feat(coding-agent): add tool override support via extensions

- Add setActiveTools() to ExtensionAPI for dynamic tool management
- Extensions can now override, wrap, or disable built-in tools
- Add tool-override.ts example demonstrating the pattern
- Update documentation for tool override capabilities
This commit is contained in:
Mario Zechner 2026-01-08 13:14:27 +01:00
parent 7a2c19cdf0
commit e3dd4f21d1
10 changed files with 211 additions and 61 deletions

View file

@ -946,6 +946,17 @@ pi.registerTool({
Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`) by registering a tool with the same name. Interactive mode displays a warning when this happens.
Use `--no-tools` to start without built-in tools, then add back specific ones with `--tools`:
```bash
# No built-in tools, only extension tools
pi --no-tools -e ./my-extension.ts
# No built-in read, use extension's read, keep other built-ins
pi -e ./tool-override.ts
```
See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.ts) for a complete example that overrides `read` with logging and access control.
**Your implementation must match the exact result shape**, including the `details` type. The UI and session logic depend on these shapes for rendering and state tracking.
Built-in tool implementations: