@sagmans/dsh-tui 0.5.2 → 0.7.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 (285) hide show
  1. package/.agents/skills/dsh-tui-dogfood/SKILL.md +83 -0
  2. package/.agents/skills/dsh-tui-dogfood/references/home-state.md +78 -0
  3. package/.agents/skills/dsh-tui-dogfood/scripts/clone-links.mjs +133 -0
  4. package/.agents/skills/dsh-tui-dogfood/scripts/run-plugin-from-worktree.sh +417 -0
  5. package/.agents/skills/dsh-tui-update-models/SKILL.md +121 -0
  6. package/.agents/skills/dsh-tui-update-models/references/model-wiring.md +162 -0
  7. package/.agents/skills/dsh-tui-update-models/scripts/dump-model-catalog.mjs +178 -0
  8. package/README.md +131 -17
  9. package/lib/agent/host.d.ts +11 -0
  10. package/lib/agent/host.d.ts.map +1 -1
  11. package/lib/agent/host.js +16 -2
  12. package/lib/agent/host.js.map +1 -1
  13. package/lib/agent/present.d.ts.map +1 -1
  14. package/lib/agent/present.js +2 -1
  15. package/lib/agent/present.js.map +1 -1
  16. package/lib/agent/undo.d.ts +52 -0
  17. package/lib/agent/undo.d.ts.map +1 -0
  18. package/lib/agent/undo.js +106 -0
  19. package/lib/agent/undo.js.map +1 -0
  20. package/lib/cards/composition.d.ts +68 -0
  21. package/lib/cards/composition.d.ts.map +1 -0
  22. package/lib/cards/composition.js +117 -0
  23. package/lib/cards/composition.js.map +1 -0
  24. package/lib/cards/presenter.d.ts +23 -0
  25. package/lib/cards/presenter.d.ts.map +1 -0
  26. package/lib/cards/presenter.js +394 -0
  27. package/lib/cards/presenter.js.map +1 -0
  28. package/lib/cards/preview.d.ts +42 -0
  29. package/lib/cards/preview.d.ts.map +1 -0
  30. package/lib/cards/preview.js +51 -0
  31. package/lib/cards/preview.js.map +1 -0
  32. package/lib/cards.d.ts +42 -95
  33. package/lib/cards.d.ts.map +1 -1
  34. package/lib/cards.js +4 -526
  35. package/lib/cards.js.map +1 -1
  36. package/lib/compat/section.d.ts +29 -0
  37. package/lib/compat/section.d.ts.map +1 -0
  38. package/lib/compat/section.js +82 -0
  39. package/lib/compat/section.js.map +1 -0
  40. package/lib/config.d.ts +27 -2
  41. package/lib/config.d.ts.map +1 -1
  42. package/lib/config.js +61 -1
  43. package/lib/config.js.map +1 -1
  44. package/lib/contracts.d.ts +28 -0
  45. package/lib/contracts.d.ts.map +1 -1
  46. package/lib/fold-cursor.d.ts +8 -0
  47. package/lib/fold-cursor.d.ts.map +1 -1
  48. package/lib/fold-cursor.js +18 -0
  49. package/lib/fold-cursor.js.map +1 -1
  50. package/lib/gates/question-card.d.ts +77 -0
  51. package/lib/gates/question-card.d.ts.map +1 -0
  52. package/lib/gates/question-card.js +113 -0
  53. package/lib/gates/question-card.js.map +1 -0
  54. package/lib/gates/questions.d.ts +127 -0
  55. package/lib/gates/questions.d.ts.map +1 -0
  56. package/lib/gates/questions.js +418 -0
  57. package/lib/gates/questions.js.map +1 -0
  58. package/lib/gates.d.ts +1 -113
  59. package/lib/gates.d.ts.map +1 -1
  60. package/lib/gates.js +1 -484
  61. package/lib/gates.js.map +1 -1
  62. package/lib/herdr/reporter.d.ts +9 -4
  63. package/lib/herdr/reporter.d.ts.map +1 -1
  64. package/lib/herdr/reporter.js +5 -9
  65. package/lib/herdr/reporter.js.map +1 -1
  66. package/lib/herdr/state.d.ts +35 -4
  67. package/lib/herdr/state.d.ts.map +1 -1
  68. package/lib/herdr/state.js +37 -4
  69. package/lib/herdr/state.js.map +1 -1
  70. package/lib/index.d.ts +1 -0
  71. package/lib/index.d.ts.map +1 -1
  72. package/lib/index.js +343 -2267
  73. package/lib/index.js.map +1 -1
  74. package/lib/input/action-catalog.d.ts +74 -0
  75. package/lib/input/action-catalog.d.ts.map +1 -0
  76. package/lib/input/action-catalog.js +137 -0
  77. package/lib/input/action-catalog.js.map +1 -0
  78. package/lib/input/actions.d.ts +5 -81
  79. package/lib/input/actions.d.ts.map +1 -1
  80. package/lib/input/actions.js +4 -621
  81. package/lib/input/actions.js.map +1 -1
  82. package/lib/input/completion.d.ts +11 -1
  83. package/lib/input/completion.d.ts.map +1 -1
  84. package/lib/input/completion.js +17 -1
  85. package/lib/input/completion.js.map +1 -1
  86. package/lib/input/file-index.d.ts +40 -0
  87. package/lib/input/file-index.d.ts.map +1 -0
  88. package/lib/input/file-index.js +141 -0
  89. package/lib/input/file-index.js.map +1 -0
  90. package/lib/input/file-search.d.ts +1 -38
  91. package/lib/input/file-search.d.ts.map +1 -1
  92. package/lib/input/file-search.js +1 -487
  93. package/lib/input/file-search.js.map +1 -1
  94. package/lib/input/key-press.d.ts +57 -0
  95. package/lib/input/key-press.d.ts.map +1 -0
  96. package/lib/input/key-press.js +218 -0
  97. package/lib/input/key-press.js.map +1 -0
  98. package/lib/input/keymap-conflicts.d.ts +59 -0
  99. package/lib/input/keymap-conflicts.d.ts.map +1 -0
  100. package/lib/input/keymap-conflicts.js +292 -0
  101. package/lib/input/keymap-conflicts.js.map +1 -0
  102. package/lib/input/keymap-settings.js +1 -1
  103. package/lib/input/keymap-settings.js.map +1 -1
  104. package/lib/input/keymap.d.ts.map +1 -1
  105. package/lib/input/keymap.js +5 -1
  106. package/lib/input/keymap.js.map +1 -1
  107. package/lib/input/submission.d.ts +11 -1
  108. package/lib/input/submission.d.ts.map +1 -1
  109. package/lib/input/submission.js +10 -1
  110. package/lib/input/submission.js.map +1 -1
  111. package/lib/input/workspace-files.d.ts +10 -0
  112. package/lib/input/workspace-files.d.ts.map +1 -0
  113. package/lib/input/workspace-files.js +359 -0
  114. package/lib/input/workspace-files.js.map +1 -0
  115. package/lib/install-skills.d.ts +20 -0
  116. package/lib/install-skills.d.ts.map +1 -0
  117. package/lib/install-skills.js +198 -0
  118. package/lib/install-skills.js.map +1 -0
  119. package/lib/keys-command.d.ts +2 -1
  120. package/lib/keys-command.d.ts.map +1 -1
  121. package/lib/keys-command.js +2 -1
  122. package/lib/keys-command.js.map +1 -1
  123. package/lib/model-list.d.ts +37 -0
  124. package/lib/model-list.d.ts.map +1 -0
  125. package/lib/model-list.js +60 -0
  126. package/lib/model-list.js.map +1 -0
  127. package/lib/startup.d.ts +8 -0
  128. package/lib/startup.d.ts.map +1 -1
  129. package/lib/startup.js +120 -24
  130. package/lib/startup.js.map +1 -1
  131. package/lib/subagents.d.ts +7 -3
  132. package/lib/subagents.d.ts.map +1 -1
  133. package/lib/subagents.js +28 -4
  134. package/lib/subagents.js.map +1 -1
  135. package/lib/surface/appearance-preferences.d.ts +26 -0
  136. package/lib/surface/appearance-preferences.d.ts.map +1 -0
  137. package/lib/surface/appearance-preferences.js +139 -0
  138. package/lib/surface/appearance-preferences.js.map +1 -0
  139. package/lib/surface/appearance.d.ts +87 -0
  140. package/lib/surface/appearance.d.ts.map +1 -0
  141. package/lib/surface/appearance.js +353 -0
  142. package/lib/surface/appearance.js.map +1 -0
  143. package/lib/surface/background-work.d.ts +49 -0
  144. package/lib/surface/background-work.d.ts.map +1 -0
  145. package/lib/surface/background-work.js +146 -0
  146. package/lib/surface/background-work.js.map +1 -0
  147. package/lib/surface/commands.d.ts +80 -0
  148. package/lib/surface/commands.d.ts.map +1 -0
  149. package/lib/surface/commands.js +364 -0
  150. package/lib/surface/commands.js.map +1 -0
  151. package/lib/surface/modal-input.d.ts +58 -0
  152. package/lib/surface/modal-input.d.ts.map +1 -0
  153. package/lib/surface/modal-input.js +237 -0
  154. package/lib/surface/modal-input.js.map +1 -0
  155. package/lib/surface/model-choice.d.ts +54 -0
  156. package/lib/surface/model-choice.d.ts.map +1 -0
  157. package/lib/surface/model-choice.js +325 -0
  158. package/lib/surface/model-choice.js.map +1 -0
  159. package/lib/surface/preset-choice.d.ts +78 -0
  160. package/lib/surface/preset-choice.d.ts.map +1 -0
  161. package/lib/surface/preset-choice.js +163 -0
  162. package/lib/surface/preset-choice.js.map +1 -0
  163. package/lib/surface/prompt-input.d.ts +97 -0
  164. package/lib/surface/prompt-input.d.ts.map +1 -0
  165. package/lib/surface/prompt-input.js +215 -0
  166. package/lib/surface/prompt-input.js.map +1 -0
  167. package/lib/surface/prompt-memory.d.ts +76 -0
  168. package/lib/surface/prompt-memory.d.ts.map +1 -0
  169. package/lib/surface/prompt-memory.js +167 -0
  170. package/lib/surface/prompt-memory.js.map +1 -0
  171. package/lib/surface/session-lifecycle.d.ts +120 -0
  172. package/lib/surface/session-lifecycle.d.ts.map +1 -0
  173. package/lib/surface/session-lifecycle.js +321 -0
  174. package/lib/surface/session-lifecycle.js.map +1 -0
  175. package/lib/surface/session-picker.d.ts +39 -0
  176. package/lib/surface/session-picker.d.ts.map +1 -0
  177. package/lib/surface/session-picker.js +107 -0
  178. package/lib/surface/session-picker.js.map +1 -0
  179. package/lib/surface/session-view.d.ts +86 -0
  180. package/lib/surface/session-view.d.ts.map +1 -0
  181. package/lib/surface/session-view.js +215 -0
  182. package/lib/surface/session-view.js.map +1 -0
  183. package/lib/surface/staged-turns.d.ts +81 -0
  184. package/lib/surface/staged-turns.d.ts.map +1 -0
  185. package/lib/surface/staged-turns.js +206 -0
  186. package/lib/surface/staged-turns.js.map +1 -0
  187. package/lib/surface/terminal-lifecycle.d.ts +76 -0
  188. package/lib/surface/terminal-lifecycle.d.ts.map +1 -0
  189. package/lib/surface/terminal-lifecycle.js +222 -0
  190. package/lib/surface/terminal-lifecycle.js.map +1 -0
  191. package/lib/terminal/warning-screen.d.ts +8 -1
  192. package/lib/terminal/warning-screen.d.ts.map +1 -1
  193. package/lib/terminal/warning-screen.js +9 -0
  194. package/lib/terminal/warning-screen.js.map +1 -1
  195. package/lib/terminal-text/scan.d.ts +44 -0
  196. package/lib/terminal-text/scan.d.ts.map +1 -0
  197. package/lib/terminal-text/scan.js +195 -0
  198. package/lib/terminal-text/scan.js.map +1 -0
  199. package/lib/terminal-text/sgr.d.ts +32 -0
  200. package/lib/terminal-text/sgr.d.ts.map +1 -0
  201. package/lib/terminal-text/sgr.js +203 -0
  202. package/lib/terminal-text/sgr.js.map +1 -0
  203. package/lib/terminal-text.d.ts +1 -1
  204. package/lib/terminal-text.d.ts.map +1 -1
  205. package/lib/terminal-text.js +2 -379
  206. package/lib/terminal-text.js.map +1 -1
  207. package/lib/theme-command.js +2 -1
  208. package/lib/theme-command.js.map +1 -1
  209. package/lib/theme-defaults.d.ts +64 -0
  210. package/lib/theme-defaults.d.ts.map +1 -0
  211. package/lib/theme-defaults.js +248 -0
  212. package/lib/theme-defaults.js.map +1 -0
  213. package/lib/theme-resolver.d.ts +36 -0
  214. package/lib/theme-resolver.d.ts.map +1 -0
  215. package/lib/theme-resolver.js +112 -0
  216. package/lib/theme-resolver.js.map +1 -0
  217. package/lib/theme-schema.d.ts +6 -6
  218. package/lib/theme-schema.d.ts.map +1 -1
  219. package/lib/theme-schema.js +3 -2
  220. package/lib/theme-schema.js.map +1 -1
  221. package/lib/theme-settings.d.ts +13 -15
  222. package/lib/theme-settings.d.ts.map +1 -1
  223. package/lib/theme-settings.js +27 -19
  224. package/lib/theme-settings.js.map +1 -1
  225. package/lib/theme-tokens.d.ts +1 -90
  226. package/lib/theme-tokens.d.ts.map +1 -1
  227. package/lib/theme-tokens.js +11 -341
  228. package/lib/theme-tokens.js.map +1 -1
  229. package/lib/theme.d.ts +1 -1
  230. package/lib/theme.d.ts.map +1 -1
  231. package/lib/theme.js +2 -1
  232. package/lib/theme.js.map +1 -1
  233. package/lib/tool-display.d.ts.map +1 -1
  234. package/lib/tool-display.js +2 -1
  235. package/lib/tool-display.js.map +1 -1
  236. package/lib/transcript/message-content.d.ts +21 -0
  237. package/lib/transcript/message-content.d.ts.map +1 -0
  238. package/lib/transcript/message-content.js +61 -0
  239. package/lib/transcript/message-content.js.map +1 -0
  240. package/lib/transcript/tool-calls.d.ts +106 -0
  241. package/lib/transcript/tool-calls.d.ts.map +1 -0
  242. package/lib/transcript/tool-calls.js +254 -0
  243. package/lib/transcript/tool-calls.js.map +1 -0
  244. package/lib/transcript.d.ts +38 -43
  245. package/lib/transcript.d.ts.map +1 -1
  246. package/lib/transcript.js +58 -245
  247. package/lib/transcript.js.map +1 -1
  248. package/lib/ui/copy.d.ts +17 -0
  249. package/lib/ui/copy.d.ts.map +1 -0
  250. package/lib/ui/copy.js +104 -0
  251. package/lib/ui/copy.js.map +1 -0
  252. package/lib/ui/dock.d.ts +35 -3
  253. package/lib/ui/dock.d.ts.map +1 -1
  254. package/lib/ui/dock.js +124 -23
  255. package/lib/ui/dock.js.map +1 -1
  256. package/lib/ui/editor.d.ts.map +1 -1
  257. package/lib/ui/editor.js +2 -1
  258. package/lib/ui/editor.js.map +1 -1
  259. package/lib/ui/frame.d.ts +31 -0
  260. package/lib/ui/frame.d.ts.map +1 -1
  261. package/lib/ui/frame.js +27 -4
  262. package/lib/ui/frame.js.map +1 -1
  263. package/lib/ui/keymap-picker.d.ts +2 -1
  264. package/lib/ui/keymap-picker.d.ts.map +1 -1
  265. package/lib/ui/keymap-picker.js +1 -0
  266. package/lib/ui/keymap-picker.js.map +1 -1
  267. package/lib/ui/view/gate-card.d.ts +21 -0
  268. package/lib/ui/view/gate-card.d.ts.map +1 -0
  269. package/lib/ui/view/gate-card.js +104 -0
  270. package/lib/ui/view/gate-card.js.map +1 -0
  271. package/lib/ui/view/tool-card.d.ts +138 -0
  272. package/lib/ui/view/tool-card.d.ts.map +1 -0
  273. package/lib/ui/view/tool-card.js +413 -0
  274. package/lib/ui/view/tool-card.js.map +1 -0
  275. package/lib/ui/view/transcript-message.d.ts +62 -0
  276. package/lib/ui/view/transcript-message.d.ts.map +1 -0
  277. package/lib/ui/view/transcript-message.js +158 -0
  278. package/lib/ui/view/transcript-message.js.map +1 -0
  279. package/lib/ui/view.d.ts +87 -156
  280. package/lib/ui/view.d.ts.map +1 -1
  281. package/lib/ui/view.js +122 -556
  282. package/lib/ui/view.js.map +1 -1
  283. package/package.json +3 -1
  284. package/themes/deepseek-blue.yaml +9 -0
  285. package/themes/violet-orbit.yaml +7 -0
