Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Update JS SDK docstrings

Tomas Valentace68e3451c5c
diff --git a/packages/js-sdk/src/connectionConfig.ts b/packages/js-sdk/src/connectionConfig.ts
index e27d3e88e..7ef358109 100644
--- a/packages/js-sdk/src/connectionConfig.ts
+++ b/packages/js-sdk/src/connectionConfig.ts
@@ -13,31 +13,31 @@ export interface ConnectionOpts {
/**
* E2B API key to use for authentication.
*
- * @default `E2B_API_KEY` // environment variable
+ * @default E2B_API_KEY // environment variable
*/
apiKey?: string
/**
* E2B access token to use for authentication.
*
- * @default `E2B_ACCESS_TOKEN` // environment variable
+ * @default E2B_ACCESS_TOKEN // environment variable
*/
accessToken?: string
/**
* Domain to use for the API.
*
- * @default `E2B_DOMAIN` // environment variable or `e2b.dev`
+ * @default E2B_DOMAIN // environment variable or `e2b.dev`
*/
domain?: string
/**
* If true the SDK starts in the debug mode and **connects to the local envd API server**.
*
- * @default `E2B_DEBUG` // environment variable or `false`
+ * @default E2B_DEBUG // environment variable or `false`
*/
debug?: boolean
/**
* Timeout for requests to the API in **milliseconds**.
*
- * @default 30_000 // (30 seconds)
+ * @default 30_000 // 30 seconds
*/
requestTimeoutMs?: number
/**
@@ -101,4 +101,5 @@ export class ConnectionConfig {
*/
export type Username = 'root' | 'user'
+
export const defaultUsername: Username = 'user'
diff --git a/packages/js-sdk/src/sandbox/commands/commandHandle.ts b/packages/js-sdk/src/sandbox/commands/commandHandle.ts
index 740cd3454..42d4b3313 100644
--- a/packages/js-sdk/src/sandbox/commands/commandHandle.ts
+++ b/packages/js-sdk/src/sandbox/commands/commandHandle.ts
@@ -141,7 +141,7 @@ export class CommandHandle
}
/**
- * Waits for the command to finish and returns the result.
+ * Wait for the command to finish and return the result.
* If the command exits with a non-zero exit code, it throws a `CommandExitError`.
*
* @returns `CommandResult` result of command execution.
diff --git a/packages/js-sdk/src/sandbox/commands/index.ts b/packages/js-sdk/src/sandbox/commands/index.ts
index d37a68f6b..1324ed286 100644
--- a/packages/js-sdk/src/sandbox/commands/index.ts
+++ b/packages/js-sdk/src/sandbox/commands/index.ts
@@ -67,7 +67,7 @@ export interface CommandStartOpts extends CommandRequestOpts {
/**
* Timeout for the command in **milliseconds**.
*
- * @default 60_000 // (60 seconds)
+ * @default 60_000 // 60 seconds
*/
timeoutMs?: number
}
diff --git a/packages/js-sdk/src/sandbox/commands/pty.ts b/packages/js-sdk/src/sandbox/commands/pty.ts
index 2875f2703..d0cb0ff59 100644
--- a/packages/js-sdk/src/sandbox/commands/pty.ts
+++ b/packages/js-sdk/src/sandbox/commands/pty.ts
@@ -36,7 +36,7 @@ export interface PtyCreateOpts
/**
* Timeout for the PTY in **milliseconds**.
*
- * @default 60_000 // (60 seconds)
+ * @default 60_000 // 60 seconds
*/
timeoutMs?: number
/**
@@ -135,7 +135,7 @@ export class Pty {
}
/**
- * Send input to a PTY process.
+ * Send input to a PTY.
*
* @param pid process ID of the PTY.
* @param data input data to send to the PTY.
@@ -172,7 +172,7 @@ export class Pty {
}
/**
- * Resize a PTY.
+ * Resize PTY.
* Call this when the terminal window is resized and the number of columns and rows has changed.
*
* @param pid process ID of the PTY.
diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index bfce8902f..dd519fc06 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -84,7 +84,7 @@ export interface WatchOpts extends FilesystemRequestOpts {
* Timeout for the watch operation in **milliseconds**.
* You can pass `0` to disable the timeout.
*
- * @default 60_000 // (60 seconds)
+ * @default 60_000 // 60 seconds
*/
timeoutMs?: number
/**
@@ -110,7 +110,7 @@ export class Filesystem {
}
/**
- * Read file content and return it as a `string`.
+ * Read file content as a `string`.
*
* You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.
*
@@ -125,7 +125,7 @@ export class Filesystem {
opts?: FilesystemRequestOpts & { format?: 'text' }
): Promise<string>
/**
- * Read file content and return it as a `Uint8Array`.
+ * Read file content as a `Uint8Array`.
*
* You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.
*
@@ -140,7 +140,7 @@ export class Filesystem {
opts?: FilesystemRequestOpts & { format: 'bytes' }
): Promise<Uint8Array>
/**
- * Read file content and return it as a `Blob`.
+ * Read file content as a `Blob`.
*
* You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.
*
@@ -155,7 +155,7 @@ export class Filesystem {
opts?: FilesystemRequestOpts & { format: 'blob' }
): Promise<Blob>
/**
- * Read file content and return it as a `ReadableStream`.
+ * Read file content as a `ReadableStream`.
*
* You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.
*
@@ -425,7 +425,7 @@ export class Filesystem {
* @param onEvent callback to call when an event in the directory occurs.
* @param opts connection options.
*
- * @returns `WatchHandle` object that for stopping watching directory.
+ * @returns `WatchHandle` object for stopping watching directory.
*/
async watchDir(
path: string,
diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.ts
index 0190f2f70..2a1106b8e 100644
--- a/packages/js-sdk/src/sandbox/index.ts
+++ b/packages/js-sdk/src/sandbox/index.ts
@@ -33,7 +33,7 @@ export interface SandboxOpts extends ConnectionOpts {
/**
* Timeout for the sandbox in **milliseconds**.
*
- * @default 300_000 // (5 minutes)
+ * @default 300_000 // 5 minutes
*/
timeoutMs?: number
}
@@ -41,7 +41,7 @@ export interface SandboxOpts extends ConnectionOpts {
/**
* E2B cloud sandbox is a secure and isolated cloud environment.
*
- * That allows you to:
+ * The sandbox allows you to:
* - Access Linux OS
* - Create, list, and delete files and directories
* - Run commands
@@ -50,7 +50,7 @@ export interface SandboxOpts extends ConnectionOpts {
*
* Check docs [here](https://e2b.dev/docs).
*
- * Use {@link Sandbox.create} method to create a new sandbox.
+ * Use {@link Sandbox.create} to create a new sandbox.
*
* @example
* ```ts
@@ -222,7 +222,7 @@ export class Sandbox extends SandboxApi {
*
* @param port number of the port in the sandbox.
*
- * @returns host address of the sandbox port
+ * @returns host address of the sandbox port.
*
* @example
* ```ts