@mariozechner/pi-coding-agent 0.56.2 → 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 +26 -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 +1 -0
- 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/settings-manager.d.ts +1 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +26 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +13 -4
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/compaction.md +2 -0
- package/docs/extensions.md +13 -1
- 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/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/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",
|