@turri-dev/cli 0.2.4-next.bc1fc47 → 0.2.4-next.efe96fe

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +3 -4
  2. package/dist/bedrock-region.js +3 -3
  3. package/dist/chat-models.d.ts +1 -1
  4. package/dist/chat-models.js +1 -1
  5. package/dist/chat-scope.d.ts +1 -3
  6. package/dist/chats.d.ts +2 -2
  7. package/dist/chats.js +3 -3
  8. package/dist/cli.js +6 -23
  9. package/dist/config-edit.d.ts +20 -8
  10. package/dist/config-edit.js +29 -21
  11. package/dist/config.d.ts +43 -50
  12. package/dist/config.js +122 -104
  13. package/dist/conform-cli.js +1 -1
  14. package/dist/conformance-switch.d.ts +7 -6
  15. package/dist/conformance-switch.js +16 -16
  16. package/dist/extension.d.ts +1 -1
  17. package/dist/extension.js +82 -200
  18. package/dist/host-session.d.ts +2 -2
  19. package/dist/host-session.js +2 -2
  20. package/dist/host.d.ts +1 -1
  21. package/dist/host.js +3 -3
  22. package/dist/init-config.js +1 -1
  23. package/dist/loop-tools.d.ts +9 -13
  24. package/dist/loop-tools.js +32 -37
  25. package/dist/parse-cli.js +2 -2
  26. package/dist/pi-launch.js +3 -0
  27. package/dist/pi-settings.d.ts +4 -0
  28. package/dist/pi-settings.js +39 -0
  29. package/dist/pi.js +3 -3
  30. package/dist/plain/check.d.ts +1 -1
  31. package/dist/plain/check.js +3 -1
  32. package/dist/plain-files.js +4 -4
  33. package/dist/regenerate/agent-env.d.ts +1 -1
  34. package/dist/regenerate/agent-env.js +3 -3
  35. package/dist/regenerate/agent-shell.js +2 -2
  36. package/dist/regenerate/base-folder.d.ts +2 -2
  37. package/dist/regenerate/base-folder.js +1 -1
  38. package/dist/regenerate/jobs.d.ts +2 -2
  39. package/dist/regenerate/jobs.js +10 -10
  40. package/dist/regenerate/ledger.d.ts +1 -1
  41. package/dist/regenerate/loop.d.ts +3 -3
  42. package/dist/regenerate/loop.js +27 -23
  43. package/dist/regenerate/model-names.d.ts +33 -0
  44. package/dist/regenerate/{engine.js → model-names.js} +2 -28
  45. package/dist/regenerate/paths.d.ts +1 -1
  46. package/dist/regenerate/paths.js +2 -2
  47. package/dist/regenerate/scripts-being-written.d.ts +4 -4
  48. package/dist/regenerate/scripts-being-written.js +3 -3
  49. package/dist/regenerate/test-scripts.d.ts +2 -1
  50. package/dist/regenerate/test-scripts.js +33 -23
  51. package/dist/regenerate/testing-steps.d.ts +6 -6
  52. package/dist/regenerate/testing-steps.js +8 -8
  53. package/dist/{config-command.d.ts → settings.d.ts} +13 -8
  54. package/dist/{config-command.js → settings.js} +155 -24
  55. package/dist/setup.d.ts +2 -2
  56. package/dist/setup.js +7 -7
  57. package/docs/README.md +2 -2
  58. package/docs/chats.md +3 -4
  59. package/docs/claude-subscription.md +2 -2
  60. package/docs/config.md +50 -38
  61. package/docs/development.md +1 -1
  62. package/docs/headless.md +1 -2
  63. package/docs/hosting.md +6 -6
  64. package/docs/parser.md +1 -1
  65. package/docs/regenerating.md +9 -9
  66. package/docs/sentinel.md +2 -2
  67. package/docs/skills-and-gates.md +1 -2
  68. package/docs/using.md +8 -17
  69. package/genome/rules/project-model.md +2 -1
  70. package/genome/rules/turri-regeneration.md +2 -1
  71. package/genome/skills/implement-conformance-testing-script/SKILL.md +2 -2
  72. package/genome/skills/implement-unit-testing-script/SKILL.md +3 -3
  73. package/package.json +1 -1
  74. package/dist/regenerate/engine.d.ts +0 -52
  75. package/dist/stacks.d.ts +0 -13
  76. package/dist/stacks.js +0 -96
