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
feat(session-host): include deferred tools in session snapshot and policy
Steven Enamakelfd2c30836c4e
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 1267c9486b..3376568010 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -114,6 +114,13 @@ struct OpenHumanTurnToolSurface {durable_tool_specs: Arc<Vec<Arc<tinytools::ToolSpec>>>,visible_tool_specs: Arc<Vec<Arc<tinytools::ToolSpec>>>,visible_tool_names: std::collections::HashSet<String>,+ /// Registered but never advertised: the `Deferred` tools the harness's+ /// `tool_search` bridge can reach. Part of the snapshot the driver treats+ /// as the final allowlist, and classified `Allow` by the policy, so a+ /// found tool is callable. See `OpenHumanSessionHost::deferred_tool_names`.+ deferred_tool_names: std::collections::HashSet<String>,+ /// Whether this belt reaches deferred tools at all; fixed at build.+ discovery_enabled: bool,/// Whether newly connected delegates may enter the visible belt without a/// caller explicitly allowing them. A hide/named restriction turns this/// off so refresh cannot reopen withdrawn authority.@@ -183,10 +190,21 @@ impl OpenHumanTurnPrelude {.tool_surface.lock().unwrap_or_else(std::sync::PoisonError::into_inner);+ // The snapshot is the declaration set the session grants — the+ // driver reads it back as the harness allowlist — so it carries+ // the deferred tools beside the advertised ones. The harness+ // still advertises only the `Direct` registrations and reaches+ // the rest through its `tool_search` bridge.ToolSnapshot::new(surface.visible_tool_specs.iter()+ .chain(+ surface+ .tool_specs+ .iter()+ .filter(|spec| surface.deferred_tool_names.contains(&spec.name)),+ ).map(|spec| spec.as_ref().clone()).collect(),)@@ -542,6 +560,20 @@ impl OpenHumanTurnPrelude {&mut surface.visible_tool_names,&agent_definition_name,);+ // Same split as the session host's `recompute_deferred_tool_names`:+ // a `Deferred` synthesised tool leaves the wire and joins the+ // searchable set, on a belt that opted into discovery.+ if surface.discovery_enabled {+ let mut deferred =+ crate::tools::implementations::meta::deferred_tool_names(surface.tools.as_slice());+ deferred.extend(crate::tools::implementations::meta::deferred_tool_names(+ synthesized.as_slice(),+ ));+ surface+ .visible_tool_names+ .retain(|name| !deferred.contains(name));+ surface.deferred_tool_names = deferred;+ }let specs = surface.durable_tool_specs@@ -557,13 +589,27 @@ impl OpenHumanTurnPrelude {.chain(synthesized_tools.iter()).map(|tool| tool.as_ref()).collect::<Vec<_>>();+ // Advertised plus deferred, like the session host: a deferred tool+ // outside the set would be `HideFromPrompt`, which the direct-call+ // gate refuses.+ let reachable: std::collections::HashSet<String> = if surface.visible_tool_names.is_empty()+ {+ std::collections::HashSet::new()+ } else {+ surface+ .visible_tool_names+ .iter()+ .chain(surface.deferred_tool_names.iter())+ .cloned()+ .collect()+ };let mut policy = ToolPolicyEngine::build_session_from_refs(&surface.agent_definition_name,&surface.event_channel,"session",&self.config.channel_permissions,&all_tools,- &surface.visible_tool_names,+ &reachable,);crate::tools::toolpacks::close_handed_off_packs(&mut policy,@@ -1501,6 +1547,8 @@ impl OpenHumanSessionHost {durable_tool_specs: self.durable_tool_specs.clone(),visible_tool_specs: self.visible_tool_specs.clone(),visible_tool_names: self.visible_tool_names.clone(),+ deferred_tool_names: self.deferred_tool_names.clone(),+ discovery_enabled: self.discovery_enabled,auto_include_new_synthesized_tools: true,synthesized_tool_names: self.synthesized_tool_names.clone(),tool_policy_session: self.tool_policy_session.clone(),@@ -1887,6 +1935,8 @@ impl OpenHumanSessionHost {durable_tool_specs: self.durable_tool_specs.clone(),visible_tool_specs: self.visible_tool_specs.clone(),visible_tool_names: self.visible_tool_names.clone(),+ deferred_tool_names: self.deferred_tool_names.clone(),+ discovery_enabled: self.discovery_enabled,auto_include_new_synthesized_tools: auto_include_new_synthesized_tools.unwrap_or(prior_auto_include),synthesized_tool_names: self.synthesized_tool_names.clone(),