|
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 | + |
3 | 17 | ## 0.4.13 |
4 | 18 |
|
5 | 19 | ### Patch Changes |
|
37 | 51 | 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 | 52 |
|
39 | 53 | The implementation is end-to-end: |
40 | | - |
41 | 54 | - New `FileExistsResult` and `FileExistsRequest` types in shared package |
42 | 55 | - Handler endpoint at `/api/exists` in container layer |
43 | 56 | - Client method in `FileClient` and `Sandbox` classes |
|
136 | 149 | 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 | 150 |
|
138 | 151 | **Key security improvements:** |
139 | | - |
140 | 152 | - Control plane processes are hidden from sandboxed commands |
141 | 153 | - Platform secrets in `/proc/1/environ` are inaccessible |
142 | 154 | - Ports 8888 (Jupyter) and 3000 (Bun) are protected from hijacking |
143 | 155 |
|
144 | 156 | **Breaking changes:** |
145 | | - |
146 | 157 | 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 | 158 |
|
148 | 159 | ```javascript |
149 | 160 | // Before: manual session management |
150 | | - await sandbox.exec("cd /app", { sessionId: "my-session" }); |
| 161 | + await sandbox.exec('cd /app', { sessionId: 'my-session' }); |
151 | 162 |
|
152 | 163 | // After: automatic session per sandbox |
153 | | - await sandbox.exec("cd /app"); |
| 164 | + await sandbox.exec('cd /app'); |
154 | 165 | ``` |
155 | 166 |
|
156 | 167 | 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 | 168 |
|
158 | 169 | ```javascript |
159 | 170 | // Before: each exec was independent |
160 | | - await sandbox.exec("cd /app"); |
161 | | - await sandbox.exec("pwd"); // Output: /workspace |
| 171 | + await sandbox.exec('cd /app'); |
| 172 | + await sandbox.exec('pwd'); // Output: /workspace |
162 | 173 |
|
163 | 174 | // After: state persists in session |
164 | | - await sandbox.exec("cd /app"); |
165 | | - await sandbox.exec("pwd"); // Output: /app |
| 175 | + await sandbox.exec('cd /app'); |
| 176 | + await sandbox.exec('pwd'); // Output: /app |
166 | 177 | ``` |
167 | 178 |
|
168 | 179 | **Migration guide:** |
169 | | - |
170 | 180 | - Remove `sessionId` from all method calls - each sandbox maintains its own session |
171 | 181 | - If you need isolated execution contexts within the same sandbox, use `sandbox.createSession()`: |
172 | 182 | ```javascript |
173 | 183 | // Create independent sessions with different environments |
174 | 184 | const buildSession = await sandbox.createSession({ |
175 | | - name: "build", |
176 | | - env: { NODE_ENV: "production" }, |
177 | | - cwd: "/build", |
| 185 | + name: 'build', |
| 186 | + env: { NODE_ENV: 'production' }, |
| 187 | + cwd: '/build' |
178 | 188 | }); |
179 | 189 | const testSession = await sandbox.createSession({ |
180 | | - name: "test", |
181 | | - env: { NODE_ENV: "test" }, |
182 | | - cwd: "/test", |
| 190 | + name: 'test', |
| 191 | + env: { NODE_ENV: 'test' }, |
| 192 | + cwd: '/test' |
183 | 193 | }); |
184 | 194 | ``` |
185 | 195 | - Environment variables set in one command persist to the next |
|
0 commit comments