/** * Email bridge helpers for cross-process email capture via Redis pub/sub. */ /** Minimal emitter interface. */ interface BridgeEmitter { on(event: string, handler: (...args: unknown[]) => void): void; } /** Minimal Redis publisher interface. */ interface RedisPublisher { publish(channel: string, message: string): Promise; } /** Minimal Redis subscriber interface. */ interface RedisSubscriber extends RedisPublisher { subscribe(channel: string, handler: (message: string) => void): unknown; } /** Sink that persists an ingested email (the SQLite dashboard store). */ interface DashboardEmailSink { recordEmail(record: Record): void; } /** Targets for ingesting remote emails. */ export interface EmailBridgeTargets { debugEmails: { ingest(record: Record): void; } | null; /** * The persistent dashboard store, or a (possibly async) getter for it. * * A getter is used because the bridge subscribes during early boot — * before the SQLite dashboard store exists — yet remote emails arrive * later, by which time the store is available. Resolving lazily lets * cross-process (queue-worker) emails land in SQLite, where the * dashboard/debug APIs read from when persistence is enabled. */ dashboardStore: DashboardEmailSink | (() => DashboardEmailSink | null | Promise) | null; } /** * Ingest a remote email message from Redis pub/sub. * Skips messages from the same process. */ export declare function ingestRemoteEmail(message: string, processTag: string, targets: EmailBridgeTargets): void; /** * Register mail event listeners that publish to Redis. */ export declare function registerMailEventPublisher(emitter: BridgeEmitter, redis: RedisPublisher, processTag: string, channel: string): void; /** * Full email bridge setup: publish local events + subscribe to remote ones. * Returns the Redis instance (for cleanup) or null. */ export declare function setupFullEmailBridge(emitter: BridgeEmitter, redis: RedisSubscriber, channel: string, targets: EmailBridgeTargets): Promise; /** * Lightweight publisher-only email bridge (for non-web environments). */ export declare function setupPublisherOnlyBridge(emitter: BridgeEmitter, redis: RedisPublisher, channel: string): void; export {};