@tangle-network/sandbox 1.0.28 → 1.0.30

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
1
  import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-CPdKHcQ-.js";
2
2
  import { E as assertCurrentBackendType } from "../interactive-controller-B0g65BjC.js";
3
- import { t as SandboxInstance } from "../sandbox-NnTFfn1A.js";
3
+ import { t as SandboxInstance } from "../sandbox-qSGg5R-M.js";
4
4
  import { C as StateError, E as ValidationError, g as NotFoundError } from "../errors-BuPtQ91K.js";
5
- import { t as Sandbox } from "../client-BOoNWvIL.js";
5
+ import { t as Sandbox } from "../client-DEOaV2DX.js";
6
6
  import { z } from "zod";
7
7
  //#region src/agent/instances.ts
8
8
  const managers = /* @__PURE__ */ new WeakMap();
@@ -1,6 +1,6 @@
1
1
  import { D as foldModelRoutingFields, E as assertCurrentBackendType, M as withProfileHarness, N as withoutCreateOnlyModelFields, S as encodePromptForWire, T as applyRequestedModel, V as backendTypeSchema, k as normalizeRuntimeBackendConfig, o as requestInteractiveSessionToken } from "./interactive-controller-B0g65BjC.js";
2
2
  import { r as agentProfileSchema } from "./profile-schema-1WmjXjE9.js";
3
- import { A as normalizeStartupDiagnostics, D as isRetryableProfileFileMaterializeFailure, E as validateDeferredProfileFileMounts, M as normalizeConnection, N as normalizeEgressPolicyFields, O as normalizeCaptureProof, P as normalizeSandboxShape, T as splitInlineProfileSkills, j as parseStopPhase, k as normalizeSandboxCreateReceipt, n as createSandboxInstanceFromResponse, o as exportTraceBundle, w as splitInlineProfileFileMounts } from "./sandbox-NnTFfn1A.js";
3
+ import { A as normalizeStartupDiagnostics, D as isRetryableProfileFileMaterializeFailure, E as validateDeferredProfileFileMounts, M as normalizeConnection, N as normalizeEgressPolicyFields, O as normalizeCaptureProof, P as normalizeSandboxShape, T as splitInlineProfileSkills, j as parseStopPhase, k as normalizeSandboxCreateReceipt, n as createSandboxInstanceFromResponse, o as exportTraceBundle, w as splitInlineProfileFileMounts } from "./sandbox-qSGg5R-M.js";
4
4
  import { E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, c as CompliancePlacementError, f as GpuProviderNotConfiguredError, g as NotFoundError, h as NetworkError, i as readResponseJson, m as NON_RETRYABLE_CREATE_QUOTA_REASONS, n as parseErrorResponse, r as parseResponseError, x as SandboxError, y as QuotaError } from "./errors-BuPtQ91K.js";
5
5
  import { n as combineAbortSignals } from "./abort-signal-JVaAyNMP.js";
6
6
  import { t as fetchSandboxApi } from "./api-request-B7cnX489.js";
@@ -1,5 +1,5 @@
1
1
  import { r as agentProfileSchema } from "./profile-schema-1WmjXjE9.js";
2
- import { F as canonicalAgentProfileDigest } from "./sandbox-NnTFfn1A.js";
2
+ import { F as canonicalAgentProfileDigest } from "./sandbox-qSGg5R-M.js";
3
3
  import { E as ValidationError, s as CapabilityError, x as SandboxError } from "./errors-BuPtQ91K.js";
4
4
  import { t as awaitWithAbort } from "./abort-signal-JVaAyNMP.js";
5
5
  import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-DtuQ8T6N.js";
