fwdloop 0.35.2 → 0.37.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 (104) hide show
  1. package/README.md +1 -1
  2. package/bin/fwdloop +5 -2
  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 -43
  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 +610 -64
  14. package/src/checked.js +28 -33
  15. package/src/checklistsign.js +2 -1
  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 +26 -4
  23. package/src/drafter.js +86 -62
  24. package/src/factwords.js +7 -4
  25. package/src/globprefix.js +26 -0
  26. package/src/model-step.js +22 -4
  27. package/src/pageask.js +6 -4
  28. package/src/pagedropwords.js +3 -11
  29. package/src/pagedry.js +75 -1
  30. package/src/pagefetch.js +11 -6
  31. package/src/pagelook.js +2 -1
  32. package/src/pagerules.js +8 -2
  33. package/src/panel/author.js +20 -8
  34. package/src/panel/authorcard.js +3 -3
  35. package/src/panel/data.js +3 -2
  36. package/src/panel/index.html +176 -41
  37. package/src/panel/result.js +40 -3
  38. package/src/pickrecord.js +14 -0
  39. package/src/planrebuild.js +55 -19
  40. package/src/ratelimit.js +117 -0
  41. package/src/report.js +216 -0
  42. package/src/rowresults.js +111 -0
  43. package/src/rubricstep.js +65 -2
  44. package/src/runner.js +61 -9
  45. package/src/send.js +19 -82
  46. package/src/shapebuild.js +281 -0
  47. package/src/shapelook.js +91 -0
  48. package/src/shapemenu.js +64 -0
  49. package/src/shaperesult.js +104 -0
  50. package/src/shaperows.js +263 -0
  51. package/src/shapewords.js +140 -0
  52. package/src/sheetbuild.js +41 -29
  53. package/src/sheetclaims.js +49 -1
  54. package/src/sheetfind.js +8 -0
  55. package/src/sheetlook.js +11 -1
  56. package/src/sheetrows.js +10 -64
  57. package/src/ticketrows.js +1 -1
  58. package/src/try-checks.js +39 -6
  59. package/src/types.js +1 -0
  60. package/src/whole-job.js +108 -16
  61. package/types/action-stop.d.ts +1 -1
  62. package/types/auditchecks.d.ts +13 -2
  63. package/types/authoring.d.ts +24 -4
  64. package/types/blockasks.d.ts +6 -10
  65. package/types/blockassemble.d.ts +13 -13
  66. package/types/blockdraft.d.ts +3 -2
  67. package/types/blockpick.d.ts +4 -0
  68. package/types/cardlist.d.ts +18 -2
  69. package/types/checkblock.d.ts +278 -28
  70. package/types/checked.d.ts +15 -6
  71. package/types/checklook.d.ts +36 -0
  72. package/types/checkrows.d.ts +119 -0
  73. package/types/citedcheck.d.ts +4 -2
  74. package/types/closers.d.ts +10 -1
  75. package/types/drafter.d.ts +8 -4
  76. package/types/globprefix.d.ts +5 -0
  77. package/types/model-step.d.ts +43 -2
  78. package/types/pageask.d.ts +5 -3
  79. package/types/pagedropwords.d.ts +0 -1
  80. package/types/pagedry.d.ts +27 -0
  81. package/types/pagefetch.d.ts +3 -2
  82. package/types/pagerules.d.ts +4 -0
  83. package/types/panel/result.d.ts +19 -2
  84. package/types/pickrecord.d.ts +10 -0
  85. package/types/ratelimit.d.ts +59 -0
  86. package/types/report.d.ts +46 -0
  87. package/types/rowresults.d.ts +28 -0
  88. package/types/rubricstep.d.ts +21 -0
  89. package/types/runner.d.ts +3 -1
  90. package/types/send.d.ts +13 -12
  91. package/types/shapebuild.d.ts +97 -0
  92. package/types/shapelook.d.ts +76 -0
  93. package/types/shapemenu.d.ts +40 -0
  94. package/types/shaperesult.d.ts +40 -0
  95. package/types/shaperows.d.ts +102 -0
  96. package/types/shapewords.d.ts +43 -0
  97. package/types/sheetbuild.d.ts +31 -13
  98. package/types/sheetclaims.d.ts +16 -0
  99. package/types/sheetfind.d.ts +1 -0
  100. package/types/sheetrows.d.ts +5 -36
  101. package/types/ticketrows.d.ts +1 -1
  102. package/types/try-checks.d.ts +2 -1
  103. package/types/types.d.ts +4 -0
  104. package/types/whole-job.d.ts +69 -3
package/src/model-step.js CHANGED
@@ -31,6 +31,9 @@ import { appendCall, appendTool, nextRound } from './diary.js';
31
31
  import { ConfigError } from './config.js';
32
32
  import { worstThinkingStatus } from './thinking.js';
33
33
  import { citedBrief, toldPicks } from './citedcheck.js';
34
+ import { shapeBriefOf, shapeLineBrief } from './rubricstep.js';
35
+
36
+ const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
34
37
  import { sheetAnswerProps, sheetBrief } from './sheetclaims.js';
35
38
 
