@tangle-network/agent-runtime 0.289.2 → 0.291.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-ClgRxMQ9.js → activation-BPZL1WCG.js} +2 -2
- package/dist/{activation-ClgRxMQ9.js.map → activation-BPZL1WCG.js.map} +1 -1
- package/dist/{activation-BH2oPn09.d.ts → activation-D8DOMMZc.d.ts} +3 -3
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-CrsMoYmK.js → coordination-driver-CUnF7gfN.js} +3 -2
- package/dist/coordination-driver-CUnF7gfN.js.map +1 -0
- package/dist/{delegate-BtA5G0Zi.js → delegate-B0j4915d.js} +2 -2
- package/dist/{delegate-BtA5G0Zi.js.map → delegate-B0j4915d.js.map} +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +2 -2
- package/dist/{graph-9xDBu--o.js → graph-ByPZb_xc.js} +5 -5
- package/dist/{graph-9xDBu--o.js.map → graph-ByPZb_xc.js.map} +1 -1
- package/dist/{improvement-cycle-Rq1wYTxJ.js → improvement-cycle-DipoyAM3.js} +4 -4
- package/dist/{improvement-cycle-Rq1wYTxJ.js.map → improvement-cycle-DipoyAM3.js.map} +1 -1
- package/dist/{index-w7xjlAcL.d.ts → index-D-5e8mss.d.ts} +16 -18
- package/dist/index.d.ts +7 -7
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +3 -3
- package/dist/intelligence.js +4 -4
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +10 -10
- package/dist/{loop-runner-bin-DxZdgqD5.d.ts → loop-runner-bin-Bkw-_LkG.d.ts} +3 -3
- package/dist/{loop-runner-bin-D6vu3zKo.js → loop-runner-bin-DhPBdCux.js} +3 -3
- package/dist/{loop-runner-bin-D6vu3zKo.js.map → loop-runner-bin-DhPBdCux.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 +5 -5
- package/dist/{model-policy-CA5d1YUP.js → model-policy-DydyWTQg.js} +186 -2
- package/dist/model-policy-DydyWTQg.js.map +1 -0
- package/dist/{openai-tools-CWp4nc4r.d.ts → openai-tools-De6m7S4Y.d.ts} +2 -2
- package/dist/profiles.d.ts +2 -2
- package/dist/profiles.js +1 -1
- package/dist/{provision-supervisor-43_bsO7n.js → provision-supervisor-DvEpuocs.js} +9 -26
- package/dist/provision-supervisor-DvEpuocs.js.map +1 -0
- package/dist/{runtime-Coi8gH_G.js → runtime-Ba7oK4M1.js} +9 -9
- package/dist/{runtime-Coi8gH_G.js.map → runtime-Ba7oK4M1.js.map} +1 -1
- package/dist/{search-method-Dooo6JxE.js → search-method-Cs6SLt8I.js} +87 -49
- package/dist/search-method-Cs6SLt8I.js.map +1 -0
- package/dist/{server-xIUtcV4x.js → server-CVRFM3ZF.js} +3 -3
- package/dist/{server-xIUtcV4x.js.map → server-CVRFM3ZF.js.map} +1 -1
- package/dist/{stream-agent-turn-DJqcRoxP.d.ts → stream-agent-turn-n3kOukD_.d.ts} +22 -48
- package/dist/{substrate-C9cGwDJ5.d.ts → substrate-DFWtsdNI.d.ts} +2 -2
- package/dist/{supervise-B_GnmIw0.js → supervise-dYioyGT-.js} +27 -7
- package/dist/supervise-dYioyGT-.js.map +1 -0
- package/dist/{supervisor-CDsr_sZD.js → supervisor-DpUCJtKC.js} +162 -696
- package/dist/supervisor-DpUCJtKC.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-BPO06pPv.d.ts → types-BFcLI8Ge.d.ts} +5 -1
- package/package.json +5 -5
- package/dist/coordination-driver-CrsMoYmK.js.map +0 -1
- package/dist/model-policy-CA5d1YUP.js.map +0 -1
- package/dist/provision-supervisor-43_bsO7n.js.map +0 -1
- package/dist/search-method-Dooo6JxE.js.map +0 -1
- package/dist/supervise-B_GnmIw0.js.map +0 -1
- package/dist/supervisor-CDsr_sZD.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, i as ConfigError, l as RetainedInteractiveBindingError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError$1, u as RetainedRunAdmissionError } from "./errors-DodWX-cb.js";
|
|
2
|
-
import { a as concreteProfileModel, c as profileModelExecutionSettings, d as
|
|
2
|
+
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, d as assertRouterAutoDeclaration, f as assertRouterAutoResponse, g as observedModelMatchesDeclared, h as observedModelHasSnapshot, l as profileProviderModel, m as mergeObservedModelIdentity, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-DydyWTQg.js";
|
|
3
3
|
import { S as verifyWorkspaceSnapshotArtifacts, i as verifyAgentCandidateWorkspaceArchive } from "./workspace-archive-MhowMCmp.js";
|
|
4
4
|
import { n as assertNoSymlinkDescendant, r as publishExclusiveDurableFile } from "./durable-file-DWQA4ooo.js";
|
|
5
5
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
6
|
-
import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionRefSchema,
|
|
6
|
+
import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentNativeContextContinuationResultSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, AgentTurnInputSchema, AgentTurnResultSchema, CanonicalStreamEventSchema, ContextTransferRequestSchema, InteractionAcknowledgementSchema, InteractionResponseCommandSchema, NativeContextBoundaryProofSchema, NativeContextContinuationRequestSchema, REASONING_EFFORTS, RuntimeEventEnvelopeSchema, TerminalReplayWindowSchema, TerminalSessionRefSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentNativeContextContinuationResultMatchesRequest, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, agentRunCancellationRequestDigest, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalWorkspaceCwd, exactAgentInteractiveSessionStart, harnessTypeSchema, nativeContextContinuationTurnDigest, nativeReasoningControl, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema, workspaceCheckpointRequestDigest, workspaceCheckpointResultMatchesRequest, workspaceCleanupAcknowledgementMatches, workspaceCleanupRequestDigest } from "@tangle-network/agent-interface";
|
|
7
7
|
import { estimateCost, isModelPriced, isToolSpan, toolSpansToTraceAnalysisStore } from "@tangle-network/agent-eval";
|
|
8
8
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
9
9
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -16,6 +16,7 @@ import { homedir, hostname, tmpdir } from "node:os";
|
|
|
16
16
|
import { stripVTControlCharacters } from "node:util";
|
|
17
17
|
import { ATTR, deriveHexId, isW3CSpanId, isW3CTraceId } from "@tangle-network/agent-trace-contract";
|
|
18
18
|
import { REDACTION_VERSION as REDACTION_VERSION$1, redact } from "@tangle-network/agent-eval/traces";
|
|
19
|
+
import { z } from "zod";
|
|
19
20
|
import { SDKError, generateIdempotencyKey, withRetry } from "@tangle-network/agent-core";
|
|
20
21
|
import { collectAgentFinalMessageText, collectAgentResponseText } from "@tangle-network/sandbox";
|
|
21
22
|
import { request } from "node:http";
|
|
@@ -5308,7 +5309,7 @@ function createOtelExporter(config) {
|
|
|
5308
5309
|
body: JSON.stringify(body),
|
|
5309
5310
|
signal: AbortSignal.timeout(timeoutMs)
|
|
5310
5311
|
});
|
|
5311
|
-
const text = await response.text();
|
|
5312
|
+
const text = await response.text().catch(() => "");
|
|
5312
5313
|
if (!response.ok) {
|
|
5313
5314
|
const detail = text ? `: ${text.slice(0, 200)}` : "";
|
|
5314
5315
|
drop(batch.length, `HTTP ${response.status} from ${url}${detail}`);
|
|
@@ -5323,7 +5324,6 @@ function createOtelExporter(config) {
|
|
|
5323
5324
|
}
|
|
5324
5325
|
/** The single sender: it drains the queue batch by batch until the queue is empty. */
|
|
5325
5326
|
function drain() {
|
|
5326
|
-
if (sending === void 0 && queue.length === 0) return Promise.resolve();
|
|
5327
5327
|
sending ??= (async () => {
|
|
5328
5328
|
try {
|
|
5329
5329
|
while (queue.length > 0) {
|
|
@@ -8579,7 +8579,10 @@ function describeLeakedReservation(leak) {
|
|
|
8579
8579
|
const outcomeSchema = AgentTurnResultSchema.pick({
|
|
8580
8580
|
success: true,
|
|
8581
8581
|
error: true
|
|
8582
|
-
}).extend({
|
|
8582
|
+
}).extend({
|
|
8583
|
+
errorCode: AgentTurnResultSchema.shape.error,
|
|
8584
|
+
statusCode: z.number().int().min(400).max(599).optional()
|
|
8585
|
+
}).strict();
|
|
8583
8586
|
/** Read only the executor envelope; application output and grades are not execution status. */
|
|
8584
8587
|
function executorFailure(result) {
|
|
8585
8588
|
if (result.outcome === void 0) return void 0;
|
|
@@ -8587,7 +8590,8 @@ function executorFailure(result) {
|
|
|
8587
8590
|
if (outcome.success) return void 0;
|
|
8588
8591
|
return {
|
|
8589
8592
|
error: outcome.error ?? "Agent execution failed",
|
|
8590
|
-
...outcome.errorCode === void 0 ? {} : { errorCode: outcome.errorCode }
|
|
8593
|
+
...outcome.errorCode === void 0 ? {} : { errorCode: outcome.errorCode },
|
|
8594
|
+
...outcome.statusCode === void 0 ? {} : { statusCode: outcome.statusCode }
|
|
8591
8595
|
};
|
|
8592
8596
|
}
|
|
8593
8597
|
/** The failure text alone, for callers that record a settlement reason. */
|
|
@@ -10272,11 +10276,12 @@ function unavailableSignalInText(text) {
|
|
|
10272
10276
|
/**
|
|
10273
10277
|
* The code or status that marks a failed turn outcome as an upstream capacity refusal, or
|
|
10274
10278
|
* `undefined`. The outcome's own `errorCode` decides first; the failure text is read only when no
|
|
10275
|
-
* code decided, because a harness CLI
|
|
10279
|
+
* code or numeric status decided, because a harness CLI can report the router's refusal as text.
|
|
10276
10280
|
*/
|
|
10277
10281
|
function unavailableSignalOfFailure(failure) {
|
|
10278
10282
|
const code = failure.errorCode?.toLowerCase();
|
|
10279
10283
|
if (code !== void 0 && UNAVAILABLE_CODES.has(code)) return code;
|
|
10284
|
+
if (failure.statusCode !== void 0) return UNAVAILABLE_STATUSES.has(failure.statusCode) ? `http-${failure.statusCode}` : void 0;
|
|
10280
10285
|
return unavailableSignalInText(failure.error);
|
|
10281
10286
|
}
|
|
10282
10287
|
const DEFAULT_UNAVAILABLE_PAUSE_MS = 15e3;
|
|
@@ -10426,75 +10431,6 @@ function providerAsSandboxClient(provider, options = {}) {
|
|
|
10426
10431
|
});
|
|
10427
10432
|
} };
|
|
10428
10433
|
}
|
|
10429
|
-
/**
|
|
10430
|
-
* The idle timeout this adapter sends when nothing else names one: 1,800 seconds.
|
|
10431
|
-
*
|
|
10432
|
-
* Sandbox substitutes no value of its own: an omitted field falls back to the platform's global
|
|
10433
|
-
* idle timeout, documented as 30 minutes unless an operator changed it, and Runtime sent none. Idle
|
|
10434
|
-
* means inactivity to Sandbox, which suspends the sandbox (the container stops; the workspace is
|
|
10435
|
-
* kept) rather than deleting it. The SDK does not define inactivity further. A request in flight
|
|
10436
|
-
* counts as activity: a Discovery Lab seat created with `idleTimeoutSeconds: 1800` ran one request
|
|
10437
|
-
* to 2,252 seconds, ended by a per-request cap, not by idling (fleet-launch-2026-08-22).
|
|
10438
|
-
*
|
|
10439
|
-
* The value restates the documented default, so it can tighten a longer operator setting but never
|
|
10440
|
-
* loosen the default. It is 3.8 times the longest gap between frames recorded across a healthy
|
|
10441
|
-
* fleet run (469 seconds, same report), and a supervised provider child is observed through an open
|
|
10442
|
-
* stream for its whole turn. It is a backstop for a process that dies holding an environment; the
|
|
10443
|
-
* settlement barrier releases retained environments itself (`Executor.releaseRetained`). It does
|
|
10444
|
-
* nothing on a driver with a create/delete-only lifecycle, which the SDK says skips suspension.
|
|
10445
|
-
*/
|
|
10446
|
-
const DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS = 1800;
|
|
10447
|
-
function sandboxIdleTimeoutSeconds(value) {
|
|
10448
|
-
if (value === void 0) return DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS;
|
|
10449
|
-
if (!Number.isSafeInteger(value) || value <= 0) throw new ValidationError(`sandboxClientAsProvider: idleTimeoutSeconds must be a positive whole number of seconds, got ${String(value)}`);
|
|
10450
|
-
return value;
|
|
10451
|
-
}
|
|
10452
|
-
/**
|
|
10453
|
-
* Adapt a `SandboxClient` into the shared `AgentEnvironmentProvider` contract.
|
|
10454
|
-
* The provider declares the public SDK contract before it creates an environment.
|
|
10455
|
-
* Each environment exposes interactive methods only when its deployment declares every required capability.
|
|
10456
|
-
* @experimental */
|
|
10457
|
-
function sandboxClientAsProvider(client, options = {}) {
|
|
10458
|
-
const providerName = options.name ?? "tangle-sandbox";
|
|
10459
|
-
const idleTimeoutSeconds = sandboxIdleTimeoutSeconds(options.idleTimeoutSeconds);
|
|
10460
|
-
const providerCapabilities = async () => {
|
|
10461
|
-
const resolved = await (options.capabilities ? typeof options.capabilities === "function" ? options.capabilities() : options.capabilities : defaultTangleSandboxCapabilities({
|
|
10462
|
-
namedProfiles: options.resolveProfile !== void 0,
|
|
10463
|
-
rediscover: hasGet(client)
|
|
10464
|
-
}));
|
|
10465
|
-
if (hasGet(client)) return resolved;
|
|
10466
|
-
const { interactiveAgent: _interactiveAgent, ...withoutInteractive } = resolved;
|
|
10467
|
-
return withoutInteractive;
|
|
10468
|
-
};
|
|
10469
|
-
return {
|
|
10470
|
-
name: providerName,
|
|
10471
|
-
capabilities: providerCapabilities,
|
|
10472
|
-
...options.validateProfile ? { validateProfile: options.validateProfile } : {},
|
|
10473
|
-
async create(input) {
|
|
10474
|
-
const custom = options.mapCreateInput?.(input);
|
|
10475
|
-
const createOptions = custom === void 0 ? await sandboxOptionsFromCreateInput(input, options.defaultBackend ?? "opencode", options.resolveProfile, providerName, idleTimeoutSeconds) : {
|
|
10476
|
-
...custom,
|
|
10477
|
-
idleTimeoutSeconds: custom.idleTimeoutSeconds ?? idleTimeoutSeconds
|
|
10478
|
-
};
|
|
10479
|
-
const capabilities = await providerCapabilities();
|
|
10480
|
-
return sandboxInstanceAsEnvironment(await client.create(createOptions, input.signal === void 0 ? void 0 : { signal: input.signal }), providerName, client, capabilities, idleTimeoutSeconds);
|
|
10481
|
-
},
|
|
10482
|
-
...hasGet(client) ? { async get(id) {
|
|
10483
|
-
const capabilities = await providerCapabilities();
|
|
10484
|
-
const box = await client.get(id);
|
|
10485
|
-
return box ? sandboxInstanceAsEnvironment(box, providerName, client, capabilities, idleTimeoutSeconds) : null;
|
|
10486
|
-
} } : {},
|
|
10487
|
-
...hasList(client) ? { async list(query) {
|
|
10488
|
-
return (await client.list(query?.providerOptions)).map((box) => ({
|
|
10489
|
-
id: String(box.id),
|
|
10490
|
-
provider: providerName,
|
|
10491
|
-
name: typeof box.name === "string" ? box.name : void 0,
|
|
10492
|
-
status: statusFromUnknown(readBoxStatus(box)),
|
|
10493
|
-
metadata: readBoxMetadata(box)
|
|
10494
|
-
}));
|
|
10495
|
-
} } : {}
|
|
10496
|
-
};
|
|
10497
|
-
}
|
|
10498
10434
|
/** Only a verified, single-session capture may supply a scalar session identity. */
|
|
10499
10435
|
function capturedSessionIdentity(provenance, coverageComplete, executionId, providerSessionId) {
|
|
10500
10436
|
const unknown = {
|
|
@@ -11178,7 +11114,8 @@ async function* streamProviderExecutor(args) {
|
|
|
11178
11114
|
...result.outcome?.status === "failed" ? { outcome: {
|
|
11179
11115
|
success: false,
|
|
11180
11116
|
...result.outcome.error ? { error: result.outcome.error } : {},
|
|
11181
|
-
...result.outcome.errorCode ? { errorCode: result.outcome.errorCode } : {}
|
|
11117
|
+
...result.outcome.errorCode ? { errorCode: result.outcome.errorCode } : {},
|
|
11118
|
+
...failureStatusCode(result.outcome) === void 0 ? {} : { statusCode: failureStatusCode(result.outcome) }
|
|
11182
11119
|
} } : {},
|
|
11183
11120
|
outRef: contentRef(`provider:${args.provider.name}`, settledResult),
|
|
11184
11121
|
out: settledResult,
|
|
@@ -11187,7 +11124,8 @@ async function* streamProviderExecutor(args) {
|
|
|
11187
11124
|
};
|
|
11188
11125
|
const refusal = args.mayContinue && source.retained && result.outcome?.status === "failed" ? unavailableSignalOfFailure({
|
|
11189
11126
|
error: result.outcome.error ?? "",
|
|
11190
|
-
...result.outcome.errorCode ? { errorCode: result.outcome.errorCode } : {}
|
|
11127
|
+
...result.outcome.errorCode ? { errorCode: result.outcome.errorCode } : {},
|
|
11128
|
+
...failureStatusCode(result.outcome) === void 0 ? {} : { statusCode: failureStatusCode(result.outcome) }
|
|
11191
11129
|
}) : void 0;
|
|
11192
11130
|
if (refusal !== void 0) unavailable = {
|
|
11193
11131
|
signal: refusal,
|
|
@@ -11568,52 +11506,6 @@ function createInputFromSandboxOptions(options) {
|
|
|
11568
11506
|
providerOptions: { sandboxCreateOptions: options ?? {} }
|
|
11569
11507
|
};
|
|
11570
11508
|
}
|
|
11571
|
-
async function sandboxOptionsFromCreateInput(input, defaultBackend, resolveProfile, providerName = "tangle-sandbox", idleTimeoutSeconds = DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS) {
|
|
11572
|
-
if (input.runtimeAttachments !== void 0) throw new ValidationError("Tangle Sandbox runtimeAttachments require an explicit mapCreateInput mapper; the maintained Sandbox SDK create contract does not transport them");
|
|
11573
|
-
const backendType = input.backend ?? defaultBackend;
|
|
11574
|
-
const workspace = WorkspaceRequestSchema.parse(input.workspace ?? {});
|
|
11575
|
-
const environment = sandboxEnvironmentFromWorkspace(workspace);
|
|
11576
|
-
const cwd = workspaceCwdPathForBase(workspace.cwd, "repository", providerName);
|
|
11577
|
-
const providerOptions = input.providerOptions?.sandboxCreateOptions;
|
|
11578
|
-
const base = providerOptions && typeof providerOptions === "object" ? { ...providerOptions } : {};
|
|
11579
|
-
assertSandboxSecretNames(input.secrets);
|
|
11580
|
-
assertSandboxSecretNames(base.secrets);
|
|
11581
|
-
const profile = await sandboxProfileFromReference(input.profile, resolveProfile);
|
|
11582
|
-
const { profile: _baseProfile, ...baseBackend } = base.backend ?? {};
|
|
11583
|
-
return {
|
|
11584
|
-
...base,
|
|
11585
|
-
idleTimeoutSeconds: base.idleTimeoutSeconds ?? idleTimeoutSeconds,
|
|
11586
|
-
...environment ? { environment } : {},
|
|
11587
|
-
...workspace.repoUrl ? { git: {
|
|
11588
|
-
url: workspace.repoUrl,
|
|
11589
|
-
ref: workspace.gitRef
|
|
11590
|
-
} } : {},
|
|
11591
|
-
...cwd === void 0 ? {} : { cwd },
|
|
11592
|
-
...input.resources ? { resources: input.resources } : {},
|
|
11593
|
-
...input.env ? { env: input.env } : {},
|
|
11594
|
-
...Array.isArray(input.secrets) ? { secrets: input.secrets } : {},
|
|
11595
|
-
...input.metadata ? { metadata: input.metadata } : {},
|
|
11596
|
-
...input.name ? { name: input.name } : {},
|
|
11597
|
-
...input.idempotencyKey ? { idempotencyKey: input.idempotencyKey } : {},
|
|
11598
|
-
backend: {
|
|
11599
|
-
...baseBackend,
|
|
11600
|
-
type: backendType,
|
|
11601
|
-
profile
|
|
11602
|
-
}
|
|
11603
|
-
};
|
|
11604
|
-
}
|
|
11605
|
-
function assertSandboxSecretNames(secrets) {
|
|
11606
|
-
if (secrets !== void 0 && secrets !== "all" && (!Array.isArray(secrets) || secrets.some((secret) => typeof secret !== "string" || secret.trim().length === 0))) throw new ValidationError("Tangle Sandbox secret names must be non-empty strings; secret values are unsupported");
|
|
11607
|
-
}
|
|
11608
|
-
function sandboxEnvironmentFromWorkspace(workspace) {
|
|
11609
|
-
if (workspace.environment !== void 0 && workspace.image !== void 0 && workspace.environment !== workspace.image) throw new ValidationError("Tangle Sandbox accepts one environment value; workspace.environment and workspace.image must match");
|
|
11610
|
-
return workspace.environment ?? workspace.image;
|
|
11611
|
-
}
|
|
11612
|
-
async function sandboxProfileFromReference(profile, resolveProfile) {
|
|
11613
|
-
if (typeof profile !== "string") return profile;
|
|
11614
|
-
if (!resolveProfile) throw new ValidationError(`Tangle Sandbox requires an inline AgentProfile; named profile "${profile}" needs SandboxClientProviderOptions.resolveProfile`);
|
|
11615
|
-
return resolveProfile(profile);
|
|
11616
|
-
}
|
|
11617
11509
|
function environmentAsSandboxInstance(environment, options) {
|
|
11618
11510
|
let providerSessionId = null;
|
|
11619
11511
|
let controlRef;
|
|
@@ -11785,147 +11677,6 @@ function environmentAsSandboxInstance(environment, options) {
|
|
|
11785
11677
|
}
|
|
11786
11678
|
};
|
|
11787
11679
|
}
|
|
11788
|
-
async function sandboxInstanceAsEnvironment(box, providerName, client, providerCapabilities, idleTimeoutSeconds) {
|
|
11789
|
-
const capabilities = await sandboxEnvironmentCapabilities(box, providerCapabilities);
|
|
11790
|
-
const interactiveAgent = capabilities.interactiveAgent;
|
|
11791
|
-
return {
|
|
11792
|
-
id: String(box.id),
|
|
11793
|
-
provider: providerName,
|
|
11794
|
-
capabilities,
|
|
11795
|
-
...typeof box.name === "string" ? { name: box.name } : {},
|
|
11796
|
-
...readBoxMetadata(box) ? { metadata: readBoxMetadata(box) } : {},
|
|
11797
|
-
async status() {
|
|
11798
|
-
await maybeRefresh(box);
|
|
11799
|
-
return statusFromUnknown(readBoxStatus(box));
|
|
11800
|
-
},
|
|
11801
|
-
async *stream(input) {
|
|
11802
|
-
for await (const event of box.streamPrompt(promptFromAgentTurnInput(input), promptOptionsFromAgentTurnInput(input))) yield environmentEventFromSandboxEvent(event);
|
|
11803
|
-
},
|
|
11804
|
-
...hasDispatchPrompt(box) ? { async dispatch(input) {
|
|
11805
|
-
return sessionRefFromSandboxDispatch(await box.dispatchPrompt(promptFromAgentTurnInput(input), promptOptionsFromAgentTurnInput(input)), providerName);
|
|
11806
|
-
} } : {},
|
|
11807
|
-
...hasSession(box) ? {
|
|
11808
|
-
session(id, sessionOptions) {
|
|
11809
|
-
return sandboxSessionAsAgentSession(box.session(id), sessionOptions?.controlRef);
|
|
11810
|
-
},
|
|
11811
|
-
async respondToInteraction(command, options) {
|
|
11812
|
-
return (await box.session(command.binding.sessionId).respondToInteraction(command, options)).acknowledgement;
|
|
11813
|
-
}
|
|
11814
|
-
} : {},
|
|
11815
|
-
...interactiveAgent ? {
|
|
11816
|
-
async startInteractive(request, options) {
|
|
11817
|
-
const exactRequest = AgentInteractiveSessionStartSchema.parse(request);
|
|
11818
|
-
assertSandboxInteractiveBinding(exactRequest.run, box, providerName);
|
|
11819
|
-
const result = await box.session(exactRequest.run.sessionId).interactive().start(exactRequest, options);
|
|
11820
|
-
if (result.state !== "running") throw new ValidationError("sandbox interactive process settled before attachment");
|
|
11821
|
-
const ref = detachedSnapshot(AgentInteractiveSessionRefSchema.parse(result.ref), "sandbox interactive start reference");
|
|
11822
|
-
if (!agentInteractiveSessionRefMatchesStart(exactRequest, ref)) throw new ValidationError("sandbox interactive start returned a different exact process");
|
|
11823
|
-
return ref;
|
|
11824
|
-
},
|
|
11825
|
-
interactive(ref) {
|
|
11826
|
-
const exactRef = detachedSnapshot(AgentInteractiveSessionRefSchema.parse(ref), "sandbox interactive reference");
|
|
11827
|
-
assertSandboxInteractiveBinding(exactRef.run, box, providerName);
|
|
11828
|
-
const session = box.session(exactRef.run.sessionId).interactive({ ref: exactRef });
|
|
11829
|
-
const controlledSessions = /* @__PURE__ */ new Map();
|
|
11830
|
-
const controlledSession = (control) => {
|
|
11831
|
-
const key = canonicalCandidateDigest(control);
|
|
11832
|
-
const existing = controlledSessions.get(key);
|
|
11833
|
-
if (existing) return existing;
|
|
11834
|
-
const created = box.session(exactRef.run.sessionId).interactive({
|
|
11835
|
-
ref: exactRef,
|
|
11836
|
-
control
|
|
11837
|
-
});
|
|
11838
|
-
controlledSessions.set(key, created);
|
|
11839
|
-
return created;
|
|
11840
|
-
};
|
|
11841
|
-
return {
|
|
11842
|
-
ref: exactRef,
|
|
11843
|
-
claimControl: (request, options) => session.claimControl(request, options),
|
|
11844
|
-
async status(options) {
|
|
11845
|
-
const status = await session.status(options);
|
|
11846
|
-
if (status === null) throw new ValidationError(`sandbox interactive session "${exactRef.run.sessionId}" is unavailable`);
|
|
11847
|
-
return status;
|
|
11848
|
-
},
|
|
11849
|
-
attach: (request, options) => {
|
|
11850
|
-
const controlled = controlledSession(request.control);
|
|
11851
|
-
if (typeof controlled.attachAgentTerminal !== "function") return Promise.reject(new ValidationError("sandbox interactive session does not expose the exact terminal adapter"));
|
|
11852
|
-
return controlled.attachAgentTerminal(request, options);
|
|
11853
|
-
},
|
|
11854
|
-
sendPrompt: (command, options) => controlledSession(command.control).sendPrompt(command, options),
|
|
11855
|
-
stop: (command, options) => controlledSession(command.control).stop(command, options)
|
|
11856
|
-
};
|
|
11857
|
-
}
|
|
11858
|
-
} : {},
|
|
11859
|
-
...hasRead(box) ? { read: box.read.bind(box) } : {},
|
|
11860
|
-
...hasWrite(box) ? { write: box.write.bind(box) } : {},
|
|
11861
|
-
...hasExec(box) ? { async exec(command, options) {
|
|
11862
|
-
return execResultFromSandboxExecResult(await box.exec(command, options));
|
|
11863
|
-
} } : {},
|
|
11864
|
-
async checkpoint(options) {
|
|
11865
|
-
return {
|
|
11866
|
-
id: (await box.snapshot({ ...options?.name ? { tags: [options.name] } : {} })).snapshotId,
|
|
11867
|
-
provider: providerName,
|
|
11868
|
-
...options?.metadata ? { metadata: options.metadata } : {}
|
|
11869
|
-
};
|
|
11870
|
-
},
|
|
11871
|
-
async fork(checkpoint, options) {
|
|
11872
|
-
return sandboxInstanceAsEnvironment(await client.create({
|
|
11873
|
-
fromSnapshot: checkpoint.id,
|
|
11874
|
-
fromSandboxId: String(box.id),
|
|
11875
|
-
idleTimeoutSeconds,
|
|
11876
|
-
...options?.name ? { name: options.name } : {},
|
|
11877
|
-
...options?.metadata ? { metadata: options.metadata } : {}
|
|
11878
|
-
}), providerName, client, providerCapabilities, idleTimeoutSeconds);
|
|
11879
|
-
},
|
|
11880
|
-
async placement() {
|
|
11881
|
-
return placementInfoFromLoopPlacement(client.describePlacement?.(box), box);
|
|
11882
|
-
},
|
|
11883
|
-
async refresh() {
|
|
11884
|
-
await maybeRefresh(box);
|
|
11885
|
-
},
|
|
11886
|
-
async destroy() {
|
|
11887
|
-
await destroyBox(box);
|
|
11888
|
-
}
|
|
11889
|
-
};
|
|
11890
|
-
}
|
|
11891
|
-
function sandboxSessionAsAgentSession(session, expectedControlRef) {
|
|
11892
|
-
const controlRef = resolveSessionControlRef(session.controlRef, expectedControlRef, { allowExpectedWhenActualAbsent: true });
|
|
11893
|
-
return {
|
|
11894
|
-
id: session.id,
|
|
11895
|
-
...controlRef === void 0 ? {} : { controlRef },
|
|
11896
|
-
async status() {
|
|
11897
|
-
const status = await session.status();
|
|
11898
|
-
if (!status) return null;
|
|
11899
|
-
assertSandboxStatusBinding(status, controlRef);
|
|
11900
|
-
return sessionStatusFromUnknown(status.status);
|
|
11901
|
-
},
|
|
11902
|
-
async *events(options) {
|
|
11903
|
-
const executionId = scopedExecutionId(controlRef, options?.executionId);
|
|
11904
|
-
for await (const event of session.events({
|
|
11905
|
-
...options?.since === void 0 ? {} : { since: options.since },
|
|
11906
|
-
...executionId === void 0 ? {} : { executionId },
|
|
11907
|
-
...options?.signal === void 0 ? {} : { signal: options.signal }
|
|
11908
|
-
})) yield environmentEventFromSandboxEvent(event);
|
|
11909
|
-
},
|
|
11910
|
-
async result(options) {
|
|
11911
|
-
return agentTurnResultFromPromptResult(await awaitAbortable$1(Promise.resolve().then(() => session.result({ ...controlRef?.executionId === void 0 ? {} : { executionId: controlRef.executionId } })), options?.signal));
|
|
11912
|
-
},
|
|
11913
|
-
async prompt(input) {
|
|
11914
|
-
return agentTurnResultFromPromptResult(await session.prompt(promptFromAgentTurnInput(input), promptOptionsFromAgentTurnInput(input)));
|
|
11915
|
-
},
|
|
11916
|
-
...session.respondToInteraction ? { async respondToInteraction(command, options) {
|
|
11917
|
-
assertInteractionCommandScope(command, controlRef);
|
|
11918
|
-
return (await session.respondToInteraction(command, options)).acknowledgement;
|
|
11919
|
-
} } : {},
|
|
11920
|
-
...session.cancelRun ? { async cancelRun(request, options) {
|
|
11921
|
-
assertCancellationScope(request, controlRef);
|
|
11922
|
-
return session.cancelRun(request, options);
|
|
11923
|
-
} } : {},
|
|
11924
|
-
cancel() {
|
|
11925
|
-
return session.interrupt(controlRef?.executionId === void 0 ? void 0 : { executionId: controlRef.executionId }).then(() => void 0);
|
|
11926
|
-
}
|
|
11927
|
-
};
|
|
11928
|
-
}
|
|
11929
11680
|
function sandboxSessionFromAgentSession(session, expectedControlRef) {
|
|
11930
11681
|
if (!session) throw new ValidationError("providerAsSandboxClient: session is unavailable");
|
|
11931
11682
|
const controlRef = resolveSessionControlRef(session.controlRef, expectedControlRef);
|
|
@@ -11999,20 +11750,6 @@ function promptResultFromAgentTurnResult(result) {
|
|
|
11999
11750
|
} : {}
|
|
12000
11751
|
};
|
|
12001
11752
|
}
|
|
12002
|
-
function environmentEventFromSandboxEvent(event) {
|
|
12003
|
-
const data = event.data && typeof event.data === "object" ? event.data : {};
|
|
12004
|
-
const normalized = canonicalStreamEventFromSandboxEvent(event);
|
|
12005
|
-
const usage = tokenUsageFromData(data);
|
|
12006
|
-
const receipt = tokenUsageReceipt(tokenUsageRecord(data));
|
|
12007
|
-
return {
|
|
12008
|
-
type: String(event.type),
|
|
12009
|
-
data,
|
|
12010
|
-
...event.id ? { id: event.id } : {},
|
|
12011
|
-
...normalized ? { normalized } : {},
|
|
12012
|
-
...usage && receipt.complete ? { usage } : {},
|
|
12013
|
-
providerEvent: event
|
|
12014
|
-
};
|
|
12015
|
-
}
|
|
12016
11753
|
function sandboxEventFromEnvironmentEvent(event) {
|
|
12017
11754
|
const normalized = event.normalized;
|
|
12018
11755
|
const type = normalized?.type ?? event.type;
|
|
@@ -12074,12 +11811,14 @@ function providerFailureEvent(event, sandboxEvent) {
|
|
|
12074
11811
|
if (!failedStatus && !failedTerminal) return void 0;
|
|
12075
11812
|
const detail = failureDetail(sandboxEvent.data) ?? failureDetail(outcome) ?? failureDetail(result) ?? (normalized?.type === "status" ? normalized.detail : void 0);
|
|
12076
11813
|
const errorCode = failureCode(sandboxEvent.data) ?? failureCode(outcome) ?? failureCode(result);
|
|
11814
|
+
const statusCode = failureStatusCode(sandboxEvent.data) ?? failureStatusCode(outcome) ?? failureStatusCode(result);
|
|
12077
11815
|
return {
|
|
12078
11816
|
type: "result",
|
|
12079
11817
|
data: {
|
|
12080
11818
|
status: "failed",
|
|
12081
11819
|
...detail ? { error: detail } : {},
|
|
12082
|
-
...errorCode ? { errorCode } : {}
|
|
11820
|
+
...errorCode ? { errorCode } : {},
|
|
11821
|
+
...statusCode === void 0 ? {} : { statusCode }
|
|
12083
11822
|
}
|
|
12084
11823
|
};
|
|
12085
11824
|
}
|
|
@@ -12168,6 +11907,11 @@ function failureDetail(value) {
|
|
|
12168
11907
|
if (typeof value.message === "string") return value.message;
|
|
12169
11908
|
return typeof value.detail === "string" ? value.detail : void 0;
|
|
12170
11909
|
}
|
|
11910
|
+
/** Preserve the Sandbox outcome's numeric HTTP metadata across the provider adapter. */
|
|
11911
|
+
function failureStatusCode(value) {
|
|
11912
|
+
const statusCode = recordValue(value)?.statusCode;
|
|
11913
|
+
return typeof statusCode === "number" && Number.isInteger(statusCode) && statusCode >= 400 && statusCode <= 599 ? statusCode : void 0;
|
|
11914
|
+
}
|
|
12171
11915
|
function failureCode(value) {
|
|
12172
11916
|
if (!value) return void 0;
|
|
12173
11917
|
const error = recordValue(value.error);
|
|
@@ -12239,17 +11983,6 @@ function resolveSessionControlRef(actual, expected, options = {}) {
|
|
|
12239
11983
|
if (!sameControlCoordinates(actualExact.data, expectedExact)) throw new ValidationError("provider session returned a different exact run control reference");
|
|
12240
11984
|
return actualExact.data;
|
|
12241
11985
|
}
|
|
12242
|
-
function assertSandboxStatusBinding(status, controlRef) {
|
|
12243
|
-
if (!status || typeof status !== "object" || controlRef === void 0) return;
|
|
12244
|
-
const record = status;
|
|
12245
|
-
if (record.runControlRef !== void 0) {
|
|
12246
|
-
if (!sameControlCoordinates(AgentExactRunControlRefSchema.parse(record.runControlRef), controlRef)) throw new ValidationError("sandbox status returned a different exact run control reference");
|
|
12247
|
-
}
|
|
12248
|
-
for (const key of ["activeExecutionId", "latestExecutionId"]) {
|
|
12249
|
-
const executionId = record[key];
|
|
12250
|
-
if (executionId !== void 0 && executionId !== controlRef.executionId) throw new ValidationError("sandbox status returned a different execution");
|
|
12251
|
-
}
|
|
12252
|
-
}
|
|
12253
11986
|
function assertInteractionCommandScope(command, controlRef) {
|
|
12254
11987
|
if (controlRef === void 0) return;
|
|
12255
11988
|
if (command.binding.runId !== controlRef.runId || command.binding.environmentId !== controlRef.environmentId || command.binding.sessionId !== controlRef.sessionId || command.binding.executionId !== controlRef.executionId) throw new ValidationError("interaction response targeted a different execution");
|
|
@@ -12387,50 +12120,6 @@ function isUsageType(type) {
|
|
|
12387
12120
|
function isNestedUsageType(type) {
|
|
12388
12121
|
return isSandboxTerminalEvent(type) && sandboxTerminalUsageField(type) === "usage";
|
|
12389
12122
|
}
|
|
12390
|
-
function tokenUsageFromData(data) {
|
|
12391
|
-
const usageRecord = tokenUsageRecord(data);
|
|
12392
|
-
const inputTokens = inputTokensFromUsage(usageRecord);
|
|
12393
|
-
const outputTokens = outputTokensFromUsage(usageRecord);
|
|
12394
|
-
const totalTokens = finiteNumber(usageRecord.totalTokens);
|
|
12395
|
-
const cacheReadInputTokens = finiteNumber(usageRecord.cacheReadInputTokens);
|
|
12396
|
-
const cacheCreationInputTokens = finiteNumber(usageRecord.cacheCreationInputTokens);
|
|
12397
|
-
const reasoningTokens = finiteNumber(usageRecord.reasoningTokens);
|
|
12398
|
-
const cost = finiteNumber(usageRecord.cost) ?? finiteNumber(usageRecord.costUsd) ?? finiteNumber(usageRecord.totalCostUsd) ?? finiteNumber(data.costUsd) ?? finiteNumber(data.totalCostUsd);
|
|
12399
|
-
if (inputTokens === void 0 && outputTokens === void 0 && totalTokens === void 0 && cacheReadInputTokens === void 0 && cacheCreationInputTokens === void 0 && reasoningTokens === void 0 && cost === void 0) return void 0;
|
|
12400
|
-
return {
|
|
12401
|
-
inputTokens: inputTokens ?? 0,
|
|
12402
|
-
outputTokens: outputTokens ?? 0,
|
|
12403
|
-
...totalTokens !== void 0 ? { totalTokens } : {},
|
|
12404
|
-
...cacheReadInputTokens !== void 0 ? { cacheReadInputTokens } : {},
|
|
12405
|
-
...cacheCreationInputTokens !== void 0 ? { cacheCreationInputTokens } : {},
|
|
12406
|
-
...reasoningTokens !== void 0 ? { reasoningTokens } : {},
|
|
12407
|
-
...cost !== void 0 ? { cost } : {}
|
|
12408
|
-
};
|
|
12409
|
-
}
|
|
12410
|
-
function tokenUsageRecord(data) {
|
|
12411
|
-
return recordValue(data.usage) ?? recordValue(data.tokenUsage) ?? data;
|
|
12412
|
-
}
|
|
12413
|
-
function inputTokensFromUsage(value) {
|
|
12414
|
-
const usage = recordValue(value);
|
|
12415
|
-
if (!usage) return void 0;
|
|
12416
|
-
return finiteNumber(usage.inputTokens) ?? finiteNumber(usage.tokensIn) ?? finiteNumber(usage.prompt_tokens);
|
|
12417
|
-
}
|
|
12418
|
-
function outputTokensFromUsage(value) {
|
|
12419
|
-
const usage = recordValue(value);
|
|
12420
|
-
if (!usage) return void 0;
|
|
12421
|
-
return finiteNumber(usage.outputTokens) ?? finiteNumber(usage.tokensOut) ?? finiteNumber(usage.completion_tokens);
|
|
12422
|
-
}
|
|
12423
|
-
function tokenUsageReceipt(value) {
|
|
12424
|
-
const usage = recordValue(value);
|
|
12425
|
-
const hasInput = inputTokensFromUsage(usage) !== void 0;
|
|
12426
|
-
const hasOutput = outputTokensFromUsage(usage) !== void 0;
|
|
12427
|
-
return {
|
|
12428
|
-
hasInput,
|
|
12429
|
-
hasOutput,
|
|
12430
|
-
hasTokens: hasInput || hasOutput || finiteNumber(usage?.totalTokens) !== void 0 || finiteNumber(usage?.cacheReadInputTokens) !== void 0 || finiteNumber(usage?.cacheCreationInputTokens) !== void 0 || finiteNumber(usage?.reasoningTokens) !== void 0,
|
|
12431
|
-
complete: hasInput && hasOutput
|
|
12432
|
-
};
|
|
12433
|
-
}
|
|
12434
12123
|
function mergeTokenUsage(left, right) {
|
|
12435
12124
|
if (!left) return right;
|
|
12436
12125
|
if (!right) return left;
|
|
@@ -12444,21 +12133,9 @@ function mergeTokenUsage(left, right) {
|
|
|
12444
12133
|
...left.cost !== void 0 || right.cost !== void 0 ? { cost: (left.cost ?? 0) + (right.cost ?? 0) } : {}
|
|
12445
12134
|
};
|
|
12446
12135
|
}
|
|
12447
|
-
function finiteNumber(value) {
|
|
12448
|
-
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
12449
|
-
}
|
|
12450
12136
|
function stringValue(value) {
|
|
12451
12137
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
12452
12138
|
}
|
|
12453
|
-
function agentTurnResultFromPromptResult(result) {
|
|
12454
|
-
const record = result;
|
|
12455
|
-
return {
|
|
12456
|
-
text: typeof record.response === "string" ? record.response : typeof record.text === "string" ? record.text : typeof record.finalText === "string" ? record.finalText : "",
|
|
12457
|
-
success: typeof record.success === "boolean" ? record.success : true,
|
|
12458
|
-
...typeof record.error === "string" ? { error: record.error } : {},
|
|
12459
|
-
usage: tokenUsageFromData(record)
|
|
12460
|
-
};
|
|
12461
|
-
}
|
|
12462
12139
|
function sandboxDispatchResultFromSessionRef(session) {
|
|
12463
12140
|
const controlRef = session.controlRef === void 0 ? void 0 : AgentExactRunControlRefSchema.parse(session.controlRef);
|
|
12464
12141
|
const metadataExecutionId = optionalDispatchIdentity(session.metadata?.executionId, "executionId");
|
|
@@ -12479,50 +12156,11 @@ function sandboxDispatchResultFromSessionRef(session) {
|
|
|
12479
12156
|
}
|
|
12480
12157
|
};
|
|
12481
12158
|
}
|
|
12482
|
-
function sessionRefFromSandboxDispatch(dispatched, providerName) {
|
|
12483
|
-
const record = dispatched && typeof dispatched === "object" ? dispatched : void 0;
|
|
12484
|
-
const id = record?.sessionId ?? record?.id;
|
|
12485
|
-
if (typeof id !== "string" || id.length === 0) throw new ValidationError("sandboxClientAsProvider: dispatch returned no session id");
|
|
12486
|
-
if (!record) throw new ValidationError("sandboxClientAsProvider: dispatch returned no session record");
|
|
12487
|
-
const executionId = optionalDispatchIdentity(record.executionId, "executionId");
|
|
12488
|
-
const controlRef = record.runControlRef === void 0 ? void 0 : AgentExactRunControlRefSchema.parse(record.runControlRef);
|
|
12489
|
-
if (controlRef !== void 0) {
|
|
12490
|
-
if (controlRef.sessionId !== id || controlRef.provider !== providerName) throw new ValidationError("sandbox dispatch returned a control reference for another session");
|
|
12491
|
-
if (executionId !== void 0 && controlRef.executionId !== executionId) throw new ValidationError("sandbox dispatch returned conflicting execution identities");
|
|
12492
|
-
}
|
|
12493
|
-
if (record.alreadyExisted !== void 0 && typeof record.alreadyExisted !== "boolean") throw new ValidationError("sandbox dispatch returned an invalid alreadyExisted flag");
|
|
12494
|
-
if (record.dispatched !== void 0 && typeof record.dispatched !== "boolean") throw new ValidationError("sandbox dispatch returned an invalid dispatched flag");
|
|
12495
|
-
if (record.status !== void 0 && !isSandboxSessionStatus(record.status)) throw new ValidationError("sandbox dispatch returned an invalid session status");
|
|
12496
|
-
return {
|
|
12497
|
-
id,
|
|
12498
|
-
provider: providerName,
|
|
12499
|
-
...controlRef === void 0 ? {} : { controlRef },
|
|
12500
|
-
metadata: {
|
|
12501
|
-
...record.status ? { status: record.status } : {},
|
|
12502
|
-
...executionId === void 0 ? {} : { executionId },
|
|
12503
|
-
...record.alreadyExisted !== void 0 ? { alreadyExisted: record.alreadyExisted } : {},
|
|
12504
|
-
...record.dispatched !== void 0 ? { dispatched: record.dispatched } : {}
|
|
12505
|
-
}
|
|
12506
|
-
};
|
|
12507
|
-
}
|
|
12508
12159
|
function optionalDispatchIdentity(value, label) {
|
|
12509
12160
|
if (value === void 0) return void 0;
|
|
12510
12161
|
if (typeof value !== "string" || value.length === 0) throw new ValidationError(`sandbox dispatch returned an invalid ${label}`);
|
|
12511
12162
|
return value;
|
|
12512
12163
|
}
|
|
12513
|
-
function isSandboxSessionStatus(value) {
|
|
12514
|
-
return value === "queued" || value === "running" || value === "completed" || value === "failed" || value === "cancelled";
|
|
12515
|
-
}
|
|
12516
|
-
function execResultFromSandboxExecResult(result) {
|
|
12517
|
-
const record = result;
|
|
12518
|
-
const exitCode = finiteNumber(record.exitCode) ?? finiteNumber(record.code);
|
|
12519
|
-
if (exitCode === void 0) throw new ValidationError("sandboxClientAsProvider: exec returned no exit code");
|
|
12520
|
-
return {
|
|
12521
|
-
exitCode,
|
|
12522
|
-
stdout: typeof record.stdout === "string" ? record.stdout : "",
|
|
12523
|
-
stderr: typeof record.stderr === "string" ? record.stderr : ""
|
|
12524
|
-
};
|
|
12525
|
-
}
|
|
12526
12164
|
function statusFromUnknown(status) {
|
|
12527
12165
|
if (status === "pending" || status === "provisioning" || status === "running") return status;
|
|
12528
12166
|
if (status === "stopped" || status === "failed" || status === "expired") return status;
|
|
@@ -12534,133 +12172,6 @@ function sessionStatusFromUnknown(status) {
|
|
|
12534
12172
|
if (status === "completed" || status === "cancelled") return status;
|
|
12535
12173
|
return statusFromUnknown(status);
|
|
12536
12174
|
}
|
|
12537
|
-
function readBoxStatus(box) {
|
|
12538
|
-
return box.status;
|
|
12539
|
-
}
|
|
12540
|
-
function readBoxMetadata(box) {
|
|
12541
|
-
const metadata = box.metadata;
|
|
12542
|
-
return metadata && typeof metadata === "object" ? metadata : void 0;
|
|
12543
|
-
}
|
|
12544
|
-
async function maybeRefresh(box) {
|
|
12545
|
-
const refresh = box.refresh;
|
|
12546
|
-
if (typeof refresh === "function") await refresh.call(box);
|
|
12547
|
-
}
|
|
12548
|
-
async function destroyBox(box) {
|
|
12549
|
-
const deleteBox = box.delete;
|
|
12550
|
-
if (typeof deleteBox === "function") await deleteBox.call(box);
|
|
12551
|
-
}
|
|
12552
|
-
function placementInfoFromLoopPlacement(placement, box) {
|
|
12553
|
-
if (!placement) return {
|
|
12554
|
-
kind: "sandbox",
|
|
12555
|
-
sandboxId: String(box.id)
|
|
12556
|
-
};
|
|
12557
|
-
return {
|
|
12558
|
-
kind: placement.kind === "fleet" ? "fleet" : placement.kind === "in-process" ? "local" : "sandbox",
|
|
12559
|
-
...placement.sandboxId ? { sandboxId: placement.sandboxId } : { sandboxId: String(box.id) },
|
|
12560
|
-
...placement.fleetId ? { fleetId: placement.fleetId } : {},
|
|
12561
|
-
...placement.machineId ? { machineId: placement.machineId } : {}
|
|
12562
|
-
};
|
|
12563
|
-
}
|
|
12564
|
-
const completeInteractiveAgentCapabilities = {
|
|
12565
|
-
start: true,
|
|
12566
|
-
control: true,
|
|
12567
|
-
status: true,
|
|
12568
|
-
attach: true,
|
|
12569
|
-
reattach: true,
|
|
12570
|
-
sendPrompt: true,
|
|
12571
|
-
input: true,
|
|
12572
|
-
resize: true,
|
|
12573
|
-
stop: true
|
|
12574
|
-
};
|
|
12575
|
-
async function sandboxEnvironmentCapabilities(box, providerCapabilities) {
|
|
12576
|
-
const { interactiveAgent: providerInteractive, ...baseCapabilities } = providerCapabilities;
|
|
12577
|
-
if (!hasCompleteInteractiveAgentCapabilities(providerInteractive)) return baseCapabilities;
|
|
12578
|
-
let deployed;
|
|
12579
|
-
try {
|
|
12580
|
-
deployed = await box.capabilities();
|
|
12581
|
-
} catch {
|
|
12582
|
-
return baseCapabilities;
|
|
12583
|
-
}
|
|
12584
|
-
if (!hasCompleteInteractiveAgentCapabilities(deployed?.interactiveAgent)) return baseCapabilities;
|
|
12585
|
-
if (!hasExactInteractiveTerminalAdapter(box)) return baseCapabilities;
|
|
12586
|
-
return {
|
|
12587
|
-
...baseCapabilities,
|
|
12588
|
-
interactiveAgent: { ...completeInteractiveAgentCapabilities }
|
|
12589
|
-
};
|
|
12590
|
-
}
|
|
12591
|
-
function hasExactInteractiveTerminalAdapter(box) {
|
|
12592
|
-
if (!hasSession(box)) return false;
|
|
12593
|
-
try {
|
|
12594
|
-
const session = box.session("__runtime-capability-probe__");
|
|
12595
|
-
const interactive = session.interactive;
|
|
12596
|
-
if (typeof interactive !== "function") return false;
|
|
12597
|
-
return typeof interactive.call(session).attachAgentTerminal === "function";
|
|
12598
|
-
} catch {
|
|
12599
|
-
return false;
|
|
12600
|
-
}
|
|
12601
|
-
}
|
|
12602
|
-
function hasCompleteInteractiveAgentCapabilities(value) {
|
|
12603
|
-
return value?.start === true && value.control === true && value.status === true && value.attach === true && value.reattach === true && value.sendPrompt === true && value.input === true && value.resize === true && value.stop === true;
|
|
12604
|
-
}
|
|
12605
|
-
function assertSandboxInteractiveBinding(run, box, providerName) {
|
|
12606
|
-
if (run.provider !== providerName || run.environmentId !== String(box.id)) throw new ValidationError("sandbox interactive request targets another environment");
|
|
12607
|
-
}
|
|
12608
|
-
function defaultTangleSandboxCapabilities(options) {
|
|
12609
|
-
return {
|
|
12610
|
-
profile: {
|
|
12611
|
-
namedProfiles: options.namedProfiles,
|
|
12612
|
-
systemPrompt: { ...harnessSystemPromptIntents(void 0) },
|
|
12613
|
-
instructions: true,
|
|
12614
|
-
tools: true,
|
|
12615
|
-
permissions: true,
|
|
12616
|
-
mcp: true,
|
|
12617
|
-
subagents: true,
|
|
12618
|
-
resources: {
|
|
12619
|
-
files: true,
|
|
12620
|
-
instructions: true,
|
|
12621
|
-
tools: true,
|
|
12622
|
-
skills: true,
|
|
12623
|
-
agents: true,
|
|
12624
|
-
commands: true
|
|
12625
|
-
},
|
|
12626
|
-
hooks: true,
|
|
12627
|
-
modes: true,
|
|
12628
|
-
runtimeUpdate: true,
|
|
12629
|
-
validation: true
|
|
12630
|
-
},
|
|
12631
|
-
streaming: {
|
|
12632
|
-
live: true,
|
|
12633
|
-
replay: true,
|
|
12634
|
-
detach: true,
|
|
12635
|
-
turnIdempotency: true
|
|
12636
|
-
},
|
|
12637
|
-
sessions: {
|
|
12638
|
-
continue: true,
|
|
12639
|
-
list: true,
|
|
12640
|
-
messages: true
|
|
12641
|
-
},
|
|
12642
|
-
workspace: {
|
|
12643
|
-
read: true,
|
|
12644
|
-
write: true,
|
|
12645
|
-
exec: true,
|
|
12646
|
-
git: true,
|
|
12647
|
-
upload: true,
|
|
12648
|
-
download: true,
|
|
12649
|
-
cwdBases: {
|
|
12650
|
-
repository: true,
|
|
12651
|
-
host: false
|
|
12652
|
-
}
|
|
12653
|
-
},
|
|
12654
|
-
branching: {
|
|
12655
|
-
checkpoint: false,
|
|
12656
|
-
fork: false
|
|
12657
|
-
},
|
|
12658
|
-
...options.rediscover ? { interactiveAgent: { ...completeInteractiveAgentCapabilities } } : {},
|
|
12659
|
-
placement: true,
|
|
12660
|
-
usage: true,
|
|
12661
|
-
confidential: false
|
|
12662
|
-
};
|
|
12663
|
-
}
|
|
12664
12175
|
function contentRef(prefix, value) {
|
|
12665
12176
|
let str;
|
|
12666
12177
|
try {
|
|
@@ -12675,164 +12186,6 @@ function contentRef(prefix, value) {
|
|
|
12675
12186
|
}
|
|
12676
12187
|
return `${prefix}:${(hash >>> 0).toString(16).padStart(8, "0")}`;
|
|
12677
12188
|
}
|
|
12678
|
-
function hasGet(client) {
|
|
12679
|
-
return typeof client.get === "function";
|
|
12680
|
-
}
|
|
12681
|
-
function hasList(client) {
|
|
12682
|
-
return typeof client.list === "function";
|
|
12683
|
-
}
|
|
12684
|
-
function hasDispatchPrompt(box) {
|
|
12685
|
-
return typeof box.dispatchPrompt === "function";
|
|
12686
|
-
}
|
|
12687
|
-
function hasSession(box) {
|
|
12688
|
-
return typeof box.session === "function";
|
|
12689
|
-
}
|
|
12690
|
-
function hasRead(box) {
|
|
12691
|
-
return typeof box.read === "function";
|
|
12692
|
-
}
|
|
12693
|
-
function hasWrite(box) {
|
|
12694
|
-
return typeof box.write === "function";
|
|
12695
|
-
}
|
|
12696
|
-
function hasExec(box) {
|
|
12697
|
-
return typeof box.exec === "function";
|
|
12698
|
-
}
|
|
12699
|
-
//#endregion
|
|
12700
|
-
//#region src/runtime/model-identity.ts
|
|
12701
|
-
const SNAPSHOT_TOKEN = /^[A-Za-z0-9._-]+$/u;
|
|
12702
|
-
const datedIsoSuffix = /^(.*)-(\d{4})-(\d{2})-(\d{2})$/u;
|
|
12703
|
-
const datedCompactSuffix = /^(.*)-(\d{4})(\d{2})(\d{2})$/u;
|
|
12704
|
-
const datedMonthSuffix = /^(.*)-(\d{4})-(\d{2})$/u;
|
|
12705
|
-
/** Match equivalent bare and provider-qualified spellings without discarding observed identity. */
|
|
12706
|
-
function observedModelMatchesDeclared(observed, declared) {
|
|
12707
|
-
const observedIdentity = modelIdentityParts(observed);
|
|
12708
|
-
const declaredIdentity = modelIdentityParts(declared);
|
|
12709
|
-
if (!observedIdentity || !declaredIdentity) return false;
|
|
12710
|
-
if (declaredIdentity.snapshot !== void 0 && (observedIdentity.snapshot !== declaredIdentity.snapshot || observedIdentity.snapshotKind !== declaredIdentity.snapshotKind)) return false;
|
|
12711
|
-
return equivalentModelBase(observedIdentity.base, declaredIdentity.base);
|
|
12712
|
-
}
|
|
12713
|
-
/** Merge two observations of one served model while retaining a snapshot-bearing raw identity. */
|
|
12714
|
-
function mergeObservedModelIdentity(current, next) {
|
|
12715
|
-
const currentIdentity = modelIdentityParts(current);
|
|
12716
|
-
const nextIdentity = modelIdentityParts(next);
|
|
12717
|
-
if (!currentIdentity || !nextIdentity) return void 0;
|
|
12718
|
-
if (!equivalentModelBase(currentIdentity.base, nextIdentity.base)) return void 0;
|
|
12719
|
-
if (currentIdentity.snapshot !== void 0 && nextIdentity.snapshot !== void 0 && (currentIdentity.snapshot !== nextIdentity.snapshot || currentIdentity.snapshotKind !== nextIdentity.snapshotKind)) return;
|
|
12720
|
-
return currentIdentity.snapshot === void 0 && nextIdentity.snapshot !== void 0 ? next : current;
|
|
12721
|
-
}
|
|
12722
|
-
/** Return the canonical model and its validated snapshot kind for runtime evidence reduction. */
|
|
12723
|
-
function canonicalObservedModelParts(model) {
|
|
12724
|
-
const identity = modelIdentityParts(model);
|
|
12725
|
-
if (!identity) return void 0;
|
|
12726
|
-
const base = identity.base.slice(identity.base.lastIndexOf("/") + 1);
|
|
12727
|
-
const canonical = identity.snapshot === void 0 ? base : identity.snapshotKind === "date" ? `${base}-${identity.snapshot}` : `${base}@${identity.snapshot}`;
|
|
12728
|
-
return {
|
|
12729
|
-
base,
|
|
12730
|
-
...identity.snapshot !== void 0 ? { snapshot: identity.snapshot } : {},
|
|
12731
|
-
...identity.snapshotKind !== void 0 ? { snapshotKind: identity.snapshotKind } : {},
|
|
12732
|
-
canonical
|
|
12733
|
-
};
|
|
12734
|
-
}
|
|
12735
|
-
/** Return whether an observed identity includes a provider snapshot. */
|
|
12736
|
-
function observedModelHasSnapshot(model) {
|
|
12737
|
-
return modelIdentityParts(model)?.snapshot !== void 0;
|
|
12738
|
-
}
|
|
12739
|
-
function modelIdentityParts(model) {
|
|
12740
|
-
if (model.length === 0) return null;
|
|
12741
|
-
const at = model.lastIndexOf("@");
|
|
12742
|
-
if (at < 0) {
|
|
12743
|
-
const dated = datedModelIdentity(model);
|
|
12744
|
-
if (dated !== void 0) return dated;
|
|
12745
|
-
return modelLeaf(model).length === 0 ? null : { base: model };
|
|
12746
|
-
}
|
|
12747
|
-
const base = model.slice(0, at);
|
|
12748
|
-
const snapshot = model.slice(at + 1);
|
|
12749
|
-
if (base.length === 0 || modelLeaf(base).length === 0 || !SNAPSHOT_TOKEN.test(snapshot)) return null;
|
|
12750
|
-
return {
|
|
12751
|
-
base,
|
|
12752
|
-
snapshot,
|
|
12753
|
-
snapshotKind: "opaque"
|
|
12754
|
-
};
|
|
12755
|
-
}
|
|
12756
|
-
function equivalentModelBase(observed, declared) {
|
|
12757
|
-
const observedPath = modelBaseParts(observed);
|
|
12758
|
-
const declaredPath = modelBaseParts(declared);
|
|
12759
|
-
if (!samePath(observedPath.path, declaredPath.path)) return false;
|
|
12760
|
-
if (observedPath.provider === void 0 || declaredPath.provider === void 0 || observedPath.provider === declaredPath.provider) return true;
|
|
12761
|
-
if (observedPath.provider === "tangle-router" || declaredPath.provider === "tangle-router") {
|
|
12762
|
-
const router = observedPath.provider === "tangle-router" ? observedPath : declaredPath;
|
|
12763
|
-
const upstream = observedPath.provider === "tangle-router" ? declaredPath : observedPath;
|
|
12764
|
-
if (upstream.provider === void 0) return false;
|
|
12765
|
-
return samePath(router.path, upstream.path) || router.path[0] === upstream.provider && samePath(router.path.slice(1), upstream.path);
|
|
12766
|
-
}
|
|
12767
|
-
return false;
|
|
12768
|
-
}
|
|
12769
|
-
function modelBaseParts(model) {
|
|
12770
|
-
const segments = model.split("/");
|
|
12771
|
-
const normalized = segments.length > 1 && isHarnessPrefix(segments[0]) ? segments.slice(1) : segments;
|
|
12772
|
-
if (normalized.length === 1) return {
|
|
12773
|
-
provider: void 0,
|
|
12774
|
-
path: normalized
|
|
12775
|
-
};
|
|
12776
|
-
return {
|
|
12777
|
-
provider: normalized[0],
|
|
12778
|
-
path: normalized.slice(1)
|
|
12779
|
-
};
|
|
12780
|
-
}
|
|
12781
|
-
function isHarnessPrefix(segment) {
|
|
12782
|
-
return segment !== void 0 && harnessTypeSchema.safeParse(segment).success;
|
|
12783
|
-
}
|
|
12784
|
-
function samePath(left, right) {
|
|
12785
|
-
return left.length === right.length && left.every((segment, index) => segment === right[index]);
|
|
12786
|
-
}
|
|
12787
|
-
function modelLeaf(model) {
|
|
12788
|
-
return model.slice(model.lastIndexOf("/") + 1);
|
|
12789
|
-
}
|
|
12790
|
-
/**
|
|
12791
|
-
* Parse the provider's documented dated snapshot forms.
|
|
12792
|
-
*
|
|
12793
|
-
* `undefined` means that the model has no dated shape and must be treated as a normal base.
|
|
12794
|
-
* `null` means that it has a dated shape but the date is invalid, so identity matching fails.
|
|
12795
|
-
*/
|
|
12796
|
-
function datedModelIdentity(model) {
|
|
12797
|
-
const iso = datedIsoSuffix.exec(model);
|
|
12798
|
-
if (iso) {
|
|
12799
|
-
const [, base, yearText, monthText, dayText] = iso;
|
|
12800
|
-
return buildDatedIdentity(base, `${yearText}-${monthText}-${dayText}`, isValidCalendarDate(yearText, monthText, dayText));
|
|
12801
|
-
}
|
|
12802
|
-
const compact = datedCompactSuffix.exec(model);
|
|
12803
|
-
if (compact) {
|
|
12804
|
-
const [, base, yearText, monthText, dayText] = compact;
|
|
12805
|
-
return buildDatedIdentity(base, `${yearText}-${monthText}-${dayText}`, isValidCalendarDate(yearText, monthText, dayText));
|
|
12806
|
-
}
|
|
12807
|
-
const month = datedMonthSuffix.exec(model);
|
|
12808
|
-
if (month) {
|
|
12809
|
-
const [, base, yearText, monthText] = month;
|
|
12810
|
-
return buildDatedIdentity(base, `${yearText}-${monthText}`, isValidCalendarMonth(yearText, monthText));
|
|
12811
|
-
}
|
|
12812
|
-
}
|
|
12813
|
-
function buildDatedIdentity(base, snapshot, valid) {
|
|
12814
|
-
if (base === void 0 || base.length === 0 || base.endsWith("/")) return void 0;
|
|
12815
|
-
return valid ? {
|
|
12816
|
-
base,
|
|
12817
|
-
snapshot,
|
|
12818
|
-
snapshotKind: "date"
|
|
12819
|
-
} : null;
|
|
12820
|
-
}
|
|
12821
|
-
function isValidCalendarDate(yearText, monthText, dayText) {
|
|
12822
|
-
if (yearText === void 0 || monthText === void 0 || dayText === void 0) return false;
|
|
12823
|
-
const year = Number(yearText);
|
|
12824
|
-
const month = Number(monthText);
|
|
12825
|
-
const day = Number(dayText);
|
|
12826
|
-
if (year < 2e3 || year > 2099 || month < 1 || month > 12 || day < 1 || day > 31) return false;
|
|
12827
|
-
const date = new Date(Date.UTC(year, month - 1, day));
|
|
12828
|
-
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
|
|
12829
|
-
}
|
|
12830
|
-
function isValidCalendarMonth(yearText, monthText) {
|
|
12831
|
-
if (yearText === void 0 || monthText === void 0) return false;
|
|
12832
|
-
const year = Number(yearText);
|
|
12833
|
-
const month = Number(monthText);
|
|
12834
|
-
return year >= 2e3 && year <= 2099 && month >= 1 && month <= 12;
|
|
12835
|
-
}
|
|
12836
12189
|
//#endregion
|
|
12837
12190
|
//#region src/runtime/tool-loop.ts
|
|
12838
12191
|
/**
|
|
@@ -13098,7 +12451,7 @@ async function routerChatWithTools(cfg, messages, tools, opts) {
|
|
|
13098
12451
|
let transportAttempts = 1;
|
|
13099
12452
|
const headers = routerRequestHeaders(cfg, opts);
|
|
13100
12453
|
const complete = cfg.complete;
|
|
13101
|
-
const
|
|
12454
|
+
const raw = complete ? await (async () => {
|
|
13102
12455
|
const result = await retryRouterOperation(retry, opts?.signal, (signal) => complete(structuredClone(body), {
|
|
13103
12456
|
headers,
|
|
13104
12457
|
signal
|
|
@@ -13110,10 +12463,11 @@ async function routerChatWithTools(cfg, messages, tools, opts) {
|
|
|
13110
12463
|
method: "POST",
|
|
13111
12464
|
headers,
|
|
13112
12465
|
body: JSON.stringify(body)
|
|
13113
|
-
}, opts?.signal, retry);
|
|
12466
|
+
}, opts?.signal, retry, opts?.onResponse);
|
|
13114
12467
|
transportAttempts = result.attempts;
|
|
13115
12468
|
return routerResponseJson(result.response, result.attempts);
|
|
13116
12469
|
})();
|
|
12470
|
+
const data = raw;
|
|
13117
12471
|
const msg = data.choices?.[0]?.message;
|
|
13118
12472
|
if (!msg) throw new ValidationError$1("router completion: no choices[0].message");
|
|
13119
12473
|
const toolCalls = (msg?.tool_calls ?? []).map((tc, i) => ({
|
|
@@ -13123,6 +12477,7 @@ async function routerChatWithTools(cfg, messages, tools, opts) {
|
|
|
13123
12477
|
}));
|
|
13124
12478
|
const { usage, resources, costUsd, costProvenance, billedCostUsd, cache } = meterTurn(data.usage, cfg.model, transportAttempts);
|
|
13125
12479
|
return {
|
|
12480
|
+
response: raw,
|
|
13126
12481
|
content: msg?.content ?? null,
|
|
13127
12482
|
toolCalls,
|
|
13128
12483
|
transportAttempts,
|
|
@@ -13349,12 +12704,64 @@ function routerRequestHeaders(cfg, opts) {
|
|
|
13349
12704
|
function reportedModel(value) {
|
|
13350
12705
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
13351
12706
|
}
|
|
13352
|
-
async function fetchRouterResponse(url, init, callerSignal, retry) {
|
|
12707
|
+
async function fetchRouterResponse(url, init, callerSignal, retry, onResponse) {
|
|
12708
|
+
let attempt = 0;
|
|
13353
12709
|
const result = await retryRouterOperation(retry, callerSignal, async (signal) => {
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
12710
|
+
attempt += 1;
|
|
12711
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
12712
|
+
let candidate;
|
|
12713
|
+
try {
|
|
12714
|
+
candidate = await fetch(url, {
|
|
12715
|
+
...init,
|
|
12716
|
+
signal
|
|
12717
|
+
});
|
|
12718
|
+
} catch (error) {
|
|
12719
|
+
await observeRouterResponse(onResponse, {
|
|
12720
|
+
endpoint: url,
|
|
12721
|
+
callId: new Headers(init.headers).get("idempotency-key") ?? "",
|
|
12722
|
+
attempt,
|
|
12723
|
+
startedAt,
|
|
12724
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12725
|
+
status: null,
|
|
12726
|
+
headers: {},
|
|
12727
|
+
body: null,
|
|
12728
|
+
error: {
|
|
12729
|
+
name: error instanceof Error ? error.name : "Error",
|
|
12730
|
+
message: error instanceof Error ? error.message : String(error)
|
|
12731
|
+
}
|
|
12732
|
+
}, signal);
|
|
12733
|
+
throw error;
|
|
12734
|
+
}
|
|
12735
|
+
if (onResponse) {
|
|
12736
|
+
const headers = Object.fromEntries([...candidate.headers].filter(([name]) => ![
|
|
12737
|
+
"authorization",
|
|
12738
|
+
"proxy-authorization",
|
|
12739
|
+
"set-cookie",
|
|
12740
|
+
"cookie"
|
|
12741
|
+
].includes(name.toLowerCase())));
|
|
12742
|
+
let body = null;
|
|
12743
|
+
let bodyError;
|
|
12744
|
+
try {
|
|
12745
|
+
body = await candidate.clone().text();
|
|
12746
|
+
} catch (error) {
|
|
12747
|
+
bodyError = error;
|
|
12748
|
+
}
|
|
12749
|
+
await observeRouterResponse(onResponse, {
|
|
12750
|
+
endpoint: url,
|
|
12751
|
+
callId: new Headers(init.headers).get("idempotency-key") ?? "",
|
|
12752
|
+
attempt,
|
|
12753
|
+
startedAt,
|
|
12754
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12755
|
+
status: candidate.status,
|
|
12756
|
+
headers,
|
|
12757
|
+
body,
|
|
12758
|
+
...bodyError === void 0 ? {} : { error: {
|
|
12759
|
+
name: bodyError instanceof Error ? bodyError.name : "Error",
|
|
12760
|
+
message: bodyError instanceof Error ? bodyError.message : String(bodyError)
|
|
12761
|
+
} }
|
|
12762
|
+
}, signal);
|
|
12763
|
+
if (bodyError !== void 0) throw bodyError;
|
|
12764
|
+
}
|
|
13358
12765
|
if (candidate.ok) return candidate;
|
|
13359
12766
|
const text = await candidate.text().catch(() => "<failed to read response body>");
|
|
13360
12767
|
throw new SDKError(`router ${candidate.status}: ${text.slice(0, 200)}`, {
|
|
@@ -13369,6 +12776,28 @@ async function fetchRouterResponse(url, init, callerSignal, retry) {
|
|
|
13369
12776
|
attempts: result.attempts
|
|
13370
12777
|
};
|
|
13371
12778
|
}
|
|
12779
|
+
/** Evidence failure cannot authorize a second inference, even after the request deadline. */
|
|
12780
|
+
async function observeRouterResponse(observer, receipt, signal) {
|
|
12781
|
+
if (!observer) return;
|
|
12782
|
+
let onAbort;
|
|
12783
|
+
try {
|
|
12784
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
12785
|
+
onAbort = () => reject(signal.reason ?? /* @__PURE__ */ new Error("Response observation aborted"));
|
|
12786
|
+
if (signal.aborted) onAbort();
|
|
12787
|
+
else signal.addEventListener("abort", onAbort, { once: true });
|
|
12788
|
+
});
|
|
12789
|
+
await Promise.race([Promise.resolve().then(() => observer(receipt)), aborted]);
|
|
12790
|
+
} catch (error) {
|
|
12791
|
+
throw new SDKError("Router response observation failed", {
|
|
12792
|
+
code: "UNKNOWN",
|
|
12793
|
+
retryable: false,
|
|
12794
|
+
cause: error instanceof Error ? error : new Error(String(error)),
|
|
12795
|
+
context: { phase: "response_observation" }
|
|
12796
|
+
});
|
|
12797
|
+
} finally {
|
|
12798
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
12799
|
+
}
|
|
12800
|
+
}
|
|
13372
12801
|
async function retryRouterOperation(retry, callerSignal, operation) {
|
|
13373
12802
|
let attempts = 0;
|
|
13374
12803
|
try {
|
|
@@ -13379,6 +12808,7 @@ async function retryRouterOperation(retry, callerSignal, operation) {
|
|
|
13379
12808
|
try {
|
|
13380
12809
|
return await operation(attemptSignal.signal);
|
|
13381
12810
|
} catch (error) {
|
|
12811
|
+
if (error instanceof SDKError && error.context?.phase === "response_observation") throw error;
|
|
13382
12812
|
if (callerSignal?.aborted) throw callerSignal.reason ?? error;
|
|
13383
12813
|
if (attemptSignal.signal.aborted) throw new SDKError(`router request timeout after ${retry.requestTimeoutMs}ms`, {
|
|
13384
12814
|
code: "TIMEOUT",
|
|
@@ -18623,6 +18053,7 @@ const ROUTER_TRANSCRIPT_HARNESS = "router";
|
|
|
18623
18053
|
const TURN_CONTENT_BYTES = 256 * 1024;
|
|
18624
18054
|
function createRouterTranscript() {
|
|
18625
18055
|
const kept = [];
|
|
18056
|
+
const records = [];
|
|
18626
18057
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
18627
18058
|
let turnStart = 0;
|
|
18628
18059
|
let replyEchoPending = false;
|
|
@@ -18637,10 +18068,17 @@ function createRouterTranscript() {
|
|
|
18637
18068
|
if (message.role === "assistant") continue;
|
|
18638
18069
|
}
|
|
18639
18070
|
kept.push(message);
|
|
18071
|
+
records.push(message);
|
|
18640
18072
|
}
|
|
18641
18073
|
};
|
|
18642
18074
|
return {
|
|
18643
18075
|
observe,
|
|
18076
|
+
response(receipt) {
|
|
18077
|
+
records.push({
|
|
18078
|
+
type: "provider.response",
|
|
18079
|
+
...receipt
|
|
18080
|
+
});
|
|
18081
|
+
},
|
|
18644
18082
|
reply(reply) {
|
|
18645
18083
|
const message = {
|
|
18646
18084
|
role: "assistant",
|
|
@@ -18655,6 +18093,7 @@ function createRouterTranscript() {
|
|
|
18655
18093
|
})) } : {}
|
|
18656
18094
|
};
|
|
18657
18095
|
kept.push(message);
|
|
18096
|
+
records.push(message);
|
|
18658
18097
|
replyEchoPending = true;
|
|
18659
18098
|
const added = kept.slice(turnStart).map(forTurnEvent);
|
|
18660
18099
|
turnStart = kept.length;
|
|
@@ -18663,7 +18102,7 @@ function createRouterTranscript() {
|
|
|
18663
18102
|
capture() {
|
|
18664
18103
|
if (live !== void 0) observe(live);
|
|
18665
18104
|
if (kept.length === 0) return harnessTranscriptUnavailable("execution-never-started");
|
|
18666
|
-
return harnessTranscriptFromLines(ROUTER_TRANSCRIPT_HARNESS, "conversation",
|
|
18105
|
+
return harnessTranscriptFromLines(ROUTER_TRANSCRIPT_HARNESS, "conversation", records.map((record) => JSON.stringify(record)));
|
|
18667
18106
|
}
|
|
18668
18107
|
};
|
|
18669
18108
|
}
|
|
@@ -19501,6 +18940,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19501
18940
|
routerKey: seam.routerKey,
|
|
19502
18941
|
tools: seam.tools
|
|
19503
18942
|
}, { multiTurn: true });
|
|
18943
|
+
if (model === "tangle/auto") assertRouterAutoDeclaration(profileExecution.extraBody?.auto, profileExecution.stream);
|
|
19504
18944
|
const enabledToolNames = new Set(seam.tools.map((tool) => tool.function.name));
|
|
19505
18945
|
const maxTurns = profileExecution.maxTurns ?? 0;
|
|
19506
18946
|
const requestIdentity = routerRequestIdentity(ctx);
|
|
@@ -19529,6 +18969,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19529
18969
|
let resources;
|
|
19530
18970
|
let transportAttempts = 0;
|
|
19531
18971
|
let observedModel;
|
|
18972
|
+
const providerResponses = [];
|
|
19532
18973
|
let reasoningTokens = 0;
|
|
19533
18974
|
let reasoningKnown = true;
|
|
19534
18975
|
const promptCache = {};
|
|
@@ -19565,6 +19006,11 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19565
19006
|
}, messages, seam.tools, {
|
|
19566
19007
|
...profileExecution.temperature !== void 0 ? { temperature: profileExecution.temperature } : {},
|
|
19567
19008
|
signal: turnController.signal,
|
|
19009
|
+
onResponse: async (receipt) => {
|
|
19010
|
+
providerResponses.push(receipt);
|
|
19011
|
+
transcript.response(receipt);
|
|
19012
|
+
await seam.onProviderResponse?.(structuredClone(receipt));
|
|
19013
|
+
},
|
|
19568
19014
|
...profileExecution.toolChoice ? { toolChoice: profileExecution.toolChoice } : {},
|
|
19569
19015
|
...profileExecution.tokenLimits.applied,
|
|
19570
19016
|
...profileExecution.seed !== void 0 ? { seed: profileExecution.seed } : {},
|
|
@@ -19602,7 +19048,12 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19602
19048
|
}]))).resources;
|
|
19603
19049
|
transportAttempts += res.transportAttempts;
|
|
19604
19050
|
if (res.model !== void 0) recordRuntimeOwnedProviderModel(executor, res.model);
|
|
19605
|
-
|
|
19051
|
+
if (model === "tangle/auto") {
|
|
19052
|
+
assertRouterAutoResponse(profileExecution.extraBody?.auto, res.response, res.model);
|
|
19053
|
+
tokensKnown = false;
|
|
19054
|
+
reasoningKnown = false;
|
|
19055
|
+
usdKnown = false;
|
|
19056
|
+
} else assertObservedRouterModel(res.model, model, "routerToolsInlineExecutor");
|
|
19606
19057
|
if (res.model !== void 0) observedModel = res.model;
|
|
19607
19058
|
mergePromptCache(promptCache, res.cache);
|
|
19608
19059
|
if (res.usage) {
|
|
@@ -19724,6 +19175,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19724
19175
|
turns,
|
|
19725
19176
|
toolCalls: executedToolCalls,
|
|
19726
19177
|
transportAttempts,
|
|
19178
|
+
providerResponses,
|
|
19727
19179
|
...estimatedUsd !== void 0 ? { estimatedCostUsd: estimatedUsd } : {},
|
|
19728
19180
|
...Object.keys(promptCache).length > 0 ? { promptCache } : {},
|
|
19729
19181
|
...reasoningKnown && turns > 0 ? { reasoningTokens } : {}
|
|
@@ -20552,12 +20004,13 @@ const cliInPlaceExecutor = (spec, ctx) => {
|
|
|
20552
20004
|
function snapshotExecutorConfig(config) {
|
|
20553
20005
|
switch (config.backend) {
|
|
20554
20006
|
case "router-tools": {
|
|
20555
|
-
const { complete, executeToolCall, onMessages, onToolStep, ...decisionData } = config;
|
|
20007
|
+
const { complete, executeToolCall, onMessages, onToolStep, onProviderResponse, ...decisionData } = config;
|
|
20556
20008
|
const snapshot = detachedSnapshot(decisionData, "createExecutor router-tools config");
|
|
20557
20009
|
return Object.freeze({
|
|
20558
20010
|
...snapshot,
|
|
20559
20011
|
...complete === void 0 ? {} : { complete },
|
|
20560
20012
|
executeToolCall,
|
|
20013
|
+
...onProviderResponse === void 0 ? {} : { onProviderResponse },
|
|
20561
20014
|
...onMessages === void 0 ? {} : { onMessages },
|
|
20562
20015
|
...onToolStep === void 0 ? {} : { onToolStep }
|
|
20563
20016
|
});
|
|
@@ -23260,21 +22713,22 @@ async function ownerWorkspaceRetentionFailures(events, nodeId, blobs) {
|
|
|
23260
22713
|
if (event.kind === "execution-input") {
|
|
23261
22714
|
flush();
|
|
23262
22715
|
current = {
|
|
22716
|
+
executionId: `${nodeId}:input:${event.seq}`,
|
|
23263
22717
|
environmentIds: /* @__PURE__ */ new Set(),
|
|
23264
|
-
|
|
22718
|
+
controlByEnvironment: /* @__PURE__ */ new Map()
|
|
23265
22719
|
};
|
|
23266
22720
|
} else if (event.kind === "execution-admitted" && event.admission.phase === "environment") {
|
|
23267
22721
|
if (current?.result !== void 0) flush();
|
|
23268
22722
|
current ??= {
|
|
23269
22723
|
environmentIds: /* @__PURE__ */ new Set(),
|
|
23270
|
-
|
|
22724
|
+
controlByEnvironment: /* @__PURE__ */ new Map()
|
|
23271
22725
|
};
|
|
23272
22726
|
current.environmentIds.add(event.admission.environmentId);
|
|
23273
|
-
|
|
23274
|
-
|
|
22727
|
+
} else if (event.kind === "execution-admitted" && event.admission.phase === "dispatched") current?.controlByEnvironment.set(event.admission.controlRef.environmentId, event.admission.controlRef);
|
|
22728
|
+
else if (event.kind === "execution-result") {
|
|
23275
22729
|
current ??= {
|
|
23276
22730
|
environmentIds: /* @__PURE__ */ new Set(),
|
|
23277
|
-
|
|
22731
|
+
controlByEnvironment: /* @__PURE__ */ new Map()
|
|
23278
22732
|
};
|
|
23279
22733
|
current.result = event;
|
|
23280
22734
|
}
|
|
@@ -23301,20 +22755,21 @@ async function ownerWorkspaceRetentionFailures(events, nodeId, blobs) {
|
|
|
23301
22755
|
}
|
|
23302
22756
|
const snapshot = output !== null && typeof output === "object" ? output.workspaceSnapshot : void 0;
|
|
23303
22757
|
const environmentId = [...attempt.environmentIds][0];
|
|
23304
|
-
const
|
|
23305
|
-
if (!hasDurableWorkspaceCapture(output, snapshot, environmentId, executionId)) failures.add(environmentId);
|
|
22758
|
+
const controlRef = attempt.controlByEnvironment.get(environmentId);
|
|
22759
|
+
if (!hasDurableWorkspaceCapture(output, snapshot, environmentId, attempt.executionId, controlRef)) failures.add(environmentId);
|
|
23306
22760
|
}
|
|
23307
22761
|
return failures;
|
|
23308
22762
|
}
|
|
23309
22763
|
/** A stored result authorizes cleanup only for the exact source and complete capture. */
|
|
23310
|
-
function hasDurableWorkspaceCapture(output, snapshot, environmentId, executionId) {
|
|
22764
|
+
function hasDurableWorkspaceCapture(output, snapshot, environmentId, executionId, controlRef) {
|
|
23311
22765
|
const parsed = agentCandidateWorkspaceSnapshotEvidenceSchema.safeParse(snapshot);
|
|
23312
22766
|
if (!parsed.success || !("locator" in parsed.data.manifest) || !("locator" in parsed.data.archive)) return false;
|
|
23313
22767
|
if (output === null || typeof output !== "object") return false;
|
|
23314
22768
|
const capture = output.workspaceCapture;
|
|
23315
22769
|
if (capture === null || typeof capture !== "object") return false;
|
|
23316
22770
|
const receipt = capture;
|
|
23317
|
-
|
|
22771
|
+
const capturedControl = AgentExactRunControlRefSchema.safeParse(receipt.controlRef);
|
|
22772
|
+
if (executionId === void 0 || controlRef === void 0 || !capturedControl.success || !sameControlCoordinates(capturedControl.data, controlRef) || receipt.environmentId !== environmentId || receipt.executionId !== executionId || receipt.coverageComplete !== true) return false;
|
|
23318
22773
|
const linked = agentCandidateWorkspaceSnapshotEvidenceSchema.safeParse(receipt.snapshot);
|
|
23319
22774
|
return linked.success && linked.data.digest === parsed.data.digest && JSON.stringify(linked.data.manifest) === JSON.stringify(parsed.data.manifest) && JSON.stringify(linked.data.archive) === JSON.stringify(parsed.data.archive);
|
|
23320
22775
|
}
|
|
@@ -26506,7 +25961,7 @@ function isInfraError(err) {
|
|
|
26506
25961
|
* journal so the executor can run its `act` inside a nested scope. `act` fails loud if
|
|
26507
25962
|
* called directly — a driver child runs THROUGH its nested-scope executor, never as a root.
|
|
26508
25963
|
*/
|
|
26509
|
-
function driverChild(profile, driver, journal, execution, acceptedSubmission, recoverExecutor) {
|
|
25964
|
+
function driverChild(profile, driver, journal, execution, acceptedSubmission, recoverExecutor, unassessedOutput) {
|
|
26510
25965
|
const name = profile.name ?? driver.name;
|
|
26511
25966
|
const traceSource = driver.traceSource;
|
|
26512
25967
|
const progress = driver.progress;
|
|
@@ -26519,6 +25974,7 @@ function driverChild(profile, driver, journal, execution, acceptedSubmission, re
|
|
|
26519
25974
|
driver,
|
|
26520
25975
|
journal,
|
|
26521
25976
|
...acceptedSubmission ? { acceptedSubmission } : {},
|
|
25977
|
+
...unassessedOutput ? { unassessedOutput } : {},
|
|
26522
25978
|
...recoverExecutor ? { recoverExecutor } : {},
|
|
26523
25979
|
...traceSource ? { traceSource } : {},
|
|
26524
25980
|
...progress ? { progress } : {},
|
|
@@ -26642,7 +26098,8 @@ const driverExecutorFactory = (rawSpec, ctx) => {
|
|
|
26642
26098
|
reported: childWork,
|
|
26643
26099
|
reservation: addSpend(childWork, totalMetered)
|
|
26644
26100
|
};
|
|
26645
|
-
const
|
|
26101
|
+
const acceptedSubmission = spec.acceptedSubmission?.() === true;
|
|
26102
|
+
const verdict = !acceptedSubmission && spec.unassessedOutput?.() === true ? void 0 : deriveDeliveryVerdict(events.filter((event) => event.kind === "settled"), out, acceptedSubmission);
|
|
26646
26103
|
artifact = {
|
|
26647
26104
|
outRef: `${driverRuntime}:${nestedRoot}`,
|
|
26648
26105
|
out: out === void 0 ? null : out,
|
|
@@ -27456,11 +26913,18 @@ const DETERMINISTIC_BRIDGE_CODES = /* @__PURE__ */ new Set([
|
|
|
27456
26913
|
var HarnessTurnFailedError = class extends Error {
|
|
27457
26914
|
runtime;
|
|
27458
26915
|
errorCode;
|
|
26916
|
+
statusCode;
|
|
26917
|
+
/** The shared HTTP error reader also uses this status for persisted diagnostics. */
|
|
26918
|
+
status;
|
|
27459
26919
|
constructor(runtime, failure) {
|
|
27460
26920
|
super(`${runtime} harness turn ended with a failed outcome` + (failure.errorCode === void 0 ? "" : ` (${failure.errorCode})`) + `: ${failure.error}`);
|
|
27461
26921
|
this.name = "HarnessTurnFailedError";
|
|
27462
26922
|
this.runtime = runtime;
|
|
27463
26923
|
if (failure.errorCode !== void 0) this.errorCode = failure.errorCode;
|
|
26924
|
+
if (failure.statusCode !== void 0) {
|
|
26925
|
+
this.statusCode = failure.statusCode;
|
|
26926
|
+
this.status = failure.statusCode;
|
|
26927
|
+
}
|
|
27464
26928
|
}
|
|
27465
26929
|
};
|
|
27466
26930
|
/**
|
|
@@ -27477,7 +26941,8 @@ function upstreamUnavailableSignal(error) {
|
|
|
27477
26941
|
if (error instanceof CheckUnavailableError) return "check-unavailable";
|
|
27478
26942
|
if (error instanceof HarnessTurnFailedError) return unavailableSignalOfFailure({
|
|
27479
26943
|
error: error.message,
|
|
27480
|
-
...error.errorCode === void 0 ? {} : { errorCode: error.errorCode }
|
|
26944
|
+
...error.errorCode === void 0 ? {} : { errorCode: error.errorCode },
|
|
26945
|
+
...error.statusCode === void 0 ? {} : { statusCode: error.statusCode }
|
|
27481
26946
|
});
|
|
27482
26947
|
if (error instanceof BackendTransportError) {
|
|
27483
26948
|
const code = error.upstreamCode?.toLowerCase();
|
|
@@ -27509,7 +26974,8 @@ function classifyDriverFailure(error, signal) {
|
|
|
27509
26974
|
if (error instanceof Error && errorProperty(error, "name") === "AbortError") return "terminal";
|
|
27510
26975
|
if (error instanceof HarnessTurnFailedError) {
|
|
27511
26976
|
if (error.errorCode !== void 0 && DETERMINISTIC_BRIDGE_CODES.has(error.errorCode)) return "terminal";
|
|
27512
|
-
|
|
26977
|
+
if (isUpstreamUnavailable(error)) return "unavailable";
|
|
26978
|
+
return foreignHttpStatusVerdict(error) ?? "transient";
|
|
27513
26979
|
}
|
|
27514
26980
|
if (error instanceof BackendTransportError) {
|
|
27515
26981
|
if (error.upstreamCode !== void 0 && DETERMINISTIC_BRIDGE_CODES.has(error.upstreamCode)) return "terminal";
|
|
@@ -28921,6 +28387,6 @@ function isNonEmptySpend(s) {
|
|
|
28921
28387
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false || Object.values(s.resources ?? {}).some((resource) => resource.amount > 0 || !resource.known);
|
|
28922
28388
|
}
|
|
28923
28389
|
//#endregion
|
|
28924
|
-
export { waitUntil as $,
|
|
28390
|
+
export { waitUntil as $, projectSandboxOutcome as $i, captureWorkerTraceEvidence as $n, runWorktreeHarness as $r, claimsAuthority as $t, driverExecutorFactory as A, withBudgetResources as Aa, writeAllBytes as Ai, providerAsExecutor as An, mergeTraceEnv as Ar, cliInPlaceExecutor as At, recordScopeOwnerDriverAttempt as B, providerMessageText as Ba, recordRuntimeOwnedDriveHarnessProviderEvidence as Bi, FileResultBlobStore as Bn, createOtelExporter as Br, WORKER_TRACE_PROPAGATION as Bt, createContinuationKeeper as C, throwAbort as Ca, sandboxActProfileMaterialization as Ci, captureBeforeDestroy as Cn, runAbortable as Cr, recoverRetainedInteractiveRun as Ct, passedItems as D, zeroSpend as Da, isNoEntError as Di, runBrainLoop as Dn, readHarnessTranscript as Dr, rollingDispatch as Dt, failedItems as E, withTimeout as Ea, worktreeCliProfileMaterialization as Ei, routerBrain as En, persistHarnessTranscript as Er, queueOf as Et, beginScopeOwnerAttempt as F, armDeadlineTimer as Fa, inheritRuntimeOwnedExecutorAttestation as Fi, createPushTraceSource as Fn, resolveRedactor as Fr, createWorktreeCliExecutor as Ft, settledToIteration as G, runtimeOwnedPendingExecutorMaterialization as Gi, assertContentAddress as Gn, padTraceId as Gr, taskToPrompt as Gt, recordScopeOwnerPause as H, runtimeOwnedExecutorExecutionBinding as Hi, InMemoryResultBlobStore as Hn, generateSpanId as Hr, workerTraceEnv as Ht, createScope as I, teardownExecutor as Ia, knownExecutionBindingReceipt as Ii, decodeToolPart as In, buildLoopOtelSpans as Ir, DEFAULT_SANDBOX_STEERING_MAX_TURNS as It, createWaitProbes as J, unknownMaterializationReceipt as Ji, loadSpawnForest as Jn, createRuntimeStreamEventCollector as Jr, readWorkerProgress as Jt, createWorkerSlots as K, runtimeOwnedScopeOwnerRuntime as Ki, encodeResultBlob as Kn, toOtelAttributes as Kr, DEFAULT_STALL_AFTER_MS as Kt, deriveNodeExecutionIdentity as L, teardownSurfaces as La, knownMaterializationReceipt as Li, sandboxSessionTraceSource as Ln, buildLoopSpanNodes as Lr, createSteerableSandboxSession as Lt, withDriverExecutor as M, abortError$2 as Ma, attestRuntimeOwnedScopeOwner as Mi, resolveAgentEnvironmentProvider as Mn, traceContextToEnv as Mr, createExecutor as Mt, SUBTREE_RESULT_LIMIT as N, awaitAbortable$1 as Na, authoredProfileDigest as Ni, unavailablePauseMs as Nn, defaultRedactor as Nr, createExecutorRegistry as Nt, verdictFromJudgeScore as O, addResourceSpend as Oa, prepareJsonlAppend as Oi, LEAF_CONTINUATION_TASK as On, contentAddress as Or, bindReusableExecutorExecutionId as Ot, assertRecursiveReservationPolicy as P, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Pa, finalizeRuntimeOwnedPendingExecutor as Pi, unavailableSignalOfFailure as Pn, defaultRedactorIdentityMaterial as Pr, snapshotExecutorConfig as Pt, validateWaitSpec as Q, detachedSnapshot as Qi, WORKER_TOOL_TRACE_SCHEMA_VERSION as Qn, runSettledCommand as Qr, PEER_MAIL_WIRE_KEY as Qt, meterRuntimeOwnedAccounting as R, promptFromAgentTurnInput as Ra, newExecutionAttemptId as Ri, registerRetainedExecutorPreparation as Rn, buildRuntimeEventOtelSpans as Rr, createRouterTranscript as Rt, composeContinuationNote as S, stringifySafe as Sa, renderUnsupported as Si, SandboxEvidenceRetentionError as Sn, linkAbort as Sr, reconnectRetainedInteractiveRun as St, expandQuestions as T, unmeteredSpend as Ta, validateProfileMaterialization as Ti, readPromptOptions as Tn, harnessTranscriptArtifact as Tr, freeSlots as Tt, restoreScopeOwnerAcceptedExecution as U, runtimeOwnedExecutorMaterialization as Ui, InMemorySpawnJournal as Un, loopEventToOtelSpan as Ur, workerTraceHeaders as Ut, recordScopeOwnerMaterialization as V, runtimeOwnedDriveHarnessProviderEvidence as Vi, FileSpawnJournal as Vn, flatOtelSpan as Vr, readWorkerTraceContext as Vt, scopeOwnerExecutorNodeContext as W, runtimeOwnedExecutorProviderEvidence as Wi, SpawnEventIndex as Wn, padSpanId as Wr, workerTraceSeamKey as Wt, pollFor as X, executableAgentSpecSnapshot as Xi, pendingWaits as Xn, sanitizeKnowledgeReadinessReport as Xr, AUTHORITY_MARKERS as Xt, isWaitOutcome as Y, executableAgentProfileSnapshot as Yi, materializeTreeView as Yn, sanitizeAgentRuntimeEvent as Yr, createInbox as Yt, timerAt as Z, detachedFrozen as Zi, replaySpawnTree as Zn, sanitizeRuntimeStreamEvent as Zr, DEFAULT_PEER_MAIL_LIMITS as Zt, CheckUnavailableError as _, hasCompleteCacheBreakdown as _a, promptControlProfileMaterialization as _i, isTerminalDecision as _n, retainedCreateMaterial as _r, workerInteractiveAdmissionFile as _t, collectDelivered as a, extractLlmCallEvent as aa, harnessInvocation as ai, isTerminalNodeStatus as an, ReservationWaitRefused as ar, reconcileScopeRetainedOwnerEnvironment as at, bestComposite as b, randomSuffix as ba, promptResourceProfileMaterialization as bi, probeSandboxCapabilities as bn, RunCancellationReason as br, workerInteractiveBindingFile as bt, runTree as c, mapSandboxToolEvent as ca, parseCodexTokenUsage as ci, addHarnessUsage as cn, meterUsageEvent as cr, scopeRetainedOwnerResourceReader as ct, classifyDriverFailure as d, sandboxProgressEvents as da, AGENT_PROFILE_MATERIALIZATION_AXES as di, readCodexRolloutSession as dn, spendFromUsageTotals as dr, SPAWN_RESOURCE_PATH_MAX_BYTES as dt, readSandboxOutcome as ea, captureWorktreeDiff as ei, createPeerMailbox as en, isTraceAnalysisStore as er, bindScopeRetainedOwnerEnvironmentId as et, runDriverWithRetry as f, sumSandboxUsage as fa, assertProfileMaterialization as fi, bridgeRuntimeAttachmentsKey as fn, errMessage as fr, environmentReader as ft, CONTINUATION_FACTS as g, deleteBoxSafe as ga, profileMaterializationAxes$1 as gi, defaultSelectWinner as gn, startRetainedRunInEnvironment as gr, readWorkerInteractiveAdmissions as gt, CONTINUATIONS_DIR as h, cloneSpend as ha, fullProfileMaterialization as hi, createSandboxForSpec as hn, startRetainedRun as hr, interactiveAdmissionSeamKey as ht, bestDelivered as i, createSandboxUsageLedger as ia, LOCAL_HARNESSES as ii, isLiveNodeStatus as in, BudgetReconcileFault as ir, prepareScopeRetainedOwnerTask as it, isDriverSpec as j, decodeHarnessUsage as ja, attestRuntimeOwnedPendingExecutor as ji, providerAsSandboxClient as jn, readTraceContextFromEnv as jr, cliWorktreeExecutor as jt, driverChild as k, resourceTelemetry as ka, readCommittedJsonLines as ki, createAgentEnvironmentProviderRegistry as kn, createPropagatingTraceEmitter as kr, captureReusableExecutorConfig as kt, DriverAttemptsExhaustedError as l, notifySandboxEventObserver as la, CodexExecutionDiagnosticError as li, createCodexRolloutStoreReader as ln, newUsageTotals as lr, scopeRetainedOwnerRestorePoint as lt, upstreamUnavailableSignal as m, chargedTokens as ma, defineProfileMaterializationContract as mi, TERMINAL_DECISIONS as mn, recoverRetainedRun as mr, resolveSpawnResourcePaths as mt, createRootHandle as n, canonicalStreamEventFromSandboxEvent as na, removeWorktree as ni, peerMailTools as nn, workerTraceAnalysisStore as nr, consumeScopeRetainedOwnerResult as nt, pickBestDelivered as o, isSandboxTerminalEvent as oa, harnessSupportsReasoningEffort as oi, bridgeAdmissionRefusal as on, assertValidBudget as or, scopeRetainedOwnerContext as ot, summarizeDriverAttempts as p, addSpend as pa, controlProfileMaterialization as pi, bridgeStopSignalKey as pn, reconnectRetainedRun as pr, hostDirectoryReader as pt, openSlotGroup as q, unknownExecutionBindingReceipt as qi, insideCursorNamespace as qn, createRuntimeEventCollector as qr, createActivityLog as qt, createSupervisor as r, createSandboxToolPartState as ra, DEFAULT_LOCAL_HARNESS as ri, peerMailVerbNames as rn, executorFailure as rr, noteScopeRetainedOwnerCoordination as rt, runFinalizer as s, mapSandboxEvent as sa, localHarnessExecutable as si, bridgeModelRouteRefusal as sn, createBudgetPool as sr, scopeRetainedOwnerPriorSpend as st, DEFAULT_MAX_DEPTH as t, assertSandboxServedModel as ta, createWorktree as ti, isPeerMailEnvelope as tn, parseWorkerToolTraceArtifact as tr, bindScopeRetainedOwnerProvider as tt, HarnessTurnFailedError as u, sandboxEventServedBackend as ua, terminateProcessTreeAndConfirm as ui, harnessUsageIsEmpty as un, spendFromUsageEvents as ur, scopeRetainedOwnerResult as ut, admitContinuationPolicy as v, isAbortError$2 as va, promptModelProfileMaterialization as vi, runAgentRounds as vn, destroyInteractiveEnvironment as vr, attachWorker as vt, distillFindings as w, throwIfAborted as wa, unsupportedProfileDimensions as wi, assertBoxlessPromptOptions as wn, captureHarnessTranscript as wr, startRetainedInteractiveRun as wt, checkVerdictOf as x, sleep as xa, renderProfileMaterializationIssues as xi, acquireSandbox as xn, abortError as xr, workerInteractiveBindingsDir as xt, admitFinding as y, promptCacheTokenClasses as ya, promptOnlyProfileMaterialization as yi, createSandboxLineage as yn, environmentGone as yr, readWorkerInteractiveBinding as yt, meterRuntimeOwnedProviderAttempt as z, promptOptionsFromAgentTurnInput as za, providerAttemptEvidence as zi, retainedExecutorSeamKey as zn, createOpenInferenceFileExporter as zr, createInPlaceCliExecutor as zt };
|
|
28925
28391
|
|
|
28926
|
-
//# sourceMappingURL=supervisor-
|
|
28392
|
+
//# sourceMappingURL=supervisor-DpUCJtKC.js.map
|