bareloop 0.12.0 → 0.14.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 +139 -0
- package/README.md +1 -1
- package/bareloop.context.md +169 -7
- package/package.json +2 -2
- package/src/behaviour.js +150 -0
- package/src/bridges.js +1 -1
- package/src/calibrate.js +1 -1
- package/src/cardauthor.js +1 -1
- package/src/index.js +21 -1
- package/src/job.js +1 -1
- package/src/judged.js +1 -1
- package/src/ledger.js +103 -1
- package/src/plan.js +43 -2
- package/src/planrun.js +306 -16
- package/src/readshim.js +570 -0
- package/src/reuse.js +27 -3
- package/src/root.js +1 -1
- package/src/run.js +39 -4
- package/src/selection.js +1 -1
- package/src/tools.js +34 -2
- package/src/transport.js +71 -0
- package/types/behaviour.d.ts +46 -0
- package/types/index.d.ts +3 -1
- package/types/ledger.d.ts +58 -0
- package/types/plan.d.ts +19 -2
- package/types/planrun.d.ts +37 -2
- package/types/readshim.d.ts +128 -0
- package/types/reuse.d.ts +24 -0
- package/types/run.d.ts +15 -1
- package/types/tools.d.ts +17 -1
- package/types/transport.d.ts +19 -0
package/types/reuse.d.ts
CHANGED
|
@@ -364,6 +364,7 @@ export function resumeTreeGate({ head, seed, dirty }: {
|
|
|
364
364
|
* @param {number} [opts.strikeLimit] forwarded (a plan step's strike ceiling)
|
|
365
365
|
* @param {number} [opts.closeTimeoutMs] forwarded
|
|
366
366
|
* @param {boolean} [opts.layerRoot] forwarded
|
|
367
|
+
* @param {boolean|'cap'|'diff'} [opts.readShim] the read shim's ARM (A0/A1/A2/A3), forwarded verbatim
|
|
367
368
|
* @param {any} [opts.resume] RESUME (module C) — a `readResume` reading of the KILLED
|
|
368
369
|
* run's own spine. Its `approvalHash` must match this run's, or the run refuses:
|
|
369
370
|
* a resume continues ONE signed run, not any run.
|
|
@@ -397,6 +398,7 @@ export function runReuse(opts: {
|
|
|
397
398
|
strikeLimit?: number | undefined;
|
|
398
399
|
closeTimeoutMs?: number | undefined;
|
|
399
400
|
layerRoot?: boolean | undefined;
|
|
401
|
+
readShim?: boolean | "cap" | "diff" | undefined;
|
|
400
402
|
resume?: any;
|
|
401
403
|
runJob?: typeof shippedRunJob | undefined;
|
|
402
404
|
now?: (() => number) | undefined;
|
|
@@ -587,6 +589,28 @@ export const REUSE_GRADED_RED: readonly string[];
|
|
|
587
589
|
* how they would come to disagree about which member is which: the first three are
|
|
588
590
|
* allowances the loop's remaining tries are meant to spend against, and the human
|
|
589
591
|
* ones are the stop no further try can change (see `hardStop`).
|
|
592
|
+
*
|
|
593
|
+
* `provider-red` folded in 2026-08-25 (PRD v1.80 TODO #4, F115 "Ruled: one transport
|
|
594
|
+
* retry"; hamr's ruling verbatim: *"joins resume anyways and you decide but you are
|
|
595
|
+
* given an honest readout and with 1 retry"*). It is a MACHINE halt, not a human one
|
|
596
|
+
* — it does NOT go into `HUMAN_CHECKPOINTS` — but it is a checkpoint by the same
|
|
597
|
+
* test every other member here passes: the close never got the say it was asked
|
|
598
|
+
* for (no verdict was rendered, so it is not a graded red — see `REUSE_GRADED_RED`
|
|
599
|
+
* above), and the scout+draft and every finished step it bought stand on disk
|
|
600
|
+
* exactly like a cap-halt or a wall-halt. The one transport retry
|
|
601
|
+
* (`src/planrun.js`'s `withTransportRetry`) already covers the common case; when
|
|
602
|
+
* that retry ALSO fails, throwing the run away because the transport hiccuped
|
|
603
|
+
* twice is throwing away real work for no reason a machine can judge. Deliberately
|
|
604
|
+
* NO cost/step threshold gates this: a threshold is a number picked from a small
|
|
605
|
+
* observed sample (F115 logged exactly 7 rows), which is arbiter territory
|
|
606
|
+
* reserved for hamr — the operator decides case by case, every time, off the
|
|
607
|
+
* honest readout `scripts/run-u.mjs` prints.
|
|
608
|
+
*
|
|
609
|
+
* This entry was built 2026-08-24 as a LOCAL widening in `scripts/run-u.mjs`
|
|
610
|
+
* (`RESUMABLE_HALTS = [...CHECKPOINT_OUTCOMES, 'provider-red']`) because this file
|
|
611
|
+
* sat outside that pass's scope — the fold here is the follow-up, so this repo
|
|
612
|
+
* does not end up with two lists that can drift, which is the exact failure this
|
|
613
|
+
* constant exists to end (see the paragraph above).
|
|
590
614
|
*/
|
|
591
615
|
export const CHECKPOINT_OUTCOMES: readonly string[];
|
|
592
616
|
/**
|
package/types/run.d.ts
CHANGED
|
@@ -97,6 +97,19 @@
|
|
|
97
97
|
* collision walk would mint a `-2` beside the work the resume exists to continue. The
|
|
98
98
|
* fold's precedent exactly: the chain's state is DECLARED, never re-derived. Forwarded
|
|
99
99
|
* verbatim to the plan flow; absent is the cold path.
|
|
100
|
+
* @param {boolean|'cap'|'diff'} [opts.readShim=false] THE READ SHIM (src/readshim.js) —
|
|
101
|
+
* WHICH ARM to run, threaded to the plan flow. The Phase 2 pre-registration's four:
|
|
102
|
+
* `false` A0 — off (the default)
|
|
103
|
+
* `'cap'` A1 — cap + pointer + next-unseen-slice + G1, no diff
|
|
104
|
+
* `'diff'` A2 — the diff lever alone: no cap, no pointer, no G1
|
|
105
|
+
* `true` A3 — every lever
|
|
106
|
+
* Anything else THROWS below, before a token is spent: a mis-spelled arm coerced
|
|
107
|
+
* by truthiness into A3 would run one treatment under another's label and be
|
|
108
|
+
* invisible in the results afterwards.
|
|
109
|
+
* OFF is byte-identical to the pre-shim run in every observable (G1 included): the
|
|
110
|
+
* frozen A0 baseline arm has to be exactly today, so a guard firing under a disabled
|
|
111
|
+
* shim would make the baseline a treatment arm. The default-flip belongs to a
|
|
112
|
+
* paid contrast nobody has approved yet (the `layerRoot` precedent, F41).
|
|
100
113
|
* @param {boolean} [opts.layerRoot=false] Layer R (within-run ratchet) — shell
|
|
101
114
|
* territory, threaded to the plan flow. Defaults OFF
|
|
102
115
|
* (decided 2026-07-21): fixation is extinct on every current job (F41), so
|
|
@@ -128,7 +141,7 @@
|
|
|
128
141
|
* 'interpreter-red' | 'cap-halt' | 'wall-halt' | 'step-stalled' |
|
|
129
142
|
* 'hitl-pause' | 'hitl-decision-red' | `step-red:<id>`
|
|
130
143
|
*/
|
|
131
|
-
export function runJob(rawSpec: object | string, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider, emit, capRuns, strikeLimit, shellCapUsd, closeTimeoutMs, layerRoot, bridge, priorSpentUsd, priorSpendComplete, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun }: {
|
|
144
|
+
export function runJob(rawSpec: object | string, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider, emit, capRuns, strikeLimit, shellCapUsd, closeTimeoutMs, layerRoot, readShim, bridge, priorSpentUsd, priorSpendComplete, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun }: {
|
|
132
145
|
approvals: unknown;
|
|
133
146
|
workdir: string;
|
|
134
147
|
provider: any;
|
|
@@ -159,6 +172,7 @@ export function runJob(rawSpec: object | string, { approvals, workdir, provider,
|
|
|
159
172
|
grantUsed?: boolean;
|
|
160
173
|
} | null | undefined;
|
|
161
174
|
resumeBranch?: string | null | undefined;
|
|
175
|
+
readShim?: boolean | "cap" | "diff" | undefined;
|
|
162
176
|
layerRoot?: boolean | undefined;
|
|
163
177
|
humanRuling?: {
|
|
164
178
|
decision: string;
|
package/types/tools.d.ts
CHANGED
|
@@ -19,8 +19,24 @@ export function strategyFor(granted: string[]): string;
|
|
|
19
19
|
* RESULT is invisible cannot be judged: a `ctx_get` that silently reds (stale pointer,
|
|
20
20
|
* bad range) looks exactly like one that worked, and the worker's fallback to a
|
|
21
21
|
* whole-file read looks like a free choice instead of a forced one.
|
|
22
|
+
* @param {{onStalePointer?: ((req: {file: string, path: string, startLine: number, endLine: number, detail: string}) => {text: string, outcome: string}|null)|null}} [opts]
|
|
23
|
+
* `onStalePointer`: the read shim's stale-pointer serve, wired ONLY by a capping
|
|
24
|
+
* arm (see `createReadShim`). Absent — every caller today except that one — this
|
|
25
|
+
* whole seam is byte-identical to what it was, which is what keeps A0 the
|
|
26
|
+
* untouched baseline an experiment has already run against.
|
|
22
27
|
*/
|
|
23
|
-
export function createCtxTools(lc: any, workdir: string, emit: (type: string, data: object) => void
|
|
28
|
+
export function createCtxTools(lc: any, workdir: string, emit: (type: string, data: object) => void, { onStalePointer }?: {
|
|
29
|
+
onStalePointer?: ((req: {
|
|
30
|
+
file: string;
|
|
31
|
+
path: string;
|
|
32
|
+
startLine: number;
|
|
33
|
+
endLine: number;
|
|
34
|
+
detail: string;
|
|
35
|
+
}) => {
|
|
36
|
+
text: string;
|
|
37
|
+
outcome: string;
|
|
38
|
+
} | null) | null;
|
|
39
|
+
}): ({
|
|
24
40
|
name: string;
|
|
25
41
|
description: string;
|
|
26
42
|
parameters: {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is `err` a transport-class failure — the request never produced an HTTP
|
|
3
|
+
* response? True for: a TLS fault mid-record ("bad record mac" and kin), a
|
|
4
|
+
* reset/broken/timed-out socket (ECONNRESET, EPIPE, ETIMEDOUT, ECONNREFUSED,
|
|
5
|
+
* ENETUNREACH — by code on the error itself or on `err.cause`), and
|
|
6
|
+
* `fetch failed` wrapping a network `cause`. False for anything carrying an
|
|
7
|
+
* HTTP status (`err.status`/`err.statusCode`, 4xx/5xx/429) or an explicit
|
|
8
|
+
* `err.retryable === false` — those are provider RESPONSES, not transport
|
|
9
|
+
* casualties, and bare-agent's own policy governs them unchanged.
|
|
10
|
+
* @param {any} err
|
|
11
|
+
* @returns {boolean}
|
|
12
|
+
*/
|
|
13
|
+
export function isTransportFailure(err: any): boolean;
|
|
14
|
+
/** The fixed retry budget: ONE extra attempt after the first transport
|
|
15
|
+
* throw. Never read from a job spec or CLI flag — raising it is arbiter
|
|
16
|
+
* territory (only a code change hamr signs, never a run-time knob). */
|
|
17
|
+
export const TRANSPORT_RETRIES: 1;
|
|
18
|
+
/** bare-agent's `Retry.call` counts ATTEMPTS, not retries. */
|
|
19
|
+
export const TRANSPORT_MAX_ATTEMPTS: number;
|