@sagmans/dsh-tui 0.6.0 → 0.8.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 (271) 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 +199 -0
  6. package/.agents/skills/dsh-tui-update-models/references/model-wiring.md +292 -0
  7. package/.agents/skills/dsh-tui-update-models/scripts/dump-model-catalog.mjs +314 -0
  8. package/README.md +154 -27
  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/herdr/client.d.ts +8 -0
  55. package/lib/herdr/client.d.ts.map +1 -1
  56. package/lib/herdr/client.js +13 -1
  57. package/lib/herdr/client.js.map +1 -1
  58. package/lib/herdr/constants.d.ts +18 -0
  59. package/lib/herdr/constants.d.ts.map +1 -1
  60. package/lib/herdr/constants.js +18 -0
  61. package/lib/herdr/constants.js.map +1 -1
  62. package/lib/herdr/reporter.d.ts +20 -4
  63. package/lib/herdr/reporter.d.ts.map +1 -1
  64. package/lib/herdr/reporter.js +70 -20
  65. package/lib/herdr/reporter.js.map +1 -1
  66. package/lib/herdr/state.d.ts +10 -0
  67. package/lib/herdr/state.d.ts.map +1 -1
  68. package/lib/herdr/state.js +21 -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 +348 -2602
  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 -625
  81. package/lib/input/actions.js.map +1 -1
  82. package/lib/input/completion.d.ts +1 -1
  83. package/lib/input/completion.d.ts.map +1 -1
  84. package/lib/input/completion.js +2 -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 +3 -1
  106. package/lib/input/keymap.js.map +1 -1
  107. package/lib/input/workspace-files.d.ts +10 -0
  108. package/lib/input/workspace-files.d.ts.map +1 -0
  109. package/lib/input/workspace-files.js +359 -0
  110. package/lib/input/workspace-files.js.map +1 -0
  111. package/lib/install-skills.d.ts +39 -0
  112. package/lib/install-skills.d.ts.map +1 -0
  113. package/lib/install-skills.js +273 -0
  114. package/lib/install-skills.js.map +1 -0
  115. package/lib/keys-command.d.ts +2 -1
  116. package/lib/keys-command.d.ts.map +1 -1
  117. package/lib/keys-command.js +2 -1
  118. package/lib/keys-command.js.map +1 -1
  119. package/lib/model-list.d.ts +37 -0
  120. package/lib/model-list.d.ts.map +1 -0
  121. package/lib/model-list.js +60 -0
  122. package/lib/model-list.js.map +1 -0
  123. package/lib/startup.d.ts +8 -0
  124. package/lib/startup.d.ts.map +1 -1
  125. package/lib/startup.js +120 -24
  126. package/lib/startup.js.map +1 -1
  127. package/lib/subagents.d.ts +7 -3
  128. package/lib/subagents.d.ts.map +1 -1
  129. package/lib/subagents.js +28 -4
  130. package/lib/subagents.js.map +1 -1
  131. package/lib/surface/appearance-preferences.d.ts +26 -0
  132. package/lib/surface/appearance-preferences.d.ts.map +1 -0
  133. package/lib/surface/appearance-preferences.js +139 -0
  134. package/lib/surface/appearance-preferences.js.map +1 -0
  135. package/lib/surface/appearance.d.ts +87 -0
  136. package/lib/surface/appearance.d.ts.map +1 -0
  137. package/lib/surface/appearance.js +353 -0
  138. package/lib/surface/appearance.js.map +1 -0
  139. package/lib/surface/background-work.d.ts +51 -0
  140. package/lib/surface/background-work.d.ts.map +1 -0
  141. package/lib/surface/background-work.js +172 -0
  142. package/lib/surface/background-work.js.map +1 -0
  143. package/lib/surface/commands.d.ts +82 -0
  144. package/lib/surface/commands.d.ts.map +1 -0
  145. package/lib/surface/commands.js +370 -0
  146. package/lib/surface/commands.js.map +1 -0
  147. package/lib/surface/modal-input.d.ts +59 -0
  148. package/lib/surface/modal-input.d.ts.map +1 -0
  149. package/lib/surface/modal-input.js +243 -0
  150. package/lib/surface/modal-input.js.map +1 -0
  151. package/lib/surface/model-choice.d.ts +54 -0
  152. package/lib/surface/model-choice.d.ts.map +1 -0
  153. package/lib/surface/model-choice.js +325 -0
  154. package/lib/surface/model-choice.js.map +1 -0
  155. package/lib/surface/preset-choice.d.ts +78 -0
  156. package/lib/surface/preset-choice.d.ts.map +1 -0
  157. package/lib/surface/preset-choice.js +163 -0
  158. package/lib/surface/preset-choice.js.map +1 -0
  159. package/lib/surface/prompt-input.d.ts +97 -0
  160. package/lib/surface/prompt-input.d.ts.map +1 -0
  161. package/lib/surface/prompt-input.js +215 -0
  162. package/lib/surface/prompt-input.js.map +1 -0
  163. package/lib/surface/prompt-memory.d.ts +76 -0
  164. package/lib/surface/prompt-memory.d.ts.map +1 -0
  165. package/lib/surface/prompt-memory.js +167 -0
  166. package/lib/surface/prompt-memory.js.map +1 -0
  167. package/lib/surface/session-lifecycle.d.ts +120 -0
  168. package/lib/surface/session-lifecycle.d.ts.map +1 -0
  169. package/lib/surface/session-lifecycle.js +324 -0
  170. package/lib/surface/session-lifecycle.js.map +1 -0
  171. package/lib/surface/session-picker.d.ts +39 -0
  172. package/lib/surface/session-picker.d.ts.map +1 -0
  173. package/lib/surface/session-picker.js +107 -0
  174. package/lib/surface/session-picker.js.map +1 -0
  175. package/lib/surface/session-view.d.ts +86 -0
  176. package/lib/surface/session-view.d.ts.map +1 -0
  177. package/lib/surface/session-view.js +215 -0
  178. package/lib/surface/session-view.js.map +1 -0
  179. package/lib/surface/staged-turns.d.ts +81 -0
  180. package/lib/surface/staged-turns.d.ts.map +1 -0
  181. package/lib/surface/staged-turns.js +206 -0
  182. package/lib/surface/staged-turns.js.map +1 -0
  183. package/lib/surface/terminal-lifecycle.d.ts +76 -0
  184. package/lib/surface/terminal-lifecycle.d.ts.map +1 -0
  185. package/lib/surface/terminal-lifecycle.js +222 -0
  186. package/lib/surface/terminal-lifecycle.js.map +1 -0
  187. package/lib/terminal-text/scan.d.ts +44 -0
  188. package/lib/terminal-text/scan.d.ts.map +1 -0
  189. package/lib/terminal-text/scan.js +195 -0
  190. package/lib/terminal-text/scan.js.map +1 -0
  191. package/lib/terminal-text/sgr.d.ts +32 -0
  192. package/lib/terminal-text/sgr.d.ts.map +1 -0
  193. package/lib/terminal-text/sgr.js +203 -0
  194. package/lib/terminal-text/sgr.js.map +1 -0
  195. package/lib/terminal-text.d.ts +1 -1
  196. package/lib/terminal-text.d.ts.map +1 -1
  197. package/lib/terminal-text.js +2 -379
  198. package/lib/terminal-text.js.map +1 -1
  199. package/lib/theme-command.js +2 -1
  200. package/lib/theme-command.js.map +1 -1
  201. package/lib/theme-defaults.d.ts +64 -0
  202. package/lib/theme-defaults.d.ts.map +1 -0
  203. package/lib/theme-defaults.js +248 -0
  204. package/lib/theme-defaults.js.map +1 -0
  205. package/lib/theme-files.d.ts +1 -1
  206. package/lib/theme-files.d.ts.map +1 -1
  207. package/lib/theme-files.js +1 -1
  208. package/lib/theme-files.js.map +1 -1
  209. package/lib/theme-resolver.d.ts +36 -0
  210. package/lib/theme-resolver.d.ts.map +1 -0
  211. package/lib/theme-resolver.js +112 -0
  212. package/lib/theme-resolver.js.map +1 -0
  213. package/lib/theme-schema.d.ts.map +1 -1
  214. package/lib/theme-schema.js +3 -2
  215. package/lib/theme-schema.js.map +1 -1
  216. package/lib/theme-settings.d.ts +5 -7
  217. package/lib/theme-settings.d.ts.map +1 -1
  218. package/lib/theme-settings.js +37 -21
  219. package/lib/theme-settings.js.map +1 -1
  220. package/lib/theme-tokens.d.ts +0 -89
  221. package/lib/theme-tokens.d.ts.map +1 -1
  222. package/lib/theme-tokens.js +0 -356
  223. package/lib/theme-tokens.js.map +1 -1
  224. package/lib/theme.d.ts +1 -1
  225. package/lib/theme.d.ts.map +1 -1
  226. package/lib/theme.js +2 -1
  227. package/lib/theme.js.map +1 -1
  228. package/lib/tool-display.d.ts.map +1 -1
  229. package/lib/tool-display.js +2 -1
  230. package/lib/tool-display.js.map +1 -1
  231. package/lib/transcript/message-content.d.ts +21 -0
  232. package/lib/transcript/message-content.d.ts.map +1 -0
  233. package/lib/transcript/message-content.js +61 -0
  234. package/lib/transcript/message-content.js.map +1 -0
  235. package/lib/transcript/tool-calls.d.ts +106 -0
  236. package/lib/transcript/tool-calls.d.ts.map +1 -0
  237. package/lib/transcript/tool-calls.js +254 -0
  238. package/lib/transcript/tool-calls.js.map +1 -0
  239. package/lib/transcript.d.ts +14 -55
  240. package/lib/transcript.d.ts.map +1 -1
  241. package/lib/transcript.js +31 -253
  242. package/lib/transcript.js.map +1 -1
  243. package/lib/ui/dock.d.ts +14 -2
  244. package/lib/ui/dock.d.ts.map +1 -1
  245. package/lib/ui/dock.js +52 -10
  246. package/lib/ui/dock.js.map +1 -1
  247. package/lib/ui/editor.d.ts.map +1 -1
  248. package/lib/ui/editor.js +2 -1
  249. package/lib/ui/editor.js.map +1 -1
  250. package/lib/ui/keymap-picker.d.ts +2 -1
  251. package/lib/ui/keymap-picker.d.ts.map +1 -1
  252. package/lib/ui/keymap-picker.js +1 -0
  253. package/lib/ui/keymap-picker.js.map +1 -1
  254. package/lib/ui/view/gate-card.d.ts +21 -0
  255. package/lib/ui/view/gate-card.d.ts.map +1 -0
  256. package/lib/ui/view/gate-card.js +104 -0
  257. package/lib/ui/view/gate-card.js.map +1 -0
  258. package/lib/ui/view/tool-card.d.ts +149 -0
  259. package/lib/ui/view/tool-card.d.ts.map +1 -0
  260. package/lib/ui/view/tool-card.js +429 -0
  261. package/lib/ui/view/tool-card.js.map +1 -0
  262. package/lib/ui/view/transcript-message.d.ts +62 -0
  263. package/lib/ui/view/transcript-message.d.ts.map +1 -0
  264. package/lib/ui/view/transcript-message.js +158 -0
  265. package/lib/ui/view/transcript-message.js.map +1 -0
  266. package/lib/ui/view.d.ts +105 -223
  267. package/lib/ui/view.d.ts.map +1 -1
  268. package/lib/ui/view.js +132 -679
  269. package/lib/ui/view.js.map +1 -1
  270. package/package.json +3 -1
  271. package/themes/violet-orbit.yaml +7 -5
