@cloudflare/sandbox 0.9.1 → 0.9.3

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,6 +1,6 @@
1
1
  import "../dist-B_eXrP83.js";
2
- import "../errors-LE3HHcRb.js";
3
- import { h as streamFile, n as getSandbox } from "../sandbox-PAYx1CcU.js";
2
+ import "../errors-CBi-O-pF.js";
3
+ import { h as streamFile, n as getSandbox } from "../sandbox-BAuU-2a0.js";
4
4
  import { DurableObject, env } from "cloudflare:workers";
5
5
  import { Hono } from "hono";
6
6
 
@@ -75,6 +75,7 @@ declare const ErrorCode: {
75
75
  readonly INVALID_JSON_RESPONSE: "INVALID_JSON_RESPONSE";
76
76
  readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
77
77
  readonly INTERNAL_ERROR: "INTERNAL_ERROR";
78
+ readonly RPC_TRANSPORT_ERROR: "RPC_TRANSPORT_ERROR";
78
79
  };
79
80
  type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
80
81
  //#endregion
@@ -213,6 +214,35 @@ interface OpencodeStartupContext {
213
214
  stderr?: string;
214
215
  command?: string;
215
216
  }
217
+ /**
218
+ * RPC transport error contexts. Surfaced when the capnweb WebSocket session
219
+ * fails on the SDK side rather than the container reporting a structured
220
+ * error. Always retryable — the next call will open a fresh connection.
221
+ */
222
+ type RPCTransportErrorKind = /** Server closed the WebSocket (container crash, DO eviction, network blip). */
223
+ 'peer_closed'
224
+ /** Underlying socket fired the `error` event. */ | 'connection_failed'
225
+ /** WebSocket upgrade failed before the session was established. */ | 'upgrade_failed'
226
+ /** Peer sent a non-string frame; capnweb's wire format is JSON text only. */ | 'invalid_frame'
227
+ /** Peer sent a frame the wire-format parser rejected (capnweb readLoop SyntaxError). */ | 'protocol_error'
228
+ /** Session was disposed (locally or remotely) while a call was pending. */ | 'session_disposed'
229
+ /** Anything else that bubbled up from the transport with no recognisable shape. */ | 'unknown';
230
+ interface RPCTransportContext {
231
+ /** Categorical bucket so callers can branch on `peer_closed` vs `upgrade_failed` etc. */
232
+ kind: RPCTransportErrorKind;
233
+ /** Original error message, verbatim from capnweb / our DeferredTransport. */
234
+ originalMessage: string;
235
+ /**
236
+ * The underlying Error's `name` property. capnweb preserves this across
237
+ * the wire for the standard built-ins (TypeError, SyntaxError, etc.), so
238
+ * it's a more reliable hint than the message string for those cases.
239
+ */
240
+ errorName: string;
241
+ /** WebSocket close code, when available (kind === 'peer_closed'). */
242
+ closeCode?: number;
243
+ /** WebSocket close reason, when available (kind === 'peer_closed'). */
244
+ closeReason?: string;
245
+ }
216
246
  /**
217
247
  * Desktop error contexts
218
248
  */
@@ -229,5 +259,5 @@ interface DesktopCoordinateErrorContext {
229
259
  displayHeight: number;
230
260
  }
231
261
  //#endregion