package/dist/core.js CHANGED
@@ -1,7 +1,7 @@
1
- import { b as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-NnTFfn1A.js";
1
+ import { b as ManagedProcessClient, r as WorkspaceImages, t as SandboxInstance } from "./sandbox-qSGg5R-M.js";
2
2
  import { C as StateError, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, d as FileWriteConflictError, g as NotFoundError, h as NetworkError, s as CapabilityError, v as ProfileFileMountPathError, x as SandboxError, y as QuotaError } from "./errors-BuPtQ91K.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-BOoNWvIL.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-DEOaV2DX.js";
4
4
  import { i as profileChannelReference, r as lineInstanceKey, t as LinesClient } from "./lines-CmiqZwyo.js";
5
5
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
6
- import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-Bu1eaKce.js";
6
+ import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-DIRJ6rOS.js";
7
7
  export { AuthError, CapabilityError, FileWriteConflictError, HostedInstance, ISOLATED_CREATION_ATTESTATION_VERSION, InstanceRestartingError, InstancesClient, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, LinesClient, ManagedProcessClient, NetworkError, NotFoundError, PartialFailureError, ProfileFileMountPathError, PublicTemplatePublishError, PublicTemplatesClient, QuotaError, Sandbox, SandboxError, SandboxInstance, SeatSelectionError, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, createSelectSeat, gatewaySeatTransport, isBackendRegistryInteractionKind, lineInstanceKey, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseLineApplicationRequest, parseLineApplicationResult, profileChannelReference, sandboxFailureKind };
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
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-B0g65BjC.js";
2
2
  import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, k as agentInteractiveSessionPromptRequestDigest, l as createInteractiveControlHolderId, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, s as InteractiveSessionNotRunningError, t as BrowserInteractiveSessionControlController, u as interactiveSessionIdentityDigest } from "./browser-interactive-control-controller-BujauBOG.js";
3
3
  import { i as SANDBOX_SIZE_PRESET_NAMES, r as agentProfileSchema, t as agentProfileConfidentialSchema } from "./profile-schema-1WmjXjE9.js";
4
- import { C as materializeProfileFileMounts, E as validateDeferredProfileFileMounts, S as SandboxOperationFailedError, T as splitInlineProfileSkills, _ as collectAgentResponseText, a as buildTraceExportPayload, b as ManagedProcessClient, c as toOtelJson, d as InteractiveSessionHandle, f as InteractiveTerminalFrameLog, g as collectAgentFinalMessageText, h as applySandboxEventText, i as MAX_EGRESS_DENIALS_LIMIT, l as SandboxTaskSession, m as createInteractiveTerminalSession, o as exportTraceBundle, p as createInteractiveTerminalCapture, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as getSandboxEventText, w as splitInlineProfileFileMounts, x as SandboxOperation, y as isToolBearingEvent } from "./sandbox-NnTFfn1A.js";
4
+ import { C as materializeProfileFileMounts, E as validateDeferredProfileFileMounts, S as SandboxOperationFailedError, T as splitInlineProfileSkills, _ as collectAgentResponseText, a as buildTraceExportPayload, b as ManagedProcessClient, c as toOtelJson, d as InteractiveSessionHandle, f as InteractiveTerminalFrameLog, g as collectAgentFinalMessageText, h as applySandboxEventText, i as MAX_EGRESS_DENIALS_LIMIT, l as SandboxTaskSession, m as createInteractiveTerminalSession, o as exportTraceBundle, p as createInteractiveTerminalCapture, r as WorkspaceImages, s as otelTraceIdForTangleTrace, t as SandboxInstance, u as SandboxSession, v as getSandboxEventText, w as splitInlineProfileFileMounts, x as SandboxOperation, y as isToolBearingEvent } from "./sandbox-qSGg5R-M.js";
5
5
  import { C as StateError, E as ValidationError, S as ServerError, T as TimeoutError, _ as PartialFailureError, a as AuthError, b as ResumeEnvRequiredError, c as CompliancePlacementError, d as FileWriteConflictError, f as GpuProviderNotConfiguredError, g as NotFoundError, h as NetworkError, l as EdgeNotReadyError, o as BranchFanoutExceedsHostError, p as KeyBudgetExhaustedError, s as CapabilityError, t as TerminalStreamError, u as EgressProxyRecoveryError, v as ProfileFileMountPathError, w as StreamInterruptedError, x as SandboxError, y as QuotaError } from "./errors-BuPtQ91K.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-BOoNWvIL.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-DEOaV2DX.js";
7
7
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-Di7sGcJ4.js";
8
8
  import { t as parseSSEStream } from "./sse-parser-B7uNzlUG.js";
9
9
  import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-CmiqZwyo.js";
10
10
  import { PublicTemplatePublishError, PublicTemplatesClient } from "./public-templates.js";
11
- import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-Bu1eaKce.js";
12
- import { s as TangleSandboxClient } from "./tangle-Dep5zD65.js";
11
+ import { a as LINE_APPLICATION_REPLY_MAX_CHARS, c as parseLineApplicationResult, i as gatewaySeatTransport, l as sandboxFailureKind, n as SeatSelectionError, o as LINE_APPLICATION_REQUEST_MAX_BYTES, r as createSelectSeat, s as parseLineApplicationRequest, t as ISOLATED_CREATION_ATTESTATION_VERSION } from "./core-DIRJ6rOS.js";
12
+ import { s as TangleSandboxClient } from "./tangle-Deo7EJ3u.js";
13
13
  import { z } from "zod";
