bareloop 0.56.0 → 0.58.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 (93) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +3 -3
  3. package/bareloop.context.md +75 -214
  4. package/package.json +2 -2
  5. package/src/authorflow.js +71 -136
  6. package/src/authoring.js +5 -124
  7. package/src/authorjob.js +125 -417
  8. package/src/authorreadout.js +105 -355
  9. package/src/authorrun.js +70 -234
  10. package/src/authorscout.js +9 -1
  11. package/src/blockasks.js +12 -17
  12. package/src/bundlerun.js +4 -1
  13. package/src/checkblock.js +297 -75
  14. package/src/checklist.js +1 -1
  15. package/src/checkpick.js +9 -5
  16. package/src/cli.js +3 -3
  17. package/src/declaredclose.js +45 -112
  18. package/src/destpoint.js +1 -1
  19. package/src/draftspend.js +20 -4
  20. package/src/fencepointcall.js +76 -0
  21. package/src/guarddescriptions.js +14 -0
  22. package/src/index.js +3 -43
  23. package/src/interviewrun.js +13 -8
  24. package/src/job.js +20 -1
  25. package/src/jobblock.js +11 -46
  26. package/src/judged.js +13 -1229
  27. package/src/kinds.js +10 -348
  28. package/src/noteask.js +124 -0
  29. package/src/pagedry.js +27 -5
  30. package/src/pagemap.js +7 -29
  31. package/src/pagerules.js +18 -3
  32. package/src/panel/authorroutes.js +15 -4
  33. package/src/panel/authorsession.js +201 -167
  34. package/src/panel/importrun.js +0 -1
  35. package/src/panel/index.html +43 -18
  36. package/src/panel/jobplan.js +54 -19
  37. package/src/panel/server.js +90 -69
  38. package/src/panel/status.js +3 -0
  39. package/src/pickrecord.js +15 -54
  40. package/src/planrun.js +4 -48
  41. package/src/promptregisters.js +7 -17
  42. package/src/providerrows.js +0 -36
  43. package/src/providers.js +4 -25
  44. package/src/questionbox.js +34 -30
  45. package/src/reviewdoor.js +1 -1
  46. package/src/rowresults.js +69 -0
  47. package/src/rubricstep.js +136 -28
  48. package/src/run.js +2 -15
  49. package/src/stagewords.js +24 -0
  50. package/src/userrun.js +14 -111
  51. package/types/authorflow.d.ts +51 -137
  52. package/types/authoring.d.ts +1 -14
  53. package/types/authorjob.d.ts +14 -55
  54. package/types/authorreadout.d.ts +52 -80
  55. package/types/authorrun.d.ts +20 -0
  56. package/types/blockasks.d.ts +5 -11
  57. package/types/checkblock.d.ts +147 -28
  58. package/types/checklist.d.ts +2 -2
  59. package/types/checkpick.d.ts +5 -3
  60. package/types/cli.d.ts +1 -3
  61. package/types/declaredclose.d.ts +5 -33
  62. package/types/draftspend.d.ts +16 -2
  63. package/types/fencepointcall.d.ts +68 -0
  64. package/types/guarddescriptions.d.ts +7 -0
  65. package/types/index.d.ts +2 -4
  66. package/types/job.d.ts +8 -0
  67. package/types/jobblock.d.ts +8 -38
  68. package/types/judged.d.ts +7 -357
  69. package/types/kinds.d.ts +4 -104
  70. package/types/noteask.d.ts +76 -0
  71. package/types/pagedry.d.ts +13 -0
  72. package/types/pagemap.d.ts +2 -5
  73. package/types/pagerules.d.ts +7 -0
  74. package/types/panel/authorsession.d.ts +37 -5
  75. package/types/panel/jobplan.d.ts +15 -3
  76. package/types/panel/server.d.ts +46 -13
  77. package/types/panel/status.d.ts +5 -0
  78. package/types/pickrecord.d.ts +8 -13
  79. package/types/planrun.d.ts +1 -22
  80. package/types/providerrows.d.ts +0 -31
  81. package/types/providers.d.ts +3 -19
  82. package/types/questionbox.d.ts +20 -6
  83. package/types/rowresults.d.ts +23 -0
  84. package/types/rubricstep.d.ts +43 -7
  85. package/types/run.d.ts +1 -20
  86. package/types/stagewords.d.ts +11 -0
  87. package/types/userrun.d.ts +0 -1
  88. package/src/calibrate.js +0 -702
  89. package/src/cardauthor.js +0 -502
  90. package/src/fitcheck.js +0 -168
  91. package/types/calibrate.d.ts +0 -201
  92. package/types/cardauthor.d.ts +0 -358
  93. package/types/fitcheck.d.ts +0 -119
