Commit Graph

883 Commits

Author SHA1 Message Date
Mish Ushakov 2c995d4494 refactor(sdk): make octet-stream file upload opt-in via useOctetStream (#1296)
## Summary

- Adds an opt-in `useOctetStream` / `use_octet_stream` flag to sandbox
file write — JS on `FilesystemWriteOpts`, Python keyword on `write` /
`write_files` (async + sync).
- Changes the default upload path to `multipart/form-data` regardless of
envd version. Callers must opt in to `application/octet-stream`
(requires envd 0.5.7 or later).

## Example

JS:

```ts
// Default — multipart/form-data
await sandbox.files.write('hello.txt', 'world')

// Opt in to application/octet-stream (envd >= 0.5.7)
await sandbox.files.writeFiles(
  [{ path: 'a.txt', data: 'a' }, { path: 'b.txt', data: 'b' }],
  { useOctetStream: true },
)
```

Python:

```python
# Default — multipart/form-data
sandbox.files.write('hello.txt', 'world')

# Opt in to application/octet-stream (envd >= 0.5.7)
await sandbox.files.write_files(
    [{'path': 'a.txt', 'data': 'a'}, {'path': 'b.txt', 'data': 'b'}],
    use_octet_stream=True,
)
```

## Test plan

- [ ] JS: `pnpm --filter e2b run lint && pnpm --filter e2b run
typecheck`
- [ ] Python: `cd packages/python-sdk && poetry run make lint && poetry
run make typecheck`
- [ ] Manual write with and without `useOctetStream` /
`use_octet_stream` against envd 0.5.7+.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-27 21:16:33 +00:00
github-actions[bot] 557b723cc1 [skip ci] Release new versions 2026-04-24 18:35:47 +00:00
Mish Ushakov 3167e19b4f fix(sdk): buffer template upload to set Content-Length, add regression tests (#1294)
## Summary
Consolidates the fix and tests from #1285 and #1293 into a single PR.

- **js-sdk**: `uploadFile` used to pass a Node `Readable` directly to
`fetch`, causing undici to fall back to `Transfer-Encoding: chunked`. S3
presigned PUT URLs reject chunked with 501 NotImplemented. Fix buffers
the archive first so `Content-Length` is set. Includes:
- Regression test that spins up a local HTTP server and asserts
`Content-Length` is set and matches the body, and `Transfer-Encoding` is
not chunked.
- Type-fix for the CLI's typecheck (cast `Pack` →
`AsyncIterable<Buffer>`).
- Dynamic import of `node:stream/consumers` so the browser bundle
doesn't pull it in.
- **python-sdk**: Adds sync + async regression tests for `upload_file`
that guard against the same class of bug (someone swapping
`tar_buffer.getvalue()` for a stream/generator). No Python code change —
the current implementation already passes bytes to `httpx.put(...,
content=...)`.

Authorship of the original JS fix commit preserved (truffle-dev).

Closes #1243.

## Test plan
- [x] `pnpm run test tests/template/uploadFile.test.ts` — passes
- [x] `pnpm run typecheck` / `lint` clean across js-sdk and cli
- [x] `poetry run pytest tests/sync/template_sync/test_upload_file.py
tests/async/template_async/test_upload_file.py -v` — both pass
- [x] `poetry run make format` / `make lint` / `make typecheck` clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: truffle <truffleagent@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-24 07:14:54 -07:00
Mish Ushakov b97fd4dfd0 test: remove apt, bun, npm, pip install tests (#1275)
## Summary
- Deletes install test files for apt, bun, npm, and pip in both JS and
Python SDKs
- Removes sync and async variants in Python
- Stacktrace tests for these install methods are kept

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 06:27:23 -07:00
Mish Ushakov c2d6eef78d test: reduce test_sbx_metrics flakiness by extending polling window (#1291)
## Summary
- Bumps metrics polling from 15s to 30s in Python async/sync and JS SDK
tests so the backend has enough headroom to populate metrics under load
— this test was the new #1 CI offender (5/9 Python runs and 4/10 JS runs
failed).
- Raises the async Python sandbox timeout from 20s to 60s for parity
with sync, and adds per-test timeout overrides
(`@pytest.mark.timeout(60)` / `{ timeout: 60_000 }`) so polling can
complete under the default 30s pytest/vitest cap.
- Happy path is unchanged: the loop still breaks as soon as metrics
appear.

## Test plan
- [x] `pnpm run format`, `pnpm run lint`, `pnpm run typecheck` pass
- [x] `test_sbx_metrics` (Python async) passed locally in 8.4s
- [x] `test_sbx_metrics` (Python sync) passed locally in 15.6s
- [x] `metrics.test.ts` (JS) passed locally in 20.7s

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-24 06:03:49 -07:00
Kagura 2f0ff5f0f7 fix(sdk): prevent shell injection in MCP config via proper escaping (#1276)
## Summary

Fixes #1154

When creating a sandbox with an `mcp` config, the JSON-serialized config
is interpolated directly into a shell command wrapped in single quotes.
Since `json.dumps()` / `JSON.stringify()` do not escape single quotes,
any MCP config value containing a single quote (e.g., API keys, tokens,
URLs) breaks out of shell quoting and allows arbitrary command execution
inside the sandbox.

## Changes

### Python SDK (`sandbox_async/main.py`, `sandbox_sync/main.py`)
- Use `shlex.quote()` to properly escape the JSON config string (4
locations)
- `shlex.quote()` is a stdlib function designed exactly for this purpose

### JS/TS SDK (`sandbox/index.ts`)
- Add a `shellQuote()` helper that escapes single quotes using the
standard `'\'''` pattern (equivalent to Python's `shlex.quote()`)
- Apply it to both MCP config interpolation sites (2 locations)

## Before / After

**Before** (vulnerable):
```
mcp-gateway --config '{"servers": {"test": {"envs": {"KEY": "it's a value"}}}}'
#                                                            ^^ breaks out
```

**After** (safe):
```
mcp-gateway --config '{"servers": {"test": {"envs": {"KEY": "it'\''s a value"}}}}'
#                                                            ^^^^ properly escaped
```

## Testing

Verified escaping behavior for both Python (`shlex.quote`) and JS
(`shellQuote`) with the PoC from the issue — single quotes in config
values are properly escaped and no longer allow shell breakout.

---------

Co-authored-by: Mish Ushakov <10400064+mishushakov@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 07:30:14 -07:00
luo jiyin 7695889b7a Fix typos in docs, tests, and helper names (#1282)
## Summary

- fix typos in hand-written docs and comments
- rename typoed helper variables in the CLI
- fix typoed test identifiers and descriptions in the JS SDK tests
- fix typoed credential warning text in the Python SDK

## Testing

- not run

Closes #1281
2026-04-21 06:00:02 -07:00
Berry f667f335c6 fix: correct write_files docstring about directory auto-creation (#1260)
## Summary
- Fixes the Python SDK `write_files` docstring (both sync and async)
which incorrectly stated that writing to a non-existing directory would
produce an error
- The backend actually auto-creates parent directories, consistent with
the `write()` docstring and existing tests
(`test_write_to_non_existing_directory`)

## Test plan
- [x] Verified behavior with a test script — both `write()` and
`write_files()` auto-create nested directories
- [x] Existing tests pass (`test_write_to_non_existing_directory`,
`writeFiles creates parent directories`)
2026-04-12 15:51:41 +02:00
Mish Ushakov b5f2631141 feat: add gzip content encoding option for file operations (#1252)
## Summary

- Adds optional `gzip` parameter to sandbox file read/write operations
across JS and Python SDKs
- Uploads are gzip-compressed via `CompressionStream` (JS) /
`gzip.compress` (Python) when enabled, downloads request
`Accept-Encoding: gzip`
- Only applies to the octet-stream upload path (envd >= 0.5.7), so older
envd versions are unaffected
- Includes tests for both SDKs covering write+read with gzip, write gzip
+ read plain, multi-file writes, and byte format reads

## Test plan

- [ ] Run JS SDK content encoding tests (`contentEncoding.test.ts`)
- [ ] Run Python async/sync content encoding tests
(`test_content_encoding.py`)
- [ ] Integration test with envd backend supporting `Content-Encoding:
gzip`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 10:17:53 +00:00
github-actions[bot] 58ecd78053 [skip ci] Release new versions 2026-04-02 19:20:43 +00:00
Mish Ushakov cf35f61b44 feat: use application/octet-stream for sandbox file uploads (#1242)
## Summary
- Switches sandbox filesystem file uploads from `multipart/form-data` to
`application/octet-stream` in both the JS and Python SDKs
- Each file is now uploaded as raw binary with the path passed as a
query parameter, matching the `application/octet-stream` content type in
the envd API spec
- Multi-file writes send one request per file sequentially

## Test plan
- [ ] Run JS SDK filesystem write tests (`pnpm run test` in
`packages/js-sdk`)
- [ ] Run Python SDK filesystem write tests (`pytest` in
`packages/python-sdk`)
- [ ] Verify single file write, multi-file write, and various data types
(string, bytes, streams)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 13:45:22 +02:00
Mish Ushakov ef46004327 feat: increase volume file upload timeout to 1 hour (#1248)
Increases the default timeout for volume `writeFile`/`write_file`
operations from 60 seconds to 1 hour in both the JS and Python SDKs.
Other volume operations retain the existing 60s default. Users can still
override via `requestTimeoutMs` (JS) or `request_timeout` (Python).

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 10:31:08 -07:00
Berry 1cc385a767 Link runCode/run_code to docs in READMEs (#1237)
## Summary
- Made `runCode()` and `run_code()` references in READMEs link to the
[code interpreting docs](https://e2b.dev/docs/code-interpreting)
- Updated root README, js-sdk README, and python-sdk README

## Test plan
- [ ] Verify links render correctly on GitHub
- [ ] Confirm docs URL resolves
2026-03-29 15:48:28 +02:00
github-actions[bot] c02d11eb58 [skip ci] Release new versions 2026-03-26 01:32:46 +00:00
Mish Ushakov 6d7e72e3bd feat: add Volume CRUD operations to SDKs (#1126)
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Joe Lombrozo <joe.lombrozo@e2b.dev>
2026-03-25 17:37:46 -07:00
github-actions[bot] 4bee8c54d4 [skip ci] Release new versions 2026-03-25 19:27:39 +00:00
Berry a240f99db5 Default to base e2b SDK in READMEs (#1232)
## Summary
- Updated root README, js-sdk README, and python-sdk README to show base
`e2b` SDK install and usage as the default
- Code-interpreter is now shown as an optional step for when
`runCode()`/`run_code()` is actually needed
- SDK links in descriptions now point to base `e2b` packages on npm/PyPI

## Why
The base `e2b` package covers commands, files, git, networking, and
sandbox lifecycle. Users who don't need code execution shouldn't be
directed to install `@e2b/code-interpreter` / `e2b-code-interpreter` as
their first step.

## Test plan
- [ ] Verify README renders correctly on GitHub
- [ ] Confirm base SDK examples use correct import syntax
- [ ] Confirm code-interpreter section still shows correct usage for
`runCode()`
2026-03-24 21:04:20 +01:00
github-actions[bot] 9710e56bd5 [skip ci] Release new versions 2026-03-23 22:29:10 +00:00
Matt Brockman 7c8d29839a feat (api): Sandbox info lifecycle network (#1213)
extracts the `allow_internet_access`, `lifecycle`, and `network` configs
to the get info responses from the api when present.

Create a sandbox with lifecycle and network rules, check info while
running, pause it, and check info again. Network rules, lifecycle
config, and `allowInternetAccess` all returned while running and paused

```
$ e2b sandbox info xxx --format json

# running
{
  "sandboxId": "xxx",
  "templateId": "xxx",
  "name": "stdin",
  "metadata": {},
  "allowInternetAccess": true,
  "envdVersion": "0.4.3",
  "startedAt": "2026-03-19T01:39:56.238Z",
  "endAt": "2026-03-19T01:44:56.238Z",
  "state": "running",
  "cpuCount": 2,
  "memoryMB": 1024,
  "network": {
    "allowOut": ["api.example.com", "cdn.example.com"],
    "denyOut": ["0.0.0.0/0"],
    "allowPublicTraffic": true
  },
  "lifecycle": {
    "onTimeout": "pause",
    "autoResume": true
  }
}

# paused
{
  "sandboxId": "xxx",
  "templateId": "xxx",
  "metadata": {},
  "allowInternetAccess": true,
  "envdVersion": "0.4.3",
  "startedAt": "2026-03-19T01:39:56.238Z",
  "endAt": "2026-03-19T01:40:27.964Z",
  "state": "paused",
  "cpuCount": 2,
  "memoryMB": 1024,
  "network": {
    "allowOut": ["api.example.com", "cdn.example.com"],
    "denyOut": ["0.0.0.0/0"],
    "allowPublicTraffic": true
  },
  "lifecycle": {
    "onTimeout": "pause",
    "autoResume": true
  }
}
```



<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Updates the public `sandbox info` response shape across OpenAPI, JS,
and Python SDKs, which may impact downstream consumers that assume the
previous schema. Risk is moderate since changes are additive/optional
but touch generated models and response mapping logic.
> 
> **Overview**
> **Sandbox info responses now include network and lifecycle
configuration when present.** The OpenAPI spec and generated JS schema
extend `SandboxDetail` with `allowInternetAccess`, `network`, and a new
`lifecycle` object (with `SandboxOnTimeout` and `SandboxLifecycle`).
> 
> The JS SDK updates `SandboxApi.getFullInfo()` and exported types to
return these fields, introducing `SandboxInfoLifecycle` for info
responses. The Python SDK updates generated client models accordingly,
adds `SandboxLifecycle`/`SandboxOnTimeout` models, and maps
`SandboxDetail.network`/`SandboxDetail.lifecycle` into `SandboxInfo`
(plus exports `SandboxInfoLifecycle`).
> 
> A changeset bumps `@e2b/python-sdk` and `e2b` as minor for the
expanded info payload.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
adb22292c08b1db9c8fe60c702f83fee2695af97. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-03-23 14:48:02 -07:00
Ben Fornefeld 1c55083de0 Fix: Missing default connection config propagation (#1179)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Medium Risk**
> Changes how instance methods merge and forward connection options (api
key/domain/headers/timeouts) to API calls in both JS and Python SDKs,
which can affect request routing and auth headers. Regression tests
reduce risk but behavior changes could impact callers relying on
previous (incorrect) defaults.
> 
> **Overview**
> Fixes **missing propagation of instance `connectionConfig`** when
calling sandbox instance methods (notably `pause`/`betaPause`/`connect`,
plus related methods) so default config is always forwarded and per-call
overrides still win.
> 
> In the JS SDK this centralizes option merging via a new
`resolveApiOpts()` helper and updates multiple `SandboxApi.*` calls to
use it; in the Python SDK it updates `Sandbox.connect()` and
`Sandbox.pause()` (sync + async) to pass
`self.connection_config.get_api_params(**opts)`.
> 
> Adds regression tests in both SDKs to assert defaults are forwarded
and overrides are applied correctly.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
60aa6ca1c386d99613976269106298267d5dbfbe. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-03-23 18:27:29 +01:00
github-actions[bot] fd7fb51474 [skip ci] Release new versions 2026-03-23 16:11:58 +00:00
Jakub Novák 5a673d15c8 chore: distinguish between Sandbox and file not found (#1231)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Medium Risk**
> Changes public error/exception types in both JS and Python SDKs by
introducing new subclasses and remapping 404/NotFound conditions, which
may affect downstream error handling despite deprecation shims.
> 
> **Overview**
> **Distinguishes “sandbox not found” from “file/directory not found”
across the SDKs.** Adds `FileNotFound*` and `SandboxNotFound*`
error/exception types (with `NotFound*` marked deprecated) and updates
sandbox lifecycle APIs to throw `SandboxNotFound*` for
missing/non-running sandboxes.
> 
> Refactors envd HTTP/RPC error handling in both JS and Python to
support overridable status/code→error maps, and wires filesystem
operations to map 404/`NotFound` into `FileNotFound*`. Tests are updated
accordingly, and patch changesets are added for both packages.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
73da92694c02f71355b1f8625845c82865bf3b1d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-03-23 08:59:29 -07:00
Mish Ushakov ca856201f5 feat(templates): add fixMissing option to aptInstall (#1205)
## Summary
- Added `fixMissing` option to `aptInstall()` in JS SDK
- Added `fix_missing` parameter to `apt_install()` in Python SDK
- Enables `--fix-missing` flag for `apt-get install` command

🤖 Generated with Claude Code

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: adds an optional flag passthrough to the generated `apt-get
install` command in both SDKs, with no behavior change unless explicitly
enabled.
> 
> **Overview**
> Adds an optional `fixMissing` (JS) / `fix_missing` (Python) parameter
to template `apt` install helpers so callers can emit `apt-get install
--fix-missing` when builds hit transient package download issues.
> 
> Updates the JS type definitions/docs accordingly and includes a
changeset bumping `e2b` and `@e2b/python-sdk` as a minor release.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4c0b897e192c3ec6b880ab4e3f1695f1b1289d7b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-18 14:21:01 +00:00
github-actions[bot] a206ddb6f8 [skip ci] Release new versions 2026-03-18 08:05:53 +00:00
Tomas Valenta 710fae6fa1 Limit hanging stream timeout (#1197)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Medium Risk**
> Changes request timeout semantics for server-stream calls by adding
`write` and conditional `read` timeouts, which could alter behavior for
long-running/slow streams but is limited to client-side networking
configuration.
> 
> **Overview**
> **Improves timeout handling for server-stream requests in the Python
SDK.** `Client._prepare_server_stream_request` now builds a richer
`httpcore` timeout extension: `request_timeout` applies to `connect`,
`pool`, and `write`, and the separate `timeout` parameter is mapped to a
`read` timeout (to help prevent hanging streams).
> 
> Adds a changeset to publish a patch release documenting the updated
`request_timeout` behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e66ef8e5056cfdb81892222881519e5e63f9e514. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Matt Brockman <matt.brockman@e2b.dev>
2026-03-18 05:25:12 +00:00
Ben Fornefeld 089b8b9805 Remove: SDK Reference artifacts and apps/web (#1199)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Medium Risk**
> Medium risk because it deletes a large subtree (`apps/web`) and
removes SDK-reference generation/commit steps from the package publish
workflow, which may affect downstream docs/release expectations.
> 
> **Overview**
> **Removes the docs web app and generated SDK reference content.** The
PR deletes `apps/web` configs/scripts (Next.js/MDX setup, Sentry config,
prebuild/sitemap generation) and removes the committed `sdk-reference`
MDX pages.
> 
> **Simplifies repo automation and ownership.** The package publish
workflow no longer generates/clones/commits SDK reference docs,
`CODEOWNERS` drops web/docs ownership entries, and the root ESLint
config removes `@stylistic/ts` in favor of the built-in `semi` rule.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4158d777b5f3d3fa30b538e434d34ce0e697d473. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-03-17 10:08:28 -07:00
github-actions[bot] 0d5cfd1301 [skip ci] Release new versions 2026-03-09 22:23:14 +00:00
joe-lombrozo-s-bot[bot] 16c86d17d0 fix(python-sdk): use per-event-loop transport for async client (#1178) 2026-03-09 19:45:00 +00:00
github-actions[bot] d289772df0 [skip ci] Release new versions 2026-03-06 13:35:12 +00:00
Mish Ushakov 222105dc8f fix: include dotfiles in template file uploads (#1162)
## Summary
- Enable glob patterns to match files starting with dot (e.g., `.env`,
`.gitignore`)
- JS SDK: Add `dot: true` to glob calls in `getAllFilesInPath`
- Python SDK: Add `glob.DOTMATCH` flag to glob calls in
`get_all_files_in_path`
- Add comprehensive tests for dotfile handling in both SDKs

Previously, the glob library defaults prevented dotfiles from being
matched, preventing upload of configuration files like `.env`. This fix
enables proper handling of dotfiles in template file uploads.

## Test plan
-  All 16 JS SDK tests pass (4 new dotfile tests)
-  All 17 Python SDK tests pass (4 new dotfile tests)
-  `pnpm run format` passes
-  `pnpm run lint` passes
-  `pnpm run typecheck` passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Small, well-scoped change to glob options that only broadens matched
file sets; main risk is unintentionally including hidden files unless
excluded via ignore patterns.
> 
> **Overview**
> Template file collection now includes dot-prefixed files and
directories (e.g., `.env`, `.gitignore`, `.hidden/**`) when
building/uploading templates.
> 
> This updates globbing in the JS SDK’s `getAllFilesInPath` to set `dot:
true` (including recursive directory expansion) and the Python SDK’s
`get_all_files_in_path` to add `glob.DOTMATCH`, and adds targeted tests
in both SDKs to verify dotfile inclusion and that ignore patterns still
exclude specified dotfiles. A changeset bumps both `e2b` and
`@e2b/python-sdk` as patch releases.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
fc3cbcc232bc28559d38bb267162d3f55138b558. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 08:16:16 -08:00
github-actions[bot] d8559492d0 [skip ci] Release new versions 2026-03-04 21:43:16 +00:00
Matt Brockman 7027f369a3 autoresume: lifecycle component in sdk (#1146)
Implements the `lifecycle` prop on `Sandbox.create`, taking over and
deprecating the `beta_pause` functionality.

Currently supports:
- `on_timeout`: `kill` (default) | `pause`. Controls what should happen
to the sandbox when it hits end of life. Pause allows for resuming
- `auto_resume`: False (default) | True. Whether the sandbox should
autoresume on traffic

Intended for additional functionality as we update the backend to
support additional props. Blocked from deploying until the API and
client-proxy are deployed but for pre-approval.

(Meant to be extended later as add more capabilities to the API)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes the API contract and request payload shape for sandbox
auto-resume and alters lifecycle/timeout behavior mapping, which could
break older integrations if backend/client versions are mismatched.
> 
> **Overview**
> Adds a new `lifecycle` configuration on `Sandbox.create` (JS + Python)
to control what happens at timeout (`kill` vs `pause`) and whether
paused sandboxes auto-resume on traffic (`auto_resume`).
> 
> Deprecates `betaPause`/`beta_pause` and the JS `autoPause` create
option in favor of the new lifecycle semantics, updates connect/pause
call paths accordingly, and expands tests to cover resume-on-connect and
auto-resume behaviors.
> 
> Updates the OpenAPI contract and generated clients so `autoResume` is
now an object with an `enabled: boolean` flag (removing the previous
policy enum), and bumps SDK versions via a changeset.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
515f9b7fc13a5ec13db75450e8f6252e3c7bcf03. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-03-04 13:23:08 -08:00
github-actions[bot] e04780fafb [skip ci] Release new versions 2026-03-04 14:59:03 +00:00
Berry e83cf86454 feat: add getTags/get_tags to list all tags for a template (#1132)
## Summary
- Add `GET /templates/{templateID}/tags` endpoint to the OpenAPI spec
- Add `Template.getTags()` to JS/TS SDK
- Add `Template.get_tags()` (sync) and `AsyncTemplate.get_tags()`
(async) to Python SDK
- Returns a list of `TemplateTag` objects with `tag`, `buildId`, and
`createdAt` fields

## Test plan
- Added unit tests for JS SDK (`Template.getTags` happy path + 404
error)
- Added unit tests for Python SDK (sync + async, happy path + error)
2026-03-03 16:38:39 +01:00
Jakub Dobry 6371d0c1ce fix: remove 'Paused' from sandbox not found error in set_timeout (#1174) 2026-03-02 14:54:27 -08:00
Jakub Dobry 59a0f0478a chore: use template versioning in tests (#1151) 2026-02-26 20:58:20 -08:00
Jakub Dobry 51582e8315 fix: update kill test to use valid sandbox ID format (#1169)
The infra now validates sandbox ID format (^[a-z0-9]+$), allowing only
lowercase alphanumeric characters. The test was using
'non-existing-sandbox' which fails format validation due to hyphens,
returning a 400 error instead of reaching the expected 404 path.

This updates the test to use 'nonexistingsandbox' — a valid format that
doesn't exist, so it properly hits the 404 "not found" response and
returns false as expected.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: test-only change that updates hardcoded IDs to match new
validation rules, without modifying runtime logic.
> 
> **Overview**
> Updates JS and Python SDK `kill non-existing sandbox` tests to use a
lowercase alphanumeric sandbox ID (`nonexistingsandbox`) instead of a
hyphenated one, so the tests exercise the intended *not-found* path
rather than failing format validation.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e43acb66ef4465ae60a368ac8c7377023b4a6da3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Jakub Novak <jakub@e2b.dev>
2026-02-26 02:08:58 -08:00
github-actions[bot] 602cc2d51f [skip ci] Release new versions 2026-02-24 20:53:45 +00:00
Jakub Dobry a55ca219e9 feat: snapshots (#1111) 2026-02-24 11:59:11 -08:00
github-actions[bot] f922884447 [skip ci] Release new versions 2026-02-21 02:00:30 +00:00
Jakub Dobry 24279d07b9 fix: scope sandbox_test_id fixture per-test to prevent cross-worker interference (#1149) 2026-02-20 17:50:24 -08:00
Jakub Dobry 85f5b8d2b3 chore: various bug fixes (#1145)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Mostly CI/test changes plus a small logging tweak; low production
impact, with main risk being altered test timing/flake behavior due to
new timeout defaults.
> 
> **Overview**
> Improves release-candidate GitHub workflows by passing sanitized
`tag`/`preid` via step `env` vars and quoting them when running `npm
version`/`npm publish`, reducing the chance of input/expansion issues.
> 
> Stabilizes sandbox internet-access tests in JS and Python by switching
the curl target to Google’s `generate_204` endpoint and updating
expected status codes. Python tests also tighten global `pytest` timeout
to 30s, remove per-sandbox default timeouts from fixtures, and add 180s
timeouts specifically for template test suites via new `conftest.py`
files.
> 
> CLI sandbox status polling now logs the caught error when
`Sandbox.getInfo` fails (instead of silently returning `false`).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
187849338dd46f9d0dd1adb0a070719ebad87309. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-02-18 11:37:32 +01:00
Jakub Dobry 5cc2c8a1ef fix(tests): vitest state cross pollution (#1144) 2026-02-17 17:21:23 -08:00
Jakub Dobry 3033d255bc chore(test): replace netcat with Python HTTP server in network tests (#1140) 2026-02-17 08:18:39 -08:00
Vasek Mlejnsky 96c407e27f Update download badges in README.md (#1133)
Update broken downloads badge

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only change that updates external badge image URLs and
styling; no runtime or build behavior is affected.
> 
> **Overview**
> Fixes broken download badges in `README.md` and
`packages/python-sdk/README.md`.
> 
> The PyPI badge is switched from shields.io to a Pepy monthly downloads
badge, and the NPM badge label/styling is updated to explicitly show
*monthly* downloads.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
811324dd583dd068f6a763489ac6c63483c47f87. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-02-14 21:10:01 +00:00
Mish Ushakov c38a1819b6 Fix Python SDK type issues with ty type checker (#1122)
## Summary
- Resolved 43 type diagnostics reported by ty (Astral's Python type
checker)
- Fixed Self type issues on class singletons
- Added explicit type annotations for shadowed attributes
- Replaced None with UNSET for auto-generated API parameters
- Fixed method signature alignment for protocol matching
- Added targeted type: ignore suppressions for pattern-based limitations

All checks pass: ty check, ruff format, ruff check.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Mostly typing/CI changes, but some adjustments affect sandbox
connect/pause overload dispatch and API response/parameter handling
(`UNSET` vs `None`), which could alter edge-case runtime behavior.
> 
> **Overview**
> Fixes Python SDK static typing issues for Astral’s `ty` checker and
wires typechecking into CI.
> 
> Adds a new `Typecheck` GitHub Action plus workspace `typecheck`
scripts (TS packages via `tsc`, Python SDK via `make typecheck` running
`ty`), and publishes a patch changeset for `@e2b/python-sdk`.
> 
> Across the Python SDK, adjusts type annotations and overloads (e.g.,
`Self`/singleton typing, `connect` overloads, optional
`user`/token/domain handling), tightens API model parsing with
`cast`/`Optional` checks and `UNSET` usage, and adds a few targeted `ty`
ignore comments in tests/protocols to silence checker limitations.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f66402847c40cee7e44e1aaa7caa97e271ba9978. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-02-12 16:23:39 +00:00
Matt Brockman 87ceec29d9 feat: enable piping on the e2b cli (#1127)
Adds stdin piping support to `e2b sandbox exec`, so users can do:

  ```bash
  echo "data" | e2b sandbox exec <id> -- cat
cat file.bin | e2b sandbox exec <id> -- python3 -c 'import sys;
print(len(sys.stdin.buffer.read()))'
```

  Included:
  - JS SDK updates:
      - closeStdin()
      - supportsStdinClose
  - CLI updates:
      - detects piped stdin
      - streams stdin in 64 KiB chunks
      - closes remote stdin on EOF
  - graceful fallback for older sandbox versions (requires `envd` >= 0.5.2, warn + ignore piped input)


  ### Example Usage

  #### non-piped exec still works
```
  e2b sandbox exec <sandbox_id> -- 'echo backend-non-pipe'
```
  #### piped stdin path (supported envd) should deliver bytes
```
  echo "hello" | e2b sandbox exec <sandbox_id> -- 'wc -c'   # expect 6
printf '\x00\x01\x02\xff' | $e2b sandbox exec <sandbox_id> -- 'wc -c' #
expect 4
```
  #### optional: legacy template behavior should warn + ignore piped stdin
```
echo "hello" | e2b sandbox exec <legacy_sandbox_id> -- 'wc -c' # expect
0 + "Ignoring piped stdin."
```
2026-02-11 16:18:28 -08:00
github-actions[bot] e11378c8c6 [skip ci] Release new versions 2026-02-09 19:28:29 +00:00
Berry 6395a5fb5d fix: resolve ty no-matching-overload on Sandbox.kill() (#1119)
## Summary

- Fixes `ty` type checker reporting `error[no-matching-overload]` when
calling `Sandbox.kill()` (and all other methods using the
`class_method_variant` pattern)
- Single 2-line change: make `class_method_variant` inherit from
`Generic[T]` instead of `object`

## Problem

The `class_method_variant` descriptor uses `cast(T, self)` to tell type
checkers that the decorator preserves the original function's type.
Without `Generic[T]`, `T` is only a method-level TypeVar — `ty` doesn't
trust the cast and fails to resolve overloads at call sites. `mypy` and
`pyright` are more lenient and accept it either way.

Affected methods (both `Sandbox` and `AsyncSandbox`): `kill`, `connect`,
`set_timeout`, `get_info`, `get_metrics`, `beta_pause`.

## Fix

Adding `Generic[T]` makes `T` a class-level type parameter, so `ty` can
track the type binding through the descriptor
(`class_method_variant[(self, **opts) -> bool]`). The cast then makes
sense to all three type checkers.

## Verification

Tested with a consumer repro (`sandbox.kill()`) against:

| Type Checker | Before | After |
|---|---|---|
| ty 0.0.15 | `error[no-matching-overload]` | All checks passed |
| mypy 1.19.1 | All checks passed | All checks passed |
| pyright 1.1.408 | All checks passed | All checks passed |

## Test plan

- [x] Verified `ty check` passes on consumer-side repro
- [x] Verified `mypy` and `pyright` still pass (no regressions)
- [x] Verified Python syntax is valid
- [x] No runtime behavior change (`Generic[T]` only affects type-level
metadata)
2026-02-09 10:32:27 -08:00
github-actions[bot] 12c8d6e6e1 [skip ci] Release new versions 2026-02-09 13:02:58 +00:00