/** * Extension Content Bridge * * Main bridge for content script communication with extension background script. * Handles sending user actions and receiving state updates from the extension. * * @packageDocumentation */ /** * Vowel state structure */ export interface VowelState { state: string; isListening: boolean; isSpeaking: boolean; isConnected: boolean; isAIThinking?: boolean; isActiveTab?: boolean; } /** * Transcript update structure */ export interface TranscriptUpdate { type: 'user' | 'agent'; text: string; isFinal: boolean; } /** * Bridge for content script communication with extension * * This class: * - Sends user actions to extension background script * - Receives state updates from extension * - Manages local UI state based on extension state * - Handles connection/disconnection with extension * * @example * ```typescript * const bridge = new ExtensionContentBridge(); * * // Listen to state updates * bridge.onStateUpdate((state) => { * console.log('New state:', state); * }); * * // Start session * await bridge.startSession(); * ``` */ export declare class ExtensionContentBridge { private stateListeners; private transcriptListeners; private errorListeners; private isConnected; constructor(); /** * Start a voice session via extension * * @param config - Optional configuration overrides * @throws Error if extension is not connected or fails to start session */ startSession(config?: any): Promise; /** * Stop the voice session * * @throws Error if extension is not connected or fails to stop session */ stopSession(): Promise; /** * Get current state from extension * * @returns Current Vowel state * @throws Error if extension is not connected or fails to get state */ getState(): Promise; /** * Update configuration * * @param config - Partial configuration to update * @throws Error if extension is not connected or fails to update config */ updateConfig(config: any): Promise; /** * Interrupt current agent action * * @throws Error if extension is not connected or fails to interrupt */ interrupt(): Promise; /** * Listen to state updates * * @param listener - Callback function for state updates * @returns Unsubscribe function * * @example * ```typescript * const unsubscribe = bridge.onStateUpdate((state) => { * console.log('State:', state); * }); * * // Later: unsubscribe() * ``` */ onStateUpdate(listener: (state: VowelState) => void): () => void; /** * Listen to transcript updates * * @param listener - Callback function for transcript updates * @returns Unsubscribe function */ onTranscriptUpdate(listener: (transcript: TranscriptUpdate) => void): () => void; /** * Listen to errors * * @param listener - Callback function for errors * @returns Unsubscribe function */ onError(listener: (error: Error) => void): () => void; /** * Check if connected to extension * * @returns True if connected */ isExtensionConnected(): boolean; /** * Setup message listener for extension messages */ private setupMessageListener; /** * Handle incoming messages from extension */ private handleMessage; /** * Check connection with extension * More resilient - side panel might not be open yet */ private checkConnection; } //# sourceMappingURL=ExtensionContentBridge.d.ts.map