/** * Exclusive lock for the global project registry. * * Scoped to the registry writers only (requirement 6.6). The other shared-root * files and the global-directory anchor belong to `worktree-dashboard-concurrency`. */ /** Total time budget for acquiring the lock before giving up. */ export declare const DEFAULT_LOCK_TIMEOUT_MS = 5000; /** A lock file whose mtime is older than this may be broken. */ export declare const DEFAULT_LOCK_STALE_MS = 30000; /** Delay between acquisition attempts. */ export declare const DEFAULT_LOCK_RETRY_INTERVAL_MS = 25; export interface RegistryLockOptions { /** Total time budget for acquisition. Default {@link DEFAULT_LOCK_TIMEOUT_MS}. */ timeoutMs?: number; /** Age (from the lock file's mtime) past which the lock is breakable. Default {@link DEFAULT_LOCK_STALE_MS}. */ staleMs?: number; /** Delay between attempts. Default {@link DEFAULT_LOCK_RETRY_INTERVAL_MS}. */ retryIntervalMs?: number; /** * @internal Injection point for the concurrency tests, awaited after a lock * has been judged stale and before it is broken. The stat→rename window is * microseconds wide in practice, so a test that merely hopes to hit it is * flaky; this makes the interleaving certain. Production callers never set it. */ onStaleVerdict?: () => Promise; } export type RegistryLockResult = { acquired: true; value: T; } | { acquired: false; reason: 'timeout' | 'error'; error?: NodeJS.ErrnoException; }; /** * Temp filename for an atomic registry write: `...tmp`. * * Requirement 6.3. A single shared `.tmp` lets two concurrent * writers interleave bytes into one file; rename atomicity does not help, * because both renames move the same corrupted file. */ export declare function uniqueTempPath(basePath: string): string; /** * Run `fn` while holding an exclusive lock on `lockPath`. * * Never throws on acquisition failure: the caller registers before the MCP * transport connects, so throwing would kill the handshake (requirement 6.4). * The outcome is reported in the return value; `fn`'s own errors propagate. */ export declare function withRegistryLock(lockPath: string, fn: () => Promise, options?: RegistryLockOptions): Promise>; //# sourceMappingURL=registry-lock.d.ts.map