@mariozechner/pi-coding-agent 0.57.0 → 0.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/README.md +1 -1
  3. package/dist/core/export-html/index.d.ts +5 -2
  4. package/dist/core/export-html/index.d.ts.map +1 -1
  5. package/dist/core/export-html/index.js +4 -3
  6. package/dist/core/export-html/index.js.map +1 -1
  7. package/dist/core/export-html/template.js +11 -14
  8. package/dist/core/export-html/tool-renderer.d.ts +5 -2
  9. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  10. package/dist/core/export-html/tool-renderer.js +12 -5
  11. package/dist/core/export-html/tool-renderer.js.map +1 -1
  12. package/dist/core/extensions/index.d.ts +1 -1
  13. package/dist/core/extensions/index.d.ts.map +1 -1
  14. package/dist/core/extensions/index.js.map +1 -1
  15. package/dist/core/extensions/types.d.ts +13 -1
  16. package/dist/core/extensions/types.d.ts.map +1 -1
  17. package/dist/core/extensions/types.js.map +1 -1
  18. package/dist/core/resource-loader.d.ts.map +1 -1
  19. package/dist/core/resource-loader.js +1 -1
  20. package/dist/core/resource-loader.js.map +1 -1
  21. package/dist/main.d.ts.map +1 -1
  22. package/dist/main.js +41 -11
  23. package/dist/main.js.map +1 -1
  24. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  25. package/dist/modes/interactive/components/extension-editor.js +1 -0
  26. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  27. package/dist/modes/interactive/components/tree-selector.d.ts +17 -0
  28. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  29. package/dist/modes/interactive/components/tree-selector.js +111 -6
  30. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  31. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  32. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  33. package/dist/modes/interactive/interactive-mode.js +45 -0
  34. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  35. package/docs/extensions.md +25 -2
  36. package/docs/keybindings.md +9 -1
  37. package/docs/terminal-setup.md +18 -1
  38. package/docs/tmux.md +30 -8
  39. package/docs/tree.md +9 -0
  40. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  41. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  42. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  43. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  44. package/examples/extensions/with-deps/package-lock.json +2 -2
  45. package/examples/extensions/with-deps/package.json +1 -1
  46. package/package.json +4 -4
@@ -225,8 +225,9 @@ Run `npm install` in the extension directory, then imports from `node_modules/`
225
225
  ### Lifecycle Overview
226
226
 
227
227
  ```
228
- pi starts
228
+ pi starts (CLI only)
229
229
 
230
+ ├─► session_directory (CLI startup only, no ctx)
230
231
  └─► session_start
231
232
 
232
233
 
@@ -285,6 +286,26 @@ exit (Ctrl+C, Ctrl+D)
285
286
 
286
287
  See [session.md](session.md) for session storage internals and the SessionManager API.
287
288
 
289
+ #### session_directory
290
+
291
+ Fired by the `pi` CLI during startup session resolution, before the initial session manager is created.
292
+
293
+ This event is:
294
+ - CLI-only. It is not emitted in SDK mode.
295
+ - Startup-only. It is not emitted for later interactive `/new` or `/resume` actions.
296
+ - Bypassed when `--session-dir` is provided.
297
+ - Special-cased to receive no `ctx` argument.
298
+
299
+ If multiple extensions return `sessionDir`, the last one wins.
300
+
301
+ ```typescript
302
+ pi.on("session_directory", async (event) => {
303
+ return {
304
+ sessionDir: `/tmp/pi-sessions/${encodeURIComponent(event.cwd)}`,
305
+ };
306
+ });
307
+ ```
308
+
288
309
  #### session_start
289
310
 
290
311
  Fired on initial session load.
@@ -674,7 +695,9 @@ Transforms chain across handlers. See [input-transform.ts](../examples/extension
674
695
 
675
696
  ## ExtensionContext
676
697
 
677
- Every handler receives `ctx: ExtensionContext`:
698
+ All handlers except `session_directory` receive `ctx: ExtensionContext`.
699
+
700
+ `session_directory` is a CLI startup hook and receives only the event.
678
701
 
679
702
  ### ctx.ui
680
703
 
@@ -7,11 +7,12 @@ All keyboard shortcuts can be customized via `~/.pi/agent/keybindings.json`. Eac
7
7
  `modifier+key` where modifiers are `ctrl`, `shift`, `alt` (combinable) and keys are:
8
8
 
9
9
  - **Letters:** `a-z`
10
+ - **Digits:** `0-9`
10
11
  - **Special:** `escape`, `esc`, `enter`, `return`, `tab`, `space`, `backspace`, `delete`, `insert`, `clear`, `home`, `end`, `pageUp`, `pageDown`, `up`, `down`, `left`, `right`
11
12
  - **Function:** `f1`-`f12`
12
13
  - **Symbols:** `` ` ``, `-`, `=`, `[`, `]`, `\`, `;`, `'`, `,`, `.`, `/`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `(`, `)`, `_`, `+`, `|`, `~`, `{`, `}`, `:`, `<`, `>`, `?`
