import type { IncomingMessage } from 'node:http'; import type { Socket } from 'node:net'; import { type CreateVoiceSessionRequest, type CreateVoiceSessionResponse } from '@xopcai/realtime-protocol/voice'; import type { Config } from '../../config/schema.js'; import type { ResolvedStreamingStt, ResolvedStreamingTts, VoiceRealtimeRuntimeOptions } from './runtime.types.js'; export type { VoiceTicketClaim, VoiceRealtimeRuntimeOptions } from './runtime.types.js'; export type VoiceSessionCreationErrorCode = 'VOICE_DISABLED' | 'SESSION_NOT_FOUND' | 'SESSION_CONFLICT' | 'SESSION_LIMIT' | 'PROVIDER_UNAVAILABLE'; export declare class VoiceSessionCreationError extends Error { readonly code: VoiceSessionCreationErrorCode; readonly status: 404 | 409 | 429 | 503; constructor(code: VoiceSessionCreationErrorCode, message: string, status: 404 | 409 | 429 | 503); } export declare function resolveStreamingStt(config: Config, language?: string): ResolvedStreamingStt | undefined; export declare function resolveStreamingTts(config: Config): ResolvedStreamingTts | undefined; export declare class VoiceRealtimeRuntime { private readonly options; private readonly wss; private readonly tickets; private readonly preauthBudget; private readonly socketsByPrincipal; private readonly conversationReservations; private closed; constructor(options: VoiceRealtimeRuntimeOptions); private prepareSession; preflight(request: CreateVoiceSessionRequest): Promise; createSession(request: CreateVoiceSessionRequest, principalId: string, now?: number): Promise; handleUpgrade(req: IncomingMessage, socket: Socket, head: Buffer): boolean; hasConversation(sessionKey: string): boolean; close(): void; private releaseConversationReservation; private consumeTicket; private pruneTickets; private handleConnection; }