@tangle-network/sandbox 1.0.358 → 1.0.360

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/README.md CHANGED
@@ -41,7 +41,7 @@ Every HTTP request has a default deadline, including direct runtime, Platform, b
41
41
 
42
42
  JSON and error bodies remain bounded through consumption. Successful event streams, downloads and batch streams use the request deadline through response headers; their lifetime is controlled by caller cancellation and the operation's stream policy. A timeout ends the client's wait; work already accepted by the server may continue. Rejoin a keyed create or batch using its original key.
43
43
 
44
- Retries require both a replay-safe request and a retryable catalog error. Recovery may first refresh an expired bearer, supply a missing profile or wait for a retained snapshot's copy; these state changes preserve their existing recovery behavior. Transport retries retain shared pacing, `Retry-After`, caller cancellation and their deadline. `x-no-retry` disables transport replay. A planned host-agent restart refuses new work before it reaches the sandbox: the host answers 503 `SIDECAR_RESTARTING` (header-marked; the SDK resends it through the API) and the API answers 503 `HOST_AGENT_RESTARTING` with `Retry-After` and `retryUntil`, after holding the request for part of the restart. Either is safe to resend whatever the method. A turn's first POST is resent under its execution id until `retryUntil`; other calls are not yet (#18232), so a caller resends them.
44
+ Retries require both a replay-safe request and a retryable catalog error. Recovery may first refresh an expired bearer, supply a missing profile or wait for a retained snapshot's copy; these state changes preserve their existing recovery behavior. Transport retries retain shared pacing, `Retry-After`, caller cancellation and their deadline. `x-no-retry` disables transport replay. A planned host-agent restart refuses new work before it reaches the sandbox: the host answers 503 `SIDECAR_RESTARTING` (header-marked; the SDK resends it through the API) and the API answers 503 `HOST_AGENT_RESTARTING` with `Retry-After` and `retryUntil`, after holding the request for part of the restart. Either is safe to resend whatever the method. A turn's first POST is resent under its execution id until `retryUntil`; any other call the API refuses with `HOST_AGENT_RESTARTING` is resent whatever its method, within its attempts and deadline, unless `x-no-retry` is set.
45
45
 
46
46
  ## Choose an entrypoint
47
47
 
@@ -1,8 +1,8 @@
1
- import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-DZAOzxSU.js";
2
- import { D as assertCurrentBackendType } from "../interactive-controller-B96vAwgY.js";
3
- import { t as SandboxInstance } from "../sandbox-Cdrkxe3b.js";
1
+ import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-C7u2MP-o.js";
2
+ import { D as assertCurrentBackendType } from "../interactive-controller-P6pOAp7O.js";
3
+ import { t as SandboxInstance } from "../sandbox-C98VGojy.js";
4
4
  import { O as ValidationError, T as StateError, v as NotFoundError } from "../errors-vuyhjefs.js";
5
- import { t as Sandbox } from "../client-CvIwi5A-.js";
5
+ import { t as Sandbox } from "../client-CJbIFADn.js";
6
6
  import { z } from "zod";
7
7
  //#region src/agent/instances.ts
8
8
  const managers = /* @__PURE__ */ new WeakMap();
@@ -66,7 +66,7 @@ async function servePreviewMcp(request, config) {
66
66
  if (typeof config.authorize !== "function") throw new Error("Preview MCP requires a host authorization callback");
67
67
  const tools = config.tools ?? PREVIEW_TOOLS;
68
68
  if (!tools.length || tools.some((tool) => !PREVIEW_TOOLS.includes(tool))) throw new Error("Preview MCP requires an explicit nonempty preview-only tool grant");
69
- const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-DZAOzxSU.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
69
+ const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-C7u2MP-o.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
70
70
  const handle = await createMcpServer(config.box, {
71
71
  name: "tangle-previews",
72
72
  sessionId: config.sessionId,
@@ -30,7 +30,7 @@ function rewrapResponse(original, headers, body = original.body) {
30
30
  //#endregion
31
31
  //#region src/lib/api-request.mjs
32
32
  /** The package version tsdown.config.ts defines; unbuilt source reports 0.0.0. */
33
- const SDK_VERSION = "1.0.358";
33
+ const SDK_VERSION = "1.0.360";
34
34
  function withRequestContextHeaders(response, path, method, body = response.body) {
35
35
  const headers = new Headers(response.headers);
36
36
  headers.set("x-tangle-request-path", path);
@@ -68,15 +68,15 @@ function isReplayableBody(body) {
68
68
  if (typeof ReadableStream !== "undefined" && body instanceof ReadableStream) return false;
69
69
  return !(Symbol.asyncIterator in body);
70
70
  }
71
- /** The wait before resending after `response` (none: connection lost) on the shared pacing, or undefined when it is final or cannot go before `deadline`. */
72
- async function retryDelayMs(response, attempt, deadline) {
71
+ /** The wait before resending after `response` (none: connection lost) on the shared pacing, or undefined when it is final, not `safe` to resend (a planned-restart refusal always is) or cannot go before `deadline`. */
72
+ async function retryDelayMs(response, attempt, deadline, safe) {
73
73
  const after = parseSandboxRetryAfterHeader(response?.headers.get("retry-after"));
74
74
  const status = response?.status ?? 503;
75
- if (!(status >= 502 && status <= 504 || status === 429 && after !== void 0)) return void 0;
75
+ if (!(status >= 502 && status <= 504 || status === 429 && after !== void 0) || !safe && !response) return void 0;
76
76
  if (response) {
77
77
  const body = await response.clone().json().catch(() => null);
78
78
  const code = body?.error?.code ?? body?.code;
79
- if (typeof code === "string" && Object.hasOwn(ERROR_CATALOG, code) && !catalogEntry(code).retryable) return void 0;
79
+ if (!safe && code !== "HOST_AGENT_RESTARTING" || Object.hasOwn(ERROR_CATALOG, code) && !catalogEntry(code).retryable) return void 0;
80
80
  }
81
81
  return planResend(SANDBOX_API_RETRY_SCOPE, attempt, {
82
82
  retryAfterMs: after,
@@ -84,7 +84,7 @@ async function retryDelayMs(response, attempt, deadline) {
84
84
  capMs: 4e3
85
85
  });
86
86
  }
87
- /** SDK/probe transport retries replayable idempotent/keyed calls, or any verb after a proven failed dial.
87
+ /** SDK/probe transport retries replayable idempotent/keyed calls, or any verb after a proven failed dial or a planned-restart refusal.
88
88
  * x-no-retry forbids replay; the caller deadline bounds attempts, and headers finalize an answer. */
89
89
  async function fetchSandboxApi({ baseUrl, apiKey, timeoutMs = SDK_TIMEOUTS.default, signal, fetchImpl = fetch, networkError = (error) => error, timeoutError = () => new DOMException("The operation was aborted due to timeout", "TimeoutError") }, path, options, fetchOptions) {
90
90
  const url = `${baseUrl.replace(/\/+$/, "")}${path}`;
@@ -132,7 +132,7 @@ async function fetchSandboxApi({ baseUrl, apiKey, timeoutMs = SDK_TIMEOUTS.defau
132
132
  lost = error;
133
133
  }
134
134
  const undelivered = !response && isUndelivered(lost);
135
- const delayMs = repeatable && (undelivered || safe) && attempt < attempts ? await retryDelayMs(response, attempt, deadline) : void 0;
135
+ const delayMs = repeatable && attempt < attempts ? await retryDelayMs(response, attempt, deadline, undelivered || safe) : void 0;
136
136
  if (delayMs === void 0) {
137
137
  if (!response) throw lost;
138
138
  break;
@@ -1,7 +1,7 @@
1
1
  import { C as boundedIdentifierSchema, D as isBoundedEventContentJson, E as boundedStringSchema, S as boundedEventContentStringSchema, T as boundedJsonSchema, _ as CONTRACT_MAX_ARRAY_LENGTH, b as boundedEventContentJsonSchema, g as sha256DigestSchema, o as canonicalCandidateDigest, w as boundedJsonRecordSchema, x as boundedEventContentRecordSchema, y as CONTRACT_MAX_STRING_LENGTH } from "./harness-DW2I_kp7.js";
2
2
  import { t as agentExecutionPreparationReceiptSchema } from "./agent-execution-preparation-receipt-BFGr2nAM.js";
3
3
  import { t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
4
- import { i as fetchSandboxApi } from "./api-request-BzuYho6K.js";
4
+ import { i as fetchSandboxApi } from "./api-request-ICRFm6vc.js";
5
5
  import { z } from "zod";
6
6
  //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.21/node_modules/@tangle-network/agent-interface/dist/native-session-event.js
7
7
  /**
@@ -1,10 +1,10 @@
1
- import { D as assertCurrentBackendType, E as applyRequestedModel, M as withProfileHarness, N as withoutCreateOnlyModelFields, T as isBrowserRuntime, V as backendTypeSchema, k as normalizeRuntimeBackendConfig, o as requestInteractiveSessionToken, x as encodePromptForWire } from "./interactive-controller-B96vAwgY.js";
1
+ import { D as assertCurrentBackendType, E as applyRequestedModel, M as withProfileHarness, N as withoutCreateOnlyModelFields, T as isBrowserRuntime, V as backendTypeSchema, k as normalizeRuntimeBackendConfig, o as requestInteractiveSessionToken, x as encodePromptForWire } from "./interactive-controller-P6pOAp7O.js";
2
2
  import { r as agentProfileSchema } from "./profile-schema-C_MbI9mE.js";
3
- import { $ as isRateLimitCreateError, B as normalizeConnection, E as validateDeferredProfileFileMounts, F as normalizeSandboxCreateReceipt, G as CAPACITY_ETA_WAIT_MAX_MS, H as normalizeProxySecretReceipt, I as normalizeStartupDiagnostics, J as createRetryDelayMs, K as DEPLOY_WINDOW_RETRY_MS, P as normalizeCaptureProof, Q as isDeployWindowCreateError, R as dateOf, T as splitInlineProfileSkills, U as normalizeSandboxShape, V as normalizeEgressPolicyFields, W as CAPACITY_ETA_MARGIN_MS, X as generateIdempotencyKey, Y as extendableDeadline, Z as isCapacityShortageCreateError, d as sandboxLedgerUsd, et as isRetryableCreateError, n as createSandboxInstanceFromResponse, o as exportTraceBundle, q as awaitCreateResend, w as splitInlineProfileFileMounts, x as deleteSandbox, z as parseLifecycleTimes } from "./sandbox-Cdrkxe3b.js";
3
+ import { $ as createRetryDelayMs, A as splitInlineProfileSkills, B as normalizeSandboxCreateReceipt, E as deleteSandbox, G as normalizeConnection, J as normalizeSandboxShape, K as normalizeEgressPolicyFields, Q as awaitCreateResend, U as dateOf, V as normalizeStartupDiagnostics, W as parseLifecycleTimes, X as CAPACITY_ETA_WAIT_MAX_MS, Y as CAPACITY_ETA_MARGIN_MS, Z as DEPLOY_WINDOW_RETRY_MS, at as isRetryableCreateError, d as exportTraceBundle, et as extendableDeadline, g as sandboxLedgerUsd, it as isRateLimitCreateError, j as validateDeferredProfileFileMounts, k as splitInlineProfileFileMounts, n as createSandboxInstanceFromResponse, nt as isCapacityShortageCreateError, q as normalizeProxySecretReceipt, rt as isDeployWindowCreateError, tt as generateIdempotencyKey, z as normalizeCaptureProof } from "./sandbox-C98VGojy.js";
4
4
  import { C as SandboxError, D as TimeoutError, O as ValidationError, _ as NetworkError, a as readResponseJson, c as AuthError, i as parseResponseError, r as parseErrorResponse, v as NotFoundError, w as ServerError, y as PartialFailureError } from "./errors-vuyhjefs.js";
5
5
  import { n as combineAbortSignals } from "./abort-signal-BsriwJ8L.js";
6
6
  import { r as abortableSleep, t as RETRY_POLICY } from "./retry-policy-oW3_ljoc.js";
7
- import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-BzuYho6K.js";
7
+ import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-ICRFm6vc.js";
8
8
  import { l as SANDBOX_AGENT_HOME, t as isInsideReservedDir } from "./file-transfer-DOSTbUSR.js";
9
9
  import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-sGVP8skk.js";
10
10
  import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
@@ -1,2 +1,2 @@
1
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-BH_QCRvn.js";
1
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-p2F-32d0.js";
2
2
  export { CollaborationClient, CollaborationFileBridge, buildCollaborationDocumentId, normalizeCollaborationPath, parseCollaborationDocumentId };
@@ -1,5 +1,5 @@
1
1
  import { D as TimeoutError, _ as NetworkError, r as parseErrorResponse } from "./errors-vuyhjefs.js";
2
- import { i as fetchSandboxApi } from "./api-request-BzuYho6K.js";
2
+ import { i as fetchSandboxApi } from "./api-request-ICRFm6vc.js";
3
3
  //#region src/collaboration/client.ts
4
4
  function normalizeBaseUrl(url) {
5
5
  return url.replace(/\/+$/, "");
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
- import { S as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-Cdrkxe3b.js";
1
+ import { D as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-C98VGojy.js";
2
2
  import { C as SandboxError, D as TimeoutError, O as ValidationError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, m as FileWriteConflictError, o as responseMetadata, r as parseErrorResponse, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-vuyhjefs.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-CvIwi5A-.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-CJbIFADn.js";
4
4
  import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-vZDk8YYb.js";
5
5
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
6
6
  import { a as parseLineApplicationResult, i as parseLineApplicationRequest, n as LINE_APPLICATION_REPLY_MAX_CHARS, o as sandboxFailureKind, r as LINE_APPLICATION_REQUEST_MAX_BYTES, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-CBWUEURz.js";
@@ -1,4 +1,4 @@
1
- import { i as fetchSandboxApi } from "../api-request-BzuYho6K.js";
1
+ import { i as fetchSandboxApi } from "../api-request-ICRFm6vc.js";
2
2
  import { t as ITangleJobsAbi } from "../abi-pcDt2Adp.js";
3
3
  import { createPublicClient, createWalletClient, decodeAbiParameters, encodeAbiParameters, encodeFunctionData, hexToBytes, http, keccak256, parseAbi, parseAbiParameters, parseEventLogs, recoverMessageAddress, stringToHex } from "viem";
4
4
  import { privateKeyToAccount } from "viem/accounts";
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { A as requestedPublicProfileDigest, B as ALL_BACKEND_TYPES, F as createAgentRunOutcomeTracker, H as isolationPrincipalSchema, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, V as backendTypeSchema, W as parseBackendType, i as terminalUpgradeHeadersSupported, k as normalizeRuntimeBackendConfig, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./interactive-controller-B96vAwgY.js";
1
+ import { A as requestedPublicProfileDigest, B as ALL_BACKEND_TYPES, F as createAgentRunOutcomeTracker, H as isolationPrincipalSchema, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, V as backendTypeSchema, W as parseBackendType, i as terminalUpgradeHeadersSupported, k as normalizeRuntimeBackendConfig, n as InteractiveSessionController, r as TerminalStream, t as BrowserInteractiveSessionController, z as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./interactive-controller-P6pOAp7O.js";
2
2
  import { i as SANDBOX_SIZE_PRESET_NAMES, r as agentProfileSchema, t as agentProfileConfidentialSchema } from "./profile-schema-C_MbI9mE.js";
3
- 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-d-FdfGfu.js";
4
- import { A as isMaterializerHarness, C as materializeProfileFileMounts, D as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, E as validateDeferredProfileFileMounts, M as SandboxOperation, N as SandboxOperationFailedError, O as ProfileUnsupportedError, S as ManagedProcessClient, T as splitInlineProfileSkills, _ as collectAgentFinalMessageText, a as buildTraceExportPayload, b as isToolBearingEvent, c as toOtelJson, f as InteractiveSessionHandle, g as applySandboxEventText, h as createInteractiveTerminalSession, i as MAX_EGRESS_DENIALS_LIMIT, j as materializeProfile, k as enforceWorkspacePlanSupport, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as exportTraceBundle, p as InteractiveTerminalFrameLog, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as collectAgentResponseText, w as splitInlineProfileFileMounts, y as getSandboxEventText } from "./sandbox-Cdrkxe3b.js";
3
+ 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-BQJRUwwF.js";
4
+ import { A as splitInlineProfileSkills, C as collectAgentResponseText, D as ManagedProcessClient, F as isMaterializerHarness, I as materializeProfile, L as SandboxOperation, M as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, N as ProfileUnsupportedError, O as materializeProfileFileMounts, P as enforceWorkspacePlanSupport, R as SandboxOperationFailedError, S as collectAgentFinalMessageText, T as isToolBearingEvent, _ as InteractiveSessionHandle, a as SANDBOX_RUNTIMES, b as createInteractiveTerminalSession, c as gpuLeaseAttachSchema, d as exportTraceBundle, f as otelTraceIdForTangleTrace, h as SandboxSession, i as MAX_EGRESS_DENIALS_LIMIT, j as validateDeferredProfileFileMounts, k as splitInlineProfileFileMounts, l as gpuLeaseCommandSchema, m as SandboxTaskSession, o as GPU_LEASE_PROVIDER_NAMES, p as toOtelJson, r as WorkspaceImages, s as gpuAcceleratorSchema, t as SandboxInstance, u as buildTraceExportPayload, v as InteractiveTerminalFrameLog, w as getSandboxEventText, x as applySandboxEventText, y as createInteractiveTerminalCapture } from "./sandbox-C98VGojy.js";
5
5
  import { C as SandboxError, D as TimeoutError, E as StreamInterruptedError, O as ValidationError, S as ResumeEnvRequiredError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, d as CompliancePlacementError, f as EdgeNotReadyError, g as KeyBudgetExhaustedError, h as GpuProviderNotConfiguredError, l as BranchFanoutExceedsHostError, m as FileWriteConflictError, o as responseMetadata, p as EgressProxyRecoveryError, r as parseErrorResponse, t as TerminalStreamError, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-vuyhjefs.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-CvIwi5A-.js";
7
- import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-BzuYho6K.js";
8
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-BH_QCRvn.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-CJbIFADn.js";
7
+ import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-ICRFm6vc.js";
8
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-p2F-32d0.js";
9
9
  import "./file-transfer-DOSTbUSR.js";
10
10
  import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
11
11
  import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-vZDk8YYb.js";
@@ -13,7 +13,7 @@ import { t as downloadFile } from "./file-download-CdYQq4-A.js";
13
13
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
14
14
  import { a as parseLineApplicationResult, i as parseLineApplicationRequest, n as LINE_APPLICATION_REPLY_MAX_CHARS, o as sandboxFailureKind, r as LINE_APPLICATION_REQUEST_MAX_BYTES, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-CBWUEURz.js";
15
15
  import { a as createSelectSeat, i as SeatSelectionError, o as gatewaySeatTransport } from "./select-seat-LICdfnzm.js";
16
- import { s as BlueprintSandboxClient } from "./tangle-CihnQLE-.js";
16
+ import { s as BlueprintSandboxClient } from "./tangle-D4NR1KZM.js";
17
17
  import { z } from "zod";
18
18
  //#region ../../../packages/runtime-contracts/dist/model-key-proxy.js
19
19
  const MANAGED_MODEL_KEY_SENTINEL = "proxy-managed-per-request";
@@ -318,147 +318,6 @@ function startTeeAttestationHeartbeat(sandbox, options = {}) {
318
318
  };
319
319
  }
320
320
  //#endregion
321
- //#region ../../../packages/runtime-contracts/dist/gpu-lease.js
322
- const GPU_LEASE_PROVIDER_NAMES = [
323
- "runpod",
324
- "vast-ai",
325
- "lambda-labs",
326
- "aws",
327
- "gcp",
328
- "azure",
329
- "modal"
330
- ];
331
- const gpuLeaseProviderSchema = z.string().trim().toLowerCase().min(1).max(64).regex(/^[a-z][a-z0-9-]*$/);
332
- const gpuAcceleratorKindSchema = z.string().trim().toLowerCase().min(1).max(128).regex(/^[a-z0-9][a-z0-9._-]*$/);
333
- const gpuAcceleratorSchema = z.object({
334
- kind: gpuAcceleratorKindSchema,
335
- count: z.number().int().positive().default(1),
336
- vramGb: z.number().positive().optional()
337
- }).strict();
338
- const gpuLeaseCommandSchema = z.object({
339
- command: z.string().min(1).max(8192),
340
- timeoutMs: z.number().int().positive().max(2147453647).optional(),
341
- env: z.record(z.string(), z.string()).optional(),
342
- cwd: z.string().min(1).max(2048).optional()
343
- }).strict();
344
- z.object({
345
- refresh: z.enum(["true", "false"]).optional(),
346
- acceleratorKind: gpuAcceleratorKindSchema.optional(),
347
- acceleratorCount: z.coerce.number().pipe(gpuAcceleratorSchema.shape.count.unwrap()).optional(),
348
- acceleratorVramGb: z.coerce.number().positive().optional()
349
- }).strict();
350
- z.object({
351
- maxSpendUsd: z.number().positive().max(1e4).optional(),
352
- maxLifetimeSeconds: z.number().int().positive().max(1440 * 60).optional()
353
- }).strict().refine((value) => value.maxSpendUsd !== void 0 || value.maxLifetimeSeconds !== void 0, "Renewal requires a lifetime or spend cap");
354
- const gpuLeaseOptionsSchema = z.object({
355
- provider: gpuLeaseProviderSchema.optional(),
356
- image: z.string().min(1).max(512).optional(),
357
- env: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/), z.string()).optional(),
358
- diskGb: z.number().int().positive().optional(),
359
- volumeGb: z.number().int().nonnegative().optional(),
360
- volumeMountPath: z.string().startsWith("/").max(2048).optional(),
361
- region: z.string().min(1).max(128).optional(),
362
- manifest: z.record(z.string(), z.unknown()).optional(),
363
- command: z.array(z.string().max(8192)).min(1).max(256).optional(),
364
- ports: z.array(z.number().int().min(1).max(65535)).max(32).optional(),
365
- endpoint: z.object({
366
- port: z.number().int().min(1).max(65535),
367
- healthPath: z.string().regex(/^\/(?![/\\])/).refine((path) => ![
368
- "\r",
369
- "\n",
370
- " "
371
- ].some((char) => path.includes(char))).max(2048).optional()
372
- }).strict().optional(),
373
- allowSpot: z.boolean().optional(),
374
- maxHourlyUsd: z.number().positive().optional(),
375
- weights: z.object({
376
- manifestSha: z.string().regex(/^[a-f0-9]{64}$/),
377
- sizeBytes: z.number().int().positive().safe()
378
- }).strict().optional(),
379
- arms: z.array(z.unknown()).min(1).max(256).optional(),
380
- maxSpendUsd: z.number().positive().max(1e4),
381
- maxLifetimeSeconds: z.number().int().positive().max(1440 * 60),
382
- idleTimeoutSeconds: z.number().int().positive().optional()
383
- }).strict();
384
- const gpuLeaseAttachSchema = gpuLeaseOptionsSchema.extend({ accelerator: gpuAcceleratorSchema });
385
- const acceleratorSchema$1 = gpuAcceleratorSchema;
386
- const providerSchema = gpuLeaseProviderSchema;
387
- z.object({
388
- ...gpuLeaseOptionsSchema.omit({ env: true }).shape,
389
- id: z.string(),
390
- projectRef: z.string(),
391
- ownerUserId: z.string(),
392
- productId: z.string().optional(),
393
- provider: providerSchema,
394
- providerLeaseId: z.string().optional(),
395
- providerInstanceType: z.string().optional(),
396
- workerUrl: z.string().optional(),
397
- endpointUrl: z.string().optional(),
398
- status: z.enum([
399
- "provisioning",
400
- "ready",
401
- "detaching",
402
- "destroyed",
403
- "failed"
404
- ]),
405
- accelerator: acceleratorSchema$1,
406
- providerCostPerHourUsd: z.number().optional(),
407
- customerPricePerHourUsd: z.number().optional(),
408
- estimatedProviderCostUsd: z.number().optional(),
409
- estimatedCustomerCostUsd: z.number().optional(),
410
- providerSelection: z.object({
411
- strategy: z.enum([
412
- "explicit",
413
- "cheapest",
414
- "ranked"
415
- ]),
416
- selectedProvider: providerSchema,
417
- requestedProvider: providerSchema.optional(),
418
- candidates: z.array(z.object({
419
- provider: providerSchema,
420
- accelerator: acceleratorSchema$1,
421
- providerInstanceType: z.string().optional(),
422
- region: z.string().optional(),
423
- pricingSource: z.enum(["live", "configured"]).optional(),
424
- providerCostPerHourUsd: z.number(),
425
- customerPricePerHourUsd: z.number(),
426
- maxLifetimeSeconds: z.number(),
427
- estimatedProviderCostUsd: z.number(),
428
- estimatedCustomerCostUsd: z.number()
429
- })),
430
- rejected: z.array(z.object({
431
- provider: providerSchema,
432
- error: z.string()
433
- }))
434
- }).optional(),
435
- createdAt: z.string(),
436
- updatedAt: z.string(),
437
- readyAt: z.string().optional(),
438
- startedAt: z.string().optional(),
439
- lastUsedAt: z.string().optional(),
440
- destroyedAt: z.string().optional(),
441
- failure: z.string().optional(),
442
- billing: z.object({
443
- seconds: z.number(),
444
- providerCostUsd: z.number(),
445
- customerCostUsd: z.number(),
446
- providerCostPerHourUsd: z.number(),
447
- customerPricePerHourUsd: z.number(),
448
- startedAt: z.string(),
449
- stoppedAt: z.string()
450
- }).optional()
451
- });
452
- //#endregion
453
- //#region ../../../packages/runtime-contracts/dist/runtime-backend.js
454
- /**
455
- * The runtime a sandbox runs on, which a create names as `runtime`: a Docker
456
- * container on the host kernel, or a Firecracker microVM with its own kernel.
457
- * It is also what a provisioned host runs and the autoscaler buys.
458
- */
459
- const SANDBOX_RUNTIMES = ["docker", "firecracker"];
460
- [...SANDBOX_RUNTIMES];
461
- //#endregion
462
321
  //#region src/image.ts
463
322
  function isFetchClient(client) {
464
323
  return typeof client.fetch === "function";
@@ -1,5 +1,5 @@
1
1
  import { D as TimeoutError, _ as NetworkError, r as parseErrorResponse, u as CapabilityError } from "../errors-vuyhjefs.js";
2
- import { i as fetchSandboxApi } from "../api-request-BzuYho6K.js";
2
+ import { i as fetchSandboxApi } from "../api-request-ICRFm6vc.js";
3
3
  import { n as verifyDownload } from "../file-download-CdYQq4-A.js";
4
4
  import { t as rawEvidenceArchiveAttemptSchema } from "../raw-evidence-export-Dog7W5zP.js";
5
5
  import { z } from "zod";
@@ -1,2 +1,2 @@
1
- import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-d-FdfGfu.js";
1
+ import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-BQJRUwwF.js";
2
2
  export { BrowserInteractiveSessionControlController, InteractiveSessionNotRunningError, browserInteractiveControlHolderId };
@@ -1,9 +1,9 @@
1
1
  import { C as boundedIdentifierSchema, T as boundedJsonSchema, o as canonicalCandidateDigest } from "./harness-DW2I_kp7.js";
2
2
  import { r as agentProfileSchema } from "./profile-schema-C_MbI9mE.js";
3
- import { B as PlanContinuationSchema, D as agentInteractiveSessionControlClaimMatchesRef, P as AgentExactRunControlRefSchema, R as AgentExecutionOutcomeSchema, U as InteractionRequestSchema, c as assertInteractiveSessionRef, h as AgentInteractiveSessionAttachSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, r as browserInteractiveTerminalEndpoint, v as AgentInteractiveSessionControlClaimSchema, x as AgentInteractiveSessionRefSchema, z as DurablePlanSchema } from "./browser-interactive-control-controller-d-FdfGfu.js";
3
+ import { B as PlanContinuationSchema, D as agentInteractiveSessionControlClaimMatchesRef, P as AgentExactRunControlRefSchema, R as AgentExecutionOutcomeSchema, U as InteractionRequestSchema, c as assertInteractiveSessionRef, h as AgentInteractiveSessionAttachSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, r as browserInteractiveTerminalEndpoint, v as AgentInteractiveSessionControlClaimSchema, x as AgentInteractiveSessionRefSchema, z as DurablePlanSchema } from "./browser-interactive-control-controller-BQJRUwwF.js";
4
4
  import { O as ValidationError, _ as NetworkError, i as parseResponseError, s as retryWhen, t as TerminalStreamError, u as CapabilityError, w as ServerError } from "./errors-vuyhjefs.js";
5
5
  import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
6
- import { n as SDK_TIMEOUTS } from "./api-request-BzuYho6K.js";
6
+ import { n as SDK_TIMEOUTS } from "./api-request-ICRFm6vc.js";
7
7
  import { c as awaitSdkResend, s as uploadChunked } from "./chunked-upload-wSXiVX7I.js";
8
8
  import { t as parseSSEStream } from "./sse-parser-BCG3iL9j.js";
9
9
  import { z } from "zod";
@@ -1,4 +1,4 @@
1
- import "./api-request-BzuYho6K.js";
1
+ import "./api-request-ICRFm6vc.js";
2
2
  import { u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-DOSTbUSR.js";
3
3
  import { a as listAgentPreviews, i as getAgentPreview, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "./preview-operations-BTHZR1w2.js";
4
4
  //#region \0rolldown/runtime.js
@@ -396,7 +396,7 @@ async function createMcpServer(box, options = {}) {
396
396
  const { bindings, handlers } = bindToolSpecs(box, options);
397
397
  const server = new serverModule.Server({
398
398
  name: options.name ?? "tangle-sandbox",
399
- version: options.version ?? "1.0.358"
399
+ version: options.version ?? "1.0.360"
400
400
  }, { capabilities: { tools: {} } });
401
401
  server.setRequestHandler(typesModule.ListToolsRequestSchema, async () => ({ tools: bindings.map(({ spec: s }) => ({
402
402
  name: s.name,
package/dist/runtime.js CHANGED
@@ -1,7 +1,7 @@
1
- import { F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController } from "./interactive-controller-B96vAwgY.js";
2
- import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-d-FdfGfu.js";
1
+ import { F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController } from "./interactive-controller-P6pOAp7O.js";
2
+ import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BQJRUwwF.js";
3
3
  import { C as SandboxError, D as TimeoutError, O as ValidationError, T as StateError, _ as NetworkError, b as ProfileFileMountPathError, c as AuthError, m as FileWriteConflictError, u as CapabilityError, v as NotFoundError, w as ServerError, x as QuotaError, y as PartialFailureError } from "./errors-vuyhjefs.js";
4
- import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-BzuYho6K.js";
4
+ import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-ICRFm6vc.js";
5
5
  import { s as uploadChunked } from "./chunked-upload-wSXiVX7I.js";
6
6
  //#region src/runtime-client.ts
7
7
  function requireToken(token) {
@@ -1,14 +1,14 @@
1
- import { A as requestedPublicProfileDigest, C as runtimeFilesystemPath, D as assertCurrentBackendType, E as applyRequestedModel, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodeTextForWire, U as normalizeEffectiveBackend, _ as mintTraceId, a as assertScopedTokenActive, b as validateAcceptedDispatchRunRef, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as canUseNodeHttp2, x as encodePromptForWire, y as resolveDispatchRunIdentity } from "./interactive-controller-B96vAwgY.js";
1
+ import { A as requestedPublicProfileDigest, C as runtimeFilesystemPath, D as assertCurrentBackendType, E as applyRequestedModel, F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, O as mergeRuntimeBackendConfig, P as withoutRuntimeSecrets, S as encodeTextForWire, U as normalizeEffectiveBackend, _ as mintTraceId, a as assertScopedTokenActive, b as validateAcceptedDispatchRunRef, c as SandboxRuntimeApi, d as appendSessionIdQuery, f as callHeaders, g as isTraceId, h as TRACE_ID_HEADER, i as terminalUpgradeHeadersSupported, j as requestedSecretProfilePublicDigest, k as normalizeRuntimeBackendConfig, l as normalizeSessionInfo, m as assertFileWritePreconditions, n as InteractiveSessionController, p as sessionHeaders, r as TerminalStream, s as requestScopedToken, u as sessionMessageRequestBody, v as resolveTraceId, w as canUseNodeHttp2, x as encodePromptForWire, y as resolveDispatchRunIdentity } from "./interactive-controller-P6pOAp7O.js";
2
2
  import { C as boundedIdentifierSchema$1, E as boundedStringSchema$1, g as sha256DigestSchema$1, o as canonicalCandidateDigest$1, s as canonicalCandidateJson$1 } from "./harness-DW2I_kp7.js";
3
3
  import { a as ProxySecretReceiptSchema$1, r as agentProfileSchema$1 } from "./profile-schema-C_MbI9mE.js";
4
4
  import { t as sha256$1 } from "./sha2-BIoWepwn.js";
5
- 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-d-FdfGfu.js";
5
+ 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-BQJRUwwF.js";
6
6
  import { t as canonicalAgentProfileDigest } from "./agent-execution-preparation-CatenlMs.js";
7
7
  import { C as SandboxError, D as TimeoutError, E as StreamInterruptedError, O as ValidationError, T as StateError, _ as NetworkError, a as readResponseJson, b as ProfileFileMountPathError, c as AuthError, f as EdgeNotReadyError, i as parseResponseError, n as isTransientWrite, o as responseMetadata, r as parseErrorResponse, s as retryWhen, t as TerminalStreamError, u as CapabilityError, v as NotFoundError, w as ServerError, y as PartialFailureError } from "./errors-vuyhjefs.js";
8
8
  import { t as parseSandboxRetryAfterHeader } from "./retry-after-header-BZbs5rig.js";
9
9
  import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
10
10
  import { a as backoffDelayMs, o as isUndelivered, r as abortableSleep } from "./retry-policy-oW3_ljoc.js";
11
- import { a as isReplayableBody, i as fetchSandboxApi, n as SDK_TIMEOUTS, o as rewrapResponse, t as IDEMPOTENT_METHODS } from "./api-request-BzuYho6K.js";
11
+ import { a as isReplayableBody, i as fetchSandboxApi, n as SDK_TIMEOUTS, o as rewrapResponse, t as IDEMPOTENT_METHODS } from "./api-request-ICRFm6vc.js";
12
12
  import { a as SANDBOX_PROXY_REQUEST_MAX_BYTES, c as PROFILE_FILE_MOUNT_OUTSIDE_ROOTS_CODE, d as isProfileFileMountOutsideRoots, f as profileFileMountOutsideRootsMessage, l as SANDBOX_AGENT_HOME, o as FILE_OPERATION_LIMITS, u as SANDBOX_FILE_API_ABSOLUTE_ROOTS } from "./file-transfer-DOSTbUSR.js";
13
13
  import { c as awaitSdkResend, l as takeSdkTurn, s as uploadChunked } from "./chunked-upload-wSXiVX7I.js";
14
14
  import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-sGVP8skk.js";
@@ -13777,6 +13777,147 @@ var SandboxEgressCapabilities = class extends SandboxTraceCapabilities {
13777
13777
  }
13778
13778
  };
13779
13779
  //#endregion
13780
+ //#region ../../../packages/runtime-contracts/dist/gpu-lease.js
13781
+ const GPU_LEASE_PROVIDER_NAMES = [
13782
+ "runpod",
13783
+ "vast-ai",
13784
+ "lambda-labs",
13785
+ "aws",
13786
+ "gcp",
13787
+ "azure",
13788
+ "modal"
13789
+ ];
13790
+ const gpuLeaseProviderSchema = z.string().trim().toLowerCase().min(1).max(64).regex(/^[a-z][a-z0-9-]*$/);
13791
+ const gpuAcceleratorKindSchema = z.string().trim().toLowerCase().min(1).max(128).regex(/^[a-z0-9][a-z0-9._-]*$/);
13792
+ const gpuAcceleratorSchema = z.object({
13793
+ kind: gpuAcceleratorKindSchema,
13794
+ count: z.number().int().positive().default(1),
13795
+ vramGb: z.number().positive().optional()
13796
+ }).strict();
13797
+ const gpuLeaseCommandSchema = z.object({
13798
+ command: z.string().min(1).max(8192),
13799
+ timeoutMs: z.number().int().positive().max(2147453647).optional(),
13800
+ env: z.record(z.string(), z.string()).optional(),
13801
+ cwd: z.string().min(1).max(2048).optional()
13802
+ }).strict();
13803
+ z.object({
13804
+ refresh: z.enum(["true", "false"]).optional(),
13805
+ acceleratorKind: gpuAcceleratorKindSchema.optional(),
13806
+ acceleratorCount: z.coerce.number().pipe(gpuAcceleratorSchema.shape.count.unwrap()).optional(),
13807
+ acceleratorVramGb: z.coerce.number().positive().optional()
13808
+ }).strict();
13809
+ z.object({
13810
+ maxSpendUsd: z.number().positive().max(1e4).optional(),
13811
+ maxLifetimeSeconds: z.number().int().positive().max(1440 * 60).optional()
13812
+ }).strict().refine((value) => value.maxSpendUsd !== void 0 || value.maxLifetimeSeconds !== void 0, "Renewal requires a lifetime or spend cap");
13813
+ const gpuLeaseOptionsSchema = z.object({
13814
+ provider: gpuLeaseProviderSchema.optional(),
13815
+ image: z.string().min(1).max(512).optional(),
13816
+ env: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/), z.string()).optional(),
13817
+ diskGb: z.number().int().positive().optional(),
13818
+ volumeGb: z.number().int().nonnegative().optional(),
13819
+ volumeMountPath: z.string().startsWith("/").max(2048).optional(),
13820
+ region: z.string().min(1).max(128).optional(),
13821
+ manifest: z.record(z.string(), z.unknown()).optional(),
13822
+ command: z.array(z.string().max(8192)).min(1).max(256).optional(),
13823
+ ports: z.array(z.number().int().min(1).max(65535)).max(32).optional(),
13824
+ endpoint: z.object({
13825
+ port: z.number().int().min(1).max(65535),
13826
+ healthPath: z.string().regex(/^\/(?![/\\])/).refine((path) => ![
13827
+ "\r",
13828
+ "\n",
13829
+ " "
13830
+ ].some((char) => path.includes(char))).max(2048).optional()
13831
+ }).strict().optional(),
13832
+ allowSpot: z.boolean().optional(),
13833
+ maxHourlyUsd: z.number().positive().optional(),
13834
+ weights: z.object({
13835
+ manifestSha: z.string().regex(/^[a-f0-9]{64}$/),
13836
+ sizeBytes: z.number().int().positive().safe()
13837
+ }).strict().optional(),
13838
+ arms: z.array(z.unknown()).min(1).max(256).optional(),
13839
+ maxSpendUsd: z.number().positive().max(1e4),
13840
+ maxLifetimeSeconds: z.number().int().positive().max(1440 * 60),
13841
+ idleTimeoutSeconds: z.number().int().positive().optional()
13842
+ }).strict();
13843
+ const gpuLeaseAttachSchema = gpuLeaseOptionsSchema.extend({ accelerator: gpuAcceleratorSchema });
13844
+ const acceleratorSchema = gpuAcceleratorSchema;
13845
+ const providerSchema = gpuLeaseProviderSchema;
13846
+ z.object({
13847
+ ...gpuLeaseOptionsSchema.omit({ env: true }).shape,
13848
+ id: z.string(),
13849
+ projectRef: z.string(),
13850
+ ownerUserId: z.string(),
13851
+ productId: z.string().optional(),
13852
+ provider: providerSchema,
13853
+ providerLeaseId: z.string().optional(),
13854
+ providerInstanceType: z.string().optional(),
13855
+ workerUrl: z.string().optional(),
13856
+ endpointUrl: z.string().optional(),
13857
+ status: z.enum([
13858
+ "provisioning",
13859
+ "ready",
13860
+ "detaching",
13861
+ "destroyed",
13862
+ "failed"
13863
+ ]),
13864
+ accelerator: acceleratorSchema,
13865
+ providerCostPerHourUsd: z.number().optional(),
13866
+ customerPricePerHourUsd: z.number().optional(),
13867
+ estimatedProviderCostUsd: z.number().optional(),
13868
+ estimatedCustomerCostUsd: z.number().optional(),
13869
+ providerSelection: z.object({
13870
+ strategy: z.enum([
13871
+ "explicit",
13872
+ "cheapest",
13873
+ "ranked"
13874
+ ]),
13875
+ selectedProvider: providerSchema,
13876
+ requestedProvider: providerSchema.optional(),
13877
+ candidates: z.array(z.object({
13878
+ provider: providerSchema,
13879
+ accelerator: acceleratorSchema,
13880
+ providerInstanceType: z.string().optional(),
13881
+ region: z.string().optional(),
13882
+ pricingSource: z.enum(["live", "configured"]).optional(),
13883
+ providerCostPerHourUsd: z.number(),
13884
+ customerPricePerHourUsd: z.number(),
13885
+ maxLifetimeSeconds: z.number(),
13886
+ estimatedProviderCostUsd: z.number(),
13887
+ estimatedCustomerCostUsd: z.number()
13888
+ })),
13889
+ rejected: z.array(z.object({
13890
+ provider: providerSchema,
13891
+ error: z.string()
13892
+ }))
13893
+ }).optional(),
13894
+ createdAt: z.string(),
13895
+ updatedAt: z.string(),
13896
+ readyAt: z.string().optional(),
13897
+ startedAt: z.string().optional(),
13898
+ lastUsedAt: z.string().optional(),
13899
+ destroyedAt: z.string().optional(),
13900
+ failure: z.string().optional(),
13901
+ billing: z.object({
13902
+ seconds: z.number(),
13903
+ providerCostUsd: z.number(),
13904
+ customerCostUsd: z.number(),
13905
+ providerCostPerHourUsd: z.number(),
13906
+ customerPricePerHourUsd: z.number(),
13907
+ startedAt: z.string(),
13908
+ stoppedAt: z.string()
13909
+ }).optional()
13910
+ });
13911
+ //#endregion
13912
+ //#region ../../../packages/runtime-contracts/dist/runtime-backend.js
13913
+ /**
13914
+ * The runtime a sandbox runs on, which a create names as `runtime`: a Docker
13915
+ * container on the host kernel, or a Firecracker microVM with its own kernel.
13916
+ * It is also what a provisioned host runs and the autoscaler buys.
13917
+ */
13918
+ const SANDBOX_RUNTIMES = ["docker", "firecracker"];
13919
+ [...SANDBOX_RUNTIMES];
13920
+ //#endregion
13780
13921
  //#region ../../../packages/runtime-contracts/dist/egress-activity.js
13781
13922
  /**
13782
13923
  * The egress activity record a sandbox's proxy log is read into, shared by the
@@ -14955,4 +15096,4 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
14955
15096
  }
14956
15097
  };
14957
15098
  //#endregion
14958
- export { isRateLimitCreateError as $, isMaterializerHarness as A, normalizeConnection as B, materializeProfileFileMounts as C, HARNESS_LAUNCH_MATERIALIZE_OPTIONS as D, validateDeferredProfileFileMounts as E, normalizeSandboxCreateReceipt as F, CAPACITY_ETA_WAIT_MAX_MS as G, normalizeProxySecretReceipt as H, normalizeStartupDiagnostics as I, createRetryDelayMs as J, DEPLOY_WINDOW_RETRY_MS as K, readFilesystemIncarnationTuple as L, SandboxOperation as M, SandboxOperationFailedError as N, ProfileUnsupportedError as O, normalizeCaptureProof as P, isDeployWindowCreateError as Q, dateOf as R, ManagedProcessClient as S, splitInlineProfileSkills as T, normalizeSandboxShape as U, normalizeEgressPolicyFields as V, CAPACITY_ETA_MARGIN_MS as W, generateIdempotencyKey as X, extendableDeadline as Y, isCapacityShortageCreateError as Z, collectAgentFinalMessageText as _, buildTraceExportPayload as a, isToolBearingEvent as b, toOtelJson as c, sandboxLedgerUsd as d, isRetryableCreateError as et, InteractiveSessionHandle as f, applySandboxEventText as g, createInteractiveTerminalSession as h, MAX_EGRESS_DENIALS_LIMIT as i, materializeProfile as j, enforceWorkspacePlanSupport as k, SandboxTaskSession as l, createInteractiveTerminalCapture as m, createSandboxInstanceFromResponse as n, exportTraceBundle as o, InteractiveTerminalFrameLog as p, awaitCreateResend as q, WorkspaceImages as r, otelTraceIdForTangleTrace as s, SandboxInstance as t, SandboxSession as u, collectAgentResponseText as v, splitInlineProfileFileMounts as w, deleteSandbox as x, getSandboxEventText as y, parseLifecycleTimes as z };
15099
+ export { createRetryDelayMs as $, splitInlineProfileSkills as A, normalizeSandboxCreateReceipt as B, collectAgentResponseText as C, ManagedProcessClient as D, deleteSandbox as E, isMaterializerHarness as F, normalizeConnection as G, readFilesystemIncarnationTuple as H, materializeProfile as I, normalizeSandboxShape as J, normalizeEgressPolicyFields as K, SandboxOperation as L, HARNESS_LAUNCH_MATERIALIZE_OPTIONS as M, ProfileUnsupportedError as N, materializeProfileFileMounts as O, enforceWorkspacePlanSupport as P, awaitCreateResend as Q, SandboxOperationFailedError as R, collectAgentFinalMessageText as S, isToolBearingEvent as T, dateOf as U, normalizeStartupDiagnostics as V, parseLifecycleTimes as W, CAPACITY_ETA_WAIT_MAX_MS as X, CAPACITY_ETA_MARGIN_MS as Y, DEPLOY_WINDOW_RETRY_MS as Z, InteractiveSessionHandle as _, SANDBOX_RUNTIMES as a, isRetryableCreateError as at, createInteractiveTerminalSession as b, gpuLeaseAttachSchema as c, exportTraceBundle as d, extendableDeadline as et, otelTraceIdForTangleTrace as f, sandboxLedgerUsd as g, SandboxSession as h, MAX_EGRESS_DENIALS_LIMIT as i, isRateLimitCreateError as it, validateDeferredProfileFileMounts as j, splitInlineProfileFileMounts as k, gpuLeaseCommandSchema as l, SandboxTaskSession as m, createSandboxInstanceFromResponse as n, isCapacityShortageCreateError as nt, GPU_LEASE_PROVIDER_NAMES as o, toOtelJson as p, normalizeProxySecretReceipt as q, WorkspaceImages as r, isDeployWindowCreateError as rt, gpuAcceleratorSchema as s, SandboxInstance as t, generateIdempotencyKey as tt, buildTraceExportPayload as u, InteractiveTerminalFrameLog as v, getSandboxEventText as w, applySandboxEventText as x, createInteractiveTerminalCapture as y, normalizeCaptureProof as z };
@@ -1,5 +1,5 @@
1
1
  import { n as combineAbortSignals } from "../abort-signal-BsriwJ8L.js";
2
- import { i as fetchSandboxApi } from "../api-request-BzuYho6K.js";
2
+ import { i as fetchSandboxApi } from "../api-request-ICRFm6vc.js";
3
3
  import "../sidecar-proxy-error-DTdbCbUM.js";
4
4
  import { t as parseSSEStream } from "../sse-parser-BCG3iL9j.js";
5
5
  import { PART_TEXT, PART_TEXT_SUFFIX } from "@tangle-network/agent-core/sse";
@@ -1,3 +1,3 @@
1
- import { _ as SandboxCreateResponseParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as AgentSandboxBlueprintAbi, g as SandboxCreateParamTypes, h as JsonResponseParamTypes, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_DELETE, n as fetchQuote, o as validateQuote, p as JOB_SANDBOX_CREATE, r as inputsHashOf, s as BlueprintSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxIdParamTypes } from "../tangle-CihnQLE-.js";
1
+ import { _ as SandboxCreateResponseParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as AgentSandboxBlueprintAbi, g as SandboxCreateParamTypes, h as JsonResponseParamTypes, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_DELETE, n as fetchQuote, o as validateQuote, p as JOB_SANDBOX_CREATE, r as inputsHashOf, s as BlueprintSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxIdParamTypes } from "../tangle-D4NR1KZM.js";
2
2
  import { t as ITangleJobsAbi } from "../abi-pcDt2Adp.js";
3
3
  export { AgentSandboxBlueprintAbi, BlueprintSandboxClient, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
@@ -1,6 +1,6 @@
1
- import { L as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-Cdrkxe3b.js";
1
+ import { H as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-C98VGojy.js";
2
2
  import { a as readResponseJson } from "./errors-vuyhjefs.js";
3
- import { i as fetchSandboxApi } from "./api-request-BzuYho6K.js";
3
+ import { i as fetchSandboxApi } from "./api-request-ICRFm6vc.js";
4
4
  import { t as ITangleJobsAbi } from "./abi-pcDt2Adp.js";
5
5
  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-BvN0Mk3j.js";
6
6
  //#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.358",
3
+ "version": "1.0.360",
4
4
  "description": "TypeScript SDK for Tangle Sandbox: create cloud sandboxes and run commands and coding agents in them",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -153,15 +153,15 @@
153
153
  "vitest": "^4.1.12",
154
154
  "ws": "^8.22.0",
155
155
  "yjs": "13.6.33",
156
- "@products/sandbox-test-utils": "0.0.0",
157
156
  "@repo/shared": "0.0.0",
158
- "@tangle-network/agent-profile-materialize": "0.27.1",
159
157
  "@tangle-network/cli-agent-registry": "0.15.0",
160
- "@tangle-network/runtime-contracts": "0.20.0"
158
+ "@tangle-network/runtime-contracts": "0.20.0",
159
+ "@tangle-network/agent-profile-materialize": "0.27.1",
160
+ "@products/sandbox-test-utils": "0.0.0"
161
161
  },
162
162
  "tangleRelease": {
163
- "sourceSha": "a8b4845ca412f331d1089273862d166ae8f60c95",
164
- "mergedAt": "2026-11-10T11:02:57-08:00"
163
+ "sourceSha": "3a1cc7124e7ee6b6279cc728618cc699fbe74e41",
164
+ "mergedAt": "2026-11-10T11:25:12-08:00"
165
165
  },
166
166
  "scripts": {
167
167
  "build": "node scripts/build-dist.mjs && bash scripts/verify-dist.sh",