@herbertgao/pi-extensions 2026.11.5 → 2026.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -2
  3. package/THIRD_PARTY_NOTICES.md +1 -1
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +5 -4
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -4
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +4 -4
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +6 -0
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +22 -4
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/session-tokens.ts +3 -3
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +22 -2
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +5 -0
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +38 -6
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +2 -1
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +4 -4
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-layout.ts +6 -6
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-palette.ts +4 -4
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +3 -2
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-mode.ts +465 -0
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-scope.ts +44 -0
  22. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  23. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark-hc.json +2 -4
  24. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +3 -5
  25. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light-hc.json +2 -4
  26. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +3 -5
  27. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +10 -0
  28. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  29. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +1 -1
  31. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/asset-producer.md +1 -1
  32. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/documenter.md +4 -4
  33. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
  34. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/manual-edit-applier.md +3 -2
  35. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +13 -7
  36. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/init.md +2 -0
  37. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +5 -3
  38. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +2 -2
  39. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  40. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  41. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable +39 -22
  42. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable.cmd +43 -15
  43. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +357 -139
  44. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @herbertgao/pi-extensions
2
2
 
3
+ ## 2026.11.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`47bf3d5`](https://github.com/HerbertGao/pi-extensions/commit/47bf3d5c5d482a4fcb1e60a994455a4fc6bbe5e4), [`47bf3d5`](https://github.com/HerbertGao/pi-extensions/commit/47bf3d5c5d482a4fcb1e60a994455a4fc6bbe5e4), [`47bf3d5`](https://github.com/HerbertGao/pi-extensions/commit/47bf3d5c5d482a4fcb1e60a994455a4fc6bbe5e4), [`47bf3d5`](https://github.com/HerbertGao/pi-extensions/commit/47bf3d5c5d482a4fcb1e60a994455a4fc6bbe5e4)]:
8
+ - @herbertgao/pi-impeccable@0.2.0
9
+ - @herbertgao/pi-cc-extensions@1.1.0
10
+
3
11
  ## 2026.11.5
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -41,13 +41,13 @@ The package bundles 6 active `@herbertgao/*` child packages—`pi-agency`, `pi-b
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.15`; 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.
44
+ The locally customized CC package follows upstream `pi-cc-extensions@1.0.16`; 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
46
  Antigravity `0.12.0` enriches search citations by visiting source sites by default (`ANTIGRAVITY_NO_SOURCE_ENRICH=1` disables enrichment). `ANTIGRAVITY_DEFER_TOOLS=1` registers `google_search` and `generate_image` as deferred tools; the default stays direct. A refreshed catalog does not restore a model the current catalog omitted, and an image save rejects a symlink destination. 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
 
50
- Impeccable `4.8.0` is vendored as `@herbertgao/pi-impeccable` and loaded with `/skill:impeccable`. Its native engine downloads to `~/.impeccable` on first use after SHA-256 verification; set `IMPECCABLE_BIN` for offline or preinstalled setups. The package does not install automatic post-edit hooks, and upstream `pin`/`unpin` do not discover npm-loaded skills.
50
+ Impeccable `4.8.1` is vendored as `@herbertgao/pi-impeccable` and loaded with `/skill:impeccable`. Its native engine downloads to `~/.impeccable` on first use after SHA-256 verification; set `IMPECCABLE_BIN` for offline or preinstalled setups. The launcher skips a sibling engine binary that reports a different version. Go leaves a staged removal in the page so Undo and Discard can restore it. The package does not install automatic post-edit hooks, and upstream `pin`/`unpin` do not discover npm-loaded skills.
51
51
 
52
52
  ### Agency Agents
53
53
 
