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/authorrun.js
CHANGED
|
@@ -101,8 +101,7 @@
|
|
|
101
101
|
// in; a draft missing one, or naming one the provider factory
|
|
102
102
|
// does not know, dies here loud, listing the known table.
|
|
103
103
|
import { keysForDoor } from './keysfile.js';
|
|
104
|
-
import {
|
|
105
|
-
import { ConfigError } from './config.js';
|
|
104
|
+
import { keyNameFor, keyValueOf, ratesFor, ratesOfLine, resolveWorker, rowsForHome } from './providerrows.js';
|
|
106
105
|
import {
|
|
107
106
|
readFileSync, writeFileSync, appendFileSync, mkdirSync, existsSync, statSync,
|
|
108
107
|
} from 'node:fs';
|
|
@@ -116,7 +115,6 @@ import {
|
|
|
116
115
|
import {
|
|
117
116
|
makeLoopGenerate, CONFIRM_MENU, confirmSystemFor,
|
|
118
117
|
} from './authorflow.js';
|
|
119
|
-
import { defaultJudgeLoop, resolveJobJudge } from './judged.js';
|
|
120
118
|
import { validateJob, jobSpecHash, resolveWorkerModel } from './job.js';
|
|
121
119
|
import { scanSecrets, redactSecrets } from './validate.js';
|
|
122
120
|
import { detectLanguage } from './detectlang.js';
|
|
@@ -125,15 +123,15 @@ import { rubricGoal } from './rubricstep.js';
|
|
|
125
123
|
import { LEDGER_SYSTEM } from './checklist.js';
|
|
126
124
|
import { ROW_EDIT_SYSTEM } from './rowedit.js';
|
|
127
125
|
import { moveFile } from './movefile.js';
|
|
128
|
-
import {
|
|
126
|
+
import { GATE_AUDIT_FILE } from './kinds.js';
|
|
129
127
|
import { resolveProvider, buildRunnerProviders, apiKeyProblem } from './providers.js';
|
|
130
128
|
import { commandFor } from './invoke.js';
|
|
131
129
|
import { readSourceManifest, missingDependencies, nonRepoSourceMessage, isRubricFilesManifest } from './source.js';
|
|
132
130
|
import { tallyCalls } from './text.js';
|
|
133
131
|
import { splitReadNotes } from './pagedropwords.js';
|
|
134
132
|
import {
|
|
135
|
-
declarationLines,
|
|
136
|
-
openQuestionLines, answeredQuestionLines, fellBackLines,
|
|
133
|
+
declarationLines, parseCeiling, ceilingLine, crashRecord, phaseLine,
|
|
134
|
+
openQuestionLines, answeredQuestionLines, fellBackLines, signingStopText,
|
|
137
135
|
} from './authorreadout.js';
|
|
138
136
|
|
|
139
137
|
/** Thrown to unwind `main` to an exit code without ever calling
|
|
@@ -484,38 +482,6 @@ export async function main(argv, deps = {}) {
|
|
|
484
482
|
const baseUrl = W.baseUrl;
|
|
485
483
|
const AUTHOR_ROW = W.row;
|
|
486
484
|
|
|
487
|
-
// THE JUDGE THIS RUN'S OWN WORKER RESOLVES TO (PRD item 32.1) — resolved ONCE,
|
|
488
|
-
// here, from the DRAFT, and reused for BOTH the compose-time stamp (the
|
|
489
|
-
// declaration-authoring call's own `judgeModel` argument, below) and the
|
|
490
|
-
// calibration gate (`prepareSigning`'s `judgeModel` argument, further down).
|
|
491
|
-
// `resolveJobJudge` is the one
|
|
492
|
-
// spelling of "the named provider's own `tiers.sonnet` defaults an absent
|
|
493
|
-
// model, then a signed `judge` override wins" that `scripts/run-u.mjs`
|
|
494
|
-
// applies at run time (`resolveWorkerModel` + `resolveJudge`) — spelling that
|
|
495
|
-
// composition twice by hand, once here at the wrong identity (the AUTHORING
|
|
496
|
-
// provider/model) and once at the gate, was the bug this fixes: a close
|
|
497
|
-
// calibrated against judge X got stamped with model Y, and only the run-time
|
|
498
|
-
// read (`scripts/run-u.mjs:1144`) used the job's real worker, so the mismatch
|
|
499
|
-
// surfaced as a recalibration refusal on the close's first real run.
|
|
500
|
-
// `assembleSpec` carries `provider`/`model`/`judge` from the draft into the
|
|
501
|
-
// spec untouched, so resolving again from the assembled spec below (where the
|
|
502
|
-
// identity is guaranteed valid, because `validateJob` has already passed by
|
|
503
|
-
// then) returns the byte-identical pair — one rule, read twice, not two rules.
|
|
504
|
-
//
|
|
505
|
-
// This first read runs BEFORE `validateJob` has seen the draft, so a draft
|
|
506
|
-
// naming an unresolvable provider or a malformed `judge` override THROWS here
|
|
507
|
-
// — caught, because that draft is going to red cleanly at `validateJob` a few
|
|
508
|
-
// lines below regardless, and the placeholder this falls back to is discarded
|
|
509
|
-
// unsigned the moment it does.
|
|
510
|
-
const resolveDraftJudge = (/** @type {any} */ d) => {
|
|
511
|
-
try {
|
|
512
|
-
return resolveJobJudge(d, PROVIDER_NAME, resolveWorkerModel);
|
|
513
|
-
} catch {
|
|
514
|
-
return { provider: PROVIDER_NAME, model: MODEL };
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
const draftJudge = resolveDraftJudge(draft);
|
|
518
|
-
|
|
519
485
|
// Secrets load from the environment; they never enter argv (a command line is
|
|
520
486
|
// world-readable on /proc) and they are never printed.
|
|
521
487
|
// The key is the chosen row's own variable (P8: no built-in name). Names only.
|
|
@@ -538,15 +504,6 @@ export async function main(argv, deps = {}) {
|
|
|
538
504
|
const al = ratesOfLine(W.line);
|
|
539
505
|
authorPrice = al ? { ...al, envName: AUTHOR_ROW.envName } : null;
|
|
540
506
|
}
|
|
541
|
-
/** The judge's key follows the RESOLVED judge provider's own env var, with
|
|
542
|
-
* `JUDGE_API_KEY` as the role-named override in front (PRD item 32.3) — the same
|
|
543
|
-
* contract `scripts/run-u.mjs` keeps, so one story covers both surfaces. When the
|
|
544
|
-
* judge IS the authoring provider this is the key already read above. */
|
|
545
|
-
const judgeRowOf = (/** @type {{provider: string, model?: string|null}} */ j) => judgeRowFor(keyCfg, j, PROVIDER_NAME, AUTHOR_ROW);
|
|
546
|
-
const judgeKeyFor = (/** @type {string} */ providerName) => (
|
|
547
|
-
env.JUDGE_API_KEY ?? (providerName === PROVIDER_NAME ? apiKey : keyValueOf(env, judgeRowFor(keyCfg, { provider: providerName }, PROVIDER_NAME, AUTHOR_ROW)?.envName))
|
|
548
|
-
);
|
|
549
|
-
|
|
550
507
|
/** F6 — an unpriced call makes the TOTAL unknown, and unknown is reported as
|
|
551
508
|
* UNKNOWN. `?? 0` launders unknown into $0, and a bare floor that reads as exact
|
|
552
509
|
* is F6 in an honest coat, so the floor is marked `≥`.
|
|
@@ -577,17 +534,9 @@ export async function main(argv, deps = {}) {
|
|
|
577
534
|
out(` ${ceilingLine(CEILING_USD)}`);
|
|
578
535
|
out(' stops at prepareSigning — this script NEVER signs and NEVER runs the job\n');
|
|
579
536
|
|
|
580
|
-
// F190 (docs/wiki/FINDINGS.md)
|
|
581
|
-
// call, a duplicate of the SAME construction `buildRunnerProviders` already
|
|
582
|
-
// owns for `src/cli.js`. Routed through the one owner now: the judge half of
|
|
583
|
-
// this call is a THROWAWAY (`judgeProviderName`/`judgeModel`/`judgeBaseUrl` all
|
|
584
|
-
// equal the author's own identity, so `buildRunnerProviders`' own reuse check
|
|
585
|
-
// returns the SAME instance as `provider` rather than constructing a second
|
|
586
|
-
// one) — the real judge identity is not resolved until after `validateJob`,
|
|
587
|
-
// further down, where a second call takes only its `.judgeProvider`.
|
|
537
|
+
// F190 (docs/wiki/FINDINGS.md): the one owner of the provider construction (`buildRunnerProviders`), shared with src/cli.js.
|
|
588
538
|
const { provider } = buildRunnerProviders({
|
|
589
539
|
providerName: PROVIDER_NAME, apiKey, model: MODEL, baseUrl, legacyMaxTokens: AUTHOR_ROW.legacyMaxTokens,
|
|
590
|
-
judgeApiKey: apiKey, judgeModel: MODEL, judgeProviderName: PROVIDER_NAME, judgeBaseUrl: baseUrl,
|
|
591
540
|
});
|
|
592
541
|
emit('author-start', { runid, source: SOURCE, lang: LANG, verdictType: VERDICT, provider: PROVIDER_NAME, model: MODEL, baseUrl: baseUrl ?? null, job: draft?.job ?? null, timeoutMs: TIMEOUT_MS, ceilingUsd: CEILING_USD });
|
|
593
542
|
|
|
@@ -868,13 +817,6 @@ export async function main(argv, deps = {}) {
|
|
|
868
817
|
// `provider` drives the scout; `generate` is the declaration model boundary (one
|
|
869
818
|
// bare-agent Loop per call, the tool wired to end the call it is used in).
|
|
870
819
|
const authored = await authorCloseForJob({
|
|
871
|
-
// the judge that will certify this close's calibration set, if it composes a
|
|
872
|
-
// judged stage (PRD item 32.1). A DRAFT CAN carry a signed `judge` override
|
|
873
|
-
// already (`judge` is an OPERATOR field, not one of `AUTHORED_SPEC_FIELDS`) —
|
|
874
|
-
// `draftJudge`, resolved once above from the draft's own `provider`/`model`/
|
|
875
|
-
// `judge`, is what the spec will resolve to at run time (`scripts/run-u.mjs`),
|
|
876
|
-
// not this authoring run's own drafting identity.
|
|
877
|
-
judgeModel: draftJudge.model,
|
|
878
820
|
answers,
|
|
879
821
|
verdictType: VERDICT,
|
|
880
822
|
repoPath: SOURCE,
|
|
@@ -997,15 +939,6 @@ export async function main(argv, deps = {}) {
|
|
|
997
939
|
if (r.red) out(` red: ${JSON.stringify(r.red)}`);
|
|
998
940
|
for (const e of refusalEvents(r)) emit(e.type, e);
|
|
999
941
|
}
|
|
1000
|
-
// a refused rubric proposal reads in plain words FIRST (the same text the panel shows), the technical reds after
|
|
1001
|
-
if (PLAIN_PROPOSAL_STOPS.includes(String(authored.stop))) {
|
|
1002
|
-
out(`\n${proposalStopText({
|
|
1003
|
-
stop: String(authored.stop), reds: authored.reds ?? [],
|
|
1004
|
-
cases: authored.judged?.signed?.cases ?? authored.judged?.proposal?.proposal?.cases ?? null,
|
|
1005
|
-
spend: authored.cost ? { knownUsd: authored.cost.knownUsd ?? null, spendComplete: authored.cost.spendComplete ?? null } : null,
|
|
1006
|
-
source: authored.judged?.source === 'signer' ? 'signer' : 'proposal',
|
|
1007
|
-
})}`);
|
|
1008
|
-
}
|
|
1009
942
|
for (const red of authored.reds ?? []) {
|
|
1010
943
|
out(`\nRED ${red.code} at ${red.path}\n${red.detail}`);
|
|
1011
944
|
emit('job-red', red);
|
|
@@ -1053,21 +986,6 @@ export async function main(argv, deps = {}) {
|
|
|
1053
986
|
// this block is otherwise reachable only after a paid scout and a paid model call,
|
|
1054
987
|
// and a readout no test can reach is a readout nothing checks.
|
|
1055
988
|
for (const l of declarationLines(spec)) out(l);
|
|
1056
|
-
// …and, for a close that JUDGES, the two artifacts the judge is signed with.
|
|
1057
|
-
// NAMED DEFERRAL, said out loud rather than implied: this script's ONE
|
|
1058
|
-
// interactive seam is the confirm turn above (PRD item 33 M3 piece 4,
|
|
1059
|
-
// step S4) — it does not ALSO offer the D5 fix step here, so the
|
|
1060
|
-
// proposal is signed AS PROPOSED. The library seam exists
|
|
1061
|
-
// (`authorCloseForJob({signerFix})`) and the interactive surface for IT
|
|
1062
|
-
// is the interview's and the UI's (N6), which is the same split the
|
|
1063
|
-
// guard battery already lives under here: shown, not edited at this surface.
|
|
1064
|
-
const rubric = rubricLines(spec);
|
|
1065
|
-
if (rubric.length) {
|
|
1066
|
-
for (const l of rubric) out(l);
|
|
1067
|
-
out(` source ${authored.judged?.source ?? 'unknown'}`
|
|
1068
|
-
+ (authored.judged?.source === 'proposal' ? ' (proposed and stored unedited — this script offers no fix step)' : ''));
|
|
1069
|
-
for (const s of authored.judged?.scrubbed ?? []) out(` MASKED ${s.path} — the stored bytes differ from what was typed`);
|
|
1070
|
-
}
|
|
1071
989
|
out(`written ${specFile}`);
|
|
1072
990
|
|
|
1073
991
|
// `shellCapUsd` COUPLES to the spec's own budget, exactly as run-u does it at the
|
|
@@ -1088,97 +1006,6 @@ export async function main(argv, deps = {}) {
|
|
|
1088
1006
|
} else {
|
|
1089
1007
|
// ── 3. D9's gates. Nothing here judges the close; it measures it. ────────
|
|
1090
1008
|
//
|
|
1091
|
-
// THE JUDGE SEAM, wired only when the close actually judges. It is a
|
|
1092
|
-
// A SEPARATE provider instance for the judge: its tier is never the
|
|
1093
|
-
// drafter's model and never agent-selectable, and §4.2's safety argument is
|
|
1094
|
-
// worth exactly as much as the tier its injection evidence was measured on.
|
|
1095
|
-
// Absent it, `prepareSigning` refuses the close as a wiring gap rather than
|
|
1096
|
-
// signing an ungraded ruler.
|
|
1097
|
-
const judges = closeJudges(spec.closeDecl);
|
|
1098
|
-
// THE JUDGE, RESOLVED (PRD item 32.1) — the job's OWN worker provider and
|
|
1099
|
-
// model by default, a signed `judge` override when the spec names one.
|
|
1100
|
-
// Resolved from the ASSEMBLED SPEC through the same `resolveJobJudge` call
|
|
1101
|
-
// as `draftJudge` above; `provider`/`model`/`judge` reached here unchanged
|
|
1102
|
-
// from the draft, so this is the identical pair — the calibration gate
|
|
1103
|
-
// STAMPS the graded set with whatever this resolves to, so the identity
|
|
1104
|
-
// that certifies the floor here must be the identity the close will later
|
|
1105
|
-
// refuse to grade without (and the identity `scripts/run-u.mjs` resolves).
|
|
1106
|
-
const judge = judges
|
|
1107
|
-
? resolveJobJudge(spec, PROVIDER_NAME, resolveWorkerModel)
|
|
1108
|
-
: null;
|
|
1109
|
-
// the judge's price: the judge model's own row (`judgeRatesFor`) — on the author's endpoint when the
|
|
1110
|
-
// judge is the same provider, else the row for the judge's own provider. A bad one refuses here,
|
|
1111
|
-
// before the calibration gate spends anything — beside the judge-key check, the same door.
|
|
1112
|
-
/** @type {ReturnType<typeof ratesFor>} */
|
|
1113
|
-
let judgePrice = null;
|
|
1114
|
-
if (judge) {
|
|
1115
|
-
try {
|
|
1116
|
-
judgePrice = judgeRatesFor(judge, PROVIDER_NAME, baseUrl, authorPrice, keyCfg);
|
|
1117
|
-
} catch (e) {
|
|
1118
|
-
if (!(e instanceof ConfigError)) throw e;
|
|
1119
|
-
err(`${e.message} — refusing before the calibration gate spends anything`);
|
|
1120
|
-
archiveGateAudit();
|
|
1121
|
-
throw new ExitSignal(2);
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
// F181 — the judge key is required exactly when `judges` is true (this
|
|
1125
|
-
// script has no presence check on it today; adding one is out of this
|
|
1126
|
-
// finding's scope). What this door DOES owe, the same as the worker
|
|
1127
|
-
// key above: a resolved value that IS present but carries a shape an
|
|
1128
|
-
// HTTP header cannot refuses here, before the calibration gate spends
|
|
1129
|
-
// anything, rather than crashing mid-call.
|
|
1130
|
-
// `if (judge)` rather than `if (judges)`: identical at runtime (`judge`
|
|
1131
|
-
// is non-null exactly when `judges` is true, by the ternary just above)
|
|
1132
|
-
// but this form is what actually narrows `judge` for tsc below, honestly,
|
|
1133
|
-
// rather than a cast past what it can prove.
|
|
1134
|
-
if (judge) {
|
|
1135
|
-
const judgeKeyValue = judgeKeyFor(judge.provider);
|
|
1136
|
-
const judgeKeyProblem = judgeKeyValue ? apiKeyProblem(judgeKeyValue) : null;
|
|
1137
|
-
if (judgeKeyProblem) {
|
|
1138
|
-
const judgeEnvName = env.JUDGE_API_KEY ? 'JUDGE_API_KEY' : (judgeRowOf(judge)?.envName ?? judge.provider);
|
|
1139
|
-
err(`${judgeEnvName} ${judgeKeyProblem} — refusing rather than crashing mid-call (never trimmed or repaired; fix the value at its source)`);
|
|
1140
|
-
// F186 — the scout above already ran and may have left its own gate
|
|
1141
|
-
// audit in the tree. Under `process.exit()` this path used to skip
|
|
1142
|
-
// the finally block below entirely, so the audit was archived here
|
|
1143
|
-
// explicitly. A thrown ExitSignal now DOES reach the finally block
|
|
1144
|
-
// (unlike process.exit()) — archiveGateAudit() runs again there —
|
|
1145
|
-
// but the call stays here too: it is idempotent (`gateAuditArchived`
|
|
1146
|
-
// guards it), and this keeps the archive from ever depending on the
|
|
1147
|
-
// finally block running first, the same defensive reasoning F186
|
|
1148
|
-
// was written under.
|
|
1149
|
-
archiveGateAudit();
|
|
1150
|
-
throw new ExitSignal(2);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
// F190 — `baseUrl` rides along only when the judge is the SAME provider
|
|
1154
|
-
// as the author/worker: a spec's `baseUrl` is the AUTHOR's endpoint, and
|
|
1155
|
-
// handing it to a different vendor's client is the silent-misconfiguration
|
|
1156
|
-
// class `endpointKey` exists to prevent (a DeepSeek key sent to the
|
|
1157
|
-
// openai-api default host, e.g.). Routed through `buildRunnerProviders`
|
|
1158
|
-
// (the ONE owner of this construction — `src/cli.js` and, above,
|
|
1159
|
-
// this file's own author provider) rather than a hand-rolled
|
|
1160
|
-
// `makeProvider` call: the `providerName`/`apiKey`/`model`/`tierModels`/
|
|
1161
|
-
// `baseUrl` half repeats the author's own identity (so its `provider`
|
|
1162
|
-
// half of the return, unused here, is a throwaway — never a second live
|
|
1163
|
-
// instance of the author's client), and the `judge*` half is this run's
|
|
1164
|
-
// OWN resolved judge — the identical conditional `scripts/run-u.mjs`'s
|
|
1165
|
-
// own call already applies.
|
|
1166
|
-
// an if/else, not the equivalent ternary — the ternary's own ok-branch
|
|
1167
|
-
// object literal did not narrow `judge` for tsc; this form does, the
|
|
1168
|
-
// same real-narrowing reasoning as the `if (judge)` above.
|
|
1169
|
-
let judgeProvider = null;
|
|
1170
|
-
if (judge) {
|
|
1171
|
-
judgeProvider = buildRunnerProviders({
|
|
1172
|
-
providerName: PROVIDER_NAME, apiKey, model: MODEL, baseUrl, legacyMaxTokens: AUTHOR_ROW.legacyMaxTokens,
|
|
1173
|
-
judgeApiKey: judgeKeyFor(judge.provider), judgeModel: judge.model, judgeProviderName: judge.provider,
|
|
1174
|
-
judgeBaseUrl: judge.provider === PROVIDER_NAME ? baseUrl : (judgeRowOf(judge)?.baseUrl.trim() || undefined),
|
|
1175
|
-
judgeLegacyMaxTokens: judge.provider === PROVIDER_NAME ? AUTHOR_ROW.legacyMaxTokens : (judgeRowOf(judge)?.legacyMaxTokens ?? false),
|
|
1176
|
-
}).judgeProvider;
|
|
1177
|
-
}
|
|
1178
|
-
if (judge) {
|
|
1179
|
-
out(`\ncalibration gate — REAL judge calls at ${judge.model} on ${judge.provider}, one per case plus the injection battery.`);
|
|
1180
|
-
out(' this is the only gate that spends money, and it runs after every free one.');
|
|
1181
|
-
}
|
|
1182
1009
|
// the end check: a rubric close with no real check is refused here, whatever the seed gate would say (the stop words are printed below from signingStopText)
|
|
1183
1010
|
const signing = authored.hasBuiltCheck === false
|
|
1184
1011
|
? { ok: false, reds: [], refusal: null, specHash: null, seedRef: authored.seedRef, gates: { declaration: { ok: true, grounded: '-' }, precheck: null, seedVerdict: null }, work: [], guards: [], stops: [] }
|
|
@@ -1187,20 +1014,6 @@ export async function main(argv, deps = {}) {
|
|
|
1187
1014
|
// gate 1a re-runs the job validator inside prepareSigning — same coupling, or
|
|
1188
1015
|
// the spec that just passed above would fail the gate that signs it
|
|
1189
1016
|
shellCapUsd: spec.budgetUsd,
|
|
1190
|
-
// …and the SAME operator ceiling the scout and the declaration loop ran under,
|
|
1191
|
-
// with everything they spent folded in. The gate is this run's third and
|
|
1192
|
-
// largest paid seam; without both halves the advertised budget and the
|
|
1193
|
-
// enforced budget are two different numbers, and re-invoking a seam under one
|
|
1194
|
-
// number would silently widen it.
|
|
1195
|
-
ceilingUsd: CEILING_USD,
|
|
1196
|
-
priorCalls: [...metered],
|
|
1197
|
-
judgeLoop: judgeProvider ? (o) => defaultJudgeLoop({ provider: judgeProvider, system: o.system, rates: judgePrice?.rates ?? null, thinking: spec.thinking === true }) : null,
|
|
1198
|
-
// the seam's other half (PRD item 32.1): the graded set is STAMPED with
|
|
1199
|
-
// this, and the close later refuses to grade under any other identity.
|
|
1200
|
-
judgeModel: judge?.model ?? null,
|
|
1201
|
-
// the gate's spend joins the run's ONE metered list, under the judge call's
|
|
1202
|
-
// own label — a close's calibration is money like any other money (F12)
|
|
1203
|
-
onJudgeCost: (c) => onCall({ label: `${c.label}:${c.id}`, costUsd: c.costUsd, unpricedRounds: c.unpricedRounds }),
|
|
1204
1017
|
});
|
|
1205
1018
|
const signingFile = writeOut('signing.json', signing);
|
|
1206
1019
|
emit('signing', { ok: signing.ok, specHash: signing.specHash, seedRef: signing.seedRef, gates: signing.gates });
|
|
@@ -1209,28 +1022,15 @@ export async function main(argv, deps = {}) {
|
|
|
1209
1022
|
out('\ngates');
|
|
1210
1023
|
out(` 1 declaration ${g.declaration?.ok ? 'PASS' : 'FAIL'} grounded=${g.declaration?.grounded ?? '-'}${g.declaration?.scoped ? ` scoped=${JSON.stringify(g.declaration.scoped)}` : ''}`);
|
|
1211
1024
|
out(` 2 precheck ${g.precheck === null ? 'not reached' : (g.precheck.ok ? 'PASS — every stage ran' : `FAIL — ${g.precheck.stops.length} stage(s) could not run`)}`);
|
|
1212
|
-
// ruling 3: the judged-ONLY close clears this gate on its calibration, so the
|
|
1213
|
-
// line says PASS and names the proof — printing FAIL beside a signable spec
|
|
1214
|
-
// would be the readout disagreeing with the gate it reports on
|
|
1215
1025
|
out(` 3 seed verdict ${g.seedVerdict === null
|
|
1216
1026
|
? 'not reached'
|
|
1217
1027
|
: (g.seedVerdict.ok
|
|
1218
1028
|
? `PASS — work red at seed: ${g.seedVerdict.workRed.join(', ')}`
|
|
1219
|
-
:
|
|
1220
|
-
? 'PASS via the CALIBRATION gate — this close carries a judged stage'
|
|
1221
|
-
: 'FAIL — no work stage is red at the seed'))}`);
|
|
1029
|
+
: 'FAIL — no work stage is red at the seed')}`);
|
|
1222
1030
|
if (g.seedVerdict) {
|
|
1223
1031
|
out(` red at seed: ${g.seedVerdict.redAtSeed.join(', ') || '(none)'}`);
|
|
1224
1032
|
out(` green at seed: ${g.seedVerdict.greenAtSeed.join(', ') || '(none)'}`);
|
|
1225
|
-
// ruling 3 (widened 2026-10-09): a close with a judged stage clears gate 3 on its calibration instead,
|
|
1226
|
-
// and the surface SAYS which proof carried it rather than leaving a reader
|
|
1227
|
-
// to wonder why an empty workRed list passed
|
|
1228
|
-
if (g.seedVerdict.satisfiedBy === 'calibration') {
|
|
1229
|
-
out(' a judged stage skips the seed read (ruling 8), so this close\'s proof that its judged stage CAN fail is');
|
|
1230
|
-
out(' the graded calibration set below — signed cases it must red as well as ones it must pass.');
|
|
1231
|
-
}
|
|
1232
1033
|
}
|
|
1233
|
-
if (judges) for (const l of calibrationLines(g.calibration)) out(l);
|
|
1234
1034
|
|
|
1235
1035
|
/** the seed evidence a user READS to decide whether this close measures their
|
|
1236
1036
|
* job. `value`/`baseline` print as `unknown` when absent — never as 0. */
|
|
@@ -1275,13 +1075,10 @@ export async function main(argv, deps = {}) {
|
|
|
1275
1075
|
if (signing.specHash && signing.specHash !== hash) {
|
|
1276
1076
|
out(` NOTE prepareSigning hashed ${signing.specHash} — the validator normalized the spec; sign the resolved one.`);
|
|
1277
1077
|
}
|
|
1278
|
-
// THE WHOLE RUN's spend, off the ONE metered list
|
|
1279
|
-
// populations in it. Gates 1-3 spend no tokens (they run commands); gate 4
|
|
1280
|
-
// buys a real judge call per case, so a line saying "the gates spend no
|
|
1281
|
-
// tokens" would have been false the moment a judged close reached here.
|
|
1078
|
+
// THE WHOLE RUN's spend, off the ONE metered list. Gates 1-3 spend no tokens (they run commands).
|
|
1282
1079
|
out(`authoring ${costLine(authored.cost)}`);
|
|
1283
1080
|
const totalCost = costSoFar();
|
|
1284
|
-
out(`total cost ${costLine(totalCost)}
|
|
1081
|
+
out(`total cost ${costLine(totalCost)} (gates 1-3 spend no tokens — they run commands)`);
|
|
1285
1082
|
// hamr's ruling 2026-09-28 ("one cap covers drafting + run") — this
|
|
1286
1083
|
// run's own known FLOOR (never $0 on an unpriced call, F6), handed to
|
|
1287
1084
|
// the run-u command below as `--draft-spent-usd` so the SIGNED run's
|
package/src/blockasks.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { readingQuestion, cantCheckQuestion } from './pagemap.js';
|
|
4
4
|
import { plainWords, HOW_TO_ANSWER, CANT_CHECK_WORDS } from './checkpick.js';
|
|
5
5
|
|
|
6
|
-
/** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'cant-check'|'no-check'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any
|
|
6
|
+
/** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'cant-check'|'no-check'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>}} BlockAsk */
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The questions the block has open, in the order the person meets them: the look's readings, then the look's can't-checks, then the pick path's asks (a proposal or a can't-check about a rule the pick path owns) in rule order (a proposal is not counted toward the 3-ask cap).
|
|
@@ -16,7 +16,7 @@ export function questionsOfBlock(block, scoped = []) {
|
|
|
16
16
|
return block.open.map((/** @type {any} */ q) => {
|
|
17
17
|
const row = block.rows.find((r) => r.key === q.rowKey);
|
|
18
18
|
const rule = Number(row?.rule);
|
|
19
|
-
const base = { key: q.key, rowKey: q.rowKey, line: q.line, rule, source: /** @type {'look'} */ ('look'), ruleText: String(q.ruleText)
|
|
19
|
+
const base = { key: q.key, rowKey: q.rowKey, line: q.line, rule, source: /** @type {'look'} */ ('look'), ruleText: String(q.ruleText) };
|
|
20
20
|
if (q.ask === 'reading') return { ...base, ask: /** @type {'reading'} */ ('reading'), counted: true, reading: String(q.proposal), question: readingQuestion(q.line, String(q.ruleText), String(q.proposal)) };
|
|
21
21
|
if (q.ask === 'check') {
|
|
22
22
|
const words = plainWords(q.proposal);
|
package/src/bundlerun.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { askRequired, isQuit } from './prompts.js';
|
|
25
25
|
import { askBundle, resolveBundleRef } from './bundleref.js';
|
|
26
26
|
import { rowsForHome, chatLines } from './providerrows.js';
|
|
27
|
-
import { jobSpecHash } from './job.js';
|
|
27
|
+
import { jobSpecHash, oldJobWords } from './job.js';
|
|
28
28
|
import { addWorktree, worktreePath, commitWork } from './worktree.js';
|
|
29
29
|
import { parseJsonl } from './replayio.js';
|
|
30
30
|
import { legsOf } from './legs.js';
|
|
@@ -93,6 +93,9 @@ export async function bundleMain(args, {
|
|
|
93
93
|
// the repo. Any red (incl. bundle-tampered) stops here.
|
|
94
94
|
const bundle = readBundle(bundleDir);
|
|
95
95
|
if (!bundle.ok) { printReds(bundle.reds, err); return 1; }
|
|
96
|
+
// hamr 2026-11-14 (piece 6): a bundle of a job made with PASS/FAIL examples or the old judge does not run; old runs are not repaired
|
|
97
|
+
const oldJob = oldJobWords(bundle.spec);
|
|
98
|
+
if (oldJob !== null) { err(oldJob); return 1; }
|
|
96
99
|
|
|
97
100
|
// 1b. F128 — the bundle's OWN node_modules must carry `bareloop` before anything else
|
|
98
101
|
// runs. Left unchecked, the close crashes deep inside runJob's close-first precheck with
|