export type OwnerIdentityStatus = 'matched' | 'mismatch' | 'unavailable' | 'not_recorded'; /** A recorded candidate, not a claim that the OS returned the lock holder PID. */ export interface OwnerBlocker { pid: number | null; pid_source: 'owner_record' | 'unknown'; instance_id?: string; phase?: 'starting' | 'ready' | 'stopping'; started_at_ms?: number; identity: OwnerIdentityStatus; } export class OwnerLockError extends Error { constructor( readonly code: string, readonly reason: string, readonly blocker: OwnerBlocker, readonly osError?: string, ) { super(`${reason} ${blocker.pid === null ? 'Blocker PID is unknown.' : `Recorded pid ${blocker.pid}, instance ${blocker.instance_id}, identity ${blocker.identity}.`}` + (osError ? ` OS error: ${osError}.` : '')); this.name = 'OwnerLockError'; } }