@tangle-network/agent-runtime 0.141.0 → 0.141.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-4Aa3qXFV.js → activation-N3-XqXfZ.js} +2 -2
- package/dist/{activation-4Aa3qXFV.js.map → activation-N3-XqXfZ.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +3 -3
- package/dist/{analyst-loop-DtOEXGzR.js → analyst-loop-B1P_vE2a.js} +2 -2
- package/dist/{analyst-loop-DtOEXGzR.js.map → analyst-loop-B1P_vE2a.js.map} +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +1 -1
- package/dist/{authoring-Bzow2zKI.js → authoring-CgVh-A1V.js} +2 -2
- package/dist/{authoring-Bzow2zKI.js.map → authoring-CgVh-A1V.js.map} +1 -1
- package/dist/{conversation-C3eZCvLd.js → conversation-BXU1X8G2.js} +2 -2
- package/dist/{conversation-C3eZCvLd.js.map → conversation-BXU1X8G2.js.map} +1 -1
- package/dist/conversation.d.ts +1 -1
- package/dist/conversation.js +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +1 -1
- package/dist/{environment-provider-BAO8wt1_.js → environment-provider-BEU4devP.js} +2 -2
- package/dist/{environment-provider-BAO8wt1_.js.map → environment-provider-BEU4devP.js.map} +1 -1
- package/dist/{environment-provider-B985TeIr.d.ts → environment-provider-BicwCDK5.d.ts} +3 -3
- package/dist/environment-provider.d.ts +1 -1
- package/dist/environment-provider.js +1 -1
- package/dist/{graph-BHR5SFUh.js → graph-BrNGDPE9.js} +2 -2
- package/dist/{graph-BHR5SFUh.js.map → graph-BrNGDPE9.js.map} +1 -1
- package/dist/{improvement-cycle-H_27-d1O.js → improvement-cycle-OHQFP_Gk.js} +5 -5
- package/dist/{improvement-cycle-H_27-d1O.js.map → improvement-cycle-OHQFP_Gk.js.map} +1 -1
- package/dist/{index-CTI6v7V6.d.ts → index-CV1xRWy2.d.ts} +3 -3
- package/dist/{index-D4dUTLcs.d.ts → index-Dn1p6Mm-.d.ts} +65 -7
- package/dist/{index-Y7Wnmlip.d.ts → index-eYcsB_kL.d.ts} +4 -4
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +5 -5
- package/dist/intelligence.js +4 -4
- package/dist/kernel.d.ts +7 -7
- package/dist/kernel.js +10 -10
- package/dist/{knowledge-C3qWCMJi.js → knowledge-BNyRMsXW.js} +3 -3
- package/dist/{knowledge-C3qWCMJi.js.map → knowledge-BNyRMsXW.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-Clm1wCGW.d.ts → loop-runner-bin-CnPlGIy8.d.ts} +3 -3
- package/dist/{loop-runner-bin-Cv-x6lzB.js → loop-runner-bin-WbQdnSrJ.js} +4 -4
- package/dist/{loop-runner-bin-Cv-x6lzB.js.map → loop-runner-bin-WbQdnSrJ.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 +5 -5
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-DabO2cOu.js → openai-tools-iVhY1_LQ.js} +2 -2
- package/dist/{openai-tools-DabO2cOu.js.map → openai-tools-iVhY1_LQ.js.map} +1 -1
- package/dist/{openai-tools-5p7xigAz.d.ts → openai-tools-t5-6h5bj.d.ts} +2 -2
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{redact-D1qhbHWB.d.ts → redact-B0gDSTZO.d.ts} +3 -3
- package/dist/{runtime-CMIt1tII.d.ts → runtime-htqI3fKL.d.ts} +4 -4
- package/dist/{runtime-Dy_u99XS.js → runtime-z3cnjg-G.js} +9 -9
- package/dist/{runtime-Dy_u99XS.js.map → runtime-z3cnjg-G.js.map} +1 -1
- package/dist/{sandbox-events-DPmXlcKw.js → sandbox-events-kbgcTyiC.js} +131 -6
- package/dist/sandbox-events-kbgcTyiC.js.map +1 -0
- package/dist/{stream-agent-turn-4kUH8Nnn.js → stream-agent-turn-CoY1-PSR.js} +2 -2
- package/dist/{stream-agent-turn-4kUH8Nnn.js.map → stream-agent-turn-CoY1-PSR.js.map} +1 -1
- package/dist/{stream-agent-turn-D8Jaq70U.d.ts → stream-agent-turn-Dfy12OjG.d.ts} +3 -3
- package/dist/{structural-rollout-sr5KFnq4.js → structural-rollout-BuS4N3Zi.js} +3 -3
- package/dist/{structural-rollout-sr5KFnq4.js.map → structural-rollout-BuS4N3Zi.js.map} +1 -1
- package/dist/{supervise-CqN9ThOr.js → supervise-D1YsxL5W.js} +2 -2
- package/dist/{supervise-CqN9ThOr.js.map → supervise-D1YsxL5W.js.map} +1 -1
- package/dist/{supervisor-3cq3UHmU.js → supervisor-eo3t-RFb.js} +104 -100
- package/dist/supervisor-eo3t-RFb.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +11 -11
- package/dist/{types-D9WBXD7G.d.ts → types-DZrBoBpN.d.ts} +3 -2
- package/dist/{types-CNGHfnk3.d.ts → types-_7w24mMg.d.ts} +2 -2
- package/package.json +10 -7
- package/dist/sandbox-events-DPmXlcKw.js.map +0 -1
- package/dist/supervisor-3cq3UHmU.js.map +0 -1
|
@@ -2,10 +2,10 @@ import { f as RuntimeRunStateError, m as ValidationError, r as BackendTransportE
|
|
|
2
2
|
import { t as detachedSnapshot } from "./snapshot-cK9K420n.js";
|
|
3
3
|
import { S as contentAddress, a as aggregateProviderModelEvidence, c as pendingWaits, g as runtimeOwnedNestedDriverTreeRoot, h as nestedDriverTreeRoot, l as replaySpawnTree, m as driverRuntime, o as loadSpawnForest, p as attestNestedDriverTreeOwner, s as materializeTreeView, v as captureWorkerTraceEvidence } from "./spawn-journal-D2HKUImC.js";
|
|
4
4
|
import { _ as zeroTokenUsage, a as hasCompleteCacheBreakdown, c as promptCacheTokenClasses, d as sleep, f as stringifySafe, g as withTimeout, h as usdEstimatedOf, i as deleteBoxSafe, l as randomSuffix, m as throwIfAborted, n as chargedTokens, p as throwAbort, r as cloneTokenUsage, s as mapWithConcurrency, t as addTokenUsage, u as randomUuid } from "./util-C1bv6yog.js";
|
|
5
|
-
import {
|
|
5
|
+
import { a as extractLlmCallEvent, c as notifySandboxEventObserver, n as assertSandboxServedModel, t as assertSandboxEventSucceeded } from "./sandbox-events-kbgcTyiC.js";
|
|
6
6
|
import { a as concreteProfileModel, l as resolveRouterRetryPolicy, o as profileBridgeWireModel, s as profileModelExecutionSettings, t as assertExecutableAgentProfile, u as agentHarness } from "./model-policy-DgRJIJse.js";
|
|
7
7
|
import { C as unknownExecutionBindingReceipt, E as executableAgentSpecSnapshot, S as runtimeOwnedScopeOwnerRuntime, T as executableAgentProfileSnapshot, a as authoredProfileDigest, b as runtimeOwnedExecutorProviderEvidence, c as knownExecutionBindingReceipt, f as recordRuntimeOwnedProviderAttemptStart, g as runtimeOwnedDeferredExecutorRuntime, h as recordRuntimeOwnedProviderModel, l as knownMaterializationReceipt, m as recordRuntimeOwnedProviderIdentityConflict, n as attestRuntimeOwnedExecutor, o as finalizeRuntimeOwnedPendingExecutor, p as recordRuntimeOwnedProviderDispatchNotStarted, r as attestRuntimeOwnedPendingExecutor, t as attestRuntimeOwnedDeferredExecutor, u as newExecutionAttemptId, v as runtimeOwnedExecutorExecutionBinding, w as unknownMaterializationReceipt, x as runtimeOwnedPendingExecutorMaterialization, y as runtimeOwnedExecutorMaterialization } from "./materialization-CrdcfWXp.js";
|
|
8
|
-
import { i as resolveAgentEnvironmentProvider, n as providerAsExecutor, r as providerAsSandboxClient } from "./environment-provider-
|
|
8
|
+
import { i as resolveAgentEnvironmentProvider, n as providerAsExecutor, r as providerAsSandboxClient } from "./environment-provider-BEU4devP.js";
|
|
9
9
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
10
10
|
import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentTurnInputSchema, REASONING_EFFORTS, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema } from "@tangle-network/agent-interface";
|
|
11
11
|
import { estimateCost, isModelPriced } from "@tangle-network/agent-eval";
|
|
@@ -4033,20 +4033,31 @@ function resolveBackendType(profile, override) {
|
|
|
4033
4033
|
}
|
|
4034
4034
|
/**
|
|
4035
4035
|
* Build `CreateSandboxOptions` for `profile`, merging `overrides` and setting
|
|
4036
|
-
* `backend.profile`.
|
|
4036
|
+
* `backend.profile`. The exact provider and model always ride the create
|
|
4037
|
+
* request as separate canonical fields; omitting either lets the sandbox select
|
|
4038
|
+
* an ambient default while Runtime records a different executed instrument.
|
|
4039
|
+
* Other model/server override fields pass through after identity validation.
|
|
4037
4040
|
*/
|
|
4038
4041
|
function buildBackendOptions(profile, overrides) {
|
|
4039
4042
|
assertExecutableAgentProfile(profile, "buildBackendOptions");
|
|
4040
4043
|
const base = overrides ?? {};
|
|
4041
4044
|
const overrideBackend = base.backend;
|
|
4045
|
+
const overrideProvider = overrideBackend?.model?.provider;
|
|
4042
4046
|
const overrideModel = overrideBackend?.model?.model;
|
|
4047
|
+
const profileProvider = profile.model?.provider?.trim();
|
|
4043
4048
|
const profileModel = concreteProfileModel(profile);
|
|
4049
|
+
if (overrideProvider !== void 0 && overrideProvider !== profileProvider) throw new Error(`buildBackendOptions: backend provider ${JSON.stringify(overrideProvider)} conflicts with AgentProfile provider ${JSON.stringify(profileProvider)}`);
|
|
4044
4050
|
if (overrideModel !== void 0 && overrideModel !== profileModel) throw new Error(`buildBackendOptions: backend model ${JSON.stringify(overrideModel)} conflicts with AgentProfile model ${JSON.stringify(profileModel)}`);
|
|
4045
4051
|
return {
|
|
4046
4052
|
...base,
|
|
4047
4053
|
backend: {
|
|
4048
4054
|
type: resolveBackendType(profile, overrideBackend),
|
|
4049
4055
|
profile,
|
|
4056
|
+
model: {
|
|
4057
|
+
...overrideBackend?.model,
|
|
4058
|
+
provider: profileProvider,
|
|
4059
|
+
model: profileModel
|
|
4060
|
+
},
|
|
4050
4061
|
...overrideBackend?.server ? { server: overrideBackend.server } : {}
|
|
4051
4062
|
}
|
|
4052
4063
|
};
|
|
@@ -4684,6 +4695,12 @@ async function executeIteration(args) {
|
|
|
4684
4695
|
}
|
|
4685
4696
|
});
|
|
4686
4697
|
const events = [];
|
|
4698
|
+
slot.events = events;
|
|
4699
|
+
const requestedModel = concreteProfileModel(spec.profile);
|
|
4700
|
+
const requested = {
|
|
4701
|
+
...spec.profile.model?.provider !== void 0 ? { provider: spec.profile.model.provider } : {},
|
|
4702
|
+
...requestedModel !== void 0 ? { model: requestedModel } : {}
|
|
4703
|
+
};
|
|
4687
4704
|
let sawLlmCall = false;
|
|
4688
4705
|
for await (const event of stream) {
|
|
4689
4706
|
events.push(event);
|
|
@@ -4691,6 +4708,8 @@ async function executeIteration(args) {
|
|
|
4691
4708
|
iterationIndex: args.item.index,
|
|
4692
4709
|
agentRunName: slot.agentRunName
|
|
4693
4710
|
});
|
|
4711
|
+
assertSandboxEventSucceeded(event);
|
|
4712
|
+
assertSandboxServedModel(event, requested);
|
|
4694
4713
|
const llmCall = extractLlmCallEvent(event, slot.agentRunName);
|
|
4695
4714
|
if (llmCall) {
|
|
4696
4715
|
sawLlmCall = true;
|
|
@@ -4714,7 +4733,6 @@ async function executeIteration(args) {
|
|
|
4714
4733
|
slot.tokenUsage.tokensKnown = false;
|
|
4715
4734
|
slot.costUsdKnown = false;
|
|
4716
4735
|
}
|
|
4717
|
-
slot.events = events;
|
|
4718
4736
|
slot.output = args.output.parse(events);
|
|
4719
4737
|
if (args.validator) slot.verdict = await args.validator.validate(slot.output, {
|
|
4720
4738
|
iteration: args.item.index,
|
|
@@ -5894,6 +5912,11 @@ function createSteerableSandboxSession(args) {
|
|
|
5894
5912
|
}
|
|
5895
5913
|
};
|
|
5896
5914
|
const promptOptions = readPromptOptions(args.loopCtx);
|
|
5915
|
+
const requestedModel = concreteProfileModel(args.profile);
|
|
5916
|
+
const requested = {
|
|
5917
|
+
...args.profile.model?.provider !== void 0 ? { provider: args.profile.model.provider } : {},
|
|
5918
|
+
...requestedModel !== void 0 ? { model: requestedModel } : {}
|
|
5919
|
+
};
|
|
5897
5920
|
const started = now();
|
|
5898
5921
|
const tokens = zeroTokenUsage();
|
|
5899
5922
|
let tokensKnown = true;
|
|
@@ -5943,6 +5966,8 @@ function createSteerableSandboxSession(args) {
|
|
|
5943
5966
|
} else events = await lineage.continue(handle, prompt, turnController.signal, promptOptions);
|
|
5944
5967
|
for await (const event of events) {
|
|
5945
5968
|
recordEvent(event);
|
|
5969
|
+
assertSandboxEventSucceeded(event);
|
|
5970
|
+
assertSandboxServedModel(event, requested);
|
|
5946
5971
|
const call = extractLlmCallEvent(event, spec.name ?? String(args.harness));
|
|
5947
5972
|
if (!call) continue;
|
|
5948
5973
|
sawLlmCall = true;
|
|
@@ -9505,6 +9530,75 @@ function mergeAbortSignals(...signals) {
|
|
|
9505
9530
|
return c.signal;
|
|
9506
9531
|
}
|
|
9507
9532
|
//#endregion
|
|
9533
|
+
//#region src/runtime/supervise/abortable.ts
|
|
9534
|
+
/**
|
|
9535
|
+
* One abort race for the supervision tree.
|
|
9536
|
+
*
|
|
9537
|
+
* Every layer that can be cancelled needs the same two things: an `AbortError` that
|
|
9538
|
+
* carries the signal's own reason, and a settle-once race between the work and the
|
|
9539
|
+
* signal. Written per layer, the race drifts — the listener stops being removed on
|
|
9540
|
+
* one path, or a late resolution overwrites a cancellation that already won.
|
|
9541
|
+
*
|
|
9542
|
+
* The fallback message is the only thing a layer supplies, so the error still names
|
|
9543
|
+
* which layer cancelled.
|
|
9544
|
+
*/
|
|
9545
|
+
/** An `AbortError` carrying the signal's own string reason, or `fallback` when it states none. */
|
|
9546
|
+
function abortError(signal, fallback) {
|
|
9547
|
+
const reason = signal.reason;
|
|
9548
|
+
const error = new Error(typeof reason === "string" && reason.length > 0 ? reason : fallback);
|
|
9549
|
+
error.name = "AbortError";
|
|
9550
|
+
return error;
|
|
9551
|
+
}
|
|
9552
|
+
/**
|
|
9553
|
+
* Settle `act()` against `signal`. The first outcome wins and the listener is always
|
|
9554
|
+
* removed, so neither a late resolution nor a late abort can settle the promise twice.
|
|
9555
|
+
* The losing promise stays observed, so a late rejection cannot surface as an unhandled
|
|
9556
|
+
* process error.
|
|
9557
|
+
*
|
|
9558
|
+
* The abort rejection is deferred one microtask so a result the action had ALREADY
|
|
9559
|
+
* produced still wins. It does not hand the race to a listener the action registers
|
|
9560
|
+
* from inside `act()`: this function subscribes before it calls `act()`, so its own
|
|
9561
|
+
* abort handler runs first and settles the promise. A caller that must let the action
|
|
9562
|
+
* observe the abort itself has to hold a live promise and await that instead.
|
|
9563
|
+
*
|
|
9564
|
+
* A synchronous throw from `act()` propagates as the rejection, not as an abort.
|
|
9565
|
+
*/
|
|
9566
|
+
async function runAbortable(act, signal, fallback) {
|
|
9567
|
+
if (signal.aborted) throw abortError(signal, fallback);
|
|
9568
|
+
return await new Promise((resolve, reject) => {
|
|
9569
|
+
let settled = false;
|
|
9570
|
+
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
9571
|
+
const onAbort = () => {
|
|
9572
|
+
queueMicrotask(() => {
|
|
9573
|
+
if (settled) return;
|
|
9574
|
+
settled = true;
|
|
9575
|
+
cleanup();
|
|
9576
|
+
reject(abortError(signal, fallback));
|
|
9577
|
+
});
|
|
9578
|
+
};
|
|
9579
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
9580
|
+
let work;
|
|
9581
|
+
try {
|
|
9582
|
+
work = Promise.resolve(act());
|
|
9583
|
+
} catch (error) {
|
|
9584
|
+
cleanup();
|
|
9585
|
+
reject(error);
|
|
9586
|
+
return;
|
|
9587
|
+
}
|
|
9588
|
+
work.then((value) => {
|
|
9589
|
+
if (settled) return;
|
|
9590
|
+
settled = true;
|
|
9591
|
+
cleanup();
|
|
9592
|
+
resolve(value);
|
|
9593
|
+
}, (error) => {
|
|
9594
|
+
if (settled) return;
|
|
9595
|
+
settled = true;
|
|
9596
|
+
cleanup();
|
|
9597
|
+
reject(error);
|
|
9598
|
+
});
|
|
9599
|
+
});
|
|
9600
|
+
}
|
|
9601
|
+
//#endregion
|
|
9508
9602
|
//#region src/runtime/supervise/budget.ts
|
|
9509
9603
|
/**
|
|
9510
9604
|
*
|
|
@@ -11417,7 +11511,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
|
|
|
11417
11511
|
};
|
|
11418
11512
|
try {
|
|
11419
11513
|
await executionReady;
|
|
11420
|
-
if (childAbort.signal.aborted) throw abortError(childAbort.signal);
|
|
11514
|
+
if (childAbort.signal.aborted) throw abortError(childAbort.signal, "execution aborted");
|
|
11421
11515
|
live.status = "running";
|
|
11422
11516
|
started = true;
|
|
11423
11517
|
const ran = executor.execute(task, childAbort.signal);
|
|
@@ -11687,7 +11781,7 @@ function preserveUnknownTelemetry(streamed, terminal) {
|
|
|
11687
11781
|
async function awaitAbortable(work, signal) {
|
|
11688
11782
|
if (signal.aborted) {
|
|
11689
11783
|
work.catch(() => void 0);
|
|
11690
|
-
throw abortError(signal);
|
|
11784
|
+
throw abortError(signal, "execution aborted");
|
|
11691
11785
|
}
|
|
11692
11786
|
return await new Promise((resolve, reject) => {
|
|
11693
11787
|
let settled = false;
|
|
@@ -11696,7 +11790,7 @@ async function awaitAbortable(work, signal) {
|
|
|
11696
11790
|
if (settled) return;
|
|
11697
11791
|
settled = true;
|
|
11698
11792
|
cleanup();
|
|
11699
|
-
reject(abortError(signal));
|
|
11793
|
+
reject(abortError(signal, "execution aborted"));
|
|
11700
11794
|
});
|
|
11701
11795
|
};
|
|
11702
11796
|
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
@@ -11714,12 +11808,6 @@ async function awaitAbortable(work, signal) {
|
|
|
11714
11808
|
});
|
|
11715
11809
|
});
|
|
11716
11810
|
}
|
|
11717
|
-
function abortError(signal) {
|
|
11718
|
-
const reason = signal.reason;
|
|
11719
|
-
const error = new Error(typeof reason === "string" && reason.length > 0 ? reason : "execution aborted");
|
|
11720
|
-
error.name = "AbortError";
|
|
11721
|
-
return error;
|
|
11722
|
-
}
|
|
11723
11811
|
function downRecord(reason, infra, trace, metered, providerModel) {
|
|
11724
11812
|
return {
|
|
11725
11813
|
kind: "down",
|
|
@@ -11847,7 +11935,7 @@ const driverExecutorFactory = (rawSpec, ctx) => {
|
|
|
11847
11935
|
scope: nestedScope
|
|
11848
11936
|
};
|
|
11849
11937
|
try {
|
|
11850
|
-
const out = await
|
|
11938
|
+
const out = await runAbortable(() => driver.act(task, nestedScope), controller.signal, "driver aborted");
|
|
11851
11939
|
await finalizeScopeOwnerMaterialization(nestedScope);
|
|
11852
11940
|
await closeActive("driver completed");
|
|
11853
11941
|
const events = await loadTreeEvents(journal, nestedRoot);
|
|
@@ -11927,47 +12015,6 @@ async function closeNestedScope(scope, controller, reason) {
|
|
|
11927
12015
|
const view = scope.view;
|
|
11928
12016
|
if (view.inFlight > 0 || view.waiting > 0) throw new ValidationError(`driverExecutor: nested cleanup left ${view.inFlight} running and ${view.waiting} waiting nodes`);
|
|
11929
12017
|
}
|
|
11930
|
-
async function driverActAbortable(act, signal) {
|
|
11931
|
-
if (signal.aborted) throw driverAbortError(signal);
|
|
11932
|
-
return await new Promise((resolve, reject) => {
|
|
11933
|
-
let settled = false;
|
|
11934
|
-
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
11935
|
-
const onAbort = () => {
|
|
11936
|
-
queueMicrotask(() => {
|
|
11937
|
-
if (settled) return;
|
|
11938
|
-
settled = true;
|
|
11939
|
-
cleanup();
|
|
11940
|
-
reject(driverAbortError(signal));
|
|
11941
|
-
});
|
|
11942
|
-
};
|
|
11943
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
11944
|
-
let work;
|
|
11945
|
-
try {
|
|
11946
|
-
work = Promise.resolve(act());
|
|
11947
|
-
} catch (error) {
|
|
11948
|
-
cleanup();
|
|
11949
|
-
reject(error);
|
|
11950
|
-
return;
|
|
11951
|
-
}
|
|
11952
|
-
work.then((value) => {
|
|
11953
|
-
if (settled) return;
|
|
11954
|
-
settled = true;
|
|
11955
|
-
cleanup();
|
|
11956
|
-
resolve(value);
|
|
11957
|
-
}, (error) => {
|
|
11958
|
-
if (settled) return;
|
|
11959
|
-
settled = true;
|
|
11960
|
-
cleanup();
|
|
11961
|
-
reject(error);
|
|
11962
|
-
});
|
|
11963
|
-
});
|
|
11964
|
-
}
|
|
11965
|
-
function driverAbortError(signal) {
|
|
11966
|
-
const reason = signal.reason;
|
|
11967
|
-
const error = new Error(typeof reason === "string" && reason.length > 0 ? reason : "driver aborted");
|
|
11968
|
-
error.name = "AbortError";
|
|
11969
|
-
return error;
|
|
11970
|
-
}
|
|
11971
12018
|
/** The nested tree's full event list — the one evidence the spend, verdict, AND driver-inference
|
|
11972
12019
|
* roll-ups read off the same journal the supervisor sums. */
|
|
11973
12020
|
async function loadTreeEvents(journal, nestedRoot) {
|
|
@@ -12581,7 +12628,7 @@ function createSupervisor() {
|
|
|
12581
12628
|
try {
|
|
12582
12629
|
actOutcome = {
|
|
12583
12630
|
ok: true,
|
|
12584
|
-
out: await runAbortable(() => rootAct(task, scope), controller.signal)
|
|
12631
|
+
out: await runAbortable(() => rootAct(task, scope), controller.signal, "supervisor aborted")
|
|
12585
12632
|
};
|
|
12586
12633
|
} catch (error) {
|
|
12587
12634
|
actOutcome = {
|
|
@@ -12819,49 +12866,6 @@ function boundedSettleGrace(graceMs, deadlineAtMs, now) {
|
|
|
12819
12866
|
async function drainCursor(scope) {
|
|
12820
12867
|
for (;;) if (await scope.next() === null) return;
|
|
12821
12868
|
}
|
|
12822
|
-
/** Race root policy execution against the same signal that stops every child. The losing promise
|
|
12823
|
-
* remains observed, so a late rejection cannot surface as an unhandled process error. */
|
|
12824
|
-
async function runAbortable(act, signal) {
|
|
12825
|
-
if (signal.aborted) throw supervisorAbortError(signal);
|
|
12826
|
-
return await new Promise((resolve, reject) => {
|
|
12827
|
-
let settled = false;
|
|
12828
|
-
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
12829
|
-
const onAbort = () => {
|
|
12830
|
-
queueMicrotask(() => {
|
|
12831
|
-
if (settled) return;
|
|
12832
|
-
settled = true;
|
|
12833
|
-
cleanup();
|
|
12834
|
-
reject(supervisorAbortError(signal));
|
|
12835
|
-
});
|
|
12836
|
-
};
|
|
12837
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
12838
|
-
let work;
|
|
12839
|
-
try {
|
|
12840
|
-
work = Promise.resolve(act());
|
|
12841
|
-
} catch (error) {
|
|
12842
|
-
cleanup();
|
|
12843
|
-
reject(error);
|
|
12844
|
-
return;
|
|
12845
|
-
}
|
|
12846
|
-
work.then((value) => {
|
|
12847
|
-
if (settled) return;
|
|
12848
|
-
settled = true;
|
|
12849
|
-
cleanup();
|
|
12850
|
-
resolve(value);
|
|
12851
|
-
}, (error) => {
|
|
12852
|
-
if (settled) return;
|
|
12853
|
-
settled = true;
|
|
12854
|
-
cleanup();
|
|
12855
|
-
reject(error);
|
|
12856
|
-
});
|
|
12857
|
-
});
|
|
12858
|
-
}
|
|
12859
|
-
function supervisorAbortError(signal) {
|
|
12860
|
-
const reason = signal.reason;
|
|
12861
|
-
const error = new Error(typeof reason === "string" && reason.length > 0 ? reason : "supervisor aborted");
|
|
12862
|
-
error.name = "AbortError";
|
|
12863
|
-
return error;
|
|
12864
|
-
}
|
|
12865
12869
|
/**
|
|
12866
12870
|
* The lifecycle cause of a no-winner, or `undefined` when the supervisor's own state proves
|
|
12867
12871
|
* nothing. Returning `undefined` rather than falling through to `all-children-down` is what lets
|
|
@@ -13041,4 +13045,4 @@ function isNonEmptySpend(s) {
|
|
|
13041
13045
|
//#endregion
|
|
13042
13046
|
export { createInbox as $, AGENT_PROFILE_MATERIALIZATION_AXES as $t, createBudgetPool as A, exportEvalRuns as At, WORKER_TRACE_PROPAGATION as B, sanitizeKnowledgeReadinessReport as Bt, effectiveConcurrency as C, traceContextToEnv as Ct, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as D, buildRuntimeEventOtelSpans as Dt, rollingDispatch as E, buildLoopSpanNodes as Et, cliWorktreeExecutor as F, padTraceId as Ft, DEFAULT_SANDBOX_STEERING_MAX_TURNS as G, createWorktree as Gt, workerTraceEnv as H, runSettledCommand as Ht, createExecutor as I, toOtelAttributes as It, decodeToolPart as J, LOCAL_HARNESSES as Jt, createSteerableSandboxSession as K, removeWorktree as Kt, createExecutorRegistry as L, createRuntimeEventCollector as Lt, bindReusableExecutorExecutionId as M, generateSpanId as Mt, bridgeStopSignalKey as N, loopEventToOtelSpan as Nt, teardownExecutor as O, createOpenInferenceFileExporter as Ot, captureReusableExecutorConfig as P, padSpanId as Pt, readWorkerProgress as Q, CodexExecutionDiagnosticError as Qt, snapshotExecutorConfig as R, createRuntimeStreamEventCollector as Rt, waitUntil as S, readTraceContextFromEnv as St, queueOf as T, buildLoopOtelSpans as Tt, workerTraceHeaders as U, runWorktreeHarness as Ut, readWorkerTraceContext as V, sanitizeRuntimeStreamEvent as Vt, workerTraceSeamKey as W, captureWorktreeDiff as Wt, DEFAULT_STALL_AFTER_MS as X, localHarnessExecutable as Xt, sandboxSessionTraceSource as Y, harnessSupportsReasoningEffort as Yt, createActivityLog as Z, parseCodexTokenUsage as Zt, createWaitProbes as _, runBrainLoop as _t, pickBestDelivered as a, promptControlProfileMaterialization as an, isPeerMailEnvelope as at, timerAt as b, createPropagatingTraceEmitter as bt, driverChild as c, promptResourceProfileMaterialization as cn, TERMINAL_DECISIONS as ct, deriveNodeExecutionIdentity as d, validateProfileMaterialization as dn, isTerminalDecision as dt, assertProfileMaterialization as en, AUTHORITY_MARKERS as et, meterRuntimeOwnedAccounting as f, worktreeCliProfileMaterialization as fn, runAgentRounds as ft, settledToIteration as g, routerBrain as gt, scopeOwnerExecutorNodeContext as h, acquireSandbox as ht, collectDelivered as i, profileMaterializationAxes$1 as in, createPeerMailbox as it, spendFromUsageEvents as j, flatOtelSpan as jt, assertValidBudget as k, createOtelExporter as kt, withDriverExecutor as l, renderProfileMaterializationIssues as ln, createSandboxForSpec as lt, recordScopeOwnerMaterialization as m, probeSandboxCapabilities as mt, createSupervisor as n, defineProfileMaterializationContract as nn, PEER_MAIL_WIRE_KEY as nt, runFinalizer as o, promptModelProfileMaterialization as on, peerMailTools as ot, meterRuntimeOwnedProviderAttempt as p, createSandboxLineage as pt, createPushTraceSource as q, DEFAULT_LOCAL_HARNESS as qt, bestDelivered as r, fullProfileMaterialization as rn, claimsAuthority as rt, runTree as s, promptOnlyProfileMaterialization as sn, peerMailVerbNames as st, createRootHandle as t, controlProfileMaterialization as tn, DEFAULT_PEER_MAIL_LIMITS as tt, createScope as u, sandboxActProfileMaterialization as un, defaultSelectWinner as ut, isWaitOutcome as v, canonicalObservedModel as vt, freeSlots as w, INTELLIGENCE_WIRE_VERSION as wt, validateWaitSpec as x, mergeTraceEnv as xt, pollFor as y, observedModelMatchesDeclared as yt, createWorktreeCliExecutor as z, sanitizeAgentRuntimeEvent as zt };
|
|
13043
13047
|
|
|
13044
|
-
//# sourceMappingURL=supervisor-
|
|
13048
|
+
//# sourceMappingURL=supervisor-eo3t-RFb.js.map
|