type DeepReadonly = T extends ((...args: never[]) => unknown) ? T : T extends object ? { readonly [K in keyof T]: DeepReadonly; } : T; declare class GorpClient, C> { private readonly mutator; private readonly _send; private committed; private optimistic; private _pending; private _nextSeq; private readonly changeListeners; private changes; private previousState; private optimisticDirty; constructor(config: GorpClient.Config); get state(): DeepReadonly; get firstPendingSeq(): number; apply(_param0: GorpMessage): void; send(command: C): void; onChange(callback: () => void): () => void; resync(): void; isChangedAt(path: string[]): boolean; getChangedKeys(path: string[]): string[]; private beginFrame; private replayMutator; private rebuildOptimistic; } declare namespace GorpClient { type Config, C> = { initialState: T; mutator: (state: T, command: C, seq: number) => void; send: (command: C) => void; }; } type GorpMessage = { ops: GorpOperation[]; ack?: number; }; type GorpOperation = { type: "set"; path: string[]; value: unknown; } | { type: "append-text"; path: string[]; value: string; }; interface GorpPubsub { readonly state: unknown; receive(command: C): void; subscribe(callback: (env: GorpMessage) => void): () => void; } declare class GorpRelay, C> { private readonly gorp; private readonly _send; private readonly subscribers; constructor(config: GorpRelay.Config); get state(): DeepReadonly; receive(command: C): void; applyUpstream(msg: GorpMessage): void; subscribe(callback: (env: GorpMessage) => void): () => void; serialize(): RelaySerializedState; restore(serialized: RelaySerializedState): void; } declare namespace GorpRelay { type Config, C> = { initialState: T; send: (command: C) => void; }; } declare class GorpServer, C> { private readonly gorp; private readonly mutator; private readonly flusher; private readonly _state; private _nextSeq; constructor(config: GorpServer.Config); get state(): T; set state(value: T); receive(command: C): void; subscribe(callback: (env: GorpMessage) => void): () => void; } declare namespace GorpServer { type Config, C> = { initialState: T; mutator: (state: T, command: C, seq: number) => void; }; } type GorpSession = { highWater: number; lastActivity: number; }; declare class GorpSessions { private readonly inner; private readonly _sessions; private readonly clients; private outgoing; private lastSeenAck; private readonly unsubscribe; constructor(inner: GorpPubsub); get sessions(): ReadonlyMap; addClient(sessionId: string, fromSeq: number, send: (msg: GorpMessage) => void): GorpSessions.ClientHandle; close(): void; serialize(): GorpSessionsState; restore(state: GorpSessionsState): void; private fanOut; private pruneSessions; } declare namespace GorpSessions { interface ClientHandle { receive(command: C): void; remove(): void; } } type GorpSessionsState = { sessions: Record; }; type RelaySerializedState = { state: T; }; declare function appendText(value: string): string; declare namespace entry_root_exports { export { GorpClient, GorpMessage, GorpRelay, GorpServer, GorpSessions, GorpSessionsState, RelaySerializedState, appendText }; } export { entry_root_exports as entry_root };