14
14
  //#region ../../../packages/runtime-contracts/dist/model-key-proxy.js
15
15
  /**
@@ -2881,7 +2881,7 @@ var SandboxOperationFailedError = class extends SandboxError {
2881
2881
  this.operation = operation;
2882
2882
  }
2883
2883
  };
2884
- function isRecord$2(value) {
2884
+ function isRecord$1(value) {
2885
2885
  return value !== null && typeof value === "object" && !Array.isArray(value);
2886
2886
  }
2887
2887
  const KINDS = [
@@ -2896,7 +2896,7 @@ const STATES = [
2896
2896
  "failed"
2897
2897
  ];
2898
2898
  function parseSnapshot(value) {
2899
- if (!isRecord$2(value) || typeof value.snapshotId !== "string") return;
2899
+ if (!isRecord$1(value) || typeof value.snapshotId !== "string") return;
2900
2900
  return {
2901
2901
  snapshotId: value.snapshotId,
2902
2902
  createdAt: new Date(typeof value.createdAt === "string" ? value.createdAt : Date.now()),
@@ -2918,11 +2918,11 @@ function parseSandboxOperation(value, expected) {
2918
2918
  return info;
2919
2919
  }
2920
2920
  function parseOperationBody(value) {
2921
- if (!isRecord$2(value) || typeof value.id !== "string" || typeof value.sandboxId !== "string" || typeof value.statusUrl !== "string" || typeof value.acceptedAt !== "string" || !KINDS.includes(value.kind) || !STATES.includes(value.state)) throw contractViolation(`The API answered an operation that does not match the contract: ${JSON.stringify(value).slice(0, 200)}`);
2922
- const result = isRecord$2(value.result) ? value.result : void 0;
2921
+ if (!isRecord$1(value) || typeof value.id !== "string" || typeof value.sandboxId !== "string" || typeof value.statusUrl !== "string" || typeof value.acceptedAt !== "string" || !KINDS.includes(value.kind) || !STATES.includes(value.state)) throw contractViolation(`The API answered an operation that does not match the contract: ${JSON.stringify(value).slice(0, 200)}`);
2922
+ const result = isRecord$1(value.result) ? value.result : void 0;
2923
2923
  const snapshot = parseSnapshot(result?.snapshot);
2924
2924
  const durability = result?.durability === "local" || result?.durability === "remote" ? result.durability : void 0;
2925
- const error = isRecord$2(value.error) ? value.error : void 0;
2925
+ const error = isRecord$1(value.error) ? value.error : void 0;
2926
2926
  return {
2927
2927
  id: value.id,
2928
2928
  kind: value.kind,
@@ -2935,7 +2935,7 @@ function parseOperationBody(value) {
2935
2935
  ...result ? { result: {
2936
2936
  ...durability ? { durability } : {},
2937
2937
  ...snapshot ? { snapshot } : {},
2938
- ...isRecord$2(result.sandbox) ? { sandbox: result.sandbox } : {},
2938
+ ...isRecord$1(result.sandbox) ? { sandbox: result.sandbox } : {},
2939
2939
  ...result.deleted === true ? { deleted: true } : {}
2940
2940
  } } : {},
2941
2941
  ...error && typeof error.code === "string" && typeof error.message === "string" ? { error: {
@@ -4371,7 +4371,7 @@ function timerMsViolation(value) {
4371
4371
  * `data.properties.part.text` when replayed by the session
4372
4372
  * endpoint.
4373
4373
  */
