@tangle-network/agent-runtime 0.185.2 → 0.188.0
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-wYQYXdaN.js → activation-CpEoQaj5.js} +3 -3
- package/dist/{activation-wYQYXdaN.js.map → activation-CpEoQaj5.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +3 -3
- package/dist/{analyst-loop-DCTra9Qy.js → analyst-loop-CSH7P-Bf.js} +2 -2
- package/dist/{analyst-loop-DCTra9Qy.js.map → analyst-loop-CSH7P-Bf.js.map} +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +1 -1
- package/dist/{authoring-DPBWqmKI.js → authoring-fsUwd9hg.js} +2 -2
- package/dist/{authoring-DPBWqmKI.js.map → authoring-fsUwd9hg.js.map} +1 -1
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-7lVEly33.js → candidate-execution-CehLeZmx.js} +4 -4
- package/dist/{candidate-execution-7lVEly33.js.map → candidate-execution-CehLeZmx.js.map} +1 -1
- package/dist/{conversation-DOuYw0ke.js → conversation-DILnmy84.js} +2 -2
- package/dist/{conversation-DOuYw0ke.js.map → conversation-DILnmy84.js.map} +1 -1
- package/dist/conversation.d.ts +1 -1
- package/dist/conversation.js +1 -1
- package/dist/{coordination-driver-CMA8JjHm.js → coordination-driver-CtbyZv5d.js} +4 -4
- package/dist/{coordination-driver-CMA8JjHm.js.map → coordination-driver-CtbyZv5d.js.map} +1 -1
- package/dist/durable.d.ts +24 -3
- package/dist/durable.js +12 -2
- package/dist/durable.js.map +1 -1
- package/dist/environment-provider-C4AQiUxj.d.ts +143 -0
- package/dist/{environment-provider-CoHsIFp5.js → environment-provider-DZxuH3E4.js} +55 -8
- package/dist/environment-provider-DZxuH3E4.js.map +1 -0
- package/dist/environment-provider.d.ts +2 -2
- package/dist/environment-provider.js +1 -1
- package/dist/{graph-BE92JgZp.js → graph-Cox_7pht.js} +92 -4
- package/dist/graph-Cox_7pht.js.map +1 -0
- package/dist/graph.d.ts +3 -3
- package/dist/graph.js +5 -5
- package/dist/{improvement-cycle-DpZ-QVJ7.js → improvement-cycle-BYHefgVo.js} +6 -6
- package/dist/{improvement-cycle-DpZ-QVJ7.js.map → improvement-cycle-BYHefgVo.js.map} +1 -1
- package/dist/{index-DHSZjuLC.d.ts → index-DA9jKuJc.d.ts} +3 -3
- package/dist/{index-BhtdFMnG.d.ts → index-DVob1IA1.d.ts} +117 -14
- package/dist/{index-Dg2UXocB.d.ts → index-DdmozvB8.d.ts} +4 -4
- package/dist/index.d.ts +9 -9
- package/dist/index.js +13 -13
- package/dist/intelligence.d.ts +5 -5
- package/dist/intelligence.js +6 -6
- package/dist/kernel.d.ts +7 -7
- package/dist/kernel.js +13 -13
- package/dist/{knowledge-ChNVQklk.js → knowledge-Bj1rDycX.js} +5 -5
- package/dist/{knowledge-ChNVQklk.js.map → knowledge-Bj1rDycX.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-JEk_AK4l.js → loop-runner-bin-DgmtU0F0.js} +4 -4
- package/dist/{loop-runner-bin-JEk_AK4l.js.map → loop-runner-bin-DgmtU0F0.js.map} +1 -1
- package/dist/{loop-runner-bin-NanoP_bG.d.ts → loop-runner-bin-g9fWDuOh.d.ts} +3 -3
- 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 +6 -6
- package/dist/mcp/index.js +6 -6
- package/dist/{openai-tools-Cbk5uBUu.d.ts → openai-tools-BDwAdxk5.d.ts} +2 -2
- package/dist/{openai-tools-5SoV8xqN.js → openai-tools-Cz04RKfD.js} +2 -2
- package/dist/{openai-tools-5SoV8xqN.js.map → openai-tools-Cz04RKfD.js.map} +1 -1
- package/dist/{prepare-Tip-2ZoZ.js → prepare-BpIGs5Tc.js} +123 -40
- package/dist/prepare-BpIGs5Tc.js.map +1 -0
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/profiles.d.ts +2 -2
- package/dist/{protected-model-port-Dd3a1SRm.js → protected-model-port-YclORl0x.js} +2 -2
- package/dist/{protected-model-port-Dd3a1SRm.js.map → protected-model-port-YclORl0x.js.map} +1 -1
- package/dist/{provision-supervisor-DptgdNBI.js → provision-supervisor-B-_4I1In.js} +5 -5
- package/dist/{provision-supervisor-DptgdNBI.js.map → provision-supervisor-B-_4I1In.js.map} +1 -1
- package/dist/{redact-BYcuQ6R_.d.ts → redact-C9EWk1FT.d.ts} +3 -3
- package/dist/{runtime-DtzMGguV.js → runtime-DN0SxAaM.js} +13 -13
- package/dist/{runtime-DtzMGguV.js.map → runtime-DN0SxAaM.js.map} +1 -1
- package/dist/{runtime-B-DLSfE5.d.ts → runtime-EQgE3942.d.ts} +23 -7
- package/dist/{sandbox-events-DGXLxiuX.js → sandbox-events-DWeQRWxg.js} +4 -2
- package/dist/sandbox-events-DWeQRWxg.js.map +1 -0
- package/dist/{spawn-journal--N8Ten1q.js → spawn-journal-CxRa-NJ2.js} +2 -2
- package/dist/{spawn-journal--N8Ten1q.js.map → spawn-journal-CxRa-NJ2.js.map} +1 -1
- package/dist/{stream-agent-turn-DY-y9yW1.d.ts → stream-agent-turn-BomJ21AK.d.ts} +3 -3
- package/dist/{stream-agent-turn-C82amSXX.js → stream-agent-turn-DWWe_7bh.js} +2 -2
- package/dist/{stream-agent-turn-C82amSXX.js.map → stream-agent-turn-DWWe_7bh.js.map} +1 -1
- package/dist/{structural-rollout-BXxt_yLq.js → structural-rollout-DPmVZaLI.js} +4 -4
- package/dist/{structural-rollout-BXxt_yLq.js.map → structural-rollout-DPmVZaLI.js.map} +1 -1
- package/dist/{substrate-RrmNZoL3.d.ts → substrate-qLePHqvH.d.ts} +2 -2
- package/dist/{supervise-CgVFzWv-.js → supervise-BUy1cr2L.js} +245 -29
- package/dist/supervise-BUy1cr2L.js.map +1 -0
- package/dist/{supervisor-D7FrKvu6.js → supervisor-BSNkaM2a.js} +149 -20
- package/dist/supervisor-BSNkaM2a.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +13 -13
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-B-rWcun_.d.ts → types-BbkiJR1D.d.ts} +37 -4
- package/dist/{types-CrTTgig6.d.ts → types-BdolQ6Zi.d.ts} +20 -1
- package/dist/{util-D6ZEuBMi.js → util-BfoW6RU7.js} +53 -4
- package/dist/util-BfoW6RU7.js.map +1 -0
- package/dist/{workspace-archive-ByonPBl-.js → workspace-archive-5K72EnlT.js} +2 -2
- package/dist/{workspace-archive-ByonPBl-.js.map → workspace-archive-5K72EnlT.js.map} +1 -1
- package/package.json +8 -8
- package/dist/environment-provider-CoHsIFp5.js.map +0 -1
- package/dist/environment-provider-CzohJCuk.d.ts +0 -89
- package/dist/graph-BE92JgZp.js.map +0 -1
- package/dist/prepare-Tip-2ZoZ.js.map +0 -1
- package/dist/sandbox-events-DGXLxiuX.js.map +0 -1
- package/dist/supervise-CgVFzWv-.js.map +0 -1
- package/dist/supervisor-D7FrKvu6.js.map +0 -1
- package/dist/util-D6ZEuBMi.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { A as assertEventBinding, B as exactContinuedControlRef, C as runtimeOwnedScopeOwnerRuntime, D as abortError, E as RetainedRunProviderContractError, F as assertWaitDuration, G as freezeControlRef, H as exactSession, I as awaitAbortable$1, J as sameControlCoordinates, K as hasDurableCancel, L as cancellationRequest, M as assertResultBinding, N as assertSequence, O as assertBoundaryBinding, P as assertStableText, R as copyControlRef, S as runtimeOwnedPendingExecutorMaterialization, T as unknownMaterializationReceipt, U as exactSessionCancel, V as exactControlRef, W as exactSessionResult, Y as freshTurnInput, _ as runtimeOwnedDeferredExecutorRuntime, a as authoredProfileDigest, b as runtimeOwnedExecutorMaterialization, c as knownExecutionBindingReceipt, g as recordRuntimeOwnedProviderModel, h as recordRuntimeOwnedProviderIdentityConflict, j as assertInteractionBinding, k as assertCanonicalEventBinding, l as knownMaterializationReceipt, m as recordRuntimeOwnedProviderDispatchNotStarted, n as attestRuntimeOwnedExecutor, o as finalizeRuntimeOwnedPendingExecutor, p as recordRuntimeOwnedProviderAttemptStart, q as isTerminalSessionStatus, r as attestRuntimeOwnedPendingExecutor, s as inheritRuntimeOwnedExecutorAttestation, t as attestRuntimeOwnedDeferredExecutor, u as newExecutionAttemptId, w as unknownExecutionBindingReceipt, x as runtimeOwnedExecutorProviderEvidence, y as runtimeOwnedExecutorExecutionBinding, z as delay } from "./materialization-CekWK6OO.js";
|
|
2
2
|
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, l as RetainedInteractiveBindingError, m as ValidationError, r as BackendTransportError, u as RetainedRunAdmissionError } from "./errors-CDZ8XsVj.js";
|
|
3
3
|
import { n as detachedSnapshot } from "./snapshot-CTAf4uuA.js";
|
|
4
|
-
import { _ as captureWorkerTraceEvidence, a as aggregateProviderModelEvidence, c as loadSpawnForest, d as replaySpawnTree, f as attestNestedDriverTreeOwner, h as runtimeOwnedNestedDriverTreeRoot, l as materializeTreeView, m as nestedDriverTreeRoot, n as FileSpawnJournal, o as closesCursorSlot, p as driverRuntime, u as pendingWaits, x as contentAddress } from "./spawn-journal
|
|
5
|
-
import { _ as
|
|
6
|
-
import { _ as parseCodexUsageRecord, c as mapSandboxToolEvent, d as sandboxProgressEvents, h as parseCanonicalTransportEvent, i as createSandboxUsageLedger, l as notifySandboxEventObserver, m as extractTransportEventIdentity, r as createSandboxToolPartState, t as assertSandboxServedModel, u as sandboxEventServedBackend } from "./sandbox-events-
|
|
4
|
+
import { _ as captureWorkerTraceEvidence, a as aggregateProviderModelEvidence, c as loadSpawnForest, d as replaySpawnTree, f as attestNestedDriverTreeOwner, h as runtimeOwnedNestedDriverTreeRoot, l as materializeTreeView, m as nestedDriverTreeRoot, n as FileSpawnJournal, o as closesCursorSlot, p as driverRuntime, u as pendingWaits, x as contentAddress } from "./spawn-journal-CxRa-NJ2.js";
|
|
5
|
+
import { _ as throwIfAborted, a as cloneTokenUsage, b as zeroSpend, d as randomSuffix, f as randomUuid, g as throwAbort, h as stringifySafe, l as mapWithConcurrency, m as sleep, n as addTokenUsage, o as deleteBoxSafe, p as roundBoxMinutes, r as chargedTokens, s as hasCompleteCacheBreakdown, t as addSpend, u as promptCacheTokenClasses, v as unmeteredSpend, x as zeroTokenUsage, y as withTimeout } from "./util-BfoW6RU7.js";
|
|
6
|
+
import { _ as parseCodexUsageRecord, c as mapSandboxToolEvent, d as sandboxProgressEvents, h as parseCanonicalTransportEvent, i as createSandboxUsageLedger, l as notifySandboxEventObserver, m as extractTransportEventIdentity, r as createSandboxToolPartState, t as assertSandboxServedModel, u as sandboxEventServedBackend } from "./sandbox-events-DWeQRWxg.js";
|
|
7
7
|
import { n as executableAgentSpecSnapshot, r as projectSandboxOutcome, t as executableAgentProfileSnapshot } from "./executable-spec-DxuiDFAU.js";
|
|
8
8
|
import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, l as profileProviderModel, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-Wf2MxXJ9.js";
|
|
9
|
-
import { c as linkAbort, i as resolveAgentEnvironmentProvider, l as runAbortable, n as providerAsExecutor, r as providerAsSandboxClient, s as abortError$1 } from "./environment-provider-
|
|
9
|
+
import { c as linkAbort, i as resolveAgentEnvironmentProvider, l as runAbortable, n as providerAsExecutor, r as providerAsSandboxClient, s as abortError$1 } from "./environment-provider-DZxuH3E4.js";
|
|
10
10
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
11
11
|
import { n as assertNoSymlinkDescendant, r as publishExclusiveDurableFile } from "./durable-file-g3YdfEh4.js";
|
|
12
12
|
import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, ContextTransferRequestSchema, InteractionAcknowledgementSchema, InteractionResponseCommandSchema, NativeContextBoundaryProofSchema, NativeContextContinuationRequestSchema, REASONING_EFFORTS, RuntimeEventEnvelopeSchema, TerminalReplayWindowSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentNativeContextContinuationResultMatchesRequest, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, exactAgentInteractiveSessionStart, harnessTypeSchema, nativeContextContinuationTurnDigest, nativeReasoningControl, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema } from "@tangle-network/agent-interface";
|
|
@@ -4956,6 +4956,7 @@ async function executeIteration(args) {
|
|
|
4956
4956
|
}
|
|
4957
4957
|
});
|
|
4958
4958
|
let box;
|
|
4959
|
+
let boxAcquiredAt;
|
|
4959
4960
|
let lineageOwned = false;
|
|
4960
4961
|
let sawLlmCall = false;
|
|
4961
4962
|
const usageLedger = createSandboxUsageLedger(spec.profile.harness);
|
|
@@ -4982,11 +4983,13 @@ async function executeIteration(args) {
|
|
|
4982
4983
|
if (source) {
|
|
4983
4984
|
const acquired = await source.acquire();
|
|
4984
4985
|
box = acquired.handle.box;
|
|
4986
|
+
boxAcquiredAt = args.now();
|
|
4985
4987
|
lineageOwned = true;
|
|
4986
4988
|
args.lineageState?.handles.set(args.item.index, acquired.handle);
|
|
4987
4989
|
stream = acquired.events;
|
|
4988
4990
|
} else {
|
|
4989
4991
|
box = await createSandboxForSpec(args.ctx.sandboxClient, spec, args.signal, args.recordMount);
|
|
4992
|
+
boxAcquiredAt = args.now();
|
|
4990
4993
|
const prompt = spec.taskToPrompt(args.item.task);
|
|
4991
4994
|
const promptOptions = args.promptOptions;
|
|
4992
4995
|
stream = args.streaming === "poll" ? promptEvents("poll", box, prompt, `${args.runId}-i${args.item.index}`, args.signal, promptOptions) : box.streamPrompt(prompt, {
|
|
@@ -5075,7 +5078,13 @@ async function executeIteration(args) {
|
|
|
5075
5078
|
}
|
|
5076
5079
|
});
|
|
5077
5080
|
if (lineageOwned) {} else if (args.collectBox && box) args.collectBox(box);
|
|
5078
|
-
else
|
|
5081
|
+
else {
|
|
5082
|
+
const teardown = await destroySandboxSafe(box, args.ctx.traceEmitter, args.runId, args.now);
|
|
5083
|
+
if (boxAcquiredAt !== void 0 && teardown !== "no-delete-api") {
|
|
5084
|
+
slot.boxLiveMs = Math.max(0, args.now() - boxAcquiredAt);
|
|
5085
|
+
if (teardown !== "deleted") slot.boxLiveMsKnown = false;
|
|
5086
|
+
}
|
|
5087
|
+
}
|
|
5079
5088
|
}
|
|
5080
5089
|
if (isAbortError$1(slot.error) || args.signal.aborted) {
|
|
5081
5090
|
if (slot.error) throw slot.error;
|
|
@@ -5093,9 +5102,13 @@ const TEARDOWN_TIMEOUT_MS = 15e3;
|
|
|
5093
5102
|
* A delete that throws or hangs (bounded by `TEARDOWN_TIMEOUT_MS`) is recorded
|
|
5094
5103
|
* as a `loop.teardown.failed` trace so a silently-leaking box is observable —
|
|
5095
5104
|
* distinct from a fake with no `delete`, which is expected and stays silent.
|
|
5105
|
+
*
|
|
5106
|
+
* The return value names which of those three happened, because the caller pairs the box's
|
|
5107
|
+
* lifetime on it: only `'deleted'` closes the lifetime, `'unproven'` leaves it a floor, and
|
|
5108
|
+
* `'no-delete-api'` means there was no box lifecycle to time at all.
|
|
5096
5109
|
*/
|
|
5097
5110
|
async function destroySandboxSafe(box, trace, runId, now) {
|
|
5098
|
-
if (!box || typeof box.delete !== "function") return;
|
|
5111
|
+
if (!box || typeof box.delete !== "function") return "no-delete-api";
|
|
5099
5112
|
const emitFailed = async (reason) => {
|
|
5100
5113
|
if (!trace || !runId) return;
|
|
5101
5114
|
await emitTrace(trace, {
|
|
@@ -5111,6 +5124,7 @@ async function destroySandboxSafe(box, trace, runId, now) {
|
|
|
5111
5124
|
const outcome = await withTimeout(deleteBoxSafe(box), TEARDOWN_TIMEOUT_MS);
|
|
5112
5125
|
if (outcome === void 0) await emitFailed("timeout");
|
|
5113
5126
|
else if (outcome === false) await emitFailed("delete threw");
|
|
5127
|
+
return outcome === true ? "deleted" : "unproven";
|
|
5114
5128
|
}
|
|
5115
5129
|
/**
|
|
5116
5130
|
* Branch point for a new round — the iteration a later round descends from.
|
|
@@ -5210,6 +5224,9 @@ function finalize(args) {
|
|
|
5210
5224
|
addTokenUsage(acc, iter.tokenUsage);
|
|
5211
5225
|
return acc;
|
|
5212
5226
|
}, zeroTokenUsage());
|
|
5227
|
+
const timedBoxes = args.iterations.filter((iter) => iter.boxLiveMs !== void 0);
|
|
5228
|
+
const boxLiveMs = timedBoxes.reduce((sum, iter) => sum + (iter.boxLiveMs ?? 0), 0);
|
|
5229
|
+
const boxLiveMsKnown = timedBoxes.length === args.iterations.length && args.iterations.every((iter) => iter.boxLiveMsKnown !== false);
|
|
5213
5230
|
return {
|
|
5214
5231
|
decision: args.decision,
|
|
5215
5232
|
iterations: args.iterations,
|
|
@@ -5220,6 +5237,8 @@ function finalize(args) {
|
|
|
5220
5237
|
...estimatedCostUsd > 0 ? { estimatedCostUsd } : {},
|
|
5221
5238
|
...Object.keys(promptCache).length > 0 ? { promptCache } : {},
|
|
5222
5239
|
tokenUsage,
|
|
5240
|
+
...timedBoxes.length > 0 ? { boxLiveMs } : {},
|
|
5241
|
+
...boxLiveMsKnown ? {} : { boxLiveMsKnown: false },
|
|
5223
5242
|
provenance: {
|
|
5224
5243
|
mounts: args.mounts,
|
|
5225
5244
|
selectionReceipts: buildSelectionReceipts(args.iterations, winner, selector)
|
|
@@ -7974,13 +7993,22 @@ async function* streamSandboxLeaf(args) {
|
|
|
7974
7993
|
...result.estimatedCostUsd !== void 0 ? { estimatedCostUsd: result.estimatedCostUsd } : {},
|
|
7975
7994
|
...result.promptCache ? { promptCache: result.promptCache } : {}
|
|
7976
7995
|
};
|
|
7996
|
+
const boxMinutes = result.boxLiveMs === void 0 ? void 0 : roundBoxMinutes(result.boxLiveMs / 6e4);
|
|
7977
7997
|
const spent = {
|
|
7978
7998
|
iterations: result.iterations.length,
|
|
7979
7999
|
tokens: cloneTokenUsage(result.tokenUsage),
|
|
7980
8000
|
...tokensKnown ? {} : { tokensKnown: false },
|
|
7981
8001
|
usd: result.costUsd,
|
|
7982
8002
|
...usdKnown ? {} : { usdKnown: false },
|
|
7983
|
-
ms: Date.now() - started
|
|
8003
|
+
ms: Date.now() - started,
|
|
8004
|
+
...boxMinutes === void 0 ? {
|
|
8005
|
+
boxMinutesKnown: false,
|
|
8006
|
+
boxMinutesProvenance: "uncaptured"
|
|
8007
|
+
} : {
|
|
8008
|
+
boxMinutes,
|
|
8009
|
+
boxMinutesKnown: result.boxLiveMsKnown !== false,
|
|
8010
|
+
boxMinutesProvenance: "estimated"
|
|
8011
|
+
}
|
|
7984
8012
|
};
|
|
7985
8013
|
args.onArtifact({
|
|
7986
8014
|
outRef: contentRef("sandbox", {
|
|
@@ -8036,15 +8064,40 @@ function failedRound(result) {
|
|
|
8036
8064
|
* `valid` from its check. This is the sandbox backend's structural answer for a
|
|
8037
8065
|
* run with no oracle at all — without it nothing ever writes `valid`, no settled
|
|
8038
8066
|
* child is ever DELIVERED, and the finalizer has nothing to select no matter how
|
|
8039
|
-
* well the worker ran. Structural, never self-reported: the
|
|
8040
|
-
*
|
|
8067
|
+
* well the worker ran. Structural, never self-reported: the round's
|
|
8068
|
+
* {@link SandboxOutputMarker} says what the harness produced, and the verdict is
|
|
8069
|
+
* that marker.
|
|
8070
|
+
*
|
|
8071
|
+
* `text` is the only marker that passes. `empty` (a text-bearing terminal event
|
|
8072
|
+
* carrying an empty string) and `absent` (no text-bearing event at all) each settle
|
|
8073
|
+
* `valid: false` with the marker named in `notes`, because a box that answered
|
|
8074
|
+
* nothing is not a worker whose output a finalizer may select. The two stay
|
|
8075
|
+
* distinct: `empty` reports a box that ran and said nothing, `absent` reports an
|
|
8076
|
+
* answer no reader can confirm was ever produced.
|
|
8041
8077
|
*/
|
|
8042
8078
|
function leafVerdict(result) {
|
|
8043
|
-
|
|
8044
|
-
return
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8079
|
+
const output = result.winner?.output;
|
|
8080
|
+
if (output === void 0) return void 0;
|
|
8081
|
+
return verdictForOutputMarker(output.output);
|
|
8082
|
+
}
|
|
8083
|
+
/** The verdict one {@link SandboxOutputMarker} settles, with the marker named in `notes`. */
|
|
8084
|
+
function verdictForOutputMarker(marker) {
|
|
8085
|
+
switch (marker.kind) {
|
|
8086
|
+
case "text": return {
|
|
8087
|
+
valid: true,
|
|
8088
|
+
score: 1
|
|
8089
|
+
};
|
|
8090
|
+
case "empty": return {
|
|
8091
|
+
valid: false,
|
|
8092
|
+
score: 0,
|
|
8093
|
+
notes: "sandbox output marker empty: the round produced a text-bearing terminal event that carried no answer"
|
|
8094
|
+
};
|
|
8095
|
+
case "absent": return {
|
|
8096
|
+
valid: false,
|
|
8097
|
+
score: 0,
|
|
8098
|
+
notes: "sandbox output marker absent: the round produced no text-bearing event, so no answer was observed"
|
|
8099
|
+
};
|
|
8100
|
+
}
|
|
8048
8101
|
}
|
|
8049
8102
|
/**
|
|
8050
8103
|
* Spawns a subprocess (`bin` + `args`). It cannot account tokens, so it is
|
|
@@ -8585,6 +8638,7 @@ async function* streamBridgeSession(args) {
|
|
|
8585
8638
|
const external = linkAbort(args.signal, args.controller.signal).signal;
|
|
8586
8639
|
const tokens = zeroTokenUsage();
|
|
8587
8640
|
let tokensKnown = true;
|
|
8641
|
+
let tokensUnknownReason;
|
|
8588
8642
|
let usd = 0;
|
|
8589
8643
|
let usdKnown = true;
|
|
8590
8644
|
let estimatedUsdCharged = 0;
|
|
@@ -8819,6 +8873,19 @@ async function* streamBridgeSession(args) {
|
|
|
8819
8873
|
kind: "turn",
|
|
8820
8874
|
label: `turn ${turns}`
|
|
8821
8875
|
});
|
|
8876
|
+
if (!sawTurnTokenUsage) {
|
|
8877
|
+
const receipt = readBridgeReceiptTokens(activeRun.profileMaterialization?.inference?.observation?.usage);
|
|
8878
|
+
if ("event" in receipt) {
|
|
8879
|
+
sawTurnTokenUsage = true;
|
|
8880
|
+
turnInputTokens += receipt.event.input;
|
|
8881
|
+
turnOutputTokens += receipt.event.output;
|
|
8882
|
+
addTokenUsage(tokens, receipt.event);
|
|
8883
|
+
yield receipt.event;
|
|
8884
|
+
if (receipt.event.freshInput !== void 0) promptCache.freshInput = (promptCache.freshInput ?? 0) + receipt.event.freshInput;
|
|
8885
|
+
if (receipt.event.cacheRead !== void 0) promptCache.readTokens = (promptCache.readTokens ?? 0) + receipt.event.cacheRead;
|
|
8886
|
+
if (receipt.event.cacheWrite !== void 0) promptCache.writeTokens = (promptCache.writeTokens ?? 0) + receipt.event.cacheWrite;
|
|
8887
|
+
} else tokensUnknownReason ??= receipt.reason;
|
|
8888
|
+
}
|
|
8822
8889
|
if (!sawTurnTokenUsage || !turnTokensKnown) tokensKnown = false;
|
|
8823
8890
|
if (!sawTurnCostStatus || !turnUsdKnown) usdKnown = false;
|
|
8824
8891
|
if (!sawTurnCostStatus || !turnUsdKnown) {
|
|
@@ -8865,7 +8932,8 @@ async function* streamBridgeSession(args) {
|
|
|
8865
8932
|
toolCalls,
|
|
8866
8933
|
transportAttempts,
|
|
8867
8934
|
...Object.keys(promptCache).length > 0 ? { promptCache } : {},
|
|
8868
|
-
...sawEstimatedUsd ? { estimatedCostUsd: estimatedUsd } : {}
|
|
8935
|
+
...sawEstimatedUsd ? { estimatedCostUsd: estimatedUsd } : {},
|
|
8936
|
+
...tokensKnown || tokensUnknownReason === void 0 ? {} : { tokensUnknownReason }
|
|
8869
8937
|
};
|
|
8870
8938
|
args.onArtifact({
|
|
8871
8939
|
outRef: contentRef("bridge", {
|
|
@@ -8877,6 +8945,50 @@ async function* streamBridgeSession(args) {
|
|
|
8877
8945
|
spent
|
|
8878
8946
|
});
|
|
8879
8947
|
}
|
|
8948
|
+
/**
|
|
8949
|
+
* The tokens one cli-bridge turn's own materialization receipt states, or the reason it states
|
|
8950
|
+
* none.
|
|
8951
|
+
*
|
|
8952
|
+
* cli-bridge runs every harness against a scoped-loopback endpoint that it owns, counts the model
|
|
8953
|
+
* traffic that passes through it, and publishes that count for the turn as
|
|
8954
|
+
* `inference.observation.usage`. The count is harness-agnostic BY CONSTRUCTION: the proxy reads
|
|
8955
|
+
* provider requests, not a CLI's own event vocabulary. A harness that emits no OpenAI-shaped
|
|
8956
|
+
* `usage` frame therefore still has a readable receipt, which is why this runtime holds NO
|
|
8957
|
+
* per-harness bridge decoder — the bridge normalizes usage at the source and the runtime keeps one
|
|
8958
|
+
* reader. (`harness-usage.ts` holds the decoder registry for the OTHER transport, the sandbox
|
|
8959
|
+
* stream, where the runtime does read a harness's own event.)
|
|
8960
|
+
*
|
|
8961
|
+
* A receipt states a turn's tokens only when it names BOTH totals. Anything less leaves the turn
|
|
8962
|
+
* unknown with the reason named, never a zero that would read as a measured free turn.
|
|
8963
|
+
*
|
|
8964
|
+
* The counters beside the two totals CLASSIFY the prompt total; none of them adds to it. The
|
|
8965
|
+
* receipt carries no reasoning counter at all, so the codex hazard of adding a reasoning count to
|
|
8966
|
+
* an output total that already contains it cannot arise on this path.
|
|
8967
|
+
*/
|
|
8968
|
+
function readBridgeReceiptTokens(usage) {
|
|
8969
|
+
if (usage === void 0) return { reason: "usage-unreadable: the turn receipt carried no bridge inference observation" };
|
|
8970
|
+
const input = usage.inputTokens;
|
|
8971
|
+
const output = usage.outputTokens;
|
|
8972
|
+
if (input === void 0 || output === void 0) return { reason: `usage-unreadable: the turn receipt named no ${[...input === void 0 ? ["prompt"] : [], ...output === void 0 ? ["completion"] : []].join(" and ")} total` };
|
|
8973
|
+
const fresh = usage.freshInputTokens;
|
|
8974
|
+
const classes = promptCacheTokenClasses(input, {
|
|
8975
|
+
...usage.cacheReadInputTokens === void 0 ? {} : { readTokens: usage.cacheReadInputTokens },
|
|
8976
|
+
...usage.cacheWriteInputTokens === void 0 ? {} : { writeTokens: usage.cacheWriteInputTokens }
|
|
8977
|
+
});
|
|
8978
|
+
const declaredFresh = classes.freshInput === void 0 && fresh !== void 0 && fresh <= input ? {
|
|
8979
|
+
freshInput: fresh,
|
|
8980
|
+
cacheBreakdownKnown: false
|
|
8981
|
+
} : {};
|
|
8982
|
+
const contradiction = classes.freshInput !== void 0 && fresh !== void 0 && fresh !== classes.freshInput ? { cacheBreakdownKnown: false } : {};
|
|
8983
|
+
return { event: {
|
|
8984
|
+
kind: "tokens",
|
|
8985
|
+
input,
|
|
8986
|
+
output,
|
|
8987
|
+
...classes,
|
|
8988
|
+
...declaredFresh,
|
|
8989
|
+
...contradiction
|
|
8990
|
+
} };
|
|
8991
|
+
}
|
|
8880
8992
|
const BRIDGE_CANCEL_LONG_POLL_MS = 3e4;
|
|
8881
8993
|
const BRIDGE_BRUTAL_KILL_WAIT_MS = 150;
|
|
8882
8994
|
/**
|
|
@@ -9949,14 +10061,15 @@ function snapshotExecutorConfig(config) {
|
|
|
9949
10061
|
});
|
|
9950
10062
|
}
|
|
9951
10063
|
case "provider": {
|
|
9952
|
-
const { provider, registry, profileForCreate, taskToTurn, ...decisionData } = config;
|
|
10064
|
+
const { provider, registry, profileForCreate, taskToTurn, validator, ...decisionData } = config;
|
|
9953
10065
|
const snapshot = detachedSnapshot(decisionData, "createExecutor provider config");
|
|
9954
10066
|
const resolvedProvider = resolveAgentEnvironmentProvider(provider, registry);
|
|
9955
10067
|
return Object.freeze({
|
|
9956
10068
|
...snapshot,
|
|
9957
10069
|
provider: resolvedProvider,
|
|
9958
10070
|
...profileForCreate === void 0 ? {} : { profileForCreate },
|
|
9959
|
-
...taskToTurn === void 0 ? {} : { taskToTurn }
|
|
10071
|
+
...taskToTurn === void 0 ? {} : { taskToTurn },
|
|
10072
|
+
...validator === void 0 ? {} : { validator }
|
|
9960
10073
|
});
|
|
9961
10074
|
}
|
|
9962
10075
|
case "sandbox": {
|
|
@@ -10091,6 +10204,7 @@ function createExecutor(config) {
|
|
|
10091
10204
|
if (providerSeam.steering) {
|
|
10092
10205
|
if (providerSeam.taskToTurn) throw new ValidationError("createExecutor(provider, steering): taskToTurn is not representable by the text-only steerable session");
|
|
10093
10206
|
if (providerSeam.destroyOnSettle === false) throw new ValidationError("createExecutor(provider, steering): destroyOnSettle=false conflicts with the session-owned environment lifecycle");
|
|
10207
|
+
if (providerSeam.validator) throw new ValidationError("createExecutor(provider, steering): validator is not representable with steering — the steerable session is a multi-turn session on one environment, not a scored single-shot leaf, so the score would be silently dropped");
|
|
10094
10208
|
const harness = requiredProviderProfileHarness(spec, providerSeam);
|
|
10095
10209
|
const sandboxClient = providerAsSandboxClient(provider, {
|
|
10096
10210
|
defaults: {
|
|
@@ -10106,7 +10220,8 @@ function createExecutor(config) {
|
|
|
10106
10220
|
...seamed.seams,
|
|
10107
10221
|
[sandboxSeamKey]: {
|
|
10108
10222
|
sandboxClient,
|
|
10109
|
-
steering: providerSeam.steering
|
|
10223
|
+
steering: providerSeam.steering,
|
|
10224
|
+
...providerSeam.promptOptions === void 0 ? {} : { loopCtx: { promptOptions: providerSeam.promptOptions } }
|
|
10110
10225
|
}
|
|
10111
10226
|
}
|
|
10112
10227
|
};
|
|
@@ -10373,6 +10488,17 @@ function singleShotDriver(maxIterations) {
|
|
|
10373
10488
|
* it trusts a reported `input`: the token channel is an accounting unit, not a trust boundary
|
|
10374
10489
|
* against a provider that misreports its own usage.
|
|
10375
10490
|
*
|
|
10491
|
+
* THE POOL RESERVES AGAINST THREE QUANTITIES AND NO MORE. `Spend.boxMinutes` — platform box wall
|
|
10492
|
+
* time — is reported and summed, and it is never reserved, never committed, and never refunded.
|
|
10493
|
+
* The reason is the conservation law above: a reservation is only meaningful against a ceiling a
|
|
10494
|
+
* caller declared and a measurement the pool can trust, and box minutes have neither. `Budget`
|
|
10495
|
+
* declares no box ceiling, and the number the sandbox executor reports is DERIVED from the box
|
|
10496
|
+
* lifetime it watched (`boxMinutesProvenance: 'estimated'`), not a platform receipt. Reserving
|
|
10497
|
+
* against an estimate would let a derived number refuse real work, which is the same defect as a
|
|
10498
|
+
* gate that cannot fire, inverted. When the platform reports minutes itself
|
|
10499
|
+
* (`boxMinutesProvenance: 'observed'`) and a `Budget` gains a box ceiling, the channel becomes a
|
|
10500
|
+
* conserved quantity; until both hold, it is evidence only.
|
|
10501
|
+
*
|
|
10376
10502
|
* Pure and deterministic: the run's start instant is supplied, there is no I/O, and no
|
|
10377
10503
|
* wall-clock or RNG read. A `reserve`/`reconcile` ticket is single-use (fail-loud on double or
|
|
10378
10504
|
* unknown reconcile) so a child can never refund twice. Reconciling an OPEN ticket always
|
|
@@ -14298,7 +14424,10 @@ function preserveUnknownTelemetry(streamed, terminal) {
|
|
|
14298
14424
|
},
|
|
14299
14425
|
...terminal.tokensKnown === false ? { tokensKnown: false } : {},
|
|
14300
14426
|
...terminal.usdKnown === false ? { usdKnown: false } : {},
|
|
14301
|
-
ms: terminal.ms
|
|
14427
|
+
ms: terminal.ms,
|
|
14428
|
+
...terminal.boxMinutes !== void 0 ? { boxMinutes: terminal.boxMinutes } : {},
|
|
14429
|
+
...terminal.boxMinutesKnown !== void 0 ? { boxMinutesKnown: terminal.boxMinutesKnown } : {},
|
|
14430
|
+
...terminal.boxMinutesProvenance !== void 0 ? { boxMinutesProvenance: terminal.boxMinutesProvenance } : {}
|
|
14302
14431
|
};
|
|
14303
14432
|
}
|
|
14304
14433
|
async function awaitAbortable(work, signal) {
|
|
@@ -15541,4 +15670,4 @@ function isNonEmptySpend(s) {
|
|
|
15541
15670
|
//#endregion
|
|
15542
15671
|
export { bridgeModelRouteRefusal as $, INTELLIGENCE_WIRE_VERSION as $t, readWorkerInteractiveBinding as A, controlProfileMaterialization as An, peerMailVerbNames as At, retainedCreateMaterial as B, sandboxActProfileMaterialization as Bn, createSandboxLineage as Bt, timerAt as C, LOCAL_HARNESSES as Cn, AUTHORITY_MARKERS as Ct, readWorkerInteractiveAdmissions as D, CodexExecutionDiagnosticError as Dn, createPeerMailbox as Dt, interactiveAdmissionSeamKey as E, parseCodexTokenUsage as En, claimsAuthority as Et, startRetainedInteractiveRun as F, promptModelProfileMaterialization as Fn, TERMINAL_DECISIONS as Ft, rollingDispatch as G, routerBrain as Gt, effectiveConcurrency as H, validateProfileMaterialization as Hn, acquireSandbox as Ht, reconnectRetainedRun as I, promptOnlyProfileMaterialization as In, createSandboxForSpec as It, assertValidBudget as J, observedModelMatchesDeclared as Jt, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as K, runBrainLoop as Kt, recoverRetainedRun as L, promptResourceProfileMaterialization as Ln, defaultSelectWinner as Lt, workerInteractiveBindingsDir as M, fullProfileMaterialization as Mn, isTerminalNodeStatus as Mt, reconnectRetainedInteractiveRun as N, profileMaterializationAxes$1 as Nn, createInPlaceCliExecutor as Nt, workerInteractiveAdmissionFile as O, AGENT_PROFILE_MATERIALIZATION_AXES as On, isPeerMailEnvelope as Ot, recoverRetainedInteractiveRun as P, promptControlProfileMaterialization as Pn, taskToPrompt as Pt, bridgeAdmissionRead as Q, traceContextToEnv as Qt, startRetainedRun as R, renderProfileMaterializationIssues as Rn, isTerminalDecision as Rt, pollFor as S, DEFAULT_LOCAL_HARNESS as Sn, createInbox as St, waitUntil as T, localHarnessExecutable as Tn, PEER_MAIL_WIRE_KEY as Tt, freeSlots as U, worktreeCliProfileMaterialization as Un, assertBoxlessPromptOptions as Ut, destroyInteractiveEnvironment as V, unsupportedProfileDimensions as Vn, probeSandboxCapabilities as Vt, queueOf as W, readPromptOptions as Wt, spendFromUsageEvents as X, mergeTraceEnv as Xt, createBudgetPool as Y, createPropagatingTraceEmitter as Yt, bindReusableExecutorExecutionId as Z, readTraceContextFromEnv as Zt, recordScopeOwnerMaterialization as _, runSettledCommand as _n, decodeToolPart as _t, uncertainSpawnBudgets as a, exportEvalRuns as an, createExecutor as at, createWaitProbes as b, createWorktree as bn, createActivityLog as bt, pickBestDelivered as c, loopEventToOtelSpan as cn, createWorktreeCliExecutor as ct, driverChild as d, toOtelAttributes as dn, workerTraceEnv as dt, buildLoopOtelSpans as en, bridgeRuntimeAttachmentsKey as et, withDriverExecutor as f, createRuntimeEventCollector as fn, workerTraceHeaders as ft, meterRuntimeOwnedProviderAttempt as g, sanitizeRuntimeStreamEvent as gn, createPushTraceSource as gt, meterRuntimeOwnedAccounting as h, sanitizeKnowledgeReadinessReport as hn, createSteerableSandboxSession as ht, sumMeasuredSpendFromEvents as i, createOtelExporter as in, cliWorktreeExecutor as it, workerInteractiveBindingFile as j, defineProfileMaterializationContract as jn, isLiveNodeStatus as jt, attachWorker as k, assertProfileMaterialization as kn, peerMailTools as kt, runFinalizer as l, padSpanId as ln, WORKER_TRACE_PROPAGATION as lt, deriveNodeExecutionIdentity as m, sanitizeAgentRuntimeEvent as mn, DEFAULT_SANDBOX_STEERING_MAX_TURNS as mt, createSupervisor as n, buildRuntimeEventOtelSpans as nn, captureReusableExecutorConfig as nt, bestDelivered as o, flatOtelSpan as on, createExecutorRegistry as ot, createScope as p, createRuntimeStreamEventCollector as pn, workerTraceSeamKey as pt, teardownExecutor as q, canonicalObservedModel as qt, maxSeqOf as r, createOpenInferenceFileExporter as rn, cliInPlaceExecutor as rt, collectDelivered as s, generateSpanId as sn, snapshotExecutorConfig as st, createRootHandle as t, buildLoopSpanNodes as tn, bridgeStopSignalKey as tt, runTree as u, padTraceId as un, readWorkerTraceContext as ut, scopeOwnerExecutorNodeContext as v, runWorktreeHarness as vn, sandboxSessionTraceSource as vt, validateWaitSpec as w, harnessSupportsReasoningEffort as wn, DEFAULT_PEER_MAIL_LIMITS as wt, isWaitOutcome as x, removeWorktree as xn, readWorkerProgress as xt, settledToIteration as y, captureWorktreeDiff as yn, DEFAULT_STALL_AFTER_MS as yt, startRetainedRunInEnvironment as z, renderUnsupported as zn, runAgentRounds as zt };
|
|
15543
15672
|
|
|
15544
|
-
//# sourceMappingURL=supervisor-
|
|
15673
|
+
//# sourceMappingURL=supervisor-BSNkaM2a.js.map
|