@tangle-network/agent-runtime 0.325.16 → 0.325.17-1
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-BZz9_4us.d.ts → activation-BBW-m71u.d.ts} +2 -2
- package/dist/{activation-BC_sG5Vt.js → activation-D96mexEy.js} +3 -3
- package/dist/{activation-BC_sG5Vt.js.map → activation-D96mexEy.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{bundle-DqvlwhKP.js → bundle-BJJmfEsw.js} +2 -2
- package/dist/{bundle-DqvlwhKP.js.map → bundle-BJJmfEsw.js.map} +1 -1
- package/dist/candidate-execution/index.js +5 -5
- package/dist/{coordination-driver-BbX61_O3.js → coordination-driver-BDW2BD3B.js} +5 -12
- package/dist/{coordination-driver-BbX61_O3.js.map → coordination-driver-BDW2BD3B.js.map} +1 -1
- package/dist/{delegate-BzlYG0rC.js → delegate-DfLfoyqH.js} +2 -2
- package/dist/{delegate-BzlYG0rC.js.map → delegate-DfLfoyqH.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +5 -5
- package/dist/{graph-DLRi2Eu0.js → graph-Db0mn91l.js} +4 -4
- package/dist/{graph-DLRi2Eu0.js.map → graph-Db0mn91l.js.map} +1 -1
- package/dist/{improvement-cycle-BWy2LAfd.js → improvement-cycle-vIlvNX1K.js} +6 -6
- package/dist/{improvement-cycle-BWy2LAfd.js.map → improvement-cycle-vIlvNX1K.js.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +7 -7
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-Cmo6nly8.js → loop-runner-bin-CGo7AZ5o.js} +3 -3
- package/dist/{loop-runner-bin-Cmo6nly8.js.map → loop-runner-bin-CGo7AZ5o.js.map} +1 -1
- package/dist/{loop-runner-bin-UpYsI0iM.d.ts → loop-runner-bin-cUBz2dI3.d.ts} +2 -2
- 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 +2 -2
- package/dist/mcp/index.js +5 -5
- package/dist/{openai-tools-BoHnTyO2.d.ts → openai-tools-B_iSLxRt.d.ts} +2 -2
- package/dist/placement.d.ts +1 -1
- package/dist/{prepare-0kTqt9qn.js → prepare-DpavgJT8.js} +7 -8
- package/dist/{prepare-0kTqt9qn.js.map → prepare-DpavgJT8.js.map} +1 -1
- package/dist/{profile-DhZvQngF.js → profile-ZS7_KLwK.js} +55 -30
- package/dist/profile-ZS7_KLwK.js.map +1 -0
- package/dist/{profile-materialization-BnoEf1co.d.ts → profile-materialization-C5-t3HJ7.d.ts} +8 -3
- package/dist/profiles.d.ts +1 -1
- package/dist/{protected-model-port-CFQj32Lt.js → protected-model-port-BLyyfL3l.js} +4 -4
- package/dist/{protected-model-port-CFQj32Lt.js.map → protected-model-port-BLyyfL3l.js.map} +1 -1
- package/dist/{provision-supervisor-CyQfHdRp.js → provision-supervisor-BZx-pDF2.js} +4 -4
- package/dist/{provision-supervisor-CyQfHdRp.js.map → provision-supervisor-BZx-pDF2.js.map} +1 -1
- package/dist/{runtime-CcRx5_Vj.js → runtime-Agdr28lx.js} +111 -177
- package/dist/runtime-Agdr28lx.js.map +1 -0
- package/dist/{search-executor-D-fj_D5B.js → search-executor-DkxGFYh8.js} +3 -3
- package/dist/{search-executor-D-fj_D5B.js.map → search-executor-DkxGFYh8.js.map} +1 -1
- package/dist/{server-_lleZFlY.js → server-DRvmdqAe.js} +4 -4
- package/dist/{server-_lleZFlY.js.map → server-DRvmdqAe.js.map} +1 -1
- package/dist/{supervise-D1Zs0u8D.js → supervise-Hn5Bkl4x.js} +11 -50
- package/dist/supervise-Hn5Bkl4x.js.map +1 -0
- package/dist/{supervisor-BBhhuv4v.js → supervisor-Cwnf_e8V.js} +97 -84
- package/dist/supervisor-Cwnf_e8V.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +14 -14
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-Ca5R4QXR.d.ts → types-D3un8JfP.d.ts} +4 -5
- package/dist/{sandbox-profile-compat-CVgQWb7T.js → workspace-streams-CcoARX4v.js} +12 -49
- package/dist/workspace-streams-CcoARX4v.js.map +1 -0
- package/package.json +9 -9
- package/dist/profile-DhZvQngF.js.map +0 -1
- package/dist/runtime-CcRx5_Vj.js.map +0 -1
- package/dist/sandbox-profile-compat-CVgQWb7T.js.map +0 -1
- package/dist/supervise-D1Zs0u8D.js.map +0 -1
- package/dist/supervisor-BBhhuv4v.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as publishExclusiveDurableFile, n as assertNoSymlinkDescendant } from "./durable-file-B_eJr6Mb.js";
|
|
2
2
|
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, i as ConfigError, l as RetainedInteractiveBindingError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError$1, u as RetainedRunAdmissionError } from "./errors-DodWX-cb.js";
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as promptCacheTokenClasses, Ct as checkInIdleMs, Dt as teardownSurfaces, Et as teardownExecutor, F as deepFreezeCandidate, G as cloneTokenUsage, H as addTokenUsage, J as fnv1a32Hex, K as deleteBoxSafe, Q as mapWithConcurrency, St as boundedChildDeadlineAt, Tt as singleFlightTeardown, U as chargedTokens, V as addSpend, W as cloneSpend, Y as hasCompleteCacheBreakdown, Z as isAsyncIterable$1, a as verifyAgentCandidateWorkspaceArtifacts, at as throwAbort, bt as ROOT_DEADLINE_REASON, ct as withTimeout, dt as addResourceSpend, et as randomSuffix, ft as assertResources, gt as CHILD_DEADLINE_REASON, ht as ACCEPTED_RESULT_GRACE_MS, i as readAgentCandidateWorkspaceArtifactFiles, it as stringifySafe, j as verifiedArtifactChunks, k as verifyWorkspaceSnapshotArtifacts, lt as zeroSpend, mt as withBudgetResources, nt as roundBoxMinutes, o as verifyAgentCandidateWorkspaceTree, ot as throwIfAborted, pt as resourceTelemetry, q as errorMessage, rt as sleep, st as unmeteredSpend, tt as randomUuid, u as verifyAgentCandidateWorkspaceArchive, ut as zeroTokenUsage, wt as isDeadlineAbortReason, xt as armDeadlineTimer } from "./workspace-streams-CcoARX4v.js";
|
|
4
4
|
import { runTaskQueue } from "./task-queue.js";
|
|
5
5
|
import { a as readCommittedJsonLines, n as isNoEntError, t as appendCommittedJsonLine } from "./jsonl-file-DBv31uPi.js";
|
|
6
6
|
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, d as assertRouterAutoDeclaration, f as assertRouterAutoResponse, g as observedModelMatchesDeclared, h as observedModelHasSnapshot, l as profileProviderModel, m as mergeObservedModelIdentity, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-CyCUwHed.js";
|
|
@@ -3377,6 +3377,68 @@ function sandboxProgressEvents(event, state) {
|
|
|
3377
3377
|
}];
|
|
3378
3378
|
return [];
|
|
3379
3379
|
}
|
|
3380
|
+
/**
|
|
3381
|
+
* Collect one turn's events, keeping only the newest snapshot of each streamed text or
|
|
3382
|
+
* reasoning part.
|
|
3383
|
+
*
|
|
3384
|
+
* opencode sends `message.part.updated` once per token, and every frame carries the part's
|
|
3385
|
+
* whole cumulative text, so keeping every frame holds O(L²) bytes per turn: two concurrent
|
|
3386
|
+
* audit workflows took the platform API from 459 MB to an OOM at 1.95 GB in 11 minutes.
|
|
3387
|
+
* A snapshot (a frame whose part carries `text`) whose text extends the previous snapshot
|
|
3388
|
+
* of the same part replaces it and moves to the newest position, which is the rule the
|
|
3389
|
+
* Sandbox SDK's text collectors already apply, so the collected text is unchanged. The kept
|
|
3390
|
+
* frame drops its `delta`, because its text already holds every earlier increment and a
|
|
3391
|
+
* reader that joins `delta ?? part.text` across frames would otherwise read only the last
|
|
3392
|
+
* one. Delta-only frames and every other event are kept as they arrived.
|
|
3393
|
+
*/
|
|
3394
|
+
function createSandboxTurnEventCollector() {
|
|
3395
|
+
const slots = [];
|
|
3396
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
3397
|
+
return {
|
|
3398
|
+
push(event) {
|
|
3399
|
+
const snapshot = partSnapshot(event);
|
|
3400
|
+
if (!snapshot) {
|
|
3401
|
+
slots.push(event);
|
|
3402
|
+
return;
|
|
3403
|
+
}
|
|
3404
|
+
const previous = snapshots.get(snapshot.key);
|
|
3405
|
+
const extends_ = previous !== void 0 && snapshot.text.startsWith(previous.text);
|
|
3406
|
+
if (extends_) slots[previous.at] = void 0;
|
|
3407
|
+
snapshots.set(snapshot.key, {
|
|
3408
|
+
at: slots.length,
|
|
3409
|
+
text: snapshot.text
|
|
3410
|
+
});
|
|
3411
|
+
slots.push(extends_ ? withoutDelta(event) : event);
|
|
3412
|
+
},
|
|
3413
|
+
events() {
|
|
3414
|
+
return slots.filter((event) => event !== void 0);
|
|
3415
|
+
}
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3418
|
+
function partSnapshot(event) {
|
|
3419
|
+
if (event?.type !== "message.part.updated") return void 0;
|
|
3420
|
+
const data = asRecord(event.data);
|
|
3421
|
+
const part = asRecord(data?.part) ?? asRecord(asRecord(data?.properties)?.part);
|
|
3422
|
+
if (!part || typeof part.id !== "string") return void 0;
|
|
3423
|
+
if (part.type !== "text" && part.type !== "reasoning" && part.type !== "thinking") return void 0;
|
|
3424
|
+
const text = typeof part.text === "string" ? part.text : typeof part.content === "string" ? part.content : void 0;
|
|
3425
|
+
return text === void 0 ? void 0 : {
|
|
3426
|
+
key: `${part.type}:${part.id}`,
|
|
3427
|
+
text
|
|
3428
|
+
};
|
|
3429
|
+
}
|
|
3430
|
+
function withoutDelta(event) {
|
|
3431
|
+
const data = asRecord(event.data);
|
|
3432
|
+
if (!data || !("delta" in data)) return event;
|
|
3433
|
+
const { delta: _delta, ...rest } = data;
|
|
3434
|
+
return {
|
|
3435
|
+
...event,
|
|
3436
|
+
data: rest
|
|
3437
|
+
};
|
|
3438
|
+
}
|
|
3439
|
+
function asRecord(value) {
|
|
3440
|
+
return value !== null && typeof value === "object" ? value : void 0;
|
|
3441
|
+
}
|
|
3380
3442
|
//#endregion
|
|
3381
3443
|
//#region src/runtime/supervise/trace-root.ts
|
|
3382
3444
|
/**
|
|
@@ -4848,18 +4910,18 @@ const promptControlProfileMaterialization = defineProfileMaterializationContract
|
|
|
4848
4910
|
"metadata"
|
|
4849
4911
|
]
|
|
4850
4912
|
});
|
|
4851
|
-
/** Sandbox carries every canonical profile leaf except proxySecrets until its Interface does. */
|
|
4852
|
-
const sandboxProfileMaterialization = defineProfileMaterializationContract({
|
|
4853
|
-
name: "sandbox-profile-execution",
|
|
4854
|
-
axes: AGENT_PROFILE_MATERIALIZATION_AXES.filter((axis) => axis !== "proxySecrets")
|
|
4855
|
-
});
|
|
4856
4913
|
/**
|
|
4857
|
-
*
|
|
4858
|
-
*
|
|
4914
|
+
* Materialization contract for `createSandboxAct`.
|
|
4915
|
+
*
|
|
4916
|
+
* `createSandboxAct` hands the whole `AgentProfile` to the sandbox as `backend.profile`, so every
|
|
4917
|
+
* profile leaf crosses the boundary. `buildBackendOptions` resolves the runner only from
|
|
4918
|
+
* `profile.harness`; an explicit `sandboxOverrides.backend.type` may confirm that choice but cannot
|
|
4919
|
+
* replace it. A candidate declaring a harness the sandbox cannot run throws rather than running
|
|
4920
|
+
* elsewhere and reporting success.
|
|
4859
4921
|
*/
|
|
4860
4922
|
const sandboxActProfileMaterialization = defineProfileMaterializationContract({
|
|
4861
4923
|
name: "createSandboxAct",
|
|
4862
|
-
axes:
|
|
4924
|
+
axes: fullProfileMaterialization.axes
|
|
4863
4925
|
});
|
|
4864
4926
|
/** Materialization contract for a run path that only injects prompt text. */
|
|
4865
4927
|
const promptOnlyProfileMaterialization = defineProfileMaterializationContract({
|
|
@@ -12939,14 +13001,6 @@ const NATIVE_SETTLE_POLL_MS = 1e3;
|
|
|
12939
13001
|
const RETAINED_OBSERVATION_IDLE_MS = 8 * 6e4;
|
|
12940
13002
|
const RETAINED_RESULT_WAIT_MS = 6e4;
|
|
12941
13003
|
const RETAINED_OBSERVATION_BATCH_EVENTS = 1024;
|
|
12942
|
-
/**
|
|
12943
|
-
* After its exact result, a stream that still owes its terminal frame keeps reading only while its
|
|
12944
|
-
* frames keep coming: the next frame must arrive within this long of the last one. A quiet stream,
|
|
12945
|
-
* or one with no frame at all, closes on the result at once and never holds the wake. A provider
|
|
12946
|
-
* sends a turn's last frames and its result together on two connections, and a burst that
|
|
12947
|
-
* straddles the result is read whole.
|
|
12948
|
-
*/
|
|
12949
|
-
const RETAINED_TAIL_FLOW_MS = 100;
|
|
12950
13004
|
var RetainedReadTimeoutError = class extends Error {
|
|
12951
13005
|
constructor(label, ms) {
|
|
12952
13006
|
super(`retained provider ${label} did not settle within ${ms} ms`);
|
|
@@ -13532,29 +13586,9 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13532
13586
|
}
|
|
13533
13587
|
return exactResult;
|
|
13534
13588
|
};
|
|
13535
|
-
const exactWakers = /* @__PURE__ */ new Set();
|
|
13536
|
-
let exactWatched = false;
|
|
13537
|
-
const onExactResult = (waker) => {
|
|
13538
|
-
if (exactResultSettled) {
|
|
13539
|
-
waker();
|
|
13540
|
-
return () => {};
|
|
13541
|
-
}
|
|
13542
|
-
exactWakers.add(waker);
|
|
13543
|
-
if (!exactWatched) {
|
|
13544
|
-
exactWatched = true;
|
|
13545
|
-
const fire = () => {
|
|
13546
|
-
for (const wake of [...exactWakers]) wake();
|
|
13547
|
-
};
|
|
13548
|
-
readExactResult().then(fire, fire);
|
|
13549
|
-
}
|
|
13550
|
-
return () => {
|
|
13551
|
-
exactWakers.delete(waker);
|
|
13552
|
-
};
|
|
13553
|
-
};
|
|
13554
13589
|
let lastReplayPosition;
|
|
13555
13590
|
let sawTerminal = false;
|
|
13556
13591
|
let lastObservedAt = Date.now();
|
|
13557
|
-
let lastFrameAt;
|
|
13558
13592
|
const seenEvents = /* @__PURE__ */ new Map();
|
|
13559
13593
|
const drain = async function* (open) {
|
|
13560
13594
|
let iterator;
|
|
@@ -13575,23 +13609,12 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13575
13609
|
if (observedFrames > 0 && observedFrames % RETAINED_OBSERVATION_BATCH_EVENTS === 0) await awaitAbortable$1(new Promise((resolve) => setImmediate$1(resolve)), signal);
|
|
13576
13610
|
let next;
|
|
13577
13611
|
let wake;
|
|
13578
|
-
let grace;
|
|
13579
|
-
let unwatch;
|
|
13580
13612
|
try {
|
|
13581
13613
|
const remaining = observationIdleMs - (Date.now() - lastObservedAt);
|
|
13582
13614
|
if (remaining <= 0) throw new RetainedReadTimeoutError("event stream", observationIdleMs);
|
|
13583
13615
|
const exactWake = new Promise((resolve) => {
|
|
13584
13616
|
wake = setImmediate$1(() => {
|
|
13585
|
-
|
|
13586
|
-
const flowing = sawTerminal || lastFrameAt === void 0 ? 0 : RETAINED_TAIL_FLOW_MS - (Date.now() - lastFrameAt);
|
|
13587
|
-
if (flowing <= 0) {
|
|
13588
|
-
resolve({ kind: "exact-result" });
|
|
13589
|
-
return;
|
|
13590
|
-
}
|
|
13591
|
-
grace = setTimeout(() => resolve({ kind: "exact-result" }), flowing);
|
|
13592
|
-
if (typeof grace.unref === "function") grace.unref();
|
|
13593
|
-
};
|
|
13594
|
-
unwatch = onExactResult(close);
|
|
13617
|
+
readExactResult().then(() => resolve({ kind: "exact-result" }), () => resolve({ kind: "exact-result" }));
|
|
13595
13618
|
});
|
|
13596
13619
|
});
|
|
13597
13620
|
const observed = await awaitRetainedRead(Promise.race([awaitAbortable$1(Promise.resolve().then(() => iterator.next()), signal).then((value) => ({
|
|
@@ -13610,8 +13633,6 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13610
13633
|
break;
|
|
13611
13634
|
} finally {
|
|
13612
13635
|
if (wake !== void 0) clearImmediate(wake);
|
|
13613
|
-
if (grace !== void 0) clearTimeout(grace);
|
|
13614
|
-
unwatch?.();
|
|
13615
13636
|
}
|
|
13616
13637
|
if (next.done) break;
|
|
13617
13638
|
observedFrames += 1;
|
|
@@ -13641,7 +13662,6 @@ async function providerExecutionSource(args, turn, signal) {
|
|
|
13641
13662
|
seenEvents.set(eventId, digest);
|
|
13642
13663
|
}
|
|
13643
13664
|
lastObservedAt = Date.now();
|
|
13644
|
-
lastFrameAt = lastObservedAt;
|
|
13645
13665
|
if (identity.cursor !== void 0) lastReplayPosition = identity.cursor;
|
|
13646
13666
|
else if (eventId !== void 0) lastReplayPosition = eventId;
|
|
13647
13667
|
if (isTerminalEnvironmentEvent(next.value)) sawTerminal = true;
|
|
@@ -15780,7 +15800,6 @@ function resolveBackendType(profile, override) {
|
|
|
15780
15800
|
*/
|
|
15781
15801
|
function buildBackendOptions(profile, overrides) {
|
|
15782
15802
|
assertExecutableAgentProfile(profile, "buildBackendOptions");
|
|
15783
|
-
assertSandboxProfileCompatibility(profile, "sandbox backend profile");
|
|
15784
15803
|
const base = overrides ?? {};
|
|
15785
15804
|
const overrideBackend = base.backend;
|
|
15786
15805
|
const overrideProvider = overrideBackend?.model?.provider;
|
|
@@ -16484,25 +16503,28 @@ async function executeIteration(args) {
|
|
|
16484
16503
|
parentIndex: args.parentIndex
|
|
16485
16504
|
}
|
|
16486
16505
|
});
|
|
16487
|
-
const
|
|
16488
|
-
slot.events = events;
|
|
16506
|
+
const collector = createSandboxTurnEventCollector();
|
|
16489
16507
|
const requestedModel = concreteProfileModel(spec.profile);
|
|
16490
16508
|
const requested = {
|
|
16491
16509
|
...spec.profile.model?.provider !== void 0 ? { provider: spec.profile.model.provider } : {},
|
|
16492
16510
|
...requestedModel !== void 0 ? { model: requestedModel } : {}
|
|
16493
16511
|
};
|
|
16494
16512
|
const outcomeTracker = createAgentRunOutcomeTracker();
|
|
16495
|
-
|
|
16496
|
-
|
|
16497
|
-
|
|
16498
|
-
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16513
|
+
try {
|
|
16514
|
+
for await (const event of stream) {
|
|
16515
|
+
collector.push(event);
|
|
16516
|
+
if (box !== void 0) args.evidenceTracker?.observe(box, event, source ? args.lineageState?.handles.get(args.item.index)?.sessionId : void 0);
|
|
16517
|
+
outcomeTracker.observe(event);
|
|
16518
|
+
notifySandboxEventObserver(event, args.ctx.onSandboxEvent, {
|
|
16519
|
+
iterationIndex: args.item.index,
|
|
16520
|
+
agentRunName: slot.agentRunName
|
|
16521
|
+
});
|
|
16522
|
+
const llmCall = usageLedger.observe(event, slot.agentRunName);
|
|
16523
|
+
if (llmCall) creditLlmCall(llmCall);
|
|
16524
|
+
assertSandboxServedModel(event, requested);
|
|
16525
|
+
}
|
|
16526
|
+
} finally {
|
|
16527
|
+
slot.events = collector.events();
|
|
16506
16528
|
}
|
|
16507
16529
|
const harnessCall = usageLedger.settleTurn(slot.agentRunName);
|
|
16508
16530
|
if (harnessCall) creditLlmCall(harnessCall);
|
|
@@ -16512,7 +16534,7 @@ async function executeIteration(args) {
|
|
|
16512
16534
|
slot.tokenUsage.tokensKnown = false;
|
|
16513
16535
|
slot.costUsdKnown = false;
|
|
16514
16536
|
}
|
|
16515
|
-
slot.output = args.output.parse(events);
|
|
16537
|
+
slot.output = args.output.parse(slot.events);
|
|
16516
16538
|
const projection = projectSandboxOutcome(outcome);
|
|
16517
16539
|
if (projection.status === "failed") throw new Error(projection.reason);
|
|
16518
16540
|
if (projection.status === "completed" && args.validator) slot.verdict = await args.validator.validate(slot.output, {
|
|
@@ -24815,19 +24837,16 @@ function sumMeasuredSpendFromEvents(events) {
|
|
|
24815
24837
|
};
|
|
24816
24838
|
}
|
|
24817
24839
|
/** Restore the same journal projection and accounting for root and nested scopes. @internal */
|
|
24818
|
-
async function prepareScopeResume(opts, events, signal, now, parentId = opts.runId
|
|
24819
|
-
if (
|
|
24820
|
-
const prepared =
|
|
24821
|
-
events,
|
|
24822
|
-
recoveries: []
|
|
24823
|
-
} : await prepareInterruptedExecutors(opts, events, signal, now, parentId);
|
|
24840
|
+
async function prepareScopeResume(opts, events, signal, now, parentId = opts.runId) {
|
|
24841
|
+
if (parentId === opts.runId && await healReleasedSlots(opts, signal, now) > 0) events = await opts.journal.loadTree(opts.runId) ?? events;
|
|
24842
|
+
const prepared = await prepareInterruptedExecutors(opts, events, signal, now, parentId);
|
|
24824
24843
|
const prior = prepared.events;
|
|
24825
24844
|
const recovering = new Set(prepared.recoveries.map((item) => item.spawned.id));
|
|
24826
24845
|
const measuredEvents = prior.filter((event) => event.kind !== "metered" && event.kind !== "reconciled" || !recovering.has(event.id));
|
|
24827
24846
|
const measured = sumMeasuredSpendFromEvents(measuredEvents);
|
|
24828
24847
|
const hasCommittedEvidence = measuredEvents.some((event) => event.kind === "metered" || event.kind === "reconciled" || event.kind === "settled" || event.kind === "cancelled");
|
|
24829
24848
|
const settled = await replaySpawnTree(opts.journal, opts.blobs, opts.runId);
|
|
24830
|
-
|
|
24849
|
+
signal.throwIfAborted();
|
|
24831
24850
|
return {
|
|
24832
24851
|
poolRestore: {
|
|
24833
24852
|
...hasCommittedEvidence ? { committed: addSpend(measured.childWork, measured.driverInference) } : {},
|
|
@@ -26345,12 +26364,7 @@ async function reconcileOwnerWorkspaceBeforeReuse(state, signal) {
|
|
|
26345
26364
|
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");
|
|
26346
26365
|
const controlRef = dispatched.controlRef;
|
|
26347
26366
|
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");
|
|
26348
|
-
const
|
|
26349
|
-
const lookupBound = AbortSignal.timeout(lookupMs);
|
|
26350
|
-
const environment = await runAbortable(() => provider.get(environmentId), AbortSignal.any([signal, lookupBound]), "accepted workspace source lookup aborted").catch((error) => {
|
|
26351
|
-
if (lookupBound.aborted && !signal.aborted) throw new Error(`accepted workspace source lookup timed out after ${lookupMs} ms`);
|
|
26352
|
-
throw error;
|
|
26353
|
-
});
|
|
26367
|
+
const environment = await runAbortable(() => provider.get(environmentId), AbortSignal.any([signal, AbortSignal.timeout(Math.min(3e4, capture.port.timeoutMs))]), "accepted workspace source lookup timed out");
|
|
26354
26368
|
if (environment === null || environment.id !== environmentId || environment.provider !== provider.name) throw new Error("accepted workspace source is unavailable");
|
|
26355
26369
|
const identity = ownerCaptureIdentity(attempt, args);
|
|
26356
26370
|
const context = {
|
|
@@ -31044,8 +31058,7 @@ function createSupervisor() {
|
|
|
31044
31058
|
else opts.signal?.addEventListener("abort", abortRecovery, { once: true });
|
|
31045
31059
|
let restored;
|
|
31046
31060
|
try {
|
|
31047
|
-
|
|
31048
|
-
restored = await prepareScopeResume(opts, prior, recoveryController.signal, now, opts.runId, cancelledAtEntry);
|
|
31061
|
+
restored = await prepareScopeResume(opts, prior, recoveryController.signal, now);
|
|
31049
31062
|
} finally {
|
|
31050
31063
|
opts.signal?.removeEventListener("abort", abortRecovery);
|
|
31051
31064
|
}
|
|
@@ -31761,6 +31774,6 @@ function isNonEmptySpend(s) {
|
|
|
31761
31774
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false || Object.values(s.resources ?? {}).some((resource) => resource.amount > 0 || !resource.known);
|
|
31762
31775
|
}
|
|
31763
31776
|
//#endregion
|
|
31764
|
-
export { environmentReader as $, InMemoryResultBlobStore as $i, readHarnessTranscript as $n, renderUnsupported as $r, DEFAULT_PEER_MAIL_LIMITS as $t, scopeOwnerExecutorNodeContext as A,
|
|
31777
|
+
export { environmentReader as $, InMemoryResultBlobStore as $i, readHarnessTranscript as $n, renderUnsupported as $r, DEFAULT_PEER_MAIL_LIMITS as $t, scopeOwnerExecutorNodeContext as A, settlementFailureCause as Ai, providerAsSandboxClient as An, captureWorktreeDiff as Ar, bindReusableExecutorExecutionId as At, consumeScopeRetainedOwnerResult as B, createSandboxTurnEventCollector as Bi, startRetainedRunInEnvironment as Bn, terminateProcessTreeAndConfirm as Br, createRouterTranscript as Bt, deriveNodeExecutionIdentity as C, defaultRedactor as Ca, executableAgentProfileSnapshot as Ci, assertBoxlessPromptOptions as Cn, createRuntimeEventCollector as Cr, checkVerdictOf as Ct, recordScopeOwnerMaterialization as D, promptOptionsFromAgentTurnInput as Da, abortError$1 as Di, LEAF_CONTINUATION_TASK as Dn, sanitizeRuntimeStreamEvent as Dr, failedItems as Dt, recordScopeOwnerDriverAttempt as E, promptFromAgentTurnInput as Ea, readSandboxOutcome as Ei, runBrainLoop as En, sanitizeKnowledgeReadinessReport as Er, expandQuestions as Et, seatExecutionProfile as F, TRACE_ROOT_SCHEMA as Fi, bridgeRuntimeAttachmentsKey as Fn, harnessInvocation as Fr, createExecutorRegistry as Ft, scopeRetainedOwnerContext as G, mapSandboxToolEvent as Gi, openSlotGroup as Gn, defineProfileMaterializationContract as Gr, workerTraceHeaders as Gt, prepareScopeRetainedOwnerSeatSwitch as H, extractLlmCallEvent as Hi, destroyInteractiveEnvironment as Hn, assertProfileMaterialization as Hr, WORKER_TRACE_PROPAGATION as Ht, abandonScopeRetainedOwnerInvocation as I, TRACE_SUMMARY_SCHEMA as Ii, bridgeStopSignalKey as In, harnessSupportsReasoningEffort as Ir, snapshotExecutorConfig as It, scopeRetainedOwnerResourceReader as J, sandboxProgressEvents as Ji, linkAbort as Jn, promptControlProfileMaterialization as Jr, DEFAULT_STALL_AFTER_MS as Jt, scopeRetainedOwnerJournalRoot as K, notifySandboxEventObserver as Ki, RunCancellationReason as Kn, fullProfileMaterialization as Kr, workerTraceSeamKey as Kt, beginScopeRetainedOwnerDrive as L, assertSandboxServedModel as Li, reconnectRetainedRun as Ln, localHarnessExecutable as Lr, createWorktreeCliExecutor as Lt, SeatChain as M, retainedExecutorSeamKey as Mi, createPushTraceSource as Mn, removeWorktree as Mr, cliInPlaceExecutor as Mt, SeatChainExhaustedError as N, unavailablePauseMs as Ni, decodeToolPart as Nn, DEFAULT_LOCAL_HARNESS as Nr, cliWorktreeExecutor as Nt, recordScopeOwnerPause as O, providerMessageText as Oa, awaitAbortable$1 as Oi, createAgentEnvironmentProviderRegistry as On, runSettledCommand as Or, passedItems as Ot, authoredSeatStages as P, unavailableSignalOfFailure as Pi, sandboxSessionTraceSource as Pn, LOCAL_HARNESSES as Pr, createExecutor as Pt, SPAWN_RESOURCE_PATH_MAX_BYTES as Q, FileSpawnJournal as Qi, persistHarnessTranscript as Qn, renderProfileMaterializationIssues as Qr, AUTHORITY_MARKERS as Qt, bindScopeRetainedOwnerEnvironmentId as R, canonicalStreamEventFromSandboxEvent as Ri, recoverRetainedRun as Rn, parseCodexTokenUsage as Rr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Rt, createScope as S, spendFromUsageTotals as Sa, unknownMaterializationReceipt as Si, captureBeforeDestroy as Sn, toOtelAttributes as Sr, bestComposite as St, meterRuntimeOwnedProviderAttempt as T, resolveRedactor as Ta, projectSandboxOutcome as Ti, routerBrain as Tn, sanitizeAgentRuntimeEvent as Tr, distillFindings as Tt, prepareScopeRetainedOwnerTask as U, isSandboxTerminalEvent as Ui, environmentGone as Un, assertProfileMaterializes as Ur, readWorkerTraceContext as Ut, noteScopeRetainedOwnerCoordination as V, createSandboxUsageLedger as Vi, retainedCreateMaterial as Vn, AGENT_PROFILE_MATERIALIZATION_AXES as Vr, createInPlaceCliExecutor as Vt, reconcileScopeRetainedOwnerEnvironment as W, mapSandboxEvent as Wi, createWorkerSlots as Wn, controlProfileMaterialization as Wr, workerTraceEnv as Wt, scopeRetainedOwnerResult as X, decodeHarnessUsage as Xi, captureHarnessTranscript as Xn, promptOnlyProfileMaterialization as Xr, readWorkerProgress as Xt, scopeRetainedOwnerRestorePoint as Y, sumSandboxUsage as Yi, runAbortable as Yn, promptModelProfileMaterialization as Yr, createActivityLog as Yt, scopeRetainedOwnerTurnEnded as Z, FileResultBlobStore as Zi, harnessTranscriptArtifact as Zn, promptResourceProfileMaterialization as Zr, createInbox as Zt, isDriverSpec as _, assertValidBudget as _a, runtimeOwnedExecutorMaterialization as _i, isTerminalDecision as _n, flatOtelSpan as _r, CONTINUATIONS_DIR as _t, collectDelivered as a, WORKER_TOOL_TRACE_SCHEMA_VERSION as aa, attestRuntimeOwnedScopeOwner as ai, peerMailVerbNames as an, priceTokens as ar, runtimeGraphMetadataKey as at, assertRecursiveReservationPolicy as b, newUsageTotals as ba, runtimeOwnedScopeOwnerRuntime as bi, acquireSandbox as bn, padSpanId as br, admitContinuationPolicy as bt, runTree as c, parseWorkerToolTraceArtifact as ca, finalizeRuntimeOwnedPendingExecutor as ci, bridgeAdmissionRefusal as cn, createPropagatingTraceEmitter as cr, readWorkerInteractiveBinding as ct, classifyDriverFailure as d, detachedFrozen as da, knownMaterializationReceipt as di, createCodexRolloutStoreReader as dn, traceContextToEnv as dr, startRetainedInteractiveRun as dt, InMemorySpawnJournal as ea, sandboxActProfileMaterialization as ei, PEER_MAIL_WIRE_KEY as en, resolveHarnessTranscriptCapture as er, hostDirectoryReader as et, runDriverWithRetry as f, detachedSnapshot as fa, newExecutionAttemptId as fi, harnessUsageIsEmpty as fn, buildLoopOtelSpans as fr, freeSlots as ft, driverExecutorFactory as g, ReservationWaitRefused as ga, runtimeOwnedExecutorExecutionBinding as gi, defaultSelectWinner as gn, createOtelExporter as gr, mapExecutorResult as gt, driverChild as h, BudgetReconcileFault as ha, runtimeOwnedDriveHarnessProviderEvidence as hi, createSandboxForSpec as hn, createOpenInferenceFileExporter as hr, gateOnDeliverable as ht, bestDelivered as i, replaySpawnTree as ia, attestRuntimeOwnedPendingExecutor as ii, peerMailTools as in, runCodeMode as ir, providerVisibleProfile as it, settledToIteration as j, registerRetainedExecutorPreparation as ji, resolveAgentEnvironmentProvider as jn, createWorktree as jr, captureReusableExecutorConfig as jt, restoreScopeOwnerAcceptedExecution as k, runtimeFailureCause as ki, providerAsExecutor as kn, runWorktreeHarness as kr, verdictFromJudgeScore as kt, DriverAttemptsExhaustedError as l, workerTraceAnalysisStore as la, inheritRuntimeOwnedExecutorAttestation as li, bridgeModelRouteRefusal as ln, mergeTraceEnv as lr, reconnectRetainedInteractiveRun as lt, upstreamUnavailableSignal as m, errMessage as ma, recordRuntimeOwnedDriveHarnessProviderEvidence as mi, TERMINAL_DECISIONS as mn, buildRuntimeEventOtelSpans as mr, rollingDispatch as mt, createRootHandle as n, loadSpawnForest as na, validateProfileMaterialization as ni, createPeerMailbox as nn, createCodeModeTools as nr, coordinationMcpAlias as nt, pickBestDelivered as o, captureWorkerTraceEvidence as oa, authoredAgentIdentity as oi, isLiveNodeStatus as on, routerTokenPrice as or, interactiveAdmissionSeamKey as ot, summarizeDriverAttempts as p, executorFailure as pa, providerAttemptEvidence as pi, readCodexRolloutSession as pn, buildLoopSpanNodes as pr, queueOf as pt, scopeRetainedOwnerPriorSpend as q, sandboxEventServedBackend as qi, abortError as qn, profileMaterializationAxes$1 as qr, taskToPrompt as qt, createSupervisor as r, materializeTreeView as ra, worktreeCliProfileMaterialization as ri, isPeerMailEnvelope as rn, describeCodeModeTools as rr, coordinationProfileToolPrefix as rt, runFinalizer as s, isTraceAnalysisStore as sa, authoredProfileDigest as si, isTerminalNodeStatus as sn, ROUTER_PRICE_SOURCE as sr, attachWorker as st, DEFAULT_MAX_DEPTH as t, insideCursorNamespace as ta, unsupportedProfileDimensions as ti, claimsAuthority as tn, retainHarnessTranscript as tr, resolveSpawnResourcePaths as tt, HarnessTurnFailedError as u, contentAddress as ua, knownExecutionBindingReceipt as ui, addHarnessUsage as un, readTraceContextFromEnv as ur, recoverRetainedInteractiveRun as ut, withDriverExecutor as v, createBudgetPool as va, runtimeOwnedExecutorProviderEvidence as vi, runAgentRounds as vn, generateSpanId as vr, CONTINUATION_FACTS as vt, meterRuntimeOwnedAccounting as w, defaultRedactorIdentityMaterial as wa, executableAgentSpecSnapshot as wi, readPromptOptions as wn, createRuntimeStreamEventCollector as wr, createContinuationKeeper as wt, beginScopeOwnerAttempt as x, spendFromUsageEvents as xa, unknownExecutionBindingReceipt as xi, SandboxEvidenceRetentionError as xn, padTraceId as xr, admitFinding as xt, SUBTREE_RESULT_LIMIT as y, meterUsageEvent as ya, runtimeOwnedPendingExecutorMaterialization as yi, createSandboxLineage as yn, loopEventToOtelSpan as yr, CheckUnavailableError as yt, bindScopeRetainedOwnerProvider as z, createSandboxToolPartState as zi, startRetainedRun as zn, CodexExecutionDiagnosticError as zr, createSteerableSandboxSession as zt };
|
|
31765
31778
|
|
|
31766
|
-
//# sourceMappingURL=supervisor-
|
|
31779
|
+
//# sourceMappingURL=supervisor-Cwnf_e8V.js.map
|