36
39
  import {
@@ -138,14 +141,27 @@ const CITED_SCHEMA = Object.freeze({
138
141
  additionalProperties: false,
139
142
  });
140
143
 
144
+ // M19 S5: a step whose line is a list of items and nothing else (its close carries `itemShape` and no `cited`) answers `{results: [...]}`, one object per item; the check (src/closers.js closeItemShape, bareguard's `itemShape`)
145
+ // reads the fields, so the schema asks only for the list
146
+ const LIST_SCHEMA = Object.freeze({
147
+ type: 'object',
148
+ properties: {
149
+ results: { type: 'array', items: { type: 'object' } },
150
+ ...DONE_PROPS,
151
+ },
152
+ required: ['results', 'done'],
153
+ additionalProperties: false,
154
+ });
155
+
141
156
  /**
142
157
  * Build the `emit_artifact` tool schema from a step's declared close CLASS
143
158
  * only (plus, for a green step that quotes a saved page, the form of its answer).
144
159
  * `stepClass` is `'green' | 'softgreen' | 'hitl' | null | undefined`; `cited` is true for that green step.
145
160
  */
146
161
  /** @param {string|null|undefined} stepClass @param {boolean} [cited] @param {any[]|null} [sheet] M10b piece 2: the step's `close.sheet` (its claim boxes become the answer) @param {boolean} [withText] M10 am22: a fact step with the person's picks also answers in `text` (the picks read it) */
147
- export function buildEmitArtifactSchema(stepClass, cited = false, sheet = null, withText = false) {
162
+ export function buildEmitArtifactSchema(stepClass, cited = false, sheet = null, withText = false, items = false) {
148
163
  const text = withText ? { text: { type: 'string' } } : {};
164
+ if (items && !cited && (stepClass === 'green' || stepClass === 'softgreen')) return { ...LIST_SCHEMA, properties: { ...LIST_SCHEMA.properties, ...text }, required: [...LIST_SCHEMA.required.slice(0, 1), ...(withText ? ['text'] : []), 'done'] };
149
165
  if (stepClass === 'green' && Array.isArray(sheet)) {
150
166
  // M10b piece 2: a step that reads a sheet answers in one typed box per claim (bareguard's shapes), never a cite
151
167
  const { properties, required } = sheetAnswerProps(sheet);
@@ -334,7 +350,7 @@ function stoppedResult(cumulative, modelId, modelMatch) {
334
350
  * @param {{in:number,out:number}} [opts.rates]
335
351
  * @param {string} [opts.modelId]
336
352
  * @param {Record<string,string|undefined>} [opts.env] - the merged shell+keys-file env the key is read from (default process.env).
337
- * @returns {(executorContext:object, grantedTools:Record<string,any>, stepMeta?:{class?:string, attempt?:number, step?:string|null, cited?:any, sheet?:any[]|null, withText?:boolean, picked?:any[]|null, thinkingMode?:'on'|'off'}, seam?:{stopRequested?:() => boolean}) => Promise<any>}
353
+ * @returns {(executorContext:object, grantedTools:Record<string,any>, stepMeta?:{class?:string, attempt?:number, step?:string|null, cited?:any, sheet?:any[]|null, withText?:boolean, itemShape?:any, line?:number|null, picked?:any[]|null, thinkingMode?:'on'|'off'}, seam?:{stopRequested?:() => boolean}) => Promise<any>}
338
354
  */
339
355
  export function makeLiveModelStep({
340
356
  slot, model, spendPath, provider: injectedProvider, rates: injectedRates, modelId: injectedModelId, env,
@@ -375,7 +391,7 @@ export function makeLiveModelStep({
375
391
  const runDir = dirname(spendPath);
376
392
  const diaryStep = stepMeta.step ?? null;
377
393
  const diaryTry = typeof stepMeta.attempt === 'number' ? stepMeta.attempt : null;
378
- const toolSchema = buildEmitArtifactSchema(stepMeta.class, stepMeta.class === 'green' && Boolean(stepMeta.cited), stepMeta.class === 'green' && Array.isArray(stepMeta.sheet) ? stepMeta.sheet : null, stepMeta.class === 'green' && stepMeta.withText === true);
394
+ const toolSchema = buildEmitArtifactSchema(stepMeta.class, stepMeta.class === 'green' && Boolean(stepMeta.cited), stepMeta.class === 'green' && Array.isArray(stepMeta.sheet) ? stepMeta.sheet : null, stepMeta.class === 'green' && stepMeta.withText === true, isRec(stepMeta.itemShape));
379
395
  const thinkingMode = stepMeta.thinkingMode === 'on' || stepMeta.thinkingMode === 'off' ? stepMeta.thinkingMode : null;
380
396
  const systemPrompt = 'You are executing one step of a signed, human-authored automation. '
381
397
  + 'Call emit_artifact exactly once with this step\'s result. Ground every value in the '
@@ -389,9 +405,11 @@ export function makeLiveModelStep({
389
405
  // M14 item 2: what happened so far in this run (src/memo.js), whole, on every try that has any; absent = nothing has happened yet. Text only, it leans the model, the close alone judges
390
406
  ...(typeof executorContext.memo === 'string' && executorContext.memo !== '' ? { fromThisRun: executorContext.memo } : {}),
391
407
  // M10 am7 item 3: a step that quotes a saved page is told the form of its answer and what each result must hold; M10 am28: and each pick on its line (values only)
392
- ...(stepMeta.class === 'green' && stepMeta.cited ? { quoting: { ...citedBrief(stepMeta.cited), ...(Array.isArray(stepMeta.picked) && stepMeta.picked.length > 0 ? { yourTextHas: toldPicks(stepMeta.picked) } : {}) } } : {}),
408
+ ...(stepMeta.class === 'green' && stepMeta.cited ? { quoting: { ...citedBrief(stepMeta.cited), ...(isRec(stepMeta.itemShape) ? { eachResultAlso: shapeBriefOf(stepMeta.itemShape, stepMeta.cited) } : {}), ...(Array.isArray(stepMeta.picked) && stepMeta.picked.length > 0 ? { yourTextHas: toldPicks(stepMeta.picked) } : {}) } } : {}),
393
409
  // M10b piece 2: a step that reads a sheet is told the shape of each claim box (bareguard's worked example), never the check
394
410
  ...(stepMeta.class === 'green' && Array.isArray(stepMeta.sheet) ? { answering: sheetBrief(stepMeta.sheet) } : {}),
411
+ // M19 S5 (amendment B, the third brief exception): a step whose line is a list of items is told the answer, each field in plain words and one example item, all written by code; never a verdict, never its other guardrails
412
+ ...(isRec(stepMeta.itemShape) && !stepMeta.cited ? { answering: shapeLineBrief(stepMeta.line ?? 0, stepMeta.itemShape, stepMeta.withText === true) } : {}),
395
413
  // M10 am22: a fact step whose line carries the person's picks also writes the answer the job line asks for, in "text" (their sizes are in the job line)
396
414
  ...(stepMeta.class === 'green' && stepMeta.withText === true ? { alsoWrite: 'Also give "text": the written answer the goal asks for, in your own words, grounded in what you found. Never leave it empty.' } : {}),
397
415
  });
package/src/pageask.js CHANGED
@@ -10,6 +10,9 @@ import { columnTail } from './sheetfind.js';
10
10
  export const MAX_LOOK_ASKS = 3;
11
11
  /** the answer that drops a `~` rule the page cannot check: the person types it (any case, a closing full stop allowed) */
12
12
  export const DROP_IT = 'drop it';
13
+ // borrowed-from: bareloop src/questionbox.js@v0.60.0 (CHOICE_SAYS.pickColumn)
14
+ /** M17 am9 item 3: the door's refusal of a wrong answer to a column tie (signed words) */
15
+ export const TIE_PICK_SAY = 'This question has a list to choose from: pick one of the columns, or Drop it. Nothing was saved.';
13
16
  /** @param {unknown} text @returns {boolean} */
14
17
  export const isDropIt = (text) => String(text ?? '').trim().replace(/\.$/, '').toLowerCase() === DROP_IT;
15
18
  /** the answers that accept the code's reading of a rule; anything else the person types is their own reading */
@@ -66,9 +69,6 @@ const readingRest = (n) => `, or type your own reading (your answer replaces tha
66
69
  const cantCheckTail = (n) => ` Answer "${DROP_IT}", or type how to check it (your answer replaces that ~ rule on line ${n}).`;
67
70
  /** @param {number} n @param {string} rule @param {string} reading @returns {string} */
68
71
  export const readingQuestion = (n, rule, reading) => `Your line ${n} says "${rule}".${READING_HEAD}${reading}${READING_TAIL}${readingRest(n)}`;
69
- // borrowed-from: bareloop src/pagemap.js@v0.56.0 (3383cce) (cantCheckQuestion; readingQuestion above is exported for the block's asks)
70
- /** @param {number} n @param {string} rule @returns {string} the can't-check ask in its one spelling */
71
- export const cantCheckQuestion = (n, rule) => `Your line ${n} says "${rule}". I can't check this on the page. Drop it?${cantCheckTail(n)}`;
72
72
  /** @param {unknown} q a recorded question @returns {string|null} the reading a reading ask proposed, or null when it was another kind of question */
73
73
  export function readingOfQuestion(q) {
74
74
  const s = String(q ?? '');
@@ -119,7 +119,7 @@ export function decidedWords(h) {
119
119
  * person's own words, taken word for word with newlines folded to spaces. A question that is not a look ask is never changed: its answer is its rule.
120
120
  * M10 am16: a shape guardrail's ask (`ask: 'check'` proposes a check, `'no-check'` found none) takes the same words: `agree` takes the proposal (and the check it
121
121
  * carries, `check`), `drop it` leaves the rule Not checked (either kind), anything else is the person's own words (`own`: a `~` rule on the line, no check).
122
- * @param {{source?: string, ask?: string, proposal?: string|null, check?: Record<string, any>}} q @param {unknown} typed @param {'agree'|'drop'|'rule'} [choice] M10 am29: the button used; absent = today's words reading (CLI, old files)
122
+ * @param {{source?: string, ask?: string, proposal?: string|null, check?: Record<string, any>, readings?: Record<string, string>}} q @param {unknown} typed @param {'agree'|'drop'|'rule'|'column'} [choice] M10 am29: the button used; absent = today's words reading (CLI, old files)
123
123
  * @returns {{rule: string|null, left: boolean, check?: Record<string, any>, own?: boolean, action?: 'known', actionLine?: string}} `rule` = the words written as a new `~` rule (null when the rule is left Not checked)
124
124
  */
125
125
  export function ruleOfAnswer(q, typed, choice) {
@@ -130,6 +130,8 @@ export function ruleOfAnswer(q, typed, choice) {
130
130
  if (choice === 'drop') return { rule: null, left: true }; // M13 am11c: there is no Drop it here; the answer door refuses it (the question is about the job line, not a ~ rule)
131
131
  return { rule: null, left: false, action: 'known', actionLine: choice === 'agree' && typeof q.proposal === 'string' ? q.proposal : typedText };
132
132
  }
133
+ // M17 am9 item 4: a column picked from a tie is the reading the tie carried for that column (the rule's words are rewritten in place by applyAnswers); anything not on the list never reaches here (the door refuses it)
134
+ if (choice === 'column') return { rule: q.readings?.[typedText] ?? null, left: q.readings?.[typedText] === undefined };
133
135
  if (choice !== undefined) { // M10 am29: a typed choice decides, never the words; the box (`rule`) keeps its words whole
134
136
  const shapeC = q.ask === 'check' || q.ask === 'no-check';
135
137
  if (choice === 'agree' && typeof q.proposal === 'string' && (q.ask === 'reading' || q.ask === 'check')) return { rule: q.proposal, left: false, ...(q.ask === 'check' && q.check ? { check: q.check } : {}) };
@@ -8,6 +8,7 @@
8
8
 
9
9
  // borrowed-from: bareloop src/pagedropwords.js@v0.56.0 (3383cce) (the four reasons the block's drops carry, and the sign-twice sentence by `d.other`; FACT_LANGS lives with the facts in src/citedcheck.js)
10
10
  import { FACT_LANGS } from './citedcheck.js';
11
+ import { REASON } from './checkblock.js';
11
12
 
12
13
  /** the two ways a sign listed twice can be used once (v0.56.0 spells the sentence from `d.other`; no other -> "currency", the sentence fwd has always written) */
13
14
  const SIGN_TWICE_AS = ['currency', 'unit'];
@@ -35,10 +36,7 @@ const WORDS = /** @type {Record<string, (d: Dropped) => string>} */ ({
35
36
  'decimal-not-on-page': () => 'the page shows no amount written with a comma before the decimals, so it is not checked.',
36
37
  // borrowed-from: bareloop src/pagedropwords.js@c550dc8 (the phrase dry read's sentence)
37
38
  'phrase-no-result': (d) => `"${d.other}" is on the page but in none of its results, so it is not checked.`,
38
- 'person-left': () => 'You chose to leave it Not checked.',
39
- // M10 am16 (items 4, 5): a shape guardrail with no check picked is Not checked, and you judge it at the Ask
40
- 'no-pick': () => 'No check was picked for it, so you judge it at the Ask.',
41
- 'own-words': () => 'Your own words are on the line; the machine has no check for them, so you judge it at the Ask.',
39
+ 'person-left': () => REASON.left,
42
40
  // M10 piece 5 (item 7, am8 item 1): the signed Not-checked reasons for a job word that is not a column. `fact` = the job's word.
43
41
  'no-column': (d) => `there is no column '${d.fact}'`,
44
42
  'no-fit': (d) => `no column fits '${d.fact}'`,
@@ -53,17 +51,11 @@ const WORDS = /** @type {Record<string, (d: Dropped) => string>} */ ({
53
51
 
54
52
  /**
55
53
  * M10 am2 item 3: the plan card row for a `~` rule the person chose to leave Not checked ("drop it"), word for word:
56
- * `not checked · "<rule>" — You chose to leave it Not checked.` (the rule as the person wrote it; the sentence is the one table's).
54
+ * `not checked · "<rule>" — You chose to leave it Not checked.` (the rule as the person wrote it; the sentence is REASON.left, the one table's: src/checkblock.js).
57
55
  * @param {string} rule @returns {string}
58
56
  */
59
57
  export const leftRuleLine = (rule) => `not checked · "${rule}" — ${WORDS['person-left'](/** @type {Dropped} */ ({}))}`;
60
58
 
61
- /**
62
- * M10 am16 (item 5): the plan card row for a shape guardrail that has no picked check, in the same form as {@link leftRuleLine}: `not checked · "<rule>" — <reason>`.
63
- * @param {string} rule @param {'no-pick'|'own-words'} reason @returns {string}
64
- */
65
- export const pickNoteLine = (rule, reason) => `not checked · "${rule}" — ${WORDS[reason](/** @type {Dropped} */ ({}))}`;
66
-
67
59
  /** @param {Dropped} d @returns {string} the plain sentence for one drop */
68
60
  export function dropSentence(d) {
69
61
  const f = WORDS[d.reason];
package/src/pagedry.js CHANGED
@@ -7,6 +7,8 @@
7
7
 
8
8
  import { checkCited, factsOfLook } from './citedcheck.js';
9
9
  import { linesOf, numberAtEnd } from './pagerules.js';
10
+ import { asList } from './pagebits.js';
11
+ import { redactSecrets } from './redact.js';
10
12
 
11
13
  /** @typedef {import('./pagerules.js').KeptFact} KeptFact @typedef {import('./pagerules.js').Dropped} Dropped */
12
14
 
@@ -128,7 +130,8 @@ export async function dryReadPhrases(text, facts) {
128
130
  const reads = {};
129
131
  for (const k of facts) {
130
132
  if (k.shape !== 'phrase' || quotes.length === 0 || !k.words.length) { kept.push(k); continue; }
131
- const part = { source: SOURCE, facts: factsOfLook({ name: CLAIM, shape: 'phrase', words: [k.words[0]] }) };
133
+ // M19 am5: a plain phrase fact is read on all its words (any one); a place keeps its one
134
+ const part = { source: SOURCE, facts: factsOfLook({ name: CLAIM, shape: 'phrase', words: Array.isArray(/** @type {any} */ (k).phrases) ? [k.words[0]] : k.words }) };
132
135
  let n = 0;
133
136
  for (const quote of quotes) {
134
137
  const g = await checkCited({ part, text, results: [{ quote, values: {} }] });
@@ -140,3 +143,74 @@ export async function dryReadPhrases(text, facts) {
140
143
  }
141
144
  return { facts: kept, dropped, reads };
142
145
  }
146
+
147
+ // borrowed-from: bareloop src/pagedry.js@v0.60.0 (timeCandidateLines, CLOCK: the loose time finder asSeenOf reads; asSeenOf, AS_SEEN_MAX_LINES, AS_SEEN_MAX_CHARS: F337; hamr 2026-11-19. Not taken: dryReadTimes)
148
+ /** a clock time as the page writes it: H:MM or HH:MM, then an optional AM/PM (any case, a space between allowed) */
149
+ const CLOCK = /\d{1,2}:\d{2}(?:\s?[AaPp][Mm])?/;
150
+
151
+ /**
152
+ * The candidate lines of a kept time fact: a LOOSE finder (it only collects). Every page line where a kept label word has a clock time anywhere
153
+ * after it; the value is that line's first time after the label. Whether the run's checker can read it is not decided here.
154
+ * @param {string} text @param {KeptFact} k @returns {{quote: string, value: string}[]}
155
+ */
156
+ export function timeCandidateLines(text, k) {
157
+ const raw = text.split('\n');
158
+ const squashed = linesOf(text);
159
+ /** @type {{quote: string, value: string}[]} */
160
+ const out = [];
161
+ squashed.forEach((ln, i) => {
162
+ for (const w of k.words) {
163
+ for (let at = ln.indexOf(w); at !== -1; at = ln.indexOf(w, at + w.length)) {
164
+ const m = CLOCK.exec(ln.slice(at + w.length));
165
+ if (m) { out.push({ quote: raw[i].trim(), value: m[0] }); return; }
166
+ }
167
+ }
168
+ });
169
+ return out;
170
+ }
171
+
172
+ /** the longest "as seen" example kept: more lines or characters than this is not a result's few label lines, so nothing is stored */
173
+ export const AS_SEEN_MAX_LINES = 12;
174
+ export const AS_SEEN_MAX_CHARS = 3000;
175
+
176
+ /**
177
+ * AS SEEN (F337): the planner's example of one result's shape. When a signed fact's label sits on a different line than the result's first line
178
+ * (a hosted flights site: the price line, then `Departure time:` on the next), the worker must copy those lines whole; the planner is the one who can
179
+ * tell it, so the signed record keeps the exact input lines from the drafting copy. Result and label lines are found by the SAME finders the dry
180
+ * reads use (`moneyResultLines`, `timeCandidateLines`), one line at a time, so there is no second reader of "what holds this label". The first
181
+ * result is the first line holding the first labelled fact (money or time); its block runs to the next such line. Every other labelled fact must
182
+ * have its label on the first line or inside the block, else nothing is stored (never a half-example). Lines are the input's own bytes (secret-masked).
183
+ * @param {string} text the drafting copy of the input @param {any[]} facts the signed facts of one part @param {string} input the input's label
184
+ * @returns {{input: string, lines: string[], labels: string[]} | null} null when every label is on the first line, or nothing fits
185
+ */
186
+ export function asSeenOf(text, facts, input) {
187
+ const lab = (Array.isArray(facts) ? facts : []).filter((f) => f && typeof f.anchor === 'string' && f.anchor !== '' && (f.shape === 'money' || f.shape === 'time'));
188
+ if (lab.length === 0) return null;
189
+ const raw = text.split('\n');
190
+ /** @type {(line: string, f: any) => boolean} */
191
+ const holds = (line, f) => {
192
+ /** @type {KeptFact} */
193
+ const k = { line: 0, name: String(f.name ?? ''), shape: f.shape, from: '', words: [f.anchor], ...(f.shape === 'money' ? { unit: asList(f.unit), currency: asList(f.currency), ...(f.decimal === undefined ? {} : { decimal: f.decimal }) } : {}) };
194
+ return (f.shape === 'money' ? moneyResultLines(line, k) : timeCandidateLines(line, k)).length > 0;
195
+ };
196
+ const starts = [];
197
+ for (let i = 0; i < raw.length && starts.length < 2; i++) if (holds(raw[i], lab[0])) starts.push(i);
198
+ if (starts.length === 0) return null;
199
+ const s = starts[0];
200
+ const end = starts[1] ?? raw.length;
201
+ /** @type {string[]} */
202
+ const labels = [];
203
+ let last = s;
204
+ for (const f of lab.slice(1)) {
205
+ if (holds(raw[s], f)) continue;
206
+ let at = -1;
207
+ for (let i = s + 1; i < end; i++) if (holds(raw[i], f)) { at = i; break; }
208
+ if (at < 0) return null;
209
+ labels.push(f.anchor);
210
+ last = Math.max(last, at);
211
+ }
212
+ if (labels.length === 0) return null;
213
+ const lines = raw.slice(s, last + 1);
214
+ if (lines.length > AS_SEEN_MAX_LINES || lines.join('\n').length > AS_SEEN_MAX_CHARS) return null;
215
+ return { input, lines: lines.map((l) => redactSecrets(l)), labels };
216
+ }
package/src/pagefetch.js CHANGED
@@ -87,11 +87,11 @@ export function pageContentChars(text) {
87
87
 
88
88
  /**
89
89
  * @typedef {{goto: (url: string, timeout?: number) => Promise<{url: string, status: number}>, waitForNetworkIdle: (o?: {idle?: number, timeout?: number}) => Promise<void>,
90
- * snapshot: (o?: {mode?: string}) => Promise<string>, close: () => Promise<void>}} FetchPage the part of barebrowse's page handle the fetch uses
90
+ * snapshot: (o?: {mode?: string}) => Promise<string>, close: () => Promise<void>, botBlocked?: boolean}} FetchPage the part of barebrowse's page handle the fetch uses
91
91
  */
92
92
 
93
- /** the oldest barebrowse we accept: 0.21.0 honours CONNECT_OPTIONS (incognito, blockPrivateNetwork; an older one would drop both guards without a word); 0.24.1 tethers Chromium to its launcher, so a killed run or an Abandoned draft leaves no browser behind; 0.26.0 makes goto() resolve to {url, status}, the HTTP status an error page is refused on (M10 am13) */
94
- export const MIN_BAREBROWSE = [0, 26, 0];
93
+ /** the oldest barebrowse we accept: 0.21.0 honours CONNECT_OPTIONS (incognito, blockPrivateNetwork; an older one would drop both guards without a word); 0.24.1 tethers Chromium to its launcher, so a killed run or an Abandoned draft leaves no browser behind; 0.26.0 makes goto() resolve to {url, status}, the HTTP status an error page is refused on (M10 am13); 0.30.0 sets page.botBlocked, the flag a bot challenge is refused on (F222) */
94
+ export const MIN_BAREBROWSE = [0, 30, 0];
95
95
 
96
96
  /** @param {string} v @returns {boolean} true when `v` (x.y.z) is at least MIN_BAREBROWSE */
97
97
  export function barebrowseNewEnough(v) {
@@ -108,7 +108,7 @@ async function loadConnect() {
108
108
  try {
109
109
  const mod = /** @type {any} */ (await import('barebrowse'));
110
110
  const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.resolve('barebrowse'))), '..', 'package.json'), 'utf8'));
111
- if (!barebrowseNewEnough(pkg.version)) return { ok: /** @type {const} */ (false), error: `the page reader (barebrowse ${pkg.version}) is too old: a web page needs 0.26.0 or newer, which keeps the browser private, off the local network, closed when the run ends, and says whether the page loaded` };
111
+ if (!barebrowseNewEnough(pkg.version)) return { ok: /** @type {const} */ (false), error: `the page reader (barebrowse ${pkg.version}) is too old: a web page needs 0.30.0 or newer, which keeps the browser private, off the local network, closed when the run ends, and says whether the page loaded` };
112
112
  return { ok: /** @type {const} */ (true), connect: /** @type {(opts: Record<string, any>) => Promise<FetchPage>} */ (mod.connect) };
113
113
  } catch (e) { return { ok: /** @type {const} */ (false), error: `the page reader (barebrowse) could not be loaded: ${/** @type {Error} */ (e).message}` }; }
114
114
  }
@@ -137,6 +137,8 @@ export async function fetchPageText(url, { connect, timeoutMs = PAGE_FETCH_TIMEO
137
137
  let timer;
138
138
  /** @type {Promise<FetchPage>|undefined} */
139
139
  let opening;
140
+ /** @type {FetchPage|undefined} */
141
+ let shot;
140
142
  try {
141
143
  opening = open({ ...CONNECT_OPTIONS });
142
144
  const page = opening;
@@ -150,13 +152,16 @@ export async function fetchPageText(url, { connect, timeoutMs = PAGE_FETCH_TIMEO
150
152
  if (st < 200 || st > 299) return { refused: `${u.href} came back as an error page (HTTP ${st}), so there is nothing to read` };
151
153
  // bounded: a page that never goes quiet (polling, streaming) is read as it stands (bareloop); the size and chrome floors below then decide
152
154
  try { await p.waitForNetworkIdle({ idle: idleMs, timeout: idleTimeoutMs }); } catch { /* read what is there */ }
153
- return p.snapshot({ ...SNAPSHOT_OPTIONS });
155
+ const t = await p.snapshot({ ...SNAPSHOT_OPTIONS });
156
+ shot = p;
157
+ return t;
154
158
  })(),
155
159
  new Promise((_, reject) => { timer = setTimeout(() => reject(new Error(`no answer inside ${Math.round(timeoutMs / 1000)} seconds`)), timeoutMs); }),
156
160
  ]);
157
161
  if (text && typeof text === 'object' && 'refused' in text) return { ok: false, error: String(text.refused) };
158
162
  if (typeof text !== 'string') return { ok: false, error: `${u.href} did not come back as text` };
159
- if (/\[BOT CHALLENGE DETECTED[\] ]/.test(text)) return { ok: false, error: `${u.href} asked for a human check (a bot challenge), so the page could not be read` };
163
+ // F222: barebrowse 0.30.0 sets page.botBlocked exactly when it writes its marker; only a strict true counts
164
+ if (/** @type {FetchPage|undefined} */ (shot)?.botBlocked === true) return { ok: false, error: `${u.href} asked for a human check (a bot challenge), so the page could not be read` };
160
165
  const size = text.trim().length;
161
166
  if (size < MIN_PAGE_CHARS) return { ok: false, error: `${u.href} came back with ${size === 0 ? 'no text' : `only ${size} characters of text`} (less than ${MIN_PAGE_CHARS}) - the page did not load, or holds nothing to read` };
162
167
  if (pageContentChars(text) < MIN_CONTENT_CHARS) return { ok: false, error: `${u.href} came back with only the site's own header and menus - the page did not load its content, so there is nothing to read` };
package/src/pagelook.js CHANGED
@@ -85,7 +85,8 @@ export const notCheckedLines = (dropped, jobLines) => dropRows(dropped).map((row
85
85
  export function lookFactOf(k, source) {
86
86
  /** @type {any} */
87
87
  const out = { line: k.line, name: k.name, shape: k.shape, source, words: [...k.words] };
88
- if (k.shape === 'phrase') out.phrase = k.words[0];
88
+ // M19 am5: a phrase fact with several words keeps ALL of them (`words`; signed by `factsOfLook` as one any-of fact); `phrase` is only the one-word fact's. Diverges from bareloop's lookFactOf, which keeps the first word.
89
+ if (k.shape === 'phrase' && k.words.length <= 1) out.phrase = k.words[0];
89
90
  if (Array.isArray(/** @type {any} */ (k).phrases)) out.phrases = [.../** @type {any} */ (k).phrases];
90
91
  else { out.labels = [...k.words]; if (k.words.length) out.label = k.words[0]; }
91
92
  if (k.unit) out.unit = [...k.unit];
package/src/pagerules.js CHANGED
@@ -12,7 +12,7 @@ import { countExact, countPhrase, squash, normLabel } from './pagebits.js';
12
12
  /**
13
13
  * @typedef {{op: string, value?: string|number, lo?: string|number, hi?: string|number}} Reading what a `~` rule means as a limit (PRD v1.107 Part 5b): the same shape as a signed fact rule
14
14
  * @typedef {{name: string, from?: string, shape: string, words?: string[], currency?: string[], unit?: string[], reading?: Reading}} MapFact the AI's map, one fact
15
- * @typedef {{facts: MapFact[]}} PageMap
15
+ * @typedef {{facts: MapFact[], cannot?: {from?: string, why?: string}[]}} PageMap
16
16
  * @typedef {{line: number, name: string, shape: string, from: string, words: string[], unit?: string[], currency?: string[], forRule?: number, reading?: Reading}} KeptFact
17
17
  * `words` = what the page proves: the labels of a money/number/time fact, or the alternative phrases of a phrase fact (a place is a phrase)
18
18
  * @typedef {{line: number, rule?: number, fact: string, word?: string, reason: string, other?: string}} Dropped `other` = what the drop is compared to: the first label (R1), the primary form (R1L), the fact it would have repeated (S1)
@@ -185,8 +185,14 @@ export function applyPageRules(text, mapping, jobLines) {
185
185
  /** @type {Dropped[]} */
186
186
  const dropped = [];
187
187
  const all = Array.isArray(mapping?.facts) ? mapping.facts.filter(isRec) : [];
188
+ // borrowed-from: bareloop src/pagerules.js@v0.61.0 (fc56e1f3) (the contested set and tieOfFact, copied unchanged)
189
+ const contested = new Set((Array.isArray(mapping?.cannot) ? mapping.cannot : []).filter(isRec).map((c) => tieOf(c.from, jobLines)).filter((t) => t.rule !== undefined).map((t) => `${t.line}:${t.rule}`));
190
+ const tieOfFact = (/** @type {MapFact} */ f) => {
191
+ const t = tieOf(f.from, jobLines);
192
+ return t.rule !== undefined && contested.has(`${t.line}:${t.rule}`) ? { line: t.line } : t;
193
+ };
188
194
  /** @type {Map<MapFact, {line: number, rule?: number}>} */
189
- const ties = new Map(all.map((f) => [f, tieOf(f.from, jobLines)]));
195
+ const ties = new Map(all.map((f) => [f, tieOfFact(f)]));
190
196
  const drop = (/** @type {MapFact} */ f, /** @type {string|undefined} */ word, /** @type {string} */ reason, /** @type {string|undefined} */ other = undefined) => {
191
197
  const t = /** @type {{line: number, rule?: number}} */ (ties.get(f));
192
198
  dropped.push({ line: t.line, ...(t.rule === undefined ? {} : { rule: t.rule }), fact: String(f.name ?? ''), ...(word === undefined ? {} : { word }), reason, ...(other === undefined ? {} : { other }) });
@@ -27,6 +27,8 @@
27
27
  // One at a time with no lock table: `start` is fully synchronous (check live -> create the folder -> spawn ->
28
28
  // write pid.json, no await between), so two requests that arrive together run one after the other and the second
29
29
  // sees the first's live child and is refused. A dead child never blocks (its pid is read, never assumed).
30
+ import { ncRowsOf } from '../checklook.js';
31
+ import { planCard } from '../checkrows.js';
30
32
  import { randomBytes } from 'node:crypto';
31
33
  import {
32
34
  mkdirSync, realpathSync, rmSync, writeFileSync,
@@ -41,7 +43,7 @@ import {
41
43
  import { rowEditPlan } from '../planrebuild.js';
42
44
  import { cardLinesOf } from '../checklistsign.js';
43
45
  import { appendSpendRow } from '../provider.js';
44
- import { ruleOfAnswer, panelQuestionText, DROP_IT } from '../pageask.js';
46
+ import { ruleOfAnswer, panelQuestionText, DROP_IT, TIE_PICK_SAY } from '../pageask.js';
45
47
  import { checkFlowName, nextRunId, readFileInside, readdirInside } from '../flow.js';
46
48
  import { readModelRecord } from '../flowmodel.js';
47
49
  import { isFwdloopAlive } from '../liveness.js';
@@ -291,7 +293,7 @@ export function createAuthor(opts) {
291
293
  // A child never comes back to life, so a stale "alive" only delays the offer; asked AFTER the files were read, the questions are already on disk (C9's order is for a missing result)
292
294
  if (childRunning(dir)) return { ...shared, phase: newest > 0 ? (cur.kind === 'answers' ? 'redrafting' : 'revising') : 'drafting' };
293
295
  const lineText = (line) => parseJobBox(typeof card?.job === 'string' ? card.job : '').steps[line - 1]?.text ?? null;
294
- const questions = q.questions.map((x) => ({ k: x.k, line: x.line, lineText: lineText(x.line), question: scrub(x.question, keys), answered: x.answer !== null, ...(x.source === 'look' ? { source: 'look', ask: x.ask, proposes: typeof x.proposal === 'string' && (x.ask === 'reading' || x.ask === 'check' || x.ask === 'action'), drops: Number.isInteger(x.ruleNo), shown: scrub(panelQuestionText(x), keys) } : {}) }));
296
+ const questions = q.questions.map((x) => ({ k: x.k, line: x.line, lineText: lineText(x.line), question: scrub(x.question, keys), answered: x.answer !== null, ...(x.source === 'look' ? { source: 'look', ask: x.ask, proposes: typeof x.proposal === 'string' && (x.ask === 'reading' || x.ask === 'check' || x.ask === 'action'), drops: Number.isInteger(x.ruleNo), shown: scrub(panelQuestionText(x), keys), ...(Array.isArray(x.columns) && x.columns.length > 0 ? { columns: x.columns.map((c) => scrub(c, keys)) } : {}) } : {}) }));
295
297
  return { ...shared, stepList: stepListOf(dir, rel, keys, true), phase: 'questions-open', plan: rel, questions, openK: q.open[0].k, total: q.questions.length };
296
298
  }
297
299
  if (q.questions.length > 0) return { ...shared, phase: 'stopped', say: ANSWERS_NOT_DRAFTED_SAY };
@@ -356,15 +358,19 @@ export function createAuthor(opts) {
356
358
  const ncFile = readJson(dir, `${rel}/${NOT_CHECKED_FILE}`);
357
359
  const view = notCheckedView(ncFile?.notChecked, decl);
358
360
  // M16 item 5: the plan card's list - the rows with their tags and Drop, the suggestions with Add - read from the card the draft saved (src/cardlist.js); a plan without a list has none
359
- const card = cardLinesOf(decl).size > 0 ? readJson(dir, `${rel}/log.json`)?.checkCard : undefined;
360
- const list = card && Array.isArray(card.rows) && Array.isArray(card.suggested) ? { lines: [...cardLinesOf(decl)].sort((a, b) => a - b), rows: card.rows, suggested: card.suggested } : null;
361
+ // M19 am6: a saved draft with a signed list draws its card rows read from the plan (a card saved with the old words is rebuilt); the suggestions, the restorable rows and the Drop flags are the saved card's
362
+ const savedLog = cardLinesOf(decl).size > 0 ? readJson(dir, `${rel}/log.json`) : undefined;
363
+ const card = savedLog?.checkCard && parsed?.ok === true && Array.isArray(savedLog.checkCard.rows)
364
+ ? planCard(savedLog.checkCard, { declaration: decl, lines: parsed.lines, csvRoles: csvRolesOf(parsed.arbiter), kept: Array.isArray(kept) ? kept.filter((/** @type {any} */ k) => k && Number.isInteger(k.line)) : [], log: savedLog.log })
365
+ : savedLog?.checkCard;
366
+ const list = card && Array.isArray(card.rows) && Array.isArray(card.suggested) ? { lines: [...cardLinesOf(decl)].sort((a, b) => a - b), rows: card.rows, notChecked: Array.isArray(card.notChecked) ? card.notChecked : [], suggested: card.suggested, restorable: Array.isArray(card.restorable) ? card.restorable : [] } : null;
361
367
  // M16 P4c (bareloop's plan view): the job's lines with their `~` rules (the signed text's own, split at its "; " joins) and the two checks every step has; a plan with a list draws them
362
368
  const planLines = parsed?.ok === true ? parsed.lines.map((/** @type {any} */ l) => ({ n: l.n, text: l.text, rules: l.guardrail ? l.guardrail.split('; ') : [] })) : [];
363
369
  // M13 am11: the job's action (its last line, when the AI named it or the person agreed or typed it), drawn as `› line <n> writes everything before it [agent]` (no Drop, am11c)
364
370
  const act = readJson(dir, `${rel}/log.json`)?.action;
365
371
  const action = isObj(act) && Number.isInteger(act.line) && act.dropped !== true ? { line: act.line, ...(act.by === 'agent' || act.by === 'you' ? { by: act.by } : {}) } : null;
366
372
  return {
367
- ...(action ? { action } : {}), checked: checkedLines(decl, opts), notChecked: { ...view, ...(isObj(ncFile?.by) ? { by: ncFile.by } : {}) }, ...(list ? { list, planLines, always: [...EVERY_STEP_TEXTS] } : {}),
373
+ ...(action ? { action } : {}), checked: checkedLines(decl, opts), notChecked: { ...view, ...(isObj(ncFile?.by) ? { by: ncFile.by } : {}), rows: ncRowsOf(view.items, isObj(ncFile?.by) ? ncFile.by : {}) }, ...(list ? { list, planLines, always: [...EVERY_STEP_TEXTS] } : {}),
368
374
  };
369
375
  }
370
376
 
@@ -814,10 +820,14 @@ export function createAuthor(opts) {
814
820
  if (choice === undefined) return { status: 400, body: { ok: false, refused: 'bad-choice', say: 'This page is out of date. Reload it and answer again. Nothing was saved.' } };
815
821
  {
816
822
  const proposes = look && typeof q.proposal === 'string' && (q.ask === 'reading' || q.ask === 'check' || q.ask === 'action');
817
- if (choice !== 'agree' && choice !== 'drop' && choice !== 'rule') return { status: 400, body: { ok: false, refused: 'bad-choice', say: 'That answer is not one of the choices. Nothing was saved.' } };
823
+ if (choice !== 'agree' && choice !== 'drop' && choice !== 'rule' && choice !== 'column') return { status: 400, body: { ok: false, refused: 'bad-choice', say: 'That answer is not one of the choices. Nothing was saved.' } };
824
+ // M17 am9 item 3: a column tie is a closed question. `column` is taken only as the name of one of ITS OWN tied columns; `rule` and `agree` are refused on it; `column` on any other question is not offered
825
+ if (Array.isArray(q.columns) && q.columns.length > 0) {
826
+ if (choice === 'rule' || choice === 'agree' || (choice === 'column' && !(typeof b.answer === 'string' && q.columns.includes(b.answer)))) return { status: 400, body: { ok: false, refused: 'bad-choice', say: TIE_PICK_SAY } };
827
+ } else if (choice === 'column') return { status: 400, body: { ok: false, refused: 'bad-choice', say: 'That choice is not offered for this question. Nothing was saved.' } };
818
828
  if ((choice === 'agree' && !proposes) || (choice === 'drop' && !look)) return { status: 400, body: { ok: false, refused: 'bad-choice', say: 'That choice is not offered for this question. Nothing was saved.' } };
819
829
  }
820
- const answer = choice === 'agree' ? 'agree' : choice === 'drop' ? DROP_IT : typeof b.answer === 'string' ? (look ? b.answer.replace(/\s*\n\s*/g, ' ') : b.answer).trim().replace(/^(?:~\s*)+/, '') : '';
830
+ const answer = choice === 'column' ? /** @type {string} */ (b.answer) : choice === 'agree' ? 'agree' : choice === 'drop' ? DROP_IT : typeof b.answer === 'string' ? (look ? b.answer.replace(/\s*\n\s*/g, ' ') : b.answer).trim().replace(/^(?:~\s*)+/, '') : '';
821
831
  if (answer === '') return { status: 400, body: { ok: false, refused: 'blank-answer', say: look ? LOOK_BLANK_ANSWER_SAY : BLANK_ANSWER_SAY } };
822
832
  if (!look && /[\r\n]/.test(answer)) return { status: 400, body: { ok: false, refused: 'one-line', say: ONE_LINE_ANSWER_SAY } };
823
833
  if (keys.some((k) => k.length >= 8 && answer.includes(k))) return { status: 400, body: { ok: false, refused: 'key', say: 'This answer contains an API key. Keys go in Settings only. Nothing was saved.' } };
@@ -836,7 +846,9 @@ export function createAuthor(opts) {
836
846
  const all = full.map((x) => {
837
847
  const typed = x.k === v.openK ? answer : x.answer;
838
848
  const ch = x.k === v.openK ? choice : x.choice;
839
- return { line: x.line, question: x.question, answer: typed, ...ruleOfAnswer(x, typed, ch), ruleNo: x.ruleNo, ruleText: x.ruleText, ask: x.ask, proposal: x.proposal };
849
+ const eff = ruleOfAnswer(x, typed, ch);
850
+ // M17 am9a: a picked column is the agreed column rule, the same shape an Agree to one offered column has, so applyAnswers rewrites the `~` rule in place
851
+ return { line: x.line, question: x.question, answer: typed, ...eff, ruleNo: x.ruleNo, ruleText: x.ruleText, ask: x.ask, proposal: ch === 'column' ? eff.rule : x.proposal };
840
852
  });
841
853
  const adds = all.filter((x) => x.rule !== null);
842
854
  // M13 am11 rule 2: the answer to the action question adds the agreed or typed line as the job's LAST line (numbered by the card), (there is no Drop it: the answer door refuses it); the redraft is told
@@ -184,10 +184,10 @@ export function applyAnswers(job, all) {
184
184
  const parts = isColumnChoiceRule(x.proposal) && Number.isInteger(x.ruleNo) ? columnChoiceParts(x.rule) : null;
185
185
  const swapped = parts ? swapColumnWord(String(x.ruleText ?? ''), parts.word, parts.column) : null;
186
186
  // M17 ruling 2: an agreed column for a word that is no `~` rule (the job's prose) adds NO `~` line; it is told to the AI, whose check (if it suggests one) is a `!` `[agent]` row built by code
187
- // and so is an agreed column for a word that is not in the tied rule's text (nothing to rewrite): never a new line
188
- const proseCol = isColumnChoiceRule(x.proposal) && isColumnChoiceRule(x.rule) && (!Number.isInteger(x.ruleNo) || swapped === null) ? columnChoiceParts(x.rule) : null;
187
+ // M17 am9a: an agreed column answer about a `~` rule always rewrites that rule in place: the word swapped for the column, else `use the column '<c>' for '<w>'`; never only told to the AI
188
+ const proseCol = isColumnChoiceRule(x.proposal) && isColumnChoiceRule(x.rule) && !Number.isInteger(x.ruleNo) ? columnChoiceParts(x.rule) : null;
189
189
  if (proseCol) { columns.push({ line: x.line, word: proseCol.word, column: proseCol.column }); continue; }
190
- if (x.ask !== undefined && Number.isInteger(x.ruleNo) && (!isColumnChoiceRule(x.proposal) || !isColumnChoiceRule(x.rule) || swapped !== null)) {
190
+ if (x.ask !== undefined && Number.isInteger(x.ruleNo)) {
191
191
  const r = replaceRuleOnJob(out, x.line, String(x.ruleText ?? ''), swapped ?? x.rule);
192
192
  if (r.replaced) { out = r.job; done += 1; }
193
193
  } else appends.push({ line: x.line, answer: x.rule });
package/src/panel/data.js CHANGED
@@ -19,6 +19,7 @@
19
19
  // same things at the route level, but this module refuses on its own too
20
20
  // (negative scenario v: nothing outside `--root` is ever read).
21
21
 
22
+ import { ncRowsOf } from '../checklook.js';
22
23
  import {
23
24
  existsSync, realpathSync,
24
25
  } from 'node:fs';
@@ -2114,7 +2115,7 @@ function buildJobPlan(declaration, asks, flowDir, flowHash = null, jobLines = /*
2114
2115
  const declSteps = Array.isArray(declaration?.steps) ? declaration.steps : [];
2115
2116
  const steps = declSteps.map((st, i) => {
2116
2117
  const ak = asks.find((x) => x.line === st.fromLine);
2117
- const listRows = onList.has(st.fromLine) ? listPartRows(declaration, st).map((r) => ({ text: r.text, by: r.by })) : null;
2118
+ const listRows = onList.has(st.fromLine) ? listPartRows(declaration, st, { lines: Array.isArray(jobLines) ? jobLines : [] }).map((r) => ({ text: r.text, by: r.by, kind: 'truth' })) : null;
2118
2119
  return {
2119
2120
  step: i + 1,
2120
2121
  line: Number.isInteger(st.fromLine) ? st.fromLine : null,
@@ -2139,7 +2140,7 @@ function buildJobPlan(declaration, asks, flowDir, flowHash = null, jobLines = /*
2139
2140
  const recorded = !!nc && Array.isArray(nc.items);
2140
2141
  const view = recorded ? notCheckedView(nc.items, declaration) : { items: [], readNotes: [] };
2141
2142
  return {
2142
- steps, notChecked: { label: notCheckedLabelOf(declaration), items: view.items, readNotes: view.readNotes, recorded, ...(onList.size > 0 && nc?.by && typeof nc.by === 'object' ? { by: nc.by } : {}) },
2143
+ steps, notChecked: { label: notCheckedLabelOf(declaration), items: view.items, readNotes: view.readNotes, recorded, ...(onList.size > 0 && nc?.by && typeof nc.by === 'object' ? { by: nc.by } : {}), ...(onList.size > 0 ? { rows: ncRowsOf(view.items, nc?.by && typeof nc.by === 'object' ? nc.by : {}) } : {}) },
2143
2144
  ...(onList.size > 0 ? { always: [...EVERY_STEP_TEXTS] } : {}),
2144
2145
  };
2145
2146
  }