fwdloop 0.33.0 → 0.34.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 (66) hide show
  1. package/bin/fwdloop +14 -2
  2. package/package.json +1 -1
  3. package/src/auditchecks.js +6 -4
  4. package/src/authoring.js +4 -3
  5. package/src/blockasks.js +3 -2
  6. package/src/blockassemble.js +40 -21
  7. package/src/blockdraft.js +8 -13
  8. package/src/blockpick.js +11 -1
  9. package/src/checkblock.js +95 -56
  10. package/src/checklist.js +1 -1
  11. package/src/checklistsign.js +1 -1
  12. package/src/checkpick.js +7 -73
  13. package/src/declaration.js +9 -7
  14. package/src/drafter.js +152 -130
  15. package/src/noteask.js +62 -0
  16. package/src/pageask.js +5 -68
  17. package/src/pagedry.js +27 -4
  18. package/src/pagerules.js +19 -3
  19. package/src/panel/author.js +3 -3
  20. package/src/panel/authorcard.js +34 -11
  21. package/src/panel/index.html +7 -1
  22. package/src/pickrecord.js +42 -54
  23. package/src/planrebuild.js +16 -6
  24. package/src/rowedit.js +35 -5
  25. package/src/rubricstep.js +9 -1
  26. package/src/setup.js +1 -1
  27. package/src/sheetblock.js +17 -7
  28. package/src/sheetbuild.js +151 -0
  29. package/src/sheetchecks.js +3 -2
  30. package/src/sheetfind.js +4 -4
  31. package/src/sheetlook.js +14 -3
  32. package/src/sheetoffer.js +50 -5
  33. package/src/sheetrows.js +18 -2
  34. package/src/ticket-draft.js +4 -21
  35. package/src/ticketrows.js +100 -0
  36. package/types/auditchecks.d.ts +2 -1
  37. package/types/authoring.d.ts +4 -2
  38. package/types/blockasks.d.ts +1 -2
  39. package/types/blockassemble.d.ts +20 -3
  40. package/types/blockdraft.d.ts +4 -12
  41. package/types/blockpick.d.ts +5 -0
  42. package/types/checkblock.d.ts +32 -17
  43. package/types/checklist.d.ts +3 -3
  44. package/types/checkpick.d.ts +4 -34
  45. package/types/declaration.d.ts +7 -0
  46. package/types/drafter.d.ts +15 -355
  47. package/types/noteask.d.ts +52 -0
  48. package/types/pageask.d.ts +0 -35
  49. package/types/pagedry.d.ts +13 -0
  50. package/types/pagerules.d.ts +7 -0
  51. package/types/panel/authorcard.d.ts +13 -8
  52. package/types/panel/authorflows.d.ts +4 -4
  53. package/types/panel/data.d.ts +1 -1
  54. package/types/pickrecord.d.ts +47 -13
  55. package/types/rowedit.d.ts +16 -1
  56. package/types/rubricstep.d.ts +3 -0
  57. package/types/sheetblock.d.ts +11 -4
  58. package/types/sheetbuild.d.ts +84 -0
  59. package/types/sheetchecks.d.ts +2 -1
  60. package/types/sheetfind.d.ts +2 -2
  61. package/types/sheetoffer.d.ts +26 -1
  62. package/types/sheetrows.d.ts +8 -0
  63. package/types/ticket-draft.d.ts +3 -49
  64. package/types/ticketrows.d.ts +61 -0
  65. package/src/repairs.js +0 -38
  66. package/types/repairs.d.ts +0 -13
package/src/checkblock.js CHANGED
@@ -1,4 +1,5 @@
1
- // borrowed-from: bareloop src/checkblock.js@v0.56.0 (3383cce) + f148028e (M16 am2: an agreed answer's follower row takes its parent's check after the parts are numbered, 4 lines in build())
1
+ // borrowed-from: bareloop src/checkblock.js@v0.57.0 (c18df406)
2
+ // first ported from: bareloop src/checkblock.js@v0.56.0 (3383cce) + f148028e (M16 am2: an agreed answer's follower row takes its parent's check after the parts are numbered, 4 lines in build())
2
3
  // Ported, not copied whole (M16 am3 (1)): the imports point at fwd's files (src/blockpick.js is bareloop's checkpick.js under another name), and the three patterns built from text
3
4
  // (the whole-word test in `inText`, the number test in `inJob` and `matchCount`) are written by hand, because src/ builds no pattern from text (test/signed-text.test.js).
4
5
  // THE CHECK BLOCK of a rubric job (hamr 2026-11-12: "goal again is simplfication and one flow one place ai suggestes ! code adds $ and code decides what worked/doable").
@@ -9,15 +10,16 @@
9
10
  // Pure: no I/O, no clock, no model. Rubric jobs only (repo jobs never run through it).
10
11
  import { countExact, countPhrase } from './pagebits.js';
11
12
  import { checkFactWords, keptSetOf } from './factwords.js';
12
- import { isCountable, keepOrDrop, countCheck, partOfPick, plainWords, sameRuleWords } from './blockpick.js';
13
- import { dropRows } from './pagedropwords.js';
14
- import { boundInWords, rubricStepShapeReds, defaultCitedText, readLimit, holdsManyBounds, NEGATING_RE } from './rubricstep.js';
13
+ import { isCountable, keepOrDrop, countCheck, obviousCheck, partOfPick, plainWords, sameRuleWords } from './blockpick.js';
14
+ import { dropRows, dropSentence } from './pagedropwords.js';
15
+ import { phraseInNoResult } from './pagedry.js';
16
+ import { boundInWords, rubricStepShapeReds, defaultCitedText, defaultNoteText, readLimit, holdsManyBounds, NEGATING_RE, WHY_OTHER_CURRENCY } from './rubricstep.js';
15
17
  import { validReading } from './pagerules.js';
16
18
  import { weekOnly, weekTokens, WEEK_ONLY_WORDS, MAX_BANG } from './checklist.js';
17
19
  import { fitPlacePhrase } from './placerule.js';
18
20
  import { ruleWords } from './pageask.js';
19
21
  import { SIGNED_ROW_FIELDS } from './declaredclose.js';
20
- import { factSentence, countSentence } from './citedcheck.js';
22
+ import { factSentence, countSentence, factsOfLook } from './citedcheck.js';
21
23
 
22
24
  /**
23
25
  * A row. `kind`: rule, fact, phrase, count, cited, numbers, floor. `by`: you (`~`), agent (`!`), default (`$`). A `~` row may carry `links` (the look's facts tied to it),
@@ -26,7 +28,7 @@ import { factSentence, countSentence } from './citedcheck.js';
26
28
  */
