@turri-dev/cli 0.2.4-next.efe96fe → 0.2.4-next.f26a225
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 +2 -2
- package/dist/chat-skills.d.ts +1 -1
- package/dist/chat-skills.js +1 -1
- package/dist/chats.d.ts +42 -8
- package/dist/chats.js +122 -38
- package/dist/cli.js +1 -1
- package/dist/config-edit.js +4 -4
- package/dist/config.d.ts +48 -11
- package/dist/config.js +102 -13
- package/dist/extension.d.ts +9 -0
- package/dist/extension.js +184 -109
- package/dist/genome.js +1 -1
- package/dist/host-session.d.ts +6 -5
- package/dist/host-session.js +2 -2
- package/dist/host.d.ts +2 -0
- package/dist/identity.js +2 -2
- package/dist/init-config.d.ts +1 -1
- package/dist/init-config.js +7 -7
- package/dist/launch-agent.d.ts +51 -0
- package/dist/launch-agent.js +267 -0
- package/dist/{release-cli.js → launch-cli.js} +41 -24
- package/dist/launch-session.d.ts +68 -0
- package/dist/launch-session.js +217 -0
- package/dist/launch-tools.d.ts +28 -0
- package/dist/launch-tools.js +69 -0
- package/dist/launch-track.d.ts +125 -0
- package/dist/launch-track.js +320 -0
- package/dist/loop-cli.js +4 -4
- package/dist/loop-tools.d.ts +8 -3
- package/dist/loop-tools.js +37 -32
- package/dist/notice.d.ts +7 -6
- package/dist/plain-files.d.ts +2 -2
- package/dist/plain-files.js +3 -3
- package/dist/regenerate/command-check.d.ts +7 -1
- package/dist/regenerate/command-check.js +43 -1
- package/dist/regenerate/delivery.d.ts +1 -1
- package/dist/regenerate/delivery.js +3 -3
- package/dist/regenerate/launch.d.ts +154 -0
- package/dist/regenerate/{release.js → launch.js} +195 -51
- package/dist/regenerate/ledger.d.ts +32 -1
- package/dist/regenerate/lineage.d.ts +2 -0
- package/dist/regenerate/lineage.js +8 -0
- package/dist/regenerate/loop.d.ts +6 -5
- package/dist/regenerate/loop.js +16 -17
- package/dist/regenerate/paths.d.ts +2 -2
- package/dist/regenerate/paths.js +2 -2
- package/dist/self-invocation.js +7 -7
- package/dist/sentinel-check.d.ts +3 -3
- package/dist/sentinel-check.js +3 -3
- package/dist/sentinel.d.ts +18 -12
- package/dist/sentinel.js +68 -42
- package/docs/README.md +2 -2
- package/docs/chats.md +2 -2
- package/docs/config.md +9 -9
- package/docs/development.md +1 -1
- package/docs/headless.md +1 -1
- package/docs/hosting.md +14 -13
- package/docs/launch.md +67 -0
- package/docs/parser.md +1 -1
- package/docs/regenerating.md +3 -3
- package/docs/sandbox.md +3 -3
- package/docs/sentinel.md +24 -12
- package/docs/skills-and-gates.md +3 -3
- package/docs/using.md +7 -7
- package/genome/rules/turri-regeneration.md +1 -1
- package/package.json +1 -1
- package/dist/regenerate/release.d.ts +0 -121
- package/dist/release-agent.d.ts +0 -43
- package/dist/release-agent.js +0 -130
- package/dist/release-tools.d.ts +0 -44
- package/dist/release-tools.js +0 -170
- package/docs/deploy.md +0 -48
- /package/dist/{release-cli.d.ts → launch-cli.d.ts} +0 -0
package/dist/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import { copyFileSync, existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { copyFileSync, existsSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, join, resolve } from "node:path";
|
|
4
4
|
import { load as loadYaml } from "js-yaml";
|
|
5
5
|
import { projectDirOf, resolveTemplateDirs } from "./regenerate/paths.js";
|
|
@@ -24,8 +24,8 @@ import { projectDirOf, resolveTemplateDirs } from "./regenerate/paths.js";
|
|
|
24
24
|
* review: false # review the code and its tests once they pass (default: true)
|
|
25
25
|
* mutation-testing: false # give the coding agent and the reviewer can_it_fail (default: true)
|
|
26
26
|
* allow-to-stop-jobs: false # stop a running job the spec moved on from (default: true)
|
|
27
|
-
*
|
|
28
|
-
* sentinel: true # a chat of its own every finished pulse goes to, which tests
|
|
27
|
+
* launch-after-pulse: true # launch what each pulse lands, in the background, the newest commit winning (default: false)
|
|
28
|
+
* sentinel: true # a chat of its own every finished pulse goes to, which tests what is launched and tells you what is wrong: true, false, or ask - the person asked before it first opens in a session (default: ask)
|
|
29
29
|
* rules-off: [integrations] # ***plain rules to leave out of the prompts, by name (default: none)
|
|
30
30
|
* unittests-script: test_scripts/run_unittests.sh # the testing scripts - see test-scripts.ts
|
|
31
31
|
* conformance-tests-script: test_scripts/run_conformance_tests.sh
|
|
@@ -142,7 +142,65 @@ export function moduleConfigsOf(root) {
|
|
|
142
142
|
* config.turri.yaml, and each config.<module>.yaml to config.turri.<module>.yaml, so nothing is lost when the old files
|
|
143
143
|
* stop being read. The old files are left as they are. Gives back the files written, by name.
|
|
144
144
|
*/
|
|
145
|
+
/**
|
|
146
|
+
* Keys turri has renamed, old to new - no alias: a project's config.turri.yaml or config.turri.<module>.yaml that still has
|
|
147
|
+
* the old one has it renamed as turri first reads or writes the project's config (`renameOldKeys`), its value and its
|
|
148
|
+
* comment kept. One that sets the new one too is left as it is, the old one said in the banner as doing nothing.
|
|
149
|
+
*/
|
|
150
|
+
export const RENAMED_KEYS = { "release-after-pulse": "launch-after-pulse" };
|
|
151
|
+
/** The projects whose config files were looked at for old keys this process, and what was renamed in each - for the banner. */
|
|
152
|
+
const renamedKeys = new Map();
|
|
153
|
+
/**
|
|
154
|
+
* Rename the old keys of `RENAMED_KEYS` in the project's config.turri*.yaml files - once a process, or again with `again`
|
|
155
|
+
* (a file just copied from its old name). A top-level key alone, its line kept but for the key's name; a file that also
|
|
156
|
+
* sets the new key, one that does not parse, or one that cannot be written is left as it is. Returns every key renamed
|
|
157
|
+
* in the project this process.
|
|
158
|
+
*/
|
|
159
|
+
export function renameOldKeys(root, options = {}) {
|
|
160
|
+
const dir = resolve(root);
|
|
161
|
+
const done = renamedKeys.get(dir);
|
|
162
|
+
if (done !== undefined && options.again !== true)
|
|
163
|
+
return done;
|
|
164
|
+
const renamed = done ?? [];
|
|
165
|
+
renamedKeys.set(dir, renamed);
|
|
166
|
+
for (const file of namesIn(dir).filter((name) => /^config\.turri(\.[^.]+)?\.yaml$/.test(name))) {
|
|
167
|
+
const path = join(dir, file);
|
|
168
|
+
let text;
|
|
169
|
+
let parsed;
|
|
170
|
+
try {
|
|
171
|
+
text = readFileSync(path, "utf8");
|
|
172
|
+
parsed = loadYaml(text);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
178
|
+
continue;
|
|
179
|
+
let changed = text;
|
|
180
|
+
const now = [];
|
|
181
|
+
for (const [from, to] of Object.entries(RENAMED_KEYS)) {
|
|
182
|
+
if (!(from in parsed) || to in parsed)
|
|
183
|
+
continue;
|
|
184
|
+
const line = new RegExp(`^${from.replace(/[-]/g, "\\-")}(?=[ \\t]*:)`, "m");
|
|
185
|
+
if (!line.test(changed))
|
|
186
|
+
continue;
|
|
187
|
+
changed = changed.replace(line, to);
|
|
188
|
+
now.push({ file, from, to });
|
|
189
|
+
}
|
|
190
|
+
if (now.length === 0)
|
|
191
|
+
continue;
|
|
192
|
+
try {
|
|
193
|
+
writeFileSync(path, changed);
|
|
194
|
+
renamed.push(...now);
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
/* a file turri cannot write keeps its old key: the banner says it does nothing */
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return renamed;
|
|
201
|
+
}
|
|
145
202
|
export function adoptLegacyConfig(root, options = {}) {
|
|
203
|
+
renameOldKeys(root);
|
|
146
204
|
if (!usesLegacyConfig(root))
|
|
147
205
|
return [];
|
|
148
206
|
const copies = [
|
|
@@ -152,6 +210,9 @@ export function adoptLegacyConfig(root, options = {}) {
|
|
|
152
210
|
];
|
|
153
211
|
for (const [from, to] of copies)
|
|
154
212
|
copyFileSync(join(root, from), join(root, to));
|
|
213
|
+
// What was copied may have keys turri has renamed since.
|
|
214
|
+
if (copies.length > 0)
|
|
215
|
+
renameOldKeys(root, { again: true });
|
|
155
216
|
return copies.map(([, to]) => to);
|
|
156
217
|
}
|
|
157
218
|
/** The module whose config file a pulse runs with: worked out as it was queued, whatever the files say since. */
|
|
@@ -242,10 +303,10 @@ export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhig
|
|
|
242
303
|
* The code fixer of a conformance run and the repair agent are coding agents; the unit-test and conformance arbiters
|
|
243
304
|
* are both `arbiter`.
|
|
244
305
|
*/
|
|
245
|
-
export const AGENT_ROLES = ["chat", "sentinel", "planner", "diagnosis", "
|
|
306
|
+
export const AGENT_ROLES = ["chat", "sentinel", "planner", "diagnosis", "launch", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"];
|
|
246
307
|
/**
|
|
247
308
|
* How hard each role thinks when nothing names a level - not the config's `models:`, nor a `:level` on the model it is
|
|
248
|
-
* given. The agents that do the work - write the code and the tests, explore,
|
|
309
|
+
* given. The agents that do the work - write the code and the tests, explore, launch - think little: they work from a
|
|
249
310
|
* spec that leaves little to guess, and every turn of theirs is many. The ones that judge - review, weigh, plan, find a
|
|
250
311
|
* cause - think more: a wrong call there costs pulses. The conversation keeps its own level, pi's.
|
|
251
312
|
*/
|
|
@@ -253,7 +314,7 @@ export const ROLE_THINKING = {
|
|
|
253
314
|
coding: "low",
|
|
254
315
|
conformance: "low",
|
|
255
316
|
explorer: "low",
|
|
256
|
-
|
|
317
|
+
launch: "low",
|
|
257
318
|
reviewer: "medium",
|
|
258
319
|
"test-reviewer": "medium",
|
|
259
320
|
judge: "medium",
|
|
@@ -263,7 +324,7 @@ export const ROLE_THINKING = {
|
|
|
263
324
|
diagnosis: "medium",
|
|
264
325
|
};
|
|
265
326
|
/** The roles on the conversation's side: without their own entry they take the chat's model, not `default`. */
|
|
266
|
-
// The
|
|
327
|
+
// The launch is not: it follows steps - a script, a start command - and runs on the coding model, thinking low. Nor
|
|
267
328
|
// is the diagnosis: a post-mortem of a job that failed, read by the person - it runs on the coding model, thinking medium.
|
|
268
329
|
const CHAT_SIDE = ["chat", "sentinel", "planner"];
|
|
269
330
|
function isThinkingLevel(value) {
|
|
@@ -413,7 +474,7 @@ export const CONFIG_KEYS = {
|
|
|
413
474
|
review: "review",
|
|
414
475
|
mutationTesting: "mutation-testing",
|
|
415
476
|
allowToStopJobs: "allow-to-stop-jobs",
|
|
416
|
-
|
|
477
|
+
launchAfterPulse: "launch-after-pulse",
|
|
417
478
|
sentinel: "sentinel",
|
|
418
479
|
testDir: "test-dir",
|
|
419
480
|
conformanceTests: "conformance-tests",
|
|
@@ -449,6 +510,8 @@ export function readProjectConfig(root, module) {
|
|
|
449
510
|
return withRunOverrides(readLayeredConfig(root, module));
|
|
450
511
|
}
|
|
451
512
|
function readLayeredConfig(root, module) {
|
|
513
|
+
// A key turri has renamed, renamed in the files as they are first read.
|
|
514
|
+
renameOldKeys(root);
|
|
452
515
|
const project = readConfigFile(join(root, projectConfigFile(root)));
|
|
453
516
|
if (module === undefined)
|
|
454
517
|
return project;
|
|
@@ -603,7 +666,7 @@ function readConfigFileNow(path) {
|
|
|
603
666
|
review: typeof raw[CONFIG_KEYS.review] === "boolean" ? raw[CONFIG_KEYS.review] : undefined,
|
|
604
667
|
mutationTesting: typeof raw[CONFIG_KEYS.mutationTesting] === "boolean" ? raw[CONFIG_KEYS.mutationTesting] : undefined,
|
|
605
668
|
allowToStopJobs: typeof raw[CONFIG_KEYS.allowToStopJobs] === "boolean" ? raw[CONFIG_KEYS.allowToStopJobs] : undefined,
|
|
606
|
-
|
|
669
|
+
launchAfterPulse: typeof raw[CONFIG_KEYS.launchAfterPulse] === "boolean" ? raw[CONFIG_KEYS.launchAfterPulse] : undefined,
|
|
607
670
|
sentinel: typeof raw[CONFIG_KEYS.sentinel] === "boolean" || raw[CONFIG_KEYS.sentinel] === "ask" ? raw[CONFIG_KEYS.sentinel] : undefined,
|
|
608
671
|
testDir: text(raw[CONFIG_KEYS.testDir]),
|
|
609
672
|
conformanceTests: typeof raw[CONFIG_KEYS.conformanceTests] === "boolean" ? raw[CONFIG_KEYS.conformanceTests] : undefined,
|
|
@@ -644,7 +707,8 @@ const OLDER_KEYS = ["model", "turn_limit"];
|
|
|
644
707
|
* not silently ignored. config.yaml is left out: it may be another tool's, with keys of its own.
|
|
645
708
|
*/
|
|
646
709
|
export function unknownConfigKeys(root) {
|
|
647
|
-
|
|
710
|
+
// An old name of a renamed key is said on a line of its own (configLines), not as a key turri does not read.
|
|
711
|
+
const known = new Set([...Object.values(CONFIG_KEYS), ...OLDER_KEYS, ...Object.keys(RENAMED_KEYS)]);
|
|
648
712
|
const found = [];
|
|
649
713
|
for (const file of namesIn(root).filter((name) => /^config\.turri(\.[^.]+)?\.yaml$/.test(name)).sort()) {
|
|
650
714
|
let parsed;
|
|
@@ -662,7 +726,32 @@ export function unknownConfigKeys(root) {
|
|
|
662
726
|
}
|
|
663
727
|
return found;
|
|
664
728
|
}
|
|
665
|
-
/**
|
|
666
|
-
|
|
667
|
-
|
|
729
|
+
/**
|
|
730
|
+
* The banner's lines for the project's config files: each key turri renamed in them this process, each old name left
|
|
731
|
+
* beside its new one - doing nothing - and each file with keys turri does not read.
|
|
732
|
+
*/
|
|
733
|
+
export function configLines(root) {
|
|
734
|
+
const renamed = renameOldKeys(root).map(({ file, from, to }) => ({ kind: "renamed", file, text: `${file}: ${from} is called ${to} now - turri renamed it there, its value kept.` }));
|
|
735
|
+
const left = [];
|
|
736
|
+
for (const file of namesIn(root).filter((name) => /^config\.turri(\.[^.]+)?\.yaml$/.test(name)).sort()) {
|
|
737
|
+
let parsed;
|
|
738
|
+
try {
|
|
739
|
+
parsed = loadYaml(readFileSync(join(root, file), "utf8"));
|
|
740
|
+
}
|
|
741
|
+
catch {
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
745
|
+
continue;
|
|
746
|
+
for (const [from, to] of Object.entries(RENAMED_KEYS)) {
|
|
747
|
+
if (from in parsed && to in parsed)
|
|
748
|
+
left.push({ kind: "old-beside-new", file, text: `${file} has ${from}, the old name of ${to}, which it sets too: ${from} does nothing - take it out.` });
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
const unknown = unknownConfigKeys(root).map(({ file, keys }) => ({
|
|
752
|
+
kind: "unknown",
|
|
753
|
+
file,
|
|
754
|
+
text: `${file} has ${keys.length === 1 ? "a key" : "keys"} turri does not read - ${keys.join(", ")}: no setting turri has, so ${keys.length === 1 ? "it does" : "they do"} nothing. Take ${keys.length === 1 ? "it" : "them"} out, or see docs/config.md for the spelling.`,
|
|
755
|
+
}));
|
|
756
|
+
return [...renamed, ...left, ...unknown];
|
|
668
757
|
}
|
package/dist/extension.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { fromWorkingDir } from "./loop-tools.ts";
|
|
|
6
6
|
import { type WorkLoop } from "./regenerate/loop.ts";
|
|
7
7
|
import { type AskUser, type AskUserIO } from "./ask.ts";
|
|
8
8
|
import { type TurriCore, type TurriHost } from "./chats.ts";
|
|
9
|
+
import { type Job } from "./regenerate/jobs.ts";
|
|
9
10
|
/**
|
|
10
11
|
* Puts a skill step's question to the person, when there is one to ask.
|
|
11
12
|
*
|
|
@@ -143,6 +144,14 @@ export declare function projectConfigBlock(root: string): string;
|
|
|
143
144
|
*/
|
|
144
145
|
export declare function turnOnConformance(core: TurriCore, plainFile?: string): string;
|
|
145
146
|
export { fromWorkingDir };
|
|
147
|
+
/**
|
|
148
|
+
* What a chat's agent is told of a pulse it asked for that ended, with the sentinel off. One that landed under
|
|
149
|
+
* launch-after-pulse is being launched as it is told: it says so, and offers nothing else for it - it is told once the
|
|
150
|
+
* launch ends.
|
|
151
|
+
*/
|
|
152
|
+
export declare function pulseEndNote(job: Job, options?: {
|
|
153
|
+
launching?: boolean;
|
|
154
|
+
}): string;
|
|
146
155
|
/**
|
|
147
156
|
* What the agent is to do with a job that just ended, unasked: what the project's guidance says to do then, or else say
|
|
148
157
|
* in a line or two what ended - the person saw it end already, in the transcript.
|