/**
 * In-process pub/sub for per-user notification events.
 *
 * Mirrors the design of `preview/event-bus.ts` but keys subscriptions
 * by `userId` instead of `(collection, documentId)`. When the comments
 * hook layer persists a new `DocumentNotification`, it also calls
 * `publishNotification(userId, dto)` so any active SSE stream for that
 * user receives the row in real time. The HTTP layer still works for
 * clients that don't subscribe — the bus is strictly additive.
 *
 * Why in-process:
 *
 *   - Single-node deployments get push-to-bell delivery "for free" with
 *     zero infrastructure dependency. This is the dominant deployment
 *     shape for self-hosted Actuate today.
 *   - Multi-node deployments lose cross-node delivery — node A only
 *     pushes to its own subscribers. The poll fallback in the admin UI
 *     keeps the bell correct on those nodes; SSE is treated as a
 *     latency-win optimisation, not a correctness primitive. A future
 *     slice can swap this for a Redis/Postgres-listen-backed bus
 *     without changing the public contract (`publishNotification` /
 *     `subscribeUserNotifications`).
 *
 * Memory safety: the per-user `Set<Listener>` is dropped from the map
 * when the last subscriber unsubscribes, so an idle process holding
 * thousands of users does not pay any storage cost.
 */
import type { NotificationDTO } from './notifications.js';
export type NotificationListener = (notification: NotificationDTO) => void;
/**
 * Register a listener for `userId`'s notifications. Returns an
 * unsubscribe function — callers MUST invoke it on disconnect, or the
 * bus will leak listener references indefinitely (each listener pins
 * its enclosing closure).
 */
export declare function subscribeUserNotifications(userId: string, listener: NotificationListener): () => void;
/**
 * Publish `notification` to every listener registered for its
 * `userId`. Listener exceptions are isolated — one buggy stream must
 * not take down every other subscriber for the same user (and never
 * the calling write path).
 *
 * Returns `true` when at least one listener was reachable, `false`
 * otherwise (useful in tests to assert SSE wiring; production code can
 * ignore the return value).
 */
export declare function publishNotification(notification: NotificationDTO): boolean;
/**
 * How many active subscribers does this user have? Useful for tests
 * and operator dashboards ("is anyone listening?"). Not part of the
 * write-path contract.
 */
export declare function notificationSubscriberCount(userId: string): number;
/**
 * Test helper. Drops every subscription. Production code never calls
 * this — listener leaks should be visible in the test suite, not
 * papered over in production.
 */
export declare function __resetNotificationBus(): void;
//# sourceMappingURL=notification-bus.d.ts.map