bareloop 0.56.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 (78) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +3 -3
  3. package/bareloop.context.md +65 -207
  4. package/package.json +2 -2
  5. package/src/authorflow.js +25 -78
  6. package/src/authoring.js +5 -124
  7. package/src/authorjob.js +33 -395
  8. package/src/authorreadout.js +17 -355
  9. package/src/authorrun.js +8 -211
  10. package/src/blockasks.js +2 -2
  11. package/src/bundlerun.js +4 -1
  12. package/src/checkblock.js +76 -50
  13. package/src/checklist.js +1 -1
  14. package/src/checkpick.js +10 -1
  15. package/src/cli.js +3 -3
  16. package/src/declaredclose.js +11 -110
  17. package/src/destpoint.js +1 -1
  18. package/src/index.js +3 -43
  19. package/src/interviewrun.js +13 -8
  20. package/src/job.js +20 -1
  21. package/src/jobblock.js +11 -46
  22. package/src/judged.js +13 -1229
  23. package/src/kinds.js +5 -347
  24. package/src/noteask.js +124 -0
  25. package/src/pagedry.js +27 -5
  26. package/src/pagemap.js +2 -2
  27. package/src/pagerules.js +18 -3
  28. package/src/panel/authorroutes.js +9 -3
  29. package/src/panel/authorsession.js +99 -141
  30. package/src/panel/importrun.js +0 -1
  31. package/src/panel/index.html +6 -6
  32. package/src/panel/jobplan.js +7 -5
  33. package/src/panel/server.js +25 -64
  34. package/src/panel/status.js +3 -0
  35. package/src/pickrecord.js +15 -54
  36. package/src/planrun.js +2 -48
  37. package/src/promptregisters.js +2 -17
  38. package/src/providerrows.js +0 -36
  39. package/src/providers.js +4 -25
  40. package/src/questionbox.js +4 -12
  41. package/src/rubricstep.js +26 -6
  42. package/src/run.js +2 -15
  43. package/src/userrun.js +14 -111
  44. package/types/authorflow.d.ts +9 -58
  45. package/types/authoring.d.ts +1 -14
  46. package/types/authorjob.d.ts +13 -55
  47. package/types/authorreadout.d.ts +8 -80
  48. package/types/blockasks.d.ts +1 -2
  49. package/types/checkblock.d.ts +32 -17
  50. package/types/checklist.d.ts +2 -2
  51. package/types/checkpick.d.ts +5 -0
  52. package/types/cli.d.ts +1 -3
  53. package/types/declaredclose.d.ts +3 -33
  54. package/types/index.d.ts +2 -4
  55. package/types/job.d.ts +8 -0
  56. package/types/jobblock.d.ts +8 -38
  57. package/types/judged.d.ts +7 -357
  58. package/types/kinds.d.ts +3 -104
  59. package/types/noteask.d.ts +76 -0
  60. package/types/pagedry.d.ts +13 -0
  61. package/types/pagerules.d.ts +7 -0
  62. package/types/panel/authorsession.d.ts +35 -4
  63. package/types/panel/jobplan.d.ts +3 -3
  64. package/types/panel/server.d.ts +13 -5
  65. package/types/panel/status.d.ts +5 -0
  66. package/types/pickrecord.d.ts +8 -13
  67. package/types/planrun.d.ts +1 -22
  68. package/types/providerrows.d.ts +0 -31
  69. package/types/providers.d.ts +3 -19
  70. package/types/rubricstep.d.ts +9 -0
  71. package/types/run.d.ts +1 -20
  72. package/types/userrun.d.ts +0 -1
  73. package/src/calibrate.js +0 -702
  74. package/src/cardauthor.js +0 -502
  75. package/src/fitcheck.js +0 -168
  76. package/types/calibrate.d.ts +0 -201
  77. package/types/cardauthor.d.ts +0 -358
  78. package/types/fitcheck.d.ts +0 -119
@@ -11,6 +11,7 @@
11
11
  //
12
12
  // `cls` is 'machine check' | 'judge' | null (null = not known yet: the confirm card's checks are the model's plan, the
13
13
  // stage kinds exist only after drafting). Pure; no file IO.
14
+ import { NOT_REACHED } from './status.js';
14
15
  import { ticketFilterWords } from '../ticketfilter.js';
15
16
  import { KIND_CATALOGUE } from '../authoring.js';
16
17
  import { WEEK_ONLY_WORDS } from '../checklist.js';
@@ -19,7 +20,7 @@ import { checksOfClose, signedFactNames, proseNotChecked, lineRules, confirmedGo
19
20
 
20
21
  /** `by` = who added the check: the drafter (`agent`) or the person's own pick (`you`); absent = code's own (an always-on guard, a number tie) or not known */
21
22
  /** `stage` = the signed close stage the row belongs to (its recorded verdict is the row's result in the Audit) */
22
- /** @typedef {{text: string, by: 'agent'|'you'|'default'|null, result: 'passed'|'failed'|'none'|'not-checked'|'held'|'record-missing', word?: string}} AuditRow */
23
+ /** @typedef {{text: string, by: 'agent'|'you'|'default'|null, result: 'passed'|'failed'|'none'|'not-reached'|'not-checked'|'held'|'record-missing', word?: string}} AuditRow */
23
24
  /** @typedef {{name: string, cls: 'machine check'|'judge'|null, by?: 'agent'|'you'|'default'|null, key?: string, stage?: string}} PlanCheck */
24
25
  /** @typedef {{n: number, text: string, rule: string, rules: string[], checks: PlanCheck[], refused: string[], always?: string[], picked?: string[]}} PlanLine */
25
26
  /** @typedef {{lines: PlanLine[], loose: PlanCheck[], notChecked: string[], readNotes: string[], alwaysOn: string[], older: boolean, goal?: string, ticketFilter?: string, notCheckedBy?: Record<string, 'you'|'agent'|'default'>, suggested?: {key: string, line: number, text: string}[], editable?: boolean}} JobPlan */
@@ -178,12 +179,12 @@ export const AUDIT_NO_RESULT = 'no result recorded';
178
179
  * (`results`: stage name to passed), never re-derived; a row no verdict was recorded for says so. A Not checked row's result is "not checked" (its reason is in its words).
179
180
  * The write fence is enforced per write by the gate, so its row reads the gate's own record of THIS run (hamr ruling A, 2026-11-13): `blocked` = the write/edit attempts the gate denied
180
181
  * (`held · N writes blocked`), or `null` when the run's gate record is missing (said in plain words, never "held").
181
- * @param {JobPlan} plan @param {string[]} guards @param {Map<string, boolean>|null} results @param {number|null} [blocked]
182
+ * @param {JobPlan} plan @param {string[]} guards @param {Map<string, boolean>|null} results @param {number|null} [blocked] @param {boolean} [closeRan] the results are a CLOSE's (the latest), so a declared stage missing from them was not reached (the close stops at its first red); else a stage no verdict was recorded for reads none
182
183
  * @returns {{checks: AuditRow[], notChecked: AuditRow[], always: AuditRow[]}}
183
184
  */
184
- export function auditChecksOf(plan, guards, results, blocked = null) {
185
- /** @param {string|undefined|null} stage @returns {'passed'|'failed'|'none'} */
186
- const verdict = (stage) => (!stage || !results || !results.has(stage) ? 'none' : (results.get(stage) ? 'passed' : 'failed'));
185
+ export function auditChecksOf(plan, guards, results, blocked = null, closeRan = false) {
186
+ /** @param {string|undefined|null} stage @returns {'passed'|'failed'|'none'|'not-reached'} */
187
+ const verdict = (stage) => (!stage || !results ? 'none' : (!results.has(stage) ? (closeRan ? 'not-reached' : 'none') : (results.get(stage) ? 'passed' : 'failed')));
187
188
  /** @type {AuditRow[]} */
188
189
  const checks = [];
189
190
  for (const l of plan.lines) for (const c of l.checks) checks.push({ text: `line ${l.n} · ${c.name}`, by: c.by ?? null, result: verdict(c.stage) });
@@ -206,5 +207,6 @@ export function auditChecksOf(plan, guards, results, blocked = null) {
206
207
  }
207
208
  return { text: g, by: /** @type {'default'} */ ('default'), result: verdict(stage) };
208
209
  });
210
+ for (const r of [...checks, ...always]) if (r.result === 'not-reached') r.word = NOT_REACHED.word;
209
211
  return { checks, notChecked, always };
210
212
  }