package/dist/extension.js CHANGED
@@ -9,7 +9,7 @@ import { allocateImageId, Box, getCapabilities, getPngDimensions, isKeyRelease,
9
9
  import { defineTool, getMarkdownTheme, UserMessageComponent } from "@earendil-works/pi-coding-agent";
10
10
  import { Type } from "typebox";
11
11
  import { CODING_MODEL_ENV } from "./chat-models.js";
12
- import { AGENT_ROLES, chosenStack, CONFIG_FILE, configForSpec, stackForModule, hasProjectConfig, LEGACY_CONFIG_FILE, projectConfigFile, stackConfigFileIn, stackOf, stacksOf, withStack, modelOnly, modelSpec, projectModels, readProjectConfig, roleModel, splitModelSpec, unknownConfigLines } from "./config.js";
12
+ import { AGENT_ROLES, CONFIG_FILE, configForSpec, readConfigFile, configModuleFor, hasProjectConfig, LEGACY_CONFIG_FILE, projectConfigFile, moduleConfigFile, moduleConfigFileIn, configModuleOf, moduleConfigsOf, withConfigModule, modelOnly, modelSpec, projectModels, readProjectConfig, roleModel, splitModelSpec, unknownConfigLines } from "./config.js";
13
13
  import { projectDirOf, skillRunDir } from "./regenerate/paths.js";
14
14
  import { sweepOrphanedGroups } from "./regenerate/shell.js";
15
15
  import { readScript, scriptAgainstMachine, stackOnMachine, toolchainsBlock } from "./stack.js";
@@ -21,7 +21,7 @@ import { bannerWarnings } from "./turri-versions.js";
21
21
  import { CONFORMANCE_OFF_REFUSAL, conformanceBlock, conformanceTestsOn, conformanceTestsOnIn, turnOnConformanceTests } from "./conformance-switch.js";
22
22
  import { BACKGROUND_NOTE, doneLine, failedTask, ownChanges, runDetails, skillRunDelivery, startedText } from "./background-skills.js";
23
23
  import { createAskUserTool } from "./tools.js";
24
- import { asksFromScratch, asksWholeChain, driftTool, endWait, fromWorkingDir, haltTool, loopReply, startWait, toldByWaitingCall, MODEL_PARAM, regenerateTool, STACK_PARAM, stopJob, WAIT_PARAM, withCallStack, WORKING_DIR_PARAM } from "./loop-tools.js";
24
+ import { asksFromScratch, asksWholeChain, driftTool, endWait, fromWorkingDir, haltTool, loopReply, startWait, toldByWaitingCall, MODEL_PARAM, regenerateTool, stopJob, WAIT_PARAM, whenBuildable, WORKING_DIR_PARAM } from "./loop-tools.js";
25
25
  import { createWebTools } from "./regenerate/web.js";
26
26
  import { describeGates, interruptedRun, runSkill } from "./genome.js";
27
27
  import { unqueue } from "./chat-waiting.js";
@@ -33,7 +33,7 @@ import { runReleaseAgent } from "./release-agent.js";
33
33
  import { createSteeringStore, EVERY_MODULE, moduleNameOf, queueSectionOf, steeringFor } from "./regenerate/steer.js";
34
34
  import { askedForCommandLine, refusal, selfInvocation, TOOLS_NOT_CLI } from "./self-invocation.js";
35
35
  import { NEW_PROJECT } from "./new-project.js";
36
- import { describeChoices, describeResolution, modelFor, resolveModel } from "./regenerate/engine.js";
36
+ import { describeResolution, resolveModel } from "./regenerate/model-names.js";
37
37
  import { checkPlainFile, formatCheckResults } from "./plain/check.js";
38
38
  import { checkPlainTool } from "./parse-tool.js";
39
39
  import { changedFiles, projectFiles } from "./plain-files.js";
@@ -64,12 +64,11 @@ import { LOADING_PROVIDERS } from "./installed-providers.js";
64
64
  import { machineChange, machineChangeReason, writesPlain } from "./regenerate/command-check.js";
65
65
  import { beginCapture, captureConsole, describeCaptured, dropNoise } from "./quiet.js";
66
66
  import { loadRules, renderRulesBlock } from "./rules.js";
67
- import { registerTurriConfig, ruleNames } from "./config-command.js";
67
+ import { registerSettings, ruleNames } from "./settings.js";
68
68
  import { writeSetting } from "./config-edit.js";
69
69
  import { describeStdlib } from "./stdlib.js";
70
70
  import { DECLINED, peekKeyListener, runAsk } from "./ask.js";
71
71
  import { QuestionDialog } from "./question-dialog.js";
72
- import { registerStacks } from "./stacks.js";
73
72
  import { catalogueLine, chosenCommand, createCommandGate, startPicked, discoverSkills, leftOutNote, startedByCommandOnly } from "./skills.js";
74
73
  import { supersededByTurri } from "./chat-skills.js";
75
74
  import { conversationIdentity } from "./identity.js";
@@ -409,7 +408,7 @@ export function sessionLoop(session) {
409
408
  }
410
409
  /**
411
410
  * turri's extension, built into one chat of the session: its tools, commands and handlers run in the chat's scope -
412
- * its stack, its id on the pulses it asks for - on the session's job registry and work loop.
411
+ * its id on the pulses it asks for - on the session's job registry and work loop.
413
412
  */
414
413
  function turriExtension(api, session, link) {
415
414
  const pi = scopedToChat(api, link.scope);
@@ -557,7 +556,7 @@ function turriExtension(api, session, link) {
557
556
  // With them, the instruction to do turri's work with its tools rather than its command
558
557
  // line - enforced below, not only asked for.
559
558
  const rules = loadRules(join(PACKAGE_ROOT, "genome", "rules"), readProjectConfig(cwd).rulesOff ?? []);
560
- // Laid out again once rules-off changes - /turri-config changes it as turri runs - and the same block in between.
559
+ // Laid out again once rules-off changes - /settings changes it as turri runs - and the same block in between.
561
560
  let rulesKept = { off: (readProjectConfig(cwd).rulesOff ?? []).join(","), block: chatRulesBlock(rules) };
562
561
  const rulesBlock = () => {
563
562
  const off = readProjectConfig(cwd).rulesOff ?? [];
@@ -717,11 +716,9 @@ function turriExtension(api, session, link) {
717
716
  registerRegenerate(pi, cwd, jobs);
718
717
  registerDrift(pi, cwd, jobs);
719
718
  registerBind(pi, cwd, jobs, (plainFile) => turnOnConformance(session, plainFile));
720
- registerRenderModels(pi);
721
719
  registerDeploy(pi, cwd, jobs, deployStates.get(jobs) ?? createDeployState());
722
720
  registerSteering(pi, cwd);
723
721
  registerSideQuestions(pi, cwd, jobs);
724
- registerStacks(pi, cwd);
725
722
  // More chats beside this one, in the terminal: /chat, alt+n, alt+1…9 (chat-commands.ts).
726
723
  if (session.terminal)
727
724
  registerChats(pi, session);
@@ -753,17 +750,17 @@ function turriExtension(api, session, link) {
753
750
  if (backgroundSkillRuns.has(key)) {
754
751
  return { text: `${skill.name} is running in the background already; what it does comes back to this chat when it ends. Nothing new was started.`, details: { background: true, started: false } };
755
752
  }
756
- const model = skill.model === "coding" ? jobModel(ctx, "spec_changes", undefined, plainFile) : conversationModel(ctx);
757
- const stack = plainFile !== undefined ? stackForModule(plainFile) : chosenStack();
753
+ const model = skill.model === "coding" ? jobModel(ctx, undefined, plainFile) : conversationModel(ctx);
754
+ const configModule = plainFile !== undefined ? configModuleFor(plainFile) : undefined;
758
755
  const kind = scriptKindOfSkill(skill.name);
759
756
  const shown = plainFile !== undefined ? relative(cwd, plainFile) || basename(plainFile) : undefined;
760
757
  // While it writes a testing script, the modules that need it wait for it rather than fail for want of it.
761
- const written = kind !== undefined ? writingScript({ project: plainFile !== undefined ? projectDirOf(plainFile) : cwd, kind, ...(stack !== undefined ? { stack } : {}) }) : () => { };
758
+ const written = kind !== undefined ? writingScript({ project: plainFile !== undefined ? projectDirOf(plainFile) : cwd, kind, ...(configModule !== undefined ? { configModule } : {}) }) : () => { };
762
759
  const controller = new AbortController();
763
760
  backgroundSkillRuns.set(key, controller);
764
761
  const context = [
765
762
  conversationContext(ctx, params.context),
766
- shown !== undefined ? `It is for ${shown}${stack !== undefined ? `, on the stack ${stack}` : ""}.` : undefined,
763
+ shown !== undefined ? `It is for ${shown}${configModule !== undefined ? `, built with ${moduleConfigFile(configModule)} over ${CONFIG_FILE}` : ""}.` : undefined,
767
764
  BACKGROUND_NOTE,
768
765
  ]
769
766
  .filter((part) => part !== undefined && part.trim() !== "")
@@ -775,7 +772,7 @@ function turriExtension(api, session, link) {
775
772
  const end = (ended) => skillRunEnds.put(ended.ok
776
773
  ? { skill: skill.name, ok: true, line: doneLine(skill.name, ended.changed, kind), ...about }
777
774
  : { skill: skill.name, ok: false, line: `${skill.name} ${ended.why}.`, task: failedTask(skill.name, ended.why, ended.output, kind), ...about });
778
- void captureConsole(() => withStack(stack, () => runSkill({
775
+ void captureConsole(() => withConfigModule(configModule, () => runSkill({
779
776
  skillDir: skill.dir,
780
777
  signal: controller.signal,
781
778
  cwd,
@@ -847,7 +844,7 @@ function turriExtension(api, session, link) {
847
844
  description: "Start a new run even though an interrupted one exists here, discarding it.",
848
845
  })),
849
846
  plainFile: Type.Optional(Type.String({
850
- description: "The module the skill's work is for - its .plain file, e.g. backend.plain: a testing script is written for that module's stack, " +
847
+ description: "The module the skill's work is for - its .plain file, e.g. backend.plain: a testing script is written for that module, named in its config, " +
851
848
  "on its coding model. Omitted: the project's.",
852
849
  })),
853
850
  }),
@@ -1002,8 +999,8 @@ function turriExtension(api, session, link) {
1002
999
  // A testing script being written - here to its end, in print mode - holds the modules it is for, as in the background:
1003
1000
  // a pulse started meanwhile, by a regenerate called beside it, would run against the script as it was.
1004
1001
  const kind = scriptKindOfSkill(skill.name);
1005
- const stack = plainFile !== undefined ? stackForModule(plainFile) : chosenStack();
1006
- const written = kind !== undefined ? writingScript({ project: plainFile !== undefined ? projectDirOf(plainFile) : cwd, kind, ...(stack !== undefined ? { stack } : {}) }) : () => { };
1002
+ const configModule = plainFile !== undefined ? configModuleFor(plainFile) : undefined;
1003
+ const written = kind !== undefined ? writingScript({ project: plainFile !== undefined ? projectDirOf(plainFile) : cwd, kind, ...(configModule !== undefined ? { configModule } : {}) }) : () => { };
1007
1004
  const ended = () => {
1008
1005
  written();
1009
1006
  ran_();
@@ -1026,20 +1023,20 @@ function turriExtension(api, session, link) {
1026
1023
  push(` A: ${answer}`);
1027
1024
  recordExchange(pi, { skill: skill.name, question, answer, ...(said !== undefined && said.trim() !== "" ? { said: said.trim() } : {}) });
1028
1025
  }, (question) => askOnTheSide(pi, ctx, cwd, jobs, question), dialogs),
1029
- model: skill.model === "coding" ? jobModel(ctx, "spec_changes", undefined, plainFile) : conversationModel(ctx),
1026
+ model: skill.model === "coding" ? jobModel(ctx, undefined, plainFile) : conversationModel(ctx),
1030
1027
  // Renders queued by a step land in the same registry as everything else, so
1031
1028
  // pulses sees them without knowing a skill started them.
1032
1029
  // Asked per job as it is queued, so a model chosen mid-interview applies from then on.
1033
1030
  renderQueue: workLoopFor(jobs, cwd, ctx),
1034
1031
  // The person answers the skill's agent while it runs, so it can take "render these with ..." too.
1035
1032
  // parse too: a skill parses what it wrote with the same check the conversation has.
1036
- sharedTools: [setRenderModelTool(pi, ctx), checkPlainTool(cwd), ...createWebTools()],
1033
+ sharedTools: [checkPlainTool(cwd), ...createWebTools()],
1037
1034
  // The conversation's own regenerate, drift, halt and conform, on its loop: a skill waits for nothing, and regenerates on the model chosen.
1038
1035
  loopTools: [
1039
- regenerateTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named, work) => jobModel(ctx, work ?? "spec_changes", named, plainFile), wait: () => false }),
1036
+ regenerateTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named) => jobModel(ctx, named, plainFile), wait: () => false }),
1040
1037
  driftTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx) }),
1041
1038
  haltTool({ jobs, workLoop: () => workLoops.get(jobs)?.loop }),
1042
- conformTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named) => jobModel(ctx, "spec_changes", named, plainFile), wait: () => false }),
1039
+ conformTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named) => jobModel(ctx, named, plainFile), wait: () => false }),
1043
1040
  ],
