export interface DaemonMeta {
    pid: number;
    port: number;
    startedAt: string;
    adminDir: string;
}
export interface DaemonStartOptions {
    port: number;
    adminDir: string;
    nextBin: string;
    projectRoot?: string;
}
/**
 * Spawn the admin-ui daemon. Returns the recorded metadata. The caller is
 * responsible for choosing a free port first (via `findFreePort`) — this
 * function does not probe.
 */
export declare function daemonStart(opts: DaemonStartOptions): Promise<DaemonMeta>;
export interface DaemonStopResult {
    stopped: boolean;
    signaledPid?: number;
    usedSigkill?: boolean;
}
/**
 * Stop the daemon. SIGTERMs, polls for exit up to 3s, SIGKILLs on timeout,
 * then removes the PID + meta files.
 *
 * Returns `stopped: false` only when there was no daemon to stop (no PID
 * file or a malformed one). A daemon that was already dead on disk but had
 * leftover PID file returns `stopped: true` with the reaped PID — the
 * cleanup itself is work worth reporting.
 */
export declare function daemonStop(): Promise<DaemonStopResult>;
export type DaemonStatusResult = {
    running: true;
    pid: number;
    port: number;
    adminDir: string;
    startedAt: string;
} | {
    running: false;
};
/**
 * Read the daemon's current status. Combines PID-file presence, a
 * `kill(pid, 0)` liveness check, and the recorded metadata. Does NOT probe
 * the port — the caller can do that separately if it wants to distinguish
 * "process alive but not yet listening" from "process alive and serving."
 */
export declare function daemonStatus(): Promise<DaemonStatusResult>;
/**
 * Find a free port starting from `start`. If `start` is 0, the OS picks.
 * If `start` is taken, returns a fresh OS-picked port (does NOT scan
 * upward — scanning invites races between the check and the listen).
 */
export declare function findFreePort(start: number): Promise<number>;
/**
 * Probe whether a port is currently accepting connections. Used by
 * `uiStatus` to verify the daemon is actually serving (not just alive in
 * the process table but stuck).
 */
export declare function isPortListening(port: number): Promise<boolean>;