@@ -74,7 +74,7 @@ import { SHAPES } from '../providershapes.js';
74
74
  import { resolveProvider } from '../providers.js';
75
75
  import { readResume, checkpointAgeGate, CHECKPOINT_OUTCOMES } from '../reuse.js';
76
76
  import {
77
- statusFor, partStatusFor, GOAL_MET_LINE, doorViewOf, ACTOR_MARKER, DOOR_WORDS, isReusableGreen, STATUS,
77
+ statusFor, partStatusFor, GOAL_MET_LINE, doorViewOf, ACTOR_MARKER, DOOR_WORDS, isReusableGreen, STATUS, NOT_REACHED,
78
78
  } from './status.js';
79
79
  import { thinkingJobText } from '../thinking.js';
80
80
  import { ticketFilterWords } from '../ticketfilter.js';
@@ -1534,13 +1534,14 @@ function stepChecksOf(records, spec) {
1534
1534
  }
1535
1535
 
1536
1536
  /**
1537
- * The generic Result tab's "The checks" box, from the run's LAST `outer-close` record: each stage's plain question ({@link stageQuestionText}'s one
1537
+ * The generic Result tab's "The checks" box, from the run's FINAL close record (the last `outer-close` or fix-loop staged `close-verdict`): each stage's plain question ({@link stageQuestionText}'s one
1538
1538
  * owner, through the spec's own declaration), its pass/fail word from the status table, and the number the close read. A run the close never reached
1539
1539
  * falls back to the checks its steps ran ({@link stepChecksOf}); `null` when neither exists.
1540
1540
  * @param {any[]} records @param {any} spec
1541
1541
  */
1542
1542
  function checksOf(records, spec) {
1543
- const oc = records.findLast((r) => r && r.type === 'outer-close' && Array.isArray(r.stages));
1543
+ // the run's FINAL close: the last staged record by position — the `outer-close` precheck runs once BEFORE the fix loop, whose own staged `close-verdict`s come after it (live run mwg3pov1)
1544
+ const oc = records.findLast((r) => r && (r.type === 'close-verdict' || r.type === 'outer-close') && Array.isArray(r.stages));
1544
1545
  if (!oc) return stepChecksOf(records, spec);
1545
1546
  const kindMeta = stageKindMetaFromSpec(spec);
1546
1547
  const stages = oc.stages.filter((/** @type {any} */ s) => s && typeof s.name === 'string').map((/** @type {any} */ raw) => {
@@ -1555,9 +1556,16 @@ function checksOf(records, spec) {
1555
1556
  };
1556
1557
  });
1557
1558
  const ok = stages.filter((/** @type {any} */ s) => s.passed).length;
1559
+ // a stage the signed close declares but this LATEST close never reached (it stops at the first red) is "not reached" — never the precheck's old reading
1560
+ const ran = new Set(stages.map((/** @type {any} */ s) => s.name));
1561
+ const unreached = [...(kindMeta ?? new Map())].filter(([n]) => !ran.has(n)).map(([name, m]) => ({
1562
+ name, question: m.question, passed: false, notReached: true, status: NOT_REACHED,
1563
+ value: null, baseline: null, direction: m.direction, baselineKind: m.baselineKind, notes: null,
1564
+ }));
1565
+ const shown = kindMeta ? [...kindMeta.keys()].map((n) => stages.find((/** @type {any} */ s) => s.name === n) ?? unreached.find((u) => u.name === n)).concat(stages.filter((/** @type {any} */ s) => !kindMeta.has(s.name))) : stages;
1558
1566
  return {
1559
- head: `${ok} of ${stages.length} passed · the close ran them after the worker stopped`,
1560
- passed: ok, total: stages.length, allPassed: ok === stages.length, stages,
1567
+ head: `${ok} of ${stages.length} passed${unreached.length ? ` · ${unreached.length} not reached` : ''} · the close ran them after the worker stopped`,
1568
+ passed: ok, total: stages.length, notReached: unreached.length, allPassed: ok === stages.length, stages: shown,
1561
1569
  notes: stages.filter((/** @type {any} */ s) => s.notes).map((/** @type {any} */ s) => ({ name: s.name, text: s.notes })),
1562
1570
  };
1563
1571
  }
