@tangle-network/agent-runtime 0.133.8 → 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-CbgOt7bK.js → activation-BaxUkhEf.js} +3 -3
- package/dist/{activation-CbgOt7bK.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-DI2ZcORJ.js → authoring-BlbRLEOS.js} +2 -2
- package/dist/{authoring-DI2ZcORJ.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-CnLcp2Tl.js → graph-CKNenH2a.js} +4 -4
- package/dist/{graph-CnLcp2Tl.js.map → graph-CKNenH2a.js.map} +1 -1
- package/dist/{improvement-cycle-ekj_ODWY.js → improvement-cycle-CSBantKB.js} +9 -9
- package/dist/{improvement-cycle-ekj_ODWY.js.map → improvement-cycle-CSBantKB.js.map} +1 -1
- package/dist/{index-DqJa9jGF.d.ts → index-CgBJtAzI.d.ts} +2 -2
- package/dist/{index-CP8LBWD1.d.ts → index-Cz4qKBxm.d.ts} +4 -4
- package/dist/{index-Cgo-tyB8.d.ts → index-De10l_EU.d.ts} +27 -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 +10 -10
- package/dist/{knowledge-BdJoVN9q.js → knowledge-B2C9t1Z4.js} +7 -7
- package/dist/{knowledge-BdJoVN9q.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-C1uQcY_O.js → loop-runner-bin-C0ymKYU7.js} +5 -5
- package/dist/{loop-runner-bin-C1uQcY_O.js.map → loop-runner-bin-C0ymKYU7.js.map} +1 -1
- package/dist/{loop-runner-bin-BX_266wJ.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-BTznyT19.js → openai-tools-ClOkPIi0.js} +2 -2
- package/dist/{openai-tools-BTznyT19.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-Br49sl8u.js → runtime-Bisfbn3_.js} +29 -14
- 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-C4_mifPH.js → structural-rollout-DKEP5i__.js} +6 -6
- package/dist/{structural-rollout-C4_mifPH.js.map → structural-rollout-DKEP5i__.js.map} +1 -1
- package/dist/{supervise-BTwl4Cdi.js → supervise-DhghNvl6.js} +55 -37
- package/dist/supervise-DhghNvl6.js.map +1 -0
- package/dist/{supervisor-BA87pb7g.js → supervisor-CMlIOkJP.js} +65 -21
- package/dist/supervisor-CMlIOkJP.js.map +1 -0
- 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-Br49sl8u.js.map +0 -1
- package/dist/spawn-journal-BX3-4WDm.js.map +0 -1
- package/dist/supervise-BTwl4Cdi.js.map +0 -1
- package/dist/supervisor-BA87pb7g.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";
|
|
@@ -6668,6 +6668,7 @@ const sandboxExecutor = (spec, ctx) => {
|
|
|
6668
6668
|
}
|
|
6669
6669
|
};
|
|
6670
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");
|
|
6671
6672
|
const inbox = createInbox();
|
|
6672
6673
|
const session = createSteerableSandboxSession({
|
|
6673
6674
|
controller,
|
|
@@ -6719,6 +6720,7 @@ const sandboxExecutor = (spec, ctx) => {
|
|
|
6719
6720
|
maxIterations,
|
|
6720
6721
|
controller,
|
|
6721
6722
|
loopCtx: seam.loopCtx,
|
|
6723
|
+
...seam.validator ? { validator: seam.validator } : {},
|
|
6722
6724
|
traceEnv,
|
|
6723
6725
|
onArtifact: (a) => {
|
|
6724
6726
|
artifact = a;
|
|
@@ -6758,6 +6760,7 @@ async function* streamSandboxLeaf(args) {
|
|
|
6758
6760
|
driver: args.driver,
|
|
6759
6761
|
agentRun,
|
|
6760
6762
|
output: args.output,
|
|
6763
|
+
...args.validator ? { validator: args.validator } : {},
|
|
6761
6764
|
task: args.task,
|
|
6762
6765
|
maxIterations: args.maxIterations,
|
|
6763
6766
|
maxConcurrency: 1,
|
|
@@ -7135,6 +7138,7 @@ const bridgeExecutor = (spec, ctx) => {
|
|
|
7135
7138
|
trace.record(step);
|
|
7136
7139
|
},
|
|
7137
7140
|
onProviderAttemptStart: () => recordRuntimeOwnedProviderAttemptStart(executor),
|
|
7141
|
+
onProviderDispatchNotStarted: () => recordRuntimeOwnedProviderDispatchNotStarted(executor),
|
|
7138
7142
|
onProviderModel: (model) => recordRuntimeOwnedProviderModel(executor, model),
|
|
7139
7143
|
onProviderIdentityConflict: () => recordRuntimeOwnedProviderIdentityConflict(executor),
|
|
7140
7144
|
onArtifact: (a) => {
|
|
@@ -7464,6 +7468,7 @@ async function* streamBridgeSession(args) {
|
|
|
7464
7468
|
publishProfileMaterialization();
|
|
7465
7469
|
} catch (error) {
|
|
7466
7470
|
publishProfileMaterialization();
|
|
7471
|
+
if (isTrustedPreProviderRejection(error)) args.onProviderDispatchNotStarted();
|
|
7467
7472
|
if (interruptSig.aborted && !args.signal.aborted && !args.controller.signal.aborted) {
|
|
7468
7473
|
if (!await cancelBridgeRunToTerminal(seam, activeRun, "infinity", external)) throw new ValidationError(`bridgeExecutor: interrupted run ${activeRun.id} did not reach terminal state`);
|
|
7469
7474
|
interrupted = true;
|
|
@@ -7565,9 +7570,11 @@ async function* streamDurableBridgeRun(args) {
|
|
|
7565
7570
|
}
|
|
7566
7571
|
if (!res.ok) {
|
|
7567
7572
|
const body = (await res.text()).slice(0, 300);
|
|
7573
|
+
const providerDispatch = providerDispatchFromErrorBody(body);
|
|
7568
7574
|
throw new BackendTransportError("bridge", `bridgeExecutor: bridge ${res.status}: ${body}`, {
|
|
7569
7575
|
status: res.status,
|
|
7570
|
-
body
|
|
7576
|
+
body,
|
|
7577
|
+
...providerDispatch === "not_started" ? { providerDispatch } : {}
|
|
7571
7578
|
});
|
|
7572
7579
|
}
|
|
7573
7580
|
if (!res.body) throw new ValidationError("bridgeExecutor: bridge response had no body to stream");
|
|
@@ -7820,6 +7827,27 @@ async function cancelBridgeRunToTerminal(seam, run, grace, stopSignal) {
|
|
|
7820
7827
|
function errorMessage(error) {
|
|
7821
7828
|
return error instanceof Error ? error.message : String(error);
|
|
7822
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
|
+
}
|
|
7823
7851
|
function mergeBridgeObservedModel(current, next) {
|
|
7824
7852
|
if (current === void 0 || current === next) return next;
|
|
7825
7853
|
const merged = mergeObservedModelIdentity(current, next);
|
|
@@ -8116,7 +8144,7 @@ function parseSseStreamTail(buf) {
|
|
|
8116
8144
|
} catch {
|
|
8117
8145
|
return;
|
|
8118
8146
|
}
|
|
8119
|
-
if (parsed.error) throw
|
|
8147
|
+
if (parsed.error) throw bridgeUpstreamError(parsed.error, "bridgeExecutor: bridge upstream error");
|
|
8120
8148
|
}
|
|
8121
8149
|
/** Parse one SSE frame into a numbered run event, terminal marker, or unnumbered keepalive. */
|
|
8122
8150
|
function parseSseFrame(frame) {
|
|
@@ -8151,7 +8179,7 @@ function parseSseFrame(frame) {
|
|
|
8151
8179
|
if (parsed.error) return {
|
|
8152
8180
|
kind: "event",
|
|
8153
8181
|
id,
|
|
8154
|
-
error:
|
|
8182
|
+
error: bridgeUpstreamError(parsed.error, "bridgeExecutor: bridge stream error")
|
|
8155
8183
|
};
|
|
8156
8184
|
const out = {};
|
|
8157
8185
|
if (parsed.model !== void 0) {
|
|
@@ -8530,14 +8558,19 @@ function snapshotExecutorConfig(config) {
|
|
|
8530
8558
|
"loopCtx",
|
|
8531
8559
|
"maxIterations",
|
|
8532
8560
|
"sandboxClient",
|
|
8533
|
-
"steering"
|
|
8561
|
+
"steering",
|
|
8562
|
+
"validator"
|
|
8534
8563
|
]), "createExecutor sandbox config");
|
|
8535
|
-
const { sandboxClient, loopCtx, ...decisionData } = config;
|
|
8564
|
+
const { sandboxClient, loopCtx, validator, ...decisionData } = config;
|
|
8565
|
+
const port = {
|
|
8566
|
+
sandboxClient,
|
|
8567
|
+
...validator === void 0 ? {} : { validator }
|
|
8568
|
+
};
|
|
8536
8569
|
if (loopCtx === void 0) {
|
|
8537
8570
|
const snapshot = detachedSnapshot(decisionData, "createExecutor sandbox config");
|
|
8538
8571
|
return Object.freeze({
|
|
8539
8572
|
...snapshot,
|
|
8540
|
-
|
|
8573
|
+
...port
|
|
8541
8574
|
});
|
|
8542
8575
|
}
|
|
8543
8576
|
const { hooks, traceEmitter, onSandboxEvent, runHandle, ...loopDecisionData } = loopCtx;
|
|
@@ -8548,7 +8581,7 @@ function snapshotExecutorConfig(config) {
|
|
|
8548
8581
|
const loopSnapshot = snapshot.loopCtx;
|
|
8549
8582
|
return Object.freeze({
|
|
8550
8583
|
...snapshot,
|
|
8551
|
-
|
|
8584
|
+
...port,
|
|
8552
8585
|
loopCtx: Object.freeze({
|
|
8553
8586
|
...loopSnapshot,
|
|
8554
8587
|
...hooks === void 0 ? {} : { hooks },
|
|
@@ -8944,6 +8977,15 @@ function mergeAbortSignals(...signals) {
|
|
|
8944
8977
|
* spend, and refunds the unspent remainder to `free`. Tokens and usd are separate
|
|
8945
8978
|
* channels (`LoopTokenUsage` has no `usd`); iterations are conserved alongside them.
|
|
8946
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
|
+
*
|
|
8947
8989
|
* Pure and deterministic: `now()` is injected, there is no I/O, and no wall-clock or
|
|
8948
8990
|
* RNG read. A `reserve`/`reconcile` ticket is single-use (fail-loud on double or
|
|
8949
8991
|
* unknown reconcile) so a child can never refund twice. Reconciling an OPEN ticket always
|
|
@@ -9044,9 +9086,6 @@ async function foldUsage(events) {
|
|
|
9044
9086
|
ms: 0
|
|
9045
9087
|
};
|
|
9046
9088
|
}
|
|
9047
|
-
function totalTokens(usage) {
|
|
9048
|
-
return usage.input + usage.output;
|
|
9049
|
-
}
|
|
9050
9089
|
/**
|
|
9051
9090
|
* Create a conserved reservation pool from a root `Budget`. `now()` is injected so the
|
|
9052
9091
|
* deadline readout is deterministic; defaults to `Date.now` for non-test callers. The
|
|
@@ -9061,6 +9100,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9061
9100
|
let reservedTokens = 0;
|
|
9062
9101
|
let committedTokens = 0;
|
|
9063
9102
|
let tokensTainted = false;
|
|
9103
|
+
let cacheBreakdownTainted = false;
|
|
9064
9104
|
const usdCapped = root.maxUsd !== void 0;
|
|
9065
9105
|
let freeUsd = root.maxUsd ?? 0;
|
|
9066
9106
|
let reservedUsd = 0;
|
|
@@ -9126,7 +9166,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9126
9166
|
assertValidSpend(spent, `budget pool ticket ${ticket.id} spend`);
|
|
9127
9167
|
const { tokens: rTokens, usd: rUsd, iterations: rIterations } = ticket.reserved;
|
|
9128
9168
|
const unknownUnderCap = usdCapped && spent.usdKnown === false;
|
|
9129
|
-
const spentTokens =
|
|
9169
|
+
const spentTokens = chargedTokens(spent.tokens);
|
|
9130
9170
|
const usdBudgeted = ticket.reserved.usdBudgeted !== false;
|
|
9131
9171
|
let violation;
|
|
9132
9172
|
if (spentTokens > rTokens) violation = `ticket ${ticket.id} spent ${spentTokens} tokens > reserved ${rTokens}`;
|
|
@@ -9135,6 +9175,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9135
9175
|
else if (unknownUnderCap) violation = `ticket ${ticket.id} reported unknown dollar cost under a dollar-capped budget`;
|
|
9136
9176
|
open.delete(ticket.id);
|
|
9137
9177
|
if (spent.tokensKnown === false) tokensTainted = true;
|
|
9178
|
+
if (!hasCompleteCacheBreakdown(spent.tokens)) cacheBreakdownTainted = true;
|
|
9138
9179
|
if (spent.usdKnown === false) usdMeasured = false;
|
|
9139
9180
|
reservedTokens -= rTokens;
|
|
9140
9181
|
committedTokens += spentTokens;
|
|
@@ -9156,8 +9197,9 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9156
9197
|
assertValidSpend(spend, "observed spend");
|
|
9157
9198
|
if (usdCapped && spend.usdKnown === false) throw new ValidationError("budget pool: cannot observe unknown dollar cost under a dollar-capped budget");
|
|
9158
9199
|
if (spend.tokensKnown === false) tokensTainted = true;
|
|
9200
|
+
if (!hasCompleteCacheBreakdown(spend.tokens)) cacheBreakdownTainted = true;
|
|
9159
9201
|
if (spend.usdKnown === false) usdMeasured = false;
|
|
9160
|
-
const tokens =
|
|
9202
|
+
const tokens = chargedTokens(spend.tokens);
|
|
9161
9203
|
freeTokens -= tokens;
|
|
9162
9204
|
committedTokens += tokens;
|
|
9163
9205
|
freeIterations -= spend.iterations;
|
|
@@ -9169,6 +9211,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9169
9211
|
return {
|
|
9170
9212
|
tokensLeft: freeTokens,
|
|
9171
9213
|
tokensKnown: !tokensTainted,
|
|
9214
|
+
cacheBreakdownKnown: !cacheBreakdownTainted,
|
|
9172
9215
|
usdLeft: usdCapped ? usdTainted ? 0 : freeUsd : 0,
|
|
9173
9216
|
usdCapped,
|
|
9174
9217
|
usdKnown: usdMeasured && !usdTainted,
|
|
@@ -9184,8 +9227,9 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
|
|
|
9184
9227
|
assertValidSpend(restore.committed, "budget restore committed");
|
|
9185
9228
|
const committed = restore.committed;
|
|
9186
9229
|
if (committed.tokensKnown === false) tokensTainted = true;
|
|
9230
|
+
if (!hasCompleteCacheBreakdown(committed.tokens)) cacheBreakdownTainted = true;
|
|
9187
9231
|
if (committed.usdKnown === false) usdMeasured = false;
|
|
9188
|
-
const tokens =
|
|
9232
|
+
const tokens = chargedTokens(committed.tokens);
|
|
9189
9233
|
freeTokens -= tokens;
|
|
9190
9234
|
committedTokens += tokens;
|
|
9191
9235
|
freeIterations -= committed.iterations;
|
|
@@ -12396,4 +12440,4 @@ function isNonEmptySpend(s) {
|
|
|
12396
12440
|
//#endregion
|
|
12397
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 };
|
|
12398
12442
|
|
|
12399
|
-
//# sourceMappingURL=supervisor-
|
|
12443
|
+
//# sourceMappingURL=supervisor-CMlIOkJP.js.map
|