fwdloop 0.32.0 → 0.33.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 +8 -2
- package/package.json +2 -2
- package/src/auditchecks.js +53 -0
- package/src/authoring.js +52 -12
- package/src/blockasks.js +44 -0
- package/src/blockassemble.js +140 -0
- package/src/blockdraft.js +91 -0
- package/src/blocklines.js +30 -0
- package/src/blockpick.js +165 -0
- package/src/cardlist.js +19 -0
- package/src/checkblock.js +804 -0
- package/src/checked.js +48 -9
- package/src/checklist.js +99 -0
- package/src/checklistsign.js +93 -0
- package/src/checkwords.js +20 -1
- package/src/cited-record.js +21 -1
- package/src/citedcheck.js +162 -7
- package/src/closers.js +41 -3
- package/src/declaration.js +25 -2
- package/src/declaredclose.js +4 -0
- package/src/draft-steps.js +3 -1
- package/src/drafter.js +205 -122
- package/src/factwords.js +112 -0
- package/src/inputlook.js +53 -0
- package/src/labelscan.js +162 -0
- package/src/pageask.js +4 -1
- package/src/pagedropwords.js +11 -1
- package/src/panel/author.js +73 -4
- package/src/panel/authorcard.js +9 -6
- package/src/panel/data.js +41 -9
- package/src/panel/index.html +202 -13
- package/src/panel/result.js +4 -3
- package/src/panel/server.js +3 -1
- package/src/pickrecord.js +28 -0
- package/src/placerule.js +398 -0
- package/src/planrebuild.js +206 -0
- package/src/rowedit.js +118 -0
- package/src/rubricstep.js +264 -0
- package/src/runfile.js +4 -2
- package/src/runner.js +67 -10
- package/src/setup.js +10 -4
- package/src/sheetblock.js +6 -2
- package/src/sheetchecks.js +49 -64
- package/src/sheetclaims.js +12 -32
- package/src/sheetoffer.js +24 -52
- package/src/sheetrows.js +107 -0
- package/src/sheetrun.js +13 -10
- package/src/summary-words.js +3 -3
- package/src/try-checks.js +31 -12
- package/src/types.js +1 -0
- package/types/auditchecks.d.ts +24 -0
- package/types/authoring.d.ts +18 -1
- package/types/blockasks.d.ts +37 -0
- package/types/blockassemble.d.ts +33 -0
- package/types/blockdraft.d.ts +83 -0
- package/types/blocklines.d.ts +31 -0
- package/types/blockpick.d.ts +41 -0
- package/types/cardlist.d.ts +21 -0
- package/types/checkblock.d.ts +363 -0
- package/types/checked.d.ts +16 -2
- package/types/checklist.d.ts +115 -0
- package/types/checklistsign.d.ts +27 -0
- package/types/checkwords.d.ts +5 -0
- package/types/cited-record.d.ts +9 -0
- package/types/citedcheck.d.ts +33 -2
- package/types/closers.d.ts +24 -2
- package/types/declaredclose.d.ts +2 -0
- package/types/drafter.d.ts +15 -361
- package/types/factwords.d.ts +38 -0
- package/types/inputlook.d.ts +49 -0
- package/types/labelscan.d.ts +35 -0
- package/types/pageask.d.ts +2 -0
- package/types/panel/author.d.ts +41 -0
- package/types/panel/authorcard.d.ts +1 -1
- package/types/panel/data.d.ts +4 -2
- package/types/panel/jobgrid.d.ts +1 -1
- package/types/pickrecord.d.ts +22 -0
- package/types/placerule.d.ts +208 -0
- package/types/planrebuild.d.ts +52 -0
- package/types/provider.d.ts +1 -1
- package/types/rowedit.d.ts +33 -0
- package/types/rubricstep.d.ts +60 -0
- package/types/runfile.d.ts +5 -2
- package/types/runner.d.ts +45 -1
- package/types/sheetblock.d.ts +1 -0
- package/types/sheetchecks.d.ts +10 -17
- package/types/sheetclaims.d.ts +2 -1
- package/types/sheetoffer.d.ts +5 -5
- package/types/sheetrows.d.ts +73 -0
- package/types/sheetrun.d.ts +4 -4
- package/types/summary-words.d.ts +2 -1
- package/types/try-checks.d.ts +4 -2
- package/types/types.d.ts +8 -0
package/src/panel/data.js
CHANGED
|
@@ -40,8 +40,11 @@ import { readSpendRows } from '../provider.js';
|
|
|
40
40
|
import { applyRunValues, parseWaitMs, pickRunValues, VALUES_FILE_RE } from '../runvalues.js';
|
|
41
41
|
import { readSetup } from '../setup.js';
|
|
42
42
|
import { parseHintBlock } from '../learn.js';
|
|
43
|
-
import { checkedLines, notCheckedView,
|
|
44
|
-
import {
|
|
43
|
+
import { checkedLines, notCheckedView, notCheckedLabelOf, listPartRows } from '../checked.js';
|
|
44
|
+
import { EVERY_STEP_TEXTS } from '../try-checks.js';
|
|
45
|
+
import { LABEL_PICKED, tagOf } from '../checkwords.js';
|
|
46
|
+
import { listLinesOf } from '../checklistsign.js';
|
|
47
|
+
import { auditChecksOf } from '../auditchecks.js';
|
|
45
48
|
import { panelQuestionText } from '../pageask.js';
|
|
46
49
|
import { csvRolesOf, askSheetCard } from '../sheetblock.js';
|
|
47
50
|
import { readSheetChecks } from '../sheet-record.js';
|
|
@@ -1543,7 +1546,7 @@ function runSummary(ctx, glyph, { root, catalogue, triggerRead, now, home }) {
|
|
|
1543
1546
|
}
|
|
1544
1547
|
const send = ctx.arbiter && Array.isArray(ctx.arbiter.sends) ? ctx.arbiter.sends.find((x) => x.target && typeof x.target.path === 'string') : undefined;
|
|
1545
1548
|
const endedPlain = endedWords({
|
|
1546
|
-
outcome, died, line, destination: send ? send.target.path : null, canResume: ctx.resumable === true && ctx.sameJob === true, home, skipReason: ctx.historyRow?.skipReason,
|
|
1549
|
+
outcome, died, line, destination: send ? send.target.path : null, canResume: ctx.resumable === true && ctx.sameJob === true, home, skipReason: ctx.historyRow?.skipReason, anywayOffered: newTicketScheduleOf(ctx.flowDir) !== null,
|
|
1547
1550
|
});
|
|
1548
1551
|
// M9 am7 item 1: ENDED opens with the run's local end date and time, then its outcome word, then today's reason (NEXT stays as it was)
|
|
1549
1552
|
const ended = endedPlain === null ? null : {
|
|
@@ -1565,6 +1568,15 @@ function runSummary(ctx, glyph, { root, catalogue, triggerRead, now, home }) {
|
|
|
1565
1568
|
return { ended, scheduled, schedule, canSchedule: !!(t && t.hasGreenRun), catchUp: catchUpWords(rec) };
|
|
1566
1569
|
}
|
|
1567
1570
|
|
|
1571
|
+
/**
|
|
1572
|
+
* M13 am10: the job's schedule when it is a new-ticket one, else null. The one test for "the panel has Run it anyway here": the grid's `anyway` and the skipped run's next line both ask it.
|
|
1573
|
+
* @param {string} flowDir
|
|
1574
|
+
*/
|
|
1575
|
+
function newTicketScheduleOf(flowDir) {
|
|
1576
|
+
const sched = readSchedule(flowDir);
|
|
1577
|
+
return sched && sched.trigger?.kind === 'new-ticket' ? sched : null;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1568
1580
|
/**
|
|
1569
1581
|
* `GET /api/runs/:flow/:runId` — the Run tab (M4a scope item 2): the step
|
|
1570
1582
|
* map from `declaration.steps`, step cards -> attempts from `audit.jsonl`
|
|
@@ -1899,6 +1911,8 @@ export function draftTotals(modelRows, ctx = {}) {
|
|
|
1899
1911
|
*/
|
|
1900
1912
|
export function getDraftBlock(flowDir, runDir) {
|
|
1901
1913
|
const setup = readSetup(flowDir);
|
|
1914
|
+
// M16 item 5: a plan with a list tags the rule a person's answer added `[you]` (a row's `by`), an older plan keeps `[you picked]`
|
|
1915
|
+
const youTag = (() => { try { const d = readFileInside(flowDir, 'declaration.json'); return d.ok && listLinesOf(JSON.parse(d.text)).size > 0 ? tagOf('you') : LABEL_PICKED; } catch { return LABEL_PICKED; } })();
|
|
1902
1916
|
const rows = [];
|
|
1903
1917
|
const human = (r, attempt, extra) => ({
|
|
1904
1918
|
attempt, step: 'drafting', class: 'hitl', verdict: 'hitl', at: r.at ?? null, setup: true, blocked: false, action: 'human', tokensDisplay: { kind: 'no-model' }, ...extra,
|
|
@@ -1934,6 +1948,7 @@ export function getDraftBlock(flowDir, runDir) {
|
|
|
1934
1948
|
else if (r.kind === 'revise') happened.push(r.verdict === 'red' ? 'revise red' : `revising${retry(r)}`);
|
|
1935
1949
|
else if (r.kind === 'redraft') happened.push(r.verdict === 'red' ? 'redraft red' : `redrafting with your answers${retry(r)}`);
|
|
1936
1950
|
else if (r.kind === 'human') happened.push('your answer');
|
|
1951
|
+
else if (r.kind === 'rowedit') happened.push(r.op === 'drop' ? 'you dropped a check' : 'you added a check');
|
|
1937
1952
|
else if (r.kind === 'sign') happened.push(`signed (${r.signedBy ?? 'you'})`);
|
|
1938
1953
|
if (r.kind === 'card') {
|
|
1939
1954
|
const c = r.card && typeof r.card === 'object' ? r.card : {};
|
|
@@ -1942,7 +1957,9 @@ export function getDraftBlock(flowDir, runDir) {
|
|
|
1942
1957
|
rows.push(human(r, n, { action: 'card (you)', gap }));
|
|
1943
1958
|
} else if (r.kind === 'note') rows.push(human(r, n, { action: 'note (you)', gap: String(r.text ?? '') }));
|
|
1944
1959
|
// M10 am2 item 4: a question the page look raised and your answer, under the drafting step, in bareloop's words (`you were asked:` / `you said:`)
|
|
1945
|
-
else if (r.kind === 'human') rows.push(human(r, n, { action: `you were asked: ${panelQuestionText(r)}`, gap: `you said: ${r.answer}${r.source === 'look' && typeof r.rule === 'string' && r.rule !== '' ? ` ${
|
|
1960
|
+
else if (r.kind === 'human') rows.push(human(r, n, { action: `you were asked: ${panelQuestionText(r)}`, gap: `you said: ${r.answer}${r.source === 'look' && typeof r.rule === 'string' && r.rule !== '' ? ` ${youTag}` : ''}` }));
|
|
1961
|
+
// M16 item 5: a Drop or an Add on the card: a human row, $0, no model
|
|
1962
|
+
else if (r.kind === 'rowedit') rows.push(human(r, n, { action: r.op === 'drop' ? 'you dropped a check' : 'you added a check', gap: String(r.key ?? '') }));
|
|
1946
1963
|
else if (r.kind === 'draft') { rows.push(model(r, n, 'draft')); rows.push(...tryRows(r, n)); }
|
|
1947
1964
|
else if (r.kind === 'change') { rows.push(model(r, n, `change ${r.n}`)); rows.push(...tryRows(r, n)); }
|
|
1948
1965
|
else if (r.kind === 'startover') { rows.push(model(r, n, 'start over')); rows.push(...tryRows(r, n)); }
|
|
@@ -2018,7 +2035,7 @@ function attachFolds(groups, runDir, flowDir, { root, flow, catalogue }) {
|
|
|
2018
2035
|
* shared-sidecar contamination risk here the way bareloop's gate-audit
|
|
2019
2036
|
* sidecar had). `null` when the flow/runId doesn't resolve (404).
|
|
2020
2037
|
* @param {{root: string, flow: string, runId: string, scheduleRead?: (flow: string) => any, home?: string, catalogue?: any, resumeAttempt?: (flow: string, runId: string) => any, startingRun?: (flow: string, runId: string) => boolean, now?: () => number}} opts
|
|
2021
|
-
* @returns {{flow:string, runId:string, rows:any[], groups:any[], draft:ReturnType<typeof getDraftBlock>, learnings: any[], needsLeft: string|null, schedule: ReturnType<typeof scheduleAuditWords>, empty:boolean, why:string|null}|null}
|
|
2038
|
+
* @returns {{flow:string, runId:string, rows:any[], groups:any[], draft:ReturnType<typeof getDraftBlock>, auditChecks: ReturnType<typeof auditChecksOf>, learnings: any[], needsLeft: string|null, schedule: ReturnType<typeof scheduleAuditWords>, empty:boolean, why:string|null}|null}
|
|
2022
2039
|
*/
|
|
2023
2040
|
export function getRunAudit({
|
|
2024
2041
|
root, flow, runId, scheduleRead, home, catalogue, resumeAttempt, startingRun, now = Date.now,
|
|
@@ -2046,6 +2063,15 @@ export function getRunAudit({
|
|
|
2046
2063
|
// never a second, client-side re-grouping.
|
|
2047
2064
|
groups,
|
|
2048
2065
|
draft: getDraftBlock(run.flowDir, run.runDir),
|
|
2066
|
+
// M16 item 5 (hamr ruling A, 2026-11-13): the card's own sections - Checks, Not checked, Always checked - each row with its tag and, after the run, its recorded result; null for a plan with no list
|
|
2067
|
+
auditChecks: (() => {
|
|
2068
|
+
if (!catalogue) return null;
|
|
2069
|
+
const job = readRunJob({ root, name: flow, catalogue, runDir: run.runDir }).read;
|
|
2070
|
+
if (!job.ok) return null;
|
|
2071
|
+
const setup = readSetup(run.flowDir);
|
|
2072
|
+
const sign = setup.present ? setup.rows.findLast((/** @type {any} */ r) => r.kind === 'sign') : undefined;
|
|
2073
|
+
return auditChecksOf(job.declaration, readChecks(run.runDir), sign?.notChecked ?? null, { lines: job.lines, csvRoles: csvRolesOf(job.arbiter) });
|
|
2074
|
+
})(),
|
|
2049
2075
|
// M8 item 6: what the planner was told from earlier runs, READ-ONLY (borrowed-from: bareloop src/panel/server.js@v0.46.0:1854): the exact block as the run's record kept it, `hints` = the same text split
|
|
2050
2076
|
// into fields by learn.js's parseHintBlock (the one reader). Empty (no box) when the run was handed nothing: no record, or a run that reused its plan.
|
|
2051
2077
|
learnings: (() => { const rec = readLearningsRecord(run.runDir); return rec === null ? [] : [{ phase: rec.phase, text: rec.text, chars: rec.text.length, ids: rec.ids, hints: parseHintBlock(rec.text) }]; })(),
|
|
@@ -2082,16 +2108,19 @@ export function getRunAudit({
|
|
|
2082
2108
|
*/
|
|
2083
2109
|
function buildJobPlan(declaration, asks, flowDir, flowHash = null, jobLines = /** @type {any[]|undefined} */ (undefined), csvRoles = /** @type {string[]} */ ([])) {
|
|
2084
2110
|
const lines = checkedLines(declaration, { askLines: asks.map((x) => x.line), lines: jobLines, csvRoles });
|
|
2111
|
+
const onList = listLinesOf(declaration); // M16 P4c: a step on a list line carries its check rows apart (the page draws them under the job line, as bareloop's Job tab does)
|
|
2085
2112
|
const declSteps = Array.isArray(declaration?.steps) ? declaration.steps : [];
|
|
2086
2113
|
const steps = declSteps.map((st, i) => {
|
|
2087
2114
|
const ak = asks.find((x) => x.line === st.fromLine);
|
|
2115
|
+
const listRows = onList.has(st.fromLine) ? listPartRows(declaration, st).map((r) => ({ text: r.text, by: r.by })) : null;
|
|
2088
2116
|
return {
|
|
2089
2117
|
step: i + 1,
|
|
2090
2118
|
line: Number.isInteger(st.fromLine) ? st.fromLine : null,
|
|
2091
2119
|
reads: Array.isArray(st.reads) ? st.reads : [],
|
|
2092
2120
|
makes: typeof st.emits === 'string' ? st.emits : null,
|
|
2093
2121
|
mayDo: Array.isArray(st.primitives) ? st.primitives : [],
|
|
2094
|
-
check: lines[i].sentences,
|
|
2122
|
+
check: listRows ? lines[i].sentences.slice(0, lines[i].sentences.length - listRows.length) : lines[i].sentences,
|
|
2123
|
+
...(listRows ? { listRows } : {}),
|
|
2095
2124
|
checkClass: lines[i].class,
|
|
2096
2125
|
sheet: lines[i].sheet ?? null,
|
|
2097
2126
|
ask: !!ak,
|
|
@@ -2107,7 +2136,10 @@ function buildJobPlan(declaration, asks, flowDir, flowHash = null, jobLines = /*
|
|
|
2107
2136
|
const nc = ofThisJob ? signRow?.notChecked : undefined;
|
|
2108
2137
|
const recorded = !!nc && Array.isArray(nc.items);
|
|
2109
2138
|
const view = recorded ? notCheckedView(nc.items, declaration) : { items: [], readNotes: [] };
|
|
2110
|
-
return {
|
|
2139
|
+
return {
|
|
2140
|
+
steps, notChecked: { label: notCheckedLabelOf(declaration), items: view.items, readNotes: view.readNotes, recorded, ...(onList.size > 0 && nc?.by && typeof nc.by === 'object' ? { by: nc.by } : {}) },
|
|
2141
|
+
...(onList.size > 0 ? { always: [...EVERY_STEP_TEXTS] } : {}),
|
|
2142
|
+
};
|
|
2111
2143
|
}
|
|
2112
2144
|
|
|
2113
2145
|
/**
|
|
@@ -2343,8 +2375,8 @@ export function getJobGrid({
|
|
|
2343
2375
|
reason: g.glyph === '[–]' ? g.label.replace(/^skipped — ?/, '') || null : null,
|
|
2344
2376
|
});
|
|
2345
2377
|
}
|
|
2346
|
-
const sched =
|
|
2347
|
-
const from = sched &&
|
|
2378
|
+
const sched = newTicketScheduleOf(flowDir);
|
|
2379
|
+
const from = sched && typeof sched.from === 'string' ? sched.from : null;
|
|
2348
2380
|
const list = from !== null && ticketScheduleOf(flowDir, from) !== null ? getTicketList({
|
|
2349
2381
|
root, flow, runId: from, catalogue,
|
|
2350
2382
|
}) : null;
|
package/src/panel/index.html
CHANGED
|
@@ -478,6 +478,9 @@
|
|
|
478
478
|
.audit-group.audit-fold h4.audit-status-header::after{content:none;}
|
|
479
479
|
/* M8 item 6: bareloop's learnings box, copied (borrowed-from: bareloop src/panel/index.html@v0.47.1 417e80c, the learnings arrow only): a framed row, the header a full-width button with the arrow, chip and words inline; the arrow is the same ▶ / ▼ the other Audit folds draw (h4.audit-status-header::before), faint, a smaller gap on a phone */
|
|
480
480
|
.audit-part{border:1px solid var(--border);margin-bottom:6px;background:var(--panel2);}
|
|
481
|
+
/* borrowed-from: bareloop src/panel/index.html@v0.56.0 (3383cce) :181-182 */
|
|
482
|
+
.audit-caret{flex:none;color:var(--text-faint);margin-right:.6em;}
|
|
483
|
+
@media (max-width: 640px){ .audit-caret{margin-right:.2em;} }
|
|
481
484
|
.audit-part-toggle{width:100%;text-align:left;display:block;white-space:normal;min-height:44px;padding:8px 10px;}
|
|
482
485
|
.audit-part-toggle::before,.audit-part-toggle::after{content:"";}
|
|
483
486
|
.audit-part-toggle.audit-learn-fold::before{content:"\25B6 ";color:var(--text-faint);}
|
|
@@ -747,6 +750,30 @@
|
|
|
747
750
|
.chat-question .q-err{color:var(--red);}
|
|
748
751
|
.chat-extras{display:flex;flex-direction:column;gap:10px;margin-bottom:10px;}
|
|
749
752
|
.chat-extras:empty{display:none;}
|
|
753
|
+
/* M16 item 5: a row of the older blocks wears the tag of its kind */
|
|
754
|
+
.chat-extras .by{color:var(--text-faint);font-size:12px;}
|
|
755
|
+
/* M16 P4c: the plan view of bareloop's card and Job tab (borrowed-from: bareloop src/panel/index.html@v0.56.0 (3383cce) :680-701): job lines numbered, `~` rows under, checks and folds; only the marker is blue */
|
|
756
|
+
.jp{white-space:normal;font-size:13px;}
|
|
757
|
+
.jp-legend{font-size:12px;color:var(--text-faint);margin:0 0 8px;}
|
|
758
|
+
.jp-legend b,.jp .mk{color:var(--plan);font-weight:700;}
|
|
759
|
+
/* a wrapped job line hangs: its text lines up after the number, not under it (the signed mock's gutter shape) */
|
|
760
|
+
.jp .jl{margin-bottom:8px;overflow-wrap:anywhere;padding-left:30px;text-indent:-30px;}
|
|
761
|
+
.jp .jl .sub,.jp .jl .fold{padding-left:0;text-indent:0;}
|
|
762
|
+
.jp .num{display:inline-block;text-indent:0;width:22px;text-align:right;color:var(--text-faint);margin-right:8px;}
|
|
763
|
+
.jp .sub{color:var(--text-dim);padding-left:30px;}
|
|
764
|
+
.jp .fold{padding-left:30px;color:var(--text);}
|
|
765
|
+
/* who added a check: the drafter's [agent] or the person's own [you picked] in the dim of a ~ row */
|
|
766
|
+
.jp .by{color:var(--text-dim);white-space:nowrap;}
|
|
767
|
+
/* the confirm card's Drop / Add: wraps with its row, a comfortable touch target, no horizontal scroll at phone width */
|
|
768
|
+
.jp .jp-btn{margin:2px 0 2px 8px;padding:4px 12px;min-height:32px;font-size:inherit;}
|
|
769
|
+
.jp .fold{overflow-wrap:anywhere;}
|
|
770
|
+
.jp-sug .lbl{display:block;margin-top:6px;font-weight:700;}
|
|
771
|
+
.jp details.fold{padding-left:0;margin:6px 0;}
|
|
772
|
+
.jp details>summary{cursor:pointer;list-style:none;font-weight:700;}
|
|
773
|
+
.jp details>summary::-webkit-details-marker{display:none;}
|
|
774
|
+
.jp details>summary::before{content:"\203A";color:var(--plan);font-weight:700;margin-right:6px;}
|
|
775
|
+
.jp details[open]>summary::before{content:"\2304";}
|
|
776
|
+
.jp details ul{margin:4px 0 0;padding-left:26px;color:var(--text-dim);}
|
|
750
777
|
.msg.bot .who::before{content:"$ ";}
|
|
751
778
|
.msg .who{font-size:11px;color:var(--text-faint);margin-bottom:3px;text-transform:none;font-weight:400;}
|
|
752
779
|
/* the card's free-text boxes wrap (textarea): grow a few rows (fitBox), then scroll inside */
|
|
@@ -2691,15 +2718,18 @@
|
|
|
2691
2718
|
// M10b am2: what a job line that reads a sheet shows, drawn from the server's ONE block ({guardrails, checked: [{text, ...}], notChecked: [..] | "none"}): its
|
|
2692
2719
|
// guardrails, "Checked:" with one line per sheet check (name, plain words, covers), then "Not checked:" with the guardrails no check covers, or "none".
|
|
2693
2720
|
// Pure: the Chat plan card and the Job tab step rows both draw these strings; the server wrote every one of them.
|
|
2694
|
-
|
|
2721
|
+
// M16 am4: with `onList` the checks are drawn as rows of the list (tags, Drop) by the caller, so this draws the rest
|
|
2722
|
+
function sheetBlockLines(sheet, onList){
|
|
2695
2723
|
if(!sheet) return [];
|
|
2696
2724
|
var out = [];
|
|
2697
2725
|
if((sheet.guardrails || []).length){
|
|
2698
2726
|
out.push("Guardrails:");
|
|
2699
2727
|
sheet.guardrails.forEach(function(g){ out.push("- " + g); });
|
|
2700
2728
|
}
|
|
2701
|
-
|
|
2702
|
-
|
|
2729
|
+
if(!onList){
|
|
2730
|
+
out.push("Checked:");
|
|
2731
|
+
(sheet.checked || []).forEach(function(c){ out.push("- " + c.text); });
|
|
2732
|
+
}
|
|
2703
2733
|
if(sheet.notChecked === "none" || !(sheet.notChecked || []).length) out.push("Not checked: none");
|
|
2704
2734
|
else { out.push("Not checked:"); sheet.notChecked.forEach(function(g){ out.push("- " + g); }); }
|
|
2705
2735
|
return out;
|
|
@@ -3699,7 +3729,7 @@
|
|
|
3699
3729
|
};
|
|
3700
3730
|
if(out.known){
|
|
3701
3731
|
t.checks.forEach(function(c){
|
|
3702
|
-
var cell = { name: String(c.n), n: c.n, question: c.text, source: c.source, status: c.ok ? "pass" : "fail", number: c.ok && c.result ? c.result : null };
|
|
3732
|
+
var cell = { name: String(c.n), n: c.n, question: c.text + (c.by ? " " + tagWordOf(c.by) : ""), source: c.source, status: c.ok ? "pass" : "fail", number: c.ok && c.result ? c.result : null };
|
|
3703
3733
|
if(!c.ok && !out.red){
|
|
3704
3734
|
var lines = gridGapLines(t.gap);
|
|
3705
3735
|
out.red = { lines: lines.length ? lines : [c.text] };
|
|
@@ -4080,6 +4110,87 @@
|
|
|
4080
4110
|
wrap.appendChild(head); wrap.appendChild(list);
|
|
4081
4111
|
box.appendChild(wrap);
|
|
4082
4112
|
}
|
|
4113
|
+
// M16 item 5 (hamr ruling A, 2026-11-13): the card's own sections - Checks, Not checked, Always checked - each row with its tag and, after the run, its recorded result (server: `auditChecks`).
|
|
4114
|
+
// 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
|
|
4115
|
+
// 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
|
|
4116
|
+
function tagWordOf(by){ return by === "you" || by === "agent" || by === "default" ? "[" + by + "]" : ""; }
|
|
4117
|
+
function byTagOf(by){ return tagWordOf(by) === "" ? "" : ' <span class="by" data-testid="plan-by" data-by="' + by + '">' + tagWordOf(by) + '</span>'; }
|
|
4118
|
+
// 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.
|
|
4119
|
+
// `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.
|
|
4120
|
+
// 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)
|
|
4121
|
+
function planCheckRowHtml(name, cls, by, ctlHtml){
|
|
4122
|
+
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>";
|
|
4123
|
+
}
|
|
4124
|
+
function planFoldHtml(title, items, testid, byOf){
|
|
4125
|
+
if(!items || !items.length) return "";
|
|
4126
|
+
return '<details class="fold" data-testid="' + testid + '"><summary>' + escapeXml(title) + " \u00B7 " + items.length + "</summary><ul>" +
|
|
4127
|
+
items.map(function(x){ return "<li>" + escapeXml(x) + byTagOf(byOf(x)) + "</li>"; }).join("") + "</ul></details>";
|
|
4128
|
+
}
|
|
4129
|
+
function planViewHtml(plan, ctl){
|
|
4130
|
+
var hasCheck = (plan.lines || []).some(function(l){ return (l.checks || []).length; });
|
|
4131
|
+
var h = '<div class="jp" data-testid="job-plan">' + (hasCheck ? '<div class="jp-legend">Done when every <b>\u203A</b> check passes</div>' : "");
|
|
4132
|
+
(plan.lines || []).forEach(function(l){
|
|
4133
|
+
h += '<div class="jl" data-testid="plan-line"><span class="num">' + escapeXml(String(l.n)) + "</span>" + escapeXml(l.text);
|
|
4134
|
+
(l.rules || []).forEach(function(r){ h += '<div class="sub">~ ' + escapeXml(r) + "</div>"; });
|
|
4135
|
+
// fwdloop's own words under the line, plain grey after its `~` rows and before its checks: the line's lead sentence (src/checked.js) and a sheet line's block (hamr 2026-11-14)
|
|
4136
|
+
(l.leads || []).concat(l.extra || []).forEach(function(t){ h += '<div class="sub" data-testid="plan-lead">' + escapeXml(t) + "</div>"; });
|
|
4137
|
+
(l.checks || []).forEach(function(c){ h += planCheckRowHtml(c.name, c.cls, c.by, ctl && c.drop && c.key ? ctl("drop", c.key) : ""); });
|
|
4138
|
+
h += "</div>";
|
|
4139
|
+
});
|
|
4140
|
+
if((plan.suggested || []).length){
|
|
4141
|
+
h += '<div class="jl jp-sug" data-testid="plan-suggested"><span class="num"></span><span class="lbl">Suggested \u00B7 not in your job, not checked unless you add it</span>' + plan.suggested.map(function(x){
|
|
4142
|
+
return '<div class="fold" data-testid="plan-suggest-row"><span class="mk">\u203A</span> line ' + escapeXml(String(x.line)) + " \u00B7 " + escapeXml(x.text) + byTagOf("agent") + (x.dropped ? " (you dropped it)" : "") + (ctl ? ctl("add", x.key) : "") + "</div>";
|
|
4143
|
+
}).join("") + "</div>";
|
|
4144
|
+
}
|
|
4145
|
+
var ncBy = plan.notCheckedBy || {};
|
|
4146
|
+
h += planFoldHtml("Not checked", plan.notChecked, "plan-notchecked", function(x){ return ncBy[x]; });
|
|
4147
|
+
h += planFoldHtml("How the page was read", plan.readNotes, "plan-readnotes", function(){ return ""; });
|
|
4148
|
+
h += planFoldHtml("Always checked", plan.alwaysOn, "plan-alwayson", function(){ return "default"; });
|
|
4149
|
+
return h + "</div>";
|
|
4150
|
+
}
|
|
4151
|
+
function auditCheckRowHtml(r){
|
|
4152
|
+
var res = r.result === "passed" ? ["green", "passed"] : r.result === "failed" ? ["red", "failed"] : r.result === "not-checked" ? ["grey", "not checked"] : ["grey", "no result recorded"];
|
|
4153
|
+
return '<div class="audit-check-row" data-testid="audit-check-row" data-result="' + escapeXml(r.result) + '" style="overflow-wrap:anywhere;margin:2px 0">' + escapeXml(r.text) + byTagOf(r.by) + " " + stateDotHTML(res[0], res[1], "audit-check-state") + "</div>";
|
|
4154
|
+
}
|
|
4155
|
+
// 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)
|
|
4156
|
+
function auditChecksSignClass(rows){
|
|
4157
|
+
if(rows.some(function(r){ return r.result === "failed"; })) return glyphClass("[\u2717]");
|
|
4158
|
+
if(rows.some(function(r){ return r.result === "none"; })) return glyphClass("[\u00B7]");
|
|
4159
|
+
return glyphClass("[\u2713]");
|
|
4160
|
+
}
|
|
4161
|
+
// borrowed-from: bareloop src/panel/index.html@v0.56.0 (3383cce) :1358 (auditCaret)
|
|
4162
|
+
function auditCaret(open){ return '<span class="audit-caret">' + (open ? "\u25BC" : "\u25B6") + '</span>'; }
|
|
4163
|
+
function auditChecksEl(ac){
|
|
4164
|
+
var all = (ac.checks || []).concat(ac.always || []);
|
|
4165
|
+
var nPass = all.filter(function(r){ return r.result === "passed"; }).length;
|
|
4166
|
+
var nFail = all.filter(function(r){ return r.result === "failed"; }).length;
|
|
4167
|
+
var head = "checks \u00B7 " + nPass + " passed" + (nFail ? " \u00B7 " + nFail + " failed" : "") + ((ac.notChecked || []).length ? " \u00B7 " + ac.notChecked.length + " not checked" : "");
|
|
4168
|
+
var wrap = document.createElement("div");
|
|
4169
|
+
wrap.className = "audit-part";
|
|
4170
|
+
wrap.setAttribute("data-testid", "audit-checks-group");
|
|
4171
|
+
var btn = document.createElement("button");
|
|
4172
|
+
btn.type = "button";
|
|
4173
|
+
btn.className = "btn audit-part-toggle";
|
|
4174
|
+
btn.setAttribute("aria-expanded", "false");
|
|
4175
|
+
btn.setAttribute("data-testid", "audit-checks-toggle");
|
|
4176
|
+
// P4c: bareloop's header: the caret span, the state sign, the words (re-drawn on each toggle)
|
|
4177
|
+
var headHtml = function(open){ return auditCaret(open) + stateDotHTML(auditChecksSignClass(all), "", "audit-checks-state") + escapeXml(head); };
|
|
4178
|
+
btn.innerHTML = headHtml(false);
|
|
4179
|
+
var body = document.createElement("div");
|
|
4180
|
+
body.className = "audit-part-body";
|
|
4181
|
+
body.hidden = true;
|
|
4182
|
+
body.setAttribute("data-testid", "audit-checks-body");
|
|
4183
|
+
var sec = function(title, rows, tid){
|
|
4184
|
+
if(!rows || !rows.length) return "";
|
|
4185
|
+
return '<div data-testid="' + tid + '" style="margin:6px 0"><div><b>' + escapeXml(title) + "</b></div>" + rows.map(auditCheckRowHtml).join("") + "</div>";
|
|
4186
|
+
};
|
|
4187
|
+
body.innerHTML = '<div class="jp">' + sec("Checks", ac.checks, "audit-checks-checks") + sec("Not checked", ac.notChecked, "audit-checks-notchecked") + sec("Always checked", ac.always, "audit-checks-always") + "</div>";
|
|
4188
|
+
function paint(open){ body.hidden = !open; btn.setAttribute("aria-expanded", open ? "true" : "false"); btn.innerHTML = headHtml(open); }
|
|
4189
|
+
btn.addEventListener("click", function(){ var open = body.hidden; auditExpanded["\u0000checks"] = open; paint(open); });
|
|
4190
|
+
if(auditExpanded["\u0000checks"] === true) paint(true);
|
|
4191
|
+
wrap.appendChild(btn); wrap.appendChild(body);
|
|
4192
|
+
return wrap;
|
|
4193
|
+
}
|
|
4083
4194
|
function renderAuditGroups(result){
|
|
4084
4195
|
var runKey = currentFlow + "/" + currentRunId;
|
|
4085
4196
|
if(auditExpandedRun !== runKey){ auditExpanded = {}; auditExpandedRun = runKey; }
|
|
@@ -4129,6 +4240,9 @@
|
|
|
4129
4240
|
container.appendChild(nrow);
|
|
4130
4241
|
anyVisible = true;
|
|
4131
4242
|
}
|
|
4243
|
+
// hamr ruling A (2026-11-13): the card's own sections, one of the Audit's groups, after the schedule and the Needs-you line and before the step groups (bareloop v0.56.0 renderAuditGroups order)
|
|
4244
|
+
var ac = result.auditChecks;
|
|
4245
|
+
if(ac && ((ac.checks || []).length || (ac.notChecked || []).length || (ac.always || []).length)) container.appendChild(auditChecksEl(ac));
|
|
4132
4246
|
var groups = (draftG ? [draftG] : []).concat(result.empty ? [] : (result.groups || []));
|
|
4133
4247
|
groups.forEach(function(g){
|
|
4134
4248
|
var rows = (g.rows || []).filter(auditRowMatchesFilter);
|
|
@@ -4329,11 +4443,15 @@
|
|
|
4329
4443
|
fold.appendChild(textDiv("plan-row", "reads: " + ((st.reads || []).length ? st.reads.join(", ") : "nothing")));
|
|
4330
4444
|
fold.appendChild(textDiv("plan-row", "makes: " + (st.makes || "unknown")));
|
|
4331
4445
|
fold.appendChild(textDiv("plan-row", "may do: " + ((st.mayDo || []).length ? st.mayDo.join(", ") : "nothing (pure stop)")));
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
else
|
|
4335
|
-
|
|
4336
|
-
|
|
4446
|
+
if(st.ask) fold.appendChild(textDiv("plan-row", "check: ASK · waits " + plainWait(st.waitMs)));
|
|
4447
|
+
// P4c: a plan with a list shows the lead sentence and the sheet block under its job line, not in the fold
|
|
4448
|
+
else if(!(job.plan && job.plan.always)){
|
|
4449
|
+
// M10 am11: each check sentence is its own row
|
|
4450
|
+
if(!(st.check || []).length) fold.appendChild(textDiv("plan-row", "check: "));
|
|
4451
|
+
else st.check.forEach(function(s){ fold.appendChild(textDiv("plan-row", "check: " + s)); });
|
|
4452
|
+
// M10b am2: a step that reads a sheet shows its line's block under the check sentence
|
|
4453
|
+
sheetBlockLines(st.sheet).forEach(function(t){ fold.appendChild(textDiv("plan-row", t)); });
|
|
4454
|
+
}
|
|
4337
4455
|
return fold;
|
|
4338
4456
|
}
|
|
4339
4457
|
// 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).
|
|
@@ -4344,6 +4462,15 @@
|
|
|
4344
4462
|
tail.innerHTML = "";
|
|
4345
4463
|
(plan.steps || []).filter(function(st){ return !placed[st.step]; }).forEach(function(st){ tail.appendChild(jobStepFold(st, job)); });
|
|
4346
4464
|
var nc = plan.notChecked || {};
|
|
4465
|
+
// M16 P4c: a plan with a list draws bareloop's three folds (Not checked, How the page was read, Always checked), each line tagged
|
|
4466
|
+
if(plan.always && nc.recorded){
|
|
4467
|
+
var jpFolds = document.createElement("div");
|
|
4468
|
+
jpFolds.className = "jp";
|
|
4469
|
+
var ncBy = nc.by || {};
|
|
4470
|
+
jpFolds.innerHTML = planFoldHtml("Not checked", nc.items, "plan-notchecked", function(x){ return ncBy[x]; }) + planFoldHtml("How the page was read", nc.readNotes, "plan-readnotes", function(){ return ""; }) + planFoldHtml("Always checked", plan.always, "plan-alwayson", function(){ return "default"; });
|
|
4471
|
+
tail.appendChild(jpFolds);
|
|
4472
|
+
return;
|
|
4473
|
+
}
|
|
4347
4474
|
var fold = document.createElement("details");
|
|
4348
4475
|
fold.className = "plan-fold plan-notchecked";
|
|
4349
4476
|
var sum = document.createElement("summary");
|
|
@@ -4400,6 +4527,14 @@
|
|
|
4400
4527
|
(job.sends || []).filter(function(sd){ return sd.line === l.line; }).forEach(function(sd){
|
|
4401
4528
|
cell.appendChild(textDiv("ro-value sub", "~ writes out to " + (sd.target || "unknown")));
|
|
4402
4529
|
});
|
|
4530
|
+
// 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
|
|
4531
|
+
// the line's lead sentence and a sheet block draw as plain grey lines first (hamr 2026-11-14), then the rows
|
|
4532
|
+
var listRowsHtml = "";
|
|
4533
|
+
((job.plan && job.plan.steps) || []).filter(function(st){ return st.line === l.line; }).forEach(function(st){
|
|
4534
|
+
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>"; });
|
|
4535
|
+
(st.listRows || []).forEach(function(r){ listRowsHtml += planCheckRowHtml(r.text, "", r.by, ""); });
|
|
4536
|
+
});
|
|
4537
|
+
if(listRowsHtml){ var jpRows = document.createElement("div"); jpRows.className = "jp"; jpRows.innerHTML = listRowsHtml; cell.appendChild(jpRows); }
|
|
4403
4538
|
((job.plan && job.plan.steps) || []).filter(function(st){ return st.line === l.line; }).forEach(function(st){
|
|
4404
4539
|
placed[st.step] = true;
|
|
4405
4540
|
cell.appendChild(jobStepFold(st, job));
|
|
@@ -5802,6 +5937,22 @@
|
|
|
5802
5937
|
question: q.question, agree: false, drop: false
|
|
5803
5938
|
};
|
|
5804
5939
|
}
|
|
5940
|
+
// 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
|
|
5941
|
+
function planOfState(state, list){
|
|
5942
|
+
var nc = state.notChecked || {};
|
|
5943
|
+
var plan = {lines: [], suggested: list.suggested || [], notChecked: nc.items || [], notCheckedBy: nc.by && typeof nc.by === "object" ? nc.by : {}, readNotes: nc.readNotes || [], alwaysOn: state.always || []};
|
|
5944
|
+
(state.planLines || []).forEach(function(pl){
|
|
5945
|
+
var l = {n: pl.n, text: pl.text, rules: pl.rules || [], leads: [], checks: [], extra: []};
|
|
5946
|
+
state.checked.forEach(function(c){
|
|
5947
|
+
if(c.line !== pl.n) return;
|
|
5948
|
+
if(c.sentences.length) l.leads.push(c.sentences[0]);
|
|
5949
|
+
sheetBlockLines(c.sheet, true).forEach(function(t){ l.extra.push(t); });
|
|
5950
|
+
});
|
|
5951
|
+
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}); });
|
|
5952
|
+
plan.lines.push(l);
|
|
5953
|
+
});
|
|
5954
|
+
return plan;
|
|
5955
|
+
}
|
|
5805
5956
|
// pure: what sits beside a green plan: Your answers (only when the plan was drafted with some), Checked (the machine's sentences from the
|
|
5806
5957
|
// typed checks) and Not checked (the drafter's own list, ALWAYS with its label), or null when there is no plan to show
|
|
5807
5958
|
function extrasFor(state){
|
|
@@ -5812,6 +5963,12 @@
|
|
|
5812
5963
|
return "line " + a.line + (a.lineText ? ": " + a.lineText : "") + "\n > " + a.answer;
|
|
5813
5964
|
})});
|
|
5814
5965
|
}
|
|
5966
|
+
// M16 P4c: a plan with a list draws bareloop's plan view (lines, checks with their tags, Suggested, the folds) in one bubble, from the card the draft saved (server: state.list, planLines, always)
|
|
5967
|
+
var list = state.list && Array.isArray(state.list.rows) ? state.list : null;
|
|
5968
|
+
if(list){
|
|
5969
|
+
blocks.push({id: "chat-plan", plan: planOfState(state, list)});
|
|
5970
|
+
return {blocks: blocks};
|
|
5971
|
+
}
|
|
5815
5972
|
// M10 am11: each check sentence is its own line (the step's label leads its first; the rest sit under it)
|
|
5816
5973
|
var checkedLines = [];
|
|
5817
5974
|
state.checked.forEach(function(c){
|
|
@@ -5819,11 +5976,12 @@
|
|
|
5819
5976
|
checkedLines.push(i === 0 ? (c.line !== null && c.line !== undefined ? "line " + c.line : "step " + c.step) + ": " + s : " " + s);
|
|
5820
5977
|
});
|
|
5821
5978
|
// M10b am2: a line that reads a sheet: its guardrails, Checked (name, words, covers), Not checked
|
|
5822
|
-
sheetBlockLines(c.sheet).forEach(function(t){ checkedLines.push(" " + t); });
|
|
5979
|
+
sheetBlockLines(c.sheet, false).forEach(function(t){ checkedLines.push(" " + t); });
|
|
5823
5980
|
});
|
|
5824
5981
|
blocks.push({id: "chat-checked", head: "Checked", sub: "built by the machine from the plan's checks", lines: checkedLines});
|
|
5825
5982
|
var nc = state.notChecked || {};
|
|
5826
|
-
|
|
5983
|
+
var ncBy = nc.by && typeof nc.by === "object" ? nc.by : {};
|
|
5984
|
+
blocks.push({id: "chat-notchecked", head: nc.label || "", sub: "", lines: (nc.items && nc.items.length) ? nc.items.map(function(x){ return ncBy[x] ? {text: "- " + x, by: ncBy[x], op: "", key: ""} : "- " + x; }) : ["The drafter listed nothing."]});
|
|
5827
5985
|
// M10 am11: code's notes about written forms it did not use are their own list, after Not checked (none = no block)
|
|
5828
5986
|
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; })});
|
|
5829
5987
|
return {blocks: blocks};
|
|
@@ -6665,13 +6823,23 @@
|
|
|
6665
6823
|
qAnswer.value = ""; qError.textContent = "";
|
|
6666
6824
|
}
|
|
6667
6825
|
}
|
|
6826
|
+
// one line of a block: plain text, or a row with its tag
|
|
6827
|
+
function extraLineHTML(l){
|
|
6828
|
+
if(typeof l === "string") return escapeXml(l);
|
|
6829
|
+
return escapeXml(l.text) + byTagOf(l.by);
|
|
6830
|
+
}
|
|
6831
|
+
// the Drop / Add button of the plan view (bareloop's control; the click is handled once on the extras box)
|
|
6832
|
+
function planControlHTML(op, key){
|
|
6833
|
+
return ' <button type="button" class="btn jp-btn" data-testid="plan-' + op + '" data-rowop="' + op + '" data-rowkey="' + escapeXml(key) + '">' + (op === "add" ? "Add" : "Drop") + "</button>";
|
|
6834
|
+
}
|
|
6668
6835
|
// Your answers / Checked / Not checked; a plan being drafted again leaves them on show (like the plan), anything else without a green plan clears them
|
|
6669
6836
|
function renderExtras(state){
|
|
6670
6837
|
if(state && (state.phase === "revising" || state.phase === "redrafting")) return;
|
|
6671
6838
|
var v = extrasFor(state);
|
|
6672
6839
|
var html = v ? v.blocks.map(function(b){
|
|
6673
|
-
|
|
6674
|
-
(b.sub ? ' <span class="hint">(' + escapeXml(b.sub) + ')</span>' : '') + (b.lines.length ? '\n' + b.lines.map(
|
|
6840
|
+
var inner = b.plan ? '<div class="who">fwdloop</div>' + planViewHtml(b.plan, planControlHTML)
|
|
6841
|
+
: '<b class="readout-head">' + escapeXml(b.head) + '</b>' + (b.sub ? ' <span class="hint">(' + escapeXml(b.sub) + ')</span>' : '') + (b.lines.length ? '\n' + b.lines.map(extraLineHTML).join("\n") : '');
|
|
6842
|
+
return '<div class="msg' + (b.plan ? ' bot' : '') + '" id="' + b.id + '" data-testid="' + b.id + '">' + inner + '</div>';
|
|
6675
6843
|
}).join("") : "";
|
|
6676
6844
|
if(html !== extrasKey){ extrasKey = html; extrasEl.innerHTML = html; }
|
|
6677
6845
|
}
|
|
@@ -6858,6 +7026,27 @@
|
|
|
6858
7026
|
|
|
6859
7027
|
// Send (amendments 24/25): the answer to the question now open. A blank answer is refused by the server in plain words and the question stays open.
|
|
6860
7028
|
// M10 am29: a choice button posts its own choice and nothing else; the box's button posts the box's words as a new rule (choice "rule"), never read as agree or drop it
|
|
7029
|
+
// Drop / Add (M16 item 5): $0, no AI call. The server writes a new plan; a sign click on the old one is cleared (its hash is not the plan's now)
|
|
7030
|
+
var rowBusy = false;
|
|
7031
|
+
function doRowEdit(btn){
|
|
7032
|
+
if(rowBusy || !sessionId || !lastState || lastState.phase !== "green") return;
|
|
7033
|
+
rowBusy = true;
|
|
7034
|
+
var id = sessionId;
|
|
7035
|
+
var all = extrasEl.querySelectorAll("button[data-rowop]");
|
|
7036
|
+
for(var i = 0; i < all.length; i++) all[i].disabled = true;
|
|
7037
|
+
authorPost("/api/author/" + id + "/row-edit", {op: btn.getAttribute("data-rowop"), key: btn.getAttribute("data-rowkey")}).then(function(r){
|
|
7038
|
+
rowBusy = false;
|
|
7039
|
+
if(id !== sessionId) return;
|
|
7040
|
+
if(!(r.status >= 200 && r.status < 300 && r.body && r.body.ok === true)){ chatActionFailed(refusalText(r)); for(var j = 0; j < all.length; j++) all[j].disabled = false; return; }
|
|
7041
|
+
chatActionOk();
|
|
7042
|
+
signInfo = null; signClickedOnce = false;
|
|
7043
|
+
poll();
|
|
7044
|
+
}).catch(function(){ rowBusy = false; for(var j = 0; j < all.length; j++) all[j].disabled = false; chatActionFailed(NETWORK_SAY); });
|
|
7045
|
+
}
|
|
7046
|
+
extrasEl.addEventListener("click", function(ev){
|
|
7047
|
+
var t = ev.target && ev.target.closest ? ev.target.closest("button[data-rowop]") : null;
|
|
7048
|
+
if(t && extrasEl.contains(t)) doRowEdit(t);
|
|
7049
|
+
});
|
|
6861
7050
|
function doAnswer(choice){
|
|
6862
7051
|
if(qBusy || !sessionId || !lastState || lastState.phase !== "questions-open") return;
|
|
6863
7052
|
qBusy = true; qSend.disabled = true; qAgree.disabled = true; qDrop.disabled = true; qError.textContent = "";
|
package/src/panel/result.js
CHANGED
|
@@ -14,7 +14,7 @@ import { basename, join } from 'node:path';
|
|
|
14
14
|
import { readFileInside } from '../flow.js';
|
|
15
15
|
import { isCellsPath } from '../closers.js';
|
|
16
16
|
import { readAcceptedHashesByEmits } from '../ask.js';
|
|
17
|
-
import {
|
|
17
|
+
import { notCheckedLabelOf } from '../checked.js';
|
|
18
18
|
import { checkSendDestination, readArtifactResult } from '../runner.js';
|
|
19
19
|
import { flowTypeOf } from '../declaration.js';
|
|
20
20
|
import { isAgree, readingOfQuestion } from '../pageask.js';
|
|
@@ -23,6 +23,7 @@ import { readLineSection, LINE_CHECKS_FILE } from '../line-checks.js';
|
|
|
23
23
|
import { readChecks } from '../diary.js';
|
|
24
24
|
import { sheetLineBlocks, csvRolesOf } from '../sheetblock.js';
|
|
25
25
|
import { readSheetChecks } from '../sheet-record.js';
|
|
26
|
+
import { tagged } from '../checkwords.js';
|
|
26
27
|
|
|
27
28
|
/** the two sentences for a saved file that is no longer what the run wrote (code-owned, one spelling) */
|
|
28
29
|
export const RESULT_FILE_GONE = 'the saved file is gone';
|
|
@@ -218,7 +219,7 @@ function checksOfLine(stepsOfLine, diary) {
|
|
|
218
219
|
for (const st of stepsOfLine) {
|
|
219
220
|
const rows = diary.filter((r) => r && r.step === st.emits && isInt(r.try) && Array.isArray(r.checks));
|
|
220
221
|
const newest = rows.reduce((m, r) => (m === null || r.try >= m.try ? r : m), null);
|
|
221
|
-
for (const c of newest ? newest.checks : []) if (c && isStr(c.text) && typeof c.ok === 'boolean') out.push({ ok: c.ok, text: c.text, result: isStr(c.result) ? c.result : null });
|
|
222
|
+
for (const c of newest ? newest.checks : []) if (c && isStr(c.text) && typeof c.ok === 'boolean') out.push({ ok: c.ok, text: c.by === 'you' || c.by === 'agent' || c.by === 'default' ? tagged(c.text, c.by) : c.text, result: isStr(c.result) ? c.result : null }); // hamr 2026-11-14: a check the plan's list built carries the tag of its row
|
|
222
223
|
}
|
|
223
224
|
return out;
|
|
224
225
|
}
|
|
@@ -293,7 +294,7 @@ export function buildResult({
|
|
|
293
294
|
}
|
|
294
295
|
const pages = [...new Set(urls.values())];
|
|
295
296
|
return {
|
|
296
|
-
flow, runId, lines, pages, pageNote: pages.length ? RESULT_PAGE_MAY_CHANGE : null, notCheckedLabel:
|
|
297
|
+
flow, runId, lines, pages, pageNote: pages.length ? RESULT_PAGE_MAY_CHANGE : null, notCheckedLabel: ((l) => l.charAt(0).toUpperCase() + l.slice(1))(notCheckedLabelOf(declaration)), notChecked, readNotes, delivered, gap,
|
|
297
298
|
door: door === null ? null : { head: RESULT_DOOR_HEAD, ask: RESULT_DOOR_ASK, askId: door.askId, draftNo: door.draftNo },
|
|
298
299
|
};
|
|
299
300
|
}
|
package/src/panel/server.js
CHANGED
|
@@ -343,7 +343,7 @@ function resumeRoute(res, body, root, resumer) {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
/**
|
|
346
|
-
* `POST /api/author/{draft,run,trigger-prepare,trigger,resume-prepare,resume,<id>/sign-prepare,<id>/sign,<id>/revise,<id>/answer,<id>/abandon,start/<id>/clear}` — run after the same gates as every other POST.
|
|
346
|
+
* `POST /api/author/{draft,run,trigger-prepare,trigger,resume-prepare,resume,<id>/sign-prepare,<id>/sign,<id>/revise,<id>/answer,<id>/row-edit,<id>/abandon,start/<id>/clear}` — run after the same gates as every other POST.
|
|
347
347
|
* Anything else under `/api/author/` is a 404 by name.
|
|
348
348
|
* @param {any} res @param {string} url @param {any} body @param {ReturnType<typeof createAuthor>} author
|
|
349
349
|
*/
|
|
@@ -363,6 +363,8 @@ function authorPost(res, url, body, author) {
|
|
|
363
363
|
if (sg) { send(author.sign(sg[1], body)); return; }
|
|
364
364
|
const rv = /^\/api\/author\/([^/]+)\/revise$/.exec(url);
|
|
365
365
|
if (rv) { send(author.revise(rv[1], body)); return; }
|
|
366
|
+
const re = /^\/api\/author\/([^/]+)\/row-edit$/.exec(url);
|
|
367
|
+
if (re) { send(author.rowEdit(re[1], body)); return; }
|
|
366
368
|
const an = /^\/api\/author\/([^/]+)\/answer$/.exec(url);
|
|
367
369
|
if (an) { send(author.answer(an[1], body)); return; }
|
|
368
370
|
const sc = /^\/api\/author\/start\/([^/]+)\/clear$/.exec(url);
|
package/src/pickrecord.js
CHANGED
|
@@ -142,5 +142,33 @@ export function readRecordFile(file) {
|
|
|
142
142
|
} catch { return null; }
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
// borrowed-from: bareloop src/pickrecord.js@v0.56.0 (3383cce) (readRowChoices; read through readFileInside; writeRecordPart not taken, see the M16 p1 report)
|
|
146
|
+
/**
|
|
147
|
+
* The Drop/Add choices a draft's person made on the confirm card (hamr 2026-11-13, N-2), carried the same way as the picks: tied to the line's words and the row's own name, never to a number.
|
|
148
|
+
* @param {string} file @returns {{lineWords: string, occurrence: number, tail: string, choice: string}[]|null}
|
|
149
|
+
*/
|
|
150
|
+
export function readRowChoices(file) {
|
|
151
|
+
try {
|
|
152
|
+
const g = readFileInside(path.dirname(file), path.basename(file));
|
|
153
|
+
if (!g.ok) return null;
|
|
154
|
+
const j = JSON.parse(g.text);
|
|
155
|
+
return Array.isArray(j?.rowChoices) ? j.rowChoices.filter((/** @type {any} */ e) => e && typeof e.lineWords === 'string' && Number.isInteger(e.occurrence) && typeof e.tail === 'string' && (e.choice === 'drop' || e.choice === 'add')) : null;
|
|
156
|
+
} catch { return null; }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 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}`;
|
|
161
|
+
* the next draft drops a new check with the same id again. Read through readFileInside; a missing or unreadable record is no record.
|
|
162
|
+
* @param {string} file @returns {{key: string, line: number, index: number, check: Record<string, any>, text: string}[]|null}
|
|
163
|
+
*/
|
|
164
|
+
export function readSheetDropped(file) {
|
|
165
|
+
try {
|
|
166
|
+
const g = readFileInside(path.dirname(file), path.basename(file));
|
|
167
|
+
if (!g.ok) return null;
|
|
168
|
+
const j = JSON.parse(g.text);
|
|
169
|
+
return Array.isArray(j?.sheetDropped) ? j.sheetDropped.filter((/** @type {any} */ d) => d && typeof d.key === 'string' && Number.isInteger(d.line) && d.check && typeof d.check === 'object' && !Array.isArray(d.check)) : null;
|
|
170
|
+
} catch { return null; }
|
|
171
|
+
}
|
|
172
|
+
|
|
145
173
|
/** where a plan folder keeps its record @param {string} planDir */
|
|
146
174
|
export const recordPath = (planDir) => path.join(planDir, RECORD_FILE);
|