13
14
 
14
- Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, etc.
15
+ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, `ctrl+1`, etc.
15
16
 
16
17
  ## All Actions
17
18
 
@@ -119,6 +120,13 @@ Modifier combinations: `ctrl+shift+x`, `alt+ctrl+x`, `ctrl+shift+alt+x`, etc.
119
120
  | `selectConfirm` | `enter` | Confirm selection |
120
121
  | `selectCancel` | `escape`, `ctrl+c` | Cancel selection |
121
122
 
123
+ ### Tree Navigation
124
+
125
+ | Action | Default | Description |
126
+ |--------|---------|-------------|
127
+ | `treeFoldOrUp` | `ctrl+left`, `alt+left` | Fold current branch segment, or jump to the previous segment start |
128
+ | `treeUnfoldOrDown` | `ctrl+right`, `alt+right` | Unfold current branch segment, or jump to the next segment start or branch end |
129
+
122
130
  ### Session Picker
123
131
 
124
132
  | Action | Default | Description |
@@ -8,13 +8,30 @@ Work out of the box.
8
8
 
9
9
  ## Ghostty
10
10
 
11
- Add to your Ghostty config (`~/.config/ghostty/config`):
11
+ Add to your Ghostty config (`~/Library/Application Support/com.mitchellh.ghostty/config` on macOS, `~/.config/ghostty/config` on Linux):
12
12
 
13
13
  ```
14
14
  keybind = alt+backspace=text:\x1b\x7f
15
+ ```
16
+
17
+ Older Claude Code versions may have added this Ghostty mapping:
18
+
19
+ ```
15
20
  keybind = shift+enter=text:\n
16
21
  ```
17
22
 
23
+ That mapping sends a raw linefeed byte. Inside pi, that is indistinguishable from `Ctrl+J`, so tmux and pi no longer see a real `shift+enter` key event.
24
+
25
+ If Claude Code 2.x or newer is the only reason you added that mapping, you can remove it, unless you want to use Claude Code in tmux, where it still requires that Ghostty mapping.
26
+
27
+ If you want `Shift+Enter` to keep working in tmux via that remap, add `ctrl+j` to your pi `newLine` keybinding in `~/.pi/agent/keybindings.json`:
28
+
29
+ ```json
30
+ {
31
+ "newLine": ["shift+enter", "ctrl+j"]
32
+ }
33
+ ```
34
+
18
35
  ## WezTerm
19
36
 
20
37
  Create `~/.wezterm.lua`:
package/docs/tmux.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # tmux Setup
2
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`.
3
+ Pi works inside tmux, but tmux strips modifier information from certain keys by default. Without configuration, `Shift+Enter` and `Ctrl+Enter` are usually indistinguishable from plain `Enter`.
4
4
 
5
- ## Required Configuration
5
+ ## Recommended Configuration
6
6
 
7
7
  Add to `~/.tmux.conf`:
8
8
 
@@ -11,27 +11,49 @@ set -g extended-keys on
11
11
  set -g extended-keys-format csi-u
12
12
  ```
13
13
 
14
- Then restart tmux (not just reload):
14
+ Then restart tmux fully:
15
15
 
16
16
  ```bash
17
17
  tmux kill-server
18
18
  tmux
19
19
  ```
