@linxiraos/pi-tui 1.4.11 → 1.4.13

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 (265) hide show
  1. package/CHANGELOG.md +30 -233
  2. package/README.md +4 -1
  3. package/THIRD-PARTY-NOTICES.txt +4 -5
  4. package/dist/types/apps/shell-visualizer.d.ts +24 -0
  5. package/dist/types/autocomplete.d.ts +20 -0
  6. package/dist/types/chat/cache-invalidation-marker.d.ts +15 -7
  7. package/dist/types/chat/chat-transcript-builder.d.ts +5 -3
  8. package/dist/types/chat/display-preferences.d.ts +2 -0
  9. package/dist/types/chat/extension-types.d.ts +72 -1
  10. package/dist/types/chat/image-loading.d.ts +2 -2
  11. package/dist/types/chat/messages.d.ts +2 -3
  12. package/dist/types/chat/read-tool-group.d.ts +15 -2
  13. package/dist/types/chat/skill-message.d.ts +1 -0
  14. package/dist/types/chat/spotlight.d.ts +203 -0
  15. package/dist/types/chat/tool-execution.d.ts +26 -5
  16. package/dist/types/chat/transcript-actions.d.ts +11 -0
  17. package/dist/types/chat/transcript-browser.d.ts +9 -0
  18. package/dist/types/chat/transcript-presentation.d.ts +164 -0
  19. package/dist/types/chat/ttsr-notification.d.ts +2 -0
  20. package/dist/types/chrome/message-frame.d.ts +2 -0
  21. package/dist/types/chrome/transcript-container.d.ts +27 -6
  22. package/dist/types/components/loader.d.ts +0 -2
  23. package/dist/types/components/markdown.d.ts +11 -1
  24. package/dist/types/components/settings-list.d.ts +12 -2
  25. package/dist/types/frame-rate.d.ts +18 -0
  26. package/dist/types/hotkeys-markdown.d.ts +2 -0
  27. package/dist/types/index.d.ts +3 -0
  28. package/dist/types/keybinding-matchers.d.ts +4 -1
  29. package/dist/types/kitty-graphics.d.ts +1 -1
  30. package/dist/types/motion-effects.d.ts +10 -0
  31. package/dist/types/native/encode.d.ts +2 -0
  32. package/dist/types/native/measure.d.ts +10 -0
  33. package/dist/types/native/overlay.d.ts +1 -1
  34. package/dist/types/native/quiet.d.ts +5 -0
  35. package/dist/types/native/reconcile.d.ts +6 -1
  36. package/dist/types/native/spans.d.ts +6 -0
  37. package/dist/types/native/state.d.ts +4 -0
  38. package/dist/types/overlays/agent-hub.d.ts +6 -0
  39. package/dist/types/overlays/link-browser.d.ts +55 -0
  40. package/dist/types/overlays/running-subagent-badge.d.ts +1 -4
  41. package/dist/types/overlays/spotlight-sheet.d.ts +36 -0
  42. package/dist/types/prompt/composer-attachments.d.ts +5 -2
  43. package/dist/types/prompt/composer-cache.d.ts +7 -2
  44. package/dist/types/prompt/composer.d.ts +6 -11
  45. package/dist/types/prompt/custom-editor.d.ts +8 -2
  46. package/dist/types/prompt/gradient-highlight.d.ts +2 -2
  47. package/dist/types/prompt/magic-keywords.d.ts +2 -0
  48. package/dist/types/prompt/model-mention-autocomplete.d.ts +9 -7
  49. package/dist/types/prompt/model-mention-syntax.d.ts +6 -0
  50. package/dist/types/prompt/prompt-action-autocomplete.d.ts +2 -1
  51. package/dist/types/prompt/welcome.d.ts +19 -0
  52. package/dist/types/render/extension-links.d.ts +0 -6
  53. package/dist/types/render/index.d.ts +1 -0
  54. package/dist/types/render/link-hints.d.ts +78 -0
  55. package/dist/types/render/render-utils.d.ts +0 -2
  56. package/dist/types/setup/scenes/types.d.ts +8 -0
  57. package/dist/types/setup/scenes/updates.d.ts +6 -0
  58. package/dist/types/setup/wizard.d.ts +7 -2
  59. package/dist/types/spinner-clock.d.ts +34 -0
  60. package/dist/types/status-line/component.d.ts +8 -4
  61. package/dist/types/status-line/host.d.ts +62 -0
  62. package/dist/types/status-line/index.d.ts +1 -0
  63. package/dist/types/status-line/prompt-cache.d.ts +14 -0
  64. package/dist/types/status-line/schema.d.ts +1 -1
  65. package/dist/types/status-line/startup.d.ts +6 -0
  66. package/dist/types/status-line/types.d.ts +8 -21
  67. package/dist/types/theme/schema.d.ts +28 -1
  68. package/dist/types/theme/symbols.d.ts +1 -1
  69. package/dist/types/theme/theme-class.d.ts +12 -2
  70. package/dist/types/theme/theme.d.ts +1 -1
  71. package/dist/types/theme/tui-adapters.d.ts +7 -0
  72. package/dist/types/thinking.d.ts +12 -0
  73. package/dist/types/tools/ask.d.ts +1 -1
  74. package/dist/types/tools/bash.d.ts +21 -0
  75. package/dist/types/tools/find.d.ts +9 -1
  76. package/dist/types/tools/grep.d.ts +2 -1
  77. package/dist/types/tools/grouped-file-output.d.ts +17 -0
  78. package/dist/types/tools/job-widget.d.ts +2 -2
  79. package/dist/types/tools/lsp.d.ts +4 -2
  80. package/dist/types/tools/native-view.d.ts +4 -0
  81. package/dist/types/tools/renderer.d.ts +9 -1
  82. package/dist/types/tools/shell-trace.d.ts +10 -0
  83. package/dist/types/tools/shell-viz-render.d.ts +6 -0
  84. package/dist/types/tools/shell-viz.d.ts +16 -0
  85. package/dist/types/tools/wait.d.ts +2 -2
  86. package/dist/types/tools/web-search-types.d.ts +1 -0
  87. package/dist/types/tools/write.d.ts +2 -0
  88. package/dist/types/tui.d.ts +15 -1
  89. package/package.json +15 -11
  90. package/src/apps/shell-visualizer.d.ts +24 -0
  91. package/src/apps/shell-visualizer.ts +167 -0
  92. package/src/autocomplete.d.ts +20 -0
  93. package/src/autocomplete.ts +14 -0
  94. package/src/chat/assistant-message.ts +11 -6
  95. package/src/chat/cache-invalidation-marker.d.ts +15 -7
  96. package/src/chat/cache-invalidation-marker.ts +18 -9
  97. package/src/chat/chat-transcript-builder.d.ts +5 -3
  98. package/src/chat/chat-transcript-builder.ts +16 -12
  99. package/src/chat/display-preferences.d.ts +2 -0
  100. package/src/chat/display-preferences.ts +3 -0
  101. package/src/chat/extension-types.d.ts +72 -1
  102. package/src/chat/extension-types.ts +74 -1
  103. package/src/chat/image-loading.d.ts +2 -2
  104. package/src/chat/image-loading.ts +2 -2
  105. package/src/chat/messages.d.ts +2 -3
  106. package/src/chat/messages.ts +3 -8
  107. package/src/chat/read-tool-group.d.ts +15 -2
  108. package/src/chat/read-tool-group.ts +201 -41
  109. package/src/chat/skill-message.d.ts +1 -0
  110. package/src/chat/skill-message.ts +4 -0
  111. package/src/chat/spotlight.d.ts +203 -0
  112. package/src/chat/spotlight.ts +460 -0
  113. package/src/chat/tool-execution.d.ts +26 -5
  114. package/src/chat/tool-execution.ts +360 -38
  115. package/src/chat/transcript-actions.d.ts +11 -0
  116. package/src/chat/transcript-actions.ts +13 -1
  117. package/src/chat/transcript-browser.d.ts +9 -0
  118. package/src/chat/transcript-browser.ts +18 -0
  119. package/src/chat/transcript-presentation.d.ts +164 -0
  120. package/src/chat/transcript-presentation.ts +642 -0
  121. package/src/chat/ttsr-notification.d.ts +25 -0
  122. package/src/chat/ttsr-notification.ts +5 -0
  123. package/src/chrome/message-frame.d.ts +2 -0
  124. package/src/chrome/message-frame.ts +7 -0
  125. package/src/chrome/message-notice.d.ts +58 -0
  126. package/src/chrome/transcript-container.d.ts +27 -6
  127. package/src/chrome/transcript-container.ts +317 -66
  128. package/src/components/editor.ts +25 -1
  129. package/src/components/loader.d.ts +0 -2
  130. package/src/components/loader.ts +30 -18
  131. package/src/components/markdown.d.ts +11 -1
  132. package/src/components/markdown.ts +41 -16
  133. package/src/components/settings-list.d.ts +12 -2
  134. package/src/components/settings-list.ts +29 -13
  135. package/src/frame-rate.d.ts +18 -0
  136. package/src/frame-rate.ts +36 -0
  137. package/src/hotkeys-markdown.ts +9 -2
  138. package/src/index.d.ts +3 -0
  139. package/src/index.ts +3 -0
  140. package/src/keybinding-matchers.d.ts +4 -1
  141. package/src/keybinding-matchers.ts +13 -12
  142. package/src/kitty-graphics.d.ts +1 -1
  143. package/src/kitty-graphics.ts +3 -2
  144. package/src/motion-effects.d.ts +10 -0
  145. package/src/motion-effects.ts +27 -0
  146. package/src/native/backend.ts +66 -7
  147. package/src/native/encode.d.ts +2 -0
  148. package/src/native/encode.ts +2 -0
  149. package/src/native/measure.d.ts +10 -0
  150. package/src/native/measure.ts +185 -0
  151. package/src/native/overlay.d.ts +1 -1
  152. package/src/native/overlay.ts +1 -1
  153. package/src/native/quiet.d.ts +5 -0
  154. package/src/native/quiet.ts +105 -0
  155. package/src/native/reconcile.d.ts +6 -1
  156. package/src/native/reconcile.ts +16 -10
  157. package/src/native/spans.d.ts +6 -0
  158. package/src/native/spans.ts +40 -0
  159. package/src/native/state.d.ts +4 -0
  160. package/src/native/state.ts +18 -0
  161. package/src/overlays/agent-hub.ts +15 -2
  162. package/src/overlays/ask-dialog.ts +1 -0
  163. package/src/overlays/btw-history-panel.ts +73 -6
  164. package/src/overlays/link-browser.ts +295 -0
  165. package/src/overlays/running-subagent-badge.ts +2 -9
  166. package/src/overlays/settings-defs.ts +1 -1
  167. package/src/overlays/settings-selector.ts +17 -3
  168. package/src/overlays/spotlight-sheet.ts +478 -0
  169. package/src/overlays/usage-dashboard.ts +6 -5
  170. package/src/prompt/composer-attachments.d.ts +5 -2
  171. package/src/prompt/composer-attachments.ts +6 -6
  172. package/src/prompt/composer-cache.ts +17 -16
  173. package/src/prompt/composer.ts +30 -123
  174. package/src/prompt/custom-editor.ts +17 -13
  175. package/src/prompt/gradient-highlight.d.ts +2 -2
  176. package/src/prompt/gradient-highlight.ts +5 -4
  177. package/src/prompt/magic-keywords.d.ts +2 -0
  178. package/src/prompt/magic-keywords.ts +4 -1
  179. package/src/prompt/model-mention-autocomplete.ts +73 -20
  180. package/src/prompt/model-mention-syntax.d.ts +6 -0
  181. package/src/prompt/model-mention-syntax.ts +9 -0
  182. package/src/prompt/prompt-action-autocomplete.ts +49 -33
  183. package/src/prompt/tips.txt +1 -0
  184. package/src/prompt/welcome.ts +104 -2
  185. package/src/render/extension-links.d.ts +0 -6
  186. package/src/render/extension-links.ts +0 -20
  187. package/src/render/index.d.ts +1 -0
  188. package/src/render/index.ts +1 -0
  189. package/src/render/link-hints.d.ts +78 -0
  190. package/src/render/link-hints.ts +299 -0
  191. package/src/render/render-utils.d.ts +0 -2
  192. package/src/render/render-utils.ts +0 -5
  193. package/src/setup/scenes/glyph.ts +1 -1
  194. package/src/setup/scenes/types.ts +8 -0
  195. package/src/setup/scenes/updates.ts +116 -0
  196. package/src/setup/wizard.ts +19 -8
  197. package/src/spinner-clock.d.ts +34 -0
  198. package/src/spinner-clock.ts +79 -0
  199. package/src/status-line/component.ts +145 -53
  200. package/src/status-line/host.ts +51 -0
  201. package/src/status-line/index.ts +1 -0
  202. package/src/status-line/presets.ts +3 -1
  203. package/src/status-line/prompt-cache.ts +154 -0
  204. package/src/status-line/schema.ts +1 -1
  205. package/src/status-line/segments.ts +33 -22
  206. package/src/status-line/startup.ts +22 -4
  207. package/src/status-line/types.ts +8 -22
  208. package/src/stdin-buffer.ts +89 -46
  209. package/src/terminal-capabilities.ts +3 -3
  210. package/src/terminal.ts +1 -8
  211. package/src/theme/loader.ts +3 -2
  212. package/src/theme/schema.d.ts +28 -1
  213. package/src/theme/schema.ts +30 -1
  214. package/src/theme/symbols.d.ts +1 -1
  215. package/src/theme/symbols.ts +15 -3
  216. package/src/theme/theme-class.d.ts +12 -2
  217. package/src/theme/theme-class.ts +23 -0
  218. package/src/theme/theme-schema.json +1 -1
  219. package/src/theme/theme.d.ts +1 -1
  220. package/src/theme/theme.ts +3 -7
  221. package/src/theme/tui-adapters.d.ts +7 -0
  222. package/src/theme/tui-adapters.ts +33 -1
  223. package/src/thinking.d.ts +12 -0
  224. package/src/thinking.ts +31 -0
  225. package/src/tools/ask.d.ts +1 -1
  226. package/src/tools/ask.ts +99 -38
  227. package/src/tools/ast-edit.ts +51 -32
  228. package/src/tools/ast-grep.ts +31 -19
  229. package/src/tools/bash.d.ts +21 -0
  230. package/src/tools/bash.ts +166 -24
  231. package/src/tools/find.d.ts +9 -1
  232. package/src/tools/find.ts +23 -2
  233. package/src/tools/grep.d.ts +2 -1
  234. package/src/tools/grep.ts +52 -36
  235. package/src/tools/grouped-file-output.d.ts +17 -0
  236. package/src/tools/grouped-file-output.ts +20 -2
  237. package/src/tools/job-widget.d.ts +2 -2
  238. package/src/tools/job-widget.ts +2 -2
  239. package/src/tools/lsp.d.ts +4 -2
  240. package/src/tools/lsp.ts +537 -642
  241. package/src/tools/native-view.d.ts +4 -0
  242. package/src/tools/native-view.ts +8 -2
  243. package/src/tools/renderer.d.ts +9 -1
  244. package/src/tools/renderer.ts +9 -1
  245. package/src/tools/shell-trace.d.ts +10 -0
  246. package/src/tools/shell-trace.ts +80 -0
  247. package/src/tools/shell-viz-render.d.ts +6 -0
  248. package/src/tools/shell-viz-render.ts +156 -0
  249. package/src/tools/shell-viz.d.ts +16 -0
  250. package/src/tools/shell-viz.ts +181 -0
  251. package/src/tools/streaming-output.ts +18 -8
  252. package/src/tools/wait.d.ts +2 -2
  253. package/src/tools/wait.ts +39 -34
  254. package/src/tools/web-search-types.d.ts +1 -0
  255. package/src/tools/web-search-types.ts +1 -0
  256. package/src/tools/write.d.ts +2 -0
  257. package/src/tools/write.ts +2 -0
  258. package/src/tui.d.ts +15 -1
  259. package/src/tui.ts +63 -6
  260. package/src/windows-input-mode.ts +7 -1
  261. package/dist/types/chat/collab-prompt-message.d.ts +0 -14
  262. package/dist/types/chrome/collab-qrcode.d.ts +0 -35
  263. package/src/chat/collab-prompt-message.d.ts +0 -14
  264. package/src/chat/collab-prompt-message.ts +0 -46
  265. package/src/chrome/collab-qrcode.ts +0 -99