@@ -0,0 +1,429 @@
1
+ /**
2
+ * How one tool's card draws: its header, its measured facts, the nested calls a
3
+ * program dispatched, and the preview an opened card shows.
4
+ *
5
+ * Kept apart from the view that places rows because card drawing answers to the
6
+ * presenter's own card shape and to the reader's per-tool display policy, and
7
+ * neither of those knows about reading order or row caches.
8
+ */
9
+ import { visibleWidth, wrapTextWithAnsi } from '@earendil-works/pi-tui';
10
+ import { cardDetailRows, shellFoldHint, shellRetentionHint } from "../../cards/preview.js";
11
+ import { clip, oneLine } from "../../cards.js";
12
+ import {} from "../../input/actions.js";
13
+ import {} from "../../transcript.js";
14
+ import {} from "../../transcript/tool-calls.js";
15
+ import {} from "../../tool-display.js";
16
+ import { CARD_ROW_TOKEN } from "../../theme-tokens.js";
17
+ import {} from "../../theme.js";
18
+ import {} from "../view.js";
19
+ /** A nested call is a signpost under its card, so it sits one step shallower than that card's detail. */
20
+ const SUBCALL_INDENT = ' ';
21
+ /**
22
+ * Blank columns a one-line tool row keeps at the right edge.
23
+ *
24
+ * The cut mark would otherwise sit under the terminal's own last column, where
25
+ * a border or the cursor lives; the padding is part of the look, not a
26
+ * preference, so it is not a settings key.
27
+ */
28
+ const COLLAPSED_EDGE_PADDING = 5;
29
+ /**
30
+ * The mark that says a call is in flight.
31
+ *
32
+ * The same arrow the dock uses for what is still to do, because it answers the
33
+ * same question — is this work still moving — and a second symbol for it would
34
+ * read as a second state.
35
+ */
36
+ /** A duration below a whole second is not a measurement, so it is not drawn. */
37
+ const MIN_ELAPSED_SECONDS = 1;
38
+ /** A row that a card's kind does not map draws as generic detail. */
39
+ const FALLBACK_ROW_TOKEN = 'tool.detail';
40
+ /** The words an opened card uses when retention, not the fold, dropped rows. */
41
+ const CARD_HINT_RETAINED = 'more lines not shown';
42
+ /** What separates a card's header from its measured facts, and the facts from each other. */
43
+ const STAT_LEAD = ' ';
44
+ const STAT_SEPARATOR = ' · ';
45
+ /** The symbol that says what a fact counts; a size needs none. */
46
+ const STAT_SYMBOL = {
47
+ added: '+',
48
+ changed: '~',
49
+ removed: '-',
50
+ size: '',
51
+ };
52
+ /** Which colour draws each fact, so added, changed, and removed never share one. */
53
+ const STAT_TOKEN = {
54
+ added: 'tool.stat.added',
55
+ changed: 'tool.stat.changed',
56
+ removed: 'tool.stat.removed',
57
+ size: 'tool.stat.size',
58
+ };
59
+ /** The column a one-line tool row must not pass, so a cut never reaches the edge. */
60
+ const collapsedEdge = (width) => Math.max(1, width - COLLAPSED_EDGE_PADDING);
61
+ /** The indent a card's own detail rows sit under, one step inside the header above them. */
62
+ const DETAIL_INDENT = ' ';
63
+ export class ToolCards {
64
+ context;
65
+ constructor(context) {
66
+ this.context = context;
67
+ }
68
+ /**
69
+ * Wrap one already-styled block under a prefix.
70
+ *
71
+ * A card header mixes tokens — title, argument, stats — in a single string, so
72
+ * it cannot go through {@link pushWrapped}, which escapes and restyles plain
73
+ * text. Its width still has to fold at the screen edge rather than be cut,
74
+ * because the argument is the part a reader scans for and a silently dropped
75
+ * command is worse than a taller card.
76
+ */
77
+ pushStyledWrapped(lines, content, width, prefix) {
78
+ const lead = visibleWidth(prefix);
79
+ const indent = ' '.repeat(lead);
80
+ const wrapped = wrapTextWithAnsi(content, Math.max(1, width - lead));
81
+ wrapped.forEach((line, index) => {
82
+ lines.push(this.context.theme.cut(`${index === 0 ? prefix : indent}${line}`, width, ''));
83
+ });
84
+ }
85
+ pushCard(lines, entry, width, spans) {
86
+ const live = this.context.liveCall(entry.id);
87
+ // The card was drawn when the call was requested, so a duration measured at
88
+ // render time is the only clock it can be shown with: the fold holds the one
89
+ // timestamp this window has.
90
+ const card = this.cardOf(entry.card, live);
91
+ const spec = this.context.toolDisplay(card.tool);
92
+ const expanded = this.context.expansionOf(entry);
93
+ const start = lines.length;
94
+ // What a folded card shows of its rows is the reader's choice, so a shell
95
+ // run no longer spends twenty rows on screen just because its output is the
96
+ // answer: the answer is one click away, and the row it costs is one.
97
+ const preview = expanded
98
+ ? { expanded: true }
99
+ : spec.output === 'tail'
100
+ ? { expanded: false, preview: 'tail', rows: spec.tail }
101
+ : { expanded: false, preview: 'title' };
102
+ const { lines: detail, hidden } = cardDetailRows(card, preview);
103
+ const titleToken = this.titleToken(card, { running: 'tool.running.title', failed: 'tool.failed.title' });
104
+ const glyphToken = card.failed ? 'tool.failed.glyph' : 'tool.glyph';
105
+ if (expanded) {
106
+ const { lead, body } = this.renderHead(card, titleToken, glyphToken);
107
+ // A header that folds keeps the argument and its stats; a terminal command
108
+ // can be longer than the screen, so it wraps under its own indent.
109
+ if (body !== '')
110
+ this.pushStyledWrapped(lines, body, width, lead);
111
+ }
112
+ else {
113
+ const head = this.renderCollapsedHead(card, hidden, titleToken, glyphToken, width);
114
+ if (head !== '')
115
+ lines.push(this.context.theme.cut(head, collapsedEdge(width), '…'));
116
+ }
117
+ // The calls a program dispatched sit under the header whether the card is
118
+ // open or folded: one line per call is what the card stands for, and hiding
119
+ // them behind the card's own fold made a program's work invisible.
120
+ const headerEnd = lines.length;
121
+ const nestedKey = card.subCalls === undefined ? undefined : this.context.subCallsKey(entry.id);
122
+ const nested = this.context.subCallsOpen(entry);
123
+ if (nested)
124
+ this.pushSubCalls(lines, entry, width, spans);
125
+ // Where the calls stopped, so the card's own rows are counted from below them.
126
+ const callsEnd = lines.length;
127
+ if (expanded && card.kind === 'terminal' && card.argument !== undefined && card.argument !== '' && this.context.theme.visible('tool.args')) {
128
+ this.pushStyledWrapped(lines, this.context.theme.rich(card.argument, { token: 'tool.args', column: visibleWidth(DETAIL_INDENT) }), width, DETAIL_INDENT);
129
+ }
130
+ for (const row of detail) {
131
+ const drawn = this.detailRow(row, card.kind);
132
+ // A row whose every part is hidden draws nothing, and nothing must not
133
+ // cost a line: the indent would read as an empty row the card does not have.
134
+ if (drawn === '')
135
+ continue;
136
+ lines.push(this.context.theme.cut(`${DETAIL_INDENT}${drawn}`, width, ''));
137
+ }
138
+ // The pill is not output, so it draws after the preview window rather than
139
+ // inside it: a run bounded to its tail still reports how it ended. Folded,
140
+ // it rides the header instead, where it costs no row of its own.
141
+ if (expanded && card.kind === 'terminal' && card.status !== undefined && this.context.theme.visible('tool.terminal.status')) {
142
+ lines.push(this.context.theme.cut(`${DETAIL_INDENT}${this.context.theme.rich(card.status, { token: 'tool.terminal.status', column: visibleWidth(DETAIL_INDENT) })}`, width, ''));
143
+ }
144
+ // A shell card's rows are kept from the end, so a hidden count always names
145
+ // the rows *before* what is on screen and the hint has to say so; every
146
+ // other card keeps its head, where a neutral count is enough. A folded card
147
+ // that shows a tail is bounded by that window, an opened one by retention,
148
+ // so the opened hint promises no more than memory kept.
149
+ if (hidden > 0 && this.context.theme.visible('tool.hint')) {
150
+ const hint = preview.expanded
151
+ ? card.kind === 'terminal' ? shellRetentionHint(hidden) : `${hidden} ${CARD_HINT_RETAINED}`
152
+ : preview.preview === 'tail'
153
+ ? shellFoldHint(hidden, this.context.cardOpenHint())
154
+ : undefined;
155
+ if (hint !== undefined) {
156
+ lines.push(this.context.theme.style('tool.hint', this.context.theme.cut(`${DETAIL_INDENT}${hint}`, width, '')));
157
+ }
158
+ }
159
+ // A card that dispatched calls splits its rows between two targets: the
160
+ // header answers for the calls one level under it, and the rows below them
161
+ // fold the card the way every other card folds. The header stops where it
162
+ // stopped drawing rather than at the calls, because a reader pointing at
163
+ // what the program returned means the card, not the list above it. The call
164
+ // rows keep the tighter targets they draw for themselves, so opening one
165
+ // call still opens that call rather than hiding the list around it.
166
+ const key = this.context.toolKey(entry.id);
167
+ if (nestedKey !== undefined && headerEnd > start) {
168
+ spans.push({ key: nestedKey, start, end: headerEnd, expanded: nested });
169
+ }
170
+ const cardStart = nestedKey === undefined ? start : nested ? callsEnd : headerEnd;
171
+ if (key !== undefined && lines.length > cardStart)
172
+ spans.push({ key, start: cardStart, end: lines.length, expanded });
173
+ }
174
+ /**
175
+ * The calls one card dispatched, one entry each.
176
+ *
177
+ * A nested call is a signpost rather than a card of its own, so it keeps one
178
+ * entry per call, clipped to that entry until the reader clicks it: the
179
+ * argument is the part a reader scans for, and one that always wrapped pushed
180
+ * the rest of the program off the screen.
181
+ */
182
+ pushSubCalls(lines, entry, width, spans) {
183
+ const card = entry.card;
184
+ const subCalls = card.subCalls ?? [];
185
+ for (const call of subCalls) {
186
+ const start = lines.length;
187
+ const open = this.context.subCallOpen(entry.id, call.id);
188
+ // A program's calls are the work between its start and its return value, so
189
+ // each row's own name says what became of it — the call still in flight in
190
+ // the running colour, one that failed in the failed colour, and one that is
191
+ // back in the colour every settled name is read in.
192
+ const titleToken = this.titleToken(call, { running: 'tool.subcall.running', failed: 'tool.failed.title' });
193
+ const column = visibleWidth(SUBCALL_INDENT);
194
+ const title = this.context.theme.visible(titleToken) ? this.context.theme.rich(call.title, { token: titleToken, column }) : '';
195
+ const argument = call.argument === undefined || !this.context.theme.visible('tool.subcall.args')
196
+ ? ''
197
+ : this.context.theme.rich(call.argument, { token: 'tool.subcall.args', column });
198
+ // How the call ended is the tool's own line about its outcome — a shell's
199
+ // exit status — and it is the only part of a dispatch's result that fits on
200
+ // the one row a reader scans.
201
+ const status = call.status === undefined || !this.context.theme.visible('tool.terminal.status')
202
+ ? ''
203
+ : this.context.theme.rich(call.status, { token: 'tool.terminal.status', column });
204
+ // Joined rather than concatenated: the name and the argument are one space
205
+ // apart whether or not either of them is drawn at all, and the outcome joins
206
+ // the row the way it joins every other one.
207
+ const label = [title, argument.trim()].filter(part => part !== '').join(' ');
208
+ const drawn = [label, status].filter(part => part !== '').join(this.statSeparator());
209
+ // A row whose every part is hidden draws nothing, and nothing must not
210
+ // cost a line the card does not have.
211
+ if (drawn === '')
212
+ continue;
213
+ if (open) {
214
+ this.pushStyledWrapped(lines, drawn, width, SUBCALL_INDENT);
215
+ this.pushSubCallOutput(lines, call, width);
216
+ }
217
+ else {
218
+ lines.push(this.context.theme.cut(`${SUBCALL_INDENT}${drawn}`, collapsedEdge(width), '…'));
219
+ }
220
+ spans.push({ key: this.context.subCallKey(entry.id, call.id), start, end: lines.length, expanded: open });
221
+ }
222
+ const hidden = (card.subCallsTotal ?? subCalls.length) - subCalls.length;
223
+ if (hidden > 0 && this.context.theme.visible('tool.hint')) {
224
+ lines.push(this.context.theme.style('tool.hint', this.context.theme.cut(`${SUBCALL_INDENT}… ${hidden} more calls`, width, '')));
225
+ }
226
+ }
227
+ /**
228
+ * What a dispatched call declared and what it produced, under its argument.
229
+ *
230
+ * The parent card keeps only the program's return value, so both are otherwise
231
+ * gone; a reader who opens the row is asking for them, which is why the call's
232
+ * own rows come first and its outcome under them. Each section keeps the
233
+ * retention its card used, so a long run still says what it dropped.
234
+ */
235
+ pushSubCallOutput(lines, call, width) {
236
+ for (const section of [call.presented, call.output]) {
237
+ if (section === undefined)
238
+ continue;
239
+ for (const row of section.rows) {
240
+ const drawn = this.detailRow(row, section.kind);
241
+ if (drawn === '')
242
+ continue;
243
+ lines.push(this.context.theme.cut(`${DETAIL_INDENT}${drawn}`, width, ''));
244
+ }
245
+ const hidden = section.totalLines - section.rows.length;
246
+ if (hidden > 0 && this.context.theme.visible('tool.hint')) {
247
+ // A shell's rows are kept from the end, so its hidden count names the
248
+ // earlier lines; every other kind keeps its head, where the count is of
249
+ // what follows and a neutral wording is what the card uses too.
250
+ const hint = section.kind === 'terminal' ? shellRetentionHint(hidden) : `${hidden} ${CARD_HINT_RETAINED}`;
251
+ lines.push(this.context.theme.style('tool.hint', this.context.theme.cut(`${DETAIL_INDENT}${hint}`, width, '')));
252
+ }
253
+ }
254
+ }
255
+ /**
256
+ * A folded card's one row: label, clipped argument, measured facts, outcome.
257
+ *
258
+ * The outcome rides this row rather than a row of its own, because one line
259
+ * per call is what folding promises. A shell card's hidden rows are counted
260
+ * here too: its output is the answer the reader asked for, and a fold that
261
+ * left no trace of it would read as a call that produced nothing.
262
+ *
263
+ * The argument is the part that gives up room: it is clipped to whatever the
264
+ * label, the facts, and the outcome leave before the edge, so a wide terminal
265
+ * shows more of the call while a narrow one still shows how it ended.
266
+ */
267
+ renderCollapsedHead(card, hidden, titleToken, glyphToken, width) {
268
+ const edge = collapsedEdge(width);
269
+ const lead = this.cardLead(titleToken, glyphToken);
270
+ const title = this.cardTitle(card, titleToken);
271
+ const separator = this.statSeparator();
272
+ // One row is what folding promises, so a running call reports its duration
273
+ // on the same line rather than costing a row of its own.
274
+ const elapsed = this.elapsedStat(card);
275
+ // The facts carry their own lead; the outcome and the count join whatever
276
+ // precedes them, so the folded line reads as one sentence about the run.
277
+ let tail = this.renderStats(card.stats);
278
+ const status = card.kind === 'terminal' && card.status !== undefined && this.context.theme.visible('tool.terminal.status')
279
+ ? this.context.theme.rich(card.status, { token: 'tool.terminal.status' })
280
+ : '';
281
+ if (status !== '')
282
+ tail += `${separator}${status}`;
283
+ if (card.kind === 'terminal' && hidden > 0) {
284
+ const count = this.renderStats([{ kind: 'size', text: `${hidden} line${hidden === 1 ? '' : 's'}` }], '');
285
+ if (count !== '')
286
+ tail += `${separator}${count}`;
287
+ }
288
+ if (elapsed !== '')
289
+ tail += `${separator}${elapsed}`;
290
+ const fixed = visibleWidth(lead) + visibleWidth(title) + visibleWidth(tail);
291
+ const room = Math.max(0, edge - fixed - (title === '' ? 0 : 1));
292
+ const argument = room > 0 ? this.cardArgument(card, room) : '';
293
+ const head = [title, argument].filter(part => part !== '').join(' ');
294
+ // A row with no visible label or argument opens with the tail, and a line
295
+ // that begins with a separator reads as a row that lost its first word.
296
+ if (head === '' && tail.startsWith(separator))
297
+ tail = tail.slice(separator.length);
298
+ return `${lead}${head}${tail}`;
299
+ }
300
+ /**
301
+ * One detail row, drawn with its own kind's colours or nothing at all.
302
+ *
303
+ * The row says what it is, so the renderer never guesses from the text: a diff
304
+ * line beginning with "+" is an addition because the presenter said so, not
305
+ * because of its first character.
306
+ */
307
+ detailRow(row, kind) {
308
+ return row.parts
309
+ .map(part => {
310
+ const token = CARD_ROW_TOKEN[kind]?.[part.class] ?? FALLBACK_ROW_TOKEN;
311
+ return this.context.theme.visible(token) ? this.context.theme.rich(part.text, { token, column: visibleWidth(DETAIL_INDENT) }) : '';
312
+ })
313
+ .join('');
314
+ }
315
+ /** The mark that introduces a card, empty when the theme hides its label. */
316
+ cardLead(titleToken, glyphToken) {
317
+ return this.context.theme.visible(titleToken) ? this.context.theme.glyph(glyphToken) : '';
318
+ }
319
+ /** A card's label, styled, or nothing when the theme hides it. */
320
+ cardTitle(card, titleToken) {
321
+ return this.context.theme.visible(titleToken) ? this.context.theme.rich(card.title, { token: titleToken }) : '';
322
+ }
323
+ /** A card's argument, styled and flattened, clipped to `limit` when one is given. */
324
+ cardArgument(card, limit) {
325
+ if (card.argument === undefined || card.argument === '' || !this.context.theme.visible('tool.args'))
326
+ return '';
327
+ const shown = limit === undefined ? card.argument : clip(oneLine(card.argument), limit);
328
+ return this.context.theme.rich(shown, { token: 'tool.args' });
329
+ }
330
+ /**
331
+ * A card's header: its label, its argument, and its measured facts.
332
+ *
333
+ * The glyph is returned apart from the body so a wrapped continuation can
334
+ * align under the label rather than under the mark. An opened terminal's
335
+ * argument is left out because it needs a row of its own — it is the one
336
+ * argument that can be a whole command rather than a word.
337
+ */
338
+ renderHead(card, titleToken, glyphToken) {
339
+ const lead = this.cardLead(titleToken, glyphToken);
340
+ const title = this.cardTitle(card, titleToken);
341
+ const argument = card.kind === 'terminal' ? '' : this.cardArgument(card);
342
+ const head = [title, argument].filter(part => part !== '').join(' ');
343
+ const stats = this.renderStats(card.stats);
344
+ const elapsed = this.elapsedStat(card);
345
+ return { lead, body: `${head}${stats}${elapsed === '' ? '' : `${this.statSeparator()}${elapsed}`}` };
346
+ }
347
+ /**
348
+ * The colour a call's name is drawn in, which is the whole of its state.
349
+ *
350
+ * The name is where a reader looking for a call looks first, so what that call
351
+ * is doing belongs in the name rather than in a glyph beside it: one name, in
352
+ * the colour of its state, and nothing a reader has to learn to read first.
353
+ *
354
+ * A state is only how a name is painted, though, so a reader who turns one of
355
+ * these colours off still gets the name: hiding a state token takes the colour
356
+ * away, not the word it was painted on.
357
+ */
358
+ titleToken(state, tokens) {
359
+ if (state.failed)
360
+ return this.context.theme.visible(tokens.failed) ? tokens.failed : 'tool.title';
361
+ if (state.running === true)
362
+ return this.context.theme.visible(tokens.running) ? tokens.running : 'tool.title';
363
+ return 'tool.title';
364
+ }
365
+ /**
366
+ * The seconds a call has taken: counting while it is unanswered, and kept on
367
+ * the card of a program that dispatched calls.
368
+ *
369
+ * A plain tool's duration is not worth the width once its outcome is on the
370
+ * row, but a program is a thing that took time, and the reader who watched the
371
+ * timer count wants the total it ended on — quietly, since the work is over.
372
+ */
373
+ elapsedStat(card) {
374
+ const seconds = card.elapsed ?? 0;
375
+ if (seconds < MIN_ELAPSED_SECONDS)
376
+ return '';
377
+ const token = card.running === true
378
+ ? 'tool.running.elapsed'
379
+ : this.dispatchedCalls(card)
380
+ ? 'tool.elapsed.done'
381
+ : undefined;
382
+ if (token === undefined || !this.context.theme.visible(token))
383
+ return '';
384
+ return this.context.theme.style(token, `${STAT_SYMBOL.changed}${seconds}s`);
385
+ }
386
+ /**
387
+ * Whether this card drew calls a program dispatched.
388
+ *
389
+ * The child rows are the fold's own statement that the card is a program's, so
390
+ * the view never has to know the name of the tool that runs one.
391
+ */
392
+ dispatchedCalls(card) {
393
+ return card.subCalls !== undefined;
394
+ }
395
+ /**
396
+ * The card as this frame reads it, with its elapsed time filled in.
397
+ *
398
+ * The entry itself is left alone: the rows are cached by entry identity, so
399
+ * rewriting one every second to carry a number that changes every second would
400
+ * discard the rows of a call that has been waiting all along.
401
+ */
402
+ cardOf(card, live) {
403
+ if (!live.running || card.running === true)
404
+ return card;
405
+ return { ...card, running: true, elapsed: live.elapsed };
406
+ }
407
+ /** The separator a header uses between its label, its facts, and its outcome. */
408
+ statSeparator() {
409
+ return this.context.theme.style('tool.stat.separator', STAT_SEPARATOR);
410
+ }
411
+ /**
412
+ * The measured facts, each in its own colour, or nothing when none is visible.
413
+ *
414
+ * The lead is a parameter because a header that already carries a title and an
415
+ * argument separates its facts with the same mark as its outcome, while facts
416
+ * on a row of their own stand apart with blank columns.
417
+ */
418
+ renderStats(stats, lead = STAT_LEAD) {
419
+ if (stats === undefined || stats.length === 0)
420
+ return '';
421
+ const drawn = stats
422
+ .filter(stat => this.context.theme.visible(STAT_TOKEN[stat.kind]))
423
+ .map(stat => this.context.theme.rich(`${STAT_SYMBOL[stat.kind]}${stat.text}`, { token: STAT_TOKEN[stat.kind] }));
424
+ if (drawn.length === 0)
425
+ return '';
426
+ return `${lead}${drawn.join(this.statSeparator())}`;
427
+ }
428
+ }
429
+ //# sourceMappingURL=tool-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-card.js","sourceRoot":"","sources":["../../../src/ui/view/tool-card.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,gB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AK,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;QAClH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAA;QACjC,OAAO,GAAG,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,CAAA;IACrD,CAAC;CACJ"}
@@ -0,0 +1,62 @@
1
+ import { type TranscriptEntry } from '../../transcript.ts';
2
+ import { type TuiToken } from '../../theme-tokens.ts';
3
+ import { type TuiTheme } from '../../theme.ts';
4
+ import { type FrameRow } from '../frame.ts';
5
+ import { type MarkdownFace, type MarkdownRenderer } from '../markdown.ts';
6
+ import { type ClickSpan } from '../view.ts';
7
+ export interface MessagesContext {
8
+ readonly theme: TuiTheme;
9
+ readonly markdown: MarkdownRenderer;
10
+ readonly reasoningOpen: (entry: Extract<TranscriptEntry, {
11
+ kind: 'reasoning';
12
+ }>) => boolean;
13
+ readonly reasoningFoldHint: () => string;
14
+ readonly reasoningKey: (id: string) => string | undefined;
15
+ readonly pushWrapped: (lines: string[], text: string, width: number, prefix: string, token: TuiToken) => void;
16
+ }
17
+ export declare class Messages {
18
+ private readonly context;
19
+ constructor(context: MessagesContext);
20
+ /**
21
+ * The rows one markdown message draws, with the padding pi-tui adds for background styling removed.
22
+ *
23
+ * The source is drawn first so the markdown renderer never measures a sequence
24
+ * it cannot see; its own spans are applied around the result afterwards.
25
+ */
26
+ private markdownLines;
27
+ /**
28
+ * Render one message's text as markdown.
29
+ *
30
+ * A thought passes its own face and an indent, so the row stays visibly a
31
+ * detail of the step that produced it rather than a second answer.
32
+ */
33
+ private pushMarkdown;
34
+ /**
35
+ * One message closed into a frame, with its markdown laid out to what is left inside.
36
+ *
37
+ * A prompt and a reply are the two objects of an exchange, so both are drawn as
38
+ * bars rather than as one more stretch of rows; the face, the border's element,
39
+ * and whether the text is still arriving are the only differences. Markdown lays
40
+ * itself out to the frame's text width, so the frame may only place the rows:
41
+ * wrapping them again would break what it drew. The rows are recorded as they
42
+ * are drawn, because a copy of this message will carry the frame with it and
43
+ * only the drawing knows which columns of a row are the frame's.
44
+ */
45
+ pushFramed(lines: string[], copy: FrameRow[], text: string, width: number, live: boolean, face: MarkdownFace, borderToken: TuiToken): void;
46
+ /**
47
+ * The face a thought is drawn in.
48
+ *
49
+ * Its shade stays the thought body's and it asks for no drawing: a diagram in
50
+ * the middle of a thought would carry the answer's weight, and the answer's
51
+ * colours would make the thinking compete with it.
52
+ */
53
+ private reasoningFace;
54
+ /** The face a submitted prompt is drawn in: its structure is markdown's, its shade stays the prompt's. */
55
+ userFace(): MarkdownFace;
56
+ pushReasoning(lines: string[], entry: Extract<TranscriptEntry, {
57
+ kind: 'reasoning';
58
+ }>, width: number, spans: ClickSpan[]): void;
59
+ /** The mark and the space that introduce an element, empty when it has none. */
60
+ elementLead(token: TuiToken): string;
61
+ }
62
+ //# sourceMappingURL=transcript-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript-message.d.ts","sourceRoot":"","sources":["../../../src/ui/view/transcript-message.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,EAAkD,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3F,OAAO,EAAe,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtF,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAsC3C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,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