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.
## 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>
## 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
```
# Description
- Respect `E2B_DOMAIN` for `e2b auth login` in CLI
- Keep `E2B_DOCS_BASE` to allow for running dashboard locally or towards
potentially different domain
PR that allows you to pass `proxy` (of the type ProxyTypes) when calling
methods in the SDK that send requests. Also, if you pass `proxy` when
creating a sandbox, all the sandbox requests (called on the
Sandbox/AsyncSandbox instance) will automatically use the same proxy.
The PR also contains a small bugfix—adding missing passing of limits and
passing these directly instead of through transport to be able to pass
the proxy parameter properly.
This change should also be compatible with the code interpreter—it uses
the client transport, which uses the passed proxy if there is any.
This feature allows passing custom headers in the Python and JS SDK. One
use-case for it currently is passing custom authorization (Supabase)
headers with the request.