Skip to content

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

refactor(tools): re-export tool traits from tinytools directly

Steven Enamakel48316dff38d9
diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rs
index 25d02c4d8d..57db15f8f4 100644
--- a/crates/openhuman-core/src/tools/mod.rs
+++ b/crates/openhuman-core/src/tools/mod.rs
@@ -21,10 +21,4 @@ pub use schemas::{
all_controller_schemas as all_tools_controller_schemas,
all_registered_controllers as all_tools_registered_controllers,
};
-// `Tool` itself rides here too, so an embedder implementing a tool reaches the *vendored* tinytools rather than adding a second path to it.
-// A second path is not merely duplicate -- it produces incompatible Rust types,
-// and a tool built against it cannot be handed to a session at all.
-pub use tinytools::{
- PermissionLevel, Tool, ToolCategory, ToolExposure, ToolResult, ToolScope, ToolSpec,
-};
pub(crate) use user_filter::filter_tools_by_user_preference;
diff --git a/crates/openhuman-core/src/tools/orchestrator_tools.rs b/crates/openhuman-core/src/tools/orchestrator_tools.rs
index 269a887c37..aaf686d616 100644
--- a/crates/openhuman-core/src/tools/orchestrator_tools.rs
+++ b/crates/openhuman-core/src/tools/orchestrator_tools.rs
@@ -38,10 +38,10 @@ use crate::integrations::composio::ComposioActionTool;
// SpawnWorkerThreadTool import kept commented while the worker-thread spawn is
// temporarily disabled (see tinyhumansai/openhuman#1624).
-use super::ArchetypeDelegationTool;
-#[allow(unused_imports)]
-use super::SpawnWorkerThreadTool;
+use crate::agent::orchestration::tools::ArchetypeDelegationTool;
use crate::agent::orchestration::tools::DelegationTarget;
+#[allow(unused_imports)]
+use crate::agent::orchestration::tools::SpawnWorkerThreadTool;
use tinytools::Tool;
/// Synthesise the delegation tool list for an agent based on its
diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rs
index 150226287b..26f28a187e 100644
--- a/crates/openhuman-embed/src/lib.rs
+++ b/crates/openhuman-embed/src/lib.rs
@@ -79,12 +79,12 @@ pub use openhuman_core::tools::toolpacks::{GroupMode, ToolGroups};
// would build tools of a different, incompatible type.
pub use openhuman_core::agent::tinyagents::host::LastTurnUsage;
pub use openhuman_core::agent::{HostTools, HostTurnTools, TurnContext};
-pub use openhuman_core::tools::{PermissionLevel, Tool, ToolExposure, ToolResult};
pub use openhuman_core::{
CoreBuilder, CoreRuntime, DaemonConfig, DomainSet, HostKind, ServiceSet, TokenSource,
};
/// Declarative execution requirements for host-owned tools, from the core's vendored contract.
pub use tinytools::ToolPolicy;
+pub use tinytools::{PermissionLevel, Tool, ToolExposure, ToolResult};
/// Live agent-turn progress for in-process embedders.
pub mod agent_progress {
diff --git a/crates/openhuman-embed/tests/approval_lifecycle.rs b/crates/openhuman-embed/tests/approval_lifecycle.rs
index 1a164325fd..e6620d0fb7 100644
--- a/crates/openhuman-embed/tests/approval_lifecycle.rs
+++ b/crates/openhuman-embed/tests/approval_lifecycle.rs
@@ -309,7 +309,7 @@ impl Tool for RemovalTool {
async fn execute(
&self,
_: serde_json::Value,
- ) -> anyhow::Result<openhuman_core::tools::ToolResult> {
+ ) -> anyhow::Result<tinytools::ToolResult> {
let _guard = BlockingDecisionDrop {
barrier: self.barrier.clone(),
dropping: self.dropping.clone(),
diff --git a/crates/openhuman-embed/tests/attached_tools.rs b/crates/openhuman-embed/tests/attached_tools.rs
index 566da3ee25..30e87e83b0 100644
--- a/crates/openhuman-embed/tests/attached_tools.rs
+++ b/crates/openhuman-embed/tests/attached_tools.rs
@@ -29,8 +29,8 @@ impl Tool for Marker {
async fn execute(
&self,
_: serde_json::Value,
- ) -> anyhow::Result<openhuman_core::tools::ToolResult> {
- Ok(openhuman_core::tools::ToolResult::success("accepted"))
+ ) -> anyhow::Result<tinytools::ToolResult> {
+ Ok(tinytools::ToolResult::success("accepted"))
}
}
#[test]
diff --git a/crates/openhuman-embed/tests/channel_agents.rs b/crates/openhuman-embed/tests/channel_agents.rs
index f14db0bd41..e729e61718 100644
--- a/crates/openhuman-embed/tests/channel_agents.rs
+++ b/crates/openhuman-embed/tests/channel_agents.rs
@@ -12,7 +12,7 @@ use std::sync::{Arc, Mutex};
use std::time::Duration;
use common::{chat_completion, chat_requests, offline_config, runtime, stub_backend};
-use openhuman_core::tools::{PermissionLevel, ToolResult};
+use tinytools::{PermissionLevel, ToolResult};
use openhuman_embed::{
AgentDefinitionSpec, AgentSpec, AgentTurnOrigin, ChannelError, HostTurnTools, Provider,
Runtime, TelegramChannelSpec, Tool, ToolScopeSpec, Workspace,
diff --git a/crates/openhuman-embed/tests/cron_agents.rs b/crates/openhuman-embed/tests/cron_agents.rs
index 358614ec33..39c30f4225 100644
--- a/crates/openhuman-embed/tests/cron_agents.rs
+++ b/crates/openhuman-embed/tests/cron_agents.rs
@@ -44,12 +44,12 @@ impl Tool for Ping {
async fn execute(
&self,
_args: serde_json::Value,
- ) -> anyhow::Result<openhuman_core::tools::ToolResult> {
+ ) -> anyhow::Result<tinytools::ToolResult> {
self.seen
.lock()
.unwrap()
.push(openhuman_core::agent::turn_origin::current());
- Ok(openhuman_core::tools::ToolResult::success("pinged"))
+ Ok(tinytools::ToolResult::success("pinged"))
}
}
diff --git a/crates/openhuman-embed/tests/inline_permissions.rs b/crates/openhuman-embed/tests/inline_permissions.rs
index 733bb127e3..3c1c549eaf 100644
--- a/crates/openhuman-embed/tests/inline_permissions.rs
+++ b/crates/openhuman-embed/tests/inline_permissions.rs
@@ -28,9 +28,9 @@ impl Tool for Probe {
fn parameters_schema(&self) -> Value {
json!({"type":"object","properties":{}})
}
- async fn execute(&self, _: Value) -> anyhow::Result<openhuman_core::tools::ToolResult> {
+ async fn execute(&self, _: Value) -> anyhow::Result<tinytools::ToolResult> {
self.0.fetch_add(1, Ordering::SeqCst);
- Ok(openhuman_core::tools::ToolResult::success("ran"))
+ Ok(tinytools::ToolResult::success("ran"))
}
}
#[test]
diff --git a/crates/openhuman-embed/tests/isolation_mcp.rs b/crates/openhuman-embed/tests/isolation_mcp.rs
index ec4331e1e9..06ad4a12ff 100644
--- a/crates/openhuman-embed/tests/isolation_mcp.rs
+++ b/crates/openhuman-embed/tests/isolation_mcp.rs
@@ -12,7 +12,7 @@ use std::sync::Arc;
use common::{chat_requests, offline_config, route, runtime, scripted_provider, stub_backend};
use openhuman_core::core::runtime::{AgentContextRegistry, CoreContext};
use openhuman_core::mcp::registry::types::{CommandKind, InstalledServer, Transport};
-use openhuman_core::tools::Tool;
+use tinytools::Tool;
use openhuman_embed::{Access, AgentSpec, Runtime, Workspace};
use serde_json::{json, Value};
diff --git a/crates/openhuman-embed/tests/scoped_hooks.rs b/crates/openhuman-embed/tests/scoped_hooks.rs
index 3a7ae3ae96..3af4900a86 100644
--- a/crates/openhuman-embed/tests/scoped_hooks.rs
+++ b/crates/openhuman-embed/tests/scoped_hooks.rs
@@ -89,8 +89,8 @@ impl Tool for Probe {
fn parameters_schema(&self) -> Value {
json!({"type":"object","properties":{"owner":{"type":"string"}},"required":["owner"]})
}
- async fn execute(&self, _: Value) -> anyhow::Result<openhuman_core::tools::ToolResult> {
- Ok(openhuman_core::tools::ToolResult::success("observed"))
+ async fn execute(&self, _: Value) -> anyhow::Result<tinytools::ToolResult> {
+ Ok(tinytools::ToolResult::success("observed"))
}
}
diff --git a/crates/openhuman-embed/tests/turn_tools.rs b/crates/openhuman-embed/tests/turn_tools.rs
index 021ad8668f..799f9e2032 100644
--- a/crates/openhuman-embed/tests/turn_tools.rs
+++ b/crates/openhuman-embed/tests/turn_tools.rs
@@ -27,9 +27,9 @@ impl Tool for Probe {
fn parameters_schema(&self) -> Value {
json!({"type":"object","properties":{}})
}
- async fn execute(&self, _: Value) -> anyhow::Result<openhuman_core::tools::ToolResult> {
+ async fn execute(&self, _: Value) -> anyhow::Result<tinytools::ToolResult> {
self.0.fetch_add(1, Ordering::SeqCst);
- Ok(openhuman_core::tools::ToolResult::success("ran"))
+ Ok(tinytools::ToolResult::success("ran"))
}
}
#[test]
diff --git a/crates/openhuman-embed/tests/usage_hooks.rs b/crates/openhuman-embed/tests/usage_hooks.rs
index fadcffa411..2d21d2fe22 100644
--- a/crates/openhuman-embed/tests/usage_hooks.rs
+++ b/crates/openhuman-embed/tests/usage_hooks.rs
@@ -52,8 +52,8 @@ impl Tool for Probe {
fn parameters_schema(&self) -> Value {
json!({"type":"object","properties":{}})
}
- async fn execute(&self, _: Value) -> anyhow::Result<openhuman_core::tools::ToolResult> {
- Ok(openhuman_core::tools::ToolResult::success("value"))
+ async fn execute(&self, _: Value) -> anyhow::Result<tinytools::ToolResult> {
+ Ok(tinytools::ToolResult::success("value"))
}
}
fn billed(mut response: Value) -> Value {