bareloop 0.55.0 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +3 -3
  3. package/bareloop.context.md +69 -209
  4. package/package.json +2 -2
  5. package/src/authorflow.js +164 -340
  6. package/src/authoring.js +7 -127
  7. package/src/authorjob.js +139 -472
  8. package/src/authorreadout.js +24 -368
  9. package/src/authorrun.js +21 -215
  10. package/src/behaviour.js +14 -0
  11. package/src/blockasks.js +43 -0
  12. package/src/bundlerun.js +4 -1
  13. package/src/checkblock.js +798 -0
  14. package/src/checklist.js +128 -0
  15. package/src/checkpick.js +39 -312
  16. package/src/checkwords.js +3 -1
  17. package/src/cli.js +3 -3
  18. package/src/declaredclose.js +38 -108
  19. package/src/destpoint.js +4 -2
  20. package/src/draftspend.js +46 -0
  21. package/src/facts.js +8 -1
  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 +5 -347
  28. package/src/noteask.js +124 -0
  29. package/src/pagedry.js +27 -5
  30. package/src/pagemap.js +15 -3
  31. package/src/pagerules.js +18 -3
  32. package/src/panel/authorroutes.js +24 -6
  33. package/src/panel/authorsession.js +222 -177
  34. package/src/panel/importrun.js +0 -1
  35. package/src/panel/index.html +198 -26
  36. package/src/panel/jobplan.js +87 -33
  37. package/src/panel/server.js +74 -68
  38. package/src/panel/status.js +3 -0
  39. package/src/pickrecord.js +34 -55
  40. package/src/placerule.js +355 -0
  41. package/src/planrun.js +2 -48
  42. package/src/promptregisters.js +13 -17
  43. package/src/providerrows.js +0 -36
  44. package/src/providers.js +4 -25
  45. package/src/questionbox.js +104 -0
  46. package/src/rowedit.js +115 -0
  47. package/src/rubricstep.js +234 -127
  48. package/src/run.js +11 -16
  49. package/src/userrun.js +60 -112
  50. package/types/authorflow.d.ts +41 -197
  51. package/types/authoring.d.ts +1 -14
  52. package/types/authorjob.d.ts +35 -59
  53. package/types/authorreadout.d.ts +10 -88
  54. package/types/behaviour.d.ts +12 -0
  55. package/types/blockasks.d.ts +36 -0
  56. package/types/checkblock.d.ts +376 -0
  57. package/types/checklist.d.ts +134 -0
  58. package/types/checkpick.d.ts +8 -140
  59. package/types/cli.d.ts +1 -3
  60. package/types/declaredclose.d.ts +7 -33
  61. package/types/destpoint.d.ts +2 -0
  62. package/types/draftspend.d.ts +21 -0
  63. package/types/index.d.ts +2 -4
  64. package/types/job.d.ts +8 -0
  65. package/types/jobblock.d.ts +8 -38
  66. package/types/judged.d.ts +7 -357
  67. package/types/kinds.d.ts +3 -104
  68. package/types/noteask.d.ts +76 -0
  69. package/types/pagedry.d.ts +13 -0
  70. package/types/pagemap.d.ts +4 -0
  71. package/types/pagerules.d.ts +7 -0
  72. package/types/panel/authorsession.d.ts +47 -5
  73. package/types/panel/jobgrid.d.ts +8 -8
  74. package/types/panel/jobplan.d.ts +48 -10
  75. package/types/panel/server.d.ts +27 -18
  76. package/types/panel/status.d.ts +5 -0
  77. package/types/pickrecord.d.ts +20 -13
  78. package/types/placerule.d.ts +194 -0
  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 +87 -0
  83. package/types/rowedit.d.ts +32 -0
  84. package/types/rubricstep.d.ts +100 -48
  85. package/types/run.d.ts +9 -19
  86. package/types/userrun.d.ts +0 -1
  87. package/src/calibrate.js +0 -702
  88. package/src/cardauthor.js +0 -502
  89. package/src/fitcheck.js +0 -166
  90. package/types/calibrate.d.ts +0 -201
  91. package/types/cardauthor.d.ts +0 -358
  92. package/types/fitcheck.d.ts +0 -113
@@ -67,16 +67,19 @@ export function labelsFor(verdictType: string): Record<string | number, string>;
67
67
  * close — one source, never a second hand-typed list — rendered through the
