@cloudflare/sandbox 0.4.1 → 0.4.3
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 +9 -9
- package/CHANGELOG.md +12 -0
- package/Dockerfile +12 -48
- package/dist/{chunk-HGF554LH.js → chunk-EXQOIRZI.js} +139 -24
- package/dist/chunk-EXQOIRZI.js.map +1 -0
- package/dist/chunk-JXZMAU2C.js +559 -0
- package/dist/chunk-JXZMAU2C.js.map +1 -0
- package/dist/index.js +22 -11
- package/dist/index.js.map +1 -1
- package/dist/interpreter.js +1 -1
- package/dist/request-handler.js +2 -2
- package/dist/sandbox.js +2 -2
- package/package.json +4 -2
- package/src/sandbox.ts +0 -1
- package/dist/chunk-BCJ7SF3Q.js +0 -117
- package/dist/chunk-BCJ7SF3Q.js.map +0 -1
- package/dist/chunk-HGF554LH.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @cloudflare/sandbox@0.4.
|
|
2
|
+
> @cloudflare/sandbox@0.4.3 build
|
|
3
3
|
> rm -rf dist && tsup src/*.ts --outDir dist --dts --sourcemap --format esm
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/file-stream.ts, src/index.ts, src/interpreter.ts, src/request-handler.ts, src/sandbox.ts, src/security.ts, src/sse-parser.ts
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[32mESM[39m [1mdist/file-stream.js [22m[32m146.00 B[39m
|
|
11
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m1.10 KB[39m
|
|
12
12
|
[32mESM[39m [1mdist/chunk-BFVUNTP4.js [22m[32m2.76 KB[39m
|
|
13
13
|
[32mESM[39m [1mdist/interpreter.js [22m[32m156.00 B[39m
|
|
14
14
|
[32mESM[39m [1mdist/request-handler.js [22m[32m262.00 B[39m
|
|
15
15
|
[32mESM[39m [1mdist/sandbox.js [22m[32m224.00 B[39m
|
|
16
|
-
[32mESM[39m [1mdist/chunk-
|
|
17
|
-
[32mESM[39m [1mdist/chunk-
|
|
16
|
+
[32mESM[39m [1mdist/chunk-EXQOIRZI.js [22m[32m71.23 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/chunk-JXZMAU2C.js [22m[32m14.43 KB[39m
|
|
18
18
|
[32mESM[39m [1mdist/security.js [22m[32m233.00 B[39m
|
|
19
19
|
[32mESM[39m [1mdist/chunk-Z532A7QC.js [22m[32m1.75 KB[39m
|
|
20
20
|
[32mESM[39m [1mdist/sse-parser.js [22m[32m233.00 B[39m
|
|
21
21
|
[32mESM[39m [1mdist/chunk-EKSWCBCA.js [22m[32m2.28 KB[39m
|
|
22
22
|
[32mESM[39m [1mdist/file-stream.js.map [22m[32m71.00 B[39m
|
|
23
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
23
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m71.00 B[39m
|
|
24
24
|
[32mESM[39m [1mdist/chunk-BFVUNTP4.js.map [22m[32m6.71 KB[39m
|
|
25
25
|
[32mESM[39m [1mdist/interpreter.js.map [22m[32m71.00 B[39m
|
|
26
26
|
[32mESM[39m [1mdist/request-handler.js.map [22m[32m71.00 B[39m
|
|
27
27
|
[32mESM[39m [1mdist/sandbox.js.map [22m[32m71.00 B[39m
|
|
28
|
-
[32mESM[39m [1mdist/chunk-
|
|
29
|
-
[32mESM[39m [1mdist/chunk-
|
|
28
|
+
[32mESM[39m [1mdist/chunk-EXQOIRZI.js.map [22m[32m146.89 KB[39m
|
|
29
|
+
[32mESM[39m [1mdist/chunk-JXZMAU2C.js.map [22m[32m33.44 KB[39m
|
|
30
30
|
[32mESM[39m [1mdist/security.js.map [22m[32m71.00 B[39m
|
|
31
31
|
[32mESM[39m [1mdist/chunk-Z532A7QC.js.map [22m[32m3.96 KB[39m
|
|
32
32
|
[32mESM[39m [1mdist/sse-parser.js.map [22m[32m71.00 B[39m
|
|
33
33
|
[32mESM[39m [1mdist/chunk-EKSWCBCA.js.map [22m[32m5.61 KB[39m
|
|
34
|
-
[32mESM[39m ⚡️ Build success in
|
|
34
|
+
[32mESM[39m ⚡️ Build success in 154ms
|
|
35
35
|
[34mDTS[39m Build start
|
|
36
|
-
[32mDTS[39m ⚡️ Build success in
|
|
36
|
+
[32mDTS[39m ⚡️ Build success in 2714ms
|
|
37
37
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.46 KB[39m
|
|
38
38
|
[32mDTS[39m [1mdist/file-stream.d.ts [22m[32m1.34 KB[39m
|
|
39
39
|
[32mDTS[39m [1mdist/interpreter.d.ts [22m[32m1007.00 B[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @cloudflare/sandbox
|
|
2
2
|
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#114](https://github.com/cloudflare/sandbox-sdk/pull/114) [`8c1f440`](https://github.com/cloudflare/sandbox-sdk/commit/8c1f440ad6fd89a5c69f9ca9d055ad9b183dd1c3) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Debloat base docker image (2.63GB → 1.03GB)
|
|
8
|
+
|
|
9
|
+
## 0.4.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`e53d7e7`](https://github.com/cloudflare/sandbox-sdk/commit/e53d7e7ce185f79bdd899029bb532e9651ae7ba5) Thanks [@threepointone](https://github.com/threepointone)! - fix build by inlining repo/shared
|
|
14
|
+
|
|
3
15
|
## 0.4.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/Dockerfile
CHANGED
|
@@ -56,46 +56,27 @@ COPY --from=builder /app/tooling ./tooling
|
|
|
56
56
|
RUN npm ci --production
|
|
57
57
|
|
|
58
58
|
# ============================================================================
|
|
59
|
-
# Stage 4: Runtime - Ubuntu 22.04 with
|
|
59
|
+
# Stage 4: Runtime - Ubuntu 22.04 with only runtime dependencies
|
|
60
60
|
# ============================================================================
|
|
61
61
|
FROM ubuntu:22.04 AS runtime
|
|
62
62
|
|
|
63
63
|
# Prevent interactive prompts during package installation
|
|
64
64
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
65
65
|
|
|
66
|
-
# Install essential
|
|
67
|
-
RUN apt-get update && apt-get install -y \
|
|
68
|
-
# Basic utilities
|
|
66
|
+
# Install essential runtime packages
|
|
67
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
69
68
|
curl \
|
|
70
69
|
wget \
|
|
70
|
+
ca-certificates \
|
|
71
|
+
python3.11 \
|
|
72
|
+
python3-pip \
|
|
73
|
+
python3.11-venv \
|
|
74
|
+
procps \
|
|
71
75
|
git \
|
|
72
76
|
unzip \
|
|
73
77
|
zip \
|
|
74
|
-
file \
|
|
75
|
-
# Process management
|
|
76
|
-
procps \
|
|
77
|
-
htop \
|
|
78
|
-
# Build tools
|
|
79
|
-
build-essential \
|
|
80
|
-
pkg-config \
|
|
81
|
-
# Network tools
|
|
82
|
-
net-tools \
|
|
83
|
-
iputils-ping \
|
|
84
|
-
dnsutils \
|
|
85
|
-
# Text processing
|
|
86
78
|
jq \
|
|
87
|
-
|
|
88
|
-
nano \
|
|
89
|
-
# Python dependencies
|
|
90
|
-
python3.11 \
|
|
91
|
-
python3.11-dev \
|
|
92
|
-
python3-pip \
|
|
93
|
-
python3.11-venv \
|
|
94
|
-
# Other useful tools
|
|
95
|
-
ca-certificates \
|
|
96
|
-
gnupg \
|
|
97
|
-
lsb-release \
|
|
98
|
-
strace \
|
|
79
|
+
file \
|
|
99
80
|
&& rm -rf /var/lib/apt/lists/*
|
|
100
81
|
|
|
101
82
|
# Set Python 3.11 as default python3
|
|
@@ -108,13 +89,6 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
|
108
89
|
|
|
109
90
|
# Install Bun runtime from official image
|
|
110
91
|
COPY --from=oven/bun:1 /usr/local/bin/bun /usr/local/bin/bun
|
|
111
|
-
COPY --from=oven/bun:1 /usr/local/bin/bunx /usr/local/bin/bunx
|
|
112
|
-
|
|
113
|
-
# Install development tools globally
|
|
114
|
-
RUN npm install -g \
|
|
115
|
-
wrangler \
|
|
116
|
-
vite \
|
|
117
|
-
opencode-ai
|
|
118
92
|
|
|
119
93
|
# Install essential Python packages for code execution
|
|
120
94
|
RUN pip3 install --no-cache-dir \
|
|
@@ -123,12 +97,6 @@ RUN pip3 install --no-cache-dir \
|
|
|
123
97
|
pandas \
|
|
124
98
|
ipython
|
|
125
99
|
|
|
126
|
-
# Verify installations
|
|
127
|
-
RUN python3 --version && \
|
|
128
|
-
node --version && \
|
|
129
|
-
npm --version && \
|
|
130
|
-
bun --version
|
|
131
|
-
|
|
132
100
|
# Set up runtime container server directory
|
|
133
101
|
WORKDIR /container-server
|
|
134
102
|
|
|
@@ -143,10 +111,9 @@ COPY --from=builder /app/packages/sandbox-container/src/runtime/executors/python
|
|
|
143
111
|
# Includes: @repo/shared, zod, esbuild (runtime dependencies)
|
|
144
112
|
COPY --from=prod-deps /app/node_modules ./node_modules
|
|
145
113
|
|
|
146
|
-
# Copy workspace packages
|
|
147
|
-
|
|
148
|
-
COPY --from=prod-deps /app/packages/shared ./packages/shared
|
|
149
|
-
COPY --from=prod-deps /app/tooling/typescript-config ./tooling/typescript-config
|
|
114
|
+
# Copy workspace packages
|
|
115
|
+
COPY --from=prod-deps /app/packages/shared/dist ./packages/shared/dist
|
|
116
|
+
COPY --from=prod-deps /app/packages/shared/package.json ./packages/shared/package.json
|
|
150
117
|
|
|
151
118
|
# Configure process pool sizes (can be overridden at runtime)
|
|
152
119
|
ENV PYTHON_POOL_MIN_SIZE=3
|
|
@@ -157,9 +124,6 @@ ENV TYPESCRIPT_POOL_MIN_SIZE=3
|
|
|
157
124
|
ENV TYPESCRIPT_POOL_MAX_SIZE=10
|
|
158
125
|
|
|
159
126
|
# Create clean workspace directory for user code
|
|
160
|
-
# Architecture:
|
|
161
|
-
# /container-server/ - SDK infrastructure (server, executors, dependencies)
|
|
162
|
-
# /workspace/ - User's clean workspace for their code
|
|
163
127
|
RUN mkdir -p /workspace
|
|
164
128
|
|
|
165
129
|
# Expose the application port (3000 for control)
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CodeInterpreter
|
|
3
|
-
|
|
2
|
+
CodeInterpreter,
|
|
3
|
+
ResultImpl,
|
|
4
|
+
TraceContext,
|
|
5
|
+
createLogger,
|
|
6
|
+
createNoOpLogger,
|
|
7
|
+
runWithLogger
|
|
8
|
+
} from "./chunk-JXZMAU2C.js";
|
|
4
9
|
import {
|
|
5
10
|
SecurityError,
|
|
6
11
|
sanitizeSandboxId,
|
|
@@ -10,21 +15,135 @@ import {
|
|
|
10
15
|
parseSSEStream
|
|
11
16
|
} from "./chunk-EKSWCBCA.js";
|
|
12
17
|
|
|
13
|
-
// src/request-handler.ts
|
|
14
|
-
import { createLogger as createLogger2, TraceContext as TraceContext2 } from "@repo/shared";
|
|
15
|
-
|
|
16
18
|
// src/sandbox.ts
|
|
17
19
|
import { Container, getContainer } from "@cloudflare/containers";
|
|
18
|
-
import { createLogger, runWithLogger, TraceContext } from "@repo/shared";
|
|
19
|
-
|
|
20
|
-
// src/clients/base-client.ts
|
|
21
|
-
import { createNoOpLogger } from "@repo/shared";
|
|
22
20
|
|
|
23
|
-
//
|
|
24
|
-
|
|
21
|
+
// ../shared/dist/errors/codes.js
|
|
22
|
+
var ErrorCode = {
|
|
23
|
+
// File System Errors (404)
|
|
24
|
+
FILE_NOT_FOUND: "FILE_NOT_FOUND",
|
|
25
|
+
// Permission Errors (403)
|
|
26
|
+
PERMISSION_DENIED: "PERMISSION_DENIED",
|
|
27
|
+
// File System Errors (409)
|
|
28
|
+
FILE_EXISTS: "FILE_EXISTS",
|
|
29
|
+
// File System Errors (400)
|
|
30
|
+
IS_DIRECTORY: "IS_DIRECTORY",
|
|
31
|
+
NOT_DIRECTORY: "NOT_DIRECTORY",
|
|
32
|
+
// File System Errors (500)
|
|
33
|
+
NO_SPACE: "NO_SPACE",
|
|
34
|
+
TOO_MANY_FILES: "TOO_MANY_FILES",
|
|
35
|
+
RESOURCE_BUSY: "RESOURCE_BUSY",
|
|
36
|
+
READ_ONLY: "READ_ONLY",
|
|
37
|
+
NAME_TOO_LONG: "NAME_TOO_LONG",
|
|
38
|
+
TOO_MANY_LINKS: "TOO_MANY_LINKS",
|
|
39
|
+
FILESYSTEM_ERROR: "FILESYSTEM_ERROR",
|
|
40
|
+
// Command Errors (404)
|
|
41
|
+
COMMAND_NOT_FOUND: "COMMAND_NOT_FOUND",
|
|
42
|
+
// Command Errors (403/400)
|
|
43
|
+
COMMAND_PERMISSION_DENIED: "COMMAND_PERMISSION_DENIED",
|
|
44
|
+
INVALID_COMMAND: "INVALID_COMMAND",
|
|
45
|
+
// Command Errors (500)
|
|
46
|
+
COMMAND_EXECUTION_ERROR: "COMMAND_EXECUTION_ERROR",
|
|
47
|
+
STREAM_START_ERROR: "STREAM_START_ERROR",
|
|
48
|
+
// Process Errors (404)
|
|
49
|
+
PROCESS_NOT_FOUND: "PROCESS_NOT_FOUND",
|
|
50
|
+
// Process Errors (403/500)
|
|
51
|
+
PROCESS_PERMISSION_DENIED: "PROCESS_PERMISSION_DENIED",
|
|
52
|
+
PROCESS_ERROR: "PROCESS_ERROR",
|
|
53
|
+
// Port Errors (409)
|
|
54
|
+
PORT_ALREADY_EXPOSED: "PORT_ALREADY_EXPOSED",
|
|
55
|
+
PORT_IN_USE: "PORT_IN_USE",
|
|
56
|
+
// Port Errors (404)
|
|
57
|
+
PORT_NOT_EXPOSED: "PORT_NOT_EXPOSED",
|
|
58
|
+
// Port Errors (400)
|
|
59
|
+
INVALID_PORT_NUMBER: "INVALID_PORT_NUMBER",
|
|
60
|
+
INVALID_PORT: "INVALID_PORT",
|
|
61
|
+
// Port Errors (502/500)
|
|
62
|
+
SERVICE_NOT_RESPONDING: "SERVICE_NOT_RESPONDING",
|
|
63
|
+
PORT_OPERATION_ERROR: "PORT_OPERATION_ERROR",
|
|
64
|
+
// Port Errors (400)
|
|
65
|
+
CUSTOM_DOMAIN_REQUIRED: "CUSTOM_DOMAIN_REQUIRED",
|
|
66
|
+
// Git Errors (404)
|
|
67
|
+
GIT_REPOSITORY_NOT_FOUND: "GIT_REPOSITORY_NOT_FOUND",
|
|
68
|
+
GIT_BRANCH_NOT_FOUND: "GIT_BRANCH_NOT_FOUND",
|
|
69
|
+
// Git Errors (401)
|
|
70
|
+
GIT_AUTH_FAILED: "GIT_AUTH_FAILED",
|
|
71
|
+
// Git Errors (502)
|
|
72
|
+
GIT_NETWORK_ERROR: "GIT_NETWORK_ERROR",
|
|
73
|
+
// Git Errors (400)
|
|
74
|
+
INVALID_GIT_URL: "INVALID_GIT_URL",
|
|
75
|
+
// Git Errors (500)
|
|
76
|
+
GIT_CLONE_FAILED: "GIT_CLONE_FAILED",
|
|
77
|
+
GIT_CHECKOUT_FAILED: "GIT_CHECKOUT_FAILED",
|
|
78
|
+
GIT_OPERATION_FAILED: "GIT_OPERATION_FAILED",
|
|
79
|
+
// Code Interpreter Errors (503)
|
|
80
|
+
INTERPRETER_NOT_READY: "INTERPRETER_NOT_READY",
|
|
81
|
+
// Code Interpreter Errors (404)
|
|
82
|
+
CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND",
|
|
83
|
+
// Code Interpreter Errors (500)
|
|
84
|
+
CODE_EXECUTION_ERROR: "CODE_EXECUTION_ERROR",
|
|
85
|
+
// Validation Errors (400)
|
|
86
|
+
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
87
|
+
// Generic Errors (400/500)
|
|
88
|
+
INVALID_JSON_RESPONSE: "INVALID_JSON_RESPONSE",
|
|
89
|
+
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
90
|
+
INTERNAL_ERROR: "INTERNAL_ERROR"
|
|
91
|
+
};
|
|
25
92
|
|
|
26
|
-
//
|
|
27
|
-
|
|
93
|
+
// ../shared/dist/errors/status-map.js
|
|
94
|
+
var ERROR_STATUS_MAP = {
|
|
95
|
+
// 404 Not Found
|
|
96
|
+
[ErrorCode.FILE_NOT_FOUND]: 404,
|
|
97
|
+
[ErrorCode.COMMAND_NOT_FOUND]: 404,
|
|
98
|
+
[ErrorCode.PROCESS_NOT_FOUND]: 404,
|
|
99
|
+
[ErrorCode.PORT_NOT_EXPOSED]: 404,
|
|
100
|
+
[ErrorCode.GIT_REPOSITORY_NOT_FOUND]: 404,
|
|
101
|
+
[ErrorCode.GIT_BRANCH_NOT_FOUND]: 404,
|
|
102
|
+
[ErrorCode.CONTEXT_NOT_FOUND]: 404,
|
|
103
|
+
// 400 Bad Request
|
|
104
|
+
[ErrorCode.IS_DIRECTORY]: 400,
|
|
105
|
+
[ErrorCode.NOT_DIRECTORY]: 400,
|
|
106
|
+
[ErrorCode.INVALID_COMMAND]: 400,
|
|
107
|
+
[ErrorCode.INVALID_PORT_NUMBER]: 400,
|
|
108
|
+
[ErrorCode.INVALID_PORT]: 400,
|
|
109
|
+
[ErrorCode.INVALID_GIT_URL]: 400,
|
|
110
|
+
[ErrorCode.CUSTOM_DOMAIN_REQUIRED]: 400,
|
|
111
|
+
[ErrorCode.INVALID_JSON_RESPONSE]: 400,
|
|
112
|
+
[ErrorCode.NAME_TOO_LONG]: 400,
|
|
113
|
+
[ErrorCode.VALIDATION_FAILED]: 400,
|
|
114
|
+
// 401 Unauthorized
|
|
115
|
+
[ErrorCode.GIT_AUTH_FAILED]: 401,
|
|
116
|
+
// 403 Forbidden
|
|
117
|
+
[ErrorCode.PERMISSION_DENIED]: 403,
|
|
118
|
+
[ErrorCode.COMMAND_PERMISSION_DENIED]: 403,
|
|
119
|
+
[ErrorCode.PROCESS_PERMISSION_DENIED]: 403,
|
|
120
|
+
[ErrorCode.READ_ONLY]: 403,
|
|
121
|
+
// 409 Conflict
|
|
122
|
+
[ErrorCode.FILE_EXISTS]: 409,
|
|
123
|
+
[ErrorCode.PORT_ALREADY_EXPOSED]: 409,
|
|
124
|
+
[ErrorCode.PORT_IN_USE]: 409,
|
|
125
|
+
[ErrorCode.RESOURCE_BUSY]: 409,
|
|
126
|
+
// 502 Bad Gateway
|
|
127
|
+
[ErrorCode.SERVICE_NOT_RESPONDING]: 502,
|
|
128
|
+
[ErrorCode.GIT_NETWORK_ERROR]: 502,
|
|
129
|
+
// 503 Service Unavailable
|
|
130
|
+
[ErrorCode.INTERPRETER_NOT_READY]: 503,
|
|
131
|
+
// 500 Internal Server Error
|
|
132
|
+
[ErrorCode.NO_SPACE]: 500,
|
|
133
|
+
[ErrorCode.TOO_MANY_FILES]: 500,
|
|
134
|
+
[ErrorCode.TOO_MANY_LINKS]: 500,
|
|
135
|
+
[ErrorCode.FILESYSTEM_ERROR]: 500,
|
|
136
|
+
[ErrorCode.COMMAND_EXECUTION_ERROR]: 500,
|
|
137
|
+
[ErrorCode.STREAM_START_ERROR]: 500,
|
|
138
|
+
[ErrorCode.PROCESS_ERROR]: 500,
|
|
139
|
+
[ErrorCode.PORT_OPERATION_ERROR]: 500,
|
|
140
|
+
[ErrorCode.GIT_CLONE_FAILED]: 500,
|
|
141
|
+
[ErrorCode.GIT_CHECKOUT_FAILED]: 500,
|
|
142
|
+
[ErrorCode.GIT_OPERATION_FAILED]: 500,
|
|
143
|
+
[ErrorCode.CODE_EXECUTION_ERROR]: 500,
|
|
144
|
+
[ErrorCode.UNKNOWN_ERROR]: 500,
|
|
145
|
+
[ErrorCode.INTERNAL_ERROR]: 500
|
|
146
|
+
};
|
|
28
147
|
|
|
29
148
|
// src/errors/classes.ts
|
|
30
149
|
var SandboxError = class extends Error {
|
|
@@ -600,7 +719,7 @@ var BaseHttpClient = class {
|
|
|
600
719
|
return await response.json();
|
|
601
720
|
} catch (error) {
|
|
602
721
|
const errorResponse = {
|
|
603
|
-
code:
|
|
722
|
+
code: ErrorCode.INVALID_JSON_RESPONSE,
|
|
604
723
|
message: `Invalid JSON response: ${error instanceof Error ? error.message : "Unknown parsing error"}`,
|
|
605
724
|
context: {},
|
|
606
725
|
httpStatus: response.status,
|
|
@@ -618,7 +737,7 @@ var BaseHttpClient = class {
|
|
|
618
737
|
errorData = await response.json();
|
|
619
738
|
} catch {
|
|
620
739
|
errorData = {
|
|
621
|
-
code:
|
|
740
|
+
code: ErrorCode.INTERNAL_ERROR,
|
|
622
741
|
message: `HTTP error! status: ${response.status}`,
|
|
623
742
|
context: { statusText: response.statusText },
|
|
624
743
|
httpStatus: response.status,
|
|
@@ -995,9 +1114,6 @@ var GitClient = class extends BaseHttpClient {
|
|
|
995
1114
|
};
|
|
996
1115
|
|
|
997
1116
|
// src/clients/interpreter-client.ts
|
|
998
|
-
import {
|
|
999
|
-
ResultImpl
|
|
1000
|
-
} from "@repo/shared";
|
|
1001
1117
|
var InterpreterClient = class extends BaseHttpClient {
|
|
1002
1118
|
maxRetries = 3;
|
|
1003
1119
|
retryDelayMs = 1e3;
|
|
@@ -1129,7 +1245,7 @@ var InterpreterClient = class extends BaseHttpClient {
|
|
|
1129
1245
|
return createErrorFromResponse(errorData);
|
|
1130
1246
|
} catch {
|
|
1131
1247
|
const errorResponse = {
|
|
1132
|
-
code:
|
|
1248
|
+
code: ErrorCode.INTERNAL_ERROR,
|
|
1133
1249
|
message: `HTTP ${response.status}: ${response.statusText}`,
|
|
1134
1250
|
context: {},
|
|
1135
1251
|
httpStatus: response.status,
|
|
@@ -1535,7 +1651,6 @@ var Sandbox = class extends Container {
|
|
|
1535
1651
|
if (!this.baseUrl) {
|
|
1536
1652
|
this.baseUrl = baseUrl;
|
|
1537
1653
|
await this.ctx.storage.put("baseUrl", baseUrl);
|
|
1538
|
-
console.log(`[Sandbox] Stored base URL: ${baseUrl}`);
|
|
1539
1654
|
} else {
|
|
1540
1655
|
if (this.baseUrl !== baseUrl) {
|
|
1541
1656
|
throw new Error("Base URL already set and different from one previously provided");
|
|
@@ -1885,7 +2000,7 @@ var Sandbox = class extends Container {
|
|
|
1885
2000
|
async exposePort(port, options) {
|
|
1886
2001
|
if (options.hostname.endsWith(".workers.dev")) {
|
|
1887
2002
|
const errorResponse = {
|
|
1888
|
-
code:
|
|
2003
|
+
code: ErrorCode.CUSTOM_DOMAIN_REQUIRED,
|
|
1889
2004
|
message: `Port exposure requires a custom domain. .workers.dev domains do not support wildcard subdomains required for port proxying.`,
|
|
1890
2005
|
context: { originalError: options.hostname },
|
|
1891
2006
|
httpStatus: 400,
|
|
@@ -2109,8 +2224,8 @@ var Sandbox = class extends Container {
|
|
|
2109
2224
|
|
|
2110
2225
|
// src/request-handler.ts
|
|
2111
2226
|
async function proxyToSandbox(request, env) {
|
|
2112
|
-
const traceId =
|
|
2113
|
-
const logger =
|
|
2227
|
+
const traceId = TraceContext.fromHeaders(request.headers) || TraceContext.generate();
|
|
2228
|
+
const logger = createLogger({
|
|
2114
2229
|
component: "sandbox-do",
|
|
2115
2230
|
traceId,
|
|
2116
2231
|
operation: "proxy"
|
|
@@ -2233,4 +2348,4 @@ export {
|
|
|
2233
2348
|
getSandbox,
|
|
2234
2349
|
Sandbox
|
|
2235
2350
|
};
|
|
2236
|
-
//# sourceMappingURL=chunk-
|
|
2351
|
+
//# sourceMappingURL=chunk-EXQOIRZI.js.map
|