import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { type SessionRowData, type SessionGroupData } from "./components/sessionListComponent.js"; import type { VoiceState, IPendingToolConfirmation, ITranscriptTurn } from "../../chat/browser/voiceClient/voiceSessionController.js"; export interface VoiceWidgetCallbacks { readonly copilotIconSrc: string; readonly hideDisconnect: boolean; connect(): void; disconnect(): void; pttDown(): void; pttUp(): void; closeWindow(): void; stopPlayback(): void; openSession(resource: URI): void; stopSession(resource: URI): void; cancelSession(resource: URI): void; /** Select a session as the transcription target. */ selectTargetSession(resource: URI | undefined): void; /** Create a new session and set it as transcription target. */ newSessionAsTarget(): void; getAnalyserNode(): AnalyserNode | null; onResize(): void; openPttKeySettings(): void; /** Optional — when provided, header renders a "popout" button. */ openPopout?(): void; /** Submit user feedback. Returns success/failure. */ submitFeedback(feedbackText: string): Promise<{ ok: boolean; error?: string; }>; /** Called when the user dismisses the onboarding card. */ onOnboardingCompleted?(): void; /** * Optional — when provided, the expand chevron opens this picker instead of * the inline session list. Used by the floating window to show the agent * sessions quickpick with a "set as voice target" action. */ showSessionsPicker?(): void; } /** * Host-configuration for the widget. Defaults match the floating aux-window * (the original consumer); the chatViewPane voice bar overrides everything. */ export interface VoiceWidgetOptions { /** Fixed pixel width (legacy aux-window behavior) or `'auto'` to flow. */ readonly width?: number | "auto"; /** Whether the header is a drag handle (aux window only). */ readonly draggable?: boolean; /** Show the close X in the header. */ readonly showClose?: boolean; /** Show the expand/collapse chevron + session list. */ readonly showExpandChevron?: boolean; /** Show the centered "Tap to start / Listening / Speaking" status label. */ readonly showStatusText?: boolean; /** * Show the working/needs-input/done counter rows and the "No active sessions" * placeholder. The speaking-session pill and tool confirmations remain * visible regardless, since they are important interactive context. */ readonly showStatusCounters?: boolean; /** Show the copilot icon at the start of the header. */ readonly showCopilotIcon?: boolean; /** Center the Connect button horizontally instead of pushing it to the right. */ readonly centerConnectButton?: boolean; /** Optional title rendered above the header row (e.g. "VOICE CHAT"). */ readonly title?: string; /** Optional subtitle rendered next to the title. */ readonly subtitle?: string; /** Set tabIndex=0 on the widget root and wire Space-key PTT. */ readonly focusable?: boolean; /** Whether to show the onboarding card (first-time experience). */ readonly showOnboarding?: boolean; /** * When true, the onboarding card re-appears every time the widget enters * a fully-disconnected state (i.e. not connected, not connecting, and not * auto-reconnecting). When false (default), onboarding follows the legacy * first-time-only behavior gated by ``showOnboarding`` + manual dismiss. */ readonly reshowOnboardingOnDisconnect?: boolean; /** * Initial expanded state of the widget — when true the session list and * expanded session details are shown by default. Defaults to false * (collapsed) to match the legacy floating aux-window behavior. */ readonly defaultExpanded?: boolean; /** * When true, renders the widget in a chat-input-box style layout: * a rounded bordered container for transcript/placeholder text with a * toolbar row below for action icons. Matches the chat panel input box * appearance. */ readonly inputBoxLayout?: boolean; } export declare class AgentsVoiceWidget extends Disposable { private readonly container; private readonly callbacks; private readonly _isConnected; private readonly _isConnecting; private readonly _isReconnecting; private readonly _voiceState; private readonly _expanded; private readonly _workingCount; private readonly _needsInputCount; private readonly _doneCount; private readonly _pendingToolConfirmations; private readonly _speakingSession; private readonly _speakingSessionLabel; private readonly _sessions; private readonly _sessionGroups; private readonly _selectedTargetSession; private readonly _transcriptTurns; private readonly _pttKeyLabel; private readonly _statusText; private readonly _popoutAvailable; private readonly _feedbackDialogState; private readonly _showOnboarding; private readonly _onboardingPendingConnect; private readonly _shouldShowExpanded; private readonly _headerComponent; private readonly _onboardingComponent; private readonly _feedbackDialogComponent; private readonly _voiceBarComponent; private readonly _transcriptComponent; private readonly _inputBoxTranscriptComponent; private readonly _statusRowsComponent; private readonly _sessionListComponent; private readonly _rootDiv; private readonly _glowDiv; private readonly _titleRow; private readonly _contentDiv; private readonly _statusTextDiv; private readonly _sessionListWrapper; private readonly _expandSpacer; private readonly _chevronWrapper; private readonly _chevronIcon; private readonly _inputBoxContainer; private readonly _inputBoxPlaceholder; private readonly _inputBoxToolbar; private readonly _inputBoxMicBtn; private readonly _inputBoxGearBtn; private readonly _inputBoxConnIndicator; private readonly _inputBoxFeedbackBtn; private readonly _inputBoxSessionsBtn; private readonly _inputBoxCloseBtn; private readonly _options; constructor(container: HTMLElement, callbacks: VoiceWidgetCallbacks, options?: VoiceWidgetOptions); private _updateDOM; private _updateDOMInputBoxLayout; private _updateDOMClassicLayout; setConnected(connected: boolean): void; setConnecting(connecting: boolean): void; setReconnecting(reconnecting: boolean): void; setVoiceState(state: VoiceState): void; setStatusCounts(working: number, needsInput: number, done: number): void; setPendingToolConfirmations(confirmations: readonly IPendingToolConfirmation[]): void; setSpeakingSession(session: URI | undefined, label: string | undefined): void; setSessions(sessions: readonly SessionRowData[]): void; setSelectedTargetSession(resource: URI | undefined): void; setSessionGroups(groups: readonly SessionGroupData[] | undefined): void; setPttKeyLabel(label: string | undefined): void; setTranscriptTurns(turns: readonly ITranscriptTurn[]): void; setStatusText(text: string): void; setPopoutAvailable(available: boolean): void; private _toggleFeedbackDialog; private _dismissOnboarding; /** * Externally trigger onboarding dismissal (e.g. when the user connects * from the floating mini-view, the main panel should drop the onboarding). * Also clears any in-flight pending-connect state so a later success * doesn't re-trigger the completion callback. */ dismissOnboarding(): void; private _submitFeedback; private _animationFrameId; private _startWaveformAnimation; private _stopWaveformAnimation; }