@tangle-network/sandbox 1.0.150 → 1.0.151
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/agent/index.js +3 -3
- package/dist/auth/index.js +2 -2
- package/dist/cli-auth-bundle-D6NcQKP9.js +2 -0
- package/dist/{cli-auth-bundle-DF3PK8iC-B7hvDZ5g.js → cli-auth-bundle-DF3PK8iC-DrtpxJ_t.js} +6 -3
- package/dist/{client-uT-_wj7o.js → client-BpDtlFDQ.js} +6 -7
- package/dist/{core-2tJeMUpF.js → core-vjPhSRwO.js} +3 -3
- package/dist/core.js +3 -3
- package/dist/index.js +5 -5
- package/dist/{interactive-controller-vW55gCE7.js → interactive-controller-C1UItRXC.js} +77 -87
- package/dist/{local-cli-auth-BwuumC43.js → local-cli-auth-9-yeJf61.js} +1 -1
- package/dist/runtime.js +1 -1
- package/dist/{sandbox-B4FtKioc.js → sandbox-DSq5wR-6.js} +8 -6
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-Zsppk8f5.js → tangle-CZxvfOpr.js} +1 -1
- package/package.json +6 -6
- package/dist/cli-auth-bundle-BJzsjBal.js +0 -2
package/dist/agent/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-tBlLJqTb.js";
|
|
2
|
-
import { k as assertCurrentBackendType } from "../interactive-controller-
|
|
3
|
-
import { t as SandboxInstance } from "../sandbox-
|
|
2
|
+
import { k as assertCurrentBackendType } from "../interactive-controller-C1UItRXC.js";
|
|
3
|
+
import { t as SandboxInstance } from "../sandbox-DSq5wR-6.js";
|
|
4
4
|
import { C as StateError, E as ValidationError, g as NotFoundError } from "../errors-BfR-fBvN.js";
|
|
5
|
-
import { t as Sandbox } from "../client-
|
|
5
|
+
import { t as Sandbox } from "../client-BpDtlFDQ.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/agent/instances.ts
|
|
8
8
|
const managers = /* @__PURE__ */ new WeakMap();
|
package/dist/auth/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-DF3PK8iC-
|
|
2
|
-
import "../cli-auth-bundle-
|
|
1
|
+
import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-DF3PK8iC-DrtpxJ_t.js";
|
|
2
|
+
import "../cli-auth-bundle-D6NcQKP9.js";
|
|
3
3
|
//#region src/auth/tokens.ts
|
|
4
4
|
const textEncoder = new TextEncoder();
|
|
5
5
|
const textDecoder = new TextDecoder();
|
|
@@ -1053,9 +1053,12 @@ const BACKEND_TYPE = {
|
|
|
1053
1053
|
};
|
|
1054
1054
|
/** Stable declaration order; registry tests check the shipped spec composition. */
|
|
1055
1055
|
const ALL_BACKEND_TYPES = Object.values(BACKEND_TYPE);
|
|
1056
|
-
|
|
1056
|
+
z.enum(ALL_BACKEND_TYPES);
|
|
1057
1057
|
z.string().regex(/^[A-Za-z0-9_.:@-]{1,256}$/);
|
|
1058
|
-
new Set(ALL_BACKEND_TYPES);
|
|
1058
|
+
const BACKEND_TYPE_SET = new Set(ALL_BACKEND_TYPES);
|
|
1059
|
+
function isBackendType(value) {
|
|
1060
|
+
return BACKEND_TYPE_SET.has(value);
|
|
1061
|
+
}
|
|
1059
1062
|
//#endregion
|
|
1060
1063
|
//#region ../../../packages/cli-agent-registry/dist/specs-Dj7cGYWA.mjs
|
|
1061
1064
|
z.globalRegistry.add(agentProfileSchema, {
|
|
@@ -1645,4 +1648,4 @@ function assertCliAuthReferenceSupported(backendType, model) {
|
|
|
1645
1648
|
return reference;
|
|
1646
1649
|
}
|
|
1647
1650
|
//#endregion
|
|
1648
|
-
export {
|
|
1651
|
+
export { isBackendType as a, materializeCliAuthBundle as i, assertCliAuthReferenceSupported as n, cliAuthReferenceSchema as r, AUTH_BUNDLE_PATHS as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as encodePromptForWire, D as isBrowserRuntime, F as withoutCreateOnlyModelFields, O as applyRequestedModel, P as withProfileHarness, U as backendTypeSchema, j as normalizeRuntimeBackendConfig, k as assertCurrentBackendType, o as requestInteractiveSessionToken } from "./interactive-controller-
|
|
1
|
+
import { C as encodePromptForWire, D as isBrowserRuntime, F as withoutCreateOnlyModelFields, O as applyRequestedModel, P as withProfileHarness, U as backendTypeSchema, j as normalizeRuntimeBackendConfig, k as assertCurrentBackendType, o as requestInteractiveSessionToken } from "./interactive-controller-C1UItRXC.js";
|
|
2
2
|
import { r as agentProfileSchema } from "./profile-schema-Y5Xl8aOt.js";
|
|
3
|
-
import { A as normalizeStartupDiagnostics, B as generateIdempotencyKey, D as isRetryableProfileFileMaterializeFailure, E as validateDeferredProfileFileMounts, F as normalizeSandboxShape, H as
|
|
3
|
+
import { A as normalizeStartupDiagnostics, B as generateIdempotencyKey, D as isRetryableProfileFileMaterializeFailure, E as validateDeferredProfileFileMounts, F as normalizeSandboxShape, G as waitForCreateRetry, H as isDeployWindowCreateError, M as normalizeConnection, N as normalizeEgressPolicyFields, O as normalizeCaptureProof, P as normalizeProxySecretReceipt, R as DEPLOY_WINDOW_RETRY_MS, T as splitInlineProfileSkills, U as isRateLimitCreateError, V as isCapacityShortageCreateError, W as isRetryableCreateError, j as parseStopPhase, k as normalizeSandboxCreateReceipt, n as createSandboxInstanceFromResponse, o as exportTraceBundle, w as splitInlineProfileFileMounts, z as createRetryDelayMs } from "./sandbox-DSq5wR-6.js";
|
|
4
4
|
import { D as isInsideReservedDir, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, g as NotFoundError, h as NetworkError, i as readResponseJson, n as parseErrorResponse, r as parseResponseError, x as SandboxError } from "./errors-BfR-fBvN.js";
|
|
5
5
|
import { n as combineAbortSignals } from "./abort-signal-CDxyloxz.js";
|
|
6
6
|
import { t as fetchSandboxApi } from "./api-request-DNrodWdz.js";
|
|
@@ -1211,11 +1211,11 @@ function isLocalSandboxEndpoint(baseUrl) {
|
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
1213
|
async function resolveLocalCliAuthFiles(backendType) {
|
|
1214
|
-
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-
|
|
1214
|
+
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-9-yeJf61.js");
|
|
1215
1215
|
return discoverLocalCliAuthFiles(backendType);
|
|
1216
1216
|
}
|
|
1217
1217
|
async function loadLocalCliAuthExpectation(backendType) {
|
|
1218
|
-
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-
|
|
1218
|
+
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-9-yeJf61.js");
|
|
1219
1219
|
return describe(backendType);
|
|
1220
1220
|
}
|
|
1221
1221
|
/**
|
|
@@ -1886,15 +1886,14 @@ var SandboxCreation = class extends SandboxManagement {
|
|
|
1886
1886
|
let pacedByServer = false;
|
|
1887
1887
|
const isPacedCreateError = (cause) => isDeployWindowCreateError(cause) || pacedByServer && isRateLimitCreateError(cause);
|
|
1888
1888
|
const createTimeoutError = () => {
|
|
1889
|
-
|
|
1889
|
+
if (isCapacityShortageCreateError(lastServerError)) return lastServerError;
|
|
1890
1890
|
const elapsedMs = Date.now() - startedAt;
|
|
1891
1891
|
const metadata = { elapsedMs };
|
|
1892
1892
|
if (allPreviousCreateAttemptsRefused && lastServerError?.createFailureDisposition === "not-admitted") metadata.createFailureDisposition = "not-admitted";
|
|
1893
|
-
if (etaSeconds !== void 0) metadata.etaSeconds = etaSeconds;
|
|
1894
1893
|
const spentBudget = elapsedMs >= timeoutMs;
|
|
1895
1894
|
const preamble = spentBudget ? `Sandbox create did not complete within ${timeoutMs}ms. ` : `Sandbox create ended after ${elapsedMs}ms of its ${timeoutMs}ms budget. `;
|
|
1896
1895
|
const earlyExit = spentBudget || lastServerError?.retryAfterMs === void 0 ? "" : `The server asked for a ${Math.ceil(lastServerError.retryAfterMs / 1e3)}s wait, which the remaining budget cannot cover. `;
|
|
1897
|
-
return new TimeoutError(timeoutMs, preamble + (lastServerError ? `The last attempt failed with ${lastServerError.code}${lastServerError.status === void 0 ? "" : ` (HTTP ${lastServerError.status})`}: ${lastServerError.message}. ` : "") + earlyExit + `The provision may still be running server-side; retry create() with idempotencyKey="${idempotencyKey}" to join it
|
|
1896
|
+
return new TimeoutError(timeoutMs, preamble + (lastServerError ? `The last attempt failed with ${lastServerError.code}${lastServerError.status === void 0 ? "" : ` (HTTP ${lastServerError.status})`}: ${lastServerError.message}. ` : "") + earlyExit + `The provision may still be running server-side; retry create() with idempotencyKey="${idempotencyKey}" to join it.`, metadata, lastServerError);
|
|
1898
1897
|
};
|
|
1899
1898
|
const sleepBeforeRetry = async (delayMs) => {
|
|
1900
1899
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as agentProfileSchema } from "./profile-schema-Y5Xl8aOt.js";
|
|
2
|
-
import {
|
|
2
|
+
import { K as canonicalAgentProfileDigest } from "./sandbox-DSq5wR-6.js";
|
|
3
3
|
import { E as ValidationError, s as CapabilityError, x as SandboxError } from "./errors-BfR-fBvN.js";
|
|
4
4
|
import { t as awaitWithAbort } from "./abort-signal-CDxyloxz.js";
|
|
5
|
-
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-DF3PK8iC-
|
|
6
|
-
import "./cli-auth-bundle-
|
|
5
|
+
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-DF3PK8iC-DrtpxJ_t.js";
|
|
6
|
+
import "./cli-auth-bundle-D6NcQKP9.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region src/failure-kind.ts
|
|
9
9
|
const LOST_CODES = new Set(["BACKING_CONTAINER_MISSING", "SANDBOX_NOT_FOUND"]);
|
package/dist/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-
|
|
1
|
+
import { b as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-DSq5wR-6.js";
|
|
2
2
|
import { C as StateError, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, d as FileWriteConflictError, g as NotFoundError, h as NetworkError, n as parseErrorResponse, s as CapabilityError, v as ProfileFileMountPathError, x as SandboxError, y as QuotaError } from "./errors-BfR-fBvN.js";
|
|
3
|
-
import { a as InstancesClient, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, p as isBackendRegistryInteractionKind, r as HostedInstance, t as Sandbox, u as backendRegistryEntrySchema } from "./client-
|
|
3
|
+
import { a as InstancesClient, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, p as isBackendRegistryInteractionKind, r as HostedInstance, t as Sandbox, u as backendRegistryEntrySchema } from "./client-BpDtlFDQ.js";
|
|
4
4
|
import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-DlLR4pHq.js";
|
|
5
5
|
import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
|
|
6
|
-
import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-
|
|
6
|
+
import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-vjPhSRwO.js";
|
|
7
7
|
export { AuthError, CapabilityError, FileWriteConflictError, HostedInstance, ISOLATED_CREATION_ATTESTATION_VERSION, InstanceRestartingError, InstancesClient, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, LinesClient, ManagedProcessClient, NetworkError, NotFoundError, PartialFailureError, ProfileFileMountPathError, PublicTemplatePublishError, PublicTemplatesClient, QuotaError, Sandbox, SandboxError, SandboxInstance, SeatSelectionError, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, createSelectSeat, gatewaySeatTransport, isBackendRegistryInteractionKind, lineInstanceKey, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseErrorResponse, parseLineApplicationRequest, parseLineApplicationResult, profileChannelReference, sandboxFailureKind };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { B as projectAgentTerminalRecord, H as ALL_BACKEND_TYPES, K as parseBackendType, L as createAgentRunOutcomeTracker, M as requestedPublicProfileDigest, R as deriveAgentResultOutcome, U as backendTypeSchema, V as TERMINAL_WS_ECHO_SUBPROTOCOL, W as isolationPrincipalSchema, i as terminalUpgradeHeadersSupported, j as normalizeRuntimeBackendConfig, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as deriveAgentRunOutcome } from "./interactive-controller-
|
|
1
|
+
import { B as projectAgentTerminalRecord, H as ALL_BACKEND_TYPES, K as parseBackendType, L as createAgentRunOutcomeTracker, M as requestedPublicProfileDigest, R as deriveAgentResultOutcome, U as backendTypeSchema, V as TERMINAL_WS_ECHO_SUBPROTOCOL, W as isolationPrincipalSchema, i as terminalUpgradeHeadersSupported, j as normalizeRuntimeBackendConfig, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as deriveAgentRunOutcome } from "./interactive-controller-C1UItRXC.js";
|
|
2
2
|
import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, k as agentInteractiveSessionPromptRequestDigest, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-CRCRI6x5.js";
|
|
3
3
|
import { i as SANDBOX_SIZE_PRESET_NAMES, r as agentProfileSchema, t as agentProfileConfidentialSchema } from "./profile-schema-Y5Xl8aOt.js";
|
|
4
|
-
import { C as materializeProfileFileMounts, E as validateDeferredProfileFileMounts, S as SandboxOperationFailedError, T as splitInlineProfileSkills, _ as collectAgentResponseText, a as buildTraceExportPayload, b as ManagedProcessClient, c as toOtelJson, d as InteractiveSessionHandle, f as InteractiveTerminalFrameLog, g as collectAgentFinalMessageText, h as applySandboxEventText, i as MAX_EGRESS_DENIALS_LIMIT, l as SandboxTaskSession, m as createInteractiveTerminalSession, o as exportTraceBundle, p as createInteractiveTerminalCapture, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as getSandboxEventText, w as splitInlineProfileFileMounts, x as SandboxOperation, y as isToolBearingEvent } from "./sandbox-
|
|
4
|
+
import { C as materializeProfileFileMounts, E as validateDeferredProfileFileMounts, S as SandboxOperationFailedError, T as splitInlineProfileSkills, _ as collectAgentResponseText, a as buildTraceExportPayload, b as ManagedProcessClient, c as toOtelJson, d as InteractiveSessionHandle, f as InteractiveTerminalFrameLog, g as collectAgentFinalMessageText, h as applySandboxEventText, i as MAX_EGRESS_DENIALS_LIMIT, l as SandboxTaskSession, m as createInteractiveTerminalSession, o as exportTraceBundle, p as createInteractiveTerminalCapture, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as getSandboxEventText, w as splitInlineProfileFileMounts, x as SandboxOperation, y as isToolBearingEvent } from "./sandbox-DSq5wR-6.js";
|
|
5
5
|
import { C as StateError, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, b as ResumeEnvRequiredError, c as CompliancePlacementError, d as FileWriteConflictError, f as GpuProviderNotConfiguredError, g as NotFoundError, h as NetworkError, l as EdgeNotReadyError, n as parseErrorResponse, o as BranchFanoutExceedsHostError, p as KeyBudgetExhaustedError, s as CapabilityError, t as TerminalStreamError, u as EgressProxyRecoveryError, v as ProfileFileMountPathError, w as StreamInterruptedError, x as SandboxError, y as QuotaError } from "./errors-BfR-fBvN.js";
|
|
6
|
-
import { _ as createBatchResultAccumulator, a as InstancesClient, c as runtimeWorkspaceCwdSchema, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, g as IntelligenceClient, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, n as RunsClient, o as SandboxFleetClient, p as isBackendRegistryInteractionKind, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as backendRegistryEntrySchema, v as validateBatchRunRequest } from "./client-
|
|
6
|
+
import { _ as createBatchResultAccumulator, a as InstancesClient, c as runtimeWorkspaceCwdSchema, d as backendRegistryInteractionKindSchema, f as backendRegistryResponseSchema, g as IntelligenceClient, h as parseBackendRegistryResponseBody, i as InstanceRestartingError, l as backendRegistryCapabilitiesSchema, m as parseBackendRegistryResponse, n as RunsClient, o as SandboxFleetClient, p as isBackendRegistryInteractionKind, r as HostedInstance, s as SandboxFleet, t as Sandbox, u as backendRegistryEntrySchema, v as validateBatchRunRequest } from "./client-BpDtlFDQ.js";
|
|
7
7
|
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-CX_XvFZZ.js";
|
|
8
8
|
import { t as parseSSEStream } from "./sse-parser-DrI47LyG.js";
|
|
9
9
|
import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-DlLR4pHq.js";
|
|
10
10
|
import { t as downloadFile } from "./file-download-CICuFwGb.js";
|
|
11
11
|
import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
|
|
12
|
-
import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-
|
|
13
|
-
import { s as TangleSandboxClient } from "./tangle-
|
|
12
|
+
import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-vjPhSRwO.js";
|
|
13
|
+
import { s as TangleSandboxClient } from "./tangle-CZxvfOpr.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
//#region ../../../packages/runtime-contracts/dist/model-key-proxy.js
|
|
16
16
|
const MANAGED_MODEL_KEY_SENTINEL = "proxy-managed-per-request";
|
|
@@ -280,68 +280,56 @@ function parseApproval(value) {
|
|
|
280
280
|
}
|
|
281
281
|
return approval;
|
|
282
282
|
}
|
|
283
|
-
/** Inspect outcome markers without copying potentially large tool inputs and outputs
|
|
283
|
+
/** Inspect outcome markers without copying potentially large tool inputs and outputs;
|
|
284
|
+
* a malformed history names its first offending entry field. */
|
|
284
285
|
function inspectTerminalToolOutcomes(value) {
|
|
285
|
-
if (!Array.isArray(value)) return { malformed:
|
|
286
|
-
|
|
287
|
-
for (const entry of value) {
|
|
286
|
+
if (!Array.isArray(value)) return { malformed: "toolInvocations" };
|
|
287
|
+
let approval;
|
|
288
|
+
for (const [index, entry] of value.entries()) {
|
|
288
289
|
const tool = plainRecord(entry);
|
|
289
|
-
|
|
290
|
-
if (
|
|
291
|
-
if (tool
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
290
|
+
if (!readString(tool?.toolName)) return { malformed: `toolInvocations[${index}].toolName` };
|
|
291
|
+
if (tool?.isError !== void 0 && typeof tool.isError !== "boolean") return { malformed: `toolInvocations[${index}].isError` };
|
|
292
|
+
if (tool?.isError !== true) continue;
|
|
293
|
+
const inspection = inspectToolResult(tool.result);
|
|
294
|
+
if (!inspection.approvalCode) continue;
|
|
295
|
+
if (approval) return { malformed: `toolInvocations[${index}].result` };
|
|
296
|
+
approval = { message: inspection.message ?? "Hub action requires approval" };
|
|
297
|
+
if (inspection.approvalId) approval.approvalId = inspection.approvalId;
|
|
298
|
+
if (inspection.connectionId) approval.connectionId = inspection.connectionId;
|
|
297
299
|
}
|
|
298
|
-
return
|
|
300
|
+
return approval ? { approval } : {};
|
|
299
301
|
}
|
|
302
|
+
/** Copy a tool history for public output, or name its first entry field that is not one. */
|
|
300
303
|
function parseToolInvocations(value) {
|
|
301
|
-
if (!Array.isArray(value)) return
|
|
304
|
+
if (!Array.isArray(value)) return "toolInvocations";
|
|
302
305
|
const result = [];
|
|
303
|
-
for (const entry of value) {
|
|
306
|
+
for (const [index, entry] of value.entries()) {
|
|
304
307
|
const tool = plainRecord(entry);
|
|
305
308
|
const toolName = readString(tool?.toolName);
|
|
306
|
-
if (!tool || !toolName
|
|
309
|
+
if (!tool || !toolName) return `toolInvocations[${index}].toolName`;
|
|
310
|
+
if (tool.isError !== void 0 && typeof tool.isError !== "boolean") return `toolInvocations[${index}].isError`;
|
|
307
311
|
const invocation = { toolName };
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (tool.result !== void 0) {
|
|
315
|
-
const copied = copyJsonValue(tool.result);
|
|
316
|
-
if (!copied.success) return void 0;
|
|
317
|
-
invocation.result = copied.value;
|
|
312
|
+
const inputKey = (tool.input ?? null) === null ? "arguments" : "input";
|
|
313
|
+
for (const key of [inputKey, "result"]) {
|
|
314
|
+
if (tool[key] === void 0) continue;
|
|
315
|
+
const copied = copyJsonValue(tool[key]);
|
|
316
|
+
if (!copied.success) return `toolInvocations[${index}].${key}`;
|
|
317
|
+
invocation[key === "result" ? "result" : "input"] = copied.value;
|
|
318
318
|
}
|
|
319
319
|
if (typeof tool.isError === "boolean") invocation.isError = tool.isError;
|
|
320
320
|
result.push(invocation);
|
|
321
321
|
}
|
|
322
322
|
return result;
|
|
323
323
|
}
|
|
324
|
-
function inspectToolOutcomes(toolInvocations) {
|
|
325
|
-
let approval;
|
|
326
|
-
for (const tool of toolInvocations ?? []) {
|
|
327
|
-
if (tool.isError !== true) continue;
|
|
328
|
-
const inspection = inspectToolResult(tool.result);
|
|
329
|
-
if (!inspection.approvalCode) continue;
|
|
330
|
-
if (approval) return { malformed: true };
|
|
331
|
-
approval = { message: inspection.message ?? "Hub action requires approval" };
|
|
332
|
-
if (inspection.approvalId) approval.approvalId = inspection.approvalId;
|
|
333
|
-
if (inspection.connectionId) approval.connectionId = inspection.connectionId;
|
|
334
|
-
}
|
|
335
|
-
const result = { malformed: false };
|
|
336
|
-
if (approval) result.approval = approval;
|
|
337
|
-
return result;
|
|
338
|
-
}
|
|
339
324
|
function inspectToolResult(value) {
|
|
340
325
|
let root = value;
|
|
341
|
-
if (typeof value === "string")
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
326
|
+
if (typeof value === "string") {
|
|
327
|
+
if (new TextEncoder().encode(value).byteLength > MAX_SERIALIZED_TOOL_VALUE_BYTES) return { approvalCode: false };
|
|
328
|
+
try {
|
|
329
|
+
root = JSON.parse(value);
|
|
330
|
+
} catch {
|
|
331
|
+
return { approvalCode: false };
|
|
332
|
+
}
|
|
345
333
|
}
|
|
346
334
|
const record = plainRecord(root);
|
|
347
335
|
if (!record) return { approvalCode: false };
|
|
@@ -358,12 +346,17 @@ function inspectToolResult(value) {
|
|
|
358
346
|
if (connectionId) result.connectionId = connectionId;
|
|
359
347
|
return result;
|
|
360
348
|
}
|
|
361
|
-
/** Copy a provider value into a bounded JSON-only value safe for public output.
|
|
349
|
+
/** Copy a provider value into a bounded JSON-only value safe for public output. A value over
|
|
350
|
+
* the bound is history, not the outcome: it becomes a note of its size and the turn still settles. */
|
|
362
351
|
function copyJsonValue(value) {
|
|
363
352
|
try {
|
|
364
353
|
const serialized = JSON.stringify(value);
|
|
365
|
-
if (serialized === void 0
|
|
366
|
-
|
|
354
|
+
if (serialized === void 0) return { success: false };
|
|
355
|
+
const bytes = new TextEncoder().encode(serialized).byteLength;
|
|
356
|
+
return bytes > MAX_SERIALIZED_TOOL_VALUE_BYTES ? {
|
|
357
|
+
success: true,
|
|
358
|
+
value: `[omitted: ${bytes} bytes exceed the ${MAX_SERIALIZED_TOOL_VALUE_BYTES}-byte tool value bound]`
|
|
359
|
+
} : {
|
|
367
360
|
success: true,
|
|
368
361
|
value: JSON.parse(serialized)
|
|
369
362
|
};
|
|
@@ -457,7 +450,7 @@ function projectAgentTerminalRecord(record) {
|
|
|
457
450
|
const nested = plainRecord(record.result);
|
|
458
451
|
const { toolInvocations: nestedTools, approval: nestedApproval, ...nestedTerminal } = nested ?? {};
|
|
459
452
|
const summary = inspectTerminalApproval(record);
|
|
460
|
-
if (summary.malformed) throw new Error(
|
|
453
|
+
if (summary.malformed) throw new Error(`Agent terminal approval summary is malformed or conflicting: ${summary.malformed}`);
|
|
461
454
|
return {
|
|
462
455
|
...terminal,
|
|
463
456
|
...nested === void 0 ? {} : { result: nestedTerminal },
|
|
@@ -467,7 +460,8 @@ function projectAgentTerminalRecord(record) {
|
|
|
467
460
|
function inspectTerminalApproval(record, prior) {
|
|
468
461
|
const nested = plainRecord(record.result);
|
|
469
462
|
const inspections = [record.toolInvocations, nested?.toolInvocations].filter((value) => value !== void 0).map(inspectTerminalToolOutcomes);
|
|
470
|
-
|
|
463
|
+
const malformed = inspections.find((inspection) => inspection.malformed);
|
|
464
|
+
if (malformed) return malformed;
|
|
471
465
|
return mergeApprovalCandidates([
|
|
472
466
|
prior,
|
|
473
467
|
record.approval,
|
|
@@ -480,16 +474,13 @@ function mergeApprovalCandidates(candidates) {
|
|
|
480
474
|
for (const candidate of candidates) {
|
|
481
475
|
if (candidate === void 0) continue;
|
|
482
476
|
const next = parseApproval(candidate);
|
|
483
|
-
if (!next || approval && !sameApproval(approval, next)) return { malformed:
|
|
477
|
+
if (!next || approval && !sameApproval(approval, next)) return { malformed: "approval" };
|
|
484
478
|
approval = {
|
|
485
479
|
...approval,
|
|
486
480
|
...next
|
|
487
481
|
};
|
|
488
482
|
}
|
|
489
|
-
return {
|
|
490
|
-
approval,
|
|
491
|
-
malformed: false
|
|
492
|
-
};
|
|
483
|
+
return { approval };
|
|
493
484
|
}
|
|
494
485
|
function sameApproval(left, right) {
|
|
495
486
|
return [
|
|
@@ -502,20 +493,19 @@ function createOutcomeState() {
|
|
|
502
493
|
return {
|
|
503
494
|
terminalReached: false,
|
|
504
495
|
terminalStatuses: /* @__PURE__ */ new Set(),
|
|
505
|
-
malformed: false,
|
|
506
496
|
interactions: /* @__PURE__ */ new Map()
|
|
507
497
|
};
|
|
508
498
|
}
|
|
509
499
|
function observeEvent(state, event) {
|
|
510
500
|
try {
|
|
511
501
|
if (!event || typeof event !== "object") {
|
|
512
|
-
state.malformed
|
|
502
|
+
state.malformed ??= "event";
|
|
513
503
|
return;
|
|
514
504
|
}
|
|
515
505
|
const type = typeof event.type === "string" ? event.type : "";
|
|
516
506
|
const data = plainRecord(event.data);
|
|
517
507
|
if (!type || !data) {
|
|
518
|
-
state.malformed
|
|
508
|
+
state.malformed ??= type ? `${type}.data` : "event.type";
|
|
519
509
|
return;
|
|
520
510
|
}
|
|
521
511
|
if (type === "error") {
|
|
@@ -530,13 +520,13 @@ function observeEvent(state, event) {
|
|
|
530
520
|
if (type === "result") observeOutcomeFrame(state, type, data, false);
|
|
531
521
|
if (type === "done") observeOutcomeFrame(state, type, data, true);
|
|
532
522
|
} catch {
|
|
533
|
-
state.malformed
|
|
523
|
+
state.malformed ??= "event";
|
|
534
524
|
}
|
|
535
525
|
}
|
|
536
526
|
function observeInteraction(state, data) {
|
|
537
527
|
const request = parseInteraction(data.request);
|
|
538
528
|
if (!request) {
|
|
539
|
-
state.malformed
|
|
529
|
+
state.malformed ??= "interaction.request";
|
|
540
530
|
return;
|
|
541
531
|
}
|
|
542
532
|
retainInteraction(state, request);
|
|
@@ -544,7 +534,7 @@ function observeInteraction(state, data) {
|
|
|
544
534
|
function observeInteractionCancel(state, data) {
|
|
545
535
|
const id = readString(data.id);
|
|
546
536
|
if (!id) {
|
|
547
|
-
state.malformed
|
|
537
|
+
state.malformed ??= "interaction.cancel.id";
|
|
548
538
|
return;
|
|
549
539
|
}
|
|
550
540
|
state.interactions.delete(id);
|
|
@@ -552,33 +542,33 @@ function observeInteractionCancel(state, data) {
|
|
|
552
542
|
function observePlan(state, data) {
|
|
553
543
|
const plan = parsePlan(data.plan);
|
|
554
544
|
if (!plan) {
|
|
555
|
-
state.malformed
|
|
545
|
+
state.malformed ??= "plan.submitted.plan";
|
|
556
546
|
return;
|
|
557
547
|
}
|
|
558
548
|
retainPlan(state, plan);
|
|
559
549
|
}
|
|
560
550
|
function observeOutcomeFrame(state, type, data, terminal) {
|
|
561
551
|
if (terminal) state.terminalReached = true;
|
|
562
|
-
if (data.success !== void 0 && typeof data.success !== "boolean") state.malformed
|
|
552
|
+
if (data.success !== void 0 && typeof data.success !== "boolean") state.malformed ??= `${type}.success`;
|
|
563
553
|
if (typeof data.success === "boolean") {
|
|
564
|
-
if (state.terminalSuccess !== void 0 && state.terminalSuccess !== data.success) state.malformed
|
|
554
|
+
if (state.terminalSuccess !== void 0 && state.terminalSuccess !== data.success) state.malformed ??= `${type}.success contradicts an earlier frame`;
|
|
565
555
|
state.terminalSuccess = data.success;
|
|
566
556
|
}
|
|
567
557
|
if (type === "done" || data.outcome !== void 0) {
|
|
568
|
-
if (!AgentExecutionOutcomeSchema.safeParse(data.outcome).success) state.malformed
|
|
558
|
+
if (!AgentExecutionOutcomeSchema.safeParse(data.outcome).success) state.malformed ??= `${type}.outcome`;
|
|
569
559
|
}
|
|
570
560
|
const outcome = plainRecord(data.outcome);
|
|
571
561
|
const nestedResult = plainRecord(data.result);
|
|
572
|
-
for (const value of
|
|
573
|
-
data.status,
|
|
574
|
-
outcome?.type,
|
|
575
|
-
outcome?.status,
|
|
576
|
-
nestedResult?.status
|
|
577
|
-
|
|
562
|
+
for (const [field, value] of Object.entries({
|
|
563
|
+
status: data.status,
|
|
564
|
+
"outcome.type": outcome?.type,
|
|
565
|
+
"outcome.status": outcome?.status,
|
|
566
|
+
"result.status": nestedResult?.status
|
|
567
|
+
})) {
|
|
578
568
|
if (value === void 0) continue;
|
|
579
569
|
const status = normalizeStatus(value);
|
|
580
570
|
if (status) state.terminalStatuses.add(status);
|
|
581
|
-
else state.malformed
|
|
571
|
+
else state.malformed ??= `${type}.${field}`;
|
|
582
572
|
}
|
|
583
573
|
state.terminalError ??= readError(data) ?? readError(outcome) ?? readError(nestedResult);
|
|
584
574
|
state.terminalErrorCode ??= readString(data.errorCode) ?? readString(data.code) ?? readString(outcome?.errorCode) ?? readString(outcome?.code) ?? readString(nestedResult?.errorCode) ?? readString(nestedResult?.code);
|
|
@@ -587,22 +577,22 @@ function observeOutcomeFrame(state, type, data, terminal) {
|
|
|
587
577
|
if (interactionCandidate !== void 0) {
|
|
588
578
|
const interaction = parseInteraction(interactionCandidate);
|
|
589
579
|
if (interaction) retainInteraction(state, interaction);
|
|
590
|
-
else state.malformed
|
|
580
|
+
else state.malformed ??= `${type}.interaction`;
|
|
591
581
|
}
|
|
592
582
|
const planCandidate = data.plan ?? (outcome?.type === "awaiting_plan_decision" ? outcome.plan : void 0) ?? (nestedResult?.status === "awaiting_plan_decision" ? nestedResult.plan : void 0);
|
|
593
583
|
if (planCandidate !== void 0) {
|
|
594
584
|
const plan = parsePlan(planCandidate);
|
|
595
585
|
if (plan) retainPlan(state, plan);
|
|
596
|
-
else state.malformed
|
|
586
|
+
else state.malformed ??= `${type}.plan`;
|
|
597
587
|
}
|
|
598
588
|
const invocationCandidate = data.toolInvocations ?? nestedResult?.toolInvocations;
|
|
599
589
|
if (invocationCandidate !== void 0) {
|
|
600
590
|
const invocations = parseToolInvocations(invocationCandidate);
|
|
601
|
-
if (invocations) retainToolInvocations(state, invocations);
|
|
602
|
-
else state.malformed
|
|
591
|
+
if (typeof invocations !== "string") retainToolInvocations(state, invocations);
|
|
592
|
+
else state.malformed ??= `${type}.${invocations}`;
|
|
603
593
|
}
|
|
604
594
|
const summary = inspectTerminalApproval(data, state.approval);
|
|
605
|
-
if (summary.malformed) state.malformed
|
|
595
|
+
if (summary.malformed) state.malformed ??= `${type}.${summary.malformed}`;
|
|
606
596
|
else state.approval = summary.approval;
|
|
607
597
|
}
|
|
608
598
|
function settleOutcome(state) {
|
|
@@ -611,7 +601,9 @@ function settleOutcome(state) {
|
|
|
611
601
|
const statusGroups = classifyStatuses(state.terminalStatuses);
|
|
612
602
|
if (statusGroups.failure) return failed(state.terminalError ?? `Agent execution ended with status ${statusGroups.failure}`, state.terminalErrorCode, common, state.terminalErrorStatusCode);
|
|
613
603
|
if (!state.terminalReached) return failed("Agent stream ended without a terminal event", void 0, common);
|
|
614
|
-
|
|
604
|
+
const malformed = state.malformed ?? statusGroups.malformed;
|
|
605
|
+
const problem = malformed && `Agent terminal outcome is malformed: ${malformed}`;
|
|
606
|
+
if (problem) return failed(problem, void 0, common);
|
|
615
607
|
const wait = selectWait(state);
|
|
616
608
|
if (wait.error) return failed(wait.error, void 0, common);
|
|
617
609
|
if (statusGroups.wait && statusGroups.wait !== wait.kind) return failed("Agent terminal wait does not match its response request", void 0, common);
|
|
@@ -628,7 +620,7 @@ function classifyStatuses(statuses) {
|
|
|
628
620
|
let failure;
|
|
629
621
|
let wait;
|
|
630
622
|
let success = false;
|
|
631
|
-
let
|
|
623
|
+
let malformed;
|
|
632
624
|
let conflicting = false;
|
|
633
625
|
for (const status of statuses) if (FAILURE_STATUSES.has(status)) failure ??= status;
|
|
634
626
|
else if (SUCCESS_STATUSES.has(status)) success = true;
|
|
@@ -637,14 +629,12 @@ function classifyStatuses(statuses) {
|
|
|
637
629
|
if (!next) continue;
|
|
638
630
|
if (wait && wait !== next) conflicting = true;
|
|
639
631
|
wait = next;
|
|
640
|
-
} else unknown
|
|
641
|
-
if (failure && (wait || success)) conflicting
|
|
632
|
+
} else malformed ??= `unknown terminal status ${status}`;
|
|
633
|
+
if (conflicting || failure && (wait || success)) malformed ??= `conflicting terminal statuses ${[...statuses].join(", ")}`;
|
|
642
634
|
return {
|
|
643
635
|
failure,
|
|
644
636
|
wait,
|
|
645
|
-
|
|
646
|
-
unknown,
|
|
647
|
-
conflicting
|
|
637
|
+
malformed
|
|
648
638
|
};
|
|
649
639
|
}
|
|
650
640
|
function selectWait(state) {
|
|
@@ -708,7 +698,7 @@ function failed(error, errorCode, common, statusCode) {
|
|
|
708
698
|
}
|
|
709
699
|
function retainPlan(state, plan) {
|
|
710
700
|
if (state.plan && (state.plan.id !== plan.id || state.plan.revision !== plan.revision || state.plan.title !== plan.title || state.plan.body !== plan.body || state.plan.submittedAt !== plan.submittedAt)) {
|
|
711
|
-
state.malformed
|
|
701
|
+
state.malformed ??= `plan ${plan.id} changed between frames`;
|
|
712
702
|
return;
|
|
713
703
|
}
|
|
714
704
|
state.plan = plan;
|
|
@@ -716,7 +706,7 @@ function retainPlan(state, plan) {
|
|
|
716
706
|
function retainInteraction(state, interaction) {
|
|
717
707
|
const known = state.interactions.get(interaction.id);
|
|
718
708
|
if (known && known.requestDigest !== interaction.requestDigest) {
|
|
719
|
-
state.malformed
|
|
709
|
+
state.malformed ??= `interaction ${interaction.id} changed its request`;
|
|
720
710
|
return;
|
|
721
711
|
}
|
|
722
712
|
state.interactions.set(interaction.id, interaction);
|
|
@@ -726,7 +716,7 @@ function openInteraction(state) {
|
|
|
726
716
|
}
|
|
727
717
|
function retainToolInvocations(state, invocations) {
|
|
728
718
|
if (state.toolInvocations && JSON.stringify(state.toolInvocations) !== JSON.stringify(invocations)) {
|
|
729
|
-
state.malformed
|
|
719
|
+
state.malformed ??= "toolInvocations changed between frames";
|
|
730
720
|
return;
|
|
731
721
|
}
|
|
732
722
|
state.toolInvocations = invocations;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-DF3PK8iC-
|
|
1
|
+
import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-DF3PK8iC-DrtpxJ_t.js";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, join } from "node:path";
|
|
4
4
|
import { homedir } from "node:os";
|
package/dist/runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as projectAgentTerminalRecord, L as createAgentRunOutcomeTracker, R as deriveAgentResultOutcome, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as deriveAgentRunOutcome } from "./interactive-controller-
|
|
1
|
+
import { B as projectAgentTerminalRecord, L as createAgentRunOutcomeTracker, R as deriveAgentResultOutcome, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as deriveAgentRunOutcome } from "./interactive-controller-C1UItRXC.js";
|
|
2
2
|
import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-CRCRI6x5.js";
|
|
3
3
|
import { C as StateError, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, d as FileWriteConflictError, g as NotFoundError, h as NetworkError, s as CapabilityError, v as ProfileFileMountPathError, x as SandboxError, y as QuotaError } from "./errors-BfR-fBvN.js";
|
|
4
4
|
import { t as fetchSandboxApi } from "./api-request-DNrodWdz.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as mergeRuntimeBackendConfig, C as encodePromptForWire, E as canUseNodeHttp2, G as normalizeEffectiveBackend, I as withoutRuntimeSecrets, L as createAgentRunOutcomeTracker, M as requestedPublicProfileDigest, N as requestedSecretProfilePublicDigest, O as applyRequestedModel, R as deriveAgentResultOutcome, S as validateAcceptedDispatchRunRef, T as runtimeFilesystemPath, _ as TRACE_ID_HEADER, a as assertScopedTokenActive, b as resolveTraceId, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as waitForRetryAfter, h as isRetryableCredentialRefusal, i as terminalUpgradeHeadersSupported, j as normalizeRuntimeBackendConfig, k as assertCurrentBackendType, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as isTraceId, w as encodeTextForWire, x as resolveDispatchRunIdentity, y as mintTraceId } from "./interactive-controller-
|
|
1
|
+
import { A as mergeRuntimeBackendConfig, C as encodePromptForWire, E as canUseNodeHttp2, G as normalizeEffectiveBackend, I as withoutRuntimeSecrets, L as createAgentRunOutcomeTracker, M as requestedPublicProfileDigest, N as requestedSecretProfilePublicDigest, O as applyRequestedModel, R as deriveAgentResultOutcome, S as validateAcceptedDispatchRunRef, T as runtimeFilesystemPath, _ as TRACE_ID_HEADER, a as assertScopedTokenActive, b as resolveTraceId, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as waitForRetryAfter, h as isRetryableCredentialRefusal, i as terminalUpgradeHeadersSupported, j as normalizeRuntimeBackendConfig, k as assertCurrentBackendType, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as isTraceId, w as encodeTextForWire, x as resolveDispatchRunIdentity, y as mintTraceId } from "./interactive-controller-C1UItRXC.js";
|
|
2
2
|
import { C as boundedIdentifierSchema, E as boundedStringSchema, g as sha256DigestSchema, o as canonicalCandidateDigest, s as canonicalCandidateJson, u as isCanonicalJsonValue } from "./harness-BhAJqO2u.js";
|
|
3
3
|
import { A as agentInteractiveSessionStatusMatchesRef, B as PlanContinuationSchema, C as AgentInteractiveSessionStopAcknowledgementSchema, D as agentInteractiveSessionControlClaimMatchesRef, E as agentInteractiveSessionControlClaimIsNewer, F as AgentRunCancellationAcknowledgementSchema, G as InteractionResponseSchema, H as InteractionBindingSchema, I as AgentRunCancellationRequestSchema, L as agentRunCancellationAcknowledgementMatchesRequest, M as agentInteractiveDimensionSchema, N as sameAgentExactRun, O as agentInteractiveSessionPromptAcknowledgementMatchesCommand, P as AgentExactRunControlRefSchema, S as AgentInteractiveSessionStatusSchema, T as agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, U as InteractionRequestSchema, V as InteractionAcknowledgementSchema, W as InteractionResponseCommandSchema, _ as AgentInteractiveSessionControlClaimRequestSchema, b as AgentInteractiveSessionPromptCommandSchema, d as interactiveSessionControlClaimResponseSchema, f as interactiveSessionControlReleaseResponseSchema, g as AgentInteractiveSessionControlClaimAcknowledgementSchema, h as AgentInteractiveSessionAttachSchema, j as agentInteractiveSessionStopAcknowledgementMatchesCommand, l as createInteractiveControlHolderId, m as interactiveSessionStatusResponseSchema, p as interactiveSessionControlValidationResponseSchema, v as AgentInteractiveSessionControlClaimSchema, w as AgentInteractiveSessionStopCommandSchema, x as AgentInteractiveSessionRefSchema, y as AgentInteractiveSessionPromptAcknowledgementSchema } from "./browser-interactive-control-controller-CRCRI6x5.js";
|
|
4
4
|
import { a as ProxySecretReceiptSchema, o as canonicalAgentProfileValue, r as agentProfileSchema } from "./profile-schema-Y5Xl8aOt.js";
|
|
@@ -10,8 +10,8 @@ import { t as SIDECAR_PROXY_ERROR_HEADER } from "./sidecar-proxy-error-5DpLmHeN.
|
|
|
10
10
|
import { t as parseSSEStream } from "./sse-parser-DrI47LyG.js";
|
|
11
11
|
import { s as uploadChunked } from "./chunked-upload-CyP-FOeZ.js";
|
|
12
12
|
import { t as runPreparedProcess } from "./prepared-process-C-rwZPIZ.js";
|
|
13
|
-
import { a as
|
|
14
|
-
import "./cli-auth-bundle-
|
|
13
|
+
import { a as isBackendType, r as cliAuthReferenceSchema } from "./cli-auth-bundle-DF3PK8iC-DrtpxJ_t.js";
|
|
14
|
+
import "./cli-auth-bundle-D6NcQKP9.js";
|
|
15
15
|
import { n as SandboxLines } from "./lines-DlLR4pHq.js";
|
|
16
16
|
import { t as downloadFile } from "./file-download-CICuFwGb.js";
|
|
17
17
|
import { z } from "zod";
|
|
@@ -328,6 +328,8 @@ const DEPLOY_WINDOW_RETRY_MS = 15e4;
|
|
|
328
328
|
function isDeployWindowCreateError(cause) {
|
|
329
329
|
return cause instanceof SandboxError && cause.status === 503 && DEPLOY_WINDOW_RETRY_CODES.has(cause.code);
|
|
330
330
|
}
|
|
331
|
+
/** A no-room refusal allocated nothing, so a create giving up on one reports this typed 503. */
|
|
332
|
+
const isCapacityShortageCreateError = (cause) => isDeployWindowCreateError(cause) && (cause.code === "CAPACITY_EXHAUSTED" || cause.code === "HOST_PRESSURE");
|
|
331
333
|
/**
|
|
332
334
|
* The plan rate limiter's 429 (`RATE_LIMIT_EXCEEDED`, or the platform's own
|
|
333
335
|
* limiter): `quotaType` is the limiter's default `rate_limit`, never one of
|
|
@@ -6511,7 +6513,7 @@ function parseSandboxRuntimeCapabilities(raw) {
|
|
|
6511
6513
|
const nativeVersion = record.nativeSessionCaptureVersion;
|
|
6512
6514
|
const nativeHarnesses = record.nativeSessionCaptureHarnesses;
|
|
6513
6515
|
if (nativeVersion !== void 0 && (typeof nativeVersion !== "number" || !Number.isSafeInteger(nativeVersion) || nativeVersion < 1)) invalidCapabilities("a malformed 'nativeSessionCaptureVersion'");
|
|
6514
|
-
if (nativeHarnesses !== void 0 && (!Array.isArray(nativeHarnesses) || nativeHarnesses.some((harness) =>
|
|
6516
|
+
if (nativeHarnesses !== void 0 && (!Array.isArray(nativeHarnesses) || nativeHarnesses.some((harness) => typeof harness !== "string") || new Set(nativeHarnesses).size !== nativeHarnesses.length)) invalidCapabilities("malformed 'nativeSessionCaptureHarnesses'");
|
|
6515
6517
|
const interactionsValue = record.interactions;
|
|
6516
6518
|
if (interactionsValue === null || typeof interactionsValue !== "object" || Array.isArray(interactionsValue)) invalidCapabilities("a malformed 'interactions' group");
|
|
6517
6519
|
const interactionsRecord = interactionsValue;
|
|
@@ -6544,7 +6546,7 @@ function parseSandboxRuntimeCapabilities(raw) {
|
|
|
6544
6546
|
...typeof record.claudeTokenContinuations === "boolean" ? { claudeTokenContinuations: record.claudeTokenContinuations } : {},
|
|
6545
6547
|
...typeof record.codexCredentialContinuations === "boolean" ? { codexCredentialContinuations: record.codexCredentialContinuations } : {},
|
|
6546
6548
|
...typeof nativeVersion === "number" ? { nativeSessionCaptureVersion: nativeVersion } : {},
|
|
6547
|
-
...Array.isArray(nativeHarnesses) ? { nativeSessionCaptureHarnesses: nativeHarnesses.
|
|
6549
|
+
...Array.isArray(nativeHarnesses) ? { nativeSessionCaptureHarnesses: nativeHarnesses.filter(isBackendType) } : {},
|
|
6548
6550
|
agentInterface: record.agentInterface,
|
|
6549
6551
|
sidecarVersion: record.sidecarVersion,
|
|
6550
6552
|
image: record.image,
|
|
@@ -11688,4 +11690,4 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
|
|
|
11688
11690
|
}
|
|
11689
11691
|
};
|
|
11690
11692
|
//#endregion
|
|
11691
|
-
export { normalizeStartupDiagnostics as A, generateIdempotencyKey as B, materializeProfileFileMounts as C, isRetryableProfileFileMaterializeFailure as D, validateDeferredProfileFileMounts as E, normalizeSandboxShape as F,
|
|
11693
|
+
export { normalizeStartupDiagnostics as A, generateIdempotencyKey as B, materializeProfileFileMounts as C, isRetryableProfileFileMaterializeFailure as D, validateDeferredProfileFileMounts as E, normalizeSandboxShape as F, waitForCreateRetry as G, isDeployWindowCreateError as H, DEFAULT_CREATE_TIMEOUT_MS as I, canonicalAgentProfileDigest as K, DEFAULT_GPU_CREATE_TIMEOUT_MS as L, normalizeConnection as M, normalizeEgressPolicyFields as N, normalizeCaptureProof as O, normalizeProxySecretReceipt as P, DEPLOY_WINDOW_RETRY_MS as R, SandboxOperationFailedError as S, splitInlineProfileSkills as T, isRateLimitCreateError as U, isCapacityShortageCreateError as V, isRetryableCreateError as W, collectAgentResponseText as _, buildTraceExportPayload as a, ManagedProcessClient as b, toOtelJson as c, InteractiveSessionHandle as d, InteractiveTerminalFrameLog as f, collectAgentFinalMessageText as g, applySandboxEventText as h, MAX_EGRESS_DENIALS_LIMIT as i, parseStopPhase as j, normalizeSandboxCreateReceipt as k, SandboxTaskSession as l, createInteractiveTerminalSession as m, createSandboxInstanceFromResponse as n, exportTraceBundle as o, createInteractiveTerminalCapture as p, WorkspaceImages as r, otelTraceIdForTangleTrace as s, SandboxInstance as t, SandboxSession as u, getSandboxEventText as v, splitInlineProfileFileMounts as w, SandboxOperation as x, isToolBearingEvent as y, createRetryDelayMs as z };
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-
|
|
1
|
+
import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-CZxvfOpr.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
1
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-DSq5wR-6.js";
|
|
2
2
|
import { i as readResponseJson } from "./errors-BfR-fBvN.js";
|
|
3
3
|
import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-vaFoyyiO.js";
|
|
4
4
|
//#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.151",
|
|
4
4
|
"description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -154,14 +154,14 @@
|
|
|
154
154
|
"ws": "^8.22.0",
|
|
155
155
|
"yjs": "13.6.33",
|
|
156
156
|
"@products/sandbox-test-utils": "0.0.0",
|
|
157
|
-
"@repo/shared": "0.0.0",
|
|
158
157
|
"@tangle-network/cli-agent-registry": "0.15.0",
|
|
159
|
-
"@
|
|
160
|
-
"@tangle-network/agent-profile-materialize": "0.27.1"
|
|
158
|
+
"@repo/shared": "0.0.0",
|
|
159
|
+
"@tangle-network/agent-profile-materialize": "0.27.1",
|
|
160
|
+
"@tangle-network/runtime-contracts": "0.20.0"
|
|
161
161
|
},
|
|
162
162
|
"tangleRelease": {
|
|
163
|
-
"sourceSha": "
|
|
164
|
-
"mergedAt": "2026-10-
|
|
163
|
+
"sourceSha": "92b8ac3234515337008cf66f2715c4c5661453a5",
|
|
164
|
+
"mergedAt": "2026-10-31T03:47:48-06:00"
|
|
165
165
|
},
|
|
166
166
|
"scripts": {
|
|
167
167
|
"build": "node scripts/build-dist.mjs",
|