@@ -1995,16 +2003,6 @@ function getRunDetailBody(runid, opts) {
1995
2003
  // the export row only for a run export would take — the one rule, `checkExportable`, never a copy of it
1996
2004
  const exportName = checkExportable(row, runName).ok ? runName : null;
1997
2005
  const { ended, resume, status } = endedForRow(row, rawSpineRecords, summary, death, true, exportName);
1998
- // judgeModel (Summary box "judge:" line): the FIRST `judge-round`'s own
1999
- // `model` field (src/planrun.js:1704's `onJudgeCost` emit) — a soft-green
2000
- // close's own paid judge seam, distinct from the worker `model` above.
2001
- // `null` whenever no judge-round was ever recorded (the common case —
2002
- // src/replay.js's own note: no real archived run measured against this
2003
- // build carries one yet), never guessed from the worker model.
2004
- const judgeRoundWithModel = rawSpineRecords.find(
2005
- (r) => r && typeof r === 'object' && r.type === 'judge-round' && typeof r.model === 'string' && r.model.length > 0,
2006
- );
2007
- const judgeModel = judgeRoundWithModel ? judgeRoundWithModel.model : null;
2008
2006
 
2009
2007
  /** @param {string|null} outcome @param {boolean} isLast */
2010
2008
  const stateFor = (outcome, isLast) => {
@@ -2141,7 +2139,6 @@ function getRunDetailBody(runid, opts) {
2141
2139
  checkTypeTitle: checkTypeTitle(summary.verdictType, row.at),
2142
2140
  model: summary.model,
2143
2141
  provider: summary.provider,
2144
- judgeModel,
2145
2142
  budgetUsd: summary.budgetUsd,
2146
2143
  glyph: status.sign,
2147
2144
  status,
@@ -2248,7 +2245,7 @@ function getRunDetailBody(runid, opts) {
2248
2245
  // Cross-run learnings now ride on the part that received them (`part.learnings`, `part.learningsError`; src/panel/handed.js).
2249
2246
  // PRD v1.106 Part 5 F: the two Run summary rows, worded here (the page prints them)
2250
2247
  callsLine: callsLineOf(rawSpineRecords, scopedBehaviour(row, rawSpineRecords)),
2251
- checksLine: checksLineOf(rawSpineRecords, enrichedParts),
2248
+ checksLine: checksLineOf(rawSpineRecords, specForParts),
2252
2249
  auditChecks: auditChecksFor(row, rawSpineRecords, specForParts, opts),
2253
2250
  memoryCache: summary.memoryCache,
2254
2251
  // PLACE RULES: what the run start read for each place-rule check (plain lines from code), or null when the run has none; the Audit page's placement of it is not built yet
@@ -3179,53 +3176,17 @@ export function callsLineOf(records, behaviour) {
3179
3176
  : `${model} model · tool calls: no log saved`;
3180
3177
  }
3181
3178
 
3182
- /** "1-5", "2", "1-2, 4" from try numbers @param {number[]} ns */
3183
- function tryRanges(ns) {
3184
- const out = [];
3185
- for (let i = 0; i < ns.length; i += 1) {
3186
- let j = i;
3187
- while (j + 1 < ns.length && ns[j + 1] === ns[j] + 1) j += 1;
3188
- out.push(j > i ? `${ns[i]}-${ns[j]}` : String(ns[i]));
3189
- i = j;
3190
- }
3191
- return out.join(', ');
3192
- }
3193
-
3194
3179
  /**
3195
- * "16 run · 8 passed · 8 failed (write-flight-facts tries 1-5, then tries 1-3)" — counts of what ran, never a fraction (the "checks N/M"
3196
- * headline stays withdrawn). Every `exit-eval` result plus every graded `outer-close` stage; the parenthesis names the steps and try ranges
3197
- * that failed, from the same `tries[]` the Audit reads. A run with neither says `not recorded`.
3198
- * @param {any[]} records the run's raw spine @param {any[]|null|undefined} parts the enriched parts
3180
+ * "3 run · 3 passed · 0 failed" (+ " · N not reached") — counts of what the run's LATEST close ran, never a fraction (the "checks N/M" headline stays withdrawn).
3181
+ * Read from {@link checksOf}, the one owner the Audit checks fold and the Result checks box read (live run mwg3pov1): the last staged close, a stage it never reached counts as
3182
+ * neither passed nor failed, and a run no close reached falls back to the checks its steps ran. No history of earlier tries. A run with neither says `not recorded`.
3183
+ * @param {any[]} records the run's raw spine @param {any} spec the run's signed spec (names the stages the close declares)
3199
3184
  * @returns {string}
3200
3185
  */
3201
- export function checksLineOf(records, parts) {
3202
- let run = 0;
3203
- let passed = 0;
3204
- let outerFailed = false;
3205
- for (const r of records) {
3206
- if (!r) continue;
3207
- if (r.type === 'exit-eval' && Array.isArray(r.results)) {
3208
- for (const x of r.results) { run += 1; if (x && x.pass === true) passed += 1; }
3209
- } else if (r.type === 'outer-close' && Array.isArray(r.stages)) {
3210
- for (const x of r.stages) { run += 1; if (x && x.verdict === 'satisfied') passed += 1; else outerFailed = true; }
3211
- }
3212
- }
3213
- if (run === 0) return 'not recorded';
3214
- /** @type {string[]} */
3215
- const named = [];
3216
- /** @type {Set<string>} */
3217
- const seenLabel = new Set();
3218
- for (const p of parts ?? []) {
3219
- if (p.kind !== 'step' || !Array.isArray(p.tries)) continue;
3220
- const bad = p.tries.filter((/** @type {any} */ t) => t.failed > 0).map((/** @type {any} */ t) => t.n);
3221
- if (bad.length === 0) continue;
3222
- const text = `tries ${tryRanges(bad)}`;
3223
- named.push(seenLabel.has(p.label) ? `then ${text}` : `${p.label} ${text}`);
3224
- seenLabel.add(p.label);
3225
- }
3226
- if (outerFailed) named.push('the outer close');
3227
- const failed = run - passed;
3228
- return `${run} run · ${passed} passed · ${failed} failed${named.length ? ` (${named.join(', ')})` : ''}`;
3186
+ export function checksLineOf(records, spec) {
3187
+ const c = checksOf(records, spec);
3188
+ if (!c || c.total === 0) return 'not recorded';
3189
+ return `${c.total} run · ${c.passed} passed · ${c.total - c.passed} failed${c.notReached ? ` · ${c.notReached} not reached` : ''}`;
3229
3190
  }
3230
3191
 
3231
3192
  /** 1 -> "1st", 4 -> "4th", 12 -> "12th" @param {number} n */
@@ -3424,15 +3385,15 @@ function auditChecksFor(row, records, spec, opts) {
3424
3385
  if (spec.closeDecl && typeof spec.closeDecl.lang === 'string' && typeof spec.verdictType === 'string') {
3425
3386
  try {
3426
3387
  guards = confirmProtections({
3427
- verdictType: spec.verdictType, lang: spec.closeDecl.lang, jobLines: Array.isArray(spec.jobLines) ? spec.jobLines : null,
3388
+ verdictType: spec.verdictType, lang: spec.closeDecl.lang, jobLines: Array.isArray(spec.jobLines) ? spec.jobLines : null, closeDecl: spec.closeDecl,
3428
3389
  writeScope: Array.isArray(spec.writeScope) && spec.writeScope.every((/** @type {any} */ x) => typeof x === 'string') ? spec.writeScope : null,
3429
3390
  });
3430
3391
  } catch { guards = []; }
3431
3392
  }
3432
3393
  const got = checksOf(records, spec);
3433
- const results = got ? new Map(got.stages.map((/** @type {any} */ x) => [x.name, x.passed === true])) : null;
3394
+ const results = got ? new Map(got.stages.filter((/** @type {any} */ x) => !x.notReached).map((/** @type {any} */ x) => [x.name, x.passed === true])) : null;
3434
3395
  const rows = scopedAuditRows(row, records);
3435
- return auditChecksOf(plan, guards, results, rows === null ? null : writesBlocked(rows));
3396
+ return auditChecksOf(plan, guards, results, rows === null ? null : writesBlocked(rows), got !== null && got.notReached !== undefined);
3436
3397
  }
3437
3398
 
3438
3399
  /**
@@ -47,6 +47,9 @@ export const STATUS = Object.freeze({
47
47
  skipped: Object.freeze({ sign: '–', word: 'skipped' }),
48
48
  });
49
49
 
50
+ /** a close stage the run's LATEST close never reached (it stops at the first red): the [·] sign, grey, never the precheck's old reading. Beside STATUS, not in it: it is a stage's standing, never a run's status */
51
+ export const NOT_REACHED = Object.freeze({ sign: '·', word: 'not reached' });
52
+
50
53
  /**
51
54
  * The plain words a skipped run carries (the `settled` event's `words`, the Ended line), from CODE. They do NOT repeat the status word: every surface prints `skipped — <words>` from the table's word (the CLI line adds its own `skipped:`): the filter decision's own reason, never model-written.
52
55
  * `reason` is `decideTicket`'s ('closed' | 'priority P3, not P1' | 'no P1 label' | 'no bug label'); `filter` is the job's signed `ticketFilter`, which tells a missing
package/src/pickrecord.js CHANGED
@@ -11,7 +11,7 @@ export const RECORD_FILE = 'picks-record.json';
11
11
  /** the exact words a kept pick is marked with in the draft log, the Audit and the plan card (M10 am17 (6)) */
12
12
  export const KEPT_WORDS = 'kept from last draft';
13
13
 
14
- /** @typedef {{lineWords: string, occurrence: number, ruleText: string, added: string|null, check: Record<string, any>|null, own: boolean, left: boolean}} Entry */
14
+ /** @typedef {{lineWords: string, occurrence: number, ruleText: string, added?: string|null, check: Record<string, any>|null, own: boolean, left: boolean}} Entry */
15
15
  /** @typedef {{line: number, rule: number, text: string}} Rule */
16
16
 
17
17
  const norm = (/** @type {unknown} */ t) => String(t).toLowerCase().replace(/\s+/g, ' ').trim();
@@ -35,9 +35,9 @@ export function lineKeys(lines) {
35
35
  }
36
36
 
37
37
  /**
38
- * The entries for answers just given, numbered on THIS card (the answer redraft's card: its line and rule numbers are the ones the asks carried).
38
+ * The entries for answers just given, numbered on THIS card (the answer redraft's card: its line and rule numbers are the ones the asks carried; the rule's text is the FINAL rule's words).
39
39
  * @param {{n: number, text: string}[]} lines @param {Rule[]} rules
40
- * @param {{line: number, rule: number, check?: Record<string, any>|null, added?: string|null, own?: boolean}[]} picks @param {{line: number, rule: number}[]} left
40
+ * @param {{line: number, rule: number, check?: Record<string, any>|null, own?: boolean}[]} picks @param {{line: number, rule: number}[]} left
41
41
  * @returns {Entry[]}
42
42
  */
43
43
  export function entriesFromAnswers(lines, rules, picks, left) {
@@ -52,82 +52,43 @@ export function entriesFromAnswers(lines, rules, picks, left) {
52
52
  const out = [];
53
53
  for (const p of picks) {
54
54
  const b = base(p.line, p.rule);
55
- if (b) out.push({ ...b, added: typeof p.added === 'string' ? p.added : null, check: p.check ?? null, own: p.own === true, left: false });
55
+ if (b) out.push({ ...b, check: p.check ?? null, own: p.own === true, left: false });
56
56
  }
57
57
  for (const l of left) {
58
58
  const b = base(l.line, l.rule);
59
- if (b) out.push({ ...b, added: null, check: null, own: false, left: true });
59
+ if (b) out.push({ ...b, check: null, own: false, left: true });
60
60
  }
61
61
  return out;
62
62
  }
63
63
 
64
64
  /**
65
65
  * Decide, for the card in hand, which stored picks are kept and which guardrails must be asked.
66
- * A pick is KEPT when the job line with its words (same order among equal lines) still has its source guardrail with the exact words and, if the pick wrote a `~` line,
67
- * that line with its exact words too. Otherwise the pick is dropped (never partly kept) and its guardrails are asked: a pair broken on one side is ONE ask, so the
68
- * partner left on the card is folded (neither asked nor given the old check) - except an EDITED added line (M10 am21): that one is asked (`pairRule` = its source's number) and the source is folded. Pure.
66
+ * A pick is KEPT when the job line with its words (same order among equal lines) still has a guardrail with the pick's exact words. One rule in, one rule out (hamr 2026-11-14): an answer REPLACED the
67
+ * rule it was asked about, so the stored words are the final rule's words and there is no second line to pair; a rule whose words changed is simply new and asked. Pure.
69
68
  * @param {Entry[]} entries @param {{n: number, text: string}[]} lines @param {Rule[]} rules every guardrail the call settles
70
- * @returns {{picks: {line: number, rule: number, check: Record<string, any>|null, added?: string, own?: boolean}[], left: {line: number, rule: number}[],
71
- * kept: {line: number, rule: number, entry: Entry}[], askRules: (Rule & {pairRule?: number})[]}}
69
+ * @returns {{picks: {line: number, rule: number, check: Record<string, any>|null, own?: boolean}[], left: {line: number, rule: number}[],
70
+ * kept: {line: number, rule: number, entry: Entry}[], askRules: Rule[]}}
72
71
  */
73
72
  export function matchRecord(entries, lines, rules) {
74
73
  const byKey = new Map([...lineKeys(lines)].map(([n, k]) => [`${k.lineWords}#${k.occurrence}`, n]));
75
74
  /** @type {Set<string>} */
76
75
  const claimed = new Set();
77
- /** @type {Set<string>} */
78
- const folded = new Set();
79
- /** @type {Map<string, number>} an edited added line (by id) -> the rule number of the source it was paired with (M10 am21) */
80
- const edited = new Map();
81
- const free = (/** @type {number} */ n, /** @type {string} */ text) => rules.find((r) => r.line === n && !claimed.has(id(r)) && !folded.has(id(r)) && norm(r.text) === norm(text));
82
76
  const kept = [];
83
- /** @type {{e: Entry, n: number|undefined}[]} */
84
- const broken = [];
85
77
  for (const e of Array.isArray(entries) ? entries : []) {
86
78
  const n = byKey.get(`${e.lineWords}#${e.occurrence}`);
87
- const src = n === undefined ? undefined : free(n, e.ruleText);
88
- if (src) claimed.add(id(src)); // held while the partner is looked for, so a pair never takes one rule twice
89
- const add = n === undefined || !src || e.added === null ? undefined : free(n, e.added);
90
- if (n !== undefined && src && (e.added === null || add)) {
91
- if (add) claimed.add(id(add));
92
- kept.push({ line: n, rule: src.rule, entry: e });
93
- } else {
94
- if (src) claimed.delete(id(src));
95
- broken.push({ e, n });
96
- }
97
- }
98
- // a pair broken on one side is ONE pick, so ONE ask: the partner that is left folds into it (it keeps no old check and is not asked on its own)
99
- for (const { e, n } of broken) {
100
- if (e.added === null) continue;
101
- if (n === undefined) {
102
- // the line's own words changed: it is a new line, all its guardrails are asked; its old `~` line with its source still there rides the source's ask
103
- for (const l of lines) {
104
- const s = free(l.n, e.ruleText);
105
- const a = s ? rules.find((r) => r.line === l.n && r !== s && !claimed.has(id(r)) && !folded.has(id(r)) && norm(r.text) === norm(e.added ?? '')) : undefined;
106
- if (a) { folded.add(id(a)); break; }
107
- }
108
- continue;
109
- }
110
- const src = free(n, e.ruleText);
111
- const add = free(n, e.added);
112
- if (src && !add) {
113
- // the added line was edited (or deleted): the unclaimed rule right after the source on that line is it. M10 am21: the ONE ask is about THAT line's words
114
- // (it carries the source's number as `pairRule`, the rule its pick is kept under); the source rides it and is not asked on its own
115
- const p = rules.find((r) => r.line === n && r.rule > src.rule && !claimed.has(id(r)) && !folded.has(id(r)));
116
- if (p) { folded.add(id(src)); edited.set(id(p), src.rule); }
117
- } else if (add && !src) {
118
- // the source was edited: the unclaimed rule right before the added line is it; the old added line rides that ask
119
- const p = [...rules].reverse().find((r) => r.line === n && r.rule < add.rule && !claimed.has(id(r)) && !folded.has(id(r)));
120
- if (p) folded.add(id(add));
121
- }
79
+ const src = n === undefined ? undefined : rules.find((r) => r.line === n && !claimed.has(id(r)) && norm(r.text) === norm(e.ruleText));
80
+ if (!src) continue;
81
+ claimed.add(id(src));
82
+ kept.push({ line: /** @type {number} */ (n), rule: src.rule, entry: e });
122
83
  }
123
84
  const picks = [];
124
85
  const left = [];
125
86
  for (const k of kept) {
126
87
  const e = k.entry;
127
88
  if (e.left) left.push({ line: k.line, rule: k.rule });
128
- else picks.push({ line: k.line, rule: k.rule, check: e.check, ...(e.added === null ? {} : { added: e.added }), ...(e.own ? { own: true } : {}) });
89
+ else picks.push({ line: k.line, rule: k.rule, check: e.check, ...(e.own ? { own: true } : {}) });
129
90
  }
130
- return { picks, left, kept, askRules: rules.filter((r) => !claimed.has(id(r)) && !folded.has(id(r))).map((r) => (edited.has(id(r)) ? { ...r, pairRule: edited.get(id(r)) } : r)) };
91
+ return { picks, left, kept, askRules: rules.filter((r) => !claimed.has(id(r))) };
131
92
  }
132
93
 
133
94
  /**
package/src/planrun.js CHANGED
@@ -45,7 +45,6 @@ import { globToPrefix, redactSecrets, SECRET_PATTERNS } from './validate.js';
45
45
  import { startAttemptDiff } from './attemptdiff.js';
46
46
  import { validateBridge, loadGate, newestEligibleVersion, reuseEligibility, quarantinesCredit, QUARANTINED_CODE } from './bridges.js';
47
47
  import { extractArtifact, rateSourceFields } from './text.js';
48
- import { defaultJudgeLoop } from './judged.js';
49
48
  import { workerThinkingMode, thinkingCallOptions } from './thinking.js';
50
49
  export { rateSourceFields };
51
50
  import { createClock, isWallTimeout } from './clock.js';
@@ -848,21 +847,6 @@ ${scoutBlob || '(no scout notes)'}`;
848
847
  * @param {{in: number, out: number}|null} [opts.rates] the customer's own price for the worker's key row (USD per
849
848
  * 1K tokens, `ratesFor`) — handed to the one Loop that drives worker, scout and planner rounds, so they read
850
849
  * `rateSource:'caller'`; null = bare-agent's built-in guess. Not applied to a native (CLI) session, which reports its own cost.
851
- * @param {{in: number, out: number}|null} [opts.judgeRates] the same, for the judge's Loop
852
- * @param {string|null} [opts.judgeModel] softgreen — WHICH model that judge provider drives
853
- * (PRD item 32.1). Resolved by the CALLER (`resolveJudge`, src/judged.js: the spec's signed
854
- * `judge` override, else the job's own worker model), never pinned in this library. It
855
- * travels with `judgeProvider` or the judged stage stops as a wiring gap: a verdict whose
856
- * grader cannot be named is a floor nobody can attribute.
857
- * @param {any} [opts.judgeProvider] softgreen — the provider a JUDGED close stage runs its
858
- * locate call through, built by the CALLER from the RESOLVED judge identity (PRD item
859
- * 32.1: `resolveJudge`, src/judged.js — the spec's signed `judge` override, else the job's
860
- * own worker provider and model), never pinned in this library. Separate
861
- * from `provider`/`providerFor` on purpose: the judge tier is not a step knob and never
862
- * agent-selectable, and the worker's binding is not a legal stand-in for it. Absent is not
863
- * a fall-back — a judged stage with no seam instrument-STOPS as a wiring gap, the same
864
- * answer a native job with no `nativeProvider` gets. A close with no judged stage never
865
- * reads it.
866
850
  * @param {(type: string, data?: object) => object} opts.emit spine emitter (the caller's METERED emit)
867
851
  * @param {() => number} opts.remainingUsd the one wallet: what is left of the signed budget right now
868
852
  * @param {() => boolean} [opts.isUnpriced] has any round come back with a null cost? (F6) — the
@@ -1080,7 +1064,7 @@ ${scoutBlob || '(no scout notes)'}`;
1080
1064
  * 'branch-red' | 'cap-halt' | 'wall-halt' | 'stopped' | 'provider-red' | 'interpreter-red' |
1081
1065
  * 'step-stalled' | 'hitl-pause' | 'hitl-decision-red' | `step-red:<id>`
1082
1066
  */
1083
- export async function runPlan(job, { workdir, provider, nativeProvider, providerFor, judgeProvider = null, judgeModel = null, rates = null, judgeRates = null, emit, remainingUsd, isUnpriced = () => false, spendComplete = () => true, capRuns = 3, strikeLimit = STRIKE_LIMIT, closeTimeoutMs, closeDir = null, maxStepRounds = 40, layerRoot = false, readShim = false, scout = true, scoutRounds = SCOUT_ROUNDS, bridge = null, now, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, priorSpentUsd = 0, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null }) {
1067
+ export async function runPlan(job, { workdir, provider, nativeProvider, providerFor, rates = null, emit, remainingUsd, isUnpriced = () => false, spendComplete = () => true, capRuns = 3, strikeLimit = STRIKE_LIMIT, closeTimeoutMs, closeDir = null, maxStepRounds = 40, layerRoot = false, readShim = false, scout = true, scoutRounds = SCOUT_ROUNDS, bridge = null, now, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, priorSpentUsd = 0, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null }) {
1084
1068
  // MEMORY-CACHE: what the read shim (src/readshim.js) saved THIS run, summed across
1085
1069
  // every mkWorker's own shim instance (scout, drafter, each step's worker, the fix
1086
1070
  // worker) — one accumulator closed over by all of them, because the shim's ledger
@@ -1789,27 +1773,6 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
1789
1773
  // arbiter-owned fact reaches a stage: through the ctx, never through the
1790
1774
  // declaration. A command close has no human stage to hand it to.
1791
1775
  humanRuling: liveRuling,
1792
- // SOFTGREEN — the judged stage's paid seam and its meter, the same way: through
1793
- // the ctx, never the declaration. The seam is null unless the operator wired a
1794
- // pinned judge provider (a judged stage then STOPS as a wiring gap rather than
1795
- // grading on the worker's model). The meter emits a distinct `judge-round`
1796
- // record carrying the call's own honest cost — the SAME emit the worker rounds
1797
- // ride, so `runJob`'s ONE ledger accounts a close's spend exactly as it accounts
1798
- // an attempt's (a budget funds the attempt PLUS its close), and a null cost trips
1799
- // the same F6 pricing halt rather than being laundered into $0.
1800
- judgeLoop: judgeProvider ? (/** @type {{system: string}} */ o) => defaultJudgeLoop({ provider: judgeProvider, system: o.system, rates: judgeRates, thinking: job.thinking === true }) : null,
1801
- // the seam's other half (PRD item 32.1) — WHICH model that loop drives. Passed
1802
- // through untouched: this module resolves no judge, exactly as it constructs no
1803
- // provider. `runJudgedFloor` stops as a wiring gap when it is absent rather than
1804
- // falling back to a library pin, so a null here is a stop and never a default.
1805
- ...(judgeModel === null ? {} : { judgeModel }),
1806
- // F152/PRD 30.4 — the judge's locate call carried NO time bound at all: a
1807
- // live endpoint that accepts and never answers hung the process forever
1808
- // (measured), because an open socket is an active handle and no backstop
1809
- // can fire on it. The SAME derivation every worker round already uses,
1810
- // handed through as the FUNCTION (not a snapshot) so a retried locate call
1811
- // re-reads the remaining time rather than reusing the first attempt's.
1812
- callBounds,
1813
1776
  // REPORT-ONLY: what a rubric-step stage's cited checks read (bareguard `full.evidence`), recorded as `rubric-evidence` for the Result
1814
1777
  // tab's highlights. No verdict, gap, governor or money path reads it. Masked HERE with the run's one `scrub`: the `text` is a quote from
1815
1778
  // the frozen page record, and the spine is append-only. Masking moves offsets, so an entry whose text changed keeps NO spans.
@@ -1824,15 +1787,6 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
1824
1787
  }),
1825
1788
  ...(e.evidenceTotal !== undefined ? { evidenceTotal: e.evidenceTotal } : {}),
1826
1789
  }),
1827
- onJudgeCost: (/** @type {any} */ c) => emit('judge-round', {
1828
- stage: c.stage, path: c.path, attempt: c.attempt, label: c.label, model: c.model,
1829
- costUsd: c.costUsd, unpricedRounds: c.unpricedRounds,
1830
- // BA-21 provenance, through the SAME helper the worker rounds use — this record
1831
- // is on `spendProvenance`'s read list (src/ledger.js). The judge cost payload
1832
- // (src/kinds.js `onJudgeCost`) forwards the field when the judge Loop carried it
1833
- // (`defaultJudgeLoop`); a loop that metered no rate leaves the key absent (UNKNOWN).
1834
- ...rateSourceFields(c),
1835
- }),
1836
1790
  })
1837
1791
  : runStages(stages, scrub, closeOpts));
1838
1792
  /**
@@ -2163,7 +2117,7 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
2163
2117
  }
2164
2118
  const listed = await seedListing(workdir, s.seedRef);
2165
2119
  const v = listed.stop === null
2166
- ? validateCloseDecl(job.closeDecl, { at: 'closeDecl', listing: listed.files, verdictType: job.verdictType, writeScope: job.writeScope, jobLines: Array.isArray(job.jobLines) ? job.jobLines : null , inputLabels: inputLabelsOf(job.inputs) })
2120
+ ? validateCloseDecl(job.closeDecl, { at: 'closeDecl', listing: listed.files, verdictType: job.verdictType, jobLines: Array.isArray(job.jobLines) ? job.jobLines : null , inputLabels: inputLabelsOf(job.inputs) })
2167
2121
  : { ok: false, grounded: false, reds: [{ code: 'listing-unreadable', path: 'closeDecl', detail: listed.stop }] };
2168
2122
  emit('close-decl', {
2169
2123
  genre: job.closeDecl.genre,
@@ -8,8 +8,7 @@
8
8
  // rule applies to, and this file's own doc-comment is where a human reads it.
9
9
  //
10
10
  // The inventory is FILE-scoped, not const-scoped. Several of the files below
11
- // hold more than one named prompt const, and at least two (authorscout.js,
12
- // cardauthor.js) also build a model-facing prompt INLINE inside a function
11
+ // hold more than one named prompt const, and at least one (authorscout.js) also build a model-facing prompt INLINE inside a function
13
12
  // (template literals, not a top-level const) rather than assembling one from a
14
13
  // named export. A const-scoped check would silently miss those; a file-scoped
15
14
  // one does not, because the whole file is in scope once it appears here. The
@@ -20,7 +19,7 @@
20
19
  // consts that read as model-facing instruction text, and separately for inline
21
20
  // template-literal prompts built inside a function). Files checked and found to
22
21
  // carry NO prompt content: src/plan.js, src/validate.js, src/kinds.js,
23
- // src/text.js, src/declaredclose.js, src/calibrate.js, src/index.js (the last
22
+ // src/text.js, src/declaredclose.js, src/index.js (the last
24
23
  // is the barrel export only).
25
24
 
26
25
  /**
@@ -51,24 +50,10 @@ export const PROMPT_REGISTERS = Object.freeze([
51
50
  Object.freeze({ file: 'src/authorflow.js', name: 'CONFIRM_STRUCTURE_INSTRUCTION' }),
52
51
  Object.freeze({ file: 'src/authorflow.js', name: 'confirmedBlock() (inline template, not a const — feeds authorPrompt)' }),
53
52
 
54
- // src/judged.js — the softgreen judge's locate prompt (spine + per-rule asks)
55
- Object.freeze({ file: 'src/judged.js', name: 'PROMPT_HEAD' }),
56
- Object.freeze({ file: 'src/judged.js', name: 'PROMPT_TAIL' }),
57
- Object.freeze({ file: 'src/judged.js', name: 'JUDGE_RULES[*].ask (per-rule fragments)' }),
58
- Object.freeze({ file: 'src/judged.js', name: 'locatePrompt() (inline template, not a const)' }),
59
-
60
- // src/cardauthor.js — compiles a person's own words into a judged rubric
61
- Object.freeze({ file: 'src/cardauthor.js', name: 'COMPILE_SYSTEM' }),
62
- Object.freeze({ file: 'src/cardauthor.js', name: 'cardCasesPrompt() (inline template, not a const)' }),
63
-
64
53
  // src/pagemap.js - the page-word map call (idea A core): the AI names the page's own words for the person's job
65
54
  Object.freeze({ file: 'src/pagemap.js', name: 'MAP_SYSTEM' }),
66
55
  Object.freeze({ file: 'src/pagemap.js', name: 'mapPrompt() (inline template, not a const)' }),
67
56
 
68
- // src/fitcheck.js - the fit check call (F243): the AI splits each job line into asks and quotes the page for each
69
- Object.freeze({ file: 'src/fitcheck.js', name: 'FIT_SYSTEM' }),
70
- Object.freeze({ file: 'src/fitcheck.js', name: 'fitPrompt() (inline template, not a const)' }),
71
-
72
57
  // src/readshim.js — the capped/deduplicating read shim's worker-facing strategy
73
58
  Object.freeze({ file: 'src/readshim.js', name: 'READ_SHIM_STRATEGY' }),
74
59
  Object.freeze({ file: 'src/readshim.js', name: 'READ_SHIM_DIFF_STRATEGY' }),
@@ -367,39 +367,3 @@ export function ratesOfLine(line) {
367
367
  const outPerM = /** @type {number} */ (line.outPerM);
368
368
  return { rates: { in: inPerM / 1000, out: outPerM / 1000 }, inPerM, outPerM };
369
369
  }
