@turri-dev/cli 0.2.4-next.bc1fc47 → 0.2.4-next.d779410
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 +5 -6
- package/dist/bedrock-region.js +3 -3
- 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 -10
- package/dist/chats.js +125 -41
- package/dist/cli.js +7 -24
- package/dist/config-edit.d.ts +20 -8
- package/dist/config-edit.js +32 -24
- package/dist/config.d.ts +90 -60
- package/dist/config.js +224 -117
- package/dist/conform-cli.js +1 -1
- package/dist/conformance-switch.d.ts +7 -6
- package/dist/conformance-switch.js +16 -16
- package/dist/extension.d.ts +10 -1
- package/dist/extension.js +263 -306
- package/dist/genome.js +1 -1
- package/dist/host-session.d.ts +8 -7
- package/dist/host-session.js +4 -4
- package/dist/host.d.ts +3 -1
- package/dist/host.js +3 -3
- package/dist/identity.js +2 -2
- package/dist/init-config.d.ts +1 -1
- package/dist/init-config.js +8 -8
- 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 +17 -16
- package/dist/loop-tools.js +69 -69
- package/dist/notice.d.ts +7 -6
- package/dist/parse-cli.js +2 -2
- package/dist/pi-launch.js +3 -0
- package/dist/pi-settings.d.ts +4 -0
- package/dist/pi-settings.js +39 -0
- package/dist/pi.js +3 -3
- package/dist/plain/check.d.ts +1 -1
- package/dist/plain/check.js +3 -1
- package/dist/plain-files.d.ts +2 -2
- package/dist/plain-files.js +7 -7
- package/dist/regenerate/agent-env.d.ts +1 -1
- package/dist/regenerate/agent-env.js +3 -3
- package/dist/regenerate/agent-shell.js +2 -2
- package/dist/regenerate/base-folder.d.ts +2 -2
- package/dist/regenerate/base-folder.js +1 -1
- 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/jobs.d.ts +2 -2
- package/dist/regenerate/jobs.js +10 -10
- package/dist/regenerate/launch.d.ts +154 -0
- package/dist/regenerate/{release.js → launch.js} +195 -51
- package/dist/regenerate/ledger.d.ts +33 -2
- package/dist/regenerate/lineage.d.ts +2 -0
- package/dist/regenerate/lineage.js +8 -0
- package/dist/regenerate/loop.d.ts +9 -8
- package/dist/regenerate/loop.js +43 -40
- 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/scripts-being-written.d.ts +4 -4
- package/dist/regenerate/scripts-being-written.js +3 -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 +6 -6
- package/dist/regenerate/testing-steps.js +8 -8
- 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/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/docs/README.md +4 -4
- package/docs/chats.md +5 -6
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +58 -46
- package/docs/development.md +2 -2
- package/docs/headless.md +2 -3
- package/docs/hosting.md +20 -19
- package/docs/launch.md +67 -0
- package/docs/parser.md +2 -2
- package/docs/regenerating.md +12 -12
- package/docs/sandbox.md +3 -3
- package/docs/sentinel.md +26 -14
- package/docs/skills-and-gates.md +4 -5
- package/docs/using.md +15 -24
- package/genome/rules/project-model.md +2 -1
- package/genome/rules/turri-regeneration.md +3 -2
- 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/regenerate/engine.d.ts +0 -52
- 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/dist/stacks.d.ts +0 -13
- package/dist/stacks.js +0 -96
- package/docs/deploy.md +0 -48
- /package/dist/{release-cli.d.ts → launch-cli.d.ts} +0 -0
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
import { basename, isAbsolute, join, relative, resolve } from "node:path";
|
|
2
4
|
import { applyBedrockRegion } from "./bedrock-region.js";
|
|
3
|
-
import { CONFIG_FILE, LEGACY_CONFIG_FILE, THINKING_LEVELS, usesLegacyConfig } from "./config.js";
|
|
4
|
-
import { currentValue, dotenvFiles, EFFECT_TEXT, overriddenBy, parseValue, pathOptions, readConfigText, settingOf, settings, shownValue, writeSetting, } from "./config-edit.js";
|
|
5
|
+
import { CONFIG_FILE, LEGACY_CONFIG_FILE, moduleConfigFile, moduleConfigsOf, THINKING_LEVELS, usesLegacyConfig } from "./config.js";
|
|
6
|
+
import { currentValue, dotenvFiles, EFFECT_TEXT, overriddenBy, parseValue, pathOptions, readConfigText, readModuleConfigText, settingOf, settings, shownValue, writeSetting, } from "./config-edit.js";
|
|
5
7
|
import { PACKAGE_ROOT } from "./environment.js";
|
|
8
|
+
import { describeResolution, resolveModel } from "./regenerate/model-names.js";
|
|
9
|
+
import { openPiSettings } from "./pi-settings.js";
|
|
6
10
|
import { loadRules } from "./rules.js";
|
|
7
11
|
/** The option that unsets a setting, for a setting. */
|
|
8
12
|
const unsetOption = (setting) => `unset - ${setting.unset}`;
|
|
9
13
|
const TYPE_ANOTHER = "type another…";
|
|
10
14
|
const DONE = "done";
|
|
11
15
|
const ROLES_ENTRY = "models.<role> - each agent role's own model, thinking and turn limit…";
|
|
16
|
+
const PI_ENTRY = "pi's own settings - the theme, the editor, how the chat is shown…";
|
|
12
17
|
/** The models pi can reach here, signed in: provider/id - from a chat's context, the model registry the chats use. */
|
|
13
18
|
export function reachable(ctx) {
|
|
14
19
|
try {
|
|
@@ -21,7 +26,7 @@ export function reachable(ctx) {
|
|
|
21
26
|
/** How many values the terminal's autocomplete shows for a setting: a host reads them whole (`settingCandidates`). */
|
|
22
27
|
const COMPLETIONS_SHOWN = 40;
|
|
23
28
|
/**
|
|
24
|
-
* Every value /
|
|
29
|
+
* Every value /settings offers for a setting after what is typed, in its order - "unset" left out, and uncapped: what
|
|
25
30
|
* its completions show, the first of them, and what a host's settings list shows (host-session.ts `settingChoices`).
|
|
26
31
|
* A model setting's are every model pi can reach, signed in - `models` - and after a colon, that model's thinking levels.
|
|
27
32
|
*/
|
|
@@ -48,25 +53,22 @@ function listLine(setting, text) {
|
|
|
48
53
|
const value = currentValue(text, setting.key);
|
|
49
54
|
return `${setting.key}: ${value === undefined ? `(unset - ${setting.unset})` : shownValue(value)}`;
|
|
50
55
|
}
|
|
51
|
-
export function
|
|
56
|
+
export function registerSettings(pi, options) {
|
|
52
57
|
const { cwd } = options;
|
|
53
58
|
// The models for completions, which are given no context: the last one seen.
|
|
54
59
|
let seen;
|
|
55
60
|
pi.on("session_start", (_event, ctx) => {
|
|
56
61
|
seen = ctx;
|
|
57
62
|
});
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ctx.ui.notify(parsed.error, "error");
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const value = "unset" in parsed ? undefined : parsed.value;
|
|
63
|
+
/**
|
|
64
|
+
* Write a setting - or unset it - into config.turri.yaml, or `module`'s own file, and change live what turri fixed at
|
|
65
|
+
* its start; says what it did and when it takes effect.
|
|
66
|
+
*/
|
|
67
|
+
const change = async (setting, value, ctx, module) => {
|
|
67
68
|
// The first setting written where the project is still read from config.yaml: copied to config.turri.yaml first.
|
|
68
69
|
const adopting = usesLegacyConfig(cwd);
|
|
69
|
-
const text = writeSetting(cwd, setting.key, value);
|
|
70
|
+
const text = writeSetting(cwd, setting.key, value, module);
|
|
71
|
+
const file = module !== undefined ? moduleConfigFile(module) : CONFIG_FILE;
|
|
70
72
|
const notes = [];
|
|
71
73
|
// A model changed: the AWS region its Bedrock models need is worked out again - set, moved or taken back by turri.
|
|
72
74
|
if (setting.key.endsWith("-model") || setting.key.startsWith("models."))
|
|
@@ -89,9 +91,21 @@ export function registerTurriConfig(pi, options) {
|
|
|
89
91
|
}
|
|
90
92
|
if (adopting)
|
|
91
93
|
notes.push(`${LEGACY_CONFIG_FILE} was copied to ${CONFIG_FILE} first - turri reads its own file from now on, and leaves ${LEGACY_CONFIG_FILE} as it is.`);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
if (module !== undefined)
|
|
95
|
+
notes.push(`It holds for ${module}.plain and every module built on it that has no file of its own, over ${CONFIG_FILE}.`);
|
|
96
|
+
notes.push(...overriddenBy(cwd, text, setting, module));
|
|
97
|
+
const what = value === undefined ? `${setting.key} unset - ${module !== undefined ? `${CONFIG_FILE}'s holds` : setting.unset}` : `${setting.key}: ${shownValue(value)}`;
|
|
98
|
+
return [`${what} - written to ${file}, ${EFFECT_TEXT[setting.effect]}.`, ...notes].join("\n");
|
|
99
|
+
};
|
|
100
|
+
/** Set a setting to what was typed - or unset it - and say what it did and when it takes effect. */
|
|
101
|
+
const apply = async (setting, typed, ctx) => {
|
|
102
|
+
const models = reachable(ctx);
|
|
103
|
+
const parsed = parseValue(setting, typed, models.length > 0 ? (model) => models.includes(model) : undefined);
|
|
104
|
+
if ("error" in parsed) {
|
|
105
|
+
ctx.ui.notify(parsed.error, "error");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
ctx.ui.notify(await change(setting, "unset" in parsed ? undefined : parsed.value, ctx), "info");
|
|
95
109
|
};
|
|
96
110
|
/** Ask for a setting's value, as its kind takes it: what is typed comes back, or nothing when the dialog is left. */
|
|
97
111
|
const askValue = async (setting, ctx) => {
|
|
@@ -154,15 +168,20 @@ export function registerTurriConfig(pi, options) {
|
|
|
154
168
|
}
|
|
155
169
|
}
|
|
156
170
|
};
|
|
157
|
-
/** Pick a setting from the list - the models of each role behind one entry. */
|
|
171
|
+
/** Pick a setting from the list - the models of each role behind one entry, and pi's own settings last. */
|
|
158
172
|
const askSetting = async (ctx) => {
|
|
159
173
|
const text = readConfigText(cwd);
|
|
160
174
|
const all = settings(options.rules());
|
|
161
175
|
const top = all.filter((setting) => !setting.key.startsWith("models."));
|
|
162
|
-
const lines = [...top.map((setting) => listLine(setting, text)), ROLES_ENTRY];
|
|
163
|
-
const chosen = await ctx.ui.select(`/
|
|
176
|
+
const lines = [...top.map((setting) => listLine(setting, text)), ROLES_ENTRY, PI_ENTRY];
|
|
177
|
+
const chosen = await ctx.ui.select(`/settings - the project's ${CONFIG_FILE}. Pick a setting to change:`, lines);
|
|
164
178
|
if (chosen === undefined)
|
|
165
179
|
return undefined;
|
|
180
|
+
if (chosen === PI_ENTRY) {
|
|
181
|
+
if (!openPiSettings())
|
|
182
|
+
ctx.ui.notify("pi's own settings open only in the terminal's chat.", "info");
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
166
185
|
if (chosen === ROLES_ENTRY) {
|
|
167
186
|
const roles = all.filter((setting) => setting.key.startsWith("models."));
|
|
168
187
|
const role = await ctx.ui.select("Which role's model or turn limit?", roles.map((setting) => listLine(setting, text)));
|
|
@@ -200,8 +219,8 @@ export function registerTurriConfig(pi, options) {
|
|
|
200
219
|
await apply(setting, value, ctx);
|
|
201
220
|
},
|
|
202
221
|
});
|
|
203
|
-
pi.registerCommand("
|
|
204
|
-
description: `Change a setting of the project's ${CONFIG_FILE}`,
|
|
222
|
+
pi.registerCommand("settings", {
|
|
223
|
+
description: `Change a setting of the project's ${CONFIG_FILE} - or pi's own, last in the list`,
|
|
205
224
|
getArgumentCompletions: (prefix) => {
|
|
206
225
|
const all = settings(options.rules());
|
|
207
226
|
const space = prefix.indexOf(" ");
|
|
@@ -234,7 +253,7 @@ export function registerTurriConfig(pi, options) {
|
|
|
234
253
|
setting = settingOf(key, options.rules());
|
|
235
254
|
if (setting === undefined) {
|
|
236
255
|
const near = settings(options.rules()).filter((entry) => entry.key.includes(key.toLowerCase())).map((entry) => entry.key);
|
|
237
|
-
ctx.ui.notify(`No setting ${key}.${near.length > 0 ? ` Did you mean ${near.slice(0, 5).join(", ")}?` : " /
|
|
256
|
+
ctx.ui.notify(`No setting ${key}.${near.length > 0 ? ` Did you mean ${near.slice(0, 5).join(", ")}?` : " /settings alone lists them."}`, "error");
|
|
238
257
|
return;
|
|
239
258
|
}
|
|
240
259
|
}
|
|
@@ -244,4 +263,116 @@ export function registerTurriConfig(pi, options) {
|
|
|
244
263
|
await apply(setting, given, ctx);
|
|
245
264
|
},
|
|
246
265
|
});
|
|
266
|
+
pi.registerTool(defineTool({
|
|
267
|
+
name: "settings",
|
|
268
|
+
label: "Settings",
|
|
269
|
+
description: `Read or change the project's settings: ${CONFIG_FILE}, and a module's own config.turri.<module>.yaml laid over it for ` +
|
|
270
|
+
"that module and every module built on it that has no file of its own. With no key: every setting, what it is " +
|
|
271
|
+
"and where it is set. With a key and no value: that setting, what it takes and what it is unset. With a value: " +
|
|
272
|
+
"written, taking effect as it says - the coding model at the next pulse. A model may be given by its name as the " +
|
|
273
|
+
"user said it; one that fits several, or none with credentials, comes back as a list - ask the user which. " +
|
|
274
|
+
"Some settings are the user's alone and are refused: they change them with /settings. For one pulse on another " +
|
|
275
|
+
"model, pass model to regenerate or conform instead.",
|
|
276
|
+
promptSnippet: "read the project's settings, or change one when the user asks - the coding model among them",
|
|
277
|
+
promptGuidelines: [
|
|
278
|
+
"Change a setting only when the user asks for it - \"regenerate with gpt 5.5 from now on\" is coding-model - and say what it is now and when it takes effect.",
|
|
279
|
+
"If settings returns several candidate models, ask the user which one, then call it again with the exact provider/model-id.",
|
|
280
|
+
"A setting settings refuses is the user's to change: tell them why it matters and that /settings changes it - never edit the config files to get round it.",
|
|
281
|
+
],
|
|
282
|
+
parameters: Type.Object({
|
|
283
|
+
key: Type.Optional(Type.String({ description: "The setting as the config file writes it - coding-model, models.coding, review, unittests-script. Omitted: every setting" })),
|
|
284
|
+
value: Type.Optional(Type.String({
|
|
285
|
+
description: "What to set it to: true or false, a number, one of its words, a path from the project root, a model as " +
|
|
286
|
+
"provider/model-id - :thinking after it - or its name as the user said it, a list separated by commas; " +
|
|
287
|
+
"unset to take it out. Omitted: what it is now",
|
|
288
|
+
})),
|
|
289
|
+
module: Type.Optional(Type.String({
|
|
290
|
+
description: `The module - its .plain file, e.g. backend.plain - whose own config.turri.<module>.yaml to write. Omitted: ${CONFIG_FILE}, the whole project's`,
|
|
291
|
+
})),
|
|
292
|
+
}),
|
|
293
|
+
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
294
|
+
const reply = (text) => ({ content: [{ type: "text", text }], details: {} });
|
|
295
|
+
const module = params.module !== undefined && params.module.trim() !== "" ? basename(params.module.trim(), ".plain") : undefined;
|
|
296
|
+
if (params.key === undefined || params.key.trim() === "")
|
|
297
|
+
return reply(describeSettings(cwd, options.rules));
|
|
298
|
+
const setting = settingOf(params.key, options.rules());
|
|
299
|
+
if (setting === undefined) {
|
|
300
|
+
const key = params.key.trim().toLowerCase();
|
|
301
|
+
const near = settings(options.rules()).filter((entry) => entry.key.includes(key)).map((entry) => entry.key);
|
|
302
|
+
throw new Error(`No setting ${params.key}.${near.length > 0 ? ` Did you mean ${near.slice(0, 5).join(", ")}?` : " Call settings with no key for every one."}`);
|
|
303
|
+
}
|
|
304
|
+
if (params.value === undefined)
|
|
305
|
+
return reply(describeSetting(cwd, setting));
|
|
306
|
+
if (setting.personOnly === true) {
|
|
307
|
+
throw new Error(`${setting.key} is the user's to change, not yours: ${setting.about}. Nothing was written. Tell them what it would change, ` +
|
|
308
|
+
`and that /settings ${setting.key} changes it.`);
|
|
309
|
+
}
|
|
310
|
+
if (module !== undefined && setting.projectOnly === true)
|
|
311
|
+
throw new Error(`${setting.key} is the whole project's: it is set in ${CONFIG_FILE} alone, never in a module's file. Nothing was written.`);
|
|
312
|
+
const value = writtenValue(setting, params.value, cwd, ctx);
|
|
313
|
+
return reply(await change(setting, value, ctx, module));
|
|
314
|
+
},
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
/** What a setting is set to, read from what the chat gave: a model's name resolved, a path kept inside the project - or why not. */
|
|
318
|
+
function writtenValue(setting, given, cwd, ctx) {
|
|
319
|
+
let typed = given.trim();
|
|
320
|
+
if (setting.kind === "model" && !/^(unset|default|none|-)$/i.test(typed)) {
|
|
321
|
+
const colon = typed.lastIndexOf(":");
|
|
322
|
+
const level = colon !== -1 && THINKING_LEVELS.includes(typed.slice(colon + 1)) ? typed.slice(colon + 1) : undefined;
|
|
323
|
+
const name = level !== undefined ? typed.slice(0, colon) : typed;
|
|
324
|
+
const resolved = resolveModel(name, ctx.modelRegistry);
|
|
325
|
+
if (!resolved.ok)
|
|
326
|
+
throw new Error(`Nothing was written.\n${describeResolution(resolved)}`);
|
|
327
|
+
typed = `${resolved.model}${level !== undefined ? `:${level}` : ""}`;
|
|
328
|
+
}
|
|
329
|
+
if (setting.kind === "path" && !/^(unset|default|none|-)$/i.test(typed)) {
|
|
330
|
+
const inside = relative(cwd, resolve(cwd, typed));
|
|
331
|
+
if (inside.startsWith("..") || isAbsolute(inside))
|
|
332
|
+
throw new Error(`${setting.key} takes a path inside the project, from its root - ${typed} is outside it. Nothing was written.`);
|
|
333
|
+
}
|
|
334
|
+
const parsed = parseValue(setting, typed);
|
|
335
|
+
if ("error" in parsed)
|
|
336
|
+
throw new Error(`${parsed.error} Nothing was written.`);
|
|
337
|
+
return "unset" in parsed ? undefined : parsed.value;
|
|
338
|
+
}
|
|
339
|
+
/** Every setting, as the chat is told them: what each is in config.turri.yaml, what each module's file sets over it. */
|
|
340
|
+
function describeSettings(cwd, rules) {
|
|
341
|
+
const text = readConfigText(cwd);
|
|
342
|
+
const all = settings(rules());
|
|
343
|
+
const lines = all
|
|
344
|
+
.filter((setting) => !setting.key.startsWith("models.") || currentValue(text, setting.key) !== undefined)
|
|
345
|
+
.map((setting) => `- ${listLine(setting, text)}${setting.personOnly === true ? " - the user's to change" : ""}`);
|
|
346
|
+
const modules = moduleConfigsOf(cwd).map((module) => {
|
|
347
|
+
const own = readModuleConfigText(cwd, module);
|
|
348
|
+
const set = all.filter((setting) => currentValue(own, setting.key) !== undefined).map((setting) => `${setting.key}: ${shownValue(currentValue(own, setting.key))}`);
|
|
349
|
+
return `${moduleConfigFile(module)}, over it for ${module}.plain and the modules built on it: ${set.length > 0 ? set.join(", ") : "nothing"}`;
|
|
350
|
+
});
|
|
351
|
+
return [`${CONFIG_FILE}:`, ...lines, ...(modules.length > 0 ? ["", ...modules] : []), "", "models.<role> not listed are unset: each role takes default's, then coding-model's."].join("\n");
|
|
352
|
+
}
|
|
353
|
+
/** One setting, as the chat is told it: what it does, what it takes, what it is in each file. */
|
|
354
|
+
function describeSetting(cwd, setting) {
|
|
355
|
+
const now = currentValue(readConfigText(cwd), setting.key);
|
|
356
|
+
const takes = setting.kind === "boolean"
|
|
357
|
+
? "true or false"
|
|
358
|
+
: setting.kind === "model"
|
|
359
|
+
? "a model, provider/model-id[:thinking]"
|
|
360
|
+
: setting.kind === "path"
|
|
361
|
+
? "a path from the project root"
|
|
362
|
+
: setting.kind === "list"
|
|
363
|
+
? `a list${setting.options !== undefined ? ` of ${setting.options.join(", ")}` : ""}`
|
|
364
|
+
: setting.options !== undefined
|
|
365
|
+
? `${setting.kind === "number" ? "a number - e.g. " : "one of "}${setting.options.join(", ")}`
|
|
366
|
+
: `a ${setting.kind}`;
|
|
367
|
+
const modules = setting.projectOnly === true ? [] : moduleConfigsOf(cwd).flatMap((module) => {
|
|
368
|
+
const own = currentValue(readModuleConfigText(cwd, module), setting.key);
|
|
369
|
+
return own !== undefined ? [`${moduleConfigFile(module)}: ${shownValue(own)}`] : [];
|
|
370
|
+
});
|
|
371
|
+
return [
|
|
372
|
+
`${setting.key} - ${setting.about}.`,
|
|
373
|
+
`Takes ${takes}; unset: ${setting.unset}.`,
|
|
374
|
+
`${CONFIG_FILE}: ${now === undefined ? "unset" : shownValue(now)}${modules.length > 0 ? `; ${modules.join("; ")}` : ""}.`,
|
|
375
|
+
...(setting.personOnly === true ? ["The user's to change, with /settings - not yours."] : []),
|
|
376
|
+
...(setting.projectOnly === true ? [`The whole project's: set in ${CONFIG_FILE} alone.`] : []),
|
|
377
|
+
].join("\n");
|
|
247
378
|
}
|
package/dist/setup.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare function checkProject(project: string, machine?: {
|
|
|
38
38
|
jdk?: () => boolean | Promise<boolean>;
|
|
39
39
|
}): Promise<Check[]>;
|
|
40
40
|
/**
|
|
41
|
-
* In a project: each model its config names -
|
|
41
|
+
* In a project: each model its config.turri.yaml names - or the module config pinned, its file's over it - tried with one short
|
|
42
42
|
* request. A model that answers is ready; one that does not says what the provider said, and what to do about it.
|
|
43
43
|
*/
|
|
44
44
|
export declare function checkProjectModels(project: string, access?: ModelAccess): Promise<Check[]>;
|
|
@@ -77,7 +77,7 @@ export interface ClaudeCodeProbe {
|
|
|
77
77
|
*/
|
|
78
78
|
export declare function checkClaudeSubscription(project: string, env?: NodeJS.ProcessEnv, probe?: ClaudeCodeProbe): Promise<Check[]>;
|
|
79
79
|
/**
|
|
80
|
-
* The base folders the project's config names - its own, and each
|
|
80
|
+
* The base folders the project's config names - its own, and each module's own file's - each there with its files, or not: a codebase
|
|
81
81
|
* that requires nothing starts from one, and its first pulse stops when it is not there. Nothing when none is named.
|
|
82
82
|
*/
|
|
83
83
|
export declare function checkBaseFolders(project: string): Promise<Check[]>;
|
package/dist/setup.js
CHANGED
|
@@ -10,7 +10,7 @@ import { fetchLatest, newerThan, turrisOnPath, versionFindings } from "./turri-v
|
|
|
10
10
|
import { sandboxAvailable, sandboxWithAsync } from "./regenerate/os-sandbox.js";
|
|
11
11
|
import { findTestScripts, onThisMachine } from "./regenerate/test-scripts.js";
|
|
12
12
|
import { configKeyOptions, parseArgs } from "./cli-options.js";
|
|
13
|
-
import { CONFIG_FILE, hasProjectConfig, readProjectConfig,
|
|
13
|
+
import { CONFIG_FILE, hasProjectConfig, readProjectConfig, moduleConfigFile, configModuleOf, moduleConfigsOf } from "./config.js";
|
|
14
14
|
import { checkModels, modelsInUse, piModelAccess } from "./model-check.js";
|
|
15
15
|
import { bedrockRegionFor, describeBedrockRegion, regionInGeography } from "./bedrock-region.js";
|
|
16
16
|
import { baseFilesAsync } from "./regenerate/base-folder.js";
|
|
@@ -181,11 +181,11 @@ function checkGlobal() {
|
|
|
181
181
|
];
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
* In a project: each model its config names -
|
|
184
|
+
* In a project: each model its config.turri.yaml names - or the module config pinned, its file's over it - tried with one short
|
|
185
185
|
* request. A model that answers is ready; one that does not says what the provider said, and what to do about it.
|
|
186
186
|
*/
|
|
187
187
|
export async function checkProjectModels(project, access) {
|
|
188
|
-
const used = modelsInUse(readProjectConfig(project,
|
|
188
|
+
const used = modelsInUse(readProjectConfig(project, configModuleOf(project)));
|
|
189
189
|
if (used.length === 0) {
|
|
190
190
|
return [{ level: "missing", name: "Models", detail: "config.turri.yaml names none", fix: "turri init-config writes the two models - or name them here: --harness-model, --coding-model" }];
|
|
191
191
|
}
|
|
@@ -262,7 +262,7 @@ const claudeCodeProbe = (project) => ({
|
|
|
262
262
|
* Max subscription, and nothing in the environment it refuses. Nothing when no model is a claude-code one.
|
|
263
263
|
*/
|
|
264
264
|
export async function checkClaudeSubscription(project, env = process.env, probe = claudeCodeProbe(project)) {
|
|
265
|
-
const configs = [readProjectConfig(project), ...
|
|
265
|
+
const configs = [readProjectConfig(project), ...moduleConfigsOf(project).map((module) => readProjectConfig(project, module))];
|
|
266
266
|
const named = [...new Set(configs.flatMap((config) => modelsInUse(config)).filter((used) => used.spec.startsWith("claude-code/")).map((used) => used.spec))];
|
|
267
267
|
if (named.length === 0)
|
|
268
268
|
return [];
|
|
@@ -290,15 +290,15 @@ export async function checkClaudeSubscription(project, env = process.env, probe
|
|
|
290
290
|
return [{ level: "ok", name, detail: `pi-claude-code installed, Claude Code signed in to ${status.subscriptionType} - for ${named.join(", ")}` }];
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
|
-
* The base folders the project's config names - its own, and each
|
|
293
|
+
* The base folders the project's config names - its own, and each module's own file's - each there with its files, or not: a codebase
|
|
294
294
|
* that requires nothing starts from one, and its first pulse stops when it is not there. Nothing when none is named.
|
|
295
295
|
*/
|
|
296
296
|
export async function checkBaseFolders(project) {
|
|
297
297
|
const named = new Map();
|
|
298
|
-
for (const [
|
|
298
|
+
for (const [module, config] of [[undefined, readProjectConfig(project)], ...moduleConfigsOf(project).map((module) => [module, readProjectConfig(project, module)])]) {
|
|
299
299
|
if (config.baseFolder === undefined)
|
|
300
300
|
continue;
|
|
301
|
-
named.set(config.baseFolder, [...(named.get(config.baseFolder) ?? []),
|
|
301
|
+
named.set(config.baseFolder, [...(named.get(config.baseFolder) ?? []), module === undefined ? CONFIG_FILE : moduleConfigFile(module)]);
|
|
302
302
|
}
|
|
303
303
|
return Promise.all([...named].map(async ([folder, files]) => {
|
|
304
304
|
const path = resolve(project, folder);
|
package/docs/README.md
CHANGED
|
@@ -21,7 +21,7 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
21
21
|
| which model codes, and how to change it | [using](using.md#choosing-a-model), [the project config](config.md#models) |
|
|
22
22
|
| how to run turri on my Claude Pro, Max or Team subscription instead of an API key | [a Claude subscription](claude-subscription.md) |
|
|
23
23
|
| what `config.turri.yaml` can set, and what happens without it | [the project config](config.md) |
|
|
24
|
-
| how a backend and a frontend on different stacks share one project | [
|
|
24
|
+
| how a backend and a frontend on different stacks share one project | [a module's own config](config.md#a-modules-own-config) |
|
|
25
25
|
| which ready-made stacks \*\*\*plain can import - a FastAPI backend, a React frontend | [the standard library](authoring-plain.md#the-standard-library) |
|
|
26
26
|
| everything an agent was sent and did, to debug it | [using](using.md#agent-logs) |
|
|
27
27
|
| how to regenerate \*\*\*plain overnight, and resume it | [running unattended](headless.md) |
|
|
@@ -30,7 +30,7 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
30
30
|
| which skill does what | [authoring \*\*\*plain](authoring-plain.md#the-skills) |
|
|
31
31
|
| what happens when \*\*\*plain changes | [regenerating the code](regenerating.md#when-plain-changes) |
|
|
32
32
|
| why a test was not allowed to be deleted | [regenerating the code](regenerating.md#the-tests-must-actually-pass) |
|
|
33
|
-
| how to try what is built, and what
|
|
33
|
+
| how to try what is built, and what a launch may install | [launch](launch.md) |
|
|
34
34
|
| what the agents can and cannot reach | [the sandbox](sandbox.md) |
|
|
35
35
|
| how skill review gates and judges work | [skills and gates](skills-and-gates.md) |
|
|
36
36
|
| how the parser matches the reference implementation | [the \*\*\*plain parser](parser.md) |
|
|
@@ -46,8 +46,8 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
46
46
|
| [Chats](chats.md) | several chats in one session: what each keeps and what they share, `/chat` and its keys, `turri --continue` and `.turri/chats.json` |
|
|
47
47
|
| [The sentinel](sentinel.md) | the chat every finished pulse goes to: what it checks and tests, its notices and how to answer them, what it may do, closing it, its model, in a host |
|
|
48
48
|
| [A Claude subscription](claude-subscription.md) | running every agent on a Claude Pro, Max or Team subscription through Claude Code: setting it up, its models, checking it yourself, in turri-desktop, its limits, when it does not work |
|
|
49
|
-
| [The project config](config.md) | `config.turri.yaml` and
|
|
50
|
-
| [
|
|
49
|
+
| [The project config](config.md) | `config.turri.yaml` and a module's own `config.turri.<module>.yaml`: where they are read from, every key, models and their inheritance, conformance, the testing scripts, which file builds a module, the old `config.yaml` |
|
|
50
|
+
| [Launch](launch.md) | trying what is built: the launch track, a commit in dist/<module>, starting it on your machine, after every pulse, `turri launch` |
|
|
51
51
|
| [Running unattended](headless.md) | regenerating overnight or in CI: before you leave it, the command, the results, resuming, rebuilding one functionality |
|
|
52
52
|
| [Authoring \*\*\*plain](authoring-plain.md) | a \*\*\*plain project, what \*\*\*plain is made of, the rules, writing \*\*\*plain with the agent, the skills, checking \*\*\*plain |
|
|
53
53
|
| [Regenerating](regenerating.md) | where things go, one job, a whole module and how its work is cut into jobs, each job's cases, \*\*\*plain changes, conformance tests, the two records of what is built |
|
package/docs/chats.md
CHANGED
|
@@ -8,20 +8,19 @@ Each chat has its own:
|
|
|
8
8
|
|
|
9
9
|
- **history** - what was said in it, and nothing said in another; a chat asked about another's says so and asks;
|
|
10
10
|
- **turns** - a hidden chat keeps working, and starts a turn of its own when a pulse it asked for ends;
|
|
11
|
-
- **model and thinking level** - [pi](https://pi.dev)'s `/model`, and `/
|
|
12
|
-
- **stack** - `/stack` and the chat's `stack` tool choose it for that chat alone; a new chat starts with `--stack`'s, or none (see [stacks](config.md#stacks));
|
|
11
|
+
- **model and thinking level** - [pi](https://pi.dev)'s `/model`, and `/settings harness-model` in that chat;
|
|
13
12
|
- **questions** - what it asks waits in it until you look at it.
|
|
14
13
|
|
|
15
14
|
The session's, shared by every chat:
|
|
16
15
|
|
|
17
16
|
- **the pulses and their plan** - one job registry and one work loop on the project: a pulse any chat starts is in every chat's side panel and `pulses`, and two chats asking for the same module get one plan, not two;
|
|
18
|
-
- **the coding model**
|
|
17
|
+
- **the coding model** given with `--coding-model`, and `parallel-jobs`;
|
|
19
18
|
- **steering** - what `steer` was told, every plan follows;
|
|
20
19
|
- **conformance** chosen with `conform`, module by module;
|
|
21
|
-
- **what
|
|
20
|
+
- **what launches started** - it runs until turri ends or `/halt launched <name>`, whatever chats are opened or closed - and the launch track;
|
|
22
21
|
- **the ledger** - one run, each event with the id of the chat its work was asked for in (`chat`), and `chat.opened` and `chat.closed` as they happen.
|
|
23
22
|
|
|
24
|
-
A pulse's end goes to the [sentinel](sentinel.md) - a chat of turri's own, opened in the background with the first pulse that finishes, once you said to start it under `sentinel: ask` - which checks it, tests what was
|
|
23
|
+
A pulse's end goes to the [sentinel](sentinel.md) - a chat of turri's own, opened in the background with the first pulse that finishes, once you said to start it under `sentinel: ask` - which checks it, tests what was launched, and puts what needs you as a notice in the chat you are in. That chat shows the pulse's end; its agent is told of a pulse that landed, to tell you so and what the sentinel is doing with it - and when the sentinel is done with any pulse, what it found - and nothing more - and not of one that went wrong: the sentinel's notice is what it hears of that. With `sentinel: false`, a pulse's end is told to the chat that asked for it instead, shown or not - its agent reacts to it there; the chat's mark in the strip says it has something new. When that chat has been closed, the chat shown is told. Closing a chat stops its turn, never its pulses.
|
|
25
24
|
|
|
26
25
|
## In the terminal
|
|
27
26
|
|
|
@@ -61,7 +60,7 @@ turri records which chats are open in `.turri/chats.json` - a run a session, eac
|
|
|
61
60
|
- **a session's chats** are kept until five newer sessions have recorded theirs, then deleted with their record;
|
|
62
61
|
- a session still running is never reopened by another turri.
|
|
63
62
|
|
|
64
|
-
In [debug mode](config.md#debug-mode) nothing is deleted.
|
|
63
|
+
In [debug mode](config.md#debug-mode) nothing is deleted.
|
|
65
64
|
|
|
66
65
|
## Where there is one chat
|
|
67
66
|
|
|
@@ -44,7 +44,7 @@ turri does not depend on the extension: it finds it as pi does, once you have in
|
|
|
44
44
|
coding-model: claude-code/claude-sonnet-5:low # it writes the code
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
For a project that has a `config.turri.yaml` already, it sets those two and leaves everything else as it was; or change them yourself, or with `/
|
|
47
|
+
For a project that has a `config.turri.yaml` already, it sets those two and leaves everything else as it was; or change them yourself, or with `/settings harness-model claude-code/claude-opus-5-5:medium` in the chat.
|
|
48
48
|
|
|
49
49
|
Two settings of the extension's own, read from the environment: `PI_CLAUDE_CODE_COMMAND`, the Claude Code to run when it is not `claude` on the PATH, and `PI_CLAUDE_CODE_CONFIG_DIR`, a Claude Code configuration folder of its own - another account's sign-in, say.
|
|
50
50
|
|
|
@@ -103,7 +103,7 @@ Each step says what you should see; the first one that does not is where it stop
|
|
|
103
103
|
turri regenerate app.plain
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
The pulse's coding agent runs on `claude-code/claude-sonnet-5`, and the pulse lands as on any model. To watch it work, run it in [debug mode](config.md#debug-mode) (`--debug`): the pulse's log in `.turri/jobs/` names each agent's model and shows the tools it called. In the chat,
|
|
106
|
+
The pulse's coding agent runs on `claude-code/claude-sonnet-5`, and the pulse lands as on any model. To watch it work, run it in [debug mode](config.md#debug-mode) (`--debug`): the pulse's log in `.turri/jobs/` names each agent's model and shows the tools it called. In the chat, ask which model the code is regenerated on: the `settings` tool says, and where it is set.
|
|
107
107
|
|
|
108
108
|
## In turri-desktop
|
|
109
109
|
|