@sagmans/dsh-tui 0.6.0 → 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 (250) 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 +99 -5
  9. package/lib/agent/present.d.ts.map +1 -1
  10. package/lib/agent/present.js +2 -1
  11. package/lib/agent/present.js.map +1 -1
  12. package/lib/cards/composition.d.ts +68 -0
  13. package/lib/cards/composition.d.ts.map +1 -0
  14. package/lib/cards/composition.js +117 -0
  15. package/lib/cards/composition.js.map +1 -0
  16. package/lib/cards/presenter.d.ts +23 -0
  17. package/lib/cards/presenter.d.ts.map +1 -0
  18. package/lib/cards/presenter.js +394 -0
  19. package/lib/cards/presenter.js.map +1 -0
  20. package/lib/cards/preview.d.ts +42 -0
  21. package/lib/cards/preview.d.ts.map +1 -0
  22. package/lib/cards/preview.js +51 -0
  23. package/lib/cards/preview.js.map +1 -0
  24. package/lib/cards.d.ts +12 -120
  25. package/lib/cards.d.ts.map +1 -1
  26. package/lib/cards.js +4 -556
  27. package/lib/cards.js.map +1 -1
  28. package/lib/compat/section.d.ts +29 -0
  29. package/lib/compat/section.d.ts.map +1 -0
  30. package/lib/compat/section.js +82 -0
  31. package/lib/compat/section.js.map +1 -0
  32. package/lib/config.d.ts +27 -2
  33. package/lib/config.d.ts.map +1 -1
  34. package/lib/config.js +61 -1
  35. package/lib/config.js.map +1 -1
  36. package/lib/contracts.d.ts +28 -0
  37. package/lib/contracts.d.ts.map +1 -1
  38. package/lib/fold-cursor.d.ts +8 -0
  39. package/lib/fold-cursor.d.ts.map +1 -1
  40. package/lib/fold-cursor.js +18 -0
  41. package/lib/fold-cursor.js.map +1 -1
  42. package/lib/gates/question-card.d.ts +77 -0
  43. package/lib/gates/question-card.d.ts.map +1 -0
  44. package/lib/gates/question-card.js +113 -0
  45. package/lib/gates/question-card.js.map +1 -0
  46. package/lib/gates/questions.d.ts +127 -0
  47. package/lib/gates/questions.d.ts.map +1 -0
  48. package/lib/gates/questions.js +418 -0
  49. package/lib/gates/questions.js.map +1 -0
  50. package/lib/gates.d.ts +1 -113
  51. package/lib/gates.d.ts.map +1 -1
  52. package/lib/gates.js +1 -484
  53. package/lib/gates.js.map +1 -1
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.d.ts.map +1 -1
  56. package/lib/index.js +343 -2602
  57. package/lib/index.js.map +1 -1
  58. package/lib/input/action-catalog.d.ts +74 -0
  59. package/lib/input/action-catalog.d.ts.map +1 -0
  60. package/lib/input/action-catalog.js +137 -0
  61. package/lib/input/action-catalog.js.map +1 -0
  62. package/lib/input/actions.d.ts +5 -81
  63. package/lib/input/actions.d.ts.map +1 -1
  64. package/lib/input/actions.js +4 -625
  65. package/lib/input/actions.js.map +1 -1
  66. package/lib/input/completion.d.ts +1 -1
  67. package/lib/input/completion.d.ts.map +1 -1
  68. package/lib/input/completion.js +2 -1
  69. package/lib/input/completion.js.map +1 -1
  70. package/lib/input/file-index.d.ts +40 -0
  71. package/lib/input/file-index.d.ts.map +1 -0
  72. package/lib/input/file-index.js +141 -0
  73. package/lib/input/file-index.js.map +1 -0
  74. package/lib/input/file-search.d.ts +1 -38
  75. package/lib/input/file-search.d.ts.map +1 -1
  76. package/lib/input/file-search.js +1 -487
  77. package/lib/input/file-search.js.map +1 -1
  78. package/lib/input/key-press.d.ts +57 -0
  79. package/lib/input/key-press.d.ts.map +1 -0
  80. package/lib/input/key-press.js +218 -0
  81. package/lib/input/key-press.js.map +1 -0
  82. package/lib/input/keymap-conflicts.d.ts +59 -0
  83. package/lib/input/keymap-conflicts.d.ts.map +1 -0
  84. package/lib/input/keymap-conflicts.js +292 -0
  85. package/lib/input/keymap-conflicts.js.map +1 -0
  86. package/lib/input/keymap-settings.js +1 -1
  87. package/lib/input/keymap-settings.js.map +1 -1
  88. package/lib/input/keymap.d.ts.map +1 -1
  89. package/lib/input/keymap.js +3 -1
  90. package/lib/input/keymap.js.map +1 -1
  91. package/lib/input/workspace-files.d.ts +10 -0
  92. package/lib/input/workspace-files.d.ts.map +1 -0
  93. package/lib/input/workspace-files.js +359 -0
  94. package/lib/input/workspace-files.js.map +1 -0
  95. package/lib/install-skills.d.ts +20 -0
  96. package/lib/install-skills.d.ts.map +1 -0
  97. package/lib/install-skills.js +198 -0
  98. package/lib/install-skills.js.map +1 -0
  99. package/lib/keys-command.d.ts +2 -1
  100. package/lib/keys-command.d.ts.map +1 -1
  101. package/lib/keys-command.js +2 -1
  102. package/lib/keys-command.js.map +1 -1
  103. package/lib/model-list.d.ts +37 -0
  104. package/lib/model-list.d.ts.map +1 -0
  105. package/lib/model-list.js +60 -0
  106. package/lib/model-list.js.map +1 -0
  107. package/lib/startup.d.ts +8 -0
  108. package/lib/startup.d.ts.map +1 -1
  109. package/lib/startup.js +120 -24
  110. package/lib/startup.js.map +1 -1
  111. package/lib/subagents.d.ts +7 -3
  112. package/lib/subagents.d.ts.map +1 -1
  113. package/lib/subagents.js +28 -4
  114. package/lib/subagents.js.map +1 -1
  115. package/lib/surface/appearance-preferences.d.ts +26 -0
  116. package/lib/surface/appearance-preferences.d.ts.map +1 -0
  117. package/lib/surface/appearance-preferences.js +139 -0
  118. package/lib/surface/appearance-preferences.js.map +1 -0
  119. package/lib/surface/appearance.d.ts +87 -0
  120. package/lib/surface/appearance.d.ts.map +1 -0
  121. package/lib/surface/appearance.js +353 -0
  122. package/lib/surface/appearance.js.map +1 -0
  123. package/lib/surface/background-work.d.ts +49 -0
  124. package/lib/surface/background-work.d.ts.map +1 -0
  125. package/lib/surface/background-work.js +146 -0
  126. package/lib/surface/background-work.js.map +1 -0
  127. package/lib/surface/commands.d.ts +80 -0
  128. package/lib/surface/commands.d.ts.map +1 -0
  129. package/lib/surface/commands.js +364 -0
  130. package/lib/surface/commands.js.map +1 -0
  131. package/lib/surface/modal-input.d.ts +58 -0
  132. package/lib/surface/modal-input.d.ts.map +1 -0
  133. package/lib/surface/modal-input.js +237 -0
  134. package/lib/surface/modal-input.js.map +1 -0
  135. package/lib/surface/model-choice.d.ts +54 -0
  136. package/lib/surface/model-choice.d.ts.map +1 -0
  137. package/lib/surface/model-choice.js +325 -0
  138. package/lib/surface/model-choice.js.map +1 -0
  139. package/lib/surface/preset-choice.d.ts +78 -0
  140. package/lib/surface/preset-choice.d.ts.map +1 -0
  141. package/lib/surface/preset-choice.js +163 -0
  142. package/lib/surface/preset-choice.js.map +1 -0
  143. package/lib/surface/prompt-input.d.ts +97 -0
  144. package/lib/surface/prompt-input.d.ts.map +1 -0
  145. package/lib/surface/prompt-input.js +215 -0
  146. package/lib/surface/prompt-input.js.map +1 -0
  147. package/lib/surface/prompt-memory.d.ts +76 -0
  148. package/lib/surface/prompt-memory.d.ts.map +1 -0
  149. package/lib/surface/prompt-memory.js +167 -0
  150. package/lib/surface/prompt-memory.js.map +1 -0
  151. package/lib/surface/session-lifecycle.d.ts +120 -0
  152. package/lib/surface/session-lifecycle.d.ts.map +1 -0
  153. package/lib/surface/session-lifecycle.js +321 -0
  154. package/lib/surface/session-lifecycle.js.map +1 -0
  155. package/lib/surface/session-picker.d.ts +39 -0
  156. package/lib/surface/session-picker.d.ts.map +1 -0
  157. package/lib/surface/session-picker.js +107 -0
  158. package/lib/surface/session-picker.js.map +1 -0
  159. package/lib/surface/session-view.d.ts +86 -0
  160. package/lib/surface/session-view.d.ts.map +1 -0
  161. package/lib/surface/session-view.js +215 -0
  162. package/lib/surface/session-view.js.map +1 -0
  163. package/lib/surface/staged-turns.d.ts +81 -0
  164. package/lib/surface/staged-turns.d.ts.map +1 -0
  165. package/lib/surface/staged-turns.js +206 -0
  166. package/lib/surface/staged-turns.js.map +1 -0
  167. package/lib/surface/terminal-lifecycle.d.ts +76 -0
  168. package/lib/surface/terminal-lifecycle.d.ts.map +1 -0
  169. package/lib/surface/terminal-lifecycle.js +222 -0
  170. package/lib/surface/terminal-lifecycle.js.map +1 -0
  171. package/lib/terminal-text/scan.d.ts +44 -0
  172. package/lib/terminal-text/scan.d.ts.map +1 -0
  173. package/lib/terminal-text/scan.js +195 -0
  174. package/lib/terminal-text/scan.js.map +1 -0
  175. package/lib/terminal-text/sgr.d.ts +32 -0
  176. package/lib/terminal-text/sgr.d.ts.map +1 -0
  177. package/lib/terminal-text/sgr.js +203 -0
  178. package/lib/terminal-text/sgr.js.map +1 -0
  179. package/lib/terminal-text.d.ts +1 -1
  180. package/lib/terminal-text.d.ts.map +1 -1
  181. package/lib/terminal-text.js +2 -379
  182. package/lib/terminal-text.js.map +1 -1
  183. package/lib/theme-command.js +2 -1
  184. package/lib/theme-command.js.map +1 -1
  185. package/lib/theme-defaults.d.ts +64 -0
  186. package/lib/theme-defaults.d.ts.map +1 -0
  187. package/lib/theme-defaults.js +248 -0
  188. package/lib/theme-defaults.js.map +1 -0
  189. package/lib/theme-resolver.d.ts +36 -0
  190. package/lib/theme-resolver.d.ts.map +1 -0
  191. package/lib/theme-resolver.js +112 -0
  192. package/lib/theme-resolver.js.map +1 -0
  193. package/lib/theme-schema.d.ts.map +1 -1
  194. package/lib/theme-schema.js +3 -2
  195. package/lib/theme-schema.js.map +1 -1
  196. package/lib/theme-settings.d.ts +5 -7
  197. package/lib/theme-settings.d.ts.map +1 -1
  198. package/lib/theme-settings.js +27 -19
  199. package/lib/theme-settings.js.map +1 -1
  200. package/lib/theme-tokens.d.ts +0 -89
  201. package/lib/theme-tokens.d.ts.map +1 -1
  202. package/lib/theme-tokens.js +0 -356
  203. package/lib/theme-tokens.js.map +1 -1
  204. package/lib/theme.d.ts +1 -1
  205. package/lib/theme.d.ts.map +1 -1
  206. package/lib/theme.js +2 -1
  207. package/lib/theme.js.map +1 -1
  208. package/lib/tool-display.d.ts.map +1 -1
  209. package/lib/tool-display.js +2 -1
  210. package/lib/tool-display.js.map +1 -1
  211. package/lib/transcript/message-content.d.ts +21 -0
  212. package/lib/transcript/message-content.d.ts.map +1 -0
  213. package/lib/transcript/message-content.js +61 -0
  214. package/lib/transcript/message-content.js.map +1 -0
  215. package/lib/transcript/tool-calls.d.ts +106 -0
  216. package/lib/transcript/tool-calls.d.ts.map +1 -0
  217. package/lib/transcript/tool-calls.js +254 -0
  218. package/lib/transcript/tool-calls.js.map +1 -0
  219. package/lib/transcript.d.ts +14 -55
  220. package/lib/transcript.d.ts.map +1 -1
  221. package/lib/transcript.js +31 -253
  222. package/lib/transcript.js.map +1 -1
  223. package/lib/ui/dock.d.ts +14 -2
  224. package/lib/ui/dock.d.ts.map +1 -1
  225. package/lib/ui/dock.js +52 -10
  226. package/lib/ui/dock.js.map +1 -1
  227. package/lib/ui/editor.d.ts.map +1 -1
  228. package/lib/ui/editor.js +2 -1
  229. package/lib/ui/editor.js.map +1 -1
  230. package/lib/ui/keymap-picker.d.ts +2 -1
  231. package/lib/ui/keymap-picker.d.ts.map +1 -1
  232. package/lib/ui/keymap-picker.js +1 -0
  233. package/lib/ui/keymap-picker.js.map +1 -1
  234. package/lib/ui/view/gate-card.d.ts +21 -0
  235. package/lib/ui/view/gate-card.d.ts.map +1 -0
  236. package/lib/ui/view/gate-card.js +104 -0
  237. package/lib/ui/view/gate-card.js.map +1 -0
  238. package/lib/ui/view/tool-card.d.ts +138 -0
  239. package/lib/ui/view/tool-card.d.ts.map +1 -0
  240. package/lib/ui/view/tool-card.js +413 -0
  241. package/lib/ui/view/tool-card.js.map +1 -0
  242. package/lib/ui/view/transcript-message.d.ts +62 -0
  243. package/lib/ui/view/transcript-message.d.ts.map +1 -0
  244. package/lib/ui/view/transcript-message.js +158 -0
  245. package/lib/ui/view/transcript-message.js.map +1 -0
  246. package/lib/ui/view.d.ts +80 -220
  247. package/lib/ui/view.d.ts.map +1 -1
  248. package/lib/ui/view.js +81 -675
  249. package/lib/ui/view.js.map +1 -1
  250. package/package.json +3 -1
