@sagmans/dsh-tui 0.12.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (489) hide show
  1. package/.agents/skills/dsh-tui-dogfood/SKILL.md +18 -2
  2. package/.agents/skills/dsh-tui-dogfood/references/home-state.md +4 -4
  3. package/.agents/skills/dsh-tui-dogfood/scripts/clone-links.mjs +19 -11
  4. package/.agents/skills/dsh-tui-dogfood/scripts/run-plugin-from-worktree.sh +31 -9
  5. package/.agents/skills/dsh-tui-update-models/SKILL.md +1 -1
  6. package/.agents/skills/dsh-tui-update-models/references/model-wiring.md +6 -6
  7. package/.agents/skills/dsh-tui-update-models/scripts/dump-model-catalog.mjs +21 -13
  8. package/README.md +61 -23
  9. package/cordis.patch.yml +2 -0
  10. package/lib/agent/fork.d.ts +3 -1
  11. package/lib/agent/fork.d.ts.map +1 -1
  12. package/lib/agent/fork.js +2 -0
  13. package/lib/agent/fork.js.map +1 -1
  14. package/lib/agent/history.d.ts +14 -22
  15. package/lib/agent/history.d.ts.map +1 -1
  16. package/lib/agent/history.js +20 -14
  17. package/lib/agent/history.js.map +1 -1
  18. package/lib/agent/host.d.ts.map +1 -1
  19. package/lib/agent/host.js +6 -0
  20. package/lib/agent/host.js.map +1 -1
  21. package/lib/agent/model.d.ts +10 -8
  22. package/lib/agent/model.d.ts.map +1 -1
  23. package/lib/agent/model.js +9 -7
  24. package/lib/agent/model.js.map +1 -1
  25. package/lib/agent/present.d.ts +1 -1
  26. package/lib/agent/present.d.ts.map +1 -1
  27. package/lib/agent/present.js +1 -1
  28. package/lib/agent/present.js.map +1 -1
  29. package/lib/agent/presets.d.ts +4 -1
  30. package/lib/agent/presets.d.ts.map +1 -1
  31. package/lib/agent/presets.js +9 -2
  32. package/lib/agent/presets.js.map +1 -1
  33. package/lib/agent/projections.d.ts +8 -2
  34. package/lib/agent/projections.d.ts.map +1 -1
  35. package/lib/agent/projections.js +8 -2
  36. package/lib/agent/projections.js.map +1 -1
  37. package/lib/agent/prompt-history.d.ts +8 -48
  38. package/lib/agent/prompt-history.d.ts.map +1 -1
  39. package/lib/agent/prompt-history.js +34 -15
  40. package/lib/agent/prompt-history.js.map +1 -1
  41. package/lib/agent/status.d.ts +9 -24
  42. package/lib/agent/status.d.ts.map +1 -1
  43. package/lib/agent/status.js +7 -2
  44. package/lib/agent/status.js.map +1 -1
  45. package/lib/agent/undo.d.ts +2 -4
  46. package/lib/agent/undo.d.ts.map +1 -1
  47. package/lib/agent/undo.js +10 -5
  48. package/lib/agent/undo.js.map +1 -1
  49. package/lib/cards/composition.d.ts +7 -7
  50. package/lib/cards/composition.d.ts.map +1 -1
  51. package/lib/cards/composition.js +13 -12
  52. package/lib/cards/composition.js.map +1 -1
  53. package/lib/cards/presenter.d.ts +11 -14
  54. package/lib/cards/presenter.d.ts.map +1 -1
  55. package/lib/cards/presenter.js +40 -19
  56. package/lib/cards/presenter.js.map +1 -1
  57. package/lib/cards/preview.d.ts.map +1 -1
  58. package/lib/cards/preview.js +5 -1
  59. package/lib/cards/preview.js.map +1 -1
  60. package/lib/cards.d.ts +17 -23
  61. package/lib/cards.d.ts.map +1 -1
  62. package/lib/cards.js +27 -12
  63. package/lib/cards.js.map +1 -1
  64. package/lib/compat/probe.d.ts +2 -5
  65. package/lib/compat/probe.d.ts.map +1 -1
  66. package/lib/compat/probe.js +2 -2
  67. package/lib/compat/probe.js.map +1 -1
  68. package/lib/compat/section.d.ts +5 -4
  69. package/lib/compat/section.d.ts.map +1 -1
  70. package/lib/compat/section.js +4 -0
  71. package/lib/compat/section.js.map +1 -1
  72. package/lib/config.d.ts +0 -3
  73. package/lib/config.d.ts.map +1 -1
  74. package/lib/config.js +7 -1
  75. package/lib/config.js.map +1 -1
  76. package/lib/export.d.ts +5 -7
  77. package/lib/export.d.ts.map +1 -1
  78. package/lib/export.js +48 -10
  79. package/lib/export.js.map +1 -1
  80. package/lib/fold-cursor.d.ts +3 -3
  81. package/lib/fold-cursor.d.ts.map +1 -1
  82. package/lib/fold-cursor.js +5 -3
  83. package/lib/fold-cursor.js.map +1 -1
  84. package/lib/gates/question-card.d.ts +3 -38
  85. package/lib/gates/question-card.d.ts.map +1 -1
  86. package/lib/gates/question-card.js +13 -10
  87. package/lib/gates/question-card.js.map +1 -1
  88. package/lib/gates/questions.d.ts +14 -8
  89. package/lib/gates/questions.d.ts.map +1 -1
  90. package/lib/gates/questions.js +25 -18
  91. package/lib/gates/questions.js.map +1 -1
  92. package/lib/gates.d.ts +17 -25
  93. package/lib/gates.d.ts.map +1 -1
  94. package/lib/gates.js +2 -4
  95. package/lib/gates.js.map +1 -1
  96. package/lib/herdr/client.d.ts +10 -12
  97. package/lib/herdr/client.d.ts.map +1 -1
  98. package/lib/herdr/client.js +9 -8
  99. package/lib/herdr/client.js.map +1 -1
  100. package/lib/herdr/constants.d.ts +3 -2
  101. package/lib/herdr/constants.d.ts.map +1 -1
  102. package/lib/herdr/constants.js +3 -2
  103. package/lib/herdr/constants.js.map +1 -1
  104. package/lib/herdr/reporter.d.ts +4 -39
  105. package/lib/herdr/reporter.d.ts.map +1 -1
  106. package/lib/herdr/reporter.js +13 -19
  107. package/lib/herdr/reporter.js.map +1 -1
  108. package/lib/herdr/state.d.ts +4 -3
  109. package/lib/herdr/state.d.ts.map +1 -1
  110. package/lib/herdr/state.js +6 -5
  111. package/lib/herdr/state.js.map +1 -1
  112. package/lib/host/preset-files.d.ts +0 -17
  113. package/lib/host/preset-files.d.ts.map +1 -1
  114. package/lib/host/preset-files.js +7 -2
  115. package/lib/host/preset-files.js.map +1 -1
  116. package/lib/host/roster.d.ts +1 -1
  117. package/lib/host/roster.d.ts.map +1 -1
  118. package/lib/host/roster.js +3 -3
  119. package/lib/host/roster.js.map +1 -1
  120. package/lib/host/runner.d.ts +2 -5
  121. package/lib/host/runner.d.ts.map +1 -1
  122. package/lib/host/runner.js +2 -5
  123. package/lib/host/runner.js.map +1 -1
  124. package/lib/identity.d.ts +6 -3
  125. package/lib/identity.d.ts.map +1 -1
  126. package/lib/identity.js +18 -3
  127. package/lib/identity.js.map +1 -1
  128. package/lib/index.d.ts +2 -0
  129. package/lib/index.d.ts.map +1 -1
  130. package/lib/index.js +42 -14
  131. package/lib/index.js.map +1 -1
  132. package/lib/injection.d.ts.map +1 -1
  133. package/lib/injection.js +1 -0
  134. package/lib/injection.js.map +1 -1
  135. package/lib/input/action-catalog.d.ts.map +1 -1
  136. package/lib/input/action-catalog.js +4 -0
  137. package/lib/input/action-catalog.js.map +1 -1
  138. package/lib/input/actions.d.ts +4 -3
  139. package/lib/input/actions.d.ts.map +1 -1
  140. package/lib/input/actions.js +8 -3
  141. package/lib/input/actions.js.map +1 -1
  142. package/lib/input/completion.d.ts +3 -11
  143. package/lib/input/completion.d.ts.map +1 -1
  144. package/lib/input/completion.js +8 -6
  145. package/lib/input/completion.js.map +1 -1
  146. package/lib/input/file-index.d.ts +1 -12
  147. package/lib/input/file-index.d.ts.map +1 -1
  148. package/lib/input/file-index.js +21 -17
  149. package/lib/input/file-index.js.map +1 -1
  150. package/lib/input/file-search.d.ts +6 -3
  151. package/lib/input/file-search.d.ts.map +1 -1
  152. package/lib/input/file-search.js +29 -10
  153. package/lib/input/file-search.js.map +1 -1
  154. package/lib/input/fuzzy.d.ts +6 -12
  155. package/lib/input/fuzzy.d.ts.map +1 -1
  156. package/lib/input/fuzzy.js +18 -27
  157. package/lib/input/fuzzy.js.map +1 -1
  158. package/lib/input/ghost.d.ts +5 -5
  159. package/lib/input/ghost.d.ts.map +1 -1
  160. package/lib/input/ghost.js +4 -3
  161. package/lib/input/ghost.js.map +1 -1
  162. package/lib/input/key-press.d.ts +8 -7
  163. package/lib/input/key-press.d.ts.map +1 -1
  164. package/lib/input/key-press.js +8 -6
  165. package/lib/input/key-press.js.map +1 -1
  166. package/lib/input/keymap-conflicts.d.ts +6 -6
  167. package/lib/input/keymap-conflicts.d.ts.map +1 -1
  168. package/lib/input/keymap-conflicts.js +6 -6
  169. package/lib/input/keymap-conflicts.js.map +1 -1
  170. package/lib/input/keymap.d.ts +6 -18
  171. package/lib/input/keymap.d.ts.map +1 -1
  172. package/lib/input/keymap.js +7 -10
  173. package/lib/input/keymap.js.map +1 -1
  174. package/lib/input/match.js +4 -4
  175. package/lib/input/match.js.map +1 -1
  176. package/lib/input/submission.d.ts +7 -3
  177. package/lib/input/submission.d.ts.map +1 -1
  178. package/lib/input/submission.js +2 -2
  179. package/lib/input/submission.js.map +1 -1
  180. package/lib/input/workspace-files.d.ts +1 -2
  181. package/lib/input/workspace-files.d.ts.map +1 -1
  182. package/lib/input/workspace-files.js +20 -11
  183. package/lib/input/workspace-files.js.map +1 -1
  184. package/lib/input.d.ts +6 -0
  185. package/lib/input.d.ts.map +1 -1
  186. package/lib/input.js +34 -1
  187. package/lib/input.js.map +1 -1
  188. package/lib/install-skills.d.ts +5 -22
  189. package/lib/install-skills.d.ts.map +1 -1
  190. package/lib/install-skills.js +18 -18
  191. package/lib/install-skills.js.map +1 -1
  192. package/lib/jobs.d.ts +10 -5
  193. package/lib/jobs.d.ts.map +1 -1
  194. package/lib/jobs.js +39 -13
  195. package/lib/jobs.js.map +1 -1
  196. package/lib/keymaps.d.ts.map +1 -1
  197. package/lib/keymaps.js +2 -0
  198. package/lib/keymaps.js.map +1 -1
  199. package/lib/keys-command.d.ts +1 -1
  200. package/lib/keys-command.d.ts.map +1 -1
  201. package/lib/model-list.d.ts +0 -27
  202. package/lib/model-list.d.ts.map +1 -1
  203. package/lib/model-list.js +1 -1
  204. package/lib/model-list.js.map +1 -1
  205. package/lib/moshi.d.ts +13 -0
  206. package/lib/moshi.d.ts.map +1 -0
  207. package/lib/moshi.js +130 -0
  208. package/lib/moshi.js.map +1 -0
  209. package/lib/spacing.d.ts +0 -7
  210. package/lib/spacing.d.ts.map +1 -1
  211. package/lib/spacing.js +1 -1
  212. package/lib/spacing.js.map +1 -1
  213. package/lib/startup.d.ts +1 -1
  214. package/lib/startup.d.ts.map +1 -1
  215. package/lib/startup.js +9 -1
  216. package/lib/startup.js.map +1 -1
  217. package/lib/stash/lock.d.ts +1 -37
  218. package/lib/stash/lock.d.ts.map +1 -1
  219. package/lib/stash/lock.js +41 -35
  220. package/lib/stash/lock.js.map +1 -1
  221. package/lib/stash/paths.d.ts +8 -7
  222. package/lib/stash/paths.d.ts.map +1 -1
  223. package/lib/stash/paths.js +21 -17
  224. package/lib/stash/paths.js.map +1 -1
  225. package/lib/stash/private-fs.d.ts +14 -5
  226. package/lib/stash/private-fs.d.ts.map +1 -1
  227. package/lib/stash/private-fs.js +30 -8
  228. package/lib/stash/private-fs.js.map +1 -1
  229. package/lib/stash/schema.d.ts +3 -6
  230. package/lib/stash/schema.d.ts.map +1 -1
  231. package/lib/stash/schema.js +11 -9
  232. package/lib/stash/schema.js.map +1 -1
  233. package/lib/stash/store.d.ts +9 -40
  234. package/lib/stash/store.d.ts.map +1 -1
  235. package/lib/stash/store.js +26 -24
  236. package/lib/stash/store.js.map +1 -1
  237. package/lib/stash.d.ts +7 -11
  238. package/lib/stash.d.ts.map +1 -1
  239. package/lib/stash.js +18 -11
  240. package/lib/stash.js.map +1 -1
  241. package/lib/subagents.d.ts +9 -9
  242. package/lib/subagents.d.ts.map +1 -1
  243. package/lib/subagents.js +19 -18
  244. package/lib/subagents.js.map +1 -1
  245. package/lib/surface/appearance-preferences.d.ts.map +1 -1
  246. package/lib/surface/appearance-preferences.js +7 -0
  247. package/lib/surface/appearance-preferences.js.map +1 -1
  248. package/lib/surface/appearance.d.ts.map +1 -1
  249. package/lib/surface/appearance.js +7 -2
  250. package/lib/surface/appearance.js.map +1 -1
  251. package/lib/surface/background-work.d.ts +2 -0
  252. package/lib/surface/background-work.d.ts.map +1 -1
  253. package/lib/surface/background-work.js +45 -36
  254. package/lib/surface/background-work.js.map +1 -1
  255. package/lib/surface/commands.d.ts.map +1 -1
  256. package/lib/surface/commands.js +17 -9
  257. package/lib/surface/commands.js.map +1 -1
  258. package/lib/surface/modal-input.d.ts +4 -0
  259. package/lib/surface/modal-input.d.ts.map +1 -1
  260. package/lib/surface/modal-input.js +81 -46
  261. package/lib/surface/modal-input.js.map +1 -1
  262. package/lib/surface/model-choice.d.ts.map +1 -1
  263. package/lib/surface/model-choice.js +10 -8
  264. package/lib/surface/model-choice.js.map +1 -1
  265. package/lib/surface/plugin-actions.d.ts.map +1 -1
  266. package/lib/surface/plugin-actions.js +4 -0
  267. package/lib/surface/plugin-actions.js.map +1 -1
  268. package/lib/surface/preset-choice.d.ts.map +1 -1
  269. package/lib/surface/preset-choice.js +15 -17
  270. package/lib/surface/preset-choice.js.map +1 -1
  271. package/lib/surface/prompt-input.js +1 -1
  272. package/lib/surface/prompt-input.js.map +1 -1
  273. package/lib/surface/prompt-memory.d.ts +7 -6
  274. package/lib/surface/prompt-memory.d.ts.map +1 -1
  275. package/lib/surface/prompt-memory.js +3 -3
  276. package/lib/surface/session-lifecycle.d.ts +7 -1
  277. package/lib/surface/session-lifecycle.d.ts.map +1 -1
  278. package/lib/surface/session-lifecycle.js +17 -12
  279. package/lib/surface/session-lifecycle.js.map +1 -1
  280. package/lib/surface/session-picker.js +1 -1
  281. package/lib/surface/session-picker.js.map +1 -1
  282. package/lib/surface/session-view.d.ts +1 -1
  283. package/lib/surface/session-view.d.ts.map +1 -1
  284. package/lib/surface/session-view.js +4 -5
  285. package/lib/surface/session-view.js.map +1 -1
  286. package/lib/surface/staged-turns.d.ts.map +1 -1
  287. package/lib/surface/staged-turns.js +8 -4
  288. package/lib/surface/staged-turns.js.map +1 -1
  289. package/lib/surface/terminal-lifecycle.d.ts +1 -1
  290. package/lib/surface/terminal-lifecycle.d.ts.map +1 -1
  291. package/lib/surface/terminal-lifecycle.js +8 -5
  292. package/lib/surface/terminal-lifecycle.js.map +1 -1
  293. package/lib/terminal/bell.d.ts +0 -2
  294. package/lib/terminal/bell.d.ts.map +1 -1
  295. package/lib/terminal/bell.js +2 -1
  296. package/lib/terminal/bell.js.map +1 -1
  297. package/lib/terminal/clipboard.d.ts +4 -4
  298. package/lib/terminal/clipboard.js +4 -4
  299. package/lib/terminal/external-editor.d.ts +4 -60
  300. package/lib/terminal/external-editor.d.ts.map +1 -1
  301. package/lib/terminal/external-editor.js +28 -40
  302. package/lib/terminal/external-editor.js.map +1 -1
  303. package/lib/terminal/host-writes.d.ts +7 -18
  304. package/lib/terminal/host-writes.d.ts.map +1 -1
  305. package/lib/terminal/host-writes.js +19 -18
  306. package/lib/terminal/host-writes.js.map +1 -1
  307. package/lib/terminal/input.d.ts +6 -0
  308. package/lib/terminal/input.d.ts.map +1 -0
  309. package/lib/terminal/input.js +15 -0
  310. package/lib/terminal/input.js.map +1 -0
  311. package/lib/terminal/restore.d.ts +2 -1
  312. package/lib/terminal/restore.d.ts.map +1 -1
  313. package/lib/terminal/signals.d.ts +2 -1
  314. package/lib/terminal/signals.d.ts.map +1 -1
  315. package/lib/terminal/signals.js +1 -1
  316. package/lib/terminal/signals.js.map +1 -1
  317. package/lib/terminal/title.d.ts +1 -11
  318. package/lib/terminal/title.d.ts.map +1 -1
  319. package/lib/terminal/title.js +5 -4
  320. package/lib/terminal/title.js.map +1 -1
  321. package/lib/terminal/warning-screen.d.ts +11 -2
  322. package/lib/terminal/warning-screen.d.ts.map +1 -1
  323. package/lib/terminal/warning-screen.js +166 -22
  324. package/lib/terminal/warning-screen.js.map +1 -1
  325. package/lib/terminal-text/scan.d.ts +4 -5
  326. package/lib/terminal-text/scan.d.ts.map +1 -1
  327. package/lib/terminal-text/scan.js +16 -9
  328. package/lib/terminal-text/scan.js.map +1 -1
  329. package/lib/terminal-text/sgr.d.ts +4 -3
  330. package/lib/terminal-text/sgr.d.ts.map +1 -1
  331. package/lib/terminal-text/sgr.js +9 -14
  332. package/lib/terminal-text/sgr.js.map +1 -1
  333. package/lib/terminal-text.d.ts +7 -12
  334. package/lib/terminal-text.d.ts.map +1 -1
  335. package/lib/terminal-text.js +32 -23
  336. package/lib/terminal-text.js.map +1 -1
  337. package/lib/text.d.ts +8 -14
  338. package/lib/text.d.ts.map +1 -1
  339. package/lib/text.js +14 -15
  340. package/lib/text.js.map +1 -1
  341. package/lib/theme-capability.d.ts +3 -15
  342. package/lib/theme-capability.d.ts.map +1 -1
  343. package/lib/theme-capability.js +18 -15
  344. package/lib/theme-capability.js.map +1 -1
  345. package/lib/theme-defaults.d.ts +3 -57
  346. package/lib/theme-defaults.d.ts.map +1 -1
  347. package/lib/theme-defaults.js +25 -14
  348. package/lib/theme-defaults.js.map +1 -1
  349. package/lib/theme-files.d.ts +16 -32
  350. package/lib/theme-files.d.ts.map +1 -1
  351. package/lib/theme-files.js +43 -27
  352. package/lib/theme-files.js.map +1 -1
  353. package/lib/theme-resolver.d.ts +3 -3
  354. package/lib/theme-resolver.d.ts.map +1 -1
  355. package/lib/theme-resolver.js +9 -6
  356. package/lib/theme-resolver.js.map +1 -1
  357. package/lib/theme-schema.d.ts +7 -42
  358. package/lib/theme-schema.d.ts.map +1 -1
  359. package/lib/theme-schema.js +9 -11
  360. package/lib/theme-schema.js.map +1 -1
  361. package/lib/theme-settings.d.ts +19 -10
  362. package/lib/theme-settings.d.ts.map +1 -1
  363. package/lib/theme-settings.js +23 -17
  364. package/lib/theme-settings.js.map +1 -1
  365. package/lib/theme-tokens.d.ts +6 -12
  366. package/lib/theme-tokens.d.ts.map +1 -1
  367. package/lib/theme-tokens.js +2 -2
  368. package/lib/theme-tokens.js.map +1 -1
  369. package/lib/theme.d.ts +5 -10
  370. package/lib/theme.d.ts.map +1 -1
  371. package/lib/theme.js +11 -18
  372. package/lib/theme.js.map +1 -1
  373. package/lib/todo-guard.d.ts +8 -4
  374. package/lib/todo-guard.d.ts.map +1 -1
  375. package/lib/todo-guard.js +17 -6
  376. package/lib/todo-guard.js.map +1 -1
  377. package/lib/tokens.d.ts +0 -2
  378. package/lib/tokens.d.ts.map +1 -1
  379. package/lib/tokens.js +1 -1
  380. package/lib/tokens.js.map +1 -1
  381. package/lib/tool-display.d.ts +1 -13
  382. package/lib/tool-display.d.ts.map +1 -1
  383. package/lib/tool-display.js +4 -4
  384. package/lib/tool-display.js.map +1 -1
  385. package/lib/transcript/message-content.d.ts.map +1 -1
  386. package/lib/transcript/message-content.js +31 -9
  387. package/lib/transcript/message-content.js.map +1 -1
  388. package/lib/transcript/tool-calls.d.ts +9 -7
  389. package/lib/transcript/tool-calls.d.ts.map +1 -1
  390. package/lib/transcript/tool-calls.js +27 -20
  391. package/lib/transcript/tool-calls.js.map +1 -1
  392. package/lib/transcript.d.ts +15 -18
  393. package/lib/transcript.d.ts.map +1 -1
  394. package/lib/transcript.js +70 -41
  395. package/lib/transcript.js.map +1 -1
  396. package/lib/ui/copy.d.ts +5 -4
  397. package/lib/ui/copy.d.ts.map +1 -1
  398. package/lib/ui/copy.js +9 -6
  399. package/lib/ui/copy.js.map +1 -1
  400. package/lib/ui/diff.d.ts +0 -30
  401. package/lib/ui/diff.d.ts.map +1 -1
  402. package/lib/ui/diff.js +16 -9
  403. package/lib/ui/diff.js.map +1 -1
  404. package/lib/ui/dock.d.ts +12 -10
  405. package/lib/ui/dock.d.ts.map +1 -1
  406. package/lib/ui/dock.js +27 -14
  407. package/lib/ui/dock.js.map +1 -1
  408. package/lib/ui/editor.d.ts +5 -4
  409. package/lib/ui/editor.d.ts.map +1 -1
  410. package/lib/ui/editor.js +17 -9
  411. package/lib/ui/editor.js.map +1 -1
  412. package/lib/ui/frame.d.ts +4 -12
  413. package/lib/ui/frame.d.ts.map +1 -1
  414. package/lib/ui/frame.js +6 -6
  415. package/lib/ui/frame.js.map +1 -1
  416. package/lib/ui/gap.d.ts +0 -4
  417. package/lib/ui/gap.d.ts.map +1 -1
  418. package/lib/ui/gap.js +4 -3
  419. package/lib/ui/gap.js.map +1 -1
  420. package/lib/ui/gate-input.d.ts +3 -3
  421. package/lib/ui/gate-input.d.ts.map +1 -1
  422. package/lib/ui/gate-input.js +9 -9
  423. package/lib/ui/gate-input.js.map +1 -1
  424. package/lib/ui/layout.d.ts +1 -8
  425. package/lib/ui/layout.d.ts.map +1 -1
  426. package/lib/ui/layout.js +10 -11
  427. package/lib/ui/layout.js.map +1 -1
  428. package/lib/ui/markdown.d.ts +3 -5
  429. package/lib/ui/markdown.d.ts.map +1 -1
  430. package/lib/ui/markdown.js +18 -7
  431. package/lib/ui/markdown.js.map +1 -1
  432. package/lib/ui/mermaid.d.ts +0 -11
  433. package/lib/ui/mermaid.d.ts.map +1 -1
  434. package/lib/ui/mermaid.js +32 -17
  435. package/lib/ui/mermaid.js.map +1 -1
  436. package/lib/ui/picker-card.d.ts +4 -8
  437. package/lib/ui/picker-card.d.ts.map +1 -1
  438. package/lib/ui/picker-card.js +17 -15
  439. package/lib/ui/picker-card.js.map +1 -1
  440. package/lib/ui/picker.d.ts +11 -17
  441. package/lib/ui/picker.d.ts.map +1 -1
  442. package/lib/ui/picker.js +36 -17
  443. package/lib/ui/picker.js.map +1 -1
  444. package/lib/ui/queue.d.ts.map +1 -1
  445. package/lib/ui/queue.js +11 -1
  446. package/lib/ui/queue.js.map +1 -1
  447. package/lib/ui/stash-picker.d.ts +1 -10
  448. package/lib/ui/stash-picker.d.ts.map +1 -1
  449. package/lib/ui/stash-picker.js +4 -4
  450. package/lib/ui/stash-picker.js.map +1 -1
  451. package/lib/ui/status.d.ts +2 -19
  452. package/lib/ui/status.d.ts.map +1 -1
  453. package/lib/ui/status.js +15 -17
  454. package/lib/ui/status.js.map +1 -1
  455. package/lib/ui/view/document.d.ts +33 -0
  456. package/lib/ui/view/document.d.ts.map +1 -0
  457. package/lib/ui/view/document.js +96 -0
  458. package/lib/ui/view/document.js.map +1 -0
  459. package/lib/ui/view/gate-card.d.ts +2 -0
  460. package/lib/ui/view/gate-card.d.ts.map +1 -1
  461. package/lib/ui/view/gate-card.js +12 -10
  462. package/lib/ui/view/gate-card.js.map +1 -1
  463. package/lib/ui/view/tool-card.d.ts +7 -4
  464. package/lib/ui/view/tool-card.d.ts.map +1 -1
  465. package/lib/ui/view/tool-card.js +12 -17
  466. package/lib/ui/view/tool-card.js.map +1 -1
  467. package/lib/ui/view/transcript-message.d.ts +7 -7
  468. package/lib/ui/view/transcript-message.d.ts.map +1 -1
  469. package/lib/ui/view/transcript-message.js +19 -10
  470. package/lib/ui/view/transcript-message.js.map +1 -1
  471. package/lib/ui/view.d.ts +53 -84
  472. package/lib/ui/view.d.ts.map +1 -1
  473. package/lib/ui/view.js +79 -158
  474. package/lib/ui/view.js.map +1 -1
  475. package/lib/work.d.ts +13 -10
  476. package/lib/work.d.ts.map +1 -1
  477. package/lib/work.js +30 -8
  478. package/lib/work.js.map +1 -1
  479. package/package.json +12 -7
  480. package/presets/cordis.patch.yml +1 -0
  481. package/presets/minimal.patch.yml +1 -0
  482. package/presets/ptc.patch.yml +1 -0
  483. package/presets/standard.patch.yml +1 -0
  484. package/themes/deepseek-blue.yaml +38 -51
  485. package/themes/marine-static.yaml +27 -35
  486. package/themes/pine-slope.yaml +13 -11
  487. package/themes/polar-drift.yaml +6 -0
  488. package/themes/violet-orbit.yaml +14 -18
  489. package/themes/wine-thicket.yaml +13 -13
