@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
package/dist/regenerate/loop.js
CHANGED
|
@@ -15,7 +15,7 @@ import { adoptDigests, chainTree, codeTree, conformanceTarget, CONFORM_AGAIN, ma
|
|
|
15
15
|
import { describeSpecDiffConformance, renderSpecDiffConformance } from "./conform.js";
|
|
16
16
|
import { conformanceDirFor } from "./conformance.js";
|
|
17
17
|
import { modulesRoot, projectRootOf } from "./paths.js";
|
|
18
|
-
import { configForSpec, configModuleFor, moduleConfigFile, testDirOf, withConfigModule } from "../config.js";
|
|
18
|
+
import { configForSpec, configModuleFor, moduleConfigFile, moduleConfigsOf, testDirOf, withConfigModule } from "../config.js";
|
|
19
19
|
import { describeSpecChange } from "./prompt.js";
|
|
20
20
|
import { resolveTemplateDirs } from "./paths.js";
|
|
21
21
|
import { builtTips, copyRequiredCode, copyRequiredTests, importingModules, isImportModule, newlyRequired, resolveRequiresChain, startFromScratch } from "./requires.js";
|
|
@@ -33,7 +33,7 @@ import { baseFolderDrift, baseOfCodebase, seedFromBaseFolder } from "./base-fold
|
|
|
33
33
|
import { BASE_RECORD_FILE } from "./paths.js";
|
|
34
34
|
import { onScriptRunEnded, scriptBeingWritten } from "./scripts-being-written.js";
|
|
35
35
|
import { conformanceTestsOn } from "../conformance-switch.js";
|
|
36
|
-
import { projectRootFor } from "./test-scripts.js";
|
|
36
|
+
import { findTestScripts, projectRootFor } from "./test-scripts.js";
|
|
37
37
|
/** What is left to regenerate, as the conversation and the command line read it. */
|
|
38
38
|
export function describeDrift(reports) {
|
|
39
39
|
if (reports.length === 0)
|
|
@@ -304,6 +304,20 @@ export function createWorkLoop(options) {
|
|
|
304
304
|
// Lacking the script, or with one being written over: a pulse started now would run without it, or against the old one.
|
|
305
305
|
return scriptBeingWritten(root, kind, configModuleFor(tip.plainFile));
|
|
306
306
|
};
|
|
307
|
+
/**
|
|
308
|
+
* Why a codebase waits for a unit testing script of its own, or undefined: the project's modules name their scripts in
|
|
309
|
+
* config files of their own - each its own stack's - and none applies to it, nor names a script it could run. Its
|
|
310
|
+
* script is still to come: a pulse started now would stop for want of one. Looked at again when a script run ends, or
|
|
311
|
+
* the module is asked for again.
|
|
312
|
+
*/
|
|
313
|
+
const lacksOwnScript = (state) => {
|
|
314
|
+
const tip = tipEntry(state);
|
|
315
|
+
const root = projectRootFor(tip.plainFile, tip.buildDir);
|
|
316
|
+
if (configModuleFor(tip.plainFile) !== undefined || moduleConfigsOf(root).length === 0)
|
|
317
|
+
return undefined;
|
|
318
|
+
const found = withModuleConfig(state, () => findTestScripts(root, tip.plainFile, tip.buildDir));
|
|
319
|
+
return found.unit !== undefined ? undefined : `${NO_OWN_SCRIPT}${found.notes?.unit !== undefined ? ` ${found.notes.unit}` : ""}`;
|
|
320
|
+
};
|
|
307
321
|
/**
|
|
308
322
|
* The base folder a codebase started from, as its status says it. Counting the files still there looks at each, and the
|
|
309
323
|
* status is read often: so it is read again only when the base record or the code record moved - a pulse landed.
|
|
@@ -514,12 +528,6 @@ export function createWorkLoop(options) {
|
|
|
514
528
|
reportActivity(` ⇢ steered pulse ${running.jobId} (${steering.steers} of ${MAX_STEERS}): ${why}`);
|
|
515
529
|
return true;
|
|
516
530
|
};
|
|
517
|
-
/** How the person wants a codebase's work planned: the conversation's and AGENTS.md's steering, then the requests'. */
|
|
518
|
-
const steeringOf = (state) => [
|
|
519
|
-
...(options.steering?.(state.askedFile) ?? []),
|
|
520
|
-
...state.guidance.map((text) => ({ source: "the request that asked for the work", text })),
|
|
521
|
-
];
|
|
522
|
-
const steeringKeyOf = (state) => JSON.stringify(steeringOf(state));
|
|
523
531
|
const plan = async (state, spec, from, track = "code") => {
|
|
524
532
|
const tip = tipEntry(state);
|
|
525
533
|
const current = track === "code" ? codeTree(spec.tree) : conformanceOf(state, spec, from);
|
|
@@ -531,7 +539,6 @@ export function createWorkLoop(options) {
|
|
|
531
539
|
catch {
|
|
532
540
|
/* the layout is only for how the diffs read */
|
|
533
541
|
}
|
|
534
|
-
const steering = steeringOf(state);
|
|
535
542
|
const separately = track === "conformance" && state.conformanceSeparately === true;
|
|
536
543
|
// How big a pulse may be: the module's config, else the defaults.
|
|
537
544
|
const config = configForSpec(tip.plainFile);
|
|
@@ -540,7 +547,7 @@ export function createWorkLoop(options) {
|
|
|
540
547
|
// A pure rename is turri's to make before the next pulse, not a delete and an add: the work is planned from the code as renamed.
|
|
541
548
|
const renamed = track === "code" ? pureRenames(from, readRecord(testsDirOf(state)), spec.tree, tip.moduleName) : undefined;
|
|
542
549
|
const base = renamed !== undefined && renamed.renames.length > 0 && renamed.code !== null ? codeTree(renamed.code) : from;
|
|
543
|
-
const input = { base, current, specFile, specText,
|
|
550
|
+
const input = { base, current, specFile, specText, track, moduleName: tip.moduleName, limits, ...(separately ? { separately } : {}), ...(testPlainPath !== undefined ? { testPlainPath } : {}) };
|
|
544
551
|
const model = typeof options.plannerModel === "function" ? options.plannerModel() : options.plannerModel;
|
|
545
552
|
const agents = options.planner === false ? undefined : (options.planner ?? llmChunkAgents({ cwd: options.cwd, model: model ?? state.model, label: `${basename(tip.plainFile)} planner` }));
|
|
546
553
|
reportStage(`${tip.moduleName}: planning the ${track === "code" ? "work" : "conformance tests"} into pulses`);
|
|
@@ -876,7 +883,7 @@ export function createWorkLoop(options) {
|
|
|
876
883
|
}
|
|
877
884
|
for (const chain of chains)
|
|
878
885
|
for (const entry of toBuild(chain))
|
|
879
|
-
states.add(track(chain.slice(0, chain.indexOf(entry) + 1),
|
|
886
|
+
states.add(track(chain.slice(0, chain.indexOf(entry) + 1), request));
|
|
880
887
|
}
|
|
881
888
|
return states;
|
|
882
889
|
};
|
|
@@ -972,18 +979,16 @@ export function createWorkLoop(options) {
|
|
|
972
979
|
return;
|
|
973
980
|
}
|
|
974
981
|
}
|
|
975
|
-
// Still wanted: what comes after it is planned now, from what it will land - not once it has.
|
|
976
|
-
// changed, the code's is planned again too: what is not running yet follows it.
|
|
982
|
+
// Still wanted: what comes after it is planned now, from what it will land - not once it has.
|
|
977
983
|
const planOf = track === "code" ? state.plan : state.conformancePlan;
|
|
978
|
-
|
|
979
|
-
if (planOf === undefined || planOf.specKey !== specKey || (track === "code" && state.plan?.steeringKey !== steeringKey)) {
|
|
984
|
+
if (planOf === undefined || planOf.specKey !== specKey) {
|
|
980
985
|
const running = state.running;
|
|
981
986
|
// Shown as being planned on the regeneration; the status goes on showing the running job.
|
|
982
987
|
const rest = workOf(track, running.after, state, spec).length === 0 ? { jobs: [], notes: [] } : await planIdle(state, spec, running.after, track);
|
|
983
988
|
const next = { specKey, from: serializeTree(running.from), jobs: [running.planned, ...rest.jobs] };
|
|
984
989
|
if (state.running === running) {
|
|
985
990
|
if (track === "code")
|
|
986
|
-
state.plan = { ...next,
|
|
991
|
+
state.plan = { ...next, notes: rest.notes };
|
|
987
992
|
else
|
|
988
993
|
state.conformancePlan = { ...next, codeKey: codeKeyOf(state) };
|
|
989
994
|
}
|
|
@@ -1089,15 +1094,14 @@ export function createWorkLoop(options) {
|
|
|
1089
1094
|
return;
|
|
1090
1095
|
}
|
|
1091
1096
|
const fromKey = serializeTree(from);
|
|
1092
|
-
|
|
1093
|
-
if (state.plan === undefined || state.plan.specKey !== specKey || state.plan.from !== fromKey || state.plan.steeringKey !== steeringKey || state.plan.jobs.length === 0) {
|
|
1097
|
+
if (state.plan === undefined || state.plan.specKey !== specKey || state.plan.from !== fromKey || state.plan.jobs.length === 0) {
|
|
1094
1098
|
if (!mayPlan) {
|
|
1095
1099
|
state.plan = undefined;
|
|
1096
1100
|
state.why = LOOK_AGAIN;
|
|
1097
1101
|
return;
|
|
1098
1102
|
}
|
|
1099
1103
|
const { jobs, notes } = await planIdle(state, spec, from, "code");
|
|
1100
|
-
state.plan = { specKey, from: fromKey,
|
|
1104
|
+
state.plan = { specKey, from: fromKey, jobs, notes };
|
|
1101
1105
|
if (jobs.length === 0) {
|
|
1102
1106
|
state.why = NO_PLAN;
|
|
1103
1107
|
return;
|
|
@@ -1107,6 +1111,11 @@ export function createWorkLoop(options) {
|
|
|
1107
1111
|
state.why = SCRIPT_BEING_WRITTEN("unit testing script");
|
|
1108
1112
|
return;
|
|
1109
1113
|
}
|
|
1114
|
+
const lacking = lacksOwnScript(state);
|
|
1115
|
+
if (lacking !== undefined) {
|
|
1116
|
+
state.why = lacking;
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1110
1119
|
state.why = undefined;
|
|
1111
1120
|
startJob(state, spec, from, state.plan.jobs[0]);
|
|
1112
1121
|
};
|
|
@@ -1142,7 +1151,8 @@ export function createWorkLoop(options) {
|
|
|
1142
1151
|
const own = (jobs) => (jobs ?? []).filter((job) => job !== running);
|
|
1143
1152
|
// A track being planned again shows as that, not as its plan before - and a module asked for, from that moment, as
|
|
1144
1153
|
// its code being planned: its code deleted, what is left worked out, before the planner runs.
|
|
1145
|
-
|
|
1154
|
+
// One waiting for a module below it is shown waiting, asked for or not: nothing plans it until that one is built.
|
|
1155
|
+
const planningTrack = state.running === undefined ? (state.planning ?? (preparing.has(tipEntry(state).moduleName) && state.waitsFor === undefined ? "code" : undefined)) : undefined;
|
|
1146
1156
|
const replanning = planningTrack;
|
|
1147
1157
|
const jobs = [
|
|
1148
1158
|
...(running !== undefined ? [running] : []),
|
|
@@ -1213,11 +1223,11 @@ export function createWorkLoop(options) {
|
|
|
1213
1223
|
* Look after a codebase - its chain up to it - from now on; says its state. Its config is worked out again - its tip's
|
|
1214
1224
|
* (`configModuleFor`): `asked`, one that cannot be told refuses the ask; otherwise it keeps the one it had.
|
|
1215
1225
|
*/
|
|
1216
|
-
const track = (chain,
|
|
1226
|
+
const track = (chain, request, asked = false) => {
|
|
1217
1227
|
const tip = tipOf(chain);
|
|
1218
1228
|
let state = modules.get(tip.buildDir);
|
|
1219
1229
|
if (state === undefined) {
|
|
1220
|
-
state = { chain
|
|
1230
|
+
state = { chain };
|
|
1221
1231
|
modules.set(tip.buildDir, state);
|
|
1222
1232
|
// Bottom of the chain first: a codebase is looked at after those it is built on.
|
|
1223
1233
|
const at = order.findIndex((key) => modules.get(key).chain.some((entry) => entry.buildDir === tip.buildDir));
|
|
@@ -1227,7 +1237,6 @@ export function createWorkLoop(options) {
|
|
|
1227
1237
|
order.splice(at, 0, tip.buildDir);
|
|
1228
1238
|
}
|
|
1229
1239
|
state.chain = chain;
|
|
1230
|
-
state.askedFile = askedFile;
|
|
1231
1240
|
try {
|
|
1232
1241
|
state.configModule = { name: configModuleFor(tip.plainFile) };
|
|
1233
1242
|
}
|
|
@@ -1239,8 +1248,6 @@ export function createWorkLoop(options) {
|
|
|
1239
1248
|
const model = request.model ?? withModuleConfig(state, () => options.modelFor?.(tip.plainFile));
|
|
1240
1249
|
if (model !== undefined)
|
|
1241
1250
|
state.model = model;
|
|
1242
|
-
if (request.guidance !== undefined && !state.guidance.includes(request.guidance))
|
|
1243
|
-
state.guidance.push(request.guidance);
|
|
1244
1251
|
return state;
|
|
1245
1252
|
};
|
|
1246
1253
|
const loop = {
|
|
@@ -1253,7 +1260,7 @@ export function createWorkLoop(options) {
|
|
|
1253
1260
|
ahead.delete(file);
|
|
1254
1261
|
}
|
|
1255
1262
|
// Asked for, its config is worked out - its own file, or one of a module it requires - and pinned to its pulses.
|
|
1256
|
-
const states = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1),
|
|
1263
|
+
const states = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), given, true)))));
|
|
1257
1264
|
// Asked again, a halted codebase is tried again - one the person halted too. Looked ahead at, its kept plan starts.
|
|
1258
1265
|
for (const state of states) {
|
|
1259
1266
|
state.halted = undefined;
|
|
@@ -1261,6 +1268,13 @@ export function createWorkLoop(options) {
|
|
|
1261
1268
|
state.lookedAhead = undefined;
|
|
1262
1269
|
// Asked for again: its conformance tests are written for every functional spec with scenarios, not only those conform named.
|
|
1263
1270
|
state.conformanceOnly = undefined;
|
|
1271
|
+
// A module below it not built at all: it waits for that one, said at once - the looks go bottom first, each the
|
|
1272
|
+
// planner's time, and until its own it would show as being planned. Its look says it again, or moves it on.
|
|
1273
|
+
const below = state.running === undefined ? state.chain.slice(0, -1).find((entry) => modules.has(entry.buildDir) && !started(entry)) : undefined;
|
|
1274
|
+
if (below !== undefined && state.waitsFor === undefined) {
|
|
1275
|
+
state.waitsFor = below.moduleName;
|
|
1276
|
+
state.why = `waiting for ${below.moduleName}: the code it is built on is not built yet`;
|
|
1277
|
+
}
|
|
1264
1278
|
}
|
|
1265
1279
|
await tick();
|
|
1266
1280
|
return [...new Set(states)].map(statusOf);
|
|
@@ -1274,7 +1288,7 @@ export function createWorkLoop(options) {
|
|
|
1274
1288
|
if (!asked.has(file))
|
|
1275
1289
|
ahead.set(file, { ...ahead.get(file), ...given });
|
|
1276
1290
|
// Its config pinned as an ask pins it: the plan is made, and its pulses run, with the config regenerate would use.
|
|
1277
|
-
const tracked = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1),
|
|
1291
|
+
const tracked = withParseCache(() => files.flatMap((file) => chainsFor(file).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), given, true)))));
|
|
1278
1292
|
// A chain with a pulse running is being built as asked, and goes on; every other codebase is held - one asked for
|
|
1279
1293
|
// earlier too, which would otherwise start the work the look ahead plans.
|
|
1280
1294
|
const building = (state) => state.chain.some((entry) => modules.get(entry.buildDir)?.running !== undefined);
|
|
@@ -1317,7 +1331,7 @@ export function createWorkLoop(options) {
|
|
|
1317
1331
|
return why(`It follows ${index - 1} planned pulse${index === 2 ? "" : "s"} here: its prompt depends on what ${index === 2 ? "that one lands" : "they land"}, and is built when it starts.`);
|
|
1318
1332
|
if (job.track === "conformance")
|
|
1319
1333
|
return why("A conformance pulse's prompt is built from what the code it tests holds once it is built: it is not shown before.");
|
|
1320
|
-
// The plan as kept, and only while it fits the ***plain
|
|
1334
|
+
// The plan as kept, and only while it fits the ***plain as it is now - else regenerate would plan again.
|
|
1321
1335
|
let spec;
|
|
1322
1336
|
try {
|
|
1323
1337
|
spec = chainSpec(state.chain);
|
|
@@ -1325,8 +1339,8 @@ export function createWorkLoop(options) {
|
|
|
1325
1339
|
catch (error) {
|
|
1326
1340
|
return why(`Its ***plain does not parse now: ${error instanceof Error ? error.message : String(error)}`);
|
|
1327
1341
|
}
|
|
1328
|
-
if (state.plan === undefined || !state.plan.jobs.includes(job) || state.plan.specKey !== keyOf(spec)
|
|
1329
|
-
return why("The ***plain
|
|
1342
|
+
if (state.plan === undefined || !state.plan.jobs.includes(job) || state.plan.specKey !== keyOf(spec)) {
|
|
1343
|
+
return why("The ***plain changed since it was planned: regenerate would plan it again. Look ahead again to see the new plan.");
|
|
1330
1344
|
}
|
|
1331
1345
|
const task = await withModuleConfig(state, () => promptOf({ plainFile: tip.plainFile, spec: { ...spec, tree: job.step.tree }, planned: job }));
|
|
1332
1346
|
return task !== undefined ? { ...pulse, task } : why("It has no prompt to show.");
|
|
@@ -1386,7 +1400,7 @@ export function createWorkLoop(options) {
|
|
|
1386
1400
|
const codebase = chain.slice(0, chain.indexOf(entry) + 1);
|
|
1387
1401
|
const tip = tipOf(codebase);
|
|
1388
1402
|
// The codebase as the loop knows it, or - never asked for - as its records have it.
|
|
1389
|
-
const state = modules.get(tip.buildDir) ?? { chain: codebase
|
|
1403
|
+
const state = modules.get(tip.buildDir) ?? { chain: codebase };
|
|
1390
1404
|
return withModuleConfig(state, () => {
|
|
1391
1405
|
const report = { module: tip.moduleName, plainFile: tip.plainFile, code: undefined, conformance: undefined, ...(conformanceTestsOn(tip.plainFile) ? {} : { conformanceOff: true }) };
|
|
1392
1406
|
let spec;
|
|
@@ -1494,7 +1508,7 @@ export function createWorkLoop(options) {
|
|
|
1494
1508
|
}
|
|
1495
1509
|
}
|
|
1496
1510
|
}
|
|
1497
|
-
const tracked = withParseCache(() => (wentBack ? [own] : chainsFor(file)).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1),
|
|
1511
|
+
const tracked = withParseCache(() => (wentBack ? [own] : chainsFor(file)).flatMap((chain) => toBuild(chain).map((entry) => track(chain.slice(0, chain.indexOf(entry) + 1), request, true))));
|
|
1498
1512
|
// The module asked for, in its own codebase - and those below it: never the codebases built on it.
|
|
1499
1513
|
const asking = tracked.find((state) => tipEntry(state).buildDir === self.buildDir);
|
|
1500
1514
|
const states = asking !== undefined ? tracked.filter((state) => own.some((entry) => entry.buildDir === tipEntry(state).buildDir)) : tracked;
|
|
@@ -1766,11 +1780,13 @@ export const UP_TO_DATE = "built from the ***plain as it is";
|
|
|
1766
1780
|
const LOOKED_AHEAD = "looked ahead - planned, and nothing starts until regenerate, conform or /regenerate asks for it";
|
|
1767
1781
|
/** What a planned row of a codebase a look ahead planned says first. */
|
|
1768
1782
|
const LOOKED_AHEAD_NOTE = "Planned by a look ahead: it waits for regenerate, conform or /regenerate to start it.";
|
|
1769
|
-
/** Why a codebase held for a look ahead has no plan: its ***plain
|
|
1770
|
-
const LOOK_AGAIN = "looked ahead, and the ***plain
|
|
1783
|
+
/** Why a codebase held for a look ahead has no plan: its ***plain moved since, and only a look ahead plans it. */
|
|
1784
|
+
const LOOK_AGAIN = "looked ahead, and the ***plain changed since - look ahead again to plan it, or regenerate it";
|
|
1771
1785
|
/** Why a codebase with work left has no plan: the planner found none. */
|
|
1772
1786
|
/** Why a codebase waits for a testing script being written in the background. */
|
|
1773
1787
|
const SCRIPT_BEING_WRITTEN = (what) => `waiting for its ${what}, which is being written`;
|
|
1788
|
+
/** Why a codebase waits where modules name their testing scripts in files of their own and it has none: the note says which file names which. */
|
|
1789
|
+
const NO_OWN_SCRIPT = "waiting for a unit testing script of its own - write one for its stack (implement-unit-testing-script), named in its own config file.";
|
|
1774
1790
|
const NO_PLAN = "the planner found no way to cut the work into pulses that hold together";
|
|
1775
1791
|
/**
|
|
1776
1792
|
* Where the functional specs' test plain files of a module's chain are, by func-id and module - the module's own when none
|
|
@@ -1990,7 +2006,7 @@ export function describeModules(statuses, options = {}) {
|
|
|
1990
2006
|
? ` ${index + 1}. ${job.track === "conformance" ? "conformance tests: " : ""}${job.title} - being planned into pulses`
|
|
1991
2007
|
: ` ${index + 1}. ${job.track === "conformance" ? "conformance tests: " : ""}${job.title} - ${casesText(job.cases)}`));
|
|
1992
2008
|
if (status.planNotes !== undefined)
|
|
1993
|
-
lines.push("
|
|
2009
|
+
lines.push(" where the plan fell back:", ...status.planNotes.map((note) => ` - ${note}`));
|
|
1994
2010
|
// A look ahead from the command line keeps its plan only while the process lives: the run that starts it plans again.
|
|
1995
2011
|
if (status.why !== undefined)
|
|
1996
2012
|
lines.push(options.for === "command line" && status.why === LOOKED_AHEAD
|
|
@@ -4,6 +4,8 @@ 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";
|
|
8
|
+
import type { notificationView } from "../terminal-notifications.ts";
|
|
7
9
|
/**
|
|
8
10
|
* The side panel: the spec and how far the code has been regenerated, beside the conversation rather than instead of
|
|
9
11
|
* it.
|
|
@@ -21,6 +23,9 @@ export interface SidePanelOptions {
|
|
|
21
23
|
earlier?: () => Job[];
|
|
22
24
|
/** The regeneration's pages. Not given: the pulse list alone. */
|
|
23
25
|
map?: () => MarkedPage[];
|
|
26
|
+
notifications?: ReturnType<typeof notificationView>;
|
|
27
|
+
pointer?: PointerHover;
|
|
28
|
+
tabLabel?: ButtonPaint;
|
|
24
29
|
/** Rows the panel may use. */
|
|
25
30
|
rows: () => number;
|
|
26
31
|
style: TranscriptStyle;
|
|
@@ -53,7 +58,7 @@ export interface SidePanelOptions {
|
|
|
53
58
|
export declare function createSidePanel(options: SidePanelOptions): {
|
|
54
59
|
render(width: number): string[];
|
|
55
60
|
handleInput(data: string): void;
|
|
56
|
-
/**
|
|
61
|
+
/** View tabs switch on a click, and the wheel scrolls the panel wherever the keyboard is. */
|
|
57
62
|
handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
58
63
|
invalidate(): void;
|
|
59
64
|
};
|
|
@@ -12,6 +12,53 @@ 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 compact = options.notifications && width < 54;
|
|
41
|
+
const close = width >= 30 && !compact ? " × close " : width >= 3 ? " × " : "×";
|
|
42
|
+
const right = width - visibleWidth(close);
|
|
43
|
+
const buttons = [];
|
|
44
|
+
let x = 0;
|
|
45
|
+
if (options.map) {
|
|
46
|
+
const labels = [["map", "***plain"], ["pulses", "pulses"]];
|
|
47
|
+
if (options.notifications) {
|
|
48
|
+
const count = options.notifications.count();
|
|
49
|
+
labels.push(["notifications", `${width < 36 ? "notices" : "notifications"}${count ? ` ${count}` : ""}`]);
|
|
50
|
+
}
|
|
51
|
+
for (const [action, label] of labels) {
|
|
52
|
+
const text = truncateToWidth(` ${label} `, Math.max(0, right - x - 1), "");
|
|
53
|
+
if (!text)
|
|
54
|
+
break;
|
|
55
|
+
buttons.push({ action, text, x });
|
|
56
|
+
x += visibleWidth(text) + 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return [...buttons, { action: "close", text: close, x: right }];
|
|
60
|
+
};
|
|
61
|
+
const tabLabel = options.tabLabel ?? ((text, active) => active ? style.heading(text) : style.muted(text));
|
|
15
62
|
/** The keys back to the chat - and `s`, from over the screen to beside the chat and back. */
|
|
16
63
|
const backKeys = () => {
|
|
17
64
|
if (options.dock === undefined)
|
|
@@ -65,7 +112,7 @@ export function createSidePanel(options) {
|
|
|
65
112
|
/** The rule under the top. */
|
|
66
113
|
const rule = (width) => style.muted("─".repeat(Math.max(1, width)));
|
|
67
114
|
const renderPulses = (width, rows) => {
|
|
68
|
-
const keys = ["↑↓ move", "enter open/close", "←→", "o/c all", "pgup pgdn scroll", ...(options.map !== undefined ? ["p regen"] : []), ...backKeys()];
|
|
115
|
+
const keys = ["↑↓ move", "click/enter open/close", "←→", "o/c all", "pgup pgdn scroll", ...(options.map !== undefined ? ["p regen"] : []), ...backKeys()];
|
|
69
116
|
const top = topBlock([`${style.heading("pulses")}${waitingNote()}`], keys, width);
|
|
70
117
|
// Under the top: the rule, and a line of space - as the map has.
|
|
71
118
|
const bodyHeight = Math.max(3, rows - top.length - 2);
|
|
@@ -75,6 +122,10 @@ export function createSidePanel(options) {
|
|
|
75
122
|
const tree_ = jobsTreeLines([...options.jobs(), ...(options.earlier?.() ?? [])], tree, width, style);
|
|
76
123
|
drawnTree = { rows: tree_.rows, rowStarts: tree_.rowStarts, lineCount: tree_.lines.length };
|
|
77
124
|
keepCursorInView(tree, tree_.rowStarts, tree_.lines.length, bodyHeight);
|
|
125
|
+
hitLabels(tree_, tree.top, top.length + 2, bodyHeight, width, (row, index) => ({
|
|
126
|
+
key: `tree:${row.section}:${row.kind}:${row.kind !== "section" ? row.job.id : ""}:${row.kind === "file" ? row.file : ""}`,
|
|
127
|
+
pick: () => { tree.cursor = index; treeKey(tree, drawnTree.rows, "toggle"); },
|
|
128
|
+
}));
|
|
78
129
|
const visible = tree_.lines.slice(tree.top, tree.top + bodyHeight);
|
|
79
130
|
while (visible.length < bodyHeight)
|
|
80
131
|
visible.push("");
|
|
@@ -94,12 +145,19 @@ export function createSidePanel(options) {
|
|
|
94
145
|
const tabbed = pages.length > 1;
|
|
95
146
|
const page = shownPage(pages, map);
|
|
96
147
|
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()];
|
|
148
|
+
const keys = [...discuss, "↑↓ move", "click/enter open/close", ...(tabbed ? ["←→ module"] : []), "o/c all", "pgup pgdn", "p pulses", ...backKeys()];
|
|
98
149
|
// The legend's box in the upper right corner, over what is under it; too narrow a panel has none.
|
|
99
150
|
const box = width >= 60 ? legendBox(legendLines(page, style)) : [];
|
|
100
151
|
const room = box.length > 0 ? width - visibleWidth(box[0]) - 1 : width;
|
|
101
152
|
// 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())
|
|
153
|
+
const title = [specMapHeader(page, Number.MAX_SAFE_INTEGER, style, waitingNote())];
|
|
154
|
+
if (tabbed) {
|
|
155
|
+
const tabs = tabBar(pages, page, room, style, now);
|
|
156
|
+
const y = headerHeight + wrapTextWithAnsi(title[0], room).length;
|
|
157
|
+
for (const tab of tabs.targets)
|
|
158
|
+
hit(y, { key: `module:${tab.page.plainFile}`, x: tab.x, end: tab.end, pick: () => switchTab(pages, map, pages.indexOf(tab.page) - pages.indexOf(page)) });
|
|
159
|
+
title.push(tabs.line);
|
|
160
|
+
}
|
|
103
161
|
const top = topBlock(title, keys, room);
|
|
104
162
|
// Under the top: the rule, a line of space, and the columns' headings - two lines.
|
|
105
163
|
const bodyHeight = Math.max(3, rows - top.length - 4);
|
|
@@ -110,6 +168,19 @@ export function createSidePanel(options) {
|
|
|
110
168
|
const drawn = long ? specMapLines(pages, map, width - 2, style, options.jobs(), now) : first;
|
|
111
169
|
drawnMap = { rows: drawn.rows, rowStarts: drawn.rowStarts, lineCount: drawn.lines.length };
|
|
112
170
|
keepCursorInView(map, drawn.rowStarts, drawn.lines.length, bodyHeight);
|
|
171
|
+
const headings = columnHeadings(page, width, style);
|
|
172
|
+
const bodyY = top.length + 2 + headings.length;
|
|
173
|
+
hitLabels(drawn, map.top, bodyY, bodyHeight, long ? width - 2 : width, (row, index) => ({
|
|
174
|
+
key: `map:${row.key}`,
|
|
175
|
+
pick: () => { map.cursor = index; map.cursorKey = row.key; toggleMapRow(row); },
|
|
176
|
+
}));
|
|
177
|
+
// On a short header the legend can cover part of a body row as well.
|
|
178
|
+
for (let i = bodyY; i < box.length; i++) {
|
|
179
|
+
const y = headerHeight + i;
|
|
180
|
+
const row = hits.get(y);
|
|
181
|
+
if (row)
|
|
182
|
+
hits.set(y, row.map((target) => ({ ...target, end: Math.min(target.end, room) })));
|
|
183
|
+
}
|
|
113
184
|
const visible = drawn.lines.slice(map.top, map.top + bodyHeight).map((line) => truncateToWidth(line, long ? width - 2 : width));
|
|
114
185
|
while (visible.length < bodyHeight)
|
|
115
186
|
visible.push("");
|
|
@@ -120,7 +191,7 @@ export function createSidePanel(options) {
|
|
|
120
191
|
})()
|
|
121
192
|
: visible;
|
|
122
193
|
// The rule beside the box stops short of it.
|
|
123
|
-
return overBox([...top, rule(top.length < box.length ? room - 1 : width), "", ...
|
|
194
|
+
return overBox([...top, rule(top.length < box.length ? room - 1 : width), "", ...headings, ...body], box, width);
|
|
124
195
|
};
|
|
125
196
|
/** From the map to the pulse list: onto the pulse that regenerates the item under the cursor, when one does. */
|
|
126
197
|
const toPulses = () => {
|
|
@@ -155,6 +226,17 @@ export function createSidePanel(options) {
|
|
|
155
226
|
return;
|
|
156
227
|
}
|
|
157
228
|
};
|
|
229
|
+
const toggleMapRow = (target, open) => {
|
|
230
|
+
if (target === undefined || target.kind === "group")
|
|
231
|
+
return;
|
|
232
|
+
const to = open ?? !(target.kind === "import" ? target.open : map.open.has(target.key));
|
|
233
|
+
if (target.kind === "import")
|
|
234
|
+
map.imports.set(target.key.replace(/^import\n/, ""), to);
|
|
235
|
+
else if (to)
|
|
236
|
+
map.open.add(target.key);
|
|
237
|
+
else
|
|
238
|
+
map.open.delete(target.key);
|
|
239
|
+
};
|
|
158
240
|
/** A key in the map. */
|
|
159
241
|
const mapKey = (data) => {
|
|
160
242
|
const page = Math.max(1, lastBodyHeight - 1);
|
|
@@ -164,25 +246,12 @@ export function createSidePanel(options) {
|
|
|
164
246
|
map.cursor = Math.max(0, Math.min(rows.length - 1, to));
|
|
165
247
|
map.cursorKey = rows[map.cursor]?.key;
|
|
166
248
|
};
|
|
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
249
|
if (matchesKey(data, Key.up))
|
|
181
250
|
move(map.cursor - 1);
|
|
182
251
|
else if (matchesKey(data, Key.down))
|
|
183
252
|
move(map.cursor + 1);
|
|
184
253
|
else if (matchesKey(data, Key.enter) || data === " ")
|
|
185
|
-
|
|
254
|
+
toggleMapRow(row);
|
|
186
255
|
// ←→ go from one module's tab to the next.
|
|
187
256
|
else if (matchesKey(data, Key.right))
|
|
188
257
|
switchTab(pages, map, 1);
|
|
@@ -190,7 +259,7 @@ export function createSidePanel(options) {
|
|
|
190
259
|
switchTab(pages, map, -1);
|
|
191
260
|
else if (data === "o" || data === "c")
|
|
192
261
|
for (const entry of rows)
|
|
193
|
-
|
|
262
|
+
toggleMapRow(entry, data === "o");
|
|
194
263
|
else if (data === DISCUSS_KEY && options.discuss !== undefined) {
|
|
195
264
|
const shown = shownPage(pages, map);
|
|
196
265
|
if (shown?.stuck === true)
|
|
@@ -211,15 +280,30 @@ export function createSidePanel(options) {
|
|
|
211
280
|
};
|
|
212
281
|
return {
|
|
213
282
|
render(width) {
|
|
214
|
-
|
|
283
|
+
hits.clear();
|
|
284
|
+
let bar = "";
|
|
285
|
+
let end = 0;
|
|
286
|
+
for (const { action, text, x } of controls(width)) {
|
|
287
|
+
bar += " ".repeat(x - end) + tabLabel(text, map.view === action, options.pointer?.target === `panel:${action}`, action === "close" ? "close" : "tab");
|
|
288
|
+
end = x + visibleWidth(text);
|
|
289
|
+
}
|
|
290
|
+
const header = bar ? [bar, ""] : [];
|
|
291
|
+
headerHeight = header.length;
|
|
292
|
+
const rows = Math.max(8, options.rows()) - header.length;
|
|
215
293
|
try {
|
|
216
|
-
|
|
294
|
+
if (map.view === "notifications" && options.notifications) {
|
|
295
|
+
const lines = options.notifications.render(width, rows).slice(0, rows);
|
|
296
|
+
return [...header, ...lines, ...new Array(rows - lines.length).fill("")];
|
|
297
|
+
}
|
|
298
|
+
return [...header, ...(map.view === "map" && options.map !== undefined ? renderMap(width, rows) : renderPulses(width, rows))];
|
|
217
299
|
}
|
|
218
300
|
catch (error) {
|
|
301
|
+
hits.clear();
|
|
219
302
|
// A frame that throws is never drawn - nor is anything after it: the screen would freeze. What failed is shown instead.
|
|
220
303
|
const top = topBlock([`${style.heading(map.view === "map" ? "regen" : "pulses")}${waitingNote()}`], [...(options.map !== undefined ? ["p the other view"] : []), ...backKeys()], width);
|
|
221
304
|
const lines = (error instanceof Error ? (error.stack ?? error.message) : String(error)).split("\n").slice(0, Math.max(1, rows - top.length - 1));
|
|
222
305
|
return [
|
|
306
|
+
...header,
|
|
223
307
|
...top,
|
|
224
308
|
rule(width),
|
|
225
309
|
...lines.map((line, index) => truncateToWidth(index === 0 ? style.error(`could not be drawn: ${line}`) : style.muted(line), width)),
|
|
@@ -228,6 +312,17 @@ export function createSidePanel(options) {
|
|
|
228
312
|
}
|
|
229
313
|
},
|
|
230
314
|
handleInput(data) {
|
|
315
|
+
if (map.view === "notifications" && options.notifications) {
|
|
316
|
+
if (!options.notifications.inDetail() && data === "p")
|
|
317
|
+
return toPulses();
|
|
318
|
+
if (!options.notifications.inDetail() && data === "s" && options.dock)
|
|
319
|
+
return options.dock.toggle();
|
|
320
|
+
return options.notifications.handleInput(data);
|
|
321
|
+
}
|
|
322
|
+
if (data === "n" && options.notifications) {
|
|
323
|
+
map.view = "notifications";
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
231
326
|
if (matchesKey(data, Key.escape)) {
|
|
232
327
|
options.back();
|
|
233
328
|
return;
|
|
@@ -274,8 +369,49 @@ export function createSidePanel(options) {
|
|
|
274
369
|
else if (matchesKey(data, Key.end) || data === "G")
|
|
275
370
|
tree.cursor = Math.max(0, drawnTree.rows.length - 1);
|
|
276
371
|
},
|
|
277
|
-
/**
|
|
372
|
+
/** View tabs switch on a click, and the wheel scrolls the panel wherever the keyboard is. */
|
|
278
373
|
handleMouse(event) {
|
|
374
|
+
const down = pressed;
|
|
375
|
+
if (event.type === "press" || event.type === "click")
|
|
376
|
+
pressed = undefined;
|
|
377
|
+
if (event.y === 0 && (event.type === "move" || (event.button === "left" && (event.type === "press" || event.type === "click")))) {
|
|
378
|
+
for (const { action, text, x } of controls(event.width)) {
|
|
379
|
+
if (event.x >= x && event.x < x + visibleWidth(text)) {
|
|
380
|
+
if (options.pointer)
|
|
381
|
+
options.pointer.target = `panel:${action}`;
|
|
382
|
+
if (event.type === "move")
|
|
383
|
+
return { handled: true, render: false };
|
|
384
|
+
if (event.type === "press")
|
|
385
|
+
pressed = action;
|
|
386
|
+
else if (action === down && action !== map.view) {
|
|
387
|
+
if (action === "close")
|
|
388
|
+
options.close();
|
|
389
|
+
else if (action === "notifications")
|
|
390
|
+
map.view = "notifications";
|
|
391
|
+
else if (action === "map")
|
|
392
|
+
toMap();
|
|
393
|
+
else
|
|
394
|
+
toPulses();
|
|
395
|
+
}
|
|
396
|
+
return { handled: true };
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
if (map.view === "notifications" && options.notifications) {
|
|
401
|
+
if (event.y < headerHeight)
|
|
402
|
+
return;
|
|
403
|
+
return options.notifications.handleMouse({ ...event, y: event.y - headerHeight, height: event.height - headerHeight });
|
|
404
|
+
}
|
|
405
|
+
if (event.button === "left" && (event.type === "press" || event.type === "click")) {
|
|
406
|
+
const target = hits.get(event.y)?.find(({ x, end }) => event.x >= x && event.x < end);
|
|
407
|
+
if (target) {
|
|
408
|
+
if (event.type === "press")
|
|
409
|
+
pressed = target.key;
|
|
410
|
+
else if (down === target.key)
|
|
411
|
+
target.pick();
|
|
412
|
+
return { handled: true };
|
|
413
|
+
}
|
|
414
|
+
}
|
|
279
415
|
if (event.type !== "wheel" || event.wheelDelta === undefined)
|
|
280
416
|
return undefined;
|
|
281
417
|
if (map.view === "map" && options.map !== undefined)
|
|
@@ -12,8 +12,8 @@ import type { TranscriptStyle } from "./transcript-view.ts";
|
|
|
12
12
|
* folded block each. A chain of many modules nested one in another was too deep to read, and too much to draw.
|
|
13
13
|
*/
|
|
14
14
|
export interface SpecMapState {
|
|
15
|
-
/** Which
|
|
16
|
-
view: "map" | "pulses";
|
|
15
|
+
/** Which tab the side panel shows. */
|
|
16
|
+
view: "map" | "pulses" | "notifications";
|
|
17
17
|
/** The row the cursor is on, and the key of what is there - it stays on the item when rows move. */
|
|
18
18
|
cursor: number;
|
|
19
19
|
cursorKey?: string;
|
|
@@ -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
|
};
|