@linxiraos/pi-tui 1.4.6 → 1.4.9

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 (399) hide show
  1. package/CHANGELOG.md +162 -244
  2. package/README.md +41 -35
  3. package/dist/types/app-keybindings.d.ts +20 -0
  4. package/dist/types/apps/session-picker.d.ts +5 -0
  5. package/dist/types/charts/chart-plan.d.ts +9 -7
  6. package/dist/types/charts/table-data.d.ts +4 -2
  7. package/dist/types/chat/assistant-message.d.ts +15 -3
  8. package/dist/types/chat/bash-execution.d.ts +6 -1
  9. package/dist/types/chat/display-preferences.d.ts +2 -0
  10. package/dist/types/chat/eval-execution.d.ts +2 -0
  11. package/dist/types/chat/execution-shared.d.ts +14 -8
  12. package/dist/types/chat/extension-types.d.ts +31 -0
  13. package/dist/types/chat/figure-markdown.d.ts +2 -0
  14. package/dist/types/chat/reply-write.d.ts +48 -0
  15. package/dist/types/chat/svg-figure.d.ts +5 -0
  16. package/dist/types/chat/table-chart.d.ts +6 -3
  17. package/dist/types/chat/tool-execution.d.ts +1 -2
  18. package/dist/types/chat/transcript-outline.d.ts +7 -0
  19. package/dist/types/chat/transcript-render-helpers.d.ts +13 -3
  20. package/dist/types/chrome/dynamic-border.d.ts +6 -0
  21. package/dist/types/chrome/index.d.ts +1 -0
  22. package/dist/types/chrome/transcript-notice.d.ts +35 -0
  23. package/dist/types/chrome/transcript-status.d.ts +21 -9
  24. package/dist/types/components/editor.d.ts +23 -6
  25. package/dist/types/components/image.d.ts +6 -0
  26. package/dist/types/components/loader.d.ts +2 -0
  27. package/dist/types/components/markdown.d.ts +7 -0
  28. package/dist/types/keybinding-matchers.d.ts +7 -0
  29. package/dist/types/native/blobs.d.ts +2 -1
  30. package/dist/types/native/describe.d.ts +4 -2
  31. package/dist/types/native/node.d.ts +2 -3
  32. package/dist/types/native/overlay.d.ts +42 -2
  33. package/dist/types/native/picker.d.ts +4 -4
  34. package/dist/types/native/state.d.ts +4 -0
  35. package/dist/types/overlays/annotation-overlay.d.ts +7 -1
  36. package/dist/types/overlays/annotation-types.d.ts +28 -0
  37. package/dist/types/overlays/btw-history-panel.d.ts +15 -0
  38. package/dist/types/overlays/btw-history.d.ts +24 -0
  39. package/dist/types/overlays/btw-inject.d.ts +22 -0
  40. package/dist/types/overlays/btw-panel.d.ts +7 -0
  41. package/dist/types/overlays/hook-editor.d.ts +2 -0
  42. package/dist/types/overlays/jobs-panel.d.ts +4 -0
  43. package/dist/types/overlays/login-dialog.d.ts +5 -1
  44. package/dist/types/overlays/model-browser.d.ts +11 -2
  45. package/dist/types/overlays/oauth-selector.d.ts +23 -0
  46. package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
  47. package/dist/types/overlays/rewind-selector.d.ts +1 -1
  48. package/dist/types/overlays/session-selector.d.ts +33 -4
  49. package/dist/types/prompt/composer.d.ts +56 -5
  50. package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
  51. package/dist/types/render/extension-links.d.ts +65 -0
  52. package/dist/types/render/hyperlink.d.ts +25 -7
  53. package/dist/types/render/index.d.ts +1 -0
  54. package/dist/types/render/render-utils.d.ts +23 -1
  55. package/dist/types/setup/scenes/glyph.d.ts +1 -1
  56. package/dist/types/setup/scenes/model.d.ts +1 -1
  57. package/dist/types/setup/scenes/outro.d.ts +5 -4
  58. package/dist/types/setup/scenes/sign-in.d.ts +13 -8
  59. package/dist/types/setup/scenes/types.d.ts +16 -1
  60. package/dist/types/setup/startup-splash.d.ts +1 -1
  61. package/dist/types/setup/wizard-overlay.d.ts +11 -7
  62. package/dist/types/setup/wizard.d.ts +5 -1
  63. package/dist/types/status-line/component.d.ts +1 -1
  64. package/dist/types/status-line/context-usage.d.ts +28 -6
  65. package/dist/types/status-line/host.d.ts +6 -2
  66. package/dist/types/status-line/startup.d.ts +0 -15
  67. package/dist/types/terminal-capabilities.d.ts +1 -1
  68. package/dist/types/theme/symbols.d.ts +3 -1
  69. package/dist/types/theme/theme-class.d.ts +1 -0
  70. package/dist/types/theme/theme.d.ts +1 -24
  71. package/dist/types/theme/tui-adapters.d.ts +2 -0
  72. package/dist/types/thinking.d.ts +8 -6
  73. package/dist/types/tools/ast-grep.d.ts +2 -0
  74. package/dist/types/tools/bash-interactive.d.ts +6 -0
  75. package/dist/types/tools/bash.d.ts +2 -0
  76. package/dist/types/tools/default-renderer.d.ts +6 -4
  77. package/dist/types/tools/eval.d.ts +2 -0
  78. package/dist/types/tools/find.d.ts +1 -1
  79. package/dist/types/tools/grouped-file-output.d.ts +100 -19
  80. package/dist/types/tools/hashline-format.d.ts +5 -0
  81. package/dist/types/tools/irc.d.ts +6 -0
  82. package/dist/types/tools/json-tree.d.ts +23 -4
  83. package/dist/types/tools/lsp.d.ts +2 -0
  84. package/dist/types/tools/mcp.d.ts +6 -5
  85. package/dist/types/tools/native-view.d.ts +3 -1
  86. package/dist/types/tools/output-meta.d.ts +27 -0
  87. package/dist/types/tools/read.d.ts +14 -4
  88. package/dist/types/tools/renderer.d.ts +2 -0
  89. package/dist/types/tools/streaming-output.d.ts +11 -0
  90. package/dist/types/tools/task.d.ts +13 -4
  91. package/dist/types/tools/url-scheme-host.d.ts +17 -0
  92. package/dist/types/tools/wait.d.ts +2 -0
  93. package/dist/types/tools/yield.d.ts +1 -1
  94. package/dist/types/tui.d.ts +19 -2
  95. package/dist/types/utils.d.ts +4 -0
  96. package/package.json +10 -14
  97. package/src/app-keybindings.d.ts +20 -0
  98. package/src/app-keybindings.ts +20 -0
  99. package/src/apps/git/git-tui.ts +10 -17
  100. package/src/apps/git/sidebar.ts +21 -35
  101. package/src/apps/ps-top.ts +4 -12
  102. package/src/apps/session-picker.ts +7 -0
  103. package/src/charts/chart-plan.d.ts +9 -7
  104. package/src/charts/chart-plan.ts +20 -79
  105. package/src/charts/table-data.d.ts +4 -2
  106. package/src/charts/table-data.ts +55 -6
  107. package/src/chat/advisor-message.ts +2 -0
  108. package/src/chat/assistant-message.d.ts +15 -3
  109. package/src/chat/assistant-message.ts +137 -19
  110. package/src/chat/background-tan-message.ts +4 -0
  111. package/src/chat/bash-execution.d.ts +6 -1
  112. package/src/chat/bash-execution.ts +26 -9
  113. package/src/chat/chat-transcript-builder.ts +63 -30
  114. package/src/chat/compaction-summary-message.ts +2 -1
  115. package/src/chat/display-preferences.d.ts +2 -0
  116. package/src/chat/display-preferences.ts +3 -0
  117. package/src/chat/eval-execution.d.ts +2 -0
  118. package/src/chat/eval-execution.ts +14 -7
  119. package/src/chat/execution-shared.d.ts +14 -8
  120. package/src/chat/execution-shared.ts +39 -18
  121. package/src/chat/extension-types.d.ts +31 -0
  122. package/src/chat/extension-types.ts +34 -0
  123. package/src/chat/figure-markdown.d.ts +2 -0
  124. package/src/chat/figure-markdown.ts +6 -4
  125. package/src/chat/read-tool-group.ts +56 -36
  126. package/src/chat/reply-write.d.ts +48 -0
  127. package/src/chat/reply-write.ts +127 -0
  128. package/src/chat/svg-figure.d.ts +5 -0
  129. package/src/chat/svg-figure.ts +55 -16
  130. package/src/chat/table-chart.d.ts +6 -3
  131. package/src/chat/table-chart.ts +29 -6
  132. package/src/chat/tool-execution.d.ts +1 -2
  133. package/src/chat/tool-execution.ts +20 -13
  134. package/src/chat/transcript-outline.d.ts +7 -0
  135. package/src/chat/transcript-outline.ts +27 -0
  136. package/src/chat/transcript-render-helpers.d.ts +13 -3
  137. package/src/chat/transcript-render-helpers.ts +134 -44
  138. package/src/chrome/dynamic-border.d.ts +6 -0
  139. package/src/chrome/dynamic-border.ts +28 -2
  140. package/src/chrome/index.ts +1 -0
  141. package/src/chrome/transcript-notice.d.ts +35 -0
  142. package/src/chrome/transcript-notice.ts +83 -0
  143. package/src/chrome/transcript-status.d.ts +21 -9
  144. package/src/chrome/transcript-status.ts +32 -30
  145. package/src/components/editor.d.ts +23 -6
  146. package/src/components/editor.ts +133 -25
  147. package/src/components/image.d.ts +6 -0
  148. package/src/components/image.ts +13 -0
  149. package/src/components/key-value-list.ts +9 -9
  150. package/src/components/loader.d.ts +2 -0
  151. package/src/components/loader.ts +7 -0
  152. package/src/components/markdown.d.ts +7 -0
  153. package/src/components/markdown.ts +116 -6
  154. package/src/components/section.ts +1 -9
  155. package/src/components/table.ts +1 -9
  156. package/src/hotkeys-markdown.ts +1 -0
  157. package/src/keybinding-matchers.d.ts +7 -0
  158. package/src/keybinding-matchers.ts +13 -0
  159. package/src/native/backend.ts +10 -67
  160. package/src/native/blobs.d.ts +2 -1
  161. package/src/native/blobs.ts +3 -2
  162. package/src/native/describe.d.ts +4 -2
  163. package/src/native/describe.ts +9 -4
  164. package/src/native/node.d.ts +2 -3
  165. package/src/native/node.ts +2 -3
  166. package/src/native/overlay.d.ts +42 -2
  167. package/src/native/overlay.ts +124 -16
  168. package/src/native/picker.d.ts +4 -4
  169. package/src/native/picker.ts +4 -4
  170. package/src/native/state.d.ts +4 -0
  171. package/src/native/state.ts +25 -5
  172. package/src/overlays/advisor-config.ts +1 -10
  173. package/src/overlays/annotation-overlay.ts +125 -37
  174. package/src/overlays/annotation-types.ts +24 -0
  175. package/src/overlays/btw-history-panel.ts +106 -14
  176. package/src/overlays/btw-history.ts +65 -0
  177. package/src/overlays/btw-inject.ts +91 -0
  178. package/src/overlays/btw-panel.ts +53 -12
  179. package/src/overlays/extensions/extension-dashboard.ts +7 -8
  180. package/src/overlays/hook-editor.ts +6 -0
  181. package/src/overlays/hook-selector.ts +2 -2
  182. package/src/overlays/jobs-panel.ts +82 -22
  183. package/src/overlays/login-dialog.ts +39 -31
  184. package/src/overlays/mcp-add-wizard.ts +1 -1
  185. package/src/overlays/model-browser.ts +106 -10
  186. package/src/overlays/model-hub.ts +1 -7
  187. package/src/overlays/model-picker.ts +1 -10
  188. package/src/overlays/oauth-selector.ts +44 -6
  189. package/src/overlays/plan-review-overlay.ts +13 -2
  190. package/src/overlays/rewind-selector.ts +29 -12
  191. package/src/overlays/session-selector.ts +338 -47
  192. package/src/overlays/settings-defs.ts +2 -2
  193. package/src/overlays/tree-selector.ts +83 -27
  194. package/src/overlays/usage-dashboard.ts +9 -18
  195. package/src/prompt/composer.ts +233 -6
  196. package/src/prompt/custom-editor.ts +6 -1
  197. package/src/prompt/emoji-autocomplete.ts +0 -2
  198. package/src/prompt/interactive-context-helpers.ts +29 -4
  199. package/src/render/code-cell.ts +1 -1
  200. package/src/render/extension-links.d.ts +65 -0
  201. package/src/render/extension-links.ts +214 -0
  202. package/src/render/file-list.ts +4 -7
  203. package/src/render/hyperlink.d.ts +25 -7
  204. package/src/render/hyperlink.ts +65 -9
  205. package/src/render/index.d.ts +1 -0
  206. package/src/render/index.ts +1 -0
  207. package/src/render/render-utils.d.ts +23 -1
  208. package/src/render/render-utils.ts +38 -6
  209. package/src/setup/scenes/composer.ts +2 -0
  210. package/src/setup/scenes/glyph.ts +4 -2
  211. package/src/setup/scenes/model.ts +192 -29
  212. package/src/setup/scenes/outro.ts +33 -15
  213. package/src/setup/scenes/sign-in.ts +196 -400
  214. package/src/setup/scenes/theme.ts +2 -0
  215. package/src/setup/scenes/types.ts +18 -1
  216. package/src/setup/startup-splash.ts +8 -7
  217. package/src/setup/wizard-overlay.ts +164 -35
  218. package/src/setup/wizard.ts +11 -2
  219. package/src/status-line/component.ts +4 -10
  220. package/src/status-line/context-usage.ts +72 -21
  221. package/src/status-line/host.ts +6 -2
  222. package/src/status-line/startup.ts +36 -70
  223. package/src/terminal-capabilities.d.ts +1 -1
  224. package/src/terminal-capabilities.ts +5 -0
  225. package/src/terminal.ts +24 -2
  226. package/src/theme/defaults.json +1 -0
  227. package/src/theme/loader.ts +1 -1
  228. package/src/theme/symbols.d.ts +3 -1
  229. package/src/theme/symbols.ts +16 -9
  230. package/src/theme/theme-class.d.ts +1 -0
  231. package/src/theme/theme-class.ts +15 -3
  232. package/src/theme/theme.d.ts +1 -24
  233. package/src/theme/theme.ts +3 -75
  234. package/src/theme/tui-adapters.d.ts +2 -0
  235. package/src/theme/tui-adapters.ts +8 -3
  236. package/src/thinking.d.ts +8 -6
  237. package/src/thinking.ts +17 -11
  238. package/src/tmux.ts +1 -0
  239. package/src/tools/agent-tree.ts +13 -11
  240. package/src/tools/ask.ts +24 -37
  241. package/src/tools/ast-edit.ts +48 -93
  242. package/src/tools/ast-grep.d.ts +2 -0
  243. package/src/tools/ast-grep.ts +31 -67
  244. package/src/tools/bash-interactive.d.ts +49 -0
  245. package/src/tools/bash-interactive.ts +6 -1
  246. package/src/tools/bash.d.ts +2 -0
  247. package/src/tools/bash.ts +9 -0
  248. package/src/tools/default-renderer.d.ts +6 -4
  249. package/src/tools/default-renderer.ts +10 -7
  250. package/src/tools/edit.ts +50 -43
  251. package/src/tools/eval.d.ts +2 -0
  252. package/src/tools/eval.ts +16 -4
  253. package/src/tools/fetch.ts +2 -1
  254. package/src/tools/find.d.ts +1 -1
  255. package/src/tools/find.ts +13 -5
  256. package/src/tools/github.ts +14 -46
  257. package/src/tools/glob.ts +2 -1
  258. package/src/tools/grep.ts +47 -277
  259. package/src/tools/grouped-file-output.d.ts +100 -19
  260. package/src/tools/grouped-file-output.ts +414 -103
  261. package/src/tools/hashline-format.d.ts +5 -0
  262. package/src/tools/hashline-format.ts +5 -0
  263. package/src/tools/irc.d.ts +6 -0
  264. package/src/tools/irc.ts +6 -0
  265. package/src/tools/job-widget.ts +13 -1
  266. package/src/tools/json-tree.d.ts +23 -4
  267. package/src/tools/json-tree.ts +132 -46
  268. package/src/tools/lsp.d.ts +2 -0
  269. package/src/tools/lsp.ts +246 -47
  270. package/src/tools/mcp.d.ts +6 -5
  271. package/src/tools/mcp.ts +20 -12
  272. package/src/tools/native-view.d.ts +3 -1
  273. package/src/tools/native-view.ts +12 -6
  274. package/src/tools/output-meta.d.ts +27 -0
  275. package/src/tools/output-meta.ts +68 -4
  276. package/src/tools/proc-render.ts +3 -3
  277. package/src/tools/read.d.ts +14 -4
  278. package/src/tools/read.ts +20 -5
  279. package/src/tools/renderer.d.ts +2 -0
  280. package/src/tools/renderer.ts +2 -0
  281. package/src/tools/streaming-output.d.ts +11 -0
  282. package/src/tools/streaming-output.ts +41 -0
  283. package/src/tools/task.d.ts +13 -4
  284. package/src/tools/task.ts +100 -97
  285. package/src/tools/url-scheme-host.d.ts +17 -0
  286. package/src/tools/url-scheme-host.ts +21 -0
  287. package/src/tools/vibe.ts +4 -4
  288. package/src/tools/wait.d.ts +2 -0
  289. package/src/tools/wait.ts +8 -5
  290. package/src/tools/write.ts +17 -27
  291. package/src/tools/yield.d.ts +1 -1
  292. package/src/tools/yield.ts +19 -10
  293. package/src/tui.d.ts +19 -2
  294. package/src/tui.ts +134 -24
  295. package/src/utils.d.ts +4 -0
  296. package/src/utils.ts +10 -0
  297. package/dist/types/theme/defaults/index.d.ts +0 -10289
  298. package/src/theme/defaults/alabaster.json +0 -103
  299. package/src/theme/defaults/amethyst.json +0 -106
  300. package/src/theme/defaults/anthracite.json +0 -103
  301. package/src/theme/defaults/basalt.json +0 -101
  302. package/src/theme/defaults/birch.json +0 -105
  303. package/src/theme/defaults/dark-abyss.json +0 -101
  304. package/src/theme/defaults/dark-arctic.json +0 -114
  305. package/src/theme/defaults/dark-aurora.json +0 -105
  306. package/src/theme/defaults/dark-catppuccin.json +0 -117
  307. package/src/theme/defaults/dark-cavern.json +0 -101
  308. package/src/theme/defaults/dark-celestial.json +0 -116
  309. package/src/theme/defaults/dark-copper.json +0 -105
  310. package/src/theme/defaults/dark-cosmos.json +0 -100
  311. package/src/theme/defaults/dark-cyberpunk.json +0 -112
  312. package/src/theme/defaults/dark-dracula.json +0 -108
  313. package/src/theme/defaults/dark-eclipse.json +0 -101
  314. package/src/theme/defaults/dark-ember.json +0 -105
  315. package/src/theme/defaults/dark-equinox.json +0 -100
  316. package/src/theme/defaults/dark-forest.json +0 -106
  317. package/src/theme/defaults/dark-github.json +0 -115
  318. package/src/theme/defaults/dark-gruvbox.json +0 -122
  319. package/src/theme/defaults/dark-lavender.json +0 -105
  320. package/src/theme/defaults/dark-lunar.json +0 -99
  321. package/src/theme/defaults/dark-midnight.json +0 -105
  322. package/src/theme/defaults/dark-monochrome.json +0 -104
  323. package/src/theme/defaults/dark-monokai.json +0 -108
  324. package/src/theme/defaults/dark-nebula.json +0 -100
  325. package/src/theme/defaults/dark-neon-noir.json +0 -110
  326. package/src/theme/defaults/dark-nord.json +0 -108
  327. package/src/theme/defaults/dark-ocean.json +0 -111
  328. package/src/theme/defaults/dark-one.json +0 -110
  329. package/src/theme/defaults/dark-poimandres.json +0 -125
  330. package/src/theme/defaults/dark-rainforest.json +0 -101
  331. package/src/theme/defaults/dark-reef.json +0 -101
  332. package/src/theme/defaults/dark-retro.json +0 -102
  333. package/src/theme/defaults/dark-rose-pine.json +0 -106
  334. package/src/theme/defaults/dark-sakura.json +0 -105
  335. package/src/theme/defaults/dark-slate.json +0 -105
  336. package/src/theme/defaults/dark-solarized.json +0 -107
  337. package/src/theme/defaults/dark-solstice.json +0 -100
  338. package/src/theme/defaults/dark-starfall.json +0 -101
  339. package/src/theme/defaults/dark-sunset.json +0 -109
  340. package/src/theme/defaults/dark-swamp.json +0 -100
  341. package/src/theme/defaults/dark-synthwave.json +0 -113
  342. package/src/theme/defaults/dark-taiga.json +0 -101
  343. package/src/theme/defaults/dark-terminal.json +0 -105
  344. package/src/theme/defaults/dark-tokyo-night.json +0 -111
  345. package/src/theme/defaults/dark-tundra.json +0 -101
  346. package/src/theme/defaults/dark-twilight.json +0 -101
  347. package/src/theme/defaults/dark-volcanic.json +0 -101
  348. package/src/theme/defaults/graphite.json +0 -102
  349. package/src/theme/defaults/index.d.ts +0 -10289
  350. package/src/theme/defaults/index.ts +0 -203
  351. package/src/theme/defaults/light-arctic.json +0 -117
  352. package/src/theme/defaults/light-aurora-day.json +0 -101
  353. package/src/theme/defaults/light-canyon.json +0 -101
  354. package/src/theme/defaults/light-catppuccin.json +0 -116
  355. package/src/theme/defaults/light-cirrus.json +0 -100
  356. package/src/theme/defaults/light-coral.json +0 -105
  357. package/src/theme/defaults/light-cyberpunk.json +0 -106
  358. package/src/theme/defaults/light-dawn.json +0 -100
  359. package/src/theme/defaults/light-dunes.json +0 -101
  360. package/src/theme/defaults/light-eucalyptus.json +0 -105
  361. package/src/theme/defaults/light-forest.json +0 -110
  362. package/src/theme/defaults/light-frost.json +0 -105
  363. package/src/theme/defaults/light-github.json +0 -125
  364. package/src/theme/defaults/light-glacier.json +0 -101
  365. package/src/theme/defaults/light-gruvbox.json +0 -118
  366. package/src/theme/defaults/light-haze.json +0 -100
  367. package/src/theme/defaults/light-honeycomb.json +0 -105
  368. package/src/theme/defaults/light-lagoon.json +0 -101
  369. package/src/theme/defaults/light-lavender.json +0 -105
  370. package/src/theme/defaults/light-meadow.json +0 -101
  371. package/src/theme/defaults/light-mint.json +0 -105
  372. package/src/theme/defaults/light-monochrome.json +0 -111
  373. package/src/theme/defaults/light-ocean.json +0 -109
  374. package/src/theme/defaults/light-one.json +0 -109
  375. package/src/theme/defaults/light-opal.json +0 -101
  376. package/src/theme/defaults/light-orchard.json +0 -101
  377. package/src/theme/defaults/light-paper.json +0 -105
  378. package/src/theme/defaults/light-poimandres.json +0 -125
  379. package/src/theme/defaults/light-prism.json +0 -100
  380. package/src/theme/defaults/light-retro.json +0 -108
  381. package/src/theme/defaults/light-sand.json +0 -105
  382. package/src/theme/defaults/light-savanna.json +0 -101
  383. package/src/theme/defaults/light-solarized.json +0 -112
  384. package/src/theme/defaults/light-soleil.json +0 -100
  385. package/src/theme/defaults/light-sunset.json +0 -109
  386. package/src/theme/defaults/light-synthwave.json +0 -108
  387. package/src/theme/defaults/light-tokyo-night.json +0 -121
  388. package/src/theme/defaults/light-wetland.json +0 -101
  389. package/src/theme/defaults/light-zenith.json +0 -99
  390. package/src/theme/defaults/limestone.json +0 -104
  391. package/src/theme/defaults/mahogany.json +0 -107
  392. package/src/theme/defaults/marble.json +0 -103
  393. package/src/theme/defaults/obsidian.json +0 -101
  394. package/src/theme/defaults/onyx.json +0 -101
  395. package/src/theme/defaults/pearl.json +0 -103
  396. package/src/theme/defaults/porcelain.json +0 -101
  397. package/src/theme/defaults/quartz.json +0 -106
  398. package/src/theme/defaults/sandstone.json +0 -105
  399. package/src/theme/defaults/titanium.json +0 -100
