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

@ -25,7 +25,7 @@ pub fn tool() -> super::Tool {
name: "grep",
description: "Search for a pattern in files. Returns matching file paths by default, or matching lines with context.",
parameters_json: r#"{"type":"object","properties":{"pattern":{"type":"string","description":"Regex pattern to search for"},"path":{"type":"string","description":"Directory or file to search in (default: current directory)"},"glob":{"type":"string","description":"Glob pattern to filter files (e.g. '*.rs')"},"show_content":{"type":"boolean","description":"Show matching lines instead of just file paths"},"context_lines":{"type":"integer","description":"Lines of context around matches"}},"required":["pattern"]}"#,
handler: |_a, v| Box::pin(async move { grep(&v) }),
handler: Arc::new(|_a, v| Box::pin(async move { grep(&v)) }),
}
}