@@ -0,0 +1,21 @@
1
+ /**
2
+ * What a durable message says, read out of its content blocks.
3
+ *
4
+ * A block is whatever the harness recorded — text, a thought, or a tool result
5
+ * that carries its model-facing content one level deeper — and a reader is shown
6
+ * only the few shapes this module recognises. It sits apart from the fold
7
+ * because reading a recorded message is the same whether the message arrived
8
+ * live or came back out of a log.
9
+ */
10
+ /** The visible lines a content block list holds, thoughts excluded. */
11
+ export declare function contentLinesOf(content: unknown): string[];
12
+ /** The same lines as one string, for the callers that store text rather than rows. */
13
+ export declare function textOfContent(content: unknown): string;
14
+ /**
15
+ * The thoughts a durable message carries, in the order they were recorded.
16
+ *
17
+ * A recorded thought is the only path a resumed session has to the model's
18
+ * reasoning, and the live stream does not outlive the turn that produced it.
19
+ */
20
+ export declare function reasoningTextsOf(content: unknown): string[];
21
+ //# sourceMappingURL=message-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-content.d.ts","sourceRoot":"","sources":["../../src/transcript/message-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAezD;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAU3D"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * What a durable message says, read out of its content blocks.
3
+ *
4
+ * A block is whatever the harness recorded — text, a thought, or a tool result
5
+ * that carries its model-facing content one level deeper — and a reader is shown
6
+ * only the few shapes this module recognises. It sits apart from the fold
7
+ * because reading a recorded message is the same whether the message arrived
8
+ * live or came back out of a log.
9
+ */
10
+ /** Narrowing for the structural event reads below; each reader keeps its own copy rather than sharing one. */
11
+ function asRecord(value) {
12
+ return typeof value === 'object' && value !== null ? value : undefined;
13
+ }
14
+ /** The visible lines a content block list holds, thoughts excluded. */
15
+ export function contentLinesOf(content) {
16
+ if (!Array.isArray(content))
17
+ return [];
18
+ const lines = [];
19
+ for (const block of content) {
20
+ const record = asRecord(block);
21
+ if (record === undefined)
22
+ continue;
23
+ // A thought is a row of its own; reading it here would hand the model's
24
+ // private reasoning to the reader as though it had been said out loud.
25
+ if (record.type === 'reasoning')
26
+ continue;
27
+ // Any block that carries text counts; a tool-result block also holds its
28
+ // model-facing content one level deeper.
29
+ if (typeof record.text === 'string')
30
+ lines.push(...record.text.split('\n'));
31
+ if (Array.isArray(record.content))
32
+ lines.push(...contentLinesOf(record.content));
33
+ }
34
+ return lines;
35
+ }
36
+ /** The same lines as one string, for the callers that store text rather than rows. */
37
+ export function textOfContent(content) {
38
+ return contentLinesOf(content).join('\n');
39
+ }
40
+ /**
41
+ * The thoughts a durable message carries, in the order they were recorded.
42
+ *
43
+ * A recorded thought is the only path a resumed session has to the model's
44
+ * reasoning, and the live stream does not outlive the turn that produced it.
45
+ */
46
+ export function reasoningTextsOf(content) {
47
+ if (!Array.isArray(content))
48
+ return [];
49
+ const thoughts = [];
50
+ for (const block of content) {
51
+ const record = asRecord(block);
52
+ if (record === undefined)
53
+ continue;
54
+ if (record.type === 'reasoning' && typeof record.text === 'string')
55
+ thoughts.push(record.text);
56
+ if (Array.isArray(record.content))
57
+ thoughts.push(...reasoningTextsOf(record.content));
58
+ }
59
+ return thoughts;
60
+ }
61
+ //# sourceMappingURL=message-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-content.js","sourceRoot":"","sources":["../../src/transcript/message-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8GAA8G;AAC9G,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;AAED,uEAAuE;AACvE,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,O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C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC9F,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;IACvF,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { type ToolCard, type ToolPresenter } from '../cards.ts';
2
+ import type { TranscriptEntry } from '../transcript.ts';
3
+ /** One second in milliseconds, which is the unit a duration is reported in. */
4
+ export declare const SECOND_MS = 1000;
5
+ /**
6
+ * What is known about one call the fold has seen requested and not answered.
7
+ *
8
+ * A settled call reads as nothing rather than as a zero elapsed time: "started
9
+ * now" and "waiting an unknown time" are different things to say, and only the
10
+ * fold can tell which one is true.
11
+ */
12
+ export interface LiveCallState {
13
+ readonly running: boolean;
14
+ readonly elapsed: number;
15
+ }
16
+ /**
17
+ * The rows one folded tool event asks the transcript to commit.
18
+ *
19
+ * The fold never writes to the transcript: it holds the call-to-row bookkeeping
20
+ * that only tool events need, and hands back the rows it drew so the transcript
21
+ * stays the single owner of reading order and of what a row's index means.
22
+ */
23
+ export interface ToolCallOutcome {
24
+ /** Rows to append, in the order the fold drew them. */
25
+ readonly appends: readonly TranscriptEntry[];
26
+ /** Rows to restate in place, at the index the fold recorded when it drew them. */
27
+ readonly replacements: readonly {
28
+ readonly index: number;
29
+ readonly entry: TranscriptEntry;
30
+ }[];
31
+ }
32
+ /**
33
+ * The tool rows a session's events fold into.
34
+ *
35
+ * A tool call is the one transcript row that is drawn before it is finished: the
36
+ * request lands a card, a nested dispatch restates it, and the result replaces
37
+ * it, so the fold has to remember where each call's row went. That bookkeeping —
38
+ * and the request-to-result clock it times a running row with — is the whole of
39
+ * this module; the ordering and the rows themselves belong to the transcript.
40
+ */
41
+ export declare class ToolCallFold {
42
+ private readonly presenter;
43
+ private readonly clock;
44
+ /** Reads back the card a settled row holds, so a dispatch or a result restates the row it drew. */
45
+ private readonly cardAt;
46
+ private readonly pending;
47
+ /**
48
+ * Where each nested call landed on its root card.
49
+ *
50
+ * A dispatch logs a start and then a settle, so the second event has to find
51
+ * the row the first one drew instead of adding a second line for one call.
52
+ */
53
+ private readonly pendingSub;
54
+ constructor(presenter: ToolPresenter | undefined, clock: () => number,
55
+ /** Reads back the card a settled row holds, so a dispatch or a result restates the row it drew. */
56
+ cardAt: (index: number) => ToolCard | undefined);
57
+ /** Fold one tool event, which is the only family of events that owns cross-event state. */
58
+ apply(type: string, data: Record<string, unknown>, landingIndex: number): ToolCallOutcome;
59
+ /**
60
+ * How long one call has been in flight, or that it is not.
61
+ *
62
+ * The fold owns the request-to-result window, so a renderer asks here rather
63
+ * than timing the row itself: a row read twice in one frame would otherwise
64
+ * report two durations for one call.
65
+ */
66
+ liveCall(callId: string): LiveCallState;
67
+ /**
68
+ * Drop the in-flight bookkeeping.
69
+ *
70
+ * The sub-call records name rows of the transcript being dropped, so they go
71
+ * with the transcript: an index kept across the reset would refuse a replayed
72
+ * call the row it is entitled to.
73
+ */
74
+ reset(): void;
75
+ /**
76
+ * Whole seconds since a moment the fold read the clock at.
77
+ *
78
+ * Floored, not rounded: a duration that claims a second it has not waited yet
79
+ * would tick up before the call has been waiting that long.
80
+ */
81
+ private secondsSince;
82
+ /** The row a requested call draws, which is the row its result later replaces. */
83
+ private rootCall;
84
+ /**
85
+ * Fold one nested PTC call onto the card of the run_code call that dispatched it.
86
+ *
87
+ * Dispatches are logged while the program runs, so the root is still pending;
88
+ * a dispatch whose root is not in this fold belongs to a window that starts
89
+ * mid-run, and attaching it to another card would claim a call that card
90
+ * never made.
91
+ */
92
+ private subCall;
93
+ /**
94
+ * The card a dispatched call's log answers with.
95
+ *
96
+ * A presenter can only rebuild the view it declared when the logged content is
97
+ * enough for it: a shell's output is, while a read's numbered window and a
98
+ * search's hits live in the metadata a dispatch does not carry. The fallback is
99
+ * the content the program was actually shown, so a row whose tool cannot be
100
+ * re-presented still opens to its outcome rather than to nothing.
101
+ */
102
+ private subCallResult;
103
+ /** The row a call's result settles into: the card it drew, restated with what answered it. */
104
+ private settleResult;
105
+ }
106
+ //# sourceMappingURL=tool-calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-calls.d.ts","sourceRoot":"","sources":["../../src/transcript/tool-calls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAE9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAGvD,+EAA+E;AAC/E,eAAO,MAAM,SAAS,OAAO,CAAA;AAkB7B;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAA;IAC5C,kFAAkF;IAClF,QAAQ,CAAC,YAAY,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;KAAE,EAAE,CAAA;CAC9F;AAKD;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAWrB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,mGAAmG;IACnG,OAAO,CAAC,QAAQ,CAAC,MAAM;IAbzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiF;gBAGzF,SAAS,EAAE,aAAa,GAAG,SAAS,EACpC,KAAK,EAAE,MAAM,MAAM;IACpC,mGAAmG;IAClF,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS;IAGlE,2FAA2F;IAC3F,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,eAAe;IAezF;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa;IAMvC;;;;;;OAMG;IACH,KAAK,IAAI,IAAI;IAKb;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB,kFAAkF;IAClF,OAAO,CAAC,QAAQ;IAiBhB;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO;IAwDf;;;;;;;;OAQG;IACH,OAAO,CAAC,aAAa;IAWrB,8FAA8F;IAC9F,OAAO,CAAC,YAAY;CAmDrB"}
@@ -0,0 +1,254 @@
1
+ import { cardFromLines } from "../cards.js";
2
+ import { carriedFields, mergeCards, subCallRow, subCallRows, SUBCALL_MAX } from "../cards/composition.js";
3
+ import { contentLinesOf } from "./message-content.js";
4
+ /** One second in milliseconds, which is the unit a duration is reported in. */
5
+ export const SECOND_MS = 1000;
6
+ /** An event that changes no row. */
7
+ const NOTHING = { appends: [], replacements: [] };
8
+ /**
9
+ * The tool rows a session's events fold into.
10
+ *
11
+ * A tool call is the one transcript row that is drawn before it is finished: the
12
+ * request lands a card, a nested dispatch restates it, and the result replaces
13
+ * it, so the fold has to remember where each call's row went. That bookkeeping —
14
+ * and the request-to-result clock it times a running row with — is the whole of
15
+ * this module; the ordering and the rows themselves belong to the transcript.
16
+ */
17
+ export class ToolCallFold {
18
+ presenter;
19
+ clock;
20
+ cardAt;
21
+ pending = new Map();
22
+ /**
23
+ * Where each nested call landed on its root card.
24
+ *
25
+ * A dispatch logs a start and then a settle, so the second event has to find
26
+ * the row the first one drew instead of adding a second line for one call.
27
+ */
28
+ pendingSub = new Map();
29
+ constructor(presenter, clock,
30
+ /** Reads back the card a settled row holds, so a dispatch or a result restates the row it drew. */
31
+ cardAt) {
32
+ this.presenter = presenter;
33
+ this.clock = clock;
34
+ this.cardAt = cardAt;
35
+ }
36
+ /** Fold one tool event, which is the only family of events that owns cross-event state. */
37
+ apply(type, data, landingIndex) {
38
+ switch (type) {
39
+ case 'tool/call':
40
+ return this.rootCall(data, landingIndex);
41
+ case 'tool/ptc-dispatch-start':
42
+ return this.subCall(data, false);
43
+ case 'tool/ptc-dispatch':
44
+ return this.subCall(data, true);
45
+ case 'tool/result':
46
+ return this.settleResult(data);
47
+ default:
48
+ return NOTHING;
49
+ }
50
+ }
51
+ /**
52
+ * How long one call has been in flight, or that it is not.
53
+ *
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.
57
+ */
58
+ liveCall(callId) {
59
+ const call = callId === '' ? undefined : this.pending.get(callId);
60
+ if (call === undefined)
61
+ return { running: false, elapsed: 0 };
62
+ return { running: true, elapsed: this.secondsSince(call.startedAt) };
63
+ }
64
+ /**
65
+ * Drop the in-flight bookkeeping.
66
+ *
67
+ * The sub-call records name rows of the transcript being dropped, so they go
68
+ * with the transcript: an index kept across the reset would refuse a replayed
69
+ * call the row it is entitled to.
70
+ */
71
+ reset() {
72
+ this.pending.clear();
73
+ this.pendingSub.clear();
74
+ }
75
+ /**
76
+ * Whole seconds since a moment the fold read the clock at.
77
+ *
78
+ * Floored, not rounded: a duration that claims a second it has not waited yet
79
+ * would tick up before the call has been waiting that long.
80
+ */
81
+ secondsSince(startedAt) {
82
+ return Math.max(0, Math.floor((this.clock() - startedAt) / SECOND_MS));
83
+ }
84
+ /** The row a requested call draws, which is the row its result later replaces. */
85
+ rootCall(data, landingIndex) {
86
+ const name = typeof data.name === 'string' ? data.name : 'tool';
87
+ const argumentsJson = typeof data.arguments === 'string' ? data.arguments : '';
88
+ const callId = typeof data.callId === 'string' ? data.callId : '';
89
+ const card = this.presenter?.call(name, argumentsJson);
90
+ const entry = {
91
+ kind: 'tool',
92
+ // The id is what keeps a reader's click on this message after the
93
+ // result replaces the card: the entry object does not survive, the id does.
94
+ id: callId,
95
+ // Without a presenter the row still has to say what ran and with what.
96
+ card: card ?? cardFromLines('generic', name, name, argumentsJson === '' ? [] : argumentsJson.split('\n'), false),
97
+ };
98
+ if (callId !== '')
99
+ this.pending.set(callId, { name, argumentsJson, index: landingIndex, startedAt: this.clock(), subs: [] });
100
+ return { appends: [entry], replacements: [] };
101
+ }
102
+ /**
103
+ * Fold one nested PTC call onto the card of the run_code call that dispatched it.
104
+ *
105
+ * Dispatches are logged while the program runs, so the root is still pending;
106
+ * a dispatch whose root is not in this fold belongs to a window that starts
107
+ * mid-run, and attaching it to another card would claim a call that card
108
+ * never made.
109
+ */
110
+ subCall(data, settled) {
111
+ const rootCallId = typeof data.rootCallId === 'string' ? data.rootCallId : '';
112
+ const subCallId = typeof data.subCallId === 'string' ? data.subCallId : '';
113
+ const root = rootCallId === '' ? undefined : this.pending.get(rootCallId);
114
+ if (root === undefined || subCallId === '')
115
+ return NOTHING;
116
+ const card = this.cardAt(root.index);
117
+ if (card === undefined)
118
+ return NOTHING;
119
+ const name = typeof data.name === 'string' ? data.name : 'tool';
120
+ const argumentsJson = argumentsJsonOf(data.arguments);
121
+ // The call's own view is asked for once: it names the row and it is what the
122
+ // row shows of the call itself, so two asks could disagree about one call.
123
+ const view = this.presenter?.call(name, argumentsJson);
124
+ const isError = data.isError === true;
125
+ const result = settled ? this.subCallResult(name, argumentsJson, data, view) : undefined;
126
+ const output = result === undefined ? undefined : subCallRows(result);
127
+ // A call that answered has told the surface how it went, and that is what the
128
+ // row reports from then on — a program's calls are read by their outcomes.
129
+ const failed = settled && (isError || result?.failed === true);
130
+ const known = this.pendingSub.get(subCallId);
131
+ if (known !== undefined) {
132
+ // A settle restates the row its start drew: it ends the claim that the
133
+ // call is still in flight, adds the outcome a reader opens the row for, and
134
+ // a failure takes back what the call only declared. A call that produced
135
+ // nothing to open still has to be restated, or its row would keep saying it
136
+ // is running for as long as the card lives.
137
+ if (!settled || known.childIndex < 0)
138
+ return NOTHING;
139
+ const drawn = (card.subCalls ?? [])[known.childIndex];
140
+ if (!isError && output === undefined && drawn?.running !== true)
141
+ return NOTHING;
142
+ // A settle that reports nothing to open leaves the row's own outcome in
143
+ // place; only a failure takes it back, because the rows it drew as applied
144
+ // never happened.
145
+ const settledOutput = isError ? output : output ?? drawn?.output;
146
+ const subCalls = (card.subCalls ?? []).map((call, at) => at === known.childIndex
147
+ ? subCallRow(subCallId, name, argumentsJson, { view, output: settledOutput, status: result?.status, running: false, failed }, call)
148
+ : call);
149
+ return { appends: [], replacements: [{ index: root.index, entry: { kind: 'tool', id: rootCallId, card: { ...card, subCalls } } }] };
150
+ }
151
+ // A dispatch log arrives only once the call has settled, so a row that no
152
+ // settle has restated yet is the one still running.
153
+ const call = subCallRow(subCallId, name, argumentsJson, { view, output, status: result?.status, running: !settled, failed });
154
+ const kept = card.subCalls ?? [];
155
+ const total = (card.subCallsTotal ?? 0) + 1;
156
+ if (kept.length >= SUBCALL_MAX) {
157
+ // Retention keeps the head, where the calls that shaped the program are;
158
+ // the count still reports everything it dispatched. The id is remembered
159
+ // so a settle is not counted twice, and listed on the root so the root's
160
+ // own cleanup forgets it — an overflow row has no row to clean up after.
161
+ this.pendingSub.set(subCallId, { rootIndex: root.index, childIndex: -1 });
162
+ root.subs.push(subCallId);
163
+ return { appends: [], replacements: [{ index: root.index, entry: { kind: 'tool', id: rootCallId, card: { ...card, subCallsTotal: total } } }] };
164
+ }
165
+ root.subs.push(subCallId);
166
+ this.pendingSub.set(subCallId, { rootIndex: root.index, childIndex: kept.length });
167
+ return { appends: [], replacements: [{ index: root.index, entry: { kind: 'tool', id: rootCallId, card: { ...card, subCalls: [...kept, call], subCallsTotal: total } } }] };
168
+ }
169
+ /**
170
+ * The card a dispatched call's log answers with.
171
+ *
172
+ * A presenter can only rebuild the view it declared when the logged content is
173
+ * enough for it: a shell's output is, while a read's numbered window and a
174
+ * search's hits live in the metadata a dispatch does not carry. The fallback is
175
+ * the content the program was actually shown, so a row whose tool cannot be
176
+ * re-presented still opens to its outcome rather than to nothing.
177
+ */
178
+ subCallResult(name, argumentsJson, data, view) {
179
+ const failed = data.isError === true;
180
+ return this.presenter?.result(name, { argumentsJson, content: data.content, isError: failed, meta: data.meta })
181
+ ?? cardFromLines(view?.kind ?? 'generic', name, view?.title ?? name, contentLinesOf(data.content), failed);
182
+ }
183
+ /** The row a call's result settles into: the card it drew, restated with what answered it. */
184
+ settleResult(data) {
185
+ const message = asRecord(data.message);
186
+ const firstBlock = Array.isArray(message?.content) ? asRecord(message.content[0]) : undefined;
187
+ const callId = typeof firstBlock?.toolCallId === 'string' ? firstBlock.toolCallId : '';
188
+ const pending = callId === '' ? undefined : this.pending.get(callId);
189
+ if (callId !== '')
190
+ this.pending.delete(callId);
191
+ // The length of the run is readable here and nowhere else: the surface saw
192
+ // the call logged and now sees it answered, and this is the only moment the
193
+ // fold holds both readings of the clock.
194
+ const ranFor = pending === undefined ? undefined : this.secondsSince(pending.startedAt);
195
+ /** The card that reports this result, carrying the seconds the call took. */
196
+ const finished = (card) => (ranFor === undefined ? card : { ...card, elapsed: ranFor });
197
+ // The root is done dispatching, so its bookkeeping goes with it; the rows it
198
+ // already drew stay on the card.
199
+ if (pending !== undefined)
200
+ for (const sub of pending.subs)
201
+ this.pendingSub.delete(sub);
202
+ const name = pending?.name ?? 'tool';
203
+ const isError = message?.isError === true;
204
+ const result = this.presenter?.result(name, {
205
+ argumentsJson: pending?.argumentsJson ?? '',
206
+ content: message?.content,
207
+ isError,
208
+ meta: data.meta,
209
+ });
210
+ if (pending === undefined) {
211
+ // No matching call in this fold: a resumed transcript may start mid-call.
212
+ return {
213
+ appends: [{
214
+ kind: 'tool',
215
+ id: callId,
216
+ card: result ?? cardFromLines('generic', name, name, contentLinesOf(message?.content), isError),
217
+ }],
218
+ replacements: [],
219
+ };
220
+ }
221
+ const call = this.cardAt(pending.index);
222
+ if (result === undefined) {
223
+ // No presenter answered: the model-facing content is still what happened,
224
+ // and a reader without it would see a tool row that never reported back.
225
+ const reported = contentLinesOf(message?.content);
226
+ const base = call ?? cardFromLines('generic', name, name, [], false);
227
+ const rebuilt = reported.length === 0
228
+ ? { ...base, failed: isError }
229
+ : { ...cardFromLines(base.kind, base.tool, base.title, reported, isError), ...carriedFields(base) };
230
+ return { appends: [], replacements: [{ index: pending.index, entry: { kind: 'tool', id: callId, card: finished(rebuilt) } }] };
231
+ }
232
+ // Two readings decide this, and either is enough: the log says whether the tool
233
+ // raised, and the card the presenter built says how the call itself ended — a
234
+ // shell's non-zero exit is a failure the log's flag never carries.
235
+ const settledCard = mergeCards(call, { ...result, failed: result.failed || isError });
236
+ return { appends: [], replacements: [{ index: pending.index, entry: { kind: 'tool', id: callId, card: finished(settledCard) } }] };
237
+ }
238
+ }
239
+ /** The arguments a nested call was made with, as the shape a presenter is asked with. */
240
+ function argumentsJsonOf(value) {
241
+ if (value === undefined)
242
+ return '';
243
+ try {
244
+ return JSON.stringify(value) ?? '';
245
+ }
246
+ catch {
247
+ return '';
248
+ }
249
+ }
250
+ /** Narrowing for the structural event reads above; each reader keeps its own copy rather than sharing one. */
251
+ function asRecord(value) {
252
+ return typeof value === 'object' && value !== null ? value : undefined;
253
+ }
254
+ //# sourceMappingURL=tool-calls.js.map
@@ -0,0 +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,MAAM,OAAO,GAAoB,EAAE,OA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,CAAC,CAAC,CAAC,SAAS,CAAA;AACrG,CAAC"}
@@ -1,4 +1,5 @@
1
- import { type ToolCard, type ToolPresenter } from './cards.ts';
1
+ import type { ToolCard, ToolPresenter } from './cards.ts';
2
+ import { type LiveCallState } from './transcript/tool-calls.ts';
2
3
  /** One renderable transcript row. */
