@kingingwang/pi-darwin-arm64 0.84.4 → 0.86.1

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.
Files changed (71) hide show
  1. package/bin/CHANGELOG.md +185 -5
  2. package/bin/README.md +4 -2
  3. package/bin/docs/compaction.md +39 -13
  4. package/bin/docs/containerization.md +45 -0
  5. package/bin/docs/custom-provider.md +22 -13
  6. package/bin/docs/development.md +23 -4
  7. package/bin/docs/docs.json +4 -0
  8. package/bin/docs/environment-variables.md +3 -0
  9. package/bin/docs/extensions.md +62 -45
  10. package/bin/docs/json.md +4 -4
  11. package/bin/docs/keybindings.md +5 -2
  12. package/bin/docs/models.md +37 -3
  13. package/bin/docs/providers.md +10 -2
  14. package/bin/docs/rpc.md +1 -1
  15. package/bin/docs/sdk.md +9 -2
  16. package/bin/docs/security.md +1 -1
  17. package/bin/docs/session-format.md +82 -40
  18. package/bin/docs/sessions.md +27 -0
  19. package/bin/docs/settings.md +60 -5
  20. package/bin/docs/skills.md +1 -1
  21. package/bin/docs/terminal-setup.md +15 -0
  22. package/bin/docs/termux.md +0 -1
  23. package/bin/docs/themes.md +8 -6
  24. package/bin/docs/tui.md +21 -2
  25. package/bin/docs/usage.md +1 -0
  26. package/bin/examples/README.md +3 -0
  27. package/bin/examples/extensions/README.md +0 -1
  28. package/bin/examples/extensions/custom-provider-anthropic/index.ts +18 -12
  29. package/bin/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  30. package/bin/examples/extensions/custom-provider-anthropic/package.json +1 -1
  31. package/bin/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  32. package/bin/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  33. package/bin/examples/extensions/dynamic-resources/dynamic.json +2 -0
  34. package/bin/examples/extensions/gondolin/package-lock.json +2 -2
  35. package/bin/examples/extensions/gondolin/package.json +1 -1
  36. package/bin/examples/extensions/prompt-customizer.ts +19 -67
  37. package/bin/examples/extensions/sandbox/package-lock.json +2 -2
  38. package/bin/examples/extensions/sandbox/package.json +1 -1
  39. package/bin/examples/extensions/with-deps/package-lock.json +2 -2
  40. package/bin/examples/extensions/with-deps/package.json +1 -1
  41. package/bin/examples/plugins/pi-example-plugin/README.md +38 -0
  42. package/bin/examples/plugins/pi-example-plugin/package.json +10 -0
  43. package/bin/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  44. package/bin/examples/plugins/pi-example-plugin/src/session.ts +23 -0
  45. package/bin/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  46. package/bin/native/darwin/prebuilds/darwin-arm64/{darwin-modifiers.node → darwin-platform.node} +0 -0
  47. package/bin/package.json +24 -23
  48. package/bin/pi +2 -2
  49. package/bin/theme/dark.json +2 -1
  50. package/bin/theme/light.json +2 -1
  51. package/bin/theme/theme-schema.json +6 -2
  52. package/package.json +1 -1
  53. package/bin/examples/extensions/kimi-deferred-tools.ts +0 -61
  54. package/bin/node_modules/@mariozechner/clipboard/.yarnrc.yml +0 -1
  55. package/bin/node_modules/@mariozechner/clipboard/Cargo.toml +0 -45
  56. package/bin/node_modules/@mariozechner/clipboard/README.md +0 -60
  57. package/bin/node_modules/@mariozechner/clipboard/build.rs +0 -5
  58. package/bin/node_modules/@mariozechner/clipboard/clipboard.darwin-arm64.node +0 -0
  59. package/bin/node_modules/@mariozechner/clipboard/exp.ts +0 -12
  60. package/bin/node_modules/@mariozechner/clipboard/index.d.ts +0 -37
  61. package/bin/node_modules/@mariozechner/clipboard/index.js +0 -606
  62. package/bin/node_modules/@mariozechner/clipboard/package.json +0 -56
  63. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +0 -307
  64. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +0 -93
  65. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +0 -313
  66. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +0 -471
  67. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +0 -252
  68. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +0 -431
  69. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +0 -712
  70. package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +0 -916
  71. package/bin/node_modules/@mariozechner/clipboard/src/lib.rs +0 -194
@@ -5,10 +5,10 @@ Sessions are stored as JSONL (JSON Lines) files. Each line is a JSON object with
5
5
  ## File Location
6
6
 
7
7
  ```
8
- ~/.pi/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
8
+ ~/.pi/agent/sessions/--<path>--/<timestamp>_<session-id>.jsonl
9
9
  ```
10
10
 
11
- Where `<path>` is the working directory with `/` replaced by `-`.
11
+ By default, `<session-id>` is a UUID. Callers can supply a custom ID through the SDK or `--session-id`. For `<path>`, Pi removes the leading path separator and replaces `/`, `\\`, and `:` with `-`.
12
12
 
13
13
  ## Deleting Sessions
14
14
 
@@ -28,11 +28,11 @@ Existing sessions are automatically migrated to the current version (v3) when lo
28
28
 
29
29
  ## Source Files
30
30
 
