@turri-dev/cli 0.2.3 → 0.2.4-next.240620d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chat-idle.d.ts +2 -2
- package/dist/chat-idle.js +2 -2
- package/dist/chats.d.ts +0 -10
- package/dist/chats.js +0 -23
- package/dist/cli.js +2 -5
- package/dist/config-edit.js +1 -3
- package/dist/config.d.ts +6 -21
- package/dist/config.js +3 -16
- package/dist/conformance-switch.d.ts +7 -17
- package/dist/conformance-switch.js +21 -46
- package/dist/drift-cli.js +1 -1
- package/dist/extension.d.ts +2 -10
- package/dist/extension.js +109 -205
- package/dist/genome.js +5 -48
- package/dist/graph.js +3 -5
- package/dist/host-session.d.ts +4 -15
- package/dist/host-session.js +2 -4
- package/dist/host.d.ts +1 -3
- package/dist/host.js +1 -4
- package/dist/identity.js +0 -1
- package/dist/init-config.d.ts +0 -1
- package/dist/init-config.js +2 -9
- package/dist/installed-providers.d.ts +1 -1
- package/dist/installed-providers.js +1 -1
- package/dist/loop-cli.d.ts +4 -3
- package/dist/loop-cli.js +13 -11
- package/dist/loop-tools.js +5 -10
- package/dist/new-project.js +2 -2
- package/dist/pi-launch.js +1 -1
- package/dist/pi.js +6 -6
- package/dist/plain/check.d.ts +1 -8
- package/dist/plain/check.js +3 -38
- package/dist/regenerate/activity.d.ts +0 -7
- package/dist/regenerate/activity.js +2 -20
- package/dist/regenerate/failure-reports.d.ts +28 -0
- package/dist/regenerate/failure-reports.js +79 -0
- package/dist/regenerate/jobs-tree.js +1 -1
- package/dist/regenerate/jobs.d.ts +2 -0
- package/dist/regenerate/jobs.js +4 -0
- package/dist/regenerate/ledger-view.d.ts +11 -24
- package/dist/regenerate/ledger-view.js +14 -60
- package/dist/regenerate/ledger.d.ts +1 -14
- package/dist/regenerate/ledger.js +1 -1
- package/dist/regenerate/loop.d.ts +37 -60
- package/dist/regenerate/loop.js +165 -101
- package/dist/regenerate/regenerate.d.ts +0 -2
- package/dist/regenerate/regenerate.js +0 -14
- package/dist/regenerate/standing.js +1 -1
- package/dist/regenerate/testing-steps.d.ts +11 -0
- package/dist/regenerate/testing-steps.js +22 -3
- package/dist/regenerate-cli.js +18 -9
- package/dist/self-invocation.js +4 -7
- package/dist/sentinel.js +3 -3
- package/dist/skill.d.ts +0 -11
- package/dist/skill.js +0 -9
- package/dist/stacks.js +1 -1
- package/dist/tools.js +2 -3
- package/docs/README.md +0 -2
- package/docs/authoring-plain.md +3 -3
- package/docs/chats.md +1 -3
- package/docs/config.md +10 -12
- package/docs/deploy.md +1 -1
- package/docs/development.md +2 -3
- package/docs/headless.md +4 -3
- package/docs/hosting.md +6 -6
- package/docs/parser.md +2 -2
- package/docs/regenerating.md +12 -10
- package/docs/sentinel.md +3 -3
- package/docs/skills-and-gates.md +3 -8
- package/docs/using.md +10 -18
- package/genome/rules/test-plain-files.md +15 -7
- package/genome/rules/turri-regeneration.md +4 -9
- package/genome/skills/convert-old-syntax/SKILL.md +5 -5
- package/package.json +1 -1
- package/dist/advisor-chat.d.ts +0 -63
- package/dist/advisor-chat.js +0 -290
- package/dist/change-plain-cli.d.ts +0 -1
- package/dist/change-plain-cli.js +0 -55
- package/dist/ledger-cli.d.ts +0 -1
- package/dist/ledger-cli.js +0 -50
- package/dist/ledger-tools.d.ts +0 -10
- package/dist/ledger-tools.js +0 -64
- package/dist/regenerate/advisor-records.d.ts +0 -93
- package/dist/regenerate/advisor-records.js +0 -110
- package/dist/regenerate/advisor-runs.d.ts +0 -87
- package/dist/regenerate/advisor-runs.js +0 -327
- package/dist/regenerate/test-advisor.d.ts +0 -101
- package/dist/regenerate/test-advisor.js +0 -379
- package/dist/spec-tools.d.ts +0 -36
- package/dist/spec-tools.js +0 -128
- 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
|
|
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,
|
|
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
|
|
package/dist/chat-idle.d.ts
CHANGED
|
@@ -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
|
|
5
|
-
*
|
|
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
|
|
3
|
-
*
|
|
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
|
};
|
|
@@ -172,7 +169,7 @@ if (command === "-v" || command === "--version") {
|
|
|
172
169
|
// The AWS region the project's Bedrock models need, set before any model is called - here, and in the pi the chat starts,
|
|
173
170
|
// which inherits it - unless the person set one (bedrock-region.ts). The models named on the command line count too. A
|
|
174
171
|
// command that calls no model is left alone.
|
|
175
|
-
if (!["parse", "drift", "lineage", "
|
|
172
|
+
if (!["parse", "drift", "lineage", "init-config", ...Object.keys(PACKAGE_COMMANDS)].includes(command ?? "")) {
|
|
176
173
|
const { applyBedrockRegion } = await import("./bedrock-region.js");
|
|
177
174
|
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
175
|
applyBedrockRegion(process.cwd(), { also: named.filter((model) => model !== "") });
|
|
@@ -215,7 +212,7 @@ process.argv = [
|
|
|
215
212
|
// A headless run is stopped by a signal - SIGTERM, SIGHUP, Ctrl-C - whatever else listens for it: it exits, and what
|
|
216
213
|
// its agents left running goes with it (shell.ts kills every process group on exit). Left to the libraries' own
|
|
217
214
|
// 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"
|
|
215
|
+
if (!["parse", "drift", "lineage"].includes(command)) {
|
|
219
216
|
for (const [signal, code] of [["SIGTERM", 143], ["SIGHUP", 129], ["SIGINT", 130]]) {
|
|
220
217
|
process.on(signal, () => {
|
|
221
218
|
console.error(`\nstopped (${signal})`);
|
package/dist/config-edit.js
CHANGED
|
@@ -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: "
|
|
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
|
|
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`.
|
|
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"
|
|
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
|
|
248
|
-
*
|
|
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";
|
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
|
|
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
|
|
@@ -229,10 +228,9 @@ export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhig
|
|
|
229
228
|
/**
|
|
230
229
|
* The agents turri starts, by what they do - each can be given its own model, thinking and turn limit (`models:`).
|
|
231
230
|
* The code fixer of a conformance run and the repair agent are coding agents; the unit-test and conformance arbiters
|
|
232
|
-
* are both `arbiter`.
|
|
233
|
-
* are `advisor`.
|
|
231
|
+
* are both `arbiter`.
|
|
234
232
|
*/
|
|
235
|
-
export const AGENT_ROLES = ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"
|
|
233
|
+
export const AGENT_ROLES = ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"];
|
|
236
234
|
/**
|
|
237
235
|
* How hard each role thinks when nothing names a level - not the config's `models:`, nor a `:level` on the model it is
|
|
238
236
|
* given. The agents that do the work - write the code and the tests, explore, release - think little: they work from a
|
|
@@ -244,7 +242,6 @@ export const ROLE_THINKING = {
|
|
|
244
242
|
conformance: "low",
|
|
245
243
|
explorer: "low",
|
|
246
244
|
release: "low",
|
|
247
|
-
advisor: "low",
|
|
248
245
|
reviewer: "medium",
|
|
249
246
|
"test-reviewer": "medium",
|
|
250
247
|
judge: "medium",
|
|
@@ -344,14 +341,6 @@ export function roleModel(config, role) {
|
|
|
344
341
|
const legacy = role === "judge" || role === "test-reviewer" ? config.judgeModel : undefined;
|
|
345
342
|
return inheritModel(own, inheritModel(legacy, choiceOf(models.default)));
|
|
346
343
|
}
|
|
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
344
|
/** 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
345
|
export function roleTurnLimitMs(config, role) {
|
|
357
346
|
const models = config.models ?? {};
|
|
@@ -414,7 +403,6 @@ export const CONFIG_KEYS = {
|
|
|
414
403
|
allowToStopJobs: "allow-to-stop-jobs",
|
|
415
404
|
releaseAfterPulse: "release-after-pulse",
|
|
416
405
|
sentinel: "sentinel",
|
|
417
|
-
testAdvisor: "test-advisor",
|
|
418
406
|
testDir: "test-dir",
|
|
419
407
|
conformanceTests: "conformance-tests",
|
|
420
408
|
baseFolder: "base-folder",
|
|
@@ -589,7 +577,6 @@ function readConfigFileNow(path) {
|
|
|
589
577
|
allowToStopJobs: typeof raw[CONFIG_KEYS.allowToStopJobs] === "boolean" ? raw[CONFIG_KEYS.allowToStopJobs] : undefined,
|
|
590
578
|
releaseAfterPulse: typeof raw[CONFIG_KEYS.releaseAfterPulse] === "boolean" ? raw[CONFIG_KEYS.releaseAfterPulse] : undefined,
|
|
591
579
|
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
580
|
testDir: text(raw[CONFIG_KEYS.testDir]),
|
|
594
581
|
conformanceTests: typeof raw[CONFIG_KEYS.conformanceTests] === "boolean" ? raw[CONFIG_KEYS.conformanceTests] : undefined,
|
|
595
582
|
baseFolder: text(raw[CONFIG_KEYS.baseFolder]),
|
|
@@ -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.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
-
/**
|
|
10
|
-
export declare const
|
|
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.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
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
|
-
/**
|
|
15
|
-
export const
|
|
16
|
-
|
|
17
|
-
|
|
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,19 @@ export function conformanceBlock(on) {
|
|
|
65
65
|
"<conformance-tests>",
|
|
66
66
|
what,
|
|
67
67
|
on
|
|
68
|
-
?
|
|
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
|
+
].join("\n")
|
|
69
73
|
: [
|
|
70
|
-
"They are off here (conformance-tests: false, or unset)
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
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.",
|
|
74
|
+
"They are off here (conformance-tests: false, or unset). They make each change take about twice as long, so the person",
|
|
75
|
+
"keeps them off to iterate fast, and turning them on is theirs alone. While off, no conformance tests are written or run,",
|
|
76
|
+
"no conformance testing script either, and conform is refused. Test plain files already there are",
|
|
77
|
+
"kept, and not tested. When you think conformance tests are worth it here - the person asks for tests, a functional spec",
|
|
78
|
+
"could go wrong silently, or the coding agent keeps failing at one - tell them in a line or two why, and what it costs.",
|
|
79
|
+
"They decide, and turn them on with /conform - which also tests what is built - or /turri-config conformance-tests true.",
|
|
77
80
|
].join("\n"),
|
|
78
81
|
"</conformance-tests>",
|
|
79
82
|
].join("\n");
|
|
80
83
|
}
|
|
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
|
|
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) {
|
package/dist/extension.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { stackOnMachine } from "./stack.ts";
|
|
|
4
4
|
import { createAskUserTool } from "./tools.ts";
|
|
5
5
|
import { fromWorkingDir } from "./loop-tools.ts";
|
|
6
6
|
import { type WorkLoop } from "./regenerate/loop.ts";
|
|
7
|
-
import { type TestAdvisor } from "./regenerate/advisor-runs.ts";
|
|
8
7
|
import { type AskUser, type AskUserIO } from "./ask.ts";
|
|
9
8
|
import { type TurriCore, type TurriHost } from "./chats.ts";
|
|
10
9
|
/**
|
|
@@ -39,11 +38,6 @@ export type { TurriHost } from "./chats.ts";
|
|
|
39
38
|
export declare function createTurriCore(host?: TurriHost, options?: {
|
|
40
39
|
persist?: boolean;
|
|
41
40
|
dialogs?: (chat: string) => AskUserIO | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Whether the session has a test advisor (docs/test-advisor.md): the terminal's chat and a host - never pi's print,
|
|
44
|
-
* json and rpc modes, which end when the answer is printed, nor a headless command, which builds its own loop.
|
|
45
|
-
*/
|
|
46
|
-
advisor?: boolean;
|
|
47
41
|
}): TurriCore;
|
|
48
42
|
/** The session of this process: pi-launch.ts's, or one made as pi first builds the extension (`pi -e src/extension.ts`). */
|
|
49
43
|
export declare function processSession(make?: () => TurriCore): TurriCore;
|
|
@@ -137,13 +131,11 @@ export declare function machineNeeds(cwd: string, work?: (cwd: string) => Return
|
|
|
137
131
|
export declare function projectConfigBlock(root: string): string;
|
|
138
132
|
/**
|
|
139
133
|
* Conformance tests turned on, for the session: `conformance-tests: true` written where the module's value comes from
|
|
140
|
-
* (conformance-switch.ts)
|
|
141
|
-
*
|
|
134
|
+
* (conformance-switch.ts) - what /conform does when they are off, and a host's turnOnConformance. Every chat is told at
|
|
135
|
+
* its next turn. `plainFile`, absolute or from the project, picks the module whose stack's file
|
|
142
136
|
* is written when that names the key. Returns the file written, from the project. Starts no conformance pulse.
|
|
143
137
|
*/
|
|
144
138
|
export declare function turnOnConformance(core: TurriCore, plainFile?: string): string;
|
|
145
|
-
/** The session's test advisor, when it has one: the chat's and a host's - never pi's print, json and rpc modes'. */
|
|
146
|
-
export declare function sessionAdvisor(session: TurriCore): TestAdvisor | undefined;
|
|
147
139
|
export { fromWorkingDir };
|
|
148
140
|
/**
|
|
149
141
|
* What the agent is to do with a job that just ended, unasked: what the project's guidance says to do then, or else say
|