import { Disposable, IDisposable } from "../../../../../base/common/lifecycle.js"; import { ICommandService } from "../../../../../platform/commands/common/commands.service.js"; import { IContextViewService } from "../../../../../platform/contextview/browser/contextView.service.js"; import { IInstantiationService } from "../../../../../platform/instantiation/common/instantiation.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IStorageService } from "../../../../../platform/storage/common/storage.service.js"; import { ITelemetryService } from "../../../../../platform/telemetry/common/telemetry.service.js"; import { IChatInputOnboardingBanner, IChatInputOnboardingHostOptions } from "../widget/input/chatInputOnboarding.js"; import { ChatInputNoticeWidget } from "../widget/input/chatInputNoticeWidget.js"; import { IDictationOnboardingService } from "./dictationOnboarding.service.js"; export declare const SHOW_DICTATION_ONBOARDING_COMMAND = "workbench.action.chat.showSpeechToTextIntroduction"; export declare const RESET_DICTATION_ONBOARDING_COMMAND = "workbench.action.chat.resetSpeechToTextIntroduction"; type DictationMediaDevices = Pick; export type SwitchMicrophone = (deviceId: string) => Promise; /** One entry in the card's microphone picker. */ export interface IMicrophoneOption { readonly deviceId: string; readonly label: string; } /** * The pickable microphones, with the physical system-default device identified * in its label instead of represented by a separate synthetic row. * * Drops the virtual `default`/`communications` entries (which duplicate a real * device under a synthetic id) and de-duplicates by `deviceId`, so one physical * microphone appears exactly once - the same normalization the "Select * Microphone" quick pick does, kept in one place so the two never disagree. */ export declare function buildMicrophoneOptions(devices: readonly MediaDeviceInfo[]): IMicrophoneOption[]; /** * Index of the microphone currently in use. Falls back to the system default * when the remembered device has been unplugged, which is exactly what dictation * itself does when it acquires the stream. */ export declare function indexOfMicrophone(options: readonly IMicrophoneOption[], deviceId: string): number; export interface IDictationOnboardingBannerOptions { /** The element the card attaches itself to. */ readonly container: HTMLElement; readonly onDismiss: () => void; /** Whether this manually opened card should also acquire a microphone preview. */ readonly previewMicrophone: boolean; readonly source: "automatic" | "manual"; } /** * The first-run dictation card explains the feature and offers microphone * selection while recording starts. When reopened manually, it also previews * the selected microphone. * * The card runs alongside the first dictation, so it explains the feature * without delaying the action the user invoked. */ export declare class DictationOnboardingBanner extends ChatInputNoticeWidget implements IChatInputOnboardingBanner { private readonly bannerOptions; private readonly mediaDevices; private readonly commandService; private readonly contextViewService; private readonly logService; private readonly storageService; private readonly telemetryService; private readonly preview; private readonly waveform; private readonly hint; private readonly pickerContainer; private dictationAnalyser; private dictationWaveform; private switchMicrophone; private readonly picker; private options; constructor(bannerOptions: IDictationOnboardingBannerOptions, mediaDevices: DictationMediaDevices | undefined, commandService: ICommandService, contextViewService: IContextViewService, instantiationService: IInstantiationService, logService: ILogService, storageService: IStorageService, telemetryService: ITelemetryService); /** * Stops the waveform and releases the microphone while the card is put away * for a notification, so an invisible introduction never holds the microphone * open or keeps painting. */ setVisible(visible: boolean): void; /** * What dictation is, and that none of it is fixed. The card is shown once, so * the two things a user might want to change afterwards - whether dictation * runs at all, and how it writes what they say - have to be reachable from * here rather than left to a command nobody knows to look for. * * `[[...]]` marks the clauses that become links, so translators can keep the * sentence natural instead of having fixed phrases concatenated on. */ private renderDescription; /** * Bring the card to life. The device list and the microphone are started * together rather than in sequence: `getUserMedia` can take a second or more * to return, and waiting for it would leave the picker empty for that whole * time. Enumeration is repeated once the microphone is live, because device * labels stay blank until permission has been granted at least once. */ private startPreview; private currentDeviceId; refreshMicrophones(analyserNode?: AnalyserNode, switchMicrophone?: SwitchMicrophone): Promise; /** A picker with one entry is not a choice, so only show this row for multiple microphones. */ private renderPicker; private selectMicrophone; /** * The hint only speaks when the microphone cannot be read. At rest the * moving waveform is the instruction - a line of text telling you to talk is * one the card can do without. */ private updateHint; private renderClose; private dismiss; private logAction; } export declare class DictationOnboardingService extends Disposable implements IDictationOnboardingService { private readonly instantiationService; private readonly storageService; readonly _serviceBrand: undefined; private readonly onboarding; private currentBanner; get isVisible(): boolean; constructor(instantiationService: IInstantiationService, storageService: IStorageService); registerHost(options: IChatInputOnboardingHostOptions): IDisposable; showIfNeeded(): boolean; show(): boolean; refreshMicrophones(analyserNode?: AnalyserNode, switchMicrophone?: SwitchMicrophone): void; reset(): void; private createBanner; } export {};