@cloudflare/sandbox 0.3.7 → 0.4.2

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.
Files changed (120) hide show
  1. package/.turbo/turbo-build.log +44 -0
  2. package/CHANGELOG.md +8 -10
  3. package/Dockerfile +82 -18
  4. package/README.md +89 -824
  5. package/dist/chunk-53JFOF7F.js +2352 -0
  6. package/dist/chunk-53JFOF7F.js.map +1 -0
  7. package/dist/chunk-BFVUNTP4.js +104 -0
  8. package/dist/chunk-BFVUNTP4.js.map +1 -0
  9. package/dist/{chunk-NNGBXDMY.js → chunk-EKSWCBCA.js} +3 -6
  10. package/dist/chunk-EKSWCBCA.js.map +1 -0
  11. package/dist/chunk-JXZMAU2C.js +559 -0
  12. package/dist/chunk-JXZMAU2C.js.map +1 -0
  13. package/dist/{chunk-6UAWTJ5S.js → chunk-Z532A7QC.js} +13 -20
  14. package/dist/{chunk-6UAWTJ5S.js.map → chunk-Z532A7QC.js.map} +1 -1
  15. package/dist/file-stream.d.ts +16 -38
  16. package/dist/file-stream.js +1 -2
  17. package/dist/index.d.ts +6 -5
  18. package/dist/index.js +45 -38
  19. package/dist/interpreter.d.ts +3 -3
  20. package/dist/interpreter.js +2 -2
  21. package/dist/request-handler.d.ts +4 -3
  22. package/dist/request-handler.js +4 -7
  23. package/dist/sandbox-D9K2ypln.d.ts +583 -0
  24. package/dist/sandbox.d.ts +3 -3
  25. package/dist/sandbox.js +4 -7
  26. package/dist/security.d.ts +4 -3
  27. package/dist/security.js +3 -3
  28. package/dist/sse-parser.js +1 -1
  29. package/package.json +12 -4
  30. package/src/clients/base-client.ts +280 -0
  31. package/src/clients/command-client.ts +115 -0
  32. package/src/clients/file-client.ts +269 -0
  33. package/src/clients/git-client.ts +92 -0
  34. package/src/clients/index.ts +63 -0
  35. package/src/{interpreter-client.ts → clients/interpreter-client.ts} +148 -171
  36. package/src/clients/port-client.ts +105 -0
  37. package/src/clients/process-client.ts +177 -0
  38. package/src/clients/sandbox-client.ts +41 -0
  39. package/src/clients/types.ts +84 -0
  40. package/src/clients/utility-client.ts +94 -0
  41. package/src/errors/adapter.ts +180 -0
  42. package/src/errors/classes.ts +469 -0
  43. package/src/errors/index.ts +105 -0
  44. package/src/file-stream.ts +119 -117
  45. package/src/index.ts +81 -69
  46. package/src/interpreter.ts +17 -8
  47. package/src/request-handler.ts +69 -43
  48. package/src/sandbox.ts +694 -533
  49. package/src/security.ts +14 -23
  50. package/src/sse-parser.ts +4 -8
  51. package/startup.sh +3 -0
  52. package/tests/base-client.test.ts +328 -0
  53. package/tests/command-client.test.ts +407 -0
  54. package/tests/file-client.test.ts +643 -0
  55. package/tests/file-stream.test.ts +306 -0
  56. package/tests/git-client.test.ts +328 -0
  57. package/tests/port-client.test.ts +301 -0
  58. package/tests/process-client.test.ts +658 -0
  59. package/tests/sandbox.test.ts +465 -0
  60. package/tests/sse-parser.test.ts +290 -0
  61. package/tests/utility-client.test.ts +266 -0
  62. package/tests/wrangler.jsonc +35 -0
  63. package/tsconfig.json +9 -1
  64. package/vitest.config.ts +31 -0
  65. package/container_src/bun.lock +0 -76
  66. package/container_src/circuit-breaker.ts +0 -121
  67. package/container_src/control-process.ts +0 -784
  68. package/container_src/handler/exec.ts +0 -185
  69. package/container_src/handler/file.ts +0 -457
  70. package/container_src/handler/git.ts +0 -130
  71. package/container_src/handler/ports.ts +0 -314
  72. package/container_src/handler/process.ts +0 -568
  73. package/container_src/handler/session.ts +0 -92
  74. package/container_src/index.ts +0 -601
  75. package/container_src/interpreter-service.ts +0 -276
  76. package/container_src/isolation.ts +0 -1213
  77. package/container_src/mime-processor.ts +0 -255
  78. package/container_src/package.json +0 -18
  79. package/container_src/runtime/executors/javascript/node_executor.ts +0 -123
  80. package/container_src/runtime/executors/python/ipython_executor.py +0 -338
  81. package/container_src/runtime/executors/typescript/ts_executor.ts +0 -138
  82. package/container_src/runtime/process-pool.ts +0 -464
  83. package/container_src/shell-escape.ts +0 -42
  84. package/container_src/startup.sh +0 -11
  85. package/container_src/types.ts +0 -131
  86. package/dist/chunk-32UDXUPC.js +0 -671
  87. package/dist/chunk-32UDXUPC.js.map +0 -1
  88. package/dist/chunk-5DILEXGY.js +0 -85
  89. package/dist/chunk-5DILEXGY.js.map +0 -1
  90. package/dist/chunk-D3U63BZP.js +0 -240
  91. package/dist/chunk-D3U63BZP.js.map +0 -1
  92. package/dist/chunk-FXYPFGOZ.js +0 -129
  93. package/dist/chunk-FXYPFGOZ.js.map +0 -1
  94. package/dist/chunk-JTKON2SH.js +0 -113
  95. package/dist/chunk-JTKON2SH.js.map +0 -1
  96. package/dist/chunk-NNGBXDMY.js.map +0 -1
  97. package/dist/chunk-SQLJNZ3K.js +0 -674
  98. package/dist/chunk-SQLJNZ3K.js.map +0 -1
  99. package/dist/chunk-W7TVRPBG.js +0 -108
  100. package/dist/chunk-W7TVRPBG.js.map +0 -1
  101. package/dist/client-B3RUab0s.d.ts +0 -225
  102. package/dist/client.d.ts +0 -4
  103. package/dist/client.js +0 -7
  104. package/dist/client.js.map +0 -1
  105. package/dist/errors.d.ts +0 -95
  106. package/dist/errors.js +0 -27
  107. package/dist/errors.js.map +0 -1
  108. package/dist/interpreter-client.d.ts +0 -4
  109. package/dist/interpreter-client.js +0 -9
  110. package/dist/interpreter-client.js.map +0 -1
  111. package/dist/interpreter-types.d.ts +0 -259
  112. package/dist/interpreter-types.js +0 -9
  113. package/dist/interpreter-types.js.map +0 -1
  114. package/dist/types.d.ts +0 -453
  115. package/dist/types.js +0 -45
  116. package/dist/types.js.map +0 -1
  117. package/src/client.ts +0 -1048
  118. package/src/errors.ts +0 -219
  119. package/src/interpreter-types.ts +0 -390
  120. package/src/types.ts +0 -571
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/security.ts"],"sourcesContent":["/**\n * Security utilities for URL construction and input validation\n *\n * This module contains critical security functions to prevent:\n * - URL injection attacks\n * - SSRF (Server-Side Request Forgery) attacks\n * - DNS rebinding attacks\n * - Host header injection\n * - Open redirect vulnerabilities\n */\n\nexport class SecurityError extends Error {\n constructor(message: string, public readonly code?: string) {\n super(message);\n this.name = 'SecurityError';\n }\n}\n\n/**\n * Validates port numbers for sandbox services\n * Only allows non-system ports to prevent conflicts and security issues\n */\nexport function validatePort(port: number): boolean {\n // Must be a valid integer\n if (!Number.isInteger(port)) {\n return false;\n }\n\n // Only allow non-system ports (1024-65535)\n if (port < 1024 || port > 65535) {\n return false;\n }\n\n // Exclude ports reserved by our system\n const reservedPorts = [\n 3000, // Control plane port\n 8787, // Common wrangler dev port\n ];\n\n if (reservedPorts.includes(port)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Sanitizes and validates sandbox IDs for DNS compliance and security\n * Only enforces critical requirements - allows maximum developer flexibility\n */\nexport function sanitizeSandboxId(id: string): string {\n // Basic validation: not empty, reasonable length limit (DNS subdomain limit is 63 chars)\n if (!id || id.length > 63) {\n throw new SecurityError(\n 'Sandbox ID must be 1-63 characters long.',\n 'INVALID_SANDBOX_ID_LENGTH'\n );\n }\n\n // DNS compliance: cannot start or end with hyphens (RFC requirement)\n if (id.startsWith('-') || id.endsWith('-')) {\n throw new SecurityError(\n 'Sandbox ID cannot start or end with hyphens (DNS requirement).',\n 'INVALID_SANDBOX_ID_HYPHENS'\n );\n }\n\n // Prevent reserved names that cause technical conflicts\n const reservedNames = [\n 'www', 'api', 'admin', 'root', 'system',\n 'cloudflare', 'workers'\n ];\n\n const lowerCaseId = id.toLowerCase();\n if (reservedNames.includes(lowerCaseId)) {\n throw new SecurityError(\n `Reserved sandbox ID '${id}' is not allowed.`,\n 'RESERVED_SANDBOX_ID'\n );\n }\n\n return id;\n}\n\n\n/**\n * Logs security events for monitoring\n */\nexport function logSecurityEvent(\n event: string,\n details: Record<string, any>,\n severity: 'low' | 'medium' | 'high' | 'critical' = 'medium'\n): void {\n const logEntry = {\n timestamp: new Date().toISOString(),\n event,\n severity,\n ...details\n };\n\n switch (severity) {\n case 'critical':\n case 'high':\n console.error(`[SECURITY:${severity.toUpperCase()}] ${event}:`, JSON.stringify(logEntry));\n break;\n case 'medium':\n console.warn(`[SECURITY:${severity.toUpperCase()}] ${event}:`, JSON.stringify(logEntry));\n break;\n case 'low':\n console.info(`[SECURITY:${severity.toUpperCase()}] ${event}:`, JSON.stringify(logEntry));\n break;\n }\n}\n"],"mappings":";AAWO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YAAY,SAAiC,MAAe;AAC1D,UAAM,OAAO;AAD8B;AAE3C,SAAK,OAAO;AAAA,EACd;AACF;AAMO,SAAS,aAAa,MAAuB;AAElD,MAAI,CAAC,OAAO,UAAU,IAAI,GAAG;AAC3B,WAAO;AAAA,EACT;AAGA,MAAI,OAAO,QAAQ,OAAO,OAAO;AAC/B,WAAO;AAAA,EACT;AAGA,QAAM,gBAAgB;AAAA,IACpB;AAAA;AAAA,IACA;AAAA;AAAA,EACF;AAEA,MAAI,cAAc,SAAS,IAAI,GAAG;AAChC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,kBAAkB,IAAoB;AAEpD,MAAI,CAAC,MAAM,GAAG,SAAS,IAAI;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAGA,MAAI,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,GAAG;AAC1C,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAGA,QAAM,gBAAgB;AAAA,IACpB;AAAA,IAAO;AAAA,IAAO;AAAA,IAAS;AAAA,IAAQ;AAAA,IAC/B;AAAA,IAAc;AAAA,EAChB;AAEA,QAAM,cAAc,GAAG,YAAY;AACnC,MAAI,cAAc,SAAS,WAAW,GAAG;AACvC,UAAM,IAAI;AAAA,MACR,wBAAwB,EAAE;AAAA,MAC1B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAMO,SAAS,iBACd,OACA,SACA,WAAmD,UAC7C;AACN,QAAM,WAAW;AAAA,IACf,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,IAClC;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL;AAEA,UAAQ,UAAU;AAAA,IAChB,KAAK;AAAA,IACL,KAAK;AACH,cAAQ,MAAM,aAAa,SAAS,YAAY,CAAC,KAAK,KAAK,KAAK,KAAK,UAAU,QAAQ,CAAC;AACxF;AAAA,IACF,KAAK;AACH,cAAQ,KAAK,aAAa,SAAS,YAAY,CAAC,KAAK,KAAK,KAAK,KAAK,UAAU,QAAQ,CAAC;AACvF;AAAA,IACF,KAAK;AACH,cAAQ,KAAK,aAAa,SAAS,YAAY,CAAC,KAAK,KAAK,KAAK,KAAK,UAAU,QAAQ,CAAC;AACvF;AAAA,EACJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/security.ts"],"sourcesContent":["/**\n * Security utilities for URL construction and input validation\n *\n * This module contains critical security functions to prevent:\n * - URL injection attacks\n * - SSRF (Server-Side Request Forgery) attacks\n * - DNS rebinding attacks\n * - Host header injection\n * - Open redirect vulnerabilities\n */\n\nexport class SecurityError extends Error {\n constructor(message: string, public readonly code?: string) {\n super(message);\n this.name = 'SecurityError';\n }\n}\n\n/**\n * Validates port numbers for sandbox services\n * Only allows non-system ports to prevent conflicts and security issues\n */\nexport function validatePort(port: number): boolean {\n // Must be a valid integer\n if (!Number.isInteger(port)) {\n return false;\n }\n\n // Only allow non-system ports (1024-65535)\n if (port < 1024 || port > 65535) {\n return false;\n }\n\n // Exclude ports reserved by our system\n const reservedPorts = [\n 3000, // Control plane port\n 8787, // Common wrangler dev port\n ];\n\n if (reservedPorts.includes(port)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Sanitizes and validates sandbox IDs for DNS compliance and security\n * Only enforces critical requirements - allows maximum developer flexibility\n */\nexport function sanitizeSandboxId(id: string): string {\n // Basic validation: not empty, reasonable length limit (DNS subdomain limit is 63 chars)\n if (!id || id.length > 63) {\n throw new SecurityError(\n 'Sandbox ID must be 1-63 characters long.',\n 'INVALID_SANDBOX_ID_LENGTH'\n );\n }\n\n // DNS compliance: cannot start or end with hyphens (RFC requirement)\n if (id.startsWith('-') || id.endsWith('-')) {\n throw new SecurityError(\n 'Sandbox ID cannot start or end with hyphens (DNS requirement).',\n 'INVALID_SANDBOX_ID_HYPHENS'\n );\n }\n\n // Prevent reserved names that cause technical conflicts\n const reservedNames = [\n 'www', 'api', 'admin', 'root', 'system',\n 'cloudflare', 'workers'\n ];\n\n const lowerCaseId = id.toLowerCase();\n if (reservedNames.includes(lowerCaseId)) {\n throw new SecurityError(\n `Reserved sandbox ID '${id}' is not allowed.`,\n 'RESERVED_SANDBOX_ID'\n );\n }\n\n return id;\n}\n\n\n/**\n * Validates language for code interpreter\n * Only allows supported languages\n */\nexport function validateLanguage(language: string | undefined): void {\n if (!language) {\n return; // undefined is valid, will default to python\n }\n\n const supportedLanguages = ['python', 'python3', 'javascript', 'js', 'node', 'typescript', 'ts'];\n const normalized = language.toLowerCase();\n\n if (!supportedLanguages.includes(normalized)) {\n throw new SecurityError(\n `Unsupported language '${language}'. Supported languages: python, javascript, typescript`,\n 'INVALID_LANGUAGE'\n );\n }\n}\n"],"mappings":";AAWO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YAAY,SAAiC,MAAe;AAC1D,UAAM,OAAO;AAD8B;AAE3C,SAAK,OAAO;AAAA,EACd;AACF;AAMO,SAAS,aAAa,MAAuB;AAElD,MAAI,CAAC,OAAO,UAAU,IAAI,GAAG;AAC3B,WAAO;AAAA,EACT;AAGA,MAAI,OAAO,QAAQ,OAAO,OAAO;AAC/B,WAAO;AAAA,EACT;AAGA,QAAM,gBAAgB;AAAA,IACpB;AAAA;AAAA,IACA;AAAA;AAAA,EACF;AAEA,MAAI,cAAc,SAAS,IAAI,GAAG;AAChC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,kBAAkB,IAAoB;AAEpD,MAAI,CAAC,MAAM,GAAG,SAAS,IAAI;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAGA,MAAI,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,GAAG;AAC1C,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAGA,QAAM,gBAAgB;AAAA,IACpB;AAAA,IAAO;AAAA,IAAO;AAAA,IAAS;AAAA,IAAQ;AAAA,IAC/B;AAAA,IAAc;AAAA,EAChB;AAEA,QAAM,cAAc,GAAG,YAAY;AACnC,MAAI,cAAc,SAAS,WAAW,GAAG;AACvC,UAAM,IAAI;AAAA,MACR,wBAAwB,EAAE;AAAA,MAC1B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAOO,SAAS,iBAAiB,UAAoC;AACnE,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AAEA,QAAM,qBAAqB,CAAC,UAAU,WAAW,cAAc,MAAM,QAAQ,cAAc,IAAI;AAC/F,QAAM,aAAa,SAAS,YAAY;AAExC,MAAI,CAAC,mBAAmB,SAAS,UAAU,GAAG;AAC5C,UAAM,IAAI;AAAA,MACR,yBAAyB,QAAQ;AAAA,MACjC;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,63 +1,41 @@
1
- import { FileChunk, FileMetadata } from './types.js';
2
- import './interpreter-types.js';
1
+ import { FileChunk, FileMetadata } from '@repo/shared';
3
2
 
4
3
  /**
5
- * File streaming utilities for reading binary and text files
6
- * Provides simple AsyncIterable API over SSE stream with automatic base64 decoding
7
- */
8
-
9
- /**
10
- * Convert ReadableStream of SSE file events to AsyncIterable of file chunks
11
- * Automatically decodes base64 for binary files and provides metadata
4
+ * Stream a file from the sandbox with automatic base64 decoding for binary files
12
5
  *
13
- * @param stream - The SSE ReadableStream from readFileStream()
14
- * @param signal - Optional AbortSignal for cancellation
15
- * @returns AsyncIterable that yields file chunks (string for text, Uint8Array for binary)
6
+ * @param stream - The ReadableStream from readFileStream()
7
+ * @returns AsyncGenerator that yields FileChunk (string for text, Uint8Array for binary)
16
8
  *
17
9
  * @example
18
- * ```typescript
10
+ * ```ts
19
11
  * const stream = await sandbox.readFileStream('/path/to/file.png');
20
- *
21
12
  * for await (const chunk of streamFile(stream)) {
22
13
  * if (chunk instanceof Uint8Array) {
23
- * // Binary chunk - already decoded from base64
24
- * console.log('Binary chunk:', chunk.byteLength, 'bytes');
14
+ * // Binary chunk
15
+ * console.log('Binary chunk:', chunk.length, 'bytes');
25
16
  * } else {
26
17
  * // Text chunk
27
18
  * console.log('Text chunk:', chunk);
28
19
  * }
29
20
  * }
30
- *
31
- * // Access metadata
32
- * const iter = streamFile(stream);
33
- * for await (const chunk of iter) {
34
- * console.log('MIME type:', iter.metadata?.mimeType);
35
- * // process chunk...
36
- * }
37
21
  * ```
38
22
  */
39
- declare function streamFile(stream: ReadableStream<Uint8Array>, signal?: AbortSignal): AsyncGenerator<FileChunk, void, undefined>;
23
+ declare function streamFile(stream: ReadableStream<Uint8Array>): AsyncGenerator<FileChunk, FileMetadata>;
40
24
  /**
41
- * Helper to collect entire file from stream into memory
42
- * Useful for smaller files where you want the complete content at once
25
+ * Collect an entire file into memory from a stream
43
26
  *
44
- * @param stream - The SSE ReadableStream from readFileStream()
45
- * @param signal - Optional AbortSignal for cancellation
46
- * @returns Object with content (string or Uint8Array) and metadata
27
+ * @param stream - The ReadableStream from readFileStream()
28
+ * @returns Object containing the file content and metadata
47
29
  *
48
30
  * @example
49
- * ```typescript
50
- * const stream = await sandbox.readFileStream('/path/to/image.png');
31
+ * ```ts
32
+ * const stream = await sandbox.readFileStream('/path/to/file.txt');
51
33
  * const { content, metadata } = await collectFile(stream);
52
- *
53
- * if (content instanceof Uint8Array) {
54
- * console.log('Binary file:', metadata.mimeType, content.byteLength, 'bytes');
55
- * } else {
56
- * console.log('Text file:', metadata.mimeType, content.length, 'chars');
57
- * }
34
+ * console.log('Content:', content);
35
+ * console.log('MIME type:', metadata.mimeType);
58
36
  * ```
59
37
  */
60
- declare function collectFile(stream: ReadableStream<Uint8Array>, signal?: AbortSignal): Promise<{
38
+ declare function collectFile(stream: ReadableStream<Uint8Array>): Promise<{
61
39
  content: string | Uint8Array;
62
40
  metadata: FileMetadata;
63
41
  }>;
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  collectFile,
3
3
  streamFile
4
- } from "./chunk-5DILEXGY.js";
5
- import "./chunk-NNGBXDMY.js";
4
+ } from "./chunk-BFVUNTP4.js";
6
5
  export {
7
6
  collectFile,
8
7
  streamFile
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- export { CodeExecutionError, ContainerNotReadyError, ContextNotFoundError, InterpreterNotReadyError, InterpreterNotReadyError as JupyterNotReadyError, SandboxError, SandboxErrorResponse, SandboxNetworkError, ServiceUnavailableError, isInterpreterNotReadyError, isInterpreterNotReadyError as isJupyterNotReadyError, isRetryableError, isSandboxError, parseErrorResponse } from './errors.js';
2
- export { ChartData, CodeContext, CreateContextOptions, Execution, ExecutionError, OutputMessage, Result, ResultImpl, RunCodeOptions } from './interpreter-types.js';
1
+ export { B as BaseApiResponse, C as CommandClient, f as CommandExecuteResponse, c as CommandsResponse, d as ContainerStub, E as ErrorResponse, e as ExecuteRequest, p as ExecutionCallbacks, h as ExposePortRequest, F as FileClient, i as FileOperationRequest, j as GitCheckoutRequest, G as GitClient, I as InterpreterClient, M as MkdirRequest, k as PingResponse, P as PortClient, a as ProcessClient, R as ReadFileRequest, l as RequestConfig, m as ResponseHandler, b as Sandbox, S as SandboxClient, H as SandboxClientOptions, n as SessionRequest, o as UnexposePortRequest, U as UtilityClient, W as WriteFileRequest, g as getSandbox } from './sandbox-D9K2ypln.js';
2
+ export * from '@repo/shared';
3
+ export { BaseExecOptions, ExecEvent, ExecOptions, ExecResult, FileChunk, FileMetadata, FileStreamEvent, GitCheckoutResult, ISandbox, LogEvent, PortCloseResult, PortExposeResult, PortListResult, Process, ProcessCleanupResult, ProcessInfoResult, ProcessKillResult, ProcessListResult, ProcessLogsResult, ProcessOptions, ProcessStartResult, ProcessStatus, StartProcessRequest, StreamOptions, isExecResult, isProcess, isProcessStatus } from '@repo/shared';
4
+ export { collectFile, streamFile } from './file-stream.js';
5
+ export { CodeInterpreter } from './interpreter.js';
3
6
  export { RouteInfo, SandboxEnv, proxyToSandbox } from './request-handler.js';
4
- export { S as Sandbox, g as getSandbox } from './client-B3RUab0s.js';
5
7
  export { asyncIterableToSSEStream, parseSSEStream, responseToAsyncIterable } from './sse-parser.js';
6
- export { collectFile, streamFile } from './file-stream.js';
7
- export { DeleteFileResponse, ExecEvent, ExecOptions, ExecResult, ExecuteResponse, ExecutionSession, FileChunk, FileMetadata, FileStream, FileStreamEvent, GitCheckoutResponse, ISandbox, ListFilesResponse, LogEvent, MkdirResponse, MoveFileResponse, Process, ProcessOptions, ProcessStatus, ReadFileResponse, RenameFileResponse, StreamOptions, WriteFileResponse } from './types.js';
8
+ import 'cloudflare:workers';
8
9
  import '@cloudflare/containers';
package/dist/index.js CHANGED
@@ -1,59 +1,66 @@
1
1
  import {
2
2
  collectFile,
3
3
  streamFile
4
- } from "./chunk-5DILEXGY.js";
5
- import {
6
- asyncIterableToSSEStream,
7
- parseSSEStream,
8
- responseToAsyncIterable
9
- } from "./chunk-NNGBXDMY.js";
4
+ } from "./chunk-BFVUNTP4.js";
10
5
  import {
6
+ CommandClient,
7
+ FileClient,
8
+ GitClient,
9
+ PortClient,
10
+ ProcessClient,
11
11
  Sandbox,
12
+ SandboxClient,
13
+ UtilityClient,
12
14
  getSandbox,
13
15
  proxyToSandbox
14
- } from "./chunk-SQLJNZ3K.js";
15
- import "./chunk-6UAWTJ5S.js";
16
- import "./chunk-D3U63BZP.js";
17
- import "./chunk-32UDXUPC.js";
16
+ } from "./chunk-53JFOF7F.js";
18
17
  import {
19
- CodeExecutionError,
20
- ContainerNotReadyError,
21
- ContextNotFoundError,
22
- InterpreterNotReadyError,
23
- SandboxError,
24
- SandboxNetworkError,
25
- ServiceUnavailableError,
26
- isInterpreterNotReadyError,
27
- isRetryableError,
28
- isSandboxError,
29
- parseErrorResponse
30
- } from "./chunk-FXYPFGOZ.js";
31
- import "./chunk-JTKON2SH.js";
18
+ CodeInterpreter,
19
+ Execution,
20
+ LogLevel,
21
+ ResultImpl,
22
+ TraceContext,
23
+ createLogger,
24
+ createNoOpLogger,
25
+ getLogger,
26
+ isExecResult,
27
+ isProcess,
28
+ isProcessStatus,
29
+ runWithLogger
30
+ } from "./chunk-JXZMAU2C.js";
31
+ import "./chunk-Z532A7QC.js";
32
32
  import {
33
- ResultImpl
34
- } from "./chunk-W7TVRPBG.js";
33
+ asyncIterableToSSEStream,
34
+ parseSSEStream,
35
+ responseToAsyncIterable
36
+ } from "./chunk-EKSWCBCA.js";
35
37
  export {
36
- CodeExecutionError,
37
- ContainerNotReadyError,
38
- ContextNotFoundError,
39
- InterpreterNotReadyError,
40
- InterpreterNotReadyError as JupyterNotReadyError,
38
+ CodeInterpreter,
39
+ CommandClient,
40
+ Execution,
41
+ FileClient,
42
+ GitClient,
43
+ LogLevel as LogLevelEnum,
44
+ PortClient,
45
+ ProcessClient,
41
46
  ResultImpl,
42
47
  Sandbox,
43
- SandboxError,
44
- SandboxNetworkError,
45
- ServiceUnavailableError,
48
+ SandboxClient,
49
+ TraceContext,
50
+ UtilityClient,
46
51
  asyncIterableToSSEStream,
47
52
  collectFile,
53
+ createLogger,
54
+ createNoOpLogger,
55
+ getLogger,
48
56
  getSandbox,
49
- isInterpreterNotReadyError,
50
- isInterpreterNotReadyError as isJupyterNotReadyError,
51
- isRetryableError,
52
- isSandboxError,
53
- parseErrorResponse,
57
+ isExecResult,
58
+ isProcess,
59
+ isProcessStatus,
54
60
  parseSSEStream,
55
61
  proxyToSandbox,
56
62
  responseToAsyncIterable,
63
+ runWithLogger,
57
64
  streamFile
58
65
  };
