fwdloop 0.36.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +6 -20
  2. package/bin/fwdloop +35 -12
  3. package/package.json +3 -3
  4. package/src/action-stop.js +1 -1
  5. package/src/auditchecks.js +41 -9
  6. package/src/authoring.js +78 -20
  7. package/src/blockasks.js +10 -12
  8. package/src/blockassemble.js +49 -46
  9. package/src/blockdraft.js +4 -2
  10. package/src/blockpick.js +10 -0
  11. package/src/canrun.js +2 -1
  12. package/src/cardlist.js +28 -5
  13. package/src/checkblock.js +598 -61
  14. package/src/checked.js +27 -33
  15. package/src/checklistsign.js +3 -3
  16. package/src/checklook.js +45 -0
  17. package/src/checkrows.js +202 -0
  18. package/src/cited-record.js +2 -2
  19. package/src/citedcheck.js +53 -12
  20. package/src/citedwords.js +7 -4
  21. package/src/closers.js +49 -2
  22. package/src/declaration.js +34 -10
  23. package/src/drafter.js +99 -74
  24. package/src/factwords.js +7 -4
  25. package/src/globprefix.js +26 -0
  26. package/src/isrec.js +2 -0
  27. package/src/line-checks.js +1 -2
  28. package/src/minrule.js +16 -0
  29. package/src/model-step.js +22 -4
  30. package/src/pageask.js +0 -3
  31. package/src/pagedropwords.js +3 -11
  32. package/src/pagedry.js +75 -1
  33. package/src/pagefetch.js +11 -6
  34. package/src/pagelook.js +2 -1
  35. package/src/pagerules.js +8 -2
  36. package/src/panel/author.js +33 -8
  37. package/src/panel/data.js +3 -2
  38. package/src/panel/index.html +177 -37
  39. package/src/panel/result.js +34 -1
  40. package/src/pickrecord.js +14 -0
  41. package/src/planrebuild.js +55 -19
  42. package/src/ratelimit.js +117 -0
  43. package/src/report.js +14 -2
  44. package/src/rowresults.js +111 -0
  45. package/src/rubricstep.js +65 -2
  46. package/src/runner.js +38 -5
  47. package/src/shapebuild.js +281 -0
  48. package/src/shapelook.js +91 -0
  49. package/src/shapemenu.js +64 -0
  50. package/src/shaperesult.js +104 -0
  51. package/src/shaperows.js +263 -0
  52. package/src/shapewords.js +140 -0
  53. package/src/sheet-record.js +1 -2
  54. package/src/sheetblock.js +1 -2
  55. package/src/sheetbuild.js +41 -29
  56. package/src/sheetchecks.js +1 -2
  57. package/src/sheetclaims.js +1 -2
  58. package/src/sheetoffer.js +1 -1
  59. package/src/sheetrows.js +10 -64
  60. package/src/sheetrun.js +1 -2
  61. package/src/ticketrows.js +2 -3
  62. package/src/try-checks.js +39 -6
  63. package/src/types.js +1 -0
  64. package/src/whole-job.js +24 -8
  65. package/types/action-stop.d.ts +1 -1
  66. package/types/auditchecks.d.ts +13 -2
  67. package/types/authoring.d.ts +21 -2
  68. package/types/blockasks.d.ts +6 -10
  69. package/types/blockassemble.d.ts +12 -13
  70. package/types/blockdraft.d.ts +3 -2
  71. package/types/blockpick.d.ts +4 -0
  72. package/types/cardlist.d.ts +18 -2
  73. package/types/checkblock.d.ts +276 -27
  74. package/types/checked.d.ts +15 -6
  75. package/types/checklook.d.ts +36 -0
  76. package/types/checkrows.d.ts +119 -0
  77. package/types/citedcheck.d.ts +4 -2
  78. package/types/closers.d.ts +10 -1
  79. package/types/drafter.d.ts +9 -4
  80. package/types/globprefix.d.ts +5 -0
  81. package/types/isrec.d.ts +1 -0
  82. package/types/minrule.d.ts +6 -0
  83. package/types/model-step.d.ts +43 -2
  84. package/types/pageask.d.ts +0 -1
  85. package/types/pagedropwords.d.ts +0 -1
  86. package/types/pagedry.d.ts +27 -0
  87. package/types/pagefetch.d.ts +3 -2
  88. package/types/pagerules.d.ts +4 -0
  89. package/types/panel/result.d.ts +16 -1
  90. package/types/pickrecord.d.ts +10 -0
  91. package/types/ratelimit.d.ts +59 -0
  92. package/types/report.d.ts +2 -1
  93. package/types/rowresults.d.ts +28 -0
  94. package/types/rubricstep.d.ts +21 -0
  95. package/types/runner.d.ts +3 -1
  96. package/types/shapebuild.d.ts +97 -0
  97. package/types/shapelook.d.ts +76 -0
  98. package/types/shapemenu.d.ts +40 -0
  99. package/types/shaperesult.d.ts +40 -0
  100. package/types/shaperows.d.ts +102 -0
  101. package/types/shapewords.d.ts +43 -0
  102. package/types/sheetbuild.d.ts +31 -13
  103. package/types/sheetrows.d.ts +5 -36
  104. package/types/ticketrows.d.ts +1 -1
  105. package/types/try-checks.d.ts +2 -1
  106. package/types/types.d.ts +4 -0
  107. package/types/whole-job.d.ts +20 -4
package/src/sheetbuild.js CHANGED
@@ -1,5 +1,5 @@
1
- // M17 am2 + am3 (docs/wiki/the-module-ladder.md "M17 am2", "M17 am3"): the ONE builder of the sheet checks of a line. The AI never writes a sheet check: what it sends in the declaration round's
2
- // `close.sheet` is read here only as a typed SUGGESTION (bareguard's rule fields plus the `covers` numbers); code refuses or builds every one on bareguard's shapes and writes the check itself.
1
+ // borrowed-from: bareloop src/sheetbuild.js@v0.60.0 (`buildSheetChecks`, and the `line` routing field `buildSheetLine` strips; bareloop copied `buildSheetLine` from this file, M17 am2/am3, so it stays as it is)
2
+ // M17 am2 + am3 (docs/wiki/the-module-ladder.md "M17 am2", "M17 am3"): the ONE builder of the sheet checks of a line. The AI never writes a sheet check: what it sends on the row-edit reply (`sheetChecks`) is read here only as a typed SUGGESTION (bareguard's rule fields plus the `covers` numbers); code refuses or builds every one on bareguard's shapes and writes the check itself.
3
3
  // Ported from poc/f195-agentrows/build.mjs (F195 PASS, $0); no class code, no send-back loop, no word-to-column guess, no per-case validator patch.
4
4
  // refusals (each by bareguard, in this order): the vocabulary (rule, op), the line's sheets, the schema (a field of the rule), `columnAt` (a column of the sheet's header), `checkTables`
5
5
  // (and its problems), `groundedLiterals` (a number or date in the person's own words), `claimSchema` (an answer box), and for a `table` check `runTableChecks` on the sheet frozen at draft time.
