Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
[skip ci] Release new versions
github-actions[bot]cd45aa4aae2a
diff --git a/.changeset/twelve-planets-attend.md b/.changeset/twelve-planets-attend.mddeleted file mode 100644index 49e703783..000000000--- a/.changeset/twelve-planets-attend.md+++ /dev/null@@ -1,5 +0,0 @@-----'e2b': patch------Fix browser usagediff --git a/apps/web/package.json b/apps/web/package.jsonindex e7562d50b..2ecbebd0c 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -43,7 +43,7 @@"autoprefixer": "^10.4.7","class-variance-authority": "^0.7.0","clsx": "^1.2.1",- "e2b": "^1.0.6",+ "e2b": "^1.0.7","fast-glob": "^3.3.0","fast-xml-parser": "^4.3.3","flexsearch": "^0.7.31",diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/commands/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/commands/page.mdxnew file mode 100644index 000000000..41f75547a--- /dev/null+++ b/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/commands/page.mdx@@ -0,0 +1,483 @@+### Commands++Module for starting and interacting with commands in the sandbox.++#### Constructors++```ts+new Commands(transport: Transport, connectionConfig: ConnectionConfig): Commands+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `transport` | `Transport` |+| `connectionConfig` | `ConnectionConfig` |++###### Returns++`Commands`++#### Methods++### connect()++```ts+connect(pid: number, opts?: CommandConnectOpts): Promise<CommandHandle>+```++Connect to a running command.+You can use CommandHandle.wait to wait for the command to finish and get execution results.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `pid` | `number` | process ID of the command to connect to. You can get the list of running commands using Commands.list. |+| `opts`? | `CommandConnectOpts` | connection options. |++###### Returns++`Promise`\<`CommandHandle`\>++`CommandHandle` handle to interact with the running command.++### kill()++```ts+kill(pid: number, opts?: CommandRequestOpts): Promise<boolean>+```++Kill a running command specified by its process ID.+It uses `SIGKILL` signal to kill the command.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `pid` | `number` | process ID of the command. You can get the list of running commands using Commands.list. |+| `opts`? | `CommandRequestOpts` | connection options. |++###### Returns++`Promise`\<`boolean`\>++`true` if the command was killed, `false` if the command was not found.++### list()++```ts+list(opts?: CommandRequestOpts): Promise<ProcessInfo[]>+```++List all running commands and PTY sessions.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `opts`? | `CommandRequestOpts` | connection options. |++###### Returns++`Promise`\<`ProcessInfo`[]\>++list of running commands and PTY sessions.++### run()++###### run(cmd, opts)++```ts+run(cmd: string, opts?: CommandStartOpts & object): Promise<CommandResult>+```++Start a new command and wait until it finishes executing.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `cmd` | `string` | command to execute. |+| `opts`? | `CommandStartOpts` & `object` | options for starting the command. |++###### Returns++`Promise`\<`CommandResult`\>++`CommandResult` result of the command execution.++###### run(cmd, opts)++```ts+run(cmd: string, opts?: CommandStartOpts & object): Promise<CommandHandle>+```++Start a new command in the background.+You can use CommandHandle.wait to wait for the command to finish and get its result.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `cmd` | `string` | command to execute. |+| `opts`? | `CommandStartOpts` & `object` | options for starting the command |++###### Returns++`Promise`\<`CommandHandle`\>++`CommandHandle` handle to interact with the running command.++### sendStdin()++```ts+sendStdin(+ pid: number,+ data: string,+opts?: CommandRequestOpts): Promise<void>+```++Send data to command stdin.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `pid` | `number` | process ID of the command. You can get the list of running commands using Commands.list. |+| `data` | `string` | data to send to the command. |+| `opts`? | `CommandRequestOpts` | connection options. |++###### Returns++`Promise`\<`void`\>++***++### Pty++Module for interacting with PTYs (pseudo-terminals) in the sandbox.++#### Constructors++```ts+new Pty(transport: Transport, connectionConfig: ConnectionConfig): Pty+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `transport` | `Transport` |+| `connectionConfig` | `ConnectionConfig` |++###### Returns++`Pty`++#### Methods++### create()++```ts+create(opts: PtyCreateOpts): Promise<CommandHandle>+```++Create a new PTY (pseudo-terminal).++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `opts` | `PtyCreateOpts` | options for creating the PTY. |++###### Returns++`Promise`\<`CommandHandle`\>++handle to interact with the PTY.++### kill()++```ts+kill(pid: number, opts?: Pick<ConnectionOpts, "requestTimeoutMs">): Promise<boolean>+```++Kill a running PTY specified by process ID.+It uses `SIGKILL` signal to kill the PTY.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `pid` | `number` | process ID of the PTY. |+| `opts`? | `Pick`\<`ConnectionOpts`, `"requestTimeoutMs"`\> | connection options. |++###### Returns++`Promise`\<`boolean`\>++`true` if the PTY was killed, `false` if the PTY was not found.++### resize()++```ts+resize(+ pid: number,+ size: object,+opts?: Pick<ConnectionOpts, "requestTimeoutMs">): Promise<void>+```++Resize PTY.+Call this when the terminal window is resized and the number of columns and rows has changed.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `pid` | `number` | process ID of the PTY. |+| `size` | `object` | new size of the PTY. |+| `size.cols` | `number` | - |+| `size.rows`? | `number` | - |+| `opts`? | `Pick`\<`ConnectionOpts`, `"requestTimeoutMs"`\> | connection options. |++###### Returns++`Promise`\<`void`\>++### sendInput()++```ts+sendInput(+ pid: number,+ data: Uint8Array,+opts?: Pick<ConnectionOpts, "requestTimeoutMs">): Promise<void>+```++Send input to a PTY.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `pid` | `number` | process ID of the PTY. |+| `data` | `Uint8Array` | input data to send to the PTY. |+| `opts`? | `Pick`\<`ConnectionOpts`, `"requestTimeoutMs"`\> | connection options. |++###### Returns++`Promise`\<`void`\>++## Interfaces++### CommandRequestOpts++Options for sending a command request.++#### Extended by++- `CommandStartOpts`++#### Properties++### requestTimeoutMs?++```ts+optional requestTimeoutMs: number;+```++Timeout for requests to the API in **milliseconds**.++###### Default++```ts+30_000 // 30 seconds+```++***++### CommandStartOpts++Options for starting a new command.++#### Properties++### background?++```ts+optional background: boolean;+```++If true, starts command in the background and the method returns immediately.+You can use CommandHandle.wait to wait for the command to finish.++### cwd?++```ts+optional cwd: string;+```++Working directory for the command.++###### Default++```ts+// home directory of the user used to start the command+```++### envs?++```ts+optional envs: Record<string, string>;+```++Environment variables used for the command.++This overrides the default environment variables from `Sandbox` constructor.++###### Default++`{}`++### onStderr()?++```ts+optional onStderr: (data: string) => void | Promise<void>;+```++Callback for command stderr output.++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `data` | `string` |++###### Returns++`void` \| `Promise`\<`void`\>++### onStdout()?++```ts+optional onStdout: (data: string) => void | Promise<void>;+```++Callback for command stdout output.++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `data` | `string` |++###### Returns++`void` \| `Promise`\<`void`\>++### requestTimeoutMs?++```ts+optional requestTimeoutMs: number;+```++Timeout for requests to the API in **milliseconds**.++###### Default++```ts+30_000 // 30 seconds+```++### timeoutMs?++```ts+optional timeoutMs: number;+```++Timeout for the command in **milliseconds**.++###### Default++```ts+60_000 // 60 seconds+```++### user?++```ts+optional user: Username;+```++User to run the command as.++###### Default++`user`++***++### ProcessInfo++Information about a command, PTY session or start command running in the sandbox as process.++#### Properties++### args++```ts+args: string[];+```++Command arguments.++### cmd++```ts+cmd: string;+```++Command that was executed.++### cwd?++```ts+optional cwd: string;+```++Executed command working directory.++### envs++```ts+envs: Record<string, string>;+```++Environment variables used for the command.++### pid++```ts+pid: number;+```++Process ID.++### tag?++```ts+optional tag: string;+```++Custom tag used for identifying special commands like start command in the custom template.++## Type Aliases++### CommandConnectOpts++```ts+type CommandConnectOpts: Pick<CommandStartOpts, "onStderr" | "onStdout" | "timeoutMs"> & CommandRequestOpts;+```++Options for connecting to a command.diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/errors/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/errors/page.mdxnew file mode 100644index 000000000..c5aa2cc14--- /dev/null+++ b/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/errors/page.mdx@@ -0,0 +1,211 @@+### AuthenticationError++Thrown when authentication fails.++#### Constructors++```ts+new AuthenticationError(message: any): AuthenticationError+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `any` |++###### Returns++`AuthenticationError`++***++### InvalidArgumentError++Thrown when an invalid argument is provided.++#### Constructors++```ts+new InvalidArgumentError(message: string): InvalidArgumentError+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `string` |++###### Returns++`InvalidArgumentError`++***++### NotEnoughSpaceError++Thrown when there is not enough disk space.++#### Constructors++```ts+new NotEnoughSpaceError(message: string): NotEnoughSpaceError+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `string` |++###### Returns++`NotEnoughSpaceError`++***++### NotFoundError++Thrown when a resource is not found.++#### Constructors++```ts+new NotFoundError(message: string): NotFoundError+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `string` |++###### Returns++`NotFoundError`++***++### RateLimitError++Thrown when the API rate limit is exceeded.++#### Constructors++```ts+new RateLimitError(message: any): RateLimitError+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `any` |++###### Returns++`RateLimitError`++***++### SandboxError++Base class for all sandbox errors.++Thrown when general sandbox errors occur.++#### Extended by++- `TimeoutError`+- `InvalidArgumentError`+- `NotEnoughSpaceError`+- `NotFoundError`+- `AuthenticationError`+- `TemplateError`+- `RateLimitError`++#### Constructors++```ts+new SandboxError(message: any): SandboxError+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `any` |++###### Returns++`SandboxError`++***++### TemplateError++Thrown when the template uses old envd version. It isn't compatible with the new SDK.++#### Constructors++```ts+new TemplateError(message: string): TemplateError+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `string` |++###### Returns++`TemplateError`++***++### TimeoutError++Thrown when a timeout error occurs.++The [unavailable] error type is caused by sandbox timeout.++The [canceled] error type is caused by exceeding request timeout.++The [deadline_exceeded] error type is caused by exceeding the timeout for command execution, watch, etc.++The [unknown] error type is sometimes caused by the sandbox timeout when the request is not processed correctly.++#### Constructors++```ts+new TimeoutError(message: string): TimeoutError+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `string` |++###### Returns++`TimeoutError`++## Functions++### formatSandboxTimeoutError()++```ts+function formatSandboxTimeoutError(message: string): TimeoutError+```++#### Parameters++| Parameter | Type |+| ------ | ------ |+| `message` | `string` |++#### Returns++`TimeoutError`diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/filesystem/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/filesystem/page.mdxnew file mode 100644index 000000000..0de62cc20--- /dev/null+++ b/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/filesystem/page.mdx@@ -0,0 +1,435 @@+### FileType++Sandbox filesystem object type.++#### Enumeration Members++| Enumeration Member | Value | Description |+| ------ | ------ | ------ |+| `DIR` | `"dir"` | Filesystem object is a directory. |+| `FILE` | `"file"` | Filesystem object is a file. |++## Classes++### Filesystem++Module for interacting with the sandbox filesystem.++#### Constructors++```ts+new Filesystem(+ transport: Transport,+ envdApi: EnvdApiClient,+ connectionConfig: ConnectionConfig): Filesystem+```++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `transport` | `Transport` |+| `envdApi` | `EnvdApiClient` |+| `connectionConfig` | `ConnectionConfig` |++###### Returns++`Filesystem`++#### Methods++### exists()++```ts+exists(path: string, opts?: FilesystemRequestOpts): Promise<boolean>+```++Check if a file or a directory exists.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to a file or a directory |+| `opts`? | `FilesystemRequestOpts` | connection options. |++###### Returns++`Promise`\<`boolean`\>++`true` if the file or directory exists, `false` otherwise++### list()++```ts+list(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo[]>+```++List entries in a directory.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to the directory. |+| `opts`? | `FilesystemRequestOpts` | connection options. |++###### Returns++`Promise`\<`EntryInfo`[]\>++list of entries in the sandbox filesystem directory.++### makeDir()++```ts+makeDir(path: string, opts?: FilesystemRequestOpts): Promise<boolean>+```++Create a new directory and all directories along the way if needed on the specified path.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to a new directory. For example '/dirA/dirB' when creating 'dirB'. |+| `opts`? | `FilesystemRequestOpts` | connection options. |++###### Returns++`Promise`\<`boolean`\>++`true` if the directory was created, `false` if it already exists.++### read()++###### read(path, opts)++```ts+read(path: string, opts?: FilesystemRequestOpts & object): Promise<string>+```++Read file content as a `string`.++You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to the file. |+| `opts`? | `FilesystemRequestOpts` & `object` | connection options. |++###### Returns++`Promise`\<`string`\>++file content as string++###### read(path, opts)++```ts+read(path: string, opts?: FilesystemRequestOpts & object): Promise<Uint8Array>+```++Read file content as a `Uint8Array`.++You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to the file. |+| `opts`? | `FilesystemRequestOpts` & `object` | connection options. |++###### Returns++`Promise`\<`Uint8Array`\>++file content as `Uint8Array`++###### read(path, opts)++```ts+read(path: string, opts?: FilesystemRequestOpts & object): Promise<Blob>+```++Read file content as a `Blob`.++You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to the file. |+| `opts`? | `FilesystemRequestOpts` & `object` | connection options. |++###### Returns++`Promise`\<`Blob`\>++file content as `Blob`++###### read(path, opts)++```ts+read(path: string, opts?: FilesystemRequestOpts & object): Promise<ReadableStream<Uint8Array>>+```++Read file content as a `ReadableStream`.++You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to the file. |+| `opts`? | `FilesystemRequestOpts` & `object` | connection options. |++###### Returns++`Promise`\<`ReadableStream`\<`Uint8Array`\>\>++file content as `ReadableStream`++### remove()++```ts+remove(path: string, opts?: FilesystemRequestOpts): Promise<void>+```++Remove a file or directory.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to a file or directory. |+| `opts`? | `FilesystemRequestOpts` | connection options. |++###### Returns++`Promise`\<`void`\>++### rename()++```ts+rename(+ oldPath: string,+ newPath: string,+opts?: FilesystemRequestOpts): Promise<EntryInfo>+```++Rename a file or directory.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `oldPath` | `string` | path to the file or directory to rename. |+| `newPath` | `string` | new path for the file or directory. |+| `opts`? | `FilesystemRequestOpts` | connection options. |++###### Returns++`Promise`\<`EntryInfo`\>++information about renamed file or directory.++### watchDir()++```ts+watchDir(+ path: string,+ onEvent: (event: FilesystemEvent) => void | Promise<void>,+opts?: WatchOpts): Promise<WatchHandle>+```++Start watching a directory for filesystem events.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to directory to watch. |+| `onEvent` | (`event`: `FilesystemEvent`) => `void` \| `Promise`\<`void`\> | callback to call when an event in the directory occurs. |+| `opts`? | `WatchOpts` | connection options. |++###### Returns++`Promise`\<`WatchHandle`\>++`WatchHandle` object for stopping watching directory.++### write()++```ts+write(+ path: string,+ data: string | ArrayBuffer | Blob | ReadableStream<any>,+opts?: FilesystemRequestOpts): Promise<EntryInfo>+```++Write content to a file.++Writing to a file that doesn't exist creates the file.++Writing to a file that already exists overwrites the file.++Writing to a file at path that doesn't exist creates the necessary directories.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to file. |+| `data` | `string` \| `ArrayBuffer` \| `Blob` \| `ReadableStream`\<`any`\> | data to write to the file. Data can be a string, `ArrayBuffer`, `Blob`, or `ReadableStream`. |+| `opts`? | `FilesystemRequestOpts` | connection options. |++###### Returns++`Promise`\<`EntryInfo`\>++information about the written file++## Interfaces++### EntryInfo++Sandbox filesystem object information.++#### Properties++### name++```ts+name: string;+```++Name of the filesystem object.++### path++```ts+path: string;+```++Path to the filesystem object.++### type?++```ts+optional type: FileType;+```++Type of the filesystem object.++***++### FilesystemRequestOpts++Options for the sandbox filesystem operations.++#### Extended by++- `WatchOpts`++#### Properties++### requestTimeoutMs?++```ts+optional requestTimeoutMs: number;+```++Timeout for requests to the API in **milliseconds**.++###### Default++```ts+30_000 // 30 seconds+```++### user?++```ts+optional user: Username;+```++User to use for the operation in the sandbox.+This affects the resolution of relative paths and ownership of the created filesystem objects.++***++### WatchOpts++Options for watching a directory.++#### Properties++### onExit()?++```ts+optional onExit: (err?: Error) => void | Promise<void>;+```++Callback to call when the watch operation stops.++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `err`? | `Error` |++###### Returns++`void` \| `Promise`\<`void`\>++### recursive?++```ts+optional recursive: boolean;+```++Watch the directory recursively++### requestTimeoutMs?++```ts+optional requestTimeoutMs: number;+```++Timeout for requests to the API in **milliseconds**.++###### Default++```ts+30_000 // 30 seconds+```++### timeoutMs?++```ts+optional timeoutMs: number;+```++Timeout for the watch operation in **milliseconds**.+You can pass `0` to disable the timeout.++###### Default++```ts+60_000 // 60 seconds+```++### user?++```ts+optional user: Username;+```++User to use for the operation in the sandbox.+This affects the resolution of relative paths and ownership of the created filesystem objects.diff --git a/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/sandbox/page.mdxnew file mode 100644index 000000000..099b14853--- /dev/null+++ b/apps/web/src/app/(docs)/docs/sdk-reference/js-sdk/v1.0.7/sandbox/page.mdx@@ -0,0 +1,498 @@+### Sandbox++E2B cloud sandbox is a secure and isolated cloud environment.++The sandbox allows you to:+- Access Linux OS+- Create, list, and delete files and directories+- Run commands+- Run isolated code+- Access the internet++Check docs here.++Use Sandbox.create to create a new sandbox.++#### Example++```ts+import { Sandbox } from 'e2b'++const sandbox = await Sandbox.create()+```++#### Properties++| Property | Modifier | Type | Description |+| ------ | ------ | ------ | ------ |+| `commands` | `readonly` | `Commands` | Module for running commands in the sandbox |+| `files` | `readonly` | `Filesystem` | Module for interacting with the sandbox filesystem |+| `pty` | `readonly` | `Pty` | Module for interacting with the sandbox pseudo-terminals |+| `sandboxId` | `readonly` | `string` | Unique identifier of the sandbox. |++#### Methods++### downloadUrl()++```ts+downloadUrl(path: string): string+```++Get the URL to download a file from the sandbox.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path` | `string` | path to the file to download. |++###### Returns++`string`++URL for downloading file.++### getHost()++```ts+getHost(port: number): string+```++Get the host address for the specified sandbox port.+You can then use this address to connect to the sandbox port from outside the sandbox via HTTP or WebSocket.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `port` | `number` | number of the port in the sandbox. |++###### Returns++`string`++host address of the sandbox port.++###### Example++```ts+const sandbox = await Sandbox.create()+// Start an HTTP server+await sandbox.commands.exec('python3 -m http.server 3000')+// Get the hostname of the HTTP server+const serverURL = sandbox.getHost(3000)+```++### isRunning()++```ts+isRunning(opts?: Pick<ConnectionOpts, "requestTimeoutMs">): Promise<boolean>+```++Check if the sandbox is running.++###### Parameters++| Parameter | Type |+| ------ | ------ |+| `opts`? | `Pick`\<`ConnectionOpts`, `"requestTimeoutMs"`\> |++###### Returns++`Promise`\<`boolean`\>++`true` if the sandbox is running, `false` otherwise.++###### Example++```ts+const sandbox = await Sandbox.create()+await sandbox.isRunning() // Returns true++await sandbox.kill()+await sandbox.isRunning() // Returns false+```++### kill()++```ts+kill(opts?: Pick<SandboxOpts, "requestTimeoutMs">): Promise<void>+```++Kill the sandbox.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `opts`? | `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\> | connection options. |++###### Returns++`Promise`\<`void`\>++### setTimeout()++```ts+setTimeout(timeoutMs: number, opts?: Pick<SandboxOpts, "requestTimeoutMs">): Promise<void>+```++Set the timeout of the sandbox.+After the timeout expires the sandbox will be automatically killed.++This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to `.setTimeout`.+Maximum time a sandbox can be kept alive is 24 hours (86_400_000 milliseconds) for Pro users and 1 hour (3_600_000 milliseconds) for Hobby users.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `timeoutMs` | `number` | timeout in **milliseconds**. |+| `opts`? | `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\> | connection options. |++###### Returns++`Promise`\<`void`\>++### uploadUrl()++```ts+uploadUrl(path?: string): string+```++Get the URL to upload a file to the sandbox.++You have to send a POST request to this URL with the file as multipart/form-data.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `path`? | `string` | the directory where to upload the file, defaults to user's home directory. |++###### Returns++`string`++URL for uploading file.++### connect()++```ts+static connect<S>(+ this: S,+ sandboxId: string,+opts?: Omit<SandboxOpts, "timeoutMs" | "metadata" | "envs">): Promise<InstanceType<S>>+```++Connect to an existing sandbox.+With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).++###### Type Parameters++| Type Parameter |+| ------ |+| `S` *extends* *typeof* `Sandbox` |++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `this` | `S` | - |+| `sandboxId` | `string` | sandbox ID. |+| `opts`? | `Omit`\<`SandboxOpts`, `"timeoutMs"` \| `"metadata"` \| `"envs"`\> | connection options. |++###### Returns++`Promise`\<`InstanceType`\<`S`\>\>++sandbox instance for the existing sandbox.++###### Example++```ts+const sandbox = await Sandbox.create()+const sandboxId = sandbox.sandboxId++// Connect to the same sandbox.+const sameSandbox = await Sandbox.connect(sandboxId)+```++### create()++###### create(this, opts)++```ts+static create<S>(this: S, opts?: SandboxOpts): Promise<InstanceType<S>>+```++Create a new sandbox from the default `base` sandbox template.++###### Type Parameters++| Type Parameter |+| ------ |+| `S` *extends* *typeof* `Sandbox` |++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `this` | `S` | - |+| `opts`? | `SandboxOpts` | connection options. |++###### Returns++`Promise`\<`InstanceType`\<`S`\>\>++sandbox instance for the new sandbox.++###### Example++```ts+const sandbox = await Sandbox.create()+```++###### Constructs++Sandbox++###### create(this, template, opts)++```ts+static create<S>(+ this: S,+ template: string,+opts?: SandboxOpts): Promise<InstanceType<S>>+```++Create a new sandbox from the specified sandbox template.++###### Type Parameters++| Type Parameter |+| ------ |+| `S` *extends* *typeof* `Sandbox` |++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `this` | `S` | - |+| `template` | `string` | sandbox template name or ID. |+| `opts`? | `SandboxOpts` | connection options. |++###### Returns++`Promise`\<`InstanceType`\<`S`\>\>++sandbox instance for the new sandbox.++###### Example++```ts+const sandbox = await Sandbox.create('<template-name-or-id>')+```++###### Constructs++Sandbox++### kill()++```ts+static kill(sandboxId: string, opts?: SandboxApiOpts): Promise<boolean>+```++Kill the sandbox specified by sandbox ID.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `sandboxId` | `string` | sandbox ID. |+| `opts`? | `SandboxApiOpts` | connection options. |++###### Returns++`Promise`\<`boolean`\>++`true` if the sandbox was found and killed, `false` otherwise.++### list()++```ts+static list(opts?: SandboxApiOpts): Promise<SandboxInfo[]>+```++List all running sandboxes.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `opts`? | `SandboxApiOpts` | connection options. |++###### Returns++`Promise`\<`SandboxInfo`[]\>++list of running sandboxes.++### setTimeout()++```ts+static setTimeout(+ sandboxId: string,+ timeoutMs: number,+opts?: SandboxApiOpts): Promise<void>+```++Set the timeout of the specified sandbox.+After the timeout expires the sandbox will be automatically killed.++This method can extend or reduce the sandbox timeout set when creating the sandbox or from the last call to Sandbox.setTimeout.++Maximum time a sandbox can be kept alive is 24 hours (86_400_000 milliseconds) for Pro users and 1 hour (3_600_000 milliseconds) for Hobby users.++###### Parameters++| Parameter | Type | Description |+| ------ | ------ | ------ |+| `sandboxId` | `string` | sandbox ID. |+| `timeoutMs` | `number` | timeout in **milliseconds**. |+| `opts`? | `SandboxApiOpts` | connection options. |++###### Returns++`Promise`\<`void`\>++## Interfaces++### SandboxOpts++Options for creating a new Sandbox.++#### Properties++### accessToken?++```ts+optional accessToken: string;+```++E2B access token to use for authentication.++###### Default++```ts+E2B_ACCESS_TOKEN // environment variable+```++### apiKey?++```ts+optional apiKey: string;+```++E2B API key to use for authentication.++###### Default++```ts+E2B_API_KEY // environment variable+```++### debug?++```ts+optional debug: boolean;+```++**`Internal`**++If true the SDK starts in the debug mode and connects to the local envd API server.++###### Default++E2B_DEBUG // environment variable or `false`++### domain?++```ts+optional domain: string;+```++Domain to use for the API.++###### Default++E2B_DOMAIN // environment variable or `e2b.dev`++### envs?++```ts+optional envs: Record<string, string>;+```++Custom environment variables for the sandbox.++Used when executing commands and code in the sandbox.+Can be overridden with the `envs` argument when executing commands or code.++###### Default++```ts+{}+```++### logger?++```ts+optional logger: Logger;+```++Logger to use for logging messages. It can accept any object that implements `Logger` interface—for example, console.++### metadata?++```ts+optional metadata: Record<string, string>;+```++Custom metadata for the sandbox.++###### Default++```ts+{}+```++### requestTimeoutMs?++```ts+optional requestTimeoutMs: number;+```++Timeout for requests to the API in **milliseconds**.++###### Default++```ts+30_000 // 30 seconds+```++### timeoutMs?++```ts+optional timeoutMs: number;+```++Timeout for the sandbox in **milliseconds**.+Maximum time a sandbox can be kept alive is 24 hours (86_400_000 milliseconds) for Pro users and 1 hour (3_600_000 milliseconds) for Hobby users.++###### Default++```ts+300_000 // 5 minutes+```diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.jsonindex e52277305..2c533eb9f 100644--- a/packages/js-sdk/package.json+++ b/packages/js-sdk/package.json@@ -1,6 +1,6 @@{"name": "e2b",- "version": "1.0.6",+ "version": "1.0.7","description": "E2B SDK that give agents cloud environments","homepage": "https://e2b.dev","license": "MIT",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 3602b2497..3f959f546 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -80,7 +80,7 @@ importers:version: 1.1.4(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])'@sentry/nextjs':specifier: ^8.52.0- version: 8.54.0(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])+ version: 8.54.0(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected])([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])'@sindresorhus/slugify':specifier: ^2.1.1version: 2.2.1@@ -124,8 +124,8 @@ importers:specifier: ^1.2.1version: 1.2.1e2b:- specifier: ^1.0.6- version: 1.0.6+ specifier: ^1.0.7+ version: 1.0.7fast-glob:specifier: ^3.3.0version: 3.3.1@@ -155,10 +155,10 @@ importers:version: 0.1.3next:specifier: 14.2.21- version: 14.2.21(@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])+ version: 14.2.21(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])next-themes:specifier: ^0.2.1- version: 0.2.1([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])+ version: 0.2.1([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])posthog-js:specifier: ^1.148.0version: 1.148.0@@ -4236,8 +4236,8 @@ packages:resolution: {integrity: sha512-A3T56Dso60AXTJO+V0zUNecYXDQB9jv6nm94DpLuEshjlk2MfbCF99rHgYUbOp9IOmh3EBv0RdEGIY5l4zJZQA==}engines: {node: '>=18'}- resolution: {integrity: sha512-v0hc57AUnRuPiMPtfhqTIjznrL+v/VTnwd6clNovAaNdWYTT68p31ca9yrEDVgpIzcRybBLPp77bg92GHV2CWQ==}+ resolution: {integrity: sha512-7msagBbQ8tm51qaGp+hdaaaMjGG3zCzZtUS8bnz+LK7wdwtVTA1PmX+1Br9E3R7v6XIchnNWRpei+VjvGcfidA==}engines: {node: '>=18'}@@ -10649,7 +10649,7 @@ snapshots:'@sentry/[email protected]': {}- '@sentry/[email protected](@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])':+ '@sentry/[email protected](@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected])([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])':dependencies:'@opentelemetry/api': 1.9.0'@opentelemetry/semantic-conventions': 1.28.0@@ -10662,7 +10662,7 @@ snapshots:'@sentry/vercel-edge': 8.54.0'@sentry/webpack-plugin': 2.22.7([email protected])([email protected])chalk: 3.0.0- next: 14.2.21(@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])+ next: 14.2.21(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])resolve: 1.22.8rollup: 3.29.5stacktrace-parser: 0.1.10@@ -12561,7 +12561,7 @@ snapshots:openapi-fetch: 0.9.8platform: 1.3.6dependencies:'@bufbuild/protobuf': 2.2.2'@connectrpc/connect': 2.0.0-rc.3(@bufbuild/[email protected])@@ -14931,15 +14931,15 @@ snapshots:- [email protected]([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected]):+ [email protected]([email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected]):dependencies:- next: 14.2.21(@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])+ next: 14.2.21(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])react: 18.2.0react-dom: 18.2.0([email protected])- [email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected]):+ [email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected]):dependencies:'@next/env': 14.2.21'@swc/helpers': 0.5.5@@ -14949,7 +14949,7 @@ snapshots:postcss: 8.4.31react: 18.2.0react-dom: 18.2.0([email protected])- styled-jsx: 5.1.1(@babel/[email protected])([email protected])+ styled-jsx: 5.1.1([email protected])optionalDependencies:'@next/swc-darwin-arm64': 14.2.21'@next/swc-darwin-x64': 14.2.21@@ -16376,12 +16376,10 @@ snapshots:dependencies:inline-style-parser: 0.1.1dependencies:client-only: 0.0.1react: 18.2.0- optionalDependencies:- '@babel/core': 7.25.8dependencies: