/** * The streaming-transcription (gpt-4o-transcribe SSE) reduction as PURE logic — extracted * from `stt.ts`'s `_readTranscriptionStream` so the fiddly bits (delta accumulation, the * done-vs-error precedence, the non-SSE JSON salvage, and the "empty ≠ error" / no-speech * decision) are unit-tested without a real network stream. `stt.ts` keeps only the * ReadableStream glue and drives these two functions. */ /** The running state as SSE events fold in. `acc` = concatenated deltas (the live partial); * `final` = the `transcript.text.done` text (wins over `acc`); `streamErr` = a reason from * an `error` event on an otherwise-200 stream. */ export interface TranscriptState { acc: string; final: string; streamErr: string; } export declare function initialTranscriptState(): TranscriptState; /** The result of folding one payload: the new state plus any live partial to surface * (`onResult(interim, false)`), or null when the event produced no partial. */ export interface TranscriptStep { state: TranscriptState; interim: string | null; } /** * Fold ONE SSE `data:` payload into the transcript state. Deltas accumulate and yield a * live partial; a done event sets the final; an `error` (or `*.error`) event records a * reason. Unknown/heartbeat payloads are inert. Pure — no side effects. */ export declare function reduceTranscriptPayload(state: TranscriptState, payload: string): TranscriptStep; export type TranscriptOutcome = { kind: "result"; text: string; } | { kind: "no-speech"; } | { kind: "error"; message: string; }; /** * Decide the outcome of a completed stream. Precedence: any transcribed text wins (final * over accumulated deltas); else a mid-stream error surfaces; else it's a plain empty * result — silence / echo / the agent's own voice tail — reported as the soft `no-speech` * sentinel, NOT a scary error. `raw` is every decoded byte so a non-SSE `{ text }` JSON * body (proxy/model ignored `stream:true`) can still be salvaged. Pure. */ export declare function finalizeTranscript(state: TranscriptState, raw: string): TranscriptOutcome; //# sourceMappingURL=transcript.d.ts.map