@cloudflare/sandbox 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Dockerfile CHANGED
@@ -97,13 +97,19 @@ ENV DEBIAN_FRONTEND=noninteractive
97
97
 
98
98
  ENV SANDBOX_VERSION=${SANDBOX_VERSION}
99
99
 
100
- # Install runtime packages and S3FS-FUSE for bucket mounting
100
+ # Install runtime packages, S3FS-FUSE for bucket mounting, and snapshot tools
101
+ # - fuse3: FUSE filesystem support (replaces legacy fuse, needed by s3fs/squashfuse/fuse-overlayfs)
102
+ # - squashfs-tools: create squashfs archives (mksquashfs)
103
+ # - squashfuse: mount squashfs in userspace (FUSE)
104
+ # - fuse-overlayfs: userspace overlayfs for copy-on-write snapshots
105
+ # Cache-bust: 2 - Clear apt cache to force fresh package list
101
106
  RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
102
107
  --mount=type=cache,target=/var/lib/apt,sharing=locked \
103
108
  rm -f /etc/apt/apt.conf.d/docker-clean && \
104
109
  echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
110
+ rm -rf /var/cache/apt/* /var/lib/apt/lists/* && \
105
111
  apt-get update && apt-get install -y --no-install-recommends \
106
- s3fs fuse \
112
+ s3fs fuse3 squashfs-tools squashfuse fuse-overlayfs \
107
113
  ca-certificates curl wget procps git unzip zip jq file \
108
114
  libssl3 zlib1g libbz2-1.0 libreadline8 libsqlite3-0 \
109
115
  libncursesw6 libtinfo6 libxml2 libxmlsec1 libffi8 liblzma5 libtk8.6 && \
@@ -45,6 +45,11 @@ declare const ErrorCode: {
45
45
  readonly S3FS_MOUNT_ERROR: "S3FS_MOUNT_ERROR";
46
46
  readonly MISSING_CREDENTIALS: "MISSING_CREDENTIALS";
47
47
  readonly INVALID_MOUNT_CONFIG: "INVALID_MOUNT_CONFIG";
48
+ readonly BACKUP_CREATE_FAILED: "BACKUP_CREATE_FAILED";
49
+ readonly BACKUP_RESTORE_FAILED: "BACKUP_RESTORE_FAILED";
50
+ readonly BACKUP_NOT_FOUND: "BACKUP_NOT_FOUND";
51
+ readonly BACKUP_EXPIRED: "BACKUP_EXPIRED";
52
+ readonly INVALID_BACKUP_CONFIG: "INVALID_BACKUP_CONFIG";
48
53
  readonly INTERPRETER_NOT_READY: "INTERPRETER_NOT_READY";
49
54
  readonly CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND";
50
55
  readonly CODE_EXECUTION_ERROR: "CODE_EXECUTION_ERROR";
@@ -87,6 +92,9 @@ declare const Operation: {
87
92
  readonly GIT_CLONE: "git.clone";
88
93
  readonly GIT_CHECKOUT: "git.checkout";
89
94
  readonly GIT_OPERATION: "git.operation";
95
+ readonly BACKUP_CREATE: "backup.create";
96
+ readonly BACKUP_RESTORE: "backup.restore";
97
+ readonly BACKUP_UNMOUNT: "backup.unmount";
90
98
  readonly CODE_EXECUTE: "code.execute";
91
99
  readonly CODE_CONTEXT_CREATE: "code.context.create";
92
100
  readonly CODE_CONTEXT_DELETE: "code.context.delete";
@@ -149,6 +157,31 @@ interface ProcessExitedBeforeReadyContext {
149
157
  condition: string;
150
158
  exitCode: number;
151
159
  }
160
+ /**
161
+ * Backup error contexts
162
+ */
163
+ interface BackupCreateContext {
164
+ dir: string;
165
+ backupId?: string;
166
+ stderr?: string;
167
+ exitCode?: number;
168
+ }
169
+ interface BackupRestoreContext {
170
+ dir: string;
171
+ backupId: string;
172
+ stderr?: string;
173
+ exitCode?: number;
174
+ }
175
+ interface BackupNotFoundContext {
176
+ backupId: string;
177
+ }
178
+ interface BackupExpiredContext {
179
+ backupId: string;
180
+ expiredAt?: string;
181
+ }
182
+ interface InvalidBackupConfigContext {
183
+ reason: string;
184
+ }
152
185
  /**
153
186
  * OpenCode error contexts
154
187
  */
