@dyyz1993/pi-coding-agent 0.70.5 → 0.74.4
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 +266 -80
- package/README.md +48 -20
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +4 -2
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts +13 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +32 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +34 -22
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +2 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +9 -4
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +16 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +238 -66
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +10 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +14 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -1
- 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 +25 -26
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1042 -1116
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/agent-types.d.ts +58 -0
- package/dist/core/agent-types.d.ts.map +1 -0
- package/dist/core/agent-types.js +203 -0
- package/dist/core/agent-types.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +9 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +20 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +9 -6
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +0 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +1 -1
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/template.css +53 -4
- package/dist/core/export-html/template.js +84 -20
- package/dist/core/export-html/tool-renderer.d.ts +0 -6
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +15 -2
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/channel-factory.d.ts +13 -0
- package/dist/core/extensions/channel-factory.d.ts.map +1 -0
- package/dist/core/extensions/channel-factory.js +19 -0
- package/dist/core/extensions/channel-factory.js.map +1 -0
- package/dist/core/extensions/channel-registry.d.ts +28 -0
- package/dist/core/extensions/channel-registry.d.ts.map +1 -0
- package/dist/core/extensions/channel-registry.js +12 -0
- package/dist/core/extensions/channel-registry.js.map +1 -0
- package/dist/core/extensions/index.d.ts +4 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -0
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +0 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +49 -137
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +24 -20
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +128 -253
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/server-channel.d.ts +8 -8
- package/dist/core/extensions/server-channel.d.ts.map +1 -1
- package/dist/core/extensions/server-channel.js.map +1 -1
- package/dist/core/extensions/types.d.ts +88 -60
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +10 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/file-store/file-snapshot-manager.d.ts +95 -0
- package/dist/core/file-store/file-snapshot-manager.d.ts.map +1 -0
- package/dist/core/file-store/file-snapshot-manager.js +508 -0
- package/dist/core/file-store/file-snapshot-manager.js.map +1 -0
- package/dist/core/file-store/index.d.ts +5 -0
- package/dist/core/file-store/index.d.ts.map +1 -0
- package/dist/core/file-store/index.js +3 -0
- package/dist/core/file-store/index.js.map +1 -0
- package/dist/core/messages.d.ts +10 -2
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +23 -6
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts +19 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +97 -16
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +24 -15
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-manager.d.ts +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +61 -35
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +32 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +9 -21
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +9 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +39 -18
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +27 -17
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +133 -47
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +21 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +51 -6
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +3 -8
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -3
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash.d.ts +0 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +108 -154
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +3 -2
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +4 -3
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +50 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +178 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/output-collector.d.ts +35 -0
- package/dist/core/tools/output-collector.d.ts.map +1 -0
- package/dist/core/tools/output-collector.js +79 -0
- package/dist/core/tools/output-collector.js.map +1 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +70 -13
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/spawn-managed.d.ts +18 -0
- package/dist/core/tools/spawn-managed.d.ts.map +1 -0
- package/dist/core/tools/spawn-managed.js +52 -0
- package/dist/core/tools/spawn-managed.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +17 -39
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +3 -3
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +3 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +1 -4
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +14 -56
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +5 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +19 -4
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +1 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +18 -6
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +93 -25
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +3 -7
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +5 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +53 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +20 -4
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +423 -186
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/print-mode.d.ts +3 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +62 -19
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +80 -60
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +108 -93
- 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 +106 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +115 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +238 -12
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/child-process.d.ts +1 -0
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +8 -0
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -2
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +84 -45
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/paths.d.ts +9 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +31 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +5 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/structured-output.d.ts +10 -0
- package/dist/utils/structured-output.d.ts.map +1 -0
- package/dist/utils/structured-output.js +57 -0
- package/dist/utils/structured-output.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +6 -2
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +77 -0
- package/dist/utils/version-check.js.map +1 -0
- package/docs/compaction.md +14 -14
- package/docs/custom-provider.md +40 -31
- package/docs/development.md +1 -1
- package/docs/docs.json +148 -0
- package/docs/extensions.md +116 -56
- package/docs/index.md +70 -0
- package/docs/json.md +4 -4
- package/docs/models.md +150 -3
- package/docs/packages.md +10 -5
- package/docs/providers.md +62 -17
- package/docs/quickstart.md +142 -0
- package/docs/rollback-architecture.md +693 -0
- package/docs/rollback-test-cases.md +412 -0
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +26 -26
- package/docs/{session.md → session-format.md} +6 -6
- package/docs/sessions.md +137 -0
- package/docs/settings.md +52 -9
- package/docs/termux.md +1 -1
- package/docs/themes.md +2 -2
- package/docs/tui.md +20 -20
- package/docs/usage.md +277 -0
- package/examples/extensions/README.md +2 -4
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/commands.ts +2 -2
- 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/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/git-checkpoint.ts +1 -1
- package/examples/extensions/handoff.ts +49 -11
- package/examples/extensions/plan-mode/index.ts +1 -1
- package/examples/extensions/sandbox/package-lock.json +5 -5
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/README.md +2 -2
- package/package.json +7 -15
- package/docs/tree.md +0 -233
- package/examples/extensions/antigravity-image-gen.ts +0 -418
package/docs/sessions.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Sessions
|
|
2
|
+
|
|
3
|
+
Pi saves conversations as sessions so you can continue work, branch from earlier turns, and revisit previous paths.
|
|
4
|
+
|
|
5
|
+
## Session Storage
|
|
6
|
+
|
|
7
|
+
Sessions auto-save to `~/.pi/agent/sessions/`, organized by working directory. Each session is a JSONL file with a tree structure.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pi -c # Continue most recent session
|
|
11
|
+
pi -r # Browse and select from past sessions
|
|
12
|
+
pi --no-session # Ephemeral mode; do not save
|
|
13
|
+
pi --session <path|id> # Use a specific session file or partial session ID
|
|
14
|
+
pi --fork <path|id> # Fork a session file or partial session ID into a new session
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Use `/session` in interactive mode to see the current session file, session ID, message count, tokens, and cost.
|
|
18
|
+
|
|
19
|
+
For the JSONL file format and SessionManager API, see [Session Format](session-format.md).
|
|
20
|
+
|
|
21
|
+
## Session Commands
|
|
22
|
+
|
|
23
|
+
| Command | Description |
|
|
24
|
+
|---------|-------------|
|
|
25
|
+
| `/resume` | Browse and select previous sessions |
|
|
26
|
+
| `/new` | Start a new session |
|
|
27
|
+
| `/name <name>` | Set the current session display name |
|
|
28
|
+
| `/session` | Show session info |
|
|
29
|
+
| `/tree` | Navigate the current session tree |
|
|
30
|
+
| `/fork` | Create a new session from a previous user message |
|
|
31
|
+
| `/clone` | Duplicate the current active branch into a new session |
|
|
32
|
+
| `/compact [prompt]` | Summarize older context; see [Compaction](compaction.md) |
|
|
33
|
+
| `/export [file]` | Export session to HTML |
|
|
34
|
+
| `/share` | Upload as private GitHub gist with shareable HTML link |
|
|
35
|
+
|
|
36
|
+
## Resuming and Deleting Sessions
|
|
37
|
+
|
|
38
|
+
`/resume` opens an interactive session picker for the current project. `pi -r` opens the same picker at startup.
|
|
39
|
+
|
|
40
|
+
In the picker you can:
|
|
41
|
+
|
|
42
|
+
- search by typing
|
|
43
|
+
- toggle path display with Ctrl+P
|
|
44
|
+
- toggle sort mode with Ctrl+S
|
|
45
|
+
- filter to named sessions with Ctrl+N
|
|
46
|
+
- rename with Ctrl+R
|
|
47
|
+
- delete with Ctrl+D, then confirm
|
|
48
|
+
|
|
49
|
+
When available, pi uses the `trash` CLI for deletion instead of permanently removing files.
|
|
50
|
+
|
|
51
|
+
## Naming Sessions
|
|
52
|
+
|
|
53
|
+
Use `/name <name>` to set a human-readable session name:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
/name Refactor auth module
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Named sessions are easier to find in `/resume` and `pi -r`.
|
|
60
|
+
|
|
61
|
+
## Branching with `/tree`
|
|
62
|
+
|
|
63
|
+
Sessions are stored as trees. Every entry has an `id` and `parentId`, and the current position is the active leaf. `/tree` lets you jump to any previous point and continue from there without creating a new file.
|
|
64
|
+
|
|
65
|
+
<p align="center"><img src="images/tree-view.png" alt="Tree View" width="600"></p>
|
|
66
|
+
|
|
67
|
+
Example shape:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
├─ user: "Hello, can you help..."
|
|
71
|
+
│ └─ assistant: "Of course! I can..."
|
|
72
|
+
│ ├─ user: "Let's try approach A..."
|
|
73
|
+
│ │ └─ assistant: "For approach A..."
|
|
74
|
+
│ │ └─ user: "That worked..." ← active
|
|
75
|
+
│ └─ user: "Actually, approach B..."
|
|
76
|
+
│ └─ assistant: "For approach B..."
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Tree Controls
|
|
80
|
+
|
|
81
|
+
| Key | Action |
|
|
82
|
+
|-----|--------|
|
|
83
|
+
| ↑/↓ | Navigate visible entries |
|
|
84
|
+
| ←/→ | Page up/down |
|
|
85
|
+
| Ctrl+←/Ctrl+→ or Alt+←/Alt+→ | Fold/unfold or jump between branch segments |
|
|
86
|
+
| Shift+L | Set or clear a label on the selected entry |
|
|
87
|
+
| Shift+T | Toggle label timestamps |
|
|
88
|
+
| Enter | Select entry |
|
|
89
|
+
| Escape/Ctrl+C | Cancel |
|
|
90
|
+
| Ctrl+O | Cycle filter mode |
|
|
91
|
+
|
|
92
|
+
Filter modes are: default, no-tools, user-only, labeled-only, and all. Configure the default with `treeFilterMode` in [Settings](settings.md).
|
|
93
|
+
|
|
94
|
+
### Selection Behavior
|
|
95
|
+
|
|
96
|
+
Selecting a user or custom message:
|
|
97
|
+
|
|
98
|
+
1. Moves the leaf to the selected message's parent.
|
|
99
|
+
2. Places the selected message text in the editor.
|
|
100
|
+
3. Lets you edit and resubmit, creating a new branch.
|
|
101
|
+
|
|
102
|
+
Selecting an assistant, tool, compaction, or other non-user entry:
|
|
103
|
+
|
|
104
|
+
1. Moves the leaf to that entry.
|
|
105
|
+
2. Leaves the editor empty.
|
|
106
|
+
3. Lets you continue from that point.
|
|
107
|
+
|
|
108
|
+
Selecting the root user message resets the leaf to an empty conversation and places the original prompt in the editor.
|
|
109
|
+
|
|
110
|
+
## `/tree`, `/fork`, and `/clone`
|
|
111
|
+
|
|
112
|
+
| Feature | `/tree` | `/fork` | `/clone` |
|
|
113
|
+
|---------|---------|---------|----------|
|
|
114
|
+
| Output | Same session file | New session file | New session file |
|
|
115
|
+
| View | Full tree | User-message selector | Current active branch |
|
|
116
|
+
| Typical use | Explore alternatives in place | Start a new session from an earlier prompt | Duplicate current work before continuing |
|
|
117
|
+
| Summary | Optional branch summary | None | None |
|
|
118
|
+
|
|
119
|
+
Use `/tree` when you want to keep alternatives together. Use `/fork` or `/clone` when you want a separate session file.
|
|
120
|
+
|
|
121
|
+
## Branch Summaries
|
|
122
|
+
|
|
123
|
+
When `/tree` switches away from one branch to another, pi can summarize the abandoned branch and attach that summary at the new position. This preserves important context from the path you left without replaying the whole branch.
|
|
124
|
+
|
|
125
|
+
When prompted, choose one of:
|
|
126
|
+
|
|
127
|
+
1. no summary
|
|
128
|
+
2. summarize with the default prompt
|
|
129
|
+
3. summarize with custom focus instructions
|
|
130
|
+
|
|
131
|
+
See [Compaction](compaction.md) for branch summarization internals and extension hooks.
|
|
132
|
+
|
|
133
|
+
## Session Format
|
|
134
|
+
|
|
135
|
+
Session files are JSONL and contain message entries, model changes, thinking-level changes, labels, compactions, branch summaries, and extension entries.
|
|
136
|
+
|
|
137
|
+
For parsers, extensions, SDK usage, and the full SessionManager API, see [Session Format](session-format.md).
|
package/docs/settings.md
CHANGED
|
@@ -20,6 +20,7 @@ Edit directly or use `/settings` for common options.
|
|
|
20
20
|
| `defaultThinkingLevel` | string | - | `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"` |
|
|
21
21
|
| `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
|
|
22
22
|
| `thinkingBudgets` | object | - | Custom token budgets per thinking level |
|
|
23
|
+
| `tierModels` | `Record<string, string>` | `{ fast: "anthropic/claude-haiku-4", pro: "anthropic/claude-sonnet-4-20250514", max: "anthropic/claude-opus-4-6" }` | Model alias mapping. Maps short names (like "fast", "pro", "max") to concrete model identifiers in `provider/modelId` format. These aliases work everywhere a model can be specified: CLI `--model`, `settings.json` defaultModel, `/model` command, agent configs, and extension APIs. Only override the aliases you need. Unspecified aliases use the hardcoded defaults. Set in `.pi/settings.json` for per-project overrides. Scope: Global + Project |
|
|
23
24
|
|
|
24
25
|
#### thinkingBudgets
|
|
25
26
|
|
|
@@ -34,6 +35,17 @@ Edit directly or use `/settings` for common options.
|
|
|
34
35
|
}
|
|
35
36
|
```
|
|
36
37
|
|
|
38
|
+
#### tierModels
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"tierModels": {
|
|
43
|
+
"fast": "openai/gpt-4o-mini",
|
|
44
|
+
"pro": "google/gemini-2.5-pro"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
37
49
|
### UI & Display
|
|
38
50
|
|
|
39
51
|
| Setting | Type | Default | Description |
|
|
@@ -41,13 +53,33 @@ Edit directly or use `/settings` for common options.
|
|
|
41
53
|
| `theme` | string | `"dark"` | Theme name (`"dark"`, `"light"`, or custom) |
|
|
42
54
|
| `quietStartup` | boolean | `false` | Hide startup header |
|
|
43
55
|
| `collapseChangelog` | boolean | `false` | Show condensed changelog after updates |
|
|
44
|
-
| `enableInstallTelemetry` | boolean | `true` | Send an anonymous
|
|
56
|
+
| `enableInstallTelemetry` | boolean | `true` | Send an anonymous install/update version ping after first install or changelog-detected updates. This does not control update checks |
|
|
45
57
|
| `doubleEscapeAction` | string | `"tree"` | Action for double-escape: `"tree"`, `"fork"`, or `"none"` |
|
|
46
58
|
| `treeFilterMode` | string | `"default"` | Default filter for `/tree`: `"default"`, `"no-tools"`, `"user-only"`, `"labeled-only"`, `"all"` |
|
|
47
59
|
| `editorPaddingX` | number | `0` | Horizontal padding for input editor (0-3) |
|
|
48
60
|
| `autocompleteMaxVisible` | number | `5` | Max visible items in autocomplete dropdown (3-20) |
|
|
49
61
|
| `showHardwareCursor` | boolean | `false` | Show terminal cursor |
|
|
50
62
|
|
|
63
|
+
### Telemetry and update checks
|
|
64
|
+
|
|
65
|
+
`enableInstallTelemetry` only controls the anonymous install/update ping to `https://pi.dev/api/report-install`. Opting out of telemetry does not disable update checks; Pi can still fetch `https://pi.dev/api/latest-version` to look for the latest version.
|
|
66
|
+
|
|
67
|
+
Set `PI_SKIP_VERSION_CHECK=1` to disable the Pi version update check. Use `--offline` or `PI_OFFLINE=1` to disable all startup network operations described here, including update checks, package update checks, and install/update telemetry.
|
|
68
|
+
|
|
69
|
+
### Warnings
|
|
70
|
+
|
|
71
|
+
| Setting | Type | Default | Description |
|
|
72
|
+
|---------|------|---------|-------------|
|
|
73
|
+
| `warnings.anthropicExtraUsage` | boolean | `true` | Show a warning when Anthropic subscription auth may use paid extra usage |
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"warnings": {
|
|
78
|
+
"anthropicExtraUsage": false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
51
83
|
### Compaction
|
|
52
84
|
|
|
53
85
|
| Setting | Type | Default | Description |
|
|
@@ -77,12 +109,14 @@ Edit directly or use `/settings` for common options.
|
|
|
77
109
|
|
|
78
110
|
| Setting | Type | Default | Description |
|
|
79
111
|
|---------|------|---------|-------------|
|
|
80
|
-
| `retry.enabled` | boolean | `true` | Enable automatic retry on transient errors |
|
|
81
|
-
| `retry.maxRetries` | number | `3` | Maximum retry attempts |
|
|
82
|
-
| `retry.baseDelayMs` | number | `2000` | Base delay for exponential backoff (2s, 4s, 8s) |
|
|
83
|
-
| `retry.
|
|
112
|
+
| `retry.enabled` | boolean | `true` | Enable automatic agent-level retry on transient errors |
|
|
113
|
+
| `retry.maxRetries` | number | `3` | Maximum agent-level retry attempts |
|
|
114
|
+
| `retry.baseDelayMs` | number | `2000` | Base delay for agent-level exponential backoff (2s, 4s, 8s) |
|
|
115
|
+
| `retry.provider.timeoutMs` | number | SDK default | Provider/SDK request timeout in milliseconds |
|
|
116
|
+
| `retry.provider.maxRetries` | number | SDK default | Provider/SDK retry attempts |
|
|
117
|
+
| `retry.provider.maxRetryDelayMs` | number | `60000` | Max server-requested delay before failing (60s) |
|
|
84
118
|
|
|
85
|
-
When a provider requests a retry delay longer than `
|
|
119
|
+
When a provider requests a retry delay longer than `retry.provider.maxRetryDelayMs` (e.g., Google's "quota will reset after 5h"), the request fails immediately with an informative error instead of waiting silently. Set to `0` to disable the cap.
|
|
86
120
|
|
|
87
121
|
```json
|
|
88
122
|
{
|
|
@@ -90,7 +124,11 @@ When a provider requests a retry delay longer than `maxDelayMs` (e.g., Google's
|
|
|
90
124
|
"enabled": true,
|
|
91
125
|
"maxRetries": 3,
|
|
92
126
|
"baseDelayMs": 2000,
|
|
93
|
-
"
|
|
127
|
+
"provider": {
|
|
128
|
+
"timeoutMs": 3600000,
|
|
129
|
+
"maxRetries": 0,
|
|
130
|
+
"maxRetryDelayMs": 60000
|
|
131
|
+
}
|
|
94
132
|
}
|
|
95
133
|
}
|
|
96
134
|
```
|
|
@@ -127,7 +165,9 @@ When a provider requests a retry delay longer than `maxDelayMs` (e.g., Google's
|
|
|
127
165
|
}
|
|
128
166
|
```
|
|
129
167
|
|
|
130
|
-
`npmCommand` is used for all npm package-manager operations, including
|
|
168
|
+
`npmCommand` is used for all npm package-manager operations, including installs, uninstalls, and dependency installs inside git packages. Use argv-style entries exactly as the process should be launched. When `npmCommand` is configured, git package dependency installs use plain `install` to avoid npm-specific flags in wrappers or alternate package managers.
|
|
169
|
+
|
|
170
|
+
Normally the package manager's global modules location is queried using `root -g`. As a special case, if the first element of `npmCommand` is `"bun"`, the modules location will instead be queried with `pm bin -g`.
|
|
131
171
|
|
|
132
172
|
### Sessions
|
|
133
173
|
|
|
@@ -139,7 +179,7 @@ When a provider requests a retry delay longer than `maxDelayMs` (e.g., Google's
|
|
|
139
179
|
{ "sessionDir": ".pi/sessions" }
|
|
140
180
|
```
|
|
141
181
|
|
|
142
|
-
When multiple sources specify a session directory, `--session-dir`
|
|
182
|
+
When multiple sources specify a session directory, precedence is `--session-dir`, `PI_CODING_AGENT_SESSION_DIR`, then `sessionDir` in settings.json.
|
|
143
183
|
|
|
144
184
|
### Model Cycling
|
|
145
185
|
|
|
@@ -220,6 +260,9 @@ See [packages.md](packages.md) for package management details.
|
|
|
220
260
|
"maxRetries": 3
|
|
221
261
|
},
|
|
222
262
|
"enabledModels": ["claude-*", "gpt-4o"],
|
|
263
|
+
"warnings": {
|
|
264
|
+
"anthropicExtraUsage": true
|
|
265
|
+
},
|
|
223
266
|
"packages": ["pi-skills"]
|
|
224
267
|
}
|
|
225
268
|
```
|
package/docs/termux.md
CHANGED
package/docs/themes.md
CHANGED
|
@@ -52,7 +52,7 @@ vim ~/.pi/agent/themes/my-theme.json
|
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
54
|
{
|
|
55
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
55
|
+
"$schema": "https://raw.githubusercontent.com/dyyz1993/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
56
56
|
"name": "my-theme",
|
|
57
57
|
"vars": {
|
|
58
58
|
"primary": "#00aaff",
|
|
@@ -122,7 +122,7 @@ vim ~/.pi/agent/themes/my-theme.json
|
|
|
122
122
|
|
|
123
123
|
```json
|
|
124
124
|
{
|
|
125
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
125
|
+
"$schema": "https://raw.githubusercontent.com/dyyz1993/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
126
126
|
"name": "my-theme",
|
|
127
127
|
"vars": {
|
|
128
128
|
"blue": "#0066cc",
|
package/docs/tui.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
|
|
6
6
|
|
|
7
|
-
**Source:** [`@
|
|
7
|
+
**Source:** [`@dyyz1993/pi-tui`](https://github.com/dyyz1993/pi-mono/tree/main/packages/tui)
|
|
8
8
|
|
|
9
9
|
## Component Interface
|
|
10
10
|
|
|
@@ -33,7 +33,7 @@ The TUI appends a full SGR reset and OSC 8 reset at the end of each rendered lin
|
|
|
33
33
|
Components that display a text cursor and need IME (Input Method Editor) support should implement the `Focusable` interface:
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
import { CURSOR_MARKER, type Component, type Focusable } from "@
|
|
36
|
+
import { CURSOR_MARKER, type Component, type Focusable } from "@dyyz1993/pi-tui";
|
|
37
37
|
|
|
38
38
|
class MyInput implements Component, Focusable {
|
|
39
39
|
focused: boolean = false; // Set by TUI when focus changes
|
|
@@ -59,7 +59,7 @@ This enables IME candidate windows to appear at the correct position for CJK inp
|
|
|
59
59
|
When a container component (dialog, selector, etc.) contains an `Input` or `Editor` child, the container must implement `Focusable` and propagate the focus state to the child. Otherwise, the hardware cursor won't be positioned correctly for IME input.
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
|
-
import { Container, type Focusable, Input } from "@
|
|
62
|
+
import { Container, type Focusable, Input } from "@dyyz1993/pi-tui";
|
|
63
63
|
|
|
64
64
|
class SearchDialog extends Container implements Focusable {
|
|
65
65
|
private searchInput: Input;
|
|
@@ -179,10 +179,10 @@ See [overlay-qa-tests.ts](../examples/extensions/overlay-qa-tests.ts) for compre
|
|
|
179
179
|
|
|
180
180
|
## Built-in Components
|
|
181
181
|
|
|
182
|
-
Import from `@
|
|
182
|
+
Import from `@dyyz1993/pi-tui`:
|
|
183
183
|
|
|
184
184
|
```typescript
|
|
185
|
-
import { Text, Box, Container, Spacer, Markdown } from "@
|
|
185
|
+
import { Text, Box, Container, Spacer, Markdown } from "@dyyz1993/pi-tui";
|
|
186
186
|
```
|
|
187
187
|
|
|
188
188
|
### Text
|
|
@@ -264,7 +264,7 @@ const image = new Image(
|
|
|
264
264
|
Use `matchesKey()` for key detection:
|
|
265
265
|
|
|
266
266
|
```typescript
|
|
267
|
-
import { matchesKey, Key } from "@
|
|
267
|
+
import { matchesKey, Key } from "@dyyz1993/pi-tui";
|
|
268
268
|
|
|
269
269
|
handleInput(data: string) {
|
|
270
270
|
if (matchesKey(data, Key.up)) {
|
|
@@ -290,7 +290,7 @@ handleInput(data: string) {
|
|
|
290
290
|
**Critical:** Each line from `render()` must not exceed the `width` parameter.
|
|
291
291
|
|
|
292
292
|
```typescript
|
|
293
|
-
import { visibleWidth, truncateToWidth } from "@
|
|
293
|
+
import { visibleWidth, truncateToWidth } from "@dyyz1993/pi-tui";
|
|
294
294
|
|
|
295
295
|
render(width: number): string[] {
|
|
296
296
|
// Truncate long lines
|
|
@@ -311,7 +311,7 @@ Example: Interactive selector
|
|
|
311
311
|
import {
|
|
312
312
|
matchesKey, Key,
|
|
313
313
|
truncateToWidth, visibleWidth
|
|
314
|
-
} from "@
|
|
314
|
+
} from "@dyyz1993/pi-tui";
|
|
315
315
|
|
|
316
316
|
class MySelector {
|
|
317
317
|
private items: string[];
|
|
@@ -425,8 +425,8 @@ renderResult(result, options, theme, context) {
|
|
|
425
425
|
**For Markdown**, use `getMarkdownTheme()`:
|
|
426
426
|
|
|
427
427
|
```typescript
|
|
428
|
-
import { getMarkdownTheme } from "@
|
|
429
|
-
import { Markdown } from "@
|
|
428
|
+
import { getMarkdownTheme } from "@dyyz1993/pi-coding-agent";
|
|
429
|
+
import { Markdown } from "@dyyz1993/pi-tui";
|
|
430
430
|
|
|
431
431
|
renderResult(result, options, theme, context) {
|
|
432
432
|
const mdTheme = getMarkdownTheme();
|
|
@@ -587,12 +587,12 @@ These patterns cover the most common UI needs in extensions. **Copy these patter
|
|
|
587
587
|
|
|
588
588
|
### Pattern 1: Selection Dialog (SelectList)
|
|
589
589
|
|
|
590
|
-
For letting users pick from a list of options. Use `SelectList` from `@
|
|
590
|
+
For letting users pick from a list of options. Use `SelectList` from `@dyyz1993/pi-tui` with `DynamicBorder` for framing.
|
|
591
591
|
|
|
592
592
|
```typescript
|
|
593
|
-
import type { ExtensionAPI } from "@
|
|
594
|
-
import { DynamicBorder } from "@
|
|
595
|
-
import { Container, type SelectItem, SelectList, Text } from "@
|
|
593
|
+
import type { ExtensionAPI } from "@dyyz1993/pi-coding-agent";
|
|
594
|
+
import { DynamicBorder } from "@dyyz1993/pi-coding-agent";
|
|
595
|
+
import { Container, type SelectItem, SelectList, Text } from "@dyyz1993/pi-tui";
|
|
596
596
|
|
|
597
597
|
pi.registerCommand("pick", {
|
|
598
598
|
handler: async (_args, ctx) => {
|
|
@@ -650,7 +650,7 @@ pi.registerCommand("pick", {
|
|
|
650
650
|
For operations that take time and should be cancellable. `BorderedLoader` shows a spinner and handles escape to cancel.
|
|
651
651
|
|
|
652
652
|
```typescript
|
|
653
|
-
import { BorderedLoader } from "@
|
|
653
|
+
import { BorderedLoader } from "@dyyz1993/pi-coding-agent";
|
|
654
654
|
|
|
655
655
|
pi.registerCommand("fetch", {
|
|
656
656
|
handler: async (_args, ctx) => {
|
|
@@ -679,11 +679,11 @@ pi.registerCommand("fetch", {
|
|
|
679
679
|
|
|
680
680
|
### Pattern 3: Settings/Toggles (SettingsList)
|
|
681
681
|
|
|
682
|
-
For toggling multiple settings. Use `SettingsList` from `@
|
|
682
|
+
For toggling multiple settings. Use `SettingsList` from `@dyyz1993/pi-tui` with `getSettingsListTheme()`.
|
|
683
683
|
|
|
684
684
|
```typescript
|
|
685
|
-
import { getSettingsListTheme } from "@
|
|
686
|
-
import { Container, type SettingItem, SettingsList, Text } from "@
|
|
685
|
+
import { getSettingsListTheme } from "@dyyz1993/pi-coding-agent";
|
|
686
|
+
import { Container, type SettingItem, SettingsList, Text } from "@dyyz1993/pi-tui";
|
|
687
687
|
|
|
688
688
|
pi.registerCommand("settings", {
|
|
689
689
|
handler: async (_args, ctx) => {
|
|
@@ -822,8 +822,8 @@ Token stats available via `ctx.sessionManager.getBranch()` and `ctx.model`.
|
|
|
822
822
|
Replace the main input editor with a custom implementation. Useful for modal editing (vim), different keybindings (emacs), or specialized input handling.
|
|
823
823
|
|
|
824
824
|
```typescript
|
|
825
|
-
import { CustomEditor, type ExtensionAPI } from "@
|
|
826
|
-
import { matchesKey, truncateToWidth } from "@
|
|
825
|
+
import { CustomEditor, type ExtensionAPI } from "@dyyz1993/pi-coding-agent";
|
|
826
|
+
import { matchesKey, truncateToWidth } from "@dyyz1993/pi-tui";
|
|
827
827
|
|
|
828
828
|
type Mode = "normal" | "insert";
|
|
829
829
|
|