fix(tools): tool registry now contains ALL built-in tools

- createAllTools() populates registry with all 7 built-in tools
- --tools flag only sets initially active tools (default: read/bash/edit/write)
- Hooks can enable any tool from registry via setActiveTools()
- System prompt rebuilds with correct tool guidelines when tools change
- Document tsx module resolution workaround in README
This commit is contained in:
Mario Zechner 2026-01-04 18:44:41 +01:00
parent c447e62662
commit 2849623afc
2 changed files with 61 additions and 26 deletions

View file

@ -1132,6 +1132,21 @@ import { getPackageDir, getThemeDir } from "./paths.js";
Never use `__dirname` directly for package assets.
### Module Resolution with tsx
When running from source via `npx tsx src/cli.ts`, hooks loaded via jiti may get separate module instances from the main app. This can cause issues with global state (like the theme object).
**Workaround**: Functions like `getSettingsListTheme()` accept an optional theme parameter. In hooks, pass the theme from `ctx.ui.custom()`:
```typescript
await ctx.ui.custom((tui, theme, done) => {
const settingsTheme = getSettingsListTheme(theme);
// ...
});
```
When running the built version (`node dist/cli.js` or installed via npm), this is not an issue.
### Debug Command
`/debug` (hidden) writes rendered lines with ANSI codes to `~/.pi/agent/pi-debug.log` for TUI debugging, as well as the last set of messages that were sent to the LLM.