bareloop 0.55.0 → 0.57.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/CHANGELOG.md +82 -0
- package/README.md +3 -3
- package/bareloop.context.md +69 -209
- package/package.json +2 -2
- package/src/authorflow.js +164 -340
- package/src/authoring.js +7 -127
- package/src/authorjob.js +139 -472
- package/src/authorreadout.js +24 -368
- package/src/authorrun.js +21 -215
- package/src/behaviour.js +14 -0
- package/src/blockasks.js +43 -0
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +798 -0
- package/src/checklist.js +128 -0
- package/src/checkpick.js +39 -312
- package/src/checkwords.js +3 -1
- package/src/cli.js +3 -3
- package/src/declaredclose.js +38 -108
- package/src/destpoint.js +4 -2
- package/src/draftspend.js +46 -0
- package/src/facts.js +8 -1
- package/src/index.js +3 -43
- package/src/interviewrun.js +13 -8
- package/src/job.js +20 -1
- package/src/jobblock.js +11 -46
- package/src/judged.js +13 -1229
- package/src/kinds.js +5 -347
- package/src/noteask.js +124 -0
- package/src/pagedry.js +27 -5
- package/src/pagemap.js +15 -3
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +24 -6
- package/src/panel/authorsession.js +222 -177
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +198 -26
- package/src/panel/jobplan.js +87 -33
- package/src/panel/server.js +74 -68
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +34 -55
- package/src/placerule.js +355 -0
- package/src/planrun.js +2 -48
- package/src/promptregisters.js +13 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +104 -0
- package/src/rowedit.js +115 -0
- package/src/rubricstep.js +234 -127
- package/src/run.js +11 -16
- package/src/userrun.js +60 -112
- package/types/authorflow.d.ts +41 -197
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +35 -59
- package/types/authorreadout.d.ts +10 -88
- package/types/behaviour.d.ts +12 -0
- package/types/blockasks.d.ts +36 -0
- package/types/checkblock.d.ts +376 -0
- package/types/checklist.d.ts +134 -0
- package/types/checkpick.d.ts +8 -140
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +7 -33
- package/types/destpoint.d.ts +2 -0
- package/types/draftspend.d.ts +21 -0
- package/types/index.d.ts +2 -4
- package/types/job.d.ts +8 -0
- package/types/jobblock.d.ts +8 -38
- package/types/judged.d.ts +7 -357
- package/types/kinds.d.ts +3 -104
- package/types/noteask.d.ts +76 -0
- package/types/pagedry.d.ts +13 -0
- package/types/pagemap.d.ts +4 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +47 -5
- package/types/panel/jobgrid.d.ts +8 -8
- package/types/panel/jobplan.d.ts +48 -10
- package/types/panel/server.d.ts +27 -18
- package/types/panel/status.d.ts +5 -0
- package/types/pickrecord.d.ts +20 -13
- package/types/placerule.d.ts +194 -0
- package/types/planrun.d.ts +1 -22
- package/types/providerrows.d.ts +0 -31
- package/types/providers.d.ts +3 -19
- package/types/questionbox.d.ts +87 -0
- package/types/rowedit.d.ts +32 -0
- package/types/rubricstep.d.ts +100 -48
- package/types/run.d.ts +9 -19
- package/types/userrun.d.ts +0 -1
- package/src/calibrate.js +0 -702
- package/src/cardauthor.js +0 -502
- package/src/fitcheck.js +0 -166
- package/types/calibrate.d.ts +0 -201
- package/types/cardauthor.d.ts +0 -358
- package/types/fitcheck.d.ts +0 -113
package/src/panel/jobplan.js
CHANGED
|
@@ -4,21 +4,26 @@
|
|
|
4
4
|
//
|
|
5
5
|
// { lines: [{n, text, rule, rules: [string...], checks: [{name, cls}], refused: [reason...]}],
|
|
6
6
|
// loose: [{name, cls}], checks that name no job line (an older caller, or a model slip)
|
|
7
|
-
// notChecked: [text...], "
|
|
7
|
+
// notChecked: [text...], "Not checked" — what nothing checks
|
|
8
|
+
// notCheckedBy: {text: 'you'|'agent'|'default'}, the tag of a Not checked row, by its row's kind (a refused line under a job line is keyed by its text too)
|
|
8
9
|
// alwaysOn: [text...], the mandatory guards / protections, which serve no job line
|
|
9
10
|
// older: boolean } an older job: the numbered lines were not saved
|
|
10
11
|
//
|
|
11
12
|
// `cls` is 'machine check' | 'judge' | null (null = not known yet: the confirm card's checks are the model's plan, the
|
|
12
13
|
// stage kinds exist only after drafting). Pure; no file IO.
|
|
14
|
+
import { NOT_REACHED } from './status.js';
|
|
13
15
|
import { ticketFilterWords } from '../ticketfilter.js';
|
|
14
16
|
import { KIND_CATALOGUE } from '../authoring.js';
|
|
17
|
+
import { WEEK_ONLY_WORDS } from '../checklist.js';
|
|
15
18
|
import { splitReadNotes } from '../pagedropwords.js';
|
|
16
|
-
import { checksOfClose, signedFactNames, proseNotChecked, lineRules, confirmedGoalOf } from '../rubricstep.js';
|
|
19
|
+
import { checksOfClose, signedFactNames, proseNotChecked, lineRules, confirmedGoalOf, refusedOf, listRowName, ruleNotCheckedItems } from '../rubricstep.js';
|
|
17
20
|
|
|
18
21
|
/** `by` = who added the check: the drafter (`agent`) or the person's own pick (`you`); absent = code's own (an always-on guard, a number tie) or not known */
|
|
19
|
-
/**
|
|
22
|
+
/** `stage` = the signed close stage the row belongs to (its recorded verdict is the row's result in the Audit) */
|
|
23
|
+
/** @typedef {{text: string, by: 'agent'|'you'|'default'|null, result: 'passed'|'failed'|'none'|'not-reached'|'not-checked'|'held'|'record-missing', word?: string}} AuditRow */
|
|
24
|
+
/** @typedef {{name: string, cls: 'machine check'|'judge'|null, by?: 'agent'|'you'|'default'|null, key?: string, stage?: string}} PlanCheck */
|
|
20
25
|
/** @typedef {{n: number, text: string, rule: string, rules: string[], checks: PlanCheck[], refused: string[], always?: string[], picked?: string[]}} PlanLine */
|
|
21
|
-
/** @typedef {{lines: PlanLine[], loose: PlanCheck[], notChecked: string[], readNotes: string[], alwaysOn: string[], older: boolean, goal?: string, ticketFilter?: string}} JobPlan */
|
|
26
|
+
/** @typedef {{lines: PlanLine[], loose: PlanCheck[], notChecked: string[], readNotes: string[], alwaysOn: string[], older: boolean, goal?: string, ticketFilter?: string, notCheckedBy?: Record<string, 'you'|'agent'|'default'>, suggested?: {key: string, line: number, text: string}[], editable?: boolean}} JobPlan */
|
|
22
27
|
|
|
23
28
|
/** the ticket filter's code-owned words as a plan part, or nothing (R5) @param {any} f @returns {{ticketFilter?: string}} */
|
|
24
29
|
function filterPart(f) {
|
|
@@ -39,26 +44,18 @@ export function checkClassOfKind(kind) {
|
|
|
39
44
|
return spec.verdictClass === 'green' ? 'machine check' : 'judge';
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
/**
|
|
43
|
-
* The `~` rules of one job line, each on its own (the page draws one `~` row per rule): the line's own `rules` array when it
|
|
44
|
-
* has one (a rule may itself contain "; "), else the joined `rule` split on "; " (an older line that saved only the join).
|
|
45
|
-
* @param {any} l @returns {string[]}
|
|
46
|
-
*/
|
|
47
|
-
export function rulesOfLine(l) {
|
|
48
|
-
if (Array.isArray(l?.rules)) return l.rules.filter((/** @type {unknown} */ r) => typeof r === 'string' && r);
|
|
49
|
-
return typeof l?.rule === 'string' && l.rule ? l.rule.split('; ').filter(Boolean) : [];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
47
|
/**
|
|
53
48
|
* The plan of a SIGNED spec. With `jobLines`, each stage lands under EACH line its `fromLine` array names (a stage with none is
|
|
54
49
|
* a mandatory guard: "Always checked"), `closeDecl.refused` reasons land under their line, and `closeDecl.notes` are the
|
|
55
50
|
* drafter's own "not checked" words. Without `jobLines` (a spec that predates the job block) the signed goal sentence is
|
|
56
51
|
* line 1 and every stage name is a check under it — `older: true`.
|
|
52
|
+
* `ledger` = the draft log's final check-list rows (`readDraftLedger`), the words a Not checked row is named by; absent (no draft log) a row is named from its key.
|
|
57
53
|
* @param {any} spec
|
|
54
|
+
* @param {{key: string, words: string[]}[]|null} [ledger]
|
|
58
55
|
* @returns {JobPlan}
|
|
59
56
|
*/
|
|
60
|
-
export function planFromSpec(spec) {
|
|
61
|
-
/** @type {{name: string, cls: 'machine check'|'judge'|null, fromLine: number[]|null, by?: 'agent'|'you'|null}[]} */
|
|
57
|
+
export function planFromSpec(spec, ledger = null) {
|
|
58
|
+
/** @type {{name: string, cls: 'machine check'|'judge'|null, fromLine: number[]|null, by?: 'agent'|'you'|'default'|null, stage?: string}[]} */
|
|
62
59
|
let stages = [];
|
|
63
60
|
if (spec && Array.isArray(spec.closeDecl?.stages)) {
|
|
64
61
|
stages = spec.closeDecl.stages.filter((/** @type {any} */ s) => s && typeof s.name === 'string' && s.name)
|
|
@@ -66,8 +63,8 @@ export function planFromSpec(spec) {
|
|
|
66
63
|
const fromLine = Array.isArray(s.fromLine) && s.fromLine.length ? s.fromLine.filter(Number.isInteger) : null;
|
|
67
64
|
// PART 1b: a rubric-step stage is shown as the checks it RUNS — one code-worded row per fact, per count, per limit — read by
|
|
68
65
|
// the same reader (`checksOfClose`) the confirm card and the sign-time invariant use, so the Job tab cannot differ from them
|
|
69
|
-
const rows = s.kind === 'rubric-step' ? checksOfClose({ stages: [s], picks: spec.closeDecl.picks }) : [];
|
|
70
|
-
return rows.length > 0 ? rows.map((r) => ({ name: r.text, cls: /** @type {'machine check'} */ ('machine check'), fromLine, by: r.by })) : [{ name: s.name, cls: checkClassOfKind(s.kind), fromLine, by: /** @type {'agent'} */ ('agent') }];
|
|
66
|
+
const rows = s.kind === 'rubric-step' ? checksOfClose({ stages: [s], picks: spec.closeDecl.picks, list: spec.closeDecl.list }) : [];
|
|
67
|
+
return rows.length > 0 ? rows.map((r) => ({ name: r.text, cls: /** @type {'machine check'} */ ('machine check'), fromLine, by: r.by, stage: s.name })) : [{ name: s.name, cls: checkClassOfKind(s.kind), fromLine, by: /** @type {'agent'} */ ('agent'), stage: s.name }];
|
|
71
68
|
});
|
|
72
69
|
} else if (spec && Array.isArray(spec.close)) {
|
|
73
70
|
stages = spec.close.filter((/** @type {any} */ s) => s && typeof s.name === 'string' && s.name)
|
|
@@ -91,41 +88,53 @@ export function planFromSpec(spec) {
|
|
|
91
88
|
};
|
|
92
89
|
}
|
|
93
90
|
/** @type {PlanLine[]} */
|
|
94
|
-
const lines = jl.map((/** @type {any} */ l) => ({ n: l.n, text: l.text, rule: typeof l.rule === 'string' ? l.rule : '', rules:
|
|
91
|
+
const lines = jl.map((/** @type {any} */ l) => ({ n: l.n, text: l.text, rule: typeof l.rule === 'string' ? l.rule : '', rules: lineRules(l), checks: [], refused: [] }));
|
|
95
92
|
/** @type {PlanCheck[]} */
|
|
96
93
|
const loose = [];
|
|
97
94
|
/** @type {string[]} */
|
|
98
95
|
const alwaysOn = [];
|
|
96
|
+
/** Not checked rows tagged by their row's kind (F-c): `[you]` a rule the person wrote, `[agent]` the agent's, `[default]` code's @type {Record<string, 'you'|'agent'|'default'>} */
|
|
97
|
+
const refusedBy = {};
|
|
99
98
|
for (const s of stages) {
|
|
100
99
|
if (s.fromLine === null) { alwaysOn.push(s.name); continue; }
|
|
101
100
|
// a check that serves several job lines is shown under EACH line it serves (no new element: the same check line, repeated)
|
|
102
101
|
const served = lines.filter((l) => /** @type {number[]} */ (s.fromLine).includes(l.n));
|
|
103
|
-
for (const line of served) line.checks.push({ name: s.name, cls: s.cls, ...(s.by ? { by: s.by } : {}) });
|
|
104
|
-
if (served.length === 0) loose.push({ name: s.name, cls: s.cls, ...(s.by ? { by: s.by } : {}) });
|
|
102
|
+
for (const line of served) line.checks.push({ name: s.name, cls: s.cls, ...(s.by ? { by: s.by } : {}), ...(s.stage ? { stage: s.stage } : {}) });
|
|
103
|
+
if (served.length === 0) loose.push({ name: s.name, cls: s.cls, ...(s.by ? { by: s.by } : {}), ...(s.stage ? { stage: s.stage } : {}) });
|
|
105
104
|
}
|
|
106
105
|
// an always-on guard that the drafter said covers a job line is shown under that line too ("› check · always-on: <guard>")
|
|
107
106
|
for (const g of Array.isArray(spec?.closeDecl?.guardLines) ? spec.closeDecl.guardLines : []) {
|
|
108
107
|
if (!g || typeof g.guard !== 'string' || !Array.isArray(g.lines)) continue;
|
|
109
108
|
for (const line of lines.filter((l) => g.lines.includes(l.n))) (line.always ??= []).push(g.guard);
|
|
110
109
|
}
|
|
111
|
-
const
|
|
112
|
-
for (const r of refused) {
|
|
110
|
+
for (const r of refusedOf(spec?.closeDecl)) {
|
|
113
111
|
const line = lines.find((l) => l.n === r?.line);
|
|
114
|
-
// a refusal of ONE ~ rule (PART 1b, RF16) names the rule in the person's words, so the row reads as that rule's Not checked
|
|
115
|
-
const ruleText = line && Number.isInteger(r.rule) ? lineRules(spec.jobLines.find((/** @type {any} */ l) => l?.n === r.line))[r.rule - 1] : null;
|
|
116
|
-
|
|
112
|
+
// a refusal of ONE ~ rule (PART 1b, RF16) names the rule in the person's words, so the row reads as that rule's Not checked; a list row of another kind names its fact when it has one
|
|
113
|
+
const ruleText = line && Number.isInteger(r.rule) ? lineRules(spec.jobLines.find((/** @type {any} */ l) => l?.n === r.line))[Number(r.rule) - 1] : (r.label ?? null);
|
|
114
|
+
// a list row that is not a fact or a rule (a phrase, a count) is named by its words: the draft log's, else the text after the key's kind prefix
|
|
115
|
+
const named = line && !ruleText && r.fromList && r.key ? listRowName(r.kind, r.key, ledger?.find((x) => x.key === r.key)?.words) : null;
|
|
116
|
+
const text = ruleText ? `"${ruleText}" — ${r.reason}` : (named ? `${named} — ${r.reason}` : r.reason);
|
|
117
|
+
if (line) { line.refused.push(text); if (r.by) refusedBy[text] = r.by; }
|
|
118
|
+
}
|
|
119
|
+
// a row the list dropped because it names a version or a date from the input is told, with its reason (the signed card preview, A11); other dropped rows are not drawn
|
|
120
|
+
for (const r of Array.isArray(spec?.closeDecl?.list) ? spec.closeDecl.list : []) {
|
|
121
|
+
if (!r || r.state !== 'dropped' || r.reason !== WEEK_ONLY_WORDS || typeof r.key !== 'string' || r.kind === 'rule') continue;
|
|
122
|
+
const line = lines.find((l) => l.n === r.line);
|
|
123
|
+
if (line) line.refused.push(`${listRowName(r.kind, r.key, ledger?.find((x) => x.key === r.key)?.words)} — ${r.reason}`);
|
|
117
124
|
}
|
|
125
|
+
const notCheckedBy = { ...refusedBy };
|
|
126
|
+
for (const i of ruleNotCheckedItems(spec?.closeDecl, spec?.jobLines, ledger)) if (i.by) notCheckedBy[i.text] = i.by;
|
|
118
127
|
// the model's signed goal sentence rides along: the page draws it as the "AI's summary" row (an older job shows it as line 1 instead)
|
|
119
128
|
// (a rubric job's signed goal is the whole worker brief: only the sentence the person confirmed is the summary)
|
|
120
129
|
const summary = typeof spec?.goal === 'string' && spec.goal ? confirmedGoalOf(spec.goal) : null;
|
|
121
|
-
return { lines, loose, notChecked: notes, readNotes, alwaysOn, older: false, ...(summary ? { goal: summary } : {}), ...filterPart(spec?.ticketFilter) };
|
|
130
|
+
return { lines, loose, notChecked: notes, readNotes, alwaysOn, older: false, ...(Object.keys(notCheckedBy).length ? { notCheckedBy } : {}), ...(summary ? { goal: summary } : {}), ...filterPart(spec?.ticketFilter) };
|
|
122
131
|
}
|
|
123
132
|
|
|
124
133
|
/**
|
|
125
134
|
* The plan of the confirm turn, before anything is drafted: the person's own job lines, the model's checks under the
|
|
126
135
|
* line each names, its own "not checked" words, and the real protections (code-owned) as "Always checked".
|
|
127
136
|
* @param {{n: number, text: string, rule: string, rules?: string[]}[]|null|undefined} jobLines
|
|
128
|
-
* @param {{checkItems?: {text: string, fromLine: number[]|null, by?: 'agent'|'you'|null}[], checks?: string[], notChecked?: string[], protections?: string[], signedFacts?: string[], ticketFilter?: any, picked?: {line: number, text: string}[]}} plan
|
|
137
|
+
* @param {{checkItems?: {text: string, fromLine: number[]|null, by?: 'agent'|'you'|'default'|null, key?: string}[], checks?: string[], notChecked?: string[], protections?: string[], signedFacts?: string[], ticketFilter?: any, picked?: {line: number, text: string}[], notCheckedBy?: Record<string, 'you'|'agent'|'default'>, suggested?: {key: string, line: number, text: string}[], editable?: boolean}} plan
|
|
129
138
|
* `signedFacts` = the names of the facts the look signs (so an S1 copy of a signed fact reads as a note, not Not checked)
|
|
130
139
|
* @returns {JobPlan}
|
|
131
140
|
*/
|
|
@@ -135,16 +144,17 @@ export function planFromConfirm(jobLines, plan) {
|
|
|
135
144
|
: (Array.isArray(plan?.checks) ? plan.checks.map((c) => ({ text: String(c), fromLine: null })) : []);
|
|
136
145
|
const jl = Array.isArray(jobLines) ? jobLines : [];
|
|
137
146
|
/** @type {PlanLine[]} */
|
|
138
|
-
const lines = jl.map((l) => ({ n: l.n, text: l.text, rule: l.rule, rules:
|
|
147
|
+
const lines = jl.map((l) => ({ n: l.n, text: l.text, rule: l.rule, rules: lineRules(l), checks: [], refused: [] }));
|
|
139
148
|
/** @type {PlanCheck[]} */
|
|
140
149
|
const loose = [];
|
|
141
150
|
// the person's picks are drawn once, from `plan.picked` (their words, with `kept from last draft`) as `[you picked]` check rows: a close row for the same pick is not a second row
|
|
142
151
|
const hasPicked = Array.isArray(plan?.picked) && plan.picked.length > 0;
|
|
143
|
-
for (const c of items.filter((x) => !(hasPicked && /** @type {any} */ (x).by === 'you'))) {
|
|
144
|
-
const by = /** @type {any} */ (c).by === null ? {} : { by: /** @type {'agent'|'you'} */ (/** @type {any} */ (c).by ?? 'agent') };
|
|
152
|
+
for (const c of items.filter((x) => !(hasPicked && /** @type {any} */ (x).by === 'you' && !(/** @type {any} */ (x).key)))) {
|
|
153
|
+
const by = /** @type {any} */ (c).by === null ? {} : { by: /** @type {'agent'|'you'|'default'} */ (/** @type {any} */ (c).by ?? 'agent') };
|
|
145
154
|
const served = lines.filter((l) => Array.isArray(c.fromLine) && c.fromLine.includes(l.n));
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
const key = typeof (/** @type {any} */ (c).key) === 'string' ? { key: /** @type {any} */ (c).key } : {};
|
|
156
|
+
for (const line of served) line.checks.push({ name: c.text, cls: null, ...by, ...key });
|
|
157
|
+
if (served.length === 0) loose.push({ name: c.text, cls: null, ...by, ...key });
|
|
148
158
|
}
|
|
149
159
|
const { notChecked, readNotes } = splitReadNotes(plan?.notChecked, plan?.signedFacts);
|
|
150
160
|
// R10 (fwd am16 (6)): the checks the person picked, each under its line, in the one table's plain words (`kept from last draft` rides in `text` when a Revise kept it)
|
|
@@ -154,5 +164,49 @@ export function planFromConfirm(jobLines, plan) {
|
|
|
154
164
|
}
|
|
155
165
|
return {
|
|
156
166
|
lines, loose, notChecked, readNotes, alwaysOn: [...(plan?.protections ?? [])], older: false, ...filterPart(plan?.ticketFilter),
|
|
167
|
+
...(plan?.notCheckedBy && typeof plan.notCheckedBy === 'object' && Object.keys(plan.notCheckedBy).length ? { notCheckedBy: plan.notCheckedBy } : {}),
|
|
168
|
+
...(Array.isArray(plan?.suggested) && plan.suggested.length ? { suggested: plan.suggested } : {}),
|
|
169
|
+
...(plan?.editable === true ? { editable: true } : {}),
|
|
157
170
|
};
|
|
158
171
|
}
|
|
172
|
+
|
|
173
|
+
/** the words of a row the run recorded no verdict for: never "passed" */
|
|
174
|
+
export const AUDIT_NO_RESULT = 'no result recorded';
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The Audit's check list (hamr ruling A, 2026-11-13): the SAME sections as the card, read from the SAME model (`plan` = {@link planFromSpec}'s, plus `guards` = the
|
|
178
|
+
* code-owned protections the confirm card shows), each row with its tag and, after the run, its result. A check's result is the recorded verdict of its own signed stage
|
|
179
|
+
* (`results`: stage name to passed), never re-derived; a row no verdict was recorded for says so. A Not checked row's result is "not checked" (its reason is in its words).
|
|
180
|
+
* The write fence is enforced per write by the gate, so its row reads the gate's own record of THIS run (hamr ruling A, 2026-11-13): `blocked` = the write/edit attempts the gate denied
|
|
181
|
+
* (`held · N writes blocked`), or `null` when the run's gate record is missing (said in plain words, never "held").
|
|
182
|
+
* @param {JobPlan} plan @param {string[]} guards @param {Map<string, boolean>|null} results @param {number|null} [blocked] @param {boolean} [closeRan] the results are a CLOSE's (the latest), so a declared stage missing from them was not reached (the close stops at its first red); else a stage no verdict was recorded for reads none
|
|
183
|
+
* @returns {{checks: AuditRow[], notChecked: AuditRow[], always: AuditRow[]}}
|
|
184
|
+
*/
|
|
185
|
+
export function auditChecksOf(plan, guards, results, blocked = null, closeRan = false) {
|
|
186
|
+
/** @param {string|undefined|null} stage @returns {'passed'|'failed'|'none'|'not-reached'} */
|
|
187
|
+
const verdict = (stage) => (!stage || !results ? 'none' : (!results.has(stage) ? (closeRan ? 'not-reached' : 'none') : (results.get(stage) ? 'passed' : 'failed')));
|
|
188
|
+
/** @type {AuditRow[]} */
|
|
189
|
+
const checks = [];
|
|
190
|
+
for (const l of plan.lines) for (const c of l.checks) checks.push({ text: `line ${l.n} · ${c.name}`, by: c.by ?? null, result: verdict(c.stage) });
|
|
191
|
+
for (const c of plan.loose) checks.push({ text: `other · ${c.name}`, by: c.by ?? null, result: verdict(c.stage) });
|
|
192
|
+
/** @type {AuditRow[]} */
|
|
193
|
+
const notChecked = [];
|
|
194
|
+
const by = plan.notCheckedBy ?? {};
|
|
195
|
+
for (const l of plan.lines) for (const r of l.refused) notChecked.push({ text: `line ${l.n} · ${r}`, by: by[r] ?? null, result: 'not-checked' });
|
|
196
|
+
for (const r of plan.notChecked) notChecked.push({ text: r, by: by[r] ?? null, result: 'not-checked' });
|
|
197
|
+
const names = guards.length > 0 ? guards : plan.alwaysOn;
|
|
198
|
+
const always = names.map((g) => {
|
|
199
|
+
const head = g.split(' — ')[0];
|
|
200
|
+
const file = /^line (\d+) file$/.exec(head);
|
|
201
|
+
// the write fence is held by the gate (the row reads the gate's own record, above), never another stage's verdict
|
|
202
|
+
const stage = file ? `line-${file[1]}` : (head === 'write fence' ? null : head);
|
|
203
|
+
if (head === 'write fence') {
|
|
204
|
+
return blocked === null
|
|
205
|
+
? { text: g, by: /** @type {'default'} */ ('default'), result: /** @type {'record-missing'} */ ('record-missing'), word: "the gate's record for this run is missing" }
|
|
206
|
+
: { text: g, by: /** @type {'default'} */ ('default'), result: /** @type {'held'} */ ('held'), word: `held · ${blocked} ${blocked === 1 ? 'write' : 'writes'} blocked` };
|
|
207
|
+
}
|
|
208
|
+
return { text: g, by: /** @type {'default'} */ ('default'), result: verdict(stage) };
|
|
209
|
+
});
|
|
210
|
+
for (const r of [...checks, ...always]) if (r.result === 'not-reached') r.word = NOT_REACHED.word;
|
|
211
|
+
return { checks, notChecked, always };
|
|
212
|
+
}
|
package/src/panel/server.js
CHANGED
|
@@ -39,7 +39,7 @@ import { checkExportable } from '../runexport.js';
|
|
|
39
39
|
import { sourceNearSpine, signedSpecForRun } from '../runfiles.js';
|
|
40
40
|
import { webFetchState } from '../source.js';
|
|
41
41
|
import { isWebUrl } from '../pagefetch.js';
|
|
42
|
-
import { draftingPartFor, sessionDirForRow, readDraftSteps } from '../draftspend.js';
|
|
42
|
+
import { draftingPartFor, sessionDirForRow, readDraftSteps, readDraftLedger } from '../draftspend.js';
|
|
43
43
|
import { readingOfQuestion, isAgree } from '../pagemap.js';
|
|
44
44
|
import {
|
|
45
45
|
replayOne, parseJsonl, resolveSiblings, isSidecarByName,
|
|
@@ -47,10 +47,11 @@ import {
|
|
|
47
47
|
import { summarizeForAllLine, auditWindowsOf, replayRun } from '../replay.js';
|
|
48
48
|
import { legsOf, legsWallMs, stopFilePath, capKindOf } from '../legs.js';
|
|
49
49
|
import { chainSpend } from '../ledger.js';
|
|
50
|
-
import { runBehaviour } from '../behaviour.js';
|
|
50
|
+
import { runBehaviour, writesBlocked } from '../behaviour.js';
|
|
51
51
|
import { SPEND_RECORD_TYPES, floorsFromRecords } from '../ledger.js';
|
|
52
52
|
import { jobSpecHash, workflowKey, flowTypeOf, FLOW_TYPE_LABELS } from '../job.js';
|
|
53
53
|
import { attachMemos, learningsHanded, attachLearnings } from './handed.js';
|
|
54
|
+
import { placeRuleLines } from '../placerule.js';
|
|
54
55
|
import { confirmProtections } from '../authorflow.js';
|
|
55
56
|
import { createScheduleDoor } from './schedules.js';
|
|
56
57
|
import { buildJobGrid } from './jobgrid.js';
|
|
@@ -73,7 +74,7 @@ import { SHAPES } from '../providershapes.js';
|
|
|
73
74
|
import { resolveProvider } from '../providers.js';
|
|
74
75
|
import { readResume, checkpointAgeGate, CHECKPOINT_OUTCOMES } from '../reuse.js';
|
|
75
76
|
import {
|
|
76
|
-
statusFor, partStatusFor, GOAL_MET_LINE, doorViewOf, ACTOR_MARKER, DOOR_WORDS, isReusableGreen, STATUS,
|
|
77
|
+
statusFor, partStatusFor, GOAL_MET_LINE, doorViewOf, ACTOR_MARKER, DOOR_WORDS, isReusableGreen, STATUS, NOT_REACHED,
|
|
77
78
|
} from './status.js';
|
|
78
79
|
import { thinkingJobText } from '../thinking.js';
|
|
79
80
|
import { ticketFilterWords } from '../ticketfilter.js';
|
|
@@ -81,7 +82,7 @@ import { filterUnsure } from '../ticketlabels.js';
|
|
|
81
82
|
import { judgedFilesOf, lineRules, stepFileRel, proseNotCheckedItems } from '../rubricstep.js';
|
|
82
83
|
import { factPartOf, factSentence, ruleWords, moneyAs } from '../facts.js';
|
|
83
84
|
import { createSettingsRoutes } from './settingsroutes.js';
|
|
84
|
-
import { planFromSpec } from './jobplan.js';
|
|
85
|
+
import { planFromSpec, auditChecksOf } from './jobplan.js';
|
|
85
86
|
import { stageQuestionsByName } from '../stagewords.js';
|
|
86
87
|
|
|
87
88
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
@@ -1533,13 +1534,14 @@ function stepChecksOf(records, spec) {
|
|
|
1533
1534
|
}
|
|
1534
1535
|
|
|
1535
1536
|
/**
|
|
1536
|
-
* The generic Result tab's "The checks" box, from the run's
|
|
1537
|
+
* The generic Result tab's "The checks" box, from the run's FINAL close record (the last `outer-close` or fix-loop staged `close-verdict`): each stage's plain question ({@link stageQuestionText}'s one
|
|
1537
1538
|
* owner, through the spec's own declaration), its pass/fail word from the status table, and the number the close read. A run the close never reached
|
|
1538
1539
|
* falls back to the checks its steps ran ({@link stepChecksOf}); `null` when neither exists.
|
|
1539
1540
|
* @param {any[]} records @param {any} spec
|
|
1540
1541
|
*/
|
|
1541
1542
|
function checksOf(records, spec) {
|
|
1542
|
-
|
|
1543
|
+
// the run's FINAL close: the last staged record by position — the `outer-close` precheck runs once BEFORE the fix loop, whose own staged `close-verdict`s come after it (live run mwg3pov1)
|
|
1544
|
+
const oc = records.findLast((r) => r && (r.type === 'close-verdict' || r.type === 'outer-close') && Array.isArray(r.stages));
|
|
1543
1545
|
if (!oc) return stepChecksOf(records, spec);
|
|
1544
1546
|
const kindMeta = stageKindMetaFromSpec(spec);
|
|
1545
1547
|
const stages = oc.stages.filter((/** @type {any} */ s) => s && typeof s.name === 'string').map((/** @type {any} */ raw) => {
|
|
@@ -1554,9 +1556,16 @@ function checksOf(records, spec) {
|
|
|
1554
1556
|
};
|
|
1555
1557
|
});
|
|
1556
1558
|
const ok = stages.filter((/** @type {any} */ s) => s.passed).length;
|
|
1559
|
+
// a stage the signed close declares but this LATEST close never reached (it stops at the first red) is "not reached" — never the precheck's old reading
|
|
1560
|
+
const ran = new Set(stages.map((/** @type {any} */ s) => s.name));
|
|
1561
|
+
const unreached = [...(kindMeta ?? new Map())].filter(([n]) => !ran.has(n)).map(([name, m]) => ({
|
|
1562
|
+
name, question: m.question, passed: false, notReached: true, status: NOT_REACHED,
|
|
1563
|
+
value: null, baseline: null, direction: m.direction, baselineKind: m.baselineKind, notes: null,
|
|
1564
|
+
}));
|
|
1565
|
+
const shown = kindMeta ? [...kindMeta.keys()].map((n) => stages.find((/** @type {any} */ s) => s.name === n) ?? unreached.find((u) => u.name === n)).concat(stages.filter((/** @type {any} */ s) => !kindMeta.has(s.name))) : stages;
|
|
1557
1566
|
return {
|
|
1558
|
-
head: `${ok} of ${stages.length} passed · the close ran them after the worker stopped`,
|
|
1559
|
-
passed: ok, total: stages.length, allPassed: ok === stages.length, stages,
|
|
1567
|
+
head: `${ok} of ${stages.length} passed${unreached.length ? ` · ${unreached.length} not reached` : ''} · the close ran them after the worker stopped`,
|
|
1568
|
+
passed: ok, total: stages.length, notReached: unreached.length, allPassed: ok === stages.length, stages: shown,
|
|
1560
1569
|
notes: stages.filter((/** @type {any} */ s) => s.notes).map((/** @type {any} */ s) => ({ name: s.name, text: s.notes })),
|
|
1561
1570
|
};
|
|
1562
1571
|
}
|
|
@@ -1736,7 +1745,8 @@ export function getRunResult(runid, /** @type {{ home?: string, sessionsRoot?: s
|
|
|
1736
1745
|
// Not checked, split by the line the SIGNED plan ties each item to: a refusal carries its line (closeDecl.refused[].line, planFromSpec's
|
|
1737
1746
|
// `lines[].refused`), a prose step carries its stage's step. What the plan ties to no line stays in `notChecked` (the bottom). Together they are
|
|
1738
1747
|
// exactly the Job tab's items (its per-line "not checked" rows plus its Not checked fold) — never a second spelling.
|
|
1739
|
-
const
|
|
1748
|
+
const ledgerDir = sessionDirForRow(row, opts);
|
|
1749
|
+
const plan = planFromSpec(spec, ledgerDir ? readDraftLedger(ledgerDir) : null);
|
|
1740
1750
|
const proseByLine = proseNotCheckedItems(spec?.closeDecl);
|
|
1741
1751
|
const prosePool = proseByLine.map((i) => i.text);
|
|
1742
1752
|
const tiedToLine = (/** @type {number} */ n) => [...(plan.lines.find((l) => l.n === n)?.refused ?? []), ...proseByLine.filter((i) => i.line === n).map((i) => i.text)];
|
|
@@ -1753,6 +1763,7 @@ export function getRunResult(runid, /** @type {{ home?: string, sessionsRoot?: s
|
|
|
1753
1763
|
/** @type {any} */
|
|
1754
1764
|
const out = {
|
|
1755
1765
|
notChecked: tiedToLine(n),
|
|
1766
|
+
...(plan.notCheckedBy ? { notCheckedBy: plan.notCheckedBy } : {}),
|
|
1756
1767
|
n, text: jl && typeof jl.text === 'string' ? jl.text : '', rules: jl ? lineRules(jl) : [], kind: fp ? 'facts' : 'text', passed,
|
|
1757
1768
|
file: di ? { i: di.i, state: read[di.i].state, words: read[di.i].state === 'gone' ? RESULT_FILE_GONE : (read[di.i].state === 'changed' ? RESULT_FILE_CHANGED : null) } : null,
|
|
1758
1769
|
};
|
|
@@ -1824,6 +1835,7 @@ export function getRunResult(runid, /** @type {{ home?: string, sessionsRoot?: s
|
|
|
1824
1835
|
pages,
|
|
1825
1836
|
pageNote: pages.length ? RESULT_PAGE_MAY_CHANGE : null,
|
|
1826
1837
|
notChecked: bottom,
|
|
1838
|
+
...(plan.notCheckedBy ? { notCheckedBy: plan.notCheckedBy } : {}),
|
|
1827
1839
|
readNotes: plan.readNotes,
|
|
1828
1840
|
// the door's words, from the one table (src/panel/status.js DOOR_WORDS); the page types none of them
|
|
1829
1841
|
door: { head: DOOR_WORDS.waiting.head, ask: RESULT_DOOR_ASK },
|
|
@@ -1991,16 +2003,6 @@ function getRunDetailBody(runid, opts) {
|
|
|
1991
2003
|
// the export row only for a run export would take — the one rule, `checkExportable`, never a copy of it
|
|
1992
2004
|
const exportName = checkExportable(row, runName).ok ? runName : null;
|
|
1993
2005
|
const { ended, resume, status } = endedForRow(row, rawSpineRecords, summary, death, true, exportName);
|
|
1994
|
-
// judgeModel (Summary box "judge:" line): the FIRST `judge-round`'s own
|
|
1995
|
-
// `model` field (src/planrun.js:1704's `onJudgeCost` emit) — a soft-green
|
|
1996
|
-
// close's own paid judge seam, distinct from the worker `model` above.
|
|
1997
|
-
// `null` whenever no judge-round was ever recorded (the common case —
|
|
1998
|
-
// src/replay.js's own note: no real archived run measured against this
|
|
1999
|
-
// build carries one yet), never guessed from the worker model.
|
|
2000
|
-
const judgeRoundWithModel = rawSpineRecords.find(
|
|
2001
|
-
(r) => r && typeof r === 'object' && r.type === 'judge-round' && typeof r.model === 'string' && r.model.length > 0,
|
|
2002
|
-
);
|
|
2003
|
-
const judgeModel = judgeRoundWithModel ? judgeRoundWithModel.model : null;
|
|
2004
2006
|
|
|
2005
2007
|
/** @param {string|null} outcome @param {boolean} isLast */
|
|
2006
2008
|
const stateFor = (outcome, isLast) => {
|
|
@@ -2137,7 +2139,6 @@ function getRunDetailBody(runid, opts) {
|
|
|
2137
2139
|
checkTypeTitle: checkTypeTitle(summary.verdictType, row.at),
|
|
2138
2140
|
model: summary.model,
|
|
2139
2141
|
provider: summary.provider,
|
|
2140
|
-
judgeModel,
|
|
2141
2142
|
budgetUsd: summary.budgetUsd,
|
|
2142
2143
|
glyph: status.sign,
|
|
2143
2144
|
status,
|
|
@@ -2244,8 +2245,11 @@ function getRunDetailBody(runid, opts) {
|
|
|
2244
2245
|
// Cross-run learnings now ride on the part that received them (`part.learnings`, `part.learningsError`; src/panel/handed.js).
|
|
2245
2246
|
// PRD v1.106 Part 5 F: the two Run summary rows, worded here (the page prints them)
|
|
2246
2247
|
callsLine: callsLineOf(rawSpineRecords, scopedBehaviour(row, rawSpineRecords)),
|
|
2247
|
-
checksLine: checksLineOf(rawSpineRecords,
|
|
2248
|
+
checksLine: checksLineOf(rawSpineRecords, specForParts),
|
|
2249
|
+
auditChecks: auditChecksFor(row, rawSpineRecords, specForParts, opts),
|
|
2248
2250
|
memoryCache: summary.memoryCache,
|
|
2251
|
+
// PLACE RULES: what the run start read for each place-rule check (plain lines from code), or null when the run has none; the Audit page's placement of it is not built yet
|
|
2252
|
+
placeRules: placeRuleLines(rawSpineRecords),
|
|
2249
2253
|
// T Part 8: is this run waiting for the person's Accept? The SAME answer fills the runs list's Needs-you tag (`doorWaiting`, one owner)
|
|
2250
2254
|
accept: !runIsAlive(row) && doorWaiting(rawSpineRecords),
|
|
2251
2255
|
// PRD v1.107 Part 6: the Result tab shows for a rubric run whose signed close has a rubric-step stage, never otherwise; `delivered` is the
|
|
@@ -2419,11 +2423,22 @@ function resolveAuditPathsForRow(row, spineRecords) {
|
|
|
2419
2423
|
* @returns {ReturnType<typeof runBehaviour>|null}
|
|
2420
2424
|
*/
|
|
2421
2425
|
function scopedBehaviour(row, spineRecords) {
|
|
2426
|
+
const windowed = scopedAuditRows(row, spineRecords);
|
|
2427
|
+
return windowed === null ? null : runBehaviour(windowed);
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* The gate-audit rows inside this run's own ts window(s), the ONE scoping behind the Run tab's tools summary and the Audit's write-fence row; `null` when no
|
|
2432
|
+
* gate-audit sidecar was found for the run (never an empty list posing as a clean record).
|
|
2433
|
+
* @param {{spine: string, patient: string|null}} row
|
|
2434
|
+
* @param {any[]} spineRecords
|
|
2435
|
+
* @returns {any[]|null}
|
|
2436
|
+
*/
|
|
2437
|
+
function scopedAuditRows(row, spineRecords) {
|
|
2422
2438
|
const auditPaths = resolveAuditPathsForRow(row, spineRecords);
|
|
2423
2439
|
if (auditPaths.length === 0) return null;
|
|
2424
2440
|
const windows = runAuditWindows(spineRecords);
|
|
2425
|
-
|
|
2426
|
-
return runBehaviour(windowed);
|
|
2441
|
+
return auditPaths.flatMap((ap) => parseJsonl(ap).records).filter((r) => r && typeof r === 'object' && typeof r.ts === 'string' && inAnyWindow(r.ts, windows));
|
|
2427
2442
|
}
|
|
2428
2443
|
|
|
2429
2444
|
/**
|
|
@@ -3161,53 +3176,17 @@ export function callsLineOf(records, behaviour) {
|
|
|
3161
3176
|
: `${model} model · tool calls: no log saved`;
|
|
3162
3177
|
}
|
|
3163
3178
|
|
|
3164
|
-
/** "1-5", "2", "1-2, 4" from try numbers @param {number[]} ns */
|
|
3165
|
-
function tryRanges(ns) {
|
|
3166
|
-
const out = [];
|
|
3167
|
-
for (let i = 0; i < ns.length; i += 1) {
|
|
3168
|
-
let j = i;
|
|
3169
|
-
while (j + 1 < ns.length && ns[j + 1] === ns[j] + 1) j += 1;
|
|
3170
|
-
out.push(j > i ? `${ns[i]}-${ns[j]}` : String(ns[i]));
|
|
3171
|
-
i = j;
|
|
3172
|
-
}
|
|
3173
|
-
return out.join(', ');
|
|
3174
|
-
}
|
|
3175
|
-
|
|
3176
3179
|
/**
|
|
3177
|
-
* "
|
|
3178
|
-
*
|
|
3179
|
-
*
|
|
3180
|
-
* @param {any[]} records the run's raw spine @param {any
|
|
3180
|
+
* "3 run · 3 passed · 0 failed" (+ " · N not reached") — counts of what the run's LATEST close ran, never a fraction (the "checks N/M" headline stays withdrawn).
|
|
3181
|
+
* Read from {@link checksOf}, the one owner the Audit checks fold and the Result checks box read (live run mwg3pov1): the last staged close, a stage it never reached counts as
|
|
3182
|
+
* neither passed nor failed, and a run no close reached falls back to the checks its steps ran. No history of earlier tries. A run with neither says `not recorded`.
|
|
3183
|
+
* @param {any[]} records the run's raw spine @param {any} spec the run's signed spec (names the stages the close declares)
|
|
3181
3184
|
* @returns {string}
|
|
3182
3185
|
*/
|
|
3183
|
-
export function checksLineOf(records,
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
for (const r of records) {
|
|
3188
|
-
if (!r) continue;
|
|
3189
|
-
if (r.type === 'exit-eval' && Array.isArray(r.results)) {
|
|
3190
|
-
for (const x of r.results) { run += 1; if (x && x.pass === true) passed += 1; }
|
|
3191
|
-
} else if (r.type === 'outer-close' && Array.isArray(r.stages)) {
|
|
3192
|
-
for (const x of r.stages) { run += 1; if (x && x.verdict === 'satisfied') passed += 1; else outerFailed = true; }
|
|
3193
|
-
}
|
|
3194
|
-
}
|
|
3195
|
-
if (run === 0) return 'not recorded';
|
|
3196
|
-
/** @type {string[]} */
|
|
3197
|
-
const named = [];
|
|
3198
|
-
/** @type {Set<string>} */
|
|
3199
|
-
const seenLabel = new Set();
|
|
3200
|
-
for (const p of parts ?? []) {
|
|
3201
|
-
if (p.kind !== 'step' || !Array.isArray(p.tries)) continue;
|
|
3202
|
-
const bad = p.tries.filter((/** @type {any} */ t) => t.failed > 0).map((/** @type {any} */ t) => t.n);
|
|
3203
|
-
if (bad.length === 0) continue;
|
|
3204
|
-
const text = `tries ${tryRanges(bad)}`;
|
|
3205
|
-
named.push(seenLabel.has(p.label) ? `then ${text}` : `${p.label} ${text}`);
|
|
3206
|
-
seenLabel.add(p.label);
|
|
3207
|
-
}
|
|
3208
|
-
if (outerFailed) named.push('the outer close');
|
|
3209
|
-
const failed = run - passed;
|
|
3210
|
-
return `${run} run · ${passed} passed · ${failed} failed${named.length ? ` (${named.join(', ')})` : ''}`;
|
|
3186
|
+
export function checksLineOf(records, spec) {
|
|
3187
|
+
const c = checksOf(records, spec);
|
|
3188
|
+
if (!c || c.total === 0) return 'not recorded';
|
|
3189
|
+
return `${c.total} run · ${c.passed} passed · ${c.total - c.passed} failed${c.notReached ? ` · ${c.notReached} not reached` : ''}`;
|
|
3211
3190
|
}
|
|
3212
3191
|
|
|
3213
3192
|
/** 1 -> "1st", 4 -> "4th", 12 -> "12th" @param {number} n */
|
|
@@ -3392,6 +3371,31 @@ function successFromSpec(spec) {
|
|
|
3392
3371
|
return names.length > 0 ? names.join(' · ') : null;
|
|
3393
3372
|
}
|
|
3394
3373
|
|
|
3374
|
+
/**
|
|
3375
|
+
* The Audit's check list (hamr ruling A): the card's own sections (planFromSpec for the checks and Not checked, confirmProtections for Always checked) with each row's
|
|
3376
|
+
* result read from the run's recorded stage verdicts ({@link checksOf}), never re-derived. `null` for a run with no signed spec (nothing to list).
|
|
3377
|
+
* @param {{spine: string, patient: string|null}} row @param {any[]} records @param {any} spec @param {{ home?: string, sessionsRoot?: string }} opts
|
|
3378
|
+
*/
|
|
3379
|
+
function auditChecksFor(row, records, spec, opts) {
|
|
3380
|
+
if (!spec || typeof spec !== 'object') return null;
|
|
3381
|
+
const ledgerDir = sessionDirForRow(row, opts);
|
|
3382
|
+
const plan = planFromSpec(spec, ledgerDir ? readDraftLedger(ledgerDir) : null);
|
|
3383
|
+
/** @type {string[]} */
|
|
3384
|
+
let guards = [];
|
|
3385
|
+
if (spec.closeDecl && typeof spec.closeDecl.lang === 'string' && typeof spec.verdictType === 'string') {
|
|
3386
|
+
try {
|
|
3387
|
+
guards = confirmProtections({
|
|
3388
|
+
verdictType: spec.verdictType, lang: spec.closeDecl.lang, jobLines: Array.isArray(spec.jobLines) ? spec.jobLines : null, closeDecl: spec.closeDecl,
|
|
3389
|
+
writeScope: Array.isArray(spec.writeScope) && spec.writeScope.every((/** @type {any} */ x) => typeof x === 'string') ? spec.writeScope : null,
|
|
3390
|
+
});
|
|
3391
|
+
} catch { guards = []; }
|
|
3392
|
+
}
|
|
3393
|
+
const got = checksOf(records, spec);
|
|
3394
|
+
const results = got ? new Map(got.stages.filter((/** @type {any} */ x) => !x.notReached).map((/** @type {any} */ x) => [x.name, x.passed === true])) : null;
|
|
3395
|
+
const rows = scopedAuditRows(row, records);
|
|
3396
|
+
return auditChecksOf(plan, guards, results, rows === null ? null : writesBlocked(rows), got !== null && got.notReached !== undefined);
|
|
3397
|
+
}
|
|
3398
|
+
|
|
3395
3399
|
/**
|
|
3396
3400
|
* The write fence plus the guard checks a close actually carries — reusing
|
|
3397
3401
|
* {@link confirmProtections} (`src/authorflow.js`), the SAME function the
|
|
@@ -3630,10 +3634,12 @@ function getRunJobBody(runid, opts) {
|
|
|
3630
3634
|
if (existsSync(row.spine)) {
|
|
3631
3635
|
try { firstStart = parseJsonl(row.spine).records.find((r) => r && typeof r === 'object' && r.type === 'job-start') ?? null; } catch { firstStart = null; }
|
|
3632
3636
|
}
|
|
3637
|
+
// the check list's rows as the drafting ended, from the run's own session folder (none for a CLI or imported run: the plan then names a row from its key)
|
|
3638
|
+
const ledgerOf = () => { const dir = sessionDirForRow(row, opts); return dir ? readDraftLedger(dir) : null; };
|
|
3633
3639
|
/** @param {any} spec @param {boolean} resolved @param {string} resolvedFrom @param {string|null} note */
|
|
3634
3640
|
const fromSpec = (spec, resolved, resolvedFrom, note) => ({
|
|
3635
3641
|
// P7: the same plan model the chat's plan bubble is drawn from (src/panel/jobplan.js), read from the SIGNED spec
|
|
3636
|
-
plan: planFromSpec(spec),
|
|
3642
|
+
plan: planFromSpec(spec, ledgerOf()),
|
|
3637
3643
|
jobLines: Array.isArray(spec.jobLines) ? spec.jobLines : null,
|
|
3638
3644
|
inputs: Array.isArray(spec.inputs) && spec.inputs.length ? spec.inputs : [{ n: 1, label: 'repo', value: sourceDisplay() }],
|
|
3639
3645
|
signedAt: typeof firstStart?.ts === 'string' ? firstStart.ts : null,
|
package/src/panel/status.js
CHANGED
|
@@ -47,6 +47,9 @@ export const STATUS = Object.freeze({
|
|
|
47
47
|
skipped: Object.freeze({ sign: '–', word: 'skipped' }),
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
/** a close stage the run's LATEST close never reached (it stops at the first red): the [·] sign, grey, never the precheck's old reading. Beside STATUS, not in it: it is a stage's standing, never a run's status */
|
|
51
|
+
export const NOT_REACHED = Object.freeze({ sign: '·', word: 'not reached' });
|
|
52
|
+
|
|
50
53
|
/**
|
|
51
54
|
* The plain words a skipped run carries (the `settled` event's `words`, the Ended line), from CODE. They do NOT repeat the status word: every surface prints `skipped — <words>` from the table's word (the CLI line adds its own `skipped:`): the filter decision's own reason, never model-written.
|
|
52
55
|
* `reason` is `decideTicket`'s ('closed' | 'priority P3, not P1' | 'no P1 label' | 'no bug label'); `filter` is the job's signed `ticketFilter`, which tells a missing
|