From 1554d8869482f8cdc5c5a8a0a8ee78546fddfa06 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Sat, 4 Apr 2026 16:41:58 -0400 Subject: [PATCH] tools: delete dispatch_shared, use dispatch everywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dispatch_shared was a legacy wrapper — replaced by dispatch() which goes through the unified Tool registry. One dispatch path for all callers (interactive agent, subconscious agents, MCP server). Co-Authored-By: Proof of Concept --- src/agent/tools/mod.rs | 17 ----------------- src/subconscious/api.rs | 6 +----- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/agent/tools/mod.rs b/src/agent/tools/mod.rs index 16cafb0..276bab9 100644 --- a/src/agent/tools/mod.rs +++ b/src/agent/tools/mod.rs @@ -144,23 +144,6 @@ pub async fn dispatch_with_agent( } } -/// Dispatch shared tools — used by subconscious agents. -pub async fn dispatch_shared( - name: &str, - args: &serde_json::Value, - _provenance: Option<&str>, -) -> Option { - for tool in tools() { - if tool.name == name { - return Some(match (tool.handler)(None, args.clone()).await { - Ok(s) => s, - Err(e) => format!("Error: {}", e), - }); - } - } - None -} - /// Return all registered tools with definitions + handlers. pub fn tools() -> Vec { let mut all = vec![ diff --git a/src/subconscious/api.rs b/src/subconscious/api.rs index 864c5dc..13223b4 100644 --- a/src/subconscious/api.rs +++ b/src/subconscious/api.rs @@ -177,11 +177,7 @@ pub async fn call_api_with_tools( } }; - let prov = provenance.borrow().clone(); - let output = match agent_tools::dispatch_shared(&call.function.name, &args, Some(&prov)).await { - Some(out) => out, - None => format!("Error: Unknown tool: {}", call.function.name), - }; + let output = agent_tools::dispatch(&call.function.name, &args).await; if std::env::var("POC_AGENT_VERBOSE").is_ok() { log(&format!("TOOL RESULT ({} chars):\n{}", output.len(), output));