import type { NativeProjectPaths } from './native-types.js'; /** * Locks whose owner cannot be proven stale (different hostname, or a liveness * probe that never succeeds) become takeable by an explicit doctor repair once * their recorded creation time is at least this old. Fifteen minutes clears * crashed owners from any machine quickly enough that a user running doctor * right after a crash usually passes the threshold, while the longest legal * holder (an Archive transaction with its snapshot fences) finishes within a * few minutes, well out of reach of a blind takeover. */ export declare const NATIVE_LOCK_UNKNOWN_TAKEOVER_MS: number; export interface NativeLockOwner { id: string; pid: number; hostname: string; createdAt: string; operation: string; processIdentity?: string; } export interface NativeLockFileIdentity { device: string; inode: string; size: string; birthtimeNs: string; ctimeNs: string; mtimeNs: string; } export interface NativeLock { file: string; nativeRoot: string; locksDir: string; owner: NativeLockOwner; identity: NativeLockFileIdentity; } export interface NativeLockDiagnosis { status: 'missing' | 'active' | 'stale' | 'unknown'; owner: NativeLockOwner | null; identity: NativeLockFileIdentity | null; } export type NativeStaleLockTakeover = { status: 'removed'; owner: NativeLockOwner; } | { status: 'missing'; } | { status: 'changed'; diagnosis: NativeLockDiagnosis; }; type NativeLockCoordinatorPaths = Pick; export declare function readNativeLock(file: string): Promise; export declare function withNativeLockRecovery(pathEntries: readonly NativeLockCoordinatorPaths[], operation: string, work: () => Promise): Promise; export declare function acquireNativeLock(paths: NativeProjectPaths, name: string, operation: string): Promise; export declare function releaseNativeLock(lock: NativeLock): Promise; export declare function isProcessAlive(pid: number): boolean | null; export declare function nativeLockOwnerAgeMs(owner: NativeLockOwner | null, now?: number): number; export declare function diagnoseNativeLock(file: string): Promise; export interface NativeLockTakeoverOptions { /** * Also remove locks whose owner cannot be proven stale when the owner record is * older than NATIVE_LOCK_UNKNOWN_TAKEOVER_MS. Reserved for the explicit doctor * repair path; automatic acquisition never opts in. */ allowAgedUnknown?: boolean; } export declare function takeOverNativeStaleLock(paths: NativeProjectPaths, file: string, expected?: NativeLockDiagnosis, options?: NativeLockTakeoverOptions): Promise; export {}; //# sourceMappingURL=native-lock.d.ts.map