|
1 | 1 | # @cloudflare/sandbox |
2 | 2 |
|
| 3 | +## 0.4.14 |
| 4 | + |
| 5 | +### Patch Changes |
| 6 | + |
| 7 | +- [#172](https://github.com/cloudflare/sandbox-sdk/pull/172) [`1bf3576`](https://github.com/cloudflare/sandbox-sdk/commit/1bf35768b02532c77df6f30a2f2eb08cb2b12115) Thanks [@threepointone](https://github.com/threepointone)! - Update dependencies |
| 8 | + |
| 9 | +- [#176](https://github.com/cloudflare/sandbox-sdk/pull/176) [`7edbfa9`](https://github.com/cloudflare/sandbox-sdk/commit/7edbfa906668d75f540527f50b52483dc787192c) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Add cache mounts to Dockerfile for faster builds |
| 10 | + |
| 11 | + Adds cache mounts for npm, apt, and pip package managers in the Dockerfile. This speeds up Docker image builds when dependencies change, particularly beneficial for users building from source. |
| 12 | + |
| 13 | +- [#172](https://github.com/cloudflare/sandbox-sdk/pull/172) [`1bf3576`](https://github.com/cloudflare/sandbox-sdk/commit/1bf35768b02532c77df6f30a2f2eb08cb2b12115) Thanks [@threepointone](https://github.com/threepointone)! - Fix type generation |
| 14 | + |
| 15 | + We inline types from `@repo/shared` so that it includes the types we reexport. Fixes #165 |
| 16 | + |
| 17 | +- [#175](https://github.com/cloudflare/sandbox-sdk/pull/175) [`77cb937`](https://github.com/cloudflare/sandbox-sdk/commit/77cb93762a619523758f769a10509e665ca819fe) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Move .connect to .wsConnect within DO stub |
| 18 | + |
3 | 19 | ## 0.4.13 |
4 | 20 |
|
5 | 21 | ### Patch Changes |
|
37 | 53 | This adds a new `exists()` method to the SDK that checks whether a file or directory exists at a given path. The method returns a boolean indicating existence, similar to Python's `os.path.exists()` and JavaScript's `fs.existsSync()`. |
38 | 54 |
|
39 | 55 | The implementation is end-to-end: |
40 | | - |
41 | 56 | - New `FileExistsResult` and `FileExistsRequest` types in shared package |
42 | 57 | - Handler endpoint at `/api/exists` in container layer |
43 | 58 | - Client method in `FileClient` and `Sandbox` classes |
|
136 | 151 | Implements PID namespace isolation to protect control plane processes (Jupyter, Bun) from sandboxed code. Commands executed via `exec()` now run in isolated namespaces that cannot see or interact with system processes. |
137 | 152 |
|
138 | 153 | **Key security improvements:** |
139 | | - |
140 | 154 | - Control plane processes are hidden from sandboxed commands |
141 | 155 | - Platform secrets in `/proc/1/environ` are inaccessible |
142 | 156 | - Ports 8888 (Jupyter) and 3000 (Bun) are protected from hijacking |
143 | 157 |
|
144 | 158 | **Breaking changes:** |
145 | | - |
146 | 159 | 1. **Removed `sessionId` parameter**: The `sessionId` parameter has been removed from all methods (`exec()`, `execStream()`, `startProcess()`, etc.). Each sandbox now maintains its own persistent session automatically. |
147 | 160 |
|
148 | 161 | ```javascript |
149 | 162 | // Before: manual session management |
150 | | - await sandbox.exec("cd /app", { sessionId: "my-session" }); |
| 163 | + await sandbox.exec('cd /app', { sessionId: 'my-session' }); |
151 | 164 |
|
152 | 165 | // After: automatic session per sandbox |
153 | | - await sandbox.exec("cd /app"); |
| 166 | + await sandbox.exec('cd /app'); |
154 | 167 | ``` |
155 | 168 |
|
156 | 169 | 2. **Commands now maintain state**: Commands within the same sandbox now share state (working directory, environment variables, background processes). Previously each command was stateless. |
157 | 170 |
|
158 | 171 | ```javascript |
159 | 172 | // Before: each exec was independent |
160 | | - await sandbox.exec("cd /app"); |
161 | | - await sandbox.exec("pwd"); // Output: /workspace |
| 173 | + await sandbox.exec('cd /app'); |
| 174 | + await sandbox.exec('pwd'); // Output: /workspace |
162 | 175 |
|
163 | 176 | // After: state persists in session |
164 | | - await sandbox.exec("cd /app"); |
165 | | - await sandbox.exec("pwd"); // Output: /app |
| 177 | + await sandbox.exec('cd /app'); |
| 178 | + await sandbox.exec('pwd'); // Output: /app |
166 | 179 | ``` |
167 | 180 |
|
168 | 181 | **Migration guide:** |
169 | | - |
170 | 182 | - Remove `sessionId` from all method calls - each sandbox maintains its own session |
171 | 183 | - If you need isolated execution contexts within the same sandbox, use `sandbox.createSession()`: |
172 | 184 | ```javascript |
173 | 185 | // Create independent sessions with different environments |
174 | 186 | const buildSession = await sandbox.createSession({ |
175 | | - name: "build", |
176 | | - env: { NODE_ENV: "production" }, |
177 | | - cwd: "/build", |
| 187 | + name: 'build', |
| 188 | + env: { NODE_ENV: 'production' }, |
| 189 | + cwd: '/build' |
178 | 190 | }); |
179 | 191 | const testSession = await sandbox.createSession({ |
180 | | - name: "test", |
181 | | - env: { NODE_ENV: "test" }, |
182 | | - cwd: "/test", |
| 192 | + name: 'test', |
| 193 | + env: { NODE_ENV: 'test' }, |
| 194 | + cwd: '/test' |
183 | 195 | }); |
184 | 196 | ``` |
185 | 197 | - Environment variables set in one command persist to the next |
|
0 commit comments