/**
 * SSE protocol contract between the Python backend and the TS client.
 *
 * This file defines every SSE event type that /api/llm/stream can emit.
 * It is the single source of truth. If the Python backend changes an event
 * shape, this file must change first, and both sides' tests must be updated.
 *
 * Counterpart: backend/server/routes/llm_stream.py (_sse_event, _stream_llm)
 */
// --- SSE line parser ---
/**
 * Parse a single SSE event block (lines between double-newlines) into
 * its event name and JSON data string. Returns null if the block is
 * incomplete or malformed.
 */
export function parseSSE(lines) {
    let event = '';
    let data = '';
    for (const line of lines) {
        if (line.startsWith('event: '))
            event = line.slice(7);
        else if (line.startsWith('data: '))
            data = line.slice(6);
    }
    if (!event || !data)
        return null;
    return { event, data };
}
/** Map ThinkingLevel to backend effort levels. 'off' is absent — handled by callers. */
export const THINKING_TO_EFFORT = {
    minimal: 'low',
    low: 'low',
    medium: 'medium',
    high: 'high',
    xhigh: 'max'
};
//# sourceMappingURL=sse-protocol.js.map