import type { ProcessIncarnation, SameProcessIncarnation } from "./process-incarnation.js"; export interface BackgroundWorkerLease { readonly configPath: string; readonly path: string; readonly ownerPid: number; /** Idempotently release only this process's exact lease token. */ release(): Promise; } export interface BackgroundWorkerLeaseOptions { readonly homeDir?: string; readonly pid?: number; readonly now?: () => number; /** Test/embed seam for the owner record written by this acquisition. */ readonly processIncarnation?: ProcessIncarnation; /** Test/embed seam; production checks boot session plus process birth. */ readonly isSameProcessIncarnation?: SameProcessIncarnation; readonly randomToken?: () => string; readonly ownerlessGraceMs?: number; /** Narrow deterministic seams for filesystem-race tests. */ readonly hooks?: { readonly afterLeaseDirectoryCreated?: () => Promise; readonly beforeStaleLeaseRename?: () => Promise; }; } /** * Stable owner-private lifetime-lease path for one exact resolved config. * The full path digest avoids relying on the shorter human-facing launchd hash. */ export declare function backgroundWorkerLeasePath(configPath: string, homeDir?: string): string; /** * Acquire the process-lifetime singleton for a config. * * `undefined` means either a live owner or a fresh ownerless directory (the * atomic mkdir -> owner.json initialization window) already holds the lease. * Dead owners and old ownerless crash debris are atomically quarantined before * one bounded retry. The returned lease must be held until worker shutdown. */ export declare function acquireBackgroundWorkerLease(configPath: string, options?: BackgroundWorkerLeaseOptions): Promise; //# sourceMappingURL=background-worker-lease.d.ts.map