@tangle-network/agent-runtime 0.133.7 → 0.134.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-BeFr74qj.js → activation-BaxUkhEf.js} +3 -3
- package/dist/{activation-BeFr74qj.js.map → activation-BaxUkhEf.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{analyst-loop-C189F6v8.js → analyst-loop-BKWqQhVI.js} +2 -2
- package/dist/{analyst-loop-C189F6v8.js.map → analyst-loop-BKWqQhVI.js.map} +1 -1
- package/dist/analyst-loop.js +1 -1
- package/dist/{authoring-CxnWFZVk.js → authoring-BlbRLEOS.js} +2 -2
- package/dist/{authoring-CxnWFZVk.js.map → authoring-BlbRLEOS.js.map} +1 -1
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-_u2HIWeX.js → candidate-execution-CJRP9CcZ.js} +4 -4
- package/dist/{candidate-execution-_u2HIWeX.js.map → candidate-execution-CJRP9CcZ.js.map} +1 -1
- package/dist/{conversation-kPowfA_A.js → conversation-CrWcNPQg.js} +4 -4
- package/dist/{conversation-kPowfA_A.js.map → conversation-CrWcNPQg.js.map} +1 -1
- package/dist/conversation.d.ts +1 -1
- package/dist/conversation.js +1 -1
- package/dist/{environment-provider-DTJA4ZiM.js → environment-provider-CwvY-Zeq.js} +2 -2
- package/dist/{environment-provider-DTJA4ZiM.js.map → environment-provider-CwvY-Zeq.js.map} +1 -1
- package/dist/{environment-provider-B-w9VYcF.d.ts → environment-provider-qDOhdE9M.d.ts} +2 -2
- package/dist/environment-provider.d.ts +1 -1
- package/dist/environment-provider.js +1 -1
- package/dist/{errors-DRoXIc7E.js → errors-CVIDr7GQ.js} +9 -1
- package/dist/errors-CVIDr7GQ.js.map +1 -0
- package/dist/{graph-C_rMgoWQ.js → graph-CKNenH2a.js} +4 -4
- package/dist/{graph-C_rMgoWQ.js.map → graph-CKNenH2a.js.map} +1 -1
- package/dist/{improvement-cycle-BBH8oYiA.js → improvement-cycle-CSBantKB.js} +9 -9
- package/dist/{improvement-cycle-BBH8oYiA.js.map → improvement-cycle-CSBantKB.js.map} +1 -1
- package/dist/{index-DqJa9jGF.d.ts → index-CgBJtAzI.d.ts} +2 -2
- package/dist/{index-DLjXduyp.d.ts → index-Cz4qKBxm.d.ts} +4 -4
- package/dist/{index-kMp8g-jT.d.ts → index-De10l_EU.d.ts} +66 -6
- package/dist/index.d.ts +7 -7
- package/dist/index.js +14 -14
- package/dist/intelligence.d.ts +4 -4
- package/dist/intelligence.js +6 -6
- package/dist/kernel.d.ts +6 -6
- package/dist/kernel.js +11 -11
- package/dist/{knowledge-DubRihOP.js → knowledge-B2C9t1Z4.js} +7 -7
- package/dist/{knowledge-DubRihOP.js.map → knowledge-B2C9t1Z4.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-CMKMWSH6.js → loop-runner-bin-C0ymKYU7.js} +5 -5
- package/dist/{loop-runner-bin-CMKMWSH6.js.map → loop-runner-bin-C0ymKYU7.js.map} +1 -1
- package/dist/{loop-runner-bin-CC5c39zY.d.ts → loop-runner-bin-D-tgbSPx.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/{materialization-D2bdTfkK.js → materialization-BP5zspr2.js} +25 -10
- package/dist/materialization-BP5zspr2.js.map +1 -0
- package/dist/mcp/bin.js +4 -4
- package/dist/mcp/index.d.ts +3 -3
- package/dist/mcp/index.js +9 -9
- package/dist/mcp/memory-bin.js +1 -1
- package/dist/{memory-server-CblxrUKT.js → memory-server-Cdpy7Uu8.js} +3 -3
- package/dist/{memory-server-CblxrUKT.js.map → memory-server-Cdpy7Uu8.js.map} +1 -1
- package/dist/{model-policy-Bv1DU2fw.js → model-policy-UTTc9Z-A.js} +2 -2
- package/dist/{model-policy-Bv1DU2fw.js.map → model-policy-UTTc9Z-A.js.map} +1 -1
- package/dist/{openai-tools-DrQwA-X_.js → openai-tools-ClOkPIi0.js} +2 -2
- package/dist/{openai-tools-DrQwA-X_.js.map → openai-tools-ClOkPIi0.js.map} +1 -1
- package/dist/{prepare-DUbH3GD5.js → prepare-BXEtLOj9.js} +2 -2
- package/dist/{prepare-DUbH3GD5.js.map → prepare-BXEtLOj9.js.map} +1 -1
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/profiles.js +1 -1
- package/dist/{protected-model-port-DP7MS63a.js → protected-model-port-B7PAmTGi.js} +2 -2
- package/dist/{protected-model-port-DP7MS63a.js.map → protected-model-port-B7PAmTGi.js.map} +1 -1
- package/dist/{redact-BSD-nvTf.d.ts → redact-6UE6pdNi.d.ts} +3 -3
- package/dist/{researcher-BiWSFLi6.js → researcher-DBfKdnAz.js} +3 -3
- package/dist/{researcher-BiWSFLi6.js.map → researcher-DBfKdnAz.js.map} +1 -1
- package/dist/{runtime-VwxvxGN7.js → runtime-Bisfbn3_.js} +102 -25
- package/dist/runtime-Bisfbn3_.js.map +1 -0
- package/dist/{runtime-D-26vxJt.d.ts → runtime-DlxoqEj2.d.ts} +27 -6
- package/dist/{snapshot-DY6VGliG.js → snapshot-BOIprwBk.js} +2 -2
- package/dist/{snapshot-DY6VGliG.js.map → snapshot-BOIprwBk.js.map} +1 -1
- package/dist/{spawn-journal-BX3-4WDm.js → spawn-journal-B856eA8e.js} +27 -11
- package/dist/spawn-journal-B856eA8e.js.map +1 -0
- package/dist/{stream-agent-turn-NFWCv1X1.d.ts → stream-agent-turn-CJog3ebs.d.ts} +2 -2
- package/dist/{stream-agent-turn-D8YHY0oO.js → stream-agent-turn-CdIcf-bn.js} +4 -4
- package/dist/{stream-agent-turn-D8YHY0oO.js.map → stream-agent-turn-CdIcf-bn.js.map} +1 -1
- package/dist/{structural-rollout-eAj7HG0m.js → structural-rollout-DKEP5i__.js} +6 -6
- package/dist/{structural-rollout-eAj7HG0m.js.map → structural-rollout-DKEP5i__.js.map} +1 -1
- package/dist/{supervise-009CRDW1.js → supervise-DhghNvl6.js} +72 -40
- package/dist/supervise-DhghNvl6.js.map +1 -0
- package/dist/{supervisor-DNX8CXui.js → supervisor-CMlIOkJP.js} +89 -22
- package/dist/{supervisor-DNX8CXui.js.map → supervisor-CMlIOkJP.js.map} +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/{tool-server-VvSK1K3X.js → tool-server-Dh-NcbHr.js} +2 -2
- package/dist/{tool-server-VvSK1K3X.js.map → tool-server-Dh-NcbHr.js.map} +1 -1
- package/dist/{types-DJ7k6vHE.d.ts → types-D4BfurNs.d.ts} +9 -2
- package/dist/{util-Dr--8wAL.js → util-DD8bRWPL.js} +21 -2
- package/dist/util-DD8bRWPL.js.map +1 -0
- package/dist/{workspace-archive-WEbaLREb.js → workspace-archive-B5oJu5mZ.js} +2 -2
- package/dist/{workspace-archive-WEbaLREb.js.map → workspace-archive-B5oJu5mZ.js.map} +1 -1
- package/package.json +1 -1
- package/dist/errors-DRoXIc7E.js.map +0 -1
- package/dist/materialization-D2bdTfkK.js.map +0 -1
- package/dist/runtime-VwxvxGN7.js.map +0 -1
- package/dist/spawn-journal-BX3-4WDm.js.map +0 -1
- package/dist/supervise-009CRDW1.js.map +0 -1
- package/dist/util-Dr--8wAL.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { f as ValidationError, r as BackendTransportError, u as RuntimeRunStateError } from "./errors-
|
|
2
|
-
import { t as detachedSnapshot } from "./snapshot-
|
|
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-
|
|
4
|
-
import { c as
|
|
1
|
+
import { f as ValidationError, r as BackendTransportError, u as RuntimeRunStateError } from "./errors-CVIDr7GQ.js";
|
|
2
|
+
import { t as detachedSnapshot } from "./snapshot-BOIprwBk.js";
|
|
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-B856eA8e.js";
|
|
4
|
+
import { a as hasCompleteCacheBreakdown, c as randomSuffix, d as stringifySafe, f as throwAbort, h as zeroTokenUsage, i as deleteBoxSafe, l as randomUuid, m as withTimeout, n as chargedTokens, p as throwIfAborted, r as cloneTokenUsage, s as mapWithConcurrency, t as addTokenUsage, u as sleep } from "./util-DD8bRWPL.js";
|
|
5
5
|
import { a as notifySandboxEventObserver, n as extractLlmCallEvent } from "./sandbox-events-vIwmuPdl.js";
|
|
6
|
-
import { a as concreteProfileModel, l as resolveRouterRetryPolicy, o as profileBridgeWireModel, s as profileModelExecutionSettings, t as assertExecutableAgentProfile, u as agentHarness } from "./model-policy-
|
|
7
|
-
import { C as
|
|
8
|
-
import { i as resolveAgentEnvironmentProvider, n as providerAsExecutor, r as providerAsSandboxClient } from "./environment-provider-
|
|
6
|
+
import { a as concreteProfileModel, l as resolveRouterRetryPolicy, o as profileBridgeWireModel, s as profileModelExecutionSettings, t as assertExecutableAgentProfile, u as agentHarness } from "./model-policy-UTTc9Z-A.js";
|
|
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-BP5zspr2.js";
|
|
8
|
+
import { i as resolveAgentEnvironmentProvider, n as providerAsExecutor, r as providerAsSandboxClient } from "./environment-provider-CwvY-Zeq.js";
|
|
9
9
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-C7iJOWm3.js";
|
|
10
10
|
import { estimateCost, isModelPriced } from "@tangle-network/agent-eval";
|
|
11
11
|
import { AGENT_PROFILE_MATERIALIZATION_AXES, REASONING_EFFORTS, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, sha256DigestSchema } from "@tangle-network/agent-interface";
|
|
@@ -5976,6 +5976,9 @@ const routerSeamKey = "router";
|
|
|
5976
5976
|
const sandboxSeamKey = "sandbox";
|
|
5977
5977
|
const cliSeamKey = "cli";
|
|
5978
5978
|
const bridgeSeamKey = "bridge";
|
|
5979
|
+
/** Internal control seam used by Runtime-owned external supervisors. A completion request stops
|
|
5980
|
+
* the next bridge turn; it must not abort the paid request that is already streaming. */
|
|
5981
|
+
const bridgeStopSignalKey = "__bridge_stop_signal";
|
|
5979
5982
|
const maxBridgeTimeoutMs = 2147483647;
|
|
5980
5983
|
const bridgeModelCredentialHeader = "x-cli-bridge-model-credential";
|
|
5981
5984
|
const bridgeModelBaseUrlHeader = "x-cli-bridge-model-base-url";
|
|
@@ -6665,6 +6668,7 @@ const sandboxExecutor = (spec, ctx) => {
|
|
|
6665
6668
|
}
|
|
6666
6669
|
};
|
|
6667
6670
|
if (seam.steering) {
|
|
6671
|
+
if (seam.validator) throw new ValidationError("sandboxExecutor: validator is not representable with steering — the steerable session is not a runAgentRounds composition, so the score would be silently dropped");
|
|
6668
6672
|
const inbox = createInbox();
|
|
6669
6673
|
const session = createSteerableSandboxSession({
|
|
6670
6674
|
controller,
|
|
@@ -6716,6 +6720,7 @@ const sandboxExecutor = (spec, ctx) => {
|
|
|
6716
6720
|
maxIterations,
|
|
6717
6721
|
controller,
|
|
6718
6722
|
loopCtx: seam.loopCtx,
|
|
6723
|
+
...seam.validator ? { validator: seam.validator } : {},
|
|
6719
6724
|
traceEnv,
|
|
6720
6725
|
onArtifact: (a) => {
|
|
6721
6726
|
artifact = a;
|
|
@@ -6755,6 +6760,7 @@ async function* streamSandboxLeaf(args) {
|
|
|
6755
6760
|
driver: args.driver,
|
|
6756
6761
|
agentRun,
|
|
6757
6762
|
output: args.output,
|
|
6763
|
+
...args.validator ? { validator: args.validator } : {},
|
|
6758
6764
|
task: args.task,
|
|
6759
6765
|
maxIterations: args.maxIterations,
|
|
6760
6766
|
maxConcurrency: 1,
|
|
@@ -7007,6 +7013,7 @@ function bridgeProfileModel(profile, context) {
|
|
|
7007
7013
|
}
|
|
7008
7014
|
const bridgeExecutor = (spec, ctx) => {
|
|
7009
7015
|
const base = readSeam(ctx, bridgeSeamKey, "bridge");
|
|
7016
|
+
const stopSignal = readOptionalAbortSignal(ctx, bridgeStopSignalKey, "bridge");
|
|
7010
7017
|
const modelCredential = validateBridgeModelCredential(base.modelCredential, base.bridgeUrl, "bridgeExecutor");
|
|
7011
7018
|
const effectiveProfile = agentProfileSchema.parse(spec.profile);
|
|
7012
7019
|
const model = bridgeProfileModel(effectiveProfile, "bridgeExecutor");
|
|
@@ -7116,6 +7123,7 @@ const bridgeExecutor = (spec, ctx) => {
|
|
|
7116
7123
|
return streamBridgeSession({
|
|
7117
7124
|
task,
|
|
7118
7125
|
signal,
|
|
7126
|
+
...stopSignal === void 0 ? {} : { stopSignal },
|
|
7119
7127
|
profile: effectiveProfile,
|
|
7120
7128
|
seam,
|
|
7121
7129
|
sessionId,
|
|
@@ -7130,6 +7138,7 @@ const bridgeExecutor = (spec, ctx) => {
|
|
|
7130
7138
|
trace.record(step);
|
|
7131
7139
|
},
|
|
7132
7140
|
onProviderAttemptStart: () => recordRuntimeOwnedProviderAttemptStart(executor),
|
|
7141
|
+
onProviderDispatchNotStarted: () => recordRuntimeOwnedProviderDispatchNotStarted(executor),
|
|
7133
7142
|
onProviderModel: (model) => recordRuntimeOwnedProviderModel(executor, model),
|
|
7134
7143
|
onProviderIdentityConflict: () => recordRuntimeOwnedProviderIdentityConflict(executor),
|
|
7135
7144
|
onArtifact: (a) => {
|
|
@@ -7290,6 +7299,10 @@ async function* streamBridgeSession(args) {
|
|
|
7290
7299
|
const promptCache = {};
|
|
7291
7300
|
let nextPrompt = taskToPrompt(args.task);
|
|
7292
7301
|
for (let t = 0; args.maxTurns === 0 || t < args.maxTurns; t += 1) {
|
|
7302
|
+
if (args.stopSignal?.aborted) {
|
|
7303
|
+
observation.note = "settled after completion request";
|
|
7304
|
+
break;
|
|
7305
|
+
}
|
|
7293
7306
|
const pending = inbox.drain();
|
|
7294
7307
|
if (pending.length) {
|
|
7295
7308
|
const folded = inbox.fold(pending);
|
|
@@ -7361,6 +7374,10 @@ async function* streamBridgeSession(args) {
|
|
|
7361
7374
|
}
|
|
7362
7375
|
};
|
|
7363
7376
|
try {
|
|
7377
|
+
if (args.stopSignal?.aborted) {
|
|
7378
|
+
observation.note = "settled after completion request";
|
|
7379
|
+
break;
|
|
7380
|
+
}
|
|
7364
7381
|
args.onProviderAttemptStart();
|
|
7365
7382
|
for await (const chunk of streamDurableBridgeRun({
|
|
7366
7383
|
seam,
|
|
@@ -7451,6 +7468,7 @@ async function* streamBridgeSession(args) {
|
|
|
7451
7468
|
publishProfileMaterialization();
|
|
7452
7469
|
} catch (error) {
|
|
7453
7470
|
publishProfileMaterialization();
|
|
7471
|
+
if (isTrustedPreProviderRejection(error)) args.onProviderDispatchNotStarted();
|
|
7454
7472
|
if (interruptSig.aborted && !args.signal.aborted && !args.controller.signal.aborted) {
|
|
7455
7473
|
if (!await cancelBridgeRunToTerminal(seam, activeRun, "infinity", external)) throw new ValidationError(`bridgeExecutor: interrupted run ${activeRun.id} did not reach terminal state`);
|
|
7456
7474
|
interrupted = true;
|
|
@@ -7483,6 +7501,10 @@ async function* streamBridgeSession(args) {
|
|
|
7483
7501
|
observation.note = `turn ${turns} interrupted, resuming`;
|
|
7484
7502
|
continue;
|
|
7485
7503
|
}
|
|
7504
|
+
if (args.stopSignal?.aborted) {
|
|
7505
|
+
observation.note = "settled after completion request";
|
|
7506
|
+
break;
|
|
7507
|
+
}
|
|
7486
7508
|
if (inbox.pending() === 0) break;
|
|
7487
7509
|
}
|
|
7488
7510
|
observation.note = "settled";
|
|
@@ -7548,9 +7570,11 @@ async function* streamDurableBridgeRun(args) {
|
|
|
7548
7570
|
}
|
|
7549
7571
|
if (!res.ok) {
|
|
7550
7572
|
const body = (await res.text()).slice(0, 300);
|
|
7573
|
+
const providerDispatch = providerDispatchFromErrorBody(body);
|
|
7551
7574
|
throw new BackendTransportError("bridge", `bridgeExecutor: bridge ${res.status}: ${body}`, {
|
|
7552
7575
|
status: res.status,
|
|
7553
|
-
body
|
|
7576
|
+
body,
|
|
7577
|
+
...providerDispatch === "not_started" ? { providerDispatch } : {}
|
|
7554
7578
|
});
|
|
7555
7579
|
}
|
|
7556
7580
|
if (!res.body) throw new ValidationError("bridgeExecutor: bridge response had no body to stream");
|
|
@@ -7803,6 +7827,27 @@ async function cancelBridgeRunToTerminal(seam, run, grace, stopSignal) {
|
|
|
7803
7827
|
function errorMessage(error) {
|
|
7804
7828
|
return error instanceof Error ? error.message : String(error);
|
|
7805
7829
|
}
|
|
7830
|
+
/** Only Router's exact one-sided fact proves that provider dispatch did not start. */
|
|
7831
|
+
function isTrustedPreProviderRejection(error) {
|
|
7832
|
+
return error instanceof BackendTransportError && error.providerDispatch === "not_started";
|
|
7833
|
+
}
|
|
7834
|
+
/** Read only the Router-owned one-sided field from an error body. */
|
|
7835
|
+
function providerDispatchFromErrorBody(body) {
|
|
7836
|
+
let parsed;
|
|
7837
|
+
try {
|
|
7838
|
+
parsed = JSON.parse(body);
|
|
7839
|
+
} catch {
|
|
7840
|
+
return;
|
|
7841
|
+
}
|
|
7842
|
+
if (typeof parsed !== "object" || parsed === null) return void 0;
|
|
7843
|
+
const error = parsed.error;
|
|
7844
|
+
if (typeof error !== "object" || error === null) return void 0;
|
|
7845
|
+
return error.provider_dispatch === "not_started" ? "not_started" : void 0;
|
|
7846
|
+
}
|
|
7847
|
+
function bridgeUpstreamError(error, prefix) {
|
|
7848
|
+
const providerDispatch = error.provider_dispatch === "not_started" ? "not_started" : void 0;
|
|
7849
|
+
return new BackendTransportError("bridge", `${prefix}: ${error.message ?? error.type ?? "unknown"}`, providerDispatch === void 0 ? void 0 : { providerDispatch });
|
|
7850
|
+
}
|
|
7806
7851
|
function mergeBridgeObservedModel(current, next) {
|
|
7807
7852
|
if (current === void 0 || current === next) return next;
|
|
7808
7853
|
const merged = mergeObservedModelIdentity(current, next);
|
|
@@ -8099,7 +8144,7 @@ function parseSseStreamTail(buf) {
|
|
|
8099
8144
|
} catch {
|
|
8100
8145
|
return;
|
|
8101
8146
|
}
|
|
8102
|
-
if (parsed.error) throw
|
|
8147
|
+
if (parsed.error) throw bridgeUpstreamError(parsed.error, "bridgeExecutor: bridge upstream error");
|
|
8103
8148
|
}
|
|
8104
8149
|
/** Parse one SSE frame into a numbered run event, terminal marker, or unnumbered keepalive. */
|
|
8105
8150
|
function parseSseFrame(frame) {
|
|
@@ -8134,7 +8179,7 @@ function parseSseFrame(frame) {
|
|
|
8134
8179
|
if (parsed.error) return {
|
|
8135
8180
|
kind: "event",
|
|
8136
8181
|
id,
|
|
8137
|
-
error:
|
|
8182
|
+
error: bridgeUpstreamError(parsed.error, "bridgeExecutor: bridge stream error")
|
|
8138
8183
|
};
|
|
8139
8184
|
const out = {};
|
|
8140
8185
|
if (parsed.model !== void 0) {
|
|
@@ -8513,14 +8558,19 @@ function snapshotExecutorConfig(config) {
|
|
|
8513
8558
|
"loopCtx",
|
|
8514
8559
|
"maxIterations",
|
|
8515
8560
|
"sandboxClient",
|
|
8516
|
-
"steering"
|
|
8561
|
+
"steering",
|
|
8562
|
+
"validator"
|
|
8517
8563
|
]), "createExecutor sandbox config");
|
|
8518
|
-
const { sandboxClient, loopCtx, ...decisionData } = config;
|
|
8564
|
+
const { sandboxClient, loopCtx, validator, ...decisionData } = config;
|
|
8565
|
+
const port = {
|
|
8566
|
+
sandboxClient,
|
|
8567
|
+
...validator === void 0 ? {} : { validator }
|
|
8568
|
+
};
|
|
8519
8569
|
if (loopCtx === void 0) {
|
|
8520
8570
|
const snapshot = detachedSnapshot(decisionData, "createExecutor sandbox config");
|
|
8521
8571
|
return Object.freeze({
|
|
8522
8572
|
...snapshot,
|
|
8523
|
-
|
|
8573
|
+
...port
|
|
8524
8574
|
});
|
|
8525
8575
|
}
|
|
8526
8576
|
const { hooks, traceEmitter, onSandboxEvent, runHandle, ...loopDecisionData } = loopCtx;
|
|
@@ -8531,7 +8581,7 @@ function snapshotExecutorConfig(config) {
|
|
|
8531
8581
|
const loopSnapshot = snapshot.loopCtx;
|
|
8532
8582
|
return Object.freeze({
|
|
8533
8583
|
...snapshot,
|
|
8534
|
-
|
|
8584
|
+
...port,
|
|
8535
8585
|
loopCtx: Object.freeze({
|
|
8536
8586
|
...loopSnapshot,
|
|
8537
8587
|
...hooks === void 0 ? {} : { hooks },
|
|
@@ -8747,6 +8797,12 @@ function readSeam(ctx, key, who) {
|
|
|
8747
8797
|
if (seam === void 0 || seam === null) throw new ValidationError(`${who} executor: missing required seam "${key}" on ExecutorContext`);
|
|
8748
8798
|
return seam;
|
|
8749
8799
|
}
|
|
8800
|
+
function readOptionalAbortSignal(ctx, key, who) {
|
|
8801
|
+
const value = ctx.seams[key];
|
|
8802
|
+
if (value === void 0) return void 0;
|
|
8803
|
+
if (value === null || typeof value !== "object" || typeof value.aborted !== "boolean" || typeof value.addEventListener !== "function") throw new ValidationError(`${who} executor: seam "${key}" must be an AbortSignal`);
|
|
8804
|
+
return value;
|
|
8805
|
+
}
|
|
8750
8806
|
/** A leaf task is opaque (`unknown`). A string is the prompt verbatim; an object
|
|
8751
8807
|
* with a `prompt`/`content`/`task` string field uses it; otherwise it serializes.
|
|
8752
8808
|
* Module-exported (not package surface) so sibling leaf executors read a task
|
|
@@ -8921,6 +8977,15 @@ function mergeAbortSignals(...signals) {
|
|
|
8921
8977
|
* spend, and refunds the unspent remainder to `free`. Tokens and usd are separate
|
|
8922
8978
|
* channels (`LoopTokenUsage` has no `usd`); iterations are conserved alongside them.
|
|
8923
8979
|
*
|
|
8980
|
+
* The token unit is `chargedTokens`: every token counted ONCE, when it first enters the context
|
|
8981
|
+
* (`freshInput + cacheWrite + output`). A cached prefix is re-presented content that was already
|
|
8982
|
+
* charged when it was written, so charging a cache read again would charge the same tokens twice —
|
|
8983
|
+
* on a real fleet cache is 98% of the rolled-up prompt total, which made a declared cap bite about
|
|
8984
|
+
* 56x early. No price weight enters the token channel; money is budgeted separately on `maxUsd`.
|
|
8985
|
+
* When a provider reports no usable cache split the pool keeps charging the rolled-up
|
|
8986
|
+
* `input + output` and marks `readout().cacheBreakdownKnown` false, so the balance reads as an
|
|
8987
|
+
* upper bound on newly-presented work rather than a measurement.
|
|
8988
|
+
*
|
|
8924
8989
|
* Pure and deterministic: `now()` is injected, there is no I/O, and no wall-clock or
|
|
8925
8990
|
* RNG read. A `reserve`/`reconcile` ticket is single-use (fail-loud on double or
|
|
8926
8991
|
* unknown reconcile) so a child can never refund twice. Reconciling an OPEN ticket always
|
|
@@ -9021,9 +9086,6 @@ async function foldUsage(events) {
|
|
|
9021
9086
|
ms: 0
|
|
9022
9087
|
};
|
|
9023
9088
|
}
|
|
9024
|
-
function totalTokens(usage) {
|
|
9025
|
-
return usage.input + usage.output;
|
|
9026
|
-
}
|
|
9027
9089
|
/**
|
|
9028
9090
|
* Create a conserved reservation pool from a root `Budget`. `now()` is injected so the
|
|
9029
9091
|
* deadline readout is deterministic; defaults to `Date.now` for non-test callers. The
|
|
@@ -9038,6 +9100,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9038
9100
|
let reservedTokens = 0;
|
|
9039
9101
|
let committedTokens = 0;
|
|
9040
9102
|
let tokensTainted = false;
|
|
9103
|
+
let cacheBreakdownTainted = false;
|
|
9041
9104
|
const usdCapped = root.maxUsd !== void 0;
|
|
9042
9105
|
let freeUsd = root.maxUsd ?? 0;
|
|
9043
9106
|
let reservedUsd = 0;
|
|
@@ -9103,7 +9166,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9103
9166
|
assertValidSpend(spent, `budget pool ticket ${ticket.id} spend`);
|
|
9104
9167
|
const { tokens: rTokens, usd: rUsd, iterations: rIterations } = ticket.reserved;
|
|
9105
9168
|
const unknownUnderCap = usdCapped && spent.usdKnown === false;
|
|
9106
|
-
const spentTokens =
|
|
9169
|
+
const spentTokens = chargedTokens(spent.tokens);
|
|
9107
9170
|
const usdBudgeted = ticket.reserved.usdBudgeted !== false;
|
|
9108
9171
|
let violation;
|
|
9109
9172
|
if (spentTokens > rTokens) violation = `ticket ${ticket.id} spent ${spentTokens} tokens > reserved ${rTokens}`;
|
|
@@ -9112,6 +9175,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9112
9175
|
else if (unknownUnderCap) violation = `ticket ${ticket.id} reported unknown dollar cost under a dollar-capped budget`;
|
|
9113
9176
|
open.delete(ticket.id);
|
|
9114
9177
|
if (spent.tokensKnown === false) tokensTainted = true;
|
|
9178
|
+
if (!hasCompleteCacheBreakdown(spent.tokens)) cacheBreakdownTainted = true;
|
|
9115
9179
|
if (spent.usdKnown === false) usdMeasured = false;
|
|
9116
9180
|
reservedTokens -= rTokens;
|
|
9117
9181
|
committedTokens += spentTokens;
|
|
@@ -9133,8 +9197,9 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9133
9197
|
assertValidSpend(spend, "observed spend");
|
|
9134
9198
|
if (usdCapped && spend.usdKnown === false) throw new ValidationError("budget pool: cannot observe unknown dollar cost under a dollar-capped budget");
|
|
9135
9199
|
if (spend.tokensKnown === false) tokensTainted = true;
|
|
9200
|
+
if (!hasCompleteCacheBreakdown(spend.tokens)) cacheBreakdownTainted = true;
|
|
9136
9201
|
if (spend.usdKnown === false) usdMeasured = false;
|
|
9137
|
-
const tokens =
|
|
9202
|
+
const tokens = chargedTokens(spend.tokens);
|
|
9138
9203
|
freeTokens -= tokens;
|
|
9139
9204
|
committedTokens += tokens;
|
|
9140
9205
|
freeIterations -= spend.iterations;
|
|
@@ -9146,6 +9211,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9146
9211
|
return {
|
|
9147
9212
|
tokensLeft: freeTokens,
|
|
9148
9213
|
tokensKnown: !tokensTainted,
|
|
9214
|
+
cacheBreakdownKnown: !cacheBreakdownTainted,
|
|
9149
9215
|
usdLeft: usdCapped ? usdTainted ? 0 : freeUsd : 0,
|
|
9150
9216
|
usdCapped,
|
|
9151
9217
|
usdKnown: usdMeasured && !usdTainted,
|
|
@@ -9161,8 +9227,9 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9161
9227
|
assertValidSpend(restore.committed, "budget restore committed");
|
|
9162
9228
|
const committed = restore.committed;
|
|
9163
9229
|
if (committed.tokensKnown === false) tokensTainted = true;
|
|
9230
|
+
if (!hasCompleteCacheBreakdown(committed.tokens)) cacheBreakdownTainted = true;
|
|
9164
9231
|
if (committed.usdKnown === false) usdMeasured = false;
|
|
9165
|
-
const tokens =
|
|
9232
|
+
const tokens = chargedTokens(committed.tokens);
|
|
9166
9233
|
freeTokens -= tokens;
|
|
9167
9234
|
committedTokens += tokens;
|
|
9168
9235
|
freeIterations -= committed.iterations;
|
|
@@ -12371,6 +12438,6 @@ function isNonEmptySpend(s) {
|
|
|
12371
12438
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false;
|
|
12372
12439
|
}
|
|
12373
12440
|
//#endregion
|
|
12374
|
-
export {
|
|
12441
|
+
export { createSandboxForSpec as $, sandboxActProfileMaterialization as $t, spendFromUsageEvents as A, sanitizeRuntimeStreamEvent as At, readWorkerTraceContext as B, parseCodexTokenUsage as Bt, freeSlots as C, padSpanId as Ct, teardownExecutor as D, createRuntimeStreamEventCollector as Dt, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as E, createRuntimeEventCollector as Et, createExecutor as F, removeWorktree as Ft, createSteerableSandboxSession as G, defineProfileMaterializationContract as Gt, workerTraceHeaders as H, AGENT_PROFILE_MATERIALIZATION_AXES as Ht, createExecutorRegistry as I, DEFAULT_LOCAL_HARNESS as It, sandboxSessionTraceSource as J, promptControlProfileMaterialization as Jt, createPushTraceSource as K, fullProfileMaterialization as Kt, snapshotExecutorConfig as L, LOCAL_HARNESSES as Lt, bridgeStopSignalKey as M, runWorktreeHarness as Mt, captureReusableExecutorConfig as N, captureWorktreeDiff as Nt, assertValidBudget as O, sanitizeAgentRuntimeEvent as Ot, cliWorktreeExecutor as P, createWorktree as Pt, createInbox as Q, renderProfileMaterializationIssues as Qt, createWorktreeCliExecutor as R, harnessSupportsReasoningEffort as Rt, effectiveConcurrency as S, loopEventToOtelSpan as St, rollingDispatch as T, toOtelAttributes as Tt, workerTraceSeamKey as U, assertProfileMaterialization as Ut, workerTraceEnv as V, CodexExecutionDiagnosticError as Vt, DEFAULT_SANDBOX_STEERING_MAX_TURNS as W, controlProfileMaterialization as Wt, createActivityLog as X, promptOnlyProfileMaterialization as Xt, DEFAULT_STALL_AFTER_MS as Y, promptModelProfileMaterialization as Yt, readWorkerProgress as Z, promptResourceProfileMaterialization as Zt, isWaitOutcome as _, createOpenInferenceFileExporter as _t, pickBestDelivered as a, routerBrain as at, validateWaitSpec as b, flatOtelSpan as bt, driverChild as c, observedModelMatchesDeclared as ct, deriveNodeExecutionIdentity as d, readTraceContextFromEnv as dt, validateProfileMaterialization as en, defaultSelectWinner as et, meterRuntimeOwnedProviderAttempt as f, traceContextToEnv as ft, createWaitProbes as g, buildRuntimeEventOtelSpans as gt, settledToIteration as h, buildLoopSpanNodes as ht, collectDelivered as i, acquireSandbox as it, bindReusableExecutorExecutionId as j, runSettledCommand as jt, createBudgetPool as k, sanitizeKnowledgeReadinessReport as kt, withDriverExecutor as l, createPropagatingTraceEmitter as lt, scopeOwnerExecutorNodeContext as m, buildLoopOtelSpans as mt, createSupervisor as n, createSandboxLineage as nt, runFinalizer as o, runBrainLoop as ot, recordScopeOwnerMaterialization as p, INTELLIGENCE_WIRE_VERSION as pt, decodeToolPart as q, profileMaterializationAxes$1 as qt, bestDelivered as r, probeSandboxCapabilities as rt, runTree as s, canonicalObservedModel as st, createRootHandle as t, worktreeCliProfileMaterialization as tn, runAgentRounds as tt, createScope as u, mergeTraceEnv as ut, pollFor as v, createOtelExporter as vt, queueOf as w, padTraceId as wt, waitUntil as x, generateSpanId as xt, timerAt as y, exportEvalRuns as yt, WORKER_TRACE_PROPAGATION as z, localHarnessExecutable as zt };
|
|
12375
12442
|
|
|
12376
|
-
//# sourceMappingURL=supervisor-
|
|
12443
|
+
//# sourceMappingURL=supervisor-CMlIOkJP.js.map
|