@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.
- package/README.md +3 -4
- package/dist/bedrock-region.js +3 -3
- package/dist/chat-models.d.ts +1 -1
- package/dist/chat-models.js +1 -1
- package/dist/chat-scope.d.ts +1 -3
- package/dist/chats.d.ts +2 -2
- package/dist/chats.js +3 -3
- package/dist/cli.js +6 -23
- package/dist/config-edit.d.ts +20 -8
- package/dist/config-edit.js +29 -21
- package/dist/config.d.ts +43 -50
- package/dist/config.js +122 -104
- package/dist/conform-cli.js +1 -1
- package/dist/conformance-switch.d.ts +7 -6
- package/dist/conformance-switch.js +16 -16
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +82 -200
- package/dist/host-session.d.ts +2 -2
- package/dist/host-session.js +2 -2
- package/dist/host.d.ts +1 -1
- package/dist/host.js +3 -3
- package/dist/init-config.js +1 -1
- package/dist/loop-tools.d.ts +9 -13
- package/dist/loop-tools.js +32 -37
- package/dist/parse-cli.js +2 -2
- package/dist/pi-launch.js +3 -0
- package/dist/pi-settings.d.ts +4 -0
- package/dist/pi-settings.js +39 -0
- package/dist/pi.js +3 -3
- package/dist/plain/check.d.ts +1 -1
- package/dist/plain/check.js +3 -1
- package/dist/plain-files.js +4 -4
- package/dist/regenerate/agent-env.d.ts +1 -1
- package/dist/regenerate/agent-env.js +3 -3
- package/dist/regenerate/agent-shell.js +2 -2
- package/dist/regenerate/base-folder.d.ts +2 -2
- package/dist/regenerate/base-folder.js +1 -1
- package/dist/regenerate/jobs.d.ts +2 -2
- package/dist/regenerate/jobs.js +10 -10
- package/dist/regenerate/ledger.d.ts +1 -1
- package/dist/regenerate/loop.d.ts +3 -3
- package/dist/regenerate/loop.js +27 -23
- package/dist/regenerate/model-names.d.ts +33 -0
- package/dist/regenerate/{engine.js → model-names.js} +2 -28
- package/dist/regenerate/paths.d.ts +1 -1
- package/dist/regenerate/paths.js +2 -2
- package/dist/regenerate/scripts-being-written.d.ts +4 -4
- package/dist/regenerate/scripts-being-written.js +3 -3
- package/dist/regenerate/test-scripts.d.ts +2 -1
- package/dist/regenerate/test-scripts.js +33 -23
- package/dist/regenerate/testing-steps.d.ts +6 -6
- package/dist/regenerate/testing-steps.js +8 -8
- package/dist/{config-command.d.ts → settings.d.ts} +13 -8
- package/dist/{config-command.js → settings.js} +155 -24
- package/dist/setup.d.ts +2 -2
- package/dist/setup.js +7 -7
- package/docs/README.md +2 -2
- package/docs/chats.md +3 -4
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +50 -38
- package/docs/development.md +1 -1
- package/docs/headless.md +1 -2
- package/docs/hosting.md +6 -6
- package/docs/parser.md +1 -1
- package/docs/regenerating.md +9 -9
- package/docs/sentinel.md +2 -2
- package/docs/skills-and-gates.md +1 -2
- package/docs/using.md +8 -17
- package/genome/rules/project-model.md +2 -1
- package/genome/rules/turri-regeneration.md +2 -1
- package/genome/skills/implement-conformance-testing-script/SKILL.md +2 -2
- package/genome/skills/implement-unit-testing-script/SKILL.md +3 -3
- package/package.json +1 -1
- package/dist/regenerate/engine.d.ts +0 -52
- package/dist/stacks.d.ts +0 -13
- package/dist/stacks.js +0 -96
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ So the tools speak its language: **`regenerate`** regenerates the code from \*\*
|
|
|
125
125
|
|
|
126
126
|
## Models
|
|
127
127
|
|
|
128
|
-
`init-config`'s models are only a starting point. **turri** is built on [pi](https://pi.dev), so any model [pi](https://pi.dev) supports works - Anthropic, OpenAI, Google, Amazon Bedrock, OpenRouter, a local one. A model is reached as [pi](https://pi.dev) reaches it - `/login`, in `turri` as in `pi`, the provider's API key in the environment (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, ...), or a cloud account - and named as [pi](https://pi.dev) names it, `provider/model-id`, with `:high`, `:low` and so on for how hard it thinks. It uses three: the **harness** model you talk to, which writes \*\*\*plain and plans the work - worth a capable one - and the **coding** and **judge** models its agents build and judge with, which can be smaller and cheaper, such as GPT-6 Luna or Gemini 3.1 Flash Lite. `turri --harness-model` and `--coding-model` choose them for a session, and [pi](https://pi.dev)'s `/model` switches the one you talk to as you go; to keep them for the project, set them with `/
|
|
128
|
+
`init-config`'s models are only a starting point. **turri** is built on [pi](https://pi.dev), so any model [pi](https://pi.dev) supports works - Anthropic, OpenAI, Google, Amazon Bedrock, OpenRouter, a local one. A model is reached as [pi](https://pi.dev) reaches it - `/login`, in `turri` as in `pi`, the provider's API key in the environment (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, ...), or a cloud account - and named as [pi](https://pi.dev) names it, `provider/model-id`, with `:high`, `:low` and so on for how hard it thinks. It uses three: the **harness** model you talk to, which writes \*\*\*plain and plans the work - worth a capable one - and the **coding** and **judge** models its agents build and judge with, which can be smaller and cheaper, such as GPT-6 Luna or Gemini 3.1 Flash Lite. `turri --harness-model` and `--coding-model` choose them for a session, and [pi](https://pi.dev)'s `/model` switches the one you talk to as you go; to keep them for the project, set them with `/settings harness-model`, `/settings coding-model` and so on - each role's too, as `models.<role>` - or write them in its `config.turri.yaml`:
|
|
129
129
|
|
|
130
130
|
```yaml
|
|
131
131
|
harness-model: anthropic/claude-opus-5-5 # the model you talk to: a capable one
|
|
@@ -155,9 +155,8 @@ In a new project **turri** starts it itself, without asking how: it chooses the
|
|
|
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
|
-
- **`/
|
|
158
|
+
- **`/settings`** 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: `/settings review false`, or `/settings` alone to pick from the list - [pi](https://pi.dev)'s own settings the last entry. Or just ask: "regenerate with gpt 5.5 from now on";
|
|
159
159
|
- **`/sentinel`** says whether the sentinel checks every pulse that finishes: `ask` (you are asked before it first opens), `on` or `off`;
|
|
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
160
|
|
|
162
161
|
Other things to ask for:
|
|
163
162
|
|
|
@@ -189,7 +188,7 @@ Start at the [documentation index](docs/README.md), or go straight to a page:
|
|
|
189
188
|
| [Installation](docs/installation.md) | doctor, what turri needs of this machine, **turri** and `pi`, environment variables |
|
|
190
189
|
| [Examples](examples/README.md) | projects to build with turri step by step: guestbook - a backend and a frontend in minutes - a CLI, and a backend service tested where it matters |
|
|
191
190
|
| [Using **turri**](docs/using.md) | the conversation, skills, tools, pulses and regen, choosing models, the command line |
|
|
192
|
-
| [The project config](docs/config.md) | `config.turri.yaml` and
|
|
191
|
+
| [The project config](docs/config.md) | `config.turri.yaml` and a module's own `config.turri.<module>.yaml`: every key, models and their inheritance, conformance, the testing scripts, which file builds a module, the old `config.yaml` |
|
|
193
192
|
| [Deploy](docs/deploy.md) | trying what is built: the last commit in `dist/<module>`, started on your machine, nothing installed without asking |
|
|
194
193
|
| [Running unattended](docs/headless.md) | regenerating \*\*\*plain overnight or in CI: the command, keeping it running, the results, resuming, rebuilding one functionality |
|
|
195
194
|
| [Authoring \*\*\*plain](docs/authoring-plain.md) | what \*\*\*plain is made of, the authoring rules, the skills that write and fix it, checking it |
|
package/dist/bedrock-region.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { readProjectConfig,
|
|
4
|
+
import { readProjectConfig, moduleConfigsOf } from "./config.js";
|
|
5
5
|
import { bedrockAwsRegion, bedrockNeedsAwsRegion, bedrockPlaceOf } from "./init-config.js";
|
|
6
6
|
import { modelsInUse } from "./model-check.js";
|
|
7
7
|
/** The variable turri marks its own AWS_REGION with, so the pi it starts - and a reload - tells it from the person's. */
|
|
@@ -52,9 +52,9 @@ export function profileRegion(profile, env = process.env) {
|
|
|
52
52
|
}
|
|
53
53
|
return undefined;
|
|
54
54
|
}
|
|
55
|
-
/** The Bedrock models a project uses: every model its config names - each
|
|
55
|
+
/** The Bedrock models a project uses: every model its config names - each module's own file's too - and those given. */
|
|
56
56
|
function bedrockModels(projectDir, also) {
|
|
57
|
-
const configs = [readProjectConfig(projectDir), ...
|
|
57
|
+
const configs = [readProjectConfig(projectDir), ...moduleConfigsOf(projectDir).map((module) => readProjectConfig(projectDir, module))];
|
|
58
58
|
const specs = [...configs.flatMap((config) => modelsInUse(config).map((used) => used.spec)), ...also];
|
|
59
59
|
return [...new Set(specs.filter((spec) => spec.startsWith("amazon-bedrock/")))];
|
|
60
60
|
}
|
package/dist/chat-models.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type ProjectConfig } from "./config.ts";
|
|
|
6
6
|
* is another name for, or else `harness-model:` in config.turri.yaml. The coding model is the one
|
|
7
7
|
* every render runs on: `--coding-model`, or else `coding-model:` in config.turri.yaml - pi knows
|
|
8
8
|
* nothing of it, so it reaches the extension through the environment. Either can still be
|
|
9
|
-
* changed in the conversation: pi's /model,
|
|
9
|
+
* changed in the conversation: pi's /model, and the settings tool or /settings for the coding model.
|
|
10
10
|
*/
|
|
11
11
|
/** The environment variable a chat's --coding-model reaches the extension through. */
|
|
12
12
|
export declare const CODING_MODEL_ENV = "TURRI_CODING_MODEL";
|
package/dist/chat-models.js
CHANGED
|
@@ -6,7 +6,7 @@ import { modelSpec, projectModels } from "./config.js";
|
|
|
6
6
|
* is another name for, or else `harness-model:` in config.turri.yaml. The coding model is the one
|
|
7
7
|
* every render runs on: `--coding-model`, or else `coding-model:` in config.turri.yaml - pi knows
|
|
8
8
|
* nothing of it, so it reaches the extension through the environment. Either can still be
|
|
9
|
-
* changed in the conversation: pi's /model,
|
|
9
|
+
* changed in the conversation: pi's /model, and the settings tool or /settings for the coding model.
|
|
10
10
|
*/
|
|
11
11
|
/** The environment variable a chat's --coding-model reaches the extension through. */
|
|
12
12
|
export const CODING_MODEL_ENV = "TURRI_CODING_MODEL";
|
package/dist/chat-scope.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The chat a piece of work runs for: its tools, its commands, its event handlers - and what they start, a pulse
|
|
3
3
|
* queued from them among it. A turri session holds several chats (chats.ts); what each keeps for itself rides along
|
|
4
|
-
* with its work here: its id, which pulses and the ledger's events carry
|
|
4
|
+
* with its work here: its id, which pulses and the ledger's events carry.
|
|
5
5
|
*/
|
|
6
6
|
export interface ChatScope {
|
|
7
7
|
id: string;
|
|
8
|
-
/** The stack this chat chose with /stack or the stack tool - none: the project's config alone. */
|
|
9
|
-
stack: string | undefined;
|
|
10
8
|
/** The questions it asks now, each with what declines it: a host declines them with `Turri.decline`. */
|
|
11
9
|
readonly asking: Set<() => void>;
|
|
12
10
|
}
|
package/dist/chats.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { type ChatRole, type Conclusion, type Notice, type NoticeAnswer, type No
|
|
|
11
11
|
* The chats of a turri session.
|
|
12
12
|
*
|
|
13
13
|
* One turri process is one session on one project, and holds up to MAX_CHATS chats: conversations, each with its own
|
|
14
|
-
* history, model, thinking level
|
|
14
|
+
* history, model, thinking level and questions, each working while another is shown. What they share is the
|
|
15
15
|
* session's: the one job registry and work loop the project's pulses run in - a pulse any chat starts is in every
|
|
16
16
|
* chat's side panel - the coding model, steering, releases and the ledger.
|
|
17
17
|
*
|
|
@@ -295,7 +295,7 @@ export declare function interruptChat<R>(session: Stoppable, asked: {
|
|
|
295
295
|
export declare function createChats(options: CoreOptions): TurriCore;
|
|
296
296
|
/**
|
|
297
297
|
* pi's extension API for a chat: every tool, command, shortcut and handler the extension registers runs inside the
|
|
298
|
-
* chat's scope - its
|
|
298
|
+
* chat's scope - its id on what it starts.
|
|
299
299
|
*/
|
|
300
300
|
export declare function scopedToChat(pi: ExtensionAPI, scope: ChatScope): ExtensionAPI;
|
|
301
301
|
/** A chat's stand-in for the screen, for the terminal's driver. */
|
package/dist/chats.js
CHANGED
|
@@ -10,7 +10,7 @@ import { newNotice, noticeTask, SENTINEL, sentinelStartChoice, wentWrong } from
|
|
|
10
10
|
* The chats of a turri session.
|
|
11
11
|
*
|
|
12
12
|
* One turri process is one session on one project, and holds up to MAX_CHATS chats: conversations, each with its own
|
|
13
|
-
* history, model, thinking level
|
|
13
|
+
* history, model, thinking level and questions, each working while another is shown. What they share is the
|
|
14
14
|
* session's: the one job registry and work loop the project's pulses run in - a pulse any chat starts is in every
|
|
15
15
|
* chat's side panel - the coding model, steering, releases and the ledger.
|
|
16
16
|
*
|
|
@@ -158,7 +158,7 @@ export function createChats(options) {
|
|
|
158
158
|
const id = randomUUID().slice(0, 8);
|
|
159
159
|
const chat = {
|
|
160
160
|
id,
|
|
161
|
-
scope: { id,
|
|
161
|
+
scope: { id, asking: new Set() },
|
|
162
162
|
...(title !== undefined ? { recordedTitle: title } : {}),
|
|
163
163
|
...(role !== undefined ? { role } : {}),
|
|
164
164
|
working: false,
|
|
@@ -880,7 +880,7 @@ export function createChats(options) {
|
|
|
880
880
|
}
|
|
881
881
|
/**
|
|
882
882
|
* pi's extension API for a chat: every tool, command, shortcut and handler the extension registers runs inside the
|
|
883
|
-
* chat's scope - its
|
|
883
|
+
* chat's scope - its id on what it starts.
|
|
884
884
|
*/
|
|
885
885
|
export function scopedToChat(pi, scope) {
|
|
886
886
|
const within = (work) => work === undefined ? undefined : (...args) => inChat(scope, () => work(...args));
|
package/dist/cli.js
CHANGED
|
@@ -110,7 +110,6 @@ const USAGE = [
|
|
|
110
110
|
" turri --version turri's version, and pi's",
|
|
111
111
|
"",
|
|
112
112
|
` ${"options".padEnd(12)} --harness-model <m> the model you chat with --coding-model <m> the model that writes the code`,
|
|
113
|
-
` ${"".padEnd(12)} --stack <name> build with config.turri.<name>.yaml over config.turri.yaml - here and in every command`,
|
|
114
113
|
` ${"".padEnd(12)} --debug keep what turri writes for debugging it - agents' logs and sessions - as debug: true does`,
|
|
115
114
|
` ${"".padEnd(12)} --use-theme <t> another theme than turri-dark - and every option of pi's own`,
|
|
116
115
|
"",
|
|
@@ -125,34 +124,18 @@ const USAGE = [
|
|
|
125
124
|
"specification, so that linked resources inside it resolve the way the parser expects.",
|
|
126
125
|
].join("\n");
|
|
127
126
|
dropNoise();
|
|
128
|
-
// --
|
|
129
|
-
//
|
|
130
|
-
const argv =
|
|
127
|
+
// --debug, for any command and for the conversation: TURRI_DEBUG for this run, and the pi it starts - taken out before
|
|
128
|
+
// the rest is read, so a command never sees it.
|
|
129
|
+
const argv = withoutDebug(process.argv.slice(2));
|
|
131
130
|
const [command, ...rest] = argv;
|
|
132
|
-
|
|
131
|
+
function withoutDebug(args) {
|
|
133
132
|
const kept = [];
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const arg = args[at];
|
|
137
|
-
if (arg === "--stack")
|
|
138
|
-
stack = args[++at] ?? "";
|
|
139
|
-
else if (arg.startsWith("--stack="))
|
|
140
|
-
stack = arg.slice("--stack=".length);
|
|
141
|
-
else if (arg === "--debug")
|
|
133
|
+
for (const arg of args) {
|
|
134
|
+
if (arg === "--debug")
|
|
142
135
|
process.env.TURRI_DEBUG = "1";
|
|
143
136
|
else
|
|
144
137
|
kept.push(arg);
|
|
145
138
|
}
|
|
146
|
-
if (stack === undefined)
|
|
147
|
-
return kept;
|
|
148
|
-
const { switchStack } = await import("./stacks.js");
|
|
149
|
-
try {
|
|
150
|
-
switchStack(process.cwd(), stack);
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
154
|
-
process.exit(1);
|
|
155
|
-
}
|
|
156
139
|
return kept;
|
|
157
140
|
}
|
|
158
141
|
// `turri help` too: the word people type first, which would otherwise be an unknown command.
|
package/dist/config-edit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/
|
|
2
|
+
* `/settings`' and the chat's settings tool's side of config.turri.yaml: every setting turri reads, what it takes - a yes or no, one of a few words, a
|
|
3
3
|
* number, a model, a list - and when a change to it takes effect, so the person knows whether to wait for the next
|
|
4
4
|
* pulse or not at all. A change is written into the file line by line, its comments and the commented-out examples
|
|
5
5
|
* kept; `models:` and `agent-env:`, which nest, are written again whole, their own comments lost.
|
|
@@ -20,14 +20,20 @@ export interface Setting {
|
|
|
20
20
|
options?: string[];
|
|
21
21
|
/** The least a number may be. */
|
|
22
22
|
min?: number;
|
|
23
|
-
/** Set in the project's config.turri.yaml only: a
|
|
23
|
+
/** Set in the project's config.turri.yaml only: a module's config.turri.<module>.yaml does not change it. */
|
|
24
24
|
projectOnly?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Changed by the person alone, with /settings: the chat's settings tool refuses it. What it decides is theirs - turning
|
|
27
|
+
* conformance tests on doubles each change - or it widens what the agents reach (credentials, folders past the
|
|
28
|
+
* sandbox), or it is a check on the chat's own work (the sentinel, the ***plain rules, the ledger).
|
|
29
|
+
*/
|
|
30
|
+
personOnly?: boolean;
|
|
25
31
|
}
|
|
26
32
|
/** What each effect is, said to the person. */
|
|
27
33
|
export declare const EFFECT_TEXT: Record<Effect, string>;
|
|
28
34
|
/** Every setting, in the order the list shows them. */
|
|
29
35
|
export declare function settings(rules?: string[]): Setting[];
|
|
30
|
-
/** Every setting, as a host is given them: rules-off offering turri's own rules, as /
|
|
36
|
+
/** Every setting, as a host is given them: rules-off offering turri's own rules, as /settings offers them. */
|
|
31
37
|
export declare function configSettings(): Setting[];
|
|
32
38
|
/** A setting by its key - `review`, `models.coding` - or nothing. */
|
|
33
39
|
export declare function settingOf(key: string, rules?: string[]): Setting | undefined;
|
|
@@ -58,13 +64,19 @@ export declare function currentValue(text: string, key: string): unknown;
|
|
|
58
64
|
export declare function shownValue(value: unknown): string;
|
|
59
65
|
/** The project's config.turri.yaml - or the config.yaml it is read from until it has one - its text, empty when there is neither. */
|
|
60
66
|
export declare function readConfigText(dir: string): string;
|
|
61
|
-
/** What a change does beside setting the value: the files and settings that win over it, said to the person. */
|
|
62
|
-
export declare function overriddenBy(dir: string, text: string, setting: Setting): string[];
|
|
63
67
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
68
|
+
* What a change does beside setting the value: the files and settings that win over it, said to the person. `module`:
|
|
69
|
+
* written into that module's own file - the project's file is the one it wins over, and nothing over it is said.
|
|
66
70
|
*/
|
|
67
|
-
export declare function
|
|
71
|
+
export declare function overriddenBy(dir: string, text: string, setting: Setting, module?: string): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Write a setting into the project's config.turri.yaml - or, with `module`, that module's config.turri.<module>.yaml -
|
|
74
|
+
* made when it is not there, from config.yaml and each module's file in the old naming when they are what the project
|
|
75
|
+
* is read from - and give back the file as written.
|
|
76
|
+
*/
|
|
77
|
+
export declare function writeSetting(dir: string, key: string, value: unknown, module?: string): string;
|
|
78
|
+
/** A module's own config.turri.<module>.yaml - or the config.<module>.yaml it is read from until the project has turri's files - its text, empty when there is none. */
|
|
79
|
+
export declare function readModuleConfigText(dir: string, module: string): string;
|
|
68
80
|
/** The files a path setting is offered: the testing scripts in the root and test_scripts/, the .plain files of the folder, or - the test folder - its folders. */
|
|
69
81
|
export declare function pathOptions(dir: string, key: string): string[];
|
|
70
82
|
/** The dotenv files of the project root, for agent-env.files. */
|
package/dist/config-edit.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join } from "node:path";
|
|
|
3
3
|
import { dump as dumpYaml, load as loadYaml } from "js-yaml";
|
|
4
4
|
import { PACKAGE_ROOT } from "./environment.js";
|
|
5
5
|
import { loadRules } from "./rules.js";
|
|
6
|
-
import { adoptLegacyConfig, AGENT_ROLES, CONFIG_FILE,
|
|
6
|
+
import { adoptLegacyConfig, AGENT_ROLES, CONFIG_FILE, moduleConfigFile, moduleConfigFileIn, moduleConfigsOf, projectConfigFile, splitModelSpec, THINKING_LEVELS } from "./config.js";
|
|
7
7
|
/** What each effect is, said to the person. */
|
|
8
8
|
export const EFFECT_TEXT = {
|
|
9
9
|
now: "in effect now",
|
|
@@ -63,8 +63,8 @@ export function settings(rules = []) {
|
|
|
63
63
|
{ key: "mutation-testing", about: "whether the coding agent and the reviewer can put a bug in the code for one test run (can_it_fail)", kind: "boolean", unset: "true", effect: "next-pulse" },
|
|
64
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" },
|
|
65
65
|
{ key: "release-after-pulse", about: "whether every pulse that lands code releases it", kind: "boolean", unset: "false", effect: "next-landing" },
|
|
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" },
|
|
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" },
|
|
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", personOnly: true },
|
|
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", personOnly: true },
|
|
68
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" },
|
|
69
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" },
|
|
70
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" },
|
|
@@ -76,17 +76,17 @@ export function settings(rules = []) {
|
|
|
76
76
|
{ key: "max-lines-per-pulse", about: "the most lines of ***plain in one pulse before a group is split", kind: "number", options: ["60", "120", "200", "300"], min: 1, unset: "120", effect: "next-plan" },
|
|
77
77
|
{ key: "turn-limit", about: "seconds each agent turn has, for every role without its own - 0 for none", kind: "number", options: SECONDS, min: 0, unset: "120", effect: "next-pulse" },
|
|
78
78
|
{ key: "compact-at", about: "tokens of work an agent holds before it is compacted between turns", kind: "number", options: ["50000", "100000", "150000", "200000"], min: 1000, unset: "100000", effect: "next-pulse", projectOnly: true },
|
|
79
|
-
{ key: "rules-off", about: "***plain rules left out of the prompts of the agents that write ***plain", kind: "list", options: rules, unset: "none", effect: "next-message", projectOnly: true },
|
|
80
|
-
{ key: "agent-env.files", about: "dotenv files whose variables the agents' commands get", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true },
|
|
81
|
-
{ key: "agent-env.vars", about: "variables from turri's environment the agents' commands get, by name", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true },
|
|
82
|
-
{ key: "toolchains", about: "folders of this machine an agent's commands may read beside the usual ones", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true },
|
|
79
|
+
{ key: "rules-off", about: "***plain rules left out of the prompts of the agents that write ***plain", kind: "list", options: rules, unset: "none", effect: "next-message", projectOnly: true, personOnly: true },
|
|
80
|
+
{ key: "agent-env.files", about: "dotenv files whose variables the agents' commands get", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true, personOnly: true },
|
|
81
|
+
{ key: "agent-env.vars", about: "variables from turri's environment the agents' commands get, by name", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true, personOnly: true },
|
|
82
|
+
{ key: "toolchains", about: "folders of this machine an agent's commands may read beside the usual ones", kind: "list", unset: "none", effect: "next-pulse", projectOnly: true, personOnly: true },
|
|
83
83
|
{ key: "debug", about: "whether turri keeps what it writes for debugging it - agents' logs and sessions, pulse logs, outputs", kind: "boolean", unset: "false", effect: "next-pulse", projectOnly: true },
|
|
84
84
|
{ key: "cache-keep", about: "megabytes of package caches the project keeps; 0 keeps none", kind: "number", options: ["0", "1024", "4096", "16384"], min: 0, unset: "4096", effect: "next-start", projectOnly: true },
|
|
85
|
-
{ key: "ledger-keep", about: "megabytes of the ledger - what turri did, as facts - the project keeps; 0 keeps none", kind: "number", options: ["0", "50", "100", "500"], min: 0, unset: "100", effect: "next-start", projectOnly: true },
|
|
85
|
+
{ key: "ledger-keep", about: "megabytes of the ledger - what turri did, as facts - the project keeps; 0 keeps none", kind: "number", options: ["0", "50", "100", "500"], min: 0, unset: "100", effect: "next-start", projectOnly: true, personOnly: true },
|
|
86
86
|
...roles,
|
|
87
87
|
];
|
|
88
88
|
}
|
|
89
|
-
/** Every setting, as a host is given them: rules-off offering turri's own rules, as /
|
|
89
|
+
/** Every setting, as a host is given them: rules-off offering turri's own rules, as /settings offers them. */
|
|
90
90
|
export function configSettings() {
|
|
91
91
|
return settings(loadRules(join(PACKAGE_ROOT, "genome", "rules")).map((rule) => rule.name));
|
|
92
92
|
}
|
|
@@ -307,21 +307,24 @@ export function readConfigText(dir) {
|
|
|
307
307
|
const path = join(dir, projectConfigFile(dir));
|
|
308
308
|
return existsSync(path) ? readFileSync(path, "utf8") : "";
|
|
309
309
|
}
|
|
310
|
-
/**
|
|
311
|
-
|
|
310
|
+
/**
|
|
311
|
+
* What a change does beside setting the value: the files and settings that win over it, said to the person. `module`:
|
|
312
|
+
* written into that module's own file - the project's file is the one it wins over, and nothing over it is said.
|
|
313
|
+
*/
|
|
314
|
+
export function overriddenBy(dir, text, setting, module) {
|
|
312
315
|
const notes = [];
|
|
313
316
|
const wins = { "harness-model": "models.chat", "coding-model": "models.coding", "judge-model": "models.judge" };
|
|
314
317
|
const over = wins[setting.key];
|
|
315
318
|
if (over !== undefined && currentValue(text, over) !== undefined)
|
|
316
|
-
notes.push(`${over} is set too, and wins over ${setting.key} - change it with /
|
|
317
|
-
if (setting.projectOnly === true)
|
|
319
|
+
notes.push(`${over} is set too, and wins over ${setting.key} - change it with /settings ${over}.`);
|
|
320
|
+
if (setting.projectOnly === true || module !== undefined)
|
|
318
321
|
return notes;
|
|
319
322
|
const top = setting.key.split(".")[0];
|
|
320
|
-
for (const
|
|
321
|
-
const file =
|
|
323
|
+
for (const each of moduleConfigsOf(dir)) {
|
|
324
|
+
const file = moduleConfigFileIn(dir, each);
|
|
322
325
|
const own = loadMapping(safeRead(join(dir, file)))[top];
|
|
323
326
|
if (own !== undefined)
|
|
324
|
-
notes.push(`${file} sets ${top} too, and wins
|
|
327
|
+
notes.push(`${file} sets ${top} too, and wins for ${each}.plain and the modules built on it.`);
|
|
325
328
|
}
|
|
326
329
|
return notes;
|
|
327
330
|
}
|
|
@@ -334,15 +337,20 @@ function safeRead(path) {
|
|
|
334
337
|
}
|
|
335
338
|
}
|
|
336
339
|
/**
|
|
337
|
-
* Write a setting into the project's config.turri.yaml -
|
|
338
|
-
* file in the old naming when they are what the project
|
|
340
|
+
* Write a setting into the project's config.turri.yaml - or, with `module`, that module's config.turri.<module>.yaml -
|
|
341
|
+
* made when it is not there, from config.yaml and each module's file in the old naming when they are what the project
|
|
342
|
+
* is read from - and give back the file as written.
|
|
339
343
|
*/
|
|
340
|
-
export function writeSetting(dir, key, value) {
|
|
344
|
+
export function writeSetting(dir, key, value, module) {
|
|
341
345
|
adoptLegacyConfig(dir);
|
|
342
|
-
const text = withSetting(readConfigText(dir), key, value);
|
|
343
|
-
writeFileSync(join(dir, CONFIG_FILE), text);
|
|
346
|
+
const text = withSetting(module !== undefined ? safeRead(join(dir, moduleConfigFile(module))) : readConfigText(dir), key, value);
|
|
347
|
+
writeFileSync(join(dir, module !== undefined ? moduleConfigFile(module) : CONFIG_FILE), text);
|
|
344
348
|
return text;
|
|
345
349
|
}
|
|
350
|
+
/** A module's own config.turri.<module>.yaml - or the config.<module>.yaml it is read from until the project has turri's files - its text, empty when there is none. */
|
|
351
|
+
export function readModuleConfigText(dir, module) {
|
|
352
|
+
return safeRead(join(dir, moduleConfigFileIn(dir, module)));
|
|
353
|
+
}
|
|
346
354
|
/** The files a path setting is offered: the testing scripts in the root and test_scripts/, the .plain files of the folder, or - the test folder - its folders. */
|
|
347
355
|
export function pathOptions(dir, key) {
|
|
348
356
|
const list = (folder, test) => {
|
package/dist/config.d.ts
CHANGED
|
@@ -43,79 +43,72 @@
|
|
|
43
43
|
* either of which may be left out; a bare string is the model alone. What a model leaves out it takes
|
|
44
44
|
* from the one it inherits: judge-model from coding-model, coding-model from harness-model. They are
|
|
45
45
|
* defaults: `--harness-model` / `--coding-model` / `--judge-model` on the command line win over them,
|
|
46
|
-
* and so does a model chosen during the conversation (pi's /model
|
|
46
|
+
* and so does a model chosen during the conversation (pi's /model) or named on a call. `model:` is read
|
|
47
47
|
* as `coding-model`, which it was before there were two.
|
|
48
48
|
*
|
|
49
49
|
* Keys are written with dashes; underscores are read the same (`conformance_tests`). Keys it
|
|
50
50
|
* does not know - another tool's `config.yaml`, read while it is the old file, may carry several - are ignored, and so is a value of
|
|
51
51
|
* the wrong type. Everything is optional, and what is given on the command line wins.
|
|
52
52
|
*
|
|
53
|
-
* A
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* from the
|
|
59
|
-
*
|
|
60
|
-
* stack's file.
|
|
53
|
+
* A module can have settings of its own in `config.turri.<module>.yaml` beside `config.turri.yaml`:
|
|
54
|
+
* `config.turri.backend.yaml` for `backend.plain` - its testing scripts, its toolchains, its models - laid over
|
|
55
|
+
* `config.turri.yaml` key by key, a model it names taking what it leaves out from the project's. A module with no file
|
|
56
|
+
* of its own takes the one of a module it requires - `config.turri.backend.yaml` builds `backend_auth.plain`, which
|
|
57
|
+
* requires `backend.plain` - and two among the modules it requires is an error (`configModuleFor`). Nobody chooses it:
|
|
58
|
+
* it is worked out from the module, and a pulse keeps the one it started with. `module:`, `harness-model:` and the
|
|
59
|
+
* other settings of the whole project are read from `config.turri.yaml` alone.
|
|
61
60
|
*/
|
|
62
61
|
/** turri's settings for a project, in a file of its own: a `config.yaml` beside it may be another tool's. */
|
|
63
62
|
export declare const CONFIG_FILE = "config.turri.yaml";
|
|
64
63
|
/**
|
|
65
64
|
* Where turri's settings were before they had a file of their own. A project with no `config.turri*.yaml` yet is read
|
|
66
|
-
* from it - and a `config.<name>.yaml` beside it as the
|
|
65
|
+
* from it - and a `config.<name>.yaml` beside it as the module `<name>`'s - and turri never writes it: the first setting
|
|
67
66
|
* turri writes copies them to the new names (`adoptLegacyConfig`), and from then on the old files are not read.
|
|
68
67
|
*/
|
|
69
68
|
export declare const LEGACY_CONFIG_FILE = "config.yaml";
|
|
70
|
-
/** A
|
|
71
|
-
export declare function
|
|
72
|
-
/** Whether a folder's settings are still in the old files: a config.yaml or a config.<
|
|
69
|
+
/** A module's config file's name: `config.turri.backend.yaml` for `backend.plain`. */
|
|
70
|
+
export declare function moduleConfigFile(module: string): string;
|
|
71
|
+
/** Whether a folder's settings are still in the old files: a config.yaml or a config.<module>.yaml, and no config.turri*.yaml. */
|
|
73
72
|
export declare function usesLegacyConfig(root: string): boolean;
|
|
74
73
|
/** The file the project's settings are read from, by name: config.turri.yaml, or config.yaml while the folder has only the old files. */
|
|
75
74
|
export declare function projectConfigFile(root: string): string;
|
|
76
|
-
/** The file a
|
|
77
|
-
export declare function
|
|
78
|
-
/** Whether a folder holds a project's settings: a config.turri.yaml, a
|
|
75
|
+
/** The file a module's own settings are read from, by name - the old name while the folder has only the old files. */
|
|
76
|
+
export declare function moduleConfigFileIn(root: string, module: string): string;
|
|
77
|
+
/** Whether a folder holds a project's settings: a config.turri.yaml, a module's file, or the old files. */
|
|
79
78
|
export declare function hasProjectConfig(root: string): boolean;
|
|
80
|
-
/** The
|
|
81
|
-
export declare function
|
|
79
|
+
/** The modules a project folder has config files for, by name. */
|
|
80
|
+
export declare function moduleConfigsOf(root: string): string[];
|
|
82
81
|
/**
|
|
83
82
|
* Before turri first writes a setting in a folder whose settings are still in the old files: config.yaml copied to
|
|
84
|
-
* config.turri.yaml, and each config.<
|
|
83
|
+
* config.turri.yaml, and each config.<module>.yaml to config.turri.<module>.yaml, so nothing is lost when the old files
|
|
85
84
|
* stop being read. The old files are left as they are. Gives back the files written, by name.
|
|
86
85
|
*/
|
|
87
86
|
export declare function adoptLegacyConfig(root: string, options?: {
|
|
88
87
|
projectFile?: boolean;
|
|
89
88
|
}): string[];
|
|
89
|
+
/** Inside a pulse - or work pinned like one - the module whose config file it runs with; none outside. */
|
|
90
|
+
export declare function pinnedConfigModule(): string | undefined;
|
|
91
|
+
/** Run `work` with `module`'s config file over the project's, whatever the files say meanwhile: a pulse keeps the one it started with. */
|
|
92
|
+
export declare function withConfigModule<T>(module: string | undefined, work: () => T): T;
|
|
93
|
+
/** Whether a module's config file is pinned here - by the pulse it runs in, or the work that plans it. */
|
|
94
|
+
export declare function configModulePinned(): boolean;
|
|
90
95
|
/**
|
|
91
|
-
* The
|
|
92
|
-
*
|
|
96
|
+
* The module whose config file builds a module - its `config.turri.<module>.yaml` laid over `config.turri.yaml` - or
|
|
97
|
+
* none, `config.turri.yaml` alone. The one pinned, inside a pulse; else the module's own file; else the one file among
|
|
98
|
+
* the modules it requires, all the way down - a module is built on their code, in one codebase, with their testing
|
|
99
|
+
* scripts. Two among them is an error: which one builds it cannot be told. Only `requires` counts, not imports.
|
|
93
100
|
*/
|
|
94
|
-
export declare function
|
|
101
|
+
export declare function configModuleFor(plainFile: string): string | undefined;
|
|
102
|
+
/** Why a module's config cannot be told: two or more of the modules it requires have a config file of their own. */
|
|
103
|
+
export declare function moduleConfigClash(module: string, below: string[], root: string): string;
|
|
95
104
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
105
|
+
* Every module a module requires, all the way down, by name - read from each file's frontmatter alone, found as the
|
|
106
|
+
* parser finds them (the module's folder, its template/ folder, PLAIN_TEMPLATE_DIRS). One that is not there, or does
|
|
107
|
+
* not read, ends its branch: the parse says what is wrong with it.
|
|
98
108
|
*/
|
|
99
|
-
export declare function
|
|
100
|
-
/**
|
|
101
|
-
export declare function
|
|
102
|
-
/** Whether a stack is pinned here - named by the call that asked for the work, or kept by the pulse it runs in. */
|
|
103
|
-
export declare function stackPinned(): boolean;
|
|
104
|
-
/**
|
|
105
|
-
* The stack a module is built with: the one pinned - named by the call, or kept by the pulse - else the stack named
|
|
106
|
-
* after the module, config.turri.backend.yaml for backend.plain, else the one chosen for the session; none, when none
|
|
107
|
-
* of them is.
|
|
108
|
-
*/
|
|
109
|
-
export declare function stackForModule(plainFile: string): string | undefined;
|
|
110
|
-
/** The words that choose no stack: the project's config alone. */
|
|
111
|
-
export declare const NO_STACK: string[];
|
|
112
|
-
/**
|
|
113
|
-
* The stack `name` names for the project at `root` - undefined for none - refused when the project has no file for
|
|
114
|
-
* it, with the stacks it has.
|
|
115
|
-
*/
|
|
116
|
-
export declare function stackNamed(root: string, name: string): string | undefined;
|
|
117
|
-
/** The stack a project folder is built with now: the one chosen, when the folder has a file for it. */
|
|
118
|
-
export declare function stackOf(root: string): string | undefined;
|
|
109
|
+
export declare function requiredModulesOf(plainFile: string): string[];
|
|
110
|
+
/** The module whose config file is pinned here, when the project folder has that file. */
|
|
111
|
+
export declare function configModuleOf(root: string): string | undefined;
|
|
119
112
|
export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
120
113
|
export type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
121
114
|
/** A model, and how hard it thinks - either may be left to the one it inherits from. */
|
|
@@ -263,7 +256,7 @@ export interface ProjectConfig {
|
|
|
263
256
|
* session through a job is compacted between turns. The project's alone. Unset: 100k.
|
|
264
257
|
*/
|
|
265
258
|
compactAt?: number;
|
|
266
|
-
/** The most functional specs the planner puts in one pulse. Unset: 3. A
|
|
259
|
+
/** The most functional specs the planner puts in one pulse. Unset: 3. A module's own file wins. */
|
|
267
260
|
maxSpecsPerPulse?: number;
|
|
268
261
|
/** The most lines of spec - its functional specs and the definitions they bring - in one pulse; past it, split. Unset: 120. */
|
|
269
262
|
maxLinesPerPulse?: number;
|
|
@@ -335,10 +328,10 @@ export declare const CONFIG_KEYS: {
|
|
|
335
328
|
readonly turnLimit: "turn-limit";
|
|
336
329
|
};
|
|
337
330
|
/**
|
|
338
|
-
* The project's config - with a
|
|
331
|
+
* The project's config - with a module's own file over it, when one is named - or nothing of it when there is no file or it does
|
|
339
332
|
* not parse.
|
|
340
333
|
*/
|
|
341
|
-
export declare function readProjectConfig(root: string,
|
|
334
|
+
export declare function readProjectConfig(root: string, module?: string): ProjectConfig;
|
|
342
335
|
/**
|
|
343
336
|
* What a command's own options say of the config's keys - `turri regenerate --harness-model`, `--coding-model`,
|
|
344
337
|
* `--judge-model`, `--review`, `--mutation-testing` - read as if the file had them: each takes its key's value, and
|
|
@@ -360,9 +353,9 @@ export declare function overrideConfig(overrides: RunOverrides): void;
|
|
|
360
353
|
export declare function booleanOption(value: string): boolean | undefined;
|
|
361
354
|
/** Where the test plain files are when `test-dir:` does not say. */
|
|
362
355
|
export declare const DEFAULT_TEST_DIR = "tests";
|
|
363
|
-
/** The folder of a module's project's test plain files: `test-dir:` - its
|
|
356
|
+
/** The folder of a module's project's test plain files: `test-dir:` - its own file's over the project's - from the project's folder. */
|
|
364
357
|
export declare function testDirOf(plainFile: string): string;
|
|
365
|
-
/** The config a spec is built with: its project's, with its module's
|
|
358
|
+
/** The config a spec is built with: its project's, with its module's own file over it - or a required module's (`configModuleFor`). */
|
|
366
359
|
export declare function configForSpec(plainFile: string): ProjectConfig;
|
|
367
360
|
/**
|
|
368
361
|
* One config file, read, or nothing of it when it is not there or does not parse. Parsed again only once the file has
|
|
@@ -372,7 +365,7 @@ export declare function configForSpec(plainFile: string): ProjectConfig;
|
|
|
372
365
|
*/
|
|
373
366
|
export declare function readConfigFile(path: string): ProjectConfig;
|
|
374
367
|
/**
|
|
375
|
-
* The keys of the project's own config files - config.turri.yaml and each
|
|
368
|
+
* The keys of the project's own config files - config.turri.yaml and each module's - that turri reads nothing of: a setting
|
|
376
369
|
* turri no longer has (`test-advisor`), or one misspelt. Said as turri starts, so a setting the person thinks is on is
|
|
377
370
|
* not silently ignored. config.yaml is left out: it may be another tool's, with keys of its own.
|
|
378
371
|
*/
|