@@ -158,5 +191,5 @@ interface OpencodeStartupContext {
158
191
  command?: string;
159
192
  }
160
193
  //#endregion
161
- export { OperationType as a, ErrorResponse as i, ProcessExitedBeforeReadyContext as n, ErrorCode as o, ProcessReadyTimeoutContext as r, OpencodeStartupContext as t };
162
- //# sourceMappingURL=contexts-uY_burk0.d.ts.map
194
+ export { InvalidBackupConfigContext as a, ProcessReadyTimeoutContext as c, ErrorCode as d, BackupRestoreContext as i, ErrorResponse as l, BackupExpiredContext as n, OpencodeStartupContext as o, BackupNotFoundContext as r, ProcessExitedBeforeReadyContext as s, BackupCreateContext as t, OperationType as u };
195
+ //# sourceMappingURL=contexts-BHx40XTT.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts-BHx40XTT.d.ts","names":["ErrorCode","ErrorCode","Operation","OperationType","ErrorResponse","TContext","Record","ServiceError","ServiceResult","T","OperationType","FileNotFoundContext","FileExistsContext","FileSystemContext","CommandNotFoundContext","CommandErrorContext","ProcessNotFoundContext","ProcessErrorContext","SessionAlreadyExistsContext","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"],"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 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 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 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 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};\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 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 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/**\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//# sourceMappingURL=contexts.d.ts.map"],"mappings":";;AAIA;AA4DA;;cA5DqBA;;ECAAE,SAAAA,iBA6BpB,EAAA,mBAAA;EACWC,SAAAA,WAAa,EAAA,aAAWD;EAKnBE,SAAAA,YAAa,EAAAC,cAAA;EAAYC,SAAAA,aAAAA,EAAAA,eAAAA;EAIhCL,SAAAA,QAAAA,EAAAA,UAAAA;EAQME,SAAAA,cAAAA,EAAAA,gBAAAA;EAKHE,SAAAA,aAAAA,EAAAA,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mBAAAA;;;;;;UAMAC,oBAAAA;;;;;;UAMAC,qBAAAA;;;UAGAC,oBAAAA;;;;UAIAC,0BAAAA;;;;;;UAMAC,sBAAAA"}
@@ -45,6 +45,11 @@ const ErrorCode = {
45
45
  S3FS_MOUNT_ERROR: "S3FS_MOUNT_ERROR",
46
46
  MISSING_CREDENTIALS: "MISSING_CREDENTIALS",
47
47
  INVALID_MOUNT_CONFIG: "INVALID_MOUNT_CONFIG",
48
+ BACKUP_CREATE_FAILED: "BACKUP_CREATE_FAILED",
49
+ BACKUP_RESTORE_FAILED: "BACKUP_RESTORE_FAILED",
50
+ BACKUP_NOT_FOUND: "BACKUP_NOT_FOUND",
51
+ BACKUP_EXPIRED: "BACKUP_EXPIRED",
52
+ INVALID_BACKUP_CONFIG: "INVALID_BACKUP_CONFIG",
48
53
  INTERPRETER_NOT_READY: "INTERPRETER_NOT_READY",
49
54
  CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND",
50
55
  CODE_EXECUTION_ERROR: "CODE_EXECUTION_ERROR",
@@ -97,6 +102,11 @@ const ERROR_STATUS_MAP = {
97
102
  [ErrorCode.SESSION_ALREADY_EXISTS]: 409,
98
103
  [ErrorCode.SERVICE_NOT_RESPONDING]: 502,
99
104
  [ErrorCode.GIT_NETWORK_ERROR]: 502,
105
+ [ErrorCode.BACKUP_NOT_FOUND]: 404,
106
+ [ErrorCode.BACKUP_EXPIRED]: 400,
107
+ [ErrorCode.INVALID_BACKUP_CONFIG]: 400,
108
+ [ErrorCode.BACKUP_CREATE_FAILED]: 500,
109
+ [ErrorCode.BACKUP_RESTORE_FAILED]: 500,
100
110
  [ErrorCode.PYTHON_NOT_AVAILABLE]: 501,
101
111
  [ErrorCode.JAVASCRIPT_NOT_AVAILABLE]: 501,
102
112
  [ErrorCode.INTERPRETER_NOT_READY]: 503,
@@ -123,4 +133,4 @@ const ERROR_STATUS_MAP = {
123
133
 
124
134
  //#endregion
125
135
  export { ErrorCode as t };
126
- //# sourceMappingURL=errors-Bzl0ZNia.js.map
136
+ //# sourceMappingURL=errors-CYUY62c6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-CYUY62c6.js","names":[],"sources":["../../shared/dist/errors/codes.js","../../shared/dist/errors/status-map.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 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 // 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 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 // 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};\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 // 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 // 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 // 503 Service Unavailable\n [ErrorCode.INTERPRETER_NOT_READY]: 503,\n [ErrorCode.OPENCODE_STARTUP_FAILED]: 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.S3FS_MOUNT_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"],"mappings":";;;;;AAIA,MAAa,YAAY;CAErB,gBAAgB;CAEhB,mBAAmB;CAEnB,aAAa;CAEb,cAAc;CACd,eAAe;CAEf,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,wBAAwB;CAExB,sBAAsB;CACtB,aAAa;CAEb,kBAAkB;CAElB,qBAAqB;CACrB,cAAc;CAEd,wBAAwB;CACxB,sBAAsB;CAEtB,wBAAwB;CAExB,0BAA0B;CAC1B,sBAAsB;CAEtB,iBAAiB;CAEjB,mBAAmB;CAEnB,iBAAiB;CAEjB,kBAAkB;CAClB,qBAAqB;CACrB,sBAAsB;CAEtB,oBAAoB;CACpB,kBAAkB;CAClB,qBAAqB;CACrB,sBAAsB;CAEtB,sBAAsB;CACtB,uBAAuB;CAEvB,kBAAkB;CAElB,gBAAgB;CAChB,uBAAuB;CAEvB,uBAAuB;CAEvB,mBAAmB;CA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,mBAAmB;EAC7B,UAAU,sBAAsB;EAChC,UAAU,uBAAuB;EACjC,UAAU,uBAAuB;EACjC,UAAU,qBAAqB;EAC/B,UAAU,mBAAmB;EAC7B,UAAU,gBAAgB;EAC1B,UAAU,iBAAiB;CAC/B"}
package/dist/index.d.ts CHANGED
@@ -1,46 +1,8 @@
1
- import { $ as ProcessKillResult, A as ResponseHandler, B as FileMetadata, C as CommandClient, D as ErrorResponse, E as ContainerStub, F as ExecEvent, G as LogEvent, H as GitCheckoutResult, I as ExecOptions, J as PortExposeResult, K as MountBucketOptions, L as ExecResult, M as BaseExecOptions, N as BucketCredentials, O as HttpClientOptions, P as BucketProvider, Q as ProcessInfoResult, R as ExecutionSession, S as WriteFileRequest, T as BaseApiResponse, U as ISandbox, V as FileStreamEvent, W as ListFilesOptions, X as Process, Y as PortListResult, Z as ProcessCleanupResult, _ as GitClient, _t as ExecutionResult, a as CreateSessionRequest, at as SandboxOptions, b as MkdirRequest, c as DeleteSessionResponse, ct as WaitForLogResult, d as ProcessClient, dt as isProcess, et as ProcessListResult, f as PortClient, ft as isProcessStatus, g as GitCheckoutRequest, gt as Execution, h as InterpreterClient, ht as CreateContextOptions, i as CommandsResponse, it as ProcessStatus, j as SessionRequest, k as RequestConfig, l as PingResponse, lt as WaitForPortOptions, m as ExecutionCallbacks, mt as CodeContext, n as getSandbox, nt as ProcessOptions, o as CreateSessionResponse, ot as SessionOptions, p as UnexposePortRequest, pt as PtyOptions, q as PortCloseResult, r as SandboxClient, rt as ProcessStartResult, s as DeleteSessionRequest, st as StreamOptions, t as Sandbox, tt as ProcessLogsResult, u as UtilityClient, ut as isExecResult, v as FileClient, vt as RunCodeOptions, w as ExecuteResponse, x as ReadFileRequest, y as FileOperationRequest, z as FileChunk } from "./sandbox-CgjQQZGw.js";
2
- import { a as OperationType, i as ErrorResponse$1, n as ProcessExitedBeforeReadyContext, o as ErrorCode, r as ProcessReadyTimeoutContext } from "./contexts-uY_burk0.js";
1
+ import { $ as Process, A as RequestConfig, B as ExecResult, C as CommandClient, Ct as Execution, D as ContainerStub, E as BaseApiResponse, F as BucketCredentials, G as GitCheckoutResult, H as FileChunk, I as BucketProvider, J as LogEvent, K as ISandbox, L as DirectoryBackup, M as SessionRequest, N as BackupOptions, O as ErrorResponse, P as BaseExecOptions, Q as PortListResult, R as ExecEvent, S as WriteFileRequest, St as CreateContextOptions, T as BackupClient, Tt as RunCodeOptions, U as FileMetadata, V as ExecutionSession, W as FileStreamEvent, X as PortCloseResult, Y as MountBucketOptions, Z as PortExposeResult, _ as GitClient, _t as ExecuteRequest, a as CreateSessionRequest, at as ProcessOptions, b as MkdirRequest, bt as PtyOptions, c as DeleteSessionResponse, ct as RestoreBackupResult, d as ProcessClient, dt as StreamOptions, et as ProcessCleanupResult, f as PortClient, ft as WaitForLogResult, g as GitCheckoutRequest, gt as isProcessStatus, h as InterpreterClient, ht as isProcess, i as CommandsResponse, it as ProcessLogsResult, j as ResponseHandler, k as HttpClientOptions, l as PingResponse, lt as SandboxOptions, m as ExecutionCallbacks, mt as isExecResult, n as getSandbox, nt as ProcessKillResult, o as CreateSessionResponse, ot as ProcessStartResult, p as UnexposePortRequest, pt as WaitForPortOptions, q as ListFilesOptions, r as SandboxClient, rt as ProcessListResult, s as DeleteSessionRequest, st as ProcessStatus, t as Sandbox, tt as ProcessInfoResult, u as UtilityClient, ut as SessionOptions, v as FileClient, vt as ExposePortRequest, w as ExecuteResponse, wt as ExecutionResult, x as ReadFileRequest, xt as CodeContext, y as FileOperationRequest, yt as StartProcessRequest, z as ExecOptions } from "./sandbox-8qsR1OnB.js";
2
+ import { a as InvalidBackupConfigContext, c as ProcessReadyTimeoutContext, d as ErrorCode, i as BackupRestoreContext, l as ErrorResponse$1, n as BackupExpiredContext, r as BackupNotFoundContext, s as ProcessExitedBeforeReadyContext, t as BackupCreateContext, u as OperationType } from "./contexts-BHx40XTT.js";
3
3
 
4
- //#region ../shared/dist/request-types.d.ts
5
-
6
- /**
7
- * Request types for API calls to the container
8
- * Single source of truth for the contract between SDK clients and container handlers
9
- */
10
- /**
11
- * Request to execute a command
12
- */
13
- interface ExecuteRequest {
14
- command: string;
15
- sessionId?: string;
16
- background?: boolean;
17
- timeoutMs?: number;
18
- env?: Record<string, string | undefined>;
19
- cwd?: string;
20
- }
21
- /**
22
- * Request to start a background process
23
- * Uses flat structure consistent with other endpoints
24
- */
25
- interface StartProcessRequest {
26
- command: string;
27
- sessionId?: string;
28
- processId?: string;
29
- timeoutMs?: number;
30
- env?: Record<string, string | undefined>;
31
- cwd?: string;
32
- encoding?: string;
33
- autoCleanup?: boolean;
34
- }
35
- /**
36
- * Request to expose a port
37
- */
38
- interface ExposePortRequest {
39
- port: number;
40
- name?: string;
41
- }
42
- //#endregion
43
4
  //#region src/errors/classes.d.ts
5
+
44
6
  /**
45
7
  * Base SDK error that wraps ErrorResponse
46
8
  * Preserves all error information from container
@@ -88,6 +50,44 @@ declare class ProcessExitedBeforeReadyError extends SandboxError<ProcessExitedBe
88
50
  get condition(): string;
89
51
  get exitCode(): number;
90
52
  }
53
+ /**
54
+ * Error thrown when a backup is not found in R2
55
+ */
56
+ declare class BackupNotFoundError extends SandboxError<BackupNotFoundContext> {
57
+ constructor(errorResponse: ErrorResponse$1<BackupNotFoundContext>);
58
+ get backupId(): string;
59
+ }
60
+ /**
61
+ * Error thrown when a backup has expired (past its TTL)
62
+ */
63
+ declare class BackupExpiredError extends SandboxError<BackupExpiredContext> {
64
+ constructor(errorResponse: ErrorResponse$1<BackupExpiredContext>);
65
+ get backupId(): string;
66
+ get expiredAt(): string | undefined;
67
+ }
68
+ /**
69
+ * Error thrown when backup configuration or inputs are invalid
70
+ */
71
+ declare class InvalidBackupConfigError extends SandboxError<InvalidBackupConfigContext> {
72
+ constructor(errorResponse: ErrorResponse$1<InvalidBackupConfigContext>);
73
+ get reason(): string;
74
+ }
75
+ /**
76
+ * Error thrown when backup creation fails
77
+ */
78
+ declare class BackupCreateError extends SandboxError<BackupCreateContext> {
79
+ constructor(errorResponse: ErrorResponse$1<BackupCreateContext>);
80
+ get dir(): string;
81
+ get backupId(): string | undefined;
82
+ }
83
+ /**
84
+ * Error thrown when backup restoration fails
85
+ */
86
+ declare class BackupRestoreError extends SandboxError<BackupRestoreContext> {
87
+ constructor(errorResponse: ErrorResponse$1<BackupRestoreContext>);
88
+ get dir(): string;
89
+ get backupId(): string;
90
+ }
91
91
  //#endregion
92
92
  //#region src/file-stream.d.ts
93
93
  /**
@@ -230,5 +230,5 @@ declare class InvalidMountConfigError extends BucketMountError {
230
230
  constructor(message: string);
231
231
  }
232
232
  //#endregion
233
- export { type BaseApiResponse, type BaseExecOptions, type BucketCredentials, BucketMountError, type BucketProvider, type CodeContext, CodeInterpreter, CommandClient, type ExecuteResponse as CommandExecuteResponse, type CommandsResponse, type ContainerStub, type CreateContextOptions, type CreateSessionRequest, type CreateSessionResponse, type DeleteSessionRequest, type DeleteSessionResponse, 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 GitCheckoutRequest, type GitCheckoutResult, GitClient, type ISandbox, type InterpreterClient, InvalidMountConfigError, type ListFilesOptions, 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 RequestConfig, type ResponseHandler, type RouteInfo, type RunCodeOptions, S3FSMountError, Sandbox, SandboxClient, type HttpClientOptions as SandboxClientOptions, type SandboxEnv, type SandboxOptions, type SessionOptions, type SessionRequest, type StartProcessRequest, type StreamOptions, type UnexposePortRequest, UtilityClient, type WaitForLogResult, type WaitForPortOptions, type WriteFileRequest, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
233
+ export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, type BackupOptions, BackupRestoreError, type BaseApiResponse, type BaseExecOptions, type BucketCredentials, BucketMountError, type BucketProvider, type CodeContext, CodeInterpreter, CommandClient, type ExecuteResponse as CommandExecuteResponse, type CommandsResponse, type ContainerStub, type CreateContextOptions, type CreateSessionRequest, type CreateSessionResponse, type DeleteSessionRequest, type DeleteSessionResponse, 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 GitCheckoutRequest, type GitCheckoutResult, GitClient, type ISandbox, type InterpreterClient, InvalidBackupConfigError, InvalidMountConfigError, type ListFilesOptions, 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 RequestConfig, type ResponseHandler, type RestoreBackupResult, type RouteInfo, type RunCodeOptions, S3FSMountError, Sandbox, SandboxClient, type HttpClientOptions as SandboxClientOptions, type SandboxEnv, type SandboxOptions, type SessionOptions, type SessionRequest, type StartProcessRequest, type StreamOptions, type UnexposePortRequest, UtilityClient, type WaitForLogResult, type WaitForPortOptions, type WriteFileRequest, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
234
234
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["ExecuteRequest","Record","StartProcessRequest","ReadFileRequest","WriteFileRequest","DeleteFileRequest","RenameFileRequest","MoveFileRequest","MkdirRequest","FileExistsRequest","ExposePortRequest","GitCheckoutRequest","ListFilesRequest","SessionCreateRequest","SessionDeleteRequest"],"sources":["../../shared/dist/request-types.d.ts","../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":["/**\n * Request types for API calls to the container\n * Single source of truth for the contract between SDK clients and container handlers\n */\n/**\n * Request to execute a command\n */\nexport interface ExecuteRequest {\n command: string;\n sessionId?: string;\n background?: boolean;\n timeoutMs?: number;\n env?: Record<string, string | undefined>;\n cwd?: string;\n}\n/**\n * Request to start a background process\n * Uses flat structure consistent with other endpoints\n */\nexport interface StartProcessRequest {\n command: string;\n sessionId?: string;\n processId?: string;\n timeoutMs?: number;\n env?: Record<string, string | undefined>;\n cwd?: string;\n encoding?: string;\n autoCleanup?: boolean;\n}\n/**\n * Request to read a file\n */\nexport interface ReadFileRequest {\n path: string;\n encoding?: string;\n sessionId?: string;\n}\n/**\n * Request to write a file\n */\nexport interface WriteFileRequest {\n path: string;\n content: string;\n encoding?: string;\n sessionId?: string;\n}\n/**\n * Request to delete a file\n */\nexport interface DeleteFileRequest {\n path: string;\n sessionId?: string;\n}\n/**\n * Request to rename a file\n */\nexport interface RenameFileRequest {\n oldPath: string;\n newPath: string;\n sessionId?: string;\n}\n/**\n * Request to move a file\n */\nexport interface MoveFileRequest {\n sourcePath: string;\n destinationPath: string;\n sessionId?: string;\n}\n/**\n * Request to create a directory\n */\nexport interface MkdirRequest {\n path: string;\n recursive?: boolean;\n sessionId?: string;\n}\n/**\n * Request to check if a file or directory exists\n */\nexport interface FileExistsRequest {\n path: string;\n sessionId?: string;\n}\n/**\n * Request to expose a port\n */\nexport interface ExposePortRequest {\n port: number;\n name?: string;\n}\n/**\n * Request to clone a Git repository\n */\nexport interface GitCheckoutRequest {\n repoUrl: string;\n branch?: string;\n targetDir?: string;\n sessionId?: string;\n /** Clone depth for shallow clones (e.g., 1 for latest commit only) */\n depth?: number;\n}\n/**\n * Request to list files in a directory\n */\nexport interface ListFilesRequest {\n path: string;\n options?: {\n recursive?: boolean;\n includeHidden?: boolean;\n };\n sessionId?: string;\n}\n/**\n * Request to create a session\n */\nexport interface SessionCreateRequest {\n id?: string;\n name?: string;\n env?: Record<string, string | undefined>;\n cwd?: string;\n}\n/**\n * Request to delete a session\n */\nexport interface SessionDeleteRequest {\n sessionId: string;\n}\n//# sourceMappingURL=request-types.d.ts.map"],"mappings":";;;;;;;;;AAOA;AAYA;AAoEA;UAhFiBA,cAAAA;;;EC+BJ,UAAA,CAAA,EAAA,OAAY;EAAY,SAAA,CAAA,EAAA,MAAA;EACsB,GAAA,CAAA,ED3BjDC,MC2BiD,CAAA,MAAA,EAAA,MAAA,GAAA,SAAA,CAAA;EAAd,GAAA,CAAA,EAAA,MAAA;;;;;;AAe9B,UDnCEC,mBAAAA,CCmCF;;;EAhBuD,SAAA,CAAA,EAAA,MAAA;EAAK,SAAA,CAAA,EAAA,MAAA;EA0kB9D,GAAA,CAAA,EDxlBHD,MCwlBG,CAAA,MAAA,EAAA,MAAyB,GAAA,SAAA,CAAA;EAAqB,GAAA,CAAA,EAAA,MAAA;EAChB,QAAA,CAAA,EAAA,MAAA;EAAd,WAAA,CAAA,EAAA,OAAA;;;;AI5mB7B;AAAsC,ULkFrBS,iBAAAA,CKlFqB;EAAe,IAAA,EAAA,MAAA;EACnB,IAAA,CAAA,EAAA,MAAA;;;;;;;AJgClC;AAAqC,cAAxB,YAAwB,CAAA,WAAA,MAAA,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,SAAiC,KAAA,CAAjC;EACsB,SAAA,aAAA,EAAd,eAAc,CAAA,QAAA,CAAA;EAAd,WA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A,EAAA,MAAA,EAAA,IAAA,CAAA,EMxBtB,SNwBsB;;;;;AAS9C,cMvBA,cAAA,SAAuB,gBAAA,CNuBvB;EAAA,WAAA,CAAA,OAAA,EAAA,MAAA;;;;;AAV8D,cMH9D,uBAAA,SAAgC,gBAAA,CNG8B;EA0kB9D,WAAA,CAAA,OAAA,EAAA,MAAyB;;;;;AAAoB,cMnkB7C,uBAAA,SAAgC,gBAAA,CNmkBa;EAwB7C,WAAA,CAAA,OAAA,EAAA,MAAA"}
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":";;;;;;;;;AAqDa,cAVA,YAUA,CAAA,WAVwB,MAUxB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,SAVyD,KAAA,CAUzD;EAAA,SAAA,aAAA,EATgC,eAShC,CAT8C,QAS9C,CAAA;EAME,WAAA,CAAA,aAAA,EAf8B,eAe9B,CAf4C,QAe5C,CAAA;cAf2C;iBAS7C;EAVyD,IAAA,UAAA,CAAA,CAAA,EAAA,MAAA;EAAK,IAAA,SAAA,CAAA,CAAA,EAU9D,aAAA,GAV8D,SAAA;EA0kB9D,IAAA,UAAA,CAAA,CAAA,EAAA,MAAA,GAAyB,SAAA;EAAqB,IAAA,SAAA,CAAA,CAAA,EAAA,MAAA;EAChB,IAAA,aAAA,CAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAd,MAAA,CAAA,CAAA,EAAA;IADiB,IAAA,EAAA,MAAA;IAAY,OAAA,EAAA,MAAA;IAwB7C,IAAA,EAllBE,SAklB4B;IAAqB,OAAA,UAAA;IACrB,UAAA,EAAA,MAAA;IAAd,SAAA,kBAAA,SAAA;IADsB,UAAA,EAAA,MAAA,GAAA,SAAA;IAAY,SAAA,EAAA,MAAA;IA4BlD,aAAA,EAAA,MAAoB,GAAA,S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