fwdloop 0.21.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/bin/fwdloop +85 -34
- package/package.json +4 -3
- package/src/audit-fold.js +5 -1
- package/src/authoring.js +32 -6
- 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 +56 -7
- package/src/ctx-tools.js +2 -14
- package/src/declaration.js +85 -5
- package/src/diary.js +2 -2
- 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 +21 -0
- package/src/input-facts.js +20 -3
- package/src/model-step.js +30 -5
- 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 +83 -2
- package/src/panel/index.html +279 -12
- package/src/panel/result.js +295 -0
- package/src/panel/server.js +27 -3
- package/src/primitives.js +2 -3
- package/src/provider.js +5 -2
- package/src/redact.js +17 -0
- package/src/runner.js +83 -12
- 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 +1 -1
- package/src/try-checks.js +6 -0
- package/src/types.js +3 -2
- package/types/authoring.d.ts +19 -2
- 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/ctx-tools.d.ts +0 -1
- package/types/declaration.d.ts +15 -1
- 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 +15 -0
- package/types/input-facts.d.ts +12 -2
- package/types/model-step.d.ts +35 -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 +1 -1
- package/types/types.d.ts +11 -3
package/src/panel/index.html
CHANGED
|
@@ -396,7 +396,6 @@
|
|
|
396
396
|
.filterbar .chips{gap:4px;margin-bottom:4px;}
|
|
397
397
|
.chip.fchip{padding:3px 7px;min-height:28px;min-width:28px;font-size:12px;text-align:center;}
|
|
398
398
|
.chip.fchip::before,.chip.fchip::after{content:"";}
|
|
399
|
-
/* M11 am20 item 4: the ◷ glyph is drawn smaller than ✓ and ✗ at the same font-size (a fallback font); this chip alone is scaled up to match. */
|
|
400
399
|
.row-blocked{background:var(--red-bg);}
|
|
401
400
|
|
|
402
401
|
/* hamr review #5/#6: Audit tab grouped-by-step sections. */
|
|
@@ -492,6 +491,23 @@
|
|
|
492
491
|
.job-card h4{margin:0 0 8px;font-size:13px;position:absolute;top:-10px;left:10px;background:var(--panel2);padding:0 6px;}
|
|
493
492
|
.job-card h4::before{content:"┤ ";color:var(--text-faint);}
|
|
494
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;}
|
|
495
511
|
.field{margin-bottom:10px;}
|
|
496
512
|
label{display:block;font-size:11px;font-weight:700;color:var(--text-dim);margin-bottom:2px;text-transform:uppercase;letter-spacing:0.04em;}
|
|
497
513
|
/* hamr's 2026-09-27 exit-check review #3: Ask tab box headers — same
|
|
@@ -623,6 +639,8 @@
|
|
|
623
639
|
.jf-inrow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr) auto;gap:6px;margin-bottom:4px;align-items:start;}
|
|
624
640
|
.jf-inrow .btn.small{height:32px;padding:0 8px;}
|
|
625
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) */
|
|
626
644
|
.jf-inrow .jf-err{grid-column:1 / -1;}
|
|
627
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 */
|
|
628
646
|
.field.dimmed{opacity:.6;}
|
|
@@ -973,7 +991,7 @@
|
|
|
973
991
|
<div class="jf-gut" id="jf-inputs-gut" data-testid="jf-inputs-gut" aria-hidden="true"><div class="jf-gut-in"></div></div>
|
|
974
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>
|
|
975
993
|
</div>
|
|
976
|
-
<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>
|
|
977
995
|
<div class="jf-err" id="jf-err-inputs" data-testid="jf-err-inputs"></div>
|
|
978
996
|
</div>
|
|
979
997
|
<div class="field">
|
|
@@ -1194,6 +1212,7 @@
|
|
|
1194
1212
|
<button role="tab" id="tab-audit" aria-controls="panel-audit" aria-selected="false" data-testid="right-tab-audit">Audit / logs</button>
|
|
1195
1213
|
<button role="tab" id="tab-details" aria-controls="panel-details" aria-selected="false" data-testid="right-tab-details">Job</button>
|
|
1196
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>
|
|
1197
1216
|
</div>
|
|
1198
1217
|
|
|
1199
1218
|
<div class="pane-body" id="right-pane-body">
|
|
@@ -1315,6 +1334,11 @@
|
|
|
1315
1334
|
<div id="ask-list" data-testid="ask-list" hidden></div>
|
|
1316
1335
|
</section>
|
|
1317
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
|
+
|
|
1318
1342
|
</div>
|
|
1319
1343
|
</section>
|
|
1320
1344
|
|
|
@@ -1347,7 +1371,7 @@
|
|
|
1347
1371
|
});
|
|
1348
1372
|
}
|
|
1349
1373
|
wireTabs([document.getElementById("tab-chat"), document.getElementById("tab-runs"), document.getElementById("tab-inbox")]);
|
|
1350
|
-
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")]);
|
|
1351
1375
|
|
|
1352
1376
|
// ---- fetch helpers. Reads are GET. The ONLY non-GET requests on this page are
|
|
1353
1377
|
// the two POSTs below (M4b): /api/answer (a human clicking a door) and
|
|
@@ -2301,7 +2325,6 @@
|
|
|
2301
2325
|
if(!ok || !sc || !ink(sc)) return;
|
|
2302
2326
|
sc.style.fontSize = (parseFloat(getComputedStyle(ok).fontSize) * ink(ok) / ink(sc)) + "px";
|
|
2303
2327
|
}
|
|
2304
|
-
window.fwdloopFitChips = fitChips;
|
|
2305
2328
|
fitChips();
|
|
2306
2329
|
|
|
2307
2330
|
function runsFilterFn(items, filters, nowMs){
|
|
@@ -2345,6 +2368,212 @@
|
|
|
2345
2368
|
document.querySelectorAll(".inbox-row").forEach(function(r){ r.classList.remove("selected"); r.setAttribute("aria-pressed","false"); });
|
|
2346
2369
|
}
|
|
2347
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
|
+
|
|
2348
2577
|
// ---- Run tab: header + summary + step map + one card per step ATTEMPT
|
|
2349
2578
|
// (ruling A, 2026-09-26: "no per-round parts") — built off getRunDetail's
|
|
2350
2579
|
// `steps[]` (declaration.steps joined with audit.jsonl attempts), never a
|
|
@@ -2432,6 +2661,7 @@
|
|
|
2432
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>';
|
|
2433
2662
|
|
|
2434
2663
|
renderRunActions(detail);
|
|
2664
|
+
syncResultTab(detail); // M10 am4: shows or hides the Result tab; the ONE caller
|
|
2435
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
|
|
2436
2666
|
renderStepMap(stepBoxes.length ? [draftBox(detail.draft)].concat(stepBoxes.map(function(b, i){ return Object.assign({}, b, {n: i + 1}); })) : stepBoxes);
|
|
2437
2667
|
|
|
@@ -3272,7 +3502,9 @@
|
|
|
3272
3502
|
fold.appendChild(textDiv("plan-row", "reads: " + ((st.reads || []).length ? st.reads.join(", ") : "nothing")));
|
|
3273
3503
|
fold.appendChild(textDiv("plan-row", "makes: " + (st.makes || "unknown")));
|
|
3274
3504
|
fold.appendChild(textDiv("plan-row", "may do: " + ((st.mayDo || []).length ? st.mayDo.join(", ") : "nothing (pure stop)")));
|
|
3275
|
-
|
|
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)); });
|
|
3276
3508
|
return fold;
|
|
3277
3509
|
}
|
|
3278
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).
|
|
@@ -3293,6 +3525,17 @@
|
|
|
3293
3525
|
else if(!(nc.items || []).length) fold.appendChild(textDiv("plan-row", "the AI listed nothing"));
|
|
3294
3526
|
else nc.items.forEach(function(it){ fold.appendChild(textDiv("plan-row", it)); });
|
|
3295
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
|
+
}
|
|
3296
3539
|
}
|
|
3297
3540
|
function renderJob(job){
|
|
3298
3541
|
var empty = document.getElementById("job-empty");
|
|
@@ -3461,7 +3704,7 @@
|
|
|
3461
3704
|
// separately-fetched copy of the audit rows to cross-reference (fix #6).
|
|
3462
3705
|
// same guard as reloadRun: a late reply for a run the user already left paints nothing and writes no polling flag
|
|
3463
3706
|
var still = function(){ return currentFlow === flow && currentRunId === runId; };
|
|
3464
|
-
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){
|
|
3465
3708
|
if(!still()) return;
|
|
3466
3709
|
openRunLive = false; // unreadable books: the list rate, not 2 s forever
|
|
3467
3710
|
document.getElementById("run-empty").hidden = false;
|
|
@@ -3891,6 +4134,13 @@
|
|
|
3891
4134
|
el.className = "answer-msg" + (mine ? " " + m.cls : "");
|
|
3892
4135
|
el.textContent = mine ? m.text : "";
|
|
3893
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
|
+
}
|
|
3894
4144
|
}
|
|
3895
4145
|
// Every refusal the page shows is a plain sentence — never an HTTP status, a refusal code, an askId or a path.
|
|
3896
4146
|
// `r` is { status, body, text } from postJSON; `decision` is the answer word of an answer click (else null).
|
|
@@ -4645,6 +4895,10 @@
|
|
|
4645
4895
|
if(!state || state.phase !== "questions-open" || !Array.isArray(state.questions)) return null;
|
|
4646
4896
|
var q = state.questions.filter(function(x){ return x.k === state.openK; })[0];
|
|
4647
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
|
+
}
|
|
4648
4902
|
return {
|
|
4649
4903
|
key: String(state.draftId) + ":" + q.k, k: q.k,
|
|
4650
4904
|
head: "A question the plan raised (" + q.k + " of " + state.total + ")",
|
|
@@ -4662,11 +4916,18 @@
|
|
|
4662
4916
|
return "line " + a.line + (a.lineText ? ": " + a.lineText : "") + "\n > " + a.answer;
|
|
4663
4917
|
})});
|
|
4664
4918
|
}
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
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});
|
|
4668
4927
|
var nc = state.notChecked || {};
|
|
4669
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; })});
|
|
4670
4931
|
return {blocks: blocks};
|
|
4671
4932
|
}
|
|
4672
4933
|
// pure: did this POST succeed (one decision for every handler)
|
|
@@ -4752,7 +5013,9 @@
|
|
|
4752
5013
|
var ro = document.createElement("div");
|
|
4753
5014
|
ro.className = "jf-role-ro"; ro.textContent = role; ro.setAttribute("data-role", role);
|
|
4754
5015
|
row.appendChild(ro);
|
|
4755
|
-
|
|
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);
|
|
4756
5019
|
row.appendChild(makeErr());
|
|
4757
5020
|
runInputsEl.appendChild(row);
|
|
4758
5021
|
});
|
|
@@ -4923,7 +5186,7 @@
|
|
|
4923
5186
|
function syncCardLock(){
|
|
4924
5187
|
var on = cardLocked();
|
|
4925
5188
|
whenSyncButton();
|
|
4926
|
-
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
|
|
4927
5190
|
runFlowSel.disabled = on;
|
|
4928
5191
|
runFlowSel.classList.toggle("locked", on);
|
|
4929
5192
|
rwPickedEl.classList.toggle("locked", on);
|
|
@@ -5118,7 +5381,10 @@
|
|
|
5118
5381
|
byId("jf-err-when").textContent = "";
|
|
5119
5382
|
var roleSel = byId("jf-when-role");
|
|
5120
5383
|
roleSel.innerHTML = "";
|
|
5121
|
-
|
|
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; });
|
|
5122
5388
|
var t = c ? c.trigger : null;
|
|
5123
5389
|
sel.querySelector('option[value="hand"]').textContent = t ? "Cancel schedule" : "By hand"; // M9 am5: on a scheduled job, By hand reads Cancel schedule
|
|
5124
5390
|
sel.value = t ? t.kind : "hand";
|
|
@@ -5374,6 +5640,7 @@
|
|
|
5374
5640
|
if(v.key !== qKey){
|
|
5375
5641
|
qKey = v.key;
|
|
5376
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
|
|
5377
5644
|
qAnswer.value = ""; qError.textContent = "";
|
|
5378
5645
|
}
|
|
5379
5646
|
}
|