@mariozechner/pi-coding-agent 0.34.2 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +204 -0
- package/README.md +233 -105
- package/dist/cli/args.d.ts +3 -4
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +13 -18
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -3
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +39 -50
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +166 -197
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +3 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +6 -5
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +1 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/extensions/index.d.ts +10 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +21 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +400 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +88 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/{hooks → extensions}/runner.js +52 -141
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +461 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/{hooks → extensions}/types.js +7 -4
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +25 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/{hooks/tool-wrapper.js → extensions/wrapper.js} +39 -24
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/messages.d.ts +7 -7
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +4 -4
- package/dist/core/messages.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +40 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/{slash-commands.js → prompt-templates.js} +31 -31
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/sdk.d.ts +29 -52
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +111 -211
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +17 -17
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +25 -10
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -6
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +4 -11
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +4 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +36 -33
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +7 -2
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +93 -4
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +1 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +2 -2
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +4 -4
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +18 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/{hook-message.js → custom-message.js} +3 -3
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +2 -2
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +2 -2
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/{hook-editor.d.ts → extension-editor.d.ts} +3 -3
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/{hook-editor.js → extension-editor.js} +4 -4
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/{hook-input.d.ts → extension-input.d.ts} +3 -3
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/{hook-input.js → extension-input.js} +3 -3
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/{hook-selector.d.ts → extension-selector.d.ts} +3 -3
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/{hook-selector.js → extension-selector.js} +3 -3
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +3 -3
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +8 -8
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +3 -3
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -9
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +37 -44
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +143 -189
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +10 -33
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +3 -3
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +3 -3
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -2
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +33 -57
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +16 -16
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/extensions.md +1053 -0
- package/docs/rpc.md +4 -4
- package/docs/sdk.md +62 -93
- package/docs/session.md +22 -19
- package/docs/skills.md +1 -1
- package/docs/tui.md +1 -1
- package/examples/README.md +9 -15
- package/examples/extensions/README.md +141 -0
- package/examples/{hooks → extensions}/auto-commit-on-exit.ts +3 -3
- package/examples/extensions/chalk-logger.ts +26 -0
- package/examples/{hooks → extensions}/confirm-destructive.ts +3 -3
- package/examples/{hooks → extensions}/custom-compaction.ts +6 -6
- package/examples/{hooks → extensions}/dirty-repo-guard.ts +8 -4
- package/examples/{hooks → extensions}/file-trigger.ts +3 -3
- package/examples/{hooks → extensions}/git-checkpoint.ts +3 -3
- package/examples/{hooks → extensions}/handoff.ts +3 -3
- package/examples/extensions/hello.ts +25 -0
- package/examples/{hooks → extensions}/permission-gate.ts +3 -3
- package/examples/{hooks → extensions}/pirate.ts +5 -5
- package/examples/{hooks → extensions}/plan-mode.ts +6 -6
- package/examples/{hooks → extensions}/protected-paths.ts +3 -3
- package/examples/{hooks → extensions}/qna.ts +3 -3
- package/examples/{custom-tools/question/index.ts → extensions/question.ts} +13 -17
- package/examples/{hooks → extensions}/snake.ts +3 -3
- package/examples/{hooks → extensions}/status-line.ts +3 -3
- package/examples/{custom-tools → extensions}/subagent/README.md +15 -15
- package/examples/{custom-tools → extensions}/subagent/index.ts +22 -43
- package/examples/{custom-tools/todo/index.ts → extensions/todo.ts} +122 -39
- package/examples/{hooks → extensions}/tools.ts +5 -5
- package/examples/extensions/with-deps/index.ts +40 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +16 -0
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/05-tools.ts +7 -41
- package/examples/sdk/06-extensions.ts +81 -0
- package/examples/sdk/08-prompt-templates.ts +42 -0
- package/examples/sdk/12-full-control.ts +10 -29
- package/examples/sdk/README.md +5 -5
- package/package.json +4 -4
- package/dist/core/custom-tools/index.d.ts +0 -7
- package/dist/core/custom-tools/index.d.ts.map +0 -1
- package/dist/core/custom-tools/index.js +0 -6
- package/dist/core/custom-tools/index.js.map +0 -1
- package/dist/core/custom-tools/loader.d.ts +0 -30
- package/dist/core/custom-tools/loader.d.ts.map +0 -1
- package/dist/core/custom-tools/loader.js +0 -276
- package/dist/core/custom-tools/loader.js.map +0 -1
- package/dist/core/custom-tools/types.d.ts +0 -144
- package/dist/core/custom-tools/types.d.ts.map +0 -1
- package/dist/core/custom-tools/types.js +0 -8
- package/dist/core/custom-tools/types.js.map +0 -1
- package/dist/core/custom-tools/wrapper.d.ts +0 -15
- package/dist/core/custom-tools/wrapper.d.ts.map +0 -1
- package/dist/core/custom-tools/wrapper.js +0 -23
- package/dist/core/custom-tools/wrapper.js.map +0 -1
- package/dist/core/hooks/index.d.ts +0 -6
- package/dist/core/hooks/index.d.ts.map +0 -1
- package/dist/core/hooks/index.js +0 -6
- package/dist/core/hooks/index.js.map +0 -1
- package/dist/core/hooks/loader.d.ts +0 -146
- package/dist/core/hooks/loader.d.ts.map +0 -1
- package/dist/core/hooks/loader.js +0 -275
- package/dist/core/hooks/loader.js.map +0 -1
- package/dist/core/hooks/runner.d.ts +0 -173
- package/dist/core/hooks/runner.d.ts.map +0 -1
- package/dist/core/hooks/runner.js.map +0 -1
- package/dist/core/hooks/tool-wrapper.d.ts +0 -17
- package/dist/core/hooks/tool-wrapper.d.ts.map +0 -1
- package/dist/core/hooks/tool-wrapper.js.map +0 -1
- package/dist/core/hooks/types.d.ts +0 -767
- package/dist/core/hooks/types.d.ts.map +0 -1
- package/dist/core/hooks/types.js.map +0 -1
- package/dist/core/slash-commands.d.ts +0 -40
- package/dist/core/slash-commands.d.ts.map +0 -1
- package/dist/core/slash-commands.js.map +0 -1
- package/dist/modes/interactive/components/hook-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/hook-editor.js.map +0 -1
- package/dist/modes/interactive/components/hook-input.d.ts.map +0 -1
- package/dist/modes/interactive/components/hook-input.js.map +0 -1
- package/dist/modes/interactive/components/hook-message.d.ts +0 -18
- package/dist/modes/interactive/components/hook-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/hook-message.js.map +0 -1
- package/dist/modes/interactive/components/hook-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/hook-selector.js.map +0 -1
- package/docs/custom-tools.md +0 -514
- package/docs/extension-loading.md +0 -1004
- package/docs/hooks.md +0 -979
- package/docs/session-tree-plan.md +0 -441
- package/examples/custom-tools/README.md +0 -114
- package/examples/custom-tools/hello/index.ts +0 -21
- package/examples/hooks/README.md +0 -60
- package/examples/hooks/todo/index.ts +0 -134
- package/examples/sdk/06-hooks.ts +0 -61
- package/examples/sdk/08-slash-commands.ts +0 -42
- /package/examples/{custom-tools → extensions}/subagent/agents/planner.md +0 -0
- /package/examples/{custom-tools → extensions}/subagent/agents/reviewer.md +0 -0
- /package/examples/{custom-tools → extensions}/subagent/agents/scout.md +0 -0
- /package/examples/{custom-tools → extensions}/subagent/agents/worker.md +0 -0
- /package/examples/{custom-tools → extensions}/subagent/agents.ts +0 -0
- /package/examples/{custom-tools/subagent/commands → extensions/subagent/prompts}/implement-and-review.md +0 -0
- /package/examples/{custom-tools/subagent/commands → extensions/subagent/prompts}/implement.md +0 -0
- /package/examples/{custom-tools/subagent/commands → extensions/subagent/prompts}/scout-and-plan.md +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,206 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.35.0] - 2026-01-05
|
|
4
|
+
|
|
5
|
+
This release unifies hooks and custom tools into a single "extensions" system and renames "slash commands" to "prompt templates". ([#454](https://github.com/badlogic/pi-mono/issues/454))
|
|
6
|
+
|
|
7
|
+
**Before migrating, read:**
|
|
8
|
+
- [docs/extensions.md](docs/extensions.md) - Full API reference
|
|
9
|
+
- [README.md](README.md) - Extensions section with examples
|
|
10
|
+
- [examples/extensions/](examples/extensions/) - Working examples
|
|
11
|
+
|
|
12
|
+
### Extensions Migration
|
|
13
|
+
|
|
14
|
+
Hooks and custom tools are now unified as **extensions**. Both were TypeScript modules exporting a factory function that receives an API object. Now there's one concept, one discovery location, one CLI flag, one settings.json entry.
|
|
15
|
+
|
|
16
|
+
**Automatic migration:**
|
|
17
|
+
- `commands/` directories are automatically renamed to `prompts/` on startup (both `~/.pi/agent/commands/` and `.pi/commands/`)
|
|
18
|
+
|
|
19
|
+
**Manual migration required:**
|
|
20
|
+
1. Move files from `hooks/` and `tools/` directories to `extensions/` (deprecation warnings shown on startup)
|
|
21
|
+
2. Update imports and type names in your extension code
|
|
22
|
+
3. Update `settings.json` if you have explicit hook and custom tool paths configured
|
|
23
|
+
|
|
24
|
+
**Directory changes:**
|
|
25
|
+
```
|
|
26
|
+
# Before
|
|
27
|
+
~/.pi/agent/hooks/*.ts → ~/.pi/agent/extensions/*.ts
|
|
28
|
+
~/.pi/agent/tools/*.ts → ~/.pi/agent/extensions/*.ts
|
|
29
|
+
.pi/hooks/*.ts → .pi/extensions/*.ts
|
|
30
|
+
.pi/tools/*.ts → .pi/extensions/*.ts
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Extension discovery rules** (in `extensions/` directories):
|
|
34
|
+
1. **Direct files:** `extensions/*.ts` or `*.js` → loaded directly
|
|
35
|
+
2. **Subdirectory with index:** `extensions/myext/index.ts` → loaded as single extension
|
|
36
|
+
3. **Subdirectory with package.json:** `extensions/myext/package.json` with `"pi"` field → loads declared paths
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
// extensions/my-package/package.json
|
|
40
|
+
{
|
|
41
|
+
"name": "my-extension-package",
|
|
42
|
+
"dependencies": { "zod": "^3.0.0" },
|
|
43
|
+
"pi": {
|
|
44
|
+
"extensions": ["./src/main.ts", "./src/tools.ts"]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
No recursion beyond one level. Complex packages must use the `package.json` manifest. Dependencies are resolved via jiti, and extensions can be published to and installed from npm.
|
|
50
|
+
|
|
51
|
+
**Type renames:**
|
|
52
|
+
- `HookAPI` → `ExtensionAPI`
|
|
53
|
+
- `HookContext` → `ExtensionContext`
|
|
54
|
+
- `HookCommandContext` → `ExtensionCommandContext`
|
|
55
|
+
- `HookUIContext` → `ExtensionUIContext`
|
|
56
|
+
- `CustomToolAPI` → `ExtensionAPI` (merged)
|
|
57
|
+
- `CustomToolContext` → `ExtensionContext` (merged)
|
|
58
|
+
- `CustomToolUIContext` → `ExtensionUIContext`
|
|
59
|
+
- `CustomTool` → `ToolDefinition`
|
|
60
|
+
- `CustomToolFactory` → `ExtensionFactory`
|
|
61
|
+
- `HookMessage` → `CustomMessage`
|
|
62
|
+
|
|
63
|
+
**Import changes:**
|
|
64
|
+
```typescript
|
|
65
|
+
// Before (hook)
|
|
66
|
+
import type { HookAPI, HookContext } from "@mariozechner/pi-coding-agent";
|
|
67
|
+
export default function (pi: HookAPI) { ... }
|
|
68
|
+
|
|
69
|
+
// Before (custom tool)
|
|
70
|
+
import type { CustomToolFactory } from "@mariozechner/pi-coding-agent";
|
|
71
|
+
const factory: CustomToolFactory = (pi) => ({ name: "my_tool", ... });
|
|
72
|
+
export default factory;
|
|
73
|
+
|
|
74
|
+
// After (both are now extensions)
|
|
75
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
76
|
+
export default function (pi: ExtensionAPI) {
|
|
77
|
+
pi.on("tool_call", async (event, ctx) => { ... });
|
|
78
|
+
pi.registerTool({ name: "my_tool", ... });
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Custom tools now have full context access.** Tools registered via `pi.registerTool()` now receive the same `ctx` object that event handlers receive. Previously, custom tools had limited context. Now all extension code shares the same capabilities:
|
|
83
|
+
|
|
84
|
+
- `pi.registerTool()` - Register tools the LLM can call
|
|
85
|
+
- `pi.registerCommand()` - Register commands like `/mycommand`
|
|
86
|
+
- `pi.registerShortcut()` - Register keyboard shortcuts (shown in `/hotkeys`)
|
|
87
|
+
- `pi.registerFlag()` - Register CLI flags (shown in `--help`)
|
|
88
|
+
- `pi.registerMessageRenderer()` - Custom TUI rendering for message types
|
|
89
|
+
- `pi.on()` - Subscribe to lifecycle events (tool_call, session_start, etc.)
|
|
90
|
+
- `pi.sendMessage()` - Inject messages into the conversation
|
|
91
|
+
- `pi.appendEntry()` - Persist custom data in session (survives restart/branch)
|
|
92
|
+
- `pi.exec()` - Run shell commands
|
|
93
|
+
- `pi.getActiveTools()` / `pi.setActiveTools()` - Dynamic tool enable/disable
|
|
94
|
+
- `pi.getAllTools()` - List all available tools
|
|
95
|
+
- `pi.events` - Event bus for cross-extension communication
|
|
96
|
+
- `ctx.ui.confirm()` / `select()` / `input()` - User prompts
|
|
97
|
+
- `ctx.ui.notify()` - Toast notifications
|
|
98
|
+
- `ctx.ui.setStatus()` - Persistent status in footer (multiple extensions can set their own)
|
|
99
|
+
- `ctx.ui.setWidget()` - Widget display above editor
|
|
100
|
+
- `ctx.ui.setTitle()` - Set terminal window title
|
|
101
|
+
- `ctx.ui.custom()` - Full TUI component with keyboard handling
|
|
102
|
+
- `ctx.ui.editor()` - Multi-line text editor with external editor support
|
|
103
|
+
- `ctx.sessionManager` - Read session entries, get branch history
|
|
104
|
+
|
|
105
|
+
**Settings changes:**
|
|
106
|
+
```json
|
|
107
|
+
// Before
|
|
108
|
+
{
|
|
109
|
+
"hooks": ["./my-hook.ts"],
|
|
110
|
+
"customTools": ["./my-tool.ts"]
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// After
|
|
114
|
+
{
|
|
115
|
+
"extensions": ["./my-extension.ts"]
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**CLI changes:**
|
|
120
|
+
```bash
|
|
121
|
+
# Before
|
|
122
|
+
pi --hook ./safety.ts --tool ./todo.ts
|
|
123
|
+
|
|
124
|
+
# After
|
|
125
|
+
pi --extension ./safety.ts -e ./todo.ts
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Prompt Templates Migration
|
|
129
|
+
|
|
130
|
+
"Slash commands" (markdown files defining reusable prompts invoked via `/name`) are renamed to "prompt templates" to avoid confusion with extension-registered commands.
|
|
131
|
+
|
|
132
|
+
**Automatic migration:** The `commands/` directory is automatically renamed to `prompts/` on startup (if `prompts/` doesn't exist). Works for both regular directories and symlinks.
|
|
133
|
+
|
|
134
|
+
**Directory changes:**
|
|
135
|
+
```
|
|
136
|
+
~/.pi/agent/commands/*.md → ~/.pi/agent/prompts/*.md
|
|
137
|
+
.pi/commands/*.md → .pi/prompts/*.md
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**SDK type renames:**
|
|
141
|
+
- `FileSlashCommand` → `PromptTemplate`
|
|
142
|
+
- `LoadSlashCommandsOptions` → `LoadPromptTemplatesOptions`
|
|
143
|
+
|
|
144
|
+
**SDK function renames:**
|
|
145
|
+
- `discoverSlashCommands()` → `discoverPromptTemplates()`
|
|
146
|
+
- `loadSlashCommands()` → `loadPromptTemplates()`
|
|
147
|
+
- `expandSlashCommand()` → `expandPromptTemplate()`
|
|
148
|
+
- `getCommandsDir()` → `getPromptsDir()`
|
|
149
|
+
|
|
150
|
+
**SDK option renames:**
|
|
151
|
+
- `CreateAgentSessionOptions.slashCommands` → `.promptTemplates`
|
|
152
|
+
- `AgentSession.fileCommands` → `.promptTemplates`
|
|
153
|
+
- `PromptOptions.expandSlashCommands` → `.expandPromptTemplates`
|
|
154
|
+
|
|
155
|
+
### SDK Migration
|
|
156
|
+
|
|
157
|
+
**Discovery functions:**
|
|
158
|
+
- `discoverAndLoadHooks()` → `discoverAndLoadExtensions()`
|
|
159
|
+
- `discoverAndLoadCustomTools()` → merged into `discoverAndLoadExtensions()`
|
|
160
|
+
- `loadHooks()` → `loadExtensions()`
|
|
161
|
+
- `loadCustomTools()` → merged into `loadExtensions()`
|
|
162
|
+
|
|
163
|
+
**Runner and wrapper:**
|
|
164
|
+
- `HookRunner` → `ExtensionRunner`
|
|
165
|
+
- `wrapToolsWithHooks()` → `wrapToolsWithExtensions()`
|
|
166
|
+
- `wrapToolWithHooks()` → `wrapToolWithExtensions()`
|
|
167
|
+
|
|
168
|
+
**CreateAgentSessionOptions:**
|
|
169
|
+
- `.hooks` → removed (use `.additionalExtensionPaths` for paths)
|
|
170
|
+
- `.additionalHookPaths` → `.additionalExtensionPaths`
|
|
171
|
+
- `.preloadedHooks` → `.preloadedExtensions`
|
|
172
|
+
- `.customTools` type changed: `Array<{ path?; tool: CustomTool }>` → `ToolDefinition[]`
|
|
173
|
+
- `.additionalCustomToolPaths` → merged into `.additionalExtensionPaths`
|
|
174
|
+
- `.slashCommands` → `.promptTemplates`
|
|
175
|
+
|
|
176
|
+
**AgentSession:**
|
|
177
|
+
- `.hookRunner` → `.extensionRunner`
|
|
178
|
+
- `.fileCommands` → `.promptTemplates`
|
|
179
|
+
- `.sendHookMessage()` → `.sendCustomMessage()`
|
|
180
|
+
|
|
181
|
+
### Session Migration
|
|
182
|
+
|
|
183
|
+
**Automatic.** Session version bumped from 2 to 3. Existing sessions are migrated on first load:
|
|
184
|
+
- Message role `"hookMessage"` → `"custom"`
|
|
185
|
+
|
|
186
|
+
### Breaking Changes
|
|
187
|
+
|
|
188
|
+
- **Settings:** `hooks` and `customTools` arrays replaced with single `extensions` array
|
|
189
|
+
- **CLI:** `--hook` and `--tool` flags replaced with `--extension` / `-e`
|
|
190
|
+
- **Directories:** `hooks/`, `tools/` → `extensions/`; `commands/` → `prompts/`
|
|
191
|
+
- **Types:** See type renames above
|
|
192
|
+
- **SDK:** See SDK migration above
|
|
193
|
+
|
|
194
|
+
### Changed
|
|
195
|
+
|
|
196
|
+
- Extensions can have their own `package.json` with dependencies (resolved via jiti)
|
|
197
|
+
- Documentation: `docs/hooks.md` and `docs/custom-tools.md` merged into `docs/extensions.md`
|
|
198
|
+
- Examples: `examples/hooks/` and `examples/custom-tools/` merged into `examples/extensions/`
|
|
199
|
+
- README: Extensions section expanded with custom tools, commands, events, state persistence, shortcuts, flags, and UI examples
|
|
200
|
+
- SDK: `customTools` option now accepts `ToolDefinition[]` directly (simplified from `Array<{ path?, tool }>`)
|
|
201
|
+
- SDK: `extensions` option accepts `ExtensionFactory[]` for inline extensions
|
|
202
|
+
- SDK: `additionalExtensionPaths` replaces both `additionalHookPaths` and `additionalCustomToolPaths`
|
|
203
|
+
|
|
3
204
|
## [0.34.2] - 2026-01-04
|
|
4
205
|
|
|
5
206
|
## [0.34.1] - 2026-01-04
|
|
@@ -41,6 +242,9 @@
|
|
|
41
242
|
- Tool registry now contains all built-in tools (read, bash, edit, write, grep, find, ls) even when `--tools` limits the initially active set. Hooks can enable any tool from the registry via `pi.setActiveTools()`.
|
|
42
243
|
- System prompt now automatically rebuilds when tools change via `setActiveTools()`, updating tool descriptions and guidelines to match the new tool set
|
|
43
244
|
- Hook errors now display full stack traces for easier debugging
|
|
245
|
+
- Event bus (`pi.events`) for tool/hook communication: shared pub/sub between custom tools and hooks
|
|
246
|
+
- Custom tools now have `pi.sendMessage()` to send messages directly to the agent session without needing the event bus
|
|
247
|
+
- `sendMessage()` supports `deliverAs: "nextTurn"` to queue messages for the next user prompt
|
|
44
248
|
|
|
45
249
|
### Changed
|
|
46
250
|
|