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
@@ -0,0 +1,134 @@
1
+ /**
2
+ * A check that needs exact words from the input is true only while the input stays as it is when those words hold a VERSION-like token (1.2 or 1.2.3, not after a currency sign or before
3
+ * a percent) or a DATE-like token (2026-11-04, 04/11/2026, "Nov 4, 2026", "4 November 2026", "November 2026"). Code refuses it; a `~` rule is the person's own and is never refused by this.
4
+ * @param {unknown} t @returns {boolean}
5
+ */
6
+ export function weekOnly(t: unknown): boolean;
7
+ /**
8
+ * The version-like and date-like tokens a text holds (the very tokens {@link weekOnly} reads), each once. Pure.
9
+ * @param {unknown} t @returns {string[]}
10
+ */
11
+ export function weekTokens(t: unknown): string[];
12
+ /** @param {{n: number, text: string, rules?: string[], rule?: string}[]} jobLines @param {Record<string, string>} texts @returns {string} */
13
+ export function ledgerUserText(jobLines: {
14
+ n: number;
15
+ text: string;
16
+ rules?: string[];
17
+ rule?: string;
18
+ }[], texts: Record<string, string>): string;
19
+ /**
20
+ * The one paid call; its spend is booked like the look's. An unusable answer is NOT a guessed list: it yields no `!` proposals and says why.
21
+ * @param {{jobLines: any[], texts: Record<string, string>, generate: Function, ceilingUsd?: number|null, onCall?: (c: any) => void, priorCalls?: any[], priorRaws?: any[]}} o
22
+ * @returns {Promise<{extra: any[], reason: string|null, calls: any[], raws: any[]}>}
23
+ */
24
+ export function runLedgerSuggest({ jobLines, texts, generate, ceilingUsd, onCall, priorCalls, priorRaws }: {
25
+ jobLines: any[];
26
+ texts: Record<string, string>;
27
+ generate: Function;
28
+ ceilingUsd?: number | null;
29
+ onCall?: (c: any) => void;
30
+ priorCalls?: any[];
31
+ priorRaws?: any[];
32
+ }): Promise<{
33
+ extra: any[];
34
+ reason: string | null;
35
+ calls: any[];
36
+ raws: any[];
37
+ }>;
38
+ /** at most this many `!` checks come from the call */
39
+ export const MAX_BANG: 3;
40
+ /** the reason a check on a version or a date goes under Not checked: it is true only for the input as it is today */
41
+ export const WEEK_ONLY_WORDS: "It names a version or a date from the input, true only for the input as it is today, so you judge it at Accept.";
42
+ /** the label of the list call, as the drafting book and the draft log see it */
43
+ export const LEDGER_LABEL: "ledger-suggest";
44
+ export const LEDGER_TOOL: "suggest_extra_checks";
45
+ /** the reason the empty list is logged with */
46
+ export const EMPTY_LIST_WORDS: "empty list: nothing to check";
47
+ export function isEmptyList(rows: Row[]): boolean;
48
+ export function ledgerRecord(rows: Row[]): ({
49
+ key: string;
50
+ line: number;
51
+ rowKind: "fact" | "phrase" | "rule" | "count" | "numbers" | "cited" | "note" | "floor";
52
+ from: "rule" | "agent" | "default" | "pick" | "look";
53
+ by: "you" | "agent" | "default";
54
+ words: string[];
55
+ state: "dropped" | "not-checked" | "built" | "listed";
56
+ reason: string | null;
57
+ } | {
58
+ key: string;
59
+ line: number;
60
+ rowKind: string;
61
+ from: string;
62
+ by: string;
63
+ words: never[];
64
+ state: string;
65
+ reason: string;
66
+ })[];
67
+ /** the list call's own system text (model-facing; used only by the list call of a rubric job with input text) */
68
+ export const LEDGER_SYSTEM: "You look at the inputs of a job and name checks the inputs themselves support, beyond the guardrails the person wrote.\nCall suggest_extra_checks once with up to 3 entries, or with an empty list.\n- kind \"count\": how many results the input shows or the job asks for (min and/or max, whole numbers).\n- kind \"phrase\": fixed words copied verbatim from an input (phrase, and source = that input's label).\nUse only what you can see in the inputs. Do not repeat a guardrail the person wrote. If the inputs support none, send an empty list.";
69
+ export const LEDGER_SCHEMA: Readonly<{
70
+ type: "object";
71
+ properties: {
72
+ extra: {
73
+ type: string;
74
+ maxItems: number;
75
+ items: {
76
+ type: string;
77
+ properties: {
78
+ line: {
79
+ type: string;
80
+ minimum: number;
81
+ description: string;
82
+ };
83
+ kind: {
84
+ enum: string[];
85
+ };
86
+ source: {
87
+ type: string;
88
+ description: string;
89
+ };
90
+ phrase: {
91
+ type: string;
92
+ description: string;
93
+ };
94
+ min: {
95
+ type: string;
96
+ minimum: number;
97
+ };
98
+ max: {
99
+ type: string;
100
+ minimum: number;
101
+ };
102
+ };
103
+ required: string[];
104
+ additionalProperties: boolean;
105
+ };
106
+ };
107
+ };
108
+ required: string[];
109
+ additionalProperties: false;
110
+ }>;
111
+ export type Row = {
112
+ key: string;
113
+ line: number;
114
+ kind: "rule" | "fact" | "cited" | "count" | "phrase" | "numbers" | "note" | "floor";
115
+ from: "rule" | "pick" | "look" | "agent" | "default";
116
+ by: "you" | "agent" | "default";
117
+ words: string[];
118
+ text?: string;
119
+ rule?: number;
120
+ part?: {
121
+ line: number;
122
+ part: number;
123
+ };
124
+ source?: string;
125
+ name?: string;
126
+ min?: number;
127
+ max?: number;
128
+ pick?: string;
129
+ after?: number[];
130
+ state: "listed" | "built" | "not-checked" | "dropped";
131
+ reason: string | null;
132
+ forRule?: number;
133
+ reading?: import("./pagerules.js").Reading;
134
+ };
@@ -48,12 +48,17 @@ export function suggestUserText(lines: {
48
48
  text: string;
49
49
  }[], scoped: Rule[]): string;
