/**
 * Stream Event Dispatcher
 *
 * Pure pub/sub fan-out for interactive session stream chunks. Owns two
 * subscriber maps:
 *
 * 1. `featureSubscribers` — per-feature subscribers that survive session
 *    restarts (SSE connections live here so they keep receiving events
 *    from a freshly-booted session after the old one died).
 * 2. `globalSubscribers`  — subscribers that receive every chunk from
 *    every session tagged with its feature scope key. Used by the
 *    global turn-status SSE endpoint so the sidebar can track all
 *    active sessions without polling.
 *
 * Session-level subscribers still live on `SessionState.subscribers`
 * (they're tied to session lifetime), and `notify(state, chunk)` reads
 * them off the state passed in. The injected `SessionRegistry` dep is
 * reserved for `subscribeSession` which must resolve the state by id.
 *
 * No DB, no persistence, no logging. Just subscriber lists.
 */
import type { StreamChunk, UnsubscribeFn } from '../../../../application/ports/output/services/interactive-session-service.interface.js';
import type { SessionRegistry, SessionState } from './session-registry.js';
type SessionChunkHandler = (chunk: StreamChunk) => void;
type GlobalChunkHandler = (featureId: string, chunk: StreamChunk) => void;
export declare class StreamEventDispatcher {
    private readonly registry;
    private readonly featureSubscribers;
    private readonly globalSubscribers;
    constructor(registry: SessionRegistry);
    /**
     * Subscribe to a specific live session by sessionId. The callback is
     * appended to the `SessionState.subscribers` set and is removed when
     * the session is deleted from the registry (session-bound lifetime).
     */
    subscribeSession(sessionId: string, onChunk: SessionChunkHandler): UnsubscribeFn;
    /**
     * Subscribe at the feature level so the callback survives session
     * restarts. When a session dies (idle timeout, error) and a new one
     * boots, SSE connections subscribed here keep receiving events from
     * the new session automatically.
     */
    subscribeByFeature(featureId: string, onChunk: SessionChunkHandler): UnsubscribeFn;
    /**
     * Subscribe to every chunk emitted by every session, tagged with the
     * feature scope key so the consumer can multiplex across all active
     * sessions (global turn-status SSE endpoint).
     */
    subscribeAll(onChunk: GlobalChunkHandler): UnsubscribeFn;
    /**
     * Dispatch a chunk to all subscribers for a session — session-level,
     * feature-level, and global. Use whenever `SessionState` is in scope.
     */
    notify(state: SessionState, chunk: StreamChunk): void;
    /**
     * Dispatch a chunk to feature-level subscribers and global subscribers
     * only, for cases where no in-memory session state is available
     * (e.g. while persisting the user message before cold-boot — session
     * subscribers don't exist yet at that point).
     */
    notifyByFeatureId(featureId: string, chunk: StreamChunk): void;
}
export {};
//# sourceMappingURL=stream-event-dispatcher.d.ts.map