Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed src/openhuman/tools/toolpacks/mod.rs,src/openhuman/tools/toolpacks/ops.rs

Steven Enamakeld0a0eb5e7c8c
diff --git a/src/openhuman/tools/toolpacks/mod.rs b/src/openhuman/tools/toolpacks/mod.rs
index 6d30f46934..6a1795db89 100644
--- a/src/openhuman/tools/toolpacks/mod.rs
+++ b/src/openhuman/tools/toolpacks/mod.rs
@@ -7,10 +7,11 @@
//! idle in most conversations.
//!
//! A pack keeps its tools constructed and executable but unadvertised. The
-//! agent sees two small tools instead: [`tools::LoadSkillTool`] renders a
-//! pack's schemas into the conversation on demand, and [`tools::UseSkillTool`]
-//! executes one of them, forwarding permission level and execution context to
-//! the real tool so nothing is laundered through the proxy.
+//! agent sees one small tool instead: [`tools::UseSkillTool`] renders a pack's
+//! schemas into the conversation when called with a `skill` alone, and executes
+//! one of them when also given a `tool`, forwarding permission level and
+//! execution context to the real tool so nothing is laundered through the
+//! proxy.
//!
//! **Why a proxy and not dynamic registration.** Registering the real schemas
//! mid-turn would be better — the model would get native tool calling with
diff --git a/src/openhuman/tools/toolpacks/ops.rs b/src/openhuman/tools/toolpacks/ops.rs
index 4c323e562e..7afb169823 100644
--- a/src/openhuman/tools/toolpacks/ops.rs
+++ b/src/openhuman/tools/toolpacks/ops.rs
@@ -4,31 +4,28 @@ use std::collections::HashSet;
use std::sync::{Arc, Weak};
use super::registry;
-use super::tools::{LoadSkillTool, PackRegistryHandle, UseSkillTool, LOAD_SKILL, USE_SKILL};
+use super::tools::{PackRegistryHandle, UseSkillTool, LOAD_SKILL, USE_SKILL};
use crate::openhuman::tools::traits::Tool;
-/// Append `load_skill` + `use_skill` to a freshly built registry.
+/// Append `use_skill` to a freshly built registry.
///
-/// They start unbound; [`bind_pack_registry`] gives them their view of the
-/// registry once it is behind an `Arc`.
+/// It starts unbound; [`bind_pack_registry`] gives it its view of the registry
+/// once that is behind an `Arc`.
pub fn append_pack_tools(tools: &mut Vec<Box<dyn Tool>>) {
- let handle = PackRegistryHandle::default();
- tools.push(Box::new(LoadSkillTool::new(handle.clone())));
- tools.push(Box::new(UseSkillTool::new(handle)));
+ tools.push(Box::new(UseSkillTool::new(PackRegistryHandle::default())));
}
-/// Point the pack tools at the registry they live in.
+/// Point the pack tool at the registry it lives in.
///
-/// The handle holds a [`Weak`], so the pack tools referencing the very vector
-/// that owns them does not leak. Call this after **every** rebinding of the
+/// The handle holds a [`Weak`], so the pack tool referencing the very vector
+/// that owns it does not leak. Call this after **every** rebinding of the
/// agent's tool `Arc`; a stale handle degrades to "skill unavailable" rather
/// than dispatching to the wrong registry.
pub fn bind_pack_registry(tools: &Arc<Vec<Box<dyn Tool>>>) {
let weak: Weak<Vec<Box<dyn Tool>>> = Arc::downgrade(tools);
let mut bound = 0usize;
for tool in tools.iter() {
- let name = tool.name();
- if name != LOAD_SKILL && name != USE_SKILL {
+ if tool.name() != USE_SKILL {
continue;
}
if let Some(handle) = crate::openhuman::tools::traits::pack_registry_handle(tool.as_ref()) {
@@ -36,7 +33,7 @@ pub fn bind_pack_registry(tools: &Arc<Vec<Box<dyn Tool>>>) {
bound += 1;
}
}
- tracing::debug!(bound, "[toolpacks] bound pack tools to live registry");
+ tracing::debug!(bound, "[toolpacks] bound pack tool to live registry");
}
/// Remove packed tool names from an agent's advertised set.
@@ -55,6 +52,12 @@ pub fn bind_pack_registry(tools: &Arc<Vec<Box<dyn Tool>>>) {
/// A caller with an *empty* `visible` set means "everything is visible"
/// (the harness's historical sentinel), so there is nothing to subtract from
/// and the set is left alone.
+///
+/// [`LOAD_SKILL`] is inserted alongside [`USE_SKILL`] even though it is no
+/// longer a registered tool: the visible set is also what the tool-policy
+/// boundary is rendered from, and a model that emits the retired name reaches
+/// `use_skill` through `normalize_tool_call` only if the policy layer did not
+/// refuse it by name first.
pub fn strip_packed_from_visible(visible: &mut HashSet<String>, agent_id: &str) {
if visible.is_empty() {
return;
@@ -81,6 +84,6 @@ pub fn strip_packed_from_visible(visible: &mut HashSet<String>, agent_id: &str)
tracing::info!(
agent = %agent_id,
hidden = packed.len(),
- "[toolpacks] withheld packed tool schemas; load_skill/use_skill advertised instead"
+ "[toolpacks] withheld packed tool schemas; use_skill advertised instead"
);
}