1044
1041
  // The escalation becomes a real dialog - the host's own, when it has them. Without one there is nobody to ask,
1045
1042
  // so the gate stands.
@@ -1127,7 +1124,7 @@ function registerRegenerate(pi, cwd, jobs) {
1127
1124
  cwd,
1128
1125
  jobs,
1129
1126
  loop: (ctx) => workLoopFor(jobs, cwd, ctx),
1130
- model: (ctx, plainFile, named, work) => jobModel(ctx, work ?? "spec_changes", named, plainFile),
1127
+ model: (ctx, plainFile, named) => jobModel(ctx, named, plainFile),
1131
1128
  wait: (ctx, asked) => shouldWait(ctx.mode, asked),
1132
1129
  }));
1133
1130
  // /regenerate: the same as the tool, from the person - a module brought up to its spec as it is now, cut into pulses
@@ -1156,7 +1153,7 @@ function registerRegenerate(pi, cwd, jobs) {
1156
1153
  return;
1157
1154
  }
1158
1155
  const loop = workLoopFor(jobs, cwd, ctx);
1159
- const model = jobModel(ctx, again.length > 0 ? "functionalities" : "spec_changes", undefined, plainFile);
1156
+ const model = jobModel(ctx, undefined, plainFile);
1160
1157
  const request = { ...(model !== undefined ? { model } : {}), ...(guidance !== "" ? { guidance } : {}) };
1161
1158
  // Said at once, and kept in the chat: what follows takes a while - the planner is an agent - and the person sees it
1162
1159
  // began, not a chat that stays empty until the first pulse starts. The plan is said under it once it is made.
