@cloudflare/sandbox 0.13.0-next.797.1 → 0.13.0-next.808.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/bridge/index.js +23 -14
- package/dist/bridge/index.js.map +1 -1
- package/dist/{contexts-1EsLHByO.d.ts → contexts-DNFVmC9N.d.ts} +4 -1
- package/dist/contexts-DNFVmC9N.d.ts.map +1 -0
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.js +2 -2
- package/dist/{errors-QYlSkVGz.js → errors--yR3zLC_.js} +2 -2
- package/dist/{errors-QYlSkVGz.js.map → errors--yR3zLC_.js.map} +1 -1
- package/dist/{errors-CXR0xBpw.js → errors-Bb3s6nBS.js} +7 -1
- package/dist/errors-Bb3s6nBS.js.map +1 -0
- package/dist/extensions/index.d.ts +2 -2
- package/dist/extensions/index.js +3 -3
- package/dist/{extensions-Be5HnDGt.js → extensions-038QzSIg.js} +7 -3
- package/dist/extensions-038QzSIg.js.map +1 -0
- package/dist/{filesystem-Y5aF3nmJ.d.ts → filesystem-Cd6xd_Pe.d.ts} +5 -1
- package/dist/filesystem-Cd6xd_Pe.d.ts.map +1 -0
- package/dist/git/index.d.ts +2 -2
- package/dist/git/index.js +3 -3
- package/dist/{index-HNYBk-az.d.ts → index-CfpTXmNv.d.ts} +2 -2
- package/dist/{index-HNYBk-az.d.ts.map → index-CfpTXmNv.d.ts.map} +1 -1
- package/dist/{index-DfXx3uZL.d.ts → index-Fbdwkfft.d.ts} +9 -3
- package/dist/index-Fbdwkfft.d.ts.map +1 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/interpreter/index.d.ts +2 -2
- package/dist/interpreter/index.js +3 -3
- package/dist/openai/index.d.ts +2 -2
- package/dist/openai/index.js +1 -1
- package/dist/opencode/index.d.ts +3 -3
- package/dist/opencode/index.js +3 -3
- package/dist/{sandbox-BEhPgFZx.js → sandbox-CpelK4pU.js} +227 -68
- package/dist/sandbox-CpelK4pU.js.map +1 -0
- package/dist/{sandbox-CBkS3tGv.d.ts → sandbox-D1BoB5f7.d.ts} +2 -2
- package/dist/{sandbox-CBkS3tGv.d.ts.map → sandbox-D1BoB5f7.d.ts.map} +1 -1
- package/package.json +1 -1
- package/dist/contexts-1EsLHByO.d.ts.map +0 -1
- package/dist/errors-CXR0xBpw.js.map +0 -1
- package/dist/extensions-Be5HnDGt.js.map +0 -1
- package/dist/filesystem-Y5aF3nmJ.d.ts.map +0 -1
- package/dist/index-DfXx3uZL.d.ts.map +0 -1
- package/dist/sandbox-BEhPgFZx.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as ProcessStatus, s as SandboxCommand } from "./process-types-GStiZ8f8.js";
|
|
2
|
-
import { A as CreateTerminalOptions, D as MountBucketOptions, M as Terminal, R as ExecOptions, S as BackupOptions, T as DirectoryBackup, _ as RenameFileResult, b as WriteFileResult, d as ListFilesOptions, f as ListFilesResult, g as ReadFileStreamResult, h as ReadFileResult, i as DeleteFileResult, k as RestoreBackupResult, m as MoveFileResult, o as FileEncoding, p as MkdirResult, q as SandboxProcess, r as CheckChangesResult, s as FileExistsResult, t as CheckChangesOptions, v as WatchOptions } from "./filesystem-
|
|
2
|
+
import { A as CreateTerminalOptions, D as MountBucketOptions, M as Terminal, R as ExecOptions, S as BackupOptions, T as DirectoryBackup, _ as RenameFileResult, b as WriteFileResult, d as ListFilesOptions, f as ListFilesResult, g as ReadFileStreamResult, h as ReadFileResult, i as DeleteFileResult, k as RestoreBackupResult, m as MoveFileResult, o as FileEncoding, p as MkdirResult, q as SandboxProcess, r as CheckChangesResult, s as FileExistsResult, t as CheckChangesOptions, v as WatchOptions } from "./filesystem-Cd6xd_Pe.js";
|
|
3
3
|
|
|
4
4
|
//#region ../shared/dist/types/sandbox.d.ts
|
|
5
5
|
|
|
@@ -39,4 +39,4 @@ interface ISandbox {
|
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
export { ISandbox as t };
|
|
42
|
-
//# sourceMappingURL=sandbox-
|
|
42
|
+
//# sourceMappingURL=sandbox-D1BoB5f7.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-
|
|
1
|
+
{"version":3,"file":"sandbox-D1BoB5f7.d.ts","names":["ProcessStatus","SandboxCommand","CreateTerminalOptions","Terminal","BackupOptions","DirectoryBackup","MountBucketOptions","RestoreBackupResult","ExecOptions","SandboxProcess","CheckChangesOptions","CheckChangesResult","DeleteFileResult","FileEncoding","FileExistsResult","ListFilesOptions","ListFilesResult","MkdirResult","MoveFileResult","ReadFileResult","ReadFileStreamResult","RenameFileResult","WatchOptions","WriteFileResult","ISandbox","Promise","Uint8Array","ReadableStream","Exclude","Record","Request","Response"],"sources":["../../shared/dist/types/sandbox.d.ts"],"sourcesContent":["import type { ProcessStatus, SandboxCommand } from '../process-types.js';\nimport type { CreateTerminalOptions, Terminal } from '../pty-types.js';\nimport type { BackupOptions, DirectoryBackup, MountBucketOptions, RestoreBackupResult } from './backup-mounts.js';\nimport type { ExecOptions, SandboxProcess } from './core.js';\nimport type { CheckChangesOptions, CheckChangesResult, DeleteFileResult, FileEncoding, FileExistsResult, ListFilesOptions, ListFilesResult, MkdirResult, MoveFileResult, ReadFileResult, ReadFileStreamResult, RenameFileResult, WatchOptions, WriteFileResult } from './filesystem.js';\nexport interface ISandbox {\n exec(command: SandboxCommand, options?: ExecOptions): Promise<SandboxProcess>;\n getProcess(id: string): Promise<SandboxProcess | null>;\n listProcesses(): Promise<ProcessStatus[]>;\n writeFile(path: string, content: string | ReadableStream<Uint8Array>, options?: {\n encoding?: string;\n }): Promise<WriteFileResult>;\n readFile(path: string, options: {\n encoding: 'none';\n }): Promise<ReadFileStreamResult>;\n readFile(path: string, options?: {\n encoding?: Exclude<FileEncoding, 'none'>;\n }): Promise<ReadFileResult>;\n readFileStream(path: string): Promise<ReadableStream<Uint8Array>>;\n watch(path: string, options?: WatchOptions): Promise<ReadableStream<Uint8Array>>;\n checkChanges(path: string, options?: CheckChangesOptions): Promise<CheckChangesResult>;\n mkdir(path: string, options?: {\n recursive?: boolean;\n }): Promise<MkdirResult>;\n deleteFile(path: string): Promise<DeleteFileResult>;\n renameFile(oldPath: string, newPath: string, options?: Record<string, never>): Promise<RenameFileResult>;\n moveFile(sourcePath: string, destinationPath: string, options?: Record<string, never>): Promise<MoveFileResult>;\n listFiles(path: string, options?: ListFilesOptions): Promise<ListFilesResult>;\n exists(path: string): Promise<FileExistsResult>;\n setEnvVars(envVars: Record<string, string | undefined>): Promise<void>;\n mountBucket(bucket: string, mountPath: string, options: MountBucketOptions): Promise<void>;\n unmountBucket(mountPath: string): Promise<void>;\n createBackup(options: BackupOptions): Promise<DirectoryBackup>;\n restoreBackup(backup: DirectoryBackup): Promise<RestoreBackupResult>;\n wsConnect(request: Request, port: number): Promise<Response>;\n createTerminal(options: CreateTerminalOptions): Promise<Terminal>;\n getTerminal(id: string): Promise<Terminal | null>;\n listTerminals(): Promise<Terminal[]>;\n}\n//# sourceMappingURL=sandbox.d.ts.map"],"mappings":";;;;;AAMkBC,UADDuB,QAAAA,CACCvB;EAA0BO,IAAAA,CAAAA,OAAAA,EAA1BP,cAA0BO,EAAAA,OAAAA,CAAAA,EAAAA,WAAAA,CAAAA,EAAciB,OAAdjB,CAAsBC,cAAtBD,CAAAA;EAAsBC,UAAAA,CAAAA,EAAAA,EAAAA,MAAAA,CAAAA,EACtCgB,OADsChB,CAC9BA,cAD8BA,GAAAA,IAAAA,CAAAA;EAARgB,aAAAA,EAAAA,EAErCA,OAFqCA,CAE7BzB,aAF6ByB,EAAAA,CAAAA;EACtBhB,SAAAA,CAAAA,IAAAA,EAAAA,MAAAA,EAAAA,OAAAA,EAAAA,MAAAA,GAEUkB,cAFVlB,CAEyBiB,UAFzBjB,CAAAA,EAAAA,OACPT,CADOS,EAAAA;IAARgB,QAAAA,CAAAA,EAAAA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WsBT,QAXtBS,CAAAA;EAARa,WAAAA,CAAAA,EAAAA,EAAAA,MAAAA,CAAAA,EAYDA,OAZCA,CAYOtB,QAZPsB,GAAAA,IAAAA,CAAAA;EAC6BI,aAAAA,EAAAA,EAYtCJ,OAZsCI,CAY9B1B,QAZ8B0B,EAAAA,CAAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contexts-1EsLHByO.d.ts","names":["ErrorCode","ErrorCode","Operation","OperationType","ErrorResponse","TContext","Record","ServiceError","ServiceResult","T","ProcessExit","OperationType","FileNotFoundContext","FileExistsContext","FileTooLargeContext","FileSystemContext","CommandNotFoundContext","CommandErrorContext","ProcessNotFoundContext","ProcessErrorContext","InvalidProcessCwdContext","InvalidProcessEnvironmentContext","ProcessSpawnFailedContext","InvalidProcessCursorContext","StaleProcessHandleContext","ProcessWaitTimeoutContext","ProcessAbortedContext","TerminalNotFoundContext","InvalidTerminalCwdContext","InvalidTerminalCursorContext","TerminalControlErrorContext","StaleTerminalHandleContext","ProcessReadyTimeoutContext","ProcessExitedBeforeReadyContext","ProcessExitedBeforeLogContext","PortAlreadyExposedContext","PortNotExposedContext","InvalidPortContext","PortErrorContext","GitRepositoryNotFoundContext","GitAuthFailedContext","GitBranchNotFoundContext","GitErrorContext","InterpreterNotReadyContext","ContextNotFoundContext","CodeExecutionContext","ValidationFailedContext","Array","BucketMountContext","MissingCredentialsContext","InvalidMountConfigContext","BackupCreateContext","BackupRestoreContext","BackupNotFoundContext","BackupExpiredContext","InvalidBackupConfigContext","OpenCodeStartupContext","InternalErrorContext","ContainerUnavailableContext","OperationInterruptedReason","OperationInterruptedContext","RPCTransportErrorKind","RPCTransportContext"],"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 TERMINAL_NOT_FOUND: \"TERMINAL_NOT_FOUND\";\n readonly INVALID_PROCESS_CWD: \"INVALID_PROCESS_CWD\";\n readonly INVALID_PROCESS_ENVIRONMENT: \"INVALID_PROCESS_ENVIRONMENT\";\n readonly INVALID_PROCESS_CURSOR: \"INVALID_PROCESS_CURSOR\";\n readonly INVALID_TERMINAL_CWD: \"INVALID_TERMINAL_CWD\";\n readonly INVALID_TERMINAL_CURSOR: \"INVALID_TERMINAL_CURSOR\";\n readonly STALE_PROCESS_HANDLE: \"STALE_PROCESS_HANDLE\";\n readonly STALE_TERMINAL_HANDLE: \"STALE_TERMINAL_HANDLE\";\n readonly PROCESS_WAIT_TIMEOUT: \"PROCESS_WAIT_TIMEOUT\";\n readonly PROCESS_ABORTED: \"PROCESS_ABORTED\";\n readonly PROCESS_PERMISSION_DENIED: \"PROCESS_PERMISSION_DENIED\";\n readonly PROCESS_ERROR: \"PROCESS_ERROR\";\n readonly PROCESS_SPAWN_FAILED: \"PROCESS_SPAWN_FAILED\";\n readonly TERMINAL_CONTROL_ERROR: \"TERMINAL_CONTROL_ERROR\";\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 PROCESS_EXITED_BEFORE_LOG: \"PROCESS_EXITED_BEFORE_LOG\";\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 CONTAINER_UNAVAILABLE: \"CONTAINER_UNAVAILABLE\";\n readonly CONTROL_PROTOCOL_INCOMPATIBLE: \"CONTROL_PROTOCOL_INCOMPATIBLE\";\n readonly OPERATION_INTERRUPTED: \"OPERATION_INTERRUPTED\";\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 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 { ProcessExit } from '../process-types';\nimport 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 InvalidProcessCwdContext {\n processId?: string;\n cwd: string;\n reason: string;\n}\nexport interface InvalidProcessEnvironmentContext {\n processId?: string;\n name?: string;\n reason: string;\n}\nexport interface ProcessSpawnFailedContext {\n processId: string;\n command: string;\n cwd?: string;\n stderr?: string;\n}\nexport interface InvalidProcessCursorContext {\n processId: string;\n cursor?: string;\n reason: string;\n}\nexport interface StaleProcessHandleContext {\n processId: string;\n pid: number;\n operation: string;\n}\nexport interface ProcessWaitTimeoutContext {\n processId: string;\n operation: 'output' | 'waitForExit' | 'waitForLog';\n timeout: number;\n}\nexport interface ProcessAbortedContext {\n processId: string;\n operation: string;\n}\nexport interface TerminalNotFoundContext {\n terminalId: string;\n}\nexport interface InvalidTerminalCwdContext {\n terminalId: string;\n cwd: string;\n reason: string;\n}\nexport interface InvalidTerminalCursorContext {\n terminalId: string;\n cursor?: string;\n reason: string;\n}\nexport interface TerminalControlErrorContext {\n terminalId: string;\n operation: string;\n reason?: string;\n failure?: {\n code: string;\n message: string;\n };\n}\nexport interface StaleTerminalHandleContext {\n terminalId: string;\n operation: 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}\nexport interface ProcessExitedBeforeLogContext {\n processId: string;\n pid: number;\n exit: ProcessExit;\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 * Container availability error context. Surfaced when the sandbox container\n * cannot accept the incoming RPC connection. The container may be starting\n * up, undergoing a runtime replacement, or temporarily unhealthy. The\n * caller should retry the same operation.\n */\nexport interface ContainerUnavailableContext {\n /**\n * Categorical reason distinguishing startup unavailability from runtime\n * replacement and exhausted upgrade retries.\n */\n reason: 'container_starting' | 'container_unhealthy' | 'container_replaced' | 'rpc_upgrade_failed';\n /**\n * Always true — this error represents a transient unavailability, not a\n * permanent failure. Callers should retry the same operation.\n */\n retryable: true;\n /** Suggested delay in milliseconds before the next retry attempt. */\n retryAfterMs?: number;\n}\nexport type OperationInterruptedReason = 'runtime_replaced' | 'container_stopped' | 'transport_disposed' | 'sandbox_destroyed' | 'sandbox_lifetime_changed' | 'recovery_exhausted' | 'unknown';\nexport interface OperationInterruptedContext {\n reason: OperationInterruptedReason;\n operation: string;\n phase?: string;\n admitted: true | 'unknown';\n retryable: boolean;\n operationId?: string;\n operationKey?: string;\n idempotencyKey?: string;\n recoveryAttempts?: number;\n maxRecoveryAttempts?: number;\n backupId?: string;\n dir?: string;\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' | '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//# sourceMappingURL=contexts.d.ts.map"],"mappings":";;;;;;;AAIA;AAiFYA,cAjFSA,SAiFWA,EAAAA;;;;ECjFXE,SAAAA,YAyBpB,EAAA,cAAA;EACWC,SAAAA,aAAa,EAAA,eAAWD;EAKnBE,SAAAA,cAAaC,EAAAA,gBAAA;EAAYC,SAAAA,QAAAA,EAAAA,UAAAA;EAIhCL,SAAAA,cAAAA,EAAAA,gBAAAA;EAQME,SAAAA,aAAAA,EAAAA,eAAAA;EAKHE,SAAAA,SAAAA,EAAAA,WAAAA;EAAQ,SAAA,aAAA,EAAA,eAAA;;;;EC/CJO,SAAAA,yBAAmB,EAErBD,2BAAa;EAEXE,SAAAA,eAAiB,EAAA,iBAEnBF;EAEEG,SAAAA,uBAAmB,EAAA,yBAER;EAIXC,SAAAA,kBAAiB,EAAA,oBAEN;EAOXC,SAAAA,iBAAsB,EAAA,mBAAA;EAGtBC,SAAAA,kBAAmB,EAAA,oBAAA;EASnBC,SAAAA,mBAAsB,EAAA,qBAAA;EAGtBC,SAAAA,2BAAmB,EAAA,6BAAA;EAMnBC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;;;;;;;UAQAC,oBAAAA;;;;;;;;;;;UAWAC,2BAAAA;;;;;;;;;;;;;;KAcLC,0BAAAA;UACKC,2BAAAA;UACLD;;;;;;;;;;;;;;;;;;KAkBAE,qBAAAA;;;;;;;UAaKC,mBAAAA;;QAEPD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-CXR0xBpw.js","names":[],"sources":["../../shared/dist/errors/codes.js","../../shared/dist/errors/status-map.js","../../shared/dist/errors/suggestions.js","../../shared/dist/errors/types.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 TERMINAL_NOT_FOUND: 'TERMINAL_NOT_FOUND',\n // Process Errors (400)\n INVALID_PROCESS_CWD: 'INVALID_PROCESS_CWD',\n INVALID_PROCESS_ENVIRONMENT: 'INVALID_PROCESS_ENVIRONMENT',\n INVALID_PROCESS_CURSOR: 'INVALID_PROCESS_CURSOR',\n INVALID_TERMINAL_CWD: 'INVALID_TERMINAL_CWD',\n INVALID_TERMINAL_CURSOR: 'INVALID_TERMINAL_CURSOR',\n // Process Errors (408/409/499)\n STALE_PROCESS_HANDLE: 'STALE_PROCESS_HANDLE',\n STALE_TERMINAL_HANDLE: 'STALE_TERMINAL_HANDLE',\n PROCESS_WAIT_TIMEOUT: 'PROCESS_WAIT_TIMEOUT',\n PROCESS_ABORTED: 'PROCESS_ABORTED',\n // Process Errors (403/500)\n PROCESS_PERMISSION_DENIED: 'PROCESS_PERMISSION_DENIED',\n PROCESS_ERROR: 'PROCESS_ERROR',\n PROCESS_SPAWN_FAILED: 'PROCESS_SPAWN_FAILED',\n TERMINAL_CONTROL_ERROR: 'TERMINAL_CONTROL_ERROR',\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 PROCESS_EXITED_BEFORE_LOG: 'PROCESS_EXITED_BEFORE_LOG',\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 // Container Availability Errors (503)\n CONTAINER_UNAVAILABLE: 'CONTAINER_UNAVAILABLE',\n CONTROL_PROTOCOL_INCOMPATIBLE: 'CONTROL_PROTOCOL_INCOMPATIBLE',\n // Operation Lifecycle Errors (409)\n OPERATION_INTERRUPTED: 'OPERATION_INTERRUPTED',\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.TERMINAL_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_PROCESS_CWD]: 400,\n [ErrorCode.INVALID_PROCESS_ENVIRONMENT]: 400,\n [ErrorCode.INVALID_PROCESS_CURSOR]: 400,\n [ErrorCode.INVALID_TERMINAL_CWD]: 400,\n [ErrorCode.INVALID_TERMINAL_CURSOR]: 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.OPERATION_INTERRUPTED]: 409,\n [ErrorCode.STALE_PROCESS_HANDLE]: 409,\n [ErrorCode.STALE_TERMINAL_HANDLE]: 409,\n [ErrorCode.PROCESS_EXITED_BEFORE_LOG]: 409,\n // 410 Gone\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 // 503 Service Unavailable\n [ErrorCode.INTERPRETER_NOT_READY]: 503,\n [ErrorCode.OPENCODE_STARTUP_FAILED]: 503,\n [ErrorCode.CONTAINER_UNAVAILABLE]: 503,\n [ErrorCode.CONTROL_PROTOCOL_INCOMPATIBLE]: 503,\n [ErrorCode.RPC_TRANSPORT_ERROR]: 503,\n // 408 Request Timeout\n [ErrorCode.PROCESS_READY_TIMEOUT]: 408,\n [ErrorCode.PROCESS_WAIT_TIMEOUT]: 408,\n // 499 Client Closed Request\n [ErrorCode.PROCESS_ABORTED]: 499,\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.PROCESS_SPAWN_FAILED]: 500,\n [ErrorCode.TERMINAL_CONTROL_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.INVALID_PROCESS_CWD:\n return `Verify the process working directory exists and is accessible: ${context.cwd}`;\n case ErrorCode.INVALID_PROCESS_ENVIRONMENT:\n return 'Verify process environment variable names and values are valid strings without NUL bytes';\n case ErrorCode.PROCESS_SPAWN_FAILED:\n return `Check that \"${context.command}\" exists, is executable, and can be started in the requested working directory`;\n case ErrorCode.INVALID_PROCESS_CURSOR:\n return 'Use a log cursor previously returned by this process log stream';\n case ErrorCode.STALE_PROCESS_HANDLE:\n return 'The process handle refers to an older runtime process. Reacquire the process by ID before retrying the operation';\n case ErrorCode.STALE_TERMINAL_HANDLE:\n return 'The terminal handle refers to an older runtime terminal. Reacquire the terminal by ID before retrying the operation';\n case ErrorCode.PROCESS_WAIT_TIMEOUT:\n return 'The process did not complete before the timeout. Continue streaming logs or kill the process if it is no longer needed';\n case ErrorCode.PROCESS_ABORTED:\n return 'The process operation was aborted by the caller. Retry with a new AbortSignal if needed';\n case ErrorCode.TERMINAL_NOT_FOUND:\n return `Verify terminal \"${context.terminalId}\" exists and has not been evicted`;\n case ErrorCode.INVALID_TERMINAL_CWD:\n return `Verify the terminal working directory exists and is accessible: ${context.cwd}`;\n case ErrorCode.INVALID_TERMINAL_CURSOR:\n return 'Use a cursor previously returned by this terminal stream';\n case ErrorCode.TERMINAL_CONTROL_ERROR:\n return `Terminal control operation failed for terminal \"${context.terminalId}\"`;\n case ErrorCode.PORT_NOT_EXPOSED:\n return `Port ${context.port} is not currently available for this operation`;\n case ErrorCode.PORT_ALREADY_EXPOSED:\n return `Port ${context.port} already has preview URL authorization or activation state`;\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.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.CONTROL_PROTOCOL_INCOMPATIBLE:\n return 'Refresh the sandbox control session metadata and reconnect with a compatible control protocol';\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.CONTAINER_UNAVAILABLE: {\n const reason = context.reason;\n switch (reason) {\n case 'container_starting':\n return 'The container is still starting. Retry the operation in a moment.';\n case 'container_unhealthy':\n return 'The container is temporarily unhealthy. Retry the operation in a moment.';\n case 'container_replaced':\n return 'The container runtime was replaced. Retry the operation to use the new container.';\n case 'rpc_upgrade_failed':\n return 'The container did not accept the RPC connection before the retry budget expired. Retry the operation in a moment.';\n default:\n return 'The container is not ready yet. Retry the operation in a moment.';\n }\n }\n case ErrorCode.OPERATION_INTERRUPTED:\n return context.retryable\n ? 'Retry the operation with the same idempotency key or operation inputs so the SDK can reconcile the previous attempt.'\n : 'The operation may have started before it was interrupted. Inspect application state before retrying.';\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 (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","/**\n * Standard operation types\n */\nexport const Operation = {\n // File Operations\n FILE_READ: 'file.read',\n FILE_WRITE: 'file.write',\n FILE_DELETE: 'file.delete',\n FILE_MOVE: 'file.move',\n FILE_RENAME: 'file.rename',\n FILE_STAT: 'file.stat',\n DIRECTORY_CREATE: 'directory.create',\n DIRECTORY_LIST: 'directory.list',\n // Command Operations\n COMMAND_EXECUTE: 'command.execute',\n COMMAND_STREAM: 'command.stream',\n // Process Operations\n PROCESS_START: 'process.start',\n PROCESS_KILL: 'process.kill',\n PROCESS_LIST: 'process.list',\n PROCESS_GET: 'process.get',\n PROCESS_LOGS: 'process.logs',\n // Git Operations\n GIT_CLONE: 'git.clone',\n GIT_CHECKOUT: 'git.checkout',\n GIT_OPERATION: 'git.operation',\n // Backup Operations\n BACKUP_CREATE: 'backup.create',\n BACKUP_RESTORE: 'backup.restore',\n BACKUP_UNMOUNT: 'backup.unmount',\n // Code Interpreter\n CODE_EXECUTE: 'code.execute',\n CODE_CONTEXT_CREATE: 'code.context.create',\n CODE_CONTEXT_DELETE: 'code.context.delete'\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;CACnB,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AgB;CAChB,gBAAgB;CAEhB,cAAc;CACd,qBAAqB;CACrB,qBAAqB;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions-Be5HnDGt.js","names":["context","payload: RPCErrorPayload | undefined","kind: RPCTransportErrorKind","closeCode: number | undefined","closeReason: string | undefined","context: RPCTransportContext","interruptedContext: OperationInterruptedContext","#reader","#onRelease","#released","#release","subscription:\n | ProcessSubscriptionRPC<T>\n | ProcessPullSubscriptionRPC<T>\n | undefined","onAbort: (() => void) | undefined","onAbort","read: () => Promise<ReadableStreamReadResult<T>>","cancelReader: () => void","source: ReadableStream<T>","reader: ReadableStreamDefaultReader<T>","controller: ReadableStreamDefaultController<T> | undefined","timer: ReturnType<typeof setTimeout> | undefined","abortListener: (() => void) | undefined","competitors: Promise<T>[]","stdout: Uint8Array[]","stderr: Uint8Array[]","match","id: string","pid: number","capability: ProcessRPCDescriptor['capability']","#exitCodePromise","logStream: ReadableStream<ProcessLogEvent> | undefined","portReader: ReadableStreamDefaultReader<PortWatchEvent> | undefined","logReader: ReadableStreamDefaultReader<ProcessLogEvent> | undefined","reader: ReadableStreamDefaultReader<ProcessLogEvent> | undefined","sandboxRuntimeCall: unique symbol","#sandbox","#pkg","#requirePackage","#hashOnce","#connect","#hashPromise","current: object | null"],"sources":["../src/container-control/rpc-error.ts","../src/processes/remote-subscription.ts","../src/processes/process-waits.ts","../src/processes/process-output.ts","../src/processes/process-readiness.ts","../src/processes/wait-for-log.ts","../src/processes/sandbox-process.ts","../src/extensions/index.ts"],"sourcesContent":["/** Error translation for container control RPC calls. */\n\nimport {\n ErrorCode,\n type ErrorResponse,\n getHttpStatus,\n getSuggestion,\n type OperationInterruptedContext,\n type RPCTransportContext,\n type RPCTransportErrorKind\n} from '@repo/shared/errors';\nimport { createErrorFromResponse } from '../errors/adapter';\nimport { SandboxError } from '../errors/classes';\n\ninterface RPCErrorPayload {\n code: string;\n message: string;\n context?: Record<string, unknown>;\n}\n\nfunction isLocalSandboxError(\n error: Error\n): error is Error & { errorResponse: ErrorResponse } {\n if (!('errorResponse' in error)) return false;\n const response = error.errorResponse as Partial<ErrorResponse> | undefined;\n return (\n typeof response?.code === 'string' &&\n Object.hasOwn(ErrorCode, response.code) &&\n typeof response.message === 'string' &&\n typeof response.httpStatus === 'number' &&\n typeof response.timestamp === 'string' &&\n typeof response.context === 'object' &&\n response.context !== null\n );\n}\n\nexport interface RPCTranslationContext {\n operation?: string;\n translateTransportErrorsAsInterruptions?: boolean;\n}\n\nexport function translateRPCError(\n error: unknown,\n context: RPCTranslationContext = {}\n): never {\n if (error instanceof SandboxError) throw error;\n\n if (error instanceof Error) {\n if (isLocalSandboxError(error)) {\n throw error;\n }\n\n const propagated = error as Error & {\n code?: unknown;\n details?: unknown;\n };\n if (\n typeof propagated.code === 'string' &&\n Object.hasOwn(ErrorCode, propagated.code)\n ) {\n const code = propagated.code as ErrorCode;\n const context =\n propagated.details && typeof propagated.details === 'object'\n ? (propagated.details as Record<string, unknown>)\n : {};\n throw createErrorFromResponse({\n code,\n message: error.message,\n context,\n httpStatus: getHttpStatus(code),\n timestamp: new Date().toISOString()\n });\n }\n\n let payload: RPCErrorPayload | undefined;\n try {\n payload = JSON.parse(error.message) as RPCErrorPayload;\n } catch {}\n if (\n payload &&\n typeof payload.code === 'string' &&\n typeof payload.message === 'string'\n ) {\n throw createErrorFromResponse({\n code: payload.code as ErrorCode,\n message: payload.message,\n context: payload.context ?? {},\n httpStatus: getHttpStatus(payload.code as ErrorCode),\n timestamp: new Date().toISOString()\n });\n }\n\n const transportResponse = buildTransportErrorResponse(error);\n const interruptedResponse =\n context.translateTransportErrorsAsInterruptions === false\n ? null\n : buildInterruptedOperationResponse(transportResponse, context);\n throw createErrorFromResponse(\n (interruptedResponse ?? transportResponse) as unknown as ErrorResponse,\n { cause: error }\n );\n }\n\n const wrapped = new Error(String(error));\n throw createErrorFromResponse(\n buildTransportErrorResponse(wrapped) as unknown as ErrorResponse,\n { cause: error }\n );\n}\n\nfunction buildTransportErrorResponse(\n error: Error\n): ErrorResponse<RPCTransportContext> {\n const message = error.message;\n const errorName = error.name;\n let kind: RPCTransportErrorKind = 'unknown';\n let closeCode: number | undefined;\n let closeReason: string | undefined;\n\n if (errorName === 'TypeError') {\n kind = 'invalid_frame';\n } else if (errorName === 'SyntaxError') {\n kind = 'protocol_error';\n } else {\n const peerCloseMatch = message.match(\n /^Peer closed WebSocket: (\\d+) ?(.*)$/\n );\n if (peerCloseMatch) {\n kind = 'peer_closed';\n closeCode = Number(peerCloseMatch[1]);\n closeReason = peerCloseMatch[2] || undefined;\n } else if (message === 'WebSocket connection failed.') {\n kind = 'connection_failed';\n } else if (message.startsWith('WebSocket upgrade failed')) {\n kind = 'upgrade_failed';\n } else if (message === 'No WebSocket in upgrade response') {\n kind = 'upgrade_failed';\n } else if (\n message === 'RPC session was shut down by disposing the main stub' ||\n message === 'RPC was canceled because the RpcPromise was disposed.'\n ) {\n kind = 'session_disposed';\n }\n }\n\n const context: RPCTransportContext = {\n kind,\n originalMessage: message,\n errorName,\n ...(closeCode !== undefined ? { closeCode } : {}),\n ...(closeReason !== undefined ? { closeReason } : {})\n };\n return {\n code: ErrorCode.RPC_TRANSPORT_ERROR,\n message,\n context,\n httpStatus: getHttpStatus(ErrorCode.RPC_TRANSPORT_ERROR),\n suggestion: getSuggestion(\n ErrorCode.RPC_TRANSPORT_ERROR,\n context as unknown as Record<string, unknown>\n ),\n timestamp: new Date().toISOString()\n };\n}\n\nfunction buildInterruptedOperationResponse(\n transportResponse: ErrorResponse<RPCTransportContext>,\n context: RPCTranslationContext\n): ErrorResponse<OperationInterruptedContext> | null {\n if (!context.operation) return null;\n const { kind } = transportResponse.context;\n if (\n kind !== 'session_disposed' &&\n kind !== 'peer_closed' &&\n kind !== 'connection_failed'\n ) {\n return null;\n }\n\n const interruptedContext: OperationInterruptedContext = {\n reason:\n kind === 'session_disposed' ? 'transport_disposed' : 'runtime_replaced',\n operation: context.operation,\n admitted: 'unknown',\n retryable: false\n };\n const action =\n kind === 'session_disposed' ? 'was closing' : 'closed unexpectedly';\n\n return {\n code: ErrorCode.OPERATION_INTERRUPTED,\n message: `Sandbox operation ${context.operation} was interrupted while the runtime connection ${action}`,\n context: interruptedContext,\n httpStatus: getHttpStatus(ErrorCode.OPERATION_INTERRUPTED),\n suggestion: getSuggestion(\n ErrorCode.OPERATION_INTERRUPTED,\n interruptedContext as unknown as Record<string, unknown>\n ),\n timestamp: new Date().toISOString()\n };\n}\n","import { RpcTarget } from 'cloudflare:workers';\nimport { translateRPCError } from '../container-control/rpc-error';\nimport type {\n ProcessPullSubscriptionRPC,\n ProcessSubscriptionRPC\n} from './rpc-types';\n\ninterface RemoteSubscriptionOptions {\n protocol: 'stream' | 'pull';\n signal?: AbortSignal;\n operation?: string;\n abortError?: () => Error;\n}\n\n/** Keeps a stream local to its Durable Object and exposes pull RPC methods. */\nexport class PullSubscriptionTarget<T>\n extends RpcTarget\n implements ProcessPullSubscriptionRPC<T>\n{\n readonly #reader: ReadableStreamDefaultReader<T>;\n readonly #onRelease: (() => void) | undefined;\n #released = false;\n\n constructor(stream: ReadableStream<T>, onRelease?: () => void) {\n super();\n this.#reader = stream.getReader();\n this.#onRelease = onRelease;\n }\n\n async next(): Promise<ReadableStreamReadResult<T>> {\n if (this.#released) return { done: true, value: undefined };\n try {\n const result = await this.#reader.read();\n if (result.done) this.#release();\n return result;\n } catch (error) {\n this.#release();\n throw error;\n }\n }\n\n async cancel(): Promise<void> {\n if (this.#released) return;\n try {\n await this.#reader.cancel();\n } finally {\n this.#release();\n }\n }\n\n [Symbol.dispose](): void {\n if (this.#released) return;\n void this.#reader.cancel().catch(() => undefined);\n this.#release();\n }\n\n #release(): void {\n if (this.#released) return;\n this.#released = true;\n this.#onRelease?.();\n }\n}\n\n/** Exposes a remote Workers RPC subscription as a caller-owned local stream. */\nexport async function openRemoteSubscription<T>(\n subscriptionPromise: Promise<\n ProcessSubscriptionRPC<T> | ProcessPullSubscriptionRPC<T>\n >,\n options: RemoteSubscriptionOptions\n): Promise<ReadableStream<T>> {\n let subscription:\n | ProcessSubscriptionRPC<T>\n | ProcessPullSubscriptionRPC<T>\n | undefined;\n let releaseRequested = false;\n let cleanupStarted = false;\n const release = (): void => {\n releaseRequested = true;\n if (cleanupStarted || subscription === undefined) return;\n cleanupStarted = true;\n try {\n void subscription.cancel().catch(() => undefined);\n } catch {\n // Local disposal still runs after a synchronous RPC failure.\n }\n try {\n subscription[Symbol.dispose]();\n } catch {\n // Cleanup must not replace the consumer's result.\n }\n };\n\n const signal = options.signal;\n const aborted = (): Error =>\n options.abortError?.() ??\n (signal?.reason instanceof Error\n ? signal.reason\n : new Error('Operation aborted'));\n const raceSetup = async <U>(setup: Promise<U>): Promise<U> => {\n if (signal === undefined) return setup;\n if (signal.aborted) {\n release();\n throw aborted();\n }\n let onAbort: (() => void) | undefined;\n const abort = new Promise<never>((_, reject) => {\n onAbort = () => {\n release();\n reject(aborted());\n };\n signal.addEventListener('abort', onAbort, { once: true });\n });\n try {\n return await Promise.race([setup, abort]);\n } finally {\n if (onAbort !== undefined) signal.removeEventListener('abort', onAbort);\n }\n };\n\n try {\n subscription = await raceSetup(\n subscriptionPromise.then((value) => {\n subscription = value;\n if (releaseRequested) release();\n return value;\n })\n );\n } catch (error) {\n if (signal?.aborted) throw error;\n translateRPCError(error, {\n operation: options.operation ?? 'open process subscription'\n });\n }\n\n if (subscription === undefined)\n throw new Error('Process subscription acquisition did not complete');\n\n let read: () => Promise<ReadableStreamReadResult<T>>;\n let cancelReader: () => void;\n if (options.protocol === 'pull') {\n const pullSubscription = subscription as ProcessPullSubscriptionRPC<T>;\n read = () => pullSubscription.next();\n cancelReader = () => undefined;\n } else {\n const streamSubscription = subscription as ProcessSubscriptionRPC<T>;\n let source: ReadableStream<T>;\n try {\n source = await raceSetup(streamSubscription.stream());\n } catch (error) {\n release();\n if (signal?.aborted) throw error;\n translateRPCError(error, {\n operation: options.operation ?? 'open process subscription'\n });\n }\n\n let reader: ReadableStreamDefaultReader<T>;\n try {\n reader = source.getReader();\n } catch (error) {\n release();\n translateRPCError(error, {\n operation: options.operation ?? 'read process subscription'\n });\n }\n read = () => reader.read();\n cancelReader = () => {\n try {\n void reader.cancel().catch(() => undefined);\n } catch {\n // Remote subscription release below remains authoritative.\n }\n };\n }\n\n let stopped = false;\n let controller: ReadableStreamDefaultController<T> | undefined;\n const stop = (error?: Error): void => {\n if (stopped) return;\n stopped = true;\n signal?.removeEventListener('abort', onAbort);\n cancelReader();\n release();\n if (error !== undefined) controller?.error(error);\n };\n const onAbort = (): void => stop(aborted());\n\n return new ReadableStream<T>({\n start(localController) {\n controller = localController;\n if (signal?.aborted) onAbort();\n else signal?.addEventListener('abort', onAbort, { once: true });\n },\n async pull(localController) {\n if (stopped) return;\n try {\n const result = await read();\n if (stopped) return;\n if (result.done) {\n stopped = true;\n signal?.removeEventListener('abort', onAbort);\n release();\n localController.close();\n return;\n }\n localController.enqueue(result.value);\n } catch (error) {\n stop();\n translateRPCError(error, {\n operation: options.operation ?? 'consume process subscription'\n });\n }\n },\n cancel() {\n stop();\n }\n });\n}\n","import { ErrorCode } from '@repo/shared/errors';\nimport { translateRPCError } from '../container-control/rpc-error';\nimport {\n ProcessAbortedError,\n ProcessError,\n ProcessReadyTimeoutError,\n ProcessWaitTimeoutError\n} from '../errors';\n\nexport type WaitOperation = 'output' | 'waitForExit' | 'waitForLog';\n\nexport async function withLocalWait<T>(\n work: (settlementSignal: AbortSignal) => Promise<T>,\n options: {\n processId: string;\n operation: WaitOperation | 'waitForPort' | 'logs';\n timeout?: number;\n signal?: AbortSignal;\n port?: number;\n }\n): Promise<T> {\n const { signal, timeout } = options;\n const settlement = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n let abortListener: (() => void) | undefined;\n const competitors: Promise<T>[] = [work(settlement.signal)];\n\n if (timeout !== undefined) {\n competitors.push(\n new Promise<T>((_, reject) => {\n timer = setTimeout(\n () => reject(timeoutError(options, timeout)),\n timeout\n );\n })\n );\n }\n if (signal !== undefined) {\n competitors.push(\n new Promise<T>((_, reject) => {\n const abort = () =>\n reject(abortError(options.processId, options.operation, signal));\n if (signal.aborted) abort();\n else {\n abortListener = abort;\n signal.addEventListener('abort', abort, { once: true });\n }\n })\n );\n }\n\n try {\n return await Promise.race(competitors);\n } finally {\n settlement.abort();\n if (timer !== undefined) clearTimeout(timer);\n if (abortListener !== undefined)\n signal?.removeEventListener('abort', abortListener);\n }\n}\n\nexport function processFailure(\n processId: string,\n pid: number,\n failure: { code: string; message: string }\n): ProcessError {\n return new ProcessError({\n code: ErrorCode.PROCESS_ERROR,\n message: failure.message,\n context: { processId, pid },\n httpStatus: 500,\n timestamp: new Date().toISOString()\n });\n}\n\nexport function streamClosed(message: string): never {\n translateRPCError(new Error(message), {\n operation: 'consume process subscription',\n translateTransportErrorsAsInterruptions: false\n });\n}\n\nfunction timeoutError(\n options: {\n processId: string;\n operation: WaitOperation | 'waitForPort' | 'logs';\n port?: number;\n },\n timeout: number\n): ProcessWaitTimeoutError | ProcessReadyTimeoutError {\n if (options.operation === 'waitForPort') {\n const condition = `port ${options.port ?? 'unknown'}`;\n return new ProcessReadyTimeoutError({\n code: ErrorCode.PROCESS_READY_TIMEOUT,\n message: `Process did not become ready within ${timeout}ms. Waiting for: ${condition}`,\n context: {\n processId: options.processId,\n command: options.processId,\n condition,\n timeout\n },\n httpStatus: 408,\n timestamp: new Date().toISOString()\n });\n }\n const operation =\n options.operation === 'logs' ? 'waitForLog' : options.operation;\n return new ProcessWaitTimeoutError({\n code: ErrorCode.PROCESS_WAIT_TIMEOUT,\n message: `Process ${operation} did not complete within ${timeout}ms`,\n context: { processId: options.processId, operation, timeout },\n httpStatus: 408,\n timestamp: new Date().toISOString()\n });\n}\n\nexport function abortError(\n processId: string,\n operation: string,\n signal: AbortSignal\n): Error {\n if (signal.reason instanceof Error && signal.reason.name !== 'AbortError')\n return signal.reason;\n return new ProcessAbortedError({\n code: ErrorCode.PROCESS_ABORTED,\n message: `Process ${operation} was aborted`,\n context: { processId, operation },\n httpStatus: 499,\n timestamp: new Date().toISOString()\n });\n}\n","import type { ProcessLogEvent, ProcessOutput } from '@repo/shared';\nimport { processFailure, streamClosed } from './process-waits';\n\nexport async function readProcessOutput(\n reader: ReadableStreamDefaultReader<ProcessLogEvent>,\n options: { maxBytes?: number; processId: string; pid: number }\n): Promise<ProcessOutput<Uint8Array>> {\n const maxBytes = validateMaxBytes(options.maxBytes);\n const stdout: Uint8Array[] = [];\n const stderr: Uint8Array[] = [];\n let stdoutBytes = 0;\n let stderrBytes = 0;\n let retainedBytes = 0;\n let truncated = false;\n\n for (;;) {\n const result = await reader.read();\n if (result.done) streamClosed('Process log stream ended before exit');\n\n const event = result.value;\n if ('type' in event && event.type === 'truncated') {\n truncated = true;\n continue;\n }\n if ('state' in event) {\n if (event.state === 'error')\n throw processFailure(options.processId, options.pid, event.error);\n return {\n stdout: concat(stdout, stdoutBytes),\n stderr: concat(stderr, stderrBytes),\n exitCode: event.exit.code,\n signal: event.exit.signal,\n timedOut: event.exit.timedOut,\n truncated\n };\n }\n\n const remaining =\n maxBytes === undefined\n ? event.data.byteLength\n : Math.max(0, maxBytes - retainedBytes);\n const retainedLength = Math.min(remaining, event.data.byteLength);\n if (retainedLength < event.data.byteLength) truncated = true;\n if (retainedLength === 0) continue;\n\n const chunk =\n retainedLength === event.data.byteLength\n ? event.data\n : event.data.slice(0, retainedLength);\n if (event.type === 'stdout') {\n stdout.push(chunk);\n stdoutBytes += chunk.byteLength;\n } else {\n stderr.push(chunk);\n stderrBytes += chunk.byteLength;\n }\n retainedBytes += chunk.byteLength;\n }\n}\n\nexport function validateMaxBytes(\n maxBytes: number | undefined\n): number | undefined {\n if (maxBytes === undefined) return undefined;\n if (!Number.isFinite(maxBytes) || maxBytes < 0)\n throw new Error('maxBytes must be a non-negative finite number');\n return maxBytes;\n}\n\nfunction concat(chunks: Uint8Array[], length: number): Uint8Array {\n const out = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n out.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return out;\n}\n","import type { PortWatchEvent, ProcessLogEvent } from '@repo/shared';\nimport { ErrorCode } from '@repo/shared/errors';\nimport { ProcessExitedBeforeReadyError } from '../errors';\nimport { processFailure, streamClosed } from './process-waits';\n\nexport async function waitForReadiness(\n portReader: ReadableStreamDefaultReader<PortWatchEvent>,\n logReader: ReadableStreamDefaultReader<ProcessLogEvent>,\n context: { processId: string; pid: number; port: number }\n): Promise<void> {\n await Promise.race([\n consumePort(portReader),\n consumeTerminal(logReader, context)\n ]);\n}\n\nasync function consumePort(\n reader: ReadableStreamDefaultReader<PortWatchEvent>\n): Promise<void> {\n for (;;) {\n const result = await reader.read();\n if (result.done) streamClosed('Port watch stream ended unexpectedly');\n if (result.value.type === 'ready') return;\n if (result.value.type === 'error')\n throw new Error(result.value.error || 'Port watch failed');\n }\n}\n\nasync function consumeTerminal(\n reader: ReadableStreamDefaultReader<ProcessLogEvent>,\n context: { processId: string; pid: number; port: number }\n): Promise<never> {\n for (;;) {\n const result = await reader.read();\n if (result.done) streamClosed('Process log stream ended before exit');\n const event = result.value;\n if (!('state' in event)) continue;\n if (event.state === 'error')\n throw processFailure(context.processId, context.pid, event.error);\n throw exitedBeforeReady(context.processId, context.port, event.exit.code);\n }\n}\n\nfunction exitedBeforeReady(\n processId: string,\n port: number,\n exitCode: number\n): ProcessExitedBeforeReadyError {\n return new ProcessExitedBeforeReadyError({\n code: ErrorCode.PROCESS_EXITED_BEFORE_READY,\n message: `Process exited with code ${exitCode} before becoming ready. Waiting for: port ${port}`,\n context: {\n processId,\n command: processId,\n condition: `port ${port}`,\n exitCode\n },\n httpStatus: 500,\n timestamp: new Date().toISOString()\n });\n}\n","import type { ProcessLogEvent, WaitForLogResult } from '@repo/shared';\nimport { ErrorCode } from '@repo/shared/errors';\nimport { ProcessExitedBeforeLogError } from '../errors';\nimport { processFailure, streamClosed } from './process-waits';\n\nconst MATCH_WINDOW = 64 * 1024;\n\ntype WantedStream = 'stdout' | 'stderr' | 'both';\ntype LogStream = 'stdout' | 'stderr';\n\nexport async function readUntilLogMatch(\n reader: ReadableStreamDefaultReader<ProcessLogEvent>,\n pattern: string | RegExp,\n wanted: WantedStream,\n processId: string,\n pid: number\n): Promise<WaitForLogResult> {\n const decoders = {\n stdout: new TextDecoder(),\n stderr: new TextDecoder()\n };\n const windows = { stdout: '', stderr: '' };\n const cursors = { stdout: '', stderr: '' };\n\n const append = (\n stream: LogStream,\n decoded: string,\n cursor: string\n ): WaitForLogResult | undefined => {\n const text = bounded(windows[stream] + decoded);\n windows[stream] = text;\n cursors[stream] = cursor;\n const match = findMatch(text, pattern);\n return match === undefined ? undefined : { stream, text, match, cursor };\n };\n const flush = (cursor: string): WaitForLogResult | undefined => {\n for (const stream of ['stdout', 'stderr'] as const) {\n if (wanted !== 'both' && wanted !== stream) continue;\n const result = append(\n stream,\n decoders[stream].decode(),\n cursors[stream] || cursor\n );\n if (result !== undefined) return result;\n }\n return undefined;\n };\n\n for (;;) {\n const result = await reader.read();\n if (result.done) {\n const match = flush('');\n if (match !== undefined) return match;\n streamClosed('Process log stream ended before a match was found');\n }\n const event = result.value;\n if ('state' in event) {\n const match = flush(event.cursor);\n if (match !== undefined) return match;\n if (event.state === 'error')\n throw processFailure(processId, pid, event.error);\n throw new ProcessExitedBeforeLogError({\n code: ErrorCode.PROCESS_EXITED_BEFORE_LOG,\n message: 'Process exited before a log match was found',\n context: { processId, pid, exit: { ...event.exit } },\n httpStatus: 409,\n timestamp: new Date().toISOString()\n });\n }\n if (event.type !== 'stdout' && event.type !== 'stderr') continue;\n if (wanted !== 'both' && wanted !== event.type) continue;\n\n const match = append(\n event.type,\n decoders[event.type].decode(event.data, { stream: true }),\n event.cursor\n );\n if (match !== undefined) return match;\n }\n}\n\nfunction bounded(text: string): string {\n return text.length <= MATCH_WINDOW ? text : text.slice(-MATCH_WINDOW);\n}\n\nfunction findMatch(text: string, pattern: string | RegExp): string | undefined {\n if (typeof pattern === 'string')\n return text.includes(pattern) ? pattern : undefined;\n pattern.lastIndex = 0;\n const match = pattern.exec(text)?.[0];\n pattern.lastIndex = 0;\n return match;\n}\n","import type {\n PortWatchEvent,\n ProcessExit,\n ProcessLogEvent,\n ProcessLogsOptions,\n ProcessOutput,\n ProcessOutputOptions,\n ProcessStatus,\n ProcessTextOutputOptions,\n SandboxProcess,\n WaitForLogOptions,\n WaitForLogResult,\n WaitForPortOptions\n} from '@repo/shared';\nimport { readProcessOutput, validateMaxBytes } from './process-output';\nimport { waitForReadiness } from './process-readiness';\nimport {\n abortError,\n processFailure,\n streamClosed,\n withLocalWait\n} from './process-waits';\nimport { openRemoteSubscription } from './remote-subscription';\nimport type { ProcessRPCDescriptor } from './rpc-types';\nimport { readUntilLogMatch } from './wait-for-log';\n\nexport type { SandboxProcess };\n\nexport class SandboxProcessImpl implements SandboxProcess {\n #exitCodePromise?: Promise<number>;\n\n constructor(\n readonly id: string,\n readonly pid: number,\n private readonly capability: ProcessRPCDescriptor['capability']\n ) {}\n\n get exitCode(): Promise<number> {\n this.#exitCodePromise ??= this.waitForExit().then((exit) => exit.code);\n return this.#exitCodePromise;\n }\n\n status(): Promise<ProcessStatus> {\n return this.capability.status();\n }\n\n async logs(\n options: ProcessLogsOptions = {}\n ): Promise<ReadableStream<ProcessLogEvent>> {\n const { signal, ...rpcOptions } = options;\n return openRemoteSubscription(this.capability.openLogs(rpcOptions), {\n protocol: 'pull',\n signal,\n operation: 'read process logs',\n abortError:\n signal === undefined\n ? undefined\n : () => abortError(this.id, 'logs', signal)\n });\n }\n\n output(options: ProcessTextOutputOptions): Promise<ProcessOutput<string>>;\n output(options?: ProcessOutputOptions): Promise<ProcessOutput<Uint8Array>>;\n async output(\n options: ProcessOutputOptions | ProcessTextOutputOptions = {}\n ): Promise<ProcessOutput<Uint8Array> | ProcessOutput<string>> {\n const maxBytes = validateMaxBytes(options.maxBytes);\n const bytes = await withLocalWait(\n (settlementSignal) =>\n this.consumeLogs(settlementSignal, (reader) =>\n readProcessOutput(reader, {\n maxBytes,\n processId: this.id,\n pid: this.pid\n })\n ),\n {\n processId: this.id,\n operation: 'output',\n timeout: options.timeout,\n signal: options.signal\n }\n );\n if ('encoding' in options && options.encoding === 'utf8') {\n return {\n ...bytes,\n stdout: new TextDecoder().decode(bytes.stdout),\n stderr: new TextDecoder().decode(bytes.stderr)\n };\n }\n return bytes;\n }\n\n async waitForExit(\n options: { timeout?: number; signal?: AbortSignal } = {}\n ): Promise<ProcessExit> {\n return withLocalWait(\n (settlementSignal) =>\n this.consumeLogs(settlementSignal, (reader) =>\n readTerminal(reader, this.id, this.pid)\n ),\n {\n processId: this.id,\n operation: 'waitForExit',\n timeout: options.timeout,\n signal: options.signal\n }\n );\n }\n\n async waitForLog(\n pattern: string | RegExp,\n options: WaitForLogOptions = {}\n ): Promise<WaitForLogResult> {\n return withLocalWait(\n (settlementSignal) =>\n this.consumeLogs(settlementSignal, (reader) =>\n readUntilLogMatch(\n reader,\n pattern,\n options.stream ?? 'both',\n this.id,\n this.pid\n )\n ),\n {\n processId: this.id,\n operation: 'waitForLog',\n timeout: options.timeout,\n signal: options.signal\n }\n );\n }\n\n async waitForPort(\n port: number,\n options: WaitForPortOptions = {}\n ): Promise<void> {\n const { timeout, signal, ...rpcOptions } = options;\n return withLocalWait(\n (settlementSignal) =>\n this.waitForPortSubscriptions(port, rpcOptions, settlementSignal),\n {\n processId: this.id,\n operation: 'waitForPort',\n timeout,\n signal,\n port\n }\n );\n }\n\n private async waitForPortSubscriptions(\n port: number,\n options: Omit<WaitForPortOptions, 'timeout' | 'signal'>,\n settlementSignal: AbortSignal\n ): Promise<void> {\n const portStream = await openRemoteSubscription(\n this.capability.openPortWatch(port, options),\n {\n operation: `watch port ${port}`,\n protocol: 'pull',\n signal: settlementSignal\n }\n );\n let logStream: ReadableStream<ProcessLogEvent> | undefined;\n let portReader: ReadableStreamDefaultReader<PortWatchEvent> | undefined;\n let logReader: ReadableStreamDefaultReader<ProcessLogEvent> | undefined;\n try {\n portReader = portStream.getReader();\n logStream = await openRemoteSubscription(\n this.capability.openLogs({ replay: true, follow: true }),\n {\n operation: 'read process logs',\n protocol: 'pull',\n signal: settlementSignal\n }\n );\n logReader = logStream.getReader();\n await waitForReadiness(portReader, logReader, {\n processId: this.id,\n pid: this.pid,\n port\n });\n } finally {\n await cancelOwned(portReader, portStream);\n if (logStream !== undefined) await cancelOwned(logReader, logStream);\n }\n }\n\n kill(signal = 15): Promise<void> {\n return this.capability.kill(signal);\n }\n\n private async consumeLogs<T>(\n signal: AbortSignal,\n consume: (\n reader: ReadableStreamDefaultReader<ProcessLogEvent>\n ) => Promise<T>\n ): Promise<T> {\n const stream = await openRemoteSubscription(\n this.capability.openLogs({ replay: true, follow: true }),\n { signal, operation: 'read process logs', protocol: 'pull' }\n );\n return this.consume(stream, consume);\n }\n\n private async consume<T>(\n stream: ReadableStream<ProcessLogEvent>,\n consume: (\n reader: ReadableStreamDefaultReader<ProcessLogEvent>\n ) => Promise<T>\n ): Promise<T> {\n let reader: ReadableStreamDefaultReader<ProcessLogEvent> | undefined;\n try {\n reader = stream.getReader();\n return await consume(reader);\n } finally {\n await cancelOwned(reader, stream);\n }\n }\n}\n\nexport function createSandboxProcess(\n descriptor: ProcessRPCDescriptor\n): SandboxProcess {\n return new SandboxProcessImpl(\n descriptor.id,\n descriptor.pid,\n descriptor.capability\n );\n}\n\nasync function readTerminal(\n reader: ReadableStreamDefaultReader<ProcessLogEvent>,\n processId: string,\n pid: number\n): Promise<ProcessExit> {\n for (;;) {\n const result = await reader.read();\n if (result.done) streamClosed('Process log stream ended before exit');\n if ('state' in result.value) {\n if (result.value.state === 'exited') return result.value.exit;\n throw processFailure(processId, pid, result.value.error);\n }\n }\n}\n\nasync function cancelOwned<T>(\n reader: ReadableStreamDefaultReader<T> | undefined,\n stream: ReadableStream<T>\n): Promise<void> {\n try {\n if (reader !== undefined) await reader.cancel();\n else await stream.cancel();\n } catch {\n // The primary consumer result wins over cleanup failures.\n }\n}\n","/**\n * Unified extension surface for the Cloudflare Sandbox SDK.\n *\n * Every extension \\u2014 whether it just drives existing control sub-APIs or\n * ships its own container sidecar \\u2014 shares one shape: a class extending\n * {@link SandboxExtension}, captured lazily via a `withX(this)` factory.\n *\n * - No sidecar? Extend {@link SandboxExtension} and use `this.exec()` or\n * `this.withRuntime()` for scoped control APIs. Don't pass a package.\n * - Need a container sidecar? Pass an {@link ExtensionPackage} to `super()`.\n * Then use {@link SandboxExtension.withSidecar} with the sidecar's typed\n * capnweb remote main. Calls on that stub stream through capnweb \\u2014 callback\n * parameters round-trip across both the DO\\u2192container and container\\u2192sidecar\n * hops.\n *\n * `ExtensionPackage` carries tarball bytes produced by an extension build.\n * The SDK sends those bytes only when the container has not provisioned the\n * package hash yet.\n */\n\nimport { RpcTarget } from 'cloudflare:workers';\nimport type {\n ExecOptions,\n ExtensionHealth,\n ExtensionPackage,\n ProcessStatus,\n SandboxBackupAPI,\n SandboxCommand,\n SandboxExtensionsAPI,\n SandboxFilesAPI,\n SandboxPortsAPI,\n SandboxProcess,\n SandboxTerminalsAPI,\n SandboxTunnelsAPI,\n SandboxUtilsAPI,\n SandboxWatchAPI\n} from '@repo/shared';\nimport { EXTENSION_TARBALL_REQUIRED } from '@repo/shared';\nimport { createSandboxProcess } from '../processes';\nimport type { ProcessRPCDescriptor } from '../processes/rpc-types';\n\n// Re-export the wire types so consumers can author extensions from this\n// subpath without reaching into `@repo/shared` directly.\nexport type { ExtensionHealth, ExtensionPackage } from '@repo/shared';\n\nexport type ExtensionRuntimeControl = {\n readonly files: SandboxFilesAPI;\n readonly ports: SandboxPortsAPI;\n readonly backup: SandboxBackupAPI;\n readonly watch: SandboxWatchAPI;\n readonly tunnels: SandboxTunnelsAPI;\n readonly terminals: SandboxTerminalsAPI;\n readonly extensions: SandboxExtensionsAPI;\n readonly utils: SandboxUtilsAPI;\n};\n\ntype ExtensionRuntimeDomain =\n ExtensionRuntimeControl[keyof ExtensionRuntimeControl];\n\nexport type ExtensionRuntimeCallback = (\n control: ExtensionRuntimeControl\n) => Promise<unknown>;\n\ntype ExtensionRuntimeResult<T> = T extends\n | ExtensionRuntimeControl\n | ExtensionRuntimeDomain\n ? never\n : T;\n\nexport type ExtensionRuntimeCallbackResult<\n Call extends ExtensionRuntimeCallback\n> = Awaited<ReturnType<Call>>;\n\ntype RejectEscapingRuntimeCallback<Call extends ExtensionRuntimeCallback> =\n ExtensionRuntimeCallbackResult<Call> extends\n | ExtensionRuntimeControl\n | ExtensionRuntimeDomain\n ? never\n : unknown;\n\nexport type ExtensionRuntimeCall = <Call extends ExtensionRuntimeCallback>(\n operation: string,\n call: Call & RejectEscapingRuntimeCallback<Call>\n) => Promise<ExtensionRuntimeCallbackResult<Call>>;\n\nexport const sandboxRuntimeCall: unique symbol = Symbol('sandboxRuntimeCall');\n\nexport interface HTTPAuthHostConfig {\n token: string;\n username?: string;\n type?: 'basic' | 'bearer';\n}\n\nexport interface HTTPAuthInterceptorParams {\n hosts: Record<string, HTTPAuthHostConfig>;\n}\n\nexport type SandboxLike = {\n readonly [sandboxRuntimeCall]: ExtensionRuntimeCall;\n readonly exec?: (\n command: SandboxCommand,\n options?: ExecOptions\n ) => Promise<SandboxProcess | ProcessRPCDescriptor>;\n readonly getProcess?: (\n processId: string\n ) => Promise<SandboxProcess | ProcessRPCDescriptor | null>;\n readonly listProcesses?: () => Promise<ProcessStatus[]>;\n readonly envVars?: Record<string, string>;\n registerGitAuthInterceptor?: (\n params: HTTPAuthInterceptorParams\n ) => Promise<void>;\n};\n\nexport interface ExtensionProcessSandbox {\n exec(command: SandboxCommand, options?: ExecOptions): Promise<SandboxProcess>;\n getProcess(processId: string): Promise<SandboxProcess | null>;\n listProcesses(): Promise<ProcessStatus[]>;\n}\n\nfunction isProcessRPCDescriptor(\n process: SandboxProcess | ProcessRPCDescriptor\n): process is ProcessRPCDescriptor {\n return 'capability' in process;\n}\n\n/** Normalize local RPC descriptors and caller-side handles for extensions. */\nexport function createExtensionProcessSandbox(\n sandbox: SandboxLike\n): ExtensionProcessSandbox {\n return {\n async exec(command, options) {\n if (!sandbox.exec) {\n throw new Error(\n 'Sandbox extension requires the exec surface from the owning Sandbox'\n );\n }\n const process = await sandbox.exec.call(sandbox, command, options);\n return isProcessRPCDescriptor(process)\n ? createSandboxProcess(process)\n : process;\n },\n async getProcess(processId) {\n if (!sandbox.getProcess) {\n throw new Error(\n 'Sandbox extension requires the getProcess surface from the owning Sandbox'\n );\n }\n const process = await sandbox.getProcess.call(sandbox, processId);\n if (!process) return null;\n return isProcessRPCDescriptor(process)\n ? createSandboxProcess(process)\n : process;\n },\n listProcesses() {\n if (!sandbox.listProcesses) {\n throw new Error(\n 'Sandbox extension requires the listProcesses surface from the owning Sandbox'\n );\n }\n return sandbox.listProcesses.call(sandbox);\n }\n };\n}\n\n/**\n * The one base class for *every* extension.\n *\n * - SDK-only: just drives existing sub-APIs.\n * - Sidecar: pass an {@link ExtensionPackage} to `super(sandbox, pkg)` and\n * call `this.withSidecar<T>(operation, callback)` to use the typed capnweb stub inside one runtime callback.\n *\n * The sidecar helper throws a clear error if no package was supplied, so an\n * extension only \"becomes\" a sidecar extension when it opts in.\n *\n * ```ts\n * // SDK-only\n * class GitStatus extends SandboxExtension {\n * constructor(s: SandboxLike) { super(s); }\n * async status() {\n * const process = await this.exec(['git', 'status']);\n * return process.output({ encoding: 'utf8' });\n * }\n * }\n *\n * // Sidecar\n * import sidecarTarballBytes from './sidecar-package.tgz';\n * import type { MyAPI } from './shared';\n *\n * class MyExt extends SandboxExtension {\n * constructor(s: SandboxLike) { super(s, { tarball: new Uint8Array(sidecarTarballBytes) }); }\n * async run(input: string): Promise<string> {\n * return this.withSidecar<MyAPI, string>('my-ext.run', (api) =>\n * api.run(input)\n * );\n * }\n * }\n * ```\n *\n * RPC-safety: the sandbox lives in `#sandbox` and runtime control is reached\n * only through a symbol-keyed capability, so it is not exposed as a named RPC\n * method. Only the public methods you add form the extension's RPC surface.\n */\nexport abstract class SandboxExtension extends RpcTarget {\n readonly #sandbox: SandboxLike;\n readonly #pkg: ExtensionPackage | undefined;\n #hashPromise: Promise<string> | undefined;\n\n protected constructor(sandbox: SandboxLike, pkg?: ExtensionPackage) {\n super();\n this.#sandbox = sandbox;\n this.#pkg = pkg;\n }\n\n protected withRuntime<Call extends ExtensionRuntimeCallback>(\n operation: string,\n call: Call & RejectEscapingRuntimeCallback<Call>\n ): Promise<ExtensionRuntimeResult<ExtensionRuntimeCallbackResult<Call>>> {\n const guardedCall = async (runtimeControl: ExtensionRuntimeControl) => {\n const { control, revoke } = scopedRuntimeControl(runtimeControl);\n try {\n const result = await call(control);\n assertRuntimeControlDidNotEscape(result, control);\n return result;\n } finally {\n revoke();\n }\n };\n return this.#sandbox[sandboxRuntimeCall](\n operation,\n guardedCall as ExtensionRuntimeCallback\n ) as Promise<ExtensionRuntimeResult<ExtensionRuntimeCallbackResult<Call>>>;\n }\n\n /** Launch an argv process through the owning Sandbox. */\n protected exec(\n command: SandboxCommand,\n options?: ExecOptions\n ): Promise<SandboxProcess> {\n return createExtensionProcessSandbox(this.#sandbox).exec(command, options);\n }\n\n /** Sandbox-level environment applied to extension-launched processes. */\n protected get envVars(): Record<string, string> {\n return this.#sandbox.envVars ?? {};\n }\n\n protected get httpAuthInterceptor():\n | ((params: HTTPAuthInterceptorParams) => Promise<void>)\n | undefined {\n const register = this.#sandbox.registerGitAuthInterceptor;\n return register\n ? (params) => register.call(this.#sandbox, params)\n : undefined;\n }\n\n /**\n * Provision/connect to the sidecar and use its typed capnweb remote inside\n * one runtime callback. The remote is invalid after `call` resolves or\n * rejects, so extension code cannot silently reconnect or keep using an old\n * runtime's sidecar.\n */\n protected async withSidecar<T extends object, Result>(\n operation: string,\n call: (api: T) => Promise<Result>\n ): Promise<Result> {\n const pkg = this.#requirePackage();\n const packageHash = await this.#hashOnce();\n const scopedCall = async (control: ExtensionRuntimeControl) => {\n const connected = await this.#connect<T>(\n control.extensions,\n pkg,\n packageHash\n );\n const { proxy, revoke } = scopedSidecarRemote<T>(connected);\n try {\n const result = await call(proxy);\n assertSidecarRemoteDidNotEscape(result);\n return detachPlainData(result) as Result;\n } finally {\n revoke();\n }\n };\n return (await this.withRuntime(\n operation,\n scopedCall as ExtensionRuntimeCallback\n )) as Result;\n }\n\n /** Health snapshot for this extension's sidecar. */\n protected async sidecarHealth(): Promise<ExtensionHealth> {\n const hash = await this.#hashOnce();\n return await this.withRuntime('extension.health', (control) =>\n control.extensions.health(hash)\n );\n }\n\n /**\n * Stop this extension's sidecar. The next `withSidecar()` call will respawn\n * it on demand.\n */\n protected async stopSidecar(): Promise<void> {\n const hash = await this.#hashOnce();\n await this.withRuntime('extension.stop', (control) =>\n control.extensions.stop(hash)\n );\n }\n\n // --- internals -----------------------------------------------------------\n\n async #connect<T extends object>(\n api: SandboxExtensionsAPI,\n pkg: ExtensionPackage,\n packageHash: string\n ): Promise<T> {\n try {\n return (await api.connect({\n packageHash,\n bin: pkg.bin,\n readinessTimeoutMs: pkg.readinessTimeoutMs,\n allowInstallScripts: pkg.allowInstallScripts\n })) as T;\n } catch (error) {\n if (!isTarballRequiredError(error)) throw error;\n try {\n return (await api.connect({\n packageHash,\n tarball: pkg.tarball,\n bin: pkg.bin,\n readinessTimeoutMs: pkg.readinessTimeoutMs,\n allowInstallScripts: pkg.allowInstallScripts\n })) as T;\n } catch (retryError) {\n throw createSidecarProvisioningError(packageHash, retryError);\n }\n }\n }\n\n #hashOnce(): Promise<string> {\n const pkg = this.#requirePackage();\n this.#hashPromise ??= sha256Hex(pkg.tarball);\n return this.#hashPromise;\n }\n\n #requirePackage(): ExtensionPackage {\n if (!this.#pkg) {\n throw new Error(\n 'This extension has no sidecar package. Pass one to `super(sandbox, pkg)` to use sidecar/sidecarHealth/stopSidecar.'\n );\n }\n return this.#pkg;\n }\n}\n\n/**\n * Recognise the host's `ExtensionTarballRequired` error across the capnweb\n * boundary. There are two cases:\n *\n * 1. capnweb preserves `Error.name`, so the primary wire-safe contract is the\n * string constant `EXTENSION_TARBALL_REQUIRED`.\n * 2. capnweb sometimes re-wraps the error as an `RPCTransportError`, discarding\n * `name` but preserving the message text. We fall back to matching the\n * message so the tarball retry still fires in that case.\n */\nfunction assertRuntimeControlDidNotEscape(\n result: unknown,\n control: ExtensionRuntimeControl\n): void {\n const forbiddenHandles: unknown[] = [\n control,\n control.files,\n control.ports,\n control.backup,\n control.watch,\n control.tunnels,\n control.terminals,\n control.extensions,\n control.utils\n ].filter((handle) => handle !== undefined);\n\n if (!forbiddenHandles.includes(result)) return;\n\n throw new Error(\n 'Sandbox extension runtime callbacks must not return runtime control handles'\n );\n}\n\nfunction scopedRuntimeControl(target: ExtensionRuntimeControl): {\n control: ExtensionRuntimeControl;\n revoke(): void;\n} {\n let active = true;\n const inactiveError = () =>\n new Error(\n 'Sandbox extension runtime control is no longer valid outside its runtime callback'\n );\n const wrappedDomains = new WeakMap<object, object>();\n const scopeDomain = <Domain extends object>(domain: Domain): Domain => {\n const existing = wrappedDomains.get(domain);\n if (existing) return existing as Domain;\n const proxy = new Proxy(domain, {\n get(domainTarget, property, receiver) {\n if (!active) return () => Promise.reject(inactiveError());\n const value = Reflect.get(domainTarget, property, receiver) as unknown;\n if (typeof value === 'function') {\n return (...args: unknown[]) => {\n if (!active) return Promise.reject(inactiveError());\n const result = Reflect.apply(value, domainTarget, args) as unknown;\n return scopeRuntimeResult(result);\n };\n }\n if (typeof value === 'object' && value !== null) {\n if (objectHasCallableMember(value)) return scopeDomain(value);\n return detachPlainData(value);\n }\n return value;\n }\n });\n wrappedDomains.set(domain, proxy);\n return proxy as Domain;\n };\n const scopeRuntimeResult = (result: unknown): unknown => {\n if (result instanceof Promise) {\n return result.then(scopeRuntimeResult);\n }\n if (typeof result === 'object' && result !== null) {\n if (objectHasCallableMember(result)) return scopeDomain(result);\n return detachPlainData(result);\n }\n return result;\n };\n\n const control: ExtensionRuntimeControl = {\n files: scopeDomain(target.files),\n ports: scopeDomain(target.ports),\n backup: scopeDomain(target.backup),\n watch: scopeDomain(target.watch),\n tunnels: scopeDomain(target.tunnels),\n terminals: scopeDomain(target.terminals),\n extensions: scopeDomain(target.extensions),\n utils: scopeDomain(target.utils)\n };\n return {\n control,\n revoke: () => {\n active = false;\n }\n };\n}\n\nconst sidecarRemoteProxies = new WeakSet<object>();\n\nfunction scopedSidecarRemote<T extends object>(\n target: T\n): {\n proxy: T;\n revoke(): void;\n} {\n let active = true;\n const wrappedTargets = new WeakMap<object, object>();\n const createProxy = <Value extends object>(currentTarget: Value): Value => {\n const existing = wrappedTargets.get(currentTarget);\n if (existing) return existing as Value;\n const proxy = new Proxy(currentTarget, {\n get(targetObject, property, receiver) {\n if (!active) {\n return () =>\n Promise.reject(\n new Error(\n 'Sandbox extension sidecar remote is no longer valid outside its runtime callback'\n )\n );\n }\n const value = Reflect.get(targetObject, property, receiver) as unknown;\n if (typeof value === 'function') {\n return (...args: unknown[]) => {\n if (!active) {\n return Promise.reject(\n new Error(\n 'Sandbox extension sidecar remote is no longer valid outside its runtime callback'\n )\n );\n }\n const result = Reflect.apply(value, targetObject, args) as unknown;\n return wrapSidecarResult(result, createProxy);\n };\n }\n if (typeof value === 'object' && value !== null) {\n if (objectHasCallableMember(value)) return createProxy(value);\n return detachPlainData(value);\n }\n return value;\n }\n });\n wrappedTargets.set(currentTarget, proxy);\n sidecarRemoteProxies.add(proxy);\n return proxy as Value;\n };\n\n return {\n proxy: createProxy(target),\n revoke: () => {\n active = false;\n }\n };\n}\n\nfunction wrapSidecarResult(\n result: unknown,\n wrapObject: <Value extends object>(value: Value) => Value\n): unknown {\n if (result instanceof Promise) {\n return result.then((value) => wrapSidecarResult(value, wrapObject));\n }\n if (typeof result === 'object' && result !== null) {\n if (objectHasCallableMember(result)) return wrapObject(result);\n return detachPlainData(result);\n }\n return result;\n}\n\nfunction objectHasCallableMember(value: object): boolean {\n if (Array.isArray(value))\n return value.some((entry) => typeof entry === 'function');\n let current: object | null = value;\n while (current && current !== Object.prototype) {\n for (const property of Reflect.ownKeys(current)) {\n if (property === 'constructor') continue;\n const descriptor = Reflect.getOwnPropertyDescriptor(current, property);\n if (!descriptor) continue;\n if (typeof descriptor.value === 'function') return true;\n if (typeof descriptor.get === 'function') return true;\n }\n current = Reflect.getPrototypeOf(current);\n }\n return false;\n}\n\nfunction assertSidecarRemoteDidNotEscape(result: unknown): void {\n const seen = new WeakSet<object>();\n const visit = (value: unknown): boolean => {\n if (typeof value !== 'object' || value === null) return false;\n if (seen.has(value)) return false;\n seen.add(value);\n if (sidecarRemoteProxies.has(value)) return true;\n if (Array.isArray(value)) return value.some(visit);\n return Object.values(value as Record<string, unknown>).some(visit);\n };\n\n if (!visit(result)) return;\n throw new Error(\n 'Sandbox extension sidecar callbacks must not return sidecar remotes'\n );\n}\n\nfunction detachPlainData<T>(value: T): T {\n if (typeof value !== 'object' || value === null) return value;\n return structuredClone(value) as T;\n}\n\nfunction isTarballRequiredError(error: unknown): boolean {\n if (typeof error !== 'object' || error === null) return false;\n const candidate = error as { name?: unknown; message?: unknown };\n if (candidate.name === EXTENSION_TARBALL_REQUIRED) return true;\n if (typeof candidate.message !== 'string') return false;\n return (\n candidate.message.includes(EXTENSION_TARBALL_REQUIRED) ||\n /Extension package '[0-9a-f]{64}' is not provisioned/.test(\n candidate.message\n )\n );\n}\n\nfunction createSidecarProvisioningError(\n packageHash: string,\n cause: unknown\n): Error {\n const causeMessage =\n cause instanceof Error\n ? cause.message\n : typeof cause === 'string'\n ? cause\n : String(cause);\n return new Error(\n `Failed to provision sandbox sidecar package '${packageHash}'. The sidecar tarball was sent to the container, but the container could not install or start it. Check that the extension build generated a valid npm-style .tgz, that the .tgz is included in the Worker bundle, and that the sidecar package declares a valid package.json bin/sandboxExtension entry. Cause: ${causeMessage}`,\n { cause }\n );\n}\n\n/**\n * Hex sha256 of a tarball via Web Crypto, which is available in workerd and\n * every modern runtime. Avoids a Node-only path so this module stays\n * Worker-bundle-safe.\n */\nasync function sha256Hex(bytes: Uint8Array): Promise<string> {\n const digest = await crypto.subtle.digest('SHA-256', bytes as BufferSource);\n const view = new Uint8Array(digest);\n let hex = '';\n for (const byte of view) {\n hex += byte.toString(16).padStart(2, '0');\n }\n return hex;\n}\n"],"mappings":";;;;;;;AAoBA,SAAS,oBACP,OACmD;AACnD,KAAI,EAAE,mBAAmB,OAAQ,QAAO;CACxC,MAAM,WAAW,MAAM;AACvB,QACE,OAAO,UAAU,SAAS,YAC1B,OAAO,OAAO,WAAW,SAAS,KAAK,IACvC,OAAO,SAAS,YAAY,YAC5B,OAAO,SAAS,eAAe,YAC/B,OAAO,SAAS,cAAc,YAC9B,OAAO,SAAS,YAAY,YAC5B,SAAS,YAAY;;AASzB,SAAgB,kBACd,OACA,UAAiC,EAAE,EAC5B;AACP,KAAI,iBAAiB,aAAc,OAAM;AAEzC,KAAI,iBAAiB,OAAO;AAC1B,MAAI,oBAAoB,MAAM,CAC5B,OAAM;EAGR,MAAM,aAAa;AAInB,MACE,OAAO,WAAW,SAAS,YAC3B,OAAO,OAAO,WAAW,WAAW,KAAK,EACzC;GACA,MAAM,OAAO,WAAW;GACxB,MAAMA,YACJ,WAAW,WAAW,OAAO,WAAW,YAAY,WAC/C,WAAW,UACZ,EAAE;AACR,SAAM,wBAAwB;IAC5B;IACA,SAAS,MAAM;IACf;IACA,YAAY,cAAc,KAAK;IAC/B,4BAAW,IAAI,MAAM,EAAC,aAAa;IACpC,CAAC;;EAGJ,IAAIC;AACJ,MAAI;AACF,aAAU,KAAK,MAAM,MAAM,QAAQ;UAC7B;AACR,MACE,WACA,OAAO,QAAQ,SAAS,YACxB,OAAO,QAAQ,YAAY,SAE3B,OAAM,wBAAwB;GAC5B,MAAM,QAAQ;GACd,SAAS,QAAQ;GACjB,SAAS,QAAQ,WAAW,EAAE;GAC9B,YAAY,cAAc,QAAQ,KAAkB;GACpD,4BAAW,IAAI,MAAM,EAAC,aAAa;GACpC,CAAC;EAGJ,MAAM,oBAAoB,4BAA4B,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QAAO;AACxD,QAAO,gBAAgB,MAAM;;AAG/B,SAAS,uBAAuB,OAAyB;AACvD,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,YAAY;AAClB,KAAI,UAAU,SAAS,2BAA4B,QAAO;AAC1D,KAAI,OAAO,UAAU,YAAY,SAAU,QAAO;AAClD,QACE,UAAU,QAAQ,SAAS,2BAA2B,IACtD,sDAAsD,KACpD,UAAU,QACX;;AAIL,SAAS,+BACP,aACA,OACO;CACP,MAAM,eACJ,iBAAiB,QACb,MAAM,UACN,OAAO,UAAU,WACf,QACA,OAAO,MAAM;AACrB,QAAO,IAAI,MACT,gDAAgD,YAAY,oTAAoT,gBAChX,EAAE,OAAO,CACV;;;;;;;AAQH,eAAe,UAAU,OAAoC;CAC3D,MAAM,SAAS,MAAM,OAAO,OAAO,OAAO,WAAW,MAAsB;CAC3E,MAAM,OAAO,IAAI,WAAW,OAAO;CACnC,IAAI,MAAM;AACV,MAAK,MAAM,QAAQ,KACjB,QAAO,KAAK,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI;AAE3C,QAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-Y5aF3nmJ.d.ts","names":["ProcessExit","ProcessLogCursor","ProcessLogEvent","ProcessStatus","WaitForLogResult","Disposable","ExecOptions","Record","ProcessLogsOptions","AbortSignal","WaitForExitOptions","WaitForLogOptions","ProcessOutput","T","ProcessOutputOptions","ProcessTextOutputOptions","SandboxProcess","Promise","ReadableStream","RegExp","Uint8Array","WaitForPortOptions","PortCheckRequest","PortCheckResponse","PortWatchRequest","PortWatchEvent","PortWatchRPCOptions","PortWatchSubscriptionAPI","SandboxOptions","ProcessExit","ProcessFailure","SandboxCommand","WaitForExitOptions","CreateTerminalOptions","Record","TerminalSnapshot","TerminalOutputCursor","TerminalOutputOptions","AbortSignal","TerminalOutputEvent","Uint8Array","TerminalOutputSubscriptionAPI","ReadableStream","Promise","Terminal","Request","Response","SandboxTerminalsAPI","Omit","PtyClientControlMessage","PtyServerControlMessage","BackupCompressionOptions","BackupOptions","DirectoryBackup","RestoreBackupResult","BucketProvider","BucketCredentials","RemoteMountBucketOptions","LocalMountBucketOptions","R2BindingMountBucketOptions","MountBucketOptions","MkdirResult","WriteFileResult","FileEncoding","ReadFileResult","ReadFileStreamResult","Uint8Array","ReadableStream","DeleteFileResult","RenameFileResult","MoveFileResult","FileExistsResult","FileInfo","ListFilesOptions","ListFilesResult","FileStreamEvent","FileMetadata","FileChunk","WatchOptions","CheckChangesOptions","FileWatchEventType","WatchRequest","CheckChangesRequest","FileWatchSSEEvent","CheckChangesResult","EnvSetResult","PortExposeResult","HealthCheckResult","ShutdownResult"],"sources":["../../shared/dist/types/core.d.ts","../../shared/dist/pty-types.d.ts","../../shared/dist/types/backup-mounts.d.ts","../../shared/dist/types/filesystem.d.ts"],"sourcesContent":["import type { ProcessExit, ProcessLogCursor, ProcessLogEvent, ProcessStatus, WaitForLogResult } from '../process-types.js';\n/**\n * Represents a disposable resource with a cleanup function.\n * Common pattern used by VS Code, xterm.js, RxJS, and others.\n */\nexport interface Disposable {\n dispose(): void;\n}\nexport interface ExecOptions {\n cwd?: string;\n env?: Record<string, string>;\n timeout?: number;\n}\nexport interface ProcessLogsOptions {\n since?: ProcessLogCursor;\n replay?: boolean;\n follow?: boolean;\n signal?: AbortSignal;\n}\nexport interface WaitForExitOptions {\n timeout?: number;\n signal?: AbortSignal;\n}\nexport interface WaitForLogOptions extends WaitForExitOptions {\n stream?: 'stdout' | 'stderr' | 'both';\n}\nexport interface ProcessOutput<T> {\n stdout: T;\n stderr: T;\n exitCode: number;\n signal?: number;\n timedOut: boolean;\n truncated: boolean;\n}\nexport interface ProcessOutputOptions extends WaitForExitOptions {\n maxBytes?: number;\n}\nexport interface ProcessTextOutputOptions extends ProcessOutputOptions {\n encoding: 'utf8';\n}\nexport interface SandboxProcess {\n readonly id: string;\n readonly pid: number;\n readonly exitCode: Promise<number>;\n status(): Promise<ProcessStatus>;\n logs(options?: ProcessLogsOptions): Promise<ReadableStream<ProcessLogEvent>>;\n waitForLog(pattern: string | RegExp, options?: WaitForLogOptions): Promise<WaitForLogResult>;\n waitForExit(options?: WaitForExitOptions): Promise<ProcessExit>;\n output(options: ProcessTextOutputOptions): Promise<ProcessOutput<string>>;\n output(options?: ProcessOutputOptions): Promise<ProcessOutput<Uint8Array>>;\n waitForPort(port: number, options?: WaitForPortOptions): Promise<void>;\n kill(signal?: number): Promise<void>;\n}\n/**\n * Options for waiting for a port to become ready\n */\nexport interface WaitForPortOptions {\n /**\n * Check mode\n * - 'http': Make an HTTP request and check for success status\n * - 'tcp': Just check if TCP connection succeeds (default)\n * @default 'tcp'\n */\n mode?: 'http' | 'tcp';\n /**\n * HTTP path to check (only used when mode is 'http')\n * @default '/'\n */\n path?: string;\n /**\n * Expected HTTP status code or range (only used when mode is 'http')\n * - Single number: exact match (e.g., 200)\n * - Object with min/max: range match (e.g., { min: 200, max: 399 })\n * @default { min: 200, max: 399 }\n */\n status?: number | {\n min: number;\n max: number;\n };\n /**\n * Maximum time to wait in milliseconds\n * @default no timeout\n */\n timeout?: number;\n /**\n * Signal used to cancel waiting locally.\n */\n signal?: AbortSignal;\n /**\n * Interval between checks in milliseconds\n * @default 500\n */\n interval?: number;\n}\n/**\n * Request body for port readiness check endpoint\n */\nexport interface PortCheckRequest {\n port: number;\n mode: 'http' | 'tcp';\n path?: string;\n statusMin?: number;\n statusMax?: number;\n}\n/**\n * Response from port readiness check endpoint\n */\nexport interface PortCheckResponse {\n ready: boolean;\n /** HTTP status code received (only for http mode) */\n statusCode?: number;\n /** Error message if check failed */\n error?: string;\n}\n/**\n * Request body for streaming port watch endpoint\n */\nexport interface PortWatchRequest extends PortCheckRequest {\n /** Process ID to monitor - stream closes if process exits */\n processId?: string;\n /** Internal polling interval in ms (default: 500) */\n interval?: number;\n}\n/**\n * SSE event emitted by port watch stream\n */\nexport type PortWatchEvent = {\n type: 'watching';\n port: number;\n} | {\n type: 'ready';\n port: number;\n statusCode?: number;\n} | {\n type: 'error';\n port: number;\n error: string;\n};\nexport interface PortWatchRPCOptions {\n mode?: 'http' | 'tcp';\n path?: string;\n status?: number | {\n min: number;\n max: number;\n };\n interval?: number;\n}\nexport interface PortWatchSubscriptionAPI {\n stream(): Promise<ReadableStream<PortWatchEvent>>;\n cancel(): Promise<void>;\n [Symbol.dispose](): void;\n}\nexport interface SandboxOptions {\n /**\n * Duration after which the sandbox instance will sleep if no requests are received\n * Can be:\n * - A string like \"30s\", \"3m\", \"5m\", \"1h\" (seconds, minutes, or hours)\n * - A number representing seconds (e.g., 180 for 3 minutes)\n * Default: \"10m\" (10 minutes)\n *\n * Note: Ignored when keepAlive is true\n */\n sleepAfter?: string | number;\n /**\n * Keep the container alive indefinitely by preventing automatic shutdown\n * When true, the container will never auto-timeout and must be explicitly destroyed\n * - Any scenario where activity can't be automatically detected\n *\n * Important: You MUST call sandbox.destroy() when done to avoid resource leaks\n *\n * Default: false\n */\n keepAlive?: boolean;\n /**\n * Normalize sandbox ID to lowercase for preview URL compatibility\n *\n * Required for preview URLs because hostnames are case-insensitive (RFC 3986), which\n * would route requests to a different Durable Object instance with IDs containing uppercase letters.\n *\n * **Important:** Different normalizeId values create different Durable Object instances:\n * - `getSandbox(ns, \"MyProject\")` → DO key: \"MyProject\"\n * - `getSandbox(ns, \"MyProject\", {normalizeId: true})` → DO key: \"myproject\"\n *\n * **Future change:** In a future version, this will default to `true` (automatically lowercase all IDs).\n * IDs with uppercase letters will trigger a warning. To prepare, use lowercase IDs or explicitly\n * pass `normalizeId: true`.\n *\n * @example\n * getSandbox(ns, \"my-project\") // Works with preview URLs (lowercase)\n * getSandbox(ns, \"MyProject\", {normalizeId: true}) // Normalized to \"myproject\"\n *\n * @default false\n */\n normalizeId?: boolean;\n /**\n * Container startup timeout configuration\n *\n * Tune timeouts based on your container's characteristics. SDK defaults (30s instance, 90s ports)\n * work for most use cases. Adjust for heavy containers or fail-fast applications.\n *\n * Can also be configured via environment variables:\n * - SANDBOX_INSTANCE_TIMEOUT_MS\n * - SANDBOX_PORT_TIMEOUT_MS\n * - SANDBOX_POLL_INTERVAL_MS\n *\n * Precedence: options > env vars > SDK defaults\n *\n * @example\n * // Heavy containers (ML models, large apps)\n * getSandbox(ns, id, {\n * containerTimeouts: { portReadyTimeoutMS: 180_000 }\n * })\n *\n * @example\n * // Fail-fast for latency-sensitive apps\n * getSandbox(ns, id, {\n * containerTimeouts: {\n * instanceGetTimeoutMS: 15_000,\n * portReadyTimeoutMS: 30_000\n * }\n * })\n */\n containerTimeouts?: {\n /**\n * Time to wait for container instance provisioning\n * @default 30000 (30s) - or SANDBOX_INSTANCE_TIMEOUT_MS env var\n */\n instanceGetTimeoutMS?: number;\n /**\n * Time to wait for application startup and ports to be ready\n * @default 90000 (90s) - or SANDBOX_PORT_TIMEOUT_MS env var\n */\n portReadyTimeoutMS?: number;\n /**\n * How often to poll for container readiness\n * @default 300 (300ms) - or SANDBOX_POLL_INTERVAL_MS env var\n */\n waitIntervalMS?: number;\n };\n}\n//# sourceMappingURL=core.d.ts.map","import type { ProcessExit, ProcessFailure, SandboxCommand } from './process-types.js';\nimport type { WaitForExitOptions } from './types/core.js';\nexport interface CreateTerminalOptions {\n command: SandboxCommand;\n cwd?: string;\n env?: Record<string, string>;\n cols?: number;\n rows?: number;\n bufferSize?: number;\n}\nexport interface TerminalSnapshot {\n id: string;\n pid?: number;\n command: SandboxCommand;\n cwd?: string;\n status: 'running' | 'exited' | 'error';\n exit?: ProcessExit;\n error?: ProcessFailure;\n}\nexport type TerminalOutputCursor = string;\nexport interface TerminalOutputOptions {\n since?: TerminalOutputCursor;\n replay?: boolean;\n follow?: boolean;\n signal?: AbortSignal;\n}\nexport type TerminalOutputEvent = {\n type: 'data';\n terminalId: string;\n cursor: TerminalOutputCursor;\n timestamp: string;\n data: Uint8Array;\n} | {\n type: 'terminal';\n terminalId: string;\n cursor: TerminalOutputCursor;\n timestamp: string;\n state: 'exited';\n exit: ProcessExit;\n} | {\n type: 'terminal';\n terminalId: string;\n cursor: TerminalOutputCursor;\n timestamp: string;\n state: 'error';\n error: ProcessFailure;\n} | {\n type: 'truncated';\n terminalId: string;\n cursor?: TerminalOutputCursor;\n timestamp: string;\n};\nexport interface TerminalOutputSubscriptionAPI {\n stream(): Promise<ReadableStream<TerminalOutputEvent>>;\n cancel(): Promise<void>;\n [Symbol.dispose](): void;\n}\nexport interface Terminal {\n readonly id: string;\n getSnapshot(): Promise<TerminalSnapshot>;\n write(data: Uint8Array): Promise<void>;\n resize(cols: number, rows: number): Promise<void>;\n output(options?: TerminalOutputOptions): Promise<ReadableStream<TerminalOutputEvent>>;\n waitForExit(options?: WaitForExitOptions): Promise<ProcessExit>;\n interrupt(): Promise<void>;\n terminate(): Promise<void>;\n connect(request: Request, options?: {\n cursor?: TerminalOutputCursor;\n cols?: number;\n rows?: number;\n }): Promise<Response>;\n}\nexport interface SandboxTerminalsAPI {\n create(options: CreateTerminalOptions): Promise<TerminalSnapshot>;\n get(id: string): Promise<TerminalSnapshot | null>;\n list(): Promise<TerminalSnapshot[]>;\n output(id: string, options?: Omit<TerminalOutputOptions, 'signal'>): Promise<TerminalOutputSubscriptionAPI>;\n write(id: string, data: Uint8Array): Promise<void>;\n resize(id: string, cols: number, rows: number): Promise<void>;\n interrupt(id: string): Promise<void>;\n terminate(id: string): Promise<void>;\n hasActive(): Promise<boolean>;\n}\nexport type PtyClientControlMessage = {\n type: 'resize';\n cols: number;\n rows: number;\n} | {\n type: 'interrupt';\n} | {\n type: 'terminate';\n};\nexport type PtyServerControlMessage = {\n type: 'ready';\n cursor?: TerminalOutputCursor;\n} | {\n type: 'chunk';\n cursor: TerminalOutputCursor;\n byteLength: number;\n} | {\n type: 'truncated';\n cursor?: TerminalOutputCursor;\n} | {\n type: 'exit';\n cursor: TerminalOutputCursor;\n exit: ProcessExit;\n} | {\n type: 'error';\n cursor?: TerminalOutputCursor;\n code?: string;\n message: string;\n};\n//# sourceMappingURL=pty-types.d.ts.map","/**\n * Options for creating a directory backup\n */\nexport interface BackupCompressionOptions {\n format?: 'gzip' | 'lz4' | 'zstd';\n threads?: number;\n}\nexport interface BackupOptions {\n /** Directory to back up. Must be absolute and under `/workspace`, `/home`, `/tmp`, `/var/tmp`, or `/app`. */\n dir: string;\n /** Human-readable name for this backup. Optional. */\n name?: string;\n /** Seconds until automatic garbage collection. Default: 259200 (3 days). No upper limit. */\n ttl?: number;\n /**\n * Respect git ignore rules for the backup directory when it is inside a git repository.\n *\n * Default: false.\n * If the directory is not inside a git repository, no git-based exclusions are applied.\n * If git is not installed in the container, a warning is logged and gitignore rules are skipped.\n */\n gitignore?: boolean;\n /**\n * Glob patterns to exclude from the backup.\n * A single-component pattern, such as `node_modules`, `dist/`, or `*.log`,\n * matches at any depth. A multi-component pattern, such as `build/output`,\n * matches only relative to `dir`. mksquashfs does not support `**`, so `**`\n * components are removed and do not make a multi-component pattern match at\n * any depth.\n *\n * @example ['node_modules', '*.log', '.cache', 'build/output']\n */\n excludes?: string[];\n /**\n * Use local R2 binding for backup storage instead of presigned URLs.\n * Required for local development where presigned URLs and FUSE are unavailable.\n * When true, the DO resolves BACKUP_BUCKET from its own env as an R2 binding.\n */\n localBucket?: boolean;\n compression?: BackupCompressionOptions;\n /**\n * Use parallel multipart upload to R2 for large archives.\n * Significantly speeds up uploads for archives over 10 MiB.\n * Default: true.\n */\n multipart?: boolean;\n}\n/**\n * Handle representing a stored directory backup.\n * Serializable metadata returned by createBackup().\n * Store it anywhere and later pass it to restoreBackup().\n */\nexport interface DirectoryBackup {\n /** Unique backup identifier */\n readonly id: string;\n /** Directory to restore into. Must be under `/workspace`, `/home`, `/tmp`, `/var/tmp`, or `/app`. */\n readonly dir: string;\n /** Whether this backup was created with local R2 binding mode. */\n readonly localBucket?: boolean;\n}\n/**\n * Result returned from a successful restoreBackup() call\n */\nexport interface RestoreBackupResult {\n success: boolean;\n /** The directory that was restored */\n dir: string;\n /** Backup ID that was restored */\n id: string;\n}\n/**\n * Supported S3-compatible storage providers\n */\nexport type BucketProvider = 'r2' | 's3' | 'gcs';\n/**\n * Credentials for S3-compatible storage\n */\nexport interface BucketCredentials {\n accessKeyId: string;\n secretAccessKey: string;\n}\n/**\n * Options for mounting an S3-compatible bucket via s3fs-FUSE (production)\n */\nexport interface RemoteMountBucketOptions {\n /**\n * S3-compatible endpoint URL\n *\n * Examples:\n * - R2: 'https://abc123.r2.cloudflarestorage.com'\n * - AWS S3: 'https://s3.us-west-2.amazonaws.com'\n * - GCS: 'https://storage.googleapis.com'\n */\n endpoint: string;\n /**\n * Optional provider hint for automatic s3fs flag configuration\n * If not specified, will attempt to detect from endpoint URL.\n *\n * Examples:\n * - 'r2' - Cloudflare R2 (adds nomixupload)\n * - 's3' - Amazon S3 (standard configuration)\n * - 'gcs' - Google Cloud Storage (no special flags needed)\n */\n provider?: BucketProvider;\n /**\n * Explicit credentials (overrides env var auto-detection)\n */\n credentials?: BucketCredentials;\n /**\n * Mount filesystem as read-only\n * Default: false\n */\n readOnly?: boolean;\n /**\n * Advanced: Override or extend s3fs options\n *\n * These will be merged with provider-specific defaults.\n * To override defaults completely, specify all options here.\n *\n * Common options:\n * - 'use_path_request_style' - Use path-style URLs (bucket/path vs bucket.host/path)\n * - 'nomixupload' - Disable mixed multipart uploads (needed for some providers)\n * - 'nomultipart' - Disable all multipart operations\n * - 'sigv2' - Use signature version 2 instead of v4\n * - 'no_check_certificate' - Skip SSL certificate validation (dev/testing only)\n */\n s3fsOptions?: string[];\n /**\n * Optional prefix/subdirectory within the bucket to mount.\n *\n * When specified, only the contents under this prefix are visible at the\n * mount point, scoping the mount to a subdirectory of the bucket.\n *\n * Must start with '/' (e.g., '/workspaces/project123' or '/data/uploads/')\n */\n prefix?: string;\n /**\n * Keep real credentials in the Durable Object; write dummy credentials into\n * the container-side s3fs password file. Outbound s3fs requests are\n * intercepted by the DO, signed with real credentials, and forwarded to the\n * configured endpoint.\n *\n * Default: false (real credentials are written into the container)\n */\n credentialProxy?: boolean;\n}\n/**\n * Options for mounting a local R2 binding via bidirectional sync (local dev)\n *\n * Used during local development with `wrangler dev`. The Durable Object\n * resolves the R2 binding from its own env using the `bucket` parameter\n * and syncs files via polling instead of s3fs-FUSE.\n */\nexport interface LocalMountBucketOptions {\n /**\n * Must be true to indicate local R2 binding mode.\n */\n localBucket: true;\n /**\n * Optional prefix/subdirectory within the bucket to sync.\n *\n * When specified, only the contents under this prefix will be visible\n * at the mount point.\n */\n prefix?: string;\n /**\n * Mount filesystem as read-only\n * Default: false\n */\n readOnly?: boolean;\n}\n/**\n * Options for mounting an R2 binding via credential-less egress interception.\n */\nexport interface R2BindingMountBucketOptions {\n /**\n * Must not be set — distinguishes this variant from RemoteMountBucketOptions.\n */\n endpoint?: never;\n /**\n * Optional prefix/subdirectory within the bucket to mount.\n *\n * When specified, only the contents under this prefix will be visible\n * at the mount point.\n */\n prefix?: string;\n /**\n * Mount filesystem as read-only\n * Default: false\n */\n readOnly?: boolean;\n /**\n * Advanced: Override or extend s3fs options.\n * Provider defaults for R2 are still applied automatically.\n */\n s3fsOptions?: string[];\n}\n/**\n * Options for mounting a bucket — remote (s3fs-FUSE), local (R2 binding sync),\n * or R2 egress (credential-less s3fs via egress interception).\n */\nexport type MountBucketOptions = RemoteMountBucketOptions | LocalMountBucketOptions | R2BindingMountBucketOptions;\n//# sourceMappingURL=backup-mounts.d.ts.map","export interface MkdirResult {\n success: boolean;\n path: string;\n recursive: boolean;\n timestamp: string;\n exitCode?: number;\n}\nexport interface WriteFileResult {\n success: boolean;\n path: string;\n timestamp: string;\n exitCode?: number;\n}\n/**\n * Valid `encoding` values accepted by `readFile` / `writeFile` options.\n *\n * - `'utf-8'` / `'utf8'` — treat content as text.\n * - `'base64'` — treat content as base64-encoded binary.\n * - `'none'` — streaming variant of `readFile`, returns a\n * `ReadableStream<Uint8Array>` of raw bytes (see `ReadFileStreamResult`).\n */\nexport type FileEncoding = 'utf-8' | 'utf8' | 'base64' | 'none';\nexport interface ReadFileResult {\n success: boolean;\n path: string;\n content: string;\n timestamp: string;\n exitCode?: number;\n /**\n * Encoding used for content (utf-8 for text, base64 for binary)\n */\n encoding?: 'utf-8' | 'base64';\n /**\n * Whether the file is detected as binary\n */\n isBinary?: boolean;\n /**\n * MIME type of the file (e.g., 'image/png', 'text/plain')\n */\n mimeType?: string;\n /**\n * File size in bytes\n */\n size?: number;\n}\n/**\n * Result of `readFile()` with `encoding: 'none'`.\n *\n * `content` is a raw binary `ReadableStream<Uint8Array>` delivered directly\n * over the capnp channel — no base64 encoding, no SSE framing, no buffering.\n */\nexport interface ReadFileStreamResult {\n success: true;\n path: string;\n content: ReadableStream<Uint8Array>;\n size: number;\n mimeType: string;\n timestamp: string;\n}\nexport interface DeleteFileResult {\n success: boolean;\n path: string;\n timestamp: string;\n exitCode?: number;\n}\nexport interface RenameFileResult {\n success: boolean;\n path: string;\n newPath: string;\n timestamp: string;\n exitCode?: number;\n}\nexport interface MoveFileResult {\n success: boolean;\n path: string;\n newPath: string;\n timestamp: string;\n exitCode?: number;\n}\nexport interface FileExistsResult {\n success: boolean;\n path: string;\n exists: boolean;\n timestamp: string;\n}\nexport interface FileInfo {\n name: string;\n absolutePath: string;\n relativePath: string;\n type: 'file' | 'directory' | 'symlink' | 'other';\n size: number;\n modifiedAt: string;\n mode: string;\n permissions: {\n readable: boolean;\n writable: boolean;\n executable: boolean;\n };\n}\nexport interface ListFilesOptions {\n recursive?: boolean;\n includeHidden?: boolean;\n}\nexport interface ListFilesResult {\n success: boolean;\n path: string;\n files: FileInfo[];\n count: number;\n timestamp: string;\n exitCode?: number;\n}\n/**\n * SSE events for file streaming\n */\nexport type FileStreamEvent = {\n type: 'metadata';\n mimeType: string;\n size: number;\n isBinary: boolean;\n encoding: 'utf-8' | 'base64';\n} | {\n type: 'chunk';\n data: string;\n} | {\n type: 'complete';\n bytesRead: number;\n} | {\n type: 'error';\n error: string;\n};\n/**\n * File metadata from streaming\n */\nexport interface FileMetadata {\n mimeType: string;\n size: number;\n isBinary: boolean;\n encoding: 'utf-8' | 'base64';\n}\n/**\n * File stream chunk - either string (text) or Uint8Array (binary, auto-decoded)\n */\nexport type FileChunk = string | Uint8Array;\n/**\n * Options for watching a directory.\n *\n * `watch()` resolves only after the watcher is established on the filesystem.\n * The returned SSE stream can be consumed with `parseSSEStream()`.\n */\nexport interface WatchOptions {\n /**\n * Watch subdirectories recursively\n * @default true\n */\n recursive?: boolean;\n /**\n * Glob patterns to include (e.g., '*.ts', '*.js').\n * If not specified, all files are included.\n * Cannot be used together with `exclude`.\n */\n include?: string[];\n /**\n * Glob patterns to exclude (e.g., 'node_modules', '.git').\n * Cannot be used together with `include`.\n * @default ['.git', 'node_modules', '.DS_Store']\n */\n exclude?: string[];\n}\n/**\n * Options for checking whether a path changed while disconnected.\n *\n * Pass the `version` returned from a previous `checkChanges()` call to learn\n * whether the path is unchanged, changed, or needs a full resync because the\n * retained change state was reset. Change state lives only for the current\n * container lifetime and may expire while idle.\n */\nexport interface CheckChangesOptions extends WatchOptions {\n /**\n * Version returned by a previous `checkChanges()` call.\n */\n since?: string;\n}\n/**\n * @internal SSE event types for container communication\n */\nexport type FileWatchEventType = 'create' | 'modify' | 'delete' | 'move_from' | 'move_to' | 'attrib';\n/**\n * @internal Request body for starting a file watch\n */\nexport interface WatchRequest {\n path: string;\n recursive?: boolean;\n events?: FileWatchEventType[];\n include?: string[];\n exclude?: string[];\n}\n/**\n * @internal Request body for checking retained change state.\n */\nexport interface CheckChangesRequest extends WatchRequest {\n since?: string;\n}\n/**\n * SSE events emitted by `sandbox.watch()`.\n */\nexport type FileWatchSSEEvent = {\n type: 'watching';\n path: string;\n watchId: string;\n} | {\n type: 'event';\n eventType: FileWatchEventType;\n path: string;\n isDirectory: boolean;\n timestamp: string;\n} | {\n type: 'error';\n error: string;\n} | {\n type: 'stopped';\n reason: string;\n};\n/**\n * Result returned by `checkChanges()`.\n */\nexport type CheckChangesResult = {\n success: true;\n status: 'unchanged' | 'changed';\n version: string;\n timestamp: string;\n} | {\n success: true;\n status: 'resync';\n reason: 'expired' | 'restarted';\n version: string;\n timestamp: string;\n};\nexport interface EnvSetResult {\n success: boolean;\n timestamp: string;\n}\nexport interface PortExposeResult {\n url: string;\n port: number;\n name?: string;\n}\nexport interface HealthCheckResult {\n success: boolean;\n status: 'healthy' | 'unhealthy';\n timestamp: string;\n}\nexport interface ShutdownResult {\n success: boolean;\n message: string;\n timestamp: string;\n}\n//# sourceMappingURL=filesystem.d.ts.map"],"mappings":";;;;AAkCiBc,UA1BAR,WAAAA,CA0BoB;EAGpBS,GAAAA,CAAAA,EAAAA,MAAAA;EAGAC,GAAAA,CAAAA,EA9BPT,MA8BOS,CAAAA,MAAc,EAAA,MAAA,CAAA;EAGRC,OAAAA,CAAAA,EAAAA,MAAAA;;AACTA,UA/BGT,kBAAAA,CA+BHS;EACKT,KAAAA,CAAAA,EA/BPP,gBA+BOO;EAA4CN,MAAAA,CAAAA,EAAAA,OAAAA;EAAfgB,MAAAA,CAAAA,EAAAA,OAAAA;EAARD,MAAAA,CAAAA,EA5B3BR,WA4B2BQ;;AACWN,UA3BlCD,kBAAAA,CA2BkCC;EAA4BP,OAAAA,CAAAA,EAAAA,MAAAA;EAARa,MAAAA,CAAAA,EAzB1DR,WAyB0DQ;;AAChBjB,UAxBtCW,iBAAAA,SAA0BD,kBAwBYV,CAAAA;EAARiB,MAAAA,CAAAA,EAAAA,QAAAA,GAAAA,QAAAA,GAAAA,MAAAA;;AACQL,UAtBtCA,aAsBsCA,CAAAA,CAAAA,CAAAA,CAAAA;EAARK,MAAAA,EArBnCJ,CAqBmCI;EAC1BH,MAAAA,EArBTD,CAqBSC;EAA6CM,QAAAA,EAAAA,MAAAA;EAAdR,MAAAA,CAAAA,EAAAA,MAAAA;EAARK,QAAAA,EAAAA,OAAAA;EACJI,SAAAA,EAAAA,OAAAA;;AACbJ,UAjBVH,oBAAAA,SAA6BJ,kBAiBnBO,CAAAA;EAAO,QAAA,CA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
1
|
-
{"version":3,"file":"index-DfXx3uZL.d.ts","names":["BackupCompressionOptions","ReadFileRequest","WriteFileRequest","DeleteFileRequest","RenameFileRequest","MoveFileRequest","MkdirRequest","FileExistsRequest","ListFilesRequest","CreateBackupRequest","UploadPart","UploadPartsRequest","UploadedPart","UploadPartsResponse","CreateBackupResponse","RestoreBackupRequest","RestoreBackupResponse","SandboxProcessesAPI","SandboxTerminalsAPI","CreateBackupResponse","RestoreBackupResponse","UploadedPart","UploadPartsResponse","BackupCompressionOptions","CheckChangesRequest","CheckChangesResult","DeleteFileResult","FileEncoding","FileExistsResult","ListFilesOptions","ListFilesResult","MkdirResult","MoveFileResult","PortWatchRPCOptions","PortWatchSubscriptionAPI","ReadFileResult","ReadFileStreamResult","RenameFileResult","WatchRequest","WriteFileResult","S3FSOptionValue","MountCommandResult","MountS3FSRequest","Record","RemoveMountDirectoryRequest","SandboxAPI","SandboxFilesAPI","SandboxPortsAPI","SandboxUtilsAPI","SandboxBackupAPI","SandboxWatchAPI","SandboxTunnelsAPI","SandboxMountsAPI","SandboxWorkspaceAPI","SandboxExtensionsAPI","ReadFileStreamOptions","ReadFileBinaryOptions","ReadFileOptions","Exclude","WriteFileOptions","MkdirOptions","Promise","Uint8Array","ReadableStream","RuntimeMetadata","CreateWorkspaceArchiveRequest","CreateWorkspaceArchiveResult","ExtractWorkspaceArchiveRequest","BackupUploadArchiveRequest","BackupDownloadArchiveRequest","Array","BackupPrepareRestoreRequest","BackupUploadPartsRequest","BackupCreateArchiveOptions","WatchSubscriptionAPI","TunnelInfo","QuickTunnelInfo","NamedTunnelInfo","TunnelOptions","TunnelRunMode","TunnelRunIdentity","TunnelRunRef","EnsureQuickTunnelRunRequest","EnsureNamedTunnelRunRequest","EnsureTunnelRunRequest","QuickTunnelRunSnapshot","NamedTunnelRunSnapshot","TunnelRunSnapshot","EnsureTunnelRunResult","StopTunnelRunRequest","StopTunnelRunResult","TunnelRunExitEvent","ExtensionPackage","ExtensionRegistration","ExtensionHealth","ExtensionConnectRequest","EXTENSION_TARBALL_REQUIRED","SandboxControlCallback"],"sources":["../../shared/dist/request-types.d.ts","../../shared/dist/rpc-types.d.ts","../src/processes/rpc-types.ts","../src/extensions/index.ts"],"sourcesContent":["import type { BackupCompressionOptions } from './types.js';\n/**\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 read a file\n */\nexport interface ReadFileRequest {\n path: string;\n encoding?: string;\n}\n/**\n * Request to write a file\n */\nexport interface WriteFileRequest {\n path: string;\n content: string;\n encoding?: string;\n}\n/**\n * Request to delete a file\n */\nexport interface DeleteFileRequest {\n path: string;\n}\n/**\n * Request to rename a file\n */\nexport interface RenameFileRequest {\n oldPath: string;\n newPath: string;\n}\n/**\n * Request to move a file\n */\nexport interface MoveFileRequest {\n sourcePath: string;\n destinationPath: string;\n}\n/**\n * Request to create a directory\n */\nexport interface MkdirRequest {\n path: string;\n recursive?: boolean;\n}\n/**\n * Request to check if a file or directory exists\n */\nexport interface FileExistsRequest {\n path: string;\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}\n/**\n * Request to create a backup archive from a directory.\n * The container creates a squashfs archive at archivePath.\n * The DO then reads it and uploads to R2.\n */\nexport interface CreateBackupRequest {\n /** Directory to back up */\n dir: string;\n /** Path where the container should write the archive */\n archivePath: string;\n /** Respect git ignore rules when the directory is inside a git repository */\n gitignore?: boolean;\n /** Glob patterns to exclude from the backup */\n excludes?: string[];\n compression?: BackupCompressionOptions;\n}\n/**\n * A single part to upload in a multipart upload.\n * The container reads the byte range from the local archive and PUTs it\n * to the presigned URL.\n */\nexport interface UploadPart {\n partNumber: number;\n /** Presigned PUT URL for this part */\n url: string;\n /** Byte offset within the archive file */\n offset: number;\n /** Number of bytes in this part */\n size: number;\n}\n/**\n * Request to upload parts of a backup archive directly from the container to R2.\n * Used for parallel multipart upload of large archives.\n */\nexport interface UploadPartsRequest {\n /** Path to the archive file in the container */\n archivePath: string;\n /** Parts to upload in parallel */\n parts: UploadPart[];\n}\n/**\n * Result for a single uploaded part (ETag returned by R2).\n */\nexport interface UploadedPart {\n partNumber: number;\n etag: string;\n}\n/**\n * Response after the container has uploaded all parts.\n */\nexport interface UploadPartsResponse {\n success: boolean;\n parts: UploadedPart[];\n}\n/**\n * Response from the container after creating a backup archive\n */\nexport interface CreateBackupResponse {\n success: boolean;\n /** Size of the archive in bytes */\n sizeBytes: number;\n /** Path to the archive file in the container */\n archivePath: string;\n}\n/**\n * Request to restore a backup from an archive file.\n * The DO writes the archive to archivePath first, then tells the container to extract it.\n */\nexport interface RestoreBackupRequest {\n /** Directory to restore into */\n dir: string;\n /** Path to the archive file in the container */\n archivePath: string;\n}\n/**\n * Response from the container after restoring a backup\n */\nexport interface RestoreBackupResponse {\n success: boolean;\n /** Directory that was restored */\n dir: string;\n}\n//# sourceMappingURL=request-types.d.ts.map","/**\n * Shared interface types for the container-control path.\n *\n * Defines the contract between the SDK control client and the container\n * control-plane API. The current wire implementation uses capnweb RPC.\n */\nimport type { SandboxProcessesAPI } from './process-types.js';\nimport type { SandboxTerminalsAPI } from './pty-types.js';\nimport type { CreateBackupResponse, RestoreBackupResponse, UploadedPart, UploadPartsResponse } from './request-types.js';\nimport type { BackupCompressionOptions, CheckChangesRequest, CheckChangesResult, DeleteFileResult, FileEncoding, FileExistsResult, ListFilesOptions, ListFilesResult, MkdirResult, MoveFileResult, PortWatchRPCOptions, PortWatchSubscriptionAPI, ReadFileResult, ReadFileStreamResult, RenameFileResult, WatchRequest, WriteFileResult } from './types.js';\nexport type S3FSOptionValue = string | boolean;\nexport interface MountCommandResult {\n success: boolean;\n exitCode: number;\n stdout: string;\n stderr: string;\n}\nexport interface MountS3FSRequest {\n source: string;\n mountPath: string;\n options: Record<string, S3FSOptionValue>;\n}\nexport interface RemoveMountDirectoryRequest {\n path: string;\n onlyIfNotMountpoint: boolean;\n}\nexport interface SandboxAPI {\n files: SandboxFilesAPI;\n ports: SandboxPortsAPI;\n utils: SandboxUtilsAPI;\n backup: SandboxBackupAPI;\n watch: SandboxWatchAPI;\n tunnels: SandboxTunnelsAPI;\n terminals: SandboxTerminalsAPI;\n processes: SandboxProcessesAPI;\n mounts: SandboxMountsAPI;\n workspace: SandboxWorkspaceAPI;\n extensions: SandboxExtensionsAPI;\n}\nexport type ReadFileStreamOptions = object;\nexport interface ReadFileBinaryOptions {\n encoding: 'none';\n}\nexport interface ReadFileOptions {\n encoding?: Exclude<FileEncoding, 'none'>;\n}\nexport interface WriteFileOptions {\n encoding?: string;\n permissions?: string;\n}\nexport interface MkdirOptions {\n recursive?: boolean;\n}\nexport interface SandboxFilesAPI {\n readFile(path: string, options: ReadFileBinaryOptions): Promise<ReadFileStreamResult>;\n readFile(path: string, options?: ReadFileOptions): Promise<ReadFileResult>;\n readFileStream(path: string, options?: ReadFileStreamOptions): Promise<ReadableStream<Uint8Array>>;\n writeFile(path: string, content: string, options?: WriteFileOptions): Promise<WriteFileResult>;\n writeFileStream(path: string, stream: ReadableStream<Uint8Array>, options?: Record<string, never>): Promise<{\n success: boolean;\n path: string;\n bytesWritten: number;\n timestamp: string;\n }>;\n deleteFile(path: string, options?: Record<string, never>): Promise<DeleteFileResult>;\n renameFile(oldPath: string, newPath: string, options?: Record<string, never>): Promise<RenameFileResult>;\n moveFile(sourcePath: string, destinationPath: string, options?: Record<string, never>): Promise<MoveFileResult>;\n mkdir(path: string, options?: MkdirOptions): Promise<MkdirResult>;\n listFiles(path: string, options?: ListFilesOptions): Promise<ListFilesResult>;\n exists(path: string, options?: Record<string, never>): Promise<FileExistsResult>;\n}\nexport interface SandboxPortsAPI {\n openWatch(port: number, options?: PortWatchRPCOptions): Promise<PortWatchSubscriptionAPI>;\n}\nexport interface RuntimeMetadata {\n runtimeIncarnationID: string;\n sandboxVersion: string;\n controlProtocolVersion: 1;\n}\nexport interface SandboxUtilsAPI {\n ping(): Promise<string>;\n getRuntimeMetadata(): Promise<RuntimeMetadata>;\n activateControlSession(expectedRuntimeIncarnationID: string): Promise<RuntimeMetadata>;\n}\nexport interface CreateWorkspaceArchiveRequest {\n root: string;\n excludes: readonly string[];\n}\nexport interface CreateWorkspaceArchiveResult {\n archivePath: string;\n}\nexport interface ExtractWorkspaceArchiveRequest {\n root: string;\n archivePath: string;\n}\nexport interface SandboxWorkspaceAPI {\n createArchive(request: CreateWorkspaceArchiveRequest): Promise<CreateWorkspaceArchiveResult>;\n extractArchive(request: ExtractWorkspaceArchiveRequest): Promise<void>;\n cleanupArchive(archivePath: string): Promise<void>;\n}\nexport interface SandboxMountsAPI {\n pathExists(path: string): Promise<boolean>;\n ensureDirectory(path: string): Promise<void>;\n chmodOwnerOnly(path: string): Promise<void>;\n deleteFile(path: string): Promise<void>;\n mountS3FS(request: MountS3FSRequest): Promise<MountCommandResult>;\n mountS3FSAndVerify(request: MountS3FSRequest): Promise<MountCommandResult>;\n isMountpoint(path: string): Promise<boolean>;\n unmountFuse(path: string): Promise<MountCommandResult>;\n unmountFuseIfMounted(path: string): Promise<void>;\n removeMountDirectory(request: RemoveMountDirectoryRequest): Promise<MountCommandResult>;\n}\nexport interface BackupUploadArchiveRequest {\n archivePath: string;\n url: string;\n timeoutMs: number;\n}\nexport interface BackupDownloadArchiveRequest {\n archivePath: string;\n expectedSize: number;\n parts: Array<{\n url: string;\n offset: number;\n range?: string;\n }>;\n timeoutMs: number;\n}\nexport interface BackupPrepareRestoreRequest {\n dir: string;\n backupId: string;\n archivePath: string;\n}\nexport interface BackupUploadPartsRequest {\n archivePath: string;\n parts: Array<{\n partNumber: number;\n url: string;\n offset: number;\n size: number;\n }>;\n}\nexport interface BackupCreateArchiveOptions {\n excludes?: string[];\n gitignore?: boolean;\n compression?: BackupCompressionOptions;\n}\nexport interface SandboxBackupAPI {\n createArchive(dir: string, archivePath: string, options?: BackupCreateArchiveOptions): Promise<CreateBackupResponse>;\n restoreArchive(dir: string, archivePath: string): Promise<RestoreBackupResponse>;\n uploadArchive(request: BackupUploadArchiveRequest): Promise<void>;\n uploadParts(request: BackupUploadPartsRequest): Promise<UploadPartsResponse>;\n prepareRestore(request: BackupPrepareRestoreRequest): Promise<{\n existingSize: number;\n }>;\n downloadArchive(request: BackupDownloadArchiveRequest): Promise<void>;\n extractArchive(dir: string, archivePath: string): Promise<void>;\n cleanupArchive(archivePath: string): Promise<void>;\n}\nexport type { UploadedPart, UploadPartsResponse };\nexport interface WatchSubscriptionAPI {\n stream(): Promise<ReadableStream<Uint8Array>>;\n cancel(): Promise<void>;\n [Symbol.dispose](): void;\n}\nexport interface SandboxWatchAPI {\n watch(request: WatchRequest): Promise<WatchSubscriptionAPI>;\n checkChanges(request: CheckChangesRequest): Promise<CheckChangesResult>;\n}\n/**\n * Public-facing tunnel record. Discriminated on the presence of `name`:\n * quick tunnels (`*.trycloudflare.com`) omit it, named tunnels carry the\n * label that was passed to `get(port, { name })`.\n */\nexport type TunnelInfo = QuickTunnelInfo | NamedTunnelInfo;\nexport interface QuickTunnelInfo {\n id: string;\n port: number;\n /** `https://<random>.trycloudflare.com`. */\n url: string;\n /** Hostname portion of `url`. */\n hostname: string;\n createdAt: string;\n /** Absent on quick tunnels; narrows the union. */\n name?: never;\n}\nexport interface NamedTunnelInfo {\n /** Cloudflare tunnel UUID (8-4-4-4-12). */\n id: string;\n port: number;\n /** `https://<hostname>`. */\n url: string;\n /** Full hostname bound to the tunnel (without scheme). */\n hostname: string;\n createdAt: string;\n /** Label originally passed via `TunnelOptions.name`. */\n name: string;\n}\n/**\n * Options accepted by `sandbox.tunnels.get(port, options)`. Omitting\n * `name` (or omitting the options object) selects the zero-config quick\n * tunnel; setting `name` selects the named-tunnel flow.\n */\nexport interface TunnelOptions {\n /**\n * Single DNS label under the configured zone. The full hostname is\n * `<name>.<zone-name>`. See `validateTunnelName` for the format rules.\n */\n name?: string;\n}\nexport type TunnelRunMode = 'quick' | 'named';\nexport interface TunnelRunIdentity {\n tunnelId: string;\n runId: string;\n}\nexport type TunnelRunRef = TunnelRunIdentity;\nexport interface EnsureQuickTunnelRunRequest extends TunnelRunIdentity {\n mode: 'quick';\n port: number;\n readyTimeoutMs?: number;\n stopGraceMs?: number;\n}\nexport interface EnsureNamedTunnelRunRequest extends TunnelRunIdentity {\n mode: 'named';\n port: number;\n cloudflaredToken: string;\n readyTimeoutMs?: number;\n stopGraceMs?: number;\n}\nexport type EnsureTunnelRunRequest = EnsureQuickTunnelRunRequest | EnsureNamedTunnelRunRequest;\nexport interface QuickTunnelRunSnapshot extends TunnelRunIdentity {\n mode: 'quick';\n port: number;\n url: string;\n hostname: string;\n startedAt: string;\n}\nexport interface NamedTunnelRunSnapshot extends TunnelRunIdentity {\n mode: 'named';\n port: number;\n startedAt: string;\n}\nexport type TunnelRunSnapshot = QuickTunnelRunSnapshot | NamedTunnelRunSnapshot;\nexport interface EnsureTunnelRunResult {\n run: TunnelRunSnapshot;\n started: boolean;\n}\nexport type StopTunnelRunRequest = TunnelRunRef;\nexport interface StopTunnelRunResult {\n stopped: boolean;\n}\nexport interface TunnelRunExitEvent extends TunnelRunIdentity {\n mode: TunnelRunMode;\n port: number;\n exitCode: number | null;\n}\nexport interface SandboxTunnelsAPI {\n /** Ensure a runtime-local cloudflared process for a DO-issued run id. */\n ensureTunnelRun(request: EnsureTunnelRunRequest): Promise<EnsureTunnelRunResult>;\n /** Stop the matching runtime-local cloudflared process. */\n stopTunnelRun(request: StopTunnelRunRequest): Promise<StopTunnelRunResult>;\n}\n/**\n * Author-facing description of a sidecar extension. An extension is an\n * npm-style package: an `.tgz` whose embedded `package.json` declares the\n * sidecar entrypoint (via `bin`) and any extension metadata (under the\n * `sandboxExtension` key).\n *\n * The SDK ships the tarball bytes; the container hashes them, provisions a\n * dedicated directory keyed by content hash, derives identity from the\n * embedded `package.json`, installs the package with `bun add`, and spawns\n * the declared bin under Bun.\n *\n * `ExtensionPackage` carries tarball bytes produced by an extension build.\n * The SDK sends those bytes only when the container has not provisioned the\n * package hash yet.\n */\nexport interface ExtensionPackage {\n /** Raw `.tgz` bytes. */\n tarball: Uint8Array;\n /**\n * Bin entry to run when the embedded `package.json` declares more than one.\n * Defaults to the value of `sandboxExtension.bin` in `package.json`, then\n * to the single bin entry if there is exactly one.\n */\n bin?: string;\n /**\n * Max time to wait for the sidecar to accept a capnweb connection on its\n * unix socket. Falls back to `sandboxExtension.readinessTimeoutMs` in\n * `package.json`, then to a host default.\n */\n readinessTimeoutMs?: number;\n /**\n * Run lifecycle scripts during `bun add`. Defaults to false — provisioning\n * happens before the sidecar is supervised, so install-time side effects\n * are deliberately opt-in.\n */\n allowInstallScripts?: boolean;\n}\n/**\n * Container-derived identity for a provisioned extension package. Not\n * authored — produced by the host after extracting the embedded\n * `package.json` from a tarball.\n */\nexport interface ExtensionRegistration {\n /** Slugified package name (e.g. `@acme/foo` → `acme-foo`). */\n id: string;\n packageName: string;\n version: string;\n /** Hex sha256 of the tarball bytes. */\n packageHash: string;\n /** Resolved bin entry the host spawns. */\n bin: string;\n readinessTimeoutMs: number;\n}\n/** Health snapshot for a provisioned extension. */\nexport interface ExtensionHealth {\n packageHash: string;\n id: string;\n version: string;\n /** Tarball is on disk and the package.json has been read. */\n provisioned: boolean;\n /** Sidecar process is currently running. */\n running: boolean;\n pid: number | null;\n /** Whether a `__ping__` round-tripped over capnweb. */\n responsive: boolean;\n}\n/**\n * Connect request payload. The SDK hashes the tarball locally and first sends\n * only the hash. If the current host process has not provisioned that hash,\n * it responds with an `ExtensionTarballRequired` error and the SDK retries\n * with `tarball` populated.\n */\nexport interface ExtensionConnectRequest {\n packageHash: string;\n /** Only sent when the host has not seen this hash yet. */\n tarball?: Uint8Array;\n bin?: string;\n readinessTimeoutMs?: number;\n allowInstallScripts?: boolean;\n}\n/**\n * Error name thrown by the host's `connect` when it has not yet provisioned\n * the requested hash and the request did not carry tarball bytes. The SDK\n * recognises this name via `Error.name` and retries the connect with the\n * bytes attached. Kept as a string constant so it survives capnweb\n * cross-realm error reconstruction.\n */\nexport declare const EXTENSION_TARBALL_REQUIRED = \"ExtensionTarballRequired\";\n/**\n * Control surface for container sidecar extensions.\n *\n * `connect` is the only entry point: it provisions on first use, supervises\n * lazily, and returns the sidecar's capnweb remote main as a stub. Calls on\n * the stub are proxied through the container's capnweb session to the\n * sidecar's capnweb session — callback parameters (including streaming\n * handlers) round-trip across both hops.\n */\nexport interface SandboxExtensionsAPI {\n /**\n * Provision the package (if new) and return the sidecar's typed remote\n * main. The result is a capnweb stub whose methods correspond to the\n * sidecar's `RpcTarget` surface.\n */\n connect(req: ExtensionConnectRequest): Promise<unknown>;\n /** Health snapshot, probing the sidecar with a `__ping__` when running. */\n health(packageHash: string): Promise<ExtensionHealth>;\n /** Stop a sidecar and release its capnweb session. */\n stop(packageHash: string): Promise<void>;\n}\n/**\n * RPC surface the Sandbox DO exposes to the container over the existing\n * capnweb session. The container reaches it via\n * `session.getRemoteMain<SandboxControlCallback>()` and invokes methods\n * to push control-plane events (today: tunnel exits) back to the DO.\n *\n * One stable target per sandbox; not per-tunnel. Reusable seam for\n * future container→DO events.\n */\nexport interface SandboxControlCallback {\n /** Called by the container when a runtime-local tunnel run exits. */\n onTunnelRunExit(event: TunnelRunExitEvent): Promise<void>;\n}\n//# sourceMappingURL=rpc-types.d.ts.map"],"mappings":";;;;;;;AC6KA;AACA;AAWiB6E,UD/EAjE,YAAAA,CC+Ee;EAiBfkE,UAAAA,EAAAA,MAAa;EAQbE,IAAAA,EAAAA,MAAAA;AAIjB;AACA;AAMA;AAOA;AACiBK,UDpHAxE,mBAAAA,CCoHsB;EAOtByE,OAAAA,EAAAA,OAAAA;EAKLC,KAAAA,ED9HD3E,YC8HC2E,EAAiB;AAC7B;AAIA;AACA;AAQA;AAE6BH,UDzIZtE,oBAAAA,CCyIYsE;EAAiCI,OAAAA,EAAAA,OAAAA;EAAR3B;EAE3B4B,SAAAA,EAAAA,MAAAA;EAA+BC;EAAR7B,WAAAA,EAAAA,MAAAA;;;;;ACjPjC,UF0HA7C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