import { Image } from "./image"; import { SandboxInstance, SandboxProcessResponse } from "./sandbox"; import type { VMConfig, VMConnectOptions, VMCreateOptions, VMExecOptions, VMInfo, VMListOptions, VMLogsOptions, VMMetrics, VMPromptOptions, VMPromptSession, VMStartOptions, VMUpdateOptions, VMWaitOptions } from "../../types/vm"; import { VMArtifact, VMArtifacts } from "./vm-artifacts"; import { VMFileSystem, VMProcess, VMProcessManager, VMDocker } from "./vm-runtime"; import { VMDesktop } from "./vm-desktop"; import { VMAccess } from "./vm-access"; /** A named, persistent CPU VM. Every factory returns this same manageable object. */ export declare class VM extends VMAccess { static readonly snapshots: VMArtifacts; static readonly templates: VMArtifacts; readonly snapshots: VMArtifacts; readonly templates: VMArtifacts; readonly fs: VMFileSystem; readonly docker: VMDocker; readonly process: VMProcessManager; readonly desktop: VMDesktop; readonly requestId: string; readonly config: VMConfig; private _info?; private preparedBody?; private preparation?; private creation?; private connected?; private connectedAt; private serviceContainer?; private handles; constructor(config?: VMConfig | string); static create(config?: VMConfig, opts?: VMCreateOptions): Promise; /** Read an existing VM by name or ID without starting compute. */ static get(nameOrId: string, opts?: { sshKeyPath?: string; }): Promise; /** Resolve and start/resume a VM, waiting for exec readiness by default. */ static connect(nameOrId: string, opts?: VMConnectOptions): Promise; static list(opts?: VMListOptions): Promise; /** Prepare an Image for standalone image builds, without launching a VM. */ static prepareImage(image: Image, opts?: { desktop?: boolean; }): Promise; get info(): VMInfo; get id(): string; get name(): string; get status(): VMInfo["status"]; get spec(): VMInfo["spec"]; get metadata(): Record; get containerId(): string | undefined; get publicIpv6(): string | undefined; get terminalUrl(): string | undefined; get desktopUrl(): string | undefined; get urls(): Record; private path; private setInfo; private makeSandbox; /** @internal Shared management transport for the scoped helpers. */ action(action: string, body?: Record, opts?: Record): Promise; /** Build/resolve the image, mounts and SSH key, and freeze an idempotent launch request. */ prepare(): Promise; private prepareOnce; /** Create and wait for exec readiness. wait:false returns after launch submission. */ create(opts?: VMCreateOptions): Promise; refresh(opts?: Pick): Promise; start(opts?: VMStartOptions): Promise; resume(opts?: VMStartOptions): Promise; pause(): Promise; /** Stop from disk. noSnapshot skips creating the visible stop snapshot; the durable root remains. */ stop(opts?: { noSnapshot?: boolean; }): Promise; remove(): Promise; delete(): Promise; update(opts: VMUpdateOptions): Promise; updateTtl(ttl: number): Promise; updateNetworkPermissions(blockNetwork?: boolean, allowList?: string[]): Promise; wait(opts?: VMWaitOptions): Promise; private servicesReady; /** @internal Resolve fresh runtime identity before each new guest operation. */ runtime(refresh?: boolean, allowStarting?: boolean, timeoutMs?: number, signal?: AbortSignal): Promise; /** @internal Reject PID reuse after a reboot, without automatically waking a VM. */ assertRuntime(containerId: string, opts?: Pick): Promise; private track; exec(command: string | string[], opts?: VMExecOptions): Promise; execShell(command: string, opts?: VMExecOptions): Promise; runCode(code: string, blocking?: boolean, cwd?: string, env?: Record): Promise; listProcesses(): Promise; localProcesses(): VMProcess[]; /** Reattach to a PID; containerId guards against PID reuse if saved across restarts. */ getProcess(pid: number, opts?: { containerId?: string; }): Promise; touch(): Promise; /** @internal Lease renewal is serialized and released even when a callback fails. */ acquireLease(): Promise<() => Promise>; keepAlive(callback: (vm: this) => Promise): Promise; snapshot(name?: string): Promise; createTemplate(name?: string, description?: string): Promise; fork(name?: string, opts?: VMCreateOptions): Promise; exposePort(port: number, opts?: { protected?: boolean; }): Promise; expose(port: number, opts?: { protected?: boolean; }): Promise; unexposePort(port: number): Promise; unexpose(port: number): Promise; bind(port: number): Promise; getUrl(port: number): Promise; listUrls(): Promise>; getAccessToken(): Promise; rotateAccessToken(): Promise; accessUrl(port: number, opts?: { ttl?: number; }): Promise; metrics(): Promise; prompt(prompt: string, opts?: VMPromptOptions & { background?: false; }): Promise; prompt(prompt: string, opts: VMPromptOptions & { background: true; }): Promise; prompt(prompt: string, opts: VMPromptOptions): Promise; /** Return a process's async log stream, including its wait/kill handle. */ logs(opts?: VMLogsOptions): Promise; }