@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
@@ -3,7 +3,7 @@ import type { CompactionSettings } from "@linxiraos/pi-agent-core/compaction";
3
3
  import { effectiveReserveTokens, resolveThresholdTokens } from "@linxiraos/pi-agent-core/compaction";
4
4
  import type { Tool as AiTool, Model } from "@linxiraos/pi-ai";
5
5
  import { renderToolExamples } from "@linxiraos/pi-ai/dialect";
6
- import { toolWireSchema } from "@linxiraos/pi-ai/utils/schema";
6
+ import { stripSchemaDescriptions, toolWireSchema } from "@linxiraos/pi-ai/utils/schema";
7
7
 
8
8
  interface ContextSkill {
9
9
  readonly name: string;
@@ -128,6 +128,11 @@ export interface NonMessageTokenSource {
128
128
  readonly state?: {
129
129
  readonly tools?: readonly ContextTool[];
130
130
  };
131
+ /**
132
+ * Whether requests to `model` ship description-stripped tool specs because
133
+ * the catalog rides in the system prompt (`Agent.prunesToolDescriptions`).
134
+ */
135
+ prunesToolDescriptions?(model: Model | undefined): boolean;
131
136
  };
132
137
  readonly skills?: readonly ContextSkill[];
133
138
  /** Provider-facing, session-frozen descriptions when available. */
@@ -166,7 +171,10 @@ type ToolSchemaSource = readonly ContextTool[];
166
171
 
167
172
  interface ToolSchemaTokenCache {
168
173
  revision: number;
169
- byTokenizer: WeakMap<Tokenizer, { revision: number; sourceRevision: number; tokens: number }>;
174
+ byTokenizer: WeakMap<
175
+ Tokenizer,
176
+ { revision: number; sourceRevision: number; pruneDescriptions: boolean; tokens: number }
177
+ >;
170
178
  }
171
179
 
172
180
  /**
@@ -216,12 +224,24 @@ export interface ToolSchemaFragments {
216
224
  readonly schemaError?: string;
217
225
  }
218
226
 
227
+ /** How {@link toolSchemaFragments} renders one tool definition. */
228
+ export interface ToolSchemaFragmentOptions {
229
+ /** Also return `display`: the same fragments with the schema JSON indented by this many spaces. */
230
+ displayIndent?: number;
231
+ /**
232
+ * Mirror `normalizeTools({ pruneDescriptions: true })`: the wire spec is the
233
+ * name plus the description-stripped schema, with no description or examples.
234
+ */
235
+ pruneDescriptions?: boolean;
236
+ }
237
+
219
238
  /**
220
239
  * Provider-visible text of one tool definition. `displayIndent` additionally
221
240
  * returns `display`, the same fragments with the schema JSON indented, from
222
241
  * the same schema conversion.
223
242
  */
224
- export function toolSchemaFragments(tool: ContextTool, displayIndent?: number): ToolSchemaFragments {
243
+ export function toolSchemaFragments(tool: ContextTool, options: ToolSchemaFragmentOptions = {}): ToolSchemaFragments {
244
+ const { displayIndent, pruneDescriptions = false } = options;
225
245
  // Extension-supplied tools may carry a non-string name/description or a
226
246
  // parameters value whose wire schema stringifies to `undefined` (e.g. a
227
247
  // callable schema that escaped normalization). A non-string fragment is
@@ -234,7 +254,7 @@ export function toolSchemaFragments(tool: ContextTool, displayIndent?: number):
234
254
  display?.push(shown);
235
255
  };
236
256
  if (typeof name === "string") push(name);
237
- if (typeof description === "string") push(description);
257
+ if (!pruneDescriptions && typeof description === "string") push(description);
238
258
  try {
239
259
  const wireTool: AiTool = {
240
260
  name,
@@ -242,12 +262,14 @@ export function toolSchemaFragments(tool: ContextTool, displayIndent?: number):
242
262
  parameters: parameters as AiTool["parameters"],
243
263
  examples: tool.examples,
244
264
  };
245
- const wireSchema = toolWireSchema(wireTool) ?? {};
265
+ const fullSchema = toolWireSchema(wireTool) ?? {};
266
+ const wireSchema = pruneDescriptions ? stripSchemaDescriptions(fullSchema) : fullSchema;
246
267
  const wireJson = JSON.stringify(wireSchema);
247
268
  if (typeof wireJson === "string")
248
269
  push(wireJson, display ? JSON.stringify(wireSchema, null, displayIndent) : wireJson);
249
- // The agent loop appends rendered examples to the wire description.
250
- const examplesBlock = renderToolExamples(wireTool);
270
+ // The agent loop appends rendered examples to the wire description,
271
+ // which pruning empties.
272
+ const examplesBlock = pruneDescriptions ? undefined : renderToolExamples(wireTool);
251
273
  if (examplesBlock) push(examplesBlock);
252
274
  } catch (error) {
253
275
  // Schema may contain functions or cycles.
@@ -256,23 +278,41 @@ export function toolSchemaFragments(tool: ContextTool, displayIndent?: number):
256
278
  return { fragments, display };
257
279
  }
258
280
 
281
+ /** Inputs that select which tool-schema estimate applies, beyond the roster and tokenizer. */
282
+ export interface ToolSchemaEstimateOptions {
283
+ /** Caller settings/source revision; a change invalidates the cached estimate. */
284
+ sourceRevision?: number;
285
+ /** Count the description-stripped specs sent when the catalog rides in the system prompt. */
286
+ pruneDescriptions?: boolean;
287
+ }
288
+
259
289
  /**
260
290
  * Estimate provider-visible tool-schema tokens.
261
291
  *
262
292
  * Results are cached by roster-array identity, tokenizer identity, the
263
- * caller-supplied settings/source revision, and the roster's explicit dynamic
264
- * metadata revision. Callers whose descriptions or schemas are live getters
265
- * must either advance `sourceRevision` or call
293
+ * caller-supplied settings/source revision, the prune mode, and the roster's
294
+ * explicit dynamic metadata revision. Callers whose descriptions or schemas are
295
+ * live getters must either advance `sourceRevision` or call
266
296
  * {@link invalidateToolSchemaMetadata} when those inputs change.
267
297
  */
268
- export function estimateToolSchemaTokens(tools: ToolSchemaSource, tokenizer: Tokenizer, sourceRevision = 0): number {
298
+ export function estimateToolSchemaTokens(
299
+ tools: ToolSchemaSource,
300
+ tokenizer: Tokenizer,
301
+ options: ToolSchemaEstimateOptions = {},
302
+ ): number {
303
+ const { sourceRevision = 0, pruneDescriptions = false } = options;
269
304
  const cache = toolSchemaTokenCache(tools);
270
305
  const cached = cache.byTokenizer.get(tokenizer);
271
- if (cached?.revision === cache.revision && cached.sourceRevision === sourceRevision) return cached.tokens;
306
+ if (
307
+ cached?.revision === cache.revision &&
308
+ cached.sourceRevision === sourceRevision &&
309
+ cached.pruneDescriptions === pruneDescriptions
310
+ )
311
+ return cached.tokens;
272
312
 
273
- const fragments = tools.flatMap(tool => toolSchemaFragments(tool).fragments);
313
+ const fragments = tools.flatMap(tool => toolSchemaFragments(tool, { pruneDescriptions }).fragments);
274
314
  const tokens = tokenizer.countTokens(fragments);
275
- cache.byTokenizer.set(tokenizer, { revision: cache.revision, sourceRevision, tokens });
315
+ cache.byTokenizer.set(tokenizer, { revision: cache.revision, sourceRevision, pruneDescriptions, tokens });
276
316
  return tokens;
277
317
  }
278
318
 
@@ -281,9 +321,9 @@ export function estimateContextToolSchemaTokens(
281
321
  tools: ToolSchemaSource,
282
322
  tokenizer: Tokenizer,
283
323
  model: Model | undefined,
284
- sourceRevision = 0,
324
+ options: ToolSchemaEstimateOptions = {},
285
325
  ): number {
286
- return model?.toolSchemasInContext === false ? 0 : estimateToolSchemaTokens(tools, tokenizer, sourceRevision);
326
+ return model?.toolSchemasInContext === false ? 0 : estimateToolSchemaTokens(tools, tokenizer, options);
287
327
  }
288
328
 
289
329
  /**
@@ -293,15 +333,17 @@ export function estimateContextToolSchemaTokens(
293
333
  *
294
334
  * Exposed so callers like `StatusLineComponent` can cache the non-message
295
335
  * total separately from the growing message total. A model switch can change
296
- * which tool schemas occupy context without changing the roster.
336
+ * which tool schemas occupy context without changing the roster; a prune-mode
337
+ * change (`Agent.prunesToolDescriptions`) changes how much of each spec ships.
297
338
  */
298
339
  // The per-turn threshold and compaction paths call these helpers repeatedly.
299
- // Cache by prompt, roster, skills, tokenizer, revision, and model schema policy;
300
- // setSystemPrompt/setTools replace their arrays rather than mutating them.
340
+ // Cache by prompt, roster, skills, tokenizer, revision, model schema policy, and
341
+ // prune mode; setSystemPrompt/setTools replace their arrays rather than mutating them.
301
342
  interface NonMessageTokenCache {
302
343
  systemPromptRef: readonly string[];
303
344
  toolsRef: ToolSchemaSource;
304
345
  toolSchemasInContext: boolean;
346
+ pruneToolDescriptions: boolean;
305
347
  toolsRevision: number;
306
348
  sourceRevision: number;
307
349
  skillful: boolean;
@@ -335,6 +377,7 @@ function nonMessageTokenCacheEntry(
335
377
  const systemPromptRef = session.systemPrompt ?? EMPTY_STRING_PARTS;
336
378
  const toolsRef = session.agent?.state?.tools ?? EMPTY_TOOLS;
337
379
  const toolSchemasInContext = session.model?.toolSchemasInContext !== false;
380
+ const pruneToolDescriptions = session.agent?.prunesToolDescriptions?.(session.model) === true;
338
381
  const toolsRevision = getToolSchemaMetadataRevision(toolsRef);
339
382
  const skillsRef = session.renderedSkills ?? session.skills ?? EMPTY_SKILLS;
340
383
  let entry = cachedSession[NON_MESSAGE_TOKEN_CACHE];
@@ -343,6 +386,7 @@ function nonMessageTokenCacheEntry(
343
386
  entry.systemPromptRef === systemPromptRef &&
344
387
  entry.toolsRef === toolsRef &&
345
388
  entry.toolSchemasInContext === toolSchemasInContext &&
389
+ entry.pruneToolDescriptions === pruneToolDescriptions &&
346
390
  entry.toolsRevision === toolsRevision &&
347
391
  entry.sourceRevision === sourceRevision &&
348
392
  entry.skillsRef === skillsRef &&
@@ -354,6 +398,7 @@ function nonMessageTokenCacheEntry(
354
398
  systemPromptRef,
355
399
  toolsRef,
356
400
  toolSchemasInContext,
401
+ pruneToolDescriptions,
357
402
  toolsRevision,
358
403
  sourceRevision,
359
404
  skillful: true,
@@ -377,7 +422,10 @@ export function computeNonMessageTokens(
377
422
  const tools = session.agent?.state?.tools ?? EMPTY_TOOLS;
378
423
  const tokens =
379
424
  tokenizer.countTokens(Array.from(systemPromptParts, part => part ?? "")) +
380
- estimateContextToolSchemaTokens(tools, tokenizer, session.model, sourceRevision);
425
+ estimateContextToolSchemaTokens(tools, tokenizer, session.model, {
426
+ sourceRevision,
427
+ pruneDescriptions: entry.pruneToolDescriptions,
428
+ });
381
429
  entry.tokens = tokens;
382
430
  return tokens;
383
431
  }
@@ -409,7 +457,10 @@ export function computeNonMessageBreakdown(
409
457
  renderedSkills(session.renderedSkills ?? session.skills ?? EMPTY_SKILLS, tools),
410
458
  tokenizer,
411
459
  );
412
- const toolsTokens = estimateContextToolSchemaTokens(tools, tokenizer, session.model, sourceRevision);
460
+ const toolsTokens = estimateContextToolSchemaTokens(tools, tokenizer, session.model, {
461
+ sourceRevision,
462
+ pruneDescriptions: entry.pruneToolDescriptions,
463
+ });
413
464
  const systemPromptParts = session.systemPrompt ?? EMPTY_STRING_PARTS;
414
465
  const systemContextTokens = tokenizer.countTokens(Array.from(systemPromptParts.slice(1), part => part ?? ""));
415
466
  const systemPromptTokens = Math.max(0, tokenizer.countTokens(systemPromptParts[0] ?? "") - skillsTokens);
@@ -102,8 +102,12 @@ export interface StatusLineHost<TSession extends StatusLineSession = StatusLineS
102
102
  calculateTokensPerSecond(messages: readonly AgentMessage[], isStreaming: boolean): number | null;
103
103
  limitMatchesActiveAccount(report: UsageReport, limit: UsageLimit, identity: StatusAccountIdentity): boolean;
104
104
  classifyResetExpiry?(report: UsageReport, nowMs: number): StatusResetExpiry | undefined;
105
- /** One-line warning for saved resets anywhere in the pool that expire within 24 hours. */
106
- resetExpiryNotice?(reports: readonly UsageReport[], nowMs: number): string | undefined;
105
+ /**
106
+ * One-line warning for saved resets anywhere in the pool that are about to expire.
107
+ * The host owns deduplication: a returned warning counts as shown, so each saved
108
+ * reset is warned about once, not once per refresh or conversation.
109
+ */
110
+ resetExpiryNotice?(session: TSession, reports: readonly UsageReport[], nowMs: number): string | undefined;
107
111
  computeCompactionBoundaries(session: TSession, contextWindow: number, model?: Model): CompactionBoundaries | null;
108
112
  }
109
113
 
@@ -13,9 +13,9 @@
13
13
  * statusLine.attachToEditor(editor, getComposerStyle(shape));
14
14
  * ```
15
15
  */
16
+ import { type } from "@linxiraos/pi-omptype";
16
17
  import type { ThinkingLevel } from "@linxiraos/pi-agent-core";
17
18
  import type { Model } from "@linxiraos/pi-catalog/types";
18
- import { isRecord } from "@linxiraos/pi-utils/type-guards";
19
19
  import { parseThinkingLevel } from "../thinking";
20
20
  import { StatusLineComponent } from "./component";
21
21
  import type { CompactionBoundaries } from "./context-usage";
@@ -100,82 +100,48 @@ export function createStartupStatusLine(data: StatusLineStartupData): StatusLine
100
100
  return statusLine;
101
101
  }
102
102
 
103
- function isOneOf<T extends string>(values: readonly T[], value: unknown): value is T {
104
- return typeof value === "string" && values.some(candidate => candidate === value);
105
- }
106
-
107
- function isOptionalBoolean(value: unknown): boolean {
108
- return value === undefined || typeof value === "boolean";
109
- }
110
-
111
- function isSegmentList(value: unknown): boolean {
112
- return value === undefined || (Array.isArray(value) && value.every(id => isOneOf(STATUS_LINE_SEGMENT_IDS, id)));
113
- }
103
+ const SegmentIds = type.enumerated(...STATUS_LINE_SEGMENT_IDS).array();
114
104
 
115
105
  /** Shallow check of persisted settings; nested segment options are trusted as written by this version. */
116
- function isStatusLineSettings(value: unknown): value is StatusLineSettings {
117
- return (
118
- isRecord(value) &&
119
- (value.preset === undefined || isOneOf(STATUS_LINE_PRESET_VALUES, value.preset)) &&
120
- isSegmentList(value.leftSegments) &&
121
- isSegmentList(value.rightSegments) &&
122
- (value.separator === undefined || isOneOf(STATUS_LINE_SEPARATOR_VALUES, value.separator)) &&
123
- (value.segmentOptions === undefined || isRecord(value.segmentOptions)) &&
124
- (value.contextLine === undefined || isOneOf(CONTEXT_LINE_MODE_VALUES, value.contextLine)) &&
125
- isOptionalBoolean(value.showHookStatus) &&
126
- isOptionalBoolean(value.sessionAccent) &&
127
- isOptionalBoolean(value.transparent) &&
128
- isOptionalBoolean(value.compactThinkingLevel)
129
- );
130
- }
131
-
132
- /** Check the model fields the status line reads; the rest is trusted as serialized by this version. */
133
- function isPersistedModel(value: unknown): value is Model {
134
- return (
135
- isRecord(value) &&
136
- typeof value.id === "string" &&
137
- typeof value.name === "string" &&
138
- typeof value.provider === "string" &&
139
- typeof value.api === "string" &&
140
- typeof value.contextWindow === "number"
141
- );
142
- }
106
+ const StatusLineSettingsShape = type({
107
+ "preset?": type.enumerated(...STATUS_LINE_PRESET_VALUES),
108
+ "leftSegments?": SegmentIds,
109
+ "rightSegments?": SegmentIds,
110
+ "separator?": type.enumerated(...STATUS_LINE_SEPARATOR_VALUES),
111
+ "segmentOptions?": "Record<string, unknown>",
112
+ "contextLine?": type.enumerated(...CONTEXT_LINE_MODE_VALUES),
113
+ "showHookStatus?": "boolean",
114
+ "sessionAccent?": "boolean",
115
+ "transparent?": "boolean",
116
+ "compactThinkingLevel?": "boolean",
117
+ });
143
118
 
144
- function readCompactionBoundaries(value: unknown): CompactionBoundaries | null | undefined {
145
- if (value === null) return null;
146
- if (!isRecord(value) || typeof value.thresholdPercent !== "number") return undefined;
147
- const speculationPercent = value.speculationPercent;
148
- if (speculationPercent !== null && typeof speculationPercent !== "number") return undefined;
149
- return { thresholdPercent: value.thresholdPercent, speculationPercent };
150
- }
119
+ const StartupDataShape = type({
120
+ "+": "delete",
121
+ settings: StatusLineSettingsShape,
122
+ gitEnabled: "boolean",
123
+ // Only the fields the status line reads; the rest is trusted as serialized by this version.
124
+ "model?": { id: "string", name: "string", provider: "string", api: "string", contextWindow: "number" },
125
+ "thinkingLevel?": "string",
126
+ autoThinking: "boolean",
127
+ fastMode: "boolean",
128
+ usingSubscription: "boolean",
129
+ autoCompactEnabled: "boolean",
130
+ compactionBoundaries: type({ "+": "delete", thresholdPercent: "number", speculationPercent: "number | null" }).or(
131
+ "null",
132
+ ),
133
+ });
151
134
 
152
135
  /** Validate persisted {@link StatusLineStartupData}; `undefined` for anything malformed. */
153
136
  export function readStatusLineStartupData(value: unknown): StatusLineStartupData | undefined {
154
- if (!isRecord(value) || !isStatusLineSettings(value.settings)) return undefined;
155
- const model = value.model;
156
- if (model !== undefined && !isPersistedModel(model)) return undefined;
157
- const thinkingLevel = typeof value.thinkingLevel === "string" ? parseThinkingLevel(value.thinkingLevel) : undefined;
158
- if (value.thinkingLevel !== undefined && thinkingLevel === undefined) return undefined;
159
- const compactionBoundaries = readCompactionBoundaries(value.compactionBoundaries);
160
- if (
161
- typeof value.gitEnabled !== "boolean" ||
162
- typeof value.autoThinking !== "boolean" ||
163
- typeof value.fastMode !== "boolean" ||
164
- typeof value.usingSubscription !== "boolean" ||
165
- typeof value.autoCompactEnabled !== "boolean" ||
166
- compactionBoundaries === undefined
167
- ) {
168
- return undefined;
169
- }
137
+ const data = StartupDataShape(value);
138
+ if (data instanceof type.errors) return undefined;
139
+ const thinkingLevel = data.thinkingLevel === undefined ? undefined : parseThinkingLevel(data.thinkingLevel);
140
+ if (data.thinkingLevel !== undefined && thinkingLevel === undefined) return undefined;
170
141
  return {
171
- settings: value.settings,
172
- gitEnabled: value.gitEnabled,
173
- model,
142
+ ...data,
143
+ settings: data.settings as StatusLineSettings,
144
+ model: data.model as Model | undefined,
174
145
  thinkingLevel,
175
- autoThinking: value.autoThinking,
176
- fastMode: value.fastMode,
177
- usingSubscription: value.usingSubscription,
178
- autoCompactEnabled: value.autoCompactEnabled,
179
- compactionBoundaries,
180
146
  };
181
147
  }
@@ -18,7 +18,7 @@ export declare enum NotifyProtocol {
18
18
  Osc99 = "\u001B]99;;",
19
19
  Osc9 = "\u001B]9;"
20
20
  }
21
- export type TerminalId = "kitty" | "ghostty" | "wezterm" | "iterm2" | "vscode" | "alacritty" | "warp" | "orca" | "otty" | "rio" | "tern" | "monstar" | "zetawork" | "base" | "trueColor";
21
+ export type TerminalId = "kitty" | "ghostty" | "wezterm" | "iterm2" | "vscode" | "alacritty" | "warp" | "orca" | "otty" | "rio" | "tern" | "monstar" | "rex" | "zetawork" | "base" | "trueColor";
22
22
  /** Terminal capability details used for rendering and protocol selection. */
23
23
  export declare class TerminalInfo {
24
24
  readonly id: TerminalId;
@@ -67,6 +67,7 @@ export type TerminalId =
67
67
  | "rio"
68
68
  | "tern"
69
69
  | "monstar"
70
+ | "rex"
70
71
  | "zetawork"
71
72
  | "base"
72
73
  | "trueColor";
@@ -644,6 +645,8 @@ const KNOWN_TERMINALS = Object.freeze({
644
645
  // OSC 99, and OSC 66 text sizing are outside rio's supported set and keep
645
646
  // the conservative defaults.
646
647
  rio: new TerminalInfo("rio", ImageProtocol.Kitty, true, true),
648
+ // Rex (TERM_PROGRAM=rex / TERM=xterm-rex): only Kitty graphics is confirmed.
649
+ rex: new TerminalInfo("rex", ImageProtocol.Kitty, true, false),
647
650
  // Tern (Stencil's terminal, `stencil-term`) sets TERM_PROGRAM=tern and
648
651
  // implements Kitty graphics, OSC 8 and OSC 9/99 notifications. Whether zeta
649
652
  // renders natively (Tern Surface Protocol) is decided by the `hello`
@@ -693,6 +696,7 @@ export function detectTerminalId(env: NodeJS.ProcessEnv = Bun.env): TerminalId {
693
696
  if (caseEq(program, "rio")) return "rio";
694
697
  if (caseEq(program, "tern")) return "tern";
695
698
  if (caseEq(program, "monstar")) return "monstar";
699
+ if (caseEq(program, "rex")) return "rex";
696
700
  if (caseEq(program, "zetawork")) return "zetawork";
697
701
  return null;
698
702
  }
@@ -745,6 +749,7 @@ export function detectTerminalId(env: NodeJS.ProcessEnv = Bun.env): TerminalId {
745
749
 
746
750
  if (TERM?.toLowerCase().includes("ghostty")) return "ghostty";
747
751
  if (TERM && caseEq(TERM, "monstar")) return "monstar";
752
+ if (TERM && caseEq(TERM, "xterm-rex")) return "rex";
748
753
 
749
754
  if (COLORTERM) {
750
755
  if (caseEq(COLORTERM, "truecolor") || caseEq(COLORTERM, "24bit")) return "trueColor";
package/src/terminal.ts CHANGED
@@ -774,7 +774,8 @@ type Da1SentinelOwner =
774
774
  | { kind: "privateMode"; mode: number }
775
775
  | { kind: "osc99Probe"; id: string }
776
776
  | { kind: "glyphProtocol"; phase: "support" | "confirm" }
777
- | { kind: "tsp" };
777
+ | { kind: "tsp" }
778
+ | { kind: "drain"; answered: () => void };
778
779
 
779
780
  let nextOsc99ProbeId = 1;
780
781
 
@@ -1607,6 +1608,10 @@ export class ProcessTerminal implements Terminal {
1607
1608
  if (owner.phase === this.#glyphProtocolPhase) this.#resolveGlyphProtocolSupport(false);
1608
1609
  break;
1609
1610
  }
1611
+ case "drain": {
1612
+ owner.answered();
1613
+ break;
1614
+ }
1610
1615
  case "tsp": {
1611
1616
  // DA1 before any `tsp;r` reply: the terminal doesn't speak TSP.
1612
1617
  this.#resolveTspSupport(
@@ -2314,12 +2319,29 @@ export class ProcessTerminal implements Terminal {
2314
2319
  process.stdin.on("data", onData);
2315
2320
  const endTime = Date.now() + maxMs;
2316
2321
 
2322
+ // A terminal that answers DA1 (`#sixelSupport` is set from its first
2323
+ // reply) answers this one after everything it sent before reading it:
2324
+ // replies to output already written (TSP acks for the last frames, which
2325
+ // a terminal may send well after the idle window) are read here instead
2326
+ // of reaching the shell as typed text.
2327
+ let sentinelAnswered = true;
2328
+ if (this.#sixelSupport !== undefined && !this.#dead) {
2329
+ sentinelAnswered = false;
2330
+ this.#da1SentinelOwners.push({
2331
+ kind: "drain",
2332
+ answered: () => {
2333
+ sentinelAnswered = true;
2334
+ },
2335
+ });
2336
+ this.#safeWrite("\x1b[c");
2337
+ }
2338
+
2317
2339
  try {
2318
2340
  while (true) {
2319
2341
  const now = Date.now();
2320
2342
  const timeLeft = endTime - now;
2321
2343
  if (timeLeft <= 0) break;
2322
- if (now - lastDataTime >= idleMs) break;
2344
+ if (sentinelAnswered && now - lastDataTime >= idleMs) break;
2323
2345
  await new Promise(resolve => setTimeout(resolve, Math.min(idleMs, timeLeft)));
2324
2346
  }
2325
2347
  } finally {