From fa90994e4926b653c44a8ae77b39be34aee940bd Mon Sep 17 00:00:00 2001 From: 0div Date: Fri, 20 Sep 2024 18:03:32 +0200 Subject: [PATCH 01/29] [squashed many commits] GH actions workflow for API ref autogen --- .github/scripts/is_new_api_ref.sh | 11 + .github/workflows/generate_api_ref.yml | 109 ++++++ .github/workflows/release.yml | 2 +- .gitignore | 3 + .../api-reference/cli/v0.5.8/auth/page.mdx | 58 +++ .../api-reference/cli/v0.5.8/sandbox/page.mdx | 84 ++++ .../cli/v0.5.8/template/page.mdx | 90 +++++ .../js-sdk/v0.16.2-beta.51/errors/page.mdx | 206 ++++++++++ .../v0.16.2-beta.51/filesystem/page.mdx | 359 +++++++++++++++++ .../js-sdk/v0.16.2-beta.51/process/page.mdx | 23 ++ .../js-sdk/v0.16.2-beta.51/pty/page.mdx | 165 ++++++++ .../js-sdk/v0.16.2-beta.51/sandbox/page.mdx | 367 ++++++++++++++++++ .../python-sdk/v0.17.1/exceptions/page.mdx | 75 ++++ .../python-sdk/v0.17.1/sandbox_async/page.mdx | 337 ++++++++++++++++ .../python-sdk/v0.17.1/sandbox_sync/page.mdx | 347 +++++++++++++++++ packages/cli/scripts/generate_api_ref.sh | 26 +- packages/js-sdk/scripts/generate_api_ref.sh | 43 +- .../python-sdk/e2b/sandbox_async/pty/main.py | 16 +- .../python-sdk/e2b/sandbox_sync/pty/main.py | 4 + .../python-sdk/scripts/generate_api_ref.sh | 19 +- pnpm-lock.yaml | 326 +++++++++++++++- 21 files changed, 2621 insertions(+), 49 deletions(-) create mode 100755 .github/scripts/is_new_api_ref.sh create mode 100644 .github/workflows/generate_api_ref.yml create mode 100644 apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/auth/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/sandbox/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/template/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/errors/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/filesystem/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/process/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/pty/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/sandbox/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/exceptions/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx diff --git a/.github/scripts/is_new_api_ref.sh b/.github/scripts/is_new_api_ref.sh new file mode 100755 index 000000000..9e2400285 --- /dev/null +++ b/.github/scripts/is_new_api_ref.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# This script checks for diffs in the packages directory. +# If there are diffs, it means we need to generate a new API references. +if git diff --name-only HEAD^ | grep -q '^packages/'; then + echo "true" +else + echo "false" +fi diff --git a/.github/workflows/generate_api_ref.yml b/.github/workflows/generate_api_ref.yml new file mode 100644 index 000000000..93428b5cd --- /dev/null +++ b/.github/workflows/generate_api_ref.yml @@ -0,0 +1,109 @@ +name: Generate SDK API references + +on: + workflow_dispatch: + push: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +permissions: + contents: write + +jobs: + is_new_api_ref: + name: Is new API reference? + runs-on: ubuntu-latest + outputs: + new_api_ref: ${{ steps.sdk-changes.outputs.new_api_ref }} + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Check if SDK changes + id: sdk-changes + run: | + IS_NEW_API_REF=$(./.github/scripts/is_new_api_ref.sh) + echo "new_api_ref=$IS_NEW_API_REF" >> "$GITHUB_OUTPUT" + + sdk-changes: + name: SDK changes + needs: [is_new_api_ref] + if: always() + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v3 + id: pnpm-install + with: + version: 9.5 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "18.x" + registry-url: "https://registry.npmjs.org" + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + + - name: Configure pnpm + run: | + pnpm config set auto-install-peers true + pnpm config set exclude-links-from-lockfile true + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Set up Python + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + version: 1.5.1 + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Install dependencies + working-directory: ./packages/python-sdk + run: poetry install --no-interaction --no-root + + - name: Generate Python SDK API reference + id: python-sdk-api-ref + working-directory: ./packages/python-sdk + run: | + source .venv/bin/activate + ./scripts/generate_api_ref.sh + + - name: Generate JS SDK API reference + id: js-sdk-api-ref + working-directory: packages/js-sdk + run: ./scripts/generate_api_ref.sh + + - name: Generate CLI API reference + id: cli-api-ref + working-directory: packages/cli + run: ./scripts/generate_api_ref.sh + + - name: Show docs file structure + run: tree apps/web/src/app/\(docs\)/docs/api-reference + + - name: Commit new SDK API reference versions + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add apps/web/src/app/\(docs\)/docs/api-reference + git commit -m "[skip ci] Release new SDK API reference doc versions" + git push \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb1cee5e8..604210e8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -115,7 +115,7 @@ jobs: secrets: inherit release: - needs: [python-tests, js-tests, cli-tests] + needs: [is_release, python-tests, js-tests, cli-tests] if: always() && !contains(needs.*.result, 'failure') && needs.is_release.outputs.release == 'true' name: Release runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 8e12639e8..d2dd8fc7e 100644 --- a/.gitignore +++ b/.gitignore @@ -287,3 +287,6 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ + +# API reference artifacts +api_ref/ diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/auth/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/auth/page.mdx new file mode 100644 index 000000000..5e547262c --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/auth/page.mdx @@ -0,0 +1,58 @@ +# e2b auth + + +authentication commands + +## Usage + +```bash +e2b auth [options] [command] +``` +# e2b auth login + + +log in to CLI + +## Usage + +```bash +e2b auth login [options] +``` + + +# e2b auth logout + + +log out of CLI + +## Usage + +```bash +e2b auth logout [options] +``` + + +# e2b auth info + + +get information about the current user + +## Usage + +```bash +e2b auth info [options] +``` + + +# e2b auth configure + + +configure user + +## Usage + +```bash +e2b auth configure [options] +``` + + diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/sandbox/page.mdx new file mode 100644 index 000000000..060e6969c --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/sandbox/page.mdx @@ -0,0 +1,84 @@ +# e2b sandbox + + +work with sandboxes + +## Usage + +```bash +e2b sandbox [options] [command] +``` +# e2b sandbox connect + + +connect terminal to already running sandbox + +## Usage + +```bash +e2b sandbox connect [options] +``` + + +# e2b sandbox list + + +list all running sandboxes + +## Usage + +```bash +e2b sandbox list [options] +``` + + +# e2b sandbox kill + + +kill sandbox + +## Usage + +```bash +e2b sandbox kill [options] +``` + + +# e2b sandbox spawn + + +spawn sandbox and connect terminal to it + +## Usage + +```bash +e2b sandbox spawn [options] [template] +``` + +## Options + + + - `-p, --path : change root directory where command is executed to directory ` + - `--config : specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. ` + + +# e2b sandbox logs + + +show logs for sandbox + +## Usage + +```bash +e2b sandbox logs [options] +``` + +## Options + + + - `--level : filter logs by level (DEBUG, INFO, WARN, ERROR). The logs with the higher levels will be also shown. [default: INFO]` + - `-f, --follow: keep streaming logs until the sandbox is closed ` + - `--format : specify format for printing logs (json, pretty) [default: pretty]` + - `--loggers [loggers]: filter logs by loggers. The available loggers are process, filesystem, terminal, network, file. Specify multiple loggers by separating them with a comma. [default: process,filesystem]` + + diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/template/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/template/page.mdx new file mode 100644 index 000000000..48d3dcb2e --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.8/template/page.mdx @@ -0,0 +1,90 @@ +# e2b template + + +manage sandbox templates + +## Usage + +```bash +e2b template [options] [command] +``` +# e2b template build + + +build sandbox template defined by ./e2b.Dockerfile or ./Dockerfile in root directory. By default the root directory is the current working directory. This command also creates e2b.toml config. + +## Usage + +```bash +e2b template build [options] [template] +``` + +## Options + + + - `-p, --path : change root directory where command is executed to directory ` + - `-d, --dockerfile : specify path to Dockerfile. By default E2B tries to find e2b.Dockerfile or Dockerfile in root directory. ` + - `-n, --name : specify sandbox template name. You can use the template name to start the sandbox with SDK. The template name must be lowercase and contain only letters, numbers, dashes and underscores. ` + - `-c, --cmd : specify command that will be executed when the sandbox is started. ` + - `-t, --team : specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). ` + - `--config : specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. ` + - `--cpu-count : specify the number of CPUs that will be used to run the sandbox. The default value is 2. ` + - `--memory-mb : specify the amount of memory in megabytes that will be used to run the sandbox. Must be an even number. The default value is 512. ` + - `--build-arg : specify additional build arguments for the build command. The format should be =. ` + + +# e2b template list + + +list sandbox templates + +## Usage + +```bash +e2b template list [options] +``` + +## Options + + + - `-t, --team : specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). ` + + +# e2b template init + + +create basic E2B Dockerfile (./e2b.Dockerfile) in root directory. You can then run e2b template build to build sandbox template from this Dockerfile + +## Usage + +```bash +e2b template init [options] +``` + +## Options + + + - `-p, --path : change root directory where command is executed to directory ` + + +# e2b template delete + + +delete sandbox template and e2b.toml config + +## Usage + +```bash +e2b template delete [options] [template] +``` + +## Options + + + - `-p, --path : change root directory where command is executed to directory ` + - `--config : specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. ` + - `-s, --select: select sandbox template from interactive list ` + - `-t, --team : specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). ` + - `-y, --yes: skip manual delete confirmation ` + + diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/errors/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/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.51/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.51/filesystem/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/filesystem/page.mdx new file mode 100644 index 000000000..0cc2ef1d2 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/filesystem/page.mdx @@ -0,0 +1,359 @@ +# sandbox/filesystem + +## Enumerations + +### FileType + +#### Enumeration Members + +##### DIR + +> **DIR**: `"dir"` + +###### Defined in + +sandbox/filesystem/index.ts:32 + +##### FILE + +> **FILE**: `"file"` + +###### Defined in + +sandbox/filesystem/index.ts:31 + +## Classes + +### 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:58 + +#### Methods + +##### exists() + +> **exists**(`path`, `opts`?): `Promise`\<`boolean`\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` + +###### Returns + +`Promise`\<`boolean`\> + +###### Defined in + +sandbox/filesystem/index.ts:212 + +##### list() + +> **list**(`path`, `opts`?): `Promise`\<`EntryInfo`[]\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` + +###### Returns + +`Promise`\<`EntryInfo`[]\> + +###### Defined in + +sandbox/filesystem/index.ts:130 + +##### makeDir() + +> **makeDir**(`path`, `opts`?): `Promise`\<`boolean`\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` + +###### Returns + +`Promise`\<`boolean`\> + +###### Defined in + +sandbox/filesystem/index.ts:157 + +##### read() + +###### read(path, opts) + +> **read**(`path`, `opts`?): `Promise`\<`string`\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` & `object` + +###### Returns + +`Promise`\<`string`\> + +###### Defined in + +sandbox/filesystem/index.ts:66 + +###### read(path, opts) + +> **read**(`path`, `opts`?): `Promise`\<`Uint8Array`\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` & `object` + +###### Returns + +`Promise`\<`Uint8Array`\> + +###### Defined in + +sandbox/filesystem/index.ts:67 + +###### read(path, opts) + +> **read**(`path`, `opts`?): `Promise`\<`Blob`\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` & `object` + +###### Returns + +`Promise`\<`Blob`\> + +###### Defined in + +sandbox/filesystem/index.ts:68 + +###### 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:69 + +##### remove() + +> **remove**(`path`, `opts`?): `Promise`\<`void`\> + +###### Parameters + +• **path**: `string` + +• **opts?**: `FilesystemRequestOpts` + +###### Returns + +`Promise`\<`void`\> + +###### Defined in + +sandbox/filesystem/index.ts:201 + +##### rename() + +> **rename**(`oldPath`, `newPath`, `opts`?): `Promise`\<`EntryInfo`\> + +###### Parameters + +• **oldPath**: `string` + +• **newPath**: `string` + +• **opts?**: `FilesystemRequestOpts` + +###### Returns + +`Promise`\<`EntryInfo`\> + +###### Defined in + +sandbox/filesystem/index.ts:176 + +##### watch() + +> **watch**(`path`, `onEvent`, `opts`?): `Promise`\<`WatchHandle`\> + +###### Parameters + +• **path**: `string` + +• **onEvent** + +• **opts?**: `FilesystemRequestOpts` & `object` + +###### Returns + +`Promise`\<`WatchHandle`\> + +###### Defined in + +sandbox/filesystem/index.ts:231 + +##### write() + +> **write**(`path`, `data`, `opts`?): `Promise`\<`EntryInfo`\> + +###### Parameters + +• **path**: `string` + +• **data**: `string` \| `ArrayBuffer` \| `Blob` \| `ReadableStream`\<`any`\> + +• **opts?**: `FilesystemRequestOpts` + +###### Returns + +`Promise`\<`EntryInfo`\> + +###### Defined in + +sandbox/filesystem/index.ts:96 + +## Interfaces + +### EntryInfo + +#### Properties + +##### name + +> **name**: `string` + +###### Defined in + +sandbox/filesystem/index.ts:25 + +##### path + +> **path**: `string` + +###### Defined in + +sandbox/filesystem/index.ts:27 + +##### type + +> **type**: `FileType` + +###### Defined in + +sandbox/filesystem/index.ts:26 + +*** + +### FilesystemRequestOpts + +#### Extended by + +- `WatchOpts` + +#### Properties + +##### requestTimeoutMs? + +> `optional` **requestTimeoutMs**: `number` + +###### Defined in + +connectionConfig.ts:11 + +##### user? + +> `optional` **user**: `Username` + +###### Defined in + +sandbox/filesystem/index.ts:45 + +*** + +### WatchOpts + +#### Properties + +##### onExit()? + +> `optional` **onExit**: (`err`) => `void` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`void` + +###### Defined in + +sandbox/filesystem/index.ts:50 + +##### requestTimeoutMs? + +> `optional` **requestTimeoutMs**: `number` + +###### Defined in + +connectionConfig.ts:11 + +##### timeout? + +> `optional` **timeout**: `number` + +###### Defined in + +sandbox/filesystem/index.ts:49 + +##### user? + +> `optional` **user**: `Username` + +###### Defined in + +sandbox/filesystem/index.ts:45 diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/process/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/process/page.mdx new file mode 100644 index 000000000..354462a37 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/process/page.mdx @@ -0,0 +1,23 @@ +# sandbox/process + +## References + +### Process + +Re-exports Process + +### ProcessConnectOpts + +Re-exports ProcessConnectOpts + +### ProcessInfo + +Re-exports ProcessInfo + +### ProcessRequestOpts + +Re-exports ProcessRequestOpts + +### ProcessStartOpts + +Re-exports ProcessStartOpts diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/pty/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/pty/page.mdx new file mode 100644 index 000000000..0b4bc9bd5 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/pty/page.mdx @@ -0,0 +1,165 @@ +# sandbox/pty + +## Classes + +### Pty + +#### Constructors + +##### new Pty() + +> **new Pty**(`transport`, `connectionConfig`): `Pty` + +###### Parameters + +• **transport**: `Transport` + +• **connectionConfig**: `ConnectionConfig` + +###### Returns + +`Pty` + +###### Defined in + +sandbox/pty.ts:29 + +#### Methods + +##### create() + +> **create**(`opts`): `Promise`\<`ProcessHandle`\> + +###### Parameters + +• **opts**: `PtyCreateOpts` + +###### Returns + +`Promise`\<`ProcessHandle`\> + +###### Defined in + +sandbox/pty.ts:33 + +##### resize() + +> **resize**(`pid`, `size`, `opts`?): `Promise`\<`void`\> + +###### Parameters + +• **pid**: `number` + +• **size** + +• **size.cols**: `number` + +• **size.rows?**: `number` + +• **opts?**: `Pick`\<`ConnectionOpts`, `"requestTimeoutMs"`\> + +###### Returns + +`Promise`\<`void`\> + +###### Defined in + +sandbox/pty.ts:100 + +##### sendInput() + +> **sendInput**(`pid`, `data`, `opts`?): `Promise`\<`void`\> + +###### Parameters + +• **pid**: `number` + +• **data**: `Uint8Array` + +• **opts?**: `Pick`\<`ConnectionOpts`, `"requestTimeoutMs"`\> + +###### Returns + +`Promise`\<`void`\> + +###### Defined in + +sandbox/pty.ts:77 + +## Interfaces + +### PtyCreateOpts + +#### Properties + +##### cols + +> **cols**: `number` + +###### Defined in + +sandbox/pty.ts:17 + +##### cwd? + +> `optional` **cwd**: `string` + +###### Defined in + +sandbox/pty.ts:23 + +##### envs? + +> `optional` **envs**: `Record`\<`string`, `string`\> + +###### Defined in + +sandbox/pty.ts:22 + +##### onData() + +> **onData**: (`data`) => `void` \| `Promise`\<`void`\> + +###### Parameters + +• **data**: `Uint8Array` + +###### Returns + +`void` \| `Promise`\<`void`\> + +###### Defined in + +sandbox/pty.ts:19 + +##### requestTimeoutMs? + +> `optional` **requestTimeoutMs**: `number` + +###### Defined in + +connectionConfig.ts:11 + +##### rows + +> **rows**: `number` + +###### Defined in + +sandbox/pty.ts:18 + +##### timeoutMs? + +> `optional` **timeoutMs**: `number` + +###### Defined in + +sandbox/pty.ts:20 + +##### user? + +> `optional` **user**: `Username` + +###### Defined in + +sandbox/pty.ts:21 diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/sandbox/page.mdx new file mode 100644 index 000000000..ae11c69f2 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.51/sandbox/page.mdx @@ -0,0 +1,367 @@ +# sandbox + +## Classes + +### Sandbox + +#### Constructors + +##### new Sandbox() + +> **new Sandbox**(`opts`): `Sandbox` + +###### Parameters + +• **opts**: `Omit`\<`SandboxOpts`, `"metadata"` \| `"envs"` \| `"timeoutMs"`\> & `object` + +###### Returns + +`Sandbox` + +###### Defined in + +sandbox/index.ts:33 + +#### Properties + +##### commands + +> `readonly` **commands**: `Process` + +###### Defined in + +sandbox/index.ts:22 + +##### files + +> `readonly` **files**: `Filesystem` + +###### Defined in + +sandbox/index.ts:21 + +##### pty + +> `readonly` **pty**: `Pty` + +###### Defined in + +sandbox/index.ts:23 + +##### sandboxId + +> `readonly` **sandboxId**: `string` + +###### Defined in + +sandbox/index.ts:25 + +#### Methods + +##### downloadUrl() + +> **downloadUrl**(`path`): `string` + +###### Parameters + +• **path**: `string` + +###### Returns + +`string` + +###### Defined in + +sandbox/index.ts:125 + +##### getHost() + +> **getHost**(`port`): `string` + +###### Parameters + +• **port**: `number` + +###### Returns + +`string` + +###### Defined in + +sandbox/index.ts:76 + +##### isRunning() + +> **isRunning**(`opts`?): `Promise`\<`boolean`\> + +###### Parameters + +• **opts?**: `Pick`\<`ConnectionOpts`, `"requestTimeoutMs"`\> + +###### Returns + +`Promise`\<`boolean`\> + +###### Defined in + +sandbox/index.ts:84 + +##### kill() + +> **kill**(`opts`?): `Promise`\<`void`\> + +###### Parameters + +• **opts?**: `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\> + +###### Returns + +`Promise`\<`void`\> + +###### Defined in + +sandbox/index.ts:112 + +##### setTimeout() + +> **setTimeout**(`timeoutMs`, `opts`?): `Promise`\<`void`\> + +###### Parameters + +• **timeoutMs**: `number` + +• **opts?**: `Pick`\<`SandboxOpts`, `"requestTimeoutMs"`\> + +###### Returns + +`Promise`\<`void`\> + +###### Defined in + +sandbox/index.ts:103 + +##### uploadUrl() + +> **uploadUrl**(`path`?): `string` + +###### Parameters + +• **path?**: `string` + +###### Returns + +`string` + +###### Defined in + +sandbox/index.ts:121 + +##### connect() + +> `static` **connect**\<`S`\>(`this`, `sandboxId`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\> + +###### Type Parameters + +• **S** *extends* *typeof* `Sandbox` + +###### Parameters + +• **this**: `S` + +• **sandboxId**: `string` + +• **opts?**: `Omit`\<`SandboxOpts`, `"metadata"` \| `"envs"` \| `"timeoutMs"`\> + +###### Returns + +`Promise`\<`InstanceType`\<`S`\>\> + +###### Defined in + +sandbox/index.ts:69 + +##### create() + +###### create(this, opts) + +> `static` **create**\<`S`\>(`this`, `opts`?): `Promise`\<`InstanceType`\<`S`\>\> + +###### Type Parameters + +• **S** *extends* *typeof* `Sandbox` + +###### Parameters + +• **this**: `S` + +• **opts?**: `SandboxOpts` + +###### Returns + +`Promise`\<`InstanceType`\<`S`\>\> + +###### Defined in + +sandbox/index.ts:52 + +###### 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:53 + +##### 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:47 + +##### list() + +> `static` **list**(`opts`?): `Promise`\<`SandboxInfo`[]\> + +###### Parameters + +• **opts?**: `SandboxApiOpts` + +###### Returns + +`Promise`\<`SandboxInfo`[]\> + +###### Defined in + +sandbox/sandboxApi.ts:72 + +##### setTimeout() + +> `static` **setTimeout**(`sandboxId`, `timeoutMs`, `opts`?): `Promise`\<`void`\> + +###### Parameters + +• **sandboxId**: `string` + +• **timeoutMs**: `number` + +• **opts?**: `SandboxApiOpts` + +###### Returns + +`Promise`\<`void`\> + +###### Defined in + +sandbox/sandboxApi.ts:94 + +## Interfaces + +### SandboxOpts + +#### Properties + +##### accessToken? + +> `optional` **accessToken**: `string` + +###### Defined in + +connectionConfig.ts:8 + +##### apiKey? + +> `optional` **apiKey**: `string` + +###### Defined in + +connectionConfig.ts:7 + +##### debug? + +> `optional` **debug**: `boolean` + +###### Defined in + +connectionConfig.ts:10 + +##### domain? + +> `optional` **domain**: `string` + +###### Defined in + +connectionConfig.ts:9 + +##### envs? + +> `optional` **envs**: `Record`\<`string`, `string`\> + +###### Defined in + +sandbox/index.ts:13 + +##### logger? + +> `optional` **logger**: `Logger` + +###### Defined in + +connectionConfig.ts:12 + +##### metadata? + +> `optional` **metadata**: `Record`\<`string`, `string`\> + +###### Defined in + +sandbox/index.ts:12 + +##### requestTimeoutMs? + +> `optional` **requestTimeoutMs**: `number` + +###### Defined in + +connectionConfig.ts:11 + +##### timeoutMs? + +> `optional` **timeoutMs**: `number` + +###### Defined in + +sandbox/index.ts:14 diff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/exceptions/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/exceptions/page.mdx new file mode 100644 index 000000000..b0b6e6089 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/exceptions/page.mdx @@ -0,0 +1,75 @@ + + + +## SandboxException Objects + +```python +class SandboxException(Exception) +``` + +Raised when a sandbox exception occurs. + +Base class for all sandbox errors. + + +## TimeoutException Objects + +```python +class TimeoutException(SandboxException) +``` + +Raised when a timeout occurs. + +The [unavailable] exception type is caused by sandbox timeout. + +The [canceled] exception type is caused by exceeding request timeout. + +The [deadline_exceeded] exception type is caused by exceeding the timeout for process, watch, etc. + +The [unknown] exception type is sometimes caused by the sandbox timeout when the request is not processed correctly. + + +## NotEnoughSpaceException Objects + +```python +class NotEnoughSpaceException(SandboxException) +``` + +Raised when there is not enough disk space. + + +## NotFoundException Objects + +```python +class NotFoundException(SandboxException) +``` + +Raised when a resource is not found. + + +## InvalidArgumentException Objects + +```python +class InvalidArgumentException(SandboxException) +``` + +Raised when an invalid argument is provided. + + +## AuthenticationException Objects + +```python +class AuthenticationException(SandboxException) +``` + +Raised when authentication fails. + + +## TemplateException Objects + +```python +class TemplateException(SandboxException) +``` + +Exception raised when the template uses old envd version. It isn't compatible with the new SDK. + diff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx new file mode 100644 index 000000000..c30a981d6 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx @@ -0,0 +1,337 @@ + + + +## Filesystem Objects + +```python +class Filesystem() +``` + + +#### read + +```python +async def read(path: str, + format: Literal["text", "bytes", "stream"] = "text", + user: Username = "user", + request_timeout: Optional[float] = None) +``` + +Read from file + + +#### write + +```python +async def write(path: str, + data: Union[str, bytes, IO], + user: Username = "user", + request_timeout: Optional[float] = None) -> EntryInfo +``` + +Write to file +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, you'll get an error. + + +#### list + +```python +async def list(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> List[EntryInfo] +``` + +List directory + + +#### exists + +```python +async def exists(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> bool +``` + +Check if file exists. + + +#### remove + +```python +async def remove(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> None +``` + +Remove file + + +#### rename + +```python +async def rename(old_path: str, + new_path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> EntryInfo +``` + +Rename file + + +#### make\_dir + +```python +async def make_dir(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> bool +``` + +Create directory and all parent directories + + +#### watch + +```python +async def watch(path: str, + on_event: OutputHandler[FilesystemEvent], + on_exit: Optional[OutputHandler[Exception]] = None, + user: Username = "user", + request_timeout: Optional[float] = None, + timeout: Optional[float] = 60) +``` + +Watch directory for changes + + + + + + + + +## Process Objects + +```python +class Process() +``` + + +#### list + +```python +async def list(request_timeout: Optional[float] = None) -> List[ProcessInfo] +``` + +List processes + + +#### kill + +```python +async def kill(pid: int, request_timeout: Optional[float] = None) -> bool +``` + +Kill process + + +#### send\_stdin + +```python +async def send_stdin(pid: int, + data: str, + request_timeout: Optional[float] = None) +``` + +Send stdin + + +#### run + +```python +async def run(cmd: str, + background: Union[bool, None] = None, + envs: Optional[Dict[str, str]] = None, + user: Username = "user", + cwd: Optional[str] = None, + on_stdout: Optional[OutputHandler[Stdout]] = None, + on_stderr: Optional[OutputHandler[Stderr]] = None, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) +``` + +Run command + + + + + + +## Pty Objects + +```python +class Pty() +``` + + +#### kill + +```python +async def kill(pid: int, request_timeout: Optional[float] = None) -> bool +``` + +Kill process by PID + + +#### send\_stdin + +```python +async def send_stdin(pid: int, + data: bytes, + request_timeout: Optional[float] = None) +``` + +Send data to process stdin + + +#### create + +```python +async def create( + size: PtySize, + user: Username = "user", + cwd: Optional[str] = None, + on_data: Optional[Callable[[bytes], None]] = None, + envs: Optional[Dict[str, str]] = None, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) -> AsyncProcessHandle +``` + +Create new PTY process + + +#### resize + +```python +async def resize(pid: int, + size: PtySize, + request_timeout: Optional[float] = None) +``` + +Resize PTY + + + + + + +## AsyncSandbox Objects + +```python +class AsyncSandbox(SandboxSetup, SandboxApi) +``` + + +#### files + +```python +@property +def files() -> Filesystem +``` + +Get a Filesystem Object + + +#### commands + +```python +@property +def commands() -> Process +``` + +Get a Process Object + + +#### sandbox\_id + +```python +@property +def sandbox_id() -> str +``` + +Get the sandbox ID + + +#### envd\_api\_url + +```python +@property +def envd_api_url() -> str +``` + +Get the sanbox API URL + + +#### connection\_config + +```python +@property +def connection_config() -> ConnectionConfig +``` + +Get the ConnectionConfig Object + + +#### \_\_init\_\_ + +```python +def __init__(**opts: Unpack[AsyncSandboxOpts]) +``` + +Instantiate sandbox + + +#### is\_running + +```python +async def is_running(request_timeout: Optional[float] = None) -> bool +``` + +Check if sandbox is running + + +#### connect + +```python +@classmethod +async def connect(cls, + sandbox_id: str, + api_key: Optional[str] = None, + domain: Optional[str] = None, + debug: Optional[bool] = None) +``` + +Connect to a running sandbox + + +#### kill + +```python +@class_method_variant("_cls_kill") +async def kill(request_timeout: Optional[float] = None) -> bool +``` + +Kill sandbox + + +#### set\_timeout + +```python +@class_method_variant("_cls_set_timeout") +async def set_timeout(timeout: int, + request_timeout: Optional[float] = None) -> None +``` + +Configure request timeout + diff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx new file mode 100644 index 000000000..ef5f237b7 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx @@ -0,0 +1,347 @@ + + + +## Filesystem Objects + +```python +class Filesystem() +``` + + +#### read + +```python +def read(path: str, + format: Literal["text", "bytes", "stream"] = "text", + user: Username = "user", + request_timeout: Optional[float] = None) +``` + +Read from file + + +#### write + +```python +def write(path: str, + data: Union[str, bytes, IO], + user: Username = "user", + request_timeout: Optional[float] = None) -> EntryInfo +``` + +Write to file +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, you'll get an error. + + +#### list + +```python +def list(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> List[EntryInfo] +``` + +List directory + + +#### exists + +```python +def exists(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> bool +``` + +Check if file exists. + + +#### remove + +```python +def remove(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> None +``` + +Remove file + + +#### rename + +```python +def rename(old_path: str, + new_path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> EntryInfo +``` + +Rename file + + +#### make\_dir + +```python +def make_dir(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> bool +``` + +Create directory and all parent directories + + +#### watch + +```python +def watch(path: str, + user: Username = "user", + request_timeout: Optional[float] = None, + timeout: Optional[float] = 60) +``` + +Watch directory for changes. + + + + + + + + +## Process Objects + +```python +class Process() +``` + + +#### list + +```python +def list(request_timeout: Optional[float] = None) -> List[ProcessInfo] +``` + +List processes + + +#### kill + +```python +def kill(pid: int, request_timeout: Optional[float] = None) -> bool +``` + +Kill process + + +#### send\_stdin + +```python +def send_stdin(pid: int, data: str, request_timeout: Optional[float] = None) +``` + +Send stdin + + +#### run + +```python +def run(cmd: str, + background: Union[bool, None] = None, + envs: Optional[Dict[str, str]] = None, + user: Username = "user", + cwd: Optional[str] = None, + on_stdout: Optional[Callable[[str], None]] = None, + on_stderr: Optional[Callable[[str], None]] = None, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) +``` + +Run command + + +#### connect + +```python +def connect(pid: int, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) +``` + +Connect to process + + + + +## Pty Objects + +```python +class Pty() +``` + + +#### kill + +```python +def kill(pid: int, request_timeout: Optional[float] = None) -> bool +``` + +Kill process by PID + + +#### send\_stdin + +```python +def send_stdin(pid: int, + data: bytes, + request_timeout: Optional[float] = None) -> None +``` + +Send data to process stdin + + +#### create + +```python +def create(size: PtySize, + user: Username = "user", + cwd: Optional[str] = None, + envs: Optional[Dict[str, str]] = None, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) -> ProcessHandle +``` + +Create new PTY process + + +#### resize + +```python +def resize(pid: int, + size: PtySize, + request_timeout: Optional[float] = None) -> None +``` + +Resize PTY + + + + + + +## Sandbox Objects + +```python +class Sandbox(SandboxSetup, SandboxApi) +``` + + +#### files + +```python +@property +def files() -> Filesystem +``` + +Get a Filesystem Object + + +#### commands + +```python +@property +def commands() -> Process +``` + +Get a Process Object + + +#### sandbox\_id + +```python +@property +def sandbox_id() -> str +``` + +Get the sandbox ID + + +#### envd\_api\_url + +```python +@property +def envd_api_url() -> str +``` + +Get the sanbox API URL + + +#### connection\_config + +```python +@property +def connection_config() -> ConnectionConfig +``` + +Get the ConnectionConfig Object + + +#### \_\_init\_\_ + +```python +def __init__(template: Optional[str] = None, + timeout: Optional[int] = None, + metadata: Optional[Dict[str, str]] = None, + envs: Optional[Dict[str, str]] = None, + api_key: Optional[str] = None, + domain: Optional[str] = None, + debug: Optional[bool] = None, + sandbox_id: Optional[str] = None, + request_timeout: Optional[float] = None) +``` + +Instantiate sandbox + + +#### is\_running + +```python +def is_running(request_timeout: Optional[float] = None) -> bool +``` + +Check if sandbox is running + + +#### connect + +```python +@classmethod +def connect(cls, + sandbox_id: str, + api_key: Optional[str] = None, + domain: Optional[str] = None, + debug: Optional[bool] = None) +``` + +Connect to a running sandbox + + +#### kill + +```python +@class_method_variant("_cls_kill") +def kill(request_timeout: Optional[float] = None) -> bool +``` + +Kill sandbox + + +#### set\_timeout + +```python +@class_method_variant("_cls_set_timeout") +def set_timeout(timeout: int, request_timeout: Optional[float] = None) -> None +``` + +Configure sandbox timeout + diff --git a/packages/cli/scripts/generate_api_ref.sh b/packages/cli/scripts/generate_api_ref.sh index 8cb0ffa2f..51a1b8414 100755 --- a/packages/cli/scripts/generate_api_ref.sh +++ b/packages/cli/scripts/generate_api_ref.sh @@ -8,14 +8,18 @@ mkdir -p api_ref npx tsup && echo && NODE_ENV=development node dist/index.js -cmd2md -# move to docs (for later use) -#for file in api_ref/*.md; do -# # Extract the filename without extension -# filename=$(basename "$file" .md) -# -# # Create the directory if it doesn't exist -# mkdir -p "../../apps/web/src/app/(docs)/docs/api-reference/cli/$filename" -# -# # Move the file to the new location and rename it to page.mdx -# mv "$file" "../../apps/web/src/app/(docs)/docs/api-reference/cli/$filename/page.mdx" -#done +PKG_VERSION="v$(node -p "require('./package.json').version")" + +# move to docs web app +for file in api_ref/*.md; do + # Extract the filename without extension + filename=$(basename "$file" .md) + + # Create the directory if it doesn't exist + mkdir -p "../../apps/web/src/app/(docs)/docs/api-reference/cli/${PKG_VERSION}/${filename}" + + # Move the file to the new location and rename it to page.mdx + mv "$file" "../../apps/web/src/app/(docs)/docs/api-reference/cli/${PKG_VERSION}/${filename}/page.mdx" +done + +rm -rf api_ref diff --git a/packages/js-sdk/scripts/generate_api_ref.sh b/packages/js-sdk/scripts/generate_api_ref.sh index dfd0926b2..bd822ed2e 100755 --- a/packages/js-sdk/scripts/generate_api_ref.sh +++ b/packages/js-sdk/scripts/generate_api_ref.sh @@ -8,20 +8,29 @@ set -euo pipefail # generate raw api reference markdown files npx typedoc -# move to docs (for later use) -#mkdir -p ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/sandbox -#mv api_ref/sandbox.md ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/sandbox/page.mdx -# -#mkdir -p ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/errors -#mv api_ref/errors.md ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/errors/page.mdx -# -#mkdir -p ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/filesystem -#mv api_ref/sandbox/filesystem.md ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/filesystem/page.mdx -# -#mkdir -p ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/process -#mv api_ref/sandbox/process.md ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/process/page.mdx -# -#mkdir -p ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/pty -#mv api_ref/sandbox/pty.md ../../apps/web/src/app/\(docs\)/docs/api-reference/js-sdk/pty/page.mdx -# -#rm -rf api_ref +PKG_VERSION="v$(node -p "require('./package.json').version")" +ROUTES_DIR="../../apps/web/src/app/(docs)/docs/api-reference/js-sdk/${PKG_VERSION}" +# move to docs web app +mkdir -p "${ROUTES_DIR}" + +rm -rf api_ref/README.md + +# Flatten the api_ref directory by moving all nested files to the root level and remove empty subdirectories +find api_ref -mindepth 2 -type f | while read -r file; do + mv "$file" api_ref/ +done +find api_ref -type d -empty -delete + +# Transfrom top level MD files into folders of the same name with page.mdx inside +find api_ref -maxdepth 1 -type f -name "*.md" | while read -r file; do + # Extract the filename without extension + filename=$(basename "$file" .md) + # Create the directory of the same name in api_ref + mkdir -p "api_ref/${filename}" + # Move the file inside the newly created directory + mv "$file" "api_ref/${filename}/page.mdx" +done + +cp -r api_ref/* "${ROUTES_DIR}" + +rm -rf api_ref diff --git a/packages/python-sdk/e2b/sandbox_async/pty/main.py b/packages/python-sdk/e2b/sandbox_async/pty/main.py index d52c2d4d2..ccfcb7054 100644 --- a/packages/python-sdk/e2b/sandbox_async/pty/main.py +++ b/packages/python-sdk/e2b/sandbox_async/pty/main.py @@ -1,15 +1,11 @@ +from typing import Callable, Dict, Optional + import e2b_connect import httpcore - -from typing import Dict, Optional, Callable - +from e2b.connection_config import ConnectionConfig, Username from e2b.envd.process import process_connect, process_pb2 -from e2b.connection_config import ( - Username, - ConnectionConfig, -) -from e2b.exceptions import SandboxException from e2b.envd.rpc import authentication_header, handle_rpc_exception +from e2b.exceptions import SandboxException from e2b.sandbox.process.process_handle import PtySize from e2b.sandbox_async.process.process_handle import AsyncProcessHandle @@ -34,6 +30,7 @@ async def kill( pid: int, request_timeout: Optional[float] = None, ) -> bool: + """Kill process by PID""" try: await self._rpc.asend_signal( process_pb2.SendSignalRequest( @@ -57,6 +54,7 @@ async def send_stdin( data: bytes, request_timeout: Optional[float] = None, ): + """Send data to process stdin""" try: await self._rpc.asend_input( process_pb2.SendInputRequest( @@ -82,6 +80,7 @@ async def create( timeout: Optional[float] = 60, request_timeout: Optional[float] = None, ) -> AsyncProcessHandle: + """Create new PTY process""" envs = envs or {} envs["TERM"] = "xterm-256color" events = self._rpc.astart( @@ -123,6 +122,7 @@ async def create( async def resize( self, pid: int, size: PtySize, request_timeout: Optional[float] = None ): + """Resize PTY""" await self._rpc.aupdate( process_pb2.UpdateRequest( process=process_pb2.ProcessSelector(pid=pid), diff --git a/packages/python-sdk/e2b/sandbox_sync/pty/main.py b/packages/python-sdk/e2b/sandbox_sync/pty/main.py index 3d4cbc761..81f5d0e47 100644 --- a/packages/python-sdk/e2b/sandbox_sync/pty/main.py +++ b/packages/python-sdk/e2b/sandbox_sync/pty/main.py @@ -34,6 +34,7 @@ def kill( pid: int, request_timeout: Optional[float] = None, ) -> bool: + """Kill process by PID""" try: self._rpc.send_signal( process_pb2.SendSignalRequest( @@ -57,6 +58,7 @@ def send_stdin( data: bytes, request_timeout: Optional[float] = None, ) -> None: + """Send data to process stdin""" try: self._rpc.send_input( process_pb2.SendInputRequest( @@ -81,6 +83,7 @@ def create( timeout: Optional[float] = 60, request_timeout: Optional[float] = None, ) -> ProcessHandle: + """Create new PTY process""" envs = envs or {} envs["TERM"] = "xterm-256color" events = self._rpc.start( @@ -121,6 +124,7 @@ def create( def resize( self, pid: int, size: PtySize, request_timeout: Optional[float] = None ) -> None: + """Resize PTY""" self._rpc.update( process_pb2.UpdateRequest( process=process_pb2.ProcessSelector(pid=pid), diff --git a/packages/python-sdk/scripts/generate_api_ref.sh b/packages/python-sdk/scripts/generate_api_ref.sh index 211333b04..c174fd644 100755 --- a/packages/python-sdk/scripts/generate_api_ref.sh +++ b/packages/python-sdk/scripts/generate_api_ref.sh @@ -5,17 +5,24 @@ set -euo pipefail # This script generates the python sdk api reference markdown files # Run it in the `python-sdk/` directory +PKG_VERSION="v$(node -p "require('./package.json').version")" + packages=("sandbox_sync" "sandbox_async" "exceptions") -mkdir api_ref +mkdir -p ../../apps/web/src/app/\(docs\)/docs/api-reference/python-sdk/${PKG_VERSION} + +mkdir -p api_ref for package in "${packages[@]}"; do # generate raw api reference markdown file - pydoc-markdown -p e2b.${package} >api_ref/${package}.mdx + pydoc-markdown -p e2b."${package}" >api_ref/"${package}".mdx # remove package path display - sed -i '' '/]*>.*<\/a>/d' api_ref/${package}.mdx + sed -i '/]*>.*<\/a>/d' api_ref/"${package}".mdx # remove empty hyperlinks - sed -i '' '/^# /d' api_ref/${package}.mdx - # move to docs (for later use) - # mv api_ref/${package}.mdx ../../apps/web/src/app/\(docs\)/docs/api-reference/python-sdk/${package}/page.mdx + sed -i '/^# /d' "api_ref/${package}.mdx" + # move to docs + mkdir -p "../../apps/web/src/app/(docs)/docs/api-reference/python-sdk/${PKG_VERSION}/${package}" + mv "api_ref/${package}.mdx" "../../apps/web/src/app/(docs)/docs/api-reference/python-sdk/${PKG_VERSION}/${package}/page.mdx" done + +rm -rf api_ref diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dd0c4c1fb..92a65abb2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -359,7 +359,13 @@ importers: version: 6.7.6 tsup: specifier: ^8.0.2 - version: 8.2.2(jiti@1.21.6)(postcss@8.4.39)(typescript@5.5.3) + version: 8.2.2(jiti@1.21.6)(postcss@8.4.39)(typescript@5.5.3)(yaml@2.5.1) + typedoc: + specifier: ^0.26.7 + version: 0.26.7(typescript@5.5.3) + typedoc-plugin-markdown: + specifier: ^4.2.7 + version: 4.2.8(typedoc@0.26.7(typescript@5.5.3)) typescript: specifier: ^5.4.5 version: 5.5.3 @@ -2199,6 +2205,21 @@ packages: peerDependencies: webpack: '>=4.40.0' + '@shikijs/core@1.18.0': + resolution: {integrity: sha512-VK4BNVCd2leY62Nm2JjyxtRLkyrZT/tv104O81eyaCjHq4Adceq2uJVFJJAIof6lT1mBwZrEo2qT/T+grv3MQQ==} + + '@shikijs/engine-javascript@1.18.0': + resolution: {integrity: sha512-qoP/aO/ATNwYAUw1YMdaip/YVEstMZEgrwhePm83Ll9OeQPuxDZd48szZR8oSQNQBT8m8UlWxZv8EA3lFuyI5A==} + + '@shikijs/engine-oniguruma@1.18.0': + resolution: {integrity: sha512-B9u0ZKI/cud+TcmF8Chyh+R4V5qQVvyDOqXC2l2a4x73PBSBc6sZ0JRAX3eqyJswqir6ktwApUUGBYePdKnMJg==} + + '@shikijs/types@1.18.0': + resolution: {integrity: sha512-O9N36UEaGGrxv1yUrN2nye7gDLG5Uq0/c1LyfmxsvzNPqlHzWo9DI0A4+fhW2y3bGKuQu/fwS7EPdKJJCowcVA==} + + '@shikijs/vscode-textmate@9.2.2': + resolution: {integrity: sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==} + '@sigstore/bundle@1.1.0': resolution: {integrity: sha512-PFutXEy0SmQxYI4texPw3dd2KewuNqv7OuK1ZFtY2fM754yhvG2KdgwIhRnoEE2uHdtdGNQ8s0lb94dW9sELog==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -2414,6 +2435,9 @@ packages: '@types/hast@2.3.6': resolution: {integrity: sha512-47rJE80oqPmFdVDCD7IheXBrVdwuBgsYwoczFvKmwfo2Mzsnt+V9OONsYauFmICb6lQPpCuXYJWejBNs4pDJRg==} + '@types/hast@3.0.4': + resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} + '@types/http-cache-semantics@4.0.3': resolution: {integrity: sha512-V46MYLFp08Wf2mmaBhvgjStM3tPa+2GAdy/iqoX+noX1//zje2x4XmrIU0cAwyClATsTmahbtoQ2EwP7I5WSiA==} @@ -2435,6 +2459,9 @@ packages: '@types/mdast@3.0.12': resolution: {integrity: sha512-DT+iNIRNX884cx0/Q1ja7NyUPpZuv0KPyL5rGNxm1WC1OtHstl7n4Jb7nk+xacNShQMbczJjt8uFzznpp6kYBg==} + '@types/mdast@4.0.4': + resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} + '@types/mdx@2.0.8': resolution: {integrity: sha512-r7/zWe+f9x+zjXqGxf821qz++ld8tp6Z4jUS6qmPZUXH6tfh4riXOhAqb12tWGWAevCFtMt1goLWkQMqIJKpsA==} @@ -2504,6 +2531,9 @@ packages: '@types/unist@2.0.8': resolution: {integrity: sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw==} + '@types/unist@3.0.3': + resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} + '@types/update-notifier@6.0.5': resolution: {integrity: sha512-uUOhxsJ3edPHu06r3k4I2yJ4eoyqBt+53ra9+caXEx0ruoPwqNHTlkq75CUvI4yWsrCA5+31tih+opunLCYnXw==} @@ -2684,6 +2714,9 @@ packages: resolution: {integrity: sha512-Qlzzx4sE4u3FsHTPQAAQFJFNOuqtuY0LFrZHwQ8IHK705XxBiWOFkfKRWu6niB7hwfgnwIpO4jTC75ozW1PHWg==} engines: {node: ^18.18.0 || >=20.0.0} + '@ungap/structured-clone@1.2.0': + resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + '@vercel/analytics@1.0.2': resolution: {integrity: sha512-BZFxVrv24VbNNl5xMxqUojQIegEeXMI6rX3rg1uVLYUEXsuKNBSAEQf4BWEcjQDp/8aYJOj6m8V4PUA3x/cxgg==} @@ -3555,6 +3588,9 @@ packages: detect-node-es@1.1.0: resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==} + devlop@1.1.0: + resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} @@ -3640,6 +3676,10 @@ packages: resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} engines: {node: '>=8.6'} + entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + env-paths@2.2.1: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} @@ -4242,9 +4282,15 @@ packages: hast-util-to-estree@2.3.3: resolution: {integrity: sha512-ihhPIUPxN0v0w6M5+IiAZZrn0LH2uZomeWwhn7uP7avZC6TE7lIiEh2yBMPr5+zi1aUCXq6VoYRgs2Bw9xmycQ==} + hast-util-to-html@9.0.3: + resolution: {integrity: sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==} + hast-util-whitespace@2.0.1: resolution: {integrity: sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==} + hast-util-whitespace@3.0.0: + resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} + hey-listen@1.0.8: resolution: {integrity: sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q==} @@ -4272,6 +4318,9 @@ packages: resolution: {integrity: sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + html-void-elements@3.0.0: + resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==} + http-cache-semantics@4.1.1: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} @@ -4810,6 +4859,9 @@ packages: lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + linkify-it@5.0.0: + resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} + load-json-file@6.2.0: resolution: {integrity: sha512-gUD/epcRms75Cw8RT1pUdHugZYM5ce64ucs2GEISABwkRsOQr0q2wm/MV2TKThycIe5e0ytRweW2RZxclogCdQ==} engines: {node: '>=8'} @@ -4922,6 +4974,9 @@ packages: peerDependencies: react: ^16.5.1 || ^17.0.0 || ^18.0.0 + lunr@2.3.9: + resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==} + magic-string@0.16.0: resolution: {integrity: sha512-c4BEos3y6G2qO0B9X7K0FVLOPT9uGrjYwYRLFmDqyl5YMboUviyecnXWp94fJTSMwPw2/sf+CEYt5AGpmklkkQ==} @@ -4957,6 +5012,10 @@ packages: resolution: {integrity: sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q==} engines: {node: '>=0.10.0'} + markdown-it@14.1.0: + resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} + hasBin: true + markdown-table@3.0.3: resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==} @@ -5005,12 +5064,18 @@ packages: mdast-util-to-hast@12.3.0: resolution: {integrity: sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==} + mdast-util-to-hast@13.2.0: + resolution: {integrity: sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==} + mdast-util-to-markdown@1.5.0: resolution: {integrity: sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A==} mdast-util-to-string@3.2.0: resolution: {integrity: sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==} + mdurl@2.0.0: + resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} + mdx-annotations@0.1.3: resolution: {integrity: sha512-2XrOlQeBDUa8GirNHy/Y7BR1h/P+vzk+1G2rzAfqJ+lg6JcEOKMCqsVkpVFSw0hdzpVuj9BnoNeA+aU1XPTkoA==} @@ -5096,6 +5161,9 @@ packages: micromark-util-character@1.2.0: resolution: {integrity: sha512-lXraTwcX3yH/vMDaFWCQJP1uIszLVebzUa3ZHdrgxr7KEU/9mL4mVgCpGbyhvNLNlauROiNUq7WN5u7ndbY6xg==} + micromark-util-character@2.1.0: + resolution: {integrity: sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==} + micromark-util-chunked@1.1.0: resolution: {integrity: sha512-Ye01HXpkZPNcV6FiyoW2fGZDUw4Yc7vT0E9Sad83+bEDiCJ1uXu0S3mr8WLpsz3HaG3x2q0HM6CTuPdcZcluFQ==} @@ -5114,6 +5182,9 @@ packages: micromark-util-encode@1.1.0: resolution: {integrity: sha512-EuEzTWSTAj9PA5GOAs992GzNh2dGQO52UvAbtSOMvXTxv3Criqb6IOzJUBCmEqrrXSblJIJBbFFv6zPxpreiJw==} + micromark-util-encode@2.0.0: + resolution: {integrity: sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==} + micromark-util-events-to-acorn@1.2.3: resolution: {integrity: sha512-ij4X7Wuc4fED6UoLWkmo0xJQhsktfNh1J0m8g4PbIMPlx+ek/4YdW5mvbye8z/aZvAPUoxgXHrwVlXAPKMRp1w==} @@ -5129,15 +5200,24 @@ packages: micromark-util-sanitize-uri@1.2.0: resolution: {integrity: sha512-QO4GXv0XZfWey4pYFndLUKEAktKkG5kZTdUNaTAkzbuJxn2tNBOr+QtxR2XpWaMhbImT2dPzyLrPXLlPhph34A==} + micromark-util-sanitize-uri@2.0.0: + resolution: {integrity: sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==} + micromark-util-subtokenize@1.1.0: resolution: {integrity: sha512-kUQHyzRoxvZO2PuLzMt2P/dwVsTiivCK8icYTeR+3WgbuPqfHgPPy7nFKbeqRivBvn/3N3GBiNC+JRTMSxEC7A==} micromark-util-symbol@1.1.0: resolution: {integrity: sha512-uEjpEYY6KMs1g7QfJ2eX1SQEV+ZT4rUD3UcF6l57acZvLNK7PBZL+ty82Z1qhK1/yXIY4bdx04FKMgR0g4IAag==} + micromark-util-symbol@2.0.0: + resolution: {integrity: sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==} + micromark-util-types@1.1.0: resolution: {integrity: sha512-ukRBgie8TIAcacscVHSiddHjO4k/q3pnedmzMQ4iwDcK0FtFCohKOlFbaOL/mPgfnPsL3C1ZyxJa4sbWrBl3jg==} + micromark-util-types@2.0.0: + resolution: {integrity: sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==} + micromark@3.2.0: resolution: {integrity: sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==} @@ -5513,6 +5593,9 @@ packages: resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} engines: {node: '>=12'} + oniguruma-to-js@0.4.3: + resolution: {integrity: sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==} + open@9.1.0: resolution: {integrity: sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==} engines: {node: '>=14.16'} @@ -5919,6 +6002,10 @@ packages: pump@3.0.0: resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} + punycode.js@2.3.1: + resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} + engines: {node: '>=6'} + punycode@2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} @@ -6048,6 +6135,9 @@ packages: regenerator-runtime@0.14.0: resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} + regex@4.3.2: + resolution: {integrity: sha512-kK/AA3A9K6q2js89+VMymcboLOlF5lZRCYJv3gzszXFHBr6kO6qLGzbm+UIugBEV8SMMKCTR59txoY6ctRHYVw==} + regexp.prototype.flags@1.5.1: resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} engines: {node: '>= 0.4'} @@ -6289,6 +6379,9 @@ packages: shiki@0.11.1: resolution: {integrity: sha512-EugY9VASFuDqOexOgXR18ZV+TbFrQHeCpEYaXamO+SZlsnT/2LxuLBX25GGtIrwaEVFXUAbUQ601SWE2rMwWHA==} + shiki@1.18.0: + resolution: {integrity: sha512-8jo7tOXr96h9PBQmOHVrltnETn1honZZY76YA79MHheGQg55jBvbm9dtU+MI5pjC5NJCFuA6rvVTLVeSW5cE4A==} + shimmer@1.2.1: resolution: {integrity: sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw==} @@ -6845,6 +6938,19 @@ packages: typedarray-to-buffer@3.1.5: resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==} + typedoc-plugin-markdown@4.2.8: + resolution: {integrity: sha512-1EDsc66jaCjZtxdYy+Rl0KDU1WY/iyuCOOPaeFzcYFZ81FNXV8CmgUDOHri20WGmYnkEM5nQ+ooxj1vyuQo0Lg==} + engines: {node: '>= 18'} + peerDependencies: + typedoc: 0.26.x + + typedoc@0.26.7: + resolution: {integrity: sha512-gUeI/Wk99vjXXMi8kanwzyhmeFEGv1LTdTQsiyIsmSYsBebvFxhbcyAx7Zjo4cMbpLGxM4Uz3jVIjksu/I2v6Q==} + engines: {node: '>= 18'} + hasBin: true + peerDependencies: + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x + typescript@5.1.6: resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} engines: {node: '>=14.17'} @@ -6860,6 +6966,9 @@ packages: engines: {node: '>=14.17'} hasBin: true + uc.micro@2.1.0: + resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} + udc@1.0.1: resolution: {integrity: sha512-jv+D9de1flsum5QkFtBdjyppCQAdz9kTck/0xST5Vx48T9LL2BYnw0Iw77dSKDQ9KZ/PS3qPO1vfXHDpLZlxcQ==} @@ -6911,24 +7020,39 @@ packages: unist-util-is@5.2.1: resolution: {integrity: sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==} + unist-util-is@6.0.0: + resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==} + unist-util-position-from-estree@1.1.2: resolution: {integrity: sha512-poZa0eXpS+/XpoQwGwl79UUdea4ol2ZuCYguVaJS4qzIOMDzbqz8a3erUCOmubSZkaOuGamb3tX790iwOIROww==} unist-util-position@4.0.4: resolution: {integrity: sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==} + unist-util-position@5.0.0: + resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==} + unist-util-remove-position@4.0.2: resolution: {integrity: sha512-TkBb0HABNmxzAcfLf4qsIbFbaPDvMO6wa3b3j4VcEzFVaw1LBKwnW4/sRJ/atSLSzoIg41JWEdnE7N6DIhGDGQ==} unist-util-stringify-position@3.0.3: resolution: {integrity: sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==} + unist-util-stringify-position@4.0.0: + resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==} + unist-util-visit-parents@5.1.3: resolution: {integrity: sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==} + unist-util-visit-parents@6.0.1: + resolution: {integrity: sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==} + unist-util-visit@4.1.2: resolution: {integrity: sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==} + unist-util-visit@5.0.0: + resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} + universalify@0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} @@ -7041,9 +7165,15 @@ packages: vfile-message@3.1.4: resolution: {integrity: sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==} + vfile-message@4.0.2: + resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==} + vfile@5.3.7: resolution: {integrity: sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==} + vfile@6.0.3: + resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} + vite-node@1.6.0: resolution: {integrity: sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==} engines: {node: ^18.0.0 || >=20.0.0} @@ -7271,6 +7401,11 @@ packages: resolution: {integrity: sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==} engines: {node: '>= 14'} + yaml@2.5.1: + resolution: {integrity: sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==} + engines: {node: '>= 14'} + hasBin: true + yargs-parser@18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} engines: {node: '>=6'} @@ -9416,6 +9551,33 @@ snapshots: - encoding - supports-color + '@shikijs/core@1.18.0': + dependencies: + '@shikijs/engine-javascript': 1.18.0 + '@shikijs/engine-oniguruma': 1.18.0 + '@shikijs/types': 1.18.0 + '@shikijs/vscode-textmate': 9.2.2 + '@types/hast': 3.0.4 + hast-util-to-html: 9.0.3 + + '@shikijs/engine-javascript@1.18.0': + dependencies: + '@shikijs/types': 1.18.0 + '@shikijs/vscode-textmate': 9.2.2 + oniguruma-to-js: 0.4.3 + + '@shikijs/engine-oniguruma@1.18.0': + dependencies: + '@shikijs/types': 1.18.0 + '@shikijs/vscode-textmate': 9.2.2 + + '@shikijs/types@1.18.0': + dependencies: + '@shikijs/vscode-textmate': 9.2.2 + '@types/hast': 3.0.4 + + '@shikijs/vscode-textmate@9.2.2': {} + '@sigstore/bundle@1.1.0': dependencies: '@sigstore/protobuf-specs': 0.2.1 @@ -9689,6 +9851,10 @@ snapshots: dependencies: '@types/unist': 2.0.8 + '@types/hast@3.0.4': + dependencies: + '@types/unist': 2.0.8 + '@types/http-cache-semantics@4.0.3': {} '@types/inquirer@9.0.7': @@ -9712,6 +9878,10 @@ snapshots: dependencies: '@types/unist': 2.0.8 + '@types/mdast@4.0.4': + dependencies: + '@types/unist': 3.0.3 + '@types/mdx@2.0.8': {} '@types/minimist@1.2.2': {} @@ -9778,6 +9948,8 @@ snapshots: '@types/unist@2.0.8': {} + '@types/unist@3.0.3': {} + '@types/update-notifier@6.0.5': dependencies: '@types/configstore': 6.0.1 @@ -10033,6 +10205,8 @@ snapshots: '@typescript-eslint/types': 7.16.1 eslint-visitor-keys: 3.4.3 + '@ungap/structured-clone@1.2.0': {} + '@vercel/analytics@1.0.2': {} '@vitest/expect@1.6.0': @@ -10975,6 +11149,10 @@ snapshots: detect-node-es@1.1.0: {} + devlop@1.1.0: + dependencies: + dequal: 2.0.3 + didyoumean@1.2.2: {} diff-sequences@29.6.3: {} @@ -11060,6 +11238,8 @@ snapshots: ansi-colors: 4.1.3 strip-ansi: 6.0.1 + entities@4.5.0: {} + env-paths@2.2.1: {} err-code@2.0.3: {} @@ -11775,7 +11955,7 @@ snapshots: dependencies: foreground-child: 3.1.1 jackspeak: 2.3.6 - minimatch: 9.0.3 + minimatch: 9.0.5 minipass: 7.0.3 path-scurry: 1.10.1 @@ -11938,8 +12118,26 @@ snapshots: transitivePeerDependencies: - supports-color + hast-util-to-html@9.0.3: + dependencies: + '@types/hast': 3.0.4 + '@types/unist': 3.0.3 + ccount: 2.0.1 + comma-separated-tokens: 2.0.3 + hast-util-whitespace: 3.0.0 + html-void-elements: 3.0.0 + mdast-util-to-hast: 13.2.0 + property-information: 6.3.0 + space-separated-tokens: 2.0.2 + stringify-entities: 4.0.3 + zwitch: 2.0.4 + hast-util-whitespace@2.0.1: {} + hast-util-whitespace@3.0.0: + dependencies: + '@types/hast': 3.0.4 + hey-listen@1.0.8: {} highlight-words-core@1.2.2: {} @@ -11964,6 +12162,8 @@ snapshots: dependencies: lru-cache: 7.18.3 + html-void-elements@3.0.0: {} + http-cache-semantics@4.1.1: {} http-proxy-agent@5.0.0: @@ -12013,7 +12213,7 @@ snapshots: ignore-walk@6.0.3: dependencies: - minimatch: 9.0.3 + minimatch: 9.0.5 ignore@5.2.4: {} @@ -12478,6 +12678,10 @@ snapshots: lines-and-columns@1.2.4: {} + linkify-it@5.0.0: + dependencies: + uc.micro: 2.1.0 + load-json-file@6.2.0: dependencies: graceful-fs: 4.2.11 @@ -12577,6 +12781,8 @@ snapshots: dependencies: react: 18.2.0 + lunr@2.3.9: {} + magic-string@0.16.0: dependencies: vlq: 0.2.3 @@ -12621,6 +12827,15 @@ snapshots: markdown-extensions@1.1.1: {} + markdown-it@14.1.0: + dependencies: + argparse: 2.0.1 + entities: 4.5.0 + linkify-it: 5.0.0 + mdurl: 2.0.0 + punycode.js: 2.3.1 + uc.micro: 2.1.0 + markdown-table@3.0.3: {} mdast-util-definitions@5.1.2: @@ -12760,6 +12975,18 @@ snapshots: unist-util-position: 4.0.4 unist-util-visit: 4.1.2 + mdast-util-to-hast@13.2.0: + dependencies: + '@types/hast': 3.0.4 + '@types/mdast': 4.0.4 + '@ungap/structured-clone': 1.2.0 + devlop: 1.1.0 + micromark-util-sanitize-uri: 2.0.0 + trim-lines: 3.0.1 + unist-util-position: 5.0.0 + unist-util-visit: 5.0.0 + vfile: 6.0.3 + mdast-util-to-markdown@1.5.0: dependencies: '@types/mdast': 3.0.12 @@ -12775,6 +13002,8 @@ snapshots: dependencies: '@types/mdast': 3.0.12 + mdurl@2.0.0: {} + mdx-annotations@0.1.3: dependencies: acorn: 8.11.3 @@ -12987,6 +13216,11 @@ snapshots: micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 + micromark-util-character@2.1.0: + dependencies: + micromark-util-symbol: 2.0.0 + micromark-util-types: 2.0.0 + micromark-util-chunked@1.1.0: dependencies: micromark-util-symbol: 1.1.0 @@ -13015,6 +13249,8 @@ snapshots: micromark-util-encode@1.1.0: {} + micromark-util-encode@2.0.0: {} + micromark-util-events-to-acorn@1.2.3: dependencies: '@types/acorn': 4.0.6 @@ -13042,6 +13278,12 @@ snapshots: micromark-util-encode: 1.1.0 micromark-util-symbol: 1.1.0 + micromark-util-sanitize-uri@2.0.0: + dependencies: + micromark-util-character: 2.1.0 + micromark-util-encode: 2.0.0 + micromark-util-symbol: 2.0.0 + micromark-util-subtokenize@1.1.0: dependencies: micromark-util-chunked: 1.1.0 @@ -13051,8 +13293,12 @@ snapshots: micromark-util-symbol@1.1.0: {} + micromark-util-symbol@2.0.0: {} + micromark-util-types@1.1.0: {} + micromark-util-types@2.0.0: {} + micromark@3.2.0: dependencies: '@types/debug': 4.1.8 @@ -13515,6 +13761,10 @@ snapshots: dependencies: mimic-fn: 4.0.0 + oniguruma-to-js@0.4.3: + dependencies: + regex: 4.3.2 + open@9.1.0: dependencies: default-browser: 4.0.0 @@ -13798,12 +14048,13 @@ snapshots: optionalDependencies: postcss: 8.4.39 - postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.39): + postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.39)(yaml@2.5.1): dependencies: lilconfig: 3.1.2 optionalDependencies: jiti: 1.21.6 postcss: 8.4.39 + yaml: 2.5.1 postcss-nested@6.0.1(postcss@8.4.31): dependencies: @@ -13931,6 +14182,8 @@ snapshots: end-of-stream: 1.4.4 once: 1.4.0 + punycode.js@2.3.1: {} + punycode@2.3.0: {} pupa@2.1.1: @@ -14080,6 +14333,8 @@ snapshots: regenerator-runtime@0.14.0: {} + regex@4.3.2: {} + regexp.prototype.flags@1.5.1: dependencies: call-bind: 1.0.2 @@ -14362,6 +14617,15 @@ snapshots: vscode-oniguruma: 1.7.0 vscode-textmate: 6.0.0 + shiki@1.18.0: + dependencies: + '@shikijs/core': 1.18.0 + '@shikijs/engine-javascript': 1.18.0 + '@shikijs/engine-oniguruma': 1.18.0 + '@shikijs/types': 1.18.0 + '@shikijs/vscode-textmate': 9.2.2 + '@types/hast': 3.0.4 + shimmer@1.2.1: {} side-channel@1.0.4: @@ -14854,7 +15118,7 @@ snapshots: - supports-color - ts-node - tsup@8.2.2(jiti@1.21.6)(postcss@8.4.39)(typescript@5.5.3): + tsup@8.2.2(jiti@1.21.6)(postcss@8.4.39)(typescript@5.5.3)(yaml@2.5.1): dependencies: bundle-require: 5.0.0(esbuild@0.23.0) cac: 6.7.14 @@ -14866,7 +15130,7 @@ snapshots: globby: 11.1.0 joycon: 3.1.1 picocolors: 1.0.1 - postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.39) + postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.39)(yaml@2.5.1) resolve-from: 5.0.0 rollup: 4.19.0 source-map: 0.8.0-beta.0 @@ -14960,12 +15224,27 @@ snapshots: dependencies: is-typedarray: 1.0.0 + typedoc-plugin-markdown@4.2.8(typedoc@0.26.7(typescript@5.5.3)): + dependencies: + typedoc: 0.26.7(typescript@5.5.3) + + typedoc@0.26.7(typescript@5.5.3): + dependencies: + lunr: 2.3.9 + markdown-it: 14.1.0 + minimatch: 9.0.5 + shiki: 1.18.0 + typescript: 5.5.3 + yaml: 2.5.1 + typescript@5.1.6: {} typescript@5.2.2: {} typescript@5.5.3: {} + uc.micro@2.1.0: {} + udc@1.0.1: {} ufo@1.3.1: {} @@ -15027,6 +15306,10 @@ snapshots: dependencies: '@types/unist': 2.0.8 + unist-util-is@6.0.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-position-from-estree@1.1.2: dependencies: '@types/unist': 2.0.8 @@ -15035,6 +15318,10 @@ snapshots: dependencies: '@types/unist': 2.0.8 + unist-util-position@5.0.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-remove-position@4.0.2: dependencies: '@types/unist': 2.0.8 @@ -15044,17 +15331,32 @@ snapshots: dependencies: '@types/unist': 2.0.8 + unist-util-stringify-position@4.0.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-visit-parents@5.1.3: dependencies: '@types/unist': 2.0.8 unist-util-is: 5.2.1 + unist-util-visit-parents@6.0.1: + dependencies: + '@types/unist': 3.0.3 + unist-util-is: 6.0.0 + unist-util-visit@4.1.2: dependencies: '@types/unist': 2.0.8 unist-util-is: 5.2.1 unist-util-visit-parents: 5.1.3 + unist-util-visit@5.0.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-is: 6.0.0 + unist-util-visit-parents: 6.0.1 + universalify@0.1.2: {} universalify@2.0.0: {} @@ -15188,6 +15490,11 @@ snapshots: '@types/unist': 2.0.8 unist-util-stringify-position: 3.0.3 + vfile-message@4.0.2: + dependencies: + '@types/unist': 3.0.3 + unist-util-stringify-position: 4.0.0 + vfile@5.3.7: dependencies: '@types/unist': 2.0.8 @@ -15195,6 +15502,11 @@ snapshots: unist-util-stringify-position: 3.0.3 vfile-message: 3.1.4 + vfile@6.0.3: + dependencies: + '@types/unist': 3.0.3 + vfile-message: 4.0.2 + vite-node@1.6.0(@types/node@18.18.6)(terser@5.20.0): dependencies: cac: 6.7.14 @@ -15459,6 +15771,8 @@ snapshots: yaml@2.3.2: {} + yaml@2.5.1: {} + yargs-parser@18.1.3: dependencies: camelcase: 5.3.1 From 81724048765bffdb15a08607004f9e36e0adb342 Mon Sep 17 00:00:00 2001 From: 0div Date: Tue, 24 Sep 2024 18:18:32 +0200 Subject: [PATCH 02/29] allow commit failure in workflow --- .github/workflows/generate_api_ref.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate_api_ref.yml b/.github/workflows/generate_api_ref.yml index 93428b5cd..4e89a997e 100644 --- a/.github/workflows/generate_api_ref.yml +++ b/.github/workflows/generate_api_ref.yml @@ -105,5 +105,5 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add apps/web/src/app/\(docs\)/docs/api-reference - git commit -m "[skip ci] Release new SDK API reference doc versions" + git commit -m "[skip ci] Release new SDK API reference doc versions" || exit 0 git push \ No newline at end of file From 08daef2d4993ceea8057ad258e8c10791a59a925 Mon Sep 17 00:00:00 2001 From: 0div Date: Thu, 26 Sep 2024 09:47:05 +0200 Subject: [PATCH 03/29] prebuild API ref routes and adapt component for nested ul elements --- apps/web/package.json | 1 + apps/web/prebuild.js | 42 ++ apps/web/src/components/Navigation/index.tsx | 203 ++++--- apps/web/src/components/Navigation/routes.tsx | 506 +++++++++--------- 4 files changed, 420 insertions(+), 332 deletions(-) create mode 100644 apps/web/prebuild.js diff --git a/apps/web/package.json b/apps/web/package.json index 446beead2..216079310 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -4,6 +4,7 @@ "private": true, "scripts": { "dev": "next dev", + "prebuild": "node prebuild.js", "build": "next build", "start": "next start", "lint": "next lint", diff --git a/apps/web/prebuild.js b/apps/web/prebuild.js new file mode 100644 index 000000000..18dc759cc --- /dev/null +++ b/apps/web/prebuild.js @@ -0,0 +1,42 @@ +const fs = require('fs') +const path = require('path') + +function walkDir(dir, basePath = '') { + const entries = fs.readdirSync(dir, { withFileTypes: true }) + + return entries + .map((entry) => { + const relativePath = path.join(basePath, entry.name) + + if (entry.isDirectory()) { + let route = { title: entry.name } + const links = walkDir(path.join(dir, entry.name), relativePath) + if (links.length > 0) { + route.links = links + } else { + route.href = '/' + relativePath + } + return route + } + }) + .filter(Boolean) +} + +function generateApiRefRoutes() { + const apiRefPath = path.join(__dirname, './src/app/(docs)/docs/api-reference') + + if (!fs.existsSync(apiRefPath)) { + return [] + } + + return walkDir(apiRefPath) +} + +const apiRefRoutes = generateApiRefRoutes() + +fs.writeFileSync( + path.join(__dirname, './src/components/Navigation/apiRefRoutes.json'), + JSON.stringify(apiRefRoutes, null, 2) +) + +console.log('API reference routes generated successfully.') diff --git a/apps/web/src/components/Navigation/index.tsx b/apps/web/src/components/Navigation/index.tsx index daab33929..7c202aa0e 100644 --- a/apps/web/src/components/Navigation/index.tsx +++ b/apps/web/src/components/Navigation/index.tsx @@ -1,16 +1,16 @@ 'use client' -import { useRef } from 'react' -import Link from 'next/link' -import { usePathname } from 'next/navigation' import clsx from 'clsx' import { AnimatePresence, motion, useIsPresent } from 'framer-motion' +import Link from 'next/link' +import { usePathname } from 'next/navigation' +import { useRef } from 'react' +import { Auth } from '@/components/Auth' import { useIsInsideMobileNavigation } from '@/components/MobileNavigation' import { useSectionStore } from '@/components/SectionProvider' import { Tag } from '@/components/Tag' import { remToPx } from '@/lib/remToPx' -import { Auth } from '@/components/Auth' import { routes } from './routes' interface NavGroup { @@ -76,17 +76,14 @@ function NavLink({ ? 'text-zinc-900 dark:text-white' : 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white', isFontMono ? 'font-mono text-xs' : '', - className, + className )} >
{icon} {tag ? (
- + {tag} @@ -94,7 +91,9 @@ function NavLink({
) : ( - {children} + + {children} + )}
@@ -103,19 +102,27 @@ function NavLink({ function VisibleSectionHighlight({ group, pathname }) { const [sections, visibleSections] = useInitialValue( - [useSectionStore(s => s.sections), useSectionStore(s => s.visibleSections)], - useIsInsideMobileNavigation(), + [ + useSectionStore((s) => s.sections), + useSectionStore((s) => s.visibleSections), + ], + useIsInsideMobileNavigation() ) const isPresent = useIsPresent() const firstVisibleSectionIndex = Math.max( 0, - [{ id: '_top' }, ...sections].findIndex(section => section.id === visibleSections[0]), + [{ id: '_top' }, ...sections].findIndex( + (section) => section.id === visibleSections[0] + ) ) const itemHeight = remToPx(2) - const height = isPresent ? Math.max(1, visibleSections.length) * itemHeight : itemHeight + const height = isPresent + ? Math.max(1, visibleSections.length) * itemHeight + : itemHeight const activePageIndex = activeGroupIndex(group, pathname) - const top = activePageIndex * itemHeight + firstVisibleSectionIndex * itemHeight + const top = + activePageIndex * itemHeight + firstVisibleSectionIndex * itemHeight return ( s.sections)], - isInsideMobileNavigation, + [initialPathname, useSectionStore((s) => s.sections)], + isInsideMobileNavigation ) if (!pathname) { @@ -176,10 +189,7 @@ function NavigationGroup({ group, className }) {
{isActiveGroup && ( - + )} {isActiveGroup && ( - + )} -
    - {group.links.map(link => ( - +
      + {group.links.map((link) => ( + {/* @ts-ignore */} - - {link.title} - - - {`/docs${link.href}` === pathname && sections.length > 0 && ( - - {sections.map(section => ( -
    • - {/* @ts-ignore */} - - {section.title} - -
    • - ))} -
      - )} + {link.href ? ( + + {link.title} + + ) : ( + {link.title} + )} + + {`/docs${link.href}` === pathname && + (sections.length > 0 || link.links) && ( + + {sections.map((section) => ( +
    • + {/* @ts-ignore */} + + {section.title} + +
    • + ))} + {link.links && + link.links.map((nestedLink) => ( +
    • + + {nestedLink.title} + + {nestedLink.links && ( +
        + {nestedLink.links.map((deepNestedLink) => ( +
      • + + {deepNestedLink.title} + +
      • + ))} +
      + )} +
    • + ))} +
      + )}
      ))} @@ -260,7 +296,6 @@ function NavigationGroup({ group, className }) { ) } - export function Navigation(props) { return (
+
) } diff --git a/apps/web/src/components/Navigation/routes.tsx b/apps/web/src/components/Navigation/routes.tsx index e5a30e1b6..945cf3847 100644 --- a/apps/web/src/components/Navigation/routes.tsx +++ b/apps/web/src/components/Navigation/routes.tsx @@ -77,7 +77,7 @@ export const routes = [ title: 'Quickstart', links: [ { - title: 'Set up E2B Sandbox', + title: 'Start E2B Sandbox', href: '/docs/installation', }, ] @@ -86,7 +86,7 @@ export const routes = [ title: 'Guides', // How to's links: [ { - title: 'Executed AI-generated code', + title: 'Execute AI-generated code', href: '/docs/a', }, { @@ -94,12 +94,24 @@ export const routes = [ href: '/docs/b', }, { - title: 'Upload & download files', + title: 'Set environment variables', href: '/docs/c', }, { - title: 'Customize CPU and RAM', + title: 'Upload & download files', href: '/docs/d', + }, + { + title: 'Customize CPU and RAM', + href: '/docs/e', + }, + { + title: 'Set working directory', + href: '/docs/f', + }, + { + title: 'Associate specific sandbox with your user', + href: '/docs/g', } ] }, @@ -120,6 +132,23 @@ export const routes = [ }, ] }, + { + title: 'Sandbox', + links: [ + { + title: 'Lifecycle', + href: '/docs/sandbox/lifecycle', + }, + { + title: 'Metadata', + href: '/docs/sandbox/filesystem', + }, + { + title: 'Customization', + href: '/docs/sandbox/customization', + } + ], + }, { title: 'Filesystem', links: [ @@ -136,6 +165,7 @@ export const routes = [ title: 'Overview', href: '/docs/process/overview', }, + ] }, { diff --git a/packages/js-sdk/package.json b/packages/js-sdk/package.json index 3e7b8c9ca..23d667138 100644 --- a/packages/js-sdk/package.json +++ b/packages/js-sdk/package.json @@ -52,7 +52,7 @@ "playwright": "^1.48.0", "react": "^18.3.1", "tsup": "^8.0.2", - "typedoc": "^0.26.7", + "typedoc": "^0.26.8", "typedoc-plugin-markdown": "^4.2.7", "typescript": "^5.4.5", "vitest": "^2.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1077dc20d..b43bd8cf1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -382,7 +382,7 @@ importers: specifier: ^8.0.2 version: 8.3.0(typescript@5.5.3) typedoc: - specifier: ^0.26.7 + specifier: ^0.26.8 version: 0.26.8(typescript@5.5.3) typedoc-plugin-markdown: specifier: ^4.2.7 From f2de8cb89f286aa3d8ef3b50aeaaaf3a308d821c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 12 Oct 2024 19:57:33 +0000 Subject: [PATCH 25/29] [skip ci] Release new SDK API reference doc versions --- .../api-reference/cli/v0.5.10/auth/page.mdx | 58 ++ .../cli/v0.5.10/sandbox/page.mdx | 84 ++ .../cli/v0.5.10/template/page.mdx | 90 +++ .../js-sdk/v0.16.2-beta.52/errors/page.mdx | 206 +++++ .../v0.16.2-beta.52/filesystem/page.mdx | 440 +++++++++++ .../js-sdk/v0.16.2-beta.52/process/page.mdx | 27 + .../js-sdk/v0.16.2-beta.52/sandbox/page.mdx | 476 ++++++++++++ .../python-sdk/v0.17.1/exceptions/page.mdx | 75 ++ .../python-sdk/v0.17.1/sandbox_async/page.mdx | 719 ++++++++++++++++++ .../python-sdk/v0.17.1/sandbox_sync/page.mdx | 661 ++++++++++++++++ 10 files changed, 2836 insertions(+) create mode 100644 apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/auth/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/template/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/errors/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/filesystem/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/process/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/sandbox/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/exceptions/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx create mode 100644 apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/auth/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/auth/page.mdx new file mode 100644 index 000000000..5e547262c --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/auth/page.mdx @@ -0,0 +1,58 @@ +# e2b auth + + +authentication commands + +## Usage + +```bash +e2b auth [options] [command] +``` +# e2b auth login + + +log in to CLI + +## Usage + +```bash +e2b auth login [options] +``` + + +# e2b auth logout + + +log out of CLI + +## Usage + +```bash +e2b auth logout [options] +``` + + +# e2b auth info + + +get information about the current user + +## Usage + +```bash +e2b auth info [options] +``` + + +# e2b auth configure + + +configure user + +## Usage + +```bash +e2b auth configure [options] +``` + + diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx new file mode 100644 index 000000000..060e6969c --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx @@ -0,0 +1,84 @@ +# e2b sandbox + + +work with sandboxes + +## Usage + +```bash +e2b sandbox [options] [command] +``` +# e2b sandbox connect + + +connect terminal to already running sandbox + +## Usage + +```bash +e2b sandbox connect [options] +``` + + +# e2b sandbox list + + +list all running sandboxes + +## Usage + +```bash +e2b sandbox list [options] +``` + + +# e2b sandbox kill + + +kill sandbox + +## Usage + +```bash +e2b sandbox kill [options] +``` + + +# e2b sandbox spawn + + +spawn sandbox and connect terminal to it + +## Usage + +```bash +e2b sandbox spawn [options] [template] +``` + +## Options + + + - `-p, --path : change root directory where command is executed to directory ` + - `--config : specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. ` + + +# e2b sandbox logs + + +show logs for sandbox + +## Usage + +```bash +e2b sandbox logs [options] +``` + +## Options + + + - `--level : filter logs by level (DEBUG, INFO, WARN, ERROR). The logs with the higher levels will be also shown. [default: INFO]` + - `-f, --follow: keep streaming logs until the sandbox is closed ` + - `--format : specify format for printing logs (json, pretty) [default: pretty]` + - `--loggers [loggers]: filter logs by loggers. The available loggers are process, filesystem, terminal, network, file. Specify multiple loggers by separating them with a comma. [default: process,filesystem]` + + diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/template/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/template/page.mdx new file mode 100644 index 000000000..48d3dcb2e --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/template/page.mdx @@ -0,0 +1,90 @@ +# e2b template + + +manage sandbox templates + +## Usage + +```bash +e2b template [options] [command] +``` +# e2b template build + + +build sandbox template defined by ./e2b.Dockerfile or ./Dockerfile in root directory. By default the root directory is the current working directory. This command also creates e2b.toml config. + +## Usage + +```bash +e2b template build [options] [template] +``` + +## Options + + + - `-p, --path : change root directory where command is executed to directory ` + - `-d, --dockerfile : specify path to Dockerfile. By default E2B tries to find e2b.Dockerfile or Dockerfile in root directory. ` + - `-n, --name : specify sandbox template name. You can use the template name to start the sandbox with SDK. The template name must be lowercase and contain only letters, numbers, dashes and underscores. ` + - `-c, --cmd : specify command that will be executed when the sandbox is started. ` + - `-t, --team : specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). ` + - `--config : specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. ` + - `--cpu-count : specify the number of CPUs that will be used to run the sandbox. The default value is 2. ` + - `--memory-mb : specify the amount of memory in megabytes that will be used to run the sandbox. Must be an even number. The default value is 512. ` + - `--build-arg : specify additional build arguments for the build command. The format should be =. ` + + +# e2b template list + + +list sandbox templates + +## Usage + +```bash +e2b template list [options] +``` + +## Options + + + - `-t, --team : specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). ` + + +# e2b template init + + +create basic E2B Dockerfile (./e2b.Dockerfile) in root directory. You can then run e2b template build to build sandbox template from this Dockerfile + +## Usage + +```bash +e2b template init [options] +``` + +## Options + + + - `-p, --path : change root directory where command is executed to directory ` + + +# e2b template delete + + +delete sandbox template and e2b.toml config + +## Usage + +```bash +e2b template delete [options] [template] +``` + +## Options + + + - `-p, --path : change root directory where command is executed to directory ` + - `--config : specify path to the E2B config toml. By default E2B tries to find ./e2b.toml in root directory. ` + - `-s, --select: select sandbox template from interactive list ` + - `-t, --team : specify the team ID that the operation will be associated with. You can find team ID in the team settings in the E2B dashboard (https://e2b.dev/dashboard?tab=team). ` + - `-y, --yes: skip manual delete confirmation ` + + diff --git a/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/errors/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/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.52/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.52/filesystem/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/filesystem/page.mdx new file mode 100644 index 000000000..6b20d4b01 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/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 + +##### watch() + +> **watch**(`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.52/process/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/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.52/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.52/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/js-sdk/v0.16.2-beta.52/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.52/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/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/exceptions/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/exceptions/page.mdx new file mode 100644 index 000000000..256bf8a08 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/exceptions/page.mdx @@ -0,0 +1,75 @@ + + + +## SandboxException + +```python +class SandboxException(Exception) +``` + +Raised when a sandbox exception occurs. + +Base class for all sandbox errors. + + +## TimeoutException + +```python +class TimeoutException(SandboxException) +``` + +Raised when a timeout occurs. + +The [unavailable] exception type is caused by sandbox timeout. + +The [canceled] exception type is caused by exceeding request timeout. + +The [deadline_exceeded] exception type is caused by exceeding the timeout for process, watch, etc. + +The [unknown] exception type is sometimes caused by the sandbox timeout when the request is not processed correctly. + + +## NotEnoughSpaceException + +```python +class NotEnoughSpaceException(SandboxException) +``` + +Raised when there is not enough disk space. + + +## NotFoundException + +```python +class NotFoundException(SandboxException) +``` + +Raised when a resource is not found. + + +## InvalidArgumentException + +```python +class InvalidArgumentException(SandboxException) +``` + +Raised when an invalid argument is provided. + + +## AuthenticationException + +```python +class AuthenticationException(SandboxException) +``` + +Raised when authentication fails. + + +## TemplateException + +```python +class TemplateException(SandboxException) +``` + +Exception raised when the template uses old envd version. It isn't compatible with the new SDK. + diff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx new file mode 100644 index 000000000..a7511b576 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_async/page.mdx @@ -0,0 +1,719 @@ + + + + + +## AsyncSandbox + +```python +class AsyncSandbox(SandboxSetup, SandboxApi) +``` + +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 `AsyncSandbox.create()` to create a new sandbox. + +**Example**: + +```python +sandbox = await AsyncSandbox.create() +``` + + +#### files + +```python +@property +def files() -> Filesystem +``` + +Filesystem module for interacting with the sandbox's filesystem + + +#### commands + +```python +@property +def commands() -> Process +``` + +Commands module for interacting with the sandbox's processes + + +#### pty + +```python +@property +def pty() -> Pty +``` + +PTY module for interacting with the sandbox's pseudo-terminal. + + +#### sandbox\_id + +```python +@property +def sandbox_id() -> str +``` + +Get the sandbox ID + + +#### envd\_api\_url + +```python +@property +def envd_api_url() -> str +``` + +Get the sandbox API URL + + +#### connection\_config + +```python +@property +def connection_config() -> ConnectionConfig +``` + +Get the ConnectionConfig object + + +#### \_\_init\_\_ + +```python +def __init__(**opts: Unpack[AsyncSandboxOpts]) +``` + +Use `Sandbox.create()` instead. + + +#### is\_running + +```python +async def is_running(request_timeout: Optional[float] = None) -> bool +``` + +Check if the sandbox is running. + +**Returns**: + +`True` if the sandbox is running, `False` otherwise +Example +```python +sandbox = await AsyncSandbox.create() +await sandbox.is_running() # Returns True + +await sandbox.kill() +await sandbox.is_running() # Returns False +``` + + +#### create + +```python +@classmethod +async def create(cls, + template: Optional[str] = None, + timeout: Optional[int] = None, + metadata: Optional[Dict[str, str]] = None, + envs: Optional[Dict[str, str]] = None, + api_key: Optional[str] = None, + domain: Optional[str] = None, + debug: Optional[bool] = None, + request_timeout: Optional[float] = None) +``` + +Creates a new sandbox. + +This method creates a new sandbox in the async version, +you have to use this method instead of using the constructor. + + +#### connect + +```python +@classmethod +async def connect(cls, + sandbox_id: str, + api_key: Optional[str] = None, + domain: Optional[str] = None, + debug: Optional[bool] = None) +``` + +Connects to an existing Sandbox. + +**Arguments**: + +- `sandbox_id`: Sandbox ID +- `api_key`: E2B API Key +- `domain`: E2B Domain (use only if you self-host E2B) +- `debug`: For developing purposes, uses a local sandbox + +**Returns**: + +Sandbox object +@example +```python +sandbox = await AsyncSandbox.create() +sandbox_id = sandbox.sandbox_id + +same_sandbox = await AsyncSandbox.connect(sandbox_id) + + +#### kill + +```python +@class_method_variant("_cls_kill") +async def kill(request_timeout: Optional[float] = None) -> bool +``` + +Kill the sandbox. + +**Arguments**: + +- `request_timeout`: Timeout for the request + +**Returns**: + +`True` if the sandbox was killed, `False` if the sandbox was not found + + +#### set\_timeout + +```python +@class_method_variant("_cls_set_timeout") +async def set_timeout(timeout: int, + request_timeout: Optional[float] = None) -> None +``` + +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. + +**Arguments**: + +- `timeout`: Duration in milliseconds. Must be between 0 and 86400000 milliseconds (24 hours). +- `request_timeout`: Timeout for the request + + + + +## Process + +```python +class Process() +``` + +Manager for starting and interacting with processes in the sandbox. + + +#### list + +```python +async def list(request_timeout: Optional[float] = None) -> List[ProcessInfo] +``` + +Lists all running processes. + +**Arguments**: + +- `request_timeout`: Request timeout + +**Returns**: + +List of running processes + + +#### kill + +```python +async def kill(pid: int, request_timeout: Optional[float] = None) -> bool +``` + +Kills a process. + +**Arguments**: + +- `pid`: Process ID to connect to. You can get the list of processes using `sandbox.commands.list()`. +- `request_timeout`: Request timeout + +**Returns**: + +`True` if the process was killed, `False` if the process was not found + + +#### send\_stdin + +```python +async def send_stdin(pid: int, + data: str, + request_timeout: Optional[float] = None) -> None +``` + +Sends data to the stdin of a process. + +:param pid Process ID to send data to. You can get the list of processes using `sandbox.commands.list()`. +:param data: Data to send to the process +:param request_timeout: Request timeout + + + +#### run + +```python +async def run(cmd: str, + background: Union[bool, None] = None, + envs: Optional[Dict[str, str]] = None, + user: Username = "user", + cwd: Optional[str] = None, + on_stdout: Optional[OutputHandler[Stdout]] = None, + on_stderr: Optional[OutputHandler[Stderr]] = None, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) +``` + +Starts a new process and depending on the `background` parameter, waits for the process to finish or not. + +:param cmd Command to execute +:param background: + If `True`, the function will return a `ProcessHandle` object that can be used to interact with the process. + If `False`, the function will wait for the process to finish and return a `ProcessResult` object. +:param envs: Environment variables +:param user: User to run the process as +:param cwd: Working directory +:param on_stdout: Callback for stdout +:param on_stderr: Callback for stderr +:param timeout: Timeout for the maximum time the process is allowed to run +:param request_timeout: Timeout for the request +:return: `ProcessHandle` if `background` is `True`, `ProcessResult` if `background` is `False` + + + +#### connect + +```python +async def connect( + pid: int, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None, + on_stdout: Optional[OutputHandler[Stdout]] = None, + on_stderr: Optional[OutputHandler[Stderr]] = None +) -> AsyncProcessHandle +``` + +Connects to an existing process. + +**Arguments**: + +- `pid`: Process ID to connect to. You can get the list of processes using `sandbox.commands.list()`. +- `timeout`: Timeout for the connection +- `request_timeout`: Request timeout +- `on_stdout`: Callback for stdout +- `on_stderr`: Callback for stderr + + + + +## Pty + +```python +class Pty() +``` + +Manager for starting and interacting with PTY (pseudo-terminal) processes in the sandbox. + + +#### kill + +```python +async def kill(pid: int, request_timeout: Optional[float] = None) -> bool +``` + +Kills a process. + +**Arguments**: + +- `pid`: Process ID to kill. You can get the list of processes using `sandbox.commands.list()`. +- `request_timeout`: Timeout for the request + +**Returns**: + +`true` if the process was killed, `false` if the process was not found + + +#### send\_stdin + +```python +async def send_stdin(pid: int, + data: bytes, + request_timeout: Optional[float] = None) -> None +``` + +Sends input to a PTY process. + +**Arguments**: + +- `pid`: Process ID of the PTY process +- `data`: Input data to send +- `request_timeout`: Timeout for the request + + +#### create + +```python +async def create( + size: PtySize, + on_data: OutputHandler[PtyOutput], + user: Username = "user", + cwd: Optional[str] = None, + envs: Optional[Dict[str, str]] = None, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) -> AsyncProcessHandle +``` + +Starts a new process with a PTY (pseudo-terminal). + +**Arguments**: + +- `size`: Size of the PTY +- `on_data`: Callback for handling PTY output +- `user`: User to start the process as +- `cwd`: Current working directory +- `envs`: Environment variables +- `timeout`: Timeout for the request +- `request_timeout`: Timeout for the request + +**Returns**: + +New process + + +#### resize + +```python +async def resize(pid: int, + size: PtySize, + request_timeout: Optional[float] = None) +``` + +Resizes a PTY process (changes the number of columns and rows in the terminal). + +**Arguments**: + +- `pid`: Process ID of the PTY process +- `size`: New size of the PTY +- `request_timeout`: Timeout for the request + + + + +## AsyncProcessHandle + +```python +class AsyncProcessHandle() +``` + +Class representing a process. It provides methods for waiting and killing the process. + + +#### pid + +```python +@property +def pid() +``` + +Get the process ID. + + +#### stdout + +```python +@property +def stdout() +``` + +Stdout of the process. + + +#### stderr + +```python +@property +def stderr() +``` + +Stderr of the process. + + +#### error + +```python +@property +def error() +``` + +Error message of the process. It is `None` if the process is still running. + + +#### exit\_code + +```python +@property +def exit_code() +``` + +Exit code of the process. It is `None` if the process is still running. + + +#### disconnect + +```python +async def disconnect() -> None +``` + +Disconnects from the process. It does not kill the process. It only stops receiving events from the process. + + +#### wait + +```python +async def wait() -> ProcessResult +``` + +Waits for the process to finish and returns the result. + +If the process exits with a non-zero exit code, it throws a `ProcessExitException`. + +**Returns**: + +Process result + + +#### kill + +```python +async def kill() -> bool +``` + +Kills the process. + +**Returns**: + +Whether the process was killed successfully + + + + + + +## AsyncWatchHandle + +```python +class AsyncWatchHandle() +``` + +Class representing the watch operation. It provides method to stop the watch operation. + + +#### close + +```python +async def close() +``` + +Stop watching the directory. + + + + +## Filesystem + +```python +class Filesystem() +``` + +Manager for interacting with the filesystem in the sandbox. + + +#### read + +```python +async def read(path: str, + format: Literal["text", "bytes", "stream"] = "text", + user: Username = "user", + request_timeout: Optional[float] = None) +``` + +Reads a whole file content and returns it in requested format (text by default). + +:param path: Path to the file +:param format: Format of the file content +:param user: Run the operation as this user +:param request_timeout: Timeout for the request +:return File content in requested format + + + +#### write + +```python +async def write(path: str, + data: Union[str, bytes, IO], + user: Username = "user", + request_timeout: Optional[float] = None) -> 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. + +**Arguments**: + +- `path`: Path to the file +- `data`: Data to write to the file +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request + +**Returns**: + +Information about the written file + + +#### list + +```python +async def list(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> List[EntryInfo] +``` + +Lists entries in a directory. + +**Arguments**: + +- `path`: Path to the directory +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request + +**Returns**: + +List of entries in the directory + + +#### exists + +```python +async def exists(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> bool +``` + +Checks if a file or a directory exists. + +:param path: Path to a file or a directory +:param user Run the operation as this user +:param request_timeout Timeout for the request + + + +#### remove + +```python +async def remove(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> None +``` + +Removes a file or a directory. + +**Arguments**: + +- `path`: Path to a file or a directory +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request + + +#### rename + +```python +async def rename(old_path: str, + new_path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> EntryInfo +``` + +Renames a file or directory from one path to another. + +:param old_path Path to the file or directory to move +:param new_path Path to move the file or directory to +:param user Run the operation as this user +:param request_timeout Timeout for the request + +:return: Information about the renamed file or directory + + + +#### make\_dir + +```python +async def make_dir(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> bool +``` + +Creates a new directory and all directories along the way if needed on the specified path. + +**Arguments**: + +- `path`: Path to a new directory. For example '/dirA/dirB' when creating 'dirB'. +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request + +**Returns**: + +True if the directory was created, False if the directory already exists + + +#### watch + +```python +async def watch(path: str, + on_event: OutputHandler[FilesystemEvent], + on_exit: Optional[OutputHandler[Exception]] = None, + user: Username = "user", + request_timeout: Optional[float] = None, + timeout: Optional[float] = 60) -> AsyncWatchHandle +``` + +Watches directory for filesystem events. + +**Arguments**: + +- `path`: Path to a directory that will be watched +- `on_event`: Callback that will be called on each event +- `on_exit`: Callback that will be called when the watch is closed +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request +- `timeout`: Timeout for the watch, after which the watch will be closed + +**Returns**: + +Watcher handle + diff --git a/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx new file mode 100644 index 000000000..9813b6714 --- /dev/null +++ b/apps/web/src/app/(docs)/docs/api-reference/python-sdk/v0.17.1/sandbox_sync/page.mdx @@ -0,0 +1,661 @@ + + + + + +## Sandbox + +```python +class Sandbox(SandboxSetup, SandboxApi) +``` + +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()` to create a new sandbox. + +**Example**: + +```python +sandbox = Sandbox() +``` + + +#### files + +```python +@property +def files() -> Filesystem +``` + +Filesystem module for interacting with the sandbox's filesystem + + +#### commands + +```python +@property +def commands() -> Process +``` + +Commands module for interacting with the sandbox's processes + + +#### pty + +```python +@property +def pty() -> Pty +``` + +PTY module for interacting with the sandbox's pseudo-terminal + + +#### sandbox\_id + +```python +@property +def sandbox_id() -> str +``` + +Unique identifier of the sandbox + + +#### envd\_api\_url + +```python +@property +def envd_api_url() -> str +``` + +Get the sandbox API URL + + +#### connection\_config + +```python +@property +def connection_config() -> ConnectionConfig +``` + +Get the ConnectionConfig object + + +#### \_\_init\_\_ + +```python +def __init__(template: Optional[str] = None, + timeout: Optional[int] = None, + metadata: Optional[Dict[str, str]] = None, + envs: Optional[Dict[str, str]] = None, + api_key: Optional[str] = None, + domain: Optional[str] = None, + debug: Optional[bool] = None, + sandbox_id: Optional[str] = None, + request_timeout: Optional[float] = None) +``` + +Instantiate sandbox + + +#### is\_running + +```python +def is_running(request_timeout: Optional[float] = None) -> bool +``` + +Check if the sandbox is running. + +**Returns**: + +`True` if the sandbox is running, `False` otherwise +Example +```python +sandbox = Sandbox() +sandbox.is_running() # Returns True + +sandbox.kill() +sandbox.is_running() # Returns False +``` + + +#### connect + +```python +@classmethod +def connect(cls, + sandbox_id: str, + api_key: Optional[str] = None, + domain: Optional[str] = None, + debug: Optional[bool] = None) +``` + +Connects to an existing Sandbox. + +**Arguments**: + +- `sandbox_id`: Sandbox ID +- `api_key`: E2B API Key +- `domain`: E2B Domain (use only if you self-host E2B) +- `debug`: For developing purposes, uses a local sandbox + +**Returns**: + +Sandbox object +@example +```python +sandbox = Sandbox() +sandbox_id = sandbox.sandbox_id + +same_sandbox = Sandbox.connect(sandbox_id) + + +#### kill + +```python +@class_method_variant("_cls_kill") +def kill(request_timeout: Optional[float] = None) -> bool +``` + +Kill the sandbox. + +**Arguments**: + +- `request_timeout`: Timeout for the request + +**Returns**: + +`True` if the sandbox was killed, `False` if the sandbox was not found + + +#### set\_timeout + +```python +@class_method_variant("_cls_set_timeout") +def set_timeout(timeout: int, request_timeout: Optional[float] = None) -> None +``` + +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. + +**Arguments**: + +- `timeout`: Duration in milliseconds. Must be between 0 and 86400000 milliseconds (24 hours). +- `request_timeout`: Timeout for the request + + + + +## Process + +```python +class Process() +``` + + +#### list + +```python +def list(request_timeout: Optional[float] = None) -> List[ProcessInfo] +``` + +Lists all running processes. + +**Arguments**: + +- `request_timeout`: Request timeout + +**Returns**: + +List of running processes + + +#### kill + +```python +def kill(pid: int, request_timeout: Optional[float] = None) -> bool +``` + +Kills a process. + +**Arguments**: + +- `pid`: Process ID to connect to. You can get the list of processes using `sandbox.commands.list()`. +- `request_timeout`: Request timeout + +**Returns**: + +`True` if the process was killed, `False` if the process was not found + + +#### send\_stdin + +```python +def send_stdin(pid: int, data: str, request_timeout: Optional[float] = None) +``` + +Sends data to the stdin of a process. + +:param pid Process ID to send data to. You can get the list of processes using `sandbox.commands.list()`. +:param data: Data to send to the process +:param request_timeout: Request timeout + + + +#### run + +```python +def run(cmd: str, + background: Union[bool, None] = None, + envs: Optional[Dict[str, str]] = None, + user: Username = "user", + cwd: Optional[str] = None, + on_stdout: Optional[Callable[[str], None]] = None, + on_stderr: Optional[Callable[[str], None]] = None, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) +``` + +Starts a new process and depending on the `background` parameter, waits for the process to finish or not. + +:param cmd Command to execute +:param background: + If `True`, the function will return a `ProcessHandle` object that can be used to interact with the process. + If `False`, the function will wait for the process to finish and return a `ProcessResult` object. +:param envs: Environment variables +:param user: User to run the process as +:param cwd: Working directory +:param on_stdout: Callback for stdout +:param on_stderr: Callback for stderr +:param timeout: Timeout for the maximum time the process is allowed to run +:param request_timeout: Timeout for the request +:return: `ProcessHandle` if `background` is `True`, `ProcessResult` if `background` is `False` + + + +#### connect + +```python +def connect(pid: int, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) +``` + +Connects to an existing process. + +**Arguments**: + +- `pid`: Process ID to connect to. You can get the list of processes using `sandbox.commands.list()`. +- `timeout`: Timeout for the connection +- `request_timeout`: Request timeout + + + + +## Pty + +```python +class Pty() +``` + +Manager for starting and interacting with PTY (pseudo-terminal) processes in the sandbox. + + +#### kill + +```python +def kill(pid: int, request_timeout: Optional[float] = None) -> bool +``` + +Kills a process. + +**Arguments**: + +- `pid`: Process ID to kill. You can get the list of processes using `sandbox.commands.list()`. +- `request_timeout`: Timeout for the request + +**Returns**: + +`true` if the process was killed, `false` if the process was not found + + +#### send\_stdin + +```python +def send_stdin(pid: int, + data: bytes, + request_timeout: Optional[float] = None) -> None +``` + +Sends input to a PTY process. + +**Arguments**: + +- `pid`: Process ID of the PTY process +- `data`: Input data to send +- `request_timeout`: Timeout for the request + + +#### create + +```python +def create(size: PtySize, + user: Username = "user", + cwd: Optional[str] = None, + envs: Optional[Dict[str, str]] = None, + timeout: Optional[float] = 60, + request_timeout: Optional[float] = None) -> ProcessHandle +``` + +Starts a new process with a PTY (pseudo-terminal). + +**Arguments**: + +- `size`: Size of the PTY +- `user`: User to start the process as +- `cwd`: Current working directory +- `envs`: Environment variables +- `timeout`: Timeout for the request +- `request_timeout`: Timeout for the request + +**Returns**: + +New process + + +#### resize + +```python +def resize(pid: int, + size: PtySize, + request_timeout: Optional[float] = None) -> None +``` + +Resizes a PTY process (changes the number of columns and rows in the terminal). + +**Arguments**: + +- `pid`: Process ID of the PTY process +- `size`: New size of the PTY +- `request_timeout`: Timeout for the request + + + + +## ProcessHandle + +```python +class ProcessHandle() +``` + +Class representing a process. It provides methods for waiting and killing the process. +It is also used to iterate over the process output. + + +#### pid + +```python +@property +def pid() +``` + +Get the process ID. + + +#### disconnect + +```python +def disconnect() -> None +``` + +Disconnect from the process. It does not kill the process. It only stops receiving events from the process. + + +#### wait + +```python +def wait(on_pty: Optional[Callable[[PtyOutput], None]] = None, + on_stdout: Optional[Callable[[str], None]] = None, + on_stderr: Optional[Callable[[str], None]] = None) -> ProcessResult +``` + +Waits for the process to finish and returns the result. + +If the process exits with a non-zero exit code, it throws a `ProcessExitException`. + +**Arguments**: + +- `on_pty`: Callback for pty output +- `on_stdout`: Callback for stdout output +- `on_stderr`: Callback for stderr output + +**Returns**: + +Process result + + +#### kill + +```python +def kill() -> bool +``` + +Kills the process. + +**Returns**: + +Whether the process was killed successfully + + + + +## WatchHandle + +```python +class WatchHandle() +``` + +Handle for watching filesystem events. It is used to iterate over the events in the watched directory. + + +#### close + +```python +def close() +``` + +Stop watching the directory. + +**Warnings**: + + You won't get any event if you don't iterate over the handle before closing it. + + + + +## Filesystem + +```python +class Filesystem() +``` + +Manager for interacting with the filesystem in the sandbox. + + +#### read + +```python +def read(path: str, + format: Literal["text", "bytes", "stream"] = "text", + user: Username = "user", + request_timeout: Optional[float] = None) +``` + +Reads a whole file content and returns it in requested format (text by default). + +:param path: Path to the file +:param format: Format of the file content +:param user: Run the operation as this user +:param request_timeout: Timeout for the request +:return File content in requested format + + + +#### write + +```python +def write(path: str, + data: Union[str, bytes, IO], + user: Username = "user", + request_timeout: Optional[float] = None) -> 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. + +**Arguments**: + +- `path`: Path to the file +- `data`: Data to write to the file +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request + +**Returns**: + +Information about the written file + + +#### list + +```python +def list(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> List[EntryInfo] +``` + +Lists entries in a directory. + +**Arguments**: + +- `path`: Path to the directory +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request + +**Returns**: + +List of entries in the directory + + +#### exists + +```python +def exists(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> bool +``` + +Checks if a file or a directory exists. + +:param path: Path to a file or a directory +:param user Run the operation as this user +:param request_timeout Timeout for the request + + + +#### remove + +```python +def remove(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> None +``` + +Removes a file or a directory. + +**Arguments**: + +- `path`: Path to a file or a directory +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request + + +#### rename + +```python +def rename(old_path: str, + new_path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> EntryInfo +``` + +Renames a file or directory from one path to another. + +:param old_path Path to the file or directory to move +:param new_path Path to move the file or directory to +:param user Run the operation as this user +:param request_timeout Timeout for the request + +:return: Information about the renamed file or directory + + + +#### make\_dir + +```python +def make_dir(path: str, + user: Username = "user", + request_timeout: Optional[float] = None) -> bool +``` + +Creates a new directory and all directories along the way if needed on the specified path. + +**Arguments**: + +- `path`: Path to a new directory. For example '/dirA/dirB' when creating 'dirB'. +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request + +**Returns**: + +True if the directory was created, False if the directory already exists + + +#### watch + +```python +def watch(path: str, + user: Username = "user", + request_timeout: Optional[float] = None, + timeout: Optional[float] = 60) -> WatchHandle +``` + +Watches directory for filesystem events. The watch will be closed after the timeout. + +To get the events, you need to iterate over the returned WatchHandle. + +**Arguments**: + +- `path`: Path to a directory that will be watched +- `user`: Run the operation as this user +- `request_timeout`: Timeout for the request +- `timeout`: Timeout for the watch, after which the watch will be closed + +**Returns**: + +Watcher handle + From 125cda6cc75d6830f51712ac742c571cd91a18ad Mon Sep 17 00:00:00 2001 From: Tomas Valenta Date: Sat, 12 Oct 2024 13:39:42 -0700 Subject: [PATCH 26/29] Add flag for killing all running sandboxes to the CLI --- packages/cli/src/commands/sandbox/kill.ts | 52 ++++++++++++++++++----- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/packages/cli/src/commands/sandbox/kill.ts b/packages/cli/src/commands/sandbox/kill.ts index 86cd0d494..278365926 100644 --- a/packages/cli/src/commands/sandbox/kill.ts +++ b/packages/cli/src/commands/sandbox/kill.ts @@ -4,31 +4,61 @@ import { ensureAPIKey } from 'src/api' import { asBold } from 'src/utils/format' import * as e2b from 'e2b' +async function killSandbox(sandboxID: string, apiKey: string) { + const killed = await e2b.Sandbox.kill(sandboxID, { apiKey }) + if (killed) { + console.log(`Sandbox ${asBold(sandboxID)} has been killed`) + } else { + console.error(`Sandbox ${asBold(sandboxID)} wasn't found`) + } +} + export const killCommand = new commander.Command('kill') .description('kill sandbox') .argument( - '', - `kill the sandbox specified by ${asBold('')}`, + '[sandboxID]', + `kill the sandbox specified by ${asBold('[sandboxID]')}`, ) .alias('kl') - .action(async (sandboxID: string) => { + .option('-a, --all', 'kill all running sandboxes') + .action(async (sandboxID: string, { all }: { all: boolean }) => { try { const apiKey = ensureAPIKey() - if (!sandboxID) { - console.error('You need to specify sandbox ID') + if (!sandboxID && !all) { + console.error( + `You need to specify ${asBold('[sandboxID]')} or use ${asBold( + '-a/--all', + )} flag`, + ) process.exit(1) } - await e2b.Sandbox.kill(sandboxID, { apiKey }) + if (all && sandboxID) { + console.error( + `You cannot use ${asBold('-a/--all')} flag while specifying ${asBold( + '[sandboxID]', + )}`, + ) + process.exit(1) + } - console.log(`Sandbox ${asBold(sandboxID)} has been killed`) - } catch (err: any) { - if (err?.status === 404) { - console.error(`Sandbox ${asBold(sandboxID)} wasn't found`) + if (all) { + const sandboxes = await e2b.Sandbox.list({ apiKey }) + + if (sandboxes.length === 0) { + console.log('No running sandboxes') + process.exit(0) + } + + await Promise.all( + sandboxes.map((sandbox) => killSandbox(sandbox.sandboxId, apiKey)), + ) } else { - console.error(err) + await killSandbox(sandboxID, apiKey) } + } catch (err: any) { + console.error(err) process.exit(1) } }) From 7c4d44e206e0132236453272737023c23d82f324 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 12 Oct 2024 20:40:58 +0000 Subject: [PATCH 27/29] [skip ci] Release new SDK API reference doc versions --- .../(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx index 060e6969c..0bc6e3247 100644 --- a/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx +++ b/apps/web/src/app/(docs)/docs/api-reference/cli/v0.5.10/sandbox/page.mdx @@ -40,9 +40,14 @@ kill sandbox ## Usage ```bash -e2b sandbox kill [options] +e2b sandbox kill [options] [sandboxID] ``` +## Options + + + - `-a, --all: kill all running sandboxes ` + # e2b sandbox spawn From d2e9b3ba8a70a970f5383ae7b4d03d145a642a37 Mon Sep 17 00:00:00 2001 From: Tomas Valenta Date: Sat, 12 Oct 2024 13:44:23 -0700 Subject: [PATCH 28/29] Update CLI docs --- .../src/app/(docs)/docs/cli/commands/page.mdx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/(docs)/docs/cli/commands/page.mdx b/apps/web/src/app/(docs)/docs/cli/commands/page.mdx index 6397c7fcd..53809a229 100644 --- a/apps/web/src/app/(docs)/docs/cli/commands/page.mdx +++ b/apps/web/src/app/(docs)/docs/cli/commands/page.mdx @@ -311,8 +311,23 @@ Running `e2b sandbox spawn` without specifying a template with the `[template]` ## `sandbox kill` -Immediately kill a running sandbox. +Immediately kill a running sandbox or all running sandboxes. ```bash -e2b sandbox kill +e2b sandbox kill [sandboxID] ``` +#### **Arguments** + + + + + +#### **Options** + + + + From a0bcaa5646d9a84f5942b95a73bc201058e05e91 Mon Sep 17 00:00:00 2001 From: Tomas Valenta Date: Sat, 12 Oct 2024 15:43:58 -0700 Subject: [PATCH 29/29] Update CLI template build example snippet --- packages/cli/src/commands/template/build.ts | 33 +++++++++------------ 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/template/build.ts index 8ebdfb19c..82e71b334 100644 --- a/packages/cli/src/commands/template/build.ts +++ b/packages/cli/src/commands/template/build.ts @@ -337,13 +337,12 @@ export const buildCommand = new commander.Command('build') process.stdout.write('\n') console.log('Building docker image...') - const cmd = `docker build . -f ${dockerfileRelativePath} --pull --platform linux/amd64 -t docker.${ - connectionConfig.domain - }/e2b/custom-envs/${templateID}:${template.buildID} ${Object.entries( - dockerBuildArgs, - ) - .map(([key, value]) => `--build-arg="${key}=${value}"`) - .join(' ')}` + const cmd = `docker build . -f ${dockerfileRelativePath} --pull --platform linux/amd64 -t docker.${connectionConfig.domain + }/e2b/custom-envs/${templateID}:${template.buildID} ${Object.entries( + dockerBuildArgs, + ) + .map(([key, value]) => `--build-arg="${key}=${value}"`) + .join(' ')}` child_process.execSync(cmd, { stdio: 'inherit', cwd: root, @@ -422,33 +421,29 @@ async function waitForBuildFinish( const pythonExample = asPython(`from e2b import Sandbox # Start sandbox -sandbox = Sandbox(template="${ - aliases?.length ? aliases[0] : template.templateID - }") +sandbox = Sandbox("${aliases?.length ? aliases[0] : template.templateID}") # Interact with sandbox. Learn more here: # https://e2b.dev/docs/sandbox/overview -# Close sandbox once done -sandbox.close()`) +# Kill sandbox once done +sandbox.kill()`) const typescriptExample = asTypescript(`import { Sandbox } from 'e2b' // Start sandbox -const sandbox = await Sandbox.create({ template: '${ - aliases?.length ? aliases[0] : template.templateID - }' }) +const sandbox = await Sandbox.create('${aliases?.length ? aliases[0] : template.templateID}') // Interact with sandbox. Learn more here: // https://e2b.dev/docs/sandbox/overview -// Close sandbox once done -await sandbox.close()`) +// Kill sandbox once done +await sandbox.kill()`) - const examplesMessage = `You can use E2B Python or JS SDK to spawn sandboxes now. + const examplesMessage = `You can use E2B Python or JS SDK to create sandboxes now. Find more here - ${asPrimary( 'https://e2b.dev/docs/guide/custom-sandbox', - )} in ${asBold('Spawn and control your sandbox')} section.` + )} in ${asBold('Create and control your sandbox')} section.` const exampleHeader = boxen.default(examplesMessage, { padding: {