bareloop 0.50.0 → 0.52.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/CHANGELOG.md +30 -0
- package/README.md +12 -0
- package/bareloop.context.md +28 -7
- package/package.json +2 -2
- package/src/authorflow.js +10 -1
- package/src/authorscout.js +2 -2
- package/src/carrynote.js +262 -0
- package/src/carrystore.js +220 -0
- package/src/config.js +4 -1
- package/src/handoff.js +100 -0
- package/src/job.js +6 -1
- package/src/panel/index.html +314 -189
- package/src/panel/server.js +47 -3
- package/src/plan.js +5 -1
- package/src/planrun.js +54 -7
- package/src/readshim.js +17 -1
- package/src/replay.js +28 -3
- package/src/run.js +5 -2
- package/src/stagewords.js +12 -3
- package/src/tools.js +17 -0
- package/src/userrun.js +3 -0
- package/types/carrynote.d.ts +134 -0
- package/types/carrystore.d.ts +69 -0
- package/types/config.d.ts +1 -1
- package/types/handoff.d.ts +39 -0
- package/types/plan.d.ts +4 -0
- package/types/planrun.d.ts +5 -1
- package/types/readshim.d.ts +1 -0
- package/types/replay.d.ts +1 -0
- package/types/run.d.ts +5 -1
- package/types/stagewords.d.ts +7 -2
- package/types/tools.d.ts +8 -0
package/src/panel/index.html
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
always-scrolling wrapper makes the header genuinely sticky on both
|
|
49
49
|
breakpoints, and also owns the horizontal scroll for the Path column
|
|
50
50
|
on narrow (390px) screens instead of leaving it to .pane-body. */
|
|
51
|
-
.audit-table-scroll{overflow:auto;max-height:min(60vh,520px);}
|
|
51
|
+
.audit-table-scroll{overflow:auto;max-height:min(60vh,520px);max-width:100%;}
|
|
52
52
|
/* z-index keeps rows from showing through the solid th background as
|
|
53
53
|
they scroll under it. */
|
|
54
54
|
[data-testid="audit-table"] th{position:sticky;top:0;z-index:1;}
|
|
@@ -118,6 +118,8 @@
|
|
|
118
118
|
.topbar .version{flex:none;}
|
|
119
119
|
@media (max-width: 600px){ .topbar .tagline{display:none;} }
|
|
120
120
|
.topbar-right{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
|
|
121
|
+
#online-dot{font-size:12px;white-space:nowrap;flex:none;}
|
|
122
|
+
#online-dot.on{color:var(--green);} #online-dot.off{color:var(--red);}
|
|
121
123
|
|
|
122
124
|
[hidden]{display:none !important;}
|
|
123
125
|
.main{display:flex;flex:1;min-height:0;}
|
|
@@ -386,11 +388,46 @@
|
|
|
386
388
|
.step-card h4{margin:0;font-size:13px;text-transform:none;letter-spacing:0;}
|
|
387
389
|
.step-meta{font-size:12px;color:var(--text-dim);margin-top:4px;}
|
|
388
390
|
/* build item C: Audit tab attempt/rounds detail (reused by audit-part-toggle expansion) */
|
|
389
|
-
.attempts-list{margin-top:8px;border-top:1px dotted var(--border-strong);padding-top:8px;}
|
|
390
|
-
.attempt-row{margin-bottom:6px;}
|
|
391
|
-
.attempt-toggle{margin-bottom:4px;}
|
|
392
391
|
.rounds-list{margin:6px 0 6px 12px;padding-left:8px;border-left:2px solid var(--border-strong);}
|
|
393
|
-
.
|
|
392
|
+
/* PRD v1.119 (signed mock variant F): the Audit check grid, its errors list and the rounds folded per try */
|
|
393
|
+
.glyph-q{color:var(--magenta);} .glyph-nr{color:var(--text-faint);}
|
|
394
|
+
.rounds-fold{margin:4px 0 6px 12px;font-size:12px;}
|
|
395
|
+
.rounds-fold>summary{cursor:pointer;color:var(--text-dim);min-height:28px;overflow-wrap:anywhere;}
|
|
396
|
+
.rounds-fold .rf-body{margin-top:4px;padding-left:8px;border-left:2px solid var(--border-strong);}
|
|
397
|
+
.sub-label{font-size:11px;color:var(--text-faint);text-transform:uppercase;letter-spacing:0.06em;margin:12px 0 4px;}
|
|
398
|
+
.grid-wrap{overflow:auto;max-width:100%;}
|
|
399
|
+
table.grid{width:100%;min-width:0;}
|
|
400
|
+
table.grid th.q,table.grid td.q{min-width:170px;max-width:340px;white-space:normal;overflow-wrap:anywhere;font-size:12px;}
|
|
401
|
+
table.grid th.t,table.grid td.c{text-align:center;width:64px;min-width:56px;white-space:nowrap;}
|
|
402
|
+
table.grid th.t .hint{display:block;text-transform:none;letter-spacing:0;font-weight:400;margin:0;}
|
|
403
|
+
table.grid td.c{padding:2px;}
|
|
404
|
+
.cell{border:1px solid transparent;background:none;min-width:44px;min-height:32px;color:var(--text-faint);font-size:14px;font-weight:700;}
|
|
405
|
+
.cell.fail{color:var(--red);border-color:var(--border-strong);background:var(--red-bg);}
|
|
406
|
+
.cell.pass{color:var(--green);cursor:default;}
|
|
407
|
+
.cell.notrun{color:var(--text-faint);cursor:default;}
|
|
408
|
+
.cell.unk{color:var(--magenta);cursor:default;}
|
|
409
|
+
.fold-list{margin-top:10px;}
|
|
410
|
+
.fgrid .cell.fail[aria-expanded="true"]{outline:2px solid var(--red);outline-offset:1px;}
|
|
411
|
+
.fx-errors{margin:8px 0 4px;min-width:0;}
|
|
412
|
+
.fx-label{font-size:11px;color:var(--text-faint);text-transform:uppercase;letter-spacing:0.06em;margin-bottom:2px;}
|
|
413
|
+
.fx-row{min-width:0;}
|
|
414
|
+
.fx-rowhead{display:flex;align-items:baseline;gap:8px;width:100%;min-width:0;min-height:32px;padding:3px 4px;border:0;background:none;color:var(--text);font:inherit;font-size:12px;text-align:left;}
|
|
415
|
+
button.fx-rowhead{cursor:pointer;}
|
|
416
|
+
button.fx-rowhead:hover{background:var(--panel2);}
|
|
417
|
+
button.fx-rowhead:focus-visible,.fx-more:focus-visible,.cell.fail:focus-visible{outline:2px solid var(--red);outline-offset:1px;}
|
|
418
|
+
.fx-caret{flex:none;width:12px;color:var(--text-faint);}
|
|
419
|
+
.fx-try{flex:none;font-weight:700;}
|
|
420
|
+
.fx-chk{flex:none;white-space:nowrap;}
|
|
421
|
+
.fx-first{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-dim);}
|
|
422
|
+
.fx-faint,.fx-count{color:var(--text-faint);}
|
|
423
|
+
.fx-count{flex:none;white-space:nowrap;}
|
|
424
|
+
.fx-row.open>.fx-rowhead{background:var(--red-bg);}
|
|
425
|
+
.fx-body{margin:0 0 6px 20px;border-left:2px solid var(--red);padding:4px 10px;background:var(--red-bg);min-width:0;}
|
|
426
|
+
.fx-sub{font-size:12px;color:var(--text);font-weight:700;margin:6px 0 2px;overflow-wrap:anywhere;}
|
|
427
|
+
.fx-lines{font-size:12px;color:var(--text-dim);}
|
|
428
|
+
.fx-lines div{margin:1px 0;overflow-wrap:anywhere;}
|
|
429
|
+
.fx-judged{overflow-wrap:anywhere;}
|
|
430
|
+
.fx-more{margin-top:4px;min-height:28px;padding:2px 8px;border:1px solid var(--border-strong);background:var(--panel2);color:var(--text);font-size:12px;}
|
|
394
431
|
/* item 1 (2026-09-26): a round's own model call renders as this table's
|
|
395
432
|
header ROW (visually distinct from its tool-call rows below it). */
|
|
396
433
|
tr.round-header-row td{background:var(--panel2);font-weight:700;}
|
|
@@ -415,11 +452,6 @@
|
|
|
415
452
|
.actor-mark{color:var(--text-faint);font-size:12px;margin-left:6px;white-space:nowrap;}
|
|
416
453
|
.step-tally{font-size:12px;color:var(--text-dim);overflow-wrap:anywhere;margin:2px 0 6px;}
|
|
417
454
|
.try-line{margin:10px 0 2px;overflow-wrap:anywhere;font-weight:700;}
|
|
418
|
-
.try-check,.try-judged{margin:2px 0 2px 12px;font-size:13px;overflow-wrap:anywhere;}
|
|
419
|
-
.try-judged{font-size:12px;color:var(--text-dim);}
|
|
420
|
-
.try-reasons{margin:2px 0 4px 12px;font-size:12px;color:var(--text-dim);}
|
|
421
|
-
.try-reasons summary{cursor:pointer;}
|
|
422
|
-
.try-reasons div{margin:2px 0 2px 8px;overflow-wrap:anywhere;}
|
|
423
455
|
.step-rounds-note{font-size:12px;color:var(--text-faint);margin:8px 0 2px;overflow-wrap:anywhere;}
|
|
424
456
|
.rounds-page-info{margin-top:6px;display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
|
|
425
457
|
|
|
@@ -640,7 +672,9 @@
|
|
|
640
672
|
.pv-knote > .hint:empty{display:none;}
|
|
641
673
|
.pv-key[data-open="0"] .pv-models{display:none;}
|
|
642
674
|
.pv-mrow{border-top:1px dotted var(--border-strong);min-height:32px;}
|
|
643
|
-
.pv-mrow:hover
|
|
675
|
+
.pv-mrow:hover{background:var(--panel2);}
|
|
676
|
+
.pv-mrow:focus-within,.pv-mrow:focus-within:hover{background:var(--rl-accent-bg-strong);box-shadow:inset 0 0 0 2px var(--accent);}
|
|
677
|
+
.pv-mrow:focus{outline:none;}
|
|
644
678
|
.pv-um{grid-column:1;display:flex;align-items:center;gap:0;min-width:0;}
|
|
645
679
|
.pv-uh,.pv-m-use{flex:0 0 44px;width:44px;display:flex;align-items:center;justify-content:center;}
|
|
646
680
|
.pv-m-use{min-height:32px;}
|
|
@@ -717,6 +751,7 @@
|
|
|
717
751
|
</div>
|
|
718
752
|
<div class="topbar-right">
|
|
719
753
|
<span class="hint" id="host-line"></span>
|
|
754
|
+
<span id="online-dot" class="on" data-testid="online-dot" role="status">● online</span>
|
|
720
755
|
<button class="btn small" type="button" id="btn-settings" data-testid="btn-settings">⚙ Settings</button>
|
|
721
756
|
<button class="theme-toggle" id="theme-toggle" type="button" aria-label="Toggle light/dark theme">☽</button>
|
|
722
757
|
</div>
|
|
@@ -1116,8 +1151,9 @@
|
|
|
1116
1151
|
// ---- fetch helpers ----
|
|
1117
1152
|
function getJSON(path){
|
|
1118
1153
|
return fetch(path, { headers: { accept: "application/json" } }).then(function(r){
|
|
1119
|
-
|
|
1120
|
-
|
|
1154
|
+
// `.status` marks "node answered": an HTTP error, or a 200 whose body would not parse — the online dot reads it (only a status-less failure is offline).
|
|
1155
|
+
if(!r.ok){ var err = new Error(path + ": HTTP " + r.status); err.status = r.status; throw err; }
|
|
1156
|
+
return r.json().catch(function(e){ e.status = r.status; throw e; });
|
|
1121
1157
|
});
|
|
1122
1158
|
}
|
|
1123
1159
|
|
|
@@ -1149,6 +1185,11 @@
|
|
|
1149
1185
|
if(outcome === null || outcome === undefined) return boxIsLive ? "▶" : "?";
|
|
1150
1186
|
return "✗";
|
|
1151
1187
|
}
|
|
1188
|
+
// a try that no close ended (the provider dropped it, the person stopped it, it died) has no verdict: "?", the same sign the Audit grid's column wears.
|
|
1189
|
+
// `a.noVerdict` is the server's word for it (src/panel/server.js); every surface that draws a try's glyph reads this one rule.
|
|
1190
|
+
function tryGlyph(a, boxIsLive){
|
|
1191
|
+
return a && typeof a.noVerdict === "string" && a.noVerdict !== "" ? "?" : attemptGlyph(a ? a.outcome : null, boxIsLive);
|
|
1192
|
+
}
|
|
1152
1193
|
// P3 addition: colour ONLY [✓]/[✗] (the standing wording ruling's own
|
|
1153
1194
|
// words/glyph vocabulary is unchanged — this wraps the same glyph
|
|
1154
1195
|
// character in a plain inline colour span for the two result-carrying
|
|
@@ -1165,7 +1206,7 @@
|
|
|
1165
1206
|
// part-card renderer below, never by this function.
|
|
1166
1207
|
function attemptsInlineText(attempts, boxIsLive){
|
|
1167
1208
|
if(!attempts || !attempts.length) return "";
|
|
1168
|
-
return attempts.map(function(a){ return "attempt " + a.n + " " +
|
|
1209
|
+
return attempts.map(function(a){ return "attempt " + a.n + " " + tryGlyph(a, boxIsLive); }).join(" · ");
|
|
1169
1210
|
}
|
|
1170
1211
|
function stepTitleText(idx, s){
|
|
1171
1212
|
var base = s.noNumber ? s.title : (idx + 1) + ' ' + s.title;
|
|
@@ -1225,7 +1266,8 @@
|
|
|
1225
1266
|
if(part.kind === "drafting") return glyphSpan(attemptGlyph("green", false)); // [✓]: drafting is done once the run exists
|
|
1226
1267
|
if(partHasNoVerdict(part)) return null;
|
|
1227
1268
|
var boxIsLive = box.state === "running";
|
|
1228
|
-
if(box.attempts.length > 1) return box.attempts.map(function(a){ return glyphSpan(
|
|
1269
|
+
if(box.attempts.length > 1) return box.attempts.map(function(a){ return glyphSpan(tryGlyph(a, boxIsLive)); }).join("");
|
|
1270
|
+
if(box.attempts.length === 1 && box.attempts[0].noVerdict) return glyphSpan(tryGlyph(box.attempts[0], boxIsLive));
|
|
1229
1271
|
var outcome = (part.outcome !== null && part.outcome !== undefined) ? part.outcome : (box.attempts[0] ? box.attempts[0].outcome : null);
|
|
1230
1272
|
return glyphSpan(attemptGlyph(outcome, boxIsLive));
|
|
1231
1273
|
}
|
|
@@ -2972,47 +3014,6 @@
|
|
|
2972
3014
|
function stateDotHTML(cls, word, testid){
|
|
2973
3015
|
return '<span class="step-state" data-testid="' + testid + '"><span class="dot ' + cls + (cls === "amber" ? " pulse" : "") + '"></span><b class="st-word">' + escapeXml(word) + '</b></span>';
|
|
2974
3016
|
}
|
|
2975
|
-
// build item C: Audit tab attempt row -> its rounds (server-built,
|
|
2976
|
-
// lazy-fetched on expand via /api/runs/:runid/rounds?part=<i>&attempt=<n>).
|
|
2977
|
-
function buildAttemptsList(container, partIndex, attempts, boxIsLive){
|
|
2978
|
-
container.innerHTML = "";
|
|
2979
|
-
attempts.forEach(function(a){
|
|
2980
|
-
var row = document.createElement("div");
|
|
2981
|
-
row.className = "attempt-row";
|
|
2982
|
-
row.setAttribute("data-testid", "audit-attempt-" + partIndex + "-" + a.n);
|
|
2983
|
-
// plain-checks build (2026-09-28): the withdrawn "checks N/M" headline
|
|
2984
|
-
// is replaced by attemptChecksLine's plain words (including the
|
|
2985
|
-
// opening outer-close grade, which is attempt 1 on this SAME list —
|
|
2986
|
-
// src/replay.js's fixLoop.attempts) — "" for a rubric/command close or
|
|
2987
|
-
// a still-running attempt with no stages yet.
|
|
2988
|
-
var checksText = attemptChecksLine(a);
|
|
2989
|
-
var checksList = fullStageList(a).map(stageLineHtml).join("<br>");
|
|
2990
|
-
row.innerHTML =
|
|
2991
|
-
'<button class="btn small attempt-toggle" type="button" aria-expanded="false">' +
|
|
2992
|
-
'attempt ' + a.n + ' ' + attemptGlyph(a.outcome, boxIsLive) +
|
|
2993
|
-
(a.thinking ? ' · ' + escapeXml(a.thinking) : '') +
|
|
2994
|
-
(checksText ? ' · ' + checksText : '') +
|
|
2995
|
-
'</button>' +
|
|
2996
|
-
(checksList ? '<div class="checks-list" data-testid="audit-attempt-checks-' + partIndex + '-' + a.n + '" hidden>' + checksList + '</div>' : '') +
|
|
2997
|
-
'<div class="rounds-list" hidden></div>';
|
|
2998
|
-
container.appendChild(row);
|
|
2999
|
-
var btn = row.querySelector(".attempt-toggle");
|
|
3000
|
-
var roundsEl = row.querySelector(".rounds-list");
|
|
3001
|
-
var checksEl = row.querySelector(".checks-list");
|
|
3002
|
-
var built = false;
|
|
3003
|
-
btn.addEventListener("click", function(){
|
|
3004
|
-
var expanded = btn.getAttribute("aria-expanded") === "true";
|
|
3005
|
-
btn.setAttribute("aria-expanded", expanded ? "false" : "true");
|
|
3006
|
-
roundsEl.hidden = expanded;
|
|
3007
|
-
if(checksEl) checksEl.hidden = expanded;
|
|
3008
|
-
if(!expanded && !built){
|
|
3009
|
-
built = true;
|
|
3010
|
-
loadRounds(roundsEl, partIndex, a, 0);
|
|
3011
|
-
}
|
|
3012
|
-
});
|
|
3013
|
-
});
|
|
3014
|
-
}
|
|
3015
|
-
|
|
3016
3017
|
// PRD v1.106 Part 5: who did a part's work, in the server's own words (`part.marker`: [model] or [human · ask]); nothing typed here
|
|
3017
3018
|
function actorMarkHtml(part){
|
|
3018
3019
|
return part && typeof part.marker === "string" && part.marker !== "" ? ' <span class="actor-mark" data-testid="actor-mark">' + escapeXml(part.marker) + '</span>' : "";
|
|
@@ -3025,75 +3026,241 @@
|
|
|
3025
3026
|
}).join("");
|
|
3026
3027
|
return '<div class="audit-table-scroll"><table class="rounds-table" data-testid="door-table"><thead><tr><th>Round</th><th>Try</th><th>Action</th><th>Path</th><th>Decision</th><th>Time</th></tr></thead><tbody>' + rows + "</tbody></table></div>";
|
|
3027
3028
|
}
|
|
3028
|
-
// PRD v1.
|
|
3029
|
-
//
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
if(
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3029
|
+
// PRD v1.119 (signed mock design/audit-grid-mock.html variant F): ONE look for a plan step's tries and the fix loop's tries. A grid per part (rows =
|
|
3030
|
+
// the part's checks in DECLARED order with their plain questions, columns = tries), under it an "errors" list (one row per try that failed or has
|
|
3031
|
+
// no verdict), then the rounds folded per try. Every word comes from the server (`part.tries`, `attempt.checks`/`stages`/`reasons`/`noVerdict`,
|
|
3032
|
+
// `declaredStages`, `stageQuestionText`); the page joins checks to declared rows by NAME and types none of them.
|
|
3033
|
+
function gridGlyph(g){
|
|
3034
|
+
if(g === "✓") return '<span class="glyph-green">' + g + '</span>';
|
|
3035
|
+
if(g === "✗") return '<span class="glyph-red">' + g + '</span>';
|
|
3036
|
+
if(g === "?") return '<span class="glyph-q">' + g + '</span>';
|
|
3037
|
+
if(g === "·") return '<span class="glyph-nr">' + g + '</span>';
|
|
3038
|
+
return g;
|
|
3039
|
+
}
|
|
3040
|
+
function gridPlural(n, w){ return n + " " + w + (n === 1 ? "" : "s"); }
|
|
3041
|
+
// a plan step's graded try (`part.tries[i]` + its attempt's checks, run order) as one grid column; a cut-off try ran no check: no verdict
|
|
3042
|
+
function gridStepTryOf(part, t, boxIsLive){
|
|
3043
|
+
var a = (part.attempts || []).filter(function(x){ return x.n === t.n; })[0] || null;
|
|
3044
|
+
var out = {
|
|
3045
|
+
n: t.n, glyph: t.cutOff ? "?" : attemptGlyph(t.outcome, boxIsLive), hint: t.thinking || "", noVerdict: t.cutOff ? (t.words || "") : null,
|
|
3046
|
+
known: false, inflight: false, cells: {}, order: [], judged: a && Array.isArray(a.judged) ? a.judged : [], attempt: a || { n: t.n }, calls: a ? (typeof a.rounds === "number" ? a.rounds : null) : (t.cutOff && part.cutOffTry && typeof part.cutOffTry.rounds === "number" ? part.cutOffTry.rounds : null), opening: false
|
|
3047
|
+
};
|
|
3048
|
+
if(!t.cutOff && a && Array.isArray(a.checks)){
|
|
3049
|
+
out.known = true;
|
|
3050
|
+
a.checks.forEach(function(c){
|
|
3051
|
+
out.cells[c.name] = { name: c.name, question: c.question, status: c.pass ? "pass" : "fail", number: c.pass && c.note ? c.note : null, reasons: c.reasons || [] };
|
|
3052
|
+
out.order.push(c.name);
|
|
3053
|
+
});
|
|
3054
|
+
}
|
|
3055
|
+
return out;
|
|
3056
|
+
}
|
|
3057
|
+
// a fix try: the opening close or one fix iteration; `stages` are the checks that RAN (first-red-wins), `reasons` the failing one's output lines
|
|
3058
|
+
function gridFixTryOf(a, boxIsLive){
|
|
3059
|
+
var noVerdict = typeof a.noVerdict === "string" && a.noVerdict !== "" ? a.noVerdict : null;
|
|
3060
|
+
var out = {
|
|
3061
|
+
n: a.n, glyph: tryGlyph(a, boxIsLive), hint: a.source === "outer-close" ? "opening close" : (a.thinking || ""), noVerdict: noVerdict,
|
|
3062
|
+
known: Array.isArray(a.stages), judged: [], inflight: (a.outcome === null || a.outcome === undefined) && !!boxIsLive, cells: {}, order: [], attempt: a,
|
|
3063
|
+
calls: typeof a.rounds === "number" ? a.rounds : null, opening: a.source === "outer-close"
|
|
3064
|
+
};
|
|
3065
|
+
if(out.known){
|
|
3066
|
+
var failSeen = false;
|
|
3067
|
+
a.stages.forEach(function(s){
|
|
3068
|
+
var ok = s.verdict === "satisfied";
|
|
3069
|
+
var cell = { name: s.name, question: stageQuestionText(s), status: ok ? "pass" : "fail", number: ok ? (stageNumberText(s) || null) : null, reasons: [] };
|
|
3070
|
+
if(!ok && !failSeen){ failSeen = true; cell.reasons = Array.isArray(a.reasons) ? a.reasons : []; }
|
|
3071
|
+
out.cells[s.name] = cell;
|
|
3072
|
+
out.order.push(s.name);
|
|
3073
|
+
});
|
|
3074
|
+
}
|
|
3075
|
+
return out;
|
|
3076
|
+
}
|
|
3077
|
+
// the rows, DECLARED order (the server's `n` is run order): every declared check for the fix loop, only the checks a step's tries ran for a step;
|
|
3078
|
+
// a check the declaration does not name (a step's own exit check) follows, numbered on from the declared ones
|
|
3079
|
+
function gridRowsOf(declared, tries, stepOnly){
|
|
3080
|
+
var used = {};
|
|
3081
|
+
tries.forEach(function(t){ t.order.forEach(function(nm){ used[nm] = true; }); });
|
|
3082
|
+
var rows = [];
|
|
3083
|
+
var listed = {};
|
|
3084
|
+
declared.forEach(function(d, i){
|
|
3085
|
+
if(stepOnly && !used[d.name]) return;
|
|
3086
|
+
rows.push({ n: i + 1, name: d.name, question: stageQuestionText(d) });
|
|
3087
|
+
listed[d.name] = true;
|
|
3088
|
+
});
|
|
3089
|
+
var next = declared.length;
|
|
3090
|
+
tries.forEach(function(t){
|
|
3091
|
+
t.order.forEach(function(nm){
|
|
3092
|
+
if(listed[nm]) return;
|
|
3093
|
+
listed[nm] = true;
|
|
3094
|
+
next += 1;
|
|
3095
|
+
rows.push({ n: next, name: nm, question: stageQuestionText(t.cells[nm]) });
|
|
3096
|
+
});
|
|
3097
|
+
});
|
|
3098
|
+
return rows;
|
|
3099
|
+
}
|
|
3100
|
+
function gridModelOf(part, boxIsLive){
|
|
3101
|
+
var attempts = Array.isArray(part.attempts) ? part.attempts : [];
|
|
3102
|
+
var declared = [];
|
|
3103
|
+
attempts.some(function(a){
|
|
3104
|
+
if(Array.isArray(a.declaredStages) && a.declaredStages.length > 0){ declared = a.declaredStages; return true; }
|
|
3105
|
+
return false;
|
|
3049
3106
|
});
|
|
3050
|
-
|
|
3051
|
-
|
|
3107
|
+
var graded = part.kind === "step" && Array.isArray(part.tries) && part.tries.length > 0;
|
|
3108
|
+
var tries = graded
|
|
3109
|
+
? part.tries.map(function(t){ return gridStepTryOf(part, t, boxIsLive); })
|
|
3110
|
+
: attempts.map(function(a){ return gridFixTryOf(a, boxIsLive); });
|
|
3111
|
+
return { tries: tries, rows: gridRowsOf(declared, tries, graded) };
|
|
3112
|
+
}
|
|
3113
|
+
// one cell: pass, fail, not run (first-red-wins stopped the close) or no verdict
|
|
3114
|
+
function gridCellOf(t, row){
|
|
3115
|
+
if(t.noVerdict) return { s: "unk" };
|
|
3116
|
+
var c = t.cells[row.name];
|
|
3117
|
+
if(c) return { s: c.status, number: c.number };
|
|
3118
|
+
if(!t.known) return { s: t.inflight ? "notrun" : "unk" };
|
|
3119
|
+
return { s: "notrun" };
|
|
3120
|
+
}
|
|
3121
|
+
// a try's failing checks with their output lines, in row order (none for a try with no verdict)
|
|
3122
|
+
function gridFailsOf(model, t){
|
|
3123
|
+
if(t.noVerdict) return [];
|
|
3124
|
+
return model.rows.filter(function(r){ var c = t.cells[r.name]; return !!c && c.status === "fail"; }).map(function(r){
|
|
3125
|
+
return { row: r, reasons: t.cells[r.name].reasons || [] };
|
|
3052
3126
|
});
|
|
3053
|
-
return html;
|
|
3054
3127
|
}
|
|
3055
|
-
//
|
|
3056
|
-
function
|
|
3128
|
+
// default on load: only the LAST failed try's row is open
|
|
3129
|
+
function gridDefaultOpen(model){
|
|
3130
|
+
var open = {};
|
|
3131
|
+
var last = null;
|
|
3132
|
+
model.tries.forEach(function(t){ if(gridFailsOf(model, t).length > 0) last = t.n; });
|
|
3133
|
+
if(last !== null) open[last] = true;
|
|
3134
|
+
return open;
|
|
3135
|
+
}
|
|
3136
|
+
function gridTableHtml(pid, model){
|
|
3137
|
+
if(model.rows.length === 0) return "";
|
|
3138
|
+
var head = '<tr><th class="q">check</th>' + model.tries.map(function(t){
|
|
3139
|
+
return '<th class="t">try ' + t.n + " " + gridGlyph(t.glyph) + (t.hint ? '<span class="hint">' + escapeXml(t.hint) + "</span>" : "") + "</th>";
|
|
3140
|
+
}).join("") + "</tr>";
|
|
3141
|
+
var body = model.rows.map(function(r){
|
|
3142
|
+
var tds = model.tries.map(function(t){
|
|
3143
|
+
var c = gridCellOf(t, r);
|
|
3144
|
+
if(c.s === "unk") return '<td class="c"><span class="cell unk" title="try ' + t.n + ': no verdict">' + gridGlyph("?") + "</span></td>";
|
|
3145
|
+
if(c.s === "notrun") return '<td class="c"><span class="cell notrun" title="not run (first-red-wins stopped the close)">' + gridGlyph("·") + "</span></td>";
|
|
3146
|
+
if(c.s === "pass") return '<td class="c"><span class="cell pass" title="passed' + (c.number ? ": " + escapeXml(c.number) : "") + '">' + gridGlyph("✓") + "</span></td>";
|
|
3147
|
+
return '<td class="c"><button type="button" class="cell fail" aria-expanded="false" aria-controls="fxerr-' + pid + '" data-fx="' + t.n + ":" + r.n + '" title="try ' + t.n + ", check #" + r.n + ': failed - click to read its errors">' + gridGlyph("✗") + "</button></td>";
|
|
3148
|
+
}).join("");
|
|
3149
|
+
return '<tr><td class="q">' + r.n + " " + escapeXml(r.question) + "</td>" + tds + "</tr>";
|
|
3150
|
+
}).join("");
|
|
3151
|
+
return '<div class="grid-wrap audit-table-scroll"><table class="grid fgrid" data-testid="audit-grid-table"><thead>' + head + "</thead><tbody>" + body + "</tbody></table></div>";
|
|
3152
|
+
}
|
|
3153
|
+
// the errors list: one row per try that failed or has no verdict; `st` = {open: {tryN: true}, more: {"tryN:checkN": true}}
|
|
3154
|
+
function gridErrorsHtml(pid, model, st){
|
|
3155
|
+
var rows = model.tries.map(function(t){
|
|
3156
|
+
if(t.noVerdict){
|
|
3157
|
+
return '<div class="fx-row fx-row-q"><span class="fx-rowhead"><span class="fx-caret"></span><span class="fx-try">try ' + t.n + '</span><span class="fx-chk">' + gridGlyph("?") + '</span><span class="fx-first fx-faint">' + escapeXml(t.noVerdict) + "</span></span></div>";
|
|
3158
|
+
}
|
|
3159
|
+
var fails = gridFailsOf(model, t);
|
|
3160
|
+
if(fails.length === 0) return "";
|
|
3161
|
+
var total = 0;
|
|
3162
|
+
fails.forEach(function(f){ total += f.reasons.length; });
|
|
3163
|
+
var firstLine = fails[0].reasons[0] || fails[0].row.question;
|
|
3164
|
+
var rest = Math.max(0, total - 1);
|
|
3165
|
+
var open = !!st.open[t.n];
|
|
3166
|
+
var head = '<button type="button" class="fx-rowhead" id="fxrow-' + pid + "-" + t.n + '" data-fxrow="' + t.n + '" aria-expanded="' + (open ? "true" : "false") + '"><span class="fx-caret">' + (open ? "▾" : "▸") +
|
|
3167
|
+
'</span><span class="fx-try">try ' + t.n + '</span><span class="fx-chk">#' + fails[0].row.n + " " + gridGlyph("✗") +
|
|
3168
|
+
(fails.length > 1 ? ' <span class="fx-faint">+' + (fails.length - 1) + " more check" + (fails.length > 2 ? "s" : "") + "</span>" : "") +
|
|
3169
|
+
'</span><span class="fx-first" title="' + escapeXml(firstLine) + '">' + escapeXml(firstLine) + "</span>" + (rest ? '<span class="fx-count">(+' + rest + " more)</span>" : "") + "</button>";
|
|
3170
|
+
var body = "";
|
|
3171
|
+
if(open){
|
|
3172
|
+
body = '<div class="fx-body">' + fails.map(function(f){
|
|
3173
|
+
var cap = 8;
|
|
3174
|
+
var ex = !!st.more[t.n + ":" + f.row.n];
|
|
3175
|
+
var shown = ex ? f.reasons : f.reasons.slice(0, cap);
|
|
3176
|
+
return (fails.length > 1 ? '<div class="fx-sub">#' + f.row.n + " " + escapeXml(f.row.question) + "</div>" : "") +
|
|
3177
|
+
'<div class="fx-lines">' + shown.map(function(r){ return "<div>" + escapeXml(r) + "</div>"; }).join("") + "</div>" +
|
|
3178
|
+
(f.reasons.length > cap ? '<button type="button" class="fx-more" data-fxmore="' + t.n + ":" + f.row.n + '">' + (ex ? "show first " + cap + " only" : "+" + (f.reasons.length - cap) + " more lines") + "</button>" : "");
|
|
3179
|
+
}).join("") + "</div>";
|
|
3180
|
+
}
|
|
3181
|
+
return '<div class="fx-row' + (open ? " open" : "") + '">' + head + body + "</div>";
|
|
3182
|
+
}).join("");
|
|
3183
|
+
return rows ? '<div class="fx-label">errors</div>' + rows : "";
|
|
3184
|
+
}
|
|
3185
|
+
// the rounds, folded per try, lazy: each fold fetches its own try's rounds (the per-attempt endpoint) the first time it opens
|
|
3186
|
+
function gridRoundsHtml(model){
|
|
3187
|
+
return '<div class="sub-label">rounds per try</div><div class="fold-list">' + model.tries.map(function(t){
|
|
3188
|
+
var line = '<div class="try-line" style="margin-top:6px">try ' + t.n + " " + gridGlyph(t.glyph) + "</div>";
|
|
3189
|
+
if(t.calls === 0){
|
|
3190
|
+
return line + '<div class="step-rounds-note">' + (t.opening ? "no rounds: the opening close ran before any model call" : "no rounds recorded") + "</div>";
|
|
3191
|
+
}
|
|
3192
|
+
return line + '<details class="rounds-fold" data-fxrounds="' + t.n + '"><summary>try ' + t.n + " rounds" + (t.calls === null ? "" : " (" + gridPlural(t.calls, "call") + ")") +
|
|
3193
|
+
'</summary><div class="rf-body"><div class="hint">loading…</div></div></details>';
|
|
3194
|
+
}).join("") + "</div>";
|
|
3195
|
+
}
|
|
3196
|
+
// a rubric step's try names the file its check read (the server's `attempt.judged` words): one faint line per try that has one
|
|
3197
|
+
function gridJudgedHtml(model){
|
|
3198
|
+
return model.tries.map(function(t){
|
|
3199
|
+
return (t.judged || []).map(function(j){ return '<div class="hint fx-judged">try ' + t.n + " · " + escapeXml(j) + "</div>"; }).join("");
|
|
3200
|
+
}).join("");
|
|
3201
|
+
}
|
|
3202
|
+
function gridPartHtml(pid, model){
|
|
3203
|
+
return gridTableHtml(pid, model) + '<div class="fx-errors" id="fxerr-' + pid + '" hidden></div>' + gridJudgedHtml(model) + gridRoundsHtml(model);
|
|
3204
|
+
}
|
|
3205
|
+
function renderGridErrors(wrap, pid, model, st){
|
|
3206
|
+
var host = wrap.querySelector(".fx-errors");
|
|
3207
|
+
var html = gridErrorsHtml(pid, model, st);
|
|
3208
|
+
host.hidden = html === "";
|
|
3209
|
+
host.innerHTML = html;
|
|
3210
|
+
Array.prototype.forEach.call(wrap.querySelectorAll("[data-fx]"), function(b){
|
|
3211
|
+
b.setAttribute("aria-expanded", st.open[b.getAttribute("data-fx").split(":")[0]] ? "true" : "false");
|
|
3212
|
+
});
|
|
3213
|
+
}
|
|
3214
|
+
// a step's or the fix loop's body: tally (steps), then the grid, the errors list and the rounds folds
|
|
3215
|
+
function buildGridBody(body, partIndex, part, boxIsLive){
|
|
3216
|
+
var pid = "p" + partIndex;
|
|
3217
|
+
var model = gridModelOf(part, boxIsLive);
|
|
3218
|
+
var st = { open: gridDefaultOpen(model), more: {} };
|
|
3219
|
+
if(part.tally){
|
|
3220
|
+
var tally = document.createElement("div");
|
|
3221
|
+
tally.className = "step-tally";
|
|
3222
|
+
tally.setAttribute("data-testid", "audit-tally-" + partIndex);
|
|
3223
|
+
tally.textContent = part.tally;
|
|
3224
|
+
body.appendChild(tally);
|
|
3225
|
+
}
|
|
3057
3226
|
var wrap = document.createElement("div");
|
|
3058
|
-
wrap.
|
|
3059
|
-
wrap.setAttribute("data-testid", "audit-
|
|
3060
|
-
|
|
3061
|
-
part.tries.forEach(function(t){ html += tryBlockHtml(part, t, boxIsLive, partIndex); });
|
|
3062
|
-
html += '<div class="rounds-list" data-testid="audit-step-rounds-' + partIndex + '"></div>';
|
|
3063
|
-
wrap.innerHTML = html;
|
|
3227
|
+
wrap.setAttribute("data-fxpart", pid);
|
|
3228
|
+
wrap.setAttribute("data-testid", "audit-grid-" + partIndex);
|
|
3229
|
+
wrap.innerHTML = gridPartHtml(pid, model);
|
|
3064
3230
|
body.appendChild(wrap);
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
var
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
} else {
|
|
3089
|
-
el.innerHTML = (data.toolLogSaved ? "" : '<div class="hint">tool calls: no log saved</div>') +
|
|
3090
|
-
'<div class="audit-table-scroll"><table class="rounds-table" data-testid="rounds-table"><thead><tr><th>Round</th><th>Try</th><th>Action</th><th>Path</th><th>Decision</th><th>Time</th></tr></thead><tbody>' + rowsHtml + "</tbody></table></div>";
|
|
3231
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3232
|
+
var toggle = function(tn, force, focusRow){
|
|
3233
|
+
st.open[tn] = force === undefined ? !st.open[tn] : force;
|
|
3234
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3235
|
+
var el = document.getElementById("fxrow-" + pid + "-" + tn);
|
|
3236
|
+
if(el && focusRow){ el.scrollIntoView({ block: "nearest" }); el.focus(); } else if(el){ el.focus(); }
|
|
3237
|
+
};
|
|
3238
|
+
wrap.addEventListener("click", function(e){
|
|
3239
|
+
var more = e.target.closest("[data-fxmore]");
|
|
3240
|
+
if(more){
|
|
3241
|
+
var key = more.getAttribute("data-fxmore");
|
|
3242
|
+
st.more[key] = !st.more[key];
|
|
3243
|
+
renderGridErrors(wrap, pid, model, st);
|
|
3244
|
+
var again = wrap.querySelector('[data-fxmore="' + key + '"]');
|
|
3245
|
+
if(again) again.focus();
|
|
3246
|
+
return;
|
|
3247
|
+
}
|
|
3248
|
+
var row = e.target.closest("[data-fxrow]");
|
|
3249
|
+
if(row){ toggle(parseInt(row.getAttribute("data-fxrow"), 10), undefined, false); return; }
|
|
3250
|
+
var cell = e.target.closest("[data-fx]");
|
|
3251
|
+
if(cell){
|
|
3252
|
+
var tn = parseInt(cell.getAttribute("data-fx").split(":")[0], 10);
|
|
3253
|
+
toggle(tn, st.open[tn] ? false : true, true);
|
|
3091
3254
|
}
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3255
|
+
});
|
|
3256
|
+
Array.prototype.forEach.call(wrap.querySelectorAll("details.rounds-fold"), function(d){
|
|
3257
|
+
var t = model.tries.filter(function(x){ return x.n === parseInt(d.getAttribute("data-fxrounds"), 10); })[0];
|
|
3258
|
+
var built = false;
|
|
3259
|
+
d.addEventListener("toggle", function(){
|
|
3260
|
+
if(!d.open || built) return;
|
|
3261
|
+
built = true;
|
|
3262
|
+
loadRounds(d.querySelector(".rf-body"), partIndex, t.attempt, 0);
|
|
3263
|
+
});
|
|
3097
3264
|
});
|
|
3098
3265
|
}
|
|
3099
3266
|
|
|
@@ -3283,8 +3450,8 @@
|
|
|
3283
3450
|
];
|
|
3284
3451
|
// plain-checks build (2026-09-28): the part's headline check LINE — its
|
|
3285
3452
|
// MOST RECENT attempt's own declared-close grading (the opening
|
|
3286
|
-
// outer-close grade counts as attempt 1, same list
|
|
3287
|
-
//
|
|
3453
|
+
// outer-close grade counts as attempt 1, same list the grid's
|
|
3454
|
+
// columns read), in the withdrawn headline's place.
|
|
3288
3455
|
// PRD v1.106 Part 3: a part with one call (plan, scout, replan, a one-attempt step) says the thinking it was sent here; the server worded it
|
|
3289
3456
|
if(typeof part.thinking === "string" && part.thinking !== "") bits.push(escapeXml(part.thinking));
|
|
3290
3457
|
var latestAttempt = Array.isArray(part.attempts) && part.attempts.length ? part.attempts[part.attempts.length - 1] : null;
|
|
@@ -3313,10 +3480,7 @@
|
|
|
3313
3480
|
* wins means a later attempt's own `stages` array can be shorter than the
|
|
3314
3481
|
* close it belongs to; hamr's live catch on run mulbz0ny, checks-count fix
|
|
3315
3482
|
* 2026-09-28), falling back to `stages.length` only when no spec resolved.
|
|
3316
|
-
* The
|
|
3317
|
-
* attempt header, and the Run tab card / Audit Grouped header show this
|
|
3318
|
-
* SAME text bare (hamr: "same text as its attempt header, minus 'attempt
|
|
3319
|
-
* N'").
|
|
3483
|
+
* The Run tab card and the Audit Grouped header show this text.
|
|
3320
3484
|
* @param {any} attempt @returns {string}
|
|
3321
3485
|
*/
|
|
3322
3486
|
function attemptChecksLine(attempt){
|
|
@@ -3387,52 +3551,6 @@
|
|
|
3387
3551
|
if(stage.direction === "lower-is-better" && stage.baselineKind === "seed" && hasBaseline) return stage.value + ", limit " + stage.baseline;
|
|
3388
3552
|
return hasBaseline ? (stage.value + " (baseline " + stage.baseline + ")") : String(stage.value);
|
|
3389
3553
|
}
|
|
3390
|
-
/**
|
|
3391
|
-
* plain-checks build (2026-09-28): the expanded attempt row's FULL declared
|
|
3392
|
-
* stage list, in declared order, including stages that never ran (first-
|
|
3393
|
-
* red-wins stopped the close early) — hamr's ruling: "one line per DECLARED
|
|
3394
|
-
* stage, in order, including stages that never ran". Zips
|
|
3395
|
-
* `attempt.declaredStages` (the server's full ordered `{name, question}`
|
|
3396
|
-
* list) against `attempt.stages` (the shorter, possibly-partial RAN list)
|
|
3397
|
-
* BY NAME: a declared stage with a matching ran entry renders that entry
|
|
3398
|
-
* (`ran: true`); one with no match renders a synthetic not-run stub
|
|
3399
|
-
* (`ran: false`, `verdict: null`). When no `declaredStages` travelled at
|
|
3400
|
-
* all (no spec resolvable), falls back to whatever ran, unpadded — exactly
|
|
3401
|
-
* today's behaviour for a rubric/command close or an unresolvable spec.
|
|
3402
|
-
* @param {any} attempt @returns {{n: number, ran: boolean, stage: any}[]}
|
|
3403
|
-
*/
|
|
3404
|
-
function fullStageList(attempt){
|
|
3405
|
-
var ran = Array.isArray(attempt.stages) ? attempt.stages : [];
|
|
3406
|
-
if(!Array.isArray(attempt.declaredStages) || attempt.declaredStages.length === 0){
|
|
3407
|
-
return ran.map(function(s, i){ return { n: i + 1, ran: true, stage: s }; });
|
|
3408
|
-
}
|
|
3409
|
-
var byName = {};
|
|
3410
|
-
ran.forEach(function(s){ if(s && typeof s.name === "string") byName[s.name] = s; });
|
|
3411
|
-
return attempt.declaredStages.map(function(ds, i){
|
|
3412
|
-
var s = ds && Object.prototype.hasOwnProperty.call(byName, ds.name) ? byName[ds.name] : null;
|
|
3413
|
-
if(s) return { n: i + 1, ran: true, stage: s };
|
|
3414
|
-
return { n: i + 1, ran: false, stage: { name: ds ? ds.name : null, question: ds ? ds.question : null, verdict: null } };
|
|
3415
|
-
});
|
|
3416
|
-
}
|
|
3417
|
-
/**
|
|
3418
|
-
* one stage's expand-view line — "#N <question> <mark> <number>", hamr's
|
|
3419
|
-
* closed illustration:
|
|
3420
|
-
* #1 did it change any file? ✓
|
|
3421
|
-
* #2 src/checks.js has 0 type errors? ✗ 4 left, need 0
|
|
3422
|
-
* #3 other files didn't get more type errors? · not run
|
|
3423
|
-
* A never-run declared stage (`entry.ran === false`) always reads "· not
|
|
3424
|
-
* run", no number. A ran stage with no recorded number (a guard, a
|
|
3425
|
-
* pass/fail command stage) renders the mark alone.
|
|
3426
|
-
* @param {{n: number, ran: boolean, stage: any}} entry @returns {string}
|
|
3427
|
-
*/
|
|
3428
|
-
function stageLineHtml(entry){
|
|
3429
|
-
var s = entry.stage;
|
|
3430
|
-
var q = escapeXml(stageQuestionText(s));
|
|
3431
|
-
if(!entry.ran) return "#" + entry.n + " " + q + " · not run";
|
|
3432
|
-
var mark = s.verdict === "satisfied" ? glyphSpan("✓") : (s.verdict ? glyphSpan("✗") : "–");
|
|
3433
|
-
var numberText = stageNumberText(s);
|
|
3434
|
-
return "#" + entry.n + " " + q + " " + mark + (numberText ? " " + numberText : "");
|
|
3435
|
-
}
|
|
3436
3554
|
var currentAuditFilter = "all";
|
|
3437
3555
|
function auditPartMatchesFilter(rowWrap, filter){
|
|
3438
3556
|
if(filter === "all") return true;
|
|
@@ -3558,16 +3676,9 @@
|
|
|
3558
3676
|
var doorEl = document.createElement("div");
|
|
3559
3677
|
doorEl.innerHTML = doorTableHtml(part);
|
|
3560
3678
|
body.appendChild(doorEl);
|
|
3561
|
-
} else if(part.kind === "step" && Array.isArray(part.tries) && part.tries.length > 0){
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
// parts WITH an attempt sub-loop (a multi-attempt step, or the fix
|
|
3565
|
-
// loop) expand to attempt rows first — each attempt expands to its
|
|
3566
|
-
// own rounds table on its own click, same as the Run tab used to.
|
|
3567
|
-
var attemptsWrap = document.createElement("div");
|
|
3568
|
-
attemptsWrap.className = "attempts-list";
|
|
3569
|
-
body.appendChild(attemptsWrap);
|
|
3570
|
-
buildAttemptsList(attemptsWrap, idx, attempts, box.state === "running");
|
|
3679
|
+
} else if((part.kind === "fix" && attempts.length > 0) || (part.kind === "step" && ((Array.isArray(part.tries) && part.tries.length > 0) || attempts.length > 1))){
|
|
3680
|
+
// PRD v1.119: a plan step's tries and the fix loop's tries are ONE grid look: checks x tries, an errors list, the rounds folded per try
|
|
3681
|
+
buildGridBody(body, idx, part, box.state === "running");
|
|
3571
3682
|
} else {
|
|
3572
3683
|
// parts with NO sub-loop (scout, plan, replan, judge, run, or a
|
|
3573
3684
|
// single-attempt step) expand STRAIGHT to their rounds table.
|
|
@@ -4101,24 +4212,37 @@
|
|
|
4101
4212
|
});
|
|
4102
4213
|
}
|
|
4103
4214
|
|
|
4215
|
+
// The Runs list poll (every RUNS_LIST_POLL_MS) is the panel's heartbeat: ANY reply (even an HTTP error) = node answered = online; only a read that failed
|
|
4216
|
+
// with no HTTP status (the network, a dead panel) = offline. ONE painter writes the dot; the served page starts online.
|
|
4217
|
+
function paintOnline(isOnline){
|
|
4218
|
+
var el = document.getElementById("online-dot");
|
|
4219
|
+
el.className = isOnline ? "on" : "off";
|
|
4220
|
+
el.textContent = isOnline ? "\u25CF online" : "\u25CF offline";
|
|
4221
|
+
}
|
|
4222
|
+
|
|
4104
4223
|
function refreshRunsList(force){
|
|
4105
4224
|
var now = Date.now();
|
|
4106
4225
|
if(!force && (now - lastRunsListRefreshAt) < RUNS_LIST_POLL_MS) return Promise.resolve();
|
|
4107
4226
|
lastRunsListRefreshAt = now;
|
|
4108
4227
|
return getJSON("/api/runs").then(function(result){
|
|
4109
4228
|
pollFailStreak = 0;
|
|
4229
|
+
paintOnline(true);
|
|
4110
4230
|
var runs = result.runs || [];
|
|
4111
4231
|
var next = sig(result);
|
|
4112
4232
|
if(next === lastRunsPayloadSig) return runs; // unchanged payload — never rebuild the DOM for nothing
|
|
4113
4233
|
lastRunsPayloadSig = next;
|
|
4114
4234
|
lastRunsSig = sig(runs);
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4235
|
+
// a render throw is a page bug, not the panel being down: log it here so it never reaches the status catch below (which would paint "offline")
|
|
4236
|
+
try {
|
|
4237
|
+
withScrollPreserved(["left-pane-body"], function(){
|
|
4238
|
+
// the painter re-runs the SAME filter/search state — a poll tick never resets it, and it writes a box only when its markup changed.
|
|
4239
|
+
setRunsData(result);
|
|
4240
|
+
runsFilterBar.refresh();
|
|
4241
|
+
});
|
|
4242
|
+
} catch(renderErr){ console.error("runs list render failed", renderErr); }
|
|
4120
4243
|
return runs;
|
|
4121
|
-
}).catch(function(){
|
|
4244
|
+
}).catch(function(err){
|
|
4245
|
+
paintOnline(!!(err && typeof err.status === "number"));
|
|
4122
4246
|
pollFailStreak++;
|
|
4123
4247
|
// Keep the last good render; a transient failure is invisible. Only a
|
|
4124
4248
|
// PERSISTENT failure (3+ ticks, ~6s) gets a quiet, non-alarming note —
|
|
@@ -4309,7 +4433,7 @@
|
|
|
4309
4433
|
// M4d Providers layout F. One parent block per key (.pv-key): its key band (name, API shape select, Base URL box, the legacy tick, tokens,
|
|
4310
4434
|
// the Refresh button), a folded summary, and its model lines as child rows (.pv-mrow). The key row owns shape, Base URL and the legacy
|
|
4311
4435
|
// tick, so a model line can never drift from them. Shape and Base URL are always editable; a change of either saves both (judged together).
|
|
4312
|
-
var folds = {}; // slot -> true (unfolded) / false (folded): set once, on first paint (
|
|
4436
|
+
var folds = {}; // slot -> true (unfolded) / false (folded): set once, on first paint (every key starts folded), then only the person changes it
|
|
4313
4437
|
var typedOpen = {}; // slot -> true while "+ type a model name" is open
|
|
4314
4438
|
function buildProviderRow(row){
|
|
4315
4439
|
var key = document.createElement("div");
|
|
@@ -4344,6 +4468,7 @@
|
|
|
4344
4468
|
function buildModelLine(slot, m){
|
|
4345
4469
|
var d = document.createElement("div");
|
|
4346
4470
|
d.className = "pv-mrow";
|
|
4471
|
+
d.tabIndex = -1;
|
|
4347
4472
|
d.setAttribute("data-model", m.model);
|
|
4348
4473
|
d.setAttribute("data-testid", "model-line");
|
|
4349
4474
|
d.innerHTML =
|
|
@@ -4455,7 +4580,7 @@
|
|
|
4455
4580
|
data.rows.forEach(function(row){
|
|
4456
4581
|
var key = pvRows.querySelector('.pv-key[data-slot="' + row.slot + '"]');
|
|
4457
4582
|
if(!key){ key = buildProviderRow(row); pvRows.appendChild(key); }
|
|
4458
|
-
if(folds[row.slot] === undefined) folds[row.slot] =
|
|
4583
|
+
if(folds[row.slot] === undefined) folds[row.slot] = false;
|
|
4459
4584
|
key.setAttribute("data-open", folds[row.slot] ? "1" : "0");
|
|
4460
4585
|
var fold = key.querySelector("[data-act=fold]");
|
|
4461
4586
|
fold.textContent = folds[row.slot] ? "▾" : "▸";
|