@tangle-network/agent-runtime 0.284.2 → 0.286.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/dist/{activation-DXFzDCmr.js → activation-ByUQM5wd.js} +2 -2
- package/dist/{activation-DXFzDCmr.js.map → activation-ByUQM5wd.js.map} +1 -1
- package/dist/{activation-CxiJixSO.d.ts → activation-KvioC2fx.d.ts} +3 -3
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-BJzVI1oV.js → coordination-driver-CLqj3s53.js} +3 -3
- package/dist/{coordination-driver-BJzVI1oV.js.map → coordination-driver-CLqj3s53.js.map} +1 -1
- package/dist/{delegate-C_pbu2r6.js → delegate-SSnnbyKu.js} +2 -2
- package/dist/{delegate-C_pbu2r6.js.map → delegate-SSnnbyKu.js.map} +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +3 -3
- package/dist/{graph-CgPvD3JV.js → graph-to6d8CPK.js} +4 -4
- package/dist/{graph-CgPvD3JV.js.map → graph-to6d8CPK.js.map} +1 -1
- package/dist/{improvement-cycle-DxBnEP8q.js → improvement-cycle-Cm_YPUwJ.js} +3 -3
- package/dist/{improvement-cycle-DxBnEP8q.js.map → improvement-cycle-Cm_YPUwJ.js.map} +1 -1
- package/dist/{index-BmGVkjsc.d.ts → index-BspUvwtx.d.ts} +15 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +3 -3
- package/dist/intelligence.js +4 -4
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-BFU_pmN6.js → loop-runner-bin-By_D4FLz.js} +3 -3
- package/dist/{loop-runner-bin-BFU_pmN6.js.map → loop-runner-bin-By_D4FLz.js.map} +1 -1
- package/dist/{loop-runner-bin-CqwbQ0et.d.ts → loop-runner-bin-CvOEO1dE.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +5 -5
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-H8QPhTVE.d.ts → openai-tools-BCS5D37j.d.ts} +2 -2
- package/dist/profiles.d.ts +2 -2
- package/dist/{provision-supervisor-CqRp0Rzo.js → provision-supervisor-CoXCyrZX.js} +4 -4
- package/dist/{provision-supervisor-CqRp0Rzo.js.map → provision-supervisor-CoXCyrZX.js.map} +1 -1
- package/dist/{run-layout-vwd4SwX_.js → run-layout-DSCWdbX2.js} +4 -3
- package/dist/run-layout-DSCWdbX2.js.map +1 -0
- package/dist/{runtime-BtdxnxWj.js → runtime-HbOyntiw.js} +9 -9
- package/dist/{runtime-BtdxnxWj.js.map → runtime-HbOyntiw.js.map} +1 -1
- package/dist/{search-method-Hjmqa4B8.js → search-method-D2H7J_CE.js} +2 -2
- package/dist/{search-method-Hjmqa4B8.js.map → search-method-D2H7J_CE.js.map} +1 -1
- package/dist/{server-CIGxKcia.js → server-Bgy1lt_A.js} +3 -3
- package/dist/{server-CIGxKcia.js.map → server-Bgy1lt_A.js.map} +1 -1
- package/dist/{stream-agent-turn-IIqBKeLB.d.ts → stream-agent-turn-CaLVbKSY.d.ts} +15 -3
- package/dist/{substrate-CHQ5GYnU.d.ts → substrate-E5mSYCU7.d.ts} +2 -2
- package/dist/{supervise-B9XlnKGA.js → supervise-Dgfve4nM.js} +20 -16
- package/dist/supervise-Dgfve4nM.js.map +1 -0
- package/dist/{supervisor-D4NnNHZd.js → supervisor-Ds1NgT-A.js} +100 -6
- package/dist/supervisor-Ds1NgT-A.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/{top-app-VAOrBskv.js → top-app-DaiR4LXM.js} +2 -2
- package/dist/{top-app-VAOrBskv.js.map → top-app-DaiR4LXM.js.map} +1 -1
- package/dist/tui/bin.js +1 -1
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-D56jQad-.d.ts → types-wIVzqXdQ.d.ts} +3 -1
- package/package.json +1 -1
- package/skills/profile-authoring/SKILL.md +42 -89
- package/skills/profile-authoring/references/acceptance-examples.md +93 -0
- package/dist/run-layout-vwd4SwX_.js.map +0 -1
- package/dist/supervise-B9XlnKGA.js.map +0 -1
- package/dist/supervisor-D4NnNHZd.js.map +0 -1
|
@@ -2267,6 +2267,8 @@ interface ContinuationNoteInput {
|
|
|
2267
2267
|
readonly progress: DriverProgressMark;
|
|
2268
2268
|
/** Whether `read_continuation` is served to this manager. */
|
|
2269
2269
|
readonly canReadMore: boolean;
|
|
2270
|
+
/** Whether submit_result is served to this manager. Absent means unavailable. */
|
|
2271
|
+
readonly canSubmitResult?: boolean;
|
|
2270
2272
|
/** Whether the check's score comes from cases the director cannot see. */
|
|
2271
2273
|
readonly sealed?: boolean;
|
|
2272
2274
|
}
|
|
@@ -5818,4 +5820,4 @@ interface WidenGate<Out> {
|
|
|
5818
5820
|
}
|
|
5819
5821
|
//#endregion
|
|
5820
5822
|
export { SpawnJournal as $, RuntimeStreamEvent as $a, Iteration as $i, ReadableEnvironment as $n, RetainedInteractiveBindingError as $r, RuntimeStreamEventCollector as $t, NodeExecutionIdentity as A, RuntimeRunStatus as Aa, RetainedRunStartMaterial as Ai, RetainedPendingCause as An, ContinuationPanelInput as Ar, TraceContext as At, ResultBlobStore as B, AgentTaskRunResult as Ba, ReservationHolder as Bi, ReconnectRetainedInteractiveRunOptions as Bn, distillFindings as Br, OtelSpan as Bt, ExecutorToolCall as C, Validator as Ca, RetainedRunEffect as Ci, SessionTraceBox as Cn, CheckUnavailableError as Cr, WorkspaceCheckpointMarker as Ct, MaterializedExecutionIdentity as D, RuntimeRunOptions as Da, RetainedRunIntentAdmission as Di, decodeToolPart as Dn, ContinuationEntry as Dr, workerTraceEnv as Dt, HeldEnvironment as E, RuntimeRunHandle as Ea, RetainedRunHandle as Ei, createPushTraceSource as En, ContinuationContext as Er, readWorkerTraceContext as Et, ProviderModelAttemptEvidence as F, AgentExecutionBackend as Fa, BudgetPoolRestore as Fi, ScopeProgressInput as Fn, VerdictSummary as Fr, LoopSpanNode as Ft, RootMaterialization as G, OpenAIChatResponseFormat as Ga, ReservationWaitRefused as Gi, RetainedInteractiveStartMaterial as Gn, AgentEvalError$1 as Gr, createOpenInferenceFileExporter as Gt, ResumedWork as H, AgentTaskStatus as Ha, ReservationShortfall as Hi, RetainedInteractiveAdmissionHook as Hn, failedItems as Hr, buildLoopOtelSpans as Ht, ProviderModelExecutionEvidence as I, AgentKnowledgeProvider as Ia, BudgetReadout as Ii, TeamProgress as In, admitContinuationPolicy as Ir, OtelAttribute as It, RootStreamReceipt as J, RunAgentTaskOptions as Ja, spendFromUsageEvents as Ji, HarnessTranscriptCapture as Jn, ConfigError as Jr, loopEventToOtelSpan as Jt, RootProviderModelEvidence as K, OpenAIChatTool as Ka, ReserveOptions as Ki, StartRetainedInteractiveRunOptions as Kn, AgentEvalErrorCode as Kr, createOtelExporter as Kt, RecursiveReservationPolicy as L, AgentRuntimeEvent as La, BudgetReconcileFault as Li, WorkerProgress as Ln, admitFinding as Lr, OtelExportConfig as Lt, NodeSnapshot as M, AgentAdapter as Ma, StartRetainedRunInEnvironmentOptions as Mi, ActivityNote as Mn, ContinuationPolicy as Mr, mergeTraceEnv as Mt, NodeStatus as N, AgentBackendContext as Na, StartRetainedRunOptions as Ni, DEFAULT_STALL_AFTER_MS as Nn, ContinuationProfile as Nr, readTraceContextFromEnv as Nt, MaterializedModelIdentity as O, RuntimeRunPersistenceAdapter as Oa, RetainedRunReplayPoint as Oi, sandboxSessionTraceSource as On, ContinuationNoteInput as Or, workerTraceHeaders as Ot, ProfileMaterializationReceipt as P, AgentBackendInput as Pa, BudgetPool as Pi, ExecutorProgress as Pn, PanelFinding as Pr, traceContextToEnv as Pt, SpawnEvent as Q, RuntimeSessionStore as Qa, ExecCtx as Qi, HarnessTranscriptUnavailableReason as Qn, RetainedInteractiveAdmissionError as Qr, RuntimeEventCollector as Qt, ResourceLimit as R, AgentRuntimeEventSink as Ra, LeakedReservation as Ri, createActivityLog as Rn, checkVerdictOf as Rr, OtelExportStats as Rt, ExecutorTeardownWarning as S, ValidationCtx as Sa, RetainedRunDispatchedAdmission as Si, SessionMessageLike as Sn, CheckRead as Sr, WorkerTraceUnavailableReason as St, Handle as T, RuntimeRunCost as Ta, RetainedRunEventOptions as Ti, TraceSource as Tn, ContinuationAppend as Tr, WorkerTraceSeamCarrier as Tt, RetainedExecutionState as U, BackendErrorDetail as Ua, ReservationStage as Ui, RetainedInteractiveEnvironmentInput as Un, passedItems as Ur, buildLoopSpanNodes as Ut, ResumedKeyState as V, AgentTaskSpec as Va, ReservationRejection as Vi, RecoverRetainedInteractiveRunOptions as Vn, expandQuestions as Vr, RuntimeEventOtelOptions as Vt, RootHandle as W, KnowledgeReadinessDecision as Wa, ReservationTicket as Wi, RetainedInteractiveRunHandle as Wn, verdictFromJudgeScore as Wr, buildRuntimeEventOtelSpans as Wt, Scope as X, RuntimeCanonicalStreamEvent as Xa, DefaultVerdict$1 as Xi, HarnessTranscriptFile as Xn, NotFoundError as Xr, padTraceId as Xt, Runtime as Y, RunAgentTaskStreamOptions as Ya, AgentRunSpec as Yi, HarnessTranscriptEvidence as Yn, JudgeError as Yr, padSpanId as Yt, Settled as Z, RuntimeSession as Za, Driver as Zi, HarnessTranscriptUnavailable as Zn, PlannerError as Zr, toOtelAttributes as Zt, ExecutorMaterialization as _, MountRecorder as _a, RetainedInteractiveStartedAdmission as _i, isWaitOutcome as _n, upstreamUnavailableSignal as _r, WaitOpts as _t, BudgetOverspend as a, LoopLineageOptions as aa, WorkerSlots as ai, createRuntimeEventCollector as an, DriverAttemptsExhaustedError as ar, SpendGap as at, ExecutorRegistry as b, SandboxClient as ba, RetainedRunCancelOptions as bi, validateWaitSpec as bn, CONTINUATIONS_DIR as br, WorkerInteractiveUnavailableReason as bt, EnvironmentTeardownReceipt as c, LoopResult as ca, NativeContextContinuationHandle as ci, sanitizeKnowledgeReadinessReport as cn, DriverContractState as cr, SubtreeSummary as ct, ExecutorAccounting as d, LoopTeardownFailedPayload as da, RecoverRetainedRunIntentOptions as di, WaitOutcome as dn, DriverProgressMark as dr, SupervisorOpts as dt, LoopDecisionPayload as ea, RetainedRunAdmissionError as ei, RuntimeStreamEventSink as en, captureHarnessTranscript as er, SpawnOpts as et, ExecutorCancellation as f, LoopTokenUsage as fa, RecoverRetainedRunOptions as fi, WaitProbe as fn, DriverReentry as fr, TokenUsageProvenance as ft, ExecutorFactory as g, MountManifestEntry as ga, RetainedInteractiveIntentAdmission as gi, createWaitProbes as gn, summarizeDriverAttempts as gr, UsageEvent as gt, ExecutorExecutionBinding as h, LoopWinner as ha, RetainedInteractiveEnvironmentAdmission as hi, WaitSpec as hn, classifyDriverFailure as hr, UnknownMaterializationReason as ht, Budget as i, LoopIterationStartedPayload as ia, SlotPermit as ii, SanitizedKnowledgeRequirement as in, DriverAttemptStop as ir, SpendChannel as it, NodeId as j, startRuntimeRun as ja, RetainedRunTurnInput as ji, ActivityLog as jn, ContinuationPanelResult as jr, createPropagatingTraceEmitter as jt, NoWinnerError as k, RuntimeRunRow as ka, RetainedRunSnapshot as ki, RetainedChildRecovery as kn, ContinuationPanel as kr, workerTraceSeamKey as kt, ExecutionBindingReceipt as l, LoopSandboxPlacement as la, NativeContextContinuationInput as li, sanitizeRuntimeStreamEvent as ln, DriverFailureClass as lr, SupervisedResult as lt, ExecutorContext as m, LoopTraceEvent as ma, RetainedInteractiveAdmission as mi, WaitRejection as mn, DriverRetryPolicy as mr, UnconfirmedTeardown as mt, AgentExecutionRef as n, LoopIterationDispatchPayload as na, RuntimeRunStateError as ni, RuntimeTelemetryOptions as nn, persistHarnessTranscript as nr, SpawnRejection as nt, BudgetViolation as o, LoopPlanDescription as oa, createWorkerSlots as oi, createRuntimeStreamEventCollector as on, DriverBudgetReadout as or, SteerableRootHandle as ot, ExecutorCancellationRequest as p, LoopTraceEmitter as pa, RecoverRetainedRunResult as pi, WaitProbeRegistry as pn, DriverRepromptRefusal as pr, TreeView as pt, RootSignal as q, OpenAIChatToolChoice as qa, createBudgetPool as qi, HarnessTranscriptArtifact as qn, BackendTransportError as qr, generateSpanId as qt, AgentSpec as r, LoopIterationEndedPayload as ra, ValidationError as ri, SanitizedKnowledgeReadinessReport as rn, DriverAttemptRecord as rr, Spend as rt, DefaultVerdict as s, LoopPlanPayload as sa, NativeContextContinuationExecution as si, sanitizeAgentRuntimeEvent as sn, DriverContinuationRecord as sr, SubtreeResult as st, Agent as t, LoopEndedPayload as ta, RetainedRunDispatchBindingError as ti, RuntimeStreamEventSummary as tn, harnessTranscriptArtifact as tr, SpawnPrior as tt, Executor as u, LoopStartedPayload as ua, ReconnectRetainedRunOptions as ui, PendingWait as un, DriverLoopRecord as ur, Supervisor as ut, ExecutorNodeContext as v, OutputAdapter as va, RetainedRunAdmission as vi, pollFor as vn, UnavailablePausePolicy as vr, WidenGate as vt, FleetYield as w, RuntimeRunCompleteInput as wa, RetainedRunEnvironmentAdmission as wi, ToolStepInput as wn, CheckVerdict as wr, WorkerTraceResolver as wt, ExecutorResult as x, SelectionReceipt as xa, RetainedRunCancellation as xi, waitUntil as xn, CONTINUATION_FACTS as xr, WorkerTraceEvidence as xt, ExecutorProgressEvent as y, RunProvenance as ya, RetainedRunAdmissionHook as yi, timerAt as yn, AdmittedFinding as yr, WorkerInteractiveSession as yt, ResourceSpend as z, AgentTaskContext as za, ReservationFloor as zi, readWorkerProgress as zn, composeContinuationNote as zr, OtelExporter as zt };
|
|
5821
|
-
//# sourceMappingURL=types-
|
|
5823
|
+
//# sourceMappingURL=types-wIVzqXdQ.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.286.0",
|
|
4
4
|
"description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-runtime#readme",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,6 @@ The audience accepts or rejects the result: a paper's authors and referees, a re
|
|
|
15
15
|
The proxy is the check you can run during the work: an exact checker, a test suite, a rater, or a demo.
|
|
16
16
|
The gap is everything the proxy accepts and the audience rejects.
|
|
17
17
|
Hacks live in the gap, and a stronger model does not close it.
|
|
18
|
-
Measured: where a known gap existed, 15 of 27 lanes with claims filed false "new" results; where none was known, 0 of 34 lanes did.
|
|
19
18
|
|
|
20
19
|
## 1. Name the audience and its acceptance test
|
|
21
20
|
|
|
@@ -82,19 +81,32 @@ A null that is no search, such as a spec conflict or a gap list, names each item
|
|
|
82
81
|
A null without a certificate, or without a registered reproducer, is recorded as "stopped, unverified", never as success.
|
|
83
82
|
A null inside a range the source checked or an earlier reproduced null covered adds nothing.
|
|
84
83
|
Tell agents the checker may be wrong; credit a checker-defect report the same way, once someone outside the run reproduces the defect.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
|
|
85
|
+
Separate execution settlement, development progress, and final acceptance.
|
|
86
|
+
An unknown outside verdict does not establish absent research progress.
|
|
87
|
+
Match completion instructions to the tools actually served to that node.
|
|
88
|
+
Require `submit_result` only when its grant and checker exist.
|
|
89
|
+
Keep unassessed results unassessed when the execution contract permits settlement without acceptance.
|
|
90
|
+
|
|
91
|
+
For continued research, inspect the installed Runtime deliverable and continuation contracts before choosing bounds.
|
|
92
|
+
Use the existing `checkState` interface for calibrated development measurements when applicable.
|
|
93
|
+
Probe useful progress and unchanged or invalid artifacts before relying on the measurement.
|
|
94
|
+
An always-false acceptance placeholder alone cannot distinguish useful work from stagnation.
|
|
95
|
+
Preserve genuine no-progress limits, deadlines, budgets, and cancellation.
|
|
96
|
+
Choose `maxBarren` from the task's measured feedback cadence; pending assessment does not justify a universally low value.
|
|
97
|
+
|
|
98
|
+
For managers, state how they wait for descendants and collect their artifacts before returning.
|
|
99
|
+
A nested manager returning can end its scope and cancel live descendants.
|
|
100
|
+
Use the granted `await_event` tool while required descendant work remains live.
|
|
101
|
+
A bounded event wait can return before the worker finishes; inspect its state and continue waiting when appropriate.
|
|
102
|
+
A background shell timer does not establish Runtime re-entry.
|
|
103
|
+
Require each descendant to retain partial work where its parent can recover it after interruption.
|
|
104
|
+
|
|
105
|
+
Retain certificates and partial work where the outside assessor can read exact bytes.
|
|
106
|
+
A certificate becomes accepted only through the registered outside check.
|
|
107
|
+
Record the actual termination cause separately from the research outcome.
|
|
108
|
+
State the continuation policy and available completion path in the immutable input.
|
|
109
|
+
A source merge proves no change to an installed or running process.
|
|
98
110
|
|
|
99
111
|
## 6. Carry known traps
|
|
100
112
|
|
|
@@ -103,7 +115,6 @@ Write each trap as what the held-back acceptance refuses, never as what the prox
|
|
|
103
115
|
"The outside check does not count a c = 0 instance" is a trap; "the checker passed c = 0 claims" is a recipe.
|
|
104
116
|
Examples: excluded or trivial cases, stale or wrong-field comparators, published answers, tests versus users, a demo versus a customer, a rater versus an expert.
|
|
105
117
|
Keep infrastructure incidents out of the brief; the operator owns the stack.
|
|
106
|
-
Measured: a director told of an infrastructure failure spent 2 of its first 4 children probing it.
|
|
107
118
|
Record each new trap where the next author reads it, in the same change as its fix.
|
|
108
119
|
|
|
109
120
|
## 7. Set budget and caps
|
|
@@ -118,7 +129,6 @@ Give each paid job its own named key with a dollar cap, and state the dollars be
|
|
|
118
129
|
|
|
119
130
|
Before launch, register the claim, the arms, the outcome measures, the useful-effect threshold, and the result that would refute the claim.
|
|
120
131
|
Run each ingredient you want to credit against a control without it: the referee, the credited exit, live notes, the wording.
|
|
121
|
-
Measured elsewhere: prompt wording alone moved one model's cheating from over 85% to 1%.
|
|
122
132
|
Count precision after review, not claim volume.
|
|
123
133
|
Report reviewed-claim precision, canary pass rate, how many proxy passes the audience accepts, and the cost per accepted result.
|
|
124
134
|
|
|
@@ -136,15 +146,20 @@ Keep unknown cost, output and state unknown; never record them as zero or succes
|
|
|
136
146
|
Before a new or changed profile, name the observed reason and the result that would reverse the choice.
|
|
137
147
|
Before you retry a null or failed child, inspect its recorded artifacts; finished work may be usable.
|
|
138
148
|
A profile with no Runtime coordination tool is a leaf; any coordination tool makes it a managed node.
|
|
139
|
-
|
|
149
|
+
`agent_runtime_coordination_spawn_worker: true` grants Runtime spawning; names, metadata and role labels grant nothing.
|
|
150
|
+
Prove recursive execution through actual child-to-grandchild edges.
|
|
151
|
+
Record harness-native children separately from Runtime children.
|
|
152
|
+
Group retries of the same assignment into one lineage when comparing teams.
|
|
140
153
|
Grant `submit_result` only when Runtime gives that node an independent check; otherwise its settlement stays unassessed.
|
|
141
154
|
Grant only the observation, steering and journal tools that the assignment needs.
|
|
142
155
|
Set `harness`, `model.default` and `model.provider` explicitly, and validate against the current `agentProfileSchema`.
|
|
143
156
|
A tool name must be one the harness publishes, and a refused name fails the same way on retry.
|
|
144
157
|
`ls`, `list` and `find` are not tool names; select paths with a glob tool and search contents with a grep tool.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
158
|
+
Inspect materialized permissions and served tools before relying on a restriction.
|
|
159
|
+
Distinguish exact Runtime grants from harness-native defaults, which may expose additional tools.
|
|
160
|
+
Keep file access within the actual permission boundary.
|
|
161
|
+
Use the execution owner's supported cancellation and recovery procedures for a wedged parent.
|
|
162
|
+
Compare Runtime's materialization receipt and served tool set with what you authored before a large run.
|
|
148
163
|
|
|
149
164
|
Hand a file by path in `resources.files`, and compare the returned sha256 with your source:
|
|
150
165
|
|
|
@@ -172,82 +187,20 @@ Referee: family, instrument, dollars:
|
|
|
172
187
|
Monitor: model, what it may steer:
|
|
173
188
|
Null certificate: space, rows, calibration; registered reproducer, sha256, source calibration; who reruns it, budget:
|
|
174
189
|
Credited exit, in the agents' words:
|
|
175
|
-
|
|
190
|
+
Served completion tools and observed materialization:
|
|
191
|
+
Development progress measurement, calibration, and feedback cadence:
|
|
192
|
+
Stop: installed check/continuation policy, deadline, maxBarren, budget, cancellation:
|
|
176
193
|
Known traps handed to agents:
|
|
177
194
|
Budget, caps, key and its dollar cap:
|
|
178
195
|
Arms, control, measures, threshold, refuting result:
|
|
179
196
|
Records that expose a hack:
|
|
180
197
|
```
|
|
181
198
|
|
|
182
|
-
##
|
|
183
|
-
|
|
184
|
-
### Counterexample hunt, before and after
|
|
185
|
-
|
|
186
|
-
Before, on a 36-lane hunt over 12 conjectures in 2026-09:
|
|
187
|
-
The brief transcribed Wang and Zheng's Conjecture 13 (arXiv:2104.12942) as "c != 1".
|
|
188
|
-
The checker refused only c = 1, and its admission decoys came from that transcription.
|
|
189
|
-
Workers held the same checker that scored claims, and it counted any verified claim as new.
|
|
190
|
-
All 3 lanes on that conjecture filed 39 "verified-new" claims, every one at c = 0.
|
|
191
|
-
The paper assumes c != 0 throughout; at c = 0 the question is only whether x^d permutes the field.
|
|
192
|
-
The real yield was 0.
|
|
193
|
-
|
|
194
|
-
After:
|
|
195
|
-
Audience: the paper's authors and its referees.
|
|
196
|
-
Acceptance: Conjecture 13 quoted with the standing assumption that c is not 0 or 1, plus a literature sweep.
|
|
197
|
-
Gap probe: before launch, the checker refuses c = 0 and classes a Corollary 11 family member as known.
|
|
198
|
-
Agents run the development checker; the operator reruns a held-back checker and the sweep on each packet.
|
|
199
|
-
A referee from another family recomputes each claim with its own code.
|
|
200
|
-
A null over m <= 20 ends the run at its bound, and it counts once the outside check reruns its own reproducer on the certificate's cells.
|
|
201
|
-
Arms: with and without the referee.
|
|
202
|
-
|
|
203
|
-
### A null that counts
|
|
204
|
-
|
|
205
|
-
Wang and Zheng checked Conjecture 13 for 2 <= m <= 10.
|
|
206
|
-
Two lanes searched every (m, d, c) with c not in {0, 1} to m = 20, found no counterexample, and wrote a table.
|
|
207
|
-
Nobody outside the run could check that table.
|
|
208
|
-
Before the next launch, the operator registers a reference search for one m, its sha256, and its calibration: Theorem 9 gives 4 PcN pairs at m = 6 and 8 at m = 10, and a canary drops family (2) so those pairs must count as found.
|
|
209
|
-
As a certificate, the null reads:
|
|
210
|
-
|
|
211
|
-
```json
|
|
212
|
-
{"space": {"cells": {"m": {"from": 2, "to": 20}}, "method": "enumerate", "bound": "m <= 20",
|
|
213
|
-
"within": "each unit d modulo 2^m - 1, one per Frobenius orbit, and each c outside {0, 1}"},
|
|
214
|
-
"rows": [{"cell": {"m": 12}, "searched": 585442, "positives": 28, "found": 0}],
|
|
215
|
-
"calibration": [{"cell": {"m": 6}, "why": "Theorem 9: x^5 is PcN for c in GF(4) outside {0, 1}"}],
|
|
216
|
-
"reference": "sha256:5d198f4fc2d9..."}
|
|
217
|
-
```
|
|
199
|
+
## Examples
|
|
218
200
|
|
|
219
|
-
|
|
220
|
-
The
|
|
221
|
-
|
|
222
|
-
A reference that searches nothing fails at m = 6; one whose found never fires fails the canary.
|
|
223
|
-
If the budget ends after m = 18, the null is credited for 11 <= m <= 18 only.
|
|
224
|
-
The in-run check holds the certificate, and the run ends at `maxBarren`; only the rerun gives credit.
|
|
225
|
-
The trap for this conjecture reads: "the outside check does not count a c = 0 instance; the source sets c = 0 aside".
|
|
226
|
-
|
|
227
|
-
### Coding task scored by tests
|
|
228
|
-
|
|
229
|
-
Audience: the task's author, and a maintainer who decides whether to merge.
|
|
230
|
-
Proxy: the visible tests.
|
|
231
|
-
Gap: a change that passes the tests and that a maintainer rejects, such as a special-cased input, an edited test or a skipped check.
|
|
232
|
-
Measured: in an 8-lane Terminal-Bench batch, Runtime marked 6 lanes as winners and the task's verifier passed 1 of them.
|
|
233
|
-
Profile: agents run the visible tests.
|
|
234
|
-
The held-back verifier and hidden tests run on the patch in a fresh container.
|
|
235
|
-
Hash the test files; a changed test fails acceptance.
|
|
236
|
-
A referee from another family reads the diff for special cases.
|
|
237
|
-
A report that the task cannot pass without breaking its specification ends the run; it counts once the held-back verifier reproduces the conflict.
|
|
238
|
-
|
|
239
|
-
### Product for a customer
|
|
240
|
-
|
|
241
|
-
Audience: the customer who pays, and the decision the product supports.
|
|
242
|
-
Acceptance: the customer's own evaluation criteria, quoted, and a walkthrough of the running product doing the customer's task.
|
|
243
|
-
Proxy: an LLM fulfilment rater and a compliance checklist.
|
|
244
|
-
Gap, measured across product lanes: the rater accepted 19 of 31 failed lanes and scored 0.45 where always-reject scored 0.73.
|
|
245
|
-
In one wave, 19 of 44 reviewers never received the product.
|
|
246
|
-
Profile: reviewers mount the product by path and must run it.
|
|
247
|
-
A referee from another family walks the customer's task on the running product.
|
|
248
|
-
The rater stays a ruler, not a gate, until it beats always-reject.
|
|
249
|
-
Acceptance is the owner's or the customer's walkthrough.
|
|
250
|
-
"Not ready, and this is what is missing" ends the run; it counts once the owner's walkthrough reproduces each gap.
|
|
201
|
+
For acceptance gaps and null certificates, read [acceptance examples](references/acceptance-examples.md).
|
|
202
|
+
The core instructions above are complete when only this file is mounted.
|
|
203
|
+
Mount the reference as well when the assignment needs its worked examples.
|
|
251
204
|
|
|
252
205
|
## Then consider
|
|
253
206
|
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Acceptance examples
|
|
2
|
+
|
|
3
|
+
These examples preserve historical observations from the previous skill.
|
|
4
|
+
Their counts are not current fleet measurements or default settings.
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- [Counterexample hunt](#counterexample-hunt-before-and-after)
|
|
9
|
+
- [A null that counts](#a-null-that-counts)
|
|
10
|
+
- [Coding task](#coding-task-scored-by-tests)
|
|
11
|
+
- [Customer product](#product-for-a-customer)
|
|
12
|
+
- [Other historical observations](#other-historical-observations)
|
|
13
|
+
|
|
14
|
+
## Counterexample hunt, before and after
|
|
15
|
+
|
|
16
|
+
Before, on a 36-lane hunt over 12 conjectures in 2026-09:
|
|
17
|
+
The brief transcribed Wang and Zheng's Conjecture 13 (arXiv:2104.12942) as "c != 1".
|
|
18
|
+
The checker refused only c = 1, and its admission decoys came from that transcription.
|
|
19
|
+
Workers held the same checker that scored claims, and it counted any verified claim as new.
|
|
20
|
+
All 3 lanes on that conjecture filed 39 "verified-new" claims, every one at c = 0.
|
|
21
|
+
The paper assumes c != 0 throughout; at c = 0 the question is only whether x^d permutes the field.
|
|
22
|
+
The real yield was 0.
|
|
23
|
+
|
|
24
|
+
After:
|
|
25
|
+
Audience: the paper's authors and its referees.
|
|
26
|
+
Acceptance: Conjecture 13 quoted with the standing assumption that c is not 0 or 1, plus a literature sweep.
|
|
27
|
+
Gap probe: before launch, the checker refuses c = 0 and classes a Corollary 11 family member as known.
|
|
28
|
+
Agents run the development checker; the operator reruns a held-back checker and the sweep on each packet.
|
|
29
|
+
A referee from another family recomputes each claim with its own code.
|
|
30
|
+
A null over m <= 20 ends the run at its bound, and it counts once the outside check reruns its own reproducer on the certificate's cells.
|
|
31
|
+
Arms: with and without the referee.
|
|
32
|
+
|
|
33
|
+
## A null that counts
|
|
34
|
+
|
|
35
|
+
Wang and Zheng checked Conjecture 13 for 2 <= m <= 10.
|
|
36
|
+
Two lanes searched every (m, d, c) with c not in {0, 1} to m = 20, found no counterexample, and wrote a table.
|
|
37
|
+
Nobody outside the run could check that table.
|
|
38
|
+
Before the next launch, the operator registers a reference search for one m, its sha256, and its calibration: Theorem 9 gives 4 PcN pairs at m = 6 and 8 at m = 10, and a canary drops family (2) so those pairs must count as found.
|
|
39
|
+
As a certificate, the null reads:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{"space": {"cells": {"m": {"from": 2, "to": 20}}, "method": "enumerate", "bound": "m <= 20",
|
|
43
|
+
"within": "each unit d modulo 2^m - 1, one per Frobenius orbit, and each c outside {0, 1}"},
|
|
44
|
+
"rows": [{"cell": {"m": 12}, "searched": 585442, "positives": 28, "found": 0}],
|
|
45
|
+
"calibration": [{"cell": {"m": 6}, "why": "Theorem 9: x^5 is PcN for c in GF(4) outside {0, 1}"}],
|
|
46
|
+
"reference": "sha256:5d198f4fc2d9..."}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The rows list every m; one is shown.
|
|
50
|
+
The outside check hashes its copy, reruns the calibration and the canary with no network, then m = 11 to 20, then the rest.
|
|
51
|
+
Rows typed instead of computed fail at the first cell that differs, and a script in the lane's packet is never run.
|
|
52
|
+
A reference that searches nothing fails at m = 6; one whose found never fires fails the canary.
|
|
53
|
+
If the budget ends after m = 18, the null is credited for 11 <= m <= 18 only.
|
|
54
|
+
The run retains the certificate and ends under its registered stop policy; only the outside rerun gives credit.
|
|
55
|
+
The trap for this conjecture reads: "the outside check does not count a c = 0 instance; the source sets c = 0 aside".
|
|
56
|
+
|
|
57
|
+
## Coding task scored by tests
|
|
58
|
+
|
|
59
|
+
Audience: the task's author, and a maintainer who decides whether to merge.
|
|
60
|
+
Proxy: the visible tests.
|
|
61
|
+
Gap: a change that passes the tests and that a maintainer rejects, such as a special-cased input, an edited test or a skipped check.
|
|
62
|
+
Measured: in an 8-lane Terminal-Bench batch, Runtime marked 6 lanes as winners and the task's verifier passed 1 of them.
|
|
63
|
+
Profile: agents run the visible tests.
|
|
64
|
+
The held-back verifier and hidden tests run on the patch in a fresh container.
|
|
65
|
+
Hash the test files; a changed test fails acceptance.
|
|
66
|
+
A referee from another family reads the diff for special cases.
|
|
67
|
+
A conflict report follows the registered completion and stop policy.
|
|
68
|
+
It counts only after the held-back verifier reproduces the conflict.
|
|
69
|
+
|
|
70
|
+
## Product for a customer
|
|
71
|
+
|
|
72
|
+
Audience: the customer who pays, and the decision the product supports.
|
|
73
|
+
Acceptance: the customer's own evaluation criteria, quoted, and a walkthrough of the running product doing the customer's task.
|
|
74
|
+
Proxy: an LLM fulfilment rater and a compliance checklist.
|
|
75
|
+
Gap, measured across product lanes: the rater accepted 19 of 31 failed lanes and scored 0.45 where always-reject scored 0.73.
|
|
76
|
+
In one wave, 19 of 44 reviewers never received the product.
|
|
77
|
+
Profile: reviewers mount the product by path and must run it.
|
|
78
|
+
A referee from another family walks the customer's task on the running product.
|
|
79
|
+
The rater stays a ruler, not a gate, until it beats always-reject.
|
|
80
|
+
Acceptance is the owner's or the customer's walkthrough.
|
|
81
|
+
A gap report follows the registered completion and stop policy.
|
|
82
|
+
It counts only after the owner's walkthrough reproduces each gap.
|
|
83
|
+
|
|
84
|
+
## Other historical observations
|
|
85
|
+
|
|
86
|
+
These observations motivated the original guidance.
|
|
87
|
+
Consult their underlying records before reusing their numerical claims.
|
|
88
|
+
|
|
89
|
+
- Measured: where a known gap existed, 15 of 27 lanes with claims filed false "new" results; where none was known, 0 of 34 lanes did.
|
|
90
|
+
- Measured elsewhere: a credited exit cut one model's test cheating from 54% to 9%, while prohibitions barely moved another's.
|
|
91
|
+
- Measured: an in-run check that accepted a documented null made it the cheapest hack in 11 of 16 blind judgments.
|
|
92
|
+
- Measured: a director told of an infrastructure failure spent 2 of its first 4 children probing it.
|
|
93
|
+
- Measured elsewhere: prompt wording alone moved one model's cheating from over 85% to 1%.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-layout-vwd4SwX_.js","names":[],"sources":["../src/runtime/supervise/run-layout.ts"],"sourcesContent":["/**\n * The on-disk supervisor-run layout: `<root>/.agent/supervisor/<id>`.\n *\n * This is the durable, cross-process face of a supervisor run — the counterpart to the in-process\n * `Inbox` seam in `./inbox`. A run persists its state under one directory so that any OTHER process\n * can find it after the fact: `@tangle-network/traces` reads exactly this layout via\n * `traces analyze --supervisor-run-dir`, a restarted host can rehydrate a run it no longer holds\n * handles to, and a human can steer a live worker by appending one NDJSON line. Until now the\n * layout was defined only in the unpublished `loops` repo (`src/supervisor-control.ts`) — a\n * published reader depending on an unpublished writer's convention — so the contract is promoted\n * here, names preserved.\n *\n * `.agent` is the one dot-dir for ALL agent-owned state (skills already write\n * `.agent/hypotheses/`, `.agent/skill-runs.jsonl`); supervisor runs live beside them rather than\n * under a product-branded dir. Runs written by older writers used `.loops/supervisor/<id>` —\n * readers that must see those keep a legacy fallback; this writer never creates `.loops` again.\n *\n * Layout, relative to `supervisorRunDir(root, id)`:\n *\n * steers/requests/<hash>.json one exact, caller-idempotent {@link WorkerSteerRequest}\n * steers/acks/<hash>.json runtime acknowledgement for that steer operation\n * workers/<id>.inbox.ndjson best-effort readable projection of admitted steer requests\n * workers/<label>.ndjson best-effort per-worker control-event log (delivery bookkeeping)\n * cancellations/requests.ndjson worker-scoped cancel requests (durable inbox); each line is a\n * {@link WorkerCancelRequest}\n * cancellations/<opId>.json the acknowledgement for one cancel operation — a\n * {@link WorkerCancellation} written ONLY by the runtime\n * acknowledger in the OWNING manager's turn loop: exact node\n * ids route to the manager that parents them (any depth);\n * label/profile-name references to the root manager alone\n * cancellations/run.request.json the run-scoped cancel request — one {@link RunCancelRequest},\n * the whole RUN rather than one worker\n * cancellations/run.json the acknowledgement for the run-scoped request — a\n * {@link RunCancellation} written ONLY by the runtime (the root\n * manager issues the abort; the `supervise()` settle path records\n * what the run actually did)\n *\n * Reads are tolerant by contract: a partial trailing line (a writer mid-append) or a corrupt line\n * never poisons the rest of the file — later valid lines still matter. Duplicate operation ids\n * collapse to the first admitted request, while a payload conflict fails closed.\n *\n * Promoted from `loops/src/supervisor-control.ts`. Steer admission now requires the exact worker id\n * and a caller-owned operation id. One atomic request file is the durable inbox; the NDJSON file is\n * a readable projection only and never controls idempotency.\n *\n * @experimental\n */\n\nimport { createHash } from 'node:crypto'\nimport { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs'\nimport { join, resolve } from 'node:path'\nimport { canonicalCandidateDigest, type Sha256Digest } from '@tangle-network/agent-interface'\nimport type { RetainedRunEffect } from '../retained-run-types'\nimport {\n appendDurableFile,\n assertNoSymlinkDescendant,\n publishExclusiveDurableFile,\n writeAtomicDurableFile,\n} from './durable-file'\n\n/** One atomically admitted down-leg request for an exact worker id. @stable */\nexport interface WorkerSteerRequest {\n readonly schemaVersion: 1\n /** Caller-minted stable idempotency key for this operation. */\n readonly operationId: string\n /** Digest of operation id, worker id, message, source, and interrupt mode. */\n readonly requestDigest: Sha256Digest\n /** ISO timestamp of durable admission. */\n readonly at: string\n /** Who asked — 'human', a brain label, a tool name. Provenance, not authorization. */\n readonly source: string\n /** Exact supervised node id, including the run id for its root manager. */\n readonly worker: string\n readonly message: string\n readonly interrupt: boolean\n}\n\n/** Runtime acknowledgement for one exact steer operation. @stable */\nexport interface WorkerSteerAcknowledgement {\n readonly schemaVersion: 1\n readonly operationId: string\n readonly requestDigest: Sha256Digest\n readonly worker: string\n readonly effect: 'unknown' | 'delivered' | 'not_live' | 'unsupported' | 'refused'\n readonly requestedAt: string\n readonly observedAt: string\n readonly detail: string\n}\n\n/** Caller input for one retry-safe steer operation. @stable */\nexport interface WriteWorkerSteerOptions {\n readonly operationId: string\n readonly message: string\n readonly source?: string\n readonly interrupt?: boolean\n}\n\n/** One durable worker-scoped cancel request appended to the run's cancellation inbox. */\nexport interface WorkerCancelRequest {\n /** Caller-minted stable operation identifier — the idempotency key of the whole operation. */\n readonly operationId: string\n /** ISO timestamp of the append. */\n readonly at: string\n /** Who asked — 'human', a brain label, a tool name. Provenance, not authorization. */\n readonly source: string\n /** The worker the request targets: a workerId (node id — routed to the owning manager at any\n * depth), or a profile name or spawn label (resolved by the root manager against its direct\n * children only). */\n readonly worker: string\n readonly reason?: string\n}\n\n/**\n * The durable acknowledgement state for one worker-scoped cancel operation, keyed by\n * `operationId`. The runtime acknowledger is the ONLY writer; `cancelWorker` only reads it.\n *\n * `effect` reuses the retained-run vocabulary ({@link RetainedRunEffect}) so the runtime has one\n * spelling of the four cancellation states:\n * - `'unknown'` — not yet resolved by the runtime (also what `cancelWorker` returns for\n * a request no acknowledger has answered), or — terminally, with the\n * run-over detail — an abort was issued but the run ended before the\n * termination could be observed. Never a success.\n * - `'cancel_requested'` — the runtime issued the worker's abort; termination not yet proven.\n * - `'cancelled'` — the worker reached a terminal `down` state on the settle path.\n * - `'not_live'` — the worker was not live to cancel (already settled, it settled\n * `done` despite the abort, or the run ended before the request was\n * ever applied). Never a success of THIS operation.\n *\n * Expiry is run end: the owning manager's final pass closes every still-open request it owns\n * (`not_live` never applied, `unknown` issued-but-unproven), so a pending request cannot outlive\n * its run and abort a future spawn that happens to reuse a label.\n */\nexport interface WorkerCancellation {\n readonly operationId: string\n /** The worker reference exactly as requested. */\n readonly worker: string\n readonly effect: RetainedRunEffect\n /** ISO timestamp of the original request. */\n readonly requestedAt: string\n /** ISO timestamp of the runtime's most recent observation of this operation. */\n readonly observedAt: string\n /** The node id the acknowledger resolved `worker` to, once resolved. */\n readonly workerId?: string\n /** The caller's reason, carried verbatim from the request. */\n readonly reason?: string\n /** The runtime's explanation of how it arrived at `effect`. */\n readonly detail?: string\n /**\n * Every node id this operation PROVED terminated: the requested worker plus each descendant of\n * its subtree observed to reach a terminal `down`/`cancelled` journal record at or after the\n * abort was ISSUED — the acknowledger's own `observedAt` on the `cancel_requested` record\n * (runtime clock), never the client's `requestedAt` (a cancelled lead cascades to its subtree\n * by design — the scope signal chain — so the acknowledgement names the set, not one id).\n * Proven at acknowledgement time; post-abort causation is approximate: a descendant that died\n * of its own cause after the abort is indistinguishable from the cascade and may be included,\n * a late teardown journal joins the set on a later pass while the manager still runs, and one\n * still absent at run end is absent from the set. Grows monotonically; empty until termination\n * is proven.\n */\n readonly terminated: ReadonlyArray<string>\n}\n\n/** One durable run-scoped cancel request: cancel the WHOLE run, not one worker. */\nexport interface RunCancelRequest {\n /** Caller-minted stable operation identifier — the idempotency key of the whole operation. */\n readonly operationId: string\n /** ISO timestamp of the write. */\n readonly at: string\n /** Who asked — 'human', a brain label, a tool name. Provenance, not authorization. */\n readonly source: string\n /** Requested observation target, measured by the acknowledgement's deadlineExceeded field.\n * The observer always cascades eagerly. This does not guarantee scheduler latency or cleanup. */\n readonly deadlineMs?: number\n /** Stable operator/requester identity for audit trails. */\n readonly operator?: string\n readonly reason?: string\n}\n\n/**\n * The durable acknowledgement state for the run-scoped cancel operation, keyed by `operationId`.\n * The runtime is the ONLY writer; {@link cancelRun} only reads it.\n *\n * `effect` is the same {@link RetainedRunEffect} vocabulary the worker-scoped and retained-run\n * paths use, so the runtime has one spelling of the four cancellation states:\n * - `'unknown'` — no runtime has answered yet. Never a success.\n * - `'cancel_requested'` — the root manager issued the run's cascading abort; the run's terminal\n * state is not yet observed.\n * - `'cancelled'` — the run reached its terminal cancelled state with confirmed teardown.\n * - `'not_live'` — the run was not live to cancel: it settled on its own despite the\n * request, or it ended before the request was applied.\n */\nexport interface RunCancellation {\n /** Runtime path that issued the cascade. */\n readonly path?: 'observer' | 'turn-boundary' | 'fallback'\n /** Runtime clock elapsed between request timestamp and cascade application. */\n readonly appliedAfterMs?: number\n /** Whether application exceeded the requested deadlineMs; absent when no target was requested. */\n readonly deadlineExceeded?: boolean\n readonly operationId: string\n readonly effect: RetainedRunEffect\n /** ISO timestamp of the original request. */\n readonly requestedAt: string\n /** ISO timestamp of the runtime's most recent observation of this operation. */\n readonly observedAt: string\n /** The caller's reason, carried verbatim from the request. */\n readonly reason?: string\n /** The caller's operator identity, carried verbatim from the request. */\n readonly operator?: string\n /** The runtime's explanation of how it arrived at `effect`. */\n readonly detail?: string\n}\n\n/** The root every supervisor run of one workspace lives under. */\nexport function supervisorRunsRoot(rootDir: string): string {\n return join(resolve(rootDir), '.agent', 'supervisor')\n}\n\n/** The run directory every artifact of one supervisor run lives under. */\nexport function supervisorRunDir(rootDir: string, id: string): string {\n return join(supervisorRunsRoot(rootDir), id)\n}\n\n/**\n * Where a pre-rename writer put the same run (`<root>/.loops/supervisor/<id>`). Readers that must\n * see historical runs check {@link supervisorRunDir} first and fall back to this; nothing writes\n * here anymore.\n */\nexport function legacySupervisorRunDir(rootDir: string, id: string): string {\n return join(legacySupervisorRunsRoot(rootDir), id)\n}\n\n/**\n * The pre-rename runs root (`<root>/.loops/supervisor`). Only readers that ENUMERATE historical\n * runs need this — the per-id form is {@link legacySupervisorRunDir}. Nothing writes here.\n */\nexport function legacySupervisorRunsRoot(rootDir: string): string {\n return join(resolve(rootDir), '.loops', 'supervisor')\n}\n\n/** A worker label reduced to a safe filename stem. Empty labels get a stable fallback. */\nexport function safeWorkerFile(label: string): string {\n const safe = label.replace(/[^A-Za-z0-9._-]/g, '_')\n return safe.length > 0 ? safe : 'worker'\n}\n\n/** The directory holding every per-worker file of one run (inboxes and control-event logs). */\nexport function supervisorWorkersDir(eventDir: string): string {\n return join(eventDir, 'workers')\n}\n\n/** The durable inbox file for one worker of one run. */\nexport function workerInboxFile(rootDir: string, supervisorId: string, worker: string): string {\n return workerInboxFileFromEventDir(supervisorRunDir(rootDir, supervisorId), worker)\n}\n\n/** Same, addressed from an already-known run directory (the reader's usual entry point). */\nexport function workerInboxFileFromEventDir(eventDir: string, worker: string): string {\n return join(supervisorWorkersDir(eventDir), `${safeWorkerFile(worker)}.inbox.ndjson`)\n}\n\n/**\n * The best-effort control-event log for one worker (`workers/<label>.ndjson`) — delivery\n * bookkeeping for steers, plus whatever lifecycle events a writer chooses to append. Distinct from\n * the inbox: the inbox is the durable down-leg queue, this is the record of what happened to it.\n */\nexport function workerControlLogFile(eventDir: string, worker: string): string {\n return join(supervisorWorkersDir(eventDir), `${safeWorkerFile(worker)}.ndjson`)\n}\n\n/** Directory containing atomically admitted steer requests and runtime acknowledgements. */\nexport function workerSteersDir(eventDir: string): string {\n return join(eventDir, 'steers')\n}\n\n/** Directory containing one canonical request file per steer operation. */\nexport function workerSteerRequestsDir(eventDir: string): string {\n return join(workerSteersDir(eventDir), 'requests')\n}\n\n/** Directory containing one runtime acknowledgement per steer operation. */\nexport function workerSteerAcknowledgementsDir(eventDir: string): string {\n return join(workerSteersDir(eventDir), 'acks')\n}\n\n/** Canonical request file for one caller-owned steer operation id. */\nexport function workerSteerRequestFile(eventDir: string, operationId: string): string {\n return join(workerSteerRequestsDir(eventDir), `${operationFileHash(operationId)}.json`)\n}\n\n/** Runtime acknowledgement file for one caller-owned steer operation id. */\nexport function workerSteerAcknowledgementFile(eventDir: string, operationId: string): string {\n return join(workerSteerAcknowledgementsDir(eventDir), `${operationFileHash(operationId)}.json`)\n}\n\n/**\n * Admit one steer exactly once under a caller-owned operation id.\n *\n * Pass `supervisorId` as `worker` to address the root. Router roots consume requests between\n * turns; native roots use their existing accepting inbox during execution, or acknowledge\n * `unsupported` when none is available. Delivery does not prove model consumption.\n * This filesystem API requires trusted write access to the run directory; it adds no MCP grant.\n *\n * The per-operation request file is linked into place atomically after its bytes reach disk. A\n * same-body retry returns the winner's request. A changed-body retry fails loud. The NDJSON inbox\n * and control log are readable projections written only by the admission winner.\n * @stable\n */\nexport function writeWorkerSteer(\n rootDir: string,\n supervisorId: string,\n worker: string,\n options: WriteWorkerSteerOptions,\n): {\n worker: string\n file: string\n request: WorkerSteerRequest\n acknowledgement?: WorkerSteerAcknowledgement\n replayed: boolean\n} {\n const workerId = worker.trim()\n if (!workerId) throw new Error('writeWorkerSteer: worker id is empty')\n const operationId = options.operationId.trim()\n if (!operationId) throw new Error('writeWorkerSteer: operationId is empty')\n const trimmed = options.message.trim()\n if (!trimmed) throw new Error('steer message is empty')\n const source = options.source?.trim() || 'human'\n const interrupt = options.interrupt === true\n const dir = supervisorRunDir(rootDir, supervisorId)\n const requestDigest = workerSteerRequestDigest({\n operationId,\n worker: workerId,\n message: trimmed,\n source,\n interrupt,\n })\n const request: WorkerSteerRequest = {\n schemaVersion: 1,\n operationId,\n requestDigest,\n at: new Date().toISOString(),\n source,\n worker: workerId,\n message: trimmed,\n interrupt,\n }\n const file = workerSteerRequestFile(dir, operationId)\n assertNoSymlinkDescendant(dir, file, 'steer request')\n mkdirSync(workerSteerRequestsDir(dir), { recursive: true })\n assertNoSymlinkDescendant(dir, file, 'steer request')\n const admitted = admitSteerRequest(file, request)\n if (admitted.replayed) {\n return {\n worker: admitted.request.worker,\n file,\n request: admitted.request,\n ...(readWorkerSteerAcknowledgement(dir, operationId) === undefined\n ? {}\n : { acknowledgement: readWorkerSteerAcknowledgement(dir, operationId) }),\n replayed: true,\n }\n }\n mkdirSync(supervisorWorkersDir(dir), { recursive: true })\n const projection = workerInboxFile(rootDir, supervisorId, workerId)\n try {\n appendFileSync(projection, `${JSON.stringify(request)}\\n`, 'utf8')\n } catch {\n // The atomic operation file is the queue. This projection does not control admission.\n }\n appendWorkerControlEvent(dir, workerId, {\n kind: 'message',\n direction: 'down',\n source,\n operationId,\n requestDigest,\n message: trimmed,\n interrupt,\n queued: true,\n delivered: false,\n })\n return { worker: workerId, file, request, replayed: false }\n}\n\n/** Read every atomically admitted request for one exact worker id, in admission order. @stable */\nexport function readWorkerSteerRequests(eventDir: string, worker?: string): WorkerSteerRequest[] {\n const workerId = worker?.trim()\n if (worker !== undefined && !workerId) return []\n let names: string[]\n assertNoSymlinkDescendant(eventDir, workerSteerRequestsDir(eventDir), 'steer request')\n try {\n names = readdirSync(workerSteerRequestsDir(eventDir))\n } catch {\n return []\n }\n const out: WorkerSteerRequest[] = []\n for (const name of names) {\n if (!name.endsWith('.json')) continue\n try {\n const file = join(workerSteerRequestsDir(eventDir), name)\n assertNoSymlinkDescendant(eventDir, file, 'steer request')\n const parsed = parseWorkerSteerRequest(JSON.parse(readFileSync(file, 'utf8')))\n if (name !== `${operationFileHash(parsed.operationId)}.json`) continue\n if (workerId === undefined || parsed.worker === workerId) out.push(parsed)\n } catch {\n // One corrupt request cannot hide other independently committed operations.\n }\n }\n return out.sort((left, right) =>\n left.at === right.at\n ? left.operationId.localeCompare(right.operationId)\n : left.at.localeCompare(right.at),\n )\n}\n\n/** Read one runtime steer acknowledgement, or `undefined` while no manager has answered. @stable */\nexport function readWorkerSteerAcknowledgement(\n eventDir: string,\n operationId: string,\n): WorkerSteerAcknowledgement | undefined {\n const id = operationId.trim()\n if (!id) throw new Error('readWorkerSteerAcknowledgement: operationId is empty')\n const file = workerSteerAcknowledgementFile(eventDir, id)\n assertNoSymlinkDescendant(eventDir, file, 'steer acknowledgement')\n if (!existsSync(file)) return undefined\n const record = parseWorkerSteerAcknowledgement(JSON.parse(readFileSync(file, 'utf8')))\n if (record.operationId !== id) {\n throw new Error(`steer acknowledgement '${file}' belongs to another operation`)\n }\n return record\n}\n\n/**\n * Claim one steer for delivery with an atomic no-clobber acknowledgement.\n * Returns `true` only to the process that created the pre-delivery record.\n * @internal\n */\nexport function claimWorkerSteerDelivery(\n eventDir: string,\n record: WorkerSteerAcknowledgement,\n): boolean {\n const exact = parseWorkerSteerAcknowledgement(record)\n if (exact.effect !== 'unknown') {\n throw new Error('steer delivery claim must use effect unknown')\n }\n const request = readWorkerSteerRequest(eventDir, exact.operationId)\n if (request === undefined || request.requestDigest !== exact.requestDigest) {\n throw new Error('steer delivery claim does not match an admitted request')\n }\n const dir = workerSteerAcknowledgementsDir(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'steer acknowledgement')\n mkdirSync(dir, { recursive: true })\n assertNoSymlinkDescendant(eventDir, dir, 'steer acknowledgement')\n const file = workerSteerAcknowledgementFile(eventDir, exact.operationId)\n if (publishExclusiveDurableFile(file, `${JSON.stringify(exact, null, 2)}\\n`)) {\n return true\n }\n const winner = readWorkerSteerAcknowledgement(eventDir, exact.operationId)\n if (\n winner === undefined ||\n winner.operationId !== exact.operationId ||\n winner.requestDigest !== exact.requestDigest\n ) {\n throw new Error('steer delivery claim conflicts with another operation')\n }\n return false\n}\n\n/** Atomically replace the runtime acknowledgement for one steer operation. @internal */\nexport function writeWorkerSteerAcknowledgement(\n eventDir: string,\n record: WorkerSteerAcknowledgement,\n): void {\n const exact = parseWorkerSteerAcknowledgement(record)\n const request = readWorkerSteerRequest(eventDir, exact.operationId)\n if (request === undefined || request.requestDigest !== exact.requestDigest) {\n throw new Error('steer acknowledgement does not match an admitted request')\n }\n const dir = workerSteerAcknowledgementsDir(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'steer acknowledgement')\n mkdirSync(dir, { recursive: true })\n assertNoSymlinkDescendant(eventDir, dir, 'steer acknowledgement')\n const file = workerSteerAcknowledgementFile(eventDir, exact.operationId)\n const prior = readWorkerSteerAcknowledgement(eventDir, exact.operationId)\n if (\n prior !== undefined &&\n prior.effect !== 'unknown' &&\n canonicalCandidateDigest(prior) !== canonicalCandidateDigest(exact)\n ) {\n throw new Error(`steer operation '${exact.operationId}' already has a terminal acknowledgement`)\n }\n writeAtomicDurableFile(file, `${JSON.stringify(exact, null, 2)}\\n`)\n}\n\n/** The directory holding every cancellation artifact of one run (request inbox + acknowledgements). */\nexport function workerCancellationsDir(eventDir: string): string {\n return join(eventDir, 'cancellations')\n}\n\n/**\n * The durable cancel-request inbox of one run — one NDJSON line per {@link WorkerCancelRequest}.\n * It stays append-only so independent operations retain admission order and readers can skip a\n * partial trailing line. `appendDurableFile` uses O_APPEND, one write, file fsync, and directory\n * fsync; single-record acknowledgements use atomic replacement instead.\n */\nexport function workerCancelRequestsFile(eventDir: string): string {\n return join(workerCancellationsDir(eventDir), 'requests.ndjson')\n}\n\n/**\n * The acknowledgement file for one cancel operation. The filename is a sanitized stem of the\n * `operationId`; the record inside carries the exact id, and readers verify it so two distinct\n * ids that sanitize to one stem fail loud instead of answering for each other.\n */\nexport function workerCancellationFile(eventDir: string, operationId: string): string {\n return join(workerCancellationsDir(eventDir), `${safeOperationFile(operationId)}.json`)\n}\n\nfunction safeOperationFile(operationId: string): string {\n const safe = operationId.replace(/[^A-Za-z0-9._-]/g, '_')\n if (safe.length === 0) throw new Error('cancel operationId is empty')\n return safe\n}\n\n/** Read every valid cancel request in the run's cancellation inbox. Corrupt lines are skipped. */\nexport function readWorkerCancelRequests(eventDir: string): WorkerCancelRequest[] {\n const dir = workerCancellationsDir(eventDir)\n const file = workerCancelRequestsFile(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'cancel request')\n assertNoSymlinkDescendant(eventDir, file, 'cancel request')\n if (!existsSync(file)) return []\n const out: WorkerCancelRequest[] = []\n const byOperationId = new Map<string, WorkerCancelRequest>()\n let raw = ''\n try {\n raw = readFileSync(file, 'utf8')\n } catch {\n return out\n }\n for (const line of raw.split('\\n')) {\n const trimmed = line.trim()\n if (!trimmed) continue\n let parsed: Partial<WorkerCancelRequest>\n try {\n parsed = JSON.parse(trimmed) as Partial<WorkerCancelRequest>\n } catch {\n // Ignore partial or corrupt input lines; later valid lines still matter.\n continue\n }\n if (!isWorkerCancelRequest(parsed)) continue\n const prior = byOperationId.get(parsed.operationId)\n if (prior !== undefined) {\n assertSameWorkerCancelRequest(prior, parsed)\n } else {\n byOperationId.set(parsed.operationId, parsed)\n out.push(parsed)\n }\n }\n return out\n}\n\n/**\n * Read the acknowledgement for one cancel operation. `undefined` when the runtime has not\n * answered. A record whose stored `operationId` differs from the requested one is a filename\n * collision between two sanitized ids — fail loud rather than return another operation's answer.\n */\nexport function readWorkerCancellation(\n eventDir: string,\n operationId: string,\n): WorkerCancellation | undefined {\n const dir = workerCancellationsDir(eventDir)\n const file = workerCancellationFile(eventDir, operationId)\n assertNoSymlinkDescendant(eventDir, dir, 'cancel acknowledgement')\n assertNoSymlinkDescendant(eventDir, file, 'cancel acknowledgement')\n if (!existsSync(file)) return undefined\n const parsed = JSON.parse(readFileSync(file, 'utf8')) as WorkerCancellation\n if (parsed.operationId !== operationId) {\n throw new Error(\n `cancel acknowledgement collision: '${file}' holds operation '${parsed.operationId}', ` +\n `not '${operationId}' — use operation ids that stay distinct after filename sanitization`,\n )\n }\n return parsed\n}\n\n/**\n * Durably write one acknowledgement record. The shared writer fsyncs the file and containing\n * directory, so a concurrent reader sees the prior complete record or the new complete record.\n *\n * @internal The runtime acknowledger is the only intended writer; clients read via\n * {@link readWorkerCancellation} or {@link cancelWorker}.\n */\nexport function writeWorkerCancellation(eventDir: string, record: WorkerCancellation): void {\n const dir = workerCancellationsDir(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'cancel acknowledgement')\n mkdirSync(dir, { recursive: true })\n assertNoSymlinkDescendant(eventDir, dir, 'cancel acknowledgement')\n const file = workerCancellationFile(eventDir, record.operationId)\n assertNoSymlinkDescendant(eventDir, file, 'cancel acknowledgement')\n writeAtomicDurableFile(file, `${JSON.stringify(record, null, 2)}\\n`, { mode: 0o600 })\n}\n\n/**\n * Request the cancellation of ONE worker, idempotently, and return the operation's current\n * durable state.\n *\n * The write half of the acknowledged-cancellation contract (`writeWorkerSteer` is the steer\n * analog): append the request to the run's cancellation inbox, where the OWNING manager's\n * acknowledger (its turn loop — the root for label/profile references, the parent manager for an\n * exact node id at any depth) applies it — aborting exactly that worker's subtree and recording\n * what it proved. This function never applies the cancellation itself; writing a\n * request file is not an acknowledgement.\n *\n * Idempotency is a lookup: when an acknowledgement for `operationId` already exists, it is\n * returned AS-IS and nothing is appended — repeating one operation can never apply twice. A\n * retry that changes the worker, source, or reason fails closed. A request the runtime has not\n * answered yet returns `effect: 'unknown'` (never a success); call again with the same\n * `operationId` — or `readWorkerCancellation` — to read the acknowledged result after a\n * reconnect.\n */\nexport function cancelWorker(\n eventDir: string,\n worker: string,\n operationId: string,\n options: { readonly reason?: string; readonly source?: string } = {},\n): WorkerCancellation {\n const ref = worker.trim()\n if (!ref) throw new Error('cancelWorker: worker reference is empty')\n const opId = operationId.trim()\n if (!opId) throw new Error('cancelWorker: operationId is empty')\n const pending = readWorkerCancelRequests(eventDir).find((r) => r.operationId === opId)\n const candidate = {\n operationId: opId,\n worker: ref,\n source: options.source ?? 'human',\n ...(options.reason === undefined ? {} : { reason: options.reason }),\n }\n if (pending !== undefined) assertSameWorkerCancelRequest(pending, candidate)\n const acknowledged = readWorkerCancellation(eventDir, opId)\n if (acknowledged !== undefined) {\n if (pending === undefined && options.source !== undefined) {\n throw new Error(\n `cancelWorker: operation '${opId}' cannot verify source without its admitted request`,\n )\n }\n assertWorkerCancellationMatchesCandidate(acknowledged, candidate)\n return acknowledged\n }\n const source = options.source ?? 'human'\n const request: WorkerCancelRequest = pending ?? {\n operationId: opId,\n at: new Date().toISOString(),\n source,\n worker: ref,\n ...(options.reason === undefined ? {} : { reason: options.reason }),\n }\n if (!pending) {\n const dir = workerCancellationsDir(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'cancel request')\n mkdirSync(dir, { recursive: true })\n assertNoSymlinkDescendant(eventDir, dir, 'cancel request')\n const file = workerCancelRequestsFile(eventDir)\n assertNoSymlinkDescendant(eventDir, file, 'cancel request')\n appendDurableFile(file, `${JSON.stringify(request)}\\n`, { mode: 0o600 })\n appendWorkerControlEvent(eventDir, ref, {\n kind: 'cancel-request',\n operationId: opId,\n source,\n queued: true,\n ...(options.reason === undefined ? {} : { reason: options.reason }),\n })\n }\n return {\n operationId: opId,\n worker: request.worker,\n effect: 'unknown',\n requestedAt: request.at,\n observedAt: request.at,\n ...(request.reason === undefined ? {} : { reason: request.reason }),\n detail: 'request queued; no runtime acknowledger has answered yet',\n terminated: [],\n }\n}\n\n/** The run-scoped cancel request file of one run — one {@link RunCancelRequest}. */\nexport function runCancelRequestFile(eventDir: string): string {\n return join(workerCancellationsDir(eventDir), 'run.request.json')\n}\n\n/** The run-scoped acknowledgement file of one run — one {@link RunCancellation}. */\nexport function runCancellationFile(eventDir: string): string {\n return join(workerCancellationsDir(eventDir), 'run.json')\n}\n\n/** Read the run-scoped cancel request, or `undefined` when none was written. */\nexport function readRunCancelRequest(eventDir: string): RunCancelRequest | undefined {\n const dir = workerCancellationsDir(eventDir)\n const file = runCancelRequestFile(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'run cancel request')\n assertNoSymlinkDescendant(eventDir, file, 'run cancel request')\n if (!existsSync(file)) return undefined\n const parsed = JSON.parse(readFileSync(file, 'utf8')) as Partial<RunCancelRequest>\n if (!isRunCancelRequest(parsed)) {\n throw new Error(`run cancel request '${file}' is not a complete RunCancelRequest`)\n }\n return parsed\n}\n\n/**\n * Read the acknowledgement for the run-scoped cancel operation. `undefined` when the runtime has\n * not answered. A record holding a DIFFERENT `operationId` belongs to another operation on the\n * same run — fail loud rather than answer for it.\n */\nexport function readRunCancellation(\n eventDir: string,\n operationId: string,\n): RunCancellation | undefined {\n const dir = workerCancellationsDir(eventDir)\n const file = runCancellationFile(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'run cancel acknowledgement')\n assertNoSymlinkDescendant(eventDir, file, 'run cancel acknowledgement')\n if (!existsSync(file)) return undefined\n const parsed = JSON.parse(readFileSync(file, 'utf8')) as RunCancellation\n if (parsed.operationId !== operationId) {\n throw new Error(\n `run cancel acknowledgement '${file}' holds operation '${parsed.operationId}', not ` +\n `'${operationId}' — one run carries one run-scoped cancel operation`,\n )\n }\n return parsed\n}\n\n/**\n * Durably write the run-scoped acknowledgement. The shared writer fsyncs the file and containing\n * directory, so a concurrent reader sees the prior complete record or the new complete record.\n *\n * @internal The runtime is the only intended writer; clients read via {@link readRunCancellation}\n * or {@link cancelRun}.\n */\nexport function writeRunCancellation(eventDir: string, record: RunCancellation): void {\n const dir = workerCancellationsDir(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'run cancel acknowledgement')\n mkdirSync(dir, { recursive: true })\n assertNoSymlinkDescendant(eventDir, dir, 'run cancel acknowledgement')\n const file = runCancellationFile(eventDir)\n assertNoSymlinkDescendant(eventDir, file, 'run cancel acknowledgement')\n writeAtomicDurableFile(file, `${JSON.stringify(record, null, 2)}\\n`, { mode: 0o600 })\n}\n\n/**\n * Request the cancellation of the WHOLE run, idempotently, and return the operation's current\n * durable state.\n *\n * The run-scoped twin of {@link cancelWorker}: write the request into the run's cancellation\n * directory, where the run's own root manager applies it — aborting the root through the one\n * cascade controller the run already has, so every live worker comes down with it. This function\n * never applies the cancellation itself; writing a request file is not an acknowledgement.\n *\n * Idempotency is a lookup: when an acknowledgement for `operationId` already exists it is returned\n * AS-IS and nothing is written. A retry that changes the source, reason, deadline, or operator\n * fails closed. A request the runtime has not answered yet returns `effect: 'unknown'` (never a\n * success); call again with the same `operationId` — or {@link readRunCancellation} — to read the\n * acknowledged result after a reconnect.\n *\n * A run carries ONE run-scoped operation: a second request under a different `operationId` throws\n * rather than silently replacing the pending one, because both would claim the same single abort.\n */\nexport function cancelRun(\n eventDir: string,\n operationId: string,\n options: {\n readonly reason?: string\n readonly source?: string\n readonly deadlineMs?: number\n readonly operator?: string\n } = {},\n): RunCancellation {\n if (\n options.deadlineMs !== undefined &&\n (!Number.isFinite(options.deadlineMs) || options.deadlineMs < 0)\n ) {\n throw new Error('cancelRun: deadlineMs must be a finite nonnegative number')\n }\n const opId = operationId.trim()\n if (!opId) throw new Error('cancelRun: operationId is empty')\n const pending = readRunCancelRequest(eventDir)\n if (pending !== undefined && pending.operationId !== opId) {\n throw new Error(\n `cancelRun: run cancel '${pending.operationId}' is already pending for this run; ` +\n `read it with readRunCancellation instead of issuing '${opId}'`,\n )\n }\n const candidate = {\n operationId: opId,\n source: options.source ?? 'human',\n ...(options.reason === undefined ? {} : { reason: options.reason }),\n ...(options.deadlineMs === undefined ? {} : { deadlineMs: options.deadlineMs }),\n ...(options.operator === undefined ? {} : { operator: options.operator }),\n }\n if (pending !== undefined) assertSameRunCancelRequest(pending, candidate)\n const acknowledged = readRunCancellation(eventDir, opId)\n if (acknowledged !== undefined) {\n if (pending === undefined && options.source !== undefined) {\n throw new Error(\n `cancelRun: operation '${opId}' cannot verify source without its admitted request`,\n )\n }\n assertRunCancellationMatchesCandidate(acknowledged, candidate)\n return acknowledged\n }\n const source = options.source ?? 'human'\n const request: RunCancelRequest = pending ?? {\n operationId: opId,\n at: new Date().toISOString(),\n source,\n ...(options.reason === undefined ? {} : { reason: options.reason }),\n ...(options.deadlineMs === undefined ? {} : { deadlineMs: options.deadlineMs }),\n ...(options.operator === undefined ? {} : { operator: options.operator }),\n }\n if (pending === undefined) {\n const dir = workerCancellationsDir(eventDir)\n assertNoSymlinkDescendant(eventDir, dir, 'run cancel request')\n mkdirSync(dir, { recursive: true })\n assertNoSymlinkDescendant(eventDir, dir, 'run cancel request')\n const file = runCancelRequestFile(eventDir)\n assertNoSymlinkDescendant(eventDir, file, 'run cancel request')\n writeAtomicDurableFile(file, `${JSON.stringify(request, null, 2)}\\n`, { mode: 0o600 })\n appendWorkerControlEvent(eventDir, 'run', {\n kind: 'run-cancel-request',\n operationId: opId,\n source,\n queued: true,\n ...(options.reason === undefined ? {} : { reason: options.reason }),\n ...(options.deadlineMs === undefined ? {} : { deadlineMs: options.deadlineMs }),\n ...(options.operator === undefined ? {} : { operator: options.operator }),\n })\n }\n return {\n operationId: opId,\n effect: 'unknown',\n requestedAt: request.at,\n observedAt: request.at,\n ...(request.reason === undefined ? {} : { reason: request.reason }),\n ...(request.operator === undefined ? {} : { operator: request.operator }),\n detail: 'request queued; no runtime acknowledger has answered yet',\n }\n}\n\ntype WorkerCancelRequestCandidate = {\n readonly operationId: string\n readonly worker: string\n readonly source: string\n readonly reason?: string\n}\n\ntype RunCancelRequestCandidate = {\n readonly deadlineMs?: number\n readonly operationId: string\n readonly source: string\n readonly reason?: string\n readonly operator?: string\n}\n\nfunction assertSameWorkerCancelRequest(\n existing: WorkerCancelRequest,\n candidate: WorkerCancelRequestCandidate,\n): void {\n if (existing.operationId !== candidate.operationId) {\n throw new Error(`cancelWorker: operation '${candidate.operationId}' has an id collision`)\n }\n if (existing.worker !== candidate.worker) {\n throw new Error(\n `cancelWorker: operation '${candidate.operationId}' conflicts with its admitted request ` +\n `(worker '${existing.worker}' != '${candidate.worker}')`,\n )\n }\n if (existing.source !== candidate.source) {\n throw new Error(\n `cancelWorker: operation '${candidate.operationId}' conflicts with its admitted request ` +\n `(source '${existing.source}' != '${candidate.source}')`,\n )\n }\n if (existing.reason !== candidate.reason) {\n throw new Error(\n `cancelWorker: operation '${candidate.operationId}' conflicts with its admitted request ` +\n `(reason differs)`,\n )\n }\n}\n\nfunction assertWorkerCancellationMatchesCandidate(\n existing: WorkerCancellation,\n candidate: WorkerCancelRequestCandidate,\n): void {\n if (existing.worker !== candidate.worker) {\n throw new Error(\n `cancelWorker: operation '${candidate.operationId}' conflicts with its acknowledgement ` +\n `(worker '${existing.worker}' != '${candidate.worker}')`,\n )\n }\n if (existing.reason !== candidate.reason) {\n throw new Error(\n `cancelWorker: operation '${candidate.operationId}' conflicts with its acknowledgement ` +\n `(reason differs)`,\n )\n }\n}\n\nfunction assertSameRunCancelRequest(\n existing: RunCancelRequest,\n candidate: RunCancelRequestCandidate,\n): void {\n if (existing.operationId !== candidate.operationId) {\n throw new Error(`cancelRun: operation '${candidate.operationId}' has an id collision`)\n }\n if (existing.source !== candidate.source) {\n throw new Error(\n `cancelRun: operation '${candidate.operationId}' conflicts with its admitted request ` +\n `(source '${existing.source}' != '${candidate.source}')`,\n )\n }\n if (existing.deadlineMs !== candidate.deadlineMs) {\n throw new Error(\n `cancelRun: operation '${candidate.operationId}' conflicts with its admitted request (deadlineMs differs)`,\n )\n }\n if (existing.reason !== candidate.reason) {\n throw new Error(\n `cancelRun: operation '${candidate.operationId}' conflicts with its admitted request ` +\n `(reason differs)`,\n )\n }\n if (existing.operator !== candidate.operator) {\n throw new Error(\n `cancelRun: operation '${candidate.operationId}' conflicts with its admitted request ` +\n `(operator '${existing.operator}' != '${candidate.operator}')`,\n )\n }\n}\n\nfunction assertRunCancellationMatchesCandidate(\n existing: RunCancellation,\n candidate: RunCancelRequestCandidate,\n): void {\n if (existing.reason !== candidate.reason) {\n throw new Error(\n `cancelRun: operation '${candidate.operationId}' conflicts with its acknowledgement ` +\n `(reason differs)`,\n )\n }\n // An acknowledgement written before acknowledgements carried the operator (0.251.0) names none\n // even when its admitted request does. The request comparator has already held the candidate\n // to that request, so a legacy record matches any candidate operator; a record that names one\n // must name the same one.\n if (existing.operator !== undefined && existing.operator !== candidate.operator) {\n throw new Error(\n `cancelRun: operation '${candidate.operationId}' conflicts with its acknowledgement ` +\n `(operator '${existing.operator}' != '${candidate.operator}')`,\n )\n }\n}\n\nfunction isRunCancelRequest(value: Partial<RunCancelRequest>): value is RunCancelRequest {\n return (\n typeof value.operationId === 'string' &&\n value.operationId.length > 0 &&\n typeof value.at === 'string' &&\n typeof value.source === 'string' &&\n (value.deadlineMs === undefined ||\n (Number.isFinite(value.deadlineMs) && value.deadlineMs >= 0)) &&\n (value.reason === undefined || typeof value.reason === 'string') &&\n (value.operator === undefined || typeof value.operator === 'string')\n )\n}\n\nfunction isWorkerCancelRequest(value: Partial<WorkerCancelRequest>): value is WorkerCancelRequest {\n return (\n typeof value.operationId === 'string' &&\n value.operationId.length > 0 &&\n typeof value.at === 'string' &&\n typeof value.source === 'string' &&\n typeof value.worker === 'string' &&\n value.worker.length > 0 &&\n (value.reason === undefined || typeof value.reason === 'string')\n )\n}\n\nfunction appendWorkerControlEvent(\n eventDir: string,\n label: string,\n event: Record<string, unknown>,\n): void {\n try {\n mkdirSync(supervisorWorkersDir(eventDir), { recursive: true })\n appendFileSync(\n workerControlLogFile(eventDir, label),\n `${JSON.stringify({ at: new Date().toISOString(), label, ...event })}\\n`,\n 'utf8',\n )\n } catch {\n // Control logging is best-effort; the inbox write above is the durable part.\n }\n}\n\nfunction workerSteerRequestDigest(value: {\n readonly operationId: string\n readonly worker: string\n readonly message: string\n readonly source: string\n readonly interrupt: boolean\n}): Sha256Digest {\n return canonicalCandidateDigest({ kind: 'worker-steer-request.v1', ...value })\n}\n\nfunction operationFileHash(operationId: string): string {\n const id = operationId.trim()\n if (!id) throw new Error('steer operationId is empty')\n return createHash('sha256').update(id).digest('hex')\n}\n\nfunction admitSteerRequest(\n file: string,\n request: WorkerSteerRequest,\n): { readonly request: WorkerSteerRequest; readonly replayed: boolean } {\n const existing = readWorkerSteerRequestFile(file)\n if (existing !== undefined) {\n assertSameSteerRequest(existing, request)\n return { request: existing, replayed: true }\n }\n if (publishExclusiveDurableFile(file, `${JSON.stringify(request, null, 2)}\\n`)) {\n return { request, replayed: false }\n }\n const winner = readWorkerSteerRequestFile(file)\n if (winner === undefined) {\n throw new Error('steer request publication lost its winner')\n }\n assertSameSteerRequest(winner, request)\n return { request: winner, replayed: true }\n}\n\nfunction readWorkerSteerRequest(\n eventDir: string,\n operationId: string,\n): WorkerSteerRequest | undefined {\n const file = workerSteerRequestFile(eventDir, operationId)\n assertNoSymlinkDescendant(eventDir, file, 'steer request')\n const request = readWorkerSteerRequestFile(file)\n if (request !== undefined && request.operationId !== operationId) {\n throw new Error('steer request file belongs to another operation')\n }\n return request\n}\n\nfunction readWorkerSteerRequestFile(file: string): WorkerSteerRequest | undefined {\n if (!existsSync(file)) return undefined\n return parseWorkerSteerRequest(JSON.parse(readFileSync(file, 'utf8')))\n}\n\nfunction parseWorkerSteerRequest(value: unknown): WorkerSteerRequest {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('steer request is malformed')\n }\n const request = value as Partial<WorkerSteerRequest>\n if (\n request.schemaVersion !== 1 ||\n typeof request.operationId !== 'string' ||\n request.operationId.length === 0 ||\n typeof request.requestDigest !== 'string' ||\n typeof request.at !== 'string' ||\n typeof request.source !== 'string' ||\n request.source.length === 0 ||\n typeof request.worker !== 'string' ||\n request.worker.length === 0 ||\n typeof request.message !== 'string' ||\n request.message.trim().length === 0 ||\n typeof request.interrupt !== 'boolean'\n ) {\n throw new Error('steer request is malformed')\n }\n const exact = request as WorkerSteerRequest\n const expected = workerSteerRequestDigest({\n operationId: exact.operationId,\n worker: exact.worker,\n message: exact.message,\n source: exact.source,\n interrupt: exact.interrupt,\n })\n if (exact.requestDigest !== expected) throw new Error('steer request digest does not match')\n return exact\n}\n\nfunction parseWorkerSteerAcknowledgement(value: unknown): WorkerSteerAcknowledgement {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('steer acknowledgement is malformed')\n }\n const record = value as Partial<WorkerSteerAcknowledgement>\n if (\n record.schemaVersion !== 1 ||\n typeof record.operationId !== 'string' ||\n record.operationId.length === 0 ||\n typeof record.requestDigest !== 'string' ||\n typeof record.worker !== 'string' ||\n record.worker.length === 0 ||\n (record.effect !== 'unknown' &&\n record.effect !== 'delivered' &&\n record.effect !== 'not_live' &&\n record.effect !== 'unsupported' &&\n record.effect !== 'refused') ||\n typeof record.requestedAt !== 'string' ||\n typeof record.observedAt !== 'string' ||\n typeof record.detail !== 'string'\n ) {\n throw new Error('steer acknowledgement is malformed')\n }\n return record as WorkerSteerAcknowledgement\n}\n\nfunction assertSameSteerRequest(existing: WorkerSteerRequest, candidate: WorkerSteerRequest): void {\n if (existing.operationId !== candidate.operationId) {\n throw new Error('steer operation file collision')\n }\n if (existing.requestDigest !== candidate.requestDigest) {\n throw new Error(\n `writeWorkerSteer: operation '${candidate.operationId}' conflicts with its admitted request`,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqNA,SAAgB,mBAAmB,SAAyB;CAC1D,OAAO,KAAK,QAAQ,OAAO,GAAG,UAAU,YAAY;AACtD;;AAGA,SAAgB,iBAAiB,SAAiB,IAAoB;CACpE,OAAO,KAAK,mBAAmB,OAAO,GAAG,EAAE;AAC7C;;;;;;AAOA,SAAgB,uBAAuB,SAAiB,IAAoB;CAC1E,OAAO,KAAK,yBAAyB,OAAO,GAAG,EAAE;AACnD;;;;;AAMA,SAAgB,yBAAyB,SAAyB;CAChE,OAAO,KAAK,QAAQ,OAAO,GAAG,UAAU,YAAY;AACtD;;AAGA,SAAgB,eAAe,OAAuB;CACpD,MAAM,OAAO,MAAM,QAAQ,oBAAoB,GAAG;CAClD,OAAO,KAAK,SAAS,IAAI,OAAO;AAClC;;AAGA,SAAgB,qBAAqB,UAA0B;CAC7D,OAAO,KAAK,UAAU,SAAS;AACjC;;AAGA,SAAgB,gBAAgB,SAAiB,cAAsB,QAAwB;CAC7F,OAAO,4BAA4B,iBAAiB,SAAS,YAAY,GAAG,MAAM;AACpF;;AAGA,SAAgB,4BAA4B,UAAkB,QAAwB;CACpF,OAAO,KAAK,qBAAqB,QAAQ,GAAG,GAAG,eAAe,MAAM,EAAE,cAAc;AACtF;;;;;;AAOA,SAAgB,qBAAqB,UAAkB,QAAwB;CAC7E,O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