@mariozechner/pi-coding-agent 0.27.0 → 0.27.2

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.
@@ -192,7 +192,7 @@ interface ToolSessionEvent {
192
192
 
193
193
  **Reasons:**
194
194
  - `start`: Initial session load on startup
195
- - `switch`: User switched to a different session (`/session`)
195
+ - `switch`: User switched to a different session (`/resume`)
196
196
  - `branch`: User branched from a previous message (`/branch`)
197
197
  - `clear`: User cleared the session (`/clear`)
198
198
 
@@ -400,12 +400,12 @@ const factory: CustomToolFactory = (pi) => {
400
400
 
401
401
  ## Examples
402
402
 
403
- See [`examples/custom-tools/todo.ts`](../examples/custom-tools/todo.ts) for a complete example with:
403
+ See [`examples/custom-tools/todo/index.ts`](../examples/custom-tools/todo/index.ts) for a complete example with:
404
404
  - `onSession` for state reconstruction
405
405
  - Custom `renderCall` and `renderResult`
406
406
  - Proper branching support via details storage
407
407
 
408
408
  Test with:
409
409
  ```bash
410
- pi --tool packages/coding-agent/examples/custom-tools/todo.ts
410
+ pi --tool packages/coding-agent/examples/custom-tools/todo/index.ts
411
411
  ```
package/docs/hooks.md CHANGED
@@ -120,7 +120,7 @@ user branches (/branch)
120
120
  ├─► session (reason: "before_branch", can cancel)
121
121
  └─► session (reason: "branch", AFTER branch)
122
122
 
123
- user switches session (/session)
123
+ user switches session (/resume)
124
124
 
125
125
  ├─► session (reason: "before_switch", can cancel)
126
126
  └─► session (reason: "switch", AFTER switch)
@@ -154,13 +154,18 @@ pi.on("session", async (event, ctx) => {
154
154
  if (event.reason === "before_clear") {
155
155
  return { cancel: true };
156
156
  }
157
- // No return needed if not cancelling
157
+
158
+ // For before_branch only: create branch but skip conversation restore
159
+ // (useful for checkpoint hooks that restore files separately)
160
+ if (event.reason === "before_branch") {
161
+ return { skipConversationRestore: true };
162
+ }
158
163
  });
159
164
  ```
160
165
 
161
166
  **Reasons:**
162
167
  - `start`: Initial session load on startup
163
- - `before_switch` / `switch`: User switched sessions (`/session`)
168
+ - `before_switch` / `switch`: User switched sessions (`/resume`)
164
169
  - `before_clear` / `clear`: User cleared the session (`/clear`)
165
170
  - `before_branch` / `branch`: User branched the session (`/branch`)
166
171
  - `shutdown`: Process is exiting (double Ctrl+C, Ctrl+D, or SIGTERM)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mariozechner/pi-coding-agent",
3
- "version": "0.27.0",
3
+ "version": "0.27.2",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -39,9 +39,9 @@
39
39
  "prepublishOnly": "npm run clean && npm run build"
40
40
  },
41
41
  "dependencies": {
42
- "@mariozechner/pi-agent-core": "^0.27.0",
43
- "@mariozechner/pi-ai": "^0.27.0",
44
- "@mariozechner/pi-tui": "^0.27.0",
42
+ "@mariozechner/pi-agent-core": "^0.27.2",
43
+ "@mariozechner/pi-ai": "^0.27.2",
44
+ "@mariozechner/pi-tui": "^0.27.2",
45
45
  "chalk": "^5.5.0",
46
46
  "cli-highlight": "^2.1.11",
47
47
  "diff": "^8.0.2",