@sagmans/dsh-tui 0.1.2 → 0.3.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 (158) hide show
  1. package/README.md +196 -17
  2. package/cordis.patch.yml +4 -2
  3. package/lib/agent/host.d.ts +14 -0
  4. package/lib/agent/host.d.ts.map +1 -1
  5. package/lib/agent/host.js +20 -4
  6. package/lib/agent/host.js.map +1 -1
  7. package/lib/agent/model.d.ts +50 -0
  8. package/lib/agent/model.d.ts.map +1 -1
  9. package/lib/agent/model.js +87 -1
  10. package/lib/agent/model.js.map +1 -1
  11. package/lib/agent/present.d.ts +7 -1
  12. package/lib/agent/present.d.ts.map +1 -1
  13. package/lib/agent/present.js +33 -4
  14. package/lib/agent/present.js.map +1 -1
  15. package/lib/agent/presets.d.ts +7 -1
  16. package/lib/agent/presets.d.ts.map +1 -1
  17. package/lib/agent/presets.js +7 -3
  18. package/lib/agent/presets.js.map +1 -1
  19. package/lib/agent/status.d.ts +10 -0
  20. package/lib/agent/status.d.ts.map +1 -1
  21. package/lib/agent/status.js +2 -0
  22. package/lib/agent/status.js.map +1 -1
  23. package/lib/cards.d.ts +127 -7
  24. package/lib/cards.d.ts.map +1 -1
  25. package/lib/cards.js +381 -52
  26. package/lib/cards.js.map +1 -1
  27. package/lib/export.d.ts +5 -4
  28. package/lib/export.d.ts.map +1 -1
  29. package/lib/export.js +62 -13
  30. package/lib/export.js.map +1 -1
  31. package/lib/fold-cursor.d.ts +23 -0
  32. package/lib/fold-cursor.d.ts.map +1 -0
  33. package/lib/fold-cursor.js +31 -0
  34. package/lib/fold-cursor.js.map +1 -0
  35. package/lib/gates.d.ts +145 -2
  36. package/lib/gates.d.ts.map +1 -1
  37. package/lib/gates.js +335 -40
  38. package/lib/gates.js.map +1 -1
  39. package/lib/index.d.ts +7 -1
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js +651 -92
  42. package/lib/index.js.map +1 -1
  43. package/lib/input/actions.d.ts +136 -0
  44. package/lib/input/actions.d.ts.map +1 -0
  45. package/lib/input/actions.js +740 -0
  46. package/lib/input/actions.js.map +1 -0
  47. package/lib/input/keymap-settings.d.ts +21 -0
  48. package/lib/input/keymap-settings.d.ts.map +1 -0
  49. package/lib/input/keymap-settings.js +28 -0
  50. package/lib/input/keymap-settings.js.map +1 -0
  51. package/lib/input/keymap.d.ts +91 -0
  52. package/lib/input/keymap.d.ts.map +1 -0
  53. package/lib/input/keymap.js +170 -0
  54. package/lib/input/keymap.js.map +1 -0
  55. package/lib/input/match.d.ts +10 -0
  56. package/lib/input/match.d.ts.map +1 -0
  57. package/lib/input/match.js +83 -0
  58. package/lib/input/match.js.map +1 -0
  59. package/lib/input/submission.d.ts +8 -1
  60. package/lib/input/submission.d.ts.map +1 -1
  61. package/lib/input/submission.js +9 -2
  62. package/lib/input/submission.js.map +1 -1
  63. package/lib/input.d.ts +17 -0
  64. package/lib/input.d.ts.map +1 -0
  65. package/lib/input.js +27 -0
  66. package/lib/input.js.map +1 -0
  67. package/lib/keys-command.d.ts +16 -0
  68. package/lib/keys-command.d.ts.map +1 -0
  69. package/lib/keys-command.js +60 -0
  70. package/lib/keys-command.js.map +1 -0
  71. package/lib/queue.d.ts +6 -0
  72. package/lib/queue.d.ts.map +1 -0
  73. package/lib/queue.js +68 -0
  74. package/lib/queue.js.map +1 -0
  75. package/lib/settings-notice.d.ts +19 -0
  76. package/lib/settings-notice.d.ts.map +1 -0
  77. package/lib/settings-notice.js +30 -0
  78. package/lib/settings-notice.js.map +1 -0
  79. package/lib/terminal/warning-screen.d.ts +8 -0
  80. package/lib/terminal/warning-screen.d.ts.map +1 -0
  81. package/lib/terminal/warning-screen.js +66 -0
  82. package/lib/terminal/warning-screen.js.map +1 -0
  83. package/lib/theme-capability.d.ts +36 -0
  84. package/lib/theme-capability.d.ts.map +1 -0
  85. package/lib/theme-capability.js +190 -0
  86. package/lib/theme-capability.js.map +1 -0
  87. package/lib/theme-command.d.ts +10 -0
  88. package/lib/theme-command.d.ts.map +1 -0
  89. package/lib/theme-command.js +61 -0
  90. package/lib/theme-command.js.map +1 -0
  91. package/lib/theme-settings.d.ts +196 -0
  92. package/lib/theme-settings.d.ts.map +1 -0
  93. package/lib/theme-settings.js +229 -0
  94. package/lib/theme-settings.js.map +1 -0
  95. package/lib/theme-tokens.d.ts +110 -0
  96. package/lib/theme-tokens.d.ts.map +1 -0
  97. package/lib/theme-tokens.js +427 -0
  98. package/lib/theme-tokens.js.map +1 -0
  99. package/lib/theme.d.ts +32 -35
  100. package/lib/theme.d.ts.map +1 -1
  101. package/lib/theme.js +112 -63
  102. package/lib/theme.js.map +1 -1
  103. package/lib/tokens.d.ts +15 -0
  104. package/lib/tokens.d.ts.map +1 -0
  105. package/lib/tokens.js +29 -0
  106. package/lib/tokens.js.map +1 -0
  107. package/lib/transcript.d.ts +26 -1
  108. package/lib/transcript.d.ts.map +1 -1
  109. package/lib/transcript.js +153 -25
  110. package/lib/transcript.js.map +1 -1
  111. package/lib/ui/dock.d.ts.map +1 -1
  112. package/lib/ui/dock.js +67 -28
  113. package/lib/ui/dock.js.map +1 -1
  114. package/lib/ui/editor.d.ts +51 -0
  115. package/lib/ui/editor.d.ts.map +1 -0
  116. package/lib/ui/editor.js +159 -0
  117. package/lib/ui/editor.js.map +1 -0
  118. package/lib/ui/frame.d.ts +54 -0
  119. package/lib/ui/frame.d.ts.map +1 -0
  120. package/lib/ui/frame.js +79 -0
  121. package/lib/ui/frame.js.map +1 -0
  122. package/lib/ui/gate-input.d.ts +20 -0
  123. package/lib/ui/gate-input.d.ts.map +1 -0
  124. package/lib/ui/gate-input.js +96 -0
  125. package/lib/ui/gate-input.js.map +1 -0
  126. package/lib/ui/markdown.d.ts +19 -2
  127. package/lib/ui/markdown.d.ts.map +1 -1
  128. package/lib/ui/markdown.js +37 -6
  129. package/lib/ui/markdown.js.map +1 -1
  130. package/lib/ui/mermaid.d.ts +44 -0
  131. package/lib/ui/mermaid.d.ts.map +1 -0
  132. package/lib/ui/mermaid.js +178 -0
  133. package/lib/ui/mermaid.js.map +1 -0
  134. package/lib/ui/picker.d.ts +66 -7
  135. package/lib/ui/picker.d.ts.map +1 -1
  136. package/lib/ui/picker.js +112 -19
  137. package/lib/ui/picker.js.map +1 -1
  138. package/lib/ui/prompt.d.ts +30 -0
  139. package/lib/ui/prompt.d.ts.map +1 -0
  140. package/lib/ui/prompt.js +45 -0
  141. package/lib/ui/prompt.js.map +1 -0
  142. package/lib/ui/queue.d.ts +24 -0
  143. package/lib/ui/queue.d.ts.map +1 -0
  144. package/lib/ui/queue.js +57 -0
  145. package/lib/ui/queue.js.map +1 -0
  146. package/lib/ui/status.d.ts +7 -1
  147. package/lib/ui/status.d.ts.map +1 -1
  148. package/lib/ui/status.js +84 -24
  149. package/lib/ui/status.js.map +1 -1
  150. package/lib/ui/view.d.ts +65 -2
  151. package/lib/ui/view.d.ts.map +1 -1
  152. package/lib/ui/view.js +319 -59
  153. package/lib/ui/view.js.map +1 -1
  154. package/lib/work.d.ts +48 -0
  155. package/lib/work.d.ts.map +1 -1
  156. package/lib/work.js +44 -0
  157. package/lib/work.js.map +1 -1
  158. package/package.json +5 -2
