@turri-dev/cli 0.4.2-next.a6867e8 → 0.4.3-next.3fc888b
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 +1 -0
- package/dist/background-skills.d.ts +4 -1
- package/dist/background-skills.js +9 -1
- package/dist/capture/agents.d.ts +391 -0
- package/dist/capture/agents.js +338 -0
- package/dist/capture/area.d.ts +58 -0
- package/dist/capture/area.js +197 -0
- package/dist/capture/assemble.d.ts +122 -0
- package/dist/capture/assemble.js +452 -0
- package/dist/capture/capture.d.ts +116 -0
- package/dist/capture/capture.js +1281 -0
- package/dist/capture/chat.d.ts +29 -0
- package/dist/capture/chat.js +94 -0
- package/dist/capture/checks.d.ts +142 -0
- package/dist/capture/checks.js +643 -0
- package/dist/capture/config.d.ts +13 -0
- package/dist/capture/config.js +60 -0
- package/dist/capture/interface.d.ts +71 -0
- package/dist/capture/interface.js +199 -0
- package/dist/capture/map.d.ts +58 -0
- package/dist/capture/map.js +530 -0
- package/dist/capture/plan.d.ts +8 -0
- package/dist/capture/plan.js +13 -0
- package/dist/capture/progress.d.ts +109 -0
- package/dist/capture/progress.js +240 -0
- package/dist/capture/report.d.ts +75 -0
- package/dist/capture/report.js +268 -0
- package/dist/capture/scripts.d.ts +26 -0
- package/dist/capture/scripts.js +33 -0
- package/dist/capture/state.d.ts +299 -0
- package/dist/capture/state.js +43 -0
- package/dist/capture/trial.d.ts +34 -0
- package/dist/capture/trial.js +89 -0
- package/dist/capture-cli.d.ts +1 -0
- package/dist/capture-cli.js +77 -0
- package/dist/chat-commands.d.ts +2 -10
- package/dist/chat-commands.js +3 -57
- package/dist/chat-tab-header.d.ts +15 -0
- package/dist/chat-tab-header.js +78 -0
- package/dist/chat-tabs.d.ts +26 -0
- package/dist/chat-tabs.js +100 -0
- package/dist/chat-terminal.js +57 -8
- package/dist/chat-waiting.d.ts +4 -1
- package/dist/chat-waiting.js +7 -4
- package/dist/chats.d.ts +12 -7
- package/dist/chats.js +35 -21
- package/dist/cli.js +32 -14
- package/dist/config-edit.js +4 -2
- package/dist/config.d.ts +15 -2
- package/dist/config.js +62 -4
- package/dist/extension.d.ts +1 -0
- package/dist/extension.js +262 -136
- package/dist/identity.js +3 -2
- package/dist/init-config.js +2 -0
- package/dist/loop-cli.js +5 -1
- package/dist/loop-tools.d.ts +2 -3
- package/dist/loop-tools.js +12 -13
- package/dist/new-project.d.ts +5 -0
- package/dist/new-project.js +11 -0
- package/dist/pi-launch.js +2 -0
- package/dist/pi-themes.d.ts +3 -0
- package/dist/pi-themes.js +21 -0
- package/dist/pi.js +2 -2
- package/dist/plain-code-blocks.d.ts +14 -0
- package/dist/plain-code-blocks.js +56 -0
- package/dist/pointer-hover.d.ts +12 -0
- package/dist/pointer-hover.js +48 -0
- package/dist/question-dialog.d.ts +5 -0
- package/dist/question-dialog.js +20 -1
- package/dist/regenerate/chunk-plan.d.ts +2 -11
- package/dist/regenerate/chunk-plan.js +9 -20
- package/dist/regenerate/command-check.d.ts +9 -0
- package/dist/regenerate/command-check.js +163 -14
- package/dist/regenerate/job-panel.d.ts +5 -107
- package/dist/regenerate/job-panel.js +4 -289
- package/dist/regenerate/jobs-tree.d.ts +1 -0
- package/dist/regenerate/jobs-tree.js +5 -1
- package/dist/regenerate/loop.d.ts +6 -14
- package/dist/regenerate/loop.js +51 -35
- package/dist/regenerate/side-panel.d.ts +6 -1
- package/dist/regenerate/side-panel.js +158 -22
- package/dist/regenerate/spec-map-view.d.ts +11 -3
- package/dist/regenerate/spec-map-view.js +22 -2
- package/dist/regenerate/test-scripts.d.ts +8 -0
- package/dist/regenerate/test-scripts.js +20 -5
- package/dist/reopen.d.ts +29 -0
- package/dist/reopen.js +47 -0
- package/dist/resume-line.d.ts +4 -1
- package/dist/resume-line.js +5 -2
- package/dist/sentinel-chat.js +7 -2
- package/dist/sentinel.d.ts +1 -1
- package/dist/sentinel.js +4 -2
- package/dist/setup.js +9 -1
- package/dist/terminal-notifications.d.ts +31 -0
- package/dist/terminal-notifications.js +134 -0
- package/docs/README.md +2 -0
- package/docs/capture.md +207 -0
- package/docs/chats.md +8 -7
- package/docs/config.md +18 -3
- package/docs/development.md +4 -1
- package/docs/hosting.md +2 -2
- package/docs/launch.md +2 -2
- package/docs/regenerating.md +9 -8
- package/docs/sandbox.md +3 -1
- package/docs/sentinel.md +11 -11
- package/docs/skills-and-gates.md +1 -1
- package/docs/theming.md +3 -3
- package/docs/using.md +12 -5
- package/genome/capture/capture.md +26 -0
- package/genome/capture/check-conventions.md +5 -0
- package/genome/capture/check-reference.md +11 -0
- package/genome/capture/compact.md +7 -0
- package/genome/capture/concepts.md +3 -0
- package/genome/capture/divide.md +9 -0
- package/genome/capture/feature.md +45 -0
- package/genome/capture/interface.md +9 -0
- package/genome/capture/modules.md +23 -0
- package/genome/capture/outline.md +11 -0
- package/genome/capture/readability.md +12 -0
- package/genome/capture/reference.md +10 -0
- package/genome/capture/split.md +9 -0
- package/genome/capture/survey.md +37 -0
- package/genome/capture/trial.md +18 -0
- package/genome/capture/verify.md +7 -0
- package/genome/rules/turri-regeneration.md +2 -2
- package/package.json +3 -3
- package/dist/regenerate/steer.d.ts +0 -34
- package/dist/regenerate/steer.js +0 -91
|
@@ -67,7 +67,23 @@ export function tabBar(pages, shown, width, style, now) {
|
|
|
67
67
|
if (from > 0 && visibleWidth(lineOf(from - 1, to)) <= width)
|
|
68
68
|
(from -= 1), (widened = true);
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
const full = lineOf(from, to);
|
|
71
|
+
const end = visibleWidth(full) > width ? Math.max(0, width - 1) : width;
|
|
72
|
+
const targets = [];
|
|
73
|
+
let x = 0;
|
|
74
|
+
const target = (text, index) => {
|
|
75
|
+
const next = x + visibleWidth(text);
|
|
76
|
+
if (x < end && pages[index])
|
|
77
|
+
targets.push({ x, end: Math.min(next, end), page: pages[index] });
|
|
78
|
+
x = next + 2;
|
|
79
|
+
};
|
|
80
|
+
if (from > 0)
|
|
81
|
+
target(`‹ ${from}`, from - 1);
|
|
82
|
+
for (let i = from; i < to; i++)
|
|
83
|
+
target(tabs[i] ?? "", i);
|
|
84
|
+
if (to < tabs.length)
|
|
85
|
+
target(`${tabs.length - to} ›`, to);
|
|
86
|
+
return { line: truncateToWidth(full, width, "…"), targets };
|
|
71
87
|
}
|
|
72
88
|
/** What needs the person - a stuck page, its `!` - in the warning colour: it waits on them, nothing is broken. */
|
|
73
89
|
const needs = (style) => style.warning ?? style.error;
|
|
@@ -427,6 +443,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
427
443
|
const lines = [];
|
|
428
444
|
const marks = [];
|
|
429
445
|
const rowStarts = [];
|
|
446
|
+
const labelHeights = [];
|
|
430
447
|
const add = (line, mark) => {
|
|
431
448
|
lines.push(line);
|
|
432
449
|
marks.push(mark);
|
|
@@ -455,6 +472,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
455
472
|
rowStarts.push(lines.length);
|
|
456
473
|
const text = `${INDENT.repeat(row.depth + 1)}${row.label}`;
|
|
457
474
|
add(`${pointer}${here ? style.heading(text) : style.muted(text)}`);
|
|
475
|
+
labelHeights.push(0); // A heading, with nothing to open.
|
|
458
476
|
underImport = true;
|
|
459
477
|
return;
|
|
460
478
|
}
|
|
@@ -468,6 +486,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
468
486
|
const items = page.items.filter((item) => item.file === row.file);
|
|
469
487
|
const text = `${row.open ? "▾" : "▸"} from ${row.file} · ${importSummary(items)}`;
|
|
470
488
|
add(`${pointer}${INDENT.repeat(row.depth + 1)}${here ? style.heading(text) : style.muted(text)}`);
|
|
489
|
+
labelHeights.push(1);
|
|
471
490
|
underImport = true;
|
|
472
491
|
return;
|
|
473
492
|
}
|
|
@@ -516,6 +535,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
516
535
|
if (heading !== undefined)
|
|
517
536
|
for (const line of hanging(body, first, room))
|
|
518
537
|
add(`${CONTINUED}${line}`, mark);
|
|
538
|
+
labelHeights.push(lines.length - rowStarts[index]);
|
|
519
539
|
// The first item that needs the person says what for, and how to go about it - opened or closed.
|
|
520
540
|
if (page.stuck && !toldWhy && rungOf(item) === "needsYou") {
|
|
521
541
|
toldWhy = true;
|
|
@@ -540,7 +560,7 @@ export function specMapLines(pages, state, width, style, _jobs = [], now = Date.
|
|
|
540
560
|
add(`${CONTINUED}${style.muted(`… ${changed.length - 4} more - enter opens it`)}`, mark);
|
|
541
561
|
}
|
|
542
562
|
});
|
|
543
|
-
return { lines, rowStarts, rows, marks };
|
|
563
|
+
return { lines, rowStarts, labelHeights, rows, marks };
|
|
544
564
|
}
|
|
545
565
|
/** How the strip and the minimap colour a mark. */
|
|
546
566
|
function paintOf(mark, style) {
|
|
@@ -71,6 +71,9 @@ export declare function projectRootFor(plainFile: string, buildDir: string): str
|
|
|
71
71
|
*
|
|
72
72
|
* A folder holding two of a kind does not say which is meant: it is skipped, and noted, so the
|
|
73
73
|
* error that stops the build can say to name one in config.turri.yaml.
|
|
74
|
+
*
|
|
75
|
+
* Where modules have config files of their own and none applies to this one, a script one of those files names is that
|
|
76
|
+
* module's - of its stack - and never found in a folder for this one: a frontend is not tested with the backend's script.
|
|
74
77
|
*/
|
|
75
78
|
export declare function findTestScripts(root: string, plainFile?: string, buildDir?: string): TestScripts;
|
|
76
79
|
/**
|
|
@@ -85,6 +88,11 @@ export declare function staticChecksOnly(run: {
|
|
|
85
88
|
exitCode: number;
|
|
86
89
|
timedOut?: boolean;
|
|
87
90
|
}): boolean;
|
|
91
|
+
/** The skill that writes a testing script of a kind, and what the script is called in words. */
|
|
92
|
+
export declare function testingScriptSkill(kind: ScriptKind): {
|
|
93
|
+
skill: string;
|
|
94
|
+
what: string;
|
|
95
|
+
};
|
|
88
96
|
/** The kind of testing script a skill writes, by its name - one that writes none, undefined. */
|
|
89
97
|
export declare function scriptKindOfSkill(skill: string): ScriptKind | undefined;
|
|
90
98
|
/** Raised before a build starts when the script that would decide it is done is missing. */
|
|
@@ -54,12 +54,15 @@ export function projectRootFor(plainFile, buildDir) {
|
|
|
54
54
|
const index = parts.lastIndexOf("plain_modules");
|
|
55
55
|
return index > 0 ? parts.slice(0, index).join(sep) : dirname(resolve(plainFile));
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
58
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The one script of a kind in a folder, by the names the skills give them; two or more say which. What `claimed` holds -
|
|
59
|
+
* the scripts other modules' own files name - is never one of them.
|
|
60
|
+
*/
|
|
61
|
+
function onlyScriptIn(dir, kind, claimed = new Set()) {
|
|
59
62
|
if (!existsSync(dir))
|
|
60
63
|
return {};
|
|
61
64
|
const candidates = readdirSync(dir)
|
|
62
|
-
.filter((name) => (kind === "prepare" ? PREPARE_NAME.test(name) : scriptKind(name) === kind) && isFile(join(dir, name)))
|
|
65
|
+
.filter((name) => (kind === "prepare" ? PREPARE_NAME.test(name) : scriptKind(name) === kind) && isFile(join(dir, name)) && !claimed.has(resolve(dir, name)))
|
|
63
66
|
.sort();
|
|
64
67
|
if (candidates.length === 1)
|
|
65
68
|
return { path: join(dir, candidates[0]) };
|
|
@@ -79,6 +82,9 @@ function onlyScriptIn(dir, kind) {
|
|
|
79
82
|
*
|
|
80
83
|
* A folder holding two of a kind does not say which is meant: it is skipped, and noted, so the
|
|
81
84
|
* error that stops the build can say to name one in config.turri.yaml.
|
|
85
|
+
*
|
|
86
|
+
* Where modules have config files of their own and none applies to this one, a script one of those files names is that
|
|
87
|
+
* module's - of its stack - and never found in a folder for this one: a frontend is not tested with the backend's script.
|
|
82
88
|
*/
|
|
83
89
|
export function findTestScripts(root, plainFile, buildDir) {
|
|
84
90
|
const found = {};
|
|
@@ -89,6 +95,11 @@ export function findTestScripts(root, plainFile, buildDir) {
|
|
|
89
95
|
const file = own !== undefined ? `${moduleConfigFileIn(root, own)} (over ${projectConfigFile(root)})` : projectConfigFile(root);
|
|
90
96
|
// Modules with files of their own, none of them this one's: its scripts are likely named in theirs.
|
|
91
97
|
const others = own === undefined ? moduleConfigsOf(root) : [];
|
|
98
|
+
// What their files name is theirs: never this module's, found in a folder.
|
|
99
|
+
const claimed = new Set(others.flatMap((each) => {
|
|
100
|
+
const theirs = readProjectConfig(root, each);
|
|
101
|
+
return [theirs.unittestsScript, theirs.conformanceTestsScript, theirs.prepareEnvironmentScript].flatMap((named) => (named !== undefined ? [resolve(root, named.trim())] : []));
|
|
102
|
+
}));
|
|
92
103
|
// Where a script is named: the module's own file - or, where modules have their own, the one of the module that builds it.
|
|
93
104
|
const nameIn = own !== undefined
|
|
94
105
|
? moduleConfigFileIn(root, own)
|
|
@@ -114,7 +125,7 @@ export function findTestScripts(root, plainFile, buildDir) {
|
|
|
114
125
|
}
|
|
115
126
|
}
|
|
116
127
|
for (const dir of [root, join(root, SCRIPTS_DIR)]) {
|
|
117
|
-
const { path, several } = onlyScriptIn(dir, kind);
|
|
128
|
+
const { path, several } = onlyScriptIn(dir, kind, claimed);
|
|
118
129
|
if (path !== undefined) {
|
|
119
130
|
found[kind] = path;
|
|
120
131
|
break;
|
|
@@ -137,7 +148,7 @@ export function findTestScripts(root, plainFile, buildDir) {
|
|
|
137
148
|
if (preparePath !== undefined)
|
|
138
149
|
notes.prepare = `${file} names ${prepareNamed.trim()} as the ${CONFIG_KEYS.prepareEnvironmentScript}, and there is no such file.`;
|
|
139
150
|
for (const dir of [root, join(root, SCRIPTS_DIR)]) {
|
|
140
|
-
const { path, several } = onlyScriptIn(dir, "prepare");
|
|
151
|
+
const { path, several } = onlyScriptIn(dir, "prepare", claimed);
|
|
141
152
|
if (path !== undefined) {
|
|
142
153
|
found.prepare = path;
|
|
143
154
|
break;
|
|
@@ -182,6 +193,10 @@ const SKILL = {
|
|
|
182
193
|
unit: { skill: "implement-unit-testing-script", file: "run_unittests", what: "unit testing script" },
|
|
183
194
|
conformance: { skill: "implement-conformance-testing-script", file: "run_conformance_tests", what: "conformance testing script" },
|
|
184
195
|
};
|
|
196
|
+
/** The skill that writes a testing script of a kind, and what the script is called in words. */
|
|
197
|
+
export function testingScriptSkill(kind) {
|
|
198
|
+
return { skill: SKILL[kind].skill, what: SKILL[kind].what };
|
|
199
|
+
}
|
|
185
200
|
/** The kind of testing script a skill writes, by its name - one that writes none, undefined. */
|
|
186
201
|
export function scriptKindOfSkill(skill) {
|
|
187
202
|
return Object.keys(SKILL).find((kind) => SKILL[kind].skill === skill);
|
package/dist/reopen.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* turri opened again in another folder, in the same terminal, once its chat has quit: a chat works on the project of
|
|
3
|
+
* the folder it was opened in, and after a capture the work is in another - `plain/`, a project of its own. `turri`
|
|
4
|
+
* (cli.ts) starts the chat as a process of its own, with turri's theme, its screen and the folder's models, and names
|
|
5
|
+
* it a file to write in: a chat that is to open again elsewhere writes where, with what, and quits; `turri` reads it and
|
|
6
|
+
* starts the chat there as it started the first - the theme, the screen and that folder's models worked out the same.
|
|
7
|
+
* A chat `turri` did not start - a host's, a desktop app's - has no file, and is never offered it.
|
|
8
|
+
*/
|
|
9
|
+
/** The file the chat `turri` started writes where it is to open again. */
|
|
10
|
+
export declare const REOPEN_FILE_ENV = "TURRI_REOPEN_FILE";
|
|
11
|
+
/** Said to the chat opened again, at its start: the capture whose report it tells - what the capture said of itself. */
|
|
12
|
+
export declare const REOPENED_AFTER_CAPTURE = "TURRI_REOPENED_AFTER_CAPTURE";
|
|
13
|
+
export interface Reopening {
|
|
14
|
+
/** The folder the chat opens in. */
|
|
15
|
+
dir: string;
|
|
16
|
+
/** Its arguments, as `turri` takes them. */
|
|
17
|
+
args: string[];
|
|
18
|
+
/** What it is told at its start, in its environment. */
|
|
19
|
+
env: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/** Whether this chat can open again in another folder: `turri` started it. */
|
|
22
|
+
export declare function canReopen(): boolean;
|
|
23
|
+
/** Ask `turri` to open the chat again in `dir` once it has quit - the caller quits it. False when it cannot (`canReopen`). */
|
|
24
|
+
export declare function reopenIn(dir: string, options?: {
|
|
25
|
+
args?: string[];
|
|
26
|
+
env?: Record<string, string>;
|
|
27
|
+
}): boolean;
|
|
28
|
+
/** What the chat that quit asked for, taken - its file removed - or undefined when it asked for nothing. */
|
|
29
|
+
export declare function takeReopening(file: string): Reopening | undefined;
|
package/dist/reopen.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
/**
|
|
3
|
+
* turri opened again in another folder, in the same terminal, once its chat has quit: a chat works on the project of
|
|
4
|
+
* the folder it was opened in, and after a capture the work is in another - `plain/`, a project of its own. `turri`
|
|
5
|
+
* (cli.ts) starts the chat as a process of its own, with turri's theme, its screen and the folder's models, and names
|
|
6
|
+
* it a file to write in: a chat that is to open again elsewhere writes where, with what, and quits; `turri` reads it and
|
|
7
|
+
* starts the chat there as it started the first - the theme, the screen and that folder's models worked out the same.
|
|
8
|
+
* A chat `turri` did not start - a host's, a desktop app's - has no file, and is never offered it.
|
|
9
|
+
*/
|
|
10
|
+
/** The file the chat `turri` started writes where it is to open again. */
|
|
11
|
+
export const REOPEN_FILE_ENV = "TURRI_REOPEN_FILE";
|
|
12
|
+
/** Said to the chat opened again, at its start: the capture whose report it tells - what the capture said of itself. */
|
|
13
|
+
export const REOPENED_AFTER_CAPTURE = "TURRI_REOPENED_AFTER_CAPTURE";
|
|
14
|
+
/** Whether this chat can open again in another folder: `turri` started it. */
|
|
15
|
+
export function canReopen() {
|
|
16
|
+
return (process.env[REOPEN_FILE_ENV] ?? "") !== "";
|
|
17
|
+
}
|
|
18
|
+
/** Ask `turri` to open the chat again in `dir` once it has quit - the caller quits it. False when it cannot (`canReopen`). */
|
|
19
|
+
export function reopenIn(dir, options = {}) {
|
|
20
|
+
const file = process.env[REOPEN_FILE_ENV];
|
|
21
|
+
if (file === undefined || file === "")
|
|
22
|
+
return false;
|
|
23
|
+
const reopening = { dir, args: options.args ?? [], env: options.env ?? {} };
|
|
24
|
+
writeFileSync(file, JSON.stringify(reopening));
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
/** What the chat that quit asked for, taken - its file removed - or undefined when it asked for nothing. */
|
|
28
|
+
export function takeReopening(file) {
|
|
29
|
+
let text;
|
|
30
|
+
try {
|
|
31
|
+
text = readFileSync(file, "utf8");
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
rmSync(file, { force: true });
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(text);
|
|
39
|
+
if (typeof parsed.dir !== "string" || !Array.isArray(parsed.args) || parsed.args.some((arg) => typeof arg !== "string"))
|
|
40
|
+
return undefined;
|
|
41
|
+
const env = Object.fromEntries(Object.entries(parsed.env ?? {}).filter((entry) => typeof entry[1] === "string"));
|
|
42
|
+
return { dir: parsed.dir, args: parsed.args, env };
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
package/dist/resume-line.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* pi's lines on the way out that say how to resume the session - its label, then the command on a line of its own -
|
|
3
|
+
* left out: turri leaves nothing behind but the command run.
|
|
4
|
+
*/
|
|
2
5
|
export declare function withoutResumeLine(text: string): string;
|
package/dist/resume-line.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* pi's lines on the way out that say how to resume the session - its label, then the command on a line of its own -
|
|
3
|
+
* left out: turri leaves nothing behind but the command run.
|
|
4
|
+
*/
|
|
2
5
|
export function withoutResumeLine(text) {
|
|
3
|
-
return text.replace(/^(?:\x1b\[[0-9;]*m)*To resume this session
|
|
6
|
+
return text.replace(/^(?:\x1b\[[0-9;]*m)*To resume this session:(?:\x1b\[[0-9;]*m)*\n[^\n]*\n?/m, "");
|
|
4
7
|
}
|
package/dist/sentinel-chat.js
CHANGED
|
@@ -177,6 +177,8 @@ export function noticeDialogs(pi, session, link, context) {
|
|
|
177
177
|
pi.on("agent_settled", () => void ask());
|
|
178
178
|
return {
|
|
179
179
|
put(notice) {
|
|
180
|
+
if (session.terminal)
|
|
181
|
+
return; // The terminal centre received it, including the question whether to start.
|
|
180
182
|
try {
|
|
181
183
|
pi.appendEntry(NOTICE_ENTRY, notice);
|
|
182
184
|
}
|
|
@@ -191,13 +193,14 @@ export function noticeDialogs(pi, session, link, context) {
|
|
|
191
193
|
},
|
|
192
194
|
concluded(conclusion) {
|
|
193
195
|
try {
|
|
194
|
-
|
|
196
|
+
if (!session.terminal)
|
|
197
|
+
pi.appendEntry(CONCLUDED_ENTRY, conclusion);
|
|
195
198
|
}
|
|
196
199
|
catch {
|
|
197
200
|
/* the agent is still told */
|
|
198
201
|
}
|
|
199
202
|
// A host that shows the person the conclusion itself: the chat knows of it - in order, with no turn of its own.
|
|
200
|
-
const shown = session.host.pulseEndsShown === true;
|
|
203
|
+
const shown = session.terminal || session.host.pulseEndsShown === true;
|
|
201
204
|
void pi.sendMessage({
|
|
202
205
|
customType: "turri_sentinel_concluded",
|
|
203
206
|
content: concludedNote(conclusion, { shown }),
|
|
@@ -206,6 +209,8 @@ export function noticeDialogs(pi, session, link, context) {
|
|
|
206
209
|
}, shown ? { triggerTurn: false } : { triggerTurn: true, deliverAs: "followUp" });
|
|
207
210
|
},
|
|
208
211
|
over(notice) {
|
|
212
|
+
if (session.terminal)
|
|
213
|
+
return;
|
|
209
214
|
asking.get(notice.id)?.abort();
|
|
210
215
|
const at = waiting.indexOf(notice);
|
|
211
216
|
if (at !== -1)
|
package/dist/sentinel.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare function keepGuidance(cwd: string, text: string): void;
|
|
|
30
30
|
* What a chat of the person's is told of the pulses that end: told itself, of those asked for in it - or, with the
|
|
31
31
|
* sentinel on, nothing, the sentinel telling the person what needs them.
|
|
32
32
|
*/
|
|
33
|
-
export declare function pulseEndsBlock(sentinel: boolean): string;
|
|
33
|
+
export declare function pulseEndsBlock(sentinel: boolean, terminal?: boolean): string;
|
|
34
34
|
/**
|
|
35
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
|
|
36
36
|
* does with it - and to tell the person so, and do nothing else about it. `launching`: launch-after-pulse is on - it is
|
package/dist/sentinel.js
CHANGED
|
@@ -119,7 +119,9 @@ export function keepGuidance(cwd, text) {
|
|
|
119
119
|
* What a chat of the person's is told of the pulses that end: told itself, of those asked for in it - or, with the
|
|
120
120
|
* sentinel on, nothing, the sentinel telling the person what needs them.
|
|
121
121
|
*/
|
|
122
|
-
export function pulseEndsBlock(sentinel) {
|
|
122
|
+
export function pulseEndsBlock(sentinel, terminal = false) {
|
|
123
|
+
if (sentinel && terminal)
|
|
124
|
+
return "<pulse-ends>\nThe sentinel checks finished pulses. Their results, its conclusions and its notices go to the notification centre (/notifications). Do not announce them here. Answer if the person asks; when they accept a notice's action, do the task you are given.\n</pulse-ends>";
|
|
123
125
|
return sentinel
|
|
124
126
|
? [
|
|
125
127
|
"<pulse-ends>",
|
|
@@ -219,7 +221,7 @@ export function sentinelPrompt(cwd, options = {}) {
|
|
|
219
221
|
"You fix the project's tooling and nothing else. Your file tools read the whole project; write and edit reach only the",
|
|
220
222
|
"testing scripts and config.turri.yaml - and in it only where the scripts are, and toolchains:. Your shell runs with",
|
|
221
223
|
"the project read only; the files you try a launch with go in $TMPDIR - /tmp is outside what it may write. It sees no",
|
|
222
|
-
"other process: ps and lsof do not run there - who_holds says what holds a port and whose it is. You never change ***plain - it is the person's intent, never yours to fix - and never
|
|
224
|
+
"other process: ps and lsof do not run there - who_holds says what holds a port and whose it is. You never change ***plain - it is the person's intent, never yours to fix - and never",
|
|
223
225
|
"launch, or regenerate but by resume after a fix of yours. You install nothing on this machine and change none of",
|
|
224
226
|
"its settings, nor the person's shell - under no circumstances: that is always the person's, said in a notice. You",
|
|
225
227
|
"never ask the person questions - a notice is how you reach them.",
|
package/dist/setup.js
CHANGED
|
@@ -10,7 +10,7 @@ import { fetchLatest, newerThan, turrisOnPath, versionFindings } from "./turri-v
|
|
|
10
10
|
import { sandboxAvailable, sandboxWithAsync } from "./regenerate/os-sandbox.js";
|
|
11
11
|
import { findTestScripts, onThisMachine } from "./regenerate/test-scripts.js";
|
|
12
12
|
import { configKeyOptions, parseArgs } from "./cli-options.js";
|
|
13
|
-
import { CONFIG_FILE, hasProjectConfig, readProjectConfig, moduleConfigFile, configModuleOf, moduleConfigsOf } from "./config.js";
|
|
13
|
+
import { CONFIG_FILE, hasProjectConfig, readProjectConfig, moduleConfigFile, configModuleOf, moduleConfigsOf, configProblems } from "./config.js";
|
|
14
14
|
import { checkModels, modelsInUse, piModelAccess } from "./model-check.js";
|
|
15
15
|
import { bedrockRegionFor, describeBedrockRegion, regionInGeography } from "./bedrock-region.js";
|
|
16
16
|
import { baseFilesAsync } from "./regenerate/base-folder.js";
|
|
@@ -230,6 +230,14 @@ async function allChecks(options) {
|
|
|
230
230
|
const project = options.dir;
|
|
231
231
|
if (project === undefined)
|
|
232
232
|
return checks;
|
|
233
|
+
// A config that does not parse is read as empty - every setting at its default, the models pi's own: said first.
|
|
234
|
+
checks.push(...configProblems(project).map((problem) => ({
|
|
235
|
+
level: "missing",
|
|
236
|
+
name: "Config",
|
|
237
|
+
detail: problem.text,
|
|
238
|
+
more: [`turri reads a config that does not parse as empty: none of ${problem.file} applies - not its models, not conformance tests, no other setting.`],
|
|
239
|
+
fix: `Set each key once in ${problem.file}, then run turri doctor again`,
|
|
240
|
+
})));
|
|
233
241
|
if (hasProjectConfig(project) || existsSync(join(project, "plain_modules")))
|
|
234
242
|
checks.push(...(await checkProject(project, { has: (command) => onThisMachine(command, env) !== undefined })));
|
|
235
243
|
if (hasProjectConfig(project))
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
2
|
+
import type { TurriCore } from "./chats.ts";
|
|
3
|
+
import type { Conclusion, Notice } from "./notice.ts";
|
|
4
|
+
import { type DialogStyle } from "./question-dialog.ts";
|
|
5
|
+
/** The terminal session's inbox. A notice keeps its identity and live state from the session that answers it. */
|
|
6
|
+
export interface TerminalNotification {
|
|
7
|
+
title: string;
|
|
8
|
+
detail: string;
|
|
9
|
+
conclusion?: string;
|
|
10
|
+
notice?: Notice;
|
|
11
|
+
seen: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class TerminalNotifications {
|
|
14
|
+
readonly items: TerminalNotification[];
|
|
15
|
+
private readonly reviews;
|
|
16
|
+
get count(): number;
|
|
17
|
+
needsAnswer(item: TerminalNotification): boolean;
|
|
18
|
+
add(title: string, detail: string, notice?: Notice): void;
|
|
19
|
+
/** Only the sentinel's review shares a row. The pulse result and the question whether to start it are independent. */
|
|
20
|
+
private review;
|
|
21
|
+
put(notice: Notice, work?: Pick<Conclusion, "job" | "check">): void;
|
|
22
|
+
concluded(result: Conclusion): void;
|
|
23
|
+
}
|
|
24
|
+
/** The notifications tab. Opening or leaving a detail never answers its notice. Only an explicit choice does. */
|
|
25
|
+
export declare function notificationView(session: TurriCore, style: DialogStyle, leave: () => void): {
|
|
26
|
+
count: () => number;
|
|
27
|
+
inDetail: () => boolean;
|
|
28
|
+
render(width: number, available: number): readonly string[];
|
|
29
|
+
handleInput(data: string): void;
|
|
30
|
+
handleMouse: (event: TuiMouseEvent) => import("@earendil-works/pi-tui").TuiMouseEventResult | undefined;
|
|
31
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Container, SelectList, Text } from "@earendil-works/pi-tui";
|
|
2
|
+
import { QuestionDialog } from "./question-dialog.js";
|
|
3
|
+
export class TerminalNotifications {
|
|
4
|
+
items = [];
|
|
5
|
+
reviews = new Map();
|
|
6
|
+
get count() {
|
|
7
|
+
return this.items.filter((item) => !item.seen || this.needsAnswer(item)).length;
|
|
8
|
+
}
|
|
9
|
+
needsAnswer(item) {
|
|
10
|
+
return item.notice?.state === "open" && item.notice.kind !== "fixed";
|
|
11
|
+
}
|
|
12
|
+
add(title, detail, notice) {
|
|
13
|
+
this.items.unshift({ title, detail, seen: false, notice });
|
|
14
|
+
}
|
|
15
|
+
/** Only the sentinel's review shares a row. The pulse result and the question whether to start it are independent. */
|
|
16
|
+
review(about, title) {
|
|
17
|
+
const key = about.check ? `check:${about.check}` : about.job ? `pulse:${about.job}` : undefined;
|
|
18
|
+
const known = key && this.reviews.get(key);
|
|
19
|
+
if (known)
|
|
20
|
+
return known;
|
|
21
|
+
const item = { title, detail: "", seen: false };
|
|
22
|
+
this.items.unshift(item);
|
|
23
|
+
if (key)
|
|
24
|
+
this.reviews.set(key, item);
|
|
25
|
+
return item;
|
|
26
|
+
}
|
|
27
|
+
put(notice, work) {
|
|
28
|
+
const about = [notice.module, notice.pulse !== undefined ? `pulse ${notice.pulse}` : undefined].filter(Boolean).join(" · ");
|
|
29
|
+
const heading = notice.kind === "fixed" ? "Fixed" : "Sentinel";
|
|
30
|
+
const title = [heading, about, notice.summary].filter(Boolean).join(" · ");
|
|
31
|
+
const detail = notice.evidence.join("\n\n");
|
|
32
|
+
if (notice.kind === "sentinel-start")
|
|
33
|
+
return this.add(title, detail, notice);
|
|
34
|
+
const item = this.review(work ?? notice, title);
|
|
35
|
+
Object.assign(item, { title, detail, notice, seen: false });
|
|
36
|
+
}
|
|
37
|
+
concluded(result) {
|
|
38
|
+
const what = result.pulse !== undefined ? `pulse ${result.pulse}` : result.job ?? result.check;
|
|
39
|
+
const verdict = result.verdict === "holds" ? "it holds" : result.verdict === "wrong" ? "found something wrong" : "not checked";
|
|
40
|
+
const item = this.review(result, ["Sentinel", result.module, what, verdict].filter(Boolean).join(" · "));
|
|
41
|
+
item.conclusion = `${verdict}: ${result.summary}`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** The notifications tab. Opening or leaving a detail never answers its notice. Only an explicit choice does. */
|
|
45
|
+
export function notificationView(session, style, leave) {
|
|
46
|
+
const inbox = session.notifications;
|
|
47
|
+
const { accent, muted } = style;
|
|
48
|
+
const listBox = new Container();
|
|
49
|
+
let list;
|
|
50
|
+
let rows = [];
|
|
51
|
+
let labels = [];
|
|
52
|
+
let visible = 0;
|
|
53
|
+
let detail;
|
|
54
|
+
let selectedNotice;
|
|
55
|
+
let detailState;
|
|
56
|
+
let height = 20;
|
|
57
|
+
const back = () => { detail = undefined; selectedNotice = undefined; };
|
|
58
|
+
const show = (item, steering = false) => {
|
|
59
|
+
item.seen = true;
|
|
60
|
+
const notice = item.notice;
|
|
61
|
+
selectedNotice = notice;
|
|
62
|
+
detailState = notice?.state;
|
|
63
|
+
const open = notice?.state === "open";
|
|
64
|
+
const actions = open && notice.kind !== "fixed" ? notice.actions.map((action, index) => `${index + 1}. ${action.label}`) : [];
|
|
65
|
+
const steer = "Say what to do instead…";
|
|
66
|
+
const ignore = "Ignore - leave it as the build has it";
|
|
67
|
+
const options = [...actions, ...(open && notice.ignorable ? [ignore] : []), ...(open && notice.kind === undefined ? [steer] : []), ...(open ? ["Dismiss"] : []), "Back"];
|
|
68
|
+
const target = notice && session.chats().find((chat) => chat.id === notice.chat);
|
|
69
|
+
detail = new QuestionDialog({
|
|
70
|
+
question: steering ? "What should be done about it?" : "Notifications",
|
|
71
|
+
context: [item.title, item.detail, item.conclusion, ...(open && notice.kind === undefined && target ? [`Accepted work goes to ${target.title}.`] : [])].filter(Boolean).join("\n\n"),
|
|
72
|
+
...(steering ? {} : { options, clickable: true }), rows: () => height,
|
|
73
|
+
style, requestRender: () => { },
|
|
74
|
+
done(answer) {
|
|
75
|
+
if (!answer || !notice || notice.state !== "open" || (!steering && answer === "Back"))
|
|
76
|
+
return back();
|
|
77
|
+
if (!steering && answer === steer)
|
|
78
|
+
return show(item, true);
|
|
79
|
+
if (steering)
|
|
80
|
+
session.answer(notice.id, { steer: answer });
|
|
81
|
+
else if (answer === "Dismiss")
|
|
82
|
+
session.answer(notice.id, { dismiss: true });
|
|
83
|
+
else if (answer === ignore)
|
|
84
|
+
session.answer(notice.id, { ignore: true });
|
|
85
|
+
else
|
|
86
|
+
session.answer(notice.id, { action: actions.indexOf(answer) });
|
|
87
|
+
back();
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
session.changed();
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
count: () => inbox.count,
|
|
94
|
+
inDetail: () => detail !== undefined,
|
|
95
|
+
render(width, available) {
|
|
96
|
+
height = available;
|
|
97
|
+
if (selectedNotice && selectedNotice.state !== detailState)
|
|
98
|
+
back();
|
|
99
|
+
if (detail)
|
|
100
|
+
return detail.render(width);
|
|
101
|
+
const next = inbox.items;
|
|
102
|
+
const lines = next.map((item) => `${inbox.needsAnswer(item) ? "? " : item.seen ? " " : "• "}${item.notice && item.notice.state !== "open" ? `[${item.notice.state}] ` : ""}${item.title.replace(/\s+/g, " ")}`);
|
|
103
|
+
const room = Math.max(1, available - 4);
|
|
104
|
+
if (!list || room !== visible || next.length !== rows.length || next.some((item, i) => item !== rows[i] || lines[i] !== labels[i])) {
|
|
105
|
+
// Keep the same item selected when a pulse finishes while the person is reading the list.
|
|
106
|
+
const selected = rows[Number(list?.getSelectedItem()?.value)];
|
|
107
|
+
rows = next.slice();
|
|
108
|
+
labels = lines;
|
|
109
|
+
visible = room;
|
|
110
|
+
list = new SelectList(rows.map((_item, i) => ({ value: String(i), label: labels[i] })), room, { selectedPrefix: accent, selectedText: accent, description: muted, scrollInfo: muted, noMatch: muted });
|
|
111
|
+
list.setSelectedIndex(selected ? rows.indexOf(selected) : 0);
|
|
112
|
+
list.onSelect = ({ value }) => show(rows[Number(value)]);
|
|
113
|
+
list.onCancel = leave;
|
|
114
|
+
listBox.clear();
|
|
115
|
+
listBox.addChild(new Text(style.bold(accent("Notifications")), 0, 0));
|
|
116
|
+
listBox.addChild(rows.length ? list : new Text("No notifications this session.", 0, 0));
|
|
117
|
+
listBox.addChild(new Text(muted(rows.length ? "↑↓ select · enter open · r mark all read · esc back" : "esc back"), 0, 0));
|
|
118
|
+
}
|
|
119
|
+
return listBox.render(width);
|
|
120
|
+
},
|
|
121
|
+
handleInput(data) {
|
|
122
|
+
if (detail)
|
|
123
|
+
detail.handleInput(data);
|
|
124
|
+
else if (data === "r") {
|
|
125
|
+
for (const item of inbox.items)
|
|
126
|
+
item.seen = true;
|
|
127
|
+
session.changed();
|
|
128
|
+
}
|
|
129
|
+
else
|
|
130
|
+
list?.handleInput(data);
|
|
131
|
+
},
|
|
132
|
+
handleMouse: (event) => detail ? detail.handleMouse(event) : listBox.handleMouse(event),
|
|
133
|
+
};
|
|
134
|
+
}
|
package/docs/README.md
CHANGED
|
@@ -16,6 +16,7 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
16
16
|
| what my machine needs, and why a check failed | [installation](installation.md) |
|
|
17
17
|
| what turri needs of this machine, and what `turri doctor` checks | [installation](installation.md#what-turri-doctor-checks) |
|
|
18
18
|
| how to start a project, or add a feature, in a conversation | [using](using.md#in-a-conversation) |
|
|
19
|
+
| how to bring an existing codebase under \*\*\*plain | [capture](capture.md) |
|
|
19
20
|
| how to have several chats open at once, and reopen them | [chats](chats.md) |
|
|
20
21
|
| what checks each pulse as it finishes, and tells me what needs me | [the sentinel](sentinel.md) |
|
|
21
22
|
| which model codes, and how to change it | [using](using.md#choosing-a-model), [the project config](config.md#models) |
|
|
@@ -48,6 +49,7 @@ turri is the first coding agent with the power of regenerative software: [\*\*\*
|
|
|
48
49
|
| [A Claude subscription](claude-subscription.md) | running every agent on a Claude Pro, Max or Team subscription through Claude Code: setting it up, its models, checking it yourself, in turri-desktop, its limits, when it does not work |
|
|
49
50
|
| [The project config](config.md) | `config.turri.yaml` and a module's own `config.turri.<module>.yaml`: where they are read from, every key, models and their inheritance, conformance, the testing scripts, which file builds a module, the old `config.yaml` |
|
|
50
51
|
| [Launch](launch.md) | trying what is built: the launch track, a commit in dist/<module>, starting it on your machine, after every pulse, `turri launch` |
|
|
52
|
+
| [Capture](capture.md) | an existing codebase captured into \*\*\*plain, offline: what it aims for, how it scales, what it writes, the report, resuming |
|
|
51
53
|
| [Running unattended](headless.md) | regenerating overnight or in CI: before you leave it, the command, the results, resuming, rebuilding one functionality |
|
|
52
54
|
| [Authoring \*\*\*plain](authoring-plain.md) | a \*\*\*plain project, what \*\*\*plain is made of, the rules, writing \*\*\*plain with the agent, the skills, checking \*\*\*plain |
|
|
53
55
|
| [Regenerating](regenerating.md) | where things go, one job, a whole module and how its work is cut into jobs, each job's cases, \*\*\*plain changes, conformance tests, the two records of what is built |
|