@earendil-works/pi-coding-agent 0.86.0 → 0.87.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.
Files changed (138) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +37 -0
  3. package/dist/bundle/chunks/{chunk-7YM6BE7Y.js → chunk-4DKZACXI.js} +53 -46
  4. package/dist/bundle/chunks/chunk-GV2E3GBU.js +2 -0
  5. package/dist/bundle/chunks/github-copilot.js +1 -1
  6. package/dist/bundle/chunks/meta.js +2 -0
  7. package/dist/bundle/chunks/{openai-completions-KQPOPEVM.js → openai-completions-XHML6MTL.js} +1 -1
  8. package/dist/bundle/chunks/{virtual-modules-XW5APVUE.js → virtual-modules-BNWPZYDH.js} +1 -1
  9. package/dist/bundle/cli-runtime.js +3 -0
  10. package/dist/bundle/cli.js +4 -2
  11. package/dist/bundle/index.js +1 -1
  12. package/dist/bundle/rpc-entry.js +1 -1
  13. package/dist/cli/args.d.ts.map +1 -1
  14. package/dist/cli/args.js +1 -0
  15. package/dist/cli/args.js.map +1 -1
  16. package/dist/cli/file-processor.d.ts +1 -1
  17. package/dist/cli/file-processor.d.ts.map +1 -1
  18. package/dist/cli/file-processor.js.map +1 -1
  19. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  20. package/dist/core/agent-session-runtime.js +1 -1
  21. package/dist/core/agent-session-runtime.js.map +1 -1
  22. package/dist/core/agent-session.d.ts +27 -3
  23. package/dist/core/agent-session.d.ts.map +1 -1
  24. package/dist/core/agent-session.js +389 -119
  25. package/dist/core/agent-session.js.map +1 -1
  26. package/dist/core/cache-warmer.d.ts +1 -0
  27. package/dist/core/cache-warmer.d.ts.map +1 -1
  28. package/dist/core/cache-warmer.js +15 -1
  29. package/dist/core/cache-warmer.js.map +1 -1
  30. package/dist/core/compaction/compaction.d.ts +3 -1
  31. package/dist/core/compaction/compaction.d.ts.map +1 -1
  32. package/dist/core/compaction/compaction.js +146 -48
  33. package/dist/core/compaction/compaction.js.map +1 -1
  34. package/dist/core/crash-log.d.ts +5 -0
  35. package/dist/core/crash-log.d.ts.map +1 -1
  36. package/dist/core/crash-log.js +68 -0
  37. package/dist/core/crash-log.js.map +1 -1
  38. package/dist/core/export-html/template.js +6 -1
  39. package/dist/core/extensions/index.d.ts +1 -1
  40. package/dist/core/extensions/index.d.ts.map +1 -1
  41. package/dist/core/extensions/index.js.map +1 -1
  42. package/dist/core/extensions/runner.d.ts +16 -3
  43. package/dist/core/extensions/runner.d.ts.map +1 -1
  44. package/dist/core/extensions/runner.js +110 -5
  45. package/dist/core/extensions/runner.js.map +1 -1
  46. package/dist/core/extensions/types.d.ts +77 -6
  47. package/dist/core/extensions/types.d.ts.map +1 -1
  48. package/dist/core/extensions/types.js.map +1 -1
  49. package/dist/core/index.d.ts +1 -1
  50. package/dist/core/index.d.ts.map +1 -1
  51. package/dist/core/index.js.map +1 -1
  52. package/dist/core/model-config.d.ts +52 -0
  53. package/dist/core/model-config.d.ts.map +1 -1
  54. package/dist/core/model-config.js +16 -0
  55. package/dist/core/model-config.js.map +1 -1
  56. package/dist/core/model-resolver.d.ts.map +1 -1
  57. package/dist/core/model-resolver.js +1 -0
  58. package/dist/core/model-resolver.js.map +1 -1
  59. package/dist/core/prompt-templates.d.ts +6 -1
  60. package/dist/core/prompt-templates.d.ts.map +1 -1
  61. package/dist/core/prompt-templates.js +61 -35
  62. package/dist/core/prompt-templates.js.map +1 -1
  63. package/dist/core/provider-composer.d.ts +1 -0
  64. package/dist/core/provider-composer.d.ts.map +1 -1
  65. package/dist/core/provider-composer.js +19 -0
  66. package/dist/core/provider-composer.js.map +1 -1
  67. package/dist/core/resource-loader.d.ts.map +1 -1
  68. package/dist/core/resource-loader.js +6 -2
  69. package/dist/core/resource-loader.js.map +1 -1
  70. package/dist/core/sdk.d.ts.map +1 -1
  71. package/dist/core/sdk.js +3 -4
  72. package/dist/core/sdk.js.map +1 -1
  73. package/dist/core/session-manager.d.ts +36 -9
  74. package/dist/core/session-manager.d.ts.map +1 -1
  75. package/dist/core/session-manager.js +97 -7
  76. package/dist/core/session-manager.js.map +1 -1
  77. package/dist/core/tools/read.d.ts +4 -1
  78. package/dist/core/tools/read.d.ts.map +1 -1
  79. package/dist/core/tools/read.js +5 -1
  80. package/dist/core/tools/read.js.map +1 -1
  81. package/dist/index.d.ts +2 -2
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/main.d.ts.map +1 -1
  86. package/dist/main.js +4 -3
  87. package/dist/main.js.map +1 -1
  88. package/dist/modes/interactive/bug-report.d.ts +2 -0
  89. package/dist/modes/interactive/bug-report.d.ts.map +1 -1
  90. package/dist/modes/interactive/bug-report.js +6 -5
  91. package/dist/modes/interactive/bug-report.js.map +1 -1
  92. package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
  93. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  94. package/dist/modes/interactive/components/extension-editor.js +7 -2
  95. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  96. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  97. package/dist/modes/interactive/components/tree-selector.js +7 -0
  98. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  99. package/dist/modes/interactive/interactive-mode.d.ts +5 -1
  100. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  101. package/dist/modes/interactive/interactive-mode.js +74 -5
  102. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  103. package/dist/utils/clipboard-image.d.ts.map +1 -1
  104. package/dist/utils/clipboard-image.js +1 -12
  105. package/dist/utils/clipboard-image.js.map +1 -1
  106. package/dist/utils/clipboard.d.ts.map +1 -1
  107. package/dist/utils/clipboard.js +74 -20
  108. package/dist/utils/clipboard.js.map +1 -1
  109. package/dist/utils/mime.d.ts.map +1 -1
  110. package/dist/utils/mime.js +1 -1
  111. package/dist/utils/mime.js.map +1 -1
  112. package/dist/utils/tool-result-images.d.ts +3 -1
  113. package/dist/utils/tool-result-images.d.ts.map +1 -1
  114. package/dist/utils/tool-result-images.js +4 -1
  115. package/dist/utils/tool-result-images.js.map +1 -1
  116. package/dist/utils/wsl.d.ts +3 -0
  117. package/dist/utils/wsl.d.ts.map +1 -0
  118. package/dist/utils/wsl.js +15 -0
  119. package/dist/utils/wsl.js.map +1 -0
  120. package/docs/compaction.md +23 -4
  121. package/docs/extensions.md +70 -6
  122. package/docs/models.md +29 -1
  123. package/docs/providers.md +8 -0
  124. package/docs/sdk.md +13 -2
  125. package/docs/session-format.md +15 -2
  126. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  127. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  128. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  129. package/examples/extensions/gondolin/package-lock.json +2 -2
  130. package/examples/extensions/gondolin/package.json +1 -1
  131. package/examples/extensions/sandbox/package-lock.json +2 -2
  132. package/examples/extensions/sandbox/package.json +1 -1
  133. package/examples/extensions/with-deps/package-lock.json +2 -2
  134. package/examples/extensions/with-deps/package.json +1 -1
  135. package/examples/plugins/pi-example-plugin/src/session.ts +3 -2
  136. package/npm-shrinkwrap.json +20 -20
  137. package/package.json +8 -8
  138. package/dist/bundle/chunks/chunk-7IOYH2SY.js +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,65 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.87.0] - 2026-09-21
