bareloop 0.54.0 → 0.54.1

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 CHANGED
@@ -5,6 +5,14 @@ All notable changes to bareloop are documented here. Format:
5
5
  [SemVer](https://semver.org/spec/v2.0.0.html). Pre-1.0: **minor** = a ladder rung or
6
6
  feature lands, **patch** = docs, fixes, scaffolding.
7
7
 
8
+ ## [0.54.1] - 2026-11-04
9
+
10
+ ### Fixed
11
+
12
+ - **The review door's held line no longer says a rubric green earns no learning credit.** A rubric run's lessons count at run end (PRD v1.112); only reuse/bridge credit waits for Accept, so `src/u-readout.js` now says "NO reuse credit until you accept it", and `bareloop.context.md` says the same in its two places. The same wording is fixed where Accept's release is described elsewhere: the door's Accept line (`src/u-readout.js`), the run-u HELD line (`src/userrun.js`), the `bridges.js`/`reuse.js` door comments, and the tests pinning them. Also, the learn-ledger climb test's failure message no longer quotes a time figure.
13
+ - **The step a money or time cap escalated reads capped, not failed.** A run that ended capped left its last step's card at `failed` because that step's own `step-end` says `escalated` and carries no stop reason (real spines msi0w2i5 and msx87qqs: the cap's escalation lands just before the step-end). `src/panel/server.js` now gives the run's LAST step part the cap word where the run's verdict is known, and only when that step's own escalation was the cap: a wall-halt reads time cap, a money cap-halt reads money cap (the replay part now carries its `tripped` escalation, with `ladder` when its strike limit ended it). A step its own strike limit escalated stays failed even if the run then ended on the cap (the ladder's stop is also category `cap-halt`, real spine u-mshcpdg4), and so does an earlier escalated step.
14
+ - **`climb` and `foldCards` no longer compare card pairs already in one family.** Same families, levels and groups (checked identical against the old code on 4,000 random ledgers for `climb`, and on 4,300 random and real-shaped card sets for `foldCards`); 2,000 same-lesson rows take about 60 ms instead of about 400 ms, which removes the load flake in `tests/learn-ledger.test.js`. `tests/launcher-stop-deadline.test.js` now uses a fake clock through a new optional `clock` dep of the launcher (default `performance.now`, no change for real callers), so load can no longer flip it.
15
+
8
16
  ## [0.54.0] - 2026-11-03
9
17
 
10
18
  ### Added
@@ -5,7 +5,7 @@
5
5
  > facts with quotes from the real artifact, an arbiter-owned `decide()` renders pass/fail from
6
6
  > a signed rubric card, and *unsure* is a red, never a pass — bought by a signed calibration
7
7
  > gate (ten graded truths, five resisted lies, floor 10/10, itemized reds). A soft-green pass
8
- > mints its bridge row QUARANTINED: no learning credit until an `accept` releases it, forward
8
+ > mints its bridge row QUARANTINED: no reuse credit until an `accept` releases it, forward
9
9
  > only; a rerun records a disposition and its outcome is a NEW run's own row, born held
10
10
  > again. Every run ends at the signer's **review door** — `accept` / `rerun` / `pause` — which
11
11
  > records a disposition and **never changes the loop's own verdict** (`runPlan` still returns
@@ -1903,7 +1903,7 @@ Loop path is untouched.
1903
1903
  **Resume-to-cap (close-first):** the job's close runs FIRST, before any tokens
1904
1904
  (`close-precheck` on the spine, output scrubbed at capture like every close). Already-green
1905
1905
  is a DISTINCT zero-token outcome, never plain `green`: nothing was done, so it mints no
1906
- learning credit and runs no on-green retention. A close that cannot RUN is a `broken-close`
1906
+ reuse credit and runs no on-green retention. A close that cannot RUN is a `broken-close`
1907
1907
  escalation before any provider call. So the resume story is: a `cap-halt` or `wall-halt`
1908
1908
  stop IS the checkpoint (the workdir + the close), the human raises `budgetUsd` or
1909
1909
  `maxWallMs` (a new spec hash — re-sign), and the rerun picks up where the budget died,
@@ -2146,7 +2146,7 @@ a named `reason`: no `registryDir` (`no-registry` — the registry is operator-s
2146
2146
  conjured), `outcome !== 'green'` (`green-predates-run` for already-green — accept confirms a
2147
2147
  verdict, it never mints one — else `not-green`), and no executed `plan` (`no-plan-executed`,
2148
2148
  R1). Every green class mints (hamr's ruling 2026-08-30): a `soft-green` row is born HELD —
2149
- its learning credit is quarantined until a signer accepts at the door — and a `green`-class
2149
+ its reuse credit is quarantined until a signer accepts at the door — and a `green`-class
2150
2150
  row is born RELEASED, because a machine's own close proved it and there was never a credit
2151
2151
  to quarantine; `quarantinesCredit(verdictType)` in `greenParts` is the one predicate, read
2152
2152
  off the record's own `verdictType`, never a flag. `door-accept` on a released row records
@@ -2884,7 +2884,9 @@ shares the same seq counter, so it is an exact ordering where two same-milliseco
2884
2884
  are not), never pooled across every occurrence sharing the id. `rounds` counts real
2885
2885
  `worker-round` records (`phase === 'step:<id>'`), never the declared cap; `toolCalls` is the one
2886
2886
  thing still windowed by `ts` (the gate-audit carries no `step` or shared `seq`). `tripped` is the
2887
- last `escalation` whose `seq` falls inside the occurrence's window — `{category, detail}`, with
2887
+ last `escalation` whose `seq` falls inside the occurrence's window — `{category, detail}` (plus `ladder: true`
2888
+ when the escalation is the step ladder's own strike-limit stop, which is also category `cap-halt` but carries
2889
+ `spend.strikes`; a money cap's escalation does not), with
2888
2890
  `detail` falling back to `decision` when the escalation site carries no `detail` at all (a
2889
2891
  ladder-exhaustion `cap-halt`, `src/ralph.js`, is the measured example — without the fallback the
2890
2892
  tripped line would print a bare category and hide the real reason).
@@ -3678,7 +3680,7 @@ key you want first (the panel picks the row by the Model menu).
3678
3680
  stopped runs are `no ending recorded` and `you pressed Stop` (each `— resume` when Resume is offered).
3679
3681
  Every PART of a run detail (`parts[]`) also carries its own `status` `{key, sign, word}` from the same table
3680
3682
  (`partStatusFor`, `src/panel/status.js`): drafting, a green outcome and a part with no verdict and no cut-off → passed; a red
3681
- outcome → its run-outcome word; a part its leg's halt cut off → capped (money cap / time cap — also a leg that ended `escalated` on a money-halt or wall-halt, and the open step of a single-leg run that ended on a cap), stopped (you stopped it),
3683
+ outcome → its run-outcome word; a part its leg's halt cut off → capped (money cap / time cap — also a leg that ended `escalated` on a money-halt or wall-halt, and the open step of a single-leg run that ended on a cap; and the LAST step part of a run that ended capped when that step's OWN escalation was the cap — its `step-end` reads `escalated` with no stop reason, so `cappedLastStep` in `src/panel/server.js` gives it the cap word, a `wall-halt` escalation reading time cap and a `cap-halt` that is not the ladder's reading money cap; a step its own strike limit escalated, and any earlier escalated step, stays failed), stopped (you stopped it),
3682
3684
  died, else failed. A run that DIED (no `job-end`, runner gone) leaves its last part in flight: when that part has no outcome
3683
3685
  and no cut-off, the server marks it `died` (`[?] died`), never the "happened, so passed" default — replay alone cannot tell
3684
3686
  died from still running, so `getRunDetail` decides it from the same `death` verdict as the run's status. A live run's open
@@ -4486,7 +4488,7 @@ A **Rubric** job whose first Input is the full path of a FILE (not a repo folder
4486
4488
  - **Panel topbar.** `bareloop · v<version> · automate a job, verified`: the version is bareloop's own package.json, read once when the panel starts and templated into the page when it is served (`__BARELOOP_PANEL_VERSION__`), so it is the version the process runs, not what package.json says now. Right of the host line and left of Settings sits the online dot (`#online-dot`): the Runs list read (the 10 s poll, no new endpoint or timer) paints green `online` on any HTTP reply, even an error status or a 200 whose body will not parse, and red `offline` only when the read fails with no HTTP status (the panel process is gone); a page render error after a good read never paints it offline.
4487
4489
  - **After drafting, the code-worded card is the only plan on screen (run mv5e1ktb).** The confirm turn's plan bubble is the drafter's own prose (written before any close existed) and used to stay in the thread above the code-worded card; when the rubric card is ready the earlier `kind:'plan'` messages are dropped. `partSentence` now reads "1 line" / "1 word" for a count of one.
4488
4490
  - **Each `~` guardrail is its own row on the plan card.** `planFromSpec` / `planFromConfirm` lines carry `rules: string[]` (the line's own `rules`, else the joined `rule` split on "; "); `renderJobPlan` draws one `~ rule` row per rule under its numbered line, in the plan card and the Job tab alike (one renderer). Gutter numbers stay on job lines only.
4489
- - **The review door's held line is true for a no-judge close.** Credit is held by VERDICT CLASS (`quarantinesCredit`: soft-green), whether or not a judge ran; the door now says "this is a rubric (soft-green) job, so its green earns NO reuse and NO learning credit until you accept it, whether or not a judge ran". Wording only; `bridges.js`/`reuse.js`/the Reuse refusal still say "rendered by the judged floor".
4491
+ - **The review door's held line is true for a no-judge close.** Credit is held by VERDICT CLASS (`quarantinesCredit`: soft-green), whether or not a judge ran; the door now says "this is a rubric (soft-green) job, so its green earns NO reuse credit until you accept it, whether or not a judge ran". Wording only; `bridges.js`/`reuse.js`/the Reuse refusal still say "rendered by the judged floor".
4490
4492
  - **A refused drafting try records why.** `authorClose` emits `onPhase('author-try-failed', { call, i, of, reds | reason, declaration? })` for a try refused by validation (the scrubbed reds), by a vacuous or stopped seed read (a `reason`), or by an all-cut-off reply; the panel writes `{kind:'try-refused', no, call, reason, reds?, declaration?}` to `draft-log.jsonl` (`tryRefusedText`, `src/authorreadout.js`, the code's own red details) and shows `<call>: refused — <reason>` on the drafting step's detail line. The CLI prints it via `phaseLine`. The refused declaration itself rides beside it (`declaration`, secrets masked; `declarationText` + `declarationCut` when over 60000 characters), so a failed draft can be read and replayed at $0 (`declarationRecord`).
4491
4493
 
4492
4494
  ### Required facts — a line that finds, lists or looks something up (Part 1b, `src/facts.js`, `docs/product/ITEM33-BUILD.md` "Addendum 2026-10-13" and "Part 1c", PRD item 33 RF1–RF22)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bareloop",
3
- "version": "0.54.0",
3
+ "version": "0.54.1",
4
4
  "description": "Workflows that earn their own design, with receipts — agent-authored workflows for repeated, long, verifiable jobs that improve across runs under an un-gameable gate.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/bridges.js CHANGED
@@ -50,7 +50,8 @@ export const BRIDGE_SCHEMA = 'bridge-v1';
50
50
  * SOFTGREEN MODULE 6 — the verdict classes whose greens are minted QUARANTINED.
51
51
  *
52
52
  * The standing ruling (PRD v1.53, given a mechanism by v1.71 §3): *softgreen
53
- * passes are quarantined from learning credit until the judged floor is proven*,
53
+ * passes are quarantined from learning credit until the judged floor is proven*
54
+ * (learning credit = reuse/bridge credit),
54
55
  * and **the signer's `accept` at the review door is what releases it**.
55
56
  *
56
57
  * `soft-green` and NOT `hitl`: the hold is about the young JUDGE, not about every
@@ -65,7 +66,7 @@ export const QUARANTINED_VERDICTS = Object.freeze(['soft-green']);
65
66
  * spelling, because three literals is how a hold silently becomes a breakage. */
66
67
  export const QUARANTINED_CODE = 'quarantined';
67
68
 
68
- /** does a green under this verdict class earn its learning credit at the close, or
69
+ /** does a green under this verdict class earn its reuse credit at the close, or
69
70
  * does it wait for a person? Absent/unknown means green's behaviour, byte for byte
70
71
  * — the pre-softgreen path is the default and stays untouched.
71
72
  * @param {unknown} verdictType @returns {boolean} */
@@ -525,7 +526,7 @@ export function reuseEligibility(bridge) {
525
526
  /**
526
527
  * THE REVIEW DOOR, written down (PRD v1.71 §3). The person read the finished run
527
528
  * and said one of three things; this records that on the run's own row, and — for
528
- * `accept` on a HELD green — releases the learning credit that green has been
529
+ * `accept` on a HELD green — releases the reuse credit that green has been
529
530
  * carrying unspent.
530
531
  *
531
532
  * Three properties, and each is a ruling rather than a convenience:
package/src/carrystore.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // The carry note's store (M1, F258): the run-level record behind src/carrynote.js. It captures the worker's read-class tool
2
2
  // calls AT THE SOURCE (the worker's tool objects, result SUMMARIES only, never file
3
- // content), reads the run's edits from the WORKING TREE (git diff against the run's start commit, never the spine), renders
3
+ // content), reads the run's edits from the WORKING TREE (git diff against the run's start commit, never the spine), renders
4
4
  // the note and persists its state under `<workdir>/.smoke/carry/state.json` (an arbiter book: the worker's fs.deny covers
5
5
  // `.smoke`, so it cannot read it; the gate audit, spine and bridges live there too). There is no switch: the memo is
6
6
  // always on (hamr 2026-11-01).
package/src/launcher.js CHANGED
@@ -60,6 +60,7 @@ const RULE_WIDTH = 56;
60
60
  * @property {((target: string) => Promise<boolean>)} [open] default the shared OS opener
61
61
  * @property {(port: number) => Promise<boolean>} [portFree] default: try to bind 127.0.0.1:port
62
62
  * @property {(ms: number) => Promise<void>} [sleep]
63
+ * @property {() => number} [clock] monotonic ms clock for stop's wait-until-gone deadlines (default performance.now); tests pass a fake one so load cannot move a deadline
63
64
  * @property {(question: string) => Promise<string>} [ask] the y/N and menu reader
64
65
  * @property {string} [bareloopBin] default bin/bareloop.mjs of this package
65
66
  * @property {import('./tty-colour.js').Paint} [paint] colour for stdout lines (default none); {@link makePaint} decides TTY / NO_COLOR / TERM
@@ -369,8 +370,9 @@ async function waitFor(d, port, gone) {
369
370
  const sleep = sleepOf(d);
370
371
  const deadline = d.deadlineMs ?? WAIT_DEADLINE_MS;
371
372
  // real clock time (CLOCK_MONOTONIC): a probe can take up to its whole timeout, so counting POLL_MS a turn would overshoot the deadline many times over
372
- const t0 = performance.now();
373
- while (performance.now() - t0 <= deadline) {
373
+ const clock = d.clock ?? (() => performance.now());
374
+ const t0 = clock();
375
+ while (clock() - t0 <= deadline) {
374
376
  const found = await probePanels({ ports: [port], timeoutMs: d.timeoutMs, fetchImpl: d.fetchImpl });
375
377
  if (gone ? found.length === 0 : found.length > 0) return true;
376
378
  await sleep(POLL_MS);
@@ -501,7 +503,8 @@ export async function stopCmd(args, io, d, shown) {
501
503
  }
502
504
  }
503
505
  // the pid being gone is the truth (signal 0: ESRCH = gone, EPERM = alive); the port going quiet is checked after, for those that went
504
- const t0 = performance.now();
506
+ const clock = d.clock ?? (() => performance.now());
507
+ const t0 = clock();
505
508
  const limit = d.deadlineMs ?? WAIT_DEADLINE_MS;
506
509
  const sleep = sleepOf(d);
507
510
  let pending = panels.slice();
@@ -509,7 +512,7 @@ export async function stopCmd(args, io, d, shown) {
509
512
  pending = pending.filter((p) => {
510
513
  try { kill(p.pid, 0); return true; } catch (e) { return /** @type {any} */ (e)?.code !== 'ESRCH'; }
511
514
  });
512
- if (pending.length === 0 || performance.now() - t0 > limit) break;
515
+ if (pending.length === 0 || clock() - t0 > limit) break;
513
516
  await sleep(POLL_MS);
514
517
  }
515
518
  if (pending.length > 0) {
package/src/learn.js CHANGED
@@ -526,10 +526,11 @@ export function foldCards(cards) {
526
526
  const n = cards.length;
527
527
  const par = cards.map((_, i) => i);
528
528
  const find = (/** @type {number} */ x) => { let r = x; while (par[r] !== r) r = par[r]; par[x] = r; return r; };
529
- for (let i = 0; i < n; i += 1) for (let j = i + 1; j < n; j += 1) if (cardsMatch(cards[i], cards[j]).match) par[find(i)] = find(j);
529
+ // a pair already in one family cannot change the families, so its (Jaccard) test is skipped: one big family stays near-linear
530
+ for (let i = 0; i < n; i += 1) for (let j = i + 1; j < n; j += 1) if (find(i) !== find(j) && cardsMatch(cards[i], cards[j]).match) par[find(i)] = find(j);
530
531
  /** @type {Map<number, number[]>} */
531
532
  const comps = new Map();
532
- for (let i = 0; i < n; i += 1) { const r = find(i); comps.set(r, [...(comps.get(r) ?? []), i]); }
533
+ for (let i = 0; i < n; i += 1) { const r = find(i); const f = comps.get(r); if (f) f.push(i); else comps.set(r, [i]); }
533
534
  /** @type {Card[][]} */
534
535
  const groups = [];
535
536
  for (const m of comps.values()) {
@@ -697,10 +698,11 @@ export function climb(rows) {
697
698
  const n = rows.length;
698
699
  const par = rows.map((_, i) => i);
699
700
  const find = (/** @type {number} */ x) => { let r = x; while (par[r] !== r) r = par[r]; par[x] = r; return r; };
700
- for (let i = 0; i < n; i += 1) for (let j = i + 1; j < n; j += 1) if (cardsMatch(rows[i].sample, rows[j].sample, { sameJob: false }).match) par[find(i)] = find(j);
701
+ // a pair already in one family cannot change the families, so its (Jaccard) test is skipped: one big family stays near-linear
702
+ for (let i = 0; i < n; i += 1) for (let j = i + 1; j < n; j += 1) if (find(i) !== find(j) && cardsMatch(rows[i].sample, rows[j].sample, { sameJob: false }).match) par[find(i)] = find(j);
701
703
  /** @type {Map<number, number[]>} */
702
704
  const fam = new Map();
703
- for (let i = 0; i < n; i += 1) { const r = find(i); fam.set(r, [...(fam.get(r) ?? []), i]); }
705
+ for (let i = 0; i < n; i += 1) { const r = find(i); const f = fam.get(r); if (f) f.push(i); else fam.set(r, [i]); }
704
706
  /** @type {Row[]} */
705
707
  const out = rows.map((r) => ({ ...r, level: 'workflow' }));
706
708
  for (const idx of fam.values()) {
@@ -1881,7 +1881,7 @@ function getRunDetailBody(runid, opts) {
1881
1881
  // tabs still never disagree about order/counts/blocked-call figures.
1882
1882
  // a run that DIED (no job-end, runner gone — `death`, decided once above) leaves its last part in flight: that part reads
1883
1883
  // `died`, never the "happened, so passed" default. Replay alone cannot tell died from still running, so the verdict lives here.
1884
- parts: (handed.drafting && Array.isArray(enrichedParts) ? [handed.drafting, ...enrichedParts] : enrichedParts)?.map((p, i, all) => ({ ...(death.died && i === all.length - 1 ? diedFixTry(p) : p), status: partStatusFor(death.died && i === all.length - 1 && p.kind !== 'drafting' && p.outcome == null && !p.stopReason ? { ...p, stopReason: 'died' } : p) })),
1884
+ parts: (handed.drafting && Array.isArray(enrichedParts) ? [handed.drafting, ...enrichedParts] : enrichedParts)?.map((p, i, all) => ({ ...(death.died && i === all.length - 1 ? diedFixTry(p) : p), status: partStatusFor(death.died && i === all.length - 1 && p.kind !== 'drafting' && p.outcome == null && !p.stopReason ? { ...p, stopReason: 'died' } : cappedLastStep(p, i === all.length - 1, status.key)) })),
1885
1885
  replans: summary.replans,
1886
1886
  close: summary.close,
1887
1887
  branch: summary.branch,
@@ -2772,6 +2772,24 @@ function noVerdictWords(stop) {
2772
2772
  return CUT_OFF_WORDS;
2773
2773
  }
2774
2774
 
2775
+ /**
2776
+ * A run that ended capped (money or time) cut its LAST part, a step the cap escalated: that step's own `step-end` reads
2777
+ * `escalated` and carries no `stopReason`, so its card said failed under a capped header (real spines msi0w2i5, msx87qqs: the
2778
+ * cap-halt / wall-halt escalation lands just before the step-end). The verdict is known only here, like the died marking, so the
2779
+ * LAST part alone gets the cap word, and only when the step's OWN escalation (`part.tripped`, src/replay.js) was the cap: `wall-halt`
2780
+ * reads 'time cap', a `cap-halt` that is not the ladder's (`tripped.ladder`) reads 'money cap'. A step its strike limit escalated
2781
+ * stays failed even if the run then ended on the cap (real spine u-mshcpdg4: the ladder's stop is also category `cap-halt`), and so
2782
+ * does an earlier escalated step (a later part follows).
2783
+ * @param {any} part @param {boolean} isLast @param {string} runStatusKey
2784
+ */
2785
+ function cappedLastStep(part, isLast, runStatusKey) {
2786
+ if (!isLast || runStatusKey !== 'capped' || part.kind !== 'step' || part.outcome !== 'escalated' || part.stopReason) return part;
2787
+ const t = part.tripped;
2788
+ if (t?.category === 'wall-halt') return { ...part, stopReason: 'time cap' };
2789
+ if (t?.category === 'cap-halt' && !t.ladder) return { ...part, stopReason: 'money cap' };
2790
+ return part;
2791
+ }
2792
+
2775
2793
  /** a died run's fix part: its last try never got a verdict (the Audit grid's "?" row says it died) @param {any} part */
2776
2794
  function diedFixTry(part) {
2777
2795
  if (part.kind !== 'fix' || !Array.isArray(part.attempts) || part.attempts.length === 0) return part;
@@ -75,8 +75,10 @@ export function statusFor(o) {
75
75
  */
76
76
  export function partStatusFor(part) {
77
77
  if (part.kind === 'drafting') return statusFor({ outcome: 'green' });
78
- if (typeof part.outcome === 'string') return statusFor({ outcome: part.outcome });
79
78
  const why = part.stopReason;
79
+ // a step the run's cap escalated ends `escalated` yet wears the cap word (src/panel/server.js cappedLastStep)
80
+ if (part.outcome === 'escalated' && (why === 'money cap' || why === 'time cap')) return { key: 'capped', ...STATUS.capped };
81
+ if (typeof part.outcome === 'string') return statusFor({ outcome: part.outcome });
80
82
  if (why) {
81
83
  const key = why === 'money cap' || why === 'time cap' ? 'capped' : why === 'you stopped it' ? 'stopped' : why === 'died' ? 'died' : 'failed';
82
84
  return { key, ...STATUS[key] };
package/src/replay.js CHANGED
@@ -683,6 +683,9 @@ export function replayRun(spineEvents, auditEvents = [], { runId = null, auditAv
683
683
  // occurrence is never left with just a bare category word when the
684
684
  // record actually explains itself.
685
685
  detail: trimTo(e.detail, TRIP_DETAIL_MAX) ?? trimTo(e.decision, TRIP_DETAIL_MAX),
686
+ // the step ladder's own stop is ALSO category `cap-halt` (real spine u-mshcpdg4 seq 185) but carries `spend.strikes`; a money cap's
687
+ // escalation does not (u-msi0w2i5 seq 143). An ADDED field, only when the ladder ended the step.
688
+ ...(typeof e.spend?.strikes === 'number' ? { ladder: true } : {}),
686
689
  } : null);
687
690
 
688
691
  /**
@@ -1411,6 +1414,9 @@ export function replayRun(spineEvents, auditEvents = [], { runId = null, auditAv
1411
1414
  spentUsd: step.spentUsd,
1412
1415
  unpricedRounds: step.unpricedRounds,
1413
1416
  outcome: step.outcome,
1417
+ // the escalation inside the step's window (category/detail, `ladder` when its own strike limit ended it): the panel reads it to
1418
+ // tell a step the cap escalated from a step the ladder escalated (src/panel/server.js cappedLastStep)
1419
+ ...(step.tripped ? { tripped: step.tripped } : {}),
1414
1420
  // P5-R (resumed runs only): why its leg's halt cut this step off, whether it is the same step continuing
1415
1421
  // from the leg before, and its retry count not counting continuations
1416
1422
  ...(step.stopReason === undefined ? {} : { stopReason: step.stopReason, continued: step.continued, tryNumber: step.tryNumber }),
package/src/reuse.js CHANGED
@@ -1647,7 +1647,7 @@ export async function runReuse(opts) {
1647
1647
  // TERMINAL rather than on the absence of a plan. `already-green` means the
1648
1648
  // close was satisfied at the precheck — before this leg wrote a byte — so
1649
1649
  // whatever plan is on the spine did not produce it, and minting a version
1650
- // from one would be learning credit for work that did not happen.
1650
+ // from one would be reuse credit for work that did not happen.
1651
1651
  //
1652
1652
  // It used to be covered by accident: a cold already-green never drafts, so
1653
1653
  // `read.plan` was null and the branch below caught it. N4 broke that
@@ -2150,7 +2150,7 @@ export function writeGreenRow({ registryDir, bridge = null, meta, record }) {
2150
2150
  * row, and if so, write it.
2151
2151
  *
2152
2152
  * `scripts/run-u.mjs` has always kept standalone bridge FILES and never a registry,
2153
- * so its review door could describe a held learning credit it had no row to release:
2153
+ * so its review door could describe a held reuse credit it had no row to release:
2154
2154
  * `--decide accept` reached `recordDoor`, found no green row for the runid and died
2155
2155
  * `no-row-for-run`. This is the row, and STORAGE IS ALL IT IS — selection, promotion
2156
2156
  * and reuse execution stay parked (layer-3-reuse). Nothing here reads a row back.
@@ -2207,7 +2207,7 @@ export function writeRunGreenRow({ registryDir, job, name, outcome, plan, record
2207
2207
  /**
2208
2208
  * Apply a signer's door decision to the workflow a run wrote its row against:
2209
2209
  * record the disposition, and — on `accept` over a HELD judged green — release the
2210
- * learning credit that green has been carrying unspent (PRD v1.71 §3).
2210
+ * reuse credit that green has been carrying unspent (PRD v1.71 §3).
2211
2211
  *
2212
2212
  * This is the ONE seam between a person's answer and the box. It is deliberately
2213
2213
  * separate from `runReuse`: the door opens AFTER the run has ended (a green run is
package/src/u-readout.js CHANGED
@@ -202,7 +202,7 @@ export function reviewDoorPackage({ door, diff }) {
202
202
  const out = [];
203
203
  out.push(`REVIEW DOOR — this run's close minted ${String(d.outcome ?? 'a verdict')} and it STANDS. Nothing you do here changes it.`);
204
204
  if (held) {
205
- out.push(' held this is a rubric (soft-green) job, so its green earns NO reuse and NO learning credit until you accept it, whether or not a judge ran');
205
+ out.push(' held this is a rubric (soft-green) job, so its green earns NO reuse credit until you accept it, whether or not a judge ran');
206
206
  }
207
207
  // the body: what the machine judged, what moved, and the lines themselves —
208
208
  // rendered by the SAME code the pause screen uses, off the same record shape.
@@ -273,7 +273,7 @@ export function doorTimingRedLines({ names }) {
273
273
  export function runDoorLines({ rerun, accept, pause, ttlDays, held }) {
274
274
  return threeDoors({
275
275
  rerun: '"I don\'t like it, go again" — your words become the requirement a FRESH engagement plans against (its own clock, what is left of the signed budget)',
276
- accept: `${held ? 'releases this run\'s learning credit' : 'confirms it'} — and the close\'s MECHANICAL stages re-run first, because the tree can move after a run ends`,
276
+ accept: `${held ? 'releases this run\'s reuse credit' : 'confirms it'} — and the close\'s MECHANICAL stages re-run first, because the tree can move after a run ends`,
277
277
  pause: `not now. Nothing runs and nothing is spent; the door keeps for ${ttlDays} days and then expires on its own, which is all that "cancel" ever meant`,
278
278
  }, { rerun, accept, pause });
279
279
  }
package/src/userrun.js CHANGED
@@ -2311,7 +2311,7 @@ async function execute(ctx) {
2311
2311
  // still names (soft-green today) — a green-class row is born RELEASED, because a
2312
2312
  // machine proved it and there was never a credit to quarantine
2313
2313
  out(quarantinesCredit(spec.verdictType)
2314
- ? ' HELD: this green\'s learning credit is quarantined until you release it at the door below'
2314
+ ? ' HELD: this green\'s reuse credit is quarantined until you release it at the door below'
2315
2315
  : ' RELEASED: a machine proved this green, so its row carries no credit to quarantine');
2316
2316
  } else if (REGISTRY_ROW.write !== null) {
2317
2317
  // a REFUSED write is said out loud rather than swallowed — the door below is about to
@@ -1,4 +1,4 @@
1
- /** does a green under this verdict class earn its learning credit at the close, or
1
+ /** does a green under this verdict class earn its reuse credit at the close, or
2
2
  * does it wait for a person? Absent/unknown means green's behaviour, byte for byte
3
3
  * — the pre-softgreen path is the default and stays untouched.
4
4
  * @param {unknown} verdictType @returns {boolean} */
@@ -112,7 +112,7 @@ export function reuseEligibility(bridge: unknown): {
112
112
  /**
113
113
  * THE REVIEW DOOR, written down (PRD v1.71 §3). The person read the finished run
114
114
  * and said one of three things; this records that on the run's own row, and — for
115
- * `accept` on a HELD green — releases the learning credit that green has been
115
+ * `accept` on a HELD green — releases the reuse credit that green has been
116
116
  * carrying unspent.
117
117
  *
118
118
  * Three properties, and each is a ruling rather than a convenience:
@@ -272,7 +272,8 @@ export const BRIDGE_SCHEMA: "bridge-v1";
272
272
  * SOFTGREEN MODULE 6 — the verdict classes whose greens are minted QUARANTINED.
273
273
  *
274
274
  * The standing ruling (PRD v1.53, given a mechanism by v1.71 §3): *softgreen
275
- * passes are quarantined from learning credit until the judged floor is proven*,
275
+ * passes are quarantined from learning credit until the judged floor is proven*
276
+ * (learning credit = reuse/bridge credit),
276
277
  * and **the signer's `accept` at the review door is what releases it**.
277
278
  *
278
279
  * `soft-green` and NOT `hitl`: the hold is about the young JUDGE, not about every
@@ -23,6 +23,7 @@
23
23
  * @property {((target: string) => Promise<boolean>)} [open] default the shared OS opener
24
24
  * @property {(port: number) => Promise<boolean>} [portFree] default: try to bind 127.0.0.1:port
25
25
  * @property {(ms: number) => Promise<void>} [sleep]
26
+ * @property {() => number} [clock] monotonic ms clock for stop's wait-until-gone deadlines (default performance.now); tests pass a fake one so load cannot move a deadline
26
27
  * @property {(question: string) => Promise<string>} [ask] the y/N and menu reader
27
28
  * @property {string} [bareloopBin] default bin/bareloop.mjs of this package
28
29
  * @property {import('./tty-colour.js').Paint} [paint] colour for stdout lines (default none); {@link makePaint} decides TTY / NO_COLOR / TERM
@@ -294,6 +295,10 @@ export type LauncherDeps = {
294
295
  */
295
296
  portFree?: ((port: number) => Promise<boolean>) | undefined;
296
297
  sleep?: ((ms: number) => Promise<void>) | undefined;
298
+ /**
299
+ * monotonic ms clock for stop's wait-until-gone deadlines (default performance.now); tests pass a fake one so load cannot move a deadline
300
+ */
301
+ clock?: (() => number) | undefined;
297
302
  /**
298
303
  * the y/N and menu reader
299
304
  */
package/types/replay.d.ts CHANGED
@@ -149,6 +149,7 @@ export function replayRun(spineEvents: any[], auditEvents?: any[], { runId, audi
149
149
  spentUsd: number | null;
150
150
  unpricedRounds: number;
151
151
  tripped: {
152
+ ladder?: boolean | undefined;
152
153
  category: any;
153
154
  detail: string | null;
154
155
  } | null;
@@ -211,6 +212,7 @@ export function replayRun(spineEvents: any[], auditEvents?: any[], { runId, audi
211
212
  spentUsd: number | null;
212
213
  unpricedRounds: number;
213
214
  tripped: {
215
+ ladder?: boolean | undefined;
214
216
  category: any;
215
217
  detail: string | null;
216
218
  } | null;
@@ -237,6 +239,7 @@ export function replayRun(spineEvents: any[], auditEvents?: any[], { runId, audi
237
239
  spentUsd: number | null;
238
240
  unpricedRounds: number;
239
241
  tripped: {
242
+ ladder?: boolean | undefined;
240
243
  category: any;
241
244
  detail: string | null;
242
245
  } | null;
package/types/reuse.d.ts CHANGED
@@ -484,7 +484,7 @@ export function writeGreenRow({ registryDir, bridge, meta, record }: {
484
484
  * row, and if so, write it.
485
485
  *
486
486
  * `scripts/run-u.mjs` has always kept standalone bridge FILES and never a registry,
487
- * so its review door could describe a held learning credit it had no row to release:
487
+ * so its review door could describe a held reuse credit it had no row to release:
488
488
  * `--decide accept` reached `recordDoor`, found no green row for the runid and died
489
489
  * `no-row-for-run`. This is the row, and STORAGE IS ALL IT IS — selection, promotion
490
490
  * and reuse execution stay parked (layer-3-reuse). Nothing here reads a row back.
@@ -525,7 +525,7 @@ export function writeRunGreenRow({ registryDir, job, name, outcome, plan, record
525
525
  /**
526
526
  * Apply a signer's door decision to the workflow a run wrote its row against:
527
527
  * record the disposition, and — on `accept` over a HELD judged green — release the
528
- * learning credit that green has been carrying unspent (PRD v1.71 §3).
528
+ * reuse credit that green has been carrying unspent (PRD v1.71 §3).
529
529
  *
530
530
  * This is the ONE seam between a person's answer and the box. It is deliberately
531
531
  * separate from `runReuse`: the door opens AFTER the run has ended (a green run is