UNPKG

e2b

Version:

E2B SDK that give agents cloud environments

1,583 lines (1,576 loc) 93.9 kB
import createClient from 'openapi-fetch'; import { Transport, Client } from '@connectrpc/connect'; import { Message } from '@bufbuild/protobuf'; import { GenService, GenMessage } from '@bufbuild/protobuf/codegenv1'; /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. */ interface paths { "/sandboxes": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description List all running sandboxes */ get: { parameters: { query?: { /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */ metadata?: string; }; header?: never; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned all running sandboxes */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ListedSandbox"][]; }; }; 400: components["responses"]["400"]; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; put?: never; /** @description Create a sandbox from the template */ post: { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; requestBody: { content: { "application/json": components["schemas"]["NewSandbox"]; }; }; responses: { /** @description The sandbox was created successfully */ 201: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Sandbox"]; }; }; 400: components["responses"]["400"]; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/sandboxes/{sandboxID}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description Get a sandbox by id */ get: { parameters: { query?: never; header?: never; path: { sandboxID: components["parameters"]["sandboxID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned the sandbox */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["SandboxDetail"]; }; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; put?: never; post?: never; /** @description Kill a sandbox */ delete: { parameters: { query?: never; header?: never; path: { sandboxID: components["parameters"]["sandboxID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description The sandbox was killed successfully */ 204: { headers: { [name: string]: unknown; }; content?: never; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; options?: never; head?: never; patch?: never; trace?: never; }; "/sandboxes/{sandboxID}/logs": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description Get sandbox logs */ get: { parameters: { query?: { /** @description Maximum number of logs that should be returned */ limit?: number; /** @description Starting timestamp of the logs that should be returned in milliseconds */ start?: number; }; header?: never; path: { sandboxID: components["parameters"]["sandboxID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned the sandbox logs */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["SandboxLogs"]; }; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/sandboxes/{sandboxID}/metrics": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description Get sandbox metrics */ get: { parameters: { query?: never; header?: never; path: { sandboxID: components["parameters"]["sandboxID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned the sandbox metrics */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["SandboxMetric"][]; }; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/sandboxes/{sandboxID}/pause": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** @description Pause the sandbox */ post: { parameters: { query?: never; header?: never; path: { sandboxID: components["parameters"]["sandboxID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description The sandbox was paused successfully and can be resumed */ 204: { headers: { [name: string]: unknown; }; content?: never; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; 409: components["responses"]["409"]; 500: components["responses"]["500"]; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/sandboxes/{sandboxID}/refreshes": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** @description Refresh the sandbox extending its time to live */ post: { parameters: { query?: never; header?: never; path: { sandboxID: components["parameters"]["sandboxID"]; }; cookie?: never; }; requestBody?: { content: { "application/json": { /** @description Duration for which the sandbox should be kept alive in seconds */ duration?: number; }; }; }; responses: { /** @description Successfully refreshed the sandbox */ 204: { headers: { [name: string]: unknown; }; content?: never; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/sandboxes/{sandboxID}/resume": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** @description Resume the sandbox */ post: { parameters: { query?: never; header?: never; path: { sandboxID: components["parameters"]["sandboxID"]; }; cookie?: never; }; requestBody: { content: { "application/json": components["schemas"]["ResumedSandbox"]; }; }; responses: { /** @description The sandbox was resumed successfully */ 201: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Sandbox"]; }; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; 409: components["responses"]["409"]; 500: components["responses"]["500"]; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/sandboxes/{sandboxID}/timeout": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** @description Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. */ post: { parameters: { query?: never; header?: never; path: { sandboxID: components["parameters"]["sandboxID"]; }; cookie?: never; }; requestBody?: { content: { "application/json": { /** * Format: int32 * @description Timeout in seconds from the current time after which the sandbox should expire */ timeout: number; }; }; }; responses: { /** @description Successfully set the sandbox timeout */ 204: { headers: { [name: string]: unknown; }; content?: never; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/sandboxes/metrics": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description List all running sandboxes with metrics */ get: { parameters: { query?: { /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */ metadata?: string; }; header?: never; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned all running sandboxes with metrics */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["RunningSandboxWithMetrics"][]; }; }; 400: components["responses"]["400"]; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/teams": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description List all teams */ get: { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned all teams */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Team"][]; }; }; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/templates": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description List all templates */ get: { parameters: { query?: { teamID?: string; }; header?: never; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned all templates */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Template"][]; }; }; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; put?: never; /** @description Create a new template */ post: { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; requestBody: { content: { "application/json": components["schemas"]["TemplateBuildRequest"]; }; }; responses: { /** @description The build was accepted */ 202: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Template"]; }; }; 400: components["responses"]["400"]; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/templates/{templateID}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** @description Rebuild an template */ post: { parameters: { query?: never; header?: never; path: { templateID: components["parameters"]["templateID"]; }; cookie?: never; }; requestBody: { content: { "application/json": components["schemas"]["TemplateBuildRequest"]; }; }; responses: { /** @description The build was accepted */ 202: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Template"]; }; }; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; /** @description Delete a template */ delete: { parameters: { query?: never; header?: never; path: { templateID: components["parameters"]["templateID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description The template was deleted successfully */ 204: { headers: { [name: string]: unknown; }; content?: never; }; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; options?: never; head?: never; /** @description Update template */ patch: { parameters: { query?: never; header?: never; path: { templateID: components["parameters"]["templateID"]; }; cookie?: never; }; requestBody: { content: { "application/json": components["schemas"]["TemplateUpdateRequest"]; }; }; responses: { /** @description The template was updated successfully */ 200: { headers: { [name: string]: unknown; }; content?: never; }; 400: components["responses"]["400"]; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; trace?: never; }; "/templates/{templateID}/builds/{buildID}": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** @description Start the build */ post: { parameters: { query?: never; header?: never; path: { buildID: components["parameters"]["buildID"]; templateID: components["parameters"]["templateID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description The build has started */ 202: { headers: { [name: string]: unknown; }; content?: never; }; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/templates/{templateID}/builds/{buildID}/status": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description Get template build info */ get: { parameters: { query?: { /** @description Index of the starting build log that should be returned with the template */ logsOffset?: number; }; header?: never; path: { buildID: components["parameters"]["buildID"]; templateID: components["parameters"]["templateID"]; }; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned the template */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["TemplateBuild"]; }; }; 401: components["responses"]["401"]; 404: components["responses"]["404"]; 500: components["responses"]["500"]; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; "/v2/sandboxes": { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** @description List all sandboxes */ get: { parameters: { query?: { /** @description Maximum number of items to return per page */ limit?: number; /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */ metadata?: string; /** @description Cursor to start the list from */ nextToken?: string; /** @description Filter sandboxes by one or more states */ state?: components["schemas"]["SandboxState"][]; }; header?: never; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description Successfully returned all running sandboxes */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["ListedSandbox"][]; }; }; 400: components["responses"]["400"]; 401: components["responses"]["401"]; 500: components["responses"]["500"]; }; }; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; } interface components { schemas: { /** * Format: int32 * @description CPU cores for the sandbox */ CPUCount: number; CreatedAccessToken: { /** * Format: date-time * @description Timestamp of access token creation */ createdAt: string; /** * Format: uuid * @description Identifier of the access token */ id: string; /** @description Name of the access token */ name: string; /** @description Raw value of the access token */ token: string; /** @description Mask of the access token */ tokenMask: string; }; CreatedTeamAPIKey: { /** * Format: date-time * @description Timestamp of API key creation */ createdAt: string; createdBy: components["schemas"]["TeamUser"] | null; /** * Format: uuid * @description Identifier of the API key */ id: string; /** @description Raw value of the API key */ key: string; /** @description Mask of the API key */ keyMask: string; /** * Format: date-time * @description Last time this API key was used */ lastUsed: string | null; /** @description Name of the API key */ name: string; }; EnvVars: { [key: string]: string; }; Error: { /** * Format: int32 * @description Error code */ code: number; /** @description Error */ message: string; }; ListedSandbox: { /** @description Alias of the template */ alias?: string; /** @description Identifier of the client */ clientID: string; cpuCount: components["schemas"]["CPUCount"]; /** * Format: date-time * @description Time when the sandbox will expire */ endAt: string; memoryMB: components["schemas"]["MemoryMB"]; metadata?: components["schemas"]["SandboxMetadata"]; /** @description Identifier of the sandbox */ sandboxID: string; /** * Format: date-time * @description Time when the sandbox was started */ startedAt: string; state: components["schemas"]["SandboxState"]; /** @description Identifier of the template from which is the sandbox created */ templateID: string; }; /** * Format: int32 * @description Memory for the sandbox in MB */ MemoryMB: number; NewAccessToken: { /** @description Name of the access token */ name: string; }; NewSandbox: { /** * @description Automatically pauses the sandbox after the timeout * @default false */ autoPause: boolean; envVars?: components["schemas"]["EnvVars"]; metadata?: components["schemas"]["SandboxMetadata"]; /** @description Secure all system communication with sandbox */ secure?: boolean; /** @description Identifier of the required template */ templateID: string; /** * Format: int32 * @description Time to live for the sandbox in seconds. * @default 15 */ timeout: number; }; NewTeamAPIKey: { /** @description Name of the API key */ name: string; }; Node: { /** * Format: int32 * @description Number of allocated CPU cores */ allocatedCPU: number; /** * Format: int32 * @description Amount of allocated memory in MiB */ allocatedMemoryMiB: number; /** * Format: uint64 * @description Number of sandbox create fails */ createFails: number; /** @description Identifier of the node */ nodeID: string; /** * Format: int32 * @description Number of sandboxes running on the node */ sandboxCount: number; /** * Format: int * @description Number of starting Sandboxes */ sandboxStartingCount: number; status: components["schemas"]["NodeStatus"]; /** @description Version of the orchestrator */ version: string; }; NodeDetail: { /** @description List of cached builds id on the node */ cachedBuilds: string[]; /** * Format: uint64 * @description Number of sandbox create fails */ createFails: number; /** @description Identifier of the node */ nodeID: string; /** @description List of sandboxes running on the node */ sandboxes: components["schemas"]["ListedSandbox"][]; status: components["schemas"]["NodeStatus"]; /** @description Version of the orchestrator */ version: string; }; /** * @description Status of the node * @enum {string} */ NodeStatus: "ready" | "draining" | "connecting" | "unhealthy"; NodeStatusChange: { status: components["schemas"]["NodeStatus"]; }; ResumedSandbox: { /** * @description Automatically pauses the sandbox after the timeout * @default false */ autoPause: boolean; /** * Format: int32 * @description Time to live for the sandbox in seconds. * @default 15 */ timeout: number; }; RunningSandboxWithMetrics: { /** @description Alias of the template */ alias?: string; /** @description Identifier of the client */ clientID: string; cpuCount: components["schemas"]["CPUCount"]; /** * Format: date-time * @description Time when the sandbox will expire */ endAt: string; memoryMB: components["schemas"]["MemoryMB"]; metadata?: components["schemas"]["SandboxMetadata"]; metrics?: components["schemas"]["SandboxMetric"][]; /** @description Identifier of the sandbox */ sandboxID: string; /** * Format: date-time * @description Time when the sandbox was started */ startedAt: string; /** @description Identifier of the template from which is the sandbox created */ templateID: string; }; Sandbox: { /** @description Alias of the template */ alias?: string; /** @description Identifier of the client */ clientID: string; /** @description Access token used for envd communication */ envdAccessToken?: string; /** @description Version of the envd running in the sandbox */ envdVersion: string; /** @description Identifier of the sandbox */ sandboxID: string; /** @description Identifier of the template from which is the sandbox created */ templateID: string; }; SandboxDetail: { /** @description Alias of the template */ alias?: string; /** @description Identifier of the client */ clientID: string; cpuCount: components["schemas"]["CPUCount"]; /** * Format: date-time * @description Time when the sandbox will expire */ endAt: string; /** @description Access token used for envd communication */ envdAccessToken?: string; /** @description Version of the envd running in the sandbox */ envdVersion?: string; memoryMB: components["schemas"]["MemoryMB"]; metadata?: components["schemas"]["SandboxMetadata"]; /** @description Identifier of the sandbox */ sandboxID: string; /** * Format: date-time * @description Time when the sandbox was started */ startedAt: string; state: components["schemas"]["SandboxState"]; /** @description Identifier of the template from which is the sandbox created */ templateID: string; }; /** @description Log entry with timestamp and line */ SandboxLog: { /** @description Log line content */ line: string; /** * Format: date-time * @description Timestamp of the log entry */ timestamp: string; }; SandboxLogs: { /** @description Logs of the sandbox */ logs: components["schemas"]["SandboxLog"][]; }; SandboxMetadata: { [key: string]: string; }; /** @description Metric entry with timestamp and line */ SandboxMetric: { /** * Format: int32 * @description Number of CPU cores */ cpuCount: number; /** * Format: float * @description CPU usage percentage */ cpuUsedPct: number; /** * Format: int64 * @description Total memory in MiB */ memTotalMiB: number; /** * Format: int64 * @description Memory used in MiB */ memUsedMiB: number; /** * Format: date-time * @description Timestamp of the metric entry */ timestamp: string; }; /** * @description State of the sandbox * @enum {string} */ SandboxState: "running" | "paused"; Team: { /** @description API key for the team */ apiKey: string; /** @description Whether the team is the default team */ isDefault: boolean; /** @description Name of the team */ name: string; /** @description Identifier of the team */ teamID: string; }; TeamAPIKey: { /** * Format: date-time * @description Timestamp of API key creation */ createdAt: string; createdBy: components["schemas"]["TeamUser"] | null; /** * Format: uuid * @description Identifier of the API key */ id: string; /** @description Mask of the API key */ keyMask: string; /** * Format: date-time * @description Last time this API key was used */ lastUsed: string | null; /** @description Name of the API key */ name: string; }; TeamUser: { /** @description Email of the user */ email: string; /** * Format: uuid * @description Identifier of the user */ id: string; }; Template: { /** @description Aliases of the template */ aliases?: string[]; /** * Format: int32 * @description Number of times the template was built */ buildCount: number; /** @description Identifier of the last successful build for given template */ buildID: string; cpuCount: components["schemas"]["CPUCount"]; /** * Format: date-time * @description Time when the template was created */ createdAt: string; createdBy: components["schemas"]["TeamUser"] | null; /** * Format: date-time * @description Time when the template was last used */ lastSpawnedAt: string; memoryMB: components["schemas"]["MemoryMB"]; /** @description Whether the template is public or only accessible by the team */ public: boolean; /** * Format: int64 * @description Number of times the template was used */ spawnCount: number; /** @description Identifier of the template */ templateID: string; /** * Format: date-time * @description Time when the template was last updated */ updatedAt: string; }; TemplateBuild: { /** @description Identifier of the build */ buildID: string; /** * @description Build logs * @default [] */ logs: string[]; /** * @description Status of the template * @enum {string} */ status: "building" | "waiting" | "ready" | "error"; /** @description Identifier of the template */ templateID: string; }; TemplateBuildRequest: { /** @description Alias of the template */ alias?: string; cpuCount?: components["schemas"]["CPUCount"]; /** @description Dockerfile for the template */ dockerfile: string; memoryMB?: components["schemas"]["MemoryMB"]; /** @description Start command to execute in the template after the build */ startCmd?: string; /** @description Identifier of the team */ teamID?: string; }; TemplateUpdateRequest: { /** @description Whether the template is public or only accessible by the team */ public?: boolean; }; UpdateTeamAPIKey: { /** @description New name for the API key */ name: string; }; }; responses: { /** @description Bad request */ 400: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description Authentication error */ 401: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description Not found */ 404: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description Conflict */ 409: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; /** @description Server error */ 500: { headers: { [name: string]: unknown; }; content: { "application/json": components["schemas"]["Error"]; }; }; }; parameters: { accessTokenID: string; apiKeyID: string; buildID: string; nodeID: string; sandboxID: string; templateID: string; }; requestBodies: never; headers: never; pathItems: never; } /** * Logger interface compatible with {@link console} used for logging Sandbox messages. */ interface Logger { /** * Debug level logging method. */ debug?: (...args: any[]) => void; /** * Info level logging method. */ info?: (...args: any[]) => void; /** * Error level logging method. */ error?: (...args: any[]) => void; } /** * Connection options for requests to the API. */ interface ConnectionOpts { /** * E2B API key to use for authentication. * * @default E2B_API_KEY // environment variable */ apiKey?: string; /** * E2B access token to use for authentication. * * @default E2B_ACCESS_TOKEN // environment variable */ accessToken?: string; /** * Domain to use for the API. * * @default E2B_DOMAIN // environment variable or `e2b.app` */ domain?: string; /** * If true the SDK starts in the debug mode and connects to the local envd API server. * @internal * @default E2B_DEBUG // environment variable or `false` */ debug?: boolean; /** * Timeout for requests to the API in **milliseconds**. * * @default 30_000 // 30 seconds */ requestTimeoutMs?: number; /** * Logger to use for logging messages. It can accept any object that implements `Logger` interface—for example, {@link console}. */ logger?: Logger; /** * Additional headers to send with the request. */ headers?: Record<string, string>; } /** * Configuration for connecting to the API. */ declare class ConnectionConfig { readonly debug: boolean; readonly domain: string; readonly apiUrl: string; readonly logger?: Logger; readonly requestTimeoutMs: number; readonly apiKey?: string; readonly accessToken?: string; readonly headers?: Record<string, string>; constructor(opts?: ConnectionOpts); private static get domain(); private static get debug(); private static get apiKey(); private static get accessToken(); getSignal(requestTimeoutMs?: number): AbortSignal | undefined; } /** * User used for the operation in the sandbox. */ type Username = 'root' | 'user'; /** * Client for interacting with the E2B API. */ declare class ApiClient { readonly api: ReturnType<typeof createClient<paths>>; constructor(config: ConnectionConfig, opts?: { requireAccessToken?: boolean; requireApiKey?: boolean; }); } /** * Base class for all sandbox errors. * * Thrown when general sandbox errors occur. */ declare class SandboxError extends Error { constructor(message: any); } /** * Thrown when a timeout error occurs. * * The [unavailable] error type is caused by sandbox timeout. * * The [canceled] error type is caused by exceeding request timeout. * * The [deadline_exceeded] error type is caused by exceeding the timeout for command execution, watch, etc. * * The [unknown] error type is sometimes caused by the sandbox timeout when the request is not processed correctly. */ declare class TimeoutError extends SandboxError { constructor(message: string); } /** * Thrown when an invalid argument is provided. */ declare class InvalidArgumentError extends SandboxError { constructor(message: string); } /** * Thrown when there is not enough disk space. */ declare class NotEnoughSpaceError extends SandboxError { constructor(message: string); } /** * Thrown when a resource is not found. */ declare class NotFoundError extends SandboxError { constructor(message: string); } /** * Thrown when authentication fails. */ declare class AuthenticationError extends SandboxError { constructor(message: any); } /** * Thrown when the template uses old envd version. It isn't compatible with the new SDK. */ declare class TemplateError extends SandboxError { constructor(message: string); } /** * Get the URL signature for the specified path, operation and user. * * @param path Path to the file in the sandbox. * * @param operation File system operation. Can be either `read` or `write`. * * @param user Sandbox user. * * @param expirationInSeconds Optional signature expiration time in seconds. */ interface SignatureOpts { path: string; operation: 'read' | 'write'; user: string; expirationInSeconds?: number; envdAccessToken?: string; } declare function getSignature({ path, operation, user, expirationInSeconds, envdAccessToken }: SignatureOpts): { signature: string; expiration: number | null; }; /** * @generated from message process.PTY */ type PTY = Message<"process.PTY"> & { /** * @generated from field: process.PTY.Size size = 1; */ size?: PTY_Size; }; /** * @generated from message process.PTY.Size */ type PTY_Size = Message<"process.PTY.Size"> & { /** * @generated from field: uint32 cols = 1; */ cols: number; /** * @generated from field: uint32 rows = 2; */ rows: number; }; /** * @generated from message process.ProcessConfig */ type ProcessConfig = Message<"process.ProcessConfig"> & { /** * @generated from field: string cmd = 1; */ cmd: string; /** * @generated from field: repeated string args = 2; */ args: string[]; /** * @generated from field: map<string, string> envs = 3; */ envs: { [key: string]: string; }; /** * @generated from field: optional string cwd = 4; */ cwd?: string; }; /** * @generated from message process.ListRequest */ type ListRequest = Message<"process.ListRequest"> & {}; /** * Describes the message process.ListRequest. * Use `create(ListRequestSchema)` to create a new message. */ declare const ListRequestSchema: GenMessage<ListRequest>; /** * @generated from message process.ProcessInfo */ type ProcessInfo$1 = Message<"process.ProcessInfo"> & { /** * @generated from field: process.ProcessConfig config = 1; */ config?: ProcessConfig; /** * @generated from field: uint32 pid = 2; */ pid: number; /** * @generated from field: optional string tag = 3; */ tag?: string; }; /** * @generated from message process.ListResponse */ type ListResponse = Message<"process.ListResponse"> & { /** * @generated from field: repeated process.ProcessInfo processes = 1; */ processes: ProcessInfo$1[]; }; /** * Describes the message process.ListResponse. * Use `create(ListResponseSchema)` to create a new message. */ declare const ListResponseSchema: GenMessage<ListResponse>; /** * @generated from message process.StartRequest */ type StartRequest = Message<"process.StartRequest"> & { /** * @generated from field: process.ProcessConfig process = 1; */ process?: ProcessConfig; /** * @generated from field: optional process.PTY pty = 2; */ pty?: PTY; /** * @generated from field: optional string tag = 3; */ tag?: string; }; /** * Describes the message process.StartRequest. * Use `create(StartRequestSchema)` to create a new message. */ declare const StartRequestSchema: GenMessage<StartRequest>; /** * @generated from message process.UpdateRequest */ type UpdateRequest = Message<"process.UpdateRequest"> & { /** * @generated from field: process.ProcessSelector process = 1; */ process?: ProcessSelector; /** * @generated from field: optional process.PTY pty = 2; */ pty?: PTY; }; /** * Describes the message process.UpdateRequest. * Use `create(UpdateRequestSchema)` to create a new message. */ declare const UpdateRequestSchema: GenMessage<UpdateRequest>; /** * @generated from message process.UpdateResponse */ type UpdateResponse = Message<"process.UpdateResponse"> & {}; /** * Describes the message process.UpdateResponse. * Use `create(UpdateResponseSchema)` to create a new message. */ declare const UpdateResponseSchema: GenMessage<UpdateResponse>; /** * @generated from message process.ProcessEvent */ type ProcessEvent = Message<"process.ProcessEvent"> & { /** * @generated from oneof process.ProcessEvent.event */ event: { /** * @generated from field: process.ProcessEvent.StartEvent start = 1; */ value: ProcessEvent_StartEvent; case: "start"; } | { /** * @generated from field: process.ProcessEvent.D