@tangle-network/agent-runtime 3.0.43 → 4.0.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-CiUbW1QE.d.ts → activation-B49A14V5.d.ts} +2 -2
- package/dist/{activation-1YUy4GWu.js → activation-BiQYCayd.js} +2 -2
- package/dist/{activation-1YUy4GWu.js.map → activation-BiQYCayd.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +4 -4
- package/dist/{coordination-manager-DXOwLu9T.js → coordination-manager-C-ZoeZ73.js} +6 -6
- package/dist/{coordination-manager-DXOwLu9T.js.map → coordination-manager-C-ZoeZ73.js.map} +1 -1
- package/dist/{coordination-map-routing-2_hUlTnz.js → coordination-map-routing-SnsZp287.js} +2 -2
- package/dist/{coordination-map-routing-2_hUlTnz.js.map → coordination-map-routing-SnsZp287.js.map} +1 -1
- package/dist/{delegate-CAvTMCk0.js → delegate-d9HcOFC5.js} +2 -2
- package/dist/{delegate-CAvTMCk0.js.map → delegate-d9HcOFC5.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +7 -7
- package/dist/{graph-C7Xthj-4.js → graph-C_Z0Ua10.js} +6 -6
- package/dist/{graph-C7Xthj-4.js.map → graph-C_Z0Ua10.js.map} +1 -1
- package/dist/{graph-registry-EGeo_moB.js → graph-registry-BU7pcrUW.js} +1 -1
- package/dist/{graph-registry-BoaUV5g8.js → graph-registry-CI1o16DH.js} +3 -3
- package/dist/{graph-registry-BoaUV5g8.js.map → graph-registry-CI1o16DH.js.map} +1 -1
- package/dist/{improve-BZpoezFh.js → improve-B4v4S8jY.js} +7 -7
- package/dist/{improve-BZpoezFh.js.map → improve-B4v4S8jY.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +5 -5
- package/dist/{jsonl-file-CbxMVnUj.js → jsonl-file-CvPuwM0a.js} +5 -2
- package/dist/jsonl-file-CvPuwM0a.js.map +1 -0
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +12 -12
- package/dist/{loop-runner-Dmjf2IY6.d.ts → loop-runner-DKvA0JJr.d.ts} +2 -2
- package/dist/{loop-runner-BchibTTn.js → loop-runner-DMZkwlND.js} +2 -2
- package/dist/{loop-runner-BchibTTn.js.map → loop-runner-DMZkwlND.js.map} +1 -1
- 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 +1 -1
- package/dist/mcp/index.js +5 -5
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-BtDnk11d.js → provision-supervisor-Cjs4SQ9Q.js} +5 -5
- package/dist/{provision-supervisor-BtDnk11d.js.map → provision-supervisor-Cjs4SQ9Q.js.map} +1 -1
- package/dist/{run-cancellation-DEW04dun.js → run-cancellation-CGgk54Md.js} +3 -3
- package/dist/{run-cancellation-DEW04dun.js.map → run-cancellation-CGgk54Md.js.map} +1 -1
- package/dist/{runtime-CKoChP6L.js → runtime-BmxmsaNz.js} +15 -15
- package/dist/{runtime-CKoChP6L.js.map → runtime-BmxmsaNz.js.map} +1 -1
- package/dist/{scope-Bg1uCsPR.js → scope-CJ7xtrs8.js} +127 -69
- package/dist/scope-CJ7xtrs8.js.map +1 -0
- package/dist/{search-executor-CJ5y2-b8.js → search-executor-DSB6XAl1.js} +3 -3
- package/dist/{search-executor-CJ5y2-b8.js.map → search-executor-DSB6XAl1.js.map} +1 -1
- package/dist/{server-zdmmyP7r.js → server-FWT2Nt_w.js} +3 -3
- package/dist/{server-zdmmyP7r.js.map → server-FWT2Nt_w.js.map} +1 -1
- package/dist/{structural-rollout-CH9b7K9B.js → structural-rollout-Bl23HSOd.js} +3 -3
- package/dist/{structural-rollout-CH9b7K9B.js.map → structural-rollout-Bl23HSOd.js.map} +1 -1
- package/dist/{supervise-472pyfgQ.js → supervise-MAzd0hOk.js} +93 -41
- package/dist/supervise-MAzd0hOk.js.map +1 -0
- package/dist/{supervision-discovery-CD350Iar.js → supervision-discovery-6EtvKCsU.js} +3 -3
- package/dist/{supervision-discovery-CD350Iar.js.map → supervision-discovery-6EtvKCsU.js.map} +1 -1
- package/dist/{supervisor-BDOWzyCC.js → supervisor-CwANBb9-.js} +10 -3
- package/dist/supervisor-CwANBb9-.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{top-web-CNTJBqFy.js → top-web-CZP3RRhD.js} +5 -5
- package/dist/{top-web-CNTJBqFy.js.map → top-web-CZP3RRhD.js.map} +1 -1
- package/dist/tui/bin.js +3 -3
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-tG_tps7N.d.ts → types-ooyUaxq_.d.ts} +18 -3
- package/package.json +2 -2
- package/dist/jsonl-file-CbxMVnUj.js.map +0 -1
- package/dist/scope-Bg1uCsPR.js.map +0 -1
- package/dist/supervise-472pyfgQ.js.map +0 -1
- package/dist/supervisor-BDOWzyCC.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, l as RetainedInteractiveBindingError, m as ValidationError, r as BackendTransportError, u as RetainedRunAdmissionError } from "./errors-AzSuGI23.js";
|
|
2
2
|
import { $ as isAsyncIterable, Ct as boundedChildDeadlineAt, Dt as teardownExecutor, Et as singleFlightTeardown, F as deepFreezeCandidate, G as chargedTokens, H as abortError, K as cloneSpend, St as armDeadlineTimer, U as addSpend, W as addTokenUsage, X as fnv1a32Hex, Y as errorMessage, Z as hasCompleteCacheBreakdown, a as verifyAgentCandidateWorkspaceArtifacts, at as sleep, dt as zeroSpend, ft as zeroTokenUsage, g as workspaceLimits, gt as withBudgetResources, h as verifyAgentCandidateWorkspaceArchive, ht as resourceTelemetry, i as readAgentCandidateWorkspaceArtifactFiles, j as verifiedArtifactChunks, k as verifyWorkspaceSnapshotArtifacts, m as safeArchivePath, mt as assertResources, o as verifyAgentCandidateWorkspaceTree, pt as addResourceSpend, q as cloneTokenUsage, tt as promptCacheTokenClasses, vt as CHILD_DEADLINE_REASON, wt as checkInIdleMs, z as sha256Bytes$1 } from "./workspace-streams-8ALHaZzx.js";
|
|
3
|
-
import { _ as errorText, a as readCommittedJsonLines, b as resolveRedactor, c as appendCommittedJsonLine, d as detachedSnapshot, f as shareParsedStrings, g as errorProperty, l as sha256, m as errMessage, p as causeChain, r as prepareJsonlAppend, s as withJsonlFileLock, t as isNoEntError, v as defaultRedactor } from "./jsonl-file-
|
|
3
|
+
import { _ as errorText, a as readCommittedJsonLines, b as resolveRedactor, c as appendCommittedJsonLine, d as detachedSnapshot, f as shareParsedStrings, g as errorProperty, l as sha256, m as errMessage, p as causeChain, r as prepareJsonlAppend, s as withJsonlFileLock, t as isNoEntError, v as defaultRedactor } from "./jsonl-file-CvPuwM0a.js";
|
|
4
4
|
import { t as assertExecutableAgentProfile } from "./model-policy-JOcg3NRs.js";
|
|
5
5
|
import { a as writeAtomicDurableFile, n as assertNoSymlinkDescendant, o as captureRunWriteContext, r as publishExclusiveDurableFile, s as fenceRunWrite, t as appendDurableFile } from "./durable-file-DstVeHcj.js";
|
|
6
6
|
import { a as withPursuitContext, i as notifyRuntimeHookEvent } from "./runtime-hooks-CsW2pfFk.js";
|
|
@@ -2473,6 +2473,7 @@ const PLATFORM_FAILURE_CODES = new Set([
|
|
|
2473
2473
|
"provider_quota_exceeded",
|
|
2474
2474
|
"provider_quota_exhausted",
|
|
2475
2475
|
"buffer.overflow",
|
|
2476
|
+
"EXECUTION_INTERRUPTED",
|
|
2476
2477
|
"TIMEOUT",
|
|
2477
2478
|
"ECONNRESET",
|
|
2478
2479
|
"ECONNREFUSED",
|
|
@@ -2483,7 +2484,6 @@ const PLATFORM_FAILURE_CODES = new Set([
|
|
|
2483
2484
|
const PLATFORM_FAILURE_MESSAGES = [
|
|
2484
2485
|
/^terminated$/u,
|
|
2485
2486
|
/Execution exceeded its time limit/u,
|
|
2486
|
-
/Execution interrupted: the agent runtime restarted/u,
|
|
2487
2487
|
/Platform key[- ]verification/u,
|
|
2488
2488
|
/Platform key delegation failed/u,
|
|
2489
2489
|
/Bad Gateway/iu,
|
|
@@ -2811,25 +2811,31 @@ const MAX_RESET_HOLD_MS = 216e5;
|
|
|
2811
2811
|
/** How often a refusal whose reset is beyond {@link MAX_RESET_HOLD_MS} is probed again. */
|
|
2812
2812
|
const FAR_RESET_PROBE_MS = 36e5;
|
|
2813
2813
|
/**
|
|
2814
|
-
* When a refusal says its quota resets, as epoch ms
|
|
2815
|
-
*
|
|
2816
|
-
*
|
|
2817
|
-
*
|
|
2818
|
-
* the last refusal came at 22:18Z against `reset at 2026-10-19 06:18:14`, which is 22:18:14Z at
|
|
2819
|
-
* +08:00. A time with its own zone is read as written. A time in the past is no reset time: the
|
|
2820
|
-
* caller keeps its doubling pause. A time more than MAX_RESET_HOLD_MS ahead is held for only
|
|
2821
|
-
* FAR_RESET_PROBE_MS at a time, so a misread zone cannot hold a seat for a day, yet the spent seat
|
|
2822
|
-
* is not asked again every 5 minutes: on magnetar-rust-20261019c a reset beyond 6 h drew about 12
|
|
2823
|
-
* attempts an hour against the refusing seat.
|
|
2814
|
+
* When a capacity refusal says its quota resets, as epoch ms: the `resetAt` field (ISO string or
|
|
2815
|
+
* epoch ms) on the error or a cause, as agent-provider-tangle's `TangleCredentialCapacityError`
|
|
2816
|
+
* carries it. Text is never read: zro-game-20261104b's children re-probed every 183 s against a
|
|
2817
|
+
* seat whose structured reset was 2026-11-10T12:00Z, because only the message was parsed.
|
|
2824
2818
|
*/
|
|
2825
|
-
function
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2819
|
+
function reportedResetAt(error) {
|
|
2820
|
+
for (const cause of causeChain(error)) {
|
|
2821
|
+
let value;
|
|
2822
|
+
try {
|
|
2823
|
+
value = Reflect.get(cause, "resetAt");
|
|
2824
|
+
} catch {
|
|
2825
|
+
continue;
|
|
2826
|
+
}
|
|
2827
|
+
const at = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : NaN;
|
|
2828
|
+
if (Number.isFinite(at)) return at;
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
/**
|
|
2832
|
+
* Until when a reported reset holds a pause, or `undefined` for none (absent or past: the caller
|
|
2833
|
+
* keeps its doubling pause). A reset more than MAX_RESET_HOLD_MS ahead is held FAR_RESET_PROBE_MS
|
|
2834
|
+
* at a time; on magnetar-rust-20261019c a far reset drew about 12 attempts an hour.
|
|
2835
|
+
*/
|
|
2836
|
+
function unavailableResumeAt(resetAt, nowMs) {
|
|
2837
|
+
if (resetAt === void 0 || resetAt <= nowMs) return void 0;
|
|
2838
|
+
return resetAt - nowMs > MAX_RESET_HOLD_MS ? nowMs + FAR_RESET_PROBE_MS : resetAt;
|
|
2833
2839
|
}
|
|
2834
2840
|
/**
|
|
2835
2841
|
* Spread a wait over `[ms / 2, ms]`. Every driver a Platform restart cut off fails within the same
|
|
@@ -3774,12 +3780,17 @@ function providerAttemptEvidence(model) {
|
|
|
3774
3780
|
});
|
|
3775
3781
|
}
|
|
3776
3782
|
// src/runtime/supervise/seat-chain.ts
|
|
3777
|
-
|
|
3783
|
+
/** How often a pause with no known reset asks again, the account cache's cadence. */
|
|
3784
|
+
const SEAT_RECHECK_MS = 12e4;
|
|
3785
|
+
/** No seat can start before `resumeAt`: the chain is exhausted, or `detail` says why not. */
|
|
3786
|
+
var SeatPauseError = class extends Error {
|
|
3778
3787
|
resumeAt;
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3788
|
+
detail;
|
|
3789
|
+
constructor(resumeAt, detail) {
|
|
3790
|
+
super(`${detail ?? "authored subscription seat chain exhausted"}; resume at ${resumeAt}`);
|
|
3791
|
+
this.name = "SeatPauseError";
|
|
3782
3792
|
this.resumeAt = resumeAt;
|
|
3793
|
+
this.detail = detail;
|
|
3783
3794
|
}
|
|
3784
3795
|
};
|
|
3785
3796
|
/** One logical node's durable chain. The spawn journal is the sole transition authority. */
|
|
@@ -3895,8 +3906,8 @@ var SeatChain = class {
|
|
|
3895
3906
|
}
|
|
3896
3907
|
return active;
|
|
3897
3908
|
}
|
|
3898
|
-
const recheckAt = Math.max(earliestReset ?? 0, this.now() +
|
|
3899
|
-
throw new
|
|
3909
|
+
const recheckAt = Math.max(earliestReset ?? 0, this.now() + SEAT_RECHECK_MS);
|
|
3910
|
+
throw new SeatPauseError(new Date(recheckAt).toISOString());
|
|
3900
3911
|
}
|
|
3901
3912
|
async close(reason) {
|
|
3902
3913
|
const events = (await this.journal.loadTree(this.rootId) ?? []).filter((event) => event.kind === "seat-segment" && event.id === this.nodeId);
|
|
@@ -8602,6 +8613,7 @@ const outsideKinds = /* @__PURE__ */ new Set([
|
|
|
8602
8613
|
"environment-teardown",
|
|
8603
8614
|
"environment-terminal",
|
|
8604
8615
|
"workspace-checkpoint-requested",
|
|
8616
|
+
"workspace-checkpoint-refused",
|
|
8605
8617
|
"workspace-checkpoint",
|
|
8606
8618
|
"workspace-checkpoint-fork-requested",
|
|
8607
8619
|
"workspace-checkpoint-fork-ready",
|
|
@@ -9062,16 +9074,17 @@ function pendingCheckpoints(events, state) {
|
|
|
9062
9074
|
// src/runtime/supervise/retained-owner-checkpoint-capture.ts
|
|
9063
9075
|
/**
|
|
9064
9076
|
* Delete checkpoints, each only after its files are captured into the run's content-addressed
|
|
9065
|
-
* store; a checkpoint no capture holds is kept, and the cleanup record says why.
|
|
9077
|
+
* store; a checkpoint no capture holds is kept, and the cleanup record says why. `uncapturable`
|
|
9078
|
+
* deletes one anyway when no capture port exists: the record then names no digest. Only the
|
|
9066
9079
|
* source-scoped handle can fork a checkpoint and attest its deletion, including after its source
|
|
9067
9080
|
* is lost. `parent` cancels the captures (the owner's scope during rotation); each provider
|
|
9068
9081
|
* operation also has its own bound.
|
|
9069
9082
|
*/
|
|
9070
|
-
async function cleanCheckpoints(state, branching, checkpoints, events, parent) {
|
|
9083
|
+
async function cleanCheckpoints(state, branching, checkpoints, events, parent, uncapturable = false) {
|
|
9071
9084
|
const unconfirmed = [];
|
|
9072
9085
|
const refused = [];
|
|
9073
9086
|
for (const event of checkpoints) {
|
|
9074
|
-
const captured = await captureBeforeCleanup(state, branching, event, events, parent);
|
|
9087
|
+
const captured = await captureBeforeCleanup(state, branching, event, events, parent, uncapturable);
|
|
9075
9088
|
if ("reason" in captured) {
|
|
9076
9089
|
state.captureRefused ??= /* @__PURE__ */ new Set();
|
|
9077
9090
|
state.captureRefused.add(event.checkpoint.checkpointId);
|
|
@@ -9115,7 +9128,7 @@ async function cleanCheckpoints(state, branching, checkpoints, events, parent) {
|
|
|
9115
9128
|
environmentId: event.environmentId,
|
|
9116
9129
|
checkpointId: event.checkpoint.checkpointId,
|
|
9117
9130
|
confirmed,
|
|
9118
|
-
capturedDigest: captured.digest,
|
|
9131
|
+
...captured.digest === void 0 ? {} : { capturedDigest: captured.digest },
|
|
9119
9132
|
seq: state.nextSequence(),
|
|
9120
9133
|
at: new Date(state.args.now()).toISOString()
|
|
9121
9134
|
});
|
|
@@ -9133,7 +9146,7 @@ async function cleanCheckpoints(state, branching, checkpoints, events, parent) {
|
|
|
9133
9146
|
* destroyed once the capture is journaled, so neither a failure nor a crash leaves it running
|
|
9134
9147
|
* unrecorded.
|
|
9135
9148
|
*/
|
|
9136
|
-
async function captureBeforeCleanup(state, branching, event, events, parent) {
|
|
9149
|
+
async function captureBeforeCleanup(state, branching, event, events, parent, uncapturable = false) {
|
|
9137
9150
|
const { args } = state;
|
|
9138
9151
|
const checkpointId = event.checkpoint.checkpointId;
|
|
9139
9152
|
const recorded = events.find((prior) => prior.kind === "workspace-checkpoint-capture" && prior.id === args.nodeId && prior.provider === event.provider && prior.environmentId === event.environmentId && prior.checkpointId === checkpointId);
|
|
@@ -9144,7 +9157,7 @@ async function captureBeforeCleanup(state, branching, event, events, parent) {
|
|
|
9144
9157
|
needsSource
|
|
9145
9158
|
});
|
|
9146
9159
|
const capture = state.checkpointCapture;
|
|
9147
|
-
if (capture?.port.captureCheckpoint === void 0) return refuse("no checkpoint capture: the owner backend has no captureCheckpoint", false);
|
|
9160
|
+
if (capture?.port.captureCheckpoint === void 0) return uncapturable ? {} : refuse("no checkpoint capture: the owner backend has no captureCheckpoint", false);
|
|
9148
9161
|
const provider = state.provider;
|
|
9149
9162
|
if (provider?.get === void 0) return refuse("the provider cannot reconstruct a fork of the checkpoint", false);
|
|
9150
9163
|
const get = provider.get.bind(provider);
|
|
@@ -9339,8 +9352,8 @@ function scopeRetainedOwnerJournalRoot(scope) {
|
|
|
9339
9352
|
}
|
|
9340
9353
|
/**
|
|
9341
9354
|
* Bind cleanup before replay can return an already accepted owner result. `checkpointCapture` is
|
|
9342
|
-
* where each checkpoint's files are stored before the checkpoint is deleted; without it,
|
|
9343
|
-
* checkpoint of this owner is deleted.
|
|
9355
|
+
* where each checkpoint's files are stored before the checkpoint is deleted; without it, a
|
|
9356
|
+
* checkpoint of this owner is deleted only when a provider refuses a newer one.
|
|
9344
9357
|
*/
|
|
9345
9358
|
function bindScopeRetainedOwnerProvider(scope, provider, checkpointCapture) {
|
|
9346
9359
|
const state = owners.get(scope);
|
|
@@ -9413,6 +9426,23 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
9413
9426
|
state.checkpointsUnavailable = `environment ${environment.id} offers no durable checkpoint`;
|
|
9414
9427
|
return;
|
|
9415
9428
|
}
|
|
9429
|
+
const requestOne = () => requestCheckpoint(scope, state, provider.name, environment, branching, source, signal);
|
|
9430
|
+
if (!await requestOne() && (!await deleteOldestUncapturable(state, branching, environment.id, signal) || !await requestOne())) return;
|
|
9431
|
+
const events = await args.journal.loadTree(args.rootId) ?? [];
|
|
9432
|
+
const owned = pendingCheckpoints(events, state).filter((event) => event.environmentId === environment.id && state.captureRefused?.has(event.checkpoint.checkpointId) !== true);
|
|
9433
|
+
const rotation = new AbortController();
|
|
9434
|
+
state.rotationCaptures = rotation;
|
|
9435
|
+
const timer = setTimeout(() => rotation.abort(/* @__PURE__ */ new Error(`the rotation's ${WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS} ms for checkpoint captures ran out; checkpoint kept`)), WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS);
|
|
9436
|
+
try {
|
|
9437
|
+
await cleanCheckpoints(state, branching, owned.slice(0, -2), events, AbortSignal.any([scope.signal, rotation.signal]));
|
|
9438
|
+
} finally {
|
|
9439
|
+
clearTimeout(timer);
|
|
9440
|
+
if (state.rotationCaptures === rotation) delete state.rotationCaptures;
|
|
9441
|
+
}
|
|
9442
|
+
}
|
|
9443
|
+
/** Ask for one checkpoint and journal the answer. True when the journal holds the checkpoint. */
|
|
9444
|
+
async function requestCheckpoint(scope, state, providerName, environment, branching, source, signal) {
|
|
9445
|
+
const { args } = state;
|
|
9416
9446
|
const seq = state.nextSequence();
|
|
9417
9447
|
const at = new Date(args.now()).toISOString();
|
|
9418
9448
|
const name = `owner-checkpoint-${seq}`;
|
|
@@ -9439,7 +9469,7 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
9439
9469
|
await args.journal.appendEvent(args.rootId, {
|
|
9440
9470
|
kind: "workspace-checkpoint-requested",
|
|
9441
9471
|
id: args.nodeId,
|
|
9442
|
-
provider:
|
|
9472
|
+
provider: providerName,
|
|
9443
9473
|
environmentId: environment.id,
|
|
9444
9474
|
request,
|
|
9445
9475
|
...marked ? { marker } : {},
|
|
@@ -9447,30 +9477,46 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
9447
9477
|
at
|
|
9448
9478
|
});
|
|
9449
9479
|
const result = await runAbortable(() => branching.checkpoint(request, { signal }), signal, "retained owner checkpoint timed out");
|
|
9450
|
-
if (result.status !== "created" && result.status !== "replayed")
|
|
9451
|
-
|
|
9480
|
+
if (result.status !== "created" && result.status !== "replayed") {
|
|
9481
|
+
await args.journal.appendEvent(args.rootId, {
|
|
9482
|
+
kind: "workspace-checkpoint-refused",
|
|
9483
|
+
id: args.nodeId,
|
|
9484
|
+
provider: providerName,
|
|
9485
|
+
environmentId: environment.id,
|
|
9486
|
+
idempotencyKey: request.idempotencyKey,
|
|
9487
|
+
message: errorText("message" in result ? result.message : result.status),
|
|
9488
|
+
seq: state.nextSequence(),
|
|
9489
|
+
at
|
|
9490
|
+
});
|
|
9491
|
+
return false;
|
|
9492
|
+
}
|
|
9493
|
+
if (!workspaceCheckpointResultMatchesRequest(request, result)) return false;
|
|
9452
9494
|
scope.signal.throwIfAborted();
|
|
9453
9495
|
await args.journal.appendEvent(args.rootId, {
|
|
9454
9496
|
kind: "workspace-checkpoint",
|
|
9455
9497
|
id: args.nodeId,
|
|
9456
|
-
provider:
|
|
9498
|
+
provider: providerName,
|
|
9457
9499
|
environmentId: environment.id,
|
|
9458
9500
|
checkpoint: result.checkpoint,
|
|
9459
9501
|
...marked ? { marker } : {},
|
|
9460
9502
|
seq: state.nextSequence(),
|
|
9461
9503
|
at
|
|
9462
9504
|
});
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9505
|
+
return true;
|
|
9506
|
+
}
|
|
9507
|
+
/**
|
|
9508
|
+
* Delete this environment's oldest checkpoint beyond {@link WORKSPACE_CHECKPOINTS_KEPT} when no
|
|
9509
|
+
* capture could ever hold its files, to make room for a newer one. Keeping them all stopped the
|
|
9510
|
+
* restore point instead: zro-game-20261104b's box stored 25 of its 61 requests, its plan's limit,
|
|
9511
|
+
* and its last restore point was 7 h old. A backend that captures deletes through its rotation.
|
|
9512
|
+
*/
|
|
9513
|
+
async function deleteOldestUncapturable(state, branching, environmentId, signal) {
|
|
9514
|
+
if (state.checkpointCapture?.port.captureCheckpoint !== void 0) return false;
|
|
9515
|
+
const events = await state.args.journal.loadTree(state.args.rootId) ?? [];
|
|
9516
|
+
const oldest = pendingCheckpoints(events, state).filter((event) => event.environmentId === environmentId).slice(0, -2).slice(0, 1);
|
|
9517
|
+
if (oldest.length === 0) return false;
|
|
9518
|
+
const { unconfirmed } = await cleanCheckpoints(state, branching, oldest, events, signal, true);
|
|
9519
|
+
return unconfirmed.length === 0;
|
|
9474
9520
|
}
|
|
9475
9521
|
/**
|
|
9476
9522
|
* The owner's workspace-capture journal writers. A turn's capture starting cuts short the
|
|
@@ -10955,27 +11001,28 @@ function scopeRetainedOwnerResourceReader(scope) {
|
|
|
10955
11001
|
}
|
|
10956
11002
|
// src/runtime/supervise/retained-owner-seat-switch.ts
|
|
10957
11003
|
/** A committed turn is the seat boundary. Keep its native home for a same-harness provider
|
|
10958
|
-
* continuation; only a provider/harness change needs a new environment
|
|
11004
|
+
* continuation; only a provider/harness change needs a new environment, and a checkpoint of the
|
|
11005
|
+
* old one, whose time it returns. */
|
|
10959
11006
|
async function prepareScopeRetainedOwnerSeatSwitch(scope, mode) {
|
|
10960
11007
|
const state = owners.get(scope);
|
|
10961
11008
|
if (!state?.acceptedRef || !state.acceptedConsumed) throw new ValidationError("seat switch requires a committed owner turn");
|
|
10962
11009
|
const accepted = state.acceptedRef;
|
|
10963
11010
|
const owned = await checkpointOwner(scope, state);
|
|
11011
|
+
if (mode === "same-environment") return void 0;
|
|
10964
11012
|
const acceptedIndex = owned.findIndex((event) => event.kind === "execution-result" && event.seq === accepted.seq && event.outRef === accepted.outRef);
|
|
10965
11013
|
if (acceptedIndex < 0) throw new ValidationError("seat switch has no committed result in its journal");
|
|
10966
11014
|
const source = owned.slice(0, acceptedIndex).reverse().find((event) => event.kind === "execution-admitted" && event.admission.phase === "environment");
|
|
10967
11015
|
const sourceEnvironmentId = source?.kind === "execution-admitted" && source.admission.phase === "environment" ? source.admission.environmentId : void 0;
|
|
10968
|
-
const
|
|
10969
|
-
|
|
10970
|
-
if (
|
|
10971
|
-
|
|
10972
|
-
state.
|
|
11016
|
+
const since = owned.slice(acceptedIndex + 1).reverse();
|
|
11017
|
+
const checkpoint = since.find((event) => event.kind === "workspace-checkpoint" && event.environmentId === sourceEnvironmentId);
|
|
11018
|
+
if (checkpoint?.kind !== "workspace-checkpoint") {
|
|
11019
|
+
const refusal = since.find((event) => event.kind === "workspace-checkpoint-refused");
|
|
11020
|
+
const why = state.checkpointsUnavailable ?? (refusal?.kind === "workspace-checkpoint-refused" ? refusal.message : "none was taken");
|
|
11021
|
+
throw new ValidationError(`no checkpoint of its committed source: ${why}`);
|
|
10973
11022
|
}
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
sourceEnvironmentId: checkpoint.environmentId
|
|
10978
|
-
};
|
|
11023
|
+
await retireCheckpointed(scope, state, owned, checkpoint, "seat changed");
|
|
11024
|
+
state.forceNewSession = true;
|
|
11025
|
+
return checkpoint.at;
|
|
10979
11026
|
}
|
|
10980
11027
|
/** An exhausted seat chain pauses its manager until `resumeAt` with no turn to run: on
|
|
10981
11028
|
* magnetar-rust-sandbox-20261031b (Runtime 3.0.5) a resume paused four managers until 11-04 with
|
|
@@ -16146,7 +16193,7 @@ var ScopeSpawner = class {
|
|
|
16146
16193
|
const { recovery, opts } = request;
|
|
16147
16194
|
const child = this.admit(request, reuse, ticket);
|
|
16148
16195
|
const { id, continuing } = child;
|
|
16149
|
-
const controller = this.armChildAbort(child, cleanup);
|
|
16196
|
+
const controller = this.armChildAbort(child, cleanup, permit);
|
|
16150
16197
|
const deferredOwner = {};
|
|
16151
16198
|
const workerTrace = args.workerTrace?.(args.parentId);
|
|
16152
16199
|
const { recoveryReady, markRecoveryReady } = recoveryReadyGate(recovery, budgetGranted);
|
|
@@ -16267,20 +16314,24 @@ var ScopeSpawner = class {
|
|
|
16267
16314
|
}
|
|
16268
16315
|
/**
|
|
16269
16316
|
* The child's abort chains off this scope's signal AND its own handle.abort() or bounded
|
|
16270
|
-
* deadline; aborting mid-acquire cascades into acquireSandbox's find-by-name reap.
|
|
16317
|
+
* deadline; aborting mid-acquire cascades into acquireSandbox's find-by-name reap. A live child's
|
|
16318
|
+
* time box counts from its grant, not its spawn: queue time is not its time (zro-game-20261104a
|
|
16319
|
+
* s15-s20 expired queued, execution-did-not-start). A recovered child keeps its journaled grant.
|
|
16271
16320
|
*/
|
|
16272
|
-
armChildAbort(child, cleanup) {
|
|
16321
|
+
armChildAbort(child, cleanup, permit) {
|
|
16273
16322
|
const { args, now } = this.deps;
|
|
16274
16323
|
const { id, childDeadlineAtMs } = child;
|
|
16275
16324
|
const controller = new AbortController();
|
|
16276
16325
|
cleanup.cascadeAbort = () => controller.abort(args.signal.reason);
|
|
16277
16326
|
if (args.signal.aborted) controller.abort(args.signal.reason);
|
|
16278
16327
|
else args.signal.addEventListener("abort", cleanup.cascadeAbort, { once: true });
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16328
|
+
const runDeadlineAtMs = args.depth === 0 ? args.pool.readout().deadlineMs : 0;
|
|
16329
|
+
let cleared = false;
|
|
16330
|
+
const arm = (deadlineAtMs) => {
|
|
16331
|
+
if (deadlineAtMs === void 0 || cleared) return;
|
|
16332
|
+
const timeBox = !(runDeadlineAtMs > 0 && deadlineAtMs >= runDeadlineAtMs);
|
|
16282
16333
|
let clearCheckIn;
|
|
16283
|
-
const clearTimer = armDeadlineTimer(Math.max(0,
|
|
16334
|
+
const clearTimer = armDeadlineTimer(Math.max(0, deadlineAtMs - now()), () => {
|
|
16284
16335
|
clearCheckIn = timeBox ? this.deps.checkInAtTimeBox(id, controller) : void 0;
|
|
16285
16336
|
if (clearCheckIn === void 0) controller.abort(CHILD_DEADLINE_REASON);
|
|
16286
16337
|
});
|
|
@@ -16288,6 +16339,13 @@ var ScopeSpawner = class {
|
|
|
16288
16339
|
clearTimer();
|
|
16289
16340
|
clearCheckIn?.();
|
|
16290
16341
|
};
|
|
16342
|
+
};
|
|
16343
|
+
if (child.recovery !== void 0 || child.opts.budget.deadlineMs === void 0) arm(childDeadlineAtMs);
|
|
16344
|
+
else {
|
|
16345
|
+
cleanup.clearChildDeadline = () => {
|
|
16346
|
+
cleared = true;
|
|
16347
|
+
};
|
|
16348
|
+
permit.ready.then(() => arm(boundedChildDeadlineAt(args.pool.readout().deadlineMs, child.opts.budget.deadlineMs, now())), () => void 0);
|
|
16291
16349
|
}
|
|
16292
16350
|
return controller;
|
|
16293
16351
|
}
|
|
@@ -16795,6 +16853,6 @@ async function recoverRetainedChildren(args, children, spawn, next) {
|
|
|
16795
16853
|
throw error;
|
|
16796
16854
|
}
|
|
16797
16855
|
}
|
|
16798
|
-
export { deriveNodeExecutionIdentity as $,
|
|
16856
|
+
export { deriveNodeExecutionIdentity as $, parseCodexUsageRecord as $i, persistHarnessTranscript as $n, DISPATCH_EXECUTION_CHANGED_CODE as $r, insideCursorNamespace as $t, nestedScopeSeamKey as A, spendFromUsageTotals as Ai, workerTraceEnv as An, recordRuntimeOwnedProviderAttemptStart as Ar, beginScopeRetainedOwnerDrive as At, beginScopeOwnerAttempt as B, extractTransportEventIdentity as Bi, flatOtelSpan as Bn, unknownExecutionBindingReceipt as Br, retainedOwnerWorkspaceRetentionSeamKey as Bt, writeWorkerSteerAcknowledgement as C, hashJson as Ci, nativeCopyDelayMs as Cn, finalizeRuntimeOwnedPendingExecutor as Cr, environmentReader as Ct, isTraceAnalysisStore as D, meterUsageEvent as Di, openSlotGroup as Dn, newExecutionAttemptId as Dr, prepareScopeRetainedOwnerTask as Dt, replaySpawnTree as E, createBudgetPool as Ei, createWorkerSlots as En, knownMaterializationReceipt as Er, consumeScopeRetainedOwnerResult as Et, recoverRetainedInteractiveRun as F, sandboxLeafOutputFromEvents as Fi, buildLoopOtelSpans as Fn, runtimeOwnedExecutorExecutionBinding as Fr, scopeRetainedOwnerRestorePoint as Ft, scopeOwnerExecutorNodeContext as G, extractLlmCallEvent as Gi, sanitizeKnowledgeReadinessReport as Gn, runtimeFlowAgent as Gr, materializeTreeView as Gt, noteScopeOwnerPlannedExecution as H, canonicalSandboxUsageMode as Hi, loopEventToOtelSpan as Hn, executableAgentProfileSnapshot as Hr, scopeRetainedOwnerJournalRoot as Ht, startRetainedInteractiveRun as I, sandboxOutputMarker as Ii, buildLoopSpanNodes as In, runtimeOwnedExecutorMaterialization as Ir, noteScopeRetainedOwnerCoordination as It, providerVisibleProfile as J, sameModelId as Ji, captureBoundHarnessTranscript as Jn, runtimeFailureCause as Jr, nestedDriverTreeRoot as Jt, coordinationMcpAlias as K, isSandboxTerminalEvent as Ki, sanitizeRuntimeStreamEvent as Kn, runtimeFlowBrain as Kr, attestNestedDriverTreeOwner as Kt, FileSpawnJournal as L, sandboxProgressEvents as Li, buildRuntimeEventOtelSpans as Ln, runtimeOwnedExecutorProviderEvidence as Lr, scopeRetainedOwnerCheckpointing as Lt, attachWorker as M, createSandboxToolPartState as Mi, createPropagatingTraceEmitter as Mn, recordRuntimeOwnedProviderIdentityConflict as Mr, scopeRetainedOwnerTurnEnded as Mt, readWorkerInteractiveBinding as N, mapSandboxEvent as Ni, mergeTraceEnv as Nn, recordRuntimeOwnedProviderModel as Nr, assertRetainedOwnerCoordinationRekey as Nt, parseWorkerToolTraceArtifact as O, newUsageTotals as Oi, resolveWorkerSlots as On, providerAttemptEvidence as Or, scopeRetainedOwnerPriorSpend as Ot, reconnectRetainedInteractiveRun as P, mapSandboxToolEvent as Pi, readTraceContextFromEnv as Pn, runtimeOwnedDriveHarnessProviderEvidence as Pr, reconcileScopeRetainedOwnerEnvironment as Pt, assertRecursiveReservationPolicy as Q, decodeHarnessUsage as Qi, harnessTranscriptUnavailable as Qn, settlementFailureCause as Qr, closesCursorSlot as Qt, appendSpawnEvents as R, terminalTextFromSandboxEvent as Ri, createOpenInferenceFileExporter as Rn, runtimeOwnedPendingExecutorMaterialization as Rr, bindScopeRetainedOwnerEnvironmentId as Rt, writeWorkerSteer as S, executorFailureInfra as Si, captureProviderWorkspaceSnapshot as Sn, authoredProfileDigest as Sr, scopeRetainedOwnerResourceReader as St, sumSpendFromEvents as T, isCredentialRefusal as Ti, workspaceCaptureReceipt as Tn, knownExecutionBindingReceipt as Tr, abandonScopeRetainedOwnerInvocation as Tt, recordScopeOwnerMaterialization as U, createSandboxTurnEventCollector as Ui, createRuntimeEventCollector as Un, executableAgentSpecSnapshot as Ur, loadSpawnForest as Ut, finalizeScopeOwnerMaterialization as V, assertSandboxServedModel as Vi, generateSpanId as Vn, unknownMaterializationReceipt as Vr, scopeRetainedOwnerContext as Vt, restoreScopeOwnerAcceptedExecution as W, createSandboxUsageLedger as Wi, createRuntimeStreamEventCollector as Wn, isRuntimeFlowBrain as Wr, ownedTreeRootSpawn as Wt, reenteredWorkers as X, sandboxTerminalUsageField as Xi, harnessTranscriptArtifact as Xn, runtimeFailureRemediationSchema as Xr, encodeResultBlob as Xt, runtimeGraphMetadataKey as Y, sandboxEventServedBackend as Yi, captureHarnessTranscript as Yn, runtimeFailureCauseSchema as Yr, FileResultBlobStore as Yt, settledToIteration as Z, sumSandboxUsage as Zi, harnessTranscriptFromLines as Zn, runtimeProviderCode as Zr, SpawnEventIndex as Zt, supervisorRunDir as _, TRACE_ROOT_SCHEMA as _i, destroyInteractiveEnvironment as _n, attestRuntimeOwnedDeferredExecutor as _r, startScopeRecoveries as _t, readRootStream as a, freezeControlRef as aa, registerRetainedExecutorPreparation as ai, reconnectRetainedRun as an, DEFAULT_STALL_AFTER_MS as ar, hasRetriableTeardowns as at, workerInboxFileFromEventDir as b, contentRef as bi, assertProviderWorkspaceRetentionPort as bn, attestRuntimeOwnedScopeOwner as br, prepareScopeRetainedOwnerSeatSwitch as bt, cancelWorker as c, RunCancellationReason as ca, UNAVAILABLE_CODES as ci, startRetainedRunInEnvironment as cn, readWorkerProgress as cr, recordScopeOwnerBarrenPause as ct, legacySupervisorRunsRoot as d, runAbortable as da, jitteredMs as di, offerInteractiveControl as dn, SEAT_RECHECK_MS as dr, registerNestedTeardownScope as dt, recordValue as ea, DISPATCH_NOT_ADMITTED_CODE as ei, verifyWorkspaceMarker as en, readHarnessTranscript as er, freeSlots as et, readWorkerCancelRequests as f, signalAbortError as fa, printedStatus as fi, prepareInteractiveDelegation as fn, SeatChain as fr, releaseHeldEnvironments as ft, safeWorkerFile as g, unavailableSignalOfFailure as gi, verifyObserverRecords as gn, subscriptionUsageLimitSignal as gr, settleManagerWork as gt, readWorkerSteerRequests as h, providerMessageText as ha, unavailableResumeAt as hi, observerRecordDigest as hn, seatExecutionProfile as hr, retryUnconfirmedTeardowns as ht, nodeStreamFile as i, exactSession as ia, isSchemaRejection as ii, mintRetainedIdentity as in, retainHarnessTranscript as ir, closeScopeAdmission as it, interactiveAdmissionSeamKey as j, assertValidBudget as ji, workerTraceHeaders as jn, recordRuntimeOwnedProviderDispatchNotStarted as jr, scopeRetainedOwnerSettled as jt, workerTraceAnalysisStore as k, spendFromUsageEvents as ki, WORKER_TRACE_PROPAGATION as kn, recordRuntimeOwnedDriveHarnessProviderEvidence as kr, scopeRetainedOwnerResult as kt, claimWorkerSteerDelivery as l, abortReason as la, UNAVAILABLE_STATUSES as li, retainedCreateMaterial as ln, isLiveNodeStatus as lr, recordScopeOwnerDriverAttempt as lt, readWorkerSteerAcknowledgement as m, promptOptionsFromAgentTurnInput as ma, unavailablePauseMs as mi, createFileObserverHooks as mn, authoredSeatStages as mr, releaseRetainedEnvironments as mt, ROOT_STREAM_FILE as n, assertEventBinding as na, TRANSPORT_ERROR_CODES as ni, stopRetainedNativeExecution as nn, readBoundHarnessSessions as nr, rollingDispatch as nt, readRootStreamReceipt as o, isTerminalSessionStatus as oa, retainedExecutorContext as oi, recoverRetainedRun as on, createActivityLog as or, meterRuntimeOwnedAccounting as ot, readWorkerCancellation as p, promptFromAgentTurnInput as pa, reportedResetAt as pi, FileObserverJournal as pn, SeatPauseError as pr, releaseManagerEnvironment as pt, coordinationProfileToolPrefix as q, notifySandboxEventObserver as qi, HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS as qn, reportedFailureCause as qr, driverRuntime as qt, createRootStreamSink as r, awaitAbortable$1 as ra, isProvisioningRefusal as ri, assertRetainedRunReplayMaterial as rn, resolveHarnessTranscriptCapture as rr, closeRetainedSlots as rt, appendWorkerControlEvent as s, sameControlCoordinates as sa, retainedExecutorSeamKey as si, startRetainedRun as sn, describeToolArgs as sr, meterRuntimeOwnedProviderAttempt as st, createScope as t, RetainedRunProviderContractError as ta, RetainedExecutionPendingError as ti, describeRetainedNativeStops as tn, HARNESS_TRANSCRIPT_READ_LIMITS as tr, queueOf as tt, legacySupervisorRunDir as u, linkAbort as ua, cappedDoublingMs as ui, acceptedInteractiveControl as un, isTerminalNodeStatus as ur, recordScopeOwnerPause as ut, supervisorRunsRoot as v, TRACE_SUMMARY_SCHEMA as vi, environmentGone as vn, attestRuntimeOwnedExecutor as vr, unconfirmedTeardowns as vt, prepareScopeResume as w, credentialCommandExit as wi, openNativeMirror as wn, inheritRuntimeOwnedExecutorAttestation as wr, resolveSpawnResourcePaths as wt, writeWorkerCancellation as x, executorFailure as xi, captureProviderLiveWorkspace as xn, authoredAgentIdentity as xr, releaseScopeRetainedOwnerForSeatPause as xt, workerCancellationsDir as y, contentAddress as yi, DEFAULT_NATIVE_CAPTURE_INTERVAL_MS as yn, attestRuntimeOwnedPendingExecutor as yr, waitForScopeChildren as yt, spawnJournalRecordEvents as z, canonicalStreamEventFromSandboxEvent as zi, createOtelExporter as zn, runtimeOwnedScopeOwnerRuntime as zr, bindScopeRetainedOwnerProvider as zt };
|
|
16799
16857
|
|
|
16800
|
-
//# sourceMappingURL=scope-
|
|
16858
|
+
//# sourceMappingURL=scope-CJ7xtrs8.js.map
|