@tangle-network/agent-runtime 0.319.8 → 0.319.10
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-BWZI_qKj.js → activation-BKglRwjB.js} +2 -2
- package/dist/{activation-BWZI_qKj.js.map → activation-BKglRwjB.js.map} +1 -1
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-DylWk2Ch.js → coordination-driver-CE01_us_.js} +2 -2
- package/dist/{coordination-driver-DylWk2Ch.js.map → coordination-driver-CE01_us_.js.map} +1 -1
- package/dist/{delegate-BplL_LTN.js → delegate-BptW384t.js} +2 -2
- package/dist/{delegate-BplL_LTN.js.map → delegate-BptW384t.js.map} +1 -1
- package/dist/durable.js +2 -2
- package/dist/{graph-ZY00Xbsd.js → graph-Bkcora6P.js} +4 -4
- package/dist/{graph-ZY00Xbsd.js.map → graph-Bkcora6P.js.map} +1 -1
- package/dist/{improvement-cycle-CWZg3n35.js → improvement-cycle-0cnwWPFY.js} +3 -3
- package/dist/{improvement-cycle-CWZg3n35.js.map → improvement-cycle-0cnwWPFY.js.map} +1 -1
- package/dist/index.js +7 -7
- package/dist/intelligence.js +3 -3
- package/dist/kernel.js +8 -8
- package/dist/{loop-runner-bin-RWPcxc7o.js → loop-runner-bin-DRw76sWb.js} +3 -3
- package/dist/{loop-runner-bin-RWPcxc7o.js.map → loop-runner-bin-DRw76sWb.js.map} +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.js +4 -4
- package/dist/{provision-supervisor-BeNz-1fA.js → provision-supervisor-Bs698TqJ.js} +3 -3
- package/dist/{provision-supervisor-BeNz-1fA.js.map → provision-supervisor-Bs698TqJ.js.map} +1 -1
- package/dist/{runtime-DeMyz0Hv.js → runtime-SioKh3r_.js} +8 -8
- package/dist/{runtime-DeMyz0Hv.js.map → runtime-SioKh3r_.js.map} +1 -1
- package/dist/{search-executor-NUDuVpM0.js → search-executor-DjKdQluM.js} +2 -2
- package/dist/{search-executor-NUDuVpM0.js.map → search-executor-DjKdQluM.js.map} +1 -1
- package/dist/{server-BHbAmfr5.js → server-BfEwCD55.js} +3 -3
- package/dist/{server-BHbAmfr5.js.map → server-BfEwCD55.js.map} +1 -1
- package/dist/{supervise-BUGydD8V.js → supervise-Bj8U345y.js} +4 -4
- package/dist/{supervise-BUGydD8V.js.map → supervise-Bj8U345y.js.map} +1 -1
- package/dist/{supervisor-CRod4ISR.js → supervisor-CCtmmmOz.js} +171 -63
- package/dist/supervisor-CCtmmmOz.js.map +1 -0
- package/dist/testing.js +12 -12
- package/dist/tui/index.js +1 -1
- package/package.json +1 -1
- package/dist/supervisor-CRod4ISR.js.map +0 -1
|
@@ -7428,6 +7428,42 @@ async function captureProviderLiveWorkspace(port, context, parent) {
|
|
|
7428
7428
|
clearDeadline();
|
|
7429
7429
|
}
|
|
7430
7430
|
}
|
|
7431
|
+
/** @internal Construct the same exact receipt for a live capture and evidence-only recovery. */
|
|
7432
|
+
function workspaceCaptureReceipt(context, captured) {
|
|
7433
|
+
const { snapshot, provenance, coverageComplete = false, incompleteReason } = captured;
|
|
7434
|
+
return {
|
|
7435
|
+
executionId: context.executionId,
|
|
7436
|
+
...context.controlRef === void 0 ? {} : { controlRef: context.controlRef },
|
|
7437
|
+
...context.node === void 0 ? {} : { node: context.node },
|
|
7438
|
+
environmentId: context.environment.id,
|
|
7439
|
+
profileDigest: canonicalAgentProfileDigest(context.profile),
|
|
7440
|
+
...capturedSessionIdentity(provenance, coverageComplete, context.executionId, context.providerSessionId ?? null),
|
|
7441
|
+
snapshot,
|
|
7442
|
+
provenance,
|
|
7443
|
+
coverageComplete,
|
|
7444
|
+
...incompleteReason === void 0 ? {} : { incompleteReason }
|
|
7445
|
+
};
|
|
7446
|
+
}
|
|
7447
|
+
/** Only a verified, single-session capture may supply a scalar session identity. */
|
|
7448
|
+
function capturedSessionIdentity(provenance, coverageComplete, executionId, providerSessionId) {
|
|
7449
|
+
const unknown = {
|
|
7450
|
+
providerSessionId,
|
|
7451
|
+
nativeSessionId: null
|
|
7452
|
+
};
|
|
7453
|
+
if (!coverageComplete || provenance?.status !== "reported" || provenance.executionId !== executionId || provenance.sessions?.length !== 1) return unknown;
|
|
7454
|
+
const session = provenance.sessions[0];
|
|
7455
|
+
if (session.executionId !== executionId || providerSessionId !== null && session.id !== providerSessionId) return unknown;
|
|
7456
|
+
const ids = new Set((provenance.attempts ?? []).filter((attempt) => session.executionIds?.includes(attempt.executionId)).flatMap((attempt) => attempt.nativeSessionIds));
|
|
7457
|
+
const nativeSessionId = ids.size === 1 ? [...ids][0] : null;
|
|
7458
|
+
if (session.nativeSessionId != null && nativeSessionId !== session.nativeSessionId) return {
|
|
7459
|
+
providerSessionId,
|
|
7460
|
+
nativeSessionId: null
|
|
7461
|
+
};
|
|
7462
|
+
return {
|
|
7463
|
+
providerSessionId,
|
|
7464
|
+
nativeSessionId
|
|
7465
|
+
};
|
|
7466
|
+
}
|
|
7431
7467
|
/** Validate the executable retention port at the create boundary. */
|
|
7432
7468
|
function assertProviderWorkspaceRetentionPort(port, context) {
|
|
7433
7469
|
if (!Number.isSafeInteger(port.timeoutMs) || port.timeoutMs <= 0) throw new ValidationError$1(`${context}: workspaceRetention.timeoutMs must be a positive safe integer`);
|
|
@@ -11272,6 +11308,13 @@ function classifyRetainedPendingCause(cause, phase = "execution") {
|
|
|
11272
11308
|
}
|
|
11273
11309
|
return "unobservable";
|
|
11274
11310
|
}
|
|
11311
|
+
/** @internal Evidence recovery failed; the accepted turn stands and a root pursuit stays open. */
|
|
11312
|
+
var RetainedWorkspaceCapturePendingError = class extends Error {
|
|
11313
|
+
constructor(executionId, cause) {
|
|
11314
|
+
super(`retained workspace capture pending for ${executionId}; source environment preserved: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
11315
|
+
this.name = "RetainedWorkspaceCapturePendingError";
|
|
11316
|
+
}
|
|
11317
|
+
};
|
|
11275
11318
|
/**
|
|
11276
11319
|
* Local observation stopped; the retained provider execution has no accepted terminal result.
|
|
11277
11320
|
*
|
|
@@ -11670,26 +11713,6 @@ function providerAsSandboxClient(provider, options = {}) {
|
|
|
11670
11713
|
});
|
|
11671
11714
|
} };
|
|
11672
11715
|
}
|
|
11673
|
-
/** Only a verified, single-session capture may supply a scalar session identity. */
|
|
11674
|
-
function capturedSessionIdentity(provenance, coverageComplete, executionId, providerSessionId) {
|
|
11675
|
-
const unknown = {
|
|
11676
|
-
providerSessionId,
|
|
11677
|
-
nativeSessionId: null
|
|
11678
|
-
};
|
|
11679
|
-
if (!coverageComplete || provenance?.status !== "reported" || provenance.executionId !== executionId || provenance.sessions?.length !== 1) return unknown;
|
|
11680
|
-
const session = provenance.sessions[0];
|
|
11681
|
-
if (session.executionId !== executionId || providerSessionId !== null && session.id !== providerSessionId) return unknown;
|
|
11682
|
-
const ids = new Set((provenance.attempts ?? []).filter((attempt) => session.executionIds?.includes(attempt.executionId)).flatMap((attempt) => attempt.nativeSessionIds));
|
|
11683
|
-
const nativeSessionId = ids.size === 1 ? [...ids][0] : null;
|
|
11684
|
-
if (session.nativeSessionId != null && nativeSessionId !== session.nativeSessionId) return {
|
|
11685
|
-
providerSessionId,
|
|
11686
|
-
nativeSessionId: null
|
|
11687
|
-
};
|
|
11688
|
-
return {
|
|
11689
|
-
providerSessionId,
|
|
11690
|
-
nativeSessionId
|
|
11691
|
-
};
|
|
11692
|
-
}
|
|
11693
11716
|
/**
|
|
11694
11717
|
* Lower the seam's prompt options onto turn fields, through the one mapper this module already
|
|
11695
11718
|
* uses to raise a sandbox prompt into a provider turn. Reusing it is what keeps the two directions
|
|
@@ -12497,24 +12520,24 @@ function admittedEnvironmentId(retention) {
|
|
|
12497
12520
|
}
|
|
12498
12521
|
}
|
|
12499
12522
|
function providerWorkspaceCaptureReceipt(args, environment, snapshot, fallbackSessionId) {
|
|
12500
|
-
const provenance = args.workspaceProvenance();
|
|
12501
12523
|
const coverage = args.workspaceCoverage();
|
|
12502
12524
|
const controlRef = args.workspaceControlRef();
|
|
12503
|
-
return {
|
|
12525
|
+
return workspaceCaptureReceipt({
|
|
12504
12526
|
executionId: args.executionId,
|
|
12505
12527
|
...controlRef === void 0 ? {} : { controlRef },
|
|
12506
12528
|
...args.node === void 0 ? {} : { node: args.node },
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12529
|
+
environment,
|
|
12530
|
+
profile: args.profile,
|
|
12531
|
+
providerSessionId: controlRef?.sessionId ?? fallbackSessionId
|
|
12532
|
+
}, {
|
|
12510
12533
|
snapshot,
|
|
12511
|
-
provenance:
|
|
12534
|
+
provenance: args.workspaceProvenance() ?? {
|
|
12512
12535
|
status: "unavailable",
|
|
12513
12536
|
missing: ["Capture coverage metadata was not retained"]
|
|
12514
12537
|
},
|
|
12515
12538
|
coverageComplete: coverage.complete,
|
|
12516
12539
|
...coverage.incompleteReason === void 0 ? {} : { incompleteReason: coverage.incompleteReason }
|
|
12517
|
-
};
|
|
12540
|
+
});
|
|
12518
12541
|
}
|
|
12519
12542
|
async function* streamProviderExecutor(args) {
|
|
12520
12543
|
const started = Date.now();
|
|
@@ -13332,18 +13355,14 @@ function environmentAsSandboxInstance(environment, options) {
|
|
|
13332
13355
|
providerSessionId,
|
|
13333
13356
|
nativeSessionId: null,
|
|
13334
13357
|
profile: identity.profile
|
|
13335
|
-
}).then((
|
|
13358
|
+
}).then((captured) => workspaceCaptureReceipt({
|
|
13359
|
+
environment,
|
|
13336
13360
|
executionId: identity.executionId,
|
|
13337
13361
|
...controlRef === void 0 ? {} : { controlRef },
|
|
13338
13362
|
...identity.node === void 0 ? {} : { node: identity.node },
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
snapshot,
|
|
13343
|
-
provenance,
|
|
13344
|
-
coverageComplete: coverageComplete ?? false,
|
|
13345
|
-
...incompleteReason === void 0 ? {} : { incompleteReason }
|
|
13346
|
-
}));
|
|
13363
|
+
profile: identity.profile,
|
|
13364
|
+
providerSessionId
|
|
13365
|
+
}, captured));
|
|
13347
13366
|
const receipt = await capture;
|
|
13348
13367
|
publication ??= Promise.resolve().then(async () => {
|
|
13349
13368
|
await options.onWorkspaceCaptured?.(receipt);
|
|
@@ -24890,6 +24909,7 @@ async function prepareScopeRetainedOwnerSeatSwitch(scope, mode) {
|
|
|
24890
24909
|
if (!state?.acceptedRef || !state.acceptedConsumed) throw new ValidationError$1("seat switch requires a committed owner turn");
|
|
24891
24910
|
const accepted = state.acceptedRef;
|
|
24892
24911
|
await scopeRetainedOwnerTurnEnded(scope);
|
|
24912
|
+
await reconcileOwnerWorkspaceBeforeReuse(state, scope.signal);
|
|
24893
24913
|
await state.checkpointing;
|
|
24894
24914
|
await checkpointOwnerWorkspace(scope, state);
|
|
24895
24915
|
const owned = (await state.args.journal.loadTree(state.args.rootId) ?? []).filter((event) => event.id === state.args.nodeId);
|
|
@@ -25490,7 +25510,7 @@ async function releaseOwnerEnvironment(state, provider, capturesMs) {
|
|
|
25490
25510
|
const pendingSources = new Set(requestFailures.map(({ event }) => event.environmentId));
|
|
25491
25511
|
const released = new Set(events.flatMap((event) => event.kind === "environment-teardown" && event.id === args.nodeId && event.provider === provider.name && event.destroyed ? [event.environmentId] : []));
|
|
25492
25512
|
const environments = new Set(events.flatMap((event) => event.id === args.nodeId && event.kind === "execution-admitted" && event.admission.phase === "environment" ? [event.admission.environmentId] : []));
|
|
25493
|
-
const retentionFailures = state.workspaceRetention || events.some((event) => event.kind === "execution-input" && event.id === args.nodeId && event.workspaceRetention === true) ? await ownerWorkspaceRetentionFailures(events, args
|
|
25513
|
+
const retentionFailures = state.workspaceRetention || events.some((event) => event.kind === "execution-input" && event.id === args.nodeId && event.workspaceRetention === true) ? await ownerWorkspaceRetentionFailures(events, args) : /* @__PURE__ */ new Set();
|
|
25494
25514
|
const unconfirmed = [];
|
|
25495
25515
|
const preserved = [];
|
|
25496
25516
|
let lastDetail;
|
|
@@ -25641,23 +25661,17 @@ function unsettledOwnerRuns(events, nodeId, environmentId) {
|
|
|
25641
25661
|
close();
|
|
25642
25662
|
return [...runs.values()];
|
|
25643
25663
|
}
|
|
25644
|
-
/**
|
|
25645
|
-
|
|
25646
|
-
*
|
|
25647
|
-
* The receipt is the attempt's committed result, or an evidence record of the same attempt: a
|
|
25648
|
-
* turn its manager stopped commits its result first and journals its capture as evidence after
|
|
25649
|
-
* it, and a turn that failed journals the capture it took of the stopped session. This runs only
|
|
25650
|
-
* at a release no process will resume, so a complete, verified capture of the exact execution is
|
|
25651
|
-
* the whole of what keeping the source would preserve.
|
|
25652
|
-
*/
|
|
25653
|
-
async function ownerWorkspaceRetentionFailures(events, nodeId, blobs) {
|
|
25664
|
+
/** One grouping for release and the evidence gate before another owner invocation. */
|
|
25665
|
+
function ownerWorkspaceAttempts(events, nodeId) {
|
|
25654
25666
|
const attempts = [];
|
|
25655
25667
|
let current;
|
|
25656
25668
|
const flush = () => {
|
|
25657
25669
|
if (current !== void 0) attempts.push(current);
|
|
25658
25670
|
current = void 0;
|
|
25659
25671
|
};
|
|
25660
|
-
const fresh = (executionId) => ({
|
|
25672
|
+
const fresh = (executionId, workspaceRetention) => ({
|
|
25673
|
+
workspaceRetention,
|
|
25674
|
+
admissions: [],
|
|
25661
25675
|
...executionId === void 0 ? {} : { executionId },
|
|
25662
25676
|
environmentIds: /* @__PURE__ */ new Set(),
|
|
25663
25677
|
controlByEnvironment: /* @__PURE__ */ new Map(),
|
|
@@ -25667,18 +25681,37 @@ async function ownerWorkspaceRetentionFailures(events, nodeId, blobs) {
|
|
|
25667
25681
|
if (!("id" in event) || event.id !== nodeId) continue;
|
|
25668
25682
|
if (event.kind === "execution-input") {
|
|
25669
25683
|
flush();
|
|
25670
|
-
current = fresh(`${nodeId}:input:${event.seq}
|
|
25684
|
+
current = fresh(`${nodeId}:input:${event.seq}`, event.workspaceRetention);
|
|
25671
25685
|
} else if (event.kind === "execution-admitted" && event.admission.phase === "environment") {
|
|
25672
25686
|
if (current?.result !== void 0) flush();
|
|
25673
25687
|
current ??= fresh();
|
|
25674
25688
|
current.environmentIds.add(event.admission.environmentId);
|
|
25675
|
-
|
|
25676
|
-
else if (event.kind === "execution-
|
|
25689
|
+
current.admissions.push(event.admission);
|
|
25690
|
+
} else if (event.kind === "execution-admitted" && event.admission.phase === "dispatched") {
|
|
25691
|
+
current?.admissions.push(event.admission);
|
|
25692
|
+
current?.controlByEnvironment.set(event.admission.controlRef.environmentId, event.admission.controlRef);
|
|
25693
|
+
} else if (event.kind === "execution-admitted") current?.admissions.push(event.admission);
|
|
25694
|
+
else if (event.kind === "execution-bound") {
|
|
25695
|
+
if (current !== void 0 && current.result === void 0) current.binding = event.binding;
|
|
25696
|
+
} else if (event.kind === "execution-result") {
|
|
25677
25697
|
current ??= fresh();
|
|
25678
25698
|
current.result = event;
|
|
25679
25699
|
} else if (event.kind === "execution-evidence") current?.evidence.push(event);
|
|
25680
25700
|
}
|
|
25681
25701
|
flush();
|
|
25702
|
+
return attempts;
|
|
25703
|
+
}
|
|
25704
|
+
/**
|
|
25705
|
+
* Group owner admissions by input and require a verified workspace receipt before deletion.
|
|
25706
|
+
*
|
|
25707
|
+
* The receipt is the attempt's committed result, or an evidence record of the same attempt: a
|
|
25708
|
+
* turn its manager stopped commits its result first and journals its capture as evidence after
|
|
25709
|
+
* it, and a turn that failed journals the capture it took of the stopped session. A root capture
|
|
25710
|
+
* failure can enter this cleanup barrier and still be resumed, so any receipt refused before
|
|
25711
|
+
* reuse must also preserve its source here.
|
|
25712
|
+
*/
|
|
25713
|
+
async function ownerWorkspaceRetentionFailures(events, owner) {
|
|
25714
|
+
const attempts = ownerWorkspaceAttempts(events, owner.nodeId);
|
|
25682
25715
|
const failures = /* @__PURE__ */ new Set();
|
|
25683
25716
|
for (const attempt of attempts) {
|
|
25684
25717
|
if (attempt.environmentIds.size === 0) continue;
|
|
@@ -25687,19 +25720,87 @@ async function ownerWorkspaceRetentionFailures(events, nodeId, blobs) {
|
|
|
25687
25720
|
continue;
|
|
25688
25721
|
}
|
|
25689
25722
|
const environmentId = [...attempt.environmentIds][0];
|
|
25690
|
-
|
|
25691
|
-
|
|
25692
|
-
|
|
25693
|
-
|
|
25694
|
-
|
|
25695
|
-
|
|
25696
|
-
|
|
25697
|
-
|
|
25723
|
+
if (!await ownerAttemptHasCapture(attempt, environmentId, owner.blobs, attempt.workspaceRetention === true ? owner : void 0)) failures.add(environmentId);
|
|
25724
|
+
}
|
|
25725
|
+
return failures;
|
|
25726
|
+
}
|
|
25727
|
+
async function ownerAttemptHasCapture(attempt, environmentId, blobs, owner) {
|
|
25728
|
+
const controlRef = attempt.controlByEnvironment.get(environmentId);
|
|
25729
|
+
const receipts = [...attempt.result === void 0 ? [] : [attempt.result.outRef], ...attempt.evidence.map((event) => event.outRef)];
|
|
25730
|
+
let verified = false;
|
|
25731
|
+
for (const outRef of receipts) {
|
|
25732
|
+
const output = await storedOutput(blobs, outRef);
|
|
25733
|
+
if (hasDurableWorkspaceCapture(output, output !== null && typeof output === "object" ? output.workspaceSnapshot : void 0, environmentId, attempt.executionId, controlRef, owner === void 0 ? void 0 : ownerCaptureIdentity(attempt, owner))) {
|
|
25734
|
+
verified = true;
|
|
25735
|
+
break;
|
|
25736
|
+
}
|
|
25737
|
+
}
|
|
25738
|
+
return verified;
|
|
25739
|
+
}
|
|
25740
|
+
function ownerCaptureIdentity(attempt, owner) {
|
|
25741
|
+
const intent = attempt.admissions.find((admission) => admission.phase === "intent");
|
|
25742
|
+
const node = attempt.binding === void 0 ? void 0 : {
|
|
25743
|
+
rootId: owner.executionRootId ?? owner.rootId,
|
|
25744
|
+
parentId: owner.nodeId,
|
|
25745
|
+
nodeId: owner.nodeId,
|
|
25746
|
+
...owner.depth === void 0 ? {} : { depth: owner.depth },
|
|
25747
|
+
attemptId: attempt.binding.attemptId
|
|
25748
|
+
};
|
|
25749
|
+
return {
|
|
25750
|
+
profileDigest: intent?.requestedProfileDigest,
|
|
25751
|
+
node
|
|
25752
|
+
};
|
|
25753
|
+
}
|
|
25754
|
+
/** Recover evidence only, before a later turn or checkpoint can change the accepted workspace. */
|
|
25755
|
+
async function reconcileOwnerWorkspaceBeforeReuse(state, signal) {
|
|
25756
|
+
const { args } = state;
|
|
25757
|
+
const events = await args.journal.loadTree(args.rootId) ?? [];
|
|
25758
|
+
const attempts = ownerWorkspaceAttempts(events, args.nodeId);
|
|
25759
|
+
const latest = attempts.at(-1);
|
|
25760
|
+
const unusable = unusableEnvironmentIds(events.filter((event) => event.id === args.nodeId));
|
|
25761
|
+
if (latest === void 0) return;
|
|
25762
|
+
const reusing = new Set(latest.environmentIds);
|
|
25763
|
+
if (latest.result === void 0 && state.priorSession !== void 0) reusing.add(state.priorSession.environmentId);
|
|
25764
|
+
for (const [index, attempt] of attempts.entries()) {
|
|
25765
|
+
if (attempt.workspaceRetention !== true || attempt.result === void 0) continue;
|
|
25766
|
+
for (const environmentId of attempt.environmentIds) {
|
|
25767
|
+
if (!reusing.has(environmentId) || unusable.has(environmentId)) continue;
|
|
25768
|
+
if (await ownerAttemptHasCapture(attempt, environmentId, args.blobs, args)) continue;
|
|
25769
|
+
try {
|
|
25770
|
+
if (attempt.environmentIds.size !== 1 || attempt.executionId === void 0) throw new Error("accepted workspace has ambiguous admission identity");
|
|
25771
|
+
if (index < attempts.length - 1) throw new Error("a later invocation already admitted this environment; historical workspace cannot be recaptured");
|
|
25772
|
+
const capture = state.checkpointCapture;
|
|
25773
|
+
const provider = state.provider;
|
|
25774
|
+
const intent = attempt.admissions.find((admission) => admission.phase === "intent");
|
|
25775
|
+
const admission = attempt.admissions.find((admission) => admission.phase === "environment");
|
|
25776
|
+
const dispatched = attempt.admissions.find((admission) => admission.phase === "dispatched");
|
|
25777
|
+
if (capture === void 0 || provider?.get === void 0 || intent?.phase !== "intent" || admission?.phase !== "environment" || dispatched?.phase !== "dispatched") throw new Error("accepted workspace recovery requires its retention port and exact admissions");
|
|
25778
|
+
const controlRef = dispatched.controlRef;
|
|
25779
|
+
if (provider.name !== intent.provider || admission.provider !== intent.provider || controlRef.provider !== intent.provider || admission.environmentId !== controlRef.environmentId || admission.sessionId !== controlRef.sessionId || admission.executionId !== controlRef.executionId || admission.idempotencyKey !== intent.idempotencyKey || dispatched.idempotencyKey !== intent.idempotencyKey || admission.sessionId !== intent.sessionId || admission.executionId !== intent.executionId || admission.turnId !== intent.turnId || dispatched.turnId !== intent.turnId || canonicalAgentProfileDigest(capture.profile) !== intent.requestedProfileDigest) throw new Error("accepted workspace recovery does not match its original profile or admission");
|
|
25780
|
+
const environment = await runAbortable(() => provider.get(environmentId), AbortSignal.any([signal, AbortSignal.timeout(Math.min(3e4, capture.port.timeoutMs))]), "accepted workspace source lookup timed out");
|
|
25781
|
+
if (environment === null || environment.id !== environmentId || environment.provider !== provider.name) throw new Error("accepted workspace source is unavailable");
|
|
25782
|
+
const identity = ownerCaptureIdentity(attempt, args);
|
|
25783
|
+
const context = {
|
|
25784
|
+
environment,
|
|
25785
|
+
executionId: attempt.executionId,
|
|
25786
|
+
controlRef,
|
|
25787
|
+
providerSessionId: controlRef.sessionId,
|
|
25788
|
+
nativeSessionId: null,
|
|
25789
|
+
profile: capture.profile,
|
|
25790
|
+
...identity.node === void 0 ? {} : { node: identity.node }
|
|
25791
|
+
};
|
|
25792
|
+
const captured = await runAbortable(() => captureProviderWorkspaceSnapshot(capture.port, context), signal, "accepted workspace capture aborted");
|
|
25793
|
+
const output = {
|
|
25794
|
+
workspaceSnapshot: captured.snapshot,
|
|
25795
|
+
workspaceCapture: workspaceCaptureReceipt(context, captured)
|
|
25796
|
+
};
|
|
25797
|
+
if (!hasDurableWorkspaceCapture(output, captured.snapshot, environmentId, attempt.executionId, controlRef, identity)) throw new Error(captured.incompleteReason ?? "accepted workspace capture is incomplete");
|
|
25798
|
+
await state.context.onEvidence(output);
|
|
25799
|
+
} catch (cause) {
|
|
25800
|
+
throw new RetainedWorkspaceCapturePendingError(attempt.executionId ?? args.nodeId, cause);
|
|
25698
25801
|
}
|
|
25699
25802
|
}
|
|
25700
|
-
if (!verified) failures.add(environmentId);
|
|
25701
25803
|
}
|
|
25702
|
-
return failures;
|
|
25703
25804
|
}
|
|
25704
25805
|
/** A stored output whose bytes match its content reference, or undefined. */
|
|
25705
25806
|
async function storedOutput(blobs, outRef) {
|
|
@@ -25711,13 +25812,14 @@ async function storedOutput(blobs, outRef) {
|
|
|
25711
25812
|
}
|
|
25712
25813
|
}
|
|
25713
25814
|
/** A stored result authorizes cleanup only for the exact source and complete capture. */
|
|
25714
|
-
function hasDurableWorkspaceCapture(output, snapshot, environmentId, executionId, controlRef) {
|
|
25815
|
+
function hasDurableWorkspaceCapture(output, snapshot, environmentId, executionId, controlRef, identity) {
|
|
25715
25816
|
const parsed = agentCandidateWorkspaceSnapshotEvidenceSchema.safeParse(snapshot);
|
|
25716
25817
|
if (!parsed.success || !("locator" in parsed.data.manifest) || !("locator" in parsed.data.archive)) return false;
|
|
25717
25818
|
if (output === null || typeof output !== "object") return false;
|
|
25718
25819
|
const capture = output.workspaceCapture;
|
|
25719
25820
|
if (capture === null || typeof capture !== "object") return false;
|
|
25720
25821
|
const receipt = capture;
|
|
25822
|
+
if (identity !== void 0 && (identity.profileDigest === void 0 || receipt.profileDigest !== identity.profileDigest || (identity.node === void 0 ? receipt.node !== void 0 : receipt.node === void 0 || contentAddress(receipt.node) !== contentAddress(identity.node)))) return false;
|
|
25721
25823
|
const capturedControl = AgentExactRunControlRefSchema.safeParse(receipt.controlRef);
|
|
25722
25824
|
if (executionId === void 0 || controlRef === void 0 || !capturedControl.success || !sameControlCoordinates(capturedControl.data, controlRef) || receipt.environmentId !== environmentId || receipt.executionId !== executionId || receipt.coverageComplete !== true) return false;
|
|
25723
25825
|
const linked = agentCandidateWorkspaceSnapshotEvidenceSchema.safeParse(receipt.snapshot);
|
|
@@ -25838,6 +25940,7 @@ async function prepareScopeRetainedOwnerTask(scope, task) {
|
|
|
25838
25940
|
const accepted = [...attempt].reverse().find((event) => event.kind === "execution-result");
|
|
25839
25941
|
if (accepted?.kind === "execution-result") state.acceptedRef = accepted;
|
|
25840
25942
|
}
|
|
25943
|
+
if (state.taskRef !== void 0 && state.acceptedRef === void 0) await reconcileOwnerWorkspaceBeforeReuse(state, scope.signal);
|
|
25841
25944
|
const unusable = unusableEnvironmentIds(owned);
|
|
25842
25945
|
const inFlight = continuedEnvironment(owned);
|
|
25843
25946
|
if (inFlight?.inFlight && unusable.has(inFlight.admission.environmentId)) {
|
|
@@ -25852,6 +25955,7 @@ async function prepareScopeRetainedOwnerTask(scope, task) {
|
|
|
25852
25955
|
state.admissions.length = 0;
|
|
25853
25956
|
}
|
|
25854
25957
|
if (state.prepared && state.acceptedRef && state.acceptedConsumed) {
|
|
25958
|
+
await reconcileOwnerWorkspaceBeforeReuse(state, scope.signal);
|
|
25855
25959
|
const currentEnvironment = [...state.admissions].reverse().find((admission) => admission.phase === "environment");
|
|
25856
25960
|
if (currentEnvironment?.phase === "environment") state.priorSession = currentEnvironment;
|
|
25857
25961
|
delete state.inputSequence;
|
|
@@ -27539,7 +27643,9 @@ function createScope(args) {
|
|
|
27539
27643
|
});
|
|
27540
27644
|
registerScopeRetainedOwner(scope, {
|
|
27541
27645
|
rootId: args.root,
|
|
27646
|
+
executionRootId: args.ownerMaterialization?.journalRoot ?? args.root,
|
|
27542
27647
|
nodeId: args.parentId,
|
|
27648
|
+
depth: args.depth,
|
|
27543
27649
|
journal: args.journal,
|
|
27544
27650
|
blobs: args.blobs,
|
|
27545
27651
|
priorEvents: args.resumeFrom?.events ?? [],
|
|
@@ -29557,6 +29663,7 @@ async function runDriverWithRetry(run) {
|
|
|
29557
29663
|
try {
|
|
29558
29664
|
await run.drive(attempt, reentry);
|
|
29559
29665
|
} catch (error) {
|
|
29666
|
+
if (error instanceof RetainedWorkspaceCapturePendingError) throw error;
|
|
29560
29667
|
const durationMs = now() - startedAt;
|
|
29561
29668
|
const classification = classifyDriverFailure(error, run.signal);
|
|
29562
29669
|
const after = run.progress();
|
|
@@ -30414,6 +30521,7 @@ function createSupervisor() {
|
|
|
30414
30521
|
const tree = runTree(scope);
|
|
30415
30522
|
const leakedReservations = pool.openReservations();
|
|
30416
30523
|
if (controller.signal.reason instanceof RunCancellationReason) return noWinner();
|
|
30524
|
+
if (!actOutcome.ok && actOutcome.error instanceof RetainedWorkspaceCapturePendingError) throw actOutcome.error;
|
|
30417
30525
|
if (actOutcome.ok) {
|
|
30418
30526
|
if (executionAborted) return noWinner();
|
|
30419
30527
|
const out = actOutcome.out;
|
|
@@ -30903,4 +31011,4 @@ function isNonEmptySpend(s) {
|
|
|
30903
31011
|
//#endregion
|
|
30904
31012
|
export { environmentReader as $, runtimeOwnedScopeOwnerRuntime as $i, parseWorkerToolTraceArtifact as $n, loopEventToOtelSpan as $r, PEER_MAIL_WIRE_KEY as $t, scopeOwnerExecutorNodeContext as A, promptOnlyProfileMaterialization as Ai, resolveAgentEnvironmentProvider as An, resolveHarnessTranscriptCapture as Ar, captureReusableExecutorConfig as At, consumeScopeRetainedOwnerResult as B, authoredProfileDigest as Bi, InMemoryResultBlobStore as Bn, mergeTraceEnv as Br, createInPlaceCliExecutor as Bt, deriveNodeExecutionIdentity as C, promptFromAgentTurnInput as Ca, assertProfileMaterializes as Ci, readPromptOptions as Cn, abortError as Cr, createContinuationKeeper as Ct, recordScopeOwnerMaterialization as D, profileMaterializationAxes$1 as Di, createAgentEnvironmentProviderRegistry as Dn, harnessTranscriptArtifact as Dr, passedItems as Dt, recordScopeOwnerDriverAttempt as E, fullProfileMaterialization as Ei, LEAF_CONTINUATION_TASK as En, captureHarnessTranscript as Er, failedItems as Et, seatExecutionProfile as F, unsupportedProfileDimensions as Fi, retainedExecutorSeamKey as Fn, runCodeMode as Fr, snapshotExecutorConfig as Ft, scopeRetainedOwnerContext as G, newExecutionAttemptId as Gi, replaySpawnTree as Gn, resolveRedactor as Gr, workerTraceSeamKey as Gt, prepareScopeRetainedOwnerSeatSwitch as H, inheritRuntimeOwnedExecutorAttestation as Hi, insideCursorNamespace as Hn, traceContextToEnv as Hr, readWorkerTraceContext as Ht, abandonScopeRetainedOwnerInvocation as I, validateProfileMaterialization as Ii, unavailablePauseMs as In, priceTokens as Ir, createWorktreeCliExecutor as It, scopeRetainedOwnerResourceReader as J, runtimeOwnedDriveHarnessProviderEvidence as Ji, readCommittedJsonLines as Jn, buildRuntimeEventOtelSpans as Jr, createActivityLog as Jt, scopeRetainedOwnerJournalRoot as K, providerAttemptEvidence as Ki, isNoEntError as Kn, buildLoopOtelSpans as Kr, taskToPrompt as Kt, beginScopeRetainedOwnerDrive as L, worktreeCliProfileMaterialization as Li, unavailableSignalOfFailure as Ln, routerTokenPrice as Lr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Lt, SeatChain as M, renderProfileMaterializationIssues as Mi, decodeToolPart as Mn, contentAddress as Mr, cliWorktreeExecutor as Mt, SeatChainExhaustedError as N, renderUnsupported as Ni, sandboxSessionTraceSource as Nn, createCodeModeTools as Nr, createExecutor as Nt, recordScopeOwnerPause as O, promptControlProfileMaterialization as Oi, providerAsExecutor as On, persistHarnessTranscript as Or, verdictFromJudgeScore as Ot, authoredSeatStages as P, sandboxActProfileMaterialization as Pi, registerRetainedExecutorPreparation as Pn, describeCodeModeTools as Pr, createExecutorRegistry as Pt, SPAWN_RESOURCE_PATH_MAX_BYTES as Q, runtimeOwnedPendingExecutorMaterialization as Qi, isTraceAnalysisStore as Qn, generateSpanId as Qr, DEFAULT_PEER_MAIL_LIMITS as Qt, bindScopeRetainedOwnerEnvironmentId as R, attestRuntimeOwnedPendingExecutor as Ri, FileResultBlobStore as Rn, ROUTER_PRICE_SOURCE as Rr, createSteerableSandboxSession as Rt, createScope as S, awaitAbortable$1 as Sa, assertProfileMaterialization as Si, assertBoxlessPromptOptions as Sn, RunCancellationReason as Sr, checkVerdictOf as St, meterRuntimeOwnedProviderAttempt as T, providerMessageText as Ta, defineProfileMaterializationContract as Ti, runBrainLoop as Tn, runAbortable as Tr, expandQuestions as Tt, prepareScopeRetainedOwnerTask as U, knownExecutionBindingReceipt as Ui, loadSpawnForest as Un, defaultRedactor as Ur, workerTraceEnv as Ut, noteScopeRetainedOwnerCoordination as V, finalizeRuntimeOwnedPendingExecutor as Vi, InMemorySpawnJournal as Vn, readTraceContextFromEnv as Vr, WORKER_TRACE_PROPAGATION as Vt, reconcileScopeRetainedOwnerEnvironment as W, knownMaterializationReceipt as Wi, materializeTreeView as Wn, defaultRedactorIdentityMaterial as Wr, workerTraceHeaders as Wt, scopeRetainedOwnerResult as X, runtimeOwnedExecutorMaterialization as Xi, WORKER_TOOL_TRACE_SCHEMA_VERSION as Xn, createOtelExporter as Xr, createInbox as Xt, scopeRetainedOwnerRestorePoint as Y, runtimeOwnedExecutorExecutionBinding as Yi, writeAllBytes as Yn, createOpenInferenceFileExporter as Yr, readWorkerProgress as Yt, scopeRetainedOwnerTurnEnded as Z, runtimeOwnedExecutorProviderEvidence as Zi, captureWorkerTraceEvidence as Zn, flatOtelSpan as Zr, AUTHORITY_MARKERS as Zt, isDriverSpec as _, sandboxEventServedBackend as _a, localHarnessExecutable as _i, runAgentRounds as _n, retainedCreateMaterial as _r, CONTINUATION_FACTS as _t, collectDelivered as a, detachedSnapshot as aa, sanitizeAgentRuntimeEvent as ai, isLiveNodeStatus as an, createBudgetPool as ar, interactiveAdmissionSeamKey as at, assertRecursiveReservationPolicy as b, decodeHarnessUsage as ba, terminateProcessTreeAndConfirm as bi, SandboxEvidenceRetentionError as bn, createWorkerSlots as br, admitFinding as bt, runTree as c, assertSandboxServedModel as ca, runSettledCommand as ci, bridgeModelRouteRefusal as cn, spendFromUsageEvents as cr, reconnectRetainedInteractiveRun as ct, classifyDriverFailure as d, createSandboxUsageLedger as da, createWorktree as di, harnessUsageIsEmpty as dn, bridgeStopSignalKey as dr, freeSlots as dt, unknownExecutionBindingReceipt as ea, padSpanId as ei, claimsAuthority as en, workerTraceAnalysisStore as er, hostDirectoryReader as et, runDriverWithRetry as f, extractLlmCallEvent as fa, removeWorktree as fi, readCodexRolloutSession as fn, errMessage as fr, queueOf as ft, driverExecutorFactory as g, notifySandboxEventObserver as ga, harnessSupportsReasoningEffort as gi, isTerminalDecision as gn, startRetainedRunInEnvironment as gr, CONTINUATIONS_DIR as gt, driverChild as h, mapSandboxToolEvent as ha, harnessInvocation as hi, defaultSelectWinner as hn, startRetainedRun as hr, mapExecutorResult as ht, bestDelivered as i, detachedFrozen as ia, createRuntimeStreamEventCollector as ii, peerMailVerbNames as in, assertValidBudget as ir, providerVisibleProfile as it, settledToIteration as j, promptResourceProfileMaterialization as ji, createPushTraceSource as jn, retainHarnessTranscript as jr, cliInPlaceExecutor as jt, restoreScopeOwnerAcceptedExecution as k, promptModelProfileMaterialization as ki, providerAsSandboxClient as kn, readHarnessTranscript as kr, bindReusableExecutorExecutionId as kt, DriverAttemptsExhaustedError as l, canonicalStreamEventFromSandboxEvent as la, runWorktreeHarness as li, addHarnessUsage as ln, spendFromUsageTotals as lr, recoverRetainedInteractiveRun as lt, upstreamUnavailableSignal as m, mapSandboxEvent as ma, LOCAL_HARNESSES as mi, createSandboxForSpec as mn, recoverRetainedRun as mr, gateOnDeliverable as mt, createRootHandle as n, executableAgentProfileSnapshot as na, toOtelAttributes as ni, isPeerMailEnvelope as nn, BudgetReconcileFault as nr, coordinationMcpAlias as nt, pickBestDelivered as o, projectSandboxOutcome as oa, sanitizeKnowledgeReadinessReport as oi, isTerminalNodeStatus as on, meterUsageEvent as or, attachWorker as ot, summarizeDriverAttempts as p, isSandboxTerminalEvent as pa, DEFAULT_LOCAL_HARNESS as pi, TERMINAL_DECISIONS as pn, reconnectRetainedRun as pr, rollingDispatch as pt, scopeRetainedOwnerPriorSpend as q, recordRuntimeOwnedDriveHarnessProviderEvidence as qi, prepareJsonlAppend as qn, buildLoopSpanNodes as qr, DEFAULT_STALL_AFTER_MS as qt, createSupervisor as r, executableAgentSpecSnapshot as ra, createRuntimeEventCollector as ri, peerMailTools as rn, ReservationWaitRefused as rr, coordinationProfileToolPrefix as rt, runFinalizer as s, readSandboxOutcome as sa, sanitizeRuntimeStreamEvent as si, bridgeAdmissionRefusal as sn, newUsageTotals as sr, readWorkerInteractiveBinding as st, DEFAULT_MAX_DEPTH as t, unknownMaterializationReceipt as ta, padTraceId as ti, createPeerMailbox as tn, executorFailure as tr, resolveSpawnResourcePaths as tt, HarnessTurnFailedError as u, createSandboxToolPartState as ua, captureWorktreeDiff as ui, createCodexRolloutStoreReader as un, bridgeRuntimeAttachmentsKey as ur, startRetainedInteractiveRun as ut, withDriverExecutor as v, sandboxProgressEvents as va, parseCodexTokenUsage as vi, createSandboxLineage as vn, destroyInteractiveEnvironment as vr, CheckUnavailableError as vt, meterRuntimeOwnedAccounting as w, promptOptionsFromAgentTurnInput as wa, controlProfileMaterialization as wi, routerBrain as wn, linkAbort as wr, distillFindings as wt, beginScopeOwnerAttempt as x, abortError$1 as xa, AGENT_PROFILE_MATERIALIZATION_AXES as xi, captureBeforeDestroy as xn, openSlotGroup as xr, bestComposite as xt, SUBTREE_RESULT_LIMIT as y, sumSandboxUsage as ya, CodexExecutionDiagnosticError as yi, acquireSandbox as yn, environmentGone as yr, admitContinuationPolicy as yt, bindScopeRetainedOwnerProvider as z, attestRuntimeOwnedScopeOwner as zi, FileSpawnJournal as zn, createPropagatingTraceEmitter as zr, createRouterTranscript as zt };
|
|
30905
31013
|
|
|
30906
|
-
//# sourceMappingURL=supervisor-
|
|
31014
|
+
//# sourceMappingURL=supervisor-CCtmmmOz.js.map
|