232
- export { DesktopCoordinateErrorContext as a, OpencodeStartupContext as c, SessionTerminatedContext as d, ErrorResponse as f, BackupRestoreContext as i, ProcessExitedBeforeReadyContext as l, ErrorCode as m, BackupExpiredContext as n, DesktopErrorContext as o, OperationType as p, BackupNotFoundContext as r, InvalidBackupConfigContext as s, BackupCreateContext as t, ProcessReadyTimeoutContext as u };
233
- //# sourceMappingURL=contexts-D6kt6WyG.d.ts.map
262
+ export { DesktopCoordinateErrorContext as a, OpencodeStartupContext as c, RPCTransportContext as d, RPCTransportErrorKind as f, ErrorCode as g, OperationType as h, BackupRestoreContext as i, ProcessExitedBeforeReadyContext as l, ErrorResponse as m, BackupExpiredContext as n, DesktopErrorContext as o, SessionTerminatedContext as p, BackupNotFoundContext as r, InvalidBackupConfigContext as s, BackupCreateContext as t, ProcessReadyTimeoutContext as u };
263
+ //# sourceMappingURL=contexts-D_shbnJs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts-D_shbnJs.d.ts","names":["ErrorCode","ErrorCode","Operation","OperationType","ErrorResponse","TContext","Record","ServiceError","ServiceResult","T","OperationType","FileNotFoundContext","FileExistsContext","FileTooLargeContext","FileSystemContext","CommandNotFoundContext","CommandErrorContext","ProcessNotFoundContext","ProcessErrorContext","SessionAlreadyExistsContext","SessionDestroyedContext","SessionTerminatedContext","ProcessReadyTimeoutContext","ProcessExitedBeforeReadyContext","PortAlreadyExposedContext","PortNotExposedContext","InvalidPortContext","PortErrorContext","GitRepositoryNotFoundContext","GitAuthFailedContext","GitBranchNotFoundContext","GitErrorContext","InterpreterNotReadyContext","ContextNotFoundContext","CodeExecutionContext","ValidationFailedContext","Array","BucketMountContext","MissingCredentialsContext","InvalidMountConfigContext","BackupCreateContext","BackupRestoreContext","BackupNotFoundContext","BackupExpiredContext","InvalidBackupConfigContext","OpencodeStartupContext","InternalErrorContext","RPCTransportErrorKind","RPCTransportContext","DesktopErrorContext","DesktopCoordinateErrorContext"],"sources":["../../shared/dist/errors/codes.d.ts","../../shared/dist/errors/types.d.ts","../../shared/dist/errors/contexts.d.ts"],"sourcesContent":["/**\n * Centralized error code registry\n * Each code maps to a specific error type with consistent semantics\n */\nexport declare const ErrorCode: {\n readonly FILE_NOT_FOUND: \"FILE_NOT_FOUND\";\n readonly PERMISSION_DENIED: \"PERMISSION_DENIED\";\n readonly FILE_EXISTS: \"FILE_EXISTS\";\n readonly IS_DIRECTORY: \"IS_DIRECTORY\";\n readonly NOT_DIRECTORY: \"NOT_DIRECTORY\";\n readonly FILE_TOO_LARGE: \"FILE_TOO_LARGE\";\n readonly NO_SPACE: \"NO_SPACE\";\n readonly TOO_MANY_FILES: \"TOO_MANY_FILES\";\n readonly RESOURCE_BUSY: \"RESOURCE_BUSY\";\n readonly READ_ONLY: \"READ_ONLY\";\n readonly NAME_TOO_LONG: \"NAME_TOO_LONG\";\n readonly TOO_MANY_LINKS: \"TOO_MANY_LINKS\";\n readonly FILESYSTEM_ERROR: \"FILESYSTEM_ERROR\";\n readonly COMMAND_NOT_FOUND: \"COMMAND_NOT_FOUND\";\n readonly COMMAND_PERMISSION_DENIED: \"COMMAND_PERMISSION_DENIED\";\n readonly INVALID_COMMAND: \"INVALID_COMMAND\";\n readonly COMMAND_EXECUTION_ERROR: \"COMMAND_EXECUTION_ERROR\";\n readonly STREAM_START_ERROR: \"STREAM_START_ERROR\";\n readonly PROCESS_NOT_FOUND: \"PROCESS_NOT_FOUND\";\n readonly PROCESS_PERMISSION_DENIED: \"PROCESS_PERMISSION_DENIED\";\n readonly PROCESS_ERROR: \"PROCESS_ERROR\";\n readonly SESSION_ALREADY_EXISTS: \"SESSION_ALREADY_EXISTS\";\n readonly SESSION_DESTROYED: \"SESSION_DESTROYED\";\n readonly SESSION_TERMINATED: \"SESSION_TERMINATED\";\n readonly PORT_ALREADY_EXPOSED: \"PORT_ALREADY_EXPOSED\";\n readonly PORT_IN_USE: \"PORT_IN_USE\";\n readonly PORT_NOT_EXPOSED: \"PORT_NOT_EXPOSED\";\n readonly INVALID_PORT_NUMBER: \"INVALID_PORT_NUMBER\";\n readonly INVALID_PORT: \"INVALID_PORT\";\n readonly SERVICE_NOT_RESPONDING: \"SERVICE_NOT_RESPONDING\";\n readonly PORT_OPERATION_ERROR: \"PORT_OPERATION_ERROR\";\n readonly CUSTOM_DOMAIN_REQUIRED: \"CUSTOM_DOMAIN_REQUIRED\";\n readonly GIT_REPOSITORY_NOT_FOUND: \"GIT_REPOSITORY_NOT_FOUND\";\n readonly GIT_BRANCH_NOT_FOUND: \"GIT_BRANCH_NOT_FOUND\";\n readonly GIT_AUTH_FAILED: \"GIT_AUTH_FAILED\";\n readonly GIT_NETWORK_ERROR: \"GIT_NETWORK_ERROR\";\n readonly INVALID_GIT_URL: \"INVALID_GIT_URL\";\n readonly GIT_CLONE_FAILED: \"GIT_CLONE_FAILED\";\n readonly GIT_CHECKOUT_FAILED: \"GIT_CHECKOUT_FAILED\";\n readonly GIT_OPERATION_FAILED: \"GIT_OPERATION_FAILED\";\n readonly BUCKET_MOUNT_ERROR: \"BUCKET_MOUNT_ERROR\";\n readonly BUCKET_UNMOUNT_ERROR: \"BUCKET_UNMOUNT_ERROR\";\n readonly S3FS_MOUNT_ERROR: \"S3FS_MOUNT_ERROR\";\n readonly MISSING_CREDENTIALS: \"MISSING_CREDENTIALS\";\n readonly INVALID_MOUNT_CONFIG: \"INVALID_MOUNT_CONFIG\";\n readonly BACKUP_CREATE_FAILED: \"BACKUP_CREATE_FAILED\";\n readonly BACKUP_RESTORE_FAILED: \"BACKUP_RESTORE_FAILED\";\n readonly BACKUP_NOT_FOUND: \"BACKUP_NOT_FOUND\";\n readonly BACKUP_EXPIRED: \"BACKUP_EXPIRED\";\n readonly INVALID_BACKUP_CONFIG: \"INVALID_BACKUP_CONFIG\";\n readonly INTERPRETER_NOT_READY: \"INTERPRETER_NOT_READY\";\n readonly CONTEXT_NOT_FOUND: \"CONTEXT_NOT_FOUND\";\n readonly CODE_EXECUTION_ERROR: \"CODE_EXECUTION_ERROR\";\n readonly PYTHON_NOT_AVAILABLE: \"PYTHON_NOT_AVAILABLE\";\n readonly JAVASCRIPT_NOT_AVAILABLE: \"JAVASCRIPT_NOT_AVAILABLE\";\n readonly OPENCODE_STARTUP_FAILED: \"OPENCODE_STARTUP_FAILED\";\n readonly PROCESS_READY_TIMEOUT: \"PROCESS_READY_TIMEOUT\";\n readonly PROCESS_EXITED_BEFORE_READY: \"PROCESS_EXITED_BEFORE_READY\";\n readonly DESKTOP_NOT_STARTED: \"DESKTOP_NOT_STARTED\";\n readonly DESKTOP_START_FAILED: \"DESKTOP_START_FAILED\";\n readonly DESKTOP_UNAVAILABLE: \"DESKTOP_UNAVAILABLE\";\n readonly DESKTOP_PROCESS_CRASHED: \"DESKTOP_PROCESS_CRASHED\";\n readonly DESKTOP_INVALID_OPTIONS: \"DESKTOP_INVALID_OPTIONS\";\n readonly DESKTOP_INVALID_COORDINATES: \"DESKTOP_INVALID_COORDINATES\";\n readonly WATCH_NOT_FOUND: \"WATCH_NOT_FOUND\";\n readonly WATCH_START_ERROR: \"WATCH_START_ERROR\";\n readonly WATCH_STOP_ERROR: \"WATCH_STOP_ERROR\";\n readonly VALIDATION_FAILED: \"VALIDATION_FAILED\";\n readonly INVALID_JSON_RESPONSE: \"INVALID_JSON_RESPONSE\";\n readonly UNKNOWN_ERROR: \"UNKNOWN_ERROR\";\n readonly INTERNAL_ERROR: \"INTERNAL_ERROR\";\n readonly RPC_TRANSPORT_ERROR: \"RPC_TRANSPORT_ERROR\";\n};\nexport type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];\n//# sourceMappingURL=codes.d.ts.map","import type { ErrorCode } from './codes';\n/**\n * Standard operation types\n */\nexport declare const Operation: {\n readonly FILE_READ: \"file.read\";\n readonly FILE_WRITE: \"file.write\";\n readonly FILE_DELETE: \"file.delete\";\n readonly FILE_MOVE: \"file.move\";\n readonly FILE_RENAME: \"file.rename\";\n readonly FILE_STAT: \"file.stat\";\n readonly DIRECTORY_CREATE: \"directory.create\";\n readonly DIRECTORY_LIST: \"directory.list\";\n readonly COMMAND_EXECUTE: \"command.execute\";\n readonly COMMAND_STREAM: \"command.stream\";\n readonly PROCESS_START: \"process.start\";\n readonly PROCESS_KILL: \"process.kill\";\n readonly PROCESS_LIST: \"process.list\";\n readonly PROCESS_GET: \"process.get\";\n readonly PROCESS_LOGS: \"process.logs\";\n readonly PORT_EXPOSE: \"port.expose\";\n readonly PORT_UNEXPOSE: \"port.unexpose\";\n readonly PORT_LIST: \"port.list\";\n readonly PORT_PROXY: \"port.proxy\";\n readonly GIT_CLONE: \"git.clone\";\n readonly GIT_CHECKOUT: \"git.checkout\";\n readonly GIT_OPERATION: \"git.operation\";\n readonly BACKUP_CREATE: \"backup.create\";\n readonly BACKUP_RESTORE: \"backup.restore\";\n readonly BACKUP_UNMOUNT: \"backup.unmount\";\n readonly DESKTOP_START: \"desktop.start\";\n readonly DESKTOP_STOP: \"desktop.stop\";\n readonly DESKTOP_SCREENSHOT: \"desktop.screenshot\";\n readonly DESKTOP_MOUSE: \"desktop.mouse\";\n readonly DESKTOP_KEYBOARD: \"desktop.keyboard\";\n readonly DESKTOP_STATUS: \"desktop.status\";\n readonly CODE_EXECUTE: \"code.execute\";\n readonly CODE_CONTEXT_CREATE: \"code.context.create\";\n readonly CODE_CONTEXT_DELETE: \"code.context.delete\";\n};\nexport type OperationType = (typeof Operation)[keyof typeof Operation];\n/**\n * Standard error response format with generic context type\n * TContext allows type-safe access to error-specific context\n */\nexport interface ErrorResponse<TContext = Record<string, unknown>> {\n /**\n * Error type code (machine-readable)\n */\n code: ErrorCode;\n /**\n * Human-readable error message\n */\n message: string;\n /**\n * Operation that was attempted (useful for debugging and logging)\n */\n operation?: OperationType;\n /**\n * Structured error context with relevant details\n * Type varies based on error code\n */\n context: TContext;\n /**\n * HTTP status code (for client SDK)\n */\n httpStatus: number;\n /**\n * Timestamp when error occurred\n */\n timestamp: string;\n /**\n * Actionable suggestion for fixing the error\n */\n suggestion?: string;\n /**\n * Link to documentation\n */\n documentation?: string;\n}\n/**\n * Container ServiceError (lightweight, enriched by handlers)\n */\nexport interface ServiceError {\n message: string;\n code: ErrorCode;\n details?: Record<string, unknown>;\n}\n/**\n * ServiceResult type for container services\n */\nexport type ServiceResult<T> = {\n success: true;\n data: T;\n} | {\n success: false;\n error: ServiceError;\n};\n//# sourceMappingURL=types.d.ts.map","import type { OperationType } from './types';\n/**\n * File system error contexts\n */\nexport interface FileNotFoundContext {\n path: string;\n operation: OperationType;\n}\nexport interface FileExistsContext {\n path: string;\n operation: OperationType;\n}\nexport interface FileTooLargeContext {\n path: string;\n operation: OperationType;\n maxSize: number;\n actualSize: number;\n}\nexport interface FileSystemContext {\n path: string;\n operation: OperationType;\n stderr?: string;\n exitCode?: number;\n}\n/**\n * Command error contexts\n */\nexport interface CommandNotFoundContext {\n command: string;\n}\nexport interface CommandErrorContext {\n command: string;\n exitCode?: number;\n stdout?: string;\n stderr?: string;\n}\n/**\n * Process error contexts\n */\nexport interface ProcessNotFoundContext {\n processId: string;\n}\nexport interface ProcessErrorContext {\n processId: string;\n pid?: number;\n exitCode?: number;\n stderr?: string;\n}\nexport interface SessionAlreadyExistsContext {\n sessionId: string;\n /**\n * `CLOUDFLARE_PLACEMENT_ID` captured from the container at the moment the\n * duplicate create was detected. Included so a restarted DO can learn the\n * container's placement ID from an idempotent session-create. `null` when\n * the env var is not set (for example, in local development).\n */\n containerPlacementId?: string | null;\n}\nexport interface SessionDestroyedContext {\n sessionId: string;\n}\nexport interface SessionTerminatedContext {\n sessionId: string;\n exitCode: number | null;\n}\n/**\n * Process readiness error contexts\n */\nexport interface ProcessReadyTimeoutContext {\n processId: string;\n command: string;\n condition: string;\n timeout: number;\n}\nexport interface ProcessExitedBeforeReadyContext {\n processId: string;\n command: string;\n condition: string;\n exitCode: number;\n}\n/**\n * Port error contexts\n */\nexport interface PortAlreadyExposedContext {\n port: number;\n portName?: string;\n}\nexport interface PortNotExposedContext {\n port: number;\n}\nexport interface InvalidPortContext {\n port: number;\n reason: string;\n}\nexport interface PortErrorContext {\n port: number;\n portName?: string;\n stderr?: string;\n}\n/**\n * Git error contexts\n */\nexport interface GitRepositoryNotFoundContext {\n repository: string;\n}\nexport interface GitAuthFailedContext {\n repository: string;\n}\nexport interface GitBranchNotFoundContext {\n branch: string;\n repository?: string;\n}\nexport interface GitErrorContext {\n repository?: string;\n branch?: string;\n targetDir?: string;\n stderr?: string;\n exitCode?: number;\n}\n/**\n * Code interpreter error contexts\n */\nexport interface InterpreterNotReadyContext {\n retryAfter?: number;\n progress?: number;\n}\nexport interface ContextNotFoundContext {\n contextId: string;\n}\nexport interface CodeExecutionContext {\n contextId?: string;\n ename?: string;\n evalue?: string;\n traceback?: string[];\n}\n/**\n * Validation error contexts\n */\nexport interface ValidationFailedContext {\n validationErrors: Array<{\n field: string;\n message: string;\n code?: string;\n }>;\n}\n/**\n * Bucket mounting error contexts\n */\nexport interface BucketMountContext {\n bucket: string;\n mountPath: string;\n endpoint: string;\n stderr?: string;\n exitCode?: number;\n}\nexport interface MissingCredentialsContext {\n bucket: string;\n endpoint: string;\n}\nexport interface InvalidMountConfigContext {\n bucket?: string;\n mountPath?: string;\n endpoint?: string;\n reason?: string;\n}\n/**\n * Backup error contexts\n */\nexport interface BackupCreateContext {\n dir: string;\n backupId?: string;\n stderr?: string;\n exitCode?: number;\n}\nexport interface BackupRestoreContext {\n dir: string;\n backupId: string;\n stderr?: string;\n exitCode?: number;\n}\nexport interface BackupNotFoundContext {\n backupId: string;\n}\nexport interface BackupExpiredContext {\n backupId: string;\n expiredAt?: string;\n}\nexport interface InvalidBackupConfigContext {\n reason: string;\n}\n/**\n * OpenCode error contexts\n */\nexport interface OpencodeStartupContext {\n port: number;\n stderr?: string;\n command?: string;\n}\n/**\n * Generic error contexts\n */\nexport interface InternalErrorContext {\n originalError?: string;\n stack?: string;\n [key: string]: unknown;\n}\n/**\n * RPC transport error contexts. Surfaced when the capnweb WebSocket session\n * fails on the SDK side rather than the container reporting a structured\n * error. Always retryable — the next call will open a fresh connection.\n */\nexport type RPCTransportErrorKind = \n/** Server closed the WebSocket (container crash, DO eviction, network blip). */\n'peer_closed'\n/** Underlying socket fired the `error` event. */\n | 'connection_failed'\n/** WebSocket upgrade failed before the session was established. */\n | 'upgrade_failed'\n/** Peer sent a non-string frame; capnweb's wire format is JSON text only. */\n | 'invalid_frame'\n/** Peer sent a frame the wire-format parser rejected (capnweb readLoop SyntaxError). */\n | 'protocol_error'\n/** Session was disposed (locally or remotely) while a call was pending. */\n | 'session_disposed'\n/** Anything else that bubbled up from the transport with no recognisable shape. */\n | 'unknown';\nexport interface RPCTransportContext {\n /** Categorical bucket so callers can branch on `peer_closed` vs `upgrade_failed` etc. */\n kind: RPCTransportErrorKind;\n /** Original error message, verbatim from capnweb / our DeferredTransport. */\n originalMessage: string;\n /**\n * The underlying Error's `name` property. capnweb preserves this across\n * the wire for the standard built-ins (TypeError, SyntaxError, etc.), so\n * it's a more reliable hint than the message string for those cases.\n */\n errorName: string;\n /** WebSocket close code, when available (kind === 'peer_closed'). */\n closeCode?: number;\n /** WebSocket close reason, when available (kind === 'peer_closed'). */\n closeReason?: string;\n}\n/**\n * Desktop error contexts\n */\nexport interface DesktopErrorContext {\n process?: string;\n stderr?: string;\n crashedProcess?: string;\n reason?: string;\n}\nexport interface DesktopCoordinateErrorContext {\n x: number;\n y: number;\n displayWidth: number;\n displayHeight: number;\n}\n//# sourceMappingURL=contexts.d.ts.map"],"mappings":";;AAIA;AA0EA;;cA1EqBA;;ECAAE,SAAAA,iBAmCpB,EAAA,mBAAA;EACWC,SAAAA,WAAa,EAAA,aAAWD;EAKnBE,SAAAA,YAAa,EAAAC,cAAA;EAAYC,SAAAA,aAAAA,EAAAA,eAAAA;EAIhCL,SAAAA,cAAAA,EAAAA,gBAAAA;EAQME,SAAAA,QAAAA,EAAAA,UAAAA;EAKHE,SAAAA,cAAAA,EAAAA,gBAAAA;EAAQ,SAAA,aAAA,EAAA,eAAA;;;;ECDJgB,SAAAA,gBAAAA,EAAwB,kBAAA;EAOxBC,SAAAA,iBAAAA,EAAAA,mBAA0B;EAM1BC,SAAAA,yBAA+B,EAAA,2BAAA;EA8F/BiB,SAAAA,eAAmB,EAAA,iBAAA;EAMnBC,SAAAA,uBAAoB,EAAA,yBAAA;EAMpBC,SAAAA,kBAAqB,EAAA,oBAAA;EAGrBC,SAAAA,iBAAoB,EAAA,mBAAA;EAIpBC,SAAAA,yBAA0B,EAAA,2BAAA;EAM1BC,SAAAA,aAAAA,EAAAA,eAAsB;EAkB3BE,SAAAA,sBAAqB,EAAA,wBAAA;EAehBC,SAAAA,iBAAmB,EAAA,mBAE1BD;EAiBOE,SAAAA,kBAAmB,EAAA,oBAAA;EAMnBC,SAAAA,oBAAAA,EAAAA,sBAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KF7KlClD,SAAAA,WAAoBA,wBAAwBA;;;AA1ExD;AA0EA;;cC1EqBE;;EAAAA,SAAAA,UAmCpB,EAAA,YAAA;EACWC,SAAAA,WAAa,EAAA,aAAWD;EAKnBE,SAAAA,SAAa,EAAA,WAAAC;EAAYC,SAAAA,WAAAA,EAAAA,aAAAA;EAIhCL,SAAAA,SAAAA,EAAAA,WAAAA;EAQME,SAAAA,gBAAAA,EAAAA,kBAAAA;EAKHE,SAAAA,cAAAA,EAAAA,gBAAAA;EAAQ,SAAA,eAAA,EAAA,iBAAA;;;;ECDJgB,SAAAA,YAAAA,EAAAA,cAAwB;EAOxBC,SAAAA,WAAAA,EAAAA,aAA0B;EAM1BC,SAAAA,YAAAA,EAAAA,cAA+B;EA8F/BiB,SAAAA,WAAAA,EAAmB,aAAA;EAMnBC,SAAAA,aAAAA,EAAoB,eAAA;EAMpBC,SAAAA,SAAAA,EAAAA,WAAqB;EAGrBC,SAAAA,UAAAA,EAAAA,YAAoB;EAIpBC,SAAAA,SAAAA,EAAAA,WAA0B;EAM1BC,SAAAA,YAAAA,EAAAA,cAAsB;EAkB3BE,SAAAA,aAAAA,EAAqB,eAAA;EAehBC,SAAAA,aAAmB,EAAA,eAE1BD;EAiBOE,SAAAA,cAAmB,EAAA,gBAAA;EAMnBC,SAAAA,cAAAA,EAAAA,gBAA6B;;;;;;;;;;;KDnNlC/C,aAAAA,WAAwBD,wBAAwBA;;;;;UAK3CE,yBAAyBE;;;;QAIhCL;;;;;;;;cAQME;;;;;WAKHE;;;;;;;;;;;;;;;;;;;;;UCDIgB,wBAAAA;;;;;;;UAOAC,0BAAAA;;;;;;UAMAC,+BAAAA;;;;;;;;;UA8FAiB,mBAAAA;;;;;;UAMAC,oBAAAA;;;;;;UAMAC,qBAAAA;;;UAGAC,oBAAAA;;;;UAIAC,0BAAAA;;;;;;UAMAC,sBAAAA;;;;;;;;;;KAkBLE,qBAAAA;;;;;;;;UAeKC,mBAAAA;;QAEPD;;;;;;;;;;;;;;;;;UAiBOE,mBAAAA;;;;;;UAMAC,6BAAAA"}
@@ -0,0 +1,227 @@
1
+ //#region ../shared/dist/errors/codes.js
2
+ /**
3
+ * Centralized error code registry
4
+ * Each code maps to a specific error type with consistent semantics
5
+ */
6
+ const ErrorCode = {
7
+ FILE_NOT_FOUND: "FILE_NOT_FOUND",
8
+ PERMISSION_DENIED: "PERMISSION_DENIED",
9
+ FILE_EXISTS: "FILE_EXISTS",
10
+ IS_DIRECTORY: "IS_DIRECTORY",
11
+ NOT_DIRECTORY: "NOT_DIRECTORY",
12
+ FILE_TOO_LARGE: "FILE_TOO_LARGE",
13
+ NO_SPACE: "NO_SPACE",
14
+ TOO_MANY_FILES: "TOO_MANY_FILES",
15
+ RESOURCE_BUSY: "RESOURCE_BUSY",
16
+ READ_ONLY: "READ_ONLY",
17
+ NAME_TOO_LONG: "NAME_TOO_LONG",
18
+ TOO_MANY_LINKS: "TOO_MANY_LINKS",
19
+ FILESYSTEM_ERROR: "FILESYSTEM_ERROR",
20
+ COMMAND_NOT_FOUND: "COMMAND_NOT_FOUND",
21
+ COMMAND_PERMISSION_DENIED: "COMMAND_PERMISSION_DENIED",
22
+ INVALID_COMMAND: "INVALID_COMMAND",
23
+ COMMAND_EXECUTION_ERROR: "COMMAND_EXECUTION_ERROR",
24
+ STREAM_START_ERROR: "STREAM_START_ERROR",
25
+ PROCESS_NOT_FOUND: "PROCESS_NOT_FOUND",
26
+ PROCESS_PERMISSION_DENIED: "PROCESS_PERMISSION_DENIED",
27
+ PROCESS_ERROR: "PROCESS_ERROR",
28
+ SESSION_ALREADY_EXISTS: "SESSION_ALREADY_EXISTS",
29
+ SESSION_DESTROYED: "SESSION_DESTROYED",
30
+ SESSION_TERMINATED: "SESSION_TERMINATED",
31
+ PORT_ALREADY_EXPOSED: "PORT_ALREADY_EXPOSED",
32
+ PORT_IN_USE: "PORT_IN_USE",
33
+ PORT_NOT_EXPOSED: "PORT_NOT_EXPOSED",
34
+ INVALID_PORT_NUMBER: "INVALID_PORT_NUMBER",
35
+ INVALID_PORT: "INVALID_PORT",
36
+ SERVICE_NOT_RESPONDING: "SERVICE_NOT_RESPONDING",
37
+ PORT_OPERATION_ERROR: "PORT_OPERATION_ERROR",
38
+ CUSTOM_DOMAIN_REQUIRED: "CUSTOM_DOMAIN_REQUIRED",
39
+ GIT_REPOSITORY_NOT_FOUND: "GIT_REPOSITORY_NOT_FOUND",
40
+ GIT_BRANCH_NOT_FOUND: "GIT_BRANCH_NOT_FOUND",
41
+ GIT_AUTH_FAILED: "GIT_AUTH_FAILED",
42
+ GIT_NETWORK_ERROR: "GIT_NETWORK_ERROR",
43
+ INVALID_GIT_URL: "INVALID_GIT_URL",
44
+ GIT_CLONE_FAILED: "GIT_CLONE_FAILED",
45
+ GIT_CHECKOUT_FAILED: "GIT_CHECKOUT_FAILED",
46
+ GIT_OPERATION_FAILED: "GIT_OPERATION_FAILED",
47
+ BUCKET_MOUNT_ERROR: "BUCKET_MOUNT_ERROR",
48
+ BUCKET_UNMOUNT_ERROR: "BUCKET_UNMOUNT_ERROR",
49
+ S3FS_MOUNT_ERROR: "S3FS_MOUNT_ERROR",
50
+ MISSING_CREDENTIALS: "MISSING_CREDENTIALS",
51
+ INVALID_MOUNT_CONFIG: "INVALID_MOUNT_CONFIG",
52
+ BACKUP_CREATE_FAILED: "BACKUP_CREATE_FAILED",
53
+ BACKUP_RESTORE_FAILED: "BACKUP_RESTORE_FAILED",
54
+ BACKUP_NOT_FOUND: "BACKUP_NOT_FOUND",
55
+ BACKUP_EXPIRED: "BACKUP_EXPIRED",
56
+ INVALID_BACKUP_CONFIG: "INVALID_BACKUP_CONFIG",
57
+ INTERPRETER_NOT_READY: "INTERPRETER_NOT_READY",
58
+ CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND",
59
+ CODE_EXECUTION_ERROR: "CODE_EXECUTION_ERROR",
60
+ PYTHON_NOT_AVAILABLE: "PYTHON_NOT_AVAILABLE",
61
+ JAVASCRIPT_NOT_AVAILABLE: "JAVASCRIPT_NOT_AVAILABLE",
62
+ OPENCODE_STARTUP_FAILED: "OPENCODE_STARTUP_FAILED",
63
+ PROCESS_READY_TIMEOUT: "PROCESS_READY_TIMEOUT",
64
+ PROCESS_EXITED_BEFORE_READY: "PROCESS_EXITED_BEFORE_READY",
65
+ DESKTOP_NOT_STARTED: "DESKTOP_NOT_STARTED",
66
+ DESKTOP_START_FAILED: "DESKTOP_START_FAILED",
67
+ DESKTOP_UNAVAILABLE: "DESKTOP_UNAVAILABLE",
68
+ DESKTOP_PROCESS_CRASHED: "DESKTOP_PROCESS_CRASHED",
69
+ DESKTOP_INVALID_OPTIONS: "DESKTOP_INVALID_OPTIONS",
70
+ DESKTOP_INVALID_COORDINATES: "DESKTOP_INVALID_COORDINATES",
71
+ WATCH_NOT_FOUND: "WATCH_NOT_FOUND",
72
+ WATCH_START_ERROR: "WATCH_START_ERROR",
73
+ WATCH_STOP_ERROR: "WATCH_STOP_ERROR",
74
+ VALIDATION_FAILED: "VALIDATION_FAILED",
75
+ INVALID_JSON_RESPONSE: "INVALID_JSON_RESPONSE",
76
+ UNKNOWN_ERROR: "UNKNOWN_ERROR",
77
+ INTERNAL_ERROR: "INTERNAL_ERROR",
78
+ RPC_TRANSPORT_ERROR: "RPC_TRANSPORT_ERROR"
79
+ };
80
+
81
+ //#endregion
82
+ //#region ../shared/dist/errors/status-map.js
83
+ /**
84
+ * Maps error codes to HTTP status codes
85
+ * Centralized mapping ensures consistency across SDK
86
+ */
87
+ const ERROR_STATUS_MAP = {
88
+ [ErrorCode.FILE_NOT_FOUND]: 404,
89
+ [ErrorCode.COMMAND_NOT_FOUND]: 404,
90
+ [ErrorCode.PROCESS_NOT_FOUND]: 404,
91
+ [ErrorCode.PORT_NOT_EXPOSED]: 404,
92
+ [ErrorCode.GIT_REPOSITORY_NOT_FOUND]: 404,
93
+ [ErrorCode.GIT_BRANCH_NOT_FOUND]: 404,
94
+ [ErrorCode.CONTEXT_NOT_FOUND]: 404,
95
+ [ErrorCode.WATCH_NOT_FOUND]: 404,
96
+ [ErrorCode.IS_DIRECTORY]: 400,
97
+ [ErrorCode.NOT_DIRECTORY]: 400,
98
+ [ErrorCode.INVALID_COMMAND]: 400,
99
+ [ErrorCode.INVALID_PORT_NUMBER]: 400,
100
+ [ErrorCode.INVALID_PORT]: 400,
101
+ [ErrorCode.INVALID_GIT_URL]: 400,
102
+ [ErrorCode.CUSTOM_DOMAIN_REQUIRED]: 400,
103
+ [ErrorCode.INVALID_JSON_RESPONSE]: 400,
104
+ [ErrorCode.NAME_TOO_LONG]: 400,
105
+ [ErrorCode.VALIDATION_FAILED]: 400,
106
+ [ErrorCode.MISSING_CREDENTIALS]: 400,
107
+ [ErrorCode.INVALID_MOUNT_CONFIG]: 400,
108
+ [ErrorCode.GIT_AUTH_FAILED]: 401,
109
+ [ErrorCode.PERMISSION_DENIED]: 403,
110
+ [ErrorCode.COMMAND_PERMISSION_DENIED]: 403,
111
+ [ErrorCode.PROCESS_PERMISSION_DENIED]: 403,
112
+ [ErrorCode.READ_ONLY]: 403,
113
+ [ErrorCode.FILE_EXISTS]: 409,
114
+ [ErrorCode.PORT_ALREADY_EXPOSED]: 409,
115
+ [ErrorCode.PORT_IN_USE]: 409,
116
+ [ErrorCode.RESOURCE_BUSY]: 409,
117
+ [ErrorCode.SESSION_ALREADY_EXISTS]: 409,
118
+ [ErrorCode.SESSION_DESTROYED]: 410,
119
+ [ErrorCode.SESSION_TERMINATED]: 410,
120
+ [ErrorCode.FILE_TOO_LARGE]: 413,
121
+ [ErrorCode.SERVICE_NOT_RESPONDING]: 502,
122
+ [ErrorCode.GIT_NETWORK_ERROR]: 502,
123
+ [ErrorCode.BACKUP_NOT_FOUND]: 404,
124
+ [ErrorCode.BACKUP_EXPIRED]: 400,
125
+ [ErrorCode.INVALID_BACKUP_CONFIG]: 400,
126
+ [ErrorCode.BACKUP_CREATE_FAILED]: 500,
127
+ [ErrorCode.BACKUP_RESTORE_FAILED]: 500,
128
+ [ErrorCode.PYTHON_NOT_AVAILABLE]: 501,
129
+ [ErrorCode.JAVASCRIPT_NOT_AVAILABLE]: 501,
130
+ [ErrorCode.DESKTOP_NOT_STARTED]: 409,
131
+ [ErrorCode.DESKTOP_START_FAILED]: 500,
132
+ [ErrorCode.DESKTOP_UNAVAILABLE]: 503,
133
+ [ErrorCode.DESKTOP_PROCESS_CRASHED]: 500,
134
+ [ErrorCode.DESKTOP_INVALID_OPTIONS]: 400,
135
+ [ErrorCode.DESKTOP_INVALID_COORDINATES]: 400,
136
+ [ErrorCode.INTERPRETER_NOT_READY]: 503,
137
+ [ErrorCode.OPENCODE_STARTUP_FAILED]: 503,
138
+ [ErrorCode.RPC_TRANSPORT_ERROR]: 503,
139
+ [ErrorCode.PROCESS_READY_TIMEOUT]: 408,
140
+ [ErrorCode.PROCESS_EXITED_BEFORE_READY]: 500,
141
+ [ErrorCode.NO_SPACE]: 500,
142
+ [ErrorCode.TOO_MANY_FILES]: 500,
143
+ [ErrorCode.TOO_MANY_LINKS]: 500,
144
+ [ErrorCode.FILESYSTEM_ERROR]: 500,
145
+ [ErrorCode.COMMAND_EXECUTION_ERROR]: 500,
146
+ [ErrorCode.STREAM_START_ERROR]: 500,
147
+ [ErrorCode.PROCESS_ERROR]: 500,
148
+ [ErrorCode.PORT_OPERATION_ERROR]: 500,
149
+ [ErrorCode.GIT_CLONE_FAILED]: 500,
150
+ [ErrorCode.GIT_CHECKOUT_FAILED]: 500,
151
+ [ErrorCode.GIT_OPERATION_FAILED]: 500,
152
+ [ErrorCode.CODE_EXECUTION_ERROR]: 500,
153
+ [ErrorCode.BUCKET_MOUNT_ERROR]: 500,
154
+ [ErrorCode.BUCKET_UNMOUNT_ERROR]: 500,
155
+ [ErrorCode.S3FS_MOUNT_ERROR]: 500,
156
+ [ErrorCode.WATCH_START_ERROR]: 500,
157
+ [ErrorCode.WATCH_STOP_ERROR]: 500,
158
+ [ErrorCode.UNKNOWN_ERROR]: 500,
159
+ [ErrorCode.INTERNAL_ERROR]: 500
160
+ };
161
+ /**
162
+ * Get HTTP status code for an error code
163
+ * Falls back to 500 for unknown errors
164
+ */
165
+ function getHttpStatus(code) {
166
+ return ERROR_STATUS_MAP[code] || 500;
167
+ }
168
+
169
+ //#endregion
170
+ //#region ../shared/dist/errors/suggestions.js
171
+ /**
172
+ * Get actionable suggestion for an error code
173
+ * Used by handlers when enriching ServiceError → ErrorResponse
174
+ */
175
+ function getSuggestion(code, context) {
176
+ switch (code) {
177
+ case ErrorCode.FILE_NOT_FOUND: return `Ensure the file exists at ${context.path} before attempting to access it`;
178
+ case ErrorCode.FILE_EXISTS: return `File already exists at ${context.path}. Use a different path or delete the existing file first`;
179
+ case ErrorCode.COMMAND_NOT_FOUND: return `Check that "${context.command}" is installed and available in the system PATH`;
180
+ case ErrorCode.PROCESS_NOT_FOUND: return "Verify the process ID is correct and the process has not already exited";
181
+ case ErrorCode.PORT_NOT_EXPOSED: return `Port ${context.port} is not currently exposed. Use listExposedPorts() to see active ports`;
182
+ case ErrorCode.PORT_ALREADY_EXPOSED: return `Port ${context.port} is already exposed. Unexpose it first or use a different port`;
183
+ case ErrorCode.PORT_IN_USE: return `Port ${context.port} is already in use by another service. Choose a different port`;
184
+ case ErrorCode.SESSION_ALREADY_EXISTS: return `Session "${context.sessionId}" already exists. Use a different session ID or reuse the existing session`;
185
+ case ErrorCode.SESSION_DESTROYED: return `Session "${context.sessionId}" was destroyed. Create a new session to continue executing commands`;
186
+ case ErrorCode.SESSION_TERMINATED: return `Session "${context.sessionId}" ended because its shell exited (exit code: ${context.exitCode ?? "unknown"}). Session-local state (env vars, cwd, shell functions) has been lost. Retry the call to start a fresh session, or call createSession() with the same id to recreate it explicitly`;
187
+ case ErrorCode.INVALID_PORT: return `Port must be between 1 and 65535. Port ${context.port} is ${context.reason}`;
188
+ case ErrorCode.GIT_REPOSITORY_NOT_FOUND: return "Verify the repository URL is correct and accessible";
189
+ case ErrorCode.GIT_AUTH_FAILED: return "Check authentication credentials or use a public repository";
190
+ case ErrorCode.GIT_BRANCH_NOT_FOUND: return `Branch "${context.branch}" does not exist in the repository. Check the branch name or use the default branch`;
191
+ case ErrorCode.INTERPRETER_NOT_READY: return context.retryAfter ? `Code interpreter is starting up. Retry after ${context.retryAfter} seconds` : "Code interpreter is not ready. Please wait a moment and try again";
192
+ case ErrorCode.CONTEXT_NOT_FOUND: return `Context "${context.contextId}" does not exist. Create a context first using createContext()`;
193
+ case ErrorCode.VALIDATION_FAILED: return "Check the request parameters and ensure they match the required format";
194
+ case ErrorCode.NO_SPACE: return "Not enough disk space available. Consider cleaning up temporary files or increasing storage";
195
+ case ErrorCode.PERMISSION_DENIED: return "Operation not permitted. Check file/directory permissions";
196
+ case ErrorCode.IS_DIRECTORY: return `Cannot perform this operation on a directory. Path ${context.path} is a directory`;
197
+ case ErrorCode.NOT_DIRECTORY: return `Expected a directory but found a file at ${context.path}`;
198
+ case ErrorCode.RESOURCE_BUSY: return "Resource is currently in use. Wait for the current operation to complete";
199
+ case ErrorCode.READ_ONLY: return "Cannot modify a read-only resource";
200
+ case ErrorCode.SERVICE_NOT_RESPONDING: return "Service is not responding. Check if the service is running and accessible";
201
+ case ErrorCode.BACKUP_NOT_FOUND: return `Backup "${context.backupId}" does not exist. Verify the backup ID is correct`;
202
+ case ErrorCode.BACKUP_EXPIRED: return `Backup "${context.backupId}" has expired. Create a new backup`;
203
+ case ErrorCode.INVALID_BACKUP_CONFIG: return `Invalid backup configuration: ${context.reason}`;
204
+ case ErrorCode.BACKUP_CREATE_FAILED: return "Backup creation failed. Check that the directory exists and you have sufficient disk space";
205
+ case ErrorCode.BACKUP_RESTORE_FAILED: return "Backup restoration failed. The archive may be corrupted or the target directory may be in use";
206
+ case ErrorCode.DESKTOP_NOT_STARTED: return "Desktop environment is not running. Call sandbox.desktop.start() first";
207
+ case ErrorCode.DESKTOP_START_FAILED: return `Desktop failed to start: ${context.reason || "unknown error"}. Check container logs`;
208
+ case ErrorCode.DESKTOP_UNAVAILABLE: return "Desktop processes are not healthy. Try sandbox.desktop.stop() then sandbox.desktop.start()";
209
+ case ErrorCode.DESKTOP_PROCESS_CRASHED: return `Desktop process "${context.crashedProcess}" crashed. Restart with sandbox.desktop.start()`;
210
+ case ErrorCode.DESKTOP_INVALID_OPTIONS: return `Invalid desktop options: ${context.reason}. Check resolution and DPI values`;
211
+ case ErrorCode.DESKTOP_INVALID_COORDINATES: return `Coordinates (${context.x}, ${context.y}) are outside the display area (${context.displayWidth}x${context.displayHeight})`;
212
+ case ErrorCode.RPC_TRANSPORT_ERROR: switch (context.kind) {
213
+ case "peer_closed": return "The container closed the WebSocket mid-call (likely a container restart, eviction, or crash). Retry the call — the SDK will open a fresh connection.";
214
+ case "connection_failed": return "The WebSocket connection failed. Retry the call; if the failure persists, check container health and network connectivity.";
215
+ case "upgrade_failed": return "The WebSocket upgrade was rejected by the container. Verify the container is running and reachable on the configured port.";
216
+ case "invalid_frame": return "The container sent a frame the RPC transport cannot handle. This usually indicates a version mismatch between the SDK and the container image.";
217
+ case "protocol_error": return "The peer sent a malformed RPC message (capnweb could not parse the wire format). This usually indicates a version mismatch between the SDK and the container image.";
218
+ case "session_disposed": return "The RPC session was disposed while a call was in flight. Avoid reusing stubs after disconnect(); the next method call will reconnect automatically.";
219
+ default: return "The RPC transport raised an error. Retry the call — the SDK will open a fresh connection.";
220
+ }
221
+ default: return;
222
+ }
223
+ }
224
+
225
+ //#endregion
226
+ export { getHttpStatus as n, ErrorCode as r, getSuggestion as t };
227
+ //# sourceMappingURL=errors-CBi-O-pF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-CBi-O-pF.js","names":[],"sources":["../../shared/dist/errors/codes.js","../../shared/dist/errors/status-map.js","../../shared/dist/errors/suggestions.js"],"sourcesContent":["/**\n * Centralized error code registry\n * Each code maps to a specific error type with consistent semantics\n */\nexport const ErrorCode = {\n // File System Errors (404)\n FILE_NOT_FOUND: 'FILE_NOT_FOUND',\n // Permission Errors (403)\n PERMISSION_DENIED: 'PERMISSION_DENIED',\n // File System Errors (409)\n FILE_EXISTS: 'FILE_EXISTS',\n // File System Errors (400)\n IS_DIRECTORY: 'IS_DIRECTORY',\n NOT_DIRECTORY: 'NOT_DIRECTORY',\n // File Too Large Errors (413)\n FILE_TOO_LARGE: 'FILE_TOO_LARGE',\n // File System Errors (500)\n NO_SPACE: 'NO_SPACE',\n TOO_MANY_FILES: 'TOO_MANY_FILES',\n RESOURCE_BUSY: 'RESOURCE_BUSY',\n READ_ONLY: 'READ_ONLY',\n NAME_TOO_LONG: 'NAME_TOO_LONG',\n TOO_MANY_LINKS: 'TOO_MANY_LINKS',\n FILESYSTEM_ERROR: 'FILESYSTEM_ERROR',\n // Command Errors (404)\n COMMAND_NOT_FOUND: 'COMMAND_NOT_FOUND',\n // Command Errors (403/400)\n COMMAND_PERMISSION_DENIED: 'COMMAND_PERMISSION_DENIED',\n INVALID_COMMAND: 'INVALID_COMMAND',\n // Command Errors (500)\n COMMAND_EXECUTION_ERROR: 'COMMAND_EXECUTION_ERROR',\n STREAM_START_ERROR: 'STREAM_START_ERROR',\n // Process Errors (404)\n PROCESS_NOT_FOUND: 'PROCESS_NOT_FOUND',\n // Process Errors (403/500)\n PROCESS_PERMISSION_DENIED: 'PROCESS_PERMISSION_DENIED',\n PROCESS_ERROR: 'PROCESS_ERROR',\n // Session Errors (409)\n SESSION_ALREADY_EXISTS: 'SESSION_ALREADY_EXISTS',\n // Session Errors (410)\n SESSION_DESTROYED: 'SESSION_DESTROYED',\n SESSION_TERMINATED: 'SESSION_TERMINATED',\n // Port Errors (409)\n PORT_ALREADY_EXPOSED: 'PORT_ALREADY_EXPOSED',\n PORT_IN_USE: 'PORT_IN_USE',\n // Port Errors (404)\n PORT_NOT_EXPOSED: 'PORT_NOT_EXPOSED',\n // Port Errors (400)\n INVALID_PORT_NUMBER: 'INVALID_PORT_NUMBER',\n INVALID_PORT: 'INVALID_PORT',\n // Port Errors (502/500)\n SERVICE_NOT_RESPONDING: 'SERVICE_NOT_RESPONDING',\n PORT_OPERATION_ERROR: 'PORT_OPERATION_ERROR',\n // Port Errors (400)\n CUSTOM_DOMAIN_REQUIRED: 'CUSTOM_DOMAIN_REQUIRED',\n // Git Errors (404)\n GIT_REPOSITORY_NOT_FOUND: 'GIT_REPOSITORY_NOT_FOUND',\n GIT_BRANCH_NOT_FOUND: 'GIT_BRANCH_NOT_FOUND',\n // Git Errors (401)\n GIT_AUTH_FAILED: 'GIT_AUTH_FAILED',\n // Git Errors (502)\n GIT_NETWORK_ERROR: 'GIT_NETWORK_ERROR',\n // Git Errors (400)\n INVALID_GIT_URL: 'INVALID_GIT_URL',\n // Git Errors (500)\n GIT_CLONE_FAILED: 'GIT_CLONE_FAILED',\n GIT_CHECKOUT_FAILED: 'GIT_CHECKOUT_FAILED',\n GIT_OPERATION_FAILED: 'GIT_OPERATION_FAILED',\n // Bucket mounting errors\n BUCKET_MOUNT_ERROR: 'BUCKET_MOUNT_ERROR',\n BUCKET_UNMOUNT_ERROR: 'BUCKET_UNMOUNT_ERROR',\n S3FS_MOUNT_ERROR: 'S3FS_MOUNT_ERROR',\n MISSING_CREDENTIALS: 'MISSING_CREDENTIALS',\n INVALID_MOUNT_CONFIG: 'INVALID_MOUNT_CONFIG',\n // Backup Errors (500)\n BACKUP_CREATE_FAILED: 'BACKUP_CREATE_FAILED',\n BACKUP_RESTORE_FAILED: 'BACKUP_RESTORE_FAILED',\n // Backup Errors (404)\n BACKUP_NOT_FOUND: 'BACKUP_NOT_FOUND',\n // Backup Errors (400)\n BACKUP_EXPIRED: 'BACKUP_EXPIRED',\n INVALID_BACKUP_CONFIG: 'INVALID_BACKUP_CONFIG',\n // Code Interpreter Errors (503)\n INTERPRETER_NOT_READY: 'INTERPRETER_NOT_READY',\n // Code Interpreter Errors (404)\n CONTEXT_NOT_FOUND: 'CONTEXT_NOT_FOUND',\n // Code Interpreter Errors (500)\n CODE_EXECUTION_ERROR: 'CODE_EXECUTION_ERROR',\n // Code Interpreter Errors (501) - Feature not available in image variant\n PYTHON_NOT_AVAILABLE: 'PYTHON_NOT_AVAILABLE',\n JAVASCRIPT_NOT_AVAILABLE: 'JAVASCRIPT_NOT_AVAILABLE',\n // OpenCode Errors (503)\n OPENCODE_STARTUP_FAILED: 'OPENCODE_STARTUP_FAILED',\n // Process Readiness Errors (408/500)\n PROCESS_READY_TIMEOUT: 'PROCESS_READY_TIMEOUT',\n PROCESS_EXITED_BEFORE_READY: 'PROCESS_EXITED_BEFORE_READY',\n // Desktop Errors (409)\n DESKTOP_NOT_STARTED: 'DESKTOP_NOT_STARTED',\n // Desktop Errors (500)\n DESKTOP_START_FAILED: 'DESKTOP_START_FAILED',\n // Desktop Errors (503)\n DESKTOP_UNAVAILABLE: 'DESKTOP_UNAVAILABLE',\n // Desktop Errors (500)\n DESKTOP_PROCESS_CRASHED: 'DESKTOP_PROCESS_CRASHED',\n // Desktop Errors (400)\n DESKTOP_INVALID_OPTIONS: 'DESKTOP_INVALID_OPTIONS',\n DESKTOP_INVALID_COORDINATES: 'DESKTOP_INVALID_COORDINATES',\n // File Watch Errors (404)\n WATCH_NOT_FOUND: 'WATCH_NOT_FOUND',\n // File Watch Errors (500)\n WATCH_START_ERROR: 'WATCH_START_ERROR',\n WATCH_STOP_ERROR: 'WATCH_STOP_ERROR',\n // Validation Errors (400)\n VALIDATION_FAILED: 'VALIDATION_FAILED',\n // Generic Errors (400/500)\n INVALID_JSON_RESPONSE: 'INVALID_JSON_RESPONSE',\n UNKNOWN_ERROR: 'UNKNOWN_ERROR',\n INTERNAL_ERROR: 'INTERNAL_ERROR',\n // RPC Transport Errors (503) — capnweb WebSocket session-level failures\n // raised on the SDK side, not by the container. The container went away\n // mid-call (peer close), the WebSocket failed before/after upgrade, the\n // peer sent a frame the transport cannot handle, or the session was\n // disposed while a call was in flight.\n RPC_TRANSPORT_ERROR: 'RPC_TRANSPORT_ERROR'\n};\n","import { ErrorCode } from './codes';\n/**\n * Maps error codes to HTTP status codes\n * Centralized mapping ensures consistency across SDK\n */\nexport const ERROR_STATUS_MAP = {\n // 404 Not Found\n [ErrorCode.FILE_NOT_FOUND]: 404,\n [ErrorCode.COMMAND_NOT_FOUND]: 404,\n [ErrorCode.PROCESS_NOT_FOUND]: 404,\n [ErrorCode.PORT_NOT_EXPOSED]: 404,\n [ErrorCode.GIT_REPOSITORY_NOT_FOUND]: 404,\n [ErrorCode.GIT_BRANCH_NOT_FOUND]: 404,\n [ErrorCode.CONTEXT_NOT_FOUND]: 404,\n [ErrorCode.WATCH_NOT_FOUND]: 404,\n // 400 Bad Request\n [ErrorCode.IS_DIRECTORY]: 400,\n [ErrorCode.NOT_DIRECTORY]: 400,\n [ErrorCode.INVALID_COMMAND]: 400,\n [ErrorCode.INVALID_PORT_NUMBER]: 400,\n [ErrorCode.INVALID_PORT]: 400,\n [ErrorCode.INVALID_GIT_URL]: 400,\n [ErrorCode.CUSTOM_DOMAIN_REQUIRED]: 400,\n [ErrorCode.INVALID_JSON_RESPONSE]: 400,\n [ErrorCode.NAME_TOO_LONG]: 400,\n [ErrorCode.VALIDATION_FAILED]: 400,\n [ErrorCode.MISSING_CREDENTIALS]: 400,\n [ErrorCode.INVALID_MOUNT_CONFIG]: 400,\n // 401 Unauthorized\n [ErrorCode.GIT_AUTH_FAILED]: 401,\n // 403 Forbidden\n [ErrorCode.PERMISSION_DENIED]: 403,\n [ErrorCode.COMMAND_PERMISSION_DENIED]: 403,\n [ErrorCode.PROCESS_PERMISSION_DENIED]: 403,\n [ErrorCode.READ_ONLY]: 403,\n // 409 Conflict\n [ErrorCode.FILE_EXISTS]: 409,\n [ErrorCode.PORT_ALREADY_EXPOSED]: 409,\n [ErrorCode.PORT_IN_USE]: 409,\n [ErrorCode.RESOURCE_BUSY]: 409,\n [ErrorCode.SESSION_ALREADY_EXISTS]: 409,\n // 410 Gone\n [ErrorCode.SESSION_DESTROYED]: 410,\n [ErrorCode.SESSION_TERMINATED]: 410,\n // 413 Content Too Large\n [ErrorCode.FILE_TOO_LARGE]: 413,\n // 502 Bad Gateway\n [ErrorCode.SERVICE_NOT_RESPONDING]: 502,\n [ErrorCode.GIT_NETWORK_ERROR]: 502,\n // Backup errors\n [ErrorCode.BACKUP_NOT_FOUND]: 404,\n [ErrorCode.BACKUP_EXPIRED]: 400,\n [ErrorCode.INVALID_BACKUP_CONFIG]: 400,\n [ErrorCode.BACKUP_CREATE_FAILED]: 500,\n [ErrorCode.BACKUP_RESTORE_FAILED]: 500,\n // 501 Not Implemented (feature not available in image variant)\n [ErrorCode.PYTHON_NOT_AVAILABLE]: 501,\n [ErrorCode.JAVASCRIPT_NOT_AVAILABLE]: 501,\n // Desktop errors\n [ErrorCode.DESKTOP_NOT_STARTED]: 409,\n [ErrorCode.DESKTOP_START_FAILED]: 500,\n [ErrorCode.DESKTOP_UNAVAILABLE]: 503,\n [ErrorCode.DESKTOP_PROCESS_CRASHED]: 500,\n [ErrorCode.DESKTOP_INVALID_OPTIONS]: 400,\n [ErrorCode.DESKTOP_INVALID_COORDINATES]: 400,\n // 503 Service Unavailable\n [ErrorCode.INTERPRETER_NOT_READY]: 503,\n [ErrorCode.OPENCODE_STARTUP_FAILED]: 503,\n [ErrorCode.RPC_TRANSPORT_ERROR]: 503,\n // 408 Request Timeout\n [ErrorCode.PROCESS_READY_TIMEOUT]: 408,\n // 500 Internal Server Error\n [ErrorCode.PROCESS_EXITED_BEFORE_READY]: 500,\n [ErrorCode.NO_SPACE]: 500,\n [ErrorCode.TOO_MANY_FILES]: 500,\n [ErrorCode.TOO_MANY_LINKS]: 500,\n [ErrorCode.FILESYSTEM_ERROR]: 500,\n [ErrorCode.COMMAND_EXECUTION_ERROR]: 500,\n [ErrorCode.STREAM_START_ERROR]: 500,\n [ErrorCode.PROCESS_ERROR]: 500,\n [ErrorCode.PORT_OPERATION_ERROR]: 500,\n [ErrorCode.GIT_CLONE_FAILED]: 500,\n [ErrorCode.GIT_CHECKOUT_FAILED]: 500,\n [ErrorCode.GIT_OPERATION_FAILED]: 500,\n [ErrorCode.CODE_EXECUTION_ERROR]: 500,\n [ErrorCode.BUCKET_MOUNT_ERROR]: 500,\n [ErrorCode.BUCKET_UNMOUNT_ERROR]: 500,\n [ErrorCode.S3FS_MOUNT_ERROR]: 500,\n [ErrorCode.WATCH_START_ERROR]: 500,\n [ErrorCode.WATCH_STOP_ERROR]: 500,\n [ErrorCode.UNKNOWN_ERROR]: 500,\n [ErrorCode.INTERNAL_ERROR]: 500\n};\n/**\n * Get HTTP status code for an error code\n * Falls back to 500 for unknown errors\n */\nexport function getHttpStatus(code) {\n return ERROR_STATUS_MAP[code] || 500;\n}\n","import { ErrorCode } from './codes';\n/**\n * Get actionable suggestion for an error code\n * Used by handlers when enriching ServiceError → ErrorResponse\n */\nexport function getSuggestion(code, context) {\n switch (code) {\n case ErrorCode.FILE_NOT_FOUND:\n return `Ensure the file exists at ${context.path} before attempting to access it`;\n case ErrorCode.FILE_EXISTS:\n return `File already exists at ${context.path}. Use a different path or delete the existing file first`;\n case ErrorCode.COMMAND_NOT_FOUND:\n return `Check that \"${context.command}\" is installed and available in the system PATH`;\n case ErrorCode.PROCESS_NOT_FOUND:\n return 'Verify the process ID is correct and the process has not already exited';\n case ErrorCode.PORT_NOT_EXPOSED:\n return `Port ${context.port} is not currently exposed. Use listExposedPorts() to see active ports`;\n case ErrorCode.PORT_ALREADY_EXPOSED:\n return `Port ${context.port} is already exposed. Unexpose it first or use a different port`;\n case ErrorCode.PORT_IN_USE:\n return `Port ${context.port} is already in use by another service. Choose a different port`;\n case ErrorCode.SESSION_ALREADY_EXISTS:\n return `Session \"${context.sessionId}\" already exists. Use a different session ID or reuse the existing session`;\n case ErrorCode.SESSION_DESTROYED:\n return `Session \"${context.sessionId}\" was destroyed. Create a new session to continue executing commands`;\n case ErrorCode.SESSION_TERMINATED:\n return `Session \"${context.sessionId}\" ended because its shell exited (exit code: ${context.exitCode ?? 'unknown'}). Session-local state (env vars, cwd, shell functions) has been lost. Retry the call to start a fresh session, or call createSession() with the same id to recreate it explicitly`;\n case ErrorCode.INVALID_PORT:\n return `Port must be between 1 and 65535. Port ${context.port} is ${context.reason}`;\n case ErrorCode.GIT_REPOSITORY_NOT_FOUND:\n return 'Verify the repository URL is correct and accessible';\n case ErrorCode.GIT_AUTH_FAILED:\n return 'Check authentication credentials or use a public repository';\n case ErrorCode.GIT_BRANCH_NOT_FOUND:\n return `Branch \"${context.branch}\" does not exist in the repository. Check the branch name or use the default branch`;\n case ErrorCode.INTERPRETER_NOT_READY:\n return context.retryAfter\n ? `Code interpreter is starting up. Retry after ${context.retryAfter} seconds`\n : 'Code interpreter is not ready. Please wait a moment and try again';\n case ErrorCode.CONTEXT_NOT_FOUND:\n return `Context \"${context.contextId}\" does not exist. Create a context first using createContext()`;\n case ErrorCode.VALIDATION_FAILED:\n return 'Check the request parameters and ensure they match the required format';\n case ErrorCode.NO_SPACE:\n return 'Not enough disk space available. Consider cleaning up temporary files or increasing storage';\n case ErrorCode.PERMISSION_DENIED:\n return 'Operation not permitted. Check file/directory permissions';\n case ErrorCode.IS_DIRECTORY:\n return `Cannot perform this operation on a directory. Path ${context.path} is a directory`;\n case ErrorCode.NOT_DIRECTORY:\n return `Expected a directory but found a file at ${context.path}`;\n case ErrorCode.RESOURCE_BUSY:\n return 'Resource is currently in use. Wait for the current operation to complete';\n case ErrorCode.READ_ONLY:\n return 'Cannot modify a read-only resource';\n case ErrorCode.SERVICE_NOT_RESPONDING:\n return 'Service is not responding. Check if the service is running and accessible';\n case ErrorCode.BACKUP_NOT_FOUND:\n return `Backup \"${context.backupId}\" does not exist. Verify the backup ID is correct`;\n case ErrorCode.BACKUP_EXPIRED:\n return `Backup \"${context.backupId}\" has expired. Create a new backup`;\n case ErrorCode.INVALID_BACKUP_CONFIG:\n return `Invalid backup configuration: ${context.reason}`;\n case ErrorCode.BACKUP_CREATE_FAILED:\n return 'Backup creation failed. Check that the directory exists and you have sufficient disk space';\n case ErrorCode.BACKUP_RESTORE_FAILED:\n return 'Backup restoration failed. The archive may be corrupted or the target directory may be in use';\n case ErrorCode.DESKTOP_NOT_STARTED:\n return 'Desktop environment is not running. Call sandbox.desktop.start() first';\n case ErrorCode.DESKTOP_START_FAILED:\n return `Desktop failed to start: ${context.reason || 'unknown error'}. Check container logs`;\n case ErrorCode.DESKTOP_UNAVAILABLE:\n return 'Desktop processes are not healthy. Try sandbox.desktop.stop() then sandbox.desktop.start()';\n case ErrorCode.DESKTOP_PROCESS_CRASHED:\n return `Desktop process \"${context.crashedProcess}\" crashed. Restart with sandbox.desktop.start()`;\n case ErrorCode.DESKTOP_INVALID_OPTIONS:\n return `Invalid desktop options: ${context.reason}. Check resolution and DPI values`;\n case ErrorCode.DESKTOP_INVALID_COORDINATES:\n return `Coordinates (${context.x}, ${context.y}) are outside the display area (${context.displayWidth}x${context.displayHeight})`;\n case ErrorCode.RPC_TRANSPORT_ERROR: {\n const kind = context.kind;\n switch (kind) {\n case 'peer_closed':\n return 'The container closed the WebSocket mid-call (likely a container restart, eviction, or crash). Retry the call — the SDK will open a fresh connection.';\n case 'connection_failed':\n return 'The WebSocket connection failed. Retry the call; if the failure persists, check container health and network connectivity.';\n case 'upgrade_failed':\n return 'The WebSocket upgrade was rejected by the container. Verify the container is running and reachable on the configured port.';\n case 'invalid_frame':\n return 'The container sent a frame the RPC transport cannot handle. This usually indicates a version mismatch between the SDK and the container image.';\n case 'protocol_error':\n return 'The peer sent a malformed RPC message (capnweb could not parse the wire format). This usually indicates a version mismatch between the SDK and the container image.';\n case 'session_disposed':\n return 'The RPC session was disposed while a call was in flight. Avoid reusing stubs after disconnect(); the next method call will reconnect automatically.';\n default:\n return 'The RPC transport raised an error. Retry the call — the SDK will open a fresh connection.';\n }\n }\n // Generic fallback for other errors\n default:\n return undefined;\n }\n}\n"],"mappings":";;;;;AAIA,MAAa,YAAY;CAErB,gBAAgB;CAEhB,mBAAmB;CAEnB,aAAa;CAEb,cAAc;CACd,eAAe;CAEf,gBAAgB;CAEhB,UAAU;CACV,gBAAgB;CAChB,eAAe;CACf,WAAW;CACX,eAAe;CACf,gBAAgB;CAChB,kBAAkB;CAElB,mBAAmB;CAEnB,2BAA2B;CAC3B,iBAAiB;CAEjB,yBAAyB;CACzB,oBAAoB;CAEpB,mBAAmB;CAEnB,2BAA2B;CAC3B,eAAe;CAEf,w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ACX,QAAO;EACX,KAAK,UAAU,qBACX,QAAO,4BAA4B,QAAQ,UAAU,gBAAgB;EACzE,KAAK,UAAU,oBACX,QAAO;EACX,KAAK,UAAU,wBACX,QAAO,oBAAoB,QAAQ,eAAe;EACtD,KAAK,UAAU,wBACX,QAAO,4BAA4B,QAAQ,OAAO;EACtD,KAAK,UAAU,4BACX,QAAO,gBAAgB,QAAQ,EAAE,IAAI,QAAQ,EAAE,kCAAkC,QAAQ,aAAa,GAAG,QAAQ,cAAc;EACnI,KAAK,UAAU,oBAEX,SADa,QAAQ,MACrB;GACI,KAAK,cACD,QAAO;GACX,KAAK,oBACD,QAAO;GACX,KAAK,iBACD,QAAO;GACX,KAAK,gBACD,QAAO;GACX,KAAK,iBACD,QAAO;GACX,KAAK,mBACD,QAAO;GACX,QACI,QAAO;;EAInB,QACI"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as BucketProvider, A as DesktopStopResponse, At as RestoreBackupResult, B as ExecuteResponse, Bt as ExecuteRequest, C as ClickOptions, Ct as ProcessKillResult, D as DesktopStartOptions, Dt as ProcessStartResult, E as DesktopClient, Et as ProcessOptions, F as ScreenshotRegion, Ft as WaitForPortOptions, G as HttpClientOptions, Gt as CreateContextOptions, H as BaseApiResponse, Ht as StartProcessRequest, I as ScreenshotResponse, It as WatchOptions, J as SessionRequest, Jt as RunCodeOptions, K as RequestConfig, Kt as Execution, L as ScrollDirection, Lt as isExecResult, M as ScreenSizeResponse, Mt as SessionOptions, N as ScreenshotBytesResponse, Nt as StreamOptions, O as DesktopStartResponse, Ot as ProcessStatus, P as ScreenshotOptions, Pt as WaitForLogResult, Q as BucketCredentials, R as TypeOptions, Rt as isProcess, S as WriteFileRequest, St as ProcessInfoResult, T as Desktop, Tt as ProcessLogsResult, U as ContainerStub, Ut as PtyOptions, V as BackupClient, Vt as ExposePortRequest, W as ErrorResponse, Wt as CodeContext, X as BackupOptions, Y as SandboxInterpreterAPI, Z as BaseExecOptions, _ as GitClient, _t as PortCloseResult, a as CreateSessionRequest, at as ExecResult, b as MkdirRequest, bt as Process, c as DeleteSessionResponse, ct as FileMetadata, d as ProcessClient, dt as GitCheckoutResult, et as CheckChangesOptions, f as PortClient, ft as ISandbox, g as GitCheckoutRequest, gt as MountBucketOptions, h as InterpreterClient, ht as LogEvent, i as CommandsResponse, it as ExecOptions, j as KeyInput, jt as SandboxOptions, k as DesktopStatusResponse, kt as RemoteMountBucketOptions, l as PingResponse, lt as FileStreamEvent, m as ExecutionCallbacks, mt as LocalMountBucketOptions, n as getSandbox, nt as DirectoryBackup, o as CreateSessionResponse, ot as ExecutionSession, p as UnexposePortRequest, pt as ListFilesOptions, q as ResponseHandler, qt as ExecutionResult, r as SandboxClient, rt as ExecEvent, s as DeleteSessionRequest, st as FileChunk, t as Sandbox, tt as CheckChangesResult, u as UtilityClient, ut as FileWatchSSEEvent, v as FileClient, vt as PortExposeResult, w as CursorPositionResponse, wt as ProcessListResult, x as ReadFileRequest, xt as ProcessCleanupResult, y as FileOperationRequest, yt as PortListResult, z as CommandClient, zt as isProcessStatus } from "./sandbox-Bb3n0SeC.js";
2
- import { a as DesktopCoordinateErrorContext, d as SessionTerminatedContext, f as ErrorResponse$1, i as BackupRestoreContext, l as ProcessExitedBeforeReadyContext, m as ErrorCode, n as BackupExpiredContext, o as DesktopErrorContext, p as OperationType, r as BackupNotFoundContext, s as InvalidBackupConfigContext, t as BackupCreateContext, u as ProcessReadyTimeoutContext } from "./contexts-D6kt6WyG.js";
1
+ import { $ as BackupOptions, A as DesktopStopResponse, At as ProcessStartResult, B as ExecuteResponse, Bt as WatchOptions, C as ClickOptions, Ct as Process, D as DesktopStartOptions, Dt as ProcessListResult, E as DesktopClient, Et as ProcessKillResult, F as ScreenshotRegion, Ft as SandboxTransport, G as HttpClientOptions, Gt as CodeContext, H as BaseApiResponse, Ht as isProcess, I as ScreenshotResponse, It as SessionOptions, J as SessionRequest, Jt as ExecutionResult, K as RequestConfig, Kt as CreateContextOptions, L as ScrollDirection, Lt as StreamOptions, M as ScreenSizeResponse, Mt as RemoteMountBucketOptions, N as ScreenshotBytesResponse, Nt as RestoreBackupResult, O as DesktopStartResponse, Ot as ProcessLogsResult, P as ScreenshotOptions, Pt as SandboxOptions, Q as StartProcessRequest, R as TypeOptions, Rt as WaitForLogResult, S as WriteFileRequest, St as PortListResult, T as Desktop, Tt as ProcessInfoResult, U as ContainerStub, Ut as isProcessStatus, V as BackupClient, Vt as isExecResult, W as ErrorResponse, Wt as PtyOptions, X as ExecuteRequest, Y as SandboxInterpreterAPI, Yt as RunCodeOptions, Z as ExposePortRequest, _ as GitClient, _t as LocalMountBucketOptions, a as CreateSessionRequest, at as DirectoryBackup, b as MkdirRequest, bt as PortCloseResult, c as DeleteSessionResponse, ct as ExecResult, d as ProcessClient, dt as FileMetadata, et as BaseExecOptions, f as PortClient, ft as FileStreamEvent, g as GitCheckoutRequest, gt as ListFilesOptions, h as InterpreterClient, ht as ISandbox, i as CommandsResponse, it as CheckChangesResult, j as KeyInput, jt as ProcessStatus, k as DesktopStatusResponse, kt as ProcessOptions, l as PingResponse, lt as ExecutionSession, m as ExecutionCallbacks, mt as GitCheckoutResult, n as getSandbox, nt as BucketProvider, o as CreateSessionResponse, ot as ExecEvent, p as UnexposePortRequest, pt as FileWatchSSEEvent, q as ResponseHandler, qt as Execution, r as SandboxClient, rt as CheckChangesOptions, s as DeleteSessionRequest, st as ExecOptions, t as Sandbox, tt as BucketCredentials, u as UtilityClient, ut as FileChunk, v as FileClient, vt as LogEvent, w as CursorPositionResponse, wt as ProcessCleanupResult, x as ReadFileRequest, xt as PortExposeResult, y as FileOperationRequest, yt as MountBucketOptions, z as CommandClient, zt as WaitForPortOptions } from "./sandbox-CW4QeITP.js";
2
+ import { a as DesktopCoordinateErrorContext, d as RPCTransportContext, f as RPCTransportErrorKind, g as ErrorCode, h as OperationType, i as BackupRestoreContext, l as ProcessExitedBeforeReadyContext, m as ErrorResponse$1, n as BackupExpiredContext, o as DesktopErrorContext, p as SessionTerminatedContext, r as BackupNotFoundContext, s as InvalidBackupConfigContext, t as BackupCreateContext, u as ProcessReadyTimeoutContext } from "./contexts-D_shbnJs.js";
3
3
  import { ContainerProxy } from "@cloudflare/containers";
