/** * Per-HQ-root ownership for the long-lived `hq-sync-runner --watch` process. * * The operation lock has a separate scope so a watch owner does not block * one-shot sync/rescue work. Its lock record is the authority; the adjacent * status JSON is an atomic, read-only projection for the daemon and desktop. */ export declare const WATCH_OWNER_LOCK_SCOPE = "watch-owner"; export declare const WATCH_OWNER_HEARTBEAT_INTERVAL_MS = 15000; /** Public read-only status shape consumed by the daemon and desktop app. */ export interface WatchOwnerLeaseStatus { owner: string; pid: number; processName: string; version: string; startedAt: string; heartbeatAt: string; } export interface WatchOwnerLease { readonly statusPath: string; /** Resolves once a heartbeat proves this process no longer owns its lease. */ readonly lost: Promise; release(): Promise; } export type WatchOwnerAcquireResult = { status: "acquired"; lease: WatchOwnerLease; } | { status: "busy"; owner: string; pid: number; processName: string; startedAt: string; }; export interface AcquireWatchOwnerOptions { /** Test seam; production reads the installed package version. */ version?: string; /** Test seam; production refreshes the public status every 15 seconds. */ heartbeatIntervalMs?: number; /** Test seam; production uses the current system time. */ now?: () => Date; /** Test seam; production atomically renames status files with node:fs. */ renameSync?: (from: string, to: string) => void; /** Test seam; production atomically renames status files with node:fs. */ rename?: (from: string, to: string) => Promise; } /** Deterministic JSON status path for a canonical HQ root on this machine. */ export declare function watchOwnerStatusPathFor(hqRoot: string): string; /** Read current status without acquiring or changing the owner lock. */ export declare function readWatchOwnerStatus(hqRoot: string): WatchOwnerLeaseStatus | null; /** Acquire the required exclusive watch-owner lock before any sync activity. */ export declare function acquireWatchOwnerLease(hqRoot: string, owner?: string, options?: AcquireWatchOwnerOptions): WatchOwnerAcquireResult; //# sourceMappingURL=watch-owner-lease.d.ts.map