export type BuildStep = { op: 'env'; key: string; value: string; } | { op: 'workdir'; path: string; } | { op: 'user'; user: string; } | { op: 'run'; cmd: string; } | { op: 'pip'; packages: string[]; } | { op: 'npm'; packages: string[]; } | { op: 'apt'; packages: string[]; } | { op: 'kernel_modules'; profile: 'container'; } | { op: 'copy'; content_b64: string; dst: string; mode?: string; }; export interface BuildOpts { name: string; version?: string; default_cpu?: number; default_ram_mb?: number; default_disk_gb?: number; size_mb?: number; /** Polls the template list until state != "building" — set 0 to fire-and-forget * (returns immediately with state:'building'). A non-zero wait that expires * throws PlatinumTimeoutError (the build keeps running server-side; poll * `templates.get(id)` to pick it up). */ wait_ms?: number; } export interface BuildResult { id: string; name: string; state: 'building' | 'ready' | 'failed'; build_logs?: string; content_hash?: string; } /** Anything that looks like a Platinum client. A real `Platinum` instance is * preferred (its request() is used directly, so timeouts, error typing and * fetch injection all apply); a bare `{ url|apiUrl, token }` literal works too. */ interface PlatinumLike { apiUrl?: string; url?: string; token: string; request?(method: string, path: string, body?: unknown, opts?: { timeoutMs?: number; }): Promise; } export declare class Template { private base; private steps; private _entrypoint?; private _readyCmd?; private constructor(); static fromImage(ref: string): Template; static fromPythonImage(version: string): Template; static fromNodeImage(version: string): Template; static fromBunImage(version: string): Template; static fromUbuntuImage(version: string): Template; static fromDebianImage(version: string): Template; static fromAlpineImage(version: string): Template; env(key: string, value: string): this; workdir(path: string): this; user(user: string): this; runCmd(cmd: string): this; pipInstall(packages: string[]): this; npmInstall(packages: string[]): this; aptInstall(packages: string[]): this; /** Include the guest kernel's complete module tree so dockerd or Podman can * run inside sandboxes built from this template. */ containerRuntime(): this; /** Inline copy. For small files only (<256 KiB). Pass a path to read it from disk. */ copy(src: string | Uint8Array, dst: string, mode?: string): this; entrypoint(cmd: string): this; /** Probe that runs inside the guest after entrypoint launches. Sandbox reports * ready only when this exits 0. */ readyCmd(cmd: string): this; toSpec(opts: BuildOpts): Record; /** * Inline-image shape for `POST /v1/sandboxes`. Skips the explicit `name`/ * `version` — Platinum derives a deterministic `inline-` template * name from the hashed spec, so identical specs from any caller dedupe to * one row. Pass this directly via `sandboxes.create({ image: tpl, ... })`. */ toImageSpec(opts?: { default_cpu?: number; default_ram_mb?: number; default_disk_gb?: number; size_mb?: number; }): Record; build(dn: PlatinumLike, opts: BuildOpts): Promise; } export {};