20
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.
21
+ Pi requests extended key reporting automatically when Kitty keyboard protocol is not available. With `extended-keys-format csi-u`, tmux forwards modified keys in CSI-u format, which is the most reliable configuration.
22
+
23
+ ## Why `csi-u` Is Recommended
24
+
25
+ With only:
26
+
27
+ ```tmux
28
+ set -g extended-keys on
29
+ ```
30
+
31
+ tmux defaults to `extended-keys-format xterm`. When an application requests extended key reporting, modified keys are forwarded in xterm `modifyOtherKeys` format such as:
32
+
33
+ - `Ctrl+C` → `\x1b[27;5;99~`
34
+ - `Ctrl+D` → `\x1b[27;5;100~`
35
+ - `Ctrl+Enter` → `\x1b[27;5;13~`
36
+
37
+ With `extended-keys-format csi-u`, the same keys are forwarded as:
38
+
39
+ - `Ctrl+C` → `\x1b[99;5u`
40
+ - `Ctrl+D` → `\x1b[100;5u`
41
+ - `Ctrl+Enter` → `\x1b[13;5u`
42
+
43
+ Pi supports both formats, but `csi-u` is the recommended tmux setup.
22
44
 
23
45
  ## What This Fixes
24
46
 
25
- Without this config, tmux collapses modified enter keys to plain `\r`:
47
+ Without tmux extended keys, modified Enter keys collapse to legacy sequences:
26
48
 
27
- | Key | Without config | With config |
28
- |-----|---------------|-------------|
49
+ | Key | Without extkeys | With `csi-u` |
50
+ |-----|-----------------|--------------|
29
51
  | Enter | `\r` | `\r` |
30
52
  | Shift+Enter | `\r` | `\x1b[13;2u` |
31
53
  | Ctrl+Enter | `\r` | `\x1b[13;5u` |
32
54
  | Alt/Option+Enter | `\x1b\r` | `\x1b[13;3u` |
33
55
 
34
- This affects the default keybindings (`Enter` to submit, `Shift+Enter` for newline) and any custom keybindings using modified enter keys.
56
+ This affects the default keybindings (`Enter` to submit, `Shift+Enter` for newline) and any custom keybindings using modified Enter.
35
57
 
36
58
  ## Requirements
37
59
 
package/docs/tree.md CHANGED
@@ -33,16 +33,25 @@ Sessions are stored as trees where each entry has an `id` and `parentId`. The "l
33
33
  | Key | Action |
34
34
  |-----|--------|
35
35
  | ↑/↓ | Navigate (depth-first order) |
36
+ | ←/→ | Page up/down |
37
+ | Ctrl+←/Ctrl+→ or Alt+←/Alt+→ | Fold/unfold and jump between branch segments |
36
38
  | Enter | Select node |
37
39
  | Escape/Ctrl+C | Cancel |
38
40
  | Ctrl+U | Toggle: user messages only |
39
41
  | Ctrl+O | Toggle: show all (including custom/label entries) |
40
42
 
43
+ `Ctrl+←` or `Alt+←` folds the current node if it is foldable. Foldable nodes are roots and branch segment starts that have visible children. If the current node is not foldable, or is already folded, the selection jumps up to the previous visible branch segment start.
44
+
45
+ `Ctrl+→` or `Alt+→` unfolds the current node if it is folded. Otherwise, the selection jumps down to the next visible branch segment start, or to the branch end when there is no further branch point.
46
+
41
47
  ### Display
42
48
 
43
49
  - Height: half terminal height
44
50
  - Current leaf marked with `← active`
45
51
  - Labels shown inline: `[label-name]`
52
+ - Foldable branch starts show `⊟` in the connector. Folded branches show `⊞`
53
+ - Active path marker `•` appears after the fold indicator when applicable
54
+ - Search and filter changes reset all folds
46
55
  - Default filter hides `label` and `custom` entries (shown in Ctrl+O mode)
47
56
  - Children sorted by timestamp (oldest first)
48
57
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.8.0",
9
+ "version": "1.8.1",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-qwen-cli",
3
3
  "private": true,
4
- "version": "1.7.0",
4
+ "version": "1.7.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "1.21.0",
3
+ "version": "1.21.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "1.21.0",
9
+ "version": "1.21.1",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "1.21.0",
4
+ "version": "1.21.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mariozechner/pi-coding-agent",
3
- "version": "0.57.0",
3
+ "version": "0.57.1",
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.57.0",
44
- "@mariozechner/pi-ai": "^0.57.0",
45
- "@mariozechner/pi-tui": "^0.57.0",
43
+ "@mariozechner/pi-agent-core": "^0.57.1",
44
+ "@mariozechner/pi-ai": "^0.57.1",
45
+ "@mariozechner/pi-tui": "^0.57.1",
46
46
  "@silvia-odwyer/photon-node": "^0.3.4",
47
47
  "chalk": "^5.5.0",
48
48
  "cli-highlight": "^2.1.11",