export interface AdmissionConfig { /** Base directory holding one subdirectory per resource. */ dir: string; /** Resource name, e.g. "browser-qa" or "build". */ resource: string; /** Maximum concurrent holders. */ capacity: number; /** Poll interval while waiting (default 500ms). */ pollMs?: number; /** Entries older than this are pruned regardless of PID (default 6h). */ ttlMs?: number; } export interface AdmissionEntry { pid: number; label: string; created_at: string; /** Set on holders once admitted. */ acquired_at?: string; } export interface AdmissionWaitInfo { /** 1-based position in the ticket queue. */ position: number; holders: AdmissionEntry[]; } export interface AdmissionAcquireOptions { /** Human-readable holder description shown in status listings. */ label: string; /** Maximum wait before AdmissionTimeoutError (default 20 minutes). */ timeoutMs?: number; /** Progress callback, invoked at most once per poll while waiting. */ onWait?: (info: AdmissionWaitInfo) => void; } export interface AdmissionHandle { /** The held entry's filename (diagnostics). */ entry: string; /** Milliseconds spent waiting in the queue. */ waitedMs: number; /** Give the slot back. Safe to call more than once. */ release: () => void; } export declare class AdmissionTimeoutError extends Error { readonly holders: AdmissionEntry[]; constructor(resource: string, timeoutMs: number, holders: AdmissionEntry[]); } /** Is a PID alive on this machine? EPERM counts as alive; only ESRCH counts * as dead (fail toward respecting holders rather than stealing slots). */ export declare function pidAlive(pid: number): boolean; /** * Join the FIFO queue for one resource and resolve once a slot is held. * Throws AdmissionTimeoutError (with the holders snapshot) when no slot * frees within the timeout — the caller decides whether that is fatal. */ export declare function acquireAdmission(config: AdmissionConfig, options: AdmissionAcquireOptions): Promise; export interface AdmissionStatus { resource: string; capacity?: number; holders: AdmissionEntry[]; waiters: AdmissionEntry[]; } /** Snapshot the queue for one resource, pruning dead entries on the way. */ export declare function admissionStatus(config: Pick): AdmissionStatus; /** * Base directory for admission queue state. tmpdir clears on reboot, which * is correct — stale queue state must not outlive the boot. Override with * HARNERY_ADMISSION_DIR. Host CLIs and harn commands must share this helper * so they join the same machine-wide queues. */ export declare function admissionBaseDir(): string; /** Resources present under an admission base directory. */ export declare function listAdmissionResources(dir: string): string[]; //# sourceMappingURL=admission.d.ts.map