export { createAsyncLock, readJsonIfExists, tryReadJson, writeJson } from "./json-files.js";
export type PairingReadCache<TState> = {
    loadStateForRead: (baseDir: string | undefined) => Promise<TState>;
    invalidate: () => void;
};
export declare function createPairingReadCache<TState>(params: {
    resolvePaths: (baseDir: string | undefined) => {
        pendingPath: string;
        pairedPath: string;
    };
    load: (baseDir: string | undefined) => Promise<TState>;
}): PairingReadCache<TState>;
export declare function resolvePairingPaths(baseDir: string | undefined, subdir: string): {
    dir: string;
    pendingPath: string;
    pairedPath: string;
};
export declare function coercePairingStateRecord<T>(value: unknown): Record<string, T>;
export declare function pruneExpiredPending<T extends {
    ts: number;
}>(pendingById: Record<string, T>, nowMs: number, ttlMs: number): void;
export type PendingPairingRequestResult<TPending> = {
    status: "pending";
    request: TPending;
    created: boolean;
};
export declare function reconcilePendingPairingRequests<TPending extends {
    requestId: string;
}, TIncoming>(params: {
    pendingById: Record<string, TPending>;
    existing: readonly TPending[];
    incoming: TIncoming;
    canRefreshSingle: (existing: TPending, incoming: TIncoming) => boolean;
    refreshSingle: (existing: TPending, incoming: TIncoming) => TPending;
    buildReplacement: (params: {
        existing: readonly TPending[];
        incoming: TIncoming;
    }) => TPending;
    persist: () => Promise<void>;
}): Promise<PendingPairingRequestResult<TPending>>;
