import { Event } from "../../../../../sessions/sessions.web.main.internal.js"; import { ChatSpeechToTextState, ChatDictationSurface, IChatDictationTranscript, IChatSpeechToTextStopOptions, IDictationAccuracyMeasurement } from "./chatSpeechToTextService.js"; export declare const IChatSpeechToTextService: import("../../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; export interface IChatSpeechToTextService { readonly _serviceBrand: undefined; readonly onDidChangeState: Event; readonly state: ChatSpeechToTextState; readonly isBusy: boolean; /** Dictation surface associated with the current or most recent session. */ readonly currentSurface: ChatDictationSurface; /** * Fires with the cumulative transcript while recording, so callers can * render dictation live as the user speaks. The value grows monotonically * (finalized utterances plus any in-progress delta), and carries the * finalized (committed) portion of that transcript. */ readonly onDidUpdateTranscript: Event; /** Whether interim transcript text should be rendered while recording. */ readonly showTranscriptWhileDictating: boolean; /** Analyser for the active microphone capture, used for audio-reactive feedback. */ readonly analyserNode: AnalyserNode | undefined; /** Replace the microphone used by an active recording and return its analyser. */ switchMicrophone(window: Window & typeof globalThis, deviceId: string): Promise; /** * Whether speech-to-text is available for the current Copilot entitlement, * selected backend, and platform. Callers gate the dictation UI on this. */ readonly isConfigured: boolean; /** * Fires when the model-preparation state changes. `true` while the model is * downloading/loading, `false` once it is ready, errors, or the session * ends. Callers swap the mic affordance for a spinner while preparing. */ readonly onDidChangePreparingModel: Event; /** Whether the on-device model is currently downloading/loading. */ readonly isPreparingModel: boolean; /** * Fires when the model-download sub-state changes. `true` while the model is * actively downloading to disk (a confirmed cache miss), `false` while it is * merely loading an already-cached model into memory or once preparation * ends. Callers use this to show a download affordance only during a real * download, and a plain spinner while loading. */ readonly onDidChangeDownloadingModel: Event; /** Whether the on-device model is currently downloading to disk (cache miss). */ readonly isDownloadingModel: boolean; /** * Fires whenever the on-device model download progress changes while the * model is being prepared, so callers can update a progress ring. */ readonly onDidChangeModelDownloadProgress: Event; /** * Fractional download progress in `[0, 1]` while the model is downloading, * or `undefined` when the fraction is not yet known (indeterminate), the * download has finished and the model is loading into memory, or no * preparation is in progress. */ readonly modelDownloadProgress: number | undefined; /** * Begin capturing microphone audio in the given window and streaming it to * the on-device transcription model. Rejects if the microphone cannot be * accessed. `surface` identifies the dictation surface for telemetry * (defaults to the chat input). */ start(window: Window & typeof globalThis, surface?: ChatDictationSurface): Promise; /** * Stop capturing, flush the final utterance, and resolve with the complete * cumulative transcript (or `undefined` when nothing was transcribed). */ stopAndTranscribe(options?: IChatSpeechToTextStopOptions): Promise; /** Abort an in-progress recording without keeping the transcript. */ cancel(): Promise; /** The backend selected for the current/most-recent session (`nemo` or `mai`). */ readonly currentBackend: string; /** * Report how much a finished dictation was edited before it was submitted, as * an accuracy proxy. Computes the edit distance internally and logs only * aggregate metrics; no transcript text is emitted. */ logDictationAccuracy(measurement: IDictationAccuracyMeasurement): void; }