fwdloop 0.20.0 → 0.22.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 +2 -0
- package/bin/fwdloop +85 -34
- package/package.json +4 -3
- package/src/audit-fold.js +181 -0
- package/src/authoring.js +33 -7
- package/src/books.js +1 -1
- package/src/checked.js +18 -1
- package/src/cited-record.js +138 -0
- package/src/cited-source.js +49 -0
- package/src/citedcheck.js +306 -0
- package/src/citedwords.js +197 -0
- package/src/closers.js +105 -9
- package/src/ctx-tools.js +2 -14
- package/src/declaration.js +85 -5
- package/src/diary.js +49 -0
- package/src/docx.js +16 -2
- package/src/draft-steps.js +1 -1
- package/src/drafter.js +292 -25
- package/src/flow.js +33 -7
- package/src/flowmodel.js +63 -5
- package/src/input-facts.js +20 -3
- package/src/model-step.js +132 -9
- package/src/pageask.js +136 -0
- package/src/pagebits.js +107 -0
- package/src/pagedropwords.js +171 -0
- package/src/pagedry.js +120 -0
- package/src/pagefetch.js +164 -0
- package/src/pagelook.js +155 -0
- package/src/pagemap.js +55 -0
- package/src/pageplace.js +103 -0
- package/src/pagerules.js +318 -0
- package/src/panel/author.js +41 -20
- package/src/panel/authorcard.js +11 -1
- package/src/panel/authorflows.js +21 -15
- package/src/panel/authorstart.js +2 -4
- package/src/panel/authortrigger.js +14 -4
- package/src/panel/data.js +130 -10
- package/src/panel/index.html +499 -41
- package/src/panel/result.js +295 -0
- package/src/panel/server.js +27 -3
- package/src/primitives.js +43 -2
- package/src/provider.js +5 -2
- package/src/redact.js +17 -0
- package/src/runner.js +128 -21
- package/src/schedule.js +3 -3
- package/src/setup.js +16 -1
- package/src/sheetfind.js +50 -0
- package/src/sheetlook.js +157 -0
- package/src/signed-text.js +11 -1
- package/src/thinking.js +39 -0
- package/src/try-checks.js +68 -0
- package/src/types.js +4 -2
- package/types/audit-fold.d.ts +54 -0
- package/types/authoring.d.ts +20 -2
- package/types/books.d.ts +17 -0
- package/types/checked.d.ts +10 -0
- package/types/cited-record.d.ts +21 -0
- package/types/cited-source.d.ts +18 -0
- package/types/citedcheck.d.ts +95 -0
- package/types/citedwords.d.ts +97 -0
- package/types/closers.d.ts +55 -3
- package/types/declaration.d.ts +15 -1
- package/types/diary.d.ts +57 -0
- package/types/docx.d.ts +14 -0
- package/types/drafter.d.ts +244 -2
- package/types/flow.d.ts +21 -0
- package/types/flowmodel.d.ts +40 -3
- package/types/input-facts.d.ts +12 -2
- package/types/model-step.d.ts +38 -3
- package/types/pageask.d.ts +75 -0
- package/types/pagebits.d.ts +32 -0
- package/types/pagedropwords.d.ts +40 -0
- package/types/pagedry.d.ts +38 -0
- package/types/pagefetch.d.ts +86 -0
- package/types/pagelook.d.ts +75 -0
- package/types/pagemap.d.ts +31 -0
- package/types/pageplace.d.ts +22 -0
- package/types/pagerules.d.ts +86 -0
- package/types/panel/authorcard.d.ts +2 -0
- package/types/panel/authorflows.d.ts +2 -0
- package/types/panel/data.d.ts +26 -0
- package/types/panel/result.d.ts +156 -0
- package/types/provider.d.ts +3 -1
- package/types/redact.d.ts +1 -0
- package/types/runner.d.ts +156 -7
- package/types/schedule.d.ts +0 -11
- package/types/setup.d.ts +13 -0
- package/types/sheetfind.d.ts +46 -0
- package/types/sheetlook.d.ts +120 -0
- package/types/thinking.d.ts +31 -0
- package/types/try-checks.d.ts +55 -0
- package/types/types.d.ts +20 -3
package/src/panel/index.html
CHANGED
|
@@ -453,6 +453,24 @@
|
|
|
453
453
|
}
|
|
454
454
|
.audit-group.audit-fold table{margin-top:8px;}
|
|
455
455
|
.audit-group.audit-fold table[hidden]{display:none !important;}
|
|
456
|
+
/* M4d am29 (design lab C): the step fold's body - tally, a line per try with its checks, then the Round table. The marker ends the header. */
|
|
457
|
+
.audit-fold-body[hidden]{display:none !important;}
|
|
458
|
+
.audit-fold-body{margin-top:8px;font-size:12px;min-width:0;max-width:100%;}
|
|
459
|
+
.audit-fold-who{flex:none;margin-left:auto;font-weight:700;font-size:11px;white-space:nowrap;}
|
|
460
|
+
.audit-fold-who.model{color:var(--cyan);} .audit-fold-who.human{color:var(--magenta,#9854f1);}
|
|
461
|
+
.audit-tally{color:var(--text-dim);margin:2px 0 4px;}
|
|
462
|
+
.audit-try{margin:4px 0 2px;overflow-wrap:anywhere;}
|
|
463
|
+
.audit-checks{margin:2px 0 6px 14px;}
|
|
464
|
+
.audit-chk{overflow-wrap:anywhere;}
|
|
465
|
+
.audit-chk > span{margin-right:6px;}
|
|
466
|
+
.audit-chk .src,.audit-judged{color:var(--text-faint);}
|
|
467
|
+
.audit-fold-label{color:var(--text-faint);text-transform:uppercase;font-size:10px;letter-spacing:.05em;margin-top:8px;}
|
|
468
|
+
.audit-fold-body table.rounds-table{width:100%;border-collapse:collapse;margin-top:4px;}
|
|
469
|
+
.audit-fold-body table.rounds-table th{position:sticky;top:0;z-index:1;}
|
|
470
|
+
.audit-fold-body table.rounds-table tr.trysep td{border-top:1px solid var(--border-strong);}
|
|
471
|
+
.rounds-pager{color:var(--text-faint);font-size:11px;margin-top:4px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
|
|
472
|
+
.step-card .step-head .who{font-weight:700;font-size:11px;}
|
|
473
|
+
.step-card .step-head .who.model{color:var(--cyan);} .step-card .step-head .who.human{color:var(--magenta,#9854f1);}
|
|
456
474
|
/* hamr's 2026-09-27 review: the group header's own state word (g.state,
|
|
457
475
|
rendered as a <span class="badge STATE">) and its per-try marks
|
|
458
476
|
(<span class="mark STATE">) reuse the SAME color vocabulary the runs
|
|
@@ -473,6 +491,23 @@
|
|
|
473
491
|
.job-card h4{margin:0 0 8px;font-size:13px;position:absolute;top:-10px;left:10px;background:var(--panel2);padding:0 6px;}
|
|
474
492
|
.job-card h4::before{content:"┤ ";color:var(--text-faint);}
|
|
475
493
|
.job-card h4::after{content:" ├";color:var(--text-faint);}
|
|
494
|
+
/* M10 am4: the Result tab. borrowed-from: bareloop src/panel/index.html@2959217 :188 :192 :397-408 (the Your-call card's rules are below, am5 item 2) */
|
|
495
|
+
.st-word{font-weight:700;color:var(--text);}
|
|
496
|
+
.step-state{display:inline-flex;align-items:center;gap:2px;font-size:12px;}
|
|
497
|
+
/* PRD v1.107 Part 6: the Result tab. Boxes are the Job tab's own (.job-card, .field, .ro-value, .field-row); text wraps, nothing scrolls the page. */
|
|
498
|
+
#result-body{min-width:0;overflow-wrap:anywhere;}
|
|
499
|
+
.rs-ok{color:var(--green);font-weight:700;}
|
|
500
|
+
.rs-bad{color:var(--red);font-weight:700;}
|
|
501
|
+
#result-body mark{background:var(--rl-accent-bg-strong);color:var(--text);border-radius:2px;padding:0 1px;}
|
|
502
|
+
#result-body details>summary{cursor:pointer;color:var(--text-dim);min-height:28px;}
|
|
503
|
+
.rs-warn{color:var(--amber);overflow-wrap:anywhere;}
|
|
504
|
+
/* M10 am5 item 2: the Your-call card. borrowed-from: bareloop src/panel/index.html@2959217 :401-403 :407 */
|
|
505
|
+
#result-door-card{border-color:var(--amber);}
|
|
506
|
+
#result-door-card .st-word{color:var(--amber);}
|
|
507
|
+
#result-door-card textarea{width:100%;min-height:60px;margin:6px 0;background:var(--bg);color:var(--text);border:1px solid var(--text-dim);font:inherit;padding:6px;box-sizing:border-box;}
|
|
508
|
+
#result-door-card .stopping{color:var(--amber);font-size:13px;overflow-wrap:anywhere;}
|
|
509
|
+
/* M10 am4 item 8 (bareloop never looked on a phone): a long saved-file name wraps inside its button instead of pushing it past the screen */
|
|
510
|
+
#result-body .btn{max-width:100%;box-sizing:border-box;white-space:normal;overflow-wrap:anywhere;}
|
|
476
511
|
.field{margin-bottom:10px;}
|
|
477
512
|
label{display:block;font-size:11px;font-weight:700;color:var(--text-dim);margin-bottom:2px;text-transform:uppercase;letter-spacing:0.04em;}
|
|
478
513
|
/* hamr's 2026-09-27 exit-check review #3: Ask tab box headers — same
|
|
@@ -604,6 +639,8 @@
|
|
|
604
639
|
.jf-inrow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr) auto;gap:6px;margin-bottom:4px;align-items:start;}
|
|
605
640
|
.jf-inrow .btn.small{height:32px;padding:0 8px;}
|
|
606
641
|
.jf-inrow .jf-role-ro{padding:5px 7px;min-height:32px;overflow-wrap:anywhere;border:1px solid var(--border);background:var(--bg);color:var(--text-dim);}
|
|
642
|
+
#details-schedule{overflow-wrap:anywhere;} /* M10: a page input's full address in the Schedule field wraps, never spills */
|
|
643
|
+
.jf-inrow .jf-path{text-overflow:ellipsis;} /* M10: a web page's address is cut with an ellipsis (the whole is the title) */
|
|
607
644
|
.jf-inrow .jf-err{grid-column:1 / -1;}
|
|
608
645
|
/* M4e amendment 4/5: what a Run or a Resume cannot change shows dimmed (the signature fixes it); only the open boxes are bright */
|
|
609
646
|
.field.dimmed{opacity:.6;}
|
|
@@ -703,6 +740,12 @@
|
|
|
703
740
|
}
|
|
704
741
|
td.am-detail .am-d{margin:0 0 3px;}
|
|
705
742
|
td.am-detail .am-d b{color:var(--text);font-weight:600;}
|
|
743
|
+
/* the Round table keeps its real table layout on a phone and scrolls inside its own box (.audit-table-scroll), never the page */
|
|
744
|
+
.audit-group table.rounds-table{display:table;width:max-content;min-width:100%;max-width:none;}
|
|
745
|
+
.audit-group table.rounds-table thead{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal;}
|
|
746
|
+
.audit-group table.rounds-table tbody{display:table-row-group;}
|
|
747
|
+
.audit-group table.rounds-table tr{display:table-row;padding:0;overflow:visible;}
|
|
748
|
+
.audit-group table.rounds-table td{display:table-cell;padding:4px 6px;white-space:normal;overflow-wrap:anywhere;border-right:1px dotted var(--border);}
|
|
706
749
|
}
|
|
707
750
|
|
|
708
751
|
/* M4d piece 4: the Settings view (a sibling of #main-view, opened from the header). Layout borrowed from bareloop:
|
|
@@ -948,7 +991,7 @@
|
|
|
948
991
|
<div class="jf-gut" id="jf-inputs-gut" data-testid="jf-inputs-gut" aria-hidden="true"><div class="jf-gut-in"></div></div>
|
|
949
992
|
<textarea class="jf-wrap" id="jf-inputs" rows="3" data-testid="jf-inputs" autocomplete="off" spellcheck="false" placeholder="resume: /full/path/to/resume.md"></textarea>
|
|
950
993
|
</div>
|
|
951
|
-
<div class="hint">One line per file: a name, a colon, its full path starting with
|
|
994
|
+
<div class="hint">One line per file: a name, a colon, its full path starting with /, or a web address (http:// or https://). The page never reads the file.</div>
|
|
952
995
|
<div class="jf-err" id="jf-err-inputs" data-testid="jf-err-inputs"></div>
|
|
953
996
|
</div>
|
|
954
997
|
<div class="field">
|
|
@@ -1141,11 +1184,12 @@
|
|
|
1141
1184
|
</section>
|
|
1142
1185
|
|
|
1143
1186
|
<section id="panel-runs" class="tabpanel" role="tabpanel" aria-labelledby="tab-runs" hidden>
|
|
1144
|
-
<!-- M11: ONE list. Running now
|
|
1187
|
+
<!-- M11: ONE list. Running now and Needs you are never filtered and sit above the grey line; Scheduled (the search also finds it, am17; the ◷ chip shows only it, am19) sits BELOW the search box and chips, above Jobs (am20). -->
|
|
1145
1188
|
<div id="rl-top" data-testid="rl-top"></div>
|
|
1146
1189
|
<div class="rl-dash"></div>
|
|
1147
|
-
<div class="rl-faint" data-testid="rl-filter-note">
|
|
1190
|
+
<div class="rl-faint" data-testid="rl-filter-note">search also finds Scheduled; ◷ shows only Scheduled</div>
|
|
1148
1191
|
<div id="runs-filterbar-anchor"></div>
|
|
1192
|
+
<div id="rl-sched" data-testid="rl-sched"></div>
|
|
1149
1193
|
<div id="wf-list" data-testid="wf-list"></div>
|
|
1150
1194
|
</section>
|
|
1151
1195
|
|
|
@@ -1168,6 +1212,7 @@
|
|
|
1168
1212
|
<button role="tab" id="tab-audit" aria-controls="panel-audit" aria-selected="false" data-testid="right-tab-audit">Audit / logs</button>
|
|
1169
1213
|
<button role="tab" id="tab-details" aria-controls="panel-details" aria-selected="false" data-testid="right-tab-details">Job</button>
|
|
1170
1214
|
<button role="tab" id="tab-ask" aria-controls="panel-ask" aria-selected="false" data-testid="right-tab-ask">Ask</button>
|
|
1215
|
+
<button role="tab" id="tab-result" aria-controls="panel-result" aria-selected="false" data-testid="right-tab-result" hidden>Result</button>
|
|
1171
1216
|
</div>
|
|
1172
1217
|
|
|
1173
1218
|
<div class="pane-body" id="right-pane-body">
|
|
@@ -1244,7 +1289,11 @@
|
|
|
1244
1289
|
<div class="job-card" id="job-card" hidden data-testid="job-card-readonly">
|
|
1245
1290
|
<h4 id="details-title">Job card — signed</h4>
|
|
1246
1291
|
<div class="hint" id="details-jobfrom" data-testid="details-jobfrom"></div>
|
|
1247
|
-
|
|
1292
|
+
<!-- M4d am28: Model and Thinking side by side on one row (.field-row, the paired-field row bareloop's Job tab uses for its caps) -->
|
|
1293
|
+
<div class="field-row">
|
|
1294
|
+
<div class="field"><label>Model</label><div class="ro-value" id="details-model">—</div></div>
|
|
1295
|
+
<div class="field" id="details-thinking-field"><label>Thinking</label><div class="ro-value" id="details-thinking" data-testid="details-thinking">—</div></div>
|
|
1296
|
+
</div>
|
|
1248
1297
|
<!-- M9 am6: how this run began, then the workflow's schedule now; both are words built on the server (src/summary-words.js) -->
|
|
1249
1298
|
<div class="field"><label>Started</label><div class="ro-value" id="details-started" data-testid="details-started">—</div></div>
|
|
1250
1299
|
<div class="field"><label>Schedule</label><div class="ro-value" id="details-schedule" data-testid="details-schedule">—</div></div>
|
|
@@ -1285,6 +1334,11 @@
|
|
|
1285
1334
|
<div id="ask-list" data-testid="ask-list" hidden></div>
|
|
1286
1335
|
</section>
|
|
1287
1336
|
|
|
1337
|
+
<section id="panel-result" class="tabpanel" role="tabpanel" aria-labelledby="tab-result" hidden data-testid="panel-result">
|
|
1338
|
+
<div id="result-empty" class="hint" style="font-size:13px;padding:24px 0;">select a run first</div>
|
|
1339
|
+
<div id="result-body" data-testid="result-body" hidden></div>
|
|
1340
|
+
</section>
|
|
1341
|
+
|
|
1288
1342
|
</div>
|
|
1289
1343
|
</section>
|
|
1290
1344
|
|
|
@@ -1317,7 +1371,7 @@
|
|
|
1317
1371
|
});
|
|
1318
1372
|
}
|
|
1319
1373
|
wireTabs([document.getElementById("tab-chat"), document.getElementById("tab-runs"), document.getElementById("tab-inbox")]);
|
|
1320
|
-
wireTabs([document.getElementById("tab-run"), document.getElementById("tab-audit"), document.getElementById("tab-details"), document.getElementById("tab-ask")]);
|
|
1374
|
+
wireTabs([document.getElementById("tab-run"), document.getElementById("tab-audit"), document.getElementById("tab-details"), document.getElementById("tab-ask"), document.getElementById("tab-result")]);
|
|
1321
1375
|
|
|
1322
1376
|
// ---- fetch helpers. Reads are GET. The ONLY non-GET requests on this page are
|
|
1323
1377
|
// the two POSTs below (M4b): /api/answer (a human clicking a door) and
|
|
@@ -1691,6 +1745,7 @@
|
|
|
1691
1745
|
// book-derived list, never guessed from `primitives` by exclusion.
|
|
1692
1746
|
toolsTotal: s.toolsTotal || null, toolsWhy: s.toolsWhy || null, ungranted: s.ungranted || [],
|
|
1693
1747
|
stoppedReason: s.stoppedReason || null,
|
|
1748
|
+
who: s.who || null, newLine: typeof s.newLine === "string" ? s.newLine : "\u2014", lastAnswerAt: s.lastAnswerAt || null,
|
|
1694
1749
|
state: s.groupState || "pending", // the server's one decider (deriveStepGroupState); no group = no row yet = not started
|
|
1695
1750
|
};
|
|
1696
1751
|
});
|
|
@@ -1867,14 +1922,14 @@
|
|
|
1867
1922
|
}
|
|
1868
1923
|
|
|
1869
1924
|
// ---- M11: ONE runs list (docs/wiki/the-module-ladder.md "M11 scope", amendments 1 and 2; docs/product/m11-runs-list-mock.html, the right box).
|
|
1870
|
-
// Top to bottom: Running now, Needs you
|
|
1925
|
+
// Top to bottom: Running now, Needs you (never filtered), a dashed line, the search box and chips, Scheduled (am20: the search narrows it), Jobs, the
|
|
1871
1926
|
// quiet fold. The page works out NOTHING: `live`, the Needs-you tag (`needs`), the job order and quiet split (`jobs`), the Scheduled cards and the two
|
|
1872
1927
|
// limits all come from GET /api/runs (src/panel/data.js). `rlModel` is pure (payload in, cards out); the rl*Html functions only draw it.
|
|
1873
1928
|
var rlData = { rows: [], jobs: [], scheduled: [], limits: { quietDays: 0, olderRuns: 0 } };
|
|
1874
1929
|
// manual fold memory, keyed by flow ("__quiet" is the quiet fold): a per-viewer convenience, reset on reload. A manual click wins over an automatic open.
|
|
1875
1930
|
var rlOpen = {};
|
|
1876
1931
|
// the last markup written into each box: an identical repaint (every poll) writes nothing, so focus, scroll and a half-read card survive it
|
|
1877
|
-
var rlLast = { top: null, jobs: null };
|
|
1932
|
+
var rlLast = { top: null, sched: null, jobs: null };
|
|
1878
1933
|
// The ONE writer of `rlData`: the whole /api/runs payload, as the server sent it.
|
|
1879
1934
|
function setRunsData(r){
|
|
1880
1935
|
rlData = { rows: r.rows || [], jobs: r.jobs || [], scheduled: r.scheduled || [], limits: r.limits || rlData.limits };
|
|
@@ -1939,13 +1994,28 @@
|
|
|
1939
1994
|
if(typeof s.runId !== "string" || s.runId === "") return '<div class="rl-card" data-testid="rl-sched-' + escapeXml(s.flow) + '">' + body + '</div>';
|
|
1940
1995
|
return '<button class="rl-card" type="button" data-rl-jump="' + escapeXml(s.flow + "|" + s.runId) + '" data-testid="rl-sched-' + escapeXml(s.flow) + '">' + body + '</button>';
|
|
1941
1996
|
}
|
|
1942
|
-
|
|
1997
|
+
// M11 am17: the ONE search box narrows the Scheduled cards by job name (matchesSearch in nameOnly mode: a run number or a date word is skipped, so it narrows only Jobs).
|
|
1998
|
+
// The result and time chips never touch Scheduled. With the `scheduled` chip pressed and nothing matching, the list says so; otherwise an empty Scheduled draws nothing, header included.
|
|
1999
|
+
// M11 am20: Running now and Needs you only (never filtered); they sit above the search box. Scheduled is drawn by rlSchedHtml, below it.
|
|
2000
|
+
function rlTopHtml(m, filters){
|
|
1943
2001
|
var h = "";
|
|
1944
2002
|
if(m.running.length) h += rlSectHtml("Running now", m.running.length) + m.running.map(function(r){ return rlJumpCardHtml(r, false); }).join("");
|
|
1945
2003
|
if(m.needs.length) h += rlSectHtml("Needs you", m.needs.length) + m.needs.map(function(r){ return rlJumpCardHtml(r, true); }).join("");
|
|
1946
|
-
if(m.scheduled.length) h += rlSectHtml("Scheduled", m.scheduled.length) + m.scheduled.map(rlScheduledCardHtml).join("");
|
|
1947
2004
|
return h;
|
|
1948
2005
|
}
|
|
2006
|
+
// the Scheduled cards the search leaves (the ONE place that narrows them); the count line and rlSchedHtml both read it
|
|
2007
|
+
function rlSchedShown(scheduled, q){
|
|
2008
|
+
return (scheduled || []).filter(function(s){ return matchesSearch(s.flow, null, q, null, true); });
|
|
2009
|
+
}
|
|
2010
|
+
function rlSchedCountText(n){
|
|
2011
|
+
return "showing " + n + " scheduled job" + (n === 1 ? "" : "s");
|
|
2012
|
+
}
|
|
2013
|
+
function rlSchedHtml(m, filters){
|
|
2014
|
+
var shown = rlSchedShown(m.scheduled, filters && filters.search ? filters.search : "");
|
|
2015
|
+
if(shown.length) return rlSectHtml("Scheduled", shown.length) + shown.map(rlScheduledCardHtml).join("");
|
|
2016
|
+
if(filters && filters.scheduled === true) return '<div class="rl-hint">no scheduled job matches</div>';
|
|
2017
|
+
return "";
|
|
2018
|
+
}
|
|
1949
2019
|
// a run card inside a job: `[sign] run-N date · model` / `word — why · $cost · wall`
|
|
1950
2020
|
function rlRunCardHtml(r, selected, hit){
|
|
1951
2021
|
var why = (r.word === "passed" && r.glyph === "[✓]" && !r.line) ? "goal met" : r.line;
|
|
@@ -2021,10 +2091,13 @@
|
|
|
2021
2091
|
var groups = filterWorkflows(groupRunsByFlow(rlData.rows), filters, Date.now());
|
|
2022
2092
|
var m = rlModel(rlData, groups, filters, rlData.limits, { flow: currentFlow, runId: currentRunId }, rlOpen);
|
|
2023
2093
|
var topEl = document.getElementById("rl-top");
|
|
2094
|
+
var schedEl = document.getElementById("rl-sched");
|
|
2024
2095
|
var listEl = document.getElementById("wf-list");
|
|
2025
|
-
var top = rlTopHtml(m);
|
|
2026
|
-
var
|
|
2096
|
+
var top = rlTopHtml(m, filters);
|
|
2097
|
+
var sched = rlSchedHtml(m, filters);
|
|
2098
|
+
var jobs = filters.scheduled === true ? "" : rlJobsHtml(m); // M11 am17: the scheduled chip hides Jobs and the quiet fold
|
|
2027
2099
|
if(top !== rlLast.top){ rlLast.top = top; withFocusPreserved(topEl, function(){ topEl.innerHTML = top; }); }
|
|
2100
|
+
if(sched !== rlLast.sched){ rlLast.sched = sched; withFocusPreserved(schedEl, function(){ schedEl.innerHTML = sched; }); }
|
|
2028
2101
|
if(jobs !== rlLast.jobs){ rlLast.jobs = jobs; withFocusPreserved(listEl, function(){ listEl.innerHTML = jobs; }); }
|
|
2029
2102
|
tickSince();
|
|
2030
2103
|
}
|
|
@@ -2097,6 +2170,7 @@
|
|
|
2097
2170
|
'<button class="chip fchip" type="button" aria-pressed="false" data-filter-group="time" data-filter-value="7d" title="last 7 days" data-testid="chip-' + scope + '-time-7d">7d</button>' +
|
|
2098
2171
|
'<button class="chip fchip" type="button" aria-pressed="false" data-filter-group="time" data-filter-value="30d" title="last 30 days" data-testid="chip-' + scope + '-time-30d">30d</button>' +
|
|
2099
2172
|
'<button class="chip fchip" type="button" aria-pressed="true" data-filter-group="time" data-filter-value="all" title="all time" data-testid="chip-' + scope + '-time-all">all</button>' +
|
|
2173
|
+
(noSigns ? '' : '<button class="chip fchip" type="button" aria-pressed="false" data-filter-group="view" data-filter-value="scheduled" title="scheduled jobs only" aria-label="scheduled jobs only" data-testid="chip-' + scope + '-scheduled">◷</button>') +
|
|
2100
2174
|
'<button class="chip fchip" type="button" id="' + scope + '-filter-clear" data-testid="' + scope + '-filter-clear">clear</button>' +
|
|
2101
2175
|
'</div>' +
|
|
2102
2176
|
'<div class="hint" id="' + scope + '-filter-count" data-testid="' + scope + '-filter-count"></div>' +
|
|
@@ -2111,7 +2185,7 @@
|
|
|
2111
2185
|
// shape (src/panel/data.js's listRuns). M11 am5: the search splits at spaces and EVERY word must match, case-insensitive. A word shaped run-N is
|
|
2112
2186
|
// that run exactly; a word shaped MM/DD, MM-DD or YYYY-MM-DD (a real day) is the run's LOCAL start day (`when`, the time the card shows; MM/DD = any year);
|
|
2113
2187
|
// any other word (a part date like 10/1 too) is a substring of the flow name or the runId.
|
|
2114
|
-
function matchesSearch(flow, runId, query, when){
|
|
2188
|
+
function matchesSearch(flow, runId, query, when, nameOnly){
|
|
2115
2189
|
var words = String(query || "").toLowerCase().replace(/[()]/g, "").split(/\s+/).filter(function(w){ return w; });
|
|
2116
2190
|
if(!words.length) return true;
|
|
2117
2191
|
var f = String(flow || "").toLowerCase();
|
|
@@ -2119,15 +2193,16 @@
|
|
|
2119
2193
|
var d = when ? new Date(when) : null;
|
|
2120
2194
|
var ok = d && !isNaN(d.getTime());
|
|
2121
2195
|
return words.every(function(w){
|
|
2122
|
-
if(/^run-\d+$/.test(w)) return r === w;
|
|
2196
|
+
if(/^run-\d+$/.test(w)) return nameOnly ? true : r === w;
|
|
2123
2197
|
var day = /^(?:(\d{4})-)?(\d\d)[-\/](\d\d)$/.exec(w);
|
|
2124
2198
|
if(day && (day[1] ? w.charAt(4) === "-" && w.charAt(7) === "-" : w.charAt(2) === "/" || w.charAt(2) === "-")){
|
|
2125
2199
|
var mo = Number(day[2]), da = Number(day[3]);
|
|
2126
2200
|
if(mo >= 1 && mo <= 12 && da >= 1 && da <= 31){
|
|
2201
|
+
if(nameOnly) return true;
|
|
2127
2202
|
return !!ok && d.getMonth() + 1 === mo && d.getDate() === da && (!day[1] || d.getFullYear() === Number(day[1]));
|
|
2128
2203
|
}
|
|
2129
2204
|
}
|
|
2130
|
-
return f.indexOf(w) !== -1 || r.indexOf(w) !== -1;
|
|
2205
|
+
return f.indexOf(w) !== -1 || (!nameOnly && r.indexOf(w) !== -1);
|
|
2131
2206
|
});
|
|
2132
2207
|
}
|
|
2133
2208
|
function filterRuns(runs, filters, nowMs){
|
|
@@ -2158,7 +2233,7 @@
|
|
|
2158
2233
|
function createFilterBar(opts){
|
|
2159
2234
|
var scope = opts.scope;
|
|
2160
2235
|
var storageKey = opts.storageKey;
|
|
2161
|
-
var state = { results: [], time: "all", search: "" };
|
|
2236
|
+
var state = { results: [], time: "all", search: "", scheduled: false };
|
|
2162
2237
|
var allItems = [];
|
|
2163
2238
|
|
|
2164
2239
|
function load(){
|
|
@@ -2171,6 +2246,7 @@
|
|
|
2171
2246
|
results: Array.isArray(parsed.results) ? parsed.results : [],
|
|
2172
2247
|
time: typeof parsed.time === "string" ? parsed.time : "all",
|
|
2173
2248
|
search: typeof parsed.search === "string" ? parsed.search : "",
|
|
2249
|
+
scheduled: parsed.scheduled === true,
|
|
2174
2250
|
};
|
|
2175
2251
|
}
|
|
2176
2252
|
}
|
|
@@ -2183,7 +2259,7 @@
|
|
|
2183
2259
|
document.querySelectorAll('.filterbar[data-scope="' + scope + '"] .chip[data-filter-group]').forEach(function(chip){
|
|
2184
2260
|
var group = chip.getAttribute("data-filter-group");
|
|
2185
2261
|
var value = chip.getAttribute("data-filter-value");
|
|
2186
|
-
var active = group === "time" ? state.time === value : state.results.indexOf(value) !== -1;
|
|
2262
|
+
var active = group === "time" ? state.time === value : group === "view" ? state.scheduled : state.results.indexOf(value) !== -1;
|
|
2187
2263
|
chip.setAttribute("aria-pressed", active ? "true" : "false");
|
|
2188
2264
|
});
|
|
2189
2265
|
var searchEl = document.getElementById(scope + "-filter-search");
|
|
@@ -2193,7 +2269,7 @@
|
|
|
2193
2269
|
var filtered = opts.filterFn(allItems, state, Date.now());
|
|
2194
2270
|
opts.applyFn(filtered);
|
|
2195
2271
|
var countEl = document.getElementById(scope + "-filter-count");
|
|
2196
|
-
if(countEl) countEl.textContent = "showing " + filtered.length + " of " + allItems.length + " " + (opts.noun || "runs");
|
|
2272
|
+
if(countEl) countEl.textContent = (opts.countFn && opts.countFn(state)) || ("showing " + filtered.length + " of " + allItems.length + " " + (opts.noun || "runs"));
|
|
2197
2273
|
}
|
|
2198
2274
|
document.querySelectorAll('.filterbar[data-scope="' + scope + '"] .chip[data-filter-group]').forEach(function(chip){
|
|
2199
2275
|
chip.addEventListener("click", function(){
|
|
@@ -2201,6 +2277,8 @@
|
|
|
2201
2277
|
var value = chip.getAttribute("data-filter-value");
|
|
2202
2278
|
if(group === "time"){
|
|
2203
2279
|
state.time = value; // single-select within time
|
|
2280
|
+
} else if(group === "view"){
|
|
2281
|
+
state.scheduled = !state.scheduled; // M11 am17: the scheduled chip, the one writer of state.scheduled
|
|
2204
2282
|
} else {
|
|
2205
2283
|
var idx = state.results.indexOf(value);
|
|
2206
2284
|
if(idx === -1) state.results.push(value); else state.results.splice(idx, 1);
|
|
@@ -2213,7 +2291,7 @@
|
|
|
2213
2291
|
var clearBtn = document.getElementById(scope + "-filter-clear");
|
|
2214
2292
|
if(clearBtn){
|
|
2215
2293
|
clearBtn.addEventListener("click", function(){
|
|
2216
|
-
state = { results: [], time: "all", search: "" };
|
|
2294
|
+
state = { results: [], time: "all", search: "", scheduled: false };
|
|
2217
2295
|
paint();
|
|
2218
2296
|
save();
|
|
2219
2297
|
apply();
|
|
@@ -2237,8 +2315,17 @@
|
|
|
2237
2315
|
};
|
|
2238
2316
|
}
|
|
2239
2317
|
|
|
2240
|
-
// ONE filter bar, mounted
|
|
2318
|
+
// ONE filter bar, mounted below the unfiltered sections (Running now, Needs you); Scheduled and Jobs sit below it (M11 am20). The search narrows Scheduled; the chips act on Jobs and quiet jobs only: `runsFilterFn` keeps a job when ANY of its runs match.
|
|
2241
2319
|
document.getElementById("runs-filterbar-anchor").innerHTML = filterBarHTML("runs");
|
|
2320
|
+
// M11 am21: ◷'s ink is as tall as ✓'s, whatever font draws it. Canvas measureText of each chip's own font (works in a hidden tab) at 100px; ◷ gets the size that makes its ink match ✓'s.
|
|
2321
|
+
function fitChips(){
|
|
2322
|
+
var cv = document.createElement("canvas").getContext("2d");
|
|
2323
|
+
var ink = function(e){ var cs = getComputedStyle(e); cv.font = cs.fontWeight + " 100px " + cs.fontFamily; var m = cv.measureText(e.textContent); return m.actualBoundingBoxAscent + m.actualBoundingBoxDescent; };
|
|
2324
|
+
var ok = document.querySelector('[data-testid="chip-runs-res-pass"]'), sc = document.querySelector('[data-testid="chip-runs-scheduled"]');
|
|
2325
|
+
if(!ok || !sc || !ink(sc)) return;
|
|
2326
|
+
sc.style.fontSize = (parseFloat(getComputedStyle(ok).fontSize) * ink(ok) / ink(sc)) + "px";
|
|
2327
|
+
}
|
|
2328
|
+
fitChips();
|
|
2242
2329
|
|
|
2243
2330
|
function runsFilterFn(items, filters, nowMs){
|
|
2244
2331
|
return filterWorkflows(groupRunsByFlow(items), filters, nowMs);
|
|
@@ -2251,9 +2338,10 @@
|
|
|
2251
2338
|
storageKey: "fwdloop-panel-runs-filters",
|
|
2252
2339
|
filterFn: runsFilterFn,
|
|
2253
2340
|
applyFn: runsApplyFn,
|
|
2341
|
+
countFn: function(st){ return st.scheduled === true ? rlSchedCountText(rlSchedShown(rlData.scheduled, st.search).length) : null; }, // M11 am20: ◷ pressed, the line counts scheduled jobs
|
|
2254
2342
|
});
|
|
2255
2343
|
function currentRunsFilters(){
|
|
2256
|
-
return runsFilterBar ? runsFilterBar.getState() : { results: [], time: "all", search: "" };
|
|
2344
|
+
return runsFilterBar ? runsFilterBar.getState() : { results: [], time: "all", search: "", scheduled: false };
|
|
2257
2345
|
}
|
|
2258
2346
|
|
|
2259
2347
|
// item 4: phone-only "scroll the run view into view" on row select, and
|
|
@@ -2280,6 +2368,212 @@
|
|
|
2280
2368
|
document.querySelectorAll(".inbox-row").forEach(function(r){ r.classList.remove("selected"); r.setAttribute("aria-pressed","false"); });
|
|
2281
2369
|
}
|
|
2282
2370
|
|
|
2371
|
+
// borrowed-from: bareloop src/panel/index.html@2959217 :2839 (stateDotHTML)
|
|
2372
|
+
function stateDotHTML(cls, word, testid){
|
|
2373
|
+
return '<span class="step-state" data-testid="' + testid + '"><span class="dot ' + cls + (cls === "amber" ? " pulse" : "") + '"></span><b class="st-word">' + escapeXml(word) + '</b></span>';
|
|
2374
|
+
}
|
|
2375
|
+
// ---- Result tab (M10 am4: a copy of bareloop's, PRD v1.107 Part 6) ----
|
|
2376
|
+
// borrowed-from: bareloop src/panel/index.html@2959217 :3646-3833, adjusted to fwdloop's shape: the run is (flow, runId); the status word is `detail.word`;
|
|
2377
|
+
// the run name is `<flow> (<runId>)`; no Your-call card or pointer here (item 5 waits).
|
|
2378
|
+
// The server decides everything: `detail.hasResult` shows the tab, `/result` carries the signed lines, the facts' own sentences
|
|
2379
|
+
// (src/facts.js factSentence), the rows of the delivered file (sha256-checked against the run's own record) and `passed` (read from the
|
|
2380
|
+
// run's own check-run). The page only draws; it never decides a check and never searches a quote for a word.
|
|
2381
|
+
var resultDetail = null;
|
|
2382
|
+
var resultData = null;
|
|
2383
|
+
function resultTabShown(){ return document.getElementById("tab-result").getAttribute("aria-selected") === "true"; }
|
|
2384
|
+
function clearResult(){
|
|
2385
|
+
resultDetail = null; resultData = null;
|
|
2386
|
+
document.getElementById("result-body").hidden = true;
|
|
2387
|
+
document.getElementById("result-body").innerHTML = "";
|
|
2388
|
+
document.getElementById("result-empty").hidden = false;
|
|
2389
|
+
}
|
|
2390
|
+
// called by renderRun for every detail it draws: shows or removes the tab button
|
|
2391
|
+
function syncResultTab(detail){
|
|
2392
|
+
var btn = document.getElementById("tab-result");
|
|
2393
|
+
var show = detail.hasResult === true;
|
|
2394
|
+
if(!show && resultTabShown()) document.getElementById("tab-run").click();
|
|
2395
|
+
btn.hidden = !show;
|
|
2396
|
+
var same = !!resultData && resultData.flow === detail.flow && resultData.runId === detail.runId;
|
|
2397
|
+
if(!show || !same) clearResult(); // another run's rows never stay on screen
|
|
2398
|
+
resultDetail = show ? detail : null;
|
|
2399
|
+
if(show && same) renderResult();
|
|
2400
|
+
}
|
|
2401
|
+
function loadResult(flow, runId){
|
|
2402
|
+
return getJSON("/api/runs/" + encodeURIComponent(flow) + "/" + encodeURIComponent(runId) + "/result").then(function(data){
|
|
2403
|
+
if(currentFlow !== flow || currentRunId !== runId || !resultDetail || resultDetail.flow !== data.flow || resultDetail.runId !== data.runId) return;
|
|
2404
|
+
resultData = data;
|
|
2405
|
+
renderResult();
|
|
2406
|
+
}).catch(function(){ /* the tab keeps what it last drew */ });
|
|
2407
|
+
}
|
|
2408
|
+
document.getElementById("tab-result").addEventListener("click", function(){ if(currentRunId !== null) loadResult(currentFlow, currentRunId); });
|
|
2409
|
+
|
|
2410
|
+
// a RED run's own file words (the last file its check judged: "the file is gone" / "the file changed after the check") and the one note that says
|
|
2411
|
+
// what those rows are. A DELIVERED file's gone/changed words are said once, in the Saved card, never here.
|
|
2412
|
+
function resultFileWords(file){
|
|
2413
|
+
var note = file && file.judged && file.note ? '<div class="hint" data-testid="result-judged-note">' + escapeXml(file.note) + '</div>' : "";
|
|
2414
|
+
return note + (file && file.judged && file.words ? '<div class="rs-warn" data-testid="result-file-words">' + escapeXml(file.words) + '</div>' : "");
|
|
2415
|
+
}
|
|
2416
|
+
function resultField(label, inner){
|
|
2417
|
+
return '<div class="field"><label>' + escapeXml(label) + '</label>' + inner + '</div>';
|
|
2418
|
+
}
|
|
2419
|
+
// the numbered job line and its ~ rules, one box (the Job tab's "N. text" spelling, a space after the number)
|
|
2420
|
+
function resultLineBox(line){
|
|
2421
|
+
return resultField("The job line", '<div class="ro-value" data-testid="result-linetext">' + escapeXml(line.n + ". " + line.text) +
|
|
2422
|
+
(line.rules || []).map(function(r){ return '<br>~ ' + escapeXml(r); }).join("") + '</div>');
|
|
2423
|
+
}
|
|
2424
|
+
// no saved result to show: one line, never the file-state words (those are in Saved)
|
|
2425
|
+
var RESULT_NONE = "no saved result to show";
|
|
2426
|
+
// the proof quote, with the words the check read marked. The server sends the check's own text and offsets (`r.proof`: bareguard's
|
|
2427
|
+
// `full.evidence`, spans already chosen and merged); the page only cuts the text at those offsets, escapes every piece and marks.
|
|
2428
|
+
// It never searches a quote for a word. No proof (an old run, a quote the check did not read): the plain quote, unmarked.
|
|
2429
|
+
function resultProofHtml(r){
|
|
2430
|
+
var p = r.proof;
|
|
2431
|
+
if(!p || typeof p.text !== "string" || !Array.isArray(p.marks)) return escapeXml(r.quote);
|
|
2432
|
+
var h = "", at = 0;
|
|
2433
|
+
p.marks.forEach(function(m){
|
|
2434
|
+
h += escapeXml(p.text.slice(at, m[0])) + "<mark>" + escapeXml(p.text.slice(m[0], m[1])) + "</mark>";
|
|
2435
|
+
at = m[1];
|
|
2436
|
+
});
|
|
2437
|
+
return h + escapeXml(p.text.slice(at));
|
|
2438
|
+
}
|
|
2439
|
+
function resultFactsLine(line){
|
|
2440
|
+
var facts = line.facts || [];
|
|
2441
|
+
var n = facts.length;
|
|
2442
|
+
var ok = line.passed === true ? ' <span class="rs-ok" data-testid="result-ok">\u2713</span>' : "";
|
|
2443
|
+
var h = resultFileWords(line.file);
|
|
2444
|
+
if(Array.isArray(line.rows) && line.rows.length){
|
|
2445
|
+
h += resultField("Results (" + line.rows.length + ")", '<div class="ro-value" data-testid="result-results">' + line.rows.map(function(r){
|
|
2446
|
+
return '<div class="ro-value" data-testid="result-row" style="margin-bottom:8px">' +
|
|
2447
|
+
'<div style="display:flex;justify-content:space-between;flex-wrap:wrap;gap:6px"><b style="color:var(--text)">Result ' + r.n + '</b>' +
|
|
2448
|
+
(line.passed === true ? '<span class="rs-ok" data-testid="result-count">' + n + ' of ' + n + ' \u2713</span>' : "") + '</div>' +
|
|
2449
|
+
'<div class="field-row" style="margin-top:6px">' + r.cells.map(function(c, i){
|
|
2450
|
+
return '<div class="field"><label>' + escapeXml(facts[i] ? facts[i].name : "") + '</label><div class="ro-value" data-testid="result-cell">' + escapeXml(c) + ok + '</div></div>';
|
|
2451
|
+
}).join("") + '</div>' +
|
|
2452
|
+
'<details data-testid="result-proof"><summary>proof \u2014 the page\'s own words</summary><div class="ro-value" data-testid="result-quote" style="overflow-wrap:anywhere">' + resultProofHtml(r) + '</div></details></div>';
|
|
2453
|
+
}).join("") + '</div>');
|
|
2454
|
+
} else if(!(line.file && line.file.judged && line.file.words)){
|
|
2455
|
+
h += '<div class="hint" data-testid="result-nofile">' + RESULT_NONE + '</div>';
|
|
2456
|
+
}
|
|
2457
|
+
if(facts.length){
|
|
2458
|
+
h += resultField("The checks", '<div class="ro-value" data-testid="result-rules">' +
|
|
2459
|
+
facts.map(function(f){ return escapeXml(f.sentence) + (f.note ? ' ' + escapeXml(f.note) : ""); }).join("<br>") +
|
|
2460
|
+
(line.passed === true && Array.isArray(line.rows) && line.rows.length ? '<br><span class="hint">\u2713 = code checked it against the saved page</span>' : "") + '</div>');
|
|
2461
|
+
}
|
|
2462
|
+
return h;
|
|
2463
|
+
}
|
|
2464
|
+
// M10 am9 item 2: what the line's step checked, one row each, ✓ or ✗, in the Audit try line's words (the server's `text` and `result`; code wrote them).
|
|
2465
|
+
// A line with none draws nothing.
|
|
2466
|
+
function resultChecksList(line){
|
|
2467
|
+
var cs = line.checks || [];
|
|
2468
|
+
if(!cs.length) return "";
|
|
2469
|
+
return resultField(line.kind === "facts" ? "What the step checked" : "The checks", '<div class="ro-value" data-testid="result-checklist">' + cs.map(function(c){
|
|
2470
|
+
return '<div data-testid="result-check"><span class="' + (c.ok ? "rs-ok" : "rs-bad") + '">' + (c.ok ? "\u2713" : "\u2717") + '</span> ' + escapeXml(c.text) +
|
|
2471
|
+
(c.result ? ' (' + escapeXml(c.result) + ')' : "") + '</div>';
|
|
2472
|
+
}).join("") + '</div>');
|
|
2473
|
+
}
|
|
2474
|
+
function resultTextLine(line){
|
|
2475
|
+
var h = resultFileWords(line.file);
|
|
2476
|
+
if(typeof line.answer === "string") h += resultField("Answer", '<div class="ro-value" data-testid="result-answer" style="color:var(--text);white-space:pre-wrap">' + escapeXml(line.answer) + '</div>');
|
|
2477
|
+
else if(!(line.file && line.file.judged && line.file.words)) h += '<div class="hint" data-testid="result-nofile">' + RESULT_NONE + '</div>';
|
|
2478
|
+
(line.cites || []).forEach(function(c){
|
|
2479
|
+
h += resultField("Quotes from " + c.label + " (" + c.items.length + ")", '<details data-testid="result-cites"><summary>show</summary><div class="ro-value" style="white-space:pre-wrap">' +
|
|
2480
|
+
c.items.map(function(it){ return '<b>' + escapeXml(it.claim) + '</b>\n' + escapeXml(it.quote); }).join("\n\n") + '</div></details>');
|
|
2481
|
+
});
|
|
2482
|
+
return h;
|
|
2483
|
+
}
|
|
2484
|
+
// a list, one row per item (the Job tab lists the same items one per row)
|
|
2485
|
+
function resultNotChecked(label, items, testid){
|
|
2486
|
+
if(!items || !items.length) return "";
|
|
2487
|
+
return resultField(label, '<div class="ro-value" data-testid="' + testid + '"><ul style="margin:0;padding-left:18px">' +
|
|
2488
|
+
items.map(function(t){ return '<li>' + escapeXml(t) + '</li>'; }).join("") + '</ul></div>');
|
|
2489
|
+
}
|
|
2490
|
+
// the web page a result was read from: a link (http/https only, new tab) and the server's words that the page may have moved on
|
|
2491
|
+
function resultPageLink(url, note, testid){
|
|
2492
|
+
if(typeof url !== "string" || !/^https?:\/\//i.test(url)) return "";
|
|
2493
|
+
return resultField("Page read", '<div class="ro-value" data-testid="' + testid + '" style="overflow-wrap:anywhere"><a href="' + escapeXml(url) +
|
|
2494
|
+
'" target="_blank" rel="noopener noreferrer">' + escapeXml(url) + '</a><div class="hint" data-testid="result-page-note">' + escapeXml(note || "") + '</div></div>');
|
|
2495
|
+
}
|
|
2496
|
+
// `own` = the Result tab read 2+ pages, so this line's box shows its own page
|
|
2497
|
+
function resultLineCard(line, own, note){
|
|
2498
|
+
return '<div class="job-card" data-testid="result-line"><h4>Line ' + escapeXml(String(line.n)) + '</h4>' + resultLineBox(line) +
|
|
2499
|
+
(own ? resultPageLink(line.page, note, "result-page-line") : "") +
|
|
2500
|
+
(line.kind === "facts" ? resultFactsLine(line) : resultTextLine(line)) + resultChecksList(line) +
|
|
2501
|
+
resultNotChecked("Not checked", line.notChecked, "result-line-notchecked") + '</div>';
|
|
2502
|
+
}
|
|
2503
|
+
function renderResult(){
|
|
2504
|
+
var detail = resultDetail, data = resultData;
|
|
2505
|
+
var body = document.getElementById("result-body");
|
|
2506
|
+
if(!detail || !data || data.flow !== detail.flow || data.runId !== detail.runId){ return; }
|
|
2507
|
+
document.getElementById("result-empty").hidden = true;
|
|
2508
|
+
body.hidden = false;
|
|
2509
|
+
// keep what the person is typing (and the box they opened) across a poll-driven redraw
|
|
2510
|
+
var keepText = body.querySelector("#result-rerun-text");
|
|
2511
|
+
var typed = keepText ? keepText.value : "";
|
|
2512
|
+
var rerunOpen = !!body.querySelector("#result-rerun-box:not([hidden])");
|
|
2513
|
+
var counters = document.getElementById("run-counters").textContent.split(" \u00b7 ");
|
|
2514
|
+
var h = '<div class="job-card" data-testid="result-head"><h4>Result</h4>' +
|
|
2515
|
+
resultField("Status", '<div class="ro-value">' + stateDotHTML(glyphClass(detail.glyph), detail.word || "", "result-status") +
|
|
2516
|
+
' \u00b7 ' + escapeXml(detail.checkType) + ' \u00b7 ' + escapeXml(detail.flow + " (" + detail.runId + ")") + '</div>') +
|
|
2517
|
+
'<div class="field-row">' + resultField("Money", '<div class="ro-value" data-testid="result-counters">' + escapeXml(counters[0] || "") + '</div>') +
|
|
2518
|
+
resultField("Time", '<div class="ro-value">' + escapeXml((counters[1] || "").replace(/^took /, "")) + '</div>') + '</div>' +
|
|
2519
|
+
((data.pages || []).length === 1 ? resultPageLink(data.pages[0], data.pageNote, "result-page-top") : "") + '</div>';
|
|
2520
|
+
var ownPages = (data.pages || []).length >= 2;
|
|
2521
|
+
(data.lines || []).forEach(function(line){ h += resultLineCard(line, ownPages, data.pageNote); });
|
|
2522
|
+
if(data.gap){
|
|
2523
|
+
h += '<div class="rs-warn" data-testid="result-gap">The check said: ' + escapeXml(data.gap.line) + (data.gap.moreText ? ' ' + escapeXml(data.gap.moreText) : "") + '</div>';
|
|
2524
|
+
}
|
|
2525
|
+
if((data.notChecked || []).length){
|
|
2526
|
+
h += '<div class="job-card"><h4>Not checked</h4>' + resultNotChecked(data.notCheckedLabel, data.notChecked, "result-notchecked") + '</div>';
|
|
2527
|
+
}
|
|
2528
|
+
if((data.readNotes || []).length){
|
|
2529
|
+
h += '<div class="job-card"><h4>How the page was read</h4>' + resultNotChecked("How the page was read \u00b7 " + data.readNotes.length, data.readNotes, "result-readnotes") + '</div>';
|
|
2530
|
+
}
|
|
2531
|
+
if(data.door) h += resultDoorHtml(data.door);
|
|
2532
|
+
if((data.delivered || []).length){
|
|
2533
|
+
h += '<div class="job-card" data-testid="result-saved"><h4>Saved</h4>' + data.delivered.map(function(d){
|
|
2534
|
+
return resultField(d.name, '<div class="ro-value" data-testid="result-path" style="overflow-wrap:anywhere">' + escapeXml(d.path) + '</div>' +
|
|
2535
|
+
(d.words ? '<div class="rs-warn" data-testid="result-file-gone">' + escapeXml(d.words) + '</div>'
|
|
2536
|
+
: '<div class="run-actions" style="margin:6px 0 0;"><a class="btn" style="text-decoration:none;" data-testid="result-download" download href="/api/runs/' + encodeURIComponent(data.flow) + '/' + encodeURIComponent(data.runId) + '/download?i=' + d.i + '">Download ' + escapeXml(d.name) + '</a></div>'));
|
|
2537
|
+
}).join("") + '</div>';
|
|
2538
|
+
}
|
|
2539
|
+
body.innerHTML = h;
|
|
2540
|
+
var ta = body.querySelector("#result-rerun-text");
|
|
2541
|
+
if(ta){
|
|
2542
|
+
ta.value = typed;
|
|
2543
|
+
if(rerunOpen){ body.querySelector("#result-rerun-box").hidden = false; body.querySelector('[data-testid="result-rerun"]').disabled = typed.trim() === ""; }
|
|
2544
|
+
wireResultDoor(body, data.door, data.flow, data.runId);
|
|
2545
|
+
}
|
|
2546
|
+
paintAnswerMsg();
|
|
2547
|
+
}
|
|
2548
|
+
// M10 am5 item 2: the Your-call card. Bareloop's words and layout; no Pause (a run waiting for you stays open and spends nothing until you answer or its ask wait ends).
|
|
2549
|
+
// Accept and Rerun with my words are the Ask tab's own: the same `sendAnswer` and POST /api/answer (decision accept / rerun, the words as the reason), so an
|
|
2550
|
+
// answer given here is the answer on every tab. The server decides when the card is shown (`door`); the page types none of its words.
|
|
2551
|
+
function resultDoorHtml(door){
|
|
2552
|
+
return '<div class="job-card" id="result-door-card" data-testid="result-door"><h4>Your call</h4><div class="field"><div class="ro-value"><b class="st-word">' + escapeXml(door.head) + '</b> \u2014 ' + escapeXml(door.ask) + '</div></div>' +
|
|
2553
|
+
'<div class="run-actions" style="margin:6px 0 0;"><button class="btn primary" type="button" data-testid="result-accept">Accept</button>' +
|
|
2554
|
+
'<button class="btn" type="button" data-testid="result-rerun-open">Rerun with my words</button></div>' +
|
|
2555
|
+
'<div id="result-rerun-box" data-testid="result-rerun-box" hidden><textarea id="result-rerun-text" data-testid="result-rerun-text" aria-label="your words for the rerun" placeholder="e.g. only morning flights, and show the airline"></textarea>' +
|
|
2556
|
+
'<button class="btn" type="button" data-testid="result-rerun" disabled>Rerun</button></div>' +
|
|
2557
|
+
'<div id="result-door-msg" data-testid="result-door-msg"></div></div>';
|
|
2558
|
+
}
|
|
2559
|
+
function wireResultDoor(body, door, flow, runId){
|
|
2560
|
+
var card = body.querySelector("#result-door-card");
|
|
2561
|
+
if(!card) return;
|
|
2562
|
+
var ask = {askId: door.askId};
|
|
2563
|
+
var ctx = {flow: flow, runId: runId, draftNo: door.draftNo};
|
|
2564
|
+
card.querySelector('[data-testid="result-accept"]').addEventListener("click", function(){ sendAnswer(card, ask, ctx, "accept"); });
|
|
2565
|
+
var box = card.querySelector("#result-rerun-box");
|
|
2566
|
+
var txt = card.querySelector("#result-rerun-text");
|
|
2567
|
+
var go = card.querySelector('[data-testid="result-rerun"]');
|
|
2568
|
+
card.querySelector('[data-testid="result-rerun-open"]').addEventListener("click", function(){ box.hidden = !box.hidden; if(!box.hidden) txt.focus(); });
|
|
2569
|
+
// required: the button stays off while the words are empty, and the click re-checks (the engine refuses empty words too)
|
|
2570
|
+
txt.addEventListener("input", function(){ go.disabled = txt.value.trim() === ""; });
|
|
2571
|
+
go.addEventListener("click", function(){
|
|
2572
|
+
if(txt.value.trim() === ""){ say(flow, runId, "refused", "Write what you want done differently, then press Rerun."); return; }
|
|
2573
|
+
sendAnswer(card, ask, ctx, "rerun");
|
|
2574
|
+
});
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2283
2577
|
// ---- Run tab: header + summary + step map + one card per step ATTEMPT
|
|
2284
2578
|
// (ruling A, 2026-09-26: "no per-round parts") — built off getRunDetail's
|
|
2285
2579
|
// `steps[]` (declaration.steps joined with audit.jsonl attempts), never a
|
|
@@ -2353,16 +2647,21 @@
|
|
|
2353
2647
|
// read straight off detail.steps/detail.spendSummary, never re-derived
|
|
2354
2648
|
// from a second, separately-fetched copy of the audit rows.
|
|
2355
2649
|
var modelText = detail.model || (detail.modelWhy || "no model call recorded yet");
|
|
2650
|
+
// M9 am21/am22: the run's time follows its cost on the top line, after a middle dot like the cost's: the same number as the `took ...` line (one source, detail.wallMs); a finished run without one says so, never 0; a run still going or waiting shows none.
|
|
2651
|
+
var headTime = !runFinished(detail) ? "" : (typeof detail.wallMs === "number" ? duration(detail.wallMs) : "time not recorded");
|
|
2356
2652
|
var closeText = closeClassSummaryText(detail.steps) || (detail.stepsWhy || "no steps recorded");
|
|
2357
2653
|
box.innerHTML =
|
|
2358
|
-
'<div class="summary-headline"><span class="' + dotClass(detail.glyph, detail.pulse) + '"></span>' + signHtml(detail.word, detail.line, detail.label) + ' · <span class="num">' + escapeXml(spendText) + '</span
|
|
2654
|
+
'<div class="summary-headline"><span class="' + dotClass(detail.glyph, detail.pulse) + '"></span>' + signHtml(detail.word, detail.line, detail.label) + ' · <span class="num">' + escapeXml(spendText) + '</span>' + (headTime ? ' · ' + escapeXml(headTime) : '') + '</div>' +
|
|
2359
2655
|
'<div class="summary-row" data-testid="summary-model"><span class="sum-label">model:</span><span class="sum-val">' + escapeXml(modelText) + '</span></div>' +
|
|
2360
2656
|
'<div class="summary-row"><span class="sum-label">steps:</span><span class="sum-val">' + stepsText + '</span></div>' +
|
|
2361
2657
|
'<div class="summary-row" data-testid="summary-why"><span class="sum-label">why:</span><span class="sum-val">' + escapeXml(detail.stopReason || detail.stopReasonWhy || "not recorded") + '</span></div>' +
|
|
2362
2658
|
'<div class="summary-row" data-testid="summary-close"><span class="sum-label">close:</span><span class="sum-val">' + escapeXml(closeText) + '</span></div>' +
|
|
2363
|
-
'<div class="summary-row" data-testid="summary-spend"><span class="sum-label">spend:</span><span class="sum-val">' + spendSummaryText(detail.spendSummary) + '</span></div>'
|
|
2659
|
+
'<div class="summary-row" data-testid="summary-spend"><span class="sum-label">spend:</span><span class="sum-val">' + spendSummaryText(detail.spendSummary) + '</span></div>' +
|
|
2660
|
+
'<div class="summary-row" data-testid="summary-calls"><span class="sum-label">calls:</span><span class="sum-val">' + escapeXml((detail.runLines && detail.runLines.calls) || "\u2014") + '</span></div>' +
|
|
2661
|
+
'<div class="summary-row" data-testid="summary-checks"><span class="sum-label">checks:</span><span class="sum-val">' + escapeXml((detail.runLines && detail.runLines.checks) || "\u2014") + '</span></div>';
|
|
2364
2662
|
|
|
2365
2663
|
renderRunActions(detail);
|
|
2664
|
+
syncResultTab(detail); // M10 am4: shows or hides the Result tab; the ONE caller
|
|
2366
2665
|
// amendment 7 item 2: the Draft is the first box of the Map (an arrow runs on to step 1); the steps keep their own numbers
|
|
2367
2666
|
renderStepMap(stepBoxes.length ? [draftBox(detail.draft)].concat(stepBoxes.map(function(b, i){ return Object.assign({}, b, {n: i + 1}); })) : stepBoxes);
|
|
2368
2667
|
|
|
@@ -2381,6 +2680,8 @@
|
|
|
2381
2680
|
// unknown" row.
|
|
2382
2681
|
if(box.attempts.length) card.appendChild(buildStepActionsLineEl(box, idx));
|
|
2383
2682
|
else card.appendChild(textLineEl("hint", "not attempted yet", "step-card-actions-" + idx));
|
|
2683
|
+
// M4d am29 item 6: the one new line, the server's words (`—` with no record); a human step's answer time is formatted here, in the viewer's clock
|
|
2684
|
+
card.appendChild(textLineEl("step-meta", box.newLine + (box.who === "human" && box.lastAnswerAt ? " \u00b7 " + (new Date(box.lastAnswerAt).toLocaleTimeString()) : ""), "step-card-new-" + idx));
|
|
2384
2685
|
// Amendment M4a-3 (hamr's request): "tools: read 3 · write 1" (this
|
|
2385
2686
|
// step's own tool tally, `summarizeStepTools`) plus "allowed: read,
|
|
2386
2687
|
// write" (the signed grant, unchanged from the old "granted:" line) —
|
|
@@ -2515,6 +2816,14 @@
|
|
|
2515
2816
|
closeBadge.className = "badge cyan";
|
|
2516
2817
|
closeBadge.textContent = closeClassLabel(box.closeClass);
|
|
2517
2818
|
head.appendChild(closeBadge);
|
|
2819
|
+
// M4d am29 item 6: the same marker as the Audit header; only a step with a record has one
|
|
2820
|
+
if(box.who){
|
|
2821
|
+
var who = document.createElement("span");
|
|
2822
|
+
who.className = "who " + box.who;
|
|
2823
|
+
who.setAttribute("data-testid", "step-card-who-" + idx);
|
|
2824
|
+
who.textContent = foldWhoWords(box.who);
|
|
2825
|
+
head.appendChild(who);
|
|
2826
|
+
}
|
|
2518
2827
|
return head;
|
|
2519
2828
|
}
|
|
2520
2829
|
// The actions line: "<time> · <cost> · [N tokens ·] try N <marks>" — every
|
|
@@ -2605,7 +2914,7 @@
|
|
|
2605
2914
|
// hamr's 2026-09-27 review item (b): a jump from the Run tab must land
|
|
2606
2915
|
// on an OPEN group even if a human had folded it — never scroll to a
|
|
2607
2916
|
// collapsed section with nothing visible in it.
|
|
2608
|
-
var table = row.querySelector("table");
|
|
2917
|
+
var table = row.querySelector("table, .audit-fold-body");
|
|
2609
2918
|
var header = row.querySelector("h4");
|
|
2610
2919
|
if(table && table.hidden){
|
|
2611
2920
|
table.hidden = false;
|
|
@@ -2648,6 +2957,8 @@
|
|
|
2648
2957
|
if(!Array.isArray(r.raw) || r.raw.length === 0) return "";
|
|
2649
2958
|
return r.raw.map(function(t){ return "<div class=\"audit-raw\">" + escapeXml(String(t)) + "</div>"; }).join("");
|
|
2650
2959
|
}
|
|
2960
|
+
// M4d am26: ` · thinking off` after a model try's verdict, the server's words (`r.thinkingPhrase`); nothing for a row that has none
|
|
2961
|
+
function auditThinkingHtml(r){ return typeof r.thinkingPhrase === "string" && r.thinkingPhrase.length > 0 ? " \u00b7 " + escapeXml(r.thinkingPhrase) : ""; }
|
|
2651
2962
|
function buildAuditRowEl(r, includeStep){
|
|
2652
2963
|
var tr = document.createElement("tr");
|
|
2653
2964
|
var glyph = verdictGlyph(r.verdict, r.class);
|
|
@@ -2666,7 +2977,7 @@
|
|
|
2666
2977
|
"<td data-label=\"Action\">" + escapeXml(actionText) + "</td>" +
|
|
2667
2978
|
"<td data-label=\"Gap\">" + escapeXml(isRejectRow ? "" : auditGapText(r)) + auditRawHtml(r) + "</td>" +
|
|
2668
2979
|
"<td data-label=\"Cost\">" + escapeXml(auditCostCellText(r)) + "</td>" +
|
|
2669
|
-
"<td data-label=\"Verdict\"><span class=\"badge " + badgeClass + "\">" + escapeXml(word) + "</span
|
|
2980
|
+
"<td data-label=\"Verdict\"><span class=\"badge " + badgeClass + "\">" + escapeXml(word) + "</span>" + auditThinkingHtml(r) + "</td>" +
|
|
2670
2981
|
"<td data-label=\"Close\">" + escapeXml(auditCloseText(r)) + "</td>" +
|
|
2671
2982
|
"<td data-label=\"Time\">" + auditTimeCellHtml(r) + "</td>" +
|
|
2672
2983
|
// phone-only one-line cells (CSS shows these and hides the rest below 640px; hidden on desktop)
|
|
@@ -2764,6 +3075,7 @@
|
|
|
2764
3075
|
if(g.draft) return draftLineText(g.summary);
|
|
2765
3076
|
var line = [p.status, p.name, p.cost].join(" " + p.dot + " ");
|
|
2766
3077
|
if(p.tries) line += " \u00b7 try " + p.tries.n + " " + p.tries.marks.join("");
|
|
3078
|
+
if(g.fold) line += " " + foldWhoWords(g.fold.who);
|
|
2767
3079
|
return line;
|
|
2768
3080
|
}
|
|
2769
3081
|
// hamr's 2026-09-27 review: the header's status word gets the SAME color
|
|
@@ -2841,12 +3153,106 @@
|
|
|
2841
3153
|
});
|
|
2842
3154
|
}
|
|
2843
3155
|
h4.appendChild(tail);
|
|
3156
|
+
// M4d am29 item 4: the header ends with who acted on the step; only a step with a fold (a run with records) has it
|
|
3157
|
+
if(g.fold){
|
|
3158
|
+
var who = document.createElement("span");
|
|
3159
|
+
who.className = "audit-fold-who " + g.fold.who;
|
|
3160
|
+
who.setAttribute("data-testid", "audit-group-who");
|
|
3161
|
+
who.textContent = foldWhoWords(g.fold.who);
|
|
3162
|
+
h4.appendChild(who);
|
|
3163
|
+
}
|
|
2844
3164
|
return h4;
|
|
2845
3165
|
}
|
|
2846
3166
|
// Grouped view: one section per step, server order preserved (first-seen
|
|
2847
3167
|
// order of `r.step` across this run's own rows — never re-sorted).
|
|
2848
3168
|
// review item #1: COLLAPSED by default — a map/step-card click
|
|
2849
3169
|
// (`openAuditGroup`) is the only thing that force-expands one.
|
|
3170
|
+
// M4d am29 (items 4-6): the step fold's words, all from the server's `fold` (src/audit-fold.js); this page only draws them.
|
|
3171
|
+
function foldWhoWords(who){ return who === "human" ? "[human \u00b7 ask]" : "[model]"; }
|
|
3172
|
+
function foldSize(n){ return n < 1024 ? n + " B" : (n < 1048576 ? (n / 1024).toFixed(1) + " KB" : (n / 1048576).toFixed(1) + " MB"); }
|
|
3173
|
+
function foldEl(tag, cls, text, testId){
|
|
3174
|
+
var e = document.createElement(tag);
|
|
3175
|
+
if(cls) e.className = cls;
|
|
3176
|
+
if(text !== null && text !== undefined) e.textContent = text;
|
|
3177
|
+
if(testId) e.setAttribute("data-testid", testId);
|
|
3178
|
+
return e;
|
|
3179
|
+
}
|
|
3180
|
+
function foldTryEl(t, human){
|
|
3181
|
+
var wrap = document.createElement("div");
|
|
3182
|
+
var line = foldEl("div", "audit-try", null, "audit-try-line");
|
|
3183
|
+
line.appendChild(document.createTextNode("try " + t.n + " "));
|
|
3184
|
+
line.appendChild(foldEl("span", "mark " + auditMarkClass(t.mark), t.mark));
|
|
3185
|
+
var rest = human
|
|
3186
|
+
? [t.answer, t.about ? "about " + t.about : null]
|
|
3187
|
+
: [t.thinking, t.gap];
|
|
3188
|
+
rest.forEach(function(x){ if(x) line.appendChild(document.createTextNode(" \u00b7 " + x)); });
|
|
3189
|
+
wrap.appendChild(line);
|
|
3190
|
+
if(!human && t.checks && t.checks.length){
|
|
3191
|
+
var box = foldEl("div", "audit-checks", null, "audit-checks");
|
|
3192
|
+
t.checks.forEach(function(c){
|
|
3193
|
+
var row = foldEl("div", "audit-chk", null, "audit-check");
|
|
3194
|
+
row.appendChild(foldEl("span", "mark " + (c.ok ? "green" : "red"), c.ok ? "\u2713" : "\u2717"));
|
|
3195
|
+
row.appendChild(foldEl("span", null, "#" + c.n + " " + c.text + (c.result ? " (" + c.result + ")" : "")));
|
|
3196
|
+
row.appendChild(foldEl("span", "src", "\u00b7 from " + c.source));
|
|
3197
|
+
box.appendChild(row);
|
|
3198
|
+
});
|
|
3199
|
+
if(t.output){
|
|
3200
|
+
var sha = String(t.output.sha256);
|
|
3201
|
+
box.appendChild(foldEl("div", "audit-judged", "output judged: " + t.output.file + " \u00b7 " + foldSize(t.output.bytes) + " \u00b7 sha256 " + sha.slice(0, 4) + "\u2026" + sha.slice(-2), "audit-judged"));
|
|
3202
|
+
}
|
|
3203
|
+
wrap.appendChild(box);
|
|
3204
|
+
}
|
|
3205
|
+
return wrap;
|
|
3206
|
+
}
|
|
3207
|
+
var ROUNDS_PAGE = 20;
|
|
3208
|
+
function foldRowEl(r, prevTry){
|
|
3209
|
+
var tr = document.createElement("tr");
|
|
3210
|
+
if(prevTry !== null && r.try !== prevTry) tr.className = "trysep";
|
|
3211
|
+
[r.round === null || r.round === undefined ? "\u2014" : String(r.round), r.try === null || r.try === undefined ? "\u2014" : String(r.try), r.action, r.path || "\u2014", r.decision, auditShortTime(r)].forEach(function(t){
|
|
3212
|
+
tr.appendChild(foldEl("td", null, t));
|
|
3213
|
+
});
|
|
3214
|
+
return tr;
|
|
3215
|
+
}
|
|
3216
|
+
// the Round table, 20 rows at a time (bareloop's "showing A\u2013B of N" + load more), table scrolling inside its own box
|
|
3217
|
+
function foldRoundsEl(g){
|
|
3218
|
+
var rows = g.fold.rows || [];
|
|
3219
|
+
var wrap = document.createElement("div");
|
|
3220
|
+
wrap.appendChild(foldEl("div", "audit-fold-label", "rounds"));
|
|
3221
|
+
var scroll = foldEl("div", "audit-table-scroll");
|
|
3222
|
+
var table = document.createElement("table");
|
|
3223
|
+
table.className = "rounds-table";
|
|
3224
|
+
table.setAttribute("data-testid", "rounds-table-" + g.step);
|
|
3225
|
+
table.innerHTML = "<thead><tr><th>Round</th><th>Try</th><th>Action</th><th>Path</th><th>Decision</th><th>Time</th></tr></thead><tbody></tbody>";
|
|
3226
|
+
var tbody = table.querySelector("tbody");
|
|
3227
|
+
scroll.appendChild(table);
|
|
3228
|
+
wrap.appendChild(scroll);
|
|
3229
|
+
var pager = foldEl("div", "rounds-pager", null, "rounds-pager");
|
|
3230
|
+
wrap.appendChild(pager);
|
|
3231
|
+
var shown = 0;
|
|
3232
|
+
function more(){
|
|
3233
|
+
var to = Math.min(rows.length, shown + ROUNDS_PAGE);
|
|
3234
|
+
for(var i = shown; i < to; i += 1) tbody.appendChild(foldRowEl(rows[i], i === 0 ? null : rows[i - 1].try));
|
|
3235
|
+
shown = to;
|
|
3236
|
+
pager.innerHTML = "";
|
|
3237
|
+
pager.appendChild(foldEl("span", null, rows.length === 0 ? "no rows" : "showing 1\u2013" + shown + " of " + rows.length));
|
|
3238
|
+
if(shown < rows.length){
|
|
3239
|
+
var b = foldEl("button", "btn small", "load more", "rounds-load-more");
|
|
3240
|
+
b.type = "button";
|
|
3241
|
+
b.addEventListener("click", function(ev){ ev.stopPropagation(); more(); });
|
|
3242
|
+
pager.appendChild(b);
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
more();
|
|
3246
|
+
return wrap;
|
|
3247
|
+
}
|
|
3248
|
+
function buildFoldBodyEl(g){
|
|
3249
|
+
var f = g.fold, human = f.who === "human";
|
|
3250
|
+
var body = foldEl("div", "audit-fold-body", null, "audit-fold-body-" + g.step);
|
|
3251
|
+
if(f.tally) body.appendChild(foldEl("div", "audit-tally", f.tally, "audit-tally"));
|
|
3252
|
+
(f.tries || []).forEach(function(t){ body.appendChild(foldTryEl(t, human)); });
|
|
3253
|
+
body.appendChild(foldRoundsEl(g));
|
|
3254
|
+
return body;
|
|
3255
|
+
}
|
|
2850
3256
|
var auditExpanded = {}; // step -> true/false once a human toggled it; reset when the run changes
|
|
2851
3257
|
var auditExpandedRun = null;
|
|
2852
3258
|
function renderAuditGroups(result){
|
|
@@ -2868,10 +3274,12 @@
|
|
|
2868
3274
|
sh.className = "audit-status-header";
|
|
2869
3275
|
sh.setAttribute("role", "button"); sh.setAttribute("tabindex", "0"); sh.setAttribute("aria-expanded", "false");
|
|
2870
3276
|
sh.style.cursor = "pointer";
|
|
2871
|
-
|
|
3277
|
+
// M9 am23: sign + word (one badge, as a step header's), then `schedule`, then ` · ` and the parts. The word is the server's (`sc.word`, from SIGN_WORDS); no table here.
|
|
2872
3278
|
var ssign = document.createElement("span");
|
|
2873
3279
|
ssign.className = "badge sign-badge " + (sc.sign === "[\u25B6]" ? "amber" : sc.sign === "[\u2717]" ? "red" : "grey");
|
|
2874
|
-
ssign.setAttribute("data-testid", "audit-schedule-sign"); ssign.textContent = sc.sign; sh.appendChild(ssign);
|
|
3280
|
+
ssign.setAttribute("data-testid", "audit-schedule-sign"); ssign.textContent = sc.word ? sc.sign + " " + sc.word : sc.sign; sh.appendChild(ssign);
|
|
3281
|
+
var sname = document.createElement("span"); sname.className = "audit-fold-name keep"; sname.textContent = "schedule"; sh.appendChild(sname);
|
|
3282
|
+
var slead = document.createElement("span"); slead.setAttribute("data-testid", "audit-schedule-lead"); slead.textContent = "\u00b7"; sh.appendChild(slead); // plain span: a phone keeps this dot (the signed header has it)
|
|
2875
3283
|
var stail = document.createElement("span"); stail.className = "audit-fold-tail wrap"; stail.setAttribute("data-testid", "audit-schedule-head"); stail.textContent = sc.head; sh.appendChild(stail);
|
|
2876
3284
|
var sl = document.createElement("table");
|
|
2877
3285
|
sl.setAttribute("data-testid", "audit-table-schedule"); sl.hidden = true;
|
|
@@ -2930,12 +3338,20 @@
|
|
|
2930
3338
|
header.style.cursor = "pointer";
|
|
2931
3339
|
wrap.appendChild(header);
|
|
2932
3340
|
if(noRecord){ container.appendChild(wrap); return; } // nothing to open: the header already says "no draft record"
|
|
2933
|
-
|
|
2934
|
-
table
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
3341
|
+
// M4d am29: a step with a fold draws it (design lab C); a step without one (an older run, the Draft, the run's own group) keeps its table as before
|
|
3342
|
+
var table, tbody;
|
|
3343
|
+
if(g.fold){
|
|
3344
|
+
table = buildFoldBodyEl(g);
|
|
3345
|
+
table.hidden = !isOpen;
|
|
3346
|
+
rows = []; // a fold has no per-try table row to open with the group (`syncSingleRow` below leaves it alone)
|
|
3347
|
+
} else {
|
|
3348
|
+
table = document.createElement("table");
|
|
3349
|
+
table.hidden = !isOpen;
|
|
3350
|
+
table.innerHTML = "<thead><tr><th>Attempt</th><th>Action</th><th>Gap</th><th>Cost</th><th>Verdict</th><th>Close</th><th>Time</th></tr></thead><tbody></tbody>";
|
|
3351
|
+
tbody = table.querySelector("tbody");
|
|
3352
|
+
rows.forEach(function(r){ tbody.appendChild(buildAuditRowEl(r, false)); });
|
|
3353
|
+
table.setAttribute("data-testid", "audit-table-grouped-" + g.step);
|
|
3354
|
+
}
|
|
2939
3355
|
wrap.appendChild(table);
|
|
2940
3356
|
// M4c-fix amendment 2 (j): a step with exactly one try opens that try's detail with the group, closes with it
|
|
2941
3357
|
// (the same `.open` tap-detail the row's own tap toggles; only the phone layout shows it).
|
|
@@ -3086,7 +3502,9 @@
|
|
|
3086
3502
|
fold.appendChild(textDiv("plan-row", "reads: " + ((st.reads || []).length ? st.reads.join(", ") : "nothing")));
|
|
3087
3503
|
fold.appendChild(textDiv("plan-row", "makes: " + (st.makes || "unknown")));
|
|
3088
3504
|
fold.appendChild(textDiv("plan-row", "may do: " + ((st.mayDo || []).length ? st.mayDo.join(", ") : "nothing (pure stop)")));
|
|
3089
|
-
|
|
3505
|
+
// M10 am11: each check sentence is its own row
|
|
3506
|
+
if(st.ask || !(st.check || []).length) fold.appendChild(textDiv("plan-row", "check: " + (st.ask ? "ASK · waits " + plainWait(st.waitMs) : "")));
|
|
3507
|
+
else st.check.forEach(function(s){ fold.appendChild(textDiv("plan-row", "check: " + s)); });
|
|
3090
3508
|
return fold;
|
|
3091
3509
|
}
|
|
3092
3510
|
// The tail: any step that came from no listed line, then the folded Not-checked summary (its label comes from the payload, src/checked.js; always shown).
|
|
@@ -3107,6 +3525,17 @@
|
|
|
3107
3525
|
else if(!(nc.items || []).length) fold.appendChild(textDiv("plan-row", "the AI listed nothing"));
|
|
3108
3526
|
else nc.items.forEach(function(it){ fold.appendChild(textDiv("plan-row", it)); });
|
|
3109
3527
|
tail.appendChild(fold);
|
|
3528
|
+
// M10 am11: code's notes about written forms it did not use, their own fold after Not checked (none = no fold)
|
|
3529
|
+
if((nc.readNotes || []).length){
|
|
3530
|
+
var rn = document.createElement("details");
|
|
3531
|
+
rn.className = "plan-fold plan-readnotes";
|
|
3532
|
+
var rs = document.createElement("summary");
|
|
3533
|
+
rs.className = "plan-sum";
|
|
3534
|
+
rs.textContent = "How the page was read";
|
|
3535
|
+
rn.appendChild(rs);
|
|
3536
|
+
nc.readNotes.forEach(function(it){ rn.appendChild(textDiv("plan-row", it)); });
|
|
3537
|
+
tail.appendChild(rn);
|
|
3538
|
+
}
|
|
3110
3539
|
}
|
|
3111
3540
|
function renderJob(job){
|
|
3112
3541
|
var empty = document.getElementById("job-empty");
|
|
@@ -3161,6 +3590,7 @@
|
|
|
3161
3590
|
document.getElementById("details-model").textContent = job.model
|
|
3162
3591
|
? ("model used: " + job.model + " (from this run's rows)")
|
|
3163
3592
|
: (job.modelWhy || "no model call recorded yet");
|
|
3593
|
+
document.getElementById("details-thinking").textContent = typeof job.thinkingRule === "string" ? job.thinkingRule : "—";
|
|
3164
3594
|
document.getElementById("details-started").textContent = job.started || "—";
|
|
3165
3595
|
document.getElementById("details-schedule").textContent = job.schedule || "none";
|
|
3166
3596
|
// M4e amendment 6 item 5 + amendment 7 item 4: "$<cap> per run · 1h wait · redo up to <n>"; several asks: "waits 1h, 30m", each through plainWait.
|
|
@@ -3274,7 +3704,7 @@
|
|
|
3274
3704
|
// separately-fetched copy of the audit rows to cross-reference (fix #6).
|
|
3275
3705
|
// same guard as reloadRun: a late reply for a run the user already left paints nothing and writes no polling flag
|
|
3276
3706
|
var still = function(){ return currentFlow === flow && currentRunId === runId; };
|
|
3277
|
-
getJSON(base).then(function(d){ if(still()) paintRun(d); }).catch(function(e){
|
|
3707
|
+
getJSON(base).then(function(d){ if(still()){ paintRun(d); if(d.hasResult === true) loadResult(flow, runId); } }).catch(function(e){
|
|
3278
3708
|
if(!still()) return;
|
|
3279
3709
|
openRunLive = false; // unreadable books: the list rate, not 2 s forever
|
|
3280
3710
|
document.getElementById("run-empty").hidden = false;
|
|
@@ -3310,8 +3740,12 @@
|
|
|
3310
3740
|
var openRunLive = true; // is the open run still changing? (true until its detail says otherwise)
|
|
3311
3741
|
var wasHidden = false;
|
|
3312
3742
|
// One writer of `openRunLive`: every paint of the open run's detail goes through here.
|
|
3743
|
+
// M9 am21: the ONE decider of a finished run ([✓] [✗] [■]); the open-run poll and the summary line's time both ask it.
|
|
3744
|
+
function runFinished(d){
|
|
3745
|
+
return !!d && (d.glyph === "[\u2713]" || d.glyph === "[\u2717]" || d.glyph === "[\u25A0]");
|
|
3746
|
+
}
|
|
3313
3747
|
function paintRun(d){
|
|
3314
|
-
openRunLive = !(d
|
|
3748
|
+
openRunLive = !runFinished(d);
|
|
3315
3749
|
var next = sig(d);
|
|
3316
3750
|
if(next !== null && next === lastSig.detail) return;
|
|
3317
3751
|
lastSig.detail = next;
|
|
@@ -3700,6 +4134,13 @@
|
|
|
3700
4134
|
el.className = "answer-msg" + (mine ? " " + m.cls : "");
|
|
3701
4135
|
el.textContent = mine ? m.text : "";
|
|
3702
4136
|
});
|
|
4137
|
+
// the Result tab's Your-call card shows the same message for its own run (no attribute is added while there is none)
|
|
4138
|
+
var rm = document.getElementById("result-door-msg");
|
|
4139
|
+
if(rm){
|
|
4140
|
+
var m2 = answerMsg;
|
|
4141
|
+
if(m2 && resultDetail && m2.flow === resultDetail.flow && m2.runId === resultDetail.runId){ rm.className = "answer-msg " + m2.cls; rm.textContent = m2.text; }
|
|
4142
|
+
else if(rm.textContent !== "" || rm.hasAttribute("class")){ rm.removeAttribute("class"); rm.textContent = ""; }
|
|
4143
|
+
}
|
|
3703
4144
|
}
|
|
3704
4145
|
// Every refusal the page shows is a plain sentence — never an HTTP status, a refusal code, an askId or a path.
|
|
3705
4146
|
// `r` is { status, body, text } from postJSON; `decision` is the answer word of an answer click (else null).
|
|
@@ -4454,6 +4895,10 @@
|
|
|
4454
4895
|
if(!state || state.phase !== "questions-open" || !Array.isArray(state.questions)) return null;
|
|
4455
4896
|
var q = state.questions.filter(function(x){ return x.k === state.openK; })[0];
|
|
4456
4897
|
if(!q) return null;
|
|
4898
|
+
// M10 am2 item 1 / am5 item 1: a question the page look raised is ONE plain chat message (bareloop's words); the head and line rows stay empty
|
|
4899
|
+
if(q.source === "look"){
|
|
4900
|
+
return { key: String(state.draftId) + ":" + q.k, k: q.k, head: "", line: "", question: "A question the plan raised (" + q.k + " of " + state.total + "), about job line " + q.line + ": " + q.question };
|
|
4901
|
+
}
|
|
4457
4902
|
return {
|
|
4458
4903
|
key: String(state.draftId) + ":" + q.k, k: q.k,
|
|
4459
4904
|
head: "A question the plan raised (" + q.k + " of " + state.total + ")",
|
|
@@ -4471,11 +4916,18 @@
|
|
|
4471
4916
|
return "line " + a.line + (a.lineText ? ": " + a.lineText : "") + "\n > " + a.answer;
|
|
4472
4917
|
})});
|
|
4473
4918
|
}
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4919
|
+
// M10 am11: each check sentence is its own line (the step's label leads its first; the rest sit under it)
|
|
4920
|
+
var checkedLines = [];
|
|
4921
|
+
state.checked.forEach(function(c){
|
|
4922
|
+
c.sentences.forEach(function(s, i){
|
|
4923
|
+
checkedLines.push(i === 0 ? (c.line !== null && c.line !== undefined ? "line " + c.line : "step " + c.step) + ": " + s : " " + s);
|
|
4924
|
+
});
|
|
4925
|
+
});
|
|
4926
|
+
blocks.push({id: "chat-checked", head: "Checked", sub: "built by the machine from the plan's checks", lines: checkedLines});
|
|
4477
4927
|
var nc = state.notChecked || {};
|
|
4478
4928
|
blocks.push({id: "chat-notchecked", head: nc.label || "", sub: "", lines: (nc.items && nc.items.length) ? nc.items.map(function(x){ return "- " + x; }) : ["The drafter listed nothing."]});
|
|
4929
|
+
// M10 am11: code's notes about written forms it did not use are their own list, after Not checked (none = no block)
|
|
4930
|
+
if(nc.readNotes && nc.readNotes.length) blocks.push({id: "chat-readnotes", head: "How the page was read", sub: "", lines: nc.readNotes.map(function(x){ return "- " + x; })});
|
|
4479
4931
|
return {blocks: blocks};
|
|
4480
4932
|
}
|
|
4481
4933
|
// pure: did this POST succeed (one decision for every handler)
|
|
@@ -4561,7 +5013,9 @@
|
|
|
4561
5013
|
var ro = document.createElement("div");
|
|
4562
5014
|
ro.className = "jf-role-ro"; ro.textContent = role; ro.setAttribute("data-role", role);
|
|
4563
5015
|
row.appendChild(ro);
|
|
4564
|
-
|
|
5016
|
+
var pathEl = makeInput("jf-path", "/full/path/to/file", sources ? sources[role] : "");
|
|
5017
|
+
if(f && f.pages && f.pages[role]){ pathEl.value = f.pages[role]; pathEl.readOnly = true; pathEl.setAttribute("data-page", "1"); pathEl.title = "A web page: its address is signed with the job and can't be changed here."; } // M10 am3
|
|
5018
|
+
row.appendChild(pathEl);
|
|
4565
5019
|
row.appendChild(makeErr());
|
|
4566
5020
|
runInputsEl.appendChild(row);
|
|
4567
5021
|
});
|
|
@@ -4732,7 +5186,7 @@
|
|
|
4732
5186
|
function syncCardLock(){
|
|
4733
5187
|
var on = cardLocked();
|
|
4734
5188
|
whenSyncButton();
|
|
4735
|
-
card.querySelectorAll("input[type=text], textarea").forEach(function(el){ el.readOnly = on; el.classList.toggle("locked", on); });
|
|
5189
|
+
card.querySelectorAll("input[type=text], textarea").forEach(function(el){ el.readOnly = on || el.hasAttribute("data-page"); el.classList.toggle("locked", on); }); // M10: a web-page row is always read-only
|
|
4736
5190
|
runFlowSel.disabled = on;
|
|
4737
5191
|
runFlowSel.classList.toggle("locked", on);
|
|
4738
5192
|
rwPickedEl.classList.toggle("locked", on);
|
|
@@ -4927,7 +5381,10 @@
|
|
|
4927
5381
|
byId("jf-err-when").textContent = "";
|
|
4928
5382
|
var roleSel = byId("jf-when-role");
|
|
4929
5383
|
roleSel.innerHTML = "";
|
|
4930
|
-
|
|
5384
|
+
// M10: a file trigger watches a FILE; a web-page input is never offered (a job with only page inputs gets the clock options only)
|
|
5385
|
+
var fileRoles = ((f && f.roles) || []).filter(function(r){ return !(f.pages && f.pages[r]); });
|
|
5386
|
+
fileRoles.forEach(function(r){ var o = document.createElement("option"); o.value = r; o.textContent = r; roleSel.appendChild(o); });
|
|
5387
|
+
["file-updated", "new-file"].forEach(function(k){ var o = byId("jf-when").querySelector('option[value="' + k + '"]'); o.hidden = o.disabled = fileRoles.length === 0; });
|
|
4931
5388
|
var t = c ? c.trigger : null;
|
|
4932
5389
|
sel.querySelector('option[value="hand"]').textContent = t ? "Cancel schedule" : "By hand"; // M9 am5: on a scheduled job, By hand reads Cancel schedule
|
|
4933
5390
|
sel.value = t ? t.kind : "hand";
|
|
@@ -5183,6 +5640,7 @@
|
|
|
5183
5640
|
if(v.key !== qKey){
|
|
5184
5641
|
qKey = v.key;
|
|
5185
5642
|
qHead.textContent = v.head; qLine.textContent = v.line; qText.textContent = v.question;
|
|
5643
|
+
qHead.hidden = v.head === ""; qLine.hidden = v.line === ""; // a look question is one plain message: no empty rows
|
|
5186
5644
|
qAnswer.value = ""; qError.textContent = "";
|
|
5187
5645
|
}
|
|
5188
5646
|
}
|