import type { CommittedPageOperation, PageOperationRequest, PageSessionSnapshot } from './protocol.js'; import type { AnnotationOperationRequest, AnnotationPreview, AnnotationSessionSnapshot, CommittedAnnotationOperation } from './annotation-protocol.js'; import type { CommittedFormOperation, FormOperationRequest, FormSessionSnapshot } from './form-protocol.js'; /** Messages accepted from a browser client by the reference relay. */ export type ClientRelayMessage = { readonly type: 'session.join'; readonly sessionId: string; readonly memberToken?: string; readonly actorId?: string; readonly displayName?: string; } | { readonly type: 'session.approve'; readonly sessionId: string; readonly requestId: string; } | { readonly type: 'session.reject'; readonly sessionId: string; readonly requestId: string; } | { readonly type: 'page.operation'; readonly sessionId: string; readonly request: PageOperationRequest; } | { readonly type: 'annotation.operation'; readonly sessionId: string; readonly request: AnnotationOperationRequest; } | { readonly type: 'annotation.preview'; readonly sessionId: string; readonly preview: AnnotationPreview; } | { readonly type: 'form.operation'; readonly sessionId: string; readonly request: FormOperationRequest; }; /** Snapshots, commits, and structured errors emitted by the reference relay. */ export type ServerRelayMessage = { readonly type: 'session.snapshot'; readonly sessionId: string; readonly snapshot: PageSessionSnapshot; } | { readonly type: 'annotation.snapshot'; readonly sessionId: string; readonly snapshot: AnnotationSessionSnapshot; } | { readonly type: 'form.snapshot'; readonly sessionId: string; readonly snapshot: FormSessionSnapshot; } | { readonly type: 'session.presence'; readonly sessionId: string; readonly connectedCount: number; } | { readonly type: 'page.committed'; readonly sessionId: string; readonly committed: CommittedPageOperation; } | { readonly type: 'annotation.committed'; readonly sessionId: string; readonly committed: CommittedAnnotationOperation; } | { readonly type: 'annotation.preview'; readonly sessionId: string; readonly preview: AnnotationPreview; } | { readonly type: 'form.committed'; readonly sessionId: string; readonly committed: CommittedFormOperation; } | { readonly type: 'session.join.pending'; readonly sessionId: string; readonly requestId: string; } | { readonly type: 'session.join.request'; readonly sessionId: string; readonly requestId: string; readonly actorId: string; readonly displayName: string; } | { readonly type: 'session.join.approved'; readonly sessionId: string; readonly requestId: string; readonly memberToken: string; } | { readonly type: 'session.join.rejected'; readonly sessionId: string; readonly requestId: string; readonly retryAfterMs: number; } | { readonly type: 'session.join.resolved'; readonly sessionId: string; readonly requestId: string; readonly decision: 'approved' | 'rejected' | 'cancelled'; } | { readonly type: 'operation.rejected'; readonly sessionId?: string; readonly operationId?: string; readonly code: string; readonly message: string; readonly currentRevision?: number; }; /** * Parses and validates one untrusted client WebSocket payload. * @throws `Error` for malformed JSON, envelopes, or operations. * @param json - The JSON value to parse. * @returns The resulting ClientRelayMessage. * */ export declare function parseClientRelayMessage(json: string): ClientRelayMessage; /** * Parses and validates one untrusted relay payload before changing client state. * @throws `Error` for malformed JSON, snapshots, commits, or errors. * @param json - The JSON value to parse. * @returns The resulting ServerRelayMessage. * */ export declare function parseServerRelayMessage(json: string): ServerRelayMessage; //# sourceMappingURL=wire.d.ts.map