import { z } from 'zod'; /** The registry filename for a daemon on `port` (sibling of daemon-.pid /.log). */ export declare function daemonRegistryFileName(port: number): string; /** Extract the port from a registry filename, or null when the name isn't a registry entry. */ export declare function daemonRegistryPort(fileName: string): number | null; /** One daemon's registry entry: enough to match it to a project and prove it's still alive. */ export declare const DaemonRegistryEntrySchema: z.ZodObject<{ port: z.ZodNumber; pid: z.ZodNumber; cwd: z.ZodString; projectId: z.ZodOptional; startedAt: z.ZodNumber; }, "strip", z.ZodTypeAny, { port: number; pid: number; cwd: string; startedAt: number; projectId?: string | undefined; }, { port: number; pid: number; cwd: string; startedAt: number; projectId?: string | undefined; }>; export type DaemonRegistryEntry = z.infer; /** * Pick the daemon port an app should connect to, given the registry entries, the app's projectId, and * a liveness probe. Pure so both the vite and next plugins share one rule and it's unit-testable: * 1. drop dead daemons (crashed, stale entry); * 2. among the living, prefer the one whose projectId matches the app's — lowest port wins on a tie; * 3. return null when nothing matches, so the caller falls back to the default port (never guesses a * mismatched daemon — a wrong auto-connect is worse than the honest default). */ export declare function pickDaemonPort(entries: readonly DaemonRegistryEntry[], projectId: string | undefined, isAlive: (pid: number) => boolean): number | null;