27
29
 
28
30
  /** the card's fixed words, one spelling (the renderer reads them; a test reads them too) */
29
- export const CARD_T = Object.freeze({ agreed: 'you agreed:', count: 'result count', cited: 'every claim is backed by a quote copied from', theInput: 'the input', numbers: 'every number in the text is in a checked quote of line', withWords: 'with the words' });
31
+ export const CARD_T = Object.freeze({ count: 'result count', cited: 'every claim is backed by a quote copied from', theInput: 'the input', numbers: 'every number in the text is in a checked quote of line', withWords: 'with the words' });
30
32
 
31
33
  /** the four row edits an AI reply may hold */
32
34
  export const EDIT_OPS = Object.freeze(['add', 'reading', 'pick', 'not-checkable']);
@@ -86,11 +88,12 @@ export const REASON = Object.freeze({
86
88
  export function renderCard(rows) {
87
89
  return rows.filter((r) => r.kind !== 'floor' && r.state !== 'suggested' && r.state !== 'dropped' && !r.hidden).map((r) => {
88
90
  let body;
89
- if (r.kind === 'rule') body = `"${r.text}"${r.pick ? ` -> ${plainWords(r.pick)}` : ''}${r.agreedText ? ` (${CARD_T.agreed} ${r.agreedText})` : ''}`;
91
+ if (r.kind === 'rule') body = `"${r.text}"${r.pick && !sameRuleWords(r.text, plainWords(r.pick)) ? ` -> ${plainWords(r.pick)}` : ''}`;
90
92
  else if (r.kind === 'count') body = `${CARD_T.count} ${r.min ?? ''}-${r.max ?? ''}`;
91
93
  else if (r.kind === 'cited') body = `${CARD_T.cited} "${r.source ?? CARD_T.theInput}"`;
94
+ else if (r.kind === 'note') body = defaultNoteText(r.line);
92
95
  else if (r.kind === 'numbers') body = `${CARD_T.numbers} ${(r.after ?? []).join(', ')}`;
93
- else body = `${r.kind} "${r.name ?? r.words?.[0] ?? ''}"${r.words?.length ? ` ${CARD_T.withWords} ${r.words.map((/** @type {string} */ w) => `"${w}"`).join(', ')}` : ''}`;
96
+ else body = `${r.kind} "${r.name ?? r.words?.[0] ?? ''}"${(r.grown ?? r.words)?.length ? ` ${CARD_T.withWords} ${(r.grown ?? r.words).map((/** @type {string} */ w) => `"${w}"`).join(', ')}` : ''}`;
94
97
  return { key: r.key, line: r.line, by: r.by, state: r.state, reason: r.reason ?? null, text: `${r.by === 'you' ? '~' : r.by === 'agent' ? '!' : '$'} ${body}` };
95
98
  });
96
99
  }
@@ -138,12 +141,16 @@ export class CheckBlock {
138
141
  this.deltaLog = [];
139
142
  /** @type {any} */
140
143
  this.closeCache = null;
144
+ /** @type {Map<number, 'yes'|'no'|'failed'>} the note question's answer per facts-only line (src/noteask.js; code decides what it means) */
145
+ this.notes = new Map();
141
146
  }
142
147
 
143
148
  textOf(/** @type {string|undefined} */ source) { return this.texts[source ?? this.labels[0] ?? ''] ?? Object.values(this.texts)[0] ?? ''; }
144
149
  /** @param {number} line @param {string} [kind] */
145
150
  rowsOn(line, kind) { return this.rows.filter((r) => r.line === line && (kind === undefined || r.kind === kind)); }
146
151
  ruleRows(/** @type {number} */ line) { return this.rows.filter((r) => r.kind === 'rule' && r.line === line); }
152
+ /** does a `~` rule's own row say it is Not checked? Then its row is the ONE place the rule is said (its reason: the look's sentence, or the person's Drop) @param {number} line @param {number} rule */
153
+ saysRule(line, rule) { return this.rows.some((r) => r.kind === 'rule' && r.line === line && r.rule === rule && r.state === 'not-checked' && typeof r.reason === 'string' && r.reason !== ''); }
147
154
  /** every word the person wrote on a line: the line and its `~` rules */
148
155
  said(/** @type {number} */ line) { return [this.lines.find((l) => l.n === line)?.text ?? '', ...this.ruleRows(line).map((r) => r.text)].join(' '); }
149
156
  /** @param {Row} r @returns {Row} the row as stored (a repeated key gets `#2`) */
@@ -199,8 +206,6 @@ export class CheckBlock {
199
206
  if (r.kind === 'floor') continue;
200
207
  if (r.left) r.can = { ok: false, why: REASON.left };
201
208
  else if (r.lookWhy && r.kind === 'fact' && !r.words.length) r.can = { ok: false, why: r.lookWhy };
202
- else if (r.folded) r.can = { ok: false, why: REASON.noPick };
203
- else if (r.parent) this.matchFollow(r);
204
209
  else if (r.kind === 'rule') this.matchRule(r);
205
210
  else if (r.kind === 'fact' || r.kind === 'phrase') this.matchBang(r);
206
211
  else if (r.kind === 'count') this.matchCount(r);
@@ -217,7 +222,7 @@ export class CheckBlock {
217
222
  }
218
223
 
219
224
  /** a `!` row: the agent's fact, phrase or count (a look fact tied to a rule is a link on that rule's row, never a row of its own) */
220
- isBang(/** @type {Row} */ r) { return r.by === 'agent' && (r.kind === 'fact' || r.kind === 'phrase' || r.kind === 'count') && !r.parent; }
225
+ isBang(/** @type {Row} */ r) { return r.by === 'agent' && (r.kind === 'fact' || r.kind === 'phrase' || r.kind === 'count'); }
221
226
 
222
227
  /**
223
228
  * The job's own word for a `!` row: when none of its page words is in the job line or its `~` rules but a proper name the job holds (capital or digit first, 3+ characters) is a whole-word part of one
@@ -241,12 +246,6 @@ export class CheckBlock {
241
246
  return (r.words ?? []).some((/** @type {string} */ w) => inText(said, w)) || (r.kind === 'fact' && typeof r.name === 'string' && inText(said, r.name));
242
247
  }
243
248
 
