fwdloop 0.36.0 → 0.38.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 +6 -20
- package/bin/fwdloop +35 -12
- package/package.json +3 -3
- package/src/action-stop.js +1 -1
- package/src/auditchecks.js +41 -9
- package/src/authoring.js +78 -20
- package/src/blockasks.js +10 -12
- package/src/blockassemble.js +49 -46
- package/src/blockdraft.js +4 -2
- package/src/blockpick.js +10 -0
- package/src/canrun.js +2 -1
- package/src/cardlist.js +28 -5
- package/src/checkblock.js +598 -61
- package/src/checked.js +27 -33
- package/src/checklistsign.js +3 -3
- package/src/checklook.js +45 -0
- package/src/checkrows.js +202 -0
- package/src/cited-record.js +2 -2
- package/src/citedcheck.js +53 -12
- package/src/citedwords.js +7 -4
- package/src/closers.js +49 -2
- package/src/declaration.js +34 -10
- package/src/drafter.js +99 -74
- package/src/factwords.js +7 -4
- package/src/globprefix.js +26 -0
- package/src/isrec.js +2 -0
- package/src/line-checks.js +1 -2
- package/src/minrule.js +16 -0
- package/src/model-step.js +22 -4
- package/src/pageask.js +0 -3
- package/src/pagedropwords.js +3 -11
- package/src/pagedry.js +75 -1
- package/src/pagefetch.js +11 -6
- package/src/pagelook.js +2 -1
- package/src/pagerules.js +8 -2
- package/src/panel/author.js +33 -8
- package/src/panel/data.js +3 -2
- package/src/panel/index.html +177 -37
- package/src/panel/result.js +34 -1
- package/src/pickrecord.js +14 -0
- package/src/planrebuild.js +55 -19
- package/src/ratelimit.js +117 -0
- package/src/report.js +14 -2
- package/src/rowresults.js +111 -0
- package/src/rubricstep.js +65 -2
- package/src/runner.js +38 -5
- package/src/shapebuild.js +281 -0
- package/src/shapelook.js +91 -0
- package/src/shapemenu.js +64 -0
- package/src/shaperesult.js +104 -0
- package/src/shaperows.js +263 -0
- package/src/shapewords.js +140 -0
- package/src/sheet-record.js +1 -2
- package/src/sheetblock.js +1 -2
- package/src/sheetbuild.js +41 -29
- package/src/sheetchecks.js +1 -2
- package/src/sheetclaims.js +1 -2
- package/src/sheetoffer.js +1 -1
- package/src/sheetrows.js +10 -64
- package/src/sheetrun.js +1 -2
- package/src/ticketrows.js +2 -3
- package/src/try-checks.js +39 -6
- package/src/types.js +1 -0
- package/src/whole-job.js +24 -8
- package/types/action-stop.d.ts +1 -1
- package/types/auditchecks.d.ts +13 -2
- package/types/authoring.d.ts +21 -2
- package/types/blockasks.d.ts +6 -10
- package/types/blockassemble.d.ts +12 -13
- package/types/blockdraft.d.ts +3 -2
- package/types/blockpick.d.ts +4 -0
- package/types/cardlist.d.ts +18 -2
- package/types/checkblock.d.ts +276 -27
- package/types/checked.d.ts +15 -6
- package/types/checklook.d.ts +36 -0
- package/types/checkrows.d.ts +119 -0
- package/types/citedcheck.d.ts +4 -2
- package/types/closers.d.ts +10 -1
- package/types/drafter.d.ts +9 -4
- package/types/globprefix.d.ts +5 -0
- package/types/isrec.d.ts +1 -0
- package/types/minrule.d.ts +6 -0
- package/types/model-step.d.ts +43 -2
- package/types/pageask.d.ts +0 -1
- package/types/pagedropwords.d.ts +0 -1
- package/types/pagedry.d.ts +27 -0
- package/types/pagefetch.d.ts +3 -2
- package/types/pagerules.d.ts +4 -0
- package/types/panel/result.d.ts +16 -1
- package/types/pickrecord.d.ts +10 -0
- package/types/ratelimit.d.ts +59 -0
- package/types/report.d.ts +2 -1
- package/types/rowresults.d.ts +28 -0
- package/types/rubricstep.d.ts +21 -0
- package/types/runner.d.ts +3 -1
- package/types/shapebuild.d.ts +97 -0
- package/types/shapelook.d.ts +76 -0
- package/types/shapemenu.d.ts +40 -0
- package/types/shaperesult.d.ts +40 -0
- package/types/shaperows.d.ts +102 -0
- package/types/shapewords.d.ts +43 -0
- package/types/sheetbuild.d.ts +31 -13
- package/types/sheetrows.d.ts +5 -36
- package/types/ticketrows.d.ts +1 -1
- package/types/try-checks.d.ts +2 -1
- package/types/types.d.ts +4 -0
- package/types/whole-job.d.ts +20 -4
package/src/panel/index.html
CHANGED
|
@@ -612,6 +612,22 @@
|
|
|
612
612
|
/* M12 piece 3: the ticket list in the Result tab (mockup docs/product/m12-ticket-results-mock.html, variant E). Its boxes are the panel's own: .audit-group, .filterbar, .chips, .btn.small. */
|
|
613
613
|
/* M13 piece 6: the job's Result grid (mock docs/product/m13-setup-mock.html Part 3). The table, cells, q-fold and step-sub are the Audit grid's own; these are the bucket fold rows, the stats line and the run column. */
|
|
614
614
|
#result-body .tg-stats{font-size:13px;margin:0 0 8px;overflow-wrap:anywhere;}
|
|
615
|
+
/* borrowed-from: bareloop src/panel/index.html@v0.61.0 (.sf-*). a shape line with many fields: one folded row per item (signed mock A2); a failed item is open and tinted; nothing scrolls sideways */
|
|
616
|
+
.sf-item{border-bottom:1px dotted var(--border-strong);}
|
|
617
|
+
.sf-item>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;min-height:36px;font-size:12px;padding:0 4px;}
|
|
618
|
+
.sf-item>summary::-webkit-details-marker{display:none;}
|
|
619
|
+
.sf-nm{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
|
620
|
+
.sf-ct{flex:0 0 auto;white-space:nowrap;}
|
|
621
|
+
.sf-ar{flex:0 0 auto;color:var(--accent);font-weight:700;}
|
|
622
|
+
.sf-ar::before{content:"\25B8";}
|
|
623
|
+
.sf-item[open]>summary .sf-ar::before{content:"\25BE";}
|
|
624
|
+
.sf-item.bad>summary{background:var(--red-bg);}
|
|
625
|
+
.sf-fl{padding:4px 8px 8px 22px;font-size:12px;}
|
|
626
|
+
.sf-fl>div{display:flex;gap:8px;padding:2px 0;border-bottom:1px dotted var(--border);}
|
|
627
|
+
.sf-fl .k{flex:0 0 84px;color:var(--text-dim);overflow:hidden;text-overflow:ellipsis;}
|
|
628
|
+
.sf-fl .g{flex:0 0 14px;}
|
|
629
|
+
.sf-fl .v{flex:1 1 auto;min-width:0;overflow-wrap:anywhere;}
|
|
630
|
+
.sf-fl .why{color:var(--red);}
|
|
615
631
|
table.grid.tg td.r,table.grid.tg th.r{position:sticky;left:0;background:var(--panel2);z-index:1;min-width:84px;white-space:nowrap;}
|
|
616
632
|
table.grid.tg td.c{min-width:84px;}
|
|
617
633
|
table.grid.tg th{color:var(--accent);font-weight:700;}
|
|
@@ -769,6 +785,22 @@
|
|
|
769
785
|
/* the confirm card's Drop / Add: wraps with its row, a comfortable touch target, no horizontal scroll at phone width */
|
|
770
786
|
.jp .jp-btn{margin:2px 0 2px 8px;padding:4px 12px;min-height:32px;font-size:inherit;}
|
|
771
787
|
.jp .fold{overflow-wrap:anywhere;}
|
|
788
|
+
/* borrowed-from: bareloop src/panel/index.html@v0.61.0 (fc56e1f3) .ck-* (the signed check-list look, M19 S6) */
|
|
789
|
+
.jp .ck-g{margin:6px 0 6px 16px;text-indent:0;}
|
|
790
|
+
.jp .ck-h{font-weight:700;font-size:12px;color:var(--text-dim);margin:6px 0 2px;}
|
|
791
|
+
.jp .ck-row{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px;padding-left:12px;text-indent:0;overflow-wrap:anywhere;}
|
|
792
|
+
.jp .ck-row .tagcol{display:inline-block;min-width:82px;}
|
|
793
|
+
.jp .ck-row .kind{display:inline-block;min-width:48px;color:var(--text-faint);}
|
|
794
|
+
.jp .ck-row .ck-t{flex:1 1 220px;min-width:0;}
|
|
795
|
+
.jp .ck-row .ck-right{margin-left:auto;white-space:nowrap;}
|
|
796
|
+
.jp .ck-row .ck-under{flex-basis:100%;padding-left:138px;}
|
|
797
|
+
.jp .ck-why{display:inline;}
|
|
798
|
+
.jp .ck-why>summary::before{content:none;margin:0;}
|
|
799
|
+
.jp .ck-why>summary{font-weight:400;}
|
|
800
|
+
.jp .jl>.lbl{font-weight:700;margin-right:6px;}
|
|
801
|
+
.jp .ck-why summary{display:inline;cursor:pointer;color:var(--text-dim);list-style:none;margin-left:6px;}
|
|
802
|
+
.jp .ck-why summary::-webkit-details-marker{display:none;}
|
|
803
|
+
.jp .ck-why[open]{display:block;}
|
|
772
804
|
.jp-sug .lbl{display:block;margin-top:6px;font-weight:700;}
|
|
773
805
|
.jp details.fold{padding-left:0;margin:6px 0;}
|
|
774
806
|
.jp details>summary{cursor:pointer;list-style:none;font-weight:700;}
|
|
@@ -1221,7 +1253,7 @@
|
|
|
1221
1253
|
<div class="jf-gut" id="jf-job-gut" data-testid="jf-job-gut" aria-hidden="true"><div class="jf-gut-in"></div></div>
|
|
1222
1254
|
<textarea class="jf-wrap" id="jf-job" rows="6" data-testid="jf-job" autocomplete="off" spellcheck="false" placeholder="Read my resume ~keep it under 600 words Ask: check it with me Write it out"></textarea>
|
|
1223
1255
|
</div>
|
|
1224
|
-
<div class="hint">One step per line. A
|
|
1256
|
+
<div class="hint">One step per line. A <code>~</code> line under a step is its rule; add at least one. <code>Ask:</code> stops for you (<code>Ask 2h:</code> waits 2h). The last line writes the result to the Destination.</div>
|
|
1225
1257
|
<div class="jf-err" id="jf-err-job" data-testid="jf-err-job"></div>
|
|
1226
1258
|
</div>
|
|
1227
1259
|
<div class="field">
|
|
@@ -1448,6 +1480,8 @@
|
|
|
1448
1480
|
<div class="hint" id="chat-action-error" data-testid="chat-action-error"></div>
|
|
1449
1481
|
|
|
1450
1482
|
<button class="btn primary wide" type="button" id="chat-main-btn" data-testid="chat-main" disabled>Draft</button>
|
|
1483
|
+
<!-- M19 am14: POLL-OWNED, written only by renderActions from state.refusal (the words after "draft refused at $0 — "); never by a click handler -->
|
|
1484
|
+
<div class="jf-err" id="chat-draft-refusal" data-testid="chat-draft-refusal"></div>
|
|
1451
1485
|
<div class="hint" id="chat-main-hint" data-testid="chat-main-hint"></div>
|
|
1452
1486
|
<!-- M4e amendment 14 item 2: on a green plan, Revise opens every card field (the main button then reads Draft) -->
|
|
1453
1487
|
<button class="btn wide" type="button" id="chat-revise-btn" data-testid="chat-revise" hidden>Revise</button>
|
|
@@ -2842,8 +2876,30 @@
|
|
|
2842
2876
|
'/download?i=' + d.i + '&view=1" target="_blank" rel="noopener noreferrer">' + escapeXml(d.name) + '</a>' + renamed + '</div>');
|
|
2843
2877
|
}).join("");
|
|
2844
2878
|
}
|
|
2879
|
+
// ---- SHAPE JOBS (M19 S8; borrowed-from: bareloop src/panel/index.html@v0.61.0 shapeFoldHtml, shapeResultCard): a shape line's answer is a FOLD (every shape line, any field count): one row per item, opening to its fields, the stats line and the Not checked line. The server decides every mark and word (`line.shape`, src/shaperesult.js); the page only draws. An item's name is plain text.
|
|
2880
|
+
// one row per item `N \u00B7 name \u2713 k of n \u25B8`, a native <details> opening to one line per field; a failed item starts open (signed mock A2)
|
|
2881
|
+
function shapeFoldHtml(m){
|
|
2882
|
+
var n = m.columns.length;
|
|
2883
|
+
return '<div class="sf-list" data-testid="shape-fold">' + m.rows.map(function(r){
|
|
2884
|
+
var bad = r.cells.filter(function(c){ return c.mark === "r"; }).length;
|
|
2885
|
+
return '<details class="sf-item' + (bad ? ' bad' : '') + '" data-testid="shape-item"' + (bad ? ' open' : '') + '><summary><span class="sf-nm" data-testid="shape-name" title="' + escapeXml(r.name) + '">' + escapeXml(r.name) + '</span><span class="sf-ct" data-testid="shape-count">' + gridMarkOf(bad ? "r" : "g") + ' ' + (n - bad) + ' of ' + n + '</span><span class="sf-ar"></span></summary><div class="sf-fl">' +
|
|
2886
|
+
r.cells.map(function(c, j){ return '<div data-testid="shape-field" data-result="' + (c.mark === "r" ? "failed" : "passed") + '"><span class="k">' + escapeXml(m.columns[j].name) + '</span><span class="g">' + gridMarkOf(c.mark) + '</span><span class="v">' + escapeXml(c.text || "") + (c.why ? ' <span class="why">\u00B7 ' + escapeXml(c.why) + '</span>' : '') + '</span></div>'; }).join("") + '</div></details>';
|
|
2887
|
+
}).join("") + '</div>';
|
|
2888
|
+
}
|
|
2889
|
+
function shapeResultCard(line, detail, many){
|
|
2890
|
+
var m = line.shape;
|
|
2891
|
+
var h = '<div class="job-card" data-testid="result-shape"><h4>Result' + (many ? " \u00B7 line " + escapeXml(String(line.n)) : "") + '</h4>';
|
|
2892
|
+
if(!m){
|
|
2893
|
+
h += '<div class="hint" data-testid="result-nofile">' + RESULT_NONE + '</div>';
|
|
2894
|
+
} else {
|
|
2895
|
+
h += '<p class="tg-stats" data-testid="shape-stats"><b>' + escapeXml(String(detail.flow || "")) + '</b> \u00B7 ' + escapeXml(String(detail.runId || "")) + ' \u00B7 <b>' + m.total + '</b> items \u00B7 <b>' + m.passed + '</b> passed \u00B7 <b>' + m.failed + '</b> failed</p>';
|
|
2896
|
+
h += shapeFoldHtml(m);
|
|
2897
|
+
}
|
|
2898
|
+
return h + resultNotChecked("Not checked", line.notChecked, "result-line-notchecked") + '</div>';
|
|
2899
|
+
}
|
|
2845
2900
|
// `own` = the Result tab read 2+ pages, so this line's box shows its own page
|
|
2846
2901
|
function resultLineCard(line, own, note){
|
|
2902
|
+
if(line.kind === "shape") return shapeResultCard(line, resultDetail || {}, !!(resultData && (resultData.lines || []).length > 1));
|
|
2847
2903
|
return '<div class="job-card" data-testid="result-line"><h4>Line ' + escapeXml(String(line.n)) + '</h4>' + resultLineBox(line) +
|
|
2848
2904
|
(own ? resultPageLink(line.page, note, "result-page-line") : "") +
|
|
2849
2905
|
(line.kind === "facts" ? resultFactsLine(line) : resultTextLine(line)) + (line.sheet ? resultSheetBlock(line.sheet) : resultChecksList(line)) +
|
|
@@ -4134,43 +4190,73 @@
|
|
|
4134
4190
|
// borrowed-from: bareloop src/panel/index.html@v0.56.0 (3383cce) :3845-3885 (auditCheckRowHtml, auditChecksSignClass, auditChecksEl), drawn in fwdloop's own fold (the learnings fold's header and body shape), appended inside #audit-groups
|
|
4135
4191
|
// the tag of a row by its kind (M16 item 5, one spelling: src/checkwords.js TAG): `~` rows [you], `!` rows [agent], `$` rows [default]; the plan card and the Audit both draw it
|
|
4136
4192
|
function tagWordOf(by){ return by === "you" || by === "agent" || by === "default" ? "[" + by + "]" : ""; }
|
|
4137
|
-
|
|
4193
|
+
// borrowed-from: bareloop src/panel/index.html@v0.61.0 (fc56e1f3) byTagOf (the sign before the tag, section 3.7: `~ [you]`, `! [agent]`, `$ [default]`)
|
|
4194
|
+
function byTagOf(by, form){ return (tagWordOf(by) === "" ? "" : ' <span class="by" data-testid="plan-by" data-by="' + by + '">' + (by === "you" ? "~ " : by === "agent" ? "! " : "$ ") + tagWordOf(by) + '</span>') + (form === "shape" ? ' <span class="by" data-testid="plan-form" data-form="shape">[shape]</span>' : ""); }
|
|
4195
|
+
// borrowed-from: bareloop src/panel/index.html@v0.61.0 (fc56e1f3) ckTagHtml, ckRowHtml, ckGroupHtml (the signed check-list look): a row is `[tag] kind words ... right`, the tag first in a fixed column,
|
|
4196
|
+
// the kind word second (`truth`, `shape`, `file`), the Drop / Add or the result at the right; a long reason sits behind "why", a failed row's red reason indented under it.
|
|
4197
|
+
function ckTagHtml(by){ return '<span class="by tagcol" data-testid="plan-by"' + (by ? ' data-by="' + escapeXml(by) + '"' : "") + ">" + (by ? "[" + escapeXml(by) + "]" : "") + "</span>"; }
|
|
4198
|
+
function ckRowHtml(o){
|
|
4199
|
+
var why = o.why ? ' <details class="ck-why" data-testid="ck-why"><summary>\u25B8 why</summary><div class="hint">' + escapeXml(o.why) + "</div></details>" : "";
|
|
4200
|
+
return '<div class="ck-row" data-testid="' + (o.testid || "plan-check") + '"' + (o.attrs || "") + (o.title ? ' title="' + escapeXml(o.title) + '"' : "") + ">" + ckTagHtml(o.by) + '<span class="kind" data-testid="ck-kind">' + (o.kind ? escapeXml(o.kind) : "") + '</span><span class="ck-t">' + escapeXml(o.text) + why + "</span>" + (o.right ? '<span class="ck-right">' + o.right + "</span>" : "") + (o.under || "") + "</div>";
|
|
4201
|
+
}
|
|
4202
|
+
function ckGroupHtml(title, rows, testid, tail){
|
|
4203
|
+
return rows.length ? '<div class="ck-g" data-testid="' + testid + '"><div class="ck-h">' + escapeXml(title) + " \u00B7 " + rows.length + (tail ? " \u00B7 " + escapeXml(tail) : "") + "</div>" + rows.join("") + "</div>" : "";
|
|
4204
|
+
}
|
|
4138
4205
|
// M16 P4c: the plan view of bareloop's card and Job tab, one drawing for both. `plan` = {lines: [{n, text, rules, leads, checks, extra}], suggested, notChecked, notCheckedBy, readNotes, alwaysOn}; the server wrote every string.
|
|
4139
4206
|
// `ctl` (the card only) draws the Drop / Add button of a row. fwdloop's own rows keep their place in bareloop's structure: a line's lead sentence (src/checked.js) and a sheet line's block draw as a row under their line.
|
|
4140
4207
|
// borrowed-from: bareloop src/panel/index.html@v0.56.0 (3383cce) :4157-4196 (planViewHtml: the line, its `~` rows, `\u203A check` rows, Suggested, the Not checked / How the page was read / Always checked folds)
|
|
4141
|
-
function planCheckRowHtml(name, cls, by, ctlHtml){
|
|
4142
|
-
return '<div class="fold" data-testid="plan-check"><span class="mk">\u203A</span> check \u00B7 ' + escapeXml(name) + (cls ? " \u00B7 " + escapeXml(cls) : "") + byTagOf(by) + (ctlHtml || "") + "</div>";
|
|
4143
|
-
}
|
|
4144
4208
|
function planFoldHtml(title, items, testid, byOf){
|
|
4145
4209
|
if(!items || !items.length) return "";
|
|
4146
4210
|
return '<details class="fold" data-testid="' + testid + '"><summary>' + escapeXml(title) + " \u00B7 " + items.length + "</summary><ul>" +
|
|
4147
4211
|
items.map(function(x){ return "<li>" + escapeXml(x) + byTagOf(byOf(x)) + "</li>"; }).join("") + "</ul></details>";
|
|
4148
4212
|
}
|
|
4213
|
+
// borrowed-from: bareloop src/panel/index.html@v0.61.0 (fc56e1f3) renderJobPlan (the groups of the signed look); fwd's own rows (a line's lead sentence, a sheet line's block, "How the page was read") keep their words inside it
|
|
4214
|
+
function planLegend(){
|
|
4215
|
+
return "Done when every check below passes";
|
|
4216
|
+
}
|
|
4149
4217
|
function planViewHtml(plan, ctl){
|
|
4150
|
-
var
|
|
4151
|
-
var
|
|
4152
|
-
|
|
4218
|
+
var lines = plan.lines || [];
|
|
4219
|
+
var hasCheck = (plan.alwaysOn || []).length > 0 || lines.some(function(l){ return (l.checks || []).length; });
|
|
4220
|
+
var h = '<div class="jp" data-testid="job-plan">' + (hasCheck ? '<div class="jp-legend">' + planLegend() + "</div>" : "");
|
|
4221
|
+
var checkRow = function(c){
|
|
4222
|
+
var kind = c.kind || (c.shape ? "shape" : "truth");
|
|
4223
|
+
return ckRowHtml({ by: c.by, kind: kind, text: c.name, right: ctl && c.drop && c.key ? ctl("drop", c.key) : "", title: c.cls || "", attrs: c.shape ? ' data-shape="1"' : "" });
|
|
4224
|
+
};
|
|
4225
|
+
// borrowed-from: bareloop src/panel/index.html@v0.61.0 (ncRow: a dropped rule's Not checked row has an Add back button)
|
|
4226
|
+
var ncRow = function(r){ return ckRowHtml({ by: r.by, text: r.text, why: r.why, testid: "plan-refused", right: ctl && r.addBack ? ctl("add", r.addBack, "Add back") : "" }); };
|
|
4227
|
+
var suggRow = function(x){ return ckRowHtml({ by: "agent", kind: /\.shape\./.test(x.key) ? "shape" : "truth", text: x.text + (x.dropped ? " (you dropped it)" : ""), right: ctl ? ctl("add", x.key) : "", testid: "plan-suggest-row" }); };
|
|
4228
|
+
var nc = plan.ncRows || [];
|
|
4229
|
+
// the rows no one line owns (the two checks every step has, a Not checked note naming no line): in the block of a one-line job, in a block of their own when there are several lines
|
|
4230
|
+
var jobChecks = (plan.alwaysOn || []).map(function(g){ return ckRowHtml({ by: "default", kind: "file", text: g, testid: "plan-always" }); });
|
|
4231
|
+
var jobNc = nc.filter(function(r){ return !r.line || !lines.some(function(l){ return l.n === r.line; }); });
|
|
4232
|
+
var sugg = plan.suggested || [];
|
|
4233
|
+
var oneLine = lines.length === 1;
|
|
4234
|
+
var groups = function(l, own){
|
|
4235
|
+
var checked = (l ? l.checks.map(checkRow) : []).concat(own ? jobChecks : []);
|
|
4236
|
+
var notc = (l ? nc.filter(function(r){ return r.line === l.n; }) : []).concat(own ? jobNc : []).map(ncRow);
|
|
4237
|
+
var sg = sugg.filter(function(x){ return l ? (x.line === l.n || (own && !lines.some(function(y){ return y.n === x.line; }))) : !lines.some(function(y){ return y.n === x.line; }); }).map(suggRow);
|
|
4238
|
+
return ckGroupHtml("CHECKED", checked, "plan-checked") + ckGroupHtml("NOT CHECKED", notc, "plan-notchecked", "you judge these at Accept") + (sg.length ? '<div class="ck-g jp-sug" data-testid="plan-suggested"><div class="ck-h">SUGGESTED \u00B7 add if you want it</div>' + sg.join("") + "</div>" : "");
|
|
4239
|
+
};
|
|
4240
|
+
lines.forEach(function(l){
|
|
4153
4241
|
h += '<div class="jl" data-testid="plan-line"><span class="num">' + escapeXml(String(l.n)) + "</span>" + escapeXml(l.text);
|
|
4154
4242
|
(l.rules || []).forEach(function(r){ h += '<div class="sub">~ ' + escapeXml(r) + "</div>"; });
|
|
4155
|
-
// fwdloop's own words under the line, plain grey after its `~` rows and before its
|
|
4243
|
+
// fwdloop's own words under the line, plain grey after its `~` rows and before its groups: the line's lead sentence (src/checked.js) and a sheet line's block (hamr 2026-11-14)
|
|
4156
4244
|
(l.leads || []).concat(l.extra || []).forEach(function(t){ h += '<div class="sub" data-testid="plan-lead">' + escapeXml(t) + "</div>"; });
|
|
4157
|
-
|
|
4158
|
-
h += "</div>";
|
|
4245
|
+
h += groups(l, oneLine) + "</div>";
|
|
4159
4246
|
});
|
|
4160
|
-
if(
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
}).join("") + "</div>";
|
|
4247
|
+
if(!oneLine){
|
|
4248
|
+
var rest = groups(null, true);
|
|
4249
|
+
if(rest) h += '<div class="jl" data-testid="plan-job-level"><span class="num"></span><span class="lbl">Every line</span>' + rest + "</div>";
|
|
4164
4250
|
}
|
|
4165
|
-
var ncBy = plan.notCheckedBy || {};
|
|
4166
|
-
h += planFoldHtml("Not checked", plan.notChecked, "plan-notchecked", function(x){ return ncBy[x]; });
|
|
4167
4251
|
h += planFoldHtml("How the page was read", plan.readNotes, "plan-readnotes", function(){ return ""; });
|
|
4168
|
-
h += planFoldHtml("Always checked", plan.alwaysOn, "plan-alwayson", function(){ return "default"; });
|
|
4169
4252
|
return h + "</div>";
|
|
4170
4253
|
}
|
|
4254
|
+
// borrowed-from: bareloop src/panel/index.html@v0.61.0 (fc56e1f3) auditCheckRowHtml: `[tag] kind words ... result`, the result word at the right, a failed row's red reason indented under it; a Not checked row has no result word, only its "why"
|
|
4171
4255
|
function auditCheckRowHtml(r){
|
|
4172
4256
|
var res = r.result === "passed" ? ["green", "passed"] : r.result === "failed" ? ["red", "failed"] : r.result === "not-checked" ? ["grey", "not checked"] : ["grey", "no result recorded"];
|
|
4173
|
-
|
|
4257
|
+
var nc = r.result === "not-checked";
|
|
4258
|
+
return ckRowHtml({ by: r.by, kind: nc ? "" : r.kind, text: r.text, why: nc ? r.why : "", testid: "audit-check-row", attrs: ' data-result="' + escapeXml(r.result) + '"', right: nc ? "" : stateDotHTML(res[0], res[1], "audit-check-state"),
|
|
4259
|
+
under: r.result === "failed" && r.why ? '<div class="hint ck-under" data-testid="audit-check-why">' + escapeXml(r.why) + "</div>" : "" });
|
|
4174
4260
|
}
|
|
4175
4261
|
// the fold's one state sign: any row failed = [\u2717]; else any row with no recorded result = [\u00B7]; else [\u2713] ("not checked" rows never move it)
|
|
4176
4262
|
function auditChecksSignClass(rows){
|
|
@@ -4205,15 +4291,24 @@
|
|
|
4205
4291
|
body.className = "audit-fold-body";
|
|
4206
4292
|
body.hidden = true;
|
|
4207
4293
|
body.setAttribute("data-testid", "audit-checks-body");
|
|
4208
|
-
var
|
|
4209
|
-
if(!rows || !rows.length) return "";
|
|
4210
|
-
return '<div data-testid="' + tid + '" style="margin:6px 0"><div><b>' + escapeXml(title) + "</b></div>" + rows.map(auditCheckRowHtml).join("") + "</div>";
|
|
4211
|
-
};
|
|
4294
|
+
var grp = function(title, rows, tid, tail){ return ckGroupHtml(title, rows.map(auditCheckRowHtml), tid, tail); };
|
|
4212
4295
|
var readSec = function(notes){
|
|
4213
4296
|
if(!notes || !notes.length) return "";
|
|
4214
4297
|
return '<div data-testid="audit-checks-readnotes" style="margin:6px 0"><div><b>How the page was read</b></div>' + notes.map(function(t){ return '<div class="audit-check-row" data-testid="audit-read-note" style="overflow-wrap:anywhere;margin:2px 0">' + escapeXml(t) + "</div>"; }).join("") + "</div>";
|
|
4215
4298
|
};
|
|
4216
|
-
|
|
4299
|
+
// borrowed-from: bareloop src/panel/index.html@v0.61.0 (fc56e1f3) auditChecksEl: one block per job line (signed look): `Line N text`, its CHECKED rows, its NOT CHECKED rows; the rows no line owns (the two every step has, a Not checked note naming no line) join the block of a one-line job, else have a block of their own
|
|
4300
|
+
var lineBlocks = ac.lines || [];
|
|
4301
|
+
var blocks = lineBlocks.map(function(l, i, all){
|
|
4302
|
+
var own = all.length === 1;
|
|
4303
|
+
return '<div class="jl" data-testid="audit-line"><span class="lbl">Line ' + escapeXml(String(l.n)) + "</span> " + escapeXml(l.text) +
|
|
4304
|
+
grp("CHECKED", (l.checks || []).concat(own ? (ac.always || []) : []), "audit-checks-checks") + grp("NOT CHECKED", (l.notChecked || []).concat(own ? (ac.jobNotChecked || []) : []), "audit-checks-notchecked", "you judge these at Accept") + "</div>";
|
|
4305
|
+
});
|
|
4306
|
+
if(lineBlocks.length !== 1){
|
|
4307
|
+
var rest = grp("CHECKED", ac.always || [], "audit-checks-always") + grp("NOT CHECKED", ac.jobNotChecked || [], "audit-checks-notchecked", "you judge these at Accept");
|
|
4308
|
+
if(rest) blocks.push('<div class="jl" data-testid="audit-job-level"><span class="lbl">Every line</span>' + rest + "</div>");
|
|
4309
|
+
}
|
|
4310
|
+
// a run read without its per-line data (an older record, a row owned by a line the job text lacks) keeps the flat groups, no row lost
|
|
4311
|
+
body.innerHTML = '<div class="jp">' + (lineBlocks.length ? blocks.join("") : grp("CHECKED", (ac.checks || []).concat(ac.always || []), "audit-checks-checks") + grp("NOT CHECKED", ac.notChecked || [], "audit-checks-notchecked", "you judge these at Accept")) + readSec(ac.readNotes) + "</div>";
|
|
4217
4312
|
function paint(open){ body.hidden = !open; wrap.classList.toggle("closed", !open); btn.setAttribute("aria-expanded", open ? "true" : "false"); }
|
|
4218
4313
|
function toggle(){ var open = body.hidden; auditExpanded["\u0000checks"] = open; paint(open); }
|
|
4219
4314
|
btn.addEventListener("click", toggle);
|
|
@@ -4493,12 +4588,16 @@
|
|
|
4493
4588
|
tail.innerHTML = "";
|
|
4494
4589
|
(plan.steps || []).filter(function(st){ return !placed[st.step]; }).forEach(function(st){ tail.appendChild(jobStepFold(st, job)); });
|
|
4495
4590
|
var nc = plan.notChecked || {};
|
|
4496
|
-
//
|
|
4591
|
+
// M19 S6: a plan with a list draws the signed look's rows no line owns in an "Every line" block (a one-line job's sit in its Line 1 block, above), then "How the page was read"
|
|
4497
4592
|
if(plan.always && nc.recorded){
|
|
4498
4593
|
var jpFolds = document.createElement("div");
|
|
4499
4594
|
jpFolds.className = "jp";
|
|
4500
|
-
var
|
|
4501
|
-
|
|
4595
|
+
var many = (job.prose || []).length !== 1;
|
|
4596
|
+
var lineNos = (job.prose || []).map(function(x){ return x.line; });
|
|
4597
|
+
var restNc = (nc.rows || []).filter(function(r){ return (many && !r.line) || (r.line && lineNos.indexOf(r.line) < 0); }).map(function(r){ return ckRowHtml({ by: r.by, text: r.text, why: r.why, testid: "plan-refused" }); });
|
|
4598
|
+
var restChecked = many ? (plan.always || []).map(function(g){ return ckRowHtml({ by: "default", kind: "file", text: g, testid: "plan-always" }); }) : [];
|
|
4599
|
+
var rest = ckGroupHtml("CHECKED", restChecked, "plan-checked") + ckGroupHtml("NOT CHECKED", restNc, "plan-notchecked", "you judge these at Accept");
|
|
4600
|
+
jpFolds.innerHTML = (rest ? '<div class="jl" data-testid="plan-job-level"><span class="lbl">Every line</span>' + rest + "</div>" : "") + planFoldHtml("How the page was read", nc.readNotes, "plan-readnotes", function(){ return ""; });
|
|
4502
4601
|
tail.appendChild(jpFolds);
|
|
4503
4602
|
return;
|
|
4504
4603
|
}
|
|
@@ -4542,6 +4641,9 @@
|
|
|
4542
4641
|
jobEl.innerHTML = "";
|
|
4543
4642
|
// M4e amendment 37: one wrapper per signed line: the human's words, its `~` rows, then its step(s) folded under it (the plan, never in the same row).
|
|
4544
4643
|
var placed = {};
|
|
4644
|
+
// am2 item 1: the Job tab's legend, first in the box, only when the plan has a check (bareloop v0.61.0 renderJobPlan's hasCheck); the same string as the card's
|
|
4645
|
+
var jobPlan = job.plan || {};
|
|
4646
|
+
if((jobPlan.always || []).length > 0 || (jobPlan.steps || []).some(function(st){ return (st.listRows || []).length; })) jobEl.appendChild(textDiv("jp-legend", planLegend()));
|
|
4545
4647
|
if(!job.prose || !job.prose.length){
|
|
4546
4648
|
jobEl.appendChild(textDiv("hint", "no signed prose lines"));
|
|
4547
4649
|
} else {
|
|
@@ -4560,11 +4662,16 @@
|
|
|
4560
4662
|
});
|
|
4561
4663
|
// M16 P4c: the checks of a list line sit under the job line as `\u203A check` rows with their tags (bareloop's Job tab); the step fold keeps the rest
|
|
4562
4664
|
// the line's lead sentence and a sheet block draw as plain grey lines first (hamr 2026-11-14), then the rows
|
|
4563
|
-
var listRowsHtml = "";
|
|
4665
|
+
var listRowsHtml = "", listChecked = [];
|
|
4564
4666
|
((job.plan && job.plan.steps) || []).filter(function(st){ return st.line === l.line; }).forEach(function(st){
|
|
4565
4667
|
if(job.plan.always && !st.ask) (st.check || []).concat(sheetBlockLines(st.sheet, true)).forEach(function(t){ listRowsHtml += '<div class="sub" data-testid="plan-lead">' + escapeXml(t) + "</div>"; });
|
|
4566
|
-
(st.listRows || []).forEach(function(r){
|
|
4668
|
+
(st.listRows || []).forEach(function(r){ listChecked.push(ckRowHtml({ by: r.by, kind: r.kind || "truth", text: r.text })); });
|
|
4567
4669
|
});
|
|
4670
|
+
var ncAll = (job.plan && job.plan.notChecked && job.plan.notChecked.rows) || [];
|
|
4671
|
+
var oneJobLine = job.prose.length === 1;
|
|
4672
|
+
var ownNc = ncAll.filter(function(r){ return r.line === l.line || (oneJobLine && !r.line); }).map(function(r){ return ckRowHtml({ by: r.by, text: r.text, why: r.why, testid: "plan-refused" }); });
|
|
4673
|
+
var ownChecked = listChecked.concat(oneJobLine && job.plan && job.plan.always ? job.plan.always.map(function(g){ return ckRowHtml({ by: "default", kind: "file", text: g, testid: "plan-always" }); }) : []);
|
|
4674
|
+
if(listChecked.length || ownNc.length || (oneJobLine && job.plan && job.plan.always)) listRowsHtml += ckGroupHtml("CHECKED", ownChecked, "plan-checked") + ckGroupHtml("NOT CHECKED", ownNc, "plan-notchecked", "you judge these at Accept");
|
|
4568
4675
|
if(listRowsHtml){ var jpRows = document.createElement("div"); jpRows.className = "jp"; jpRows.innerHTML = listRowsHtml; cell.appendChild(jpRows); }
|
|
4569
4676
|
((job.plan && job.plan.steps) || []).filter(function(st){ return st.line === l.line; }).forEach(function(st){
|
|
4570
4677
|
placed[st.step] = true;
|
|
@@ -5709,6 +5816,7 @@
|
|
|
5709
5816
|
var startOverBtn = document.getElementById("chat-startover-btn");
|
|
5710
5817
|
var reviseBtn = document.getElementById("chat-revise-btn");
|
|
5711
5818
|
var errEl = document.getElementById("chat-card-error"); // POLL-OWNED: the draft's own sentence (red / stopped)
|
|
5819
|
+
var refusalEl = document.getElementById("chat-draft-refusal"); // POLL-OWNED: the pointer to a refusal under a box, or the words of one with no box (M19 am14b)
|
|
5712
5820
|
var actionErrEl = document.getElementById("chat-action-error"); // ACTION-OWNED: only a click's refusal; the poll never wipes it
|
|
5713
5821
|
var progressRow = document.getElementById("chat-progress-row");
|
|
5714
5822
|
var questionBox = document.getElementById("chat-question");
|
|
@@ -5983,17 +6091,22 @@
|
|
|
5983
6091
|
// pure: the plan view's model for a plan with a list: each job line with its `~` rules, its lead sentence (src/checked.js), the built rows of the list, a sheet line's block; then the suggestions and the three folds
|
|
5984
6092
|
function planOfState(state, list){
|
|
5985
6093
|
var nc = state.notChecked || {};
|
|
5986
|
-
var plan = {lines: [], suggested: list.suggested || [], notChecked: nc.items || [], notCheckedBy: nc.by && typeof nc.by === "object" ? nc.by : {}, readNotes: nc.readNotes || [], alwaysOn: state.always || []};
|
|
6094
|
+
var plan = {lines: [], suggested: list.suggested || [], notChecked: nc.items || [], notCheckedBy: nc.by && typeof nc.by === "object" ? nc.by : {}, readNotes: nc.readNotes || [], alwaysOn: state.always || [], ncRows: (nc.rows || []).map(function(r){ return Object.assign({}, r); })};
|
|
5987
6095
|
(state.planLines || []).forEach(function(pl){
|
|
5988
6096
|
var l = {n: pl.n, text: pl.text, rules: pl.rules || [], leads: [], checks: [], extra: []};
|
|
5989
6097
|
state.checked.forEach(function(c){
|
|
5990
6098
|
if(c.line !== pl.n) return;
|
|
5991
|
-
if(c.
|
|
6099
|
+
if(typeof c.lead === "string") l.leads.push(c.lead);
|
|
5992
6100
|
sheetBlockLines(c.sheet, true).forEach(function(t){ l.extra.push(t); });
|
|
5993
6101
|
});
|
|
5994
|
-
list.rows.filter(function(r){ return r.line === pl.n && r.state === "built"; }).forEach(function(r){ l.checks.push({name: r.text, cls: "", by: r.by, key: r.key, drop: r.drop === true}); });
|
|
6102
|
+
list.rows.filter(function(r){ return r.line === pl.n && r.state === "built"; }).forEach(function(r){ l.checks.push({name: r.text, cls: "", by: r.by, key: r.key, drop: r.drop === true, kind: r.kind}); });
|
|
5995
6103
|
plan.lines.push(l);
|
|
5996
6104
|
});
|
|
6105
|
+
// borrowed-from: bareloop src/panel/jobplan.js@v0.61.0 (planFromConfirm: a rule the person dropped, confirm card only: its Not checked row carries the key the Add back button posts)
|
|
6106
|
+
(list.restorable || []).forEach(function(x){
|
|
6107
|
+
var n = plan.ncRows.find(function(r){ return r.addBack === undefined && r.text === x.text && (r.line === x.line || r.line === 0); });
|
|
6108
|
+
if(n) n.addBack = x.key;
|
|
6109
|
+
});
|
|
5997
6110
|
return plan;
|
|
5998
6111
|
}
|
|
5999
6112
|
// pure: what sits beside a green plan: Your answers (only when the plan was drafted with some), Checked (the machine's sentences from the
|
|
@@ -6326,7 +6439,8 @@
|
|
|
6326
6439
|
|
|
6327
6440
|
// ---- a refusal shows next to its box ----
|
|
6328
6441
|
function clearFieldErrors(){
|
|
6329
|
-
|
|
6442
|
+
// the painted refusal's box line belongs to paintRefusal / clearRefusal (the one writer): a late flows answer repaints the Run form and must not wipe it
|
|
6443
|
+
card.querySelectorAll(".jf-err").forEach(function(e){ if(e !== refusalBoxEl) e.textContent = ""; });
|
|
6330
6444
|
}
|
|
6331
6445
|
function errElFor(field){
|
|
6332
6446
|
var m = /^inputs\.(\d+)$/.exec(field);
|
|
@@ -6872,8 +6986,8 @@
|
|
|
6872
6986
|
return escapeXml(l.text) + byTagOf(l.by);
|
|
6873
6987
|
}
|
|
6874
6988
|
// the Drop / Add button of the plan view (bareloop's control; the click is handled once on the extras box)
|
|
6875
|
-
function planControlHTML(op, key){
|
|
6876
|
-
return ' <button type="button" class="btn jp-btn" data-testid="plan-' + op + '" data-rowop="' + op + '" data-rowkey="' + escapeXml(key) + '">' + (op === "add" ? "Add" : "Drop") + "</button>";
|
|
6989
|
+
function planControlHTML(op, key, label){
|
|
6990
|
+
return ' <button type="button" class="btn jp-btn" data-testid="plan-' + op + '" data-rowop="' + op + '" data-rowkey="' + escapeXml(key) + '">' + (label || (op === "add" ? "Add" : "Drop")) + "</button>";
|
|
6877
6991
|
}
|
|
6878
6992
|
// M13 am11c: the action row, two cases, never a Drop (to change it, Revise). You picked it (Agree or typed): [you]. The AI's pick, or an old log with no `by`: [agent].
|
|
6879
6993
|
function actionRowHtml(a){
|
|
@@ -6941,9 +7055,28 @@
|
|
|
6941
7055
|
function syncJobBoxFromSession(state){
|
|
6942
7056
|
var jt = state && state.card && state.card.job;
|
|
6943
7057
|
var box = document.getElementById("jf-job");
|
|
6944
|
-
|
|
7058
|
+
// F259: a red or stopped draft has left the boxes to the person (the card is open to fix and draft again); the poll never writes them back
|
|
7059
|
+
if(!sessionLive || reviseOpen || state.phase === "stopped" || state.phase === "red" || typeof jt !== "string" || jt === box.value) return;
|
|
6945
7060
|
setVal("jf-job", jt); fitCardBoxes();
|
|
6946
7061
|
}
|
|
7062
|
+
// M19 am14b: the ONE writer of a draft refusal's lines. The box error is painted once per refusal (so a poll never brings back a line the person cleared by pressing Draft).
|
|
7063
|
+
var REFUSAL_POINTER = "Not drafted: fix the red line above.";
|
|
7064
|
+
var refusalKey = ""; // which refusal is painted
|
|
7065
|
+
var refusalBoxEl = null; // the box error line it was painted into (null: none)
|
|
7066
|
+
function clearRefusal(){
|
|
7067
|
+
if(refusalBoxEl) refusalBoxEl.textContent = "";
|
|
7068
|
+
refusalBoxEl = null; refusalKey = ""; refusalEl.textContent = "";
|
|
7069
|
+
}
|
|
7070
|
+
function paintRefusal(state, r){
|
|
7071
|
+
var key = r ? String(state.draftId) + "|" + r.box + "|" + r.words : "";
|
|
7072
|
+
if(key === refusalKey) return;
|
|
7073
|
+
clearRefusal();
|
|
7074
|
+
refusalKey = key;
|
|
7075
|
+
if(!r) return;
|
|
7076
|
+
var boxEl = r.box ? errElFor(r.box) : null;
|
|
7077
|
+
if(boxEl){ boxEl.textContent = r.words; refusalBoxEl = boxEl; refusalEl.textContent = REFUSAL_POINTER; }
|
|
7078
|
+
else refusalEl.textContent = r.words;
|
|
7079
|
+
}
|
|
6947
7080
|
function renderActions(state){
|
|
6948
7081
|
lastState = state;
|
|
6949
7082
|
renderQuestion(state);
|
|
@@ -6952,7 +7085,11 @@
|
|
|
6952
7085
|
if(signInfo && state.hash && state.hash !== signInfo.hash){ signInfo = null; signClickedOnce = false; }
|
|
6953
7086
|
// #chat-card-error is POLL-OWNED: it carries only the draft's own sentence (a red plan or a stopped child), written here and
|
|
6954
7087
|
// nowhere else. A refused click goes to #chat-action-error, which this function never touches.
|
|
6955
|
-
|
|
7088
|
+
// M19 am14b: a draft refused at $0 shows its words under the box it is about (red, like "required") with one pointer by the Draft button; a refusal with no box shows
|
|
7089
|
+
// its words under the button. No grey copy: the grey card line carries every other sentence (a red plan from the AI keeps its own).
|
|
7090
|
+
var refusal = (state.phase === "stopped" && state.refusal && typeof state.refusal === "object") ? state.refusal : null;
|
|
7091
|
+
paintRefusal(state, refusal);
|
|
7092
|
+
errEl.textContent = (!refusal && (state.phase === "red" || state.phase === "stopped") && state.say) ? state.say : "";
|
|
6956
7093
|
var progressChanged = renderProgress(stepsFor(state, {model: drafterModel, starting: startId !== null, signClicked: signClickedOnce}));
|
|
6957
7094
|
sessionLive = CLIENT_TERMINAL_PHASES.indexOf(state.phase) === -1;
|
|
6958
7095
|
refreshStartEnabled();
|
|
@@ -6976,6 +7113,7 @@
|
|
|
6976
7113
|
threadKey = ""; thread.innerHTML = "";
|
|
6977
7114
|
renderQuestion(null); renderExtras(null);
|
|
6978
7115
|
errEl.textContent = "";
|
|
7116
|
+
clearRefusal();
|
|
6979
7117
|
progressRow.hidden = true; progressRow.innerHTML = ""; progressHtml = "";
|
|
6980
7118
|
refreshStartEnabled();
|
|
6981
7119
|
}
|
|
@@ -6983,6 +7121,7 @@
|
|
|
6983
7121
|
thread.innerHTML = ""; threadKey = "";
|
|
6984
7122
|
renderQuestion(null); renderExtras(null);
|
|
6985
7123
|
errEl.textContent = "";
|
|
7124
|
+
clearRefusal();
|
|
6986
7125
|
actionErrEl.textContent = "";
|
|
6987
7126
|
clearFieldErrors();
|
|
6988
7127
|
stopStart();
|
|
@@ -7120,6 +7259,7 @@
|
|
|
7120
7259
|
}).catch(function(){ qBusy = false; qSend.disabled = false; qAgree.disabled = false; qDrop.disabled = false; qColumn.disabled = false; qError.textContent = NETWORK_SAY; });
|
|
7121
7260
|
}
|
|
7122
7261
|
function doDraft(startedOverFrom){
|
|
7262
|
+
clearRefusal();
|
|
7123
7263
|
clearFieldErrors();
|
|
7124
7264
|
chatActionOk();
|
|
7125
7265
|
// disabled from the click until the reply; unlocked below only if the draft is refused
|
package/src/panel/result.js
CHANGED
|
@@ -25,6 +25,10 @@ import { readChecks } from '../diary.js';
|
|
|
25
25
|
import { sheetLineBlocks, csvRolesOf } from '../sheetblock.js';
|
|
26
26
|
import { readSheetChecks } from '../sheet-record.js';
|
|
27
27
|
import { tagged } from '../checkwords.js';
|
|
28
|
+
import { shapeResultModel } from '../shaperesult.js';
|
|
29
|
+
import { shapeItemOfPlain } from '../shapewords.js';
|
|
30
|
+
import { SHAPE_TRUTH_WORDS } from '../shaperows.js';
|
|
31
|
+
import { lineRulesOf } from '../whole-job.js';
|
|
28
32
|
|
|
29
33
|
/** the two sentences for a saved file that is no longer what the run wrote (code-owned, one spelling) */
|
|
30
34
|
export const RESULT_FILE_GONE = 'the saved file is gone';
|
|
@@ -179,7 +183,7 @@ export function readDelivered(rec) {
|
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
/**
|
|
182
|
-
* The files this run's signed sends wrote: for each signed send whose send step ended green in the audit, the file `<flow>-<runId>-<emits>.md`
|
|
186
|
+
* The files this run's signed sends wrote: for each signed send whose send step ended green in the audit, the file `<job>-YYYY-MM-DD[-n].md` (`sentName`, M15 am3; older runs: `<flow>-<runId>-<emits>.md`)
|
|
183
187
|
* in the signed folder with the sha256 the send recorded for it (M15), or, for a send older than M15, `.json` with the sha256 the human's accept recorded for the ask that
|
|
184
188
|
* send reads (`readAcceptedHashesByEmits`, the same record the send itself checked). No accepted hash = recorded as null, which reads as "changed", never as ok.
|
|
185
189
|
* @returns {{path: string, dir: string|null, name: string, note: string|null, sha256: string|null}[]}
|
|
@@ -235,6 +239,26 @@ function gapOf(text) {
|
|
|
235
239
|
return { line: rows[0], more, moreText: more > 0 ? `(+${more} more)` : null };
|
|
236
240
|
}
|
|
237
241
|
|
|
242
|
+
/**
|
|
243
|
+
* borrowed-from: bareloop src/panel/server.js@v0.61.0 (`shapeRedsFromRecords`, the gap-line half), adjusted to fwdloop's books: a run records the close's plain gap lines on its audit and log.json attempt rows (never bareguard's per-row record),
|
|
244
|
+
* and a red run's judged answer is the model output of that attempt in log.json. A shape line's answer for the Result tab: the delivered artifact (the step closed green: no item is red) or, for a red run, the step's last red attempt
|
|
245
|
+
* with the item reds read back from its plain gap lines through `shapeItemOfPlain`. Third outcome: nothing readable is `null` (the page says "no saved result to show").
|
|
246
|
+
* @param {{runDir: string, step: any, line: number, logJson: any}} a @returns {{results: any[], reds: string[]}|null}
|
|
247
|
+
*/
|
|
248
|
+
export function shapeAnswerOf({ runDir, step, line, logJson }) {
|
|
249
|
+
const a = readArtifactResult(runDir, step.emits);
|
|
250
|
+
if (a.ok && a.value && typeof a.value === 'object' && Array.isArray(a.value.results)) return { results: a.value.results, reds: [] };
|
|
251
|
+
const last = (Array.isArray(logJson?.attempts) ? logJson.attempts : []).filter((t) => t && t.step === step.emits && t.verdict === 'red').at(-1);
|
|
252
|
+
const out = last?.modelOutput;
|
|
253
|
+
if (!out || typeof out !== 'object' || !Array.isArray(out.results)) return null;
|
|
254
|
+
const reds = String(last.gap ?? '').split('\n').flatMap((l) => {
|
|
255
|
+
const m = /^line (\d+): (item \d+.*)$/s.exec(l);
|
|
256
|
+
const red = m && Number(m[1]) === line ? shapeItemOfPlain(m[2]) : null;
|
|
257
|
+
return red ? [red] : [];
|
|
258
|
+
});
|
|
259
|
+
return { results: out.results, reds: [...new Set(reds)] };
|
|
260
|
+
}
|
|
261
|
+
|
|
238
262
|
/**
|
|
239
263
|
* The Result tab's JSON for one run (`GET /api/runs/:flow/:runId/result`).
|
|
240
264
|
* @param {{flow: string, runId: string, runDir: string, root: string, flowRead: any, arbiter: any, historyRow: any, auditRows: any[], logJson: any, notChecked: string[], readNotes?: string[], setupRows?: any[], door?: {askId: string, draftNo: number}|null}} a
|
|
@@ -268,6 +292,15 @@ export function buildResult({
|
|
|
268
292
|
}).filter((x) => x !== null);
|
|
269
293
|
if (written.length > 0) out.answer = written.join('\n\n');
|
|
270
294
|
}
|
|
295
|
+
// M19 S8 (the signed mock A2): a line whose close holds a list-of-items check (`close.itemShape`) shows its answer as a fold of items; the model is src/shaperesult.js's (bareloop v0.61.0), the marks and words the server's
|
|
296
|
+
const shapeStep = (declaration?.steps ?? []).find((st) => st.fromLine === l.n && st.close && typeof st.close.itemShape === 'object' && st.close.itemShape !== null && Array.isArray(st.close.itemShape.fields));
|
|
297
|
+
if (shapeStep) {
|
|
298
|
+
out.kind = 'shape';
|
|
299
|
+
const got = shapeAnswerOf({ runDir, step: shapeStep, line: l.n, logJson });
|
|
300
|
+
out.shape = got === null ? null : shapeResultModel({ part: shapeStep.close.itemShape, results: got.results, reds: got.reds, rules: lineRulesOf(l) });
|
|
301
|
+
if (!out.notChecked.includes(SHAPE_TRUTH_WORDS)) out.notChecked = [...out.notChecked, SHAPE_TRUTH_WORDS];
|
|
302
|
+
return out;
|
|
303
|
+
}
|
|
271
304
|
if (c) {
|
|
272
305
|
out.source = c.source;
|
|
273
306
|
out.page = urls.get(c.source) ?? null;
|
package/src/pickrecord.js
CHANGED
|
@@ -118,6 +118,20 @@ export function readRowChoices(file) {
|
|
|
118
118
|
} catch { return null; }
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
// borrowed-from: bareloop src/pickrecord.js@v0.61.0 (fc56e1f3) (readShapeDropped; read through readFileInside like readSheetDropped; writeRecordPart not taken: fwd's writers are src/authoring.js and src/planrebuild.js)
|
|
122
|
+
/**
|
|
123
|
+
* Shape jobs (clause 4): the shape fields a person dropped from a plan, carried like the sheet's (the block's `shapeDroppedRecord`: `{lineWords, occurrence, name}` or `{lineWords, occurrence, rule}`), so a Revise keeps a Drop of the very same field. A missing or unreadable record is no record.
|
|
124
|
+
* @param {string} file @returns {{lineWords: string, occurrence: number, name?: string, rule?: number}[]|null}
|
|
125
|
+
*/
|
|
126
|
+
export function readShapeDropped(file) {
|
|
127
|
+
try {
|
|
128
|
+
const g = readFileInside(path.dirname(file), path.basename(file));
|
|
129
|
+
if (!g.ok) return null;
|
|
130
|
+
const j = JSON.parse(g.text);
|
|
131
|
+
return Array.isArray(j?.shapeDropped) ? j.shapeDropped.filter((/** @type {any} */ d) => d && typeof d.lineWords === 'string' && Number.isInteger(d.occurrence) && (typeof d.name === 'string' || Number.isInteger(d.rule))) : null;
|
|
132
|
+
} catch { return null; }
|
|
133
|
+
}
|
|
134
|
+
|
|
121
135
|
/**
|
|
122
136
|
* The sheet checks the person dropped from a plan (hamr 2026-11-14: a Revise keeps a sheet Drop), carried like the page-row choices: the record's `sheetDropped` entries, each `{key, line, index, check, text}`;
|
|
123
137
|
* the next draft drops a new check with the same id again. Read through readFileInside; a missing or unreadable record is no record.
|