type Doc<TMeta = Record<string, unknown>> = {
    id: string;
    fields: Record<string, string>;
    meta?: TMeta;
};
interface Adapter<R, D = Doc> {
    fromRow(row: R): D;
    toRow?(doc: D, original?: R): R;
}
declare const identityAdapter: Adapter<Doc, Doc>;
type DeltaOp<TRow = unknown> = {
    op: 'add';
    row: TRow;
} | {
    op: 'update';
    row: TRow;
} | {
    op: 'remove';
    id: string;
};
type DeltaPayload<TRow = unknown> = {
    version: string | number;
    changes: DeltaOp<TRow>[];
};
type BootstrapPayload<TRow = unknown> = {
    version: string | number;
    rows: TRow[];
};
type SyncConfig<TRow = unknown> = {
    bootstrap?: () => Promise<BootstrapPayload<TRow>>;
    fetchDelta?: (sinceVersion: string | number) => Promise<DeltaPayload<TRow>>;
    pollIntervalMs?: number;
    subscribe?: (onChange: (delta: DeltaPayload<TRow>) => void) => () => void;
};
interface Signal<TDoc = Doc, TCtx = unknown> {
    id: string;
    compute(doc: TDoc, ctx: TCtx): number;
    meta?: {
        range?: [number, number];
        description?: string;
    };
}
type CombinerKind = 'product' | 'weighted_sum' | 'log_sum';
type Combiner = CombinerKind | ((scores: Record<string, number>, weights: Record<string, number>) => number);
type ScoreExplanation = {
    docId: string;
    total: number;
    contributions: Array<{
        signalId: string;
        value: number;
        weight: number;
    }>;
};
type IdentityProvider = () => Record<string, unknown> | undefined;
declare function nfkc(s: string): string;
declare function clamp(n: number, lo: number, hi: number): number;
declare function combine(kind: Combiner, scores: Record<string, number>, weights: Record<string, number>): number;

export { type Adapter, type BootstrapPayload, type Combiner, type CombinerKind, type DeltaOp, type DeltaPayload, type Doc, type IdentityProvider, type ScoreExplanation, type Signal, type SyncConfig, clamp, combine, identityAdapter, nfkc };