244
- /** a `~` line an agreed answer wrote (or a carried pair partner) is checked by the rule it was agreed from: one check, both numbers */
245
- matchFollow(/** @type {Row} */ r) {
246
- const parent = this.rows.find((x) => x.key === r.parent);
247
- r.can = parent?.can?.ok ? { ok: true, how: 'follow' } : { ok: false, why: parent?.can?.why ?? 'the rule it was agreed from is not checked' };
248
- }
249
-
250
249
  /** a `!` count row is built unless a `~` rule on its line already names the number */
251
250
  matchCount(/** @type {Row} */ r) {
252
251
  const nums = [r.min, r.max].filter((x) => Number.isInteger(x)).map(String);
@@ -263,12 +262,16 @@ export class CheckBlock {
263
262
  const links = (r.links ?? []).filter((/** @type {any} */ l) => !(negated && isPhrase(l)) && l.words.some((/** @type {string} */ w) => proved(this.textOf(l.source), w)));
264
263
  const said = this.said(r.line);
265
264
  let ownWhy = null;
265
+ let otherCurrency = false;
266
266
  for (const l of links) {
267
267
  let reading = l.reading;
268
268
  let ownWords = false;
269
269
  if (l.shape === 'money' || l.shape === 'time') {
270
270
  // the person's words win (hamr 2026-11-13): code's reading of the `~` words beats the look's and the AI's; theirs is used only when code cannot read the words
271
271
  const rd = this.wordsReading(l, r.text);
272
+ // fwdloop run walk-m16-flights run-1: "under $150" on a euro fact fell back to the look's reading and checked 150 euros; a bound in another currency than the page fact is never replaced by the look's or the AI's reading
273
+ const lim = !rd && l.shape === 'money' ? readLimit('money', r.text, l) : null;
274
+ if (lim && 'why' in lim && lim.why === WHY_OTHER_CURRENCY) { otherCurrency = true; continue; }
272
275
  if (rd) { reading = rd; ownWords = true; }
273
276
  else if (reading === undefined) {
274
277
  const own = readLimit(l.shape, r.text, l);
@@ -296,6 +299,7 @@ export class CheckBlock {
296
299
  r.can = { ok: true, how: 'fact', link: l, reading: undefined };
297
300
  return;
298
301
  }
302
+ if (otherCurrency) { r.can = { ok: false, why: `the amount in your rule is in another currency than the page's prices, so it is not checked.` }; return; }
299
303
  if (r.links?.length && !links.length) { r.can = { ok: false, why: REASON.lookNoWords }; return; }
300
304
  if (r.origin === 'typed' || r.cantAsked) { r.can = { ok: false, why: r.aiReason ?? r.lookWhy ?? REASON.nothingOnPage }; return; }
301
305
  if (r.links?.length) { r.can = { ok: false, why: r.aiReason ?? `the look tied a fact to this rule but gave no limit, and ${ownWhy ? `in your words ${ownWhy}` : 'your own words give none code can read'}, so you judge it at Accept.` }; return; }
@@ -306,6 +310,12 @@ export class CheckBlock {
306
310
  matchCountRule(/** @type {Row} */ r) {
307
311
  if (!r.pick && (r.cantAsked || !this.countScope(r.text))) { r.can = { ok: false, why: r.aiReason ?? REASON.noRule }; return; }
308
312
  if (r.pick) { r.can = { ok: true, how: 'pick' }; return; }
313
+ // no obvious asks (hamr 2026-11-14): a rule whose words ARE the check ("exactly 3 list items") is settled as it stands, so a replaced rule never re-asks on a re-draft or a Reuse
314
+ const obvious = obviousCheck(r.text);
315
+ if (obvious) {
316
+ const res = keepOrDrop(r.text, /** @type {any} */ ({ ...obvious }));
317
+ if (res.kept) { r.pick = res.check; r.from = 'pick'; r.can = { ok: true, how: 'pick' }; return; }
318
+ }
309
319
  const proposal = r.pickProposal ?? countCheck(r.text);
310
320
  if (!this.asks) r.can = { ok: false, why: REASON.noRule };
311
321
  else if (proposal) r.can = { ok: false, ask: 'check', proposal, why: REASON.waitingPick };
@@ -329,6 +339,12 @@ export class CheckBlock {
329
339
  r.can = { ok: true, how: 'place', strips: fits[0] ?? [] };
330
340
  return;
331
341
  }
342
+ // fwdloop run walk-m16-flights run-1: "Rome" was on the page (search box, toggles) but in no result row, so no run could pass it. When the line's look reads result rows (a money fact), a phrase in none of them is refused with the look's own sentence (one owner: pagedry.js + pagedropwords.js)
343
+ // (a look fact already went through the same dry read in pagemap.js, so only the AI's own adds are read here)
344
+ if (r.from === 'agent' && (r.shape ?? 'phrase') === 'phrase') {
345
+ const money = this.lookFacts.filter((/** @type {any} */ f) => f.line === r.line && f.shape === 'money' && (!r.source || !f.source || f.source === r.source));
346
+ if (phraseInNoResult(text, money, provedWords[0])) { r.can = { ok: false, why: dropSentence({ line: r.line, fact: r.name ?? provedWords[0], other: provedWords[0], reason: 'phrase-no-result' }) }; return; }
347
+ }
332
348
  r.can = { ok: true, how: 'bang', word: provedWords[0] };
333
349
  }
334
350
 
@@ -348,8 +364,6 @@ export class CheckBlock {
348
364
  map.push({ part: parts.length, line: l.n, rows: lineRows[i] ?? [], origin: 'code' });
349
365
  parts.push(p);
350
366
  });
351
- // a follow row ends with its parent's check: the parent's part is known only now, after the line's parts are numbered
352
- for (const f of this.rowsOn(l.n).filter((x) => x.parent)) f.part = this.rows.find((x) => x.key === f.parent)?.part ?? null;
353
367
  }
354
368
  // a suggestion code has not built stays off the card (Audit only, F-b); a held one is trialled: shown under Suggested only when code has proved it builds (hamr 2026-11-13)
355
369
  for (const r of this.rows.filter((x) => x.held)) this.trialOffer(r);
@@ -391,11 +405,11 @@ export class CheckBlock {
391
405
  for (const r of this.rowsOn(l.n)) {
392
406
  if (r.kind === 'floor') continue;
393
407
  r.part = null;
394
- if (r.parent) continue; // a follow row copies its parent's end state after the line is built
408
+ r.grown = undefined;
395
409
  if (!r.can?.ok) { r.state = 'not-checked'; r.reason = r.can?.why ?? 'not checked'; continue; }
396
410
  if (r.held) { r.state = 'suggested'; r.reason = r.choice === 'drop' ? REASON.dropped : REASON.suggested; continue; }
397
411
  if (r.can.how === 'pick') {
398
- const p = partOfPick(r.pick, r.text, [r.rule, ...this.followsOf(r).map((/** @type {Row} */ f) => f.rule)]);
412
+ const p = partOfPick(r.pick, r.text, [r.rule]);
399
413
  const reds = rubricStepShapeReds({ step: l.n, parts: [p] }, 'trial');
400
414
  if (reds.length) { r.state = 'not-checked'; r.reason = `the pick is not a legal check: ${reds[0].detail}`; continue; }
401
415
  pickParts.push({ p, key: r.key }); r.state = 'built'; r.reason = null;
@@ -407,7 +421,7 @@ export class CheckBlock {
407
421
  facts.push(...built.fresh);
408
422
  r.factNames = built.names;
409
423
  factRows.push({ r, src: built.src });
410
- if (r.kind === 'rule') rulesCarried.push(r.rule, ...this.followsOf(r).map((/** @type {Row} */ f) => f.rule));
424
+ if (r.kind === 'rule') rulesCarried.push(r.rule);
411
425
  r.state = 'built'; r.reason = null;
412
426
  }
413
427
  if (facts.length) {
@@ -418,19 +432,24 @@ export class CheckBlock {
418
432
  };
419
433
  const reds = rubricStepShapeReds({ step: l.n, parts: [part] }, 'trial');
420
434
  if (reds.length) for (const x of [...factRows.map((f) => f.r), ...(countRow ? [countRow] : [])]) { x.state = 'not-checked'; x.reason = `code could not build the line's fact part: ${reds[0]?.detail}`; x.part = null; }
421
- else { lineParts.push(part); lineRows.push([...factRows.map((f) => f.r.key), ...(countRow ? [countRow.key] : [])]); factLines.add(l.n); if (countRow) { countRow.state = 'built'; countRow.reason = null; } }
435
+ else {
436
+ // M17 am4 (B3): the ONE writer of a place's grown phrases (fwd's signed R2c, M10 am7 item 2): the part holds EVERY phrase as a fact of its own, and the row holds the same words (`grown`),
437
+ // so the card (renderCard), the plan and the Job tab say what the plan checks. A place the look did not grow keeps the one word.
438
+ const src = factRows[0]?.src;
439
+ const grownOf = (/** @type {any} */ f) => {
440
+ const k = f && f.shape === 'phrase' ? /** @type {any[]} */ (this.lookFacts).find((x) => x.line === l.n && Array.isArray(x.phrases) && String(x.name) === f.name && (x.source === undefined || x.source === src)) : undefined;
441
+ return k ? factsOfLook(k) : null;
442
+ };
443
+ for (const { r } of factRows) {
444
+ const words = (r.factNames ?? []).flatMap((/** @type {string} */ n) => (grownOf(facts.find((f) => f.name === n)) ?? []).map((x) => String(x.phrase)));
445
+ r.grown = words.length ? words : undefined;
446
+ }
447
+ lineParts.push({ ...part, facts: facts.flatMap((f) => grownOf(f) ?? [f]) }); lineRows.push([...factRows.map((f) => f.r.key), ...(countRow ? [countRow.key] : [])]); factLines.add(l.n); if (countRow) { countRow.state = 'built'; countRow.reason = null; } }
422
448
  } else if (countRow) { countRow.state = 'not-checked'; countRow.reason = REASON.countNeedsFact; }
423
449
  for (const { p, key } of pickParts) { lineParts.push(p); lineRows.push([key]); }
424
450
  this.buildDefaults(l, lineParts, lineRows, factLines);
425
- for (const f of this.rowsOn(l.n).filter((x) => x.parent)) {
426
- const par = this.rows.find((x) => x.key === f.parent);
427
- f.state = par?.state ?? 'not-checked'; f.reason = par?.state === 'built' ? null : (par?.reason ?? 'not checked'); // its part is set by build(), after the parts are numbered (one owner)
428
- }
429
451
  }
430
452
 
431
- /** the follow rows of a row (its agreed or carried `~` lines) */
432
- followsOf(/** @type {Row} */ r) { return this.rows.filter((x) => x.parent === r.key); }
433
-
434
453
  /**
435
454
  * The fact(s) a fact-like row builds, checked alone through the bareguard shapes and against the facts already on the line.
436
455
  * @param {Row} r @param {any[]} onLine the facts already built on this line @returns {{fresh: any[], src: string, names: string[]} | {why: string}}
@@ -476,7 +495,7 @@ export class CheckBlock {
476
495
  const cited = !this.cited ? null : this.rowsOn(l.n, 'cited')[0] ?? this.addRow({ key: `L${l.n}.$cited`, line: l.n, kind: 'cited', by: 'default', from: 'default', source: this.labels[0] });
477
496
  const numbers = this.rowsOn(l.n, 'numbers')[0] ?? null;
478
497
  if (cited) cited.part = null;
479
- if (factLines.has(l.n)) { if (cited) { cited.state = 'not-checked'; cited.reason = REASON.onePerLine; } return; }
498
+ if (factLines.has(l.n)) { if (cited) { cited.state = 'not-checked'; cited.reason = REASON.onePerLine; } this.buildNote(l, lineParts, lineRows); return; }
480
499
  const only = this.labels.length === 1 ? this.labels[0] : null;
481
500
  if (cited && only) { lineParts.push({ text: defaultCitedText(only), class: 'countable', check: 'cited', source: only }); lineRows.push([cited.key]); cited.state = 'built'; cited.reason = null; }
482
501
  else if (cited) { cited.state = 'not-checked'; cited.reason = REASON.manyInputs; }
@@ -487,6 +506,29 @@ export class CheckBlock {
487
506
  lineRows.push([nr.key]); nr.state = 'built'; nr.reason = null; nr.part = null;
488
507
  }
489
508
 
509
+ // borrowed-from: bareloop src/checkblock.js@v0.57.0 (c18df406) (buildNote, factOnlyLines, setNotes)
510
+ /**
511
+ * The `$` note row of a facts-only line: the one note question said yes -> a countable nonEmpty text part sits beside the facts (the existing keep-both shape), so the brief
512
+ * is FACTS AND TEXT and text-present is floored; no -> nothing; the call failed -> a Not checked row in plain words. One owner of the row and its part.
513
+ */
514
+ buildNote(/** @type {{n: number}} */ l, /** @type {any[]} */ lineParts, /** @type {string[][]} */ lineRows) {
515
+ const ans = this.notes.get(l.n);
516
+ if (ans !== 'yes' && ans !== 'failed') return;
517
+ const row = this.rowsOn(l.n, 'note')[0] ?? this.addRow({ key: `L${l.n}.$note`, line: l.n, kind: 'note', by: 'default', from: 'default' });
518
+ if (ans === 'failed') { row.state = 'not-checked'; row.reason = `could not ask whether line ${l.n} also wants a note`; row.part = null; return; }
519
+ lineParts.push({ text: defaultNoteText(l.n), class: 'countable', check: 'nonEmpty' });
520
+ lineRows.push([row.key]); row.state = 'built'; row.reason = null;
521
+ }
522
+
523
+ /** the job lines that ended up facts-only (a fact part and no text beside it): the lines the note question is about. Reconciles first. @returns {number[]} */
524
+ factOnlyLines() {
525
+ const c = this.reconcile();
526
+ return c.stages.filter((/** @type {any} */ st) => st.params.parts.some((/** @type {any} */ p) => p.class === 'fact') && !st.params.parts.some((/** @type {any} */ p) => p.class === 'countable')).map((/** @type {any} */ st) => st.params.step);
527
+ }
528
+
529
+ /** the note question's answers, `{line, answer: 'yes'|'no'|'failed'}`; the whole list is reconciled again @param {{line: number, answer: 'yes'|'no'|'failed'}[]} answers */
530
+ setNotes(answers) { for (const a of answers) this.notes.set(a.line, a.answer); this.reconcile(); }
531
+
490
532
  // 5. the code-forced questions for rows code cannot settle (a person answers; the CHOICE decides, never the words). Cap 3 is the caller's (MAX_QUESTIONS).
491
533
  ask() {
492
534
  this.open = [];
@@ -499,7 +541,8 @@ export class CheckBlock {
499
541
  hasOpenQuestions() { return this.open.length > 0; }
500
542
  hasPendingDelta() { return this.queue.length > 0; }
501
543
 
502
- // 6. the person's answer: a row edit from the typed CHOICE (agree | drop | rule)
544
+ // 6. the person's answer: a row edit from the typed CHOICE (agree | drop | rule). ONE rule in, ONE rule out (hamr 2026-11-14, superseding the 2026-11-12 ruling that an agreed answer is a new `~` line):
545
+ // the answer REPLACES the asked rule, same line and same rule number; this list is the one owner (the job text is rebuilt from it, `jobLinesView`).
503
546
  /** @param {string} qKey @param {string} choice @param {string} [text] @returns {{ok: true} | {ok: false, why: string}} */
504
547
  applyAnswer(qKey, choice, text) {
505
548
  const q = this.open.find((x) => x.key === qKey);
@@ -511,50 +554,46 @@ export class CheckBlock {
511
554
  if (q.ask === 'check') {
512
555
  const res = keepOrDrop(r.text, /** @type {any} */ ({ ...q.proposal }));
513
556
  if (!res.kept) return { ok: false, why: String(res.why) };
514
- r.pick = res.check; r.from = 'pick'; r.agreedText = plainWords(/** @type {any} */ (res.check));
515
- said = r.agreedText;
516
- } else { r.agreed = true; r.agreedText = said; }
517
- // hamr 2026-11-12 (ruling 1): an agreed answer is a `~` rule in plain words, a new line with the SAME rule number a typed rule gets; an edited added line (pairWith) IS that line, so its words are replaced
518
- if (r.pairWith !== undefined) r.text = said;
519
- else {
520
- // F318: agreeing to words the line already holds as a `~` rule adds no second line (the pick cites the rule that is there); a reading always adds its line
521
- const held = q.ask === 'check' ? this.ruleRows(r.line).filter((x) => sameRuleWords(x.text, said)).at(-1) : undefined;
522
- if (held === undefined) this.addRow({ key: `L${r.line}.~${this.ruleRows(r.line).length + 1}`, line: r.line, kind: 'rule', by: 'you', from: 'rule', origin: 'agreed', parent: r.key, text: said, rule: this.ruleRows(r.line).length + 1 });
523
- else if (held !== r) this.follow(r, held);
524
- }
557
+ r.pick = res.check; r.from = 'pick';
558
+ said = plainWords(/** @type {any} */ (res.check));
559
+ } else r.agreed = true;
560
+ r.text = said;
525
561
  return { ok: true };
526
562
  }
527
563
  if (choice === 'drop') { r.left = true; return { ok: true }; }
528
564
  if (choice === 'rule') {
529
565
  const said = String(text ?? '').replace(/\s+/g, ' ').trim();
530
566
  if (!said) return { ok: false, why: 'an answer is needed' };
531
- r.cantAsked = true;
532
- const n = this.ruleRows(r.line).length + 1;
533
- this.addRow({ key: `L${r.line}.~${n}`, line: r.line, kind: 'rule', by: 'you', from: 'rule', origin: 'typed', text: said, rule: n });
567
+ // the person's own words are the rule now (typed); a counting rule is judged again as written (settled when its words are the proposal), any other stays the person's to judge
568
+ r.text = said; r.origin = 'typed'; r.cantAsked = !isCountable(said);
534
569
  return { ok: true };
535
570
  }
536
571
  return { ok: false, why: 'not one of the choices' };
537
572
  }
538
573
 
539
- /** the `~` row `partner` is checked by `source` (one check, both rule numbers) */
540
- follow(/** @type {Row} */ source, /** @type {Row} */ partner) { partner.parent = source.key; partner.origin = 'agreed'; }
574
+ /**
575
+ * The job lines as the list now holds them: every line's `~` rules are the rule rows' own words, in rule order (a replaced rule keeps its place and number). ONE owner of the job text after an answer.
576
+ * @template {{n: number, text: string}} L @param {L[]} jobLines @returns {(L & {rule: string, rules: string[]})[]}
577
+ */
578
+ jobLinesView(jobLines) {
579
+ return jobLines.map((l) => {
580
+ const rules = this.ruleRows(l.n).sort((a, b) => a.rule - b.rule).map((r) => String(r.text));
581
+ return { ...l, rule: rules.join('; '), rules };
582
+ });
583
+ }
541
584
 
542
585
  /**
543
- * Revise keeps the picks of the last draft (am17/am18/am21, `src/pickrecord.js` `matchRecord`): a kept pick settles its rule and its added `~` line follows it; a kept left rule is
544
- * left; an edited added line (`pairRule`) is the row asked and its source follows it.
545
- * @param {{picks?: {line: number, rule: number, check: any, added?: string, own?: boolean}[], left?: {line: number, rule: number}[]}} kept
546
- * @param {{line: number, rule: number, pairRule?: number}[]} [asked] the rules still asked (a `pairRule` marks an edited added line)
586
+ * Revise keeps the picks of the last draft (am17/am18, `src/pickrecord.js` `matchRecord`): a kept pick settles its rule (its words are the final rule's words) and a kept left rule is left.
587
+ * @param {{picks?: {line: number, rule: number, check: any, own?: boolean}[], left?: {line: number, rule: number}[]}} kept
547
588
  */
548
- carry({ picks = [], left = [] }, asked = []) {
589
+ carry({ picks = [], left = [] }) {
549
590
  const rowOf = (/** @type {number} */ line, /** @type {number} */ rule) => this.ruleRows(line).find((x) => x.rule === rule);
550
591
  for (const p of picks) {
551
592
  const r = rowOf(p.line, p.rule);
552
593
  if (!r) continue;
553
- if (p.check) { r.pick = p.check; r.from = 'pick'; r.keptFromLast = true; r.agreedText = plainWords(p.check); } else { r.cantAsked = true; r.keptFromLast = true; }
554
- if (typeof p.added === 'string') { const add = this.ruleRows(p.line).filter((x) => x !== r && !x.parent && sameRuleWords(x.text, String(p.added))).at(-1); if (add) this.follow(r, add); }
594
+ if (p.check) { r.pick = p.check; r.from = 'pick'; r.keptFromLast = true; } else { r.cantAsked = !isCountable(r.text); r.keptFromLast = true; }
555
595
  }
556
596
  for (const l of left) { const r = rowOf(l.line, l.rule); if (r) { r.left = true; r.keptFromLast = true; } }
557
- for (const a of asked) if (a.pairRule !== undefined) { const r = rowOf(a.line, a.rule); if (r) { r.pairWith = a.pairRule; const src = rowOf(a.line, a.pairRule); if (src && src !== r) this.follow(r, src); } }
558
597
  }
559
598
 
560
599
  // 7. the AI's reply: a list of proposed ROW edits, each judged ALONE; a bad edit is refused on its own and costs the rest nothing
package/src/checklist.js CHANGED
@@ -41,7 +41,7 @@ export function weekTokens(t) {
41
41
  }
42
42
 
43
43
  /**
44
- * @typedef {{key: string, line: number, kind: 'rule'|'fact'|'cited'|'count'|'phrase'|'numbers'|'floor', from: 'rule'|'pick'|'look'|'agent'|'default', by: 'you'|'agent'|'default',
44
+ * @typedef {{key: string, line: number, kind: 'rule'|'fact'|'cited'|'count'|'phrase'|'numbers'|'note'|'floor', from: 'rule'|'pick'|'look'|'agent'|'default', by: 'you'|'agent'|'default',
45
45
  * words: string[], text?: string, rule?: number, part?: {line: number, part: number}, source?: string, name?: string, min?: number, max?: number, pick?: string, after?: number[],
46
46
  * state: 'listed'|'built'|'not-checked'|'dropped', reason: string|null, forRule?: number, reading?: import('./pagerules.js').Reading}} Row
47
47
  */
@@ -36,7 +36,7 @@ export function checkListReds(declaration) {
36
36
  const lines = [...new Set([...list.filter((r) => Number.isInteger(r.line)).map((r) => /** @type {number} */ (r.line)), ...sheetLines])].sort((a, b) => a - b);
37
37
  const stepsOn = (/** @type {number} */ n) => steps.filter((st) => st.fromLine === n);
38
38
  const partsOn = (/** @type {number} */ n) => stepsOn(n).flatMap((st) => closePartsOf(st, sheetListed));
39
- const built = list.filter((r) => r.state === 'built' && r.kind !== 'floor');
39
+ const built = list.filter((r) => r.state === 'built' && r.kind !== 'floor' && r.kind !== 'ticket');
40
40
  /** @type {string[]} */
41
41
  const reds = [];
42
42
  for (const r of built) {
package/src/checkpick.js CHANGED
@@ -205,95 +205,29 @@ export function countCheck(text) {
205
205
  /** the can't-check ask, as the signed words say it */
206
206
  export const CANT_CHECK_WORDS = "I can't check this. Your own words, or Not checked?";
207
207
  /** how every answer is told, once (am2 item 2's words) */
208
- export const HOW_TO_ANSWER = (/** @type {number} */ line, /** @type {boolean} */ agree) => `${agree ? 'Answer "agree" to use it, or type your own words' : 'Type your own words'} (your answer is added as a new ~ rule on line ${line}), or answer "drop it" to leave it Not checked.`;
208
+ export const HOW_TO_ANSWER = (/** @type {number} */ line, /** @type {boolean} */ agree) => `${agree ? 'Answer "agree" to use it, or type your own words' : 'Type your own words'} (your answer replaces that ~ rule on line ${line}), or answer "drop it" to leave it Not checked.`;
209
209
 
210
210
  /**
211
211
  * The asks for the rows: `Line n, guardrail "<…>": I propose <check in plain words>.` for a kept check, `Line n, guardrail "<…>": I can't check this. Your own words, or
212
212
  * Not checked?` when nothing was kept. A proposal is not counted toward am1's cap; a can't-check ask is (am16 (5)).
213
213
  * @param {ReturnType<typeof rowsFromAnswer>} rows
214
- * @returns {{pairRule?: number, line: number, rule: number, source: 'look', ask: 'check'|'no-check', ruleText: string, question: string, reading?: string, check?: Record<string, any>, counted: boolean}[]}
214
+ * @returns {{line: number, rule: number, source: 'look', ask: 'check'|'no-check', ruleText: string, question: string, reading?: string, check?: Record<string, any>, counted: boolean}[]}
215
215
  */
216
216
  export function checkAsks(rows) {
217
217
  return rows.map((r) => {
218
- const pair = typeof (/** @type {any} */ (r).pairRule) === 'number' ? { pairRule: /** @type {any} */ (r).pairRule } : {}; // M10 am21: the asked line is an edited added line
219
218
  if (r.check === null) {
220
- return { ...pair, line: r.line, rule: r.rule, source: 'look', ask: 'no-check', ruleText: r.text, counted: true, question: `Line ${r.line}, guardrail "${r.text}": ${CANT_CHECK_WORDS} ${HOW_TO_ANSWER(r.line, false)}` };
219
+ return { line: r.line, rule: r.rule, source: 'look', ask: 'no-check', ruleText: r.text, counted: true, question: `Line ${r.line}, guardrail "${r.text}": ${CANT_CHECK_WORDS} ${HOW_TO_ANSWER(r.line, false)}` };
221
220
  }
222
221
  const words = plainWords(/** @type {any} */ (r.check));
223
- return { ...pair, line: r.line, rule: r.rule, source: 'look', ask: 'check', ruleText: r.text, counted: false, reading: words, check: r.check, question: `Line ${r.line}, guardrail "${r.text}": I propose ${words}. ${HOW_TO_ANSWER(r.line, true)}` };
222
+ return { line: r.line, rule: r.rule, source: 'look', ask: 'check', ruleText: r.text, counted: false, reading: words, check: r.check, question: `Line ${r.line}, guardrail "${r.text}": I propose ${words}. ${HOW_TO_ANSWER(r.line, true)}` };
224
223
  });
225
224
  }
226
225
 
227
- // ---- the plan uses only the checks you picked (am16 (4)) -------------------------------------------------------------------------------------
226
+ // ---- the shape of a pick (M10 am16); the plan's checks are built by the list (src/checkblock.js), not here -------------------------------------------------------------------------------------
228
227
  /**
229
- * @typedef {{line: number, rule: number, check: Record<string, any>|null, added?: string, own?: boolean}} Pick
230
- * `check` = the check the person agreed to (null for their own words); `added` = the `~` rule the answer wrote on the line; `own` = their own words
228
+ * @typedef {{line: number, rule: number, check: Record<string, any>|null, own?: boolean}} Pick
229
+ * `check` = the check the person agreed to (null for their own words); `own` = their own words
231
230
  */
232
- /**
233
- * Settle every scoped rule against the person's answers: a rule with a picked check is checked; the `~` line an agree wrote is covered by that pick; every other
234
- * rule is Not checked, with the reason (`person-left` = they chose it, `own-words` = they gave their own words, `no-pick` = nothing was picked).
235
- * @param {ReturnType<typeof scopedRules>} rules @param {Pick[]} picks @param {{line: number, rule: number}[]} left
236
- * @returns {{checks: Map<number, Record<string, any>[]>, notes: {line: number, rule: number, text: string, reason: 'person-left'|'own-words'|'no-pick'}[]}}
237
- */
238
- export function settleRules(rules, picks, left) {
239
- /** @type {Map<number, Record<string, any>[]>} */
240
- const checks = new Map();
241
- /** @type {{line: number, rule: number, text: string, reason: 'person-left'|'own-words'|'no-pick'}[]} */
242
- const notes = [];
243
- const sameText = (/** @type {string|undefined} */ a, /** @type {string} */ b) => typeof a === 'string' && norm(a) === norm(b);
244
- for (const r of rules) {
245
- const own = picks.find((p) => p.line === r.line && p.rule === r.rule);
246
- if (own?.check) { checks.set(r.line, [...(checks.get(r.line) ?? []), own.check]); continue; }
247
- if (picks.some((p) => p.check && p.line === r.line && sameText(p.added, r.text))) continue;
248
- if (left.some((l) => l.line === r.line && l.rule === r.rule)) notes.push({ ...r, reason: 'person-left' });
249
- else if (own?.own || picks.some((p) => !p.check && p.own && p.line === r.line && sameText(p.added, r.text))) notes.push({ ...r, reason: 'own-words' });
250
- else notes.push({ ...r, reason: 'no-pick' });
251
- }
252
- return { checks, notes };
253
- }
254
-
255
- /**
256
- * Overwrite the drafter's check on every step of a line this call settles (a green step, which another signed part settles, is left alone): a line with picked checks
257
- * is softgreen and carries exactly those checks; a line with none is hitl. Whatever `close.shape` the drafter wrote is gone. Pure: returns a new declaration.
258
- * @param {any} declaration @param {ReturnType<typeof scopedRules>} rules @param {ReturnType<typeof settleRules>} settled
259
- * @param {(note: {line: number, reason: 'person-left'|'own-words'|'no-pick'}) => string} sentence the one table's words for a reason
260
- */
261
- export function applyPicks(declaration, rules, settled, sentence) {
262
- if (!declaration || !Array.isArray(declaration.steps)) return declaration;
263
- const lineSet = new Set(rules.map((r) => r.line));
264
- const green = (/** @type {number} */ n) => declaration.steps.some((/** @type {any} */ st) => st?.fromLine === n && st?.close?.class === 'green');
265
- const mine = (/** @type {number} */ n) => lineSet.has(n) && !green(n);
266
- const steps = declaration.steps.map((/** @type {any} */ st) => {
267
- // M10 am22 (1): a fact line keeps its fact close and adds the person's picks to it (`close.picked`); the line stays green
268
- if (st && typeof st === 'object' && lineSet.has(st.fromLine) && green(st.fromLine)) {
269
- const { picked: _own, ...close } = st.close ?? {};
270
- const kept = settled.checks.get(st.fromLine) ?? [];
271
- return { ...st, close: kept.length && st.close?.class === 'green' ? { ...close, picked: kept } : close };
272
- }
273
- if (!st || typeof st !== 'object' || !mine(st.fromLine)) return st;
274
- const picked = settled.checks.get(st.fromLine) ?? [];
275
- return { ...st, close: picked.length ? { class: 'softgreen', shape: { picked } } : { class: 'hitl' } };
276
- });
277
- const out = { ...declaration, steps };
278
- // M10 am22 (3): the record of the fact lines that carry the person's picks, written here and nowhere else; whatever the drafter sent for it is gone
279
- const pickedLines = [...new Set(steps.filter((/** @type {any} */ st) => Array.isArray(st?.close?.picked) && st.close.class === 'green').map((/** @type {any} */ st) => st.fromLine))].sort((a, b) => a - b);
280
- if (pickedLines.length) out.pickedLines = pickedLines; else delete out.pickedLines;
281
- const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
282
- if (isRec(declaration.guardrailClasses)) {
283
- out.guardrailClasses = { ...declaration.guardrailClasses };
284
- const un = isRec(declaration.unjudgeable) ? { ...declaration.unjudgeable } : {};
285
- for (const n of lineSet) {
286
- if (!mine(n) || !declaration.steps.some((/** @type {any} */ st) => st?.fromLine === n)) continue;
287
- const has = (settled.checks.get(n) ?? []).length > 0;
288
- out.guardrailClasses[String(n)] = has ? 'softgreen' : 'hitl';
289
- if (has) delete un[String(n)];
290
- else un[String(n)] = [...new Set(settled.notes.filter((x) => x.line === n).map(sentence))].join(' ') || 'No check was picked for it, so you judge it at the Ask.';
291
- }
292
- if (isRec(declaration.unjudgeable) || Object.keys(un).length) out.unjudgeable = un;
293
- }
294
- return out;
295
- }
296
-
297
231
  // borrowed-from: bareloop src/checkpick.js@0408a8f (retentionOf, 890affa; adapted to fwdloop's one close per line: a unit is one cited fact of the line's step)
298
232
  /**
299
233
  * M10 am27 (4) RETENTION record of one draft (record only, counts, no words). Per job line: `aiParts` = the cited facts the drafter wrote on that line (a `cited` close counts once per
@@ -45,6 +45,7 @@ import { lineRules } from './pagebits.js';
45
45
  import { OFFERED as OFFERED_RULES } from './checkwords.js';
46
46
  import { isColumnChoiceRule } from './sheetoffer.js';
47
47
  import { checkListReds } from './checklistsign.js';
48
+ import { ticketListReds } from './ticketrows.js';
48
49
 
49
50
  /** @typedef {import('./types.js').Arbiter} Arbiter */
50
51
  /** @typedef {import('./types.js').SignedLine} SignedLine */
@@ -159,7 +160,7 @@ function checkMcp(declaration, reds) {
159
160
  /** M12 piece 3 (item 4): the signed label filter, `ticketFilter: {priority?: ['P0'..'P3'], labels?: [names]}`; optional, and only on a job that lists MCP tools.
160
161
  * Pure data: code decides at run (src/ticket-labels.js); the drafter may only suggest it and a human signs it.
161
162
  * @param {Record<string, any>} declaration @param {string[]} reds */
162
- function checkTicketFilter(declaration, reds) {
163
+ export function checkTicketFilter(declaration, reds) {
163
164
  if (!Object.hasOwn(declaration, 'ticketFilter')) return;
164
165
  const f = declaration.ticketFilter;
165
166
  if (!isPlainObject(f) || Object.keys(f).length === 0) {
@@ -186,7 +187,7 @@ function checkTicketFilter(declaration, reds) {
186
187
 
187
188
  /** M12 piece 3 (signed item 7): the ticket fields a schedule may watch, `ticketWatch: ['state'|'labels']`; optional, only on a job that lists MCP tools, typed values only.
188
189
  * The scheduler compares (src/trigger-tickets.js); the drafter may suggest, a human signs. @param {Record<string, any>} declaration @param {string[]} reds */
189
- function checkTicketWatch(declaration, reds) {
190
+ export function checkTicketWatch(declaration, reds) {
190
191
  if (!Object.hasOwn(declaration, 'ticketWatch')) return;
191
192
  const w = declaration.ticketWatch;
192
193
  if (!Array.isArray(w) || w.length === 0) { reds.push(`declaration: "ticketWatch" must be a non-empty list of fields (${WATCHABLE.join(' and ')})`); return; }
@@ -226,7 +227,7 @@ export const SHAPE_KEYS = Object.freeze(['maxWords', 'sections', 'linesPerInvoic
226
227
  export const MACHINE_SHAPE_KEYS = Object.freeze(['wordsPerSection', 'picked']);
227
228
 
228
229
  const SHAPE_TYPE_CHECKS = Object.freeze({
229
- // M10 am16: the checks the person picked, set by code (src/checkpick.js applyPicks), each one a bareguard rule with only that rule's own fields
230
+ // M10 am16: the checks the person picked, set by code (src/blockassemble.js), each one a bareguard rule with only that rule's own fields
230
231
  picked: {
231
232
  expected: 'a non-empty array of checks, each an object with a text rule of bareguard\'s list',
232
233
  check: (v) => Array.isArray(v) && v.length > 0 && v.every((c) => isPlainObject(c) && typeof c.rule === 'string' && OFFERED_RULES.includes(c.rule)),
@@ -560,7 +561,7 @@ function checkShapeBuilds(shape, label, reds, redsBefore) {
560
561
  }
561
562
 
562
563
  /**
563
- * M10 am22 (3): `pickedLines` is the record of the fact lines that carry the person's picks: a list of line numbers. Code writes it (src/checkpick.js applyPicks).
564
+ * M10 am22 (3): `pickedLines` is the record of the fact lines that carry the person's picks: a list of line numbers. Code writes it (src/blockassemble.js).
564
565
  * @param {Record<string, any>} declaration @param {string[]} reds
565
566
  */
566
567
  function checkPickedLines(declaration, reds) {
@@ -571,7 +572,7 @@ function checkPickedLines(declaration, reds) {
571
572
 
572
573
  /**
573
574
  * M10 am22: `close.picked` is the checks the person picked for a fact line, kept beside its fact check and run on the answer's `text`. Code sets it (src/checkpick.js
574
- * applyPicks); here it must be a green step's, a list of bareguard text rules that builds into a check.
575
+ * assembleFromBlock); here it must be a green step's, a list of bareguard text rules that builds into a check.
575
576
  * It is allowed ONLY on a line the signed plan records in `pickedLines` (written by code from the person's picks); a count on any other fact line is refused.
576
577
  * @param {any} step @param {string} label @param {string} effectiveClass @param {string[]} reds @param {Record<string, any>} declaration
577
578
  */
@@ -818,10 +819,10 @@ export function validateDeclaration(declaration, context = {}) {
818
819
  reds.push('declaration: "guardrailClasses" must be an object keyed by line number');
819
820
  }
820
821
 
821
- // --- unjudgeable (REQUIRED; {} is fine) ------------------------------------
822
+ // --- unjudgeable (M17 am4, C8: a new plan carries none; a plan signed before holds it and is read as signed) ---
822
823
  let unjudgeable = {};
823
824
  if (!Object.prototype.hasOwnProperty.call(declaration, 'unjudgeable')) {
824
- reds.push('declaration: "unjudgeable" is required (an object keyed by line number; {} is fine)');
825
+ // nothing to read
825
826
  } else if (Array.isArray(declaration.unjudgeable) && declaration.unjudgeable.length === 0) {
826
827
  // am41 item 1 (F63): an empty list carries no data; it counts as {}. A non-empty list falls to the red below.
827
828
  } else if (isPlainObject(declaration.unjudgeable)) {
@@ -1121,6 +1122,7 @@ export function validateDeclaration(declaration, context = {}) {
1121
1122
 
1122
1123
  // M16 item 2: the checks of a list line are the signed list's; a plan carrying one proves it here, at sign and at run start ($0)
1123
1124
  reds.push(...checkListReds(declaration));
1125
+ reds.push(...ticketListReds(declaration));
1124
1126
 
1125
1127
  // --- ask slots (ported from poc/m1/slots.mjs's checkAskSlots) --------------
1126
1128
  // (a) exactly one hitl step bound to each signed ask line.