4
+
5
+ ### New Features
6
+
7
+ - **Canonical session context and extension boundaries** — Edit model context without rewriting history and add actionable lifecycle hooks. See [ContextEditEntry](docs/session-format.md#contexteditentry) and [extension events](docs/extensions.md#extension-events).
8
+ - **Full-transcript context extensions** — Use `context_with_system` for per-request system-message transformations. See [`context_with_system`](docs/extensions.md#context_with_system).
9
+ - **Per-model image input limits** — Configure cache-safe image resizing per model for attachments, `read`, and tool-result images. See [Image Input Limits](docs/models.md#image-input-limits).
10
+
11
+ ### Breaking Changes
12
+
13
+ - Removed the inherited `shouldStopAfterTurn` agent option. Use `finishTurn` and return `{ action: "end" }` instead. `finishTurn` runs before `turn_end` but applies the decision afterward, and it also receives error and aborted responses; migrate normal-response predicates by returning `undefined` for those hard exits. See the `@earendil-works/pi-agent-core` changelog for a complete before-and-after example.
14
+ - Added `ContextEditEntry` to the exported `SessionEntry` union. TypeScript consumers with exhaustive entry switches must handle `context_edit`; use `replacement: null` for omission and a content replacement otherwise.
15
+ - Made `SessionManager` canonical for `AgentSession` provider context. Assigning `session.agent.state.messages` no longer replaces future request history; restore with `SessionManager.inMemory(cwd, { id }, entries)`, navigate with `session.navigateTree()`, or append through `session.sessionManager` and call `session.refreshContext()`.
16
+ - Expanded `TurnEndEvent` with required boundary fields and added `AgentBeforeSettleEvent` to the exported `ExtensionEvent` union. Consumers constructing events or exhaustively switching on `ExtensionEvent` must handle the new shapes. `ExtensionRunner.emit()` no longer accepts `turn_end`; host integrations dispatch actionable boundaries with `emitBoundary(baseEvent, buildContext)`.
17
+ - Deferred runs requested from `agent_settled` handlers until all settled handlers finish. Handlers still observe `ctx.isIdle() === true`, but no longer see a reentrant `agent_start` during the same notification dispatch.
18
+
19
+ ### Added
20
+
21
+ - Added append-only model-context edits. For example, `sessionManager.appendContextEdit(entryId, null)` omits one message from future provider context without changing raw history, usage, or UI history.
22
+ - Added actionable `turn_end` and `agent_before_settle` extension boundaries. Return `{ entries: [...event.entries, draft], continue: true }` to persist structural entries in order and ensure one next provider request without changing steering or follow-up scheduling.
23
+ - Added retain-none compaction input: `sessionManager.appendCompaction(summary, null, tokensBefore)` stores the compaction's own ID as its kept boundary.
24
+ - Added the `context_with_system` extension event, which runs after `context` handlers on the full transcript including system messages and sends its result verbatim. See [`context_with_system`](docs/extensions.md#context_with_system).
25
+ - Added per-model image resize profiles through `inputLimits.images.resize` in `models.json`, applied to file attachments, image reads, and tool-result images ([#9631](https://github.com/earendil-works/pi/issues/9631)).
26
+
27
+ ### Fixed
28
+
29
+ - Fixed string context-edit replacements producing invalid assistant and tool-result message content instead of text blocks.
30
+ - Fixed context-invisible boundary metadata and replacement edits causing newly appended or replaced input to be summarized before its first provider request.
31
+ - Fixed edited-context accounting both discarding valid assistant usage captured after the latest context edit and reusing that usage after a later compaction made it stale.
32
+ - Fixed selected error retries and final length/overflow recovery retaining abandoned model attempts in future provider context; post-run recovery omissions are now persisted without hiding raw transcript history or changing queue scheduling.
33
+ - Fixed `context` handlers that filter or slice messages dropping the prompt and tool declarations, which after extension-driven compaction left requests without built-in tools or made Codex emit raw tool-call text. Handlers no longer see system messages; Pi restores the prompt and tool state after they run. See [`context`](docs/extensions.md#context) ([#9789](https://github.com/earendil-works/pi/issues/9789), [#9822](https://github.com/earendil-works/pi/issues/9822)).
34
+ - Fixed `/bug` allowing uploads in offline mode while preserving local zip exports ([#9841](https://github.com/earendil-works/pi/pull/9841) by [@christianklotz](https://github.com/christianklotz)).
35
+ - Fixed idle prompt-cache warming rebuilding expired caches when its timer or an extension decision is delayed.
36
+ - Improved crash diagnostics with hints identifying loaded extensions that appear in the stack trace.
37
+ - Fixed text files beginning with `GIF` being misclassified as images and omitted from `read` and CLI `@file` input ([#9755](https://github.com/earendil-works/pi/issues/9755)).
38
+ - Fixed malformed prompt template frontmatter being silently ignored instead of reported as a resource warning ([#9830](https://github.com/earendil-works/pi/pull/9830) by [@christianklotz](https://github.com/christianklotz)).
39
+ - Fixed inherited unknown OpenAI-compatible Chat Completions endpoints receiving strict tool schemas unless they explicitly advertise support ([#9816](https://github.com/earendil-works/pi/issues/9816)).
40
+
41
+ ## [0.86.1] - 2026-09-20
42
+
43
+ ### New Features
44
+
45
+ - **Meta Muse provider** — Sign in with Meta using `/login meta` or use `META_API_KEY` to access Muse Spark models. See [Meta (Muse subscription)](docs/providers.md#meta-muse-subscription).
46
+
47
+ ### Added
48
+
49
+ - Added Meta (Muse subscription) login via `/login meta` with automatic Model API key refresh, plus `META_API_KEY` support ([#9096](https://github.com/earendil-works/pi/pull/9096) by [@xl0](https://github.com/xl0)).
50
+
51
+ ### Changed
52
+
53
+ - Enabled Node's persistent compile cache before loading the bundled CLI runtime, reducing repeat launch time.
54
+
55
+ ### Fixed
56
+
57
+ - Fixed `/bug` descriptions dropping line breaks from pasted diagnostics.
58
+ - Fixed `/bug` hints appearing for user cancellations and retryable provider failures such as service unavailability.
59
+ - Fixed clipboard copy failing in containers and WSL without WSLg by restoring the OSC 52 fallback when no display is available, and added a verified Windows clipboard backend for WSL ([#9688](https://github.com/earendil-works/pi/issues/9688)).
60
+ - Fixed inherited z.ai `Prompt too long` errors not being recognized as context overflow ([#9805](https://github.com/earendil-works/pi/issues/9805)).
61
+ - Fixed inherited Cerebras models advertising unsupported strict tool schemas, which caused HTTP 400 errors when strict and non-strict tools were mixed ([#9804](https://github.com/earendil-works/pi/pull/9804) by [@EdenGottlieb](https://github.com/EdenGottlieb)).
62
+
3
63
  ## [0.86.0] - 2026-09-19
4
64
 
5
65
  ### New Features
@@ -32,6 +92,7 @@
32
92
 
33
93
  ### Changed
34
94
 
95
+ - Enabled Node's persistent compile cache before loading the bundled CLI runtime, reducing repeat launch time.
35
96
  - Made `--resume` session results appear progressively, using file modification times to prioritize all-folder loading and cancelling outstanding transcript reads after selection.
36
97
  - Reduced `--continue` startup time by checking candidate session headers in modification-time order and stopping after the newest matching session.
37
98
  - Replaced the external native clipboard dependency with bundled asynchronous macOS, Windows, and X11 helpers while preserving platform command and OSC 52 fallbacks ([#9163](https://github.com/earendil-works/pi/pull/9163)).
@@ -118,6 +179,7 @@
118
179
  - Added inherited OpenAI-compatible `vllmPriority` and `supportsMaxOutputTokens` model settings for vLLM scheduler priority and OpenAI Responses output-token limits ([#9004](https://github.com/earendil-works/pi/pull/9004) by [@AppleDannyClegg](https://github.com/AppleDannyClegg), [#8941](https://github.com/earendil-works/pi/pull/8941) by [@scturtle](https://github.com/scturtle)).
119
180
  - Added inherited LaTeX rendering for relational algebra join symbols ([#9050](https://github.com/earendil-works/pi/pull/9050) by [@haoqixu](https://github.com/haoqixu)).
120
181
  - Added a clickable "Jump to latest message" label with the `tui.altScreen.bottom` shortcut to the fullscreen transcript while it is scrolled up ([#9080](https://github.com/earendil-works/pi/pull/9080) by [@rwachtler](https://github.com/rwachtler)).
182
+ - Added Meta (Muse subscription) login via `/login meta` with automatic Model API key refresh, plus `META_API_KEY` support.
121
183
 
122
184
  ### Changed
123
185
 
package/README.md CHANGED
@@ -130,6 +130,7 @@ For each built-in provider, pi maintains a list of tool-capable models. Configur
130
130
  - Together AI
131
131
  - Baseten
132
132
  - Kimi For Coding
133
+ - Meta
133
134
  - MiniMax
134
135
  - Xiaomi MiMo
135
136
  - Xiaomi MiMo Token Plan (China)
@@ -281,6 +282,15 @@ Long sessions can exhaust context windows. Compaction summarizes older messages
281
282
 
282
283
  Compaction is lossy. The full history remains in the JSONL file; use `/tree` to revisit. Customize compaction behavior via [extensions](#extensions). See [docs/compaction.md](docs/compaction.md) for internals.
283
284
 
285
+ Session model context is projected from append-only history. Extensions can append a `context_edit` to omit or replace an earlier message only for future model requests; raw history and usage remain unchanged:
286
+
287
+ ```typescript
288
+ const assistantId = sessionManager.appendMessage(partialAssistant);
289
+ sessionManager.appendContextEdit(assistantId, null); // Hidden from model context, retained in JSONL.
290
+ ```
291
+
292
+ A retain-none compaction uses `appendCompaction(summary, null, tokensBefore)` to make the exact summary the new context root while preserving prior raw entries.
293
+
284
294
  ---
285
295
 
286
296
  ## Settings
@@ -382,6 +392,33 @@ export default function (pi: ExtensionAPI) {
382
392
  }
383
393
  ```
384
394
 
395
+ `turn_end` and `agent_before_settle` are actionable persistence boundaries. Handlers can append structural entries and request one continuation. Later handlers see earlier proposals:
396
+
397
+ ```typescript
398
+ let replacedResponse = false;
399
+ pi.on("turn_end", (event) => {
400
+ if (replacedResponse || event.outcome !== "completed" || event.toolResults.length > 0) return;
401
+ replacedResponse = true;
402
+ return {
403
+ entries: [
404
+ ...event.entries,
405
+ { type: "context_edit", targetId: event.messageEntryId, replacement: null },
406
+ {
407
+ type: "custom_message",
408
+ customType: "replacement-instruction",
409
+ content: "Answer again using the persisted user request.",
410
+ display: false,
411
+ },
412
+ ],
413
+ continue: true,
414
+ };
415
+ });
416
+ ```
417
+
418
+ Continuation is one-shot per boundary result, not per registered handler. It ensures one next provider request: tool-result, steering, or follow-up scheduling can satisfy that request without adding another one; otherwise Pi makes one context-only request. Guard handlers like the example above because an unconditional `continue: true` is evaluated again after the next response and can loop indefinitely. Error and aborted responses remain hard exits.
419
+
420
+ Use `agent_before_settle` for final actions after retries, compaction, and queued input are exhausted. See [docs/extensions.md](docs/extensions.md#agent_start--agent_end--agent_before_settle--agent_settled).
421
+
385
422
  The default export can also be `async`. pi waits for async extension factories before startup continues, which is useful for one-time initialization such as fetching remote model lists before calling `pi.registerProvider()`.
386
423
 
387
424
  **What's possible:**