@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
package/src/tools/mcp.ts CHANGED
@@ -16,7 +16,7 @@ import { plainText } from "../native/spans";
16
16
  import { errorText, noteText, truncationNotice } from "./native-view";
17
17
  import { getMarkdownTheme, type Theme } from "../theme/theme";
18
18
  import {
19
- describeJsonTree,
19
+ describeJsonValue,
20
20
  formatArgsInline,
21
21
  JSON_TREE_MAX_DEPTH_COLLAPSED,
22
22
  JSON_TREE_MAX_DEPTH_EXPANDED,
@@ -302,38 +302,46 @@ function mcpHead(title: string, entries: readonly [string, unknown][]): NativeTo
302
302
  /**
303
303
  * Native counterpart of the ANSI card's Args tree: the complete arguments,
304
304
  * folded under an `Args` section because the head summary clips each value.
305
+ * The host's `json` viewer, when it draws one, lists the arguments with their
306
+ * containers folded to one-line previews.
305
307
  */
306
- function mcpArgsSection(entries: readonly [string, unknown][]): NativeNode | undefined {
308
+ function mcpArgsSection(entries: readonly [string, unknown][], json: boolean): NativeNode | undefined {
307
309
  if (entries.length === 0) return undefined;
308
310
  return node(
309
311
  "section",
310
312
  { head: [span("Args", "muted")], collapsible: true, collapsed: true },
311
- [describeJsonTree(Object.fromEntries(entries))],
313
+ [describeJsonValue(Object.fromEntries(entries), { native: json })],
312
314
  "args",
313
315
  );
314
316
  }
315
317
 
316
318
  /** Native MCP call view: the head plus the folded args, inline while pending. */
317
- export function describeMCPCall(args: Record<string, unknown>, label: string): NativeToolView {
319
+ export function describeMCPCall(
320
+ args: Record<string, unknown>,
321
+ label: string,
322
+ options?: RenderResultOptions,
323
+ ): NativeToolView {
318
324
  const entries = visibleMcpArgs(args);
319
- const section = mcpArgsSection(entries);
325
+ const section = mcpArgsSection(entries, options?.json === true);
320
326
  return { tool: mcpHead(label, entries), body: section ? [section] : undefined, inline: true };
321
327
  }
322
328
 
323
329
  const mcpResultMemo = new OwnerMemo<NativeToolView | undefined>();
324
330
 
325
331
  /**
326
- * Native MCP result view: JSON output as a JSON tree, Markdown when the
327
- * preference is on, otherwise the raw text as tool output; the folded Args
328
- * section follows, so the collapsed preview still leads with the output.
332
+ * Native MCP result view: JSON output as the host's `json` viewer (when it
333
+ * draws one) or a JSON tree, Markdown when the preference is on, otherwise
334
+ * the raw text as tool output; the folded Args section follows, so the
335
+ * collapsed preview still leads with the output.
329
336
  */
330
337
  export function describeMCPResult(
331
338
  result: { content: Array<{ type: string; text?: string }>; details?: MCPToolDetails; isError?: boolean },
332
- _options: RenderResultOptions,
339
+ options: RenderResultOptions,
333
340
  args?: Record<string, unknown>,
334
341
  ): NativeToolView | undefined {
342
+ const json = options.json === true;
335
343
  // Callers allocate a fresh args object per streamed delta, so identity is a sound dep.
336
- return mcpResultMemo.get(result, [renderMarkdownResults, args], () => {
344
+ return mcpResultMemo.get(result, [renderMarkdownResults, args, json], () => {
337
345
  const textContent = (result.content ?? [])
338
346
  .filter(block => block.type === "text")
339
347
  .map(block => block.text ?? "")
@@ -355,13 +363,13 @@ export function describeMCPResult(
355
363
  }
356
364
  if (!output) body.push(noteText("(no output)"));
357
365
  else if (isError) body.push(errorText(output));
358
- else if (isJson) body.push(describeJsonTree(parsed));
366
+ else if (isJson) body.push(describeJsonValue(parsed, { native: json }));
359
367
  else if (renderMarkdownResults) body.push(md(output));
360
368
  else body.push(ansi(output));
361
369
  const warning = truncationNotice(result.details?.meta);
362
370
  if (warning) body.push(warning);
363
371
  const entries = visibleMcpArgs(args);
364
- const section = mcpArgsSection(entries);
372
+ const section = mcpArgsSection(entries, json);
365
373
  if (section) body.push(section);
366
374
  return {
367
375
  tool: mcpHead(title, entries),
@@ -6,8 +6,10 @@ import { type OutputMeta } from "./output-meta";
6
6
  import type { NativeToolHead, NativeToolView, ToolRenderResult } from "./renderer";
7
7
  /** A path for native heads: relative to the working directory when inside it, else `~`-shortened. */
8
8
  export declare function displayPath(filePath: string): string;
9
- /** `file://` link for a head's path target, when the path is absolute. */
9
+ /** Configured file link for a head's path target, when the path is absolute. */
10
10
  export declare function fileHref(filePath: string | undefined): string | undefined;
11
+ /** Link for a head target that is a web URL (`www.` gains `https://`), else undefined. */
12
+ export declare function urlHref(target: string | undefined): string | undefined;
11
13
  /** Diff stats as one head `meta` string, `+8 −1` (U+2212 minus), or undefined when nothing changed. */
12
14
  export declare function diffStatsMeta(added: number, removed: number): string | undefined;
13
15
  /**
@@ -8,7 +8,7 @@ import type { TspSpan, TspText, TspTone } from "@linxiraos/pi-wire";
8
8
  import { ansi, code, compact, keyed, node, row, span, text } from "../native/describe";
9
9
  import type { NativeChild, NativeNode } from "../native/node";
10
10
  import { tryFileUri } from "../render/hyperlink";
11
- import { type ParsedDiagnostic, parseDiagnosticMessage, shortenPath } from "../render/render-utils";
11
+ import { type ParsedDiagnostic, parseDiagnosticMessage, pathNameStart, shortenPath } from "../render/render-utils";
12
12
  import { plainText } from "../native/spans";
13
13
  import type { FileDiagnosticsResult } from "./lsp";
14
14
  import { formatArtifactErrorNotice, formatTruncationMetaNotice, type OutputMeta } from "./output-meta";
@@ -23,11 +23,18 @@ export function displayPath(filePath: string): string {
23
23
  return shortenPath(filePath);
24
24
  }
25
25
 
26
- /** `file://` link for a head's path target, when the path is absolute. */
26
+ /** Configured file link for a head's path target, when the path is absolute. */
27
27
  export function fileHref(filePath: string | undefined): string | undefined {
28
28
  return filePath && path.isAbsolute(filePath) ? tryFileUri(filePath) : undefined;
29
29
  }
30
30
 
31
+ /** Link for a head target that is a web URL (`www.` gains `https://`), else undefined. */
32
+ export function urlHref(target: string | undefined): string | undefined {
33
+ if (!target) return undefined;
34
+ const candidate = /^www\./i.test(target) ? `https://${target}` : target;
35
+ return /^https?:\/\/\S+$/i.test(candidate) ? candidate : undefined;
36
+ }
37
+
31
38
  /** Diff stats as one head `meta` string, `+8 −1` (U+2212 minus), or undefined when nothing changed. */
32
39
  export function diffStatsMeta(added: number, removed: number): string | undefined {
33
40
  const parts: string[] = [];
@@ -74,11 +81,10 @@ export function fileRow(
74
81
  } = {},
75
82
  ): NativeNode {
76
83
  const isDir = filePath.endsWith("/");
77
- const bare = isDir ? filePath.slice(0, -1) : filePath;
78
- const cut = bare.lastIndexOf("/") + 1;
84
+ const cut = pathNameStart(filePath);
79
85
  const spans: TspSpan[] = [];
80
- if (cut > 0) spans.push(span(bare.slice(0, cut), "dim"));
81
- spans.push(span(`${bare.slice(cut) || "…"}${isDir ? "/" : ""}`, "strong", p.href ? { href: p.href } : undefined));
86
+ if (cut > 0) spans.push(span(filePath.slice(0, cut), "dim"));
87
+ spans.push(span(filePath.slice(cut) || "…", "strong", p.href ? { href: p.href } : undefined));
82
88
  if (p.range) spans.push(span(p.range, "muted"));
83
89
  const children: NativeChild[] = [
84
90
  p.lead ?? node("icon", { name: p.icon ?? (isDir ? "folder" : "file"), tone: p.tone }),
@@ -100,8 +100,21 @@ export interface LimitsMeta {
100
100
  last: number;
101
101
  };
102
102
  selectorBase?: string;
103
+ /** The first cut line exceeds what one `:raw` read returns; that read stops at this many bytes. */
104
+ rawByteCap?: number;
103
105
  };
104
106
  }
107
+ /**
108
+ * The bash minimizer rewrote this output: `filter` is the native filter label
109
+ * (`chain` for a minimized `&&`/`;` chain), the byte counts are the raw capture
110
+ * and the minimized text, and `artifactId` holds the raw capture.
111
+ */
112
+ export interface MinimizedMeta {
113
+ filter: string;
114
+ inputBytes: number;
115
+ outputBytes: number;
116
+ artifactId: string;
117
+ }
105
118
  /**
106
119
  * Structured metadata for tool outputs.
107
120
  */
@@ -114,6 +127,7 @@ export interface OutputMeta {
114
127
  pagedSource?: true;
115
128
  diagnostics?: DiagnosticMeta;
116
129
  limits?: LimitsMeta;
130
+ minimized?: MinimizedMeta;
117
131
  }
118
132
  /**
119
133
  * Reformat pre-formatted diagnostic messages into a multi-level, prefix-folded
@@ -136,6 +150,13 @@ export declare function stripRawOutputArtifactNotice(text: string): {
136
150
  text: string;
137
151
  artifactId?: string;
138
152
  };
153
+ /** Whether `line` is the column-cap notice {@link formatOutputNotice} emits (`[Some lines truncated to 768 chars…]`). */
154
+ export declare function isColumnTruncationNotice(line: string): boolean;
155
+ /**
156
+ * Whether the bracketed notice `line` carries the column-cap clause: alone, or after the parts
157
+ * {@link formatOutputNotice} joins before it (`[Showing lines 1-4 of 5. … Some lines truncated to 768 chars…]`).
158
+ */
159
+ export declare function hasColumnTruncationClause(line: string): boolean;
139
160
  /** Remove a trailing generated output notice when metadata is unavailable. */
140
161
  export declare function stripGeneratedOutputNotice(text: string): string;
141
162
  /** Format truncation ranges and recovery hints. */
@@ -147,6 +168,12 @@ export declare function formatTruncationMetaNotice(truncation: TruncationMeta, s
147
168
  export declare function formatStyledArtifactReference(artifactId: string, theme: Theme): string;
148
169
  /** Describe an incomplete artifact capture. */
149
170
  export declare function formatArtifactErrorNotice(error: OutputArtifactError): string;
171
+ /**
172
+ * `git 120.4KB → 3.2KB`: the minimizer filter that ran and the bytes it took the output from and to.
173
+ * Native labels are short words; a rehydrated session or extension may carry any text, so the label
174
+ * is sanitized to one plain line, its home paths shortened to `~`, and width-bounded.
175
+ */
176
+ export declare function formatMinimizedMeta(minimized: MinimizedMeta): string;
150
177
  /**
151
178
  * Format notices from OutputMeta for LLM consumption.
152
179
  * Returns empty string if no notices needed.
@@ -1,5 +1,13 @@
1
1
  import type { Theme } from "../theme/theme";
2
- import { formatBytes, wrapBrackets } from "../render/render-utils";
2
+ import { sanitizeText } from "@linxiraos/pi-utils";
3
+ import {
4
+ flattenLine,
5
+ formatBytes,
6
+ shortenEmbeddedPaths,
7
+ TRUNCATE_LENGTHS,
8
+ truncateToWidth,
9
+ wrapBrackets,
10
+ } from "../render/render-utils";
3
11
  import type { OutputArtifactError } from "./streaming-output";
4
12
  import { formatGroupedFiles } from "./grouped-file-output";
5
13
 
@@ -76,9 +84,23 @@ export interface LimitsMeta {
76
84
  artifactElidedBytes?: number;
77
85
  lines?: { first: number; last: number };
78
86
  selectorBase?: string;
87
+ /** The first cut line exceeds what one `:raw` read returns; that read stops at this many bytes. */
88
+ rawByteCap?: number;
79
89
  };
80
90
  }
81
91
 
92
+ /**
93
+ * The bash minimizer rewrote this output: `filter` is the native filter label
94
+ * (`chain` for a minimized `&&`/`;` chain), the byte counts are the raw capture
95
+ * and the minimized text, and `artifactId` holds the raw capture.
96
+ */
97
+ export interface MinimizedMeta {
98
+ filter: string;
99
+ inputBytes: number;
100
+ outputBytes: number;
101
+ artifactId: string;
102
+ }
103
+
82
104
  /**
83
105
  * Structured metadata for tool outputs.
84
106
  */
@@ -91,6 +113,7 @@ export interface OutputMeta {
91
113
  pagedSource?: true;
92
114
  diagnostics?: DiagnosticMeta;
93
115
  limits?: LimitsMeta;
116
+ minimized?: MinimizedMeta;
94
117
  }
95
118
 
96
119
  // Regex: split on the first `:digits:digits` boundary to separate path from the rest
@@ -202,6 +225,33 @@ export function stripRawOutputArtifactNotice(text: string): { text: string; arti
202
225
  return artifactId === undefined ? { text } : { text: stripped, artifactId };
203
226
  }
204
227
 
228
+ /** The column-cap clause {@link formatOutputNotice} puts in a notice, alone or after other parts. */
229
+ const COLUMN_TRUNCATION_CLAUSE = "Some lines truncated to ";
230
+ /**
231
+ * The rest of the clause as {@link formatOutputNotice} writes it: the cap as JavaScript prints a
232
+ * finite number (the setting takes any, `768.5` included), its unit, then a `. ` suffix or the bracket.
233
+ */
234
+ const COLUMN_TRUNCATION_TAIL = String.raw`-?\d+(?:\.\d+)?(?:e[+-]\d+)? (?:chars|bytes)(?:\. .*)?\]$`;
235
+ const COLUMN_TRUNCATION_NOTICE = new RegExp(String.raw`^\[${COLUMN_TRUNCATION_CLAUSE}${COLUMN_TRUNCATION_TAIL}`, "u");
236
+ const COLUMN_TRUNCATION_IN_NOTICE = new RegExp(
237
+ String.raw`^\[.*\. ${COLUMN_TRUNCATION_CLAUSE}${COLUMN_TRUNCATION_TAIL}`,
238
+ "u",
239
+ );
240
+
241
+ /** Whether `line` is the column-cap notice {@link formatOutputNotice} emits (`[Some lines truncated to 768 chars…]`). */
242
+ export function isColumnTruncationNotice(line: string): boolean {
243
+ return COLUMN_TRUNCATION_NOTICE.test(line.trim());
244
+ }
245
+
246
+ /**
247
+ * Whether the bracketed notice `line` carries the column-cap clause: alone, or after the parts
248
+ * {@link formatOutputNotice} joins before it (`[Showing lines 1-4 of 5. … Some lines truncated to 768 chars…]`).
249
+ */
250
+ export function hasColumnTruncationClause(line: string): boolean {
251
+ const trimmed = line.trim();
252
+ return COLUMN_TRUNCATION_NOTICE.test(trimmed) || COLUMN_TRUNCATION_IN_NOTICE.test(trimmed);
253
+ }
254
+
205
255
  function isGeneratedOutputNoticeLine(line: string): boolean {
206
256
  if (!line.startsWith("[") || !line.endsWith("]")) return false;
207
257
  const body = line.slice(1, -1);
@@ -209,7 +259,7 @@ function isGeneratedOutputNoticeLine(line: string): boolean {
209
259
  body.startsWith("Showing ") ||
210
260
  /^\d+ matches limit reached\. Use limit=\d+ for more/u.test(body) ||
211
261
  /^\d+ results limit reached(?:\.|$)/u.test(body) ||
212
- body.startsWith("Some lines truncated to ")
262
+ isColumnTruncationNotice(line)
213
263
  );
214
264
  }
215
265
 
@@ -297,6 +347,17 @@ export function formatArtifactErrorNotice(error: OutputArtifactError): string {
297
347
  return `Full output was not saved completely (artifact ${error} failed)`;
298
348
  }
299
349
 
350
+ /**
351
+ * `git 120.4KB → 3.2KB`: the minimizer filter that ran and the bytes it took the output from and to.
352
+ * Native labels are short words; a rehydrated session or extension may carry any text, so the label
353
+ * is sanitized to one plain line, its home paths shortened to `~`, and width-bounded.
354
+ */
355
+ export function formatMinimizedMeta(minimized: MinimizedMeta): string {
356
+ const label = shortenEmbeddedPaths(flattenLine(sanitizeText(minimized.filter)));
357
+ const filter = truncateToWidth(label, TRUNCATE_LENGTHS.SHORT);
358
+ return `${filter} ${formatBytes(minimized.inputBytes)} → ${formatBytes(minimized.outputBytes)}`;
359
+ }
360
+
300
361
  /**
301
362
  * Format notices from OutputMeta for LLM consumption.
302
363
  * Returns empty string if no notices needed.
@@ -340,14 +401,17 @@ export function formatOutputNotice(meta: OutputMeta | undefined): string {
340
401
  // notices always read "chars", so default missing units to it. Otherwise
341
402
  // a resumed legacy session renders "… 768 undefined" and stripOutputNotice
342
403
  // stops matching the persisted "… 768 chars" text.
343
- let columnNotice = `Some lines truncated to ${c.maxColumn} ${c.unit ?? "chars"}`;
404
+ let columnNotice = `${COLUMN_TRUNCATION_CLAUSE}${c.maxColumn} ${c.unit ?? "chars"}`;
344
405
  // An artifact cut to a head/tail sample renumbers its lines, so only a complete one names a line.
345
406
  const selectorBase =
346
407
  c.selectorBase ?? (c.artifactId != null && !c.artifactElidedBytes ? `artifact://${c.artifactId}` : undefined);
347
408
  if (c.lines && selectorBase !== undefined) {
348
409
  // One line per selector: a span of cut lines can exceed what one read returns.
349
410
  const { first, last } = c.lines;
350
- columnNotice += `. Use ${selectorBase}:raw:${first}-${first} to read line ${first} whole`;
411
+ columnNotice +=
412
+ c.rawByteCap === undefined
413
+ ? `. Use ${selectorBase}:raw:${first}-${first} to read line ${first} whole`
414
+ : `. Use ${selectorBase}:raw:${first}-${first} to read line ${first} uncut, byte-capped at ${formatBytes(c.rawByteCap)}`;
351
415
  if (last > first) columnNotice += `; cut lines run to line ${last}, each read the same way`;
352
416
  } else if (c.artifactId != null) {
353
417
  columnNotice += `. ${formatFullOutputReference(c.artifactId, c.artifactElidedBytes)}`;
@@ -138,10 +138,10 @@ function jobRow(job: JobSnapshot, theme: Theme): string {
138
138
  ? "error"
139
139
  : job.status === "running"
140
140
  ? "running"
141
- : "done",
141
+ : "success",
142
142
  theme,
143
143
  );
144
- return `${icon} ${formatBadge(job.type, job.status === "failed" ? "error" : job.status === "cancelled" ? "warning" : "accent", theme)} ${theme.fg("toolOutput", safe(job.id))} ${theme.fg("dim", safe(job.label))} ${theme.fg("dim", formatDuration(job.durationMs))}`;
144
+ return `${icon} ${formatBadge(job.type, job.status === "failed" ? "error" : job.status === "cancelled" ? "warning" : "accent", theme)} ${theme.fg("toolOutput", safe(job.id))} ${theme.fg("dim", safe(job.intent || job.label))} ${theme.fg("dim", formatDuration(job.durationMs))}`;
145
145
  }
146
146
 
147
147
  /** Render live and completed process writes with the URL-selected operation. */
@@ -303,7 +303,7 @@ function jobItem(job: JobSnapshot, badge?: { text: string; tone: TspTone }): Nat
303
303
  "item",
304
304
  {
305
305
  label: [span(job.type, "accent"), span(" "), span(safe(job.id), "toolOutput")],
306
- detail: [span(safe(job.label), "muted")],
306
+ detail: [span(safe(job.intent || job.label), "muted")],
307
307
  value: badge ? [span(badge.text, badge.tone)] : [span(formatDuration(job.durationMs), "muted")],
308
308
  tone: badge?.tone ?? jobTone(job.status),
309
309
  },
@@ -111,6 +111,16 @@ export declare function splitInternalUrlSel(rawPath: string, specOf?: (scheme: s
111
111
  path: string;
112
112
  sel?: string;
113
113
  };
114
+ /**
115
+ * Split a filesystem read target from its query (`data.json?q=.items` →
116
+ * `data.json`, `?q=.items`), the display twin of the read tool's JSON, SQLite
117
+ * and image-question parsers. URLs own their query string and stay whole, as
118
+ * does a `?` inside a file name.
119
+ */
120
+ export declare function splitReadQuery(readPath: string): {
121
+ path: string;
122
+ query?: string;
123
+ };
114
124
  /** Recognize HTTP URLs and www-prefixed external read targets. */
115
125
  export declare function isReadableUrlPath(value: string): boolean;
116
126
  /** Return the first selected line when every range has valid one-based bounds. */
@@ -139,11 +149,11 @@ export declare function readSourceFsPath(details: unknown): string | undefined;
139
149
  */
140
150
  export declare function readResultIsMarkdown(details: ReadToolDetails | undefined, args: ReadRenderArgs | undefined): boolean;
141
151
  /**
142
- * Read content as numbered, wrapped `code` (no path header: the head names
143
- * the file), matching the ANSI preview's hanging wrap. Numbers come from
152
+ * Read content as one numbered, wrapped `code` block (no path header: the head
153
+ * names the file), matching the ANSI preview's hanging wrap. Numbers come from
144
154
  * `lineNumbers` (`displayContent`'s per-line numbers, `null` for an elided
145
- * block; runs split with `…` between) when they cover every line, else count
146
- * up from `start`.
155
+ * block, which Tern shows as a `…` gap row where the numbers jump) when they
156
+ * cover every line, else count up from `start`.
147
157
  */
148
158
  export declare function readContentCode(content: string, start: number, numbers: readonly (number | null)[] | undefined, path: string | undefined): NativeNode[];
149
159
  /** Render file, image, and URL reads in the transcript. */
package/src/tools/read.ts CHANGED
@@ -242,6 +242,20 @@ export function splitInternalUrlSel(
242
242
  return { path, sel: chunks.join(":") };
243
243
  }
244
244
 
245
+ /** A read query after a filesystem path: `?key=` (`?q=…`, `?limit=…&where=…`), not a `\\?\` long-path prefix. */
246
+ const READ_QUERY_RE = /(?<!^\\\\)\?\w+=/;
247
+
248
+ /**
249
+ * Split a filesystem read target from its query (`data.json?q=.items` →
250
+ * `data.json`, `?q=.items`), the display twin of the read tool's JSON, SQLite
251
+ * and image-question parsers. URLs own their query string and stay whole, as
252
+ * does a `?` inside a file name.
253
+ */
254
+ export function splitReadQuery(readPath: string): { path: string; query?: string } {
255
+ const at = splitUrlScheme(readPath) ? -1 : readPath.search(READ_QUERY_RE);
256
+ return at > 0 ? { path: readPath.slice(0, at), query: readPath.slice(at) } : { path: readPath };
257
+ }
258
+
245
259
  /** Recognize HTTP URLs and www-prefixed external read targets. */
246
260
  export function isReadableUrlPath(value: string): boolean {
247
261
  return /^https?:\/\/?/i.test(value) || /^www\./i.test(value);
@@ -466,11 +480,11 @@ function readRangeStart(rawPath: string, args: ReadRenderArgs | undefined): numb
466
480
  }
467
481
 
468
482
  /**
469
- * Read content as numbered, wrapped `code` (no path header: the head names
470
- * the file), matching the ANSI preview's hanging wrap. Numbers come from
483
+ * Read content as one numbered, wrapped `code` block (no path header: the head
484
+ * names the file), matching the ANSI preview's hanging wrap. Numbers come from
471
485
  * `lineNumbers` (`displayContent`'s per-line numbers, `null` for an elided
472
- * block; runs split with `…` between) when they cover every line, else count
473
- * up from `start`.
486
+ * block, which Tern shows as a `…` gap row where the numbers jump) when they
487
+ * cover every line, else count up from `start`.
474
488
  */
475
489
  export function readContentCode(
476
490
  content: string,
@@ -479,10 +493,11 @@ export function readContentCode(
479
493
  path: string | undefined,
480
494
  ): NativeNode[] {
481
495
  const lines = content.split("\n");
482
- return numberedCode(
496
+ const block = numberedCode(
483
497
  lines.map((text, i) => ({ n: numbers && numbers.length === lines.length ? numbers[i]! : start + i, text })),
484
498
  { path, wrap: true },
485
499
  );
500
+ return block ? [block] : [];
486
501
  }
487
502
 
488
503
  /** An image content block as the read tool emits it (base64 data + mime type). */
@@ -36,6 +36,8 @@ export interface RenderResultOptions {
36
36
  cancelled?: boolean;
37
37
  /** The native host shows files by path (`cx.supports("media")`). Native describe hooks only. */
38
38
  media?: boolean;
39
+ /** The native host draws raw JSON values (`cx.supports("json")`). Native describe hooks only. */
40
+ json?: boolean;
39
41
  }
40
42
  /** Render options for a result, plus the tool-specific context the transcript threads through. */
41
43
  export type RenderResultContextOptions = RenderResultOptions & {
@@ -37,6 +37,8 @@ export interface RenderResultOptions {
37
37
  cancelled?: boolean;
38
38
  /** The native host shows files by path (`cx.supports("media")`). Native describe hooks only. */
39
39
  media?: boolean;
40
+ /** The native host draws raw JSON values (`cx.supports("json")`). Native describe hooks only. */
41
+ json?: boolean;
40
42
  }
41
43
 
42
44
  /** Render options for a result, plus the tool-specific context the transcript threads through. */
@@ -177,6 +177,17 @@ export declare function truncateLineBytes(line: string, maxBytes?: number): {
177
177
  text: string;
178
178
  wasTruncated: boolean;
179
179
  };
180
+ /**
181
+ * Where `text` shows in `output` written through an {@link OutputSink} with
182
+ * `maxColumns`, searching from `from`: each of its lines whole, or, where the
183
+ * cap cut the output line, a head of it and `…` ending that output line.
184
+ * Only the first line can be cut short of its first 16 characters (after
185
+ * other text on its output line); such text is not found.
186
+ */
187
+ export declare function findColumnCapped(output: string, text: string, from?: number): {
188
+ start: number;
189
+ end: number;
190
+ } | undefined;
180
191
  /** Shared helper to build a no-truncation result. */
181
192
  export declare function noTruncResult(content: string, totalLines?: number, totalBytes?: number): TruncationResult;
182
193
  /**
@@ -323,6 +323,47 @@ export function truncateLineBytes(
323
323
  return { text: materializeString(`${head}…`), wasTruncated: true };
324
324
  }
325
325
 
326
+ /** Leading characters of a text's first line {@link findColumnCapped} searches for. */
327
+ const CAPPED_PROBE_CHARS = 16;
328
+
329
+ /**
330
+ * Where `text` shows in `output` written through an {@link OutputSink} with
331
+ * `maxColumns`, searching from `from`: each of its lines whole, or, where the
332
+ * cap cut the output line, a head of it and `…` ending that output line.
333
+ * Only the first line can be cut short of its first 16 characters (after
334
+ * other text on its output line); such text is not found.
335
+ */
336
+ export function findColumnCapped(output: string, text: string, from = 0): { start: number; end: number } | undefined {
337
+ if (!text) return undefined;
338
+ const lines = text.split(NL);
339
+ const probe = lines[0] ? lines[0].slice(0, CAPPED_PROBE_CHARS) : NL;
340
+ for (let at = output.indexOf(probe, from); at !== -1; at = output.indexOf(probe, at + 1)) {
341
+ const end = cappedLinesEnd(output, at, lines);
342
+ if (end !== undefined) return { start: at, end };
343
+ }
344
+ return undefined;
345
+ }
346
+
347
+ /** End of `lines` shown in column-capped `output` from `at`, if they show there. */
348
+ function cappedLinesEnd(output: string, at: number, lines: readonly string[]): number | undefined {
349
+ let pos = at;
350
+ for (let i = 0; i < lines.length; i++) {
351
+ const line = lines[i];
352
+ const last = i === lines.length - 1;
353
+ if (output.startsWith(line, pos) && (last || output[pos + line.length] === NL)) {
354
+ pos += last ? line.length : line.length + 1;
355
+ continue;
356
+ }
357
+ let eol = output.indexOf(NL, pos);
358
+ if (eol === -1) eol = output.length;
359
+ if (eol === pos || output[eol - 1] !== ELLIPSIS || !line.startsWith(output.slice(pos, eol - 1))) return undefined;
360
+ if (last) return eol;
361
+ if (eol === output.length) return undefined;
362
+ pos = eol + 1;
363
+ }
364
+ return pos;
365
+ }
366
+
326
367
  // =============================================================================
327
368
  // Content truncation (line + byte aware, no full Buffer allocation)
328
369
  // =============================================================================
@@ -1,9 +1,10 @@
1
1
  import type { Usage } from "@linxiraos/pi-ai";
2
2
  import type { ThemeColor } from "../theme/theme";
3
3
  import type { ConfiguredThinkingLevel } from "../render/render-utils";
4
- import type { RenderResultOptions, NativeToolView, ToolRenderResult } from "./renderer";
5
4
  import { type Component } from "../tui";
5
+ import type { RenderResultOptions } from "./renderer";
6
6
  import { type Theme } from "../theme/theme";
7
+ import type { NativeToolView, ToolRenderResult } from "./renderer";
7
8
  /** Render context threaded in from `ToolExecutionComponent.#buildRenderContext`. */
8
9
  interface TaskRenderContext {
9
10
  hasResult?: boolean;
@@ -103,10 +104,11 @@ export interface TaskItem {
103
104
  agent?: string;
104
105
  /** Historical source session selected by the bundled consult agent. */
105
106
  sourceSession?: string;
106
- /** Optional model selector override for the historical source session. */
107
+ /** Bundled seance: override for the source session's saved model. Any other agent: one exact per-call model, gated by `task.perCallModel`. */
107
108
  model?: string | string[];
108
- /** The work; required by the schema. */
109
+ /** Inline instructions; exactly one of task or taskFile is required. */
109
110
  task?: string;
111
+ taskFile?: string;
110
112
  /** How open-ended the work is; required by the schema and the child's sole `auto` thinking classification input. */
111
113
  solutionSpace?: string;
112
114
  /** Per-spawn thinking effort: lowest/middle/highest level the resolved model supports. Overrides the agent's default selector (e.g. `auto`). */
@@ -133,10 +135,12 @@ export interface TaskParams {
133
135
  agent?: string;
134
136
  /** Historical source session selected by the bundled consult agent. */
135
137
  sourceSession?: string;
136
- /** Optional model selector override for the historical source session. */
138
+ /** See {@link TaskItem.model}. */
137
139
  model?: string | string[];
138
140
  /** The work (flat form). */
139
141
  task?: string;
142
+ /** Absolute path or local:// URL to a UTF-8 file (flat form), mutually exclusive with task. */
143
+ taskFile?: string;
140
144
  /** How open-ended the work is (flat form); see {@link TaskItem.solutionSpace}. */
141
145
  solutionSpace?: string;
142
146
  /** Per-spawn thinking effort (flat form): lowest/middle/highest level the resolved model supports. */
@@ -212,6 +216,9 @@ export interface AgentProgress {
212
216
  status: "pending" | "running" | "completed" | "failed" | "aborted";
213
217
  task: string;
214
218
  assignment?: string;
219
+ taskFile?: string;
220
+ /** SHA-256 of the exact task file bytes before decoding and trimming. */
221
+ taskFileSha256?: string;
215
222
  description?: string;
216
223
  lastIntent?: string;
217
224
  currentTool?: string;
@@ -319,6 +326,8 @@ export interface SingleResult {
319
326
  agentSource: AgentSource;
320
327
  task: string;
321
328
  assignment?: string;
329
+ taskFile?: string;
330
+ taskFileSha256?: string;
322
331
  description?: string;
323
332
  lastIntent?: string;
324
333
  exitCode: number;