import type { ChatConfig, Attachment } from '../types/index.ts'; export declare class N8nApiError extends Error { readonly status?: number; /** * True when the underlying transport or status code indicates the request can be safely * retried (network failure, 408, 429, 502/503/504). 4xx responses (other than 408/429) and * any error that occurred after streaming chunks have been written are non-retryable. */ readonly retryable: boolean; constructor(message: string, status?: number, retryable?: boolean); } /** * Send a message to the n8n webhook. * * Non-streaming: expects { output: string } response. * Streaming: SSE; each event contains data: { text: "chunk" } or data: { output: "full" }. * * Automatically retries transient transport failures (network errors, 408, 429, 502/503/504) * with short backoff. Other 4xx and any error that occurs *after* streaming has begun are * surfaced immediately — duplicating partially-delivered content would be worse than failing. * * @param config Chat configuration * @param sessionId Current session ID (maps to chatSessionKey) * @param text User message text * @param language Optional ISO 639-1 code forwarded to n8n * @param onChunk Called with each streaming chunk (enables streaming mode) * @returns Full bot response text */ export declare function sendMessage(config: ChatConfig, sessionId: string, text: string, language?: string, attachments?: Attachment[], onChunk?: (chunk: string) => void): Promise;