Skip to content

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

refactor(tools): route metadata through host extensions

Steven Enamakel40d4ac570a8e
diff --git a/src/openhuman/agent/harness/session/turn_tests.rs b/src/openhuman/agent/harness/session/turn_tests.rs
index f03f900415..4acaa351f0 100644
--- a/src/openhuman/agent/harness/session/turn_tests.rs
+++ b/src/openhuman/agent/harness/session/turn_tests.rs
@@ -269,7 +269,7 @@ impl Tool for GeneratedContextTool {
Ok(ToolResult::success("generated-output"))
}
- fn generated_runtime_context(
+ fn host_call_extension(
&self,
_args: &serde_json::Value,
) -> Option<GeneratedToolRuntimeContext> {
diff --git a/src/openhuman/agent/tinyagents/middleware.rs b/src/openhuman/agent/tinyagents/middleware.rs
index 8cb0a82c96..c9b23177d5 100644
--- a/src/openhuman/agent/tinyagents/middleware.rs
+++ b/src/openhuman/agent/tinyagents/middleware.rs
@@ -1288,7 +1288,7 @@ impl ToolPolicyMiddleware {
.iter()
.flat_map(|set| set.iter())
.find(|t| t.name() == name)
- .and_then(|t| t.generated_runtime_context(args))
+ .and_then(|t| crate::openhuman::tools::traits::generated_runtime_context(t.as_ref(), args))
}
}
diff --git a/src/openhuman/tools/toolpacks/ops.rs b/src/openhuman/tools/toolpacks/ops.rs
index e8d6221f85..4c323e562e 100644
--- a/src/openhuman/tools/toolpacks/ops.rs
+++ b/src/openhuman/tools/toolpacks/ops.rs
@@ -31,7 +31,7 @@ pub fn bind_pack_registry(tools: &Arc<Vec<Box<dyn Tool>>>) {
if name != LOAD_SKILL && name != USE_SKILL {
continue;
}
- if let Some(handle) = tool.pack_registry_handle() {
+ if let Some(handle) = crate::openhuman::tools::traits::pack_registry_handle(tool.as_ref()) {
handle.bind(weak.clone());
bound += 1;
}
diff --git a/src/openhuman/tools/toolpacks/tools.rs b/src/openhuman/tools/toolpacks/tools.rs
index 6e9757f0d4..5fa989da89 100644
--- a/src/openhuman/tools/toolpacks/tools.rs
+++ b/src/openhuman/tools/toolpacks/tools.rs
@@ -170,7 +170,10 @@ impl Tool for LoadSkillTool {
PermissionLevel::ReadOnly
}
- fn pack_registry_handle(&self) -> Option<&PackRegistryHandle> {
+ /// The registry handle rides on the vocabulary's erased host extension:
+ /// `PackRegistryHandle` is this host's concept, and `tinytools` has no
+ /// business naming it. `traits::pack_registry_handle` reads it back.
+ fn host_extension(&self) -> Option<&(dyn std::any::Any + Send + Sync)> {
Some(&self.handle)
}
}
@@ -323,7 +326,10 @@ impl Tool for UseSkillTool {
}
}
- fn pack_registry_handle(&self) -> Option<&PackRegistryHandle> {
+ /// The registry handle rides on the vocabulary's erased host extension:
+ /// `PackRegistryHandle` is this host's concept, and `tinytools` has no
+ /// business naming it. `traits::pack_registry_handle` reads it back.
+ fn host_extension(&self) -> Option<&(dyn std::any::Any + Send + Sync)> {
Some(&self.handle)
}
}