import { BaseActionViewItem } from "../../../../../base/browser/ui/actionbar/actionViewItems.js"; import { IAction } from "../../../../../base/common/actions.js"; import { IObservable } from "../../../../../base/common/observable.js"; import { Action2 } from "../../../../../platform/actions/common/actions.js"; import { ICommandService } from "../../../../../platform/commands/common/commands.service.js"; import { IConfigurationService } from "../../../../../platform/configuration/common/configuration.service.js"; import { IContextMenuService } from "../../../../../platform/contextview/browser/contextView.service.js"; import { IAccessibilityService } from "../../../../../platform/accessibility/common/accessibility.service.js"; import { IThemeService } from "../../../../../platform/theme/common/themeService.service.js"; import { ServicesAccessor } from "../../../../../platform/instantiation/common/instantiation.js"; import { IKeybindingService } from "../../../../../platform/keybinding/common/keybinding.service.js"; import { IHoverService } from "../../../../../platform/hover/browser/hover.service.js"; import { IVoiceSessionController } from "../voiceClient/voiceSessionController.service.js"; import { IMicCaptureService } from "../voiceClient/micCaptureService.service.js"; import { ITtsPlaybackService } from "../voiceClient/ttsPlaybackService.service.js"; import { IChatSpeechToTextService } from "../speechToText/chatSpeechToTextService.service.js"; import { VoiceInputMode } from "./voiceInputMode.js"; import { IVoiceInputModeService } from "./voiceInputMode.service.js"; /** * Menu placeholder action for the segmented voice input mode toggle. The actual UI is * rendered by {@link VoiceInputModeActionViewItem}; running the action is a no-op. */ export declare class ChatVoiceInputModeAction extends Action2 { static readonly ID = "workbench.action.chat.voiceInputMode"; constructor(); run(_accessor: ServicesAccessor): void; } /** * Hold-to-talk (walkie-talkie) keybinding for the segmented voice toggle. While the key * is held the microphone listens; releasing it ends the turn and sends. Holding also * interrupts the assistant to barge in. Works the same in hands-free and manual modes and * never disconnects. Auto-connects on the first hold so a single shortcut starts talking. */ export declare class ChatVoiceInputModeToggleListenAction extends Action2 { static readonly ID = "workbench.action.chat.voiceInputMode.holdToTalk"; private _holdActive; constructor(); run(accessor: ServicesAccessor): Promise; } export declare function registerVoiceInputModeSimulateActions(): void; /** * Optional host hooks for reusing {@link VoiceInputModeActionViewItem} outside the * main chat input (e.g. the agents-window new-session composer), where dictation and * voice must target that surface rather than the last focused chat widget. */ export interface IVoiceInputModePillOptions { /** Toggle dictation for the host surface (defaults to the shared toggle command). */ readonly toggleDictation?: () => void; /** Whether this is the focused or last-focused chat input that owns live state. */ readonly isActive?: IObservable; /** Whether the dictation session belongs to this input. Defaults to `isActive`. */ readonly isDictationActive?: IObservable; /** Whether the shared Voice Mode transport belongs to this input. */ readonly isVoiceActive?: IObservable; } /** * A single segmented control in the chat input that hosts Dictation and Voice Mode, * including the connected-session listen or mute control. Only one input mode can be * active at a time — activating one stops the other. */ export declare class VoiceInputModeActionViewItem extends BaseActionViewItem { private readonly _options; private readonly voiceInputModeService; private readonly voiceSessionController; private readonly commandService; private readonly configurationService; private readonly keybindingService; private readonly contextMenuService; private readonly hoverService; private readonly micCaptureService; private readonly ttsPlaybackService; private readonly chatSpeechToTextService; private readonly accessibilityService; private readonly themeService; private _reel; private _dictationCell; private _voiceCell; private _listenCell; private _muteCell; private _dictationIcon; private _listenIcon; private _muteIcon; private _voiceBars; private _voiceBarEls; private _barAnimationFrame; private _voiceHovering; private _voiceLive; private _barData; private _listenHoldTimer; private _listenHoldListening; private _listenHoldGesture; private _listenSuppressClick; private readonly _listenPointerUp; private readonly _dictationRing; private _getLabelWithKeybinding; private _getVoicePowerCommandId; private _updateAriaLabels; constructor(action: IAction, _options: IVoiceInputModePillOptions | undefined, voiceInputModeService: IVoiceInputModeService, voiceSessionController: IVoiceSessionController, commandService: ICommandService, configurationService: IConfigurationService, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, hoverService: IHoverService, micCaptureService: IMicCaptureService, ttsPlaybackService: ITtsPlaybackService, chatSpeechToTextService: IChatSpeechToTextService, accessibilityService: IAccessibilityService, themeService: IThemeService); /** Set the shared pill/waveform color from the theme-derived voice accent. */ private _updateVoiceStateColors; render(container: HTMLElement): void; /** Start or stop the audio-reactive bar loop based on live + hover state. */ private _syncBarAnimation; /** * Animate the waveform bars from live audio. Uses the mic analyser while listening * and the TTS analyser while the assistant speaks. When no analyser is available * (e.g. reduced motion or pre-capture), the CSS keyframe fallback drives the bars. */ private _startBarAnimation; private _stopBarAnimation; /** * Toggle built-in on-device dictation. By default this runs the shared * {@link DICTATION_TOGGLE_COMMAND_ID} command (which targets the last focused * chat widget); a host that isn't an `IChatWidget` (e.g. the agents-window * composer) can inject its own toggle via {@link IVoiceInputModePillOptions}. */ private _toggleDictation; /** * Activate a segmented cell from the keyboard. The cells live inside a toolbar's * `ActionBar`, whose key handler runs the (no-op) placeholder action on Enter/Space * and calls `preventDefault`/`stopPropagation`, which would otherwise swallow the * native button activation. Handle Enter/Space here and stop the event before it * bubbles to the ActionBar so the focused cell's own gesture runs. */ private _registerActivationKeys; private _onClickDictation; /** The voice button connects or disconnects; hands-free mode starts listening after connect. */ private _onClickVoicePowerToggle; /** Tap the listen cell to toggle listening on and off. */ private _onClickListen; private _onClickMute; /** Threshold (ms) separating a quick tap (toggle) from a press-and-hold (talk). */ private static readonly HOLD_THRESHOLD_MS; private _onListenPointerDown; private _endListenPointerHold; dispose(): void; } export declare function isVoiceInputModeAvailable(voiceInputModeService: IVoiceInputModeService): VoiceInputMode | "both" | undefined;