@tangle-network/agent-runtime 3.0.42 → 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-C1_GUwX8.d.ts → activation-B49A14V5.d.ts} +2 -2
- package/dist/{activation-CiM6hSrn.js → activation-BiQYCayd.js} +2 -2
- package/dist/{activation-CiM6hSrn.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-_PcKOR-S.js → coordination-manager-C-ZoeZ73.js} +6 -6
- package/dist/{coordination-manager-_PcKOR-S.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--q1zCR-1.js → delegate-d9HcOFC5.js} +2 -2
- package/dist/{delegate--q1zCR-1.js.map → delegate-d9HcOFC5.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +7 -7
- package/dist/{graph-oFhKT5Ad.js → graph-C_Z0Ua10.js} +6 -6
- package/dist/{graph-oFhKT5Ad.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-DhTBR1p-.js → improve-B4v4S8jY.js} +7 -7
- package/dist/{improve-DhTBR1p-.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-DMBWRkx0.d.ts → loop-runner-DKvA0JJr.d.ts} +2 -2
- package/dist/{loop-runner-BmtOiAiq.js → loop-runner-DMZkwlND.js} +2 -2
- package/dist/{loop-runner-BmtOiAiq.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-wJp8ECNK.js → provision-supervisor-Cjs4SQ9Q.js} +5 -5
- package/dist/{provision-supervisor-wJp8ECNK.js.map → provision-supervisor-Cjs4SQ9Q.js.map} +1 -1
- package/dist/{run-cancellation-Xh0hv_aO.js → run-cancellation-CGgk54Md.js} +3 -3
- package/dist/{run-cancellation-Xh0hv_aO.js.map → run-cancellation-CGgk54Md.js.map} +1 -1
- package/dist/{runtime-BsXRlG8W.js → runtime-BmxmsaNz.js} +15 -15
- package/dist/{runtime-BsXRlG8W.js.map → runtime-BmxmsaNz.js.map} +1 -1
- package/dist/{scope-D04GkJ6P.js → scope-CJ7xtrs8.js} +134 -71
- package/dist/scope-CJ7xtrs8.js.map +1 -0
- package/dist/{search-executor-Dzhi0WRa.js → search-executor-DSB6XAl1.js} +3 -3
- package/dist/{search-executor-Dzhi0WRa.js.map → search-executor-DSB6XAl1.js.map} +1 -1
- package/dist/{server-WKv4YNcI.js → server-FWT2Nt_w.js} +3 -3
- package/dist/{server-WKv4YNcI.js.map → server-FWT2Nt_w.js.map} +1 -1
- package/dist/{structural-rollout-xXWwKM4G.js → structural-rollout-Bl23HSOd.js} +3 -3
- package/dist/{structural-rollout-xXWwKM4G.js.map → structural-rollout-Bl23HSOd.js.map} +1 -1
- package/dist/{supervise-BO9acmsB.js → supervise-MAzd0hOk.js} +110 -55
- package/dist/supervise-MAzd0hOk.js.map +1 -0
- package/dist/{supervision-discovery-CcTLSYff.js → supervision-discovery-6EtvKCsU.js} +3 -3
- package/dist/{supervision-discovery-CcTLSYff.js.map → supervision-discovery-6EtvKCsU.js.map} +1 -1
- package/dist/{supervisor-BQz8lkcd.js → supervisor-CwANBb9-.js} +53 -16
- 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-D-QEIh-x.js → top-web-CZP3RRhD.js} +5 -5
- package/dist/{top-web-D-QEIh-x.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-CRCOBzGj.d.ts → types-ooyUaxq_.d.ts} +21 -3
- package/package.json +2 -2
- package/dist/jsonl-file-CbxMVnUj.js.map +0 -1
- package/dist/scope-D04GkJ6P.js.map +0 -1
- package/dist/supervise-BO9acmsB.js.map +0 -1
- package/dist/supervisor-BQz8lkcd.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,
|
|
@@ -2762,9 +2762,14 @@ const UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([
|
|
|
2762
2762
|
*/
|
|
2763
2763
|
function unavailableSignalInText(text) {
|
|
2764
2764
|
for (const token of text.toLowerCase().matchAll(/[a-z_]+/gu)) if (UNAVAILABLE_CODES.has(token[0])) return token[0];
|
|
2765
|
-
const status = text
|
|
2766
|
-
return status !== void 0 && UNAVAILABLE_STATUSES.has(
|
|
2765
|
+
const status = printedStatus(text);
|
|
2766
|
+
return status !== void 0 && UNAVAILABLE_STATUSES.has(status) ? `http-${status}` : void 0;
|
|
2767
2767
|
}
|
|
2768
|
+
/** The HTTP status a harness printed in its `status code <n>` framing, if any. */
|
|
2769
|
+
const printedStatus = (text) => {
|
|
2770
|
+
const status = text.match(/\bstatus code (\d{3})\b/u)?.[1];
|
|
2771
|
+
return status === void 0 ? void 0 : Number(status);
|
|
2772
|
+
};
|
|
2768
2773
|
/**
|
|
2769
2774
|
* Sandbox's 409 `NO_HOST_FITS_SHAPE` for a shape that fits its host's ceiling: no exceeded
|
|
2770
2775
|
* dimension, only `its room is held placeable on <sku>`. It is sent by mistake for "no room now"
|
|
@@ -2806,25 +2811,31 @@ const MAX_RESET_HOLD_MS = 216e5;
|
|
|
2806
2811
|
/** How often a refusal whose reset is beyond {@link MAX_RESET_HOLD_MS} is probed again. */
|
|
2807
2812
|
const FAR_RESET_PROBE_MS = 36e5;
|
|
2808
2813
|
/**
|
|
2809
|
-
* When a refusal says its quota resets, as epoch ms
|
|
2810
|
-
*
|
|
2811
|
-
*
|
|
2812
|
-
*
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
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.
|
|
2818
|
+
*/
|
|
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.
|
|
2819
2835
|
*/
|
|
2820
|
-
function unavailableResumeAt(
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
const zone = match[3] ?? (/Usage limit reached for \d+ hour/u.test(text) ? "+08:00" : void 0);
|
|
2824
|
-
if (zone === void 0) return void 0;
|
|
2825
|
-
const at = Date.parse(`${match[1]}T${match[2]}${zone.length === 5 ? `${zone.slice(0, 3)}:${zone.slice(3)}` : zone}`);
|
|
2826
|
-
if (!Number.isFinite(at) || at <= nowMs) return void 0;
|
|
2827
|
-
return at - nowMs > MAX_RESET_HOLD_MS ? nowMs + FAR_RESET_PROBE_MS : at;
|
|
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;
|
|
2828
2839
|
}
|
|
2829
2840
|
/**
|
|
2830
2841
|
* Spread a wait over `[ms / 2, ms]`. Every driver a Platform restart cut off fails within the same
|
|
@@ -3769,12 +3780,17 @@ function providerAttemptEvidence(model) {
|
|
|
3769
3780
|
});
|
|
3770
3781
|
}
|
|
3771
3782
|
// src/runtime/supervise/seat-chain.ts
|
|
3772
|
-
|
|
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 {
|
|
3773
3787
|
resumeAt;
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3788
|
+
detail;
|
|
3789
|
+
constructor(resumeAt, detail) {
|
|
3790
|
+
super(`${detail ?? "authored subscription seat chain exhausted"}; resume at ${resumeAt}`);
|
|
3791
|
+
this.name = "SeatPauseError";
|
|
3777
3792
|
this.resumeAt = resumeAt;
|
|
3793
|
+
this.detail = detail;
|
|
3778
3794
|
}
|
|
3779
3795
|
};
|
|
3780
3796
|
/** One logical node's durable chain. The spawn journal is the sole transition authority. */
|
|
@@ -3890,8 +3906,8 @@ var SeatChain = class {
|
|
|
3890
3906
|
}
|
|
3891
3907
|
return active;
|
|
3892
3908
|
}
|
|
3893
|
-
const recheckAt = Math.max(earliestReset ?? 0, this.now() +
|
|
3894
|
-
throw new
|
|
3909
|
+
const recheckAt = Math.max(earliestReset ?? 0, this.now() + SEAT_RECHECK_MS);
|
|
3910
|
+
throw new SeatPauseError(new Date(recheckAt).toISOString());
|
|
3895
3911
|
}
|
|
3896
3912
|
async close(reason) {
|
|
3897
3913
|
const events = (await this.journal.loadTree(this.rootId) ?? []).filter((event) => event.kind === "seat-segment" && event.id === this.nodeId);
|
|
@@ -8597,6 +8613,7 @@ const outsideKinds = /* @__PURE__ */ new Set([
|
|
|
8597
8613
|
"environment-teardown",
|
|
8598
8614
|
"environment-terminal",
|
|
8599
8615
|
"workspace-checkpoint-requested",
|
|
8616
|
+
"workspace-checkpoint-refused",
|
|
8600
8617
|
"workspace-checkpoint",
|
|
8601
8618
|
"workspace-checkpoint-fork-requested",
|
|
8602
8619
|
"workspace-checkpoint-fork-ready",
|
|
@@ -9057,16 +9074,17 @@ function pendingCheckpoints(events, state) {
|
|
|
9057
9074
|
// src/runtime/supervise/retained-owner-checkpoint-capture.ts
|
|
9058
9075
|
/**
|
|
9059
9076
|
* Delete checkpoints, each only after its files are captured into the run's content-addressed
|
|
9060
|
-
* 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
|
|
9061
9079
|
* source-scoped handle can fork a checkpoint and attest its deletion, including after its source
|
|
9062
9080
|
* is lost. `parent` cancels the captures (the owner's scope during rotation); each provider
|
|
9063
9081
|
* operation also has its own bound.
|
|
9064
9082
|
*/
|
|
9065
|
-
async function cleanCheckpoints(state, branching, checkpoints, events, parent) {
|
|
9083
|
+
async function cleanCheckpoints(state, branching, checkpoints, events, parent, uncapturable = false) {
|
|
9066
9084
|
const unconfirmed = [];
|
|
9067
9085
|
const refused = [];
|
|
9068
9086
|
for (const event of checkpoints) {
|
|
9069
|
-
const captured = await captureBeforeCleanup(state, branching, event, events, parent);
|
|
9087
|
+
const captured = await captureBeforeCleanup(state, branching, event, events, parent, uncapturable);
|
|
9070
9088
|
if ("reason" in captured) {
|
|
9071
9089
|
state.captureRefused ??= /* @__PURE__ */ new Set();
|
|
9072
9090
|
state.captureRefused.add(event.checkpoint.checkpointId);
|
|
@@ -9110,7 +9128,7 @@ async function cleanCheckpoints(state, branching, checkpoints, events, parent) {
|
|
|
9110
9128
|
environmentId: event.environmentId,
|
|
9111
9129
|
checkpointId: event.checkpoint.checkpointId,
|
|
9112
9130
|
confirmed,
|
|
9113
|
-
capturedDigest: captured.digest,
|
|
9131
|
+
...captured.digest === void 0 ? {} : { capturedDigest: captured.digest },
|
|
9114
9132
|
seq: state.nextSequence(),
|
|
9115
9133
|
at: new Date(state.args.now()).toISOString()
|
|
9116
9134
|
});
|
|
@@ -9128,7 +9146,7 @@ async function cleanCheckpoints(state, branching, checkpoints, events, parent) {
|
|
|
9128
9146
|
* destroyed once the capture is journaled, so neither a failure nor a crash leaves it running
|
|
9129
9147
|
* unrecorded.
|
|
9130
9148
|
*/
|
|
9131
|
-
async function captureBeforeCleanup(state, branching, event, events, parent) {
|
|
9149
|
+
async function captureBeforeCleanup(state, branching, event, events, parent, uncapturable = false) {
|
|
9132
9150
|
const { args } = state;
|
|
9133
9151
|
const checkpointId = event.checkpoint.checkpointId;
|
|
9134
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);
|
|
@@ -9139,7 +9157,7 @@ async function captureBeforeCleanup(state, branching, event, events, parent) {
|
|
|
9139
9157
|
needsSource
|
|
9140
9158
|
});
|
|
9141
9159
|
const capture = state.checkpointCapture;
|
|
9142
|
-
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);
|
|
9143
9161
|
const provider = state.provider;
|
|
9144
9162
|
if (provider?.get === void 0) return refuse("the provider cannot reconstruct a fork of the checkpoint", false);
|
|
9145
9163
|
const get = provider.get.bind(provider);
|
|
@@ -9334,8 +9352,8 @@ function scopeRetainedOwnerJournalRoot(scope) {
|
|
|
9334
9352
|
}
|
|
9335
9353
|
/**
|
|
9336
9354
|
* Bind cleanup before replay can return an already accepted owner result. `checkpointCapture` is
|
|
9337
|
-
* where each checkpoint's files are stored before the checkpoint is deleted; without it,
|
|
9338
|
-
* 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.
|
|
9339
9357
|
*/
|
|
9340
9358
|
function bindScopeRetainedOwnerProvider(scope, provider, checkpointCapture) {
|
|
9341
9359
|
const state = owners.get(scope);
|
|
@@ -9408,6 +9426,23 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
9408
9426
|
state.checkpointsUnavailable = `environment ${environment.id} offers no durable checkpoint`;
|
|
9409
9427
|
return;
|
|
9410
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;
|
|
9411
9446
|
const seq = state.nextSequence();
|
|
9412
9447
|
const at = new Date(args.now()).toISOString();
|
|
9413
9448
|
const name = `owner-checkpoint-${seq}`;
|
|
@@ -9434,7 +9469,7 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
9434
9469
|
await args.journal.appendEvent(args.rootId, {
|
|
9435
9470
|
kind: "workspace-checkpoint-requested",
|
|
9436
9471
|
id: args.nodeId,
|
|
9437
|
-
provider:
|
|
9472
|
+
provider: providerName,
|
|
9438
9473
|
environmentId: environment.id,
|
|
9439
9474
|
request,
|
|
9440
9475
|
...marked ? { marker } : {},
|
|
@@ -9442,30 +9477,46 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
9442
9477
|
at
|
|
9443
9478
|
});
|
|
9444
9479
|
const result = await runAbortable(() => branching.checkpoint(request, { signal }), signal, "retained owner checkpoint timed out");
|
|
9445
|
-
if (result.status !== "created" && result.status !== "replayed")
|
|
9446
|
-
|
|
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;
|
|
9447
9494
|
scope.signal.throwIfAborted();
|
|
9448
9495
|
await args.journal.appendEvent(args.rootId, {
|
|
9449
9496
|
kind: "workspace-checkpoint",
|
|
9450
9497
|
id: args.nodeId,
|
|
9451
|
-
provider:
|
|
9498
|
+
provider: providerName,
|
|
9452
9499
|
environmentId: environment.id,
|
|
9453
9500
|
checkpoint: result.checkpoint,
|
|
9454
9501
|
...marked ? { marker } : {},
|
|
9455
9502
|
seq: state.nextSequence(),
|
|
9456
9503
|
at
|
|
9457
9504
|
});
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
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;
|
|
9469
9520
|
}
|
|
9470
9521
|
/**
|
|
9471
9522
|
* The owner's workspace-capture journal writers. A turn's capture starting cuts short the
|
|
@@ -10950,27 +11001,28 @@ function scopeRetainedOwnerResourceReader(scope) {
|
|
|
10950
11001
|
}
|
|
10951
11002
|
// src/runtime/supervise/retained-owner-seat-switch.ts
|
|
10952
11003
|
/** A committed turn is the seat boundary. Keep its native home for a same-harness provider
|
|
10953
|
-
* 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. */
|
|
10954
11006
|
async function prepareScopeRetainedOwnerSeatSwitch(scope, mode) {
|
|
10955
11007
|
const state = owners.get(scope);
|
|
10956
11008
|
if (!state?.acceptedRef || !state.acceptedConsumed) throw new ValidationError("seat switch requires a committed owner turn");
|
|
10957
11009
|
const accepted = state.acceptedRef;
|
|
10958
11010
|
const owned = await checkpointOwner(scope, state);
|
|
11011
|
+
if (mode === "same-environment") return void 0;
|
|
10959
11012
|
const acceptedIndex = owned.findIndex((event) => event.kind === "execution-result" && event.seq === accepted.seq && event.outRef === accepted.outRef);
|
|
10960
11013
|
if (acceptedIndex < 0) throw new ValidationError("seat switch has no committed result in its journal");
|
|
10961
11014
|
const source = owned.slice(0, acceptedIndex).reverse().find((event) => event.kind === "execution-admitted" && event.admission.phase === "environment");
|
|
10962
11015
|
const sourceEnvironmentId = source?.kind === "execution-admitted" && source.admission.phase === "environment" ? source.admission.environmentId : void 0;
|
|
10963
|
-
const
|
|
10964
|
-
|
|
10965
|
-
if (
|
|
10966
|
-
|
|
10967
|
-
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}`);
|
|
10968
11022
|
}
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
sourceEnvironmentId: checkpoint.environmentId
|
|
10973
|
-
};
|
|
11023
|
+
await retireCheckpointed(scope, state, owned, checkpoint, "seat changed");
|
|
11024
|
+
state.forceNewSession = true;
|
|
11025
|
+
return checkpoint.at;
|
|
10974
11026
|
}
|
|
10975
11027
|
/** An exhausted seat chain pauses its manager until `resumeAt` with no turn to run: on
|
|
10976
11028
|
* magnetar-rust-sandbox-20261031b (Runtime 3.0.5) a resume paused four managers until 11-04 with
|
|
@@ -16141,7 +16193,7 @@ var ScopeSpawner = class {
|
|
|
16141
16193
|
const { recovery, opts } = request;
|
|
16142
16194
|
const child = this.admit(request, reuse, ticket);
|
|
16143
16195
|
const { id, continuing } = child;
|
|
16144
|
-
const controller = this.armChildAbort(child, cleanup);
|
|
16196
|
+
const controller = this.armChildAbort(child, cleanup, permit);
|
|
16145
16197
|
const deferredOwner = {};
|
|
16146
16198
|
const workerTrace = args.workerTrace?.(args.parentId);
|
|
16147
16199
|
const { recoveryReady, markRecoveryReady } = recoveryReadyGate(recovery, budgetGranted);
|
|
@@ -16262,20 +16314,24 @@ var ScopeSpawner = class {
|
|
|
16262
16314
|
}
|
|
16263
16315
|
/**
|
|
16264
16316
|
* The child's abort chains off this scope's signal AND its own handle.abort() or bounded
|
|
16265
|
-
* 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.
|
|
16266
16320
|
*/
|
|
16267
|
-
armChildAbort(child, cleanup) {
|
|
16321
|
+
armChildAbort(child, cleanup, permit) {
|
|
16268
16322
|
const { args, now } = this.deps;
|
|
16269
16323
|
const { id, childDeadlineAtMs } = child;
|
|
16270
16324
|
const controller = new AbortController();
|
|
16271
16325
|
cleanup.cascadeAbort = () => controller.abort(args.signal.reason);
|
|
16272
16326
|
if (args.signal.aborted) controller.abort(args.signal.reason);
|
|
16273
16327
|
else args.signal.addEventListener("abort", cleanup.cascadeAbort, { once: true });
|
|
16274
|
-
|
|
16275
|
-
|
|
16276
|
-
|
|
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);
|
|
16277
16333
|
let clearCheckIn;
|
|
16278
|
-
const clearTimer = armDeadlineTimer(Math.max(0,
|
|
16334
|
+
const clearTimer = armDeadlineTimer(Math.max(0, deadlineAtMs - now()), () => {
|
|
16279
16335
|
clearCheckIn = timeBox ? this.deps.checkInAtTimeBox(id, controller) : void 0;
|
|
16280
16336
|
if (clearCheckIn === void 0) controller.abort(CHILD_DEADLINE_REASON);
|
|
16281
16337
|
});
|
|
@@ -16283,6 +16339,13 @@ var ScopeSpawner = class {
|
|
|
16283
16339
|
clearTimer();
|
|
16284
16340
|
clearCheckIn?.();
|
|
16285
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);
|
|
16286
16349
|
}
|
|
16287
16350
|
return controller;
|
|
16288
16351
|
}
|
|
@@ -16790,6 +16853,6 @@ async function recoverRetainedChildren(args, children, spawn, next) {
|
|
|
16790
16853
|
throw error;
|
|
16791
16854
|
}
|
|
16792
16855
|
}
|
|
16793
|
-
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 };
|
|
16794
16857
|
|
|
16795
|
-
//# sourceMappingURL=scope-
|
|
16858
|
+
//# sourceMappingURL=scope-CJ7xtrs8.js.map
|