@turri-dev/cli 0.2.3 → 0.2.4-next.009bd0c
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 +7 -8
- package/dist/bedrock-region.js +3 -3
- package/dist/chat-idle.d.ts +2 -2
- package/dist/chat-idle.js +2 -2
- 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/chat-skills.d.ts +1 -1
- package/dist/chat-skills.js +1 -1
- package/dist/chats.d.ts +44 -20
- package/dist/chats.js +125 -64
- package/dist/cli.js +12 -31
- package/dist/config-edit.d.ts +20 -8
- package/dist/config-edit.js +32 -26
- package/dist/config.d.ts +106 -78
- package/dist/config.js +267 -133
- package/dist/conform-cli.js +14 -3
- package/dist/conformance-switch.d.ts +13 -22
- package/dist/conformance-switch.js +37 -59
- package/dist/drift-cli.js +1 -1
- package/dist/extension.d.ts +17 -10
- package/dist/extension.js +425 -531
- package/dist/genome.js +10 -49
- package/dist/graph.js +3 -5
- package/dist/host-session.d.ts +11 -21
- package/dist/host-session.js +6 -8
- package/dist/host.d.ts +4 -4
- package/dist/host.js +4 -7
- package/dist/identity.js +2 -3
- package/dist/init-config.d.ts +1 -2
- package/dist/init-config.js +10 -17
- package/dist/installed-providers.d.ts +1 -1
- package/dist/installed-providers.js +1 -1
- package/dist/launch-agent.d.ts +41 -0
- package/dist/launch-agent.js +219 -0
- package/dist/{release-cli.js → launch-cli.js} +41 -24
- package/dist/launch-session.d.ts +58 -0
- package/dist/launch-session.js +195 -0
- package/dist/launch-tools.d.ts +28 -0
- package/dist/launch-tools.js +69 -0
- package/dist/launch-track.d.ts +120 -0
- package/dist/launch-track.js +298 -0
- package/dist/loop-cli.d.ts +4 -3
- package/dist/loop-cli.js +17 -15
- package/dist/loop-tools.d.ts +45 -21
- package/dist/loop-tools.js +155 -90
- package/dist/new-project.js +2 -2
- package/dist/notice.d.ts +7 -6
- package/dist/parse-cli.js +2 -2
- package/dist/pi-launch.js +4 -1
- package/dist/pi-settings.d.ts +4 -0
- package/dist/pi-settings.js +39 -0
- package/dist/pi.js +12 -9
- package/dist/plain/check.d.ts +2 -9
- package/dist/plain/check.js +6 -39
- package/dist/plain-files.d.ts +2 -2
- package/dist/plain-files.js +7 -7
- package/dist/regenerate/activity.d.ts +0 -7
- package/dist/regenerate/activity.js +2 -20
- package/dist/regenerate/agent-env.d.ts +1 -1
- package/dist/regenerate/agent-env.js +3 -3
- package/dist/regenerate/agent-shell.js +5 -3
- package/dist/regenerate/audit.js +9 -0
- package/dist/regenerate/base-folder.d.ts +2 -2
- package/dist/regenerate/base-folder.js +1 -1
- package/dist/regenerate/cases.js +7 -0
- package/dist/regenerate/chunk-plan.d.ts +5 -0
- package/dist/regenerate/chunk-plan.js +16 -1
- package/dist/regenerate/command-check.d.ts +1 -1
- package/dist/regenerate/command-check.js +1 -1
- package/dist/regenerate/delivery.d.ts +1 -1
- package/dist/regenerate/delivery.js +3 -3
- package/dist/regenerate/drift.d.ts +4 -0
- package/dist/regenerate/drift.js +26 -6
- package/dist/regenerate/failure-reports.d.ts +28 -0
- package/dist/regenerate/failure-reports.js +79 -0
- package/dist/regenerate/job-panel.js +3 -1
- package/dist/regenerate/jobs-tree.js +1 -1
- package/dist/regenerate/jobs.d.ts +4 -2
- package/dist/regenerate/jobs.js +14 -10
- package/dist/regenerate/launch.d.ts +126 -0
- package/dist/regenerate/{release.js → launch.js} +60 -48
- package/dist/regenerate/ledger-view.d.ts +11 -24
- package/dist/regenerate/ledger-view.js +14 -60
- package/dist/regenerate/ledger.d.ts +26 -16
- package/dist/regenerate/ledger.js +1 -1
- package/dist/regenerate/lineage.d.ts +2 -0
- package/dist/regenerate/lineage.js +8 -0
- package/dist/regenerate/loop.d.ts +54 -67
- package/dist/regenerate/loop.js +312 -148
- 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 +3 -3
- package/dist/regenerate/paths.js +4 -4
- package/dist/regenerate/records.d.ts +11 -0
- package/dist/regenerate/records.js +15 -0
- package/dist/regenerate/regenerate.d.ts +0 -2
- package/dist/regenerate/regenerate.js +4 -15
- package/dist/regenerate/renames.js +4 -4
- package/dist/regenerate/requires.d.ts +7 -0
- package/dist/regenerate/requires.js +24 -18
- package/dist/regenerate/scripts-being-written.d.ts +4 -4
- package/dist/regenerate/scripts-being-written.js +3 -3
- package/dist/regenerate/spec-map.js +3 -3
- package/dist/regenerate/standing.js +1 -1
- package/dist/regenerate/submit-work.d.ts +2 -0
- package/dist/regenerate/submit-work.js +8 -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 +16 -5
- package/dist/regenerate/testing-steps.js +28 -9
- package/dist/regenerate-cli.js +18 -9
- package/dist/self-invocation.d.ts +11 -0
- package/dist/self-invocation.js +36 -10
- package/dist/sentinel-check.d.ts +3 -3
- package/dist/sentinel-check.js +3 -3
- package/dist/sentinel.d.ts +17 -12
- package/dist/sentinel.js +75 -46
- 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/dist/skill.d.ts +0 -11
- package/dist/skill.js +0 -9
- package/dist/tools.js +2 -3
- package/dist/turri-versions.js +2 -1
- package/docs/README.md +4 -6
- package/docs/authoring-plain.md +3 -3
- package/docs/chats.md +6 -9
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +61 -51
- package/docs/development.md +4 -5
- package/docs/headless.md +7 -6
- package/docs/hosting.md +24 -23
- package/docs/launch.md +63 -0
- package/docs/parser.md +3 -3
- package/docs/regenerating.md +30 -22
- package/docs/sandbox.md +3 -3
- package/docs/sentinel.md +27 -16
- package/docs/skills-and-gates.md +6 -11
- package/docs/using.md +25 -42
- package/genome/rules/project-model.md +2 -1
- package/genome/rules/test-plain-files.md +15 -7
- package/genome/rules/turri-regeneration.md +7 -10
- package/genome/skills/convert-old-syntax/SKILL.md +5 -5
- 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/advisor-chat.d.ts +0 -63
- package/dist/advisor-chat.js +0 -290
- package/dist/change-plain-cli.js +0 -55
- package/dist/ledger-cli.d.ts +0 -1
- package/dist/ledger-cli.js +0 -50
- package/dist/ledger-tools.d.ts +0 -10
- package/dist/ledger-tools.js +0 -64
- package/dist/regenerate/advisor-records.d.ts +0 -93
- package/dist/regenerate/advisor-records.js +0 -110
- package/dist/regenerate/advisor-runs.d.ts +0 -87
- package/dist/regenerate/advisor-runs.js +0 -327
- package/dist/regenerate/engine.d.ts +0 -52
- package/dist/regenerate/release.d.ts +0 -121
- package/dist/regenerate/test-advisor.d.ts +0 -101
- package/dist/regenerate/test-advisor.js +0 -379
- package/dist/release-agent.d.ts +0 -43
- package/dist/release-agent.js +0 -130
- package/dist/release-cli.d.ts +0 -1
- package/dist/release-tools.d.ts +0 -44
- package/dist/release-tools.js +0 -170
- package/dist/spec-tools.d.ts +0 -36
- package/dist/spec-tools.js +0 -128
- package/dist/stacks.d.ts +0 -13
- package/dist/stacks.js +0 -96
- package/docs/deploy.md +0 -48
- package/docs/test-advisor.md +0 -110
- /package/dist/{change-plain-cli.d.ts → launch-cli.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, join, resolve } from "node:path";
|
|
2
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
3
3
|
import { conformanceTestsOn } from "../conformance-switch.js";
|
|
4
|
-
import {
|
|
4
|
+
import { configModuleFor, configModulePinned, testDirOf, withConfigModule } from "../config.js";
|
|
5
5
|
import { IMPORT_DIRECTIVE, readPlainSourceMetadata } from "../plain/parser.js";
|
|
6
6
|
import { FUNCTIONAL_REQUIREMENTS, REQUIRED_FUNCTIONAL_SPECS, TEST_REQUIREMENTS } from "../plain/spec.js";
|
|
7
7
|
import { isStdlibModule, STDLIB_ROOT } from "../plain/stdlib.js";
|
|
@@ -50,16 +50,16 @@ export function conformanceTemplateOf(plainFile) {
|
|
|
50
50
|
return conformance !== undefined && existsSync(join(STDLIB_ROOT, `${conformance}.plain`)) ? conformance : undefined;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* The conformance testing script a module's tests would run with, looked for
|
|
54
|
-
*
|
|
53
|
+
* The conformance testing script a module's tests would run with, looked for with its config - the one pinned, else the
|
|
54
|
+
* one `configModuleFor` gives it - or nothing, with why when there is a why.
|
|
55
55
|
*/
|
|
56
56
|
export function conformanceScriptOf(plainFile, buildDir) {
|
|
57
|
-
const
|
|
57
|
+
const configModule = configModulePinned() ? undefined : configModuleFor(plainFile);
|
|
58
58
|
const scripts = () => {
|
|
59
59
|
const root = buildDir !== undefined ? projectRootFor(plainFile, buildDir) : projectDirOf(plainFile);
|
|
60
60
|
return findTestScripts(root, plainFile, buildDir);
|
|
61
61
|
};
|
|
62
|
-
const found =
|
|
62
|
+
const found = configModulePinned() ? scripts() : withConfigModule(configModule, scripts);
|
|
63
63
|
return { ...(found.conformance !== undefined ? { script: found.conformance } : {}), ...(found.notes?.conformance !== undefined ? { note: found.notes.conformance } : {}) };
|
|
64
64
|
}
|
|
65
65
|
/** The functional specs of a codebase's tree - its own, or ones it inherits - that have scenarios, as `module:func-id`, a module below's first. */
|
|
@@ -73,9 +73,9 @@ function named(specs) {
|
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* The step of adding tests a module skipped, when its functional specs have scenarios: no test reqs - its own or
|
|
76
|
-
* imported - or no conformance testing script
|
|
76
|
+
* imported - or no conformance testing script. `tree` is what its conformance tests would be written from:
|
|
77
77
|
* the codebase's spec, the module's own sections with its imports in, and the functional specs it inherits. The script
|
|
78
|
-
* is looked for
|
|
78
|
+
* is looked for with the module's config - the one pinned, else the one `configModuleFor` gives it.
|
|
79
79
|
*/
|
|
80
80
|
export function testingGap(input) {
|
|
81
81
|
const { moduleName, plainFile } = input;
|
|
@@ -93,7 +93,7 @@ export function testingGap(input) {
|
|
|
93
93
|
return {
|
|
94
94
|
step: "test reqs",
|
|
95
95
|
text: `${moduleName} has scenarios to test - ${named(tested)} - but no ***test reqs***, so its conformance tests cannot be written - the test reqs are ` +
|
|
96
|
-
`the first step of adding tests. Next step: ${reqs}
|
|
96
|
+
`the first step of adding tests. Next step: ${reqs}${found.script === undefined ? `; then ${scriptStep}` : ""}.`,
|
|
97
97
|
short: "scenarios not tested: no test reqs",
|
|
98
98
|
};
|
|
99
99
|
}
|
|
@@ -108,3 +108,22 @@ export function testingGap(input) {
|
|
|
108
108
|
}
|
|
109
109
|
return undefined;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* The steps of adding tests a module still has to take before it has anything to test - in their order: its test reqs,
|
|
113
|
+
* its conformance testing script, the scenarios - from the first one missing. What is said when conform
|
|
114
|
+
* finds no scenarios: the whole way there, not the last step alone.
|
|
115
|
+
*/
|
|
116
|
+
export function stepsToScenarios(input) {
|
|
117
|
+
const { moduleName, plainFile } = input;
|
|
118
|
+
const steps = [];
|
|
119
|
+
if ((input.tree[TEST_REQUIREMENTS] ?? []).length === 0) {
|
|
120
|
+
const conformance = conformanceTemplateOf(plainFile);
|
|
121
|
+
steps.push(conformance !== undefined ? `import the stack's conformance template, ${conformance}` : "write the module's own ***test reqs***");
|
|
122
|
+
}
|
|
123
|
+
if (conformanceScriptOf(plainFile, input.buildDir).script === undefined)
|
|
124
|
+
steps.push("write the conformance testing script with the implement-conformance-testing-script skill");
|
|
125
|
+
const testDir = relative(projectDirOf(resolve(plainFile)), testDirOf(plainFile)) || ".";
|
|
126
|
+
steps.push(`write the scenarios, each functional spec's in ${testDir}/${moduleName}/<func-id>.plain, then regenerate`);
|
|
127
|
+
const order = steps.length > 1 ? "Adding tests is three steps, in this order: the test reqs, the conformance testing script, the scenarios. " : "";
|
|
128
|
+
return `${order}Next step: ${steps.join("; then ")}.`;
|
|
129
|
+
}
|
package/dist/regenerate-cli.js
CHANGED
|
@@ -16,7 +16,8 @@ build when none is given), coding-model (the agents that build) and harness-mode
|
|
|
16
16
|
0 only when every module is complete: regenerated from the spec as it is, and its conformance tests written
|
|
17
17
|
for every functional spec's scenarios.
|
|
18
18
|
|
|
19
|
-
--dry-run plan the work and print the prompt of
|
|
19
|
+
--dry-run look ahead: plan the work as regenerate would and print the prompt of each codebase's
|
|
20
|
+
next pulse, starting nothing and changing no code or tests
|
|
20
21
|
--start-over start over, without asking, a codebase regenerated without a module it now requires -
|
|
21
22
|
with no terminal to ask and without it, the run stops there
|
|
22
23
|
--from-scratch delete the module's code and conformance tests (its lineage keeps them) and regenerate all of it
|
|
@@ -45,23 +46,31 @@ if (!named) {
|
|
|
45
46
|
process.exit(1);
|
|
46
47
|
}
|
|
47
48
|
const scratch = options["from-scratch-chain"] !== undefined ? "chain" : options["from-scratch"] !== undefined ? "module" : undefined;
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const dryRun = options["dry-run"] !== undefined;
|
|
50
|
+
// A dry run writes nothing: from scratch deletes the code before it plans, and functional specs named are marked in the records first.
|
|
51
|
+
if (scratch !== undefined && dryRun) {
|
|
50
52
|
console.error(`--from-scratch${scratch === "chain" ? "-chain" : ""} deletes the code before anything is planned: it cannot be a dry run.`);
|
|
51
53
|
process.exit(1);
|
|
52
54
|
}
|
|
55
|
+
if (again.length > 0 && dryRun) {
|
|
56
|
+
console.error(`${again.join(", ")} would be marked to regenerate again in the code records before anything is planned: that cannot be a dry run.`);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
53
59
|
runLoop({
|
|
54
60
|
plainFile: named,
|
|
55
61
|
...(buildDir !== undefined ? { buildDir } : {}),
|
|
56
62
|
...(report !== undefined ? { report } : {}),
|
|
57
63
|
command: ["regenerate", ...process.argv.slice(2)],
|
|
58
|
-
dryRun
|
|
64
|
+
dryRun,
|
|
59
65
|
startOver: options["start-over"] !== undefined,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
// A dry run is a look ahead: planned as regenerate plans it, nothing started.
|
|
67
|
+
ask: (loop) => dryRun
|
|
68
|
+
? loop.lookAhead(named)
|
|
69
|
+
: again.length > 0
|
|
70
|
+
? loop.regenerateAgain(named, again)
|
|
71
|
+
: scratch !== undefined
|
|
72
|
+
? loop.fromScratch(named, { chain: scratch === "chain" })
|
|
73
|
+
: loop.bringUp(named),
|
|
65
74
|
}).catch((error) => {
|
|
66
75
|
console.error(error instanceof Error ? error.message : error);
|
|
67
76
|
process.exit(1);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* the same build directories. It is never the right call unless the person asked for the
|
|
9
9
|
* command line, so the harness refuses it and names the tool to use instead.
|
|
10
10
|
*/
|
|
11
|
+
import { type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
11
12
|
/**
|
|
12
13
|
* What a shell command would run of turri or pi itself, if anything: the subcommand,
|
|
13
14
|
* or "pi" for another pi. `turri parse`, `drift` and `lineage` are not in it - they start no
|
|
@@ -23,3 +24,13 @@ export declare function askedForCommandLine(message: string): boolean;
|
|
|
23
24
|
export declare function refusal(what: string, surface?: string): string;
|
|
24
25
|
/** The instruction that goes into the conversation's system prompt. */
|
|
25
26
|
export declare const TOOLS_NOT_CLI: string;
|
|
27
|
+
type AnyTool = ToolDefinition<any, any, any>;
|
|
28
|
+
/** What a skill's agent is told when its shell would run turri or another pi. */
|
|
29
|
+
export declare function skillRefusal(what: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* A skill's shell: pi's bash in the project, refusing what its agent never runs there - turri or another pi again
|
|
32
|
+
* (selfInvocation), and a change to the machine's toolchains or settings (machineChange). The conversation's own bash is
|
|
33
|
+
* held to the same by its tool_call guard; a skill runs in a session of its own, which that guard does not see.
|
|
34
|
+
*/
|
|
35
|
+
export declare function skillShell(cwd: string): AnyTool;
|
|
36
|
+
export {};
|
package/dist/self-invocation.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* the same build directories. It is never the right call unless the person asked for the
|
|
9
9
|
* command line, so the harness refuses it and names the tool to use instead.
|
|
10
10
|
*/
|
|
11
|
+
import { createBashToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
12
|
+
import { machineChange, machineChangeReason } from "./regenerate/command-check.js";
|
|
11
13
|
/** The tool that does what a turri subcommand does, from inside the conversation. */
|
|
12
14
|
const TOOL_FOR = {
|
|
13
15
|
regenerate: "regenerate",
|
|
14
|
-
glimpse: "glimpse",
|
|
15
16
|
conform: "conform",
|
|
16
17
|
cultivate: "cultivate",
|
|
17
|
-
|
|
18
|
-
"change-plain": "regenerate",
|
|
18
|
+
launch: "launch",
|
|
19
19
|
chat: "nothing - you are the conversation already",
|
|
20
20
|
ask: "nothing - you are the conversation already",
|
|
21
21
|
};
|
|
@@ -31,9 +31,8 @@ const NPM_SCRIPT = {
|
|
|
31
31
|
const ENTRY = {
|
|
32
32
|
"regenerate-cli": "regenerate",
|
|
33
33
|
"conform-cli": "conform",
|
|
34
|
-
"change-plain-cli": "change-plain",
|
|
35
34
|
"cultivate-cli": "cultivate",
|
|
36
|
-
"
|
|
35
|
+
"launch-cli": "launch",
|
|
37
36
|
};
|
|
38
37
|
/** Where a command starts: the start of the string, or after a separator. */
|
|
39
38
|
const AT_COMMAND = String.raw `(?:^|[\s;&|()\x60$])`;
|
|
@@ -43,10 +42,10 @@ const AT_COMMAND = String.raw `(?:^|[\s;&|()\x60$])`;
|
|
|
43
42
|
* agent - and neither are setup and doctor.
|
|
44
43
|
*/
|
|
45
44
|
export function selfInvocation(command) {
|
|
46
|
-
const cli = new RegExp(`${AT_COMMAND}(?:npx\\s+)?turri\\s+(regenerate|
|
|
45
|
+
const cli = new RegExp(`${AT_COMMAND}(?:npx\\s+)?turri\\s+(regenerate|conform|cultivate|launch)\\b`).exec(command);
|
|
47
46
|
if (cli)
|
|
48
47
|
return cli[1];
|
|
49
|
-
const launcher = new RegExp(`(?:bin/turri\\.mjs|src/cli\\.ts)\\s+(regenerate|
|
|
48
|
+
const launcher = new RegExp(`(?:bin/turri\\.mjs|src/cli\\.ts)\\s+(regenerate|conform|cultivate|launch)\\b`).exec(command);
|
|
50
49
|
if (launcher)
|
|
51
50
|
return launcher[1];
|
|
52
51
|
// turri alone, or with options, is the conversation - where a command starts, not a word an argument names (`which turri`).
|
|
@@ -83,7 +82,7 @@ const PI_CONFIGURES = new Set([
|
|
|
83
82
|
export function askedForCommandLine(message) {
|
|
84
83
|
const text = message.toLowerCase();
|
|
85
84
|
return (/\b(headless|command[ -]line|cli|terminal|shell|in bash|via bash|through bash|npm run|nohup)\b/.test(text) ||
|
|
86
|
-
/\bturri\s+(regenerate|
|
|
85
|
+
/\bturri\s+(regenerate|conform|cultivate|launch)\b/.test(text) ||
|
|
87
86
|
/(^|\s)turri\s+-p\b/.test(text) ||
|
|
88
87
|
/(^|\s)pi\s+-p\b/.test(text));
|
|
89
88
|
}
|
|
@@ -101,11 +100,38 @@ export function refusal(what, surface) {
|
|
|
101
100
|
export const TOOLS_NOT_CLI = [
|
|
102
101
|
"<turri-tools>",
|
|
103
102
|
"In this conversation, you do your work with your tools - regenerate, conform, cultivate and the rest - which run as",
|
|
104
|
-
"background jobs the user can watch and halt. To try what is regenerated,
|
|
105
|
-
"run your own command line (turri regenerate,
|
|
103
|
+
"background jobs the user can watch and halt. To try what is regenerated, launch it - never by hand in plain_modules. Never",
|
|
104
|
+
"run your own command line (turri regenerate, conform, cultivate, launch, turri itself; npm run",
|
|
106
105
|
"regenerate and the like) or start another pi through bash:",
|
|
107
106
|
"that is a separate headless run the user cannot see or stop. Only when the user explicitly asks for the",
|
|
108
107
|
"command line, run it. Configuring pi itself - turri install, update, remove, list; pi install, update, list, config, auth; or its settings files -",
|
|
109
108
|
"is fine; it starts no agent.",
|
|
110
109
|
"</turri-tools>",
|
|
111
110
|
].join("\n");
|
|
111
|
+
/** What a skill's agent is told when its shell would run turri or another pi. */
|
|
112
|
+
export function skillRefusal(what) {
|
|
113
|
+
return (`Not run: that starts ${what === "pi" ? "another agent" : `turri ${what}`} from the shell - a separate, headless run outside the person's session, ` +
|
|
114
|
+
"its pulses and /halt, writing the same codebases as the work loop. A skill starts no pulse: finish your own work, and say in what you " +
|
|
115
|
+
"hand back what should run next - the conversation runs it.");
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A skill's shell: pi's bash in the project, refusing what its agent never runs there - turri or another pi again
|
|
119
|
+
* (selfInvocation), and a change to the machine's toolchains or settings (machineChange). The conversation's own bash is
|
|
120
|
+
* held to the same by its tool_call guard; a skill runs in a session of its own, which that guard does not see.
|
|
121
|
+
*/
|
|
122
|
+
export function skillShell(cwd) {
|
|
123
|
+
const bash = createBashToolDefinition(cwd);
|
|
124
|
+
return {
|
|
125
|
+
...bash,
|
|
126
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
127
|
+
const command = String(params.command ?? "");
|
|
128
|
+
const what = selfInvocation(command);
|
|
129
|
+
if (what !== undefined)
|
|
130
|
+
throw new Error(skillRefusal(what));
|
|
131
|
+
const changes = machineChange(command);
|
|
132
|
+
if (changes !== undefined)
|
|
133
|
+
throw new Error(machineChangeReason(changes));
|
|
134
|
+
return bash.execute(toolCallId, params, signal, onUpdate, ctx);
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
package/dist/sentinel-check.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SentinelCheck } from "./notice.ts";
|
|
2
2
|
/**
|
|
3
|
-
* A check a host asks the sentinel for (docs/sentinel.md): functional specs of one module, tested in
|
|
4
|
-
* its own codebase's
|
|
3
|
+
* A check a host asks the sentinel for (docs/sentinel.md): functional specs of one module, tested in what is launched of
|
|
4
|
+
* it - its own codebase's code, which holds the code of every module its requires chain builds on. Refused before it is
|
|
5
5
|
* queued when there is nothing to test: a module that is not there or does not parse, a func-id it does not have, one
|
|
6
6
|
* not built in its codebase as its ***plain has it now.
|
|
7
7
|
*/
|
|
@@ -10,7 +10,7 @@ export interface CheckRequest {
|
|
|
10
10
|
module: string;
|
|
11
11
|
/**
|
|
12
12
|
* The functional specs to test, each `module:func-id` - of the module, or of any module its requires chain builds on,
|
|
13
|
-
* whose code its
|
|
13
|
+
* whose code its codebase holds. A bare func-id is the module's own.
|
|
14
14
|
*/
|
|
15
15
|
funcIds: string[];
|
|
16
16
|
}
|
package/dist/sentinel-check.js
CHANGED
|
@@ -12,7 +12,7 @@ export function prepareCheck(project, request) {
|
|
|
12
12
|
if (name === "" || file === undefined)
|
|
13
13
|
return { refused: `There is no module ${name === "" ? "named" : name} in the project: no .plain file of its folder is ${name || "<module>"}.plain.` };
|
|
14
14
|
if (isImportModule(file))
|
|
15
|
-
return { refused: `${name} is an import module: it has no codebase of its own to
|
|
15
|
+
return { refused: `${name} is an import module: it has no codebase of its own to launch. Check a module that imports it.` };
|
|
16
16
|
let chain;
|
|
17
17
|
try {
|
|
18
18
|
chain = resolveRequiresChain(file, [], undefined, { allowNoFunctionalities: true });
|
|
@@ -31,13 +31,13 @@ export function prepareCheck(project, request) {
|
|
|
31
31
|
const id = colon === -1 ? funcId : funcId.slice(colon + 1).trim();
|
|
32
32
|
return { module, id, label: `${module}:${id}` };
|
|
33
33
|
});
|
|
34
|
-
// Only what its
|
|
34
|
+
// Only what its codebase holds: the module and the modules its requires chain builds on.
|
|
35
35
|
const inChain = new Map(chain.map((entry) => [entry.moduleName, entry]));
|
|
36
36
|
const outside = named.filter(({ module }) => !inChain.has(module));
|
|
37
37
|
if (outside.length > 0) {
|
|
38
38
|
const below = chain.slice(0, -1).map((entry) => entry.moduleName);
|
|
39
39
|
return {
|
|
40
|
-
refused: `Not in ${whose(name)}
|
|
40
|
+
refused: `Not in ${whose(name)} codebase: ${outside.map((spec) => spec.label).join(", ")} - ${[...new Set(outside.map((spec) => spec.module))].join(", ")} ${new Set(outside.map((spec) => spec.module)).size === 1 ? "is" : "are"} not ${name} or a module its requires chain builds on` +
|
|
41
41
|
`${below.length > 0 ? ` (${below.join(", ")})` : ` - it builds on none`}.`,
|
|
42
42
|
};
|
|
43
43
|
}
|
package/dist/sentinel.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { type SentinelSetting } from "./config.ts";
|
|
3
3
|
import { type Job } from "./regenerate/jobs.ts";
|
|
4
|
-
import type {
|
|
4
|
+
import type { LaunchedProcess } from "./regenerate/launch.ts";
|
|
5
|
+
import { type PulseLaunch } from "./launch-session.ts";
|
|
5
6
|
import { type Conclusion, type Notice, type NoticeInput, type SentinelCheck } from "./notice.ts";
|
|
6
7
|
import type { CheckedSpec } from "./sentinel-check.ts";
|
|
7
8
|
export * from "./notice.ts";
|
|
8
9
|
/**
|
|
9
10
|
* The sentinel: a chat of the session's own that every finished pulse goes to (docs/sentinel.md). It checks how each
|
|
10
|
-
* pulse went - and, with `
|
|
11
|
+
* pulse went - and, with `launch-after-pulse` on, tests what was launched - finds out why when something is wrong, and
|
|
11
12
|
* puts it to the person as a notice in the chat they look at, with what they can do about it. It changes nothing: its
|
|
12
13
|
* file tools only read, its shell runs with the project read only, and it has none of the tools that change ***plain or
|
|
13
14
|
* start work. The chat the person talks to is never interrupted for a pulse that went well.
|
|
@@ -32,37 +33,41 @@ export declare function keepGuidance(cwd: string, text: string): void;
|
|
|
32
33
|
export declare function pulseEndsBlock(sentinel: boolean): string;
|
|
33
34
|
/**
|
|
34
35
|
* What the chat the person is in is told of a pulse that landed, with the sentinel on: that it landed, what the sentinel
|
|
35
|
-
* does with it - and to tell the person so, and do nothing else about it.
|
|
36
|
+
* does with it - and to tell the person so, and do nothing else about it. `launching`: launch-after-pulse is on - it is
|
|
37
|
+
* launched in the background, and the sentinel tests it once it runs.
|
|
36
38
|
*/
|
|
37
|
-
export declare function landedNote(job: Job,
|
|
39
|
+
export declare function landedNote(job: Job, options?: {
|
|
38
40
|
shown?: boolean;
|
|
41
|
+
launching?: boolean;
|
|
39
42
|
}): string;
|
|
40
43
|
/**
|
|
41
44
|
* Its identity and its task, in its system prompt in place of the conversation's. A host's `surface` - where the person
|
|
42
|
-
* watches it, in the host's words - stands in place of their not watching, and has it try
|
|
45
|
+
* watches it, in the host's words - stands in place of their not watching, and has it try what is launched with the host's tools.
|
|
43
46
|
*/
|
|
44
47
|
export declare function sentinelPrompt(cwd: string, options?: {
|
|
45
48
|
extraTools?: string[];
|
|
46
49
|
surface?: string;
|
|
47
50
|
}): string;
|
|
48
|
-
/** What the sentinel is told of one finished pulse: the ledger's facts, the chats, and what
|
|
51
|
+
/** What the sentinel is told of one finished pulse: the ledger's facts, the chats, and what runs of it. */
|
|
49
52
|
export declare function sentinelBrief(job: Job, context: {
|
|
50
53
|
project: string;
|
|
51
54
|
asked?: string;
|
|
52
55
|
focused?: string;
|
|
53
|
-
|
|
54
|
-
releaseAfterPulse: boolean;
|
|
56
|
+
launch: PulseLaunch;
|
|
55
57
|
reaction: string;
|
|
56
58
|
}): string;
|
|
57
59
|
/**
|
|
58
|
-
* What the sentinel is told of a host's check:
|
|
59
|
-
* specs to test, with what each says and its scenarios, as turri reads them now.
|
|
60
|
+
* What the sentinel is told of a host's check: what is launched of the module - what runs, and where - and the
|
|
61
|
+
* functional specs to test, with what each says and its scenarios, as turri reads them now.
|
|
60
62
|
*/
|
|
61
63
|
export declare function sentinelCheckBrief(check: SentinelCheck, context: {
|
|
62
64
|
specs: CheckedSpec[];
|
|
63
|
-
|
|
65
|
+
running: LaunchedProcess[];
|
|
64
66
|
commit?: string;
|
|
65
|
-
|
|
67
|
+
failed?: {
|
|
68
|
+
id: string;
|
|
69
|
+
summary?: string;
|
|
70
|
+
};
|
|
66
71
|
focused?: string;
|
|
67
72
|
}): string;
|
|
68
73
|
/**
|
package/dist/sentinel.js
CHANGED
|
@@ -11,11 +11,12 @@ import { formatDuration, pulseName } from "./regenerate/jobs.js";
|
|
|
11
11
|
import { readLedger } from "./regenerate/ledger.js";
|
|
12
12
|
import { describePulseView, pulseView } from "./regenerate/ledger-view.js";
|
|
13
13
|
import { MODULES_DIR, ensureInScratch } from "./regenerate/paths.js";
|
|
14
|
+
import { whatRuns } from "./launch-session.js";
|
|
14
15
|
import { SENTINEL, SENTINEL_START, wentWrong } from "./notice.js";
|
|
15
16
|
export * from "./notice.js";
|
|
16
17
|
/**
|
|
17
18
|
* The sentinel: a chat of the session's own that every finished pulse goes to (docs/sentinel.md). It checks how each
|
|
18
|
-
* pulse went - and, with `
|
|
19
|
+
* pulse went - and, with `launch-after-pulse` on, tests what was launched - finds out why when something is wrong, and
|
|
19
20
|
* puts it to the person as a notice in the chat they look at, with what they can do about it. It changes nothing: its
|
|
20
21
|
* file tools only read, its shell runs with the project read only, and it has none of the tools that change ***plain or
|
|
21
22
|
* start work. The chat the person talks to is never interrupted for a pulse that went well.
|
|
@@ -35,14 +36,14 @@ export function sentinelSetting(cwd) {
|
|
|
35
36
|
* - and whether to start it.
|
|
36
37
|
*/
|
|
37
38
|
export function sentinelStartNotice(about, cwd) {
|
|
38
|
-
let
|
|
39
|
+
let launched = false;
|
|
39
40
|
try {
|
|
40
|
-
|
|
41
|
+
launched = readProjectConfig(cwd).launchAfterPulse === true;
|
|
41
42
|
}
|
|
42
43
|
catch {
|
|
43
|
-
/* a config that cannot be read
|
|
44
|
+
/* a config that cannot be read launches nothing */
|
|
44
45
|
}
|
|
45
|
-
const what = `a background tab that reviews each finished pulse${
|
|
46
|
+
const what = `a background tab that reviews each finished pulse${launched ? " and tries to use what was launched" : ""}`;
|
|
46
47
|
if (!("kind" in about)) {
|
|
47
48
|
return {
|
|
48
49
|
kind: "sentinel-start",
|
|
@@ -119,7 +120,7 @@ export function pulseEndsBlock(sentinel) {
|
|
|
119
120
|
return sentinel
|
|
120
121
|
? [
|
|
121
122
|
"<pulse-ends>",
|
|
122
|
-
"The sentinel - a chat of my own, beside this one - checks every pulse that finishes and tests what was
|
|
123
|
+
"The sentinel - a chat of my own, beside this one - checks every pulse that finishes and tests what was launched.",
|
|
123
124
|
"When a pulse lands, the chat the person is in is told, to tell them it landed and what the sentinel does with it -",
|
|
124
125
|
"and nothing more: the pulse is the sentinel's. A pulse that went wrong you are not told of. What needs the person, the",
|
|
125
126
|
"sentinel puts to them as a notice in the chat they are in: what is wrong, and what can be done. When they accept",
|
|
@@ -130,11 +131,11 @@ export function pulseEndsBlock(sentinel) {
|
|
|
130
131
|
}
|
|
131
132
|
/**
|
|
132
133
|
* What the chat the person is in is told of a pulse that landed, with the sentinel on: that it landed, what the sentinel
|
|
133
|
-
* does with it - and to tell the person so, and do nothing else about it.
|
|
134
|
+
* does with it - and to tell the person so, and do nothing else about it. `launching`: launch-after-pulse is on - it is
|
|
135
|
+
* launched in the background, and the sentinel tests it once it runs.
|
|
134
136
|
*/
|
|
135
|
-
export function landedNote(job,
|
|
136
|
-
const
|
|
137
|
-
const where = released.map((item) => `${item.name} at ${item.url ?? item.command}`).join(", ");
|
|
137
|
+
export function landedNote(job, options = {}) {
|
|
138
|
+
const launching = options.launching === true;
|
|
138
139
|
// The host showed the person the pulse's end itself: what happened, for when they ask - nobody is told anything now.
|
|
139
140
|
if (options.shown === true) {
|
|
140
141
|
return [
|
|
@@ -142,7 +143,7 @@ export function landedNote(job, released, options = {}) {
|
|
|
142
143
|
"",
|
|
143
144
|
(job.report ?? "").trim(),
|
|
144
145
|
"",
|
|
145
|
-
`The sentinel - a chat of my own beside this one -
|
|
146
|
+
`The sentinel - a chat of my own beside this one - checks it${launching ? ", once it is launched, in the background, and tests what runs" : ""}; the person was shown that it landed. The pulse is the sentinel's: nothing is to be tested, launched, opened or run for it here.`,
|
|
146
147
|
].join("\n");
|
|
147
148
|
}
|
|
148
149
|
return [
|
|
@@ -150,14 +151,14 @@ export function landedNote(job, released, options = {}) {
|
|
|
150
151
|
"",
|
|
151
152
|
(job.report ?? "").trim(),
|
|
152
153
|
"",
|
|
153
|
-
|
|
154
|
+
`${launching ? "It is being launched in the background, and the sentinel" : "The sentinel"} - a chat of my own beside this one - checks it${launching ? " and tests what runs once it is up" : " now"}. If it finds something wrong, it puts it to the person in the chat they are in, with what can be done; when it is done, you are told.`,
|
|
154
155
|
"",
|
|
155
|
-
`Tell the person, in a line or two, what landed and that the sentinel is checking it${
|
|
156
|
+
`Tell the person, in a line or two, what landed and that the sentinel is checking it${launching ? " - and tests it once it is launched" : ""}. Do nothing else about it: the pulse is the sentinel's now. Do not test it, launch it, open it, run anything for it, or start other work because of it - whatever the project's guidance says to do when a pulse finishes.`,
|
|
156
157
|
].join("\n");
|
|
157
158
|
}
|
|
158
159
|
/**
|
|
159
160
|
* Its identity and its task, in its system prompt in place of the conversation's. A host's `surface` - where the person
|
|
160
|
-
* watches it, in the host's words - stands in place of their not watching, and has it try
|
|
161
|
+
* watches it, in the host's words - stands in place of their not watching, and has it try what is launched with the host's tools.
|
|
161
162
|
*/
|
|
162
163
|
export function sentinelPrompt(cwd, options = {}) {
|
|
163
164
|
const guidance = readGuidance(cwd);
|
|
@@ -171,19 +172,24 @@ export function sentinelPrompt(cwd, options = {}) {
|
|
|
171
172
|
"asks you to check. This conversation is for the pulse, or the check, in the message turri writes first. For a pulse:",
|
|
172
173
|
"what it was, how it ended,",
|
|
173
174
|
...(surface === ""
|
|
174
|
-
? ["its ***plain diff, its log, and what was
|
|
175
|
+
? ["its ***plain diff, its log, and what was launched. The person does not watch you: they are in another chat, and", "hear from you only through notify_person."]
|
|
175
176
|
: [
|
|
176
|
-
"its ***plain diff, its log, and what was
|
|
177
|
+
"its ***plain diff, its log, and what was launched. The person can watch you try it, where the host shows it;",
|
|
177
178
|
"they talk to you in another chat, and hear what you find only through notify_person.",
|
|
178
179
|
]),
|
|
179
180
|
"",
|
|
180
181
|
"For the pulse:",
|
|
181
|
-
"1. Check how it went, from what turri tells you - and, when that is not enough,
|
|
182
|
-
"
|
|
183
|
-
"2. When it was
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
182
|
+
"1. Check how it went, from what turri tells you - and, when that is not enough, the pulse in full (pulses with its id),",
|
|
183
|
+
" its log, and the code and the ***plain, which you read.",
|
|
184
|
+
"2. When it was launched (the message says so - launch-after-pulse is on), test it: it is running where the message",
|
|
185
|
+
" says - a launch that holds the pulse's commit, and the pulses after it the message names. Test what the message",
|
|
186
|
+
" says this pulse changed - what a later pulse changed again is that pulse's to test. How far you test is yours to",
|
|
187
|
+
" judge, from what the pulse changed and what the ***plain says",
|
|
188
|
+
" it should do: that it came up, answers, and does what its ***plain diff says it now does. Where the ***plain picks",
|
|
189
|
+
" one way among several - which of a tie comes first, how a default is chosen - try an input on which the ways give",
|
|
190
|
+
" different answers, so a pass shows the ***plain's way and no other: a tie whose first word is also first",
|
|
191
|
+
" alphabetically tells \"first in the file\" from nothing.",
|
|
192
|
+
"3. When something is wrong - the pulse failed or stopped, it did not pass, the launch did not come up, the software",
|
|
187
193
|
" does not do what its ***plain says - find out why. Then:",
|
|
188
194
|
" - When it is the project's tooling - a testing script, or where config.turri.yaml says the scripts are and which",
|
|
189
195
|
" toolchain folders the agents may read (toolchains:) - fix it yourself, with edit: a script calling python3 where",
|
|
@@ -198,19 +204,19 @@ export function sentinelPrompt(cwd, options = {}) {
|
|
|
198
204
|
" the person runs themselves (`brew install node`), and make the action resuming once they have.",
|
|
199
205
|
" When it is a gap in the ***plain the build settled with an assumption - something the person may reasonably leave",
|
|
200
206
|
" as it is - say so with ignorable: the gap in the summary, what the build does in the evidence. Never for",
|
|
201
|
-
" something broken, a pulse that went wrong, or a
|
|
207
|
+
" something broken, a pulse that went wrong, or a launch that did not come up.",
|
|
202
208
|
"4. When all is well, notify no one.",
|
|
203
209
|
"5. Last, call conclude once for it - holds or wrong, and in a line or two what you checked and what you found:",
|
|
204
210
|
" the chat the person is in is told, whether all is well or not. Then say the same here, in a line or two.",
|
|
205
211
|
"",
|
|
206
|
-
"For a check: the person picked functional specs of a module for you to test in
|
|
212
|
+
"For a check: the person picked functional specs of a module for you to test in what is launched of it, which runs where the",
|
|
207
213
|
"message says. Test those - what each says and its scenarios - not the module's other functional specs. Notify the",
|
|
208
214
|
"person of what does not do what its ***plain says, as for a pulse, and call conclude once for the check, by its id.",
|
|
209
215
|
"",
|
|
210
216
|
"You fix the project's tooling and nothing else. Your file tools read the whole project; write and edit reach only the",
|
|
211
217
|
"testing scripts and config.turri.yaml - and in it only where the scripts are, and toolchains:. Your shell runs with",
|
|
212
|
-
"the project read only. You never change ***plain - it is the person's intent, never yours to fix - and never steer,",
|
|
213
|
-
"
|
|
218
|
+
"the project read only; the files you try a launch with go in $TMPDIR - /tmp is outside what it may write. You never change ***plain - it is the person's intent, never yours to fix - and never steer,",
|
|
219
|
+
"launch, or regenerate but by resume after a fix of yours. You install nothing on this machine and change none of",
|
|
214
220
|
"its settings, nor the person's shell - under no circumstances: that is always the person's, said in a notice. You",
|
|
215
221
|
"never ask the person questions - a notice is how you reach them.",
|
|
216
222
|
"",
|
|
@@ -225,7 +231,7 @@ export function sentinelPrompt(cwd, options = {}) {
|
|
|
225
231
|
"<surface>",
|
|
226
232
|
surface,
|
|
227
233
|
"</surface>",
|
|
228
|
-
`Try
|
|
234
|
+
`Try what is launched with ${theirs}, where the person can watch. Keep your shell for what those cannot show - logs, exit`,
|
|
229
235
|
"codes, files.",
|
|
230
236
|
]
|
|
231
237
|
: tools.length > 0
|
|
@@ -235,7 +241,7 @@ export function sentinelPrompt(cwd, options = {}) {
|
|
|
235
241
|
...(guidance !== "" ? ["", "<guidance>", "What the person told you to keep in mind:", guidance, "</guidance>"] : []),
|
|
236
242
|
].join("\n");
|
|
237
243
|
}
|
|
238
|
-
/** What the sentinel is told of one finished pulse: the ledger's facts, the chats, and what
|
|
244
|
+
/** What the sentinel is told of one finished pulse: the ledger's facts, the chats, and what runs of it. */
|
|
239
245
|
export function sentinelBrief(job, context) {
|
|
240
246
|
const view = (() => {
|
|
241
247
|
try {
|
|
@@ -266,13 +272,8 @@ export function sentinelBrief(job, context) {
|
|
|
266
272
|
lines.push("", "Its ***plain diff:", job.diff.trimEnd());
|
|
267
273
|
if (job.logFile !== undefined)
|
|
268
274
|
lines.push("", `Its log: ${job.logFile}`);
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
lines.push("", "It was released, as its last stage (release-after-pulse). What runs now:", ...whatRuns(context.released), "Test it.");
|
|
272
|
-
}
|
|
273
|
-
else if (job.status === "succeeded" && !didNotPass(job)) {
|
|
274
|
-
lines.push("", context.releaseAfterPulse ? "Nothing was released after it." : "release-after-pulse is off: nothing was released, and you test nothing running - check the pulse alone.");
|
|
275
|
-
}
|
|
275
|
+
if (job.status === "succeeded" && !didNotPass(job))
|
|
276
|
+
lines.push("", ...launchLines(job, context.launch));
|
|
276
277
|
if (job.specConflict !== undefined) {
|
|
277
278
|
lines.push("", "It stopped on two functional specs that contradict each other: turri has put that to the person itself. Notify no one about it.");
|
|
278
279
|
}
|
|
@@ -282,23 +283,51 @@ export function sentinelBrief(job, context) {
|
|
|
282
283
|
lines.push("", `When you are done with it, call conclude for ${job.id} - whether all is well or not.`);
|
|
283
284
|
return lines.join("\n");
|
|
284
285
|
}
|
|
285
|
-
/** What runs
|
|
286
|
-
function
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
/** What runs for a pulse that landed, as the sentinel is told it: the launch that holds its commit, or why there is none to test. */
|
|
287
|
+
function launchLines(job, launch) {
|
|
288
|
+
const spec = (each) => `${each.module}:${each.funcId}`;
|
|
289
|
+
if (launch.off === true)
|
|
290
|
+
return [`${launch.commit !== undefined ? `Its commit is ${launch.commit.slice(0, 7)}. ` : ""}launch-after-pulse is off: nothing was launched, and you test nothing running - check the pulse alone.`];
|
|
291
|
+
if (launch.commit === undefined)
|
|
292
|
+
return ["Nothing was launched for it: turri has no commit it landed - check the pulse alone."];
|
|
293
|
+
const commit = launch.commit.slice(0, 7);
|
|
294
|
+
if (launch.notAsked !== undefined)
|
|
295
|
+
return [`Its commit is ${commit}. Its launch could not be asked for: ${launch.notAsked}`, "That is what you find out about: the launch did not come up."];
|
|
296
|
+
if (launch.stopped === true || launch.launch === undefined)
|
|
297
|
+
return [`Its commit is ${commit}. The person stopped its launch: nothing of it runs - check the pulse alone.`];
|
|
298
|
+
const what = launch.launch;
|
|
299
|
+
const later = launch.later.map((other) => `${other.id} (${pulseName(other)})`);
|
|
300
|
+
const lines = [
|
|
301
|
+
`Its commit is ${commit}. It was launched in the background (launch-after-pulse): what runs is ${what.codebase} at ${what.short} (${what.id}), which holds it${later.length > 0 ? ` and the pulses that landed after it - ${later.join(", ")}` : ""}.`,
|
|
302
|
+
];
|
|
303
|
+
if (what.status === "failed") {
|
|
304
|
+
lines.push(`That launch did not come up: ${what.summary ?? "the launch agent did not say why"}`, "That is what you find out about: the launch did not come up. Test nothing in its place - never the code in plain_modules, where a pulse may be writing, nor a server of your own: what would pass there is not what the person tries.");
|
|
305
|
+
return lines;
|
|
306
|
+
}
|
|
307
|
+
lines.push("What runs now:", ...whatRuns(launch.running));
|
|
308
|
+
if (launch.laterSpecs.length > 0) {
|
|
309
|
+
lines.push(`Test what this pulse changed - but not ${launch.laterSpecs.map(spec).join(", ")}: a later pulse changed ${launch.laterSpecs.length === 1 ? "it" : "them"} again, and its check tests ${launch.laterSpecs.length === 1 ? "it" : "them"}.`);
|
|
310
|
+
}
|
|
311
|
+
else
|
|
312
|
+
lines.push("Test what this pulse changed.");
|
|
313
|
+
return lines;
|
|
290
314
|
}
|
|
291
315
|
/**
|
|
292
|
-
* What the sentinel is told of a host's check:
|
|
293
|
-
* specs to test, with what each says and its scenarios, as turri reads them now.
|
|
316
|
+
* What the sentinel is told of a host's check: what is launched of the module - what runs, and where - and the
|
|
317
|
+
* functional specs to test, with what each says and its scenarios, as turri reads them now.
|
|
294
318
|
*/
|
|
295
319
|
export function sentinelCheckBrief(check, context) {
|
|
296
320
|
const lines = [
|
|
297
|
-
`Check ${check.id}: the person asked you to check ${check.funcIds.length === 1 ? "a functional spec" : `${check.funcIds.length} functional specs`} of ${check.module}, in
|
|
321
|
+
`Check ${check.id}: the person asked you to check ${check.funcIds.length === 1 ? "a functional spec" : `${check.funcIds.length} functional specs`} of ${check.module}, in what is launched of it.`,
|
|
298
322
|
];
|
|
299
323
|
if (context.focused !== undefined)
|
|
300
324
|
lines.push(`The person is in the chat "${context.focused}": a notice goes there.`);
|
|
301
|
-
lines.push("",
|
|
325
|
+
lines.push("", `What is launched of ${check.module} holds its code and that of every module its requires chain builds on${context.commit !== undefined ? `, at its commit ${context.commit}` : ""} - a commit that landed whole, never what a pulse is writing now.${context.failed !== undefined ? "" : " What runs now:"}`, ...(context.failed !== undefined
|
|
326
|
+
? [
|
|
327
|
+
`Its last launch, ${context.failed.id}, did not come up: ${context.failed.summary ?? "the launch agent did not say why"}`,
|
|
328
|
+
"That is what you find out about: the launch did not come up. Test nothing in its place - never the code in plain_modules, where a pulse may be writing, nor a server of your own: what would pass there is not what the person tries.",
|
|
329
|
+
]
|
|
330
|
+
: whatRuns(context.running)), "", `Test these functional specs of ${check.module} - only these, not its others, though they run too:`);
|
|
302
331
|
for (const spec of context.specs) {
|
|
303
332
|
lines.push("", `# ${spec.funcId}`, spec.text);
|
|
304
333
|
for (const [title, scenarios] of [["Conformance scenarios", spec.conformance], ["Acceptance scenarios", spec.acceptance]]) {
|
|
@@ -316,7 +345,7 @@ export function sentinelCheckBrief(check, context) {
|
|
|
316
345
|
* The tools the sentinel's agent may call: what reads, write and edit for the project's tooling alone, resume, its
|
|
317
346
|
* notices and its guidance - and what a host gives it.
|
|
318
347
|
*/
|
|
319
|
-
export const SENTINEL_TOOLS = ["read", "ls", "grep", "find", "write", "edit", "bash", "read_output", "
|
|
348
|
+
export const SENTINEL_TOOLS = ["read", "ls", "grep", "find", "write", "edit", "bash", "read_output", "pulses", "parse", "doctor", "web_search", "web_fetch", "resume", "notify_person", "conclude", "keep_guidance"];
|
|
320
349
|
/** A testing script by its name - `run_unittests_python.sh`, `prepare_environment_node.sh` - and a config file of turri's. */
|
|
321
350
|
const SCRIPT_FILE = /^(run_|prepare_environment).*\.(sh|ps1|bat|cmd)$/;
|
|
322
351
|
const CONFIG_FILE_NAME = /^config\.turri(\..+)?\.yaml$/;
|
|
@@ -439,7 +468,7 @@ export function notifyTool(notify) {
|
|
|
439
468
|
ignorable: Type.Optional(Type.Boolean({
|
|
440
469
|
description: "true when the person may reasonably leave it as the build has it, for good: chiefly a gap in the ***plain the build settled with an " +
|
|
441
470
|
"assumption - then say the gap in the summary and what the build does in the evidence (the ***plain does not say what happens to " +
|
|
442
|
-
"passwords over 72 bytes; the build refuses them with 422). Never for something broken, a pulse that went wrong, or a
|
|
471
|
+
"passwords over 72 bytes; the build refuses them with 422). Never for something broken, a pulse that went wrong, or a launch that did not come up.",
|
|
443
472
|
})),
|
|
444
473
|
}),
|
|
445
474
|
async execute(_id, params) {
|