@@ -217,4 +217,4 @@ The aggregate bundles [`pi-provider-qoder`](https://github.com/simonsmh/pi-provi
217
217
 
218
218
  ## `@herbertgao/pi-impeccable`
219
219
 
220
- The aggregate bundles [`@herbertgao/pi-impeccable`](https://github.com/HerbertGao/pi-extensions/tree/master/packages/pi-impeccable), vendored from [`pbakaus/impeccable`](https://github.com/pbakaus/impeccable) release `4.8.0` at commit `414603bf14c7a344edb466bb1f85690c77ce8b7d`, under the Apache License 2.0. The bundled child package includes the complete upstream `LICENSE` and `NOTICE.md`, including its third-party attributions.
220
+ The aggregate bundles [`@herbertgao/pi-impeccable`](https://github.com/HerbertGao/pi-extensions/tree/master/packages/pi-impeccable), vendored from [`pbakaus/impeccable`](https://github.com/pbakaus/impeccable) release `4.8.1` at commit `924bbd194d02e5e15a227e75b5901fb0d7a4ecad`, under the Apache License 2.0. `scripts/live-browser.js` includes one local fix that keeps a staged removal in the live DOM. The bundled child package includes the complete upstream `LICENSE` and `NOTICE.md`, including its third-party attributions.
@@ -1,5 +1,15 @@
1
1
  # @herbertgao/pi-cc-extensions
2
2
 
3
+ ## 1.0.16-local.1
4
+
5
+ ### Minor Changes
6
+
7
+ - [#362](https://github.com/HerbertGao/pi-extensions/pull/362) [`47bf3d5`](https://github.com/HerbertGao/pi-extensions/commit/47bf3d5c5d482a4fcb1e60a994455a4fc6bbe5e4) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Replay upstream pi-cc-extensions 1.0.16. Ctrl+O opens a fullscreen transcript with tools expanded and leaves the live transcript unchanged. The session token chip follows the Nerd Font switch, compact summaries wait until a declared tool is mounted, and diff colors follow success and error. Regular mode still does not enable terminal mouse reporting.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#362](https://github.com/HerbertGao/pi-extensions/pull/362) [`47bf3d5`](https://github.com/HerbertGao/pi-extensions/commit/47bf3d5c5d482a4fcb1e60a994455a4fc6bbe5e4) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Keep a shell tool's elapsed time when Ctrl+O opens the fullscreen transcript.
12
+
3
13
  ## 1.0.15-local.1
4
14
 
5
15
  ### Minor Changes
@@ -32,8 +32,9 @@ Run `/reload` after installation.
32
32
  | Fullscreen mode | Tool card/group expand and collapse on click, previews, hover highlight, and a back-to-bottom button | `TUIMODE=fullscreen` or `--tui-mode fullscreen` |
33
33
  | Settings panel | `Style / Features / UI / Diff / Thinking / Footer` tabs | `/ccstyle` |
34
34
  | Context inspection | Usage breakdown and previews for the system prompt, memory, skills, tools definition, and messages | `/context` |
35
+ | Transcript browsing | Full-screen transcript browsing with every tool output expanded | `Ctrl+O` |
35
36
  | Session/Subagent references | Search and inject effective context from previous Sessions or existing SubAgents | `@` |
36
- | Status bar | Shows model, context, cache, cost, the conversation token total, and git; also works with `@narumitw/pi-usage` for live quota. Git/cache Nerd Font icons can be turned off | `/ccstyle` |
37
+ | Status bar | Shows model, context, cache, cost, the conversation token total, and git; also works with `@narumitw/pi-usage` for live quota. Git/cache/token Nerd Font icons can be turned off | `/ccstyle` |
37
38
  | Theme | Bundled themes: CC Dark, CC Light, CC Dark HC, CC Light HC | `/settings` → Theme |
38
39
 
39
40
  Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-examples-default.md) · [compact](./docs/tool-render-examples-compact.md)
@@ -86,10 +87,10 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
86
87
  "footerTokenRate": true, // output rate chip; false hides it
87
88
  "footerTokenRateMode": "average", // average: whole-prompt avg; live: trailing 1s rate
88
89
  "footerTokenRateTtft": true, // append TTFT to the rate chip; false shows tok/s only
89
- "footerSessionTokens": false, // conversation token total chip (∑); sums usage.totalTokens from session entries. Off by default
90
+ "footerSessionTokens": false, // conversation token total chip (Nerd Font glyph, Σ in plain text); sums usage.totalTokens from session entries. Off by default
90
91
  "footerCurrency": "USD", // display currency for the footer cost
91
92
  "footerCurrencyRate": null, // display units per 1 cost unit; null changes the symbol only
92
- "footerNerdIcons": true, // Nerd Font glyphs for git/cache; false = plain text
93
+ "footerNerdIcons": true, // Nerd Font glyphs for git/cache/tokens; false = plain text
93
94
  "footerGitStatsMode": "working", // working (default): uncommitted; branch: cumulative net changes
94
95
  "footerHiddenKeys": [], // hidden chip keys
95
96
  "footerLine1Keys": ["model", "context", "cache", "rate", "cost", "tokens", "pi-usage"], // chip order per line; builtins and plugins share one layout
@@ -128,7 +129,7 @@ pi -e . # one run, does not edit settings.json
128
129
 
129
130
  ## Credits
130
131
 
131
- - Based on [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.15 (MIT), upstream baseline [`b996151`](https://github.com/minuque/pi-cc-extensions/commit/b996151bb63028c270340bde3e9526a62c634d2f), with this repository's configuration migration and compatibility patches retained.
132
+ - Based on [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.16 (MIT), upstream baseline [`5e3ef6b`](https://github.com/minuque/pi-cc-extensions/commit/5e3ef6b9f96d198f93ec242eac81ff21bebdb4e1), with this repository's configuration migration and compatibility patches retained.
132
133
  - 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
134
 
134
135
  ## License
@@ -32,8 +32,9 @@ pi install git:github.com/HerbertGao/pi-extensions
32
32
  | Fullscreen mode | 工具卡/group 单击展开与收起、预览、hover 高亮、回到底部按钮 | `TUIMODE=fullscreen` 或 `--tui-mode fullscreen` |
33
33
  | 配置面板 | `Style / Features / UI / Diff / Thinking / Footer` 六页签 | `/ccstyle` |
34
34
  | 上下文检查 | 查看上下文占用,并预览 System prompt、Memory、Skills、Tools definition 和消息内容 | `/context` |
35
+ | 会话记录浏览 | 全屏浏览完整会话记录,工具输出全展开 | `Ctrl+O` |
35
36
  | Session/Subagent 引用 | 搜索并注入历史 Session 或现有 SubAgent 的有效上下文 | `@` |
36
- | 状态栏 | 显示:模型、上下文、缓存、费用、本次对话累计 token、git并适配 @narumitw/pi-usage 实时显示额度;git/缓存图标可关 Nerd Font | `/ccstyle` |
37
+ | 状态栏 | 显示:模型、上下文、缓存、费用、本次对话累计 token、git并适配 @narumitw/pi-usage 实时显示额度;git/缓存/token 图标可关 Nerd Font | `/ccstyle` |
37
38
  | 主题 | 随包提供 4 个主题:CC Dark、CC Light、CC Dark HC、CC Light HC | `/settings` → Theme |
38
39
 
39
40
  `on` / `compact` 两种模式的渲染样例:[默认模式](./docs/tool-render-examples-default.md) · [紧凑模式](./docs/tool-render-examples-compact.md)
@@ -86,10 +87,10 @@ pi install git:github.com/HerbertGao/pi-extensions
86
87
  "footerTokenRate": true, // 输出速率芯片;false 隐藏
87
88
  "footerTokenRateMode": "average", // average:整段指令平均(avg);live:最近 1 秒瞬时(live)
88
89
  "footerTokenRateTtft": true, // 速率芯片是否带 TTFT;false 只显示 tok/s
89
- "footerSessionTokens": false, // 本次对话累计 token 芯片(∑);累加会话条目的 usage.totalTokens,默认关
90
+ "footerSessionTokens": false, // 本次对话累计 token 芯片(Nerd Font 图标,纯文本为 Σ);累加会话条目的 usage.totalTokens,默认关
90
91
  "footerCurrency": "USD", // 底栏费用的显示币种
91
92
  "footerCurrencyRate": null, // 1 单位费用换成多少显示币种;null 只换符号、不乘倍率
92
- "footerNerdIcons": true, // git/缓存用 Nerd Font 图标;false 为纯文本
93
+ "footerNerdIcons": true, // git/缓存/token 用 Nerd Font 图标;false 为纯文本
93
94
  "footerGitStatsMode": "working", // working(默认):未提交改动;branch:分支累计净改动
94
95
  "footerHiddenKeys": [], // 隐藏的芯片 key
95
96
  "footerLine1Keys": ["model", "context", "cache", "rate", "cost", "tokens", "pi-usage"], // 每行芯片顺序;内置项与插件同一套排布
@@ -128,7 +129,7 @@ pi -e . # 只跑一次,不改 settings.json
128
129
 
129
130
  ## 致谢
130
131
 
131
- - 基于 [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.15(MIT),上游基线 [`b996151`](https://github.com/minuque/pi-cc-extensions/commit/b996151bb63028c270340bde3e9526a62c634d2f);保留本仓库的配置迁移与兼容性补丁。
132
+ - 基于 [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.16(MIT),上游基线 [`5e3ef6b`](https://github.com/minuque/pi-cc-extensions/commit/5e3ef6b9f96d198f93ec242eac81ff21bebdb4e1);保留本仓库的配置迁移与兼容性补丁。
132
133
  - 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
134
 
134
135
  ## 许可证
@@ -760,8 +760,8 @@ export async function showCcstylePanel(
760
760
  id: "footerNerdIcons",
761
761
  label: "Nerd Font icons",
762
762
  description: config.footerNerdIcons
763
- ? "Git and cache chips use Nerd Font glyphs. Turn off for plain text."
764
- : "Git and cache chips use plain text. No Nerd Font required.",
763
+ ? "Git, cache and token chips use Nerd Font glyphs. Turn off for plain text."
764
+ : "Git, cache and token chips use plain text. No Nerd Font required.",
765
765
  currentValue: config.footerNerdIcons ? "on" : "off",
766
766
  values: ["on", "off"],
767
767
  };
@@ -938,8 +938,8 @@ export async function showCcstylePanel(
938
938
  updateConfig({ footerNerdIcons: enabled });
939
939
  footerNerdIconsSetting.currentValue = enabled ? "on" : "off";
940
940
  footerNerdIconsSetting.description = enabled
941
- ? "Git and cache chips use Nerd Font glyphs. Turn off for plain text."
942
- : "Git and cache chips use plain text. No Nerd Font required.";
941
+ ? "Git, cache and token chips use Nerd Font glyphs. Turn off for plain text."
942
+ : "Git, cache and token chips use plain text. No Nerd Font required.";
943
943
  ctx.ui.notify(`Updated ${id}: ${value}`, "info");
944
944
  return;
945
945
  }
@@ -26,6 +26,7 @@ import {
26
26
  styleCompactThinkingText,
27
27
  } from "../renderer/compact-mode.ts";
28
28
  import { refreshMountedTranscript } from "../renderer/transcript-refresh.ts";
29
+ import { isTranscriptComponent } from "../renderer/transcript-scope.ts";
29
30
  import {
30
31
  COMPACT_THINKING_OWNER,
31
32
  COMPACT_THINKING_PATCH_KEY,
@@ -645,6 +646,11 @@ function compactThinking(pi: ExtensionAPI) {
645
646
  message: AssistantMessage,
646
647
  isStreaming?: boolean,
647
648
  ) {
649
+ // 浏览层副本:不改写思考块,也不当作最新消息跟踪。
650
+ if (isTranscriptComponent(this)) {
651
+ originalUpdateContent.call(this, message, isStreaming);
652
+ return;
653
+ }
648
654
  const component = this as AssistantMessageComponentLike;
649
655
  const self = this as unknown as AssistantInternals;
650
656
  // isStreaming 丢失 → mermaid 流式误渲染来回闪。
@@ -59,10 +59,26 @@ export const FOOTER_NERD_ICON_CACHE = "󰆼";
59
59
  // md power-plug:MCP 服务器连接数
60
60
  export const FOOTER_NERD_ICON_MCP = "\u{f06a5}";
61
61
 
62
- export function footerGlyphs(nerdIcons: boolean): { git: string; cache: string; mcp: string } {
62
+ // md sigma:会话累计 token。与缓存、MCP 同属 md 图标,字高一致。
63
+ export const FOOTER_NERD_ICON_TOKENS = "\u{f04a0}";
64
+ // 纯文本用希腊字母 Σ:数学求和号 ∑ 在多数字体里比数字高,排在芯片里突兀。
65
+ // 不留空:只剩数字时看不出是 token 总数。
66
+ export const FOOTER_PLAIN_ICON_TOKENS = "Σ";
67
+
68
+ export function footerGlyphs(nerdIcons: boolean): {
69
+ git: string;
70
+ cache: string;
71
+ mcp: string;
72
+ tokens: string;
73
+ } {
63
74
  return nerdIcons
64
- ? { git: FOOTER_NERD_ICON_GIT, cache: FOOTER_NERD_ICON_CACHE, mcp: FOOTER_NERD_ICON_MCP }
65
- : { git: "", cache: "", mcp: "" };
75
+ ? {
76
+ git: FOOTER_NERD_ICON_GIT,
77
+ cache: FOOTER_NERD_ICON_CACHE,
78
+ mcp: FOOTER_NERD_ICON_MCP,
79
+ tokens: FOOTER_NERD_ICON_TOKENS,
80
+ }
81
+ : { git: "", cache: "", mcp: "", tokens: FOOTER_PLAIN_ICON_TOKENS };
66
82
  }
67
83
 
68
84
  /**
@@ -487,7 +503,9 @@ const createCustomFooterFactory =
487
503
  const costChip = costLabel
488
504
  ? theme.fg("dim", costLabel) + (usingSubscription ? theme.fg("warning", " sub") : "")
489
505
  : "";
490
- const tokensLabel = config.footerSessionTokens ? formatSessionTokenTotal(tokens) : "";
506
+ const tokensLabel = config.footerSessionTokens
507
+ ? formatSessionTokenTotal(tokens, footerGlyphs(config.footerNerdIcons).tokens)
508
+ : "";
491
509
 
492
510
  const gitColor = theme.getThinkingBorderColor("medium");
493
511
  let place = theme.fg("accent", cwdLabel);
@@ -45,8 +45,8 @@ export function sessionEntryTokens(entry: unknown): number {
45
45
  return 0;
46
46
  }
47
47
 
48
- /** 芯片文案:`∑ 402k`;没有数据返回空串(不占位置)。 */
49
- export function formatSessionTokenTotal(total: number): string {
48
+ /** 芯片文案:`<glyph> 402k`;没有数据返回空串(不占位置)。 */
49
+ export function formatSessionTokenTotal(total: number, glyph: string): string {
50
50
  if (!Number.isFinite(total) || total <= 0) return "";
51
- return `∑ ${formatTokenCount(Math.round(total))}`;
51
+ return `${glyph} ${formatTokenCount(Math.round(total))}`;
52
52
  }
@@ -60,6 +60,14 @@ import { isToolCallHovered } from "./mouse/hover.ts";
60
60
  import { getToolMouseTui } from "./mouse/scroll.ts";
61
61
  import { expandedBodyComponent, insetComponent } from "./tool/result.ts";
62
62
  import { isLiveToolCall, scheduleAnimation } from "./tool/tool-state.ts";
63
+ import { isTranscriptComponent } from "./transcript-scope.ts";
64
+
65
+ const COMPACT_ROUND_TAIL_KEY = Symbol.for("ccstyle.compactRoundTail");
66
+
67
+ /** compact 挂进对话区的回合尾行(摘要行与槽位卡),浏览层跳过它。 */
68
+ export function isCompactRoundTail(value: unknown): boolean {
69
+ return Boolean(value && typeof value === "object" && (value as any)[COMPACT_ROUND_TAIL_KEY]);
70
+ }
63
71
  import { renderExpandedToolResult } from "./tool/tool-io.ts";
64
72
  import { paddedBackgroundRow } from "./tool/grouping.ts";
65
73
  import { styleChangeCounts } from "./tool/ccstyle-tool.ts";
@@ -1479,15 +1487,22 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
1479
1487
  /**
1480
1488
  * 回合还有活干:成员消息仍在流式,或本回合的工具还没拿到最终结果。
1481
1489
  * 收尾要么按事实等活干完,要么摘要行就会把仍在跑的工具报成 Ran for。
1490
+ * pendingLiveTool 是「toolCall 已写进消息、组件还没挂上」的空窗:流停了也要等它合上。
1491
+ * 只在 renderRoundLive 里按缺组件重算;空闲回放不会再补组件,不因此停在 Running。
1482
1492
  */
1483
1493
  const roundHasLiveWork = (round: CompactRound): boolean => {
1494
+ if (round.pendingLiveTool && !sessionIdle()) return true;
1484
1495
  for (const component of round.messages.keys()) {
1485
1496
  if (component?.isStreaming === true) return true;
1486
1497
  }
1487
1498
  const ids = roundToolCallIds(round);
1488
1499
  if (ids.size === 0) return false;
1489
1500
  for (const tool of trackedToolComponents) {
1490
- if (typeof tool?.toolCallId === "string" && ids.has(tool.toolCallId) && isRunningTool(tool)) {
1501
+ const id = tool?.toolCallId;
1502
+ if (typeof id !== "string" || !ids.has(id)) continue;
1503
+ if (isRunningTool(tool)) return true;
1504
+ // 组件已挂上、还没 markExecutionStarted:声明期 id 仍在等派发。
1505
+ if (!sessionIdle() && isLiveToolCall(id) && (!tool.result || tool.isPartial === true)) {
1491
1506
  return true;
1492
1507
  }
1493
1508
  }
@@ -1625,6 +1640,7 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
1625
1640
  }
1626
1641
  const tail: MountedRoundTail = { host: undefined, container: undefined, parts: [], round };
1627
1642
  const host: any = {
1643
+ [COMPACT_ROUND_TAIL_KEY]: true,
1628
1644
  outputPad: Number(round.anchor?.outputPad) || 0,
1629
1645
  children: [],
1630
1646
  render: (width: number) => tail.parts.flatMap((part: any) => part?.render?.(width) ?? []),
@@ -2287,6 +2303,8 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
2287
2303
  return patch.assistantNative.call(this, message, isStreaming);
2288
2304
  }
2289
2305
  self.lastMessage = message;
2306
+ // 浏览层副本:不进回合跟踪,按原生方式渲染完整消息。
2307
+ if (isTranscriptComponent(this)) return passThroughAssistant(this, message, isStreaming);
2290
2308
  trackedAssistantComponents.add(this);
2291
2309
  if (!patch.active || config.mode !== "compact") {
2292
2310
  return passThroughAssistant(this, message, isStreaming);
@@ -2431,7 +2449,7 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
2431
2449
  };
2432
2450
 
2433
2451
  patch.toolInstalledRender = function (this: any, width: number) {
2434
- if (!patch.active || config.mode !== "compact") {
2452
+ if (!patch.active || config.mode !== "compact" || isTranscriptComponent(this)) {
2435
2453
  return patch.toolOriginalRender.call(this, width);
2436
2454
  }
2437
2455
  const name = String(this.toolName ?? "");
@@ -2460,6 +2478,8 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
2460
2478
  };
2461
2479
 
2462
2480
  patch.toolInstalledUpdateDisplay = function (this: any) {
2481
+ // 浏览层副本:不受回合展开规则约束,也不进组件跟踪。
2482
+ if (isTranscriptComponent(this)) return patch.toolOriginalUpdateDisplay.call(this);
2463
2483
  const id = String(this.toolCallId ?? "");
2464
2484
  if (
2465
2485
  patch.active &&
@@ -31,6 +31,7 @@ import {
31
31
  TOOL_MOUSE_DISABLE,
32
32
  } from "./mouse/interaction.ts";
33
33
  import { getToolMouseTui, noteNewTranscriptItem } from "./mouse/scroll.ts";
34
+ import { installTranscriptMode, teardownTranscriptMode } from "./transcript-mode.ts";
34
35
  import {
35
36
  disposeStickyPromptPatches,
36
37
  installStickyPromptPatches,
@@ -254,6 +255,8 @@ export default function (
254
255
  // 鼠标交互独立于渲染层:fullscreen 渲染层让位(hooks undefined)但
255
256
  // 工具点击/回到底部适配仍需安装;保持在渲染层安装之后以维持原顺序。
256
257
  if (ctx?.mode === "tui" && ctx?.hasUI) installToolMouseInteraction(ctx, mouseOwner);
258
+ // 浏览模式与鼠标交互同为输入监听,跟着一起装。
259
+ installTranscriptMode(ctx);
257
260
  if (!hooks) return;
258
261
  hooks.toolGrouping.setTheme(ctx.ui.theme);
259
262
  setMessageDisplayTheme(ctx.ui.theme);
@@ -278,6 +281,7 @@ export default function (
278
281
  // Compaction rebuilds the transcript without session_start. Rebind after
279
282
  // other TUI extensions may have replaced the root input dispatcher.
280
283
  if (ctx?.mode === "tui" && ctx?.hasUI) installToolMouseInteraction(ctx, mouseOwner);
284
+ installTranscriptMode(ctx);
281
285
  if (!hooks) return;
282
286
  hooks.toolGrouping.setTheme(ctx.ui.theme);
283
287
  setMessageDisplayTheme(ctx.ui.theme);
@@ -318,6 +322,7 @@ export default function (
318
322
  // 鼠标交互独立于渲染层:fullscreen 下 installation 为 undefined,
319
323
  // 但 onTerminalInput 监听与 handleViewportInput 包装仍需释放。
320
324
  teardownToolMouseInteraction(mouseOwner);
325
+ teardownTranscriptMode();
321
326
  const current = installation;
322
327
  if (!current || !current.defaultMode.isOwner()) return;
323
328
  current.defaultMode.shutdown();
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { Text, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
6
6
  import { config, getToolDisplayConfig, type CompactStyleMode } from "../../config/config.ts";
7
+ import { expandedLineLimit } from "../transcript-scope.ts";
7
8
  import { isToolCallHovered } from "../mouse/hover.ts";
8
9
  import {
9
10
  ASK_USER_QUESTION_TOOL_NAME,
@@ -126,7 +127,7 @@ function renderExpandedTaskResult(
126
127
  if (toolName === "TaskList") {
127
128
  const tasks = parseTaskList(text);
128
129
  if (!tasks.length) return undefined;
129
- const limit = Math.max(1, config.expandedPreviewMaxLines);
130
+ const limit = Math.max(1, expandedLineLimit(config.expandedPreviewMaxLines));
130
131
  const rows = tasks.slice(0, limit).map((task) => {
131
132
  const color =
132
133
  task.status === "completed"
@@ -181,6 +182,33 @@ function toolElapsedMs(context: any, isPartial: boolean): number | undefined {
181
182
  return Math.max(0, end - startedAt);
182
183
  }
183
184
 
185
+ /**
186
+ * 把原卡的 shell 时钟抄到浏览层副本上。
187
+ *
188
+ * 副本是新建的 ToolExecutionComponent,rendererState 是空的。renderCall 见到
189
+ * executionStarted 且没有开始时间就会写成 Date.now(),运行中的卡、以及只靠
190
+ * 时钟记耗时的完成态,会显示成将近 0。完成态的 durationMs 在结果上,跟 result
191
+ * 一起走,这里不抄。只抄这两个字段:共享整个 state 会把展开视图和视觉状态串到对话区那张卡上。
192
+ * 必须在副本 markExecutionStarted / updateResult 之前抄,否则第一次绘制会先写上现在并缓存错误耗时。
193
+ */
194
+ export function copyShellTimingState(from: any, to: any): void {
195
+ const source = from?.rendererState;
196
+ const target = to?.rendererState;
197
+ if (!source || !target || source === target) return;
198
+ if (
199
+ typeof source.ccstyleShellStartedAt === "number" &&
200
+ Number.isFinite(source.ccstyleShellStartedAt)
201
+ ) {
202
+ target.ccstyleShellStartedAt = source.ccstyleShellStartedAt;
203
+ }
204
+ if (
205
+ typeof source.ccstyleShellEndedAt === "number" &&
206
+ Number.isFinite(source.ccstyleShellEndedAt)
207
+ ) {
208
+ target.ccstyleShellEndedAt = source.ccstyleShellEndedAt;
209
+ }
210
+ }
211
+
184
212
  /**
185
213
  * shell 的耗时文本。Pi 原生 shell 渲染器会在结果底部报一行,ccstyle 的通用折叠行把它盖掉了。
186
214
  *
@@ -196,8 +224,8 @@ function shellDurationText(toolName: string, context: any, isPartial: boolean):
196
224
 
197
225
  /**
198
226
  * 运行中的展开视图:与结束后同一份 Input / Output。
199
- * 还没输出、或正文 trim 后为空时用 Pending… 占位:空白会被视图画成 Done,像已经跑完了。
200
- * trim 只用来判空;非空正文原样保留,不整段去掉缩进和空白。
227
+ * 还没输出时用 Pending… 占位:空正文会被视图画成 Done,像已经跑完了。
228
+ * 纯空白(空格、换行、tab)同样算还没输出;非空正文保留原始缩进,不整体 trim。
201
229
  * shell 的已用时间挂到视图尾部;取值函数每帧重算,秒数才跟着动画 tick 走。
202
230
  */
203
231
  function renderRunningExpandedResult(toolName: string, result: any, context: any, theme: any): any {
@@ -474,8 +502,12 @@ export function createCcstyleTool(
474
502
  cachedWidth = width;
475
503
  cachedIcon = icon;
476
504
  // 路径按最终可用宽度中间截断,避免整行二次截断隐藏文件名。
477
- cachedLine = `${lead}${icon} ${renderToolSummary(summary, mainWidth, theme.fg.bind(theme))}${extraStyled}`;
478
- return [truncateToWidth(cachedLine, viewportWidth, "")];
505
+ cachedLine = truncateToWidth(
506
+ `${lead}${icon} ${renderToolSummary(summary, mainWidth, theme.fg.bind(theme))}${extraStyled}`,
507
+ viewportWidth,
508
+ "",
509
+ );
510
+ return [cachedLine];
479
511
  },
480
512
  invalidate() {
481
513
  cachedLine = undefined;
@@ -541,7 +573,7 @@ export function createCcstyleTool(
541
573
  if (options?.isPartial) {
542
574
  // 等待回答时也能展开看问题原文(Input 即 args.questions);折叠态 1 格缩进。
543
575
  if (expanded) return renderRunningExpandedResult(toolName, result, context, theme);
544
- // 折叠后清掉展开视图,与其它运行中工具一致。
576
+ // 折叠后清掉展开视图,与通用 partial 折叠一致。
545
577
  if (context?.state) context.state.ccstyleIoView = undefined;
546
578
  return renderRunningCollapsedResult({ toolName, context, theme, prefix: " ↳ " });
547
579
  }
@@ -11,6 +11,7 @@
11
11
  import { highlightCode } from "@earendil-works/pi-coding-agent";
12
12
  import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
13
13
  import { config } from "../../config/config.ts";
14
+ import { expandedLineLimit } from "../transcript-scope.ts";
14
15
  import { stripAnsi } from "../../utils/ansi-text.ts";
15
16
  import { oneLine } from "../../utils/format.ts";
16
17
  import { toolLoadingIcon } from "../../utils/tool-loading-icon.ts";
@@ -164,7 +165,7 @@ export function codemodeCodeLines(
164
165
  if (text) statements.push(text);
165
166
  }
166
167
  if (statements.length === 0) return [];
167
- const limit = Math.max(1, config.expandedInputMaxLines);
168
+ const limit = Math.max(1, expandedLineLimit(config.expandedInputMaxLines));
168
169
  const visible = statements.slice(0, limit);
169
170
  const rail = `${INDENT}${fg("dim", "│")} `;
170
171
  const lines = visible.map((statement) =>
@@ -53,8 +53,8 @@ function renderDiffStatBar(stats: DiffStats, width: number, theme: DiffTheme): s
53
53
  }
54
54
  const removedSlots = Math.max(0, barSlots - addedSlots);
55
55
 
56
- const addedBar = addedSlots > 0 ? theme.fg("toolDiffAdded", "━".repeat(addedSlots)) : "";
57
- const removedBar = removedSlots > 0 ? theme.fg("toolDiffRemoved", "━".repeat(removedSlots)) : "";
56
+ const addedBar = addedSlots > 0 ? theme.fg("success", "━".repeat(addedSlots)) : "";
57
+ const removedBar = removedSlots > 0 ? theme.fg("error", "━".repeat(removedSlots)) : "";
58
58
  return stabilizeBackgroundResets(
59
59
  `${theme.fg("dim", "[")}${addedBar}${removedBar}${theme.fg("dim", "]")}`,
60
60
  );
@@ -63,8 +63,8 @@ function renderDiffStatBar(stats: DiffStats, width: number, theme: DiffTheme): s
63
63
  function buildDiffSummaryBasePieces(stats: DiffStats, theme: DiffTheme): string[] {
64
64
  return [
65
65
  theme.fg("toolOutput", `↳ ${emphasis(theme, "diff")}`),
66
- theme.fg("toolDiffAdded", `+${stats.added}`),
67
- theme.fg("toolDiffRemoved", `-${stats.removed}`),
66
+ theme.fg("success", `+${stats.added}`),
67
+ theme.fg("error", `-${stats.removed}`),
68
68
  ];
69
69
  }
70
70
 
@@ -92,10 +92,10 @@ function renderChangeMarker(
92
92
  return rowBg ? `${rowBg} ${rowBg}` : " ";
93
93
  }
94
94
  if (kind === "add") {
95
- return colorizeSegment(theme, "toolDiffAdded", glyph, rowBg);
95
+ return colorizeSegment(theme, "success", glyph, rowBg);
96
96
  }
97
97
  if (kind === "remove") {
98
- return colorizeSegment(theme, "toolDiffRemoved", glyph, rowBg);
98
+ return colorizeSegment(theme, "error", glyph, rowBg);
99
99
  }
100
100
  return colorizeSegment(theme, "dim", glyph, rowBg);
101
101
  }
@@ -132,12 +132,12 @@ function renderCodeDivider(
132
132
  );
133
133
  }
134
134
 
135
- function getLineNumberColor(kind: DiffLineKind): "dim" | "toolDiffAdded" | "toolDiffRemoved" {
135
+ function getLineNumberColor(kind: DiffLineKind): "dim" | "success" | "error" {
136
136
  if (kind === "add") {
137
- return "toolDiffAdded";
137
+ return "success";
138
138
  }
139
139
  if (kind === "remove") {
140
- return "toolDiffRemoved";
140
+ return "error";
141
141
  }
142
142
  return "dim";
143
143
  }
@@ -179,7 +179,7 @@ function renderClassicContentPrefix(
179
179
  }
180
180
 
181
181
  const glyph = kind === "add" ? "+" : "-";
182
- const glyphColor = kind === "add" ? "toolDiffAdded" : "toolDiffRemoved";
182
+ const glyphColor = kind === "add" ? "success" : "error";
183
183
  const spacer = rowBg ? `${rowBg} ` : " ";
184
184
  return `${colorizeSegment(theme, glyphColor, glyph, rowBg)}${spacer}`;
185
185
  }
@@ -115,7 +115,7 @@ export function keepBackgroundAcrossResets(text: string, rowBg: string): string
115
115
 
116
116
  export function colorizeSegment(
117
117
  theme: DiffTheme,
118
- color: "dim" | "toolDiffAdded" | "toolDiffRemoved",
118
+ color: "dim" | "success" | "error",
119
119
  text: string,
120
120
  rowBg: string | undefined,
121
121
  ): string {
@@ -276,15 +276,15 @@ export function readThemeAnsi(
276
276
  export function resolveDiffPalette(theme: DiffTheme): DiffPalette {
277
277
  const fallbackBg = parseAnsiColorCode(readThemeAnsi(theme, "bg", "toolPendingBg")) ??
278
278
  parseAnsiColorCode(readThemeAnsi(theme, "bg", "userMessageBg")) ?? { r: 32, g: 35, b: 42 };
279
- // 删除行用 toolErrorBg 做基底(主题里是 diffDelBg 暗红);不定义时退回通用基底混 tint。
279
+ // 新增行/删除行的文字和底色统一取 success、error,与工具标题、footer 计数同源。
280
280
  const addBaseBg = parseAnsiColorCode(readThemeAnsi(theme, "bg", "toolSuccessBg")) ?? fallbackBg;
281
281
  const removeBaseBg = parseAnsiColorCode(readThemeAnsi(theme, "bg", "toolErrorBg")) ?? addBaseBg;
282
- const addFg = parseAnsiColorCode(readThemeAnsi(theme, "fg", "toolDiffAdded")) ?? {
282
+ const addFg = parseAnsiColorCode(readThemeAnsi(theme, "fg", "success")) ?? {
283
283
  r: 88,
284
284
  g: 173,
285
285
  b: 88,
286
286
  };
287
- const removeFg = parseAnsiColorCode(readThemeAnsi(theme, "fg", "toolDiffRemoved")) ?? {
287
+ const removeFg = parseAnsiColorCode(readThemeAnsi(theme, "fg", "error")) ?? {
288
288
  r: 196,
289
289
  g: 98,
290
290
  b: 98,
@@ -96,9 +96,9 @@ export function styleDiffSummaryLine(
96
96
  };
97
97
  if (countsIndex >= 0 && stats) {
98
98
  pushMuted(countsIndex);
99
- pieces.push(theme.fg("toolDiffAdded", `+${stats.added}`));
99
+ pieces.push(theme.fg("success", `+${stats.added}`));
100
100
  pieces.push(theme.fg("muted", " "));
101
- pieces.push(theme.fg("toolDiffRemoved", `-${stats.removed}`));
101
+ pieces.push(theme.fg("error", `-${stats.removed}`));
102
102
  cursor = countsIndex + counts.length;
103
103
  }
104
104
  if (hintIndex >= cursor) {
@@ -1,5 +1,6 @@
1
1
  import { Text, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
2
2
  import { config } from "../../config/config.ts";
3
+ import { expandedLineLimit } from "../transcript-scope.ts";
3
4
  import { sanitizeToolResultText } from "../../utils/tool-result-sanitize.ts";
4
5
  import {
5
6
  SHOW_MORE_LABEL,
@@ -648,8 +649,8 @@ export function renderExpandedToolResult(
648
649
  ): ExpandedToolIoView | ExpandedToolResultText | Text {
649
650
  const { text: inputBody, codeBlock } = formatToolInputBody(args);
650
651
  const outputBody = body;
651
- const maxOutputLines = config.expandedOutputMaxLines;
652
- const maxInputLines = config.expandedInputMaxLines;
652
+ const maxOutputLines = expandedLineLimit(config.expandedOutputMaxLines, context);
653
+ const maxInputLines = expandedLineLimit(config.expandedInputMaxLines, context);
653
654
 
654
655
  // Prefer structured Input/Output when we have args or non-empty output.
655
656
  if (inputBody.trim() || outputBody.trim()) {