package/lib/ui/view.js CHANGED
@@ -1,10 +1,56 @@
1
- import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from '@earendil-works/pi-tui';
2
- import { cardDetailRows } from "../cards.js";
1
+ import { visibleWidth, wrapTextWithAnsi } from '@earendil-works/pi-tui';
2
+ import { cardDetailRows, shellFoldHint, shellRetentionHint } from "../cards.js";
3
+ import { defaultKeymap, hintKeys } from "../input/actions.js";
4
+ import { CUSTOM_ROW_NUMBER } from "../gates.js";
3
5
  import { displayText } from "../text.js";
6
+ import { CARD_ROW_TOKEN } from "../theme-tokens.js";
7
+ import { canFrame, frameText } from "./frame.js";
4
8
  import { RowCache } from "./rows.js";
5
9
  const DETAIL_INDENT = ' ';
6
10
  const OPTION_INDENT = ' ';
7
- const ALL_COLLAPSED = { expandCards: false, expandReasoning: false };
11
+ /** A nested call is a signpost under its card, so it sits one step shallower than that card's detail. */
12
+ const SUBCALL_INDENT = ' ';
13
+ /** The mark a cursor falls back to when the reader has not set one, so no literal lives in a template. */
14
+ const CURSOR_MARK = '❯';
15
+ const APPROVAL_MARK = '⚠';
16
+ const QUESTION_MARK = '?';
17
+ const CHECKBOX_ON = '[x]';
18
+ const CHECKBOX_OFF = '[ ]';
19
+ /** A row that a card's kind does not map draws as generic detail. */
20
+ const FALLBACK_ROW_TOKEN = 'tool.detail';
21
+ /** An unselected row has no cursor, and a blank column is not a value to configure. */
22
+ const NO_CURSOR = ' ';
23
+ /** The words an opened card uses when retention, not the fold, dropped rows. */
24
+ const CARD_HINT_RETAINED = 'more lines not shown';
25
+ /** What a hint names when the reader has unbound the key it would advertise. */
26
+ const REASONING_FOLD_FALLBACK = 'shift+tab';
27
+ const CARD_OPEN_FALLBACK = 'ctrl+o';
28
+ /** What separates a card's header from its measured facts, and the facts from each other. */
29
+ const STAT_LEAD = ' ';
30
+ const STAT_SEPARATOR = ' · ';
31
+ /** The symbol that says what a fact counts; a size needs none. */
32
+ const STAT_SYMBOL = {
33
+ added: '+',
34
+ changed: '~',
35
+ removed: '-',
36
+ size: '',
37
+ };
38
+ /** Which colour draws each fact, so added, changed, and removed never share one. */
39
+ const STAT_TOKEN = {
40
+ added: 'tool.stat.added',
41
+ changed: 'tool.stat.changed',
42
+ removed: 'tool.stat.removed',
43
+ size: 'tool.stat.size',
44
+ };
45
+ /**
46
+ * The state a reader gets before opening anything, and the view's own fallback.
47
+ *
48
+ * Cards and thoughts start folded because either can be long enough to push the
49
+ * answer off the screen. A program's calls are the opposite case: one clipped
50
+ * line each, under a header that already names them, so folding them costs a
51
+ * reader the very thing the card stands for.
52
+ */
53
+ export const DEFAULT_VIEW_STATE = { expandCards: false, expandReasoning: false, expandSubCalls: true };
8
54
  export class TranscriptView {
9
55
  model;
10
56
  theme;
@@ -19,7 +65,7 @@ export class TranscriptView {
19
65
  this.rows = options.rows ?? new RowCache();
20
66
  }
21
67
  get viewState() {
22
- return this.options.state?.() ?? ALL_COLLAPSED;
68
+ return this.options.state?.() ?? DEFAULT_VIEW_STATE;
23
69
  }
24
70
  /** The cache's own account of the work it avoided; a test reads this. */
25
71
  rowStats() {
@@ -36,95 +82,290 @@ export class TranscriptView {
36
82
  const indent = ' '.repeat(lead);
37
83
  const wrapped = wrapTextWithAnsi(displayText(text), Math.max(1, width - lead));
38
84
  wrapped.forEach((line, index) => {
39
- lines.push(style(truncateToWidth(`${index === 0 ? prefix : indent}${line}`, width, '')));
85
+ lines.push(style(this.theme.cut(`${index === 0 ? prefix : indent}${line}`, width, '')));
40
86
  });
41
87
  }
42
- /** Render assistant text as markdown: the model writes structure, the reader reads it. */
43
- pushMarkdown(lines, text, width, prefix) {
88
+ /**
89
+ * Wrap one already-styled block under a prefix.
90
+ *
91
+ * A card header mixes tokens — title, argument, stats — in a single string, so
92
+ * it cannot go through {@link pushWrapped}, which escapes and restyles plain
93
+ * text. Its width still has to fold at the screen edge rather than be cut,
94
+ * because the argument is the part a reader scans for and a silently dropped
95
+ * command is worse than a taller card.
96
+ */
97
+ pushStyledWrapped(lines, content, width, prefix) {
44
98
  const lead = visibleWidth(prefix);
45
99
  const indent = ' '.repeat(lead);
46
- const rendered = this.markdown.render(displayText(text), Math.max(1, width - lead));
47
- rendered.forEach((line, index) => {
100
+ const wrapped = wrapTextWithAnsi(content, Math.max(1, width - lead));
101
+ wrapped.forEach((line, index) => {
102
+ lines.push(this.theme.cut(`${index === 0 ? prefix : indent}${line}`, width, ''));
103
+ });
104
+ }
105
+ /** Render assistant text as markdown: the model writes structure, the reader reads it. */
106
+ pushMarkdown(lines, text, width, live) {
107
+ const rendered = this.markdown.render(displayText(text), Math.max(1, width), live);
108
+ rendered.forEach(line => {
48
109
  // The renderer pads to its width for background styling we do not use.
49
110
  const trimmed = line.replace(/[ \t]+$/u, '');
50
- // A blank markdown line stays blank: indenting it would leave trailing
51
- // spaces in the frame for a row that shows nothing.
111
+ // A blank markdown line stays blank: it shows nothing, so it holds nothing.
52
112
  if (trimmed === '') {
53
113
  lines.push('');
54
114
  return;
55
115
  }
56
- lines.push(truncateToWidth(`${index === 0 ? prefix : indent}${trimmed}`, width, '…'));
116
+ lines.push(this.theme.cut(trimmed, width, '…'));
57
117
  });
58
118
  }
119
+ /** The live map, or the shipped one for a caller that did not lend one. */
120
+ keymap() {
121
+ return this.options.keys?.() ?? defaultKeymap();
122
+ }
123
+ reasoningFoldHint() {
124
+ return hintKeys(this.keymap(), 'surface.reasoning') || REASONING_FOLD_FALLBACK;
125
+ }
59
126
  pushReasoning(lines, entry, width) {
60
- lines.push(this.theme.dim(truncateToWidth(`${this.theme.glyphs.reasoning} ${displayText(entry.summary)}`, width, '')));
127
+ if (!this.theme.visible('transcript.reasoning.summary'))
128
+ return;
129
+ const glyph = this.theme.glyph('transcript.reasoning.summary');
130
+ const lead = glyph === '' ? '' : `${glyph} `;
131
+ // A folded row carries the key that opens it, because a count with no way to
132
+ // reach the text reads the same as the text never having arrived. The key
133
+ // rides the row rather than a line of its own, so naming the hidden body
134
+ // costs no vertical space.
135
+ const suffix = !this.viewState.expandReasoning && entry.body !== '' && this.theme.visible('transcript.reasoning.hint')
136
+ ? ` (${this.reasoningFoldHint()})`
137
+ : '';
138
+ // The key is kept whole: the summary is the part that gives up room.
139
+ const room = Math.max(1, width - visibleWidth(suffix));
140
+ const summary = this.theme.style('transcript.reasoning.summary', this.theme.cut(`${lead}${displayText(entry.summary)}`, room, ''));
141
+ lines.push(suffix === '' ? summary : `${summary}${this.theme.style('transcript.reasoning.hint', suffix)}`);
61
142
  if (!this.viewState.expandReasoning)
62
143
  return;
144
+ if (!this.theme.visible('transcript.reasoning.body'))
145
+ return;
63
146
  for (const line of entry.body.split('\n')) {
64
- this.pushWrapped(lines, line, width, DETAIL_INDENT, this.theme.dim);
147
+ this.pushWrapped(lines, line, width, DETAIL_INDENT, text => this.theme.style('transcript.reasoning.body', text));
65
148
  }
66
149
  }
67
150
  pushCard(lines, card, width) {
68
151
  const expanded = this.viewState.expandCards;
69
- const { lines: detail, hidden } = cardDetailRows(card, expanded);
70
- const mark = card.failed ? '✗' : '⚒';
71
- lines.push(this.theme.tool(truncateToWidth(`${mark} ${displayText(card.title)}`, width, '')));
152
+ // A card whose kind declares its call IS a command keeps its output tail
153
+ // while folded: that output is the answer the reader asked for, so it
154
+ // outranks the one-line rule every other card follows. Its command is drawn
155
+ // outside the fold entirely, because what ran is never a detail.
156
+ const preview = expanded
157
+ ? { expanded: true }
158
+ : { expanded: false, preview: card.kind === 'terminal' ? 'shellTail' : 'title' };
159
+ const { lines: detail, hidden } = cardDetailRows(card, preview);
160
+ const titleToken = card.failed ? 'tool.failed.title' : 'tool.title';
161
+ const glyphToken = card.failed ? 'tool.failed.glyph' : 'tool.glyph';
162
+ const { lead, body } = this.renderHead(card, titleToken, glyphToken);
163
+ // A header that folds keeps the argument and its stats; a terminal command
164
+ // can be longer than the screen, so it wraps under its own indent.
165
+ if (body !== '')
166
+ this.pushStyledWrapped(lines, body, width, lead);
167
+ if (this.viewState.expandSubCalls)
168
+ this.pushSubCalls(lines, card, width);
169
+ if (card.kind === 'terminal' && card.argument !== undefined && card.argument !== '' && this.theme.visible('tool.args')) {
170
+ this.pushStyledWrapped(lines, this.theme.style('tool.args', displayText(card.argument)), width, DETAIL_INDENT);
171
+ }
72
172
  for (const row of detail) {
73
- const style = row.startsWith('+')
74
- ? this.theme.added
75
- : row.startsWith('-') ? this.theme.removed : this.theme.dim;
76
- lines.push(style(truncateToWidth(`${DETAIL_INDENT}${displayText(row)}`, width, '')));
173
+ // The row says what it is, so the renderer never guesses from the text:
174
+ // a diff line beginning with "+" is an addition because the presenter
175
+ // said so, not because of its first character.
176
+ const drawn = row.parts
177
+ .map(part => {
178
+ const token = CARD_ROW_TOKEN[card.kind]?.[part.class] ?? FALLBACK_ROW_TOKEN;
179
+ return this.theme.visible(token) ? this.theme.style(token, displayText(part.text)) : '';
180
+ })
181
+ .join('');
182
+ // A row whose every part is hidden draws nothing, and nothing must not
183
+ // cost a line: the indent would read as an empty row the card does not have.
184
+ if (drawn === '')
185
+ continue;
186
+ lines.push(this.theme.cut(`${DETAIL_INDENT}${drawn}`, width, ''));
77
187
  }
78
- if (hidden > 0) {
79
- const hint = expanded ? `${hidden} more lines not shown` : `… ${hidden} more lines · ctrl+o shows them`;
80
- lines.push(this.theme.dim(truncateToWidth(`${DETAIL_INDENT}${hint}`, width, '')));
188
+ // The pill is not output, so it draws after the preview window rather than
189
+ // inside it: a run bounded to its tail still reports how it ended.
190
+ if (card.kind === 'terminal' && card.status !== undefined && this.theme.visible('tool.terminal.status')) {
191
+ lines.push(this.theme.cut(`${DETAIL_INDENT}${this.theme.style('tool.terminal.status', displayText(card.status))}`, width, ''));
81
192
  }
193
+ if (hidden <= 0 || !this.theme.visible('tool.hint'))
194
+ return;
195
+ // A shell card's rows are kept from the end, so a hidden count always names
196
+ // the rows *before* what is on screen and the hint has to say so; every
197
+ // other card keeps its head, where a neutral count is enough. A folded shell
198
+ // card is bounded by its preview window, an opened one by retention, so the
199
+ // opened hint promises no more than memory kept.
200
+ const hint = card.kind === 'terminal'
201
+ ? preview.expanded
202
+ ? shellRetentionHint(hidden)
203
+ : shellFoldHint(hidden, hintKeys(this.keymap(), 'surface.toolDetail') || CARD_OPEN_FALLBACK)
204
+ : preview.expanded ? `${hidden} ${CARD_HINT_RETAINED}` : undefined;
205
+ if (hint === undefined)
206
+ return;
207
+ lines.push(this.theme.style('tool.hint', this.theme.cut(`${DETAIL_INDENT}${hint}`, width, '')));
208
+ }
209
+ /**
210
+ * The calls one card dispatched, one entry each.
211
+ *
212
+ * A nested call is a signpost rather than a card of its own, so it keeps one
213
+ * entry per call; a long argument still wraps under that entry rather than
214
+ * being cut, because the argument is the part a reader scans for and a
215
+ * silently shortened path reads as the one that ran.
216
+ */
217
+ pushSubCalls(lines, card, width) {
218
+ const subCalls = card.subCalls ?? [];
219
+ for (const call of subCalls) {
220
+ const titleToken = call.failed ? 'tool.failed.title' : 'tool.subcall.title';
221
+ const title = this.theme.visible(titleToken) ? this.theme.style(titleToken, displayText(call.title)) : '';
222
+ const argument = call.argument === undefined || !this.theme.visible('tool.subcall.args')
223
+ ? ''
224
+ : ` ${this.theme.style('tool.subcall.args', displayText(call.argument))}`;
225
+ const drawn = `${title}${argument}`;
226
+ // A row whose every part is hidden draws nothing, and nothing must not
227
+ // cost a line the card does not have.
228
+ if (drawn === '')
229
+ continue;
230
+ this.pushStyledWrapped(lines, drawn, width, SUBCALL_INDENT);
231
+ }
232
+ const hidden = (card.subCallsTotal ?? subCalls.length) - subCalls.length;
233
+ if (hidden > 0 && this.theme.visible('tool.hint')) {
234
+ lines.push(this.theme.style('tool.hint', this.theme.cut(`${SUBCALL_INDENT}… ${hidden} more calls`, width, '')));
235
+ }
236
+ }
237
+ /**
238
+ * A card's header: its label, its argument, and its measured facts.
239
+ *
240
+ * The glyph is returned apart from the body so a wrapped continuation can
241
+ * align under the label rather than under the mark. A terminal's argument is
242
+ * left out because it needs a row of its own — it is the one argument that can
243
+ * be a whole command rather than a word.
244
+ */
245
+ renderHead(card, titleToken, glyphToken) {
246
+ const glyph = this.theme.visible(titleToken) ? this.theme.glyph(glyphToken) : '';
247
+ const lead = glyph === '' ? '' : `${glyph} `;
248
+ let body = this.theme.visible(titleToken) ? this.theme.style(titleToken, displayText(card.title)) : '';
249
+ if (card.kind !== 'terminal' && card.argument !== undefined && card.argument !== '' && this.theme.visible('tool.args')) {
250
+ body += `${body === '' ? '' : ' '}${this.theme.style('tool.args', displayText(card.argument))}`;
251
+ }
252
+ return { lead, body: body + this.renderStats(card.stats) };
253
+ }
254
+ /** The measured facts, each in its own colour, or nothing when none is visible. */
255
+ renderStats(stats) {
256
+ if (stats === undefined || stats.length === 0)
257
+ return '';
258
+ const drawn = stats
259
+ .filter(stat => this.theme.visible(STAT_TOKEN[stat.kind]))
260
+ .map(stat => this.theme.style(STAT_TOKEN[stat.kind], `${STAT_SYMBOL[stat.kind]}${displayText(stat.text)}`));
261
+ if (drawn.length === 0)
262
+ return '';
263
+ return `${STAT_LEAD}${drawn.join(this.theme.style('tool.stat.separator', STAT_SEPARATOR))}`;
82
264
  }
83
265
  pushPicker(lines, picker, width) {
84
266
  lines.push('');
85
- lines.push(this.theme.bold(truncateToWidth(`↻ ${displayText(picker.title)}`, width, '')));
86
- if (picker.note !== undefined) {
87
- this.pushWrapped(lines, picker.note, width, DETAIL_INDENT, this.theme.bold);
267
+ if (this.theme.visible('picker.title')) {
268
+ const glyph = this.theme.glyph('picker.glyph');
269
+ const lead = glyph === '' ? '' : `${glyph} `;
270
+ lines.push(this.theme.style('picker.title', this.theme.cut(`${lead}${displayText(picker.title)}`, width, '')));
88
271
  }
89
- if (picker.filter !== '') {
90
- lines.push(this.theme.dim(truncateToWidth(`${DETAIL_INDENT}filter: ${displayText(picker.filter)}`, width, '')));
272
+ if (picker.note !== undefined && this.theme.visible('picker.note')) {
273
+ this.pushWrapped(lines, picker.note, width, DETAIL_INDENT, text => this.theme.style('picker.note', text));
91
274
  }
92
- if (picker.above > 0) {
93
- lines.push(this.theme.dim(truncateToWidth(`${OPTION_INDENT}… ${picker.above} newer`, width, '')));
275
+ if (picker.filter !== '' && this.theme.visible('picker.filter')) {
276
+ lines.push(this.theme.style('picker.filter', this.theme.cut(`${DETAIL_INDENT}filter: ${displayText(picker.filter)}`, width, '')));
277
+ }
278
+ if (picker.above > 0 && this.theme.visible('picker.scrollNewer')) {
279
+ lines.push(this.theme.style('picker.scrollNewer', this.theme.cut(`${OPTION_INDENT}… ${picker.above} newer`, width, '')));
94
280
  }
95
281
  for (const row of picker.rows) {
96
- const cursor = row.current ? '❯' : ' ';
282
+ const token = row.current ? 'picker.rowCurrent' : 'picker.row';
283
+ if (!this.theme.visible(token))
284
+ continue;
285
+ const cursor = row.current ? this.theme.glyph('picker.cursor') || CURSOR_MARK : NO_CURSOR;
97
286
  const text = row.description === undefined
98
287
  ? `${cursor} ${row.label}`
99
288
  : `${cursor} ${row.label} — ${row.description}`;
100
- const style = row.current ? this.theme.bold : (value) => value;
101
- lines.push(style(truncateToWidth(`${OPTION_INDENT}${displayText(text)}`, width, '')));
289
+ lines.push(this.theme.style(token, this.theme.cut(`${OPTION_INDENT}${displayText(text)}`, width, '')));
102
290
  }
103
- if (picker.below > 0) {
104
- lines.push(this.theme.dim(truncateToWidth(`${OPTION_INDENT}… ${picker.below} older`, width, '')));
291
+ if (picker.below > 0 && this.theme.visible('picker.scrollOlder')) {
292
+ lines.push(this.theme.style('picker.scrollOlder', this.theme.cut(`${OPTION_INDENT}… ${picker.below} older`, width, '')));
293
+ }
294
+ if (this.theme.visible('picker.hint')) {
295
+ lines.push(this.theme.style('picker.hint', this.theme.cut(`${OPTION_INDENT}${displayText(picker.hint)}`, width, '')));
105
296
  }
106
- lines.push(this.theme.dim(truncateToWidth(`${OPTION_INDENT}${displayText(picker.hint)}`, width, '')));
107
297
  }
108
298
  pushGate(lines, gate, width) {
109
299
  lines.push('');
110
- lines.push(this.theme.bold(truncateToWidth(`${gate.kind === 'approval' ? '⚠' : '?'} ${displayText(gate.title)}`, width, '')));
111
- for (const detail of gate.detail) {
112
- this.pushWrapped(lines, detail, width, DETAIL_INDENT, this.theme.dim);
300
+ if (this.theme.visible('gate.title')) {
301
+ const glyphToken = gate.kind === 'approval' ? 'gate.glyphApproval' : 'gate.glyphQuestion';
302
+ const glyph = this.theme.glyph(glyphToken) || (gate.kind === 'approval' ? APPROVAL_MARK : QUESTION_MARK);
303
+ // The question is the thing being decided, so it wraps rather than being
304
+ // cut: a reader cannot answer a sentence they were not shown.
305
+ this.pushWrapped(lines, gate.title, width, `${glyph} `, text => this.theme.style('gate.title', text));
306
+ }
307
+ if (this.theme.visible('gate.detail')) {
308
+ for (const detail of gate.detail) {
309
+ this.pushWrapped(lines, detail, width, DETAIL_INDENT, text => this.theme.style('gate.detail', text));
310
+ }
113
311
  }
114
312
  gate.options.forEach((option, position) => {
115
- const box = option.selected ? '[x]' : '[ ]';
116
- const cursor = option.current ? '❯' : ' ';
117
- const label = displayText(option.label);
118
- const text = option.description === undefined
119
- ? `${cursor} ${box} ${position + 1}. ${label}`
120
- : `${cursor} ${box} ${position + 1}. ${label} — ${displayText(option.description)}`;
121
- const style = option.current ? this.theme.bold : (value) => value;
122
- lines.push(style(truncateToWidth(`${OPTION_INDENT}${text}`, width, '')));
313
+ this.pushGateRow(lines, width, {
314
+ number: gate.optionOffset + position + 1,
315
+ label: option.label,
316
+ description: option.description,
317
+ current: option.current,
318
+ selected: option.selected,
319
+ });
123
320
  });
124
- lines.push(this.theme.dim(truncateToWidth(`${OPTION_INDENT}${displayText(gate.hint)}`, width, '')));
321
+ // The free-text row is drawn under the window rather than inside it: it is
322
+ // the one row that must never scroll out of reach, and the window's own
323
+ // numbering is left running 1..n above it.
324
+ if (gate.custom !== undefined) {
325
+ this.pushGateRow(lines, width, {
326
+ number: CUSTOM_ROW_NUMBER,
327
+ label: gate.custom.label,
328
+ description: gate.custom.description,
329
+ current: gate.custom.current,
330
+ selected: gate.custom.selected,
331
+ });
332
+ }
333
+ // The answer belongs to the row it fills: the free-text row, or the question
334
+ // itself when typing is the only way to answer it. The rows come from the
335
+ // surface's own editor, so they are placed rather than restyled — it draws
336
+ // its frame, its padding, and its cursor for the width it is given.
337
+ if (gate.answerInput !== undefined) {
338
+ const room = Math.max(1, width - visibleWidth(OPTION_INDENT));
339
+ for (const row of gate.answerInput.render(room))
340
+ lines.push(`${OPTION_INDENT}${row}`);
341
+ }
342
+ // The keys are how the gate is answered at all, so they wrap rather than
343
+ // lose their tail at a narrow edge.
344
+ if (this.theme.visible('gate.hint')) {
345
+ this.pushWrapped(lines, gate.hint, width, OPTION_INDENT, text => this.theme.style('gate.hint', text));
346
+ }
125
347
  }
126
- /** The rows one transcript entry becomes. */
127
- renderEntry(entry, lines, width, glyphs) {
348
+ /**
349
+ * One row a reader can choose: the cursor, the box, the number, the label.
350
+ *
351
+ * The row wraps under the label it belongs to rather than at the screen edge,
352
+ * because the label and its description together are what tells two rows
353
+ * apart, and a mark on a continuation line reads as another row.
354
+ */
355
+ pushGateRow(lines, width, row) {
356
+ const token = row.current ? 'gate.optionCurrent' : 'gate.option';
357
+ if (!this.theme.visible(token))
358
+ return;
359
+ const cursor = row.current ? this.theme.glyph('gate.cursor') || CURSOR_MARK : NO_CURSOR;
360
+ const box = row.selected ? CHECKBOX_ON : CHECKBOX_OFF;
361
+ const lead = `${OPTION_INDENT}${cursor} ${box} ${row.number}. `;
362
+ const text = row.description === undefined ? row.label : `${row.label} — ${row.description}`;
363
+ // The text reaches pushWrapped unescaped: it escapes once, and escaping a
364
+ // second time would show the reader the escape instead of the character.
365
+ this.pushWrapped(lines, text, width, lead, body => this.theme.style(token, body));
366
+ }
367
+ /** The rows one transcript entry becomes; `live` marks the entry the turn is still writing. */
368
+ renderEntry(entry, lines, width, live) {
128
369
  switch (entry.kind) {
129
370
  case 'tool':
130
371
  this.pushCard(lines, entry.card, width);
@@ -133,25 +374,44 @@ export class TranscriptView {
133
374
  this.pushReasoning(lines, entry, width);
134
375
  return;
135
376
  case 'assistant':
136
- this.pushMarkdown(lines, entry.text, width, `${glyphs.assistant} `);
377
+ this.pushMarkdown(lines, entry.text, width, live);
137
378
  return;
138
379
  case 'user':
139
- this.pushWrapped(lines, entry.text, width, `${glyphs.user} `, this.theme.bold);
380
+ if (!this.theme.visible('transcript.user'))
381
+ return;
382
+ // A prompt is boxed wherever it is read, so the row it left in the queue
383
+ // and the row it becomes here are recognisably the same object.
384
+ lines.push(...frameText(entry.text, width, {
385
+ text: text => this.theme.style('transcript.user', text),
386
+ border: rule => this.theme.editor.borderColor(rule),
387
+ framed: canFrame(width, this.theme.visible('editor.border')),
388
+ }));
140
389
  return;
141
390
  case 'notice':
142
- this.pushWrapped(lines, entry.text, width, `${glyphs.notice} `, this.theme.notice);
391
+ if (!this.theme.visible('transcript.notice'))
392
+ return;
393
+ this.pushWrapped(lines, entry.text, width, this.elementLead('transcript.notice'), text => this.theme.style('transcript.notice', text));
143
394
  return;
144
395
  case 'marker':
145
- this.pushWrapped(lines, entry.text, width, `${glyphs.marker} `, this.theme.marker);
396
+ if (!this.theme.visible('transcript.marker'))
397
+ return;
398
+ this.pushWrapped(lines, entry.text, width, this.elementLead('transcript.marker'), text => this.theme.style('transcript.marker', text));
146
399
  return;
147
400
  }
148
401
  }
402
+ /** The mark and the space that introduce an element, empty when it has none. */
403
+ elementLead(token) {
404
+ const glyph = this.theme.visible(token) ? this.theme.glyph(token) : '';
405
+ return glyph === '' ? '' : `${glyph} `;
406
+ }
149
407
  render(width) {
150
408
  if (width <= 0)
151
409
  return [];
152
- const { glyphs } = this.theme;
153
410
  const state = this.viewState;
154
- const tag = `${width}|${state.expandCards ? 'c' : '-'}${state.expandReasoning ? 'r' : '-'}`;
411
+ // The revision is part of the key: rows drawn under an older theme table
412
+ // must miss, or a settings change would restyle only the rows that happened
413
+ // to be redrawn for another reason.
414
+ const tag = `${width}|${state.expandCards ? 'c' : '-'}${state.expandReasoning ? 'r' : '-'}${state.expandSubCalls ? 'p' : '-'}|${this.theme.revision}`;
155
415
  const lines = [];
156
416
  const settled = this.model.settledCount();
157
417
  const entries = this.model.entries();
@@ -159,7 +419,7 @@ export class TranscriptView {
159
419
  // The in-flight rows change on every frame, so caching them would only
160
420
  // fill the cache with objects nobody will ask for again.
161
421
  if (index >= settled) {
162
- this.renderEntry(entry, lines, width, glyphs);
422
+ this.renderEntry(entry, lines, width, true);
163
423
  continue;
164
424
  }
165
425
  const cached = this.rows.lookup(entry, tag);
@@ -168,7 +428,7 @@ export class TranscriptView {
168
428
  continue;
169
429
  }
170
430
  const rendered = [];
171
- this.renderEntry(entry, rendered, width, glyphs);
431
+ this.renderEntry(entry, rendered, width, false);
172
432
  this.rows.store(entry, tag, rendered);
173
433
  lines.push(...rendered);
174
434
  }
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/ui/view.ts"],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,KAAK,EAAE,GAAG,CAAC,CAAA;YAC3C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAA;gBACrB,SAAQ;YACV,CAAC;YACD,MAAM,QAAQ,GAAa,EAAE,CAAA;YAC7B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;YAC/C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;YACrC,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA;QACzB,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAA;QACtC,IAAI,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAA;QAClC,IAAI,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;QACzD,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
package/lib/work.d.ts CHANGED
@@ -20,6 +20,54 @@ export interface WorkState {
20
20
  export declare function orderTodos(todos: readonly TodoEntry[]): readonly TodoEntry[];
21
21
  /** The todo list as plain lines, for a reader who asked for it by name. */
22
22
  export declare function describeTodos(todos: readonly TodoEntry[] | undefined): string;
23
+ /**
24
+ * Plan mode as the package that owns it reports it.
25
+ *
26
+ * The surface keeps no flag of its own: a session it has forgotten — cleared,
27
+ * or one of several on screen — still answers for the agent being driven, and
28
+ * only the host knows which selection is waiting for the turn boundary.
29
+ */
30
+ export interface PlanModeState {
31
+ /** The logged state. */
32
+ readonly active: boolean;
33
+ /** A selection waiting for the next turn boundary; absent once it is applied. */
34
+ readonly pending?: boolean;
35
+ }
36
+ /** The plan controller, described structurally so the surface needs no import of it. */
37
+ export interface PlanModeController {
38
+ get(agent: unknown): unknown;
39
+ }
40
+ /** The name the plan package registers under, in the container and in a preset scope. */
41
+ export declare const PLAN_SERVICE = "planMode";
42
+ /**
43
+ * Where the surface asks for a service.
44
+ *
45
+ * A plugin a preset mounts behind `isolate` is invisible outside the group that
46
+ * declares it, the host included, so the agent's own composition has to be
47
+ * asked through its preset. The container is the fallback for a composition that
48
+ * mounts the package flat.
49
+ */
50
+ export interface ServiceLookup {
51
+ readonly direct: (name: string) => unknown;
52
+ readonly forAgent: (agent: unknown, name: string) => unknown;
53
+ }
54
+ /** The plan state of one agent, read from whichever scope of the composition holds it. */
55
+ export declare function readPlanState(lookup: ServiceLookup, agent: unknown): PlanModeState | undefined;
56
+ /**
57
+ * Whether plan mode is the state the agent is in, or is about to be in.
58
+ *
59
+ * A selection made inside a turn waits for the next accepted pre-step, so a
60
+ * second press before that boundary has to read the selection: asking for the
61
+ * logged state again would be a no-op, which the reader reads as a dead key.
62
+ */
63
+ export declare function planSelectedActive(state: PlanModeState | undefined, fallback: boolean): boolean;
64
+ /**
65
+ * The command that asks for the other state.
66
+ *
67
+ * `/plan` enters and `/plan off` exits — neither toggles — so the surface names
68
+ * the one it wants rather than keeping a flag that can drift from the host's.
69
+ */
70
+ export declare function planToggleLine(active: boolean): string;
23
71
  /**
24
72
  * Fold the agent's work state out of durable events.
25
73
  *
package/lib/work.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"work.d.ts","sourceRoot":"","sources":["../src/work.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,iEAAiE;AACjE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,CAAA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