import type { DatabaseSync } from 'node:sqlite'; export interface NotificationDispatch { id: string; notificationId: string; ownerId: string; workspaceId: string; channel: 'browser' | 'telegram'; destinationId: string; destination: unknown; subjectId: string | null; subjectRevision: number; attempt: number; } export type DispatchPolicy = { action: 'send'; } | { action: 'cancel'; } | { action: 'defer'; until: number; }; export type DispatchReceipt = { status: 'accepted'; providerMessageId: string | null; } | { status: 'rejected'; retryAt?: number; }; /** Owns durable delivery only. The host supplies policy and transports; neither may widen the saved scope. */ export declare class NotificationDispatcher { private readonly db; private readonly dependencies; private active; private stopped; constructor(db: DatabaseSync, dependencies: { authorize: (dispatch: NotificationDispatch, signal: AbortSignal) => Promise; send: (dispatch: NotificationDispatch, signal: AbortSignal) => Promise; clock?: () => number; timeoutMs?: number; }); /** Called by the host notification pump; overlapping passes never make a second claim. */ drainOne(): Promise; stop(): Promise; private now; private deliver; }