import * as react_jsx_runtime from 'react/jsx-runtime'; import { L as LiquidOrbProps, a as LiquidOrbMode, b as LiquidOrbConfig, c as LiquidOrbContextValue, O as OrbParams, V as VADConfig, A as AudioFrame } from './useConversation-CJyx6P-d.js'; export { d as AudioReactivityConfig, C as ConversationPhase, D as DEFAULT_AUDIO_REACTIVITY, P as PulseType, Q as QualityTier, U as UseConversationOptions, e as UseConversationReturn, u as useConversation } from './useConversation-CJyx6P-d.js'; import React from 'react'; import { SDKRouterClient } from '@sdkrouter/client'; import * as zustand from 'zustand'; import 'three'; declare function LiquidOrb({ mode, audioSource, size, config, className, children, }: LiquidOrbProps): react_jsx_runtime.JSX.Element; interface LiquidOrbProviderProps { mode?: LiquidOrbMode; audioSource?: HTMLAudioElement | null; config?: LiquidOrbConfig; children: React.ReactNode; } declare function LiquidOrbProvider({ mode: modeProp, audioSource, config, children, }: LiquidOrbProviderProps): react_jsx_runtime.JSX.Element; declare function useLiquidOrb(): LiquidOrbContextValue; declare const DEFAULT_PRESETS: Record; type RecorderStatus = 'idle' | 'recording' | 'transcribing' | 'error'; /** Audio energy bands emitted per frame via onAudioFrame */ interface MicAudioFrame { low: number; mid: number; high: number; volume: number; } interface UseSpeechRecorderOptions { /** SDKRouterClient instance with audioUrl configured */ client: SDKRouterClient; /** Language hint for STT (ISO 639-1), e.g. 'en', 'ru' */ language?: string; /** STT model, default 'whisper-1' */ model?: string; /** * Use browser Web Speech API instead of server. * Falls back to server STT if browser doesn't support it. * - true: prefer browser * - false: always use server (default) * - 'auto': browser if supported, server otherwise */ useWebSpeechAPI?: boolean | 'auto'; /** BCP-47 lang for Web Speech API, e.g. 'en-US'. Derived from `language` if not set */ webSpeechLang?: string; /** Silence duration (ms) before auto-stop. 0 = disabled. Default 0. */ silenceTimeout?: number; /** RMS threshold below which audio is considered silence. Default 0.01 */ silenceThreshold?: number; /** Advanced VAD configuration (overrides silenceTimeout/silenceThreshold when provided) */ vadConfig?: Partial; /** Called when transcription completes */ onResult?: (text: string) => void; /** Called with interim text while still speaking (Web Speech API only) */ onInterim?: (text: string) => void; /** Called on error */ onError?: (error: Error) => void; /** Called every animation frame with mic FFT data (for visualizations) */ onAudioFrame?: (frame: MicAudioFrame) => void; /** * Use server-side streaming STT via WebSocket. * - true: always use streaming * - 'auto': streaming if client supports it, fallback to batch * - 'prefer': streaming first, then browser Web Speech, then batch * - false: never (default) */ useStreamingSTT?: boolean | 'auto' | 'prefer'; } interface UseSpeechRecorderReturn { status: RecorderStatus; /** Start recording from microphone */ startRecording: () => Promise; /** Stop recording and send to STT */ stopRecording: () => void; /** True while actively recording */ isRecording: boolean; /** Which STT backend is being used */ backend: 'server' | 'browser'; /** Whether browser Web Speech API is available */ webSpeechSupported: boolean; /** Last error message */ error: string | null; } declare function useSpeechRecorder(options: UseSpeechRecorderOptions): UseSpeechRecorderReturn; type WebSpeechStatus = 'idle' | 'listening' | 'error'; interface UseWebSpeechOptions { /** Language (BCP-47), e.g. 'en-US', 'ru-RU'. Default: browser default */ lang?: string; /** Continuous recognition (keeps listening until stopped). Default: false */ continuous?: boolean; /** Interim results while speaking. Default: true */ interimResults?: boolean; /** Called with final transcript */ onResult?: (text: string) => void; /** Called with interim transcript (partial, still speaking) */ onInterim?: (text: string) => void; /** Called on error */ onError?: (error: Error) => void; } interface UseWebSpeechReturn { status: WebSpeechStatus; /** Start browser speech recognition */ startListening: () => void; /** Stop browser speech recognition */ stopListening: () => void; isListening: boolean; /** Whether Web Speech API is available in this browser */ isSupported: boolean; error: string | null; } declare function useWebSpeech(options?: UseWebSpeechOptions): UseWebSpeechReturn; /** * useStreamingSTT — React hook for server-side streaming speech-to-text. * * Captures raw PCM audio from the microphone via AudioContext + ScriptProcessor, * streams it over a WebSocket to the audio_service, and receives interim/final * transcription results in real-time. */ interface UseStreamingSTTOptions { client: SDKRouterClient; model?: string; language?: string; silenceTimeout?: number; silenceThreshold?: number; onInterim?: (text: string) => void; onResult?: (text: string) => void; onError?: (error: Error) => void; onAudioFrame?: (frame: MicAudioFrame) => void; } interface UseStreamingSTTReturn { startRecording: () => Promise; stopRecording: () => void; isRecording: boolean; status: RecorderStatus; } declare function useStreamingSTT(options: UseStreamingSTTOptions): UseStreamingSTTReturn; type EventHandler = (data: T) => void; declare class TypedEmitter> { private listeners; on(event: K, handler: EventHandler): () => void; emit(event: K, data: TMap[K]): void; off(event: K, handler: EventHandler): void; removeAllListeners(): void; } type ConversationPhase = 'idle' | 'listening' | 'thinking' | 'speaking'; interface AISphereEventMap { 'conversation:phase-change': ConversationPhase; 'conversation:transcript': string; 'conversation:response': string; 'conversation:error': Error; 'audio:mic-frame': AudioFrame; 'audio:tts-frame': AudioFrame; 'audio:tts-start': HTMLAudioElement; 'audio:tts-end': void; } declare function AISphereEventsProvider({ children }: { children: React.ReactNode; }): react_jsx_runtime.JSX.Element; declare function useAISphereEmitter(): TypedEmitter; declare function useAISphereEvent(event: K, handler: (data: AISphereEventMap[K]) => void): void; interface LogEntry { id: number; timestamp: number; event: string; data: unknown; } interface LoggerState { logs: LogEntry[]; maxEntries: number; nextId: number; addLog: (event: string, data: unknown) => void; clear: () => void; } declare const useLoggerStore: zustand.UseBoundStore>; declare function useLoggerBridge(): void; /** * useTextChunker — Smart text chunking for TTS * * Splits text into natural speech chunks optimized for TTS: * - Prioritizes sentence boundaries * - Falls back to clause boundaries (commas, semicolons) * - Respects minimum/maximum chunk sizes * - Handles streaming input (accumulates until boundary found) * - Preserves abbreviations, numbers, URLs */ interface TextChunkerConfig { /** Minimum chunk length before emitting. Default 20 */ minLength: number; /** Maximum chunk length — force split if exceeded. Default 200 */ maxLength: number; /** Ideal chunk length — prefer splits near this. Default 80 */ idealLength: number; /** Minimum length for FIRST chunk (for fast time-to-first-audio). Default: same as minLength */ firstChunkMinLength: number; /** Language hint for smarter splitting. Default 'en' */ language: string; } interface TextChunkerReturn { /** Feed text (can be called multiple times for streaming) */ push: (text: string) => string[]; /** Flush remaining buffer (call when stream ends) */ flush: () => string | null; /** Reset state */ reset: () => void; /** Get current buffer content */ getBuffer: () => string; } /** * Smart text chunker hook for TTS */ declare function useTextChunker(config?: Partial): TextChunkerReturn; /** * Non-hook version for use outside React components * * Adaptive chunking: analyzes content to determine optimal chunk sizes * - Short replies (< 150 chars): send as single chunk * - Lists: chunk by items * - Medium (150-400): moderate chunks ~180 chars * - Long (> 400): larger chunks ~300 chars for natural flow */ declare function createTextChunker(config?: Partial): { push(text: string): string[]; flush(): string | null; reset(): void; getBuffer(): string; /** Get detected content type (for debugging) */ getContentType(): "medium" | "short" | "long" | "list"; /** Get current chunk index */ getChunkIndex(): number; }; export { type AISphereEventMap, AISphereEventsProvider, AudioFrame, DEFAULT_PRESETS, LiquidOrb, LiquidOrbConfig, LiquidOrbContextValue, LiquidOrbMode, LiquidOrbProps, LiquidOrbProvider, type LogEntry, OrbParams, type RecorderStatus, type TextChunkerConfig, type TextChunkerReturn, TypedEmitter, type UseSpeechRecorderOptions, type UseSpeechRecorderReturn, type UseStreamingSTTOptions, type UseStreamingSTTReturn, type UseWebSpeechOptions, type UseWebSpeechReturn, type WebSpeechStatus, createTextChunker, useAISphereEmitter, useAISphereEvent, useLiquidOrb, useLoggerBridge, useLoggerStore, useSpeechRecorder, useStreamingSTT, useTextChunker, useWebSpeech };