@cloudflare/sandbox 0.4.14 → 0.4.16
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 +7 -7
- package/CHANGELOG.md +20 -0
- package/Dockerfile +70 -29
- package/README.md +9 -1
- package/dist/index.d.ts +386 -322
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +136 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/clients/git-client.ts +7 -0
- package/src/clients/index.ts +4 -0
- package/src/clients/utility-client.ts +33 -0
- package/src/index.ts +6 -2
- package/src/sandbox.ts +37 -4
- package/src/version.ts +1 -1
- package/tests/git-client.test.ts +72 -0
- package/tests/sandbox.test.ts +33 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @cloudflare/sandbox@0.4.
|
|
2
|
+
> @cloudflare/sandbox@0.4.16 build
|
|
3
3
|
> rm -rf dist && tsdown --config tsdown.config.ts
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.15.11[22m powered by rolldown [2mv1.0.0-beta.45[22m
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [
|
|
11
|
-
[34mℹ[39m [2mdist/[22mindex.js.map [
|
|
12
|
-
[34mℹ[39m [2mdist/[22mindex.d.ts.map [2m
|
|
13
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m
|
|
14
|
-
[34mℹ[39m 4 files, total:
|
|
15
|
-
[32m✔[39m Build complete in [
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m100.14 kB[22m [2m│ gzip: 22.78 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22mindex.js.map [2m211.33 kB[22m [2m│ gzip: 46.59 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22mindex.d.ts.map [2m 73.81 kB[22m [2m│ gzip: 20.47 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m 56.43 kB[22m [2m│ gzip: 12.24 kB[22m
|
|
14
|
+
[34mℹ[39m 4 files, total: 441.72 kB
|
|
15
|
+
[32m✔[39m Build complete in [32m2083ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @cloudflare/sandbox
|
|
2
2
|
|
|
3
|
+
## 0.4.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#184](https://github.com/cloudflare/sandbox-sdk/pull/184) [`7989b61`](https://github.com/cloudflare/sandbox-sdk/commit/7989b6105cea8c381dd162be0bcb29db3e214fde) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Redact credentials from Git URLs in logs
|
|
8
|
+
|
|
9
|
+
- [#186](https://github.com/cloudflare/sandbox-sdk/pull/186) [`c2e3384`](https://github.com/cloudflare/sandbox-sdk/commit/c2e3384b151ae3f430c2edc8c492921d0b6b8b1c) Thanks [@whoiskatrin](https://github.com/whoiskatrin)! - Expose deleteSession API with proper safeguards
|
|
10
|
+
- Add `deleteSession(sessionId)` method to public SDK API
|
|
11
|
+
- Prevent deletion of default session (throws error with guidance to use `sandbox.destroy()`)
|
|
12
|
+
- Session cleanup kills all running commands in parallel before destroying shell
|
|
13
|
+
- Return structured `SessionDeleteResult` with success status, sessionId, and timestamp
|
|
14
|
+
|
|
15
|
+
## 0.4.15
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#185](https://github.com/cloudflare/sandbox-sdk/pull/185) [`7897cdd`](https://github.com/cloudflare/sandbox-sdk/commit/7897cddefc366bbd640ea138b34a520a0b2ddf8c) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Fix foreground commands blocking on background processes
|
|
20
|
+
|
|
21
|
+
- [#183](https://github.com/cloudflare/sandbox-sdk/pull/183) [`ff2fa91`](https://github.com/cloudflare/sandbox-sdk/commit/ff2fa91479357ef88cfb22418f88acb257462faa) Thanks [@whoiskatrin](https://github.com/whoiskatrin)! - update python to 3.11.14
|
|
22
|
+
|
|
3
23
|
## 0.4.14
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/Dockerfile
CHANGED
|
@@ -31,7 +31,7 @@ COPY --from=pruner /app/out/package-lock.json ./package-lock.json
|
|
|
31
31
|
|
|
32
32
|
# Install ALL dependencies with cache mount for npm packages
|
|
33
33
|
RUN --mount=type=cache,target=/root/.npm \
|
|
34
|
-
npm ci
|
|
34
|
+
CI=true npm ci
|
|
35
35
|
|
|
36
36
|
# Copy pruned source code
|
|
37
37
|
COPY --from=pruner /app/out/full/ .
|
|
@@ -55,10 +55,52 @@ COPY --from=builder /app/tooling ./tooling
|
|
|
55
55
|
|
|
56
56
|
# Install ONLY production dependencies (excludes typescript, @types/*, etc.)
|
|
57
57
|
RUN --mount=type=cache,target=/root/.npm \
|
|
58
|
-
npm ci --production
|
|
58
|
+
CI=true npm ci --production
|
|
59
59
|
|
|
60
60
|
# ============================================================================
|
|
61
|
-
# Stage 4:
|
|
61
|
+
# Stage 4: Download pre-built Python 3.11.14
|
|
62
|
+
# ============================================================================
|
|
63
|
+
FROM ubuntu:22.04 AS python-builder
|
|
64
|
+
|
|
65
|
+
# Prevent interactive prompts during package installation
|
|
66
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
67
|
+
|
|
68
|
+
# Accept architecture from Docker BuildKit (for multi-arch builds)
|
|
69
|
+
ARG TARGETARCH
|
|
70
|
+
|
|
71
|
+
# Install minimal dependencies for downloading
|
|
72
|
+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
73
|
+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
74
|
+
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
|
75
|
+
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
|
|
76
|
+
apt-get update && apt-get install -y --no-install-recommends \
|
|
77
|
+
wget ca-certificates
|
|
78
|
+
|
|
79
|
+
# Download and extract pre-built Python 3.11.14 from python-build-standalone
|
|
80
|
+
# Using PGO+LTO optimized builds for better performance
|
|
81
|
+
# Supports multi-arch: amd64 (x86_64) and arm64 (aarch64)
|
|
82
|
+
RUN --mount=type=cache,target=/tmp/python-cache \
|
|
83
|
+
# Map Docker TARGETARCH to python-build-standalone arch naming
|
|
84
|
+
if [ "$TARGETARCH" = "amd64" ]; then \
|
|
85
|
+
PYTHON_ARCH="x86_64-unknown-linux-gnu"; \
|
|
86
|
+
EXPECTED_SHA256="edd8d11aa538953d12822fab418359a692fd1ee4ca2675579fbf0fa31e3688f1"; \
|
|
87
|
+
elif [ "$TARGETARCH" = "arm64" ]; then \
|
|
88
|
+
PYTHON_ARCH="aarch64-unknown-linux-gnu"; \
|
|
89
|
+
EXPECTED_SHA256="08141d31f95d86a23f23e4c741b726de0055f12f83200d1d4867b4e8e6e967c5"; \
|
|
90
|
+
else \
|
|
91
|
+
echo "Unsupported architecture: $TARGETARCH" && exit 1; \
|
|
92
|
+
fi && \
|
|
93
|
+
cd /tmp/python-cache && \
|
|
94
|
+
wget -nc https://github.com/indygreg/python-build-standalone/releases/download/20251028/cpython-3.11.14+20251028-${PYTHON_ARCH}-install_only.tar.gz && \
|
|
95
|
+
# Verify SHA256 checksum for security
|
|
96
|
+
echo "${EXPECTED_SHA256} cpython-3.11.14+20251028-${PYTHON_ARCH}-install_only.tar.gz" | sha256sum -c - && \
|
|
97
|
+
cd /tmp && \
|
|
98
|
+
tar -xzf /tmp/python-cache/cpython-3.11.14+20251028-${PYTHON_ARCH}-install_only.tar.gz && \
|
|
99
|
+
mv python /usr/local/ && \
|
|
100
|
+
rm -rf /tmp/cpython-*
|
|
101
|
+
|
|
102
|
+
# ============================================================================
|
|
103
|
+
# Stage 5: Runtime - Ubuntu 22.04 with only runtime dependencies
|
|
62
104
|
# ============================================================================
|
|
63
105
|
FROM ubuntu:22.04 AS runtime
|
|
64
106
|
|
|
@@ -71,44 +113,43 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|
|
71
113
|
# Set the sandbox version as an environment variable for version checking
|
|
72
114
|
ENV SANDBOX_VERSION=${SANDBOX_VERSION}
|
|
73
115
|
|
|
74
|
-
# Install
|
|
116
|
+
# Install runtime packages and Python runtime libraries
|
|
75
117
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
76
118
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
77
119
|
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
|
78
120
|
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache && \
|
|
79
121
|
apt-get update && apt-get install -y --no-install-recommends \
|
|
80
|
-
curl \
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
122
|
+
ca-certificates curl wget procps git unzip zip jq file \
|
|
123
|
+
libssl3 zlib1g libbz2-1.0 libreadline8 libsqlite3-0 \
|
|
124
|
+
libncursesw6 libtinfo6 libxml2 libxmlsec1 libffi8 liblzma5 libtk8.6 && \
|
|
125
|
+
update-ca-certificates
|
|
126
|
+
|
|
127
|
+
# Copy pre-built Python from python-builder stage
|
|
128
|
+
COPY --from=python-builder /usr/local/python /usr/local/python
|
|
129
|
+
|
|
130
|
+
# Create symlinks and update shared library cache
|
|
131
|
+
RUN ln -s /usr/local/python/bin/python3.11 /usr/local/bin/python3.11 && \
|
|
132
|
+
ln -s /usr/local/python/bin/python3 /usr/local/bin/python3 && \
|
|
133
|
+
ln -s /usr/local/python/bin/pip3 /usr/local/bin/pip3 && \
|
|
134
|
+
echo "/usr/local/python/lib" > /etc/ld.so.conf.d/python.conf && \
|
|
135
|
+
ldconfig
|
|
92
136
|
|
|
93
137
|
# Set Python 3.11 as default python3
|
|
94
|
-
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
|
|
138
|
+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.11 1
|
|
95
139
|
|
|
96
|
-
# Install
|
|
97
|
-
RUN
|
|
98
|
-
|
|
99
|
-
|
|
140
|
+
# Install Python packages
|
|
141
|
+
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
142
|
+
pip3 install --no-cache-dir matplotlib numpy pandas ipython
|
|
143
|
+
|
|
144
|
+
# Install Node.js 20 LTS from official Node image
|
|
145
|
+
COPY --from=node:20-slim /usr/local/bin/node /usr/local/bin/node
|
|
146
|
+
COPY --from=node:20-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
|
|
147
|
+
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
|
|
148
|
+
ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
|
|
100
149
|
|
|
101
150
|
# Install Bun runtime from official image
|
|
102
151
|
COPY --from=oven/bun:1 /usr/local/bin/bun /usr/local/bin/bun
|
|
103
152
|
|
|
104
|
-
# Install essential Python packages with cache mount
|
|
105
|
-
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
106
|
-
pip3 install \
|
|
107
|
-
matplotlib \
|
|
108
|
-
numpy \
|
|
109
|
-
pandas \
|
|
110
|
-
ipython
|
|
111
|
-
|
|
112
153
|
# Set up runtime container server directory
|
|
113
154
|
WORKDIR /container-server
|
|
114
155
|
|
package/README.md
CHANGED
|
@@ -116,9 +116,17 @@ export default {
|
|
|
116
116
|
- **Preview URLs** - Expose services with public URLs
|
|
117
117
|
- **Git Integration** - Clone repositories directly
|
|
118
118
|
|
|
119
|
+
## Contributing
|
|
120
|
+
|
|
121
|
+
We welcome contributions from the community! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on:
|
|
122
|
+
|
|
123
|
+
- Setting up your development environment
|
|
124
|
+
- Creating pull requests
|
|
125
|
+
- Code style and testing requirements
|
|
126
|
+
|
|
119
127
|
## Development
|
|
120
128
|
|
|
121
|
-
This repository contains the SDK source code.
|
|
129
|
+
This repository contains the SDK source code. Quick start:
|
|
122
130
|
|
|
123
131
|
```bash
|
|
124
132
|
# Clone the repo
|