@@ -1,4 +1,5 @@
1
1
  import type { ImageContent } from "@linxiraos/pi-ai";
2
+ import { sanitizeDisplayText } from "./extensions/display-text";
2
3
 
3
4
  export interface BtwHistoryTurn {
4
5
  question: string;
@@ -32,6 +33,11 @@ export function getBtwTurns(record: BtwHistoryRecord): readonly BtwHistoryTurn[]
32
33
  return [record, ...(record.followUps ?? [])];
33
34
  }
34
35
 
36
+ /** Identifies one turn of a topic, its latest by default: a follow-up gets a new key, so per-answer marks reset. */
37
+ export function getBtwTurnKey(record: BtwHistoryRecord, turnIndex = record.followUps?.length ?? 0): string {
38
+ return `${record.id}:${turnIndex}`;
39
+ }
40
+
35
41
  /** Copy the most recent nonblank answer, preserving its original whitespace. */
36
42
  export function getBtwCopyText(record: BtwHistoryRecord): string | undefined {
37
43
  if (record.followUps) {
@@ -42,3 +48,62 @@ export function getBtwCopyText(record: BtwHistoryRecord): string | undefined {
42
48
  }
43
49
  return record.answer.trim() ? record.answer : undefined;
44
50
  }
51
+
52
+ const INJECT_OPEN = "<inject>";
53
+ const INJECT_CLOSE = "</inject>";
54
+
55
+ /** An answer around its `<inject>` block: the steering prompt a side answer drafted for the main session. */
56
+ export interface BtwInjectParts {
57
+ before: string;
58
+ inject: string;
59
+ after: string;
60
+ /** False while no opener has a close: the block may still be streaming, so it runs to the end. */
61
+ closed: boolean;
62
+ }
63
+
64
+ /**
65
+ * Split an answer at its last closed `<inject>` block: the last opener that has a close
66
+ * after it, paired with the first close after it. A tag merely mentioned in prose,
67
+ * before or after the block, cannot capture it. Without a closed block, the last opener
68
+ * runs to the end (`closed: false`); display it only while the answer still streams.
69
+ * Linear: the last opener before the last close is the last one with any close after it.
70
+ */
71
+ export function splitBtwInject(answer: string): BtwInjectParts | undefined {
72
+ const lastClose = answer.lastIndexOf(INJECT_CLOSE);
73
+ const open = lastClose === -1 ? -1 : answer.lastIndexOf(INJECT_OPEN, lastClose - INJECT_OPEN.length);
74
+ if (open !== -1) {
75
+ const close = answer.indexOf(INJECT_CLOSE, open + INJECT_OPEN.length);
76
+ return {
77
+ before: answer.slice(0, open),
78
+ inject: answer.slice(open + INJECT_OPEN.length, close),
79
+ after: answer.slice(close + INJECT_CLOSE.length),
80
+ closed: true,
81
+ };
82
+ }
83
+ const streaming = answer.lastIndexOf(INJECT_OPEN);
84
+ if (streaming === -1) return undefined;
85
+ return {
86
+ before: answer.slice(0, streaming),
87
+ inject: answer.slice(streaming + INJECT_OPEN.length),
88
+ after: "",
89
+ closed: false,
90
+ };
91
+ }
92
+
93
+ /** A block's text as shown and as sent: control sequences stripped, tabs expanded, trimmed. */
94
+ export function formatBtwInjectText(inject: string): string {
95
+ return sanitizeDisplayText(inject).trim();
96
+ }
97
+
98
+ /** The steering prompt to send, exactly as the block shows it; undefined while unclosed or blank. */
99
+ export function getBtwInject(answer: string): string | undefined {
100
+ const parts = splitBtwInject(answer);
101
+ const text = parts?.closed ? formatBtwInjectText(parts.inject) : "";
102
+ return text || undefined;
103
+ }
104
+
105
+ /** A topic's steering prompt: only its latest turn's, once that turn completed. */
106
+ export function getBtwRecordInject(record: BtwHistoryRecord): string | undefined {
107
+ const latest = getBtwLatestTurn(record);
108
+ return latest.status === "complete" ? getBtwInject(latest.answer) : undefined;
109
+ }
@@ -0,0 +1,91 @@
1
+ import { type Component, Markdown, visibleWidth, wrapTextWithAnsi } from "../index";
2
+ import { getMarkdownTheme, theme } from "../theme/theme";
3
+ import { card, col, md, span, text } from "../native/describe";
4
+ import type { NativeNode } from "../native/node";
5
+ import { type BtwInjectParts, formatBtwInjectText } from "./btw-history";
6
+ import { sanitizeDisplayText } from "./extensions/display-text";
7
+
8
+ /** Labels a steering prompt that has not been sent yet. */
9
+ export const BTW_INJECT_LABEL = "Inject into main session";
10
+ /** Labels a sent steering prompt. */
11
+ export const BTW_INJECTED_LABEL = "Injected into main session";
12
+
13
+ /** A displayed `<inject>` block: still sendable, or sent. Blocks in neither state render as plain text. */
14
+ export type BtwInjectState = "pending" | "sent";
15
+
16
+ /**
17
+ * Terminal lines for an `<inject>` block: every wrapped line behind a gutter of the `btw.rail`
18
+ * (pink while pending, green once sent) and the send arrow (`nav.selected`) or blanks as wide,
19
+ * then the label on the row below. Both states take the same rows and text column, so sending
20
+ * recolours the block in place.
21
+ */
22
+ function renderBlockLines(inject: string, width: number, sent: boolean): string[] {
23
+ const arrow = theme.nav.selected;
24
+ const color = sent ? "success" : "customMessageLabel";
25
+ const marker = sent ? arrow : " ".repeat(visibleWidth(arrow));
26
+ const prefix = `${theme.fg(color, theme.symbol("btw.rail"))} ${theme.bold(marker)} `;
27
+ const inner = Math.max(1, width - visibleWidth(prefix));
28
+ const body = formatBtwInjectText(inject)
29
+ .split("\n")
30
+ .flatMap(line => (line.trim() ? wrapTextWithAnsi(line, inner) : [""]))
31
+ .map(line => `${prefix}${line}`);
32
+ return [...body, `${prefix}${theme.fg(color, sent ? BTW_INJECTED_LABEL : BTW_INJECT_LABEL)}`];
33
+ }
34
+
35
+ /** Text-mode answer split around its `<inject>` block: prose, the railed block, prose, a blank row apart. */
36
+ export class BtwInjectAnswer implements Component {
37
+ readonly #inject: string;
38
+ readonly #sent: boolean;
39
+ readonly #before: Markdown | undefined;
40
+ readonly #after: Markdown | undefined;
41
+
42
+ constructor(parts: BtwInjectParts, sent: boolean) {
43
+ this.#inject = parts.inject;
44
+ this.#sent = sent;
45
+ this.#before = prose(parts.before);
46
+ this.#after = prose(parts.after);
47
+ }
48
+
49
+ render(width: number): string[] {
50
+ return [
51
+ ...(this.#before ? [...this.#before.render(width), ""] : []),
52
+ ...renderBlockLines(this.#inject, width, this.#sent),
53
+ ...(this.#after ? ["", ...this.#after.render(width)] : []),
54
+ ];
55
+ }
56
+
57
+ invalidate(): void {
58
+ this.#before?.invalidate();
59
+ this.#after?.invalidate();
60
+ }
61
+ }
62
+
63
+ function prose(text: string): Markdown | undefined {
64
+ const trimmed = text.trim();
65
+ return trimmed ? new Markdown(sanitizeDisplayText(trimmed), 0, 0, getMarkdownTheme()) : undefined;
66
+ }
67
+
68
+ /**
69
+ * The same answer for native surfaces. They wrap text themselves, so a per-row gutter cannot
70
+ * follow wrapped lines: a card toned like the rail (`user` pending, `success` sent) marks the
71
+ * whole block instead, with the label as its last row.
72
+ */
73
+ export function describeBtwInjectAnswer(parts: BtwInjectParts, sent: boolean, stream: boolean): NativeNode {
74
+ const before = parts.before.trim();
75
+ const after = parts.after.trim();
76
+ const label = sent ? `${theme.nav.selected} ${BTW_INJECTED_LABEL}` : BTW_INJECT_LABEL;
77
+ const block = card({ role: "zeta.btw.inject", tone: sent ? "success" : "user" }, [
78
+ ...formatBtwInjectText(parts.inject)
79
+ .split("\n")
80
+ .map(line => text(line, { wrap: "word" })),
81
+ text([span(label, sent ? "success" : "customMessageLabel")]),
82
+ ]);
83
+ return col(
84
+ [
85
+ ...(before ? [md(sanitizeDisplayText(before), { stream })] : []),
86
+ block,
87
+ ...(after ? [md(sanitizeDisplayText(after), { stream })] : []),
88
+ ],
89
+ { gap: "sm" },
90
+ );
91
+ }
@@ -5,10 +5,13 @@ import { sanitizeErrorLine } from "../chrome/error-block";
5
5
  import { OverlayPanel } from "../chrome/overlay-box";
6
6
  import { StreamingPanelContent } from "../chrome/streaming-panel";
7
7
  import { boundKeys, interruptKey } from "../chrome/keybinding-hints";
8
- import { formatKeyHint } from "../app-keybindings";
8
+ import { formatKeyHint, type KeyId } from "../app-keybindings";
9
9
  import type { NativeNode } from "../native/node";
10
10
  import { col, md, node, span, text } from "../native/describe";
11
11
  import { hintsRow, type NativeHint, statusHintsRow } from "../native/overlay";
12
+ import { appBtwInjectKey } from "../keybinding-matchers";
13
+ import { type BtwInjectParts, splitBtwInject } from "./btw-history";
14
+ import { BtwInjectAnswer, describeBtwInjectAnswer } from "./btw-inject";
12
15
 
13
16
  type BtwPanelState = "running" | "complete" | "branching" | "aborted" | "error";
14
17
 
@@ -19,21 +22,28 @@ interface BtwPanelComponentOptions {
19
22
  tui: TUI;
20
23
  canBranch?: () => boolean;
21
24
  canFollowUp?: () => boolean;
25
+ /**
26
+ * Given only while `btw.inject` is on: the answer's `<inject>` block shows apart from its
27
+ * prose, and the inject key (`app.btw.inject`) is offered while this returns true.
28
+ */
29
+ canInject?: () => boolean;
22
30
  }
23
31
 
24
32
  export class BtwPanelComponent extends OverlayPanel {
25
33
  #tui: TUI;
26
34
  #canBranch: (() => boolean) | undefined;
27
35
  #canFollowUp: (() => boolean) | undefined;
36
+ #canInject: (() => boolean) | undefined;
28
37
  #state: BtwPanelState = "running";
29
38
  #answer = "";
30
39
  #errorMessage: string | undefined;
31
40
  #visibleAnswer = "";
32
41
  #closed = false;
33
42
  #copied = false;
43
+ #injected = false;
34
44
  #baseTitle: string;
35
45
  readonly #content: StreamingPanelContent;
36
- #native: { node: NativeNode; canFollowUp: boolean; canBranch: boolean } | undefined;
46
+ #native: { node: NativeNode; canFollowUp: boolean; canBranch: boolean; injectKey: KeyId | undefined } | undefined;
37
47
 
38
48
  constructor(options: BtwPanelComponentOptions) {
39
49
  const baseTitle = replaceTabs(options.title ?? `/btw ${options.question}`);
@@ -42,8 +52,9 @@ export class BtwPanelComponent extends OverlayPanel {
42
52
  this.#tui = options.tui;
43
53
  this.#canBranch = options.canBranch;
44
54
  this.#canFollowUp = options.canFollowUp;
55
+ this.#canInject = options.canInject;
45
56
  this.#content = new StreamingPanelContent(() => ({
46
- sections: [this.#contentComponent()],
57
+ sections: this.#contentSections(),
47
58
  footer: () => this.#footerLine(),
48
59
  }));
49
60
  this.addChild(this.#content);
@@ -81,6 +92,13 @@ export class BtwPanelComponent extends OverlayPanel {
81
92
  this.#rebuild();
82
93
  }
83
94
 
95
+ /** Shows the answer's steering prompt as sent (send arrows, green), or back to pending when a send failed. */
96
+ setInjected(injected: boolean): void {
97
+ if (this.#closed || this.#injected === injected) return;
98
+ this.#injected = injected;
99
+ this.#rebuild();
100
+ }
101
+
84
102
  #setCopied(copied: boolean): void {
85
103
  this.#copied = copied;
86
104
  this.title = copied ? `${this.#baseTitle} ✓ Copied` : this.#baseTitle;
@@ -123,6 +141,20 @@ export class BtwPanelComponent extends OverlayPanel {
123
141
  return this.#visibleAnswer;
124
142
  }
125
143
 
144
+ /**
145
+ * The answer around its `<inject>` block, which displays apart from the prose only while
146
+ * streaming or once the tag closed: an unclosed block in a finished answer stays plain text.
147
+ */
148
+ #injectParts(): BtwInjectParts | undefined {
149
+ const parts = this.#canInject ? splitBtwInject(this.#visibleAnswer) : undefined;
150
+ return parts && (parts.closed || this.#state === "running") ? parts : undefined;
151
+ }
152
+
153
+ /** The bound inject key while it can send the answer's steering prompt. */
154
+ #injectKey(): KeyId | undefined {
155
+ return this.#canInject?.() ? appBtwInjectKey() : undefined;
156
+ }
157
+
126
158
  close(): void {
127
159
  this.#closed = true;
128
160
  }
@@ -135,8 +167,10 @@ export class BtwPanelComponent extends OverlayPanel {
135
167
  override describe(): NativeNode {
136
168
  const canFollowUp = this.#canFollowUp?.() ?? false;
137
169
  const canBranch = this.#canBranch?.() ?? this.isBranchable();
170
+ const injectKey = this.#injectKey();
138
171
  const memo = this.#native;
139
- if (memo && memo.canFollowUp === canFollowUp && memo.canBranch === canBranch) return memo.node;
172
+ if (memo && memo.canFollowUp === canFollowUp && memo.canBranch === canBranch && memo.injectKey === injectKey)
173
+ return memo.node;
140
174
  // Inline in the dock, styled as a sheet by role: a borderless column headed by the question.
141
175
  // The command word is the accent; the rest of the heading is the question or arguments.
142
176
  const space = this.#baseTitle.indexOf(" ");
@@ -148,12 +182,12 @@ export class BtwPanelComponent extends OverlayPanel {
148
182
  ...(live ? [node("spinner", {})] : []),
149
183
  title,
150
184
  ]);
151
- const described = col([head, this.#describeBody(), this.#describeFooter(canFollowUp, canBranch)], {
185
+ const described = col([head, this.#describeBody(), this.#describeFooter(canFollowUp, canBranch, injectKey)], {
152
186
  role: this.nativeRole,
153
187
  gap: "sm",
154
188
  tone: this.#state === "error" ? "error" : this.#state === "aborted" ? "warning" : undefined,
155
189
  });
156
- this.#native = { node: described, canFollowUp, canBranch };
190
+ this.#native = { node: described, canFollowUp, canBranch, injectKey };
157
191
  return described;
158
192
  }
159
193
 
@@ -162,18 +196,22 @@ export class BtwPanelComponent extends OverlayPanel {
162
196
  return text([span(sanitizeErrorLine(this.#errorMessage ?? "Unknown error"), "error")], { wrap: "word" });
163
197
  }
164
198
  const answer = this.#visibleAnswer;
165
- if (answer) return md(answer, { stream: this.#state === "running" });
199
+ const parts = this.#injectParts();
200
+ const stream = this.#state === "running";
201
+ if (parts) return describeBtwInjectAnswer(parts, this.#injected, stream);
202
+ if (answer) return md(answer, { stream });
166
203
  const waiting = this.#state === "running" ? `${theme.status.pending} Waiting for response…` : "No text returned.";
167
204
  return text([span(waiting, "dim")]);
168
205
  }
169
206
 
170
- #describeFooter(canFollowUp: boolean, canBranch: boolean): NativeNode {
207
+ #describeFooter(canFollowUp: boolean, canBranch: boolean, injectKey: KeyId | undefined): NativeNode {
171
208
  const esc: NativeHint = { keys: boundKeys("app.interrupt", ["escape"]).slice(0, 1), label: "to close" };
172
209
  switch (this.#state) {
173
210
  case "running":
174
211
  return hintsRow([{ ...esc, label: "to cancel" }]);
175
212
  case "complete": {
176
213
  const hints: NativeHint[] = [];
214
+ if (injectKey) hints.push({ keys: [injectKey], label: "to inject" });
177
215
  if (this.isCopyable()) hints.push({ keys: ["c"], label: this.#copied ? "to copy again" : "to copy" });
178
216
  if (canFollowUp) hints.push({ keys: ["f"], label: "to follow up" });
179
217
  if (canBranch) hints.push({ keys: ["b"], label: "to branch" });
@@ -209,6 +247,8 @@ export class BtwPanelComponent extends OverlayPanel {
209
247
  case "complete": {
210
248
  const actions: string[] = [];
211
249
  const copyKey = formatKeyHint("c");
250
+ const injectKey = this.#injectKey();
251
+ if (injectKey) actions.push(`${formatKeyHint(injectKey)} to inject`);
212
252
  if (this.isCopyable()) actions.push(this.#copied ? `${copyKey} to copy again` : `${copyKey} to copy`);
213
253
  if (this.#canFollowUp?.()) actions.push(`${formatKeyHint("f")} to follow up`);
214
254
  if (this.#canBranch?.() ?? this.isBranchable()) actions.push(`${formatKeyHint("b")} to branch`);
@@ -227,16 +267,17 @@ export class BtwPanelComponent extends OverlayPanel {
227
267
  }
228
268
  }
229
269
 
230
- #contentComponent(): Component {
270
+ #contentSections(): Component[] {
231
271
  if (this.#state === "error") {
232
- return new Text(theme.fg("error", sanitizeErrorLine(this.#errorMessage ?? "Unknown error")), 0, 0);
272
+ return [new Text(theme.fg("error", sanitizeErrorLine(this.#errorMessage ?? "Unknown error")), 0, 0)];
233
273
  }
234
274
  const text = this.#visibleAnswer;
235
275
  if (!text) {
236
276
  const waiting =
237
277
  this.#state === "running" ? `${theme.status.pending} Waiting for response…` : "No text returned.";
238
- return new Text(theme.fg("dim", waiting), 0, 0);
278
+ return [new Text(theme.fg("dim", waiting), 0, 0)];
239
279
  }
240
- return new Markdown(text, 0, 0, getMarkdownTheme());
280
+ const parts = this.#injectParts();
281
+ return [parts ? new BtwInjectAnswer(parts, this.#injected) : new Markdown(text, 0, 0, getMarkdownTheme())];
241
282
  }
242
283
  }
@@ -23,7 +23,7 @@ import type { Component } from "../../tui";
23
23
  import { col, keyed, node, span, text } from "../../native/describe";
24
24
  import { Memo } from "../../native/memo";
25
25
  import type { DescribeContext, NativeNode, NativeScroll, NativeUiEvent } from "../../native/node";
26
- import { actionBar, actionButton } from "../../native/overlay";
26
+ import { actionBar, actionButton, iconButton } from "../../native/overlay";
27
27
  import { CLOSE_ACTION, type PickerEvent, picker, pickerAction, pickerEvent } from "../../native/picker";
28
28
  import { type KeyId, matchesKey } from "../../keys";
29
29
  import { parseSgrMouse } from "../../mouse";
@@ -711,13 +711,12 @@ export class ExtensionDashboard implements Component {
711
711
  text(DASHBOARD_TITLE, { role: "zeta.app.title" }),
712
712
  text([span(query ? `${shown} of ${total}` : `${total} extensions`, "muted")], { truncate: "end" }),
713
713
  ]),
714
- node("icon", {
715
- name: "x",
716
- role: "zeta.app.ibtn",
717
- title: `Close ${formatTooltipKey(boundKeys("app.interrupt", ["escape"])[0] ?? "escape")}`,
718
- aria: "Close",
719
- actions: { click: "close" },
720
- }),
714
+ iconButton(
715
+ "x",
716
+ "close",
717
+ `Close ${formatTooltipKey(boundKeys("app.interrupt", ["escape"])[0] ?? "escape")}`,
718
+ { aria: "Close" },
719
+ ),
721
720
  ],
722
721
  "head",
723
722
  );
@@ -407,6 +407,12 @@ export class HookEditorComponent extends OverlayPanel implements Focusable {
407
407
  else this.#editor.pasteText(text);
408
408
  }
409
409
 
410
+ /** Replace the draft, as Ctrl+R history search does for the main composer. */
411
+ setText(text: string): void {
412
+ if (this.#disposed) return;
413
+ this.#editor.setText(text);
414
+ }
415
+
410
416
  /**
411
417
  * Prompt-style: raw Enter submits; Editor owns newline-producing sequences.
412
418
  * The follow-up chord (`app.message.followUp` → Ctrl+Q / Ctrl+Enter) also
@@ -647,9 +647,9 @@ export class HookSelectorComponent extends OverlayPanel {
647
647
  return;
648
648
  }
649
649
 
650
- if (matchesSelectUp(keyData) || (!this.#isSearchEnabled() && matchesKey(keyData, "k"))) {
650
+ if (matchesSelectUp(keyData)) {
651
651
  this.#moveSelection(-1);
652
- } else if (matchesSelectDown(keyData) || (!this.#isSearchEnabled() && matchesKey(keyData, "j"))) {
652
+ } else if (matchesSelectDown(keyData)) {
653
653
  this.#moveSelection(1);
654
654
  } else if (matchesKey(keyData, "enter") || matchesKey(keyData, "return") || keyData === "\n") {
655
655
  const selected = this.#menu.selectedItem;
@@ -26,6 +26,10 @@ export interface JobsPanelJob {
26
26
  readonly type: string;
27
27
  readonly status: "running" | "completed" | "failed" | "cancelled";
28
28
  readonly label: string;
29
+ /** What the job is for, in the model's words; rows and the detail lead with it over a command `label`. */
30
+ readonly intent?: string;
31
+ /** One line on what a command does and when it ends, from the cheap model; the detail shows it under the intent. */
32
+ readonly caption?: string;
29
33
  readonly startTime: number;
30
34
  readonly endTime?: number;
31
35
  /** Registry id of the agent that owns the job. */
@@ -130,6 +134,12 @@ export class JobsSheet implements Component {
130
134
  #native: { key: string; output: string | undefined; node: NativeNode } | undefined;
131
135
  /** Fallback output tail, reused while the selected job's output is unchanged. */
132
136
  #tail: { id: string; output: string; lines: readonly string[] } | undefined;
137
+ /**
138
+ * The selected job as last seen: its row, detail and the subagents placing
139
+ * it. The session evicts settled jobs on its own clock; while the user keeps
140
+ * one selected it stays listed with its last output, until they select another.
141
+ */
142
+ #held: { job: JobsPanelJob; detail: JobsPanelDetail | undefined; agents: readonly JobTreeAgent[] } | undefined;
133
143
 
134
144
  constructor(source: JobsSheetSource) {
135
145
  this.#source = source;
@@ -137,16 +147,17 @@ export class JobsSheet implements Component {
137
147
 
138
148
  describe(_cx: DescribeContext): NativeNode {
139
149
  const { rows, jobs, selected, cancellable } = this.#current();
140
- const detail = selected && this.#source.inspect(selected.id);
150
+ const detail = selected && this.#inspect(selected.id);
141
151
  const now = Date.now();
142
152
  // Elapsed nodes tick on their own; list values and the output pane redraw
143
- // when a job starts, settles, leaves or moves in the tree, its process
144
- // changes, its output grows, or (while one runs) once a second.
153
+ // when a job starts, settles, leaves or moves in the tree, gets its
154
+ // caption (it can land after the job settles), its process changes, its
155
+ // output grows, or (while one runs) once a second.
145
156
  const key = [
146
157
  rows
147
158
  .map(
148
159
  entry =>
149
- `${jobTreeGuide(entry, theme)}${entry.kind === "job" ? `${entry.job.id}:${entry.job.status}` : entry.agent.id}`,
160
+ `${jobTreeGuide(entry, theme)}${entry.kind === "job" ? `${entry.job.id}:${entry.job.status}:${entry.job.caption ?? ""}` : entry.agent.id}`,
150
161
  )
151
162
  .join(","),
152
163
  selected?.id,
@@ -194,15 +205,20 @@ export class JobsSheet implements Component {
194
205
  const cursor = job === selected ? ">" : " ";
195
206
  const age = formatDuration(jobAge(job, now));
196
207
  const agent = entry.agent && entry.agent.id !== job.label ? `${entry.agent.id}: ` : "";
197
- lines.push(
198
- truncateToWidth(
199
- `${cursor} ${guide}${job.status} ${job.type} ${age} ${agent}${collapseCommand(job.label)}`,
200
- width,
201
- ),
202
- );
208
+ // The intent is model-written: strip terminal controls and flatten it to one row like the command.
209
+ const title = shortenEmbeddedPaths(collapseCommand(sanitizeText(job.intent ?? job.label)));
210
+ lines.push(truncateToWidth(`${cursor} ${guide}${job.status} ${job.type} ${age} ${agent}${title}`, width));
203
211
  }
204
- const detail = selected && this.#source.inspect(selected.id);
212
+ const detail = selected && this.#inspect(selected.id);
205
213
  if (detail) {
214
+ if (selected.caption) {
215
+ for (const line of wrapTextWithAnsi(
216
+ shortenEmbeddedPaths(sanitizeText(selected.caption)),
217
+ Math.max(1, width - 3),
218
+ )) {
219
+ lines.push(` ${theme.fg("muted", line)}`);
220
+ }
221
+ }
206
222
  // Rows show the cut label; the selected job's command wraps here,
207
223
  // bounded so a long script never pushes the facts and output off the sheet.
208
224
  if (detail.command) {
@@ -221,7 +237,7 @@ export class JobsSheet implements Component {
221
237
  detail.artifactId && `artifact://${detail.artifactId}`,
222
238
  ]);
223
239
  if (facts.length > 0) lines.push(truncateToWidth(` ${facts.join(" · ")}`, width));
224
- if (detail.widget) {
240
+ if (detail.widget && widgetHasData(detail.widget)) {
225
241
  for (const line of renderJobWidgetLines(detail.widget, Math.max(0, width - 3), theme)) {
226
242
  lines.push(` ${line}`);
227
243
  }
@@ -262,15 +278,43 @@ export class JobsSheet implements Component {
262
278
  selected: JobsPanelJob | undefined;
263
279
  cancellable: boolean;
264
280
  } {
265
- const { running, recent, rootId, agents } = this.#source.load();
266
- const rows = buildJobTree([...running, ...recent], agents ?? [], rootId);
281
+ const snapshot = this.#source.load();
282
+ const { running, rootId } = snapshot;
283
+ let { recent, agents = [] } = snapshot;
284
+ // A settled job the session evicted stays listed while it is selected.
285
+ const held = this.#held?.job.id === this.#selectedId ? this.#held : undefined;
286
+ const evicted =
287
+ held !== undefined &&
288
+ held.job.status !== "running" &&
289
+ !running.some(job => job.id === held.job.id) &&
290
+ !recent.some(job => job.id === held.job.id);
291
+ if (evicted) {
292
+ recent = [...recent, held.job];
293
+ const known = new Set(agents.map(agent => agent.id));
294
+ agents = [...agents, ...held.agents.filter(agent => !known.has(agent.id))];
295
+ }
296
+ const rows = buildJobTree([...running, ...recent], agents, rootId);
267
297
  const jobs = rows.flatMap(entry => (entry.kind === "job" ? [entry.job] : []));
268
298
  const selected = jobs.find(job => job.id === this.#selectedId) ?? jobs[0];
269
299
  this.#selectedId = selected?.id;
300
+ if (!selected) this.#held = undefined;
301
+ else if (!evicted) {
302
+ const detail = held?.job.id === selected.id ? held.detail : undefined;
303
+ this.#held = { job: selected, detail, agents: snapshot.agents ?? [] };
304
+ }
270
305
  const owned = selected?.ownerId === undefined || selected.ownerId === rootId;
271
306
  return { rows, jobs, selected, cancellable: this.#source.cancel !== undefined && owned };
272
307
  }
273
308
 
309
+ /** The job's detail from the source, else the last one seen while it was held. */
310
+ #inspect(id: string): JobsPanelDetail | undefined {
311
+ const detail = this.#source.inspect(id);
312
+ const held = this.#held?.job.id === id ? this.#held : undefined;
313
+ if (!held) return detail;
314
+ if (detail) held.detail = detail;
315
+ return held.detail;
316
+ }
317
+
274
318
  #tailLines(id: string, output: string): readonly string[] {
275
319
  const cached = this.#tail;
276
320
  if (cached?.id === id && cached.output === output) return cached.lines;
@@ -297,6 +341,11 @@ function jobAge(job: JobsPanelJob, nowMs: number): number {
297
341
  return Math.max(0, (job.endTime ?? nowMs) - job.startTime);
298
342
  }
299
343
 
344
+ /** Whether a widget draws more than its title: one without data only repeats the job's heading. */
345
+ function widgetHasData(widget: JobWidgetView): boolean {
346
+ return widget.blocks.length > 0 || widget.headline !== undefined || Boolean(widget.stage);
347
+ }
348
+
300
349
  /**
301
350
  * The last `count` pieces of `text.trimEnd().split("\n")`, found by scanning
302
351
  * back from the end so a long running output is never split as a whole.
@@ -339,8 +388,9 @@ function describeJobList(rows: readonly JobTreeRow<JobsPanelJob>[], selected: Jo
339
388
 
340
389
  /**
341
390
  * One list row: the type icon tinted by status, the tree connector, the
342
- * subagent a task job runs, the one-line label (a process job's command in
343
- * mono, a task's work in prose) and how long it ran.
391
+ * subagent a task job runs, the one-line label (what the job is for when the
392
+ * model said, else a process job's command in mono or a task's work in prose)
393
+ * and how long it ran.
344
394
  */
345
395
  function describeJobItem(job: JobsPanelJob, agentName: string | undefined, guide: string, nowMs: number): NativeNode {
346
396
  const status = STATUS_LABEL[job.status];
@@ -349,13 +399,17 @@ function describeJobItem(job: JobsPanelJob, agentName: string | undefined, guide
349
399
  label: compact([
350
400
  guide !== "" && span(guide, "mono dim"),
351
401
  agentName !== undefined && agentName !== job.label && span(`${agentName} `, "strong"),
352
- job.type === "task" ? span(job.label) : span(collapseCommand(job.label), "mono"),
402
+ job.intent
403
+ ? span(job.intent)
404
+ : job.type === "task"
405
+ ? span(job.label)
406
+ : span(collapseCommand(job.label), "mono"),
353
407
  ]),
354
408
  value: [span(age, "mono")],
355
409
  icon: TYPE_ICON[job.type] ?? "job",
356
410
  tone: STATUS_TONE[job.status],
357
- title: `${job.label}\n${status} · ${job.type} · ${job.id}`,
358
- aria: `${job.label}, ${status.toLowerCase()}, ${age}`,
411
+ title: `${job.intent ? `${job.intent}\n` : ""}${job.caption ? `${job.caption}\n` : ""}${job.label}\n${status} · ${job.type} · ${job.id}`,
412
+ aria: `${job.intent ?? job.label}, ${status.toLowerCase()}, ${age}`,
359
413
  });
360
414
  }
361
415
 
@@ -388,8 +442,9 @@ function describeEmpty(): NativeNode {
388
442
 
389
443
  /**
390
444
  * The selected job: a status line (pill, live elapsed, type · id, Cancel job
391
- * when `cancellable`), its task or full command, facts and the output pane (or
392
- * its empty state).
445
+ * when `cancellable`), what it is for, what its command does (the cheap
446
+ * model's caption), its full command, facts, its widget
447
+ * when it has data to draw and the output pane (or its empty state).
393
448
  */
394
449
  function describeDetail(
395
450
  job: JobsPanelJob,
@@ -401,6 +456,7 @@ function describeDetail(
401
456
  const exit = detail?.exitCode;
402
457
  const age = Math.round(jobAge(job, nowMs));
403
458
  const command = detail?.command ?? (job.type === "task" ? undefined : job.label);
459
+ const title = job.intent ?? (command ? undefined : job.label);
404
460
  const pids = detail?.pids ?? [];
405
461
  const facts = compact([
406
462
  job.agentId ? { k: "Agent", v: [span(job.agentId, "mono")] } : undefined,
@@ -430,11 +486,15 @@ function describeDetail(
430
486
  ]),
431
487
  { role: "zeta.jobs.status", gap: "sm", align: "center" },
432
488
  ),
489
+ title ? text(title, { role: "zeta.jobs.title", wrap: "word" }) : undefined,
490
+ job.caption ? text([span(job.caption, "muted")], { role: "zeta.jobs.caption", wrap: "word" }) : undefined,
433
491
  command
434
492
  ? code(command, { lang: "bash", wrap: true, preview: { lines: 4 }, role: "zeta.jobs.command" })
435
493
  : text(job.label, { role: "zeta.jobs.title", wrap: "word" }),
436
494
  facts.length > 0 && node("kv", { items: facts, role: "zeta.jobs.facts" }),
437
- detail?.widget && node("col", { role: "zeta.jobs.widget" }, [describeJobWidget(detail.widget)], "widget"),
495
+ detail?.widget &&
496
+ widgetHasData(detail.widget) &&
497
+ node("col", { role: "zeta.jobs.widget" }, [describeJobWidget(detail.widget)], "widget"),
438
498
  node(
439
499
  "col",
440
500
  { role: "zeta.jobs.out", gap: "sm" },