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): introduce OpenHumanTools dispatcher
Steven Enamakel07575b3ecf05
diff --git a/crates/openhuman-core/src/flows/caps_host/tools/mod.rs b/crates/openhuman-core/src/flows/caps_host/tools/mod.rsindex 4a94a86f8b..5aa5212092 100644--- a/crates/openhuman-core/src/flows/caps_host/tools/mod.rs+++ b/crates/openhuman-core/src/flows/caps_host/tools/mod.rs@@ -25,13 +25,18 @@mod composio;mod native;+use std::sync::Arc;+use async_trait::async_trait;use serde_json::Value;-use tinyflows::error::{EngineError, Result};use crate::config::Config;+use crate::core::runtime::DispatchCtx;+use crate::security::approval::ApprovalTurnContext;use crate::security::SecurityPolicy;+use super::{EngineError, Result};+pub(crate) use composio::ComposioToolBackend;pub(crate) use native::NativeToolBackend;@@ -43,6 +48,47 @@ pub(crate) use native::NativeToolBackend;pub(crate) const NATIVE_TOOL_PREFIX: &str =crate::tools::native_ops::flow_backend::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)+}++pub(crate) async fn is_curated_flow_tool(+ ctx: &DispatchCtx,+ config: &Config,+ slug: &str,+) -> bool {+ crate::integrations::composio::flow_gate::is_curated_flow_tool(ctx, config, slug).await+}++/// Per-run tool dispatcher retaining the captured context, live policy and+/// approval correlation for each module callback.+pub(crate) struct OpenHumanTools {+ pub(crate) ctx: DispatchCtx,+ pub(crate) config: Arc<Config>,+ pub(crate) security: Arc<SecurityPolicy>,+ pub(crate) approval: ApprovalTurnContext,+}++impl OpenHumanTools {+ pub(crate) async fn invoke(+ &self,+ slug: &str,+ args: Value,+ conn: Option<&str>,+ ) -> Result<Value> {+ let ctx = ToolCallCtx {+ dispatch: &self.ctx,+ config: &self.config,+ security: &self.security,+ approval: &self.approval,+ };+ match backend_for(slug) {+ Some(backend) => backend.invoke(&ctx, slug, args, conn).await,+ None => Err(unclaimed_slug_error(slug)),+ }+ }+}+/// What a backend needs to service one call.////// Borrowed rather than owned so dispatch clones nothing per call.