Expand description
Tool dispatch — routes tool calls from inference to the registry. Tool execution dispatch — sequential, parallel, and split-batch.
Routes tool calls from the inference loop to execution, handling approval flow, parallelization, and result recording.
§Dispatch flow
Model emits tool calls
→ Classify each call's effect (ReadOnly / LocalMutation / Destructive)
→ Split into read-only batch + mutation batch
→ Read-only tools: execute in parallel (tokio::join)
→ Mutation tools: execute sequentially with approval
→ Record results in DB + inject into conversation§Related modules
crate::tools— tool definitions andToolRegistry::execute()crate::approval— approval mode and effect classificationsub_agent_dispatch.rs—InvokeAgenthandling (needs provider access)approval_flow.rs— interactive approval UI flow
§Design (DESIGN.md)
- Tool Dispatch: Match Statement (P2): Tools are dispatched via a
matchinToolRegistry::execute(), not aHashMap<String, Box<dyn Tool>>. Rust’s exhaustive matching catches missing handlers at compile time.