@kingingwang/pi-windows-x64 0.84.1 → 0.84.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/bin/CHANGELOG.md +168 -2
- package/bin/README.md +9 -4
- package/bin/docs/compaction.md +21 -6
- package/bin/docs/custom-provider.md +6 -3
- package/bin/docs/environment-variables.md +16 -10
- package/bin/docs/extensions.md +24 -9
- package/bin/docs/json.md +12 -5
- package/bin/docs/keybindings.md +22 -12
- package/bin/docs/llama-cpp.md +2 -0
- package/bin/docs/models.md +8 -2
- package/bin/docs/packages.md +2 -2
- package/bin/docs/providers.md +8 -1
- package/bin/docs/rpc.md +24 -7
- package/bin/docs/sdk.md +16 -2
- package/bin/docs/settings.md +41 -2
- package/bin/docs/skills.md +4 -3
- package/bin/docs/terminal-setup.md +34 -11
- package/bin/docs/themes.md +24 -3
- package/bin/docs/tui.md +2 -2
- package/bin/docs/usage.md +9 -4
- package/bin/docs/windows.md +24 -2
- package/bin/examples/extensions/border-status-editor.ts +1 -1
- package/bin/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/bin/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/bin/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/bin/examples/extensions/git-checkpoint.ts +2 -2
- package/bin/examples/extensions/gondolin/package-lock.json +2 -2
- package/bin/examples/extensions/gondolin/package.json +1 -1
- package/bin/examples/extensions/notify.ts +3 -1
- package/bin/examples/extensions/sandbox/package-lock.json +2 -2
- package/bin/examples/extensions/sandbox/package.json +1 -1
- package/bin/examples/extensions/subagent/README.md +3 -1
- package/bin/examples/extensions/subagent/agents.ts +40 -9
- package/bin/examples/extensions/subagent/index.ts +27 -4
- package/bin/examples/extensions/titlebar-spinner.ts +1 -1
- package/bin/examples/extensions/with-deps/package-lock.json +2 -2
- package/bin/examples/extensions/with-deps/package.json +1 -1
- package/bin/examples/rpc-extension-ui.ts +1 -1
- package/bin/examples/sdk/06-extensions.ts +1 -1
- package/bin/examples/sdk/README.md +1 -1
- package/bin/package.json +12 -14
- package/bin/pi.exe +0 -0
- package/bin/theme/dark.json +2 -0
- package/bin/theme/light.json +2 -0
- package/bin/theme/theme-schema.json +9 -1
- package/package.json +1 -1
- package/bin/node_modules/@mariozechner/clipboard-win32-x64-msvc/README.md +0 -3
- package/bin/node_modules/@mariozechner/clipboard-win32-x64-msvc/clipboard.win32-x64-msvc.node +0 -0
- package/bin/node_modules/@mariozechner/clipboard-win32-x64-msvc/package.json +0 -22
package/bin/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,175 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [0.84.3] - 2026-08-24
|
|
4
|
+
|
|
5
|
+
### New Features
|
|
6
|
+
|
|
7
|
+
- **PowerShell tool** — Use optional native PowerShell command execution on Windows. See [PowerShell Tool](docs/windows.md#powershell-tool).
|
|
8
|
+
- **Safer managed updates** — Stage, verify, and atomically activate updates for installer-managed installations. See [Install and Manage](docs/packages.md#install-and-manage).
|
|
9
|
+
- **Model and thinking controls** — Select thinking levels with `/thinking`, search defaults, keep selections session-scoped, and persist them explicitly with Ctrl+S. See [Models and Thinking](docs/keybindings.md#models-and-thinking).
|
|
10
|
+
|
|
11
|
+
### Breaking Changes
|
|
12
|
+
|
|
13
|
+
- Renamed the inherited `GoogleThinkingLevel` type to `GoogleApiThinkingLevel` and added `ResolvedGoogleThinkingLevel` for normalized adapter levels.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Added an optional `powershell` tool for Windows, configurable through `defaultTools` and the SDK. See [PowerShell Tool](docs/windows.md#powershell-tool).
|
|
18
|
+
- Added a `/thinking` selector and searchable default choices to the model and thinking selectors; Ctrl+S saves the selected model as the global default. See [Models and Thinking](docs/keybindings.md#models-and-thinking).
|
|
19
|
+
- Added optional routing session IDs to exported compaction summary helpers so callers can preserve provider routing without enabling prompt cache writes.
|
|
20
|
+
- Added transcript usage notices for compaction and branch summaries when cache miss notices are enabled.
|
|
21
|
+
- Added `session_compact_failed` extension events so compaction failures and aborts expose their reason, retry state, source, and error message to handlers ([#8175](https://github.com/earendil-works/pi/issues/8175)).
|
|
22
|
+
- Added inherited provider-neutral `toolChoice` support to simple stream requests.
|
|
23
|
+
- Added inherited automatic Anthropic server-side refusal fallback for supported first-party models, including returned-model usage pricing ([#8017](https://github.com/earendil-works/pi/issues/8017)).
|
|
24
|
+
- Added inherited configurable OpenAI-compatible thinking-token budget fields for vLLM, Qwen/SGLang, and llama.cpp servers. See [OpenAI Compatibility](docs/models.md#openai-compatibility) ([#8275](https://github.com/earendil-works/pi/pull/8275) by [@bnsd55](https://github.com/bnsd55)).
|
|
25
|
+
- Added inherited China-specific ZAI Coding Plan models, including GLM-4.6V vision support and API-equivalent usage cost estimates ([#8220](https://github.com/earendil-works/pi/issues/8220)).
|
|
26
|
+
- Added inherited `deepseek-v4-pro-0813` support to the Qwen Token Plan Individual catalog ([#8194](https://github.com/earendil-works/pi/issues/8194)).
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Changed experimental installer-managed installations so `pi update` stages, verifies, and atomically activates the selected release in place. See [Install and Manage](docs/packages.md#install-and-manage).
|
|
31
|
+
- Changed inherited built-in xAI models to use the Responses API with encrypted reasoning replay and made Grok 4.6 the default xAI model ([#8124](https://github.com/earendil-works/pi/pull/8124) by [@Jaaneek](https://github.com/Jaaneek)).
|
|
32
|
+
- Changed inherited Anthropic, Azure OpenAI, Google, Mistral, and OpenAI adapters to send Pi's default `User-Agent` unless overridden ([#8305](https://github.com/earendil-works/pi/issues/8305)).
|
|
33
|
+
- Changed Windows and WSL keybinding defaults to avoid terminal-reserved shortcuts for image paste, model cycling, editor undo, fullscreen transcript navigation and search, and message queueing ([#8372](https://github.com/earendil-works/pi/issues/8372)).
|
|
34
|
+
- Changed Bun release archives to ship the native clipboard binary only inside the wrapper package, removing a duplicate platform package from each archive.
|
|
35
|
+
- Changed package resource glob expansion to use Node.js's built-in implementation with deterministic visible-path matching, reducing the installed runtime dependency tree.
|
|
36
|
+
- Changed the bundled Node.js runtime to load jiti only when importing an extension and Babel only when uncached source needs transformation, reducing CLI startup time and bundle size.
|
|
37
|
+
- Changed syntax highlighting to initialize only twenty common languages eagerly and defer the remaining grammars until after the initial TUI render, reducing CLI startup time.
|
|
38
|
+
- Changed the Node.js CLI and RPC entrypoints to load a bundled runtime, reducing startup filesystem reads while keeping the public library and legacy module paths on the modular runtime for normal dependency identity.
|
|
39
|
+
- Changed session sharing to render clickable terminal links, display only the canonical Radius artifact URL, and include the current system prompt and active tool definitions in Radius session shares.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- Fixed failed extension factories leaving event subscriptions, provider registrations, and default flag state active ([#8424](https://github.com/earendil-works/pi/pull/8424) by [@acmerfight](https://github.com/acmerfight)).
|
|
44
|
+
- Fixed `models.json` typings omitting the documented OpenAI-compatible `compat.supportsFinishReason` provider and model override ([#8487](https://github.com/earendil-works/pi/pull/8487) by [@petrroll](https://github.com/petrroll)).
|
|
45
|
+
- Fixed `/model` and `/thinking` selections being persisted globally unless explicitly saved with Ctrl+S ([#5263](https://github.com/earendil-works/pi/issues/5263)).
|
|
46
|
+
- Fixed JSON and RPC `toolcall_start` events omitting the tool call id and name ([#7953](https://github.com/earendil-works/pi/pull/7953) by [@christianklotz](https://github.com/christianklotz)).
|
|
47
|
+
- Fixed extensions failing to load when the Node.js CLI runs as a single-executable application ([#8237](https://github.com/earendil-works/pi/issues/8237)).
|
|
48
|
+
- Fixed nested Markdown skills inside `.agents/skills/` grouping directories not being discovered.
|
|
49
|
+
- Fixed compaction and branch summarization requests exposing tools to providers.
|
|
50
|
+
- Fixed single-object `edit` tool inputs failing validation by accepting them as one-edit arrays in both coding-agent and harness edit tools ([#7835](https://github.com/earendil-works/pi/issues/7835)).
|
|
51
|
+
- Fixed root Markdown files such as `README.md` and `AGENTS.md` in skill directories being reported as broken skills unless they declare valid skill frontmatter ([#7805](https://github.com/earendil-works/pi/issues/7805)).
|
|
52
|
+
- Fixed the default Cerebras model referencing an unavailable Z.AI model.
|
|
53
|
+
- Fixed inherited OpenAI-compatible Chat Completions reasoning replay to preserve and resend assistant-level `reasoning_details` verbatim and in order ([#7994](https://github.com/earendil-works/pi/issues/7994)).
|
|
54
|
+
- Fixed inherited Anthropic server-side fallback responses being priced with the requested model instead of the returned fallback model ([#8285](https://github.com/earendil-works/pi/issues/8285)).
|
|
55
|
+
- Fixed inherited GitHub Copilot login triggering model-policy rate limits by limiting policy updates, retrying model discovery once, and honoring server retry delays ([#7850](https://github.com/earendil-works/pi/issues/7850)).
|
|
56
|
+
- Fixed inherited Amazon Bedrock dropping and failing to replay opaque redacted reasoning from non-Anthropic models ([#8314](https://github.com/earendil-works/pi/pull/8314) by [@seiji](https://github.com/seiji)).
|
|
57
|
+
- Fixed inherited Z.AI Coding Plan models deriving incomplete reasoning-effort metadata, including missing GLM-5.3 low, high, and max levels ([#8336](https://github.com/earendil-works/pi/issues/8336)).
|
|
58
|
+
- Fixed inherited DeepSeek V4 Flash on OpenCode and OpenCode Go omitting its supported low thinking level ([#8181](https://github.com/earendil-works/pi/pull/8181) by [@tianshuang](https://github.com/tianshuang)).
|
|
59
|
+
- Fixed inherited Azure OpenAI Responses ignoring `toolChoice` in provider-specific stream requests.
|
|
60
|
+
- Fixed inherited Amazon Bedrock response hooks receiving only a synthesized request id instead of the raw response headers ([#8234](https://github.com/earendil-works/pi/issues/8234)).
|
|
61
|
+
- Fixed inherited Kimi usage reporting so top-level `cached_tokens` count as cache reads instead of normal input tokens ([#8075](https://github.com/earendil-works/pi/issues/8075)).
|
|
62
|
+
- Fixed inherited Google custom models ignoring `thinkingLevelMap`, which dropped extended thinking controls ([#8135](https://github.com/earendil-works/pi/issues/8135)).
|
|
63
|
+
- Fixed writes to `auth.json` and `models-store.json` overriding administrator-managed file permissions and ACLs ([#7779](https://github.com/earendil-works/pi/issues/7779)).
|
|
64
|
+
- Fixed UTF-8 BOM markers preventing frontmatter and user configuration files from loading ([#8337](https://github.com/earendil-works/pi/issues/8337)).
|
|
65
|
+
- Fixed invalid settings files being easy to miss during interactive startup by rendering warnings with the file path inside the TUI ([#7829](https://github.com/earendil-works/pi/issues/7829)).
|
|
66
|
+
- Fixed the subagent example repeatedly prompting before running project-local agents in trusted repositories ([#8261](https://github.com/earendil-works/pi/issues/8261)).
|
|
67
|
+
- Fixed npm package update checks treating older registry versions as available updates, preventing `pi update` from downgrading already-newer installed packages ([#8226](https://github.com/earendil-works/pi/issues/8226)).
|
|
68
|
+
- Fixed built-in llama.cpp models disappearing from `/model` when `/llama` refreshed a configured server under `PI_OFFLINE`, and included idle-slept `sleeping` router models in the selectable catalog ([#8167](https://github.com/earendil-works/pi/issues/8167)).
|
|
69
|
+
- Fixed `pi.registerFlag()` accepting default values that do not match the declared flag type ([#8064](https://github.com/earendil-works/pi/issues/8064)).
|
|
70
|
+
- Fixed Z.AI Coding Plan defaults referencing the removed GLM-5.1 model ([#8096](https://github.com/earendil-works/pi/issues/8096)).
|
|
71
|
+
- Fixed repeated ambiguous truncated-response recovery being mislabeled as context overflow ([#8130](https://github.com/earendil-works/pi/issues/8130)).
|
|
72
|
+
- Fixed duplicate fullscreen right-click paste in VS Code-based terminals on Windows ([#8186](https://github.com/earendil-works/pi/issues/8186)).
|
|
73
|
+
- Fixed inherited padded text exceeding narrow terminal widths ([#8252](https://github.com/earendil-works/pi/issues/8252)).
|
|
74
|
+
- Fixed inherited wrapped Markdown table links leaking color into borders and neighboring cells, including tables inside blockquotes ([#8335](https://github.com/earendil-works/pi/issues/8335)).
|
|
75
|
+
- Fixed llama.cpp login guidance to direct users to `/llama` before `/model` when no local models are loaded ([#8203](https://github.com/earendil-works/pi/issues/8203)).
|
|
76
|
+
- Fixed hung pi.dev model catalog requests consuming the entire refresh deadline without retrying ([#8198](https://github.com/earendil-works/pi/issues/8198)).
|
|
77
|
+
- Fixed inherited Xiaomi model catalogs listing shut-down MiMo V2 models in `/model` and `--list-models` ([#8187](https://github.com/earendil-works/pi/issues/8187)).
|
|
78
|
+
- Fixed branch summary entries recording the navigation destination in `fromId` instead of the pre-navigation source leaf.
|
|
79
|
+
- Fixed threshold auto-compaction being skipped when providers omit streaming usage data ([#8328](https://github.com/earendil-works/pi/issues/8328)).
|
|
80
|
+
- Fixed dash-prefixed prompts being parsed as options by supporting `--` as an end-of-options delimiter ([#7269](https://github.com/earendil-works/pi/issues/7269)).
|
|
81
|
+
|
|
82
|
+
## [0.84.2] - 2026-08-14
|
|
83
|
+
|
|
84
|
+
### New Features
|
|
85
|
+
|
|
86
|
+
- **Fullscreen transcript search** — Search and navigate matches in fullscreen mode. See [TUI Fullscreen Viewport](docs/keybindings.md#tui-fullscreen-viewport).
|
|
87
|
+
- **Configurable default tools** — Choose startup built-in tools globally or per project. See [Tools](docs/settings.md#tools).
|
|
88
|
+
- **Configurable fullscreen exit output** — Print the transcript or only a resume hint on exit. See [Interactive Mode](docs/usage.md#interactive-mode).
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
|
|
92
|
+
- Added fullscreen transcript search with `Ctrl+Shift+F`, incremental match highlighting, configurable search match theme colors, and next/previous navigation with `Enter`/`Ctrl+G` and `Shift+Enter`/`Ctrl+Shift+G`.
|
|
93
|
+
- Added experimental strict JSON-schema constrained sampling for the default `read`, `bash`, `edit`, and `write` tools under `PI_EXPERIMENTAL=1`.
|
|
94
|
+
- Added a fullscreen exit output setting to choose between printing the final transcript and only a session resume hint.
|
|
95
|
+
- Added the `defaultTools` setting for configuring the initial built-in tool selection globally or per project.
|
|
96
|
+
- Added `--use-theme <name[/name]>` to choose an initial per-run interactive theme without changing saved settings ([#7722](https://github.com/earendil-works/pi/pull/7722) by [@rwachtler](https://github.com/rwachtler)).
|
|
97
|
+
- Added `expandPromptTemplates` to extension `pi.sendUserMessage()` options for explicitly dispatching commands and expanding skills and prompt templates. See [`pi.sendUserMessage()`](docs/extensions.md#pisendusermessagecontent-options) ([#7857](https://github.com/earendil-works/pi/pull/7857) by [@mrexodia](https://github.com/mrexodia)).
|
|
98
|
+
- Added inherited `createGatewayBindingFetch()` for routing Cloudflare AI Gateway requests through a Workers AI binding without an API token ([#7901](https://github.com/earendil-works/pi/pull/7901) by [@Maximo-Guk](https://github.com/Maximo-Guk)).
|
|
99
|
+
- Added inherited `AssistantMessage.endTurn` to preserve OpenAI Codex's terminal `end_turn` signal for diagnostics ([#7766](https://github.com/earendil-works/pi/pull/7766)).
|
|
100
|
+
- Added inherited unbound single-line transcript scrolling actions for fullscreen mode. See [TUI Fullscreen Viewport](docs/keybindings.md#tui-fullscreen-viewport) ([#7903](https://github.com/earendil-works/pi/pull/7903) by [@midastruth](https://github.com/midastruth)).
|
|
101
|
+
|
|
102
|
+
### Changed
|
|
103
|
+
|
|
104
|
+
- Changed inherited Kimi Coding requests to use pi's runtime `User-Agent` header.
|
|
105
|
+
- Replaced the inherited Mistral SDK transport with a native Chat Completions HTTP stream, eliminating its generated client and schema runtime overhead.
|
|
106
|
+
- Documented the generic `AI_AGENT=pi` process marker and how it differs from `PI_CODING_AGENT=true` ([#7747](https://github.com/earendil-works/pi/issues/7747)).
|
|
107
|
+
- Changed inherited OpenAI Responses deferred tool loading to prefer message-anchored `additional_tools` where supported while retaining tool-search and top-level fallbacks ([#7709](https://github.com/earendil-works/pi/issues/7709)).
|
|
108
|
+
- Reduced inherited fullscreen rendering allocation churn by painting full-width layout rows directly instead of recompositing them on every frame.
|
|
109
|
+
|
|
110
|
+
### Fixed
|
|
111
|
+
|
|
112
|
+
- Fixed root Markdown files such as `README.md` and `AGENTS.md` in skill directories being reported as broken skills unless they declare valid skill frontmatter ([#7805](https://github.com/earendil-works/pi/issues/7805)).
|
|
113
|
+
- Fixed single-object `edit` tool inputs failing validation by accepting them as one-edit arrays in both coding-agent and harness edit tools ([#7835](https://github.com/earendil-works/pi/issues/7835)).
|
|
114
|
+
- Fixed managed-tool downloads delaying TUI startup and hiding diagnostics in fullscreen mode by mounting the TUI first and showing download progress and warnings inside it.
|
|
115
|
+
- Fixed opening a model selector immediately after startup cancelling and restarting the in-progress model catalog refresh.
|
|
116
|
+
- Fixed inherited GitHub Copilot login triggering API rate limits while enabling model policies by limiting concurrent policy updates ([#6187](https://github.com/earendil-works/pi/issues/6187)).
|
|
117
|
+
- Fixed fullscreen transcript search snapping back to the current match during manual scrolling and fragmented mouse input leaking into the search query.
|
|
118
|
+
- Fixed inherited required LaTeX arguments starting on a new line being parsed as empty ([#7760](https://github.com/earendil-works/pi/issues/7760)).
|
|
119
|
+
- Updated the transitive `nanoid` development dependency to address a denial-of-service vulnerability.
|
|
120
|
+
- Fixed fallback rendering for extension tool results to collapse long output and honor tool expansion ([#7979](https://github.com/earendil-works/pi/issues/7979)).
|
|
121
|
+
- Fixed JSON and RPC `message_update` events dropping cumulative usage during streaming. See [JSON Event Mode](docs/json.md) and [RPC `message_update`](docs/rpc.md#message_update-streaming) ([#7982](https://github.com/earendil-works/pi/pull/7982) by [@christianklotz](https://github.com/christianklotz)).
|
|
122
|
+
- Fixed `pi.sendMessage(..., { triggerTurn: false })` steering an active run instead of only recording the custom message ([#8022](https://github.com/earendil-works/pi/pull/8022) by [@cristinaponcela](https://github.com/cristinaponcela)).
|
|
123
|
+
- Fixed the `defaultTools` setting dropping extension and SDK custom tools when selecting built-in defaults.
|
|
124
|
+
- Fixed the subagent example rejecting YAML array syntax for the `tools` frontmatter field ([#7598](https://github.com/earendil-works/pi/pull/7598) by [@alexsavio](https://github.com/alexsavio)).
|
|
125
|
+
- Fixed the subagent example dropping parent session model, thinking, and tool configuration ([#7897](https://github.com/earendil-works/pi/pull/7897) by [@virtuald](https://github.com/virtuald)).
|
|
126
|
+
- Fixed custom system prompts concatenating the current working directory with later appended prompt content ([#7887](https://github.com/earendil-works/pi/pull/7887) by [@distributedlock](https://github.com/distributedlock)).
|
|
127
|
+
- Fixed inherited OpenAI Responses function and custom tool calls losing namespaces during streaming, proxying, and replay ([#7709](https://github.com/earendil-works/pi/issues/7709)).
|
|
128
|
+
- Fixed inherited upstream request buffer failures not triggering automatic assistant retries.
|
|
129
|
+
- Fixed inherited built-in and custom DeepSeek API models sending output limits through an unsupported field.
|
|
130
|
+
- Fixed inherited Amazon Bedrock replay rejecting tool arguments that contain empty object keys while preserving all valid nested values ([#7882](https://github.com/earendil-works/pi/pull/7882) by [@muyiyr](https://github.com/muyiyr)).
|
|
131
|
+
- Fixed inherited DeepSeek compatibility detection for base URLs whose hostname contains uppercase letters ([#7933](https://github.com/earendil-works/pi/pull/7933) by [@yearth](https://github.com/yearth)).
|
|
132
|
+
- Fixed inherited Google Generative AI and Vertex AI responses with tool calls incorrectly treating output-limit or provider-error stops as normal tool use ([#8059](https://github.com/earendil-works/pi/issues/8059)).
|
|
133
|
+
- Fixed inherited fullscreen mouse drag selection and OSC 8 link activation in terminals that report generic SGR mouse release button codes ([#7963](https://github.com/earendil-works/pi/issues/7963)).
|
|
134
|
+
- Fixed inherited focused fullscreen overlays not receiving mouse wheel or viewport scroll keys such as PageUp and PageDown ([#7894](https://github.com/earendil-works/pi/issues/7894)).
|
|
135
|
+
- Fixed inherited LaTeX control spaces split across line endings causing complete expressions to fall back to raw source.
|
|
136
|
+
- Fixed split `Alt+Enter` input over SSH being misread as Escape, added `PI_TUI_ESC_TIMEOUT` for high-latency terminals, and limited that timeout to lone Escape input ([#7899](https://github.com/earendil-works/pi/pull/7899) by [@powerfooI](https://github.com/powerfooI)).
|
|
137
|
+
- Fixed inherited idle fullscreen sessions repainting and clearing text selection when the terminal loses focus ([#7892](https://github.com/earendil-works/pi/pull/7892) by [@terrorobe](https://github.com/terrorobe)).
|
|
138
|
+
- Fixed fullscreen selection copy to use the host clipboard and report failure instead of claiming success when OSC 52 is unsupported ([#8110](https://github.com/earendil-works/pi/pull/8110) by [@Panoplos](https://github.com/Panoplos)).
|
|
4
139
|
|
|
5
140
|
## [0.84.1] - 2026-08-07
|
|
6
141
|
|
|
142
|
+
### New Features
|
|
143
|
+
|
|
144
|
+
- **Qwen Token Plan Individual** — Use the built-in provider for models documented for Individual subscriptions. See [API Keys](docs/providers.md#api-keys).
|
|
145
|
+
- **Authentication readiness checks** — Use `pi auth check` to verify provider or model credentials, optionally emitting the resolved credential.
|
|
146
|
+
- **Improved fullscreen interaction** — Select words and paragraphs with multiple clicks and configure half-page transcript scrolling. See [TUI Fullscreen Viewport](docs/keybindings.md#tui-fullscreen-viewport).
|
|
147
|
+
- **Terminating blocked tool calls** — Extension `tool_call` handlers can stop all-terminating batches without another model call. See [Tool Events](docs/extensions.md#tool-events).
|
|
148
|
+
|
|
149
|
+
### Added
|
|
150
|
+
|
|
151
|
+
- Added Qwen Token Plan Individual as a built-in provider with its documented subscription model catalog and the shared international `QWEN_TOKEN_PLAN_API_KEY`. See [API Keys](docs/providers.md#api-keys) ([#7659](https://github.com/earendil-works/pi/pull/7659) by [@arasovic](https://github.com/arasovic)).
|
|
152
|
+
- Added `pi auth check` provider/model auth preflight with optional credential output ([#7152](https://github.com/earendil-works/pi/issues/7152)).
|
|
153
|
+
- Added `terminate` support to blocked extension `tool_call` events so all-terminating batches can skip the automatic follow-up model call. See [Tool Events](docs/extensions.md#tool-events) ([#7715](https://github.com/earendil-works/pi/pull/7715) by [@muyiyr](https://github.com/muyiyr)).
|
|
154
|
+
- Added inherited double-click word and whitespace selection, granularity-aware drag selection, and triple-click paragraph selection in fullscreen mode ([#7725](https://github.com/earendil-works/pi/issues/7725), [#7733](https://github.com/earendil-works/pi/pull/7733) by [@volsa](https://github.com/volsa)).
|
|
155
|
+
- Added inherited unbound half-page transcript scrolling actions for fullscreen mode. See [TUI Fullscreen Viewport](docs/keybindings.md#tui-fullscreen-viewport) ([#7735](https://github.com/earendil-works/pi/issues/7735)).
|
|
156
|
+
|
|
157
|
+
### Changed
|
|
158
|
+
|
|
159
|
+
- Softened the bash tool's `PI_*` environment guideline in an attempt to reduce unnecessary inspection commands ([#7128](https://github.com/earendil-works/pi/issues/7128)).
|
|
160
|
+
- Reduced worst-case automatic terminal theme detection delay from 200 ms to 100 ms by probing color-scheme and background support concurrently.
|
|
161
|
+
|
|
162
|
+
### Fixed
|
|
163
|
+
|
|
164
|
+
- Fixed Bun standalone binaries crashing on startup when the cwd contains a `bunfig.toml` with `preload` by compiling with `--no-compile-autoload-bunfig` ([#7685](https://github.com/earendil-works/pi/pull/7685) by [@geril07](https://github.com/geril07)).
|
|
165
|
+
- Fixed extension TUI method wrappers recursing indefinitely when delegating to the original method ([#7731](https://github.com/earendil-works/pi/issues/7731)).
|
|
166
|
+
- Fixed right-click not pasting clipboard text in fullscreen mode on Windows.
|
|
167
|
+
- Fixed inherited `Agent.reset()` clearing transcript and runtime state during active runs; it now rejects until the agent is idle ([#7717](https://github.com/earendil-works/pi/pull/7717) by [@wesleyzhangwq](https://github.com/wesleyzhangwq)).
|
|
168
|
+
- Fixed inherited LaTeX relation, multiplication, and named-operator spacing, and matrix composition with stacked fractions, operator limits, and adjacent matrices.
|
|
169
|
+
- Reduced inherited fullscreen mouse event volume under tmux, Zellij, and GNU Screen by using button-motion tracking instead of all-motion tracking.
|
|
170
|
+
|
|
171
|
+
## [Unreleased]
|
|
172
|
+
|
|
7
173
|
### Added
|
|
8
174
|
|
|
9
175
|
- Added a `nonStreaming` setting, `--non-streaming` CLI flag, SDK session option, prompt option, and RPC prompt field for non-streaming `openai-completions` requests.
|
|
@@ -12,7 +178,7 @@
|
|
|
12
178
|
|
|
13
179
|
### New Features
|
|
14
180
|
|
|
15
|
-
- **Fullscreen TUI mode** — Switch between regular and fullscreen modes at runtime, with a sticky editor and footer, independently scrollable transcript, and draggable scrollbars. See [UI & Display](docs/settings.md#ui
|
|
181
|
+
- **Fullscreen TUI mode** — Switch between regular and fullscreen modes at runtime, with a sticky editor and footer, independently scrollable transcript, and draggable scrollbars. See [UI & Display](docs/settings.md#ui-display).
|
|
16
182
|
- **Mermaid and LaTeX rendering** — Render Mermaid diagrams and terminal-friendly Unicode math in interactive transcripts. See [Markdown settings](docs/settings.md#markdown) and [TUI Markdown](../tui/README.md#markdown).
|
|
17
183
|
- **Per-directory context overrides** — Use `AGENTS.override.md` to replace context files for a specific directory. See [Context Files](docs/usage.md#context-files).
|
|
18
184
|
- **Advanced custom model sampling** — Configure arbitrary OpenAI-compatible `samplingParams` and opt-in vLLM `thinking_token_budget` values. See [Sampling Parameters](docs/models.md#sampling-parameters).
|
package/bin/README.md
CHANGED
|
@@ -514,7 +514,7 @@ Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/)
|
|
|
514
514
|
## CLI Reference
|
|
515
515
|
|
|
516
516
|
```bash
|
|
517
|
-
pi [options] [@files...] [messages...]
|
|
517
|
+
pi [options] [--] [@files...] [messages...]
|
|
518
518
|
```
|
|
519
519
|
|
|
520
520
|
### Package Commands
|
|
@@ -584,7 +584,7 @@ cat README.md | pi -p "Summarize this text"
|
|
|
584
584
|
| `--no-builtin-tools`, `-nbt` | Disable built-in tools by default but keep extension/custom tools enabled |
|
|
585
585
|
| `--no-tools`, `-nt` | Disable all tools by default |
|
|
586
586
|
|
|
587
|
-
Available built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`
|
|
587
|
+
Available built-in tools: `read`, `bash`, `powershell` (Windows), `edit`, `write`, `grep`, `find`, `ls`
|
|
588
588
|
|
|
589
589
|
### Resource Options
|
|
590
590
|
|
|
@@ -609,9 +609,11 @@ Combine `--no-*` with explicit flags to load exactly what you need, ignoring set
|
|
|
609
609
|
| `--system-prompt <text>` | Replace default prompt (context files and skills still appended) |
|
|
610
610
|
| `--append-system-prompt <text>` | Append to system prompt |
|
|
611
611
|
| `--tui-mode <mode>` | TUI mode: `regular` (default) or experimental `fullscreen` |
|
|
612
|
+
| `--use-theme <name[/name]>` | Set the initial interactive theme for this run without changing settings |
|
|
612
613
|
| `--verbose` | Force verbose startup |
|
|
613
614
|
| `-a`, `--approve` | Trust project-local files for this run |
|
|
614
615
|
| `-na`, `--no-approve` | Ignore project-local files for this run |
|
|
616
|
+
| `--` | Stop option parsing; remaining arguments are prompts or `@file` inputs |
|
|
615
617
|
| `-h`, `--help` | Show help |
|
|
616
618
|
| `-v`, `--version` | Show version |
|
|
617
619
|
|
|
@@ -634,6 +636,9 @@ pi "List all .ts files in src/"
|
|
|
634
636
|
# Non-interactive
|
|
635
637
|
pi -p "Summarize this codebase"
|
|
636
638
|
|
|
639
|
+
# Prompt beginning with a dash
|
|
640
|
+
pi -p -- "- Summarize these points"
|
|
641
|
+
|
|
637
642
|
# Non-interactive with piped stdin
|
|
638
643
|
cat README.md | pi -p "Summarize this text"
|
|
639
644
|
|
|
@@ -677,7 +682,7 @@ pi --thinking high "Solve this complex problem"
|
|
|
677
682
|
| `PI_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
|
|
678
683
|
| `VISUAL`, `EDITOR` | Fallback external editor for Ctrl+G when `externalEditor` is unset; defaults to Notepad on Windows and `nano` elsewhere |
|
|
679
684
|
|
|
680
|
-
Commands run by the LLM-callable bash
|
|
685
|
+
Commands run by the LLM-callable `bash` and `powershell` tools also receive current session metadata:
|
|
681
686
|
|
|
682
687
|
| Variable | Description |
|
|
683
688
|
|----------|-------------|
|
|
@@ -687,7 +692,7 @@ Commands run by the LLM-callable bash tool also receive current session metadata
|
|
|
687
692
|
| `PI_MODEL` | Currently selected model ID |
|
|
688
693
|
| `PI_REASONING_LEVEL` | Current effective reasoning level |
|
|
689
694
|
|
|
690
|
-
These values are resolved when each command starts. See [Environment Variables](docs/environment-variables.md#
|
|
695
|
+
These values are resolved when each command starts. See [Environment Variables](docs/environment-variables.md#shell-tool-session-environment) for semantics, examples, and custom-tool opt-out.
|
|
691
696
|
|
|
692
697
|
---
|
|
693
698
|
|
package/bin/docs/compaction.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Compaction & Branch Summarization
|
|
2
2
|
|
|
3
|
-
LLMs have limited context windows. When conversations grow too long,
|
|
3
|
+
LLMs have limited context windows. When conversations grow too long, Pi uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
|
|
4
4
|
|
|
5
5
|
**Source files** ([pi-mono](https://github.com/earendil-works/pi-mono)):
|
|
6
6
|
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
|
|
@@ -42,13 +42,13 @@ You can also trigger manually with `/compact [instructions]`, where optional ins
|
|
|
42
42
|
2. **Extract messages**: Collect messages from the previous kept boundary (or session start) up to the cut point
|
|
43
43
|
3. **Generate summary**: Call LLM to summarize with structured format, passing the previous summary as iterative context when present
|
|
44
44
|
4. **Append entry**: Save `CompactionEntry` with summary and `firstKeptEntryId`
|
|
45
|
-
5. **
|
|
45
|
+
5. **Rebuilds context**: Session rebuilds the context for the next request, using summary + messages from `firstKeptEntryId` onwards
|
|
46
46
|
|
|
47
47
|
```
|
|
48
48
|
Before compaction:
|
|
49
49
|
|
|
50
50
|
entry: 0 1 2 3 4 5 6 7 8 9
|
|
51
|
-
|
|
51
|
+
┌─────┬─────┬─────┬──────┬─────┬─────┬──────┬──────┬─────┬─────┐
|
|
52
52
|
│ hdr │ usr │ ass │ tool │ usr │ ass │ tool │ tool │ ass │ tool│
|
|
53
53
|
└─────┴─────┴─────┴──────┴─────┴─────┴──────┴──────┴─────┴─────┘
|
|
54
54
|
└────────┬───────┘ └──────────────┬──────────────┘
|
|
@@ -59,7 +59,7 @@ Before compaction:
|
|
|
59
59
|
After compaction (new entry appended):
|
|
60
60
|
|
|
61
61
|
entry: 0 1 2 3 4 5 6 7 8 9 10
|
|
62
|
-
|
|
62
|
+
┌─────┬─────┬─────┬──────┬─────┬─────┬──────┬──────┬─────┬─────┬─────┐
|
|
63
63
|
│ hdr │ usr │ ass │ tool │ usr │ ass │ tool │ tool │ ass │ tool│ cmp │
|
|
64
64
|
└─────┴─────┴─────┴──────┴─────┴─────┴──────┴──────┴─────┴─────┴─────┘
|
|
65
65
|
└──────────┬──────┘ └──────────────────────┬───────────────────┘
|
|
@@ -102,7 +102,7 @@ Split turn (one huge turn exceeds budget):
|
|
|
102
102
|
turnPrefixMessages = [usr, ass, tool, ass, tool, tool]
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
For split turns,
|
|
105
|
+
For split turns, Pi generates two summaries and merges them:
|
|
106
106
|
1. **History summary**: Previous context (if any)
|
|
107
107
|
2. **Turn prefix summary**: The early part of the split turn
|
|
108
108
|
|
|
@@ -149,7 +149,7 @@ See [`prepareCompaction()`](https://github.com/earendil-works/pi-mono/blob/main/
|
|
|
149
149
|
|
|
150
150
|
### When It Triggers
|
|
151
151
|
|
|
152
|
-
When you use `/tree` to navigate to a different branch,
|
|
152
|
+
When you use `/tree` to navigate to a different branch, Pi offers to summarize the work you're leaving. This injects context from the left branch into the new branch.
|
|
153
153
|
|
|
154
154
|
### How It Works
|
|
155
155
|
|
|
@@ -346,6 +346,21 @@ pi.on("session_before_compact", async (event, ctx) => {
|
|
|
346
346
|
|
|
347
347
|
See [custom-compaction.ts](../examples/extensions/custom-compaction.ts) for a complete example using a different model.
|
|
348
348
|
|
|
349
|
+
### session_compact_failed
|
|
350
|
+
|
|
351
|
+
Fired when manual or automatic compaction fails or is aborted. This is useful for telemetry extensions that need to pair `session_before_compact` attempts with terminal outcomes.
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
pi.on("session_compact_failed", async (event, ctx) => {
|
|
355
|
+
const { reason, errorMessage, aborted, willRetry, fromExtension } = event;
|
|
356
|
+
// reason - "manual" (/compact), "threshold", or "overflow"
|
|
357
|
+
// errorMessage - present for non-abort failures
|
|
358
|
+
// aborted - true for cancelled/aborted compactions
|
|
359
|
+
// willRetry - whether the aborted turn would have retried after compaction
|
|
360
|
+
// fromExtension - whether extension-provided compaction content was being used
|
|
361
|
+
});
|
|
362
|
+
```
|
|
363
|
+
|
|
349
364
|
### session_before_tree
|
|
350
365
|
|
|
351
366
|
Fired before `/tree` navigation. Always fires regardless of whether user chose to summarize. Can cancel navigation or provide custom summary.
|
|
@@ -227,7 +227,7 @@ The `api` field determines which streaming implementation is used:
|
|
|
227
227
|
| `openai-responses` | OpenAI Responses API |
|
|
228
228
|
| `azure-openai-responses` | Azure OpenAI Responses API |
|
|
229
229
|
| `openai-codex-responses` | OpenAI Codex Responses API |
|
|
230
|
-
| `mistral-conversations` | Mistral
|
|
230
|
+
| `mistral-conversations` | Native Mistral Chat Completions streaming |
|
|
231
231
|
| `google-generative-ai` | Google Generative AI API |
|
|
232
232
|
| `google-vertex` | Google Vertex AI API |
|
|
233
233
|
| `bedrock-converse-stream` | Amazon Bedrock Converse API |
|
|
@@ -752,8 +752,10 @@ interface ProviderModelConfig {
|
|
|
752
752
|
requiresThinkingAsText?: boolean;
|
|
753
753
|
requiresReasoningContentOnAssistantMessages?: boolean;
|
|
754
754
|
thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "baseten" | "zai" | "qwen" | "chat-template" | "qwen-chat-template" | "string-thinking" | "ant-ling";
|
|
755
|
-
chatTemplateKwargs?: Record<string, string | number | boolean | null | { "$var": "thinking.enabled" | "thinking.effort"; omitWhenOff?: boolean }>;
|
|
756
|
-
chatTemplateArgs?: Record<string, string | number | boolean | null | { "$var": "thinking.enabled" | "thinking.effort"; omitWhenOff?: boolean }>;
|
|
755
|
+
chatTemplateKwargs?: Record<string, string | number | boolean | null | { "$var": "thinking.enabled" | "thinking.effort" | "thinking.budget"; omitWhenOff?: boolean }>;
|
|
756
|
+
chatTemplateArgs?: Record<string, string | number | boolean | null | { "$var": "thinking.enabled" | "thinking.effort" | "thinking.budget"; omitWhenOff?: boolean }>;
|
|
757
|
+
thinkingTokenBudgetField?: "thinking_token_budget" | "thinking_budget" | "thinking_budget_tokens";
|
|
758
|
+
supportsThinkingTokenBudget?: boolean;
|
|
757
759
|
cacheControlFormat?: "anthropic";
|
|
758
760
|
sessionAffinityFormat?: "openai" | "openai-nosession" | "openrouter";
|
|
759
761
|
sendSessionAffinityHeaders?: boolean;
|
|
@@ -771,4 +773,5 @@ interface ProviderModelConfig {
|
|
|
771
773
|
```
|
|
772
774
|
|
|
773
775
|
`openrouter` sends `reasoning: { effort }`. `deepseek` sends `thinking: { type: "enabled" | "disabled" }` and `reasoning_effort` when enabled. `together` sends `reasoning: { enabled }` and also `reasoning_effort` when `supportsReasoningEffort` is enabled. `qwen` is for DashScope-style top-level `enable_thinking`. Use `qwen-chat-template` for local Qwen-compatible servers that read `chat_template_kwargs.enable_thinking` and need `preserve_thinking`. Use `chat-template` for configurable `chat_template_kwargs`, for example DeepSeek V3.x behind vLLM with `chatTemplateKwargs: { "thinking": { "$var": "thinking.enabled" } }`. Use `thinkingFormat: "baseten"` with `chatTemplateArgs` when the provider expects toggle values under `chat_template_args` and optionally supports top-level `reasoning_effort`.
|
|
776
|
+
`thinkingTokenBudgetField` sends a clamped per-level thinking budget as a top-level request field (`thinking_token_budget` on vLLM, `thinking_budget` on Qwen/SGLang, `thinking_budget_tokens` on llama.cpp). `supportsThinkingTokenBudget: true` is an alias for the vLLM field name. Do not combine it with `reasoning_effort` on DashScope Qwen models.
|
|
774
777
|
`cacheControlFormat: "anthropic"` applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content.
|
|
@@ -3,18 +3,23 @@
|
|
|
3
3
|
Pi uses environment variables in three ways:
|
|
4
4
|
|
|
5
5
|
- Variables such as `PI_OFFLINE` configure the Pi process.
|
|
6
|
-
- Pi sets
|
|
7
|
-
- Commands run by the LLM-callable
|
|
6
|
+
- Pi sets process markers so child processes can identify Pi as the launching agent.
|
|
7
|
+
- Commands run by the LLM-callable shell tools receive `PI_*` variables describing the current session.
|
|
8
8
|
|
|
9
9
|
Provider API-key variables are documented separately in [Providers](providers.md#environment-variables-or-auth-file).
|
|
10
10
|
|
|
11
11
|
## Process Marker
|
|
12
12
|
|
|
13
|
-
The CLI and RPC entry points set
|
|
13
|
+
The CLI and RPC entry points set two process markers:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
- `AI_AGENT=pi` is a generic marker that lets tooling identify Pi as the agent that launched the process.
|
|
16
|
+
- `PI_CODING_AGENT=true` is Pi-specific and lets child processes detect that they run inside Pi.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
Child processes inherit both markers. They are not session-specific and are not set automatically when Pi is embedded through the SDK.
|
|
19
|
+
|
|
20
|
+
## Shell Tool Session Environment
|
|
21
|
+
|
|
22
|
+
Commands run by the `bash` and `powershell` tools receive the current Pi session state:
|
|
18
23
|
|
|
19
24
|
| Variable | Description |
|
|
20
25
|
|----------|-------------|
|
|
@@ -24,7 +29,7 @@ Commands run by the bash tool receive the current Pi session state:
|
|
|
24
29
|
| `PI_MODEL` | Currently selected model ID |
|
|
25
30
|
| `PI_REASONING_LEVEL` | Current effective reasoning level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` |
|
|
26
31
|
|
|
27
|
-
The values are resolved when each command starts. Switching models or changing the reasoning level therefore affects the next
|
|
32
|
+
The values are resolved when each command starts. Switching models or changing the reasoning level therefore affects the next shell command without restarting Pi. `PI_PROVIDER` and `PI_MODEL` identify the selected Pi model, not a different upstream model that a router may choose internally.
|
|
28
33
|
|
|
29
34
|
When asked which model or provider is running, inspect these variables instead of inferring the answer from the system prompt:
|
|
30
35
|
|
|
@@ -41,11 +46,11 @@ if [ -n "$PI_SESSION_FILE" ]; then
|
|
|
41
46
|
fi
|
|
42
47
|
```
|
|
43
48
|
|
|
44
|
-
These variables are injected into the LLM-callable bash
|
|
49
|
+
These variables are injected into the LLM-callable `bash` and `powershell` tools. They are not injected into user-entered `!` or `!!` commands.
|
|
45
50
|
|
|
46
|
-
### Custom
|
|
51
|
+
### Custom Shell Tools
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
Tools created with `createBashTool()` or `createPowerShellTool()` expose the session environment by default when registered with Pi. Injection happens before `spawnHook`, so a hook receives the variables in `ctx.env`:
|
|
49
54
|
|
|
50
55
|
```typescript
|
|
51
56
|
const bashTool = createBashTool(cwd, {
|
|
@@ -59,7 +64,7 @@ const bashTool = createBashTool(cwd, {
|
|
|
59
64
|
Disable session metadata independently of the spawn hook:
|
|
60
65
|
|
|
61
66
|
```typescript
|
|
62
|
-
const
|
|
67
|
+
const powershellTool = createPowerShellTool(cwd, {
|
|
63
68
|
exposeSessionEnvironment: false,
|
|
64
69
|
spawnHook: (ctx) => ctx,
|
|
65
70
|
});
|
|
@@ -82,6 +87,7 @@ These variables are read by Pi itself:
|
|
|
82
87
|
| `PI_CACHE_RETENTION` | Set to `long` for extended provider prompt caching where supported |
|
|
83
88
|
| `PI_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
|
|
84
89
|
| `PI_HARDWARE_CURSOR` | Set to `1` to show the hardware cursor; see [Terminal setup](terminal-setup.md) |
|
|
90
|
+
| `PI_TUI_ESC_TIMEOUT` | How long to wait after a lone ESC before treating it as Escape, in milliseconds; defaults to `100` over SSH and `10` otherwise. Increase if Alt-key input is misread as Escape |
|
|
85
91
|
| `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
|
|
86
92
|
| `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
|
|
87
93
|
|
package/bin/docs/extensions.md
CHANGED
|
@@ -330,7 +330,8 @@ user sends another prompt ◄─────────────────
|
|
|
330
330
|
|
|
331
331
|
/compact or auto-compaction
|
|
332
332
|
├─► session_before_compact (can cancel or customize)
|
|
333
|
-
|
|
333
|
+
├─► session_compact (success)
|
|
334
|
+
└─► session_compact_failed (failure or abort)
|
|
334
335
|
|
|
335
336
|
/tree navigation
|
|
336
337
|
├─► session_before_tree (can cancel or customize)
|
|
@@ -448,7 +449,7 @@ pi.on("session_before_fork", async (event, ctx) => {
|
|
|
448
449
|
After a successful fork or clone, pi emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "fork"` and `previousSessionFile`.
|
|
449
450
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
450
451
|
|
|
451
|
-
#### session_before_compact / session_compact
|
|
452
|
+
#### session_before_compact / session_compact / session_compact_failed
|
|
452
453
|
|
|
453
454
|
Fired on compaction. See [compaction.md](compaction.md) for details.
|
|
454
455
|
|
|
@@ -479,6 +480,14 @@ pi.on("session_compact", async (event, ctx) => {
|
|
|
479
480
|
// event.reason - "manual" (/compact), "threshold", or "overflow"
|
|
480
481
|
// event.willRetry - whether the aborted turn is retried after compaction (overflow recovery)
|
|
481
482
|
});
|
|
483
|
+
|
|
484
|
+
pi.on("session_compact_failed", async (event, ctx) => {
|
|
485
|
+
// event.reason - "manual" (/compact), "threshold", or "overflow"
|
|
486
|
+
// event.errorMessage - present for non-abort failures
|
|
487
|
+
// event.aborted - true for cancelled/aborted compactions
|
|
488
|
+
// event.willRetry - whether the aborted turn would have retried after compaction
|
|
489
|
+
// event.fromExtension - whether extension-provided compaction content was being used
|
|
490
|
+
});
|
|
482
491
|
```
|
|
483
492
|
|
|
484
493
|
#### session_before_tree / session_tree
|
|
@@ -762,7 +771,8 @@ Behavior guarantees:
|
|
|
762
771
|
- Mutations to `event.input` affect the actual tool execution
|
|
763
772
|
- Later `tool_call` handlers see mutations made by earlier handlers
|
|
764
773
|
- No re-validation is performed after your mutation
|
|
765
|
-
- Return values from `tool_call`
|
|
774
|
+
- Return values from `tool_call` control blocking via `{ block: true, reason?: string, terminate?: boolean }`
|
|
775
|
+
- `terminate` only applies to a blocked call; the agent stops early only when every finalized result in the batch is terminating
|
|
766
776
|
|
|
767
777
|
```typescript
|
|
768
778
|
import { isToolCallEventType } from "@earendil-works/pi-coding-agent";
|
|
@@ -778,7 +788,7 @@ pi.on("tool_call", async (event, ctx) => {
|
|
|
778
788
|
event.input.command = `source ~/.profile\n${event.input.command}`;
|
|
779
789
|
|
|
780
790
|
if (event.input.command.includes("rm -rf")) {
|
|
781
|
-
return { block: true, reason: "Dangerous command" };
|
|
791
|
+
return { block: true, reason: "Dangerous command", terminate: true };
|
|
782
792
|
}
|
|
783
793
|
}
|
|
784
794
|
|
|
@@ -1425,12 +1435,16 @@ pi.sendUserMessage([
|
|
|
1425
1435
|
// During streaming - must specify delivery mode
|
|
1426
1436
|
pi.sendUserMessage("Focus on error handling", { deliverAs: "steer" });
|
|
1427
1437
|
pi.sendUserMessage("And then summarize", { deliverAs: "followUp" });
|
|
1438
|
+
|
|
1439
|
+
// Opt in to extension command dispatch and skill/prompt template expansion
|
|
1440
|
+
pi.sendUserMessage("/review src/index.ts", { expandPromptTemplates: true });
|
|
1428
1441
|
```
|
|
1429
1442
|
|
|
1430
1443
|
**Options:**
|
|
1431
1444
|
- `deliverAs` - Required when agent is streaming:
|
|
1432
1445
|
- `"steer"` - Queues the message for delivery after the current assistant turn finishes executing its tool calls
|
|
1433
1446
|
- `"followUp"` - Waits for agent to finish all tools
|
|
1447
|
+
- `expandPromptTemplates` - Dispatch extension commands and expand skill commands and prompt templates. Defaults to `false`.
|
|
1434
1448
|
|
|
1435
1449
|
When not streaming, the message is sent immediately and triggers a new turn. When streaming without `deliverAs`, throws an error.
|
|
1436
1450
|
|
|
@@ -2045,7 +2059,7 @@ pi.registerTool({
|
|
|
2045
2059
|
|
|
2046
2060
|
### Overriding Built-in Tools
|
|
2047
2061
|
|
|
2048
|
-
Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`) by registering a tool with the same name. Interactive mode displays a warning when this happens.
|
|
2062
|
+
Extensions can override built-in tools (`read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, `ls`) by registering a tool with the same name. Interactive mode displays a warning when this happens.
|
|
2049
2063
|
|
|
2050
2064
|
```bash
|
|
2051
2065
|
# Extension's read tool replaces built-in read
|
|
@@ -2069,6 +2083,7 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
2069
2083
|
Built-in tool implementations:
|
|
2070
2084
|
- [read.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
2071
2085
|
- [bash.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
2086
|
+
- [powershell.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/powershell.ts) - `PowerShellToolDetails`
|
|
2072
2087
|
- [edit.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/edit.ts)
|
|
2073
2088
|
- [write.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/write.ts)
|
|
2074
2089
|
- [grep.ts](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
@@ -2104,11 +2119,11 @@ pi.registerTool({
|
|
|
2104
2119
|
});
|
|
2105
2120
|
```
|
|
2106
2121
|
|
|
2107
|
-
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
2122
|
+
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `PowerShellOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
2108
2123
|
|
|
2109
2124
|
For `user_bash`, extensions can reuse pi's local shell backend via `createLocalBashOperations()` instead of reimplementing local process spawning, shell resolution, and process-tree termination.
|
|
2110
2125
|
|
|
2111
|
-
The bash
|
|
2126
|
+
The `bash` and `powershell` tools also support a spawn hook to adjust the command, cwd, or env before execution:
|
|
2112
2127
|
|
|
2113
2128
|
```typescript
|
|
2114
2129
|
import { createBashTool } from "@earendil-works/pi-coding-agent";
|
|
@@ -2122,7 +2137,7 @@ const bashTool = createBashTool(cwd, {
|
|
|
2122
2137
|
});
|
|
2123
2138
|
```
|
|
2124
2139
|
|
|
2125
|
-
`createBashTool()`
|
|
2140
|
+
`createBashTool()` and `createPowerShellTool()` expose the current session to commands through `PI_SESSION_ID`, `PI_SESSION_FILE`, `PI_PROVIDER`, `PI_MODEL`, and `PI_REASONING_LEVEL`. Injection happens before `spawnHook`, so hooks receive these values in `env` and preserve them when they spread the existing environment as above. Set `exposeSessionEnvironment: false` to disable them:
|
|
2126
2141
|
|
|
2127
2142
|
```typescript
|
|
2128
2143
|
const bashTool = createBashTool(cwd, {
|
|
@@ -2130,7 +2145,7 @@ const bashTool = createBashTool(cwd, {
|
|
|
2130
2145
|
});
|
|
2131
2146
|
```
|
|
2132
2147
|
|
|
2133
|
-
See [
|
|
2148
|
+
See [Shell tool session environment](environment-variables.md#shell-tool-session-environment) for variable semantics. See [examples/extensions/ssh.ts](../examples/extensions/ssh.ts) for a complete SSH example with `--ssh` flag.
|
|
2134
2149
|
|
|
2135
2150
|
### Output Truncation
|
|
2136
2151
|
|
package/bin/docs/json.md
CHANGED
|
@@ -15,11 +15,16 @@ except that streaming message updates omit cumulative snapshots:
|
|
|
15
15
|
```typescript
|
|
16
16
|
type WithoutPartial<T> = T extends { partial: unknown } ? Omit<T, "partial"> : T;
|
|
17
17
|
|
|
18
|
+
type JsonAssistantMessageEvent<T> = T extends { type: "toolcall_start"; partial: unknown }
|
|
19
|
+
? WithoutPartial<T> & { id: string; toolName: string }
|
|
20
|
+
: WithoutPartial<T>;
|
|
21
|
+
|
|
18
22
|
type JsonAgentSessionEvent =
|
|
19
23
|
| Exclude<AgentSessionEvent, { type: "message_update" }>
|
|
20
24
|
| {
|
|
21
25
|
type: "message_update";
|
|
22
|
-
|
|
26
|
+
usage: Usage;
|
|
27
|
+
assistantMessageEvent: JsonAssistantMessageEvent<AssistantMessageEvent>;
|
|
23
28
|
};
|
|
24
29
|
```
|
|
25
30
|
|
|
@@ -73,16 +78,18 @@ Followed by events as they occur:
|
|
|
73
78
|
{"type":"agent_start"}
|
|
74
79
|
{"type":"turn_start"}
|
|
75
80
|
{"type":"message_start","message":{"role":"assistant","content":[],...}}
|
|
76
|
-
{"type":"message_update","assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
|
|
81
|
+
{"type":"message_update","usage":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
|
|
77
82
|
{"type":"message_end","message":{...}}
|
|
78
83
|
{"type":"turn_end","message":{...},"toolResults":[]}
|
|
79
84
|
{"type":"agent_end","messages":[...]}
|
|
80
85
|
```
|
|
81
86
|
|
|
82
87
|
`message_update` records are delta-only. They omit both the cumulative `message` field and
|
|
83
|
-
`assistantMessageEvent.partial` to keep stream size linear.
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
`assistantMessageEvent.partial` to keep stream size linear. The top-level `usage` field contains
|
|
89
|
+
the latest cumulative provider-reported usage and may remain zero when a provider only reports
|
|
90
|
+
usage at completion. Use `contentIndex` and `delta` to assemble live text, thinking, or tool-call
|
|
91
|
+
arguments if needed. A `toolcall_start` event also includes the constant-sized `id` and `toolName`
|
|
92
|
+
fields. `message_end` contains the final authoritative message.
|
|
86
93
|
|
|
87
94
|
## Example
|
|
88
95
|
|