Commit Graph

364 Commits

Author SHA1 Message Date
Jakub Novák ec1b831018 Fix byte shift in sandbox metrics (#837)
This pull request addresses a bug in the CLI related to incorrect byte
shifting for memory and disk metrics when dealing with sizes greater
than 4 GB.
2025-07-31 03:40:27 -07:00
github-actions[bot] 0c6cfed137 [skip ci] Release new versions 2025-07-31 09:57:39 +00:00
Jakub Novák 8c4710cc60 Fix metrics cli missing api key (#836)
# Description
Fixing a missing API key issue for sandbox metrics in the CLI
2025-07-31 09:54:44 +00:00
github-actions[bot] 115407cf1e [skip ci] Release new versions 2025-07-31 09:44:55 +00:00
Jakub Novák f123091e9a Allow to block network from SDK (#834)
# Description

This pull request introduces the ability to control internet access for
sandboxes, enhancing security for sensitive workloads.
2025-07-31 02:34:57 -07:00
github-actions[bot] 76d62ed070 [skip ci] Release new versions 2025-07-30 19:25:33 +00:00
Jakub Novák e34d69525f Expose sandbox metrics in SDKs and CLI (#828)
# Description

Expose sandbox metrics in SDKs and CLI


```
e2b sbx mt il98ycmohc6enybi79uf8

Metrics for sandbox il98ycmohc6enybi79uf8:

[2025-07-25 14:05:55Z]  CPU:  8.27% /  2 Cores | Memory:    31 / 484   MiB | Disk:  1445 / 2453  MiB
[2025-07-25 14:06:00Z]  CPU:   0.5% /  2 Cores | Memory:    32 / 484   MiB | Disk:  1445 / 2453  MiB
[2025-07-25 14:06:05Z]  CPU:   0.1% /  2 Cores | Memory:    32 / 484   MiB | Disk:  1445 / 2453  MiB
[2025-07-25 14:06:10Z]  CPU:   0.3% /  2 Cores | Memory:    32 / 484   MiB | Disk:  1445 / 2453  MiB

```

---------

Co-authored-by: Tomas Valenta <valenta.and.thomas@gmail.com>
2025-07-30 12:17:30 -07:00
github-actions[bot] 7f26f5536e [skip ci] Release new versions 2025-07-29 10:44:36 +00:00
Mish Ushakov edeafb1cdd Adds files.getInfo / files.get_info methods to retrieve information about directory/files (#724)
**Changelog**

- Adds `files.getInfo`, `files.get_info` methods to the SDKs.
- Adds tests for the new methods
- Adds documentation for the above.

**Examples**

JavaScript

```js
import { Sandbox } from '@e2b/code-interpreter'

const sandbox = await Sandbox.create()

// Create a new file
await sandbox.files.write('test_file.txt', 'Hello, world!')

// Get information about the file
const info = await sandbox.files.getInfo('test_file.txt')

console.log(info)
// {
//   name: 'test_file.txt',
//   type: 'file',
//   path: '/home/user/test_file.txt'
// }
```

Python

```py
from e2b_code_interpreter import Sandbox

sandbox = Sandbox()

# Create a new file
sandbox.files.write('test_file', 'Hello, world!')

# Get information about the file
info = sandbox.files.get_info('test_file')

print(info)
# EntryInfo(name='test_file.txt', type=<FileType.FILE: 'file'>, path='/home/user/test_file.txt')
```

---------

Co-authored-by: Jakub Novak <jakub@e2b.dev>
2025-07-29 03:39:42 -07:00
github-actions[bot] 37d69be891 [skip ci] Release new versions 2025-07-28 15:23:07 +00:00
Jakub Novák c54528faea Update User-Agent header in SDKs based on the SDK version (#830)
# Description

The bug where extra fields in envd response caused an exception was
fixed in #738. As we're also ignoring new fields in envd (implemented in
https://github.com/e2b-dev/infra/pull/847). We now have to update the
`user-agent` header.
2025-07-28 08:18:02 -07:00
github-actions[bot] 37ec33654d [skip ci] Release new versions 2025-07-18 15:23:52 +00:00
Jiri Sveceny 56dfb423ad Add image URI mask option for template build to allow custom image repository (#819)
This will allow customers who are not using our Docker repository to
fall back to their own during template build.
2025-07-18 17:20:46 +02:00
github-actions[bot] e7538fb5cc [skip ci] Release new versions 2025-07-18 11:20:02 +00:00
Jiri Sveceny 10e9a28a82 Support sandbox domain in sdk and cli (#821)
Support sandbox traffic routing to the custom domain returned from API.
2025-07-18 13:15:12 +02:00
github-actions[bot] 5f207ffa95 [skip ci] Release new versions 2025-07-17 13:16:31 +00:00
Jiri Sveceny 9f8c40e49e Client ID part removal from SDKs (#820)
- CLI spawn, connect, and logs work with and without the client part
provided
- JavaScript and Python SDKs are no longer returning IDs with client
part
2025-07-17 13:11:50 +00:00
github-actions[bot] 5cf6c145a5 [skip ci] Release new versions 2025-07-10 13:45:42 +00:00
Mish Ushakov 5c68eb7a25 Fixes Sandbox.connect not working when trying to pass API key via parameters (#772)
fixes https://github.com/e2b-dev/E2B/issues/746

- Renamed SandboxApi.get_info() > SandboxApi._cls_get_info()
- Properly overloaded Sandbox.get_info()
- Passed connect parameters to SandboxApi._cls_get_info()
2025-07-10 15:41:33 +02:00
github-actions[bot] 8b8cf0084f [skip ci] Release new versions 2025-07-09 14:49:53 +00:00
Jakub Dobry 2817a85101 Print all logs also on build success (#814)
Print all logs also on build success
2025-07-09 07:46:13 -07:00
github-actions[bot] 083d5eefa8 [skip ci] Release new versions 2025-07-09 14:08:34 +00:00
Jakub Novák 10aab1d7d6 Set default domain even if the env variable is an empty string (#813)
# Description

os.getenv doesn't use the default value, if the variable is empty string
2025-07-09 07:03:31 -07:00
github-actions[bot] 3547878756 [skip ci] Release new versions 2025-07-03 18:31:46 +00:00
Mish Ushakov 0ac4112b25 Fixes parsing http errors in connect client (#806) 2025-07-03 20:27:32 +02:00
github-actions[bot] 69eacc71bb [skip ci] Release new versions 2025-06-27 20:24:58 +00:00
Mish Ushakov 1067fc53e8 Ignore unknown fields from received messages (protobuf) (#738)
(We might actually not need this if we version the methods instead)

context:
https://github.com/e2b-dev/infra/pull/655#pullrequestreview-2851059703
reference:
https://googleapis.dev/python/protobuf/latest/google/protobuf/message.html#google.protobuf.message.Message.MergeFrom
2025-06-27 13:20:40 -07:00
github-actions[bot] 9704e2ff03 [skip ci] Release new versions 2025-06-24 17:08:34 +00:00
Mish Ushakov 89b8680c75 watchDir remove redundant "timeout" option in JS SDK (#796)
- removes redundant "timeout" option for watchDir method in the JS SDK
(we're using timeoutMs already)
2025-06-24 19:00:49 +02:00
github-actions[bot] 884e6b3917 [skip ci] Release new versions 2025-06-23 16:58:16 +00:00
Mish Ushakov 05948ed527 Use TextEncoder for crypto/signed URLs (#790)
- Replaces node:crypto with cross-runtime TextEncoder/TextDecoder API
- The uploadUrl/downloadUrl methods are now async
2025-06-23 09:51:54 -07:00
github-actions[bot] 40c73100bc [skip ci] Release new versions 2025-06-20 02:52:52 +00:00
Jiri Sveceny cb3a009ac7 Option for providing system user during upload/download url creation (#784) 2025-06-19 19:48:03 -07:00
github-actions[bot] 93134e2faa [skip ci] Release new versions 2025-06-18 12:16:44 +00:00
Mish Ushakov 4730e13656 Changed help link in the CLI on failed build (#782)
current link leads to 404
2025-06-18 14:14:03 +02:00
github-actions[bot] 995c494d4a [skip ci] Release new versions 2025-06-16 18:46:47 +00:00
Mish Ushakov 96f8c64b6f Changes timeout exception format (#778)
- this is a follow-up to #777, fixing the timeout exception format
option
2025-06-16 11:42:40 -07:00
Mish Ushakov d404a88031 Fixes incorrect error message in Python SDK (#777)
- closes #776
- changes timeout error message in Python SDK, before was same as in the
JS SDK which is incorrect.
2025-06-16 20:26:28 +02:00
github-actions[bot] 4aaeee2af4 [skip ci] Release new versions 2025-06-13 11:03:18 +00:00
Ben Fornefeld ab6140efc3 Fix(sdk): Export enums as non-const to support isolatedModules (#773)
Removes the `const` keyword from `FileType` and `FilesystemEventType`
enums.

This change prevents the enums from being inlined at compile time,
making them compatible with projects that have the `isolatedModules:
true` flag enabled in their `tsconfig.json`. This resolves the `Cannot
access ambient const enums` build error that occurs in environments like
Babel/Vite.
2025-06-13 12:58:22 +02:00
github-actions[bot] 23a9298252 [skip ci] Release new versions 2025-06-13 00:45:36 +00:00
Jakub Dobry e244ba72c0 Add option for a template ready check (#750)
## Description
Add option for a template ready check. You can specify `ready_cmd` which
will be run until it exits with code 0. Max timeout is 5 minutes. After
exit code 0, the template will be marked as ready.

If no ready command is defined, `sleep 20` is assumed when the start
command is present, and `sleep 0` when none is defined. It is also
possible to define ready command without any start command. This might
be helpful if the filesystem contains self-booted services (e.g. using
systemd).

```
ready_cmd = "echo 'Starting ready check'; sleep 40; echo 'Template is ready'"
```

This adds possibility to configure the default 20 seconds wait time for
a start command.

New documentation can be found at `/docs/sandbox-template/ready-cmd`.

## Checklist
- [x] Make sure the https://github.com/e2b-dev/infra/pull/719 is
deployed

---------

Co-authored-by: Vasek Mlejnsky <vasek@e2b.dev>
Co-authored-by: Jakub Novák <jakub@e2b.dev>
2025-06-12 17:42:37 -07:00
github-actions[bot] 27e292eedc [skip ci] Release new versions 2025-06-05 15:39:44 +00:00
Jakub Novák ca905b0639 Fix CLI regression (#762)
# Description 

Introduced in
[here](https://github.com/e2b-dev/E2B/pull/747/files#diff-69710e23d3c0765f64152a2be96bd62daf49732e11d1e46b607686ec0cf15e75)
2025-06-05 17:36:41 +02:00
github-actions[bot] 6c0927e358 [skip ci] Release new versions 2025-06-05 14:15:25 +00:00
Mish Ushakov fc182d63ef Added license sources to SDKs (#761)
- Added licenses source text to the SDKs, CLI
2025-06-05 07:10:07 -07:00
github-actions[bot] f1afba0d74 [skip ci] Release new versions 2025-06-03 10:13:57 +00:00
Ben Fornefeld 8c43806f81 Fix: TypeScript union type resolution for Commands.run() method (#753)
## Fix TypeScript union type resolution for Commands.run() method

### What's Changed
Improved TypeScript type safety for the `Commands.run()` method by
adding proper function overloads to handle the union case when the
`background` parameter type is not known at compile time.

### Key Improvements

**Better Type Safety**
- Added a third function overload to correctly handle the `background?:
boolean` union case
- TypeScript now correctly infers return types:
  - `background: true` → returns `CommandHandle`
  - `background: false | undefined` → returns `CommandResult`
- `background: boolean` (unknown at compile time) → returns
`CommandHandle | CommandResult`

**Enhanced Developer Experience**
- Added comprehensive JSDoc overloads that clearly document each usage
pattern
- IntelliSense now provides accurate type hints and autocompletion
- Eliminates ambiguous union types when the `background` value is known
at compile time

**Prevents Runtime Errors**
- When `background` is a literal value, developers get precise types and
can't accidentally call wrong methods
- When `background` is a runtime boolean, TypeScript correctly shows the
union type requiring proper type narrowing

### Why This Matters for SDK Users

Before this change, developers had to ignore ts warning & manually cast
union types when using `commands.run()`:
```typescript
// Before: typescript was complaining, because it expected `true` or `false` as literals. 
// Required manual casting:

// @ts-ignore
const result = await sbx.commands.run('ls', { background: isBackground }) as CommandHandle | CommandResult
```

After this change, TypeScript automatically infers the correct type:
```typescript
// After: TypeScript knows this is CommandHandle
const handle = await sbx.commands.run('ls', { background: true })
await handle.wait() //  TypeScript knows .wait() is available

// TypeScript knows this is CommandResult  
const result = await sbx.commands.run('ls')
console.log(result.stdout) //  TypeScript knows .stdout is available

// When background value is unknown at compile time, returns union type
const isBackground: boolean = Math.random() > 0.5
const result = await commands.run('ls', { background: isBackground })
// result is CommandHandle | CommandResult - requires type narrowing or casting
```
2025-06-03 10:09:31 +00:00
github-actions[bot] 41ef82cbd2 [skip ci] Release new versions 2025-05-15 17:22:06 +00:00
Mish Ushakov 698959dddb Added --no-cache option for building templates without cache (#735)
- Adds `--no-cache` parameter to CLI `template build` command for
building templates without cache.
2025-05-15 19:19:04 +02:00