import { type AcquireTerminalLeaseResult, type LeaseHolder, type LeaseSelfIdentity } from "./manifest-lease.ts";
export declare const LEASE_KEEPER_INTERVAL_MS = 10000;
export type LeaseKeeperState = "idle" | "waiting" | "owner" | "stopped";
export interface LeaseKeeperOptions {
    readonly dir: string;
    readonly encodedSessionId: string;
    readonly onTakeover: (lease: AcquireTerminalLeaseResult & {
        acquired: true;
    }) => void | Promise<void>;
    /** A tick that failed (e.g. the state dir became unwritable); the keeper keeps waiting. */
    readonly onError?: (error: unknown) => void;
    readonly intervalMs?: number;
    readonly now?: () => number;
    readonly self?: LeaseSelfIdentity;
    readonly isProcessAlive?: (pid: number) => boolean;
    readonly readProcessStartMs?: (pid: number) => Promise<number | undefined>;
}
export interface LeaseKeeper {
    readonly state: LeaseKeeperState;
    onTick?: () => void;
    /** Wait on `holder`; null when it is unknown (e.g. the acquire failed), so every tick re-acquires. */
    start(holder: LeaseHolder | null): void;
    stop(): void;
    /** Resolves after the tick currently in flight (if any) has settled; tests drain fake timers with it. */
    settled(): Promise<void>;
}
/**
 * The WAITER side of the lease: polls the file system only (stat + kill 0, never a subprocess)
 * and hands the session over exactly once when the holder is gone. Losing the race to another
 * waiter is not an error: this keeper simply keeps waiting on the new holder.
 */
export declare function createLeaseKeeper(options: LeaseKeeperOptions): LeaseKeeper;
//# sourceMappingURL=lease-keeper.d.ts.map