@@ -1,7 +1,7 @@
1
1
  import { cardFromLines } from "../cards.js";
2
2
  import { carriedFields, mergeCards, subCallRow, subCallRows, SUBCALL_MAX } from "../cards/composition.js";
3
3
  import { contentLinesOf } from "./message-content.js";
4
- /** One second in milliseconds, which is the unit a duration is reported in. */
4
+ /** Convert clock milliseconds so tool cards report elapsed time in whole seconds. */
5
5
  export const SECOND_MS = 1000;
6
6
  /** An event that changes no row. */
7
7
  const NOTHING = { appends: [], replacements: [] };
@@ -34,26 +34,30 @@ export class ToolCallFold {
34
34
  this.cardAt = cardAt;
35
35
  }
36
36
  /** Fold one tool event, which is the only family of events that owns cross-event state. */
37
- apply(type, data, landingIndex) {
37
+ apply(type, data, landingIndex, at = this.clock()) {
38
38
  switch (type) {
39
39
  case 'tool/call':
40
- return this.rootCall(data, landingIndex);
40
+ return this.rootCall(data, landingIndex, at);
41
41
  case 'tool/ptc-dispatch-start':
42
42
  return this.subCall(data, false);
43
43
  case 'tool/ptc-dispatch':
44
44
  return this.subCall(data, true);
45
45
  case 'tool/result':
46
- return this.settleResult(data);
46
+ return this.settleResult(data, at);
47
47
  default:
48
48
  return NOTHING;
49
49
  }
50
50
  }
51
+ /** Pending calls require time-only repaints even when their parent is idle. */
52
+ hasLiveCalls() {
53
+ return this.pending.size > 0;
54
+ }
51
55
  /**
52
56
  * How long one call has been in flight, or that it is not.
53
57
  *
54
- * The fold owns the request-to-result window, so a renderer asks here rather
55
- * than timing the row itself: a row read twice in one frame would otherwise
56
- * report two durations for one call.
58
+ * The fold owns the request timestamp and pending-call lifecycle, so renderers
59
+ * need not maintain a second timing state. Each read samples the clock anew;
60
+ * reads within one frame can cross a whole-second boundary.
57
61
  */
58
62
  liveCall(callId) {
59
63
  const call = callId === '' ? undefined : this.pending.get(callId);
@@ -73,20 +77,20 @@ export class ToolCallFold {
73
77
  this.pendingSub.clear();
74
78
  }
75
79
  /**
76
- * Whole seconds since a moment the fold read the clock at.
80
+ * Whole elapsed seconds preserve the original request clock across folds.
77
81
  *
78
82
  * Floored, not rounded: a duration that claims a second it has not waited yet
79
83
  * would tick up before the call has been waiting that long.
80
84
  */
81
- secondsSince(startedAt) {
82
- return Math.max(0, Math.floor((this.clock() - startedAt) / SECOND_MS));
85
+ secondsSince(startedAt, now = this.clock()) {
86
+ return Math.max(0, Math.floor((now - startedAt) / SECOND_MS));
83
87
  }
84
88
  /** The row a requested call draws, which is the row its result later replaces. */
85
- rootCall(data, landingIndex) {
89
+ rootCall(data, landingIndex, at) {
86
90
  const name = typeof data.name === 'string' ? data.name : 'tool';
87
91
  const argumentsJson = typeof data.arguments === 'string' ? data.arguments : '';
88
92
  const callId = typeof data.callId === 'string' ? data.callId : '';
89
- const card = this.presenter?.call(name, argumentsJson);
93
+ const card = this.presenter.call(name, argumentsJson);
90
94
  const entry = {
91
95
  kind: 'tool',
92
96
  // The id is what keeps a reader's click on this message after the
@@ -96,7 +100,7 @@ export class ToolCallFold {
96
100
  card: card ?? cardFromLines('generic', name, name, argumentsJson === '' ? [] : argumentsJson.split('\n'), false),
97
101
  };
98
102
  if (callId !== '')
99
- this.pending.set(callId, { name, argumentsJson, index: landingIndex, startedAt: this.clock(), subs: [] });
103
+ this.pending.set(callId, { name, argumentsJson, index: landingIndex, startedAt: at, subs: [] });
100
104
  return { appends: [entry], replacements: [] };
101
105
  }
102
106
  /**
@@ -120,7 +124,7 @@ export class ToolCallFold {
120
124
  const argumentsJson = argumentsJsonOf(data.arguments);
121
125
  // The call's own view is asked for once: it names the row and it is what the
122
126
  // row shows of the call itself, so two asks could disagree about one call.
123
- const view = this.presenter?.call(name, argumentsJson);
127
+ const view = this.presenter.call(name, argumentsJson);
124
128
  const isError = data.isError === true;
125
129
  const result = settled ? this.subCallResult(name, argumentsJson, data, view) : undefined;
126
130
  const output = result === undefined ? undefined : subCallRows(result);
@@ -177,11 +181,11 @@ export class ToolCallFold {
177
181
  */
178
182
  subCallResult(name, argumentsJson, data, view) {
179
183
  const failed = data.isError === true;
180
- return this.presenter?.result(name, { argumentsJson, content: data.content, isError: failed, meta: data.meta })
184
+ return this.presenter.result(name, { argumentsJson, content: data.content, isError: failed, meta: data.meta })
181
185
  ?? cardFromLines(view?.kind ?? 'generic', name, view?.title ?? name, contentLinesOf(data.content), failed);
182
186
  }
183
187
  /** The row a call's result settles into: the card it drew, restated with what answered it. */
184
- settleResult(data) {
188
+ settleResult(data, at) {
185
189
  const message = asRecord(data.message);
186
190
  const callId = toolCallIdOf(message);
187
191
  const pending = callId === '' ? undefined : this.pending.get(callId);
@@ -190,7 +194,7 @@ export class ToolCallFold {
190
194
  // The length of the run is readable here and nowhere else: the surface saw
191
195
  // the call logged and now sees it answered, and this is the only moment the
192
196
  // fold holds both readings of the clock.
193
- const ranFor = pending === undefined ? undefined : this.secondsSince(pending.startedAt);
197
+ const ranFor = pending === undefined ? undefined : this.secondsSince(pending.startedAt, at);
194
198
  /** The card that reports this result, carrying the seconds the call took. */
195
199
  const finished = (card) => (ranFor === undefined ? card : { ...card, elapsed: ranFor });
196
200
  // The root is done dispatching, so its bookkeeping goes with it; the rows it
@@ -200,7 +204,7 @@ export class ToolCallFold {
200
204
  this.pendingSub.delete(sub);
201
205
  const name = pending?.name ?? 'tool';
202
206
  const isError = message?.isError === true;
203
- const result = this.presenter?.result(name, {
207
+ const result = this.presenter.result(name, {
204
208
  argumentsJson: pending?.argumentsJson ?? '',
205
209
  content: message?.content,
206
210
  isError,
@@ -250,7 +254,10 @@ function toolCallIdOf(message) {
250
254
  const firstBlock = Array.isArray(message?.content) ? asRecord(message.content[0]) : undefined;
251
255
  return typeof firstBlock?.toolCallId === 'string' ? firstBlock.toolCallId : '';
252
256
  }
253
- /** The arguments a nested call was made with, as the shape a presenter is asked with. */
257
+ /**
258
+ * Missing or unserializable arguments must not discard an otherwise identifiable nested call.
259
+ * Empty text lets the fold retain the call when its arguments cannot be represented.
260
+ */
254
261
  function argumentsJsonOf(value) {
255
262
  if (value === undefined)
256
263
  return '';
@@ -261,7 +268,7 @@ function argumentsJsonOf(value) {
261
268
  return '';
262
269
  }
263
270
  }
264
- /** Narrowing for the structural event reads above; each reader keeps its own copy rather than sharing one. */
271
+ /** Non-object result envelopes must not interrupt result folding; object fields still need their own checks. */
265
272
  function asRecord(value) {
266
273
  return typeof value === 'object' && value !== null ? value : undefined;
267
274
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tool-calls.js","sourceRoot":"","sources":["../../src/transcript/tool-calls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqC,MAAM,aAAa,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEzG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAA;AA4C7B,oCAAoC;AACpC,MAA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E,EAAE,YAAY,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,EAAE,CAAA;IACpI,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,SAAS,YAAY,CAAC,OAA4C;IAChE,IAAI,OAAO,OAAO,EAAE,UAAU,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,UAAU,CAAA;IACtE,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7F,OAAO,OAAO,UAAU,EAAE,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;AAChF,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAClC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,gHAAgH;AAChH,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAE,KAAiC,CAAC,CAAC,CAAC,SAAS,CAAA;AACrG,CAAC"}
@@ -26,8 +26,6 @@ export type TranscriptEntry = {
26
26
  } | {
27
27
  readonly kind: 'step';
28
28
  };
29
- /** Reasoning kept per settled block, so one runaway thought cannot grow the transcript without bound. */
30
- export declare const REASONING_CHAR_LIMIT = 20000;
31
29
  /**
32
30
  * Minimal durable-input shape the fold needs.
33
31
  *
@@ -36,27 +34,26 @@ export declare const REASONING_CHAR_LIMIT = 20000;
36
34
  * structural keeps this file pure and testable without a live session.
37
35
  */
38
36
  export interface FoldableEvent {
37
+ /** Durable event time preserves tool durations when history is folded again. */
38
+ readonly time?: number;
39
39
  readonly type: string;
40
40
  readonly data?: unknown;
41
+ /** Legacy logs omit this marker; current context rewrites must not become new visible tool calls. */
42
+ readonly surfaceOp?: unknown;
41
43
  }
42
44
  /**
43
45
  * Fold durable session events into readable rows, and hold the in-flight
44
46
  * assistant text and reasoning apart from them.
45
47
  *
46
- * Durable events own the transcript: the live stream is decoration that a
47
- * repaint or a resume can drop without changing what the reader sees. Tool
48
+ * Keep transient stream state apart from durable rows so in-flight output
49
+ * can be cleared at turn boundaries without discarding settled history. Tool
48
50
  * rows come from the tool's own render intent, so the fold never learns a tool
49
51
  * name; the bookkeeping that a tool row's request, dispatch, and result share
50
52
  * lives in the call fold this model routes those events to.
51
53
  */
52
54
  export declare class TranscriptModel {
53
- /**
54
- * Clock for "how long has this been thinking or running"; injected so a test
55
- * can pin it and reachable through {@link now} so a renderer keys its rows
56
- * to the same one.
57
- */
58
- private readonly clock;
59
55
  private readonly settled;
56
+ private contentRevision;
60
57
  private live;
61
58
  private liveReasoning;
62
59
  private reasoningStartedAt;
@@ -77,13 +74,7 @@ export declare class TranscriptModel {
77
74
  private liveReasoningId;
78
75
  /** The call-to-row bookkeeping tool events share, told the clock and the rows this model holds. */
79
76
  private readonly calls;
80
- constructor(presenter?: ToolPresenter,
81
- /**
82
- * Clock for "how long has this been thinking or running"; injected so a test
83
- * can pin it and reachable through {@link now} so a renderer keys its rows
84
- * to the same one.
85
- */
86
- clock?: () => number);
77
+ constructor(presenter: ToolPresenter);
87
78
  /**
88
79
  * The clock every duration on a row is measured with.
89
80
  *
@@ -92,6 +83,8 @@ export declare class TranscriptModel {
92
83
  * only way for the number on screen and the cache key to agree.
93
84
  */
94
85
  now(): number;
86
+ /** Renderers retain a document until its folded content changes, independent of keyboard frames. */
87
+ get revision(): number;
95
88
  /** Rows to render: settled rows, the in-flight reasoning, then the in-flight text. */
96
89
  entries(): readonly TranscriptEntry[];
97
90
  /**
@@ -110,8 +103,10 @@ export declare class TranscriptModel {
110
103
  * otherwise report two durations for one call.
111
104
  */
112
105
  liveCall(callId: string): LiveCallState;
106
+ /** A viewed child can own a visible clock without owning the driven turn. */
107
+ hasLiveTiming(): boolean;
113
108
  reset(): void;
114
- /** Append a surface-local line that is not part of the durable conversation. */
109
+ /** Keep local command feedback visible without recording it as conversation for the agent or a later resume. */
115
110
  notice(text: string): void;
116
111
  /** Mark a boundary in the conversation: compaction, or work that ran elsewhere. */
117
112
  marker(text: string): void;
@@ -131,6 +126,8 @@ export declare class TranscriptModel {
131
126
  /** Settle the reasoning streamed so far into a row of its own. */
132
127
  private settleReasoning;
133
128
  apply(event: FoldableEvent): void;
129
+ /** Surface-local and durable rows share the revision that invalidates retained documents. */
130
+ private append;
134
131
  /** Commit the rows the call fold drew: appends in order, replacements in place. */
135
132
  private commit;
136
133
  /** The card a settled tool row holds, so the call fold can restate a row it drew earlier. */
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAKzD,OAAO,EAAgB,KAAK,aAAa,EAAwB,MAAM,4BAA4B,CAAA;AAEnG,qCAAqC;AACrC,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;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eAAe,CAAoB;IAC3C,mGAAmG;IACnG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;gBAExB,SAAS,EAAE,aAAa;IAKpC;;;;;;OAMG;IACH,GAAG,IAAI,MAAM;IAIb,oGAAoG;IACpG,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,sFAAsF;IACtF,OAAO,IAAI,SAAS,eAAe,EAAE;IAkBrC;;;;;;OAMG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa;IAIvC,6EAA6E;IAC7E,aAAa,IAAI,OAAO;IAIxB,KAAK,IAAI,IAAI;IAab,gHAAgH;IAChH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1B,mFAAmF;IACnF,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1B,kDAAkD;IAClD,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAsCtC,2FAA2F;IAC3F,OAAO,CAAC,aAAa;IAiBrB,8EAA8E;IAC9E,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKjC;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAoBtB,kEAAkE;IAClE,OAAO,CAAC,eAAe;IAYvB,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAiGjC,6FAA6F;IAC7F,OAAO,CAAC,MAAM;IAKd,mFAAmF;IACnF,OAAO,CAAC,MAAM;IAMd,6FAA6F;IAC7F,OAAO,CAAC,MAAM;CAIf"}
package/lib/transcript.js CHANGED
@@ -1,15 +1,16 @@
1
1
  import { injectionSummary } from "./injection.js";
2
+ import { describeDuration } from "./jobs.js";
2
3
  import { sliceGraphemes, tailGraphemes } from "./text.js";
3
4
  import { countTokens } from "./tokens.js";
4
5
  import { reasoningTextsOf, textOfContent } from "./transcript/message-content.js";
5
6
  import { ToolCallFold } from "./transcript/tool-calls.js";
6
7
  /** Reasoning kept per settled block, so one runaway thought cannot grow the transcript without bound. */
7
- export const REASONING_CHAR_LIMIT = 20_000;
8
+ const REASONING_CHAR_LIMIT = 20_000;
8
9
  /**
9
10
  * How far a live thought may grow past that budget before its head is dropped.
10
11
  *
11
- * The slice itself is linear, so a burst of slack makes it happen once per
12
- * thought rather than on every delta that crosses the limit.
12
+ * The slice itself is linear, so a burst of slack amortizes it across deltas
13
+ * rather than slicing on every delta that crosses the retained budget.
13
14
  */
14
15
  const LIVE_THOUGHT_SLACK = 2;
15
16
  /** The token count with its noun, because "1 tokens" reads as a bug. */
@@ -17,12 +18,17 @@ function describeTokens(text) {
17
18
  const tokens = countTokens(text);
18
19
  return `${tokens} token${tokens === 1 ? '' : 's'}`;
19
20
  }
21
+ /** Result rewrites preserve execution history, so their event type and operation distinguish context changes from completions. */
22
+ const TOOL_RESULT_EVENT = 'tool/result';
23
+ const SURFACE_REPLACEMENT = 'replace';
20
24
  function asRecord(value) {
21
25
  return typeof value === 'object' && value !== null ? value : undefined;
22
26
  }
27
+ /** Keep injected or unknown-source context from being attributed to the reader as a prompt. */
23
28
  function sourceKind(data) {
24
29
  return asRecord(data.source)?.kind === 'user' ? 'user' : 'plugin';
25
30
  }
31
+ /** Prefer readable failure text, then a code; leave unknown shapes to the caller's fallback instead of dumping objects. */
26
32
  function messageOf(value) {
27
33
  const record = asRecord(value);
28
34
  if (record === undefined)
@@ -37,15 +43,15 @@ function messageOf(value) {
37
43
  * Fold durable session events into readable rows, and hold the in-flight
38
44
  * assistant text and reasoning apart from them.
39
45
  *
40
- * Durable events own the transcript: the live stream is decoration that a
41
- * repaint or a resume can drop without changing what the reader sees. Tool
46
+ * Keep transient stream state apart from durable rows so in-flight output
47
+ * can be cleared at turn boundaries without discarding settled history. Tool
42
48
  * rows come from the tool's own render intent, so the fold never learns a tool
43
49
  * name; the bookkeeping that a tool row's request, dispatch, and result share
44
50
  * lives in the call fold this model routes those events to.
45
51
  */
46
52
  export class TranscriptModel {
47
- clock;
48
53
  settled = [];
54
+ contentRevision = 0;
49
55
  live = '';
50
56
  liveReasoning = '';
51
57
  reasoningStartedAt;
@@ -66,15 +72,9 @@ export class TranscriptModel {
66
72
  liveReasoningId;
67
73
  /** The call-to-row bookkeeping tool events share, told the clock and the rows this model holds. */
68
74
  calls;
69
- constructor(presenter,
70
- /**
71
- * Clock for "how long has this been thinking or running"; injected so a test
72
- * can pin it and reachable through {@link now} so a renderer keys its rows
73
- * to the same one.
74
- */
75
- clock = () => Date.now()) {
76
- this.clock = clock;
77
- this.calls = new ToolCallFold(presenter, clock, index => this.cardAt(index));
75
+ constructor(presenter) {
76
+ // Tool calls and renderer cache keys share the model's duration owner.
77
+ this.calls = new ToolCallFold(presenter, () => this.now(), index => this.cardAt(index));
78
78
  }
79
79
  /**
80
80
  * The clock every duration on a row is measured with.
@@ -84,19 +84,23 @@ export class TranscriptModel {
84
84
  * only way for the number on screen and the cache key to agree.
85
85
  */
86
86
  now() {
87
- return this.clock();
87
+ return Date.now();
88
+ }
89
+ /** Renderers retain a document until its folded content changes, independent of keyboard frames. */
90
+ get revision() {
91
+ return this.contentRevision;
88
92
  }
89
93
  /** Rows to render: settled rows, the in-flight reasoning, then the in-flight text. */
90
94
  entries() {
91
95
  const entries = [...this.settled];
92
96
  if (this.liveReasoning !== '') {
93
- const ranFor = this.reasoningStartedAt === undefined ? undefined : this.clock() - this.reasoningStartedAt;
97
+ const ranFor = this.reasoningStartedAt === undefined ? undefined : this.now() - this.reasoningStartedAt;
94
98
  entries.push({
95
99
  kind: 'reasoning',
96
100
  // The live row and the row it settles into share an id, so a click made
97
101
  // while the model is still thinking survives the thought landing.
98
102
  id: this.liveReasoningId ?? '',
99
- summary: `reasoning · ${describeTokens(this.liveReasoning)}${ranFor === undefined ? '' : ` · ${Math.max(1, Math.round(ranFor / 1000))}s`} · streaming`,
103
+ summary: `reasoning · ${describeTokens(this.liveReasoning)}${ranFor === undefined ? '' : ` · ${describeDuration(ranFor)}`} · streaming`,
100
104
  body: this.liveReasoning,
101
105
  live: true,
102
106
  });
@@ -125,7 +129,12 @@ export class TranscriptModel {
125
129
  liveCall(callId) {
126
130
  return this.calls.liveCall(callId);
127
131
  }
132
+ /** A viewed child can own a visible clock without owning the driven turn. */
133
+ hasLiveTiming() {
134
+ return this.liveReasoning !== '' || this.calls.hasLiveCalls();
135
+ }
128
136
  reset() {
137
+ this.contentRevision++;
129
138
  this.settled.length = 0;
130
139
  // The call fold's records name rows of the transcript being dropped, so the
131
140
  // fold is reset with it rather than left holding stale row indices.
@@ -136,13 +145,13 @@ export class TranscriptModel {
136
145
  this.reasoningStartedAt = undefined;
137
146
  this.reasoningPaintedThisStep = false;
138
147
  }
139
- /** Append a surface-local line that is not part of the durable conversation. */
148
+ /** Keep local command feedback visible without recording it as conversation for the agent or a later resume. */
140
149
  notice(text) {
141
- this.settled.push({ kind: 'notice', text });
150
+ this.append({ kind: 'notice', text });
142
151
  }
143
152
  /** Mark a boundary in the conversation: compaction, or work that ran elsewhere. */
144
153
  marker(text) {
145
- this.settled.push({ kind: 'marker', text });
154
+ this.append({ kind: 'marker', text });
146
155
  }
147
156
  /** Apply one transient assistant-stream chunk. */
148
157
  applyStreamChunk(chunk) {
@@ -151,19 +160,23 @@ export class TranscriptModel {
151
160
  return;
152
161
  switch (record.type) {
153
162
  case 'text-delta':
154
- if (typeof record.text === 'string')
163
+ if (typeof record.text === 'string' && record.text !== '') {
155
164
  this.live += record.text;
165
+ this.contentRevision++;
166
+ }
156
167
  return;
157
168
  case 'reasoning-delta':
158
169
  if (typeof record.text !== 'string')
159
170
  return;
160
- this.reasoningStartedAt ??= this.clock();
171
+ this.contentRevision++;
172
+ this.reasoningStartedAt ??= this.now();
161
173
  this.liveReasoningId ??= String(++this.thoughtSeq);
162
174
  this.liveReasoning += record.text;
163
- // A live thought is not bounded until the block it belongs to ends, and
164
- // every frame re-wraps what this holds: past a burst of slack the head is
165
- // dropped in one step, so a runaway thought costs a bounded wrap per frame
166
- // instead of a growing one. The recorded text, not this, is what settles.
175
+ // Keep recent thought text visible as new deltas arrive, rather than
176
+ // spending the bounded live preview on an opening that no longer changes.
177
+ // Limit repeated wrapping cost by trimming after a burst of slack.
178
+ // Streamed thoughts settle from this retained buffer; the recorded
179
+ // reasoning copy is suppressed once this step has painted a thought.
167
180
  if (this.liveReasoning.length > REASONING_CHAR_LIMIT * LIVE_THOUGHT_SLACK) {
168
181
  this.liveReasoning = tailGraphemes(this.liveReasoning, REASONING_CHAR_LIMIT);
169
182
  }
@@ -188,21 +201,21 @@ export class TranscriptModel {
188
201
  return;
189
202
  if (kind === 'error') {
190
203
  const failure = messageOf(reason.error);
191
- this.settled.push({ kind: 'notice', text: `turn failed: ${failure === '' ? 'model request failed' : failure}` });
204
+ this.append({ kind: 'notice', text: `turn failed: ${failure === '' ? 'model request failed' : failure}` });
192
205
  return;
193
206
  }
194
207
  if (kind === 'aborted') {
195
208
  const cause = asRecord(reason.reason);
196
209
  const by = typeof cause?.kind === 'string' ? cause.kind : 'user';
197
- this.settled.push({ kind: 'notice', text: `turn aborted (${by})` });
210
+ this.append({ kind: 'notice', text: `turn aborted (${by})` });
198
211
  return;
199
212
  }
200
- this.settled.push({ kind: 'notice', text: `turn ended: ${kind}` });
213
+ this.append({ kind: 'notice', text: `turn ended: ${kind}` });
201
214
  }
202
215
  /** Report a live agent failure the durable log never carries as a message. */
203
216
  reportError(error) {
204
217
  const text = error instanceof Error ? error.message : messageOf(error);
205
- this.settled.push({ kind: 'notice', text: `error: ${text === '' ? 'agent failed' : text}` });
218
+ this.append({ kind: 'notice', text: `error: ${text === '' ? 'agent failed' : text}` });
206
219
  }
207
220
  /**
208
221
  * Settle one thought into a row of its own.
@@ -211,14 +224,17 @@ export class TranscriptModel {
211
224
  * produced, so reading order still matches the order the model thought in.
212
225
  */
213
226
  paintReasoning(text, ranFor) {
214
- const timing = ranFor === undefined ? '' : ` · ${Math.max(1, Math.round(ranFor / 1000))}s`;
227
+ const timing = ranFor === undefined ? '' : ` · ${describeDuration(ranFor)}`;
228
+ // Keep the beginning for reading a settled thought in order, within the row
229
+ // budget. Streamed thoughts reach here from an already tail-trimmed buffer;
230
+ // settling does not recover their discarded opening.
215
231
  const kept = sliceGraphemes(text, REASONING_CHAR_LIMIT);
216
232
  const cut = kept.length === text.length ? '' : `\n… truncated at ${REASONING_CHAR_LIMIT} chars`;
217
233
  // The live thought keeps the id the stream gave it; a thought only the
218
234
  // recorded message carries takes the next one.
219
235
  const id = this.liveReasoningId ?? String(++this.thoughtSeq);
220
236
  this.liveReasoningId = undefined;
221
- this.settled.push({
237
+ this.append({
222
238
  kind: 'reasoning',
223
239
  id,
224
240
  summary: `reasoning · ${describeTokens(text)}${timing}`,
@@ -231,7 +247,7 @@ export class TranscriptModel {
231
247
  if (this.liveReasoning === '')
232
248
  return;
233
249
  const text = this.liveReasoning;
234
- const ranFor = this.reasoningStartedAt === undefined ? undefined : this.clock() - this.reasoningStartedAt;
250
+ const ranFor = this.reasoningStartedAt === undefined ? undefined : this.now() - this.reasoningStartedAt;
235
251
  this.liveReasoning = '';
236
252
  this.reasoningStartedAt = undefined;
237
253
  this.paintReasoning(text, ranFor);
@@ -248,19 +264,20 @@ export class TranscriptModel {
248
264
  // work apart from the next one's. Reading the loop's own event rather than
249
265
  // inferring a break from the rows is what makes a step that says nothing
250
266
  // and only calls tools still read as a step of its own.
251
- this.settled.push({ kind: 'step' });
267
+ this.append({ kind: 'step' });
252
268
  return;
253
269
  }
254
270
  case 'user/message': {
255
271
  const text = textOfContent(data.content);
256
272
  if (text === '')
257
273
  return;
258
- this.settled.push(sourceKind(data) === 'user'
274
+ this.append(sourceKind(data) === 'user'
259
275
  ? { kind: 'user', text }
260
276
  : { kind: 'notice', text: injectionSummary(data, text) });
261
277
  return;
262
278
  }
263
279
  case 'turn/end': {
280
+ this.contentRevision++;
264
281
  this.reportTurnEnd(asRecord(data.reason) ?? {});
265
282
  // A turn that ended without a recorded message must not leave streamed
266
283
  // text on screen as though it had settled.
@@ -300,10 +317,11 @@ export class TranscriptModel {
300
317
  // An attempt that settled without a message still has to explain itself.
301
318
  const failure = data.error === undefined ? '' : messageOf(data.error);
302
319
  if (failure !== '')
303
- this.settled.push({ kind: 'notice', text: `request failed: ${failure}` });
320
+ this.append({ kind: 'notice', text: `request failed: ${failure}` });
304
321
  return;
305
322
  }
306
323
  case 'assistant/message': {
324
+ this.contentRevision++;
307
325
  const content = asRecord(data.message)?.content;
308
326
  const text = textOfContent(content);
309
327
  // Settle whatever the stream held, then decide whether the recorded
@@ -317,27 +335,38 @@ export class TranscriptModel {
317
335
  }
318
336
  this.live = '';
319
337
  if (text !== '')
320
- this.settled.push({ kind: 'assistant', text });
338
+ this.append({ kind: 'assistant', text });
321
339
  return;
322
340
  }
323
341
  case 'tool/call':
324
342
  case 'tool/ptc-dispatch-start':
325
343
  case 'tool/ptc-dispatch':
326
- case 'tool/result': {
344
+ case TOOL_RESULT_EVENT: {
345
+ // Pruning replaces model-facing history after its calls settled; rendering those rewrites creates orphan cards.
346
+ if (event.type === TOOL_RESULT_EVENT && asRecord(event.surfaceOp)?.op === SURFACE_REPLACEMENT)
347
+ return;
327
348
  // Tool events are the only rows drawn before they are finished, so they
328
349
  // are folded where that bookkeeping lives and the rows come back here,
329
350
  // where reading order and row indices are owned.
330
- this.commit(this.calls.apply(event.type, data, this.settled.length));
351
+ // Replayed results must measure logged execution, not the speed of this fold.
352
+ const at = typeof event.time === 'number' && Number.isFinite(event.time) && event.time >= 0 ? event.time : undefined;
353
+ this.commit(this.calls.apply(event.type, data, this.settled.length, at));
331
354
  return;
332
355
  }
333
356
  default:
334
357
  return;
335
358
  }
336
359
  }
360
+ /** Surface-local and durable rows share the revision that invalidates retained documents. */
361
+ append(entry) {
362
+ this.settled.push(entry);
363
+ this.contentRevision++;
364
+ }
337
365
  /** Commit the rows the call fold drew: appends in order, replacements in place. */
338
366
  commit(outcome) {
367
+ this.contentRevision++;
339
368
  for (const entry of outcome.appends)
340
- this.settled.push(entry);
369
+ this.append(entry);
341
370
  for (const { index, entry } of outcome.replacements)
342
371
  this.settled[index] = entry;
343
372
  }