370
-
371
- /**
372
- * The row a judge's key and endpoint come from: the worker's own row when the judge shares the worker's API shape, else the judge
373
- * shape's row that ticks the judge's model (else the first row of that shape). `null` when no row is on that shape.
374
- * @param {readonly KeyRow[]} rows
375
- * @param {{ provider: string, model?: string|null }} judge
376
- * @param {string|null|undefined} workerProvider
377
- * @param {KeyRow|null} workerRow
378
- * @returns {KeyRow|null}
379
- */
380
- export function judgeRowFor(rows, judge, workerProvider, workerRow) {
381
- if (judge.provider === workerProvider && workerRow) return workerRow;
382
- const onShape = rows.filter((r) => r.provider === judge.provider);
383
- return onShape.find((r) => r.models.some((l) => l.model === judge.model && isTickedLine(l))) ?? onShape[0] ?? null;
384
- }
385
-
386
- /**
387
- * The price a judge's rounds are booked at. A price belongs to the MODEL's line: when the judge is
388
- * the worker's own provider it calls the worker's endpoint, so a row on that endpoint with a line
389
- * NAMED for the judge's model prices it ({@link ratesFor}); a judge model that is absent or names
390
- * no line there keeps the worker's price (the worker's row, or none = the guess). A different
391
- * provider resolves with no endpoint. The judge's KEY is chosen elsewhere (`judgeRowFor`:
392
- * the worker's own row when the judge shares its provider), so the two can come from different rows.
393
- * @param {{ provider: string, model?: string|null }} judge
394
- * @param {string|null|undefined} workerProvider
395
- * @param {string|null|undefined} workerBaseUrl
396
- * @param {ReturnType<typeof ratesFor>} workerPrice what the worker's own rounds are booked at
397
- * @param {readonly KeyRow[]} rows
398
- * @returns {ReturnType<typeof ratesFor>}
399
- */
400
- export function judgeRatesFor(judge, workerProvider, workerBaseUrl, workerPrice, rows) {
401
- if (judge.provider !== workerProvider) return ratesFor(judge.provider, undefined, rows, judge.model);
402
- const want = endpointOf(judge.provider, workerBaseUrl);
403
- const named = judge.model ? rows.some((r) => r.provider === judge.provider && endpointOf(r.provider, r.baseUrl) === want && r.models.some((l) => l.model === judge.model)) : false;
404
- return named ? ratesFor(judge.provider, workerBaseUrl, rows, judge.model) : workerPrice;
405
- }
package/src/providers.js CHANGED
@@ -169,41 +169,20 @@ export function makeProvider(providerName, { apiKey, model, baseUrl, legacyMaxTo
169
169
  }
170
170
 
171
171
  /**
172
- * Build the `{provider, providerFor, judgeProvider}` triple both authoring runners need (`src/authorrun.js` and
173
- * `src/panel/authorsession.js` call it) — ONE seam instead of two copies of the same construction. `model` is the
174
- * already-RESOLVED worker model id (the caller picked the Settings line).
175
- *
176
- * THE JUDGE IS NOT PINNED (PRD item 32.2): it is constructed through this same factory from a `judgeProviderName`/`judgeModel`
177
- * pair the CALLER resolved. `judgeApiKey` stays a SEPARATE argument: the judge may be a different provider from the worker,
178
- * and each key is read by the caller from its own row.
172
+ * Build the `{provider, providerFor}` pair both authoring runners need (`src/authorrun.js` and `src/panel/authorsession.js` call it) — ONE seam
173
+ * instead of two copies of the same construction. `model` is the already-RESOLVED worker model id (the caller picked the Settings line).
179
174
  * @param {object} args
180
175
  * @param {string} args.providerName the worker's API shape id
181
176
  * @param {string|undefined} args.apiKey the WORKER's key, read from its row's env name
182
177
  * @param {string} args.model the already-resolved worker model id
183
178
  * @param {string|undefined} [args.baseUrl] the worker row's Base URL
184
179
  * @param {boolean} [args.legacyMaxTokens] the worker row's old max_tokens tick
185
- * @param {string|undefined} args.judgeApiKey the judge's own key
186
- * @param {string} args.judgeModel the resolved judge model id
187
- * @param {string} [args.judgeProviderName] the resolved judge shape; defaults to `providerName`
188
- * @param {string|undefined} [args.judgeBaseUrl] the judge row's endpoint
189
- * @param {boolean} [args.judgeLegacyMaxTokens] the judge row's old max_tokens tick (defaults to the worker's when the judge shares its provider)
190
180
  */
191
- export function buildRunnerProviders({
192
- providerName, apiKey, model, baseUrl, legacyMaxTokens = false, judgeApiKey, judgeModel,
193
- judgeProviderName = providerName, judgeBaseUrl = undefined, judgeLegacyMaxTokens = undefined,
194
- }) {
181
+ export function buildRunnerProviders({ providerName, apiKey, model, baseUrl, legacyMaxTokens = false }) {
195
182
  const provider = makeProvider(providerName, { apiKey, model, baseUrl, legacyMaxTokens });
196
183
  // a plan step's `model` is the one schema token `sonnet` (STEP_MODELS, src/plan.js): it means THE JOB'S worker model
197
184
  const providerFor = (/** @type {string} */ _tier) => provider;
198
- // the judge goes through the SAME table as the worker. Reusing the worker instance when the identity matches exactly is not an
199
- // optimisation for its own sake: a second instance against the same endpoint/model is a second prompt-cache prefix, and cache
200
- // writes are ~41% of the bill.
201
- const judgeLegacy = judgeLegacyMaxTokens ?? (judgeProviderName === providerName ? legacyMaxTokens : false);
202
- const judgeProvider = (judgeProviderName === providerName && judgeModel === model && judgeApiKey === apiKey
203
- && judgeBaseUrl === baseUrl && judgeLegacy === legacyMaxTokens)
204
- ? provider
205
- : makeProvider(judgeProviderName, { apiKey: judgeApiKey, model: judgeModel, baseUrl: judgeBaseUrl, legacyMaxTokens: judgeLegacy });
206
- return { provider, providerFor, judgeProvider };
185
+ return { provider, providerFor };
207
186
  }
208
187
 
209
188
  /**
@@ -4,7 +4,6 @@
4
4
  // questions and keeps typing words; the stored question text never changes, only the panel's copy of it is cut.
5
5
  import { readingTail, cantCheckTail, DROP_IT } from './pagemap.js';
6
6
  import { HOW_TO_ANSWER } from './checkpick.js';
7
- import { FIT_ANSWER, FIT_GO_ON } from './fitcheck.js';
8
7
  import { DEST_ANSWER } from './destpoint.js';
9
8
 
10
9
  /** the door's refusals, word for word (fwd am31); a refusal leaves the question open and writes nothing */
@@ -35,7 +34,6 @@ export function offersOf(q) {
35
34
  */
36
35
  export function panelQuestionText(q) {
37
36
  const text = String(q.question);
38
- if (q.source === 'fit-check') return text.endsWith(FIT_ANSWER) ? text.slice(0, text.length - FIT_ANSWER.length) : text;
39
37
  if (q.source === 'dest-point') return text.endsWith(DEST_ANSWER) ? text.slice(0, text.length - DEST_ANSWER.length) : text;
40
38
  if (q.source !== 'look' || !Number.isInteger(q.line)) return text;
41
39
  const n = /** @type {number} */ (q.line);
@@ -51,11 +49,7 @@ export function panelQuestionText(q) {
51
49
  */
52
50
  export function boxFor(step) {
53
51
  if (step.kind !== 'answer' || typeof step.question !== 'string') return null;
54
- const before = step.source === 'fit-check' || step.source === 'dest-point';
55
- // the fit check: two buttons, no box (go on = keep drafting; stop = anything else, as typed words did)
56
- if (step.source === 'fit-check') {
57
- return { head: 'A question before drafting', line: '', text: panelQuestionText(/** @type {any} */ (step)), choices: [{ choice: 'go-on', label: 'Go on' }, { choice: 'stop', label: 'Stop' }], orLabel: null, sendChoice: 'stop' };
58
- }
52
+ const before = step.source === 'dest-point';
59
53
  // the Destination point: yes / no buttons and a box for a different Destination (checked at $0 before it is taken)
60
54
  if (step.source === 'dest-point') {
61
55
  return {
@@ -79,7 +73,7 @@ export function boxFor(step) {
79
73
  }
80
74
 
81
75
  /** the choices each kind of question's typed answer may name */
82
- const CHOICES = { look: ['agree', 'drop', 'rule'], 'fit-check': ['go-on', 'stop'], 'dest-point': ['yes', 'no', 'path'] };
76
+ const CHOICES = { look: ['agree', 'drop', 'rule'], 'dest-point': ['yes', 'no', 'path'] };
83
77
 
84
78
  /**
85
79
  * The door's check of a choice sent for the pending ask. Null = accepted; else the refusal words.
@@ -87,9 +81,9 @@ const CHOICES = { look: ['agree', 'drop', 'rule'], 'fit-check': ['go-on', 'stop'
87
81
  */
88
82
  export function refuseChoice(step, choice) {
89
83
  if (step.kind !== 'answer') return CHOICE_SAYS.notOffered;
90
- const own = /** @type {string[]|undefined} */ (/** @type {Record<string, string[]>} */ (CHOICES)[step.source === 'fit-check' || step.source === 'dest-point' ? step.source : 'look']);
84
+ const own = /** @type {string[]|undefined} */ (/** @type {Record<string, string[]>} */ (CHOICES)[step.source === 'dest-point' ? step.source : 'look']);
91
85
  if (typeof choice !== 'string' || !(own ?? CHOICES.look).includes(choice)) return CHOICE_SAYS.bad;
92
- if (step.source === 'fit-check' || step.source === 'dest-point') return null;
86
+ if (step.source === 'dest-point') return null;
93
87
  if (choice === 'agree' && step.offers?.agree !== true) return CHOICE_SAYS.notOffered;
94
88
  if (choice === 'drop' && step.offers?.drop !== true) return step.source === 'look' && !Number.isInteger(step.rule) ? CHOICE_SAYS.noRule : CHOICE_SAYS.notOffered;
95
89
  return null;
@@ -103,8 +97,6 @@ export function refuseChoice(step, choice) {
103
97
  export function resolveChoice(choice, text) {
104
98
  if (choice === 'agree') return { value: 'agree', shown: 'Agree' };
105
99
  if (choice === 'drop') return { value: DROP_IT, shown: 'Drop it' };
106
- if (choice === 'go-on') return { value: FIT_GO_ON, shown: 'Go on' };
107
- if (choice === 'stop') return { value: 'stop', shown: 'Stop' };
108
100
  if (choice === 'yes') return { value: 'yes', shown: 'Yes' };
109
101
  if (choice === 'no') return { value: 'no', shown: 'No' };
110
102
  const said = String(text ?? '').replace(/\s*\n\s*/g, ' ').trim();