4374
- function isRecord$1(v) {
4374
+ function isRecord(v) {
4375
4375
  return typeof v === "object" && v !== null;
4376
4376
  }
4377
4377
  /** The first candidate that is actually a string. Using `typeof` rather than a
@@ -4384,9 +4384,9 @@ function firstString(...candidates) {
4384
4384
  /** Snapshot text wins when a runtime sends both its snapshot and delta. */
4385
4385
  function messageTextUpdate(event) {
4386
4386
  if (event.type !== "message.part.updated") return void 0;
4387
- const data = isRecord$1(event.data) ? event.data : {};
4388
- const properties = isRecord$1(data.properties) ? data.properties : void 0;
4389
- const part = isRecord$1(data.part) ? data.part : isRecord$1(properties?.part) ? properties.part : void 0;
4387
+ const data = isRecord(event.data) ? event.data : {};
4388
+ const properties = isRecord(data.properties) ? data.properties : void 0;
4389
+ const part = isRecord(data.part) ? data.part : isRecord(properties?.part) ? properties.part : void 0;
4390
4390
  if (part?.type !== "text") return void 0;
4391
4391
  const snapshot = firstString(part.text, part.content);
4392
4392
  if (snapshot !== void 0) return {
@@ -4400,7 +4400,7 @@ function messageTextUpdate(event) {
4400
4400
  };
4401
4401
  }
4402
4402
  function getSandboxEventText(event) {
4403
- const data = isRecord$1(event.data) ? event.data : {};
4403
+ const data = isRecord(event.data) ? event.data : {};
4404
4404
  if (event.type === "result") return firstString(data.finalText, data.response, data.output, data.content, data.text);
4405
4405
  if (event.type === "token") return firstString(data.value, data.delta, data.text, data.content);
4406
4406
  if (event.type !== "message.part.updated") return;
@@ -4487,11 +4487,11 @@ function namesATool(type) {
4487
4487
  }
4488
4488
  function isToolBearingEvent(event) {
4489
4489
  if (namesATool(event.type)) return true;
4490
- const data = isRecord$1(event.data) ? event.data : void 0;
4490
+ const data = isRecord(event.data) ? event.data : void 0;
4491
4491
  if (!data) return false;
4492
4492
  if (event.type === "raw" && typeof data.type === "string") return namesATool(data.type);
4493
- const properties = isRecord$1(data.properties) ? data.properties : void 0;
4494
- const part = isRecord$1(data.part) ? data.part : isRecord$1(properties?.part) ? properties.part : void 0;
4493
+ const properties = isRecord(data.properties) ? data.properties : void 0;
4494
+ const part = isRecord(data.part) ? data.part : isRecord(properties?.part) ? properties.part : void 0;
4495
4495
  return typeof part?.type === "string" && namesATool(part.type);
4496
4496
  }
4497
4497
  /**
@@ -4547,9 +4547,9 @@ function collectAgentFinalMessageText(events) {
4547
4547
  for (let i = lastToolAt + 1; i < end; i++) {
4548
4548
  const event = events[i];
4549
4549
  if (event.type !== "message.part.updated") continue;
4550
- const data = isRecord$1(event.data) ? event.data : {};
4551
- const properties = isRecord$1(data.properties) ? data.properties : void 0;
4552
- const part = isRecord$1(data.part) ? data.part : isRecord$1(properties?.part) ? properties.part : void 0;
4550
+ const data = isRecord(event.data) ? event.data : {};
4551
+ const properties = isRecord(data.properties) ? data.properties : void 0;
4552
+ const part = isRecord(data.part) ? data.part : isRecord(properties?.part) ? properties.part : void 0;
4553
4553
  if (part?.type !== "text") continue;
4554
4554
  const update = messageTextUpdate(event);
4555
4555
  const text = update?.text;
@@ -10476,6 +10476,163 @@ var SandboxInteractiveTerminalOperations = class {
10476
10476
  });
10477
10477
  }
10478
10478
  };
10479
+ Object.freeze({
10480
+ BUILD_CONTEXT_NOT_FOUND: "Build context or Dockerfile not found",
10481
+ CONTEXT_ARCHIVE_TOO_LARGE: "Build context archive exceeds the configured size limit",
10482
+ CONTEXT_TOO_LARGE: "Build context exceeds the configured size limit",
10483
+ CONTEXT_TOO_MANY_ENTRIES: "Build context exceeds the configured entry limit",
10484
+ DOCKERFILE_NOT_FOUND: "Build context or Dockerfile not found",
10485
+ DOCKERFILE_TOO_LARGE: "Dockerfile exceeds the configured size limit",
10486
+ DOCKERIGNORE_TOO_LARGE: ".dockerignore exceeds the configured size limit",
10487
+ DRIVER_CAPABILITY_MISSING: "This sandbox driver cannot publish workspace images",
10488
+ DURABLE_IMAGE_PUBLICATION_UNAVAILABLE: "Durable image publication is unavailable",
10489
+ FILESYSTEM_INCARNATION_CHANGED: "Sandbox filesystem changed; refresh before publishing",
10490
+ FILESYSTEM_TRANSITIONING: "Sandbox filesystem is transitioning",
10491
+ IDEMPOTENCY_KEY_REUSED: "Idempotency key was already used for different inputs",
10492
+ IMAGE_ARCHIVE_TOO_LARGE: "Image archive exceeds the configured size limit",
10493
+ IMAGE_BUILD_CANCELLED: "Workspace image build was cancelled",
10494
+ IMAGE_BUILD_FAILED: "Workspace image build failed",
10495
+ IMAGE_BUILD_OUTPUT_TOO_LARGE: "Workspace image build produced too much output",
10496
+ IMAGE_BUILD_TIMEOUT: "Workspace image build timed out",
10497
+ IMAGE_PUBLISH_CANCELLED: "Image publication was cancelled",
10498
+ IMAGE_PUBLISH_FAILED: "Image publication failed",
10499
+ IMAGE_PUBLISH_OUTCOME_UNKNOWN: "Image publication could not be confirmed",
10500
+ IMAGE_PUBLISH_TIMEOUT: "Image publication timed out",
10501
+ IMAGE_PUBLISH_UNAVAILABLE: "Image publication is unavailable",
10502
+ IN_BOX_DOCKER_UNAVAILABLE: "In-box Docker is disabled. Build and push the image outside this sandbox, then use its registry reference.",
10503
+ INVALID_CONTEXT_ARCHIVE: "Build context archive is invalid",
10504
+ INVALID_CONTEXT_METADATA: "Sidecar returned invalid workspace context metadata",
10505
+ INVALID_DOCKERFILE: "Dockerfile is invalid",
10506
+ INVALID_DOCKERIGNORE: ".dockerignore is invalid",
10507
+ INVALID_IMAGE_ARCHIVE: "Image archive is invalid",
10508
+ INVALID_IMAGE_METADATA: "Image metadata is invalid",
10509
+ INVALID_PATH: "Invalid workspace build path",
10510
+ INVALID_REPOSITORY: "Invalid image repository",
10511
+ INVALID_REQUEST: "Invalid image request",
10512
+ PROJECT_NOT_FOUND: "Sandbox not found",
10513
+ PROTECTED_BUILD_PATH: "Build paths must not use protected workspace state",
10514
+ REGISTRY_AUTH_FAILED: "Registry authentication failed",
10515
+ REGISTRY_AUTH_UNSUPPORTED: "Registry returned an unsupported authentication challenge",
10516
+ REGISTRY_DIGEST_MISMATCH: "Registry returned an unexpected digest",
10517
+ REGISTRY_DIGEST_MISSING: "Registry did not return an image digest",
10518
+ REGISTRY_REQUEST_FAILED: "Registry request failed",
10519
+ REGISTRY_RESPONSE_TOO_LARGE: "Registry response exceeded the allowed size",
10520
+ REGISTRY_TAG_EXISTS: "Image publication tag already exists",
10521
+ REGISTRY_THROTTLED: "Registry temporarily rejected the push",
10522
+ REGISTRY_UPLOAD_INVALID: "Registry returned an invalid upload location",
10523
+ ROOTLESS_DOCKER_UNAVAILABLE: "Rootless Docker is unavailable",
10524
+ SANDBOX_IDENTITY_MISMATCH: "Sandbox identity does not match the request",
10525
+ SANDBOX_IMAGE_BUILD_FAILED: "Sandbox image build failed",
10526
+ SANDBOX_IMAGE_IDENTITY_MISMATCH: "Sandbox image identity does not match the request",
10527
+ SANDBOX_IMAGE_METADATA_MISMATCH: "Sandbox image metadata does not match the archive",
10528
+ SANDBOX_NOT_FOUND: "Sandbox not found",
10529
+ SANDBOX_NOT_READY: "Sandbox must be ready to publish its workspace",
10530
+ SANDBOX_NOT_RUNNING: "Sandbox must be running to publish its workspace",
10531
+ SIDECAR_NOT_READY: "Sandbox sidecar is not reachable",
10532
+ UNSAFE_REGISTRY_HOST: "Registry host is not allowed",
10533
+ UNSAFE_REGISTRY_REDIRECT: "Registry attempted an unsafe redirect",
10534
+ WORKSPACE_IMAGE_CAPACITY_EXCEEDED: "Image publication capacity is currently exhausted",
10535
+ WORKSPACE_IMAGE_BUILDER_BUSY: "Workspace image builder is busy",
10536
+ WORKSPACE_IMAGE_BUILDER_UNAVAILABLE: "Workspace image builder is unavailable",
10537
+ WORKSPACE_IMAGE_OPERATION_IN_PROGRESS: "Another image publication is already active for this sandbox"
10538
+ });
10539
+ const REPOSITORY_COMPONENT_RE = /^[a-z0-9]+(?:(?:[._]|__|[-]+)[a-z0-9]+)*$/;
10540
+ const REGISTRY_HOST_RE = /^(?:localhost|(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?))*)(?::\d{1,5})?$/;
10541
+ function hasControlCharacters(value) {
10542
+ for (const character of value) {
10543
+ const code = character.charCodeAt(0);
10544
+ if (code <= 31 || code === 127) return true;
10545
+ }
10546
+ return false;
10547
+ }
10548
+ const workspaceRelativePathSchema = z.string().min(1).max(512).refine((value) => !value.startsWith("/"), { message: "path must be workspace-relative" }).refine((value) => !value.includes("\\"), { message: "path must use POSIX separators" }).refine((value) => !hasControlCharacters(value), { message: "path must not contain control characters" }).refine((value) => value === "." || value.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== ".."), { message: "path must not contain empty, dot, or parent segments" });
10549
+ function parseWorkspaceImageRepository(value) {
10550
+ if (value.length === 0 || value.length > 512 || value.includes("://") || value.includes("@") || hasControlCharacters(value)) return null;
10551
+ const segments = value.split("/");
10552
+ if (segments.length < 2) return null;
10553
+ const registryHost = segments.shift();
10554
+ if (!registryHost || !REGISTRY_HOST_RE.test(registryHost)) return null;
10555
+ if (registryHost !== "localhost" && !registryHost.includes(".") && !registryHost.includes(":")) return null;
10556
+ if (segments.some((segment) => !REPOSITORY_COMPONENT_RE.test(segment))) return null;
10557
+ const portIndex = registryHost.lastIndexOf(":");
10558
+ if (portIndex !== -1) {
10559
+ const port = Number.parseInt(registryHost.slice(portIndex + 1), 10);
10560
+ if (!Number.isInteger(port) || port < 1 || port > 65535) return null;
10561
+ }
10562
+ return {
10563
+ registryHost,
10564
+ repositoryPath: segments.join("/")
10565
+ };
10566
+ }
10567
+ const workspaceImageRepositorySchema = z.string().min(1).max(512).refine((value) => parseWorkspaceImageRepository(value) !== null, { message: "repository must include a registry host and lowercase path, without a scheme, tag, or digest" });
10568
+ const workspaceImageRegistryAuthSchema = z.object({
10569
+ username: z.string().min(1).max(256).refine((value) => !hasControlCharacters(value), { message: "registry username must not contain control characters" }),
10570
+ password: z.string().min(1).max(16 * 1024)
10571
+ }).strict();
10572
+ const workspaceImagePlatformSchema = z.enum(["linux/amd64", "linux/arm64"]);
10573
+ const workspaceImagePublishPublicRequestSchema = z.object({
10574
+ contextPath: workspaceRelativePathSchema.default("."),
10575
+ dockerfilePath: workspaceRelativePathSchema.default("Dockerfile"),
10576
+ repository: workspaceImageRepositorySchema,
10577
+ auth: workspaceImageRegistryAuthSchema,
10578
+ platform: workspaceImagePlatformSchema.optional()
10579
+ }).strict().extend({ filesystemIncarnationId: z.string().uuid() });
10580
+ const workspaceImageOperationIdSchema = z.string().min(16).max(128).regex(/^[A-Za-z0-9_-]+$/, { message: "operationId must contain only letters, numbers, underscores, and dashes" });
10581
+ workspaceImagePublishPublicRequestSchema.extend({
10582
+ operationId: workspaceImageOperationIdSchema,
10583
+ projectRef: z.string().min(1).max(128)
10584
+ }).pick({
10585
+ operationId: true,
10586
+ projectRef: true,
10587
+ filesystemIncarnationId: true,
10588
+ contextPath: true,
10589
+ dockerfilePath: true
10590
+ });
10591
+ const nonNegativeSafeIntegerSchema = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
10592
+ const workspaceImageExposedPortSchema = z.object({
10593
+ port: z.number().int().min(1).max(65535),
10594
+ protocol: z.enum([
10595
+ "tcp",
10596
+ "udp",
10597
+ "sctp"
10598
+ ])
10599
+ }).strict();
10600
+ const workspaceImageExposedPortsSchema = z.array(workspaceImageExposedPortSchema).max(64).superRefine((ports, context) => {
10601
+ const seen = /* @__PURE__ */ new Set();
10602
+ for (const port of ports) {
10603
+ const identity = `${port.port}/${port.protocol}`;
10604
+ if (seen.has(identity)) {
10605
+ context.addIssue({
10606
+ code: z.ZodIssueCode.custom,
10607
+ message: "exposed ports must be unique"
10608
+ });
10609
+ return;
10610
+ }
10611
+ seen.add(identity);
10612
+ }
10613
+ });
10614
+ const workspaceImagePublishResultSchema = z.object({
10615
+ image: z.string().min(1).max(1024),
10616
+ taggedImage: z.string().min(1).max(1024),
10617
+ digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),
10618
+ imageId: z.string().regex(/^sha256:[a-f0-9]{64}$/),
10619
+ sizeBytes: nonNegativeSafeIntegerSchema,
10620
+ contextBytes: nonNegativeSafeIntegerSchema,
10621
+ contextEntries: nonNegativeSafeIntegerSchema,
10622
+ buildDurationMs: nonNegativeSafeIntegerSchema,
10623
+ pushDurationMs: nonNegativeSafeIntegerSchema,
10624
+ exposedPorts: workspaceImageExposedPortsSchema
10625
+ }).strict();
10626
+ const WORKSPACE_IMAGE_TAG_PATTERN = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/;
10627
+ /** Parse a publication result and bind both image references to its request. */
10628
+ function parseWorkspaceImagePublishResultForRepository(value, repository) {
10629
+ const parsed = workspaceImagePublishResultSchema.safeParse(value);
10630
+ if (!parsed.success) return void 0;
10631
+ const result = parsed.data;
10632
+ const tagPrefix = `${repository}:`;
10633
+ if (result.image !== `${repository}@${result.digest}` || !result.taggedImage.startsWith(tagPrefix) || !WORKSPACE_IMAGE_TAG_PATTERN.test(result.taggedImage.slice(tagPrefix.length))) return;
10634
+ return result;
10635
+ }
10479
10636
  //#endregion
