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
fix(tools): preserve tool search when filtering deferred tools
Steven Enamakel90592de9ba34
diff --git a/src/openhuman/agent/harness/session/builder/setters.rs b/src/openhuman/agent/harness/session/builder/setters.rsindex 44328a2ab7..c84597a22b 100644--- a/src/openhuman/agent/harness/session/builder/setters.rs+++ b/src/openhuman/agent/harness/session/builder/setters.rs@@ -480,7 +480,10 @@ impl AgentBuilder {//// Neither can widen anything. This runs on a set the belt and the// security policy already produced, and only ever removes from it.- let deferred = strip_deferred_from_visible(&mut visible_names, tools.as_slice());+ let deferred = crate::openhuman::tools::r#impl::meta::strip_deferred_from_visible(+ &mut visible_names,+ tools.as_slice(),+ );if !deferred.is_empty() {tracing::info!(agent = %agent_definition_name,diff --git a/src/openhuman/tools/impl/meta/mod.rs b/src/openhuman/tools/impl/meta/mod.rsindex f218119ad1..2feda3549b 100644--- a/src/openhuman/tools/impl/meta/mod.rs+++ b/src/openhuman/tools/impl/meta/mod.rs@@ -7,4 +7,7 @@pub mod tool_search;-pub use tool_search::{ToolSearchHandle, ToolSearchIndex, ToolSearchTool};+pub use tool_search::{+ strip_deferred_from_visible, ToolSearchHandle, ToolSearchIndex, ToolSearchTool,+ TOOL_SEARCH_NAME,+};diff --git a/src/openhuman/tools/impl/meta/tool_search.rs b/src/openhuman/tools/impl/meta/tool_search.rsindex 038bf6f992..ad0c9cdc23 100644--- a/src/openhuman/tools/impl/meta/tool_search.rs+++ b/src/openhuman/tools/impl/meta/tool_search.rs@@ -229,7 +229,7 @@ impl ToolSearchTool {#[async_trait::async_trait]impl Tool for ToolSearchTool {fn name(&self) -> &str {- "tool_search"+ TOOL_SEARCH_NAME}fn description(&self) -> &str {@@ -413,3 +413,43 @@ mod tests {assert_eq!(first, second);}}++/// Remove every [`ToolExposure::Deferred`] and [`ToolExposure::Hidden`] tool+/// from an agent's advertised set, returning the specs of the deferred ones so+/// the caller can index them.+///+/// Hidden tools are dropped and **not** returned: they are not searchable+/// either, by definition.+///+/// `tool_search` itself is never removed, whatever it declares. A search tool+/// the model cannot see is the one failure mode this whole mechanism cannot+/// recover from — every deferred capability would be unreachable, silently.+pub fn strip_deferred_from_visible(+ visible: &mut std::collections::HashSet<String>,+ tools: &[Box<dyn Tool>],+) -> Vec<ToolSpec> {+ use crate::openhuman::tools::ToolExposure;++ let mut deferred = Vec::new();+ for tool in tools {+ let name = tool.name();+ if name == TOOL_SEARCH_NAME || !visible.contains(name) {+ continue;+ }+ match tool.exposure() {+ ToolExposure::Direct => {}+ ToolExposure::Deferred => {+ visible.remove(name);+ deferred.push(tool.spec());+ }+ ToolExposure::Hidden => {+ visible.remove(name);+ }+ }+ }+ deferred+}++/// The advertised name of [`ToolSearchTool`], as a constant so the carve-out+/// above and the registration site cannot disagree about it.+pub const TOOL_SEARCH_NAME: &str = "tool_search";