@@ -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,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAA;AAElE;;;;;;;;GAQG;AACH,MAAM,O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Presenter } 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';
@@ -25,8 +26,6 @@ export type TranscriptEntry = {
25
26
  };
26
27
  /** Reasoning kept per settled block, so one runaway thought cannot grow the transcript without bound. */
27
28
  export declare const REASONING_CHAR_LIMIT = 20000;
28
- /** One second in milliseconds, which is the unit a duration is reported in. */
29
- export declare const SECOND_MS = 1000;
30
29
  /**
31
30
  * Minimal durable-input shape the fold needs.
32
31
  *
@@ -38,17 +37,6 @@ export interface FoldableEvent {
38
37
  readonly type: string;
39
38
  readonly data?: unknown;
40
39
  }
41
- /**
42
- * What is known about one call the fold has seen requested and not answered.
43
- *
44
- * A settled call reads as nothing rather than as a zero elapsed time: "started
45
- * now" and "waiting an unknown time" are different things to say, and only the
46
- * fold can tell which one is true.
47
- */
48
- export interface LiveCallState {
49
- readonly running: boolean;
50
- readonly elapsed: number;
51
- }
52
40
  /**
53
41
  * Fold durable session events into readable rows, and hold the in-flight
54
42
  * assistant text and reasoning apart from them.
@@ -56,10 +44,10 @@ export interface LiveCallState {
56
44
  * Durable events own the transcript: the live stream is decoration that a
57
45
  * repaint or a resume can drop without changing what the reader sees. Tool
58
46
  * rows come from the tool's own render intent, so the fold never learns a tool
59
- * 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.
60
49
  */
