/*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ import type { IVoiceEngine } from "./voice-engine"; /** * Streams microphone audio to the Jodit transcription proxy * (`wss://…/v1/ai/transcribe`) and reports transcript events back. The cloud key * stays on the server; the browser only opens an authenticated socket and sends * binary PCM16 audio. * * The server speaks the JSON protocol `ready` / `delta` / `final` / `error`; this * class translates it into callbacks the mic button consumes. * * @module plugins/ai-assistant-pro/voice */ export interface IVoiceTranscriberOptions { /** Proxy endpoint, e.g. `wss://cloud.xdsoft.net/v1/ai/transcribe`. */ url: string; /** Cloud API key (sent as the `key` query param). */ apiKey: string; /** Transcription model; defaults to the server's default. */ model?: string; /** BCP-47 language hint, e.g. `en-US`. */ language?: string; /** Silence (ms) before a phrase is committed; sent as the `silence` param. */ silenceMs?: number; /** Upstream session is live — audio is now streaming. */ onReady?: () => void; /** Interim (partial) transcript for the current phrase. */ onInterim?: (text: string) => void; /** Committed transcript for a finished phrase. */ onFinal?: (text: string) => void; /** A recoverable error (mic denied, connection/provider error). */ onError?: (message: string) => void; /** The session ended (socket closed). */ onEnd?: () => void; } export declare class VoiceTranscriber implements IVoiceEngine { private readonly options; private ws; private streamer; private running; constructor(options: IVoiceTranscriberOptions); get isActive(): boolean; /** Open the socket and begin a transcription session. */ start(): void; /** Stop the session and release the microphone. */ stop(): void; private onMessage; private startAudio; private fail; private finish; }