@turri-dev/cli 0.4.2-next.a6867e8 → 0.4.3-next.620bae9
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/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 +20 -0
- package/dist/chat-tabs.js +96 -0
- package/dist/chat-terminal.js +54 -8
- package/dist/chat-waiting.d.ts +4 -1
- package/dist/chat-waiting.js +7 -4
- package/dist/chats.d.ts +3 -1
- package/dist/chats.js +1 -1
- package/dist/extension.js +81 -88
- package/dist/identity.js +1 -1
- package/dist/loop-tools.d.ts +2 -3
- package/dist/loop-tools.js +7 -12
- package/dist/pointer-hover.d.ts +12 -0
- package/dist/pointer-hover.js +44 -0
- 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 +83 -3
- 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 +42 -34
- package/dist/regenerate/side-panel.d.ts +4 -1
- package/dist/regenerate/side-panel.js +131 -22
- package/dist/regenerate/spec-map-view.d.ts +9 -1
- package/dist/regenerate/spec-map-view.js +22 -2
- package/dist/regenerate/test-scripts.d.ts +3 -0
- package/dist/regenerate/test-scripts.js +16 -5
- package/dist/resume-line.d.ts +4 -1
- package/dist/resume-line.js +5 -2
- package/dist/sentinel.js +1 -1
- package/docs/chats.md +6 -6
- package/docs/config.md +2 -0
- package/docs/regenerating.md +8 -7
- package/docs/sandbox.md +2 -0
- package/docs/skills-and-gates.md +1 -1
- package/docs/theming.md +1 -1
- package/docs/using.md +6 -3
- package/genome/rules/turri-regeneration.md +1 -1
- package/package.json +3 -3
- package/dist/regenerate/steer.d.ts +0 -34
- package/dist/regenerate/steer.js +0 -91
|
@@ -4,6 +4,7 @@ import { type JobsTreeState } from "./jobs-tree.ts";
|
|
|
4
4
|
import type { MarkedPage } from "./spec-map.ts";
|
|
5
5
|
import { type SpecMapState } from "./spec-map-view.ts";
|
|
6
6
|
import type { TranscriptStyle } from "./transcript-view.ts";
|
|
7
|
+
import type { ButtonPaint, PointerHover } from "../pointer-hover.ts";
|
|
7
8
|
/**
|
|
8
9
|
* The side panel: the spec and how far the code has been regenerated, beside the conversation rather than instead of
|
|
9
10
|
* it.
|
|
@@ -21,6 +22,8 @@ export interface SidePanelOptions {
|
|
|
21
22
|
earlier?: () => Job[];
|
|
22
23
|
/** The regeneration's pages. Not given: the pulse list alone. */
|
|
23
24
|
map?: () => MarkedPage[];
|
|
25
|
+
pointer?: PointerHover;
|
|
26
|
+
tabLabel?: ButtonPaint;
|
|
24
27
|
/** Rows the panel may use. */
|
|
25
28
|
rows: () => number;
|
|
26
29
|
style: TranscriptStyle;
|
|
@@ -53,7 +56,7 @@ export interface SidePanelOptions {
|
|
|
53
56
|
export declare function createSidePanel(options: SidePanelOptions): {
|
|
54
57
|
render(width: number): string[];
|
|
55
58
|
handleInput(data: string): void;
|
|
56
|
-
/**
|
|
59
|
+
/** View tabs switch on a click, and the wheel scrolls the panel wherever the keyboard is. */
|
|
57
60
|
handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
58
61
|
invalidate(): void;
|
|
59
62
|
};
|
|
@@ -12,6 +12,48 @@ export function createSidePanel(options) {
|
|
|
12
12
|
let drawnTree = { rows: [], rowStarts: [], lineCount: 0 };
|
|
13
13
|
let drawnMap = { rows: [], rowStarts: [], lineCount: 0 };
|
|
14
14
|
let pages = [];
|
|
15
|
+
let pressed;
|
|
16
|
+
// Hit regions for the last frame, in panel-local cells (the dock border is outside them).
|
|
17
|
+
const hits = new Map();
|
|
18
|
+
const hit = (y, target) => {
|
|
19
|
+
const row = hits.get(y);
|
|
20
|
+
if (row)
|
|
21
|
+
row.push(target);
|
|
22
|
+
else
|
|
23
|
+
hits.set(y, [target]);
|
|
24
|
+
};
|
|
25
|
+
let headerHeight = 0;
|
|
26
|
+
function hitLabels(drawn, first, y, height, width, target) {
|
|
27
|
+
drawn.rows.forEach((row, index) => {
|
|
28
|
+
const start = drawn.rowStarts[index] - first;
|
|
29
|
+
const end = Math.min(height, start + drawn.labelHeights[index]);
|
|
30
|
+
if (Math.max(0, start) >= end)
|
|
31
|
+
return;
|
|
32
|
+
const label = { ...target(row, index), x: 0, end: width };
|
|
33
|
+
for (let line = Math.max(0, start); line < end; line++)
|
|
34
|
+
hit(headerHeight + y + line, label);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const controls = (width) => {
|
|
38
|
+
if (width <= 0 || (!options.map && !options.dock))
|
|
39
|
+
return [];
|
|
40
|
+
const close = width >= 30 ? " × close " : width >= 3 ? " × " : "×";
|
|
41
|
+
const right = width - visibleWidth(close);
|
|
42
|
+
const buttons = [];
|
|
43
|
+
let x = 0;
|
|
44
|
+
if (options.map) {
|
|
45
|
+
for (const [action, label] of [["map", "***plain"], ["pulses", "pulses"]]) {
|
|
46
|
+
const marker = width >= 30 ? (map.view === action ? "▸ " : " ") : "";
|
|
47
|
+
const text = truncateToWidth(` ${marker}${label} `, Math.max(0, right - x - 1), "");
|
|
48
|
+
if (!text)
|
|
49
|
+
break;
|
|
50
|
+
buttons.push({ action, text, x });
|
|
51
|
+
x += visibleWidth(text) + 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return [...buttons, { action: "close", text: close, x: right }];
|
|
55
|
+
};
|
|
56
|
+
const tabLabel = options.tabLabel ?? ((text, active) => active ? style.heading(text) : style.muted(text));
|
|
15
57
|
/** The keys back to the chat - and `s`, from over the screen to beside the chat and back. */
|
|
16
58
|
const backKeys = () => {
|
|
17
59
|
if (options.dock === undefined)
|
|
@@ -65,7 +107,7 @@ export function createSidePanel(options) {
|
|
|
65
107
|
/** The rule under the top. */
|
|
66
108
|
const rule = (width) => style.muted("─".repeat(Math.max(1, width)));
|
|
67
109
|
const renderPulses = (width, rows) => {
|
|
68
|
-
const keys = ["↑↓ move", "enter open/close", "←→", "o/c all", "pgup pgdn scroll", ...(options.map !== undefined ? ["p regen"] : []), ...backKeys()];
|
|
110
|
+
const keys = ["↑↓ move", "click/enter open/close", "←→", "o/c all", "pgup pgdn scroll", ...(options.map !== undefined ? ["p regen"] : []), ...backKeys()];
|
|
69
111
|
const top = topBlock([`${style.heading("pulses")}${waitingNote()}`], keys, width);
|
|
70
112
|
// Under the top: the rule, and a line of space - as the map has.
|
|
71
113
|
const bodyHeight = Math.max(3, rows - top.length - 2);
|
|
@@ -75,6 +117,10 @@ export function createSidePanel(options) {
|
|
|
75
117
|
const tree_ = jobsTreeLines([...options.jobs(), ...(options.earlier?.() ?? [])], tree, width, style);
|
|
76
118
|
drawnTree = { rows: tree_.rows, rowStarts: tree_.rowStarts, lineCount: tree_.lines.length };
|
|
77
119
|
keepCursorInView(tree, tree_.rowStarts, tree_.lines.length, bodyHeight);
|
|
120
|
+
hitLabels(tree_, tree.top, top.length + 2, bodyHeight, width, (row, index) => ({
|
|
121
|
+
key: `tree:${row.section}:${row.kind}:${row.kind !== "section" ? row.job.id : ""}:${row.kind === "file" ? row.file : ""}`,
|
|
122
|
+
pick: () => { tree.cursor = index; treeKey(tree, drawnTree.rows, "toggle"); },
|
|
123
|
+
}));
|
|
78
124
|
const visible = tree_.lines.slice(tree.top, tree.top + bodyHeight);
|
|
79
125
|
while (visible.length < bodyHeight)
|
|
80
126
|
visible.push("");
|
|
@@ -94,12 +140,19 @@ export function createSidePanel(options) {
|
|
|
94
140
|
const tabbed = pages.length > 1;
|
|
95
141
|
const page = shownPage(pages, map);
|
|
96
142
|
const discuss = page.stuck && options.discuss !== undefined ? [`${DISCUSS_KEY} talk it through in the chat`] : [];
|
|
97
|
-
const keys = [...discuss, "↑↓ move", "enter open/close", ...(tabbed ? ["←→ module"] : []), "o/c all", "pgup pgdn", "p pulses", ...backKeys()];
|
|
143
|
+
const keys = [...discuss, "↑↓ move", "click/enter open/close", ...(tabbed ? ["←→ module"] : []), "o/c all", "pgup pgdn", "p pulses", ...backKeys()];
|
|
98
144
|
// The legend's box in the upper right corner, over what is under it; too narrow a panel has none.
|
|
99
145
|
const box = width >= 60 ? legendBox(legendLines(page, style)) : [];
|
|
100
146
|
const room = box.length > 0 ? width - visibleWidth(box[0]) - 1 : width;
|
|
101
147
|
// The top line whole - it wraps beside the box; the tabs fit themselves, counting what does not fit.
|
|
102
|
-
const title = [specMapHeader(page, Number.MAX_SAFE_INTEGER, style, waitingNote())
|
|
148
|
+
const title = [specMapHeader(page, Number.MAX_SAFE_INTEGER, style, waitingNote())];
|
|
149
|
+
if (tabbed) {
|
|
150
|
+
const tabs = tabBar(pages, page, room, style, now);
|
|
151
|
+
const y = headerHeight + wrapTextWithAnsi(title[0], room).length;
|
|
152
|
+
for (const tab of tabs.targets)
|
|
153
|
+
hit(y, { key: `module:${tab.page.plainFile}`, x: tab.x, end: tab.end, pick: () => switchTab(pages, map, pages.indexOf(tab.page) - pages.indexOf(page)) });
|
|
154
|
+
title.push(tabs.line);
|
|
155
|
+
}
|
|
103
156
|
const top = topBlock(title, keys, room);
|
|
104
157
|
// Under the top: the rule, a line of space, and the columns' headings - two lines.
|
|
105
158
|
const bodyHeight = Math.max(3, rows - top.length - 4);
|
|
@@ -110,6 +163,19 @@ export function createSidePanel(options) {
|
|
|
110
163
|
const drawn = long ? specMapLines(pages, map, width - 2, style, options.jobs(), now) : first;
|
|
111
164
|
drawnMap = { rows: drawn.rows, rowStarts: drawn.rowStarts, lineCount: drawn.lines.length };
|
|
112
165
|
keepCursorInView(map, drawn.rowStarts, drawn.lines.length, bodyHeight);
|
|
166
|
+
const headings = columnHeadings(page, width, style);
|
|
167
|
+
const bodyY = top.length + 2 + headings.length;
|
|
168
|
+
hitLabels(drawn, map.top, bodyY, bodyHeight, long ? width - 2 : width, (row, index) => ({
|
|
169
|
+
key: `map:${row.key}`,
|
|
170
|
+
pick: () => { map.cursor = index; map.cursorKey = row.key; toggleMapRow(row); },
|
|
171
|
+
}));
|
|
172
|
+
// On a short header the legend can cover part of a body row as well.
|
|
173
|
+
for (let i = bodyY; i < box.length; i++) {
|
|
174
|
+
const y = headerHeight + i;
|
|
175
|
+
const row = hits.get(y);
|
|
176
|
+
if (row)
|
|
177
|
+
hits.set(y, row.map((target) => ({ ...target, end: Math.min(target.end, room) })));
|
|
178
|
+
}
|
|
113
179
|
const visible = drawn.lines.slice(map.top, map.top + bodyHeight).map((line) => truncateToWidth(line, long ? width - 2 : width));
|
|
114
180
|
while (visible.length < bodyHeight)
|
|
115
181
|
visible.push("");
|
|
@@ -120,7 +186,7 @@ export function createSidePanel(options) {
|
|
|
120
186
|
})()
|
|
121
187
|
: visible;
|
|
122
188
|
// The rule beside the box stops short of it.
|
|
123
|
-
return overBox([...top, rule(top.length < box.length ? room - 1 : width), "", ...
|
|
189
|
+
return overBox([...top, rule(top.length < box.length ? room - 1 : width), "", ...headings, ...body], box, width);
|
|
124
190
|
};
|
|
125
191
|
/** From the map to the pulse list: onto the pulse that regenerates the item under the cursor, when one does. */
|
|
126
192
|
const toPulses = () => {
|
|
@@ -155,6 +221,17 @@ export function createSidePanel(options) {
|
|
|
155
221
|
return;
|
|
156
222
|
}
|
|
157
223
|
};
|
|
224
|
+
const toggleMapRow = (target, open) => {
|
|
225
|
+
if (target === undefined || target.kind === "group")
|
|
226
|
+
return;
|
|
227
|
+
const to = open ?? !(target.kind === "import" ? target.open : map.open.has(target.key));
|
|
228
|
+
if (target.kind === "import")
|
|
229
|
+
map.imports.set(target.key.replace(/^import\n/, ""), to);
|
|
230
|
+
else if (to)
|
|
231
|
+
map.open.add(target.key);
|
|
232
|
+
else
|
|
233
|
+
map.open.delete(target.key);
|
|
234
|
+
};
|
|
158
235
|
/** A key in the map. */
|
|
159
236
|
const mapKey = (data) => {
|
|
160
237
|
const page = Math.max(1, lastBodyHeight - 1);
|
|
@@ -164,25 +241,12 @@ export function createSidePanel(options) {
|
|
|
164
241
|
map.cursor = Math.max(0, Math.min(rows.length - 1, to));
|
|
165
242
|
map.cursorKey = rows[map.cursor]?.key;
|
|
166
243
|
};
|
|
167
|
-
const isOpen = (target) => (target.kind === "item" ? map.open.has(target.key) : target.kind === "group" ? false : target.open);
|
|
168
|
-
const toggle = (target, open) => {
|
|
169
|
-
// A group's heading only says what is under it.
|
|
170
|
-
if (target === undefined || target.kind === "group")
|
|
171
|
-
return;
|
|
172
|
-
const to = open ?? !isOpen(target);
|
|
173
|
-
if (target.kind === "import")
|
|
174
|
-
map.imports.set(target.key.replace(/^import\n/, ""), to);
|
|
175
|
-
else if (to)
|
|
176
|
-
map.open.add(target.key);
|
|
177
|
-
else
|
|
178
|
-
map.open.delete(target.key);
|
|
179
|
-
};
|
|
180
244
|
if (matchesKey(data, Key.up))
|
|
181
245
|
move(map.cursor - 1);
|
|
182
246
|
else if (matchesKey(data, Key.down))
|
|
183
247
|
move(map.cursor + 1);
|
|
184
248
|
else if (matchesKey(data, Key.enter) || data === " ")
|
|
185
|
-
|
|
249
|
+
toggleMapRow(row);
|
|
186
250
|
// ←→ go from one module's tab to the next.
|
|
187
251
|
else if (matchesKey(data, Key.right))
|
|
188
252
|
switchTab(pages, map, 1);
|
|
@@ -190,7 +254,7 @@ export function createSidePanel(options) {
|
|
|
190
254
|
switchTab(pages, map, -1);
|
|
191
255
|
else if (data === "o" || data === "c")
|
|
192
256
|
for (const entry of rows)
|
|
193
|
-
|
|
257
|
+
toggleMapRow(entry, data === "o");
|
|
194
258
|
else if (data === DISCUSS_KEY && options.discuss !== undefined) {
|
|
195
259
|
const shown = shownPage(pages, map);
|
|
196
260
|
if (shown?.stuck === true)
|
|
@@ -211,15 +275,26 @@ export function createSidePanel(options) {
|
|
|
211
275
|
};
|
|
212
276
|
return {
|
|
213
277
|
render(width) {
|
|
214
|
-
|
|
278
|
+
hits.clear();
|
|
279
|
+
let bar = "";
|
|
280
|
+
let end = 0;
|
|
281
|
+
for (const { action, text, x } of controls(width)) {
|
|
282
|
+
bar += " ".repeat(x - end) + tabLabel(text, map.view === action, options.pointer?.target === `panel:${action}`, action === "close" ? "close" : "tab");
|
|
283
|
+
end = x + visibleWidth(text);
|
|
284
|
+
}
|
|
285
|
+
const header = bar ? [bar] : [];
|
|
286
|
+
headerHeight = header.length;
|
|
287
|
+
const rows = Math.max(8, options.rows()) - header.length;
|
|
215
288
|
try {
|
|
216
|
-
return map.view === "map" && options.map !== undefined ? renderMap(width, rows) : renderPulses(width, rows);
|
|
289
|
+
return [...header, ...(map.view === "map" && options.map !== undefined ? renderMap(width, rows) : renderPulses(width, rows))];
|
|
217
290
|
}
|
|
218
291
|
catch (error) {
|
|
292
|
+
hits.clear();
|
|
219
293
|
// A frame that throws is never drawn - nor is anything after it: the screen would freeze. What failed is shown instead.
|
|
220
294
|
const top = topBlock([`${style.heading(map.view === "map" ? "regen" : "pulses")}${waitingNote()}`], [...(options.map !== undefined ? ["p the other view"] : []), ...backKeys()], width);
|
|
221
295
|
const lines = (error instanceof Error ? (error.stack ?? error.message) : String(error)).split("\n").slice(0, Math.max(1, rows - top.length - 1));
|
|
222
296
|
return [
|
|
297
|
+
...header,
|
|
223
298
|
...top,
|
|
224
299
|
rule(width),
|
|
225
300
|
...lines.map((line, index) => truncateToWidth(index === 0 ? style.error(`could not be drawn: ${line}`) : style.muted(line), width)),
|
|
@@ -274,8 +349,42 @@ export function createSidePanel(options) {
|
|
|
274
349
|
else if (matchesKey(data, Key.end) || data === "G")
|
|
275
350
|
tree.cursor = Math.max(0, drawnTree.rows.length - 1);
|
|
276
351
|
},
|
|
277
|
-
/**
|
|
352
|
+
/** View tabs switch on a click, and the wheel scrolls the panel wherever the keyboard is. */
|
|
278
353
|
handleMouse(event) {
|
|
354
|
+
const down = pressed;
|
|
355
|
+
if (event.type === "press" || event.type === "click")
|
|
356
|
+
pressed = undefined;
|
|
357
|
+
if (event.y === 0 && (event.type === "move" || (event.button === "left" && (event.type === "press" || event.type === "click")))) {
|
|
358
|
+
for (const { action, text, x } of controls(event.width)) {
|
|
359
|
+
if (event.x >= x && event.x < x + visibleWidth(text)) {
|
|
360
|
+
if (options.pointer)
|
|
361
|
+
options.pointer.target = `panel:${action}`;
|
|
362
|
+
if (event.type === "move")
|
|
363
|
+
return { handled: true, render: false };
|
|
364
|
+
if (event.type === "press")
|
|
365
|
+
pressed = action;
|
|
366
|
+
else if (action === down && action !== map.view) {
|
|
367
|
+
if (action === "close")
|
|
368
|
+
options.close();
|
|
369
|
+
else if (action === "map")
|
|
370
|
+
toMap();
|
|
371
|
+
else
|
|
372
|
+
toPulses();
|
|
373
|
+
}
|
|
374
|
+
return { handled: true };
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (event.button === "left" && (event.type === "press" || event.type === "click")) {
|
|
379
|
+
const target = hits.get(event.y)?.find(({ x, end }) => event.x >= x && event.x < end);
|
|
380
|
+
if (target) {
|
|
381
|
+
if (event.type === "press")
|
|
382
|
+
pressed = target.key;
|
|
383
|
+
else if (down === target.key)
|
|
384
|
+
target.pick();
|
|
385
|
+
return { handled: true };
|
|
386
|
+
}
|
|
387
|
+
}
|
|
279
388
|
if (event.type !== "wheel" || event.wheelDelta === undefined)
|
|
280
389
|
return undefined;
|
|
281
390
|
if (map.view === "map" && options.map !== undefined)
|
|
@@ -70,7 +70,14 @@ export declare function switchTab(pages: MarkedPage[], state: SpecMapState, by:
|
|
|
70
70
|
* The tabs, a module each in the chain's order, the one shown marked - those regenerating spin, those stuck say so - fitted to
|
|
71
71
|
* `width` around the one shown, what does not fit counted at either end.
|
|
72
72
|
*/
|
|
73
|
-
export declare function tabBar(pages: MarkedPage[], shown: MarkedPage | undefined, width: number, style: TranscriptStyle, now: number):
|
|
73
|
+
export declare function tabBar(pages: MarkedPage[], shown: MarkedPage | undefined, width: number, style: TranscriptStyle, now: number): {
|
|
74
|
+
line: string;
|
|
75
|
+
targets: {
|
|
76
|
+
x: number;
|
|
77
|
+
end: number;
|
|
78
|
+
page: MarkedPage;
|
|
79
|
+
}[];
|
|
80
|
+
};
|
|
74
81
|
/**
|
|
75
82
|
* Where an item stands, as one mark on a ladder every item climbs: planned, working, regenerated, validating, conform - and needs
|
|
76
83
|
* you, off it - named in the legend in the panel's corner. The same mark means the same thing whatever the config says
|
|
@@ -123,6 +130,7 @@ export declare function specMapRows(pages: MarkedPage[], state: SpecMapState): M
|
|
|
123
130
|
export declare function specMapLines(pages: MarkedPage[], state: SpecMapState, width: number, style: TranscriptStyle, _jobs?: Job[], now?: number): {
|
|
124
131
|
lines: string[];
|
|
125
132
|
rowStarts: number[];
|
|
133
|
+
labelHeights: number[];
|
|
126
134
|
rows: MapRow[];
|
|
127
135
|
marks: LineMark[];
|
|
128
136
|
};
|
|
@@ -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
|
/**
|
|
@@ -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;
|
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.js
CHANGED
|
@@ -219,7 +219,7 @@ export function sentinelPrompt(cwd, options = {}) {
|
|
|
219
219
|
"You fix the project's tooling and nothing else. Your file tools read the whole project; write and edit reach only the",
|
|
220
220
|
"testing scripts and config.turri.yaml - and in it only where the scripts are, and toolchains:. Your shell runs with",
|
|
221
221
|
"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
|
|
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",
|
|
223
223
|
"launch, or regenerate but by resume after a fix of yours. You install nothing on this machine and change none of",
|
|
224
224
|
"its settings, nor the person's shell - under no circumstances: that is always the person's, said in a notice. You",
|
|
225
225
|
"never ask the person questions - a notice is how you reach them.",
|
package/docs/chats.md
CHANGED
|
@@ -15,7 +15,6 @@ The session's, shared by every chat:
|
|
|
15
15
|
|
|
16
16
|
- **the pulses and their plan** - one job registry and one work loop on the project: a pulse any chat starts is in every chat's side panel and `pulses`, and two chats asking for the same module get one plan, not two;
|
|
17
17
|
- **the coding model** given with `--coding-model`, and `parallel-jobs`;
|
|
18
|
-
- **steering** - what `steer` was told, every plan follows;
|
|
19
18
|
- **conformance** chosen with `conform`, module by module;
|
|
20
19
|
- **what launches started** - it runs until turri ends or `/halt launched <name>`, whatever chats are opened or closed - and the launch track;
|
|
21
20
|
- **the ledger** - one run, each event with the id of the chat its work was asked for in (`chat`), and `chat.opened` and `chat.closed` as they happen.
|
|
@@ -26,22 +25,23 @@ A pulse's end goes to the [sentinel](sentinel.md) - a chat of turri's own, opene
|
|
|
26
25
|
|
|
27
26
|
| | |
|
|
28
27
|
| --- | --- |
|
|
29
|
-
| `/chat new`, `alt+n` | a fresh chat, with the session's settings and an empty history, shown at once |
|
|
30
|
-
| `/chat 2`, `alt+2` | chat 2, shown - `alt+1` … `alt+9` |
|
|
31
|
-
| `/chat close
|
|
28
|
+
| Click `+`, `/chat new`, `alt+n` | a fresh chat, with the session's settings and an empty history, shown at once |
|
|
29
|
+
| Click tab 2, `/chat 2`, `alt+2` | chat 2, shown - `alt+1` … `alt+9` |
|
|
30
|
+
| Click a tab's `×`, `/chat close 3` | close that chat; closing a background chat leaves the one shown in place |
|
|
31
|
+
| `/chat close`, `alt+w` | close the chat shown and switch to the next one |
|
|
32
32
|
| `/chat` | a list of the chats, to pick one - or a new one |
|
|
33
33
|
| `/new` | the same as `/chat new` |
|
|
34
34
|
| `/resume` | a saved chat, opened as a chat of its own beside the others - or shown, when it is open |
|
|
35
35
|
| `ctrl+c` | what the chat shown is doing, stopped - its turn, a skill or a tool in it, a `!` command, a compaction; in a chat doing nothing, a draft in the editor cleared, else turri left, every chat with it |
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
The chat tabs sit just below the banner's horizontal rule. When the banner scrolls away, the tabs stay at the top of the fullscreen terminal. A fresh session starts with one tab and a `+` button. Click `+` to open a chat, a tab's title to switch to it, or its `×` to close it. The active tab has the accent fill and a `▸` marker when there is room. Moving the pointer over a control highlights and underlines that target, including the close button independently of its tab. Each tab shows its number and title - "new chat" until the first message, unless `/name` gives it a name - and a spinner while it works, `?` while a question waits, or `•` when it said something since you last looked. In `--tui-mode regular` the tabs scroll with the terminal; use the commands or keys to switch.
|
|
38
38
|
|
|
39
39
|
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 (`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.
|
|
40
40
|
|
|
41
41
|
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 session's second chat opens. 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.
|
|
42
42
|
|
|
43
43
|
- **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.
|
|
44
|
-
- **The side panel**
|
|
44
|
+
- **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 the spec beside the chat. Click `***plain` or `pulses` at the top of the panel to switch views, or `× close` at the top right to close the panel. `ctrl+h` and `p` are the keyboard controls. A terminal under 104 columns shows the panel full screen.
|
|
45
45
|
- **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.
|
|
46
46
|
- **`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](hosting.md)).
|
|
47
47
|
- **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).
|
package/docs/config.md
CHANGED
|
@@ -202,6 +202,8 @@ A build needs a unit testing script - and, with conformance on, a conformance te
|
|
|
202
202
|
2. the one `run_unittests*.sh` / `run_conformance_tests*.sh` in the project root;
|
|
203
203
|
3. the one of each in `test_scripts/`.
|
|
204
204
|
|
|
205
|
+
Where modules have files of their own, a module with none - nor any module it requires - never takes a script one of those files names from 2 or 3: it is another module's, of another stack. It waits for one of its own instead, saying which file names which.
|
|
206
|
+
|
|
205
207
|
The optional prepare script - `prepare-environment-script:`, else the one `prepare_environment*.sh` - is looked for the same way, and run on the build before the conformance testing script.
|
|
206
208
|
|
|
207
209
|
A folder holding two of a kind is not guessed between: name the one to use. A script named inside `plain_modules/` is refused - agents write there, so it could be changed by the work it judges. The scripts are never linked from \*\*\*plain. What they are and how they run is in [regenerating the code](regenerating.md#the-testing-scripts).
|
package/docs/regenerating.md
CHANGED
|
@@ -12,7 +12,6 @@ Every path below is in the project. What the person writes:
|
|
|
12
12
|
| --- | --- |
|
|
13
13
|
| `config.turri.yaml`, `config.turri.<module>.yaml` | the project config, and a module's own, laid over it for that module and the modules built on it - see [the project config](config.md) |
|
|
14
14
|
| `test_scripts/run_unittests_<lang>.sh`, `test_scripts/run_conformance_tests_<lang>.sh` | the testing scripts, the only judges of pass or fail - their static checks included, the formatter, linter and type checker - where `config.turri.yaml` names them, else in the project folder, else in `test_scripts/` - see [below](#the-testing-scripts) |
|
|
15
|
-
| `AGENTS.md` | optional: a section whose heading names the queue steers how the work is cut - see [how the work is cut into jobs](#how-the-work-is-cut-into-jobs) |
|
|
16
15
|
|
|
17
16
|
What a module is - each module's folder, its own git history:
|
|
18
17
|
|
|
@@ -172,7 +171,7 @@ Code accumulates up a `requires` chain: a module is built on a copy of the code
|
|
|
172
171
|
|
|
173
172
|
A module already built from \*\*\*plain as it is gets nothing. A job that does not land is rolled back, and halts its codebase: nothing more runs there until \*\*\*plain changes or the module is asked for again. On the command line, `turri regenerate` runs until nothing more can start, one line as each job starts and ends, and exits 1 when any failed.
|
|
174
173
|
|
|
175
|
-
The person halts a module's planned work too: `halt` (and `/halt`) given a planned row - `planned-<module>-2`, `planned-<module>-waiting` - or the module's name. A module's pulses are planned again from its \*\*\*plain at every look, so one planned pulse cannot be taken out alone: the module is halted - its running pulse stopped and rolled back, none of its planned pulses started, the modules built on it waiting for it - and what landed stays. A halt the person asked for holds through \*\*\*plain changes - the loop sees them without starting the module - until the module is asked for again (`regenerate`, `conform`). To
|
|
174
|
+
The person halts a module's planned work too: `halt` (and `/halt`) given a planned row - `planned-<module>-2`, `planned-<module>-waiting` - or the module's name. A module's pulses are planned again from its \*\*\*plain at every look, so one planned pulse cannot be taken out alone: the module is halted - its running pulse stopped and rolled back, none of its planned pulses started, the modules built on it waiting for it - and what landed stays. A halt the person asked for holds through \*\*\*plain changes - the loop sees them without starting the module - until the module is asked for again (`regenerate`, `conform`). To drop work, change \*\*\*plain.
|
|
176
175
|
|
|
177
176
|
A module the loop looked after whose `.plain` file is gone is forgotten - no rows, nothing waited for - and a codebase left behind, or whose \*\*\*plain no longer parses, shows nothing planned: its plan, and what it waited for, were \*\*\*plain's before.
|
|
178
177
|
|
|
@@ -190,11 +189,11 @@ Changes to what is built - an item edited or taken out, a functional spec built
|
|
|
190
189
|
|
|
191
190
|
Each planned job knows its cases - which functional specs it adds, changes (their text, or a concept they use) and takes out, or none: reqs and definitions only - and the loop says them, with each job's title, where the person looks (`drift`, `pulses`, and what `regenerate` returns).
|
|
192
191
|
|
|
193
|
-
|
|
192
|
+
How the work is cut is the planner's alone: nobody tells it which functional specs go together or what goes first. To have work built differently, change \*\*\*plain.
|
|
194
193
|
|
|
195
|
-
A plan is kept until \*\*\*plain
|
|
194
|
+
A plan is kept until \*\*\*plain or what it starts from changes. Then the work not running yet is planned again, a running job going on as it is - or [steered](#when-plain-changes), when the change is inside what it regenerates. Where a plan fell back, it says so, and what `regenerate` returns lists it under "where the plan fell back": a grouping, placement or titling that was not given or did not hold, with what was wrong, and a group split for its size. The conversation tells the person that, rather than guessing.
|
|
196
195
|
|
|
197
|
-
**Looking ahead.** What will run can be seen before it does, from the same plan: a look ahead (`WorkLoop.lookAhead` - the chat's `pulses` with a module's `plain_file`, and `turri regenerate --dry-run`) has the session's work loop plan the module as `regenerate` would - the same codebases, its config pinned
|
|
196
|
+
**Looking ahead.** What will run can be seen before it does, from the same plan: a look ahead (`WorkLoop.lookAhead` - the chat's `pulses` with a module's `plain_file`, and `turri regenerate --dry-run`) has the session's work loop plan the module as `regenerate` would - the same codebases, its config pinned - and keep the plans, starting nothing. Its codebases are held for it, apart from a halt: none of their pulses starts when another pulse ends and the loop looks again, and the look ahead writes nothing - a pure rename is not made, the work planned from the code as it would leave it. A codebase whose chain has a pulse running goes on as it was, what follows that pulse planned; a module the person halted stays halted. `regenerate`, `conform` or `/regenerate` lifts the hold, and the first pulse of the kept plan starts as it is, no planner asked again - so the plan seen is the plan run. Until then the plan is kept only while it fits: \*\*\*plain or what it starts from changed, it is dropped, not made again - only a look ahead plans a held codebase - and the next look ahead or `regenerate` plans it anew. The planned rows say they wait for `regenerate`. A planned row's id (`pulses` with `planned-<module>-1`) gives the next pulse of its codebase's whole prompt, built from the kept plan - and never planned again for it; a later pulse's prompt depends on what the ones before it land, a conformance pulse's on the code once it is built, and a codebase with a pulse running shows none. `turri regenerate --dry-run` keeps its plan only while it runs: it prints the next pulse's prompt and exits, and the `turri regenerate` after it plans again.
|
|
198
197
|
|
|
199
198
|
### When \*\*\*plain changes
|
|
200
199
|
|
|
@@ -222,7 +221,7 @@ Whether something is done is never the agent's call, and never a command it chos
|
|
|
222
221
|
|
|
223
222
|
Each is run by bash, its folders given as absolute paths - on Windows written with forward slashes (`C:/Users/...`), which Windows and Git Bash both take: GNU tar, and the other tools of Git Bash that read a backslash as an escape, would take the `\a` of `C:\Users\anton` for a bell.
|
|
224
223
|
|
|
225
|
-
The `implement-unit-testing-script` and `implement-conformance-testing-script` skills write them, in the background on the coding model of the module they are for ([background skills](skills-and-gates.md)). While one is being written - in the background, or to its end in print mode - a module built with the config it is named in waits for it, whether it lacks that script or has one being written over (a pulse started meanwhile would run against the old one) - `waiting for its unit testing script, which is being written`, or its conformance testing script - rather than fail for want of it, and is looked at again once the run ends: built, once the script is there, and stopped for want of it as before, when the run wrote none (`src/regenerate/scripts-being-written.ts`). A script written for one module's config file holds only the modules built with that file. They are looked for at the project root - the folder that holds `plain_modules` - in this order:
|
|
224
|
+
The `implement-unit-testing-script` and `implement-conformance-testing-script` skills write them, in the background on the coding model of the module they are for ([background skills](skills-and-gates.md)). While one is being written - in the background, or to its end in print mode - a module built with the config it is named in waits for it, whether it lacks that script or has one being written over (a pulse started meanwhile would run against the old one) - `waiting for its unit testing script, which is being written`, or its conformance testing script - rather than fail for want of it, and is looked at again once the run ends: built, once the script is there, and stopped for want of it as before, when the run wrote none (`src/regenerate/scripts-being-written.ts`). A script written for one module's config file holds only the modules built with that file. Asked for while the same skill writes another module's, it waits its turn, and its modules wait with it from the moment it is asked for - never started in between with the other module's script. Where the modules have config files of their own, each its own stack's, a module with none - nor any module it requires - is never given a script one of those files names: that is another module's, of another stack. Without a script of its own it waits - `waiting for a unit testing script of its own`, with which file names which - and is looked at again when a script run ends or it is asked for again, rather than start a pulse that would stop for want of one, or run another stack's tests on its code. They are looked for at the project root - the folder that holds `plain_modules` - in this order:
|
|
226
225
|
|
|
227
226
|
1. `config.turri.yaml` - with the module's own `config.turri.<module>.yaml` over it, or the one of a module it requires - naming them by path from the root:
|
|
228
227
|
|
|
@@ -234,7 +233,9 @@ The `implement-unit-testing-script` and `implement-conformance-testing-script` s
|
|
|
234
233
|
2. the root itself: the one `run_unittests*.sh` and `run_conformance_tests*.sh` there;
|
|
235
234
|
3. `test_scripts/`: the one of each there.
|
|
236
235
|
|
|
237
|
-
|
|
236
|
+
In 2 and 3 a script another module's own config file names is not a candidate for a module with no file of its own.
|
|
237
|
+
|
|
238
|
+
The same `config.turri.yaml` holds the project's other defaults - `module`, `model`, `review` - for [unattended runs](headless.md). A folder holding two of a kind is not guessed between: name the one to use in `config.turri.yaml` - or in the module's own `config.turri.<module>.yaml`. A module with no file of its own, where others have one, says so while it waits: which files there are, and which script each names. The scripts are not linked from \*\*\*plain; a link to one is ignored.
|
|
238
239
|
|
|
239
240
|
They are required: a build with no unit testing script, or with conformance on and no conformance testing script, stops before it starts and says which skill adds it.
|
|
240
241
|
|
package/docs/sandbox.md
CHANGED
|
@@ -67,6 +67,8 @@ Before an agent's command runs, its text is checked (`src/regenerate/command-che
|
|
|
67
67
|
- installs software outside the project: `sudo`, the system's package managers installing (`brew`, `apt`, `dnf`, `apk`, `pacman`, `choco`, `winget`, ...), toolchain managers installing (`nvm`, `sdk`, `rustup`, `pyenv`, `asdf`, ...), global installs (`npm -g`, `yarn global`, `pip --user`, `pipx`, `gem install`), a script downloaded and run (`curl ... | sh`), an installer (`.pkg`, `.msi`, `.dmg`, `.run`). The project's own dependencies - `npm install`, pip into its venv, `mvn`, `cargo`, `go mod` - are building the code, and pass;
|
|
68
68
|
- kills what its pulse did not start: `pkill`, `killall`, `taskkill`, `fuser -k`, or `kill` aimed at a port or name lookup. `kill $!` and `kill %1` pass.
|
|
69
69
|
|
|
70
|
+
It reads the command as the shell reads its operators: a `>`, `<`, `|`, `&` or `;` inside quotes is text (`grep -rl "</content>" .` redirects nothing), and so is the body of a here-document fed to `cat` or `tee` under a quoted delimiter (`cat > src/App.tsx <<'EOF'`) - the text of a file being written, whose `../lib/logger` is an import, not a path. A body that runs - under an unquoted delimiter, where `$(...)` expands, or fed to a shell or an interpreter - and a `$(...)` in double quotes are checked as commands.
|
|
71
|
+
|
|
70
72
|
On Windows, drive letters, backslashes and any case are read as Windows has them. It knowingly misses a path built at run time (`$(...)`, a variable, a script that reads one from a file): the OS sandbox and the audit are for those.
|
|
71
73
|
|
|
72
74
|
### The OS sandbox
|
package/docs/skills-and-gates.md
CHANGED
|
@@ -39,7 +39,7 @@ A skill declares its steps with a `## Steps` section whose `###` headings are th
|
|
|
39
39
|
|
|
40
40
|
`command-only: true` under `metadata:` keeps a skill from the model: it is started only by the person, with its slash command. None of turri's own is; turri registers the command for every such skill, the project's own too. Typed, the command puts what was typed in the chat as the person's message, and lets `cultivate` start the skill once - and so does an option starting with the command - a project's `/release-notes - for this release` - picked in the conversation's `ask_user` (`chosenCommand` in `src/skills.ts`). The answer tells the model to call `cultivate` for it at once, with the person's request word for word as its context (`startPicked`), so they never type the command after picking it; the run starting uses that up, so the model cannot start it again later on its own. Without either, `cultivate` refuses it and the model is told how the person starts it; the skill's line in `cultivate`'s list says so too.
|
|
41
41
|
|
|
42
|
-
`background: true` under `metadata:` runs a skill in the background, in the chat and a host: `cultivate` starts it and returns at once, and the chat's turn goes on. Nothing shows while it runs - no progress, no spinner - and nobody is asked anything: it has no `ask_user`, a gate it cannot pass stands, and its agent is told to decide what is left open and say what it decided. Its end comes back to the chat it was started from once that chat is idle - its agent done, nothing typed - batched (`src/background-skills.ts`): a line drawn by turri when it did its work, naming the files it changed; a message that starts a turn when it stopped at a gate, failed, or changed no file, for the chat to tell the person and decide what next. One runs at a time a skill and project, whichever chat started it;
|
|
42
|
+
`background: true` under `metadata:` runs a skill in the background, in the chat and a host: `cultivate` starts it and returns at once, and the chat's turn goes on. Nothing shows while it runs - no progress, no spinner - and nobody is asked anything: it has no `ask_user`, a gate it cannot pass stands, and its agent is told to decide what is left open and say what it decided. Its end comes back to the chat it was started from once that chat is idle - its agent done, nothing typed - batched (`src/background-skills.ts`): a line drawn by turri when it did its work, naming the files it changed; a message that starts a turn when it stopped at a gate, failed, or changed no file, for the chat to tell the person and decide what next. One runs at a time a skill and project, whichever chat started it: asked for again for the same module, nothing new starts; asked for another module - a frontend's testing script while the backend's is written - it waits its turn and starts once the run before it ends, and a testing script it is to write counts as being written from the moment it is asked for, so the modules that need it wait for it. Quitting turri stops it, and drops what waits. In pi's print, json and rpc modes, and from `turri cultivate`, it runs as any skill does, to its end. `model: coding` runs a skill on the coding model of the module it is for - `cultivate`'s `plainFile`: that module's own file's `coding-model` over the project's, and `--coding-model` over both - the model a code pulse of that module runs on; without it, a skill runs on the chat's model (`harness-model` from the command line). turri's two that write the testing scripts, `implement-unit-testing-script` and `implement-conformance-testing-script`, are its only ones that set either, and they set both.
|
|
43
43
|
|
|
44
44
|
`questioning:` under `metadata:` names the steps the questioning level caps (`src/questioning.ts`) - `[stack, product]`, say. When there are any and someone to ask, the harness itself asks the first question of the first step: how many questions those steps may ask - light (3), medium (5), thorough (10) or best judgement - and tells the agent the answer beside each step's instructions, with how broad each question is to be: broad at light, a whole area at once, narrow at thorough, an edge case at a time. Every level covers the same ground, in less or more depth. In a capped step `ask_user` refuses a question past the cap; the step's closing confirmation, asked with `confirms_phase: true`, is never counted. `end_questions` ends the step's questions sooner - best judgement's only end. What the questions leave open, the agent decides itself and says what it chose. The level, and how many questions each step has asked, are kept in the run's `run.json`, so a resumed run keeps them. A step it does not name, or a run with nobody to ask, is not capped.
|
|
45
45
|
|