fwdloop 0.23.0 → 0.25.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 +62 -32
- package/package.json +1 -1
- package/src/ask.js +15 -1
- package/src/attemptdiff.js +118 -0
- package/src/audit-fold.js +2 -0
- package/src/authoring.js +32 -2
- package/src/cited-record.js +3 -22
- package/src/cited-source.js +5 -6
- package/src/citedwords.js +36 -2
- package/src/config.js +5 -1
- package/src/diary.js +21 -17
- package/src/drafter.js +6 -2
- package/src/flowmodel.js +52 -28
- package/src/keysfile.js +1 -1
- package/src/launcher.js +552 -0
- package/src/learn.js +952 -0
- package/src/learnstore.js +348 -0
- package/src/line-checks.js +55 -0
- package/src/model-step.js +2 -0
- package/src/opener.js +33 -0
- package/src/pagedry.js +3 -4
- package/src/pagefetch.js +9 -2
- package/src/pagerules.js +28 -5
- package/src/panel/author.js +2 -0
- package/src/panel/authorflows.js +9 -9
- package/src/panel/authorresume.js +4 -3
- package/src/panel/data.js +63 -14
- package/src/panel/index.html +162 -16
- package/src/panel/result.js +7 -12
- package/src/panel/server.js +53 -5
- package/src/panel/settings.js +4 -18
- package/src/panel/spawn.js +0 -9
- package/src/prompts.js +33 -0
- package/src/redact.js +6 -6
- package/src/runfile.js +60 -0
- package/src/runner.js +144 -33
- package/src/sheet-record.js +15 -35
- package/src/sheetblock.js +3 -3
- package/src/sheetrun.js +6 -6
- package/src/summary-words.js +13 -5
- package/src/thinking.js +11 -0
- package/src/tty-colour.js +29 -0
- package/types/ask.d.ts +7 -2
- package/types/attemptdiff.d.ts +38 -0
- package/types/cited-record.d.ts +0 -2
- package/types/citedwords.d.ts +14 -0
- package/types/diary.d.ts +2 -5
- package/types/drafter.d.ts +6 -1
- package/types/flowmodel.d.ts +37 -20
- package/types/keysfile.d.ts +7 -0
- package/types/launcher.d.ts +307 -0
- package/types/learn.d.ts +576 -0
- package/types/learnstore.d.ts +168 -0
- package/types/line-checks.d.ts +26 -0
- package/types/opener.d.ts +12 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/author.d.ts +2 -0
- package/types/panel/data.d.ts +2 -1
- package/types/panel/result.d.ts +2 -4
- package/types/panel/server.d.ts +24 -3
- package/types/panel/settings.d.ts +2 -2
- package/types/panel/spawn.d.ts +0 -6
- package/types/prompts.d.ts +14 -0
- package/types/runfile.d.ts +48 -0
- package/types/runner.d.ts +14 -5
- package/types/sheet-record.d.ts +0 -2
- package/types/sheetblock.d.ts +2 -2
- package/types/sheetrun.d.ts +1 -1
- package/types/summary-words.d.ts +2 -1
- package/types/thinking.d.ts +11 -0
- package/types/tty-colour.d.ts +33 -0
|
@@ -16,7 +16,7 @@ import { userInfo } from 'node:os';
|
|
|
16
16
|
|
|
17
17
|
import { scrub } from '../authoring.js';
|
|
18
18
|
import { loadCatalogue } from '../catalogue.js';
|
|
19
|
-
import { changeSentence, checkFlowName,
|
|
19
|
+
import { changeSentence, checkFlowName, readPlan, readRunPlan, resolveRunDir } from '../flow.js';
|
|
20
20
|
import { readResumeLock } from '../liveness.js';
|
|
21
21
|
import { auditSpend } from '../runner.js';
|
|
22
22
|
import {
|
|
@@ -28,6 +28,7 @@ import { checkValues } from './authorvalues.js';
|
|
|
28
28
|
import { getRunControls } from './data.js';
|
|
29
29
|
import { providerKeys } from './spawn.js';
|
|
30
30
|
import { readModelRecord } from '../flowmodel.js';
|
|
31
|
+
import { readRunInputs } from '../runfile.js';
|
|
31
32
|
|
|
32
33
|
const KEYS = ['flow', 'runId', 'capUsd', 'hash'];
|
|
33
34
|
|
|
@@ -102,9 +103,9 @@ export function createResumeDoor(opts) {
|
|
|
102
103
|
form(flow, runId) {
|
|
103
104
|
const s = inspect({ flow: flow ?? '', runId: runId ?? '' }, true);
|
|
104
105
|
if (!s.ok) return s.reply;
|
|
105
|
-
const inputsRead =
|
|
106
|
+
const inputsRead = readRunInputs(s.runDir);
|
|
106
107
|
let inputs = [];
|
|
107
|
-
try { inputs = inputsRead.ok ?
|
|
108
|
+
try { inputs = inputsRead.ok ? inputsRead.entries.map((m) => ({ role: String(m.id), path: String(m.source) })) : []; } catch { inputs = []; }
|
|
108
109
|
const floor = capFloorOf(s.hasRound, home, readModelRecord(dirname(dirname(s.runDir))));
|
|
109
110
|
const floorUsd = floor.usd;
|
|
110
111
|
return {
|
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,6 +38,7 @@ 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';
|
|
42
43
|
import { csvRolesOf, askSheetCard } from '../sheetblock.js';
|
|
43
44
|
import { readSheetChecks } from '../sheet-record.js';
|
|
@@ -45,9 +46,10 @@ import {
|
|
|
45
46
|
NO_COPY_SAY, catchUpWords, endedLineWords, endedWords, needsLeftWords, nextInWords, nextTimeWords, scheduleAuditWords, scheduleBlockWords, scheduleFieldWords, scheduledNextFor, scheduledWords, startedWords,
|
|
46
47
|
} from '../summary-words.js';
|
|
47
48
|
import { MAX_STRUCTURE_RETRIES } from '../drafter.js';
|
|
48
|
-
import { isResultRun, checkTypeOf, buildResult, downloadOf } from './result.js';
|
|
49
|
+
import { isResultRun, checkTypeOf, buildResult, downloadOf, readCitedChecks } from './result.js';
|
|
49
50
|
import { thinkingRuleWords, thinkingTryWords } from '../thinking.js';
|
|
50
|
-
import {
|
|
51
|
+
import { readLearningsRecord } from '../flowmodel.js';
|
|
52
|
+
import { readRunThinking } from '../runfile.js';
|
|
51
53
|
import {
|
|
52
54
|
isTryRow, loadDiaries, deriveFold, cardLine, summaryLines,
|
|
53
55
|
} from '../audit-fold.js';
|
|
@@ -1286,14 +1288,27 @@ export function needsYouOf({
|
|
|
1286
1288
|
}
|
|
1287
1289
|
|
|
1288
1290
|
/**
|
|
1289
|
-
* M11
|
|
1291
|
+
* 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.
|
|
1292
|
+
* 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.
|
|
1290
1293
|
* @param {string} runDir @param {any} ctx `loadRunContext`'s result
|
|
1294
|
+
* @returns {{askId: string, waitMs: number, late: boolean, why: string}|null}
|
|
1291
1295
|
*/
|
|
1292
|
-
function
|
|
1296
|
+
function runReopenOffer(runDir, ctx) {
|
|
1293
1297
|
if (ctx.historyRow || !ctx.askJson) return null;
|
|
1294
1298
|
const savedAskId = readSavedAnswer(runDir)?.askId;
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1299
|
+
for (const a of runAsksInOrder(runDir, false)) {
|
|
1300
|
+
const offer = reopenOffer(a, ctx.askJson, ctx.resume, savedAskId === a.askId);
|
|
1301
|
+
if (offer !== null) return { askId: a.askId, ...offer };
|
|
1302
|
+
}
|
|
1303
|
+
return null;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* 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.
|
|
1308
|
+
* @param {string} runDir @param {any} ctx `loadRunContext`'s result
|
|
1309
|
+
*/
|
|
1310
|
+
function reopenableAt(runDir, ctx) {
|
|
1311
|
+
return runReopenOffer(runDir, ctx) !== null && typeof ctx.askJson.expiresAt === 'string' ? ctx.askJson.expiresAt : null;
|
|
1297
1312
|
}
|
|
1298
1313
|
|
|
1299
1314
|
/**
|
|
@@ -1768,6 +1783,8 @@ export function getRunDetail({
|
|
|
1768
1783
|
signWords: SIGN_WORDS,
|
|
1769
1784
|
pulse: glyphPulses({ glyph, label }),
|
|
1770
1785
|
controls: runControls(ctx, glyph, label),
|
|
1786
|
+
// M11 am22: the Run tab's Reopen, the Ask tab's own `reopenOffer` answer (`{askId, waitMs, late, why}`), or null
|
|
1787
|
+
reopen: runReopenOffer(run.runDir, ctx),
|
|
1771
1788
|
// M11 am11 item 3: where this run stands in Needs you now; the page shows Remove from Needs you only when `removable`
|
|
1772
1789
|
needsYou: (({ tag, removable }) => ({ tag, removable }))(needsYouOf({
|
|
1773
1790
|
runDir: run.runDir, ctx, glyph, controls: runControls(ctx, glyph, label), nowMs: now(), reopenAt: reopenableAt(run.runDir, ctx),
|
|
@@ -1967,7 +1984,7 @@ function attachFolds(groups, runDir, flowDir, { root, flow, catalogue }) {
|
|
|
1967
1984
|
* shared-sidecar contamination risk here the way bareloop's gate-audit
|
|
1968
1985
|
* sidecar had). `null` when the flow/runId doesn't resolve (404).
|
|
1969
1986
|
* @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
|
|
1970
|
-
* @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}
|
|
1987
|
+
* @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}
|
|
1971
1988
|
*/
|
|
1972
1989
|
export function getRunAudit({
|
|
1973
1990
|
root, flow, runId, scheduleRead, home, catalogue, resumeAttempt, startingRun, now = Date.now,
|
|
@@ -1995,6 +2012,9 @@ export function getRunAudit({
|
|
|
1995
2012
|
// never a second, client-side re-grouping.
|
|
1996
2013
|
groups,
|
|
1997
2014
|
draft: getDraftBlock(run.flowDir, run.runDir),
|
|
2015
|
+
// 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
|
|
2016
|
+
// 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.
|
|
2017
|
+
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) }]; })(),
|
|
1998
2018
|
// 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
|
|
1999
2019
|
needsLeft: catalogue ? needsLeftWords(getRunNeeds({
|
|
2000
2020
|
root, flow, runId, catalogue, nowMs: now(), resumeAttempt,
|
|
@@ -2116,7 +2136,7 @@ export function getRunJob({
|
|
|
2116
2136
|
trigger: f && f.trigger ? f.trigger : null, from: f?.from ?? null, model: f?.model ?? null, destination: f?.destination ?? null, inputs: f?.inputs ?? null, home,
|
|
2117
2137
|
});
|
|
2118
2138
|
})(),
|
|
2119
|
-
// M4d am28: the run's rule from its own
|
|
2139
|
+
// M4d am28: the run's rule from its own run.json; a run with none (before am25) reads `—` (thinkingRuleWords(null)); the row always shows
|
|
2120
2140
|
thinkingRule: thinkingRuleWords(readRunThinking(run.runDir)),
|
|
2121
2141
|
jobFrom: copy.present ? 'run' : 'current',
|
|
2122
2142
|
jobFromWhy: copy.present ? null : NO_JOB_COPY_WORDS,
|
|
@@ -2135,11 +2155,10 @@ export function getRunJob({
|
|
|
2135
2155
|
asks: asks.map((ak) => ({ line: ak.line, question: ak.question, waitMs: ak.ttlMs })),
|
|
2136
2156
|
capUsd: typeof a.capUsd === 'number' ? a.capUsd : null,
|
|
2137
2157
|
redoCap: typeof a.redoCap === 'number' ? a.redoCap : null,
|
|
2138
|
-
// review #5: "
|
|
2139
|
-
//
|
|
2140
|
-
// "to be safe" instruction).
|
|
2158
|
+
// review #5: "Inputs" — role -> the full signed path (a web address
|
|
2159
|
+
// shows its address), by hamr 2026-10-24.
|
|
2141
2160
|
sources: sources.map((s) => ({
|
|
2142
|
-
role: s.role, kind: s.kind, path: s.path,
|
|
2161
|
+
role: s.role, kind: s.kind, path: s.path,
|
|
2143
2162
|
})),
|
|
2144
2163
|
// review #5: "Destination" — one row per send.
|
|
2145
2164
|
sends: sends.map((s) => ({ line: s.line, kind: s.target?.kind ?? null, target: s.target?.path ?? null })),
|
|
@@ -2341,6 +2360,7 @@ function flattenEvidence(evidence) {
|
|
|
2341
2360
|
unjudged: evidence.unjudged,
|
|
2342
2361
|
why: evidence.why,
|
|
2343
2362
|
...(evidence.claims ? { claims: evidence.claims } : {}),
|
|
2363
|
+
...(evidence.results ? { results: evidence.results } : {}),
|
|
2344
2364
|
};
|
|
2345
2365
|
}
|
|
2346
2366
|
|
|
@@ -2637,6 +2657,28 @@ export function groupAskBlocks(asks) {
|
|
|
2637
2657
|
});
|
|
2638
2658
|
}
|
|
2639
2659
|
|
|
2660
|
+
/**
|
|
2661
|
+
* 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
|
|
2662
|
+
* 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
|
|
2663
|
+
* built from the ask's own values: one fact per value name, no proof, never a guess.
|
|
2664
|
+
* @param {{quote: string, values: Record<string, unknown>}[]} results @param {ReturnType<typeof readCitedChecks>|null} record
|
|
2665
|
+
* @returns {{kind: 'facts', passed: boolean, facts: any[], rows: any[]}}
|
|
2666
|
+
*/
|
|
2667
|
+
function citedLineOfResults(results, record) {
|
|
2668
|
+
const quotes = results.map((r) => r.quote);
|
|
2669
|
+
const line = record && record.present && record.ok
|
|
2670
|
+
? record.lines.find((l) => l.rows && l.rows.length === quotes.length && l.rows.every((w, i) => w.quote === quotes[i]))
|
|
2671
|
+
: undefined;
|
|
2672
|
+
if (line) return { kind: 'facts', passed: line.passed, facts: line.facts, rows: line.rows };
|
|
2673
|
+
const names = [...new Set(results.flatMap((r) => Object.keys(r.values)))];
|
|
2674
|
+
return {
|
|
2675
|
+
kind: 'facts',
|
|
2676
|
+
passed: false,
|
|
2677
|
+
facts: names.map((name) => ({ name, kind: 'value', sentence: `fact · ${name}` })),
|
|
2678
|
+
rows: results.map((r, i) => ({ n: i + 1, quote: r.quote, cells: names.map((k) => (r.values[k] === undefined ? '' : String(r.values[k]))) })),
|
|
2679
|
+
};
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2640
2682
|
/**
|
|
2641
2683
|
* `GET /api/runs/:flow/:runId/asks` — the Ask tab (M4a-1 scope item 1):
|
|
2642
2684
|
* every ask this run's books can name, in order, each carrying full
|
|
@@ -2701,7 +2743,14 @@ export function getRunAsks({
|
|
|
2701
2743
|
const { why: _gone, ...rest } = ev;
|
|
2702
2744
|
return { ...ask, evidence: { ...rest, sheet: card } };
|
|
2703
2745
|
};
|
|
2704
|
-
|
|
2746
|
+
// 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)
|
|
2747
|
+
const cited = ordered.some((a) => a.evidence?.results) ? readCitedChecks(run.runDir) : null;
|
|
2748
|
+
const withCited = (/** @type {any} */ ask) => {
|
|
2749
|
+
const { results, ...ev } = ask.evidence ?? {};
|
|
2750
|
+
if (!results) return ask;
|
|
2751
|
+
return { ...ask, evidence: { ...ev, cited: citedLineOfResults(results, cited) } };
|
|
2752
|
+
};
|
|
2753
|
+
const asks = ordered.map(withSheet).map(withCited).map((ask, i) => ({
|
|
2705
2754
|
...ask,
|
|
2706
2755
|
...deriveAskOpenFields(ask, hasHistoryRow, resume),
|
|
2707
2756
|
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;
|
|
@@ -320,6 +321,10 @@
|
|
|
320
321
|
.ended-row:last-child{margin-bottom:0;}
|
|
321
322
|
.ended-label{color:var(--text-faint);font-size:11px;letter-spacing:0.08em;min-width:84px;}
|
|
322
323
|
.ended-text{flex:1 1 220px;min-width:0;overflow-wrap:anywhere;}
|
|
324
|
+
/* M9 am24: a NEXT with several instructions is one per line, label muted, instructions in a second column (shape: bareloop 8cad363, with labels in the muted colour) */
|
|
325
|
+
.next-rows{display:grid;grid-template-columns:max-content minmax(0,1fr);column-gap:10px;row-gap:2px;}
|
|
326
|
+
.next-label{color:var(--text-faint);}
|
|
327
|
+
.next-text{min-width:0;overflow-wrap:anywhere;}
|
|
323
328
|
.audit-sched-start{padding:6px 10px;margin-bottom:8px;border:1px solid var(--border-strong);background:var(--panel2);font-size:12px;overflow-wrap:anywhere;}
|
|
324
329
|
.when-sub{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px;}
|
|
325
330
|
.when-sub > *{flex:1 1 120px;min-width:0;}
|
|
@@ -436,6 +441,13 @@
|
|
|
436
441
|
.audit-group.audit-fold h4.audit-status-header::before{content:"\25B6 ";color:var(--text-faint);}
|
|
437
442
|
.audit-group.audit-fold h4.audit-status-header[aria-expanded="true"]::before{content:"\25BC ";}
|
|
438
443
|
.audit-group.audit-fold h4.audit-status-header::after{content:none;}
|
|
444
|
+
/* 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 */
|
|
445
|
+
.audit-part{border:1px solid var(--border);margin-bottom:6px;background:var(--panel2);}
|
|
446
|
+
.audit-part-toggle{width:100%;text-align:left;display:block;white-space:normal;min-height:44px;padding:8px 10px;}
|
|
447
|
+
.audit-part-toggle::before,.audit-part-toggle::after{content:"";}
|
|
448
|
+
.audit-part-toggle.audit-learn-fold::before{content:"\25B6 ";color:var(--text-faint);}
|
|
449
|
+
.audit-part-toggle.audit-learn-fold[aria-expanded="true"]::before{content:"\25BC ";}
|
|
450
|
+
.audit-part-body{padding:8px 10px 10px;border-top:1px dotted var(--border-strong);}
|
|
439
451
|
@media (max-width: 640px){
|
|
440
452
|
/* (l) a phone: the name is the only thing that shrinks — drop the dots and the word "try", tighten the gaps */
|
|
441
453
|
.audit-group.audit-fold{padding-left:8px;padding-right:8px;}
|
|
@@ -443,6 +455,8 @@
|
|
|
443
455
|
.audit-group.audit-fold h4.audit-status-header > .badge{padding-left:0;padding-right:0;font-size:10px;}
|
|
444
456
|
.audit-group.audit-fold h4.audit-status-header::before{content:"\25B6";}
|
|
445
457
|
.audit-group.audit-fold h4.audit-status-header[aria-expanded="true"]::before{content:"\25BC";}
|
|
458
|
+
.audit-part-toggle.audit-learn-fold::before{content:"\25B6 ";}
|
|
459
|
+
.audit-part-toggle.audit-learn-fold[aria-expanded="true"]::before{content:"\25BC ";}
|
|
446
460
|
.audit-fold-sep{display:none;}
|
|
447
461
|
.audit-fold-try{margin-left:.4em;} /* the cost and the try count never touch: "$0.0010" + "1" must not read $0.00101 */
|
|
448
462
|
/* the tail wraps inside the header (never spills or is cut): it may break at its spaces and shrink */
|
|
@@ -522,7 +536,7 @@
|
|
|
522
536
|
┤ ├ pips — those are reserved for a whole-box title, not an in-flow
|
|
523
537
|
line) so it reads as a clear, bold heading without a second border. */
|
|
524
538
|
.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);}
|
|
539
|
+
.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
540
|
.art-head{color:var(--accent);}
|
|
527
541
|
.ro-value.sub{margin-left:20px;min-height:0;padding-top:2px;padding-bottom:2px;border-top-width:0;overflow-wrap:anywhere;}
|
|
528
542
|
/* 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 +760,11 @@
|
|
|
746
760
|
.audit-group table.rounds-table tbody{display:table-row-group;}
|
|
747
761
|
.audit-group table.rounds-table tr{display:table-row;padding:0;overflow:visible;}
|
|
748
762
|
.audit-group table.rounds-table td{display:table-cell;padding:4px 6px;white-space:normal;overflow-wrap:anywhere;border-right:1px dotted var(--border);}
|
|
763
|
+
/* M8 item 6: a hint's table fits the box and wraps (as bareloop's does at 320), it does not scroll sideways */
|
|
764
|
+
.audit-part table.learn-hint{display:table;width:100%;min-width:0;max-width:100%;}
|
|
765
|
+
.audit-part table.learn-hint tbody{display:table-row-group;}
|
|
766
|
+
.audit-part table.learn-hint tr{display:table-row;padding:0;}
|
|
767
|
+
.audit-part table.learn-hint td{display:table-cell;padding:4px 6px;white-space:normal;overflow-wrap:anywhere;}
|
|
749
768
|
}
|
|
750
769
|
|
|
751
770
|
/* M4d piece 4: the Settings view (a sibling of #main-view, opened from the header). Layout borrowed from bareloop:
|
|
@@ -1028,6 +1047,9 @@
|
|
|
1028
1047
|
<div class="rw-picked" id="rw-picked" data-testid="rw-picked" hidden><span id="rw-picked-txt" data-testid="rw-picked-txt"></span><a id="rw-change" data-testid="rw-change" role="button" tabindex="0">change</a></div>
|
|
1029
1048
|
<div class="hint" id="jf-run-empty" data-testid="jf-run-empty"></div>
|
|
1030
1049
|
<div class="jf-err" id="jf-err-flow" data-testid="jf-err-flow"></div>
|
|
1050
|
+
<div class="hint" id="jf-run-model" data-testid="jf-run-model"></div>
|
|
1051
|
+
<select id="jf-run-pick" data-testid="jf-run-pick" aria-label="Model to run this job with" hidden disabled><option value="">Reading your models…</option></select>
|
|
1052
|
+
<div class="jf-err" id="jf-err-run-model" data-testid="jf-err-run-model"></div>
|
|
1031
1053
|
</div>
|
|
1032
1054
|
<div class="field" data-testid="jf-run-job-field">
|
|
1033
1055
|
<label for="jf-run-jobbox">The job</label>
|
|
@@ -1038,9 +1060,6 @@
|
|
|
1038
1060
|
<div class="ro-lines" id="jf-run-job" data-testid="jf-run-job"></div>
|
|
1039
1061
|
<div class="jf-err" id="jf-err-run-job" data-testid="jf-err-run-job"></div>
|
|
1040
1062
|
<div class="hint" id="jf-run-job-hint" data-testid="jf-run-job-hint">Change anything here. A changed job line, guardrail, ask or step drafts a new workflow; a changed destination, cap, wait or model signs a new run; new files just run.</div>
|
|
1041
|
-
<div class="hint" id="jf-run-model" data-testid="jf-run-model"></div>
|
|
1042
|
-
<select id="jf-run-pick" data-testid="jf-run-pick" aria-label="Model to run this job with" hidden disabled><option value="">Reading your models…</option></select>
|
|
1043
|
-
<div class="jf-err" id="jf-err-run-model" data-testid="jf-err-run-model"></div>
|
|
1044
1063
|
</div>
|
|
1045
1064
|
<div class="field" id="jf-run-newname-field" data-testid="jf-run-newname-field" hidden>
|
|
1046
1065
|
<label for="jf-run-newname">Name of the new workflow</label>
|
|
@@ -1263,6 +1282,7 @@
|
|
|
1263
1282
|
</div>
|
|
1264
1283
|
</div>
|
|
1265
1284
|
<div id="audit-filter-empty" class="hint" data-testid="audit-filter-empty" hidden style="padding:12px 0;"></div>
|
|
1285
|
+
<div id="audit-learnings" data-testid="audit-learnings" hidden></div>
|
|
1266
1286
|
<div id="audit-groups" data-testid="audit-groups"></div>
|
|
1267
1287
|
<div class="audit-table-scroll" id="audit-flat-wrap" hidden>
|
|
1268
1288
|
<table data-testid="audit-table">
|
|
@@ -1307,7 +1327,7 @@
|
|
|
1307
1327
|
<div class="field"><label>Ask</label><div id="details-asks"></div></div>
|
|
1308
1328
|
<div class="field"><label>Destination</label><div id="details-sends"></div></div>
|
|
1309
1329
|
<div class="field"><label>$ cap</label><div class="ro-value" id="details-cap">—</div></div>
|
|
1310
|
-
<div class="field"><label>
|
|
1330
|
+
<div class="field"><label>Inputs</label><div id="details-sources"></div></div>
|
|
1311
1331
|
<div class="field"><label>Signed</label><div class="ro-value" id="details-signature">—</div></div>
|
|
1312
1332
|
<div class="plan-legend" data-testid="plan-legend"><span class="plan-mark">›</span> = the approved plan</div>
|
|
1313
1333
|
</div>
|
|
@@ -2617,6 +2637,12 @@
|
|
|
2617
2637
|
var c = red ? ' is-red' : '';
|
|
2618
2638
|
return '<div class="ended-row"><span class="ended-label' + c + '">' + label + '</span><span class="ended-text' + c + '"' + (testid ? ' data-testid="' + testid + '"' : '') + '>' + escapeXml(value) + '</span></div>';
|
|
2619
2639
|
}
|
|
2640
|
+
// M9 am24: `next` is one string; `rows` ([label, instruction] pairs, from summary-words.js) is there only when it holds several instructions
|
|
2641
|
+
function nextRow(ended){
|
|
2642
|
+
if(!Array.isArray(ended.rows) || ended.rows.length < 2) return summaryRow("NEXT", ended.next, "ended-next");
|
|
2643
|
+
var grid = ended.rows.map(function(r){ return '<span class="next-row" style="display:contents"><span class="next-label">' + escapeXml(r[0]) + '</span><span class="next-text">' + escapeXml(r[1]) + '</span></span>'; }).join("");
|
|
2644
|
+
return '<div class="ended-row"><span class="ended-label">NEXT</span><span class="ended-text next-rows" data-testid="ended-next">' + grid + '</span></div>';
|
|
2645
|
+
}
|
|
2620
2646
|
function renderSummary(detail){
|
|
2621
2647
|
var sm = detail.summary || {};
|
|
2622
2648
|
var box = document.getElementById("ended-block");
|
|
@@ -2627,7 +2653,7 @@
|
|
|
2627
2653
|
if(sc && sc.red === true) tone = "red";
|
|
2628
2654
|
box.hidden = false;
|
|
2629
2655
|
box.className = "ended-block" + (tone ? " " + tone : "");
|
|
2630
|
-
box.innerHTML = (sm.ended ? summaryRow("ENDED", sm.ended.reason, "ended-reason") +
|
|
2656
|
+
box.innerHTML = (sm.ended ? summaryRow("ENDED", sm.ended.reason, "ended-reason") + nextRow(sm.ended) : "") +
|
|
2631
2657
|
(sc ? summaryRow("SCHEDULE", sc.line1, "sched-line1", sc.red === true) + (sc.line2 ? summaryRow("", sc.line2, "sched-line2", sc.red === true) : "") : "");
|
|
2632
2658
|
} else { box.hidden = true; box.innerHTML = ""; }
|
|
2633
2659
|
note.hidden = !sm.catchUp;
|
|
@@ -2782,8 +2808,11 @@
|
|
|
2782
2808
|
el.appendChild(makeButton("Resume", "run-resume", function(){ if(window.fwdloopOpenResume) window.fwdloopOpenResume(detail); }));
|
|
2783
2809
|
}
|
|
2784
2810
|
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); }
|
|
2811
|
+
// 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
|
|
2812
|
+
if(detail.reopen) el.appendChild(makeButton("Reopen for another " + waitText(detail.reopen.waitMs), "run-reopen", function(){ sendReopen(el, detail, detail.reopen.askId); }));
|
|
2785
2813
|
// 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
|
|
2786
2814
|
if(detail.needsYou && detail.needsYou.removable) el.appendChild(makeRemoveNeedsButton(detail.flow, detail.runId, function(){ return reloadRun(detail.flow, detail.runId); }));
|
|
2815
|
+
if(detail.reopen) el.appendChild(textDiv("hint", detail.reopen.why));
|
|
2787
2816
|
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); }
|
|
2788
2817
|
el.hidden = el.children.length === 0;
|
|
2789
2818
|
}
|
|
@@ -3208,7 +3237,7 @@
|
|
|
3208
3237
|
if(testId) e.setAttribute("data-testid", testId);
|
|
3209
3238
|
return e;
|
|
3210
3239
|
}
|
|
3211
|
-
function foldTryEl(t, human){
|
|
3240
|
+
function foldTryEl(t, human, stepKey){
|
|
3212
3241
|
var wrap = document.createElement("div");
|
|
3213
3242
|
var line = foldEl("div", "audit-try", null, "audit-try-line");
|
|
3214
3243
|
line.appendChild(document.createTextNode("try " + t.n + " "));
|
|
@@ -3218,6 +3247,21 @@
|
|
|
3218
3247
|
: [t.thinking, t.gap];
|
|
3219
3248
|
rest.forEach(function(x){ if(x) line.appendChild(document.createTextNode(" \u00b7 " + x)); });
|
|
3220
3249
|
wrap.appendChild(line);
|
|
3250
|
+
// 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
|
|
3251
|
+
if(!human && t.hints && t.hints.text){
|
|
3252
|
+
var hk = "\u0000hints:" + stepKey + ":" + t.n;
|
|
3253
|
+
var hpart = foldEl("div", "audit-part", null, "audit-try-hints");
|
|
3254
|
+
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");
|
|
3255
|
+
hhead.type = "button";
|
|
3256
|
+
var hbody = foldEl("div", "audit-part-body", null, "audit-try-hints-text");
|
|
3257
|
+
hbody.style.cssText = "white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0";
|
|
3258
|
+
hbody.textContent = t.hints.text;
|
|
3259
|
+
var paintHints = function(open){ hbody.hidden = !open; hhead.setAttribute("aria-expanded", open ? "true" : "false"); };
|
|
3260
|
+
paintHints(auditExpanded[hk] === true);
|
|
3261
|
+
hhead.addEventListener("click", function(ev){ ev.stopPropagation(); var open = hbody.hidden; auditExpanded[hk] = open; paintHints(open); });
|
|
3262
|
+
hpart.appendChild(hhead); hpart.appendChild(hbody);
|
|
3263
|
+
wrap.appendChild(hpart);
|
|
3264
|
+
}
|
|
3221
3265
|
if(!human && t.checks && t.checks.length){
|
|
3222
3266
|
var box = foldEl("div", "audit-checks", null, "audit-checks");
|
|
3223
3267
|
t.checks.forEach(function(c){
|
|
@@ -3280,12 +3324,94 @@
|
|
|
3280
3324
|
var f = g.fold, human = f.who === "human";
|
|
3281
3325
|
var body = foldEl("div", "audit-fold-body", null, "audit-fold-body-" + g.step);
|
|
3282
3326
|
if(f.tally) body.appendChild(foldEl("div", "audit-tally", f.tally, "audit-tally"));
|
|
3283
|
-
(f.tries || []).forEach(function(t){ body.appendChild(foldTryEl(t, human)); });
|
|
3327
|
+
(f.tries || []).forEach(function(t){ body.appendChild(foldTryEl(t, human, g.step)); });
|
|
3284
3328
|
body.appendChild(foldRoundsEl(g));
|
|
3285
3329
|
return body;
|
|
3286
3330
|
}
|
|
3287
3331
|
var auditExpanded = {}; // step -> true/false once a human toggled it; reset when the run changes
|
|
3288
3332
|
var auditExpandedRun = null;
|
|
3333
|
+
// 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.
|
|
3334
|
+
// borrowed-from: bareloop src/panel/index.html@v0.47.1 (417e80c, the learnings fold arrow; the rest as @v0.46.0 :2843-2931: learnRow, learnHintLabel, renderAuditLearnings), drawn in fwdloop's own fold (the schedule section's header and body shape)
|
|
3335
|
+
// 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.
|
|
3336
|
+
function learnRow(tbody, testid, label, lines){
|
|
3337
|
+
var tr = document.createElement("tr");
|
|
3338
|
+
tr.setAttribute("data-testid", testid);
|
|
3339
|
+
var lab = document.createElement("td");
|
|
3340
|
+
lab.className = "hint";
|
|
3341
|
+
lab.style.cssText = "white-space:nowrap";
|
|
3342
|
+
lab.textContent = label;
|
|
3343
|
+
var val = document.createElement("td");
|
|
3344
|
+
val.style.cssText = "overflow-wrap:anywhere;white-space:pre-wrap";
|
|
3345
|
+
val.textContent = lines.join("\n");
|
|
3346
|
+
tr.appendChild(lab);
|
|
3347
|
+
tr.appendChild(val);
|
|
3348
|
+
tbody.appendChild(tr);
|
|
3349
|
+
}
|
|
3350
|
+
function learnHintLabel(h){
|
|
3351
|
+
var bits = [h.n, h.level, "seen " + h.count + (h.count === 1 ? " time" : " times")];
|
|
3352
|
+
if(h.check) bits.push(h.check);
|
|
3353
|
+
if(h.kinds && h.kinds.length) bits.push(h.kinds.join(", "));
|
|
3354
|
+
bits.push(h.fixed ? "fixed" : "never fixed");
|
|
3355
|
+
return bits.join(" \u00B7 ");
|
|
3356
|
+
}
|
|
3357
|
+
function renderAuditLearnings(result){
|
|
3358
|
+
var box = document.getElementById("audit-learnings");
|
|
3359
|
+
box.innerHTML = "";
|
|
3360
|
+
var items = result && Array.isArray(result.learnings) ? result.learnings : [];
|
|
3361
|
+
box.hidden = items.length === 0;
|
|
3362
|
+
if(items.length === 0) return;
|
|
3363
|
+
var it = items[0];
|
|
3364
|
+
var hints = Array.isArray(it.hints) ? it.hints : [];
|
|
3365
|
+
var count = Array.isArray(it.ids) ? it.ids.length : hints.length;
|
|
3366
|
+
var wrap = document.createElement("div");
|
|
3367
|
+
wrap.className = "audit-part";
|
|
3368
|
+
wrap.setAttribute("data-testid", "audit-group-learnings");
|
|
3369
|
+
var head = document.createElement("button");
|
|
3370
|
+
head.type = "button";
|
|
3371
|
+
head.className = "btn audit-part-toggle audit-learn-fold";
|
|
3372
|
+
head.setAttribute("aria-expanded", "false");
|
|
3373
|
+
head.setAttribute("data-testid", "audit-learnings-head");
|
|
3374
|
+
var label = "What the planner was told from earlier runs \u00B7 " + count + (count === 1 ? " hint" : " hints");
|
|
3375
|
+
head.innerHTML = stateDotHTML(glyphClass("[\u2713]"), "learnings", "audit-learnings-state") + " " + escapeXml(label);
|
|
3376
|
+
var list = document.createElement("div");
|
|
3377
|
+
list.className = "audit-part-body";
|
|
3378
|
+
list.setAttribute("data-testid", "audit-learnings-list");
|
|
3379
|
+
list.hidden = true;
|
|
3380
|
+
var note = document.createElement("div");
|
|
3381
|
+
note.className = "hint";
|
|
3382
|
+
note.style.cssText = "margin:6px 0;overflow-wrap:anywhere;";
|
|
3383
|
+
note.textContent = "Read-only. Given to the planner at the draft (" + Number(it.chars).toLocaleString("en-US") + " characters). No worker sees it.";
|
|
3384
|
+
list.appendChild(note);
|
|
3385
|
+
hints.forEach(function(h){
|
|
3386
|
+
var hint = document.createElement("div");
|
|
3387
|
+
hint.className = "audit-table-scroll";
|
|
3388
|
+
hint.setAttribute("data-testid", "audit-learnings-hint-" + it.phase + "-" + h.n);
|
|
3389
|
+
var table = document.createElement("table");
|
|
3390
|
+
table.className = "rounds-table learn-hint";
|
|
3391
|
+
var tbody = document.createElement("tbody");
|
|
3392
|
+
var trT = document.createElement("tr");
|
|
3393
|
+
var title = document.createElement("td");
|
|
3394
|
+
title.setAttribute("colspan", "2");
|
|
3395
|
+
title.style.cssText = "font-weight:600;overflow-wrap:anywhere";
|
|
3396
|
+
title.setAttribute("data-testid", "audit-learnings-hint-" + it.phase + "-" + h.n + "-title");
|
|
3397
|
+
title.textContent = learnHintLabel(h);
|
|
3398
|
+
trT.appendChild(title);
|
|
3399
|
+
tbody.appendChild(trT);
|
|
3400
|
+
var t = "audit-learnings-hint-" + it.phase + "-" + h.n + "-";
|
|
3401
|
+
if(h.said) learnRow(tbody, t + "said", "It said:", [h.said]);
|
|
3402
|
+
if(h.touched) learnRow(tbody, t + "touched", "Fix touched:", [h.touched]);
|
|
3403
|
+
if(h.changed && h.changed.length) learnRow(tbody, t + "changed", "What changed:", h.changed.concat(h.moreChanged ? ["(+" + h.moreChanged + " more)"] : []));
|
|
3404
|
+
table.appendChild(tbody);
|
|
3405
|
+
hint.appendChild(table);
|
|
3406
|
+
list.appendChild(hint);
|
|
3407
|
+
});
|
|
3408
|
+
function paintLearn(open){ list.hidden = !open; head.setAttribute("aria-expanded", open ? "true" : "false"); }
|
|
3409
|
+
function toggleLearn(){ var open = list.hidden; auditExpanded["\u0000learnings"] = open; paintLearn(open); } // folded on open; a re-render keeps what you chose for this run
|
|
3410
|
+
if(auditExpanded["\u0000learnings"] === true) paintLearn(true);
|
|
3411
|
+
head.addEventListener("click", toggleLearn);
|
|
3412
|
+
wrap.appendChild(head); wrap.appendChild(list);
|
|
3413
|
+
box.appendChild(wrap);
|
|
3414
|
+
}
|
|
3289
3415
|
function renderAuditGroups(result){
|
|
3290
3416
|
var runKey = currentFlow + "/" + currentRunId;
|
|
3291
3417
|
if(auditExpandedRun !== runKey){ auditExpanded = {}; auditExpandedRun = runKey; }
|
|
@@ -3437,6 +3563,7 @@
|
|
|
3437
3563
|
// says why" — checked against whichever view is actually on screen.
|
|
3438
3564
|
function paintAudit(result){
|
|
3439
3565
|
var anyGrouped = renderAuditGroups(result);
|
|
3566
|
+
renderAuditLearnings(result);
|
|
3440
3567
|
var anyFlat = renderAuditFlat(result);
|
|
3441
3568
|
var filterEmpty = document.getElementById("audit-filter-empty");
|
|
3442
3569
|
var nothingMatched = auditViewMode === "flat" ? !anyFlat : !anyGrouped;
|
|
@@ -3459,11 +3586,12 @@
|
|
|
3459
3586
|
var content = document.getElementById("audit-content");
|
|
3460
3587
|
lastAuditResult = result;
|
|
3461
3588
|
// a run with no audit rows yet still has its Draft: say so in words, and show the card
|
|
3462
|
-
var hasDraft = !!(result && (result.draft || result.schedule || result.needsLeft));
|
|
3589
|
+
var hasDraft = !!(result && (result.draft || result.schedule || result.needsLeft || (result.learnings && result.learnings.length)));
|
|
3463
3590
|
if(!result || (result.empty && !hasDraft)){
|
|
3464
3591
|
empty.hidden = false;
|
|
3465
3592
|
empty.textContent = (result && result.why) || "no audit rows for this run";
|
|
3466
3593
|
content.hidden = true;
|
|
3594
|
+
document.getElementById("audit-learnings").hidden = true; // M8 item 6: a run with nothing to show keeps no box of the run before
|
|
3467
3595
|
return;
|
|
3468
3596
|
}
|
|
3469
3597
|
empty.hidden = !result.empty;
|
|
@@ -3633,9 +3761,9 @@
|
|
|
3633
3761
|
document.getElementById("details-cap").textContent =
|
|
3634
3762
|
(typeof job.capUsd === "number" ? ("$" + job.capUsd.toFixed(2)) : "unknown")
|
|
3635
3763
|
+ " per run" + (waitText ? " · " + waitText : "") + " · redo up to " + (typeof job.redoCap === "number" ? job.redoCap : "unknown");
|
|
3636
|
-
// review #5: "
|
|
3764
|
+
// review #5: "Inputs" — role -> the full signed path (a web address shows its address), by hamr 2026-10-24.
|
|
3637
3765
|
renderRowsField("details-sources", job.sources, "no signed sources", function(s){
|
|
3638
|
-
return s.role + " → " + s.
|
|
3766
|
+
return s.role + " → " + s.path;
|
|
3639
3767
|
});
|
|
3640
3768
|
// review #5: "Destination" — one row per signed send.
|
|
3641
3769
|
renderRowsField("details-sends", job.sends, "no signed sends", function(s){
|
|
@@ -4292,7 +4420,11 @@
|
|
|
4292
4420
|
return reloadRun(ctx.flow, ctx.runId);
|
|
4293
4421
|
}).then(function(){ if(root.isConnected) setBusy(root, false); });
|
|
4294
4422
|
}
|
|
4423
|
+
// 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.
|
|
4424
|
+
var reopenOut = false;
|
|
4295
4425
|
function sendReopen(root, ctx, askId){
|
|
4426
|
+
if(reopenOut) return;
|
|
4427
|
+
reopenOut = true;
|
|
4296
4428
|
say(ctx.flow, ctx.runId, "info", "reopening…");
|
|
4297
4429
|
setBusy(root, true);
|
|
4298
4430
|
postJSON("/api/reopen", { flow: ctx.flow, runId: ctx.runId, askId: askId }).then(function(r){
|
|
@@ -4306,7 +4438,7 @@
|
|
|
4306
4438
|
}).catch(function(e){
|
|
4307
4439
|
say(ctx.flow, ctx.runId, "refused", networkText());
|
|
4308
4440
|
return reloadRun(ctx.flow, ctx.runId);
|
|
4309
|
-
}).then(function(){ if(root.isConnected) setBusy(root, false); });
|
|
4441
|
+
}).then(function(){ reopenOut = false; if(root.isConnected) setBusy(root, false); });
|
|
4310
4442
|
}
|
|
4311
4443
|
// 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.
|
|
4312
4444
|
function makeRemoveNeedsButton(flow, runId, after){
|
|
@@ -4432,6 +4564,12 @@
|
|
|
4432
4564
|
sheetBox.innerHTML = resultSheetBlock(evidence.sheet.block) + resultField("Answer", '<div class="ro-value" data-testid="ask-sheet-answers">' +
|
|
4433
4565
|
(evidence.sheet.answer || []).map(function(t){ return '<div data-testid="ask-sheet-answer">' + escapeXml(t) + '</div>'; }).join("") + '</div>');
|
|
4434
4566
|
ev.appendChild(sheetBox);
|
|
4567
|
+
} else if(evidence.cited){
|
|
4568
|
+
// 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
|
|
4569
|
+
var citedBox = document.createElement("div");
|
|
4570
|
+
citedBox.setAttribute("data-testid", "ask-cited");
|
|
4571
|
+
citedBox.innerHTML = resultFactsLine(evidence.cited);
|
|
4572
|
+
ev.appendChild(citedBox);
|
|
4435
4573
|
} else {
|
|
4436
4574
|
ev.appendChild(textDiv("hint", evidence.why || "no draft on file"));
|
|
4437
4575
|
}
|
|
@@ -4451,7 +4589,13 @@
|
|
|
4451
4589
|
}
|
|
4452
4590
|
var art = document.createElement("div");
|
|
4453
4591
|
art.className = "ro-value scroll";
|
|
4454
|
-
if(typeof u.text === "string"){ fillArtifactText(art, u.text); }
|
|
4592
|
+
if(typeof u.text === "string"){ fillArtifactText(art, u.text); }
|
|
4593
|
+
else if(u.cells && typeof u.cells === "object"){
|
|
4594
|
+
// a step that leaves fields, not prose: one line per field, "name: value" (textContent, so every value is escaped)
|
|
4595
|
+
art.style.whiteSpace = "pre-wrap";
|
|
4596
|
+
art.setAttribute("data-testid", "ask-unjudged-cells");
|
|
4597
|
+
art.textContent = Object.keys(u.cells).map(function(k){ return k + ": " + String(u.cells[k]); }).join("\n");
|
|
4598
|
+
} else { art.textContent = "no artifact text on file"; }
|
|
4455
4599
|
ev.appendChild(art);
|
|
4456
4600
|
});
|
|
4457
4601
|
return ev;
|
|
@@ -5326,8 +5470,10 @@
|
|
|
5326
5470
|
refreshCapNote(); fitCardBoxes();
|
|
5327
5471
|
doDraft(null);
|
|
5328
5472
|
}
|
|
5329
|
-
// the card stops reusing: the name box is free again
|
|
5473
|
+
// the card stops reusing: the name box is free again. ONE owner: reuseOf and the boxes startReuseDraft filled go together, so a card that
|
|
5474
|
+
// left Reuse (a refused signed start too) can never be drafted as a plain new job carrying the old job and name
|
|
5330
5475
|
function leaveReuse(){
|
|
5476
|
+
if(reuseOf !== null){ ["jf-name", "jf-job", "jf-cap-money", "jf-dest-folder", "jf-inputs"].forEach(function(id){ byId(id).value = ""; }); askWaitEl.value = "1h"; }
|
|
5331
5477
|
reuseOf = null;
|
|
5332
5478
|
editBannerEl.hidden = true; editBannerEl.textContent = "";
|
|
5333
5479
|
}
|
|
@@ -5354,7 +5500,7 @@
|
|
|
5354
5500
|
runDestEl.readOnly = !(f && f.hasSend);
|
|
5355
5501
|
runDestEl.classList.toggle("locked", !(f && f.hasSend));
|
|
5356
5502
|
byId("jf-run-dest-hint").textContent = !f ? "" : (f.hasSend ? "Where the accepted result is placed, at the last step. A different folder is signed for this run only." : "This flow has no send step, so there is no destination to set.");
|
|
5357
|
-
runCapEl.value =
|
|
5503
|
+
runCapEl.value = f ? String(f.values.capUsd) : ""; // M6 am11: the job's SIGNED cap, never what an earlier run was capped at after drafting (v)
|
|
5358
5504
|
runWaitsEl.innerHTML = "";
|
|
5359
5505
|
Object.keys((v && v.askWaits) || {}).forEach(function(line){
|
|
5360
5506
|
var row = document.createElement("div");
|
|
@@ -6154,7 +6300,7 @@
|
|
|
6154
6300
|
});
|
|
6155
6301
|
document.querySelectorAll('input[name="jf-mode"]').forEach(function(r){
|
|
6156
6302
|
r.addEventListener("change", function(){
|
|
6157
|
-
if(r.checked && reuseOf !== null && r.value !== "new" && !sessionLive){ leaveReuse();
|
|
6303
|
+
if(r.checked && reuseOf !== null && r.value !== "new" && !sessionLive){ leaveReuse(); }
|
|
6158
6304
|
if(r.checked) setMode(r.value);
|
|
6159
6305
|
});
|
|
6160
6306
|
});
|
package/src/panel/result.js
CHANGED
|
@@ -18,7 +18,7 @@ import { NOT_CHECKED_LABEL } from '../checked.js';
|
|
|
18
18
|
import { checkSendDestination } from '../runner.js';
|
|
19
19
|
import { isAgree, readingOfQuestion } from '../pageask.js';
|
|
20
20
|
import { lineRules } from '../pagebits.js';
|
|
21
|
-
import {
|
|
21
|
+
import { readLineSection, LINE_CHECKS_FILE } from '../line-checks.js';
|
|
22
22
|
import { readChecks } from '../diary.js';
|
|
23
23
|
import { sheetLineBlocks, csvRolesOf } from '../sheetblock.js';
|
|
24
24
|
import { readSheetChecks } from '../sheet-record.js';
|
|
@@ -33,8 +33,6 @@ export const RESULT_YOU_CONFIRMED = '(you confirmed)';
|
|
|
33
33
|
/** the Your-call card's words (bareloop server.js@2959217 DOOR_WORDS.waiting.head and RESULT_DOOR_ASK); the page types none of them */
|
|
34
34
|
export const RESULT_DOOR_HEAD = 'waiting for you';
|
|
35
35
|
export const RESULT_DOOR_ASK = 'the checks passed; is this what you wanted?';
|
|
36
|
-
/** the M10 cited-check record, in the run's own folder: `writeCitedLine` (src/cited-record.js) is its one writer, `readCitedChecks` its one reader. */
|
|
37
|
-
export { CITED_CHECKS_FILE };
|
|
38
36
|
|
|
39
37
|
/** end-row outcomes that are not a failure of the job */
|
|
40
38
|
const NOT_FAILED = new Set(['complete', 'stopped', 'cap-halt', 'rerun', 'ask-expired']);
|
|
@@ -78,7 +76,7 @@ function readProof(p) {
|
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
/**
|
|
81
|
-
* The ONE reader of the M10 cited-check record (`<run>/
|
|
79
|
+
* The ONE reader of the M10 cited-check record (the `cited` section of `<run>/line-checks.json`, src/line-checks.js; `writeCitedLine`, src/cited-record.js, writes it). Expected shape (typed, nothing parsed out of prose):
|
|
82
80
|
* { lines: [ { n: int, source: string (the role of a signed source), passed: boolean,
|
|
83
81
|
* facts: [ { name: string, kind: 'phrase'|'value', sentence: string, confirmed?: true } ],
|
|
84
82
|
* rows: [ { n: int, quote: string, cells: string[] (one per fact), proof?: { text: string, marks: [[start, end], ...] } } ] | null,
|
|
@@ -88,15 +86,12 @@ function readProof(p) {
|
|
|
88
86
|
* @returns {{present: false}|{present: true, ok: false, red: string}|{present: true, ok: true, lines: any[]}}
|
|
89
87
|
*/
|
|
90
88
|
export function readCitedChecks(runDir) {
|
|
91
|
-
const r =
|
|
89
|
+
const r = readLineSection(runDir, 'cited');
|
|
92
90
|
if (!r.ok) return r.missing ? { present: false } : { present: true, ok: false, red: r.red };
|
|
93
91
|
/** @param {string} why @returns {{present: true, ok: false, red: string}} */
|
|
94
|
-
const red = (why) => ({ present: true, ok: false, red: `${
|
|
95
|
-
let rec;
|
|
96
|
-
try { rec = JSON.parse(r.text); } catch { return red('not valid JSON'); }
|
|
97
|
-
if (!rec || !Array.isArray(rec.lines)) return red('"lines" is not a list');
|
|
92
|
+
const red = (why) => ({ present: true, ok: false, red: `${LINE_CHECKS_FILE} (cited): ${why}` });
|
|
98
93
|
const lines = [];
|
|
99
|
-
for (const l of
|
|
94
|
+
for (const l of r.lines) {
|
|
100
95
|
if (!l || !isInt(l.n) || !isStr(l.source)) return red('a line needs an integer "n" and a "source"');
|
|
101
96
|
if (typeof l.passed !== 'boolean') return red(`line ${l.n}: "passed" is not true or false`);
|
|
102
97
|
if (!Array.isArray(l.facts)) return red(`line ${l.n}: "facts" is not a list`);
|
|
@@ -199,7 +194,7 @@ export function deliveredOf({
|
|
|
199
194
|
}
|
|
200
195
|
|
|
201
196
|
/**
|
|
202
|
-
* M10 am9 item 2: the checks one job line's step(s) ran, from the run's own check record (`
|
|
197
|
+
* M10 am9 item 2: the checks one job line's step(s) ran, from the run's own check record (`diary.jsonl` rows of kind checks, written by code at every try), each step's NEWEST
|
|
203
198
|
* try, in the Audit try line's words (`text`, `result`). Never the AI's words. A line no step ran (an ask, a send) has none.
|
|
204
199
|
* @param {any[]} stepsOfLine the declaration's steps for the line @param {any[]} diary `readChecks(runDir)`
|
|
205
200
|
* @returns {{ok: boolean, text: string, result: string|null}[]}
|
|
@@ -237,7 +232,7 @@ export function buildResult({
|
|
|
237
232
|
// am9: a page job's card is bareloop's (no checks list); every other job lists what each step checked
|
|
238
233
|
const diary = urls.size === 0 ? readChecks(runDir) : [];
|
|
239
234
|
// 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
|
|
235
|
+
// the sheet section of line-checks.json; it is there with no rows found and when the result is written to a doc
|
|
241
236
|
const sheetBlocks = sheetLineBlocks({ declaration, lines: flowRead.lines, csvRoles: csvRolesOf(arbiter), record: readSheetChecks(runDir) });
|
|
242
237
|
const lines = flowRead.lines.filter((l) => !taken.has(l.n)).map((l) => {
|
|
243
238
|
const c = record.find((x) => x.n === l.n) ?? null;
|