pi-spine 1.0.2 → 1.2.0
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 +61 -489
- package/bin/get-version.mjs +1 -13
- package/bin/spine-batch.mjs +162 -51
- package/bin/spine-cli/batch.mjs +3 -3
- package/bin/spine-cli/lane-logs.mjs +24 -0
- package/bin/spine-cli/scenarios.mjs +298 -0
- package/bin/spine-cli/wait.mjs +30 -0
- package/bin/spine-cli/watch.mjs +27 -0
- package/bin/spine-config.mjs +1 -212
- package/bin/spine-doctor.mjs +2 -418
- package/bin/spine-init.mjs +1 -398
- package/bin/spine-issue.mjs +196 -0
- package/bin/spine-journal.mjs +1 -0
- package/bin/spine-preflight.mjs +1 -700
- package/bin/spine-review-step.mjs +6 -4
- package/bin/spine-run.mjs +30 -0
- package/bin/spine-status.mjs +19 -1
- package/bin/spine-tasks.mjs +112 -13
- package/bin/spine-worker-runner.mjs +24 -14
- package/bin/spine.mjs +52 -2
- package/extensions/spine/worker-tools.ts +14 -12
- package/package.json +5 -2
- package/skills/create-spine-tasks/SKILL.md +135 -6
- package/skills/create-spine-tasks/references/clarify-template.md +73 -0
- package/skills/create-spine-tasks/references/contract-template.md +19 -0
- package/skills/create-spine-tasks/references/prompt-template.md +2 -0
- package/skills/create-spine-tasks/references/requirements-checklist-template.md +94 -0
- package/src/batch/abort.mjs +3 -12
- package/src/batch/agent-session-worker.mjs +45 -5
- package/src/batch/attached-engine-handoff.mjs +188 -0
- package/src/batch/attached-runner.mjs +312 -0
- package/src/batch/contract-prelanded.mjs +180 -0
- package/src/batch/contract-verify.mjs +140 -2
- package/src/batch/detached-start.mjs +105 -7
- package/src/batch/diagnosis-alternatives.mjs +46 -0
- package/src/batch/diagnosis-merge-failure.mjs +79 -0
- package/src/batch/diagnosis-retry-limbo.mjs +34 -0
- package/src/batch/diagnosis-stub.mjs +109 -0
- package/src/batch/diagnosis-task-done.mjs +110 -0
- package/src/batch/diagnosis-worker-done-missing.mjs +96 -0
- package/src/batch/diagnosis.mjs +174 -62
- package/src/batch/engine-lanes/merge.mjs +168 -77
- package/src/batch/engine-lanes/queue.mjs +4 -1
- package/src/batch/engine-lanes/review.mjs +32 -74
- package/src/batch/engine-lanes/watch.mjs +29 -0
- package/src/batch/engine-lanes.mjs +1 -0
- package/src/batch/engine-scope.mjs +42 -5
- package/src/batch/engine.mjs +115 -68
- package/src/batch/evidence.mjs +81 -17
- package/src/batch/gate.mjs +46 -17
- package/src/batch/git-helpers.mjs +96 -0
- package/src/batch/heartbeat.mjs +73 -7
- package/src/batch/integrate.mjs +3 -5
- package/src/batch/journal.mjs +25 -0
- package/src/batch/lane-commit.mjs +90 -5
- package/src/batch/lifecycle.mjs +131 -4
- package/src/batch/macro-phase.mjs +226 -0
- package/src/batch/merge/adoption-doc-merge.mjs +243 -0
- package/src/batch/merge/wave-merge-state.mjs +108 -0
- package/src/batch/metrics.mjs +74 -5
- package/src/batch/orphan-detect.mjs +74 -0
- package/src/batch/pause.mjs +223 -0
- package/src/batch/post-merge-limbo.mjs +345 -17
- package/src/batch/reconcile.mjs +473 -50
- package/src/batch/resume-common.mjs +6 -2
- package/src/batch/resume-engine.mjs +58 -1
- package/src/batch/resume-lane-reviews.mjs +16 -0
- package/src/batch/resume-multi-lanes.mjs +56 -1
- package/src/batch/resume-multi-validate.mjs +148 -8
- package/src/batch/resume-multi.mjs +45 -44
- package/src/batch/resume.mjs +64 -47
- package/src/batch/retry.mjs +56 -5
- package/src/batch/review-shared.mjs +196 -0
- package/src/batch/review-spawn.mjs +326 -0
- package/src/batch/review.mjs +178 -212
- package/src/batch/rules-manifest-drift.mjs +157 -0
- package/src/batch/salvage.mjs +2 -1
- package/src/batch/sequence.mjs +454 -0
- package/src/batch/state.mjs +18 -3
- package/src/batch/status-json.mjs +67 -0
- package/src/batch/task-stall-budget.mjs +94 -10
- package/src/batch/worker-host.mjs +185 -37
- package/src/batch/worker-output.mjs +196 -3
- package/src/batch/worktree.mjs +10 -0
- package/src/cli/handoff.mjs +1 -1
- package/src/cli/issue-draft.mjs +180 -0
- package/src/cli/journal-follow.mjs +239 -0
- package/src/cli/lane-logs.mjs +291 -0
- package/src/cli/rules.mjs +1 -1
- package/src/cli/sequence.mjs +108 -0
- package/src/cli/settings-set.mjs +3 -22
- package/src/cli/settings-slash.mjs +27 -5
- package/src/cli/wait.mjs +187 -0
- package/src/cli/watch.mjs +160 -0
- package/src/config/agent-model-resolve.mjs +48 -0
- package/src/config/cursor-rules/discover.mjs +3 -21
- package/src/config/defaults.mjs +7 -1
- package/src/config/settings-fields.mjs +48 -0
- package/src/config/spine-config-load.mjs +221 -0
- package/src/config/spine-init-constants.mjs +424 -0
- package/src/config/spine-preflight-lib.mjs +1180 -0
- package/src/dashboard/lane-throughput.mjs +351 -0
- package/src/dashboard/public/dashboard.css +25 -1
- package/src/dashboard/public/dashboard.js +224 -40
- package/src/dashboard/public/index.html +15 -9
- package/src/dashboard/server.mjs +4 -0
- package/src/dashboard/snapshot.mjs +387 -6
- package/src/dashboard/view.mjs +170 -15
- package/src/doctor/agent-model-inherit.mjs +61 -6
- package/src/doctor/run-doctor-checks.mjs +483 -0
- package/src/doctor/sequence-safety.mjs +57 -0
- package/src/doctor/stale-path.mjs +22 -0
- package/src/doctor/stale-worktrees.mjs +102 -0
- package/src/fixtures/scenario-registry.mjs +194 -0
- package/src/fs/atomic-write.mjs +49 -0
- package/src/migrate/taskplane-config.mjs +1 -1
- package/src/planner/file-scope.mjs +246 -0
- package/src/planner/format-plan.mjs +9 -7
- package/src/planner/index.mjs +6 -2
- package/src/planner/pending.mjs +92 -1
- package/src/planner/wave-scope.mjs +136 -0
- package/src/planner/waves.mjs +133 -0
- package/src/tasks/analyze/index.mjs +453 -0
- package/src/tasks/packet/index.mjs +1 -0
- package/src/tasks/packet/parse-prompt.mjs +42 -1
- package/src/tasks/packet/validate-prompt.mjs +124 -0
- package/src/util/command-exists.mjs +19 -0
- package/templates/docs/constitution.md +61 -0
- package/templates/spine-config.json +9 -2
|
@@ -16,6 +16,12 @@ function formatHeartbeat(age) {
|
|
|
16
16
|
return `${age}s`;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/** @param {{ heartbeatDisplay?: string|null, heartbeatAgeSeconds?: number|null }} lane */
|
|
20
|
+
function displayHeartbeat(lane) {
|
|
21
|
+
if (lane.heartbeatDisplay != null) return lane.heartbeatDisplay;
|
|
22
|
+
return formatHeartbeat(lane.heartbeatAgeSeconds);
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
/** @param {"connecting"|"live"|"error"} state @param {string} text */
|
|
20
26
|
function setConnection(state, text) {
|
|
21
27
|
const el = $("connection-status");
|
|
@@ -124,6 +130,7 @@ function renderBatch(batch) {
|
|
|
124
130
|
if (!batch) return;
|
|
125
131
|
appendKv(dl, "Batch ID", batch.batchId);
|
|
126
132
|
appendKv(dl, "Phase", batch.phase);
|
|
133
|
+
appendKv(dl, "Macro phase", batch.macroPhaseLabel);
|
|
127
134
|
appendKv(dl, "Base", batch.baseBranch);
|
|
128
135
|
appendKv(dl, "Orch", batch.orchBranch);
|
|
129
136
|
appendKv(dl, "Started", formatTs(batch.startedAt));
|
|
@@ -137,10 +144,13 @@ function renderBatch(batch) {
|
|
|
137
144
|
|
|
138
145
|
/** @param {ReturnType<typeof buildDashboardViewModel>["waves"]} waves */
|
|
139
146
|
function renderWaves(waves) {
|
|
147
|
+
const macroSuffix = waves.macroPhaseLabel ? ` · ${waves.macroPhaseLabel}` : "";
|
|
140
148
|
$("wave-progress-summary").textContent =
|
|
141
149
|
waves.totalWaves > 0
|
|
142
|
-
? `Wave ${waves.currentWaveIndex + 1} of ${waves.totalWaves} — lane ≠ wave (see Lanes table)`
|
|
143
|
-
:
|
|
150
|
+
? `Wave ${waves.currentWaveIndex + 1} of ${waves.totalWaves}${macroSuffix} — lane ≠ wave (see Lanes table)`
|
|
151
|
+
: waves.macroPhaseLabel
|
|
152
|
+
? `${waves.macroPhaseLabel} — no waves`
|
|
153
|
+
: "No waves";
|
|
144
154
|
const list = $("wave-list");
|
|
145
155
|
list.replaceChildren();
|
|
146
156
|
for (const wave of waves.waves) {
|
|
@@ -151,14 +161,57 @@ function renderWaves(waves) {
|
|
|
151
161
|
}
|
|
152
162
|
}
|
|
153
163
|
|
|
154
|
-
/** @param {
|
|
155
|
-
function
|
|
164
|
+
/** @param {string|null|undefined} taskId */
|
|
165
|
+
function formatRunningCell(taskId) {
|
|
166
|
+
if (!taskId) return "—";
|
|
167
|
+
return `▶ ${taskId}`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** @param {string[]} taskIds */
|
|
171
|
+
function formatQueuedCell(taskIds) {
|
|
172
|
+
if (!taskIds?.length) return "—";
|
|
173
|
+
return taskIds.map((id) => `○ ${id}`).join(", ");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @param {string|null|undefined} taskId */
|
|
177
|
+
function runningCellAriaLabel(taskId) {
|
|
178
|
+
if (!taskId) return "No running task";
|
|
179
|
+
return `Running task ${taskId}`;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** @param {string[]} taskIds */
|
|
183
|
+
function queuedCellAriaLabel(taskIds) {
|
|
184
|
+
const count = taskIds?.length ?? 0;
|
|
185
|
+
if (count === 0) return "No tasks waiting in lane queue";
|
|
186
|
+
if (count === 1) return "1 task waiting in lane queue";
|
|
187
|
+
return `${count} tasks waiting in lane queue`;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** @param {HTMLElement} td @param {string} text @param {string} className @param {string} ariaLabel */
|
|
191
|
+
function appendLaneTextCell(td, text, className, ariaLabel) {
|
|
192
|
+
td.textContent = text;
|
|
193
|
+
td.className = className;
|
|
194
|
+
td.setAttribute("aria-label", ariaLabel);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** @param {ReturnType<typeof buildDashboardViewModel>["lanes"]} lanes @param {ReturnType<typeof buildDashboardViewModel>["laneTableSummary"]} laneTableSummary @param {string|null} expandedLaneId */
|
|
198
|
+
function renderLanes(lanes, laneTableSummary, expandedLaneId) {
|
|
156
199
|
const tbody = $("lane-table-body");
|
|
157
200
|
tbody.replaceChildren();
|
|
201
|
+
const columnCount = 11;
|
|
202
|
+
const maxQueuedCount = lanes.reduce(
|
|
203
|
+
(max, lane) => Math.max(max, lane.queuedCount ?? lane.queuedTaskIds?.length ?? 0),
|
|
204
|
+
0,
|
|
205
|
+
);
|
|
206
|
+
const queuedHeading = $("lane-queued-heading");
|
|
207
|
+
if (queuedHeading) {
|
|
208
|
+
queuedHeading.textContent =
|
|
209
|
+
maxQueuedCount > 0 ? `Queued (${maxQueuedCount})` : "Queued";
|
|
210
|
+
}
|
|
158
211
|
if (!lanes.length) {
|
|
159
212
|
const tr = document.createElement("tr");
|
|
160
213
|
const td = document.createElement("td");
|
|
161
|
-
td.colSpan =
|
|
214
|
+
td.colSpan = columnCount;
|
|
162
215
|
td.className = "empty-hint";
|
|
163
216
|
td.textContent = "No lanes";
|
|
164
217
|
tr.appendChild(td);
|
|
@@ -167,34 +220,153 @@ function renderLanes(lanes) {
|
|
|
167
220
|
}
|
|
168
221
|
for (const lane of lanes) {
|
|
169
222
|
const tr = document.createElement("tr");
|
|
223
|
+
tr.className = "lane-row";
|
|
224
|
+
if (lane.laneId === expandedLaneId) {
|
|
225
|
+
tr.classList.add("lane-row-expanded");
|
|
226
|
+
}
|
|
227
|
+
tr.dataset.laneId = lane.laneId;
|
|
228
|
+
tr.setAttribute("aria-expanded", lane.laneId === expandedLaneId ? "true" : "false");
|
|
170
229
|
const statusLabel =
|
|
171
230
|
lane.laneAlert === "checkpoint-warning"
|
|
172
231
|
? `${lane.status} · checkpoint warning`
|
|
173
232
|
: lane.laneAlert === "stall-killed"
|
|
174
233
|
? `${lane.status} · stall killed`
|
|
175
234
|
: lane.status;
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
lane.
|
|
235
|
+
const throughput = lane.throughput ?? {};
|
|
236
|
+
const runningText = formatRunningCell(lane.runningTaskId);
|
|
237
|
+
const queuedText = formatQueuedCell(lane.queuedTaskIds ?? []);
|
|
238
|
+
const cellSpecs = [
|
|
239
|
+
{ text: lane.laneId, className: "", ariaLabel: null },
|
|
240
|
+
{ text: statusLabel, className: `lane-status-${lane.status}`, ariaLabel: null, statusCell: true },
|
|
241
|
+
{ text: lane.activityPhaseLabel ?? "—", className: "", ariaLabel: null },
|
|
242
|
+
{
|
|
243
|
+
text: runningText,
|
|
244
|
+
className: "lane-task-running",
|
|
245
|
+
ariaLabel: runningCellAriaLabel(lane.runningTaskId),
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
text: queuedText,
|
|
249
|
+
className: "lane-task-queued",
|
|
250
|
+
ariaLabel: queuedCellAriaLabel(lane.queuedTaskIds ?? []),
|
|
251
|
+
},
|
|
252
|
+
{ text: (lane.taskIds ?? []).join(", ") || "—", className: "", ariaLabel: null },
|
|
253
|
+
{ text: displayHeartbeat(lane), className: "", ariaLabel: null },
|
|
254
|
+
{ text: throughput.elapsedDisplay ?? "—", className: "", ariaLabel: null },
|
|
255
|
+
{ text: throughput.doneDisplay ?? "—", className: "", ariaLabel: null },
|
|
256
|
+
{ text: throughput.rateDisplay ?? "—", className: "", ariaLabel: null },
|
|
257
|
+
{ text: lane.worktree ?? "—", className: "", ariaLabel: null },
|
|
183
258
|
];
|
|
184
|
-
|
|
259
|
+
cellSpecs.forEach((spec, index) => {
|
|
185
260
|
const td = document.createElement("td");
|
|
186
|
-
|
|
261
|
+
if (spec.ariaLabel) {
|
|
262
|
+
appendLaneTextCell(td, spec.text, spec.className, spec.ariaLabel);
|
|
263
|
+
} else {
|
|
264
|
+
td.textContent = spec.text;
|
|
265
|
+
if (spec.className) td.className = spec.className;
|
|
266
|
+
}
|
|
187
267
|
if (index === 1) {
|
|
188
|
-
td.className = `lane-status-${lane.status}`;
|
|
189
268
|
if (lane.laneAlert === "checkpoint-warning") td.classList.add("lane-alert-checkpoint");
|
|
190
269
|
if (lane.laneAlert === "stall-killed") td.classList.add("lane-alert-stall");
|
|
191
270
|
}
|
|
271
|
+
if (index === 3) td.classList.add("col-running");
|
|
272
|
+
if (index === 4) td.classList.add("col-queued");
|
|
273
|
+
tr.appendChild(td);
|
|
274
|
+
});
|
|
275
|
+
tr.addEventListener("click", () => {
|
|
276
|
+
expandedLaneIdState = expandedLaneIdState === lane.laneId ? null : lane.laneId;
|
|
277
|
+
if (lastSnapshot) renderSnapshot(lastSnapshot);
|
|
278
|
+
});
|
|
279
|
+
tbody.appendChild(tr);
|
|
280
|
+
|
|
281
|
+
if (lane.laneId === expandedLaneId) {
|
|
282
|
+
const detailRow = document.createElement("tr");
|
|
283
|
+
detailRow.className = "lane-detail-row";
|
|
284
|
+
const detailCell = document.createElement("td");
|
|
285
|
+
detailCell.colSpan = columnCount;
|
|
286
|
+
detailCell.appendChild(renderLaneDetailPanel(lane));
|
|
287
|
+
detailRow.appendChild(detailCell);
|
|
288
|
+
tbody.appendChild(detailRow);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (laneTableSummary) {
|
|
292
|
+
const tr = document.createElement("tr");
|
|
293
|
+
tr.className = "lane-table-summary";
|
|
294
|
+
const values = [
|
|
295
|
+
"All lanes",
|
|
296
|
+
"—",
|
|
297
|
+
"—",
|
|
298
|
+
"—",
|
|
299
|
+
"—",
|
|
300
|
+
"—",
|
|
301
|
+
"—",
|
|
302
|
+
laneTableSummary.elapsedDisplay ?? "—",
|
|
303
|
+
laneTableSummary.doneDisplay ?? "—",
|
|
304
|
+
laneTableSummary.rateDisplay ?? "—",
|
|
305
|
+
"—",
|
|
306
|
+
];
|
|
307
|
+
values.forEach((text) => {
|
|
308
|
+
const td = document.createElement("td");
|
|
309
|
+
td.textContent = text;
|
|
192
310
|
tr.appendChild(td);
|
|
193
311
|
});
|
|
194
312
|
tbody.appendChild(tr);
|
|
195
313
|
}
|
|
196
314
|
}
|
|
197
315
|
|
|
316
|
+
/** @param {ReturnType<typeof buildDashboardViewModel>["lanes"][number]} lane */
|
|
317
|
+
function renderLaneDetailPanel(lane) {
|
|
318
|
+
const panel = document.createElement("div");
|
|
319
|
+
panel.className = "lane-detail-panel";
|
|
320
|
+
|
|
321
|
+
const eventsSection = document.createElement("section");
|
|
322
|
+
eventsSection.className = "lane-detail-section";
|
|
323
|
+
const eventsHeading = document.createElement("h4");
|
|
324
|
+
eventsHeading.textContent = "Recent journal (5)";
|
|
325
|
+
eventsSection.appendChild(eventsHeading);
|
|
326
|
+
const eventsList = document.createElement("ol");
|
|
327
|
+
eventsList.className = "lane-detail-events";
|
|
328
|
+
const recentEvents = lane.detail?.recentEvents ?? [];
|
|
329
|
+
if (!recentEvents.length) {
|
|
330
|
+
const li = document.createElement("li");
|
|
331
|
+
li.className = "empty-hint";
|
|
332
|
+
li.textContent = "No lane events";
|
|
333
|
+
eventsList.appendChild(li);
|
|
334
|
+
} else {
|
|
335
|
+
for (const entry of recentEvents) {
|
|
336
|
+
const li = document.createElement("li");
|
|
337
|
+
li.textContent = `${formatTs(entry.timestamp)} · ${entry.type}: ${entry.summary}`;
|
|
338
|
+
eventsList.appendChild(li);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
eventsSection.appendChild(eventsList);
|
|
342
|
+
|
|
343
|
+
const logSection = document.createElement("section");
|
|
344
|
+
logSection.className = "lane-detail-section";
|
|
345
|
+
const logHeading = document.createElement("h4");
|
|
346
|
+
logHeading.textContent = "Worker log (10 lines)";
|
|
347
|
+
logSection.appendChild(logHeading);
|
|
348
|
+
if (lane.detail?.workerLogRef) {
|
|
349
|
+
const logRef = document.createElement("p");
|
|
350
|
+
logRef.className = "lane-detail-log-ref";
|
|
351
|
+
logRef.textContent = lane.detail.workerLogRef;
|
|
352
|
+
logSection.appendChild(logRef);
|
|
353
|
+
}
|
|
354
|
+
const logLines = lane.detail?.logTail ?? [];
|
|
355
|
+
if (!logLines.length) {
|
|
356
|
+
const empty = document.createElement("p");
|
|
357
|
+
empty.className = "empty-hint";
|
|
358
|
+
empty.textContent = "No log output";
|
|
359
|
+
logSection.appendChild(empty);
|
|
360
|
+
} else {
|
|
361
|
+
const pre = document.createElement("pre");
|
|
362
|
+
pre.textContent = logLines.join("\n");
|
|
363
|
+
logSection.appendChild(pre);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
panel.append(eventsSection, logSection);
|
|
367
|
+
return panel;
|
|
368
|
+
}
|
|
369
|
+
|
|
198
370
|
/** @param {ReturnType<typeof buildDashboardViewModel>["journal"]} journal @param {HTMLElement} listEl */
|
|
199
371
|
function renderJournalList(listEl, journal) {
|
|
200
372
|
listEl.replaceChildren();
|
|
@@ -249,42 +421,45 @@ function renderGatePanel(gateAffordance) {
|
|
|
249
421
|
}
|
|
250
422
|
|
|
251
423
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* @param {ReturnType<typeof buildDashboardViewModel>["journal"]} journal
|
|
255
|
-
* @param {boolean} showFullJournalLink
|
|
256
|
-
*/
|
|
257
|
-
function renderDefaultJournalTail(journal, showFullJournalLink) {
|
|
258
|
-
const section = $("default-journal-section");
|
|
259
|
-
const deepLink = $("default-journal-deep-link");
|
|
260
|
-
|
|
261
|
-
section.hidden = false;
|
|
262
|
-
renderJournalList($("default-journal-list"), journal);
|
|
263
|
-
deepLink.hidden = !showFullJournalLink;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Default view panels: integrate gate (when applicable) and journal tail for active batches.
|
|
424
|
+
* Default view panels: integrate gate when applicable.
|
|
268
425
|
*
|
|
269
426
|
* @param {ReturnType<typeof buildDashboardViewModel>} vm
|
|
270
427
|
*/
|
|
271
428
|
function renderDefaultStatusPanels(vm) {
|
|
272
429
|
const section = $("default-status-panels");
|
|
273
430
|
const showGate = vm.gateAffordance?.visible;
|
|
274
|
-
const showJournal = !vm.idle;
|
|
275
431
|
|
|
276
|
-
if (!showGate
|
|
432
|
+
if (!showGate) {
|
|
277
433
|
section.hidden = true;
|
|
278
434
|
return;
|
|
279
435
|
}
|
|
280
436
|
|
|
281
437
|
section.hidden = false;
|
|
282
438
|
renderGatePanel(vm.gateAffordance);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** @param {ReturnType<typeof buildDashboardViewModel>["journalLaneFilterOptions"]} options */
|
|
442
|
+
function renderJournalLaneFilter(options) {
|
|
443
|
+
const select = $("journal-lane-filter");
|
|
444
|
+
const current = journalLaneFilterState;
|
|
445
|
+
select.replaceChildren();
|
|
446
|
+
const allOption = document.createElement("option");
|
|
447
|
+
allOption.value = "";
|
|
448
|
+
allOption.textContent = "All lanes";
|
|
449
|
+
select.appendChild(allOption);
|
|
450
|
+
for (const option of options ?? []) {
|
|
451
|
+
const el = document.createElement("option");
|
|
452
|
+
el.value = option.laneId;
|
|
453
|
+
el.textContent = option.label;
|
|
454
|
+
select.appendChild(el);
|
|
455
|
+
}
|
|
456
|
+
select.value = current ?? "";
|
|
457
|
+
if (!select.dataset.bound) {
|
|
458
|
+
select.dataset.bound = "1";
|
|
459
|
+
select.addEventListener("change", () => {
|
|
460
|
+
journalLaneFilterState = select.value || null;
|
|
461
|
+
if (lastSnapshot) renderSnapshot(lastSnapshot);
|
|
462
|
+
});
|
|
288
463
|
}
|
|
289
464
|
}
|
|
290
465
|
|
|
@@ -293,16 +468,25 @@ function renderJournal(journal) {
|
|
|
293
468
|
renderJournalList($("journal-list"), journal);
|
|
294
469
|
}
|
|
295
470
|
|
|
471
|
+
/** @type {object|null} */
|
|
472
|
+
let lastSnapshot = null;
|
|
473
|
+
/** @type {string|null} */
|
|
474
|
+
let expandedLaneIdState = null;
|
|
475
|
+
/** @type {string|null} */
|
|
476
|
+
let journalLaneFilterState = null;
|
|
477
|
+
|
|
296
478
|
/** @param {object} snapshot */
|
|
297
479
|
export function renderSnapshot(snapshot) {
|
|
298
|
-
|
|
480
|
+
lastSnapshot = snapshot;
|
|
481
|
+
const vm = buildDashboardViewModel(snapshot, { journalLaneFilter: journalLaneFilterState });
|
|
299
482
|
$("active-panels").hidden = vm.idle;
|
|
300
483
|
renderBanner(vm);
|
|
301
484
|
renderDefaultStatusPanels(vm);
|
|
302
485
|
if (!vm.idle) {
|
|
303
486
|
renderBatch(vm.batch);
|
|
304
487
|
renderWaves(vm.waves);
|
|
305
|
-
renderLanes(vm.lanes);
|
|
488
|
+
renderLanes(vm.lanes, vm.laneTableSummary, expandedLaneIdState);
|
|
489
|
+
renderJournalLaneFilter(vm.journalLaneFilterOptions);
|
|
306
490
|
renderJournal(vm.journal);
|
|
307
491
|
}
|
|
308
492
|
$("snapshot-time").textContent = vm.generatedAt ? `Snapshot: ${vm.generatedAt}` : "";
|
|
@@ -25,13 +25,6 @@
|
|
|
25
25
|
<h3 id="gate-heading">Integrate gate</h3>
|
|
26
26
|
<div id="gate-panel" class="gate-panel"></div>
|
|
27
27
|
</section>
|
|
28
|
-
<section id="default-journal-section" class="panel panel-wide" aria-labelledby="default-journal-heading" hidden>
|
|
29
|
-
<h3 id="default-journal-heading">Journal tail</h3>
|
|
30
|
-
<ol id="default-journal-list" class="journal-list"></ol>
|
|
31
|
-
<p id="default-journal-deep-link" class="journal-deep-link" hidden>
|
|
32
|
-
<a href="#journal-heading">View full journal</a>
|
|
33
|
-
</p>
|
|
34
|
-
</section>
|
|
35
28
|
</section>
|
|
36
29
|
|
|
37
30
|
<main class="panels" id="active-panels" hidden>
|
|
@@ -54,9 +47,14 @@
|
|
|
54
47
|
<tr>
|
|
55
48
|
<th scope="col">Lane</th>
|
|
56
49
|
<th scope="col">Status</th>
|
|
57
|
-
<th scope="col">
|
|
50
|
+
<th scope="col">Phase</th>
|
|
51
|
+
<th scope="col" class="col-running">Running</th>
|
|
52
|
+
<th scope="col" class="col-queued" id="lane-queued-heading">Queued</th>
|
|
58
53
|
<th scope="col">Batch assignment</th>
|
|
59
54
|
<th scope="col">Heartbeat</th>
|
|
55
|
+
<th scope="col">Elapsed</th>
|
|
56
|
+
<th scope="col">Done</th>
|
|
57
|
+
<th scope="col">Rate</th>
|
|
60
58
|
<th scope="col">Worktree</th>
|
|
61
59
|
</tr>
|
|
62
60
|
</thead>
|
|
@@ -66,7 +64,15 @@
|
|
|
66
64
|
</section>
|
|
67
65
|
|
|
68
66
|
<section class="panel panel-wide" aria-labelledby="journal-heading">
|
|
69
|
-
<
|
|
67
|
+
<div class="journal-header">
|
|
68
|
+
<h3 id="journal-heading">Journal (last 20)</h3>
|
|
69
|
+
<label class="journal-filter-label" for="journal-lane-filter">
|
|
70
|
+
Lane
|
|
71
|
+
<select id="journal-lane-filter" class="journal-lane-filter" aria-label="Filter journal by lane">
|
|
72
|
+
<option value="">All lanes</option>
|
|
73
|
+
</select>
|
|
74
|
+
</label>
|
|
75
|
+
</div>
|
|
70
76
|
<ol id="journal-list" class="journal-list"></ol>
|
|
71
77
|
</section>
|
|
72
78
|
</main>
|
package/src/dashboard/server.mjs
CHANGED
|
@@ -21,6 +21,10 @@ const STATIC_ROUTES = {
|
|
|
21
21
|
"/dashboard.css": { file: "dashboard.css", contentType: "text/css; charset=utf-8" },
|
|
22
22
|
"/dashboard.js": { file: "dashboard.js", contentType: "text/javascript; charset=utf-8" },
|
|
23
23
|
"/view.mjs": { file: path.join("..", "view.mjs"), contentType: "text/javascript; charset=utf-8" },
|
|
24
|
+
"/lane-throughput.mjs": {
|
|
25
|
+
file: path.join("..", "lane-throughput.mjs"),
|
|
26
|
+
contentType: "text/javascript; charset=utf-8",
|
|
27
|
+
},
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
/**
|