10480
10637
  //#region src/workspace-images.ts
10481
10638
  const DEFAULT_WORKSPACE_IMAGE_CLIENT_TIMEOUT_MS = 99e4;
@@ -10483,7 +10640,6 @@ const WORKSPACE_IMAGE_REQUEST_ATTEMPTS = 2;
10483
10640
  const MAX_WORKSPACE_IMAGE_RESPONSE_BYTES = 64 * 1024;
10484
10641
  const MAX_TIMER_DELAY_MS = 2147483647;
10485
10642
  const IDEMPOTENCY_KEY_PATTERN = /^[A-Za-z0-9_-]{16,128}$/;
10486
- const MAX_WORKSPACE_IMAGE_EXPOSED_PORTS = 64;
10487
10643
  function createIdempotencyKey() {
10488
10644
  const crypto = globalThis.crypto;
10489
10645
  if (crypto?.randomUUID) return crypto.randomUUID();
@@ -10551,63 +10707,6 @@ async function readBoundedResponseText(response, signal) {
10551
10707
  }
10552
10708
  return new TextDecoder().decode(body);
10553
10709
  }
10554
- const WORKSPACE_IMAGE_RESULT_KEYS = [
10555
- "image",
10556
- "taggedImage",
10557
- "digest",
10558
- "imageId",
10559
- "sizeBytes",
10560
- "contextBytes",
10561
- "contextEntries",
10562
- "buildDurationMs",
10563
- "pushDurationMs",
10564
- "exposedPorts"
10565
- ];
10566
- const SHA256_DIGEST_PATTERN = /^sha256:[a-f0-9]{64}$/;
10567
- const IMAGE_TAG_PATTERN = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/;
10568
- function isRecord(value) {
10569
- return typeof value === "object" && value !== null && !Array.isArray(value);
10570
- }
10571
- function isNonNegativeSafeInteger(value) {
10572
- return Number.isSafeInteger(value) && Number(value) >= 0;
10573
- }
10574
- function parseExposedPorts(value) {
10575
- if (!Array.isArray(value) || value.length > MAX_WORKSPACE_IMAGE_EXPOSED_PORTS) return;
10576
- const ports = [];
10577
- const seen = /* @__PURE__ */ new Set();
10578
- for (const entry of value) {
10579
- if (!isRecord(entry) || Object.keys(entry).length !== 2) return void 0;
10580
- const { port, protocol } = entry;
10581
- if (typeof port !== "number" || !Number.isSafeInteger(port) || port < 1 || port > 65535 || protocol !== "tcp" && protocol !== "udp" && protocol !== "sctp") return;
10582
- const identity = `${port}/${protocol}`;
10583
- if (seen.has(identity)) return void 0;
10584
- seen.add(identity);
10585
- ports.push({
10586
- port,
10587
- protocol
10588
- });
10589
- }
10590
- return ports;
10591
- }
10592
- function parseWorkspaceImagePublishResult(value, repository) {
10593
- if (!isRecord(value)) return void 0;
10594
- if (Object.keys(value).length !== WORKSPACE_IMAGE_RESULT_KEYS.length || !WORKSPACE_IMAGE_RESULT_KEYS.every((key) => Object.hasOwn(value, key))) return;
10595
- const { image, taggedImage, digest, imageId, sizeBytes, contextBytes, contextEntries, buildDurationMs, pushDurationMs, exposedPorts } = value;
10596
- const parsedExposedPorts = parseExposedPorts(exposedPorts);
10597
- if (typeof image !== "string" || typeof taggedImage !== "string" || typeof digest !== "string" || typeof imageId !== "string" || !SHA256_DIGEST_PATTERN.test(digest) || !SHA256_DIGEST_PATTERN.test(imageId) || image !== `${repository}@${digest}` || !taggedImage.startsWith(`${repository}:`) || !IMAGE_TAG_PATTERN.test(taggedImage.slice(repository.length + 1)) || !isNonNegativeSafeInteger(sizeBytes) || !isNonNegativeSafeInteger(contextBytes) || !isNonNegativeSafeInteger(contextEntries) || !isNonNegativeSafeInteger(buildDurationMs) || !isNonNegativeSafeInteger(pushDurationMs) || !parsedExposedPorts) return;
10598
- return {
10599
- image,
10600
- taggedImage,
10601
- digest,
10602
- imageId,
10603
- sizeBytes,
10604
- contextBytes,
10605
- contextEntries,
10606
- buildDurationMs,
10607
- pushDurationMs,
10608
- exposedPorts: parsedExposedPorts
10609
- };
10610
- }
10611
10710
  /** Builds and publishes the current sandbox workspace from trusted hosts. */
