@cloudflare/sandbox 0.2.3 → 0.2.4
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/container_src/handler/file.ts +222 -2
- package/container_src/index.ts +7 -0
- package/container_src/jupyter-service.ts +8 -5
- package/container_src/types.ts +9 -0
- package/dist/{chunk-CUHYLCMT.js → chunk-3CQ6THKA.js} +31 -1
- package/dist/chunk-3CQ6THKA.js.map +1 -0
- package/dist/{chunk-S5FFBU4Y.js → chunk-6EWSYSO7.js} +1 -1
- package/dist/{chunk-S5FFBU4Y.js.map → chunk-6EWSYSO7.js.map} +1 -1
- package/dist/{chunk-4KELYYKS.js → chunk-CKIGERRS.js} +7 -6
- package/dist/chunk-CKIGERRS.js.map +1 -0
- package/dist/{chunk-VTKZL632.js → chunk-HHUDRGPY.js} +2 -2
- package/dist/{client-bzEV222a.d.ts → client-Ce40ujDF.d.ts} +10 -62
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/interpreter.d.ts +2 -2
- package/dist/jupyter-client.d.ts +2 -2
- package/dist/jupyter-client.js +2 -2
- package/dist/request-handler.d.ts +3 -3
- package/dist/request-handler.js +4 -4
- package/dist/sandbox.d.ts +2 -2
- package/dist/sandbox.js +4 -4
- package/dist/types.d.ts +118 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/src/client.ts +62 -59
- package/src/index.ts +15 -13
- package/src/sandbox.ts +14 -4
- package/src/types.ts +110 -0
- package/dist/chunk-4KELYYKS.js.map +0 -1
- package/dist/chunk-CUHYLCMT.js.map +0 -1
- /package/dist/{chunk-VTKZL632.js.map → chunk-HHUDRGPY.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sandbox.ts","../src/request-handler.ts"],"sourcesContent":["import { Container, getContainer } from \"@cloudflare/containers\";\nimport { CodeInterpreter } from \"./interpreter\";\nimport type {\n CodeContext,\n CreateContextOptions,\n ExecutionResult,\n RunCodeOptions,\n} from \"./interpreter-types\";\nimport { JupyterClient } from \"./jupyter-client\";\nimport { isLocalhostPattern } from \"./request-handler\";\nimport {\n logSecurityEvent,\n SecurityError,\n sanitizeSandboxId,\n validatePort,\n} from \"./security\";\nimport { parseSSEStream } from \"./sse-parser\";\nimport type {\n ExecEvent,\n ExecOptions,\n ExecResult,\n ExecuteResponse,\n ISandbox,\n Process,\n ProcessOptions,\n ProcessStatus,\n StreamOptions,\n} from \"./types\";\nimport { ProcessNotFoundError, SandboxError } from \"./types\";\n\nexport function getSandbox(ns: DurableObjectNamespace<Sandbox>, id: string) {\n const stub = getContainer(ns, id);\n\n // Store the name on first access\n stub.setSandboxName?.(id);\n\n return stub;\n}\n\nexport class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {\n defaultPort = 3000; // Default port for the container's Bun server\n sleepAfter = \"20m\"; // Keep container warm for 20 minutes to avoid cold starts\n client: JupyterClient;\n private sandboxName: string | null = null;\n private codeInterpreter: CodeInterpreter;\n\n constructor(ctx: DurableObjectState, env: Env) {\n super(ctx, env);\n this.client = new JupyterClient({\n onCommandComplete: (success, exitCode, _stdout, _stderr, command) => {\n console.log(\n `[Container] Command completed: ${command}, Success: ${success}, Exit code: ${exitCode}`\n );\n },\n onCommandStart: (command) => {\n console.log(`[Container] Command started: ${command}`);\n },\n onError: (error, _command) => {\n console.error(`[Container] Command error: ${error}`);\n },\n onOutput: (stream, data, _command) => {\n console.log(`[Container] [${stream}] ${data}`);\n },\n port: 3000, // Control plane port\n stub: this,\n });\n\n // Initialize code interpreter\n this.codeInterpreter = new CodeInterpreter(this);\n\n // Load the sandbox name from storage on initialization\n this.ctx.blockConcurrencyWhile(async () => {\n this.sandboxName =\n (await this.ctx.storage.get<string>(\"sandboxName\")) || null;\n });\n }\n\n // RPC method to set the sandbox name\n async setSandboxName(name: string): Promise<void> {\n if (!this.sandboxName) {\n this.sandboxName = name;\n await this.ctx.storage.put(\"sandboxName\", name);\n console.log(`[Sandbox] Stored sandbox name via RPC: ${name}`);\n }\n }\n\n // RPC method to set environment variables\n async setEnvVars(envVars: Record<string, string>): Promise<void> {\n this.envVars = { ...this.envVars, ...envVars };\n console.log(`[Sandbox] Updated environment variables`);\n }\n\n override onStart() {\n console.log(\"Sandbox successfully started\");\n }\n\n override onStop() {\n console.log(\"Sandbox successfully shut down\");\n if (this.client) {\n this.client.clearSession();\n }\n }\n\n override onError(error: unknown) {\n console.log(\"Sandbox error:\", error);\n }\n\n // Override fetch to route internal container requests to appropriate ports\n override async fetch(request: Request): Promise<Response> {\n const url = new URL(request.url);\n\n // Capture and store the sandbox name from the header if present\n if (!this.sandboxName && request.headers.has(\"X-Sandbox-Name\")) {\n const name = request.headers.get(\"X-Sandbox-Name\")!;\n this.sandboxName = name;\n await this.ctx.storage.put(\"sandboxName\", name);\n console.log(`[Sandbox] Stored sandbox name: ${this.sandboxName}`);\n }\n\n // Determine which port to route to\n const port = this.determinePort(url);\n\n // Route to the appropriate port\n return await this.containerFetch(request, port);\n }\n\n private determinePort(url: URL): number {\n // Extract port from proxy requests (e.g., /proxy/8080/*)\n const proxyMatch = url.pathname.match(/^\\/proxy\\/(\\d+)/);\n if (proxyMatch) {\n return parseInt(proxyMatch[1]);\n }\n\n // All other requests go to control plane on port 3000\n // This includes /api/* endpoints and any other control requests\n return 3000;\n }\n\n // Enhanced exec method - always returns ExecResult with optional streaming\n // This replaces the old exec method to match ISandbox interface\n async exec(command: string, options?: ExecOptions): Promise<ExecResult> {\n const startTime = Date.now();\n const timestamp = new Date().toISOString();\n\n // Handle timeout\n let timeoutId: NodeJS.Timeout | undefined;\n\n try {\n // Handle cancellation\n if (options?.signal?.aborted) {\n throw new Error(\"Operation was aborted\");\n }\n\n let result: ExecResult;\n\n if (options?.stream && options?.onOutput) {\n // Streaming with callbacks - we need to collect the final result\n result = await this.executeWithStreaming(\n command,\n options,\n startTime,\n timestamp\n );\n } else {\n // Regular execution\n const response = await this.client.execute(command, {\n sessionId: options?.sessionId,\n cwd: options?.cwd,\n env: options?.env,\n });\n\n const duration = Date.now() - startTime;\n result = this.mapExecuteResponseToExecResult(\n response,\n duration,\n options?.sessionId\n );\n }\n\n // Call completion callback if provided\n if (options?.onComplete) {\n options.onComplete(result);\n }\n\n return result;\n } catch (error) {\n if (options?.onError && error instanceof Error) {\n options.onError(error);\n }\n throw error;\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n }\n\n private async executeWithStreaming(\n command: string,\n options: ExecOptions,\n startTime: number,\n timestamp: string\n ): Promise<ExecResult> {\n let stdout = \"\";\n let stderr = \"\";\n\n try {\n const stream = await this.client.executeCommandStream(\n command,\n options.sessionId\n );\n\n for await (const event of parseSSEStream<ExecEvent>(stream)) {\n // Check for cancellation\n if (options.signal?.aborted) {\n throw new Error(\"Operation was aborted\");\n }\n\n switch (event.type) {\n case \"stdout\":\n case \"stderr\":\n if (event.data) {\n // Update accumulated output\n if (event.type === \"stdout\") stdout += event.data;\n if (event.type === \"stderr\") stderr += event.data;\n\n // Call user's callback\n if (options.onOutput) {\n options.onOutput(event.type, event.data);\n }\n }\n break;\n\n case \"complete\": {\n // Use result from complete event if available\n const duration = Date.now() - startTime;\n return (\n event.result || {\n success: event.exitCode === 0,\n exitCode: event.exitCode || 0,\n stdout,\n stderr,\n command,\n duration,\n timestamp,\n sessionId: options.sessionId,\n }\n );\n }\n\n case \"error\":\n throw new Error(event.error || \"Command execution failed\");\n }\n }\n\n // If we get here without a complete event, something went wrong\n throw new Error(\"Stream ended without completion event\");\n } catch (error) {\n if (options.signal?.aborted) {\n throw new Error(\"Operation was aborted\");\n }\n throw error;\n }\n }\n\n private mapExecuteResponseToExecResult(\n response: ExecuteResponse,\n duration: number,\n sessionId?: string\n ): ExecResult {\n return {\n success: response.success,\n exitCode: response.exitCode,\n stdout: response.stdout,\n stderr: response.stderr,\n command: response.command,\n duration,\n timestamp: response.timestamp,\n sessionId,\n };\n }\n\n // Background process management\n async startProcess(\n command: string,\n options?: ProcessOptions\n ): Promise<Process> {\n // Use the new HttpClient method to start the process\n try {\n const response = await this.client.startProcess(command, {\n processId: options?.processId,\n sessionId: options?.sessionId,\n timeout: options?.timeout,\n env: options?.env,\n cwd: options?.cwd,\n encoding: options?.encoding,\n autoCleanup: options?.autoCleanup,\n });\n\n const process = response.process;\n const processObj: Process = {\n id: process.id,\n pid: process.pid,\n command: process.command,\n status: process.status as ProcessStatus,\n startTime: new Date(process.startTime),\n endTime: undefined,\n exitCode: undefined,\n sessionId: process.sessionId,\n\n async kill(): Promise<void> {\n throw new Error(\"Method will be replaced\");\n },\n async getStatus(): Promise<ProcessStatus> {\n throw new Error(\"Method will be replaced\");\n },\n async getLogs(): Promise<{ stdout: string; stderr: string }> {\n throw new Error(\"Method will be replaced\");\n },\n };\n\n // Bind context properly\n processObj.kill = async (signal?: string) => {\n await this.killProcess(process.id, signal);\n };\n\n processObj.getStatus = async () => {\n const current = await this.getProcess(process.id);\n return current?.status || \"error\";\n };\n\n processObj.getLogs = async () => {\n const logs = await this.getProcessLogs(process.id);\n return { stdout: logs.stdout, stderr: logs.stderr };\n };\n\n // Call onStart callback if provided\n if (options?.onStart) {\n options.onStart(processObj);\n }\n\n return processObj;\n } catch (error) {\n if (options?.onError && error instanceof Error) {\n options.onError(error);\n }\n\n throw error;\n }\n }\n\n async listProcesses(): Promise<Process[]> {\n const response = await this.client.listProcesses();\n\n return response.processes.map((processData) => ({\n id: processData.id,\n pid: processData.pid,\n command: processData.command,\n status: processData.status,\n startTime: new Date(processData.startTime),\n endTime: processData.endTime ? new Date(processData.endTime) : undefined,\n exitCode: processData.exitCode,\n sessionId: processData.sessionId,\n\n kill: async (signal?: string) => {\n await this.killProcess(processData.id, signal);\n },\n\n getStatus: async () => {\n const current = await this.getProcess(processData.id);\n return current?.status || \"error\";\n },\n\n getLogs: async () => {\n const logs = await this.getProcessLogs(processData.id);\n return { stdout: logs.stdout, stderr: logs.stderr };\n },\n }));\n }\n\n async getProcess(id: string): Promise<Process | null> {\n const response = await this.client.getProcess(id);\n if (!response.process) {\n return null;\n }\n\n const processData = response.process;\n return {\n id: processData.id,\n pid: processData.pid,\n command: processData.command,\n status: processData.status,\n startTime: new Date(processData.startTime),\n endTime: processData.endTime ? new Date(processData.endTime) : undefined,\n exitCode: processData.exitCode,\n sessionId: processData.sessionId,\n\n kill: async (signal?: string) => {\n await this.killProcess(processData.id, signal);\n },\n\n getStatus: async () => {\n const current = await this.getProcess(processData.id);\n return current?.status || \"error\";\n },\n\n getLogs: async () => {\n const logs = await this.getProcessLogs(processData.id);\n return { stdout: logs.stdout, stderr: logs.stderr };\n },\n };\n }\n\n async killProcess(id: string, _signal?: string): Promise<void> {\n try {\n // Note: signal parameter is not currently supported by the HttpClient implementation\n await this.client.killProcess(id);\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"Process not found\")\n ) {\n throw new ProcessNotFoundError(id);\n }\n throw new SandboxError(\n `Failed to kill process ${id}: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n \"KILL_PROCESS_FAILED\"\n );\n }\n }\n\n async killAllProcesses(): Promise<number> {\n const response = await this.client.killAllProcesses();\n return response.killedCount;\n }\n\n async cleanupCompletedProcesses(): Promise<number> {\n // For now, this would need to be implemented as a container endpoint\n // as we no longer maintain local process storage\n // We'll return 0 as a placeholder until the container endpoint is added\n return 0;\n }\n\n async getProcessLogs(\n id: string\n ): Promise<{ stdout: string; stderr: string }> {\n try {\n const response = await this.client.getProcessLogs(id);\n return {\n stdout: response.stdout,\n stderr: response.stderr,\n };\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes(\"Process not found\")\n ) {\n throw new ProcessNotFoundError(id);\n }\n throw error;\n }\n }\n\n // Streaming methods - return ReadableStream for RPC compatibility\n async execStream(\n command: string,\n options?: StreamOptions\n ): Promise<ReadableStream<Uint8Array>> {\n // Check for cancellation\n if (options?.signal?.aborted) {\n throw new Error(\"Operation was aborted\");\n }\n\n // Get the stream from HttpClient (need to add this method)\n const stream = await this.client.executeCommandStream(\n command,\n options?.sessionId\n );\n\n // Return the ReadableStream directly - can be converted to AsyncIterable by consumers\n return stream;\n }\n\n async streamProcessLogs(\n processId: string,\n options?: { signal?: AbortSignal }\n ): Promise<ReadableStream<Uint8Array>> {\n // Check for cancellation\n if (options?.signal?.aborted) {\n throw new Error(\"Operation was aborted\");\n }\n\n // Get the stream from HttpClient\n const stream = await this.client.streamProcessLogs(processId);\n\n // Return the ReadableStream directly - can be converted to AsyncIterable by consumers\n return stream;\n }\n\n async gitCheckout(\n repoUrl: string,\n options: { branch?: string; targetDir?: string }\n ) {\n return this.client.gitCheckout(repoUrl, options.branch, options.targetDir);\n }\n\n async mkdir(path: string, options: { recursive?: boolean } = {}) {\n return this.client.mkdir(path, options.recursive);\n }\n\n async writeFile(\n path: string,\n content: string,\n options: { encoding?: string } = {}\n ) {\n return this.client.writeFile(path, content, options.encoding);\n }\n\n async deleteFile(path: string) {\n return this.client.deleteFile(path);\n }\n\n async renameFile(oldPath: string, newPath: string) {\n return this.client.renameFile(oldPath, newPath);\n }\n\n async moveFile(sourcePath: string, destinationPath: string) {\n return this.client.moveFile(sourcePath, destinationPath);\n }\n\n async readFile(path: string, options: { encoding?: string } = {}) {\n return this.client.readFile(path, options.encoding);\n }\n\n async listFiles(\n path: string,\n options: {\n recursive?: boolean;\n includeHidden?: boolean;\n } = {}\n ) {\n return this.client.listFiles(path, options);\n }\n\n async exposePort(port: number, options: { name?: string; hostname: string }) {\n await this.client.exposePort(port, options?.name);\n\n // We need the sandbox name to construct preview URLs\n if (!this.sandboxName) {\n throw new Error(\n \"Sandbox name not available. Ensure sandbox is accessed through getSandbox()\"\n );\n }\n\n const url = this.constructPreviewUrl(\n port,\n this.sandboxName,\n options.hostname\n );\n\n return {\n url,\n port,\n name: options?.name,\n };\n }\n\n async unexposePort(port: number) {\n if (!validatePort(port)) {\n logSecurityEvent(\n \"INVALID_PORT_UNEXPOSE\",\n {\n port,\n },\n \"high\"\n );\n throw new SecurityError(\n `Invalid port number: ${port}. Must be between 1024-65535 and not reserved.`\n );\n }\n\n await this.client.unexposePort(port);\n\n logSecurityEvent(\n \"PORT_UNEXPOSED\",\n {\n port,\n },\n \"low\"\n );\n }\n\n async getExposedPorts(hostname: string) {\n const response = await this.client.getExposedPorts();\n\n // We need the sandbox name to construct preview URLs\n if (!this.sandboxName) {\n throw new Error(\n \"Sandbox name not available. Ensure sandbox is accessed through getSandbox()\"\n );\n }\n\n return response.ports.map((port) => ({\n url: this.constructPreviewUrl(port.port, this.sandboxName!, hostname),\n port: port.port,\n name: port.name,\n exposedAt: port.exposedAt,\n }));\n }\n\n private constructPreviewUrl(\n port: number,\n sandboxId: string,\n hostname: string\n ): string {\n if (!validatePort(port)) {\n logSecurityEvent(\n \"INVALID_PORT_REJECTED\",\n {\n port,\n sandboxId,\n hostname,\n },\n \"high\"\n );\n throw new SecurityError(\n `Invalid port number: ${port}. Must be between 1024-65535 and not reserved.`\n );\n }\n\n let sanitizedSandboxId: string;\n try {\n sanitizedSandboxId = sanitizeSandboxId(sandboxId);\n } catch (error) {\n logSecurityEvent(\n \"INVALID_SANDBOX_ID_REJECTED\",\n {\n sandboxId,\n port,\n hostname,\n error: error instanceof Error ? error.message : \"Unknown error\",\n },\n \"high\"\n );\n throw error;\n }\n\n const isLocalhost = isLocalhostPattern(hostname);\n\n if (isLocalhost) {\n // Unified subdomain approach for localhost (RFC 6761)\n const [host, portStr] = hostname.split(\":\");\n const mainPort = portStr || \"80\";\n\n // Use URL constructor for safe URL building\n try {\n const baseUrl = new URL(`http://${host}:${mainPort}`);\n // Construct subdomain safely\n const subdomainHost = `${port}-${sanitizedSandboxId}.${host}`;\n baseUrl.hostname = subdomainHost;\n\n const finalUrl = baseUrl.toString();\n\n logSecurityEvent(\n \"PREVIEW_URL_CONSTRUCTED\",\n {\n port,\n sandboxId: sanitizedSandboxId,\n hostname,\n resultUrl: finalUrl,\n environment: \"localhost\",\n },\n \"low\"\n );\n\n return finalUrl;\n } catch (error) {\n logSecurityEvent(\n \"URL_CONSTRUCTION_FAILED\",\n {\n port,\n sandboxId: sanitizedSandboxId,\n hostname,\n error: error instanceof Error ? error.message : \"Unknown error\",\n },\n \"high\"\n );\n throw new SecurityError(\n `Failed to construct preview URL: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`\n );\n }\n }\n\n // Production subdomain logic - enforce HTTPS\n try {\n // Always use HTTPS for production (non-localhost)\n const protocol = \"https\";\n const baseUrl = new URL(`${protocol}://${hostname}`);\n\n // Construct subdomain safely\n const subdomainHost = `${port}-${sanitizedSandboxId}.${hostname}`;\n baseUrl.hostname = subdomainHost;\n\n const finalUrl = baseUrl.toString();\n\n logSecurityEvent(\n \"PREVIEW_URL_CONSTRUCTED\",\n {\n port,\n sandboxId: sanitizedSandboxId,\n hostname,\n resultUrl: finalUrl,\n environment: \"production\",\n },\n \"low\"\n );\n\n return finalUrl;\n } catch (error) {\n logSecurityEvent(\n \"URL_CONSTRUCTION_FAILED\",\n {\n port,\n sandboxId: sanitizedSandboxId,\n hostname,\n error: error instanceof Error ? error.message : \"Unknown error\",\n },\n \"high\"\n );\n throw new SecurityError(\n `Failed to construct preview URL: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`\n );\n }\n }\n\n // Code Interpreter Methods\n\n /**\n * Create a new code execution context\n */\n async createCodeContext(\n options?: CreateContextOptions\n ): Promise<CodeContext> {\n return this.codeInterpreter.createCodeContext(options);\n }\n\n /**\n * Run code with streaming callbacks\n */\n async runCode(\n code: string,\n options?: RunCodeOptions\n ): Promise<ExecutionResult> {\n const execution = await this.codeInterpreter.runCode(code, options);\n // Convert to plain object for RPC serialization\n return execution.toJSON();\n }\n\n /**\n * Run code and return a streaming response\n */\n async runCodeStream(\n code: string,\n options?: RunCodeOptions\n ): Promise<ReadableStream> {\n return this.codeInterpreter.runCodeStream(code, options);\n }\n\n /**\n * List all code contexts\n */\n async listCodeContexts(): Promise<CodeContext[]> {\n return this.codeInterpreter.listCodeContexts();\n }\n\n /**\n * Delete a code context\n */\n async deleteCodeContext(contextId: string): Promise<void> {\n return this.codeInterpreter.deleteCodeContext(contextId);\n }\n}\n","import { getSandbox, type Sandbox } from \"./sandbox\";\nimport {\n logSecurityEvent,\n sanitizeSandboxId,\n validatePort\n} from \"./security\";\n\nexport interface SandboxEnv {\n Sandbox: DurableObjectNamespace<Sandbox>;\n}\n\nexport interface RouteInfo {\n port: number;\n sandboxId: string;\n path: string;\n}\n\nexport async function proxyToSandbox<E extends SandboxEnv>(\n request: Request,\n env: E\n): Promise<Response | null> {\n try {\n const url = new URL(request.url);\n const routeInfo = extractSandboxRoute(url);\n\n if (!routeInfo) {\n return null; // Not a request to an exposed container port\n }\n\n const { sandboxId, port, path } = routeInfo;\n const sandbox = getSandbox(env.Sandbox, sandboxId);\n\n // Build proxy request with proper headers\n let proxyUrl: string;\n\n // Route based on the target port\n if (port !== 3000) {\n // Route directly to user's service on the specified port\n proxyUrl = `http://localhost:${port}${path}${url.search}`;\n } else {\n // Port 3000 is our control plane - route normally\n proxyUrl = `http://localhost:3000${path}${url.search}`;\n }\n\n const proxyRequest = new Request(proxyUrl, {\n method: request.method,\n headers: {\n ...Object.fromEntries(request.headers),\n 'X-Original-URL': request.url,\n 'X-Forwarded-Host': url.hostname,\n 'X-Forwarded-Proto': url.protocol.replace(':', ''),\n 'X-Sandbox-Name': sandboxId, // Pass the friendly name\n },\n body: request.body,\n });\n\n return sandbox.containerFetch(proxyRequest, port);\n } catch (error) {\n console.error('[Sandbox] Proxy routing error:', error);\n return new Response('Proxy routing error', { status: 500 });\n }\n}\n\nfunction extractSandboxRoute(url: URL): RouteInfo | null {\n // Parse subdomain pattern: port-sandboxId.domain\n const subdomainMatch = url.hostname.match(/^(\\d{4,5})-([^.-][^.]*[^.-]|[^.-])\\.(.+)$/);\n\n if (!subdomainMatch) {\n // Log malformed subdomain attempts\n if (url.hostname.includes('-') && url.hostname.includes('.')) {\n logSecurityEvent('MALFORMED_SUBDOMAIN_ATTEMPT', {\n hostname: url.hostname,\n url: url.toString()\n }, 'medium');\n }\n return null;\n }\n\n const portStr = subdomainMatch[1];\n const sandboxId = subdomainMatch[2];\n const domain = subdomainMatch[3];\n\n const port = parseInt(portStr, 10);\n if (!validatePort(port)) {\n logSecurityEvent('INVALID_PORT_IN_SUBDOMAIN', {\n port,\n portStr,\n sandboxId,\n hostname: url.hostname,\n url: url.toString()\n }, 'high');\n return null;\n }\n\n let sanitizedSandboxId: string;\n try {\n sanitizedSandboxId = sanitizeSandboxId(sandboxId);\n } catch (error) {\n logSecurityEvent('INVALID_SANDBOX_ID_IN_SUBDOMAIN', {\n sandboxId,\n port,\n hostname: url.hostname,\n url: url.toString(),\n error: error instanceof Error ? error.message : 'Unknown error'\n }, 'high');\n return null;\n }\n\n // DNS subdomain length limit is 63 characters\n if (sandboxId.length > 63) {\n logSecurityEvent('SANDBOX_ID_LENGTH_VIOLATION', {\n sandboxId,\n length: sandboxId.length,\n port,\n hostname: url.hostname\n }, 'medium');\n return null;\n }\n\n logSecurityEvent('SANDBOX_ROUTE_EXTRACTED', {\n port,\n sandboxId: sanitizedSandboxId,\n domain,\n path: url.pathname || \"/\",\n hostname: url.hostname\n }, 'low');\n\n return {\n port,\n sandboxId: sanitizedSandboxId,\n path: url.pathname || \"/\",\n };\n}\n\nexport function isLocalhostPattern(hostname: string): boolean {\n const hostPart = hostname.split(\":\")[0];\n return (\n hostPart === \"localhost\" ||\n hostPart === \"127.0.0.1\" ||\n hostPart === \"::1\" ||\n hostPart === \"[::1]\" ||\n hostPart === \"0.0.0.0\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,oBAAoB;;;ACiBxC,eAAsB,eACpB,SACA,KAC0B;AAC1B,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,UAAM,YAAY,oBAAoB,GAAG;AAE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AO,KAAK,gBAAgB,kBAAkB,SAAS;AAAA,EACzD;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HttpClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3CQ6THKA.js";
|
|
4
4
|
import {
|
|
5
5
|
isRetryableError,
|
|
6
6
|
parseErrorResponse
|
|
@@ -234,4 +234,4 @@ var JupyterClient = class extends HttpClient {
|
|
|
234
234
|
export {
|
|
235
235
|
JupyterClient
|
|
236
236
|
};
|
|
237
|
-
//# sourceMappingURL=chunk-
|
|
237
|
+
//# sourceMappingURL=chunk-HHUDRGPY.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ISandbox, ExecOptions, ExecResult, ProcessOptions, Process, StreamOptions, GitCheckoutResponse, MkdirResponse, WriteFileResponse, DeleteFileResponse, RenameFileResponse, MoveFileResponse, ReadFileResponse, ListFilesResponse, BaseExecOptions, ExecuteResponse, StartProcessResponse, ListProcessesResponse, GetProcessResponse, GetProcessLogsResponse } from './types.js';
|
|
1
2
|
import { Container } from '@cloudflare/containers';
|
|
2
3
|
import { CreateContextOptions, CodeContext, OutputMessage, Result, ExecutionError, RunCodeOptions, ExecutionResult } from './interpreter-types.js';
|
|
3
|
-
import { ISandbox, ExecOptions, ExecResult, ProcessOptions, Process, StreamOptions, BaseExecOptions, StartProcessResponse, ListProcessesResponse, GetProcessResponse, GetProcessLogsResponse } from './types.js';
|
|
4
4
|
|
|
5
5
|
interface ExecutionCallbacks {
|
|
6
6
|
onStdout?: (output: OutputMessage) => void | Promise<void>;
|
|
@@ -76,6 +76,10 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
76
76
|
readFile(path: string, options?: {
|
|
77
77
|
encoding?: string;
|
|
78
78
|
}): Promise<ReadFileResponse>;
|
|
79
|
+
listFiles(path: string, options?: {
|
|
80
|
+
recursive?: boolean;
|
|
81
|
+
includeHidden?: boolean;
|
|
82
|
+
}): Promise<ListFilesResponse>;
|
|
79
83
|
exposePort(port: number, options: {
|
|
80
84
|
name?: string;
|
|
81
85
|
hostname: string;
|
|
@@ -114,66 +118,6 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
|
|
|
114
118
|
deleteCodeContext(contextId: string): Promise<void>;
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
interface ExecuteResponse {
|
|
118
|
-
success: boolean;
|
|
119
|
-
stdout: string;
|
|
120
|
-
stderr: string;
|
|
121
|
-
exitCode: number;
|
|
122
|
-
command: string;
|
|
123
|
-
timestamp: string;
|
|
124
|
-
}
|
|
125
|
-
interface GitCheckoutResponse {
|
|
126
|
-
success: boolean;
|
|
127
|
-
stdout: string;
|
|
128
|
-
stderr: string;
|
|
129
|
-
exitCode: number;
|
|
130
|
-
repoUrl: string;
|
|
131
|
-
branch: string;
|
|
132
|
-
targetDir: string;
|
|
133
|
-
timestamp: string;
|
|
134
|
-
}
|
|
135
|
-
interface MkdirResponse {
|
|
136
|
-
success: boolean;
|
|
137
|
-
stdout: string;
|
|
138
|
-
stderr: string;
|
|
139
|
-
exitCode: number;
|
|
140
|
-
path: string;
|
|
141
|
-
recursive: boolean;
|
|
142
|
-
timestamp: string;
|
|
143
|
-
}
|
|
144
|
-
interface WriteFileResponse {
|
|
145
|
-
success: boolean;
|
|
146
|
-
exitCode: number;
|
|
147
|
-
path: string;
|
|
148
|
-
timestamp: string;
|
|
149
|
-
}
|
|
150
|
-
interface ReadFileResponse {
|
|
151
|
-
success: boolean;
|
|
152
|
-
exitCode: number;
|
|
153
|
-
path: string;
|
|
154
|
-
content: string;
|
|
155
|
-
timestamp: string;
|
|
156
|
-
}
|
|
157
|
-
interface DeleteFileResponse {
|
|
158
|
-
success: boolean;
|
|
159
|
-
exitCode: number;
|
|
160
|
-
path: string;
|
|
161
|
-
timestamp: string;
|
|
162
|
-
}
|
|
163
|
-
interface RenameFileResponse {
|
|
164
|
-
success: boolean;
|
|
165
|
-
exitCode: number;
|
|
166
|
-
oldPath: string;
|
|
167
|
-
newPath: string;
|
|
168
|
-
timestamp: string;
|
|
169
|
-
}
|
|
170
|
-
interface MoveFileResponse {
|
|
171
|
-
success: boolean;
|
|
172
|
-
exitCode: number;
|
|
173
|
-
sourcePath: string;
|
|
174
|
-
destinationPath: string;
|
|
175
|
-
timestamp: string;
|
|
176
|
-
}
|
|
177
121
|
interface PreviewInfo {
|
|
178
122
|
url: string;
|
|
179
123
|
port: number;
|
|
@@ -224,6 +168,10 @@ declare class HttpClient {
|
|
|
224
168
|
deleteFile(path: string, sessionId?: string): Promise<DeleteFileResponse>;
|
|
225
169
|
renameFile(oldPath: string, newPath: string, sessionId?: string): Promise<RenameFileResponse>;
|
|
226
170
|
moveFile(sourcePath: string, destinationPath: string, sessionId?: string): Promise<MoveFileResponse>;
|
|
171
|
+
listFiles(path: string, options?: {
|
|
172
|
+
recursive?: boolean;
|
|
173
|
+
includeHidden?: boolean;
|
|
174
|
+
}, sessionId?: string): Promise<ListFilesResponse>;
|
|
227
175
|
exposePort(port: number, name?: string): Promise<ExposePortResponse>;
|
|
228
176
|
unexposePort(port: number): Promise<UnexposePortResponse>;
|
|
229
177
|
getExposedPorts(): Promise<GetExposedPortsResponse>;
|
|
@@ -256,4 +204,4 @@ declare class HttpClient {
|
|
|
256
204
|
streamProcessLogs(processId: string): Promise<ReadableStream<Uint8Array>>;
|
|
257
205
|
}
|
|
258
206
|
|
|
259
|
-
export { type
|
|
207
|
+
export { type ExecutionCallbacks as E, HttpClient as H, JupyterClient as J, Sandbox as S, getSandbox as g };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { H as HttpClient } from './client-Ce40ujDF.js';
|
|
2
2
|
import './types.js';
|
|
3
3
|
import '@cloudflare/containers';
|
|
4
4
|
import './interpreter-types.js';
|
package/dist/client.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { D as DeleteFileResponse, E as ExecuteResponse, G as GitCheckoutResponse, M as MkdirResponse, a as MoveFileResponse, R as ReadFileResponse, b as RenameFileResponse, S as Sandbox, W as WriteFileResponse, g as getSandbox } from './client-bzEV222a.js';
|
|
2
1
|
export { CodeExecutionError, ContainerNotReadyError, ContextNotFoundError, JupyterNotReadyError, SandboxError, SandboxErrorResponse, SandboxNetworkError, ServiceUnavailableError, isJupyterNotReadyError, isRetryableError, isSandboxError, parseErrorResponse } from './errors.js';
|
|
3
2
|
export { ChartData, CodeContext, CreateContextOptions, Execution, ExecutionError, OutputMessage, Result, ResultImpl, RunCodeOptions } from './interpreter-types.js';
|
|
4
3
|
export { RouteInfo, SandboxEnv, proxyToSandbox } from './request-handler.js';
|
|
4
|
+
export { S as Sandbox, g as getSandbox } from './client-Ce40ujDF.js';
|
|
5
5
|
export { asyncIterableToSSEStream, parseSSEStream, responseToAsyncIterable } from './sse-parser.js';
|
|
6
|
-
export { ExecEvent, LogEvent } from './types.js';
|
|
6
|
+
export { DeleteFileResponse, ExecEvent, ExecuteResponse, GitCheckoutResponse, ListFilesResponse, LogEvent, MkdirResponse, MoveFileResponse, ReadFileResponse, RenameFileResponse, WriteFileResponse } from './types.js';
|
|
7
7
|
import '@cloudflare/containers';
|
package/dist/index.js
CHANGED
|
@@ -2,20 +2,20 @@ import {
|
|
|
2
2
|
Sandbox,
|
|
3
3
|
getSandbox,
|
|
4
4
|
proxyToSandbox
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CKIGERRS.js";
|
|
6
6
|
import "./chunk-6UAWTJ5S.js";
|
|
7
7
|
import {
|
|
8
8
|
asyncIterableToSSEStream,
|
|
9
9
|
parseSSEStream,
|
|
10
10
|
responseToAsyncIterable
|
|
11
11
|
} from "./chunk-NNGBXDMY.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-6EWSYSO7.js";
|
|
13
13
|
import "./chunk-FKBV7CZS.js";
|
|
14
14
|
import {
|
|
15
15
|
ResultImpl
|
|
16
16
|
} from "./chunk-EGC5IYXA.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-HHUDRGPY.js";
|
|
18
|
+
import "./chunk-3CQ6THKA.js";
|
|
19
19
|
import {
|
|
20
20
|
CodeExecutionError,
|
|
21
21
|
ContainerNotReadyError,
|
package/dist/interpreter.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateContextOptions, CodeContext, RunCodeOptions, Execution } from './interpreter-types.js';
|
|
2
|
-
import { S as Sandbox } from './client-
|
|
3
|
-
import '@cloudflare/containers';
|
|
2
|
+
import { S as Sandbox } from './client-Ce40ujDF.js';
|
|
4
3
|
import './types.js';
|
|
4
|
+
import '@cloudflare/containers';
|
|
5
5
|
|
|
6
6
|
declare class CodeInterpreter {
|
|
7
7
|
private jupyterClient;
|
package/dist/jupyter-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { E as ExecutionCallbacks, J as JupyterClient } from './client-Ce40ujDF.js';
|
|
2
2
|
import './interpreter-types.js';
|
|
3
|
-
import '@cloudflare/containers';
|
|
4
3
|
import './types.js';
|
|
4
|
+
import '@cloudflare/containers';
|
package/dist/jupyter-client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as Sandbox } from './client-
|
|
2
|
-
import '@cloudflare/containers';
|
|
3
|
-
import './interpreter-types.js';
|
|
1
|
+
import { S as Sandbox } from './client-Ce40ujDF.js';
|
|
4
2
|
import './types.js';
|
|
3
|
+
import './interpreter-types.js';
|
|
4
|
+
import '@cloudflare/containers';
|
|
5
5
|
|
|
6
6
|
interface SandboxEnv {
|
|
7
7
|
Sandbox: DurableObjectNamespace<Sandbox>;
|
package/dist/request-handler.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isLocalhostPattern,
|
|
3
3
|
proxyToSandbox
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CKIGERRS.js";
|
|
5
5
|
import "./chunk-6UAWTJ5S.js";
|
|
6
6
|
import "./chunk-NNGBXDMY.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-6EWSYSO7.js";
|
|
8
8
|
import "./chunk-FKBV7CZS.js";
|
|
9
9
|
import "./chunk-EGC5IYXA.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-HHUDRGPY.js";
|
|
11
|
+
import "./chunk-3CQ6THKA.js";
|
|
12
12
|
import "./chunk-LALY4SFU.js";
|
|
13
13
|
export {
|
|
14
14
|
isLocalhostPattern,
|
package/dist/sandbox.d.ts
CHANGED
package/dist/sandbox.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Sandbox,
|
|
3
3
|
getSandbox
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CKIGERRS.js";
|
|
5
5
|
import "./chunk-6UAWTJ5S.js";
|
|
6
6
|
import "./chunk-NNGBXDMY.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-6EWSYSO7.js";
|
|
8
8
|
import "./chunk-FKBV7CZS.js";
|
|
9
9
|
import "./chunk-EGC5IYXA.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-HHUDRGPY.js";
|
|
11
|
+
import "./chunk-3CQ6THKA.js";
|
|
12
12
|
import "./chunk-LALY4SFU.js";
|
|
13
13
|
export {
|
|
14
14
|
Sandbox,
|
package/dist/types.d.ts
CHANGED
|
@@ -279,14 +279,131 @@ interface ISandbox {
|
|
|
279
279
|
stdout: string;
|
|
280
280
|
stderr: string;
|
|
281
281
|
}>;
|
|
282
|
+
gitCheckout(repoUrl: string, options: {
|
|
283
|
+
branch?: string;
|
|
284
|
+
targetDir?: string;
|
|
285
|
+
}): Promise<GitCheckoutResponse>;
|
|
286
|
+
mkdir(path: string, options?: {
|
|
287
|
+
recursive?: boolean;
|
|
288
|
+
}): Promise<MkdirResponse>;
|
|
289
|
+
writeFile(path: string, content: string, options?: {
|
|
290
|
+
encoding?: string;
|
|
291
|
+
}): Promise<WriteFileResponse>;
|
|
292
|
+
deleteFile(path: string): Promise<DeleteFileResponse>;
|
|
293
|
+
renameFile(oldPath: string, newPath: string): Promise<RenameFileResponse>;
|
|
294
|
+
moveFile(sourcePath: string, destinationPath: string): Promise<MoveFileResponse>;
|
|
295
|
+
readFile(path: string, options?: {
|
|
296
|
+
encoding?: string;
|
|
297
|
+
}): Promise<ReadFileResponse>;
|
|
298
|
+
listFiles(path: string, options?: {
|
|
299
|
+
recursive?: boolean;
|
|
300
|
+
includeHidden?: boolean;
|
|
301
|
+
}): Promise<ListFilesResponse>;
|
|
302
|
+
exposePort(port: number, options: {
|
|
303
|
+
name?: string;
|
|
304
|
+
hostname: string;
|
|
305
|
+
}): Promise<{
|
|
306
|
+
url: string;
|
|
307
|
+
port: number;
|
|
308
|
+
name?: string;
|
|
309
|
+
}>;
|
|
310
|
+
unexposePort(port: number): Promise<void>;
|
|
311
|
+
getExposedPorts(hostname: string): Promise<Array<{
|
|
312
|
+
url: string;
|
|
313
|
+
port: number;
|
|
314
|
+
name?: string;
|
|
315
|
+
exposedAt: string;
|
|
316
|
+
}>>;
|
|
317
|
+
setEnvVars(envVars: Record<string, string>): Promise<void>;
|
|
318
|
+
setSandboxName(name: string): Promise<void>;
|
|
282
319
|
createCodeContext(options?: CreateContextOptions): Promise<CodeContext>;
|
|
283
320
|
runCode(code: string, options?: RunCodeOptions): Promise<ExecutionResult>;
|
|
284
321
|
runCodeStream(code: string, options?: RunCodeOptions): Promise<ReadableStream>;
|
|
285
322
|
listCodeContexts(): Promise<CodeContext[]>;
|
|
286
323
|
deleteCodeContext(contextId: string): Promise<void>;
|
|
287
324
|
}
|
|
325
|
+
interface ExecuteResponse {
|
|
326
|
+
success: boolean;
|
|
327
|
+
stdout: string;
|
|
328
|
+
stderr: string;
|
|
329
|
+
exitCode: number;
|
|
330
|
+
command: string;
|
|
331
|
+
timestamp: string;
|
|
332
|
+
}
|
|
333
|
+
interface GitCheckoutResponse {
|
|
334
|
+
success: boolean;
|
|
335
|
+
stdout: string;
|
|
336
|
+
stderr: string;
|
|
337
|
+
exitCode: number;
|
|
338
|
+
repoUrl: string;
|
|
339
|
+
branch: string;
|
|
340
|
+
targetDir: string;
|
|
341
|
+
timestamp: string;
|
|
342
|
+
}
|
|
343
|
+
interface MkdirResponse {
|
|
344
|
+
success: boolean;
|
|
345
|
+
stdout: string;
|
|
346
|
+
stderr: string;
|
|
347
|
+
exitCode: number;
|
|
348
|
+
path: string;
|
|
349
|
+
recursive: boolean;
|
|
350
|
+
timestamp: string;
|
|
351
|
+
}
|
|
352
|
+
interface WriteFileResponse {
|
|
353
|
+
success: boolean;
|
|
354
|
+
exitCode: number;
|
|
355
|
+
path: string;
|
|
356
|
+
timestamp: string;
|
|
357
|
+
}
|
|
358
|
+
interface ReadFileResponse {
|
|
359
|
+
success: boolean;
|
|
360
|
+
exitCode: number;
|
|
361
|
+
path: string;
|
|
362
|
+
content: string;
|
|
363
|
+
timestamp: string;
|
|
364
|
+
}
|
|
365
|
+
interface DeleteFileResponse {
|
|
366
|
+
success: boolean;
|
|
367
|
+
exitCode: number;
|
|
368
|
+
path: string;
|
|
369
|
+
timestamp: string;
|
|
370
|
+
}
|
|
371
|
+
interface RenameFileResponse {
|
|
372
|
+
success: boolean;
|
|
373
|
+
exitCode: number;
|
|
374
|
+
oldPath: string;
|
|
375
|
+
newPath: string;
|
|
376
|
+
timestamp: string;
|
|
377
|
+
}
|
|
378
|
+
interface MoveFileResponse {
|
|
379
|
+
success: boolean;
|
|
380
|
+
exitCode: number;
|
|
381
|
+
sourcePath: string;
|
|
382
|
+
destinationPath: string;
|
|
383
|
+
timestamp: string;
|
|
384
|
+
}
|
|
385
|
+
interface ListFilesResponse {
|
|
386
|
+
success: boolean;
|
|
387
|
+
exitCode: number;
|
|
388
|
+
path: string;
|
|
389
|
+
files: Array<{
|
|
390
|
+
name: string;
|
|
391
|
+
absolutePath: string;
|
|
392
|
+
relativePath: string;
|
|
393
|
+
type: 'file' | 'directory' | 'symlink' | 'other';
|
|
394
|
+
size: number;
|
|
395
|
+
modifiedAt: string;
|
|
396
|
+
mode: string;
|
|
397
|
+
permissions: {
|
|
398
|
+
readable: boolean;
|
|
399
|
+
writable: boolean;
|
|
400
|
+
executable: boolean;
|
|
401
|
+
};
|
|
402
|
+
}>;
|
|
403
|
+
timestamp: string;
|
|
404
|
+
}
|
|
288
405
|
declare function isExecResult(value: any): value is ExecResult;
|
|
289
406
|
declare function isProcess(value: any): value is Process;
|
|
290
407
|
declare function isProcessStatus(value: string): value is ProcessStatus;
|
|
291
408
|
|
|
292
|
-
export { type BaseExecOptions, type ExecEvent, type ExecOptions, type ExecResult, ExecutionTimeoutError, type GetProcessLogsResponse, type GetProcessResponse, type ISandbox, type ListProcessesResponse, type LogEvent, type Process, ProcessAlreadyExistsError, ProcessNotFoundError, type ProcessOptions, type ProcessRecord, type ProcessStatus, SandboxError, type StartProcessRequest, type StartProcessResponse, type StreamOptions, isExecResult, isProcess, isProcessStatus };
|
|
409
|
+
export { type BaseExecOptions, type DeleteFileResponse, type ExecEvent, type ExecOptions, type ExecResult, type ExecuteResponse, ExecutionTimeoutError, type GetProcessLogsResponse, type GetProcessResponse, type GitCheckoutResponse, type ISandbox, type ListFilesResponse, type ListProcessesResponse, type LogEvent, type MkdirResponse, type MoveFileResponse, type Process, ProcessAlreadyExistsError, ProcessNotFoundError, type ProcessOptions, type ProcessRecord, type ProcessStatus, type ReadFileResponse, type RenameFileResponse, SandboxError, type StartProcessRequest, type StartProcessResponse, type StreamOptions, type WriteFileResponse, isExecResult, isProcess, isProcessStatus };
|
package/dist/types.js
CHANGED