/** * POST /_agent-native/speak * * Text in, spoken audio out — the inverse of `transcribe-voice`, and a * framework route for the same reason: the response is audio bytes, not the * typed JSON an action contract returns. * * Returns 400 `{ error }` when no provider is configured, so a client can fall * back to the browser's own speech synthesiser instead of showing a failure. */ import { SPEECH_MAX_CHARS } from "../shared/speech.js"; export { SPEECH_MAX_CHARS }; /** The provider's named voices. Proper nouns — never localized. */ export declare const SPEAK_VOICES: readonly ["alloy", "ash", "ballad", "coral", "echo", "fable", "nova", "onyx", "sage", "shimmer"]; export type SpeakVoice = (typeof SPEAK_VOICES)[number]; export declare const DEFAULT_SPEAK_VOICE: SpeakVoice; export declare function isSpeakVoice(value: unknown): value is SpeakVoice; /** * Discriminated on a string rather than a boolean: template code compiles * without `strictNullChecks`, where `ok: true | false` widens to `boolean` and * stops narrowing the union at the call site. */ export type SpeakResult = { status: "ok"; audio: Uint8Array; mimeType: string; model: string; } | { status: "failed"; /** * `no-provider` is a configuration state a client can route around; * `provider-error` and `too-long` are failures. They are separate values * because the fallback is only correct for the first. */ reason: "no-provider" | "empty" | "too-long" | "provider-error"; message: string; }; export interface SynthesizeSpeechInput { text: string; voice?: SpeakVoice; /** * Delivery direction for the model ("read as a calm newsroom anchor"). This * is what separates a narrator from a screen reader; the voice alone does not. */ instructions?: string; apiKey?: string | null; } /** * Posts one script to the provider and hands back the bytes. Takes the resolved * key rather than resolving it, so it runs in a test without a request context. */ export declare function synthesizeSpeech({ text, voice, instructions, apiKey, }: SynthesizeSpeechInput): Promise; export declare function createSpeakHandler(): import("h3").EventHandlerWithFetch | { error: string; reason: string; }>>;