@mariozechner/pi-coding-agent 0.56.1 → 0.56.3
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 +57 -0
- package/README.md +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +50 -17
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +2 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +25 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +3 -0
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +16 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +4 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +2 -2
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +36 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +8 -23
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +14 -4
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +4 -2
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +4 -3
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +19 -5
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/compaction.md +2 -0
- package/docs/custom-provider.md +11 -7
- package/docs/extensions.md +13 -1
- package/docs/models.md +5 -1
- package/docs/settings.md +1 -0
- package/docs/tmux.md +39 -0
- 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/package.json +1 -1
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/with-deps/index.ts +1 -5
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
package/docs/compaction.md
CHANGED
|
@@ -262,6 +262,8 @@ Before summarization, messages are serialized to text via [`serializeConversatio
|
|
|
262
262
|
|
|
263
263
|
This prevents the model from treating it as a conversation to continue.
|
|
264
264
|
|
|
265
|
+
Tool results are truncated to 2000 characters during serialization. Content beyond that limit is replaced with a marker indicating how many characters were truncated. This keeps summarization requests within reasonable token budgets, since tool results (especially from `read` and `bash`) are typically the largest contributors to context size.
|
|
266
|
+
|
|
265
267
|
## Custom Summarization via Extensions
|
|
266
268
|
|
|
267
269
|
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
|
package/docs/custom-provider.md
CHANGED
|
@@ -159,6 +159,7 @@ The `api` field determines which streaming implementation is used:
|
|
|
159
159
|
| `openai-responses` | OpenAI Responses API |
|
|
160
160
|
| `azure-openai-responses` | Azure OpenAI Responses API |
|
|
161
161
|
| `openai-codex-responses` | OpenAI Codex Responses API |
|
|
162
|
+
| `mistral-conversations` | Mistral SDK Conversations/Chat streaming |
|
|
162
163
|
| `google-generative-ai` | Google Generative AI API |
|
|
163
164
|
| `google-gemini-cli` | Google Cloud Code Assist API |
|
|
164
165
|
| `google-vertex` | Google Vertex AI API |
|
|
@@ -180,14 +181,17 @@ models: [{
|
|
|
180
181
|
high: "default",
|
|
181
182
|
xhigh: "default"
|
|
182
183
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
}]
|
|
184
|
+
maxTokensField: "max_tokens", // instead of "max_completion_tokens"
|
|
185
|
+
requiresToolResultName: true, // tool results need name field
|
|
186
|
+
thinkingFormat: "qwen" // uses enable_thinking: true
|
|
187
|
+
}
|
|
188
|
+
}]
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
+
> Migration note: Mistral moved from `openai-completions` to `mistral-conversations`.
|
|
192
|
+
> Use `mistral-conversations` for native Mistral models.
|
|
193
|
+
> If you intentionally route Mistral-compatible/custom endpoints through `openai-completions`, set `compat` flags explicitly as needed.
|
|
194
|
+
|
|
191
195
|
### Auth Header
|
|
192
196
|
|
|
193
197
|
If your provider expects `Authorization: Bearer <key>` but doesn't use a standard API, set `authHeader: true`:
|
|
@@ -301,6 +305,7 @@ For providers with non-standard APIs, implement `streamSimple`. Study the existi
|
|
|
301
305
|
|
|
302
306
|
**Reference implementations:**
|
|
303
307
|
- [anthropic.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
|
|
308
|
+
- [mistral.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
|
|
304
309
|
- [openai-completions.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
|
|
305
310
|
- [openai-responses.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
|
|
306
311
|
- [google.ts](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/providers/google.ts) - Google Generative AI
|
|
@@ -581,7 +586,6 @@ interface ProviderModelConfig {
|
|
|
581
586
|
requiresToolResultName?: boolean;
|
|
582
587
|
requiresAssistantAfterToolResult?: boolean;
|
|
583
588
|
requiresThinkingAsText?: boolean;
|
|
584
|
-
requiresMistralToolIds?: boolean;
|
|
585
589
|
thinkingFormat?: "openai" | "zai" | "qwen";
|
|
586
590
|
};
|
|
587
591
|
}
|
package/docs/extensions.md
CHANGED
|
@@ -1340,6 +1340,18 @@ pi.registerTool({
|
|
|
1340
1340
|
});
|
|
1341
1341
|
```
|
|
1342
1342
|
|
|
1343
|
+
**Signaling errors:** To mark a tool execution as failed (sets `isError: true` on the result and reports it to the LLM), throw an error from `execute`. Returning a value never sets the error flag regardless of what properties you include in the return object.
|
|
1344
|
+
|
|
1345
|
+
```typescript
|
|
1346
|
+
// Correct: throw to signal an error
|
|
1347
|
+
async execute(toolCallId, params) {
|
|
1348
|
+
if (!isValid(params.input)) {
|
|
1349
|
+
throw new Error(`Invalid input: ${params.input}`);
|
|
1350
|
+
}
|
|
1351
|
+
return { content: [{ type: "text", text: "OK" }], details: {} };
|
|
1352
|
+
}
|
|
1353
|
+
```
|
|
1354
|
+
|
|
1343
1355
|
**Important:** Use `StringEnum` from `@mariozechner/pi-ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1344
1356
|
|
|
1345
1357
|
### Overriding Built-in Tools
|
|
@@ -1880,7 +1892,7 @@ const highlighted = highlightCode(code, lang, theme);
|
|
|
1880
1892
|
|
|
1881
1893
|
- Extension errors are logged, agent continues
|
|
1882
1894
|
- `tool_call` errors block the tool (fail-safe)
|
|
1883
|
-
- Tool `execute` errors
|
|
1895
|
+
- Tool `execute` errors must be signaled by throwing; the thrown error is caught, reported to the LLM with `isError: true`, and execution continues
|
|
1884
1896
|
|
|
1885
1897
|
## Mode Behavior
|
|
1886
1898
|
|
package/docs/models.md
CHANGED
|
@@ -129,7 +129,7 @@ The `apiKey` and `headers` fields support three formats:
|
|
|
129
129
|
| Field | Required | Default | Description |
|
|
130
130
|
|-------|----------|---------|-------------|
|
|
131
131
|
| `id` | Yes | — | Model identifier (passed to the API) |
|
|
132
|
-
| `name` | No | `id` |
|
|
132
|
+
| `name` | No | `id` | Human-readable model label. Used for matching (`--model` patterns) and shown in model details/status text. |
|
|
133
133
|
| `api` | No | provider's `api` | Override provider's API for this model |
|
|
134
134
|
| `reasoning` | No | `false` | Supports extended thinking |
|
|
135
135
|
| `input` | No | `["text"]` | Input types: `["text"]` or `["text", "image"]` |
|
|
@@ -137,6 +137,10 @@ The `apiKey` and `headers` fields support three formats:
|
|
|
137
137
|
| `maxTokens` | No | `16384` | Maximum output tokens |
|
|
138
138
|
| `cost` | No | all zeros | `{"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}` (per million tokens) |
|
|
139
139
|
|
|
140
|
+
Current behavior:
|
|
141
|
+
- `/model` and `--list-models` list entries by model `id`.
|
|
142
|
+
- The configured `name` is used for model matching and detail/status text.
|
|
143
|
+
|
|
140
144
|
## Overriding Built-in Providers
|
|
141
145
|
|
|
142
146
|
Route a built-in provider through a proxy without redefining models:
|
package/docs/settings.md
CHANGED
|
@@ -42,6 +42,7 @@ Edit directly or use `/settings` for common options.
|
|
|
42
42
|
| `quietStartup` | boolean | `false` | Hide startup header |
|
|
43
43
|
| `collapseChangelog` | boolean | `false` | Show condensed changelog after updates |
|
|
44
44
|
| `doubleEscapeAction` | string | `"tree"` | Action for double-escape: `"tree"`, `"fork"`, or `"none"` |
|
|
45
|
+
| `treeFilterMode` | string | `"default"` | Default filter for `/tree`: `"default"`, `"no-tools"`, `"user-only"`, `"labeled-only"`, `"all"` |
|
|
45
46
|
| `editorPaddingX` | number | `0` | Horizontal padding for input editor (0-3) |
|
|
46
47
|
| `autocompleteMaxVisible` | number | `5` | Max visible items in autocomplete dropdown (3-20) |
|
|
47
48
|
| `showHardwareCursor` | boolean | `false` | Show terminal cursor |
|
package/docs/tmux.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# tmux Setup
|
|
2
|
+
|
|
3
|
+
Pi works inside tmux, but tmux strips modifier information from certain keys by default. Without configuration, `Shift+Enter` and `Ctrl+Enter` are indistinguishable from plain `Enter`.
|
|
4
|
+
|
|
5
|
+
## Required Configuration
|
|
6
|
+
|
|
7
|
+
Add to `~/.tmux.conf`:
|
|
8
|
+
|
|
9
|
+
```tmux
|
|
10
|
+
set -g extended-keys on
|
|
11
|
+
set -g extended-keys-format csi-u
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then restart tmux (not just reload):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
tmux kill-server
|
|
18
|
+
tmux
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This tells tmux to forward modified key sequences in CSI-u format when an application requests extended key reporting. Pi requests this automatically when Kitty keyboard protocol is not available.
|
|
22
|
+
|
|
23
|
+
## What This Fixes
|
|
24
|
+
|
|
25
|
+
Without this config, tmux collapses modified enter keys to plain `\r`:
|
|
26
|
+
|
|
27
|
+
| Key | Without config | With config |
|
|
28
|
+
|-----|---------------|-------------|
|
|
29
|
+
| Enter | `\r` | `\r` |
|
|
30
|
+
| Shift+Enter | `\r` | `\x1b[13;2u` |
|
|
31
|
+
| Ctrl+Enter | `\r` | `\x1b[13;5u` |
|
|
32
|
+
| Alt/Option+Enter | `\x1b\r` | `\x1b[13;3u` |
|
|
33
|
+
|
|
34
|
+
This affects the default keybindings (`Enter` to submit, `Shift+Enter` for newline) and any custom keybindings using modified enter keys.
|
|
35
|
+
|
|
36
|
+
## Requirements
|
|
37
|
+
|
|
38
|
+
- tmux 3.2 or later (run `tmux -V` to check)
|
|
39
|
+
- A terminal emulator that supports extended keys (Ghostty, Kitty, iTerm2, WezTerm, Windows Terminal)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "1.7.
|
|
9
|
+
"version": "1.7.3",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -21,11 +21,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
21
21
|
execute: async (_toolCallId, params) => {
|
|
22
22
|
const result = ms(params.duration as ms.StringValue);
|
|
23
23
|
if (result === undefined) {
|
|
24
|
-
|
|
25
|
-
content: [{ type: "text", text: `Invalid duration: "${params.duration}"` }],
|
|
26
|
-
isError: true,
|
|
27
|
-
details: {},
|
|
28
|
-
};
|
|
24
|
+
throw new Error(`Invalid duration: "${params.duration}"`);
|
|
29
25
|
}
|
|
30
26
|
return {
|
|
31
27
|
content: [{ type: "text", text: `${params.duration} = ${result} milliseconds` }],
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "1.20.
|
|
9
|
+
"version": "1.20.3",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mariozechner/pi-coding-agent",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.3",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@mariozechner/jiti": "^2.6.2",
|
|
43
|
-
"@mariozechner/pi-agent-core": "^0.56.
|
|
44
|
-
"@mariozechner/pi-ai": "^0.56.
|
|
45
|
-
"@mariozechner/pi-tui": "^0.56.
|
|
43
|
+
"@mariozechner/pi-agent-core": "^0.56.3",
|
|
44
|
+
"@mariozechner/pi-ai": "^0.56.3",
|
|
45
|
+
"@mariozechner/pi-tui": "^0.56.3",
|
|
46
46
|
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
47
47
|
"chalk": "^5.5.0",
|
|
48
48
|
"cli-highlight": "^2.1.11",
|