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
refactor(memory): simplify memory scope API by removing config parameter
Steven Enamakeld3cf9044a687
diff --git a/crates/openhuman-core/src/agent/bus.rs b/crates/openhuman-core/src/agent/bus.rsindex f9958841bd..ed4c46bbff 100644--- a/crates/openhuman-core/src/agent/bus.rs+++ b/crates/openhuman-core/src/agent/bus.rs@@ -288,19 +288,12 @@ async fn handle_agent_run_turn(req: AgentTurnRequest) -> Result<AgentTurnResponschannel_name,target_agent_id.as_deref().unwrap_or("root"));- // Memory acts as the target agent (the root's main agent when none is- // named) for the whole channel turn.- let memory_config = crate::config::rpc::load_config_with_timeout()- .await- .unwrap_or_default();- let memory_agent = target_agent_id- .clone()- .or_else(|| memory_config.memory.root_agents.first().cloned())- .unwrap_or_default();+ // Memory acts as the target agent (the root when none is named) for+ // the whole channel turn.+ let memory_agent = target_agent_id.clone().unwrap_or_default();let outcome = turn_origin::with_origin(origin,crate::memory::scope::within_agent(- &memory_config,&memory_agent,with_file_state_agent_id(file_state_id,diff --git a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rsindex 47e0a7300f..141049422b 100644--- a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs+++ b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs@@ -222,7 +222,7 @@ async fn run_member_loop(// The member acts on memory as itself within the team: its node is// `team:<team>/agent:<agent>`, so members share the team's node and// never read each other's.- let identity = crate::memory::scope::MemoryIdentity::team_member(config, team_id, agent_id);+ let identity = crate::memory::scope::MemoryIdentity::team_member(team_id, agent_id);let member_turn = with_root_parent(config, "agent_team_runtime", "team", "teamrun", async {drive_member(config,diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 6334117e14..a6fb8ee10e 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -970,10 +970,7 @@ impl OpenHumanSessionHost {}}}- let (agent_id, config) = (- self.agent_definition_id.clone(),- self.runtime_config.clone(),- );+ let agent_id = self.agent_definition_id.clone();let turn = self.runtime_session.as_mut()@@ -983,7 +980,7 @@ impl OpenHumanSessionHost {options,);let outcome =- crate::memory::scope::within_agent_in(config.as_deref(), &agent_id, Box::pin(turn))+ crate::memory::scope::within_agent(&agent_id, Box::pin(turn)).await.map_err(|error| anyhow::anyhow!(error.to_string()))?;Ok(outcome.output.unwrap_or_default())diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex fb1f362cbc..90fff55486 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -362,7 +362,7 @@ pub(crate) async fn run_subagent_direct();}let run_result = Box::pin(with_spawn_depth(attempted_depth, async {- crate::memory::scope::within_agent_in(loaded_config.as_deref().ok(), &definition.id, with_file_state_agent_id(task_id.clone(), async {+ crate::memory::scope::within_agent(&definition.id, with_file_state_agent_id(task_id.clone(), async {with_current_sandbox_mode(definition.sandbox_mode, async {Box::pin(run_typed_mode(definition,diff --git a/crates/openhuman-core/src/memory/context.rs b/crates/openhuman-core/src/memory/context.rsindex d8b62cdba7..fadde433c7 100644--- a/crates/openhuman-core/src/memory/context.rs+++ b/crates/openhuman-core/src/memory/context.rs@@ -318,7 +318,8 @@ pub fn injection_block(config: &Config) -> Option<String> {tracing::debug!("[memory:context] memory off; no context injected");return None;}- let own = &identity.namespace;+ let own = &identity.namespace(config);+ let inherit = identity.inherit(config);if !own.is_root() && !context_path_for(&config.workspace_dir, own).is_file() {compile_in_background(config, own);}@@ -328,7 +329,7 @@ pub fn injection_block(config: &Config) -> Option<String> {break String::new();};let markdown = read_markdown(&config.workspace_dir, ¤t);- if !markdown.trim().is_empty() || !identity.inherit {+ if !markdown.trim().is_empty() || !inherit {break markdown;}node = current.parent();