import { Awareness } from 'y-protocols/awareness.js'; import { SyncManagerConfig, CollabConnectionConfig, CollabServices, CollabCallbacks, CollabStatus, CollabState } from './types'; export declare class SyncManager { private onCollabStateChange; private _status; private _context; private _awareness; private socketClient; private roomKey; private roomKeyBytes; private isOwner; private updateQueue; private uncommittedUpdatesIdList; private contentTobeAppliedQueue; private isProcessing; /** Prevents parallel terminateSession calls (UI + effect cleanup). */ private _terminating; private flushTimer; private readonly FLUSH_INTERVAL_MS; private readonly MAX_QUEUE_SIZE; private _awarenessUpdateHandler; private ydoc; private servicesRef; private callbacksRef; private onLocalUpdate?; constructor(config: SyncManagerConfig, onCollabStateChange: (state: CollabState) => void); /** Called by useSyncManager on every render to keep refs fresh */ updateRefs(services: CollabServices | undefined, callbacks: CollabCallbacks | undefined, onLocalUpdate?: (updatedDocContent: string, updateChunk: string) => void): void; get isConnected(): boolean; get isReady(): boolean; get awareness(): Awareness | null; get status(): CollabStatus; get collabState(): CollabState; private send; private runExitActions; private runEntryActions; connect(config: CollabConnectionConfig): Promise; disconnect(): Promise; terminateSession(): Promise; enqueueLocalUpdate(update: Uint8Array): void; private flushUpdates; private awaitFlush; /** * Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO * without awaiting the server ACK. The server broadcasts to peers immediately * (before MongoDB write), so content reaches observers in near-real-time. * ACK callback handles updateId tracking and auto-commit asynchronously. */ private sendUpdateBatch; forceCleanup(): void; private handleConnectionError; private handleReconnection; private connectSocket; private syncLatestCommit; private initializeAwareness; private cleanupAwareness; private commitLocalContents; private broadcastLocalContents; private processUpdateQueue; private processNextUpdate; private processCommit; private handleRemoteContentUpdate; private applyRemoteYjsUpdate; private applyQueuedRemoteContents; private withRetry; private disconnectInternal; private resetInternalState; }