import type { StreamCallbacks } from './sse-events'; export type StreamRunnerOptions = { /** Absolute URL to POST to (the /api/v1/prediction/:id endpoint). */ url: string; /** JSON body — already mapped to TORUK-CORE wire shape (see input-mapper). */ body: Record; /** Headers to send. Must already include auth + Accept: text/event-stream. */ headers: Record; /** Optional cancellation. Aborting triggers onError with code ABORTED. */ signal?: AbortSignal; /** * Awaited just before the stream request is sent, with the assembled * RequestInit. Mutating `headers` here is honored — this is the streaming * counterpart of TorukClientConfig.onRequest, so streams and normal requests * go through the same decoration path. */ onRequest?: (request: RequestInit) => Promise | void; /** * Called with the raw Response as soon as the stream opens, before any * content-type branching, so response headers (notably `x-toruk-visitor`) * are captured on both the SSE and the JSON-fallback paths. */ onResponse?: (response: Response) => void; }; /** * Run a streaming prediction. Resolves with the final { chatId, messageId } * once 'end' fires, or rejects with TorukSdkError on structural failure. * Predictable HTTP errors (401, 403, 404, 429, …) are routed through the * onError callback AND the rejection — callers can choose which to handle. */ export declare function runStream(opts: StreamRunnerOptions, callbacks: StreamCallbacks): Promise<{ chatId?: string; messageId?: string; }>;