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
package/src/run.js CHANGED
@@ -100,19 +100,6 @@ async function primitiveSmoke(workdir) {
100
100
  * (`ratesFor`, src/providerrows.js — USD per 1K tokens), resolved once by the door and handed to every
101
101
  * worker/planner Loop as bare-agent's `rates` (rounds then read `rateSource:'caller'`). Absent = the
102
102
  * built-in guess, exactly as before. A Loop-driven provider only: a native session reports its own cost.
103
- * @param {{in: number, out: number}|null} [opts.judgeRates] the same, for the judge's own key row
104
- * @param {string|null} [opts.judgeModel] SOFTGREEN — WHICH model the judge provider drives
105
- * (PRD item 32.1), resolved by the CALLER (`resolveJudge`, src/judged.js) and passed
106
- * through untouched. Travels with `judgeProvider`; absent, a judged stage stops as a
107
- * wiring gap rather than grading under an identity nobody named.
108
- * @param {any} [opts.judgeProvider] SOFTGREEN — the provider a JUDGED close stage runs its
109
- * locate call through, built by the CALLER from the RESOLVED judge identity (PRD item
110
- * 32.1: `resolveJudge`/`resolveJobJudge`, src/judged.js — the spec's signed `judge`
111
- * override, else the job's own worker provider and model), never pinned. Forwarded to the plan
112
- * flow. It is its own seam and not `provider`/`providerFor`, because the judge tier is
113
- * never a step knob and never agent-selectable; absent, a judged stage instrument-stops as
114
- * a wiring gap rather than grading on whatever binding happened to be at hand. Its spend
115
- * lands on this ledger as `judge-round` (see `ACCOUNTED_ROUND_TYPES`).
116
103
  * @param {Record<string, string>|null} [opts.placeValues] PLACE RULES (src/placerule.js): the values this run's start read for the spec's place-rule facts, by key. Bound
117
104
  * as those facts' phrases on the run's own in-memory copy AFTER the approval check and the `job-start` record, so the hash checked and the hash recorded stay the
118
105
  * SIGNED one and the signed spec is never changed; the planner and the close read the copy. Absent = the signed words.
@@ -285,7 +272,7 @@ async function primitiveSmoke(workdir) {
285
272
  * deliberately NOT in the resumable/checkpoint set (`src/reuse.js`) — an
286
273
  * unknown in-flight state is not a known-safe resume point.
287
274
  */
288
- export async function runJob(rawSpec, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider = null, judgeModel = null, rates = null, judgeRates = null, emit, capRuns = 3, strikeLimit, shellCapUsd = 2, closeTimeoutMs, closeDir = null, layerRoot = false, readShim = false, scout = true, bridge = null, draftSpentUsd = 0, draftSpendComplete = true, priorSpentUsd = 0, priorSpendComplete = true, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null, ticketRecord = null, ticketUnsure = null, prRecord = null, placeValues = null, placeRead = null }) {
275
+ export async function runJob(rawSpec, { approvals, workdir, provider, nativeProvider, providerFor, rates = null, emit, capRuns = 3, strikeLimit, shellCapUsd = 2, closeTimeoutMs, closeDir = null, layerRoot = false, readShim = false, scout = true, bridge = null, draftSpentUsd = 0, draftSpendComplete = true, priorSpentUsd = 0, priorSpendComplete = true, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null, ticketRecord = null, ticketUnsure = null, prRecord = null, placeValues = null, placeRead = null }) {
289
276
  // THE READ SHIM's ARM, resolved at the door — the FIRST thing this entry does,
290
277
  // before the ledger, before the approval gate, before a byte of the spec is read.
291
278
  // An unrecognised spelling throws here at zero cost instead of being coerced by
@@ -559,7 +546,7 @@ export async function runJob(rawSpec, { approvals, workdir, provider, nativeProv
559
546
  // accounts it natively (F12) and the job-end money contract is unchanged.
560
547
  {
561
548
  const outcome = await runPlan(job, {
562
- workdir, provider, nativeProvider, providerFor, judgeProvider, judgeModel, rates, judgeRates, emit: meter, capRuns, ...(strikeLimit !== undefined ? { strikeLimit } : {}), closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, priorWallMs: chainWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, priorSpentUsd: chainFoldUsd, resumable, stopFile, learnHints,
549
+ workdir, provider, nativeProvider, providerFor, rates, emit: meter, capRuns, ...(strikeLimit !== undefined ? { strikeLimit } : {}), closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, priorWallMs: chainWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, priorSpentUsd: chainFoldUsd, resumable, stopFile, learnHints,
563
550
  // hamr's ruling 2026-09-28 — ONE cap covers drafting + run: the run's
564
551
  // enforced ceiling is the signed `budgetUsd` (unchanged, still in the
565
552
  // spec hash) MINUS whatever drafting already spent on this job before
package/src/stagewords.js CHANGED
@@ -152,3 +152,27 @@ export function stageQuestionsByName(spec) {
152
152
  }
153
153
  return out;
154
154
  }
155
+
156
+ /**
157
+ * The plain question of the `$ [default]` write-fence row, built from the signed fence itself: `src/**` reads `src/`; an entry that is a glob this cannot read as a folder or file is quoted as it was signed.
158
+ * @param {string[]} scope @returns {string}
159
+ */
160
+ export function fenceQuestionText(scope) {
161
+ const places = scope.map((e) => {
162
+ const folder = /^(.+?)\/\*\*?$/.exec(e);
163
+ const base = folder ? `${folder[1]}/` : e;
164
+ return /[*?[\]{}]/.test(base) ? e : base;
165
+ });
166
+ return `only files in ${places.join(', ')} changed?`;
167
+ }
168
+
169
+ /**
170
+ * The plain question of a job-level `$ [default]` guard row (the one list's guard rows, by guard NAME) — the one owner the plan card, Job tab, Audit, Result and the CLI print read, in place of the guard's raw name and its
171
+ * long frozen sentence (GUARD_DESCRIPTIONS stays the older confirm-turn "protections" line). `null` for a guard with no line here: the caller keeps the old words, never an invented question.
172
+ * @param {string} name @returns {string|null}
173
+ */
174
+ export function guardQuestionText(name) {
175
+ if (name === 'changed-from-seed') return 'did the run change a file?';
176
+ if (name === 'no-suppressions') return 'no checker silenced (@ts-ignore, eslint-disable, # type: ignore)?';
177
+ return null;
178
+ }
package/src/userrun.js CHANGED
@@ -32,7 +32,7 @@ import { commitWork, removeWorktree, removePrRef } from './worktree.js';
32
32
  import { moveFile } from './movefile.js';
33
33
  import { runJob } from './run.js';
34
34
  import { moneyWithDraft } from './replay.js';
35
- import { jobSpecHash, resolveWorkerModel, validateJob, workflowKey, flowTypeOf } from './job.js';
35
+ import { jobSpecHash, resolveWorkerModel, validateJob, workflowKey, flowTypeOf, oldJobWords } from './job.js';
36
36
  import { ticketNumberOf, TICKET_NUMBER_WORDS } from './ticketshape.js';
37
37
  import { freezeRepoTicket } from './ticketrepo.js';
38
38
  import { newestUnrunTicket } from './ticketnext.js';
@@ -54,25 +54,12 @@ import { readSourceManifest, frontDoorFromManifest, proveDestination, copyOut, r
54
54
  import { scanSecrets, redactSecrets } from './validate.js';
55
55
  import { runBehaviour, formatBehaviour } from './behaviour.js';
56
56
  // the three doors' SEMANTICS live in the library; this script surfaces them
57
- import { normalizeHumanRuling, resolveHumanRuling, closeJudges, judgedStages } from './kinds.js';
58
- // SOFTGREEN — the judged stage's PINNED tier. The constant is the library's; a
59
- // spelling here would be a second pin that can drift from the one the gate calibrated.
60
- import { resolveJudge } from './judged.js';
57
+ import { normalizeHumanRuling, resolveHumanRuling } from './kinds.js';
61
58
  // --resume reads the halted run's own spine back through the SAME reader the reuse
62
59
  // path uses (never a second one) and keeps its patient the way it left it.
63
60
  import { readResume, resumeTreeGate, checkpointAgeGate, writeRunGreenRow, CHECKPOINT_OUTCOMES, PAUSE_TTL_MS } from './reuse.js';
64
- // PRD item 28's provider factory (src/providers.js): the WORKER provider's
65
- // ctor/param-gating come from here now (its key variable and price come from the
66
- // Settings row, src/providerrows.js) — one seam instead
67
- // of an `if (provider === …)` scattered across this script. PRD item 32.2
68
- // moved the JUDGE onto this SAME factory: it used to be separately pinned
69
- // below to a hardcoded Anthropic constructor at the judged tier because the
70
- // judge could only ever be Claude — now that its identity is RESOLVED
71
- // (`resolveJudge`, imported above) rather than pinned, building it through a
72
- // second bespoke constructor would be a second seam for the same job the
73
- // worker's already goes through. `tests/reviewdoor-u.test.js` greps this
74
- // file's own source to prove THIS runner actually wires the resolved judge
75
- // through `makeProvider` into `runJob` (not just that the library can).
61
+ // PRD item 28's provider factory (src/providers.js): the WORKER provider's ctor/param-gating come from here (its key variable and price come from the
62
+ // Settings row, src/providerrows.js) — one seam instead of an `if (provider === …)` scattered across this script.
76
63
  import { resolveProvider, makeProvider, probeWarningLines, apiKeyProblem } from './providers.js';
77
64
  import { loadRegistry, quarantinesCredit } from './bridges.js';
78
65
  import { HITL_PAUSE } from './declaredclose.js';
@@ -92,7 +79,7 @@ import { claimRun, monthlyRefusalText, legSpend, chainSpend } from './monthly.js
92
79
  import { ConfigError } from './config.js';
93
80
  import { learnAtRunEnd, handedHints, releaseRun } from './learnstore.js';
94
81
  import { commandFor } from './invoke.js';
95
- import { judgeRatesFor, keyNameFor, keyValueOf, priceReadout, ratesFor, ratesOfLine, resolveWorker, judgeRowFor, rowsForHome, REFUSE_NAME_MODEL } from './providerrows.js';
82
+ import { keyNameFor, keyValueOf, priceReadout, ratesFor, ratesOfLine, resolveWorker, rowsForHome, REFUSE_NAME_MODEL } from './providerrows.js';
96
83
  // the banner's wall arithmetic, extracted so it is reachable by a test (F83): the
97
84
  // end-of-run readout sits past the approval gate, so nothing could ever drive it here
98
85
  import { wallLine, doomedResume, deathAtOf, evidencePackage, doorLines, resumeAtLines, reviewDoorPackage, runDoorLines, tokensLine, doorTimingRedLines } from './u-readout.js';
@@ -247,7 +234,6 @@ class ExitSignal extends Error {
247
234
  * check entirely, the same shape `src/cli.js`'s `main(argv, deps)` uses.
248
235
  * @property {(tier: string) => any} [providerFor]
249
236
  * @property {(url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>} [fetchUrl] PART 1c - a test seam: how a web input is read at run start (production: barebrowse)
250
- * @property {any} [judgeProvider]
251
237
  * @property {typeof newestUnrunTicket} [newestUnrunTicket] R6 - a test seam: how a Tickets run that names no `--ticket` finds the newest unrun ticket (production: the real look, src/ticketnext.js)
252
238
  * @property {string} [mcpConfig] R6 - a test seam: the MCP config file that look reads (production: the person's own, found by src/mcpsources.js)
253
239
  * @property {string} [runlistHome] F196 — a test seam for `appendRun`'s
@@ -529,9 +515,7 @@ async function execute(ctx) {
529
515
  // MODEL (build-list #3, hamr's GO 2026-08-30): the signed spec's `model`, if
530
516
  // present, wins outright; a --model flag naming a DIFFERENT id is refused
531
517
  // (never silently overridden) — resolveWorkerModel is the one decision, pure
532
- // and tested apart from this script. The JUDGE's model is resolved separately
533
- // (`resolveJudge`, below the key block): it defaults to this same resolved
534
- // worker model and a signed `judge` override wins over it.
518
+ // and tested apart from this script.
535
519
  // There is no default model: a spec or flag that names none dies below with
536
520
  // REFUSE_NAME_MODEL (the model is one ticked in Settings). `spec.provider` is not validateJob'd until
537
521
  // runJob below, so an unrecognized value dies here with the same operator-
@@ -1032,7 +1016,7 @@ async function execute(ctx) {
1032
1016
  // the key from. Resolved ONCE here, at $0, before the preview, the monthly claim and any worktree or
1033
1017
  // spine, then handed down as data (`runJob`'s `rates`) — nothing deep in the run re-reads config. A bad
1034
1018
  // price refuses here; it never falls back to the built-in guess. No price set = `null` = no `rates` key
1035
- // passed anywhere, byte-identical to before. The judge's own row is resolved below, beside its key.
1019
+ // passed anywhere, byte-identical to before.
1036
1020
  const keyCfg = cfgOn ? rowsForHome(cfgHome, env) : [];
1037
1021
  /** @type {ReturnType<typeof ratesFor>} */
1038
1022
  let workerPrice = null;
@@ -1453,50 +1437,9 @@ async function execute(ctx) {
1453
1437
  // so there is one place saying which row reads which variable) and is
1454
1438
  // ALWAYS required — the worker always runs.
1455
1439
  //
1456
- // The JUDGE's key is required only when the close actually judges
1457
- // (`closeJudges`, src/kinds.js — the ONE reading of that question), and since
1458
- // PRD item 32 the judge is no longer pinned to Anthropic: its identity is
1459
- // RESOLVED below, and its key follows that resolved provider's own env var with
1460
- // `JUDGE_API_KEY` as a role-named override in front. One variable used to do two
1461
- // jobs (worker key for an anthropic-api job AND judge key for every job), which
1462
- // was confusing while the judge was pinned and would be a plain lie now that it
1463
- // is not.
1464
- //
1465
- // A green anthropic-api job's behaviour is byte-identical to before: its
1466
- // worker key IS `ANTHROPIC_API_KEY`, demanded as ever.
1467
- const JUDGES = closeJudges(spec.closeDecl);
1468
- // WHICH MODEL GRADES THIS JOB (PRD item 32.1). Resolved, never pinned: the
1469
- // spec's signed `judge: {provider, model}` if it names one, else this job's own
1470
- // worker provider and model — so a DeepSeek or Gemini job judges on its own
1471
- // provider and needs no second account. `resolveJudge` throws on a malformed
1472
- // override rather than quietly falling back to the worker's; the spec validator
1473
- // has already redded that shape, so reaching the throw means a caller skipped
1474
- // validation. Resolved UNCONDITIONALLY (needs no key) — `judge.model` rides
1475
- // into runJob below whether this leg constructs a real judge provider or not.
1476
- const judge = resolveJudge({ specJudge: spec.judge, workerProvider: spec.provider, workerModel: MODEL });
1477
- const judgeEntry = resolveProvider(judge.provider);
1478
- // …and the judge's price, from the judge MODEL's row (`judgeRatesFor`): on the worker's endpoint when the
1479
- // judge is the same provider (falling back to the worker's price when the model names no row), else the
1480
- // row for the judge's own provider. Only a judging close ever calls it, so only then can its row refuse the run.
1481
- /** @type {ReturnType<typeof ratesFor>} */
1482
- let judgePrice = null;
1483
- if (JUDGES) {
1484
- try {
1485
- judgePrice = judgeRatesFor(judge, spec.provider, baseUrl, workerPrice, keyCfg);
1486
- } catch (e) {
1487
- if (!(e instanceof ConfigError)) throw e;
1488
- err(`${e.message} — refusing to start rather than guess a price. Nothing spent.`);
1489
- throw new ExitSignal(2);
1490
- }
1491
- }
1492
- /** the row the judge's key (and endpoint) comes from: the worker's own row when the judge shares its provider, else the judge provider's row */
1493
- const judgeRow = judgeRowFor(keyCfg, judge, spec.provider, W && W.ok ? W.row : null);
1494
- // undefined, not null: both come straight off `env[...]` lookups below, which
1495
- // (like process.env) never produce null for a missing key.
1440
+ // hamr 2026-11-14: there is no judge key any more — the old judge is gone, and a rubric job grades on the check list with no model call.
1496
1441
  /** @type {string|undefined} */
1497
1442
  let workerApiKey;
1498
- /** @type {string|undefined} */
1499
- let judgeApiKey;
1500
1443
  // TEST SEAM (constraint: `deps.provider` skips the real-key check entirely,
1501
1444
  // the same shape src/bundlerun.js's door uses) — a caller that hands in
1502
1445
  // its own provider IS the run, so nothing here needs a real secret.
@@ -1504,8 +1447,7 @@ async function execute(ctx) {
1504
1447
  // P4b — the Settings row (keys file line) whose API shape + Base URL match this spec
1505
1448
  // supplies the key VARIABLE, standing in for the provider's built-in one; no matching
1506
1449
  // row = the built-in. Names only — values come from the
1507
- // env / keys file. The judge follows the worker's choice when it is the same provider
1508
- // (the same rule that gives it the worker's baseUrl below).
1450
+ // env / keys file.
1509
1451
  refuseWorker();
1510
1452
  const workerKeyName = /** @type {NonNullable<typeof W> & {ok: true}} */ (W).row.envName;
1511
1453
  // A job's worker key is its Settings row's own variable — there is no built-in name.
@@ -1517,29 +1459,6 @@ async function execute(ctx) {
1517
1459
  // door, before any provider is constructed; never echo the value.
1518
1460
  const workerKeyProblem = apiKeyProblem(workerApiKey);
1519
1461
  if (workerKeyProblem) { err(`${workerKeyName} ${workerKeyProblem} — refusing rather than crashing mid-call (never trimmed or repaired; fix the value at its source)`); throw new ExitSignal(2); }
1520
- // The judge's KEY follows the RESOLVED judge provider's own env var, with
1521
- // `JUDGE_API_KEY` as a role-named override in front of it (PRD item 32.3). The
1522
- // override matters most in the case this item exists for: a job whose worker and
1523
- // judge are the SAME provider but different accounts, and the anthropic case
1524
- // where one variable used to do two jobs.
1525
- judgeApiKey = env.JUDGE_API_KEY ?? keyValueOf(env, judgeRow?.envName);
1526
- if (JUDGES && !judgeApiKey) {
1527
- err(`This job's close JUDGES (${judgedStages(spec.closeDecl).length} judged stage(s)) and its judge is ${judge.model} on ${judge.provider}${spec.judge ? ' (signed override)' : " (this job's own worker model — no `judge` override signed)"}.`);
1528
- err(`Neither JUDGE_API_KEY nor ${judgeRow?.envName ?? `a key row for ${judge.provider}`} is set — secrets load from the environment, never the tree.`);
1529
- err('Refused at $0, BEFORE the worker spends anything: a judged run that discovers this at the close has paid for a verdict it cannot render.');
1530
- throw new ExitSignal(2);
1531
- }
1532
- // F181 — same door, second shape: a judge key that IS present can still be
1533
- // malformed (line break/control char/stray whitespace). Checked only when
1534
- // JUDGES (the key is only required then); never echoes the value.
1535
- if (JUDGES) {
1536
- const judgeKeyProblem = apiKeyProblem(/** @type {string} */ (judgeApiKey));
1537
- if (judgeKeyProblem) {
1538
- const judgeEnvName = env.JUDGE_API_KEY ? 'JUDGE_API_KEY' : (judgeRow?.envName ?? judge.provider);
1539
- err(`${judgeEnvName} ${judgeKeyProblem} — refusing rather than crashing mid-call (never trimmed or repaired; fix the value at its source)`);
1540
- throw new ExitSignal(2);
1541
- }
1542
- }
1543
1462
  }
1544
1463
 
1545
1464
  // THE MONTHLY $ LIMIT (PANEL-BUILD.md P4a; hamr 2026-09-30: "whoever runs first claims the limit and
@@ -1813,31 +1732,12 @@ async function execute(ctx) {
1813
1732
  // construction never runs (a scripted provider IS the run).
1814
1733
  let provider = deps.provider;
1815
1734
  let providerFor = deps.providerFor;
1816
- let judgeProvider = deps.judgeProvider ?? null;
1817
1735
  if (!provider) {
1818
1736
  const legacyMaxTokens = W && W.ok ? W.row.legacyMaxTokens : false;
1819
1737
  provider = makeProvider(spec.provider, { apiKey: /** @type {string} */ (workerApiKey), model: MODEL, baseUrl, legacyMaxTokens });
1820
1738
  // P: the per-step model factory. The ONLY tier a plan may name is the schema token `sonnet` (STEP_MODELS, src/plan.js — a
1821
1739
  // documented schema token, not a model id); it means THIS job's worker model, so every step's provider is the one above.
1822
1740
  providerFor = () => provider;
1823
- // SOFTGREEN — the JUDGED stage's own provider. Since PRD item 32.1 its identity is
1824
- // RESOLVED (`judge` above), not pinned: the spec's signed `judge` override, else this
1825
- // job's own worker model. It is still never a step knob and never agent-selectable —
1826
- // naming your own examiner is arbiter territory, and `judge` is a field the HUMAN
1827
- // signs into the hash. The `baseUrl` rides along only when the judge is the same
1828
- // provider as the worker: a spec's `baseUrl` is the WORKER's endpoint, and pointing a
1829
- // different vendor's client at it would be the silent-misconfiguration class
1830
- // `endpointKey` exists to prevent. Built only when `judgeApiKey` is present (PRD item
1831
- // 31.4 — the judge's key is demanded only when a judge is CALLED, so this construction
1832
- // is conditional on purpose, not unconditional): `runPlan` reads it only when a stage
1833
- // is `judged-floor`, and the alternative (deriving "does this close judge?" here) is a
1834
- // second reading of the declaration that can drift from the one the runner actually
1835
- // executes. Absent, a judged stage instrument-STOPS as a wiring gap, which is what
1836
- // every live softgreen run would have done: run-author wired this seam and this
1837
- // runner never did.
1838
- judgeProvider = judgeApiKey
1839
- ? makeProvider(judge.provider, { apiKey: /** @type {string} */ (judgeApiKey), model: judge.model, baseUrl: judge.provider === spec.provider ? baseUrl : (judgeRow && judgeRow.baseUrl.trim() !== '' ? judgeRow.baseUrl.trim() : undefined), legacyMaxTokens: judgeRow ? judgeRow.legacyMaxTokens : false })
1840
- : null;
1841
1741
  }
1842
1742
 
1843
1743
  const started = Date.now();
@@ -2076,9 +1976,9 @@ async function execute(ctx) {
2076
1976
  // used (never a second `makeSpine(spineFile)` here: two independent
2077
1977
  // emitters against one file would both start their seq counter at 0 and
2078
1978
  // collide the moment either one had already written a record).
2079
- approvals, workdir: wd, provider, providerFor, judgeProvider, judgeModel: judge.model,
1979
+ approvals, workdir: wd, provider, providerFor,
2080
1980
  // the customer's own price per key row (USD per 1K), or null = the built-in guess as before
2081
- rates: workerPrice?.rates ?? null, judgeRates: judgePrice?.rates ?? null, emit,
1981
+ rates: workerPrice?.rates ?? null, emit,
2082
1982
  // F133 (run mtqwmb9l) — `closeTimeoutMs` is deliberately NOT passed here.
2083
1983
  // `RESOLVED_CLOSE_TIMEOUT_MS` above exists only to size the outside
2084
1984
  // watchdog before it spawns; feeding it back into `runJob` used to make
@@ -2764,6 +2664,9 @@ export async function main(argv, deps = {}) {
2764
2664
  try { spec = JSON.parse(/** @type {string} */ (raw)); } catch (e) {
2765
2665
  die(`--spec ${specPath} is not readable JSON (${e.message}) — a spec nobody can parse is a spec nobody signed`);
2766
2666
  }
2667
+ // hamr 2026-11-14: a job made with PASS/FAIL examples or the old judge refuses in plain words, ahead of every other check
2668
+ const oldJob = oldJobWords(spec);
2669
+ if (oldJob) die(`--spec ${specPath}: ${oldJob} Nothing spent.`);
2767
2670
  // validateJob'd HERE, at $0, before a single filesystem lookup for the
2768
2671
  // source manifest or a single line of the preview prints — a `--job` row's
2769
2672
  // spec is developer-authored and reaches this same check inside `runJob`
@@ -7,16 +7,22 @@
7
7
  */
8
8
  export function linesNamedByReds(reds: Red[], declaration: any, lineNums: number[]): number[];
9
9
  /**
10
- * The machine's keep-or-drop of the try-3 questions. Kept only when its line is one the previous try's reds named and its
11
- * text is non-blank, at most {@link MAX_QUESTIONS}; every drop comes back with its reason, for the draft's log.
12
- * @param {any} raw @param {number[]} failedLines
13
- * @returns {{kept: {line: number, question: string, rule?: number, source?: string, ask?: 'reading'|'cant-check', reading?: string}[], dropped: {reason: string, raw: any}[]}}
10
+ * The machine's keep-or-drop of the try-3 questions. Kept only when its line is one the previous try's reds named, its text is non-blank, at most {@link MAX_QUESTIONS}, and its TAG is sound
11
+ * (Addendum 2026-11-14 (c) piece 5): the drafter names the `rule` the question is about (a `~` rule number the line really has: the answer REPLACES it) or says `new` (the answer is added as a new rule).
12
+ * A rule the line does not have, a question with neither tag and one with both are dropped; code never guesses which the drafter meant. Every drop comes back with its reason, for the draft's log.
13
+ * @param {any} raw @param {number[]} failedLines @param {{n: number, rules?: string[], rule?: string}[]|null} [jobLines] the person's numbered lines (their rules are what a tag may name)
14
+ * @returns {{kept: {line: number, question: string, rule?: number, new?: true, source?: string, ask?: 'reading'|'cant-check', reading?: string}[], dropped: {reason: string, raw: any}[]}}
14
15
  */
15
- export function normalizeQuestions(raw: any, failedLines: number[]): {
16
+ export function normalizeQuestions(raw: any, failedLines: number[], jobLines?: {
17
+ n: number;
18
+ rules?: string[];
19
+ rule?: string;
20
+ }[] | null): {
16
21
  kept: {
17
22
  line: number;
18
23
  question: string;
19
24
  rule?: number;
25
+ new?: true;
20
26
  source?: string;
21
27
  ask?: "reading" | "cant-check";
22
28
  reading?: string;
@@ -67,16 +73,19 @@ export function labelsFor(verdictType: string): Record<string | number, string>;
67
73
  * close — one source, never a second hand-typed list — rendered through the
68
74
  * frozen line in {@link GUARD_DESCRIPTIONS}, plus the write fence (a real,
69
75
  * 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
76
+ * 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
77
+ * (results and no note) is listed without it, and with no close to read nothing is claimed about text.
78
+ * @param {{verdictType: string, lang: string, writeScope?: string[]|null, jobLines?: {n: number}[]|null, closeDecl?: any}} o
71
79
  * @returns {string[]}
72
80
  */
73
- export function confirmProtections({ verdictType, lang, writeScope, jobLines }: {
81
+ export function confirmProtections({ verdictType, lang, writeScope, jobLines, closeDecl }: {
74
82
  verdictType: string;
75
83
  lang: string;
76
84
  writeScope?: string[] | null;
77
85
  jobLines?: {
78
86
  n: number;
79
87
  }[] | null;
88
+ closeDecl?: any;
80
89
  }): string[];
81
90
  /**
82
91
  * The mechanical seam between the catalogue and the schema, read BOTH ways: a
@@ -141,6 +150,13 @@ export function declarationSchema(catalogue?: Record<string, any>, { verdictType
141
150
  type: string;
142
151
  minLength: number;
143
152
  };
153
+ rule: {
154
+ type: string;
155
+ minimum: number;
156
+ };
157
+ new: {
158
+ type: string;
159
+ };
144
160
  };
145
161
  required: string[];
146
162
  };
@@ -221,45 +237,19 @@ export function declarationSchema(catalogue?: Record<string, any>, { verdictType
221
237
  items: {
222
238
  type: string;
223
239
  properties: {
224
- line: {
225
- type: string;
226
- minimum: number;
227
- description: string;
228
- };
229
- rule: {
230
- type: string;
231
- minimum: number;
232
- description: string;
233
- };
234
240
  reason: {
235
241
  type: string;
236
242
  minLength: number;
237
243
  description: string;
238
244
  };
239
- };
240
- required: string[];
241
- additionalProperties: boolean;
242
- };
243
- description: string;
244
- };
245
- guardLines: {
246
- type: string;
247
- items: {
248
- type: string;
249
- properties: {
250
- guard: {
245
+ rule?: {
251
246
  type: string;
252
- minLength: number;
247
+ minimum: number;
253
248
  description: string;
254
- };
255
- lines: {
249
+ } | undefined;
250
+ line: {
256
251
  type: string;
257
- minItems: number;
258
- uniqueItems: boolean;
259
- items: {
260
- type: string;
261
- minimum: number;
262
- };
252
+ minimum: number;
263
253
  description: string;
264
254
  };
265
255
  };
@@ -305,6 +295,13 @@ export function declarationTool(box: {
305
295
  type: string;
306
296
  minLength: number;
307
297
  };
298
+ rule: {
299
+ type: string;
300
+ minimum: number;
301
+ };
302
+ new: {
303
+ type: string;
304
+ };
308
305
  };
309
306
  required: string[];
310
307
  };
@@ -385,45 +382,19 @@ export function declarationTool(box: {
385
382
  items: {
386
383
  type: string;
387
384
  properties: {
388
- line: {
389
- type: string;
390
- minimum: number;
391
- description: string;
392
- };
393
- rule: {
394
- type: string;
395
- minimum: number;
396
- description: string;
397
- };
398
385
  reason: {
399
386
  type: string;
400
387
  minLength: number;
401
388
  description: string;
402
389
  };
403
- };
404
- required: string[];
405
- additionalProperties: boolean;
406
- };
407
- description: string;
408
- };
409
- guardLines: {
410
- type: string;
411
- items: {
412
- type: string;
413
- properties: {
414
- guard: {
390
+ rule?: {
415
391
  type: string;
416
- minLength: number;
392
+ minimum: number;
417
393
  description: string;
418
- };
419
- lines: {
394
+ } | undefined;
395
+ line: {
420
396
  type: string;
421
- minItems: number;
422
- uniqueItems: boolean;
423
- items: {
424
- type: string;
425
- minimum: number;
426
- };
397
+ minimum: number;
427
398
  description: string;
428
399
  };
429
400
  };
@@ -538,7 +509,7 @@ export function confirmedBlock(confirmed: {
538
509
  * names the ONE numbered job line it serves, or the line is refused with a reason; the mandatory guards serve no line.
539
510
  * The $0 validator (validateDeclaration, `jobLines`) enforces it and the revise loop feeds a miss back.
540
511
  * @param {number} count how many numbered job lines the person wrote
541
- * @param {string[]} [guardNames] the mandatory guards' names; present = the block also tells how a line they already cover is covered
512
+ * @param {string[]} [guardNames] the mandatory guards' names; present = the block also tells that a rule needs no stage and no refusal (code decides what keeps a rule)
542
513
  */
543
514
  export function jobLineTagBlock(count: number, guardNames?: string[]): string;
544
515
  /**
@@ -964,7 +935,7 @@ export function confirmPrompt({ answers, questions, labels, facts, listing, writ
964
935
  * ask: (step: {kind: string, [k: string]: any}) => Promise<string|null>,
965
936
  * onPhase?: (phase: string, data?: any) => void, mode?: 'tool'|'text',
966
937
  * worseThanBefore?: string, inputs?: {n: number, label: string, value: string}[]|null,
967
- * 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):
938
+ * jobLines?: {n: number}[]|null, ticket?: boolean, card?: {checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy?: Record<string, string>, closeDecl?: any}|null, block?: CheckBlock|null, cardOf?: (() => any)|null}} o retired field (hamr's ruling 2026-09-28):
968
939
  * `worseThanBefore` is never asked any more and defaults to `''` — a
969
940
  * caller may still pass a string through (kept for a future, non-ask
970
941
  * source of the same constraint), it just never comes from an ask() step.
@@ -1016,6 +987,7 @@ export function runConfirmTurn({ verdictType, answers, questions, labels, facts,
1016
987
  }[];
1017
988
  notChecked: string[];
1018
989
  notCheckedBy?: Record<string, string>;
990
+ closeDecl?: any;
1019
991
  } | null;
1020
992
  block?: CheckBlock | null;
1021
993
  cardOf?: (() => any) | null;
@@ -1260,7 +1232,7 @@ export const INPUTS_FIELD: Readonly<{
1260
1232
  label: "Inputs";
1261
1233
  prompt: string;
1262
1234
  }>;
1263
- /** P7: how to write "The job" (printed under its question by the CLI; the panel's box shows the same in its examples). */
1235
+ /** P7: how to write "The job" (printed under its question by the CLI; the panel's box shows the same in its placeholder). */
1264
1236
  export const JOB_BLOCK_HELP: readonly string[];
1265
1237
  /** Destination's wording when Source resolved to a git repo: the answer IS the
1266
1238
  * signed `writeScope` fence (ITEM33-BUILD.md M3 ruling 2). */
@@ -1319,28 +1291,13 @@ export const GREEN_QUESTIONS: Readonly<{
1319
1291
  export const FIELD_LABELS: Readonly<{
1320
1292
  1: "The job";
1321
1293
  }>;
1322
- /** The soft-green quartet's own key for Judge Examples — exported so
1323
- * `cardauthor.js` reads the SAME number this module files the answer under,
1324
- * rather than a second, hand-typed "6"/"7". */
1325
- export const SOFTGREEN_JUDGE_EXAMPLES_KEY: number;
1326
- /** The Judge Examples question — the signed table's own Holds text, verbatim
1327
- * ("one pass, one fail, and why"), not the old worded Q7 ("Give one example
1328
- * you'd pass and one you'd fail, and say why."). Exported so `cardauthor.js`'s
1329
- * prompt and this module's own `SOFTGREEN_QUESTIONS` render the identical
1330
- * string; its label ("Judge examples") lives in `SOFTGREEN_FIELD_LABELS`. */
1331
- export const JUDGE_EXAMPLES_QUESTION: "the PASS: and FAIL: examples the person wrote under their job lines, each with its line number";
1332
- /** {@link FIELD_LABELS} plus Judge Examples' own label, for the soft-green set. */
1294
+ /** {@link FIELD_LABELS} for the soft-green set: the same one label (the judge examples are gone). */
1333
1295
  export const SOFTGREEN_FIELD_LABELS: Readonly<{
1334
1296
  1: "The job";
1335
1297
  }>;
1336
1298
  /**
1337
- * THE SOFTGREEN SET — the green trio plus Judge Examples. A judged close needs
1338
- * exactly this one more thing the green set cannot supply: a real pass/fail
1339
- * pair in the person's own words, which module 4 (`cardauthor.js`) compiles
1340
- * into the signed rubric card and the frozen calibration set. It rides in
1341
- * `answers` and reaches the composer verbatim through the prompt's interview
1342
- * block, exactly as every other free-text answer does — this module derives
1343
- * nothing from it.
1299
+ * THE SOFTGREEN SET — the green set again: a rubric job's whole job is the numbered lines of "The job" (its `~` rules
1300
+ * become the check list); the PASS/FAIL judge examples are gone (hamr 2026-11-14).
1344
1301
  */
1345
1302
  export const SOFTGREEN_QUESTIONS: Readonly<{
1346
1303
  1: "the job, as numbered lines — each line may carry the rules (~) the person wrote under it";
@@ -1437,16 +1394,7 @@ export const ANSWER_QUESTION_FIELD: Readonly<{
1437
1394
  * @type {Record<'confirm'|'fix'|'type-goal'|'start-over', string>}
1438
1395
  */
1439
1396
  export const CONFIRM_MENU: Record<"confirm" | "fix" | "type-goal" | "start-over", string>;
1440
- /**
1441
- * PLAIN-ENGLISH lines for the guards `classGuards` can compose, keyed by
1442
- * guard NAME — frozen beside {@link CONFIRM_MENU} because both are constants
1443
- * the confirm turn shows a person verbatim. One entry per guard that exists
1444
- * in `MECHANICAL_GUARDS` (`src/authoring.js`); {@link confirmProtections}
1445
- * throws if a guard `classGuards` hands back has no line here, so a battery
1446
- * that grows a guard fails loudly instead of showing a blank description.
1447
- * @type {Record<string, string>}
1448
- */
1449
- export const GUARD_DESCRIPTIONS: Record<string, string>;
1397
+ export { GUARD_DESCRIPTIONS };
1450
1398
  export const AUTHOR_SYSTEM: string;
1451
1399
  /**
1452
1400
  * ONE schema per PARAMETER NAME, composed into kinds by the catalogue's own
@@ -1632,43 +1580,6 @@ export const PARAM_SCHEMAS: Readonly<{
1632
1580
  requireNonEmpty: {
1633
1581
  const: boolean;
1634
1582
  };
1635
- card: {
1636
- type: string;
1637
- description: string;
1638
- properties: {
1639
- items: {
1640
- type: string;
1641
- minItems: number;
1642
- items: {
1643
- type: string;
1644
- properties: {
1645
- rule: {
1646
- enum: string[];
1647
- description: string;
1648
- };
1649
- text: {
1650
- type: string;
1651
- minLength: number;
1652
- description: string;
1653
- };
1654
- };
1655
- required: string[];
1656
- additionalProperties: boolean;
1657
- };
1658
- };
1659
- };
1660
- required: string[];
1661
- additionalProperties: boolean;
1662
- };
1663
- paths: {
1664
- type: string;
1665
- minItems: number;
1666
- maxItems: number;
1667
- items: {
1668
- type: string;
1669
- };
1670
- description: string;
1671
- };
1672
1583
  step: {
1673
1584
  type: string;
1674
1585
  minimum: number;
@@ -1885,6 +1796,8 @@ export const CONFIRM_STRUCTURE_INSTRUCTION: string;
1885
1796
  * (`src/checklist.js`), made before the draft, never this turn's.
1886
1797
  */
1887
1798
  export const RUBRIC_CONFIRM_NOTE: string;
1799
+ /** What the confirm turn tells the model about a REPO job (model-facing, registered; Addendum 2026-11-15 (d)): the turn plans the goal only, the job's checks are the one list's rows, built by code after the draft. */
1800
+ export const REPO_CONFIRM_NOTE: string;
1888
1801
  export const CONFIRM_SYSTEM: string;
1889
1802
  /** the confirm turn's system prompt for a rubric job (model-facing, registered): a one-sentence goal, no check of its own */
1890
1803
  export const CONFIRM_GOAL_SYSTEM: string;
@@ -1897,3 +1810,4 @@ export type Red = {
1897
1810
  };
1898
1811
  import { scrubRaw } from './text.js';
1899
1812
  import { CheckBlock } from './checkblock.js';
1813
+ import { GUARD_DESCRIPTIONS } from './guarddescriptions.js';