import type { LaunchdPaths } from "./launchd.js"; import type { ProcessIncarnation, SameProcessIncarnation } from "./process-incarnation.js"; export interface BackgroundLifecycleTarget { readonly label: string; readonly paths: LaunchdPaths; } export interface BackgroundLockAcquireOptions { readonly waitTimeoutMs?: number; readonly pollIntervalMs?: number; /** Main LaunchAgent identity recorded when a synthetic shared lock is held. */ readonly ownerLabel?: string; readonly purpose?: "lifecycle" | "shared-launchd-logs"; } export interface FilesystemLifecycleLockOptions extends BackgroundLockAcquireOptions { readonly pid?: number; readonly now?: () => number; /** Permanent compatibility for owner records predating process-incarnation identity. */ readonly isProcessAlive?: (pid: number) => boolean; readonly processIncarnation?: ProcessIncarnation; readonly isSameProcessIncarnation?: SameProcessIncarnation; readonly ownerlessGraceMs?: number; readonly randomToken?: () => string; /** Deterministic seam immediately after the final identity check. */ readonly beforeStaleLockRename?: () => Promise; } export interface LifecycleLockDependencies { readonly acquireLifecycleLock: (target: BackgroundLifecycleTarget, options?: BackgroundLockAcquireOptions) => Promise<(() => Promise) | undefined>; } export declare const SHARED_LAUNCHD_LOG_LOCK_WAIT_MS = 18000; export declare const SHARED_LAUNCHD_LOG_LOCK_POLL_MS = 400; /** One per-account lock key for every mutation of the shared launchd log chain. */ export declare function sharedLaunchdLogLockTarget(target: BackgroundLifecycleTarget): BackgroundLifecycleTarget; export declare function acquireSharedLaunchdLogLock(target: BackgroundLifecycleTarget, deps: LifecycleLockDependencies, mode: "automatic" | "interactive"): Promise<(() => Promise) | undefined>; /** Canonical owner-private implementation for per-agent and synthetic shared locks. */ export declare function acquireFilesystemLifecycleLock(target: BackgroundLifecycleTarget, options?: FilesystemLifecycleLockOptions): Promise<(() => Promise) | undefined>; //# sourceMappingURL=launchd-lifecycle-lock.d.ts.map