@turri-dev/cli 0.4.2-next.a6867e8 → 0.4.3-next.3fc888b

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 (128) hide show
  1. package/README.md +1 -0
  2. package/dist/background-skills.d.ts +4 -1
  3. package/dist/background-skills.js +9 -1
  4. package/dist/capture/agents.d.ts +391 -0
  5. package/dist/capture/agents.js +338 -0
  6. package/dist/capture/area.d.ts +58 -0
  7. package/dist/capture/area.js +197 -0
  8. package/dist/capture/assemble.d.ts +122 -0
  9. package/dist/capture/assemble.js +452 -0
  10. package/dist/capture/capture.d.ts +116 -0
  11. package/dist/capture/capture.js +1281 -0
  12. package/dist/capture/chat.d.ts +29 -0
  13. package/dist/capture/chat.js +94 -0
  14. package/dist/capture/checks.d.ts +142 -0
  15. package/dist/capture/checks.js +643 -0
  16. package/dist/capture/config.d.ts +13 -0
  17. package/dist/capture/config.js +60 -0
  18. package/dist/capture/interface.d.ts +71 -0
  19. package/dist/capture/interface.js +199 -0
  20. package/dist/capture/map.d.ts +58 -0
  21. package/dist/capture/map.js +530 -0
  22. package/dist/capture/plan.d.ts +8 -0
  23. package/dist/capture/plan.js +13 -0
  24. package/dist/capture/progress.d.ts +109 -0
  25. package/dist/capture/progress.js +240 -0
  26. package/dist/capture/report.d.ts +75 -0
  27. package/dist/capture/report.js +268 -0
  28. package/dist/capture/scripts.d.ts +26 -0
  29. package/dist/capture/scripts.js +33 -0
  30. package/dist/capture/state.d.ts +299 -0
  31. package/dist/capture/state.js +43 -0
  32. package/dist/capture/trial.d.ts +34 -0
  33. package/dist/capture/trial.js +89 -0
  34. package/dist/capture-cli.d.ts +1 -0
  35. package/dist/capture-cli.js +77 -0
  36. package/dist/chat-commands.d.ts +2 -10
  37. package/dist/chat-commands.js +3 -57
  38. package/dist/chat-tab-header.d.ts +15 -0
  39. package/dist/chat-tab-header.js +78 -0
  40. package/dist/chat-tabs.d.ts +26 -0
  41. package/dist/chat-tabs.js +100 -0
  42. package/dist/chat-terminal.js +57 -8
  43. package/dist/chat-waiting.d.ts +4 -1
  44. package/dist/chat-waiting.js +7 -4
  45. package/dist/chats.d.ts +12 -7
  46. package/dist/chats.js +35 -21
  47. package/dist/cli.js +32 -14
  48. package/dist/config-edit.js +4 -2
  49. package/dist/config.d.ts +15 -2
  50. package/dist/config.js +62 -4
  51. package/dist/extension.d.ts +1 -0
  52. package/dist/extension.js +262 -136
  53. package/dist/identity.js +3 -2
  54. package/dist/init-config.js +2 -0
  55. package/dist/loop-cli.js +5 -1
  56. package/dist/loop-tools.d.ts +2 -3
  57. package/dist/loop-tools.js +12 -13
  58. package/dist/new-project.d.ts +5 -0
  59. package/dist/new-project.js +11 -0
  60. package/dist/pi-launch.js +2 -0
  61. package/dist/pi-themes.d.ts +3 -0
  62. package/dist/pi-themes.js +21 -0
  63. package/dist/pi.js +2 -2
  64. package/dist/plain-code-blocks.d.ts +14 -0
  65. package/dist/plain-code-blocks.js +56 -0
  66. package/dist/pointer-hover.d.ts +12 -0
  67. package/dist/pointer-hover.js +48 -0
  68. package/dist/question-dialog.d.ts +5 -0
  69. package/dist/question-dialog.js +20 -1
  70. package/dist/regenerate/chunk-plan.d.ts +2 -11
  71. package/dist/regenerate/chunk-plan.js +9 -20
  72. package/dist/regenerate/command-check.d.ts +9 -0
  73. package/dist/regenerate/command-check.js +163 -14
  74. package/dist/regenerate/job-panel.d.ts +5 -107
  75. package/dist/regenerate/job-panel.js +4 -289
  76. package/dist/regenerate/jobs-tree.d.ts +1 -0
  77. package/dist/regenerate/jobs-tree.js +5 -1
  78. package/dist/regenerate/loop.d.ts +6 -14
  79. package/dist/regenerate/loop.js +51 -35
  80. package/dist/regenerate/side-panel.d.ts +6 -1
  81. package/dist/regenerate/side-panel.js +158 -22
  82. package/dist/regenerate/spec-map-view.d.ts +11 -3
  83. package/dist/regenerate/spec-map-view.js +22 -2
  84. package/dist/regenerate/test-scripts.d.ts +8 -0
  85. package/dist/regenerate/test-scripts.js +20 -5
  86. package/dist/reopen.d.ts +29 -0
  87. package/dist/reopen.js +47 -0
  88. package/dist/resume-line.d.ts +4 -1
  89. package/dist/resume-line.js +5 -2
  90. package/dist/sentinel-chat.js +7 -2
  91. package/dist/sentinel.d.ts +1 -1
  92. package/dist/sentinel.js +4 -2
  93. package/dist/setup.js +9 -1
  94. package/dist/terminal-notifications.d.ts +31 -0
  95. package/dist/terminal-notifications.js +134 -0
  96. package/docs/README.md +2 -0
  97. package/docs/capture.md +207 -0
  98. package/docs/chats.md +8 -7
  99. package/docs/config.md +18 -3
  100. package/docs/development.md +4 -1
  101. package/docs/hosting.md +2 -2
  102. package/docs/launch.md +2 -2
  103. package/docs/regenerating.md +9 -8
  104. package/docs/sandbox.md +3 -1
  105. package/docs/sentinel.md +11 -11
  106. package/docs/skills-and-gates.md +1 -1
  107. package/docs/theming.md +3 -3
  108. package/docs/using.md +12 -5
  109. package/genome/capture/capture.md +26 -0
  110. package/genome/capture/check-conventions.md +5 -0
  111. package/genome/capture/check-reference.md +11 -0
  112. package/genome/capture/compact.md +7 -0
  113. package/genome/capture/concepts.md +3 -0
  114. package/genome/capture/divide.md +9 -0
  115. package/genome/capture/feature.md +45 -0
  116. package/genome/capture/interface.md +9 -0
  117. package/genome/capture/modules.md +23 -0
  118. package/genome/capture/outline.md +11 -0
  119. package/genome/capture/readability.md +12 -0
  120. package/genome/capture/reference.md +10 -0
  121. package/genome/capture/split.md +9 -0
  122. package/genome/capture/survey.md +37 -0
  123. package/genome/capture/trial.md +18 -0
  124. package/genome/capture/verify.md +7 -0
  125. package/genome/rules/turri-regeneration.md +2 -2
  126. package/package.json +3 -3
  127. package/dist/regenerate/steer.d.ts +0 -34
  128. package/dist/regenerate/steer.js +0 -91
