/** * Speech-to-text provider surface. fabric-harness ships Deepgram and * Cartesia implementations; bring-your-own for Whisper, AssemblyAI, etc. * Used by `PipelineVoiceProvider` to drive the audio-in side of * STT→LLM→TTS voice agents. */ import type { VoiceAudioFormat } from './voice.js'; export interface SttSessionOptions { /** Audio format the caller will feed via `send()`. Default `pcm16`. */ audioFormat?: VoiceAudioFormat; /** Sample rate in Hz. Default 16000 (Deepgram-recommended) for `pcm16`. */ sampleRate?: number; /** BCP-47 language tag, e.g. `en-US`, `es-MX`, or `multi` for autodetect. */ language?: string; /** Provider-specific model id. */ model?: string; /** * Voice-activity detection mode. `endpointing` lets the provider mark * end-of-utterance via silence detection; `none` returns continuous * transcripts and leaves turn detection to the caller. */ vad?: 'endpointing' | 'none'; /** * Optional ms of trailing silence to treat as end-of-utterance. * Provider-specific default when omitted. */ endpointingMs?: number; /** Abort signal — terminates the session cleanly. */ signal?: AbortSignal; } export type SttEvent = { type: 'transcript'; /** Final transcript for an utterance — safe to send to LLM. */ text: string; /** Whether this is the final transcript for the current utterance. */ isFinal: true; } | { type: 'partial'; /** Interim transcript — useful for live UI, NOT for LLM input. */ text: string; isFinal: false; } | { type: 'speech_started'; } | { type: 'speech_ended'; } | { type: 'error'; message: string; }; export interface SttSessionUsage { /** Audio seconds processed (used for billing rollup). */ seconds: number; /** Wall-clock duration in milliseconds. */ durationMs: number; } export interface SttSession { /** Send a raw audio frame in the configured format. */ send(frame: Uint8Array): void; /** Async iterable of recognition events. Closes when the session ends. */ events(): AsyncIterable; /** Tear down the underlying connection. */ close(): Promise; /** Usage rollup — populated as audio is processed. */ usage(): SttSessionUsage; } export interface SttProvider { /** Stable provider id used in cost telemetry, e.g. `deepgram`, `cartesia`. */ readonly name: string; /** Open a streaming recognition session. */ open(opts?: SttSessionOptions): Promise; } //# sourceMappingURL=voice-stt.d.ts.map