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(flows): add caps host tool invoke preflight
Steven Enamakele215751c8bad
diff --git a/crates/openhuman-core/src/flows/builder_host.rs b/crates/openhuman-core/src/flows/builder_host.rsindex 78b37c93f6..fff94474b5 100644--- a/crates/openhuman-core/src/flows/builder_host.rs+++ b/crates/openhuman-core/src/flows/builder_host.rs@@ -241,6 +241,22 @@ impl FlowsHost {}).await}++ async fn preflight_tool(&self, slug: String, args: Value) -> Result<Value, String> {+ let config = Arc::clone(&self.config);+ self.in_context(async move {+ if let Some(backend) = crate::flows::tinyflows::caps::tools::backend_for(&slug) {+ backend+ .preflight(&config, &slug, &args)+ .await+ .map_err(|error| error.to_string())?;+ }+ // The module discards this acknowledgement and returns only its+ // deterministic MockTools result. Never invoke the real backend.+ Ok(Value::Null)+ })+ .await+ }}fn required<T: DeserializeOwned>(value: &Value, key: &str) -> Result<T, String> {@@ -282,6 +298,16 @@ impl FlowsHost {}}+#[tinybus::interface(name = "ai.tinyhumans.tinyflows.CapsHost")]+impl FlowsHost {+ /// Validate mock tool arguments only; sandbox results stay module-owned.+ async fn tool_invoke(&self, slug: String, args: Value, _connection: Option<String>) -> BusResult<Value> {+ self.preflight_tool(slug, args)+ .await+ .map_err(|error| bus_error("ToolInvoke", error))+ }+}+/// A served Copilot host callback. Its address is passed in the invocation/// envelope and remains fixed for the entire tool call.pub(crate) struct HostRegistration {diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rsindex 4fd96c8cdd..ca736541dd 100644--- a/tests/json_rpc_e2e.rs+++ b/tests/json_rpc_e2e.rs@@ -11545,12 +11545,20 @@ async fn json_rpc_flows_full_arc_discover_build_create_run_inner() {clear_forced_chat_completions();with_chat_completion_requests(|requests| requests.clear());let demo_graph = opus_sonnet_demo_graph();+ let sandbox_graph = json!({+ "nodes": [+ { "id": "trigger", "kind": "trigger", "name": "Manual" },+ { "id": "search", "kind": "tool_call", "name": "Mock search",+ "config": { "slug": "oh:web_search", "args": { "query": "sandbox callback probe" } } }+ ],+ "edges": [ { "from_node": "trigger", "to_node": "search" } ]+ });// Turn 1: dry-run the graph through TinyFlows' sandbox bus path. Turn 2:// propose it after reading the sandbox result. Turn 3: a plain reply ends// the builder loop.push_forced_chat_completion_when("dry_run_workflow",- forced_tool_call_completion("dry_run_workflow", json!({ "graph": demo_graph.clone() })),+ forced_tool_call_completion("dry_run_workflow", json!({ "graph": sandbox_graph })),);push_forced_chat_completion_when("propose_workflow",