@linxiraos/pi-tui 1.1.27 → 1.2.0

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 (373) hide show
  1. package/CHANGELOG.md +47 -463
  2. package/README.md +7 -5
  3. package/dist/types/app-keybindings.d.ts +1 -1
  4. package/dist/types/apps/cleanse-board.d.ts +1 -1
  5. package/dist/types/apps/debug/log-viewer.d.ts +4 -0
  6. package/dist/types/apps/debug/raw-sse-buffer.d.ts +2 -0
  7. package/dist/types/apps/git/git-tui.d.ts +2 -2
  8. package/dist/types/apps/git/help.d.ts +3 -1
  9. package/dist/types/apps/if-bench-board.d.ts +2 -2
  10. package/dist/types/apps/setup-model-picker.d.ts +1 -1
  11. package/dist/types/autocomplete.d.ts +5 -2
  12. package/dist/types/charts/chart-plan.d.ts +674 -0
  13. package/dist/types/charts/chart-svg.d.ts +59 -0
  14. package/dist/types/charts/table-data.d.ts +175 -0
  15. package/dist/types/chat/assistant-message.d.ts +5 -0
  16. package/dist/types/chat/chat-transcript-builder.d.ts +2 -0
  17. package/dist/types/chat/compaction-summary-message.d.ts +1 -0
  18. package/dist/types/chat/execution-shared.d.ts +6 -5
  19. package/dist/types/chat/fence-figure.d.ts +42 -0
  20. package/dist/types/chat/figure-markdown.d.ts +42 -0
  21. package/dist/types/chat/messages.d.ts +1 -1
  22. package/dist/types/chat/svg-figure.d.ts +33 -0
  23. package/dist/types/chat/svg-source.d.ts +49 -0
  24. package/dist/types/chat/table-chart.d.ts +89 -0
  25. package/dist/types/chat/tool-execution.d.ts +2 -0
  26. package/dist/types/chat/user-message.d.ts +15 -2
  27. package/dist/types/chrome/shared.d.ts +9 -0
  28. package/dist/types/chrome/transcript-container.d.ts +6 -0
  29. package/dist/types/components/box.d.ts +1 -0
  30. package/dist/types/components/disclosure.d.ts +1 -0
  31. package/dist/types/components/editor.d.ts +15 -4
  32. package/dist/types/components/form.d.ts +1 -0
  33. package/dist/types/components/image.d.ts +12 -44
  34. package/dist/types/components/key-value-list.d.ts +1 -0
  35. package/dist/types/components/layout/row.d.ts +1 -0
  36. package/dist/types/components/layout/stack.d.ts +1 -0
  37. package/dist/types/components/markdown.d.ts +36 -3
  38. package/dist/types/components/scroll-view.d.ts +1 -0
  39. package/dist/types/components/section.d.ts +1 -0
  40. package/dist/types/components/table.d.ts +1 -0
  41. package/dist/types/components/text.d.ts +1 -0
  42. package/dist/types/components/tree-view.d.ts +7 -0
  43. package/dist/types/components/truncated-text.d.ts +1 -0
  44. package/dist/types/fuzzy.d.ts +29 -1
  45. package/dist/types/key-hint-format.d.ts +1 -1
  46. package/dist/types/keybinding-matchers.d.ts +3 -0
  47. package/dist/types/keybindings.d.ts +1 -1
  48. package/dist/types/kitty-graphics.d.ts +2 -2
  49. package/dist/types/loop-watchdog.d.ts +8 -7
  50. package/dist/types/multiplexers/cmux.d.ts +16 -0
  51. package/dist/types/multiplexers/herdr.d.ts +26 -0
  52. package/dist/types/multiplexers/notify.d.ts +13 -0
  53. package/dist/types/multiplexers/orca.d.ts +12 -0
  54. package/dist/types/multiplexers/screen.d.ts +9 -0
  55. package/dist/types/multiplexers/tmux.d.ts +29 -0
  56. package/dist/types/multiplexers/types.d.ts +100 -0
  57. package/dist/types/multiplexers/wmux.d.ts +12 -0
  58. package/dist/types/multiplexers/zellij.d.ts +12 -0
  59. package/dist/types/native/backend.d.ts +3 -2
  60. package/dist/types/native/blobs.d.ts +7 -3
  61. package/dist/types/native/encode.d.ts +3 -4
  62. package/dist/types/native/overlay.d.ts +5 -0
  63. package/dist/types/overlays/agent-hub-projection.d.ts +6 -5
  64. package/dist/types/overlays/agent-hub-types.d.ts +9 -0
  65. package/dist/types/overlays/agent-hub.d.ts +2 -0
  66. package/dist/types/overlays/agent-transcript-viewer.d.ts +11 -2
  67. package/dist/types/overlays/agents-hub.d.ts +9 -0
  68. package/dist/types/overlays/annotation-overlay.d.ts +19 -2
  69. package/dist/types/overlays/annotation-types.d.ts +2 -0
  70. package/dist/types/overlays/ask-dialog.d.ts +5 -2
  71. package/dist/types/overlays/history-search.d.ts +10 -0
  72. package/dist/types/overlays/hook-selector.d.ts +9 -4
  73. package/dist/types/overlays/jobs-panel.d.ts +1 -7
  74. package/dist/types/overlays/model-browser.d.ts +54 -7
  75. package/dist/types/overlays/model-hub.d.ts +23 -0
  76. package/dist/types/overlays/oauth-selector.d.ts +0 -1
  77. package/dist/types/overlays/plan-review-overlay.d.ts +3 -2
  78. package/dist/types/overlays/session-observer-registry.d.ts +2 -0
  79. package/dist/types/overlays/session-selector.d.ts +6 -2
  80. package/dist/types/overlays/settings-defs.d.ts +1 -0
  81. package/dist/types/overlays/usage-dashboard.d.ts +8 -4
  82. package/dist/types/overlays/usage-display.d.ts +3 -1
  83. package/dist/types/prompt/composer.d.ts +1 -1
  84. package/dist/types/prompt/custom-editor.d.ts +11 -8
  85. package/dist/types/prompt/image-source.d.ts +2 -1
  86. package/dist/types/prompt/interactive-context-helpers.d.ts +4 -1
  87. package/dist/types/prompt/model-mention-autocomplete.d.ts +1 -1
  88. package/dist/types/prompt/welcome.d.ts +6 -1
  89. package/dist/types/render/composite.d.ts +2 -0
  90. package/dist/types/render/output-pane.d.ts +1 -0
  91. package/dist/types/render/render-utils.d.ts +1 -0
  92. package/dist/types/render/tool-card.d.ts +6 -0
  93. package/dist/types/render/width-aware-text.d.ts +2 -0
  94. package/dist/types/setup/scenes/types.d.ts +1 -0
  95. package/dist/types/status-line/component.d.ts +3 -0
  96. package/dist/types/status-line/host.d.ts +4 -1
  97. package/dist/types/status-line/segments.d.ts +2 -0
  98. package/dist/types/status-line/types.d.ts +14 -3
  99. package/dist/types/terminal-capabilities.d.ts +27 -35
  100. package/dist/types/terminal-multiplexer.d.ts +127 -14
  101. package/dist/types/terminal.d.ts +22 -6
  102. package/dist/types/theme/active-symbols.d.ts +1 -1
  103. package/dist/types/theme/schema.d.ts +11 -2
  104. package/dist/types/theme/symbols.d.ts +1 -1
  105. package/dist/types/theme/theme-class.d.ts +7 -0
  106. package/dist/types/theme/theme.d.ts +1 -1
  107. package/dist/types/theme/tui-adapters.d.ts +3 -0
  108. package/dist/types/tmux.d.ts +11 -4
  109. package/dist/types/tools/daemon.d.ts +1 -1
  110. package/dist/types/tools/eval.d.ts +22 -3
  111. package/dist/types/tools/glob.d.ts +4 -0
  112. package/dist/types/tools/native-view.d.ts +47 -0
  113. package/dist/types/tools/output-meta.d.ts +11 -1
  114. package/dist/types/tools/renderer.d.ts +37 -2
  115. package/dist/types/tools/streaming-output.d.ts +20 -1
  116. package/dist/types/tools/task.d.ts +0 -4
  117. package/dist/types/tools/write.d.ts +9 -2
  118. package/dist/types/tools/yield.d.ts +22 -0
  119. package/dist/types/tui.d.ts +31 -0
  120. package/dist/types/utils.d.ts +6 -0
  121. package/dist/types/vim.d.ts +19 -5
  122. package/package.json +13 -9
  123. package/src/app-keybindings.d.ts +1 -1
  124. package/src/app-keybindings.ts +1 -1
  125. package/src/apps/autoresearch-dashboard.ts +7 -3
  126. package/src/apps/cleanse-board.ts +2 -2
  127. package/src/apps/cleanse-picker.ts +1 -1
  128. package/src/apps/debug/log-viewer.ts +188 -72
  129. package/src/apps/debug/raw-sse-buffer.ts +8 -0
  130. package/src/apps/debug/raw-sse.ts +39 -5
  131. package/src/apps/git/diff-pane.ts +26 -5
  132. package/src/apps/git/git-tui.ts +2 -2
  133. package/src/apps/git/help.ts +29 -20
  134. package/src/apps/if-bench-board.ts +2 -2
  135. package/src/apps/ps-top.ts +2 -2
  136. package/src/apps/setup-model-picker.ts +1 -1
  137. package/src/autocomplete.d.ts +5 -2
  138. package/src/autocomplete.ts +67 -43
  139. package/src/charts/chart-plan.d.ts +674 -0
  140. package/src/charts/chart-plan.ts +5081 -0
  141. package/src/charts/chart-svg.d.ts +59 -0
  142. package/src/charts/chart-svg.ts +4657 -0
  143. package/src/charts/table-data.d.ts +175 -0
  144. package/src/charts/table-data.ts +1478 -0
  145. package/src/chat/advisor-message.ts +11 -0
  146. package/src/chat/assistant-message.d.ts +5 -0
  147. package/src/chat/assistant-message.ts +219 -50
  148. package/src/chat/chat-transcript-builder.d.ts +2 -0
  149. package/src/chat/chat-transcript-builder.ts +5 -3
  150. package/src/chat/compaction-summary-message.d.ts +1 -0
  151. package/src/chat/compaction-summary-message.ts +8 -0
  152. package/src/chat/execution-shared.d.ts +6 -5
  153. package/src/chat/execution-shared.ts +42 -25
  154. package/src/chat/fence-figure.d.ts +42 -0
  155. package/src/chat/fence-figure.ts +80 -0
  156. package/src/chat/figure-markdown.d.ts +42 -0
  157. package/src/chat/figure-markdown.ts +174 -0
  158. package/src/chat/messages.d.ts +1 -1
  159. package/src/chat/messages.ts +1 -1
  160. package/src/chat/read-tool-group.ts +6 -4
  161. package/src/chat/skill-message.ts +6 -0
  162. package/src/chat/svg-figure.d.ts +33 -0
  163. package/src/chat/svg-figure.ts +399 -0
  164. package/src/chat/svg-source.d.ts +49 -0
  165. package/src/chat/svg-source.ts +188 -0
  166. package/src/chat/table-chart.d.ts +89 -0
  167. package/src/chat/table-chart.ts +294 -0
  168. package/src/chat/tool-execution.d.ts +2 -0
  169. package/src/chat/tool-execution.ts +80 -6
  170. package/src/chat/user-message.d.ts +15 -2
  171. package/src/chat/user-message.ts +55 -3
  172. package/src/chrome/shared.ts +53 -0
  173. package/src/chrome/transcript-container.d.ts +6 -0
  174. package/src/chrome/transcript-container.ts +93 -13
  175. package/src/components/box.d.ts +1 -0
  176. package/src/components/box.ts +5 -0
  177. package/src/components/disclosure.d.ts +1 -0
  178. package/src/components/disclosure.ts +8 -0
  179. package/src/components/editor.d.ts +15 -4
  180. package/src/components/editor.ts +294 -46
  181. package/src/components/form.d.ts +1 -0
  182. package/src/components/form.ts +8 -0
  183. package/src/components/image.d.ts +12 -44
  184. package/src/components/image.ts +47 -151
  185. package/src/components/key-value-list.d.ts +1 -0
  186. package/src/components/key-value-list.ts +4 -0
  187. package/src/components/layout/row.d.ts +1 -0
  188. package/src/components/layout/row.ts +7 -0
  189. package/src/components/layout/stack.d.ts +1 -0
  190. package/src/components/layout/stack.ts +7 -0
  191. package/src/components/markdown.d.ts +36 -3
  192. package/src/components/markdown.ts +433 -318
  193. package/src/components/scroll-view.d.ts +1 -0
  194. package/src/components/scroll-view.ts +5 -0
  195. package/src/components/section.d.ts +1 -0
  196. package/src/components/section.ts +5 -0
  197. package/src/components/settings-list.ts +2 -0
  198. package/src/components/table.d.ts +1 -0
  199. package/src/components/table.ts +4 -0
  200. package/src/components/text.d.ts +1 -0
  201. package/src/components/text.ts +7 -0
  202. package/src/components/tree-view.d.ts +7 -0
  203. package/src/components/tree-view.ts +38 -8
  204. package/src/components/truncated-text.d.ts +1 -0
  205. package/src/components/truncated-text.ts +5 -0
  206. package/src/desktop-notify.ts +1 -1
  207. package/src/fuzzy.d.ts +29 -1
  208. package/src/fuzzy.ts +115 -30
  209. package/src/key-hint-format.d.ts +1 -1
  210. package/src/key-hint-format.ts +1 -1
  211. package/src/keybinding-matchers.d.ts +3 -0
  212. package/src/keybinding-matchers.ts +6 -2
  213. package/src/keybindings.d.ts +1 -1
  214. package/src/keybindings.ts +1 -1
  215. package/src/kitty-graphics.d.ts +2 -2
  216. package/src/kitty-graphics.ts +4 -4
  217. package/src/loop-watchdog.d.ts +8 -7
  218. package/src/loop-watchdog.ts +18 -13
  219. package/src/multiplexers/cmux.d.ts +16 -0
  220. package/src/multiplexers/cmux.ts +29 -0
  221. package/src/multiplexers/herdr.d.ts +26 -0
  222. package/src/multiplexers/herdr.ts +64 -0
  223. package/src/multiplexers/notify.d.ts +13 -0
  224. package/src/multiplexers/notify.ts +24 -0
  225. package/src/multiplexers/orca.d.ts +12 -0
  226. package/src/multiplexers/orca.ts +16 -0
  227. package/src/multiplexers/screen.d.ts +9 -0
  228. package/src/multiplexers/screen.ts +15 -0
  229. package/src/multiplexers/tmux.d.ts +29 -0
  230. package/src/multiplexers/tmux.ts +40 -0
  231. package/src/multiplexers/types.d.ts +100 -0
  232. package/src/multiplexers/types.ts +110 -0
  233. package/src/multiplexers/wmux.d.ts +12 -0
  234. package/src/multiplexers/wmux.ts +16 -0
  235. package/src/multiplexers/zellij.d.ts +12 -0
  236. package/src/multiplexers/zellij.ts +24 -0
  237. package/src/native/backend.d.ts +3 -2
  238. package/src/native/backend.ts +174 -18
  239. package/src/native/blobs.d.ts +7 -3
  240. package/src/native/blobs.ts +47 -12
  241. package/src/native/encode.d.ts +3 -4
  242. package/src/native/encode.ts +58 -31
  243. package/src/native/overlay.d.ts +5 -0
  244. package/src/native/overlay.ts +13 -0
  245. package/src/native/reconcile.ts +4 -0
  246. package/src/overlays/agent-hub-projection.d.ts +6 -5
  247. package/src/overlays/agent-hub-projection.ts +124 -13
  248. package/src/overlays/agent-hub-types.d.ts +9 -0
  249. package/src/overlays/agent-hub-types.ts +6 -0
  250. package/src/overlays/agent-hub.ts +44 -29
  251. package/src/overlays/agent-transcript-viewer.ts +91 -23
  252. package/src/overlays/agents-hub.ts +28 -8
  253. package/src/overlays/annotation-overlay.ts +293 -90
  254. package/src/overlays/annotation-types.ts +2 -0
  255. package/src/overlays/ask-dialog.ts +7 -10
  256. package/src/overlays/btw-history-panel.ts +12 -1
  257. package/src/overlays/copy-selector.ts +30 -8
  258. package/src/overlays/extensions/state-manager.ts +52 -12
  259. package/src/overlays/history-search.ts +100 -7
  260. package/src/overlays/hook-selector.ts +12 -5
  261. package/src/overlays/jobs-panel.ts +28 -46
  262. package/src/overlays/model-browser.ts +341 -110
  263. package/src/overlays/model-hub.ts +300 -49
  264. package/src/overlays/move-overlay.ts +28 -14
  265. package/src/overlays/oauth-selector.ts +54 -70
  266. package/src/overlays/plan-review-overlay.ts +194 -70
  267. package/src/overlays/plugin-settings.ts +3 -3
  268. package/src/overlays/report-panel.ts +2 -2
  269. package/src/overlays/rewind-selector.ts +86 -17
  270. package/src/overlays/session-observer-registry.d.ts +2 -0
  271. package/src/overlays/session-observer-registry.ts +10 -2
  272. package/src/overlays/session-selector.ts +64 -26
  273. package/src/overlays/settings-defs.ts +4 -3
  274. package/src/overlays/settings-selector.ts +33 -8
  275. package/src/overlays/snapcompact-shape-preview.ts +2 -3
  276. package/src/overlays/stats-notice.ts +1 -1
  277. package/src/overlays/tree-selector.ts +41 -20
  278. package/src/overlays/usage-dashboard.ts +100 -50
  279. package/src/overlays/usage-display.ts +10 -4
  280. package/src/prompt/attachment-chips.ts +15 -11
  281. package/src/prompt/composer-attachments.ts +6 -4
  282. package/src/prompt/composer.ts +4 -15
  283. package/src/prompt/custom-editor.ts +54 -26
  284. package/src/prompt/image-source.ts +2 -1
  285. package/src/prompt/interactive-context-helpers.ts +30 -18
  286. package/src/prompt/macos-spelling.ts +7 -0
  287. package/src/prompt/magic-keywords.ts +11 -2
  288. package/src/prompt/model-mention-autocomplete.ts +14 -14
  289. package/src/prompt/tips.txt +6 -5
  290. package/src/prompt/welcome.ts +55 -12
  291. package/src/prompt/word-completion.ts +38 -5
  292. package/src/render/composite.d.ts +2 -0
  293. package/src/render/composite.ts +64 -0
  294. package/src/render/output-pane.d.ts +1 -0
  295. package/src/render/output-pane.ts +6 -0
  296. package/src/render/render-utils.d.ts +1 -0
  297. package/src/render/render-utils.ts +11 -0
  298. package/src/render/tool-card.d.ts +6 -0
  299. package/src/render/tool-card.ts +15 -0
  300. package/src/render/width-aware-text.d.ts +2 -0
  301. package/src/render/width-aware-text.ts +5 -0
  302. package/src/setup/scenes/model.ts +2 -1
  303. package/src/setup/scenes/types.ts +1 -0
  304. package/src/status-line/component.ts +292 -78
  305. package/src/status-line/host.ts +4 -1
  306. package/src/status-line/segments.ts +40 -22
  307. package/src/status-line/types.ts +15 -3
  308. package/src/terminal-capabilities.d.ts +27 -35
  309. package/src/terminal-capabilities.ts +75 -189
  310. package/src/terminal-multiplexer.d.ts +127 -14
  311. package/src/terminal-multiplexer.ts +112 -33
  312. package/src/terminal.d.ts +22 -6
  313. package/src/terminal.ts +139 -37
  314. package/src/theme/active-symbols.d.ts +1 -1
  315. package/src/theme/active-symbols.ts +1 -1
  316. package/src/theme/schema-validation.ts +1 -0
  317. package/src/theme/schema.d.ts +11 -2
  318. package/src/theme/schema.ts +14 -1
  319. package/src/theme/session-color.ts +1 -7
  320. package/src/theme/symbols.d.ts +1 -1
  321. package/src/theme/symbols.ts +6 -1
  322. package/src/theme/theme-class.d.ts +7 -0
  323. package/src/theme/theme-class.ts +26 -1
  324. package/src/theme/theme-schema.json +5 -1
  325. package/src/theme/theme.d.ts +1 -1
  326. package/src/theme/theme.ts +8 -4
  327. package/src/theme/tui-adapters.d.ts +3 -0
  328. package/src/theme/tui-adapters.ts +68 -0
  329. package/src/tmux.d.ts +11 -4
  330. package/src/tmux.ts +47 -11
  331. package/src/tools/ast-edit.ts +59 -35
  332. package/src/tools/ast-grep.ts +35 -16
  333. package/src/tools/bash.ts +92 -42
  334. package/src/tools/daemon.d.ts +1 -1
  335. package/src/tools/daemon.ts +1 -1
  336. package/src/tools/default-renderer.ts +35 -19
  337. package/src/tools/edit.ts +142 -120
  338. package/src/tools/eval-format/index.ts +28 -2
  339. package/src/tools/eval-format/javascript.ts +7 -5
  340. package/src/tools/eval.d.ts +22 -3
  341. package/src/tools/eval.ts +364 -208
  342. package/src/tools/fetch.ts +5 -6
  343. package/src/tools/glob.d.ts +4 -0
  344. package/src/tools/glob.ts +33 -65
  345. package/src/tools/grep.ts +81 -48
  346. package/src/tools/index.ts +2 -0
  347. package/src/tools/lsp.ts +81 -59
  348. package/src/tools/mcp.ts +111 -68
  349. package/src/tools/native-view.d.ts +47 -0
  350. package/src/tools/native-view.ts +102 -1
  351. package/src/tools/output-meta.d.ts +11 -1
  352. package/src/tools/output-meta.ts +23 -3
  353. package/src/tools/read.ts +7 -5
  354. package/src/tools/renderer.d.ts +37 -2
  355. package/src/tools/renderer.ts +42 -2
  356. package/src/tools/streaming-output.d.ts +20 -1
  357. package/src/tools/streaming-output.ts +149 -50
  358. package/src/tools/task.d.ts +0 -4
  359. package/src/tools/task.ts +112 -59
  360. package/src/tools/todo.ts +119 -30
  361. package/src/tools/wait.ts +34 -24
  362. package/src/tools/web-search.ts +1 -1
  363. package/src/tools/write.d.ts +9 -2
  364. package/src/tools/write.ts +147 -95
  365. package/src/tools/yield.d.ts +22 -0
  366. package/src/tools/yield.ts +225 -0
  367. package/src/tui.d.ts +31 -0
  368. package/src/tui.ts +309 -160
  369. package/src/utils.d.ts +6 -0
  370. package/src/utils.ts +19 -0
  371. package/src/vim.d.ts +19 -5
  372. package/src/vim.ts +333 -18
  373. package/src/windows-input-mode.ts +8 -0
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Draws a {@link ChartSpec} as a standalone SVG document colored only with
3
+ * figure tokens — `var(--fg)`, `var(--muted)`, `var(--border)`,
4
+ * `var(--accent)`, `var(--surface)`, `var(--c1)`…`var(--c6)` — on a
5
+ * transparent background — the token vocabulary of assistant ```svg figures —
6
+ * so the host resolves them against the live theme (`prepareSvg`) for both
7
+ * the rasterized terminal image and the native TSP blob.
8
+ *
9
+ * Styled after Apple's charts and Tern's UI: a UI sans (Geist where Tern
10
+ * provides it), muted labels, hairline gridlines that recede behind the
11
+ * marks, bars and cells with rounded corners, smooth lines (over a soft area
12
+ * fill where the axis starts at zero), dot legends, one hue across small
13
+ * multiples' columns with gray for context. 13-unit labels land near the terminal's own glyph size
14
+ * at 16 user units per row; bolded table cells draw at full strength while
15
+ * their neighbours recede. Grouped categories ({@link ChartSpec.groups}) name
16
+ * each group once beside its members, the groups parted by a gap; a name too
17
+ * long for its column wraps to two lines ({@link categoryLabels}). A few
18
+ * outliers far above the rest break a bar axis instead of flattening it
19
+ * ({@link outlierTier}); reference rows ({@link ChartSpec.reference}) draw a
20
+ * dashed rule through their group.
21
+ *
22
+ * Every chart opens with a header ({@link drawHeader}): the semibold title a
23
+ * planner set ({@link ChartSpec.title}, the one fact worth stating; its key
24
+ * figure in the accent), a muted
25
+ * note on how the data is encoded, and the series key right-aligned on the
26
+ * title's line when it fits. Marks size to
27
+ * the row count ({@link barMetrics}); strong heat cells and share segments
28
+ * print their figures in a theme-adaptive dark {@link ink}. Reusable
29
+ * annotation primitives — {@link band}, {@link referenceRule},
30
+ * {@link callout} — draw the {@link ChartSpec.annotations} a planner lays on.
31
+ *
32
+ * Axes tick on round steps in one unit (`0, 2, 4` for counts, `50s, 100s`,
33
+ * `25 GiB` where the table wrote binary sizes, thousands separated). Meaning
34
+ * layers on top: each contest's best value carries a quiet `best` tag (an
35
+ * outline in a heatmap), estimates (`~15`) among measured figures draw as
36
+ * dashed, faint bars ({@link barRect}), moves of a measure with a polarity read in `success`
37
+ * or `error` (transitions, factors, signed deltas), and status cells badge
38
+ * their row's name with a colored dot keyed under the chart.
39
+ */
40
+ import { type ChartSpec } from "./chart-plan.js";
41
+ import { type Dimension } from "./table-data.js";
42
+ /** A drawn chart: the SVG document and its size in user units. */
43
+ export interface ChartSvg {
44
+ readonly svg: string;
45
+ readonly width: number;
46
+ readonly height: number;
47
+ }
48
+ /** The SVG document for `spec`. */
49
+ export declare function renderChartSvg(spec: ChartSpec): ChartSvg;
50
+ /** One-line description of the chart, for screen readers and terminals that show the alt text. */
51
+ export declare function chartAlt(spec: ChartSpec): string;
52
+ /**
53
+ * A value in base units as an axis label: durations and sizes in the unit,
54
+ * counts compacted under the suffix (`12k`, `3.4M`), that `magnitude` reads
55
+ * best in — the value's own size by default, an axis' largest tick to keep
56
+ * its labels in one unit. Sizes read in decimal units (`20 GB`), or binary
57
+ * ones (`16 GiB`) when `unit` is `iB`.
58
+ */
59
+ export declare function formatValue(value: number, dim: Dimension, unit: string, magnitude?: number): string;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Numeric reading of GFM table cells and columns, the input to
3
+ * {@link planChart}: what number a cell holds (in base units, with its
4
+ * dimension and annotations) and which role each column plays — a measure to
5
+ * plot, a category label, an ordered x axis, or a row index to ignore.
6
+ *
7
+ * Cells are model-written prose, not CSV: `~1,400`, `**4** ✅`, `17 (21.5%)`,
8
+ * `24–72 h`, `12 → 15`, `5/8`, `1m 56s`, `TIMEOUT`. The reader keeps the first
9
+ * number and its unit and classifies the rest, so a column of mostly clean
10
+ * numbers survives a few annotated or sentinel cells.
11
+ */
12
+ /** What a number measures; values of one dimension share an axis after unit normalization. */
13
+ export type Dimension = "count" | "percent" | "duration" | "bytes" | "currency" | "ratio" | "fraction" | "rate";
14
+ /**
15
+ * How cleanly a cell reads as its number: bare (`12 ms`), with a short note
16
+ * (`17 (21.5%)`, `16 pass`), a range (`24–72 h`), a transition (`12 → 15`), a
17
+ * fraction (`5/8`), or a number leading prose (`~1,400w, nearly ready`).
18
+ */
19
+ export type CellFit = "pure" | "note" | "range" | "arrow" | "fraction" | "prose";
20
+ /** A cell that reads as a number. */
21
+ export interface NumberCell {
22
+ readonly kind: "number";
23
+ /** Value in base units: seconds, bytes, a plain count, percent points. */
24
+ readonly value: number;
25
+ readonly dim: Dimension;
26
+ /** Unit or currency symbol as written (`ms`, `KiB`, `$`, `tok/s`); empty for bare numbers. */
27
+ readonly unit: string;
28
+ readonly fit: CellFit;
29
+ /** Written as an estimate or bound (`~`, `≈`, `<`, `≥`). */
30
+ readonly approx: boolean;
31
+ /** Written with an explicit sign (`+12%`, `-3`). */
32
+ readonly signed: boolean;
33
+ /** The cell was bolded: models bold the value they want noticed. */
34
+ readonly emphasis: boolean;
35
+ /** The cell text without Markdown decoration. */
36
+ readonly text: string;
37
+ /** The number as written, with approximation, sign, currency and unit (`~$250`, `12.5 ms`, `24–72 h`). */
38
+ readonly figure: string;
39
+ /** `a → b`: `b`, in the same base units. */
40
+ readonly to?: number;
41
+ /** `a → b`: `b` as written. */
42
+ readonly toFigure?: string;
43
+ /** `a–b`: `b`, in the same base units. */
44
+ readonly upper?: number;
45
+ /**
46
+ * `a/b`: `b`. {@link analyzeTable} reads a score (`12/12`, `154/160`, a mean
47
+ * like `0.6/4`) as the percent of `b` reached, unless its column also holds a
48
+ * plain fraction; a pair (`85 / 147` under `Edit / read calls`) keeps `a`.
49
+ */
50
+ readonly denominator?: number;
51
+ /**
52
+ * `a ± e` (`3.67s ± 0.69`, `~404ms ± 60`, `$0.72 (±0.16)`): `e`, in the same base units — the
53
+ * spread the table states around the value; {@link figure} then writes both (`3.67s ± 0.69`).
54
+ */
55
+ readonly error?: number;
56
+ /**
57
+ * A slash list of measurements in one unit (`79 / 124 µs`, `1,864 ms /
58
+ * 2,678 ms`, `**675ms** / 680ms`): every listed value, the first included,
59
+ * in base units, 2–4 of them. `value` is the first.
60
+ */
61
+ readonly values?: readonly number[];
62
+ }
63
+ /** A cell that is not a quantity. */
64
+ export interface OtherCell {
65
+ readonly kind: "missing" | "date" | "time" | "version" | "id" | "text";
66
+ readonly text: string;
67
+ readonly emphasis: boolean;
68
+ }
69
+ export type Cell = NumberCell | OtherCell;
70
+ /**
71
+ * What a column contributes to a chart: `measure` values to plot, `label`
72
+ * category names, `temporal` dates or times, `sequence` an ordered step
73
+ * (`Run`, `Day`, `Workers`), `index` a row number or identifier never plotted.
74
+ */
75
+ export type ColumnRole = "measure" | "label" | "temporal" | "sequence" | "index";
76
+ export interface TableColumn {
77
+ readonly index: number;
78
+ /** Header text without Markdown decoration. */
79
+ readonly header: string;
80
+ readonly role: ColumnRole;
81
+ readonly cells: readonly Cell[];
82
+ /** Dominant dimension of the numeric cells. */
83
+ readonly dim: Dimension | undefined;
84
+ /** Representative unit of the dominant dimension (`$`, `tok/s`); empty when bare. */
85
+ readonly unit: string;
86
+ /** Numeric cells disagree on dimension (a metric-per-row table). */
87
+ readonly mixed: boolean;
88
+ /** Numeric cells are mostly scores out of a total (`12/12`), read as percent of it. */
89
+ readonly scores: boolean;
90
+ /**
91
+ * Per row, the status its cell leads with ({@link cellStatus}), when most
92
+ * of the column's cells lead with one: a pass/fail or progress column.
93
+ */
94
+ readonly statuses?: readonly (Status | undefined)[];
95
+ /** Every numeric data cell holds the same value: an echoed setting, not a measure. */
96
+ readonly constant: boolean;
97
+ /** Share of numeric cells written with an explicit sign. */
98
+ readonly signedShare: number;
99
+ /** Share of numeric cells written as `a → b`. */
100
+ readonly arrowShare: number;
101
+ /**
102
+ * Index of the measure column this one restates, read from the values: a
103
+ * proportional copy (`pass` 33/38 beside `pass%` 87%, `Samples` beside `% of
104
+ * Total`, `Leverage vs $200` beside the cost) or a running total of it
105
+ * (`Offset` summing `Verts`). Such a column is never a measure of its own.
106
+ */
107
+ readonly restates?: number;
108
+ }
109
+ /**
110
+ * Measure columns that add up, read from the values: leaf `parts` summing to
111
+ * `whole` in every row (`Cached + Uncached input = Input`, `Input + Output =
112
+ * Total` → parts Cached, Uncached input, Output of Total), or — when not
113
+ * `exact` — parts falling within a `Total` column, the rest unlisted (`New +
114
+ * Edited ≤ Prose total`).
115
+ */
116
+ export interface Composition {
117
+ /** Column the parts make up; absent when only a judge says the parts form a whole. */
118
+ readonly whole: number | undefined;
119
+ /** Leaf part columns, in table order. */
120
+ readonly parts: readonly number[];
121
+ /** The parts sum to the whole within the written precision in every row. */
122
+ readonly exact: boolean;
123
+ }
124
+ /** A table read for charting. */
125
+ export interface TableAnalysis {
126
+ readonly columns: readonly TableColumn[];
127
+ /**
128
+ * Category labels: the first text or temporal column not made only of codes
129
+ * (`#2233`, `00`), else the first text column, else a sequence or index column.
130
+ */
131
+ readonly label: TableColumn | undefined;
132
+ /** Plottable measure columns, constant ones excluded. */
133
+ readonly measures: readonly TableColumn[];
134
+ /** Data rows, in table order, without total/summary rows. */
135
+ readonly rows: readonly number[];
136
+ /** Total/summary rows (`Total`, `Average`, …), kept out of the scale. */
137
+ readonly totals: readonly number[];
138
+ /** Measure columns adding up to a whole, when the values show it. */
139
+ readonly composition?: Composition;
140
+ }
141
+ /**
142
+ * What a status cell (`ok`, `FAIL`, `pending`, ✅) says about its row: `good`
143
+ * passed or landed, `bad` failed or broke, `warn` partly or flaky, `pending`
144
+ * not settled yet.
145
+ */
146
+ export type Status = "good" | "bad" | "warn" | "pending";
147
+ /**
148
+ * The status a cell's text leads with (`FAIL`, `✓ via mmdc`, `**pending**`,
149
+ * `1 ok`), or `undefined` for any other text. A count before the word
150
+ * (`3 ok`) still reads as the word's status.
151
+ */
152
+ export declare function cellStatus(text: string): Status | undefined;
153
+ /**
154
+ * Strip inline Markdown from a cell: links keep their text; bold, italics,
155
+ * strikethrough, code spans and `<br>` keep their content.
156
+ */
157
+ export declare function plainCell(markdown: string): {
158
+ text: string;
159
+ emphasis: boolean;
160
+ };
161
+ /** Parse the first number of a (Markdown) cell, or classify why it is not one. */
162
+ export declare function parseCell(markdown: string): Cell;
163
+ /** Read a table's columns and rows for charting. Cells are the raw Markdown of each cell. */
164
+ export declare function analyzeTable(header: readonly string[], rows: readonly (readonly string[])[]): TableAnalysis;
165
+ /**
166
+ * Half the last written digit of `cell`, in base units (`6,313k` → 500,
167
+ * `38.5%` → 0.05): how far its value may sit from the exact quantity it
168
+ * rounds. A score (`33/38` read as percent) and a whole count written in full
169
+ * (`46`, `1,980`) are exact.
170
+ */
171
+ export declare function writtenSlack(cell: NumberCell): number;
172
+ /** Strictly increasing or strictly decreasing. */
173
+ export declare function isMonotonic(values: readonly number[]): boolean;
174
+ /** Whether `cell` reads as a number. */
175
+ export declare function isNumber(cell: Cell | undefined): cell is NumberCell;
@@ -54,6 +54,7 @@ export declare class AssistantMessageComponent extends Container {
54
54
  */
55
55
  setServedModelMismatch(info: ServedModelMismatch | undefined): void;
56
56
  invalidate(): void;
57
+ releaseRenderCaches(): void;
57
58
  setHideThinkingBlock(hide: boolean): void;
58
59
  /**
59
60
  * Allow or withhold retiring finished lines into native scrollback while the
@@ -86,6 +87,8 @@ export declare class AssistantMessageComponent extends Container {
86
87
  */
87
88
  setExpanded(expanded: boolean): void;
88
89
  isTranscriptBlockFinalized(): boolean;
90
+ /** Whether a figure still waits for the raster of its final source; the transcript holds retirement meanwhile. */
91
+ isTranscriptBlockPending(): boolean;
89
92
  render(width: number): readonly string[];
90
93
  /**
91
94
  * A `col` (role `zeta.assistant`) of `md` nodes keyed by content index, so
@@ -123,6 +126,8 @@ export declare class AssistantMessageComponent extends Container {
123
126
  messagePersistenceKey(): string | undefined;
124
127
  /** Toggle rendering for assistant-native and tool-result images. */
125
128
  setImagesVisible(visible: boolean): void;
129
+ /** Toggle charts under numeric tables (the main session's transcript only, never a subagent's). */
130
+ setTableChartsVisible(visible: boolean): void;
126
131
  /** Toggle only images produced by tool results; assistant-native images remain governed by setImagesVisible. */
127
132
  setToolResultImagesVisible(visible: boolean): void;
128
133
  setToolResultImages(toolCallId: string, images: ImageContent[]): void;
@@ -28,6 +28,8 @@ export interface ChatTranscriptBuilderDeps {
28
28
  expandThinkingBlocks?: () => boolean;
29
29
  /** Session-scoped resolved destinations for model-authored Markdown links. */
30
30
  linkTargets?: ReadonlyMap<string, string>;
31
+ /** Draw charts under numeric tables; false for transcripts that are not the main session's. Default: true. */
32
+ tableCharts?: boolean;
31
33
  requestRender: () => void;
32
34
  }
33
35
  export declare class ChatTranscriptBuilder {
@@ -31,6 +31,7 @@ declare class SummaryMessageComponent implements Component {
31
31
  handleNativeEvent(event: NativeUiEvent): void;
32
32
  setIgnoreTight(ignore: boolean): this;
33
33
  invalidate(): void;
34
+ releaseRenderCaches(): void;
34
35
  dispose(): void;
35
36
  render(width: number): readonly string[];
36
37
  }
@@ -78,7 +78,7 @@ export interface ExecutionToolInput {
78
78
  /** Tool name for the head icon (`bash`, `eval`). */
79
79
  readonly name: string;
80
80
  readonly title: string;
81
- /** The command / cell source, shown once in the head. */
81
+ /** The command / cell source: the run box's input and the head's Copy command. */
82
82
  readonly command: string;
83
83
  readonly lang: string;
84
84
  /** Excluded from context (`!!`/`$$`). */
@@ -96,10 +96,11 @@ export interface ExecutionToolInput {
96
96
  readonly artifactError?: OutputArtifactError;
97
97
  }
98
98
  /**
99
- * A user `!`/`$` run as the agent's `tool` frame (§6.6): the command in the
100
- * head with a `you` badge (plus `not sent` when excluded from context), the
101
- * timer, exit chip and cancelled note; the body is the output as an `ansi`
102
- * mini terminal following its tail, then one quiet truncation line.
99
+ * A user `!`/`$` run as the agent's `tool` frame (§6.6): a head with a `you`
100
+ * badge (plus `not sent` when excluded from context) and the command for Copy
101
+ * command; the body is one run box — the source, the output as an `ansi` mini
102
+ * terminal following its tail, and the foot (state, time, truncation) — with
103
+ * any images below it. Timer, exit chip and cancelled note stay head data.
103
104
  */
104
105
  export declare function describeExecutionTool(input: ExecutionToolInput): NativeNode;
105
106
  /**
@@ -0,0 +1,42 @@
1
+ /**
2
+ * A tool call's {@link ToolFigure} drawn under its card, the way assistant
3
+ * Markdown draws that fence: ```svg as an inline image ({@link SvgFigure}),
4
+ * redrawn as the body streams; ```mermaid as ASCII art once the body is
5
+ * final. The card already shows the source, so unlike the assistant's fence
6
+ * it never falls back to code: {@link FenceFigure.draws} turns down fences
7
+ * this terminal shows as code, and an svg that does not rasterize stays blank.
8
+ */
9
+ import type { ImageBudget } from "../components/image.js";
10
+ import type { ToolFigure } from "../tools/renderer.js";
11
+ import type { Component } from "../tui.js";
12
+ /** Fence languages a {@link FenceFigure} draws. */
13
+ export type FenceFigureLang = "svg" | "mermaid";
14
+ export interface FenceFigureOptions {
15
+ /** Shared inline-image budget for an svg's rasters. */
16
+ budget?: ImageBudget;
17
+ /** The figure's rows changed outside a render: a raster landed. */
18
+ onChange: () => void;
19
+ }
20
+ export declare class FenceFigure implements Component {
21
+ #private;
22
+ /**
23
+ * Whether this terminal draws `figure` now: an svg where inline images show
24
+ * (`showImages` and a graphics protocol), a closed mermaid fence when
25
+ * diagram rendering is on and the source renders.
26
+ */
27
+ static draws(figure: ToolFigure, options: {
28
+ showImages: boolean;
29
+ }): figure is ToolFigure & {
30
+ readonly lang: FenceFigureLang;
31
+ };
32
+ readonly lang: FenceFigureLang;
33
+ constructor(lang: FenceFigureLang, options: FenceFigureOptions);
34
+ /** Feed the fence as it stands; its `lang` is this figure's. */
35
+ update(figure: ToolFigure): void;
36
+ /** Whether a closed svg's raster is still on its way. */
37
+ get pending(): boolean;
38
+ /** The drawing; no rows while an svg draws, or when it does not. */
39
+ render(width: number): readonly string[];
40
+ invalidate(): void;
41
+ dispose(): void;
42
+ }
@@ -0,0 +1,42 @@
1
+ import type { ImageBudget } from "../components/image.js";
2
+ import type { Markdown } from "../components/markdown.js";
3
+ import { Container } from "../tui.js";
4
+ export interface FigureMarkdownOptions {
5
+ /** Markdown for one prose run (and a failed figure's code fallback); FigureMarkdown drives its transience. */
6
+ markdown: (text: string) => Markdown;
7
+ /** Draw charts under numeric tables; off for transcripts that are not the main session's. */
8
+ charts: boolean;
9
+ /** Shared inline-image budget for the figures. */
10
+ budget?: ImageBudget;
11
+ /** A figure's rows changed outside a text update (raster landed, fell back to code). */
12
+ onChange: () => void;
13
+ }
14
+ /**
15
+ * Assistant Markdown whose top-level ```svg fences are lifted out of the prose
16
+ * and drawn as images ({@link SvgFigure}), and whose numeric tables get a chart
17
+ * drawn under them ({@link TableChartFigure}), with ordinary {@link Markdown}
18
+ * for the prose between them. Stands in for Markdown on an assistant text
19
+ * block that holds an svg fence or a chartable table: {@link setText} streams
20
+ * in place, reusing every part whose kind is unchanged, and
21
+ * {@link transientRenderCache} marks the block's tail as still streaming — the
22
+ * last prose run renders transient, the last figure throttles its rasters
23
+ * until its fence closes, and a table at the tail waits for its last row.
24
+ */
25
+ export declare class FigureMarkdown extends Container {
26
+ #private;
27
+ constructor(text: string, options: FigureMarkdownOptions);
28
+ /** Replace the source; returns whether it changed. */
29
+ setText(text: string): boolean;
30
+ get transientRenderCache(): boolean;
31
+ set transientRenderCache(value: boolean);
32
+ /**
33
+ * The trimmed prose ahead of the first figure, or "" when the block opens
34
+ * with one. These are the only rows plain Markdown reproduces byte for
35
+ * byte, so they are all a transcript may publish ahead of the figure.
36
+ */
37
+ get leadingProse(): string;
38
+ /** Whether a figure's final source still waits for its raster, or a chart for its pick or raster. */
39
+ get pending(): boolean;
40
+ /** Rebuild the prose runs through the Markdown factory after its theme changed; figures keep their rasters. */
41
+ restyle(): void;
42
+ }
@@ -64,7 +64,7 @@ export interface SkillPromptDetails {
64
64
  * `ui-helpers.addMessageToChat` (renderers), `AgentHubOverlayComponent
65
65
  * #buildTranscriptLines`, `runPrintMode`, and `AcpAgent#replayAssistantMessage`
66
66
  * (fallback error emission) read it via `isSilentAbort`. */
67
- export declare const SILENT_ABORT_MARKER = "__omp.silent_abort__";
67
+ export declare const SILENT_ABORT_MARKER = "__zeta.silent_abort__";
68
68
  /** Type-guard for silent aborts. Renderers MUST call this helper so structured
69
69
  * `errorId` and legacy persisted marker messages stay in lockstep. */
70
70
  export declare function isSilentAbort(message: Pick<AssistantMessage, "errorId" | "errorMessage">): boolean;
@@ -0,0 +1,33 @@
1
+ import { type ImageBudget } from "../components/image.js";
2
+ import { type Markdown } from "../components/markdown.js";
3
+ import type { Component } from "../tui.js";
4
+ /** The active theme's color per figure token, for resolving a figure with `prepareSvg`. */
5
+ export declare function svgFigurePalette(): Record<string, string>;
6
+ /** Turn lifting ```svg fences into images on or off (the host's `tui.renderSvg`); the host rebuilds the transcript after. */
7
+ export declare function setSvgFigureRendering(enabled: boolean): void;
8
+ /** Whether assistant ```svg fences render as images where the terminal can show them. */
9
+ export declare function svgFigureRendering(): boolean;
10
+ export interface SvgFigureOptions {
11
+ /**
12
+ * Markdown for the fenced-code fallback shown when the final source does not
13
+ * render. Without it the figure decorates content shown elsewhere (a chart
14
+ * under its table): it stays blank until drawn, and when it cannot be.
15
+ */
16
+ markdown?: (text: string) => Markdown;
17
+ /** Shared inline-image budget; superseded rasters are released from it. */
18
+ budget?: ImageBudget;
19
+ /** The figure's rows changed outside a text update: a raster landed or rendering fell back to code. */
20
+ onChange: () => void;
21
+ }
22
+ export declare class SvgFigure implements Component {
23
+ #private;
24
+ constructor(options: SvgFigureOptions);
25
+ /** Feed the fence body; `final` once the fence closed or the message stopped streaming. */
26
+ update(source: string, final: boolean): void;
27
+ /** Whether the final source still waits for its raster (or for failing to render). */
28
+ get pending(): boolean;
29
+ render(width: number): readonly string[];
30
+ invalidate(): void;
31
+ dispose(): void;
32
+ debugState(): Record<string, unknown>;
33
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Source-level handling of ```svg fences in assistant Markdown: splitting
3
+ * prose around them ({@link splitSvgFences}), turning a fence that is still
4
+ * streaming into a document an SVG parser accepts ({@link closePartialSvg}),
5
+ * and resolving the theme tokens figures color themselves with
6
+ * ({@link prepareSvg}). `FigureMarkdown` lifts the fences out as `SvgFigure`
7
+ * images.
8
+ */
9
+ /** One run of an assistant text block: prose, or the body of a ```svg fence. */
10
+ export type FigureSegment = {
11
+ readonly kind: "markdown";
12
+ readonly text: string;
13
+ }
14
+ /** `closed` once the fence's closing line arrived. */
15
+ | {
16
+ readonly kind: "svg";
17
+ readonly source: string;
18
+ readonly closed: boolean;
19
+ };
20
+ /** Whether `markdown` holds a ```svg fence {@link splitSvgFences} would lift. */
21
+ export declare function hasSvgFence(markdown: string): boolean;
22
+ /**
23
+ * Split `markdown` into prose and ```svg fence bodies, in order. Only
24
+ * top-level fences lift; an svg fence nested in another fence, a list's
25
+ * indented block or a blockquote stays prose. Blank prose runs are dropped.
26
+ * An svg fence still open at the end is the last segment, `closed: false`.
27
+ */
28
+ export declare function splitSvgFences(markdown: string): FigureSegment[];
29
+ /**
30
+ * Turn a possibly truncated SVG source into a well-formed document: cut the
31
+ * trailing construct still being written (a tag without its `>`, an
32
+ * unterminated comment, CDATA section, processing instruction or declaration,
33
+ * a dangling `&entity`) and close every element left open, innermost first.
34
+ * A complete document passes through unchanged. Returns null until the root
35
+ * `<svg …>` start tag is complete — before that there is nothing to draw.
36
+ */
37
+ export declare function closePartialSvg(source: string): string | null;
38
+ /**
39
+ * Make a figure's source what an SVG rasterizer draws as written, in the
40
+ * reader's theme. Rasterizers resolve neither CSS custom properties nor an
41
+ * inherited text color, and reject a root without the SVG namespace, so:
42
+ * - `var(--name)` / `var(--name, fallback)` become `palette[name]` (an
43
+ * unknown name takes its fallback, else `palette.fg`);
44
+ * - a root `<svg>` lacking them gets `color` = `palette.fg` (so
45
+ * `currentColor` follows the theme), a sans-serif `font-family` (instead
46
+ * of the rasterizer's Times), `xmlns`, and `xmlns:xlink` when the source
47
+ * uses `xlink:` attributes.
48
+ */
49
+ export declare function prepareSvg(svg: string, palette: Readonly<Record<string, string>>): string;
@@ -0,0 +1,89 @@
1
+ import type { Tokens } from "@linxiraos/pi-utils/marked";
2
+ import { type ChartPlan } from "../charts/chart-plan.js";
3
+ import { type TableAnalysis } from "../charts/table-data.js";
4
+ import type { ImageBudget } from "../components/image.js";
5
+ import type { NativeNode } from "../native/node.js";
6
+ import type { Component } from "../tui.js";
7
+ /**
8
+ * `smart`: a model refines the local guess where meaning decides (kind,
9
+ * columns, row names, ordering, polarity, focus, title; see {@link shouldJudge});
10
+ * `always`: the local best guess charts every table it reads as numeric;
11
+ * `off`: tables stay tables.
12
+ */
13
+ export type TableChartMode = "smart" | "always" | "off";
14
+ /** A table the host's planner picks a chart for ({@link shouldJudge}). */
15
+ export interface TableChartRequest {
16
+ /** The table's Markdown source. */
17
+ readonly markdown: string;
18
+ readonly table: TableAnalysis;
19
+ /** The local best guess; the planner may keep it. */
20
+ readonly guess: ChartPlan;
21
+ }
22
+ /**
23
+ * Picks the chart for a multi-series table under `smart`: a plan, or `null`
24
+ * for no chart. A rejection falls back to the local guess.
25
+ */
26
+ export type TableChartPlanner = (request: TableChartRequest) => Promise<ChartPlan | null>;
27
+ /** A drawn chart, ready to resolve against the theme. */
28
+ export interface TableChart {
29
+ /** SVG colored with figure tokens (`var(--accent)`, …). */
30
+ readonly svg: string;
31
+ readonly alt: string;
32
+ /** Size in SVG user units. */
33
+ readonly width: number;
34
+ readonly height: number;
35
+ }
36
+ /** The chart under a table: drawn, none, or a smart pick on its way (the promise settles once the cache holds it). */
37
+ export type ChartLookup = TableChart | null | Promise<void>;
38
+ /** One run of a Markdown block: prose (ending at a charted table), or the chart drawn after that table. */
39
+ export type ChartSegment = {
40
+ readonly kind: "markdown";
41
+ readonly text: string;
42
+ } | {
43
+ readonly kind: "chart";
44
+ readonly table: Tokens.Table;
45
+ };
46
+ /** Set how tables become charts (the host's `tui.autoGraph`) and its `smart` planner; the host rebuilds the transcript after. */
47
+ export declare function setTableCharts(mode: TableChartMode, planner?: TableChartPlanner): void;
48
+ /** How assistant tables currently become charts. */
49
+ export declare function tableChartMode(): TableChartMode;
50
+ /** Whether `markdown` may hold a table {@link splitTableCharts} would chart. */
51
+ export declare function hasChartTable(markdown: string): boolean;
52
+ /**
53
+ * Split `markdown` after each top-level table that has (or may get) a chart.
54
+ * A table still streaming at the block's tail is left whole: rows may follow.
55
+ */
56
+ export declare function splitTableCharts(markdown: string, streaming: boolean): ChartSegment[];
57
+ /**
58
+ * The chart for `table` under the current mode, read once per table source.
59
+ * Under `smart` the first lookup of a multi-series table asks the planner.
60
+ */
61
+ export declare function lookupTableChart(table: Tokens.Table): ChartLookup;
62
+ /**
63
+ * A native `image` node drawing `chart` from its SVG — no raster — resolved
64
+ * against the active theme; rebuilt when the theme changes.
65
+ */
66
+ export declare function describeTableChart(chart: TableChart, key: string): NativeNode;
67
+ export interface TableChartFigureOptions {
68
+ /** Shared inline-image budget. */
69
+ budget?: ImageBudget;
70
+ /** The chart's rows changed outside a text update: its pick or raster landed. */
71
+ onChange: () => void;
72
+ }
73
+ /**
74
+ * The chart under one table, as a terminal image a blank row below it. Looks
75
+ * the chart up on first render — a block rebuilt mid-stream never asks for a
76
+ * pick it drops — and renders nothing until it is drawn, or when the table
77
+ * gets no chart.
78
+ */
79
+ export declare class TableChartFigure implements Component {
80
+ #private;
81
+ constructor(options: TableChartFigureOptions);
82
+ /** Point the figure at `table`. */
83
+ update(table: Tokens.Table): void;
84
+ /** Whether the chart is still being looked up, picked or drawn. */
85
+ get pending(): boolean;
86
+ render(width: number): readonly string[];
87
+ invalidate(): void;
88
+ dispose(): void;
89
+ }
@@ -90,6 +90,8 @@ export declare class ToolExecutionComponent extends Container {
90
90
  * component-scoped so the TUI reuses every other root subtree (issue #4377).
91
91
  */
92
92
  tickSpinner(frame: number): void;
93
+ /** Whether the result's figure still waits for its raster; the transcript holds retirement meanwhile. */
94
+ isTranscriptBlockPending(): boolean;
93
95
  /**
94
96
  * Whether this block is ready to retire as immutable history. Partial
95
97
  * results, including detached background tasks, remain active and mutable
@@ -1,10 +1,11 @@
1
+ import type { AnimationFrame, TranscriptPresentationTarget } from "../chrome/transcript-container.js";
1
2
  import { type Component, Container } from "../tui.js";
2
3
  import type { ImageContent } from "@linxiraos/pi-ai";
3
4
  import type { ReactionTarget } from "./reaction.js";
4
5
  import { type DescribeContext, type NativeNode, type NativeUiEvent } from "../native/node.js";
5
6
  /** How a user bubble styles its prose and chips (see {@link userBubbleColor}). */
6
7
  export interface UserBubbleOptions {
7
- /** Materialized `file://` targets per attached image, indexed by chip number. */
8
+ /** Filesystem paths for attached image chips, indexed by chip number. */
8
9
  imageLinks?: readonly (string | undefined)[];
9
10
  /** The message's attached images in chip order (`#1` first); a native bubble shows them. */
10
11
  images?: readonly ImageContent[];
@@ -30,9 +31,10 @@ export declare function userBubbleColor(options?: UserBubbleOptions, tokenRegex?
30
31
  * (see {@link ReactionTarget}) drawn right-aligned in the bubble's top padding row;
31
32
  * a live-steered message carries a `*` marker left-aligned in the same row.
32
33
  */
33
- export declare class UserMessageComponent extends Container implements ReactionTarget {
34
+ export declare class UserMessageComponent extends Container implements ReactionTarget, TranscriptPresentationTarget {
34
35
  #private;
35
36
  constructor(text: string, options?: UserBubbleOptions);
37
+ releaseRenderCaches(): void;
36
38
  setReaction(emoji: string): void;
37
39
  /**
38
40
  * A head-less user-toned frame with the prompt as markdown under its
@@ -45,6 +47,16 @@ export declare class UserMessageComponent extends Container implements ReactionT
45
47
  describe(cx?: DescribeContext): NativeNode;
46
48
  /** Hover toolbar clicks: zeta's own copy and rewind commands. */
47
49
  handleNativeEvent(event: NativeUiEvent): void;
50
+ /** Apply the transcript allocator's current viewport reservation. */
51
+ setTranscriptAllocation(rows: number, _frame?: AnimationFrame): void;
52
+ isTranscriptBlockFinalized(): boolean;
53
+ /**
54
+ * Single-row emergency representation for the overflow transcript layout:
55
+ * renders the first content line instead of the blank top padding row, and
56
+ * omits OSC 133 shell integration markers so moving live blocks across the
57
+ * viewport does not leave stale prompt marks on lines it no longer occupies.
58
+ */
59
+ renderTranscriptBlockEmergencyRow(width: number): string | undefined;
48
60
  render(width: number): readonly string[];
49
61
  }
50
62
  /**
@@ -75,6 +87,7 @@ export declare class CollapsedSyntheticMessageComponent implements Component {
75
87
  handleNativeEvent(event: NativeUiEvent): void;
76
88
  setIgnoreTight(ignore: boolean): this;
77
89
  invalidate(): void;
90
+ releaseRenderCaches(): void;
78
91
  dispose(): void;
79
92
  render(width: number): readonly string[];
80
93
  }
@@ -1,5 +1,14 @@
1
1
  import type { TabBarTheme } from "../components/tab-bar.js";
2
2
  /** Compact single-line display text for statuses; unlike titles, collapse padding and trim. */
3
3
  export declare function sanitizeStatusText(text: string): string;
4
+ /**
5
+ * Like {@link sanitizeStatusText}, but keeps 7-bit SGR so extensions can colour
6
+ * `ctx.ui.setStatus` text. Every other escape (OSC links/titles, DCS/PM/APC,
7
+ * 7- and 8-bit CSI), C0/C1, lone surrogates, newlines and tabs are sanitized at
8
+ * least as strictly as in `sanitizeStatusText`; space runs collapse and edges
9
+ * trim (`String#trim` whitespace) by visible text, regardless of SGR placement.
10
+ * A styled result always ends with `\x1b[0m`.
11
+ */
12
+ export declare function sanitizeHookStatusText(input: string): string;
4
13
  /** Shared tab bar theme used by fullscreen overlays (settings, agent hub). */
5
14
  export declare function getTabBarTheme(): TabBarTheme;