@@ -22,11 +22,16 @@ export interface CacheInvalidation {
22
22
  * reusing.
23
23
  *
24
24
  * The provider reports a warm prefix as `cacheRead`; a model/thinking/tool/
25
- * system-prompt change (or a history rewrite) breaks the prefix, so the next
26
- * request reads nothing from cache and re-pays for the whole prompt. We flag
25
+ * system-prompt change, a history rewrite or an expired entry breaks the
26
+ * prefix, so the next request re-pays for the prompt past the break. We flag
27
27
  * only the transition where a demonstrably warm cache goes cold: the previous
28
- * turn must have actually READ a meaningful prefix back, and this turn's
29
- * `cacheRead` collapsed to zero while it still reprocessed a non-trivial prompt.
28
+ * turn must have actually READ a meaningful prefix back, and this turn read
29
+ * back less than half of it while it still reprocessed a non-trivial prompt.
30
+ *
31
+ * A collapse need not reach zero: the leading system/tool block is shared with
32
+ * every concurrent session on the same prompt, which keeps it warm while this
33
+ * session's history expires, so a cold turn still reads that block (~15k
34
+ * tokens) back while re-writing hundreds of thousands behind it.
30
35
  *
31
36
  * Requiring a prior warm read is deliberate. A turn that merely WROTE the prefix
32
37
  * (`cacheRead` 0) has not proven the cache is live — that is the session's first
@@ -35,11 +40,14 @@ export interface CacheInvalidation {
35
40
  * call outliving the provider's 5-minute cache TTL surfaced a spurious "cache
36
41
  * miss" right under the opening message). It also collapses a run of consecutive
37
42
  * cold turns to the single marker at the moment the cache actually broke, instead
38
- * of repeating the banner on every turn while it re-warms.
43
+ * of repeating the banner on every turn while it re-warms. Measuring the loss
44
+ * against what the predecessor READ (not what it wrote) keeps both guarantees
45
+ * when only the shared block was warm: nothing proven live was lost.
39
46
  *
40
47
  * Returns `undefined` (no marker) for the first turn, turns whose predecessor
41
- * never read a warm prefix, tiny contexts, turns that reused any cache, and —
42
- * crucially — turns on providers with *implicit* best-effort caching. Only an
48
+ * never read a warm prefix, tiny contexts, turns that read back at least half
49
+ * of the predecessor's warm prefix, and — crucially — turns on providers with
50
+ * *implicit* best-effort caching. Only an
43
51
  * explicit, prefix-controlled cache (Anthropic / Bedrock `cache_control`)
44
52
  * re-creates the prefix on a cold turn (`cacheWrite > 0`); implicit caches
45
53
  * (Google / OpenAI / Fireworks) report `cacheWrite: 0` and drop `cacheRead` to
@@ -53,8 +61,9 @@ export function detectCacheInvalidation(prev: Usage | undefined, current: Usage)
53
61
  // a re-write after expiry) has not proven the cache is live, so a cold turn
54
62
  // behind it is expected — not an invalidation worth surfacing.
55
63
  if (prev.cacheRead < MIN_CACHE_FOOTPRINT) return undefined;
56
- // Any cache reuse this turn means the prefix survived (at least partly).
57
- if (current.cacheRead > 0) return undefined;
64
+ // The prefix survived when this turn read back at least half of what the
65
+ // previous one did; normal turns read all of it plus the previous write.
66
+ if (current.cacheRead * 2 >= prev.cacheRead) return undefined;
58
67
  // Only an explicit, prefix-controlled cache re-creates the prefix on a cold
59
68
  // turn — Anthropic/Bedrock report that as `cacheWrite`. Implicit best-effort
60
69
  // caches (Google/OpenAI/Fireworks) report `cacheWrite: 0` and drop `cacheRead`
@@ -2,8 +2,8 @@
2
2
  * Builds transcript components from persisted session message entries — the
3
3
  * file/remote-backed counterpart to {@link UiHelpers.addMessageToChat} (which is
4
4
  * bound to the live InteractiveModeContext). Used by the fullscreen transcript
5
- * viewer ({@link AgentTranscriptViewer}) to render a parked subagent / advisor /
6
- * collab-guest transcript that has no live session.
5
+ * viewer ({@link AgentTranscriptViewer}) to render a parked subagent or advisor
6
+ * transcript that has no live session.
7
7
  *
8
8
  * Unlike incremental transcript sync, {@link ChatTranscriptBuilder.rebuild}
9
9
  * always discards prior components and rebuilds the whole transcript from the
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import type { AgentTool } from "@linxiraos/pi-agent-core";
15
15
  import { type TUI } from "../tui";
16
- import type { MessageRenderer } from "./extension-types";
16
+ import type { AssistantTextRenderer, MessageRenderer } from "./extension-types";
17
17
  import { type TranscriptEntryLike as TranscriptEntry } from "./transcript-entry";
18
18
  import { TranscriptContainer } from "../chrome/transcript-container";
19
19
  export interface ChatTranscriptBuilderDeps {
@@ -30,6 +30,8 @@ export interface ChatTranscriptBuilderDeps {
30
30
  linkTargets?: ReadonlyMap<string, string>;
31
31
  /** Draw charts under numeric tables; false for transcripts that are not the main session's. Default: true. */
32
32
  tableCharts?: boolean;
33
+ /** Extension assistant text renderers the replayed replies draw with, as the live transcript does. */
34
+ textRenderers?: readonly AssistantTextRenderer[];
33
35
  requestRender: () => void;
34
36
  }
35
37
  export declare class ChatTranscriptBuilder {
@@ -2,8 +2,8 @@
2
2
  * Builds transcript components from persisted session message entries — the
3
3
  * file/remote-backed counterpart to {@link UiHelpers.addMessageToChat} (which is
4
4
  * bound to the live InteractiveModeContext). Used by the fullscreen transcript
5
- * viewer ({@link AgentTranscriptViewer}) to render a parked subagent / advisor /
6
- * collab-guest transcript that has no live session.
5
+ * viewer ({@link AgentTranscriptViewer}) to render a parked subagent or advisor
6
+ * transcript that has no live session.
7
7
  *
8
8
  * Unlike incremental transcript sync, {@link ChatTranscriptBuilder.rebuild}
9
9
  * always discards prior components and rebuilds the whole transcript from the
@@ -15,9 +15,8 @@ import type { AgentMessage, AgentTool } from "@linxiraos/pi-agent-core";
15
15
  import type { Usage } from "@linxiraos/pi-ai";
16
16
  import { type Component, type TUI } from "../tui";
17
17
  import type { AdvisorMessageDetails } from "./messages";
18
- import { COLLAB_PROMPT_MESSAGE_TYPE, type CollabPromptDetails } from "./messages";
19
18
  import { chatTranscriptDisplayPreferences as displayPreferences } from "./display-preferences";
20
- import type { MessageRenderer } from "./extension-types";
19
+ import type { AssistantTextRenderer, MessageRenderer } from "./extension-types";
21
20
  import { LAUNCH_COMPLETION_MESSAGE_TYPE } from "./messages";
22
21
  import {
23
22
  BACKGROUND_TAN_DISPATCH_MESSAGE_TYPE,
@@ -51,7 +50,6 @@ import { createBackgroundTanDispatchBlock } from "./background-tan-message";
51
50
  import { BashExecutionComponent } from "./bash-execution";
52
51
  import { detectCacheInvalidation } from "./cache-invalidation-marker";
53
52
  import { ServedModelTracker } from "./served-model-marker";
54
- import { CollabPromptMessageComponent } from "./collab-prompt-message";
55
53
  import {
56
54
  BranchSummaryMessageComponent,
57
55
  CompactionSummaryMessageComponent,
@@ -86,6 +84,8 @@ export interface ChatTranscriptBuilderDeps {
86
84
  linkTargets?: ReadonlyMap<string, string>;
87
85
  /** Draw charts under numeric tables; false for transcripts that are not the main session's. Default: true. */
88
86
  tableCharts?: boolean;
87
+ /** Extension assistant text renderers the replayed replies draw with, as the live transcript does. */
88
+ textRenderers?: readonly AssistantTextRenderer[];
89
89
  requestRender: () => void;
90
90
  }
91
91
 
@@ -246,6 +246,8 @@ export class ChatTranscriptBuilder {
246
246
  if (!this.#readGroup) {
247
247
  this.#readGroup = new ReadToolGroupComponent({
248
248
  showContentPreview: displayPreferences.readToolResultPreview,
249
+ // Extension presenters draw only the live main transcript; every replay draws stock cards.
250
+ transcriptPresenters: false,
249
251
  });
250
252
  this.#trackExpandable(this.#readGroup);
251
253
  this.container.addChild(this.#readGroup);
@@ -427,6 +429,7 @@ export class ChatTranscriptBuilder {
427
429
  proseOnlyThinking,
428
430
  this.#deps.linkTargets,
429
431
  expandThinkingBlocks,
432
+ { renderers: this.#deps.textRenderers ?? [], contentOffset: 0 },
430
433
  );
431
434
  assistantComponent.pickReactionTarget(this.container.children);
432
435
  this.#mountProse(assistantComponent);
@@ -451,7 +454,10 @@ export class ChatTranscriptBuilder {
451
454
  const errorPresentation = resolveAssistantErrorPresentation(message);
452
455
  const hasErrorStop = errorPresentation.kind === "full";
453
456
  const errorMessage = hasErrorStop ? errorPresentation.text : null;
454
- const appendAssistantSegment = (segment: Extract<AgentMessage, { role: "assistant" }> | undefined) => {
457
+ const appendAssistantSegment = (
458
+ toolCallId: string,
459
+ segment: Extract<AgentMessage, { role: "assistant" }> | undefined,
460
+ ) => {
455
461
  if (!segment || !assistantHasVisibleContent(segment)) return;
456
462
  const component = new AssistantMessageComponent(
457
463
  segment,
@@ -462,6 +468,7 @@ export class ChatTranscriptBuilder {
462
468
  proseOnlyThinking,
463
469
  this.#deps.linkTargets,
464
470
  expandThinkingBlocks,
471
+ { renderers: this.#deps.textRenderers ?? [], contentOffset: timeline.contentOffsets.get(toolCallId) ?? 0 },
465
472
  );
466
473
  this.#mountProse(component);
467
474
  lastAssistantComponent = component;
@@ -489,7 +496,7 @@ export class ChatTranscriptBuilder {
489
496
  const normalizedArgs = normalizeToolArgs(content.arguments);
490
497
  this.#readArgs.set(content.id, normalizedArgs);
491
498
  }
492
- appendAssistantSegment(afterToolSegment);
499
+ appendAssistantSegment(content.id, afterToolSegment);
493
500
  continue;
494
501
  }
495
502
 
@@ -516,6 +523,7 @@ export class ChatTranscriptBuilder {
516
523
  // Stable ids and Kitty placeholder cells keep images anchored
517
524
  // while the transcript viewport scrolls and reflows.
518
525
  showImages: displayPreferences.showImages,
526
+ transcriptPresenters: false,
519
527
  },
520
528
  this.#deps.getTool?.(content.name),
521
529
  this.#deps.ui,
@@ -536,7 +544,7 @@ export class ChatTranscriptBuilder {
536
544
  } else {
537
545
  this.#pendingTools.set(content.id, component);
538
546
  }
539
- appendAssistantSegment(afterToolSegment);
547
+ appendAssistantSegment(content.id, afterToolSegment);
540
548
  }
541
549
  const turnUsage = this.#turnUsage.add(message, this.#turnStartedAt);
542
550
  if (turnUsage) lastAssistantComponent.setTurnUsage(turnUsage);
@@ -616,10 +624,6 @@ export class ChatTranscriptBuilder {
616
624
  this.container.addChild(component);
617
625
  return;
618
626
  }
619
- if (message.customType === COLLAB_PROMPT_MESSAGE_TYPE) {
620
- this.container.addChild(new CollabPromptMessageComponent(message as CustomMessage<CollabPromptDetails>));
621
- return;
622
- }
623
627
  if (message.customType === SKILL_PROMPT_MESSAGE_TYPE) {
624
628
  const component = new SkillMessageComponent(message as CustomMessage<SkillPromptDetails>);
625
629
  this.#trackExpandable(component);
@@ -1,6 +1,8 @@
1
1
  /** Process-wide display preferences applied by the host settings hooks. */
2
2
  export interface ChatTranscriptDisplayPreferences {
3
3
  hideToolActivity: boolean;
4
+ /** Show the interactive shell execution visualization instead of the plain command. */
5
+ shellVisualization: boolean;
4
6
  readToolResultPreview: boolean;
5
7
  showImages: boolean;
6
8
  cacheMissMarker: boolean;
@@ -1,6 +1,8 @@
1
1
  /** Process-wide display preferences applied by the host settings hooks. */
2
2
  export interface ChatTranscriptDisplayPreferences {
3
3
  hideToolActivity: boolean;
4
+ /** Show the interactive shell execution visualization instead of the plain command. */
5
+ shellVisualization: boolean;
4
6
  readToolResultPreview: boolean;
5
7
  showImages: boolean;
6
8
  cacheMissMarker: boolean;
@@ -13,6 +15,7 @@ export interface ChatTranscriptDisplayPreferences {
13
15
  /** Current transcript display preferences. */
14
16
  export const chatTranscriptDisplayPreferences: ChatTranscriptDisplayPreferences = {
15
17
  hideToolActivity: false,
18
+ shellVisualization: true,
16
19
  readToolResultPreview: false,
17
20
  showImages: true,
18
21
  cacheMissMarker: false,
@@ -1,7 +1,10 @@
1
1
  import type { AssistantMessage } from "@linxiraos/pi-ai";
2
+ import type { TspText } from "@linxiraos/pi-wire";
2
3
  import type { Component, TUI } from "../tui";
3
4
  import type { Theme } from "../theme/theme";
4
- import type { CustomMessage, HookMessage } from "./messages";
5
+ import type { TodoItem } from "../tools/todo";
6
+ import type { BashExecutionMessage, CustomMessage, HookMessage, PythonExecutionMessage } from "./messages";
7
+ import type { NotificationRule } from "./ttsr-notification";
5
8
  export type ExtensionUiComponent = Component & {
6
9
  dispose?(): void;
7
10
  };
@@ -48,6 +51,74 @@ export interface AssistantTextRendering {
48
51
  /** Index in the full reply's `content` of this component's first block; a segment after a tool call starts past it. */
49
52
  contentOffset: number;
50
53
  }
54
+ /**
55
+ * One transcript block a {@link TranscriptPresenter} decides the display of. Later omp versions
56
+ * add block types; answer `undefined` for a `type` you do not know.
57
+ *
58
+ * - `toolCall`: a model tool call, `id` its `toolCallId`. `result` arrives with the call's first
59
+ * result frame; `isPartial` stays true while the call still streams progress.
60
+ * - `message`: a session message drawn as its own block, `id` the decimal `message.timestamp`
61
+ * (shared by messages recorded in the same millisecond).
62
+ * `custom` messages with `customType` `"advisor"`, `"skill-prompt"`, `"lsp-late-diagnostic"`,
63
+ * `"async-result"` or `"launch-completion"`, and `!`/`$` runs (`bashExecution`,
64
+ * `pythonExecution`). A `!`/`$` run still going has a provisional message and id; it is asked
65
+ * again with the recorded message once the session records the run. In Tern, late diagnostics
66
+ * an edit/write card takes are drawn with that card instead, so an `"lsp-late-diagnostic"`
67
+ * block appears only for the files no card took.
68
+ * - `event`: a TTSR rule hit or an incomplete-todo reminder, shaped like the extension event of
69
+ * the same `type`. These exist only in the session that raised them; `id` is unique per process.
70
+ *
71
+ * Read-only, and not a copy: `args`, `result`'s `content` and `details`, `message` and `event`
72
+ * are the live objects omp draws the block from, often the session's own message data. Never
73
+ * mutate them: the change would reach the block and possibly the session.
74
+ */
75
+ export type TranscriptBlock = {
76
+ readonly type: "toolCall";
77
+ readonly id: string;
78
+ readonly toolName: string;
79
+ readonly args: unknown;
80
+ readonly result?: {
81
+ readonly content: readonly unknown[];
82
+ readonly details?: unknown;
83
+ };
84
+ readonly isError: boolean;
85
+ readonly isPartial: boolean;
86
+ } | {
87
+ readonly type: "message";
88
+ readonly id: string;
89
+ readonly message: CustomMessage | BashExecutionMessage | PythonExecutionMessage;
90
+ } | {
91
+ readonly type: "event";
92
+ readonly id: string;
93
+ readonly event: {
94
+ readonly type: "ttsr_triggered";
95
+ readonly rules: readonly NotificationRule[];
96
+ } | {
97
+ readonly type: "todo_reminder";
98
+ readonly todos: readonly TodoItem[];
99
+ readonly attempt: number;
100
+ readonly maxAttempts: number;
101
+ };
102
+ };
103
+ /**
104
+ * How a transcript block is drawn: `undefined` defers to the next presenter (and, after the
105
+ * last, to `"full"`); `"full"` is omp's own card; `"hidden"` draws nothing, as hidden tool
106
+ * activity does; `"compact"` is one row from omp's own summary. `{ compact: { label, rows } }`
107
+ * replaces that row's text with `label` and adds one row per `rows` entry below it. Spans use the
108
+ * semantic tokens and theme colour names of {@link TspText}.
109
+ */
110
+ export type TranscriptPresentation = undefined | "full" | "hidden" | "compact" | {
111
+ readonly compact: {
112
+ readonly label?: TspText;
113
+ readonly rows?: readonly TspText[];
114
+ };
115
+ };
116
+ /**
117
+ * Display-only choice of how one transcript block is drawn. Presenters are asked in extension
118
+ * load order; the first answer other than `undefined` wins. A block the user expanded is always
119
+ * drawn in full.
120
+ */
121
+ export type TranscriptPresenter = (block: TranscriptBlock) => TranscriptPresentation;
51
122
  export interface HookMessageRenderOptions {
52
123
  /** Whether the view is expanded */
53
124
  expanded: boolean;
@@ -1,7 +1,10 @@
1
1
  import type { AssistantMessage } from "@linxiraos/pi-ai";
2
+ import type { TspText } from "@linxiraos/pi-wire";
2
3
  import type { Component, TUI } from "../tui";
3
4
  import type { Theme } from "../theme/theme";
4
- import type { CustomMessage, HookMessage } from "./messages";
5
+ import type { TodoItem } from "../tools/todo";
6
+ import type { BashExecutionMessage, CustomMessage, HookMessage, PythonExecutionMessage } from "./messages";
7
+ import type { NotificationRule } from "./ttsr-notification";
5
8
 
6
9
  export type ExtensionUiComponent = Component & { dispose?(): void };
7
10
 
@@ -64,6 +67,76 @@ export interface AssistantTextRendering {
64
67
  contentOffset: number;
65
68
  }
66
69
 
70
+ /**
71
+ * One transcript block a {@link TranscriptPresenter} decides the display of. Later omp versions
72
+ * add block types; answer `undefined` for a `type` you do not know.
73
+ *
74
+ * - `toolCall`: a model tool call, `id` its `toolCallId`. `result` arrives with the call's first
75
+ * result frame; `isPartial` stays true while the call still streams progress.
76
+ * - `message`: a session message drawn as its own block, `id` the decimal `message.timestamp`
77
+ * (shared by messages recorded in the same millisecond).
78
+ * `custom` messages with `customType` `"advisor"`, `"skill-prompt"`, `"lsp-late-diagnostic"`,
79
+ * `"async-result"` or `"launch-completion"`, and `!`/`$` runs (`bashExecution`,
80
+ * `pythonExecution`). A `!`/`$` run still going has a provisional message and id; it is asked
81
+ * again with the recorded message once the session records the run. In Tern, late diagnostics
82
+ * an edit/write card takes are drawn with that card instead, so an `"lsp-late-diagnostic"`
83
+ * block appears only for the files no card took.
84
+ * - `event`: a TTSR rule hit or an incomplete-todo reminder, shaped like the extension event of
85
+ * the same `type`. These exist only in the session that raised them; `id` is unique per process.
86
+ *
87
+ * Read-only, and not a copy: `args`, `result`'s `content` and `details`, `message` and `event`
88
+ * are the live objects omp draws the block from, often the session's own message data. Never
89
+ * mutate them: the change would reach the block and possibly the session.
90
+ */
91
+ export type TranscriptBlock =
92
+ | {
93
+ readonly type: "toolCall";
94
+ readonly id: string;
95
+ readonly toolName: string;
96
+ readonly args: unknown;
97
+ readonly result?: { readonly content: readonly unknown[]; readonly details?: unknown };
98
+ readonly isError: boolean;
99
+ readonly isPartial: boolean;
100
+ }
101
+ | {
102
+ readonly type: "message";
103
+ readonly id: string;
104
+ readonly message: CustomMessage | BashExecutionMessage | PythonExecutionMessage;
105
+ }
106
+ | {
107
+ readonly type: "event";
108
+ readonly id: string;
109
+ readonly event:
110
+ | { readonly type: "ttsr_triggered"; readonly rules: readonly NotificationRule[] }
111
+ | {
112
+ readonly type: "todo_reminder";
113
+ readonly todos: readonly TodoItem[];
114
+ readonly attempt: number;
115
+ readonly maxAttempts: number;
116
+ };
117
+ };
118
+
119
+ /**
120
+ * How a transcript block is drawn: `undefined` defers to the next presenter (and, after the
121
+ * last, to `"full"`); `"full"` is omp's own card; `"hidden"` draws nothing, as hidden tool
122
+ * activity does; `"compact"` is one row from omp's own summary. `{ compact: { label, rows } }`
123
+ * replaces that row's text with `label` and adds one row per `rows` entry below it. Spans use the
124
+ * semantic tokens and theme colour names of {@link TspText}.
125
+ */
126
+ export type TranscriptPresentation =
127
+ | undefined
128
+ | "full"
129
+ | "hidden"
130
+ | "compact"
131
+ | { readonly compact: { readonly label?: TspText; readonly rows?: readonly TspText[] } };
132
+
133
+ /**
134
+ * Display-only choice of how one transcript block is drawn. Presenters are asked in extension
135
+ * load order; the first answer other than `undefined` wins. A block the user expanded is always
136
+ * drawn in full.
137
+ */
138
+ export type TranscriptPresenter = (block: TranscriptBlock) => TranscriptPresentation;
139
+
67
140
  export interface HookMessageRenderOptions {
68
141
  /** Whether the view is expanded */
69
142
  expanded: boolean;
@@ -5,12 +5,12 @@ export declare const SUPPORTED_INPUT_IMAGE_MIME_TYPES: Set<string>;
5
5
  * Ollama and its local-backend family decode image input through llama.cpp /
6
6
  * `stb_image`, which is compiled without WebP support, so a WebP upload fails
7
7
  * with an opaque HTTP 400. Detect those models so the resize pipeline encodes
8
- * to PNG/JPEG instead — the automatic equivalent of `OMP_NO_WEBP=1`.
8
+ * to PNG/JPEG instead — the automatic equivalent of `ZETA_NO_WEBP=1`.
9
9
  */
10
10
  export declare function modelLacksWebpSupport(model: Pick<Model, "provider" | "api" | "imageInputDecoder"> | undefined): boolean;
11
11
  /**
12
12
  * `true` when `model` cannot decode WebP, otherwise `undefined` so the
13
- * `OMP_NO_WEBP` env fallback in {@link resizeImage} still applies. Feed straight
13
+ * `ZETA_NO_WEBP` env fallback in {@link resizeImage} still applies. Feed straight
14
14
  * into {@link ImageResizeOptions.excludeWebP}.
15
15
  */
16
16
  export declare function webpExclusionForModel(model: Pick<Model, "provider" | "api"> | undefined): true | undefined;
@@ -14,7 +14,7 @@ export const SUPPORTED_INPUT_IMAGE_MIME_TYPES = SUPPORTED_IMAGE_MIME_TYPES;
14
14
  * Ollama and its local-backend family decode image input through llama.cpp /
15
15
  * `stb_image`, which is compiled without WebP support, so a WebP upload fails
16
16
  * with an opaque HTTP 400. Detect those models so the resize pipeline encodes
17
- * to PNG/JPEG instead — the automatic equivalent of `OMP_NO_WEBP=1`.
17
+ * to PNG/JPEG instead — the automatic equivalent of `ZETA_NO_WEBP=1`.
18
18
  */
19
19
  export function modelLacksWebpSupport(
20
20
  model: Pick<Model, "provider" | "api" | "imageInputDecoder"> | undefined,
@@ -33,7 +33,7 @@ export function modelLacksWebpSupport(
33
33
 
34
34
  /**
35
35
  * `true` when `model` cannot decode WebP, otherwise `undefined` so the
36
- * `OMP_NO_WEBP` env fallback in {@link resizeImage} still applies. Feed straight
36
+ * `ZETA_NO_WEBP` env fallback in {@link resizeImage} still applies. Feed straight
37
37
  * into {@link ImageResizeOptions.excludeWebP}.
38
38
  */
39
39
  export function webpExclusionForModel(model: Pick<Model, "provider" | "api"> | undefined): true | undefined {
@@ -12,7 +12,6 @@ declare module "@linxiraos/pi-agent-core" {
12
12
  fileMention: FileMentionMessage;
13
13
  }
14
14
  }
15
- export { COLLAB_PROMPT_MESSAGE_TYPE, type CollabPromptDetails } from "@linxiraos/pi-wire";
16
15
  export type { BranchSummaryMessage, CompactionSummaryMessage } from "@linxiraos/pi-agent-core/compaction/messages";
17
16
  export declare const SKILL_PROMPT_MESSAGE_TYPE = "skill-prompt";
18
17
  export declare const LSP_LATE_DIAGNOSTIC_MESSAGE_TYPE = "lsp-late-diagnostic";
@@ -169,8 +168,8 @@ export interface FileMentionMessage {
169
168
  export declare function isUserInvokedSkillPrompt(message: CustomMessage): boolean;
170
169
  /**
171
170
  * True for a custom message that initiates a user-attributed turn: a directly
172
- * invoked `/skill:` prompt or a writable-collab peer's prompt. Agent redirects,
173
- * reminders, and auto-continues are not turn starts.
171
+ * invoked `/skill:` prompt. Agent redirects, reminders, and auto-continues are
172
+ * not turn starts.
174
173
  */
175
174
  export declare function isUserTurnInitiator(message: CustomMessage): boolean;
176
175
  /** Advisor note severities, weakest first; ranks severity thresholds such as `advisor.continueSeverity`. */
@@ -1,6 +1,5 @@
1
1
  import type { AssistantMessage, ImageContent, MessageAttribution, TextContent } from "@linxiraos/pi-ai";
2
2
  import * as AIError from "@linxiraos/pi-ai/error";
3
- import { COLLAB_PROMPT_MESSAGE_TYPE } from "@linxiraos/pi-wire";
4
3
  import { tuiText, tuiTextFmt } from "../i18n";
5
4
  import type { OutputMeta } from "../tools/output-meta";
6
5
  import type { BranchSummaryMessage, CompactionSummaryMessage } from "@linxiraos/pi-agent-core/compaction/messages";
@@ -16,7 +15,6 @@ declare module "@linxiraos/pi-agent-core" {
16
15
  fileMention: FileMentionMessage;
17
16
  }
18
17
  }
19
- export { COLLAB_PROMPT_MESSAGE_TYPE, type CollabPromptDetails } from "@linxiraos/pi-wire";
20
18
  export type { BranchSummaryMessage, CompactionSummaryMessage } from "@linxiraos/pi-agent-core/compaction/messages";
21
19
 
22
20
  export const SKILL_PROMPT_MESSAGE_TYPE = "skill-prompt";
@@ -284,14 +282,11 @@ export function isUserInvokedSkillPrompt(message: CustomMessage): boolean {
284
282
 
285
283
  /**
286
284
  * True for a custom message that initiates a user-attributed turn: a directly
287
- * invoked `/skill:` prompt or a writable-collab peer's prompt. Agent redirects,
288
- * reminders, and auto-continues are not turn starts.
285
+ * invoked `/skill:` prompt. Agent redirects, reminders, and auto-continues are
286
+ * not turn starts.
289
287
  */
290
288
  export function isUserTurnInitiator(message: CustomMessage): boolean {
291
- return (
292
- isUserInvokedSkillPrompt(message) ||
293
- (message.customType === COLLAB_PROMPT_MESSAGE_TYPE && message.attribution === "user")
294
- );
289
+ return isUserInvokedSkillPrompt(message);
295
290
  }
296
291
 
297
292
  /** Advisor note severities, weakest first; ranks severity thresholds such as `advisor.continueSeverity`. */
@@ -21,12 +21,21 @@ export declare function readArgsCollapseIntoGroup(args: unknown): boolean;
21
21
  export declare function groupedReadUsageCallIds(message: AssistantMessage): string[] | undefined;
22
22
  type ReadToolGroupOptions = {
23
23
  showContentPreview?: boolean;
24
+ /** Ask the extension transcript presenters; false for a replayed transcript (overlays). Default: true. */
25
+ transcriptPresenters?: boolean;
24
26
  };
25
27
  export declare class ReadToolGroupComponent extends Container implements ToolExecutionHandle {
26
28
  #private;
27
29
  constructor(options?: ReadToolGroupOptions);
30
+ /**
31
+ * Reads a presenter leaves full draw as the group, at the first full read's place; a compact
32
+ * read is a row of its own; hidden draws nothing.
33
+ */
28
34
  render(width: number): readonly string[];
35
+ refreshTranscriptPresentation(ids?: ReadonlySet<string>): boolean;
29
36
  isTranscriptBlockFinalized(): boolean;
37
+ /** Compact only while every read it draws is a compact row. */
38
+ isTranscriptBlockCompact(): boolean;
30
39
  finalize(): void;
31
40
  /**
32
41
  * Force the group terminal even if an entry never received its result (the
@@ -63,11 +72,14 @@ export declare class ReadToolGroupComponent extends Container implements ToolExe
63
72
  setExecutionStarted(_toolCallId?: string): void;
64
73
  setExpanded(expanded: boolean): void;
65
74
  setToolActivityVisible(visible: boolean): void;
75
+ /** The reads' Spotlight notices, in order: blocks of their own right after the group's card. */
76
+ nativeTrailers(): readonly Component[];
66
77
  getComponent(): Component;
67
78
  /**
68
79
  * Mirrors the terminal's toggles: the `tool` head (the group's root) is
69
80
  * `Ctrl+O`'s expansion; a fallback preview card collapses on its own
70
- * (`setExpanded` resets those).
81
+ * (`setExpanded` resets those). A compact read's row (`c<id>`) opens that
82
+ * read; the full rows beside compact ones (`full`) open and close their reads.
71
83
  */
72
84
  handleNativeEvent(event: NativeUiEvent): void;
73
85
  /**
@@ -75,7 +87,8 @@ export declare class ReadToolGroupComponent extends Container implements ToolExe
75
87
  * the fallback: a bare `card` (role `zeta.tool.read`) with `Read <path>` or
76
88
  * `Read (N)` in the head, a `list` of path items (status tone, link,
77
89
  * correction and conflict detail, nested usage) and a clamped preview per
78
- * read when content previews are on.
90
+ * read when content previews are on. Compact reads become rows of their
91
+ * own (keyed `c<toolCallId>`) beside that group.
79
92
  */
80
93
  describe(cx?: DescribeContext): NativeNode;
81
94
  }