import type { ChatMessageId } from '@n8n/api-types'; import type { Response } from 'express'; import type { StructuredChunk } from 'n8n-workflow'; import type { ChatHubMessage } from './chat-hub-message.entity'; export type ChunkTransformer = (chunk: string) => Promise; export declare function interceptResponseWrites(res: T, transform: ChunkTransformer): T; export type AggregatedMessage = Pick; type Handlers = { onBegin?: (message: AggregatedMessage) => Promise; onItem?: (message: AggregatedMessage, delta: string) => Promise; onEnd?: (message: AggregatedMessage) => Promise; onError?: (message: AggregatedMessage, errText?: string) => Promise; onCancel?: (message: AggregatedMessage) => Promise; }; export declare function createStructuredChunkAggregator(initialPreviousMessageId: ChatMessageId, retryOfMessageId: ChatMessageId | null, handlers?: Handlers): { ingest: (chunk: StructuredChunk) => Promise; cancelAll: () => Promise; }; export {};