From 47a559b7297da84eab8efb1bcb44b67c967777f8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 15 Oct 2024 14:40:37 +0000 Subject: [PATCH] [skip ci] Release new versions --- .../js-sdk/v0.16.2-beta.57/errors/page.mdx | 206 ++++++++ .../v0.16.2-beta.57/filesystem/page.mdx | 440 ++++++++++++++++ .../js-sdk/v0.16.2-beta.57/process/page.mdx | 27 + .../js-sdk/v0.16.2-beta.57/sandbox/page.mdx | 476 ++++++++++++++++++ packages/js-sdk/package.json | 2 +- packages/python-sdk/pyproject.toml | 2 +- 6 files changed, 1151 insertions(+), 2 deletions(-) create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/errors/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/filesystem/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/process/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/sandbox/page.mdx diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/errors/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/errors/page.mdx new file mode 100644 index 000000000..5f2546641 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/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 + +Thrown when a sandbox error occurs. + +Base class for all sandbox errors. + +#### 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 process, 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:2 diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/filesystem/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/filesystem/page.mdx new file mode 100644 index 000000000..c206954e7 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/filesystem/page.mdx @@ -0,0 +1,440 @@ +# sandbox/filesystem + +## Enumerations + +### FileType + +Type of filesystem object. + +#### Enumeration Members + +##### DIR + +> **DIR**: `"dir"` + +###### Defined in + +sandbox/filesystem/index.ts:40 + +##### FILE + +> **FILE**: `"file"` + +###### Defined in + +sandbox/filesystem/index.ts:39 + +## Classes + +### Filesystem + +Manager for interacting with the filesystem in the sandbox. + +#### Constructors + +##### new Filesystem() + +> **new Filesystem**(`transport`, `envdApi`, `connectionConfig`): `Filesystem` + +###### Parameters + +• **transport**: `Transport` + +• **envdApi**: `EnvdApiClient` + +• **connectionConfig**: `ConnectionConfig` + +###### Returns + +`Filesystem` + +###### Defined in + +sandbox/filesystem/index.ts:76 + +#### Methods + +##### exists() + +> **exists**(`path`, `opts`?): `Promise`\<`boolean`\> + +Checks if a file or a directory exists. + +###### Parameters + +• **path**: `string` + +Path to a file or a directory + +• **opts?**: `FilesystemRequestOpts` + +Options for the request + +###### Returns + +`Promise`\<`boolean`\> + +True if the file or directory exists, false otherwise + +###### Defined in + +sandbox/filesystem/index.ts:325 + +##### list() + +> **list**(`path`, `opts`?): `Promise`\<`EntryInfo`[]\> + +Lists entries in a directory. + +###### Parameters + +• **path**: `string` + +Path to the directory + +• **opts?**: `FilesystemRequestOpts` + +Options for the request + +###### Returns + +`Promise`\<`EntryInfo`[]\> + +List of entries in the directory + +###### Defined in + +sandbox/filesystem/index.ts:200 + +##### makeDir() + +> **makeDir**(`path`, `opts`?): `Promise`\<`boolean`\> + +Creates a new directory and all directories along the way if needed on the specified pth. + +###### Parameters + +• **path**: `string` + +Path to a new directory. For example '/dirA/dirB' when creating 'dirB'. + +• **opts?**: `FilesystemRequestOpts` + +Options for the request + +###### Returns + +`Promise`\<`boolean`\> + +True if the directory was created, false if it already exists + +###### Defined in + +sandbox/filesystem/index.ts:237 + +##### read() + +###### read(path, opts) + +> **read**(`path`, `opts`?): `Promise`\<`string`\> + +Reads a whole file content and returns it in requested format (text by default). + +###### Parameters + +• **path**: `string` + +Path to the file + +• **opts?**: `FilesystemRequestOpts` & `object` + +Options for the request + +###### Returns + +`Promise`\<`string`\> + +File content in requested format + +###### Defined in + +sandbox/filesystem/index.ts:92 + +###### read(path, opts) + +> **read**(`path`, `opts`?): `Promise`\<`Uint8Array`\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` & `object` + +###### Returns + +`Promise`\<`Uint8Array`\> + +###### Defined in + +sandbox/filesystem/index.ts:96 + +###### read(path, opts) + +> **read**(`path`, `opts`?): `Promise`\<`Blob`\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` & `object` + +###### Returns + +`Promise`\<`Blob`\> + +###### Defined in + +sandbox/filesystem/index.ts:100 + +###### read(path, opts) + +> **read**(`path`, `opts`?): `Promise`\<`ReadableStream`\<`Uint8Array`\>\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` & `object` + +###### Returns + +`Promise`\<`ReadableStream`\<`Uint8Array`\>\> + +###### Defined in + +sandbox/filesystem/index.ts:104 + +##### remove() + +> **remove**(`path`, `opts`?): `Promise`\<`void`\> + +Removes a file or a directory. + +###### Parameters + +• **path**: `string` + +Path to a file or a directory + +• **opts?**: `FilesystemRequestOpts` + +Options for the request + +###### Returns + +`Promise`\<`void`\> + +###### Defined in + +sandbox/filesystem/index.ts:304 + +##### rename() + +> **rename**(`oldPath`, `newPath`, `opts`?): `Promise`\<`EntryInfo`\> + +Renames a file or directory from one path to another. + +###### Parameters + +• **oldPath**: `string` + +Path to the file or directory to move + +• **newPath**: `string` + +Path to move the file or directory to + +• **opts?**: `FilesystemRequestOpts` + +Options for the request + +###### Returns + +`Promise`\<`EntryInfo`\> + +Information about the moved object + +###### Defined in + +sandbox/filesystem/index.ts:267 + +##### watchDir() + +> **watchDir**(`path`, `onEvent`, `opts`?): `Promise`\<`WatchHandle`\> + +Watches directory for filesystem events. + +###### Parameters + +• **path**: `string` + +Path to a directory that will be watched + +• **onEvent** + +Callback that will be called when an event in the directory occurs + +• **opts?**: `FilesystemRequestOpts` & `object` + +Options for the request + +###### Returns + +`Promise`\<`WatchHandle`\> + +New watcher + +###### Defined in + +sandbox/filesystem/index.ts:355 + +##### write() + +> **write**(`path`, `data`, `opts`?): `Promise`\<`EntryInfo`\> + +Writes content to a file on the path. + When writing to a file that doesn't exist, the file will get created. + When writing to a file that already exists, the file will get overwritten. + When writing to a file that's in a directory that doesn't exist, the directory will get created. + +###### Parameters + +• **path**: `string` + +Path to a new file. For example '/dirA/dirB/newFile.txt' when creating 'newFile.txt' + +• **data**: `string` \| `ArrayBuffer` \| `Blob` \| `ReadableStream`\<`any`\> + +Data to write to a new file + +• **opts?**: `FilesystemRequestOpts` + +Options for the request + +###### Returns + +`Promise`\<`EntryInfo`\> + +Information about the written file + +###### Defined in + +sandbox/filesystem/index.ts:155 + +## Interfaces + +### EntryInfo + +Information about a filesystem object. + +#### Properties + +##### name + +> **name**: `string` + +###### Defined in + +sandbox/filesystem/index.ts:30 + +##### path + +> **path**: `string` + +###### Defined in + +sandbox/filesystem/index.ts:32 + +##### type? + +> `optional` **type**: `FileType` + +###### Defined in + +sandbox/filesystem/index.ts:31 + +*** + +### FilesystemRequestOpts + +Options for sending a request to the filesystem. + +#### Extended by + +- `WatchOpts` + +#### Properties + +##### requestTimeoutMs? + +> `optional` **requestTimeoutMs**: `number` + +###### Defined in + +connectionConfig.ts:17 + +##### user? + +> `optional` **user**: `Username` + +###### Defined in + +sandbox/filesystem/index.ts:57 + +*** + +### WatchOpts + +Options for watching a directory. + +#### Properties + +##### onExit()? + +> `optional` **onExit**: (`err`) => `void` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`void` + +###### Defined in + +sandbox/filesystem/index.ts:65 + +##### requestTimeoutMs? + +> `optional` **requestTimeoutMs**: `number` + +###### Defined in + +connectionConfig.ts:17 + +##### timeout? + +> `optional` **timeout**: `number` + +###### Defined in + +sandbox/filesystem/index.ts:64 + +##### user? + +> `optional` **user**: `Username` + +###### Defined in + +sandbox/filesystem/index.ts:57 diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/process/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/process/page.mdx new file mode 100644 index 000000000..2adf95f20 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/process/page.mdx @@ -0,0 +1,27 @@ +# sandbox/process + +## References + +### Process + +Re-exports Process + +### ProcessConnectOpts + +Re-exports ProcessConnectOpts + +### ProcessInfo + +Re-exports ProcessInfo + +### ProcessRequestOpts + +Re-exports ProcessRequestOpts + +### ProcessStartOpts + +Re-exports ProcessStartOpts + +### Pty + +Re-exports Pty diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/sandbox/page.mdx new file mode 100644 index 000000000..3e32d22a1 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.57/sandbox/page.mdx @@ -0,0 +1,476 @@ +# sandbox + +## Classes + +### Sandbox + +E2B cloud sandbox gives your agent a full cloud development environment that's sandboxed. + +That means: +- Access to Linux OS +- Using filesystem (create, list, and delete files and dirs) +- Run commands +- Sandboxed - you can run any code +- Access to the internet + +Check usage docs - https://e2b.dev/docs/sandbox/overview + +These cloud sandboxes are meant to be used for agents. Like a sandboxed playgrounds, where the agent can do whatever it wants. + +Use the Sandbox.create method to create a new sandbox. + +#### Example + +```ts +import { Sandbox } from '@e2b/sdk' + +const sandbox = await Sandbox.create() +``` + +#### Properties + +##### commands + +> `readonly` **commands**: `Process` + +Commands module for interacting with the sandbox's processes + +###### Defined in + +sandbox/index.ts:57 + +##### files + +> `readonly` **files**: `Filesystem` + +Filesystem module for interacting with the sandbox's filesystem + +###### Defined in + +sandbox/index.ts:53 + +##### pty + +> `readonly` **pty**: `Pty` + +PTY module for interacting with the sandbox's pseudo-terminal + +###### Defined in + +sandbox/index.ts:61 + +##### sandboxId + +> `readonly` **sandboxId**: `string` + +Unique identifier of the sandbox. + +###### Defined in + +sandbox/index.ts:66 + +#### Methods + +##### downloadUrl() + +> **downloadUrl**(`path`): `string` + +Get the URL to download a file from the sandbox. + +###### Parameters + +• **path**: `string` + +Path to the file + +###### Returns + +`string` + +URL to download the file + +###### Defined in + +sandbox/index.ts:297 + +##### getHost() + +> **getHost**(`port`): `string` + +Get the hostname for the specified sandbox's port. + +###### Parameters + +• **port**: `number` + +Port number of a specific port in the sandbox + +###### Returns + +`string` + +Hostname of the sandbox's 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:198 + +##### 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:219 + +##### kill() + +> **kill**(`opts`?): `Promise`\<`void`\> + +Kill the sandbox. + +###### Parameters + +• **opts?**: `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\> + +Connection options + +###### Returns + +`Promise`\<`void`\> + +Promise that resolves when the sandbox is killed + +###### Defined in + +sandbox/index.ts:270 + +##### setTimeout() + +> **setTimeout**(`timeoutMs`, `opts`?): `Promise`\<`void`\> + +Set the sandbox's timeout, after which the sandbox will be automatically killed. +The sandbox can be kept alive for a maximum of 24 hours from the time of creation. +If you try to set the timeout to a period, which exceeds the maximum limit, the timeout will be set to the maximum limit. + +###### Parameters + +• **timeoutMs**: `number` + +Duration in milliseconds. Must be between 0 and 86400000 milliseconds (24 hours). + +• **opts?**: `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\> + +Connection options + +###### Returns + +`Promise`\<`void`\> + +Promise that resolves when the sandbox is kept alive + +###### Defined in + +sandbox/index.ts:249 + +##### 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 the field in the form data. +You can find the specification for this API at https://github.com/e2b-dev/E2B/blob/main/spec/envd/envd.yaml. + +###### Parameters + +• **path?**: `string` + +Path to the directory where the file will be uploaded, defaults to user's home directory + +###### Returns + +`string` + +URL to upload the file + +###### Defined in + +sandbox/index.ts:287 + +##### connect() + +> `static` **connect**\<`S`\>(`this`, `sandboxId`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\> + +Connects to an existing Sandbox. + +###### Type Parameters + +• **S** *extends* *typeof* `Sandbox` + +###### Parameters + +• **this**: `S` + +• **sandboxId**: `string` + +Sandbox ID + +• **opts?**: `Omit`\<`SandboxOpts`, `"metadata"` \| `"envs"` \| `"timeoutMs"`\> + +Connection options + +###### Returns + +`Promise`\<`InstanceType`\<`S`\>\> + +Existing Sandbox + +###### Example + +```ts +const sandbox = await Sandbox.create() +const sandboxId = sandbox.sandboxId + +// Another code block +const sameSandbox = await Sandbox.connect(sandboxId) +``` + +###### Defined in + +sandbox/index.ts:173 + +##### create() + +###### create(this, opts) + +> `static` **create**\<`S`\>(`this`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\> + +Creates 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`\>\> + +New Sandbox + +###### Example + +```ts +const sandbox = await Sandbox.create() +``` + +###### Constructs + +Sandbox + +###### Defined in + +sandbox/index.ts:125 + +###### create(this, template, opts) + +> `static` **create**\<`S`\>(`this`, `template`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\> + +###### Type Parameters + +• **S** *extends* *typeof* `Sandbox` + +###### Parameters + +• **this**: `S` + +• **template**: `string` + +• **opts?**: `SandboxOpts` + +###### Returns + +`Promise`\<`InstanceType`\<`S`\>\> + +###### Defined in + +sandbox/index.ts:129 + +##### kill() + +> `static` **kill**(`sandboxId`, `opts`?): `Promise`\<`boolean`\> + +Kills sandbox specified by sandbox ID. + +###### Parameters + +• **sandboxId**: `string` + +Sandbox ID. + +• **opts?**: `SandboxApiOpts` + +Connection options. + +###### Returns + +`Promise`\<`boolean`\> + +###### Defined in + +sandbox/sandboxApi.ts:53 + +##### list() + +> `static` **list**(`opts`?): `Promise`\<`SandboxInfo`[]\> + +###### Parameters + +• **opts?**: `SandboxApiOpts` + +###### Returns + +`Promise`\<`SandboxInfo`[]\> + +###### Defined in + +sandbox/sandboxApi.ts:81 + +##### setTimeout() + +> `static` **setTimeout**(`sandboxId`, `timeoutMs`, `opts`?): `Promise`\<`void`\> + +###### Parameters + +• **sandboxId**: `string` + +• **timeoutMs**: `number` + +• **opts?**: `SandboxApiOpts` + +###### Returns + +`Promise`\<`void`\> + +###### Defined in + +sandbox/sandboxApi.ts:108 + +## Interfaces + +### SandboxOpts + +Options for creating a new Sandbox. + +#### Properties + +##### accessToken? + +> `optional` **accessToken**: `string` + +###### Defined in + +connectionConfig.ts:14 + +##### apiKey? + +> `optional` **apiKey**: `string` + +###### Defined in + +connectionConfig.ts:13 + +##### debug? + +> `optional` **debug**: `boolean` + +###### Defined in + +connectionConfig.ts:16 + +##### domain? + +> `optional` **domain**: `string` + +###### Defined in + +connectionConfig.ts:15 + +##### envs? + +> `optional` **envs**: `Record`\<`string`, `string`\> + +###### Defined in + +sandbox/index.ts:19 + +##### logger? + +> `optional` **logger**: `Logger` + +###### Defined in + +connectionConfig.ts:18 + +##### metadata? + +> `optional` **metadata**: `Record`\<`string`, `string`\> + +###### Defined in + +sandbox/index.ts:18 + +##### requestTimeoutMs? + +> `optional` **requestTimeoutMs**: `number` + +###### Defined in + +connectionConfig.ts:17 + +##### timeoutMs? + +> `optional` **timeoutMs**: `number` + +###### Defined in + +sandbox/index.ts:20 diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.json index 96c41b0ae..2adbe2ce9 100644 --- a/packages/js-sdk/package.json +++ b/packages/js-sdk/package.json @@ -1,6 +1,6 @@ { "name": "e2b", - "version": "0.16.2-beta.56", + "version": "0.16.2-beta.57", "description": "E2B SDK that give agents cloud environments", "homepage": "https://e2b.dev", "license": "MIT", diff --git a/packages/python-sdk/pyproject.toml b/packages/python-sdk/pyproject.toml index 1f36ee4f8..3b8bbf6b7 100644 --- a/packages/python-sdk/pyproject.toml +++ b/packages/python-sdk/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "e2b" -version = "0.17.2a60" +version = "0.17.2a61" description = "E2B SDK that give agents cloud environments" authors = ["e2b "] license = "MIT"