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(runtime): register derived contexts with the agent registry
Steven Enamakel5c18808659f6
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex ddf07b1612..d395688170 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -428,7 +428,7 @@ impl CoreContext {})),}};- Arc::new(CoreContext {+ crate::storage::agents::registered(Arc::new(CoreContext {host_kind: self.host_kind,workspace_binding: RwLock::new(shared_binding),domains,@@ -438,7 +438,7 @@ impl CoreContext {backend_transport: self.backend_transport.clone(),turn_origin: self.turn_origin.clone(),session_agent: overlay.session_agent.or_else(|| self.session_agent.clone()),- })+ }))}/// The agent a host session store scopes work under this context to, if@@ -740,6 +740,8 @@ pub async fn init_stores(cfg: &crate::config::Config, domains: crate::core::runt#[path = "context_turn_origin.rs"]mod turn_origin_scope;+#[path = "context_agent.rs"]+mod agent_scope;#[cfg(test)]#[path = "context_tests.rs"]diff --git a/crates/openhuman-core/src/core/runtime/context_agent.rs b/crates/openhuman-core/src/core/runtime/context_agent.rsnew file mode 100644index 0000000000..90da0a6288--- /dev/null+++ b/crates/openhuman-core/src/core/runtime/context_agent.rs@@ -0,0 +1,30 @@+use super::*;++impl CoreContext {+ /// This context, acting for `agent`: the same configuration, workspace+ /// binding, domains and transport, with the session agent replaced.+ ///+ /// For background work that visits an agent's records when no live+ /// context of that agent is at hand (`crate::storage::agents`): the agent+ /// was registered by an earlier process, or its host dropped it. A live+ /// agent context is always preferred, since it carries the agent's own+ /// configuration.+ pub fn for_agent(self: &Arc<Self>, agent: &str) -> Arc<CoreContext> {+ let binding = self+ .workspace_binding+ .read()+ .map(|handle| Arc::clone(&*handle))+ .unwrap_or_else(|poisoned| Arc::clone(&*poisoned.into_inner()));+ Arc::new(CoreContext {+ host_kind: self.host_kind,+ workspace_binding: RwLock::new(binding),+ domains: self.domains,+ tool_groups: self.tool_groups.clone(),+ embedder_config: self.embedder_config.clone(),+ user_skill_roots: self.user_skill_roots,+ backend_transport: self.backend_transport.clone(),+ turn_origin: self.turn_origin.clone(),+ session_agent: Some(agent.to_string()),+ })+ }+}