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
feat(tools): add plan review and composio connect tools
Steven Enamakelb81d300435a6
diff --git a/crates/openhuman-core/src/agent/plan_review/tool.rs b/crates/openhuman-core/src/agent/plan_review/tool.rsindex 7dd4397b77..0f91c00809 100644--- a/crates/openhuman-core/src/agent/plan_review/tool.rs+++ b/crates/openhuman-core/src/agent/plan_review/tool.rs@@ -12,7 +12,6 @@ use async_trait::async_trait;use serde_json::json;use crate::agent::turn_origin::{self, AgentTurnOrigin};-use crate::security::approval::APPROVAL_CHAT_CONTEXT;use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult, ToolRunContext, ToolTimeout};use super::gate;@@ -133,8 +132,8 @@ impl RequestPlanReviewTool {}// Route the surface back to the originating chat thread/client (set by- // the web channel around the turn, same task-local the ApprovalGate uses).- let chat_ctx = APPROVAL_CHAT_CONTEXT.try_with(|c| c.clone()).ok();+ // the web channel for the turn, the same context the ApprovalGate uses).+ let chat_ctx = crate::agent::tinyagents::host::run_context::approval_for_tool(context).chat;let thread_id = chat_ctx.as_ref().map(|c| c.thread_id.clone());let client_id = chat_ctx.as_ref().map(|c| c.client_id.clone());diff --git a/crates/openhuman-core/src/integrations/composio/tools/connect.rs b/crates/openhuman-core/src/integrations/composio/tools/connect.rsindex 137b934d58..cd5f462956 100644--- a/crates/openhuman-core/src/integrations/composio/tools/connect.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/connect.rs@@ -226,13 +226,28 @@ impl Tool for ComposioConnectTool {// the toolkit slug into the card for the inline Connect button. The// engine's auto-gate is unconditional and would double-prompt.async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {- let outcome = Box::pin(self.execute_unredacted(args)).await;+ self.execute_with_context(args, tinytools::ToolCallOptions::default(), None)+ .await+ }++ async fn execute_with_context(+ &self,+ args: Value,+ _options: tinytools::ToolCallOptions,+ context: Option<&dyn tinytools::ToolRunContext>,+ ) -> anyhow::Result<ToolResult> {+ let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);+ let outcome = Box::pin(self.execute_unredacted(args, &approval)).await;redact_composio_outcome(&self.config, outcome)}}impl ComposioConnectTool {- async fn execute_unredacted(&self, args: Value) -> anyhow::Result<ToolResult> {+ pub(crate) async fn execute_unredacted(+ &self,+ args: Value,+ approval: &crate::security::approval::ApprovalTurnContext,+ ) -> anyhow::Result<ToolResult> {let raw_toolkit = args.get("toolkit").and_then(|v| v.as_str())@@ -250,14 +265,11 @@ impl ComposioConnectTool {let started = std::time::Instant::now();// The inline connect card only has a surface on an interactive chat- // turn (the web-chat path installs `APPROVAL_CHAT_CONTEXT`). On+ // turn (the web-chat path sets a chat approval context). On// background / cron turns there is no UI to click Connect, so fail// closed with a clear message rather than parking forever — mirrors// the `install_tool` guard (#3993).- if crate::security::approval::APPROVAL_CHAT_CONTEXT- .try_with(|_| ())- .is_err()- {+ if !approval.is_interactive() {return Ok(ToolResult::error(format!("[policy-denied] composio_connect needs an interactive chat turn. \Ask the user to connect '{toolkit}' in Connections."@@ -369,6 +381,7 @@ impl ComposioConnectTool {);let (outcome, _request_id) = match gate.intercept_audited_bounded(+ approval,"composio_connect",&summary,json!({ "toolkit": toolkit }),diff --git a/crates/openhuman-core/src/tools/impl/system/install_tool.rs b/crates/openhuman-core/src/tools/impl/system/install_tool.rsindex 9544a5998c..426a109398 100644--- a/crates/openhuman-core/src/tools/impl/system/install_tool.rs+++ b/crates/openhuman-core/src/tools/impl/system/install_tool.rs@@ -112,16 +112,35 @@ impl Tool for InstallToolTool {}async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {+ self.execute_with_context(args, tinytools::ToolCallOptions::default(), None)+ .await+ }++ async fn execute_with_context(+ &self,+ args: serde_json::Value,+ _options: tinytools::ToolCallOptions,+ context: Option<&dyn tinytools::ToolRunContext>,+ ) -> anyhow::Result<ToolResult> {+ let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);+ self.run(args, &approval).await+ }+}++impl InstallToolTool {+ /// Runs the install for a turn whose approval context is `approval`.+ pub(crate) async fn run(+ &self,+ args: serde_json::Value,+ approval: &crate::security::approval::ApprovalTurnContext,+ ) -> anyhow::Result<ToolResult> {// Gate 0: installs mutate the host (not the workspace), so they must// never run without an explicit human Approve. The ApprovalGate only- // parks for an interactive turn (`APPROVAL_CHAT_CONTEXT` present, set on- // the web-chat path); background / triage / cron turns bypass the gate- // entirely. Fail closed there — a doomed retry is short-circuited by the- // `[policy-denied]` marker.- if crate::security::approval::APPROVAL_CHAT_CONTEXT- .try_with(|_| ())- .is_err()- {+ // parks for an interactive turn (a chat context on the turn's approval+ // context, set on the web-chat path); background / triage / cron turns+ // bypass the gate entirely. Fail closed there — a doomed retry is+ // short-circuited by the `[policy-denied]` marker.+ if !approval.is_interactive() {return Ok(ToolResult::error("[policy-denied] install_tool requires interactive approval and is not available \in autonomous (background) turns.",