import { DocumentHistoryState, DocumentHistorySurface, HistoryParticipant, PurgeReason, UnifiedHistoryCueEvent } from './types.js';
import { BatchHistoryRecord } from './batch-history-adapter.js';
type ChangeListener = () => void;
type CueListener = (event: UnifiedHistoryCueEvent) => void;
type PurgeListener = (detail: {
    key: string;
    reason: PurgeReason;
}) => void;
export type DocumentHistoryCoordinatorOptions = {
    /** Maximum number of global history entries kept in memory. */
    capacity?: number;
    /**
     * Optional diagnostic hook — fired with surface/participant context when the
     * coordinator decides to purge entries. Used by integration tests and by
     * the future observability layer described in the plan.
     */
    onDiagnostic?: (message: string, detail?: Record<string, unknown>) => void;
};
export declare class DocumentHistoryCoordinator {
    #private;
    constructor(options?: DocumentHistoryCoordinatorOptions);
    /**
     * Record a coordinator-level batch step for a structural UI operation
     * that bypasses a participant's native PM/Yjs history.
     *
     * The provided `undo` / `redo` callbacks are what the coordinator runs
     * when it reaches this step during replay. They must be self-contained
     * and safe to re-run multiple times.
     *
     * Use this sparingly — content edits should still participate through
     * their local editor's history. `withHistoryBatch` is for operations
     * the user expects to undo that otherwise cannot create a PM step at all
     * (for example, blank header/footer slot materialization or a part-only
     * link-to-previous retargeting).
     */
    withHistoryBatch(batch: BatchHistoryRecord): void;
    /**
     * Registers (or re-registers) a participant. Idempotent: calling with the
     * same key replaces the previous registration without dropping global
     * entries — external callers can rebind an editor instance to the same key
     * without losing reachable history.
     */
    register(participant: HistoryParticipant, options?: {
        pinned?: boolean;
    }): void;
    /**
     * Stop observing a participant without removing its global history entries.
     * Use this for temporary detach/rebind cases (e.g. note-session editors
     * going dormant). If the participant cannot be rebound, call `purge()`
     * instead.
     */
    unregister(key: string): void;
    /**
     * Purge all global entries for a participant and stop observing it.
     *
     * Use this on irreversible disposal, external invalidation, or when the
     * capacity cap drops the last reachable entry for a dormant surface.
     */
    purge(key: string, reason?: PurgeReason): void;
    /** True while the coordinator still tracks the given participant key. */
    hasParticipant(key: string): boolean;
    /** Pin a participant so owning caches keep its editor alive while it has reachable history. */
    setPinned(key: string, pinned: boolean): void;
    isPinned(key: string): boolean;
    /** All participant keys that currently have at least one reachable global entry. */
    getReachableKeys(): Set<string>;
    setActiveSurface(surface: DocumentHistorySurface): void;
    getActiveSurface(): DocumentHistorySurface;
    canUndo(): boolean;
    canRedo(): boolean;
    getState(): DocumentHistoryState;
    undo(): boolean;
    redo(): boolean;
    /**
     * Force the coordinator to re-read one participant's local history
     * snapshot and reconcile any newly-created or externally-consumed local
     * history step.
     *
     * Use this when a host layer already knows a specific participant just
     * processed a doc-changing transaction and wants to keep the global queue
     * in lockstep even if the participant's passive subscription path is not
     * the one that surfaced the event.
     */
    syncParticipant(key: string): void;
    onChange(listener: ChangeListener): () => void;
    onCue(listener: CueListener): () => void;
    onPurge(listener: PurgeListener): () => void;
    /**
     * Dispose the coordinator. Unsubscribes from every participant and clears
     * all listeners. After destroy() the instance is inert.
     */
    destroy(): void;
}
export {};
//# sourceMappingURL=DocumentHistoryCoordinator.d.ts.map