59
66
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- import { CreateContextOptions, CodeContext, RunCodeOptions, Execution } from './interpreter-types.js';
2
- import { S as Sandbox } from './client-B3RUab0s.js';
3
- import './types.js';
1
+ import { CreateContextOptions, CodeContext, RunCodeOptions, Execution } from '@repo/shared';
2
+ import { b as Sandbox } from './sandbox-D9K2ypln.js';
3
+ import 'cloudflare:workers';
4
4
  import '@cloudflare/containers';
5
5
 
6
6
  declare class CodeInterpreter {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CodeInterpreter
3
- } from "./chunk-JTKON2SH.js";
4
- import "./chunk-W7TVRPBG.js";
3
+ } from "./chunk-JXZMAU2C.js";
4
+ import "./chunk-Z532A7QC.js";
5
5
  export {
6
6
  CodeInterpreter
7
7
  };
@@ -1,6 +1,6 @@
1
- import { S as Sandbox } from './client-B3RUab0s.js';
2
- import './types.js';
3
- import './interpreter-types.js';
1
+ import { b as Sandbox } from './sandbox-D9K2ypln.js';
2
+ import '@repo/shared';
3
+ import 'cloudflare:workers';
4
4
  import '@cloudflare/containers';
5
5
 
6
6
  interface SandboxEnv {
@@ -10,6 +10,7 @@ interface RouteInfo {
10
10
  port: number;
11
11
  sandboxId: string;
12
12
  path: string;
13
+ token: string;
13
14
  }
14
15
  declare function proxyToSandbox<E extends SandboxEnv>(request: Request, env: E): Promise<Response | null>;
15
16
  declare function isLocalhostPattern(hostname: string): boolean;
@@ -1,13 +1,10 @@
1
1
  import {
2
2
  isLocalhostPattern,
3
3
  proxyToSandbox
4
- } from "./chunk-SQLJNZ3K.js";
5
- import "./chunk-6UAWTJ5S.js";
6
- import "./chunk-D3U63BZP.js";
7
- import "./chunk-32UDXUPC.js";
8
- import "./chunk-FXYPFGOZ.js";
9
- import "./chunk-JTKON2SH.js";
10
- import "./chunk-W7TVRPBG.js";
4
+ } from "./chunk-53JFOF7F.js";
5
+ import "./chunk-JXZMAU2C.js";
6
+ import "./chunk-Z532A7QC.js";
7
+ import "./chunk-EKSWCBCA.js";
11
8
  export {
12
9
  isLocalhostPattern,
13
10
  proxyToSandbox