bareloop 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/README.md +3 -3
- package/bareloop.context.md +75 -214
- package/package.json +2 -2
- package/src/authorflow.js +71 -136
- package/src/authoring.js +5 -124
- package/src/authorjob.js +125 -417
- package/src/authorreadout.js +105 -355
- package/src/authorrun.js +70 -234
- package/src/authorscout.js +9 -1
- package/src/blockasks.js +12 -17
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +297 -75
- package/src/checklist.js +1 -1
- package/src/checkpick.js +9 -5
- package/src/cli.js +3 -3
- package/src/declaredclose.js +45 -112
- package/src/destpoint.js +1 -1
- package/src/draftspend.js +20 -4
- package/src/fencepointcall.js +76 -0
- package/src/guarddescriptions.js +14 -0
- 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 +10 -348
- package/src/noteask.js +124 -0
- package/src/pagedry.js +27 -5
- package/src/pagemap.js +7 -29
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +15 -4
- package/src/panel/authorsession.js +201 -167
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +43 -18
- package/src/panel/jobplan.js +54 -19
- package/src/panel/server.js +90 -69
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +15 -54
- package/src/planrun.js +4 -48
- package/src/promptregisters.js +7 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +34 -30
- package/src/reviewdoor.js +1 -1
- package/src/rowresults.js +69 -0
- package/src/rubricstep.js +136 -28
- package/src/run.js +2 -15
- package/src/stagewords.js +24 -0
- package/src/userrun.js +14 -111
- package/types/authorflow.d.ts +51 -137
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +14 -55
- package/types/authorreadout.d.ts +52 -80
- package/types/authorrun.d.ts +20 -0
- package/types/blockasks.d.ts +5 -11
- package/types/checkblock.d.ts +147 -28
- package/types/checklist.d.ts +2 -2
- package/types/checkpick.d.ts +5 -3
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +5 -33
- package/types/draftspend.d.ts +16 -2
- package/types/fencepointcall.d.ts +68 -0
- package/types/guarddescriptions.d.ts +7 -0
- 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 +4 -104
- package/types/noteask.d.ts +76 -0
- package/types/pagedry.d.ts +13 -0
- package/types/pagemap.d.ts +2 -5
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +37 -5
- package/types/panel/jobplan.d.ts +15 -3
- package/types/panel/server.d.ts +46 -13
- 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/questionbox.d.ts +20 -6
- package/types/rowresults.d.ts +23 -0
- package/types/rubricstep.d.ts +43 -7
- package/types/run.d.ts +1 -20
- package/types/stagewords.d.ts +11 -0
- 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/panel/server.js
CHANGED
|
@@ -74,12 +74,12 @@ 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';
|
|
81
81
|
import { filterUnsure } from '../ticketlabels.js';
|
|
82
|
-
import { judgedFilesOf, lineRules, stepFileRel, proseNotCheckedItems } from '../rubricstep.js';
|
|
82
|
+
import { judgedFilesOf, lineRules, stepFileRel, proseNotCheckedItems, carriesOneList, checksOfClose } from '../rubricstep.js';
|
|
83
83
|
import { factPartOf, factSentence, ruleWords, moneyAs } from '../facts.js';
|
|
84
84
|
import { createSettingsRoutes } from './settingsroutes.js';
|
|
85
85
|
import { planFromSpec, auditChecksOf } from './jobplan.js';
|
|
@@ -1240,6 +1240,31 @@ function rubricStagesOf(spec) {
|
|
|
1240
1240
|
return stages.filter((/** @type {any} */ s) => s && s.kind === 'rubric-step' && s.params && Number.isInteger(s.params.step));
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
|
+
/**
|
|
1244
|
+
* The per-row results of the run's FINAL close (Addendum 2026-11-14 (c) piece 4): what its stage entries recorded in `rows` (`{key, result, why?}`) and `unclaimed` (words of a gap no row owns), keyed by
|
|
1245
|
+
* the signed list's row key / by job line. A close recorded before rows existed (an older run) yields empty maps: every reader then keeps the stage verdict. Read, never re-derived.
|
|
1246
|
+
* @param {any[]} records @param {any} spec
|
|
1247
|
+
* @returns {{results: Map<string, {result: string, why?: string}>, unclaimed: Map<number, string[]>}}
|
|
1248
|
+
*/
|
|
1249
|
+
export function rowResultsFromRecords(records, spec) {
|
|
1250
|
+
/** @type {Map<string, {result: string, why?: string}>} */
|
|
1251
|
+
const results = new Map();
|
|
1252
|
+
/** @type {Map<number, string[]>} */
|
|
1253
|
+
const unclaimed = new Map();
|
|
1254
|
+
const oc = records.findLast((r) => r && (r.type === 'close-verdict' || r.type === 'outer-close') && Array.isArray(r.stages));
|
|
1255
|
+
if (!oc) return { results, unclaimed };
|
|
1256
|
+
const lineOf = new Map(rubricStagesOf(spec).map((/** @type {any} */ s) => [s.name, s.params.step]));
|
|
1257
|
+
for (const st of oc.stages) {
|
|
1258
|
+
if (!st || typeof st.name !== 'string') continue;
|
|
1259
|
+
for (const r of Array.isArray(st.rows) ? st.rows : []) {
|
|
1260
|
+
if (r && typeof r.key === 'string' && typeof r.result === 'string') results.set(r.key, { result: r.result, ...(typeof r.why === 'string' ? { why: r.why } : {}) });
|
|
1261
|
+
}
|
|
1262
|
+
const line = lineOf.get(st.name);
|
|
1263
|
+
if (line !== undefined && Array.isArray(st.unclaimed) && st.unclaimed.length) unclaimed.set(line, st.unclaimed.filter((/** @type {unknown} */ u) => typeof u === 'string'));
|
|
1264
|
+
}
|
|
1265
|
+
return { results, unclaimed };
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1243
1268
|
/** what the Result tab's open door asks, after the door's own head words */
|
|
1244
1269
|
export const RESULT_DOOR_ASK = 'the checks passed; is this what you wanted?';
|
|
1245
1270
|
|
|
@@ -1534,13 +1559,39 @@ function stepChecksOf(records, spec) {
|
|
|
1534
1559
|
}
|
|
1535
1560
|
|
|
1536
1561
|
/**
|
|
1537
|
-
* The
|
|
1562
|
+
* The Result tab's checks of a repo close that carries the one list (Addendum 2026-11-15 (d)): drawn from the list's rows only, by the Audit's own reader ({@link auditChecksFor}), each with its tag and its OWN result: an `!` stage row its
|
|
1563
|
+
* recorded verdict, a `$` guard row its guard stage, the `$` fence row and a fence-kept `~` row the gate's record of the run, a Not checked row none. The head and the counts stay the close's own. A close with no list, or a rubric close, is returned as it was.
|
|
1564
|
+
* @param {any} base what {@link checksOf} read @param {any} row @param {any[]} records @param {any} spec @param {{ home?: string, sessionsRoot?: string }} opts
|
|
1565
|
+
*/
|
|
1566
|
+
function repoRowChecks(base, row, records, spec, opts) {
|
|
1567
|
+
const cd = spec?.closeDecl;
|
|
1568
|
+
if (!base || !carriesOneList(cd) || (Array.isArray(cd.stages) ? cd.stages : []).some((/** @type {any} */ x) => x && x.kind === 'rubric-step')) return base;
|
|
1569
|
+
const ac = auditChecksFor(row, records, spec, opts);
|
|
1570
|
+
if (!ac) return base;
|
|
1571
|
+
const tag = (/** @type {any} */ by) => (by === 'you' ? '~ [you] ' : by === 'agent' ? '! [agent] ' : by === 'default' ? '$ [default] ' : '');
|
|
1572
|
+
const grey = (/** @type {string} */ word) => ({ sign: '\u00b7', word });
|
|
1573
|
+
const mk = (/** @type {any} */ r) => {
|
|
1574
|
+
const standing = r.result === 'passed' ? { passed: true, notReached: false, status: STATUS.passed }
|
|
1575
|
+
: r.result === 'failed' ? { passed: false, notReached: false, status: STATUS.failed }
|
|
1576
|
+
: r.result === 'held' ? { passed: true, notReached: false, status: { sign: STATUS.passed.sign, word: String(r.word) } }
|
|
1577
|
+
: r.result === 'record-missing' ? { passed: false, notReached: true, status: grey(String(r.word)) }
|
|
1578
|
+
: r.result === 'not-reached' ? { passed: false, notReached: true, status: NOT_REACHED }
|
|
1579
|
+
: r.result === 'not-checked' ? { passed: false, notReached: true, status: grey('not checked') }
|
|
1580
|
+
: { passed: false, notReached: true, status: grey('no result recorded') };
|
|
1581
|
+
return { name: r.key ?? r.text, question: `${tag(r.by)}${r.text}`, ...standing, value: null, baseline: null, direction: null, baselineKind: null, notes: typeof r.why === 'string' && r.why ? r.why : null };
|
|
1582
|
+
};
|
|
1583
|
+
return { ...base, stages: [...ac.checks, ...ac.notChecked].map(mk) };
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* 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
1588
|
* 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
1589
|
* falls back to the checks its steps ran ({@link stepChecksOf}); `null` when neither exists.
|
|
1540
1590
|
* @param {any[]} records @param {any} spec
|
|
1541
1591
|
*/
|
|
1542
1592
|
function checksOf(records, spec) {
|
|
1543
|
-
|
|
1593
|
+
// 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)
|
|
1594
|
+
const oc = records.findLast((r) => r && (r.type === 'close-verdict' || r.type === 'outer-close') && Array.isArray(r.stages));
|
|
1544
1595
|
if (!oc) return stepChecksOf(records, spec);
|
|
1545
1596
|
const kindMeta = stageKindMetaFromSpec(spec);
|
|
1546
1597
|
const stages = oc.stages.filter((/** @type {any} */ s) => s && typeof s.name === 'string').map((/** @type {any} */ raw) => {
|
|
@@ -1555,9 +1606,16 @@ function checksOf(records, spec) {
|
|
|
1555
1606
|
};
|
|
1556
1607
|
});
|
|
1557
1608
|
const ok = stages.filter((/** @type {any} */ s) => s.passed).length;
|
|
1609
|
+
// 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
|
|
1610
|
+
const ran = new Set(stages.map((/** @type {any} */ s) => s.name));
|
|
1611
|
+
const unreached = [...(kindMeta ?? new Map())].filter(([n]) => !ran.has(n)).map(([name, m]) => ({
|
|
1612
|
+
name, question: m.question, passed: false, notReached: true, status: NOT_REACHED,
|
|
1613
|
+
value: null, baseline: null, direction: m.direction, baselineKind: m.baselineKind, notes: null,
|
|
1614
|
+
}));
|
|
1615
|
+
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
1616
|
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,
|
|
1617
|
+
head: `${ok} of ${stages.length} passed${unreached.length ? ` · ${unreached.length} not reached` : ''} · the close ran them after the worker stopped`,
|
|
1618
|
+
passed: ok, total: stages.length, notReached: unreached.length, allPassed: ok === stages.length, stages: shown,
|
|
1561
1619
|
notes: stages.filter((/** @type {any} */ s) => s.notes).map((/** @type {any} */ s) => ({ name: s.name, text: s.notes })),
|
|
1562
1620
|
};
|
|
1563
1621
|
}
|
|
@@ -1615,7 +1673,7 @@ function genericResultOf(runid, row, records, spec, opts) {
|
|
|
1615
1673
|
job: { asked: jobTextFromSpec(spec) || (typeof start?.goal === 'string' ? start.goal : ''), scope: writeScope },
|
|
1616
1674
|
ticket,
|
|
1617
1675
|
changed: changedOf(records, writeScope),
|
|
1618
|
-
checks: checksOf(records, spec),
|
|
1676
|
+
checks: repoRowChecks(checksOf(records, spec), row, records, spec, opts),
|
|
1619
1677
|
work: workOf(row, records),
|
|
1620
1678
|
run: {
|
|
1621
1679
|
spent: spentUsd === null ? 'unknown' : `${complete ? '' : 'at least '}${panelMoney2(spentUsd)}`,
|
|
@@ -1752,8 +1810,16 @@ export function getRunResult(runid, /** @type {{ home?: string, sessionsRoot?: s
|
|
|
1752
1810
|
const fp = factPartOf(st.params);
|
|
1753
1811
|
const di = delivered.map((d, i) => ({ d, i })).filter(({ d }) => stepOfDelivered(d.path) === n).pop() ?? null;
|
|
1754
1812
|
const passed = stagePassedIn(records, st.name);
|
|
1813
|
+
// each row of the line with its OWN mark (piece 4), from the final close's per-row record; a row the record has no result for (an older run) reads the stage's mark
|
|
1814
|
+
const rowRes = rowResultsFromRecords(records, spec);
|
|
1815
|
+
const checkRows = (plan.lines.find((l) => l.n === n)?.checks ?? []).map((c) => {
|
|
1816
|
+
const got = c.key ? rowRes.results.get(c.key) : undefined;
|
|
1817
|
+
return { ...(c.key ? { key: c.key } : {}), text: c.name, by: c.by ?? null, result: got ? (got.result === 'unread' ? 'none' : got.result) : (passed ? 'passed' : 'none'), ...(got?.why ? { why: got.why } : {}) };
|
|
1818
|
+
});
|
|
1755
1819
|
/** @type {any} */
|
|
1756
1820
|
const out = {
|
|
1821
|
+
checkRows,
|
|
1822
|
+
unclaimed: rowRes.unclaimed.get(n) ?? [],
|
|
1757
1823
|
notChecked: tiedToLine(n),
|
|
1758
1824
|
...(plan.notCheckedBy ? { notCheckedBy: plan.notCheckedBy } : {}),
|
|
1759
1825
|
n, text: jl && typeof jl.text === 'string' ? jl.text : '', rules: jl ? lineRules(jl) : [], kind: fp ? 'facts' : 'text', passed,
|
|
@@ -1995,16 +2061,6 @@ function getRunDetailBody(runid, opts) {
|
|
|
1995
2061
|
// the export row only for a run export would take — the one rule, `checkExportable`, never a copy of it
|
|
1996
2062
|
const exportName = checkExportable(row, runName).ok ? runName : null;
|
|
1997
2063
|
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
2064
|
|
|
2009
2065
|
/** @param {string|null} outcome @param {boolean} isLast */
|
|
2010
2066
|
const stateFor = (outcome, isLast) => {
|
|
@@ -2141,7 +2197,6 @@ function getRunDetailBody(runid, opts) {
|
|
|
2141
2197
|
checkTypeTitle: checkTypeTitle(summary.verdictType, row.at),
|
|
2142
2198
|
model: summary.model,
|
|
2143
2199
|
provider: summary.provider,
|
|
2144
|
-
judgeModel,
|
|
2145
2200
|
budgetUsd: summary.budgetUsd,
|
|
2146
2201
|
glyph: status.sign,
|
|
2147
2202
|
status,
|
|
@@ -2248,7 +2303,7 @@ function getRunDetailBody(runid, opts) {
|
|
|
2248
2303
|
// Cross-run learnings now ride on the part that received them (`part.learnings`, `part.learningsError`; src/panel/handed.js).
|
|
2249
2304
|
// PRD v1.106 Part 5 F: the two Run summary rows, worded here (the page prints them)
|
|
2250
2305
|
callsLine: callsLineOf(rawSpineRecords, scopedBehaviour(row, rawSpineRecords)),
|
|
2251
|
-
checksLine: checksLineOf(rawSpineRecords,
|
|
2306
|
+
checksLine: checksLineOf(rawSpineRecords, specForParts),
|
|
2252
2307
|
auditChecks: auditChecksFor(row, rawSpineRecords, specForParts, opts),
|
|
2253
2308
|
memoryCache: summary.memoryCache,
|
|
2254
2309
|
// 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 +3234,17 @@ export function callsLineOf(records, behaviour) {
|
|
|
3179
3234
|
: `${model} model · tool calls: no log saved`;
|
|
3180
3235
|
}
|
|
3181
3236
|
|
|
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
3237
|
/**
|
|
3195
|
-
* "
|
|
3196
|
-
*
|
|
3197
|
-
*
|
|
3198
|
-
* @param {any[]} records the run's raw spine @param {any
|
|
3238
|
+
* "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).
|
|
3239
|
+
* 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
|
|
3240
|
+
* 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`.
|
|
3241
|
+
* @param {any[]} records the run's raw spine @param {any} spec the run's signed spec (names the stages the close declares)
|
|
3199
3242
|
* @returns {string}
|
|
3200
3243
|
*/
|
|
3201
|
-
export function checksLineOf(records,
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
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(', ')})` : ''}`;
|
|
3244
|
+
export function checksLineOf(records, spec) {
|
|
3245
|
+
const c = checksOf(records, spec);
|
|
3246
|
+
if (!c || c.total === 0) return 'not recorded';
|
|
3247
|
+
return `${c.total} run · ${c.passed} passed · ${c.total - c.passed} failed${c.notReached ? ` · ${c.notReached} not reached` : ''}`;
|
|
3229
3248
|
}
|
|
3230
3249
|
|
|
3231
3250
|
/** 1 -> "1st", 4 -> "4th", 12 -> "12th" @param {number} n */
|
|
@@ -3401,8 +3420,10 @@ function stageOfCheck(c) {
|
|
|
3401
3420
|
* @param {any} spec
|
|
3402
3421
|
* @returns {string|null}
|
|
3403
3422
|
*/
|
|
3404
|
-
function successFromSpec(spec) {
|
|
3423
|
+
export function successFromSpec(spec) {
|
|
3405
3424
|
if (!spec || typeof spec !== 'object') return null;
|
|
3425
|
+
// a one-list job (Addendum 2026-11-14 (c) piece 3): the checks ARE its rows, in the card's own words, never the stage names
|
|
3426
|
+
if (carriesOneList(spec.closeDecl)) return checksOfClose(spec.closeDecl, spec.jobLines ?? null).map((c) => c.text).join(' · ');
|
|
3406
3427
|
const stages = Array.isArray(spec.close) ? spec.close
|
|
3407
3428
|
: (spec.closeDecl && Array.isArray(spec.closeDecl.stages) ? spec.closeDecl.stages : null);
|
|
3408
3429
|
if (!stages) return null;
|
|
@@ -3424,15 +3445,15 @@ function auditChecksFor(row, records, spec, opts) {
|
|
|
3424
3445
|
if (spec.closeDecl && typeof spec.closeDecl.lang === 'string' && typeof spec.verdictType === 'string') {
|
|
3425
3446
|
try {
|
|
3426
3447
|
guards = confirmProtections({
|
|
3427
|
-
verdictType: spec.verdictType, lang: spec.closeDecl.lang, jobLines: Array.isArray(spec.jobLines) ? spec.jobLines : null,
|
|
3448
|
+
verdictType: spec.verdictType, lang: spec.closeDecl.lang, jobLines: Array.isArray(spec.jobLines) ? spec.jobLines : null, closeDecl: spec.closeDecl,
|
|
3428
3449
|
writeScope: Array.isArray(spec.writeScope) && spec.writeScope.every((/** @type {any} */ x) => typeof x === 'string') ? spec.writeScope : null,
|
|
3429
3450
|
});
|
|
3430
3451
|
} catch { guards = []; }
|
|
3431
3452
|
}
|
|
3432
3453
|
const got = checksOf(records, spec);
|
|
3433
|
-
const results = got ? new Map(got.stages.map((/** @type {any} */ x) => [x.name, x.passed === true])) : null;
|
|
3454
|
+
const results = got ? new Map(got.stages.filter((/** @type {any} */ x) => !x.notReached).map((/** @type {any} */ x) => [x.name, x.passed === true])) : null;
|
|
3434
3455
|
const rows = scopedAuditRows(row, records);
|
|
3435
|
-
return auditChecksOf(plan, guards, results, rows === null ? null : writesBlocked(rows));
|
|
3456
|
+
return auditChecksOf(plan, guards, results, rows === null ? null : writesBlocked(rows), got !== null && got.notReached !== undefined, rowResultsFromRecords(records, spec));
|
|
3436
3457
|
}
|
|
3437
3458
|
|
|
3438
3459
|
/**
|
|
@@ -3451,7 +3472,7 @@ function auditChecksFor(row, records, spec, opts) {
|
|
|
3451
3472
|
* @param {any} spec
|
|
3452
3473
|
* @returns {string|null}
|
|
3453
3474
|
*/
|
|
3454
|
-
function guardrailsFromSpec(spec) {
|
|
3475
|
+
export function guardrailsFromSpec(spec) {
|
|
3455
3476
|
if (!spec || typeof spec !== 'object') return null;
|
|
3456
3477
|
const writeScope = Array.isArray(spec.writeScope) && spec.writeScope.every((s) => typeof s === 'string')
|
|
3457
3478
|
? spec.writeScope : null;
|
|
@@ -3459,7 +3480,7 @@ function guardrailsFromSpec(spec) {
|
|
|
3459
3480
|
? `write fence — the run may only change files matching: ${writeScope.join(', ')}` : null;
|
|
3460
3481
|
if (spec.closeDecl && typeof spec.closeDecl.lang === 'string' && typeof spec.verdictType === 'string') {
|
|
3461
3482
|
try {
|
|
3462
|
-
const lines = confirmProtections({ verdictType: spec.verdictType, lang: spec.closeDecl.lang, writeScope });
|
|
3483
|
+
const lines = confirmProtections({ verdictType: spec.verdictType, lang: spec.closeDecl.lang, writeScope, closeDecl: spec.closeDecl });
|
|
3463
3484
|
if (lines.length > 0) return lines.join(' · ');
|
|
3464
3485
|
} catch { /* falls through to the write-fence-only line below */ }
|
|
3465
3486
|
}
|
package/src/panel/status.js
CHANGED
|
@@ -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
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
67
|
-
*
|
|
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,
|
|
71
|
-
* kept: {line: number, rule: number, entry: Entry}[], askRules:
|
|
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 :
|
|
88
|
-
if (src)
|
|
89
|
-
|
|
90
|
-
|
|
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.
|
|
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))
|
|
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,
|
|
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,8 @@ 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
|
-
//
|
|
1793
|
-
|
|
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,
|
|
1776
|
+
// the signed one check list: each stage entry of the close's records carries a RESULT PER ROW (report-only; no verdict reads it)
|
|
1777
|
+
list: Array.isArray(job.closeDecl?.list) ? job.closeDecl.list : null,
|
|
1813
1778
|
// REPORT-ONLY: what a rubric-step stage's cited checks read (bareguard `full.evidence`), recorded as `rubric-evidence` for the Result
|
|
1814
1779
|
// 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
1780
|
// the frozen page record, and the spine is append-only. Masking moves offsets, so an entry whose text changed keeps NO spans.
|
|
@@ -1824,15 +1789,6 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
|
|
|
1824
1789
|
}),
|
|
1825
1790
|
...(e.evidenceTotal !== undefined ? { evidenceTotal: e.evidenceTotal } : {}),
|
|
1826
1791
|
}),
|
|
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
1792
|
})
|
|
1837
1793
|
: runStages(stages, scrub, closeOpts));
|
|
1838
1794
|
/**
|
|
@@ -2163,7 +2119,7 @@ export async function runPlan(job, { workdir, provider, nativeProvider, provider
|
|
|
2163
2119
|
}
|
|
2164
2120
|
const listed = await seedListing(workdir, s.seedRef);
|
|
2165
2121
|
const v = listed.stop === null
|
|
2166
|
-
? validateCloseDecl(job.closeDecl, { at: 'closeDecl', listing: listed.files, verdictType: job.verdictType,
|
|
2122
|
+
? validateCloseDecl(job.closeDecl, { at: 'closeDecl', listing: listed.files, verdictType: job.verdictType, jobLines: Array.isArray(job.jobLines) ? job.jobLines : null , inputLabels: inputLabelsOf(job.inputs) })
|
|
2167
2123
|
: { ok: false, grounded: false, reds: [{ code: 'listing-unreadable', path: 'closeDecl', detail: listed.stop }] };
|
|
2168
2124
|
emit('close-decl', {
|
|
2169
2125
|
genre: job.closeDecl.genre,
|
package/src/promptregisters.js
CHANGED
|
@@ -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
|
|
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/
|
|
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' }),
|
|
@@ -88,6 +73,11 @@ export const PROMPT_REGISTERS = Object.freeze([
|
|
|
88
73
|
// (F198 item 2), built inline inside `middle` and appended to `w.ask([...])`
|
|
89
74
|
Object.freeze({ file: 'src/planrun.js', name: 'middle()\'s facts-only "The close\'s own numbers so far" block (inline template, not a const)' }),
|
|
90
75
|
|
|
76
|
+
// src/fencepointcall.js — the repo job's pointing call (a `~` rule the AI points at a file the write fence keeps; code proves it)
|
|
77
|
+
Object.freeze({ file: 'src/fencepointcall.js', name: 'FENCE_POINT_SYSTEM' }),
|
|
78
|
+
Object.freeze({ file: 'src/fencepointcall.js', name: 'FENCE_POINT_SCHEMA (property descriptions)' }),
|
|
79
|
+
Object.freeze({ file: 'src/fencepointcall.js', name: 'fencePointUserText() (inline template, not a const)' }),
|
|
80
|
+
|
|
91
81
|
// src/checklist.js — the one check list of a rubric job: the list call's system text and schema descriptions, the drafter's list block, the code-written refusal words
|
|
92
82
|
Object.freeze({ file: 'src/checklist.js', name: 'LEDGER_SYSTEM' }),
|
|
93
83
|
Object.freeze({ file: 'src/checklist.js', name: 'LEDGER_SCHEMA (property descriptions)' }),
|
package/src/providerrows.js
CHANGED
|
@@ -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
|
-
}
|