import { EventEmitter } from './eventEmitter.js'; import { SpeechEventType, VADEventType, ChatRole } from './enums.js'; declare class SpeechDataImpl { text: string; confidence?: number; language?: string | null; startTime?: number; endTime?: number; duration?: number; constructor(init: { text: string; confidence?: number; language?: string | null; startTime?: number; endTime?: number; duration?: number; }); } /** A transcribed speech segment with timing and confidence. */ export type SpeechData = SpeechDataImpl; /** * Create {@link SpeechData}. * @param init.text Transcribed text (required). * @param init.confidence Recognition confidence 0-1. Defaults to `0.0`. * @param init.language Detected language code, or `null`. Defaults to `null`. * @param init.startTime Segment start time in seconds. Defaults to `0.0`. * @param init.endTime Segment end time in seconds. Defaults to `0.0`. * @param init.duration Segment duration in seconds. Defaults to `0.0`. */ export declare const SpeechData: (init: { text: string; confidence?: number; language?: string | null; startTime?: number; endTime?: number; duration?: number; }) => SpeechData; declare class STTResponseImpl { eventType: SpeechEventType; data: SpeechData; metadata?: Record | null; constructor(init: { eventType: SpeechEventType; data: SpeechData; metadata?: Record | null; }); } /** A speech-to-text result: an {@link SpeechEventType} plus its {@link SpeechData}. */ export type STTResponse = STTResponseImpl; /** * Create an {@link STTResponse}. * @param init.metadata Optional provider-specific extras. Defaults to `null`. */ export declare const STTResponse: (init: { eventType: SpeechEventType; data: SpeechData; metadata?: Record | null; }) => STTResponse; declare class LLMResponseImpl { content: string; role: ChatRole; metadata?: Record | null; constructor(init: { content: string; role: ChatRole; metadata?: Record | null; }); } /** A chunk or full message produced by an {@link LLM}. */ export type LLMResponse = LLMResponseImpl; /** * Create an {@link LLMResponse}. * @param init.metadata Optional provider-specific extras. Defaults to `null`. */ export declare const LLMResponse: (init: { content: string; role: ChatRole; metadata?: Record | null; }) => LLMResponse; declare class VADDataImpl { isSpeech: boolean; confidence?: number; timestamp?: number; speechDuration?: number; silenceDuration?: number; constructor(init: { isSpeech: boolean; confidence?: number; timestamp?: number; speechDuration?: number; silenceDuration?: number; }); } /** Voice-activity-detection measurement for a moment in the audio stream. */ export type VADData = VADDataImpl; /** * Create {@link VADData}. * @param init.isSpeech Whether speech is present (required). * @param init.confidence Detection confidence 0-1. Defaults to `0.0`. * @param init.timestamp Time in seconds. Defaults to `0.0`. * @param init.speechDuration Accumulated speech duration in seconds. Defaults to `0.0`. * @param init.silenceDuration Accumulated silence duration in seconds. Defaults to `0.0`. */ export declare const VADData: (init: { isSpeech: boolean; confidence?: number; timestamp?: number; speechDuration?: number; silenceDuration?: number; }) => VADData; declare class VADResponseImpl { eventType: VADEventType; data: VADData; metadata?: Record | null; constructor(init: { eventType: VADEventType; data: VADData; metadata?: Record | null; }); } /** A VAD event ({@link VADEventType}) carrying its {@link VADData}. */ export type VADResponse = VADResponseImpl; /** * Create a {@link VADResponse}. * @param init.metadata Optional provider-specific extras. Defaults to `null`. */ export declare const VADResponse: (init: { eventType: VADEventType; data: VADData; metadata?: Record | null; }) => VADResponse; /** Callback invoked with each {@link STTResponse} transcript. */ export type SttTranscriptCallback = (response: STTResponse) => void | Promise; /** Callback invoked with each {@link VADResponse} event. */ export type VadEventCallback = (response: VADResponse) => void | Promise; /** * Callback invoked when the first audio byte of a synthesis is emitted. * @param ttfbMs Time-to-first-byte in milliseconds. * @param byteCount Number of bytes in the first chunk. */ export type FirstAudioByteCallback = (ttfbMs: number, byteCount: number) => void | Promise; /** * Base class for speech-to-text providers. Provider plugins (e.g. `DeepgramSTT({...})`) * extend this; subclass it only to integrate a custom STT. */ export declare class STT extends EventEmitter<{ error: [unknown]; }> { _providerName: string; protected _transcriptCallback: SttTranscriptCallback | null; _session?: any; constructor(); /** Human-readable provider label (defaults to the class name). */ get label(): string; /** Register a callback to receive transcripts as they are produced. */ onSttTranscript(callback: SttTranscriptCallback): void; /** Process a buffer of audio frames. Override in a custom provider. */ processAudio(_audioFrames: Uint8Array, _language?: string | null, ..._extra: any[]): Promise; /** Transcribe a streaming audio source, yielding {@link STTResponse}s. Override in a custom provider. */ streamTranscribe(_audioStream: AsyncIterable, ..._extra: any[]): AsyncIterator; /** Release any resources held by the provider. */ close(): Promise; /** Provider configuration sent to the Zero Runtime. Override to supply settings. */ getRuntimeConfig(): Record; } /** Per-call options for {@link LLM.chat}. */ export type LLMChatOptions = { /** Tools the model may call this turn. */ tools?: any; /** Optional conversational-graph routing configuration. */ conversationalGraph?: any; [key: string]: any; }; /** * Base class for language-model providers. Provider plugins (e.g. `GoogleLLM({...})`) * extend this; subclass it only to integrate a custom LLM. */ export declare class LLM extends EventEmitter<{ error: [unknown]; }> { _providerName: string; _session?: any; constructor(); /** Human-readable provider label (defaults to the class name). */ get label(): string; /** Stream a completion for the given messages, yielding {@link LLMResponse} chunks. */ chat(_messages: any, _opts?: LLMChatOptions): AsyncIterator; /** Cancel the in-flight generation for the current session, if any. */ cancelCurrentGeneration(): Promise; /** Release any resources held by the provider. */ close(): Promise; /** Provider configuration sent to the Zero Runtime. Override to supply settings. */ getRuntimeConfig(): Record; } /** Options for the {@link TTS} base constructor. */ export type TTSOptions = { /** Output sample rate in Hz. Defaults to `24000`. */ sampleRate?: number; /** Number of output channels. Defaults to `1`. */ numChannels?: number; }; /** * Base class for text-to-speech providers. Provider plugins (e.g. `CartesiaTTS({...})`) * extend this; subclass it only to integrate a custom TTS. */ export declare class TTS extends EventEmitter<{ error: [unknown]; }> { _providerName: string; _session?: any; protected _sampleRate: number; protected _numChannels: number; protected _firstAudioByteCallback: FirstAudioByteCallback | null; constructor(opts?: TTSOptions); /** Register a callback fired when the first synthesized audio byte is emitted. */ onFirstAudioByte(callback: FirstAudioByteCallback): void; /** Human-readable provider label (defaults to the class name). */ get label(): string; /** Configured output sample rate in Hz. */ get sampleRate(): number; /** Configured number of output channels. */ get numChannels(): number; /** Synthesize and speak `text` on the active session. */ synthesize(text: any, ..._extra: any[]): Promise; /** Stop the current synthesis. */ interrupt(): Promise; /** Release any resources held by the provider. */ close(): Promise; /** Provider configuration sent to the Zero Runtime. Override to supply settings. */ getRuntimeConfig(): Record; } /** Options for the {@link VAD} base constructor. */ export type VADOptions = { /** Input sample rate in Hz. Defaults to `16000`. */ sampleRate?: number; /** Speech-probability threshold 0-1 above which audio counts as speech. Defaults to `0.5`. */ threshold?: number; /** Minimum speech duration in seconds to register a start-of-speech. Defaults to `0.5`. */ minSpeechDuration?: number; /** Minimum silence duration in seconds to register an end-of-speech. Defaults to `0.5`. */ minSilenceDuration?: number; }; /** * Base class for voice-activity-detection providers. Provider plugins extend this; * subclass it only to integrate a custom VAD. */ export declare class VAD extends EventEmitter<{ error: [unknown]; info: [string]; }> { _providerName: string; protected _sampleRate: number; protected _threshold: number; protected _minSpeechDuration: number; protected _minSilenceDuration: number; protected _vadCallback: VadEventCallback | null; constructor(opts?: VADOptions); /** Human-readable provider label (defaults to the class name). */ get label(): string; /** Configured input sample rate in Hz. */ get sampleRate(): number; /** Process a buffer of audio frames. Override in a custom provider. */ processAudio(_audioFrames: Uint8Array, ..._extra: any[]): Promise; /** Flush any buffered audio. */ flush(): Promise; /** Release any resources held by the provider. */ close(): Promise; /** Register a callback to receive {@link VADResponse} events. */ onVadEvent(callback: VadEventCallback): void; /** Provider configuration (threshold and durations) sent to the Zero Runtime. */ getRuntimeConfig(): Record; } /** Options for the {@link EOU} base constructor. */ export type EOUOptions = { /** End-of-utterance probability threshold 0-1. Defaults to `0.7`. */ threshold?: number; }; /** * Base class for end-of-utterance (turn-detection) providers. Provider plugins extend * this; subclass it only to integrate a custom turn detector. */ export declare class EOU extends EventEmitter<{ error: [unknown]; }> { _providerName: string; protected _threshold: number; _session?: any; constructor(opts?: EOUOptions); /** Human-readable provider label (defaults to the class name). */ get label(): string; /** Current end-of-utterance probability threshold. */ get threshold(): number; /** Latest end-of-utterance probability 0-1 (defaults to `0.5` when unknown). */ getEouProbability(_chatContext?: any): number; /** Whether the current EOU probability meets `threshold` (or the configured one). */ detectEndOfUtterance(chatContext?: any, threshold?: number): boolean; /** Update the end-of-utterance threshold. */ setThreshold(threshold: number): void; /** Release any resources held by the provider. */ close(): Promise; /** Tear down provider state. */ cleanup(): Promise; /** Provider configuration (threshold) sent to the Zero Runtime. */ getRuntimeConfig(): Record; } export {};