4
4
 
5
5
  //#region src/errors/classes.d.ts
@@ -10,7 +10,9 @@ import { ContainerProxy } from "@cloudflare/containers";
10
10
  */
11
11
  declare class SandboxError<TContext = Record<string, unknown>> extends Error {
12
12
  readonly errorResponse: ErrorResponse$1<TContext>;
13
- constructor(errorResponse: ErrorResponse$1<TContext>);
13
+ constructor(errorResponse: ErrorResponse$1<TContext>, options?: {
14
+ cause?: unknown;
15
+ });
14
16
  get code(): ErrorCode;
15
17
  get context(): TContext;
16
18
  get httpStatus(): number;
@@ -118,6 +120,25 @@ declare class DesktopInvalidOptionsError extends SandboxError<DesktopErrorContex
118
120
  declare class DesktopInvalidCoordinatesError extends SandboxError<DesktopCoordinateErrorContext> {
119
121
  constructor(errorResponse: ErrorResponse$1<DesktopCoordinateErrorContext>);
120
122
  }
123
+ /**
124
+ * Raised when the capnweb WebSocket session itself fails on the SDK side.
125
+ * Unlike the rest of the SandboxError tree, the container never produces
126
+ * this error — it is synthesised by `translateRPCError` from the plain
127
+ * Errors capnweb / DeferredTransport raise when the connection dies.
128
+ *
129
+ * `kind` distinguishes the failure mode (peer close, upgrade failed, etc.)
130
+ * so callers can branch on a structured code instead of substring-matching
131
+ * on the message.
132
+ *
133
+ * Always retryable: the SDK opens a fresh connection on the next call.
134
+ */
135
+ declare class RPCTransportError extends SandboxError<RPCTransportContext> {
136
+ constructor(errorResponse: ErrorResponse$1<RPCTransportContext>, options?: {
137
+ cause?: unknown;
138
+ });
139
+ get kind(): RPCTransportErrorKind;
140
+ get originalMessage(): string;
141
+ }
121
142
  //#endregion
122
143
  //#region src/file-stream.d.ts
123
144
  /**
@@ -266,5 +287,5 @@ declare class InvalidMountConfigError extends BucketMountError {
266
287
  constructor(message: string);
267
288
  }
268
289
  //#endregion
269
- export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, type BackupOptions, BackupRestoreError, type BaseApiResponse, type BaseExecOptions, type BucketCredentials, BucketMountError, type BucketProvider, BucketUnmountError, type CheckChangesOptions, type CheckChangesResult, type ClickOptions, type CodeContext, CodeInterpreter, CommandClient, type ExecuteResponse as CommandExecuteResponse, type CommandsResponse, ContainerProxy, type ContainerStub, type CreateContextOptions, type CreateSessionRequest, type CreateSessionResponse, type CursorPositionResponse, type DeleteSessionRequest, type DeleteSessionResponse, type Desktop, DesktopClient, DesktopInvalidCoordinatesError, DesktopInvalidOptionsError, DesktopNotStartedError, DesktopProcessCrashedError, DesktopStartFailedError, type DesktopStartOptions, type DesktopStartResponse, type DesktopStatusResponse, type DesktopStopResponse, DesktopUnavailableError, type DirectoryBackup, type ErrorResponse, type ExecEvent, type ExecOptions, type ExecResult, type ExecuteRequest, type ExecutionCallbacks, type ExecutionResult, type ExecutionSession, type ExposePortRequest, type FileChunk, FileClient, type FileMetadata, type FileOperationRequest, type FileStreamEvent, type FileWatchSSEEvent, type GitCheckoutRequest, type GitCheckoutResult, GitClient, type ISandbox, type InterpreterClient, InvalidBackupConfigError, InvalidMountConfigError, type KeyInput, type ListFilesOptions, type LocalMountBucketOptions, type LogEvent, MissingCredentialsError, type MkdirRequest, type MountBucketOptions, type PingResponse, PortClient, type PortCloseResult, type PortExposeResult, type PortListResult, type Process, type ProcessCleanupResult, ProcessClient, ProcessExitedBeforeReadyError, type ProcessInfoResult, type ProcessKillResult, type ProcessListResult, type ProcessLogsResult, type ProcessOptions, ProcessReadyTimeoutError, type ProcessStartResult, type ProcessStatus, type PtyOptions, type ReadFileRequest, type RemoteMountBucketOptions, type RequestConfig, type ResponseHandler, type RestoreBackupResult, type RouteInfo, type RunCodeOptions, S3FSMountError, Sandbox, SandboxClient, type HttpClientOptions as SandboxClientOptions, type SandboxEnv, type SandboxOptions, type ScreenSizeResponse, type ScreenshotBytesResponse, type ScreenshotOptions, type ScreenshotRegion, type ScreenshotResponse, type ScrollDirection, type SessionOptions, type SessionRequest, SessionTerminatedError, type StartProcessRequest, type StreamOptions, type TypeOptions, type UnexposePortRequest, UtilityClient, type WaitForLogResult, type WaitForPortOptions, type WatchOptions, type WriteFileRequest, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
290
+ export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, type BackupOptions, BackupRestoreError, type BaseApiResponse, type BaseExecOptions, type BucketCredentials, BucketMountError, type BucketProvider, BucketUnmountError, type CheckChangesOptions, type CheckChangesResult, type ClickOptions, type CodeContext, CodeInterpreter, CommandClient, type ExecuteResponse as CommandExecuteResponse, type CommandsResponse, ContainerProxy, type ContainerStub, type CreateContextOptions, type CreateSessionRequest, type CreateSessionResponse, type CursorPositionResponse, type DeleteSessionRequest, type DeleteSessionResponse, type Desktop, DesktopClient, DesktopInvalidCoordinatesError, DesktopInvalidOptionsError, DesktopNotStartedError, DesktopProcessCrashedError, DesktopStartFailedError, type DesktopStartOptions, type DesktopStartResponse, type DesktopStatusResponse, type DesktopStopResponse, DesktopUnavailableError, type DirectoryBackup, type ErrorResponse, type ExecEvent, type ExecOptions, type ExecResult, type ExecuteRequest, type ExecutionCallbacks, type ExecutionResult, type ExecutionSession, type ExposePortRequest, type FileChunk, FileClient, type FileMetadata, type FileOperationRequest, type FileStreamEvent, type FileWatchSSEEvent, type GitCheckoutRequest, type GitCheckoutResult, GitClient, type ISandbox, type InterpreterClient, InvalidBackupConfigError, InvalidMountConfigError, type KeyInput, type ListFilesOptions, type LocalMountBucketOptions, type LogEvent, MissingCredentialsError, type MkdirRequest, type MountBucketOptions, type PingResponse, PortClient, type PortCloseResult, type PortExposeResult, type PortListResult, type Process, type ProcessCleanupResult, ProcessClient, ProcessExitedBeforeReadyError, type ProcessInfoResult, type ProcessKillResult, type ProcessListResult, type ProcessLogsResult, type ProcessOptions, ProcessReadyTimeoutError, type ProcessStartResult, type ProcessStatus, type PtyOptions, type RPCTransportContext, RPCTransportError, type RPCTransportErrorKind, type ReadFileRequest, type RemoteMountBucketOptions, type RequestConfig, type ResponseHandler, type RestoreBackupResult, type RouteInfo, type RunCodeOptions, S3FSMountError, Sandbox, SandboxClient, type HttpClientOptions as SandboxClientOptions, type SandboxEnv, type SandboxOptions, type SandboxTransport, type ScreenSizeResponse, type ScreenshotBytesResponse, type ScreenshotOptions, type ScreenshotRegion, type ScreenshotResponse, type ScrollDirection, type SessionOptions, type SessionRequest, SessionTerminatedError, type StartProcessRequest, type StreamOptions, type TypeOptions, type UnexposePortRequest, UtilityClient, type WaitForLogResult, type WaitForPortOptions, type WatchOptions, type WriteFileRequest, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
270
291
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/errors/classes.ts","../src/file-stream.ts","../src/interpreter.ts","../src/pty/proxy.ts","../src/request-handler.ts","../src/sse-parser.ts","../src/storage-mount/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAiD0D,cAD7C,YAC6C,CAAA,WADrB,MACqB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,SADY,KAAA,CACZ;EAS7C,SAAA,aAAA,EATgC,eAShC,CAT8C,QAS9C,CAAA;EAAA,WAAA,CAAA,aAAA,EATgC,eAShC,CAT8C,QAS9C,CAAA;EAME,IAAA,IAAA,CAAA,CAAA,EAf2C,SAe3C;iBANF;;EAVyD,IAAA,SAAA,CAAA,CAAA,EAUzD,aAAA,GAVyD,SAAA;EAAK,IAAA,UAAA,CAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAoQ9D,IAAA,SAAA,CAAA,CAAA,EAAA,MAAA;EAA4C,IAAA,aAAA,CAAA,CAAA,EAAA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gBAAA,SAAyB,KAAA,CNuCU;EAiBnC,SAAA,IAAA,EMvDW,SNuDX;EAAA,WAAA,CAAA,OAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EMrDwB,SNqDxB;;;;;AAnB8D,cMxB9D,cAAA,SAAuB,gBAAA,CNwBuC;EA6Q9D,WAAA,CAAA,OAAA,EAAA,MAAuB;;;;;AAAoB,cM3R3C,kBAAA,SAA2B,gBAAA,CN2RgB;EA6X3C,WAAA,CAAA,OAAA,EAAA,MAAyB;;;;;AAAoB,cM9oB7C,uBAAA,SAAgC,gBAAA,CN8oBa;EAwB7C,WAAA,CAAA,OAAA,EAAA,MAAA;;;;;AAAkD,cM5pBlD,uBAAA,SAAgC,gBAAA,CN4pBkB;EA4BlD,WAAA,CAAA,OAAA,EAAA,MAAoB"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as isExecResult, o as isProcess, s as isProcessStatus } from "./dist-B_eXrP83.js";
2
- import "./errors-LE3HHcRb.js";
3
- import { A as DesktopInvalidOptionsError, C as CommandClient, D as BackupNotFoundError, E as BackupExpiredError, F as InvalidBackupConfigError, I as ProcessExitedBeforeReadyError, L as ProcessReadyTimeoutError, M as DesktopProcessCrashedError, N as DesktopStartFailedError, O as BackupRestoreError, P as DesktopUnavailableError, R as SessionTerminatedError, S as DesktopClient, T as BackupCreateError, _ as UtilityClient, a as BucketMountError, b as GitClient, c as MissingCredentialsError, d as parseSSEStream, f as responseToAsyncIterable, g as SandboxClient, h as streamFile, i as proxyTerminal, j as DesktopNotStartedError, k as DesktopInvalidCoordinatesError, l as S3FSMountError, m as collectFile, n as getSandbox, o as BucketUnmountError, p as CodeInterpreter, r as proxyToSandbox, s as InvalidMountConfigError, t as Sandbox, u as asyncIterableToSSEStream, v as ProcessClient, w as BackupClient, x as FileClient, y as PortClient } from "./sandbox-PAYx1CcU.js";
2
+ import "./errors-CBi-O-pF.js";
3
+ import { A as DesktopInvalidOptionsError, C as CommandClient, D as BackupNotFoundError, E as BackupExpiredError, F as InvalidBackupConfigError, I as ProcessExitedBeforeReadyError, L as ProcessReadyTimeoutError, M as DesktopProcessCrashedError, N as DesktopStartFailedError, O as BackupRestoreError, P as DesktopUnavailableError, R as RPCTransportError, S as DesktopClient, T as BackupCreateError, _ as UtilityClient, a as BucketMountError, b as GitClient, c as MissingCredentialsError, d as parseSSEStream, f as responseToAsyncIterable, g as SandboxClient, h as streamFile, i as proxyTerminal, j as DesktopNotStartedError, k as DesktopInvalidCoordinatesError, l as S3FSMountError, m as collectFile, n as getSandbox, o as BucketUnmountError, p as CodeInterpreter, r as proxyToSandbox, s as InvalidMountConfigError, t as Sandbox, u as asyncIterableToSSEStream, v as ProcessClient, w as BackupClient, x as FileClient, y as PortClient, z as SessionTerminatedError } from "./sandbox-BAuU-2a0.js";
4
4
  import { ContainerProxy } from "@cloudflare/containers";
5
5
 
6
- export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, BackupRestoreError, BucketMountError, BucketUnmountError, CodeInterpreter, CommandClient, ContainerProxy, DesktopClient, DesktopInvalidCoordinatesError, DesktopInvalidOptionsError, DesktopNotStartedError, DesktopProcessCrashedError, DesktopStartFailedError, DesktopUnavailableError, FileClient, GitClient, InvalidBackupConfigError, InvalidMountConfigError, MissingCredentialsError, PortClient, ProcessClient, ProcessExitedBeforeReadyError, ProcessReadyTimeoutError, S3FSMountError, Sandbox, SandboxClient, SessionTerminatedError, UtilityClient, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
6
+ export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, BackupRestoreError, BucketMountError, BucketUnmountError, CodeInterpreter, CommandClient, ContainerProxy, DesktopClient, DesktopInvalidCoordinatesError, DesktopInvalidOptionsError, DesktopNotStartedError, DesktopProcessCrashedError, DesktopStartFailedError, DesktopUnavailableError, FileClient, GitClient, InvalidBackupConfigError, InvalidMountConfigError, MissingCredentialsError, PortClient, ProcessClient, ProcessExitedBeforeReadyError, ProcessReadyTimeoutError, RPCTransportError, S3FSMountError, Sandbox, SandboxClient, SessionTerminatedError, UtilityClient, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
@@ -1,4 +1,4 @@
1
- import { t as Sandbox } from "../sandbox-Bb3n0SeC.js";
1
+ import { t as Sandbox } from "../sandbox-CW4QeITP.js";
2
2
  import { ApplyPatchOperation, ApplyPatchResult, Editor as Editor$1, Shell as Shell$1, ShellAction, ShellResult } from "@openai/agents";
3
3
 
4
4
  //#region src/openai/index.d.ts
@@ -1,5 +1,5 @@
1
- import { t as Sandbox } from "../sandbox-Bb3n0SeC.js";
2
- import { c as OpencodeStartupContext } from "../contexts-D6kt6WyG.js";
1
+ import { t as Sandbox } from "../sandbox-CW4QeITP.js";
2
+ import { c as OpencodeStartupContext } from "../contexts-D_shbnJs.js";
3
3
  import { OpencodeClient } from "@opencode-ai/sdk/v2/client";
4
4
  import { Config } from "@opencode-ai/sdk/v2";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/opencode/types.ts","../../src/opencode/opencode.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAOiB,UAAA,eAAA,CAAe;EAcf;EAaA,IAAA,CAAA,EAAA,MAAA;EAAyB;EAEhC,SAAA,CAAA,EAAA,MAAA;EAEA;EAAc,MAAA,CAAA,EAzBb,MAyBa;EAMX;EAEc,GAAA,CAAA,EA/BnB,MA+BmB,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;UAzBV,cAAA;;;ECsSK;EACX,GAAA,EAAA,MAAA;EACC;EACD,KAAA,EAAA,EDnSA,OCmSA,CAAA,IAAA,CAAA;;;AAqEX;;;AAEY,UDnWK,cCmWL,CAAA,UDnW8B,cCmW9B,CAAA,CAAA;EACc;EAAf,MAAA,EDlW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AA,UDnW8B,cCmW9B,CAAA,CAAA;EACc;EAAf,MAAA,EDlWD,OCkWC;EAAR;EAAO,MAAA,EDhWA,cCgWA;AA0BV;;;;AAIW,cDxXE,oBAAA,SAA6B,KAAA,CCwX/B;EAAR,SAAA,IAAA,EAAA,yBAAA;EAAO,SAAA,OAAA,EDtXiB,sBCsXjB;EAmDM,WAAA,CAAA,OAAe,EAAA,MAAA,EAAA,OAAA,EDralB,sBCqakB,EAAA,OAAA,CAAA,EDpajB,YCoaiB;;;;;;;ADhd/B;AAcA;AAaA;;;;;AAUA;;;;;;;;;AC+QA;;;;;;AAwEA;;;;;;;;AA6BA;;;;;;;AAuDA;;;;;;AAIc,iBAhKQ,oBAAA,CAgKR,OAAA,EA/JH,OA+JG,CAAA,OAAA,CAAA,EAAA,OAAA,CAAA,EA9JF,eA8JE,CAAA,EA7JX,OA6JW,CA7JH,cA6JG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAxFQ,yBAAyB,yBACpC,4BACC,kBACT,QAAQ,eAAe;;;;;;;;iBA0BV,qBAAA,UACL,kBACA,0BACD,iBACP,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmDK,eAAA,UACL,kBACA,0BACD,iBACP,WAAW,QAAQ"}
@@ -1,5 +1,5 @@
1
1
  import { u as createLogger } from "../dist-B_eXrP83.js";
2
- import { n as ErrorCode } from "../errors-LE3HHcRb.js";
2
+ import { r as ErrorCode } from "../errors-CBi-O-pF.js";
3
3
 
4
4
  //#region src/opencode/types.ts
5
5
  /**