import type LoggerPort from '../../../ports/LoggerPort.ts';
import type { DecodedPatch } from './syncPatchLoader.ts';
/** Page request for bounded sync responses. */
export type SyncRequestPage = {
    readonly maxPatches: number;
    readonly cursor?: string | null;
};
/** Page metadata returned with a sync response. */
export type SyncResponsePage = {
    readonly maxPatches: number | null;
    readonly cursor: string | null;
    readonly hasMore: boolean;
    readonly returnedPatches: number;
};
/** Deterministic response-shaping metrics for sync operators. */
export type SyncResponseMetrics = {
    readonly patchCount: number;
    readonly skippedWriterCount: number;
    readonly estimatedPayloadBytes: number;
    readonly latencyMs: number | null;
};
export type CreateSyncRequestOptions = {
    readonly page?: SyncRequestPage;
};
export type NormalizedSyncPageRequest = {
    readonly maxPatches: number | null;
    readonly cursorOffset: number;
};
export type SyncPagePatchEntry = {
    readonly writerId: string;
    readonly sha: string;
    readonly patch: DecodedPatch;
};
export type SyncPageSkippedWriterEntry = {
    readonly writerId: string;
    readonly reason: string;
    readonly localSha: string;
    readonly remoteSha: string | null;
};
type PageAppendOptions = {
    readonly patches: SyncPagePatchEntry[];
    readonly entry: SyncPagePatchEntry;
    readonly page: NormalizedSyncPageRequest;
    readonly seenPatches: number;
};
export type PageAppendResult = {
    readonly seenPatches: number;
    readonly hasMore: boolean;
    readonly cursor: string | null;
};
export type SyncResponsePayloadEstimateInput = {
    readonly frontier: Record<string, string>;
    readonly patches: readonly SyncPagePatchEntry[];
    readonly skippedWriters: readonly SyncPageSkippedWriterEntry[];
    readonly page: SyncResponsePage;
};
export type SyncResponseMetricsLogInput = {
    readonly logger: LoggerPort;
    readonly graphName: string;
    readonly page: SyncResponsePage;
    readonly metrics: SyncResponseMetrics;
};
export declare function normalizeSyncPageRequest(page: SyncRequestPage | undefined): NormalizedSyncPageRequest;
export declare function appendPatchForPage(options: PageAppendOptions): PageAppendResult;
export declare function normalizeObservedLatencyMs(value: number | undefined): number | null;
export declare function estimateResponsePayloadBytes(input: SyncResponsePayloadEstimateInput): number;
export declare function logResponseMetrics(input: SyncResponseMetricsLogInput): void;
export {};
