WIP: Output tool via Arc<Mutex<Subconscious>>, ToolHandler to Arc<dyn Fn>

- ToolHandler changed to Arc<dyn Fn(...)> (supports closures)
- Subconscious wrapped in Arc<Mutex<>> on Mind
- init_output_tool() pushes output tool closure capturing the Arc
- Output removed from static memory_tools()
- Most tool handlers wrapped in Arc::new() but some have paren issues

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-08 20:37:19 -04:00
parent d167b11283
commit 12798eeae2
15 changed files with 74 additions and 51 deletions

View file

@ -9,13 +9,13 @@ pub fn tools() -> [super::Tool; 2] {
name: "web_fetch",
description: "Fetch content from a URL and return it as text. Use for reading web pages, API responses, documentation.",
parameters_json: r#"{"type":"object","properties":{"url":{"type":"string","description":"The URL to fetch"}},"required":["url"]}"#,
handler: |_a, v| Box::pin(async move { web_fetch(&v).await }),
handler: Arc::new(|_a, v| Box::pin(async move { web_fetch(&v).await }),
},
super::Tool {
name: "web_search",
description: "Search the web and return results. Use for finding documentation, looking up APIs, researching topics.",
parameters_json: r#"{"type":"object","properties":{"query":{"type":"string","description":"The search query"},"num_results":{"type":"integer","description":"Number of results to return (default 5)"}},"required":["query"]}"#,
handler: |_a, v| Box::pin(async move { web_search(&v).await }),
handler: Arc::new(|_a, v| Box::pin(async move { web_search(&v).await }),
},
]
}