31
- Source on GitHub ([pi-mono](https://github.com/earendil-works/pi-mono)):
32
- - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
33
- - [`packages/coding-agent/src/core/messages.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
34
- - [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
35
- - [`packages/agent/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/agent/src/types.ts) - AgentMessage union type
31
+ Source on GitHub ([pi](https://github.com/earendil-works/pi)):
32
+ - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
33
+ - [`packages/coding-agent/src/core/messages.ts`](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
34
+ - [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
35
+ - [`packages/agent/src/types.ts`](https://github.com/earendil-works/pi/blob/main/packages/agent/src/types.ts) - AgentMessage union type
36
36
 
37
37
  For TypeScript definitions in your project, inspect `node_modules/@earendil-works/pi-coding-agent/dist/` and `node_modules/@earendil-works/pi-ai/dist/`.
38
38
 
@@ -48,6 +48,7 @@ Messages contain arrays of typed content blocks:
48
48
  interface TextContent {
49
49
  type: "text";
50
50
  text: string;
51
+ textSignature?: string;
51
52
  }
52
53
 
53
54
  interface ImageContent {
@@ -59,6 +60,8 @@ interface ImageContent {
59
60
  interface ThinkingContent {
60
61
  type: "thinking";
61
62
  thinking: string;
63
+ thinkingSignature?: string;
64
+ redacted?: boolean;
62
65
  }
63
66
 
64
67
  interface ToolCall {
@@ -66,12 +69,22 @@ interface ToolCall {
66
69
  id: string;
67
70
  name: string;
68
71
  arguments: Record<string, any>;
72
+ thoughtSignature?: string;
73
+ namespace?: string;
69
74
  }
70
75
  ```
71
76
 
72
77
  ### Base Message Types (from pi-ai)
73
78
 
74
79
  ```typescript
80
+ interface SystemMessage {
81
+ role: "system";
82
+ content: string | TextContent[];
83
+ toolsAdded?: Tool[];
84
+ toolsRemoved?: Array<{ name: string }>;
85
+ timestamp: number; // Unix ms
86
+ }
87
+
75
88
  interface UserMessage {
76
89
  role: "user";
77
90
  content: string | (TextContent | ImageContent)[];
@@ -84,9 +97,16 @@ interface AssistantMessage {
84
97
  api: string;
85
98
  provider: string;
86
99
  model: string;
100
+ responseModel?: string;
101
+ responseId?: string;
102
+ providerThinkingLevel?: string;
103
+ diagnostics?: AssistantMessageDiagnostic[];
87
104
  usage: Usage;
88
- stopReason: "stop" | "length" | "toolUse" | "error" | "aborted";
105
+ stopReason: "pending" | "stop" | "length" | "toolUse" | "error" | "aborted" | "deferred";
106
+ deferred?: DeferredHandle;
89
107
  errorMessage?: string;
108
+ rawStopReason?: string;
109
+ endTurn?: boolean;
90
110
  timestamp: number;
91
111
  }
92
112
 
@@ -106,6 +126,8 @@ interface Usage {
106
126
  output: number;
107
127
  cacheRead: number;
108
128
  cacheWrite: number;
129
+ cacheWrite1h?: number;
130
+ reasoning?: number;
109
131
  totalTokens: number;
110
132
  cost: {
111
133
  input: number;
@@ -117,7 +139,7 @@ interface Usage {
117
139
  }
118
140
  ```
119
141
 
120
- The exported pi-ai `StopReason` type also includes `"pending"`, but that value is reserved for partial messages in streaming events. Terminal `done`/`error` messages replace it with a completion reason before pi persists the assistant message, so `"pending"` should never appear in session JSONL.
142
+ `"pending"` is reserved for partial messages in streaming events. Terminal events replace it with a completion reason before Pi persists the assistant message, so `"pending"` should never appear in session JSONL. `"deferred"` is a terminal reason for a provider response that will complete later; its `deferred` handle contains the provider data needed to retrieve that response.
121
143
 
122
144
  ### Extended Message Types (from pi-coding-agent)
123
145
 
@@ -146,7 +168,7 @@ interface CustomMessage {
146
168
  interface BranchSummaryMessage {
147
169
  role: "branchSummary";
148
170
  summary: string;
149
- fromId: string; // Entry we branched from
171
+ fromId: string | null; // Previous leaf whose abandoned path was summarized
150
172
  timestamp: number;
151
173
  }
152
174
 
@@ -162,6 +184,7 @@ interface CompactionSummaryMessage {
162
184
 
163
185
  ```typescript
164
186
  type AgentMessage =
187
+ | SystemMessage
165
188
  | UserMessage
166
189
  | AssistantMessage
167
190
  | ToolResultMessage
@@ -178,8 +201,8 @@ All entries (except `SessionHeader`) extend `SessionEntryBase`:
178
201
  ```typescript
179
202
  interface SessionEntryBase {
180
203
  type: string;
181
- id: string; // 8-char hex ID
182
- parentId: string | null; // Parent entry ID (null for first entry)
204
+ id: string; // Usually an 8-char hex ID; may fall back to a full UUID
205
+ parentId: string | null; // Parent entry ID (null for a root entry)
183
206
  timestamp: string; // ISO timestamp
184
207
  }
185
208
  ```
@@ -202,12 +225,19 @@ For sessions with a parent (created via `/fork`, `/clone`, or `newSession({ pare
202
225
 
203
226
  ### SessionMessageEntry
204
227
 
205
- A message in the conversation. The `message` field contains an `AgentMessage`.
228
+ A message in the conversation. The `message` field contains an `AgentMessage`. System messages carry the prompt and tool loadout: the first request of a session persists one with every prompt section and tool declaration, and later changes persist as system messages that patch `sections` by name (`null` removes one) and list `toolsAdded`/`toolsRemoved`. Replaying them in order yields the current prompt and tools; there is no separate prompt state entry.
229
+
230
+ ```json
231
+ {"type":"message","id":"a0b1c2d3","parentId":null,"timestamp":"2024-12-03T14:00:00.000Z","message":{"role":"system","content":"","sections":{"preamble":"You are an expert coding assistant...","tools":"<tools>\n- read: ...\n</tools>","cwd":"/project"},"toolsAdded":[{"name":"read","description":"...","parameters":{}}],"timestamp":1733234400000}}
232
+ {"type":"message","id":"d4e5f6g7","parentId":"c3d4e5f6","timestamp":"2024-12-03T14:04:00.000Z","message":{"role":"system","content":"","sections":{"skills":"<skills>...</skills>"},"toolsRemoved":[{"name":"write"}],"timestamp":1733234640000}}
233
+ ```
234
+
235
+ Sessions created before system messages existed have no leading system message; the first request declares the current prompt as a later system message, which replays the same way.
206
236
 
207
237
  ```json
208
- {"type":"message","id":"a1b2c3d4","parentId":"prev1234","timestamp":"2024-12-03T14:00:01.000Z","message":{"role":"user","content":"Hello"}}
209
- {"type":"message","id":"b2c3d4e5","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:00:02.000Z","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}],"provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop"}}
210
- {"type":"message","id":"c3d4e5f6","parentId":"b2c3d4e5","timestamp":"2024-12-03T14:00:03.000Z","message":{"role":"toolResult","toolCallId":"call_123","toolName":"bash","content":[{"type":"text","text":"output"}],"isError":false}}
238
+ {"type":"message","id":"a1b2c3d4","parentId":"prev1234","timestamp":"2024-12-03T14:00:01.000Z","message":{"role":"user","content":"Hello","timestamp":1733234401000}}
239
+ {"type":"message","id":"b2c3d4e5","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:00:02.000Z","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}],"api":"anthropic-messages","provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop","timestamp":1733234402000}}
240
+ {"type":"message","id":"c3d4e5f6","parentId":"b2c3d4e5","timestamp":"2024-12-03T14:00:03.000Z","message":{"role":"toolResult","toolCallId":"call_123","toolName":"bash","content":[{"type":"text","text":"output"}],"isError":false,"timestamp":1733234403000}}
211
241
  ```
212
242
 
213
243
  ### ModelChangeEntry
@@ -226,26 +256,31 @@ Emitted when the user changes the thinking/reasoning level.
226
256
  {"type":"thinking_level_change","id":"e5f6g7h8","parentId":"d4e5f6g7","timestamp":"2024-12-03T14:06:00.000Z","thinkingLevel":"high"}
227
257
  ```
228
258
 
229
- ### CompactionEntry
259
+ ### UsageEntry
230
260
 
231
- Created when context is compacted. Stores a summary of earlier messages.
261
+ Records model-attributed usage that is not an assistant message and does not participate in LLM context. `kind` is an arbitrary string identifying the operation; for example, cache warming uses `"cache_warm"`.
232
262
 
233
263
  ```json
234
- {"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","firstKeptEntryId":"c3d4e5f6","tokensBefore":50000}
264
+ {"type":"usage","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:08:00.000Z","kind":"cache_warm","provider":"anthropic","model":"claude-sonnet-4-5","usage":{"input":0,"output":0,"cacheRead":50000,"cacheWrite":0,"totalTokens":50000,"cost":{"input":0,"output":0,"cacheRead":0.015,"cacheWrite":0,"total":0.015}}}
235
265
  ```
236
266
 
237
- Newer harness-generated compactions embed the retained post-compaction context directly on the entry, instead of `firstKeptEntryId`:
267
+ Usage entries contribute to session token and cost totals. Pi hides them from the conversation tree. Consumers should treat unknown `kind` values as normal usage rather than rejecting them.
268
+
269
+ ### CompactionEntry
270
+
271
+ Created when context is compacted. Stores a summary of earlier messages and a complete system prompt/tool checkpoint.
238
272
 
239
273
  ```json
240
- {"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","tokensBefore":50000,"retainedTail":[{"role":"user","content":"latest request"},{"role":"assistant","content":[{"type":"text","text":"latest reply"}],"provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop"}]}
274
+ {"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","firstKeptEntryId":"c3d4e5f6","tokensBefore":50000,"systemMessage":{"role":"system","content":"You are a coding assistant.","toolsAdded":[],"timestamp":1733235000000}}
241
275
  ```
242
276
 
277
+ `firstKeptEntryId` is required. It identifies the first entry retained from before the compaction entry. When rebuilding context, Pi replaces older summarized entries with the compaction summary and keeps the range beginning at this entry.
278
+
243
279
  Optional fields:
280
+ - `systemMessage`: The replayed prompt sections and tool declarations at the compaction boundary; it becomes the leading system message of the compacted context, and system messages among the kept entries are dropped in its favor. It is absent on older session entries.
244
281
  - `usage`: LLM usage from generating the summary; included in session token and cost totals
245
- - `retainedTail`: Materialized `AgentMessage[]` kept after compaction. This is optional only for backward compatibility with older sessions. Newer harness-generated compactions include it so we can rebuild context from this checkpoint without walking older entries before the compaction entry.
246
282
  - `details`: Implementation-specific data (e.g., `{ readFiles: string[], modifiedFiles: string[] }` for default, or custom data for extensions)
247
283
  - `fromHook`: `true` if generated by an extension, `false`/`undefined` if pi-generated (legacy field name)
248
- - `firstKeptEntryId`: for compatibility with old entry format.
249
284
 
250
285
  ### BranchSummaryEntry
251
286
 
@@ -255,6 +290,8 @@ Created when switching branches via `/tree` with an LLM generated summary of the
255
290
  {"type":"branch_summary","id":"g7h8i9j0","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:15:00.000Z","fromId":"f6g7h8i9","summary":"Branch explored approach A..."}
256
291
  ```
257
292
 
293
+ `parentId` is the entry from which the new branch continues. `fromId` is the previous leaf whose abandoned path was summarized.
294
+
258
295
  Optional fields:
259
296
  - `usage`: LLM usage from generating the summary; included in session token and cost totals
260
297
  - `details`: File tracking data (`{ readFiles: string[], modifiedFiles: string[] }`) for default, or custom data for extensions
@@ -305,11 +342,12 @@ The session name is displayed in the session selector (`/resume`) instead of the
305
342
 
306
343
  ## Tree Structure
307
344
 
308
- Entries form a tree:
309
- - First entry has `parentId: null`
310
- - Each subsequent entry points to its parent via `parentId`
345
+ Entries normally form one tree, but navigation APIs can create multiple roots:
346
+ - A root entry has `parentId: null`; the first entry is initially the root
347
+ - Each non-root entry points to its parent via `parentId`
311
348
  - Branching creates new children from an earlier entry
312
349
  - The "leaf" is the current position in the tree
350
+ - Calling `resetLeaf()` or `branchWithSummary(null, ...)` allows a later entry to become another root
313
351
 
314
352
  ```
315
353
  [user msg] ─── [assistant] ─── [user msg] ─── [assistant] ─┬─ [user msg] ← current leaf
@@ -322,11 +360,10 @@ Entries form a tree:
322
360
  `buildContextEntries()` walks from the current leaf to the root, producing the active entry list while honoring compaction:
323
361
 
324
362
  1. Collects all entries on the path
325
- 2. If a `CompactionEntry` is on the path:
363
+ 2. If one or more `CompactionEntry` values are on the path, uses the latest one:
326
364
  - Includes the compaction entry first
327
- - If `retainedTail` is present, it acts as a self-contained checkpoint and entries after the compaction are included
328
- - Otherwise entries from `firstKeptEntryId` to the compaction are included
329
- - Then entries after compaction are included
365
+ - Includes non-system entries from `firstKeptEntryId` up to, but not including, the compaction entry
366
+ - Includes entries after the compaction entry
330
367
  3. Preserves non-message entries in the selected range so interactive mode can render them
331
368
 
332
369
  `buildSessionContext()` builds on that entry list to produce the message list for the LLM:
@@ -334,12 +371,12 @@ Entries form a tree:
334
371
  1. Extracts current model and thinking level settings from the full path
335
372
  2. Converts selected entries to messages:
336
373
  - `message` -> stored `AgentMessage`
337
- - `compaction` -> `compactionSummary` plus `retainedTail` when present
374
+ - `compaction` -> complete system checkpoint followed by `compactionSummary`
338
375
  - `branch_summary` -> `branchSummary`
339
376
  - `custom_message` -> `CustomMessage`
340
- - `custom` -> no context message
377
+ - `usage` and `custom` -> no context message
341
378
 
342
- This makes newer compactions act like self-contained checkpoints. `retainedTail` is optional only so older sessions that only store `firstKeptEntryId` continue to load correctly.
379
+ The compaction summary replaces entries before `firstKeptEntryId`. Pre-compaction system messages are folded into the complete checkpoint rather than replayed from the retained range. Retained non-system entries and all entries after the compaction remain available to the LLM.
343
380
 
344
381
  ## Parsing Example
345
382
 
@@ -364,6 +401,9 @@ for (const line of lines) {
364
401
  case "branch_summary":
365
402
  console.log(`[${entry.id}] Branch from ${entry.fromId}`);
366
403
  break;
404
+ case "usage":
405
+ console.log(`[${entry.id}] Usage (${entry.kind}): ${entry.usage.totalTokens} tokens`);
406
+ break;
367
407
  case "custom":
368
408
  console.log(`[${entry.id}] Custom (${entry.customType}): ${JSON.stringify(entry.data)}`);
369
409
  break;
@@ -388,18 +428,19 @@ for (const line of lines) {
388
428
  Key methods for working with sessions programmatically.
389
429
 
390
430
  ### Static Creation Methods
391
- - `SessionManager.create(cwd, sessionDir?)` - New session
392
- - `SessionManager.open(path, sessionDir?)` - Open existing session file
431
+ - `SessionManager.create(cwd, sessionDir?, options?)` - New session; `options` can set `id` and `parentSession`
432
+ - `SessionManager.open(path, sessionDir?, cwdOverride?)` - Open existing session file
393
433
  - `SessionManager.continueRecent(cwd, sessionDir?)` - Continue most recent or create new
394
- - `SessionManager.inMemory(cwd?)` - No file persistence
395
- - `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?)` - Fork session from another project
434
+ - `SessionManager.inMemory(cwd?, options?, entries?)` - No file persistence, optionally initialized from entries
435
+ - `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?, options?)` - Fork session from another project
396
436
 
397
437
  ### Static Listing Methods
398
438
  - `SessionManager.list(cwd, sessionDir?, onProgress?)` - List sessions for a directory
399
439
  - `SessionManager.listAll(onProgress?)` - List all sessions across all projects
440
+ - `SessionManager.listAll(sessionDir?, onProgress?)` - List sessions from a custom session root
400
441
 
401
442
  ### Instance Methods - Session Management
402
- - `newSession(options?)` - Start a new session (options: `{ parentSession?: string }`)
443
+ - `newSession(options?)` - Start a new session (options: `{ id?: string, parentSession?: string }`)
403
444
  - `setSessionFile(path)` - Switch to a different session file
404
445
  - `createBranchedSession(leafId)` - Extract branch to new session file
405
446
 
@@ -407,7 +448,8 @@ Key methods for working with sessions programmatically.
407
448
  - `appendMessage(message)` - Add message
408
449
  - `appendThinkingLevelChange(level)` - Record thinking change
409
450
  - `appendModelChange(provider, modelId)` - Record model change
410
- - `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?, fromHook?)` - Add compaction
451
+ - `appendUsage(kind, provider, model, usage)` - Record model-attributed usage outside the conversation
452
+ - `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?, fromHook?, usage?)` - Add compaction
411
453
  - `appendCustomEntry(customType, data?)` - Extension state (not in context)
412
454
  - `appendSessionInfo(name)` - Set session display name
413
455
  - `appendCustomMessageEntry(customType, content, display, details?)` - Extension message (in context)
@@ -423,7 +465,7 @@ Key methods for working with sessions programmatically.
423
465
  - `getLabel(id)` - Get label for entry
424
466
  - `branch(entryId)` - Move leaf to earlier entry
425
467
  - `resetLeaf()` - Reset leaf to null (before any entries)
426
- - `branchWithSummary(entryId, summary, details?, fromHook?)` - Branch with context summary
468
+ - `branchWithSummary(entryId, summary, details?, fromHook?, usage?)` - Branch with context summary; `entryId` may be `null` to branch from the root
427
469
 
428
470
  ### Instance Methods - Context & Info
429
471
  - `buildContextEntries()` - Get active branch entries with compaction applied
@@ -33,6 +33,7 @@ For the JSONL file format and SessionManager API, see [Session Format](session-f
33
33
  | `/compact [prompt]` | Summarize older context; see [Compaction](compaction.md) |
34
34
  | `/export [file]` | Export session to HTML |
35
35
  | `/share` | Upload as private GitHub gist with shareable HTML link |
36
+ | `/bug [description]` | Report a bug to the Pi developers; see [Reporting Bugs](#reporting-bugs) |
36
37
 
37
38
  ## Resuming and Deleting Sessions
38
39
 
@@ -138,6 +139,32 @@ When prompted, choose one of:
138
139
 
139
140
  See [Compaction](compaction.md) for branch summarization internals and extension hooks.
140
141
 
142
+ ## Reporting Bugs
143
+
144
+ `/bug [description]` collects a bug report for the Pi developers. The report is not shared publicly. The dialog asks for an optional description and whether to include the session transcript. If you decline the transcript, pi offers to have the current model write a summary of what went wrong instead; the transcript is sent to your provider with your credentials, and only the summary is attached.
145
+
146
+ The last step chooses where the report goes:
147
+
148
+ - **Upload Report** sends it to the Pi developers through `radius.pi.dev`. No login is required; if you are logged into Radius, the report is attributed to your account so the developers can follow up. If the upload fails, pi offers to export the zip instead.
149
+ - **Export as Zip** writes a zip archive to the current directory. Attach it to an issue or send it to the developers yourself.
150
+
151
+ Both contain the same files:
152
+
153
+ | File | Content |
154
+ |------|---------|
155
+ | `report.json` | pi version, runtime, OS, terminal, current model and provider configuration, loaded extensions, and settings. API keys, header values, URL credentials, and the analytics tracking id are never included. |
156
+ | `diagnostics.json` | Provider and runtime error diagnostics attached to assistant messages across the whole session (failed or aborted turns, retries, error messages), plus any recorded crashes. Always included; message content is not. |
157
+ | `session.jsonl` | The current branch of the session, only when you chose to include it. It contains file contents and command output read during the session. |
158
+ | `summary.md` | The model-written summary, only when you chose to generate one. |
159
+
160
+ Each report has a UUID. pi shows it after upload or export and records it in the session as a `pi.bug-report` entry so you can refer to it later.
161
+
162
+ Set `PI_RADIUS_GATEWAY` to upload to a different Radius deployment.
163
+
164
+ ### Crashes
165
+
166
+ When pi exits because of an uncaught exception or a fatal runtime error, it stores the error message and stack trace in `~/.pi/agent/crashes.json` (the newest five). The next interactive start shows a warning once; running `/bug` attaches the stored crashes to `diagnostics.json` and removes the file after the report is uploaded or exported. Resume the crashed session with `pi -r` first if you want the transcript in the report.
167
+
141
168
  ## Session Format
142
169
 
143
170
  Session files are JSONL and contain message entries, model changes, thinking-level changes, labels, compactions, branch summaries, and extension entries.
@@ -32,8 +32,31 @@ Use `/trust` in interactive mode to save a project trust decision for future ses
32
32
  | `defaultThinkingLevel` | string | - | Startup thinking level (saved with Ctrl+S in `/thinking`, or edited manually): `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"` |
33
33
  | `modelThinkingLevels` | object | - | Per-model startup thinking levels keyed by `"provider/modelId"`; configure from `/settings` → Default thinking level per model or edit manually |
34
34
  | `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
35
- | `showCacheMissNotices` | boolean | `false` | Show transcript notices for significant prompt-cache misses and compaction or branch-summary usage |
35
+ | `showCacheMissNotices` | boolean | `false` | Show transcript notices for significant prompt-cache misses, successful cache-warming usage, compaction or branch-summary usage, and provider recovery diagnostics such as dropped Anthropic thinking blocks |
36
36
  | `thinkingBudgets` | object | - | Custom token budgets per thinking level. Anthropic, Google, and Bedrock use these natively. OpenAI-compatible models use them when `compat.thinkingTokenBudgetField` (or `supportsThinkingTokenBudget`) is set. |
37
+ | `cacheWarming` | string | `"streaming"` | Prompt cache-warming mode: `"off"`, `"streaming"`, or `"idle"`. Global setting only. |
38
+
39
+ #### Cache Warming
40
+
41
+ Providers drop a prompt cache entry after a period of inactivity, so the first request after a pause pays full input price again. Cache warming re-sends the last request with a one-token output budget shortly before expiry:
42
+
43
+ - `"off"` disables warming.
44
+ - `"streaming"` protects expensive prefixes during long tool executions and stops as soon as the agent settles.
45
+ - `"idle"` also considers refreshes while waiting for your next prompt, using a fixed 15% continuation probability measured from real usage.
46
+
47
+ ```json
48
+ {
49
+ "cacheWarming": "idle"
50
+ }
51
+ ```
52
+
53
+ A refresh is sent only when the expected avoided cache-miss cost, minus the cost of the refresh, leaves at least $0.05 of expected savings. Active agent runs use 100% continuation probability. `/session` shows the next decision, continuation probability, expected savings, threshold, and estimated costs. When cache miss notices are enabled, each successful refresh appears in the transcript with its cost; notices identify extension overrides.
54
+
55
+ Warming stops when the context changes (model switch, compaction, branch navigation). Idle warming stops no later than 30 minutes after the last real provider request; warming during an active agent run stops after 60 minutes. Extensions can override each decision through the [`cache_warming_decision`](extensions.md#cache_warming_decision) event.
56
+
57
+ Each refresh is billed as a cache read of the full context plus one output token. Usage and cost show up in session totals but never enter model context. Pi schedules candidates at 90% of the cache lifetime while leaving at least ten seconds before expiry.
58
+
59
+ Warming needs a known cache lifetime for the model and the retention tier the request used (`short`, or `long` with `PI_CACHE_RETENTION=long`). The built-in catalog carries lifetimes for direct Anthropic; custom models and other providers can declare theirs with `promptCache` in `models.json` (see [Prompt Cache Lifetimes](models.md#prompt-cache-lifetimes)). Claude models that use budget-based rather than adaptive thinking are skipped while thinking is on, because Anthropic derives the thinking budget from `max_tokens` and keys the message cache on it, so a one-token request cannot reproduce the entry.
37
60
 
38
61
  #### thinkingBudgets
39
62
 
@@ -57,7 +80,7 @@ Use `/trust` in interactive mode to save a project trust decision for future ses
57
80
  | `quietStartup` | boolean | `false` | Hide startup header |
58
81
  | `defaultProjectTrust` | string | `"ask"` | Fallback project trust behavior: `"ask"`, `"always"`, or `"never"`. Global setting only |
59
82
  | `collapseChangelog` | boolean | `false` | Show condensed changelog after updates |
60
- | `enableInstallTelemetry` | boolean | `true` | Send an anonymous install/update version ping after first install or changelog-detected updates. This does not control update checks |
83
+ | `enableInstallTelemetry` | boolean | `true` | Send the anonymous install/update ping and selected provider attribution headers. This does not control update checks |
61
84
  | `enableAnalytics` | boolean | `false` | Opt-in analytics data sharing. Currently only asked for during the experimental first-time setup (`PI_EXPERIMENTAL=1`) |
62
85
  | `trackingId` | string | - | Analytics tracking identifier, generated when `enableAnalytics` is turned on |
63
86
  | `doubleEscapeAction` | string | `"tree"` | Action for double-escape: `"tree"`, `"fork"`, or `"none"` |
@@ -68,7 +91,7 @@ Use `/trust` in interactive mode to save a project trust decision for future ses
68
91
  | `showHardwareCursor` | boolean | `false` | Show the terminal cursor while TUI positions it for IME support |
69
92
  | `tuiMode` | string | `"regular"` | Interactive TUI mode: `"regular"` or experimental `"fullscreen"`. Changes from `/settings` apply immediately; `--tui-mode` overrides this setting at startup |
70
93
  | `fullscreenExitOutput` | string | `"transcript"` | Fullscreen exit output: `"transcript"` prints the final transcript and resume hint, while `"resume-hint"` restores the previous screen and prints only the resume hint. Has no effect in regular TUI mode |
71
- | `fullscreenScrollbar` | string | `"auto"` | Fullscreen transcript scrollbar: `"auto"` shows it temporarily while scrolling, `"always"` reserves the rightmost column and keeps it visible, and `"hidden"` hides it. Has no effect in regular TUI mode |
94
+ | `fullscreenScrollbar` | string | `"auto"` | Fullscreen transcript scrollbar: `"auto"` shows it temporarily while scrolling or while the pointer is over its rightmost-column track, `"always"` reserves that column and keeps it visible, and `"hidden"` hides it. Has no effect in regular TUI mode |
72
95
  | `fullscreenCopyOnSelect` | boolean | `true` | Automatically copy selected text in fullscreen mode. When disabled, selections stay highlighted and `Ctrl+X` copies the active selection |
73
96
 
74
97
  For VS Code, include `--wait` so pi resumes after the editor exits:
@@ -81,7 +104,7 @@ For VS Code, include `--wait` so pi resumes after the editor exits:
81
104
 
82
105
  ### Telemetry and update checks
83
106
 
84
- `enableInstallTelemetry` only controls the anonymous install/update ping to `https://pi.dev/api/report-install`. Opting out of telemetry does not disable update checks; Pi can still fetch `https://pi.dev/api/latest-version` to look for the latest version.
107
+ `enableInstallTelemetry` controls the anonymous install/update ping to `https://pi.dev/api/report-install` and Pi attribution headers for OpenRouter, NVIDIA NIM, and Cloudflare provider requests. Opting out disables both. It does not disable update checks; Pi can still fetch `https://pi.dev/api/latest-version` to look for the latest version.
85
108
 
86
109
  Set `PI_SKIP_VERSION_CHECK=1` to disable the Pi version update check. Use `--offline` or `PI_OFFLINE=1` to disable all startup network operations described here, including update checks, package update checks, and install/update telemetry.
87
110
 
@@ -118,6 +141,7 @@ Set `PI_SKIP_VERSION_CHECK=1` to disable the Pi version update check. Use `--off
118
141
  | `compaction.enabled` | boolean | `true` | Enable auto-compaction |
119
142
  | `compaction.reserveTokens` | number | `16384` | Tokens reserved for LLM response |
120
143
  | `compaction.keepRecentTokens` | number | `20000` | Recent tokens to keep (not summarized) |
144
+ | `compaction.modelOverrides` | object | - | Per-model `reserveTokens` and `keepRecentTokens` overrides keyed by exact `"provider/modelId"` |
121
145
 
122
146
  ```json
123
147
  {
@@ -129,11 +153,42 @@ Set `PI_SKIP_VERSION_CHECK=1` to disable the Pi version update check. Use `--off
129
153
  }
130
154
  ```
131
155
 
156
+ #### Per-model compaction overrides
157
+
158
+ ```json
159
+ {
160
+ "compaction": {
161
+ "enabled": true,
162
+ "reserveTokens": 16384,
163
+ "keepRecentTokens": 20000,
164
+ "modelOverrides": {
165
+ "some-provider/big-model": {
166
+ "reserveTokens": 400000
167
+ },
168
+ "local/small-model": {
169
+ "reserveTokens": 2048,
170
+ "keepRecentTokens": 4096
171
+ }
172
+ }
173
+ }
174
+ }
175
+ ```
176
+
177
+ Keys match exact, case-sensitive `provider/modelId` values, not names or glob patterns. Model IDs may contain slashes (for example, `openrouter/anthropic/claude-sonnet-4`).
178
+
179
+ Each token setting resolves independently: matching model override → ordinary `compaction` setting → built-in default. In the example, `some-provider/big-model` keeps the ordinary 20000 recent tokens. Token values must be non-negative safe integers. Invalid values in the matching model override produce an error when read; only omitted fields fall back to the ordinary setting. Model override entries must be objects. Invalid ordinary token settings produce an error when read, even if the active model has a valid override. Only omitted ordinary values use built-in defaults. Zero is accepted, but `reserveTokens: 0` leaves no response margin and also sets the summarization output budget to zero.
180
+
181
+ Global and project settings merge recursively **before** model lookup. A project can override one field for a model without replacing its other fields or other models. A global model-specific value takes precedence over a project-wide fallback; override the same model entry in the project to change it.
182
+
183
+ `enabled` is not model-specific. The active model's token settings apply to manual compaction, automatic threshold checks (including between assistant turns), and overflow recovery. Switching models takes effect on the next check or compaction. Configure overrides in JSON; `/settings` retains the ordinary auto-compaction toggle.
184
+
185
+ See [compaction.md](compaction.md) for trigger and summarization behavior.
186
+
132
187
  ### Branch Summary
133
188
 
134
189
  | Setting | Type | Default | Description |
135
190
  |---------|------|---------|-------------|
136
- | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved for branch summarization |
191
+ | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when selecting branch history; output is capped at 4096 tokens |
137
192
  | `branchSummary.skipPrompt` | boolean | `false` | Skip "Summarize branch?" prompt on `/tree` navigation (defaults to no summary) |
138
193
 
139
194
  ### Retry
@@ -66,7 +66,7 @@ For project-level Claude Code skills, add to `.pi/settings.json`:
66
66
 
67
67
  1. At startup, pi scans skill locations and extracts names and descriptions
68
68
  2. The system prompt includes available skills in XML format per the [specification](https://agentskills.io/integrate-skills)
69
- 3. When a task matches, the agent uses `read` to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
69
+ 3. When a task matches, the agent uses `read`, or `bash` when `read` is unavailable, to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
70
70
  4. The agent follows the instructions, using relative paths to reference scripts and assets
71
71
 
72
72
  This is progressive disclosure: only descriptions are always in context, full instructions load on-demand.
@@ -130,6 +130,21 @@ Add to `keybindings.json`:
130
130
  }
131
131
  ```
132
132
 
133
+ ## Zed (Integrated Terminal)
134
+
135
+ Add these key bindings to your Zed `keymap.json`:
136
+
137
+ ```json
138
+ {
139
+ "context": "Terminal",
140
+ "bindings": {
141
+ "shift-enter": ["terminal::SendText", "\u001b[13;2u"],
142
+ "ctrl--": ["terminal::SendText", "\u001b[45;5u"],
143
+ "ctrl-alt-]": ["terminal::SendText", "\u001b[93;7u"]
144
+ }
145
+ }
146
+ ```
147
+
133
148
  ## Windows Terminal
134
149
 
135
150
  Pi uses Windows-style keybindings when running natively on Windows or in WSL:
@@ -96,7 +96,6 @@ termux-camera-photo out.jpg # Take photo
96
96
  ## Limitations
97
97
 
98
98
  - **No image clipboard**: Termux clipboard API only supports text
99
- - **No native binaries**: Some optional native dependencies (like the clipboard module) are unavailable on Android ARM64 and are skipped during installation
100
99
  - **Storage access**: To access files in `/storage/emulated/0` (Downloads, etc.), run `termux-setup-storage` once to grant permissions
101
100
 
102
101
  ## Troubleshooting
@@ -88,7 +88,8 @@ vim ~/.pi/agent/themes/my-theme.json
88
88
  "text": "",
89
89
  "thinkingText": "secondary",
90
90
  "selectedBg": "#2d2d30",
91
- "scrollbarThumb": "#555566",
91
+ "scrollbarTrack": "secondary",
92
+ "scrollbarThumb": "",
92
93
  "searchMatchBg": "#2d2d30",
93
94
  "searchMatchText": "",
94
95
  "userMessageBg": "#2d2d30",
@@ -160,15 +161,15 @@ vim ~/.pi/agent/themes/my-theme.json
160
161
 
161
162
  - `name` is required, must be unique, and must not contain `/`.
162
163
  - `vars` is optional. Define reusable colors here, then reference them in `colors`.
163
- - `colors` must define all 51 required tokens. `thinkingMax`, `scrollbarThumb`, and the two search highlight tokens are optional and use the fallbacks listed below.
164
+ - `colors` must define all 53 required tokens. `thinkingMax` and the two search highlight tokens are optional and use the fallbacks listed below.
164
165
 
165
166
  The `$schema` field enables editor auto-completion and validation.
166
167
 
167
168
  ## Color Tokens
168
169
 
169
- Every theme must define all 51 required color tokens. The optional tokens preserve compatibility with existing themes: `thinkingMax` falls back to `thinkingXhigh`, `scrollbarThumb` and `searchMatchBg` fall back to `selectedBg`, and `searchMatchText` falls back to `text`. Other search matches use `searchMatchText` on `searchMatchBg` with an underline; the current match reverses that foreground/background pair and uses bold text.
170
+ Every theme must define all 53 required color tokens. The optional tokens preserve compatibility with existing themes: `thinkingMax` falls back to `thinkingXhigh`, `searchMatchBg` falls back to `selectedBg`, and `searchMatchText` falls back to `text`. Other search matches use `searchMatchText` on `searchMatchBg` with an underline; the current match reverses that foreground/background pair and uses bold text.
170
171
 
171
- ### Core UI (11 colors)
172
+ ### Core UI (13 colors)
172
173
 
173
174
  | Token | Purpose |
174
175
  |-------|---------|
@@ -183,13 +184,14 @@ Every theme must define all 51 required color tokens. The optional tokens preser
183
184
  | `dim` | Tertiary text |
184
185
  | `text` | Default text (usually `""`) |
185
186
  | `thinkingText` | Thinking block text |
187
+ | `scrollbarTrack` | Fullscreen scrollbar track foreground |
188
+ | `scrollbarThumb` | Fullscreen scrollbar thumb foreground, shared by normal and expanded states |
186
189
 
187
- ### Backgrounds & Content (11 required, 3 optional)
190
+ ### Backgrounds & Content (11 required, 2 optional)
188
191
 
189
192
  | Token | Purpose |
190
193
  |-------|---------|
191
194
  | `selectedBg` | Selected line background |
192
- | `scrollbarThumb` | Fullscreen scrollbar thumb background; optional, falls back to `selectedBg` |
193
195
  | `searchMatchBg` | Transcript search match background and current-match text; optional, falls back to `selectedBg` |
194
196
  | `searchMatchText` | Transcript search match text and current-match background; optional, falls back to `text` |
195
197
  | `userMessageBg` | User message background |
package/bin/docs/tui.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
6
6
 
7
- **Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi-mono/tree/main/packages/tui)
7
+ **Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi/tree/main/packages/tui)
8
8
 
9
9
  ## Component Interface
10
10
 
@@ -14,6 +14,7 @@ All components implement:
14
14
  interface Component {
15
15
  render(width: number): string[];
16
16
  handleInput?(data: string): void;
17
+ handleMouse?(event: TuiMouseEvent): TuiMouseEventResult | undefined;
17
18
  wantsKeyRelease?: boolean;
18
19
  invalidate(): void;
19
20
  }
@@ -23,6 +24,7 @@ interface Component {
23
24
  |--------|-------------|
24
25
  | `render(width)` | Return array of strings (one per line). Each line **must not exceed `width`**. |
25
26
  | `handleInput?(data)` | Receive keyboard input when component has focus. |
27
+ | `handleMouse?(event)` | Receive normalized pointer input in fullscreen mode. |
26
28
  | `wantsKeyRelease?` | If true, component receives key release events (Kitty protocol). Default: false. |
27
29
  | `invalidate()` | Clear cached render state. Called on theme changes. |
28
30
 
@@ -52,7 +54,7 @@ When a `Focusable` component has focus, TUI:
52
54
  3. Positions the hardware terminal cursor at that location
53
55
  4. Shows the hardware cursor only when `showHardwareCursor` is enabled
54
56
 
55
- The cursor remains hidden by default. This keeps the fake cursor rendering, while still positioning the hardware cursor for terminals that track IME candidate windows with hidden cursors. Some terminals require a visible hardware cursor for IME positioning; enable it with `showHardwareCursor`, `setShowHardwareCursor(true)`, or `PI_HARDWARE_CURSOR=1`. The `Editor` and `Input` built-in components already implement this interface.
57
+ The cursor remains hidden by default. This keeps the fake cursor rendering, while still positioning the hardware cursor for terminals that track IME candidate windows with hidden cursors. Some terminals require a visible hardware cursor for IME positioning; enable it with the renderer's `showHardwareCursor` constructor argument or `setShowHardwareCursor(true)`. Pi also maps `PI_HARDWARE_CURSOR=1` to this setting before it creates its renderer. The `Editor` and `Input` built-in components already implement this interface.
56
58
 
57
59
  ### Container Components with Embedded Inputs
58
60
 
@@ -307,6 +309,22 @@ handleInput(data: string) {
307
309
  - With modifiers: `Key.ctrl("c")`, `Key.shift("tab")`, `Key.alt("left")`, `Key.ctrlShift("p")`
308
310
  - String format also works: `"enter"`, `"ctrl+c"`, `"shift+tab"`, `"ctrl+shift+p"`
309
311
 
312
+ ## Mouse Input
313
+
314
+ Fullscreen mode routes normalized press, release, click, move, drag, and wheel events to components and overlays. Return `{ handled: true }` to suppress default behavior, `capture: true` to retain drag/release ownership, `focus: true` to request keyboard focus, and `render: true` when a hover or release visibly changes the component. Press, click, drag, and wheel render by default; no-op move/release events do not.
315
+
316
+ ```typescript
317
+ import { MouseRegion } from "@earendil-works/pi-tui";
318
+
319
+ const clickable = new MouseRegion(content, (event) => {
320
+ if (event.type !== "click" || event.button !== "left") return undefined;
321
+ expanded = !expanded;
322
+ return { handled: true };
323
+ });
324
+ ```
325
+
326
+ Unhandled wheel input scrolls the nearest `ScrollView`; unhandled primary-button drags retain transcript selection. OSC 8 links take precedence over parent click regions. `Input`, `Editor`, `SelectList`, and `SettingsList` include fullscreen mouse behavior. Regular mode does not capture mouse input because the terminal owns its scrollback.
327
+
310
328
  ## Line Width
311
329
 
312
330
  **Critical:** Each line from `render()` must not exceed the `width` parameter.
@@ -912,6 +930,7 @@ export default function (pi: ExtensionAPI) {
912
930
 
913
931
  - **Extend `CustomEditor`** (not base `Editor`) to get app keybindings (escape to abort, ctrl+d to exit, model switching, etc.)
914
932
  - **Call `super.handleInput(data)`** for keys you don't handle
933
+ - **Status spinners**: custom editors keep standalone status rows by default. Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to embed working, compaction, branch summarization, and retry spinners in the editor border instead.
915
934
  - **Factory pattern**: `setEditorComponent` receives a factory function that gets `tui`, `theme`, and `keybindings`
916
935
  - **Pass `undefined`** to restore the default editor: `ctx.ui.setEditorComponent(undefined)`
917
936
 
package/bin/docs/usage.md CHANGED
@@ -55,6 +55,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
55
55
  | `/export [file]` | Export session to HTML or JSONL |
56
56
  | `/import <file>` | Import and resume a session from a JSONL file |
57
57
  | `/share` | Upload as private GitHub gist with shareable HTML link |
58
+ | `/bug [description]` | Report a bug to the Pi developers; see [Sessions](sessions.md#reporting-bugs) |
58
59
  | `/reload` | Reload keybindings, extensions, skills, prompts, themes, and context files |
59
60
  | `/hotkeys` | Show all keyboard shortcuts |
60
61
  | `/changelog` | Display version history |