@linxiraos/pi-tui 1.1.26 → 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 (423) hide show
  1. package/CHANGELOG.md +51 -491
  2. package/README.md +13 -7
  3. package/dist/types/active-terminal.d.ts +30 -0
  4. package/dist/types/app-keybindings.d.ts +7 -2
  5. package/dist/types/apps/cleanse-board.d.ts +1 -1
  6. package/dist/types/apps/debug/log-viewer.d.ts +4 -0
  7. package/dist/types/apps/debug/raw-sse-buffer.d.ts +2 -0
  8. package/dist/types/apps/git/git-tui.d.ts +5 -4
  9. package/dist/types/apps/git/help.d.ts +3 -1
  10. package/dist/types/apps/if-bench-board.d.ts +2 -2
  11. package/dist/types/apps/setup-model-picker.d.ts +1 -1
  12. package/dist/types/autocomplete.d.ts +5 -2
  13. package/dist/types/charts/chart-plan.d.ts +674 -0
  14. package/dist/types/charts/chart-svg.d.ts +59 -0
  15. package/dist/types/charts/table-data.d.ts +175 -0
  16. package/dist/types/chat/assistant-message.d.ts +11 -1
  17. package/dist/types/chat/chat-transcript-builder.d.ts +3 -0
  18. package/dist/types/chat/compaction-summary-message.d.ts +1 -0
  19. package/dist/types/chat/execution-shared.d.ts +6 -5
  20. package/dist/types/chat/fence-figure.d.ts +42 -0
  21. package/dist/types/chat/figure-markdown.d.ts +42 -0
  22. package/dist/types/chat/messages.d.ts +1 -1
  23. package/dist/types/chat/svg-figure.d.ts +33 -0
  24. package/dist/types/chat/svg-source.d.ts +49 -0
  25. package/dist/types/chat/table-chart.d.ts +89 -0
  26. package/dist/types/chat/tool-execution.d.ts +2 -0
  27. package/dist/types/chat/user-message.d.ts +17 -4
  28. package/dist/types/chrome/shared.d.ts +9 -0
  29. package/dist/types/chrome/status-notice.d.ts +15 -3
  30. package/dist/types/chrome/transcript-container.d.ts +6 -0
  31. package/dist/types/components/box.d.ts +1 -0
  32. package/dist/types/components/disclosure.d.ts +1 -0
  33. package/dist/types/components/editor.d.ts +23 -5
  34. package/dist/types/components/form.d.ts +1 -0
  35. package/dist/types/components/image.d.ts +26 -44
  36. package/dist/types/components/input.d.ts +2 -1
  37. package/dist/types/components/key-value-list.d.ts +1 -0
  38. package/dist/types/components/layout/row.d.ts +1 -0
  39. package/dist/types/components/layout/stack.d.ts +1 -0
  40. package/dist/types/components/loader.d.ts +5 -6
  41. package/dist/types/components/markdown.d.ts +47 -5
  42. package/dist/types/components/scroll-view.d.ts +1 -0
  43. package/dist/types/components/section.d.ts +1 -0
  44. package/dist/types/components/table.d.ts +1 -0
  45. package/dist/types/components/text.d.ts +1 -0
  46. package/dist/types/components/tree-view.d.ts +7 -0
  47. package/dist/types/components/truncated-text.d.ts +1 -0
  48. package/dist/types/fuzzy.d.ts +29 -1
  49. package/dist/types/key-hint-format.d.ts +9 -1
  50. package/dist/types/keybinding-matchers.d.ts +3 -0
  51. package/dist/types/keybindings.d.ts +1 -1
  52. package/dist/types/kitty-graphics.d.ts +2 -2
  53. package/dist/types/loop-watchdog.d.ts +8 -7
  54. package/dist/types/multiplexers/cmux.d.ts +16 -0
  55. package/dist/types/multiplexers/herdr.d.ts +26 -0
  56. package/dist/types/multiplexers/notify.d.ts +13 -0
  57. package/dist/types/multiplexers/orca.d.ts +12 -0
  58. package/dist/types/multiplexers/screen.d.ts +9 -0
  59. package/dist/types/multiplexers/tmux.d.ts +29 -0
  60. package/dist/types/multiplexers/types.d.ts +100 -0
  61. package/dist/types/multiplexers/wmux.d.ts +12 -0
  62. package/dist/types/multiplexers/zellij.d.ts +12 -0
  63. package/dist/types/native/apply.d.ts +4 -3
  64. package/dist/types/native/backend.d.ts +5 -4
  65. package/dist/types/native/blobs.d.ts +7 -3
  66. package/dist/types/native/encode.d.ts +8 -6
  67. package/dist/types/native/node.d.ts +36 -5
  68. package/dist/types/native/overlay.d.ts +8 -3
  69. package/dist/types/native/settle.d.ts +4 -3
  70. package/dist/types/overlays/agent-hub-projection.d.ts +6 -5
  71. package/dist/types/overlays/agent-hub-types.d.ts +9 -0
  72. package/dist/types/overlays/agent-hub.d.ts +3 -0
  73. package/dist/types/overlays/agent-transcript-viewer.d.ts +12 -2
  74. package/dist/types/overlays/agents-hub.d.ts +9 -0
  75. package/dist/types/overlays/annotation-overlay.d.ts +19 -2
  76. package/dist/types/overlays/annotation-types.d.ts +2 -0
  77. package/dist/types/overlays/ask-dialog.d.ts +5 -2
  78. package/dist/types/overlays/btw-history-panel.d.ts +13 -1
  79. package/dist/types/overlays/copy-selector.d.ts +1 -0
  80. package/dist/types/overlays/history-search.d.ts +10 -0
  81. package/dist/types/overlays/hook-selector.d.ts +9 -4
  82. package/dist/types/overlays/hub-frame.d.ts +4 -1
  83. package/dist/types/overlays/jobs-panel.d.ts +1 -7
  84. package/dist/types/overlays/model-browser.d.ts +54 -7
  85. package/dist/types/overlays/model-hub.d.ts +37 -0
  86. package/dist/types/overlays/oauth-selector.d.ts +0 -1
  87. package/dist/types/overlays/plan-review-overlay.d.ts +3 -2
  88. package/dist/types/overlays/report-panel.d.ts +68 -0
  89. package/dist/types/overlays/rewind-selector.d.ts +1 -0
  90. package/dist/types/overlays/session-observer-registry.d.ts +2 -0
  91. package/dist/types/overlays/session-selector.d.ts +6 -2
  92. package/dist/types/overlays/settings-defs.d.ts +1 -0
  93. package/dist/types/overlays/thinking-selector.d.ts +2 -2
  94. package/dist/types/overlays/usage-dashboard.d.ts +12 -8
  95. package/dist/types/overlays/usage-display.d.ts +3 -1
  96. package/dist/types/prompt/composer-cache.d.ts +0 -16
  97. package/dist/types/prompt/composer.d.ts +18 -3
  98. package/dist/types/prompt/custom-editor.d.ts +25 -13
  99. package/dist/types/prompt/image-source.d.ts +2 -1
  100. package/dist/types/prompt/interactive-context-helpers.d.ts +5 -1
  101. package/dist/types/prompt/model-mention-autocomplete.d.ts +1 -1
  102. package/dist/types/prompt/welcome.d.ts +7 -2
  103. package/dist/types/render/composite.d.ts +2 -0
  104. package/dist/types/render/output-pane.d.ts +1 -0
  105. package/dist/types/render/render-utils.d.ts +1 -0
  106. package/dist/types/render/tool-card.d.ts +6 -0
  107. package/dist/types/render/width-aware-text.d.ts +2 -0
  108. package/dist/types/setup/scenes/types.d.ts +1 -0
  109. package/dist/types/space-hold.d.ts +40 -25
  110. package/dist/types/status-line/component.d.ts +3 -0
  111. package/dist/types/status-line/context-usage.d.ts +7 -5
  112. package/dist/types/status-line/host.d.ts +4 -1
  113. package/dist/types/status-line/segments.d.ts +2 -0
  114. package/dist/types/status-line/types.d.ts +14 -3
  115. package/dist/types/terminal-capabilities.d.ts +41 -36
  116. package/dist/types/terminal-multiplexer.d.ts +127 -14
  117. package/dist/types/terminal.d.ts +23 -16
  118. package/dist/types/theme/active-symbols.d.ts +1 -1
  119. package/dist/types/theme/schema.d.ts +11 -2
  120. package/dist/types/theme/symbols.d.ts +1 -1
  121. package/dist/types/theme/theme-class.d.ts +7 -0
  122. package/dist/types/theme/theme.d.ts +1 -1
  123. package/dist/types/theme/tui-adapters.d.ts +3 -0
  124. package/dist/types/thinking.d.ts +1 -1
  125. package/dist/types/tmux.d.ts +11 -4
  126. package/dist/types/tools/bash.d.ts +7 -2
  127. package/dist/types/tools/daemon.d.ts +1 -1
  128. package/dist/types/tools/eval.d.ts +22 -3
  129. package/dist/types/tools/glob.d.ts +4 -0
  130. package/dist/types/tools/native-view.d.ts +47 -0
  131. package/dist/types/tools/output-meta.d.ts +11 -1
  132. package/dist/types/tools/renderer.d.ts +37 -2
  133. package/dist/types/tools/streaming-output.d.ts +20 -1
  134. package/dist/types/tools/task.d.ts +2 -3
  135. package/dist/types/tools/write.d.ts +9 -2
  136. package/dist/types/tools/yield.d.ts +22 -0
  137. package/dist/types/tui.d.ts +36 -0
  138. package/dist/types/utils.d.ts +6 -0
  139. package/dist/types/vim.d.ts +19 -5
  140. package/dist/types/windows-input-mode.d.ts +33 -1
  141. package/package.json +13 -9
  142. package/src/active-terminal.d.ts +30 -0
  143. package/src/active-terminal.ts +80 -0
  144. package/src/app-keybindings.d.ts +7 -2
  145. package/src/app-keybindings.ts +7 -2
  146. package/src/apps/autoresearch-dashboard.ts +7 -3
  147. package/src/apps/cleanse-board.ts +2 -2
  148. package/src/apps/cleanse-picker.ts +1 -1
  149. package/src/apps/debug/log-viewer.ts +188 -72
  150. package/src/apps/debug/raw-sse-buffer.ts +8 -0
  151. package/src/apps/debug/raw-sse.ts +39 -5
  152. package/src/apps/git/diff-pane.ts +96 -23
  153. package/src/apps/git/git-tui.ts +23 -16
  154. package/src/apps/git/help.ts +29 -20
  155. package/src/apps/git/sidebar.ts +8 -3
  156. package/src/apps/if-bench-board.ts +2 -2
  157. package/src/apps/ps-top.ts +2 -2
  158. package/src/apps/setup-model-picker.ts +1 -1
  159. package/src/autocomplete.d.ts +5 -2
  160. package/src/autocomplete.ts +67 -43
  161. package/src/bracketed-paste.ts +10 -3
  162. package/src/charts/chart-plan.d.ts +674 -0
  163. package/src/charts/chart-plan.ts +5081 -0
  164. package/src/charts/chart-svg.d.ts +59 -0
  165. package/src/charts/chart-svg.ts +4657 -0
  166. package/src/charts/table-data.d.ts +175 -0
  167. package/src/charts/table-data.ts +1478 -0
  168. package/src/chat/advisor-message.ts +11 -0
  169. package/src/chat/assistant-message.d.ts +11 -1
  170. package/src/chat/assistant-message.ts +245 -54
  171. package/src/chat/chat-transcript-builder.d.ts +3 -0
  172. package/src/chat/chat-transcript-builder.ts +9 -3
  173. package/src/chat/compaction-summary-message.d.ts +1 -0
  174. package/src/chat/compaction-summary-message.ts +8 -0
  175. package/src/chat/execution-shared.d.ts +6 -5
  176. package/src/chat/execution-shared.ts +42 -25
  177. package/src/chat/fence-figure.d.ts +42 -0
  178. package/src/chat/fence-figure.ts +80 -0
  179. package/src/chat/figure-markdown.d.ts +42 -0
  180. package/src/chat/figure-markdown.ts +174 -0
  181. package/src/chat/messages.d.ts +1 -1
  182. package/src/chat/messages.ts +1 -1
  183. package/src/chat/read-tool-group.ts +6 -4
  184. package/src/chat/skill-message.ts +6 -0
  185. package/src/chat/svg-figure.d.ts +33 -0
  186. package/src/chat/svg-figure.ts +399 -0
  187. package/src/chat/svg-source.d.ts +49 -0
  188. package/src/chat/svg-source.ts +188 -0
  189. package/src/chat/table-chart.d.ts +89 -0
  190. package/src/chat/table-chart.ts +294 -0
  191. package/src/chat/tool-execution.d.ts +2 -0
  192. package/src/chat/tool-execution.ts +86 -7
  193. package/src/chat/user-message.d.ts +17 -4
  194. package/src/chat/user-message.ts +71 -8
  195. package/src/chrome/shared.ts +53 -0
  196. package/src/chrome/status-notice.ts +25 -7
  197. package/src/chrome/transcript-container.d.ts +6 -0
  198. package/src/chrome/transcript-container.ts +162 -19
  199. package/src/components/box.d.ts +1 -0
  200. package/src/components/box.ts +5 -0
  201. package/src/components/disclosure.d.ts +1 -0
  202. package/src/components/disclosure.ts +8 -0
  203. package/src/components/editor.d.ts +23 -5
  204. package/src/components/editor.ts +316 -47
  205. package/src/components/form.d.ts +1 -0
  206. package/src/components/form.ts +8 -0
  207. package/src/components/image.d.ts +26 -44
  208. package/src/components/image.ts +115 -152
  209. package/src/components/input.d.ts +2 -1
  210. package/src/components/input.ts +17 -7
  211. package/src/components/key-value-list.d.ts +1 -0
  212. package/src/components/key-value-list.ts +4 -0
  213. package/src/components/layout/row.d.ts +1 -0
  214. package/src/components/layout/row.ts +7 -0
  215. package/src/components/layout/stack.d.ts +1 -0
  216. package/src/components/layout/stack.ts +7 -0
  217. package/src/components/loader.d.ts +5 -6
  218. package/src/components/loader.ts +10 -17
  219. package/src/components/markdown.d.ts +47 -5
  220. package/src/components/markdown.ts +786 -303
  221. package/src/components/scroll-view.d.ts +1 -0
  222. package/src/components/scroll-view.ts +5 -0
  223. package/src/components/section.d.ts +1 -0
  224. package/src/components/section.ts +5 -0
  225. package/src/components/settings-list.ts +2 -0
  226. package/src/components/table.d.ts +1 -0
  227. package/src/components/table.ts +4 -0
  228. package/src/components/text.d.ts +1 -0
  229. package/src/components/text.ts +7 -0
  230. package/src/components/tree-view.d.ts +7 -0
  231. package/src/components/tree-view.ts +38 -8
  232. package/src/components/truncated-text.d.ts +1 -0
  233. package/src/components/truncated-text.ts +5 -0
  234. package/src/desktop-notify.ts +3 -2
  235. package/src/fuzzy.d.ts +29 -1
  236. package/src/fuzzy.ts +115 -30
  237. package/src/hotkeys-markdown.ts +9 -2
  238. package/src/key-hint-format.d.ts +9 -1
  239. package/src/key-hint-format.ts +26 -11
  240. package/src/keybinding-matchers.d.ts +3 -0
  241. package/src/keybinding-matchers.ts +6 -2
  242. package/src/keybindings.d.ts +1 -1
  243. package/src/keybindings.ts +1 -1
  244. package/src/kitty-graphics.d.ts +2 -2
  245. package/src/kitty-graphics.ts +11 -5
  246. package/src/loop-watchdog.d.ts +8 -7
  247. package/src/loop-watchdog.ts +18 -13
  248. package/src/multiplexers/cmux.d.ts +16 -0
  249. package/src/multiplexers/cmux.ts +29 -0
  250. package/src/multiplexers/herdr.d.ts +26 -0
  251. package/src/multiplexers/herdr.ts +64 -0
  252. package/src/multiplexers/notify.d.ts +13 -0
  253. package/src/multiplexers/notify.ts +24 -0
  254. package/src/multiplexers/orca.d.ts +12 -0
  255. package/src/multiplexers/orca.ts +16 -0
  256. package/src/multiplexers/screen.d.ts +9 -0
  257. package/src/multiplexers/screen.ts +15 -0
  258. package/src/multiplexers/tmux.d.ts +29 -0
  259. package/src/multiplexers/tmux.ts +40 -0
  260. package/src/multiplexers/types.d.ts +100 -0
  261. package/src/multiplexers/types.ts +110 -0
  262. package/src/multiplexers/wmux.d.ts +12 -0
  263. package/src/multiplexers/wmux.ts +16 -0
  264. package/src/multiplexers/zellij.d.ts +12 -0
  265. package/src/multiplexers/zellij.ts +24 -0
  266. package/src/native/apply.d.ts +4 -3
  267. package/src/native/apply.ts +4 -3
  268. package/src/native/backend.d.ts +5 -4
  269. package/src/native/backend.ts +199 -22
  270. package/src/native/blobs.d.ts +7 -3
  271. package/src/native/blobs.ts +47 -12
  272. package/src/native/encode.d.ts +8 -6
  273. package/src/native/encode.ts +76 -34
  274. package/src/native/node.d.ts +36 -5
  275. package/src/native/node.ts +31 -5
  276. package/src/native/overlay.d.ts +8 -3
  277. package/src/native/overlay.ts +17 -4
  278. package/src/native/reconcile.ts +16 -4
  279. package/src/native/settle.d.ts +4 -3
  280. package/src/native/settle.ts +4 -3
  281. package/src/overlays/agent-hub-projection.d.ts +6 -5
  282. package/src/overlays/agent-hub-projection.ts +124 -13
  283. package/src/overlays/agent-hub-types.d.ts +9 -0
  284. package/src/overlays/agent-hub-types.ts +6 -0
  285. package/src/overlays/agent-hub.ts +48 -29
  286. package/src/overlays/agent-transcript-viewer.ts +93 -23
  287. package/src/overlays/agents-hub.ts +28 -8
  288. package/src/overlays/annotation-overlay.ts +293 -90
  289. package/src/overlays/annotation-types.ts +2 -0
  290. package/src/overlays/ask-dialog.ts +10 -17
  291. package/src/overlays/btw-history-panel.ts +136 -39
  292. package/src/overlays/copy-selector.d.ts +1 -0
  293. package/src/overlays/copy-selector.ts +32 -8
  294. package/src/overlays/extensions/extension-dashboard.ts +4 -4
  295. package/src/overlays/extensions/state-manager.ts +52 -12
  296. package/src/overlays/history-search.ts +100 -7
  297. package/src/overlays/hook-selector.ts +12 -5
  298. package/src/overlays/hub-frame.ts +19 -1
  299. package/src/overlays/jobs-panel.ts +33 -52
  300. package/src/overlays/model-browser.ts +367 -122
  301. package/src/overlays/model-hub.ts +435 -59
  302. package/src/overlays/move-overlay.ts +28 -14
  303. package/src/overlays/oauth-selector.ts +54 -70
  304. package/src/overlays/pause-screen.ts +2 -2
  305. package/src/overlays/plan-review-overlay.ts +208 -70
  306. package/src/overlays/plugin-settings.ts +3 -3
  307. package/src/overlays/report-panel.ts +191 -0
  308. package/src/overlays/rewind-selector.ts +88 -17
  309. package/src/overlays/session-observer-registry.d.ts +2 -0
  310. package/src/overlays/session-observer-registry.ts +10 -2
  311. package/src/overlays/session-selector.ts +64 -26
  312. package/src/overlays/settings-defs.ts +5 -4
  313. package/src/overlays/settings-selector.ts +33 -8
  314. package/src/overlays/snapcompact-shape-preview.ts +2 -3
  315. package/src/overlays/stats-notice.ts +1 -1
  316. package/src/overlays/thinking-selector.ts +11 -10
  317. package/src/overlays/tree-selector.ts +41 -20
  318. package/src/overlays/usage-dashboard.ts +117 -58
  319. package/src/overlays/usage-display.ts +10 -4
  320. package/src/overlays/usage-row.ts +22 -8
  321. package/src/prompt/attachment-chips.ts +15 -11
  322. package/src/prompt/composer-attachments.ts +6 -4
  323. package/src/prompt/composer-cache.ts +7 -86
  324. package/src/prompt/composer.ts +37 -26
  325. package/src/prompt/custom-editor.ts +282 -105
  326. package/src/prompt/image-source.ts +2 -1
  327. package/src/prompt/interactive-context-helpers.ts +32 -18
  328. package/src/prompt/macos-spelling.ts +7 -0
  329. package/src/prompt/magic-keywords.ts +11 -2
  330. package/src/prompt/model-mention-autocomplete.ts +14 -14
  331. package/src/prompt/queued-messages.ts +6 -4
  332. package/src/prompt/tips.txt +13 -9
  333. package/src/prompt/welcome.ts +64 -46
  334. package/src/prompt/word-completion.ts +38 -5
  335. package/src/render/composite.d.ts +2 -0
  336. package/src/render/composite.ts +64 -0
  337. package/src/render/output-pane.d.ts +1 -0
  338. package/src/render/output-pane.ts +6 -0
  339. package/src/render/render-utils.d.ts +1 -0
  340. package/src/render/render-utils.ts +16 -1
  341. package/src/render/tool-card.d.ts +6 -0
  342. package/src/render/tool-card.ts +15 -0
  343. package/src/render/width-aware-text.d.ts +2 -0
  344. package/src/render/width-aware-text.ts +5 -0
  345. package/src/setup/scenes/model.ts +2 -1
  346. package/src/setup/scenes/types.ts +1 -0
  347. package/src/space-hold.d.ts +40 -25
  348. package/src/space-hold.ts +156 -52
  349. package/src/status-line/component.ts +292 -78
  350. package/src/status-line/context-usage.ts +21 -46
  351. package/src/status-line/host.ts +4 -1
  352. package/src/status-line/segments.ts +40 -22
  353. package/src/status-line/types.ts +15 -3
  354. package/src/terminal-capabilities.d.ts +41 -36
  355. package/src/terminal-capabilities.ts +137 -213
  356. package/src/terminal-multiplexer.d.ts +127 -14
  357. package/src/terminal-multiplexer.ts +112 -33
  358. package/src/terminal.d.ts +23 -16
  359. package/src/terminal.ts +203 -99
  360. package/src/theme/active-symbols.d.ts +1 -1
  361. package/src/theme/active-symbols.ts +1 -1
  362. package/src/theme/schema-validation.ts +1 -0
  363. package/src/theme/schema.d.ts +11 -2
  364. package/src/theme/schema.ts +14 -1
  365. package/src/theme/session-color.ts +1 -7
  366. package/src/theme/symbols.d.ts +1 -1
  367. package/src/theme/symbols.ts +11 -4
  368. package/src/theme/theme-class.d.ts +7 -0
  369. package/src/theme/theme-class.ts +26 -1
  370. package/src/theme/theme-schema.json +5 -1
  371. package/src/theme/theme.d.ts +1 -1
  372. package/src/theme/theme.ts +8 -4
  373. package/src/theme/tui-adapters.d.ts +3 -0
  374. package/src/theme/tui-adapters.ts +68 -0
  375. package/src/thinking.d.ts +1 -1
  376. package/src/thinking.ts +1 -1
  377. package/src/tmux.d.ts +11 -4
  378. package/src/tmux.ts +47 -11
  379. package/src/tools/ast-edit.ts +59 -35
  380. package/src/tools/ast-grep.ts +35 -16
  381. package/src/tools/bash.d.ts +7 -2
  382. package/src/tools/bash.ts +116 -47
  383. package/src/tools/daemon.d.ts +1 -1
  384. package/src/tools/daemon.ts +1 -1
  385. package/src/tools/default-renderer.ts +35 -19
  386. package/src/tools/edit.ts +142 -120
  387. package/src/tools/eval-format/index.ts +28 -2
  388. package/src/tools/eval-format/javascript.ts +7 -5
  389. package/src/tools/eval.d.ts +22 -3
  390. package/src/tools/eval.ts +364 -208
  391. package/src/tools/fetch.ts +5 -6
  392. package/src/tools/glob.d.ts +4 -0
  393. package/src/tools/glob.ts +33 -65
  394. package/src/tools/grep.ts +81 -48
  395. package/src/tools/index.ts +2 -0
  396. package/src/tools/lsp.ts +81 -59
  397. package/src/tools/mcp.ts +111 -68
  398. package/src/tools/native-view.d.ts +47 -0
  399. package/src/tools/native-view.ts +102 -1
  400. package/src/tools/output-meta.d.ts +11 -1
  401. package/src/tools/output-meta.ts +23 -3
  402. package/src/tools/read.ts +7 -5
  403. package/src/tools/renderer.d.ts +37 -2
  404. package/src/tools/renderer.ts +42 -2
  405. package/src/tools/streaming-output.d.ts +20 -1
  406. package/src/tools/streaming-output.ts +154 -50
  407. package/src/tools/task.d.ts +2 -3
  408. package/src/tools/task.ts +115 -62
  409. package/src/tools/todo.ts +119 -30
  410. package/src/tools/wait.ts +34 -24
  411. package/src/tools/web-search.ts +1 -1
  412. package/src/tools/write.d.ts +9 -2
  413. package/src/tools/write.ts +147 -95
  414. package/src/tools/yield.d.ts +22 -0
  415. package/src/tools/yield.ts +225 -0
  416. package/src/tui.d.ts +36 -0
  417. package/src/tui.ts +666 -217
  418. package/src/utils.d.ts +6 -0
  419. package/src/utils.ts +19 -0
  420. package/src/vim.d.ts +19 -5
  421. package/src/vim.ts +333 -18
  422. package/src/windows-input-mode.d.ts +33 -1
  423. package/src/windows-input-mode.ts +212 -6
