@turri-dev/cli 0.2.4-next.35ab04b → 0.2.4-next.636a651

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 (102) hide show
  1. package/README.md +2 -2
  2. package/dist/chat-idle.d.ts +2 -2
  3. package/dist/chat-idle.js +2 -2
  4. package/dist/chats.d.ts +0 -10
  5. package/dist/chats.js +0 -23
  6. package/dist/cli.js +5 -7
  7. package/dist/config-edit.js +1 -3
  8. package/dist/config.d.ts +20 -22
  9. package/dist/config.js +49 -22
  10. package/dist/conformance-switch.d.ts +7 -17
  11. package/dist/conformance-switch.js +24 -46
  12. package/dist/drift-cli.js +1 -1
  13. package/dist/extension.d.ts +8 -10
  14. package/dist/extension.js +157 -217
  15. package/dist/genome.js +9 -48
  16. package/dist/graph.js +3 -5
  17. package/dist/host-session.d.ts +4 -15
  18. package/dist/host-session.js +2 -4
  19. package/dist/host.d.ts +1 -3
  20. package/dist/host.js +1 -4
  21. package/dist/identity.js +0 -1
  22. package/dist/init-config.d.ts +0 -1
  23. package/dist/init-config.js +2 -9
  24. package/dist/installed-providers.d.ts +1 -1
  25. package/dist/installed-providers.js +1 -1
  26. package/dist/loop-cli.d.ts +4 -3
  27. package/dist/loop-cli.js +13 -11
  28. package/dist/loop-tools.d.ts +26 -3
  29. package/dist/loop-tools.js +85 -20
  30. package/dist/new-project.js +2 -2
  31. package/dist/pi-launch.js +1 -1
  32. package/dist/pi.js +9 -6
  33. package/dist/plain/check.d.ts +1 -8
  34. package/dist/plain/check.js +3 -38
  35. package/dist/regenerate/activity.d.ts +0 -7
  36. package/dist/regenerate/activity.js +2 -20
  37. package/dist/regenerate/agent-shell.js +3 -1
  38. package/dist/regenerate/audit.js +9 -0
  39. package/dist/regenerate/chunk-plan.d.ts +5 -0
  40. package/dist/regenerate/chunk-plan.js +16 -1
  41. package/dist/regenerate/failure-reports.d.ts +28 -0
  42. package/dist/regenerate/failure-reports.js +79 -0
  43. package/dist/regenerate/job-panel.js +3 -1
  44. package/dist/regenerate/jobs-tree.js +1 -1
  45. package/dist/regenerate/jobs.d.ts +2 -0
  46. package/dist/regenerate/jobs.js +4 -0
  47. package/dist/regenerate/ledger-view.d.ts +11 -24
  48. package/dist/regenerate/ledger-view.js +14 -60
  49. package/dist/regenerate/ledger.d.ts +1 -14
  50. package/dist/regenerate/ledger.js +1 -1
  51. package/dist/regenerate/loop.d.ts +37 -60
  52. package/dist/regenerate/loop.js +174 -106
  53. package/dist/regenerate/regenerate.d.ts +0 -2
  54. package/dist/regenerate/regenerate.js +4 -15
  55. package/dist/regenerate/standing.js +1 -1
  56. package/dist/regenerate/submit-work.d.ts +2 -0
  57. package/dist/regenerate/submit-work.js +8 -3
  58. package/dist/regenerate/testing-steps.d.ts +11 -0
  59. package/dist/regenerate/testing-steps.js +22 -3
  60. package/dist/regenerate-cli.js +18 -9
  61. package/dist/self-invocation.d.ts +11 -0
  62. package/dist/self-invocation.js +33 -7
  63. package/dist/sentinel.js +8 -5
  64. package/dist/skill.d.ts +0 -11
  65. package/dist/skill.js +0 -9
  66. package/dist/stacks.js +1 -1
  67. package/dist/tools.js +2 -3
  68. package/dist/turri-versions.js +2 -1
  69. package/docs/README.md +0 -2
  70. package/docs/authoring-plain.md +3 -3
  71. package/docs/chats.md +1 -3
  72. package/docs/config.md +11 -13
  73. package/docs/deploy.md +1 -1
  74. package/docs/development.md +2 -3
  75. package/docs/headless.md +5 -4
  76. package/docs/hosting.md +6 -6
  77. package/docs/parser.md +2 -2
  78. package/docs/regenerating.md +14 -12
  79. package/docs/sentinel.md +4 -4
  80. package/docs/skills-and-gates.md +4 -8
  81. package/docs/using.md +10 -18
  82. package/genome/rules/test-plain-files.md +15 -7
  83. package/genome/rules/turri-regeneration.md +4 -9
  84. package/genome/skills/convert-old-syntax/SKILL.md +5 -5
  85. package/package.json +1 -1
  86. package/dist/advisor-chat.d.ts +0 -63
  87. package/dist/advisor-chat.js +0 -290
  88. package/dist/change-plain-cli.d.ts +0 -1
  89. package/dist/change-plain-cli.js +0 -55
  90. package/dist/ledger-cli.d.ts +0 -1
  91. package/dist/ledger-cli.js +0 -50
  92. package/dist/ledger-tools.d.ts +0 -10
  93. package/dist/ledger-tools.js +0 -64
  94. package/dist/regenerate/advisor-records.d.ts +0 -93
  95. package/dist/regenerate/advisor-records.js +0 -110
  96. package/dist/regenerate/advisor-runs.d.ts +0 -87
  97. package/dist/regenerate/advisor-runs.js +0 -327
  98. package/dist/regenerate/test-advisor.d.ts +0 -101
  99. package/dist/regenerate/test-advisor.js +0 -379
  100. package/dist/spec-tools.d.ts +0 -36
  101. package/dist/spec-tools.js +0 -128
  102. package/docs/test-advisor.md +0 -110
package/README.md CHANGED
@@ -148,14 +148,14 @@ Then say what you want:
148
148
 
