/** * SQL-backed awareness store — makes presence work across serverless * instances. * * The in-memory awareness map in `awareness.ts` is per-process: on a * multi-instance/serverless deployment, a cursor published to instance A is * invisible to a client polling instance B, and an agent action running in * its own invocation can't reach the SSE instance's memory at all. This * store mirrors awareness rows into a `_collab_awareness` table (SQLite + * Postgres portable) so every instance serves the same participant set. * * Everything here is best-effort: presence must never fail or slow down an * edit. Writes are throttled per (docId, clientId) and skipped when the * state hasn't changed; expired rows are purged opportunistically. */ import type { AwarenessEntry } from "./awareness.js"; /** * Mirror a client's awareness state to SQL. Throttled: unchanged state is * rewritten at most every {@link WRITE_THROTTLE_MS} (to refresh last_seen). * Never throws. */ export declare function upsertAwarenessRow(docId: string, clientId: number, state: string, lastSeen: number): Promise; /** Remove a client's row (participant left). Never throws. */ export declare function deleteAwarenessRow(docId: string, clientId: number, maxLastSeen?: number): Promise; /** * Load non-expired awareness rows for a document. Returns [] on any * failure (memory-only degradation). */ export declare function loadAwarenessRows(docId: string, now?: number): Promise; /** * Strict awareness read for safety-critical callers that must distinguish * "no active participants" from "presence storage could not be read." */ export declare function loadAwarenessRowsStrict(docId: string, now?: number): Promise; /** Test hook: reset module-level throttles. */ export declare function _resetAwarenessStoreForTests(): void; //# sourceMappingURL=awareness-store.d.ts.map