import type { Registry } from '../registry.js'; import type { SandboxSubstrate } from '../substrate.js'; import type { ConeEntry, StartResult } from '../types.js'; export interface StartConeOpts { /** Full secrets.env content (caller reads from disk in CLI; constructs in * worker). Will be filtered with filterSecretsEnv before upload. */ envContents: string; /** Tray worker base URL injected into the sandbox env. */ workerBaseUrl: string; /** Substrate template ID (default 'slicc'). */ template?: string; /** Optional user-supplied name; goes into substrate.metadata.name. */ name?: string; /** SLICC version recorded on the registry entry. */ sliccVersion: string; /** Additional metadata tagged on the sandbox (e.g., { userId, email } in * worker context). Merged on top of the sandbox metadata. */ metadata?: Record; /** Extra envs passed at substrate.create. start.sh writes /slicc/secrets.env * from these BEFORE node-server boots (no race). Plan B task. */ envs?: Record; /** Poll budget for waiting on /tmp/slicc-join.json. */ pollTimeoutMs?: number; pollIntervalMs?: number; /** Default true. */ autoPauseOnCap?: boolean; /** Optional reservation ID from reserveSlot(); if provided, updates that * placeholder entry instead of appending a new one. */ reservationId?: string; /** Optional cone config JSON; injected as SLICC_CONE_CONFIG_B64 env and * written to /slicc/cone-config.json after create. */ coneConfigJson?: string; } export interface StartConeDeps { substrate: SandboxSubstrate; registry: Registry; } export interface ReserveSlotOpts { /** User ID for filtering (worker use) or undefined (CLI use). */ userId?: string; /** Optional name; checked for conflicts. */ name?: string; /** Metadata to store on the reservation entry. */ metadata?: Record; /** SLICC version recorded on the registry entry. */ sliccVersion: string; /** Environment for cap checking. */ env?: { CONE_CAP_RUNNING: string; CONE_CAP_PAUSED: string; }; /** Pre-reconciled cone list (from listCones). If provided, skips the slow * reconciliation call inside reserveSlot, making it fast enough to fit under * blockConcurrencyWhile. Worker callers MUST pass this to avoid holding the * DO lock through substrate.list(). */ reconciledCones?: ConeEntry[]; } /** * Reserve a slot in the registry atomically under DO lock, BEFORE substrate.create. * Returns a synthetic reservationId (pending-) that counts toward the cap. * Throws CloudError('CAP_EXCEEDED' | 'NAME_TAKEN') on conflict. * * Callers MUST wrap this in blockConcurrencyWhile so two concurrent calls * serialize and the second sees the first's placeholder. */ export declare function reserveSlot(deps: StartConeDeps, opts: ReserveSlotOpts): Promise<{ reservationId: string; }>; export declare function startCone(deps: StartConeDeps, opts: StartConeOpts): Promise; //# sourceMappingURL=start.d.ts.map