/** * Cross-process lock options for short synchronous state-file transactions. */ export interface FileLockOptions { /** How long to sleep between acquisition attempts. Defaults to 10 ms. */ readonly retryMs?: number | undefined; /** Maximum normal contention wait. Defaults to 5 seconds. */ readonly timeoutMs?: number | undefined; /** Process-liveness seam used by tests; defaults to process.kill(pid, 0). */ readonly isAlive?: ((pid: number) => boolean) | undefined; /** * Test/instrumentation seam invoked after a rename reports contention and before the stable lock * path is inspected. Production callers leave this unset. */ readonly onContention?: (() => void) | undefined; } /** * Run work while holding an adjacent cross-process lock directory. * * A fully-populated claim directory is published to the stable lock path by one atomic rename, so * the stable path never has an ownerless acquisition window. The owner record lets a later process * recover a lock left by a process that died inside the critical section. An unreadable/malformed * owner is never stolen automatically: uncertainty fails closed instead of risking two writers * entering together. */ export declare function withFileLockSync(targetPath: string, work: () => T, options?: FileLockOptions): T;