@@ -1,98 +1,14 @@
1
- import { foregroundAnsi, mixColors, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
2
- import { formatDuration, formatElapsed, pulseName } from "./jobs.js";
3
- /**
4
- * The live panel above the editor while background work runs.
5
- *
6
- * One block per running job: what it is and how long it has been going, the stage it is
7
- * at, what is happening this second, and the last things its agents did. What waits is not
8
- * in it - the side panel lists the queue. It disappears when nothing is running - the finished
9
- * job announces itself in the transcript instead.
10
- *
11
- * It is drawn as a component rather than handed over as lines, because pi cuts a list of
12
- * lines off at ten. Instead it sizes itself: compact by default, and the agents' trace in full
13
- * while tool output is expanded - pi's own ctrl+o, which the person already uses to see more of
14
- * what the agent did. What finished stays counted either way: the side panel lists it.
15
- */
16
- export const JOB_PANEL_KEY = "turri-jobs";
17
- /**
18
- * The key that opens the side panel on its jobs, and goes back to it. Not ctrl+j: a terminal without the Kitty keyboard
19
- * protocol sends ctrl+j as a line feed - what it sends for shift+enter too, and what a dialog reads as enter - so it
20
- * would answer a question, and take a new line from the editor. ctrl+h is the byte old terminals sent for backspace;
21
- * every terminal now sends backspace as DEL, which pi never takes for ctrl+h, so it is free - in pi, and in a dialog.
22
- */
1
+ /** Opens the side panel; ctrl+j would conflict with the editor's newline. */
23
2
  export const PANEL_KEY = "ctrl+h";
24
- const TICK_MS = 1000;
25
- /**
26
- * Each key in the line under the panel - ctrl+o, ctrl+h - breathes until it is first pressed: fully there, a little
27
- * faint, and back, so it reads as something to press, not as text. Once every BREATH_MS, redrawn every BREATH_TICK_MS
28
- * while the panel shows and a key still breathes, at most BREATH_FADE of the way from the text's colour to the dim one.
29
- * Pressed once, it stays still for the rest of the process; the other breathes on.
30
- */
31
- export const BREATH_MS = 2400;
32
- const BREATH_TICK_MS = 100;
33
- const BREATH_FADE = 0.6;
34
- const pressed = new Set();
35
- /** A key of the line was pressed - ctrl+o, or the side panel opened: it stops breathing. */
36
- export function keyPressed(key) {
37
- pressed.add(key);
38
- }
39
- export function breathes(key) {
40
- return !pressed.has(key);
41
- }
42
- /** For tests: every key breathing again. */
43
- export function resetKeysForTests() {
44
- pressed.clear();
45
- }
46
- /** How faint a breathing key is at `now`: 0, fully there, at the start of each breath, BREATH_FADE halfway through. */
47
- export function breath(now) {
48
- const phase = (now % BREATH_MS) / BREATH_MS;
49
- return BREATH_FADE * (0.5 - 0.5 * Math.cos(2 * Math.PI * phase));
50
- }
51
- /** Tool-call progress arrives many times a second; the screen does not need to. */
52
- const REDRAW_MS = 100;
53
- /** Activity lines per running job while compact. */
54
- const COMPACT_ACTIVITY = 2;
55
- /**
56
- * A spinner rather than a disclosure arrow: a `▸` promises something opens when you pick
57
- * it. The frame follows the clock, so it moves on every redraw, including the tick.
58
- */
59
3
  const SPINNER = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
60
4
  export function spinner(now) {
61
5
  return SPINNER[Math.floor(now / 1000) % SPINNER.length];
62
6
  }
63
- /** A finished pulse in its module's line: its mark, number and kind - `✓ 3 regenerate`. What it regenerated is in the side panel. */
64
- function finishedItem(job, marks) {
65
- if (job.module === undefined || job.pulse === undefined)
66
- return `${finishedMark(job, marks)} ${pulseName(job)}`;
67
- return `${finishedMark(job, marks)} ${job.pulse} ${job.kind}`;
68
- }
69
- /**
70
- * What finished, a line a module - the module that finished last on top, its name, then its pulses newest first -
71
- * fitted to `width`: the newest that fit, the rest counted as earlier. The side panel lists every one.
72
- */
73
- export function finishedLines(finished, width, marks = PLAIN_MARKS) {
74
- const byModule = new Map();
75
- for (const job of [...finished].sort((a, b) => (b.finishedAt ?? 0) - (a.finishedAt ?? 0) || b.sequence - a.sequence)) {
76
- const key = job.module ?? job.kind;
77
- byModule.set(key, [...(byModule.get(key) ?? []), job]);
78
- }
79
- const pad = Math.max(...[...byModule.keys()].map((name) => visibleWidth(name)));
80
- return [...byModule].map(([name, jobs]) => {
81
- const head = ` ${name}${" ".repeat(pad - visibleWidth(name))} `;
82
- const items = jobs.map((job) => finishedItem(job, marks));
83
- const lineOf = (shown) => `${head}${items.slice(0, shown).join(" · ")}${shown < items.length ? ` · … ${items.length - shown} earlier` : ""}`;
84
- let shown = items.length;
85
- while (width !== undefined && shown > 1 && visibleWidth(lineOf(shown)) > width)
86
- shown -= 1;
87
- return lineOf(shown);
88
- });
89
- }
90
- /** A pulse that ran to its end and whose build did not pass - stopped at a gate - is not a success. */
7
+ /** A pulse that ran to its end and whose build did not pass is not a success. */
91
8
  export function didNotPass(job) {
92
9
  return job.status === "succeeded" && job.details?.passed === false;
93
10
  }
94
11
  const PLAIN_MARKS = { success: (text) => text, error: (text) => text, warning: (text) => text };
95
- /** A finished pulse's mark, in the colour of how it ended. */
96
12
  export function finishedMark(job, paint = PLAIN_MARKS) {
97
13
  if (didNotPass(job) || job.status === "failed")
98
14
  return paint.error("✗");
@@ -100,18 +16,11 @@ export function finishedMark(job, paint = PLAIN_MARKS) {
100
16
  return paint.warning("■");
101
17
  return paint.success("✓");
102
18
  }
103
- /** What a pulse cost, as its line says it: " · $0.12", or nothing when the price is not known. */
104
19
  export function pulseCost(job) {
105
20
  return job.usage.cost > 0 ? ` · $${job.usage.cost.toFixed(2)}` : "";
106
21
  }
107
- /**
108
- * Jobs whose tool draws its own progress widget, which already shows the functional spec being
109
- * built: the panel leaves it out, so it is not written twice.
110
- */
111
- const SPEC_SHOWN_BY_WIDGET = new Set(["regenerate"]);
112
- /** Spec lines shown per running job while expanded. */
113
- const EXPANDED_SPEC_LINES = 30;
114
22
  const PLAIN_DIFF = { added: (text) => text, removed: (text) => text };
23
+ /** One line saying what a spec change does: the files, the lines added and removed, and the first line it adds. */
115
24
  export function summarizeDiff(diff, style = PLAIN_DIFF) {
116
25
  const files = new Set();
117
26
  let added = 0;
@@ -136,204 +45,10 @@ export function summarizeDiff(diff, style = PLAIN_DIFF) {
136
45
  else if (line.startsWith("-")) {
137
46
  removed += 1;
138
47
  const text = line.slice(1).replace(/^- /, "").trim();
139
- if (firstRemoved === undefined && text !== "" && !/^\*\*\*.*\*\*\*$/.test(text))
48
+ if (firstRemoved === undefined && text !== "")
140
49
  firstRemoved = text;
141
50
  }
142
51
  }
143
- // What it adds, when it adds anything; what it takes out, when that is all it does.
144
52
  const what = first !== undefined ? ` · ${first}` : firstRemoved !== undefined ? ` · removes: ${firstRemoved}` : "";
145
53
  return `${[...files].join(", ")} ${style.added(`+${added}`)} ${style.removed(`−${removed}`)}${what}`;
146
54
  }
147
- /** The lines of a diff worth reading in a panel: the hunks, not the headers. */
148
- /**
149
- * A line of the panel wrapped to its width, its continuations under its text: indented as far as it is,
150
- * and past the rule of a diff box when it is in one.
151
- */
152
- export function wrapKeepingIndent(line, width) {
153
- if (visibleWidth(line) <= width)
154
- return [line];
155
- const plain = line.replace(/\x1b\[[0-9;]*m/g, "");
156
- const indent = /^(\s*(?:│ )?)/.exec(plain)?.[1] ?? "";
157
- // Inside a diff box its rule goes on down the continuations; elsewhere, blanks.
158
- const lead = indent;
159
- const inner = Math.max(10, width - indent.length);
160
- const [first = "", ...rest] = wrapTextWithAnsi(line, width);
161
- return [first, ...rest.flatMap((part) => wrapTextWithAnsi(part, inner)).map((part) => `${lead}${part}`)];
162
- }
163
- export function jobPanelLines(jobs, options = {}) {
164
- const now = options.now ?? Date.now();
165
- const expanded = options.expanded === true;
166
- // Newest first, as every list of pulses is.
167
- const inOrder = [...jobs].sort((a, b) => b.sequence - a.sequence);
168
- const running = inOrder.filter((job) => job.status === "running").sort((a, b) => b.startedAt - a.startedAt || b.sequence - a.sequence);
169
- // A module whose work is being planned: the planner is an agent, and takes a while - shown at once, as work going on.
170
- const planning = inOrder.filter((job) => job.status === "queued" && job.planning !== undefined);
171
- // Nothing running or being planned: no panel - what waits and what finished are in the side panel.
172
- if (running.length === 0 && planning.length === 0)
173
- return [];
174
- const finished = inOrder.filter((job) => (job.status === "succeeded" || job.status === "failed" || job.status === "stopped") && job.replacedBy === undefined);
175
- const lines = [];
176
- // What finished, on top - a line a module, newest first - and a rule under it: what runs now is below, by the input.
177
- if (finished.length > 0) {
178
- lines.push(...finishedLines(finished, options.width, options.marks ?? PLAIN_MARKS));
179
- lines.push(` ${"─".repeat(Math.max(10, (options.width ?? 80) - 4))}`);
180
- }
181
- for (const [index, job] of running.entries()) {
182
- if (index > 0)
183
- lines.push("");
184
- // Its module, how long and what it has cost: what it is doing follows.
185
- lines.push(`${spinner(now)} ${pulseName(job)} · ${formatDuration(job)}${pulseCost(job)}`);
186
- // What it is on now, and for how long - beside the job's own time, which is the whole of it.
187
- const onIt = job.building?.since !== undefined ? ` · ${formatElapsed(now - job.building.since)}` : "";
188
- if (job.building !== undefined && SPEC_SHOWN_BY_WIDGET.has(job.kind)) {
189
- // The module widget shows its text; the panel, how long it has taken so far.
190
- lines.push(` ${job.building.label}${onIt}`);
191
- }
192
- else if (job.building !== undefined) {
193
- const text = job.building.text.split("\n").filter((line) => line.trim() !== "");
194
- if (!expanded) {
195
- const more = text.length > 1 ? ` (+${text.length - 1} line${text.length === 2 ? "" : "s"} · ctrl+o)` : "";
196
- lines.push(` ${job.building.label}${onIt}: ${(text[0] ?? "").trim()}${more}`);
197
- }
198
- else {
199
- lines.push(` ${job.building.label}${onIt}:`);
200
- for (const line of text.slice(0, EXPANDED_SPEC_LINES))
201
- lines.push(` │ ${line}`);
202
- if (text.length > EXPANDED_SPEC_LINES)
203
- lines.push(` │ … ${text.length - EXPANDED_SPEC_LINES} more lines - ${PANEL_KEY} shows it all`);
204
- }
205
- }
206
- const activity = expanded ? job.activity : job.activity.slice(-COMPACT_ACTIVITY);
207
- for (const line of activity)
208
- lines.push(` ${line}`);
209
- if (job.now !== undefined) {
210
- const seconds = Math.max(0, Math.round((now - job.now.since) / 1000));
211
- lines.push(` … ${job.now.label} · ${seconds}s`);
212
- }
213
- }
214
- for (const job of planning) {
215
- if (lines.length > 0 && running.length > 0)
216
- lines.push("");
217
- lines.push(`${spinner(now)} ${job.module ?? job.summary} · planning the pulses · ${formatElapsed(now - job.planning.since)}`);
218
- lines.push(" working out what to regenerate and cutting it into pulses - the first starts once it is done");
219
- }
220
- // Always a line of help: how to see more here, and how to inspect the jobs in the side panel.
221
- if (options.hints === false) {
222
- // The side panel shows it all already, and says its own keys.
223
- }
224
- else {
225
- // Set apart from the trace above it.
226
- lines.push("");
227
- const key = options.keys ?? ((_key, text) => text);
228
- lines.push(` ${key("trace", `ctrl+o to ${expanded ? "collapse" : "expand"} the trace`)} · ${key("peek", `${PANEL_KEY} to peek at regen`)}`);
229
- }
230
- // A line is one row of the screen: a newline in one - an agent's words, a command - would draw past what the renderer
231
- // tracks and stay on the screen, so each part is a row of its own.
232
- return lines.flatMap((line) => line.split(/\r?\n/));
233
- }
234
- /**
235
- * The keys of the line, painted at `now`'s breath: one not pressed yet in the text's colour mixed toward the dim one, one
236
- * pressed as it is. Plain where the theme has no colours to mix.
237
- */
238
- export function breathing(theme, now) {
239
- const text = theme.colors?.text;
240
- const dim = theme.colors?.dim ?? theme.colors?.muted;
241
- const mode = theme.getColorMode?.();
242
- if (text === undefined || dim === undefined || (mode !== "truecolor" && mode !== "256color"))
243
- return (_key, line) => line;
244
- const ansi = foregroundAnsi(mixColors(text, dim, breath(now)), mode);
245
- return (key, line) => (breathes(key) ? `${ansi}${line}\x1b[39m` : line);
246
- }
247
- export function createJobPanel(list) {
248
- let ui;
249
- let tui;
250
- let mounted = false;
251
- let timer;
252
- /** The keys breathing: a redraw a tick of it, while the panel shows and a key still breathes. */
253
- let breathTimer;
254
- /** Whether the trace was open when the panel was first drawn. */
255
- let firstExpanded;
256
- let pending;
257
- const active = () => list().some((job) => job.status === "running" || job.status === "queued");
258
- const draw = () => {
259
- if (ui === undefined)
260
- return;
261
- const target = ui;
262
- try {
263
- if (active() && !mounted) {
264
- mounted = true;
265
- target.setWidget(JOB_PANEL_KEY, (next, theme) => {
266
- tui = next;
267
- return {
268
- // Laid out on every render, so ctrl+o takes effect on the very next frame.
269
- render: (width) => {
270
- const expanded = target.getToolsExpanded();
271
- // ctrl+o turns the trace open or closed: once it is not as it first was, ctrl+o was pressed.
272
- if (firstExpanded === undefined)
273
- firstExpanded = expanded;
274
- else if (expanded !== firstExpanded)
275
- keyPressed("trace");
276
- const marks = { success: (text) => theme.fg("success", text), error: (text) => theme.fg("error", text), warning: (text) => theme.fg("warning", text) };
277
- const lines = jobPanelLines(list(), { expanded, width, marks, keys: breathing(theme, Date.now()) });
278
- // Opened, nothing is cut off: every line wraps. Closed, a line each - the panel stays short.
279
- return expanded ? lines.flatMap((line) => wrapKeepingIndent(line, width)) : lines.map((line) => truncateToWidth(line, width));
280
- },
281
- invalidate() { },
282
- };
283
- }, { placement: "aboveEditor" });
284
- }
285
- else if (!active() && mounted) {
286
- mounted = false;
287
- tui = undefined;
288
- target.setWidget(JOB_PANEL_KEY, undefined);
289
- }
290
- else {
291
- tui?.requestRender();
292
- }
293
- }
294
- catch {
295
- // The panel is a convenience; losing it must not fail the work it shows.
296
- }
297
- // The elapsed time moves even when the agents are quiet - a long model call is exactly
298
- // when someone looks to see whether anything is happening.
299
- if (mounted && timer === undefined) {
300
- timer = setInterval(draw, TICK_MS);
301
- timer.unref?.();
302
- breathTimer = setInterval(() => {
303
- // Both pressed: nothing breathes, and the panel is drawn as often as before.
304
- if (!breathes("trace") && !breathes("peek")) {
305
- clearInterval(breathTimer);
306
- breathTimer = undefined;
307
- return;
308
- }
309
- tui?.requestRender();
310
- }, BREATH_TICK_MS);
311
- breathTimer.unref?.();
312
- }
313
- else if (!mounted && timer !== undefined) {
314
- clearInterval(timer);
315
- timer = undefined;
316
- if (breathTimer !== undefined)
317
- clearInterval(breathTimer);
318
- breathTimer = undefined;
319
- }
320
- };
321
- return {
322
- attach(next) {
323
- // A new session starts with pi's widgets cleared, so whatever was mounted is gone.
324
- ui = next;
325
- mounted = false;
326
- tui = undefined;
327
- draw();
328
- },
329
- refresh() {
330
- if (pending !== undefined)
331
- return;
332
- pending = setTimeout(() => {
333
- pending = undefined;
334
- draw();
335
- }, REDRAW_MS);
336
- pending.unref?.();
337
- },
338
- };
339
- }
@@ -54,6 +54,7 @@ export declare function jobsTreeRows(jobs: Job[], state: JobsTreeState): TreeRow
54
54
  export declare function jobsTreeLines(jobs: Job[], state: JobsTreeState, width: number, style: TranscriptStyle): {
55
55
  lines: string[];
56
56
  rowStarts: number[];
57
+ labelHeights: number[];
57
58
  rows: TreeRow[];
58
59
  };
59
60
  /** Keep the cursor's row in sight: scroll only as far as that takes. */
@@ -170,6 +170,7 @@ export function jobsTreeLines(jobs, state, width, style) {
170
170
  state.cursor = Math.max(0, Math.min(state.cursor, rows.length - 1));
171
171
  const lines = [];
172
172
  const rowStarts = [];
173
+ const labelHeights = [];
173
174
  rows.forEach((row, index) => {
174
175
  rowStarts.push(lines.length);
175
176
  const here = index === state.cursor;
@@ -182,12 +183,14 @@ export function jobsTreeLines(jobs, state, width, style) {
182
183
  }
183
184
  const header = `${pointer} ${state.open[row.section] ? "▾" : "▸"} ${SECTION_NAMES[row.section]} (${row.count})`;
184
185
  lines.push(here ? style.heading(header) : style.muted(header));
186
+ labelHeights.push(1);
185
187
  return;
186
188
  }
187
189
  if (row.kind === "file") {
188
190
  const open = isFileOpen(state, row);
189
191
  const paint = style.diff ?? { ...PLAIN_PAINT, added: style.added, removed: style.removed, muted: style.muted };
190
192
  const shown = diffFiles(row.job.diff, Math.max(10, width - FILE_INDENT.length), paint, row.job.diffWhere).find((file) => file.file === row.file);
193
+ labelHeights.push(shown === undefined ? 0 : 1);
191
194
  if (shown === undefined)
192
195
  return;
193
196
  const header = `${pointer}${FILE_INDENT.slice(1)}${fileHeader(shown, paint, open)}`;
@@ -204,6 +207,7 @@ export function jobsTreeLines(jobs, state, width, style) {
204
207
  const head = `${pointer} ${open ? "▾" : "▸"} ${markOf(job, style)} ${pulseName(job)}${time}${pulseCost(job)}`;
205
208
  const [first = "", ...rest] = wrapTextWithAnsi(head, Math.max(10, width));
206
209
  lines.push(here ? style.heading(first) : first, ...rest.map((line) => ` ${line}`));
210
+ labelHeights.push(1 + rest.length);
207
211
  if (open)
208
212
  lines.push(...detailLines(job, jobs, width, style));
209
213
  });
@@ -211,7 +215,7 @@ export function jobsTreeLines(jobs, state, width, style) {
211
215
  if (state.open.earlier && (state.earlierMore ?? 0) > 0) {
212
216
  lines.push(style.muted(` ${state.earlierMore} earlier run${state.earlierMore === 1 ? "" : "s"} in the ledger - pulses with runs lists them`));
213
217
  }
214
- return { lines, rowStarts, rows };
218
+ return { lines, rowStarts, labelHeights, rows };
215
219
  }
216
220
  /** How far a job's files, and their lines, are indented under it. */
217
221
  const FILE_INDENT = " ";
@@ -1,7 +1,6 @@
1
1
  import { type ChunkAgents } from "./chunk-plan.ts";
2
2
  import { type SpecGap } from "./notes.ts";
3
3
  import { type Job, type JobRegistry, type PulseCases } from "./jobs.ts";
4
- import type { Steering } from "./steer.ts";
5
4
  import { type ChainEntry } from "./requires.ts";
6
5
  import { type SpecSnapshot } from "./regenerate.ts";
7
6
  import { type JobSteering } from "./steering.ts";
@@ -81,8 +80,8 @@ export interface ModuleStatus {
81
80
  specs?: string[];
82
81
  }>;
83
82
  /**
84
- * What the plan of its code did not do as asked: the person's wishes its planner did not follow and why, an answer
85
- * that did not hold, a group split for its size.
83
+ * Where the plan of its code fell back: a planner's answer that was not given or did not hold, a group split for its
84
+ * size.
86
85
  */
87
86
  planNotes?: string[];
88
87
  /** Why nothing runs there, when nothing does. */
@@ -149,23 +148,20 @@ export interface WorkLoop {
149
148
  */
150
149
  bringUp(plainFile: string, options?: {
151
150
  model?: string;
152
- guidance?: string;
153
151
  }): Promise<ModuleStatus[]>;
154
152
  /**
155
- * Plan a spec's module as `bringUp` would - the same codebases, its config pinned, the steering and `guidance` given
156
- * to the planner - and start nothing: the plans are kept, and its pulses held until regenerate, conform or /regenerate
157
- * asks for the module. Then the first pulse of the kept plan starts as it is, planned again only when the ***plain,
158
- * what it is built from or the steering changed since. A module the person halted stays halted, and a codebase whose
153
+ * Plan a spec's module as `bringUp` would - the same codebases, its config pinned - and start nothing: the plans are kept, and its pulses held until regenerate, conform or /regenerate
154
+ * asks for the module. Then the first pulse of the kept plan starts as it is, planned again only when the ***plain or
155
+ * what it is built from changed since. A module the person halted stays halted, and a codebase whose
159
156
  * chain has a pulse running goes on as it was, planning what follows it. Says what is planned.
160
157
  */
161
158
  lookAhead(plainFile: string, options?: {
162
159
  model?: string;
163
- guidance?: string;
164
160
  }): Promise<ModuleStatus[]>;
165
161
  /**
166
162
  * A planned row (`planned-<module>-N`, as `planned` names it) as the loop keeps it: its cases and, for the next pulse
167
163
  * of a codebase with nothing running, the whole prompt its coding agent will get - built from the kept plan, never
168
- * planned again. Otherwise, or when the ***plain or the steering changed since the plan was made, `why` says why no
164
+ * planned again. Otherwise, or when the ***plain changed since the plan was made, `why` says why no
169
165
  * prompt is shown. Undefined when no row has that id.
170
166
  */
171
167
  plannedPulse(rowId: string): Promise<PlannedPulse | undefined>;
@@ -177,7 +173,6 @@ export interface WorkLoop {
177
173
  */
178
174
  regenerateAgain(plainFile: string, funcIds: string | string[], options?: {
179
175
  model?: string;
180
- guidance?: string;
181
176
  }): Promise<ModuleStatus[]>;
182
177
  /**
183
178
  * What is left to regenerate, for a spec's module, in each codebase where its code lives: the code's work from its
@@ -222,7 +217,6 @@ export interface WorkLoop {
222
217
  */
223
218
  fromScratch(plainFile: string, options?: {
224
219
  model?: string;
225
- guidance?: string;
226
220
  chain?: boolean;
227
221
  }): Promise<ModuleStatus[]>;
228
222
  /**
@@ -367,8 +361,6 @@ export declare function createWorkLoop(options: {
367
361
  planner?: ChunkAgents | false;
368
362
  /** The planner's model, read afresh each plan - the chat's, in a conversation. */
369
363
  plannerModel?: string | (() => string | undefined);
370
- /** How the person wants the work cut and ordered, for every plan of a spec's module. */
371
- steering?: (plainFile: string) => Steering[];
372
364
  /** Renders a job. Default: a spec diff render that lands on its unit tests. */
373
365
  run?: JobRunner;
374
366
  /** Writes and runs a conformance job's tests. Default: a spec diff's conformance run, the whole suite with it. */