/** * TTS engine contract. * * The shared types and event names for Kokoro speech synthesis, implemented by * kokoro.ts and consumed by tts-stream.ts. Nothing else lives here. */ import type { GatewayEmit } from "../shared/gateway-events.js"; /** WebSocket event names emitted during synthesis (envelope: { event, payload, ts }). */ export declare const TALK_EVENTS: { readonly audio: "talk:audio"; readonly ttsDownloadProgress: "talk:tts:download:progress"; readonly ttsDownloadComplete: "talk:tts:download:complete"; readonly ttsDownloadError: "talk:tts:download:error"; }; /** Broadcast function injected everywhere (matches gateway server's `emit`). */ export type Emit = GatewayEmit; /** Kokoro-82M TTS engine (sidecar-backed). Implemented by kokoro.ts. */ export interface Tts { /** * Synthesize `text`, sentence-chunked, streaming talk:audio events; resolves * with the number of chunks emitted. `seqStart` continues a per-turn monotonic * sequence across calls; `final:false` suppresses the `last:true` flag so a * turn streamed sentence-by-sentence only signals end-of-audio on the flush. */ speak(sessionId: string, text: string, emit: Emit, opts?: { seqStart?: number; final?: boolean; }): Promise; /** * One-shot synthesis of arbitrary `text` into a single WAV buffer (no WS * streaming). Backs the standalone POST /api/tts read-aloud surface. Rejects if * the engine is unavailable (missing venv/weights). */ synthesize(text: string): Promise; status(): { available: boolean; downloading: boolean; progress: number; voice: string; ready: boolean; }; /** Pre-spawn the sidecar and load the model so the first real speak is fast. No-op if weights/venv are missing. */ warm?(): Promise; /** Download Kokoro weights on first use, emitting talk:tts:download:* events. */ download(emit: Emit): Promise; shutdown(): void; } //# sourceMappingURL=protocol.d.ts.map