Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix permissions and fix missing files from release
Jakub Novakd051dfd699fc
diff --git a/.changeset/pink-years-rush.md b/.changeset/pink-years-rush.mddeleted file mode 100644index d406299fa..000000000--- a/.changeset/pink-years-rush.md+++ /dev/null@@ -1,5 +0,0 @@-----'e2b': patch------Handle rate limit errorsdiff --git a/.github/workflows/publish_packages.yml b/.github/workflows/publish_packages.ymlindex 78391c29b..cac3a3790 100644--- a/.github/workflows/publish_packages.yml+++ b/.github/workflows/publish_packages.yml@@ -11,7 +11,7 @@ on:required: truepermissions:- contents: read+ contents: writejobs:test:diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/errors/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/errors/page.mdxnew file mode 100644index 000000000..30340427c--- /dev/null+++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/errors/page.mdx@@ -0,0 +1,206 @@+# errors++## Classes++### AuthenticationError++Thrown when authentication fails.++#### Constructors++##### new AuthenticationError()++> **new AuthenticationError**(`message`): `AuthenticationError`++###### Parameters++• **message**: `any`++###### Returns++`AuthenticationError`++###### Defined in++errors.ts:72++***++### InvalidArgumentError++Thrown when an invalid argument is provided.++#### Constructors++##### new InvalidArgumentError()++> **new InvalidArgumentError**(`message`): `InvalidArgumentError`++###### Parameters++• **message**: `string`++###### Returns++`InvalidArgumentError`++###### Defined in++errors.ts:42++***++### NotEnoughSpaceError++Thrown when there is not enough disk space.++#### Constructors++##### new NotEnoughSpaceError()++> **new NotEnoughSpaceError**(`message`): `NotEnoughSpaceError`++###### Parameters++• **message**: `string`++###### Returns++`NotEnoughSpaceError`++###### Defined in++errors.ts:52++***++### NotFoundError++Thrown when a resource is not found.++#### Constructors++##### new NotFoundError()++> **new NotFoundError**(`message`): `NotFoundError`++###### Parameters++• **message**: `string`++###### Returns++`NotFoundError`++###### Defined in++errors.ts:62++***++### SandboxError++Base class for all sandbox errors.++Thrown when general sandbox errors occur.++#### Extended by++- `TimeoutError`+- `InvalidArgumentError`+- `NotEnoughSpaceError`+- `NotFoundError`+- `AuthenticationError`+- `TemplateError`++#### Constructors++##### new SandboxError()++> **new SandboxError**(`message`): `SandboxError`++###### Parameters++• **message**: `any`++###### Returns++`SandboxError`++###### Defined in++errors.ts:14++***++### TemplateError++Thrown when the template uses old envd version. It isn't compatible with the new SDK.++#### Constructors++##### new TemplateError()++> **new TemplateError**(`message`): `TemplateError`++###### Parameters++• **message**: `string`++###### Returns++`TemplateError`++###### Defined in++errors.ts:82++***++### 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++##### new TimeoutError()++> **new TimeoutError**(`message`): `TimeoutError`++###### Parameters++• **message**: `string`++###### Returns++`TimeoutError`++###### Defined in++errors.ts:32++## Functions++### formatSandboxTimeoutError()++> **formatSandboxTimeoutError**(`message`): `TimeoutError`++#### Parameters++• **message**: `string`++#### Returns++`TimeoutError`++#### Defined in++errors.ts:2diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/filesystem/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/filesystem/page.mdxnew file mode 100644index 000000000..33edf075d--- /dev/null+++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/filesystem/page.mdx@@ -0,0 +1,518 @@+# sandbox/filesystem++## Enumerations++### FileType++Sandbox filesystem object type.++#### Enumeration Members++##### DIR++> **DIR**: `"dir"`++Filesystem object is a directory.++###### Defined in++sandbox/filesystem/index.ts:55++##### FILE++> **FILE**: `"file"`++Filesystem object is a file.++###### Defined in++sandbox/filesystem/index.ts:51++## Classes++### Filesystem++Module for interacting with the sandbox filesystem.++#### Constructors++##### new Filesystem()++> **new Filesystem**(`transport`, `envdApi`, `connectionConfig`): `Filesystem`++###### Parameters++• **transport**: `Transport`++• **envdApi**: `EnvdApiClient`++• **connectionConfig**: `ConnectionConfig`++###### Returns++`Filesystem`++###### Defined in++sandbox/filesystem/index.ts:104++#### Methods++##### exists()++> **exists**(`path`, `opts`?): `Promise`\<`boolean`\>++Check if a file or a directory exists.++###### Parameters++• **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++###### Defined in++sandbox/filesystem/index.ts:399++##### list()++> **list**(`path`, `opts`?): `Promise`\<`EntryInfo`[]\>++List entries in a directory.++###### Parameters++• **path**: `string`++path to the directory.++• **opts?**: `FilesystemRequestOpts`++connection options.++###### Returns++`Promise`\<`EntryInfo`[]\>++list of entries in the sandbox filesystem directory.++###### Defined in++sandbox/filesystem/index.ts:270++##### makeDir()++> **makeDir**(`path`, `opts`?): `Promise`\<`boolean`\>++Create a new directory and all directories along the way if needed on the specified path.++###### Parameters++• **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.++###### Defined in++sandbox/filesystem/index.ts:308++##### read()++###### read(path, opts)++> **read**(`path`, `opts`?): `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++• **path**: `string`++path to the file.++• **opts?**: `FilesystemRequestOpts` & `object`++connection options.++###### Returns++`Promise`\<`string`\>++file content as string++###### Defined in++sandbox/filesystem/index.ts:123++###### read(path, opts)++> **read**(`path`, `opts`?): `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++• **path**: `string`++path to the file.++• **opts?**: `FilesystemRequestOpts` & `object`++connection options.++###### Returns++`Promise`\<`Uint8Array`\>++file content as `Uint8Array`++###### Defined in++sandbox/filesystem/index.ts:138++###### read(path, opts)++> **read**(`path`, `opts`?): `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++• **path**: `string`++path to the file.++• **opts?**: `FilesystemRequestOpts` & `object`++connection options.++###### Returns++`Promise`\<`Blob`\>++file content as `Blob`++###### Defined in++sandbox/filesystem/index.ts:153++###### read(path, opts)++> **read**(`path`, `opts`?): `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++• **path**: `string`++path to the file.++• **opts?**: `FilesystemRequestOpts` & `object`++connection options.++###### Returns++`Promise`\<`ReadableStream`\<`Uint8Array`\>\>++file content as `ReadableStream`++###### Defined in++sandbox/filesystem/index.ts:168++##### remove()++> **remove**(`path`, `opts`?): `Promise`\<`void`\>++Remove a file or directory.++###### Parameters++• **path**: `string`++path to a file or directory.++• **opts?**: `FilesystemRequestOpts`++connection options.++###### Returns++`Promise`\<`void`\>++###### Defined in++sandbox/filesystem/index.ts:377++##### rename()++> **rename**(`oldPath`, `newPath`, `opts`?): `Promise`\<`EntryInfo`\>++Rename a file or directory.++###### Parameters++• **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.++###### Defined in++sandbox/filesystem/index.ts:339++##### watchDir()++> **watchDir**(`path`, `onEvent`, `opts`?): `Promise`\<`WatchHandle`\>++Start watching a directory for filesystem events.++###### Parameters++• **path**: `string`++path to directory to watch.++• **onEvent**++callback to call when an event in the directory occurs.++• **opts?**: `WatchOpts`++connection options.++###### Returns++`Promise`\<`WatchHandle`\>++`WatchHandle` object for stopping watching directory.++###### Defined in++sandbox/filesystem/index.ts:430++##### write()++> **write**(`path`, `data`, `opts`?): `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++• **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++###### Defined in++sandbox/filesystem/index.ts:224++## Interfaces++### EntryInfo++Sandbox filesystem object information.++#### Properties++##### name++> **name**: `string`++Name of the filesystem object.++###### Defined in++sandbox/filesystem/index.ts:33++##### path++> **path**: `string`++Path to the filesystem object.++###### Defined in++sandbox/filesystem/index.ts:41++##### type?++> `optional` **type**: `FileType`++Type of the filesystem object.++###### Defined in++sandbox/filesystem/index.ts:37++***++### FilesystemRequestOpts++Options for the sandbox filesystem operations.++#### Extended by++- `WatchOpts`++#### Properties++##### requestTimeoutMs?++> `optional` **requestTimeoutMs**: `number`++Timeout for requests to the API in **milliseconds**.++###### Default++```ts+30_000 // 30 seconds+```++###### Defined in++connectionConfig.ts:42++##### user?++> `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.++###### Defined in++sandbox/filesystem/index.ts:76++***++### WatchOpts++Options for watching a directory.++#### Properties++##### onExit()?++> `optional` **onExit**: (`err`?) => `void` \| `Promise`\<`void`\>++Callback to call when the watch operation stops.++###### Parameters++• **err?**: `Error`++###### Returns++`void` \| `Promise`\<`void`\>++###### Defined in++sandbox/filesystem/index.ts:93++##### requestTimeoutMs?++> `optional` **requestTimeoutMs**: `number`++Timeout for requests to the API in **milliseconds**.++###### Default++```ts+30_000 // 30 seconds+```++###### Defined in++connectionConfig.ts:42++##### timeoutMs?++> `optional` **timeoutMs**: `number`++Timeout for the watch operation in **milliseconds**.+You can pass `0` to disable the timeout.++###### Default++```ts+60_000 // 60 seconds+```++###### Defined in++sandbox/filesystem/index.ts:89++##### user?++> `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.++###### Defined in++sandbox/filesystem/index.ts:76diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/sandbox/page.mdxnew file mode 100644index 000000000..6c4cae338--- /dev/null+++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v1.0.2/sandbox/page.mdx@@ -0,0 +1,581 @@+# sandbox++## Classes++### 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++##### commands++> `readonly` **commands**: `Commands`++Module for running commands in the sandbox++###### Defined in++sandbox/index.ts:74++##### files++> `readonly` **files**: `Filesystem`++Module for interacting with the sandbox filesystem++###### Defined in++sandbox/index.ts:70++##### pty++> `readonly` **pty**: `Pty`++Module for interacting with the sandbox pseudo-terminals++###### Defined in++sandbox/index.ts:78++##### sandboxId++> `readonly` **sandboxId**: `string`++Unique identifier of the sandbox.++###### Defined in++sandbox/index.ts:83++#### Methods++##### downloadUrl()++> **downloadUrl**(`path`): `string`++Get the URL to download a file from the sandbox.++###### Parameters++• **path**: `string`++path to the file to download.++###### Returns++`string`++URL for downloading file.++###### Defined in++sandbox/index.ts:339++##### getHost()++> **getHost**(`port`): `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++• **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)+``++###### Defined in++sandbox/index.ts:237++##### isRunning()++> **isRunning**(`opts`?): `Promise`\<`boolean`\>++Check if the sandbox is running.++###### Parameters++• **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+```++###### Defined in++sandbox/index.ts:259++##### kill()++> **kill**(`opts`?): `Promise`\<`void`\>++Kill the sandbox.++###### Parameters++• **opts?**: `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\>++connection options.++###### Returns++`Promise`\<`void`\>++###### Defined in++sandbox/index.ts:310++##### setTimeout()++> **setTimeout**(`timeoutMs`, `opts`?): `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++• **timeoutMs**: `number`++timeout in **milliseconds**.++• **opts?**: `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\>++connection options.++###### Returns++`Promise`\<`void`\>++###### Defined in++sandbox/index.ts:290++##### uploadUrl()++> **uploadUrl**(`path`?): `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++• **path?**: `string`++the directory where to upload the file, defaults to user's home directory.++###### Returns++`string`++URL for uploading file.++###### Defined in++sandbox/index.ts:328++##### connect()++> `static` **connect**\<`S`\>(`this`, `sandboxId`, `opts`?): `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++• **S** *extends* *typeof* `Sandbox`++###### Parameters++• **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)+```++###### Defined in++sandbox/index.ts:209++##### create()++###### create(this, opts)++> `static` **create**\<`S`\>(`this`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\>++Create a new sandbox from the default `base` sandbox template.++###### Type Parameters++• **S** *extends* *typeof* `Sandbox`++###### Parameters++• **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++###### Defined in++sandbox/index.ts:143++###### create(this, template, opts)++> `static` **create**\<`S`\>(`this`, `template`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\>++Create a new sandbox from the specified sandbox template.++###### Type Parameters++• **S** *extends* *typeof* `Sandbox`++###### Parameters++• **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++###### Defined in++sandbox/index.ts:162++##### kill()++> `static` **kill**(`sandboxId`, `opts`?): `Promise`\<`boolean`\>++Kill the sandbox specified by sandbox ID.++###### Parameters++• **sandboxId**: `string`++sandbox ID.++• **opts?**: `SandboxApiOpts`++connection options.++###### Returns++`Promise`\<`boolean`\>++`true` if the sandbox was found and killed, `false` otherwise.++###### Defined in++sandbox/sandboxApi.ts:55++##### list()++> `static` **list**(`opts`?): `Promise`\<`SandboxInfo`[]\>++List all running sandboxes.++###### Parameters++• **opts?**: `SandboxApiOpts`++connection options.++###### Returns++`Promise`\<`SandboxInfo`[]\>++list of running sandboxes.++###### Defined in++sandbox/sandboxApi.ts:90++##### setTimeout()++> `static` **setTimeout**(`sandboxId`, `timeoutMs`, `opts`?): `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++• **sandboxId**: `string`++sandbox ID.++• **timeoutMs**: `number`++timeout in **milliseconds**.++• **opts?**: `SandboxApiOpts`++connection options.++###### Returns++`Promise`\<`void`\>++###### Defined in++sandbox/sandboxApi.ts:129++## Interfaces++### SandboxOpts++Options for creating a new Sandbox.++#### Properties++##### accessToken?++> `optional` **accessToken**: `string`++E2B access token to use for authentication.++###### Default++```ts+E2B_ACCESS_TOKEN // environment variable+```++###### Defined in++connectionConfig.ts:24++##### apiKey?++> `optional` **apiKey**: `string`++E2B API key to use for authentication.++###### Default++```ts+E2B_API_KEY // environment variable+```++###### Defined in++connectionConfig.ts:18++##### debug?++> `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`++###### Defined in++connectionConfig.ts:36++##### domain?++> `optional` **domain**: `string`++Domain to use for the API.++###### Default++E2B_DOMAIN // environment variable or `e2b.dev`++###### Defined in++connectionConfig.ts:30++##### envs?++> `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+{}+```++###### Defined in++sandbox/index.ts:32++##### logger?++> `optional` **logger**: `Logger`++Logger to use for logging messages. It can accept any object that implements `Logger` interface—for example, console.++###### Defined in++connectionConfig.ts:46++##### metadata?++> `optional` **metadata**: `Record`\<`string`, `string`\>++Custom metadata for the sandbox.++###### Default++```ts+{}+```++###### Defined in++sandbox/index.ts:23++##### requestTimeoutMs?++> `optional` **requestTimeoutMs**: `number`++Timeout for requests to the API in **milliseconds**.++###### Default++```ts+30_000 // 30 seconds+```++###### Defined in++connectionConfig.ts:42++##### timeoutMs?++> `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+```++###### Defined in++sandbox/index.ts:39diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.jsonindex 35e42c9fc..5d2df2285 100644--- a/packages/js-sdk/package.json+++ b/packages/js-sdk/package.json@@ -1,6 +1,6 @@{"name": "e2b",- "version": "1.0.1",+ "version": "1.0.2","description": "E2B SDK that give agents cloud environments","homepage": "https://e2b.dev","license": "MIT",