50
50
  /**
51
- * The check CODE proposes for a count rule when the call yields none (R10, ours; fwd has no such fallback): a bullets / list-items / points count -> listItems N, a lines count ->
51
+ * The check CODE proposes for a count rule when the call yields none (R10, ours; fwd has no such fallback): a bullets / list-items / points count -> listItems N (exact; "at most / up to / no more than / fewer than / under / below" -> maxListItems, "at least / minimum / no fewer than / more than" -> minListItems, F315), a lines count ->
52
52
  * maxLines N, ONE word number -> minWords N when the rule says "at least / minimum / more than", else maxWords N. A section count names no sections, so none is built; a rule naming two different counts ("3 bullets under 80 words") is not built either; a rule with
53
53
  * several word numbers or a range ("between 100 and 200 words") is not guessed. The result passes `keepOrDrop`, so every number is one the rule names.
54
54
  * @param {string} text @returns {Record<string, any>|null}
55
55
  */
56
56
  export function countCheck(text: string): Record<string, any> | null;
57
+ /**
58
+ * The check a counting rule's own words already ARE ("exactly 3 list items" -> listItems 3), or null. No obvious asks (hamr 2026-11-14): such a rule is settled as written, never proposed back to the person.
59
+ * @param {string} text @returns {Record<string, any>|null}
60
+ */
61
+ export function obviousCheck(text: string): Record<string, any> | null;
57
62
  /**
58
63
  * What the call's answer comes to, one row per scoped rule: the check kept (or null) and why it was dropped. A rule the answer never mentions is dropped as `no entry`; an
59
64
  * entry for a rule that was not sent is ignored.
@@ -64,53 +69,6 @@ export function rowsFromAnswer(scoped: Rule[], args: any): (Rule & {
64
69
  check: Record<string, any> | null;
65
70
  why: string | null;
66
71
  })[];
67
- /**
68
- * @typedef {{line: number, rule: number, source: 'look', ask: 'check'|'no-check', ruleText: string, question: string, reading?: string, check?: Record<string, any>, counted: boolean, pairRule?: number}} PickAsk
69
- */
70
- /**
71
- * The asks for the rows: `Line n, guardrail "<...>": I propose <check in plain words>.` for a kept check, `Line n, guardrail "<...>": I can't check this. Your own words, or
72
- * Not checked?` when nothing was kept. A proposal is not counted toward the 3-ask cap; a can't-check ask is (fwd am16 (5)). Both ride the existing code-forced look ask path
73
- * (`source: 'look'`), so the chat message, the answer words and the draft log rows are the look asks' own.
74
- * @param {ReturnType<typeof rowsFromAnswer>} rows @returns {PickAsk[]}
75
- */
76
- export function checkAsks(rows: ReturnType<typeof rowsFromAnswer>): PickAsk[];
77
- /**
78
- * Settle every scoped rule against the person's answers: a rule with a picked check is checked (and the `~` line an agree wrote is covered by that pick); every other rule is
79
- * Not checked, with the reason (`person-left` = they chose it, `own-words` = they gave their own words, `no-pick` = nothing was picked).
80
- * @param {Rule[]} rules @param {Pick[]} picks @param {{line: number, rule: number, kept?: boolean}[]} left @param {{n: number, rule?: string, rules?: string[]}[]} jobLines the lines AFTER the answers were added
81
- * @returns {{checks: {line: number, text: string, check: Record<string, any>, rules: number[], kept: boolean}[], notes: (Rule & {reason: NoteReason, also: number[], kept: boolean})[]}}
82
- */
83
- export function settleRules(rules: Rule[], picks: Pick[], left: {
84
- line: number;
85
- rule: number;
86
- kept?: boolean;
87
- }[], jobLines: {
88
- n: number;
89
- rule?: string;
90
- rules?: string[];
91
- }[]): {
92
- checks: {
93
- line: number;
94
- text: string;
95
- check: Record<string, any>;
96
- rules: number[];
97
- kept: boolean;
98
- }[];
99
- notes: (Rule & {
100
- reason: NoteReason;
101
- also: number[];
102
- kept: boolean;
103
- })[];
104
- };
105
- /**
106
- * RUBRIC jobs only (the caller gates on the job's lang): a part the drafter wrote as `none` or `judged` is a thing no rule can check, so it is
107
- * listed under Not checked with its own words instead of failing the whole plan (hamr's ruling 2026-11-09, as fwd lists what the drafter cannot check).
108
- * A part that is a verbatim copy of one of the person's `~` rules, or lists rule numbers, gives a `refused` entry per rule no other part carries (shown as that rule's own words); a part that is NOT a verbatim copy of a rule (the job sentence itself, the drafter's own wording) also becomes one line in `notes`, so its words are never lost. Never silent, never a line-level refusal (that would silence the line's other rule reds).
109
- * Runs BEFORE applyPicks, so a rule the person's picks settle gets code's own reason there. `guard` and every other class are untouched.
110
- * A stage left with no parts stays: an empty stage is the legal prose stage ("what the text says - you judge it at Accept"). Pure.
111
- * @param {any} declaration @param {any[]|null|undefined} jobLines @param {boolean} rubric whether the job is a rubric job (the draft gate's `lang === RUBRIC_LANG`); anything else is returned untouched, its reds stand @returns {any}
112
- */
113
- export function moveUncheckable(declaration: any, jobLines: any[] | null | undefined, rubric: boolean): any;
114
72
  /** a part of a rubric-step stage, from a pick: the check's own fields, the rule's words, and the `~` rule numbers it carries out @param {Record<string, any>} check @param {string} text @param {number[]} rules */
115
73
  export function partOfPick(check: Record<string, any>, text: string, rules: number[]): {
116
74
  rules: number[];
@@ -118,63 +76,6 @@ export function partOfPick(check: Record<string, any>, text: string, rules: numb
118
76
  class: string;
119
77
  check: any;
120
78
  };
121
- /**
122
- * Put the person's picks into the drafted declaration (a pure function; the input is untouched): on every rubric-step stage of a line this call settles, the drafter's own
123
- * word/section/line/list/phrase checks are gone (the drafter writes none, whatever it sent), a part per picked check is added carrying the `~` rule numbers it settles, and every
124
- * other settled rule goes under Not checked (`refused` with a rule number and the reason). A rule a fact or guard part of the draft already carries is left to that part.
125
- * With no picks settled (`null`) it only drops a `picks` record the drafter sent.
126
- * @param {any} declaration @param {ReturnType<typeof settleRules>|null} settled @returns {any}
127
- */
128
- export function applyPicks(declaration: any, settled: ReturnType<typeof settleRules> | null): any;
129
- /**
130
- * RUBRIC jobs only (the caller gates on the job's lang; anything else is returned untouched, its reds stand). Two small, mechanical steps on every rubric-step stage, run
131
- * before validation (hamr's ruling 2026-11-09):
132
- * F1 source fill: when the job has EXACTLY ONE input label, a `fact` part, or a `cited` part, whose `source` is missing or empty gets that label. With 2+ labels nothing is filled; a
133
- * wrong non-empty source is never rewritten (its red stands).
134
- * F2 fact merge: when ONE stage holds 2+ `fact` parts they become ONE fact part (where the first stood): the `facts` of all in order, the union of `rules` and of `covers`, the one shared
135
- * `source`, the `text`s joined with "; ". Only when it is safe, else the parts stay and the existing second-fact-list red fires: the sources differ (after F1), two facts share a name
136
- * (compared white-space and case blind), the parts' `count`s differ (a part with no count agrees with any; the merged part carries the one count), a part is not a plain object or has a
137
- * field a fact part does not carry, or `facts` is not a list.
138
- * Runs AFTER applyPicks (its strip of a count that restates a pick has already happened). Pure.
139
- * @param {any} declaration @param {string[]|null|undefined} inputLabels the labels of the job's inputs @param {boolean} rubric the draft gate's `lang === RUBRIC_LANG` @returns {any}
140
- */
141
- export function fillAndMergeFacts(declaration: any, inputLabels: string[] | null | undefined, rubric: boolean): any;
142
- /**
143
- * RETENTION record of one rubric draft (PRD v1.131 tick 7; record only). Per job line: `aiParts` = what the drafter wrote on it that is the AI's own check or extra (a fact counts once per
144
- * fact it lists, a `cited` part, a part code later moves as `none` / `judged`; guards and the drafter's own count checks are not counted, the picks strip those), `kept` = how many of
145
- * those are still in the final declaration, `dropped` = what code removed (the move to Not checked, the drop after the last try), `picks` = the line has code-matched count picks. A merge
146
- * of fact parts keeps every fact, so it drops nothing. Pure; no words, only counts.
147
- * @param {any} drafted the declaration as the drafter sent it @param {any} final the declaration the draft ended with @param {any[]|null|undefined} jobLines
148
- * @returns {{line: number, aiParts: number, kept: number, dropped: number, picks: boolean}[]}
149
- */
150
- export function retentionOf(drafted: any, final: any, jobLines: any[] | null | undefined): {
151
- line: number;
152
- aiParts: number;
153
- kept: number;
154
- dropped: number;
155
- picks: boolean;
156
- }[];
157
- /**
158
- * RUBRIC jobs only, run ONLY after the LAST try failed the gate (PRD v1.131 tick 4, hamr's ruling 2026-11-09). When EVERY red points at one part of a rubric-step stage and that part is not
159
- * a code-matched pick (a part in `declaration.picks`) nor code-owned (a guard, `numbersFromFacts`), the AI's parts those reds name are dropped and listed under Not checked: a pure extra as a
160
- * note with its words, a part that served a `~` rule as a `refused` entry for each rule no surviving part carries (rule numbers outside the line's rules are ignored, as moveUncheckable does).
161
- * Any red on a pick / code-owned part, or any red not tied to one part, returns `{refused}` and the plan is refused as today. Pure.
162
- * @param {any} declaration the declaration as the gate validated it @param {{path?: string, code?: string}[]} reds @param {any[]|null|undefined} jobLines
163
- * @returns {{declaration: any, dropped: {line: number, words: string, rules: number[]}[]}|{refused: string}}
164
- */
165
- export function dropExtras(declaration: any, reds: {
166
- path?: string;
167
- code?: string;
168
- }[], jobLines: any[] | null | undefined): {
169
- declaration: any;
170
- dropped: {
171
- line: number;
172
- words: string;
173
- rules: number[];
174
- }[];
175
- } | {
176
- refused: string;
177
- };
178
79
  /** the one tool the suggestion call uses */
179
80
  export const SUGGEST_TOOL: "suggest_checks";
180
81
  export function isCountable(g: unknown): boolean;
@@ -185,6 +86,7 @@ export function hasRoutingInput(inputs: {
185
86
  export function codeScope(inputs: {
186
87
  value?: string;
187
88
  }[] | null | undefined, g: string): "in" | "out";
89
+ export function sameRuleWords(a: unknown, b: unknown): boolean;
188
90
  export const SUGGEST_SYSTEM: string;
189
91
  /** the tool's parameter schema: one `anyOf` variant per offered rule, plus `none` */
190
92
  export const SUGGEST_SCHEMA: Readonly<{
@@ -252,46 +154,12 @@ export function suggestChannel(): {
252
154
  };
253
155
  /** the can't-check ask, as the signed words say it */
254
156
  export const CANT_CHECK_WORDS: "I can't check this. Your own words, or Not checked?";
255
- /**
256
- * @typedef {{line: number, rule: number, check: Record<string, any>|null, added?: string, own?: boolean, kept?: boolean}} Pick
257
- * `check` = the check the person agreed to (null for their own words); `added` = the `~` rule the answer wrote on the line; `own` = their own words
258
- * @typedef {'person-left'|'own-words'|'no-pick'} NoteReason
259
- */
260
- /** the one table of Not checked reasons, in the person's words (fwd src/pagedropwords.js, adapted) @type {Record<NoteReason, string>} */
261
- export const NOTE_WORDS: Record<NoteReason, string>;
262
- /** the reason a part the drafter could not express as a check is listed under Not checked (fwd's am16: the drafter writes no check of its own, what no rule can check is the person's to judge) */
263
- export const UNCHECKABLE_WORDS: "No rule can check this, so you judge it at Accept.";
264
- /** the reason a dropped AI extra is listed under Not checked */
265
- export const DROPPED_WORDS: "The AI couldn't build a working check for this, so you judge it at Accept.";
157
+ export function HOW_TO_ANSWER(line: number, agree: boolean): string;
266
158
  export type Rule = {
267
159
  line: number;
268
160
  rule: number;
269
161
  text: string;
270
162
  };
271
- export type PickAsk = {
272
- line: number;
273
- rule: number;
274
- source: "look";
275
- ask: "check" | "no-check";
276
- ruleText: string;
277
- question: string;
278
- reading?: string;
279
- check?: Record<string, any>;
280
- counted: boolean;
281
- pairRule?: number;
282
- };
283
- /**
284
- * `check` = the check the person agreed to (null for their own words); `added` = the `~` rule the answer wrote on the line; `own` = their own words
285
- */
286
- export type Pick = {
287
- line: number;
288
- rule: number;
289
- check: Record<string, any> | null;
290
- added?: string;
291
- own?: boolean;
292
- kept?: boolean;
293
- };
294
- export type NoteReason = "person-left" | "own-words" | "no-pick";
295
163
  import { plainWords } from './checkwords.js';
296
164
  import { OFFERED } from './checkwords.js';
297
165
  export { plainWords, OFFERED };
package/types/cli.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * code, so `bin/bareloop.mjs` can set `process.exitCode` and let node flush
4
4
  * queued stdout on its own (F-something: `process.exit()` can discard it).
5
5
  * @param {string[]} argv
6
- * @param {{ env?: Record<string,string|undefined>, stdout?: any, stderr?: any, cwd?: string, provider?: any, providerFor?: any, judgeProvider?: any, judgeModel?: string|null, now?: () => number, stdin?: any, interactive?: boolean, runlistHome?: string, keysHome?: string, processEnv?: Record<string,string|undefined> }} deps
6
+ * @param {{ env?: Record<string,string|undefined>, stdout?: any, stderr?: any, cwd?: string, provider?: any, providerFor?: any, now?: () => number, stdin?: any, interactive?: boolean, runlistHome?: string, keysHome?: string, processEnv?: Record<string,string|undefined> }} deps
7
7
  * @returns {Promise<number>}
8
8
  */
9
9
  export function main(argv: string[], deps?: {
@@ -13,8 +13,6 @@ export function main(argv: string[], deps?: {
13
13
  cwd?: string;
14
14
  provider?: any;
15
15
  providerFor?: any;
16
- judgeProvider?: any;
17
- judgeModel?: string | null;
18
16
  now?: () => number;
19
17
  stdin?: any;
20
18
  interactive?: boolean;
@@ -7,15 +7,6 @@ export function isDeclaredClose(job: any): boolean;
7
7
  * `offer` and `needs` pass through untouched when a declaration carries them
8
8
  * (v1's schema does not let one), so `checkMenu`'s derivation is unchanged.
9
9
  *
10
- * THE JUDGE TIER RIDES ALONG, and it rides as a STAMP for the same reason `offer`
11
- * does. The tier that graded this close's calibration set is a CLOSE-level fact
12
- * (`calibration.judgeModel`), and the stage that would buy a judge call is a STAGE;
13
- * `runStage` is handed stages and never the declaration they came out of. Rather than
14
- * plumb a second close-level channel down through every executor seam, the one place
15
- * that already turns a declaration into stages carries it across — and it carries it
16
- * from the SIGNED bytes, so a stage can never name a tier the signature does not.
17
- * `runJudgedFloor` refuses a mismatch; the absence of a stamp is the SPEC gate's
18
- * business (`validateCloseDecl` reds a set with no model), never a runtime fall-back.
19
10
  * @param {any} closeDecl
20
11
  * @returns {any[]|null} null when this is not a declaration
21
12
  */
@@ -53,7 +44,7 @@ export function declaredStages(closeDecl: any): any[] | null;
53
44
  *
54
45
  * @param {any} closeDecl
55
46
  * @param {{at?: string, listing?: string[]|null, deferListing?: boolean,
56
- * catalogue?: Record<string, any>, verdictType?: string|null, writeScope?: string[]|null, jobLines?: {n: number}[]|null,
47
+ * catalogue?: Record<string, any>, verdictType?: string|null, jobLines?: {n: number}[]|null,
57
48
  * inputLabels?: string[]|null}} [opts]
58
49
  * @returns {{ok: boolean, reds: Red[], closeDecl: any, grounded: boolean,
59
50
  * scoped: {scoped: boolean, via: string|null},
@@ -65,7 +56,6 @@ export function validateCloseDecl(closeDecl: any, opts?: {
65
56
  deferListing?: boolean;
66
57
  catalogue?: Record<string, any>;
67
58
  verdictType?: string | null;
68
- writeScope?: string[] | null;
69
59
  jobLines?: {
70
60
  n: number;
71
61
  }[] | null;
@@ -115,11 +105,7 @@ export function guardNames(closeDecl: any, verdictType: string): string[];
115
105
  * @param {{timeoutMs?: number, cwd?: string, seedRef?: string,
116
106
  * seedTrees?: any, gapCap?: number, maxBuffer?: number, baselineMode?: 'auto'|'worktree',
117
107
  * humanRuling?: {decision: string, text?: string|null}|null,
118
- * judgeLoop?: ((o: {system: string}) => any)|null,
119
- * judgeModel?: string|null,
120
- * onJudgeCost?: ((c: any) => void)|null,
121
- * onRubricEvidence?: ((e: any) => void)|null,
122
- * callBounds?: (() => {timeoutMs?: number, deadlineMs?: number})|null}} [opts]
108
+ * onRubricEvidence?: ((e: any) => void)|null}} [opts]
123
109
  * @returns {Promise<any>}
124
110
  */
125
111
  export function runDeclaredStages(stages: any[], redact?: (s: string) => string, opts?: {
@@ -134,16 +120,7 @@ export function runDeclaredStages(stages: any[], redact?: (s: string) => string,
134
120
  decision: string;
135
121
  text?: string | null;
136
122
  } | null;
137
- judgeLoop?: ((o: {
138
- system: string;
139
- }) => any) | null;
140
- judgeModel?: string | null;
141
- onJudgeCost?: ((c: any) => void) | null;
142
123
  onRubricEvidence?: ((e: any) => void) | null;
143
- callBounds?: (() => {
144
- timeoutMs?: number;
145
- deadlineMs?: number;
146
- }) | null;
147
124
  }): Promise<any>;
148
125
  /**
149
126
  * The trend reader's input for ONE close verdict, whichever executor produced
@@ -186,12 +163,10 @@ export const DECLARED_GENRES: readonly string[];
186
163
  * channel of its own.
187
164
  */
188
165
  export const CLOSE_DECL_FIELDS: readonly string[];
189
- /** what a stored calibration set carries, ENUMERATED: the frozen cases and the judge
190
- * tier that graded them. Both are inside the spec, so `jobSpecHash` covers both — which
191
- * is the whole mechanism behind "a judge-model bump forces a full recalibration"
192
- * (src/judged.js, `resolveJudge`): the field moves, the hash moves, the signature dies,
193
- * and the re-sign re-runs the gate. Anything else in there is a field nobody reads. */
194
- export const CALIBRATION_FIELDS: readonly string[];
166
+ /** the fields of a row of the one check list that the signed close carries (`closeDecl.list`); the row's own words are never signed */
167
+ export const SIGNED_ROW_FIELDS: readonly string[];
168
+ /** the states a signed row may end in */
169
+ export const SIGNED_STATES: readonly string[];
195
170
  /**
196
171
  * The prefix M1 puts on EVERY gap line of a declared stage (its `ctx.gapKeep`).
197
172
  * A literal, so the anchored pattern below is exact.
@@ -253,8 +228,7 @@ export const HUMAN_CHECKPOINTS: readonly string[];
253
228
  *
254
229
  * `hard` is by CONSTRUCTION: every mechanical kind is a command whose measurement
255
230
  * is the truth. `hitl` joined it at N4 slice 1, and `soft` at softgreen module 3
256
- * — each only because its kind is genuinely LIVE (`human-confirms`, then
257
- * `judged-floor`): the widening and the kind go in one commit, or this table
231
+ * — each only because its kind is genuinely LIVE (`human-confirms`): the widening and the kind go in one commit, or this table
258
232
  * admits a class the executor cannot render.
259
233
  *
260
234
  * `hitl` STAYS despite the class's retirement (PRD v1.71: the human stage moved
@@ -79,6 +79,8 @@ export function runDestPoint({ jobLines, files, destination, provider, maxTokens
79
79
  export const DEST_CALL_LABEL: "dest-point";
80
80
  export const DEST_SYSTEM: "You read the numbered lines of a code job. You never invent words: every file path you name must be copied, character for character, from the job line that holds it.";
81
81
  export function destQuestionText(p: DestPoint, destination: string): string;
82
+ /** the answer words the question ends with (said once, here; the panel's question box shows the question without them and has the buttons instead) */
83
+ export const DEST_ANSWER: " Type yes to set it, or no to keep it as it is.";
82
84
  export function yesNoOf(text: unknown): "yes" | "no" | null;
83
85
  export type DestPoint = {
84
86
  line: number;
@@ -104,6 +104,27 @@ export function readDraftChecks(dir: string): {
104
104
  text: string;
105
105
  by: "agent" | "you";
106
106
  }[];
107
+ /**
108
+ * The suggested checks code could not build, one plain sentence each (the last `draft-notbuilt` line of the log): the Audit's draft lines. `[]` when there are none.
109
+ * @param {string} dir
110
+ * @returns {{line: number, text: string}[]}
111
+ */
112
+ export function readDraftNotBuilt(dir: string): {
113
+ line: number;
114
+ text: string;
115
+ }[];
116
+ /**
117
+ * The check list's rows as the drafting ended (draft log `ledger` rows of phase `final`, the last one per key): each row's own words, so the Job tab can name a
118
+ * Not checked row in the person's words. `null` when the session has no readable log or no final row (a CLI run, an imported run, a deleted session). Never throws.
119
+ * @param {string} dir
120
+ * @returns {{key: string, rowKind: string, words: string[], state: string}[]|null}
121
+ */
122
+ export function readDraftLedger(dir: string): {
123
+ key: string;
124
+ rowKind: string;
125
+ words: string[];
126
+ state: string;
127
+ }[] | null;
107
128
  /**
108
129
  * The DRAFTING PART of a run (hamr 2026-10-06, option A): the first part of the run's views, built from the session's
109
130
  * drafting log. `null` when the run did not come out of a panel session, or the log carries no metered call (a Reuse
package/types/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { makeSpine } from "./spine.js";
2
2
  export { runPlan } from "./planrun.js";
3
3
  export { workBranchName } from "./workbranch.js";
4
4
  export { answerReviewDoor } from "./reviewdoor.js";
5
+ export { resolveJudge } from "./judged.js";
5
6
  export { main as cliMain } from "./cli.js";
6
7
  export { ralph, runClose, runStages, CLOSE_FAULTS } from "./ralph.js";
7
8
  export { globToPrefix, scanSecrets } from "./validate.js";
@@ -14,10 +15,7 @@ export { renderListing, selectionPrompt } from "./selection.js";
14
15
  export { validateEnvelope, resolveTrySpec, resolveReuse, reuseSpecHash, selectBridge, runReuse, REUSE_GRADED_RED, readResume, resumeTreeGate, CHECKPOINT_OUTCOMES, PAUSE_TTL_MS, checkpointAgeGate, applyDoorDecision, writeRunGreenRow } from "./reuse.js";
15
16
  export { classifyIncidents, foldLedger, ledgerDeltas, updateLedger, LEDGER_CLASSES, VOUCHED_RATE_SOURCES, rateProvenance, spendProvenance } from "./ledger.js";
16
17
  export { readShimArm, READ_SHIM_CAP, READ_SHIM_STRATEGY, READ_SHIM_DIFF_STRATEGY } from "./readshim.js";
17
- export { runDeclaredClose, runStage, seedRead, seedAtHead, LIVE_KINDS, STOP_FAULTS, JUDGED_MARKER, HUMAN_DECISIONS, SEED_EXEMPT_KINDS, normalizeHumanRuling, resolveHumanRuling, JUDGE_ATTEMPTS, MAX_JUDGED_PATHS, DOOR_OPEN_OUTCOMES, REVIEW_DOOR_CLASSES, doorOpens, mechanicalStages } from "./kinds.js";
18
- export { resolveJudge, JUDGE_RULES, JUDGE_RULE_IDS, runLocate, decide, CALIBRATION_SIZE, validateCalibrationSet, expectedOf } from "./judged.js";
19
- export { proposeJudgedArtifacts, signJudgedArtifacts, foldJudgedArtifacts } from "./cardauthor.js";
20
- export { runCalibration, INJECTION_LOCATE_BATTERY, CASUALTY_AXES } from "./calibrate.js";
18
+ export { runDeclaredClose, runStage, seedRead, seedAtHead, LIVE_KINDS, STOP_FAULTS, JUDGED_MARKER, HUMAN_DECISIONS, SEED_EXEMPT_KINDS, normalizeHumanRuling, resolveHumanRuling, DOOR_OPEN_OUTCOMES, REVIEW_DOOR_CLASSES, doorOpens, mechanicalStages } from "./kinds.js";
21
19
  export { validateDeclaration, KIND_CATALOGUE, LOCKED_KINDS, genreEnv, genreInstruments, LOCKED_CLASSES, CLASS_BATTERIES, classGuards, closeCeiling, NEVER_OFFERED_KINDS } from "./authoring.js";
22
20
  export { runAuthorScout, buildSeedListing, AUTHOR_SCOUT_VERBS, SCOUT_ATTEMPTS, SCOUT_RETRY_CAUSES } from "./authorscout.js";
23
21
  export { scrubRaw, RAW_PERSIST_MAX } from "./text.js";
package/types/job.d.ts CHANGED
@@ -30,6 +30,12 @@ export function validateBaseUrl(value: unknown): string | null;
30
30
  * @param {Record<string, any>} spec @returns {'plain'|'mcp'|'tickets'}
31
31
  */
32
32
  export function flowTypeOf(spec: Record<string, any>): "plain" | "mcp" | "tickets";
33
+ /**
34
+ * Is this signed spec an OLD job: one that carries a `judged-floor` stage (the old judge) or a job line with a `PASS:` / `FAIL:` rule (the old examples)?
35
+ * ONE reader for every door that takes a signed spec back in (Reuse, a scheduled fire, an exported bundle).
36
+ * @param {Record<string, any>} spec @returns {string|null} the plain refusal, or null when the spec is not an old job
37
+ */
38
+ export function oldJobWords(spec: Record<string, any>): string | null;
33
39
  /**
34
40
  * Validate an operator-owned job spec (`schema: "job-v1"`). Never throws on
35
41
  * JSON text or plain parsed data — the ingest contract; a live object with a
@@ -284,6 +290,8 @@ export const FLOW_TYPE_LABELS: Readonly<{
284
290
  mcp: "MCP";
285
291
  tickets: "Tickets MCP";
286
292
  }>;
293
+ /** hamr 2026-11-14 (rubric vs deterministic split, piece 6): the words for a job made with PASS/FAIL examples or the old judge, which are gone. Old runs are not repaired. */
294
+ export const OLD_JOB_WORDS: "This job was made with PASS/FAIL examples or the old judge, which are gone. Draft it fresh.";
287
295
  /**
288
296
  * The fields a "Reuse workflow" run may change: where the work lands (the write fence, `writeScope`, and a
289
297
  * `destination`/`source` where a spec ever carries them), the `inputs` the person pointed at (P7: Inputs is open on a reuse) and the two ceilings. Everything else in a signed spec is
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * Parse "The job" box. A plain line is a numbered job line (1, 2, 3...). A line starting `~` has no number and belongs
3
3
  * to the numbered line above; consecutive `~` lines become ONE rule joined with `'; '`. A `~` line starting `PASS:` or
4
- * `FAIL:` is also a judge example (kept with its line number); any other `~` line is a guardrail. Empty lines are
5
- * ignored. A `~` before line 1 is a red.
4
+ * `FAIL:` is a red ({@link PASS_FAIL_GONE_WORDS}). Empty lines are ignored. A `~` before line 1 is a red.
6
5
  * @param {unknown} text the box's raw text
7
6
  * @returns {{ok: true, lines: JobLine[]}|{ok: false, error: string}}
8
7
  */
@@ -44,13 +43,6 @@ export function jobBoxText(lines: {
44
43
  text: string;
45
44
  rules: string[];
46
45
  }[]): string;
47
- /**
48
- * The PASS:/FAIL: examples the person wrote, each kept with its line number (answer 2 of a rubric interview — what the
49
- * calibration compile reads). Empty string when there are none.
50
- * @param {JobLine[]} lines
51
- * @returns {string}
52
- */
53
- export function renderExamples(lines: JobLine[]): string;
54
46
  /**
55
47
  * The inputs as the drafter is told about them: "the person pointed at these inputs: N label path".
56
48
  * @param {JobInput[]} inputs
@@ -58,24 +50,7 @@ export function renderExamples(lines: JobLine[]): string;
58
50
  */
59
51
  export function renderInputs(inputs: JobInput[]): string;
60
52
  /**
61
- * The two cross-checks between a parsed job block and the Check type: a RUBRIC job needs at least one `PASS:` and one
62
- * `FAIL:` example (the calibration compile reads them); a DETERMINISTIC job has no judge, so an example line would be
63
- * silently dropped — a red instead.
64
- * PART 1a (hamr's ruling P1=B, docs/product/ITEM33-BUILD.md "Addendum 2026-10-12"): the examples are required of a rubric
65
- * job ONLY when it holds a judged part. A rubric job on the person's own local files holds none in this build (its
66
- * parts are counted or checked against a quote), so the caller says `judged: false` and a block without examples fits.
67
- * Examples written anyway are never a red there — they simply have no judge to read them yet.
68
- * @param {JobLine[]} lines
69
- * @param {boolean} rubric
70
- * @param {{judged?: boolean}} [o] `judged` (default true): does this job hold a judged part, so that it needs examples?
71
- * @returns {string|null} the plain red, or null when the block fits the Check type
72
- */
73
- export function jobBlockFitsCheck(lines: JobLine[], rubric: boolean, { judged }?: {
74
- judged?: boolean;
75
- }): string | null;
76
- /**
77
- * The signed `jobLines` field from parsed lines: the person's own words, `{n, text, rule, rules}` (examples stay inside the
78
- * rule text, where the person wrote them). `rules` is the same `~` lines as an array, BESIDE the joined `rule` (never
53
+ * The signed `jobLines` field from parsed lines: the person's own words, `{n, text, rule, rules}`. `rules` is the same `~` lines as an array, BESIDE the joined `rule` (never
79
54
  * replacing it); it is omitted on a line with no `~` line, and an older spec lacks it entirely.
80
55
  * @param {JobLine[]} lines
81
56
  * @returns {{n: number, text: string, rule: string, rules?: string[]}[]}
@@ -86,27 +61,22 @@ export function signedJobLines(lines: JobLine[]): {
86
61
  rule: string;
87
62
  rules?: string[];
88
63
  }[];
89
- /** @typedef {{verdict: 'PASS'|'FAIL', text: string}} JobExample a `~ PASS:` / `~ FAIL:` line (rubric only), kept with its job line */
90
- /** @typedef {{n: number, text: string, rule: string, rules: string[], examples: JobExample[]}} JobLine one numbered job line; `rule` = its `~` lines joined with '; ' ('' when none), `rules` = those same `~` lines one by one (so an example's own '; ' survives) */
64
+ /** @typedef {{n: number, text: string, rule: string, rules: string[]}} JobLine one numbered job line; `rule` = its `~` lines joined with '; ' ('' when none), `rules` = those same `~` lines one by one */
91
65
  /** @typedef {{n: number, label: string, value: string}} JobInput one numbered `label: value` input line */
66
+ /** hamr 2026-11-14: Rubric on a repo is allowed ONLY for a Tickets job; any other repo + rubric start is refused at $0 in these words */
67
+ export const REPO_RUBRIC_WORDS: "A repo job uses a Deterministic check.";
92
68
  /** the joiner for consecutive `~` lines (fwd's joinGuardrails) */
93
69
  export const RULE_JOINER: "; ";
70
+ /** hamr 2026-11-14: a `~ PASS:` / `~ FAIL:` line is refused at $0; the check list (`~` rules, Drop and Add) covers what the examples did */
71
+ export const PASS_FAIL_GONE_WORDS: "PASS/FAIL examples are gone \u2014 write what you want as a ~ rule.";
94
72
  /**
95
- * a `~ PASS:` / `~ FAIL:` line (rubric only), kept with its job line
96
- */
97
- export type JobExample = {
98
- verdict: "PASS" | "FAIL";
99
- text: string;
100
- };
101
- /**
102
- * one numbered job line; `rule` = its `~` lines joined with '; ' ('' when none), `rules` = those same `~` lines one by one (so an example's own '; ' survives)
73
+ * one numbered job line; `rule` = its `~` lines joined with '; ' ('' when none), `rules` = those same `~` lines one by one
103
74
  */
104
75
  export type JobLine = {
105
76
  n: number;
106
77
  text: string;
107
78
  rule: string;
108
79
  rules: string[];
109
- examples: JobExample[];
110
80
  };
111
81
  /**
112
82
  * one numbered `label: value` input line