@@ -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
- import { type NativeNode, type NativeUiEvent } from "../native/node.js";
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
@@ -42,9 +44,19 @@ export declare class UserMessageComponent extends Container implements ReactionT
42
44
  * agent's reaction are chips at the bottom-right, so a reaction landing
43
45
  * later updates the frame in place, even deep in scrollback.
44
46
  */
45
- describe(): NativeNode;
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;
@@ -1,14 +1,26 @@
1
1
  import type { NativeNode } from "../native/node.js";
2
2
  import { Container } from "../tui.js";
3
+ /** How a {@link StatusNotice} shows. */
4
+ export interface StatusNoticeOptions {
5
+ /** Styles the ANSI line; resolved at render so a theme change re-shapes it. */
6
+ styleFn?: (text: string) => string;
7
+ /**
8
+ * Whether a native terminal toasts it (default). False keeps the notice to
9
+ * the ANSI transcript: background chatter such as MCP connection progress,
10
+ * which would otherwise re-toast on every server that connects or fails.
11
+ */
12
+ toast?: boolean;
13
+ }
3
14
  /**
4
15
  * A transient status notice (`showStatus`: "Thinking blocks: hidden", "Copied
5
16
  * to clipboard"). The ANSI render appends a blank row and the dim line to the
6
17
  * transcript; a native terminal shows it as a toast instead, so notices never
7
- * pile up in the history. Updating the text re-shows the toast.
18
+ * pile up in the history. Updating the text re-shows the toast; a notice
19
+ * with `toast: false` describes nothing natively.
8
20
  */
