import { YpBaseChatBot } from "../../services/llms/baseChatBot.js"; import { YpBaseAssistant } from "./baseAssistant.js"; import WebSocket from "ws"; import ioredis from "ioredis"; interface VoiceMessage { delta: any; type: string; content?: string; audio?: string; metadata?: any; } interface VoiceState { speaking: boolean; listening: boolean; processingAudio: boolean; lastAudioTimestamp?: number; } interface VoiceConnectionConfig { model: string; voice: string; instructions?: string; tools?: AssistantChatbotTool[]; modalities: ("text" | "audio")[]; } interface RealtimeVoiceConnection { ws: WebSocket; connected: boolean; model: string; voice: string; } export declare class YpBaseChatBotWithVoice extends YpBaseChatBot { protected voiceEnabled: boolean; assistantVoiceConnection?: RealtimeVoiceConnection; directAgentVoiceConnection?: RealtimeVoiceConnection; private voiceMainMessageHandler?; private voiceDirectMessageHandler?; protected voiceConfig: VoiceConnectionConfig; protected voiceState: VoiceState; protected readonly VAD_TIMEOUT = 1000; protected vadTimeout?: NodeJS.Timeout; protected parentAssistant: YpBaseAssistant; sendTranscriptsToClient: boolean; isWaitingOnCancelResponseCompleted: boolean; lastNumberOfChatHistoryForInstructions: number; exitMessageFromDirectAgentConversation: string | undefined; DEBUG: boolean; constructor(wsClientId: string, wsClients: Map, redisKey: string, redisConnection: ioredis.Redis, voiceEnabled: boolean | undefined, parentAssistant: YpBaseAssistant); updateAiModelSession(message: string): Promise; initializeMainAssistantVoiceConnection(): Promise; initializeDirectAgentVoiceConnection(): Promise; destroyDirectAgentVoiceConnection(): Promise; destroyAssistantVoiceConnection(): void; protected setupVoiceMessageHandlers(ws: WebSocket, disableWhenAgentIsSpeaking: boolean): void; destroy(): void; handleResponseDone(event: any): Promise; handleAudioTranscriptDone(event: any): Promise; callFunctionHandler(event: any): Promise; getRandomStringAscii(length?: number): string; proxyToClient(event: any): Promise; handleIncomingAudio(audioData: Uint8Array): Promise; private handleVADSilence; private handleSpeechStarted; private handleSpeechStopped; handleAudioDelta(event: VoiceMessage): Promise; private handleTextOutput; sendToVoiceConnection(message: any): void; private handleAudioBufferCommitted; waitForCancelResponseCompleted(): Promise; sendCancelResponse(): Promise; initializeVoiceSession(customResponseMessage?: string): Promise; triggerResponse(message: string, cancelResponse?: boolean): Promise; protected handleVoiceSessionCreated(event: any): Promise; protected handleVoiceSessionError(event: any): Promise; protected handleVoiceResponseStatus(event: any): Promise; streamWebSocketResponses(stream: any): Promise; updateVoiceConfig(config: Partial): Promise; } export {};