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
refactor(caps_host): move native tool backend logic to dedicated module
Steven Enamakel5e717d3feeaa
diff --git a/crates/openhuman-core/src/flows/caps_host/tools/mod.rs b/crates/openhuman-core/src/flows/caps_host/tools/mod.rsindex 4add2c5919..7a7afd0778 100644--- a/crates/openhuman-core/src/flows/caps_host/tools/mod.rs+++ b/crates/openhuman-core/src/flows/caps_host/tools/mod.rs@@ -38,15 +38,7 @@ use crate::security::SecurityPolicy;use super::{EngineError, Result};pub(crate) use composio::ComposioToolBackend;-pub(crate) use native::NativeToolBackend;--/// Prefix marking a `tool_call` node's slug as a NATIVE OpenHuman tool (the-/// "Tool" node) rather than a Composio action (the "App action" node). e.g.-/// `oh:web_search`. Native tools run through the same agent tool registry the-/// assistant uses (`tools::native_ops::execute_tool`), so a flow can call-/// search / media generation / file / shell / etc. — the full toolset.-pub(crate) const NATIVE_TOOL_PREFIX: &str =- crate::tools::native_ops::flow_backend::NATIVE_TOOL_PREFIX;+pub(crate) use native::{NativeToolBackend, NATIVE_TOOL_PREFIX};pub(crate) async fn classify_composio_action_for_tier(slug: &str) -> tinybox_bus::CommandClass {crate::integrations::composio::flow_gate::classify_composio_action_for_tier(slug)diff --git a/crates/openhuman-core/src/flows/caps_host/tools/native.rs b/crates/openhuman-core/src/flows/caps_host/tools/native.rsindex f235abbf8f..0860725255 100644--- a/crates/openhuman-core/src/flows/caps_host/tools/native.rs+++ b/crates/openhuman-core/src/flows/caps_host/tools/native.rs@@ -5,7 +5,12 @@ use async_trait::async_trait;use serde_json::Value;use tinybox_bus::CommandClass;-use super::{ToolBackend, ToolCallCtx, NATIVE_TOOL_PREFIX};+use super::{ToolBackend, ToolCallCtx};++#[path = "native_backend.rs"]+mod flow_backend;++pub(crate) use flow_backend::NATIVE_TOOL_PREFIX;pub(crate) struct NativeToolBackend;@@ -26,7 +31,7 @@ impl ToolBackend for NativeToolBackend {args: Value,_conn: Option<&str>,) -> Result<Value> {- crate::tools::native_ops::flow_backend::invoke(+ flow_backend::invoke(ctx.config,slug,args,@@ -42,7 +47,7 @@ struct NativeFlowPolicyHooks<'a, 'ctx> {}#[async_trait]-impl crate::tools::native_ops::flow_backend::FlowPolicyHooks for NativeFlowPolicyHooks<'_, '_> {+impl flow_backend::FlowPolicyHooks for NativeFlowPolicyHooks<'_, '_> {async fn resolve_policy(&self,config: &crate::config::Config,diff --git a/crates/openhuman-core/src/flows/caps_host/tools/native_backend.rs b/crates/openhuman-core/src/flows/caps_host/tools/native_backend.rsindex d17cd549fc..68ac0f7f52 100644--- a/crates/openhuman-core/src/flows/caps_host/tools/native_backend.rs+++ b/crates/openhuman-core/src/flows/caps_host/tools/native_backend.rs@@ -1,6 +1,7 @@//! Adapts native tool results to the value and failure contract expected by-//! TinyFlows. Tool execution itself remains in [`super`], which owns the-//! native registry and its policy snapshot.+//! TinyFlows. Tool execution remains in `tools::native_ops`, which owns the+//! native registry and its policy snapshot; this flow adapter stays with the+//! CapsHost capability that calls it.use std::sync::Arc;@@ -43,10 +44,17 @@ pub(crate) async fn invoke(}let policy = hooks.resolve_policy(config).await?;- let class = super::classify_tool_call_with_security(config, policy.clone(), tool_name, &args)?;+ let class = crate::tools::native_ops::classify_tool_call_with_security(+ config,+ policy.clone(),+ tool_name,+ &args,+ )?;let audit_id = hooks.authorize(&policy, class, tool_name, &args).await?;tracing::debug!(target: "flows", %tool_name, ?class, "[flows] dispatching NATIVE OpenHuman tool");- let result = super::execute_tool_with_security(config, policy, tool_name, args, false)+ let result = crate::tools::native_ops::execute_tool_with_security(+ config, policy, tool_name, args, false,+ ).await.and_then(|outcome| {reject_failed_native_tool_result(slug, &outcome.result)@@ -90,5 +98,5 @@ pub(crate) fn native_tool_payload(result: &ToolResult) -> Value {}#[cfg(test)]-#[path = "flow_backend_tests.rs"]+#[path = "native_backend_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/tools/native_ops.rs b/crates/openhuman-core/src/tools/native_ops.rsindex 8232dc2165..1f695b164d 100644--- a/crates/openhuman-core/src/tools/native_ops.rs+++ b/crates/openhuman-core/src/tools/native_ops.rs@@ -264,5 +264,3 @@ pub async fn execute_tool_with_security(})}-#[path = "native_ops/flow_backend.rs"]-pub(crate) mod flow_backend;