e2b
Version:
E2B SDK that give agents cloud environments
1,629 lines (1,623 loc) • 86.1 kB
TypeScript
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"]["RunningSandbox"][];
};
};
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"]["RunningSandbox"];
};
};
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;
};
"/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"];
};
};
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;
};
}
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;
};
/**
* 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 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"];
};
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"]["RunningSandbox"][];
status: components["schemas"]["NodeStatus"];
};
/**
* @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;
};
RunningSandbox: {
/** @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;
/** @description Identifier of the template from which is the sandbox created */
templateID: string;
};
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 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;
};
/** @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;
};
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);
}
/**
* @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.DataEvent data = 2;
*/
value: ProcessEvent_DataEvent;
case: "data";
} | {
/**
* @generated from field: process.ProcessEvent.EndEvent end = 3;
*/
value: ProcessEvent_EndEvent;
case: "end";
} | {
/**
* @generated from field: process.ProcessEvent.KeepAlive keepalive = 4;
*/
value: ProcessEvent_KeepAlive;
case: "keepalive";
} | {
case: undefined;
value?: undefined;
};
};
/**
* @generated from message process.ProcessEvent.StartEvent
*/
type ProcessEvent_StartEvent = Message<"process.ProcessEvent.StartEvent"> & {
/**
* @generated from field: uint32 pid = 1;
*/
pid: number;
};
/**
* @generated from message process.ProcessEvent.DataEvent
*/
type ProcessEvent_DataEvent = Message<"process.ProcessEvent.DataEvent"> & {
/**
* @generated from oneof process.ProcessEvent.DataEvent.output
*/
output: {
/**
* @generated from field: bytes stdout = 1;
*/
value: Uint8Array;
case: "stdout";
} | {
/**
* @generated from field: bytes stderr = 2;
*/
value: Uint8Array;
case: "stderr";
} | {
/**
* @generated from field: bytes pty = 3;
*/
value: Uint8Array;
case: "pty";
} | {
case: undefined;
value?: undefined;
};
};
/**
* @generated from message process.ProcessEvent.EndEvent
*/
type ProcessEvent_EndEvent = Message<"process.ProcessEvent.EndEvent"> & {
/**
* @generated from field: sint32 exit_code = 1;
*/
exitCode: number;
/**
* @generated from field: bool exited = 2;
*/
exited: boolean;
/**
* @generated from field: string status = 3;
*/
status: string;
/**
* @generated from field: optional string error = 4;
*/
error?: string;
};
/**
* @generated from message process.ProcessEvent.KeepAlive
*/
type ProcessEvent_KeepAlive = Message<"process.ProcessEvent.KeepAlive"> & {};
/**
* @generated from message process.StartResponse
*/
type StartResponse = Message<"process.StartResponse"> & {
/**
* @generated from field: process.ProcessEvent event = 1;
*/
event?: ProcessEvent;
};
/**
* Describes the message process.StartResponse.
* Use `create(StartResponseSchema)` to create a new message.
*/
declare const StartResponseSchema: GenMessage<StartResponse>;
/**
* @generated from message process.ConnectResponse
*/
type ConnectResponse = Message<"process.ConnectResponse"> & {
/**
* @generated from field: process.ProcessEvent event = 1;
*/
event?: ProcessEvent;
};
/**
* Describes the message process.ConnectResponse.
* Use `create(ConnectResponseSchema)` to create a new message.
*/
declare const ConnectResponseSchema: GenMessage<ConnectResponse>;
/**
* @generated from message process.SendInputRequest
*/
type SendInputRequest = Message<"process.SendInputRequest"> & {
/**
* @generated from field: process.ProcessSelector process = 1;
*/
process?: ProcessSelector;
/**
* @generated from field: process.ProcessInput input = 2;
*/
input?: ProcessInput;
};
/**
* Describes the message process.SendInputRequest.
* Use `create(SendInputRequestSchema)` to create a new message.
*/
declare const SendInputRequestSchema: GenMessage<SendInputRequest>;
/**
* @generated from message process.SendInputResponse
*/
type SendInputResponse = Message<"process.SendInputResponse"> & {};
/**
* Describes the message process.SendInputResponse.
* Use `create(SendInputResponseSchema)` to create a new message.
*/
declare const SendInputResponseSchema: GenMessage<SendInputResponse>;
/**
* @generated from message process.ProcessInput
*/
type ProcessInput = Message<"process.ProcessInput"> & {
/**
* @generated from oneof process.ProcessInput.input
*/
input: {
/**
* @generated from field: bytes stdin = 1;
*/
value: Uint8Array;
case: "stdin";
} | {
/**
* @generated from field: bytes pty = 2;
*/
value: Uint8Array;
case: "pty";
} | {
case: undefined;
value?: undefined;
};
};
/**
* @generated from message process.StreamInputRequest
*/
type StreamInputRequest = Message<"process.StreamInputRequest"> & {
/**
* @generated from oneof process.StreamInputRequest.event
*/
event: {
/**
* @generated from field: process.StreamInputRequest.StartEvent start = 1;
*/
value: StreamInputRequest_StartEvent;
case: "start";
} | {
/**
* @generated from field: process.StreamInputRequest.DataEvent data = 2;
*/
value: StreamInputRequest_DataEvent;
case: "data";
} | {
/**
* @generated from field: process.StreamInputRequest.KeepAlive keepalive = 3;
*/
value: StreamInputRequest_KeepAlive;
case: "keepalive";
} | {
case: undefined;
value?: undefined;
};
};
/**
* Describes the message process.StreamInputRequest.
* Use `create(StreamInputRequestSchema)` to create a new message.
*/
declare const StreamInputRequestSchema: GenMessage<StreamI