61
50
  export declare class TranscriptModel {
62
- private readonly presenter?;
63
51
  /**
64
52
  * Clock for "how long has this been thinking or running"; injected so a test
65
53
  * can pin it and reachable through {@link now} so a renderer keys its rows
@@ -67,14 +55,6 @@ export declare class TranscriptModel {
67
55
  */
68
56
  private readonly clock;
69
57
  private readonly settled;
70
- private readonly pending;
71
- /**
72
- * Where each nested call landed on its root card.
73
- *
74
- * A dispatch logs a start and then a settle, so the second event has to find
75
- * the row the first one drew instead of adding a second line for one call.
76
- */
77
- private readonly pendingSub;
78
58
  private live;
79
59
  private liveReasoning;
80
60
  private reasoningStartedAt;
@@ -93,7 +73,9 @@ export declare class TranscriptModel {
93
73
  */
94
74
  private thoughtSeq;
95
75
  private liveReasoningId;
96
- constructor(presenter?: ToolPresenter | undefined,
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,
97
79
  /**
98
80
  * Clock for "how long has this been thinking or running"; injected so a test
99
81
  * can pin it and reachable through {@link now} so a renderer keys its rows
@@ -121,18 +103,11 @@ export declare class TranscriptModel {
121
103
  /**
122
104
  * How long one call has been in flight, or that it is not.
123
105
  *
124
- * The fold owns the request-to-result window, so a renderer asks here rather
125
- * than timing the row itself: a row read twice in one frame would otherwise
126
- * report two durations for one call.
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.
127
109
  */
128
110
  liveCall(callId: string): LiveCallState;
129
- /**
130
- * Whole seconds since a moment the fold read the clock at.
131
- *
132
- * Floored, not rounded: a duration that claims a second it has not waited yet
133
- * would tick up before the call has been waiting that long.
134
- */
135
- private secondsSince;
136
111
  /** Whether any row exists, so a caller can decide to clear or redraw. */
137
112
  isEmpty(): boolean;
138
113
  reset(): void;
@@ -156,25 +131,9 @@ export declare class TranscriptModel {
156
131
  /** Settle the reasoning streamed so far into a row of its own. */
157
132
  private settleReasoning;
158
133
  apply(event: FoldableEvent): void;
159
- /**
160
- * Fold one nested PTC call onto the card of the run_code call that dispatched it.
161
- *
162
- * Dispatches are logged while the program runs, so the root is still pending;
163
- * a dispatch whose root is not in this fold belongs to a window that starts
164
- * mid-run, and attaching it to another card would claim a call that card
165
- * never made.
166
- */
167
- private applySubCall;
168
- /**
169
- * The card a dispatched call's log answers with.
170
- *
171
- * A presenter can only rebuild the view it declared when the logged content is
172
- * enough for it: a shell's output is, while a read's numbered window and a
173
- * search's hits live in the metadata a dispatch does not carry. The fallback is
174
- * the content the program was actually shown, so a row whose tool cannot be
175
- * re-presented still opens to its outcome rather than to nothing.
176
- */
177
- private subCallResult;
178
- 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;
179
138
  }
180
139
  //# sourceMappingURL=transcript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgG,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAwB,MAAM,YAAY,CAAA;AAKlL,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;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