/**
 * AIChatRTCLocal — Local (browser-only) voice chat module.
 *
 * A zero-server-cost alternative to AIChatRTC that replaces VolcEngine RTC's
 * server-side ASR/LLM/TTS pipeline with:
 *   - Silero neural VAD (single-thread WASM) + energy-threshold fallback
 *   - Web Speech API (SpeechRecognition) for STT fallback
 *   - Optional local neural streaming ASR via a small Sherpa-ONNX-style model
 *   - Optional local Whisper ASR for Chinese/English mixed utterances
 *   - Optional local neural TTS with browser speechSynthesis fallback
 *   - Existing sdk.aiChat.chat() SSE streaming for LLM
 *
 * Mirrors AIChatRTC's public API shape so consumers can swap backends with
 * minimal changes. Supports tool calling via SandboxToolEnv and child-agent
 * sessions via ChildSessionMixin — same interface as RTCChatSession.
 *
 * Usage:
 *   const rtcLocal = new AIChatRTCLocal(window.keepwork);
 *   const session = rtcLocal.createSession({
 *     agentConfig: { WelcomeMessage: 'Hello!' },
 *     config: {
 *       LLMConfig: { Model: 'keepwork-flash', SystemMessages: ['You are a helpful assistant.'] },
 *       ASRConfig: { Language: 'zh-CN' },
 *       TTSConfig: { Speed: 1.0 },
 *     },
 *     workspace: 'myWorkspace',
 *     enabledToolCategories: ['fileOps', 'agent'],
 *   });
 *   session.on('subtitle', ({ text, isUser }) => console.log(text));
 *   session.on('state', ({ code, label }) => console.log(label));
 *   session.on('functionCallInfo', ({ name }) => console.log('calling', name));
 *   await session.start();
 *   // speak into microphone → VAD detects → STT → LLM → TTS
 *   session.sendText('Hi there');   // or type text
 *   await session.stop();
 */
type RTCLocalAny = Record<string, any>;
/** CDN paths for Silero VAD (single-thread WASM) */
declare const DEFAULT_VAD_CDN: {
    ortUrl: string;
    onnxWASMBasePath: string;
    bundleUrl: string;
    modelURL: string;
    workletURL: string;
};
declare const DEFAULT_ASSET_CACHE: {
    dbName: string;
    storeName: string;
    namespace: string;
    modelFileName: string;
    wasmFileNames: string[];
};
/** Energy-VAD defaults */
declare const ENERGY_VAD: {
    SAMPLE_INTERVAL: number;
    SPEECH_THRESHOLD: number;
    SILENCE_DURATION: number;
    SPEECH_MIN_DURATION: number;
};
declare const DEFAULT_AUDIO_CONSTRAINTS: {
    channelCount: number;
    echoCancellation: boolean;
    noiseSuppression: boolean;
    autoGainControl: boolean;
    voiceIsolation: boolean;
};
declare const ASR_PROVIDER: {
    LOCAL_NEURAL: string;
    WHISPER: string;
    WEB_SPEECH: string;
};
declare const DEFAULT_ASR_OPTIONS: {
    provider: string;
    fallbackProvider: string;
};
declare const DEFAULT_LOCAL_NEURAL_ASR: {
    sampleRate: number;
    featureDim: number;
    numThreads: number;
    executionProvider: string;
    modelingUnit: string;
    decodingMethod: string;
    tailPaddingSeconds: number;
    bufferSize: number;
    initTimeoutMs: number;
    emitPartials: boolean;
};
declare const DEFAULT_WHISPER_ASR: {
    sampleRate: number;
    featureDim: number;
    numThreads: number;
    executionProvider: string;
    decodingMethod: string;
    task: string;
    tailPaddings: number;
    initTimeoutMs: number;
};
declare const TTS_PROVIDER: {
    LOCAL_NEURAL: string;
    BROWSER_SPEECH: string;
};
declare const DEFAULT_TTS_OPTIONS: {
    provider: string;
    fallbackProvider: string;
};
declare const DEFAULT_KEEPWORK_MODEL_CDN = "https://cdn.keepwork.com/keepwork/cdn/models";
/**
 * Resolve the default model asset base at runtime.
 * On localhost / LAN / file: serve from the local ./models directory;
 * everywhere else (production Keepwork pages) use the CDN.
 */