@@ -1171,8 +1168,8 @@ function registerRegenerate(pi, cwd, jobs) {
1171
1168
  const target = plainFile;
1172
1169
  void (async () => {
1173
1170
  try {
1174
- // Built with the stack chosen now - pinned to its pulses - or refused, a project of stacks built with none.
1175
- const statuses = await withCallStack(target, undefined, () => scratch
1171
+ // Refused when its config cannot be told, or would build it with no testing script.
1172
+ const statuses = await whenBuildable(target, () => scratch
1176
1173
  ? loop.fromScratch(target, { ...request, chain })
1177
1174
  : again.length > 0
1178
1175
  ? loop.regenerateAgain(target, again, request)
@@ -1338,7 +1335,7 @@ function registerBind(pi, cwd, jobs, turnOn) {
1338
1335
  cwd,
1339
1336
  jobs,
1340
1337
  loop: (ctx) => workLoopFor(jobs, cwd, ctx),
1341
- model: (ctx, plainFile, named) => jobModel(ctx, "spec_changes", named, plainFile),
1338
+ model: (ctx, plainFile, named) => jobModel(ctx, named, plainFile),
1342
1339
  wait: (ctx, asked) => shouldWait(ctx.mode, asked),
1343
1340
  }));
1344
1341
  // /conform: the same as the tool, from the person - a module's conformance tests written and run now, for the
@@ -1388,7 +1385,7 @@ function registerBind(pi, cwd, jobs, turnOn) {
1388
1385
  // ***plain alone, before anything is said.
1389
1386
  let refusal;
1390
1387
  try {
1391
- refusal = withCallStack(plainFile, undefined, () => conformanceRefusal(plainFile, funcIds.length > 0 ? funcIds : undefined));
1388
+ refusal = whenBuildable(plainFile, () => conformanceRefusal(plainFile, funcIds.length > 0 ? funcIds : undefined));
1392
1389
  }
1393
1390
  catch (error) {
1394
1391
  refusal = error instanceof Error ? error.message : String(error);
@@ -1398,7 +1395,7 @@ function registerBind(pi, cwd, jobs, turnOn) {
1398
1395
  return;
1399
1396
  }
1400
1397
  const module = basename(plainFile).replace(/\.plain$/, "");
1401
- const model = jobModel(ctx, "spec_changes", undefined, plainFile);
1398
+ const model = jobModel(ctx, undefined, plainFile);
1402
1399
  const starting = scratch !== undefined
1403
1400
  ? `Writing ${module}'s conformance tests${scratch === "chain" ? " and its whole chain's" : ""} again from scratch…`
1404
1401
  : `Starting ${funcIds.length > 0 ? `the conformance tests of ${funcIds.join(", ")}` : `${module}'s conformance tests`}…`;
@@ -1407,7 +1404,7 @@ function registerBind(pi, cwd, jobs, turnOn) {
1407
1404
  // In the background, as /regenerate: a codebase built on the module may be stopped and deleted first.
1408
1405
  void (async () => {
1409
1406
  try {
1410
- const statuses = await withCallStack(plainFile, undefined, () => workLoopFor(jobs, cwd, ctx).conformance(plainFile, {
1407
+ const statuses = await whenBuildable(plainFile, () => workLoopFor(jobs, cwd, ctx).conformance(plainFile, {
1411
1408
  ...(funcIds.length > 0 ? { funcIds } : {}),
1412
1409
  ...(model !== undefined ? { model } : {}),
1413
1410
  ...(separately ? { separately: true } : {}),
@@ -1449,7 +1446,7 @@ function conformTool(options) {
1449
1446
  "the tip of each chain it is built in, as regenerate from scratch does its code. A " +
1450
1447
  "functional spec with no scenarios - no test plain file - is refused: there is nothing to test until scenarios " +
1451
1448
  "are written. So is one the spec does not have, and a module with scenarios that skipped a step of adding tests - " +
1452
- "no test reqs, or no conformance testing script for its stack: the refusal names the next step. While conformance tests " +
1449
+ "no test reqs, or no conformance testing script: the refusal names the next step. While conformance tests " +
1453
1450
  "are off it is refused too: they make each change take about twice as long, and turning them on is the person's - " +
1454
1451
  "with /conform - never yours.",
1455
1452
  promptSnippet: "conform: write and run the conformance tests of functional specs with scenarios",
@@ -1472,7 +1469,6 @@ function conformTool(options) {
1472
1469
  '"chain": written again from nothing - every functional spec of the chain\'s tests',
1473
1470
  })),
1474
1471
  one_by_one: Type.Optional(Type.Boolean({ description: "Only when the user asks for it: a pulse a functional spec. Omitted: every functional spec tested in one pulse, as far as the size guardrail lets" })),
1475
- stack: STACK_PARAM,
1476
1472
  model: MODEL_PARAM,
1477
1473
  wait: WAIT_PARAM,
1478
1474
  }),
@@ -1480,7 +1476,7 @@ function conformTool(options) {
1480
1476
  const params = fromWorkingDir(cwd, given);
1481
1477
  const plainFile = resolve(params.base, params.plain_file);
1482
1478
  refuseTestPlainFile(plainFile);
1483
- return withCallStack(plainFile, params.stack, async () => {
1479
+ return whenBuildable(plainFile, async () => {
1484
1480
  // Off: the person's to turn on, never the chat's - it is told to say why it wants them, and they decide.
1485
1481
  if (!conformanceTestsOn(plainFile))
1486
1482
  return { content: [{ type: "text", text: CONFORMANCE_OFF_REFUSAL }], details: { refused: true } };
@@ -1507,9 +1503,9 @@ function conformTool(options) {
1507
1503
  },
1508
1504
  });
1509
1505
  }
1510
- /** The config a spec is built with - its project's, with the chosen stack's over it - or, with no spec, the session folder's. */
1506
+ /** The config a spec is built with - its project's, with its module's own file over it - or, with no spec, the session folder's. */
1511
1507
  function configOf(plainFile) {
1512
- return plainFile !== undefined ? configForSpec(resolve(process.cwd(), plainFile)) : readProjectConfig(process.cwd(), stackOf(process.cwd()));
1508
+ return plainFile !== undefined ? configForSpec(resolve(process.cwd(), plainFile)) : readProjectConfig(process.cwd(), configModuleOf(process.cwd()));
1513
1509
  }
1514
1510
  /**
1515
1511
  * How many jobs the chat runs at once: `parallel-jobs:` in the session folder's config.turri.yaml - the only place it
@@ -1619,74 +1615,77 @@ export function projectConfigBlock(root) {
1619
1615
  if (projects.length === 0)
1620
1616
  return "";
1621
1617
  const describe = (dir) => {
1622
- const stacks = stacksOf(dir);
1623
- const chosen = stackOf(dir);
1618
+ const modules = moduleConfigsOf(dir);
1624
1619
  const where = dir === root ? "" : ` (paths relative to ${relative(root, dir)}/)`;
1625
1620
  const at = (name) => (dir === root ? name : `${relative(root, dir)}/${name}`);
1626
1621
  return [
1627
- ...settings(readProjectConfig(dir), withStack(undefined, () => findTestScripts(dir)), dir === root ? `${projectConfigFile(dir)}, for the specs here:` : `${relative(root, dir)}/${projectConfigFile(dir)}, for the specs in ${relative(root, dir)}/ - built in ${relative(root, dir)}/plain_modules:`, where, stacks.length > 0 ? "project of stacks" : "project"),
1628
- ...(stacks.length > 0
1629
- ? ["", `Stacks: ${stacks.join(", ")} - chosen now: ${chosen ?? "none, so the project's file alone"}. Each module is built with the stack of its part, pinned to its pulses whatever is chosen after: a stack named after the module is its own - backend.plain is built with config.turri.backend.yaml - with nothing to choose. For a module whose stack has another name, pass it as stack to regenerate, conform and pulses. Choose one for this chat with the stack tool only when the user asks.`]
1630
- : []),
1631
- // A stack: its file over the project's, for everything built while it is chosen.
1632
- ...stacks.flatMap((stack) => [
1622
+ ...settings(readProjectConfig(dir), withConfigModule(undefined, () => findTestScripts(dir)), dir === root ? `${projectConfigFile(dir)}, for the specs here:` : `${relative(root, dir)}/${projectConfigFile(dir)}, for the specs in ${relative(root, dir)}/ - built in ${relative(root, dir)}/plain_modules:`, where, modules.length > 0 ? "project of module files" : "project"),
1623
+ // A module's own file: over the project's, for it and every module built on it that has no file of its own.
1624
+ ...modules.flatMap((module) => [
1633
1625
  "",
1634
- ...settings(readProjectConfig(dir, stack), withStack(stack, () => findTestScripts(dir)), `${at(stackConfigFileIn(dir, stack))}, over ${projectConfigFile(dir)}, for everything built while the stack ${stack} is chosen${chosen === stack ? " - as it is now" : ""}:`, where, "stack"),
1626
+ ...settings(readProjectConfig(dir, module), withConfigModule(module, () => findTestScripts(dir)), `${at(moduleConfigFileIn(dir, module))}, over ${projectConfigFile(dir)}, for ${module}.plain and every module built on it that has no file of its own - what it sets itself, and the testing scripts it builds with; the rest is ${projectConfigFile(dir)}'s:`, where, "module", readConfigFile(join(dir, moduleConfigFileIn(dir, module)))),
1635
1627
  ]),
1636
1628
  ];
1637
1629
  };
1638
1630
  const settings = (config, scripts, heading, where,
1639
- /** The project's file, and whether it has stacks - whose scripts are theirs - or a stack's. */
1640
- of) => {
1641
- const perModule = of === "project of stacks";
1631
+ /** The project's file, and whether modules have files of their own - whose scripts are theirs - or a module's. */
1632
+ of,
1633
+ /** A module's file as written: only what it sets itself is said - an inherited setting said again reads as its own. */
1634
+ own) => {
1635
+ const perModule = of === "project of module files";
1636
+ const sets = (set) => own === undefined || set;
1642
1637
  return [
1643
1638
  heading,
1644
1639
  ...[
1645
- config.module !== undefined && of !== "stack" ? `- module: ${config.module}${where} - the module to build when the user does not name one.` : undefined,
1646
- of !== "stack"
1640
+ config.module !== undefined && of !== "module" ? `- module: ${config.module}${where} - the module to build when the user does not name one.` : undefined,
1641
+ of !== "module"
1647
1642
  ? "- conformance tests: written for every functional spec with scenarios - the conformance and acceptance scenarios of its test plain file - once the module's code is built, before anything is built on it. A functional spec with an empty test plain file is not tested. To have one tested, write its scenarios with the file tools, then call regenerate."
1648
1643
  : undefined,
1649
- config.review === true
1650
- ? "- review: true - the code and its tests are reviewed once they pass: two reviews at most, the arbiter weighing the second."
1651
- : `- review: ${config.review === false ? "false" : "not set, so off"} - the code and its tests are not reviewed: a pulse lands once its tests pass.`,
1644
+ !sets(own?.review !== undefined)
1645
+ ? undefined
1646
+ : config.review === true
1647
+ ? "- review: true - the code and its tests are reviewed once they pass: two reviews at most, the arbiter weighing the second."
1648
+ : `- review: ${config.review === false ? "false" : "not set, so off"} - the code and its tests are not reviewed: a pulse lands once its tests pass.`,
1652
1649
  ...(() => {
1653
1650
  // Each as it holds, with what it inherits: judge from coding, coding from harness.
1654
1651
  const models = projectModels(config);
1655
1652
  const shown = (choice) => modelSpec(choice) ?? "";
1656
1653
  return [
1657
- models.coding !== undefined ? `- coding-model: ${shown(models.coding)}${config.codingModel === undefined ? " (from harness-model)" : ""} - what renders run on, unless engine chose another in this session.` : undefined,
1658
- models.judge !== undefined ? `- judge-model: ${shown(models.judge)}${config.judgeModel === undefined ? " (from coding-model)" : ""} - the judge and the test review in a conformance run.` : undefined,
1659
- models.harness !== undefined && of !== "stack" ? `- harness-model: ${shown(models.harness)} - the model you start with.` : undefined,
1654
+ models.coding !== undefined && sets(own?.codingModel !== undefined || own?.models?.coding !== undefined || own?.models?.default !== undefined) ? `- coding-model: ${shown(models.coding)}${config.codingModel === undefined ? " (from harness-model)" : ""} - what pulses run on, unless a call names another model.` : undefined,
1655
+ models.judge !== undefined && sets(own?.judgeModel !== undefined || own?.models?.judge !== undefined) ? `- judge-model: ${shown(models.judge)}${config.judgeModel === undefined ? " (from coding-model)" : ""} - the judge and the test review in a conformance run.` : undefined,
1656
+ models.harness !== undefined && of !== "module" ? `- harness-model: ${shown(models.harness)} - the model you start with.` : undefined,
1660
1657
  // The other roles' own, where models: names them.
1661
1658
  ...AGENT_ROLES.filter((role) => role !== "coding" && role !== "chat").flatMap((role) => {
1662
- const own = roleModel(config, role);
1663
- return own !== undefined ? [`- models: ${role}: ${shown(own)}`] : [];
1659
+ const named = roleModel(config, role);
1660
+ return named !== undefined && sets(own?.models?.[role] !== undefined) ? [`- models: ${role}: ${shown(named)}`] : [];
1664
1661
  }),
1665
1662
  ...(() => {
1666
1663
  const limits = AGENT_ROLES.flatMap((role) => (config.models?.[role]?.turnLimit !== undefined ? [`${role} ${config.models[role].turnLimit}s`] : []));
1667
1664
  const all = config.models?.default?.turnLimit ?? config.turnLimit;
1668
- return all !== undefined || limits.length > 0 ? [`- turn limits: ${all !== undefined ? `${all}s each` : "two minutes each"}${limits.length > 0 ? `; ${limits.join(", ")}` : ""}.`] : [];
1665
+ return (all !== undefined || limits.length > 0) && sets(own?.turnLimit !== undefined || own?.models !== undefined) ? [`- turn limits: ${all !== undefined ? `${all}s each` : "two minutes each"}${limits.length > 0 ? `; ${limits.join(", ")}` : ""}.`] : [];
1669
1666
  })(),
1670
1667
  ];
1671
1668
  })(),
1672
- `- unit testing script: ${scripts.unit !== undefined ? relative(root, scripts.unit) : perModule ? "none for the whole project - each stack's file below names its own" : "none found - every build stops until there is one"}`,
1673
- `- conformance testing script: ${scripts.conformance !== undefined ? relative(root, scripts.conformance) : perModule ? "none for the whole project - see each stack's file" : "none found"}`,
1669
+ `- unit testing script: ${scripts.unit !== undefined ? relative(root, scripts.unit) : perModule ? "none for the whole project - each module's file below names its own" : "none found - every build stops until there is one"}`,
1670
+ `- conformance testing script: ${scripts.conformance !== undefined ? relative(root, scripts.conformance) : perModule ? "none for the whole project - see each module's file" : "none found"}`,
1674
1671
  scripts.prepare !== undefined ? `- prepare script: ${relative(root, scripts.prepare)} - run on the build before every conformance testing script run, which runs only once it passes` : undefined,
1675
- config.testingScriptsRunOn === "copy"
1676
- ? "- testing-scripts-run-on: copy - the testing scripts run on this machine, on a fresh copy of each module's code; `testing-scripts-run-on: in-place` (the default) runs them on the code in place."
1677
- : "- testing-scripts-run-on: in-place - the testing scripts run on this machine on the code in place, from the project, against the host codebase; `testing-scripts-run-on: copy` runs them on a fresh copy of each module's code.",
1672
+ !sets(own?.testingScriptsRunOn !== undefined)
1673
+ ? undefined
1674
+ : config.testingScriptsRunOn === "copy"
1675
+ ? "- testing-scripts-run-on: copy - the testing scripts run on this machine, on a fresh copy of each module's code; `testing-scripts-run-on: in-place` (the default) runs them on the code in place."
1676
+ : "- testing-scripts-run-on: in-place - the testing scripts run on this machine on the code in place, from the project, against the host codebase; `testing-scripts-run-on: copy` runs them on a fresh copy of each module's code.",
1678
1677
  ].filter((line) => line !== undefined),
1679
1678
  ];
1680
1679
  };
1681
1680
  return [
1682
1681
  `<project config>`,
1683
- `A project's ${CONFIG_FILE} sets how its specs are built - and a stack's config.turri.<stack>.yaml, over it, how everything is built`,
1684
- "while that stack is chosen: its testing scripts, toolchains, models and conformance - a backend and a frontend each with their own scripts.",
1685
- "One stack is chosen at a time, in each chat for that chat: the render tools follow the project's file with the chosen stack's over it;",
1686
- `a project with no ${CONFIG_FILE} yet is read from its ${LEGACY_CONFIG_FILE} (and config.<stack>.yaml): to change a setting there, copy`,
1687
- `${LEGACY_CONFIG_FILE} to ${CONFIG_FILE} - and each config.<stack>.yaml to config.turri.<stack>.yaml - first, then edit the copy; never edit ${LEGACY_CONFIG_FILE}.`,
1688
- "answer questions about the project's settings from it, and say when a render will differ from it because the user",
1689
- "asked. Name a spec by its path from here - plain/hubspot.plain - and it is built in its own project.",
1682
+ `A project's ${CONFIG_FILE} sets how its modules are built - and a module's own config.turri.<module>.yaml, over it, how that`,
1683
+ "module is built, and every module built on it that has no file of its own: its testing scripts, toolchains, models and conformance -",
1684
+ "a backend and a frontend each with their own scripts. Nobody chooses it: each module is built with its own file, else the one of",
1685
+ "a module it requires, else the project's alone - two among the modules it requires is an error to fix. A project with no",
1686
+ `${CONFIG_FILE} yet is read from its ${LEGACY_CONFIG_FILE} (and config.<module>.yaml). Change a setting with the settings tool,`,
1687
+ "never by editing these files; answer questions about the project's settings from what follows, and say when a pulse will",
1688
+ "differ from it because the user asked. Name a spec by its path from here - plain/hubspot.plain - and it is built in its own project.",
1690
1689
  ...projects.flatMap((dir) => ["", ...describe(dir)]),
1691
1690
  `</project config>`,
1692
1691
  ].join("\n");
@@ -1709,7 +1708,7 @@ function conversationModel(ctx, override) {
1709
1708
  */
1710
1709
  /** The model a release runs on - a pulse's last stage, and a check's: the one that regenerated the module. A release follows steps, and a small model thinking little does that well. */
1711
1710
  function releaseModel(ctx, plainFile) {
1712
- return modelFor(chosenModels, "spec_changes", projectModel(ctx, plainFile) ?? chatModelOf(ctx));
1711
+ return projectModel(ctx, plainFile) ?? chatModelOf(ctx);
1713
1712
  }
1714
1713
  function chatModelOf(ctx) {
1715
1714
  try {
@@ -1725,7 +1724,7 @@ let lastChatModel;
1725
1724
  /**
1726
1725
  * Conformance tests turned on, for the session: `conformance-tests: true` written where the module's value comes from
1727
1726
  * (conformance-switch.ts) - what /conform does when they are off, and a host's turnOnConformance. Every chat is told at
1728
- * its next turn. `plainFile`, absolute or from the project, picks the module whose stack's file
1727
+ * its next turn. `plainFile`, absolute or from the project, picks the module whose own file
1729
1728
  * is written when that names the key. Returns the file written, from the project. Starts no conformance pulse.
1730
1729
  */
1731
1730
  export function turnOnConformance(core, plainFile) {
@@ -1734,24 +1733,14 @@ export function turnOnConformance(core, plainFile) {
1734
1733
  }
1735
1734
  /** The skills running in the background, by project and skill - one at a time each, whichever chat started it - with what stops them. */
1736
1735
  const backgroundSkillRuns = new Map();
1737
- /** The models chosen in this session, by kind of work - for every chat. Saved in the chat they were chosen in, so reopening it keeps them. */
1738
- const chosenModels = {};
1739
- /** When they were last chosen: a chat reopened with older choices of its own leaves them be. */
1740
- let chosenModelsAt = 0;
1741
- const MODEL_CHOICE_ENTRY = "turri_render_models";
1742
1736
  /**
1743
- * The model a job's agents run on: the one named on the call, checked now so a wrong name fails
1744
- * here and not minutes later in the background; else the one chosen for its kind of work; else
1745
- * the conversation's.
1737
+ * The model a pulse's agents run on: the one named on the call, checked now so a wrong name fails here and not minutes
1738
+ * later in the background; else the coding model - `--coding-model`, or the module's config - else the conversation's.
1746
1739
  */
1747
- /**
1748
- * The model a render job runs on: the one asked for, or the one chosen in this session for its kind
1749
- * of work, or the project's - `model:` in config.turri.yaml - or the conversation's.
1750
- */
1751
- function jobModel(ctx, work, named, plainFile) {
1752
- const model = jobModelOf(ctx, work, named, plainFile);
1740
+ function jobModel(ctx, named, plainFile) {
1741
+ const model = jobModelOf(ctx, named, plainFile);
1753
1742
  // The AWS region worked out again, with every model a job ran on this session: the config's may have changed since,
1754
- // and one chosen in the session counts as the config's do - two needing two regions are said, not flipped between.
1743
+ // and one named on a call counts as the config's do - two needing two regions are said, not flipped between.
1755
1744
  if (model !== undefined)
1756
1745
  jobModels.add(model);
1757
1746
  applyBedrockRegion(plainFile !== undefined ? projectDirOf(plainFile) : process.cwd(), { also: [...jobModels] });
@@ -1759,14 +1748,14 @@ function jobModel(ctx, work, named, plainFile) {
1759
1748
  }
1760
1749
  /** Every model a job ran on in this session. */
1761
1750
  const jobModels = new Set();
1762
- function jobModelOf(ctx, work, named, plainFile) {
1751
+ function jobModelOf(ctx, named, plainFile) {
1763
1752
  if (named !== undefined && named.trim() !== "") {
1764
1753
  const resolved = resolveModel(named, ctx.modelRegistry);
1765
1754
  if (!resolved.ok)
1766
1755
  throw new Error(describeResolution(resolved));
1767
1756
  return resolved.model;
1768
1757
  }
1769
- return modelFor(chosenModels, work, projectModel(ctx, plainFile) ?? chatModelOf(ctx));
1758
+ return projectModel(ctx, plainFile) ?? chatModelOf(ctx);
1770
1759
  }
1771
1760
  /**
1772
1761
  * The coding model this session starts from, and where it was given: `turri
@@ -1799,107 +1788,6 @@ function projectModel(ctx, plainFile) {
1799
1788
  }
1800
1789
  return modelSpec({ model: resolved.model, thinking });
1801
1790
  }
1802
- /** The default coding model for showing, with where it came from - never an error. */
1803
- function projectModelLabel(ctx) {
1804
- const given = codingModelDefault();
1805
- if (given === undefined)
1806
- return undefined;
1807
- try {
1808
- return { model: projectModel(ctx), from: given.from };
1809
- }
1810
- catch {
1811
- return { model: `${given.named} - which cannot be used here`, from: given.from };
1812
- }
1813
- }
1814
- /**
1815
- * engine, for the conversation's agent and for a skill's agent - whom the person talks
1816
- * to while the skill runs - alike: both write the same choice. `conversation` is the context to
1817
- * read models and the chat's model from; omitted, the one the tool is called with.
1818
- */
1819
- function setRenderModelTool(pi, conversation) {
1820
- return defineTool({
1821
- name: "engine",
1822
- label: "Engine",
1823
- description: "The engine: which model the agents that regenerate the code run on. With no model, say which it is. With one, choose it " +
1824
- "for the rest of this session: for spec changes (every pulse the work loop plans, conformance tests included), for " +
1825
- "functionalities (regenerate with funcIds named), or for everything. By default " +
1826
- "each runs on the model the project's config.turri.yaml names, or else the conversation's model. The model may be given as provider/model-id or by name as " +
1827
- "the user said it; a name that fits more than one model, or none with credentials, comes back as a " +
1828
- "list - ask the user which they meant, never pick one yourself. Pulses already queued keep their model.",
1829
- promptSnippet: "the engine: show or choose the model that regenerates the code",
1830
- promptGuidelines: [
1831
- "When the user says which model should regenerate or build something, call engine with it - once; it holds for the rest of the session. To say which one it is, call engine with no model.",
1832
- "If engine returns several candidates, ask the user which one with ask_user or in your reply, then call it again with the exact provider/model-id.",
1833
- "Say which model a pulse will run on when you start one on something other than the conversation's model.",
1834
- ],
1835
- parameters: Type.Object({
1836
- work: Type.Optional(Type.Union([Type.Literal("spec_changes"), Type.Literal("functionalities"), Type.Literal("all")], {
1837
- description: "spec_changes, functionalities, or all of it. Omitted: all",
1838
- })),
1839
- model: Type.Optional(Type.String({
1840
- description: 'provider/model-id, or the model\'s name as the user said it. "chat" goes back to the conversation\'s model. Omitted: say which it is, changing nothing',
1841
- })),
1842
- }),
1843
- async execute(_id, given, _signal, _onUpdate, called) {
1844
- const ctx = conversation ?? called;
1845
- if (given.model === undefined) {
1846
- const text = `The engine:\n${describeChoices(chosenModels, chatModelOf(ctx), projectModelLabel(ctx))}`;
1847
- return { content: [{ type: "text", text }], details: { ...chosenModels } };
1848
- }
1849
- const params = { work: given.work ?? "all", model: given.model };
1850
- const works = params.work === "all" ? ["all", "spec_changes", "functionalities"] : [params.work];
1851
- if (/^(chat|default|conversation)$/i.test(params.model.trim())) {
1852
- for (const work of works)
1853
- delete chosenModels[work];
1854
- }
1855
- else {
1856
- const resolved = resolveModel(params.model, ctx.modelRegistry);
1857
- if (!resolved.ok)
1858
- throw new Error(describeResolution(resolved));
1859
- if (params.work === "all") {
1860
- delete chosenModels.spec_changes;
1861
- delete chosenModels.functionalities;
1862
- }
1863
- chosenModels[params.work] = resolved.model;
1864
- }
1865
- chosenModelsAt = Date.now();
1866
- pi.appendEntry(MODEL_CHOICE_ENTRY, { ...chosenModels });
1867
- const text = `The engine now:\n${describeChoices(chosenModels, chatModelOf(ctx), projectModelLabel(ctx))}`;
1868
- return { content: [{ type: "text", text }], details: { ...chosenModels } };
1869
- },
1870
- });
1871
- }
1872
- /** Choosing which model renders what, for the rest of the session. */
1873
- function registerRenderModels(pi) {
1874
- // The session's choices, every chat's: a chat reopened brings back what it chose, when that is newer than what the
1875
- // session has - and a fresh chat starts with the session's.
1876
- let started = false;
1877
- pi.on("session_start", (_event, ctx) => {
1878
- if (started)
1879
- return;
1880
- started = true;
1881
- const saved = ctx.sessionManager
1882
- .getBranch()
1883
- .filter((entry) => entry.type === "custom" && entry.customType === MODEL_CHOICE_ENTRY)
1884
- .at(-1);
1885
- const at = Date.parse(saved?.timestamp ?? "") || 1;
1886
- if (saved === undefined || at <= chosenModelsAt)
1887
- return;
1888
- chosenModelsAt = at;
1889
- for (const key of Object.keys(chosenModels))
1890
- delete chosenModels[key];
1891
- Object.assign(chosenModels, saved.data ?? {});
1892
- });
1893
- pi.registerTool(setRenderModelTool(pi));
1894
- pi.registerCommand("engine", {
1895
- description: "Show the engine: which model regenerates spec changes and functionalities. To change it, say so in the conversation.",
1896
- handler: async (_args, ctx) => {
1897
- const text = `The engine:\n${describeChoices(chosenModels, chatModelOf(ctx), projectModelLabel(ctx))}\n\nTo change it, say so - e.g. "regenerate spec changes with gpt 5.5".`;
1898
- if (ctx.hasUI)
1899
- ctx.ui.notify(text, "info");
1900
- },
1901
- });
1902
- }
1903
1791
  /**
1904
1792
  * Run the work now, or start it as a background job and hand back an id.
1905
1793
  *
@@ -1920,7 +1808,7 @@ function workLoopFor(jobs, cwd, ctx) {
1920
1808
  const loop = createWorkLoop({
1921
1809
  registry: jobs,
1922
1810
  cwd,
1923
- modelFor: (plainFile) => modelFor(chosenModels, "spec_changes", projectModel(from.ctx, plainFile) ?? chatModelOf(from.ctx)),
1811
+ modelFor: (plainFile) => projectModel(from.ctx, plainFile) ?? chatModelOf(from.ctx),
1924
1812
  // The planner reasons about the whole of the work: it runs on the chat's model.
1925
1813
  plannerModel: () => chatModelOf(from.ctx),
1926
1814
  // How the work is to be planned: the conversation's steering, and AGENTS.md's - read afresh each plan.
@@ -2034,7 +1922,6 @@ function registerJobTools(pi, jobs, cwd) {
2034
1922
  })),
2035
1923
  plain_file: Type.Optional(Type.String({ description: "A look ahead: the .plain file of the module to plan, starting nothing. Not with job_id. Omitted: no look ahead" })),
2036
1924
  working_dir: WORKING_DIR_PARAM,
2037
- stack: STACK_PARAM,
2038
1925
  wait: Type.Optional(Type.Boolean({ description: "With a pulse started: block until it finishes instead of reporting its current state (default false)" })),
2039
1926
  runs: Type.Optional(Type.Number({ description: `With no parameter: how many runs of earlier sessions to list (default ${EARLIER_RUNS})` })),
2040
1927
  }),
@@ -2045,7 +1932,7 @@ function registerJobTools(pi, jobs, cwd) {
2045
1932
  const given = fromWorkingDir(cwd, params);
2046
1933
  const plainFile = resolve(given.base, given.plain_file);
2047
1934
  refuseTestPlainFile(plainFile);
2048
- return withCallStack(plainFile, params.stack, async () => {
1935
+ return whenBuildable(plainFile, async () => {
2049
1936
  const loop = workLoopFor(jobs, cwd, ctx);
2050
1937
  const statuses = await loop.lookAhead(plainFile);
2051
1938
  return { content: [{ type: "text", text: describeLookAhead(loop, statuses) }], details: { status: "looked ahead" } };
@@ -2192,9 +2079,9 @@ function registerJobTools(pi, jobs, cwd) {
2192
2079
  openPanel(ctx);
2193
2080
  },
2194
2081
  });
2195
- // /turri-config: every setting of config.turri.yaml from the chat, each taking effect as it says - what turri fixed at its
2082
+ // /settings: every setting of config.turri.yaml from the chat, each taking effect as it says - what turri fixed at its
2196
2083
  // start changed here, as it runs.
2197
- registerTurriConfig(pi, {
2084
+ registerSettings(pi, {
2198
2085
  cwd,
2199
2086
  rules: ruleNames,
2200
2087
  chatSpec: () => modelSpec(projectModels(readProjectConfig(cwd)).harness),
@@ -2223,11 +2110,6 @@ function registerJobTools(pi, jobs, cwd) {
2223
2110
  dropped.push(`--coding-model ${process.env[CODING_MODEL_ENV]}`);
2224
2111
  delete process.env[CODING_MODEL_ENV];
2225
2112
  }
2226
- chosenModelsAt = Date.now();
2227
- for (const work of Object.keys(chosenModels)) {
2228
- dropped.push(`the engine's ${work === "all" ? "" : `${work.replace(/_/g, " ")} `}model ${chosenModels[work]}`);
2229
- delete chosenModels[work];
2230
- }
2231
2113
  return dropped.length === 0 ? undefined : `Chosen this session, and given way to the config: ${dropped.join("; ")}.`;
2232
2114
  },
2233
2115
  parallelJobs: (count) => {
@@ -3018,7 +2900,7 @@ function registerBranding(pi, skills) {
3018
2900
  ...(data.config ?? []).map((line) => theme.fg("warning", line)),
3019
2901
  `${theme.fg("text", "the first coding agent with the power of ")}${brandPink(theme)("regenerative software")}`,
3020
2902
  // Where the settings are changed, without leaving the chat.
3021
- theme.fg("muted", "configure with /turri-config"),
2903
+ theme.fg("muted", "configure with /settings"),
3022
2904
  // Only what is wrong: skills that did not load, and agents' commands less fenced than they should be.
3023
2905
  ...(data.pending > 0 ? [theme.fg("warning", `${data.pending} skill${data.pending === 1 ? "" : "s"} failed to load`)] : []),
3024
2906
  ...(data.sandbox !== undefined && data.sandbox.level !== "ok" ? [theme.fg(data.sandbox.level === "limited" ? "warning" : "error", data.sandbox.text)] : []),
@@ -81,7 +81,7 @@ export interface Turri {
81
81
  refused: string;
82
82
  };
83
83
  /**
84
- * Every value /turri-config offers for a setting after `typed` - what its completions compute, in their order, but
84
+ * Every value /settings offers for a setting after `typed` - what its completions compute, in their order, but
85
85
  * whole: uncapped, and without "unset", which a host draws itself; the values alone, not `<key> <value>`. A model
86
86
  * setting's are every model of every provider signed in to, from the model registry the chats use - and after a colon,
87
87
  * `harness-model amazon-bedrock/global.anthropic.claude-opus-5-5:`, that model's thinking levels. An unknown key gives none.
@@ -89,7 +89,7 @@ export interface Turri {
89
89
  settingChoices(key: string, typed?: string): string[];
90
90
  /**
91
91
  * Conformance tests turned on, as /conform does before it tests - the person's decision, a host's switch for it:
92
- * `conformance-tests: true` written where the module's value comes from - its stack's `config.turri.<stack>.yaml` when
92
+ * `conformance-tests: true` written where the module's value comes from - its own `config.turri.<module>.yaml`, or a required module's, when
93
93
  * that sets the key, else `config.turri.yaml` - the chats' conform no longer refused. `plainFile`, absolute or from the
94
94
  * project, picks the module; omitted,
95
95
  * the project's. Returns the file written, from the project. Starts no conformance pulse: that is `conform`'s.