@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.
- package/.turbo/turbo-build.log +44 -0
- package/CHANGELOG.md +8 -10
- package/Dockerfile +82 -18
- package/README.md +89 -824
- package/dist/chunk-53JFOF7F.js +2352 -0
- package/dist/chunk-53JFOF7F.js.map +1 -0
- package/dist/chunk-BFVUNTP4.js +104 -0
- package/dist/chunk-BFVUNTP4.js.map +1 -0
- package/dist/{chunk-NNGBXDMY.js → chunk-EKSWCBCA.js} +3 -6
- package/dist/chunk-EKSWCBCA.js.map +1 -0
- package/dist/chunk-JXZMAU2C.js +559 -0
- package/dist/chunk-JXZMAU2C.js.map +1 -0
- package/dist/{chunk-6UAWTJ5S.js → chunk-Z532A7QC.js} +13 -20
- package/dist/{chunk-6UAWTJ5S.js.map → chunk-Z532A7QC.js.map} +1 -1
- package/dist/file-stream.d.ts +16 -38
- package/dist/file-stream.js +1 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.js +45 -38
- package/dist/interpreter.d.ts +3 -3
- package/dist/interpreter.js +2 -2
- package/dist/request-handler.d.ts +4 -3
- package/dist/request-handler.js +4 -7
- package/dist/sandbox-D9K2ypln.d.ts +583 -0
- package/dist/sandbox.d.ts +3 -3
- package/dist/sandbox.js +4 -7
- package/dist/security.d.ts +4 -3
- package/dist/security.js +3 -3
- package/dist/sse-parser.js +1 -1
- package/package.json +12 -4
- package/src/clients/base-client.ts +280 -0
- package/src/clients/command-client.ts +115 -0
- package/src/clients/file-client.ts +269 -0
- package/src/clients/git-client.ts +92 -0
- package/src/clients/index.ts +63 -0
- package/src/{interpreter-client.ts → clients/interpreter-client.ts} +148 -171
- package/src/clients/port-client.ts +105 -0
- package/src/clients/process-client.ts +177 -0
- package/src/clients/sandbox-client.ts +41 -0
- package/src/clients/types.ts +84 -0
- package/src/clients/utility-client.ts +94 -0
- package/src/errors/adapter.ts +180 -0
- package/src/errors/classes.ts +469 -0
- package/src/errors/index.ts +105 -0
- package/src/file-stream.ts +119 -117
- package/src/index.ts +81 -69
- package/src/interpreter.ts +17 -8
- package/src/request-handler.ts +69 -43
- package/src/sandbox.ts +694 -533
- package/src/security.ts +14 -23
- package/src/sse-parser.ts +4 -8
- package/startup.sh +3 -0
- package/tests/base-client.test.ts +328 -0
- package/tests/command-client.test.ts +407 -0
- package/tests/file-client.test.ts +643 -0
- package/tests/file-stream.test.ts +306 -0
- package/tests/git-client.test.ts +328 -0
- package/tests/port-client.test.ts +301 -0
- package/tests/process-client.test.ts +658 -0
- package/tests/sandbox.test.ts +465 -0
- package/tests/sse-parser.test.ts +290 -0
- package/tests/utility-client.test.ts +266 -0
- package/tests/wrangler.jsonc +35 -0
- package/tsconfig.json +9 -1
- package/vitest.config.ts +31 -0
- package/container_src/bun.lock +0 -76
- package/container_src/circuit-breaker.ts +0 -121
- package/container_src/control-process.ts +0 -784
- package/container_src/handler/exec.ts +0 -185
- package/container_src/handler/file.ts +0 -457
- package/container_src/handler/git.ts +0 -130
- package/container_src/handler/ports.ts +0 -314
- package/container_src/handler/process.ts +0 -568
- package/container_src/handler/session.ts +0 -92
- package/container_src/index.ts +0 -601
- package/container_src/interpreter-service.ts +0 -276
- package/container_src/isolation.ts +0 -1213
- package/container_src/mime-processor.ts +0 -255
- package/container_src/package.json +0 -18
- package/container_src/runtime/executors/javascript/node_executor.ts +0 -123
- package/container_src/runtime/executors/python/ipython_executor.py +0 -338
- package/container_src/runtime/executors/typescript/ts_executor.ts +0 -138
- package/container_src/runtime/process-pool.ts +0 -464
- package/container_src/shell-escape.ts +0 -42
- package/container_src/startup.sh +0 -11
- package/container_src/types.ts +0 -131
- package/dist/chunk-32UDXUPC.js +0 -671
- package/dist/chunk-32UDXUPC.js.map +0 -1
- package/dist/chunk-5DILEXGY.js +0 -85
- package/dist/chunk-5DILEXGY.js.map +0 -1
- package/dist/chunk-D3U63BZP.js +0 -240
- package/dist/chunk-D3U63BZP.js.map +0 -1
- package/dist/chunk-FXYPFGOZ.js +0 -129
- package/dist/chunk-FXYPFGOZ.js.map +0 -1
- package/dist/chunk-JTKON2SH.js +0 -113
- package/dist/chunk-JTKON2SH.js.map +0 -1
- package/dist/chunk-NNGBXDMY.js.map +0 -1
- package/dist/chunk-SQLJNZ3K.js +0 -674
- package/dist/chunk-SQLJNZ3K.js.map +0 -1
- package/dist/chunk-W7TVRPBG.js +0 -108
- package/dist/chunk-W7TVRPBG.js.map +0 -1
- package/dist/client-B3RUab0s.d.ts +0 -225
- package/dist/client.d.ts +0 -4
- package/dist/client.js +0 -7
- package/dist/client.js.map +0 -1
- package/dist/errors.d.ts +0 -95
- package/dist/errors.js +0 -27
- package/dist/errors.js.map +0 -1
- package/dist/interpreter-client.d.ts +0 -4
- package/dist/interpreter-client.js +0 -9
- package/dist/interpreter-client.js.map +0 -1
- package/dist/interpreter-types.d.ts +0 -259
- package/dist/interpreter-types.js +0 -9
- package/dist/interpreter-types.js.map +0 -1
- package/dist/types.d.ts +0 -453
- package/dist/types.js +0 -45
- package/dist/types.js.map +0 -1
- package/src/client.ts +0 -1048
- package/src/errors.ts +0 -219
- package/src/interpreter-types.ts +0 -390
- 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 *
|
|
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":[]}
|
package/dist/file-stream.d.ts
CHANGED
|
@@ -1,63 +1,41 @@
|
|
|
1
|
-
import { FileChunk, FileMetadata } from '
|
|
2
|
-
import './interpreter-types.js';
|
|
1
|
+
import { FileChunk, FileMetadata } from '@repo/shared';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
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
|
|
14
|
-
* @
|
|
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
|
-
* ```
|
|
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
|
|
24
|
-
* console.log('Binary chunk:', chunk.
|
|
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
|
|
23
|
+
declare function streamFile(stream: ReadableStream<Uint8Array>): AsyncGenerator<FileChunk, FileMetadata>;
|
|
40
24
|
/**
|
|
41
|
-
*
|
|
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
|
|
45
|
-
* @
|
|
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
|
-
* ```
|
|
50
|
-
* const stream = await sandbox.readFileStream('/path/to/
|
|
31
|
+
* ```ts
|
|
32
|
+
* const stream = await sandbox.readFileStream('/path/to/file.txt');
|
|
51
33
|
* const { content, metadata } = await collectFile(stream);
|
|
52
|
-
*
|
|
53
|
-
*
|
|
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
|
|
38
|
+
declare function collectFile(stream: ReadableStream<Uint8Array>): Promise<{
|
|
61
39
|
content: string | Uint8Array;
|
|
62
40
|
metadata: FileMetadata;
|
|
63
41
|
}>;
|
package/dist/file-stream.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
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
|
-
|
|
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-
|
|
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-
|
|
15
|
-
import "./chunk-6UAWTJ5S.js";
|
|
16
|
-
import "./chunk-D3U63BZP.js";
|
|
17
|
-
import "./chunk-32UDXUPC.js";
|
|
16
|
+
} from "./chunk-53JFOF7F.js";
|
|
18
17
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
34
|
-
|
|
33
|
+
asyncIterableToSSEStream,
|
|
34
|
+
parseSSEStream,
|
|
35
|
+
responseToAsyncIterable
|
|
36
|
+
} from "./chunk-EKSWCBCA.js";
|
|
35
37
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
SandboxClient,
|
|
49
|
+
TraceContext,
|
|
50
|
+
UtilityClient,
|
|
46
51
|
asyncIterableToSSEStream,
|
|
47
52
|
collectFile,
|
|
53
|
+
createLogger,
|
|
54
|
+
createNoOpLogger,
|
|
55
|
+
getLogger,
|
|
48
56
|
getSandbox,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
package/dist/interpreter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CreateContextOptions, CodeContext, RunCodeOptions, Execution } from '
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
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 {
|
package/dist/interpreter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
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;
|
package/dist/request-handler.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isLocalhostPattern,
|
|
3
3
|
proxyToSandbox
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
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
|