@turri-dev/cli 0.1.3-next.f74e98a → 0.1.4-next.18d69fb
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.
- package/README.md +22 -1
- package/dist/ask.js +34 -15
- package/dist/extension.js +63 -19
- package/dist/genome.js +1 -1
- package/dist/loop-tools.js +20 -7
- package/dist/pi-launch.js +5 -0
- package/dist/question-dialog.js +9 -3
- package/dist/questioning.js +1 -1
- package/dist/regenerate/activity.js +2 -0
- package/dist/regenerate/conform.js +5 -5
- package/dist/regenerate/conformance-agents.js +28 -8
- package/dist/regenerate/conformance.js +24 -10
- package/dist/regenerate/loop.js +116 -10
- package/dist/regenerate/notes.js +66 -17
- package/dist/regenerate/prompt.js +3 -1
- package/dist/regenerate/regenerate.js +12 -8
- package/dist/regenerate/regression.js +2 -1
- package/dist/regenerate/requires.js +55 -2
- package/dist/regenerate/unit-review.js +11 -0
- package/dist/release-tools.js +1 -1
- package/dist/resume-line.js +4 -0
- package/dist/spec-tools.js +10 -45
- package/docs/authoring-plain.md +9 -6
- package/docs/installation.md +3 -0
- package/docs/regenerating.md +39 -13
- package/docs/skills-and-gates.md +5 -3
- package/docs/using.md +5 -4
- package/genome/skills/bud/SKILL.md +67 -36
- package/genome/skills/bud/references/intent.md +4 -0
- package/package.json +3 -3
- package/genome/skills/bud/references/checklist.md +0 -44
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ npm install -g @turri-dev/cli # puts `turri` on your PATH
|
|
|
27
27
|
turri doctor # checks the machine
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
To work on turri itself, run it from a clone
|
|
30
|
+
To follow `main` as it moves, or work on turri itself, run it [from a clone](#from-a-clone) instead.
|
|
31
31
|
|
|
32
32
|
`doctor` checks for Node 22.19+, bash, the OS sandbox and a model provider for pi; in a project, the toolchains its
|
|
33
33
|
modules need, what its testing scripts run against this machine, and that each model `config.turri.yaml` names
|
|
@@ -73,6 +73,27 @@ Rather not install Node and the rest? **turri** also runs in Docker, from one im
|
|
|
73
73
|
|
|
74
74
|
Choosing models: [models](#models); what to do next: [use](#use).
|
|
75
75
|
|
|
76
|
+
### From a clone
|
|
77
|
+
|
|
78
|
+
In place of the npm package - for the latest of `main`, or to change turri itself:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone git@github.com:turri-oss/turri.git && cd turri
|
|
82
|
+
npm install
|
|
83
|
+
npm link # puts `turri` on your PATH, pointing at this clone
|
|
84
|
+
turri doctor
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The clone runs its TypeScript sources directly, so there is nothing to build. When new commits land:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git pull
|
|
91
|
+
npm install # picks up any dependency that changed
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
A **turri** already running keeps the code it started with - start it again to run what you pulled. More in
|
|
95
|
+
[installation](docs/installation.md#from-a-clone).
|
|
96
|
+
|
|
76
97
|
## Why
|
|
77
98
|
|
|
78
99
|
In the age of coding agents, writing code is getting easy. The hard and important part is
|
package/dist/ask.js
CHANGED
|
@@ -9,6 +9,9 @@ import { PANEL_KEY } from "./regenerate/job-panel.js";
|
|
|
9
9
|
export const OTHER_OPTION = "Something else…";
|
|
10
10
|
export const CHAT_OPTION = "Chat about this";
|
|
11
11
|
export const DONE_OPTION = "Done — that's all of them";
|
|
12
|
+
/** An option's box in a question of several, ticked and not. */
|
|
13
|
+
export const TICKED = "☑";
|
|
14
|
+
export const UNTICKED = "☐";
|
|
12
15
|
export const DISMISSED = "The user dismissed the question without answering.";
|
|
13
16
|
/** How an answer that is no answer starts: the person chose to talk about the question first. */
|
|
14
17
|
export const CHAT_PREFIX = "The user has not answered this question yet: they chose to talk about it first.";
|
|
@@ -107,32 +110,48 @@ export async function runAsk(asked, io) {
|
|
|
107
110
|
return choice;
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
|
-
// Pick several:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
// Pick several: every option a box, ticked and unticked as it is chosen, until they say they are done. What they type
|
|
114
|
+
// is one more box, ticked - and can be unticked too. Something else, Chat about this and Done are no boxes.
|
|
115
|
+
const listed = [...options];
|
|
116
|
+
const ticked = new Set();
|
|
117
|
+
const picked = () => listed.filter((option) => ticked.has(option));
|
|
118
|
+
let at = 0;
|
|
119
|
+
for (;;) {
|
|
120
|
+
const rows = listed.map((option) => `${ticked.has(option) ? TICKED : UNTICKED} ${option}`);
|
|
121
|
+
const choice = await io.select(request.question, [...rows, ...extras, DONE_OPTION], context, at);
|
|
122
|
+
if (choice === undefined || choice === DONE_OPTION)
|
|
119
123
|
break;
|
|
120
124
|
if (choice === OTHER_OPTION) {
|
|
125
|
+
at = listed.length;
|
|
121
126
|
const typed = await typeInstead();
|
|
122
|
-
if (
|
|
123
|
-
|
|
127
|
+
if (typedNothing(typed))
|
|
128
|
+
continue;
|
|
129
|
+
const option = typed.trim();
|
|
130
|
+
if (!listed.includes(option))
|
|
131
|
+
listed.push(option);
|
|
132
|
+
ticked.add(option);
|
|
133
|
+
at = listed.indexOf(option);
|
|
124
134
|
continue;
|
|
125
135
|
}
|
|
126
136
|
if (choice === CHAT_OPTION) {
|
|
137
|
+
at = listed.length + extras.indexOf(CHAT_OPTION);
|
|
127
138
|
const said = await chatAbout();
|
|
128
139
|
if (typedNothing(said))
|
|
129
140
|
continue;
|
|
130
|
-
return chatAnswer(said,
|
|
141
|
+
return chatAnswer(said, picked());
|
|
131
142
|
}
|
|
132
|
-
|
|
133
|
-
|
|
143
|
+
// A row, or - where the answer is typed, on the command line - an option by its text, or one more of their own.
|
|
144
|
+
const row = rows.indexOf(choice);
|
|
145
|
+
const option = row !== -1 ? listed[row] : choice.trim();
|
|
146
|
+
if (!listed.includes(option))
|
|
147
|
+
listed.push(option);
|
|
148
|
+
if (ticked.has(option))
|
|
149
|
+
ticked.delete(option);
|
|
150
|
+
else
|
|
151
|
+
ticked.add(option);
|
|
152
|
+
at = listed.indexOf(option);
|
|
134
153
|
}
|
|
135
|
-
return
|
|
154
|
+
return ticked.size > 0 ? picked().join(", ") : DISMISSED;
|
|
136
155
|
}
|
|
137
156
|
/**
|
|
138
157
|
* While a question is open, what catches ctrl+h on the terminal's input: pi gives an extension's shortcut only the keys
|
package/dist/extension.js
CHANGED
|
@@ -90,17 +90,26 @@ aside) {
|
|
|
90
90
|
// The question, with what the asker gives to read for it - a brief to confirm - above it; what it said of its work
|
|
91
91
|
// before asking is kept in its record, never put in the dialog.
|
|
92
92
|
// A dialog of turri's own: a long brief scrolls above the question, and the options always show (question-dialog.ts).
|
|
93
|
-
const dialog = (question, context, options) => ctx.ui.custom((tui, theme, _keybindings, done) =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
const dialog = (question, context, options, selected) => ctx.ui.custom((tui, theme, _keybindings, done) => {
|
|
94
|
+
const shown = new QuestionDialog({
|
|
95
|
+
question,
|
|
96
|
+
...(context !== undefined ? { context } : {}),
|
|
97
|
+
...(options !== undefined ? { options } : {}),
|
|
98
|
+
...(selected !== undefined ? { selected } : {}),
|
|
99
|
+
rows: () => tui.terminal.rows,
|
|
100
|
+
style: { accent: (text) => theme.fg("accent", text), muted: (text) => theme.fg("muted", text), bold: (text) => theme.bold(text) },
|
|
101
|
+
done: (answer) => {
|
|
102
|
+
if (questionShown === shown)
|
|
103
|
+
questionShown = undefined;
|
|
104
|
+
done(answer);
|
|
105
|
+
},
|
|
106
|
+
requestRender: () => tui.requestRender(),
|
|
107
|
+
});
|
|
108
|
+
questionShown = shown;
|
|
109
|
+
return shown;
|
|
110
|
+
});
|
|
102
111
|
const asking = (asked) => runAsk(asked, {
|
|
103
|
-
select: (title, options, context) => dialog(title, context, options),
|
|
112
|
+
select: (title, options, context, at) => dialog(title, context, options, at),
|
|
104
113
|
input: (title, context) => dialog(title, context),
|
|
105
114
|
});
|
|
106
115
|
const bare = { ...request, said: undefined };
|
|
@@ -117,6 +126,12 @@ aside) {
|
|
|
117
126
|
}
|
|
118
127
|
/** The side panel, as a question open in the chat reaches it: set once the extension has its panel. */
|
|
119
128
|
let questionPeek;
|
|
129
|
+
/**
|
|
130
|
+
* The question open in the chat now, if any. The side panel gives the keys back to it: pi would give them to what had the
|
|
131
|
+
* focus when the panel first opened, and a panel kept beside the chat outlives that question - the keys would go to a
|
|
132
|
+
* dialog already answered, and nothing would take them.
|
|
133
|
+
*/
|
|
134
|
+
let questionShown;
|
|
120
135
|
/** A widget with nothing to draw: below the editor, it takes no line. */
|
|
121
136
|
const PEEK_KEY_WIDGET = "turri-peek-key";
|
|
122
137
|
/**
|
|
@@ -534,7 +549,7 @@ export default function (pi) {
|
|
|
534
549
|
loopTools: [
|
|
535
550
|
regenerateTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named, work) => jobModel(ctx, work ?? "spec_changes", named, plainFile), wait: () => false }),
|
|
536
551
|
driftTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx) }),
|
|
537
|
-
haltTool({ jobs }),
|
|
552
|
+
haltTool({ jobs, workLoop: () => workLoops.get(jobs)?.loop }),
|
|
538
553
|
conformTool({ cwd, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named) => jobModel(ctx, "spec_changes", named, plainFile), wait: () => false }),
|
|
539
554
|
],
|
|
540
555
|
// The escalation becomes a real dialog in the TUI. Without dialog-capable
|
|
@@ -1405,25 +1420,37 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1405
1420
|
// The panel is compact and ctrl+o only lasts as long as the work does. This is the whole
|
|
1406
1421
|
// list, finished jobs included, put in the transcript where it stays.
|
|
1407
1422
|
pi.registerCommand("halt", {
|
|
1408
|
-
description: "Halt a queued or running pulse, or what activate started: /halt [pulse id | activated <name>]",
|
|
1423
|
+
description: "Halt a queued or running pulse, a module's planned pulses, or what activate started: /halt [pulse id | module | activated <name>]",
|
|
1409
1424
|
handler: async (args, ctx) => {
|
|
1410
1425
|
if (!ctx.hasUI)
|
|
1411
1426
|
return;
|
|
1412
1427
|
const live = jobs.list().filter((job) => job.status === "running" || job.status === "queued");
|
|
1413
1428
|
const deployed = runningDeployed();
|
|
1429
|
+
const loop = workLoops.get(jobs)?.loop;
|
|
1430
|
+
// A module's planned pulses, one line a module: halting one halts the module.
|
|
1431
|
+
const plannedRows = loop?.planned() ?? [];
|
|
1432
|
+
const planned = [...new Set(plannedRows.map((row) => row.module ?? ""))].filter((module) => module !== "");
|
|
1414
1433
|
let id = args.trim();
|
|
1415
1434
|
if (id === "") {
|
|
1416
|
-
if (live.length === 0 && deployed.length === 0)
|
|
1417
|
-
return ctx.ui.notify("Nothing is regenerating or
|
|
1435
|
+
if (live.length === 0 && deployed.length === 0 && planned.length === 0)
|
|
1436
|
+
return ctx.ui.notify("Nothing is regenerating, queued or planned.", "info");
|
|
1418
1437
|
const label = (job) => `${job.id} ${job.status.padEnd(8)} ${pulseName(job)}`;
|
|
1419
|
-
const
|
|
1438
|
+
const plannedLabel = (module) => {
|
|
1439
|
+
const rows = plannedRows.filter((row) => row.module === module);
|
|
1440
|
+
const waiting = rows.find((row) => row.id.endsWith("-waiting"));
|
|
1441
|
+
return `${module} ${waiting !== undefined ? waiting.summary : `${rows.length} planned`} - halts the module`;
|
|
1442
|
+
};
|
|
1443
|
+
const labels = [...live.map(label), ...planned.map(plannedLabel), ...deployed.map((item) => deployedLabel(item.name, item.url ?? item.command))];
|
|
1420
1444
|
const picked = await ctx.ui.select("Halt which?", labels);
|
|
1421
1445
|
const job = live.find((candidate) => picked !== undefined && label(candidate) === picked);
|
|
1446
|
+
const module = planned.find((name) => picked !== undefined && plannedLabel(name) === picked);
|
|
1422
1447
|
const server = deployed.find((item) => picked !== undefined && deployedLabel(item.name, item.url ?? item.command) === picked);
|
|
1423
1448
|
if (server !== undefined)
|
|
1424
1449
|
id = `activated ${server.name}`;
|
|
1425
1450
|
else if (job !== undefined)
|
|
1426
1451
|
id = job.id;
|
|
1452
|
+
else if (module !== undefined)
|
|
1453
|
+
id = module;
|
|
1427
1454
|
else
|
|
1428
1455
|
return;
|
|
1429
1456
|
}
|
|
@@ -1432,7 +1459,7 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1432
1459
|
const stopped = await stopDeployed({ name });
|
|
1433
1460
|
return shownAfterCommand(pi, ctx, `/halt ${id}`, stopped.length > 0 ? `Halted ${stopped.join(", ")}.` : `Nothing activate started is running as ${name}.`, "info");
|
|
1434
1461
|
}
|
|
1435
|
-
ctx.ui.notify(stopJob(jobs, id), "info");
|
|
1462
|
+
ctx.ui.notify(stopJob(jobs, id, undefined, loop), "info");
|
|
1436
1463
|
},
|
|
1437
1464
|
});
|
|
1438
1465
|
// Debug mode, for the render agents started from now on - see debug-log.ts.
|
|
@@ -1508,6 +1535,7 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1508
1535
|
}
|
|
1509
1536
|
needsLooking.delete(jobs);
|
|
1510
1537
|
if (panel !== undefined) {
|
|
1538
|
+
panel.keepChatFocus();
|
|
1511
1539
|
panel.handle?.setHidden(false);
|
|
1512
1540
|
panel.keys = true;
|
|
1513
1541
|
panel.handle?.focus();
|
|
@@ -1515,7 +1543,21 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1515
1543
|
}
|
|
1516
1544
|
// Not awaited: the panel lives on while the jobs it shows run.
|
|
1517
1545
|
void ctx.ui.custom((tui, theme, _keybindings, done) => {
|
|
1518
|
-
|
|
1546
|
+
// What the chat shows when the panel takes the keys - its editor, or a pi dialog - for when it gives them back.
|
|
1547
|
+
const focusedNow = () => tui.getFocusedComponent?.() ?? null;
|
|
1548
|
+
let chatFocus = focusedNow();
|
|
1549
|
+
const keepChatFocus = () => {
|
|
1550
|
+
const focused = focusedNow();
|
|
1551
|
+
if (focused !== null && focused !== component && !(focused instanceof QuestionDialog))
|
|
1552
|
+
chatFocus = focused;
|
|
1553
|
+
};
|
|
1554
|
+
// The keys back to the chat: to the question open there now, else to what it showed - never to a question answered
|
|
1555
|
+
// while the panel was open.
|
|
1556
|
+
const giveBack = () => entry.handle?.unfocus({ target: questionShown ?? chatFocus });
|
|
1557
|
+
const close = () => {
|
|
1558
|
+
giveBack();
|
|
1559
|
+
done(undefined);
|
|
1560
|
+
};
|
|
1519
1561
|
panelTerminal = tui.terminal;
|
|
1520
1562
|
let component;
|
|
1521
1563
|
// Beside the chat: the chat drawn narrower, on the left, and a click on either side giving it the keys - undone
|
|
@@ -1548,10 +1590,11 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1548
1590
|
// Beside the chat, back to it: the chat has the keys, the panel stays.
|
|
1549
1591
|
const toChat = () => {
|
|
1550
1592
|
entry.keys = false;
|
|
1551
|
-
|
|
1593
|
+
giveBack();
|
|
1552
1594
|
tui.requestRender();
|
|
1553
1595
|
};
|
|
1554
1596
|
const toPanel = () => {
|
|
1597
|
+
keepChatFocus();
|
|
1555
1598
|
entry.keys = true;
|
|
1556
1599
|
entry.handle?.focus();
|
|
1557
1600
|
tui.requestRender();
|
|
@@ -1604,7 +1647,7 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1604
1647
|
return focused !== null && focused !== component;
|
|
1605
1648
|
},
|
|
1606
1649
|
});
|
|
1607
|
-
const entry = { view, close, keys: true };
|
|
1650
|
+
const entry = { view, close, keepChatFocus, keys: true };
|
|
1608
1651
|
panel = entry;
|
|
1609
1652
|
layOut();
|
|
1610
1653
|
// Every key goes to the panel while it shows, whatever has the focus: a question the chat model asks in the
|
|
@@ -2007,6 +2050,7 @@ function registerDeploy(pi, cwd, jobs, state) {
|
|
|
2007
2050
|
cwd,
|
|
2008
2051
|
state,
|
|
2009
2052
|
jobs,
|
|
2053
|
+
workLoop: () => workLoops.get(jobs)?.loop,
|
|
2010
2054
|
defaultPlainFile: () => readProjectConfig(cwd).module,
|
|
2011
2055
|
});
|
|
2012
2056
|
for (const tool of tools)
|
package/dist/genome.js
CHANGED
|
@@ -185,7 +185,7 @@ export async function runSkill(opts) {
|
|
|
185
185
|
// Built renders were lost with the process; queue what the specs hold that is not built.
|
|
186
186
|
if (resumed !== undefined && opts.renderQueue !== undefined) {
|
|
187
187
|
for (const file of plainFilesIn(opts.cwd))
|
|
188
|
-
void opts.renderQueue.bringUp(file).catch(() => undefined);
|
|
188
|
+
void opts.renderQueue.bringUp(file, { specChange: true }).catch(() => undefined);
|
|
189
189
|
}
|
|
190
190
|
if (liveStep !== undefined && liveProxy !== undefined) {
|
|
191
191
|
const continuous = liveStep.gate.continuous;
|
package/dist/loop-tools.js
CHANGED
|
@@ -70,7 +70,11 @@ export async function loopReply(loop, statuses, wait) {
|
|
|
70
70
|
return { content: [{ type: "text", text }], details: { jobIds } };
|
|
71
71
|
}
|
|
72
72
|
/** Halt a pulse by its id, or the start of it: what it was, and what moves up behind it. `reason`: why, kept with it. */
|
|
73
|
-
export function stopJob(jobs, named, reason) {
|
|
73
|
+
export function stopJob(jobs, named, reason, loop) {
|
|
74
|
+
// A planned row, or a module by its name: the module is halted - its rows are planned again from the spec each look.
|
|
75
|
+
const module = /^planned-/.test(named.trim()) || !jobs.list().some((job) => job.id.startsWith(named.trim())) ? loop?.halt(named, reason) : undefined;
|
|
76
|
+
if (module !== undefined)
|
|
77
|
+
return module;
|
|
74
78
|
const matches = jobs.list().filter((job) => job.id.startsWith(named.trim()));
|
|
75
79
|
if (matches.length === 0)
|
|
76
80
|
return `No pulse ${named}. /pulses shows them.`;
|
|
@@ -188,7 +192,7 @@ export function driftTool(options) {
|
|
|
188
192
|
}
|
|
189
193
|
const ACTIVATED_PARAM = Type.Optional(Type.String({ description: 'What activate started, by name - or "all" for every one' }));
|
|
190
194
|
const HALT_PULSE_PARAMS = Type.Object({
|
|
191
|
-
job_id: Type.Optional(Type.String({ description: "The pulse's id, or the start of it" })),
|
|
195
|
+
job_id: Type.Optional(Type.String({ description: "The pulse's id, or the start of it; a planned row's id (planned-<module>-...), or a module's name, halts the module" })),
|
|
192
196
|
reason: Type.Optional(Type.String({ description: "Why it is halted, kept with it - what the spec now says that it did not, say" })),
|
|
193
197
|
activated: ACTIVATED_PARAM,
|
|
194
198
|
});
|
|
@@ -201,12 +205,21 @@ export function haltTool(options) {
|
|
|
201
205
|
name: "halt",
|
|
202
206
|
label: "Halt",
|
|
203
207
|
description: jobs !== undefined
|
|
204
|
-
? "Halt a pulse, or what activate started. A pulse: a queued one never starts, a running one has its
|
|
205
|
-
"and the pulses queued behind it move up - what a running pulse already changed is rolled back, and what
|
|
206
|
-
"counts as not regenerated.
|
|
208
|
+
? "Halt a pulse, a module's planned pulses, or what activate started. A pulse: a queued one never starts, a running one has its " +
|
|
209
|
+
"agent stopped at once, and the pulses queued behind it move up - what a running pulse already changed is rolled back, and what " +
|
|
210
|
+
"it was regenerating counts as not regenerated. A planned row (planned-<module>-...) or a module's name halts the module: its " +
|
|
211
|
+
"running pulse stopped, none of its planned pulses started, and the modules built on it waiting - until it is asked for again " +
|
|
212
|
+
"with regenerate; a spec change does not start it. A module whose .plain file is gone is dropped. What activate started: the " +
|
|
213
|
+
"one named, or every one."
|
|
207
214
|
: "Stop what activate started: the one named, or every one.",
|
|
208
215
|
promptSnippet: jobs !== undefined ? "halt a pulse, or what activate started" : "stop a deployed server, or all of them",
|
|
209
|
-
promptGuidelines: jobs !== undefined
|
|
216
|
+
promptGuidelines: jobs !== undefined
|
|
217
|
+
? [
|
|
218
|
+
"Halt a pulse only when the user asks, or your instructions say to. Name which one, and say which pulses were queued behind it - they will now run.",
|
|
219
|
+
"Halting a planned row halts its whole module - one planned pulse cannot be taken out alone, as the plan is made again from the spec. To build some of it later, or cut it differently, use steer; to drop work, change the spec.",
|
|
220
|
+
"A planned row for a module that is no longer in the project is halted the same way, and dropped.",
|
|
221
|
+
]
|
|
222
|
+
: [],
|
|
210
223
|
parameters: (jobs !== undefined ? HALT_PULSE_PARAMS : HALT_ACTIVATED_PARAMS),
|
|
211
224
|
async execute(_id, params) {
|
|
212
225
|
if (params.job_id === undefined && params.activated === undefined) {
|
|
@@ -214,7 +227,7 @@ export function haltTool(options) {
|
|
|
214
227
|
}
|
|
215
228
|
const lines = [];
|
|
216
229
|
if (params.job_id !== undefined && jobs !== undefined)
|
|
217
|
-
lines.push(stopJob(jobs, params.job_id, params.reason));
|
|
230
|
+
lines.push(stopJob(jobs, params.job_id, params.reason, options.workLoop?.()));
|
|
218
231
|
if (params.activated !== undefined) {
|
|
219
232
|
const stopped = await stopDeployed(params.activated === "all" ? {} : { name: params.activated });
|
|
220
233
|
lines.push(stopped.length > 0 ? `Halted ${stopped.join(", ")}.` : `Nothing activate started is running${params.activated === "all" ? "" : ` as ${params.activated}`}.`);
|
package/dist/pi-launch.js
CHANGED
|
@@ -11,6 +11,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
11
11
|
import { main, SettingsManager } from "@earendil-works/pi-coding-agent";
|
|
12
12
|
import { ProcessTerminal } from "@earendil-works/pi-tui";
|
|
13
13
|
import "./terminal-images.js";
|
|
14
|
+
import { resumeLine } from "./resume-line.js";
|
|
14
15
|
/**
|
|
15
16
|
* pi, started the way its own CLI starts it, for `turri`.
|
|
16
17
|
*
|
|
@@ -31,6 +32,10 @@ const setTitle = ProcessTerminal.prototype.setTitle;
|
|
|
31
32
|
ProcessTerminal.prototype.setTitle = function (title) {
|
|
32
33
|
setTitle.call(this, title.replace(/^π(?= |$)/, "🪼 turri"));
|
|
33
34
|
};
|
|
35
|
+
// What pi prints on the way out to resume the session names pi - its APP_NAME, a constant - which may not be on the
|
|
36
|
+
// PATH at all: turri takes the same flags, so it is turri the line names.
|
|
37
|
+
const write = process.stdout.write.bind(process.stdout);
|
|
38
|
+
process.stdout.write = ((chunk, ...rest) => write(typeof chunk === "string" ? resumeLine(chunk) : chunk, ...rest));
|
|
34
39
|
// pi's own keys stand: a new line is shift+enter or ctrl+j. turri's side panel is on ctrl+h (job-panel.ts PANEL_KEY).
|
|
35
40
|
// What pi's CLI does before main: the process title, pi's environment markers, the HTTP
|
|
36
41
|
// dispatcher. Not exported, so loaded from the file - beside pi's entry point, wherever npm put it.
|
package/dist/question-dialog.js
CHANGED
|
@@ -25,6 +25,7 @@ export class QuestionDialog {
|
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
this.input = undefined;
|
|
28
|
+
this.selected = Math.min(Math.max(0, options.selected ?? 0), options.options.length - 1);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
get focused() {
|
|
@@ -58,18 +59,23 @@ export class QuestionDialog {
|
|
|
58
59
|
const choices = this.options.options ?? [];
|
|
59
60
|
const body = this.input !== undefined
|
|
60
61
|
? this.input.render(inner)
|
|
61
|
-
:
|
|
62
|
+
: // A long option wraps, its lines under its first, rather than cut off where the person cannot read it.
|
|
63
|
+
choices.flatMap((choice, index) => wrapTextWithAnsi(choice, Math.max(1, inner - 2)).map((line, at) => {
|
|
64
|
+
const shown = `${at === 0 && index === this.selected ? "›" : " "} ${line}`;
|
|
65
|
+
return index === this.selected ? style.accent(shown) : shown;
|
|
66
|
+
}));
|
|
62
67
|
const hint = this.input !== undefined
|
|
63
68
|
? "enter answers · esc dismisses"
|
|
64
69
|
: "↑↓ choose · enter picks · esc dismisses";
|
|
65
70
|
// The brief gets what the question, the options and the hints leave of the screen.
|
|
66
|
-
const fixed = question.length + body.length +
|
|
71
|
+
const fixed = question.length + body.length + 5;
|
|
67
72
|
const room = Math.max(3, this.options.rows() - KEPT_ABOVE - fixed);
|
|
68
73
|
const scrolls = brief.length > room;
|
|
69
74
|
this.window = scrolls ? room - 1 : brief.length;
|
|
70
75
|
this.maxScroll = scrolls ? brief.length - this.window : 0;
|
|
71
76
|
this.scroll = Math.min(this.scroll, this.maxScroll);
|
|
72
|
-
|
|
77
|
+
// Set apart from what is drawn above it - the job panel's hints.
|
|
78
|
+
const lines = [""];
|
|
73
79
|
if (brief.length > 0) {
|
|
74
80
|
lines.push(...brief.slice(this.scroll, this.scroll + this.window).map(pad));
|
|
75
81
|
if (scrolls) {
|
package/dist/questioning.js
CHANGED
|
@@ -43,7 +43,7 @@ export function questioningQuestion(phases) {
|
|
|
43
43
|
return {
|
|
44
44
|
question: `How many questions should I ask you in ${named}?`,
|
|
45
45
|
options: QUESTIONING_LEVELS.map((level) => level.option),
|
|
46
|
-
context: `Light, medium and thorough cap each of ${named} at 3, 5 and 10 questions - broader with fewer, so every level ` +
|
|
46
|
+
context: `Light, medium and thorough cap ${phases.length === 1 ? named : `each of ${named}`} at 3, 5 and 10 questions - broader with fewer, so every level ` +
|
|
47
47
|
"covers the same ground, only in less or more depth. What the questions leave open, turri decides itself and " +
|
|
48
48
|
"says what it chose. With best judgement, turri asks as much as it judges each phase needs. Each phase still " +
|
|
49
49
|
"ends with your confirmation of its summary.",
|
|
@@ -183,6 +183,8 @@ export function describeToolCall(name, args) {
|
|
|
183
183
|
return `± my_diff`;
|
|
184
184
|
case "update_notes":
|
|
185
185
|
return `✐ update_notes`;
|
|
186
|
+
case "report_spec_gap":
|
|
187
|
+
return `? spec gap: ${text("question") ?? ""}`.trimEnd();
|
|
186
188
|
case "copy_resource":
|
|
187
189
|
return `⎘ copy_resource ${path ?? text("to") ?? ""}`.trimEnd();
|
|
188
190
|
case "can_it_fail":
|
|
@@ -7,7 +7,7 @@ import { abandonWork, startWork } from "./lineage.js";
|
|
|
7
7
|
import { ensureRegressionPasses } from "./regression.js";
|
|
8
8
|
import { modulesRoot, projectDirOf } from "./paths.js";
|
|
9
9
|
import { applySpecDiff, snapshotSpec, specGapsText } from "./regenerate.js";
|
|
10
|
-
import {
|
|
10
|
+
import { gapMark, gapsSince } from "./notes.js";
|
|
11
11
|
import { sectionsOf } from "./state.js";
|
|
12
12
|
import { describeStop } from "./stop-report.js";
|
|
13
13
|
import { missingTestLabels } from "./test-kinds.js";
|
|
@@ -41,8 +41,8 @@ export async function renderSpecDiffConformance(options) {
|
|
|
41
41
|
// state, not to what an interrupted run left half-written. The tests and the whole suite are
|
|
42
42
|
// one unit, landed whole or undone whole.
|
|
43
43
|
const unit = startWork([buildDir, conformanceDir], moduleName);
|
|
44
|
-
// The
|
|
45
|
-
const
|
|
44
|
+
// The spec gaps its agents report from here on are told with the result.
|
|
45
|
+
const gapsFrom = gapMark();
|
|
46
46
|
const conformance = await renderConformanceTests({
|
|
47
47
|
plainFile: tip.plainFile,
|
|
48
48
|
frid: lastFrid,
|
|
@@ -58,8 +58,8 @@ export async function renderSpecDiffConformance(options) {
|
|
|
58
58
|
});
|
|
59
59
|
// What the codebase now has conformance tests for, as their labels say.
|
|
60
60
|
const tested = () => frids.filter((frid) => missingTestLabels(conformanceDir, frid, []).length === 0);
|
|
61
|
-
//
|
|
62
|
-
const base = { moduleName, buildDir, conformanceDir, diff: applied, conformance, specGaps:
|
|
61
|
+
// A gap is the person's to decide, whether the tests passed or not.
|
|
62
|
+
const base = { moduleName, buildDir, conformanceDir, diff: applied, conformance, specGaps: gapsSince(gapsFrom, [buildDir, conformanceDir]) };
|
|
63
63
|
if (!conformance.passed) {
|
|
64
64
|
abandonWork(unit, moduleName, notLandedWhy("for the spec change", conformance.unlabelled));
|
|
65
65
|
return { ...base, tested: tested(), passed: false, stoppedAt: "conformance" };
|
|
@@ -7,7 +7,7 @@ import { confinedTools } from "./confine.js";
|
|
|
7
7
|
import { ensureInModulesScratch, modulesScratchDir } from "./paths.js";
|
|
8
8
|
import { workspaceBlock } from "./workspace.js";
|
|
9
9
|
import { reportActivity } from "./activity.js";
|
|
10
|
-
import { runTiming } from "./test-scripts.js";
|
|
10
|
+
import { runTiming, withTestingScripts } from "./test-scripts.js";
|
|
11
11
|
import { createWebTools, WEB_TOOLS } from "./web.js";
|
|
12
12
|
import { diffFiles, digestFiles } from "./codebase.js";
|
|
13
13
|
import { ERROR_CAUSE_RULES, fixMethod, INTEGRITY_RULES, specPrimer } from "./prompt.js";
|
|
@@ -378,9 +378,17 @@ export function explorePrompt(buildDir, spec, scope, testingScripts, question, p
|
|
|
378
378
|
...(testingScripts !== undefined && testingScripts.length > 0
|
|
379
379
|
? [
|
|
380
380
|
"",
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
...(testingScripts.some((script) => script.prepare === true)
|
|
382
|
+
? [
|
|
383
|
+
"These are the project's prepare script, which the harness runs on the build first, and its conformance testing",
|
|
384
|
+
"script, which runs only once the prepare script passes and decides whether the tests pass - read both for what",
|
|
385
|
+
"they build or install before the tests run, and so what the tests can depend on:",
|
|
386
|
+
]
|
|
387
|
+
: [
|
|
388
|
+
"This is the project's conformance testing script, which the harness runs to decide whether the",
|
|
389
|
+
"tests pass - read it for what it builds or installs before the tests run, and so what the tests can depend on:",
|
|
390
|
+
]),
|
|
391
|
+
...testingScripts.flatMap((script) => ["", `<script${script.prepare === true ? ' kind="prepare environment"' : ""} path="${script.path}" run-as="${script.runs}">`, script.content.trimEnd(), "</script>"]),
|
|
384
392
|
]
|
|
385
393
|
: []),
|
|
386
394
|
...(previous !== undefined && question === undefined
|
|
@@ -704,7 +712,7 @@ export function unfoundedEvidence(evidence, opened) {
|
|
|
704
712
|
"opened, the testing script, or the failing run - each with where. What <how to invoke it> says is not evidence: it " +
|
|
705
713
|
"may be wrong, so check it against the testing script and the files.");
|
|
706
714
|
}
|
|
707
|
-
const inPrompt = (source) => /^(the )?(conformance )?testing script$|^(the )?failing run$/i.test(source.trim());
|
|
715
|
+
const inPrompt = (source) => /^(the )?(conformance )?testing script$|^(the )?prepare script$|^(the )?failing run$/i.test(source.trim());
|
|
708
716
|
const unread = given.filter((item) => !inPrompt(item.source) && !opened(item.source.trim()));
|
|
709
717
|
if (unread.length > 0) {
|
|
710
718
|
return (`Your evidence cites ${unread.map((item) => item.source.trim()).join(", ")}, which you did not open. Open each file you cite ` +
|
|
@@ -735,7 +743,7 @@ export async function judgeFailure(options) {
|
|
|
735
743
|
description: "For code: the conformance testing script's own words for what it needs the build to have - the file, entry point or module the run failed on - copied exactly from the script",
|
|
736
744
|
})),
|
|
737
745
|
evidence: Type.Optional(Type.Array(Type.Object({
|
|
738
|
-
source: Type.String({ description: "Where: the path of a file you opened, `testing script`, or `failing run`" }),
|
|
746
|
+
source: Type.String({ description: "Where: the path of a file you opened, `testing script`, `prepare script` where there is one, or `failing run`" }),
|
|
739
747
|
shows: Type.String({ description: "What it shows, e.g. `the script runs node dist/cli.js` or `tsconfig.json emits src/cli.ts as dist/src/cli.js`" }),
|
|
740
748
|
}), { description: "What you found yourself, each with where - never what <how to invoke it> claims unchecked" })),
|
|
741
749
|
functionalities: Type.Optional(Type.Array(Type.Object({
|
|
@@ -900,6 +908,12 @@ export function judgePrompt(options) {
|
|
|
900
908
|
"what is wrong. What it does with the tests, the tests have to fit; what it needs of the code - a file it runs or",
|
|
901
909
|
"checks for, a command it builds with - the code has to provide. A verdict that the script is wrong is neither",
|
|
902
910
|
"code nor tests: say which of the two has to change to get past it.",
|
|
911
|
+
...(scripts.some((script) => script.prepare === true)
|
|
912
|
+
? [
|
|
913
|
+
"The prepare script below it runs on the build before every run, and the conformance testing script only once it",
|
|
914
|
+
"passes: it binds the same way - neither agent can change it, and what it needs of the code the code provides.",
|
|
915
|
+
]
|
|
916
|
+
: []),
|
|
903
917
|
"",
|
|
904
918
|
]
|
|
905
919
|
: []),
|
|
@@ -929,7 +943,10 @@ export function judgePrompt(options) {
|
|
|
929
943
|
"",
|
|
930
944
|
`<how to invoke it>\n${options.invocation.trim()}\n</how to invoke it>`,
|
|
931
945
|
"",
|
|
932
|
-
...scripts.flatMap((script) =>
|
|
946
|
+
...scripts.flatMap((script) => {
|
|
947
|
+
const tag = script.prepare === true ? "prepare script" : "conformance testing script";
|
|
948
|
+
return [`<${tag} path="${script.path}" run-as="${script.runs}">`, script.content.trimEnd(), `</${tag}>`, ""];
|
|
949
|
+
}),
|
|
933
950
|
...(options.run.timedOut === true ? [...timedOutBlock(options.run), ""] : []),
|
|
934
951
|
`<failing run exit="${options.run.exitCode}" command="${options.run.command}">`,
|
|
935
952
|
runTiming(options.run),
|
|
@@ -1004,7 +1021,10 @@ export async function createCodeFixer(options) {
|
|
|
1004
1021
|
model: options.model,
|
|
1005
1022
|
label: `${options.label} coding agent`, role: "coding",
|
|
1006
1023
|
system: `${fence.note}\n\n${workspaceBlock({ dir: options.buildDir, hasMyDiff: options.toolNames.includes("my_diff") })}`,
|
|
1007
|
-
|
|
1024
|
+
// What the conformance testing script needs of the build, the code provides: the fixer reads it, not only a judge's quote of it.
|
|
1025
|
+
task: options.testingScripts !== undefined
|
|
1026
|
+
? withTestingScripts(codeFixerTask(options), options.testingScripts.scripts, ["conformance", "unit"], options.testingScripts.root)
|
|
1027
|
+
: codeFixerTask(options),
|
|
1008
1028
|
compaction: { instructions: CODER_COMPACTION },
|
|
1009
1029
|
...(options.checkEnvironment !== undefined ? { checkEnvironment: options.checkEnvironment } : {}),
|
|
1010
1030
|
});
|