@turri-dev/core 0.1.1-next.35d4c49 → 0.1.1-next.ad4aa8f
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/CHANGELOG.md +56 -0
- package/README.md +17 -11
- package/dist/api/models.d.ts +9 -0
- package/dist/api/models.js +15 -0
- package/dist/api/plain.d.ts +6 -6
- package/dist/api/plain.js +4 -7
- package/dist/api/project.d.ts +35 -0
- package/dist/api/project.js +47 -0
- package/dist/api/session.d.ts +48 -0
- package/dist/api/session.js +17 -0
- package/dist/api/system.d.ts +18 -0
- package/dist/api/system.js +23 -0
- package/dist/btw.d.ts +1 -1
- package/dist/capture/capture.js +11 -8
- package/dist/capture/chat.d.ts +0 -11
- package/dist/capture/chat.js +0 -29
- package/dist/capture/config.d.ts +4 -5
- package/dist/capture/config.js +34 -20
- package/dist/capture/models.d.ts +2 -1
- package/dist/capture/models.js +1 -0
- package/dist/chat-entries.d.ts +81 -39
- package/dist/chat-entries.js +125 -11
- package/dist/chat-model.d.ts +37 -0
- package/dist/chat-model.js +61 -0
- package/dist/chats.d.ts +54 -42
- package/dist/chats.js +86 -80
- package/dist/client.d.ts +30 -0
- package/dist/client.js +12 -0
- package/dist/config-edit.d.ts +54 -1
- package/dist/config-edit.js +103 -33
- package/dist/config.d.ts +12 -9
- package/dist/config.js +38 -9
- package/dist/doctor-checks.d.ts +42 -0
- package/dist/doctor-checks.js +39 -0
- package/dist/environment.d.ts +2 -23
- package/dist/environment.js +5 -68
- package/dist/errors.d.ts +32 -0
- package/dist/errors.js +24 -0
- package/dist/extension.d.ts +23 -16
- package/dist/extension.js +170 -234
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +13 -9
- package/dist/init-config.d.ts +11 -9
- package/dist/init-config.js +15 -7
- package/dist/launch-session.d.ts +2 -0
- package/dist/launch-session.js +17 -1
- package/dist/loop-tools.js +11 -10
- package/dist/module-check.d.ts +13 -0
- package/dist/module-check.js +117 -0
- package/dist/notice.d.ts +5 -0
- package/dist/parse-tool.js +3 -2
- package/dist/plain/check.d.ts +27 -13
- package/dist/plain/check.js +51 -116
- package/dist/plain/files.d.ts +2 -0
- package/dist/plain/files.js +13 -0
- package/dist/plain/graph.js +2 -2
- package/dist/plain/highlight.d.ts +4 -20
- package/dist/plain/highlight.js +7 -5
- package/dist/project.d.ts +19 -0
- package/dist/project.js +34 -0
- package/dist/quiet.d.ts +0 -2
- package/dist/quiet.js +0 -14
- package/dist/regenerate/command-check.d.ts +0 -8
- package/dist/regenerate/command-check.js +133 -53
- package/dist/regenerate/conversation-writes.d.ts +5 -1
- package/dist/regenerate/conversation-writes.js +7 -3
- package/dist/regenerate/jobs.d.ts +25 -2
- package/dist/regenerate/jobs.js +3 -0
- package/dist/regenerate/launch.d.ts +1 -0
- package/dist/regenerate/launch.js +9 -0
- package/dist/regenerate/ledger-view.d.ts +14 -14
- package/dist/regenerate/ledger.d.ts +1 -0
- package/dist/regenerate/ledger.js +4 -2
- package/dist/regenerate/loop.d.ts +2 -1
- package/dist/regenerate/loop.js +9 -1
- package/dist/regenerate/os-sandbox.d.ts +4 -2
- package/dist/regenerate/os-sandbox.js +0 -1
- package/dist/regenerate/regenerate.js +2 -1
- package/dist/regenerate/requires-chain.d.ts +44 -0
- package/dist/regenerate/requires-chain.js +174 -0
- package/dist/regenerate/requires.d.ts +2 -40
- package/dist/regenerate/requires.js +14 -171
- package/dist/regenerate/resources.d.ts +0 -2
- package/dist/regenerate/resources.js +2 -14
- package/dist/regenerate/shell.js +20 -9
- package/dist/regenerate/spec-map.d.ts +2 -0
- package/dist/regenerate/spec-map.js +4 -0
- package/dist/regenerate/standing.d.ts +5 -2
- package/dist/run-report.js +2 -2
- package/dist/self-invocation.d.ts +1 -1
- package/dist/self-invocation.js +2 -3
- package/dist/sentinel-chat.js +7 -11
- package/dist/sentinel.d.ts +1 -1
- package/dist/sentinel.js +12 -5
- package/dist/session-events.d.ts +14 -0
- package/dist/session.d.ts +594 -0
- package/dist/session.js +672 -0
- package/dist/settings.d.ts +28 -2
- package/dist/settings.js +92 -56
- package/dist/setup.d.ts +6 -30
- package/dist/setup.js +28 -105
- package/dist/stack.d.ts +25 -12
- package/dist/stack.js +77 -12
- package/dist/surface.d.ts +2 -2
- package/dist/surface.js +4 -5
- package/dist/work.d.ts +125 -0
- package/dist/work.js +250 -0
- package/docs/README.md +2 -3
- package/docs/capture.md +4 -4
- package/docs/chats.md +5 -3
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +4 -4
- package/docs/core.md +105 -128
- package/docs/development.md +9 -9
- package/docs/headless.md +1 -1
- package/docs/installation.md +4 -2
- package/docs/launch.md +2 -2
- package/docs/parser.md +1 -1
- package/docs/regenerating.md +1 -1
- package/docs/sandbox.md +4 -4
- package/docs/sentinel.md +4 -4
- package/docs/skills-and-gates.md +1 -1
- package/docs/using.md +2 -2
- package/genome/rules/integration-embedded-testing.md +3 -3
- package/genome/rules/integration-embedded.md +3 -3
- package/genome/skills/implement-conformance-testing-script/SKILL.md +6 -4
- package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_java.sh +13 -11
- package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.sh +8 -7
- package/genome/skills/implement-unit-testing-script/SKILL.md +7 -5
- package/genome/skills/implement-unit-testing-script/assets/run_unittests_java.sh +9 -13
- package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.sh +1 -1
- package/package.json +19 -32
- package/dist/api/commands.d.ts +0 -45
- package/dist/api/commands.js +0 -54
- package/dist/api/config.d.ts +0 -8
- package/dist/api/config.js +0 -8
- package/dist/api/ledger.d.ts +0 -3
- package/dist/api/ledger.js +0 -3
- package/dist/api/startup.d.ts +0 -8
- package/dist/api/startup.js +0 -8
- package/dist/api/terminal.d.ts +0 -18
- package/dist/api/terminal.js +0 -16
- package/dist/chat-models.d.ts +0 -11
- package/dist/chat-models.js +0 -11
- package/dist/chat-ui.d.ts +0 -33
- package/dist/chat-ui.js +0 -192
- package/dist/headless.d.ts +0 -99
- package/dist/headless.js +0 -226
- package/dist/host-session.d.ts +0 -136
- package/dist/host-session.js +0 -139
- package/dist/host.d.ts +0 -8
- package/dist/host.js +0 -17
- package/dist/index.d.ts +0 -16
- package/dist/index.js +0 -7
- package/dist/notifications.d.ts +0 -21
- package/dist/notifications.js +0 -44
- package/dist/reopen.d.ts +0 -29
- package/dist/reopen.js +0 -47
- package/dist/turri-versions.d.ts +0 -71
- package/dist/turri-versions.js +0 -276
- package/dist/view.d.ts +0 -78
- package/dist/view.js +0 -1
- package/docs/hosting.md +0 -284
package/dist/stack.js
CHANGED
|
@@ -6,6 +6,30 @@ import { plainFileParser, withParseCache } from "./plain/parser.js";
|
|
|
6
6
|
import { resolveTemplateDirs } from "./regenerate/paths.js";
|
|
7
7
|
import { sectionsOf } from "./regenerate/state.js";
|
|
8
8
|
import { onThisMachine } from "./regenerate/test-scripts.js";
|
|
9
|
+
/**
|
|
10
|
+
* The toolchains whose version the reqs pin and this machine is asked for: how the reqs name it, and how its command
|
|
11
|
+
* says its own. Not Python: its stacks run through uv, which finds or fetches the Python a project asks for itself.
|
|
12
|
+
*/
|
|
13
|
+
const PINNED = {
|
|
14
|
+
Go: { named: /\bgo (\d+\.\d+(?:\.\d+)?)\b/gi, command: "go", args: ["version"], read: /\bgo(\d+\.\d+(?:\.\d+)?)/ },
|
|
15
|
+
Java: { named: /\bjava (\d+)\b/gi, command: "java", args: ["-version"], read: /version "(\d+(?:\.\d+)*)/ },
|
|
16
|
+
Node: { named: /\bnode(?:\.js)? (\d+(?:\.\d+)*)\b/gi, command: "node", args: ["--version"], read: /\bv(\d+(?:\.\d+)*)/ },
|
|
17
|
+
Rust: { named: /\brust (\d+\.\d+(?:\.\d+)?)\b/gi, command: "cargo", args: ["--version"], read: /\bcargo (\d+\.\d+(?:\.\d+)?)/ },
|
|
18
|
+
};
|
|
19
|
+
/** Whether version `a` is older than `b`, segment by segment, as far as `b` says: 1.24.3 is older than 1.25, 1.25.1 is not. */
|
|
20
|
+
export function olderThan(a, b) {
|
|
21
|
+
const [x, y] = [a.split(".").map(Number), b.split(".").map(Number)];
|
|
22
|
+
for (let at = 0; at < y.length; at += 1) {
|
|
23
|
+
const [p, q] = [x[at] ?? 0, y[at]];
|
|
24
|
+
if (p !== q)
|
|
25
|
+
return p < q;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
/** What a toolchain's command says its version is - from its whole output - or nothing when it says none. */
|
|
30
|
+
export function versionIn(toolchain, output) {
|
|
31
|
+
return PINNED[toolchain]?.read.exec(output)?.[1];
|
|
32
|
+
}
|
|
9
33
|
/** Words in implementation reqs, and the toolchain each means. */
|
|
10
34
|
const STACKS = [
|
|
11
35
|
{ toolchain: "Python", commands: ["python3", "python"], words: /\b(python|fastapi|django|flask|pytest|pydantic|sqlalchemy|uvicorn)\b/gi },
|
|
@@ -25,8 +49,12 @@ export function stackOf(text) {
|
|
|
25
49
|
const needs = [];
|
|
26
50
|
for (const stack of STACKS) {
|
|
27
51
|
const words = [...new Set([...text.matchAll(stack.words)].map((match) => match[0].toLowerCase()))];
|
|
28
|
-
if (words.length
|
|
29
|
-
|
|
52
|
+
if (words.length === 0)
|
|
53
|
+
continue;
|
|
54
|
+
const pinned = PINNED[stack.toolchain];
|
|
55
|
+
const versions = pinned === undefined ? [] : [...text.matchAll(pinned.named)].map((match) => match[1]);
|
|
56
|
+
const version = versions.reduce((highest, each) => (highest === undefined || olderThan(highest, each) ? each : highest), undefined);
|
|
57
|
+
needs.push({ toolchain: stack.toolchain, commands: stack.commands, words, ...(version !== undefined ? { version } : {}) });
|
|
30
58
|
}
|
|
31
59
|
return needs;
|
|
32
60
|
}
|
|
@@ -84,27 +112,64 @@ export async function projectImplementationReqsAsync(project) {
|
|
|
84
112
|
}
|
|
85
113
|
/** Whether a command is on this machine's PATH. */
|
|
86
114
|
const onPath = (command) => onThisMachine(command) !== undefined;
|
|
115
|
+
/** The version of a toolchain on this machine, as its command says it - nothing when it says none. */
|
|
116
|
+
function versionHere(toolchain) {
|
|
117
|
+
const pinned = PINNED[toolchain];
|
|
118
|
+
if (pinned === undefined)
|
|
119
|
+
return undefined;
|
|
120
|
+
const run = spawnSync(pinned.command, pinned.args, { encoding: "utf8", timeout: 10_000, env: { ...process.env, JAVA_TOOL_OPTIONS: "" } });
|
|
121
|
+
return run.error === undefined ? versionIn(toolchain, `${run.stdout ?? ""}\n${run.stderr ?? ""}`) : undefined;
|
|
122
|
+
}
|
|
123
|
+
/** `versionHere`, without holding the thread up. */
|
|
124
|
+
async function versionHereAsync(toolchain) {
|
|
125
|
+
const pinned = PINNED[toolchain];
|
|
126
|
+
if (pinned === undefined)
|
|
127
|
+
return undefined;
|
|
128
|
+
const run = await spawnAsync(pinned.command, pinned.args, { env: { ...process.env, JAVA_TOOL_OPTIONS: "" } });
|
|
129
|
+
return versionIn(toolchain, `${run.stdout ?? ""}\n${run.stderr ?? ""}`);
|
|
130
|
+
}
|
|
87
131
|
/**
|
|
88
|
-
* What a project's modules need of this machine,
|
|
89
|
-
*
|
|
132
|
+
* What a project's modules need of this machine, which of it the machine lacks - `has` finding a command, and on macOS
|
|
133
|
+
* a JDK behind `java` (`toolchainCheck`), asked at most once - and which it has older than their reqs pin: `version`
|
|
134
|
+
* says the machine's, asked at most once a toolchain.
|
|
90
135
|
*/
|
|
91
|
-
export function stackOnMachine(project, has = onPath, jdk = jdkHere) {
|
|
136
|
+
export function stackOnMachine(project, has = onPath, jdk = jdkHere, version = versionHere) {
|
|
92
137
|
let found;
|
|
93
|
-
|
|
138
|
+
const modules = projectImplementationReqs(project);
|
|
139
|
+
const versions = new Map();
|
|
140
|
+
const here = toolchainCheck(has, () => (found ??= jdk()));
|
|
141
|
+
for (const need of modules.flatMap(({ reqs }) => stackOf(reqs.join("\n")))) {
|
|
142
|
+
if (need.version !== undefined && !versions.has(need.toolchain) && need.commands.some(here))
|
|
143
|
+
versions.set(need.toolchain, version(need.toolchain));
|
|
144
|
+
}
|
|
145
|
+
return needsAgainst(modules, here, versions);
|
|
94
146
|
}
|
|
95
|
-
/** `stackOnMachine`, never holding the host's thread up: the modules parsed one a turn, a JDK
|
|
96
|
-
export async function stackOnMachineAsync(project, has = onPath, jdk = jdkHereAsync) {
|
|
147
|
+
/** `stackOnMachine`, never holding the host's thread up: the modules parsed one a turn, a JDK and versions asked without blocking. */
|
|
148
|
+
export async function stackOnMachineAsync(project, has = onPath, jdk = jdkHereAsync, version = versionHereAsync) {
|
|
97
149
|
const modules = await projectImplementationReqsAsync(project);
|
|
150
|
+
const needs = modules.flatMap(({ reqs }) => stackOf(reqs.join("\n")));
|
|
98
151
|
// Asked only when a module needs Java and java is on the PATH - as stackOnMachine asks it, at most once.
|
|
99
152
|
let found = false;
|
|
100
|
-
if (
|
|
153
|
+
if (needs.some((need) => need.commands.includes("java")) && has("java"))
|
|
101
154
|
found = await jdk();
|
|
102
|
-
|
|
155
|
+
const here = toolchainCheck(has, () => found);
|
|
156
|
+
const versions = new Map();
|
|
157
|
+
for (const need of needs) {
|
|
158
|
+
if (need.version !== undefined && !versions.has(need.toolchain) && need.commands.some(here))
|
|
159
|
+
versions.set(need.toolchain, await version(need.toolchain));
|
|
160
|
+
}
|
|
161
|
+
return needsAgainst(modules, here, versions);
|
|
103
162
|
}
|
|
104
|
-
function needsAgainst(modules, here) {
|
|
163
|
+
function needsAgainst(modules, here, versions) {
|
|
105
164
|
return modules.map(({ module, reqs }) => {
|
|
106
165
|
const needs = stackOf(reqs.join("\n"));
|
|
107
|
-
|
|
166
|
+
const missing = needs.filter((need) => !need.commands.some(here));
|
|
167
|
+
// A version the machine's command does not say is not held against it.
|
|
168
|
+
const older = needs.flatMap((need) => {
|
|
169
|
+
const found = versions.get(need.toolchain);
|
|
170
|
+
return need.version !== undefined && found !== undefined && !missing.includes(need) && olderThan(found, need.version) ? [{ ...need, version: need.version, found }] : [];
|
|
171
|
+
});
|
|
172
|
+
return { module, needs, missing, older };
|
|
108
173
|
});
|
|
109
174
|
}
|
|
110
175
|
/**
|
package/dist/surface.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JobRegistry } from "./regenerate/jobs.ts";
|
|
2
|
-
/** The
|
|
2
|
+
/** The front end's surface for the conversation these jobs are: blank or undefined, none. */
|
|
3
3
|
export declare function setSurface(jobs: JobRegistry, surface: string | undefined): void;
|
|
4
|
-
/** The
|
|
4
|
+
/** The front end's surface, in its own words - undefined when it gave none. */
|
|
5
5
|
export declare function surfaceOf(jobs: JobRegistry | undefined): string | undefined;
|
package/dist/surface.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Where the person sees turri's work
|
|
3
|
-
*
|
|
4
|
-
* deep in a tool - a pulse not found - says the host's words and not the terminal's.
|
|
2
|
+
* Where the person sees turri's work, in the front end's own words (TurriHost.surface) - none said, no view is named.
|
|
3
|
+
* Kept with the conversation's job registry, so what is told the model deep in a tool says the front end's words.
|
|
5
4
|
*/
|
|
6
5
|
const surfaces = new WeakMap();
|
|
7
|
-
/** The
|
|
6
|
+
/** The front end's surface for the conversation these jobs are: blank or undefined, none. */
|
|
8
7
|
export function setSurface(jobs, surface) {
|
|
9
8
|
const text = surface?.trim() ?? "";
|
|
10
9
|
if (text !== "")
|
|
@@ -12,7 +11,7 @@ export function setSurface(jobs, surface) {
|
|
|
12
11
|
else
|
|
13
12
|
surfaces.delete(jobs);
|
|
14
13
|
}
|
|
15
|
-
/** The
|
|
14
|
+
/** The front end's surface, in its own words - undefined when it gave none. */
|
|
16
15
|
export function surfaceOf(jobs) {
|
|
17
16
|
return jobs !== undefined ? surfaces.get(jobs) : undefined;
|
|
18
17
|
}
|
package/dist/work.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type ProjectConfig } from "./config.ts";
|
|
2
|
+
import { type DriftReport, type ModuleStatus, type WorkLoop } from "./regenerate/loop.ts";
|
|
3
|
+
import type { Job, JobRegistry } from "./regenerate/jobs.ts";
|
|
4
|
+
import { type ModuleState } from "./run-report.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Work asked of the session's work loop - regenerating a module, or writing its conformance tests - as the chat's
|
|
7
|
+
* regenerate and conform tools ask it and as a front end or an unattended run does: one path, so the two never differ.
|
|
8
|
+
*/
|
|
9
|
+
export type WorkKind = "regenerate" | "conform";
|
|
10
|
+
/** What is asked of the loop. */
|
|
11
|
+
export interface WorkRequest {
|
|
12
|
+
/** The module's .plain file, absolute or from the session's folder. */
|
|
13
|
+
plainFile: string;
|
|
14
|
+
/**
|
|
15
|
+
* regenerate: functional specs already built, each `module:func-id`, regenerated though their spec did not change.
|
|
16
|
+
* conform: the functional specs to test (each with scenarios); one whose tests are written has them written again.
|
|
17
|
+
*/
|
|
18
|
+
funcIds?: string[];
|
|
19
|
+
/** Only when the person asks: the module's code - or tests, for conform - taken out and built again; `chain`, its whole requires chain. */
|
|
20
|
+
fromScratch?: "module" | "chain";
|
|
21
|
+
/** conform: a pulse a functional spec instead of one for all. */
|
|
22
|
+
separately?: boolean;
|
|
23
|
+
/** The coding model for this work alone, provider/model-id with an optional thinking level. Default: the module's. */
|
|
24
|
+
model?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The work asked of the loop - the one call the chat's regenerate and conform tools and the session's `work` make, after
|
|
28
|
+
* their checks. Returns what each codebase of the module's chain was planned to.
|
|
29
|
+
*/
|
|
30
|
+
export declare function planWork(loop: WorkLoop, kind: WorkKind, request: WorkRequest): Promise<ModuleStatus[]>;
|
|
31
|
+
/**
|
|
32
|
+
* The work asked of the loop after the checks the chat's tools make, each refusal a TurriError: a test plain file, a
|
|
33
|
+
* module that would be built with a config naming no unit testing script, one that does not parse, funcIds with
|
|
34
|
+
* fromScratch, conformance tests turned off.
|
|
35
|
+
*/
|
|
36
|
+
export declare function askLoop(loop: WorkLoop, kind: WorkKind, request: WorkRequest): Promise<ModuleStatus[]>;
|
|
37
|
+
/** A start over put to whoever answers it for a run: what would be started over, and why, in turri's words. */
|
|
38
|
+
export interface StartOverQuestion {
|
|
39
|
+
/** The question, a few words: "Start over?" */
|
|
40
|
+
title: string;
|
|
41
|
+
/** Why each codebase cannot be brought up by changing its code, and what starting over does. */
|
|
42
|
+
body: string;
|
|
43
|
+
/** The codebases that would be started over. */
|
|
44
|
+
codebases: string[];
|
|
45
|
+
}
|
|
46
|
+
/** How a run of work goes on past what it planned. */
|
|
47
|
+
export interface WorkRunOptions {
|
|
48
|
+
/**
|
|
49
|
+
* A codebase built without a module it now requires - or before functional specs had func-ids - cannot be brought up
|
|
50
|
+
* by changing its code: it is started over only when this says so. The answer: `true`, started over; `false`, not -
|
|
51
|
+
* the rest of the chain is regenerated, and the run ends incomplete with those codebases unfinished; `"ask"`, the
|
|
52
|
+
* person is asked through the front end; a function, it is asked, for this run alone, and answers `true`, `false`, or
|
|
53
|
+
* undefined for no answer. Absent, or no answer: the run ends incomplete at once, saying why.
|
|
54
|
+
*/
|
|
55
|
+
startOver?: boolean | "ask" | ((question: StartOverQuestion) => Promise<boolean | undefined>);
|
|
56
|
+
/** A run report written to this file as the run goes (run-report.ts). */
|
|
57
|
+
report?: string;
|
|
58
|
+
/** The command, as the report gives it. */
|
|
59
|
+
command?: string[];
|
|
60
|
+
/** The furthest-built codebase's last commit exported into this folder as the run ends, however it ends. */
|
|
61
|
+
exportTo?: string;
|
|
62
|
+
/** Aborted: the run's modules halted - running pulses stopped, nothing more started - and `done` resolves `stopped`. */
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
}
|
|
65
|
+
/** What the session gives a run. */
|
|
66
|
+
export interface WorkContext {
|
|
67
|
+
loop: WorkLoop;
|
|
68
|
+
jobs: JobRegistry;
|
|
69
|
+
/** Each job's end, as the registry tells it. Returns what stops hearing. */
|
|
70
|
+
onFinish(listener: (job: Job) => void): () => void;
|
|
71
|
+
/** A yes or no put to the person; undefined when nobody can answer. */
|
|
72
|
+
ask?(title: string, body: string): Promise<boolean | undefined>;
|
|
73
|
+
}
|
|
74
|
+
/** A run of work started: what it planned, and how it ends. */
|
|
75
|
+
export interface WorkRun {
|
|
76
|
+
/** What each codebase of the module's chain was planned to - again after a start over. */
|
|
77
|
+
planned: ModuleStatus[];
|
|
78
|
+
/** Resolves when nothing more can start: the verdict. Never rejects. */
|
|
79
|
+
done: Promise<WorkResult>;
|
|
80
|
+
}
|
|
81
|
+
/** How a run of work ended. */
|
|
82
|
+
export interface WorkResult {
|
|
83
|
+
/** `completed`: nothing failed and every codebase is regenerated from the spec as it is, its conformance tests too. */
|
|
84
|
+
status: "completed" | "failed" | "incomplete" | "stopped";
|
|
85
|
+
plainFile: string;
|
|
86
|
+
/** Every job of the session's registry, in the order they were queued. */
|
|
87
|
+
jobs: Job[];
|
|
88
|
+
failed: Job[];
|
|
89
|
+
/** The codebases not regenerated from the spec as it is, its conformance tests too - and why. */
|
|
90
|
+
unfinished: ModuleState[];
|
|
91
|
+
/** Why the run ended before it was drained: a start over nobody agreed to. */
|
|
92
|
+
reason?: string;
|
|
93
|
+
/** With `exportTo`: what was exported, or why nothing was. */
|
|
94
|
+
exported?: ExportResult;
|
|
95
|
+
}
|
|
96
|
+
export type ExportResult = {
|
|
97
|
+
exported: true;
|
|
98
|
+
dir: string;
|
|
99
|
+
module: string;
|
|
100
|
+
commit: string;
|
|
101
|
+
files: number;
|
|
102
|
+
} | {
|
|
103
|
+
exported: false;
|
|
104
|
+
dir: string;
|
|
105
|
+
why: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Start a run of work: ask the loop, settle a start over, and drain - the work run until nothing more can start, the
|
|
109
|
+
* verdict in `done`. What the session's chats ask meanwhile runs in the same loop and drains with it.
|
|
110
|
+
*/
|
|
111
|
+
export declare function runWork(context: WorkContext, kind: WorkKind, request: WorkRequest & WorkRunOptions): Promise<WorkRun>;
|
|
112
|
+
/** How each codebase stands, from what is left to regenerate there. */
|
|
113
|
+
export declare function moduleStates(reports: DriftReport[]): ModuleState[];
|
|
114
|
+
/**
|
|
115
|
+
* Why code cannot be exported into a folder - one the export would wipe something in: the project, a folder holding it,
|
|
116
|
+
* or one inside plain_modules - or undefined when it can. Anything else is the export's own, its contents replaced.
|
|
117
|
+
*/
|
|
118
|
+
export declare function exportDirProblem(dir: string, projectDir: string): string | undefined;
|
|
119
|
+
/** The furthest-built codebase's last commit, exported into `dir` - or why nothing was. */
|
|
120
|
+
export declare function exportCode(plainFile: string, dir: string): ExportResult;
|
|
121
|
+
/** The models of the three roles as a run uses them: the coding model given, the others as they fall back - each with the level it thinks at. */
|
|
122
|
+
export declare function reportModels(project: ProjectConfig, model: string | undefined): Record<"harness" | "coding" | "judge", {
|
|
123
|
+
model?: string;
|
|
124
|
+
thinking?: string;
|
|
125
|
+
}>;
|
package/dist/work.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { resolve, sep } from "node:path";
|
|
2
|
+
import { brokenConfig, inheritModel, modelOnly, modelSpec, projectModels, readProjectConfig, roleModel, ROLE_THINKING, splitModelSpec } from "./config.js";
|
|
3
|
+
import { checkModule } from "./module-check.js";
|
|
4
|
+
import { formatCheckResults } from "./plain/check.js";
|
|
5
|
+
import { CONFORMANCE_OFF_REFUSAL, conformanceTestsOn } from "./conformance-switch.js";
|
|
6
|
+
import { refuseTestPlainFile } from "./test-plain-files.js";
|
|
7
|
+
import { stopJob, whenBuildable } from "./loop-tools.js";
|
|
8
|
+
import { functionalityCompletion } from "./regenerate/loop.js";
|
|
9
|
+
import { MODULES_DIR, projectDirOf } from "./regenerate/paths.js";
|
|
10
|
+
import { exportModule } from "./regenerate/launch.js";
|
|
11
|
+
import { listFiles } from "./regenerate/testing.js";
|
|
12
|
+
import { startRunReport } from "./run-report.js";
|
|
13
|
+
import { isTurriError, TurriError } from "./errors.js";
|
|
14
|
+
/**
|
|
15
|
+
* The work asked of the loop - the one call the chat's regenerate and conform tools and the session's `work` make, after
|
|
16
|
+
* their checks. Returns what each codebase of the module's chain was planned to.
|
|
17
|
+
*/
|
|
18
|
+
export async function planWork(loop, kind, request) {
|
|
19
|
+
const plainFile = resolve(request.plainFile);
|
|
20
|
+
const model = request.model !== undefined ? { model: request.model } : {};
|
|
21
|
+
if (kind === "conform") {
|
|
22
|
+
return loop.conformance(plainFile, {
|
|
23
|
+
...(request.funcIds !== undefined ? { funcIds: request.funcIds } : {}),
|
|
24
|
+
...model,
|
|
25
|
+
...(request.separately === true ? { separately: true } : {}),
|
|
26
|
+
...(request.fromScratch !== undefined ? { fromScratch: request.fromScratch } : {}),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (request.fromScratch !== undefined)
|
|
30
|
+
return loop.fromScratch(plainFile, { ...model, chain: request.fromScratch === "chain" });
|
|
31
|
+
if ((request.funcIds ?? []).length > 0)
|
|
32
|
+
return loop.regenerateAgain(plainFile, request.funcIds, model);
|
|
33
|
+
return loop.bringUp(plainFile, model);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The work asked of the loop after the checks the chat's tools make, each refusal a TurriError: a test plain file, a
|
|
37
|
+
* module that would be built with a config naming no unit testing script, one that does not parse, funcIds with
|
|
38
|
+
* fromScratch, conformance tests turned off.
|
|
39
|
+
*/
|
|
40
|
+
export async function askLoop(loop, kind, request) {
|
|
41
|
+
const plainFile = resolve(request.plainFile);
|
|
42
|
+
try {
|
|
43
|
+
refuseTestPlainFile(plainFile);
|
|
44
|
+
whenBuildable(plainFile, () => undefined);
|
|
45
|
+
if (kind === "conform") {
|
|
46
|
+
if (!conformanceTestsOn(plainFile))
|
|
47
|
+
throw new TurriError("refused", CONFORMANCE_OFF_REFUSAL);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const check = checkModule(plainFile);
|
|
51
|
+
// The parser's message as it gives it, a test plain file out of place, and turri's next step for the old syntax.
|
|
52
|
+
if (!check.ok)
|
|
53
|
+
throw new TurriError("refused", `${plainFile} does not parse, so nothing can be regenerated from it yet:\n${formatCheckResults([check])}`);
|
|
54
|
+
if ((request.funcIds ?? []).length > 0 && request.fromScratch !== undefined)
|
|
55
|
+
throw new TurriError("refused", "Name funcIds or set fromScratch, not both: from scratch regenerates every one of them.");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw isTurriError(error) ? error : new TurriError("refused", error instanceof Error ? error.message : String(error), { cause: error });
|
|
60
|
+
}
|
|
61
|
+
return planWork(loop, kind, { ...request, plainFile });
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Start a run of work: ask the loop, settle a start over, and drain - the work run until nothing more can start, the
|
|
65
|
+
* verdict in `done`. What the session's chats ask meanwhile runs in the same loop and drains with it.
|
|
66
|
+
*/
|
|
67
|
+
export async function runWork(context, kind, request) {
|
|
68
|
+
const plainFile = resolve(request.plainFile);
|
|
69
|
+
const projectDir = projectDirOf(plainFile);
|
|
70
|
+
// A config that does not parse is read as empty: refused, rather than every pulse run on defaults - pi's model among them.
|
|
71
|
+
const broken = brokenConfig(projectDir);
|
|
72
|
+
if (broken !== undefined)
|
|
73
|
+
throw new TurriError("config-invalid", `Nothing was started: ${broken}`);
|
|
74
|
+
const exportTo = request.exportTo !== undefined ? resolve(request.exportTo) : undefined;
|
|
75
|
+
if (exportTo !== undefined) {
|
|
76
|
+
const problem = exportDirProblem(exportTo, projectDir);
|
|
77
|
+
if (problem !== undefined)
|
|
78
|
+
throw new TurriError("refused", problem);
|
|
79
|
+
}
|
|
80
|
+
const { loop, jobs } = context;
|
|
81
|
+
const project = readProjectConfig(projectDir);
|
|
82
|
+
const report = request.report !== undefined
|
|
83
|
+
? startRunReport({
|
|
84
|
+
file: request.report,
|
|
85
|
+
command: request.command ?? [kind, plainFile],
|
|
86
|
+
specFile: plainFile,
|
|
87
|
+
projectDir,
|
|
88
|
+
...(exportTo !== undefined ? { buildDir: exportTo } : {}),
|
|
89
|
+
review: project.review === true,
|
|
90
|
+
mutationTesting: project.mutationTesting !== false,
|
|
91
|
+
models: reportModels(project, request.model ?? modelSpec(projectModels(project).coding)),
|
|
92
|
+
})
|
|
93
|
+
: undefined;
|
|
94
|
+
let exported;
|
|
95
|
+
report?.attach({
|
|
96
|
+
jobs: () => jobs.list(),
|
|
97
|
+
modules: () => moduleStates(loop.drift(plainFile)),
|
|
98
|
+
completion: () => functionalityCompletion(plainFile),
|
|
99
|
+
atExit: () => (exported !== undefined ? { build_dir_export: exported } : undefined),
|
|
100
|
+
});
|
|
101
|
+
const stopHearing = report !== undefined ? context.onFinish(() => report.write()) : () => { };
|
|
102
|
+
const finish = (result) => {
|
|
103
|
+
stopHearing();
|
|
104
|
+
if (exportTo !== undefined)
|
|
105
|
+
exported = exportCode(plainFile, exportTo);
|
|
106
|
+
report?.end(result.status === "stopped" ? "interrupted" : result.status, result.reason);
|
|
107
|
+
// Written as the run ends, not as the process does: a session outlives its runs.
|
|
108
|
+
report?.write();
|
|
109
|
+
return { plainFile, ...result, ...(exported !== undefined ? { exported } : {}) };
|
|
110
|
+
};
|
|
111
|
+
let planned;
|
|
112
|
+
try {
|
|
113
|
+
planned = await askLoop(loop, kind, { ...request, plainFile });
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
stopHearing();
|
|
117
|
+
report?.crashed(error);
|
|
118
|
+
report?.write();
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
// A codebase built without a module it now requires is started over only when the person says so.
|
|
122
|
+
const toStartOver = planned.filter((status) => status.startOver !== undefined);
|
|
123
|
+
if (toStartOver.length > 0) {
|
|
124
|
+
const why = toStartOver
|
|
125
|
+
.map(({ startOver }) => startOver.old === true
|
|
126
|
+
? `${startOver.codebases.join(", ")} was built when functional specs were numbered, before they had func-ids: nothing more can be built on it.`
|
|
127
|
+
: `${startOver.codebases.join(", ")} was built without ${startOver.requires.join(", ")}, which it now requires: no change to its code can bring it in.`)
|
|
128
|
+
.join("\n");
|
|
129
|
+
const question = {
|
|
130
|
+
title: "Start over?",
|
|
131
|
+
body: `${why}\nStarting over takes its code and conformance tests out - they stay in its history - and builds it again from the bottom of the chain.`,
|
|
132
|
+
codebases: [...new Set(toStartOver.flatMap(({ startOver }) => startOver.codebases))],
|
|
133
|
+
};
|
|
134
|
+
const answer = request.startOver;
|
|
135
|
+
const agreed = typeof answer === "boolean"
|
|
136
|
+
? answer
|
|
137
|
+
: typeof answer === "function"
|
|
138
|
+
? await answer(question)
|
|
139
|
+
: answer === "ask" && context.ask !== undefined
|
|
140
|
+
? await context.ask(question.title, question.body)
|
|
141
|
+
: undefined;
|
|
142
|
+
if (agreed === true)
|
|
143
|
+
planned = await loop.startOver(plainFile, request.model !== undefined ? { model: request.model } : {});
|
|
144
|
+
else if (agreed === undefined) {
|
|
145
|
+
const reason = `${why}\nNobody answered whether to start over: run again with startOver true to start over, or false to regenerate the rest of the chain without it.`;
|
|
146
|
+
return { planned, done: Promise.resolve(finish({ status: "incomplete", jobs: jobs.list(), failed: [], unfinished: moduleStates(loop.drift(plainFile)), reason })) };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Stopped from outside: the run's modules halted, so the drain ends with what was running rolled back.
|
|
150
|
+
let stopped = false;
|
|
151
|
+
const halt = () => {
|
|
152
|
+
stopped = true;
|
|
153
|
+
for (const status of planned) {
|
|
154
|
+
try {
|
|
155
|
+
stopJob(jobs, status.module, "stopped", loop);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
/* a module with nothing of its own to halt */
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
if (request.signal?.aborted === true)
|
|
163
|
+
halt();
|
|
164
|
+
else
|
|
165
|
+
request.signal?.addEventListener("abort", halt, { once: true });
|
|
166
|
+
const done = (async () => {
|
|
167
|
+
try {
|
|
168
|
+
// Until nothing more starts: a choice is made inside the pulse it follows, so draining waits for it.
|
|
169
|
+
await loop.drain();
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
request.signal?.removeEventListener("abort", halt);
|
|
173
|
+
}
|
|
174
|
+
const ended = jobs.list();
|
|
175
|
+
const failed = ended.filter((job) => job.status === "failed");
|
|
176
|
+
const unfinished = moduleStates(loop.drift(plainFile)).filter((module) => module.state !== "complete");
|
|
177
|
+
const status = stopped ? "stopped" : failed.length > 0 ? "failed" : unfinished.length > 0 ? "incomplete" : "completed";
|
|
178
|
+
return finish({ status, jobs: ended, failed, unfinished });
|
|
179
|
+
})();
|
|
180
|
+
return { planned, done };
|
|
181
|
+
}
|
|
182
|
+
/** How each codebase stands, from what is left to regenerate there. */
|
|
183
|
+
export function moduleStates(reports) {
|
|
184
|
+
return reports.map((report) => {
|
|
185
|
+
const state = report.running !== undefined
|
|
186
|
+
? "running"
|
|
187
|
+
: report.startOver !== undefined
|
|
188
|
+
? "start_over_needed"
|
|
189
|
+
: report.why !== undefined
|
|
190
|
+
? "halted"
|
|
191
|
+
: report.code === null && (report.conformance === null || report.conformance === undefined)
|
|
192
|
+
? "complete"
|
|
193
|
+
: "incomplete";
|
|
194
|
+
const why = state === "start_over_needed"
|
|
195
|
+
? report.startOver.old === true
|
|
196
|
+
? "built when functional specs were numbered, before they had func-ids: start it over to regenerate its chain from scratch"
|
|
197
|
+
: `built without ${report.startOver.requires.join(", ")}, which it now requires: start it over`
|
|
198
|
+
: state === "incomplete"
|
|
199
|
+
? report.code !== null && report.code !== undefined
|
|
200
|
+
? "its code is not regenerated from the spec as it is"
|
|
201
|
+
: "its conformance tests are not written for what is built"
|
|
202
|
+
: report.why;
|
|
203
|
+
return { module: report.module, state, ...(why !== undefined ? { why } : {}) };
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Why code cannot be exported into a folder - one the export would wipe something in: the project, a folder holding it,
|
|
208
|
+
* or one inside plain_modules - or undefined when it can. Anything else is the export's own, its contents replaced.
|
|
209
|
+
*/
|
|
210
|
+
export function exportDirProblem(dir, projectDir) {
|
|
211
|
+
const within = (inner, of) => inner === of || inner.startsWith(`${of}${sep}`);
|
|
212
|
+
const why = within(projectDir, dir)
|
|
213
|
+
? "it holds the project, and the export replaces what is in it"
|
|
214
|
+
: within(dir, resolve(projectDir, MODULES_DIR))
|
|
215
|
+
? `it is inside ${MODULES_DIR}, which turri regenerates in`
|
|
216
|
+
: undefined;
|
|
217
|
+
if (why === undefined)
|
|
218
|
+
return undefined;
|
|
219
|
+
return `${dir} cannot be exported into: ${why}. Name a folder of its own - the code is exported there as the run ends.`;
|
|
220
|
+
}
|
|
221
|
+
/** The furthest-built codebase's last commit, exported into `dir` - or why nothing was. */
|
|
222
|
+
export function exportCode(plainFile, dir) {
|
|
223
|
+
try {
|
|
224
|
+
const code = exportModule(plainFile, { into: dir });
|
|
225
|
+
const files = listFiles(dir).length;
|
|
226
|
+
// Its history began, and nothing landed in it yet: only the harness's own files, which are left out.
|
|
227
|
+
if (files === 0)
|
|
228
|
+
return { exported: false, dir, why: `nothing has landed in ${code.moduleName} yet: its codebase holds no code` };
|
|
229
|
+
return { exported: true, dir, module: code.moduleName, commit: code.short, files };
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
return { exported: false, dir, why: error instanceof Error ? error.message : String(error) };
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/** The models of the three roles as a run uses them: the coding model given, the others as they fall back - each with the level it thinks at. */
|
|
236
|
+
export function reportModels(project, model) {
|
|
237
|
+
const coding = splitModelSpec(model);
|
|
238
|
+
const harness = projectModels(project).harness ?? modelOnly(model);
|
|
239
|
+
// As the judge's agent finds it: its models: entry over judge-model over models.default, else the coding model's.
|
|
240
|
+
const judge = inheritModel(roleModel(project, "judge"), modelOnly(model)) ?? {};
|
|
241
|
+
const choice = (given, fallback) => ({
|
|
242
|
+
...(given.model !== undefined ? { model: given.model } : {}),
|
|
243
|
+
...((given.thinking ?? fallback) !== undefined ? { thinking: given.thinking ?? fallback } : {}),
|
|
244
|
+
});
|
|
245
|
+
return {
|
|
246
|
+
harness: choice(harness, ROLE_THINKING.planner),
|
|
247
|
+
coding: choice(coding, ROLE_THINKING.coding),
|
|
248
|
+
judge: choice(judge, ROLE_THINKING.judge),
|
|
249
|
+
};
|
|
250
|
+
}
|
package/docs/README.md
CHANGED
|
@@ -37,7 +37,7 @@ They are turri's documentation of the whole product, kept here with the core tha
|
|
|
37
37
|
| what the agents can and cannot reach | [the sandbox](sandbox.md) |
|
|
38
38
|
| how skill review gates and judges work | [skills and gates](skills-and-gates.md) |
|
|
39
39
|
| how the parser matches the reference implementation | [the \*\*\*plain parser](parser.md) |
|
|
40
|
-
| how a desktop app
|
|
40
|
+
| how a front end - a desktop app, an editor - runs turri's session | [the core](core.md) |
|
|
41
41
|
| what is this package's and what is turri's CLI's, and how the CLI draws the core | [the core](core.md) |
|
|
42
42
|
| where the code for something lives | [development](development.md#layout) |
|
|
43
43
|
|
|
@@ -60,6 +60,5 @@ They are turri's documentation of the whole product, kept here with the core tha
|
|
|
60
60
|
| [Skills and gates](skills-and-gates.md) | the gate syntax, what the harness enforces, what a step can do, the rules, trying the gates |
|
|
61
61
|
| [The \*\*\*plain parser](parser.md) | the TypeScript port, `turri parse`, inheritance, the iterator, fidelity |
|
|
62
62
|
| [Theming](theming.md) | the turri themes, contrast, backgrounds, the font |
|
|
63
|
-
| [
|
|
64
|
-
| [The core](core.md) | this package and turri's CLI: the boundary, the view, the entries a chat keeps, unattended runs, what else the CLI takes from the core, importing it, turri-app |
|
|
63
|
+
| [The core](core.md) | the interface every front end builds on: the five entries, the session, the front end, events, the transcript's entries, errors, the boundary, importing and versioning |
|
|
65
64
|
| [Development](development.md) | tests, the source layout, known edges |
|
package/docs/capture.md
CHANGED
|
@@ -37,7 +37,7 @@ capture shorty ✓ survey ━ ✓ outline ━ ⠋ features ─ ○ concepts ─
|
|
|
37
37
|
|
|
38
38
|
`turri capture` prints a line as each step ends.
|
|
39
39
|
|
|
40
|
-
When it ends, turri asks whether to open the captured project. A chat works on the project of the folder it was opened in, and `plain/` is a project of its own.
|
|
40
|
+
When it ends, turri asks whether to open the captured project. A chat works on the project of the folder it was opened in, and `plain/` is a project of its own. On yes, the chat closes and `turri` starts again in `plain/` with that project's configured model and thinking. There, `ctrl+h` shows its \*\*\*plain, `/regenerate` builds it, and the chat tells you its report. On no, the chat tells you the report where you are, and `cd plain && turri` opens it later. A host - a desktop app - opens projects itself, so it is not asked.
|
|
41
41
|
|
|
42
42
|
## What it aims for
|
|
43
43
|
|
|
@@ -166,7 +166,7 @@ my-app/
|
|
|
166
166
|
- **The codebase is never written to.** Capture's agents only read it - read, grep, find, ls, and no shell - but for those that try the scenarios, which run the original in a copy of it, removed once they are done.
|
|
167
167
|
- **Assets.** The assets are copied rather than linked, so the original can be deleted without breaking anything. `base-folder: assets` puts them in the first module's code before its first pulse, at the paths they had.
|
|
168
168
|
- **The config.** Capture inherits `config.turri.yaml` from the project in which the chat or `turri capture` was started. That keeps the person's models, thinking, reviews and limits. With no config to inherit, capture writes the full `turri init-config` template. A named harness model selects its vendor's pair: for example, a global Bedrock Claude harness gets Haiku low for coding. `--coding-model` overrides that choice. A custom provider with no preset keeps its named model. The capture agents use their [own three tiers](#models).
|
|
169
|
-
- **Capture-specific settings.** Capture turns on `conformance-tests` and wires up the captured project's own unit and conformance runners. The original project's script paths, `module`, `base-folder` and `test-dir` do not carry over.
|
|
169
|
+
- **Capture-specific settings.** Capture turns on `conformance-tests` and wires up the captured project's own unit and conformance runners. The original project's script paths, `module`, `base-folder` and `test-dir` do not carry over. `/capture` uses the project's models, independently of the model the chat is on. A coding model given at chat startup, or `--harness-model` and `--coding-model` on `turri capture`, override the corresponding project model. A config that does not parse stops capture before anything is written ([details](config.md#a-config-that-does-not-parse)).
|
|
170
170
|
|
|
171
171
|
## The report
|
|
172
172
|
|
|
@@ -194,7 +194,7 @@ Its first lines are the summary the command line and the chat show. In the chat,
|
|
|
194
194
|
|
|
195
195
|
## Stopped, finished, run again
|
|
196
196
|
|
|
197
|
-
- **Stopped part-way.** Every answer is saved in `state.json` as it comes.
|
|
197
|
+
- **Stopped part-way.** Every answer is saved in `state.json` as it comes. Run `turri init-config` in the project to change models after a provider failure, then run `/capture` or `turri capture` there again. The remaining agents use the project's current model settings. The checkpoint, generated files and testing-script paths stay in place.
|
|
198
198
|
- **Finished.** A finished capture is never run over. To capture again, move `plain/` out of the way.
|
|
199
199
|
- **A folder that is not a capture.** Capture refuses a `plain/` that holds anything but its own state, and `--into <folder>` names another folder.
|
|
200
200
|
|
|
@@ -206,7 +206,7 @@ Its first lines are the summary the command line and the chat show. In the chat,
|
|
|
206
206
|
| `capture-analysis` | Check conventions, reference entries and the module's interface against the code, split and outline areas, divide features, and try draft scenarios against the original. | **Sonnet, low** |
|
|
207
207
|
| `capture` | Reason about the stack and requirements, write the specs, organise modules, reconcile concepts, revise the text and write custom testing scripts. | **Opus, medium** |
|
|
208
208
|
|
|
209
|
-
`init-config`
|
|
209
|
+
`init-config` sets all three entries each time it runs. The table shows the Claude defaults; other model families use the selected coding model for exploration and analysis and the harness model for writing. For example, with Anthropic:
|
|
210
210
|
|
|
211
211
|
```yaml
|
|
212
212
|
models:
|
package/docs/chats.md
CHANGED
|
@@ -21,6 +21,8 @@ The session's, shared by every chat:
|
|
|
21
21
|
|
|
22
22
|
Each finished pulse appears in the session's notifications. When the [sentinel](sentinel.md) is on, it checks the pulse in the background and puts its findings and conclusion there too. Your conversation stays on what you asked; accepting a notice's action starts work in the chat it names. Closing a chat stops its turn, never its pulses.
|
|
23
23
|
|
|
24
|
+
What turri tells a chat's agent itself - a pulse that ended, the sentinel's conclusion, a launch, the notice you answered - is a hidden message the model reads inside a `<turri-note>`. pi gives the model every such message as the person's; one told with no turn of its own (a pulse end or conclusion a front end shows itself) goes with your next message, in the same turn, and without the note the model read your words as turri's. The transcript keeps the message as it was sent.
|
|
25
|
+
|
|
24
26
|
## In the terminal
|
|
25
27
|
|
|
26
28
|
| | |
|
|
@@ -41,12 +43,12 @@ When the tabs scroll away, they stay at the top of the fullscreen terminal. A fr
|
|
|
41
43
|
|
|
42
44
|
A message you send while a chat's agent works is shown under the chat at once, shaded and marked `not read yet`, and stays under what the agent writes and the tools it calls until the agent reads it - at the end of its current step - when it goes into the chat as a normal message, where it was read. `alt+up` takes the messages waiting back into the editor (turri's CLI: `src/chat-waiting.ts`). While a skill runs in the chat its own agent is the one at work, and the chat's waits for the whole run: what you type then goes to the skill's agent, shown waiting until it reads it, at the end of its current step - and is in the chat from then, where it was read. The chat's agent is told what you said to the skill when the run ends. A message the skill's agent has not read when the run ends goes to the chat's agent instead.
|
|
43
45
|
|
|
44
|
-
On macOS, `alt` is Option (⌥), and reaches turri only when the terminal sends Option as Meta - otherwise ⌥N is the dead key for ñ and ⌥1 types `¡`, and nothing reaches turri. turri says so as a
|
|
46
|
+
On macOS, `alt` is Option (⌥), and reaches turri only when the terminal sends Option as Meta - otherwise ⌥N is the dead key for ñ and ⌥1 types `¡`, and nothing reaches turri. turri says so as you open a second chat of your own - the sentinel's, opened beside yours, does not count. To turn it on: Ghostty, `macos-option-as-alt = true` in its config; iTerm2, Profiles → Keys → Left Option key: Esc+; Terminal.app, Profiles → Keyboard → Use Option as Meta key; Kitty, `macos_option_as_alt yes`; WezTerm, `send_composed_key_when_left_alt_is_pressed = false`. `/chat` works without it.
|
|
45
47
|
|
|
46
48
|
- **A hidden chat's questions** wait until you show it, then come up one after another. What it says in passing is said as you show it; what it keeps on the screen - a skill's progress, the job panel - is put back each time; what you had typed in its editor and not sent is still there.
|
|
47
49
|
- **The side panel** belongs to the session and stays open when you switch chats. Click `***plain ›` at the right end of the chat tabs to open it; click `***plain ‹` to close it. The button turns pink and spins while turri plans or runs pulses. Its tabs are `***plain`, `pulses` and `notifications`; `× close` also closes it. From the keyboard, `ctrl+h` opens the panel, `p` switches between the map and pulses, and `n` opens notifications. A terminal under 104 columns shows the panel full screen.
|
|
48
50
|
- **A long command** - `/regenerate`, planning a module from scratch - does its work in the background once it is under way: the chat, and switching to another, stay free while the planner plans.
|
|
49
|
-
- **`ctrl+c`** reaches the chat shown and nothing else: another chat's turn and skill go on, and so do the pulses - `/halt` stops one. A skill stopped keeps its run, for the model to continue with `resume`. At a question - the chat's `ask_user`, a skill's interview - `ctrl+c` declines it, and the asker is told so and goes on - each question it is pressed at, however many in a row. A skill is stopped by `ctrl+c` with no question open. A second press straight after one that stopped something does nothing, so pressing twice to be sure does not leave turri; once the chat is doing nothing, the next one does - with what every other chat is doing. A host has the same as `interrupt(id)`, and `decline(id)` for a question ([hosting](
|
|
51
|
+
- **`ctrl+c`** reaches the chat shown and nothing else: another chat's turn and skill go on, and so do the pulses - `/halt` stops one. A skill stopped keeps its run, for the model to continue with `resume`. At a question - the chat's `ask_user`, a skill's interview - `ctrl+c` declines it, and the asker is told so and goes on - each question it is pressed at, however many in a row. A skill is stopped by `ctrl+c` with no question open. A second press straight after one that stopped something does nothing, so pressing twice to be sure does not leave turri; once the chat is doing nothing, the next one does - with what every other chat is doing. A host has the same as `interrupt(id)`, and `decline(id)` for a question ([hosting](core.md)).
|
|
50
52
|
- **The sentinel** is a chat in the strip like the others, `sentinel`, and never shown by itself: it closes like any chat, and the next pulse that finishes opens it again. Each pulse it checks in a fresh conversation, replacing the one in its tab. With it on, you open up to eight chats - the ninth slot is its. See [the sentinel](sentinel.md).
|
|
51
53
|
- **The last chat** of yours is not closed: `/quit` leaves turri. Leaving turri leaves the terminal as it was: the conversation is not written out to it, nor a line on how to resume - the command run is all that stays. `turri --continue` opens the chats again.
|
|
52
54
|
- **`/fork`** and **`/reload`** work on the chat shown, as [pi](https://pi.dev)'s do: the chat's history forked, or turri's extension rebuilt in it.
|
|
@@ -71,7 +73,7 @@ In [debug mode](config.md#debug-mode) nothing is deleted.
|
|
|
71
73
|
|
|
72
74
|
## In a host
|
|
73
75
|
|
|
74
|
-
A host - turri's desktop app - runs the same session with `createTurri`, opening, closing and showing chats in its own windows: see [running turri in a host](
|
|
76
|
+
A host - turri's desktop app - runs the same session with `createTurri`, opening, closing and showing chats in its own windows: see [running turri in a host](core.md).
|
|
75
77
|
|
|
76
78
|
## How it works
|
|
77
79
|
|