@earendil-works/pi-coding-agent 0.83.0 → 0.84.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.
- package/CHANGELOG.md +227 -0
- package/README.md +5 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +22 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts +19 -0
- package/dist/cli/auth-check.d.ts.map +1 -0
- package/dist/cli/auth-check.js +50 -0
- package/dist/cli/auth-check.js.map +1 -0
- package/dist/cli/auth-command.d.ts +24 -0
- package/dist/cli/auth-command.d.ts.map +1 -0
- package/dist/cli/auth-command.js +102 -0
- package/dist/cli/auth-command.js.map +1 -0
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +2 -2
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/credential-print.d.ts +5 -15
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +42 -82
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/experimental/auth.d.ts +16 -0
- package/dist/cli/experimental/auth.d.ts.map +1 -0
- package/dist/cli/experimental/auth.js +13 -0
- package/dist/cli/experimental/auth.js.map +1 -0
- package/dist/cli/experimental/cli.d.ts +6 -0
- package/dist/cli/experimental/cli.d.ts.map +1 -0
- package/dist/cli/experimental/cli.js +5 -0
- package/dist/cli/experimental/cli.js.map +1 -0
- package/dist/cli/experimental/command-options.d.ts +17 -0
- package/dist/cli/experimental/command-options.d.ts.map +1 -0
- package/dist/cli/experimental/command-options.js +35 -0
- package/dist/cli/experimental/command-options.js.map +1 -0
- package/dist/cli/experimental/command.d.ts +63 -0
- package/dist/cli/experimental/command.d.ts.map +1 -0
- package/dist/cli/experimental/command.js +130 -0
- package/dist/cli/experimental/command.js.map +1 -0
- package/dist/cli/experimental/commands/client.d.ts +13 -0
- package/dist/cli/experimental/commands/client.d.ts.map +1 -0
- package/dist/cli/experimental/commands/client.js +25 -0
- package/dist/cli/experimental/commands/client.js.map +1 -0
- package/dist/cli/experimental/commands/pi.d.ts +15 -0
- package/dist/cli/experimental/commands/pi.d.ts.map +1 -0
- package/dist/cli/experimental/commands/pi.js +28 -0
- package/dist/cli/experimental/commands/pi.js.map +1 -0
- package/dist/cli/experimental/commands/server.d.ts +13 -0
- package/dist/cli/experimental/commands/server.d.ts.map +1 -0
- package/dist/cli/experimental/commands/server.js +25 -0
- package/dist/cli/experimental/commands/server.js.map +1 -0
- package/dist/cli/experimental/transport-address.d.ts +10 -0
- package/dist/cli/experimental/transport-address.d.ts.map +1 -0
- package/dist/cli/experimental/transport-address.js +38 -0
- package/dist/cli/experimental/transport-address.js.map +1 -0
- package/dist/cli/list-models.d.ts +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +2 -2
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/startup-ui.d.ts +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +2 -2
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/remote-session.d.ts +53 -0
- package/dist/client/remote-session.d.ts.map +1 -0
- package/dist/client/remote-session.js +340 -0
- package/dist/client/remote-session.js.map +1 -0
- package/dist/client/transcript.d.ts +12 -0
- package/dist/client/transcript.d.ts.map +1 -0
- package/dist/client/transcript.js +98 -0
- package/dist/client/transcript.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -10
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +72 -70
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +25 -9
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +237 -39
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +43 -20
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +26 -3
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +5 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +44 -4
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/model-config.d.ts +29 -5
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +4 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -3
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +13 -10
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +4 -3
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +42 -10
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +30 -13
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +233 -73
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts +12 -7
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +83 -14
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/package-manager.d.ts +4 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +63 -36
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-manifest.d.ts +8 -0
- package/dist/core/pi-manifest.d.ts.map +1 -0
- package/dist/core/pi-manifest.js +25 -0
- package/dist/core/pi-manifest.js.map +1 -0
- package/dist/core/provider-composer.d.ts +4 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +36 -15
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +73 -67
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +5 -5
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +11 -8
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +3 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +12 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +40 -16
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/bash.d.ts +4 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +6 -4
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +4 -0
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +11 -7
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +7 -0
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +16 -19
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +4 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +5 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts +4 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +5 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +4 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +7 -3
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts +4 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +6 -2
- package/dist/core/tools/write.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +11 -2
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +21 -7
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +70 -25
- package/dist/main.js.map +1 -1
- package/dist/modes/index.d.ts +1 -0
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +5 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +13 -4
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +7 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +11 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +75 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +16 -4
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +4 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +26 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +8 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +30 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +3 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +9 -2
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +36 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +454 -138
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -0
- package/dist/modes/interactive/theme/light.json +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +3 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +10 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +5 -1
- package/dist/modes/interactive/theme/theme.d.ts +2 -2
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +24 -6
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +28 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +12 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +12 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +5 -4
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -3
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +11 -9
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/rpc-entry.d.ts.map +1 -1
- package/dist/rpc-entry.js +1 -0
- package/dist/rpc-entry.js.map +1 -1
- package/dist/server/create-harness.d.ts +26 -0
- package/dist/server/create-harness.d.ts.map +1 -0
- package/dist/server/create-harness.js +104 -0
- package/dist/server/create-harness.js.map +1 -0
- package/dist/utils/abort.d.ts +5 -0
- package/dist/utils/abort.d.ts.map +1 -0
- package/dist/utils/abort.js +48 -0
- package/dist/utils/abort.js.map +1 -0
- package/dist/utils/clipboard.d.ts +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +22 -2
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/management-http.d.ts +23 -0
- package/dist/utils/management-http.d.ts.map +1 -0
- package/dist/utils/management-http.js +50 -0
- package/dist/utils/management-http.js.map +1 -0
- package/dist/utils/paths.d.ts +3 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +23 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts +19 -0
- package/dist/utils/tool-result-images.d.ts.map +1 -0
- package/dist/utils/tool-result-images.js +45 -0
- package/dist/utils/tool-result-images.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +4 -6
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +4 -0
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +20 -2
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +2 -2
- package/docs/custom-provider.md +7 -5
- package/docs/extensions.md +30 -5
- package/docs/json.md +19 -14
- package/docs/keybindings.md +46 -14
- package/docs/models.md +24 -3
- package/docs/providers.md +9 -1
- package/docs/quickstart.md +2 -0
- package/docs/rpc.md +13 -11
- package/docs/sdk.md +21 -2
- package/docs/security.md +1 -1
- package/docs/settings.md +4 -1
- package/docs/themes.md +5 -3
- package/docs/usage.md +7 -0
- package/examples/extensions/custom-compaction.ts +1 -16
- package/examples/extensions/custom-provider-anthropic/index.ts +2 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/handoff.ts +2 -11
- package/examples/extensions/qna.ts +3 -7
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/summarize.ts +7 -18
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/rpc-extension-ui.ts +11 -2
- package/examples/sdk/02-custom-model.ts +1 -2
- package/examples/sdk/09-api-keys-and-oauth.ts +1 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +64 -20
- package/package.json +13 -6
package/docs/models.md
CHANGED
|
@@ -206,6 +206,7 @@ If your command is slow, expensive, rate-limited, or should keep using a previou
|
|
|
206
206
|
| `input` | No | `["text"]` | Input types: `["text"]` or `["text", "image"]` |
|
|
207
207
|
| `contextWindow` | No | `128000` | Context window size in tokens |
|
|
208
208
|
| `maxTokens` | No | `16384` | Maximum output tokens |
|
|
209
|
+
| `samplingParams` | No | omitted | Sampling parameters merged verbatim into every request body (see below) |
|
|
209
210
|
| `cost` | No | all zeros | Per-million-token rates with optional request-wide input pricing tiers |
|
|
210
211
|
| `compat` | No | provider `compat` | Provider compatibility overrides. Merged with provider-level `compat` when both are set. |
|
|
211
212
|
|
|
@@ -235,6 +236,24 @@ Current behavior:
|
|
|
235
236
|
- `/model`, `--list-models`, and the interactive footer display entries by model `id`.
|
|
236
237
|
- The configured `name` is used for model matching and secondary model detail text. It does not replace the footer/status-bar model id.
|
|
237
238
|
|
|
239
|
+
### Sampling Parameters
|
|
240
|
+
|
|
241
|
+
`samplingParams` is a free-form object merged verbatim into every request body for the model, after the fields pi sets itself, so its keys win. Use it to send sampling parameters pi does not model — including server-specific ones like llama.cpp's `min_p` or vLLM's `top_k`:
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"id": "deepseek-v4-flash",
|
|
246
|
+
"samplingParams": {
|
|
247
|
+
"temperature": 1.0,
|
|
248
|
+
"top_p": 0.95,
|
|
249
|
+
"top_k": 0,
|
|
250
|
+
"min_p": 0.0
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Only OpenAI-compatible APIs apply it (`openai-completions`, `openai-responses`, `azure-openai-responses`); other APIs ignore it. Keys override pi's named request fields (for example a `temperature` key here beats the request-level temperature), so prefer it as the single source of sampling truth for a model. In `modelOverrides`, `samplingParams` merges per key with the base model's value.
|
|
256
|
+
|
|
238
257
|
### Thinking Level Map
|
|
239
258
|
|
|
240
259
|
Use `thinkingLevelMap` on a model to describe model-specific thinking controls. Keys are pi thinking levels: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. Maps may contain holes; for example, a model can expose `high` and `max` without exposing `xhigh`.
|
|
@@ -338,7 +357,7 @@ Use `modelOverrides` to customize built-in models and matching extension-registe
|
|
|
338
357
|
}
|
|
339
358
|
```
|
|
340
359
|
|
|
341
|
-
`modelOverrides` supports these fields per model: `name`, `reasoning`, `thinkingLevelMap`, `input`, `cost` (partial), `contextWindow`, `maxTokens`, `headers`, `compat`.
|
|
360
|
+
`modelOverrides` supports these fields per model: `name`, `reasoning`, `thinkingLevelMap`, `input`, `cost` (partial), `contextWindow`, `maxTokens`, `samplingParams` (merged per key), `headers`, `compat`.
|
|
342
361
|
|
|
343
362
|
Direct OpenAI GPT-5.6 Sol, Terra, and Luna default to a `272000` context window so requests remain within OpenAI's short-context pricing tier. To opt into OpenAI's 1.05M context window, increase it for each model you use:
|
|
344
363
|
|
|
@@ -441,13 +460,15 @@ For providers with partial OpenAI compatibility, use the `compat` field.
|
|
|
441
460
|
| `supportsDeveloperRole` | Use `developer` vs `system` role |
|
|
442
461
|
| `supportsReasoningEffort` | Support for `reasoning_effort` parameter |
|
|
443
462
|
| `supportsUsageInStreaming` | Supports `stream_options: { include_usage: true }` (default: `true`) |
|
|
463
|
+
| `supportsFinishReason` | Whether streamed responses include `finish_reason`. When `false`, pi infers `stop` or `toolUse` when the stream ends. Default: `true`. |
|
|
444
464
|
| `maxTokensField` | Use `max_completion_tokens` or `max_tokens` |
|
|
445
465
|
| `requiresToolResultName` | Include `name` on tool result messages |
|
|
446
466
|
| `requiresAssistantAfterToolResult` | Insert an assistant message before a user message after tool results |
|
|
447
467
|
| `requiresThinkingAsText` | Convert thinking blocks to plain text |
|
|
448
468
|
| `requiresReasoningContentOnAssistantMessages` | Include empty `reasoning_content` on all replayed assistant messages when reasoning is enabled |
|
|
449
|
-
| `thinkingFormat` | Use `reasoning_effort`, `openrouter`, `deepseek`, `together`, `zai`, `qwen`, `chat-template`, or `qwen-chat-template` thinking parameters |
|
|
469
|
+
| `thinkingFormat` | Use `reasoning_effort`, `openrouter`, `deepseek`, `together`, `baseten`, `zai`, `qwen`, `chat-template`, or `qwen-chat-template` thinking parameters |
|
|
450
470
|
| `chatTemplateKwargs` | `chat_template_kwargs` values for `thinkingFormat: "chat-template"`; use `{ "$var": "thinking.enabled" }` or `{ "$var": "thinking.effort" }` for pi-controlled thinking values |
|
|
471
|
+
| `chatTemplateArgs` | `chat_template_args` values for `thinkingFormat: "baseten"`; use `{ "$var": "thinking.enabled" }` or `{ "$var": "thinking.effort" }` for pi-controlled thinking values |
|
|
451
472
|
| `cacheControlFormat` | Use Anthropic-style `cache_control` markers on the system prompt, last tool definition, and last user, assistant, or tool-result text content. Currently only `anthropic` is supported. |
|
|
452
473
|
| `sendSessionAffinityHeaders` | For `openai-completions`, send session-affinity headers from the session id when caching is enabled. Default: `false`. |
|
|
453
474
|
| `sessionAffinityFormat` | For `openai-completions` and `openai-responses`, the session-affinity header format: `openai` sends `session_id`/`x-client-request-id` (completions also `x-session-affinity`), `openai-nosession` omits the underscore-containing `session_id` header, `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param. Default: auto-detected. |
|
|
@@ -458,7 +479,7 @@ For providers with partial OpenAI compatibility, use the `compat` field.
|
|
|
458
479
|
| `openRouterRouting` | OpenRouter provider routing preferences. This object is sent as-is in the `provider` field of the [OpenRouter API request](https://openrouter.ai/docs/guides/routing/provider-selection). |
|
|
459
480
|
| `vercelGatewayRouting` | Vercel AI Gateway routing config for provider selection (`only`, `order`) |
|
|
460
481
|
|
|
461
|
-
`openrouter` uses `reasoning: { effort }`. `together` uses `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` uses top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that require `chat_template_kwargs.enable_thinking` and `preserve_thinking`. Use `chat-template` for vLLM/Hugging Face chat templates that need configurable `chat_template_kwargs`, such as `chatTemplateKwargs: { "thinking": { "$var": "thinking.enabled" } }` for DeepSeek V3.x templates.
|
|
482
|
+
`openrouter` uses `reasoning: { effort }`. `together` uses `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` uses top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that require `chat_template_kwargs.enable_thinking` and `preserve_thinking`. Use `chat-template` for vLLM/Hugging Face chat templates that need configurable `chat_template_kwargs`, such as `chatTemplateKwargs: { "thinking": { "$var": "thinking.enabled" } }` for DeepSeek V3.x templates. Use `thinkingFormat: "baseten"` with `chatTemplateArgs` for providers that expose toggle controls through `chat_template_args` and optionally support top-level `reasoning_effort`.
|
|
462
483
|
|
|
463
484
|
`cacheControlFormat: "anthropic"` is for OpenAI-compatible providers that expose Anthropic-style prompt caching through `cache_control` markers on text content and tool definitions.
|
|
464
485
|
|
package/docs/providers.md
CHANGED
|
@@ -92,10 +92,12 @@ pi
|
|
|
92
92
|
| Hugging Face | `HF_TOKEN` | `huggingface` |
|
|
93
93
|
| Fireworks | `FIREWORKS_API_KEY` | `fireworks` |
|
|
94
94
|
| Together AI | `TOGETHER_API_KEY` | `together` |
|
|
95
|
+
| Baseten | `BASETEN_API_KEY` | `baseten` |
|
|
95
96
|
| Kimi For Coding | `KIMI_API_KEY` | `kimi-coding` |
|
|
96
97
|
| MiniMax | `MINIMAX_API_KEY` | `minimax` |
|
|
97
98
|
| MiniMax (China) | `MINIMAX_CN_API_KEY` | `minimax-cn` |
|
|
98
|
-
| Qwen Token Plan | `QWEN_TOKEN_PLAN_API_KEY` | `qwen-token-plan` |
|
|
99
|
+
| Qwen Token Plan (existing catalog) | `QWEN_TOKEN_PLAN_API_KEY` | `qwen-token-plan` |
|
|
100
|
+
| Qwen Token Plan (Individual) | `QWEN_TOKEN_PLAN_API_KEY` | `qwen-token-plan-individual` |
|
|
99
101
|
| Qwen Token Plan (China) | `QWEN_TOKEN_PLAN_CN_API_KEY` | `qwen-token-plan-cn` |
|
|
100
102
|
| Xiaomi MiMo | `XIAOMI_API_KEY` | `xiaomi` |
|
|
101
103
|
| Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` | `xiaomi-token-plan-cn` |
|
|
@@ -120,6 +122,7 @@ Store credentials in `~/.pi/agent/auth.json`:
|
|
|
120
122
|
"opencode-go": { "type": "api_key", "key": "..." },
|
|
121
123
|
"together": { "type": "api_key", "key": "..." },
|
|
122
124
|
"qwen-token-plan": { "type": "api_key", "key": "sk-sp-..." },
|
|
125
|
+
"qwen-token-plan-individual": { "type": "api_key", "key": "sk-sp-..." },
|
|
123
126
|
"qwen-token-plan-cn": { "type": "api_key", "key": "sk-sp-..." },
|
|
124
127
|
"xiaomi": { "type": "api_key", "key": "..." },
|
|
125
128
|
"xiaomi-token-plan-cn": { "type": "api_key", "key": "..." },
|
|
@@ -128,6 +131,11 @@ Store credentials in `~/.pi/agent/auth.json`:
|
|
|
128
131
|
}
|
|
129
132
|
```
|
|
130
133
|
|
|
134
|
+
`qwen-token-plan-individual` uses the same international endpoint and `QWEN_TOKEN_PLAN_API_KEY` as
|
|
135
|
+
`qwen-token-plan`, but limits the picker to the models documented for Individual subscriptions. The existing
|
|
136
|
+
provider keeps its broader catalog for backward compatibility. When using `auth.json`, store the
|
|
137
|
+
credential under the provider you select; an environment variable is shared by both international providers.
|
|
138
|
+
|
|
131
139
|
The file is created with `0600` permissions (user read/write only). Auth file credentials take priority over environment variables.
|
|
132
140
|
|
|
133
141
|
API key credentials can also include provider-scoped environment values. These values are used before process environment variables when resolving the credential key, provider/model headers, and provider configuration such as Cloudflare account IDs, Azure OpenAI settings, Vertex project/location, Bedrock settings, `PI_CACHE_RETENTION`, and `HTTP_PROXY`/`HTTPS_PROXY`.
|
package/docs/quickstart.md
CHANGED
|
@@ -100,6 +100,8 @@ Pi loads:
|
|
|
100
100
|
- `~/.pi/agent/AGENTS.md` for global instructions
|
|
101
101
|
- `AGENTS.md` or `CLAUDE.md` from parent directories and the current directory
|
|
102
102
|
|
|
103
|
+
If a directory contains `AGENTS.override.md`, Pi loads it instead of `AGENTS.md` or `CLAUDE.md` from that directory.
|
|
104
|
+
|
|
103
105
|
Restart pi, or run `/reload`, after changing context files.
|
|
104
106
|
|
|
105
107
|
## Common things to try
|
package/docs/rpc.md
CHANGED
|
@@ -914,17 +914,15 @@ Emitted when a message begins and completes. The `message` field contains an `Ag
|
|
|
914
914
|
|
|
915
915
|
### message_update (Streaming)
|
|
916
916
|
|
|
917
|
-
Emitted during streaming of assistant messages. Contains
|
|
917
|
+
Emitted during streaming of assistant messages. Contains a delta event without a cumulative message snapshot.
|
|
918
918
|
|
|
919
919
|
```json
|
|
920
920
|
{
|
|
921
921
|
"type": "message_update",
|
|
922
|
-
"message": {...},
|
|
923
922
|
"assistantMessageEvent": {
|
|
924
923
|
"type": "text_delta",
|
|
925
924
|
"contentIndex": 0,
|
|
926
|
-
"delta": "Hello "
|
|
927
|
-
"partial": {...}
|
|
925
|
+
"delta": "Hello "
|
|
928
926
|
}
|
|
929
927
|
}
|
|
930
928
|
```
|
|
@@ -933,7 +931,6 @@ The `assistantMessageEvent` field contains one of these delta types:
|
|
|
933
931
|
|
|
934
932
|
| Type | Description |
|
|
935
933
|
|------|-------------|
|
|
936
|
-
| `start` | Message generation started |
|
|
937
934
|
| `text_start` | Text content block started |
|
|
938
935
|
| `text_delta` | Text content chunk |
|
|
939
936
|
| `text_end` | Text content block ended |
|
|
@@ -943,17 +940,21 @@ The `assistantMessageEvent` field contains one of these delta types:
|
|
|
943
940
|
| `toolcall_start` | Tool call started |
|
|
944
941
|
| `toolcall_delta` | Tool call arguments chunk |
|
|
945
942
|
| `toolcall_end` | Tool call ended (includes full `toolCall` object) |
|
|
946
|
-
| `done` | Message complete (reason: `"stop"`, `"length"`, `"toolUse"`) |
|
|
947
|
-
| `error` | Error occurred (reason: `"aborted"`, `"error"`) |
|
|
948
943
|
|
|
949
944
|
Example streaming a text response:
|
|
950
945
|
```json
|
|
951
|
-
{"type":"message_update","
|
|
952
|
-
{"type":"message_update","
|
|
953
|
-
{"type":"message_update","
|
|
954
|
-
{"type":"message_update","
|
|
946
|
+
{"type":"message_update","assistantMessageEvent":{"type":"text_start","contentIndex":0}}
|
|
947
|
+
{"type":"message_update","assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
|
|
948
|
+
{"type":"message_update","assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":" world"}}
|
|
949
|
+
{"type":"message_update","assistantMessageEvent":{"type":"text_end","contentIndex":0,"content":"Hello world"}}
|
|
955
950
|
```
|
|
956
951
|
|
|
952
|
+
`message_update` intentionally omits the former cumulative `message` field and
|
|
953
|
+
`assistantMessageEvent.partial`. Clients that need a live partial message must assemble it
|
|
954
|
+
from `message_start` and subsequent events using `contentIndex`. Treat `message_end.message`
|
|
955
|
+
as authoritative. For tool calls, buffer `toolcall_delta.delta`; `toolcall_end.toolCall`
|
|
956
|
+
contains the completed call.
|
|
957
|
+
|
|
957
958
|
### bash_execution_update
|
|
958
959
|
|
|
959
960
|
Emitted once for each output chunk from a direct `bash` command. `id` matches the command's `id`, allowing clients to associate output with the correct command.
|
|
@@ -1362,6 +1363,7 @@ Source files:
|
|
|
1362
1363
|
- [`packages/ai/src/types.ts`](../../ai/src/types.ts) - `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`
|
|
1363
1364
|
- [`packages/agent/src/types.ts`](../../agent/src/types.ts) - `AgentMessage`, `AgentEvent`
|
|
1364
1365
|
- [`src/core/messages.ts`](../src/core/messages.ts) - `BashExecutionMessage`
|
|
1366
|
+
- [`src/modes/json-event.ts`](../src/modes/json-event.ts) - `JsonAgentSessionEvent`
|
|
1365
1367
|
- [`src/modes/rpc/rpc-types.ts`](../src/modes/rpc/rpc-types.ts) - RPC command/response types, extension UI request/response types
|
|
1366
1368
|
|
|
1367
1369
|
### Model
|
package/docs/sdk.md
CHANGED
|
@@ -452,7 +452,7 @@ for (const provider of modelRuntime.getProviders()) {
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
// Runtime API key override (not persisted to disk)
|
|
455
|
-
modelRuntime.setRuntimeApiKey("anthropic", "sk-my-temp-key");
|
|
455
|
+
await modelRuntime.setRuntimeApiKey("anthropic", "sk-my-temp-key");
|
|
456
456
|
|
|
457
457
|
// Custom credential and model locations
|
|
458
458
|
const customRuntime = await ModelRuntime.create({
|
|
@@ -469,6 +469,24 @@ const { session } = await createAgentSession({
|
|
|
469
469
|
});
|
|
470
470
|
```
|
|
471
471
|
|
|
472
|
+
`login()`, `logout()`, `setRuntimeApiKey()`, and `removeRuntimeApiKey()` resolve after the affected provider's cached/built-in catalog, composition, and availability snapshot are locally consistent. They do not wait for remote catalog freshness. If credentials were committed but local synchronization fails, they reject with the exported `CredentialSynchronizationError`; inspect its `providerId`, `operation`, `credential`, and `cause` fields instead of retrying the credential mutation blindly.
|
|
473
|
+
|
|
474
|
+
Public model/auth operations and `ModelRuntime.create({ signal })` accept optional abort signals and are unbounded when omitted. SDK applications own deadline policy for remote catalog freshness:
|
|
475
|
+
|
|
476
|
+
```typescript
|
|
477
|
+
const signal = AbortSignal.timeout(15_000);
|
|
478
|
+
const result = await modelRuntime.refresh({
|
|
479
|
+
providers: ["anthropic"],
|
|
480
|
+
signal,
|
|
481
|
+
});
|
|
482
|
+
if (result.aborted) console.warn("Catalog refresh timed out; using cached models");
|
|
483
|
+
for (const [providerId, error] of result.errors) {
|
|
484
|
+
console.warn(`Could not refresh ${providerId}:`, error);
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
A failed or timed-out network refresh does not undo a successful credential operation. `refresh()` starts a new provider generation, so it does not wait behind an older stalled refresh and stale generations cannot publish afterward.
|
|
489
|
+
|
|
472
490
|
> See [examples/sdk/09-api-keys-and-oauth.ts](../examples/sdk/09-api-keys-and-oauth.ts)
|
|
473
491
|
|
|
474
492
|
### System Prompt
|
|
@@ -938,7 +956,7 @@ const modelRuntime = await ModelRuntime.create({
|
|
|
938
956
|
modelsPath: "/custom/agent/models.json",
|
|
939
957
|
});
|
|
940
958
|
if (process.env.MY_KEY) {
|
|
941
|
-
modelRuntime.setRuntimeApiKey("anthropic", process.env.MY_KEY);
|
|
959
|
+
await modelRuntime.setRuntimeApiKey("anthropic", process.env.MY_KEY);
|
|
942
960
|
}
|
|
943
961
|
|
|
944
962
|
// Inline tool
|
|
@@ -1144,6 +1162,7 @@ AgentSessionRuntime
|
|
|
1144
1162
|
// Auth and Models
|
|
1145
1163
|
ModelRuntime // implements pi-ai Models and owns credential storage
|
|
1146
1164
|
ModelRegistry // synchronous extension compatibility facade
|
|
1165
|
+
CredentialSynchronizationError
|
|
1147
1166
|
resolveCliModel
|
|
1148
1167
|
resolveModelScopeWithDiagnostics
|
|
1149
1168
|
|
package/docs/security.md
CHANGED
|
@@ -24,7 +24,7 @@ Trusting a project allows pi to load project resources that require trust, inclu
|
|
|
24
24
|
- missing project packages configured through project settings
|
|
25
25
|
- project-local extensions and project package-managed extensions
|
|
26
26
|
|
|
27
|
-
Declining trust skips protected resources. `AGENTS.md` and `CLAUDE.md`
|
|
27
|
+
Declining trust skips protected resources. Context files such as `AGENTS.override.md`, `AGENTS.md`, and `CLAUDE.md` are loaded regardless of project trust unless context loading is disabled. Before trust is resolved, pi only loads context files, user/global extensions, and CLI `-e` extensions. User/global and CLI extensions can handle the `project_trust` event; the first extension that returns a yes/no decision owns the decision.
|
|
28
28
|
|
|
29
29
|
Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, `defaultProjectTrust: "ask"` and `"never"` ignore such resources, while `"always"` trusts them. Use `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
|
|
30
30
|
|
package/docs/settings.md
CHANGED
|
@@ -65,6 +65,8 @@ Use `/trust` in interactive mode to save a project trust decision for future ses
|
|
|
65
65
|
| `outputPad` | number | `1` | Horizontal padding for user messages, assistant messages, and thinking (0 or 1) |
|
|
66
66
|
| `autocompleteMaxVisible` | number | `5` | Max visible items in autocomplete dropdown (3-20) |
|
|
67
67
|
| `showHardwareCursor` | boolean | `false` | Show the terminal cursor while TUI positions it for IME support |
|
|
68
|
+
| `tuiMode` | string | `"regular"` | Interactive TUI mode: `"regular"` or experimental `"fullscreen"`. Changes from `/settings` apply immediately; `--tui-mode` overrides this setting at startup |
|
|
69
|
+
| `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 |
|
|
68
70
|
|
|
69
71
|
For VS Code, include `--wait` so pi resumes after the editor exits:
|
|
70
72
|
|
|
@@ -178,7 +180,7 @@ Keep `retry.provider.maxRetries` at `0` unless provider-level retries are explic
|
|
|
178
180
|
| `terminal.showImages` | boolean | `true` | Show images in terminal (if supported) |
|
|
179
181
|
| `terminal.imageWidthCells` | number | `60` | Preferred inline image width in terminal cells |
|
|
180
182
|
| `terminal.clearOnShrink` | boolean | `false` | Clear empty rows when content shrinks (can cause flicker) |
|
|
181
|
-
| `images.autoResize` | boolean | `true` | Resize images to 2000x2000 max |
|
|
183
|
+
| `images.autoResize` | boolean | `true` | Resize images to 2000x2000 max. Applies to `@file` attachments, `read`, and images returned by tools |
|
|
182
184
|
| `images.blockImages` | boolean | `false` | Block all images from being sent to LLM |
|
|
183
185
|
|
|
184
186
|
### Shell
|
|
@@ -226,6 +228,7 @@ When multiple sources specify a session directory, precedence is `--session-dir`
|
|
|
226
228
|
| Setting | Type | Default | Description |
|
|
227
229
|
|---------|------|---------|-------------|
|
|
228
230
|
| `markdown.codeBlockIndent` | string | `" "` | Indentation for code blocks |
|
|
231
|
+
| `markdown.mermaid` | string | `"streaming"` | Mermaid rendering mode: `"off"`, `"final"`, or `"streaming"` |
|
|
229
232
|
|
|
230
233
|
### Resources
|
|
231
234
|
|
package/docs/themes.md
CHANGED
|
@@ -71,6 +71,7 @@ vim ~/.pi/agent/themes/my-theme.json
|
|
|
71
71
|
"text": "",
|
|
72
72
|
"thinkingText": "secondary",
|
|
73
73
|
"selectedBg": "#2d2d30",
|
|
74
|
+
"scrollbarThumb": "#555566",
|
|
74
75
|
"userMessageBg": "#2d2d30",
|
|
75
76
|
"userMessageText": "",
|
|
76
77
|
"customMessageBg": "#2d2d30",
|
|
@@ -140,13 +141,13 @@ vim ~/.pi/agent/themes/my-theme.json
|
|
|
140
141
|
|
|
141
142
|
- `name` is required, must be unique, and must not contain `/`.
|
|
142
143
|
- `vars` is optional. Define reusable colors here, then reference them in `colors`.
|
|
143
|
-
- `colors` must define all 51 required tokens. `thinkingMax` is optional and falls back to `thinkingXhigh`.
|
|
144
|
+
- `colors` must define all 51 required tokens. `thinkingMax` is optional and falls back to `thinkingXhigh`; `scrollbarThumb` is optional and falls back to `selectedBg`.
|
|
144
145
|
|
|
145
146
|
The `$schema` field enables editor auto-completion and validation.
|
|
146
147
|
|
|
147
148
|
## Color Tokens
|
|
148
149
|
|
|
149
|
-
Every theme must define all 51 required color tokens. `thinkingMax`
|
|
150
|
+
Every theme must define all 51 required color tokens. `thinkingMax` and `scrollbarThumb` are optional for compatibility with existing themes; when omitted, they use `thinkingXhigh` and `selectedBg`, respectively.
|
|
150
151
|
|
|
151
152
|
### Core UI (11 colors)
|
|
152
153
|
|
|
@@ -164,11 +165,12 @@ Every theme must define all 51 required color tokens. `thinkingMax` is optional
|
|
|
164
165
|
| `text` | Default text (usually `""`) |
|
|
165
166
|
| `thinkingText` | Thinking block text |
|
|
166
167
|
|
|
167
|
-
### Backgrounds & Content (11
|
|
168
|
+
### Backgrounds & Content (11 required, 1 optional)
|
|
168
169
|
|
|
169
170
|
| Token | Purpose |
|
|
170
171
|
|-------|---------|
|
|
171
172
|
| `selectedBg` | Selected line background |
|
|
173
|
+
| `scrollbarThumb` | Fullscreen scrollbar thumb background; optional, falls back to `selectedBg` |
|
|
172
174
|
| `userMessageBg` | User message background |
|
|
173
175
|
| `userMessageText` | User message text |
|
|
174
176
|
| `customMessageBg` | Extension message background |
|
package/docs/usage.md
CHANGED
|
@@ -103,6 +103,8 @@ Pi loads `AGENTS.md` or `CLAUDE.md` at startup from:
|
|
|
103
103
|
- parent directories, walking up from the current working directory
|
|
104
104
|
- the current directory
|
|
105
105
|
|
|
106
|
+
If a directory contains `AGENTS.override.md`, Pi loads it instead of `AGENTS.md` or `CLAUDE.md` from that directory. Context files from other directories still layer normally.
|
|
107
|
+
|
|
106
108
|
Use context files for project conventions, commands, safety rules, and preferences. Disable loading with `--no-context-files` or `-nc`.
|
|
107
109
|
|
|
108
110
|
### System Prompt Files
|
|
@@ -239,12 +241,17 @@ pi --no-extensions -e ./my-extension.ts
|
|
|
239
241
|
|--------|-------------|
|
|
240
242
|
| `--system-prompt <text>` | Replace default prompt; context files and skills are still appended |
|
|
241
243
|
| `--append-system-prompt <text>` | Append to system prompt |
|
|
244
|
+
| `--tui-mode <mode>` | TUI mode: `regular` (default) or experimental `fullscreen` |
|
|
242
245
|
| `--verbose` | Force verbose startup |
|
|
243
246
|
| `-a`, `--approve` | Trust project-local files for this run |
|
|
244
247
|
| `-na`, `--no-approve` | Ignore project-local files for this run |
|
|
245
248
|
| `-h`, `--help` | Show help |
|
|
246
249
|
| `-v`, `--version` | Show version |
|
|
247
250
|
|
|
251
|
+
In `fullscreen` mode, the transcript scrolls inside the terminal viewport while queued messages, working status, extension widgets, editor, and footer remain fixed at the bottom. Mouse/trackpad input scrolls the region under the pointer; keyboard viewport actions always remain available. Inline images work in terminals that support the Kitty graphics protocol, including Kitty and Ghostty. In iTerm2 they render as text placeholders because its inline-image protocol cannot delete or crop placements during application-owned scrolling. In `regular` mode, pi uses the main screen and terminal-owned scrollback, and iTerm2 inline images continue to render normally.
|
|
252
|
+
|
|
253
|
+
Set **TUI mode** in `/settings` to switch between `regular` and `fullscreen` immediately and choose the default for future sessions.
|
|
254
|
+
|
|
248
255
|
### File Arguments
|
|
249
256
|
|
|
250
257
|
Prefix files with `@` to include them in the message:
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { uuidv7 } from "@earendil-works/pi-ai";
|
|
17
|
-
import { complete } from "@earendil-works/pi-ai/compat";
|
|
18
17
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
19
18
|
import { convertToLlm, serializeConversation } from "@earendil-works/pi-coding-agent";
|
|
20
19
|
|
|
@@ -32,17 +31,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
// Resolve request auth for the summarization model
|
|
36
|
-
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(model);
|
|
37
|
-
if (!auth.ok) {
|
|
38
|
-
ctx.ui.notify(`Compaction auth failed: ${auth.error}`, "warning");
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (!auth.apiKey) {
|
|
42
|
-
ctx.ui.notify(`No API key for ${model.provider}, using default compaction`, "warning");
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
34
|
// Combine all messages for full summary
|
|
47
35
|
const allMessages = [...messagesToSummarize, ...turnPrefixMessages];
|
|
48
36
|
|
|
@@ -88,13 +76,10 @@ ${conversationText}
|
|
|
88
76
|
|
|
89
77
|
try {
|
|
90
78
|
// Pass signal to honor abort requests (e.g., user cancels compaction)
|
|
91
|
-
const response = await complete(
|
|
79
|
+
const response = await ctx.modelRegistry.complete(
|
|
92
80
|
model,
|
|
93
81
|
{ messages: summaryMessages },
|
|
94
82
|
{
|
|
95
|
-
apiKey: auth.apiKey,
|
|
96
|
-
headers: auth.headers,
|
|
97
|
-
env: auth.env,
|
|
98
83
|
maxTokens: 8192,
|
|
99
84
|
signal,
|
|
100
85
|
cacheRetention: "none",
|
|
@@ -124,7 +124,7 @@ async function loginAnthropic(callbacks: OAuthLoginCallbacks): Promise<OAuthCred
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
async function refreshAnthropicToken(credentials: OAuthCredentials): Promise<OAuthCredentials> {
|
|
127
|
+
async function refreshAnthropicToken(credentials: OAuthCredentials, signal: AbortSignal): Promise<OAuthCredentials> {
|
|
128
128
|
const response = await fetch(TOKEN_URL, {
|
|
129
129
|
method: "POST",
|
|
130
130
|
headers: { "Content-Type": "application/json" },
|
|
@@ -133,6 +133,7 @@ async function refreshAnthropicToken(credentials: OAuthCredentials): Promise<OAu
|
|
|
133
133
|
client_id: CLIENT_ID,
|
|
134
134
|
refresh_token: credentials.refresh,
|
|
135
135
|
}),
|
|
136
|
+
signal,
|
|
136
137
|
});
|
|
137
138
|
|
|
138
139
|
if (!response.ok) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.84.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.84.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -274,7 +274,7 @@ async function loginGitLab(callbacks: OAuthLoginCallbacks): Promise<OAuthCredent
|
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
async function refreshGitLabToken(credentials: OAuthCredentials): Promise<OAuthCredentials> {
|
|
277
|
+
async function refreshGitLabToken(credentials: OAuthCredentials, signal: AbortSignal): Promise<OAuthCredentials> {
|
|
278
278
|
const response = await fetch(`${GITLAB_COM_URL}/oauth/token`, {
|
|
279
279
|
method: "POST",
|
|
280
280
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
@@ -283,6 +283,7 @@ async function refreshGitLabToken(credentials: OAuthCredentials): Promise<OAuthC
|
|
|
283
283
|
grant_type: "refresh_token",
|
|
284
284
|
refresh_token: credentials.refresh,
|
|
285
285
|
}).toString(),
|
|
286
|
+
signal,
|
|
286
287
|
});
|
|
287
288
|
if (!response.ok) throw new Error(`Token refresh failed: ${await response.text()}`);
|
|
288
289
|
const data = (await response.json()) as {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { existsSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { gunzipSync } from "node:zlib";
|
|
4
5
|
|
|
5
6
|
// Get the bundled WAD path (relative to this module)
|
|
6
7
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
8
|
const BUNDLED_WAD = join(__dirname, "doom1.wad");
|
|
8
|
-
const WAD_URL = "https://
|
|
9
|
+
const WAD_URL = "https://www.gamers.org/pub/idgames/idstuff/doom/doom-1.8.wad.gz";
|
|
9
10
|
|
|
10
11
|
const DEFAULT_WAD_PATHS = ["./doom1.wad", "./DOOM1.WAD", "~/doom1.wad", "~/.doom/doom1.wad"];
|
|
11
12
|
|
|
@@ -42,8 +43,11 @@ export async function ensureWadFile(): Promise<string | null> {
|
|
|
42
43
|
if (!response.ok) {
|
|
43
44
|
throw new Error(`HTTP ${response.status}`);
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
46
|
+
const wad = gunzipSync(Buffer.from(await response.arrayBuffer()));
|
|
47
|
+
if (wad.subarray(0, 4).toString("ascii") !== "IWAD") {
|
|
48
|
+
throw new Error("Downloaded file is not a valid IWAD");
|
|
49
|
+
}
|
|
50
|
+
writeFileSync(BUNDLED_WAD, wad);
|
|
47
51
|
return BUNDLED_WAD;
|
|
48
52
|
} catch {
|
|
49
53
|
return null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-gondolin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.84.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-gondolin",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.84.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@earendil-works/gondolin": "0.12.0"
|
|
12
12
|
}
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
16
|
-
import { uuidv7 } from "@earendil-works/pi-ai";
|
|
17
|
-
import { complete, type Message } from "@earendil-works/pi-ai/compat";
|
|
16
|
+
import { type Message, uuidv7 } from "@earendil-works/pi-ai";
|
|
18
17
|
import type { ExtensionAPI, SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
19
18
|
import { BorderedLoader, convertToLlm, serializeConversation } from "@earendil-works/pi-coding-agent";
|
|
20
19
|
|
|
@@ -118,11 +117,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
118
117
|
loader.onAbort = () => done(null);
|
|
119
118
|
|
|
120
119
|
const doGenerate = async () => {
|
|
121
|
-
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(ctx.model!);
|
|
122
|
-
if (!auth.ok || !auth.apiKey) {
|
|
123
|
-
throw new Error(auth.ok ? `No API key for ${ctx.model!.provider}` : auth.error);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
120
|
const userMessage: Message = {
|
|
127
121
|
role: "user",
|
|
128
122
|
content: [
|
|
@@ -134,13 +128,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
134
128
|
timestamp: Date.now(),
|
|
135
129
|
};
|
|
136
130
|
|
|
137
|
-
const response = await complete(
|
|
131
|
+
const response = await ctx.modelRegistry.complete(
|
|
138
132
|
ctx.model!,
|
|
139
133
|
{ systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
|
|
140
134
|
{
|
|
141
|
-
apiKey: auth.apiKey,
|
|
142
|
-
headers: auth.headers,
|
|
143
|
-
env: auth.env,
|
|
144
135
|
signal: loader.signal,
|
|
145
136
|
cacheRetention: "none",
|
|
146
137
|
sessionId: uuidv7(),
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 3. Loads the result into the editor for user to fill in answers
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import type { UserMessage } from "@earendil-works/pi-ai";
|
|
11
11
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
12
12
|
import { BorderedLoader } from "@earendil-works/pi-coding-agent";
|
|
13
13
|
|
|
@@ -77,20 +77,16 @@ export default function (pi: ExtensionAPI) {
|
|
|
77
77
|
|
|
78
78
|
// Do the work
|
|
79
79
|
const doExtract = async () => {
|
|
80
|
-
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(ctx.model!);
|
|
81
|
-
if (!auth.ok || !auth.apiKey) {
|
|
82
|
-
throw new Error(auth.ok ? `No API key for ${ctx.model!.provider}` : auth.error);
|
|
83
|
-
}
|
|
84
80
|
const userMessage: UserMessage = {
|
|
85
81
|
role: "user",
|
|
86
82
|
content: [{ type: "text", text: lastAssistantText! }],
|
|
87
83
|
timestamp: Date.now(),
|
|
88
84
|
};
|
|
89
85
|
|
|
90
|
-
const response = await complete(
|
|
86
|
+
const response = await ctx.modelRegistry.complete(
|
|
91
87
|
ctx.model!,
|
|
92
88
|
{ systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
|
|
93
|
-
{
|
|
89
|
+
{ signal: loader.signal },
|
|
94
90
|
);
|
|
95
91
|
|
|
96
92
|
if (response.stopReason === "aborted") {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.14.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|