fwdloop 0.22.0 → 0.24.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 +31 -8
- package/package.json +2 -2
- package/src/ask.js +34 -4
- package/src/attemptdiff.js +118 -0
- package/src/audit-fold.js +2 -0
- package/src/authoring.js +36 -2
- package/src/canrun.js +5 -0
- package/src/checked.js +14 -3
- package/src/citedcheck.js +16 -1
- package/src/citedwords.js +36 -2
- package/src/closers.js +13 -223
- package/src/config.js +5 -1
- package/src/csv.js +69 -12
- package/src/declaration.js +64 -6
- package/src/drafter.js +43 -17
- package/src/flowmodel.js +56 -1
- package/src/learn.js +952 -0
- package/src/learnstore.js +346 -0
- package/src/model-step.js +15 -21
- package/src/pagedry.js +3 -4
- package/src/pagefetch.js +9 -2
- package/src/pagerules.js +28 -5
- package/src/panel/author.js +2 -1
- package/src/panel/authorcard.js +9 -2
- package/src/panel/data.js +80 -17
- package/src/panel/index.html +186 -12
- package/src/panel/result.js +6 -0
- package/src/redact.js +6 -6
- package/src/runner.js +151 -24
- package/src/sheet-record.js +57 -0
- package/src/sheetblock.js +170 -0
- package/src/sheetchecks.js +206 -0
- package/src/sheetclaims.js +78 -0
- package/src/sheetoffer.js +125 -0
- package/src/sheetrun.js +105 -0
- package/src/thinking.js +11 -0
- package/src/try-checks.js +6 -0
- package/src/types.js +1 -9
- package/types/ask.d.ts +8 -2
- package/types/attemptdiff.d.ts +38 -0
- package/types/checked.d.ts +9 -3
- package/types/citedwords.d.ts +14 -0
- package/types/closers.d.ts +6 -31
- package/types/csv.d.ts +25 -4
- package/types/declaration.d.ts +6 -1
- package/types/drafter.d.ts +28 -9
- package/types/flowmodel.d.ts +36 -0
- package/types/learn.d.ts +576 -0
- package/types/learnstore.d.ts +168 -0
- package/types/model-step.d.ts +19 -30
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorcard.d.ts +2 -1
- package/types/panel/data.d.ts +2 -1
- package/types/panel/result.d.ts +1 -1
- package/types/runner.d.ts +19 -6
- package/types/sheet-record.d.ts +24 -0
- package/types/sheetblock.d.ts +116 -0
- package/types/sheetchecks.d.ts +70 -0
- package/types/sheetclaims.d.ts +26 -0
- package/types/sheetoffer.d.ts +25 -0
- package/types/sheetrun.d.ts +35 -0
- package/types/thinking.d.ts +11 -0
- package/types/types.d.ts +16 -11
package/src/panel/data.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from 'node:fs';
|
|
25
25
|
import { createHash } from 'node:crypto';
|
|
26
26
|
import { plainPlanCheck } from '../plain-checks.js';
|
|
27
|
-
import { join,
|
|
27
|
+
import { join, sep } from 'node:path';
|
|
28
28
|
|
|
29
29
|
import {
|
|
30
30
|
readFlow, readPlan, readRunPlan, readRunJobCopy, listFlowNames, listRunIds, resolveRunDir, checkFlowName, readFileInside, readdirInside,
|
|
@@ -38,14 +38,17 @@ import {
|
|
|
38
38
|
import { readSpendRows } from '../provider.js';
|
|
39
39
|
import { applyRunValues, parseWaitMs, pickRunValues, VALUES_FILE_RE } from '../runvalues.js';
|
|
40
40
|
import { readSetup } from '../setup.js';
|
|
41
|
+
import { parseHintBlock } from '../learn.js';
|
|
41
42
|
import { checkedLines, notCheckedView, NOT_CHECKED_LABEL } from '../checked.js';
|
|
43
|
+
import { csvRolesOf, askSheetCard } from '../sheetblock.js';
|
|
44
|
+
import { readSheetChecks } from '../sheet-record.js';
|
|
42
45
|
import {
|
|
43
46
|
NO_COPY_SAY, catchUpWords, endedLineWords, endedWords, needsLeftWords, nextInWords, nextTimeWords, scheduleAuditWords, scheduleBlockWords, scheduleFieldWords, scheduledNextFor, scheduledWords, startedWords,
|
|
44
47
|
} from '../summary-words.js';
|
|
45
48
|
import { MAX_STRUCTURE_RETRIES } from '../drafter.js';
|
|
46
|
-
import { isResultRun, checkTypeOf, buildResult, downloadOf } from './result.js';
|
|
49
|
+
import { isResultRun, checkTypeOf, buildResult, downloadOf, readCitedChecks } from './result.js';
|
|
47
50
|
import { thinkingRuleWords, thinkingTryWords } from '../thinking.js';
|
|
48
|
-
import { readRunThinking } from '../flowmodel.js';
|
|
51
|
+
import { readRunThinking, readLearningsRecord } from '../flowmodel.js';
|
|
49
52
|
import {
|
|
50
53
|
isTryRow, loadDiaries, deriveFold, cardLine, summaryLines,
|
|
51
54
|
} from '../audit-fold.js';
|
|
@@ -1284,14 +1287,27 @@ export function needsYouOf({
|
|
|
1284
1287
|
}
|
|
1285
1288
|
|
|
1286
1289
|
/**
|
|
1287
|
-
* M11
|
|
1290
|
+
* M11 am22: the ONE read of "does this run offer Reopen": the first of its asks `reopenOffer` (the Ask tab's own rule) says yes to, else null.
|
|
1291
|
+
* The Run tab's `reopen`, Needs you's Reopen tag (`reopenableAt`) and the Ask tab's per-ask `reopen` all come from `reopenOffer`, never a second rule.
|
|
1288
1292
|
* @param {string} runDir @param {any} ctx `loadRunContext`'s result
|
|
1293
|
+
* @returns {{askId: string, waitMs: number, late: boolean, why: string}|null}
|
|
1289
1294
|
*/
|
|
1290
|
-
function
|
|
1295
|
+
function runReopenOffer(runDir, ctx) {
|
|
1291
1296
|
if (ctx.historyRow || !ctx.askJson) return null;
|
|
1292
1297
|
const savedAskId = readSavedAnswer(runDir)?.askId;
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1298
|
+
for (const a of runAsksInOrder(runDir, false)) {
|
|
1299
|
+
const offer = reopenOffer(a, ctx.askJson, ctx.resume, savedAskId === a.askId);
|
|
1300
|
+
if (offer !== null) return { askId: a.askId, ...offer };
|
|
1301
|
+
}
|
|
1302
|
+
return null;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* M11 am11 item 2: the expiry time of this run's ask when it has expired and can still be reopened (the Ask tab's own `reopenOffer` rule), else null.
|
|
1307
|
+
* @param {string} runDir @param {any} ctx `loadRunContext`'s result
|
|
1308
|
+
*/
|
|
1309
|
+
function reopenableAt(runDir, ctx) {
|
|
1310
|
+
return runReopenOffer(runDir, ctx) !== null && typeof ctx.askJson.expiresAt === 'string' ? ctx.askJson.expiresAt : null;
|
|
1295
1311
|
}
|
|
1296
1312
|
|
|
1297
1313
|
/**
|
|
@@ -1766,6 +1782,8 @@ export function getRunDetail({
|
|
|
1766
1782
|
signWords: SIGN_WORDS,
|
|
1767
1783
|
pulse: glyphPulses({ glyph, label }),
|
|
1768
1784
|
controls: runControls(ctx, glyph, label),
|
|
1785
|
+
// M11 am22: the Run tab's Reopen, the Ask tab's own `reopenOffer` answer (`{askId, waitMs, late, why}`), or null
|
|
1786
|
+
reopen: runReopenOffer(run.runDir, ctx),
|
|
1769
1787
|
// M11 am11 item 3: where this run stands in Needs you now; the page shows Remove from Needs you only when `removable`
|
|
1770
1788
|
needsYou: (({ tag, removable }) => ({ tag, removable }))(needsYouOf({
|
|
1771
1789
|
runDir: run.runDir, ctx, glyph, controls: runControls(ctx, glyph, label), nowMs: now(), reopenAt: reopenableAt(run.runDir, ctx),
|
|
@@ -1965,7 +1983,7 @@ function attachFolds(groups, runDir, flowDir, { root, flow, catalogue }) {
|
|
|
1965
1983
|
* shared-sidecar contamination risk here the way bareloop's gate-audit
|
|
1966
1984
|
* sidecar had). `null` when the flow/runId doesn't resolve (404).
|
|
1967
1985
|
* @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
|
|
1968
|
-
* @returns {{flow:string, runId:string, rows:any[], groups:any[], draft:ReturnType<typeof getDraftBlock>, needsLeft: string|null, schedule: ReturnType<typeof scheduleAuditWords>, empty:boolean, why:string|null}|null}
|
|
1986
|
+
* @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}
|
|
1969
1987
|
*/
|
|
1970
1988
|
export function getRunAudit({
|
|
1971
1989
|
root, flow, runId, scheduleRead, home, catalogue, resumeAttempt, startingRun, now = Date.now,
|
|
@@ -1993,6 +2011,9 @@ export function getRunAudit({
|
|
|
1993
2011
|
// never a second, client-side re-grouping.
|
|
1994
2012
|
groups,
|
|
1995
2013
|
draft: getDraftBlock(run.flowDir, run.runDir),
|
|
2014
|
+
// 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
|
|
2015
|
+
// 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.
|
|
2016
|
+
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) }]; })(),
|
|
1996
2017
|
// M11 am11 items 3-4: the one row that says why the card left Needs you (by your Remove, or after 7 days); words: src/summary-words.js
|
|
1997
2018
|
needsLeft: catalogue ? needsLeftWords(getRunNeeds({
|
|
1998
2019
|
root, flow, runId, catalogue, nowMs: now(), resumeAttempt,
|
|
@@ -2024,8 +2045,8 @@ export function getRunAudit({
|
|
|
2024
2045
|
* M6: a sign row that names another signing than the job being shown (`flowHash`) is not this job's record: `recorded:false`, never the new job's words.
|
|
2025
2046
|
* @param {any} declaration @param {Array<{line:number, ttlMs?:number}>} asks @param {string} flowDir @param {string|null} [flowHash] the signature hash of the job being shown
|
|
2026
2047
|
*/
|
|
2027
|
-
function buildJobPlan(declaration, asks, flowDir, flowHash = null) {
|
|
2028
|
-
const lines = checkedLines(declaration, { askLines: asks.map((x) => x.line) });
|
|
2048
|
+
function buildJobPlan(declaration, asks, flowDir, flowHash = null, jobLines = /** @type {any[]|undefined} */ (undefined), csvRoles = /** @type {string[]} */ ([])) {
|
|
2049
|
+
const lines = checkedLines(declaration, { askLines: asks.map((x) => x.line), lines: jobLines, csvRoles });
|
|
2029
2050
|
const declSteps = Array.isArray(declaration?.steps) ? declaration.steps : [];
|
|
2030
2051
|
const steps = declSteps.map((st, i) => {
|
|
2031
2052
|
const ak = asks.find((x) => x.line === st.fromLine);
|
|
@@ -2037,6 +2058,7 @@ function buildJobPlan(declaration, asks, flowDir, flowHash = null) {
|
|
|
2037
2058
|
mayDo: Array.isArray(st.primitives) ? st.primitives : [],
|
|
2038
2059
|
check: lines[i].sentences,
|
|
2039
2060
|
checkClass: lines[i].class,
|
|
2061
|
+
sheet: lines[i].sheet ?? null,
|
|
2040
2062
|
ask: !!ak,
|
|
2041
2063
|
waitMs: ak && typeof ak.ttlMs === 'number' ? ak.ttlMs : null,
|
|
2042
2064
|
};
|
|
@@ -2132,11 +2154,10 @@ export function getRunJob({
|
|
|
2132
2154
|
asks: asks.map((ak) => ({ line: ak.line, question: ak.question, waitMs: ak.ttlMs })),
|
|
2133
2155
|
capUsd: typeof a.capUsd === 'number' ? a.capUsd : null,
|
|
2134
2156
|
redoCap: typeof a.redoCap === 'number' ? a.redoCap : null,
|
|
2135
|
-
// review #5: "
|
|
2136
|
-
//
|
|
2137
|
-
// "to be safe" instruction).
|
|
2157
|
+
// review #5: "Inputs" — role -> the full signed path (a web address
|
|
2158
|
+
// shows its address), by hamr 2026-10-24.
|
|
2138
2159
|
sources: sources.map((s) => ({
|
|
2139
|
-
role: s.role, kind: s.kind, path: s.path,
|
|
2160
|
+
role: s.role, kind: s.kind, path: s.path,
|
|
2140
2161
|
})),
|
|
2141
2162
|
// review #5: "Destination" — one row per send.
|
|
2142
2163
|
sends: sends.map((s) => ({ line: s.line, kind: s.target?.kind ?? null, target: s.target?.path ?? null })),
|
|
@@ -2146,7 +2167,7 @@ export function getRunJob({
|
|
|
2146
2167
|
guardrails: flowRead.lines
|
|
2147
2168
|
.filter((l) => typeof l.guardrail === 'string' && l.guardrail.length > 0)
|
|
2148
2169
|
.map((l) => ({ line: l.n, guardrail: l.guardrail })),
|
|
2149
|
-
plan: buildJobPlan(flowRead.declaration, asks, run.flowDir, typeof sig?.flow === 'string' ? sig.flow : null),
|
|
2170
|
+
plan: buildJobPlan(flowRead.declaration, asks, run.flowDir, typeof sig?.flow === 'string' ? sig.flow : null, flowRead.lines, csvRolesOf(a)),
|
|
2150
2171
|
signature: (sig && typeof sig.signedBy === 'string' && typeof sig.signedAt === 'string' && typeof sig.flow === 'string')
|
|
2151
2172
|
? { signedBy: sig.signedBy, signedAt: sig.signedAt, hash: sig.flow }
|
|
2152
2173
|
: null,
|
|
@@ -2199,7 +2220,7 @@ export function getRunResult({
|
|
|
2199
2220
|
if (!got) return null;
|
|
2200
2221
|
const { run, ctx } = got;
|
|
2201
2222
|
const sig = ctx.flowRead.signature;
|
|
2202
|
-
const plan = buildJobPlan(ctx.flowRead.declaration, ctx.arbiter.asks ?? [], run.flowDir, typeof sig?.flow === 'string' ? sig.flow : null);
|
|
2223
|
+
const plan = buildJobPlan(ctx.flowRead.declaration, ctx.arbiter.asks ?? [], run.flowDir, typeof sig?.flow === 'string' ? sig.flow : null, ctx.flowRead.lines, csvRolesOf(ctx.arbiter));
|
|
2203
2224
|
return buildResult({
|
|
2204
2225
|
flow, runId, runDir: run.runDir, root, flowRead: ctx.flowRead, arbiter: ctx.arbiter, historyRow: ctx.historyRow, auditRows: ctx.auditRows, logJson: ctx.logJson, notChecked: plan.notChecked.items, readNotes: plan.notChecked.readNotes,
|
|
2205
2226
|
setupRows: (() => { const st = readSetup(run.flowDir); return st.present ? st.rows : []; })(),
|
|
@@ -2337,6 +2358,8 @@ function flattenEvidence(evidence) {
|
|
|
2337
2358
|
draft: evidence.draft ? evidence.draft.text : null,
|
|
2338
2359
|
unjudged: evidence.unjudged,
|
|
2339
2360
|
why: evidence.why,
|
|
2361
|
+
...(evidence.claims ? { claims: evidence.claims } : {}),
|
|
2362
|
+
...(evidence.results ? { results: evidence.results } : {}),
|
|
2340
2363
|
};
|
|
2341
2364
|
}
|
|
2342
2365
|
|
|
@@ -2633,6 +2656,28 @@ export function groupAskBlocks(asks) {
|
|
|
2633
2656
|
});
|
|
2634
2657
|
}
|
|
2635
2658
|
|
|
2659
|
+
/**
|
|
2660
|
+
* The Result tab's facts line for the results an ask carries (`{quote, values}` each). The run's cited-check record (src/panel/result.js `readCitedChecks`) is the
|
|
2661
|
+
* source when one of its lines holds exactly these quotes: its facts, cells and proof are drawn. Without one (an old run, a record that does not read), the line is
|
|
2662
|
+
* built from the ask's own values: one fact per value name, no proof, never a guess.
|
|
2663
|
+
* @param {{quote: string, values: Record<string, unknown>}[]} results @param {ReturnType<typeof readCitedChecks>|null} record
|
|
2664
|
+
* @returns {{kind: 'facts', passed: boolean, facts: any[], rows: any[]}}
|
|
2665
|
+
*/
|
|
2666
|
+
function citedLineOfResults(results, record) {
|
|
2667
|
+
const quotes = results.map((r) => r.quote);
|
|
2668
|
+
const line = record && record.present && record.ok
|
|
2669
|
+
? record.lines.find((l) => l.rows && l.rows.length === quotes.length && l.rows.every((w, i) => w.quote === quotes[i]))
|
|
2670
|
+
: undefined;
|
|
2671
|
+
if (line) return { kind: 'facts', passed: line.passed, facts: line.facts, rows: line.rows };
|
|
2672
|
+
const names = [...new Set(results.flatMap((r) => Object.keys(r.values)))];
|
|
2673
|
+
return {
|
|
2674
|
+
kind: 'facts',
|
|
2675
|
+
passed: false,
|
|
2676
|
+
facts: names.map((name) => ({ name, kind: 'value', sentence: `fact · ${name}` })),
|
|
2677
|
+
rows: results.map((r, i) => ({ n: i + 1, quote: r.quote, cells: names.map((k) => (r.values[k] === undefined ? '' : String(r.values[k]))) })),
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2636
2681
|
/**
|
|
2637
2682
|
* `GET /api/runs/:flow/:runId/asks` — the Ask tab (M4a-1 scope item 1):
|
|
2638
2683
|
* every ask this run's books can name, in order, each carrying full
|
|
@@ -2686,7 +2731,25 @@ export function getRunAsks({
|
|
|
2686
2731
|
}
|
|
2687
2732
|
}
|
|
2688
2733
|
const openAskJson = hasHistoryRow ? null : readAsk(run.runDir);
|
|
2689
|
-
|
|
2734
|
+
// M10b am4: an ask whose evidence is a sheet step's claim boxes carries that step's block and answer (the Result tab's block), and loses the "unrecognised shape" line
|
|
2735
|
+
const sheetRecord = ordered.some((a) => a.evidence?.claims) ? readSheetChecks(run.runDir) : null;
|
|
2736
|
+
const sheetArbiter = flowRead.ok ? flowRead.arbiter : null;
|
|
2737
|
+
const withSheet = (/** @type {any} */ ask) => {
|
|
2738
|
+
const { claims, ...ev } = ask.evidence ?? {};
|
|
2739
|
+
if (!claims) return ask;
|
|
2740
|
+
const card = flowRead.ok ? askSheetCard({ claims, declaration: flowRead.declaration, lines: flowRead.lines, csvRoles: csvRolesOf(sheetArbiter), record: sheetRecord }) : null;
|
|
2741
|
+
if (card === null) return { ...ask, evidence: ev };
|
|
2742
|
+
const { why: _gone, ...rest } = ev;
|
|
2743
|
+
return { ...ask, evidence: { ...rest, sheet: card } };
|
|
2744
|
+
};
|
|
2745
|
+
// a cited step's ask: its results drawn by the Result tab's own line (the run's cited-check record, matched by the quotes; else the quotes and values alone)
|
|
2746
|
+
const cited = ordered.some((a) => a.evidence?.results) ? readCitedChecks(run.runDir) : null;
|
|
2747
|
+
const withCited = (/** @type {any} */ ask) => {
|
|
2748
|
+
const { results, ...ev } = ask.evidence ?? {};
|
|
2749
|
+
if (!results) return ask;
|
|
2750
|
+
return { ...ask, evidence: { ...ev, cited: citedLineOfResults(results, cited) } };
|
|
2751
|
+
};
|
|
2752
|
+
const asks = ordered.map(withSheet).map(withCited).map((ask, i) => ({
|
|
2690
2753
|
...ask,
|
|
2691
2754
|
...deriveAskOpenFields(ask, hasHistoryRow, resume),
|
|
2692
2755
|
reopen: reopenOffer(ask, openAskJson, resume, readSavedAnswer(run.runDir)?.askId === ask.askId),
|
package/src/panel/index.html
CHANGED
|
@@ -170,6 +170,7 @@
|
|
|
170
170
|
/* the Run tab's top action row (Stop, Resume) */
|
|
171
171
|
.run-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:8px;}
|
|
172
172
|
.run-actions .answer-msg{margin-top:0;flex:1 1 100%;}
|
|
173
|
+
.run-actions .hint{margin-top:0;flex:1 1 100%;overflow-wrap:anywhere;}
|
|
173
174
|
/* M4c: only the two "alive" signs pulse — [▶] running and [·] waiting on
|
|
174
175
|
you — keyed to `.pulse`, which the server decides (glyphPulses), never to
|
|
175
176
|
a colour class (.grey is also the placeholder dot). A gentle opacity wave on the existing colors;
|
|
@@ -436,6 +437,11 @@
|
|
|
436
437
|
.audit-group.audit-fold h4.audit-status-header::before{content:"\25B6 ";color:var(--text-faint);}
|
|
437
438
|
.audit-group.audit-fold h4.audit-status-header[aria-expanded="true"]::before{content:"\25BC ";}
|
|
438
439
|
.audit-group.audit-fold h4.audit-status-header::after{content:none;}
|
|
440
|
+
/* M8 item 6: bareloop's learnings box, copied (borrowed-from: bareloop src/panel/index.html@v0.46.0 :421-424): a framed row, the header a full-width button with the chip and words inline, no arrow */
|
|
441
|
+
.audit-part{border:1px solid var(--border);margin-bottom:6px;background:var(--panel2);}
|
|
442
|
+
.audit-part-toggle{width:100%;text-align:left;display:block;white-space:normal;min-height:44px;padding:8px 10px;}
|
|
443
|
+
.audit-part-toggle::before,.audit-part-toggle::after{content:"";}
|
|
444
|
+
.audit-part-body{padding:8px 10px 10px;border-top:1px dotted var(--border-strong);}
|
|
439
445
|
@media (max-width: 640px){
|
|
440
446
|
/* (l) a phone: the name is the only thing that shrinks — drop the dots and the word "try", tighten the gaps */
|
|
441
447
|
.audit-group.audit-fold{padding-left:8px;padding-right:8px;}
|
|
@@ -522,7 +528,7 @@
|
|
|
522
528
|
┤ ├ pips — those are reserved for a whole-box title, not an in-flow
|
|
523
529
|
line) so it reads as a clear, bold heading without a second border. */
|
|
524
530
|
.ask-question-heading{margin:6px 0 0;font-size:13px;font-weight:700;color:var(--text);}
|
|
525
|
-
.ro-value{padding:6px 8px;min-height:32px;box-sizing:border-box;border:1px solid var(--border);background:var(--bg);color:var(--text-dim);}
|
|
531
|
+
.ro-value{padding:6px 8px;min-height:32px;box-sizing:border-box;border:1px solid var(--border);background:var(--bg);color:var(--text-dim);overflow-wrap:anywhere;}
|
|
526
532
|
.art-head{color:var(--accent);}
|
|
527
533
|
.ro-value.sub{margin-left:20px;min-height:0;padding-top:2px;padding-bottom:2px;border-top-width:0;overflow-wrap:anywhere;}
|
|
528
534
|
/* M4e amendment 37 (changes 34's layout): the Job tab is ONE column at every width. Each signed line, its ~ rows, then its step(s) folded under it:
|
|
@@ -746,6 +752,11 @@
|
|
|
746
752
|
.audit-group table.rounds-table tbody{display:table-row-group;}
|
|
747
753
|
.audit-group table.rounds-table tr{display:table-row;padding:0;overflow:visible;}
|
|
748
754
|
.audit-group table.rounds-table td{display:table-cell;padding:4px 6px;white-space:normal;overflow-wrap:anywhere;border-right:1px dotted var(--border);}
|
|
755
|
+
/* M8 item 6: a hint's table fits the box and wraps (as bareloop's does at 320), it does not scroll sideways */
|
|
756
|
+
.audit-part table.learn-hint{display:table;width:100%;min-width:0;max-width:100%;}
|
|
757
|
+
.audit-part table.learn-hint tbody{display:table-row-group;}
|
|
758
|
+
.audit-part table.learn-hint tr{display:table-row;padding:0;}
|
|
759
|
+
.audit-part table.learn-hint td{display:table-cell;padding:4px 6px;white-space:normal;overflow-wrap:anywhere;}
|
|
749
760
|
}
|
|
750
761
|
|
|
751
762
|
/* M4d piece 4: the Settings view (a sibling of #main-view, opened from the header). Layout borrowed from bareloop:
|
|
@@ -1263,6 +1274,7 @@
|
|
|
1263
1274
|
</div>
|
|
1264
1275
|
</div>
|
|
1265
1276
|
<div id="audit-filter-empty" class="hint" data-testid="audit-filter-empty" hidden style="padding:12px 0;"></div>
|
|
1277
|
+
<div id="audit-learnings" data-testid="audit-learnings" hidden></div>
|
|
1266
1278
|
<div id="audit-groups" data-testid="audit-groups"></div>
|
|
1267
1279
|
<div class="audit-table-scroll" id="audit-flat-wrap" hidden>
|
|
1268
1280
|
<table data-testid="audit-table">
|
|
@@ -1307,7 +1319,7 @@
|
|
|
1307
1319
|
<div class="field"><label>Ask</label><div id="details-asks"></div></div>
|
|
1308
1320
|
<div class="field"><label>Destination</label><div id="details-sends"></div></div>
|
|
1309
1321
|
<div class="field"><label>$ cap</label><div class="ro-value" id="details-cap">—</div></div>
|
|
1310
|
-
<div class="field"><label>
|
|
1322
|
+
<div class="field"><label>Inputs</label><div id="details-sources"></div></div>
|
|
1311
1323
|
<div class="field"><label>Signed</label><div class="ro-value" id="details-signature">—</div></div>
|
|
1312
1324
|
<div class="plan-legend" data-testid="plan-legend"><span class="plan-mark">›</span> = the approved plan</div>
|
|
1313
1325
|
</div>
|
|
@@ -2413,6 +2425,37 @@
|
|
|
2413
2425
|
var note = file && file.judged && file.note ? '<div class="hint" data-testid="result-judged-note">' + escapeXml(file.note) + '</div>' : "";
|
|
2414
2426
|
return note + (file && file.judged && file.words ? '<div class="rs-warn" data-testid="result-file-words">' + escapeXml(file.words) + '</div>' : "");
|
|
2415
2427
|
}
|
|
2428
|
+
// M10b am2: what a job line that reads a sheet shows, drawn from the server's ONE block ({guardrails, checked: [{text, ...}], notChecked: [..] | "none"}): its
|
|
2429
|
+
// guardrails, "Checked:" with one line per sheet check (name, plain words, covers), then "Not checked:" with the guardrails no check covers, or "none".
|
|
2430
|
+
// Pure: the Chat plan card and the Job tab step rows both draw these strings; the server wrote every one of them.
|
|
2431
|
+
function sheetBlockLines(sheet){
|
|
2432
|
+
if(!sheet) return [];
|
|
2433
|
+
var out = [];
|
|
2434
|
+
if((sheet.guardrails || []).length){
|
|
2435
|
+
out.push("Guardrails:");
|
|
2436
|
+
sheet.guardrails.forEach(function(g){ out.push("- " + g); });
|
|
2437
|
+
}
|
|
2438
|
+
out.push("Checked:");
|
|
2439
|
+
(sheet.checked || []).forEach(function(c){ out.push("- " + c.text); });
|
|
2440
|
+
if(sheet.notChecked === "none" || !(sheet.notChecked || []).length) out.push("Not checked: none");
|
|
2441
|
+
else { out.push("Not checked:"); sheet.notChecked.forEach(function(g){ out.push("- " + g); }); }
|
|
2442
|
+
return out;
|
|
2443
|
+
}
|
|
2444
|
+
// the Result tab's drawing of the same block, after the run: each check carries \u2713 or \u2717 and what was found (the server's `found`), then its plain words and
|
|
2445
|
+
// covers; "Not checked" again. A check with no verdict (the run never reached it) draws with no mark. Every string is escaped.
|
|
2446
|
+
function resultSheetBlock(sheet){
|
|
2447
|
+
if(!sheet) return "";
|
|
2448
|
+
var rows = (sheet.checked || []).map(function(c){
|
|
2449
|
+
var mark = c.ok === true ? '<span class="rs-ok">\u2713</span> ' : (c.ok === false ? '<span class="rs-bad">\u2717</span> ' : "");
|
|
2450
|
+
var more = [c.words, c.coversWords].filter(function(x){ return x; }).join(" \u00b7 ");
|
|
2451
|
+
return '<div data-testid="result-sheet-check">' + mark + escapeXml(typeof c.found === "string" ? c.found : c.name) +
|
|
2452
|
+
(more ? ' <span class="hint">' + escapeXml(more) + '</span>' : "") + '</div>';
|
|
2453
|
+
}).join("");
|
|
2454
|
+
var nc = sheet.notChecked === "none" || !(sheet.notChecked || []).length ? "none" : null;
|
|
2455
|
+
return resultField("Checked", '<div class="ro-value" data-testid="result-sheet-checked">' + rows + '</div>') +
|
|
2456
|
+
resultField("Not checked", nc !== null ? '<div class="ro-value" data-testid="result-sheet-notchecked">none</div>' :
|
|
2457
|
+
'<div class="ro-value" data-testid="result-sheet-notchecked"><ul style="margin:0;padding-left:18px">' + sheet.notChecked.map(function(t){ return '<li>' + escapeXml(t) + '</li>'; }).join("") + '</ul></div>');
|
|
2458
|
+
}
|
|
2416
2459
|
function resultField(label, inner){
|
|
2417
2460
|
return '<div class="field"><label>' + escapeXml(label) + '</label>' + inner + '</div>';
|
|
2418
2461
|
}
|
|
@@ -2497,7 +2540,7 @@
|
|
|
2497
2540
|
function resultLineCard(line, own, note){
|
|
2498
2541
|
return '<div class="job-card" data-testid="result-line"><h4>Line ' + escapeXml(String(line.n)) + '</h4>' + resultLineBox(line) +
|
|
2499
2542
|
(own ? resultPageLink(line.page, note, "result-page-line") : "") +
|
|
2500
|
-
(line.kind === "facts" ? resultFactsLine(line) : resultTextLine(line)) + resultChecksList(line) +
|
|
2543
|
+
(line.kind === "facts" ? resultFactsLine(line) : resultTextLine(line)) + (line.sheet ? resultSheetBlock(line.sheet) : resultChecksList(line)) +
|
|
2501
2544
|
resultNotChecked("Not checked", line.notChecked, "result-line-notchecked") + '</div>';
|
|
2502
2545
|
}
|
|
2503
2546
|
function renderResult(){
|
|
@@ -2751,8 +2794,11 @@
|
|
|
2751
2794
|
el.appendChild(makeButton("Resume", "run-resume", function(){ if(window.fwdloopOpenResume) window.fwdloopOpenResume(detail); }));
|
|
2752
2795
|
}
|
|
2753
2796
|
else if(c.noCopySay){ var nc = document.createElement("div"); nc.className = "answer-msg refused"; nc.setAttribute("data-testid", "run-no-copy-say"); nc.textContent = c.noCopySay; el.appendChild(nc); }
|
|
2797
|
+
// M11 am22: Reopen is also here, from the server's `detail.reopen` (the Ask tab's own `reopenOffer` answer); the click is the Ask tab's `sendReopen`, the line its why
|
|
2798
|
+
if(detail.reopen) el.appendChild(makeButton("Reopen for another " + waitText(detail.reopen.waitMs), "run-reopen", function(){ sendReopen(el, detail, detail.reopen.askId); }));
|
|
2754
2799
|
// M11 am11 item 3: a stopped / stuck run in Needs you can leave it; the Run tab's own button, shown only when the server says it is removable
|
|
2755
2800
|
if(detail.needsYou && detail.needsYou.removable) el.appendChild(makeRemoveNeedsButton(detail.flow, detail.runId, function(){ return reloadRun(detail.flow, detail.runId); }));
|
|
2801
|
+
if(detail.reopen) el.appendChild(textDiv("hint", detail.reopen.why));
|
|
2756
2802
|
if(stopSay){ var m = document.createElement("div"); m.className = "answer-msg refused"; m.setAttribute("data-testid", "run-stop-say"); m.textContent = stopSay.text; el.appendChild(m); }
|
|
2757
2803
|
el.hidden = el.children.length === 0;
|
|
2758
2804
|
}
|
|
@@ -3177,7 +3223,7 @@
|
|
|
3177
3223
|
if(testId) e.setAttribute("data-testid", testId);
|
|
3178
3224
|
return e;
|
|
3179
3225
|
}
|
|
3180
|
-
function foldTryEl(t, human){
|
|
3226
|
+
function foldTryEl(t, human, stepKey){
|
|
3181
3227
|
var wrap = document.createElement("div");
|
|
3182
3228
|
var line = foldEl("div", "audit-try", null, "audit-try-line");
|
|
3183
3229
|
line.appendChild(document.createTextNode("try " + t.n + " "));
|
|
@@ -3187,6 +3233,21 @@
|
|
|
3187
3233
|
: [t.thinking, t.gap];
|
|
3188
3234
|
rest.forEach(function(x){ if(x) line.appendChild(document.createTextNode(" \u00b7 " + x)); });
|
|
3189
3235
|
wrap.appendChild(line);
|
|
3236
|
+
// M8 am7 item 4: this try was handed the earlier runs' block - one line, a click opens the exact text (the learnings box's own fold classes); hidden when nothing was handed
|
|
3237
|
+
if(!human && t.hints && t.hints.text){
|
|
3238
|
+
var hk = "\u0000hints:" + stepKey + ":" + t.n;
|
|
3239
|
+
var hpart = foldEl("div", "audit-part", null, "audit-try-hints");
|
|
3240
|
+
var hhead = foldEl("button", "btn audit-part-toggle", "told from earlier runs \u00B7 " + t.hints.n + (t.hints.n === 1 ? " hint" : " hints"), "audit-try-hints-head");
|
|
3241
|
+
hhead.type = "button";
|
|
3242
|
+
var hbody = foldEl("div", "audit-part-body", null, "audit-try-hints-text");
|
|
3243
|
+
hbody.style.cssText = "white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0";
|
|
3244
|
+
hbody.textContent = t.hints.text;
|
|
3245
|
+
var paintHints = function(open){ hbody.hidden = !open; hhead.setAttribute("aria-expanded", open ? "true" : "false"); };
|
|
3246
|
+
paintHints(auditExpanded[hk] === true);
|
|
3247
|
+
hhead.addEventListener("click", function(ev){ ev.stopPropagation(); var open = hbody.hidden; auditExpanded[hk] = open; paintHints(open); });
|
|
3248
|
+
hpart.appendChild(hhead); hpart.appendChild(hbody);
|
|
3249
|
+
wrap.appendChild(hpart);
|
|
3250
|
+
}
|
|
3190
3251
|
if(!human && t.checks && t.checks.length){
|
|
3191
3252
|
var box = foldEl("div", "audit-checks", null, "audit-checks");
|
|
3192
3253
|
t.checks.forEach(function(c){
|
|
@@ -3249,12 +3310,94 @@
|
|
|
3249
3310
|
var f = g.fold, human = f.who === "human";
|
|
3250
3311
|
var body = foldEl("div", "audit-fold-body", null, "audit-fold-body-" + g.step);
|
|
3251
3312
|
if(f.tally) body.appendChild(foldEl("div", "audit-tally", f.tally, "audit-tally"));
|
|
3252
|
-
(f.tries || []).forEach(function(t){ body.appendChild(foldTryEl(t, human)); });
|
|
3313
|
+
(f.tries || []).forEach(function(t){ body.appendChild(foldTryEl(t, human, g.step)); });
|
|
3253
3314
|
body.appendChild(foldRoundsEl(g));
|
|
3254
3315
|
return body;
|
|
3255
3316
|
}
|
|
3256
3317
|
var auditExpanded = {}; // step -> true/false once a human toggled it; reset when the run changes
|
|
3257
3318
|
var auditExpandedRun = null;
|
|
3319
|
+
// M8 item 6: cross-run learnings, READ-ONLY: what the drafter was handed from earlier runs. ONE fold at the top of the Audit tab, in both views, hidden when the run was handed nothing.
|
|
3320
|
+
// borrowed-from: bareloop src/panel/index.html@v0.46.0 :2843-2931 (learnRow, learnHintLabel, renderAuditLearnings), drawn in fwdloop's own fold (the schedule section's header and body shape)
|
|
3321
|
+
// instead of bareloop's .audit-part button. The fields come from the server (learn.js parseHintBlock, the one reader of the block) - this page never splits the prose. No edit, no button but the fold.
|
|
3322
|
+
function learnRow(tbody, testid, label, lines){
|
|
3323
|
+
var tr = document.createElement("tr");
|
|
3324
|
+
tr.setAttribute("data-testid", testid);
|
|
3325
|
+
var lab = document.createElement("td");
|
|
3326
|
+
lab.className = "hint";
|
|
3327
|
+
lab.style.cssText = "white-space:nowrap";
|
|
3328
|
+
lab.textContent = label;
|
|
3329
|
+
var val = document.createElement("td");
|
|
3330
|
+
val.style.cssText = "overflow-wrap:anywhere;white-space:pre-wrap";
|
|
3331
|
+
val.textContent = lines.join("\n");
|
|
3332
|
+
tr.appendChild(lab);
|
|
3333
|
+
tr.appendChild(val);
|
|
3334
|
+
tbody.appendChild(tr);
|
|
3335
|
+
}
|
|
3336
|
+
function learnHintLabel(h){
|
|
3337
|
+
var bits = [h.n, h.level, "seen " + h.count + (h.count === 1 ? " time" : " times")];
|
|
3338
|
+
if(h.check) bits.push(h.check);
|
|
3339
|
+
if(h.kinds && h.kinds.length) bits.push(h.kinds.join(", "));
|
|
3340
|
+
bits.push(h.fixed ? "fixed" : "never fixed");
|
|
3341
|
+
return bits.join(" \u00B7 ");
|
|
3342
|
+
}
|
|
3343
|
+
function renderAuditLearnings(result){
|
|
3344
|
+
var box = document.getElementById("audit-learnings");
|
|
3345
|
+
box.innerHTML = "";
|
|
3346
|
+
var items = result && Array.isArray(result.learnings) ? result.learnings : [];
|
|
3347
|
+
box.hidden = items.length === 0;
|
|
3348
|
+
if(items.length === 0) return;
|
|
3349
|
+
var it = items[0];
|
|
3350
|
+
var hints = Array.isArray(it.hints) ? it.hints : [];
|
|
3351
|
+
var count = Array.isArray(it.ids) ? it.ids.length : hints.length;
|
|
3352
|
+
var wrap = document.createElement("div");
|
|
3353
|
+
wrap.className = "audit-part";
|
|
3354
|
+
wrap.setAttribute("data-testid", "audit-group-learnings");
|
|
3355
|
+
var head = document.createElement("button");
|
|
3356
|
+
head.type = "button";
|
|
3357
|
+
head.className = "btn audit-part-toggle";
|
|
3358
|
+
head.setAttribute("aria-expanded", "false");
|
|
3359
|
+
head.setAttribute("data-testid", "audit-learnings-head");
|
|
3360
|
+
var label = "What the planner was told from earlier runs \u00B7 " + count + (count === 1 ? " hint" : " hints");
|
|
3361
|
+
head.innerHTML = stateDotHTML(glyphClass("[\u2713]"), "learnings", "audit-learnings-state") + " " + escapeXml(label);
|
|
3362
|
+
var list = document.createElement("div");
|
|
3363
|
+
list.className = "audit-part-body";
|
|
3364
|
+
list.setAttribute("data-testid", "audit-learnings-list");
|
|
3365
|
+
list.hidden = true;
|
|
3366
|
+
var note = document.createElement("div");
|
|
3367
|
+
note.className = "hint";
|
|
3368
|
+
note.style.cssText = "margin:6px 0;overflow-wrap:anywhere;";
|
|
3369
|
+
note.textContent = "Read-only. Given to the planner at the draft (" + Number(it.chars).toLocaleString("en-US") + " characters). No worker sees it.";
|
|
3370
|
+
list.appendChild(note);
|
|
3371
|
+
hints.forEach(function(h){
|
|
3372
|
+
var hint = document.createElement("div");
|
|
3373
|
+
hint.className = "audit-table-scroll";
|
|
3374
|
+
hint.setAttribute("data-testid", "audit-learnings-hint-" + it.phase + "-" + h.n);
|
|
3375
|
+
var table = document.createElement("table");
|
|
3376
|
+
table.className = "rounds-table learn-hint";
|
|
3377
|
+
var tbody = document.createElement("tbody");
|
|
3378
|
+
var trT = document.createElement("tr");
|
|
3379
|
+
var title = document.createElement("td");
|
|
3380
|
+
title.setAttribute("colspan", "2");
|
|
3381
|
+
title.style.cssText = "font-weight:600;overflow-wrap:anywhere";
|
|
3382
|
+
title.setAttribute("data-testid", "audit-learnings-hint-" + it.phase + "-" + h.n + "-title");
|
|
3383
|
+
title.textContent = learnHintLabel(h);
|
|
3384
|
+
trT.appendChild(title);
|
|
3385
|
+
tbody.appendChild(trT);
|
|
3386
|
+
var t = "audit-learnings-hint-" + it.phase + "-" + h.n + "-";
|
|
3387
|
+
if(h.said) learnRow(tbody, t + "said", "It said:", [h.said]);
|
|
3388
|
+
if(h.touched) learnRow(tbody, t + "touched", "Fix touched:", [h.touched]);
|
|
3389
|
+
if(h.changed && h.changed.length) learnRow(tbody, t + "changed", "What changed:", h.changed.concat(h.moreChanged ? ["(+" + h.moreChanged + " more)"] : []));
|
|
3390
|
+
table.appendChild(tbody);
|
|
3391
|
+
hint.appendChild(table);
|
|
3392
|
+
list.appendChild(hint);
|
|
3393
|
+
});
|
|
3394
|
+
function paintLearn(open){ list.hidden = !open; head.setAttribute("aria-expanded", open ? "true" : "false"); }
|
|
3395
|
+
function toggleLearn(){ var open = list.hidden; auditExpanded["\u0000learnings"] = open; paintLearn(open); } // folded on open; a re-render keeps what you chose for this run
|
|
3396
|
+
if(auditExpanded["\u0000learnings"] === true) paintLearn(true);
|
|
3397
|
+
head.addEventListener("click", toggleLearn);
|
|
3398
|
+
wrap.appendChild(head); wrap.appendChild(list);
|
|
3399
|
+
box.appendChild(wrap);
|
|
3400
|
+
}
|
|
3258
3401
|
function renderAuditGroups(result){
|
|
3259
3402
|
var runKey = currentFlow + "/" + currentRunId;
|
|
3260
3403
|
if(auditExpandedRun !== runKey){ auditExpanded = {}; auditExpandedRun = runKey; }
|
|
@@ -3406,6 +3549,7 @@
|
|
|
3406
3549
|
// says why" — checked against whichever view is actually on screen.
|
|
3407
3550
|
function paintAudit(result){
|
|
3408
3551
|
var anyGrouped = renderAuditGroups(result);
|
|
3552
|
+
renderAuditLearnings(result);
|
|
3409
3553
|
var anyFlat = renderAuditFlat(result);
|
|
3410
3554
|
var filterEmpty = document.getElementById("audit-filter-empty");
|
|
3411
3555
|
var nothingMatched = auditViewMode === "flat" ? !anyFlat : !anyGrouped;
|
|
@@ -3428,11 +3572,12 @@
|
|
|
3428
3572
|
var content = document.getElementById("audit-content");
|
|
3429
3573
|
lastAuditResult = result;
|
|
3430
3574
|
// a run with no audit rows yet still has its Draft: say so in words, and show the card
|
|
3431
|
-
var hasDraft = !!(result && (result.draft || result.schedule || result.needsLeft));
|
|
3575
|
+
var hasDraft = !!(result && (result.draft || result.schedule || result.needsLeft || (result.learnings && result.learnings.length)));
|
|
3432
3576
|
if(!result || (result.empty && !hasDraft)){
|
|
3433
3577
|
empty.hidden = false;
|
|
3434
3578
|
empty.textContent = (result && result.why) || "no audit rows for this run";
|
|
3435
3579
|
content.hidden = true;
|
|
3580
|
+
document.getElementById("audit-learnings").hidden = true; // M8 item 6: a run with nothing to show keeps no box of the run before
|
|
3436
3581
|
return;
|
|
3437
3582
|
}
|
|
3438
3583
|
empty.hidden = !result.empty;
|
|
@@ -3505,6 +3650,8 @@
|
|
|
3505
3650
|
// M10 am11: each check sentence is its own row
|
|
3506
3651
|
if(st.ask || !(st.check || []).length) fold.appendChild(textDiv("plan-row", "check: " + (st.ask ? "ASK · waits " + plainWait(st.waitMs) : "")));
|
|
3507
3652
|
else st.check.forEach(function(s){ fold.appendChild(textDiv("plan-row", "check: " + s)); });
|
|
3653
|
+
// M10b am2: a step that reads a sheet shows its line's block under the check sentence
|
|
3654
|
+
sheetBlockLines(st.sheet).forEach(function(t){ fold.appendChild(textDiv("plan-row", t)); });
|
|
3508
3655
|
return fold;
|
|
3509
3656
|
}
|
|
3510
3657
|
// 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).
|
|
@@ -3600,9 +3747,9 @@
|
|
|
3600
3747
|
document.getElementById("details-cap").textContent =
|
|
3601
3748
|
(typeof job.capUsd === "number" ? ("$" + job.capUsd.toFixed(2)) : "unknown")
|
|
3602
3749
|
+ " per run" + (waitText ? " · " + waitText : "") + " · redo up to " + (typeof job.redoCap === "number" ? job.redoCap : "unknown");
|
|
3603
|
-
// review #5: "
|
|
3750
|
+
// review #5: "Inputs" — role -> the full signed path (a web address shows its address), by hamr 2026-10-24.
|
|
3604
3751
|
renderRowsField("details-sources", job.sources, "no signed sources", function(s){
|
|
3605
|
-
return s.role + " → " + s.
|
|
3752
|
+
return s.role + " → " + s.path;
|
|
3606
3753
|
});
|
|
3607
3754
|
// review #5: "Destination" — one row per signed send.
|
|
3608
3755
|
renderRowsField("details-sends", job.sends, "no signed sends", function(s){
|
|
@@ -4259,7 +4406,11 @@
|
|
|
4259
4406
|
return reloadRun(ctx.flow, ctx.runId);
|
|
4260
4407
|
}).then(function(){ if(root.isConnected) setBusy(root, false); });
|
|
4261
4408
|
}
|
|
4409
|
+
// M11 am22: the Ask tab's button and the Run tab's button are one door; while a reopen is out neither can send a second one.
|
|
4410
|
+
var reopenOut = false;
|
|
4262
4411
|
function sendReopen(root, ctx, askId){
|
|
4412
|
+
if(reopenOut) return;
|
|
4413
|
+
reopenOut = true;
|
|
4263
4414
|
say(ctx.flow, ctx.runId, "info", "reopening…");
|
|
4264
4415
|
setBusy(root, true);
|
|
4265
4416
|
postJSON("/api/reopen", { flow: ctx.flow, runId: ctx.runId, askId: askId }).then(function(r){
|
|
@@ -4273,7 +4424,7 @@
|
|
|
4273
4424
|
}).catch(function(e){
|
|
4274
4425
|
say(ctx.flow, ctx.runId, "refused", networkText());
|
|
4275
4426
|
return reloadRun(ctx.flow, ctx.runId);
|
|
4276
|
-
}).then(function(){ if(root.isConnected) setBusy(root, false); });
|
|
4427
|
+
}).then(function(){ reopenOut = false; if(root.isConnected) setBusy(root, false); });
|
|
4277
4428
|
}
|
|
4278
4429
|
// M11 am11 item 3: Remove from Needs you. One door for the Ask tab (expired ask) and the Run tab (stopped / stuck): the server writes the marker and changes nothing else.
|
|
4279
4430
|
function makeRemoveNeedsButton(flow, runId, after){
|
|
@@ -4392,6 +4543,19 @@
|
|
|
4392
4543
|
// style a footnote/why-text uses.
|
|
4393
4544
|
ev.appendChild(textDiv("evidence-heading", "draft " + ctx.draftNo));
|
|
4394
4545
|
ev.appendChild(draftEl);
|
|
4546
|
+
} else if(evidence.sheet){
|
|
4547
|
+
// M10b am4: a sheet step's ask shows the Result tab's own lines (resultSheetBlock) and the step's answer value by value, where the error line was
|
|
4548
|
+
var sheetBox = document.createElement("div");
|
|
4549
|
+
sheetBox.setAttribute("data-testid", "ask-sheet");
|
|
4550
|
+
sheetBox.innerHTML = resultSheetBlock(evidence.sheet.block) + resultField("Answer", '<div class="ro-value" data-testid="ask-sheet-answers">' +
|
|
4551
|
+
(evidence.sheet.answer || []).map(function(t){ return '<div data-testid="ask-sheet-answer">' + escapeXml(t) + '</div>'; }).join("") + '</div>');
|
|
4552
|
+
ev.appendChild(sheetBox);
|
|
4553
|
+
} else if(evidence.cited){
|
|
4554
|
+
// a cited step's ask shows the Result tab's own results (resultFactsLine): each with its fields and its proof; the unjudged evidence follows below
|
|
4555
|
+
var citedBox = document.createElement("div");
|
|
4556
|
+
citedBox.setAttribute("data-testid", "ask-cited");
|
|
4557
|
+
citedBox.innerHTML = resultFactsLine(evidence.cited);
|
|
4558
|
+
ev.appendChild(citedBox);
|
|
4395
4559
|
} else {
|
|
4396
4560
|
ev.appendChild(textDiv("hint", evidence.why || "no draft on file"));
|
|
4397
4561
|
}
|
|
@@ -4411,7 +4575,13 @@
|
|
|
4411
4575
|
}
|
|
4412
4576
|
var art = document.createElement("div");
|
|
4413
4577
|
art.className = "ro-value scroll";
|
|
4414
|
-
if(typeof u.text === "string"){ fillArtifactText(art, u.text); }
|
|
4578
|
+
if(typeof u.text === "string"){ fillArtifactText(art, u.text); }
|
|
4579
|
+
else if(u.cells && typeof u.cells === "object"){
|
|
4580
|
+
// a step that leaves fields, not prose: one line per field, "name: value" (textContent, so every value is escaped)
|
|
4581
|
+
art.style.whiteSpace = "pre-wrap";
|
|
4582
|
+
art.setAttribute("data-testid", "ask-unjudged-cells");
|
|
4583
|
+
art.textContent = Object.keys(u.cells).map(function(k){ return k + ": " + String(u.cells[k]); }).join("\n");
|
|
4584
|
+
} else { art.textContent = "no artifact text on file"; }
|
|
4415
4585
|
ev.appendChild(art);
|
|
4416
4586
|
});
|
|
4417
4587
|
return ev;
|
|
@@ -4922,6 +5092,8 @@
|
|
|
4922
5092
|
c.sentences.forEach(function(s, i){
|
|
4923
5093
|
checkedLines.push(i === 0 ? (c.line !== null && c.line !== undefined ? "line " + c.line : "step " + c.step) + ": " + s : " " + s);
|
|
4924
5094
|
});
|
|
5095
|
+
// M10b am2: a line that reads a sheet: its guardrails, Checked (name, words, covers), Not checked
|
|
5096
|
+
sheetBlockLines(c.sheet).forEach(function(t){ checkedLines.push(" " + t); });
|
|
4925
5097
|
});
|
|
4926
5098
|
blocks.push({id: "chat-checked", head: "Checked", sub: "built by the machine from the plan's checks", lines: checkedLines});
|
|
4927
5099
|
var nc = state.notChecked || {};
|
|
@@ -5284,8 +5456,10 @@
|
|
|
5284
5456
|
refreshCapNote(); fitCardBoxes();
|
|
5285
5457
|
doDraft(null);
|
|
5286
5458
|
}
|
|
5287
|
-
// the card stops reusing: the name box is free again
|
|
5459
|
+
// the card stops reusing: the name box is free again. ONE owner: reuseOf and the boxes startReuseDraft filled go together, so a card that
|
|
5460
|
+
// left Reuse (a refused signed start too) can never be drafted as a plain new job carrying the old job and name
|
|
5288
5461
|
function leaveReuse(){
|
|
5462
|
+
if(reuseOf !== null){ ["jf-name", "jf-job", "jf-cap-money", "jf-dest-folder", "jf-inputs"].forEach(function(id){ byId(id).value = ""; }); askWaitEl.value = "1h"; }
|
|
5289
5463
|
reuseOf = null;
|
|
5290
5464
|
editBannerEl.hidden = true; editBannerEl.textContent = "";
|
|
5291
5465
|
}
|
|
@@ -6112,7 +6286,7 @@
|
|
|
6112
6286
|
});
|
|
6113
6287
|
document.querySelectorAll('input[name="jf-mode"]').forEach(function(r){
|
|
6114
6288
|
r.addEventListener("change", function(){
|
|
6115
|
-
if(r.checked && reuseOf !== null && r.value !== "new" && !sessionLive){ leaveReuse();
|
|
6289
|
+
if(r.checked && reuseOf !== null && r.value !== "new" && !sessionLive){ leaveReuse(); }
|
|
6116
6290
|
if(r.checked) setMode(r.value);
|
|
6117
6291
|
});
|
|
6118
6292
|
});
|
package/src/panel/result.js
CHANGED
|
@@ -20,6 +20,8 @@ import { isAgree, readingOfQuestion } from '../pageask.js';
|
|
|
20
20
|
import { lineRules } from '../pagebits.js';
|
|
21
21
|
import { CITED_CHECKS_FILE } from '../cited-record.js';
|
|
22
22
|
import { readChecks } from '../diary.js';
|
|
23
|
+
import { sheetLineBlocks, csvRolesOf } from '../sheetblock.js';
|
|
24
|
+
import { readSheetChecks } from '../sheet-record.js';
|
|
23
25
|
|
|
24
26
|
/** the two sentences for a saved file that is no longer what the run wrote (code-owned, one spelling) */
|
|
25
27
|
export const RESULT_FILE_GONE = 'the saved file is gone';
|
|
@@ -234,12 +236,16 @@ export function buildResult({
|
|
|
234
236
|
const urls = pageUrlsByRole(arbiter);
|
|
235
237
|
// am9: a page job's card is bareloop's (no checks list); every other job lists what each step checked
|
|
236
238
|
const diary = urls.size === 0 ? readChecks(runDir) : [];
|
|
239
|
+
// M10b am2: the block of every job line that reads a sheet (guardrails, Checked with ✓ / ✗ and what was found, Not checked), from the signed job and the run's
|
|
240
|
+
// sheet-checks.json; it is there with no rows found and when the result is written to a doc
|
|
241
|
+
const sheetBlocks = sheetLineBlocks({ declaration, lines: flowRead.lines, csvRoles: csvRolesOf(arbiter), record: readSheetChecks(runDir) });
|
|
237
242
|
const lines = flowRead.lines.filter((l) => !taken.has(l.n)).map((l) => {
|
|
238
243
|
const c = record.find((x) => x.n === l.n) ?? null;
|
|
239
244
|
const out = {
|
|
240
245
|
notChecked: c ? c.notChecked : [], n: l.n, text: l.text, rules: isStr(l.guardrail) && l.guardrail !== '' ? [l.guardrail] : [],
|
|
241
246
|
kind: c ? 'facts' : 'text', passed: c ? c.passed : false, file: null,
|
|
242
247
|
checks: checksOfLine((declaration?.steps ?? []).filter((st) => st.fromLine === l.n), diary),
|
|
248
|
+
sheet: sheetBlocks.find((b) => b.line === l.n) ?? null,
|
|
243
249
|
};
|
|
244
250
|
if (c) {
|
|
245
251
|
out.source = c.source;
|
package/src/redact.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// The one secret inventory: known token shapes only, masked before a value is stored or written.
|
|
2
|
-
// borrowed-from: bareloop src/validate.js@
|
|
2
|
+
// borrowed-from: bareloop src/validate.js@76168c8 (SECRET_PATTERNS; a key right after a hyphen is masked for the distinctive prefixes). Its own module so a caller that only
|
|
3
3
|
// needs to mask (src/diary.js) does not pull litectx in through src/ctx-tools.js.
|
|
4
4
|
|
|
5
5
|
import { redact } from 'bareguard';
|
|
6
6
|
|
|
7
7
|
const SECRET_PATTERNS = [
|
|
8
8
|
/(?<![A-Za-z0-9_-])sk-[A-Za-z0-9_-]{16,}/,
|
|
9
|
-
/(?<![A-Za-z0-9_
|
|
10
|
-
/(?<![A-Za-z0-9_
|
|
11
|
-
/(?<![A-Za-z0-9_
|
|
12
|
-
/(?<![A-Za-z0-9_
|
|
13
|
-
/(?<![A-Za-z0-9_
|
|
9
|
+
/(?<![A-Za-z0-9_])ghp_[A-Za-z0-9]{20,}/,
|
|
10
|
+
/(?<![A-Za-z0-9_])github_pat_[A-Za-z0-9_]{20,}/,
|
|
11
|
+
/(?<![A-Za-z0-9_])AKIA[0-9A-Z]{16}/,
|
|
12
|
+
/(?<![A-Za-z0-9_])xox[bap]-[A-Za-z0-9-]{10,}/,
|
|
13
|
+
/(?<![A-Za-z0-9_])AIza[0-9A-Za-z_-]{35}/,
|
|
14
14
|
];
|
|
15
15
|
|
|
16
16
|
/** Mask known secret shapes. @param {unknown} raw */
|