3
4
  export type TranscriptEntry = {
4
5
  readonly kind: 'user';
@@ -43,21 +44,17 @@ export interface FoldableEvent {
43
44
  * Durable events own the transcript: the live stream is decoration that a
44
45
  * repaint or a resume can drop without changing what the reader sees. Tool
45
46
  * rows come from the tool's own render intent, so the fold never learns a tool
46
- * name.
47
+ * name; the bookkeeping that a tool row's request, dispatch, and result share
48
+ * lives in the call fold this model routes those events to.
47
49
  */
48
50
  export declare class TranscriptModel {
49
- private readonly presenter?;
50
- /** Clock for "how long has this been thinking"; injected so a test can pin it. */
51
- private readonly now;
52
- private readonly settled;
53
- private readonly pending;
54
51
  /**
55
- * Where each nested call landed on its root card.
56
- *
57
- * A dispatch logs a start and then a settle, so the second event has to find
58
- * the row the first one drew instead of adding a second line for one call.
52
+ * Clock for "how long has this been thinking or running"; injected so a test
53
+ * can pin it and reachable through {@link now} so a renderer keys its rows
54
+ * to the same one.
59
55
  */
60
- private readonly pendingSub;
56
+ private readonly clock;
57
+ private readonly settled;
61
58
  private live;
62
59
  private liveReasoning;
63
60
  private reasoningStartedAt;
@@ -76,9 +73,23 @@ export declare class TranscriptModel {
76
73
  */
77
74
  private thoughtSeq;
78
75
  private liveReasoningId;
79
- constructor(presenter?: ToolPresenter | undefined,
80
- /** Clock for "how long has this been thinking"; injected so a test can pin it. */
81
- now?: () => number);
76
+ /** The call-to-row bookkeeping tool events share, told the clock and the rows this model holds. */
77
+ private readonly calls;
78
+ constructor(presenter?: ToolPresenter,
79
+ /**
80
+ * Clock for "how long has this been thinking or running"; injected so a test
81
+ * can pin it and reachable through {@link now} so a renderer keys its rows
82
+ * to the same one.
83
+ */
84
+ clock?: () => number);
85
+ /**
86
+ * The clock every duration on a row is measured with.
87
+ *
88
+ * A renderer that caches rows has to know when a running row's duration would
89
+ * have changed, and reading the same clock the fold timed the call with is the
90
+ * only way for the number on screen and the cache key to agree.
91
+ */
92
+ now(): number;
82
93
  /** Rows to render: settled rows, the in-flight reasoning, then the in-flight text. */
83
94
  entries(): readonly TranscriptEntry[];
84
95
  /**
@@ -89,6 +100,14 @@ export declare class TranscriptModel {
89
100
  * changing.
90
101
  */
91
102
  settledCount(): number;
103
+ /**
104
+ * How long one call has been in flight, or that it is not.
105
+ *
106
+ * The call fold owns the request-to-result window, so a renderer asks here
107
+ * rather than timing the row itself: a row read twice in one frame would
108
+ * otherwise report two durations for one call.
109
+ */
110
+ liveCall(callId: string): LiveCallState;
92
111
  /** Whether any row exists, so a caller can decide to clear or redraw. */
93
112
  isEmpty(): boolean;
94
113
  reset(): void;
@@ -112,33 +131,9 @@ export declare class TranscriptModel {
112
131
  /** Settle the reasoning streamed so far into a row of its own. */
113
132
  private settleReasoning;
114
133
  apply(event: FoldableEvent): void;
115
- /**
116
- * Fold one nested PTC call onto the card of the run_code call that dispatched it.
117
- *
118
- * Dispatches are logged while the program runs, so the root is still pending;
119
- * a dispatch whose root is not in this fold belongs to a window that starts
120
- * mid-run, and attaching it to another card would claim a call that card
121
- * never made.
122
- */
123
- private applySubCall;
124
- /**
125
- * The row a settle leaves behind, once the outcome the call produced is known.
126
- *
127
- * A row that failed keeps only what still holds: its declared change never
128
- * happened, so those rows go with the outcome that never came, while the
129
- * outcome stays because the reason it failed is what a reader opens it to read.
130
- */
131
- private settledSubCall;
132
- /**
133
- * The outcome a dispatched call opens to, from the view its result presented.
134
- *
135
- * A presenter can only rebuild the view it declared when the logged content is
136
- * enough for it: a shell's output is, while a read's numbered window and a
137
- * search's hits live in the metadata a dispatch does not carry. The fallback is
138
- * the content the program was actually shown, so a row whose tool cannot be
139
- * re-presented still opens to its outcome rather than to nothing.
140
- */
141
- private subCallOutcome;
142
- private settleToolResult;
134
+ /** Commit the rows the call fold drew: appends in order, replacements in place. */
135
+ private commit;
136
+ /** The card a settled tool row holds, so the call fold can restate a row it drew earlier. */
137
+ private cardAt;
143
138
  }
144
139
  //# sourceMappingURL=transcript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+F,KAAK,QAAQ,EAAE,KAAK,aAAa,EAA0C,MAAM,YAAY,CAAA;AAKnM,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;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACvE;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAA;AAEhI,yGAAyG;AACzG,eAAO,MAAM,oBAAoB,QAAS,CAAA;AAgB1C;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,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