Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(tinymemes): remove the tinymemes module and its submodule

Steven Enamakelcb69379d3bc3
diff --git a/.gitmodules b/.gitmodules
index 5ae0834abb..21f07bab29 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -57,9 +57,6 @@
[submodule "vendor/tinysearch"]
path = vendor/tinysearch
url = https://github.com/tinyhumansai/tinysearch.git
-[submodule "vendor/tinymemes"]
- path = vendor/tinymemes
- url = https://github.com/tinyhumansai/tinymemes.git
[submodule "vendor/tinystoragedrivers"]
path = vendor/tinystoragedrivers
url = https://github.com/tinyhumansai/tinystoragedrivers.git
diff --git a/Cargo.lock b/Cargo.lock
index 1fb77a0182..789249e833 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5784,7 +5784,6 @@ dependencies = [
"tinyflows-module",
"tinyhosts-bus",
"tinyinference-core",
- "tinyinference-decisions",
"tinyinference-embeddings",
"tinyinference-llm",
"tinyinference-local",
@@ -5793,7 +5792,6 @@ dependencies = [
"tinyjuice-bus",
"tinyjuice-host",
"tinymcp-bus",
- "tinymemes-bus",
"tinymemory-api",
"tinymemory-integrations",
"tinymemory-tools",
@@ -10235,15 +10233,6 @@ dependencies = [
"tinystoragedrivers-types",
]
-[[package]]
-name = "tinymemes-bus"
-version = "0.4.1"
-dependencies = [
- "serde",
- "serde_json",
- "tinystoragedrivers-types",
-]
-
[[package]]
name = "tinymemory-api"
version = "2.0.1"
diff --git a/Cargo.toml b/Cargo.toml
index a7e33c6881..2c792087af 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -108,7 +108,7 @@ tinystoragedrivers-testkit = { path = "vendor/tinystoragedrivers/crates/tinystor
tinystoragedrivers-types = { path = "vendor/tinystoragedrivers/crates/tinystoragedrivers-types" }
[patch."https://github.com/tinyhumansai/tinyinference"]
-# tinymemes depends on the Jev client by git; resolve it to the vendored copy.
+# tinycomputer depends on the Jev client by git; resolve it to the vendored copy.
tinyinference-decisions = { path = "vendor/tinyagents/vendor/tinyinference/crates/tinyinference-decisions" }
tinyinference-core = { path = "vendor/tinyagents/vendor/tinyinference/crates/tinyinference-core" }
tinyinference-embeddings = { path = "vendor/tinyagents/vendor/tinyinference/crates/tinyinference-embeddings" }
diff --git a/crates/openhuman-app/Cargo.lock b/crates/openhuman-app/Cargo.lock
index 7d72dde37d..9870fc29e8 100644
--- a/crates/openhuman-app/Cargo.lock
+++ b/crates/openhuman-app/Cargo.lock
@@ -4576,7 +4576,6 @@ dependencies = [
"tinyflows-bus",
"tinyhosts-bus",
"tinyinference-core",
- "tinyinference-decisions",
"tinyinference-embeddings",
"tinyinference-llm",
"tinyinference-local",
@@ -4585,7 +4584,6 @@ dependencies = [
"tinyjuice-bus",
"tinyjuice-host",
"tinymcp-bus",
- "tinymemes-bus",
"tinymemory-api",
"tinymemory-integrations",
"tinymemory-tools",
@@ -7913,19 +7911,6 @@ dependencies = [
"url",
]
-[[package]]
-name = "tinyinference-decisions"
-version = "0.5.0"
-dependencies = [
- "async-trait",
- "httpdate",
- "reqwest 0.12.28",
- "serde",
- "serde_json",
- "thiserror 2.0.21",
- "tokio",
-]
-
[[package]]
name = "tinyinference-embeddings"
version = "0.5.0"
@@ -8119,15 +8104,6 @@ dependencies = [
"tinystoragedrivers-types",
]
-[[package]]
-name = "tinymemes-bus"
-version = "0.4.1"
-dependencies = [
- "serde",
- "serde_json",
- "tinystoragedrivers-types",
-]
-
[[package]]
name = "tinymemory-api"
version = "2.0.1"
diff --git a/crates/openhuman-app/Cargo.toml b/crates/openhuman-app/Cargo.toml
index 6f314bd5c8..b555d5d378 100644
--- a/crates/openhuman-app/Cargo.toml
+++ b/crates/openhuman-app/Cargo.toml
@@ -61,8 +61,6 @@ serde_json = "1"
# silently unenforced.
# - `file-logging` — the packaged app's only durable log.
# - `hosting` — registration stays credential-gated in tools/ops.rs.
-# - `tinymemes` — compiled in; still off at runtime until `OPENHUMAN_TINYMEMES`
-# (or a build-time `OPENHUMAN_TINYMEMES_DEFAULT`) turns it on.
# - `inbound-queues` — Composio triggers and agent webhooks go through the
# `tinyeventqueues` module (durable, deduplicated, paced); without it a
# deferred triage is dropped as before.
@@ -93,7 +91,6 @@ openhuman-rpc = { path = "../openhuman-rpc", default-features = false, features
"scheduler-gate",
"file-logging",
"hosting",
- "tinymemes",
"inbound-queues",
"storage-sqlite",
"storage-file",
@@ -308,7 +305,6 @@ tinytools-std = { path = "../../vendor/tinyagents/vendor/tinytools/crates/tinyto
# Crates in this world name tinyinference by git rev; without this the shell
# world resolves TWO copies of the same types. Mirrors the root Cargo.toml.
tinyinference-core = { path = "../../vendor/tinyagents/vendor/tinyinference/crates/tinyinference-core" }
-tinyinference-decisions = { path = "../../vendor/tinyagents/vendor/tinyinference/crates/tinyinference-decisions" }
tinyinference-embeddings = { path = "../../vendor/tinyagents/vendor/tinyinference/crates/tinyinference-embeddings" }
tinyinference-llm = { path = "../../vendor/tinyagents/vendor/tinyinference/crates/tinyinference-llm" }
tinyinference-local = { path = "../../vendor/tinyagents/vendor/tinyinference/crates/tinyinference-local" }
diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.toml
index a33c519feb..b739d7217e 100644
--- a/crates/openhuman-cli/Cargo.toml
+++ b/crates/openhuman-cli/Cargo.toml
@@ -513,7 +513,6 @@ default = [
"file-logging",
"modules",
"jev",
- "tinymemes",
"inbound-queues",
"storage-sqlite",
"storage-file",
@@ -528,7 +527,6 @@ http-server = ["openhuman-rpc/http-server"]
inference = ["openhuman-rpc/inference"]
documents = ["openhuman-rpc/documents"]
hosting = ["openhuman-rpc/hosting"]
-tinymemes = ["openhuman-rpc/tinymemes"]
inbound-queues = ["openhuman-rpc/inbound-queues"]
modules = ["openhuman-rpc/modules"]
voice = ["openhuman-rpc/voice"]
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index 137116629c..8c9f84b315 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -270,13 +270,6 @@ tokio = { version = "1", features = ["full"] }
once_cell = "1.19"
parking_lot = "0.12"
log = "0.4"
-# Final-reply slang + meme remix (runtime flag OPENHUMAN_TINYMEMES, off by
-# default). The engine runs in the `tinymemes` module; the host links only its
-# `*-bus` contract (vendored submodule: vendor/tinymemes).
-tinymemes-bus = { path = "../../vendor/tinymemes/crates/tinymemes-bus", features = ["storage"], optional = true }
-# The Jev client the host serves to the module's `Evaluate` callback (managed
-# Jev over the backend's System One proxy). Not a module implementation.
-tinyinference-decisions = { path = "../../vendor/tinyagents/vendor/tinyinference/crates/tinyinference-decisions", optional = true }
# Inbound event queues: the `tinyeventqueues` module durably queues and filters
# inbound events (Composio triggers, agent webhooks) before they reach an agent.
# The host links only its `*-bus` contract (vendored submodule:
@@ -605,7 +598,7 @@ secret-file = ["tinystoragedrivers-secrets/file"]
# costs no new native builds. It matches `scripts/ci/product-features.txt`. This
# does NOT move the kernel floor: that profile is
# `--no-default-features --features flows` and never reads this list.
-default = ["media", "skills", "flows", "mcp", "channels", "http-server", "scheduler-gate", "file-logging", "modules", "tinymemes", "inbound-queues", "secret-file", "legacy-import"]
+default = ["media", "skills", "flows", "mcp", "channels", "http-server", "scheduler-gate", "file-logging", "modules", "inbound-queues", "secret-file", "legacy-import"]
# The core's domain-owned HTTP surfaces (#5048): the `/v1` OpenAI-compatible
# router (`inference::http`), the `openhuman text-input run` dev server, and the MCP
# Streamable-HTTP transport (`mcp::server::http`, additionally gated by `mcp`).
@@ -658,12 +651,6 @@ documents = ["modules", "dep:tinydocs-bus"]
# `[hosting].api_key` or the provider's environment variable — because a tool
# that cannot work is worse than a tool that is not there.
hosting = ["modules", "dep:tinyhosts-bus"]
-# TinyMemes: remixes the final reply with the user's register, regional slang
-# and, sometimes, a reaction meme. Compiled into product builds; at runtime it
-# is still off until `OPENHUMAN_TINYMEMES` (or a build-time
-# `OPENHUMAN_TINYMEMES_DEFAULT`) turns it on. Off in the minimal kernel
-# profiles, so they stay free of its dependencies.
-tinymemes = ["modules", "dep:tinymemes-bus", "dep:tinyinference-decisions"]
# Inbound event queues (`inbound` domain): Composio triggers and agent webhooks
# are ingested into the `tinyeventqueues` module, which persists, filters and
# paces them and calls the host back (`Deliver`, `ClassifySalience`) to run
diff --git a/crates/openhuman-core/src/config/schema/components.rs b/crates/openhuman-core/src/config/schema/components.rs
index cf4cb9ac8a..0c2da24cbc 100644
--- a/crates/openhuman-core/src/config/schema/components.rs
+++ b/crates/openhuman-core/src/config/schema/components.rs
@@ -20,10 +20,9 @@ use serde::{Deserialize, Serialize};
use super::defaults::default_true;
/// Names of every toggleable component, in declaration order.
-pub const COMPONENT_NAMES: [&str; 17] = [
+pub const COMPONENT_NAMES: [&str; 16] = [
"flows",
"tinyflows",
- "memes",
"documents",
"search",
"mcp",
@@ -51,9 +50,6 @@ pub struct ComponentsConfig {
/// `COMPONENT_DISABLED:tinyflows` and no scheduler runs.
#[serde(default = "default_true")]
pub tinyflows: bool,
- /// Meme remixing (tinymemes).
- #[serde(default = "default_true")]
- pub memes: bool,
/// Document extraction and generation (tinydocs).
#[serde(default = "default_true")]
pub documents: bool,
@@ -105,7 +101,6 @@ impl Default for ComponentsConfig {
Self {
flows: true,
tinyflows: true,
- memes: true,
documents: true,
search: true,
mcp: true,
@@ -130,7 +125,6 @@ impl ComponentsConfig {
Some(match name {
"flows" => self.flows,
"tinyflows" => self.tinyflows,
- "memes" => self.memes,
"documents" => self.documents,
"search" => self.search,
"mcp" => self.mcp,
@@ -154,7 +148,6 @@ impl ComponentsConfig {
let slot = match name {
"flows" => &mut self.flows,
"tinyflows" => &mut self.tinyflows,
- "memes" => &mut self.memes,
"documents" => &mut self.documents,
"search" => &mut self.search,
"mcp" => &mut self.mcp,
diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rs
index 5c433412a3..88bde26895 100644
--- a/crates/openhuman-core/src/config/schema/load/migrate.rs
+++ b/crates/openhuman-core/src/config/schema/load/migrate.rs
@@ -349,8 +349,7 @@ pub(crate) fn migrate_legacy_memory_backend(config: &mut Config, raw: &str) {
/// One-shot migration of the legacy per-dependency switches into
/// `[components]` (`hosting.enabled`, `search.enabled`, `mcp_client.enabled`,
-/// `memory.engine = "none"`, `OPENHUMAN_TINYMEMES`, `composio.mode =
-/// "disabled"`). `composio.enabled` was never read and is simply dropped with
+/// `memory.engine = "none"`, `composio.mode = "disabled"`). `composio.enabled` was never read and is simply dropped with
/// its field; `composio.mode` stays as the route selector.
///
/// A legacy switch is read from the raw TOML (so an unset key keeps its
@@ -358,14 +357,6 @@ pub(crate) fn migrate_legacy_memory_backend(config: &mut Config, raw: &str) {
/// name, which makes the migration idempotent: once saved, the explicit
/// `components.*` key wins and the legacy key is never consulted again.
pub(crate) fn migrate_components(config: &mut Config, raw: &str) {
- #[cfg(feature = "tinymemes")]
- let tinymemes = std::env::var(crate::tinymemes::FLAG_ENV).ok();
- #[cfg(not(feature = "tinymemes"))]
- let tinymemes: Option<String> = None;
- migrate_components_with(config, raw, tinymemes.as_deref());
-}
-
-pub(crate) fn migrate_components_with(config: &mut Config, raw: &str, tinymemes: Option<&str>) {
let value = toml::from_str::<toml::Value>(raw).ok();
let explicit = |name: &str| {
value
@@ -406,14 +397,6 @@ pub(crate) fn migrate_components_with(config: &mut Config, raw: &str, tinymemes:
.and_then(toml::Value::as_str)
.is_some_and(|e| e.trim().eq_ignore_ascii_case("none"));
disable(config, "memory", engine_none.then_some(false));
- #[cfg(feature = "tinymemes")]
- let memes_on = tinymemes
- .filter(|v| !v.trim().is_empty())
- .map(crate::tinymemes::flag_enabled);
- // Without the `tinymemes` gate there is no legacy flag to migrate.
- #[cfg(not(feature = "tinymemes"))]
- let memes_on = tinymemes.and(None::<bool>);
- disable(config, "memes", memes_on);
// The old tool-output compaction master switch, `[tokenjuice]
// router_enabled = false`, becomes `[components] juice = false`. The
// switch stays as a sub-setting of the on state.
@@ -466,7 +449,6 @@ pub(crate) fn migrate_components_with(config: &mut Config, raw: &str, tinymemes:
"mcp" => &["mcp_client.enabled"],
"connectors" => &["composio.mode"],
"memory" => &["memory.engine"],
- "memes" => &["OPENHUMAN_TINYMEMES"],
"juice" => &["tokenjuice.router_enabled"],
"voice" => &[
"dictation.enabled",
diff --git a/crates/openhuman-core/src/config/schema/load/parse_tests.rs b/crates/openhuman-core/src/config/schema/load/parse_tests.rs
index 737b503312..4a16f3c120 100644
--- a/crates/openhuman-core/src/config/schema/load/parse_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load/parse_tests.rs
@@ -217,3 +217,66 @@ custom_dictionary = ["OpenHuman"]
"retired dictation data must be dropped on save"
);
}
+
+/// TinyMemes left OpenHuman: a config written while it was here still carries
+/// `[components] memes` and a `[memes]` section. Both must load as ignored
+/// keys (never a parse failure or a fallback to defaults) and be dropped on
+/// the next save.
+#[tokio::test]
+async fn retired_memes_settings_load_as_ignored_keys_and_are_dropped_on_save() {
+ let dir = tempfile::tempdir().unwrap();
+ let config_path = dir.path().join("config.toml");
+ let workspace = dir.path().join("workspace");
+ std::fs::create_dir(&workspace).unwrap();
+ std::fs::write(
+ &config_path,
+ r#"
+default_model = "memes-retired-model"
+
+[components]
+memes = false
+search = false
+
+[memes]
+timeout_ms = 5000
+meme_cooldown = 7
+"#,
+ )
+ .unwrap();
+
+ let config = Config::load_from_config_path(&config_path, &workspace)
+ .await
+ .unwrap();
+ assert_eq!(config.default_model.as_deref(), Some("memes-retired-model"));
+ assert!(
+ !config.components.search,
+ "known component keys still apply"
+ );
+ assert!(
+ config.components.flows,
+ "unnamed components keep their default"
+ );
+ let diagnostics = config.load_diagnostics();
+ assert_eq!(
+ diagnostics.fallback,
+ super::super::diagnostics::ConfigLoadFallback::None
+ );
+ // An unknown section is reported once, as the section itself.
+ for key in ["components.memes", "memes"] {
+ assert!(
+ diagnostics.unknown_keys.iter().any(|k| k == key),
+ "{key} should be reported as ignored: {:?}",
+ diagnostics.unknown_keys
+ );
+ }
+
+ config.save().await.unwrap();
+ let saved: toml::Value =
+ toml::from_str(&std::fs::read_to_string(config_path).unwrap()).unwrap();
+ assert!(saved.get("memes").is_none(), "[memes] is dropped on save");
+ assert!(
+ saved["components"].get("memes").is_none(),
+ "components.memes is dropped on save"
+ );
+ assert_eq!(saved["components"]["search"].as_bool(), Some(false));
+}
diff --git a/crates/openhuman-core/src/config/schema/load_components_migration_tests.rs b/crates/openhuman-core/src/config/schema/load_components_migration_tests.rs
index 0493ffe664..309a6cb87a 100644
--- a/crates/openhuman-core/src/config/schema/load_components_migration_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load_components_migration_tests.rs
@@ -6,9 +6,9 @@ fn parse(raw: &str) -> Config {
toml::from_str(raw).expect("config parses")
}
-fn migrated(raw: &str, tinymemes: Option<&str>) -> Config {
+fn migrated(raw: &str) -> Config {
let mut c = parse(raw);
- crate::config::schema::load::migrate::migrate_components_with(&mut c, raw, tinymemes);
+ crate::config::schema::load::migrate::migrate_components(&mut c, raw);
c
}
@@ -26,34 +26,30 @@ engine = "none"
[composio]
enabled = true
"#;
- let c = migrated(raw, Some("off"));
+ let c = migrated(raw);
assert!(!c.components.hosting);
assert!(!c.components.search);
assert!(!c.components.mcp);
assert!(!c.components.memory);
- assert!(!c.components.memes);
assert_eq!(c.memory.engine, "none", "engine is kept");
assert!(c.components.flows && c.components.voice, "others stay on");
}
#[test]
fn hosting_enabled_false_alone_maps_to_components_hosting() {
- let c = migrated("[hosting]\nenabled = false\n", None);
+ let c = migrated("[hosting]\nenabled = false\n");
assert!(!c.components.hosting);
assert!(c.components.search && c.components.mcp && c.components.memory);
}
#[test]
fn enabled_or_absent_legacy_flags_change_nothing() {
- let c = migrated(
- "[hosting]\nenabled = true\n[mcp_client]\nenabled = true\n",
- Some("on"),
- );
+ let c = migrated("[hosting]\nenabled = true\n[mcp_client]\nenabled = true\n");
assert_eq!(
c.components,
crate::config::schema::ComponentsConfig::default()
);
- let c = migrated("", None);
+ let c = migrated("");
assert_eq!(
c.components,
crate::config::schema::ComponentsConfig::default()
@@ -63,17 +59,17 @@ fn enabled_or_absent_legacy_flags_change_nothing() {
#[test]
fn explicit_components_key_beats_a_legacy_flag() {
let raw = "[components]\nhosting = true\n[hosting]\nenabled = false\n";
- let c = migrated(raw, None);
+ let c = migrated(raw);
assert!(c.components.hosting);
}
#[test]
fn migration_round_trip_is_idempotent() {
let raw = "[hosting]\nenabled = false\n[mcp_client]\nenabled = false\n";
- let first = migrated(raw, None);
+ let first = migrated(raw);
let saved = toml::to_string(&first).unwrap();
// Re-load the saved text: `components` is now explicit, legacy keys inert.
- let second = migrated(&saved, None);
+ let second = migrated(&saved);
assert_eq!(first.components, second.components);
let resaved = toml::to_string(&second).unwrap();
assert_eq!(saved, resaved);
@@ -81,11 +77,11 @@ fn migration_round_trip_is_idempotent() {
#[test]
fn user_turning_a_component_back_on_survives_the_stale_legacy_key() {
- let first = migrated("[hosting]\nenabled = false\n", None);
+ let first = migrated("[hosting]\nenabled = false\n");
let mut saved: toml::Value = toml::from_str(&toml::to_string(&first).unwrap()).unwrap();
saved["components"]["hosting"] = toml::Value::Boolean(true);
let text = toml::to_string(&saved).unwrap();
- assert!(migrated(&text, None).components.hosting);
+ assert!(migrated(&text).components.hosting);
}
#[test]
@@ -99,7 +95,7 @@ fn composio_enabled_is_accepted_and_dropped() {
#[test]
fn legacy_tokenjuice_router_off_maps_to_components_juice() {
- let c = migrated("[tokenjuice]\nrouter_enabled = false\n", None);
+ let c = migrated("[tokenjuice]\nrouter_enabled = false\n");
assert!(!c.components.juice);
assert!(c.components.search && c.components.mcp && c.components.memory);
}
@@ -107,12 +103,12 @@ fn legacy_tokenjuice_router_off_maps_to_components_juice() {
#[test]
fn tokenjuice_router_on_or_absent_keeps_juice_on() {
assert!(
- migrated("[tokenjuice]\nrouter_enabled = true\n", None)
+ migrated("[tokenjuice]\nrouter_enabled = true\n")
.components
.juice
);
assert!(
- migrated("[tokenjuice]\nccr_enabled = false\n", None)
+ migrated("[tokenjuice]\nccr_enabled = false\n")
.components
.juice
);
@@ -121,14 +117,14 @@ fn tokenjuice_router_on_or_absent_keeps_juice_on() {
#[test]
fn explicit_components_juice_beats_legacy_router_flag() {
let raw = "[components]\njuice = true\n[tokenjuice]\nrouter_enabled = false\n";
- assert!(migrated(raw, None).components.juice);
+ assert!(migrated(raw).components.juice);
}
#[test]
fn juice_migration_round_trip_is_idempotent() {
- let first = migrated("[tokenjuice]\nrouter_enabled = false\n", None);
+ let first = migrated("[tokenjuice]\nrouter_enabled = false\n");
let saved = toml::to_string(&first).unwrap();
- let second = migrated(&saved, None);
+ let second = migrated(&saved);
assert!(!second.components.juice);
assert_eq!(saved, toml::to_string(&second).unwrap());
}
@@ -136,9 +132,7 @@ fn juice_migration_round_trip_is_idempotent() {
#[test]
fn voice_switches_all_explicitly_off_disable_the_voice_component() {
let c = migrated(
- "[dictation]\nenabled = false\n[voice_server]\nauto_start = false\nalways_on_enabled = false\n",
- None,
- );
+ "[dictation]\nenabled = false\n[voice_server]\nauto_start = false\nalways_on_enabled = false\n");
assert!(!c.components.voice);
assert!(c.components.flows, "others stay on");
}
@@ -146,26 +140,22 @@ fn voice_switches_all_explicitly_off_disable_the_voice_component() {
#[test]
fn voice_stays_on_when_any_legacy_voice_switch_is_on_or_unset() {
let c = migrated(
- "[dictation]\nenabled = true\n[voice_server]\nauto_start = false\nalways_on_enabled = false\n",
- None,
- );
+ "[dictation]\nenabled = true\n[voice_server]\nauto_start = false\nalways_on_enabled = false\n");
assert!(c.components.voice);
- let c = migrated("[voice_server]\nauto_start = false\n", None);
+ let c = migrated("[voice_server]\nauto_start = false\n");
assert!(c.components.voice, "unset keys are not an opt-out");
}
#[test]
fn explicit_components_voice_wins_over_legacy_voice_switches() {
let c = migrated(
- "[components]\nvoice = true\n[dictation]\nenabled = false\n[voice_server]\nauto_start = false\nalways_on_enabled = false\n",
- None,
- );
+ "[components]\nvoice = true\n[dictation]\nenabled = false\n[voice_server]\nauto_start = false\nalways_on_enabled = false\n");
assert!(c.components.voice);
}
#[test]
fn composio_mode_disabled_migrates_to_components_connectors_off() {
- let c = migrated("[composio]\nmode = \"disabled\"\n", None);
+ let c = migrated("[composio]\nmode = \"disabled\"\n");
assert!(!c.components.connectors);
assert_eq!(
c.composio.mode, "disabled",
@@ -177,23 +167,20 @@ fn composio_mode_disabled_migrates_to_components_connectors_off() {
#[test]
fn composio_backend_mode_or_explicit_components_key_keeps_connectors_on() {
assert!(
- migrated("[composio]\nmode = \"direct\"\n", None)
+ migrated("[composio]\nmode = \"direct\"\n")
.components
.connectors
);
- let c = migrated(
- "[composio]\nmode = \"disabled\"\n[components]\nconnectors = true\n",
- None,
- );
+ let c = migrated("[composio]\nmode = \"disabled\"\n[components]\nconnectors = true\n");
assert!(c.components.connectors, "explicit components key wins");
}
#[test]
fn sandbox_enabled_false_maps_to_components_sandbox() {
- let c = migrated("[sandbox]\nenabled = false\n", None);
+ let c = migrated("[sandbox]\nenabled = false\n");
assert!(!c.components.sandbox);
assert_eq!(c.sandbox.enabled, Some(false), "old key kept");
- let c = migrated("[security.sandbox]\nenabled = false\n", None);
+ let c = migrated("[security.sandbox]\nenabled = false\n");
assert!(!c.components.sandbox);
}
@@ -204,6 +191,6 @@ fn sandbox_auto_or_on_or_explicit_component_keeps_the_component_on() {
"[sandbox]\nbackend = \"auto\"\n",
"[sandbox]\nenabled = false\n[components]\nsandbox = true\n",
] {
- assert!(migrated(raw, None).components.sandbox, "{raw}");
+ assert!(migrated(raw).components.sandbox, "{raw}");
}
}
diff --git a/crates/openhuman-core/src/config/schema/memes.rs b/crates/openhuman-core/src/config/schema/memes.rs
deleted file mode 100644
index 6cdfcadb84..0000000000
--- a/crates/openhuman-core/src/config/schema/memes.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-//! `[memes]` — tuning for TinyMemes reply remixing.
-//!
-//! Whether remixing runs at all is `[components] memes`; which threads are in
-//! the treatment arm is the `OPENHUMAN_TINYMEMES` flag (`off`, `on`, `ab`,
-//! `ab:NN`, with `OPENHUMAN_TINYMEMES_DEFAULT` as the build-time default). The
-//! environment variables below stay as operator overrides and win over this
-//! section when set:
-//!
-//! | setting | override |
-//! | --- | --- |
-//! | `timeout_ms` | `OPENHUMAN_TINYMEMES_TIMEOUT_MS` |
-//! | `meme_cooldown` | `OPENHUMAN_TINYMEMES_MEME_COOLDOWN` |
-
-use schemars::JsonSchema;
-use serde::{Deserialize, Serialize};
-
-pub const DEFAULT_TIMEOUT_MS: u64 = 20_000;
-pub const DEFAULT_MEME_COOLDOWN: u32 = 3;
-
-#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
-#[serde(default)]
-pub struct MemesConfig {
- /// Time budget for one remix, in milliseconds. The original reply is
- /// delivered when it runs out.
- pub timeout_ms: u64,
- /// Replies between memes.
- pub meme_cooldown: u32,
-}
-
-impl Default for MemesConfig {
- fn default() -> Self {
- Self {
- timeout_ms: DEFAULT_TIMEOUT_MS,
- meme_cooldown: DEFAULT_MEME_COOLDOWN,
- }
- }
-}
-
-#[cfg(test)]
-#[path = "memes_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/config/schema/memes_tests.rs b/crates/openhuman-core/src/config/schema/memes_tests.rs
deleted file mode 100644
index 5ae09e2420..0000000000
--- a/crates/openhuman-core/src/config/schema/memes_tests.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-use super::*;
-
-#[test]
-fn defaults_match_the_documented_values() {
- let c = MemesConfig::default();
- assert_eq!(c.timeout_ms, 20_000);
- assert_eq!(c.meme_cooldown, 3);
-}
-
-#[test]
-fn a_partial_section_keeps_the_other_defaults() {
- let c: MemesConfig = toml::from_str("timeout_ms = 5000").unwrap();
- assert_eq!(c.timeout_ms, 5000);
- assert_eq!(c.meme_cooldown, DEFAULT_MEME_COOLDOWN);
-}
diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs
index 649d209df1..919c7f8d80 100644
--- a/crates/openhuman-core/src/config/schema/mod.rs
+++ b/crates/openhuman-core/src/config/schema/mod.rs
@@ -95,7 +95,6 @@ pub use claude_agent_sdk::ClaudeAgentSdkConfig;
mod inbound;
mod inbound_sources;
mod local_ai;
-mod memes;
pub(crate) mod memory;
mod modules;
mod observability;
@@ -133,7 +132,6 @@ pub use identity_cost::{
pub use inbound::{InboundConfig, InboundSourceConfig};
pub use inbound_debounce::{InboundDebounceConfig, InboundDebounceOverride};
pub use local_ai::{LocalAiConfig, LocalAiUsage};
-pub use memes::MemesConfig;
pub use memory::{
migrate_legacy_source, MemoryAgentConfig, MemoryConfig, MemoryConversationsConfig,
MemoryEngineSettings, MemoryLayoutMode, MemorySourceConfig, MemorySourceKind, RecallSettings,
diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rs
index cd888492cf..56a53947d0 100644
--- a/crates/openhuman-core/src/config/schema/types/config.rs
+++ b/crates/openhuman-core/src/config/schema/types/config.rs
@@ -475,10 +475,6 @@ pub struct Config {
#[serde(default)]
pub tokenjuice: TokenjuiceConfig,
- /// TinyMemes remix tuning (`[memes]`); the switch is `[components] memes`.
- #[serde(default)]
- pub memes: MemesConfig,
-
/// Inbound event queues (`[inbound]`); the switch is
/// `[components] eventqueues`.
#[serde(default)]
diff --git a/crates/openhuman-core/src/config/schema/types/config_clone.rs b/crates/openhuman-core/src/config/schema/types/config_clone.rs
index 398eb5d73f..19a8a28116 100644
--- a/crates/openhuman-core/src/config/schema/types/config_clone.rs
+++ b/crates/openhuman-core/src/config/schema/types/config_clone.rs
@@ -92,7 +92,6 @@ impl Clone for Config {
embeddings_provider: self.embeddings_provider.clone(),
custom_embeddings: self.custom_embeddings.clone(),
tokenjuice: self.tokenjuice.clone(),
- memes: self.memes.clone(),
inbound: self.inbound.clone(),
inbound_debounce: self.inbound_debounce.clone(),
components: self.components.clone(),
diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rs
index 5d0b4bdefb..b22349612c 100644
--- a/crates/openhuman-core/src/config/schema/types/defaults.rs
+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs
@@ -106,7 +106,6 @@ impl Default for Config {
embeddings_provider: None,
custom_embeddings: None,
tokenjuice: TokenjuiceConfig::default(),
- memes: MemesConfig::default(),
inbound: InboundConfig::default(),
inbound_debounce: InboundDebounceConfig::default(),
components: ComponentsConfig::default(),
diff --git a/crates/openhuman-core/src/core/runtime/components.rs b/crates/openhuman-core/src/core/runtime/components.rs
index eebc29ae12..b8a098bbe7 100644
--- a/crates/openhuman-core/src/core/runtime/components.rs
+++ b/crates/openhuman-core/src/core/runtime/components.rs
@@ -21,7 +21,6 @@ pub const COMPONENT_DISABLED: &str = "COMPONENT_DISABLED";
pub struct ComponentSet {
pub flows: bool,
pub tinyflows: bool,
- pub memes: bool,
pub documents: bool,
pub search: bool,
pub mcp: bool,
@@ -55,7 +54,6 @@ impl ComponentSet {
Self {
flows: c.flows,
tinyflows: c.tinyflows,
- memes: c.memes,
documents: c.documents,
search: c.search,
mcp: c.mcp,
@@ -83,7 +81,6 @@ impl ComponentSet {
ComponentsConfig {
flows: self.flows,
tinyflows: self.tinyflows,
- memes: self.memes,
documents: self.documents,
search: self.search,
mcp: self.mcp,
diff --git a/crates/openhuman-core/src/core/runtime/features.rs b/crates/openhuman-core/src/core/runtime/features.rs
index 4ddbea7d2f..ddbdeed20e 100644
--- a/crates/openhuman-core/src/core/runtime/features.rs
+++ b/crates/openhuman-core/src/core/runtime/features.rs
@@ -12,7 +12,6 @@ pub fn compiled_features() -> std::collections::BTreeMap<String, bool> {
("inference", cfg!(feature = "inference")),
("documents", cfg!(feature = "documents")),
("hosting", cfg!(feature = "hosting")),
- ("tinymemes", cfg!(feature = "tinymemes")),
("inbound-queues", cfg!(feature = "inbound-queues")),
("modules", cfg!(feature = "modules")),
("voice", cfg!(feature = "voice")),
diff --git a/crates/openhuman-core/src/doctor/checks/config_semantics.rs b/crates/openhuman-core/src/doctor/checks/config_semantics.rs
index 92075793e3..ed38d7cb9f 100644
--- a/crates/openhuman-core/src/doctor/checks/config_semantics.rs
+++ b/crates/openhuman-core/src/doctor/checks/config_semantics.rs
@@ -265,12 +265,6 @@ fn referenced_but_disabled(config: &Config) -> Vec<Finding> {
references.push(("hosting", "hosting"));
}
- if config.memes != crate::config::schema::MemesConfig::default()
- || explicitly_configured(config, "memes")
- {
- references.push(("memes", "memes"));
- }
-
if tokenjuice_is_custom(config) {
references.push(("juice", "tokenjuice"));
}
diff --git a/crates/openhuman-core/src/doctor/contract.rs b/crates/openhuman-core/src/doctor/contract.rs
index 99a3048ba7..11a3d6e2ae 100644
--- a/crates/openhuman-core/src/doctor/contract.rs
+++ b/crates/openhuman-core/src/doctor/contract.rs
@@ -46,7 +46,6 @@ impl DoctorTier {
pub enum ComponentId {
Flows,
Tinyflows,
- Memes,
Documents,
Search,
Mcp,
@@ -68,7 +67,6 @@ impl ComponentId {
match self {
Self::Flows => components.flows,
Self::Tinyflows => components.tinyflows,
- Self::Memes => components.memes,
Self::Documents => components.documents,
Self::Search => components.search,
Self::Mcp => components.mcp,
@@ -90,7 +88,6 @@ impl ComponentId {
match self {
Self::Flows => "flows",
Self::Tinyflows => "tinyflows",
- Self::Memes => "memes",
Self::Documents => "documents",
Self::Search => "search",
Self::Mcp => "mcp",
diff --git a/crates/openhuman-core/src/lib.rs b/crates/openhuman-core/src/lib.rs
index 9b3cbda68f..93ba3e709b 100644
--- a/crates/openhuman-core/src/lib.rs
+++ b/crates/openhuman-core/src/lib.rs
@@ -105,8 +105,6 @@ pub mod test_support;
// is handled separately.
#[allow(deprecated)]
pub mod threads;
-#[cfg(feature = "tinymemes")]
-pub mod tinymemes;
pub mod tools;
pub mod triage;
pub mod util;
diff --git a/crates/openhuman-core/src/modules/registry.rs b/crates/openhuman-core/src/modules/registry.rs
index 3a99488f8b..17c3acd3b8 100644
--- a/crates/openhuman-core/src/modules/registry.rs
+++ b/crates/openhuman-core/src/modules/registry.rs
@@ -45,8 +45,6 @@ mod records_eventqueues;
mod records_extra;
mod records_flows;
mod records_mcp_connectors;
-#[cfg(feature = "tinymemes")]
-mod records_memes;
mod records_memory_juice;
mod records_search;
mod records_voice;
@@ -66,16 +64,14 @@ use records_extra::TINYCHANNELS;
use records_extra::TINYHOSTS;
use records_flows::TINYFLOWS;
use records_mcp_connectors::{TINYCONNECTORS, TINYMCP};
-#[cfg(feature = "tinymemes")]
-use records_memes::TINYMEMES;
use records_memory_juice::TINYJUICE;
use records_search::TINYSEARCH;
#[cfg(feature = "voice")]
use records_voice::TINYVOICE;
/// Every module this build can load. The records whose contract crate is an
-/// optional dependency (`documents`, `web3`, `voice`, `hosting`, `tinymemes`, `inbound-queues`) exist
-/// only when that gate is on; a product-feature build carries all fourteen.
+/// optional dependency (`documents`, `web3`, `voice`, `hosting`, `inbound-queues`) exist
+/// only when that gate is on; a product-feature build carries all thirteen.
pub const ALL: &[ModuleRecord] = &[
TINYCOMPUTER,
TINYSEARCH,
@@ -94,8 +90,6 @@ pub const ALL: &[ModuleRecord] = &[
TINYFLOWS,
#[cfg(feature = "hosting")]
TINYHOSTS,
- #[cfg(feature = "tinymemes")]
- TINYMEMES,
#[cfg(feature = "inbound-queues")]
TINYEVENTQUEUES,
];
@@ -136,7 +130,6 @@ pub const COMPONENT_OF: &[(&str, &str)] = &[
("tinychannels", "channels"),
("tinyflows", "tinyflows"),
("tinyhosts", "hosting"),
- ("tinymemes", "memes"),
("tinyeventqueues", "eventqueues"),
];
diff --git a/crates/openhuman-core/src/modules/registry/README.md b/crates/openhuman-core/src/modules/registry/README.md
index 77bc3aa83a..b55658a533 100644
--- a/crates/openhuman-core/src/modules/registry/README.md
+++ b/crates/openhuman-core/src/modules/registry/README.md
@@ -24,7 +24,6 @@ values for a family of related modules:
- [`records_extra.rs`](./records_extra.rs): `TINYBOX`, `TINYCHANNELS`, `TINYHOSTS`.
- [`records_flows.rs`](./records_flows.rs): `TINYFLOWS` (scheduler runtime, cron store and schedule maths; authoring).
- [`records_mcp_connectors.rs`](./records_mcp_connectors.rs): `TINYCONNECTORS`, `TINYMCP`.
-- [`records_memes.rs`](./records_memes.rs): `TINYMEMES`.
- `records_juice.rs`: `TINYJUICE`.
- [`records_search.rs`](./records_search.rs): `TINYSEARCH`.
- [`records_voice.rs`](./records_voice.rs): `TINYVOICE`.
diff --git a/crates/openhuman-core/src/modules/registry/records_memes.rs b/crates/openhuman-core/src/modules/registry/records_memes.rs
deleted file mode 100644
index d3aa1abe7c..0000000000
--- a/crates/openhuman-core/src/modules/registry/records_memes.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-//! Registry record for the `tinymemes` module.
-
-use crate::modules::types::{LoadPolicy, ModuleRecord, PlatformAsset, SourceSpec};
-
-/// The `tinymemes` module: final-reply slang and meme remixing, loaded on
-/// first use. The host serves the callbacks it asks for (inference, Jev,
-/// search, index storage, delivery).
-pub(crate) const TINYMEMES: ModuleRecord = ModuleRecord {
- id: "tinymemes",
- description: "Final-reply slang and meme remixing through TinyMemes",
- bus_name: tinymemes_bus::STATE_INTERFACE,
- object_path: tinymemes_bus::STATE_PATH,
- version: "0.4.1",
- release_url: "https://github.com/tinyhumansai/tinymemes/releases/tag/v0.4.1",
- assets: &[
- PlatformAsset {
- host_key: "macos-15-arm64",
- archive: "tinymemes-module-0.4.1-macos-15-arm64.tar.gz",
- sha256: "9ef332dfb479260567b4fbf12734d21d635cd6182b338474a5895cafa2093c19",
- },
- PlatformAsset {
- host_key: "macos-15-x86_64",
- archive: "tinymemes-module-0.4.1-macos-15-x86_64.tar.gz",
- sha256: "dac379e4fa92152644b1e22191614e5424b58ad04cce9f3baadbb9c9e8463a56",
- },
- PlatformAsset {
- host_key: "macos-26-arm64",
- archive: "tinymemes-module-0.4.1-macos-26-arm64.tar.gz",
- sha256: "7023133d6f88bceea185850da3a9c52a9a0a1ce0f3a065e1095087ac3303b564",
- },
- PlatformAsset {
- host_key: "macos-26-x86_64",
- archive: "tinymemes-module-0.4.1-macos-26-x86_64.tar.gz",
- sha256: "372eb95b30bc7ce3accc893b3a7cdbe6812bfd2a7bbe65c62c19f07ef7d8f10c",
- },
- PlatformAsset {
- host_key: "ubuntu-22.04-arm64",
- archive: "tinymemes-module-0.4.1-ubuntu-22.04-arm64.tar.gz",
- sha256: "92dc4a49608aaca0a83f6c50da4a6da5e726b60665a9424441e40cb1d616f652",
- },
- PlatformAsset {
- host_key: "ubuntu-22.04-x86_64",
- archive: "tinymemes-module-0.4.1-ubuntu-22.04-x86_64.tar.gz",
- sha256: "55060d251d04b62683f0443994f9376b12295f3ac0848258a6faa202fffef781",
- },
- PlatformAsset {
- host_key: "ubuntu-24.04-arm64",
- archive: "tinymemes-module-0.4.1-ubuntu-24.04-arm64.tar.gz",
- sha256: "c978dcd8e5ed355449785d94817cdaf009208cf4a1a4e7d8c8bc687bffcc0e40",
- },
- PlatformAsset {
- host_key: "ubuntu-24.04-x86_64",
- archive: "tinymemes-module-0.4.1-ubuntu-24.04-x86_64.tar.gz",
- sha256: "8612106d61a42c59a7e74e0476705285cf0ad917aa5b6ea26e86c05f4d666c76",
- },
- PlatformAsset {
- host_key: "windows-11-arm64",
- archive: "tinymemes-module-0.4.1-windows-11-arm64.zip",
- sha256: "bac64bbe575a7053232293051a6a45de6e4503d77a83da15de8b957123cf361b",
- },
- PlatformAsset {
- host_key: "windows-2022-x86_64",
- archive: "tinymemes-module-0.4.1-windows-2022-x86_64.zip",
- sha256: "a00ddc84ca3232e04613a658bd2766b0bbe2fda77d7b07285706cf65d1a85a03",
- },
- PlatformAsset {
- host_key: "windows-2025-x86_64",
- archive: "tinymemes-module-0.4.1-windows-2025-x86_64.zip",
- sha256: "8279337613b7984340ba3e0b1dfdfe17bd046e013b467152d21fa151933a1639",
- },
- ],
- load: LoadPolicy::Lazy,
- source: SourceSpec {
- submodule: "tinymemes",
- manifest: "crates/tinymemes-module/Cargo.toml",
- package: "tinymemes-module",
- lib_name: "tinymemes_module",
- features: &[],
- },
-};
diff --git a/crates/openhuman-core/src/modules/registry_contract_tests.rs b/crates/openhuman-core/src/modules/registry_contract_tests.rs
index bb6d64acd7..fe4762e6cf 100644
--- a/crates/openhuman-core/src/modules/registry_contract_tests.rs
+++ b/crates/openhuman-core/src/modules/registry_contract_tests.rs
@@ -75,12 +75,6 @@ fn contract_names() -> Vec<(&'static str, &'static str, &'static str)> {
tinyhosts_bus::BUS_NAME,
tinyhosts_bus::OBJECT_PATH,
));
- #[cfg(feature = "tinymemes")]
- names.push((
- "tinymemes",
- tinymemes_bus::STATE_INTERFACE,
- tinymemes_bus::STATE_PATH,
- ));
#[cfg(feature = "inbound-queues")]
names.push((
"tinyeventqueues",
@@ -121,12 +115,11 @@ fn a_drifted_contract_constant_is_reported_as_a_mismatch() {
feature = "web3",
feature = "voice",
feature = "hosting",
- feature = "tinymemes",
feature = "inbound-queues"
))]
#[test]
-fn a_product_feature_build_carries_all_fourteen_records() {
- assert_eq!(ALL.len(), 14);
+fn a_product_feature_build_carries_all_thirteen_records() {
+ assert_eq!(ALL.len(), 13);
for id in [
"tinycomputer",
"tinysearch",
@@ -140,7 +133,6 @@ fn a_product_feature_build_carries_all_fourteen_records() {
"tinychannels",
"tinyflows",
"tinyhosts",
- "tinymemes",
"tinyeventqueues",
] {
assert!(find(id).is_some(), "{id} missing from the registry");
@@ -163,12 +155,7 @@ fn every_record_maps_to_a_real_component() {
|| !cfg!(feature = "modules")
|| matches!(
*id,
- "tinydocs"
- | "tinywallet"
- | "tinyvoice"
- | "tinyhosts"
- | "tinymemes"
- | "tinyeventqueues"
+ "tinydocs" | "tinywallet" | "tinyvoice" | "tinyhosts" | "tinyeventqueues"
),
"mapping for unknown module '{id}'"
);
diff --git a/crates/openhuman-core/src/modules/runtime.rs b/crates/openhuman-core/src/modules/runtime.rs
index cc6a93afe6..7a0227df14 100644
--- a/crates/openhuman-core/src/modules/runtime.rs
+++ b/crates/openhuman-core/src/modules/runtime.rs
@@ -115,14 +115,6 @@ async fn install_callbacks(runtime: &'static ModuleRuntime) -> tinybus::Result<(
}
super::site_memory_host::install(connection).await?;
super::storage_host::install(connection, runtime.host()).await?;
- #[cfg(feature = "tinymemes")]
- {
- if host.components().memes {
- crate::tinymemes::service::install(connection).await?;
- } else {
- tracing::debug!("[modules] memes component off; Host callbacks not served");
- }
- }
#[cfg(feature = "web3")]
super::wallet_host::install(connection).await?;
// Deliver / ClassifySalience for the inbound event queues; with the
diff --git a/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs b/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs
index 76c0a037ed..f883a5a81a 100644
--- a/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs
+++ b/crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs
@@ -13,16 +13,6 @@ Capability {
status: CapabilityStatus::Beta,
privacy: IMAGE_TO_BACKEND,
},
-Capability {
- id: "conversation.reply_remix",
- name: "Slang and Meme Replies",
- domain: "conversation",
- category: CapabilityCategory::Conversation,
- description: "When the chat can take it, the assistant's final reply comes back in your own language and register with regional slang and sometimes a reaction meme. Serious chats are never touched, and the original reply goes out whenever remixing fails or runs out of time. After a reply is delivered, slang and meme research can run in the background through web search. Runs in the TinyMemes module; off unless the TinyMemes flag selects the thread.",
- how_to: "Configured with [components] memes and [memes] in config.toml; the OPENHUMAN_TINYMEMES flag selects threads",
- status: CapabilityStatus::Beta,
- privacy: REMIX_TO_PROVIDERS,
- },
Capability {
id: "conversation.create",
name: "Create Conversations",
diff --git a/crates/openhuman-core/src/platform/about_app/catalog_data.rs b/crates/openhuman-core/src/platform/about_app/catalog_data.rs
index 50fb58b675..098bfb92cd 100644
--- a/crates/openhuman-core/src/platform/about_app/catalog_data.rs
+++ b/crates/openhuman-core/src/platform/about_app/catalog_data.rs
@@ -28,23 +28,6 @@ const DESKTOP_TO_JEV: Option<CapabilityPrivacy> = Some(CapabilityPrivacy {
],
});
-// Reply remixing sends the chat and the reply to the inference provider and
-// Jev; background slang and meme research sends short queries derived from the
-// chat to the configured web search provider and fetches GIF pages and media.
-// The `TINYMEMES_*` overrides can route the rewrite model, research and Jev
-// straight to OpenRouter, TypeSafe or OpenJEV instead.
-const REMIX_TO_PROVIDERS: Option<CapabilityPrivacy> = Some(CapabilityPrivacy {
- leaves_device: true,
- data_kind: PrivacyDataKind::Raw,
- destinations: &[
- "Configured OpenHuman inference provider",
- "TinyHumans OpenRouter Jev proxy",
- "OpenRouter, TypeSafe or OpenJEV (only when a TINYMEMES_* override selects them)",
- "Configured web search provider (research queries)",
- "GIPHY and Imgflip (reaction GIF pages and media)",
- ],
-});
-
const DERIVED_TO_BACKEND: Option<CapabilityPrivacy> = Some(CapabilityPrivacy {
leaves_device: true,
data_kind: PrivacyDataKind::Derived,
diff --git a/crates/openhuman-core/src/platform/about_app/ops.rs b/crates/openhuman-core/src/platform/about_app/ops.rs
index 48ad61ca43..ed0810aa97 100644
--- a/crates/openhuman-core/src/platform/about_app/ops.rs
+++ b/crates/openhuman-core/src/platform/about_app/ops.rs
@@ -22,11 +22,10 @@ pub fn component_for_domain(domain: &str) -> Option<&'static str> {
/// `capability`, marked [`CapabilityStatus::Disabled`] when its component is
/// off in `components`.
pub fn apply_components(capability: Capability, components: &ComponentSet) -> Capability {
- // The sandbox and reply-remix capabilities live in the shared `security`
- // and `conversation` domains, so they are matched by id.
+ // The sandbox capability lives in the shared `security` domain, so it is
+ // matched by id.
let component = match capability.id {
"security.sandbox_backends" => Some("sandbox"),
- "conversation.reply_remix" => Some("memes"),
"automation.inbound_event_queues" => Some("eventqueues"),
// Scheduled jobs run in the tinyflows module.
"automation.view_cron_jobs"
diff --git a/crates/openhuman-core/src/platform/about_app/ops_tests.rs b/crates/openhuman-core/src/platform/about_app/ops_tests.rs
index 033c2b7156..703b44eb6c 100644
--- a/crates/openhuman-core/src/platform/about_app/ops_tests.rs
+++ b/crates/openhuman-core/src/platform/about_app/ops_tests.rs
@@ -54,20 +54,6 @@ fn sandbox_capability_shows_disabled_when_sandbox_component_is_off() {
assert_eq!(apply_components(cap, &off("voice")).status, cap.status);
}
-#[test]
-fn reply_remix_capability_shows_disabled_when_the_memes_component_is_off() {
- let cap = super::super::lookup("conversation.reply_remix").expect("reply remix capability");
- assert_ne!(cap.status, CapabilityStatus::Disabled);
- assert_eq!(
- apply_components(cap, &off("memes")).status,
- CapabilityStatus::Disabled
- );
- // Other conversation capabilities do not follow the memes switch.
- let send = super::super::lookup("conversation.send_text").expect("send_text");
- assert_eq!(apply_components(send, &off("memes")).status, send.status);
- assert_eq!(apply_components(cap, &off("voice")).status, cap.status);
-}
-
#[test]
fn inbound_queue_capability_shows_disabled_when_the_eventqueues_component_is_off() {
let cap = super::super::lookup("automation.inbound_event_queues").expect("inbound queues");
diff --git a/crates/openhuman-core/src/storage/schema.rs b/crates/openhuman-core/src/storage/schema.rs
index 976851098d..650b24199e 100644
--- a/crates/openhuman-core/src/storage/schema.rs
+++ b/crates/openhuman-core/src/storage/schema.rs
@@ -81,12 +81,6 @@ fn declared_collections() -> Vec<CollectionOwner> {
.collect(),
));
- #[cfg(feature = "tinymemes")]
- owners.push(owner(
- "tinymemes-bus",
- tinymemes_bus::storage::collections(),
- ));
-
#[cfg(feature = "inbound-queues")]
owners.push(owner(
"tinyeventqueues-bus",
@@ -153,10 +147,6 @@ pub fn module_collections(owner: &str) -> Vec<CollectionSpec> {
.collect(),
);
}
- #[cfg(feature = "tinymemes")]
- if owner == "memes" {
- return module_owned_collections(tinymemes_bus::storage::collections());
- }
#[cfg(feature = "inbound-queues")]
if owner == "teq" {
return module_owned_collections(tinyeventqueues_bus::storage::collection_specs());
diff --git a/crates/openhuman-core/src/tinymemes/arm.rs b/crates/openhuman-core/src/tinymemes/arm.rs
deleted file mode 100644
index 1413031418..0000000000
--- a/crates/openhuman-core/src/tinymemes/arm.rs
+++ /dev/null
@@ -1,126 +0,0 @@
-//! Which turns get remixed: the `OPENHUMAN_TINYMEMES` flag and its A/B split.
-//!
-//! | value | behaviour |
-//! | --- | --- |
-//! | unset, `off`, `0`, `false` | disabled; no tinymemes work at all |
-//! | `on`, `1`, `true` | every thread is in the treatment arm |
-//! | `ab` | 50% of threads are treatment, the rest control |
-//! | `ab:NN` | NN% of threads are treatment |
-//!
-//! Assignment is by a stable hash of the thread id, so a thread keeps its arm
-//! for its whole life and across restarts. The flag is read on every turn, so
-//! it can change without a restart.
-//!
-//! A build can ship with a different default: set `OPENHUMAN_TINYMEMES_DEFAULT`
-//! (same values) in the environment of the `cargo build` that produces the
-//! release, and it is baked in. The runtime `OPENHUMAN_TINYMEMES` still wins
-//! whenever it is set, so a deployment can always be switched back off.
-
-pub(crate) const FLAG_ENV: &str = "OPENHUMAN_TINYMEMES";
-
-/// Default baked in at build time (`OPENHUMAN_TINYMEMES_DEFAULT` during
-/// `cargo build`); `None` means off.
-const BUILD_DEFAULT: Option<&str> = option_env!("OPENHUMAN_TINYMEMES_DEFAULT");
-
-/// Parsed flag value.
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub(crate) enum Mode {
- Off,
- On,
- Ab { percent: u8 },
-}
-
-/// The arm a thread is in.
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub(crate) enum Arm {
- /// Feature off: nothing runs and nothing is logged per turn.
- Disabled,
- /// In an experiment, not remixed. Logged for the throughput comparison.
- Control,
- /// Remixed.
- Treatment,
-}
-
-impl Arm {
- pub(crate) fn as_str(self) -> &'static str {
- match self {
- Arm::Disabled => "disabled",
- Arm::Control => "control",
- Arm::Treatment => "treatment",
- }
- }
-}
-
-pub(crate) fn mode_from(value: Option<&str>) -> Mode {
- let Some(raw) = value.map(|v| v.trim().to_ascii_lowercase()) else {
- return Mode::Off;
- };
- match raw.as_str() {
- "" | "off" | "0" | "false" | "no" => Mode::Off,
- "on" | "1" | "true" | "yes" => Mode::On,
- "ab" => Mode::Ab { percent: 50 },
- // Any all-digit percentage above 100 means 100, including one too
- // large for `u64`.
- other => match other.strip_prefix("ab:").map(str::trim) {
- Some(digits) if !digits.is_empty() && digits.bytes().all(|b| b.is_ascii_digit()) => {
- Mode::Ab {
- percent: digits.parse::<u64>().map_or(100, |n| n.min(100)) as u8,
- }
- }
- _ => {
- log::warn!("[tinymemes] unrecognised {FLAG_ENV} value; treating as off");
- Mode::Off
- }
- },
- }
-}
-
-pub(crate) fn mode() -> Mode {
- resolve_mode(std::env::var(FLAG_ENV).ok().as_deref(), BUILD_DEFAULT)
-}
-
-/// The runtime value when set, else the build-time default, else off.
-pub(crate) fn resolve_mode(runtime: Option<&str>, build_default: Option<&str>) -> Mode {
- match runtime {
- Some(value) => mode_from(Some(value)),
- None => mode_from(build_default),
- }
-}
-
-/// Stable 0..100 bucket for a thread (FNV-1a, so it does not change between
-/// builds or platforms the way `DefaultHasher` may).
-pub(crate) fn bucket(thread_id: &str) -> u8 {
- let mut hash: u64 = 0xcbf2_9ce4_8422_2325;
- for byte in thread_id.as_bytes() {
- hash ^= u64::from(*byte);
- hash = hash.wrapping_mul(0x0100_0000_01b3);
- }
- (hash % 100) as u8
-}
-
-/// The arm for a thread under `config`: the `[components] memes` switch is the
-/// master, and the flag's arm is honoured only while the component is on.
-pub(crate) fn arm_for(config: &crate::config::Config, mode: Mode, thread_id: &str) -> Arm {
- if !config.components.memes {
- return Arm::Disabled;
- }
- assign(mode, thread_id)
-}
-
-pub(crate) fn assign(mode: Mode, thread_id: &str) -> Arm {
- match mode {
- Mode::Off => Arm::Disabled,
- Mode::On => Arm::Treatment,
- Mode::Ab { percent } => {
- if bucket(thread_id) < percent {
- Arm::Treatment
- } else {
- Arm::Control
- }
- }
- }
-}
-
-#[cfg(test)]
-#[path = "arm_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/tinymemes/arm_tests.rs b/crates/openhuman-core/src/tinymemes/arm_tests.rs
deleted file mode 100644
index a8612684ea..0000000000
--- a/crates/openhuman-core/src/tinymemes/arm_tests.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-use super::*;
-
-#[test]
-fn flag_values_parse() {
- assert_eq!(mode_from(None), Mode::Off);
- assert_eq!(mode_from(Some("off")), Mode::Off);
- assert_eq!(mode_from(Some(" ON ")), Mode::On);
- assert_eq!(mode_from(Some("1")), Mode::On);
- assert_eq!(mode_from(Some("ab")), Mode::Ab { percent: 50 });
- assert_eq!(mode_from(Some("ab:20")), Mode::Ab { percent: 20 });
- assert_eq!(mode_from(Some("ab:300")), Mode::Ab { percent: 100 });
- assert_eq!(mode_from(Some("ab:99999")), Mode::Ab { percent: 100 });
- assert_eq!(
- mode_from(Some("ab:18446744073709551616")),
- Mode::Ab { percent: 100 }
- );
- assert_eq!(mode_from(Some("ab:")), Mode::Off);
- assert_eq!(mode_from(Some("ab:-5")), Mode::Off);
- assert_eq!(mode_from(Some("ab:250")), Mode::Ab { percent: 100 });
- assert_eq!(mode_from(Some("ab:100")), Mode::Ab { percent: 100 });
- assert_eq!(mode_from(Some("sometimes")), Mode::Off);
-}
-
-#[test]
-fn assignment_is_stable_and_respects_the_split() {
- assert_eq!(assign(Mode::Off, "t"), Arm::Disabled);
- assert_eq!(assign(Mode::On, "t"), Arm::Treatment);
- assert_eq!(assign(Mode::Ab { percent: 0 }, "t"), Arm::Control);
- assert_eq!(assign(Mode::Ab { percent: 100 }, "t"), Arm::Treatment);
-
- let a = assign(Mode::Ab { percent: 50 }, "thread-abc");
- for _ in 0..10 {
- assert_eq!(assign(Mode::Ab { percent: 50 }, "thread-abc"), a);
- }
-
- let treated = (0..2000)
- .filter(|i| assign(Mode::Ab { percent: 30 }, &format!("thread-{i}")) == Arm::Treatment)
- .count();
- assert!((450..750).contains(&treated), "treated={treated}");
-}
-
-#[test]
-fn bucket_is_fixed_across_builds() {
- // FNV-1a is specified, so this value must never change; a change would
- // silently move live threads between arms.
- assert_eq!(bucket("thread-abc"), 56);
- assert_eq!(bucket(""), (0xcbf2_9ce4_8422_2325_u64 % 100) as u8);
-}
-
-#[test]
-fn runtime_flag_overrides_the_build_default() {
- assert_eq!(resolve_mode(None, None), Mode::Off);
- assert_eq!(resolve_mode(None, Some("on")), Mode::On);
- assert_eq!(resolve_mode(None, Some("ab:30")), Mode::Ab { percent: 30 });
- // A deployment can always switch a shipped default back off.
- assert_eq!(resolve_mode(Some("off"), Some("on")), Mode::Off);
- assert_eq!(
- resolve_mode(Some("ab"), Some("on")),
- Mode::Ab { percent: 50 }
- );
-}
-
-#[test]
-fn arms_have_log_names() {
- assert_eq!(Arm::Disabled.as_str(), "disabled");
- assert_eq!(Arm::Control.as_str(), "control");
- assert_eq!(Arm::Treatment.as_str(), "treatment");
- // The live flag resolves without panicking whatever the environment holds.
- let _ = mode();
-}
diff --git a/crates/openhuman-core/src/tinymemes/callbacks.rs b/crates/openhuman-core/src/tinymemes/callbacks.rs
deleted file mode 100644
index cf2a2b9c64..0000000000
--- a/crates/openhuman-core/src/tinymemes/callbacks.rs
+++ /dev/null
@@ -1,305 +0,0 @@
-//! What the module asks of the host while it works on a remix: one
-//! completion, one Jev evaluation, one web search, and the learned-state
-//! documents ([`super::docs`]).
-//!
-//! Every callback carries the correlation id of the remix it belongs to (the
-//! module echoes the one the host put in the request). A [`Registry`] entry
-//! per id holds that remix's workspace, so remixes for different workspaces
-//! run side by side and a callback with no live id is refused. An entry lives
-//! until the module reports the request finished with `End` (background
-//! research can outlast the call), or is swept after [`MAX_AGE`].
-
-use std::collections::HashMap;
-use std::future::Future;
-use std::sync::{Arc, LazyLock, Mutex};
-use std::time::{Duration, Instant};
-
-use serde::de::DeserializeOwned;
-use serde_json::Value;
-use tinyinference_decisions::{Client, EvaluationRequest};
-use tinymemes_bus::{
- host_methods, CompleteRequest, EvaluateEnvelope, HostFailure, HostResult, IndexKind,
- LoadIndexRequest, SaveIndexRequest, SearchRequest,
-};
-
-use super::{docs, inference, jev, search};
-use crate::config::Config;
-use crate::core::runtime::{CoreContext, DispatchCtx};
-
-/// How long an entry may live without its `End`.
-const MAX_AGE: Duration = Duration::from_secs(15 * 60);
-
-/// The workspace one remix runs for, and who it runs for.
-///
-/// Callbacks arrive on the module bus, outside the task that asked for the
-/// remix, so the caller's context is captured when the remix is registered and
-/// re-entered for each callback ([`Session::enter`]). A remix acts for the
-/// host, never for an agent, so there is no memory identity to carry.
-/// Only the caller's own scope counts, so in SaaS an unscoped caller's
-/// callbacks fail closed instead of acting as the operator.
-pub(super) struct Session {
- config: Config,
- jev: tokio::sync::OnceCell<Option<Arc<Client>>>,
- context: Option<Arc<CoreContext>>,
-}
-
-impl Session {
- /// The dispatch context the registering caller runs under; the host's own
- /// when it had none (a single-user process), which fails closed in SaaS.
- pub(super) fn dispatch_ctx(&self) -> DispatchCtx {
- match self.context.clone() {
- Some(context) => DispatchCtx::new(context),
- None => DispatchCtx::host_default(),
- }
- }
-
- pub(super) fn new(ctx: &DispatchCtx, config: &Config) -> Self {
- Self {
- config: config.clone(),
- jev: tokio::sync::OnceCell::new(),
- // Only the caller's own context is carried. Without one, a
- // single-user process falls back to its default context on the
- // callback side as anywhere else, and SaaS fails closed.
- context: ctx.core().cloned(),
- }
- }
-
- /// Run `fut` as the registering caller.
- pub(super) async fn enter<F: Future>(&self, fut: F) -> F::Output {
- let fut = Box::pin(fut);
- match self.context.clone() {
- Some(context) => CoreContext::scope(context, fut).await,
- None => fut.await,
- }
- }
-}
-
-struct Entry {
- session: Arc<Session>,
- registered: Instant,
-}
-
-static REGISTRY: LazyLock<Mutex<HashMap<String, Entry>>> = LazyLock::new(Mutex::default);
-
-fn registry() -> std::sync::MutexGuard<'static, HashMap<String, Entry>> {
- REGISTRY.lock().unwrap_or_else(|e| e.into_inner())
-}
-
-/// A registered remix. Dropping it forgets the remix unless it was
-/// [`kept`](Self::keep_for_background) for research that runs on after the
-/// call returns.
-pub(super) struct Registration {
- correlation: String,
- keep: bool,
-}
-
-impl Registration {
- /// The id to put in the request.
- pub(super) fn correlation(&self) -> &str {
- &self.correlation
- }
-
- /// The call succeeded: leave the entry for the module's `End`.
- pub(super) fn keep_for_background(mut self) {
- self.keep = true;
- }
-}
-
-impl Drop for Registration {
- fn drop(&mut self) {
- if !self.keep {
- registry().remove(&self.correlation);
- }
- }
-}
-
-/// Register a remix for `config`'s workspace under a fresh correlation id.
-pub(super) fn register(ctx: &DispatchCtx, config: &Config) -> Registration {
- let correlation = uuid::Uuid::new_v4().to_string();
- let mut sessions = registry();
- sessions.retain(|_, entry| entry.registered.elapsed() < MAX_AGE);
- sessions.insert(
- correlation.clone(),
- Entry {
- session: Arc::new(Session::new(ctx, config)),
- registered: Instant::now(),
- },
- );
- Registration {
- correlation,
- keep: false,
- }
-}
-
-/// The session a callback answers for, if its remix is still registered.
-pub(super) fn session(correlation: &str) -> Option<Arc<Session>> {
- registry()
- .get(correlation)
- .map(|entry| entry.session.clone())
-}
-
-/// The module finished this remix: forget it.
-pub(super) fn end(correlation: &str) {
- if registry().remove(correlation).is_some() {
- log::debug!("[tinymemes] remix ended correlation={correlation}");
- }
-}
-
-/// How many registered remixes belong to `workspace`; tests use a unique
-/// workspace so parallel tests cannot disturb the count.
-#[cfg(test)]
-pub(super) fn live_for(workspace: &std::path::Path) -> usize {
- registry()
- .values()
- .filter(|entry| entry.session.config.workspace_dir == workspace)
- .count()
-}
-
-/// The correlation id a callback payload carries (`[ { "correlation": .. } ]`).
-pub(super) fn correlation_of(payload: &Value) -> Option<&str> {
- payload
- .as_array()?
- .first()?
- .get("correlation")?
- .as_str()
- .filter(|c| !c.is_empty())
-}
-
-fn args<T: DeserializeOwned>(value: Value) -> Result<T, tinybus::Error> {
- let (request,): (T,) = serde_json::from_value(value)
- .map_err(|_| tinybus::Error::failed("invalid tinymemes host request"))?;
- Ok(request)
-}
-
-fn reply<T: serde::Serialize>(result: HostResult<T>) -> Result<Value, tinybus::Error> {
- serde_json::to_value(result)
- .map_err(|_| tinybus::Error::failed("invalid tinymemes host response"))
-}
-
-/// Answer one host callback for `session`.
-pub(super) async fn dispatch(
- session: &Session,
- member: &str,
- payload: Value,
-) -> Result<Value, tinybus::Error> {
- log::debug!("[tinymemes] host callback member={member}");
- session.enter(answer(session, member, payload)).await
-}
-
-async fn answer(session: &Session, member: &str, payload: Value) -> Result<Value, tinybus::Error> {
- match member {
- host_methods::COMPLETE => reply(complete(session, args(payload)?).await),
- host_methods::EVALUATE => reply(evaluate(session, args(payload)?).await),
- host_methods::SEARCH => reply(search(session, args(payload)?).await),
- host_methods::LOAD_INDEX => reply(load_index(session, args(payload)?).await),
- host_methods::SAVE_INDEX => reply(save_index(session, args(payload)?).await),
- // The remixed text is returned to the caller, which delivers it
- // itself; nothing is handed over through the module.
- host_methods::DELIVER => reply(HostResult::Ok(())),
- host_methods::END => {
- if let Some(correlation) = correlation_of(&payload) {
- end(correlation);
- }
- reply(HostResult::Ok(()))
- }
- _ => Err(tinybus::Error::failed("unknown tinymemes host operation")),
- }
-}
-
-async fn complete(session: &Session, request: CompleteRequest) -> HostResult<String> {
- inference::complete(
- &session.dispatch_ctx(),
- &session.config,
- &request.system,
- &request.user,
- )
- .await
- .map_err(|error| {
- log::warn!("[tinymemes] complete callback failed: {error}");
- HostFailure::Backend
- })
-}
-
-async fn evaluate(session: &Session, envelope: EvaluateEnvelope) -> HostResult<EvaluateEnvelope> {
- let Some(client) = session
- .jev
- .get_or_init(|| async { jev::managed(&session.config) })
- .await
- else {
- log::debug!("[tinymemes] evaluate callback: managed jev unavailable");
- return Err(HostFailure::Unsupported);
- };
- let request: EvaluationRequest =
- serde_json::from_value(envelope.body).map_err(|_| HostFailure::Unsupported)?;
- let result = client.evaluate(&request).await.map_err(|error| {
- log::warn!("[tinymemes] evaluate callback failed: {error}");
- HostFailure::Backend
- })?;
- let body = serde_json::to_value(result.response).map_err(|_| HostFailure::Backend)?;
- Ok(EvaluateEnvelope {
- correlation: String::new(),
- body,
- })
-}
-
-async fn search(
- session: &Session,
- request: SearchRequest,
-) -> HostResult<Vec<tinymemes_bus::SearchResult>> {
- let Some(backend) =
- search::OpenHumanSearch::available(&session.dispatch_ctx(), &session.config)
- else {
- return Err(HostFailure::Unsupported);
- };
- backend
- .search(&request.query, request.max_results as usize)
- .await
- .map_err(|error| {
- // The query is derived from the chat, so only the error is logged.
- log::warn!("[tinymemes] search callback failed: {error}");
- HostFailure::Backend
- })
-}
-
-async fn load_index(session: &Session, request: LoadIndexRequest) -> HostResult<Option<String>> {
- let config = session.config.clone();
- let kind: IndexKind = request.kind;
- match session
- .dispatch_ctx()
- .spawn_blocking(move || docs::load(&config, kind))
- .await
- {
- Ok(Ok(document)) => Ok(document),
- Ok(Err(error)) => {
- log::warn!("[tinymemes] cannot read index: {error}");
- Err(HostFailure::Backend)
- }
- Err(error) => {
- log::warn!("[tinymemes] index read task failed: {error}");
- Err(HostFailure::Backend)
- }
- }
-}
-
-async fn save_index(session: &Session, request: SaveIndexRequest) -> HostResult<()> {
- let config = session.config.clone();
- match session
- .dispatch_ctx()
- .spawn_blocking(move || docs::save(&config, request.kind, request.json))
- .await
- {
- Ok(Ok(())) => Ok(()),
- Ok(Err(error)) => {
- log::warn!("[tinymemes] cannot save index: {error}");
- Err(HostFailure::Backend)
- }
- Err(error) => {
- log::warn!("[tinymemes] index write task failed: {error}");
- Err(HostFailure::Backend)
- }
- }
-}
-
-#[cfg(test)]
-#[path = "callbacks_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs b/crates/openhuman-core/src/tinymemes/callbacks_tests.rs
deleted file mode 100644
index c89614746e..0000000000
--- a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs
+++ /dev/null
@@ -1,187 +0,0 @@
-use super::*;
-use serde_json::json;
-
-fn config_in(dir: &std::path::Path) -> Config {
- let mut config = Config::default();
- config.config_path = dir.join("config.toml");
- config.workspace_dir = dir.join("workspace");
- config.secrets.encrypt = false;
- config
-}
-
-fn decode<T: DeserializeOwned>(value: Value) -> HostResult<T> {
- serde_json::from_value(value).unwrap()
-}
-
-#[tokio::test]
-async fn an_index_saved_through_the_host_loads_back_per_kind() {
- let dir = tempfile::tempdir().unwrap();
- let session = Session::new(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir.path()),
- );
-
- let missing = dispatch(
- &session,
- host_methods::LOAD_INDEX,
- json!([{ "kind": "slang" }]),
- )
- .await
- .unwrap();
- assert_eq!(decode::<Option<String>>(missing), Ok(None));
-
- for (kind, body) in [
- ("slang", "{\"terms\":1}"),
- ("memes", "{\"memes\":2}"),
- ("remixed", "[\"m1\"]"),
- ] {
- let saved = dispatch(
- &session,
- host_methods::SAVE_INDEX,
- json!([{ "kind": kind, "json": body }]),
- )
- .await
- .unwrap();
- assert_eq!(decode::<()>(saved), Ok(()));
- }
- for (kind, body) in [
- ("slang", "{\"terms\":1}"),
- ("memes", "{\"memes\":2}"),
- ("remixed", "[\"m1\"]"),
- ] {
- let loaded = dispatch(
- &session,
- host_methods::LOAD_INDEX,
- json!([{ "kind": kind }]),
- )
- .await
- .unwrap();
- assert_eq!(decode::<Option<String>>(loaded), Ok(Some(body.into())));
- }
-}
-
-#[tokio::test]
-async fn without_managed_jev_evaluate_is_unsupported() {
- let dir = tempfile::tempdir().unwrap();
- let session = Session::new(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir.path()),
- );
- let request = json!([{ "body": { "questions": {}, "messages": [] } }]);
- let result = dispatch(&session, host_methods::EVALUATE, request)
- .await
- .unwrap();
- assert_eq!(
- decode::<EvaluateEnvelope>(result),
- Err(HostFailure::Unsupported)
- );
-}
-
-#[tokio::test]
-async fn search_switched_off_is_unsupported() {
- let dir = tempfile::tempdir().unwrap();
- let mut config = config_in(dir.path());
- config.search.enabled = Some(false);
- let session = Session::new(&crate::core::runtime::DispatchCtx::host_default(), &config);
- let result = dispatch(
- &session,
- host_methods::SEARCH,
- json!([{ "query": "q", "max_results": 3 }]),
- )
- .await
- .unwrap();
- assert_eq!(
- decode::<Vec<tinymemes_bus::SearchResult>>(result),
- Err(HostFailure::Unsupported)
- );
-}
-
-#[tokio::test]
-async fn deliver_is_acknowledged_and_unknown_members_are_refused() {
- let dir = tempfile::tempdir().unwrap();
- let session = Session::new(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir.path()),
- );
- let delivered = dispatch(
- &session,
- host_methods::DELIVER,
- json!([{ "reply": "hi", "remixed": true }]),
- )
- .await
- .unwrap();
- assert_eq!(decode::<()>(delivered), Ok(()));
- assert!(dispatch(&session, "Nope", json!([])).await.is_err());
- assert!(dispatch(&session, host_methods::COMPLETE, json!("bad"))
- .await
- .is_err());
-}
-
-#[test]
-fn registrations_are_independent_and_forgotten_on_drop() {
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path());
- let a = register(&crate::core::runtime::DispatchCtx::host_default(), &config);
- let b = register(&crate::core::runtime::DispatchCtx::host_default(), &config);
- assert_ne!(a.correlation(), b.correlation());
- assert!(session(a.correlation()).is_some() && session(b.correlation()).is_some());
- let a_id = a.correlation().to_owned();
- drop(a);
- assert!(
- session(&a_id).is_none(),
- "a failed call leaves nothing behind"
- );
- assert!(session(b.correlation()).is_some());
- assert!(session("").is_none() && session("unknown").is_none());
-}
-
-#[test]
-fn a_kept_registration_lives_until_the_module_reports_the_end() {
- let dir = tempfile::tempdir().unwrap();
- let registration = register(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir.path()),
- );
- let id = registration.correlation().to_owned();
- registration.keep_for_background();
- assert!(
- session(&id).is_some(),
- "background research may still call back"
- );
- end(&id);
- assert!(session(&id).is_none());
- end(&id);
-}
-
-#[test]
-fn the_correlation_id_is_read_from_the_first_argument_only() {
- assert_eq!(
- correlation_of(&json!([{ "correlation": "c1", "kind": "slang" }])),
- Some("c1")
- );
- for bad in [
- json!([{ "correlation": "" }]),
- json!([{ "correlation": 7 }]),
- json!([{}]),
- json!([]),
- json!({ "correlation": "c1" }),
- json!("c1"),
- ] {
- assert_eq!(correlation_of(&bad), None, "{bad}");
- }
-}
-
-#[tokio::test]
-async fn a_remix_session_answers_under_the_context_that_registered_it() {
- use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};
- let dir = tempfile::tempdir().unwrap();
- let caller = CoreContext::for_test(DomainSet::full(), None);
- let other = CoreContext::for_test(DomainSet::full(), None);
- let session = Session::new(
- &DispatchCtx::new(Arc::clone(&caller)),
- &config_in(dir.path()),
- );
- // A callback arrives on the module bus while some other context is active.
- let seen = CoreContext::scope(Arc::clone(&other), async { session.dispatch_ctx() }).await;
- assert!(Arc::ptr_eq(seen.core().expect("bound"), &caller));
-}
diff --git a/crates/openhuman-core/src/tinymemes/docs.rs b/crates/openhuman-core/src/tinymemes/docs.rs
deleted file mode 100644
index 35a95dac42..0000000000
--- a/crates/openhuman-core/src/tinymemes/docs.rs
+++ /dev/null
@@ -1,117 +0,0 @@
-//! The learned-state documents the module asks the host to keep: the slang
-//! index, the meme index and the ring of remixed message ids.
-//!
-//! They live on the storage document port ([`crate::storage`]) under the
-//! acting scope, in `memes.state`, one document per [`IndexKind`]. The host
-//! never interprets them: the formats, the ring and its cap belong to the
-//! module, and the text-to-body mapping to `tinymemes_bus::storage`
-//! (`state_body` / `state_text`), which also declares the step that brought
-//! the v1 `tinymemes_documents` rows (`{"json": "<text>"}`) here.
-//!
-//! Older installs kept them as `<workspace>/tinymemes/{slang-index,
-//! meme-index,remixed}.json`. The first load of a kind with no stored document
-//! adopts that file's content once and renames the file to `<name>.migrated`,
-//! so nothing is lost and the file is never read again.
-
-use std::path::{Path, PathBuf};
-
-use anyhow::{anyhow, Result};
-use tinymemes_bus::storage::{state_body, state_id, state_text, STATE_COLLECTION as COLLECTION};
-use tinymemes_bus::IndexKind;
-use tinystoragedrivers::{CollectionSpec, Precondition};
-
-use crate::config::Config;
-use crate::storage::documents::Repo;
-
-const DOMAIN: &str = "tinymemes::docs";
-/// Directory of the pre-storage files, under the workspace.
-const LEGACY_DIR: &str = "tinymemes";
-
-fn collections() -> Vec<CollectionSpec> {
- vec![CollectionSpec::new(COLLECTION)]
-}
-
-fn doc_id(kind: IndexKind) -> &'static str {
- state_id(kind)
-}
-
-fn legacy_file(kind: IndexKind) -> &'static str {
- match kind {
- IndexKind::Slang => "slang-index.json",
- IndexKind::Memes => "meme-index.json",
- IndexKind::Remixed => "remixed.json",
- }
-}
-
-fn legacy_path(workspace_dir: &Path, kind: IndexKind) -> PathBuf {
- workspace_dir.join(LEGACY_DIR).join(legacy_file(kind))
-}
-
-fn repo(config: &Config) -> Result<Repo> {
- Repo::current_for(&config.workspace_dir, DOMAIN, collections)
-}
-
-/// The stored document for `kind`, adopting the legacy file once.
-pub(super) fn load(config: &Config, kind: IndexKind) -> Result<Option<String>> {
- let repo = repo(config)?;
- let id = doc_id(kind);
- let stored = repo.run(move |docs| async move { docs.get(COLLECTION, id).await })?;
- if let Some(stored) = stored {
- return Ok(Some(state_text(kind, &stored.doc)));
- }
- let path = legacy_path(&config.workspace_dir, kind);
- // Only an absent file means "nothing to adopt". Any other failure
- // (permissions, bad UTF-8) is an error: answering `None` would let the
- // module start empty and save over state the old file still holds.
- let legacy = match std::fs::read_to_string(&path) {
- Ok(legacy) => legacy,
- Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None),
- Err(e) => return Err(anyhow!("read {}: {e}", path.display())),
- };
- // `Absent`: a concurrent save wins over the old file's content.
- let adopted = state_body(kind, &legacy);
- let written = repo.run(move |docs| async move {
- docs.put(COLLECTION, id, adopted, Precondition::Absent)
- .await
- .map(|_| ())
- });
- match written {
- Ok(()) => {
- let migrated = path.with_extension("json.migrated");
- match std::fs::rename(&path, &migrated) {
- Ok(()) => log::info!(
- "[tinymemes] adopted {} into storage (kept as {})",
- legacy_file(kind),
- migrated.display()
- ),
- Err(e) => log::warn!("[tinymemes] cannot retire {}: {e}", path.display()),
- }
- Ok(Some(legacy))
- }
- // Somebody stored a document in between; theirs is the truth. When no
- // document exists the put failed for a real reason, which is reported.
- Err(error) => {
- let stored = repo.run(move |docs| async move { docs.get(COLLECTION, id).await })?;
- match stored {
- Some(stored) => Ok(Some(state_text(kind, &stored.doc))),
- None => Err(error),
- }
- }
- }
-}
-
-/// Replace the stored document for `kind`.
-pub(super) fn save(config: &Config, kind: IndexKind, json: String) -> Result<()> {
- let repo = repo(config)?;
- let id = doc_id(kind);
- repo.run(move |docs| async move {
- docs.put(COLLECTION, id, state_body(kind, &json), Precondition::None)
- .await
- .map(|_| ())
- })
- .map_err(|e| anyhow!("save {id}: {e}"))
-}
-
-#[cfg(test)]
-#[path = "docs_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/tinymemes/docs_tests.rs b/crates/openhuman-core/src/tinymemes/docs_tests.rs
deleted file mode 100644
index d8187b737f..0000000000
--- a/crates/openhuman-core/src/tinymemes/docs_tests.rs
+++ /dev/null
@@ -1,119 +0,0 @@
-use super::*;
-
-fn config_in(dir: &Path) -> Config {
- let mut config = Config::default();
- config.config_path = dir.join("config.toml");
- config.workspace_dir = dir.join("workspace");
- config.secrets.encrypt = false;
- config
-}
-
-fn write_legacy(config: &Config, kind: IndexKind, content: &str) {
- let path = legacy_path(&config.workspace_dir, kind);
- std::fs::create_dir_all(path.parent().unwrap()).unwrap();
- std::fs::write(path, content).unwrap();
-}
-
-#[test]
-fn a_saved_document_loads_back_and_kinds_are_separate() {
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path());
- assert_eq!(load(&config, IndexKind::Slang).unwrap(), None);
- save(&config, IndexKind::Slang, "{\"terms\":1}".into()).unwrap();
- assert_eq!(
- load(&config, IndexKind::Slang).unwrap().as_deref(),
- Some("{\"terms\":1}")
- );
- assert_eq!(load(&config, IndexKind::Memes).unwrap(), None);
- assert_eq!(load(&config, IndexKind::Remixed).unwrap(), None);
- save(&config, IndexKind::Slang, "{\"terms\":2}".into()).unwrap();
- assert_eq!(
- load(&config, IndexKind::Slang).unwrap().as_deref(),
- Some("{\"terms\":2}")
- );
-}
-
-#[test]
-fn the_legacy_remixed_json_is_adopted_once_and_retired() {
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path());
- write_legacy(&config, IndexKind::Remixed, "[\"m1\",\"m2\"]");
-
- assert_eq!(
- load(&config, IndexKind::Remixed).unwrap().as_deref(),
- Some("[\"m1\",\"m2\"]")
- );
- let legacy = legacy_path(&config.workspace_dir, IndexKind::Remixed);
- assert!(!legacy.exists(), "the old file is retired");
- assert!(legacy.with_extension("json.migrated").is_file());
-
- // The module's later saves are the truth; a stray file is not re-adopted.
- save(&config, IndexKind::Remixed, "[\"m1\",\"m2\",\"m3\"]".into()).unwrap();
- write_legacy(&config, IndexKind::Remixed, "[\"stale\"]");
- assert_eq!(
- load(&config, IndexKind::Remixed).unwrap().as_deref(),
- Some("[\"m1\",\"m2\",\"m3\"]")
- );
-}
-
-#[test]
-fn every_legacy_index_file_is_adopted() {
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path());
- write_legacy(&config, IndexKind::Slang, "{\"slang\":true}");
- write_legacy(&config, IndexKind::Memes, "{\"memes\":true}");
- assert_eq!(
- load(&config, IndexKind::Slang).unwrap().as_deref(),
- Some("{\"slang\":true}")
- );
- assert_eq!(
- load(&config, IndexKind::Memes).unwrap().as_deref(),
- Some("{\"memes\":true}")
- );
-}
-
-#[test]
-fn a_stored_document_wins_over_a_legacy_file() {
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path());
- save(&config, IndexKind::Memes, "{\"new\":1}".into()).unwrap();
- write_legacy(&config, IndexKind::Memes, "{\"old\":1}");
- assert_eq!(
- load(&config, IndexKind::Memes).unwrap().as_deref(),
- Some("{\"new\":1}")
- );
- assert!(legacy_path(&config.workspace_dir, IndexKind::Memes).exists());
-}
-
-#[cfg(unix)]
-#[test]
-fn an_unreadable_legacy_file_is_an_error_not_an_empty_start() {
- use std::os::unix::fs::PermissionsExt;
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path());
- write_legacy(&config, IndexKind::Remixed, "[\"keep\"]");
- let path = legacy_path(&config.workspace_dir, IndexKind::Remixed);
- std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o000)).unwrap();
- if std::fs::read_to_string(&path).is_ok() {
- // Running as a user who can read anything (root): nothing to assert.
- return;
- }
- assert!(load(&config, IndexKind::Remixed).is_err());
- std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600)).unwrap();
- assert_eq!(
- load(&config, IndexKind::Remixed).unwrap().as_deref(),
- Some("[\"keep\"]"),
- "the state is still there once the file can be read"
- );
-}
-
-#[test]
-fn an_invalid_utf8_legacy_file_is_an_error() {
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path());
- let path = legacy_path(&config.workspace_dir, IndexKind::Slang);
- std::fs::create_dir_all(path.parent().unwrap()).unwrap();
- std::fs::write(&path, [0xff, 0xfe, 0x00]).unwrap();
- assert!(load(&config, IndexKind::Slang).is_err());
- assert!(path.exists(), "an unreadable file is left where it is");
-}
diff --git a/crates/openhuman-core/src/tinymemes/e2e_tests.rs b/crates/openhuman-core/src/tinymemes/e2e_tests.rs
deleted file mode 100644
index e99743ee44..0000000000
--- a/crates/openhuman-core/src/tinymemes/e2e_tests.rs
+++ /dev/null
@@ -1,150 +0,0 @@
-//! The host and the real compiled `tinymemes` module over the bus.
-//!
-//! Runs where a module library exists (`node scripts/modules/build.mjs
-//! tinymemes` with `OPENHUMAN_MODULE_SOURCE_DIR`, or the released modules the CI
-//! installer stages under `OPENHUMAN_MODULE_PATH`); skipped, with a message,
-//! otherwise. The library is loaded through a path override, the same way a
-//! developer points a host at a local build.
-
-use super::*;
-use service::MODULE_ID;
-use tinymemes_bus::IndexKind;
-
-fn config_in(dir: &std::path::Path, artifact: &std::path::Path) -> Config {
- let mut config = Config::default();
- config.config_path = dir.join("config.toml");
- config.workspace_dir = dir.join("workspace");
- config.secrets.encrypt = false;
- config.components.memes = true;
- config.modules.allow_download = false;
- config
- .modules
- .overrides
- .push(crate::config::schema::ModuleOverride::with_path(
- MODULE_ID,
- artifact.to_str().unwrap(),
- ));
- config
-}
-
-fn artifact() -> Option<std::path::PathBuf> {
- let artifact = crate::modules::local_artifact(MODULE_ID);
- if artifact.is_none() {
- eprintln!(
- "SKIPPED (not run, not asserted): no tinymemes library. Run \
- `node scripts/modules/build.mjs tinymemes` and set OPENHUMAN_MODULE_SOURCE_DIR, \
- or point OPENHUMAN_MODULE_PATH at the released modules"
- );
- }
- artifact
-}
-
-fn request(reply: &str) -> RemixRequest {
- serde_json::from_value(serde_json::json!({
- "conversation": [{ "role": "user", "text": "ok the report is done", "id": "u-1" }],
- "reply": reply,
- "region": "global",
- "timeout_ms": 20_000,
- "reply_id": "run-1:reply",
- }))
- .unwrap()
-}
-
-fn write_legacy(config: &Config, kind_file: &str, content: &str) {
- let dir = config.workspace_dir.join("tinymemes");
- std::fs::create_dir_all(&dir).unwrap();
- std::fs::write(dir.join(kind_file), content).unwrap();
-}
-
-/// With no Jev, no inference provider and no search on this host, the module
-/// still answers: it asks, is told it is unsupported, and fails open to the
-/// original reply. Its document reads reach the host's callbacks with its
-/// correlation id, which is visible as the legacy file being adopted.
-#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
-async fn the_real_module_fails_open_and_reads_its_documents_through_the_host() {
- let Some(artifact) = artifact() else { return };
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path(), &artifact);
- write_legacy(&config, "remixed.json", "[\"old-1\"]");
-
- let response = service::remix(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config,
- request("That's done."),
- )
- .await
- .expect("the module answered");
- assert!(!response.remixed, "{response:?}");
- assert_eq!(response.reply, "That's done.");
- // The module reported the request finished, so nothing is kept for it.
- assert_eq!(callbacks::live_for(&config.workspace_dir), 0);
-
- let legacy = config.workspace_dir.join("tinymemes/remixed.json");
- assert!(
- !legacy.exists(),
- "the module's LoadIndex adopted the old file"
- );
- assert_eq!(
- docs::load(&config, IndexKind::Remixed).unwrap().as_deref(),
- Some("[\"old-1\"]")
- );
-}
-
-#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
-async fn a_disabled_request_passes_through_without_a_callback() {
- let Some(artifact) = artifact() else { return };
- let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path(), &artifact);
- write_legacy(&config, "remixed.json", "[\"untouched\"]");
- let mut disabled = request("hello");
- disabled.enabled = false;
- let response = service::remix(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config,
- disabled,
- )
- .await
- .unwrap();
- assert_eq!(response.reply, "hello");
- assert_eq!(response.skipped, Some(SkipReason::Disabled));
- assert_eq!(
- callbacks::live_for(&config.workspace_dir),
- 0,
- "a disabled request keeps no registration"
- );
- assert!(
- config.workspace_dir.join("tinymemes/remixed.json").exists(),
- "a disabled request reads nothing"
- );
-}
-
-/// Two workspaces remix at once. Each callback is answered for the workspace
-/// of its own correlation id, and neither waits behind a process-wide gate.
-#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
-async fn concurrent_remixes_for_two_workspaces_stay_in_their_own_documents() {
- let Some(artifact) = artifact() else { return };
- let (dir_a, dir_b) = (tempfile::tempdir().unwrap(), tempfile::tempdir().unwrap());
- let (a, b) = (
- config_in(dir_a.path(), &artifact),
- config_in(dir_b.path(), &artifact),
- );
- write_legacy(&a, "remixed.json", "[\"from-a\"]");
- write_legacy(&b, "remixed.json", "[\"from-b\"]");
-
- let host = crate::core::runtime::DispatchCtx::host_default();
- let (ra, rb) = tokio::join!(
- service::remix(&host, &a, request("reply a")),
- service::remix(&host, &b, request("reply b"))
- );
- assert_eq!(ra.unwrap().reply, "reply a");
- assert_eq!(rb.unwrap().reply, "reply b");
-
- assert_eq!(
- docs::load(&a, IndexKind::Remixed).unwrap().as_deref(),
- Some("[\"from-a\"]")
- );
- assert_eq!(
- docs::load(&b, IndexKind::Remixed).unwrap().as_deref(),
- Some("[\"from-b\"]")
- );
-}
diff --git a/crates/openhuman-core/src/tinymemes/history.rs b/crates/openhuman-core/src/tinymemes/history.rs
deleted file mode 100644
index b448088271..0000000000
--- a/crates/openhuman-core/src/tinymemes/history.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-//! The thread as the user saw it, in the contract's vocabulary.
-
-use tinymemes_bus::{WireRole, WireTurn};
-
-use crate::threads::store::ConversationMessage;
-
-/// Whether a finished reply is worth remixing at all.
-pub(super) fn should_remix(reply: &str, placeholder: &str) -> bool {
- reply != placeholder && !reply.trim().is_empty()
-}
-
-/// The thread as the user saw it, oldest first: delivered replies (remixed or
-/// not) and the user's messages. `current_user_message` is appended unless it
-/// is already the last stored turn (the store may have persisted it first).
-pub(super) fn history_turns(
- messages: &[ConversationMessage],
- current_user_message: &str,
-) -> Vec<WireTurn> {
- let mut turns: Vec<WireTurn> = messages
- .iter()
- .filter(|m| !m.content.trim().is_empty())
- .filter_map(|m| match m.sender.as_str() {
- "user" => Some(WireTurn {
- role: WireRole::User,
- text: m.content.clone(),
- remixed: false,
- id: Some(m.id.clone()),
- }),
- "agent" | "assistant" => Some(WireTurn {
- role: WireRole::Assistant,
- text: m.content.clone(),
- // Whether it went out remixed is the module's to say: it keeps
- // the ring of remixed ids and matches them by this id.
- remixed: false,
- id: Some(m.id.clone()),
- }),
- _ => None,
- })
- .collect();
- let current = current_user_message.trim();
- let already_there = turns
- .last()
- .is_some_and(|t| t.role == WireRole::User && t.text.trim() == current);
- if !current.is_empty() && !already_there {
- turns.push(WireTurn {
- role: WireRole::User,
- text: current.to_owned(),
- remixed: false,
- id: None,
- });
- }
- turns
-}
-
-#[cfg(test)]
-#[path = "history_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/tinymemes/history_tests.rs b/crates/openhuman-core/src/tinymemes/history_tests.rs
deleted file mode 100644
index 3634380ac8..0000000000
--- a/crates/openhuman-core/src/tinymemes/history_tests.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-use super::*;
-
-fn msg(id: &str, sender: &str, content: &str) -> ConversationMessage {
- ConversationMessage {
- id: id.to_owned(),
- content: content.to_owned(),
- message_type: "text".to_owned(),
- extra_metadata: serde_json::Value::Null,
- sender: sender.to_owned(),
- created_at: "2026-10-09T00:00:00Z".to_owned(),
- }
-}
-
-#[test]
-fn only_real_answers_are_remixed() {
- assert!(should_remix("a real answer", "budget exhausted"));
- assert!(!should_remix("budget exhausted", "budget exhausted"));
- assert!(!should_remix(" \n", "budget exhausted"));
-}
-
-#[test]
-fn history_carries_message_ids_and_appends_the_pending_message() {
- let messages = vec![
- msg("u1", "user", "bhai build fail"),
- msg("r1", "agent", "Arre yaar, moye moye"),
- msg("r2", "agent", "Plain reply"),
- msg("s1", "system", "ignored"),
- msg("u2", "user", " "),
- ];
- let turns = history_turns(&messages, "phir se fail");
- assert_eq!(turns.len(), 4);
- assert_eq!(turns[0].role, WireRole::User);
- assert_eq!(turns[1].role, WireRole::Assistant);
- // The module owns the ring of remixed ids; the host only names the turns.
- assert_eq!(turns[1].id.as_deref(), Some("r1"));
- assert_eq!(turns[2].id.as_deref(), Some("r2"));
- assert!(turns.iter().all(|t| !t.remixed));
- assert_eq!(turns[3].text, "phir se fail");
- assert_eq!(turns[3].id, None);
-}
-
-#[test]
-fn pending_message_is_not_duplicated_when_already_stored() {
- let messages = vec![msg("u1", "user", "hello there")];
- let turns = history_turns(&messages, "hello there ");
- assert_eq!(turns.len(), 1);
-}
-
-#[test]
-fn a_new_message_repeating_an_earlier_one_is_still_appended() {
- // user("hello"), agent("reply"), then a new "hello": a distinct message.
- let messages = vec![msg("u1", "user", "hello"), msg("r1", "agent", "reply")];
- let turns = history_turns(&messages, "hello");
- assert_eq!(turns.len(), 3);
- assert_eq!(turns[2].text, "hello");
-}
diff --git a/crates/openhuman-core/src/tinymemes/inference.rs b/crates/openhuman-core/src/tinymemes/inference.rs
deleted file mode 100644
index 48f9f85c03..0000000000
--- a/crates/openhuman-core/src/tinymemes/inference.rs
+++ /dev/null
@@ -1,82 +0,0 @@
-//! OpenHuman's own inference, served to the module's `Complete` callback.
-//!
-//! Every call goes through the provider OpenHuman is configured with for the
-//! `summarization` role (managed backend, BYOK cloud, or local), the same
-//! path thread titles and follow-up suggestions use. Reasoning is switched off
-//! for these calls only; a rewrite needs none, and reasoning models otherwise
-//! spend ~10 s per call. The rest of OpenHuman keeps its configured reasoning.
-
-use tinyinference_llm::message::Message;
-use tinyinference_llm::model::ModelRequest;
-
-use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
-use crate::inference::provider;
-
-/// Workload role whose provider tinymemes borrows.
-pub(crate) const ROLE: &str = "summarization";
-const TEMPERATURE: f64 = 0.7;
-
-/// One system + user completion on the `summarization` provider.
-pub(crate) async fn complete(
- ctx: &DispatchCtx,
- config: &Config,
- system: &str,
- user: &str,
-) -> Result<String, String> {
- // Built per call so a provider change in Settings applies without a
- // restart; construction is cheap and synchronous.
- let (model, resolved) =
- provider::create_chat_model_with_model_id_in(ctx, ROLE, config, TEMPERATURE)
- .map_err(|e| format!("openhuman inference unavailable: {e}"))?;
- // Reasoning off for tinymemes' calls only (the rest of OpenHuman keeps
- // its configured reasoning). The managed backend honours the
- // `without_reasoning` flag; a BYOK route to OpenRouter needs
- // OpenRouter's own switch. Other endpoints are left untouched, since an
- // unknown field can be rejected.
- let mut request = crate::inference::registry::provider_request_without_reasoning(
- crate::inference::provider::factory::PROVIDER_OPENHUMAN,
- ModelRequest::new(vec![Message::system(system), Message::user(user)])
- .with_temperature(TEMPERATURE),
- );
- if routes_to_openrouter(config) {
- request.provider_options = serde_json::json!({ "reasoning": { "enabled": false } });
- }
- let response = model
- .invoke(&(), request)
- .await
- .map_err(|e| format!("openhuman inference failed model={resolved}: {e}"))?;
- let text = response.text();
- if text.trim().is_empty() {
- return Err(format!(
- "openhuman inference returned no text model={resolved}"
- ));
- }
- Ok(text)
-}
-
-/// Whether tinymemes' role resolves to an OpenRouter endpoint: a BYOK
-/// `openrouter:` route, or a custom inference URL on openrouter.ai.
-pub(crate) fn routes_to_openrouter(config: &Config) -> bool {
- let route_is_openrouter = config
- .memory_provider
- .as_deref()
- .map(|p| p.trim().to_ascii_lowercase())
- .is_some_and(|p| p.starts_with("openrouter:") || p == "openrouter");
- let url_is_openrouter = config
- .inference_url
- .as_deref()
- .is_some_and(|u| u.to_ascii_lowercase().contains("openrouter.ai"));
- route_is_openrouter || url_is_openrouter
-}
-
-/// The model id OpenHuman would use for tinymemes, for the startup log line.
-pub(crate) fn resolved_model(ctx: &DispatchCtx, config: &Config) -> String {
- provider::create_chat_model_with_model_id_in(ctx, ROLE, config, TEMPERATURE)
- .map(|(_, id)| id)
- .unwrap_or_else(|e| format!("unavailable ({e})"))
-}
-
-#[cfg(test)]
-#[path = "inference_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/tinymemes/inference_tests.rs b/crates/openhuman-core/src/tinymemes/inference_tests.rs
deleted file mode 100644
index 96eaa121d2..0000000000
--- a/crates/openhuman-core/src/tinymemes/inference_tests.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-use super::*;
-
-#[test]
-fn openrouter_routes_are_detected() {
- let mut config = Config::default();
- assert!(!routes_to_openrouter(&config));
- config.inference_url = Some("https://openrouter.ai/api/v1".into());
- assert!(routes_to_openrouter(&config));
- config.inference_url = Some("https://OpenRouter.AI/api/v1".into());
- assert!(routes_to_openrouter(&config));
- config.inference_url = Some("https://api.openai.com/v1".into());
- assert!(!routes_to_openrouter(&config));
- config.memory_provider = Some("openrouter:deepseek/deepseek-v4-flash".into());
- assert!(routes_to_openrouter(&config));
- config.memory_provider = Some("ollama:llama3.1:8b".into());
- assert!(!routes_to_openrouter(&config));
-}
-
-#[test]
-fn the_model_label_never_fails() {
- let dir = tempfile::tempdir().unwrap();
- let mut config = Config::default();
- config.config_path = dir.path().join("config.toml");
- config.workspace_dir = dir.path().join("workspace");
- config.secrets.encrypt = false;
- // Either the resolved model id or an `unavailable (...)` label.
- assert!(
- !resolved_model(&crate::core::runtime::DispatchCtx::host_default(), &config)
- .trim()
- .is_empty()
- );
-}
diff --git a/crates/openhuman-core/src/tinymemes/jev.rs b/crates/openhuman-core/src/tinymemes/jev.rs
deleted file mode 100644
index 27e20db9a5..0000000000
--- a/crates/openhuman-core/src/tinymemes/jev.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-//! Jev as OpenHuman manages it.
-//!
-//! The module uses the OpenHuman-managed Jev: a signed-in TinyHumans session
-//! reaches Jev through the backend's System One proxy, billed to the account.
-//! There is no other OpenHuman-side route.
-//!
-//! `None` means managed Jev is unavailable (signed out, or the offline local
-//! session, which has no backend account); the `Evaluate` callback then
-//! reports `Unsupported` and the module returns the original reply.
-
-use std::sync::Arc;
-
-use tinyinference_decisions::{Client, ClientConfig};
-
-use crate::config::Config;
-use crate::security::credentials::session_support::{
- is_local_session_token, resolve_backend_credential, BackendCredential,
-};
-
-pub(crate) fn managed(config: &Config) -> Option<Arc<Client>> {
- // Only a session token can be the offline local session; an API key is
- // never classified by its shape.
- let secret = match resolve_backend_credential(config).ok()? {
- BackendCredential::Session(token) if is_local_session_token(&token) => return None,
- BackendCredential::Session(token) | BackendCredential::ApiKey(token) => token,
- };
- let base = config.resolved_endpoints.control_plane_url.clone()?;
- let mut client = ClientConfig::tinyhumans_openrouter(secret);
- client.base_url = base;
- if let Some(identity) = config.resolved_endpoints.product_identity.clone() {
- client = client.with_sdk_name(&identity);
- }
- match Client::new(client) {
- Ok(c) => Some(Arc::new(c)),
- Err(e) => {
- log::warn!("[tinymemes] managed jev client build failed: {e}");
- None
- }
- }
-}
-
-#[cfg(test)]
-#[path = "jev_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/tinymemes/jev_tests.rs b/crates/openhuman-core/src/tinymemes/jev_tests.rs
deleted file mode 100644
index 797cf90659..0000000000
--- a/crates/openhuman-core/src/tinymemes/jev_tests.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use super::*;
-
-fn config_in(dir: &std::path::Path) -> Config {
- let mut config = Config::default();
- config.config_path = dir.join("config.toml");
- config.workspace_dir = dir.join("workspace");
- config.secrets.encrypt = false;
- config
-}
-
-#[test]
-fn without_a_backend_credential_managed_jev_is_unavailable() {
- let dir = tempfile::tempdir().unwrap();
- assert!(managed(&config_in(dir.path())).is_none());
-}
-
-#[test]
-fn an_api_key_reaches_managed_jev() {
- let dir = tempfile::tempdir().unwrap();
- let mut config = config_in(dir.path());
- config.resolved_endpoints.control_plane_url = Some("https://api.example.test".into());
- crate::security::credentials::api_key::store_api_key(&config, "th_live_test").unwrap();
- assert!(managed(&config).is_some());
-}
diff --git a/crates/openhuman-core/src/tinymemes/mod.rs b/crates/openhuman-core/src/tinymemes/mod.rs
deleted file mode 100644
index bbcef290bb..0000000000
--- a/crates/openhuman-core/src/tinymemes/mod.rs
+++ /dev/null
@@ -1,351 +0,0 @@
-//! TinyMemes host adapter: remixes the orchestrator's final reply with
-//! region slang and memes when the chat can take it.
-//!
-//! The engine (Jev reading, rating, rewrite, slang and meme indexes) runs in
-//! the `tinymemes` module, reached over its `tinymemes-bus` contract. This
-//! domain keeps what is the host's:
-//!
-//! - the `OPENHUMAN_TINYMEMES` flag and the A/B split ([`arm`]);
-//! - the thread as the user saw it, each message named by its id
-//! ([`history`]); the module keeps the ring of remixed ids itself and tags
-//! earlier remixed replies from it;
-//! - the callbacks the module asks for while it works: OpenHuman inference,
-//! managed Jev, web search and the learned-state documents ([`callbacks`],
-//! [`docs`], served over the bus by [`service`]). Each carries the remix's
-//! correlation id, so remixes for different workspaces run side by side.
-//!
-//! The module also owns the `TINYMEMES_*` environment overrides (OpenRouter key
-//! and model, Jev route), the LLM fallback when this host has no Jev, and the
-//! slang and meme research it runs in the background after delivery.
-//!
-//! Behaviour:
-//!
-//! - Runs after the turn, on `full_response` only. Sub-agent output never
-//! reaches it.
-//! - The agent's own transcript keeps the original wording, so the
-//! orchestrator never sees its replies in slang.
-//! - Fails open: any error, refusal or timeout delivers the original reply.
-//!
-//! Every turn in an experiment logs one grep-friendly `[tinymemes] turn` line
-//! (arm, turn time, remix time, rating, outcome) for the A/B comparison. No
-//! user content is logged.
-
-mod arm;
-mod callbacks;
-mod docs;
-mod history;
-mod inference;
-mod jev;
-mod search;
-pub(crate) mod service;
-
-use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
-use async_trait::async_trait;
-use std::time::{Duration, Instant};
-use tinymemes_bus::{RemixOptions, RemixRequest, RemixResponse, SkipReason};
-
-pub(crate) use arm::Arm;
-pub(crate) use arm::FLAG_ENV;
-
-/// Whether an `OPENHUMAN_TINYMEMES` value turns remixing on in any form.
-pub(crate) fn flag_enabled(value: &str) -> bool {
- arm::mode_from(Some(value)) != arm::Mode::Off
-}
-
-const TIMEOUT_ENV: &str = "OPENHUMAN_TINYMEMES_TIMEOUT_MS";
-const COOLDOWN_ENV: &str = "OPENHUMAN_TINYMEMES_MEME_COOLDOWN";
-
-/// Whether this thread's answer text must be held back from streaming because
-/// its final reply will be remixed (treatment arm). The UI then shows only the
-/// remixed reply instead of the original streaming in and being replaced.
-pub(crate) fn holds_text_stream(config: &Config, thread_id: &str) -> bool {
- arm::arm_for(config, arm::mode(), thread_id) == Arm::Treatment
-}
-
-/// Something that can remix one reply: the module in production, a script in
-/// tests.
-#[async_trait]
-pub(crate) trait Remixer: Send + Sync {
- async fn remix(&self, request: RemixRequest) -> Result<RemixResponse, String>;
-}
-
-/// The loadable `tinymemes` module, with this workspace's callbacks served.
-struct ModuleRemixer<'a> {
- ctx: &'a DispatchCtx,
- config: &'a Config,
-}
-
-#[async_trait]
-impl Remixer for ModuleRemixer<'_> {
- async fn remix(&self, request: RemixRequest) -> Result<RemixResponse, String> {
- service::remix(self.ctx, self.config, request).await
- }
-}
-
-/// Remix a finished task's reply in place, when it is a real answer (not
-/// empty, not the `placeholder` sent when the inference budget ran out) and
-/// the thread is in the treatment arm. Fails open: the reply is left
-/// untouched on any error.
-pub(crate) async fn remix_task_reply(
- ctx: &DispatchCtx,
- config: &Config,
- thread_id: &str,
- request_id: &str,
- user_message: &str,
- full_response: &mut String,
- placeholder: &str,
- turn_elapsed: Duration,
-) {
- if !history::should_remix(full_response, placeholder) {
- return;
- }
- if let Some(remixed) = remix_final_reply(
- arm::arm_for(config, arm::mode(), thread_id),
- ctx,
- config,
- thread_id,
- request_id,
- user_message,
- full_response,
- turn_elapsed,
- )
- .await
- {
- *full_response = remixed;
- }
-}
-
-/// Remix a finished turn's reply. Returns the text to deliver instead, or
-/// `None` to deliver the original. `turn_elapsed` is the agent turn's own
-/// duration, logged for both arms so throughput can be compared.
-async fn remix_final_reply(
- arm: Arm,
- ctx: &DispatchCtx,
- config: &Config,
- thread_id: &str,
- request_id: &str,
- user_message: &str,
- reply: &str,
- turn_elapsed: Duration,
-) -> Option<String> {
- let turn = TurnInfo {
- request_id,
- bucket: arm::bucket(thread_id),
- turn_ms: turn_elapsed.as_millis(),
- };
- if !gate(arm, &turn) {
- return None;
- }
- let started = Instant::now();
- // Fail open: without the thread, the reading would judge the reply out of
- // context, so the original goes out instead.
- let Some(messages) = load(ctx, config, thread_id).await else {
- log_outcome(&turn, started, "history_unavailable", None);
- return None;
- };
- let remixer = ModuleRemixer { ctx, config };
- remix_with(
- &remixer,
- options(ctx, config),
- &messages,
- &turn,
- started,
- user_message,
- reply,
- budget(config),
- )
- .await
-}
-
-/// Per-turn identifiers for the A/B log line.
-#[derive(Clone, Copy)]
-struct TurnInfo<'a> {
- request_id: &'a str,
- bucket: u8,
- turn_ms: u128,
-}
-
-/// Whether the arm runs the remix. The control arm logs its turn for the
-/// throughput comparison; a disabled flag does nothing at all.
-fn gate(arm: Arm, turn: &TurnInfo<'_>) -> bool {
- match arm {
- Arm::Disabled => false,
- Arm::Control => {
- log::info!(
- "[tinymemes] turn arm={} bucket={} request_id={} turn_ms={} remix_ms=0 \
- outcome=not_remixed",
- arm.as_str(),
- turn.bucket,
- turn.request_id,
- turn.turn_ms
- );
- false
- }
- Arm::Treatment => true,
- }
-}
-
-/// The thread as stored. Blocking file work, so it runs off the async
-/// runtime. `None` when the thread cannot be read.
-async fn load(
- ctx: &DispatchCtx,
- config: &Config,
- thread_id: &str,
-) -> Option<Vec<crate::threads::store::ConversationMessage>> {
- let config = config.clone();
- let thread_id = thread_id.to_owned();
- let ctx = ctx.clone();
- ctx.clone()
- .spawn_blocking(move || {
- crate::threads::store::get_messages(&ctx, config.workspace_dir.clone(), &thread_id)
- .map_err(|e| log::warn!("[tinymemes] thread history unavailable: {e}"))
- .ok()
- })
- .await
- .ok()
- .flatten()
-}
-
-/// What the host decides for the module: the meme cooldown
-/// (`OPENHUMAN_TINYMEMES_MEME_COOLDOWN` over `[memes] meme_cooldown`) and
-/// whether web search can serve research at all.
-fn options(ctx: &DispatchCtx, config: &Config) -> RemixOptions {
- options_with(
- std::env::var(COOLDOWN_ENV).ok().as_deref(),
- config.memes.meme_cooldown,
- search::OpenHumanSearch::available(ctx, config).is_some(),
- )
-}
-
-fn options_with(env: Option<&str>, configured: u32, research: bool) -> RemixOptions {
- RemixOptions {
- meme_cooldown_turns: Some(
- env.and_then(|v| v.trim().parse::<u32>().ok())
- .unwrap_or(configured),
- ),
- research,
- }
-}
-
-/// The remix time budget: `OPENHUMAN_TINYMEMES_TIMEOUT_MS` when set, else
-/// `[memes] timeout_ms`.
-fn budget(config: &Config) -> Duration {
- budget_with(
- std::env::var(TIMEOUT_ENV).ok().as_deref(),
- config.memes.timeout_ms,
- )
-}
-
-fn budget_with(env: Option<&str>, configured_ms: u64) -> Duration {
- Duration::from_millis(
- env.and_then(|v| v.trim().parse::<u64>().ok())
- .unwrap_or(configured_ms),
- )
-}
-
-/// Read, rate, and remix `reply` against the thread, within `budget`.
-#[allow(clippy::too_many_arguments)]
-async fn remix_with(
- remixer: &dyn Remixer,
- options: RemixOptions,
- messages: &[crate::threads::store::ConversationMessage],
- turn: &TurnInfo<'_>,
- started: Instant,
- user_message: &str,
- reply: &str,
- budget: Duration,
-) -> Option<String> {
- let request = RemixRequest {
- conversation: history::history_turns(messages, user_message),
- reply: reply.to_owned(),
- region: None,
- enabled: true,
- timeout_ms: u64::try_from(budget.as_millis()).unwrap_or(u64::MAX),
- deliver: false,
- // Set by the service, which owns the registry of live remixes.
- correlation: String::new(),
- // The module remembers this id when the reply goes out remixed.
- reply_id: Some(crate::threads::store::run_reply_message_id(turn.request_id)),
- options,
- };
- // The module enforces `timeout_ms` itself; this outer bound also covers
- // module load, callback serving and the bus hop.
- let response = match tokio::time::timeout(budget, remixer.remix(request)).await {
- Ok(Ok(response)) => response,
- Ok(Err(error)) => {
- log::warn!(
- "[tinymemes] remix unavailable request_id={}: {error}",
- turn.request_id
- );
- log_outcome(turn, started, "error", None);
- return None;
- }
- Err(_) => {
- log_outcome(turn, started, "timeout", None);
- return None;
- }
- };
-
- // Whether the delivered reply actually changed.
- let changed = response.remixed && response.reply.trim() != reply.trim();
- let result = if changed {
- "remixed"
- } else {
- match response.skipped {
- Some(SkipReason::Timeout) => "timeout",
- Some(SkipReason::Failed) => "error",
- _ => "unchanged",
- }
- };
- log_outcome(turn, started, result, Some(&response));
- changed.then_some(response.reply)
-}
-
-fn log_outcome(
- turn: &TurnInfo<'_>,
- started: Instant,
- result: &str,
- response: Option<&RemixResponse>,
-) {
- log::info!(
- "{}",
- turn_line(turn, started.elapsed().as_millis(), result, response)
- );
-}
-
-/// The treatment arm's per-turn log line. No user content goes in it.
-fn turn_line(
- turn: &TurnInfo<'_>,
- remix_ms: u128,
- result: &str,
- response: Option<&RemixResponse>,
-) -> String {
- let TurnInfo {
- request_id,
- bucket,
- turn_ms,
- } = *turn;
- format!(
- "[tinymemes] turn arm=treatment bucket={bucket} request_id={request_id} turn_ms={turn_ms} \
- remix_ms={remix_ms} outcome={result} score={} skipped={} wants_more_memes={}",
- response.and_then(|r| r.score).map_or(-1, i32::from),
- response
- .and_then(|r| r.skipped)
- .map_or("none", |s| match s {
- SkipReason::Disabled => "disabled",
- SkipReason::BelowThreshold => "below_threshold",
- SkipReason::Timeout => "timeout",
- SkipReason::Failed => "failed",
- }),
- response.is_some_and(|r| r.wants_more_memes),
- )
-}
-
-#[cfg(test)]
-#[path = "mod_tests.rs"]
-mod tests;
-
-#[cfg(test)]
-#[path = "e2e_tests.rs"]
-mod e2e_tests;
diff --git a/crates/openhuman-core/src/tinymemes/mod_tests.rs b/crates/openhuman-core/src/tinymemes/mod_tests.rs
deleted file mode 100644
index 831f14a573..0000000000
--- a/crates/openhuman-core/src/tinymemes/mod_tests.rs
+++ /dev/null
@@ -1,321 +0,0 @@
-use super::*;
-
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-use crate::threads::store::ConversationMessage;
-
-/// Answers every remix with a fixed response, after an optional delay.
-struct ScriptedRemixer {
- response: Result<RemixResponse, String>,
- delay: Duration,
- calls: AtomicUsize,
- last: std::sync::Mutex<Option<RemixRequest>>,
-}
-
-impl ScriptedRemixer {
- fn new(response: Result<RemixResponse, String>) -> Self {
- Self {
- response,
- delay: Duration::ZERO,
- calls: AtomicUsize::new(0),
- last: std::sync::Mutex::new(None),
- }
- }
-}
-
-#[async_trait]
-impl Remixer for ScriptedRemixer {
- async fn remix(&self, request: RemixRequest) -> Result<RemixResponse, String> {
- self.calls.fetch_add(1, Ordering::SeqCst);
- *self.last.lock().unwrap() = Some(request);
- tokio::time::sleep(self.delay).await;
- self.response.clone()
- }
-}
-
-fn remixed_response(reply: &str) -> RemixResponse {
- RemixResponse {
- reply: reply.to_owned(),
- remixed: true,
- skipped: None,
- score: Some(7),
- wants_more_memes: false,
- }
-}
-
-fn skipped_response(reply: &str, reason: SkipReason) -> RemixResponse {
- RemixResponse {
- reply: reply.to_owned(),
- remixed: false,
- skipped: Some(reason),
- score: None,
- wants_more_memes: false,
- }
-}
-
-fn turn(request_id: &str) -> TurnInfo<'_> {
- TurnInfo {
- request_id,
- bucket: 7,
- turn_ms: 1234,
- }
-}
-
-fn msg(id: &str, sender: &str, content: &str) -> ConversationMessage {
- ConversationMessage {
- id: id.to_owned(),
- content: content.to_owned(),
- message_type: "text".to_owned(),
- extra_metadata: serde_json::Value::Null,
- sender: sender.to_owned(),
- created_at: "2026-10-09T00:00:00Z".to_owned(),
- }
-}
-
-fn thread() -> Vec<ConversationMessage> {
- vec![
- msg("u1", "user", "bhai build fail ho gaya"),
- msg("r1", "agent", "Arre yaar, moye moye"),
- ]
-}
-
-async fn run(remixer: &ScriptedRemixer, request_id: &str, budget: Duration) -> Option<String> {
- remix_with(
- remixer,
- options_with(None, 3, true),
- &thread(),
- &turn(request_id),
- Instant::now(),
- "phir se fail",
- "Build failed again.",
- budget,
- )
- .await
-}
-
-#[test]
-fn the_budget_defaults_to_the_configured_twenty_seconds() {
- let config = Config::default();
- assert_eq!(
- budget_with(None, config.memes.timeout_ms),
- Duration::from_secs(20)
- );
-}
-
-#[test]
-fn the_budget_env_override_beats_config_and_bad_values_fall_back() {
- assert_eq!(
- budget_with(Some("1500"), 20_000),
- Duration::from_millis(1500)
- );
- assert_eq!(
- budget_with(Some("soon"), 7_000),
- Duration::from_millis(7_000)
- );
-}
-
-#[test]
-fn component_off_disables_every_arm() {
- let mut config = Config::default();
- config.components.memes = false;
- for mode in [arm::Mode::On, arm::Mode::Ab { percent: 100 }] {
- assert_eq!(arm::arm_for(&config, mode, "t1"), Arm::Disabled);
- }
- assert!(!holds_text_stream(&config, "t1"));
-}
-
-#[test]
-fn arm_is_honoured_only_when_the_component_is_on() {
- let config = Config::default();
- assert!(config.components.memes);
- assert_eq!(arm::arm_for(&config, arm::Mode::Off, "t1"), Arm::Disabled);
- assert_eq!(arm::arm_for(&config, arm::Mode::On, "t1"), Arm::Treatment);
- assert_eq!(
- arm::arm_for(&config, arm::Mode::Ab { percent: 0 }, "t1"),
- Arm::Control
- );
-}
-
-#[test]
-fn precedence_matrix_env_beats_build_default_and_component_gates_both() {
- // env set wins over the build default; unset falls to it; neither is off.
- assert_eq!(arm::resolve_mode(Some("off"), Some("on")), arm::Mode::Off);
- assert_eq!(arm::resolve_mode(Some("on"), None), arm::Mode::On);
- assert_eq!(arm::resolve_mode(None, Some("on")), arm::Mode::On);
- assert_eq!(arm::resolve_mode(None, None), arm::Mode::Off);
- let mut config = Config::default();
- config.components.memes = false;
- assert_eq!(
- arm::arm_for(&config, arm::resolve_mode(Some("on"), Some("on")), "t"),
- Arm::Disabled
- );
-}
-
-#[test]
-fn only_the_treatment_arm_passes_the_gate() {
- let t = turn("req");
- assert!(!gate(Arm::Disabled, &t));
- assert!(!gate(Arm::Control, &t));
- assert!(gate(Arm::Treatment, &t));
-}
-
-#[tokio::test]
-async fn a_remixed_reply_is_delivered_and_named_for_the_module_to_remember() {
- let remixer = ScriptedRemixer::new(Ok(remixed_response("Arre yaar, build phir fail!")));
- let out = run(&remixer, "req-ok", Duration::from_secs(5)).await;
- assert_eq!(out.as_deref(), Some("Arre yaar, build phir fail!"));
-
- // The module remembers remixed ids itself: it is told which id this reply
- // will have, and the thread's turns carry theirs.
- let request = remixer.last.lock().unwrap().clone().unwrap();
- assert!(request.enabled && !request.deliver);
- assert_eq!(request.reply, "Build failed again.");
- assert_eq!(request.timeout_ms, 5000);
- assert_eq!(request.conversation.last().unwrap().text, "phir se fail");
- assert_eq!(
- request.reply_id,
- Some(crate::threads::store::run_reply_message_id("req-ok"))
- );
- assert_eq!(request.conversation[1].id.as_deref(), Some("r1"));
- assert_eq!(request.options.meme_cooldown_turns, Some(3));
- assert!(request.options.research);
-}
-
-#[tokio::test]
-async fn an_unchanged_reply_sends_the_original() {
- for reason in [
- SkipReason::BelowThreshold,
- SkipReason::Failed,
- SkipReason::Timeout,
- ] {
- let remixer = ScriptedRemixer::new(Ok(skipped_response("Build failed again.", reason)));
- assert_eq!(
- run(&remixer, "req-skip", Duration::from_secs(5)).await,
- None
- );
- }
-}
-
-#[tokio::test]
-async fn a_remix_that_returns_the_same_text_is_not_a_change() {
- let remixer = ScriptedRemixer::new(Ok(remixed_response("Build failed again. ")));
- assert_eq!(
- run(&remixer, "req-same", Duration::from_secs(5)).await,
- None
- );
-}
-
-#[tokio::test]
-async fn a_module_error_sends_the_original() {
- let remixer = ScriptedRemixer::new(Err("module unavailable".into()));
- assert_eq!(run(&remixer, "req-err", Duration::from_secs(5)).await, None);
-}
-
-#[tokio::test]
-async fn a_slow_remix_times_out_to_the_original() {
- let mut remixer = ScriptedRemixer::new(Ok(remixed_response("too late")));
- remixer.delay = Duration::from_secs(30);
- let out = run(&remixer, "req-slow", Duration::from_millis(50)).await;
- assert_eq!(out, None);
-}
-
-#[tokio::test]
-async fn a_disabled_flag_leaves_the_task_reply_alone() {
- let dir = tempfile::tempdir().unwrap();
- let mut config = Config::default();
- config.config_path = dir.path().join("config.toml");
- config.workspace_dir = dir.path().join("workspace");
- let mut reply = String::from("Build failed again.");
- // Disabled arm: no module is touched and nothing changes.
- let out = remix_final_reply(
- Arm::Disabled,
- &DispatchCtx::ambient(),
- &config,
- "thread",
- "req",
- "msg",
- &reply,
- Duration::from_millis(5),
- )
- .await;
- assert_eq!(out, None);
- remix_task_reply(
- &DispatchCtx::ambient(),
- &config,
- "thread",
- "req",
- "msg",
- &mut reply,
- "placeholder",
- Duration::ZERO,
- )
- .await;
- assert_eq!(reply, "Build failed again.");
-}
-
-#[test]
-fn the_turn_line_reports_the_outcome_without_user_content() {
- let t = turn("req-1");
- let none = turn_line(&t, 5, "error", None);
- assert!(none.contains("outcome=error") && none.contains("score=-1"));
- let some = turn_line(&t, 9, "remixed", Some(&remixed_response("secret text")));
- assert!(some.contains("score=7") && some.contains("request_id=req-1"));
- assert!(!some.contains("secret text"));
- let skipped = turn_line(
- &t,
- 9,
- "unchanged",
- Some(&skipped_response("x", SkipReason::BelowThreshold)),
- );
- assert!(skipped.contains("skipped=below_threshold"));
-}
-
-#[test]
-fn flag_values_enable_remixing() {
- assert!(flag_enabled("on"));
- assert!(flag_enabled("ab:30"));
- assert!(!flag_enabled("off"));
-}
-
-#[tokio::test]
-async fn component_off_refuses_the_remix_before_any_module_load() {
- let mut config = Config::default();
- config.components.memes = false;
- let request = RemixRequest {
- conversation: Vec::new(),
- reply: "hi".to_owned(),
- region: None,
- enabled: true,
- timeout_ms: 100,
- deliver: false,
- correlation: String::new(),
- reply_id: None,
- options: RemixOptions::default(),
- };
- let err = service::remix(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config,
- request,
- )
- .await
- .unwrap_err();
- assert!(err.contains("component is off"), "{err}");
-}
-
-#[test]
-fn the_cooldown_env_beats_config_and_bad_values_fall_back() {
- assert_eq!(
- options_with(Some("5"), 3, true).meme_cooldown_turns,
- Some(5)
- );
- assert_eq!(
- options_with(Some("0"), 3, true).meme_cooldown_turns,
- Some(0)
- );
- assert_eq!(
- options_with(Some("often"), 3, true).meme_cooldown_turns,
- Some(3)
- );
- assert_eq!(options_with(None, 4, false).meme_cooldown_turns, Some(4));
- assert!(!options_with(None, 4, false).research);
-}
diff --git a/crates/openhuman-core/src/tinymemes/search.rs b/crates/openhuman-core/src/tinymemes/search.rs
deleted file mode 100644
index f7f120313c..0000000000
--- a/crates/openhuman-core/src/tinymemes/search.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-//! OpenHuman's web search as the module's `Search` callback.
-//!
-//! Runs the same checks the `web_search` tool does before calling the search
-//! module: search enabled in settings, the LocalOnly egress block, and at
-//! least one provider able to serve the search role.
-
-use serde_json::json;
-
-use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
-
-const TOOL: &str = tinysearch_bus::tools::WEB_SEARCH;
-
-pub(crate) struct OpenHumanSearch {
- ctx: DispatchCtx,
- config: Config,
-}
-
-impl OpenHumanSearch {
- /// A search backend, or `None` when OpenHuman cannot search right now.
- pub(crate) fn available(ctx: &DispatchCtx, config: &Config) -> Option<Self> {
- if !crate::search::is_active(config) {
- return None;
- }
- if crate::search::tools::local_only_search_block(TOOL).is_some() {
- return None;
- }
- let role = tinysearch_bus::role_for_tool(TOOL)?;
- let resolved = crate::search::providers::resolve(config);
- if crate::search::providers::effective_role_providers(&resolved, config, role).is_empty() {
- return None;
- }
- Some(Self {
- ctx: ctx.clone(),
- config: config.clone(),
- })
- }
-}
-
-impl OpenHumanSearch {
- /// Run one search through the search module.
- pub(crate) async fn search(
- &self,
- query: &str,
- max_results: usize,
- ) -> Result<Vec<tinymemes_bus::SearchResult>, String> {
- let request = tinysearch_bus::ExecuteToolRequest {
- name: TOOL.to_string(),
- arguments: json!({ "query": query, "max_results": max_results.clamp(1, 20) }),
- };
- let response = crate::modules::search::execute_tool(&self.ctx, &self.config, request)
- .await
- .map_err(|e| crate::search::tools::user_facing_error(&e))?;
- Ok(response
- .results
- .into_iter()
- .map(|r| tinymemes_bus::SearchResult {
- title: r.title,
- url: r.url,
- snippet: r.snippet,
- })
- .collect())
- }
-}
-
-#[cfg(test)]
-#[path = "search_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/tinymemes/search_tests.rs b/crates/openhuman-core/src/tinymemes/search_tests.rs
deleted file mode 100644
index e01c29f90c..0000000000
--- a/crates/openhuman-core/src/tinymemes/search_tests.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-use super::*;
-
-#[test]
-fn search_switched_off_in_settings_is_unavailable() {
- let mut config = Config::default();
- config.search.enabled = Some(false);
- assert!(OpenHumanSearch::available(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config
- )
- .is_none());
-}
-
-#[test]
-fn availability_follows_the_configured_providers() {
- // Whatever the default providers resolve to, a backend is returned only
- // when search is on; it never panics on a default config.
- let mut config = Config::default();
- config.search.enabled = Some(true);
- if let Some(search) =
- OpenHumanSearch::available(&crate::core::runtime::DispatchCtx::host_default(), &config)
- {
- assert!(search.config.search.is_enabled());
- }
-}
diff --git a/crates/openhuman-core/src/tinymemes/service.rs b/crates/openhuman-core/src/tinymemes/service.rs
deleted file mode 100644
index dadd69a5a3..0000000000
--- a/crates/openhuman-core/src/tinymemes/service.rs
+++ /dev/null
@@ -1,162 +0,0 @@
-//! The bus half of the `tinymemes` module: the host callbacks it is served
-//! (`Host` interface) and the client call that starts a remix.
-
-use async_trait::async_trait;
-use tinybus::{CallContext, Connection, InterfaceName, MemberName, ObjectPath};
-use tinymemes_bus::{
- host_methods, remix_methods, RemixRefusal, RemixRequest, RemixResponse, RemixResult,
- HOST_INTERFACE, HOST_METHODS, HOST_PATH, REMIX_INTERFACE, REMIX_PATH, STATE_INTERFACE,
-};
-
-use super::callbacks;
-use crate::config::Config;
-
-/// Registry id of the module the callbacks serve.
-pub(crate) const MODULE_ID: &str = "tinymemes";
-
-struct HostService {
- connection: Connection,
-}
-
-#[async_trait]
-impl tinybus::Interface for HostService {
- fn name(&self) -> InterfaceName {
- InterfaceName::new(HOST_INTERFACE).expect("contract interface name is well formed")
- }
-
- fn members(&self) -> Vec<MemberName> {
- HOST_METHODS
- .iter()
- .filter_map(|member| MemberName::new(*member).ok())
- .collect()
- }
-
- async fn call(
- &self,
- _member: &MemberName,
- _args: serde_json::Value,
- ) -> tinybus::Result<serde_json::Value> {
- // Without the broker's context there is no caller to authorize.
- Err(tinybus::Error::failed("unauthenticated tinymemes caller"))
- }
-
- async fn call_with_context(
- &self,
- member: &MemberName,
- args: serde_json::Value,
- context: &CallContext,
- ) -> tinybus::Result<serde_json::Value> {
- // Only the loaded `tinymemes` module may ask: its bus name's owner
- // must be the authenticated sender.
- let Some(sender) = context.authenticated_sender() else {
- return Err(tinybus::Error::failed("unauthenticated tinymemes caller"));
- };
- let owner = self
- .connection
- .name_owner(tinymemes_bus::STATE_INTERFACE)
- .await
- .ok()
- .flatten();
- if owner.as_ref() != Some(sender) {
- log::warn!("[tinymemes] refused a host callback from a peer that is not the module");
- return Err(tinybus::Error::failed("unknown tinymemes caller"));
- }
- // The module is the only caller, but it serves many remixes: the
- // correlation id says which workspace this callback answers for.
- let correlation = callbacks::correlation_of(&args).map(str::to_owned);
- if member.as_str() == host_methods::END {
- // Forgetting an unknown id is harmless, so `End` needs no session.
- if let Some(correlation) = &correlation {
- callbacks::end(correlation);
- }
- return serde_json::to_value(tinymemes_bus::HostResult::<()>::Ok(()))
- .map_err(|_| tinybus::Error::failed("invalid tinymemes host response"));
- }
- let Some(session) = correlation.as_deref().and_then(callbacks::session) else {
- log::debug!("[tinymemes] host callback with no live remix for its correlation id");
- return Err(tinybus::Error::failed("no such tinymemes remix"));
- };
- callbacks::dispatch(&session, member.as_str(), args).await
- }
-}
-
-/// Serve the module's host callbacks on the module bus.
-pub(crate) async fn install(connection: &Connection) -> tinybus::Result<()> {
- connection
- .serve_at(
- ObjectPath::new(HOST_PATH)?,
- HostService {
- connection: connection.clone(),
- },
- )
- .await
-}
-
-/// One foreground remix at a time per workspace.
-///
-/// The module reads its learned-state documents at the start of a remix and
-/// writes them at the end, so two remixes for one scope at once would each
-/// save a stale snapshot over the other. Different scopes never wait for each
-/// other. Background research that outlives a call is not covered: it can only
-/// lose counters, never a remixed id (the module serializes those itself).
-static FOREGROUND: std::sync::LazyLock<
- std::sync::Mutex<std::collections::HashMap<String, std::sync::Arc<tokio::sync::Mutex<()>>>>,
-> = std::sync::LazyLock::new(Default::default);
-
-fn scope_lock(config: &Config) -> std::sync::Arc<tokio::sync::Mutex<()>> {
- let key = config.workspace_dir.display().to_string();
- FOREGROUND
- .lock()
- .unwrap_or_else(|e| e.into_inner())
- .entry(key)
- .or_default()
- .clone()
-}
-
-/// Remix one reply through the loaded module, serving its callbacks for
-/// `config`'s workspace meanwhile. `request.correlation` is set here.
-pub(crate) async fn remix(
- ctx: &crate::core::runtime::DispatchCtx,
- config: &Config,
- mut request: RemixRequest,
-) -> Result<RemixResponse, String> {
- if !config.components.memes {
- return Err("the memes component is off".to_owned());
- }
- crate::modules::ensure_loaded(config, MODULE_ID).await?;
- let runtime = crate::modules::runtime::runtime()
- .await
- .map_err(|error| format!("the module bus is not running: {error}"))?;
- let proxy = runtime
- .connection()
- .proxy(STATE_INTERFACE, REMIX_PATH, REMIX_INTERFACE)
- .map_err(|error| error.to_string())?;
- let registration = callbacks::register(ctx, config);
- request.correlation = registration.correlation().to_owned();
- // A disabled request makes no callbacks and starts no research, so there
- // is nothing to keep the registration for.
- let may_research = request.enabled;
- // One foreground remix at a time per scope; see [`FOREGROUND`].
- let lock = scope_lock(config);
- let _foreground = lock.lock().await;
- let outcome: tinybus::Result<RemixResult> = proxy.call(remix_methods::REMIX, (request,)).await;
- match outcome {
- Ok(Ok(response)) => {
- // Background research may still call back; the module's `End`
- // (or the age sweep) retires the entry.
- if may_research {
- registration.keep_for_background();
- }
- Ok(response)
- }
- Ok(Err(refusal)) => Err(match refusal {
- RemixRefusal::Closing => "the tinymemes module is closing".to_owned(),
- RemixRefusal::Unauthenticated => "the tinymemes module refused the caller".to_owned(),
- }),
- Err(error) => Err(format!("tinymemes remix call failed: {error}")),
- }
-}
-
-#[cfg(test)]
-#[path = "service_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/tinymemes/service_tests.rs b/crates/openhuman-core/src/tinymemes/service_tests.rs
deleted file mode 100644
index 63c0c7f439..0000000000
--- a/crates/openhuman-core/src/tinymemes/service_tests.rs
+++ /dev/null
@@ -1,262 +0,0 @@
-use super::*;
-use serde_json::{json, Value};
-use tinybus::{broker::Broker, transport::memory::MemoryBus};
-use tinymemes_bus::{HostFailure, HostResult};
-
-fn config_in(dir: &std::path::Path) -> Config {
- let mut config = Config::default();
- config.config_path = dir.join("config.toml");
- config.workspace_dir = dir.join("workspace");
- config.secrets.encrypt = false;
- config
-}
-
-/// A host connection serving the callbacks, the peer that owns the module's
-/// bus name, and a peer that does not.
-struct Bus {
- host: Connection,
- module: Connection,
- intruder: Connection,
-}
-
-async fn bus() -> Bus {
- let bus = MemoryBus::new();
- Broker::new().spawn(bus.clone());
- let connect = || async {
- Connection::connect(bus.connect().await.unwrap())
- .await
- .unwrap()
- };
- let (host, module, intruder) = (connect().await, connect().await, connect().await);
- install(&host).await.unwrap();
- module.request_name(STATE_INTERFACE).await.unwrap();
- Bus {
- host,
- module,
- intruder,
- }
-}
-
-impl Bus {
- async fn call(
- &self,
- from: &Connection,
- member: &str,
- payload: Value,
- ) -> tinybus::Result<Value> {
- let host = self.host.unique_name().unwrap();
- from.proxy(host.as_str(), HOST_PATH, HOST_INTERFACE)
- .unwrap()
- .call(member, (payload,))
- .await
- }
-}
-
-fn decode<T: serde::de::DeserializeOwned>(value: Value) -> HostResult<T> {
- serde_json::from_value(value).unwrap()
-}
-
-#[tokio::test]
-async fn only_the_module_may_call_back_and_only_for_a_live_remix() {
- let dir = tempfile::tempdir().unwrap();
- let bus = bus().await;
- let registration = callbacks::register(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir.path()),
- );
- let correlation = registration.correlation().to_owned();
- let deliver = json!({ "correlation": correlation, "reply": "hi", "remixed": true });
-
- // The module, for its own live remix.
- let ok = bus
- .call(&bus.module, host_methods::DELIVER, deliver.clone())
- .await
- .unwrap();
- assert_eq!(decode::<()>(ok), Ok(()));
-
- // A peer that does not own the module's bus name, with a valid id.
- let refused = bus
- .call(&bus.intruder, host_methods::DELIVER, deliver)
- .await;
- assert!(refused.is_err(), "a stranger must not reach the callbacks");
-
- // The module, with an id nobody registered, or none at all.
- for payload in [
- json!({ "correlation": "not-a-live-remix", "reply": "hi", "remixed": true }),
- json!({ "reply": "hi", "remixed": true }),
- json!({ "correlation": "", "reply": "hi", "remixed": true }),
- ] {
- let refused = bus.call(&bus.module, host_methods::DELIVER, payload).await;
- assert!(refused.is_err(), "no live remix, no answer");
- }
-}
-
-#[tokio::test]
-async fn a_direct_call_without_the_brokers_context_is_unauthenticated() {
- let bus = bus().await;
- let service = HostService {
- connection: bus.host.clone(),
- };
- let error = tinybus::Interface::call(
- &service,
- &MemberName::new(host_methods::DELIVER).unwrap(),
- json!([{}]),
- )
- .await
- .unwrap_err();
- assert!(error.to_string().contains("unauthenticated"), "{error}");
-}
-
-#[tokio::test]
-async fn remixes_for_different_workspaces_are_served_at_once_each_for_its_own() {
- let (dir_a, dir_b) = (tempfile::tempdir().unwrap(), tempfile::tempdir().unwrap());
- let bus = bus().await;
- let a = callbacks::register(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir_a.path()),
- );
- let b = callbacks::register(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir_b.path()),
- );
- assert_ne!(a.correlation(), b.correlation());
-
- // Both are live together: neither waits for the other.
- let save = |registration: &callbacks::Registration, json: &str| {
- let payload =
- json!({ "correlation": registration.correlation(), "kind": "slang", "json": json });
- bus.call(&bus.module, host_methods::SAVE_INDEX, payload)
- };
- let (saved_a, saved_b) = tokio::join!(save(&a, "{\"a\":1}"), save(&b, "{\"b\":1}"));
- assert_eq!(decode::<()>(saved_a.unwrap()), Ok(()));
- assert_eq!(decode::<()>(saved_b.unwrap()), Ok(()));
-
- let load = |registration: &callbacks::Registration| {
- let payload = json!({ "correlation": registration.correlation(), "kind": "slang" });
- bus.call(&bus.module, host_methods::LOAD_INDEX, payload)
- };
- assert_eq!(
- decode::<Option<String>>(load(&a).await.unwrap()),
- Ok(Some("{\"a\":1}".into()))
- );
- assert_eq!(
- decode::<Option<String>>(load(&b).await.unwrap()),
- Ok(Some("{\"b\":1}".into()))
- );
-}
-
-#[tokio::test]
-async fn end_retires_the_remix_and_is_harmless_when_repeated_or_unknown() {
- let dir = tempfile::tempdir().unwrap();
- let bus = bus().await;
- let registration = callbacks::register(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir.path()),
- );
- let correlation = registration.correlation().to_owned();
- registration.keep_for_background();
-
- let ended = bus
- .call(
- &bus.module,
- host_methods::END,
- json!({ "correlation": correlation }),
- )
- .await
- .unwrap();
- assert_eq!(decode::<()>(ended), Ok(()));
- let after = bus
- .call(
- &bus.module,
- host_methods::EVALUATE,
- json!({ "correlation": correlation, "body": {} }),
- )
- .await;
- assert!(after.is_err(), "an ended remix answers nothing");
-
- for correlation in [correlation.as_str(), "never-registered"] {
- let again = bus
- .call(
- &bus.module,
- host_methods::END,
- json!({ "correlation": correlation }),
- )
- .await
- .unwrap();
- assert_eq!(decode::<()>(again), Ok(()));
- }
- // A stranger cannot end somebody else's remix.
- let dir2 = tempfile::tempdir().unwrap();
- let live = callbacks::register(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir2.path()),
- );
- let refused = bus
- .call(
- &bus.intruder,
- host_methods::END,
- json!({ "correlation": live.correlation() }),
- )
- .await;
- assert!(refused.is_err());
- assert!(callbacks::session(live.correlation()).is_some());
-}
-
-#[tokio::test]
-async fn an_unavailable_capability_is_reported_not_faked() {
- let dir = tempfile::tempdir().unwrap();
- let bus = bus().await;
- let registration = callbacks::register(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config_in(dir.path()),
- );
- let reply = bus
- .call(
- &bus.module,
- host_methods::EVALUATE,
- json!({ "correlation": registration.correlation(), "body": { "questions": {} } }),
- )
- .await
- .unwrap();
- assert_eq!(
- decode::<tinymemes_bus::EvaluateEnvelope>(reply),
- Err(HostFailure::Unsupported)
- );
-}
-
-#[tokio::test]
-async fn component_off_refuses_before_any_module_load() {
- let mut config = Config::default();
- config.components.memes = false;
- let request: RemixRequest =
- serde_json::from_str(r#"{"conversation":[],"reply":"hi"}"#).unwrap();
- let error = remix(
- &crate::core::runtime::DispatchCtx::host_default(),
- &config,
- request,
- )
- .await
- .unwrap_err();
- assert!(error.contains("component is off"), "{error}");
-}
-
-#[test]
-fn foreground_remixes_share_a_lock_per_workspace_and_never_across_workspaces() {
- let (dir_a, dir_b) = (tempfile::tempdir().unwrap(), tempfile::tempdir().unwrap());
- let (a, b) = (config_in(dir_a.path()), config_in(dir_b.path()));
- assert!(std::sync::Arc::ptr_eq(&scope_lock(&a), &scope_lock(&a)));
- assert!(!std::sync::Arc::ptr_eq(&scope_lock(&a), &scope_lock(&b)));
-}
-
-#[tokio::test]
-async fn a_second_remix_for_one_workspace_waits_for_the_first_but_another_workspace_does_not() {
- let (dir_a, dir_b) = (tempfile::tempdir().unwrap(), tempfile::tempdir().unwrap());
- let (a, b) = (config_in(dir_a.path()), config_in(dir_b.path()));
- let held = scope_lock(&a);
- let _first = held.lock().await;
- assert!(scope_lock(&a).try_lock().is_err(), "same workspace waits");
- assert!(
- scope_lock(&b).try_lock().is_ok(),
- "another workspace does not"
- );
-}
diff --git a/crates/openhuman-core/src/tools/ops_tests_catalog_fixture_tests.rs b/crates/openhuman-core/src/tools/ops_tests_catalog_fixture_tests.rs
index 9914700e4f..87876943d3 100644
--- a/crates/openhuman-core/src/tools/ops_tests_catalog_fixture_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests_catalog_fixture_tests.rs
@@ -39,7 +39,6 @@ fn full_product_features_enabled() -> bool {
("scheduler-gate", cfg!(feature = "scheduler-gate")),
("file-logging", cfg!(feature = "file-logging")),
("hosting", cfg!(feature = "hosting")),
- ("tinymemes", cfg!(feature = "tinymemes")),
("inbound-queues", cfg!(feature = "inbound-queues")),
("storage-sqlite", cfg!(feature = "storage-sqlite")),
("storage-file", cfg!(feature = "storage-file")),
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_event_match.rs b/crates/openhuman-core/src/web_chat/progress_bridge_event_match.rs
index 56a8fa79a0..49a618b693 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_event_match.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_event_match.rs
@@ -427,17 +427,15 @@
// Buffer the round's narration so it can be flushed as an
// interim bubble if a tool call closes this round.
pending_narration.push_str(&delta);
- if !metadata.hold_text_stream {
- text_events::publish_text_delta(
- &dispatch_ctx,
- &mut emit_seq,
- &client_id,
- &thread_id,
- &request_id,
- iteration,
- delta,
- );
- }
+ text_events::publish_text_delta(
+ &dispatch_ctx,
+ &mut emit_seq,
+ &client_id,
+ &thread_id,
+ &request_id,
+ iteration,
+ delta,
+ );
}
AgentProgress::ThinkingDelta { delta, iteration } => {
publish_seq_stamped(
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_spawn.rs b/crates/openhuman-core/src/web_chat/progress_bridge_spawn.rs
index dcdbafad09..bf5004a079 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_spawn.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_spawn.rs
@@ -27,14 +27,13 @@ pub(crate) fn spawn_progress_bridge(
let timing_snapshot_for_task = timing_snapshot.clone();
dispatch_ctx.clone().spawn(async move {
log::debug!(
- "[web_channel][bridge] spawned client_id={} thread_id={} request_id={} speak_reply={:?} source={:?} session_id={:?} hold_text_stream={}",
+ "[web_channel][bridge] spawned client_id={} thread_id={} request_id={} speak_reply={:?} source={:?} session_id={:?}",
client_id,
thread_id,
request_id,
metadata.speak_reply,
metadata.source,
metadata.session_id,
- metadata.hold_text_stream,
);
let mut round: u32 = 0;
// Accumulates the parent agent's streamed narration for the current
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
index 3788dd3ba9..21477f1750 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
@@ -564,81 +564,6 @@ fn cap_wire_args_truncates_oversized_payload_to_a_marker_string() {
assert!(rendered.contains("truncated"));
}
-/// `SubagentSpawned.parent_call_id` must reach the wire (`subagent.parent_call_id`
-/// on `subagent_spawned`) so the frontend can key the delegation row to the
-/// spawning tool call (#C1).
-#[tokio::test]
-async fn hold_text_stream_suppresses_text_delta_but_keeps_interim() {
- use crate::progress::AgentProgress;
- let tmp = tempfile::TempDir::new().unwrap();
- let config = crate::config::Config {
- workspace_dir: tmp.path().join("workspace"),
- action_dir: tmp.path().join("workspace"),
- config_path: tmp.path().join("config.toml"),
- ..Default::default()
- };
- let store = std::sync::Arc::new(tinyagents_session::port::InMemoryTurnStates::default())
- as std::sync::Arc<dyn tinyagents_session::port::TurnStates>;
- let (tx, rx) = tokio::sync::mpsc::channel(16);
- let mut bus = super::super::event_bus::subscribe_web_channel_events();
- spawn_progress_bridge(
- rx,
- "client-hold".into(),
- "thread-hold".into(),
- "req-hold".into(),
- store,
- ChatRequestMetadata {
- hold_text_stream: true,
- ..Default::default()
- },
- config,
- crate::core::runtime::DispatchCtx::ambient(),
- );
-
- tx.send(AgentProgress::TextDelta {
- delta: "Let me check the release notes for you first.".into(),
- iteration: 1,
- })
- .await
- .unwrap();
- tx.send(AgentProgress::ToolCallStarted {
- call_id: "tc-hold".into(),
- tool_name: "web_search".into(),
- arguments: serde_json::json!({}),
- iteration: 1,
- display_label: None,
- display_detail: None,
- })
- .await
- .unwrap();
-
- let events = tokio::time::timeout(std::time::Duration::from_secs(5), async {
- let mut seen = Vec::new();
- loop {
- match bus.recv().await {
- Ok(ev) if ev.thread_id == "thread-hold" => {
- let done = ev.event == "chat_interim";
- seen.push((ev.event.clone(), ev.full_response.clone()));
- if done {
- return seen;
- }
- }
- Ok(_) => continue,
- Err(err) => panic!("bus closed: {err}"),
- }
- }
- })
- .await
- .expect("chat_interim within timeout");
-
- assert!(!events.iter().any(|(e, _)| e == "text_delta"), "{events:?}");
- // The interim bubble carries the held narration itself.
- let interim = events.iter().find(|(e, _)| e == "chat_interim").unwrap();
- assert_eq!(
- interim.1.as_deref(),
- Some("Let me check the release notes for you first.")
- );
-}
#[path = "progress_bridge_tool_progress_tests.rs"]
mod tool_progress_tests;
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_text_events.rs b/crates/openhuman-core/src/web_chat/progress_bridge_text_events.rs
index bc91c1d237..2027c7de5a 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_text_events.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_text_events.rs
@@ -1,7 +1,7 @@
//! The parent agent's streamed answer text, as `text_delta` socket events.
//!
-//! Kept out of the bridge loop so a held stream (`hold_text_stream`, set for
-//! threads whose final reply is post-processed) is a one-line guard there.
+//! Kept out of the bridge loop so the loop's `TextDelta` arm stays a single
+//! call.
use crate::web_chat::WebChannelEvent;
diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rs
index 3f0fb01f44..6441df002b 100644
--- a/crates/openhuman-core/src/web_chat/run_task.rs
+++ b/crates/openhuman-core/src/web_chat/run_task.rs
@@ -185,12 +185,6 @@ pub(crate) async fn run_chat_task(
// can attribute the run (`agent.id` attr / `agent.turn:<id>` trace name).
let mut bridge_metadata = metadata.clone();
bridge_metadata.agent_id = Some(current_fp.target_agent_id.clone());
- // A TinyMemes treatment thread surfaces only the remixed reply, so the
- // original answer text is not streamed ahead of it.
- #[cfg(feature = "tinymemes")]
- {
- bridge_metadata.hold_text_stream = crate::tinymemes::holds_text_stream(&config, thread_id);
- }
let bridge = spawn_progress_bridge(
progress_rx,
client_id.to_string(),
@@ -206,8 +200,6 @@ pub(crate) async fn run_chat_task(
// wrappers below hold a pointer rather than inlining the whole future into
// this already-large `run_chat_task` frame (which otherwise overflows the
// default test-thread stack — see the channels web-turn coverage tests).
- #[cfg(feature = "tinymemes")]
- let turn_started = std::time::Instant::now();
let turn = Box::pin(agent.run_single_with_approval(message, Some(origin), approval));
let mut result = match turn.await {
Ok(response) => {
@@ -283,11 +275,6 @@ pub(crate) async fn run_chat_task(
}
}
};
- // The agent turn's own duration for the TinyMemes A/B log, taken before
- // reply speech so synthesis time is not counted as turn time.
- #[cfg(feature = "tinymemes")]
- let turn_elapsed = turn_started.elapsed();
-
if let Ok(ref task_result) = result {
let speak_reply = matches!(metadata.speak_reply, Some(true));
let trimmed_response = task_result.full_response.trim();
@@ -324,24 +311,6 @@ pub(crate) async fn run_chat_task(
}
}
- // TinyMemes: remix the final reply (slang + memes) when the flag puts this
- // thread in the treatment arm. Runs after reply speech so TTS reads the
- // original wording, and skips the budget-exhausted placeholder. Fails open.
- #[cfg(feature = "tinymemes")]
- if let Ok(ref mut task_result) = result {
- crate::tinymemes::remix_task_reply(
- ctx,
- &config,
- thread_id,
- request_id,
- message,
- &mut task_result.full_response,
- inference_budget_exceeded_user_message(),
- turn_elapsed,
- )
- .await;
- }
-
// Test hook: wedge the turn after its run, as a stuck save would.
#[cfg(any(test, debug_assertions))]
if super::ops::TEST_PARK_AFTER_RUN.load(std::sync::atomic::Ordering::SeqCst) {
diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rs
index 06bbc82ca8..d266cd40c3 100644
--- a/crates/openhuman-core/src/web_chat/schemas.rs
+++ b/crates/openhuman-core/src/web_chat/schemas.rs
@@ -182,9 +182,6 @@ fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture
// Attribution is stamped later by run_chat_task once the
// target agent is resolved.
agent_id: None,
- // Decided by run_chat_task once the thread's TinyMemes
- // arm is known.
- hold_text_stream: false,
},
)
.await?,
diff --git a/crates/openhuman-core/src/web_chat/types.rs b/crates/openhuman-core/src/web_chat/types.rs
index 448ea3c36e..9fbca4b9a7 100644
--- a/crates/openhuman-core/src/web_chat/types.rs
+++ b/crates/openhuman-core/src/web_chat/types.rs
@@ -154,12 +154,6 @@ pub struct ChatRequestMetadata {
/// is resolved — used purely for trace attribution (Langfuse `agent.id` /
/// `agent.turn:<id>` trace name), never for routing.
pub agent_id: Option<String>,
- /// Do not stream the orchestrator's answer text (`text_delta`) to the
- /// client; the reply arrives whole in `chat_done`. Set for threads whose
- /// final reply is post-processed (TinyMemes treatment arm), so the user
- /// never sees the original stream in and then get replaced. Interim
- /// narration before tool calls is still flushed as `chat_interim`.
- pub hold_text_stream: bool,
}
#[derive(Debug, Deserialize)]
diff --git a/crates/openhuman-embed/Cargo.toml b/crates/openhuman-embed/Cargo.toml
index 1d0cd7655d..4c7beae99f 100644
--- a/crates/openhuman-embed/Cargo.toml
+++ b/crates/openhuman-embed/Cargo.toml
@@ -23,7 +23,6 @@ http-server = ["openhuman-core/http-server"]
inference = ["openhuman-core/inference"]
documents = ["openhuman-core/documents"]
hosting = ["openhuman-core/hosting"]
-tinymemes = ["openhuman-core/tinymemes"]
inbound-queues = ["openhuman-core/inbound-queues"]
modules = ["openhuman-core/modules", "tinybus/modules"]
voice = ["openhuman-core/voice"]
diff --git a/crates/openhuman-rpc/Cargo.toml b/crates/openhuman-rpc/Cargo.toml
index 9697ce9943..588095919d 100644
--- a/crates/openhuman-rpc/Cargo.toml
+++ b/crates/openhuman-rpc/Cargo.toml
@@ -53,7 +53,6 @@ http-server = ["openhuman-tinyhumans/http-server"]
inference = ["openhuman-tinyhumans/inference"]
documents = ["openhuman-tinyhumans/documents"]
hosting = ["openhuman-tinyhumans/hosting"]
-tinymemes = ["openhuman-tinyhumans/tinymemes"]
inbound-queues = ["openhuman-tinyhumans/inbound-queues"]
modules = ["openhuman-tinyhumans/modules"]
voice = ["openhuman-tinyhumans/voice"]
diff --git a/crates/openhuman-tinyhumans/Cargo.toml b/crates/openhuman-tinyhumans/Cargo.toml
index f3c356fa8e..2d686eb536 100644
--- a/crates/openhuman-tinyhumans/Cargo.toml
+++ b/crates/openhuman-tinyhumans/Cargo.toml
@@ -23,7 +23,6 @@ http-server = ["openhuman-embed/http-server"]
inference = ["openhuman-embed/inference"]
documents = ["openhuman-embed/documents"]
hosting = ["openhuman-embed/hosting"]
-tinymemes = ["openhuman-embed/tinymemes"]
inbound-queues = ["openhuman-embed/inbound-queues"]
modules = ["openhuman-embed/modules"]
voice = ["openhuman-embed/voice", "dep:tinyagents-live"]
diff --git a/crates/openhuman-tui/Cargo.toml b/crates/openhuman-tui/Cargo.toml
index 27b038243a..5c70e79268 100644
--- a/crates/openhuman-tui/Cargo.toml
+++ b/crates/openhuman-tui/Cargo.toml
@@ -39,7 +39,6 @@ http-server = ["openhuman-rpc/http-server"]
inference = ["openhuman-rpc/inference"]
documents = ["openhuman-rpc/documents"]
hosting = ["openhuman-rpc/hosting"]
-tinymemes = ["openhuman-rpc/tinymemes"]
inbound-queues = ["openhuman-rpc/inbound-queues"]
modules = ["openhuman-rpc/modules"]
voice = ["openhuman-rpc/voice"]
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md
index 13bb18bf86..e663bc0a9b 100644
--- a/docs/TEST-COVERAGE-MATRIX.md
+++ b/docs/TEST-COVERAGE-MATRIX.md
@@ -196,7 +196,7 @@ Local inference runs against a runtime the user installs, starts, and pulls mode
| 4.2.10 | Durable agent reply (core stores it before announcing `chat_done`) | RU+VU | `crates/openhuman-core/src/web_chat/reply_persistence_tests.rs`, `crates/openhuman-core/src/web_chat/presentation_tests.rs`, `app/src/providers/__tests__/ChatRuntimeProvider.test.tsx` | ✅ | `deliver_response` persists an unsegmented reply under `agent:<request_id>` before publishing the terminal event, so a dropped socket, a failed `threads_message_append` or a reloaded webview costs a repaint rather than the answer; the client's append collapses onto that row by id. RU covers the write, its idempotency, the empty-reply and missing-thread paths, and that delivery still announces when the store refuses. VU covers the mirrored id, the segmented exception, the refetch that recovers a failed append, and the reconnect that rejoins orphaned thread rooms. WD E2E (kill the append mid-turn) is a follow-up |
| 4.2.11 | Links open in the default browser; the main webview never loads a remote page | RU+VU+MS | `crates/openhuman-app/src/external_navigation_tests.rs`, `app/src/utils/openUrl.test.ts`, `app/src/utils/externalLinkGuard.test.ts`, `app/src/components/Announcement/AnnouncementModal.test.tsx`, release-manual-smoke | 🟡 | RU covers the shell's navigation policy: remote http(s) navigation of `main` is cancelled and handed to the OS opener; `tauri://localhost`, `tauri.localhost`, `about:`/`data:`/`blob:` and the `tauri dev` server stay in the webview; other webviews are untouched. VU covers `openUrl` never falling back to `window.open` in the desktop shell (including the IPC bridge bootstrap gap) and the click guard. Real macOS click verified manually; automated desktop E2E is a follow-up (the WDIO desktop runner still assumes CEF) |
| 4.2.12 | Live stream renders like the reopened thread (parity, append-only, atomic settle) | VU+WD | `app/src/providers/__tests__/liveHistoryParity.test.tsx`, `app/src/store/__tests__/chatRuntimeSlice.liveParity.test.ts`, `app/src/features/conversations/derived/mapDisplayItems.test.ts`, `app/src/services/chatDeltaCoalescer.test.ts`, `app/src/features/conversations/components/AssistantUiToolCall.disclosure.test.tsx`, `app/src/components/assistant-ui/elements/reasoning-panel.test.tsx`, `app/src/components/assistant-ui/thread.followBottom.test.tsx`, `chat-live-history-parity.spec.ts` | ✅ | One scripted turn (`app/src/test/fixtures/streamedTurn.ts`) is told as socket events and as the core transcript. VU drives it through the real socket handlers: the settled reply equals the reload projection, the tail is append-only while it streams, and `chat_done` swaps tail for reply in one store update at one index. Also covered: in-place sub-agent promotion on both sides, args-delta row adoption, a superseded settle, frame-coalesced deltas, disclosure state across remounts, and following that survives a collapse. WD samples the real DOM while streaming, checks the viewport still follows, and compares with the reopened thread |
-| 4.2.13 | Final-reply remix with region slang and memes (TinyMemes, `OPENHUMAN_TINYMEMES` off/on/ab) | RU+VU | `crates/openhuman-core/src/tinymemes/arm_tests.rs`, `crates/openhuman-core/src/tinymemes/mod_tests.rs`, `crates/openhuman-core/src/tinymemes/callbacks_tests.rs`, `crates/openhuman-core/src/tinymemes/history_tests.rs`, `crates/openhuman-core/src/tinymemes/docs_tests.rs`, `crates/openhuman-core/src/tinymemes/service_tests.rs`, `crates/openhuman-core/src/tinymemes/e2e_tests.rs`, `crates/openhuman-core/src/tinymemes/inference_tests.rs`, `crates/openhuman-core/src/web_chat/progress_bridge_tests.rs::hold_text_stream_suppresses_text_delta_but_keeps_interim`, `app/src/components/markdown/MarkdownImage.test.tsx` | 🟡 | Off by default. RU covers the flag (runtime value over the build-time default), stable per-thread A/B buckets, delivered-history conversion with message ids (the module tags remixed turns from its own ring), the one-shot adoption of the legacy `remixed.json`/index files into storage, host-callback authentication (module peer only, live correlation id only) and per-workspace concurrency, OpenRouter reasoning-off routing, and that treatment threads hold `text_delta` while interim narration still flushes. VU covers capped, lazy, no-referrer meme images. The engine itself (Jev reading, rating, rewrite, meme and slang vetting) runs in the `tinymemes` module and is tested in `tinyhumansai/tinymemes`; the host side is covered with a scripted remixer and the served Complete/Evaluate/Search/LoadIndex/SaveIndex/Deliver/End callbacks; `e2e_tests.rs` drives the real compiled module (runs where a module library is staged). WD E2E of a remixed turn is a follow-up |
+| 4.2.13 | Final-reply remix with region slang and memes (TinyMemes) | — | _retired_ | 🚫 | **Retired.** TinyMemes was removed from OpenHuman (it was off by default behind `OPENHUMAN_TINYMEMES`); the reply remix now lives in chottu-core as `chottu-personality` and is tested there. Old `[memes]` / `components.memes` config keys are ignored on load (`crates/openhuman-core/src/config/schema/load/parse_tests.rs`) |
| 4.2.14 | Tool UI widgets in chat (MCP Apps `ui://` and Apps SDK templates) | RU+VU | `crates/openhuman-core/src/mcp/ui/resolve_tests.rs`, `crates/openhuman-core/src/mcp/ui/ops_tests.rs`, `crates/openhuman-core/src/mcp/ui/decorate_tests.rs`, `crates/openhuman-core/src/mcp/ui/tools_tests.rs`, `crates/openhuman-app/src/widget_scheme_tests.rs`, `app/src/features/conversations/tools/mcpUi/mcpAppBridge.test.ts`, `app/src/features/conversations/tools/mcpUi/McpAppFrame.test.tsx`, `app/src/components/assistant-ui/thread.mcpWidgets.test.tsx` | 🟡 | RU covers template resolution, resource reads, widget tool-call policy, result decoration and the `ohwidget://` proxy scheme. VU covers the bridge, the sandboxed frame, link and QR fallback, and widget placement in the assistant turn. The live widget round-trip against a real MCP server is manual smoke only |
### 4.3 Tool Invocation
diff --git a/docs/dep-audit/2026-10-11-legacy-candidates.md b/docs/dep-audit/2026-10-11-legacy-candidates.md
index f21463f48f..38e27415e0 100644
--- a/docs/dep-audit/2026-10-11-legacy-candidates.md
+++ b/docs/dep-audit/2026-10-11-legacy-candidates.md
@@ -16,9 +16,11 @@ This record selects the defaults for six follow-ups. It changes no runtime behav
## TinyMemes: keep and move to its owner
-[The host adapter](../../crates/openhuman-core/src/tinymemes/mod.rs) runs on the final web-chat reply, leaves the harness transcript original, and falls back to the original reply on failure or timeout. [The web-chat caller](../../crates/openhuman-core/src/web_chat/run_task.rs) holds treatment-arm streaming and invokes the remix after the turn. This is an implemented capability, despite having no dedicated frontend controller.
+> **Superseded.** TinyMemes was later removed from OpenHuman entirely; the reply remix now lives in chottu-core as `chottu-personality`. Links to the removed host adapter below are pinned to the last commit that had it.
-[The experiment selector](../../crates/openhuman-core/src/tinymemes/arm.rs) reads `OPENHUMAN_TINYMEMES`, supports stable per-thread A/B assignment, and falls back to `OPENHUMAN_TINYMEMES_DEFAULT` if supplied during compilation; neither flag means off. [Core defaults](../../crates/openhuman-core/Cargo.toml), [the product feature list](../../scripts/ci/product-features.txt), and [the shell manifest](../../crates/openhuman-app/Cargo.toml) still compile it.
+[The host adapter](https://github.com/tinyhumansai/openhuman/blob/0852b119c3fe83cad8fe4c52612378b8e8661a61/crates/openhuman-core/src/tinymemes/mod.rs) runs on the final web-chat reply, leaves the harness transcript original, and falls back to the original reply on failure or timeout. [The web-chat caller](../../crates/openhuman-core/src/web_chat/run_task.rs) holds treatment-arm streaming and invokes the remix after the turn. This is an implemented capability, despite having no dedicated frontend controller.
+
+[The experiment selector](https://github.com/tinyhumansai/openhuman/blob/0852b119c3fe83cad8fe4c52612378b8e8661a61/crates/openhuman-core/src/tinymemes/arm.rs) reads `OPENHUMAN_TINYMEMES`, supports stable per-thread A/B assignment, and falls back to `OPENHUMAN_TINYMEMES_DEFAULT` if supplied during compilation; neither flag means off. [Core defaults](../../crates/openhuman-core/Cargo.toml), [the product feature list](../../scripts/ci/product-features.txt), and [the shell manifest](../../crates/openhuman-app/Cargo.toml) still compile it.
The [TinyMemes repository](https://github.com/tinyhumansai/tinymemes) owns its engine, evaluation, indexes and sources. Its vendored [manifest](https://github.com/tinyhumansai/tinymemes/blob/46d5fb3b8dfe43b523c79c68975f8d3e524e8cc8/Cargo.toml) is a linked library, with no bus contract or loadable module. Add that boundary upstream rather than delete the experiment to shed a dependency. OpenHuman keeps credential resolution, approved inference/search callbacks, acting identity, delivery and lifecycle policy; the module owns remix execution and index behavior. Preserve opt-in settings and off/control/treatment semantics, original transcripts, timeout fallback and content-free experiment telemetry.
diff --git a/docs/gitbooks/en/developing/components.md b/docs/gitbooks/en/developing/components.md
index ff63f8d00f..3f294344c9 100644
--- a/docs/gitbooks/en/developing/components.md
+++ b/docs/gitbooks/en/developing/components.md
@@ -13,7 +13,6 @@ icon: toggle-on
[components]
flows = true # tinyflows: saved workflows
tinyflows = true # tinyflows module: scheduled jobs (cron) runtime, store and schedule maths
-memes = true # tinymemes
documents = true # tinydocs
search = true # tinysearch
mcp = true # tinymcp
@@ -62,7 +61,6 @@ The first load of an older config moves these once into `[components]`, and the
| `[search] enabled = false` | `components.search = false` |
| `[mcp_client] enabled = false` | `components.mcp = false` |
| `[memory] engine = "none"` | `components.memory = false` (`engine` is kept) |
-| `OPENHUMAN_TINYMEMES` set to an off value | `components.memes = false` |
| `OPENHUMAN_DISABLE_CHANNEL_LISTENERS=1` | `components.channels = false` at load (env override, kept for one release; `OPENHUMAN_COMPONENT_CHANNELS` wins) |
| `[dictation] enabled`, `[voice_server] auto_start` and `always_on_enabled` all explicitly `false` | `components.voice = false` (any other mix keeps voice on); these legacy keys are migration inputs only |
| `[sandbox] enabled = false` (or `[security.sandbox] enabled = false`) | `components.sandbox = false` (`enabled = true` or unset keeps it on; the old key is kept) |
@@ -70,11 +68,9 @@ The first load of an older config moves these once into `[components]`, and the
A `components.*` key already present in the file always wins over its legacy flag, so the migration is idempotent and turning a component back on sticks.
-## Memes
+## Removed components
-`components.memes` is the master switch: off means no remix and no module load, and the A/B arm is ignored. When on, `OPENHUMAN_TINYMEMES` (`off`, `on`, `ab`, `ab:NN`; build-time default `OPENHUMAN_TINYMEMES_DEFAULT`) picks the threads that are remixed. The `[memes]` section tunes it: `timeout_ms` (default 20000) and `meme_cooldown` (default 3). `OPENHUMAN_TINYMEMES_TIMEOUT_MS` and `OPENHUMAN_TINYMEMES_MEME_COOLDOWN` override them when set.
-
-The module reads its own `TINYMEMES_*` overrides from the process environment, so credentials never cross the bus: `TINYMEMES_OPENROUTER_KEY` (and `TINYMEMES_MODEL`) route the rewrite model and slang research through OpenRouter, `TINYMEMES_JEV` (`auto`, `typesafe`, `openrouter`, `openjev`, `llm`) with `TINYMEMES_TYPESAFE_KEY` / `TINYMEMES_OPENJEV_KEY` picks the Jev route. Without any override the module asks OpenHuman for Jev; when OpenHuman has none (signed out, offline session) the chat model answers Jev's questions instead. After the reply is delivered the module may run slang and meme research in the background through OpenHuman web search. Learned slang, memes and the remixed-message ring are documents on the storage port (older `<workspace>/tinymemes/*.json` files are adopted once and renamed `*.migrated`).
+TinyMemes (final-reply slang and meme remixing) is no longer part of OpenHuman. A config that still has `components.memes` or a `[memes]` section loads normally; the keys are ignored and dropped on the next save. `OPENHUMAN_TINYMEMES*` and `OPENHUMAN_COMPONENT_MEMES` are no longer read.
## Event queues
diff --git a/docs/gitbooks/en/developing/embed/api-index.json b/docs/gitbooks/en/developing/embed/api-index.json
index 499a23b35e..4a910669a4 100644
--- a/docs/gitbooks/en/developing/embed/api-index.json
+++ b/docs/gitbooks/en/developing/embed/api-index.json
@@ -491,7 +491,6 @@
"storage-mongodb": false,
"storage-s3": false,
"storage-sqlite": false,
- "tinymemes": true,
"voice": false,
"web3": false
},
diff --git a/docs/gitbooks/en/developing/embed/api-index.md b/docs/gitbooks/en/developing/embed/api-index.md
index 171a18b4da..dbd1937541 100644
--- a/docs/gitbooks/en/developing/embed/api-index.md
+++ b/docs/gitbooks/en/developing/embed/api-index.md
@@ -219,7 +219,6 @@ The compiled capability report describes this build:
"storage-mongodb": false,
"storage-s3": false,
"storage-sqlite": false,
- "tinymemes": true,
"voice": false,
"web3": false
},
diff --git a/docs/gitbooks/en/developing/embed/capability-matrix.md b/docs/gitbooks/en/developing/embed/capability-matrix.md
index 2f7bbba42f..f840966233 100644
--- a/docs/gitbooks/en/developing/embed/capability-matrix.md
+++ b/docs/gitbooks/en/developing/embed/capability-matrix.md
@@ -27,6 +27,5 @@ This matrix comes from the default-feature compiled capability-report example. R
| `storage-mongodb` | No |
| `storage-s3` | No |
| `storage-sqlite` | No |
-| `tinymemes` | Yes |
| `voice` | No |
| `web3` | No |
diff --git a/docs/module-boundary-inventory.md b/docs/module-boundary-inventory.md
index 819ddeb612..f9b3a06c07 100644
--- a/docs/module-boundary-inventory.md
+++ b/docs/module-boundary-inventory.md
@@ -19,7 +19,6 @@ copying its implementation into a host, or accepting weaker isolation.
| tinymcp | none in normal/build host dependencies | tinymcp-bus | core MCP registry, supervisor, CLI stdio/HTTP server | Merged host adapters use the released v0.16.1 module (contract 1.23; configured-client receipt machine and client cache are `tinymcp_bus::client_lifecycle`, host keeps only the bus-calling driver; identifier validation, the registry-detail JSON shape and the not-connected explanation are `tinymcp_bus` helpers, so the host's `registry/helpers.rs` is gone; bus members the host never calls are kept for other hosts and documented in `tinymcp_bus::names`) for registry, supervisor, client and server protocol operations, with approved host callbacks kept in OpenHuman. The 62-member artifact and local focused, lifecycle, registry, native and build gates pass; frozen recorded tool declarations are restored independently of the current catalog |
| tinychannels | tinychannels, tinychannels-runtime, tinychannels-module (test-only) | tinychannels-bus | core channels, TinyHumans host, CLI REPL | Contract 16 (operation 1.17) is pure; scoped providers, inbound/identity/outbound preparation, remote commands, runtime limits, typing and progressive delivery execute through confidential module calls. Host-owned policy, credentials, persistence and callbacks remain in OpenHuman. Both host implementation exceptions are removed; the 254-test focused suite and released-artifact runtime fixture pass |
| tinyhosts | none | tinyhosts-bus | core hosting tools | Released Execute/Providers contract consumed through the module (v0.4.0: tool-to-operation mapping, argument shaping, outcome matching and summaries live in `tinyhosts-bus::tools`); workspace authorization, credentials and approval policy remain in OpenHuman |
-| tinymemes | none | tinymemes-bus | core `tinymemes` reply remix | Released Remix contract (v1.1) consumed through the module, which owns the reading, rating, rewrite, slang and meme indexes, the remixed-id ring (behind its `IndexStore` port), the `TINYMEMES_*` env overrides, the LLM-as-Jev fallback and the background slang and meme research. The host serves the Complete, Evaluate, Search, LoadIndex, SaveIndex, Deliver and End callbacks (OpenHuman inference, managed Jev, web search, documents on the storage port), each carrying the remix's correlation id so remixes for different workspaces run concurrently, and keeps the A/B arm, flag and delivered-history policy. `tinymemes-bus` is synchronous and I/O-free (no tinybus or tinystoragedrivers-bus); the typed clients are in `tinymemes-client`, which the host does not link |
| tinyeventqueues | none | tinyeventqueues-bus | core `inbound` domain (`inbound-queues` gate) | Released EventQueues contract (v0.2) consumed through the module, which owns ingress and completion tombstones, the gate, coalescing, salience and habituation, lanes and the digest, cadences and ingestion budgets, dispatch with retry and dead letters, and its own pass timer, all on the host's storage (its `teq.*` collections and the queues of `queues.json` through the storage bus `Queues` object). The host serves the `Deliver` and `ClassifySalience` callbacks (triage under the remote-trigger origin) and keeps the `[inbound]` configuration, the routing of Composio triggers and agent webhooks, and the direct-path fallback. `tinyeventqueues-bus` is synchronous and I/O-free by default; its optional `storage` feature declares the schema |
| tinywallet | none in normal/build host dependencies | tinywallet-bus | core wallet/web3/x402 | Complete: v0.20.0 contract 1.14 adds mnemonic word-count validation to module-owned mnemonic derivation, native transactions, Web3 quotes/execution, ERC-20 encoding, and x402 payment parsing/budgets/ledger. OpenHuman retains encrypted-key custody, authenticated transport, explicit approval, and lifecycle orchestration |
| tinybox | tinybox-core (test-only) | tinybox-bus | core sandbox and security, desktop gateways | Host cutover uses TinyBox v0.1.28 (contract 1.18); the host calls members only through `tinybox_bus::names` constants and uses `tinybox_bus::CommandClass` directly (no host copy or re-export). It covers for sandbox/resource lifecycle, collected and supervised execution, jailed and native shell execution (unsandboxed, cron and the `shell` tool run through `StartNativeShellExec`; core has no shell selection or spawn of its own), standalone Docker policy validation (`ValidateDockerPolicy`), Docker control, local grants (`ResolveLocalGrants`; the host re-applies `is_always_forbidden` to the reply), file transfer and port forwarding. Host authorization and the security floor remain in OpenHuman |
diff --git a/docs/storage-schema.md b/docs/storage-schema.md
index 745e0dabba..f7e23e7f95 100644
--- a/docs/storage-schema.md
+++ b/docs/storage-schema.md
@@ -157,17 +157,6 @@ Record shapes and migrations stay with their owners.
| `mcp.tool_cache` | | | |
| `tsd.migrations` | | | |
-## tinymemes-bus
-
-| Collection | Indexes | Expiry field | Search fields |
-| --- | --- | --- | --- |
-| `memes.remix_markers` | | | |
-| `memes.state` | | | |
-| `remix_markers` | | | |
-| `tinymemes_documents` | | | |
-| `tsd.leases` | | | |
-| `tsd.migrations` | | | |
-
## tinyskills-drivers
| Collection | Indexes | Expiry field | Search fields |
diff --git a/llms-full.txt b/llms-full.txt
index 65677ecabf..9724efd40b 100644
--- a/llms-full.txt
+++ b/llms-full.txt
@@ -2831,7 +2831,6 @@ This matrix comes from the default-feature compiled capability-report example. R
| `storage-mongodb` | No |
| `storage-s3` | No |
| `storage-sqlite` | No |
-| `tinymemes` | Yes |
| `voice` | No |
| `web3` | No |
@@ -3111,7 +3110,6 @@ The compiled capability report describes this build:
"storage-mongodb": false,
"storage-s3": false,
"storage-sqlite": false,
- "tinymemes": true,
"voice": false,
"web3": false
},
diff --git a/scripts/__tests__/check-storage-schema.test.mjs b/scripts/__tests__/check-storage-schema.test.mjs
index 3a7ccdcf2c..3840e4c2ed 100644
--- a/scripts/__tests__/check-storage-schema.test.mjs
+++ b/scripts/__tests__/check-storage-schema.test.mjs
@@ -40,12 +40,6 @@ test('collection names must be <owner>.<entity> in snake_case', () => {
assert.equal(problems.length, 3, problems.join('\n'));
});
-test('known legacy migration collections remain inventoried', () => {
- assert.deepEqual(lint({
- owners: [{ crate: 'openhuman', collections: [collection('remix_markers'), collection('tinymemes_documents')] }],
- }), []);
-});
-
test('duplicate collection and index names are refused within one crate', () => {
const problems = lint({
owners: [{ crate: 'tinyflows-scheduler', collections: [
diff --git a/scripts/__tests__/module-build.test.mjs b/scripts/__tests__/module-build.test.mjs
index 4b3de72c45..92f1a7cff3 100644
--- a/scripts/__tests__/module-build.test.mjs
+++ b/scripts/__tests__/module-build.test.mjs
@@ -80,7 +80,7 @@ test("the operator-trust file maps the artifact name to the sha256 of its bytes"
test("every registry record carries a SourceSpec whose manifest exists in its submodule", () => {
const specs = parseSourceSpecs(readRegistry(DEFAULT_ROOT));
- assert.equal(specs.size, 14);
+ assert.equal(specs.size, 13);
for (const spec of specs.values()) {
assert.equal(spec.submodule, spec.id);
const manifest = join(DEFAULT_ROOT, "vendor", spec.submodule, spec.manifest);
diff --git a/scripts/ci/check-storage-schema.mjs b/scripts/ci/check-storage-schema.mjs
index 04cae664c9..71540236a8 100644
--- a/scripts/ci/check-storage-schema.mjs
+++ b/scripts/ci/check-storage-schema.mjs
@@ -32,7 +32,6 @@ export const REPO_ROOT = resolve(HERE, '..', '..');
export const DOC_PATH = resolve(REPO_ROOT, 'docs', 'storage-schema.md');
const COLLECTION = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_]*$/;
-const LEGACY_COLLECTIONS = new Set(['remix_markers', 'tinymemes_documents']);
const TIME_SUFFIX = /(_at|_ns|_us|_secs|_ts|_time)$/;
/** Features the dump is built with: the contributor set plus the wallet owner. */
@@ -43,9 +42,8 @@ export const DUMP_FEATURES = 'web3';
* dump with the feature set of an existing plain build so Cargo reuses it
* instead of compiling the core again: a comma list, or `core-product` for
* `scripts/ci/product-features.sh --core` (what the plain `openhuman-cli`
- * builds use). The schema is only gated on flows, skills, modules, web3 and
- * tinymemes, all of which are in the default set plus web3 and in the product
- * set, so the dump is identical; the wallet owner (web3) must be in any
+ * builds use). The schema is only gated on flows, skills, modules and web3,
+ * all of which are in the default set plus web3 and in the product set, so the dump is identical; the wallet owner (web3) must be in any
* override.
*/
export function dumpFeatures(env = process.env, root = REPO_ROOT) {
@@ -100,7 +98,7 @@ export function lint(dump) {
crates.add(owner.crate);
for (const collection of owner.collections ?? []) {
const { name, indexes = [], ttl_field: ttlField, search } = collection;
- if (!COLLECTION.test(name) && !LEGACY_COLLECTIONS.has(name)) {
+ if (!COLLECTION.test(name)) {
problems.push(`${owner.crate}: collection "${name}" must be <owner>.<entity> with a snake_case entity`);
}
const key = `${owner.crate}\0${name}`;
diff --git a/scripts/ci/module-boundaries.json b/scripts/ci/module-boundaries.json
index c8d49a0352..f8931fa2ff 100644
--- a/scripts/ci/module-boundaries.json
+++ b/scripts/ci/module-boundaries.json
@@ -7,7 +7,6 @@
"tinychannels",
"tinychannels-runtime",
"tinyhosts",
- "tinymemes",
"tinybox-core",
"tinybox-jail",
"tinybox-docker",
@@ -43,7 +42,6 @@
"tinymcp-",
"tinychannels-",
"tinyhosts-",
- "tinymemes-",
"tinybox-",
"tinywallet-",
"tinycomputer-",
@@ -105,11 +103,6 @@
"manifest": "vendor/tinyhosts/crates/tinyhosts-bus/Cargo.toml",
"owner": "https://github.com/tinyhumansai/tinyhosts"
},
- {
- "name": "tinymemes-bus",
- "manifest": "vendor/tinymemes/crates/tinymemes-bus/Cargo.toml",
- "owner": "https://github.com/tinyhumansai/tinymemes"
- },
{
"name": "tinybox-bus",
"manifest": "vendor/tinybox/crates/tinybox-bus/Cargo.toml",
diff --git a/scripts/ci/process-statics.json b/scripts/ci/process-statics.json
index 02ecdba5cb..ead5ab952c 100644
--- a/scripts/ci/process-statics.json
+++ b/scripts/ci/process-statics.json
@@ -529,26 +529,6 @@
"reason": "Keeps the one process-wide event-bus subscription that writes artifact rows alive and makes registration idempotent; it holds no data, and each event names the workspace and thread its row is written to.",
"verification": "threads/artifact_rows_tests.rs: recording_an_artifact_twice_writes_one_row"
},
- {
- "file": "crates/openhuman-core/src/tinymemes/callbacks.rs",
- "scope": "",
- "name": "REGISTRY",
- "type": "LazyLock<Mutex<HashMap<String,Entry>>>",
- "count": 1,
- "category": "B",
- "reason": "Keyed by a random per-remix correlation id; each entry holds the registering caller's config and CoreContext, which every callback re-enters. Callbacks are accepted only from the module peer (bus name owner) for a live id, and the entry is retired by End, a failed call, or an age sweep.",
- "verification": "tinymemes/service_tests.rs: only_the_module_may_call_back_and_only_for_a_live_remix"
- },
- {
- "file": "crates/openhuman-core/src/tinymemes/service.rs",
- "scope": "",
- "name": "FOREGROUND",
- "type": "std::sync::LazyLock<std::sync::Mutex<std::collections::HashMap<String,std::sync::Arc<tokio::sync::Mutex<()>>>>, >",
- "count": 1,
- "category": "B",
- "reason": "Holds only unit mutexes. The key is the workspace directory, so different workspaces never share or wait on a lock and no tenant data is stored.",
- "verification": "tinymemes/service_tests.rs: foreground_remixes_share_a_lock_per_workspace_and_never_across_workspaces"
- },
{
"file": "crates/openhuman-core/src/tools/sources.rs",
"scope": "",
diff --git a/scripts/ci/product-features.txt b/scripts/ci/product-features.txt
index aff89c96af..2179218a49 100644
--- a/scripts/ci/product-features.txt
+++ b/scripts/ci/product-features.txt
@@ -95,11 +95,6 @@ hosting
# Memory v2 has no gate: the `memory` domain is always compiled, and with no
# usable engine (signed out, no CortexDB key) it reports itself off at runtime.
-# TinyMemes final-reply remix (region slang, reaction memes). Compiled in so a
-# release can turn it on; still off at runtime until OPENHUMAN_TINYMEMES (or a
-# build-time OPENHUMAN_TINYMEMES_DEFAULT) enables it.
-tinymemes
-
# Inbound event queues: Composio triggers and agent webhooks are ingested into
# the tinyeventqueues module, which persists, deduplicates, filters and paces
# them and calls the host back to run triage. Runtime switches:
diff --git a/scripts/ci/storage-bypass-extension.json b/scripts/ci/storage-bypass-extension.json
index 2c9ffb886d..6b7b9789cc 100644
--- a/scripts/ci/storage-bypass-extension.json
+++ b/scripts/ci/storage-bypass-extension.json
@@ -449,16 +449,6 @@
"reason": "Owner-only atomic encrypted-secret/bootstrap file helper; native SecretStore and machine master-key policy have separate admission.",
"issue": "https://github.com/tinyhumansai/openhuman/issues/7421"
},
- {
- "rule": "file-mutation",
- "path": "crates/openhuman-core/src/tinymemes/docs.rs",
- "line": 81,
- "text": "match std::fs::rename(&path, &migrated) {",
- "occurrence": 1,
- "classification": "classic",
- "reason": "Retires the legacy JSON document by renaming it only after the native document-port write succeeds; the native document remains authoritative after adoption.",
- "issue": "https://github.com/tinyhumansai/openhuman/issues/7431"
- },
{
"rule": "file-mutation",
"path": "crates/openhuman-core/src/web3/wallet/ops/state.rs",
diff --git a/scripts/ci/storage-bypass.md b/scripts/ci/storage-bypass.md
index 7fefa23af3..e5a737c282 100644
--- a/scripts/ci/storage-bypass.md
+++ b/scripts/ci/storage-bypass.md
@@ -20,7 +20,7 @@ identities after deleting stale and retired entries. Regeneration requires an
existing baseline, refuses new findings, and can only remove fixed sites.
Canonical merge-base validation also rejects baseline growth.
-`storage-bypass-extension.json` contains **60** reviewed identities for the
+`storage-bypass-extension.json` contains **57** reviewed identities for the
broader coverage. Each records its rule, path, source line, occurrence,
classification, reason, and owning issue. These are identities, not independent
stores or completed migrations. The initial extension must already exist at the
diff --git a/scripts/lib/module-pin-inventory.mjs b/scripts/lib/module-pin-inventory.mjs
index 8dd64031c0..3f9e13d0c9 100644
--- a/scripts/lib/module-pin-inventory.mjs
+++ b/scripts/lib/module-pin-inventory.mjs
@@ -21,7 +21,6 @@ export const PIN_MAP = {
tinyvoice: { submodule: "vendor/tinyvoice" },
tinymcp: { submodule: "vendor/tinymcp" },
tinyconnectors: { submodule: "vendor/tinyconnectors" },
- tinymemes: { submodule: "vendor/tinymemes" },
tinyflows: { submodule: "vendor/tinyflows" },
tinyeventqueues: { submodule: "vendor/tinyeventqueues" },
};
diff --git a/vendor/tinymemes b/vendor/tinymemes
deleted file mode 160000
index 2b91b1a362..0000000000
--- a/vendor/tinymemes
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 2b91b1a36208fb3793c0f6e2292fbb31a88dbeb8