import { readFile, readlink } from "node:fs/promises"; import type { GitRepository, GitRunner, OwnershipMode } from "./types.js"; export interface ParsedCheckpointRef { ownerId: string; sessionHash: string; checkpointId: string; phase: "before" | "after"; } export interface CheckpointOwnerLease { schemaVersion: 1; ownerId: string; hostId: string; hostname: string; runtimeScope: string; pid: number; startedAt: string; } export type LeaseClassification = "alive" | "remote" | "stale" | "unknown"; export interface HostIdentity { id: string | null; persistent: boolean; } export interface HostIdentityOptions { platform?: NodeJS.Platform; env?: NodeJS.ProcessEnv; homeDirectory?: string; randomId?: () => string; readFile?: typeof readFile; readlink?: typeof readlink; } export interface LivenessOptions { currentOwnerId: string; currentHostId: string | null; currentHostname: string; currentRuntimeScope: string | null; probePid?: (pid: number) => void; } export interface OwnerRegistryOptions { ownerId?: string; hostIdentity?: HostIdentity; hostname?: string; runtimeScope?: string | null; shutdownWaitMs?: number; now?: () => Date; resolveHostIdentity?: () => Promise; resolveRuntimeScope?: () => Promise; probePid?: (pid: number) => void; } export declare function parseCheckpointOwnerRef(ref: string): ParsedCheckpointRef | null; export declare function ownerCheckpointPrefix(ownerId: string): string | null; export declare function parseCheckpointOwnerLease(filename: string, contents: string): CheckpointOwnerLease | null; export declare function resolvePersistentHostId(options?: HostIdentityOptions): Promise; export declare function resolveRuntimeScope(options?: HostIdentityOptions): Promise; export declare function classifyCheckpointOwner(lease: CheckpointOwnerLease, options: LivenessOptions): LeaseClassification; export declare class CheckpointOwnerRegistry { readonly ownerId: string; private readonly hostname; private readonly shutdownWaitMs; private readonly now; private readonly probePid; private readonly hostIdentityPromise; private readonly runtimeScopePromise; private readonly initializations; private readonly initialized; private readonly scans; constructor(options?: OwnerRegistryOptions); ensureInitialized(repository: GitRepository, git: GitRunner): Promise; private initialize; private startScan; private scan; shutdown(): Promise; }