9
21
  export declare class StatusNotice extends Container {
10
22
  #private;
11
- constructor(message: string, styleFn?: (text: string) => string);
12
- setMessage(message: string, styleFn?: (text: string) => string): void;
23
+ constructor(message: string, options?: StatusNoticeOptions);
24
+ setMessage(message: string, options?: StatusNoticeOptions): void;
13
25
  describe(): NativeNode;
14
26
  }
@@ -63,6 +63,12 @@ export interface TranscriptViewportSpan {
63
63
  export declare class TranscriptContainer extends Container {
64
64
  #private;
65
65
  addChild(component: Component): void;
66
+ /**
67
+ * `#entries` mirrors `children`; move both together or the next `#syncEntries`
68
+ * pays a full O(n) rebuild.
69
+ */
70
+ insertChildAt(component: Component, index: number): void;
71
+ /** Removes `component` if {@link canRemoveBlock} allows it; otherwise does nothing. */
66
72
  removeChild(component: Component): void;
67
73
  clear(): void;
68
74
  setToolActivityVisible(visible: boolean): void;
@@ -30,6 +30,7 @@ export declare class Box implements Component {
30
30
  setBgFn(bgFn?: (text: string) => string): void;
31
31
  setBorder(border?: BoxBorder): void;
32
32
  invalidate(): void;
33
+ releaseRenderCaches(): void;
33
34
  /**
34
35
  * A `card` when the box has a border or background: the background token
35
36
  * picks tone/role (user message, tool state, selection), a border colour
@@ -36,6 +36,7 @@ export declare class Disclosure implements Component {
36
36
  setExpanded(expanded: boolean): void;
37
37
  setIgnoreTight(ignore: boolean): this;
38
38
  invalidate(): void;
39
+ releaseRenderCaches(): void;
39
40
  dispose(): void;
40
41
  debugState(): Record<string, unknown>;
41
42
  get debugChildren(): readonly Component[];
@@ -1,5 +1,5 @@
1
1
  import { type AutocompleteProvider } from "../autocomplete.js";
2
- import type { TspEditorDecoration, TspTone } from "@linxiraos/pi-wire";
2
+ import type { TspEditorDecoration, TspText, TspTone } from "@linxiraos/pi-wire";
3
3
  import { type DescribeContext, type NativeChild, type NativeNode, type NativeTextEdit, type NativeUiEvent } from "../native/node.js";
4
4
  import type { SymbolTheme } from "../symbols.js";
5
5
  import { type Component, type Focusable } from "../tui.js";
@@ -106,8 +106,11 @@ export declare class Editor implements Component, Focusable {
106
106
  * dialog's text field; only the prompt composer claims `zeta.editor`).
107
107
  */
108
108
  describeLayout: ((input: NativeNode, cx: DescribeContext) => NativeEditorLayout) | undefined;
109
- /** TSP placeholder for the empty buffer; natively it replaces the rotating ANSI {@link placeholder} hints. */
110
- describePlaceholder: (() => string) | undefined;
109
+ /**
110
+ * TSP placeholder for the empty buffer; natively it replaces the rotating ANSI {@link placeholder} hints.
111
+ * Return a stable value (the same spans array) while it is unchanged: the editor node is reused by identity.
112
+ */
113
+ describePlaceholder: (() => TspText) | undefined;
111
114
  /** Called with the selected text when Visual mode yanks, so hosts can reach the system
112
115
  * clipboard — `packages/tui` deliberately has no clipboard dependency of its own. */
113
116
  onYank?: (text: string) => void;
@@ -138,11 +141,20 @@ export declare class Editor implements Component, Focusable {
138
141
  onLargePaste?: (text: string, lineCount: number, options: PasteOptions) => boolean;
139
142
  onAutocompleteCancel?: () => void;
140
143
  disableSubmit: boolean;
144
+ /** Base editors accept native edits, not atomic sends. Implementations that
145
+ * handle `send` override this readiness check for their submission path. */
146
+ protected get nativeSendable(): boolean;
141
147
  /** Placeholder painted right-aligned on the cursor row while the editor is empty and no
142
148
  * autocomplete is open; hidden when it can't keep {@link PLACEHOLDER_MIN_GAP} cells from the
143
149
  * cursor. The host styles it (ANSI allowed). Re-evaluated on every render, so hosts can derive
144
150
  * it from live state. */
145
151
  placeholder?: () => string | undefined;
152
+ /** Whole-message prediction for the next prompt, painted as ghost text after the cursor while
153
+ * the single-line buffer is a strict prefix of it, the cursor sits at its end, and no
154
+ * autocomplete is open. A shown prediction replaces the {@link placeholder}; Tab or Right inserts
155
+ * the rest without submitting. Must be a single line. Re-evaluated on every render, so hosts can
156
+ * derive it from live state. */
157
+ prediction?: () => string | undefined;
146
158
  constructor(theme: EditorTheme);
147
159
  /** Return bounded editor content, cursor, and transient child state for debug inspection. */
148
160
  debugState(): Record<string, unknown>;
@@ -247,6 +259,8 @@ export declare class Editor implements Component, Focusable {
247
259
  get atoms(): ReadonlyMap<string, string>;
248
260
  /** Monotonic buffer-content revision for render caches. Cursor-only movement does not advance it. */
249
261
  get textRevision(): number;
262
+ /** Monotonic atom-table revision for render caches: advances whenever {@link atoms} is mutated or replaced. */
263
+ get atomsRevision(): number;
250
264
  /** Whether the buffer text equals `value`, without `getText()`'s full join —
251
265
  * O(1) for the hot per-keystroke probes against short single-line values. */
252
266
  textEquals(value: string): boolean;
@@ -282,7 +296,7 @@ export declare class Editor implements Component, Focusable {
282
296
  * Mirrors the transient state the key dispatch tears down before this action so the two
283
297
  * cannot diverge: a pending character jump is cancelled by any other key, and an open
284
298
  * spelling-assist popup is dismissed by anything that is not one of its accept keys (its
285
- * debounced refresh skips assist mode, so a surviving list would hang around forever).
299
+ * refresh skips assist mode, so a surviving list would hang around forever).
286
300
  * While Vim owns the buffer (Normal or Visual) the operation is Vim's `x` — deleting the
287
301
  * selection and returning to Normal in Visual mode, the grapheme under the cursor
288
302
  * otherwise. Only Insert mode and Vim-off editors delete straight through. */
@@ -296,7 +310,7 @@ export declare class Editor implements Component, Focusable {
296
310
  submit(): void;
297
311
  /** Insert text at the current cursor position */
298
312
  insertText(text: string): void;
299
- /** Terminal-side selection edits on the `editor` node (see {@link applyHostEdit}). */
313
+ /** Terminal-side selection edits and undo on the `editor` node (see {@link applyHostEdit}). */
300
314
  handleNativeEvent(event: NativeUiEvent): void;
301
315
  /**
302
316
  * Apply an edit the terminal made over its own selection (TSP `edit`):
@@ -327,6 +341,10 @@ export declare class Editor implements Component, Focusable {
327
341
  * {@link getExpandedText}). Hosts that intercept large pastes through {@link onLargePaste} use
328
342
  * this to re-insert a (possibly transformed) paste without re-triggering the interception hook. */
329
343
  insertPaste(content: string): void;
344
+ /** Whether a character-jump hotkey is waiting for its target character. */
345
+ get isJumpPending(): boolean;
346
+ /** Type literal text through the character-editing pipeline without keybinding dispatch. */
347
+ typeCharacter(text: string): void;
330
348
  /**
331
349
  * Whether an autocomplete popup is on screen. An `@` list narrowed to no match
332
350
  * while its refresh is pending stays open internally but is hidden, so it does
@@ -44,6 +44,7 @@ export declare class FormField implements Component, Focusable, MouseRoutable {
44
44
  /** Label, description, details, preview, the control, error, summary, hint and footer as one column. */
45
45
  describe(_cx: DescribeContext): NativeNode;
46
46
  get focused(): boolean;
47
+ get hasError(): boolean;
47
48
  get debugChildren(): readonly Component[];
48
49
  set focused(value: boolean);
49
50
  setUseTerminalCursor(useTerminalCursor: boolean): void;
@@ -16,7 +16,21 @@ export interface ImageOptions {
16
16
  * repaint replaces the placement instead of stacking a duplicate.
17
17
  */
18
18
  imageKey?: string;
19
+ /**
20
+ * Schedules a repaint once this image's off-thread SIXEL encode lands.
21
+ * Defaults to the budget's repaint; a host without a budget must pass one,
22
+ * or the image's reserved rows stay blank until an unrelated repaint.
23
+ */
24
+ requestRender?: () => void;
19
25
  }
26
+ /**
27
+ * Run `render` for rows bound for native scrollback. Those rows are never
28
+ * repainted, so an image whose off-thread SIXEL encode has not landed encodes
29
+ * synchronously instead of committing its reserved blank rows.
30
+ */
31
+ export declare function renderForScrollback<T>(render: () => T): T;
32
+ /** Widest an {@link Image} rendered at `width` columns draws; callers sizing a raster for it (`SvgFigure`) match it. */
33
+ export declare function imageMaxColumns(width: number): number;
20
34
  /** Default count of inline images kept as live graphics before older ones fall back to text. */
21
35
  export declare const DEFAULT_MAX_INLINE_IMAGES = 8;
22
36
  /**
@@ -52,6 +66,8 @@ export declare class ImageBudget {
52
66
  get cap(): number;
53
67
  get enabled(): boolean;
54
68
  setRequestRender(requestRender: () => void): void;
69
+ /** Ask for a repaint, e.g. once an image's off-thread encode settles. */
70
+ requestRender(): void;
55
71
  setCap(cap: number): void;
56
72
  /**
57
73
  * Stable graphics id for a logical image. A non-empty `key` maps to the same
@@ -59,6 +75,13 @@ export declare class ImageBudget {
59
75
  * gets a fresh id every call.
60
76
  */
61
77
  acquireId(key?: string): number;
78
+ /**
79
+ * Retire the graphic held under `key` as soon as no frame shows it, instead
80
+ * of when the residency sweep reaches it. For an owner that replaced the
81
+ * image for good — a streaming SVG figure's earlier raster — so superseded
82
+ * revisions never push older images (scrollback included) out of the store.
83
+ */
84
+ release(key: string): void;
62
85
  /**
63
86
  * Start an alternate-buffer lifecycle. Call once per `?1049h`, before the
64
87
  * first pass of the fullscreen overlay or resize borrow that owns the buffer.
@@ -126,50 +149,8 @@ export declare class ImageBudget {
126
149
  * the image is purged from the terminal store.
127
150
  */
128
151
  registerPlacementGeometry(imageId: number, widthPx: number, heightPx: number): void;
129
- /**
130
- * Record this frame's native-scrollback commit target (the frame-row count
131
- * that is committed once the frame's writes land). Called once per rendered
132
- * frame — including frames that emit no placements — so an epoch whose rows
133
- * commit while its line is never rewritten is still flagged before the next
134
- * re-emission.
135
- */
136
- observeCommitWatermark(committedTo: number): void;
137
- /**
138
- * End the physical-row coordinate epoch after observing its final commit
139
- * watermark. Placement ids and latched archive state survive, but attachment
140
- * rows do not: the next placement emit records them in the new-width frame.
141
- */
142
- beginPlacementCoordinateEpoch(): void;
143
- /**
144
- * Resolve the placement id and geometry for a direct-placement emit whose
145
- * topmost attached cell sits at `attachTopFrameRow` — the first frame row
146
- * the placement covers, i.e. the block's first *visible* row, not its
147
- * origin (-1 when the writer has no frame-space position: alt-screen,
148
- * resize, ConPTY-truncated replays). `committedTo` is this frame's commit
149
- * target in the same frame-row space (-1 when unknown).
150
- *
151
- * Invariant: a placement id may be re-used (Kitty replace strips that id's
152
- * cells everywhere, scrollback included) only while none of the cells it
153
- * attached have entered native scrollback. The epoch — the `p=` id —
154
- * advances exactly when the archived flag says otherwise; rewrites with no
155
- * commit progression keep replacing the same id in place.
156
- */
157
- resolvePlacementEmit(imageId: number, attachTopFrameRow: number, committedTo: number): {
158
- placementId: number;
159
- widthPx: number;
160
- heightPx: number;
161
- } | null;
162
- /**
163
- * Restart every placement epoch after a destructive history clear (`CSI 3 J`
164
- * full paint). The clear destroys all placement cells — scrollback rows are
165
- * gone and the replay rewrites the viewport — so no archive remains to
166
- * protect. Reverting to epoch 1 lets the replay recreate every visible
167
- * placement after the terminal-wide cleanup.
168
- */
169
- resetPlacementEpochs(): ReadonlyArray<{
170
- imageId: number;
171
- lastEpoch: number;
172
- }>;
152
+ /** Source dimensions used by the frame writer to clip a direct placement. */
153
+ getPlacementGeometry(imageId: number): ImageDimensions | undefined;
173
154
  /**
174
155
  * Queue a one-time transmit for `imageId` on the surface the in-flight pass
175
156
  * paints. No-op if that surface already holds the data, so a repeated call
@@ -204,6 +185,7 @@ export declare class Image implements Component {
204
185
  /** Return source metadata without exposing the encoded image buffer. */
205
186
  debugState(): Record<string, unknown>;
206
187
  invalidate(): void;
188
+ releaseRenderCaches(): void;
207
189
  /**
208
190
  * A native `image` backed by a content-addressed blob; the terminal fits
209
191
  * it. Cell caps become `ch`/`lines` bounds. The inline-image budget and
@@ -28,6 +28,7 @@ export declare class Input implements Component, Focusable {
28
28
  setValue(value: string): void;
29
29
  setUseTerminalCursor(useTerminalCursor: boolean): void;
30
30
  getUseTerminalCursor(): boolean;
31
+ capturesInput(data: string): boolean;
31
32
  /**
32
33
  * Apply one key: the editor's text bindings (motion, deletion, kill ring,
33
34
  * undo), pastes and printable text. Returns whether the key was the
@@ -39,7 +40,7 @@ export declare class Input implements Component, Focusable {
39
40
  /** Apply terminal paste semantics to text from non-bracketed paste transports
40
41
  * (e.g. kitty's OSC 5522 enhanced clipboard read). Mirrors `Editor.pasteText`. */
41
42
  pasteText(text: string): void;
42
- /** Terminal-side selection edits on the `input` node (see {@link applyHostEdit}). */
43
+ /** Terminal-side selection edits and undo on the `input` node (see {@link applyHostEdit}). */
43
44
  handleNativeEvent(event: NativeUiEvent): void;
44
45
  /**
45
46
  * Apply an edit the terminal made over its own selection (TSP `edit`):
@@ -21,6 +21,7 @@ export declare class KeyValueList implements Component {
21
21
  constructor(rows: readonly KeyValueRow[], options: KeyValueListOptions);
22
22
  setRows(rows: readonly KeyValueRow[]): boolean;
23
23
  invalidate(): void;
24
+ releaseRenderCaches(): void;
24
25
  /** An aligned `kv` grid; label width and value wrapping are the terminal's. */
25
26
  describe(_cx: DescribeContext): NativeNode;
26
27
  render(width: number): readonly string[];
@@ -48,6 +48,7 @@ export declare class Row implements Component, MouseRoutable {
48
48
  setDecorations(prefix: LayoutDecoration | undefined, gap: LayoutDecoration | undefined, suffix: LayoutDecoration | undefined): void;
49
49
  setIgnoreTight(ignore: boolean): this;
50
50
  invalidate(): void;
51
+ releaseRenderCaches(): void;
51
52
  dispose(): void;
52
53
  /**
53
54
  * A flex `row`: each child sits in a slot carrying its width bounds
@@ -43,6 +43,7 @@ export declare class Stack implements Component, MouseRoutable {
43
43
  setHeight(height: number | undefined): void;
44
44
  setIgnoreTight(ignore: boolean): this;
45
45
  invalidate(): void;
46
+ releaseRenderCaches(): void;
46
47
  dispose(): void;
47
48
  /**
48
49
  * A `col` of slots carrying each child's height bounds (fixed → min = max
@@ -1,3 +1,4 @@
1
+ import type { KeyId } from "../keys.js";
1
2
  import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node.js";
2
3
  import { type ShimmerPalette } from "../theme/shimmer.js";
3
4
  import type { TUI } from "../tui.js";
@@ -23,16 +24,14 @@ export interface WorkingRowSpec {
23
24
  readonly variant?: WorkingRowVariant;
24
25
  /** Shimmer palette of the label (a session-accented intent). */
25
26
  readonly palette?: ShimmerPalette;
26
- /** Live tok/s, docked before the stop control. */
27
- readonly rate?: number;
28
27
  /** Key id that interrupts (`escape`); undefined hides the stop control (Esc would not cancel). */
29
- readonly interruptKey?: string;
28
+ readonly interruptKey?: KeyId;
30
29
  }
31
30
  /**
32
31
  * The dock's working row: `starburst` spinner (or a retry countdown ring),
33
- * the intent shimmering, `·`, the elapsed time, a grow spacer, then the stop
34
- * control whose click sends `interrupt`. Compaction adds an indeterminate
35
- * `progress` before the stop control; a retry says "Cancel".
32
+ * the elapsed time, the `·` divider, the intent shimmering, a grow spacer,
33
+ * then the stop control whose click sends `interrupt`. Compaction adds an
34
+ * indeterminate `progress` before the stop control; a retry says "Cancel".
36
35
  */
37
36
  export declare function describeWorkingRow(spec: WorkingRowSpec, cx: DescribeContext, now?: number): NativeNode;
38
37
  type ColorFn = (str: string) => string;
@@ -1,11 +1,27 @@
1
+ import { type TokensList } from "@linxiraos/pi-utils/marked";
1
2
  import type { DescribeContext, NativeNode } from "../native/node.js";
2
3
  import type { SymbolTheme } from "../symbols.js";
3
4
  import type { Component } from "../tui.js";
4
- /** @internal exported for tests — the grown-line-start block-kind gate. */
5
+ /** @internal exported for tests — the grown-line block-kind gate. */
5
6
  export declare function fastLineStartHazard(grownLine: string): boolean;
7
+ /**
8
+ * Lex a whole document with the renderer's rules (math, custom rules,
9
+ * strikethrough). Callers that split a document along its blocks (table
10
+ * charts) lex through this so they see the blocks Markdown renders.
11
+ */
12
+ export declare function lexDocument(text: string): TokensList;
13
+ /**
14
+ * `source` as a fenced code block in `lang`: the fence is one backtick longer
15
+ * than any backtick run in the source (at least three), so the block always
16
+ * closes where intended. `open` leaves it unclosed, the source verbatim, for
17
+ * a body that is still arriving.
18
+ */
19
+ export declare function fencedCode(lang: string, source: string, options?: {
20
+ open?: boolean;
21
+ }): string;
6
22
  /** A hyperlink as the renderer sees it: inline `[text](href)`, `<autolink>`, bare GFM URL, or reference link. */
7
23
  export interface MarkdownLink {
8
- /** Visible link text (equals `href` for autolinks and bare URLs). */
24
+ /** Flattened visible label with whitespace collapsed to one row; falls back to `href` when empty. */
9
25
  text: string;
10
26
  /** Destination exactly as marked resolved it (references resolved, no normalization). */
11
27
  href: string;
@@ -17,6 +33,17 @@ export interface MarkdownLink {
17
33
  * Duplicate hrefs are kept; callers decide how to fold them.
18
34
  */
19
35
  export declare function extractMarkdownLinks(text: string): MarkdownLink[];
36
+ /**
37
+ * Rewrite the destinations of inline links and link reference definitions in
38
+ * `text` to `resolve(href)`, leaving everything else byte-for-byte intact.
39
+ * Hosts that render the Markdown source themselves (a native terminal's `md`
40
+ * node) resolve relative destinations against their own idea of the working
41
+ * directory; handing them the session-resolved target keeps links pointing at
42
+ * what the author meant. Links inside code, images, autolinks and reference
43
+ * uses (`[x][ref]`, rewritten through their definition) are untouched; a link
44
+ * whose source cannot be located exactly is left as written.
45
+ */
46
+ export declare function rewriteMarkdownLinkDestinations(text: string, resolve: (href: string) => string | undefined): string;
20
47
  /** Drop all L2 cache entries. Call on theme change to prevent stale styled output. */
21
48
  export declare function clearRenderCache(): void;
22
49
  /**
@@ -26,6 +53,13 @@ export declare function clearRenderCache(): void;
26
53
  export interface DefaultTextStyle {
27
54
  /** Foreground color function */
28
55
  color?: (text: string) => string;
56
+ /**
57
+ * The `color` foreground is prose-level: semantically-themed markdown spans
58
+ * (headings, links) keep their own `md*` theme colors instead of being
59
+ * painted over by it, while plain text runs still use `color`. Unset keeps
60
+ * the historical behavior where `color` paints every run.
61
+ */
62
+ proseFg?: boolean;
29
63
  /** Background color function */
30
64
  bgColor?: (text: string) => string;
31
65
  /** Bold text */
@@ -82,7 +116,12 @@ export interface MarkdownTheme {
82
116
  * Return null to fall back to fenced code rendering.
83
117
  */
84
118
  resolveMermaidAscii?: (source: string, maxWidth?: number) => string | null;
85
- symbols: SymbolTheme;
119
+ /**
120
+ * Glyphs for quote borders, rules, tables and color swatches. Optional so themes
121
+ * built to the upstream pi-tui `MarkdownTheme` shape (which has no `symbols`)
122
+ * still render; omitted symbols fall back to the active theme's set.
123
+ */
124
+ symbols?: SymbolTheme;
86
125
  }
87
126
  export declare class Markdown implements Component {
88
127
  #private;
@@ -92,6 +131,7 @@ export declare class Markdown implements Component {
92
131
  debugState(): Record<string, unknown>;
93
132
  setText(text: string): boolean;
94
133
  invalidate(): void;
134
+ releaseRenderCaches(): void;
95
135
  /**
96
136
  * The unrendered source as an `md` node, `stream` while the streaming
97
137
  * (transient) cache is on. Append-only growth yields a fresh node of the
@@ -101,8 +141,10 @@ export declare class Markdown implements Component {
101
141
  describe(_cx: DescribeContext): NativeNode;
102
142
  /**
103
143
  * Width-independent source prefix of the last render ending at a frozen
104
- * Markdown block boundary. Only meaningful while streaming (transient
105
- * render cache on); grows monotonically under append-only `setText`.
144
+ * Markdown block boundary that no append can move: it stops in front of a
145
+ * display-math opener whose block an append could still close. Only
146
+ * meaningful while streaming (transient render cache on); grows
147
+ * monotonically under append-only `setText`.
106
148
  */
107
149
  getLastRenderStableText(): string;
108
150
  get transientRenderCache(): boolean;
@@ -92,6 +92,7 @@ export declare class ScrollView implements Component {
92
92
  /** Apply Arrow, Shift+Arrow, Page, Home, and End navigation keys. */
93
93
  handleScrollKey(data: string): boolean;
94
94
  invalidate(): void;
95
+ releaseRenderCaches(): void;
95
96
  /** Permanently release a wrapped child's timers, subscriptions, and other resources. */
96
97
  dispose(): void;
97
98
  /**
@@ -15,6 +15,7 @@ export declare class Section implements Component {
15
15
  #private;
16
16
  constructor(options: SectionOptions);
17
17
  invalidate(): void;
18
+ releaseRenderCaches(): void;
18
19
  dispose(): void;
19
20
  /** A `section` headed by the styled title; the rule is the terminal's. */
20
21
  describe(_cx: DescribeContext): NativeNode;
@@ -29,6 +29,7 @@ export declare class Table implements Component {
29
29
  constructor(rows: readonly (readonly TableCell[])[], columns: readonly TableColumn[], options?: TableOptions);
30
30
  setRows(rows: readonly (readonly TableCell[])[]): boolean;
31
31
  invalidate(): void;
32
+ releaseRenderCaches(): void;
32
33
  /**
33
34
  * A native `table`. Column priorities carry over unchanged (lower gives
34
35
  * way first); truncating columns truncate at the end, the rest keep
@@ -26,6 +26,7 @@ export declare class Text implements Component {
26
26
  */
27
27
  setStyleFn(styleFn?: (text: string) => string): this;
28
28
  invalidate(): void;
29
+ releaseRenderCaches(): void;
29
30
  /**
30
31
  * Wrapped text; styling re-derived from the styled source so a theme swap
31
32
  * re-resolves tokens. A background fill becomes the node's tone.
@@ -34,6 +34,13 @@ export interface FlattenTreeOptions<T, K extends TreeKey> {
34
34
  rootDepth?: number;
35
35
  /** Override the display depth inherited by direct children. */
36
36
  getChildDepth?: (item: T, row: TreeRow<T, K>, children: readonly T[]) => number;
37
+ /**
38
+ * Reuse the parent ancestor list when a child keeps the same display depth
39
+ * and the current item has no siblings (`siblingCount === 1`). Otherwise
40
+ * retain the current item as an ancestor so connector gutters remain
41
+ * accurate, including when the item has multiple children.
42
+ */
43
+ compactSameDepthAncestors?: boolean;
37
44
  /** Stop projection after this many structural items. Omit for no traversal cap. */
38
45
  maxItems?: number;
39
46
  }
@@ -9,6 +9,7 @@ export declare class TruncatedText implements Component {
9
9
  /** Return bounded source text and the last-known truncation state. */
10
10
  debugState(): Record<string, unknown>;
11
11
  invalidate(): void;
12
+ releaseRenderCaches(): void;
12
13
  /** First line only, clamped to one visual line with an end ellipsis. */
13
14
  describe(_cx: DescribeContext): NativeNode;
14
15
  render(width: number): readonly string[];
@@ -16,6 +16,20 @@ export interface FuzzyFilterResult<T> {
16
16
  score: number;
17
17
  }
18
18
  export declare function fuzzyMatch(query: string, text: string): FuzzyMatch;
19
+ /**
20
+ * A query normalized and tokenized once for matching against many texts.
21
+ *
22
+ * `fuzzyMatch(query, text)` re-normalizes `query` (and rebuilds its
23
+ * alphanumeric-swap variants) on every call; filters that test one query
24
+ * against every row should build one `FuzzyQuery` per keystroke instead.
25
+ * `query.match(text)` returns exactly what `fuzzyMatch(query, text)` returns.
26
+ */
27
+ export declare class FuzzyQuery {
28
+ #private;
29
+ constructor(query: string);
30
+ /** Same result as `fuzzyMatch(query, text)`; `text` may be a prepared {@link FuzzyText}. */
31
+ match(text: string | FuzzyText): FuzzyMatch;
32
+ }
19
33
  /**
20
34
  * A text prepared once for repeated fuzzy matching.
21
35
  *
@@ -30,7 +44,21 @@ export declare class FuzzyText {
30
44
  #private;
31
45
  constructor(text: string);
32
46
  /** Match `query` (space-separated tokens; all must match) against the prepared text. */
33
- match(query: string): FuzzyMatch;
47
+ match(query: string | FuzzyQuery): FuzzyMatch;
48
+ }
49
+ /**
50
+ * Items prepared once for repeated {@link fuzzyRank}-equivalent ranking.
51
+ *
52
+ * `fuzzyRank` resolves each candidate's search index through the bounded module
53
+ * cache, which holds at most {@link INDEX_CACHE_MAX} entries; larger candidate
54
+ * lists (the full model catalog) rebuild the overflow on every query. Hold one
55
+ * corpus per stable candidate list and call {@link rank} per keystroke instead.
56
+ */
57
+ export declare class FuzzyCorpus<T> {
58
+ #private;
59
+ constructor(items: readonly T[], getText: (item: T) => string);
60
+ /** Same results as `fuzzyRank(items, query, getText)` for the prepared items. */
61
+ rank(query: string): FuzzyFilterResult<T>[];
34
62
  }
35
63
  /**
36
64
  * Filter and sort items by fuzzy match quality (best matches first).
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Key-hint formatting, kept free of the native addon: it imports only types
3
- * plus the theme symbol mirror, so addon-free CLI paths (`omp --version`,
3
+ * plus the theme symbol mirror, so addon-free CLI paths (`zetacode --version`,
4
4
  * help text in cli/command-help.ts) can format keys without loading
5
5
  * `@linxiraos/pi-natives` through the keybindings registry.
6
6
  */
@@ -23,6 +23,14 @@ export type KeyName = KeyId | ModifierName;
23
23
  * is capitalized. Other keys are capitalized (`f5` → `F5`).
24
24
  */
25
25
  export declare function formatKeyHint(key: KeyName): string;
26
+ /**
27
+ * Format one key for a native tooltip (a TSP `title`): unicode keycap glyphs
28
+ * whatever the theme's symbol preset (`shift+tab` → `⇧⇥`), which Tern's
29
+ * tooltip splits into keycaps, and `esc` as Tern's own keycaps read. The nerd
30
+ * preset's icons are missing from Tern's UI font, and its spaced chords would
31
+ * not parse as keys.
32
+ */
33
+ export declare function formatTooltipKey(key: KeyName): string;
26
34
  /** Format alternative keys as a slash-separated hint (`["f5", "alt+r"]` → `F5/⌥R`). */
27
35
  export declare function formatKeyHints(keys: KeyName | readonly KeyName[]): string;
28
36
  /** Format a double-tap gesture: `←←` with glyphs, `Left Left` with words. */
@@ -1,3 +1,4 @@
1
+ import type { KeyId } from "./app-keybindings.js";
1
2
  /**
2
3
  * Match the coding-agent interrupt key.
3
4
  *
@@ -18,6 +19,8 @@ export declare function matchesSelectDown(data: string): boolean;
18
19
  export declare function matchesSelectPageUp(data: string): boolean;
19
20
  /** Match the generic selector page-down keybinding. */
20
21
  export declare function matchesSelectPageDown(data: string): boolean;
22
+ /** Effective external-editor key: the first bound key, or Ctrl+G when unbound. */
23
+ export declare function appExternalEditorKey(): KeyId;
21
24
  /** Match the external-editor keybinding, falling back to Ctrl+G when unbound. */
22
25
  export declare function matchesAppExternalEditor(data: string): boolean;
23
26
  /**