149
149
  > A small API where people can register and sign in, in Python.
150
150
 
151
- In a new project **turri** starts it itself, without asking how: it chooses the stack - the one you name, else a standard library stack this machine can build - writes the module and its unit testing script (and the conformance tests' when you ask for them, or the [test advisor](docs/test-advisor.md) finds a functional spec that needs them), regenerates the smallest thing that runs at once, then the main thing you described, and says what it chose and what it would write next. Every change after is yours to ask for: **turri** writes it as \*\*\*plain and regenerates it. While it works:
151
+ In a new project **turri** starts it itself, without asking how: it chooses the stack - the one you name, else a standard library stack this machine can build - writes the module and its unit testing script (and the conformance tests' when you ask for them, or - conformance tests on - it judges a functional spec needs them), regenerates the smallest thing that runs at once, then the main thing you described, and says what it chose and what it would write next. Every change after is yours to ask for: **turri** writes it as \*\*\*plain and regenerates it. While it works:
152
152
 
153
153
  - the **panel** above the input shows every build - its stage, what its agents are doing, its model and cost - and the queue behind it;
154
154
  - ask to try it at any time - "let me try it" - and **`release`** puts what is built so far in `dist/<module>` and **`activate`** starts it, installing what it needs - nothing to approve;
155
155
  - the **side panel** (`ctrl+h`) takes the screen and opens on **regen** - \*\*\*plain, every item marked planned, working, regenerated, validating, conform or needs you - and `p` turns it to the **pulses** (`/pulses`) - every pulse, running, queued and finished, and what each regenerates; what its agents did is in each pulse's log in `.turri/jobs/`, kept with `--debug` (`debug: true`);
156
156
  - **`/halt`** halts a pulse, **`/lineage`** shows every generation of a module, and the **`drift`** tool says what is left to regenerate;
157
157
  - **`/btw <question>`** asks turri something on the side - answered at once, even while a question waits for you (typed as the answer, under "Something else…"), and left out of the conversation;
158
- - **`/turri-config`** changes any setting of the project's `config.turri.yaml` - the models, review, the test advisor, how many pulses at once - and says when it takes effect: now, at your next message, or at the next pulse. No restart: `/turri-config review false`, or `/turri-config` alone to pick from the list;
158
+ - **`/turri-config`** changes any setting of the project's `config.turri.yaml` - the models, review, how many pulses at once - and says when it takes effect: now, at your next message, or at the next pulse. No restart: `/turri-config review false`, or `/turri-config` alone to pick from the list;
159
159
  - **`/sentinel`** says whether the sentinel checks every pulse that finishes: `ask` (you are asked before it first opens), `on` or `off`;
160
160
  - **`/stack`** chooses the stack to build with, in a project whose backend and frontend each have their own testing scripts in `config.turri.<stack>.yaml` - `/stack backend`, `/stack none` - for the session (`--stack <name>` on the command line). The chat's model builds each part with its own stack by itself, pinned to that module's pulses.
161
161
 
@@ -1,7 +1,7 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import type { ChatLink } from "./chats.ts";
3
3
  /**
4
- * Whether a chat is busy, for what turri tells it of its own accord - a test advisor's verdict, a background skill run's
5
- * end - and so waits: its agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
4
+ * Whether a chat is busy, for what turri tells it of its own accord - a background skill run's end - and so waits: its
5
+ * agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
6
6
  */
7
7
  export declare function chatBusy(link: ChatLink, context: () => ExtensionContext | undefined): boolean;
package/dist/chat-idle.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Whether a chat is busy, for what turri tells it of its own accord - a test advisor's verdict, a background skill run's
3
- * end - and so waits: its agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
2
+ * Whether a chat is busy, for what turri tells it of its own accord - a background skill run's end - and so waits: its
3
+ * agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
4
4
  */
5
5
  export function chatBusy(link, context) {
6
6
  const session = link.session();
package/dist/chats.d.ts CHANGED
@@ -6,7 +6,6 @@ import { type SentinelSetting } from "./config.ts";
6
6
  import type { AskUserIO } from "./ask.ts";
7
7
  import type { Job, JobRegistry } from "./regenerate/jobs.ts";
8
8
  import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
9
- import type { AdvisorVerdict } from "./regenerate/advisor-runs.ts";
10
9
  import { type ChatRole, type Conclusion, type Notice, type NoticeAnswer, type NoticeInput, type SentinelCheck } from "./notice.ts";
11
10
  /**
12
11
  * The chats of a turri session.
@@ -126,19 +125,12 @@ export interface ChatInstance {
126
125
  concluded(conclusion: Conclusion): void;
127
126
  /** The person answered a notice with something to do: the chat's agent started on it. */
128
127
  act(task: string): void;
129
- /**
130
- * The test advisor's verdict: once the chat is idle - its agent done, nothing typed - a yes starts a turn that writes its
131
- * scenarios, and a no is a line. Those that arrive meanwhile are delivered together.
132
- */
133
- advised(verdict: AdvisorVerdict): void;
134
128
  /** The jobs changed: what it draws of them is drawn again. */
135
129
  jobsChanged(): void;
136
130
  /** How hard the chat's model thinks now: sub-agents started from it think as hard. */
137
131
  thinkingLevel(): string | undefined;
138
132
  /** The chat's context, as its tools get it - for its model and its providers. */
139
133
  context(): ExtensionContext | undefined;
140
- /** Conformance tests turned on or off: the chat's tools switched to match - conform and evaluate_tests, or the tool that turns them on. */
141
- conformanceSwitched?(): void;
142
134
  }
143
135
  /** A chat's extension, linked to its chat. */
144
136
  export interface ChatLink {
@@ -248,8 +240,6 @@ export interface TurriCore {
248
240
  } | {
249
241
  refused: string;
250
242
  };
251
- /** The test advisor's verdict, for the chat the person looks at - held until there is one. Undefined: no chat to hand it to yet. */
252
- advised(verdict: AdvisorVerdict): string | undefined;
253
243
  /** The notices put to the person and not yet answered. */
254
244
  notices(): Notice[];
255
245
  /**
package/dist/chats.js CHANGED
@@ -106,8 +106,6 @@ export function createChats(options) {
106
106
  let consent = "unasked";
107
107
  let asking;
108
108
  const held = [];
109
- /** The test advisor's verdicts that came with no chat of the person's to hand them to: handed on as one comes up. */
110
- const unplaced = [];
111
109
  const run = { run: randomUUID().slice(0, 8), pid: process.pid, started: new Date().toISOString(), chats: [] };
112
110
  const changed = () => {
113
111
  for (const listener of listeners) {
@@ -364,10 +362,6 @@ export function createChats(options) {
364
362
  session: () => chat.session,
365
363
  live: (instance) => {
366
364
  chat.instance = instance;
367
- // The advisor's verdicts that waited for a chat of the person's.
368
- if (unplaced.length > 0 && personFacing() !== undefined)
369
- for (const verdict of unplaced.splice(0))
370
- core.advised(verdict);
371
365
  },
372
366
  };
373
367
  },
@@ -496,23 +490,6 @@ export function createChats(options) {
496
490
  changed();
497
491
  return target.id;
498
492
  },
499
- advised(verdict) {
500
- const target = personFacing();
501
- if (target?.instance === undefined) {
502
- unplaced.push(verdict);
503
- return undefined;
504
- }
505
- if (target.id !== shownId)
506
- target.unread = true;
507
- try {
508
- target.instance.advised(verdict);
509
- }
510
- catch {
511
- /* a chat let go as it was told: a yes stays undelivered in the advisor's file, for the next start */
512
- }
513
- changed();
514
- return target.id;
515
- },
516
493
  answer(id, answer) {
517
494
  const notice = open.find((candidate) => candidate.id === id);
518
495
  if (notice === undefined)
package/dist/cli.js CHANGED
@@ -73,13 +73,10 @@ function chat(args) {
73
73
  }
74
74
  const COMMANDS = {
75
75
  regenerate: { module: "./regenerate-cli.ts", blurb: "regenerate a module and its chain from the spec as it is (with module:func-ids: regenerate those again)" },
76
- glimpse: { module: "./regenerate-cli.ts", blurb: "plan the work and print the first job's prompt, starting nothing", args: ["--dry-run"] },
77
76
  drift: { module: "./drift-cli.ts", blurb: "what is left to regenerate: how far the code has drifted from its spec" },
78
77
  conform: { module: "./conform-cli.ts", blurb: "write and run a module's conformance tests" },
79
- "change-plain": { module: "./change-plain-cli.ts", blurb: "apply a change to ***plain, given as a git diff, and regenerate it" },
80
78
  parse: { module: "./parse-cli.ts", blurb: "parse ***plain - its syntax and structure, never its code or tests - regenerating nothing" },
81
79
  lineage: { module: "./lineage-cli.ts", blurb: "a module's lineage: what was regenerated into it, and when" },
82
- ledger: { module: "./ledger-cli.ts", blurb: "what turri did here: the last runs and their pulses, or one pulse, from the ledger" },
83
80
  release: { module: "./release-cli.ts", blurb: "release what is regenerated to dist/<module> and activate it on this machine" },
84
81
  cultivate: { module: "./cultivate-cli.ts", blurb: "run a gated skill" },
85
82
  };
@@ -112,7 +109,7 @@ const USAGE = [
112
109
  " turri <command> [args]",
113
110
  " turri --version turri's version, and pi's",
114
111
  "",
115
- ` ${"options".padEnd(12)} --harness-model <m> the model you chat with --coding-model <m> the model renders run on`,
112
+ ` ${"options".padEnd(12)} --harness-model <m> the model you chat with --coding-model <m> the model that writes the code`,
116
113
  ` ${"".padEnd(12)} --stack <name> build with config.turri.<name>.yaml over config.turri.yaml - here and in every command`,
117
114
  ` ${"".padEnd(12)} --debug keep what turri writes for debugging it - agents' logs and sessions - as debug: true does`,
118
115
  ` ${"".padEnd(12)} --use-theme <t> another theme than turri-dark - and every option of pi's own`,
@@ -158,7 +155,8 @@ async function withoutStack(args) {
158
155
  }
159
156
  return kept;
160
157
  }
161
- if (command === "-h" || command === "--help") {
158
+ // `turri help` too: the word people type first, which would otherwise be an unknown command.
159
+ if (command === "-h" || command === "--help" || command === "help") {
162
160
  console.log(USAGE);
163
161
  process.exit(0);
164
162
  }
@@ -172,7 +170,7 @@ if (command === "-v" || command === "--version") {
172
170
  // The AWS region the project's Bedrock models need, set before any model is called - here, and in the pi the chat starts,
173
171
  // which inherits it - unless the person set one (bedrock-region.ts). The models named on the command line count too. A
174
172
  // command that calls no model is left alone.
175
- if (!["parse", "drift", "lineage", "ledger", "init-config", ...Object.keys(PACKAGE_COMMANDS)].includes(command ?? "")) {
173
+ if (!["parse", "drift", "lineage", "init-config", ...Object.keys(PACKAGE_COMMANDS)].includes(command ?? "")) {
176
174
  const { applyBedrockRegion } = await import("./bedrock-region.js");
177
175
  const named = argv.flatMap((arg, at) => ["--harness-model", "--coding-model", "--model"].includes(arg) ? [argv[at + 1] ?? ""] : arg.startsWith("--harness-model=") || arg.startsWith("--coding-model=") || arg.startsWith("--model=") ? [arg.slice(arg.indexOf("=") + 1)] : []);
178
176
  applyBedrockRegion(process.cwd(), { also: named.filter((model) => model !== "") });
@@ -215,7 +213,7 @@ process.argv = [
215
213
  // A headless run is stopped by a signal - SIGTERM, SIGHUP, Ctrl-C - whatever else listens for it: it exits, and what
216
214
  // its agents left running goes with it (shell.ts kills every process group on exit). Left to the libraries' own
217
215
  // handlers, one ran on for minutes after it was told to stop, building in the same codebase as the run after it.
218
- if (!["parse", "drift", "lineage", "ledger"].includes(command)) {
216
+ if (!["parse", "drift", "lineage"].includes(command)) {
219
217
  for (const [signal, code] of [["SIGTERM", 143], ["SIGHUP", 129], ["SIGINT", 130]]) {
220
218
  process.on(signal, () => {
221
219
  console.error(`\nstopped (${signal})`);
@@ -32,7 +32,6 @@ const ROLE_ABOUT = {
32
32
  judge: "judges a failing conformance run - as judge-model, which it wins over",
33
33
  arbiter: "weighs a second review",
34
34
  debugger: "a fresh look at unit tests that keep failing the same way",
35
- advisor: "the test advisor: whether a new or changed functional spec needs scenarios",
36
35
  };
37
36
  /** Every setting, in the order the list shows them. */
38
37
  export function settings(rules = []) {
@@ -65,8 +64,7 @@ export function settings(rules = []) {
65
64
  { key: "allow-to-stop-jobs", about: "whether turri stops a running pulse the ***plain has moved on from", kind: "boolean", unset: "true", effect: "now" },
66
65
  { key: "release-after-pulse", about: "whether every pulse that lands code releases it", kind: "boolean", unset: "false", effect: "next-landing" },
67
66
  { key: "sentinel", about: "whether a chat of its own checks every finished pulse, tests the release, and tells you what is wrong - ask: you are asked before it first opens", kind: "choice", options: ["ask", "true", "false"], unset: "ask", effect: "next-landing" },
68
- { key: "test-advisor", about: "whether turri checks each new or changed functional spec with no scenarios in the background, to see whether it needs scenarios - on a yes, the chat writes them", kind: "boolean", unset: "true", effect: "now" },
69
- { key: "conformance-tests", about: "whether functional specs' scenarios are written and conformance tested - false: none, the test advisor and conform off", kind: "boolean", unset: "false", effect: "now" },
67
+ { key: "conformance-tests", about: "whether functional specs' scenarios are written and conformance tested - false: none, and the chat's conform refused", kind: "boolean", unset: "false", effect: "now" },
70
68
  { key: "test-dir", about: "the folder of the test plain files, a folder per module in it, by path from the project root", kind: "path", unset: "tests", effect: "now" },
71
69
  { key: "base-folder", about: "a folder a codebase that requires no other module starts from, by path from the project root - code to build on, files to use, copied in once", kind: "path", unset: "none: it starts empty", effect: "next-pulse" },
72
70
  { key: "unittests-script", about: "the unit testing script, by path from the project root", kind: "path", unset: "the one run_unittests*.sh found", effect: "next-test-run" },
package/dist/config.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * ```yaml
7
7
  * module: prism_cli.plain # what `turri regenerate` builds by default
8
- * conformance-tests: false # whether scenarios are written and conformance tested - false: none, the test advisor off (default: false)
8
+ * conformance-tests: false # whether scenarios are written and conformance tested - false: none (default: false)
9
9
  * test-dir: tests # where the test plain files are, a folder per module: tests/<module>/ (default: tests)
10
10
  * base-folder: existing-app # a codebase that requires none starts as a copy of it - code to build on, assets to use
11
11
  * harness-model: # the model you chat with in `turri`
@@ -20,7 +20,6 @@
20
20
  * mutation-testing: false # give the coding agent and the reviewer can_it_fail (default: true)
21
21
  * allow-to-stop-jobs: false # stop a running job the spec moved on from (default: true)
22
22
  * release-after-pulse: true # release what each pulse lands, as its last stage, before the next pulse (default: false)
23
- * test-advisor: false # check each new or changed functional spec with no scenarios for whether it needs them - on a yes, the chat writes them (default: true)
24
23
  * sentinel: true # a chat of its own every finished pulse goes to, which tests the release and tells you what is wrong: true, false, or ask - the person asked before it first opens in a session (default: ask)
25
24
  * rules-off: [integrations] # ***plain rules to leave out of the prompts, by name (default: none)
26
25
  * unittests-script: test_scripts/run_unittests.sh # the testing scripts - see test-scripts.ts
@@ -128,10 +127,9 @@ export interface ModelChoice {
128
127
  /**
129
128
  * The agents turri starts, by what they do - each can be given its own model, thinking and turn limit (`models:`).
130
129
  * The code fixer of a conformance run and the repair agent are coding agents; the unit-test and conformance arbiters
131
- * are both `arbiter`. The test advisor's calls - classifying a functional spec, its probes, its readers, its verifier -
132
- * are `advisor`.
130
+ * are both `arbiter`.
133
131
  */
134
- export declare const AGENT_ROLES: readonly ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger", "advisor"];
132
+ export declare const AGENT_ROLES: readonly ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"];
135
133
  export type AgentRole = (typeof AGENT_ROLES)[number];
136
134
  /**
137
135
  * How hard each role thinks when nothing names a level - not the config's `models:`, nor a `:level` on the model it is
@@ -181,11 +179,6 @@ export declare function skillModel(root: string, role?: "harness" | "coding"): s
181
179
  * The coding role always runs on what it is given: its config is already in it (projectModels).
182
180
  */
183
181
  export declare function roleModel(config: Pick<ProjectConfig, "harnessModel" | "judgeModel" | "models">, role: AgentRole): ModelChoice | undefined;
184
- /**
185
- * What the test advisor's calls run on: `models.advisor` - else `default` - and without either the coding
186
- * model alone, thinking as the role has it (ROLE_THINKING). Undefined when the config names no model at all.
187
- */
188
- export declare function advisorModel(config: ProjectConfig): string | undefined;
189
182
  /** How long each turn of a role's agents may take, in milliseconds: its own, `default`'s, `turn-limit:`'s - or undefined, the harness's default. */
190
183
  export declare function roleTurnLimitMs(config: Pick<ProjectConfig, "models" | "turnLimit">, role: AgentRole | undefined): number | undefined;
191
184
  /** `sentinel:` - on, off, or `ask`: on once the person says so, asked before it first opens in a session. */
@@ -230,13 +223,6 @@ export interface ProjectConfig {
230
223
  * asked, before it first opens in a session, whether to start it. Unset: ask.
231
224
  */
232
225
  sentinel?: SentinelSetting;
233
- /**
234
- * Whether the test advisor starts by itself: in the chat and a host, each new or changed functional spec with no
235
- * scenarios is classified in the background, and on a yes the chat writes its scenarios (docs/test-advisor.md). false
236
- * turns off only that: the chat's evaluate_tests still works, and asked for scenarios, the chat writes them as before.
237
- * Unset: true.
238
- */
239
- testAdvisor?: boolean;
240
226
  /**
241
227
  * The folder of the test plain files, from the project's folder: a functional spec's scenarios are in its test plain
242
228
  * file in `<test-dir>/<module>/`. Unset: `tests`.
@@ -244,9 +230,9 @@ export interface ProjectConfig {
244
230
  testDir?: string;
245
231
  /**
246
232
  * Whether functional specs' scenarios are written and conformance tested (conformance-switch.ts). False: none - no
247
- * conformance pulse, no conformance testing script, the test advisor and the chat's conform and evaluate_tests off; the
248
- * test plain files there are kept, and not tested. The person asking for tests, or agreeing to the chat's offer, turns it
249
- * on. Unset: false.
233
+ * conformance pulse, no conformance testing script, the chat's conform refused; the test plain
234
+ * files there are kept, and not tested. They make each change take about twice as long, so only the person turns them
235
+ * on - /conform, or this key. Unset: false.
250
236
  */
251
237
  conformanceTests?: boolean;
252
238
  /**
@@ -328,7 +314,6 @@ export declare const CONFIG_KEYS: {
328
314
  readonly allowToStopJobs: "allow-to-stop-jobs";
329
315
  readonly releaseAfterPulse: "release-after-pulse";
330
316
  readonly sentinel: "sentinel";
331
- readonly testAdvisor: "test-advisor";
332
317
  readonly testDir: "test-dir";
333
318
  readonly conformanceTests: "conformance-tests";
334
319
  readonly baseFolder: "base-folder";
@@ -381,7 +366,20 @@ export declare function testDirOf(plainFile: string): string;
381
366
  export declare function configForSpec(plainFile: string): ProjectConfig;
382
367
  /**
383
368
  * One config file, read, or nothing of it when it is not there or does not parse. Parsed again only once the file has
384
- * changed - its size or its modification time - and each caller given its own copy.
369
+ * changed - its size or its modification time - and each caller given its own copy. A file modified less than a second
370
+ * before it was read is read again each time, as git treats a racily clean file: written again within the same tick of
371
+ * the file system's clock - milliseconds on Linux - and to the same size, its stamp would not change.
385
372
  */
386
373
  export declare function readConfigFile(path: string): ProjectConfig;
374
+ /**
375
+ * The keys of the project's own config files - config.turri.yaml and each stack's - that turri reads nothing of: a setting
376
+ * turri no longer has (`test-advisor`), or one misspelt. Said as turri starts, so a setting the person thinks is on is
377
+ * not silently ignored. config.yaml is left out: it may be another tool's, with keys of its own.
378
+ */
379
+ export declare function unknownConfigKeys(root: string): Array<{
380
+ file: string;
381
+ keys: string[];
382
+ }>;
383
+ /** The banner's line for each config file with keys turri does not read. */
384
+ export declare function unknownConfigLines(root: string): string[];
387
385
  export {};
package/dist/config.js CHANGED
@@ -11,7 +11,7 @@ import { projectDirOf } from "./regenerate/paths.js";
11
11
  *
12
12
  * ```yaml
13
13
  * module: prism_cli.plain # what `turri regenerate` builds by default
14
- * conformance-tests: false # whether scenarios are written and conformance tested - false: none, the test advisor off (default: false)
14
+ * conformance-tests: false # whether scenarios are written and conformance tested - false: none (default: false)
15
15
  * test-dir: tests # where the test plain files are, a folder per module: tests/<module>/ (default: tests)
16
16
  * base-folder: existing-app # a codebase that requires none starts as a copy of it - code to build on, assets to use
17
17
  * harness-model: # the model you chat with in `turri`
@@ -26,7 +26,6 @@ import { projectDirOf } from "./regenerate/paths.js";
26
26
  * mutation-testing: false # give the coding agent and the reviewer can_it_fail (default: true)
27
27
  * allow-to-stop-jobs: false # stop a running job the spec moved on from (default: true)
28
28
  * release-after-pulse: true # release what each pulse lands, as its last stage, before the next pulse (default: false)
29
- * test-advisor: false # check each new or changed functional spec with no scenarios for whether it needs them - on a yes, the chat writes them (default: true)
30
29
  * sentinel: true # a chat of its own every finished pulse goes to, which tests the release and tells you what is wrong: true, false, or ask - the person asked before it first opens in a session (default: ask)
31
30
  * rules-off: [integrations] # ***plain rules to leave out of the prompts, by name (default: none)
32
31
  * unittests-script: test_scripts/run_unittests.sh # the testing scripts - see test-scripts.ts
@@ -83,16 +82,19 @@ function legacyStackConfigFile(stack) {
83
82
  }
84
83
  /**
85
84
  * The names in a folder - read again only once the folder itself has changed: a name added, removed or renamed in it
86
- * moves its modification time. Asked many times a look, for every module of every chain.
85
+ * moves its modification time. Asked many times a look, for every module of every chain. A folder changed less than a
86
+ * second before it was read is read again each time: a name added within the same tick of the file system's clock
87
+ * would not move it (readConfigFile).
87
88
  */
88
89
  function namesIn(root) {
89
90
  try {
90
91
  const at = statSync(root).mtimeMs;
91
92
  const kept = keptNames.get(root);
92
- if (kept !== undefined && kept.at === at)
93
+ if (kept !== undefined && kept.at === at && at < kept.readAt - RACY_MS)
93
94
  return [...kept.names];
95
+ const readAt = Date.now();
94
96
  const names = readdirSync(root);
95
- keptNames.set(root, { at, names });
97
+ keptNames.set(root, { at, names, readAt });
96
98
  if (keptNames.size > 64)
97
99
  keptNames.delete(keptNames.keys().next().value);
98
100
  return [...names];
@@ -229,10 +231,9 @@ export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhig
229
231
  /**
230
232
  * The agents turri starts, by what they do - each can be given its own model, thinking and turn limit (`models:`).
231
233
  * The code fixer of a conformance run and the repair agent are coding agents; the unit-test and conformance arbiters
232
- * are both `arbiter`. The test advisor's calls - classifying a functional spec, its probes, its readers, its verifier -
233
- * are `advisor`.
234
+ * are both `arbiter`.
234
235
  */
235
- export const AGENT_ROLES = ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger", "advisor"];
236
+ export const AGENT_ROLES = ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"];
236
237
  /**
237
238
  * How hard each role thinks when nothing names a level - not the config's `models:`, nor a `:level` on the model it is
238
239
  * given. The agents that do the work - write the code and the tests, explore, release - think little: they work from a
@@ -244,7 +245,6 @@ export const ROLE_THINKING = {
244
245
  conformance: "low",
245
246
  explorer: "low",
246
247
  release: "low",
247
- advisor: "low",
248
248
  reviewer: "medium",
249
249
  "test-reviewer": "medium",
250
250
  judge: "medium",
@@ -344,14 +344,6 @@ export function roleModel(config, role) {
344
344
  const legacy = role === "judge" || role === "test-reviewer" ? config.judgeModel : undefined;
345
345
  return inheritModel(own, inheritModel(legacy, choiceOf(models.default)));
346
346
  }
347
- /**
348
- * What the test advisor's calls run on: `models.advisor` - else `default` - and without either the coding
349
- * model alone, thinking as the role has it (ROLE_THINKING). Undefined when the config names no model at all.
350
- */
351
- export function advisorModel(config) {
352
- const coding = projectModels(config).coding?.model;
353
- return modelSpec(inheritModel(roleModel(config, "advisor"), coding !== undefined ? { model: coding } : undefined));
354
- }
355
347
  /** How long each turn of a role's agents may take, in milliseconds: its own, `default`'s, `turn-limit:`'s - or undefined, the harness's default. */
356
348
  export function roleTurnLimitMs(config, role) {
357
349
  const models = config.models ?? {};
@@ -414,7 +406,6 @@ export const CONFIG_KEYS = {
414
406
  allowToStopJobs: "allow-to-stop-jobs",
415
407
  releaseAfterPulse: "release-after-pulse",
416
408
  sentinel: "sentinel",
417
- testAdvisor: "test-advisor",
418
409
  testDir: "test-dir",
419
410
  conformanceTests: "conformance-tests",
420
411
  baseFolder: "base-folder",
@@ -545,28 +536,35 @@ export function configForSpec(plainFile) {
545
536
  }
546
537
  /**
547
538
  * One config file, read, or nothing of it when it is not there or does not parse. Parsed again only once the file has
548
- * changed - its size or its modification time - and each caller given its own copy.
539
+ * changed - its size or its modification time - and each caller given its own copy. A file modified less than a second
540
+ * before it was read is read again each time, as git treats a racily clean file: written again within the same tick of
541
+ * the file system's clock - milliseconds on Linux - and to the same size, its stamp would not change.
549
542
  */
550
543
  export function readConfigFile(path) {
551
544
  let stamp;
545
+ let modified;
552
546
  try {
553
547
  const stat = statSync(path);
554
548
  if (!stat.isFile())
555
549
  return {};
556
550
  stamp = `${stat.size}:${stat.mtimeMs}:${stat.ino}`;
551
+ modified = stat.mtimeMs;
557
552
  }
558
553
  catch {
559
554
  return {};
560
555
  }
561
556
  const kept = keptConfigs.get(path);
562
- if (kept !== undefined && kept.stamp === stamp)
557
+ if (kept !== undefined && kept.stamp === stamp && modified < kept.readAt - RACY_MS)
563
558
  return structuredClone(kept.config);
559
+ const readAt = Date.now();
564
560
  const config = readConfigFileNow(path);
565
- keptConfigs.set(path, { stamp, config });
561
+ keptConfigs.set(path, { stamp, config, readAt });
566
562
  if (keptConfigs.size > 64)
567
563
  keptConfigs.delete(keptConfigs.keys().next().value);
568
564
  return structuredClone(config);
569
565
  }
566
+ /** How long before it was read a config file must have last changed for its stamp to be trusted. */
567
+ const RACY_MS = 1_000;
570
568
  const keptConfigs = new Map();
571
569
  function readConfigFileNow(path) {
572
570
  let parsed;
@@ -589,7 +587,6 @@ function readConfigFileNow(path) {
589
587
  allowToStopJobs: typeof raw[CONFIG_KEYS.allowToStopJobs] === "boolean" ? raw[CONFIG_KEYS.allowToStopJobs] : undefined,
590
588
  releaseAfterPulse: typeof raw[CONFIG_KEYS.releaseAfterPulse] === "boolean" ? raw[CONFIG_KEYS.releaseAfterPulse] : undefined,
591
589
  sentinel: typeof raw[CONFIG_KEYS.sentinel] === "boolean" || raw[CONFIG_KEYS.sentinel] === "ask" ? raw[CONFIG_KEYS.sentinel] : undefined,
592
- testAdvisor: typeof raw[CONFIG_KEYS.testAdvisor] === "boolean" ? raw[CONFIG_KEYS.testAdvisor] : undefined,
593
590
  testDir: text(raw[CONFIG_KEYS.testDir]),
594
591
  conformanceTests: typeof raw[CONFIG_KEYS.conformanceTests] === "boolean" ? raw[CONFIG_KEYS.conformanceTests] : undefined,
595
592
  baseFolder: text(raw[CONFIG_KEYS.baseFolder]),
@@ -621,3 +618,33 @@ function readConfigFileNow(path) {
621
618
  turnLimit: turnLimitSetting(raw[CONFIG_KEYS.turnLimit]),
622
619
  };
623
620
  }
621
+ /** Keys a config file is read for besides CONFIG_KEYS: the older spellings turri still takes. */
622
+ const OLDER_KEYS = ["model", "turn_limit"];
623
+ /**
624
+ * The keys of the project's own config files - config.turri.yaml and each stack's - that turri reads nothing of: a setting
625
+ * turri no longer has (`test-advisor`), or one misspelt. Said as turri starts, so a setting the person thinks is on is
626
+ * not silently ignored. config.yaml is left out: it may be another tool's, with keys of its own.
627
+ */
628
+ export function unknownConfigKeys(root) {
629
+ const known = new Set([...Object.values(CONFIG_KEYS), ...OLDER_KEYS]);
630
+ const found = [];
631
+ for (const file of namesIn(root).filter((name) => /^config\.turri(\.[^.]+)?\.yaml$/.test(name)).sort()) {
632
+ let parsed;
633
+ try {
634
+ parsed = loadYaml(readFileSync(join(root, file), "utf8"));
635
+ }
636
+ catch {
637
+ continue;
638
+ }
639
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
640
+ continue;
641
+ const keys = Object.keys(parsed).filter((key) => !known.has(key));
642
+ if (keys.length > 0)
643
+ found.push({ file, keys });
644
+ }
645
+ return found;
646
+ }
647
+ /** The banner's line for each config file with keys turri does not read. */
648
+ export function unknownConfigLines(root) {
649
+ return unknownConfigKeys(root).map(({ file, keys }) => `${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.`);
650
+ }
@@ -1,15 +1,13 @@
1
- import { type ToolDefinition } from "@earendil-works/pi-coding-agent";
2
1
  /**
3
2
  * Whether a project's functional specs are conformance tested: `conformance-tests:` in its config, a stack's own over the
4
- * project's, false when unset. Off, nothing of conformance testing runs - no conformance pulse, no conformance testing
5
- * script, the test advisor and the chat's conform and evaluate_tests off; the test plain files there are kept, and not
6
- * tested. The chat always knows it, and how they are turned on: the person asking for tests, or agreeing to the chat's
7
- * offer of them, turns them on - for this session and the next, written into the config.
3
+ * project's, false when unset. Conformance testing is a validation step that makes each change take about twice as long,
4
+ * so it is off until the person turns it on - with /conform, or the setting - and they keep it off to iterate fast. Off,
5
+ * nothing of conformance testing runs - no conformance pulse, no conformance testing script, the
6
+ * chat's conform refused; the test plain files there are kept, and not tested. The chat never turns them on: it says why
7
+ * it wants them, and the person decides.
8
8
  */
9
- /** The chat's tools that run conformance testing: there while the tests are on. */
10
- export declare const CONFORMANCE_TOOLS: string[];
11
- /** The chat's tool that turns them on: there while they are off. */
12
- export declare const TURN_ON_TOOL = "turn_on_conformance_tests";
9
+ /** Why the chat's conform, or a skill that writes the conformance testing script, is refused while they are off. */
10
+ export declare const CONFORMANCE_OFF_REFUSAL: string;
13
11
  /** Whether a module's functional specs are conformance tested: its stack's `conformance-tests:` over the project's. */
14
12
  export declare function conformanceTestsOn(plainFile: string): boolean;
15
13
  /** Whether the project conformance tests anything: its own config, or a stack's - for the chat's tools, which are the project's. */
@@ -24,11 +22,3 @@ export declare function turnOnConformanceTests(project: string, plainFile?: stri
24
22
  * turned on, and that it may offer it.
25
23
  */
26
24
  export declare function conformanceBlock(on: boolean): string;
27
- /**
28
- * turn_on_conformance_tests: the chat turns conformance testing on, the person having asked for it or agreed to it.
29
- * `turnOn` is the session's (extension.ts `turnOnConformance`): the setting written, every chat's tools switched - the
30
- * file written, from the project.
31
- */
32
- export declare function turnOnConformanceTestsTool(options: {
33
- turnOn: (plainFile?: string) => string;
34
- }): ToolDefinition;
@@ -1,20 +1,20 @@
1
1
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
- import { defineTool } from "@earendil-works/pi-coding-agent";
4
- import { Type } from "typebox";
5
3
  import { adoptLegacyConfig, CONFIG_FILE, CONFIG_KEYS, configForSpec, readConfigFile, readProjectConfig, stackConfigFileIn, stackForModule, stackOf, stacksOf } from "./config.js";
6
4
  import { withSetting, writeSetting } from "./config-edit.js";
7
5
  /**
8
6
  * Whether a project's functional specs are conformance tested: `conformance-tests:` in its config, a stack's own over the
9
- * project's, false when unset. Off, nothing of conformance testing runs - no conformance pulse, no conformance testing
10
- * script, the test advisor and the chat's conform and evaluate_tests off; the test plain files there are kept, and not
11
- * tested. The chat always knows it, and how they are turned on: the person asking for tests, or agreeing to the chat's
12
- * offer of them, turns them on - for this session and the next, written into the config.
7
+ * project's, false when unset. Conformance testing is a validation step that makes each change take about twice as long,
8
+ * so it is off until the person turns it on - with /conform, or the setting - and they keep it off to iterate fast. Off,
9
+ * nothing of conformance testing runs - no conformance pulse, no conformance testing script, the
10
+ * chat's conform refused; the test plain files there are kept, and not tested. The chat never turns them on: it says why
11
+ * it wants them, and the person decides.
13
12
  */
14
- /** The chat's tools that run conformance testing: there while the tests are on. */
15
- export const CONFORMANCE_TOOLS = ["conform", "evaluate_tests"];
16
- /** The chat's tool that turns them on: there while they are off. */
17
- export const TURN_ON_TOOL = "turn_on_conformance_tests";
13
+ /** Why the chat's conform, or a skill that writes the conformance testing script, is refused while they are off. */
14
+ export const CONFORMANCE_OFF_REFUSAL = "Conformance tests are off for this project (conformance-tests: false, or unset), and turning them on is the person's " +
15
+ "decision: they make each change take about twice as long, and the person keeps them off to iterate fast. Tell the " +
16
+ "person, in a line or two, why you want conformance tests here; they decide, and turn them on with /conform - which " +
17
+ "also starts them - or /turri-config conformance-tests true. Nothing was started.";
18
18
  /** Whether a module's functional specs are conformance tested: its stack's `conformance-tests:` over the project's. */
19
19
  export function conformanceTestsOn(plainFile) {
20
20
  try {
@@ -65,44 +65,22 @@ export function conformanceBlock(on) {
65
65
  "<conformance-tests>",
66
66
  what,
67
67
  on
68
- ? "They are on here (conformance-tests: true): functional specs with scenarios are conformance tested, and the test advisor checks new ones in the background."
68
+ ? [
69
+ "They are on here (conformance-tests: true): functional specs with scenarios are conformance tested once their code is",
70
+ "built. As you write or change a functional spec, judge whether it needs scenarios, as the rules on test plain files say,",
71
+ "and write them when it does - in the same change, a visible ***plain change the person reviews like any other.",
72
+ "Scenarios are tested only once their module has test reqs and the project a conformance testing script: when you",
73
+ "write scenarios and one of those is missing, write it first, in that order - the test reqs, then the script with",
74
+ "implement-conformance-testing-script - asking nothing: conformance tests on is the person's yes to them.",
75
+ ].join("\n")
69
76
  : [
70
- "They are off here (conformance-tests: false, or unset): no scenarios are written or tested, no conformance testing script, the test",
71
- "advisor is off, and conform and evaluate_tests are not among your tools. Test plain files already there are kept, and not tested.",
72
- `When the person asks for conformance tests, or testing scenarios, call ${TURN_ON_TOOL} - their asking is their yes - then`,
73
- "go on with what they asked: the test reqs, the conformance testing script, the scenarios.",
74
- "You may offer them yourself, once and in a line, never turning them on unasked: when a functional spec could go wrong",
75
- "silently, or the coding agent keeps failing at one - say what they would add, and ask. A yes, and you call the tool.",
76
- "Asked how they are turned on: by asking you, /conform - which turns them on and tests what is built - or /turri-config conformance-tests true.",
77
+ "They are off here (conformance-tests: false, or unset). They make each change take about twice as long, so the person",
78
+ "keeps them off to iterate fast, and turning them on is theirs alone. While off, no conformance tests are written or run,",
79
+ "no conformance testing script either, and conform is refused. Test plain files already there are",
80
+ "kept, and not tested. When you think conformance tests are worth it here - the person asks for tests, a functional spec",
81
+ "could go wrong silently, or the coding agent keeps failing at one - tell them in a line or two why, and what it costs.",
82
+ "They decide, and turn them on with /conform - which also tests what is built - or /turri-config conformance-tests true.",
77
83
  ].join("\n"),
78
84
  "</conformance-tests>",
79
85
  ].join("\n");
80
86
  }
81
- /**
82
- * turn_on_conformance_tests: the chat turns conformance testing on, the person having asked for it or agreed to it.
83
- * `turnOn` is the session's (extension.ts `turnOnConformance`): the setting written, every chat's tools switched - the
84
- * file written, from the project.
85
- */
86
- export function turnOnConformanceTestsTool(options) {
87
- return defineTool({
88
- name: TURN_ON_TOOL,
89
- label: "Turn on conformance tests",
90
- description: "Turn conformance tests on for this project - conformance-tests: true in its config, for this session and the next - " +
91
- "once the person asked for conformance tests or testing scenarios, or agreed when you offered them. conform and " +
92
- "evaluate_tests become your tools, the test advisor starts checking new functional specs, and the work loop writes " +
93
- "and runs the conformance tests of every functional spec with scenarios once its code is built. Never call it unasked.",
94
- promptSnippet: `${TURN_ON_TOOL}: turn conformance tests on, the person having asked for them or agreed`,
95
- parameters: Type.Object({
96
- plain_file: Type.Optional(Type.String({ description: "The module the tests are for: its stack's config is written when that names the key. Omitted: config.turri.yaml." })),
97
- }),
98
- async execute(_id, params) {
99
- const file = options.turnOn(params.plain_file);
100
- const text = `Conformance tests are on for this project now - conformance-tests: true, written in ${file}. Say so to the person in a line. ` +
101
- "conform and evaluate_tests are your tools from your next turn, and the test advisor checks new functional specs. Go on " +
102
- "with what they asked: the test reqs, the conformance testing script, the scenarios - in that order, only what is missing. " +
103
- "Functional specs with scenarios written already, their code built, are tested once the module is next regenerated: " +
104
- "call conform for them to have their tests written now.";
105
- return { content: [{ type: "text", text }], details: { file } };
106
- },
107
- });
108
- }
package/dist/drift-cli.js CHANGED
@@ -18,7 +18,7 @@ if (named === undefined) {
18
18
  }
19
19
  try {
20
20
  refuseTestPlainFile(named);
21
- const loop = createWorkLoop({ registry: createJobRegistry(), cwd: process.cwd(), planner: false, dryRun: true });
21
+ const loop = createWorkLoop({ registry: createJobRegistry(), cwd: process.cwd(), planner: false });
22
22
  console.log(describeDrift(loop.drift(named)));
23
23
  }
24
24
  catch (error) {