The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
Split the memory module client to stay under the layout gate\n\nThe loading-state work pushed two files past the 750-line limit\n`check-openhuman-rust-layout.mjs` enforces: `memory_part_01.rs` to 842 and\n`memory_tests.rs` to 767.\n\nBoth follow the split conventions already in the tree. `memory_part_04.rs`\ntakes the `MemoryCore` / `MemoryRecall` / `MemoryPortability` / `MemoryIngest`\nimpls and is `include!`d after the other three parts, so it is concatenated\ninto the same module and needs no imports of its own. The `module_call!` and\n`module_call_slow!` macros stay in `memory_part_01.rs`: a `macro_rules!` is\nonly in scope for text that follows it, and `memory_part_02.rs` and\n`memory_part_03.rs` are concatenated before part four.\n\n`memory_tests_part_01_tests.rs` takes the real-module round-trip test and the\nscoring accessor test, wired with `#[path] mod part_01_tests;` the way\n`ops_tests_part_NN_tests.rs` already is in the composio domain. That file is a\nsubmodule rather than an `include!`, so it opens with `use super::*;` and the\none `super::capabilities_for` call becomes `super::super::capabilities_for` —\nit sits a level deeper than it did.\n\nNo behaviour change: same 116 tests pass, and the layout gate is clean.\n
Shanu13f9584c47d1
diff --git a/src/openhuman/modules/memory.rs b/src/openhuman/modules/memory.rsindex 3315d61cd0..92d546bff6 100644--- a/src/openhuman/modules/memory.rs+++ b/src/openhuman/modules/memory.rs@@ -45,3 +45,4 @@ mod tests;include!("memory_part_01.rs");include!("memory_part_02.rs");include!("memory_part_03.rs");+include!("memory_part_04.rs");diff --git a/src/openhuman/modules/memory_part_01.rs b/src/openhuman/modules/memory_part_01.rsindex 9f48293fa9..8013442394 100644--- a/src/openhuman/modules/memory_part_01.rs+++ b/src/openhuman/modules/memory_part_01.rs@@ -676,126 +676,6 @@ impl MemoryProvider for ModuleMemoryProvider {}}-#[async_trait]-impl MemoryCore for ModuleMemoryProvider {- async fn store(- &self,- namespace: &str,- key: &str,- content: &str,- category: MemoryCategory,- session_id: Option<&str>,- taint: MemoryTaint,- ) -> Result<(), MemoryError> {- // No log line carries `namespace`, `key` or `content`: all three are user- // memory content.- self.proxy("store")- .await?- .call::<()>(- methods::STORE,- (- namespace,- key,- content,- category,- session_id.map(str::to_string),- taint,- ),- )- .await- .map_err(|error| from_bus(&error))- }-- async fn get(&self, namespace: &str, key: &str) -> Result<Option<MemoryEntry>, MemoryError> {- self.proxy("get")- .await?- .call(methods::GET, (namespace, key))- .await- .map_err(|error| from_bus(&error))- }-- async fn forget(&self, namespace: &str, key: &str) -> Result<bool, MemoryError> {- self.proxy("forget")- .await?- .call(methods::FORGET, (namespace, key))- .await- .map_err(|error| from_bus(&error))- }-- async fn list(- &self,- namespace: Option<&str>,- category: Option<&MemoryCategory>,- session_id: Option<&str>,- ) -> Result<Vec<MemoryEntry>, MemoryError> {- self.proxy("list")- .await?- .call(- methods::LIST,- (- namespace.map(str::to_string),- category.cloned(),- session_id.map(str::to_string),- ),- )- .await- .map_err(|error| from_bus(&error))- }-- async fn namespaces(&self) -> Result<Vec<NamespaceSummary>, MemoryError> {- self.proxy("namespaces")- .await?- .call(methods::NAMESPACES, ())- .await- .map_err(|error| from_bus(&error))- }-}--#[async_trait]-impl MemoryRecall for ModuleMemoryProvider {- async fn recall(- &self,- query: &str,- limit: usize,- opts: &OwnedRecallOpts,- scope: Option<&SourceScope>,- ) -> Result<Vec<MemoryEntry>, MemoryError> {- // `scope` crosses as a value because the driver must apply it as a query- // predicate internally; narrowing the result here instead would let the- // module spend its `limit` on entries the caller may not see.- self.proxy("recall")- .await?- .call(methods::RECALL, (query, limit, opts, scope.cloned()))- .await- .map_err(|error| from_bus(&error))- }-}--#[async_trait]-impl MemoryPortability for ModuleMemoryProvider {- async fn export_page(- &self,- cursor: Option<&str>,- limit: usize,- ) -> Result<ExportPage, MemoryError> {- self.proxy("export_page")- .await?- .call(methods::EXPORT_PAGE, (cursor.map(str::to_string), limit))- .await- .map_err(|error| from_bus(&error))- }-- async fn import_records(- &self,- records: Vec<ExportRecord>,- ) -> Result<ImportOutcome, MemoryError> {- self.proxy("import_records")- .await?- .call(methods::IMPORT_RECORDS, (records,))- .await- .map_err(|error| from_bus(&error))- }-}macro_rules! module_call {($self:expr, $operation:literal, $method:expr, $args:expr) => {@@ -828,15 +708,3 @@ macro_rules! module_call_slow {};}-#[async_trait]-impl MemoryIngest for ModuleMemoryProvider {- async fn ingest_document(&self, item: IngestItem) -> Result<IngestOutcome, MemoryError> {- module_call!(self, "ingest_document", methods::INGEST_DOCUMENT, (item,))- }- async fn ingest_chat(&self, messages: Vec<IngestItem>) -> Result<IngestOutcome, MemoryError> {- module_call_slow!(self, "ingest_chat", methods::INGEST_CHAT, (messages,))- }- async fn ingest_email(&self, messages: Vec<IngestItem>) -> Result<IngestOutcome, MemoryError> {- module_call_slow!(self, "ingest_email", methods::INGEST_EMAIL, (messages,))- }-}diff --git a/src/openhuman/modules/memory_part_04.rs b/src/openhuman/modules/memory_part_04.rsnew file mode 100644index 0000000000..6320947388--- /dev/null+++ b/src/openhuman/modules/memory_part_04.rs@@ -0,0 +1,132 @@+#[async_trait]+impl MemoryCore for ModuleMemoryProvider {+ async fn store(+ &self,+ namespace: &str,+ key: &str,+ content: &str,+ category: MemoryCategory,+ session_id: Option<&str>,+ taint: MemoryTaint,+ ) -> Result<(), MemoryError> {+ // No log line carries `namespace`, `key` or `content`: all three are user+ // memory content.+ self.proxy("store")+ .await?+ .call::<()>(+ methods::STORE,+ (+ namespace,+ key,+ content,+ category,+ session_id.map(str::to_string),+ taint,+ ),+ )+ .await+ .map_err(|error| from_bus(&error))+ }++ async fn get(&self, namespace: &str, key: &str) -> Result<Option<MemoryEntry>, MemoryError> {+ self.proxy("get")+ .await?+ .call(methods::GET, (namespace, key))+ .await+ .map_err(|error| from_bus(&error))+ }++ async fn forget(&self, namespace: &str, key: &str) -> Result<bool, MemoryError> {+ self.proxy("forget")+ .await?+ .call(methods::FORGET, (namespace, key))+ .await+ .map_err(|error| from_bus(&error))+ }++ async fn list(+ &self,+ namespace: Option<&str>,+ category: Option<&MemoryCategory>,+ session_id: Option<&str>,+ ) -> Result<Vec<MemoryEntry>, MemoryError> {+ self.proxy("list")+ .await?+ .call(+ methods::LIST,+ (+ namespace.map(str::to_string),+ category.cloned(),+ session_id.map(str::to_string),+ ),+ )+ .await+ .map_err(|error| from_bus(&error))+ }++ async fn namespaces(&self) -> Result<Vec<NamespaceSummary>, MemoryError> {+ self.proxy("namespaces")+ .await?+ .call(methods::NAMESPACES, ())+ .await+ .map_err(|error| from_bus(&error))+ }+}++#[async_trait]+impl MemoryRecall for ModuleMemoryProvider {+ async fn recall(+ &self,+ query: &str,+ limit: usize,+ opts: &OwnedRecallOpts,+ scope: Option<&SourceScope>,+ ) -> Result<Vec<MemoryEntry>, MemoryError> {+ // `scope` crosses as a value because the driver must apply it as a query+ // predicate internally; narrowing the result here instead would let the+ // module spend its `limit` on entries the caller may not see.+ self.proxy("recall")+ .await?+ .call(methods::RECALL, (query, limit, opts, scope.cloned()))+ .await+ .map_err(|error| from_bus(&error))+ }+}++#[async_trait]+impl MemoryPortability for ModuleMemoryProvider {+ async fn export_page(+ &self,+ cursor: Option<&str>,+ limit: usize,+ ) -> Result<ExportPage, MemoryError> {+ self.proxy("export_page")+ .await?+ .call(methods::EXPORT_PAGE, (cursor.map(str::to_string), limit))+ .await+ .map_err(|error| from_bus(&error))+ }++ async fn import_records(+ &self,+ records: Vec<ExportRecord>,+ ) -> Result<ImportOutcome, MemoryError> {+ self.proxy("import_records")+ .await?+ .call(methods::IMPORT_RECORDS, (records,))+ .await+ .map_err(|error| from_bus(&error))+ }+}+#[async_trait]+impl MemoryIngest for ModuleMemoryProvider {+ async fn ingest_document(&self, item: IngestItem) -> Result<IngestOutcome, MemoryError> {+ module_call!(self, "ingest_document", methods::INGEST_DOCUMENT, (item,))+ }+ async fn ingest_chat(&self, messages: Vec<IngestItem>) -> Result<IngestOutcome, MemoryError> {+ module_call_slow!(self, "ingest_chat", methods::INGEST_CHAT, (messages,))+ }+ async fn ingest_email(&self, messages: Vec<IngestItem>) -> Result<IngestOutcome, MemoryError> {+ module_call_slow!(self, "ingest_email", methods::INGEST_EMAIL, (messages,))+ }+}diff --git a/src/openhuman/modules/memory_tests.rs b/src/openhuman/modules/memory_tests.rsindex 5fbf4363a1..e3d3ddc8cc 100644--- a/src/openhuman/modules/memory_tests.rs+++ b/src/openhuman/modules/memory_tests.rs@@ -636,132 +636,5 @@ async fn the_defaulted_members_dispatch_to_the_module_instead_of_refusing() {);}-/// The runtime-tree and flavour doors, driven against a **real** module.-///-/// The test above proves the `module_call!` arms exist by discriminating-/// `Other` from `Unsupported` against a disabled host; it cannot prove the wire-/// names are right, because a mistyped one fails the same way a disabled host-/// does. This one can: it loads an actual artifact and asserts the answers.-///-/// # What it deliberately does not drive-///-/// `runtime_summarize` and `runtime_rebuild` resolve a chat model on the-/// driver's side and then spend on it. A test that called them would either-/// reach the network or assert against a provider-resolution failure, and-/// neither says anything about the door. The five below are store-shaped and-/// answer from a fresh workspace with no ambiguity: a buffered write reports-/// where it landed, an empty tree has no root and no children, its status is-/// all zeroes, and nothing has been distilled for a persona scope.-///-/// Run it against a locally built module, one test per process:-///-/// ```text-/// TINYMEMORY_TEST_MODULE=/path/to/libtinymemory_module.dylib \-/// cargo test --lib -- --ignored --exact --test-threads=1 \-/// openhuman::modules::memory::tests::the_runtime_tree_doors_round_trip_through_a_real_module-/// ```-#[tokio::test]-#[ignore = "needs a built tinymemory module (TINYMEMORY_TEST_MODULE) and its own process: \-the bus belongs to whichever runtime creates it, so a second module-loading test in the same \-process finds a broker whose tasks are already gone and hangs rather than failing"]-async fn the_runtime_tree_doors_round_trip_through_a_real_module() {- let module = std::env::var_os("TINYMEMORY_TEST_MODULE")- .expect("set TINYMEMORY_TEST_MODULE to a built libtinymemory_module cdylib");- let workspace = tempfile::TempDir::new().expect("tempdir");-- let mut config = Config::default();- config.workspace_dir = workspace.path().to_path_buf();- config.modules.enabled = true;- config.modules.install_dir = Some(- workspace- .path()- .join("modules")- .to_string_lossy()- .into_owned(),- );- config- .modules- .overrides- .push(crate::openhuman::config::schema::ModuleOverride {- id: MODULE_ID.to_string(),- path: module.to_string_lossy().into_owned(),- });-- let provider = ModuleMemoryProvider::new(Arc::new(config));- let tree = provider.as_tree().expect("the Tree family");- let at = chrono::Utc::now();-- let path = tree- .runtime_buffer_write("team", "standup notes", at, None)- .await- .expect("RuntimeBufferWrite must reach the module");- assert!(- !path.trim().is_empty(),- "the buffered write reports where it landed"- );-- assert!(- tree.runtime_read_node("team", "root")- .await- .expect("RuntimeReadNode must reach the module")- .is_none(),- "a buffered write creates no nodes; absence is data, not an error"- );- assert!(- tree.runtime_read_children("team", "root")- .await- .expect("RuntimeReadChildren must reach the module")- .is_empty(),- "a parent that does not exist has no children"- );-- let status = tree- .runtime_tree_status("team")- .await- .expect("RuntimeTreeStatus must reach the module");- assert_eq!(status.namespace, "team");- assert_eq!(status.total_nodes, 0);- assert_eq!(status.depth, 0);-- assert!(- tree.flavour_profile("persona/communication")- .await- .expect("FlavourProfile must reach the module")- .is_none(),- "nothing has been distilled for this scope yet"- );-- // The two refusals the doors make before touching the store, so a wrong- // wire name cannot pass this test by answering plausibly to everything.- let rejected = tree- .runtime_buffer_write("../escape", "x", at, None)- .await- .expect_err("a traversal namespace is refused");- assert!(- matches!(rejected, MemoryError::Invalid(_)),- "a rejected namespace is a caller mistake, not a backend failure: {rejected:?}"- );- let blank = tree- .runtime_buffer_write("team", " ", at, None)- .await- .expect_err("blank content is refused");- assert!(- matches!(blank, MemoryError::Invalid(_)),- "blank content is a caller mistake: {blank:?}"- );-}--#[test]-fn scoring_is_advertised_and_has_a_host_accessor() {- // tinymemory v1.13.2 (tinymemory#110) added the family; advertising it and- // forwarding it must land together, or the driver claims a family whose- // accessor answers `None` — the #5598 over-claim in miniature.- let mut config = Config::default();- config.modules.enabled = false;- let provider = ModuleMemoryProvider::new(Arc::new(config));- assert!(super::capabilities_for(false).contains(Capability::Scoring));- assert!(- provider.as_scoring().is_some(),- "Scoring is advertised, so the accessor must be wired"- );-}+#[path = "memory_tests_part_01_tests.rs"]+mod part_01_tests;diff --git a/src/openhuman/modules/memory_tests_part_01_tests.rs b/src/openhuman/modules/memory_tests_part_01_tests.rsnew file mode 100644index 0000000000..f3273ce32c--- /dev/null+++ b/src/openhuman/modules/memory_tests_part_01_tests.rs@@ -0,0 +1,133 @@+//! Split off memory_tests.rs to stay under the repo's line-count gate.+//! Same module, same imports — see memory_tests.rs for what this covers.+use super::*;++/// The runtime-tree and flavour doors, driven against a **real** module.+///+/// The test above proves the `module_call!` arms exist by discriminating+/// `Other` from `Unsupported` against a disabled host; it cannot prove the wire+/// names are right, because a mistyped one fails the same way a disabled host+/// does. This one can: it loads an actual artifact and asserts the answers.+///+/// # What it deliberately does not drive+///+/// `runtime_summarize` and `runtime_rebuild` resolve a chat model on the+/// driver's side and then spend on it. A test that called them would either+/// reach the network or assert against a provider-resolution failure, and+/// neither says anything about the door. The five below are store-shaped and+/// answer from a fresh workspace with no ambiguity: a buffered write reports+/// where it landed, an empty tree has no root and no children, its status is+/// all zeroes, and nothing has been distilled for a persona scope.+///+/// Run it against a locally built module, one test per process:+///+/// ```text+/// TINYMEMORY_TEST_MODULE=/path/to/libtinymemory_module.dylib \+/// cargo test --lib -- --ignored --exact --test-threads=1 \+/// openhuman::modules::memory::tests::the_runtime_tree_doors_round_trip_through_a_real_module+/// ```+#[tokio::test]+#[ignore = "needs a built tinymemory module (TINYMEMORY_TEST_MODULE) and its own process: \+the bus belongs to whichever runtime creates it, so a second module-loading test in the same \+process finds a broker whose tasks are already gone and hangs rather than failing"]+async fn the_runtime_tree_doors_round_trip_through_a_real_module() {+ let module = std::env::var_os("TINYMEMORY_TEST_MODULE")+ .expect("set TINYMEMORY_TEST_MODULE to a built libtinymemory_module cdylib");+ let workspace = tempfile::TempDir::new().expect("tempdir");++ let mut config = Config::default();+ config.workspace_dir = workspace.path().to_path_buf();+ config.modules.enabled = true;+ config.modules.install_dir = Some(+ workspace+ .path()+ .join("modules")+ .to_string_lossy()+ .into_owned(),+ );+ config+ .modules+ .overrides+ .push(crate::openhuman::config::schema::ModuleOverride {+ id: MODULE_ID.to_string(),+ path: module.to_string_lossy().into_owned(),+ });++ let provider = ModuleMemoryProvider::new(Arc::new(config));+ let tree = provider.as_tree().expect("the Tree family");+ let at = chrono::Utc::now();++ let path = tree+ .runtime_buffer_write("team", "standup notes", at, None)+ .await+ .expect("RuntimeBufferWrite must reach the module");+ assert!(+ !path.trim().is_empty(),+ "the buffered write reports where it landed"+ );++ assert!(+ tree.runtime_read_node("team", "root")+ .await+ .expect("RuntimeReadNode must reach the module")+ .is_none(),+ "a buffered write creates no nodes; absence is data, not an error"+ );+ assert!(+ tree.runtime_read_children("team", "root")+ .await+ .expect("RuntimeReadChildren must reach the module")+ .is_empty(),+ "a parent that does not exist has no children"+ );++ let status = tree+ .runtime_tree_status("team")+ .await+ .expect("RuntimeTreeStatus must reach the module");+ assert_eq!(status.namespace, "team");+ assert_eq!(status.total_nodes, 0);+ assert_eq!(status.depth, 0);++ assert!(+ tree.flavour_profile("persona/communication")+ .await+ .expect("FlavourProfile must reach the module")+ .is_none(),+ "nothing has been distilled for this scope yet"+ );++ // The two refusals the doors make before touching the store, so a wrong+ // wire name cannot pass this test by answering plausibly to everything.+ let rejected = tree+ .runtime_buffer_write("../escape", "x", at, None)+ .await+ .expect_err("a traversal namespace is refused");+ assert!(+ matches!(rejected, MemoryError::Invalid(_)),+ "a rejected namespace is a caller mistake, not a backend failure: {rejected:?}"+ );+ let blank = tree+ .runtime_buffer_write("team", " ", at, None)+ .await+ .expect_err("blank content is refused");+ assert!(+ matches!(blank, MemoryError::Invalid(_)),+ "blank content is a caller mistake: {blank:?}"+ );+}++#[test]+fn scoring_is_advertised_and_has_a_host_accessor() {+ // tinymemory v1.13.2 (tinymemory#110) added the family; advertising it and+ // forwarding it must land together, or the driver claims a family whose+ // accessor answers `None` — the #5598 over-claim in miniature.+ let mut config = Config::default();+ config.modules.enabled = false;+ let provider = ModuleMemoryProvider::new(Arc::new(config));+ assert!(super::super::capabilities_for(false).contains(Capability::Scoring));+ assert!(+ provider.as_scoring().is_some(),+ "Scoring is advertised, so the accessor must be wired"+ );+}