@tangle-network/sandbox 1.0.265 → 1.0.266

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.
@@ -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-DwOdRywt.js";
2
- import { D as assertCurrentBackendType } from "../interactive-controller-A0KLCNPz.js";
3
- import { t as SandboxInstance } from "../sandbox-XiYoPKxd.js";
1
+ import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-DVzsBlqX.js";
2
+ import { D as assertCurrentBackendType } from "../interactive-controller-llj6EdlZ.js";
3
+ import { t as SandboxInstance } from "../sandbox-C3PqmwfU.js";
4
4
  import { O as ValidationError, T as StateError, v as NotFoundError } from "../errors-D44qyFpy.js";
5
- import { t as Sandbox } from "../client-C04xz1Dc.js";
5
+ import { t as Sandbox } from "../client-BWD7-uaL.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-DwOdRywt.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
69
+ const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-DVzsBlqX.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.265";
33
+ const SDK_VERSION = "1.0.266";
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);
@@ -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--g8UQ5TZ.js";
2
2
  import { t as agentExecutionPreparationReceiptSchema } from "./agent-execution-preparation-receipt-j1Z7Om0k.js";
3
3
  import { t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
4
- import { i as fetchSandboxApi } from "./api-request-Dg5W8sur.js";
4
+ import { i as fetchSandboxApi } from "./api-request-gkPDymqn.js";
5
5
  import { z } from "zod";
6
6
  //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.20/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-A0KLCNPz.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-llj6EdlZ.js";
2
2
  import { r as agentProfileSchema } from "./profile-schema-B11dRfGB.js";
3
- import { $ as createRetryDelayMs, B as normalizeSandboxCreateReceipt, E as deleteSandbox, G as normalizeConnection, J as normalizeSandboxShape, K as normalizeEgressPolicyFields, M as splitInlineProfileSkills, N as validateDeferredProfileFileMounts, 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 splitInlineProfileFileMounts, n as createSandboxInstanceFromResponse, nt as isCapacityShortageCreateError, q as normalizeProxySecretReceipt, rt as isDeployWindowCreateError, tt as generateIdempotencyKey, z as normalizeCaptureProof } from "./sandbox-XiYoPKxd.js";
3
+ import { $ as isRateLimitCreateError, B as normalizeConnection, D as splitInlineProfileSkills, E as splitInlineProfileFileMounts, 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, O as validateDeferredProfileFileMounts, P as normalizeCaptureProof, Q as isDeployWindowCreateError, R as dateOf, 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, x as deleteSandbox, z as parseLifecycleTimes } from "./sandbox-C3PqmwfU.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-D44qyFpy.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-Dg5W8sur.js";
7
+ import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-gkPDymqn.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-DoygSndq.js";
1
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "../collaboration-Bqk4jYQe.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-D44qyFpy.js";
2
- import { i as fetchSandboxApi } from "./api-request-Dg5W8sur.js";
2
+ import { i as fetchSandboxApi } from "./api-request-gkPDymqn.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 { D as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-XiYoPKxd.js";
1
+ import { S as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-C3PqmwfU.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-D44qyFpy.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-C04xz1Dc.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-BWD7-uaL.js";
4
4
  import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-DwJ7AKx7.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-CTkHtpap.js";
@@ -304,7 +304,14 @@ declare const GPU_LEASE_JOBS: {
304
304
  readonly EXTEND: 2;
305
305
  readonly REAP: 3;
306
306
  };
307
+ interface GpuLeaseSessionDomain {
308
+ chainId: number;
309
+ vaultAddress: `0x${string}`;
310
+ blueprintAddress: `0x${string}`;
311
+ }
307
312
  interface GpuLeaseChain {
313
+ /** Client-owned RPC/configuration context; never supplied by the operator challenge. */
314
+ sessionDomain(): Promise<GpuLeaseSessionDomain>;
308
315
  readonly account: `0x${string}`;
309
316
  signMessage(message: string): Promise<`0x${string}`>;
310
317
  createVaultLease(input: {
@@ -353,8 +360,8 @@ interface GpuLeaseOutcome {
353
360
  rankedOperators: string[];
354
361
  }
355
362
  declare function gpuLease(options: GpuLeaseOptions): Promise<GpuLeaseOutcome>;
356
- /** Sign only the exact, 300 s challenge the operator issues for this lease, never a relayed one. */
357
- declare function openGpuLeaseSession(endpoint: OperatorEndpoint, leaseId: `0x${string}`, chain: Pick<GpuLeaseChain, "account" | "signMessage">): Promise<{
363
+ /** Sign only the SDK owner message bound to client-owned chain, contracts, operator and lease. */
364
+ declare function openGpuLeaseSession(endpoint: OperatorEndpoint, leaseId: `0x${string}`, chain: Pick<GpuLeaseChain, "account" | "signMessage" | "sessionDomain">): Promise<{
358
365
  credential: SessionCredential;
359
366
  access: LeaseStatus;
360
367
  }>;
@@ -370,6 +377,7 @@ interface ViemGpuLeaseChainConfig {
370
377
  rpcUrl: string;
371
378
  privateKey: `0x${string}`;
372
379
  vaultAddress: Address;
380
+ blueprintAddress: Address;
373
381
  tangleAddress: Address;
374
382
  serviceId: bigint;
375
383
  pollIntervalMs?: number;
@@ -511,4 +519,4 @@ declare function validateQuoteIdentity(quote: OperatorQuote, opts?: {
511
519
  pinnedOperator?: `0x${string}`;
512
520
  }): Promise<ValidatedQuote | QuoteRejection>;
513
521
  //#endregion
514
- export { Capabilities, ClassCapability, GPU_LEASE_JOBS, GPU_LEASE_REQUEST_ABI, GPU_LEASE_SCHEMA_VERSION, GPU_LEASE_VAULT_ABI, GpuLeaseChain, GpuLeaseEscrowError, GpuLeaseOperatorClient, GpuLeaseOptions, GpuLeaseOutcome, GpuLeaseOutputDecoded, GpuLeaseRequestParams, INTENT_VERSION, JsonRequestBody, LeaseStatus, OperatorEndpoint, OperatorQuote, QuoteFilterInput, QuoteParams, QuoteRejection, RefundReceipt, SessionChallenge, SessionCredential, ValidatedQuote, VaultLeaseView, canonicalQuotePayload, createViemGpuLeaseChain, decodeGpuLeaseOutput, encodeGpuLeaseRequest, gpuLease, gpuLeaseIntentHash, openGpuLeaseSession, projectGpuLeaseRefund, projectRefundWei, releaseGpuLease, selectQuotes, validateOperatorQuote, validateQuoteIdentity, verifyOperatorQuote };
522
+ export { Capabilities, ClassCapability, GPU_LEASE_JOBS, GPU_LEASE_REQUEST_ABI, GPU_LEASE_SCHEMA_VERSION, GPU_LEASE_VAULT_ABI, GpuLeaseChain, GpuLeaseEscrowError, GpuLeaseOperatorClient, GpuLeaseOptions, GpuLeaseOutcome, GpuLeaseOutputDecoded, GpuLeaseRequestParams, GpuLeaseSessionDomain, INTENT_VERSION, JsonRequestBody, LeaseStatus, OperatorEndpoint, OperatorQuote, QuoteFilterInput, QuoteParams, QuoteRejection, RefundReceipt, SessionChallenge, SessionCredential, ValidatedQuote, VaultLeaseView, canonicalQuotePayload, createViemGpuLeaseChain, decodeGpuLeaseOutput, encodeGpuLeaseRequest, gpuLease, gpuLeaseIntentHash, openGpuLeaseSession, projectGpuLeaseRefund, projectRefundWei, releaseGpuLease, selectQuotes, validateOperatorQuote, validateQuoteIdentity, verifyOperatorQuote };
@@ -1,6 +1,6 @@
1
- import { i as fetchSandboxApi } from "../api-request-Dg5W8sur.js";
1
+ import { i as fetchSandboxApi } from "../api-request-gkPDymqn.js";
2
2
  import { t as ITangleJobsAbi } from "../abi-pcDt2Adp.js";
3
- import { createPublicClient, createWalletClient, decodeAbiParameters, encodeAbiParameters, encodeFunctionData, http, keccak256, parseAbi, parseAbiParameters, parseEventLogs, recoverMessageAddress, stringToHex } from "viem";
3
+ import { createPublicClient, createWalletClient, decodeAbiParameters, encodeAbiParameters, encodeFunctionData, hexToBytes, http, keccak256, parseAbi, parseAbiParameters, parseEventLogs, recoverMessageAddress, stringToHex } from "viem";
4
4
  import { privateKeyToAccount } from "viem/accounts";
5
5
  //#region src/gpu-lease/vault.ts
6
6
  const GPU_LEASE_VAULT_ABI = parseAbi([
@@ -55,6 +55,13 @@ function createViemGpuLeaseChain(config) {
55
55
  const chain = {
56
56
  publicClient,
57
57
  account: account.address,
58
+ async sessionDomain() {
59
+ return {
60
+ chainId: await publicClient.getChainId(),
61
+ vaultAddress: config.vaultAddress,
62
+ blueprintAddress: config.blueprintAddress
63
+ };
64
+ },
58
65
  signMessage(message) {
59
66
  return account.signMessage({ message });
60
67
  },
@@ -465,11 +472,34 @@ async function gpuLease(options) {
465
472
  throw new GpuLeaseEscrowError(leaseId, error, await cleanup.then(() => void 0, (cleanupError) => cleanupError ?? "release failed"));
466
473
  }
467
474
  }
468
- /** Sign only the exact, 300 s challenge the operator issues for this lease, never a relayed one. */
475
+ /** Sign only the SDK owner message bound to client-owned chain, contracts, operator and lease. */
469
476
  async function openGpuLeaseSession(endpoint, leaseId, chain) {
470
477
  const client = new GpuLeaseOperatorClient(endpoint);
471
478
  const { nonce, message, expiresAt } = await client.sessionChallenge(leaseId, chain.account);
472
- const expected = `GPU lease access\nlease: ${leaseId.toLowerCase()}\nnonce: ${nonce}\nexpires: ${expiresAt}`;
479
+ const domain = await chain.sessionDomain();
480
+ const addressBytes = (address) => {
481
+ if (!/^0x[0-9a-fA-F]{40}$/.test(address) || /^0x0{40}$/.test(address)) throw new Error("gpuLease: invalid client session domain address");
482
+ return Array.from(hexToBytes(address));
483
+ };
484
+ if (!Number.isSafeInteger(domain.chainId) || domain.chainId <= 0 || !/^0x[0-9a-fA-F]{64}$/.test(leaseId) || !Number.isSafeInteger(expiresAt)) throw new Error("gpuLease: invalid client session domain or expiry");
485
+ const expected = `Blueprint resource access\n${JSON.stringify([
486
+ {
487
+ audience: `gpu-lease:${domain.blueprintAddress.toLowerCase()}`,
488
+ chain_id: domain.chainId,
489
+ operator: addressBytes(endpoint.address),
490
+ contract: addressBytes(domain.vaultAddress)
491
+ },
492
+ {
493
+ service_id: [0, 0],
494
+ resource: leaseId.toLowerCase().slice(2)
495
+ },
496
+ chain.account.toLowerCase().slice(2),
497
+ nonce.slice(2),
498
+ expiresAt,
499
+ ["gpu:attach", "gpu:exec"]
500
+ ])}`;
501
+ addressBytes(domain.blueprintAddress);
502
+ addressBytes(chain.account);
473
503
  const ttl = expiresAt - Date.now() / 1e3;
474
504
  if (!/^0x[0-9a-f]{64}$/.test(nonce) || message !== expected || !(ttl > 0 && ttl <= 360)) throw new Error("gpuLease: operator challenge is not for this lease");
475
505
  const credential = await client.sessionVerify(nonce, await chain.signMessage(message));
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-A0KLCNPz.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-llj6EdlZ.js";
2
2
  import { i as SANDBOX_SIZE_PRESET_NAMES, r as agentProfileSchema, t as agentProfileConfidentialSchema } from "./profile-schema-B11dRfGB.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-NiHD_q3m.js";
4
- import { A as materializeProfileFileMounts, C as collectAgentResponseText, D as ManagedProcessClient, F as ProfileUnsupportedError, I as enforceWorkspacePlanSupport, L as isMaterializerHarness, M as splitInlineProfileSkills, N as validateDeferredProfileFileMounts, O as SandboxOperation, P as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, R as materializeProfile, 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 splitInlineProfileFileMounts, k as SandboxOperationFailedError, 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-XiYoPKxd.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-S_Uo-Zy7.js";
4
+ import { A as ProfileUnsupportedError, C as SandboxOperation, D as splitInlineProfileSkills, E as splitInlineProfileFileMounts, M as isMaterializerHarness, N as materializeProfile, O as validateDeferredProfileFileMounts, S as ManagedProcessClient, T as materializeProfileFileMounts, _ 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 enforceWorkspacePlanSupport, k as HARNESS_LAUNCH_MATERIALIZE_OPTIONS, 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 SandboxOperationFailedError, y as getSandboxEventText } from "./sandbox-C3PqmwfU.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-D44qyFpy.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-C04xz1Dc.js";
7
- import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-Dg5W8sur.js";
8
- import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DoygSndq.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-BWD7-uaL.js";
7
+ import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-gkPDymqn.js";
8
+ import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-Bqk4jYQe.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-DwJ7AKx7.js";
@@ -13,7 +13,7 @@ import { t as downloadFile } from "./file-download-BO-Hmn3x.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-CTkHtpap.js";
15
15
  import { a as createSelectSeat, i as SeatSelectionError, o as gatewaySeatTransport } from "./select-seat-Dc7cQ8To.js";
16
- import { s as BlueprintSandboxClient } from "./tangle-DnRsdxKt.js";
16
+ import { s as BlueprintSandboxClient } from "./tangle-BP8F3ZN0.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,6 +318,144 @@ 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
+ "modal"
327
+ ];
328
+ const gpuLeaseProviderSchema = z.string().trim().toLowerCase().min(1).max(64).regex(/^[a-z][a-z0-9-]*$/);
329
+ const gpuAcceleratorKindSchema = z.string().trim().toLowerCase().min(1).max(128).regex(/^[a-z0-9][a-z0-9._-]*$/);
330
+ const gpuAcceleratorSchema = z.object({
331
+ kind: gpuAcceleratorKindSchema,
332
+ count: z.number().int().positive().default(1),
333
+ vramGb: z.number().positive().optional()
334
+ }).strict();
335
+ const gpuLeaseCommandSchema = z.object({
336
+ command: z.string().min(1).max(8192),
337
+ timeoutMs: z.number().int().positive().max(2147453647).optional(),
338
+ env: z.record(z.string(), z.string()).optional(),
339
+ cwd: z.string().min(1).max(2048).optional()
340
+ }).strict();
341
+ z.object({
342
+ refresh: z.enum(["true", "false"]).optional(),
343
+ acceleratorKind: gpuAcceleratorKindSchema.optional(),
344
+ acceleratorCount: z.coerce.number().pipe(gpuAcceleratorSchema.shape.count.unwrap()).optional(),
345
+ acceleratorVramGb: z.coerce.number().positive().optional()
346
+ }).strict();
347
+ z.object({
348
+ maxSpendUsd: z.number().positive().max(1e4).optional(),
349
+ maxLifetimeSeconds: z.number().int().positive().max(1440 * 60).optional()
350
+ }).strict().refine((value) => value.maxSpendUsd !== void 0 || value.maxLifetimeSeconds !== void 0, "Renewal requires a lifetime or spend cap");
351
+ const gpuLeaseOptionsSchema = z.object({
352
+ provider: gpuLeaseProviderSchema.optional(),
353
+ image: z.string().min(1).max(512).optional(),
354
+ env: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/), z.string()).optional(),
355
+ diskGb: z.number().int().positive().optional(),
356
+ volumeGb: z.number().int().nonnegative().optional(),
357
+ volumeMountPath: z.string().startsWith("/").max(2048).optional(),
358
+ region: z.string().min(1).max(128).optional(),
359
+ manifest: z.record(z.string(), z.unknown()).optional(),
360
+ command: z.array(z.string().max(8192)).min(1).max(256).optional(),
361
+ ports: z.array(z.number().int().min(1).max(65535)).max(32).optional(),
362
+ endpoint: z.object({
363
+ port: z.number().int().min(1).max(65535),
364
+ healthPath: z.string().regex(/^\/(?![/\\])/).refine((path) => ![
365
+ "\r",
366
+ "\n",
367
+ " "
368
+ ].some((char) => path.includes(char))).max(2048).optional()
369
+ }).strict().optional(),
370
+ allowSpot: z.boolean().optional(),
371
+ maxHourlyUsd: z.number().positive().optional(),
372
+ weights: z.object({
373
+ manifestSha: z.string().regex(/^[a-f0-9]{64}$/),
374
+ sizeBytes: z.number().int().positive().safe()
375
+ }).strict().optional(),
376
+ arms: z.array(z.unknown()).min(1).max(256).optional(),
377
+ maxSpendUsd: z.number().positive().max(1e4),
378
+ maxLifetimeSeconds: z.number().int().positive().max(1440 * 60),
379
+ idleTimeoutSeconds: z.number().int().positive().optional()
380
+ }).strict();
381
+ const gpuLeaseAttachSchema = gpuLeaseOptionsSchema.extend({ accelerator: gpuAcceleratorSchema });
382
+ const acceleratorSchema$1 = gpuAcceleratorSchema;
383
+ const providerSchema = gpuLeaseProviderSchema;
384
+ z.object({
385
+ ...gpuLeaseOptionsSchema.omit({ env: true }).shape,
386
+ id: z.string(),
387
+ projectRef: z.string(),
388
+ ownerUserId: z.string(),
389
+ productId: z.string().optional(),
390
+ provider: providerSchema,
391
+ providerLeaseId: z.string().optional(),
392
+ providerInstanceType: z.string().optional(),
393
+ workerUrl: z.string().optional(),
394
+ endpointUrl: z.string().optional(),
395
+ status: z.enum([
396
+ "provisioning",
397
+ "ready",
398
+ "detaching",
399
+ "destroyed",
400
+ "failed"
401
+ ]),
402
+ accelerator: acceleratorSchema$1,
403
+ providerCostPerHourUsd: z.number().optional(),
404
+ customerPricePerHourUsd: z.number().optional(),
405
+ estimatedProviderCostUsd: z.number().optional(),
406
+ estimatedCustomerCostUsd: z.number().optional(),
407
+ providerSelection: z.object({
408
+ strategy: z.enum([
409
+ "explicit",
410
+ "cheapest",
411
+ "ranked"
412
+ ]),
413
+ selectedProvider: providerSchema,
414
+ requestedProvider: providerSchema.optional(),
415
+ candidates: z.array(z.object({
416
+ provider: providerSchema,
417
+ accelerator: acceleratorSchema$1,
418
+ providerInstanceType: z.string().optional(),
419
+ region: z.string().optional(),
420
+ pricingSource: z.enum(["live", "configured"]).optional(),
421
+ providerCostPerHourUsd: z.number(),
422
+ customerPricePerHourUsd: z.number(),
423
+ maxLifetimeSeconds: z.number(),
424
+ estimatedProviderCostUsd: z.number(),
425
+ estimatedCustomerCostUsd: z.number()
426
+ })),
427
+ rejected: z.array(z.object({
428
+ provider: providerSchema,
429
+ error: z.string()
430
+ }))
431
+ }).optional(),
432
+ createdAt: z.string(),
433
+ updatedAt: z.string(),
434
+ readyAt: z.string().optional(),
435
+ startedAt: z.string().optional(),
436
+ lastUsedAt: z.string().optional(),
437
+ destroyedAt: z.string().optional(),
438
+ failure: z.string().optional(),
439
+ billing: z.object({
440
+ seconds: z.number(),
441
+ providerCostUsd: z.number(),
442
+ customerCostUsd: z.number(),
443
+ providerCostPerHourUsd: z.number(),
444
+ customerPricePerHourUsd: z.number(),
445
+ startedAt: z.string(),
446
+ stoppedAt: z.string()
447
+ }).optional()
448
+ });
449
+ //#endregion
450
+ //#region ../../../packages/runtime-contracts/dist/runtime-backend.js
451
+ /**
452
+ * The runtime a sandbox runs on, which a create names as `runtime`: a Docker
453
+ * container on the host kernel, or a Firecracker microVM with its own kernel.
454
+ * It is also what a provisioned host runs and the autoscaler buys.
455
+ */
456
+ const SANDBOX_RUNTIMES = ["docker", "firecracker"];
457
+ [...SANDBOX_RUNTIMES];
458
+ //#endregion
321
459
  //#region src/image.ts
322
460
  function isFetchClient(client) {
323
461
  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-D44qyFpy.js";
2
- import { i as fetchSandboxApi } from "../api-request-Dg5W8sur.js";
2
+ import { i as fetchSandboxApi } from "../api-request-gkPDymqn.js";
3
3
  import { n as verifyDownload } from "../file-download-BO-Hmn3x.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-NiHD_q3m.js";
1
+ import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-S_Uo-Zy7.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--g8UQ5TZ.js";
2
2
  import { r as agentProfileSchema } from "./profile-schema-B11dRfGB.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-NiHD_q3m.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-S_Uo-Zy7.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-D44qyFpy.js";
5
5
  import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-BsriwJ8L.js";
6
- import { n as SDK_TIMEOUTS } from "./api-request-Dg5W8sur.js";
6
+ import { n as SDK_TIMEOUTS } from "./api-request-gkPDymqn.js";
7
7
  import { c as awaitSdkResend, s as uploadChunked } from "./chunked-upload-ChZB-dYE.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-Dg5W8sur.js";
1
+ import "./api-request-gkPDymqn.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.265"
399
+ version: options.version ?? "1.0.266"
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-A0KLCNPz.js";
2
- import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-NiHD_q3m.js";
1
+ import { F as createAgentRunOutcomeTracker, I as deriveAgentResultOutcome, L as deriveAgentRunOutcome, R as projectAgentTerminalRecord, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController } from "./interactive-controller-llj6EdlZ.js";
2
+ import { n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-S_Uo-Zy7.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-D44qyFpy.js";
4
- import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-Dg5W8sur.js";
4
+ import { i as fetchSandboxApi, n as SDK_TIMEOUTS } from "./api-request-gkPDymqn.js";
5
5
  import { s as uploadChunked } from "./chunked-upload-ChZB-dYE.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-A0KLCNPz.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-llj6EdlZ.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--g8UQ5TZ.js";
3
3
  import { a as ProxySecretReceiptSchema$1, r as agentProfileSchema$1 } from "./profile-schema-B11dRfGB.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-NiHD_q3m.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-S_Uo-Zy7.js";
6
6
  import { t as canonicalAgentProfileDigest } from "./agent-execution-preparation-N1ksNIIJ.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-D44qyFpy.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-Dg5W8sur.js";
11
+ import { a as isReplayableBody, i as fetchSandboxApi, n as SDK_TIMEOUTS, o as rewrapResponse, t as IDEMPOTENT_METHODS } from "./api-request-gkPDymqn.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-ChZB-dYE.js";
14
14
  import { n as fetchWithKeepAlive, t as emitTiming } from "./keep-alive-fetch-sGVP8skk.js";
@@ -13825,144 +13825,6 @@ var SandboxEgressCapabilities = class extends SandboxTraceCapabilities {
13825
13825
  }
13826
13826
  };
13827
13827
  //#endregion
13828
- //#region ../../../packages/runtime-contracts/dist/gpu-lease.js
13829
- const GPU_LEASE_PROVIDER_NAMES = [
13830
- "runpod",
13831
- "vast-ai",
13832
- "lambda-labs",
13833
- "modal"
13834
- ];
13835
- const gpuLeaseProviderSchema = z.string().trim().toLowerCase().min(1).max(64).regex(/^[a-z][a-z0-9-]*$/);
13836
- const gpuAcceleratorKindSchema = z.string().trim().toLowerCase().min(1).max(128).regex(/^[a-z0-9][a-z0-9._-]*$/);
13837
- const gpuAcceleratorSchema = z.object({
13838
- kind: gpuAcceleratorKindSchema,
13839
- count: z.number().int().positive().default(1),
13840
- vramGb: z.number().positive().optional()
13841
- }).strict();
13842
- const gpuLeaseCommandSchema = z.object({
13843
- command: z.string().min(1).max(8192),
13844
- timeoutMs: z.number().int().positive().max(2147453647).optional(),
13845
- env: z.record(z.string(), z.string()).optional(),
13846
- cwd: z.string().min(1).max(2048).optional()
13847
- }).strict();
13848
- z.object({
13849
- refresh: z.enum(["true", "false"]).optional(),
13850
- acceleratorKind: gpuAcceleratorKindSchema.optional(),
13851
- acceleratorCount: z.coerce.number().pipe(gpuAcceleratorSchema.shape.count.unwrap()).optional(),
13852
- acceleratorVramGb: z.coerce.number().positive().optional()
13853
- }).strict();
13854
- z.object({
13855
- maxSpendUsd: z.number().positive().max(1e4).optional(),
13856
- maxLifetimeSeconds: z.number().int().positive().max(1440 * 60).optional()
13857
- }).strict().refine((value) => value.maxSpendUsd !== void 0 || value.maxLifetimeSeconds !== void 0, "Renewal requires a lifetime or spend cap");
13858
- const gpuLeaseOptionsSchema = z.object({
13859
- provider: gpuLeaseProviderSchema.optional(),
13860
- image: z.string().min(1).max(512).optional(),
13861
- env: z.record(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/), z.string()).optional(),
13862
- diskGb: z.number().int().positive().optional(),
13863
- volumeGb: z.number().int().nonnegative().optional(),
13864
- volumeMountPath: z.string().startsWith("/").max(2048).optional(),
13865
- region: z.string().min(1).max(128).optional(),
13866
- manifest: z.record(z.string(), z.unknown()).optional(),
13867
- command: z.array(z.string().max(8192)).min(1).max(256).optional(),
13868
- ports: z.array(z.number().int().min(1).max(65535)).max(32).optional(),
13869
- endpoint: z.object({
13870
- port: z.number().int().min(1).max(65535),
13871
- healthPath: z.string().regex(/^\/(?![/\\])/).refine((path) => ![
13872
- "\r",
13873
- "\n",
13874
- " "
13875
- ].some((char) => path.includes(char))).max(2048).optional()
13876
- }).strict().optional(),
13877
- allowSpot: z.boolean().optional(),
13878
- maxHourlyUsd: z.number().positive().optional(),
13879
- weights: z.object({
13880
- manifestSha: z.string().regex(/^[a-f0-9]{64}$/),
13881
- sizeBytes: z.number().int().positive().safe()
13882
- }).strict().optional(),
13883
- arms: z.array(z.unknown()).min(1).max(256).optional(),
13884
- maxSpendUsd: z.number().positive().max(1e4),
13885
- maxLifetimeSeconds: z.number().int().positive().max(1440 * 60),
13886
- idleTimeoutSeconds: z.number().int().positive().optional()
13887
- }).strict();
13888
- const gpuLeaseAttachSchema = gpuLeaseOptionsSchema.extend({ accelerator: gpuAcceleratorSchema });
13889
- const acceleratorSchema = gpuAcceleratorSchema;
13890
- const providerSchema = gpuLeaseProviderSchema;
13891
- z.object({
13892
- ...gpuLeaseOptionsSchema.omit({ env: true }).shape,
13893
- id: z.string(),
13894
- projectRef: z.string(),
13895
- ownerUserId: z.string(),
13896
- productId: z.string().optional(),
13897
- provider: providerSchema,
13898
- providerLeaseId: z.string().optional(),
13899
- providerInstanceType: z.string().optional(),
13900
- workerUrl: z.string().optional(),
13901
- endpointUrl: z.string().optional(),
13902
- status: z.enum([
13903
- "provisioning",
13904
- "ready",
13905
- "detaching",
13906
- "destroyed",
13907
- "failed"
13908
- ]),
13909
- accelerator: acceleratorSchema,
13910
- providerCostPerHourUsd: z.number().optional(),
13911
- customerPricePerHourUsd: z.number().optional(),
13912
- estimatedProviderCostUsd: z.number().optional(),
13913
- estimatedCustomerCostUsd: z.number().optional(),
13914
- providerSelection: z.object({
13915
- strategy: z.enum([
13916
- "explicit",
13917
- "cheapest",
13918
- "ranked"
13919
- ]),
13920
- selectedProvider: providerSchema,
13921
- requestedProvider: providerSchema.optional(),
13922
- candidates: z.array(z.object({
13923
- provider: providerSchema,
13924
- accelerator: acceleratorSchema,
13925
- providerInstanceType: z.string().optional(),
13926
- region: z.string().optional(),
13927
- pricingSource: z.enum(["live", "configured"]).optional(),
13928
- providerCostPerHourUsd: z.number(),
13929
- customerPricePerHourUsd: z.number(),
13930
- maxLifetimeSeconds: z.number(),
13931
- estimatedProviderCostUsd: z.number(),
13932
- estimatedCustomerCostUsd: z.number()
13933
- })),
13934
- rejected: z.array(z.object({
13935
- provider: providerSchema,
13936
- error: z.string()
13937
- }))
13938
- }).optional(),
13939
- createdAt: z.string(),
13940
- updatedAt: z.string(),
13941
- readyAt: z.string().optional(),
13942
- startedAt: z.string().optional(),
13943
- lastUsedAt: z.string().optional(),
13944
- destroyedAt: z.string().optional(),
13945
- failure: z.string().optional(),
13946
- billing: z.object({
13947
- seconds: z.number(),
13948
- providerCostUsd: z.number(),
13949
- customerCostUsd: z.number(),
13950
- providerCostPerHourUsd: z.number(),
13951
- customerPricePerHourUsd: z.number(),
13952
- startedAt: z.string(),
13953
- stoppedAt: z.string()
13954
- }).optional()
13955
- });
13956
- //#endregion
13957
- //#region ../../../packages/runtime-contracts/dist/runtime-backend.js
13958
- /**
13959
- * The runtime a sandbox runs on, which a create names as `runtime`: a Docker
13960
- * container on the host kernel, or a Firecracker microVM with its own kernel.
13961
- * It is also what a provisioned host runs and the autoscaler buys.
13962
- */
13963
- const SANDBOX_RUNTIMES = ["docker", "firecracker"];
13964
- [...SANDBOX_RUNTIMES];
13965
- //#endregion
13966
13828
  //#region ../../../packages/runtime-contracts/dist/egress-activity.js
13967
13829
  /**
13968
13830
  * The egress activity record a sandbox's proxy log is read into, shared by the
@@ -15146,4 +15008,4 @@ var SandboxInstance = class SandboxInstance extends SandboxEgressCapabilities {
15146
15008
  }
15147
15009
  };
15148
15010
  //#endregion
15149
- export { createRetryDelayMs as $, materializeProfileFileMounts as A, normalizeSandboxCreateReceipt as B, collectAgentResponseText as C, ManagedProcessClient as D, deleteSandbox as E, ProfileUnsupportedError as F, normalizeConnection as G, readFilesystemIncarnationTuple as H, enforceWorkspacePlanSupport as I, normalizeSandboxShape as J, normalizeEgressPolicyFields as K, isMaterializerHarness as L, splitInlineProfileSkills as M, validateDeferredProfileFileMounts as N, SandboxOperation as O, HARNESS_LAUNCH_MATERIALIZE_OPTIONS as P, awaitCreateResend as Q, materializeProfile 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, splitInlineProfileFileMounts as j, SandboxOperationFailedError 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 };
15011
+ export { isRateLimitCreateError as $, ProfileUnsupportedError as A, normalizeConnection as B, SandboxOperation as C, splitInlineProfileSkills as D, splitInlineProfileFileMounts 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, isMaterializerHarness as M, materializeProfile as N, validateDeferredProfileFileMounts as O, normalizeCaptureProof as P, isDeployWindowCreateError as Q, dateOf as R, ManagedProcessClient as S, materializeProfileFileMounts 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, enforceWorkspacePlanSupport as j, HARNESS_LAUNCH_MATERIALIZE_OPTIONS 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, SandboxOperationFailedError as w, deleteSandbox as x, getSandboxEventText as y, parseLifecycleTimes 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-Dg5W8sur.js";
2
+ import { i as fetchSandboxApi } from "../api-request-gkPDymqn.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-DnRsdxKt.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-BP8F3ZN0.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 { H as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-XiYoPKxd.js";
1
+ import { L as readFilesystemIncarnationTuple, n as createSandboxInstanceFromResponse } from "./sandbox-C3PqmwfU.js";
2
2
  import { a as readResponseJson } from "./errors-D44qyFpy.js";
3
- import { i as fetchSandboxApi } from "./api-request-Dg5W8sur.js";
3
+ import { i as fetchSandboxApi } from "./api-request-gkPDymqn.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.265",
3
+ "version": "1.0.266",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
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
+ "@repo/shared": "0.0.0",
156
157
  "@products/sandbox-test-utils": "0.0.0",
157
158
  "@tangle-network/agent-profile-materialize": "0.27.1",
158
159
  "@tangle-network/cli-agent-registry": "0.15.0",
159
- "@repo/shared": "0.0.0",
160
160
  "@tangle-network/runtime-contracts": "0.20.0"
161
161
  },
162
162
  "tangleRelease": {
163
- "sourceSha": "0d9fbfec1a3603e0c82a92329879e69ba4e4ccce",
164
- "mergedAt": "2026-11-06T20:30:30-08:00"
163
+ "sourceSha": "a3a99d1827e0146e909826d5d04c2582c064ba8a",
164
+ "mergedAt": "2026-11-06T20:44:29-08:00"
165
165
  },
166
166
  "scripts": {
167
167
  "build": "node scripts/build-dist.mjs && bash scripts/verify-dist.sh",