@cloudflare/sandbox 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +0 -55
- package/README.md +1 -0
- package/dist/bridge/index.js +9 -2
- package/dist/bridge/index.js.map +1 -1
- package/dist/{contexts-XHAo64dB.d.ts → contexts-B0_bcx9f.d.ts} +2 -29
- package/dist/contexts-B0_bcx9f.d.ts.map +1 -0
- package/dist/{errors-COsTRno_.js → errors-aRUdk9K8.js} +1 -19
- package/dist/errors-aRUdk9K8.js.map +1 -0
- package/dist/index.d.ts +3 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/openai/index.d.ts +1 -1
- package/dist/opencode/index.d.ts +2 -2
- package/dist/opencode/index.d.ts.map +1 -1
- package/dist/opencode/index.js +1 -1
- package/dist/{sandbox-B9LOT0cg.d.ts → sandbox-C8l-pMlL.d.ts} +51 -384
- package/dist/sandbox-C8l-pMlL.d.ts.map +1 -0
- package/dist/{sandbox-DQxTkLyY.js → sandbox-DKG3H156.js} +801 -517
- package/dist/sandbox-DKG3H156.js.map +1 -0
- package/package.json +1 -1
- package/dist/contexts-XHAo64dB.d.ts.map +0 -1
- package/dist/errors-COsTRno_.js.map +0 -1
- package/dist/sandbox-B9LOT0cg.d.ts.map +0 -1
- package/dist/sandbox-DQxTkLyY.js.map +0 -1
package/Dockerfile
CHANGED
|
@@ -284,61 +284,6 @@ EXPOSE 4096
|
|
|
284
284
|
|
|
285
285
|
ENTRYPOINT ["/container-server/sandbox"]
|
|
286
286
|
|
|
287
|
-
# ============================================================================
|
|
288
|
-
# Desktop variant — full Linux desktop with robotgo native control
|
|
289
|
-
# ============================================================================
|
|
290
|
-
FROM golang:1.25-bookworm AS go-builder
|
|
291
|
-
|
|
292
|
-
RUN mkdir -p /usr/local/share/ca-certificates
|
|
293
|
-
RUN --mount=type=secret,id=wrangler_ca \
|
|
294
|
-
apt-get update && apt-get install -y --no-install-recommends ca-certificates && \
|
|
295
|
-
if [ -f /run/secrets/wrangler_ca ] && [ -s /run/secrets/wrangler_ca ]; then \
|
|
296
|
-
cp /run/secrets/wrangler_ca /usr/local/share/ca-certificates/wrangler-dev-ca.crt; \
|
|
297
|
-
fi && \
|
|
298
|
-
update-ca-certificates && \
|
|
299
|
-
rm -rf /var/lib/apt/lists/*
|
|
300
|
-
|
|
301
|
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
302
|
-
gcc libx11-dev libxtst-dev libxinerama-dev libpng-dev \
|
|
303
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
304
|
-
|
|
305
|
-
COPY packages/sandbox-container/native/desktop-wrapper/ /build/
|
|
306
|
-
WORKDIR /build
|
|
307
|
-
RUN go mod tidy && go build -buildmode=c-shared -o /usr/lib/desktop.so .
|
|
308
|
-
|
|
309
|
-
FROM runtime-base AS desktop
|
|
310
|
-
|
|
311
|
-
# Install display stack
|
|
312
|
-
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
313
|
-
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
314
|
-
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
|
315
|
-
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
|
|
316
|
-
apt-get update && apt-get install -y --no-install-recommends \
|
|
317
|
-
xvfb x11vnc novnc websockify \
|
|
318
|
-
xfce4 xfce4-terminal dbus-x11 \
|
|
319
|
-
libx11-6 libxrandr2 libxext6 libxrender1 libxfixes3 \
|
|
320
|
-
libxss1 libxtst6 libxi6 libxinerama1 \
|
|
321
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
322
|
-
|
|
323
|
-
COPY --from=go-builder /usr/lib/desktop.so /usr/lib/desktop.so
|
|
324
|
-
COPY --from=go-builder /usr/lib/desktop.h /usr/lib/desktop.h
|
|
325
|
-
|
|
326
|
-
COPY --from=builder /app/packages/sandbox-container/dist/sandbox /container-server/sandbox
|
|
327
|
-
COPY --from=builder /app/packages/sandbox-container/dist/workers/ /container-server/workers/
|
|
328
|
-
|
|
329
|
-
# Install koffi for FFI worker thread
|
|
330
|
-
WORKDIR /container-server
|
|
331
|
-
RUN npm init -y && npm install koffi
|
|
332
|
-
|
|
333
|
-
EXPOSE 6080
|
|
334
|
-
|
|
335
|
-
ENV DISPLAY=:99
|
|
336
|
-
ENV PYTHON_POOL_MIN_SIZE=0
|
|
337
|
-
ENV JAVASCRIPT_POOL_MIN_SIZE=0
|
|
338
|
-
ENV TYPESCRIPT_POOL_MIN_SIZE=0
|
|
339
|
-
|
|
340
|
-
ENTRYPOINT ["/container-server/sandbox"]
|
|
341
|
-
|
|
342
287
|
# ============================================================================
|
|
343
288
|
# Stage 5d: Musl image - Alpine-based with musl-linked binary
|
|
344
289
|
# ============================================================================
|
package/README.md
CHANGED
|
@@ -200,6 +200,7 @@ See the [examples directory](./examples) for complete working examples:
|
|
|
200
200
|
- [Claude Code](./examples/claude-code) - Run [Claude Code](https://claude.ai/code) headless on any repo
|
|
201
201
|
- [OpenAI Agents](./examples/openai-agents) - `Shell` and `Editor` tools for [OpenAI Agents SDK](https://openai.github.io/openai-agents-js/)
|
|
202
202
|
- [OpenCode](./examples/opencode) - [OpenCode](https://github.com/sst/opencode) web UI or [SDK](https://opencode.ai/docs/sdk/) in a sandbox
|
|
203
|
+
- [Git Repo Per Sandbox](./examples/git-repo-per-sandbox) - One Artifacts Git repo per sandbox
|
|
203
204
|
- [TypeScript Validator](./examples/typescript-validator) - Build with npm in sandbox, execute in [isolates](https://developers.cloudflare.com/workers/runtime-apis/bindings/worker-loader/)
|
|
204
205
|
|
|
205
206
|
## Status
|
package/dist/bridge/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../dist-B_eXrP83.js";
|
|
2
|
-
import "../errors-
|
|
3
|
-
import {
|
|
2
|
+
import "../errors-aRUdk9K8.js";
|
|
3
|
+
import { S as validateTunnelName, r as getSandbox, w as streamFile, x as validatePort, y as SandboxSecurityError } from "../sandbox-DKG3H156.js";
|
|
4
4
|
import { DurableObject, env } from "cloudflare:workers";
|
|
5
5
|
import { Hono } from "hono";
|
|
6
6
|
|
|
@@ -228,6 +228,11 @@ const OPENAPI_SCHEMA = {
|
|
|
228
228
|
$ref: "#/components/schemas/MountBucketCredentials",
|
|
229
229
|
description: "Explicit credentials. When omitted, the SDK auto-detects from Worker secrets (R2_ACCESS_KEY_ID / R2_SECRET_ACCESS_KEY or AWS equivalents)."
|
|
230
230
|
},
|
|
231
|
+
credentialProxy: {
|
|
232
|
+
type: "boolean",
|
|
233
|
+
description: "Keep credentials in the Durable Object and sign intercepted s3fs requests from the Worker. Credentials may be explicit or auto-detected from Worker secrets.",
|
|
234
|
+
default: false
|
|
235
|
+
},
|
|
231
236
|
s3fsOptions: {
|
|
232
237
|
type: "array",
|
|
233
238
|
items: { type: "string" },
|
|
@@ -1800,6 +1805,7 @@ function validateMountOptions(options, binding) {
|
|
|
1800
1805
|
if (options.s3fsOptions !== void 0 && !isStringArray(options.s3fsOptions)) return errorJson("options.s3fsOptions must be an array of strings when provided", "invalid_request", 400);
|
|
1801
1806
|
if (options.readOnly !== void 0 && typeof options.readOnly !== "boolean") return errorJson("options.readOnly must be a boolean when provided", "invalid_request", 400);
|
|
1802
1807
|
if (options.prefix !== void 0 && typeof options.prefix !== "string") return errorJson("options.prefix must be a string when provided", "invalid_request", 400);
|
|
1808
|
+
if ("credentialProxy" in options && options.credentialProxy !== void 0 && typeof options.credentialProxy !== "boolean") return errorJson("options.credentialProxy must be a boolean when provided", "invalid_request", 400);
|
|
1803
1809
|
if ("credentials" in options && options.credentials !== void 0 && (typeof options.credentials !== "object" || options.credentials === null || typeof options.credentials.accessKeyId !== "string" || typeof options.credentials.secretAccessKey !== "string")) return errorJson("options.credentials must include string accessKeyId and secretAccessKey", "invalid_request", 400);
|
|
1804
1810
|
return null;
|
|
1805
1811
|
}
|
|
@@ -1821,6 +1827,7 @@ function toSDKMountOptions(options) {
|
|
|
1821
1827
|
secretAccessKey: options.credentials.secretAccessKey
|
|
1822
1828
|
};
|
|
1823
1829
|
if (options.s3fsOptions !== void 0) remoteOptions.s3fsOptions = options.s3fsOptions;
|
|
1830
|
+
if ("credentialProxy" in options && typeof options.credentialProxy === "boolean") remoteOptions.credentialProxy = options.credentialProxy;
|
|
1824
1831
|
return remoteOptions;
|
|
1825
1832
|
}
|
|
1826
1833
|
const r2BindingOptions = {};
|