@herbertgao/pi-extensions 2026.11.2 → 2026.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +11 -11
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +109 -16
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +5 -1
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +12 -10
- package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +1 -1
- package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
- package/node_modules/@herbertgao/pi-subagents/src/agent-record-entry.ts +22 -6
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +9 -4
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +167 -7
- package/node_modules/@herbertgao/pi-subagents/src/ui/viewer-keys.ts +8 -4
- package/node_modules/@narumitw/pi-btw/CHANGELOG.md +259 -0
- package/node_modules/@narumitw/pi-btw/package.json +6 -5
- package/node_modules/@narumitw/pi-caffeinate/CHANGELOG.md +70 -0
- package/node_modules/@narumitw/pi-caffeinate/package.json +5 -4
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +21 -0
- package/node_modules/pi-commandcode-provider/README.md +18 -6
- package/node_modules/pi-commandcode-provider/index.ts +11 -5
- package/node_modules/pi-commandcode-provider/package.json +1 -1
- package/node_modules/pi-commandcode-provider/src/api-key.ts +26 -10
- package/node_modules/pi-commandcode-provider/src/auth-server.ts +33 -24
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +2 -2
- package/node_modules/pi-commandcode-provider/src/converters.ts +3 -61
- package/node_modules/pi-commandcode-provider/src/core.ts +29 -4
- package/node_modules/pi-commandcode-provider/src/cost.ts +32 -12
- package/node_modules/pi-commandcode-provider/src/oauth.ts +40 -6
- package/node_modules/pi-commandcode-provider/src/pricing.ts +5 -3
- package/node_modules/pi-commandcode-provider/src/runtime.ts +14 -7
- package/node_modules/pi-commandcode-provider/src/transport.ts +6 -3
- package/node_modules/pi-web-access/CHANGELOG.md +22 -0
- package/node_modules/pi-web-access/README.md +31 -12
- package/node_modules/pi-web-access/curator-page.ts +5 -1
- package/node_modules/pi-web-access/curator-server.ts +2 -0
- package/node_modules/pi-web-access/dist/index.js +673 -308
- package/node_modules/pi-web-access/dist/mcp-cli.js +666 -309
- package/node_modules/pi-web-access/gemini-search.ts +12 -4
- package/node_modules/pi-web-access/github-api.ts +1 -1
- package/node_modules/pi-web-access/github-extract.ts +3 -2
- package/node_modules/pi-web-access/index.ts +7 -3
- package/node_modules/pi-web-access/mcp-tool-definitions.ts +1 -1
- package/node_modules/pi-web-access/outcrawl.ts +204 -0
- package/node_modules/pi-web-access/package.json +2 -2
- package/node_modules/pi-web-access/sofya.ts +201 -0
- package/node_modules/pi-web-access/utils.ts +16 -6
- package/node_modules/pi-web-access/web-tool-core.ts +4 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @herbertgao/pi-extensions
|
|
2
2
|
|
|
3
|
+
## 2026.11.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#353](https://github.com/HerbertGao/pi-extensions/pull/353) [`d7118e9`](https://github.com/HerbertGao/pi-extensions/commit/d7118e94347a57977fdaaedd81ea8bd6a02f5976) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Pin pi-btw 0.63.4, pi-caffeinate 0.49.14, pi-commandcode-provider 0.7.12, and pi-web-access 0.47.0. Searchable BTW choices keep page scrolling. Sofya and Outcrawl stay explicit-only, a locked proxy cannot be skipped, and Command Code taste learning stays opt-in.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`d7118e9`](https://github.com/HerbertGao/pi-extensions/commit/d7118e94347a57977fdaaedd81ea8bd6a02f5976), [`d7118e9`](https://github.com/HerbertGao/pi-extensions/commit/d7118e94347a57977fdaaedd81ea8bd6a02f5976)]:
|
|
10
|
+
- @herbertgao/pi-cc-extensions@1.0.13
|
|
11
|
+
- @herbertgao/pi-subagents@0.23.0
|
|
12
|
+
|
|
3
13
|
## 2026.11.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -21,12 +21,12 @@ When migrating from `pi-mcp-adapter`, remove any standalone adapter install as w
|
|
|
21
21
|
The package bundles 6 active `@herbertgao/*` child packages—`pi-agency`, `pi-bark`, `pi-cc-extensions`, `pi-impeccable`, `pi-subagents`, and `sol-pi`—plus the following upstream packages under their original names:
|
|
22
22
|
|
|
23
23
|
- `pi-antigravity@0.11.0`
|
|
24
|
-
- `pi-commandcode-provider@0.7.
|
|
24
|
+
- `pi-commandcode-provider@0.7.12`
|
|
25
25
|
- `pi-provider-qoder@0.6.10`
|
|
26
26
|
- `@dietrichgebert/ponytail@5.3.3`
|
|
27
27
|
- `@juicesharp/rpiv-ask-user-question@2.15.0`
|
|
28
|
-
- `@narumitw/pi-btw@0.63.
|
|
29
|
-
- `@narumitw/pi-caffeinate@0.49.
|
|
28
|
+
- `@narumitw/pi-btw@0.63.4`
|
|
29
|
+
- `@narumitw/pi-caffeinate@0.49.14`
|
|
30
30
|
- `@pi-plugins/fast-mode@0.1.14`
|
|
31
31
|
- `@tifan/pi-copy-response@0.2.7`
|
|
32
32
|
- `@tifan/pi-handoff@2.2.2`
|
|
@@ -37,13 +37,13 @@ The package bundles 6 active `@herbertgao/*` child packages—`pi-agency`, `pi-b
|
|
|
37
37
|
- `pi-typesafe@0.14.0`
|
|
38
38
|
- `pi-next-cue@1.0.8`
|
|
39
39
|
- `pi-lens@4.4.8`
|
|
40
|
-
- `pi-web-access@0.
|
|
40
|
+
- `pi-web-access@0.47.0`
|
|
41
41
|
|
|
42
42
|
Pi loads their extensions and skills through `node_modules/` paths inside one package root. The upstream companions are pinned and bundled, not forked or renamed.
|
|
43
43
|
|
|
44
|
-
The locally customized CC package follows upstream `pi-cc-extensions@1.0.
|
|
44
|
+
The locally customized CC package follows upstream `pi-cc-extensions@1.0.14`; SoL-Pi follows its complete main baseline `e1a586af` with Pi 1.x/codemode compatibility updates through `21956803`. Local behavior not already covered upstream is retained. SoL-Pi's `update_plan` now follows upstream's model-only contract: invoke it directly, not inside codemode scripts. Action Fusion and ccstyle write rich diffs coexist without disabling either feature. All four SoL-Pi features remain opt-in; its new non-persistent-session evidence archives remain on disk for consumers and require host or caller cleanup.
|
|
45
45
|
|
|
46
|
-
Antigravity `0.11.0` enriches search citations by visiting source sites by default (`ANTIGRAVITY_NO_SOURCE_ENRICH=1` disables enrichment). It refreshes a curated model catalog and upgrades the existing model cache; previously listed model IDs may disappear. Ask `2.15.0` lets other extensions in the same process answer or cancel TUI questionnaires through its event channel, without sender authentication. Its notes shortcut defaults to `n` and can be a single non-Latin character; reserved navigation keys stay on `n`. Web Access `0.45.0` keeps direct tool exposure and `toolActivation: auto` by default. Linkup, DeepSeek search and fetch, provider gateways, `toolActivation: "none"`, deferred exposure, GCE ADC, field extraction, 9router, and plain HTTP gateway URLs require explicit configuration.
|
|
46
|
+
Antigravity `0.11.0` enriches search citations by visiting source sites by default (`ANTIGRAVITY_NO_SOURCE_ENRICH=1` disables enrichment). It refreshes a curated model catalog and upgrades the existing model cache; previously listed model IDs may disappear. Ask `2.15.0` lets other extensions in the same process answer or cancel TUI questionnaires through its event channel, without sender authentication. Its notes shortcut defaults to `n` and can be a single non-Latin character; reserved navigation keys stay on `n`. Web Access `0.45.0` keeps direct tool exposure and `toolActivation: auto` by default. Linkup, DeepSeek search and fetch, provider gateways, `toolActivation: "none"`, deferred exposure, GCE ADC, field extraction, 9router, and plain HTTP gateway URLs require explicit configuration. Web Access `0.47.0` adds Sofya and Outcrawl as explicit-only search providers. `lockProxy: true` rejects a tool-call proxy that differs from the configured proxy, including a direct connection. A GitHub repository README is returned up to 100K characters, and a clone with no `githubClone.clonePath` goes under the OS temp directory.
|
|
47
47
|
|
|
48
48
|
Ponytail `5.3.2` updates the Pi skill guidance, including how to turn it off. Its Pi extension entry is unchanged; the new Claude Code band/board hooks are not registered by this aggregate.
|
|
49
49
|
|
|
@@ -57,13 +57,13 @@ Impeccable `4.8.0` is vendored as `@herbertgao/pi-impeccable` and loaded with `/
|
|
|
57
57
|
|
|
58
58
|
`@herbertgao/pi-bark` sends localized Bark pushes when a user-facing Pi run fully settles or `@juicesharp/rpiv-ask-user-question` needs an answer. Notifications include emoji-labeled machine/path metadata and support the bundled official Pi badge through Bark's `icon` parameter. Configure it in `$PI_CODING_AGENT_DIR/bark.json` (normally `~/.pi/agent/bark.json`); see the [package README](../pi-bark/README.md). Without a valid endpoint it stays inactive.
|
|
59
59
|
|
|
60
|
-
`@narumitw/pi-caffeinate@0.49.
|
|
60
|
+
`@narumitw/pi-caffeinate@0.49.14` uses the host platform's sleep inhibitor during each Pi agent run. On macOS, `/caffeinate sleep` keeps the system awake while allowing the display to sleep; `/caffeinate display` also keeps the display awake. It releases the inhibitor when the run or session ends. Its D-Bus dependency remains on the normal socket transport under Node; Bun on Linux/macOS can use FFI and an in-process reader thread for Unix file-descriptor transport, and that thread can be unreferenced so the connection need not keep the process alive. It falls back when FFI is unavailable. No daemon or build step is added. The published extension source is unchanged from 0.49.13 aside from the manifest. It now depends on `@narumitw/pi-tui-kit@^0.69.0`, the same install BTW uses, and on `dbus-native@^0.16.3`.
|
|
61
61
|
|
|
62
|
-
`@narumitw/pi-btw@0.63.
|
|
62
|
+
`@narumitw/pi-btw@0.63.4` opens its side workspace through the `@narumitw/pi-tui-kit@^0.69.0` fullscreen handoff. It does not start that UI when the flow is already disposed or the parent terminal cannot be restored. Only one BTW flow can be open per session; a second `/btw` warns and stays closed. In split layout, mounting the first split releases Pi's idle wait so the main input stays usable. Importing new main-thread context stays manual. Settings rows keep a clipped label or value in full under the list, and a searchable model choice shows how many results match. A searchable choice keeps page scrolling; the host still owns search activation.
|
|
63
63
|
|
|
64
64
|
`clef` asks Cloudflare Clef-flash an on-demand yes/no, choice, or score and prints the questions and answers in the transcript, plus a one-line notice. It is not a permission gate. `pi-typesafe@0.14.0` provides `/typesafe` and `typesafe_evaluate` for explicit structured decisions; `/typesafe enable` or `PI_TYPESAFE_ENABLED=1` is still required for agent tool calls. The default backend remains `https://api.typesafe.ai`. `PI_TYPESAFE_BACKEND` and `PI_TYPESAFE_MODEL` select the session backend and model, and `/typesafe login` stores a key for the named backend. Only HTTP 401 refuses that key, and only for 15 minutes; a 403 refuses one request and leaves the key usable. Nace.AI (`https://console.nace.ai`, `NACE_API_KEY`, default model `drex-v2.0`) is a judgment backend. Daily request, token, and USD caps are opt-in. OpenRouter, Command Code, Liquid, SubQ, Nace.AI, and a named endpoint stay explicit and use that backend's own key. The promoted SDK is `@typesafe-ai/sdk@0.7.0`. Under Bun, the judge transport reads each response body once and replays it, so the SDK can still read the result after Bun marks the original body used.
|
|
65
65
|
|
|
66
|
-
`@herbertgao/sol-pi` adds opt-in Action Fusion, ObservationPack, Evidence-Preserving Reducer, and Online Context Compact; see its [configuration guide](../sol-pi/docs/configuration.md). `pi-lens@4.4.8` publishes a public LSP config schema, reads user-level custom rule directories (project before user before built-in), normalizes argv-style server entries, downgrades `throw-new-error` to a warning, and counts Docker, JSON, and Jedi servers in idle eviction; language routing and the retained multi-root diagnostic facts are unchanged. It promotes `@ast-grep/cli` to `0.51.0` and `@ast-grep/napi` to `^0.51.0`. Concatenated SQL passed to `.execute()` is an advisory full-analysis finding; a parameterized `execute(sql, values)` call stays quiet. Keeping injected findings in later requests is opt-in. A workspace edit through a dangling symlink is refused, and a symlink that resolves outside the workspace is refused; the fallback Biome config no longer names a nursery rule. An identity `filter(x => x).map(...)` stays a warning, and a non-identity `filter(fn).map(...)` is no longer flagged. A reduce that copies its accumulator with `Object.assign` is a warning. A directory whose name starts with `..` stays inside its project. `minimatch` is `^11.0.1`. `pi-web-access@0.
|
|
66
|
+
`@herbertgao/sol-pi` adds opt-in Action Fusion, ObservationPack, Evidence-Preserving Reducer, and Online Context Compact; see its [configuration guide](../sol-pi/docs/configuration.md). `pi-lens@4.4.8` publishes a public LSP config schema, reads user-level custom rule directories (project before user before built-in), normalizes argv-style server entries, downgrades `throw-new-error` to a warning, and counts Docker, JSON, and Jedi servers in idle eviction; language routing and the retained multi-root diagnostic facts are unchanged. It promotes `@ast-grep/cli` to `0.51.0` and `@ast-grep/napi` to `^0.51.0`. Concatenated SQL passed to `.execute()` is an advisory full-analysis finding; a parameterized `execute(sql, values)` call stays quiet. Keeping injected findings in later requests is opt-in. A workspace edit through a dangling symlink is refused, and a symlink that resolves outside the workspace is refused; the fallback Biome config no longer names a nursery rule. An identity `filter(x => x).map(...)` stays a warning, and a non-identity `filter(fn).map(...)` is no longer flagged. A reduce that copies its accumulator with `Object.assign` is a warning. A directory whose name starts with `..` stays inside its project. `minimatch` is `^11.0.1`. `pi-web-access@0.47.0` provides configurable web search and fetch tools; its `toolActivation` defaults to `auto`, choosing eager or dynamic tool activation per model. `toolActivation: "none"` stays opt-in and still requires deferred exposure. Field extraction, 9router, empty or off-topic search fallback, and plain HTTP gateway URLs stay off unless configured. An unknown tool-call provider name fails instead of selecting a provider automatically, and DuckDuckGo searches stay spaced apart after a bot check. It adds structured search/fetch data for codemode and an optional, manually started `pi-web-access-mcp` stdio CLI; installing the aggregate does not start that server. Degoog, Keenable, Ceramic, Linkup, DeepSeek fetch, Cloudflare search, SearchApi, Outcrawl, Sofya, and Tabstack are explicit-only, excluded from automatic and `all` selection. `lockProxy: true` rejects a tool-call proxy other than the configured one. A GitHub repository README is returned up to 100K characters, and a clone with no `githubClone.clonePath` goes under the OS temp directory. Optional `fetchContent.curl` and Exa/Tabstack fetch routing stay off unless configured. Provider gateway base URLs are opt-in and are not configured by the aggregate. OpenAI search now defaults to `gpt-6-luna`, results and clone cleanup are scoped per extension instance, and the promoted `@modelcontextprotocol/sdk@^1.32.1` moves the bundle off GHSA-6qxp-vccf-f47h. Perplexity search now uses the Search API's ranked pages and snippets rather than a Sonar-generated answer; requests requiring prose still use Sonar. `pi-antigravity@0.11.0` reads Pi 0.86+ transcript system messages, so Antigravity requests carry Pi's system prompt and tools; it also registers `google_search` and `generate_image` tools that use the signed-in Antigravity account. `pi-provider-qoder@0.6.10` registers the `qoder` and `qoder-cn` model providers. Startup logs one line when the npm registry has a newer release; `PI_PROVIDER_QODER_SKIP_UPDATE_CHECK=1` skips that lookup. A queued model-busy response reports its wait instead of being ignored; a ready busy response stays retryable. A queued wait that does not fit in a safe millisecond count uses `retryAfterSeconds` instead. Agent chat prefers the account's remote-agent node and, on daily chat limit code 110, tries the next node. The chosen node is cached for one hour. Sign in with `/login qoder` (browser or a personal access token from [qoder.com/account/integrations](https://qoder.com/account/integrations)) or `/login qoder-cn` (token from [qoder.com.cn/account/integrations](https://qoder.com.cn/account/integrations)). `QODER_PERSONAL_ACCESS_TOKEN` and `QODERCN_PERSONAL_ACCESS_TOKEN` log those providers in at startup. `/qoder-usage footer on` replaces the status-bar footer for that session, so leave it off while the pi-cc footer is in use. `pi-commandcode-provider@0.7.12` registers `commandcode` beside `qoder`, `qoder-cn`, and `antigravity`. `/login` lists those subscription providers and runs only the one you select. `@tifan/pi-preferred-thinking` is no longer bundled. Per-model thinking levels come from Pi. Deprecated `@tifan/pi-titlebar-spinner` is no longer bundled; Rename remains the single owner of Herdr tab naming. `@tifan/pi-handoff` imports `@tifan/pi-rename/naming` when it generates a session name, so Rename stays installed and its `/rename` command stays registered.
|
|
67
67
|
|
|
68
68
|
`pi-stash` is no longer bundled: `/btw` already preserves the main editor draft while handling side questions outside the main conversation. Prior `@herbertgao/pi-stash` releases remain available but are no longer maintained here.
|
|
69
69
|
|
|
@@ -81,9 +81,9 @@ Pi stacks widgets by key. While tasks are visible, three other above-editor widg
|
|
|
81
81
|
|
|
82
82
|
### Command Code
|
|
83
83
|
|
|
84
|
-
`pi-commandcode-provider@0.7.
|
|
84
|
+
`pi-commandcode-provider@0.7.12` adds the `commandcode` model provider. It does not register its own `/login` command. Pi's `/login` lists it with the other subscription providers (`antigravity`, `qoder`, and `qoder-cn`). Choose **Use a subscription**, then **Command Code**. Press Enter for browser login, type `key` to paste an API key, or paste the key directly. `COMMAND_CODE_API_KEY` signs the provider in at startup. Existing keys in `~/.commandcode/auth.json` are also read. Credentials Pi stores for this provider live under the `commandcode` entry in the host auth file. The reader does not take `qoder` or `antigravity` credentials.
|
|
85
85
|
|
|
86
|
-
`/commandcode-quota` shows account usage. `/commandcode-refresh` reloads the model catalog, and `/commandcode-status` shows redacted discovery diagnostics. On first start without a cache, model discovery waits for `https://api.commandcode.ai/provider/v1/models` and still loads if that request fails. TypeSafe's Command Code judge backend stays opt-in and uses that backend's own key. This aggregate does not also bundle `pi-login-manager` or `@iaziz786/pi-cmd-login`.
|
|
86
|
+
`/commandcode-quota` shows account usage. `/commandcode-refresh` reloads the model catalog, and `/commandcode-status` shows redacted discovery diagnostics: URL userinfo, query strings, and fragments are removed before the shared credential redactor runs. Taste learning on the legacy generate transport stays off unless `COMMANDCODE_TASTE_LEARNING=1`, and `CMD_ZDR=1` or `COMMANDCODE_ZDR=1` forces it off. During a DeepSeek V4 peak window, context-tier rates are doubled together with the base rates, and the host receives its own mutable copy. `/commandcode-refresh` resets the transport probe so the same key can try the Provider API again. On first start without a cache, model discovery waits for `https://api.commandcode.ai/provider/v1/models` and still loads if that request fails. TypeSafe's Command Code judge backend stays opt-in and uses that backend's own key. This aggregate does not also bundle `pi-login-manager` or `@iaziz786/pi-cmd-login`.
|
|
87
87
|
|
|
88
88
|
### Footer
|
|
89
89
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @herbertgao/pi-cc-extensions
|
|
2
2
|
|
|
3
|
+
## 1.0.14-local.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#353](https://github.com/HerbertGao/pi-extensions/pull/353) [`d7118e9`](https://github.com/HerbertGao/pi-extensions/commit/d7118e94347a57977fdaaedd81ea8bd6a02f5976) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Finish a compact summary from the turn's real activity and place it above the exposed lines. An abort during the pre-write snapshot still prevents the file from being written. A write that already reached disk still reports success.
|
|
8
|
+
|
|
3
9
|
## 1.0.13-local.1
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -128,7 +128,7 @@ pi -e . # one run, does not edit settings.json
|
|
|
128
128
|
|
|
129
129
|
## Credits
|
|
130
130
|
|
|
131
|
-
- Based on [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.
|
|
131
|
+
- Based on [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.14 (MIT), upstream baseline [`562d687`](https://github.com/minuque/pi-cc-extensions/commit/562d687829a0048081efd71d7433dcda73d7f085), with this repository's configuration migration and compatibility patches retained.
|
|
132
132
|
- Rich diffs are adapted from [`MasuRii/pi-tool-display`](https://github.com/MasuRii/pi-tool-display) (MIT). See [`extensions/renderer/tool/diff/ATTRIBUTION.md`](./extensions/renderer/tool/diff/ATTRIBUTION.md).
|
|
133
133
|
|
|
134
134
|
## License
|
|
@@ -128,7 +128,7 @@ pi -e . # 只跑一次,不改 settings.json
|
|
|
128
128
|
|
|
129
129
|
## 致谢
|
|
130
130
|
|
|
131
|
-
- 基于 [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.
|
|
131
|
+
- 基于 [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.14(MIT),上游基线 [`562d687`](https://github.com/minuque/pi-cc-extensions/commit/562d687829a0048081efd71d7433dcda73d7f085);保留本仓库的配置迁移与兼容性补丁。
|
|
132
132
|
- Rich diff 改编自 [`MasuRii/pi-tool-display`](https://github.com/MasuRii/pi-tool-display)(MIT);详见 [`extensions/renderer/tool/diff/ATTRIBUTION.md`](./extensions/renderer/tool/diff/ATTRIBUTION.md)。
|
|
133
133
|
|
|
134
134
|
## 许可证
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* Agent/Task 族:调用只进摘要计数,tool 卡始终折叠(避免 pending→完成高度闪动)。
|
|
9
9
|
* edit/write 与 ask_user_question 留在外层:不进摘要计数,折叠态也单独成行。
|
|
10
10
|
* 外层行一旦在消息里出现,当前回合就地完结(不计静默期),后续消息另起回合:
|
|
11
|
-
*
|
|
11
|
+
* 摘要行因此只折叠连续的一段工具调用。收尾后本回合的外层行排在摘要行之下,
|
|
12
|
+
* 摘要行覆盖的是它们之前的工具段;回合还在跑时它们留在原位,摘要行钉在可写底缘。
|
|
12
13
|
* 用户消息是回合的硬边界:steer 消息插进回合中间、或上一回合没正文就收尾时,回合
|
|
13
14
|
* 就地收口、后续消息另起一回合。custom 通知/summary 类组件既不是成员也不算外来行,
|
|
14
15
|
* 原地留在两段之间,不打断统计也不被挪位。
|
|
@@ -1211,6 +1212,8 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1211
1212
|
liveSlotToolIds: Set<string>;
|
|
1212
1213
|
/** 收尾后的静默期截止时间戳;期间仍按围观态渲染,到点才收拢。 */
|
|
1213
1214
|
settleUntil?: number;
|
|
1215
|
+
/** 已请求收尾但回合还有活干(消息仍在流式、工具还在跑):活干完再兑现。 */
|
|
1216
|
+
endRequest?: { endTimestamp?: number };
|
|
1214
1217
|
/** 消息已有 toolCall、工具组件还没到:等它一 updateDisplay 就重画槽位。 */
|
|
1215
1218
|
pendingLiveTool?: boolean;
|
|
1216
1219
|
foldTimer?: ReturnType<typeof setTimeout>;
|
|
@@ -1235,6 +1238,19 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1235
1238
|
let idleRef: (() => boolean) | undefined = deps.isIdle;
|
|
1236
1239
|
let roundTickTimer: ReturnType<typeof setInterval> | undefined;
|
|
1237
1240
|
|
|
1241
|
+
/** 本进程见过的回合:活动回合、本次 pass 建起的、收尾静默期的、还挂着尾行的。 */
|
|
1242
|
+
const allRounds = (): CompactRound[] => {
|
|
1243
|
+
const rounds = new Set<CompactRound>();
|
|
1244
|
+
if (activeRound) rounds.add(activeRound);
|
|
1245
|
+
for (const round of liveRounds) rounds.add(round);
|
|
1246
|
+
for (const round of pendingFoldRounds) rounds.add(round);
|
|
1247
|
+
for (const tail of mountedTails) {
|
|
1248
|
+
const round = tail.round as CompactRound | undefined;
|
|
1249
|
+
if (round) rounds.add(round);
|
|
1250
|
+
}
|
|
1251
|
+
return [...rounds];
|
|
1252
|
+
};
|
|
1253
|
+
|
|
1238
1254
|
/** 会话是否空闲:回合活性的事实来源,取不到就当没空闲(宁可保留 Running)。 */
|
|
1239
1255
|
const sessionIdle = (): boolean => {
|
|
1240
1256
|
try {
|
|
@@ -1263,14 +1279,23 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1263
1279
|
roundTickTimer = undefined;
|
|
1264
1280
|
};
|
|
1265
1281
|
|
|
1282
|
+
/** 还有回合要盯就得继续 tick:活动回合的时长要跳,挂起的收尾请求要等活干完。 */
|
|
1283
|
+
const roundTickNeeded = (): boolean => {
|
|
1284
|
+
for (const round of allRounds()) {
|
|
1285
|
+
if (round.active || round.endRequest !== undefined) return true;
|
|
1286
|
+
}
|
|
1287
|
+
return false;
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1266
1290
|
// 自备 tick:getter 在 render 重算挂钟;兼驱动 Running 扫光(setCompactSummaryActive)。
|
|
1267
1291
|
const ensureRoundTick = (): void => {
|
|
1268
1292
|
if (roundTickTimer) return;
|
|
1269
1293
|
roundTickTimer = setInterval(() => {
|
|
1270
|
-
if (!patch.active || !
|
|
1294
|
+
if (!patch.active || !roundTickNeeded()) {
|
|
1271
1295
|
stopRoundTick();
|
|
1272
1296
|
return;
|
|
1273
1297
|
}
|
|
1298
|
+
for (const round of allRounds()) retryDeferredFinalize(round);
|
|
1274
1299
|
settleStrandedRounds();
|
|
1275
1300
|
try {
|
|
1276
1301
|
// 非 force:保留 fullscreen 布局缓存和差分绘制。
|
|
@@ -1302,9 +1327,15 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1302
1327
|
value <= Date.now() + 60_000;
|
|
1303
1328
|
|
|
1304
1329
|
/** 结束回合活动态;不做任何重绘。更晚的消息 timestamp 用来保住回放时长;
|
|
1305
|
-
* 同一条消息的 timestamp 不动,活回合改用本进程挂钟,避免把历史 timestamp 收到「现在」。
|
|
1306
|
-
|
|
1330
|
+
* 同一条消息的 timestamp 不动,活回合改用本进程挂钟,避免把历史 timestamp 收到「现在」。
|
|
1331
|
+
* 回合还有活干时只记下收尾请求:提前翻成 Ran for 会把仍在跑的工具报成已结束。 */
|
|
1332
|
+
const finalizeRound = (round: CompactRound, endTimestamp?: number): boolean => {
|
|
1307
1333
|
clearFoldTimer(round);
|
|
1334
|
+
if (roundHasLiveWork(round)) {
|
|
1335
|
+
round.endRequest ??= { endTimestamp };
|
|
1336
|
+
return false;
|
|
1337
|
+
}
|
|
1338
|
+
round.endRequest = undefined;
|
|
1308
1339
|
round.active = false;
|
|
1309
1340
|
if (round.endedAt === undefined) {
|
|
1310
1341
|
let fallback = 0;
|
|
@@ -1321,22 +1352,26 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1321
1352
|
}
|
|
1322
1353
|
if (activeRound === round) {
|
|
1323
1354
|
activeRound = undefined;
|
|
1324
|
-
|
|
1325
|
-
|
|
1355
|
+
// 还有回合在跑(另一个活动回合或挂起的收尾):扫光与 tick 不能跟着一起停。
|
|
1356
|
+
const stillLive = roundTickNeeded();
|
|
1357
|
+
deps.query?.setCompactSummaryActive?.(stillLive);
|
|
1358
|
+
if (!stillLive) stopRoundTick();
|
|
1326
1359
|
}
|
|
1360
|
+
return true;
|
|
1327
1361
|
};
|
|
1328
1362
|
|
|
1329
1363
|
/**
|
|
1330
1364
|
* 结束回合活动态;render=true 时走静默期,延迟 FOLD_SETTLE_MS 再收拢。
|
|
1331
1365
|
* 分组语义不受影响:activeRound 立即让位,新消息不会被并进已收尾的回合。
|
|
1366
|
+
* 还有活干时整段跳过:回合保持 live,等活干完再收尾。
|
|
1332
1367
|
*/
|
|
1333
1368
|
const endRound = (round: CompactRound, render = false, endTimestamp?: number): void => {
|
|
1334
|
-
|
|
1335
|
-
|
|
1369
|
+
const wasActive = round.active;
|
|
1370
|
+
if (!finalizeRound(round, endTimestamp)) return;
|
|
1371
|
+
if (!render || !wasActive) {
|
|
1336
1372
|
if (render) renderRound(round);
|
|
1337
1373
|
return;
|
|
1338
1374
|
}
|
|
1339
|
-
finalizeRound(round, endTimestamp);
|
|
1340
1375
|
if (round.foldTimer !== undefined) return;
|
|
1341
1376
|
round.settleUntil = Date.now() + FOLD_SETTLE_MS;
|
|
1342
1377
|
pendingFoldRounds.add(round);
|
|
@@ -1348,10 +1383,23 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1348
1383
|
}, FOLD_SETTLE_MS);
|
|
1349
1384
|
};
|
|
1350
1385
|
|
|
1386
|
+
/**
|
|
1387
|
+
* 兑现挂起的收尾请求:活干完了当场收尾并重绘,摘要行从 Running 翻成 Ran for。
|
|
1388
|
+
* 挂在工具收尾与 tick 上,不另建定时器。
|
|
1389
|
+
*/
|
|
1390
|
+
const retryDeferredFinalize = (round: CompactRound): boolean => {
|
|
1391
|
+
const request = round.endRequest;
|
|
1392
|
+
if (!request || roundHasLiveWork(round)) return false;
|
|
1393
|
+
endRound(round, true, request.endTimestamp);
|
|
1394
|
+
renderRound(round);
|
|
1395
|
+
return true;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1351
1398
|
/**
|
|
1352
1399
|
* 外层行(edit/write/ask)切出的段落封口:跳过静默期直接定稿。
|
|
1353
1400
|
* 静默期是为"正文 token 先于 toolCall 到达"的双重转场准备的;外层边界
|
|
1354
1401
|
* 出现时摘要段内容已完整,立即收拢让 Ran for 当场落位,槽位卡一并撤走。
|
|
1402
|
+
* 本回合还有工具在跑时只挂起收尾:摘要行继续 Running,活干完再定稿。
|
|
1355
1403
|
*/
|
|
1356
1404
|
const sealRound = (round: CompactRound, endTimestamp?: number): void => {
|
|
1357
1405
|
finalizeRound(round, endTimestamp);
|
|
@@ -1428,6 +1476,24 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1428
1476
|
return ids;
|
|
1429
1477
|
};
|
|
1430
1478
|
|
|
1479
|
+
/**
|
|
1480
|
+
* 回合还有活干:成员消息仍在流式,或本回合的工具还没拿到最终结果。
|
|
1481
|
+
* 收尾要么按事实等活干完,要么摘要行就会把仍在跑的工具报成 Ran for。
|
|
1482
|
+
*/
|
|
1483
|
+
const roundHasLiveWork = (round: CompactRound): boolean => {
|
|
1484
|
+
for (const component of round.messages.keys()) {
|
|
1485
|
+
if (component?.isStreaming === true) return true;
|
|
1486
|
+
}
|
|
1487
|
+
const ids = roundToolCallIds(round);
|
|
1488
|
+
if (ids.size === 0) return false;
|
|
1489
|
+
for (const tool of trackedToolComponents) {
|
|
1490
|
+
if (typeof tool?.toolCallId === "string" && ids.has(tool.toolCallId) && isRunningTool(tool)) {
|
|
1491
|
+
return true;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
return false;
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1431
1497
|
/**
|
|
1432
1498
|
* 摘要行有东西可汇总才挂:普通工具(edit/write/ask 之外)或非空思考。
|
|
1433
1499
|
* 只剩外层卡的回合不挂——那些卡各自能展开,空摘要点开只会跳位。
|
|
@@ -1602,6 +1668,12 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1602
1668
|
return tail;
|
|
1603
1669
|
};
|
|
1604
1670
|
|
|
1671
|
+
/** 它们排在摘要行之下;定位时不把它们当摘要行之前的成员。 */
|
|
1672
|
+
const isOuterToolRow = (ids: Set<string>, value: any): boolean =>
|
|
1673
|
+
typeof value?.toolCallId === "string" &&
|
|
1674
|
+
ids.has(value.toolCallId) &&
|
|
1675
|
+
OUTER_TOOLS.has(String(value.toolName ?? ""));
|
|
1676
|
+
|
|
1605
1677
|
/**
|
|
1606
1678
|
* 尾行归位。目标位:活回合(运行中/收尾静默期)且未展开 → 容器最末,
|
|
1607
1679
|
* 计数行钉在 transcript 可写底缘,运行中到达的提示行/custom 条目只能落在
|
|
@@ -1621,22 +1693,33 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1621
1693
|
if (!container || !Array.isArray(container.children)) return;
|
|
1622
1694
|
tail.container = container;
|
|
1623
1695
|
const children = container.children as any[];
|
|
1696
|
+
const ids = roundToolCallIds(round);
|
|
1697
|
+
const live = roundLive(round);
|
|
1624
1698
|
const isMember = roundMemberMatcher(round);
|
|
1699
|
+
// 收尾后,本回合的外露行(edit/write/ask)一律排到摘要行之下;
|
|
1700
|
+
// 回合还在跑时它们留在原位,摘要行才能钉在可写底缘。
|
|
1701
|
+
const staysAbove = (value: any): boolean =>
|
|
1702
|
+
isMember(value) && (!isOuterToolRow(ids, value) || live);
|
|
1625
1703
|
const current = children.indexOf(tail.host);
|
|
1626
1704
|
// 摘尾行前先定目标位,已在位就整段跳过。
|
|
1627
1705
|
let last = -1;
|
|
1628
1706
|
for (let i = 0; i < children.length; i++) {
|
|
1629
|
-
if (children[i] === tail.host || !
|
|
1707
|
+
if (children[i] === tail.host || !staysAbove(children[i])) continue;
|
|
1630
1708
|
last = i;
|
|
1631
1709
|
}
|
|
1632
|
-
|
|
1710
|
+
// 外露行压在摘要行上方时仍要重排:尾行就算在目标位上也得让位。
|
|
1711
|
+
const outerAbove =
|
|
1712
|
+
!live &&
|
|
1713
|
+
current > 0 &&
|
|
1714
|
+
children.some((value: any, index: number) => index < current && isOuterToolRow(ids, value));
|
|
1715
|
+
const pinToEnd = live && round.anchor?.expanded !== true;
|
|
1633
1716
|
const desired = pinToEnd || last < 0 ? children.length - 1 : last + 1;
|
|
1634
|
-
if (current === desired) return;
|
|
1717
|
+
if (current === desired && !outerAbove) return;
|
|
1635
1718
|
if (current >= 0) children.splice(current, 1);
|
|
1636
1719
|
let first = -1;
|
|
1637
1720
|
last = -1;
|
|
1638
1721
|
for (let i = 0; i < children.length; i++) {
|
|
1639
|
-
if (!
|
|
1722
|
+
if (!staysAbove(children[i])) continue;
|
|
1640
1723
|
if (first < 0) first = i;
|
|
1641
1724
|
last = i;
|
|
1642
1725
|
}
|
|
@@ -1646,7 +1729,7 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1646
1729
|
// 用户消息永远留在原地:挪走会把别人的消息挪到用户消息下面去。
|
|
1647
1730
|
// custom 通知同理:它是回合内的透明行,不被统计也不挪位。
|
|
1648
1731
|
if (
|
|
1649
|
-
|
|
1732
|
+
staysAbove(children[i]) ||
|
|
1650
1733
|
isUserMessageComponent(children[i]) ||
|
|
1651
1734
|
isTransparentComponent(children[i])
|
|
1652
1735
|
) {
|
|
@@ -1681,8 +1764,10 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
1681
1764
|
*/
|
|
1682
1765
|
const syncTailForTool = (toolCallId: string): void => {
|
|
1683
1766
|
if (!toolCallId) return;
|
|
1684
|
-
for (const round of
|
|
1685
|
-
if (!
|
|
1767
|
+
for (const round of allRounds()) {
|
|
1768
|
+
if (!roundToolCallIds(round).has(toolCallId)) continue;
|
|
1769
|
+
// 工具收尾后活干完了:挂起的收尾请求当场兑现,摘要行立刻翻成 Ran for。
|
|
1770
|
+
if (retryDeferredFinalize(round)) return;
|
|
1686
1771
|
// 槽位是在消息更新时画的,当时工具组件还不存在:组件到了就补上。
|
|
1687
1772
|
// 参数流式更新也走这里,槽位卡跟着换内容。
|
|
1688
1773
|
if (round.pendingLiveTool || roundLive(round)) renderRound(round);
|
|
@@ -2288,6 +2373,14 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
|
|
|
2288
2373
|
if (hasText) {
|
|
2289
2374
|
const round = roundByComponent.get(this);
|
|
2290
2375
|
const previousMessage = round?.messages.get(this);
|
|
2376
|
+
// 消息还在流式时正文不是回合边界:同一条消息常常先出正文、再出 toolCall,
|
|
2377
|
+
// 这时收尾会在下一帧另起一条摘要行,一段工作被拆成两条。
|
|
2378
|
+
// 正文先按成员渲染,等消息收尾(isStreaming=false)再判。
|
|
2379
|
+
if (round && previousMessage && self.isStreaming === true) {
|
|
2380
|
+
round.messages.set(this, message);
|
|
2381
|
+
renderRound(round);
|
|
2382
|
+
return undefined;
|
|
2383
|
+
}
|
|
2291
2384
|
if (round && previousMessage && (round.anchor !== this || round.messages.size > 1)) {
|
|
2292
2385
|
// 最终回答开始后,当前组件恢复原生文本;它已完成的 thinking
|
|
2293
2386
|
// 留在上一轮摘要中,避免再次生成独立 Thought 行。
|
package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts
CHANGED
|
@@ -84,7 +84,7 @@ export async function executeWriteWithMetadata(
|
|
|
84
84
|
// 覆盖层只揽写前快照:路径解析(含 Windows 下 /mnt/<drive>、/cygdrive/<drive> 转换)、
|
|
85
85
|
// 目录创建、mutation queue 与错误文案全交回 pi 官方 write,参数与官方逐字一致。
|
|
86
86
|
const definition = createWriteToolDefinition(cwd, {
|
|
87
|
-
operations: writeSnapshotOperations(store, toolCallId),
|
|
87
|
+
operations: writeSnapshotOperations(store, toolCallId, signal),
|
|
88
88
|
}) as any;
|
|
89
89
|
try {
|
|
90
90
|
await definition.execute(toolCallId, params, signal, undefined, { cwd });
|
|
@@ -101,12 +101,16 @@ export async function executeWriteWithMetadata(
|
|
|
101
101
|
function writeSnapshotOperations(
|
|
102
102
|
store: WriteExecutionMetadataStore,
|
|
103
103
|
toolCallId: string,
|
|
104
|
+
signal: AbortSignal | undefined,
|
|
104
105
|
): WriteOperations {
|
|
105
106
|
return {
|
|
106
107
|
mkdir: (dir) => mkdir(dir, { recursive: true }).then(() => {}),
|
|
107
108
|
writeFile: async (absolutePath, content) => {
|
|
108
109
|
store.delete(toolCallId);
|
|
109
110
|
const metadata = await capturePreviousContent(absolutePath);
|
|
111
|
+
// 官方只在进 operations 之前查 abort(紧接着这次调用,中间没有 await),
|
|
112
|
+
// 快照读盘期间的取消只能在这里补:抛错,不写文件,也不留 metadata。
|
|
113
|
+
if (signal?.aborted) throw new Error("Operation aborted");
|
|
110
114
|
await writeFile(absolutePath, content, "utf8");
|
|
111
115
|
// 写已生效:后续 abort 不得把这次写报成失败,快照先落下。
|
|
112
116
|
store.set(toolCallId, metadata);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herbertgao/pi-cc-extensions",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14-local.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A Pi productivity suite with Claude Code-style UI, context inspection, and agent/session references",
|
|
6
6
|
"type": "module",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
},
|
|
73
73
|
"x-upstream": {
|
|
74
74
|
"package": "pi-cc-extensions",
|
|
75
|
-
"version": "1.0.
|
|
76
|
-
"reviewedVersion": "1.0.
|
|
75
|
+
"version": "1.0.14",
|
|
76
|
+
"reviewedVersion": "1.0.14",
|
|
77
77
|
"repository": "https://github.com/minuque/pi-cc-extensions",
|
|
78
|
-
"commit": "
|
|
78
|
+
"commit": "562d687829a0048081efd71d7433dcda73d7f085",
|
|
79
79
|
"trackVersion": true
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.23.1-local.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#353](https://github.com/HerbertGao/pi-extensions/pull/353) [`d7118e9`](https://github.com/HerbertGao/pi-extensions/commit/d7118e94347a57977fdaaedd81ea8bd6a02f5976) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Draw conversation-viewer tool calls with the session's own tool renderers, and unfold elided output with ctrl+o. After a reload, get_subagent_result still finds a saved agent by its handle or alias. Unconsumed results and a failed worktree cleanup stay recoverable.
|
|
8
|
+
|
|
3
9
|
## 0.23.0-local.1
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -14,7 +14,7 @@ https://github.com/user-attachments/assets/8685261b-9338-4fea-8dfe-1c590d5df543
|
|
|
14
14
|
- **Parallel background agents** — spawn multiple agents that run concurrently with automatic queuing (configurable concurrency limit, default 10) and completion notifications that reach the parent at its next boundary, several at once when they finish together
|
|
15
15
|
- **Live widget UI** — persistent above-editor widget with animated spinners, live tool activity, token counts, and colored status icons. Configurable via `/agents → Settings → Widget`: `all` (every agent), `background` (default — hides foreground runs, which already render inline as the `Agent` tool result), or `off`
|
|
16
16
|
- **FleetView** — Claude Code-style navigable list of `main` + every running subagent rendered below the editor (earliest-launched first). Press `↓` (or `←`) at an empty prompt to jump in, `↑`/`↓` to move the selection, `Enter` to open the selected agent's live, auto-updating conversation, `Esc` to return. Finished agents linger briefly before dropping out, and a viewer stays open through completion so you can read the final output. Toggle via `/agents → Settings → Fleet view`
|
|
17
|
-
- **Conversation viewer** — select any agent in `/agents` to open a live-scrolling overlay of its full conversation (auto-follows new content, scroll up to pause). In pi's fullscreen mode it is a borderless, full-terminal observer with mouse support. Steer a running agent inline by pressing `Enter` to open a composer, typing, then `Enter` to send (`Esc` or an empty submit returns) — the message appears as a user message and redirects the agent after its current tool. Press `b` on a running foreground `Agent` call to hand that run to the background (see [Sending a foreground agent to the background](#sending-a-foreground-agent-to-the-background)). Stop a still-running agent by pressing `x` (then `x` again to confirm) — steer and stop both work for background agents too. Assistant text renders as Markdown; `m` cycles that between off, assistant-only and everything (see [Viewer markdown](#persistent-settings))
|
|
17
|
+
- **Conversation viewer** — select any agent in `/agents` to open a live-scrolling overlay of its full conversation (auto-follows new content, scroll up to pause). In pi's fullscreen mode it is a borderless, full-terminal observer with mouse support. Steer a running agent inline by pressing `Enter` to open a composer, typing, then `Enter` to send (`Esc` or an empty submit returns) — the message appears as a user message and redirects the agent after its current tool. Press `b` on a running foreground `Agent` call to hand that run to the background (see [Sending a foreground agent to the background](#sending-a-foreground-agent-to-the-background)). Stop a still-running agent by pressing `x` (then `x` again to confirm) — steer and stop both work for background agents too. Tool calls render the way they do in pi's own transcript, through the renderers registered in the agent's session: a bash call shows its command and output, `read` its line numbers, `edit` its diff, an extension tool its own renderer, and a tool without one falls back to its arguments plus a bounded output preview. `ctrl+o` (or whatever `app.tools.expand` is bound to) unfolds elided tool output. Assistant text renders as Markdown; `m` cycles that between off, assistant-only and everything (see [Viewer markdown](#persistent-settings))
|
|
18
18
|
- **Custom agent types** — define agents in `.pi/agents/<name>.md` or `.agents/agents/<name>.md` (project) or globally, with YAML frontmatter: custom system prompts, model selection, thinking levels, tool restrictions, and Claude Code-compatible colored name badges
|
|
19
19
|
- **Package-shipped agents** — a pi package can declare its own subagents (and workflow scripts) with `"pi": { "subagents": { "agents": ["./agents"] } }` in its `package.json`, so `pi install` is the whole setup: no copying files into `.pi/agents/` on every machine or container start. Only packages pi has actually installed are read (never `node_modules`), package definitions rank below every agent you wrote, and `/agents` shows them read-only with Eject and Disable. Narrow or switch it off with `packageAgents` / `packageWorkflows`. **[Full guide](https://github.com/HerbertGao/pi-extensions/blob/master/packages/pi-subagents/docs/packages.md)**
|
|
20
20
|
- **Nested subagents** — opt-in, default-off delegation: a custom agent that sets `allowed_subagents` gets its own ownership-scoped `Agent`, `get_subagent_result`, and `steer_subagent` tools, depth-capped from the main session (default 2). It can control only its own children, they are stopped when it finishes, and their transcripts and token spend roll up to it. The allowlist is a privilege boundary — a child runs with its own tools, so pick it as carefully as `tools:` itself
|
|
@@ -549,15 +549,15 @@ Concurrency is capped at `max(1, min(16, cpus - 2))` — the run's own limit, in
|
|
|
549
549
|
|
|
550
550
|
Check status and retrieve results from a background agent.
|
|
551
551
|
|
|
552
|
-
| Parameter | Type | Required | Description
|
|
553
|
-
| ---------- | ------- | -------- |
|
|
554
|
-
| `agent_id` | string | yes | Agent ID
|
|
555
|
-
| `wait` | boolean | no | Wait for completion
|
|
556
|
-
| `verbose` | boolean | no | Include full conversation log
|
|
552
|
+
| Parameter | Type | Required | Description |
|
|
553
|
+
| ---------- | ------- | -------- | --------------------------------------------------------------------------------------------- |
|
|
554
|
+
| `agent_id` | string | yes | Agent ID or handle — its `name` if one was given, otherwise its type (`explore`, `explore-2`) |
|
|
555
|
+
| `wait` | boolean | no | Wait for completion |
|
|
556
|
+
| `verbose` | boolean | no | Include full conversation log |
|
|
557
557
|
|
|
558
558
|
Cancelling a `wait: true` call (for example, with `Esc`) stops only the wait. The background agent keeps running, and its completion notification still arrives normally.
|
|
559
559
|
|
|
560
|
-
A finished agent's result stays retrievable after its in-memory record is cleaned up (about ten minutes after it finishes) or lost to a reload: the final record is saved in the session as a `subagents:record` entry, and `get_subagent_result` answers from it, without the stats or the conversation (`verbose`).
|
|
560
|
+
A finished agent's result stays retrievable after its in-memory record is cleaned up (about ten minutes after it finishes) or lost to a reload: the final record is saved in the session as a `subagents:record` entry, and `get_subagent_result` answers from it by id or by handle, without the stats or the conversation (`verbose`).
|
|
561
561
|
|
|
562
562
|
### `steer_subagent`
|
|
563
563
|
|
|
@@ -768,10 +768,12 @@ Toggle via `/agents → Settings → Show model`; applied live.
|
|
|
768
768
|
|
|
769
769
|
```text
|
|
770
770
|
off every line literal, as before this setting existed
|
|
771
|
-
assistant assistant text rendered;
|
|
772
|
-
all
|
|
771
|
+
assistant assistant text rendered; any result the viewer prints itself stays verbatim (default)
|
|
772
|
+
all those results rendered too
|
|
773
773
|
```
|
|
774
774
|
|
|
775
|
+
Tool calls are outside this setting: a call and its result are drawn by the tool's own renderer (see [the conversation viewer](#ui)), which knows the shape of what it produced — a diff, line-numbered source, a shell transcript — better than a generic Markdown pass would. So `m` changes assistant text and the plain result block the viewer still prints for a result whose call is not in the transcript (a compacted prefix, a reopened session).
|
|
776
|
+
|
|
775
777
|
Scoped rather than all-or-nothing because the two kinds of content have different contracts. Assistant text _is_ Markdown — the model writes it that way, and the viewer was the only surface showing its source. A tool result is whatever bytes the tool produced, and a Markdown pass over one rewrites things that occur constantly in real output: `# section` in a shell script loses its `#`, a `---` line is swallowed as a setext heading, indented output is re-fenced, and `| a | b |` is redrawn as a box-drawing table. Each of those reads as the _tool_ having misbehaved, which is why `all` is opt-in.
|
|
776
778
|
|
|
777
779
|
Two rewrites are suppressed outright rather than left to the mode, because they change _data_ rather than layout: ordered-list markers keep their source numbering (`3) 7) 9)` stays, instead of being renumbered `3. 4. 5.`) and backslash escapes are not normalised.
|
|
@@ -1117,7 +1119,7 @@ src/
|
|
|
1117
1119
|
agent-widget.ts # Persistent widget: spinners, activity, status icons, theming
|
|
1118
1120
|
fleet-list.ts # FleetView: navigable agent list below the editor
|
|
1119
1121
|
conversation-viewer.ts # Live conversation overlay for viewing agent sessions
|
|
1120
|
-
viewer-keys.ts # Viewer scroll keys resolved through user keybindings
|
|
1122
|
+
viewer-keys.ts # Viewer scroll and expand keys, resolved through user keybindings
|
|
1121
1123
|
agent-mention.ts # `@` roster (running, resumable, and startable agents) + popup rows
|
|
1122
1124
|
schedule-menu.ts # /agents → Scheduled jobs submenu
|
|
1123
1125
|
select-item.ts # Collision-safe ctx.ui.select wrapper (numbered rows)
|
|
@@ -130,7 +130,7 @@ Fire-and-forget is the intended use: the reply carries nothing to act on, and th
|
|
|
130
130
|
|
|
131
131
|
Consumption is not terminal. An `@handle` steer un-consumes the record (the mention handler, `src/index.ts`) because the agent's reply to that message still needs relaying. A background resume (`AgentManager.resume`) does too, because the record is starting a new run, and so does handing a foreground agent to the background (`AgentManager.sendToBackground`), because its result now has to reach the parent as a notification.
|
|
132
132
|
|
|
133
|
-
One related thing that lives nowhere else: on every top-level settle, pi-subagents writes a session entry — not an event — via `pi.appendEntry("subagents:record", …)` (the manager's completion callback, `src/index.ts`, and the Agent tool's foreground `resume` branch, which settles inline without that callback; the shape is `AgentRecordEntryData` in `src/agent-record-entry.ts`), carrying `id`, `type`, `description`, `status`, `result`, `error`, `startedAt` and `completedAt`, plus `sessionFile`, `handle` and `alias` when the agent has them, and `worktreeLost: true` when its work lived in a worktree that has since been removed. `get_subagent_result` answers from it once the live record is gone, `Agent({ resume })` reopens the agent's session from
|
|
133
|
+
One related thing that lives nowhere else: on every top-level settle, pi-subagents writes a session entry — not an event — via `pi.appendEntry("subagents:record", …)` (the manager's completion callback, `src/index.ts`, and the Agent tool's foreground `resume` branch, which settles inline without that callback; the shape is `AgentRecordEntryData` in `src/agent-record-entry.ts`), carrying `id`, `type`, `description`, `status`, `result`, `error`, `startedAt` and `completedAt`, plus `sessionFile`, `handle` and `alias` when the agent has them, and `worktreeLost: true` when its work lived in a worktree that has since been removed. `get_subagent_result` answers from it once the live record is gone, by id or by the entry's handle or alias. `Agent({ resume })` reopens the agent's session from its id, and the entry also serves cross-extension history reconstruction. It is append-only history, not something to react to.
|
|
134
134
|
|
|
135
135
|
## Steering a running agent
|
|
136
136
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herbertgao/pi-subagents",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.1-local.1",
|
|
4
4
|
"description": "Claude Code-style autonomous subagents and workflow orchestration for Pi, with HerbertGao-maintained UI extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
},
|
|
70
70
|
"x-upstream": {
|
|
71
71
|
"package": "@tintinweb/pi-subagents",
|
|
72
|
-
"version": "0.23.
|
|
73
|
-
"reviewedVersion": "0.23.
|
|
72
|
+
"version": "0.23.1",
|
|
73
|
+
"reviewedVersion": "0.23.1",
|
|
74
74
|
"repository": "https://github.com/tintinweb/pi-subagents",
|
|
75
|
-
"commit": "
|
|
75
|
+
"commit": "9bb6c822bae9f4fe8d33384b715a5e2e96d5df10",
|
|
76
76
|
"trackVersion": true
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -93,23 +93,39 @@ function isAgentRecordEntryData(data: unknown): data is AgentRecordEntryData {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
|
-
* The latest persisted record of
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* The latest persisted record of `id` on the current branch. A resumed agent
|
|
97
|
+
* appends a new entry on each finish, so the last one wins; an entry on an
|
|
98
|
+
* abandoned branch is not this conversation's.
|
|
99
|
+
*
|
|
100
|
+
* When `matchHandle` is set, the handle and alias match too, case-insensitively
|
|
101
|
+
* like `@handle`, and only if no entry's id is `id`. Resume leaves it off: it
|
|
102
|
+
* reopens whatever this returns, and a handle would reopen a saved session
|
|
103
|
+
* while that agent's live record still exists.
|
|
99
104
|
*/
|
|
100
105
|
export function findAgentRecordEntry(
|
|
101
106
|
ctx: ExtensionContext,
|
|
102
107
|
id: string,
|
|
108
|
+
matchHandle = false,
|
|
103
109
|
): AgentRecordEntryData | undefined {
|
|
104
110
|
const entries = ctx.sessionManager.getBranch()
|
|
111
|
+
const wanted = id.toLowerCase()
|
|
112
|
+
let named: AgentRecordEntryData | undefined
|
|
105
113
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
106
114
|
const entry = entries[i]
|
|
107
115
|
if (entry.type !== "custom" || entry.customType !== AGENT_RECORD_ENTRY_TYPE)
|
|
108
116
|
continue
|
|
109
|
-
if (isAgentRecordEntryData(entry.data)
|
|
110
|
-
|
|
117
|
+
if (!isAgentRecordEntryData(entry.data)) continue
|
|
118
|
+
if (entry.data.id === id) return entry.data
|
|
119
|
+
if (
|
|
120
|
+
matchHandle &&
|
|
121
|
+
named === undefined &&
|
|
122
|
+
(entry.data.handle?.toLowerCase() === wanted ||
|
|
123
|
+
entry.data.alias?.toLowerCase() === wanted)
|
|
124
|
+
) {
|
|
125
|
+
named = entry.data
|
|
126
|
+
}
|
|
111
127
|
}
|
|
112
|
-
return
|
|
128
|
+
return named
|
|
113
129
|
}
|
|
114
130
|
|
|
115
131
|
/**
|
|
@@ -3814,13 +3814,18 @@ Terse command-style prompts produce shallow, generic work.
|
|
|
3814
3814
|
const record = resolveAgentRef(params.agent_id)
|
|
3815
3815
|
if (!record) {
|
|
3816
3816
|
// Evicted, or lost to a reload: answer from the record the session saved.
|
|
3817
|
-
// An evicted handle still resolves to its id through its tombstone.
|
|
3817
|
+
// An evicted handle still resolves to its id through its tombstone. After
|
|
3818
|
+
// a reload there is no tombstone, so the saved entry's handle and alias
|
|
3819
|
+
// have to match on their own.
|
|
3818
3820
|
const tombstone = manager.resolveMention(params.agent_id)
|
|
3819
|
-
const
|
|
3820
|
-
ctx,
|
|
3821
|
+
const savedId =
|
|
3821
3822
|
tombstone?.kind === "tombstone"
|
|
3822
3823
|
? tombstone.entry.id
|
|
3823
|
-
: params.agent_id
|
|
3824
|
+
: params.agent_id
|
|
3825
|
+
const saved = findAgentRecordEntry(
|
|
3826
|
+
ctx,
|
|
3827
|
+
savedId,
|
|
3828
|
+
tombstone === undefined,
|
|
3824
3829
|
)
|
|
3825
3830
|
if (saved) {
|
|
3826
3831
|
outbox.cancel(saved.id)
|