68
68
  * frozen line in {@link GUARD_DESCRIPTIONS}, plus the write fence (a real,
69
69
  * signed fence — {@link writeScopeBlock}'s own subject) when one is set.
70
- * @param {{verdictType: string, lang: string, writeScope?: string[]|null, jobLines?: {n: number}[]|null}} o
70
+ * A rubric line's file is listed as carrying text ONLY when the close really puts a text-present check on it ({@link lineCarriesText}, derived from `closeDecl`; one owner): a facts-only line
71
+ * (results and no note) is listed without it, and with no close to read nothing is claimed about text.
72
+ * @param {{verdictType: string, lang: string, writeScope?: string[]|null, jobLines?: {n: number}[]|null, closeDecl?: any}} o
71
73
  * @returns {string[]}
72
74
  */
73
- export function confirmProtections({ verdictType, lang, writeScope, jobLines }: {
75
+ export function confirmProtections({ verdictType, lang, writeScope, jobLines, closeDecl }: {
74
76
  verdictType: string;
75
77
  lang: string;
76
78
  writeScope?: string[] | null;
77
79
  jobLines?: {
78
80
  n: number;
79
81
  }[] | null;
82
+ closeDecl?: any;
80
83
  }): string[];
81
84
  /**
82
85
  * The mechanical seam between the catalogue and the schema, read BOTH ways: a
@@ -519,8 +522,7 @@ export function writeScopeBlock(writeScope: string[]): string;
519
522
  * meaning from `openQuestions` (which means "could not resolve"): the two
520
523
  * never merge.
521
524
  * @param {{checks: string[], checkItems?: {text: string, fromLine: number[]|null}[], protections: string[], openQuestions?: string[], notChecked?: string[],
522
- * answeredQuestions?: string[]}} confirmed
523
- * @param {{numbered?: boolean}} [o] `numbered` (a rubric job on files): each confirmed check carries its `#n`, which a part cites in `covers`
525
+ * answeredQuestions?: string[], goalOnly?: boolean}} confirmed
524
526
  */
525
527
  export function confirmedBlock(confirmed: {
526
528
  checks: string[];
@@ -532,8 +534,7 @@ export function confirmedBlock(confirmed: {
532
534
  openQuestions?: string[];
533
535
  notChecked?: string[];
534
536
  answeredQuestions?: string[];
535
- }, { numbered }?: {
536
- numbered?: boolean;
537
+ goalOnly?: boolean;
537
538
  }): string;
538
539
  /**
539
540
  * P7: the job-line tagging order (model-facing, registered). Rule 1 of the job block: every stage the drafter writes
@@ -567,10 +568,10 @@ export function jobLineTagBlock(count: number, guardNames?: string[]): string;
567
568
  * writeScope?: string[]|null,
568
569
  * jobLines?: {n: number}[]|null, inputs?: {n: number, label: string, value: string}[]|null,
569
570
  * confirmed?: {checks: string[], checkItems?: {text: string, fromLine: number[]|null}[], protections: string[], openQuestions?: string[], notChecked?: string[], answeredQuestions?: string[]}|null,
570
- * labelLists?: string[]|null, settled?: {line: number, rule: number, text: string}[]|null,
571
+ * labelLists?: string[]|null,
571
572
  * }} o
572
573
  */
573
- export function authorPrompt({ answers, questions, facts, listingBlock, lang, verdictType, guards, ownedEnvNames, mode, catalogue: catalogueIn, writeScope, jobLines, inputs, confirmed, labelLists, settled, }: {
574
+ export function authorPrompt({ answers, questions, facts, listingBlock, lang, verdictType, guards, ownedEnvNames, mode, catalogue: catalogueIn, writeScope, jobLines, inputs, confirmed, labelLists, }: {
574
575
  answers: Record<string | number, string>;
575
576
  questions?: Record<string | number, string>;
576
577
  facts: any;
@@ -607,64 +608,6 @@ export function authorPrompt({ answers, questions, facts, listingBlock, lang, ve
607
608
  answeredQuestions?: string[];
608
609
  } | null;
609
610
  labelLists?: string[] | null;
610
- settled?: {
611
- line: number;
612
- rule: number;
613
- text: string;
614
- }[] | null;
615
- }): string;
616
- /**
617
- * R10: the `~` rules code settles from the person's own picks, as the composer is told them. The drafter writes no check for these and lists nothing for them under
618
- * "refused": code puts the picked check, or the Not checked row, on the stage itself.
619
- * @param {{line: number, rule: number, text: string}[]} settled @returns {string}
620
- */
621
- export function settledBlock(settled: {
622
- line: number;
623
- rule: number;
624
- text: string;
625
- }[]): string;
626
- /**
627
- * The composer prompt for a rubric job on local files (Part 1a, docs/product/ITEM33-BUILD.md). There is no repository
628
- * and no survey: the facts are the numbered inputs and the listing is the frozen tree (input/ files, output/). It states
629
- * the step-file contract the worker is also told ({@link stepFileContract}), so the stage and the file cannot drift.
630
- * @param {{answers: Record<string|number, string>, questions?: Record<string|number, string>, facts: any, listingBlock: string,
631
- * verdictType: string, guards: {name: string, kind: string, params: Record<string, any>, fill: string[]}[],
632
- * mode?: 'tool'|'text', catalogue?: Record<string, any>, writeScope?: string[]|null,
633
- * jobLines?: {n: number}[]|null, inputs?: {n: number, label: string, value: string}[]|null, confirmed?: any,
634
- * labelLists?: string[]|null, settled?: {line: number, rule: number, text: string}[]|null,
635
- * }} o
636
- * @returns {string}
637
- */
638
- export function rubricAuthorPrompt({ answers, questions, facts, listingBlock, verdictType, guards, mode, catalogue, writeScope, jobLines, inputs, confirmed, labelLists, settled, }: {
639
- answers: Record<string | number, string>;
640
- questions?: Record<string | number, string>;
641
- facts: any;
642
- listingBlock: string;
643
- verdictType: string;
644
- guards: {
645
- name: string;
646
- kind: string;
647
- params: Record<string, any>;
648
- fill: string[];
649
- }[];
650
- mode?: "tool" | "text";
651
- catalogue?: Record<string, any>;
652
- writeScope?: string[] | null;
653
- jobLines?: {
654
- n: number;
655
- }[] | null;
656
- inputs?: {
657
- n: number;
658
- label: string;
659
- value: string;
660
- }[] | null;
661
- confirmed?: any;
662
- labelLists?: string[] | null;
663
- settled?: {
664
- line: number;
665
- rule: number;
666
- text: string;
667
- }[] | null;
668
611
  }): string;
669
612
  /**
670
613
  * The seed read, as the model sees it: mechanical labels, no editorial. Per-stage
@@ -698,10 +641,10 @@ export function renderSeedReadBlock(rows: any[], { gapCap }?: {
698
641
  * a credential crossed unmasked before this line existed. Applied to the whole
699
642
  * rendered block rather than one field, so a red added to the validator is
700
643
  * scrubbed by construction rather than by remembering.
701
- * @param {{kind: 'validation'|'artifact', reds: (Red|string)[], cap?: number}} o
644
+ * @param {{kind: 'validation'|'artifact'|'edits', reds: (Red|string)[], cap?: number}} o
702
645
  */
703
646
  export function renderRejectBlock({ kind, reds, cap }: {
704
- kind: "validation" | "artifact";
647
+ kind: "validation" | "artifact" | "edits";
705
648
  reds: (Red | string)[];
706
649
  cap?: number;
707
650
  }): string;
@@ -980,10 +923,9 @@ export function confirmTool(box: {
980
923
  * @param {{answers: Record<string|number, string>, questions: Record<string|number, string>,
981
924
  * labels?: Record<string|number, string>, facts?: any, listing?: string|null,
982
925
  * writeScope?: string[]|null, isRepo: boolean, lang: string, worseThanBefore?: string,
983
- * fixText?: string|null, protections?: string[], inputs?: {n: number, label: string, value: string}[]|null, ticket?: boolean,
984
- * settled?: {line: number, rule: number, text: string}[]|null}} o
926
+ * fixText?: string|null, protections?: string[], inputs?: {n: number, label: string, value: string}[]|null, ticket?: boolean}} o
985
927
  */
986
- export function confirmPrompt({ answers, questions, labels, facts, listing, writeScope, isRepo, lang, worseThanBefore, fixText, protections, inputs, ticket, settled }: {
928
+ export function confirmPrompt({ answers, questions, labels, facts, listing, writeScope, isRepo, lang, worseThanBefore, fixText, protections, inputs, ticket }: {
987
929
  answers: Record<string | number, string>;
988
930
  questions: Record<string | number, string>;
989
931
  labels?: Record<string | number, string>;
@@ -1001,11 +943,6 @@ export function confirmPrompt({ answers, questions, labels, facts, listing, writ
1001
943
  value: string;
1002
944
  }[] | null;
1003
945
  ticket?: boolean;
1004
- settled?: {
1005
- line: number;
1006
- rule: number;
1007
- text: string;
1008
- }[] | null;
1009
946
  }): string;
1010
947
  /**
1011
948
  * THE CONFIRM TURN: the $0 half (worse-than-before for a repo, a language
@@ -1030,7 +967,7 @@ export function confirmPrompt({ answers, questions, labels, facts, listing, writ
1030
967
  * ask: (step: {kind: string, [k: string]: any}) => Promise<string|null>,
1031
968
  * onPhase?: (phase: string, data?: any) => void, mode?: 'tool'|'text',
1032
969
  * worseThanBefore?: string, inputs?: {n: number, label: string, value: string}[]|null,
1033
- * jobLines?: {n: number}[]|null, ticket?: boolean, settled?: {line: number, rule: number, text: string}[]|null}} o retired field (hamr's ruling 2026-09-28):
970
+ * jobLines?: {n: number}[]|null, ticket?: boolean, card?: {checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy?: Record<string, string>}|null, block?: CheckBlock|null, cardOf?: (() => any)|null}} o retired field (hamr's ruling 2026-09-28):
1034
971
  * `worseThanBefore` is never asked any more and defaults to `''` — a
1035
972
  * caller may still pass a string through (kept for a future, non-ask
1036
973
  * source of the same constraint), it just never comes from an ask() step.
@@ -1041,7 +978,7 @@ export function confirmPrompt({ answers, questions, labels, facts, listing, writ
1041
978
  * worseThanBefore: string, openQuestions: string[], notChecked: string[], answeredQuestions?: string[]}|null,
1042
979
  * reds: Red[], cost: any}>}
1043
980
  */
1044
- export function runConfirmTurn({ verdictType, answers, questions, labels, facts, listing, writeScope, isRepo, lang, generate, book, ask, onPhase, mode, worseThanBefore: presetWorseThanBefore, inputs, jobLines, ticket, settled, }: {
981
+ export function runConfirmTurn({ verdictType, answers, questions, labels, facts, listing, writeScope, isRepo, lang, generate, book, ask, onPhase, mode, worseThanBefore: presetWorseThanBefore, inputs, jobLines, ticket, card, block, cardOf, }: {
1045
982
  verdictType: string;
1046
983
  answers: Record<string | number, string>;
1047
984
  questions: Record<string | number, string>;
@@ -1073,11 +1010,18 @@ export function runConfirmTurn({ verdictType, answers, questions, labels, facts,
1073
1010
  n: number;
1074
1011
  }[] | null;
1075
1012
  ticket?: boolean;
1076
- settled?: {
1077
- line: number;
1078
- rule: number;
1079
- text: string;
1080
- }[] | null;
1013
+ card?: {
1014
+ checkItems: {
1015
+ text: string;
1016
+ fromLine: number[];
1017
+ by: "agent" | "you" | "default";
1018
+ key?: string;
1019
+ }[];
1020
+ notChecked: string[];
1021
+ notCheckedBy?: Record<string, string>;
1022
+ } | null;
1023
+ block?: CheckBlock | null;
1024
+ cardOf?: (() => any) | null;
1081
1025
  }): Promise<{
1082
1026
  ok: boolean;
1083
1027
  stop: null | "cap-halt" | "pricing-red" | "provider-red" | "artifact-red" | "confirm-abandoned" | "confirm-restart";
@@ -1099,25 +1043,6 @@ export function runConfirmTurn({ verdictType, answers, questions, labels, facts,
1099
1043
  reds: Red[];
1100
1044
  cost: any;
1101
1045
  }>;
1102
- /**
1103
- * PRD v1.131 tick 4 (rubric jobs, the LAST try only; the caller gates both): the last try failed the gate, so the AI's own broken parts are dropped to Not checked (`dropExtras`) and the plan
1104
- * is bound and checked ONCE more with the same gate (`redo`). Returns the new settled declaration and its result when that passes; `null` = nothing dropped, the plan is refused as today (the
1105
- * try passed already, a red sits on a part the picks built or on no part, or the re-check is still red).
1106
- * @param {{pre: any, v: {ok: boolean, reds: any[]}, jobLines: any[]|null|undefined, redo: (d: any) => any}} o
1107
- * @returns {{pre: any, v: any}|null}
1108
- */
1109
- export function dropAfterLastTry({ pre, v, jobLines, redo }: {
1110
- pre: any;
1111
- v: {
1112
- ok: boolean;
1113
- reds: any[];
1114
- };
1115
- jobLines: any[] | null | undefined;
1116
- redo: (d: any) => any;
1117
- }): {
1118
- pre: any;
1119
- v: any;
1120
- } | null;
1121
1046
  /**
1122
1047
  * THE AUTHORING FLOW.
1123
1048
  *
@@ -1164,10 +1089,10 @@ export function dropAfterLastTry({ pre, v, jobLines, redo }: {
1164
1089
  * priorCalls?: {label: string, costUsd: number|null, unpricedRounds: number}[]|null,
1165
1090
  * priorRaws?: any[]|null,
1166
1091
  * jobLines?: {n: number, text: string}[]|null, inputs?: {n: number, label: string, value: string}[]|null,
1167
- * offerQuestions?: boolean, ticket?: boolean, checkPicks?: {rules: {line: number, rule: number, text: string}[], picks: any[], left: {line: number, rule: number}[]}|null,
1092
+ * offerQuestions?: boolean, ticket?: boolean, block?: CheckBlock|null, editGenerate?: Function|null,
1168
1093
  * confirmed?: {checks: string[], checkItems?: {text: string, fromLine: number[]|null}[], protections: string[], openQuestions?: string[], notChecked?: string[], answeredQuestions?: string[]}|null}} o
1169
1094
  */
1170
- export function authorClose({ workdir, seedRef, lang, verdictType, answers, questions, writeScope, scout, listing, priorCalls, priorRaws, confirmed, jobLines, inputs, generate, seedReadFn, closeCtx, ceilingUsd, onPhase, onCall, maxRevisions, structureRetries, structuredMode, catalogue: catalogueIn, offerQuestions, ticket, checkPicks, }: {
1095
+ export function authorClose({ workdir, seedRef, lang, verdictType, answers, questions, writeScope, scout, listing, priorCalls, priorRaws, confirmed, jobLines, inputs, generate, seedReadFn, closeCtx, ceilingUsd, onPhase, onCall, maxRevisions, structureRetries, structuredMode, catalogue: catalogueIn, offerQuestions, ticket, block, editGenerate, }: {
1171
1096
  workdir: string;
1172
1097
  seedRef: string;
1173
1098
  lang: string;
@@ -1222,18 +1147,8 @@ export function authorClose({ workdir, seedRef, lang, verdictType, answers, ques
1222
1147
  }[] | null;
1223
1148
  offerQuestions?: boolean;
1224
1149
  ticket?: boolean;
1225
- checkPicks?: {
1226
- rules: {
1227
- line: number;
1228
- rule: number;
1229
- text: string;
1230
- }[];
1231
- picks: any[];
1232
- left: {
1233
- line: number;
1234
- rule: number;
1235
- }[];
1236
- } | null;
1150
+ block?: CheckBlock | null;
1151
+ editGenerate?: Function | null;
1237
1152
  confirmed?: {
1238
1153
  checks: string[];
1239
1154
  checkItems?: {
@@ -1348,7 +1263,7 @@ export const INPUTS_FIELD: Readonly<{
1348
1263
  label: "Inputs";
1349
1264
  prompt: string;
1350
1265
  }>;
1351
- /** P7: how to write "The job" (printed under its question by the CLI; the panel's box shows the same in its examples). */
1266
+ /** P7: how to write "The job" (printed under its question by the CLI; the panel's box shows the same in its placeholder). */
1352
1267
  export const JOB_BLOCK_HELP: readonly string[];
1353
1268
  /** Destination's wording when Source resolved to a git repo: the answer IS the
1354
1269
  * signed `writeScope` fence (ITEM33-BUILD.md M3 ruling 2). */
@@ -1407,28 +1322,13 @@ export const GREEN_QUESTIONS: Readonly<{
1407
1322
  export const FIELD_LABELS: Readonly<{
1408
1323
  1: "The job";
1409
1324
  }>;
1410
- /** The soft-green quartet's own key for Judge Examples — exported so
1411
- * `cardauthor.js` reads the SAME number this module files the answer under,
1412
- * rather than a second, hand-typed "6"/"7". */
1413
- export const SOFTGREEN_JUDGE_EXAMPLES_KEY: number;
1414
- /** The Judge Examples question — the signed table's own Holds text, verbatim
1415
- * ("one pass, one fail, and why"), not the old worded Q7 ("Give one example
1416
- * you'd pass and one you'd fail, and say why."). Exported so `cardauthor.js`'s
1417
- * prompt and this module's own `SOFTGREEN_QUESTIONS` render the identical
1418
- * string; its label ("Judge examples") lives in `SOFTGREEN_FIELD_LABELS`. */
1419
- export const JUDGE_EXAMPLES_QUESTION: "the PASS: and FAIL: examples the person wrote under their job lines, each with its line number";
1420
- /** {@link FIELD_LABELS} plus Judge Examples' own label, for the soft-green set. */
1325
+ /** {@link FIELD_LABELS} for the soft-green set: the same one label (the judge examples are gone). */
1421
1326
  export const SOFTGREEN_FIELD_LABELS: Readonly<{
1422
1327
  1: "The job";
1423
1328
  }>;
1424
1329
  /**
1425
- * THE SOFTGREEN SET — the green trio plus Judge Examples. A judged close needs
1426
- * exactly this one more thing the green set cannot supply: a real pass/fail
1427
- * pair in the person's own words, which module 4 (`cardauthor.js`) compiles
1428
- * into the signed rubric card and the frozen calibration set. It rides in
1429
- * `answers` and reaches the composer verbatim through the prompt's interview
1430
- * block, exactly as every other free-text answer does — this module derives
1431
- * nothing from it.
1330
+ * THE SOFTGREEN SET — the green set again: a rubric job's whole job is the numbered lines of "The job" (its `~` rules
1331
+ * become the check list); the PASS/FAIL judge examples are gone (hamr 2026-11-14).
1432
1332
  */
1433
1333
  export const SOFTGREEN_QUESTIONS: Readonly<{
1434
1334
  1: "the job, as numbered lines — each line may carry the rules (~) the person wrote under it";
@@ -1720,43 +1620,6 @@ export const PARAM_SCHEMAS: Readonly<{
1720
1620
  requireNonEmpty: {
1721
1621
  const: boolean;
1722
1622
  };
1723
- card: {
1724
- type: string;
1725
- description: string;
1726
- properties: {
1727
- items: {
1728
- type: string;
1729
- minItems: number;
1730
- items: {
1731
- type: string;
1732
- properties: {
1733
- rule: {
1734
- enum: string[];
1735
- description: string;
1736
- };
1737
- text: {
1738
- type: string;
1739
- minLength: number;
1740
- description: string;
1741
- };
1742
- };
1743
- required: string[];
1744
- additionalProperties: boolean;
1745
- };
1746
- };
1747
- };
1748
- required: string[];
1749
- additionalProperties: boolean;
1750
- };
1751
- paths: {
1752
- type: string;
1753
- minItems: number;
1754
- maxItems: number;
1755
- items: {
1756
- type: string;
1757
- };
1758
- description: string;
1759
- };
1760
1623
  step: {
1761
1624
  type: string;
1762
1625
  minimum: number;
@@ -1799,16 +1662,6 @@ export const PARAM_SCHEMAS: Readonly<{
1799
1662
  };
1800
1663
  description: string;
1801
1664
  };
1802
- covers: {
1803
- type: string;
1804
- minItems: number;
1805
- uniqueItems: boolean;
1806
- items: {
1807
- type: string;
1808
- minimum: number;
1809
- };
1810
- description: string;
1811
- };
1812
1665
  rules: {
1813
1666
  type: string;
1814
1667
  minItems: number;
@@ -1961,18 +1814,6 @@ export const PARAM_SCHEMAS: Readonly<{
1961
1814
  * about KINDS: every part of a job line is counted or checked against a quote, because nothing in this build judges.
1962
1815
  */
1963
1816
  export const RUBRIC_FILES_STATEMENT: string;
1964
- /**
1965
- * THE RUBRIC RULES, in one place (live fix B1): what the confirm step and the drafter are both told about turning the person's words
1966
- * into checks. The confirm note ({@link RUBRIC_CONFIRM_NOTE}) and the composer brief ({@link REQUIRED_FACTS_BRIEF}) interpolate THIS
1967
- * constant, so the two cannot drift (in smv6k6l8dxkzs the confirm step planned a limit the drafter then could not carry, and the
1968
- * drafter added an airport code the person never wrote). Field-neutral: neither turn needs the other's field names.
1969
- */
1970
- export const RUBRIC_RULES: string;
1971
- /**
1972
- * REQUIRED FACTS, as the composer is told them (PART 1b, PRD item 33 RF1–RF17). The shape of the fact part is in the catalogue and the
1973
- * schema; this is the judgement the schema cannot carry: what becomes a fact, where its words come from, and what is Not checked.
1974
- */
1975
- export const REQUIRED_FACTS_BRIEF: string;
1976
1817
  export const CONFIRM_TOOL_NAME: "confirm_plan";
1977
1818
  /** Acknowledgement text the confirm tool's `execute` returns — mirrors
1978
1819
  * {@link DECLARATION_ACK}'s role: an output channel that records and
@@ -1991,12 +1832,14 @@ export const CONFIRM_STRUCTURE_INSTRUCTION: string;
1991
1832
  * {@link CLASS_STATEMENTS} already use, rather than a code matcher over prose.
1992
1833
  */
1993
1834
  /**
1994
- * What the confirm turn tells the model about a rubric job on local text files (model-facing, registered). There is no
1995
- * repository and no judge: a check is a limit a machine counts (words, lines, sections), or a claim a quote from a named
1996
- * input must back. Everything else the person asked for is named in `notChecked`, in their words.
1835
+ * What the confirm turn tells the model about a rubric job on local text files (model-facing, registered). The turn plans the goal only: the checks of the job are the one list's
1836
+ * (`src/checklist.js`), made before the draft, never this turn's.
1997
1837
  */
1998
1838
  export const RUBRIC_CONFIRM_NOTE: string;
1999
1839
  export const CONFIRM_SYSTEM: string;
1840
+ /** the confirm turn's system prompt for a rubric job (model-facing, registered): a one-sentence goal, no check of its own */
1841
+ export const CONFIRM_GOAL_SYSTEM: string;
1842
+ export function confirmSystemFor(lang: string): string;
2000
1843
  export type Red = {
2001
1844
  code: string;
2002
1845
  path: string;
@@ -2004,3 +1847,4 @@ export type Red = {
2004
1847
  [k: string]: any;
2005
1848
  };
2006
1849
  import { scrubRaw } from './text.js';
1850
+ import { CheckBlock } from './checkblock.js';
@@ -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
- * answerQuestions?: ((o: {questions: {line: number, question: string, rule?: number, source?: string, ask?: string, reading?: string}[], dropped: {reason: string, raw: any}[], confirmed: any}) =>
96
- * Promise<{jobLines: {n: number, text: string, rule?: string}[], answers: Record<string|number, any>, left?: {line: number, rule: number}[], picks?: any[]}|null>)|null,
97
- * pickGenerate?: Function|null, carriedPicks?: any[]|null, onPicks?: (o: {entries: any[], kept: {line: number, rule: number, entry: any}[]}) => void,
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}) =>
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,
95
+ * pickGenerate?: Function|null, ledgerGenerate?: 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[],
102
- * stop: string|null, cost: any, interview: any, confirmed: any, checkPicks?: any}>}
99
+ * closeDecl: any, seedRef: string|null, authoring: any, reds: Red[],
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, carriedPicks, onPicks, 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, 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;
@@ -164,6 +153,7 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
164
153
  source?: string;
165
154
  ask?: string;
166
155
  reading?: string;
156
+ key?: string;
167
157
  }[];
168
158
  dropped: {
169
159
  reason: string;
@@ -182,9 +172,20 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
182
172
  rule: number;
183
173
  }[];
184
174
  picks?: any[];
175
+ choices?: {
176
+ key: string;
177
+ choice: string;
178
+ text?: string;
179
+ }[];
185
180
  } | null>) | null;
186
181
  pickGenerate?: Function | null;
182
+ ledgerGenerate?: Function | null;
183
+ noteFn?: Function | null;
184
+ onJobLines?: ((jobLines: any[]) => void) | null;
185
+ editGenerate?: Function | null;
187
186
  carriedPicks?: any[] | null;
187
+ carriedChoices?: any[] | null;
188
+ onChoices?: (rec: any[]) => void;
188
189
  onPicks?: (o: {
189
190
  entries: any[];
190
191
  kept: {
@@ -207,13 +208,20 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
207
208
  closeDecl: any;
208
209
  seedRef: string | null;
209
210
  authoring: any;
210
- judged: any;
211
211
  reds: Red[];
212
212
  stop: string | null;
213
213
  cost: any;
214
214
  interview: any;
215
215
  confirmed: any;
216
- checkPicks?: any;
216
+ picked?: {
217
+ line: number;
218
+ text: string;
219
+ }[];
220
+ hasBuiltCheck?: boolean;
221
+ notBuilt?: {
222
+ line: number;
223
+ text: string;
224
+ }[];
217
225
  }>;
218
226
  /**
219
227
  * Fold an authored close into the OPERATOR's own half of the spec.
@@ -248,14 +256,6 @@ export function assembleSpec(specDraft: any, { closeDecl, verdictType }: {
248
256
  closeDecl: any;
249
257
  verdictType: string;
250
258
  }): any;
251
- /**
252
- * THE one spelling of "a passed calibration gate stands in for the seed red": the
253
- * close carries a judged stage AND the gate ran and passed. A failed or missing
254
- * calibration never satisfies it, and a close with no judged stage never reaches it.
255
- * @param {any[]} judged `judgedStages(closeDecl)` @param {any} calibration `gates.calibration`
256
- * @returns {boolean}
257
- */
258
- export function seedProofIsCalibration(judged: any[], calibration: any): boolean;
259
259
  /**
260
260
  * D9, in code: *nothing JUDGES the close; three mechanical gates plus a
261
261
  * signature.* No LLM validates another LLM's close, here or anywhere.
@@ -269,23 +269,7 @@ export function seedProofIsCalibration(judged: any[], calibration: any): boolean
269
269
  * A close with NO work stage red at seed has nothing to do and is refused
270
270
  * decision-ready — gate-2 round 2's arm B died exactly there, on a mypy that
271
271
  * scanned nothing and therefore read clean.
272
- * 4. THE CALIBRATION GATE (softgreen module 5) — for a close carrying a
273
- * `judged-floor` stage ONLY. The whole judged pipe runs over the signed ten
274
- * and the five arbiter-owned injection artifacts, and anything short of
275
- * 10/10 with itemized reds and 5/5 resisted is an unsignable close. It is
276
- * the ONE gate here that spends money, so it runs LAST — every free refusal
277
- * has already had its chance, and nobody pays to discover a broken
278
- * declaration.
279
- *
280
- * D9.3 AND THE JUDGED CLOSE (2026-08-18 second addendum, ruling 3; hamr: *"fix it now,
281
- * we are delivering softgreen, isn't that the whole point?"*; widened 2026-10-09 to mixed
282
- * closes, hamr: *"a rubric job should check if judge can judge (calibration) and judge
283
- * rules can apply properly to pass ... we can't close everything upfront"*). Gate 3
284
- * protects against a close that cannot fail. A judged stage SKIPS the seed read by ruling
285
- * 8, so it can never show red there. For ANY close carrying a judged stage (pure or
286
- * mixed with mechanical stages), a PASSED calibration gate plays the seed-red role
287
- * (`seedProofIsCalibration`). A close with NO judged stage is UNCHANGED: some work stage
288
- * must be red at the seed. A failed or missing calibration never satisfies it.
272
+ * (There was a fourth, paid gate, the calibration gate of the old judge; it is gone with the old judge, 2026-11-14.)
289
273
  *
290
274
  * Gates 2 and 3 share ONE execution, and that is stated rather than hidden: at
291
275
  * job creation the tree IS the seed, so "does every stage run against the real
@@ -298,13 +282,11 @@ export function seedProofIsCalibration(judged: any[], calibration: any): boolean
298
282
  * comes back is the resolved spec, its hash, and the evidence to sign against.
299
283
  *
300
284
  * @param {{spec: any, workdir: string, seedRef?: string|null, shellCapUsd?: number,
301
- * timeoutMs?: number, seedFn?: Function, listingFn?: Function, seedReadFn?: Function,
302
- * judgeLoop?: Function|null, judgeModel?: string|null, onJudgeCost?: ((c: any) => void)|null,
303
- * calibrateFn?: Function, ceilingUsd?: number|null, priorCalls?: any[]}} o
285
+ * timeoutMs?: number, seedFn?: Function, listingFn?: Function, seedReadFn?: Function}} o
304
286
  * @returns {Promise<{ok: boolean, specHash: string|null, seedRef: string|null,
305
287
  * gates: any, work: any[], guards: any[], stops: any[], reds: Red[], refusal: Refusal|null}>}
306
288
  */
307
- export function prepareSigning({ spec, workdir, seedRef, shellCapUsd, timeoutMs, seedFn, listingFn, seedReadFn, judgeLoop, judgeModel, onJudgeCost, calibrateFn, ceilingUsd, priorCalls, }: {
289
+ export function prepareSigning({ spec, workdir, seedRef, shellCapUsd, timeoutMs, seedFn, listingFn, seedReadFn, }: {
308
290
  spec: any;
309
291
  workdir: string;
310
292
  seedRef?: string | null;
@@ -313,12 +295,6 @@ export function prepareSigning({ spec, workdir, seedRef, shellCapUsd, timeoutMs,
313
295
  seedFn?: Function;
314
296
  listingFn?: Function;
315
297
  seedReadFn?: Function;
316
- judgeLoop?: Function | null;
317
- judgeModel?: string | null;
318
- onJudgeCost?: ((c: any) => void) | null;
319
- calibrateFn?: Function;
320
- ceilingUsd?: number | null;
321
- priorCalls?: any[];
322
298
  }): Promise<{
323
299
  ok: boolean;
324
300
  specHash: string | null;