Skip to content

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

chore: files changed crates/openhuman-core/src/memory/tools.rs,crates/openhuman-core/src/memory/tool

Steven Enamakeladb5e8158ed0
diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rs
index b6e174ed61..be70856aae 100644
--- a/crates/openhuman-core/src/memory/tools.rs
+++ b/crates/openhuman-core/src/memory/tools.rs
@@ -101,24 +101,6 @@ impl CallFacts {
}
}
- #[cfg(test)]
- fn learn_meta(&self) -> tinymemory_api::MemoryMeta {
- tinymemory_api::MemoryMeta {
- namespace: self.namespace.clone(),
- workspace: self.workspace.clone(),
- thread_id: self.thread_id.clone(),
- agent_id: self.agent_id.clone(),
- tool_call: Some(ToolCallRef {
- name: MEMORY_TOOL_NAME.to_string(),
- id: self.tool_call_id.clone(),
- }),
- source: tinymemory_api::SourceRef {
- kind: tinymemory_api::SourceKind::Agent,
- id: None,
- },
- ..tinymemory_api::MemoryMeta::default()
- }
- }
}
/// OpenHuman's monotonic Tokio clock for TinyMemory's runtime-neutral budget.
@@ -304,22 +286,6 @@ pub fn is_budget_refusal(result: &ToolResult) -> bool {
.is_some_and(|metadata| metadata.get(REFUSAL_METADATA_KEY).is_some())
}
-#[cfg(test)]
-async fn run_action(
- ctx: &DispatchCtx,
- config: &Config,
- args: &Value,
- facts: &CallFacts,
-) -> ToolResult {
- let result = MemoryTool::new(Arc::new(config.clone()))
- .call_with_facts(args.clone(), ctx.clone(), facts.clone(), None)
- .await;
- if is_write_action(args) && !result.is_error {
- super::tool_writes::drain(config).await;
- }
- result
-}
-
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
@@ -341,3 +307,8 @@ mod activity_tests;
#[cfg(test)]
#[path = "tools_read_tests.rs"]
mod read_tests;
+#[cfg(test)]
+#[path = "tools_test_support.rs"]
+mod test_support;
+#[cfg(test)]
+use test_support::run_action;
diff --git a/crates/openhuman-core/src/memory/tools_test_support.rs b/crates/openhuman-core/src/memory/tools_test_support.rs
new file mode 100644
index 0000000000..5a66a99f06
--- /dev/null
+++ b/crates/openhuman-core/src/memory/tools_test_support.rs
@@ -0,0 +1,23 @@
+//! Shared test adapters for the memory tool's native facade.
+
+use super::{CallFacts, MemoryTool, is_write_action};
+use crate::config::Config;
+use crate::core::runtime::DispatchCtx;
+use serde_json::Value;
+use std::sync::Arc;
+use tinytools::ToolResult;
+
+pub(super) async fn run_action(
+ ctx: &DispatchCtx,
+ config: &Config,
+ args: &Value,
+ facts: &CallFacts,
+) -> ToolResult {
+ let result = MemoryTool::new(Arc::new(config.clone()))
+ .call_with_facts(args.clone(), ctx.clone(), facts.clone(), None)
+ .await;
+ if is_write_action(args) && !result.is_error {
+ crate::memory::tool_writes::drain(config).await;
+ }
+ result
+}