@@ -238,16 +238,6 @@ export function ungroundedGenreEnv(lang: string, recorded: Record<string, string
238
238
  element: string;
239
239
  resolved: string;
240
240
  }[];
241
- /**
242
- * Which of a judged stage's paths lie OUTSIDE the job's write fence? One owner of the rule "a check must be
243
- * free to edit every file it can report on", called from every door that validates a declaration. It uses
244
- * the shipped fence spelling (`globToPrefix`, the same containment reading plan.js's `insideFence` has) and
245
- * returns `[]` when there is no fence to compare against or the paths are not a string list (shape is the
246
- * schema walk's business).
247
- * @param {unknown} paths @param {string[]|null|undefined} writeScope
248
- * @returns {string[]}
249
- */
250
- export function judgedOutsideFence(paths: unknown, writeScope: string[] | null | undefined): string[];
251
241
  /**
252
242
  * Validate an authored close DECLARATION. Never throws on model output — every
253
243
  * failure is a named red, in the shipped `{ok, reds, <parsed>}` shape, and the
@@ -285,13 +275,11 @@ export function judgedOutsideFence(paths: unknown, writeScope: string[] | null |
285
275
  * @param {{catalogue?: Record<string, KindSpec>, listing?: string[]|null,
286
276
  * guards?: {name: string, kind: string, params: Record<string, any>, fill: string[]}[]|null,
287
277
  * envOwned?: string[]|null, envInjected?: Record<string, string>|null, deferListing?: boolean,
288
- * verdictType?: string|null, writeScope?: string[]|null, jobLines?: {n: number}[]|null, inputLabels?: string[]|null}} [opts]
278
+ * verdictType?: string|null, jobLines?: {n: number}[]|null, inputLabels?: string[]|null}} [opts]
289
279
  * `inputLabels` — the labels of the person's inputs (Part 1a). Present, a rubric-step `cited` part must name one of them.
290
280
  * `jobLines` — the person's numbered job lines (P7). Present, every stage must name the line it serves and every
291
281
  * line needs a stage or a refusal ({@link checkJobLines}); absent (every spec that predates the job block), the
292
282
  * rule is not run.
293
- * `writeScope` — the job's signed write fence. Every path a judged stage judges must sit inside it
294
- * ({@link judgedOutsideFence}); absent, the rule is not run (the plain-folder deferral has no fence).
295
283
  * `listing` — repo-relative paths at the seed (`git ls-tree -r --name-only`).
296
284
  * `guards` — the picked class's injected guards (`classGuards`).
297
285
  * `verdictType` — the class the USER picked (`VERDICT_CLASSES`).
@@ -318,7 +306,6 @@ export function validateDeclaration(declaration: any, opts?: {
318
306
  envInjected?: Record<string, string> | null;
319
307
  deferListing?: boolean;
320
308
  verdictType?: string | null;
321
- writeScope?: string[] | null;
322
309
  jobLines?: {
323
310
  n: number;
324
311
  }[] | null;
@@ -80,34 +80,34 @@ export function refuseLockedKind(kind: string): Refusal;
80
80
  * one-genre-at-a-time law is untouched.
81
81
  *
82
82
  * @param {{answers: Record<string|number, any>, repoPath?: string|null, lang: string,
83
- * jobLines?: {n: number, text: string}[]|null, inputs?: {n: number, label: string, value: string}[]|null,
83
+ * jobLines?: {n: number, text: string, rule?: string, rules?: string[]}[]|null, inputs?: {n: number, label: string, value: string}[]|null,
84
84
  * verdictType?: string|null,
85
85
  * questions?: Record<string|number, string>|null, generate?: Function, provider?: any,
86
- * seedRef?: string|null, scout?: any, listing?: any, ceilingUsd?: number|null, judgeModel?: string|null,
86
+ * seedRef?: string|null, scout?: any, listing?: any, ceilingUsd?: number|null,
87
87
  * rates?: {in: number, out: number}|null, draftThinking?: 'on'|'off',
88
88
  * onPhase?: (phase: string, data?: any) => void,
89
89
  * onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string}) => void,
90
- * seedFn?: Function, scoutFn?: Function, listingFn?: Function, lookFn?: Function|null, fitFn?: Function|null,
91
- * fitAsk?: ((question: string) => Promise<string|null>)|null, onFit?: (fit: {state: string, asks: any[], notFound: any[]}) => void,
90
+ * seedFn?: Function, scoutFn?: Function, listingFn?: Function, lookFn?: Function|null,
92
91
  * authorFn?: Function, authorOpts?: object, writeScope?: string[]|null,
93
- * signerFix?: Function|any, proposeFn?: Function, compileOpts?: object,
94
92
  * ask?: ((step: {kind: string, [k: string]: any}) => Promise<string|null>)|null,
95
93
  * answerQuestions?: ((o: {questions: {line: number, question: string, rule?: number, source?: string, ask?: string, reading?: string, key?: string}[], dropped: {reason: string, raw: any}[], confirmed: any}) =>
96
94
  * Promise<{jobLines: {n: number, text: string, rule?: string}[], answers: Record<string|number, any>, left?: {line: number, rule: number}[], picks?: any[], choices?: {key: string, choice: string, text?: string}[]}|null>)|null,
97
- * pickGenerate?: Function|null, ledgerGenerate?: Function|null, editGenerate?: Function|null, carriedPicks?: any[]|null, carriedChoices?: any[]|null, onChoices?: (rec: any[]) => void, onPicks?: (o: {entries: any[], kept: {line: number, rule: number, entry: any}[]}) => void,
95
+ * pickGenerate?: Function|null, ledgerGenerate?: Function|null, fenceGenerate?: Function|null, noteFn?: Function|null, onJobLines?: ((jobLines: any[]) => void)|null, editGenerate?: Function|null, carriedPicks?: any[]|null, carriedChoices?: any[]|null, onChoices?: (rec: any[]) => void, onPicks?: (o: {entries: any[], kept: {line: number, rule: number, entry: any}[]}) => void,
98
96
  * confirmGenerate?: Function|null, isRepo?: boolean,
99
97
  * langResult?: {kind: string, candidates?: string[], [k: string]: any}|null}} o
100
98
  * @returns {Promise<{ok: boolean, refusal: Refusal|null, verdictType: string|null,
101
- * closeDecl: any, seedRef: string|null, authoring: any, judged: any, reds: Red[],
99
+ * closeDecl: any, seedRef: string|null, authoring: any, reds: Red[],
102
100
  * stop: string|null, cost: any, interview: any, confirmed: any, picked?: {line: number, text: string}[], hasBuiltCheck?: boolean, notBuilt?: {line: number, text: string}[]}>}
103
101
  */