@@ -58,7 +58,9 @@ export async function buildSheetLine({ line, tables, suggestions }) {
58
58
  if (!SHEET_RULES.includes(f.rule) || !isRec(V.rules[f.rule]?.ops) || !Object.hasOwn(V.rules[f.rule].ops, f.op)) { refuse('vocabulary', `no ${String(f.rule)} op "${String(f.op)}"`); continue; }
59
59
  const role = typeof f.table === 'string' ? f.table : roles.length === 1 ? roles[0] : null;
60
60
  if (role === null || !roles.includes(role)) { refuse('tables', `"${String(f.table)}" is not one of the line's sheets`); continue; }
61
- const check = { ...f, table: role };
61
+ // `line` is the reply's own routing field (src/sheetoffer.js `sheetSuggestProp`), read by buildSheetChecks, never part of a check
62
+ const { line: _line, ...own } = f;
63
+ const check = { ...own, table: role };
62
64
  const bad = Object.keys(check).filter((k) => k !== 'rule' && !Object.hasOwn(V.rules[f.rule].fields, k));
63
65
  if (bad.length > 0) { refuse('schema', `field ${bad.join(', ')} is not a ${f.rule} field`); continue; }
64
66
  const probe = { id: 'probe', ...check, ...(f.rule === 'cells' ? { claim: 'probe' } : {}) };
@@ -104,39 +106,49 @@ export async function buildSheetLine({ line, tables, suggestions }) {
104
106
  return { rows, ruleRows, agentRows, checks: [...ruleRows, ...agentRows].map((p) => p.check), refused };
105
107
  }
106
108
 
109
+ // borrowed-from: bareloop src/sheetbuild.js@v0.60.0 (`buildSheetChecks`: the suggestions and the sheet lines in, one result per line out; the check block (`setSheet`) holds the rows. fwd's own `buildSheetChecks` rewrote a declaration's
110
+ // `close.sheet` per step; the declaration is now made from the block's rows by src/blockassemble.js)
107
111
  /**
108
- * The declaration with every green sheet step's `close.sheet` REWRITTEN by code from what the AI suggested there (`buildSheetLine`). A step with no suggestion is left alone; a step none of whose
109
- * suggestions can be built loses `close.sheet` (its rules are Not checked with their reasons). Pure over the declaration it is given (a copy is returned).
110
- * @param {{declaration: any, lines: {n: number, text?: string, rules?: string[], guardrail?: string, rule?: string}[], tables: Record<string, {header: string[], rows: any[]}>}} o
111
- * @returns {Promise<{declaration: any, notChecked: Record<string, string>, refused: {line: number, helper: string, why: string}[], unbuilt: {line: number, lost: string[]}[]}>} `unbuilt`: the green sheet steps left with no check, each with its rules as Not-checked lines. `notChecked`: `line N: "rule"` -> the refusal that named it (or `NO_VALUE_WHY`), for each rule of a
112
- * rewritten line that no check holds
112
+ * Build the checks of every sheet line from the reply's suggestions, each routed to its job line by its own `line`. Every sheet line in `lines` gets a result, a line with no suggestion included (its rules are
113
+ * then Not checked with the no-pick sentence, never silently nothing). A suggestion that names no sheet line, or is not an object, is refused and listed with its helper.
114
+ * @param {{lines: {n: number, text?: string, rules?: string[], guardrail?: string, rule?: string}[], tables: Record<string, {header: string[], rows: any[]}>, suggestions: any[]}} o
115
+ * @returns {Promise<{built: Record<number, Awaited<ReturnType<typeof buildSheetLine>>>, checks: any[], notChecked: Record<string, string>, refused: {line: number|null, helper: string, why: string}[]}>}
116
+ * `notChecked`: `line N: "rule"` -> the refusal that named it (or `NO_VALUE_WHY`), for each rule of a sheet line that no check holds
113
117
  */
114
- export async function buildSheetChecks({ declaration, lines, tables }) {
118
+ export async function buildSheetChecks({ lines, tables, suggestions }) {
119
+ /** @type {Record<number, Awaited<ReturnType<typeof buildSheetLine>>>} */
120
+ const built = {};
115
121
  /** @type {Record<string, string>} */
116
122
  const notChecked = {};
117
- /** @type {{line: number, helper: string, why: string}[]} */
123
+ /** @type {{line: number|null, helper: string, why: string}[]} */
118
124
  const refused = [];
119
- if (!isRec(declaration) || !Array.isArray(declaration.steps)) return { declaration, notChecked, refused, unbuilt: [] };
120
- /** @type {Set<number>} */
121
- const done = new Set();
122
- const steps = [];
123
- for (const st of declaration.steps) {
124
- if (!isRec(st) || !isRec(st.close) || st.close.class !== 'green' || !Array.isArray(st.close.sheet) || !Number.isInteger(st.fromLine) || done.has(st.fromLine)) { steps.push(st); continue; }
125
- done.add(st.fromLine);
126
- const line = lines.find((l) => l.n === st.fromLine);
127
- if (!line) { steps.push(st); continue; }
128
- const built = await buildSheetLine({ line, tables, suggestions: st.close.sheet });
129
- for (const x of built.refused) refused.push({ line: st.fromLine, ...x });
130
- for (const r of built.rows) if (r.state === 'not-checked') notChecked[`line ${st.fromLine}: "${r.text}"`] = /** @type {string} */ (r.reason);
131
- const { sheet: _suggested, ...close } = st.close;
132
- steps.push({ ...st, close: built.checks.length > 0 ? { ...close, sheet: built.checks } : close });
125
+ /** @type {Map<number, any[]>} */
126
+ const byLine = new Map(lines.map((l) => [l.n, []]));
127
+ for (const s of suggestions) {
128
+ if (!isRec(s)) { refused.push({ line: null, helper: 'schema', why: 'a suggestion is not an object' }); continue; }
129
+ const mine = byLine.get(/** @type {number} */ (s.line));
130
+ if (mine === undefined) { refused.push({ line: Number.isInteger(s.line) ? s.line : null, helper: 'line', why: `line ${String(s.line)} is not a sheet line` }); continue; }
131
+ mine.push(s);
132
+ }
133
+ for (const line of lines) {
134
+ const r = await buildSheetLine({ line, tables, suggestions: byLine.get(line.n) ?? [] });
135
+ built[line.n] = r;
136
+ for (const x of r.refused) refused.push({ line: line.n, ...x });
137
+ for (const row of r.rows) if (row.state === 'not-checked') notChecked[`line ${line.n}: "${row.text}"`] = /** @type {string} */ (row.reason);
133
138
  }
134
- // M17 am5 / P5: a green step that reads a sheet and holds no check after the build (no suggestion, or none code could build) is REPORTED here, with each of its rules and the refusal that named it
135
- // (else the no-pick sentence). What class such a step gets is the caller's to decide (src/blockassemble.js closeUnbuiltSheetSteps); this file writes no class.
139
+ return { built, checks: lines.flatMap((l) => built[l.n].checks), notChecked, refused };
140
+ }
141
+
142
+ /**
143
+ * M17 am5 / P5 (fwd's own, kept from the declaration-rewriting builder): the green steps that read a sheet and hold no check after the build (no suggestion, or none code could build), each with its rules as Not-checked lines
144
+ * and the refusal that named each (else the no-pick sentence). What class such a step gets is the caller's to decide (src/blockassemble.js closeUnbuiltSheetSteps); this file writes no class.
145
+ * @param {{declaration: any, lines: {n: number, text?: string, rules?: string[], guardrail?: string, rule?: string}[], roles: string[], notChecked: Record<string, string>}} o
146
+ * @returns {{line: number, lost: string[]}[]}
147
+ */
148
+ export function unbuiltSheetLines({ declaration, lines, roles, notChecked }) {
136
149
  /** @type {{line: number, lost: string[]}[]} */
137
150
  const unbuilt = [];
138
- const roles = Object.keys(tables);
139
- for (const st of steps) {
151
+ for (const st of isRec(declaration) && Array.isArray(declaration.steps) ? declaration.steps : []) {
140
152
  if (!isRec(st) || !isRec(st.close) || st.close.class !== 'green' || (Array.isArray(st.close.sheet) && st.close.sheet.length > 0) || isRec(st.close.cited) || !Number.isInteger(st.fromLine)) continue;
141
153
  if (!Array.isArray(st.reads) || !st.reads.some((/** @type {string} */ r) => roles.includes(r)) || unbuilt.some((u) => u.line === st.fromLine)) continue;
142
154
  const line = lines.find((l) => l.n === st.fromLine);
@@ -144,5 +156,5 @@ export async function buildSheetChecks({ declaration, lines, tables }) {
144
156
  if (rules.length === 0) continue;
145
157
  unbuilt.push({ line: st.fromLine, lost: rules.map((r) => `line ${st.fromLine}: "${r}" \u2014 ${notChecked[`line ${st.fromLine}: "${r}"`] ?? NO_VALUE_WHY}`) });
146
158
  }
147
- return { declaration: { ...declaration, steps }, notChecked, refused, unbuilt };
159
+ return unbuilt;
148
160
  }
@@ -11,14 +11,13 @@
11
11
 
12
12
  import { checkTables, tableSha, groundedLiterals, rubricVocabulary } from 'bareguard';
13
13
  import { wordsSaidOn, lineRules } from './pagebits.js';
14
+ import { isRec } from './isrec.js';
14
15
 
15
16
  /** the bareguard rules a sheet check may use (`diff` is out of scope for M10b) */
16
17
  export const SHEET_RULES = Object.freeze(['cells', 'table']);
17
18
  /** most checks one step may carry */
18
19
  export const MAX_SHEET_CHECKS = 20;
19
20
 
20
- const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
21
-
22
21
  const V = /** @type {any} */ (rubricVocabulary);
23
22
 
24
23
  /**
@@ -5,8 +5,7 @@
5
5
  // Throws away: a check with no claim (a `table` check judges the sheet itself) adds no box; two checks with the same claim name share one box.
6
6
  import { rubricVocabulary, claimSchema } from 'bareguard';
7
7
  import { bareguardChecks } from './sheetchecks.js';
8
-
9
- const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
8
+ import { isRec } from './isrec.js';
10
9
 
11
10
  /**
12
11
  * The claim box of every `cells` check in the list: `[{claim, example}]`, one per claim name, in order. `example` is the op's worked-example answer (the box's shape
package/src/sheetoffer.js CHANGED
@@ -10,9 +10,9 @@
10
10
  import { rubricVocabulary, checkSchema } from 'bareguard';
11
11
  import { SHEET_RULES, MAX_SHEET_CHECKS } from './sheetchecks.js';
12
12
  import { columnRuleWords } from './sheetlook.js';
13
+ import { isRec } from './isrec.js';
13
14
 
14
15
  const V = /** @type {any} */ (rubricVocabulary);
15
- const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
16
16
 
17
17
  /** The comparisons of a `where` condition, as bareguard's vocabulary lists them. */
18
18
  export const WHERE_CMPS = Object.freeze([...V.rules.cells.fields.where.cmps]);
package/src/sheetrows.js CHANGED
@@ -1,17 +1,19 @@
1
1
  // M16 am4 (docs/wiki/the-module-ladder.md, "M16 amendment 4" (2)): a sheet line's checks (`close.sheet`) are rows on the plan's list, beside every other check.
2
- // The AI writes the sheet checks (M10b); code only READS them as rows: this file is the ONE writer of a sheet row, of its tag and of its card text, and of the Drop and Add of one.
2
+ // The AI writes the sheet checks (M10b); code only READS them as rows: this file is the ONE writer of a sheet row, of its tag and of its card text.
3
3
  // tag a check whose `covers` names one of the person's `~` rules is `[you]`; a check that covers none (the AI added it) is `[agent]`. (A `[default]` sheet check does not exist: no code adds one.)
4
- // Drop only an `[agent]` row; the check leaves `close.sheet` and is kept in the picks record (`sheetDropped`) so Add can put it back. A `[you]` row has no Drop.
5
- // Add puts a dropped check back at the place it had.
4
+ // Drop only an `[agent]` row, and only the check block drops it (src/checkblock.js `rowChoice`, M19 S3): the check leaves `close.sheet` and the block's `sheetDroppedRecord` keeps it in the picks record (`sheetDropped`). A `[you]` row has no Drop.
5
+ // Add the block puts a dropped check back.
6
6
  // Words are fwd's existing sheet-check words (src/sheetblock.js `sheetPlainText`); nothing here words a check. What this throws away: the check's fields (id, claim, range ...); a row keeps its line, tag, part and key.
7
7
  import { sheetLineBlocks, sheetPlainText } from './sheetblock.js';
8
8
  import { closePartsOf } from './checklistsign.js';
9
- import { isDeepStrictEqual } from 'node:util';
10
9
 
11
10
  const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
12
11
 
13
12
  /** the key of a sheet row: the block's `L<line>.<tail>` shape, tail `sheet.<check id>` @param {number} line @param {string} id */
14
13
  export const sheetRowKey = (line, id) => `L${line}.sheet.${id}`;
14
+ // borrowed-from: bareloop src/sheetrows.js@v0.60.0 (`sheetCheckBody`; the tag's own header says bareloop copied the rest of that file from fwd)
15
+ /** the fields that say what a check IS: all but the names code gives it (id, claim), the rules it covers and its row tag. Two drafts name checks differently, so "the very same check" is read on these @param {any} c @returns {Record<string, any>} */
16
+ export function sheetCheckBody(c) { const { id: _i, claim: _c, covers: _v, row: _r, ...rest } = c; return rest; }
15
17
  /** @param {unknown} key @returns {boolean} the key is a sheet row's */
16
18
  export const isSheetKey = (key) => typeof key === 'string' && key.startsWith('L') && key.includes('.sheet.');
17
19
 
@@ -48,67 +50,11 @@ export function sheetRowsOf({ declaration, lines, csvRoles }) {
48
50
  }
49
51
 
50
52
  /**
51
- * The plan's card with the sheet rows on it: the sheet rows after the block's rows, a dropped sheet check among the suggestions (Add), as the block's dropped suggestions are.
52
- * @param {{rows: any[], suggested: any[]}} card the block's card (src/cardlist.js) @param {{card: any[]}} sheet `sheetRowsOf` @param {{key: string, line: number, text: string}[]} [dropped]
53
+ * The plan's card with the sheet rows on it: the sheet rows after the block's rows. A dropped sheet check is among the block's own suggestions (Add), like any dropped `!` row (src/cardlist.js).
54
+ * @param {{rows: any[], suggested: any[]}} card the block's card (src/cardlist.js) @param {{card: any[]}} sheet `sheetRowsOf`
53
55
  */
54
- export function withSheetCard(card, sheet, dropped = []) {
55
- return { ...card, rows: [...card.rows, ...sheet.card], suggested: [...card.suggested, ...dropped.map((d) => ({ key: d.key, line: d.line, text: d.text, dropped: true }))] };
56
- }
57
-
58
- /** the dropped sheet checks the picks record keeps: `{key, line, index, check, text}` @returns {any[]} */
59
- export const droppedSheetOf = (/** @type {any} */ record) => (isRec(record) && Array.isArray(record.sheetDropped) ? record.sheetDropped.filter((d) => isRec(d) && typeof d.key === 'string' && isRec(d.check) && Number.isInteger(d.line)) : []);
60
-
61
- /** the fields that say what a check is: all but the names code gives it (id, claim) and the rules it covers */
62
- const checkBody = (/** @type {any} */ c) => { const { id: _i, claim: _c, covers: _v, ...rest } = c; return rest; };
63
-
64
- /**
65
- * M17 am3: the key of the check of the line that IS a dropped one (same typed fields; code names every check, so an id says nothing across drafts), or null. A Revise keeps a Drop only for the very same check.
66
- * @param {any} declaration @param {{line: number, check: any}} d a record of `droppedSheetOf` @returns {string|null}
67
- */
68
- export function keyOfSameCheck(declaration, d) {
69
- for (const st of isRec(declaration) && Array.isArray(declaration.steps) ? declaration.steps : []) {
70
- if (!isRec(st) || st.fromLine !== d.line || !isRec(st.close) || !Array.isArray(st.close.sheet)) continue;
71
- const hit = st.close.sheet.find((/** @type {any} */ c) => isRec(c) && isDeepStrictEqual(checkBody(c), checkBody(d.check)));
72
- if (hit) return sheetRowKey(d.line, String(hit.id));
73
- }
74
- return null;
75
- }
76
-
77
- /**
78
- * The person's Drop or Add on a sheet row, applied to the declaration (a copy). Same words as the block's own refusals (src/checkblock.js `rowChoice`).
79
- * @param {{declaration: any, lines: any[], csvRoles: string[], op: 'drop'|'add', key: string, dropped: any[]}} o
80
- * @returns {{ok: true, declaration: any, dropped: any[]}|{ok: false, why: string}}
81
- */
82
- export function sheetChoice({ declaration, lines, csvRoles, op, key, dropped }) {
83
- if (op === 'drop') {
84
- const row = sheetRowsOf({ declaration, lines, csvRoles }).card.find((r) => r.key === key);
85
- if (!row) return { ok: false, why: 'there is no such check on the list' };
86
- if (row.by === 'you') return { ok: false, why: 'that check comes from a rule you wrote; edit the job to change it' };
87
- let gone = null;
88
- const steps = declaration.steps.map((/** @type {any} */ st) => {
89
- if (gone !== null || !isRec(st) || st.fromLine !== row.line || !isRec(st.close) || !Array.isArray(st.close.sheet)) return st;
90
- const index = st.close.sheet.findIndex((/** @type {any} */ c) => isRec(c) && sheetRowKey(row.line, String(c.id)) === key);
91
- if (index === -1) return st;
92
- gone = { key, line: row.line, index, check: st.close.sheet[index], text: row.text };
93
- const sheet = st.close.sheet.filter((/** @type {unknown} */ _c, /** @type {number} */ k) => k !== index);
94
- const { sheet: _s, ...close } = st.close;
95
- return { ...st, close: sheet.length > 0 ? { ...close, sheet } : close };
96
- });
97
- if (gone === null) return { ok: false, why: 'there is no such check on the list' };
98
- return { ok: true, declaration: { ...declaration, steps }, dropped: [...dropped.filter((d) => d.key !== key), gone] };
99
- }
100
- const was = dropped.find((d) => d.key === key);
101
- if (!was) return { ok: false, why: 'only a suggested check can be added' };
102
- let put = false;
103
- const steps = declaration.steps.map((/** @type {any} */ st) => {
104
- if (put || !isRec(st) || st.fromLine !== was.line || !isRec(st.close) || st.close.class !== 'green') return st;
105
- put = true;
106
- const sheet = Array.isArray(st.close.sheet) ? [...st.close.sheet] : [];
107
- sheet.splice(Math.min(was.index, sheet.length), 0, was.check);
108
- return { ...st, close: { ...st.close, sheet } };
109
- });
110
- if (!put) return { ok: false, why: 'only a suggested check can be added' };
111
- return { ok: true, declaration: { ...declaration, steps }, dropped: dropped.filter((d) => d.key !== key) };
56
+ export function withSheetCard(card, sheet) {
57
+ return { ...card, rows: [...card.rows, ...sheet.card] };
112
58
  }
113
59
 
114
60
  /**
package/src/sheetrun.js CHANGED
@@ -12,8 +12,7 @@ import { readFileInside } from './flow.js';
12
12
  import { readRunInputs } from './runfile.js';
13
13
  import { sheetCheckSentence, bareguardChecks } from './sheetchecks.js';
14
14
  import { sheetCheckName, sheetFoundWords } from './sheetblock.js';
15
-
16
- const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
15
+ import { isRec } from './isrec.js';
17
16
 
18
17
  /** The sheet inputs any step's `close.sheet` reads, once each, in order. @param {any[]} steps @returns {string[]} */
19
18
  export function sheetRolesOf(steps) {
package/src/ticketrows.js CHANGED
@@ -4,13 +4,12 @@
4
4
  // its signed fields, its card words and its proof. A job with no ticket rows (a plan signed before M17) is not examined: its filter and watch run exactly as signed.
5
5
  // What this throws away: the filter's and watch's values (they stay in the declaration); a row keeps its line, rule number, tag, state and reason.
6
6
  import { checkTicketFilter, checkTicketWatch, isCountGuardrail } from './declaration.js';
7
-
8
- const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
7
+ import { isRec } from './isrec.js';
9
8
 
10
9
  /** @type {readonly ('ticketFilter'|'ticketWatch')[]} */
11
10
  export const TICKET_FIELDS = Object.freeze(['ticketFilter', 'ticketWatch']);
12
11
  /** the Not-checked reason of a ticket rule no legal value was suggested for (the block's own noPick sentence is used by the caller's words) */
13
- export const NO_VALUE_WHY = 'No check was picked for it, so you judge it at the Ask.';
12
+ export const NO_VALUE_WHY = 'No check was picked for it, so you judge it at Accept.';
14
13
 
15
14
  /**
16
15
  * Which signed field a Tickets rule is the check of: `ticketWatch` (a state or labels change), `ticketFilter` (a priority P0 to P3 or a label), or null (a content rule or a count).
package/src/try-checks.js CHANGED
@@ -6,6 +6,10 @@ import { serializeArtifact } from './ask.js';
6
6
  import { labelled } from './checkwords.js';
7
7
  import { sheetRowKey } from './sheetrows.js';
8
8
  import { listLinesOf, partByOf } from './checklistsign.js';
9
+ import { rowResultsOf } from './rowresults.js';
10
+ import { stepRowsOf } from './checkrows.js';
11
+ import { itemCountOf } from './shaperows.js';
12
+ import { rulesOfLine } from './sheetblock.js';
9
13
 
10
14
  export const EVERY_STEP = 'every step';
11
15
  /** the words of the two checks every step has (#1 and #2 below): the Audit's "Always checked" rows, the plan card's and the Job tab's "Always checked" fold */
@@ -47,25 +51,28 @@ export function outputRecord(step, artifact) {
47
51
  * #3 and up: the close's own checks. A softgreen close carries each of its checks; a green close is one check over all its cited fields; a close that
48
52
  * judged nothing (`unparseable`, `crash`) is one check that could not run, with that third outcome as its result.
49
53
  * @param {any} step @param {any} artifact @param {{verdict: string, red?: string|null, checks?: Array<{text:string, ok:boolean, result:string|null}>}} closed @param {any[]} [checkList] the signed list (M16): a line on it tags its checks
54
+ * @param {any[]} [jobLines] the signed job lines (M19 am11: the words of a list line's field rows read the person's rule)
50
55
  */
51
- export function closeRecords(step, artifact, closed, checkList = undefined) {
56
+ export function closeRecords(step, artifact, closed, checkList = undefined, jobLines = undefined) {
52
57
  // M16 item 5: a check of a list line carries `by`, the row's own (`you` / `agent` / `default`); the Audit draws the tag from it. Any other line keeps the words it has.
53
58
  const decl = Array.isArray(checkList) ? { checkList } : undefined;
54
59
  const listed = decl !== undefined && listLinesOf(decl).has(step?.fromLine);
55
60
  const hasCited = step?.close?.class === 'green' && !!step?.close?.cited;
56
61
  const by = (/** @type {number} */ idx, /** @type {'you'|'agent'|'default'} */ fallback) => (listed ? { by: partByOf(decl, step.fromLine, idx) ?? fallback, part: idx } : {});
57
- const rows = factRecords(step, artifact, closed, listed ? (/** @type {number} */ idx) => partByOf(decl, step.fromLine, idx) : undefined, checkList).map((r) => (listed && hasCited && r.n === 3 ? { ...r, text: String(r.text).replace(/ \[agent\]$/, ''), ...by(0, 'agent') } : r));
62
+ const rows = factRecords(step, artifact, closed, listed ? (/** @type {number} */ idx) => partByOf(decl, step.fromLine, idx) : undefined, checkList, jobLines).map((r) => (listed && hasCited && r.n === 3 ? { ...r, text: String(r.text).replace(/ \[agent\]$/, ''), ...by(0, 'agent') } : r));
63
+ // the list's part order is the close's: the fact part, the item-fields part (M19 am10), then each pick, then the tie
64
+ const lead = (hasCited ? 1 : 0) + (step?.close?.itemShape ? 1 : 0);
58
65
  // M10 am22 (1): the picks on a fact line are rows after the fact rows, each judged on the answer's text
59
66
  const picks = Array.isArray(/** @type {any} */ (closed).pickChecks) ? /** @type {any} */ (closed).pickChecks : [];
60
- const pickRows = picks.map((/** @type {any} */ c, /** @type {number} */ i) => ({ n: rows.length + 3 + i, text: listed ? c.text : labelled(c.text, 'picked'), ok: c.ok, result: c.result, source: lineSource(step), ...by((hasCited ? 1 : 0) + i, 'you') }));
67
+ const pickRows = picks.map((/** @type {any} */ c, /** @type {number} */ i) => ({ n: rows.length + 3 + i, text: listed ? c.text : labelled(c.text, 'picked'), ok: c.ok, result: c.result, source: lineSource(step), ...by(lead + i, 'you') }));
61
68
  // M16 R7: the numbers tie of a text line is one more row
62
69
  const tie = /** @type {any} */ (closed).numbersCheck;
63
70
  const picked = Array.isArray(step?.close?.picked) ? step.close.picked.length : Array.isArray(step?.close?.shape?.picked) ? step.close.shape.picked.length : 0;
64
- return [...rows, ...pickRows, ...(tie ? [{ n: rows.length + pickRows.length + 3, text: tie.text, ok: tie.ok, result: tie.result, source: lineSource(step), ...by((hasCited ? 1 : 0) + picked, 'default') }] : [])];
71
+ return [...rows, ...pickRows, ...(tie ? [{ n: rows.length + pickRows.length + 3, text: tie.text, ok: tie.ok, result: tie.result, source: lineSource(step), ...by(lead + picked, 'default') }] : [])];
65
72
  }
66
73
 
67
- /** @param {any} step @param {any} artifact @param {any} closed @param {((idx: number) => string|null)} [partBy] set for a list line (M16): its softgreen picks carry the row's `by` instead of a label @param {any[]} [checkList] the signed list: a sheet row on it gives its check's `by` */
68
- function factRecords(step, artifact, closed, partBy = undefined, checkList = undefined) {
74
+ /** @param {any} step @param {any} artifact @param {any} closed @param {((idx: number) => string|null)} [partBy] set for a list line (M16): its softgreen picks carry the row's `by` instead of a label @param {any[]} [checkList] the signed list: a sheet row on it gives its check's `by` @param {any[]} [jobLines] */
75
+ function factRecords(step, artifact, closed, partBy = undefined, checkList = undefined, jobLines = undefined) {
69
76
  const source = lineSource(step);
70
77
  if (closed.verdict === 'unparseable' || closed.verdict === 'crash') {
71
78
  return [{
@@ -87,6 +94,7 @@ function factRecords(step, artifact, closed, partBy = undefined, checkList = und
87
94
  n: 3, text: labelled('every result is quoted from the saved copy and passes its rules', 'agent'), ok: Array.isArray(/** @type {any} */ (closed).pickChecks) && closed.cited?.check ? closed.cited.check.verdict === 'green' : closed.verdict === 'green', result: `${n} result${n === 1 ? '' : 's'}`, source,
88
95
  }];
89
96
  }
97
+ if (step?.close?.class === 'green' && step?.close?.itemShape && !step.close.cited && partBy !== undefined) return itemShapeRecords(step, closed, checkList, jobLines, source);
90
98
  if (step?.close?.class === 'green') {
91
99
  const n = Object.keys(artifact?.fields ?? {}).length;
92
100
  return [{
@@ -101,3 +109,28 @@ function factRecords(step, artifact, closed, partBy = undefined, checkList = und
101
109
  return { n: 3 + i, text: id === 'keys' ? c.text : labelled(c.text, pk ? 'picked' : 'agent'), ok: c.ok, result: c.result, source };
102
110
  });
103
111
  }
112
+
113
+ /**
114
+ * M19 am11 item 4: a list line that quotes nothing: one record per row of its shape part (each item field, the rule that sets the item count), each with the result of its OWN row (src/rowresults.js `rowResultsOf`, from bareguard's own gaps),
115
+ * its row's `key`, `by` and `part`. A red no row owns is a record of its own, in the closer's words. Never "every cited field matches its source".
116
+ * @param {any} step @param {any} closed @param {any[]|undefined} checkList @param {any[]|undefined} jobLines @param {string} source
117
+ */
118
+ function itemShapeRecords(step, closed, checkList, jobLines, source) {
119
+ const line = step.fromLine;
120
+ const list = Array.isArray(checkList) ? checkList : [];
121
+ const rows = stepRowsOf({ declaration: { checkList: list, steps: [step] }, st: step, lines: Array.isArray(jobLines) ? jobLines : [] }).rows.filter((/** @type {any} */ r) => r.idx === 0 && /:shape:/.test(String(r.part)));
122
+ const ofLine = list.filter((/** @type {any} */ r) => r?.line === line);
123
+ const rules = ofLine.filter((/** @type {any} */ r) => r.kind === 'rule' && r.state === 'built' && r.part?.part === 0).map((/** @type {any} */ r) => r.rule);
124
+ const said = rulesOfLine((Array.isArray(jobLines) ? jobLines : []).find((/** @type {any} */ l) => l?.n === line));
125
+ const ruleCounts = Object.fromEntries(rules.map((/** @type {number} */ k) => [k, itemCountOf(String(said[k - 1] ?? ''))]).filter(([, c]) => c !== null));
126
+ const graded = { verdict: closed.verdict, rawGaps: Array.isArray(closed.shapeGaps) ? closed.shapeGaps : [], ruleCounts };
127
+ const res = rowResultsOf(ofLine, { step: line, parts: [{ ...step.close.itemShape, class: 'shape', rules }] }, graded);
128
+ const got = new Map(res.rows.map((/** @type {any} */ r) => [r.key, r]));
129
+ /** @type {any[]} */
130
+ const out = rows.map((/** @type {any} */ r, /** @type {number} */ i) => {
131
+ const g = got.get(r.key);
132
+ return { n: 3 + i, text: r.text, ok: g?.result === 'passed', result: g === undefined ? 'no result' : g.result === 'passed' ? null : g.result === 'failed' ? g.why : g.result, source, by: r.by, part: r.idx, key: r.key };
133
+ });
134
+ for (const u of res.unclaimed) out.push({ n: 3 + out.length, text: u, ok: false, result: null, source, unclaimed: true });
135
+ return out;
136
+ }
package/src/types.js CHANGED
@@ -255,6 +255,7 @@
255
255
  * @property {Array<{id:string, text:string, ok:boolean, result:string|null}>} [checks] a softgreen close: every check it ran (M4d am29 item 2)
256
256
  * @property {{text: string, ok: boolean, result: string|null}} [numbersCheck] the numbers tie of a text line (M16 R7): beside the class's own verdict
257
257
  * @property {{part: any, check: any, results?: unknown}} [cited] a cited green close (M10 piece 4): the fact part and the check's own answer, for the run's cited-check record
258
+ * @property {any[]} [shapeGaps] a line with an itemShape close (M19 S5): bareguard's own gaps of the items check (names, counts and bounds, never a value)
258
259
  * @property {{inputs: Array<{name:string, sha256:string}>, claims: unknown, checks: Array<{id:string, text:string, ok:boolean, result:string|null}>}} [sheetRecord] a sheet close (M10b piece 2): what the run's sheet-check record keeps
259
260
  */
260
261
 
package/src/whole-job.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // M13 am9 / M15 am3: the file holds the whole job. ONE writer of the whole-job text (`wholeJobText`), ONE finder of the Ask that shows it (`wholeJobAskIndex`).
2
- // The last Ask before the added `write it out` shows every step's result in job order, built by code from each step's saved output (never picked by the AI). Since M15 am3 that text is the BODY of the
2
+ // The last Ask before the action shows every step's result in job order, built by code from each step's saved output (never picked by the AI). Since M15 am3 that text is the BODY of the
3
3
  // run's one markdown report (`renderReportBody`, src/report.js: `## <n>. <line>`, the ~ rules, what code checked, the AI's answer under its heading; an Ask before it is one line
4
4
  // `Line <n>: you accepted this at the Ask.`); the last Ask itself and the send line are not sections. The accepted artifact is `{text}`; the send adds the title and the Passed line and writes it.
5
5
  // Throws away: what `renderReportBody` throws away. Third outcomes: a work step with no readable saved output refuses, naming the step; a frozen sheet the report needs that cannot be read refuses, naming it.
@@ -43,7 +43,7 @@ export function wholeJobAskIndex({ steps, askLines, sendLines }) {
43
43
  }
44
44
 
45
45
  /** the `~` rules of a signed job line, one string each: the parsed line carries them joined by "; " in `guardrail` (several `~` lines under one step are one guardrail), as the Result tab reads it @param {any} jl @returns {string[]} */
46
- const lineRulesOf = (jl) => (jl && typeof jl.guardrail === 'string' && jl.guardrail !== '' ? jl.guardrail.split('; ').filter(Boolean) : lineRules(jl));
46
+ export const lineRulesOf = (jl) => (jl && typeof jl.guardrail === 'string' && jl.guardrail !== '' ? jl.guardrail.split('; ').filter(Boolean) : lineRules(jl));
47
47
 
48
48
  /**
49
49
  * Is the prose of this step checked by code (M15 am3 item 2: `### The answer` instead of the not-checked heading)? Only when code really checked the step's own text (a green close with a words-per-section
@@ -60,6 +60,9 @@ export function proseCheckedOf(step, checkList) {
60
60
  return shape.wordsPerSection !== undefined || (Array.isArray(shape.picked) && shape.picked.length > 0) || (Array.isArray(c.picked) && c.picked.length > 0);
61
61
  }
62
62
 
63
+ /** the signed shape part of a step (its close's `itemShape`, M19 S5), or null: the report writes the shape section for a line that holds one (M19 amendment C) @param {any} step */
64
+ const shapeOfStep = (step) => (step?.close?.itemShape && typeof step.close.itemShape === 'object' && Array.isArray(step.close.itemShape.fields) ? step.close.itemShape : null);
65
+
63
66
  /**
64
67
  * What the report needs besides the steps: the signed lines' own words (the `~` rules), the run's frozen sheets and which sheet checks passed. Read once from the run folder.
65
68
  * @param {{ runDir: string, steps: any[], jobLines: any[]|null|undefined, checkList?: any[]|null }} p
@@ -87,10 +90,10 @@ export function reportContextOf({ runDir, steps, jobLines, checkList }) {
87
90
  /**
88
91
  * @param {{ steps: { fromLine: number, goal: string, emits?: string, close?: any }[], askLines: Map<number, any>, lastAskIndex: number,
89
92
  * readResult: (id: string) => ({ ok: true, value: any } | { ok: false, missing: true } | { ok: false, missing: false, red: string }),
90
- * context: ReturnType<typeof reportContextOf> }} p
93
+ * context: ReturnType<typeof reportContextOf>, redPrefix?: string }} p `redPrefix` is `ask: ` (an Ask job's words, unchanged); M15 am4 gives a job with no Ask `send: `
91
94
  * @returns {{ ok: true, value: { text: string } } | { ok: false, red: string }}
92
95
  */
93
- export function wholeJobText({ steps, askLines, lastAskIndex, readResult, context }) {
96
+ export function wholeJobText({ steps, askLines, lastAskIndex, readResult, context, redPrefix = 'ask: ' }) {
94
97
  if (!context.ok) return { ok: false, red: context.red };
95
98
  /** @type {Parameters<typeof renderReportBody>[0]} */
96
99
  const lines = [];
@@ -105,14 +108,15 @@ export function wholeJobText({ steps, askLines, lastAskIndex, readResult, contex
105
108
  return {
106
109
  ok: false,
107
110
  red: r.missing
108
- ? `ask: the saved output "${s.emits}" of step "${s.goal}" is missing — refusing to show the whole job`
109
- : `ask: the saved output "${s.emits}" of step "${s.goal}" — ${r.red}`,
111
+ ? `${redPrefix}the saved output "${s.emits}" of step "${s.goal}" is missing — refusing to show the whole job`
112
+ : `${redPrefix}the saved output "${s.emits}" of step "${s.goal}" — ${r.red}`,
110
113
  };
111
114
  }
112
115
  const jl = context.jobLines.find((/** @type {any} */ l) => l && l.n === s.fromLine);
113
116
  lines.push({
114
117
  n: s.fromLine, kind: 'work', text: s.goal, rules: lineRulesOf(jl), artifact: r.value,
115
118
  checks: Array.isArray(s.close?.sheet) ? s.close.sheet : [], okIds: context.okIdsOf(s.fromLine), proseChecked: proseCheckedOf(s, context.checkList),
119
+ shape: shapeOfStep(s),
116
120
  });
117
121
  }
118
122
  return { ok: true, value: { text: renderReportBody(lines, context.tables) } };
@@ -121,10 +125,13 @@ export function wholeJobText({ steps, askLines, lastAskIndex, readResult, contex
121
125
  /**
122
126
  * M15 am3 item 6: the body the send writes. A plan whose last Ask shows the whole job (`wholeIdx` >= 0) was accepted AS that text: the body is `{text}` exactly, never rebuilt. A plan signed before
123
127
  * M13 am9 (or a job with no Ask) sends the one step right before the send: its section is written from the accepted artifact, the line being that step's own (or, past an Ask, the step the Ask read).
124
- * @param {{ content: any, wholeIdx: number, steps: any[], sendIndex: number, askLines: Map<number, any>, context: ReturnType<typeof reportContextOf> }} p
128
+ * M15 am4: a job with no signed Ask (`askLines.size === 0`, no whole-job Ask) writes every work line before the send, in line order: the whole-job text over the steps before the send, the step right before it
129
+ * read from `content` (what the person accepted), the earlier ones from the run's saved outputs (`readResult`). A missing or unreadable earlier output refuses by name, in `send: ` words (never `ask: `).
130
+ * @param {{ content: any, wholeIdx: number, steps: any[], sendIndex: number, askLines: Map<number, any>, context: ReturnType<typeof reportContextOf>,
131
+ * readResult?: (id: string) => ({ ok: true, value: any } | { ok: false, missing: true } | { ok: false, missing: false, red: string }) }} p
125
132
  * @returns {{ ok: true, body: string } | { ok: false, red: string }}
126
133
  */
127
- export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, context }) {
134
+ export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, context, readResult }) {
128
135
  if (wholeIdx >= 0) {
129
136
  return typeof content?.text === 'string' && Object.keys(content).length === 1
130
137
  ? { ok: true, body: content.text }
@@ -132,6 +139,14 @@ export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, cont
132
139
  }
133
140
  if (!context.ok) return { ok: false, red: context.red };
134
141
  const before = steps[sendIndex - 1];
142
+ if (askLines.size === 0) {
143
+ if (!readResult) return { ok: false, red: 'send: no reader for the run\'s saved outputs was given — refusing to write a report' };
144
+ const whole = wholeJobText({
145
+ steps, askLines, lastAskIndex: sendIndex, context, redPrefix: 'send: ',
146
+ readResult: (id) => (before && id === before.emits ? { ok: true, value: content } : readResult(id)),
147
+ });
148
+ return whole.ok ? { ok: true, body: whole.value.text } : whole;
149
+ }
135
150
  const made = before && askLines.has(before.fromLine) ? steps.find((x) => x.emits === (before.reads ?? [])[0]) ?? before : before;
136
151
  const jl = context.jobLines.find((/** @type {any} */ l) => l && l.n === made?.fromLine);
137
152
  return {
@@ -139,6 +154,7 @@ export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, cont
139
154
  body: renderReportBody([{
140
155
  n: made?.fromLine, kind: 'work', text: made?.goal, rules: lineRulesOf(jl), artifact: content,
141
156
  checks: Array.isArray(made?.close?.sheet) ? made.close.sheet : [], okIds: context.okIdsOf(made?.fromLine), proseChecked: proseCheckedOf(made, context.checkList),
157
+ shape: shapeOfStep(made),
142
158
  }], context.tables),
143
159
  };
144
160
  }
@@ -21,7 +21,7 @@ export function lastAcceptedSha(steps: {
21
21
  emits?: string;
22
22
  }[], i: number, acceptedAskEmitsThisRun: Map<string, string | null>): string | null;
23
23
  /**
24
- * am11a 1/2: the wait of the stop. The LAST Ask's own wait when the job has an Ask before the action; else the card's Ask wait kept in the run's signed values (`arbiter.actionWaitMs`), else 1h.
24
+ * am11a 1/2: the wait of the stop. The LAST Ask's own wait when the job has an Ask before the action; else the card's Ask wait kept in the run's signed values (`sendSlot.waitMs`, src/runvalues.js), else 1h.
25
25
  * @param {{ fromLine: number }[]} steps @param {number} i @param {Map<number, {ttlMs: number}>} askLines @param {number|undefined} actionWaitMs
26
26
  */
27
27
  export function stopWaitMs(steps: {
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @param {any} declaration the signed plan @param {any[]} diary the run's `checks` rows (src/diary.js readChecks) @param {{items?: string[], by?: Record<string, string>}|null} notChecked the sign row's Not-checked block
3
3
  * @param {{lines?: any[], csvRoles?: string[]}} [sheet] the signed job lines and CSV roles: a plan whose list has sheet rows (M16 am4) shows them here, tagged by where each comes from (hamr 2026-11-14)
4
- * @returns {{checks: AuditCheckRow[], notChecked: AuditCheckRow[], readNotes: string[], always: AuditCheckRow[]}|null} null for a plan with no list (it keeps its own Audit rows)
5
- * @typedef {{text: string, by: 'you'|'agent'|'default'|null, result: 'passed'|'failed'|'none'|'not-checked'}} AuditCheckRow
4
+ * @returns {{checks: AuditCheckRow[], notChecked: AuditCheckRow[], readNotes: string[], always: AuditCheckRow[], lines: AuditLine[], jobNotChecked: AuditCheckRow[]}|null} null for a plan with no list (it keeps its own Audit rows)
5
+ * @typedef {{n: number, text: string, checks: AuditCheckRow[], notChecked: AuditCheckRow[]}} AuditLine
6
+ * @typedef {{text: string, by: 'you'|'agent'|'default'|null, result: 'passed'|'failed'|'none'|'not-checked', kind?: 'truth'|'shape'|'file', why?: string}} AuditCheckRow
6
7
  */
7
8
  export function auditChecksOf(declaration: any, diary: any[], notChecked: {
8
9
  items?: string[];
@@ -15,11 +16,21 @@ export function auditChecksOf(declaration: any, diary: any[], notChecked: {
15
16
  notChecked: AuditCheckRow[];
16
17
  readNotes: string[];
17
18
  always: AuditCheckRow[];
19
+ lines: AuditLine[];
20
+ jobNotChecked: AuditCheckRow[];
18
21
  } | null;
19
22
  /** the words of a row no result was recorded for: never "passed" */
20
23
  export const AUDIT_NO_RESULT: "no result recorded";
24
+ export type AuditLine = {
25
+ n: number;
26
+ text: string;
27
+ checks: AuditCheckRow[];
28
+ notChecked: AuditCheckRow[];
29
+ };
21
30
  export type AuditCheckRow = {
22
31
  text: string;
23
32
  by: "you" | "agent" | "default" | null;
24
33
  result: "passed" | "failed" | "none" | "not-checked";
34
+ kind?: "truth" | "shape" | "file";
35
+ why?: string;
25
36
  };
@@ -62,7 +62,7 @@ export function fmtTtl(ms: any): string;
62
62
  /** Zero-based indexes of the header and heading lines in a readout's text (split on "\n"): the panel renders those bold. */
63
63
  export function readoutHeadIndexes(text: any): any[];
64
64
  /** Plain-text readout of what the human is about to sign. Pure. */
65
- export function buildReadout({ declaration, arbiter, lines, name, modelId, costUsd, rounds, spendComplete, root, }: {
65
+ export function buildReadout({ declaration, arbiter, lines, name, modelId, costUsd, rounds, spendComplete, root, notChecked, notCheckedBy, suggested, checkCard, }: {
66
66
  declaration: any;
67
67
  arbiter: any;
68
68
  lines: any;
@@ -72,6 +72,23 @@ export function buildReadout({ declaration, arbiter, lines, name, modelId, costU
72
72
  rounds: any;
73
73
  spendComplete: any;
74
74
  root: any;
75
+ notChecked?: string[] | undefined;
76
+ notCheckedBy?: Record<string, string> | undefined;
77
+ suggested?: {
78
+ line: number;
79
+ text: string;
80
+ key?: string;
81
+ dropped?: boolean;
82
+ }[] | undefined;
83
+ checkCard?: {
84
+ rows: {
85
+ line: number;
86
+ by: string;
87
+ state: string;
88
+ text: string;
89
+ kind?: string;
90
+ }[];
91
+ } | null | undefined;
75
92
  }): string;
76
93
  /** Read the prose file. Refuses (a red, never a throw) on unreadable or blank. */
77
94
  export function readProseFile(file: any): {
@@ -115,7 +132,7 @@ export function writePlanFiles(dir: string, files: Record<string, string>, opts?
115
132
  * Test seam: `provider`/`rates`/`modelId` are injected; without them a live provider is built.
116
133
  * `onResult({ ok })` (M4d am32): called once, after the spend is booked and just before the result files are written (the CLI gives its monthly hold back there).
117
134
  */
118
- export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, columnAnswers, carriedColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, actionMode, }: {
135
+ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, columnAnswers, carriedColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, carriedShapeDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, actionMode, }: {
119
136
  proseFile: any;
120
137
  dir: any;
121
138
  root: any;
@@ -138,6 +155,7 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
138
155
  carriedPicks: any;
139
156
  carriedChoices: any;
140
157
  carriedSheetDropped: any;
158
+ carriedShapeDropped: any;
141
159
  proseRead: any;
142
160
  flowType?: "tickets" | "mcp" | "plain" | undefined;
143
161
  mcpServer?: string | undefined;
@@ -149,6 +167,7 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
149
167
  wrote: boolean;
150
168
  reds: any;
151
169
  costUsd: number;
170
+ box: string | null;
152
171
  } | {
153
172
  ok: boolean;
154
173
  wrote: boolean;
@@ -1,14 +1,10 @@
1
- /** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'cant-check'|'no-check'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>}} BlockAsk */
1
+ /** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>}} BlockAsk */
2
2
  /**
3
- * The questions the block has open, in the order the person meets them: the look's readings, then the look's can't-checks, then the pick path's asks (a proposal or a can't-check about a rule the pick path owns) in rule order (a proposal is not counted toward the 3-ask cap).
4
- * A can't-check about a rule the PICK path owns (`scoped`: src/checkpick.js scopedRules, every `~` rule of a file job) is the pick path's own ask, `no-check`, in fwd's words (a "Line N, guardrail ...: I can't check this" ask
5
- * whose answer the panel records as a pick, so Revise carries it: am17/am18/am21); any other can't-check is the look's own ask about a page.
6
- * @param {import('./checkblock.js').CheckBlock} block @param {{line: number, rule: number}[]} [scoped] @returns {BlockAsk[]}
3
+ * The questions the block has open, in the order the person meets them: the look's readings, then the pick path's proposals (a proposal is not counted toward the 3-ask cap).
4
+ * M19 am3: a rule no check can settle is no longer asked, so `block.open` holds only `reading` and `check` asks; any other kind is a bug and throws.
5
+ * @param {import('./checkblock.js').CheckBlock} block @returns {BlockAsk[]}
7
6
  */
8
- export function questionsOfBlock(block: import("./checkblock.js").CheckBlock, scoped?: {
9
- line: number;
10
- rule: number;
11
- }[]): BlockAsk[];
7
+ export function questionsOfBlock(block: import("./checkblock.js").CheckBlock): BlockAsk[];
12
8
  /**
13
9
  * The person's choices back into the block, one by one (the choice decides, never the words). A choice the block refuses is returned with its plain reason; the question stays open.
14
10
  * @param {import('./checkblock.js').CheckBlock} block @param {{key: string, choice: string, text?: string}[]} choices @returns {{key: string, why: string}[]}
@@ -27,7 +23,7 @@ export type BlockAsk = {
27
23
  line: number;
28
24
  rule: number;
29
25
  source: "look";
30
- ask: "reading" | "cant-check" | "no-check" | "check";
26
+ ask: "reading" | "check";
31
27
  ruleText: string;
32
28
  question: string;
33
29
  counted: boolean;