import { NexusDaemonServer } from './server.js';
import type { DaemonLockRecord } from './lock.js';
import type { WorkspaceContext } from '../engines/workspace-resolver.js';
export interface SupervisorOptions {
    /** The live daemon. The supervisor replaces this internally on a restart. */
    daemon: NexusDaemonServer;
    /** Workspace context — used to construct a fresh server on restart. */
    workspaceContext: WorkspaceContext;
    /** Live lock-record fetcher. Returns null when daemon hasn't yet listened. */
    getLockRecord: () => DaemonLockRecord | null;
    /** Override the incidents log path. Defaults to ~/.nexus-prime/incidents.jsonl. */
    incidentsPath?: string;
    /** Ping interval. Default 30 s. */
    pingIntervalMs?: number;
    /** Per-ping timeout. Default 5 s. */
    pingTimeoutMs?: number;
    /** Consecutive timeouts before declaring hung. Default 3. */
    maxConsecutiveTimeouts?: number;
}
export interface SupervisorIncident {
    ts: number;
    kind: 'hung' | 'restart-ok' | 'restart-failed';
    consecutiveTimeouts: number;
    pid: number;
    port: number | undefined;
    error?: string;
}
export declare class DaemonSupervisor {
    private daemon;
    private readonly workspaceContext;
    private readonly getLockRecord;
    private readonly incidentsPath;
    private readonly pingIntervalMs;
    private readonly pingTimeoutMs;
    private readonly maxConsecutiveTimeouts;
    private consecutiveTimeouts;
    private intervalHandle;
    private restarting;
    private stopped;
    constructor(options: SupervisorOptions);
    /**
     * Schedule the first tick via setImmediate (no boot-time latency cost),
     * then a periodic interval. Honors NEXUS_SUPERVISOR_DISABLED=1 — returns
     * a no-op start in that case so callers don't need an outer guard.
     */
    start(): void;
    /** Stop watching. Safe to call repeatedly. */
    stop(): void;
    /** Single health-check tick. Public for tests. */
    tick(): Promise<void>;
    private handleHung;
    private appendIncident;
    /** Test helper: read current consecutive-timeout counter. */
    getConsecutiveTimeouts(): number;
    /** Test helper: get the live daemon ref (changes after a restart). */
    getDaemon(): NexusDaemonServer;
}