104
- export function authorCloseForJob({ answers, repoPath, lang, verdictType, questions, jobLines, inputs, generate, provider, seedRef, scout, listing, ceilingUsd, rates, draftThinking, writeScope, judgeModel, onPhase, onCall, seedFn, scoutFn, listingFn, lookFn, fitFn, fitAsk, onFit, authorFn, authorOpts, pickGenerate, ledgerGenerate, editGenerate, carriedPicks, onPicks, carriedChoices, onChoices, signerFix, proposeFn, compileOpts, ask, confirmGenerate, isRepo, langResult, answerQuestions, }: {
102
+ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questions, jobLines, inputs, generate, provider, seedRef, scout, listing, ceilingUsd, rates, draftThinking, writeScope, onPhase, onCall, seedFn, scoutFn, listingFn, lookFn, authorFn, authorOpts, pickGenerate, ledgerGenerate, fenceGenerate, noteFn, onJobLines, editGenerate, carriedPicks, onPicks, carriedChoices, onChoices, ask, confirmGenerate, isRepo, langResult, answerQuestions, }: {
105
103
  answers: Record<string | number, any>;
106
104
  repoPath?: string | null;
107
105
  lang: string;
108
106
  jobLines?: {
109
107
  n: number;
110
108
  text: string;
109
+ rule?: string;
110
+ rules?: string[];
111
111
  }[] | null;
112
112
  inputs?: {
113
113
  n: number;
@@ -122,7 +122,6 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
122
122
  scout?: any;
123
123
  listing?: any;
124
124
  ceilingUsd?: number | null;
125
- judgeModel?: string | null;
126
125
  rates?: {
127
126
  in: number;
128
127
  out: number;
@@ -139,19 +138,9 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
139
138
  scoutFn?: Function;
140
139
  listingFn?: Function;
141
140
  lookFn?: Function | null;
142
- fitFn?: Function | null;
143
- fitAsk?: ((question: string) => Promise<string | null>) | null;
144
- onFit?: (fit: {
145
- state: string;
146
- asks: any[];
147
- notFound: any[];
148
- }) => void;
149
141
  authorFn?: Function;
150
142
  authorOpts?: object;
151
143
  writeScope?: string[] | null;
152
- signerFix?: Function | any;
153
- proposeFn?: Function;
154
- compileOpts?: object;
155
144
  ask?: ((step: {
156
145
  kind: string;
157
146
  [k: string]: any;
@@ -191,6 +180,9 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
191
180
  } | null>) | null;
192
181
  pickGenerate?: Function | null;
193
182
  ledgerGenerate?: Function | null;
183
+ fenceGenerate?: Function | null;
184
+ noteFn?: Function | null;
185
+ onJobLines?: ((jobLines: any[]) => void) | null;
194
186
  editGenerate?: Function | null;
195
187
  carriedPicks?: any[] | null;
196
188
  carriedChoices?: any[] | null;
@@ -217,7 +209,6 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
217
209
  closeDecl: any;
218
210
  seedRef: string | null;
219
211
  authoring: any;
220
- judged: any;
221
212
  reds: Red[];
222
213
  stop: string | null;
223
214
  cost: any;
@@ -266,14 +257,6 @@ export function assembleSpec(specDraft: any, { closeDecl, verdictType }: {
266
257
  closeDecl: any;
267
258
  verdictType: string;
268
259
  }): any;
269
- /**
270
- * THE one spelling of "a passed calibration gate stands in for the seed red": the
271
- * close carries a judged stage AND the gate ran and passed. A failed or missing
272
- * calibration never satisfies it, and a close with no judged stage never reaches it.
273
- * @param {any[]} judged `judgedStages(closeDecl)` @param {any} calibration `gates.calibration`
274
- * @returns {boolean}
275
- */
276
- export function seedProofIsCalibration(judged: any[], calibration: any): boolean;
277
260
  /**
278
261
  * D9, in code: *nothing JUDGES the close; three mechanical gates plus a
279
262
  * signature.* No LLM validates another LLM's close, here or anywhere.
@@ -287,23 +270,7 @@ export function seedProofIsCalibration(judged: any[], calibration: any): boolean
287
270
  * A close with NO work stage red at seed has nothing to do and is refused
288
271
  * decision-ready — gate-2 round 2's arm B died exactly there, on a mypy that
289
272
  * scanned nothing and therefore read clean.
290
- * 4. THE CALIBRATION GATE (softgreen module 5) — for a close carrying a
291
- * `judged-floor` stage ONLY. The whole judged pipe runs over the signed ten
292
- * and the five arbiter-owned injection artifacts, and anything short of
293
- * 10/10 with itemized reds and 5/5 resisted is an unsignable close. It is
294
- * the ONE gate here that spends money, so it runs LAST — every free refusal
295
- * has already had its chance, and nobody pays to discover a broken
296
- * declaration.
297
- *
298
- * D9.3 AND THE JUDGED CLOSE (2026-08-18 second addendum, ruling 3; hamr: *"fix it now,
299
- * we are delivering softgreen, isn't that the whole point?"*; widened 2026-10-09 to mixed
300
- * closes, hamr: *"a rubric job should check if judge can judge (calibration) and judge
301
- * rules can apply properly to pass ... we can't close everything upfront"*). Gate 3
302
- * protects against a close that cannot fail. A judged stage SKIPS the seed read by ruling
303
- * 8, so it can never show red there. For ANY close carrying a judged stage (pure or
304
- * mixed with mechanical stages), a PASSED calibration gate plays the seed-red role
305
- * (`seedProofIsCalibration`). A close with NO judged stage is UNCHANGED: some work stage
306
- * must be red at the seed. A failed or missing calibration never satisfies it.
273
+ * (There was a fourth, paid gate, the calibration gate of the old judge; it is gone with the old judge, 2026-11-14.)
307
274
  *
308
275
  * Gates 2 and 3 share ONE execution, and that is stated rather than hidden: at
309
276
  * job creation the tree IS the seed, so "does every stage run against the real
@@ -316,13 +283,11 @@ export function seedProofIsCalibration(judged: any[], calibration: any): boolean
316
283
  * comes back is the resolved spec, its hash, and the evidence to sign against.
317
284
  *
318
285
  * @param {{spec: any, workdir: string, seedRef?: string|null, shellCapUsd?: number,
319
- * timeoutMs?: number, seedFn?: Function, listingFn?: Function, seedReadFn?: Function,
320
- * judgeLoop?: Function|null, judgeModel?: string|null, onJudgeCost?: ((c: any) => void)|null,
321
- * calibrateFn?: Function, ceilingUsd?: number|null, priorCalls?: any[]}} o
286
+ * timeoutMs?: number, seedFn?: Function, listingFn?: Function, seedReadFn?: Function}} o
322
287
  * @returns {Promise<{ok: boolean, specHash: string|null, seedRef: string|null,
323
288
  * gates: any, work: any[], guards: any[], stops: any[], reds: Red[], refusal: Refusal|null}>}
324
289
  */
325
- export function prepareSigning({ spec, workdir, seedRef, shellCapUsd, timeoutMs, seedFn, listingFn, seedReadFn, judgeLoop, judgeModel, onJudgeCost, calibrateFn, ceilingUsd, priorCalls, }: {
290
+ export function prepareSigning({ spec, workdir, seedRef, shellCapUsd, timeoutMs, seedFn, listingFn, seedReadFn, }: {
326
291
  spec: any;
327
292
  workdir: string;
328
293
  seedRef?: string | null;
@@ -331,12 +296,6 @@ export function prepareSigning({ spec, workdir, seedRef, shellCapUsd, timeoutMs,
331
296
  seedFn?: Function;
332
297
  listingFn?: Function;
333
298
  seedReadFn?: Function;
334
- judgeLoop?: Function | null;
335
- judgeModel?: string | null;
336
- onJudgeCost?: ((c: any) => void) | null;
337
- calibrateFn?: Function;
338
- ceilingUsd?: number | null;
339
- priorCalls?: any[];
340
299
  }): Promise<{
341
300
  ok: boolean;
342
301
  specHash: string | null;
@@ -26,25 +26,6 @@ export function fellBackLines(authoring: {
26
26
  brokenStages: string[];
27
27
  } | null;
28
28
  } | null): string[];
29
- /**
30
- * THE TWO SIGNED JUDGED ARTIFACTS, as a person reads them before signing
31
- * (softgreen modules 4+5). Absent on a close that judges nothing, which is why
32
- * this returns an EMPTY list rather than a "no card" line: a green close has no
33
- * rubric and saying so every run is noise, not information.
34
- *
35
- * The CARD is printed in full — it is short, it is the whole standard the judge
36
- * will hold the work to, and it is the signer's own words. The CASES are printed
37
- * as a ROSTER (id, verdict, itemized reds) rather than in full: ten real source
38
- * artifacts is a page of code the terminal cannot usefully show, and what a
39
- * signer checks at this surface is that both polarities are there and that each
40
- * red names something they recognise. The artifacts themselves are in the spec
41
- * file, which is named right above this block.
42
- * @param {{closeDecl?: any}} spec the RESOLVED spec
43
- * @returns {string[]}
44
- */
45
- export function rubricLines({ closeDecl }: {
46
- closeDecl?: any;
47
- }): string[];
48
29
  /**
49
30
  * THE CONFIRM TURN'S OPEN QUESTIONS (PRD item 33 M3 piece 4, ruling 5's D3
50
31
  * addendum) — shown at the SIGNING readout, from `authored.json`'s own
@@ -75,32 +56,6 @@ export function openQuestionLines(confirmed: {
75
56
  export function answeredQuestionLines(confirmed: {
76
57
  answeredQuestions?: string[];
77
58
  } | null): string[];
78
- /**
79
- * THE CALIBRATION GATE'S OWN READOUT — the one gate that spends money, and the
80
- * one whose rows a signer has to read case by case.
81
- *
82
- * ITEMIZED, never an aggregate percentage: "9/10" tells a person nothing about
83
- * which line of their own rubric is wrong, and the fix for a miss is a card line
84
- * or a corrected case (§4.3's ceiling). A CASUALTY prints under its own name and
85
- * says so, because a dead judge is not a failed set.
86
- * @param {any} calibration `signing.gates.calibration`
87
- * @returns {string[]}
88
- */
89
- export function calibrationLines(calibration: any): string[];
90
- /**
91
- * The calibration gate's real result as one line a person reads next to the step (hamr, 2026-10-09: the panel
92
- * showed `calibrating ✓` over a gate that graded 8 of 10 and let 2 attack styles leak). PASS IS THE GATE'S OWN:
93
- * `ok` is `calibration.ok` as `runCalibration` decided it (every case right as a SET of reds, every style
94
- * resisted), never recomputed here, so there is no second spelling of the floor. The counts are read from the
95
- * record (`graded[].ok` is `compareExpectation`, which compares reds as sets); the denominators are the live
96
- * constants (CALIBRATION_SIZE, the battery length), so a gate that stopped part-way reads "x of 10", not "x of x".
97
- * @param {any} calibration `signing.gates.calibration`
98
- * @returns {{ok: boolean, note: string}|null} null when the gate was not reached
99
- */
100
- export function calibrationSummary(calibration: any): {
101
- ok: boolean;
102
- note: string;
103
- } | null;
104
59
  /**
105
60
  * THE AUTHORING CEILING, parsed from `--budget`. Housed here for the same reason
106
61
  * the readout above is: the runner is a script, and a rule no test can reach is a
@@ -193,12 +148,9 @@ export function plainKinds(): string[];
193
148
  * An unknown code is NEVER dropped: it becomes a generic sentence that still
194
149
  * quotes the code and path, under the kind `unmapped`.
195
150
  * @param {PlainRed[]} reds
196
- * @param {{cases?: any}} [o] the proposed cases, to name a case by its own id
197
151
  * @returns {PlainReason[]}
198
152
  */
199
- export function plainReasons(reds: PlainRed[], { cases }?: {
200
- cases?: any;
201
- }): PlainReason[];
153
+ export function plainReasons(reds: PlainRed[]): PlainReason[];
202
154
  /**
203
155
  * WHY one drafting try was refused, in the code's own words: the unique `detail` of each red it raised (the same sentences
204
156
  * `draftStopText` quotes at a stop), else the plain `reason` the loop gave (a seed-read failure raises no red). Scrubbed,
@@ -222,23 +174,6 @@ export function declarationRecord(declaration: unknown): {
222
174
  declarationText: string;
223
175
  declarationCut: true;
224
176
  } | {};
225
- /**
226
- * THE MESSAGE a person reads when the rubric proposal was refused. Both doors
227
- * (the panel's failed step and the CLI) print exactly this.
228
- * @param {{stop: string, reds: PlainRed[], cases?: any, spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null,
229
- * source?: 'proposal'|'signer'}} o
230
- * @returns {string}
231
- */
232
- export function proposalStopText({ stop, reds, cases, spend, source }: {
233
- stop: string;
234
- reds: PlainRed[];
235
- cases?: any;
236
- spend?: {
237
- knownUsd?: number | null;
238
- spendComplete?: boolean | null;
239
- } | null;
240
- source?: "proposal" | "signer";
241
- }): string;
242
177
  /**
243
178
  * @param {{stop: string, reds?: PlainRed[]|null, refusal?: {detail?: string}|null,
244
179
  * spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null, wholeJob?: boolean}} o `wholeJob` - a rubric job on the person's
@@ -258,14 +193,11 @@ export function draftStopText({ stop, reds, refusal, spend, wholeJob }: {
258
193
  wholeJob?: boolean;
259
194
  }): string;
260
195
  /**
261
- * Plain sentences for the reds of a refused signing, one or more per red. Card and practice-case reds reuse the
262
- * proposal table; an unknown code is a generic sentence that quotes the code.
263
- * @param {PlainRed[]} reds @param {{cases?: any}} [o]
196
+ * Plain sentences for the reds of a refused signing, one or more per red. An unknown code is a generic sentence that quotes the code.
197
+ * @param {PlainRed[]} reds
264
198
  * @returns {{kind: string, sentence: string, todo: string, red: PlainRed}[]}
265
199
  */
266
- export function signingReasons(reds: PlainRed[], { cases }?: {
267
- cases?: any;
268
- }): {
200
+ export function signingReasons(reds: PlainRed[]): {
269
201
  kind: string;
270
202
  sentence: string;
271
203
  todo: string;
@@ -276,16 +208,15 @@ export function signingReasons(reds: PlainRed[], { cases }?: {
276
208
  export function signingKinds(): string[];
277
209
  /**
278
210
  * THE MESSAGE a person reads when the signing gates refuse. The panel's failed step and the CLI print exactly this.
279
- * @param {{reds: PlainRed[], refusal?: {detail?: string}|null, cases?: any, noCheck?: boolean,
211
+ * @param {{reds: PlainRed[], refusal?: {detail?: string}|null, noCheck?: boolean,
280
212
  * spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null}} o `noCheck` = the check block has no built check (block.hasBuiltCheck() is false): the stop is the end check's own words
281
213
  * @returns {string}
282
214
  */
283
- export function signingStopText({ reds, refusal, cases, spend, noCheck }: {
215
+ export function signingStopText({ reds, refusal, spend, noCheck }: {
284
216
  reds: PlainRed[];
285
217
  refusal?: {
286
218
  detail?: string;
287
219
  } | null;
288
- cases?: any;
289
220
  noCheck?: boolean;
290
221
  spend?: {
291
222
  knownUsd?: number | null;
@@ -295,15 +226,45 @@ export function signingStopText({ reds, refusal, cases, spend, noCheck }: {
295
226
  /**
296
227
  * The reds as the drafting log keeps them: every structured field, the plain
297
228
  * sentence beside it, every string secret-scrubbed and bounded, the list capped.
298
- * @param {PlainRed[]} reds @param {{cases?: any, signing?: boolean}} [o] `signing`: the reds are the signing gates', worded by signingReasons
229
+ * @param {PlainRed[]} reds @param {{signing?: boolean}} [o] `signing`: the reds are the signing gates', worded by signingReasons
299
230
  * @returns {Record<string, any>[]}
300
231
  */
301
- export function redsRecord(reds: PlainRed[], { cases, signing }?: {
302
- cases?: any;
232
+ export function redsRecord(reds: PlainRed[], { signing }?: {
303
233
  signing?: boolean;
304
234
  }): Record<string, any>[];
305
- /** the stops this module explains in plain words */
306
- export const PLAIN_PROPOSAL_STOPS: readonly string[];
235
+ /** Zero-based indexes of the header and heading lines in a readout's text (split on "\n"): the panel draws those bold. @param {string} text @returns {number[]} */
236
+ export function readoutHeadIndexes(text: string): number[];
237
+ /**
238
+ * The plain-text readout of the draft the person is about to sign (hamr 2026-11-15, copied from fwdloop v0.34.0 `buildReadout`; ASKS, SEND TARGET, flows root and grants are fwd-only and not here).
239
+ * DISPLAY ONLY: built from the signed resolved spec, the draft log and the session's own figures; never signed, never stored, never part of the hash. Pure. The check rows are `cardOfClose`'s (the same reader and tags the card draws),
240
+ * the fence is `fenceRowText`'s, the Not checked rows are `ruleNotCheckedItems`'s plus the `refusedOf` rows it leaves out. The whole text goes through `redactSecrets`.
241
+ * @param {{spec: any, name?: string, modelId?: string|null, rounds: number, costUsd: number|null, spendComplete?: boolean, specHash?: string|null, source?: string, destination?: string,
242
+ * humans?: {question: string, answer: string, line?: number, choice?: string, words?: string}[], ledger?: {key: string, words: string[]}[]|null}} o
243
+ * `costUsd` = the known drafting spend; `spendComplete` false = a provider call was unpriced, so it reads "at least"
244
+ * @returns {string}
245
+ */
246
+ export function buildReadout({ spec, name, modelId, rounds, costUsd, spendComplete, specHash, source, destination, humans, ledger }: {
247
+ spec: any;
248
+ name?: string;
249
+ modelId?: string | null;
250
+ rounds: number;
251
+ costUsd: number | null;
252
+ spendComplete?: boolean;
253
+ specHash?: string | null;
254
+ source?: string;
255
+ destination?: string;
256
+ humans?: {
257
+ question: string;
258
+ answer: string;
259
+ line?: number;
260
+ choice?: string;
261
+ words?: string;
262
+ }[];
263
+ ledger?: {
264
+ key: string;
265
+ words: string[];
266
+ }[] | null;
267
+ }): string;
307
268
  /**
308
269
  * ONE owner of the plain sentence for every drafting stop code (hamr 2026-10-09: "a user should get a reason they can
309
270
  * understand and do something about"). What happened; `STOP_TODO` below overrides the default "draft again" where that is wrong.
@@ -313,6 +274,17 @@ export const PLAIN_PROPOSAL_STOPS: readonly string[];
313
274
  export const STOP_HEADS: Record<string, string>;
314
275
  /** codes the declaration gates (validateJob, validateCloseDecl) raise: one plain sentence covers the family */
315
276
  export const DECLARATION_CODES: readonly string[];
277
+ /** The draft readout's section headings: the ONE list (fwd v0.34.0 `READOUT_HEADS`). `buildReadout` writes them from here and `readoutHeadIndexes` finds them by it, so the panel's bold and the text cannot drift. */
278
+ export const READOUT_HEADS: Readonly<{
279
+ inputs: "INPUTS";
280
+ steps: "STEPS";
281
+ fence: "WRITE FENCE";
282
+ notChecked: "REFUSED / NOT CHECKED";
283
+ jobLines: "JOB LINES";
284
+ answers: "YOUR ANSWERS";
285
+ }>;
286
+ /** The readout's top line prefix: ONE owner for the text `buildReadout` writes and the bold `readoutHeadIndexes` finds. */
287
+ export const READOUT_HEADER_PREFIX: "DRAFT READOUT \u2014 NOT SIGNED \u2014 job ";
316
288
  export type PlainRed = {
317
289
  code: string;
318
290
  path: string;
@@ -11,6 +11,26 @@
11
11
  * `'bareloop author'` so a person who typed that is told to re-run THAT,
12
12
  * never a script path they never invoked and may not have on disk.
13
13
  */
14
+ /**
15
+ * The lines the CLI prints for one question the plan raised: the ask, then (try-3 question, Addendum 2026-11-14 (c) piece 5) what the answer does, in the panel's own words ("This replaces: ..." or
16
+ * "This adds a new rule to line N"). Pure.
17
+ * @param {{index?: number, total?: number, question?: string, line?: number, replaces?: string, adds?: boolean, [k: string]: any}} step @returns {string[]}
18
+ */
19
+ export function answerPromptLines(step: {
20
+ index?: number;
21
+ total?: number;
22
+ question?: string;
23
+ line?: number;
24
+ replaces?: string;
25
+ adds?: boolean;
26
+ [k: string]: any;
27
+ }): string[];
28
+ /**
29
+ * The confirm turn's plan as the CLI prints it, read from the SAME rows the panel card draws (Addendum 2026-11-14 (c) piece 3): every check is its row (line, tag, words), the protections are the
30
+ * write fence only for a job whose list holds the guards. A plan that carries no row items (a repo job) prints its plain `checks` as before. Pure: one string per printed line.
31
+ * @param {any} p the confirm plan @returns {string[]}
32
+ */
33
+ export function confirmPlanLines(p: any): string[];
14
34
  /**
15
35
  * Parses this script's own argv shape and runs the authoring pipeline
16
36
  * (scout, declaration loop, D9's gates) against the given (or real)
@@ -1,14 +1,9 @@
1
- /** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'cant-check'|'no-check'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>, pairRule?: number}} BlockAsk */
1
+ /** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>}} BlockAsk */
2
2
  /**
3
- * The questions the block has open, in the order the person meets them: the look's readings, then the look's can't-checks, then the pick path's asks (a proposal or a can't-check about a rule the pick path owns) in rule order (a proposal is not counted toward the 3-ask cap).
4
- * A can't-check about a rule the PICK path owns (`scoped`: src/checkpick.js scopedRules, every `~` rule of a file job) is the pick path's own ask, `no-check`, in fwd's words (a "Line N, guardrail ...: I can't check this" ask
5
- * whose answer the panel records as a pick, so Revise carries it: am17/am18/am21); any other can't-check is the look's own ask about a page.
6
- * @param {import('./checkblock.js').CheckBlock} block @param {{line: number, rule: number}[]} [scoped] @returns {BlockAsk[]}
3
+ * The questions the block has open, in the order the person meets them: the look's readings, then the pick path's check proposals in rule order (a proposal is not counted toward the 3-ask cap).
4
+ * @param {import('./checkblock.js').CheckBlock} block @returns {BlockAsk[]}
7
5
  */
8
- export function questionsOfBlock(block: import("./checkblock.js").CheckBlock, scoped?: {
9
- line: number;
10
- rule: number;
11
- }[]): BlockAsk[];
6
+ export function questionsOfBlock(block: import("./checkblock.js").CheckBlock): BlockAsk[];
12
7
  /**
13
8
  * The person's choices back into the block, one by one (the choice decides, never the words). A choice the block refuses is returned with its plain reason; the question stays open.
14
9
  * @param {import('./checkblock.js').CheckBlock} block @param {{key: string, choice: string, text?: string}[]} choices @returns {{key: string, why: string}[]}
@@ -27,11 +22,10 @@ export type BlockAsk = {
27
22
  line: number;
28
23
  rule: number;
29
24
  source: "look";
30
- ask: "reading" | "cant-check" | "no-check" | "check";
25
+ ask: "reading" | "check";
31
26
  ruleText: string;
32
27
  question: string;
33
28
  counted: boolean;
34
29
  reading?: string;
35
30
  check?: Record<string, any>;
36
- pairRule?: number;
37
31
  };