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.
- package/CHANGELOG.md +35 -0
- package/README.md +3 -3
- package/bareloop.context.md +65 -207
- package/package.json +2 -2
- package/src/authorflow.js +25 -78
- package/src/authoring.js +5 -124
- package/src/authorjob.js +33 -395
- package/src/authorreadout.js +17 -355
- package/src/authorrun.js +8 -211
- package/src/blockasks.js +2 -2
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +76 -50
- package/src/checklist.js +1 -1
- package/src/checkpick.js +10 -1
- package/src/cli.js +3 -3
- package/src/declaredclose.js +11 -110
- package/src/destpoint.js +1 -1
- package/src/index.js +3 -43
- package/src/interviewrun.js +13 -8
- package/src/job.js +20 -1
- package/src/jobblock.js +11 -46
- package/src/judged.js +13 -1229
- package/src/kinds.js +5 -347
- package/src/noteask.js +124 -0
- package/src/pagedry.js +27 -5
- package/src/pagemap.js +2 -2
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +9 -3
- package/src/panel/authorsession.js +99 -141
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +6 -6
- package/src/panel/jobplan.js +7 -5
- package/src/panel/server.js +25 -64
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +15 -54
- package/src/planrun.js +2 -48
- package/src/promptregisters.js +2 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +4 -12
- package/src/rubricstep.js +26 -6
- package/src/run.js +2 -15
- package/src/userrun.js +14 -111
- package/types/authorflow.d.ts +9 -58
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +13 -55
- package/types/authorreadout.d.ts +8 -80
- package/types/blockasks.d.ts +1 -2
- package/types/checkblock.d.ts +32 -17
- package/types/checklist.d.ts +2 -2
- package/types/checkpick.d.ts +5 -0
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +3 -33
- package/types/index.d.ts +2 -4
- package/types/job.d.ts +8 -0
- package/types/jobblock.d.ts +8 -38
- package/types/judged.d.ts +7 -357
- package/types/kinds.d.ts +3 -104
- package/types/noteask.d.ts +76 -0
- package/types/pagedry.d.ts +13 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +35 -4
- package/types/panel/jobplan.d.ts +3 -3
- package/types/panel/server.d.ts +13 -5
- package/types/panel/status.d.ts +5 -0
- package/types/pickrecord.d.ts +8 -13
- package/types/planrun.d.ts +1 -22
- package/types/providerrows.d.ts +0 -31
- package/types/providers.d.ts +3 -19
- package/types/rubricstep.d.ts +9 -0
- package/types/run.d.ts +1 -20
- package/types/userrun.d.ts +0 -1
- package/src/calibrate.js +0 -702
- package/src/cardauthor.js +0 -502
- package/src/fitcheck.js +0 -168
- package/types/calibrate.d.ts +0 -201
- package/types/cardauthor.d.ts +0 -358
- package/types/fitcheck.d.ts +0 -119
package/src/checkblock.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
// fromJob -> addLook -> reconcile( match -> build -> ask ), then, while a question is open or a reply waits: apply it and reconcile the WHOLE list again.
|
|
6
6
|
// Pure: no I/O, no clock, no model. Rubric jobs only (repo jobs never run through it).
|
|
7
7
|
import { countExact, countPhrase, checkFactWords, keptSetOf } from './factwords.js';
|
|
8
|
-
import { isCountable, keepOrDrop, countCheck, partOfPick, plainWords, sameRuleWords } from './checkpick.js';
|
|
9
|
-
import { dropRows } from './pagedropwords.js';
|
|
10
|
-
import {
|
|
8
|
+
import { isCountable, keepOrDrop, countCheck, obviousCheck, partOfPick, plainWords, sameRuleWords } from './checkpick.js';
|
|
9
|
+
import { dropRows, dropSentence } from './pagedropwords.js';
|
|
10
|
+
import { phraseInNoResult } from './pagedry.js';
|
|
11
|
+
import { boundInWords, rubricStepShapeReds, defaultCitedText, defaultNoteText, readLimit, holdsManyBounds, NEGATING_RE, WHY_OTHER_CURRENCY } from './rubricstep.js';
|
|
11
12
|
import { validReading } from './pagerules.js';
|
|
12
13
|
import { weekOnly, weekTokens, WEEK_ONLY_WORDS, MAX_BANG } from './checklist.js';
|
|
13
14
|
import { fitPlacePhrase } from './placerule.js';
|
|
@@ -22,7 +23,7 @@ import { factSentence, countSentence } from './facts.js';
|
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
25
|
/** the card's fixed words, one spelling (the renderer reads them; a test reads them too) */
|
|
25
|
-
export const CARD_T = Object.freeze({
|
|
26
|
+
export const CARD_T = Object.freeze({ count: 'result count', cited: 'every claim is backed by a quote copied from', theInput: 'the input', numbers: 'every number in the text is in a checked quote of line', withWords: 'with the words' });
|
|
26
27
|
|
|
27
28
|
/** the four row edits an AI reply may hold */
|
|
28
29
|
export const EDIT_OPS = Object.freeze(['add', 'reading', 'pick', 'not-checkable']);
|
|
@@ -59,9 +60,10 @@ export const REASON = Object.freeze({
|
|
|
59
60
|
export function renderCard(rows) {
|
|
60
61
|
return rows.filter((r) => r.kind !== 'floor' && r.state !== 'suggested' && r.state !== 'dropped' && !r.hidden).map((r) => {
|
|
61
62
|
let body;
|
|
62
|
-
if (r.kind === 'rule') body = `"${r.text}"${r.pick
|
|
63
|
+
if (r.kind === 'rule') body = `"${r.text}"${r.pick && !sameRuleWords(r.text, plainWords(r.pick)) ? ` -> ${plainWords(r.pick)}` : ''}`;
|
|
63
64
|
else if (r.kind === 'count') body = `${CARD_T.count} ${r.min ?? ''}-${r.max ?? ''}`;
|
|
64
65
|
else if (r.kind === 'cited') body = `${CARD_T.cited} "${r.source ?? CARD_T.theInput}"`;
|
|
66
|
+
else if (r.kind === 'note') body = defaultNoteText(r.line);
|
|
65
67
|
else if (r.kind === 'numbers') body = `${CARD_T.numbers} ${(r.after ?? []).join(', ')}`;
|
|
66
68
|
else body = `${r.kind} "${r.name ?? r.words?.[0] ?? ''}"${r.words?.length ? ` ${CARD_T.withWords} ${r.words.map((/** @type {string} */ w) => `"${w}"`).join(', ')}` : ''}`;
|
|
67
69
|
return { key: r.key, line: r.line, by: r.by, state: r.state, reason: r.reason ?? null, text: `${r.by === 'you' ? '~' : r.by === 'agent' ? '!' : '$'} ${body}` };
|
|
@@ -109,12 +111,16 @@ export class CheckBlock {
|
|
|
109
111
|
this.deltaLog = [];
|
|
110
112
|
/** @type {any} */
|
|
111
113
|
this.closeCache = null;
|
|
114
|
+
/** @type {Map<number, 'yes'|'no'|'failed'>} the note question's answer per facts-only line (src/noteask.js; code decides what it means) */
|
|
115
|
+
this.notes = new Map();
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
textOf(/** @type {string|undefined} */ source) { return this.texts[source ?? this.labels[0] ?? ''] ?? Object.values(this.texts)[0] ?? ''; }
|
|
115
119
|
/** @param {number} line @param {string} [kind] */
|
|
116
120
|
rowsOn(line, kind) { return this.rows.filter((r) => r.line === line && (kind === undefined || r.kind === kind)); }
|
|
117
121
|
ruleRows(/** @type {number} */ line) { return this.rows.filter((r) => r.kind === 'rule' && r.line === line); }
|
|
122
|
+
/** does a `~` rule's own row say it is Not checked? Then its row is the ONE place the rule is said (its reason: the look's sentence, or the person's Drop) @param {number} line @param {number} rule */
|
|
123
|
+
saysRule(line, rule) { return this.rows.some((r) => r.kind === 'rule' && r.line === line && r.rule === rule && r.state === 'not-checked' && typeof r.reason === 'string' && r.reason !== ''); }
|
|
118
124
|
/** every word the person wrote on a line: the line and its `~` rules */
|
|
119
125
|
said(/** @type {number} */ line) { return [this.lines.find((l) => l.n === line)?.text ?? '', ...this.ruleRows(line).map((r) => r.text)].join(' '); }
|
|
120
126
|
/** @param {Row} r @returns {Row} the row as stored (a repeated key gets `#2`) */
|
|
@@ -170,8 +176,6 @@ export class CheckBlock {
|
|
|
170
176
|
if (r.kind === 'floor') continue;
|
|
171
177
|
if (r.left) r.can = { ok: false, why: REASON.left };
|
|
172
178
|
else if (r.lookWhy && r.kind === 'fact' && !r.words.length) r.can = { ok: false, why: r.lookWhy };
|
|
173
|
-
else if (r.folded) r.can = { ok: false, why: REASON.noPick };
|
|
174
|
-
else if (r.parent) this.matchFollow(r);
|
|
175
179
|
else if (r.kind === 'rule') this.matchRule(r);
|
|
176
180
|
else if (r.kind === 'fact' || r.kind === 'phrase') this.matchBang(r);
|
|
177
181
|
else if (r.kind === 'count') this.matchCount(r);
|
|
@@ -188,7 +192,7 @@ export class CheckBlock {
|
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
/** a `!` row: the agent's fact, phrase or count (a look fact tied to a rule is a link on that rule's row, never a row of its own) */
|
|
191
|
-
isBang(/** @type {Row} */ r) { return r.by === 'agent' && (r.kind === 'fact' || r.kind === 'phrase' || r.kind === 'count')
|
|
195
|
+
isBang(/** @type {Row} */ r) { return r.by === 'agent' && (r.kind === 'fact' || r.kind === 'phrase' || r.kind === 'count'); }
|
|
192
196
|
|
|
193
197
|
/**
|
|
194
198
|
* The job's own word for a `!` row: when none of its page words is in the job line or its `~` rules but a proper name the job holds (capital or digit first, 3+ characters) is a whole-word part of one
|
|
@@ -212,12 +216,6 @@ export class CheckBlock {
|
|
|
212
216
|
return (r.words ?? []).some((/** @type {string} */ w) => inText(said, w)) || (r.kind === 'fact' && typeof r.name === 'string' && inText(said, r.name));
|
|
213
217
|
}
|
|
214
218
|
|
|
215
|
-
/** a `~` line an agreed answer wrote (or a carried pair partner) is checked by the rule it was agreed from: one check, both numbers */
|
|
216
|
-
matchFollow(/** @type {Row} */ r) {
|
|
217
|
-
const parent = this.rows.find((x) => x.key === r.parent);
|
|
218
|
-
r.can = parent?.can?.ok ? { ok: true, how: 'follow' } : { ok: false, why: parent?.can?.why ?? 'the rule it was agreed from is not checked' };
|
|
219
|
-
}
|
|
220
|
-
|
|
221
219
|
/** a `!` count row is built unless a `~` rule on its line already names the number */
|
|
222
220
|
matchCount(/** @type {Row} */ r) {
|
|
223
221
|
const nums = [r.min, r.max].filter((x) => Number.isInteger(x)).map(String);
|
|
@@ -234,12 +232,16 @@ export class CheckBlock {
|
|
|
234
232
|
const links = (r.links ?? []).filter((/** @type {any} */ l) => !(negated && isPhrase(l)) && l.words.some((/** @type {string} */ w) => proved(this.textOf(l.source), w)));
|
|
235
233
|
const said = this.said(r.line);
|
|
236
234
|
let ownWhy = null;
|
|
235
|
+
let otherCurrency = false;
|
|
237
236
|
for (const l of links) {
|
|
238
237
|
let reading = l.reading;
|
|
239
238
|
let ownWords = false;
|
|
240
239
|
if (l.shape === 'money' || l.shape === 'time') {
|
|
241
240
|
// the person's words win (hamr 2026-11-13): code's reading of the `~` words beats the look's and the AI's; theirs is used only when code cannot read the words
|
|
242
241
|
const rd = this.wordsReading(l, r.text);
|
|
242
|
+
// fwdloop run walk-m16-flights run-1: "under $150" on a euro fact fell back to the look's reading and checked 150 euros; a bound in another currency than the page fact is never replaced by the look's or the AI's reading
|
|
243
|
+
const lim = !rd && l.shape === 'money' ? readLimit('money', r.text, l) : null;
|
|
244
|
+
if (lim && 'why' in lim && lim.why === WHY_OTHER_CURRENCY) { otherCurrency = true; continue; }
|
|
243
245
|
if (rd) { reading = rd; ownWords = true; }
|
|
244
246
|
else if (reading === undefined) {
|
|
245
247
|
const own = readLimit(l.shape, r.text, l);
|
|
@@ -267,6 +269,7 @@ export class CheckBlock {
|
|
|
267
269
|
r.can = { ok: true, how: 'fact', link: l, reading: undefined };
|
|
268
270
|
return;
|
|
269
271
|
}
|
|
272
|
+
if (otherCurrency) { r.can = { ok: false, why: `the amount in your rule is in another currency than the page's prices, so it is not checked.` }; return; }
|
|
270
273
|
if (r.links?.length && !links.length) { r.can = { ok: false, why: REASON.lookNoWords }; return; }
|
|
271
274
|
if (r.origin === 'typed' || r.cantAsked) { r.can = { ok: false, why: r.aiReason ?? r.lookWhy ?? REASON.nothingOnPage }; return; }
|
|
272
275
|
if (r.links?.length) { r.can = { ok: false, why: r.aiReason ?? `the look tied a fact to this rule but gave no limit, and ${ownWhy ? `in your words ${ownWhy}` : 'your own words give none code can read'}, so you judge it at Accept.` }; return; }
|
|
@@ -277,6 +280,12 @@ export class CheckBlock {
|
|
|
277
280
|
matchCountRule(/** @type {Row} */ r) {
|
|
278
281
|
if (!r.pick && (r.cantAsked || !this.countScope(r.text))) { r.can = { ok: false, why: r.aiReason ?? REASON.noRule }; return; }
|
|
279
282
|
if (r.pick) { r.can = { ok: true, how: 'pick' }; return; }
|
|
283
|
+
// no obvious asks (hamr 2026-11-14): a rule whose words ARE the check ("exactly 3 list items") is settled as it stands, so a replaced rule never re-asks on a re-draft or a Reuse
|
|
284
|
+
const obvious = obviousCheck(r.text);
|
|
285
|
+
if (obvious) {
|
|
286
|
+
const res = keepOrDrop(r.text, /** @type {any} */ ({ ...obvious }));
|
|
287
|
+
if (res.kept) { r.pick = res.check; r.from = 'pick'; r.can = { ok: true, how: 'pick' }; return; }
|
|
288
|
+
}
|
|
280
289
|
const proposal = r.pickProposal ?? countCheck(r.text);
|
|
281
290
|
if (!this.asks) r.can = { ok: false, why: REASON.noRule };
|
|
282
291
|
else if (proposal) r.can = { ok: false, ask: 'check', proposal, why: REASON.waitingPick };
|
|
@@ -300,6 +309,12 @@ export class CheckBlock {
|
|
|
300
309
|
r.can = { ok: true, how: 'place', strips: fits[0] ?? [] };
|
|
301
310
|
return;
|
|
302
311
|
}
|
|
312
|
+
// fwdloop run walk-m16-flights run-1: "Rome" was on the page (search box, toggles) but in no result row, so no run could pass it. When the line's look reads result rows (a money fact), a phrase in none of them is refused with the look's own sentence (one owner: pagedry.js + pagedropwords.js)
|
|
313
|
+
// (a look fact already went through the same dry read in pagemap.js, so only the AI's own adds are read here)
|
|
314
|
+
if (r.from === 'agent' && (r.shape ?? 'phrase') === 'phrase') {
|
|
315
|
+
const money = this.lookFacts.filter((/** @type {any} */ f) => f.line === r.line && f.shape === 'money' && (!r.source || !f.source || f.source === r.source));
|
|
316
|
+
if (phraseInNoResult(text, money, provedWords[0])) { r.can = { ok: false, why: dropSentence({ line: r.line, fact: r.name ?? provedWords[0], other: provedWords[0], reason: 'phrase-no-result' }) }; return; }
|
|
317
|
+
}
|
|
303
318
|
r.can = { ok: true, how: 'bang', word: provedWords[0] };
|
|
304
319
|
}
|
|
305
320
|
|
|
@@ -360,11 +375,10 @@ export class CheckBlock {
|
|
|
360
375
|
for (const r of this.rowsOn(l.n)) {
|
|
361
376
|
if (r.kind === 'floor') continue;
|
|
362
377
|
r.part = null;
|
|
363
|
-
if (r.parent) continue; // a follow row copies its parent's end state after the line is built
|
|
364
378
|
if (!r.can?.ok) { r.state = 'not-checked'; r.reason = r.can?.why ?? 'not checked'; continue; }
|
|
365
379
|
if (r.held) { r.state = 'suggested'; r.reason = r.choice === 'drop' ? REASON.dropped : REASON.suggested; continue; }
|
|
366
380
|
if (r.can.how === 'pick') {
|
|
367
|
-
const p = partOfPick(r.pick, r.text, [r.rule
|
|
381
|
+
const p = partOfPick(r.pick, r.text, [r.rule]);
|
|
368
382
|
const reds = rubricStepShapeReds({ step: l.n, parts: [p] }, 'trial');
|
|
369
383
|
if (reds.length) { r.state = 'not-checked'; r.reason = `the pick is not a legal check: ${reds[0].detail}`; continue; }
|
|
370
384
|
pickParts.push({ p, key: r.key }); r.state = 'built'; r.reason = null;
|
|
@@ -376,7 +390,7 @@ export class CheckBlock {
|
|
|
376
390
|
facts.push(...built.fresh);
|
|
377
391
|
r.factNames = built.names;
|
|
378
392
|
factRows.push({ r, src: built.src });
|
|
379
|
-
if (r.kind === 'rule') rulesCarried.push(r.rule
|
|
393
|
+
if (r.kind === 'rule') rulesCarried.push(r.rule);
|
|
380
394
|
r.state = 'built'; r.reason = null;
|
|
381
395
|
}
|
|
382
396
|
if (facts.length) {
|
|
@@ -391,15 +405,8 @@ export class CheckBlock {
|
|
|
391
405
|
} else if (countRow) { countRow.state = 'not-checked'; countRow.reason = REASON.countNeedsFact; }
|
|
392
406
|
for (const { p, key } of pickParts) { lineParts.push(p); lineRows.push([key]); }
|
|
393
407
|
this.buildDefaults(l, lineParts, lineRows, factLines);
|
|
394
|
-
for (const f of this.rowsOn(l.n).filter((x) => x.parent)) {
|
|
395
|
-
const par = this.rows.find((x) => x.key === f.parent);
|
|
396
|
-
f.state = par?.state ?? 'not-checked'; f.reason = par?.state === 'built' ? null : (par?.reason ?? 'not checked'); f.part = par?.part ?? null;
|
|
397
|
-
}
|
|
398
408
|
}
|
|
399
409
|
|
|
400
|
-
/** the follow rows of a row (its agreed or carried `~` lines) */
|
|
401
|
-
followsOf(/** @type {Row} */ r) { return this.rows.filter((x) => x.parent === r.key); }
|
|
402
|
-
|
|
403
410
|
/**
|
|
404
411
|
* The fact(s) a fact-like row builds, checked alone through the bareguard shapes and against the facts already on the line.
|
|
405
412
|
* @param {Row} r @param {any[]} onLine the facts already built on this line @returns {{fresh: any[], src: string, names: string[]} | {why: string}}
|
|
@@ -444,7 +451,7 @@ export class CheckBlock {
|
|
|
444
451
|
const cited = this.rowsOn(l.n, 'cited')[0] ?? this.addRow({ key: `L${l.n}.$cited`, line: l.n, kind: 'cited', by: 'default', from: 'default', source: this.labels[0] });
|
|
445
452
|
const numbers = this.rowsOn(l.n, 'numbers')[0] ?? null;
|
|
446
453
|
cited.part = null;
|
|
447
|
-
if (factLines.has(l.n)) { cited.state = 'not-checked'; cited.reason = REASON.onePerLine; return; }
|
|
454
|
+
if (factLines.has(l.n)) { cited.state = 'not-checked'; cited.reason = REASON.onePerLine; this.buildNote(l, lineParts, lineRows); return; }
|
|
448
455
|
const only = this.labels.length === 1 ? this.labels[0] : null;
|
|
449
456
|
if (only) { lineParts.push({ text: defaultCitedText(only), class: 'countable', check: 'cited', source: only }); lineRows.push([cited.key]); cited.state = 'built'; cited.reason = null; }
|
|
450
457
|
else { cited.state = 'not-checked'; cited.reason = REASON.manyInputs; }
|
|
@@ -455,6 +462,28 @@ export class CheckBlock {
|
|
|
455
462
|
lineRows.push([nr.key]); nr.state = 'built'; nr.reason = null; nr.part = null;
|
|
456
463
|
}
|
|
457
464
|
|
|
465
|
+
/**
|
|
466
|
+
* The `$` note row of a facts-only line (build 2026-11-14 (b)): the one note question said yes -> a countable nonEmpty text part sits beside the facts (the existing keep-both shape), so the brief
|
|
467
|
+
* is FACTS AND TEXT and text-present is floored; no -> nothing; the call failed -> a Not checked row in plain words. One owner of the row and its part.
|
|
468
|
+
*/
|
|
469
|
+
buildNote(/** @type {{n: number}} */ l, /** @type {any[]} */ lineParts, /** @type {string[][]} */ lineRows) {
|
|
470
|
+
const ans = this.notes.get(l.n);
|
|
471
|
+
if (ans !== 'yes' && ans !== 'failed') return;
|
|
472
|
+
const row = this.rowsOn(l.n, 'note')[0] ?? this.addRow({ key: `L${l.n}.$note`, line: l.n, kind: 'note', by: 'default', from: 'default' });
|
|
473
|
+
if (ans === 'failed') { row.state = 'not-checked'; row.reason = `could not ask whether line ${l.n} also wants a note`; row.part = null; return; }
|
|
474
|
+
lineParts.push({ text: defaultNoteText(l.n), class: 'countable', check: 'nonEmpty' });
|
|
475
|
+
lineRows.push([row.key]); row.state = 'built'; row.reason = null;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** the job lines that ended up facts-only (a fact part and no text beside it): the lines the note question is about. Reconciles first. @returns {number[]} */
|
|
479
|
+
factOnlyLines() {
|
|
480
|
+
const c = this.reconcile();
|
|
481
|
+
return c.stages.filter((/** @type {any} */ st) => st.params.parts.some((/** @type {any} */ p) => p.class === 'fact') && !st.params.parts.some((/** @type {any} */ p) => p.class === 'countable')).map((/** @type {any} */ st) => st.params.step);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** the note question's answers, `{line, answer: 'yes'|'no'|'failed'}`; the whole list is reconciled again @param {{line: number, answer: 'yes'|'no'|'failed'}[]} answers */
|
|
485
|
+
setNotes(answers) { for (const a of answers) this.notes.set(a.line, a.answer); this.reconcile(); }
|
|
486
|
+
|
|
458
487
|
// 5. the code-forced questions for rows code cannot settle (a person answers; the CHOICE decides, never the words). Cap 3 is the caller's (MAX_QUESTIONS).
|
|
459
488
|
ask() {
|
|
460
489
|
this.open = [];
|
|
@@ -467,7 +496,8 @@ export class CheckBlock {
|
|
|
467
496
|
hasOpenQuestions() { return this.open.length > 0; }
|
|
468
497
|
hasPendingDelta() { return this.queue.length > 0; }
|
|
469
498
|
|
|
470
|
-
// 6. the person's answer: a row edit from the typed CHOICE (agree | drop | rule)
|
|
499
|
+
// 6. the person's answer: a row edit from the typed CHOICE (agree | drop | rule). ONE rule in, ONE rule out (hamr 2026-11-14, superseding the 2026-11-12 ruling that an agreed answer is a new `~` line):
|
|
500
|
+
// the answer REPLACES the asked rule, same line and same rule number; this list is the one owner (the job text is rebuilt from it, `jobLinesView`).
|
|
471
501
|
/** @param {string} qKey @param {string} choice @param {string} [text] @returns {{ok: true} | {ok: false, why: string}} */
|
|
472
502
|
applyAnswer(qKey, choice, text) {
|
|
473
503
|
const q = this.open.find((x) => x.key === qKey);
|
|
@@ -479,50 +509,46 @@ export class CheckBlock {
|
|
|
479
509
|
if (q.ask === 'check') {
|
|
480
510
|
const res = keepOrDrop(r.text, /** @type {any} */ ({ ...q.proposal }));
|
|
481
511
|
if (!res.kept) return { ok: false, why: String(res.why) };
|
|
482
|
-
r.pick = res.check; r.from = 'pick';
|
|
483
|
-
said =
|
|
484
|
-
} else
|
|
485
|
-
|
|
486
|
-
if (r.pairWith !== undefined) r.text = said;
|
|
487
|
-
else {
|
|
488
|
-
// F318: agreeing to words the line already holds as a `~` rule adds no second line (the pick cites the rule that is there); a reading always adds its line
|
|
489
|
-
const held = q.ask === 'check' ? this.ruleRows(r.line).filter((x) => sameRuleWords(x.text, said)).at(-1) : undefined;
|
|
490
|
-
if (held === undefined) this.addRow({ key: `L${r.line}.~${this.ruleRows(r.line).length + 1}`, line: r.line, kind: 'rule', by: 'you', from: 'rule', origin: 'agreed', parent: r.key, text: said, rule: this.ruleRows(r.line).length + 1 });
|
|
491
|
-
else if (held !== r) this.follow(r, held);
|
|
492
|
-
}
|
|
512
|
+
r.pick = res.check; r.from = 'pick';
|
|
513
|
+
said = plainWords(/** @type {any} */ (res.check));
|
|
514
|
+
} else r.agreed = true;
|
|
515
|
+
r.text = said;
|
|
493
516
|
return { ok: true };
|
|
494
517
|
}
|
|
495
518
|
if (choice === 'drop') { r.left = true; return { ok: true }; }
|
|
496
519
|
if (choice === 'rule') {
|
|
497
520
|
const said = String(text ?? '').replace(/\s+/g, ' ').trim();
|
|
498
521
|
if (!said) return { ok: false, why: 'an answer is needed' };
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
this.addRow({ key: `L${r.line}.~${n}`, line: r.line, kind: 'rule', by: 'you', from: 'rule', origin: 'typed', text: said, rule: n });
|
|
522
|
+
// the person's own words are the rule now (typed); a counting rule is judged again as written (settled when its words are the proposal), any other stays the person's to judge
|
|
523
|
+
r.text = said; r.origin = 'typed'; r.cantAsked = !isCountable(said);
|
|
502
524
|
return { ok: true };
|
|
503
525
|
}
|
|
504
526
|
return { ok: false, why: 'not one of the choices' };
|
|
505
527
|
}
|
|
506
528
|
|
|
507
|
-
/**
|
|
508
|
-
|
|
529
|
+
/**
|
|
530
|
+
* The job lines as the list now holds them: every line's `~` rules are the rule rows' own words, in rule order (a replaced rule keeps its place and number). ONE owner of the job text after an answer.
|
|
531
|
+
* @template {{n: number, text: string}} L @param {L[]} jobLines @returns {(L & {rule: string, rules: string[]})[]}
|
|
532
|
+
*/
|
|
533
|
+
jobLinesView(jobLines) {
|
|
534
|
+
return jobLines.map((l) => {
|
|
535
|
+
const rules = this.ruleRows(l.n).sort((a, b) => a.rule - b.rule).map((r) => String(r.text));
|
|
536
|
+
return { ...l, rule: rules.join('; '), rules };
|
|
537
|
+
});
|
|
538
|
+
}
|
|
509
539
|
|
|
510
540
|
/**
|
|
511
|
-
* Revise keeps the picks of the last draft (am17/am18
|
|
512
|
-
*
|
|
513
|
-
* @param {{picks?: {line: number, rule: number, check: any, added?: string, own?: boolean}[], left?: {line: number, rule: number}[]}} kept
|
|
514
|
-
* @param {{line: number, rule: number, pairRule?: number}[]} [asked] the rules still asked (a `pairRule` marks an edited added line)
|
|
541
|
+
* Revise keeps the picks of the last draft (am17/am18, `src/pickrecord.js` `matchRecord`): a kept pick settles its rule (its words are the final rule's words) and a kept left rule is left.
|
|
542
|
+
* @param {{picks?: {line: number, rule: number, check: any, own?: boolean}[], left?: {line: number, rule: number}[]}} kept
|
|
515
543
|
*/
|
|
516
|
-
carry({ picks = [], left = [] }
|
|
544
|
+
carry({ picks = [], left = [] }) {
|
|
517
545
|
const rowOf = (/** @type {number} */ line, /** @type {number} */ rule) => this.ruleRows(line).find((x) => x.rule === rule);
|
|
518
546
|
for (const p of picks) {
|
|
519
547
|
const r = rowOf(p.line, p.rule);
|
|
520
548
|
if (!r) continue;
|
|
521
|
-
if (p.check) { r.pick = p.check; r.from = 'pick'; r.keptFromLast = true;
|
|
522
|
-
if (typeof p.added === 'string') { const add = this.ruleRows(p.line).filter((x) => x !== r && !x.parent && sameRuleWords(x.text, String(p.added))).at(-1); if (add) this.follow(r, add); }
|
|
549
|
+
if (p.check) { r.pick = p.check; r.from = 'pick'; r.keptFromLast = true; } else { r.cantAsked = !isCountable(r.text); r.keptFromLast = true; }
|
|
523
550
|
}
|
|
524
551
|
for (const l of left) { const r = rowOf(l.line, l.rule); if (r) { r.left = true; r.keptFromLast = true; } }
|
|
525
|
-
for (const a of asked) if (a.pairRule !== undefined) { const r = rowOf(a.line, a.rule); if (r) { r.pairWith = a.pairRule; const src = rowOf(a.line, a.pairRule); if (src && src !== r) this.follow(r, src); } }
|
|
526
552
|
}
|
|
527
553
|
|
|
528
554
|
// 7. the AI's reply: a list of proposed ROW edits, each judged ALONE; a bad edit is refused on its own and costs the rest nothing
|
package/src/checklist.js
CHANGED
|
@@ -42,7 +42,7 @@ export function weekTokens(t) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* @typedef {{key: string, line: number, kind: 'rule'|'fact'|'cited'|'count'|'phrase'|'numbers'|'floor', from: 'rule'|'pick'|'look'|'agent'|'default', by: 'you'|'agent'|'default',
|
|
45
|
+
* @typedef {{key: string, line: number, kind: 'rule'|'fact'|'cited'|'count'|'phrase'|'numbers'|'note'|'floor', from: 'rule'|'pick'|'look'|'agent'|'default', by: 'you'|'agent'|'default',
|
|
46
46
|
* words: string[], text?: string, rule?: number, part?: {line: number, part: number}, source?: string, name?: string, min?: number, max?: number, pick?: string, after?: number[],
|
|
47
47
|
* state: 'listed'|'built'|'not-checked'|'dropped', reason: string|null, forRule?: number, reading?: import('./pagerules.js').Reading}} Row
|
|
48
48
|
*/
|
package/src/checkpick.js
CHANGED
|
@@ -263,6 +263,15 @@ export function countCheck(text) {
|
|
|
263
263
|
return res.kept ? res.check : null;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
/**
|
|
267
|
+
* The check a counting rule's own words already ARE ("exactly 3 list items" -> listItems 3), or null. No obvious asks (hamr 2026-11-14): such a rule is settled as written, never proposed back to the person.
|
|
268
|
+
* @param {string} text @returns {Record<string, any>|null}
|
|
269
|
+
*/
|
|
270
|
+
export function obviousCheck(text) {
|
|
271
|
+
const c = countCheck(text);
|
|
272
|
+
return c !== null && c !== undefined && sameRuleWords(text, plainWords(/** @type {any} */ (c))) ? c : null;
|
|
273
|
+
}
|
|
274
|
+
|
|
266
275
|
/**
|
|
267
276
|
* What the call's answer comes to, one row per scoped rule: the check kept (or null) and why it was dropped. A rule the answer never mentions is dropped as `no entry`; an
|
|
268
277
|
* entry for a rule that was not sent is ignored.
|
|
@@ -285,7 +294,7 @@ export function rowsFromAnswer(scoped, args) {
|
|
|
285
294
|
/** the can't-check ask, as the signed words say it */
|
|
286
295
|
export const CANT_CHECK_WORDS = "I can't check this. Your own words, or Not checked?";
|
|
287
296
|
/** how every answer is told, once (fwd am2 item 2's words) */
|
|
288
|
-
export const HOW_TO_ANSWER = (/** @type {number} */ line, /** @type {boolean} */ agree) => `${agree ? 'Answer "agree" to use it, or type your own words' : 'Type your own words'} (your answer
|
|
297
|
+
export const HOW_TO_ANSWER = (/** @type {number} */ line, /** @type {boolean} */ agree) => `${agree ? 'Answer "agree" to use it, or type your own words' : 'Type your own words'} (your answer replaces that ~ rule on line ${line}), or answer "drop it" to leave it Not checked.`;
|
|
289
298
|
|
|
290
299
|
/** a part of a rubric-step stage, from a pick: the check's own fields, the rule's words, and the `~` rule numbers it carries out @param {Record<string, any>} check @param {string} text @param {number[]} rules */
|
|
291
300
|
export function partOfPick(check, text, rules) {
|
package/src/cli.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// `bareloop run <bundle>` is a thin door (`src/bundlerun.js`) to the same engine `bareloop
|
|
7
7
|
// run-u` drives (`src/userrun.js`): providers, keys (the keys file / env, any provider the
|
|
8
8
|
// bundle's spec names), judge, monthly limit and readout are that engine's. The test seam is
|
|
9
|
-
// the engine's too: `deps.provider` (and `providerFor
|
|
9
|
+
// the engine's too: `deps.provider` (and `providerFor`) supplies a scripted
|
|
10
10
|
// provider and skips the real-key check (same as `tests/planrun-*.test.js`'s pattern).
|
|
11
11
|
//
|
|
12
12
|
// Money/arbiter rules the bundle door keeps: `--budget`/`--wall` only TIGHTEN a bundle's
|
|
@@ -305,7 +305,7 @@ async function runLauncher(cmd, rest, deps, io, home) {
|
|
|
305
305
|
* code, so `bin/bareloop.mjs` can set `process.exitCode` and let node flush
|
|
306
306
|
* queued stdout on its own (F-something: `process.exit()` can discard it).
|
|
307
307
|
* @param {string[]} argv
|
|
308
|
-
* @param {{ env?: Record<string,string|undefined>, stdout?: any, stderr?: any, cwd?: string, provider?: any, providerFor?: any,
|
|
308
|
+
* @param {{ env?: Record<string,string|undefined>, stdout?: any, stderr?: any, cwd?: string, provider?: any, providerFor?: any, now?: () => number, stdin?: any, interactive?: boolean, runlistHome?: string, keysHome?: string, processEnv?: Record<string,string|undefined> }} deps
|
|
309
309
|
* @returns {Promise<number>}
|
|
310
310
|
*/
|
|
311
311
|
export async function main(argv, deps = {}) {
|
|
@@ -353,7 +353,7 @@ async function mainInner(argv, deps, holder) {
|
|
|
353
353
|
// (`--job`/`--spec`/`--resume`/`--door`/`--decide`/`--text`/
|
|
354
354
|
// `--review-door`/`--approve`/`--registry`/`--workflow`/`--model`/
|
|
355
355
|
// `--read-shim`/`--scout`/`--ticket`/`--anyway`). `deps` is spread first so an injected test
|
|
356
|
-
// seam (`deps.provider`/`providerFor
|
|
356
|
+
// seam (`deps.provider`/`providerFor`) still reaches it,
|
|
357
357
|
// then `env`/`out`/`err` are overridden to the SAME resolved values every
|
|
358
358
|
// other command here prints through, so `run-u`'s output lands on the
|
|
359
359
|
// `stdout`/`stderr` a caller of `main` actually passed.
|
package/src/declaredclose.js
CHANGED
|
@@ -68,14 +68,11 @@
|
|
|
68
68
|
// once instead of once-per-invocation, but `runPlan` has a dozen return paths and
|
|
69
69
|
// a leaked worktree outlives the process that made it.
|
|
70
70
|
|
|
71
|
-
import { runStage, makeSeedTrees, STOP_FAULTS, EXIT_RED
|
|
71
|
+
import { runStage, makeSeedTrees, STOP_FAULTS, EXIT_RED } from './kinds.js';
|
|
72
72
|
import {
|
|
73
73
|
validateDeclaration, classGuards, genreOwnedEnvNames, ungroundedGenreEnv, DECLARABLE_LANGUAGES, TYPES_GENRE, catalogueForLang, KIND_CATALOGUE, TEXT_GENRE, genreForLang,
|
|
74
74
|
VERDICT_CLASSES, LIVE_CLASSES, NEVER_OFFERED_KINDS,
|
|
75
75
|
} from './authoring.js';
|
|
76
|
-
// the calibration set's own gate lives beside the rulebook it is graded against
|
|
77
|
-
// (src/judged.js) — one opinion about what a judged floor's signed artifacts are
|
|
78
|
-
import { validateCalibrationSet } from './judged.js';
|
|
79
76
|
import { stageGap } from './ralph.js';
|
|
80
77
|
import { isObj, isNonEmptyString } from './validate.js';
|
|
81
78
|
|
|
@@ -102,7 +99,7 @@ export const DECLARED_GENRES = Object.freeze([TYPES_GENRE.name, TEXT_GENRE]);
|
|
|
102
99
|
* constrained to the names the genre OWNS, so it can never become an environment
|
|
103
100
|
* channel of its own.
|
|
104
101
|
*/
|
|
105
|
-
export const CLOSE_DECL_FIELDS = Object.freeze(['genre', 'lang', 'stages', 'notes', 'refused', 'guardLines', 'picks', 'list', 'genreEnv'
|
|
102
|
+
export const CLOSE_DECL_FIELDS = Object.freeze(['genre', 'lang', 'stages', 'notes', 'refused', 'guardLines', 'picks', 'list', 'genreEnv']);
|
|
106
103
|
|
|
107
104
|
/** the fields of a row of the one check list that the signed close carries (`closeDecl.list`); the row's own words are never signed */
|
|
108
105
|
export const SIGNED_ROW_FIELDS = Object.freeze(['line', 'key', 'from', 'by', 'kind', 'state', 'rule', 'part', 'reason', 'facts']);
|
|
@@ -110,14 +107,7 @@ export const SIGNED_ROW_FIELDS = Object.freeze(['line', 'key', 'from', 'by', 'ki
|
|
|
110
107
|
export const SIGNED_STATES = Object.freeze(['built', 'not-checked', 'dropped']);
|
|
111
108
|
const SIGNED_FROM = Object.freeze(['rule', 'pick', 'look', 'agent', 'default']);
|
|
112
109
|
const SIGNED_BY = Object.freeze(['you', 'agent', 'default']);
|
|
113
|
-
const SIGNED_KINDS = Object.freeze(['rule', 'fact', 'cited', 'count', 'phrase', 'numbers', 'floor']);
|
|
114
|
-
|
|
115
|
-
/** what a stored calibration set carries, ENUMERATED: the frozen cases and the judge
|
|
116
|
-
* tier that graded them. Both are inside the spec, so `jobSpecHash` covers both — which
|
|
117
|
-
* is the whole mechanism behind "a judge-model bump forces a full recalibration"
|
|
118
|
-
* (src/judged.js, `resolveJudge`): the field moves, the hash moves, the signature dies,
|
|
119
|
-
* and the re-sign re-runs the gate. Anything else in there is a field nobody reads. */
|
|
120
|
-
export const CALIBRATION_FIELDS = Object.freeze(['cases', 'judgeModel']);
|
|
110
|
+
const SIGNED_KINDS = Object.freeze(['rule', 'fact', 'cited', 'count', 'phrase', 'numbers', 'note', 'floor']);
|
|
121
111
|
|
|
122
112
|
/**
|
|
123
113
|
* The prefix M1 puts on EVERY gap line of a declared stage (its `ctx.gapKeep`).
|
|
@@ -184,8 +174,7 @@ export const HUMAN_CHECKPOINTS = Object.freeze([HITL_PAUSE]);
|
|
|
184
174
|
*
|
|
185
175
|
* `hard` is by CONSTRUCTION: every mechanical kind is a command whose measurement
|
|
186
176
|
* is the truth. `hitl` joined it at N4 slice 1, and `soft` at softgreen module 3
|
|
187
|
-
* — each only because its kind is genuinely LIVE (`human-confirms
|
|
188
|
-
* `judged-floor`): the widening and the kind go in one commit, or this table
|
|
177
|
+
* — each only because its kind is genuinely LIVE (`human-confirms`): the widening and the kind go in one commit, or this table
|
|
189
178
|
* admits a class the executor cannot render.
|
|
190
179
|
*
|
|
191
180
|
* `hitl` STAYS despite the class's retirement (PRD v1.71: the human stage moved
|
|
@@ -212,23 +201,11 @@ export function isDeclaredClose(job) {
|
|
|
212
201
|
* `offer` and `needs` pass through untouched when a declaration carries them
|
|
213
202
|
* (v1's schema does not let one), so `checkMenu`'s derivation is unchanged.
|
|
214
203
|
*
|
|
215
|
-
* THE JUDGE TIER RIDES ALONG, and it rides as a STAMP for the same reason `offer`
|
|
216
|
-
* does. The tier that graded this close's calibration set is a CLOSE-level fact
|
|
217
|
-
* (`calibration.judgeModel`), and the stage that would buy a judge call is a STAGE;
|
|
218
|
-
* `runStage` is handed stages and never the declaration they came out of. Rather than
|
|
219
|
-
* plumb a second close-level channel down through every executor seam, the one place
|
|
220
|
-
* that already turns a declaration into stages carries it across — and it carries it
|
|
221
|
-
* from the SIGNED bytes, so a stage can never name a tier the signature does not.
|
|
222
|
-
* `runJudgedFloor` refuses a mismatch; the absence of a stamp is the SPEC gate's
|
|
223
|
-
* business (`validateCloseDecl` reds a set with no model), never a runtime fall-back.
|
|
224
204
|
* @param {any} closeDecl
|
|
225
205
|
* @returns {any[]|null} null when this is not a declaration
|
|
226
206
|
*/
|
|
227
207
|
export function declaredStages(closeDecl) {
|
|
228
208
|
if (!isObj(closeDecl) || !Array.isArray(closeDecl.stages)) return null;
|
|
229
|
-
const calibrationJudgeModel = isObj(closeDecl.calibration) && isNonEmptyString(closeDecl.calibration.judgeModel)
|
|
230
|
-
? closeDecl.calibration.judgeModel
|
|
231
|
-
: null;
|
|
232
209
|
return closeDecl.stages.map((s) => (isObj(s)
|
|
233
210
|
// RULING 5, stamped by the ARBITER rather than trusted from the artefact:
|
|
234
211
|
// a judged or human stage is `offer: false` BY LAW, so `checkMenu` can never
|
|
@@ -240,7 +217,6 @@ export function declaredStages(closeDecl) {
|
|
|
240
217
|
...s,
|
|
241
218
|
gapKeep: DECLARED_GAP_KEEP,
|
|
242
219
|
...(NEVER_OFFERED_KINDS.includes(s.kind) ? { offer: false } : {}),
|
|
243
|
-
...(s.kind === JUDGED_FLOOR_KIND && calibrationJudgeModel !== null ? { calibrationJudgeModel } : {}),
|
|
244
220
|
}
|
|
245
221
|
: s));
|
|
246
222
|
}
|
|
@@ -280,14 +256,14 @@ export function declaredStages(closeDecl) {
|
|
|
280
256
|
*
|
|
281
257
|
* @param {any} closeDecl
|
|
282
258
|
* @param {{at?: string, listing?: string[]|null, deferListing?: boolean,
|
|
283
|
-
* catalogue?: Record<string, any>, verdictType?: string|null,
|
|
259
|
+
* catalogue?: Record<string, any>, verdictType?: string|null, jobLines?: {n: number}[]|null,
|
|
284
260
|
* inputLabels?: string[]|null}} [opts]
|
|
285
261
|
* @returns {{ok: boolean, reds: Red[], closeDecl: any, grounded: boolean,
|
|
286
262
|
* scoped: {scoped: boolean, via: string|null},
|
|
287
263
|
* ceiling: {class: string, kind: string, stage: string|null, locked: boolean}|null}}
|
|
288
264
|
*/
|
|
289
265
|
export function validateCloseDecl(closeDecl, opts = {}) {
|
|
290
|
-
const { at = 'closeDecl', listing = null, catalogue, verdictType = null,
|
|
266
|
+
const { at = 'closeDecl', listing = null, catalogue, verdictType = null, jobLines = null, inputLabels = null } = opts;
|
|
291
267
|
const deferListing = opts.deferListing === true;
|
|
292
268
|
/** @type {Red[]} */
|
|
293
269
|
const reds = [];
|
|
@@ -435,7 +411,6 @@ export function validateCloseDecl(closeDecl, opts = {}) {
|
|
|
435
411
|
...(deferListing ? { deferListing: true } : {}),
|
|
436
412
|
guards: classGuards({ verdictType: picked, lang: closeDecl.lang }),
|
|
437
413
|
verdictType: picked,
|
|
438
|
-
writeScope,
|
|
439
414
|
jobLines,
|
|
440
415
|
inputLabels,
|
|
441
416
|
envOwned: owned,
|
|
@@ -446,55 +421,6 @@ export function validateCloseDecl(closeDecl, opts = {}) {
|
|
|
446
421
|
});
|
|
447
422
|
for (const r of v.reds) reds.push({ ...r, path: r.path ? `${at}.${r.path}` : at });
|
|
448
423
|
|
|
449
|
-
// ── THE FROZEN CALIBRATION SET (softgreen module 4, design §4.4). It rides
|
|
450
|
-
// the closeDecl rather than a stage's params because it calibrates the RULER,
|
|
451
|
-
// not one stage's parameters — and because it is read BEFORE any stage runs.
|
|
452
|
-
//
|
|
453
|
-
// WHAT IS CHECKED HERE is that a stored set is LEGAL: exactly the signed size,
|
|
454
|
-
// both polarities present, itemized reds naming lines THIS close's card
|
|
455
|
-
// actually carries. WHAT IS NOT is whether the pipe grades it correctly — that
|
|
456
|
-
// is module 5's gate, it costs paid calls, and a validator cannot buy them.
|
|
457
|
-
//
|
|
458
|
-
// A set with NO judged stage to calibrate is its own red: the card lives on
|
|
459
|
-
// the stage, so an orphan set is graded against nothing and would validate
|
|
460
|
-
// clean forever. The reverse (a judged stage with no set) is deliberately NOT
|
|
461
|
-
// redded here — making the set MANDATORY is the signing gate's call, and
|
|
462
|
-
// module 5 owns it.
|
|
463
|
-
if (closeDecl.calibration !== undefined) {
|
|
464
|
-
const judged = judgedStages(closeDecl);
|
|
465
|
-
if (!isObj(closeDecl.calibration)) {
|
|
466
|
-
red('invalid-value', `${at}.calibration`, 'the frozen calibration set, as an object carrying `cases`');
|
|
467
|
-
} else if (judged.length !== 1) {
|
|
468
|
-
red('calibration-orphan', `${at}.calibration`, `this close carries a calibration set and ${judged.length} `
|
|
469
|
-
+ 'judged-floor stage(s). The set calibrates ONE judged ruler against ONE card — with no judged stage it is '
|
|
470
|
-
+ 'graded against nothing and would read clean forever, and with two there is no one card it belongs to',
|
|
471
|
-
{ judgedStages: judged.length });
|
|
472
|
-
} else {
|
|
473
|
-
for (const key of Object.keys(closeDecl.calibration)) {
|
|
474
|
-
if (!CALIBRATION_FIELDS.includes(key)) red('invalid-value', `${at}.calibration.${key}`, `a calibration set carries ${CALIBRATION_FIELDS.map((f) => `\`${f}\``).join(' and ')} and nothing else`);
|
|
475
|
-
}
|
|
476
|
-
// WHICH TIER GRADED THIS SET, and it is REQUIRED rather than optional. A
|
|
477
|
-
// stored set is only worth the judge that graded it (§4.2's safety argument
|
|
478
|
-
// is BA-20's haiku-4.5 injection evidence and nothing else), so a set with
|
|
479
|
-
// no model beside it is a set nobody can attribute — and the `CALIBRATION_FIELDS`
|
|
480
|
-
// docstring's promise that a bump forces recalibration has nothing to fire
|
|
481
|
-
// on. Required HERE and not at the stage, for the same reason the SET's own
|
|
482
|
-
// presence is the signing gate's call and not this validator's: this gate
|
|
483
|
-
// reads a stored artifact and says whether it is legal. The RUNTIME half —
|
|
484
|
-
// refusing to grade when the stored tier is not the tier this run would buy
|
|
485
|
-
// — is the judged stage's (`runJudgedFloor`), reached through the stamp
|
|
486
|
-
// `declaredStages` puts on the stage.
|
|
487
|
-
if (closeDecl.calibration.judgeModel === undefined) {
|
|
488
|
-
red('missing-required', `${at}.calibration.judgeModel`, 'the judge tier this set was GRADED by — a calibration '
|
|
489
|
-
+ 'nobody can attribute to a model is a floor nobody can tell apart from a bumped one');
|
|
490
|
-
} else if (!isNonEmptyString(closeDecl.calibration.judgeModel)) {
|
|
491
|
-
red('invalid-value', `${at}.calibration.judgeModel`, 'the judge tier this set was graded by, as a non-empty string');
|
|
492
|
-
}
|
|
493
|
-
const cv = validateCalibrationSet(closeDecl.calibration.cases, { card: judged[0]?.params?.card ?? null });
|
|
494
|
-
for (const r of cv.reds) reds.push({ ...r, path: r.path ? `${at}.${r.path}` : `${at}.calibration` });
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
|
|
498
424
|
const ok = reds.length === 0;
|
|
499
425
|
return {
|
|
500
426
|
ok,
|
|
@@ -602,17 +528,13 @@ function translate(r, redact) {
|
|
|
602
528
|
* @param {{timeoutMs?: number, cwd?: string, seedRef?: string,
|
|
603
529
|
* seedTrees?: any, gapCap?: number, maxBuffer?: number, baselineMode?: 'auto'|'worktree',
|
|
604
530
|
* humanRuling?: {decision: string, text?: string|null}|null,
|
|
605
|
-
*
|
|
606
|
-
* judgeModel?: string|null,
|
|
607
|
-
* onJudgeCost?: ((c: any) => void)|null,
|
|
608
|
-
* onRubricEvidence?: ((e: any) => void)|null,
|
|
609
|
-
* callBounds?: (() => {timeoutMs?: number, deadlineMs?: number})|null}} [opts]
|
|
531
|
+
* onRubricEvidence?: ((e: any) => void)|null}} [opts]
|
|
610
532
|
* @returns {Promise<any>}
|
|
611
533
|
*/
|
|
612
534
|
export async function runDeclaredStages(stages, redact = (s) => s, opts = {}) {
|
|
613
535
|
const {
|
|
614
536
|
timeoutMs, cwd, seedRef, seedTrees: shared, gapCap, maxBuffer, baselineMode, humanRuling = null,
|
|
615
|
-
|
|
537
|
+
onRubricEvidence = null,
|
|
616
538
|
} = opts;
|
|
617
539
|
if (!isNonEmptyString(cwd) || !isNonEmptyString(seedRef)) {
|
|
618
540
|
// Refuse rather than guess. A declared close measures against a SEED; a
|
|
@@ -643,27 +565,6 @@ export async function runDeclaredStages(stages, redact = (s) => s, opts = {}) {
|
|
|
643
565
|
// human stage reads the absence as "nobody has answered yet", which is the
|
|
644
566
|
// whole of what a pause means.
|
|
645
567
|
humanRuling,
|
|
646
|
-
// THE PAID SEAM, THE IDENTITY and THE METER, all operator territory and all
|
|
647
|
-
// absent on every mechanical close. A judged stage with no seam STOPS as a
|
|
648
|
-
// wiring gap rather than falling back to some other model (M1 owns no
|
|
649
|
-
// provider), and `judgeModel` is the seam's OTHER half (PRD item 32.1) —
|
|
650
|
-
// WHICH model the seam drives, resolved by the caller (`resolveJudge`,
|
|
651
|
-
// src/judged.js) and passed through untouched here, exactly as `judgeLoop`
|
|
652
|
-
// is. `runStage` checks the identity before the seam, so a judged stage with
|
|
653
|
-
// neither wired reports the identity gap, and one with only the seam missing
|
|
654
|
-
// still names the judge it would have graded with. Every locate call the
|
|
655
|
-
// seam buys is reported OUT through the meter so the run's ONE ledger can
|
|
656
|
-
// see it — a close has cost $0 until this kind, and a budget must fund the
|
|
657
|
-
// attempt PLUS its close.
|
|
658
|
-
judgeLoop,
|
|
659
|
-
judgeModel,
|
|
660
|
-
onJudgeCost,
|
|
661
|
-
// F152/PRD 30.4 — the SAME per-call time bounds every worker round already
|
|
662
|
-
// carries (`callBounds()`, src/planrun.js:1518), so the judged stage's own
|
|
663
|
-
// locate call cannot hang the process on a live silent endpoint. `null` is
|
|
664
|
-
// the honest absence (an adopter/test that wires no clock through), never a
|
|
665
|
-
// defaulted number invented here.
|
|
666
|
-
callBounds,
|
|
667
568
|
// REPORT-ONLY seam: what a rubric-step stage's cited checks read (bareguard `full.evidence`); the runner records it, nothing here reads it
|
|
668
569
|
onRubricEvidence,
|
|
669
570
|
seedTrees,
|
|
@@ -723,7 +624,7 @@ export async function runDeclaredStages(stages, redact = (s) => s, opts = {}) {
|
|
|
723
624
|
* recommend a top-up on a dying run — the one direction trend.js names as
|
|
724
625
|
* dangerous. F6's answer applies: unknown, never a number that means the
|
|
725
626
|
* opposite of what it says.
|
|
726
|
-
* - a
|
|
627
|
+
* - a rubric-step (no measurement) donates its distinct red COUNT, always 'down';
|
|
727
628
|
* - any other stage with no measurement at all donates nothing, for the same reason.
|
|
728
629
|
* The stage POSITION still travels either way, so "the run got further than it
|
|
729
630
|
* ever had" is readable on every declared close.
|
|
@@ -732,8 +633,8 @@ export async function runDeclaredStages(stages, redact = (s) => s, opts = {}) {
|
|
|
732
633
|
*/
|
|
733
634
|
function trendValueOf(stage, r) {
|
|
734
635
|
if (typeof r?.value !== 'number' || !Number.isFinite(r.value)) {
|
|
735
|
-
// a
|
|
736
|
-
// (
|
|
636
|
+
// a rubric-step has no measurement: its number is how many DISTINCT reds it itemizes
|
|
637
|
+
// (src/rubricstep.js `detail.redCount`), lower-is-better, compared to its best-so-far like any deterministic count
|
|
737
638
|
return Number.isInteger(r?.detail?.redCount) ? r.detail.redCount : null;
|
|
738
639
|
}
|
|
739
640
|
return stage?.params?.direction === 'lower-is-better' ? r.value : null;
|
package/src/destpoint.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// names a file to change, the line, the file (copied from that line) and the folder that holds it. Plain code then checks every claim (the line is a job line, the path
|
|
3
3
|
// stands in that line's own words, the file is in the repo's committed tree, the folder is a real parent of it) and that the file lies OUTSIDE the Destination. Only then is
|
|
4
4
|
// there ONE question, worded by code, answered yes or no like the fit check's "go on". A made-up file, a path the line does not hold or a malformed reply is no question.
|
|
5
|
-
// Failure is OPEN (a wrong question is the costly mistake): a call that does not finish asks nothing and drafting goes on. The call/book/retry pattern is src/
|
|
5
|
+
// Failure is OPEN (a wrong question is the costly mistake): a call that does not finish asks nothing and drafting goes on. The call/book/retry pattern is src/pagemap.js's `runPageMap`.
|
|
6
6
|
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import { priceOf, scrubRaw, tallyCalls, capStop, callCasualty } from './text.js';
|