bareloop 0.55.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 +82 -0
- package/README.md +3 -3
- package/bareloop.context.md +69 -209
- package/package.json +2 -2
- package/src/authorflow.js +164 -340
- package/src/authoring.js +7 -127
- package/src/authorjob.js +139 -472
- package/src/authorreadout.js +24 -368
- package/src/authorrun.js +21 -215
- package/src/behaviour.js +14 -0
- package/src/blockasks.js +43 -0
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +798 -0
- package/src/checklist.js +128 -0
- package/src/checkpick.js +39 -312
- package/src/checkwords.js +3 -1
- package/src/cli.js +3 -3
- package/src/declaredclose.js +38 -108
- package/src/destpoint.js +4 -2
- package/src/draftspend.js +46 -0
- package/src/facts.js +8 -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 +15 -3
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +24 -6
- package/src/panel/authorsession.js +222 -177
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +198 -26
- package/src/panel/jobplan.js +87 -33
- package/src/panel/server.js +74 -68
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +34 -55
- package/src/placerule.js +355 -0
- package/src/planrun.js +2 -48
- package/src/promptregisters.js +13 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +104 -0
- package/src/rowedit.js +115 -0
- package/src/rubricstep.js +234 -127
- package/src/run.js +11 -16
- package/src/userrun.js +60 -112
- package/types/authorflow.d.ts +41 -197
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +35 -59
- package/types/authorreadout.d.ts +10 -88
- package/types/behaviour.d.ts +12 -0
- package/types/blockasks.d.ts +36 -0
- package/types/checkblock.d.ts +376 -0
- package/types/checklist.d.ts +134 -0
- package/types/checkpick.d.ts +8 -140
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +7 -33
- package/types/destpoint.d.ts +2 -0
- package/types/draftspend.d.ts +21 -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 +3 -104
- package/types/noteask.d.ts +76 -0
- package/types/pagedry.d.ts +13 -0
- package/types/pagemap.d.ts +4 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +47 -5
- package/types/panel/jobgrid.d.ts +8 -8
- package/types/panel/jobplan.d.ts +48 -10
- package/types/panel/server.d.ts +27 -18
- package/types/panel/status.d.ts +5 -0
- package/types/pickrecord.d.ts +20 -13
- package/types/placerule.d.ts +194 -0
- 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 +87 -0
- package/types/rowedit.d.ts +32 -0
- package/types/rubricstep.d.ts +100 -48
- package/types/run.d.ts +9 -19
- package/types/userrun.d.ts +0 -1
- package/src/calibrate.js +0 -702
- package/src/cardauthor.js +0 -502
- package/src/fitcheck.js +0 -166
- package/types/calibrate.d.ts +0 -201
- package/types/cardauthor.d.ts +0 -358
- package/types/fitcheck.d.ts +0 -113
package/src/userrun.js
CHANGED
|
@@ -32,7 +32,7 @@ import { commitWork, removeWorktree, removePrRef } from './worktree.js';
|
|
|
32
32
|
import { moveFile } from './movefile.js';
|
|
33
33
|
import { runJob } from './run.js';
|
|
34
34
|
import { moneyWithDraft } from './replay.js';
|
|
35
|
-
import { jobSpecHash, resolveWorkerModel, validateJob, workflowKey, flowTypeOf } from './job.js';
|
|
35
|
+
import { jobSpecHash, resolveWorkerModel, validateJob, workflowKey, flowTypeOf, oldJobWords } from './job.js';
|
|
36
36
|
import { ticketNumberOf, TICKET_NUMBER_WORDS } from './ticketshape.js';
|
|
37
37
|
import { freezeRepoTicket } from './ticketrepo.js';
|
|
38
38
|
import { newestUnrunTicket } from './ticketnext.js';
|
|
@@ -41,6 +41,8 @@ import { skipWords } from './panel/status.js';
|
|
|
41
41
|
import { checkoutPrHead, prHeadIsAncestor, recordPrOnManifest } from './prcheckout.js';
|
|
42
42
|
import { readShimArm } from './readshim.js';
|
|
43
43
|
import { closeStagesOf } from './plan.js';
|
|
44
|
+
import { placeFactsOf, readPlaceRules, valueInWords, stopWords, lastPlaceRead, placeValuesOfEvents, bindPlaceValues, NO_PLACE_RECORD_WORDS } from './placerule.js';
|
|
45
|
+
import { readFrozenInputs } from './rubricstep.js';
|
|
44
46
|
import { resolveCloseTimeoutMs } from './closetimeout.js';
|
|
45
47
|
import { makeSpine } from './spine.js';
|
|
46
48
|
// PRD item 33/M2 — the source front door. `readSourceManifest` finds the
|
|
@@ -52,25 +54,12 @@ import { readSourceManifest, frontDoorFromManifest, proveDestination, copyOut, r
|
|
|
52
54
|
import { scanSecrets, redactSecrets } from './validate.js';
|
|
53
55
|
import { runBehaviour, formatBehaviour } from './behaviour.js';
|
|
54
56
|
// the three doors' SEMANTICS live in the library; this script surfaces them
|
|
55
|
-
import { normalizeHumanRuling, resolveHumanRuling
|
|
56
|
-
// SOFTGREEN — the judged stage's PINNED tier. The constant is the library's; a
|
|
57
|
-
// spelling here would be a second pin that can drift from the one the gate calibrated.
|
|
58
|
-
import { resolveJudge } from './judged.js';
|
|
57
|
+
import { normalizeHumanRuling, resolveHumanRuling } from './kinds.js';
|
|
59
58
|
// --resume reads the halted run's own spine back through the SAME reader the reuse
|
|
60
59
|
// path uses (never a second one) and keeps its patient the way it left it.
|
|
61
60
|
import { readResume, resumeTreeGate, checkpointAgeGate, writeRunGreenRow, CHECKPOINT_OUTCOMES, PAUSE_TTL_MS } from './reuse.js';
|
|
62
|
-
// PRD item 28's provider factory (src/providers.js): the WORKER provider's
|
|
63
|
-
//
|
|
64
|
-
// Settings row, src/providerrows.js) — one seam instead
|
|
65
|
-
// of an `if (provider === …)` scattered across this script. PRD item 32.2
|
|
66
|
-
// moved the JUDGE onto this SAME factory: it used to be separately pinned
|
|
67
|
-
// below to a hardcoded Anthropic constructor at the judged tier because the
|
|
68
|
-
// judge could only ever be Claude — now that its identity is RESOLVED
|
|
69
|
-
// (`resolveJudge`, imported above) rather than pinned, building it through a
|
|
70
|
-
// second bespoke constructor would be a second seam for the same job the
|
|
71
|
-
// worker's already goes through. `tests/reviewdoor-u.test.js` greps this
|
|
72
|
-
// file's own source to prove THIS runner actually wires the resolved judge
|
|
73
|
-
// through `makeProvider` into `runJob` (not just that the library can).
|
|
61
|
+
// PRD item 28's provider factory (src/providers.js): the WORKER provider's ctor/param-gating come from here (its key variable and price come from the
|
|
62
|
+
// Settings row, src/providerrows.js) — one seam instead of an `if (provider === …)` scattered across this script.
|
|
74
63
|
import { resolveProvider, makeProvider, probeWarningLines, apiKeyProblem } from './providers.js';
|
|
75
64
|
import { loadRegistry, quarantinesCredit } from './bridges.js';
|
|
76
65
|
import { HITL_PAUSE } from './declaredclose.js';
|
|
@@ -90,7 +79,7 @@ import { claimRun, monthlyRefusalText, legSpend, chainSpend } from './monthly.js
|
|
|
90
79
|
import { ConfigError } from './config.js';
|
|
91
80
|
import { learnAtRunEnd, handedHints, releaseRun } from './learnstore.js';
|
|
92
81
|
import { commandFor } from './invoke.js';
|
|
93
|
-
import {
|
|
82
|
+
import { keyNameFor, keyValueOf, priceReadout, ratesFor, ratesOfLine, resolveWorker, rowsForHome, REFUSE_NAME_MODEL } from './providerrows.js';
|
|
94
83
|
// the banner's wall arithmetic, extracted so it is reachable by a test (F83): the
|
|
95
84
|
// end-of-run readout sits past the approval gate, so nothing could ever drive it here
|
|
96
85
|
import { wallLine, doomedResume, deathAtOf, evidencePackage, doorLines, resumeAtLines, reviewDoorPackage, runDoorLines, tokensLine, doorTimingRedLines } from './u-readout.js';
|
|
@@ -245,7 +234,6 @@ class ExitSignal extends Error {
|
|
|
245
234
|
* check entirely, the same shape `src/cli.js`'s `main(argv, deps)` uses.
|
|
246
235
|
* @property {(tier: string) => any} [providerFor]
|
|
247
236
|
* @property {(url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>} [fetchUrl] PART 1c - a test seam: how a web input is read at run start (production: barebrowse)
|
|
248
|
-
* @property {any} [judgeProvider]
|
|
249
237
|
* @property {typeof newestUnrunTicket} [newestUnrunTicket] R6 - a test seam: how a Tickets run that names no `--ticket` finds the newest unrun ticket (production: the real look, src/ticketnext.js)
|
|
250
238
|
* @property {string} [mcpConfig] R6 - a test seam: the MCP config file that look reads (production: the person's own, found by src/mcpsources.js)
|
|
251
239
|
* @property {string} [runlistHome] F196 — a test seam for `appendRun`'s
|
|
@@ -527,9 +515,7 @@ async function execute(ctx) {
|
|
|
527
515
|
// MODEL (build-list #3, hamr's GO 2026-08-30): the signed spec's `model`, if
|
|
528
516
|
// present, wins outright; a --model flag naming a DIFFERENT id is refused
|
|
529
517
|
// (never silently overridden) — resolveWorkerModel is the one decision, pure
|
|
530
|
-
// and tested apart from this script.
|
|
531
|
-
// (`resolveJudge`, below the key block): it defaults to this same resolved
|
|
532
|
-
// worker model and a signed `judge` override wins over it.
|
|
518
|
+
// and tested apart from this script.
|
|
533
519
|
// There is no default model: a spec or flag that names none dies below with
|
|
534
520
|
// REFUSE_NAME_MODEL (the model is one ticked in Settings). `spec.provider` is not validateJob'd until
|
|
535
521
|
// runJob below, so an unrecognized value dies here with the same operator-
|
|
@@ -1030,7 +1016,7 @@ async function execute(ctx) {
|
|
|
1030
1016
|
// the key from. Resolved ONCE here, at $0, before the preview, the monthly claim and any worktree or
|
|
1031
1017
|
// spine, then handed down as data (`runJob`'s `rates`) — nothing deep in the run re-reads config. A bad
|
|
1032
1018
|
// price refuses here; it never falls back to the built-in guess. No price set = `null` = no `rates` key
|
|
1033
|
-
// passed anywhere, byte-identical to before.
|
|
1019
|
+
// passed anywhere, byte-identical to before.
|
|
1034
1020
|
const keyCfg = cfgOn ? rowsForHome(cfgHome, env) : [];
|
|
1035
1021
|
/** @type {ReturnType<typeof ratesFor>} */
|
|
1036
1022
|
let workerPrice = null;
|
|
@@ -1259,6 +1245,8 @@ async function execute(ctx) {
|
|
|
1259
1245
|
// budget — money folds on every path, time does not.
|
|
1260
1246
|
/** @type {{text: string, fromRunid: string, receivedAt: string}|null} */
|
|
1261
1247
|
let DOOR_RERUN = null;
|
|
1248
|
+
/** @type {Record<string, string>|null} PLACE RULES: a door rerun's values, taken from the answered run's own record (it re-reads nothing) */
|
|
1249
|
+
let DOOR_PLACE_VALUES = null;
|
|
1262
1250
|
if (doorSpineFile !== null) {
|
|
1263
1251
|
if (RULING === null) {
|
|
1264
1252
|
err('NO DECISION — this run is standing at its review door and no decision was given.');
|
|
@@ -1267,6 +1255,20 @@ async function execute(ctx) {
|
|
|
1267
1255
|
throw new ExitSignal(2);
|
|
1268
1256
|
}
|
|
1269
1257
|
const answeredAt = new Date().toISOString();
|
|
1258
|
+
// PLACE RULES: an accept's re-proof and a rerun (which re-reads nothing: no refreeze at the door) use the values THIS run read, from its own `place-rules`
|
|
1259
|
+
// record (what a resume rebinds); never the signed drafting words, never a new read. No record = refused in plain words. The signed spec is not touched.
|
|
1260
|
+
/** @type {any} */
|
|
1261
|
+
let doorSpec = spec;
|
|
1262
|
+
if (RULING.decision !== 'pause' && placeFactsOf(spec).length > 0) {
|
|
1263
|
+
const doorPlaceValues = placeValuesOfEvents(doorEvents ?? []);
|
|
1264
|
+
if (doorPlaceValues === null) {
|
|
1265
|
+
err(`DOOR REFUSED (${RULING.decision}) — nothing was recorded and nothing was released.`);
|
|
1266
|
+
err(NO_PLACE_RECORD_WORDS);
|
|
1267
|
+
throw new ExitSignal(2);
|
|
1268
|
+
}
|
|
1269
|
+
doorSpec = bindPlaceValues(spec, doorPlaceValues);
|
|
1270
|
+
if (RULING.decision === 'rerun') DOOR_PLACE_VALUES = doorPlaceValues;
|
|
1271
|
+
}
|
|
1270
1272
|
// PRD item 27/M3 — the door's mechanical re-run needs the same effective
|
|
1271
1273
|
// ceiling the run itself would use; resolved through the identical
|
|
1272
1274
|
// function (`resolveCloseTimeoutMs`), never a second guess. Paid only on
|
|
@@ -1295,7 +1297,7 @@ async function execute(ctx) {
|
|
|
1295
1297
|
// `timedOut: true`, already handled above.
|
|
1296
1298
|
if (doorCloseTiming.closeTimeoutMs === null) throw new Error('unreachable: resolveCloseTimeoutMs sets closeTimeoutMs whenever timedOut is false');
|
|
1297
1299
|
const ans = await answerReviewDoor({
|
|
1298
|
-
job:
|
|
1300
|
+
job: doorSpec,
|
|
1299
1301
|
workdir: wd,
|
|
1300
1302
|
events: doorEvents ?? [],
|
|
1301
1303
|
decision: RULING.decision,
|
|
@@ -1435,50 +1437,9 @@ async function execute(ctx) {
|
|
|
1435
1437
|
// so there is one place saying which row reads which variable) and is
|
|
1436
1438
|
// ALWAYS required — the worker always runs.
|
|
1437
1439
|
//
|
|
1438
|
-
//
|
|
1439
|
-
// (`closeJudges`, src/kinds.js — the ONE reading of that question), and since
|
|
1440
|
-
// PRD item 32 the judge is no longer pinned to Anthropic: its identity is
|
|
1441
|
-
// RESOLVED below, and its key follows that resolved provider's own env var with
|
|
1442
|
-
// `JUDGE_API_KEY` as a role-named override in front. One variable used to do two
|
|
1443
|
-
// jobs (worker key for an anthropic-api job AND judge key for every job), which
|
|
1444
|
-
// was confusing while the judge was pinned and would be a plain lie now that it
|
|
1445
|
-
// is not.
|
|
1446
|
-
//
|
|
1447
|
-
// A green anthropic-api job's behaviour is byte-identical to before: its
|
|
1448
|
-
// worker key IS `ANTHROPIC_API_KEY`, demanded as ever.
|
|
1449
|
-
const JUDGES = closeJudges(spec.closeDecl);
|
|
1450
|
-
// WHICH MODEL GRADES THIS JOB (PRD item 32.1). Resolved, never pinned: the
|
|
1451
|
-
// spec's signed `judge: {provider, model}` if it names one, else this job's own
|
|
1452
|
-
// worker provider and model — so a DeepSeek or Gemini job judges on its own
|
|
1453
|
-
// provider and needs no second account. `resolveJudge` throws on a malformed
|
|
1454
|
-
// override rather than quietly falling back to the worker's; the spec validator
|
|
1455
|
-
// has already redded that shape, so reaching the throw means a caller skipped
|
|
1456
|
-
// validation. Resolved UNCONDITIONALLY (needs no key) — `judge.model` rides
|
|
1457
|
-
// into runJob below whether this leg constructs a real judge provider or not.
|
|
1458
|
-
const judge = resolveJudge({ specJudge: spec.judge, workerProvider: spec.provider, workerModel: MODEL });
|
|
1459
|
-
const judgeEntry = resolveProvider(judge.provider);
|
|
1460
|
-
// …and the judge's price, from the judge MODEL's row (`judgeRatesFor`): on the worker's endpoint when the
|
|
1461
|
-
// judge is the same provider (falling back to the worker's price when the model names no row), else the
|
|
1462
|
-
// row for the judge's own provider. Only a judging close ever calls it, so only then can its row refuse the run.
|
|
1463
|
-
/** @type {ReturnType<typeof ratesFor>} */
|
|
1464
|
-
let judgePrice = null;
|
|
1465
|
-
if (JUDGES) {
|
|
1466
|
-
try {
|
|
1467
|
-
judgePrice = judgeRatesFor(judge, spec.provider, baseUrl, workerPrice, keyCfg);
|
|
1468
|
-
} catch (e) {
|
|
1469
|
-
if (!(e instanceof ConfigError)) throw e;
|
|
1470
|
-
err(`${e.message} — refusing to start rather than guess a price. Nothing spent.`);
|
|
1471
|
-
throw new ExitSignal(2);
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
/** the row the judge's key (and endpoint) comes from: the worker's own row when the judge shares its provider, else the judge provider's row */
|
|
1475
|
-
const judgeRow = judgeRowFor(keyCfg, judge, spec.provider, W && W.ok ? W.row : null);
|
|
1476
|
-
// undefined, not null: both come straight off `env[...]` lookups below, which
|
|
1477
|
-
// (like process.env) never produce null for a missing key.
|
|
1440
|
+
// hamr 2026-11-14: there is no judge key any more — the old judge is gone, and a rubric job grades on the check list with no model call.
|
|
1478
1441
|
/** @type {string|undefined} */
|
|
1479
1442
|
let workerApiKey;
|
|
1480
|
-
/** @type {string|undefined} */
|
|
1481
|
-
let judgeApiKey;
|
|
1482
1443
|
// TEST SEAM (constraint: `deps.provider` skips the real-key check entirely,
|
|
1483
1444
|
// the same shape src/bundlerun.js's door uses) — a caller that hands in
|
|
1484
1445
|
// its own provider IS the run, so nothing here needs a real secret.
|
|
@@ -1486,8 +1447,7 @@ async function execute(ctx) {
|
|
|
1486
1447
|
// P4b — the Settings row (keys file line) whose API shape + Base URL match this spec
|
|
1487
1448
|
// supplies the key VARIABLE, standing in for the provider's built-in one; no matching
|
|
1488
1449
|
// row = the built-in. Names only — values come from the
|
|
1489
|
-
// env / keys file.
|
|
1490
|
-
// (the same rule that gives it the worker's baseUrl below).
|
|
1450
|
+
// env / keys file.
|
|
1491
1451
|
refuseWorker();
|
|
1492
1452
|
const workerKeyName = /** @type {NonNullable<typeof W> & {ok: true}} */ (W).row.envName;
|
|
1493
1453
|
// A job's worker key is its Settings row's own variable — there is no built-in name.
|
|
@@ -1499,29 +1459,6 @@ async function execute(ctx) {
|
|
|
1499
1459
|
// door, before any provider is constructed; never echo the value.
|
|
1500
1460
|
const workerKeyProblem = apiKeyProblem(workerApiKey);
|
|
1501
1461
|
if (workerKeyProblem) { err(`${workerKeyName} ${workerKeyProblem} — refusing rather than crashing mid-call (never trimmed or repaired; fix the value at its source)`); throw new ExitSignal(2); }
|
|
1502
|
-
// The judge's KEY follows the RESOLVED judge provider's own env var, with
|
|
1503
|
-
// `JUDGE_API_KEY` as a role-named override in front of it (PRD item 32.3). The
|
|
1504
|
-
// override matters most in the case this item exists for: a job whose worker and
|
|
1505
|
-
// judge are the SAME provider but different accounts, and the anthropic case
|
|
1506
|
-
// where one variable used to do two jobs.
|
|
1507
|
-
judgeApiKey = env.JUDGE_API_KEY ?? keyValueOf(env, judgeRow?.envName);
|
|
1508
|
-
if (JUDGES && !judgeApiKey) {
|
|
1509
|
-
err(`This job's close JUDGES (${judgedStages(spec.closeDecl).length} judged stage(s)) and its judge is ${judge.model} on ${judge.provider}${spec.judge ? ' (signed override)' : " (this job's own worker model — no `judge` override signed)"}.`);
|
|
1510
|
-
err(`Neither JUDGE_API_KEY nor ${judgeRow?.envName ?? `a key row for ${judge.provider}`} is set — secrets load from the environment, never the tree.`);
|
|
1511
|
-
err('Refused at $0, BEFORE the worker spends anything: a judged run that discovers this at the close has paid for a verdict it cannot render.');
|
|
1512
|
-
throw new ExitSignal(2);
|
|
1513
|
-
}
|
|
1514
|
-
// F181 — same door, second shape: a judge key that IS present can still be
|
|
1515
|
-
// malformed (line break/control char/stray whitespace). Checked only when
|
|
1516
|
-
// JUDGES (the key is only required then); never echoes the value.
|
|
1517
|
-
if (JUDGES) {
|
|
1518
|
-
const judgeKeyProblem = apiKeyProblem(/** @type {string} */ (judgeApiKey));
|
|
1519
|
-
if (judgeKeyProblem) {
|
|
1520
|
-
const judgeEnvName = env.JUDGE_API_KEY ? 'JUDGE_API_KEY' : (judgeRow?.envName ?? judge.provider);
|
|
1521
|
-
err(`${judgeEnvName} ${judgeKeyProblem} — refusing rather than crashing mid-call (never trimmed or repaired; fix the value at its source)`);
|
|
1522
|
-
throw new ExitSignal(2);
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
1462
|
}
|
|
1526
1463
|
|
|
1527
1464
|
// THE MONTHLY $ LIMIT (PANEL-BUILD.md P4a; hamr 2026-09-30: "whoever runs first claims the limit and
|
|
@@ -1653,6 +1590,12 @@ async function execute(ctx) {
|
|
|
1653
1590
|
throw new ExitSignal(2);
|
|
1654
1591
|
}
|
|
1655
1592
|
|
|
1593
|
+
/** @type {Record<string, string>|null} PLACE RULES: the values the run start read for the spec's place-rule facts (key to value), handed to `runJob`; null = none */
|
|
1594
|
+
let placeValues = DOOR_PLACE_VALUES;
|
|
1595
|
+
/** @type {{workflowKey: string, rows: object[]}|null} PLACE RULES: the record the spine keeps of that read; null on a resume (its first leg wrote it) */
|
|
1596
|
+
let placeRead = null;
|
|
1597
|
+
// a RESUME does not re-read: it rebinds the values its own first leg recorded, so the close grades on the words the run started with
|
|
1598
|
+
if (dead) placeValues = placeValuesOfEvents(deadAllEvents);
|
|
1656
1599
|
// RUN START REFETCH (PART 1c RF22; moved here 2026-10-19, run mvez8s54: the ~18 s barebrowse fetch ran in main() BEFORE this run was
|
|
1657
1600
|
// listed, so Sign & run showed nothing for 18 s). The run is listed FIRST (row above, with its pid and cap = the monthly claim), THEN
|
|
1658
1601
|
// fetches: the Run tab reads "fetching the page…" while source.json has no refrozenAt at or after the row. A refusal cannot be a
|
|
@@ -1709,6 +1652,25 @@ async function execute(ctx) {
|
|
|
1709
1652
|
throw new ExitSignal(2);
|
|
1710
1653
|
}
|
|
1711
1654
|
if (fresh.refreshed.length > 0 && typeof fresh.seed === 'string' && fresh.seed) SEED = fresh.seed;
|
|
1655
|
+
// PLACE RULES: every place-rule fact of the signed spec is read, by CODE, from this run's own copy of its input (the copy the refetch above just froze); the values are
|
|
1656
|
+
// bound as those facts' phrases on the run's in-memory copy inside `runJob`, after the approval check, and are never written to the signed spec. Any rule not found
|
|
1657
|
+
// stops the run here, before any provider call.
|
|
1658
|
+
const placeFacts = placeFactsOf(spec);
|
|
1659
|
+
if (placeFacts.length > 0) {
|
|
1660
|
+
const frozen = await readFrozenInputs(join(ctx.into, 'tree'), [...new Set(placeFacts.map((f) => f.source))]);
|
|
1661
|
+
// "last read": the newest earlier run of this workflow's own record, else the drafting words
|
|
1662
|
+
let earlier = {};
|
|
1663
|
+
if (cfgOn) { try { earlier = lastPlaceRead({ rows: readRunList({ home: cfgHome }).rows, job: spec.job, workflowKey: workflowKey(spec), runid }); } catch { /* no earlier record is the drafting words */ } }
|
|
1664
|
+
const read = readPlaceRules(placeFacts.map((fact) => ({ fact, text: frozen.ok ? (frozen.texts[fact.source] ?? null) : null, was: /** @type {Record<string, string>} */ (earlier)[fact.key] ?? valueInWords(fact.place, fact.phrase) })));
|
|
1665
|
+
if (!read.proceed) {
|
|
1666
|
+
const words = stopWords(read.rows);
|
|
1667
|
+
err(`${SELECTOR}: ${words}`);
|
|
1668
|
+
settleRefused(words);
|
|
1669
|
+
throw new ExitSignal(2);
|
|
1670
|
+
}
|
|
1671
|
+
placeValues = read.values;
|
|
1672
|
+
placeRead = { workflowKey: workflowKey(spec), rows: read.rows.map(({ name: _n, ...r }) => r) };
|
|
1673
|
+
}
|
|
1712
1674
|
}
|
|
1713
1675
|
|
|
1714
1676
|
const git = (/** @type {string[]} */ a) => execFileSync('git', ['-C', wd, ...a], { encoding: 'utf8' }).trim();
|
|
@@ -1770,31 +1732,12 @@ async function execute(ctx) {
|
|
|
1770
1732
|
// construction never runs (a scripted provider IS the run).
|
|
1771
1733
|
let provider = deps.provider;
|
|
1772
1734
|
let providerFor = deps.providerFor;
|
|
1773
|
-
let judgeProvider = deps.judgeProvider ?? null;
|
|
1774
1735
|
if (!provider) {
|
|
1775
1736
|
const legacyMaxTokens = W && W.ok ? W.row.legacyMaxTokens : false;
|
|
1776
1737
|
provider = makeProvider(spec.provider, { apiKey: /** @type {string} */ (workerApiKey), model: MODEL, baseUrl, legacyMaxTokens });
|
|
1777
1738
|
// P: the per-step model factory. The ONLY tier a plan may name is the schema token `sonnet` (STEP_MODELS, src/plan.js — a
|
|
1778
1739
|
// documented schema token, not a model id); it means THIS job's worker model, so every step's provider is the one above.
|
|
1779
1740
|
providerFor = () => provider;
|
|
1780
|
-
// SOFTGREEN — the JUDGED stage's own provider. Since PRD item 32.1 its identity is
|
|
1781
|
-
// RESOLVED (`judge` above), not pinned: the spec's signed `judge` override, else this
|
|
1782
|
-
// job's own worker model. It is still never a step knob and never agent-selectable —
|
|
1783
|
-
// naming your own examiner is arbiter territory, and `judge` is a field the HUMAN
|
|
1784
|
-
// signs into the hash. The `baseUrl` rides along only when the judge is the same
|
|
1785
|
-
// provider as the worker: a spec's `baseUrl` is the WORKER's endpoint, and pointing a
|
|
1786
|
-
// different vendor's client at it would be the silent-misconfiguration class
|
|
1787
|
-
// `endpointKey` exists to prevent. Built only when `judgeApiKey` is present (PRD item
|
|
1788
|
-
// 31.4 — the judge's key is demanded only when a judge is CALLED, so this construction
|
|
1789
|
-
// is conditional on purpose, not unconditional): `runPlan` reads it only when a stage
|
|
1790
|
-
// is `judged-floor`, and the alternative (deriving "does this close judge?" here) is a
|
|
1791
|
-
// second reading of the declaration that can drift from the one the runner actually
|
|
1792
|
-
// executes. Absent, a judged stage instrument-STOPS as a wiring gap, which is what
|
|
1793
|
-
// every live softgreen run would have done: run-author wired this seam and this
|
|
1794
|
-
// runner never did.
|
|
1795
|
-
judgeProvider = judgeApiKey
|
|
1796
|
-
? makeProvider(judge.provider, { apiKey: /** @type {string} */ (judgeApiKey), model: judge.model, baseUrl: judge.provider === spec.provider ? baseUrl : (judgeRow && judgeRow.baseUrl.trim() !== '' ? judgeRow.baseUrl.trim() : undefined), legacyMaxTokens: judgeRow ? judgeRow.legacyMaxTokens : false })
|
|
1797
|
-
: null;
|
|
1798
1741
|
}
|
|
1799
1742
|
|
|
1800
1743
|
const started = Date.now();
|
|
@@ -2023,6 +1966,8 @@ async function execute(ctx) {
|
|
|
2023
1966
|
try {
|
|
2024
1967
|
outcome = await runJob(spec, {
|
|
2025
1968
|
stopFile,
|
|
1969
|
+
...(placeValues === null ? {} : { placeValues }),
|
|
1970
|
+
...(placeRead === null ? {} : { placeRead }),
|
|
2026
1971
|
...(ticketRecord === null ? {} : { ticketRecord }),
|
|
2027
1972
|
...(ticketUnsure === null ? {} : { ticketUnsure }),
|
|
2028
1973
|
...(prRecord === null ? {} : { prRecord }),
|
|
@@ -2031,9 +1976,9 @@ async function execute(ctx) {
|
|
|
2031
1976
|
// used (never a second `makeSpine(spineFile)` here: two independent
|
|
2032
1977
|
// emitters against one file would both start their seq counter at 0 and
|
|
2033
1978
|
// collide the moment either one had already written a record).
|
|
2034
|
-
approvals, workdir: wd, provider, providerFor,
|
|
1979
|
+
approvals, workdir: wd, provider, providerFor,
|
|
2035
1980
|
// the customer's own price per key row (USD per 1K), or null = the built-in guess as before
|
|
2036
|
-
rates: workerPrice?.rates ?? null,
|
|
1981
|
+
rates: workerPrice?.rates ?? null, emit,
|
|
2037
1982
|
// F133 (run mtqwmb9l) — `closeTimeoutMs` is deliberately NOT passed here.
|
|
2038
1983
|
// `RESOLVED_CLOSE_TIMEOUT_MS` above exists only to size the outside
|
|
2039
1984
|
// watchdog before it spawns; feeding it back into `runJob` used to make
|
|
@@ -2719,6 +2664,9 @@ export async function main(argv, deps = {}) {
|
|
|
2719
2664
|
try { spec = JSON.parse(/** @type {string} */ (raw)); } catch (e) {
|
|
2720
2665
|
die(`--spec ${specPath} is not readable JSON (${e.message}) — a spec nobody can parse is a spec nobody signed`);
|
|
2721
2666
|
}
|
|
2667
|
+
// hamr 2026-11-14: a job made with PASS/FAIL examples or the old judge refuses in plain words, ahead of every other check
|
|
2668
|
+
const oldJob = oldJobWords(spec);
|
|
2669
|
+
if (oldJob) die(`--spec ${specPath}: ${oldJob} Nothing spent.`);
|
|
2722
2670
|
// validateJob'd HERE, at $0, before a single filesystem lookup for the
|
|
2723
2671
|
// source manifest or a single line of the preview prints — a `--job` row's
|
|
2724
2672
|
// spec is developer-authored and reaches this same check inside `runJob`
|