/**
 * StreamBridge bridges WebSocket events from cozy-realtime to async iterables
 * that can be consumed by assistant-ui's ChatModelAdapter.
 *
 * The bridge receives push-based events from WebSocket and converts them
 * to a pull-based async iterator pattern.
 */
export declare class StreamBridge {
    private streams;
    private cleanupCallback;
    private positionBuffers;
    private nextPositions;
    private sourcesMap;
    /**
     * Sets a callback to be invoked when cleanup is called.
     * This allows the provider to mark the current message as cancelled.
     */
    setCleanupCallback(callback: () => void): void;
    /**
     * Creates a new async iterable stream for a conversation.
     * The stream will yield string chunks as they arrive via onDelta().
     */
    createStream(conversationId: string): AsyncIterableIterator<string>;
    /**
     * Called when a delta event is received from WebSocket.
     * When a position is provided, chunks are buffered and flushed in order.
     * Without a position, chunks are pushed directly in arrival order.
     */
    onDelta(conversationId: string, content: string, position?: number): void;
    /**
     * Called when a 'done' event is received from WebSocket.
     * Completes the stream for the conversation.
     */
    onDone(conversationId: string): void;
    /**
     * Called when a 'sources' event is received from WebSocket.
     * Stores sources for the conversation to be retrieved by the adapter.
     */
    onSources(conversationId: string, sources: Array<{
        id?: string;
        doctype?: string;
        sourceType?: string;
        url?: string;
        title?: string;
        snippet?: string;
    }>): void;
    /**
     * Returns stored sources for a conversation.
     */
    getSources(conversationId: string): Array<{
        id?: string;
        doctype?: string;
        sourceType?: string;
        url?: string;
        title?: string;
        snippet?: string;
    }> | undefined;
    /**
     * Called when an error occurs.
     * Errors the stream for the conversation.
     */
    onError(conversationId: string, error: Error): void;
    /**
     * Cleans up the stream for a conversation.
     * Should be called when navigating away or on unmount.
     */
    cleanup(conversationId: string): void;
    /**
     * Checks if there's an active stream for a conversation.
     */
    hasStream(conversationId: string): boolean;
}
