export type LockResult = { result: T; next?: string; }; /** Throws if this lock was compromised (stolen/expired) since acquisition. Callers that write * from INSIDE the critical section must call it immediately before that write, because the * post-`fn` check cannot un-write a file the callback already replaced. */ export type LockHeldGuard = () => void; export interface LockedFileBackend { withLockAsync(fn: (current: string | undefined, assertLockHeld: LockHeldGuard) => Promise>): Promise; /** The current whole-file contents, or undefined when the file does not exist yet. * Lock-free: every writer replaces the file by atomic rename. */ readUnlocked(): string | undefined; } /** A 0600 JSON file guarded by a cross-process `proper-lockfile` lock on its own path. */ export declare class LockedJsonFile implements LockedFileBackend { private readonly path; constructor(path: string); readUnlocked(): string | undefined; private ensureFile; /** Acquire the lock without blocking the event loop, keeping every read-modify-write * callback on the same asynchronous path. */ withLockAsync(fn: (current: string | undefined, assertLockHeld: LockHeldGuard) => Promise>): Promise; }