/** * Identifies a document field that can be collaboratively edited. */ export interface DocumentKey { entityType: string; entityId: string; fieldName: string; } export declare const toDocumentKeyString: (key: DocumentKey) => string; export declare const fromDocumentKeyString: (str: string) => DocumentKey | null; export type DocumentConnectionState = "disconnected" | "connecting" | "syncing" | "connected"; export type YjsTransportConnectionState = "disconnected" | "connecting" | "connected" | "reconnecting" | "error"; export interface SessionParticipant { userId: string; isEditing: boolean; } export interface SessionState { active: boolean; participants: SessionParticipant[]; } export interface ConnectOptions { /** Initial content to use if document is empty */ initialContent?: string; } export type LiveEditingErrorCode = "NOT_FOUND" | "UNAUTHORIZED" | "SUBSCRIBE_REQUIRED" | "INVALID_PAYLOAD" | "RATE_LIMITED"; export interface LiveEditingRetryConfig { /** Maximum number of retry attempts for retryable live-editing errors */ maxRetries: number; /** Base retry delay in milliseconds */ baseDelayMs: number; /** Maximum retry delay in milliseconds */ maxDelayMs: number; /** Jitter factor in range 0-1 */ jitter: number; } export declare const DEFAULT_LIVE_EDITING_RETRY_CONFIG: LiveEditingRetryConfig; export declare const isRetryableLiveEditingErrorCode: (code: LiveEditingErrorCode) => boolean; export interface YjsSyncStep2Message extends DocumentKey { type: "yjs_sync_step2"; payload: string; seq: number; } export interface YjsUpdateMessage extends DocumentKey { type: "yjs_update"; payload: string; clientId: string; connId: string; seq: number; } export interface SessionStateMessage extends DocumentKey { type: "session_state"; active: boolean; participants: SessionParticipant[]; } export interface LiveEditingErrorMessage extends DocumentKey { type: "live_editing_error"; error: string; code: LiveEditingErrorCode; } export interface DocViewMessage extends DocumentKey { type: "doc_view"; state: "start" | "stop"; clientId: string; connId: string; } export interface DocFocusMessage extends DocumentKey { type: "doc_focus"; state: "focus" | "blur"; clientId: string; connId: string; } export interface YjsSyncStep1Message extends DocumentKey { type: "yjs_sync_step1"; payload: string; clientId: string; } export interface YjsUpdateToServerMessage extends DocumentKey { type: "yjs_update"; payload: string; clientId: string; connId: string; } export type ServerMessage = YjsSyncStep2Message | YjsUpdateMessage | SessionStateMessage | LiveEditingErrorMessage; export type ClientMessage = DocViewMessage | DocFocusMessage | YjsSyncStep1Message | YjsUpdateToServerMessage; export declare const isYjsSyncStep2Message: (msg: unknown) => msg is YjsSyncStep2Message; export declare const isYjsUpdateMessage: (msg: unknown) => msg is YjsUpdateMessage; export declare const isSessionStateMessage: (msg: unknown) => msg is SessionStateMessage; export declare const isLiveEditingErrorMessage: (msg: unknown) => msg is LiveEditingErrorMessage; export interface YjsDocumentManagerConfig { /** Logical client identity for attribution. May be stable across tabs/sessions. */ clientId: string; /** Connection-scoped identity used for echo suppression. */ connId: string; /** Optional localStorage prefix used for persisted Yjs snapshots. */ persistenceKeyPrefix?: string; /** Retry configuration for retryable live-editing errors. */ liveEditingRetry?: Partial; } export interface YjsTransport { send(message: ClientMessage): void; onMessage(callback: (message: ServerMessage) => void): () => void; onConnectionStateChange(callback: (state: YjsTransportConnectionState) => void): () => void; isConnected(): boolean; } //# sourceMappingURL=types.d.ts.map