@codesandbox/sdk
Version:
The CodeSandbox SDK
50 lines (49 loc) • 2.09 kB
TypeScript
import { type SessionCreateOptions, type SandboxSession, PitcherManagerResponse } from "./types";
import { VMTier } from "./VMTier";
import { API } from "./API";
import { SandboxClient } from "./SandboxClient";
import { Tracer } from "@opentelemetry/api";
export declare class Sandbox {
id: string;
private api;
private pitcherManagerResponse;
private tracer?;
/**
* How the Sandbox booted up:
* - RUNNING: Already running
* - RESUME: Resumes from hibernation
* - CLEAN: Clean bootup, no hibernation snapshot or shutdown
* - FORK: When the sandbox was created from a template
*/
get bootupType(): "RUNNING" | "CLEAN" | "RESUME" | "FORK";
/**
* The cluster the Sandbox is running on.
*/
get cluster(): string;
/**
* Whether the Sandbox Agent version is up to date. Use "restart" to
* update the agent.
*/
get isUpToDate(): boolean;
constructor(id: string, api: API, pitcherManagerResponse: PitcherManagerResponse, tracer?: Tracer);
private withSpan;
/**
* Updates the specs that this sandbox runs on. It will dynamically scale the sandbox to the
* new specs without a reboot. Be careful when scaling specs down, if the VM is using more memory
* than it can scale down to, it can become very slow.
*/
updateTier(tier: VMTier): Promise<void>;
/**
* Updates the hibernation timeout for this sandbox. This is the amount of seconds the sandbox
* will be kept alive without activity before it is automatically hibernated. Activity can be sessions or interactions with any endpoints exposed by the Sandbox.
*/
updateHibernationTimeout(timeoutSeconds: number): Promise<void>;
private initializeCustomSession;
private getSession;
connect(customSession?: SessionCreateOptions): Promise<SandboxClient>;
/**
* @deprecated Use createSession instead
*/
createBrowserSession(customSession?: SessionCreateOptions): Promise<SandboxSession>;
createSession(customSession?: SessionCreateOptions): Promise<SandboxSession>;
}