declare function getDefaultModelAssetBase(): string;
declare const DEFAULT_LOCAL_NEURAL_TTS: {
    numThreads: number;
    executionProvider: string;
    initTimeoutMs: number;
    speed: number;
    volume: number;
    speakerId: number;
    silenceScale: number;
    maxNumSentences: number;
};
declare const DEFAULT_LOCAL_NEURAL_TTS_PRESET = "vits_melo_zh_en";
declare const DEFAULT_LOCAL_NEURAL_TTS_ASSET_BASE: string;
declare const LOCAL_NEURAL_TTS_PRESETS: Record<string, RTCLocalAny>;
declare const LOCAL_NEURAL_TTS_PRESET_ALIASES: Record<string, string>;
declare const DEFAULT_LOCAL_NEURAL_PRESET = "zipformer_small_bilingual_zh_en";
declare const DEFAULT_LOCAL_NEURAL_ASSET_BASE: string;
declare const LOCAL_NEURAL_ASR_PRESETS: Record<string, RTCLocalAny>;
declare const LOCAL_NEURAL_ASR_PRESET_ALIASES: Record<string, string>;
declare const DEFAULT_WHISPER_PRESET = "whisper_tiny_multilingual";
declare const LOCAL_WHISPER_ASR_PRESETS: Record<string, RTCLocalAny>;
declare const LOCAL_WHISPER_ASR_PRESET_ALIASES: Record<string, string>;
declare function normalizeASRProvider(provider: unknown): string;
declare function normalizeTTSProvider(provider: unknown): string;
declare function parseOptionalInteger(value: unknown): number | undefined;
declare function trimTrailingSlash(url: unknown): string;
declare function normalizeLocalNeuralTTSPreset(preset: unknown): string;
declare function isMixedChineseEnglishLanguage(language: unknown): boolean;
declare function hasWhisperASRHints(asrConfig?: RTCLocalAny): boolean;
declare function getDefaultASRFallbackProviders(preferredProvider: unknown): string[];
declare class BaseASRBackend {
    session: RTCLocalAny;
    config: RTCLocalAny;
    name: string;
    [key: string]: any;
    constructor(session: RTCLocalAny, config?: RTCLocalAny);
    initialize(): Promise<void>;
    startUtterance(): Promise<void>;
    submitBufferedAudio(..._args: unknown[]): Promise<void>;
    stopUtterance(): Promise<void>;
    attachMediaStream(..._args: unknown[]): Promise<void>;
    destroy(): Promise<void>;
}
declare class WebSpeechASRBackend extends BaseASRBackend {
    constructor(session: RTCLocalAny, config?: RTCLocalAny);
    initialize(): Promise<void>;
    startUtterance(): Promise<void>;
    stopUtterance(): Promise<void>;
    destroy(): Promise<void>;
}
declare class WhisperASRBackend extends BaseASRBackend {
    constructor(session: RTCLocalAny, config?: RTCLocalAny);
    initialize(): Promise<void>;
    _resolveRuntimeConfig(): Promise<{
        runtimeConfig: unknown;
        recognizerConfig: unknown;
        initTimeoutMs: any;
    }>;
    _resolveRemoteUrls(value: unknown): Promise<unknown>;
    startUtterance(): Promise<void>;
    submitBufferedAudio(samples: unknown, sampleRate?: number): Promise<void>;
    stopUtterance(): Promise<void>;
    destroy(): Promise<void>;
}
declare class LocalNeuralASRBackend extends BaseASRBackend {
    constructor(session: RTCLocalAny, config?: RTCLocalAny);
    initialize(): Promise<void>;
    _resolveRuntimeConfig(): Promise<{
        runtimeConfig: unknown;
        recognizerConfig: unknown;
        initTimeoutMs: any;
    }>;
    _resolveRemoteUrls(value: unknown): Promise<unknown>;
    attachMediaStream(stream: RTCLocalAny): Promise<void>;
    _teardownAudioTap(): Promise<void>;
    startUtterance(): Promise<void>;
    submitBufferedAudio(samples: unknown, sampleRate?: number): Promise<void>;
    stopUtterance(): Promise<void>;
    destroy(): Promise<void>;
}
declare class BaseTTSBackend {
    session: RTCLocalAny;
    config: RTCLocalAny;
    name: string;
    [key: string]: any;
    constructor(session: RTCLocalAny, config?: RTCLocalAny);
    initialize(): Promise<void>;
    speak(..._args: unknown[]): Promise<void>;
    cancel(): void;
    destroy(): Promise<void>;
}
declare class BrowserSpeechTTSBackend extends BaseTTSBackend {
    constructor(session: RTCLocalAny, config?: RTCLocalAny);
    initialize(): Promise<void>;
    speak(text: string, ttsConfig?: RTCLocalAny): Promise<void>;
    cancel(): void;
    destroy(): Promise<void>;
}
declare class LocalNeuralTTSBackend extends BaseTTSBackend {
    constructor(session: RTCLocalAny, config?: RTCLocalAny);
    initialize(): Promise<void>;
    _resolveRuntimeConfig(): Promise<{
        runtimeConfig: unknown;
        offlineTtsConfig: unknown;
        initTimeoutMs: any;
        defaultSpeakerId: any;
        sampleRate: any;
        activePreset: RTCLocalAny;
    }>;
    _resolveRemoteUrls(value: unknown): Promise<unknown>;
    _ensureAudioContext(): Promise<any>;
    _synthesize(text: string, generationConfig: RTCLocalAny): Promise<RTCLocalAny>;
    _playAudio(samples: unknown, sampleRate: number, speakToken: number, playbackVolume: number): Promise<void>;
    speak(text: string, ttsConfig?: RTCLocalAny): Promise<void>;
    cancel(): void;
    destroy(): Promise<void>;
}
/** Sentence-end regex for TTS chunking (Chinese & Western punctuation + newlines) */
declare const SENTENCE_END_RE: RegExp;
export { BaseASRBackend, WebSpeechASRBackend, WhisperASRBackend, LocalNeuralASRBackend, BaseTTSBackend, BrowserSpeechTTSBackend, LocalNeuralTTSBackend, DEFAULT_VAD_CDN, DEFAULT_ASR_OPTIONS, DEFAULT_TTS_OPTIONS, DEFAULT_LOCAL_NEURAL_ASR, DEFAULT_WHISPER_ASR, DEFAULT_LOCAL_NEURAL_TTS, DEFAULT_LOCAL_NEURAL_TTS_PRESET, DEFAULT_LOCAL_NEURAL_TTS_ASSET_BASE, LOCAL_NEURAL_TTS_PRESETS, LOCAL_NEURAL_TTS_PRESET_ALIASES, DEFAULT_LOCAL_NEURAL_PRESET, DEFAULT_LOCAL_NEURAL_ASSET_BASE, LOCAL_NEURAL_ASR_PRESETS, LOCAL_NEURAL_ASR_PRESET_ALIASES, DEFAULT_WHISPER_PRESET, LOCAL_WHISPER_ASR_PRESETS, LOCAL_WHISPER_ASR_PRESET_ALIASES, DEFAULT_KEEPWORK_MODEL_CDN, getDefaultModelAssetBase, normalizeASRProvider, normalizeTTSProvider, parseOptionalInteger, trimTrailingSlash, normalizeLocalNeuralTTSPreset, isMixedChineseEnglishLanguage, hasWhisperASRHints, getDefaultASRFallbackProviders, DEFAULT_ASSET_CACHE, ENERGY_VAD, DEFAULT_AUDIO_CONSTRAINTS, ASR_PROVIDER, TTS_PROVIDER, SENTENCE_END_RE, };
//# sourceMappingURL=AIChatRTCLocal.backends.d.ts.map