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/sources/composio_tests.rs,crates/openhuman-cor

Steven Enamakel29d746d4e67a
diff --git a/crates/openhuman-core/src/memory/sources/composio_tests.rs b/crates/openhuman-core/src/memory/sources/composio_tests.rs
index 02bcf10b39..ea1b23f4b8 100644
--- a/crates/openhuman-core/src/memory/sources/composio_tests.rs
+++ b/crates/openhuman-core/src/memory/sources/composio_tests.rs
@@ -2,7 +2,6 @@ use super::*;
use tinymemory_tools::MemoryLayout;
use crate::config::schema::MemorySourceKind;
use crate::memory::test_fixtures::{bind_reference, config_in, stored};
-use tinymemory_api::Namespace;
use tinymemory_api::{ItemKind, MetaFilter};
fn record(id: &str, title: &str, content: &str) -> ConnectorRecord {
diff --git a/crates/openhuman-core/src/memory/tools_tests.rs b/crates/openhuman-core/src/memory/tools_tests.rs
index a7aba14673..0ba3c07ad4 100644
--- a/crates/openhuman-core/src/memory/tools_tests.rs
+++ b/crates/openhuman-core/src/memory/tools_tests.rs
@@ -332,43 +332,36 @@ fn gather_falls_back_to_the_action_dir() {
assert_eq!(gathered.workspace.as_deref(), Some("/the/action/dir"));
assert!(gathered.thread_id.is_none());
assert!(gathered.tool_call_id.is_none());
- let meta = gathered.learn_meta(false);
- assert!(meta.namespace.is_root(), "no agent in scope: the root");
+ let meta = gathered.learn_meta();
+ assert!(meta.namespace.is_root(), "no agent in scope: the default root");
assert_eq!(meta.source.kind, SourceKind::Agent);
assert_eq!(meta.tool_call.unwrap().name, MEMORY_TOOL_NAME);
}
#[tokio::test]
-async fn agents_keep_their_own_memory_and_share_on_request() {
+async fn learnings_are_shared_under_a_root_and_a_team_root_is_kept_apart() {
let tmp = tempfile::tempdir().unwrap();
let config = config_in(&tmp);
let engine = bind_reference(&config);
- let learn = |facts: CallFacts, text: &'static str, share: bool| {
+ let member = || CallFacts {
+ thread_id: Some("thread-team".into()),
+ ..CallFacts::of(&config, &MemoryIdentity::team_member("acme", "writer"))
+ };
+ let learn = |facts: CallFacts, text: &'static str| {
let config = config.clone();
async move {
let result = run_action(
&config,
- &json!({"action": "learn", "text": text, "share": share}),
+ &json!({"action": "learn", "text": text, "share": true}),
&facts,
)
.await;
assert!(!result.is_error, "{}", result.text());
}
};
- learn(facts(), "the main agent knows the deploy day", false).await;
- learn(
- facts_of("researcher"),
- "the researcher prefers arxiv",
- false,
- )
- .await;
- learn(
- facts_of("writer"),
- "the writer drafts in british english",
- false,
- )
- .await;
- learn(facts_of("writer"), "the user is called Sam", true).await;
+ learn(facts(), "the main agent knows the deploy day").await;
+ learn(facts_of("researcher"), "the researcher prefers arxiv").await;
+ learn(member(), "acme drafts in british english").await;
let all = stored(&engine, MetaFilter::kinds([ItemKind::Learning])).await;
let at = |text: &str| {
@@ -377,60 +370,47 @@ async fn agents_keep_their_own_memory_and_share_on_request() {
.map(|hit| (hit.meta.namespace.to_string(), hit.meta.agent_id.clone()))
.unwrap()
};
+ assert_eq!(at("deploy day"), ("root".into(), Some("orchestrator".into())));
+ assert_eq!(at("arxiv"), ("root".into(), Some("researcher".into())));
assert_eq!(
- at("deploy day"),
- ("root".into(), Some("orchestrator".into()))
- );
- assert_eq!(
- at("arxiv"),
- ("agent:researcher".into(), Some("researcher".into()))
- );
- assert_eq!(
- at("Sam"),
- ("root".into(), Some("writer".into())),
- "shared to the root"
+ at("british english"),
+ ("team:acme".into(), Some("writer".into())),
+ "a team member learns into its team's root"
);
- let fetched = run_action(
- &config,
- &json!({"action": "fetch", "query": "the", "limit": 50, "filter": {"reach": null}}),
- &facts_of("researcher"),
- )
- .await;
- let body = fetched.text();
- assert!(body.contains("arxiv"), "{body}");
- assert!(body.contains("deploy day"), "root memory is inherited");
- assert!(body.contains("Sam"), "shared learnings are inherited");
+ let fetch = |facts: CallFacts| {
+ let config = config.clone();
+ async move {
+ run_action(
+ &config,
+ &json!({"action": "fetch", "query": "the", "limit": 50, "filter": {"reach": null}}),
+ &facts,
+ )
+ .await
+ .text()
+ }
+ };
+ let researcher = fetch(facts_of("researcher")).await;
+ assert!(researcher.contains("arxiv") && researcher.contains("deploy day"));
+ let team = fetch(member()).await;
+ assert!(team.contains("british english"), "{team}");
assert!(
- !body.contains("british english"),
- "a sibling's memory is out of reach: {body}"
+ !team.contains("deploy day"),
+ "the default root's memory is out of a team's reach: {team}"
);
- let writers = stored(&engine, MetaFilter::default())
+ let main_item = stored(&engine, MetaFilter::default())
.await
.into_iter()
- .find(|hit| hit.text.contains("british english"))
+ .find(|hit| hit.text.contains("deploy day"))
.unwrap();
let forgot = run_action(
&config,
- &json!({"action": "forget", "ids": [writers.id.0.clone()]}),
- &facts_of("researcher"),
+ &json!({"action": "forget", "ids": [main_item.id.0.clone()]}),
+ &member(),
)
.await;
- assert!(
- forgot.text().contains("\"forgotten\":0"),
- "{}",
- forgot.text()
- );
- assert_eq!(
- stored(&engine, MetaFilter::default())
- .await
- .iter()
- .filter(|hit| hit.text.contains("british english"))
- .count(),
- 1,
- "a sibling's item is not forgotten"
- );
+ assert!(forgot.text().contains("\"forgotten\":0"), "{}", forgot.text());
assert!(stored(&engine, MetaFilter::default())
.await
.iter()