/** * Client for `POST /_agent-native/speak`. * * Exists so app code never hand-writes the framework route. Returns the audio * as a `Blob` the caller turns into an object URL, and keeps "no provider is * configured" as its own outcome — a caller that can fall back to the * browser's speech synthesiser must be able to tell that apart from a failure. */ import { SPEECH_MAX_CHARS } from "../shared/speech.js"; export { SPEECH_MAX_CHARS }; export type SpeechClipFailure = "no-provider" | "too-long" | "provider-error"; /** * Discriminated on a string rather than a boolean: app code compiles without * `strictNullChecks`, where `ok: true | false` widens to `boolean` and stops * narrowing the union at the call site. */ export type SpeechClipResult = { status: "ok"; blob: Blob; } | { status: "failed"; reason: SpeechClipFailure; message: string; }; export interface SpeechClipInput { text: string; /** One of the provider's named voices; the server rejects an unknown one. */ voice?: string; /** Delivery direction for the model, e.g. "read as a newsroom anchor". */ instructions?: string; signal?: AbortSignal; } export declare function fetchSpeechClip({ text, voice, instructions, signal, }: SpeechClipInput): Promise;