import { AuthStatus, ChatStatus, Message, MessageSource, SSEEvent } from '../models/types'; /** * Pure function — Functional Core. * Applies an SSE event to the current messages array, producing a new array. * Only the target assistant message is modified. * * Event types come from the Agent contract: * delta — append incremental text chunk (event.content) * error — stop streaming + surface error in bubble * end — stop streaming cleanly * status — observational, ignored * metrics — observational, ignored * visual_result — not rendered by this widget, ignored */ export declare function applySSEEvent(messages: Message[], assistantId: string, event: SSEEvent): Message[]; /** * Pure function — Functional Core. * Normalizes a `sources` SSE event into the message model. The exact payload * shape is unconfirmed (spec §3.3), so this tolerates the plausible variants: * the list under `sources` or `content`, as an array or a JSON string; items * as `{ title?, url|link|href }` objects or plain strings. Anything it cannot * understand yields [] — absence of sources must never break the chat. * * Only http(s) URLs survive (a javascript: URL from a compromised stream must * not become a clickable link); URL-less items are kept as plain citations. */ export declare function extractSources(event: SSEEvent): MessageSource[]; /** * Pure function — Functional Core. * The input is locked while a message is in flight and on every auth state * where the chat is not usable ('consent' included — the opt-in screen gates * the chat). 'idle' keeps the input enabled so the empty state doesn't flash * disabled before auth starts. */ export declare function isInputDisabled(chatStatus: ChatStatus, authStatus: AuthStatus): boolean; /** * Pure function — Functional Core. * "Nova conversa" is offered only while the chat is usable — never from * blocked/error/consent, which would be an escape hatch around those gates. */ export declare function canStartNewSession(authStatus: AuthStatus): boolean;