@turri-dev/cli 0.2.3-next.fea0bd9 → 0.2.4-next.009bd0c
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 +57 -62
- package/dist/bedrock-region.js +3 -3
- package/dist/chat-idle.d.ts +2 -2
- package/dist/chat-idle.js +2 -2
- package/dist/chat-models.d.ts +1 -1
- package/dist/chat-models.js +1 -1
- package/dist/chat-scope.d.ts +1 -3
- package/dist/chat-skills.d.ts +1 -1
- package/dist/chat-skills.js +1 -1
- package/dist/chats.d.ts +44 -20
- package/dist/chats.js +125 -64
- package/dist/cli.js +42 -31
- package/dist/config-edit.d.ts +20 -8
- package/dist/config-edit.js +32 -26
- package/dist/config.d.ts +106 -78
- package/dist/config.js +267 -133
- package/dist/conform-cli.js +14 -3
- package/dist/conformance-switch.d.ts +13 -22
- package/dist/conformance-switch.js +37 -59
- package/dist/drift-cli.js +1 -1
- package/dist/extension.d.ts +31 -12
- package/dist/extension.js +555 -556
- package/dist/genome.js +10 -49
- package/dist/graph.js +3 -5
- package/dist/host-session.d.ts +11 -21
- package/dist/host-session.js +6 -8
- package/dist/host.d.ts +4 -4
- package/dist/host.js +4 -7
- package/dist/identity.js +2 -3
- package/dist/init-config.d.ts +1 -2
- package/dist/init-config.js +10 -17
- package/dist/installed-providers.d.ts +1 -1
- package/dist/installed-providers.js +2 -2
- package/dist/launch-agent.d.ts +41 -0
- package/dist/launch-agent.js +219 -0
- package/dist/{release-cli.js → launch-cli.js} +41 -24
- package/dist/launch-session.d.ts +58 -0
- package/dist/launch-session.js +195 -0
- package/dist/launch-tools.d.ts +28 -0
- package/dist/launch-tools.js +69 -0
- package/dist/launch-track.d.ts +120 -0
- package/dist/launch-track.js +298 -0
- package/dist/loop-cli.d.ts +4 -3
- package/dist/loop-cli.js +17 -15
- package/dist/loop-tools.d.ts +45 -21
- package/dist/loop-tools.js +155 -90
- package/dist/new-project.js +2 -2
- package/dist/notice.d.ts +7 -6
- package/dist/parse-cli.js +2 -2
- package/dist/pi-launch.js +4 -1
- package/dist/pi-settings.d.ts +4 -0
- package/dist/pi-settings.js +39 -0
- package/dist/pi.js +12 -9
- package/dist/plain/check.d.ts +2 -9
- package/dist/plain/check.js +6 -39
- package/dist/plain-files.d.ts +2 -2
- package/dist/plain-files.js +7 -7
- package/dist/regenerate/activity.d.ts +0 -7
- package/dist/regenerate/activity.js +2 -20
- package/dist/regenerate/agent-env.d.ts +1 -1
- package/dist/regenerate/agent-env.js +3 -3
- package/dist/regenerate/agent-shell.js +5 -3
- package/dist/regenerate/audit.js +9 -0
- package/dist/regenerate/base-folder.d.ts +2 -2
- package/dist/regenerate/base-folder.js +1 -1
- package/dist/regenerate/cases.js +7 -0
- package/dist/regenerate/chunk-plan.d.ts +5 -0
- package/dist/regenerate/chunk-plan.js +16 -1
- package/dist/regenerate/command-check.d.ts +1 -1
- package/dist/regenerate/command-check.js +1 -1
- package/dist/regenerate/delivery.d.ts +1 -1
- package/dist/regenerate/delivery.js +3 -3
- package/dist/regenerate/drift.d.ts +4 -0
- package/dist/regenerate/drift.js +26 -6
- package/dist/regenerate/failure-reports.d.ts +28 -0
- package/dist/regenerate/failure-reports.js +79 -0
- package/dist/regenerate/job-panel.js +3 -1
- package/dist/regenerate/jobs-tree.js +1 -1
- package/dist/regenerate/jobs.d.ts +4 -2
- package/dist/regenerate/jobs.js +14 -10
- package/dist/regenerate/launch.d.ts +126 -0
- package/dist/regenerate/{release.js → launch.js} +60 -48
- package/dist/regenerate/ledger-view.d.ts +11 -24
- package/dist/regenerate/ledger-view.js +14 -60
- package/dist/regenerate/ledger.d.ts +26 -16
- package/dist/regenerate/ledger.js +1 -1
- package/dist/regenerate/lineage.d.ts +2 -0
- package/dist/regenerate/lineage.js +8 -0
- package/dist/regenerate/loop.d.ts +57 -65
- package/dist/regenerate/loop.js +354 -171
- package/dist/regenerate/model-names.d.ts +33 -0
- package/dist/regenerate/{engine.js → model-names.js} +2 -28
- package/dist/regenerate/paths.d.ts +3 -3
- package/dist/regenerate/paths.js +4 -4
- package/dist/regenerate/records.d.ts +11 -0
- package/dist/regenerate/records.js +15 -0
- package/dist/regenerate/regenerate.d.ts +0 -2
- package/dist/regenerate/regenerate.js +4 -15
- package/dist/regenerate/renames.js +4 -4
- package/dist/regenerate/requires.d.ts +7 -0
- package/dist/regenerate/requires.js +24 -18
- package/dist/regenerate/scripts-being-written.d.ts +4 -4
- package/dist/regenerate/scripts-being-written.js +3 -3
- package/dist/regenerate/spec-map.js +3 -3
- package/dist/regenerate/standing.js +1 -1
- package/dist/regenerate/submit-work.d.ts +2 -0
- package/dist/regenerate/submit-work.js +8 -3
- package/dist/regenerate/test-scripts.d.ts +2 -1
- package/dist/regenerate/test-scripts.js +33 -23
- package/dist/regenerate/testing-steps.d.ts +16 -5
- package/dist/regenerate/testing-steps.js +28 -9
- package/dist/regenerate-cli.js +18 -9
- package/dist/self-invocation.d.ts +11 -0
- package/dist/self-invocation.js +37 -11
- package/dist/sentinel-check.d.ts +3 -3
- package/dist/sentinel-check.js +3 -3
- package/dist/sentinel.d.ts +17 -12
- package/dist/sentinel.js +75 -46
- package/dist/{config-command.d.ts → settings.d.ts} +13 -8
- package/dist/{config-command.js → settings.js} +155 -24
- package/dist/setup.d.ts +2 -2
- package/dist/setup.js +7 -7
- package/dist/skill.d.ts +0 -11
- package/dist/skill.js +0 -9
- package/dist/tools.js +2 -3
- package/dist/turri-versions.js +2 -1
- package/docs/README.md +4 -6
- package/docs/authoring-plain.md +3 -3
- package/docs/chats.md +6 -9
- package/docs/claude-subscription.md +8 -8
- package/docs/config.md +62 -52
- package/docs/development.md +4 -5
- package/docs/headless.md +7 -6
- package/docs/hosting.md +25 -24
- package/docs/installation.md +4 -0
- package/docs/launch.md +63 -0
- package/docs/parser.md +3 -3
- package/docs/regenerating.md +30 -22
- package/docs/sandbox.md +3 -3
- package/docs/sentinel.md +27 -16
- package/docs/skills-and-gates.md +6 -11
- package/docs/using.md +26 -42
- package/genome/rules/project-model.md +2 -1
- package/genome/rules/test-plain-files.md +15 -7
- package/genome/rules/turri-regeneration.md +7 -10
- package/genome/skills/convert-old-syntax/SKILL.md +5 -5
- package/genome/skills/implement-conformance-testing-script/SKILL.md +2 -2
- package/genome/skills/implement-unit-testing-script/SKILL.md +3 -3
- package/package.json +1 -1
- package/dist/advisor-chat.d.ts +0 -63
- package/dist/advisor-chat.js +0 -290
- package/dist/change-plain-cli.js +0 -55
- package/dist/ledger-cli.d.ts +0 -1
- package/dist/ledger-cli.js +0 -50
- package/dist/ledger-tools.d.ts +0 -10
- package/dist/ledger-tools.js +0 -64
- package/dist/regenerate/advisor-records.d.ts +0 -93
- package/dist/regenerate/advisor-records.js +0 -110
- package/dist/regenerate/advisor-runs.d.ts +0 -87
- package/dist/regenerate/advisor-runs.js +0 -327
- package/dist/regenerate/engine.d.ts +0 -52
- package/dist/regenerate/release.d.ts +0 -121
- package/dist/regenerate/test-advisor.d.ts +0 -101
- package/dist/regenerate/test-advisor.js +0 -379
- package/dist/release-agent.d.ts +0 -43
- package/dist/release-agent.js +0 -130
- package/dist/release-cli.d.ts +0 -1
- package/dist/release-tools.d.ts +0 -44
- package/dist/release-tools.js +0 -170
- package/dist/spec-tools.d.ts +0 -36
- package/dist/spec-tools.js +0 -128
- package/dist/stacks.d.ts +0 -13
- package/dist/stacks.js +0 -96
- package/docs/deploy.md +0 -48
- package/docs/test-advisor.md +0 -110
- /package/dist/{change-plain-cli.d.ts → launch-cli.d.ts} +0 -0
|
@@ -3,7 +3,7 @@ import { type Job } from "./jobs.ts";
|
|
|
3
3
|
import { type LedgerEntry } from "./ledger.ts";
|
|
4
4
|
/**
|
|
5
5
|
* What the ledger says of pulses, read back: one pulse - from this session or an earlier one - as the chat and
|
|
6
|
-
*
|
|
6
|
+
* a host are told it, and the runs a project has had, each with its pulses.
|
|
7
7
|
*/
|
|
8
8
|
type Of<K extends LedgerEntry["kind"]> = Extract<LedgerEntry, {
|
|
9
9
|
kind: K;
|
|
@@ -48,14 +48,20 @@ export interface PulseView {
|
|
|
48
48
|
/** A pulse's events, gathered: undefined when the ledger has none of it. `entries` are its run's, oldest first. */
|
|
49
49
|
export declare function pulseView(id: string, entries: LedgerEntry[]): PulseView | undefined;
|
|
50
50
|
/**
|
|
51
|
-
* A pulse from the ledger, for the chat
|
|
51
|
+
* A pulse from the ledger, for the chat's `pulses`: what happened in it, as facts - and, last, the
|
|
52
52
|
* ***plain diff it regenerated, unless `diff` is false.
|
|
53
53
|
*/
|
|
54
54
|
export declare function describePulseView(view: PulseView, options?: {
|
|
55
55
|
diff?: boolean;
|
|
56
56
|
}): string;
|
|
57
|
-
/**
|
|
58
|
-
|
|
57
|
+
/**
|
|
58
|
+
* A pulse the ledger of any of these projects knows, described - or undefined. With `report` (the default), why one
|
|
59
|
+
* that did not land did not, as kept when it ended; without, the ledger's facts alone - for a pulse of this session,
|
|
60
|
+
* whose transcript says why.
|
|
61
|
+
*/
|
|
62
|
+
export declare function describePastPulse(projects: string[], id: string, options?: {
|
|
63
|
+
report?: boolean;
|
|
64
|
+
}): string | undefined;
|
|
59
65
|
/** A run of the project's, and its pulses: runs and pulses the most recent first. */
|
|
60
66
|
export interface RunView {
|
|
61
67
|
run: string;
|
|
@@ -64,7 +70,7 @@ export interface RunView {
|
|
|
64
70
|
pulses: PulseView[];
|
|
65
71
|
}
|
|
66
72
|
export declare function runViews(project: string): RunView[];
|
|
67
|
-
/** The project's last runs, a line a pulse: what `
|
|
73
|
+
/** The project's last runs, a line a pulse: what `pulses` lists of earlier sessions. */
|
|
68
74
|
export declare function describeRuns(runs: RunView[]): string;
|
|
69
75
|
/**
|
|
70
76
|
* The pulses of earlier sessions, for a list beside this session's: the last `runs` runs of these projects that are not
|
|
@@ -78,23 +84,4 @@ export declare function earlierPulses(projects: string[], known: Set<string>, ru
|
|
|
78
84
|
};
|
|
79
85
|
/** A pulse of the ledger's, as the lists show a job: finished as it ended, its time and cost - and nothing to run. */
|
|
80
86
|
export declare function asJob(view: PulseView): Job;
|
|
81
|
-
/** What to count in the ledger: kinds - whole, or a group by what comes before the dot - a module, since when. */
|
|
82
|
-
export interface EventQuery {
|
|
83
|
-
/** `healer.failed`, or `healer` for every healer event. */
|
|
84
|
-
kinds?: string[];
|
|
85
|
-
module?: string;
|
|
86
|
-
/** Only events at or after this time. */
|
|
87
|
-
since?: Date;
|
|
88
|
-
/** How many of the most recent to list, a line each. */
|
|
89
|
-
limit?: number;
|
|
90
|
-
}
|
|
91
|
-
/** One event in a line: when, its pulse and module, its kind, its own fields - the agent's role when it has one. */
|
|
92
|
-
export declare function eventLine(entry: LedgerEntry): string;
|
|
93
|
-
/**
|
|
94
|
-
* The events of these projects' ledgers that `query` asks for: how many of each kind, and the most recent, a line each -
|
|
95
|
-
* or, when no kind asked for is in the ledger, the kinds it has.
|
|
96
|
-
*/
|
|
97
|
-
export declare function describeEvents(projects: string[], query?: EventQuery): string;
|
|
98
|
-
/** `24h`, `7d`, `30m`, or a date and time: the moment it means, or undefined when it means none. */
|
|
99
|
-
export declare function sinceOf(text: string, now?: number): Date | undefined;
|
|
100
87
|
export {};
|
|
@@ -3,6 +3,7 @@ import { join, resolve } from "node:path";
|
|
|
3
3
|
import { describeUsage } from "./activity.js";
|
|
4
4
|
import { formatElapsed } from "./jobs.js";
|
|
5
5
|
import { LEDGER_DIR, ledgerRun, readLedger } from "./ledger.js";
|
|
6
|
+
import { failureReport } from "./failure-reports.js";
|
|
6
7
|
/** The projects whose ledgers a folder's pulses may be in: its own, and those of the projects in folders under it. */
|
|
7
8
|
export function ledgerProjects(cwd, depth = 3) {
|
|
8
9
|
const found = [];
|
|
@@ -149,7 +150,7 @@ function outcomeOf(view) {
|
|
|
149
150
|
return `${finished.status}${stopped}${landed}, after ${formatElapsed(finished.ms)}`;
|
|
150
151
|
}
|
|
151
152
|
/**
|
|
152
|
-
* A pulse from the ledger, for the chat
|
|
153
|
+
* A pulse from the ledger, for the chat's `pulses`: what happened in it, as facts - and, last, the
|
|
153
154
|
* ***plain diff it regenerated, unless `diff` is false.
|
|
154
155
|
*/
|
|
155
156
|
export function describePulseView(view, options = {}) {
|
|
@@ -224,13 +225,20 @@ export function describePulseView(view, options = {}) {
|
|
|
224
225
|
lines.push(` its ***plain diff${view.steered > 0 ? ", as last steered" : ""}:`, ...view.diff.diff.trimEnd().split("\n").map((line) => ` ${line}`));
|
|
225
226
|
return lines.join("\n");
|
|
226
227
|
}
|
|
227
|
-
/**
|
|
228
|
-
|
|
228
|
+
/**
|
|
229
|
+
* A pulse the ledger of any of these projects knows, described - or undefined. With `report` (the default), why one
|
|
230
|
+
* that did not land did not, as kept when it ended; without, the ledger's facts alone - for a pulse of this session,
|
|
231
|
+
* whose transcript says why.
|
|
232
|
+
*/
|
|
233
|
+
export function describePastPulse(projects, id, options = {}) {
|
|
229
234
|
for (const project of projects) {
|
|
230
235
|
const entries = readLedger(project);
|
|
231
236
|
const view = pulseView(id, entries);
|
|
232
|
-
if (view
|
|
233
|
-
|
|
237
|
+
if (view === undefined)
|
|
238
|
+
continue;
|
|
239
|
+
// Why one that did not land did not, as it was kept when it ended - what the ledger cannot hold.
|
|
240
|
+
const report = options.report === false ? undefined : failureReport(project, view.id);
|
|
241
|
+
return report !== undefined ? `${describePulseView(view)}\n\nWhy it did not land, as kept when it ended:\n${report}` : describePulseView(view);
|
|
234
242
|
}
|
|
235
243
|
return undefined;
|
|
236
244
|
}
|
|
@@ -249,7 +257,7 @@ export function runViews(project) {
|
|
|
249
257
|
})
|
|
250
258
|
.reverse();
|
|
251
259
|
}
|
|
252
|
-
/** The project's last runs, a line a pulse: what `
|
|
260
|
+
/** The project's last runs, a line a pulse: what `pulses` lists of earlier sessions. */
|
|
253
261
|
export function describeRuns(runs) {
|
|
254
262
|
if (runs.length === 0)
|
|
255
263
|
return "The ledger is empty: nothing has run here since it began.";
|
|
@@ -315,57 +323,3 @@ export function asJob(view) {
|
|
|
315
323
|
earlier: { run: view.run, ...(view.runMode !== undefined ? { runMode: view.runMode } : {}), lines: describePulseView(view, { diff: false }).split("\n").slice(1).map((line) => line.replace(/^ /, "")) },
|
|
316
324
|
};
|
|
317
325
|
}
|
|
318
|
-
/** The envelope's fields, said apart from an event's own. */
|
|
319
|
-
const ENVELOPE = new Set(["v", "ts", "seq", "run", "job", "module", "agent", "kind"]);
|
|
320
|
-
/** One event in a line: when, its pulse and module, its kind, its own fields - the agent's role when it has one. */
|
|
321
|
-
export function eventLine(entry) {
|
|
322
|
-
const fields = Object.entries(entry)
|
|
323
|
-
.filter(([key]) => !ENVELOPE.has(key))
|
|
324
|
-
.map(([key, value]) => {
|
|
325
|
-
// A long value - a ***plain diff, where its lines are - cut to the start of it: the line is a glance.
|
|
326
|
-
const whole = typeof value === "string" ? value : JSON.stringify(value);
|
|
327
|
-
const text = typeof value === "string" ? JSON.stringify(value.length > 160 ? `${value.slice(0, 159)}…` : value) : whole.length > 160 ? `${whole.slice(0, 159)}…` : whole;
|
|
328
|
-
return `${key}=${text}`;
|
|
329
|
-
});
|
|
330
|
-
const where = [entry.job, entry.module, entry.agent?.role ?? entry.agent?.label].filter((part) => part !== undefined);
|
|
331
|
-
return [entry.ts.slice(0, 19).replace("T", " "), ...where, entry.kind, ...fields].join(" · ");
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* The events of these projects' ledgers that `query` asks for: how many of each kind, and the most recent, a line each -
|
|
335
|
-
* or, when no kind asked for is in the ledger, the kinds it has.
|
|
336
|
-
*/
|
|
337
|
-
export function describeEvents(projects, query = {}) {
|
|
338
|
-
const all = projects.flatMap((project) => readLedger(project, query.since !== undefined ? { since: query.since } : {}));
|
|
339
|
-
const inModule = query.module !== undefined ? all.filter((entry) => entry.module === query.module) : all;
|
|
340
|
-
const wanted = query.kinds?.map((kind) => kind.trim()).filter((kind) => kind !== "");
|
|
341
|
-
const matches = (kind) => wanted === undefined || wanted.length === 0 || wanted.some((asked) => kind === asked || kind.startsWith(`${asked}.`));
|
|
342
|
-
const found = inModule.filter((entry) => matches(entry.kind));
|
|
343
|
-
const scope = [query.module !== undefined ? `in ${query.module}` : "", query.since !== undefined ? `since ${query.since.toISOString().slice(0, 16).replace("T", " ")}` : ""].filter(Boolean).join(", ");
|
|
344
|
-
if (found.length === 0) {
|
|
345
|
-
const kinds = [...new Set(inModule.map((entry) => entry.kind))].sort();
|
|
346
|
-
return `No ${wanted !== undefined && wanted.length > 0 ? wanted.join(", ") : ""} events${scope !== "" ? ` ${scope}` : ""} in the ledger.${kinds.length > 0 ? ` It has: ${kinds.join(", ")}.` : ""}`;
|
|
347
|
-
}
|
|
348
|
-
const counts = new Map();
|
|
349
|
-
for (const entry of found)
|
|
350
|
-
counts.set(entry.kind, (counts.get(entry.kind) ?? 0) + 1);
|
|
351
|
-
const pulses = new Set(found.map((entry) => entry.job).filter((job) => job !== undefined)).size;
|
|
352
|
-
const runs = new Set(found.map((entry) => entry.run)).size;
|
|
353
|
-
const limit = Math.max(1, query.limit ?? 20);
|
|
354
|
-
const recent = found.slice(-limit).reverse();
|
|
355
|
-
return [
|
|
356
|
-
`${found.length} event${found.length === 1 ? "" : "s"}${scope !== "" ? ` ${scope}` : ""}, in ${runs} run${runs === 1 ? "" : "s"} and ${pulses} pulse${pulses === 1 ? "" : "s"}: ${[...counts].sort((a, b) => b[1] - a[1]).map(([kind, times]) => `${kind} ${times}`).join(", ")}`,
|
|
357
|
-
"",
|
|
358
|
-
recent.length === found.length ? "Each, newest first:" : `The last ${recent.length}, newest first:`,
|
|
359
|
-
...recent.map(eventLine),
|
|
360
|
-
].join("\n");
|
|
361
|
-
}
|
|
362
|
-
/** `24h`, `7d`, `30m`, or a date and time: the moment it means, or undefined when it means none. */
|
|
363
|
-
export function sinceOf(text, now = Date.now()) {
|
|
364
|
-
const relative = /^(\d+)\s*([mhd])$/i.exec(text.trim());
|
|
365
|
-
if (relative !== null) {
|
|
366
|
-
const unit = { m: 60_000, h: 3_600_000, d: 86_400_000 }[relative[2].toLowerCase()];
|
|
367
|
-
return new Date(now - Number(relative[1]) * unit);
|
|
368
|
-
}
|
|
369
|
-
const date = new Date(text.trim());
|
|
370
|
-
return Number.isNaN(date.getTime()) ? undefined : date;
|
|
371
|
-
}
|
|
@@ -10,7 +10,7 @@ import { type UsageReport } from "./activity.ts";
|
|
|
10
10
|
* was queued, started, went through its stages and ended, and how; what each agent's model calls and
|
|
11
11
|
* turns cost; each tool call and test run, how long it took and how it ended; the gates' rounds and
|
|
12
12
|
* verdicts; what turri refused or stopped; what its healers did; the history's commits. What a pulse
|
|
13
|
-
* from an earlier session did is looked up here (`pulses
|
|
13
|
+
* from an earlier session did is looked up here (`pulses`) - and what it
|
|
14
14
|
* regenerated, its ***plain diff, kept whole as the one body the ledger has. Never stored: prompts,
|
|
15
15
|
* replies, thinking, tool arguments and results, file contents - and what strings an event carries are
|
|
16
16
|
* masked as the logs are.
|
|
@@ -69,8 +69,31 @@ export type LedgerEvent = {
|
|
|
69
69
|
} | {
|
|
70
70
|
kind: "sentinel.checking";
|
|
71
71
|
module?: string;
|
|
72
|
-
replaced?: string;
|
|
73
72
|
check?: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: "sentinel.paused";
|
|
75
|
+
module: string;
|
|
76
|
+
launch: string;
|
|
77
|
+
} | {
|
|
78
|
+
kind: "sentinel.resumed";
|
|
79
|
+
module: string;
|
|
80
|
+
launch: string;
|
|
81
|
+
} | {
|
|
82
|
+
kind: "sentinel.refused";
|
|
83
|
+
module?: string;
|
|
84
|
+
check?: string;
|
|
85
|
+
why: string;
|
|
86
|
+
} | {
|
|
87
|
+
kind: "launch.started";
|
|
88
|
+
launch: string;
|
|
89
|
+
commit: string;
|
|
90
|
+
pulse?: string;
|
|
91
|
+
} | {
|
|
92
|
+
kind: "launch.finished";
|
|
93
|
+
launch: string;
|
|
94
|
+
commit: string;
|
|
95
|
+
status: string;
|
|
96
|
+
ms: number;
|
|
74
97
|
} | {
|
|
75
98
|
kind: "sentinel.concluded";
|
|
76
99
|
verdict: string;
|
|
@@ -85,7 +108,7 @@ export type LedgerEvent = {
|
|
|
85
108
|
pulse?: number;
|
|
86
109
|
title?: string;
|
|
87
110
|
model?: string;
|
|
88
|
-
|
|
111
|
+
configModule?: string;
|
|
89
112
|
cases?: PulseCases;
|
|
90
113
|
waitingOn: string[];
|
|
91
114
|
follows?: string;
|
|
@@ -246,19 +269,6 @@ export type LedgerEvent = {
|
|
|
246
269
|
missing: string;
|
|
247
270
|
source: string;
|
|
248
271
|
sandbox: boolean;
|
|
249
|
-
} | {
|
|
250
|
-
kind: "advisor.classified";
|
|
251
|
-
spec: string;
|
|
252
|
-
verdict: "yes" | "no";
|
|
253
|
-
questions: string[];
|
|
254
|
-
asked: boolean;
|
|
255
|
-
} | {
|
|
256
|
-
kind: "advisor.dropped";
|
|
257
|
-
spec: string;
|
|
258
|
-
} | {
|
|
259
|
-
kind: "advisor.failed";
|
|
260
|
-
spec: string;
|
|
261
|
-
reason: string;
|
|
262
272
|
};
|
|
263
273
|
export type LedgerKind = LedgerEvent["kind"];
|
|
264
274
|
/** One line of the ledger: the event, and where and when it happened. */
|
|
@@ -17,7 +17,7 @@ import { ensureInScratch } from "./paths.js";
|
|
|
17
17
|
* was queued, started, went through its stages and ended, and how; what each agent's model calls and
|
|
18
18
|
* turns cost; each tool call and test run, how long it took and how it ended; the gates' rounds and
|
|
19
19
|
* verdicts; what turri refused or stopped; what its healers did; the history's commits. What a pulse
|
|
20
|
-
* from an earlier session did is looked up here (`pulses
|
|
20
|
+
* from an earlier session did is looked up here (`pulses`) - and what it
|
|
21
21
|
* regenerated, its ***plain diff, kept whole as the one body the ledger has. Never stored: prompts,
|
|
22
22
|
* replies, thinking, tool arguments and results, file contents - and what strings an event carries are
|
|
23
23
|
* masked as the logs are.
|
|
@@ -79,6 +79,8 @@ export declare function commitPaths(moduleDir: string, paths: string[], subject:
|
|
|
79
79
|
export declare function refreshExcludes(moduleDir: string): void;
|
|
80
80
|
/** The current commit of a module's history, if it has one. */
|
|
81
81
|
export declare function head(dir: string): string | undefined;
|
|
82
|
+
/** The module's last commit, whole. */
|
|
83
|
+
export declare function lastCommit(dir: string): string | undefined;
|
|
82
84
|
/** The module's history, newest first, one line per commit. */
|
|
83
85
|
export declare function historyLog(dir: string, limit?: number): string;
|
|
84
86
|
/** One commit in full: its message and what it changed. */
|
|
@@ -382,6 +382,14 @@ export function head(dir) {
|
|
|
382
382
|
const result = git(moduleDir, ["rev-parse", "--short", "HEAD"]);
|
|
383
383
|
return result.status === 0 ? result.stdout.trim() : undefined;
|
|
384
384
|
}
|
|
385
|
+
/** The module's last commit, whole. */
|
|
386
|
+
export function lastCommit(dir) {
|
|
387
|
+
const moduleDir = moduleDirOf(dir);
|
|
388
|
+
if (!existsSync(join(moduleDir, HISTORY_DIR)))
|
|
389
|
+
return undefined;
|
|
390
|
+
const result = git(moduleDir, ["rev-parse", "--verify", "--quiet", "HEAD"]);
|
|
391
|
+
return result.status === 0 ? result.stdout.trim() : undefined;
|
|
392
|
+
}
|
|
385
393
|
/** The module's history, newest first, one line per commit. */
|
|
386
394
|
export function historyLog(dir, limit = 30) {
|
|
387
395
|
const moduleDir = moduleDirOf(dir);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type MarshalledPlainSource } from "../plain/spec.ts";
|
|
2
1
|
import { type ChunkAgents } from "./chunk-plan.ts";
|
|
3
2
|
import { type SpecGap } from "./notes.ts";
|
|
4
3
|
import { type Job, type JobRegistry, type PulseCases } from "./jobs.ts";
|
|
@@ -102,8 +101,8 @@ export interface ModuleStatus {
|
|
|
102
101
|
codebases: string[];
|
|
103
102
|
old?: true;
|
|
104
103
|
};
|
|
105
|
-
/** The
|
|
106
|
-
|
|
104
|
+
/** The module whose config.turri.<module>.yaml it is built with, over config.turri.yaml - its own, or one it requires - when one is. */
|
|
105
|
+
configModule?: string;
|
|
107
106
|
/** Pure renames turri makes once the running pulse ends - a func-id or a scenario-id, nothing else with it: nothing regenerated. */
|
|
108
107
|
renames?: string[];
|
|
109
108
|
/**
|
|
@@ -142,25 +141,34 @@ export interface DriftReport {
|
|
|
142
141
|
}
|
|
143
142
|
/** What is left to regenerate, as the conversation and the command line read it. */
|
|
144
143
|
export declare function describeDrift(reports: DriftReport[]): string;
|
|
145
|
-
/** A codebase as the loop has just looked at it: its chain, its spec now, and what its code is built from (`codeTree` form). */
|
|
146
|
-
export interface SeenSpec {
|
|
147
|
-
chain: ChainEntry[];
|
|
148
|
-
tree: MarshalledPlainSource;
|
|
149
|
-
built: MarshalledPlainSource;
|
|
150
|
-
}
|
|
151
144
|
export interface WorkLoop {
|
|
152
145
|
/**
|
|
153
146
|
* Bring a spec's module up to the spec as the .plain files have it now - in the codebases where its
|
|
154
147
|
* code lives, and every module it is built on that has to be built first - planning and starting the
|
|
155
|
-
* first jobs. Asked again, it clears a halt
|
|
156
|
-
* again. `specChange`: brought up because its spec was changed, not asked for - a module the person halted stays
|
|
157
|
-
* halted. Says what it planned.
|
|
148
|
+
* first jobs. Asked again, it clears a halt - one the person asked for too. Says what it planned.
|
|
158
149
|
*/
|
|
159
150
|
bringUp(plainFile: string, options?: {
|
|
160
151
|
model?: string;
|
|
161
152
|
guidance?: string;
|
|
162
|
-
specChange?: boolean;
|
|
163
153
|
}): Promise<ModuleStatus[]>;
|
|
154
|
+
/**
|
|
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
|
|
159
|
+
* chain has a pulse running goes on as it was, planning what follows it. Says what is planned.
|
|
160
|
+
*/
|
|
161
|
+
lookAhead(plainFile: string, options?: {
|
|
162
|
+
model?: string;
|
|
163
|
+
guidance?: string;
|
|
164
|
+
}): Promise<ModuleStatus[]>;
|
|
165
|
+
/**
|
|
166
|
+
* A planned row (`planned-<module>-N`, as `planned` names it) as the loop keeps it: its cases and, for the next pulse
|
|
167
|
+
* 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
|
|
169
|
+
* prompt is shown. Undefined when no row has that id.
|
|
170
|
+
*/
|
|
171
|
+
plannedPulse(rowId: string): Promise<PlannedPulse | undefined>;
|
|
164
172
|
/**
|
|
165
173
|
* Regenerate functional specs of a module again, their spec changed or not - each named by its func-id: each is marked to regenerate again in
|
|
166
174
|
* the record of every codebase it is built in - committed - and they are brought up to their spec, the marked ones
|
|
@@ -180,11 +188,20 @@ export interface WorkLoop {
|
|
|
180
188
|
* Write and run the conformance tests of a spec's module - of the functional specs named, or of every one - on the
|
|
181
189
|
* code as it is built, in the codebases where its code lives: for this session, whatever the config says. Asked
|
|
182
190
|
* again, it clears a halt. Says what it planned.
|
|
191
|
+
*
|
|
192
|
+
* A functional spec named whose tests are written already has them written again: marked in the tests record of
|
|
193
|
+
* every codebase it is tested in - committed - and written anew there, its code untouched. `fromScratch` works where
|
|
194
|
+
* its code lives, as regenerating it from scratch does - the tip of each chain it is built in, never a codebase in the
|
|
195
|
+
* middle: the tip's tests folder taken out - committed first, so its history keeps it - and the tests written again
|
|
196
|
+
* there: `"module"` starting from a copy of the tests of the module the tip requires, `"chain"` from nothing, every
|
|
197
|
+
* functional spec of the chain written anew. The code is untouched, and nothing else is. Destructive: asked for only
|
|
198
|
+
* when the person asked for it. Not both: from scratch writes every one of them again.
|
|
183
199
|
*/
|
|
184
200
|
conformance(plainFile: string, options?: {
|
|
185
201
|
funcIds?: string[];
|
|
186
202
|
model?: string;
|
|
187
203
|
separately?: boolean;
|
|
204
|
+
fromScratch?: "module" | "chain";
|
|
188
205
|
}): Promise<ModuleStatus[]>;
|
|
189
206
|
/**
|
|
190
207
|
* Start over the codebases of a spec's module that now require a module their code was not built on (see
|
|
@@ -230,14 +247,24 @@ export interface WorkLoop {
|
|
|
230
247
|
mapPlan(): MapPlan;
|
|
231
248
|
/** Resolves once nothing runs and nothing more can start. */
|
|
232
249
|
drain(): Promise<void>;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
250
|
+
}
|
|
251
|
+
/** A planned pulse as `WorkLoop.plannedPulse` tells it. */
|
|
252
|
+
export interface PlannedPulse {
|
|
253
|
+
/** The planned row's id. */
|
|
254
|
+
id: string;
|
|
255
|
+
module: string;
|
|
256
|
+
plainFile: string;
|
|
257
|
+
title: string;
|
|
258
|
+
track: Track;
|
|
259
|
+
cases: JobCases;
|
|
260
|
+
/** Its place among the codebase's planned pulses, from 1. */
|
|
261
|
+
index: number;
|
|
262
|
+
/** Planned by a look ahead: it waits for regenerate, conform or /regenerate to start it. */
|
|
263
|
+
lookedAhead: boolean;
|
|
264
|
+
/** The coding agent's task, whole: the next pulse of a codebase with nothing running, from the kept plan. */
|
|
265
|
+
task?: string;
|
|
266
|
+
/** Why no task is shown, when none is. */
|
|
267
|
+
why?: string;
|
|
241
268
|
}
|
|
242
269
|
/** A pulse as the regeneration places it: by the items its trees differ in. */
|
|
243
270
|
export interface MapPulse {
|
|
@@ -347,23 +374,16 @@ export declare function createWorkLoop(options: {
|
|
|
347
374
|
/** Writes and runs a conformance job's tests. Default: a spec diff's conformance run, the whole suite with it. */
|
|
348
375
|
runConformance?: JobRunner;
|
|
349
376
|
/**
|
|
350
|
-
*
|
|
351
|
-
* the
|
|
377
|
+
* A pulse landed: its codebase's commit, once its line is in the notes - the commit what is built on it builds on.
|
|
378
|
+
* Called before the codebase's next pulse starts; what it does - a launch, under launch-after-pulse - runs on its own.
|
|
352
379
|
*/
|
|
353
|
-
|
|
380
|
+
landed?: (input: {
|
|
381
|
+
job: Job;
|
|
354
382
|
plainFile: string;
|
|
355
383
|
moduleName: string;
|
|
384
|
+
commit: string;
|
|
356
385
|
title: string;
|
|
357
|
-
|
|
358
|
-
}) => Promise<string>;
|
|
359
|
-
/** Plan, and keep the job each codebase would start (`firsts`) - but start none. */
|
|
360
|
-
dryRun?: boolean;
|
|
361
|
-
/**
|
|
362
|
-
* Told each time the loop looks at a codebase whose spec parses: its chain, the spec as the .plain files have it now,
|
|
363
|
-
* and what its code is built from - what the test advisor watches (advisor-runs.ts). Nothing it does is the loop's
|
|
364
|
-
* concern: one that throws is ignored.
|
|
365
|
-
*/
|
|
366
|
-
onSpec?: (seen: SeenSpec) => void;
|
|
386
|
+
}) => void;
|
|
367
387
|
}): WorkLoop;
|
|
368
388
|
/** Why nothing runs in a codebase whose code - and conformance tests, where they are wanted - is built from its spec as it is. */
|
|
369
389
|
export declare const UP_TO_DATE = "built from the ***plain as it is";
|
|
@@ -374,39 +394,11 @@ export declare function namesOf(module: string, funcIds: string[]): string;
|
|
|
374
394
|
* a func-id is unique in its module only.
|
|
375
395
|
*/
|
|
376
396
|
export declare function funcIdsNamed(module: string, names: string[]): string[];
|
|
377
|
-
/** The codebases the loop looks after, as the person reads them: what runs, what is planned after it, and why nothing does. */
|
|
378
|
-
/**
|
|
379
|
-
* The coding agent's task for a dry run's first job, built as the render builds it - and all it did rolled back. Not for
|
|
380
|
-
* a conformance job: its prompt is built from what the code holds once it is built.
|
|
381
|
-
*/
|
|
382
|
-
export declare function promptOf(first: ReturnType<WorkLoop["firsts"]>[number]): Promise<string | undefined>;
|
|
383
|
-
/** The first job a codebase would start, and the prompt its coding agent would get. */
|
|
384
|
-
export interface JobPreview {
|
|
385
|
-
module: string;
|
|
386
|
-
title: string;
|
|
387
|
-
track: Track;
|
|
388
|
-
cases: JobCases;
|
|
389
|
-
/** The coding agent's task, whole. Not for a conformance job: it is built from what the code holds once it is built. */
|
|
390
|
-
task?: string;
|
|
391
|
-
}
|
|
392
397
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
* what the next job there is given depends on what the running one lands.
|
|
398
|
+
* Why conform would start nothing for a module, from its ***plain alone (`conformanceAskedIn`): undefined when it would
|
|
399
|
+
* go on. What /conform checks before it says anything.
|
|
396
400
|
*/
|
|
397
|
-
export declare function
|
|
398
|
-
plainFile: string;
|
|
399
|
-
cwd: string;
|
|
400
|
-
model?: string;
|
|
401
|
-
plannerModel?: string;
|
|
402
|
-
steering?: (plainFile: string) => Steering[];
|
|
403
|
-
/** Whether a codebase, by its module, has a job running. */
|
|
404
|
-
busy?: (module: string) => boolean;
|
|
405
|
-
}): Promise<{
|
|
406
|
-
statuses: ModuleStatus[];
|
|
407
|
-
previews: JobPreview[];
|
|
408
|
-
busy: string[];
|
|
409
|
-
}>;
|
|
401
|
+
export declare function conformanceRefusal(plainFile: string, funcIds?: string[]): string | undefined;
|
|
410
402
|
/** Nothing runs, is planned or is waiting there, as its code is built from its spec as it is. */
|
|
411
403
|
export declare function isUpToDate(status: ModuleStatus): boolean;
|
|
412
404
|
export declare function describeModules(statuses: ModuleStatus[], options?: {
|