10612
10711
  var WorkspaceImages = class {
10613
10712
  constructor(client, sandboxId, ensureRunning, filesystemIncarnationId) {
@@ -10683,7 +10782,7 @@ var WorkspaceImages = class {
10683
10782
  if (error.code === "IMAGE_PUBLISH_OUTCOME_UNKNOWN" && attempt < WORKSPACE_IMAGE_REQUEST_ATTEMPTS && Date.now() < deadline) continue;
10684
10783
  throw error;
10685
10784
  }
10686
- const parsed = parseWorkspaceImagePublishResult((() => {
10785
+ const parsed = parseWorkspaceImagePublishResultForRepository((() => {
10687
10786
  try {
10688
10787
  return JSON.parse(responseText);
10689
10788
  } catch {
@@ -1,2 +1,2 @@
1
- import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-Dep5zD65.js";
1
+ import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-Deo7EJ3u.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
@@ -1,4 +1,4 @@
1
- import { n as createSandboxInstanceFromResponse } from "./sandbox-NnTFfn1A.js";
1
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-qSGg5R-M.js";
2
2
  import { i as readResponseJson } from "./errors-BuPtQ91K.js";
3
3
  import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-BXgE8UHJ.js";
4
4
  //#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
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.30",
156
- "@repo/shared": "0.0.0",
157
- "@tangle-network/runtime-contracts": "0.19.0",
158
156
  "@products/sandbox-test-utils": "0.0.0",
159
157
  "@tangle-network/agent-profile-materialize": "0.27.1",
160
- "@tangle-network/cli-agent-registry": "0.14.0"
158
+ "@tangle-network/cli-agent-registry": "0.14.0",
159
+ "@tangle-network/runtime-contracts": "0.19.0",
160
+ "@repo/shared": "0.0.0"
161
161
  },
162
162
  "tangleRelease": {
163
- "sourceSha": "978d63826f9678b70d7e77f21742d4d99b91e580",
164
- "mergedAt": "2026-10-27T06:00:15-06:00"
163
+ "sourceSha": "2dd7caa4ed3b80afbfd21aeb72d956e945836fba",
164
+ "mergedAt": "2026-10-27T06:44:36-06:00"
165
165
  },
166
166
  "scripts": {
167
167
  "build": "node scripts/build-dist.mjs",