import { type RotatingDatabasePassword } from "./database-credentials.js"; import type { Database } from "./database.js"; export declare const SESSION_LIST_NOTIFICATION_CHANNEL = "opengeni_session_lists"; /** Database-private hint. Never forward this payload directly to a client. */ export type SessionListDatabaseChange = { schema: string; workspaceId: string; sessionId: string | null; subjectId: string | null; all: boolean; /** * The author's own draft changed: their composer draft in `sessionId`, or * their new-chat draft when `sessionId` is null. Only that author's own * streams act on it; it is never a session-list change. */ draft?: true; }; export type SessionListNotification = { type: "connected" | "disconnected"; } | { type: "change"; change: SessionListDatabaseChange; }; export type SessionListChangeSource = { subscribe(listener: (event: SessionListNotification) => void): () => void; close(): Promise; }; /** * Tell the author's other devices that their draft changed, when this * transaction commits. The hint names no content: a device that follows it * reads the draft again through its own authorized, author-only read. */ export declare function notifyActorDraftChanged(db: Database, input: { workspaceId: string; subjectId: string; sessionId: string | null; }): Promise; /** * One lazy, session-pinned connection per API database handle. A transaction-mode * pooler is not a notification transport: callers must provide a direct/session * URL or leave this capability absent (the existing polling client still works). * Notifications are hints, not a replay log. Every successful LISTEN, including * reconnect, announces reconciliation before clients can consider themselves live. */ export declare function createSessionListChangeSource(databaseUrl: string, options?: { searchPath?: string; reconnectDelayMs?: number; /** File-backed password for the same login (see `createDb`'s `passwordFiles`). */ credential?: RotatingDatabasePassword; }): SessionListChangeSource;