{"version":3,"file":"extension.mjs","sources":["../../../lib/vowel/platforms/extension/messaging/ExtensionMessageProtocol.ts","../../../lib/vowel/platforms/extension/ExtensionMessageRouter.ts","../../../lib/vowel/platforms/extension/ExtensionStateSync.ts","../../../lib/vowel/platforms/extension/ExtensionVowelController.ts","../../../lib/vowel/platforms/extension/content/ExtensionContentBridge.ts","../../../lib/vowel/platforms/extension/content/components/ProxyFloatingCursor.tsx","../../../lib/vowel/platforms/extension/content/ContentScriptUI.tsx","../../../lib/vowel/platforms/extension/content/components/ProxyFloatingButton.tsx","../../../lib/vowel/platforms/extension/ExtensionConfig.ts","../../../lib/vowel/presets/extension.ts","../../../platforms/extension.ts"],"sourcesContent":["/**\n * Extension Message Protocol\n * \n * Utility functions for creating, sending, and handling extension messages.\n * \n * @packageDocumentation\n */\n\nimport type { ExtensionMessage, MessageResponse } from './ExtensionMessageTypes';\n\n/**\n * Generate unique message ID\n * \n * @returns Unique message ID string\n */\nexport function generateMessageId(): string {\n  return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n}\n\n/**\n * Create message with standard structure\n * \n * @param type - Message type\n * @param payload - Optional message payload\n * @param tabId - Optional tab identifier\n * @returns Structured message object\n * \n * @example\n * ```typescript\n * const message = createMessage('START_SESSION', { config: { appId: 'test' } });\n * ```\n */\nexport function createMessage<T extends ExtensionMessage>(\n  type: string,\n  payload?: any,\n  tabId?: number\n): T {\n  return {\n    type,\n    id: generateMessageId(),\n    timestamp: Date.now(),\n    tabId,\n    payload,\n  } as T;\n}\n\n/**\n * Send message with promise-based response\n * \n * Uses chrome.runtime.sendMessage with async/await pattern.\n * \n * @param message - Message to send\n * @returns Promise resolving to response\n * @throws Error if message sending fails or extension context is invalid\n * \n * @example\n * ```typescript\n * const response = await sendMessageWithResponse(message);\n * if (response.success) {\n *   console.log('Success:', response.data);\n * }\n * ```\n */\nexport async function sendMessageWithResponse<T = any>(\n  message: ExtensionMessage\n): Promise<T> {\n  return new Promise((resolve, reject) => {\n    // Check if chrome/browser runtime is available\n    if (typeof chrome === 'undefined' || !chrome.runtime) {\n      reject(new Error('Chrome runtime not available'));\n      return;\n    }\n\n    try {\n      chrome.runtime.sendMessage(message, (response) => {\n        if (chrome.runtime.lastError) {\n          reject(new Error(chrome.runtime.lastError.message));\n        } else {\n          resolve(response);\n        }\n      });\n    } catch (error) {\n      reject(error);\n    }\n  });\n}\n\n/**\n * Send message to specific tab\n * \n * @param tabId - Target tab ID\n * @param message - Message to send\n * @returns Promise resolving to response\n * @throws Error if tab is invalid or message fails\n * \n * @example\n * ```typescript\n * await sendMessageToTab(123, message);\n * ```\n */\nexport async function sendMessageToTab<T = any>(\n  tabId: number,\n  message: ExtensionMessage\n): Promise<T> {\n  return new Promise((resolve, reject) => {\n    if (typeof chrome === 'undefined' || !chrome.tabs) {\n      reject(new Error('Chrome tabs API not available'));\n      return;\n    }\n\n    try {\n      chrome.tabs.sendMessage(tabId, message, (response) => {\n        if (chrome.runtime.lastError) {\n          reject(new Error(chrome.runtime.lastError.message));\n        } else {\n          resolve(response);\n        }\n      });\n    } catch (error) {\n      reject(error);\n    }\n  });\n}\n\n/**\n * Broadcast message to all tabs\n * \n * @param message - Message to broadcast\n * @returns Promise resolving when all messages sent\n * \n * @example\n * ```typescript\n * await broadcastMessage(stateUpdate);\n * ```\n */\nexport async function broadcastMessage(message: ExtensionMessage): Promise<void> {\n  if (typeof chrome === 'undefined' || !chrome.tabs) {\n    throw new Error('Chrome tabs API not available');\n  }\n\n  const tabs = await chrome.tabs.query({});\n  \n  const sendPromises = tabs.map(async (tab) => {\n    if (tab.id) {\n      try {\n        await sendMessageToTab(tab.id, message);\n      } catch (error) {\n        // Content script might not be injected in this tab, ignore\n        console.debug(`Could not send message to tab ${tab.id}:`, error);\n      }\n    }\n  });\n\n  await Promise.all(sendPromises);\n}\n\n/**\n * Create success response\n * \n * @param data - Optional response data\n * @returns Success response object\n */\nexport function createSuccessResponse(data?: any): MessageResponse {\n  return {\n    success: true,\n    data,\n  };\n}\n\n/**\n * Create error response\n * \n * @param error - Error message or Error object\n * @returns Error response object\n */\nexport function createErrorResponse(error: string | Error): MessageResponse {\n  return {\n    success: false,\n    error: typeof error === 'string' ? error : error.message,\n  };\n}\n\n/**\n * Validate message structure\n * \n * @param message - Message to validate\n * @returns True if message is valid\n */\nexport function isValidMessage(message: any): message is ExtensionMessage {\n  return (\n    message &&\n    typeof message === 'object' &&\n    typeof message.type === 'string' &&\n    typeof message.id === 'string' &&\n    typeof message.timestamp === 'number'\n  );\n}\n\n/**\n * Check if running in extension context\n * \n * @returns True if in extension context (has chrome.runtime)\n */\nexport function isExtensionContext(): boolean {\n  return typeof chrome !== 'undefined' && !!chrome.runtime && !!chrome.runtime.id;\n}\n\n/**\n * Check if running in content script context\n * \n * @returns True if in content script (has chrome.runtime but not in background)\n */\nexport function isContentScriptContext(): boolean {\n  return (\n    isExtensionContext() &&\n    typeof window !== 'undefined' &&\n    window.location.protocol !== 'chrome-extension:'\n  );\n}\n\n/**\n * Check if running in background script context\n * \n * @returns True if in background script\n */\nexport function isBackgroundScriptContext(): boolean {\n  return (\n    isExtensionContext() &&\n    typeof chrome.tabs !== 'undefined' &&\n    typeof chrome.runtime.getBackgroundPage !== 'undefined'\n  );\n}\n\n","/**\n * Extension Message Router\n * \n * Routes messages from content scripts to appropriate handlers in the background script.\n * \n * @packageDocumentation\n */\n\nimport type {\n  ExtensionMessage,\n  StartSessionMessage,\n  StopSessionMessage,\n  // GetStateMessage,\n  UpdateConfigMessage,\n  SendUserMessageMessage,\n  // InterruptMessage,\n  // MessageResponse,\n} from './messaging/ExtensionMessageTypes';\nimport {\n  createSuccessResponse,\n  createErrorResponse,\n} from './messaging/ExtensionMessageProtocol';\nimport type { ExtensionVowelController } from './ExtensionVowelController';\n\n/**\n * Routes messages from content scripts to appropriate handlers\n * \n * @example\n * ```typescript\n * const router = new ExtensionMessageRouter(controller);\n * \n * chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {\n *   router.route(message, sender, sendResponse);\n *   return true;\n * });\n * ```\n */\nexport class ExtensionMessageRouter {\n  private controller: ExtensionVowelController;\n\n  constructor(controller: ExtensionVowelController) {\n    this.controller = controller;\n  }\n\n  /**\n   * Route incoming message to appropriate handler\n   * \n   * @param message - Incoming message\n   * @param sender - Message sender information\n   * @param sendResponse - Response callback function\n   */\n  async route(\n    message: ExtensionMessage,\n    sender: chrome.runtime.MessageSender,\n    sendResponse: (response?: any) => void\n  ): Promise<void> {\n    try {\n      switch (message.type) {\n        case 'START_SESSION':\n          await this.handleStartSession(message as StartSessionMessage, sender);\n          sendResponse(createSuccessResponse());\n          break;\n\n        case 'STOP_SESSION':\n          await this.handleStopSession(message as StopSessionMessage);\n          sendResponse(createSuccessResponse());\n          break;\n\n        case 'GET_STATE':\n          const state = this.handleGetState();\n          sendResponse(createSuccessResponse(state));\n          break;\n\n        case 'UPDATE_CONFIG':\n          await this.handleUpdateConfig(message as UpdateConfigMessage);\n          sendResponse(createSuccessResponse());\n          break;\n\n        case 'SEND_USER_MESSAGE':\n          await this.handleSendUserMessage(message as SendUserMessageMessage);\n          sendResponse(createSuccessResponse());\n          break;\n\n        case 'INTERRUPT':\n          await this.handleInterrupt();\n          sendResponse(createSuccessResponse());\n          break;\n\n        default:\n          console.warn('Unknown message type:', message.type);\n          sendResponse(createErrorResponse(`Unknown message type: ${message.type}`));\n      }\n    } catch (error) {\n      console.error('Error handling message:', error);\n      sendResponse(createErrorResponse(error as Error));\n    }\n  }\n\n  /**\n   * Handle START_SESSION message\n   */\n  private async handleStartSession(\n    message: StartSessionMessage,\n    sender: chrome.runtime.MessageSender\n  ): Promise<void> {\n    if (message.payload?.config) {\n      this.controller.updateConfig(message.payload.config);\n    }\n    await this.controller.startSession(sender.tab?.id);\n  }\n\n  /**\n   * Handle STOP_SESSION message\n   */\n  private async handleStopSession(_message: StopSessionMessage): Promise<void> {\n    await this.controller.stopSession();\n  }\n\n  /**\n   * Handle GET_STATE message\n   */\n  private handleGetState(): any {\n    return this.controller.getState();\n  }\n\n  /**\n   * Handle UPDATE_CONFIG message\n   */\n  private async handleUpdateConfig(message: UpdateConfigMessage): Promise<void> {\n    this.controller.updateConfig(message.payload.config);\n  }\n\n  /**\n   * Handle SEND_USER_MESSAGE message\n   */\n  private async handleSendUserMessage(\n    message: SendUserMessageMessage\n  ): Promise<void> {\n    // TODO: Implement if VowelClient supports sending text messages\n    console.log('Send user message:', message.payload.text);\n  }\n\n  /**\n   * Handle INTERRUPT message\n   */\n  private async handleInterrupt(): Promise<void> {\n    // TODO: Implement interrupt functionality in VowelClient\n    console.log('Interrupt requested');\n  }\n}\n\n","/**\n * Extension State Sync\n * \n * Synchronizes Vowel state to all active content scripts.\n * Handles broadcasting state updates, transcript updates, and errors.\n * \n * @packageDocumentation\n */\n\nimport {\n  createMessage,\n  sendMessageToTab,\n  broadcastMessage,\n} from './messaging/ExtensionMessageProtocol';\nimport type {\n  StateUpdateMessage,\n  TranscriptUpdateMessage,\n  ErrorMessage,\n  AudioPlaybackMessage,\n  ExtensionMessage,\n} from './messaging/ExtensionMessageTypes';\nimport type { ExtensionVowelController } from './ExtensionVowelController';\n\n/**\n * Synchronizes Vowel state to content scripts\n * \n * @example\n * ```typescript\n * const stateSync = new ExtensionStateSync(controller);\n * await stateSync.broadcastStateUpdate(state);\n * ```\n */\nexport class ExtensionStateSync {\n  private controller: ExtensionVowelController;\n\n  constructor(controller: ExtensionVowelController) {\n    this.controller = controller;\n  }\n\n  /**\n   * Broadcast state update to all content scripts\n   * \n   * @param state - Current Vowel state\n   */\n  async broadcastStateUpdate(state: any): Promise<void> {\n    console.log('controller', this.controller);\n    const message = createMessage<StateUpdateMessage>('STATE_UPDATE', {\n      state: state.state,\n      isListening: state.isListening,\n      isSpeaking: state.isSpeaking,\n      isConnected: state.isConnected,\n    });\n\n    await this.sendToAllContentScripts(message);\n  }\n\n  /**\n   * Broadcast transcript update\n   * \n   * @param transcript - Transcript data\n   */\n  async broadcastTranscriptUpdate(transcript: {\n    type: 'user' | 'agent';\n    text: string;\n    isFinal: boolean;\n  }): Promise<void> {\n    const message = createMessage<TranscriptUpdateMessage>('TRANSCRIPT_UPDATE', transcript);\n    await this.sendToAllContentScripts(message);\n  }\n\n  /**\n   * Broadcast error\n   * \n   * @param error - Error object or message\n   */\n  async broadcastError(error: Error | string): Promise<void> {\n    const message = createMessage<ErrorMessage>('ERROR', {\n      error: typeof error === 'string' ? error : error.message,\n      details: typeof error === 'object' ? error.stack : undefined,\n    });\n    await this.sendToAllContentScripts(message);\n  }\n\n  /**\n   * Broadcast audio playback event\n   * \n   * @param event - Playback event type\n   */\n  async broadcastAudioPlayback(event: 'started' | 'stopped'): Promise<void> {\n    const message = createMessage<AudioPlaybackMessage>('AUDIO_PLAYBACK', { event });\n    await this.sendToAllContentScripts(message);\n  }\n\n  /**\n   * Send message to specific tab\n   * \n   * @param tabId - Target tab ID\n   * @param message - Message to send\n   */\n  async sendToTab(tabId: number, message: ExtensionMessage): Promise<void> {\n    try {\n      await sendMessageToTab(tabId, message);\n    } catch (error) {\n      console.error(`Failed to send message to tab ${tabId}:`, error);\n    }\n  }\n\n  /**\n   * Send message to all tabs with content script\n   */\n  private async sendToAllContentScripts(message: ExtensionMessage): Promise<void> {\n    try {\n      await broadcastMessage(message);\n    } catch (error) {\n      console.error('Failed to broadcast message:', error);\n    }\n  }\n\n  /**\n   * Get active tab and send message to it\n   * \n   * @param message - Message to send\n   */\n  async sendToActiveTab(message: ExtensionMessage): Promise<void> {\n    try {\n      const activeTab = await this.getActiveTab();\n      if (activeTab?.id) {\n        await this.sendToTab(activeTab.id, message);\n      }\n    } catch (error) {\n      console.error('Failed to send message to active tab:', error);\n    }\n  }\n\n  /**\n   * Get the currently active tab\n   */\n  private async getActiveTab(): Promise<chrome.tabs.Tab | undefined> {\n    if (typeof chrome === 'undefined' || !chrome.tabs) {\n      return undefined;\n    }\n\n    const tabs = await chrome.tabs.query({ active: true, currentWindow: true });\n    return tabs[0];\n  }\n\n  /**\n   * Get all tabs\n   */\n  // private async getAllTabs(): Promise<chrome.tabs.Tab[]> {\n  //   if (typeof chrome === 'undefined' || !chrome.tabs) {\n  //     return [];\n  //   }\n\n  //   return await chrome.tabs.query({});\n  // }\n}\n\n","/**\n * Extension Vowel Controller\n * \n * Main controller that manages the Vowel client instance in the extension background script.\n * Handles initialization, message routing, and state synchronization to content scripts.\n * \n * @packageDocumentation\n */\n\nimport { Vowel } from '../../core/VowelClient';\nimport type { VowelClientConfig } from '../../types';\nimport { ExtensionMessageRouter } from './ExtensionMessageRouter';\nimport { ExtensionStateSync } from './ExtensionStateSync';\nimport { ExtensionNavigationAdapter } from './adapters/ExtensionNavigationAdapter';\nimport { ExtensionAutomationAdapter } from './adapters/ExtensionAutomationAdapter';\n\n/**\n * Main controller for Vowel instance in extension background script\n * \n * This controller:\n * - Manages a single Vowel client instance\n * - Routes messages from content scripts to appropriate handlers\n * - Broadcasts state updates to all listening content scripts\n * - Handles extension lifecycle (install, update, suspend)\n * \n * @example\n * ```typescript\n * const controller = new ExtensionVowelController({\n *   apiKey: 'vkey_public_xxx',\n *   systemInstruction: 'Custom instructions...',\n * });\n * \n * await controller.initialize();\n * ```\n */\nexport class ExtensionVowelController {\n  private vowelClient: Vowel | null = null;\n  private messageRouter: ExtensionMessageRouter;\n  private stateSync: ExtensionStateSync;\n  private config: VowelClientConfig;\n\n  constructor(config: VowelClientConfig) {\n    this.config = config;\n    this.messageRouter = new ExtensionMessageRouter(this);\n    this.stateSync = new ExtensionStateSync(this);\n    this.setupMessageListeners();\n    this.setupLifecycleHandlers();\n  }\n\n  /**\n   * Initialize the Vowel client with extension-specific adapters\n   */\n  async initialize(): Promise<void> {\n    console.log('🎤 Initializing Vowel controller in extension background');\n\n    const navigationAdapter = new ExtensionNavigationAdapter();\n    const automationAdapter = new ExtensionAutomationAdapter();\n\n    this.vowelClient = new Vowel({\n      ...this.config,\n      navigationAdapter,\n      automationAdapter,\n    });\n\n    // Subscribe to Vowel state changes and broadcast to content scripts\n    this.vowelClient.onStateChange((state) => {\n      // Broadcast state update (includes isListening, isSpeaking, isAIThinking, etc.)\n      this.stateSync.broadcastStateUpdate(this.getState());\n      \n      // Broadcast transcript updates if available\n      if (state.transcripts && state.transcripts.length > 0) {\n        const lastTranscript = state.transcripts[state.transcripts.length - 1];\n        this.stateSync.broadcastTranscriptUpdate({\n          type: lastTranscript.role === 'user' ? 'user' : 'agent',\n          text: lastTranscript.text,\n          isFinal: true,  // Transcripts in the state are final\n        });\n      }\n    });\n\n    console.log('✅ Vowel controller initialized successfully (with state sync)');\n  }\n\n  /**\n   * Start a voice session\n   * \n   * @param tabId - Optional tab ID to associate with session\n   */\n  async startSession(tabId?: number): Promise<void> {\n    if (!this.vowelClient) {\n      throw new Error('Vowel client not initialized');\n    }\n\n    console.log('Starting Vowel session' + (tabId ? ` for tab ${tabId}` : ''));\n    await this.vowelClient.startSession();\n\n    // Broadcast state update\n    await this.stateSync.broadcastStateUpdate(this.getState());\n  }\n\n  /**\n   * Stop the current voice session\n   */\n  async stopSession(): Promise<void> {\n    if (!this.vowelClient) {\n      console.warn('Vowel client not initialized, cannot stop session');\n      return;\n    }\n\n    console.log('Stopping Vowel session');\n    await this.vowelClient.stopSession();\n\n    // Broadcast state update\n    await this.stateSync.broadcastStateUpdate(this.getState());\n  }\n\n  /**\n   * Get current Vowel state\n   * \n   * @returns Current state object\n   */\n  getState(): any {\n    if (!this.vowelClient) {\n      return {\n        state: 'idle',\n        isListening: false,\n        isSpeaking: false,\n        isAIThinking: false,\n        isConnected: false,\n      };\n    }\n\n    // Get state from Vowel client's state manager\n    const clientState = this.vowelClient.state;\n    \n    return {\n      state: clientState.isConnected ? 'active' : 'idle',\n      isListening: clientState.isUserSpeaking || false,\n      isSpeaking: clientState.isAISpeaking || false,\n      isAIThinking: clientState.isAIThinking || false,  // AI executing tools/actions\n      isConnected: clientState.isConnected || false,\n    };\n  }\n\n  /**\n   * Update configuration\n   * \n   * @param config - Partial configuration to update\n   */\n  updateConfig(config: Partial<VowelClientConfig>): void {\n    this.config = { ...this.config, ...config };\n    \n    // If Vowel client exists, we might need to reinitialize or update it\n    // For now, just update our config\n    console.log('Configuration updated:', config);\n  }\n\n  /**\n   * Register a custom action that the AI can perform\n   * \n   * Forwards to the internal Vowel client's registerAction method\n   * \n   * @param name - Action name (will be used as tool name)\n   * @param definition - Action definition with parameters\n   * @param handler - Function to execute when action is called\n   * \n   * @example\n   * ```ts\n   * controller.registerAction('goToSite', {\n   *   description: 'Navigate to a website',\n   *   parameters: {\n   *     url: { type: 'string', description: 'URL to navigate to' }\n   *   }\n   * }, async ({ url }) => {\n   *   // Implementation\n   * });\n   * ```\n   */\n  registerAction<T = any>(\n    name: string,\n    definition: any,\n    handler: (params: T) => Promise<any>\n  ): void {\n    if (!this.vowelClient) {\n      console.error('❌ Cannot register action: Vowel client not initialized');\n      return;\n    }\n\n    this.vowelClient.registerAction(name, definition, handler);\n  }\n\n  /**\n   * Cleanup resources\n   */\n  async cleanup(): Promise<void> {\n    console.log('Cleaning up Vowel controller');\n    await this.stopSession();\n    this.vowelClient = null;\n  }\n\n  /**\n   * Get the Vowel client instance (for direct access if needed)\n   * \n   * @returns Vowel client instance or null\n   */\n  getVowelClient(): Vowel | null {\n    return this.vowelClient;\n  }\n\n  /**\n   * Setup message listeners from content scripts\n   */\n  private setupMessageListeners(): void {\n    if (typeof chrome === 'undefined' || !chrome.runtime) {\n      console.warn('Chrome runtime not available, cannot setup message listeners');\n      return;\n    }\n\n    chrome.runtime.onMessage.addListener(\n      (message, sender, sendResponse) => {\n        this.messageRouter.route(message, sender, sendResponse);\n        return true; // Keep channel open for async response\n      }\n    );\n\n    console.log('✅ Message listeners set up');\n  }\n\n  /**\n   * Setup extension lifecycle handlers\n   */\n  private setupLifecycleHandlers(): void {\n    if (typeof chrome === 'undefined' || !chrome.runtime) {\n      return;\n    }\n\n    // Handle extension install/update\n    chrome.runtime.onInstalled.addListener((details) => {\n      if (details.reason === 'install') {\n        console.log('Vowel extension installed');\n      } else if (details.reason === 'update') {\n        console.log('Vowel extension updated');\n      }\n    });\n\n    // Handle extension suspension (for MV3 service workers)\n    if ('onSuspend' in chrome.runtime) {\n      chrome.runtime.onSuspend.addListener(() => {\n        console.log('Extension suspending, cleaning up');\n        this.cleanup();\n      });\n    }\n\n    console.log('✅ Lifecycle handlers set up');\n  }\n}\n","/**\n * Extension Content Bridge\n * \n * Main bridge for content script communication with extension background script.\n * Handles sending user actions and receiving state updates from the extension.\n * \n * @packageDocumentation\n */\n\nimport {\n  createMessage,\n  sendMessageWithResponse,\n  isExtensionContext,\n} from '../messaging/ExtensionMessageProtocol';\nimport type {\n  StartSessionMessage,\n  StopSessionMessage,\n  GetStateMessage,\n  UpdateConfigMessage,\n  InterruptMessage,\n  StateUpdateMessage,\n  TranscriptUpdateMessage,\n  ErrorMessage,\n  ExtensionMessage,\n  MessageResponse,\n} from '../messaging/ExtensionMessageTypes';\n\n/**\n * Vowel state structure\n */\nexport interface VowelState {\n  state: string;\n  isListening: boolean;\n  isSpeaking: boolean;\n  isConnected: boolean;\n  isAIThinking?: boolean;  // AI is executing tools/actions\n  isActiveTab?: boolean;\n}\n\n/**\n * Transcript update structure\n */\nexport interface TranscriptUpdate {\n  type: 'user' | 'agent';\n  text: string;\n  isFinal: boolean;\n}\n\n/**\n * Bridge for content script communication with extension\n * \n * This class:\n * - Sends user actions to extension background script\n * - Receives state updates from extension\n * - Manages local UI state based on extension state\n * - Handles connection/disconnection with extension\n * \n * @example\n * ```typescript\n * const bridge = new ExtensionContentBridge();\n * \n * // Listen to state updates\n * bridge.onStateUpdate((state) => {\n *   console.log('New state:', state);\n * });\n * \n * // Start session\n * await bridge.startSession();\n * ```\n */\nexport class ExtensionContentBridge {\n  private stateListeners: Set<(state: VowelState) => void> = new Set();\n  private transcriptListeners: Set<(transcript: TranscriptUpdate) => void> = new Set();\n  private errorListeners: Set<(error: Error) => void> = new Set();\n  private isConnected: boolean = false;\n\n  constructor() {\n    this.setupMessageListener();\n    this.checkConnection();\n  }\n\n  /**\n   * Start a voice session via extension\n   * \n   * @param config - Optional configuration overrides\n   * @throws Error if extension is not connected or fails to start session\n   */\n  async startSession(config?: any): Promise<void> {\n    // Try to send message - will throw if extension context is invalid\n    const message = createMessage<StartSessionMessage>('START_SESSION', { config });\n    const response = await sendMessageWithResponse<MessageResponse>(message);\n    \n    if (!response.success) {\n      throw new Error(response.error || 'Failed to start session');\n    }\n  }\n\n  /**\n   * Stop the voice session\n   * \n   * @throws Error if extension is not connected or fails to stop session\n   */\n  async stopSession(): Promise<void> {\n    // Try to send message - will throw if extension context is invalid\n    const message = createMessage<StopSessionMessage>('STOP_SESSION');\n    const response = await sendMessageWithResponse<MessageResponse>(message);\n    \n    if (!response.success) {\n      throw new Error(response.error || 'Failed to stop session');\n    }\n  }\n\n  /**\n   * Get current state from extension\n   * \n   * @returns Current Vowel state\n   * @throws Error if extension is not connected or fails to get state\n   */\n  async getState(): Promise<VowelState> {\n    // Don't check isConnected here - we need this to work for the connection check itself\n    const message = createMessage<GetStateMessage>('GET_STATE');\n    const response = await sendMessageWithResponse<MessageResponse>(message);\n    \n    if (!response.success) {\n      throw new Error(response.error || 'Failed to get state');\n    }\n\n    return response.state;\n  }\n\n  /**\n   * Update configuration\n   * \n   * @param config - Partial configuration to update\n   * @throws Error if extension is not connected or fails to update config\n   */\n  async updateConfig(config: any): Promise<void> {\n    // Try to send message - will throw if extension context is invalid\n    const message = createMessage<UpdateConfigMessage>('UPDATE_CONFIG', { config });\n    const response = await sendMessageWithResponse<MessageResponse>(message);\n    \n    if (!response.success) {\n      throw new Error(response.error || 'Failed to update config');\n    }\n  }\n\n  /**\n   * Interrupt current agent action\n   * \n   * @throws Error if extension is not connected or fails to interrupt\n   */\n  async interrupt(): Promise<void> {\n    // Try to send message - will throw if extension context is invalid\n    const message = createMessage<InterruptMessage>('INTERRUPT');\n    const response = await sendMessageWithResponse<MessageResponse>(message);\n    \n    if (!response.success) {\n      throw new Error(response.error || 'Failed to interrupt');\n    }\n  }\n\n  /**\n   * Listen to state updates\n   * \n   * @param listener - Callback function for state updates\n   * @returns Unsubscribe function\n   * \n   * @example\n   * ```typescript\n   * const unsubscribe = bridge.onStateUpdate((state) => {\n   *   console.log('State:', state);\n   * });\n   * \n   * // Later: unsubscribe()\n   * ```\n   */\n  onStateUpdate(listener: (state: VowelState) => void): () => void {\n    this.stateListeners.add(listener);\n    return () => this.stateListeners.delete(listener);\n  }\n\n  /**\n   * Listen to transcript updates\n   * \n   * @param listener - Callback function for transcript updates\n   * @returns Unsubscribe function\n   */\n  onTranscriptUpdate(listener: (transcript: TranscriptUpdate) => void): () => void {\n    this.transcriptListeners.add(listener);\n    return () => this.transcriptListeners.delete(listener);\n  }\n\n  /**\n   * Listen to errors\n   * \n   * @param listener - Callback function for errors\n   * @returns Unsubscribe function\n   */\n  onError(listener: (error: Error) => void): () => void {\n    this.errorListeners.add(listener);\n    return () => this.errorListeners.delete(listener);\n  }\n\n  /**\n   * Check if connected to extension\n   * \n   * @returns True if connected\n   */\n  isExtensionConnected(): boolean {\n    return this.isConnected;\n  }\n\n  /**\n   * Setup message listener for extension messages\n   */\n  private setupMessageListener(): void {\n    if (!isExtensionContext()) {\n      console.warn('Not in extension context, message listener not available');\n      return;\n    }\n\n    chrome.runtime.onMessage.addListener(\n      (message: ExtensionMessage, _sender, sendResponse) => {\n        // Only handle messages that are specifically for the proxy UI bridge\n        // Messages like GET_PAGE_SNAPSHOT, SEARCH_ELEMENTS, etc. should be handled\n        // by the content script's main message listener, not this bridge\n        const bridgeMessageTypes = ['STATE_UPDATE', 'CURSOR_UPDATE', 'TRANSCRIPT_UPDATE'];\n        \n        if (bridgeMessageTypes.includes(message.type)) {\n          this.handleMessage(message);\n          sendResponse({ received: true });\n          return true;\n        }\n        \n        // For other message types, don't respond - let other listeners handle them\n        return false;\n      }\n    );\n  }\n\n  /**\n   * Handle incoming messages from extension\n   */\n  private handleMessage(message: ExtensionMessage): void {\n    switch (message.type) {\n      case 'STATE_UPDATE':\n        const stateMsg = message as StateUpdateMessage;\n        this.stateListeners.forEach(listener => listener(stateMsg.payload));\n        break;\n\n      case 'TRANSCRIPT_UPDATE':\n        const transcriptMsg = message as TranscriptUpdateMessage;\n        this.transcriptListeners.forEach(listener => listener(transcriptMsg.payload));\n        break;\n\n      case 'ERROR':\n        const errorMsg = message as ErrorMessage;\n        const error = new Error(errorMsg.payload.error);\n        this.errorListeners.forEach(listener => listener(error));\n        break;\n\n      case 'AUDIO_PLAYBACK':\n        // Handle audio playback events if needed\n        console.debug('Audio playback event:', message.payload);\n        break;\n\n      case 'TOOL_EXECUTION':\n        // Handle tool execution updates if needed\n        console.debug('Tool execution:', message.payload);\n        break;\n\n      default:\n        console.debug('Unhandled message type:', message.type);\n    }\n  }\n\n  /**\n   * Check connection with extension\n   * More resilient - side panel might not be open yet\n   */\n  private async checkConnection(): Promise<void> {\n    if (!isExtensionContext()) {\n      this.isConnected = false;\n      console.error('Not in extension context');\n      return;\n    }\n\n    try {\n      await this.getState();\n      this.isConnected = true;\n      console.log('✅ Connected to Vowel side panel');\n    } catch (error) {\n      this.isConnected = false;\n      console.warn('⚠️ Vowel side panel not responding (may not be open yet):', error);\n      console.log('💡 Open the extension side panel to activate voice control');\n      \n      // Retry connection after a delay\n      setTimeout(() => this.checkConnection(), 2000);\n    }\n  }\n}\n\n","/**\n * Proxy Floating Cursor\n * \n * Lightweight cursor component for content scripts that displays transcript\n * from the extension background script.\n * \n * @packageDocumentation\n */\n\nimport React, { useState, useEffect } from 'react';\nimport type { ExtensionContentBridge, TranscriptUpdate } from '../ExtensionContentBridge';\n\n/**\n * Props for ProxyFloatingCursor component\n */\nexport interface ProxyFloatingCursorProps {\n  /** Bridge instance for extension communication */\n  bridge: ExtensionContentBridge;\n  /** Custom class name */\n  className?: string;\n}\n\n/**\n * Proxy floating cursor for content script\n * \n * Displays transcript and cursor effects based on extension state.\n * Follows mouse cursor and shows real-time transcripts.\n * \n * @example\n * ```tsx\n * <ProxyFloatingCursor bridge={bridge} />\n * ```\n */\nexport const ProxyFloatingCursor: React.FC<ProxyFloatingCursorProps> = ({\n  bridge,\n  className,\n}) => {\n  const [transcript, setTranscript] = useState<string>('');\n  const [isVisible, setIsVisible] = useState(false);\n  const [cursorPosition, setCursorPosition] = useState({ x: 0, y: 0 });\n  const [transcriptType, setTranscriptType] = useState<'user' | 'agent'>('user');\n\n  useEffect(() => {\n    // Listen to transcript updates\n    const unsubscribeTranscript = bridge.onTranscriptUpdate((update: TranscriptUpdate) => {\n      setTranscript(update.text);\n      setTranscriptType(update.type);\n      setIsVisible(true);\n\n      if (update.isFinal) {\n        // Hide after delay for final transcripts\n        setTimeout(() => {\n          setIsVisible(false);\n          setTranscript('');\n        }, 3000);\n      }\n    });\n\n    // Listen to state updates for visibility\n    const unsubscribeState = bridge.onStateUpdate((state) => {\n      if (!state.isListening && !state.isSpeaking) {\n        setIsVisible(false);\n        setTranscript('');\n      }\n    });\n\n    // Track mouse position\n    const handleMouseMove = (e: MouseEvent) => {\n      setCursorPosition({ x: e.clientX, y: e.clientY });\n    };\n    window.addEventListener('mousemove', handleMouseMove);\n\n    return () => {\n      unsubscribeTranscript();\n      unsubscribeState();\n      window.removeEventListener('mousemove', handleMouseMove);\n    };\n  }, [bridge]);\n\n  if (!isVisible || !transcript) {\n    return null;\n  }\n\n  const bubbleColor = transcriptType === 'user' \n    ? 'rgba(102, 126, 234, 0.95)'  // Blue for user\n    : 'rgba(118, 75, 162, 0.95)';  // Purple for agent\n\n  return (\n    <div\n      className={`vowel-proxy-cursor ${className || ''}`}\n      style={{\n        position: 'fixed',\n        left: cursorPosition.x + 20,\n        top: cursorPosition.y + 20,\n        zIndex: 999998,\n        pointerEvents: 'none',\n        transition: 'opacity 0.3s ease',\n      }}\n    >\n      <div\n        className=\"vowel-proxy-cursor__bubble\"\n        style={{\n          padding: '12px 16px',\n          background: bubbleColor,\n          color: 'white',\n          borderRadius: '8px',\n          fontSize: '14px',\n          maxWidth: '300px',\n          wordWrap: 'break-word',\n          boxShadow: '0 4px 12px rgba(0, 0, 0, 0.3)',\n          position: 'relative',\n        }}\n      >\n        {/* Transcript type indicator */}\n        <div\n          style={{\n            position: 'absolute',\n            top: '-8px',\n            left: '12px',\n            padding: '2px 8px',\n            background: 'rgba(0, 0, 0, 0.2)',\n            borderRadius: '4px',\n            fontSize: '10px',\n            fontWeight: 'bold',\n            textTransform: 'uppercase',\n          }}\n        >\n          {transcriptType === 'user' ? '🎤 You' : '🤖 Agent'}\n        </div>\n\n        {/* Transcript text */}\n        <div style={{ marginTop: '4px' }}>\n          {transcript}\n        </div>\n      </div>\n    </div>\n  );\n};\n\n","/**\n * Content Script UI\n * \n * Main UI coordinator for content script that initializes and mounts\n * proxy UI components on the page using Shadow DOM.\n * \n * @packageDocumentation\n */\n\nimport React from 'react';\nimport { createRoot, type Root } from 'react-dom/client';\nimport { ExtensionContentBridge } from './ExtensionContentBridge';\n// import { ProxyFloatingButton } from './components/ProxyFloatingButton';\nimport { ProxyFloatingCursor } from './components/ProxyFloatingCursor';\nimport { BorderGlowManager } from '../../../ui/border-glow';\nimport { FloatingActionPillManager } from '../../../ui/FloatingActionPillManager';\nimport { ActionNotifier } from '../../../core/action-notifier';\nimport { isMobileOrTablet } from '../../../utils/device-detection';\n\n/**\n * Configuration for content script UI\n */\nexport interface ContentScriptUIConfig {\n  /** Button position on screen */\n  buttonPosition?: { x: number; y: number };\n  /** Whether to show connection status */\n  showConnectionStatus?: boolean;\n  /** Optional Vowel configuration */\n  vowelConfig?: any;\n}\n\n/**\n * Main UI coordinator for content script\n * \n * Initializes and mounts proxy UI components on the page using Shadow DOM\n * for style isolation.\n * \n * @example\n * ```typescript\n * const ui = new ContentScriptUI({\n *   buttonPosition: { x: 20, y: 20 },\n *   showConnectionStatus: true,\n * });\n * ```\n */\nexport class ContentScriptUI {\n  private bridge: ExtensionContentBridge;\n  private root: ShadowRoot | null = null;\n  private reactRoot: Root | null = null;\n  private container: HTMLElement | null = null;\n  private config: ContentScriptUIConfig;\n  private borderGlowManager: BorderGlowManager | null = null;\n  private actionPillManager: FloatingActionPillManager | null = null;\n\n  constructor(config: ContentScriptUIConfig = {}) {\n    this.config = config;\n    this.bridge = new ExtensionContentBridge();\n    this.initialize();\n  }\n\n  /**\n   * Initialize UI components\n   */\n  private initialize(): void {\n    console.log('config', this.config);\n    \n    // Initialize border glow (enabled by default in extension mode)\n    this.borderGlowManager = new BorderGlowManager({\n      enabled: true,\n      color: 'rgba(99, 102, 241, 0.5)',\n      intensity: 30,\n      pulse: true,\n    });\n    \n    // Initialize action pill if appropriate\n    const shouldShowPill = !isMobileOrTablet(); // Show on desktop by default in extension mode\n    if (shouldShowPill) {\n      this.actionPillManager = new FloatingActionPillManager({\n        enabled: true,\n        bottomOffset: 24,\n        autoHideDelay: 3000,\n        mobileOnly: false,\n      });\n      \n      // Subscribe to action notifier\n      const actionNotifier = ActionNotifier.getInstance();\n      actionNotifier.subscribe((notification) => {\n        if (this.actionPillManager) {\n          this.actionPillManager.show(notification);\n        }\n      });\n      \n      console.log('💊 [ContentScriptUI] Floating action pill initialized');\n    }\n    \n    // Listen for voice session state changes to show/hide border glow\n    // Only show when AI is actively thinking/acting, not just connected\n    this.bridge.onStateUpdate((state) => {\n      if (this.borderGlowManager) {\n        // Show border only when AI is actively thinking (executing tools/actions)\n        // or when AI is speaking (delivering response)\n        if (state.isAIThinking || state.isSpeaking) {\n          this.borderGlowManager.show();\n          console.log('✨ [ContentScriptUI] Border glow shown (AI is controlling)');\n        } else {\n          this.borderGlowManager.hide();\n          console.log('✨ [ContentScriptUI] Border glow hidden (AI idle)');\n        }\n      }\n    });\n    \n    // Create container element\n    this.container = document.createElement('div');\n    this.container.id = 'vowel-extension-ui';\n    document.body.appendChild(this.container);\n\n    // Create shadow root for style isolation\n    this.root = this.container.attachShadow({ mode: 'open' });\n\n    // Inject styles\n    this.injectStyles();\n\n    // Mount React components\n    this.mountComponents();\n\n    // Setup cleanup on page unload\n    window.addEventListener('beforeunload', () => {\n      this.cleanup();\n    });\n\n    console.log('✅ Vowel content script UI initialized (with border glow and action pill)');\n  }\n\n  /**\n   * Mount React components in shadow root\n   */\n  private mountComponents(): void {\n    if (!this.root) return;\n\n    const mountPoint = document.createElement('div');\n    this.root.appendChild(mountPoint);\n\n    // Create React root and render components\n    // NOTE: Only rendering floating cursor for now. The microphone button\n    // must be in the side panel for proper getUserMedia() user gesture handling.\n    this.reactRoot = createRoot(mountPoint);\n    this.reactRoot.render(\n      <React.StrictMode>\n        {/* Microphone button disabled - must be in side panel for mic permissions */}\n        {/* <ProxyFloatingButton\n          bridge={this.bridge}\n          config={this.config.vowelConfig}\n          position={this.config.buttonPosition}\n        /> */}\n        <ProxyFloatingCursor bridge={this.bridge} />\n      </React.StrictMode>\n    );\n\n    console.log('✅ Proxy UI components mounted (cursor only)');\n  }\n\n  /**\n   * Inject styles into shadow root\n   * Including critical Tailwind utilities for FloatingMicButton\n   */\n  private injectStyles(): void {\n    if (!this.root) return;\n\n    const styleElement = document.createElement('style');\n    styleElement.textContent = `\n      /* Base resets */\n      * { box-sizing: border-box; margin: 0; padding: 0; }\n      \n      :host {\n        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n        -webkit-font-smoothing: antialiased;\n      }\n\n      /* Critical Tailwind utilities for FloatingMicButton */\n      .relative { position: relative; }\n      .absolute { position: absolute; }\n      .inset-0 { inset: 0; }\n      .flex { display: flex; }\n      .items-center { align-items: center; }\n      .justify-center { justify-content: center; }\n      .rounded-2xl { border-radius: 1rem; }\n      .border-2 { border-width: 2px; }\n      .overflow-hidden { overflow: hidden; }\n      .pointer-events-none { pointer-events: none; }\n      .cursor-pointer { cursor: pointer; }\n      .text-white { color: white; }\n      .transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }\n      .duration-300 { transition-duration: 300ms; }\n      .ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }\n      .backdrop-blur-sm { backdrop-filter: blur(4px); }\n      .opacity-40 { opacity: 0.4; }\n      .bg-gradient-to-br { background-image: linear-gradient(to bottom right, var(--tw-gradient-stops)); }\n      .z-10 { z-index: 10; }\n\n      /* Animations */\n      @keyframes ping-effect {\n        75%, 100% { transform: scale(2); opacity: 0; }\n      }\n      .animate-ping-effect {\n        animation: ping-effect 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n      }\n      \n      @keyframes breathe {\n        0%, 100% { opacity: 0.5; }\n        50% { opacity: 0.8; }\n      }\n      .animate-breathe {\n        animation: breathe 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n      }\n\n      @keyframes vowel-fade-in {\n        from { opacity: 0; transform: translateY(10px); }\n        to { opacity: 1; transform: translateY(0); }\n      }\n\n      @keyframes vowel-fade-out {\n        from { opacity: 1; transform: translateY(0); }\n        to { opacity: 0; transform: translateY(-10px); }\n      }\n    `;\n    this.root.appendChild(styleElement);\n  }\n\n  /**\n   * Cleanup resources\n   */\n  cleanup(): void {\n    console.log('Cleaning up Vowel content script UI');\n\n    // Cleanup border glow manager\n    if (this.borderGlowManager) {\n      this.borderGlowManager.hide();\n      this.borderGlowManager = null;\n    }\n\n    // Cleanup action pill manager\n    if (this.actionPillManager) {\n      // Note: FloatingActionPillManager doesn't have a destroy method yet,\n      // but we can just null it and let React cleanup handle it\n      this.actionPillManager = null;\n    }\n\n    if (this.reactRoot) {\n      this.reactRoot.unmount();\n      this.reactRoot = null;\n    }\n\n    if (this.container && this.container.parentNode) {\n      this.container.parentNode.removeChild(this.container);\n      this.container = null;\n    }\n\n    this.root = null;\n    // Note: ExtensionContentBridge doesn't require cleanup as it only has listeners\n  }\n\n  /**\n   * Get bridge instance for external access\n   * \n   * @returns Extension content bridge\n   */\n  getBridge(): ExtensionContentBridge {\n    return this.bridge;\n  }\n\n  /**\n   * Check if UI is initialized\n   * \n   * @returns True if initialized\n   */\n  isInitialized(): boolean {\n    return this.root !== null && this.reactRoot !== null;\n  }\n}\n","/**\n * Proxy Floating Button\n * \n * Uses the real FloatingMicButton component and proxies interactions\n * to the extension's side panel.\n * \n * @packageDocumentation\n */\n\nimport React, { useState, useEffect } from 'react';\nimport { FloatingMicButton } from '../../../../components/FloatingMicButton';\nimport type { ExtensionContentBridge, VowelState } from '../ExtensionContentBridge';\n\n/**\n * Props for ProxyFloatingButton component\n */\nexport interface ProxyFloatingButtonProps {\n  /** Bridge instance for extension communication */\n  bridge: ExtensionContentBridge;\n  /** Button position on screen */\n  position?: { x: number; y: number };\n  /** Optional configuration */\n  config?: any;\n  /** Custom class name */\n  className?: string;\n}\n\n/**\n * Proxy floating button for content script\n * \n * This uses the real FloatingMicButton component with state from the extension.\n * It forwards all interactions to the extension's side panel via the bridge.\n * \n * @example\n * ```tsx\n * <ProxyFloatingButton \n *   bridge={bridge}\n *   position={{ x: 20, y: 20 }}\n * />\n * ```\n */\nexport const ProxyFloatingButton: React.FC<ProxyFloatingButtonProps> = ({\n  bridge,\n  position = { x: 20, y: 20 },\n  config,\n  className,\n}) => {\n  const [state, setState] = useState<VowelState | null>(null);\n  const [isConnected, setIsConnected] = useState(false);\n  const [error, setError] = useState<string | null>(null);\n\n  useEffect(() => {\n    // Check connection status\n    setIsConnected(bridge.isExtensionConnected());\n\n    // Load initial state\n    if (bridge.isExtensionConnected()) {\n      bridge.getState()\n        .then(setState)\n        .catch(err => {\n          console.error('Failed to get initial state:', err);\n          setError('Failed to connect');\n        });\n    }\n\n    // Listen to state updates\n    const unsubscribeState = bridge.onStateUpdate((newState) => {\n      setState(newState);\n      setError(null);\n    });\n\n    // Listen to errors\n    const unsubscribeError = bridge.onError((err) => {\n      console.error('Extension error:', err);\n      setError(err.message);\n    });\n\n    return () => {\n      unsubscribeState();\n      unsubscribeError();\n    };\n  }, [bridge]);\n\n  const handleClick = async () => {\n    if (!isConnected) {\n      alert('Vowel extension is not connected. Please check your extension.');\n      return;\n    }\n\n    try {\n      if (state?.isListening) {\n        await bridge.stopSession();\n      } else {\n        await bridge.startSession(config);\n      }\n    } catch (error) {\n      console.error('Failed to toggle session:', error);\n      setError(error instanceof Error ? error.message : 'Failed to toggle session');\n    }\n  };\n\n  // Map extension state to FloatingMicButton props\n  const isSessionActive = state?.state === 'active';\n  const isUserSpeaking = state?.isListening || false;\n  const isAiSpeaking = state?.isSpeaking || false;\n\n  // Determine button title\n  const getTitle = () => {\n    if (!isConnected) return 'Extension not connected';\n    if (isAiSpeaking) return 'Agent is speaking';\n    if (isUserSpeaking) return 'Stop voice session';\n    return 'Start voice session';\n  };\n\n  return (\n    <div\n      style={{\n        position: 'fixed',\n        left: position.x,\n        bottom: position.y,\n        zIndex: 999999,\n      }}\n    >\n      <FloatingMicButton\n        isConnected={isConnected && isSessionActive}\n        isConnecting={false}\n        isDisconnecting={false}\n        isUserSpeaking={isUserSpeaking}\n        isAiSpeaking={isAiSpeaking}\n        isAiThinking={false}\n        onClick={handleClick}\n        title={getTitle()}\n        inline={true}\n        className={className}\n      />\n\n      {/* Error message */}\n      {error && (\n        <div\n          style={{\n            marginTop: '8px',\n            padding: '8px 12px',\n            background: '#ff4444',\n            color: 'white',\n            borderRadius: '4px',\n            fontSize: '12px',\n            whiteSpace: 'nowrap',\n            boxShadow: '0 2px 8px rgba(0, 0, 0, 0.2)',\n          }}\n        >\n          {error}\n        </div>\n      )}\n\n      {/* Connection warning */}\n      {!isConnected && (\n        <div\n          style={{\n            marginTop: '8px',\n            padding: '8px 12px',\n            background: '#ff9800',\n            color: 'white',\n            borderRadius: '4px',\n            fontSize: '12px',\n            whiteSpace: 'nowrap',\n            boxShadow: '0 2px 8px rgba(0, 0, 0, 0.2)',\n          }}\n        >\n          Extension not connected\n        </div>\n      )}\n    </div>\n  );\n};\n","/**\n * Extension Platform Configuration\n * \n * Configuration types specific to the extension platform mode.\n * \n * @packageDocumentation\n */\n\nimport type { VowelClientConfig } from '../../types';\n\n/**\n * Configuration specific to extension platform\n */\nexport interface ExtensionConfig extends VowelClientConfig {\n  /**\n   * State synchronization options\n   */\n  stateSync?: {\n    /**\n     * Whether to broadcast state updates to all tabs\n     * @default true\n     */\n    broadcastToAllTabs?: boolean;\n\n    /**\n     * Whether to persist session across page navigations\n     * @default true\n     */\n    persistSession?: boolean;\n\n    /**\n     * Tab IDs to exclude from broadcasts\n     */\n    excludeTabs?: number[];\n  };\n\n  /**\n   * Content script UI options\n   */\n  contentScriptUI?: {\n    /**\n     * Whether to automatically mount UI on page load\n     * @default true\n     */\n    autoMount?: boolean;\n\n    /**\n     * Button position on page\n     */\n    buttonPosition?: { x: number; y: number };\n\n    /**\n     * Whether to show connection status\n     * @default true\n     */\n    showConnectionStatus?: boolean;\n\n    /**\n     * Whether to show floating cursor with transcripts\n     * @default true\n     */\n    showFloatingCursor?: boolean;\n  };\n\n  /**\n   * Extension-specific permissions required\n   */\n  permissions?: {\n    /**\n     * Required for microphone access\n     * @default true\n     */\n    microphone?: boolean;\n\n    /**\n     * Required for active tab automation\n     * @default true\n     */\n    activeTab?: boolean;\n\n    /**\n     * Required for all tabs automation\n     * @default false\n     */\n    allTabs?: boolean;\n  };\n}\n\n/**\n * Default extension configuration\n */\nexport const defaultExtensionConfig: Partial<ExtensionConfig> = {\n  stateSync: {\n    broadcastToAllTabs: true,\n    persistSession: true,\n    excludeTabs: [],\n  },\n  contentScriptUI: {\n    autoMount: true,\n    buttonPosition: { x: 20, y: 20 },\n    showConnectionStatus: true,\n    showFloatingCursor: true,\n  },\n  permissions: {\n    microphone: true,\n    activeTab: true,\n    allTabs: false,\n  },\n};\n\n","/**\n * Extension Platform Preset\n * \n * Preset configuration for the extension platform mode.\n * \n * @packageDocumentation\n */\n\nimport { ExtensionNavigationAdapter } from '../platforms/extension/adapters/ExtensionNavigationAdapter';\nimport { ExtensionAutomationAdapter } from '../platforms/extension/adapters/ExtensionAutomationAdapter';\nimport type { ExtensionConfig } from '../platforms/extension/ExtensionConfig';\nimport { defaultExtensionConfig } from '../platforms/extension/ExtensionConfig';\n\n/**\n * Preset configuration for extension platform\n * \n * This preset configures Vowel to run in an extension background script,\n * with lightweight proxy UI injected into content scripts.\n * \n * Features:\n * - Bypasses CSP restrictions\n * - Persists across page navigations\n * - Lightweight proxy UI on pages\n * - Background script handles all voice processing\n * \n * @example\n * ```typescript\n * import { extensionPreset } from '@vowel.to/client/presets/extension';\n * \n * const config = {\n *   ...extensionPreset,\n *   appId: 'your-app-id',\n * };\n * ```\n */\nexport const extensionPreset: Partial<ExtensionConfig> = {\n  ...defaultExtensionConfig,\n  \n  // Use extension-specific adapters\n  navigationAdapter: new ExtensionNavigationAdapter(),\n  automationAdapter: new ExtensionAutomationAdapter(),\n  \n  // Extension-specific settings\n  stateSync: {\n    broadcastToAllTabs: true,\n    persistSession: true,\n  },\n  \n  // Audio configuration optimized for extension\n  // @ts-ignore - audio is not defined in the type ExtensionConfig\n  audio: {\n    echoCancellation: true,\n    noiseSuppression: true,\n    autoGainControl: true,\n  },\n  \n  // Use ML-based VAD for better quality\n  vad: {\n    type: 'silero',\n    threshold: 0.5,\n  },\n};\n\n","/**\n * Extension Platform Entry Point\n * \n * Main entry point for the extension platform mode.\n * Provides initialization functions and exports for both background scripts\n * and content scripts.\n * \n * @packageDocumentation\n * \n * @example\n * Background script usage:\n * ```typescript\n * import { initializeExtensionVowel } from '@vowel.to/client/platforms/extension';\n * \n * const controller = await initializeExtensionVowel({\n *   appId: 'your-app-id',\n *   apiKey: 'your-api-key',\n * });\n * ```\n * \n * @example\n * Content script usage:\n * ```typescript\n * import { initializeContentScriptUI } from '@vowel.to/client/platforms/extension';\n * \n * const ui = initializeContentScriptUI({\n *   buttonPosition: { x: 20, y: 20 },\n * });\n * ```\n */\n\n// Export background script components\nexport { ExtensionVowelController } from '../lib/vowel/platforms/extension/ExtensionVowelController';\nexport { ExtensionMessageRouter } from '../lib/vowel/platforms/extension/ExtensionMessageRouter';\nexport { ExtensionStateSync } from '../lib/vowel/platforms/extension/ExtensionStateSync';\n\n// Export content script components\nexport { ExtensionContentBridge } from '../lib/vowel/platforms/extension/content/ExtensionContentBridge';\nexport { ContentScriptUI } from '../lib/vowel/platforms/extension/content/ContentScriptUI';\nexport { ProxyFloatingButton } from '../lib/vowel/platforms/extension/content/components/ProxyFloatingButton';\nexport { ProxyFloatingCursor } from '../lib/vowel/platforms/extension/content/components/ProxyFloatingCursor';\n\n// Export adapters\nexport { ExtensionNavigationAdapter } from '../lib/vowel/platforms/extension/adapters/ExtensionNavigationAdapter';\nexport { ExtensionAutomationAdapter } from '../lib/vowel/platforms/extension/adapters/ExtensionAutomationAdapter';\n\n// Export preset and configuration\nexport { extensionPreset } from '../lib/vowel/presets/extension';\nexport { EXTENSION_PRESET } from '../lib/vowel/presets';\nexport type { ExtensionConfig } from '../lib/vowel/platforms/extension/ExtensionConfig';\nexport { defaultExtensionConfig } from '../lib/vowel/platforms/extension/ExtensionConfig';\n\n// Export types\nexport type {\n  ExtensionMessage,\n  ContentToBackgroundMessage,\n  BackgroundToContentMessage,\n  StartSessionMessage,\n  StopSessionMessage,\n  GetStateMessage,\n  UpdateConfigMessage,\n  StateUpdateMessage,\n  TranscriptUpdateMessage,\n  ErrorMessage,\n  MessageResponse,\n} from '../lib/vowel/platforms/extension/messaging/ExtensionMessageTypes';\n\n// Export protocol utilities\nexport {\n  generateMessageId,\n  createMessage,\n  sendMessageWithResponse,\n  sendMessageToTab,\n  broadcastMessage,\n  createSuccessResponse,\n  createErrorResponse,\n  isValidMessage,\n  isExtensionContext,\n  isContentScriptContext,\n  isBackgroundScriptContext,\n} from '../lib/vowel/platforms/extension/messaging/ExtensionMessageProtocol';\n\nimport { ExtensionVowelController } from '../lib/vowel/platforms/extension/ExtensionVowelController';\nimport { ContentScriptUI } from '../lib/vowel/platforms/extension/content/ContentScriptUI';\nimport { extensionPreset } from '../lib/vowel/presets/extension';\nimport type { ExtensionConfig } from '../lib/vowel/platforms/extension/ExtensionConfig';\n\n/**\n * Initialize Vowel controller in extension background script\n * \n * This function creates and initializes a Vowel controller instance\n * with extension-specific adapters and configuration.\n * \n * @param config - Extension configuration\n * @returns Initialized Vowel controller\n * \n * @example\n * ```typescript\n * // In extension background.ts\n * import { initializeExtensionVowel } from '@vowel.to/client/platforms/extension';\n * \n * const controller = await initializeExtensionVowel({\n *   appId: 'your-app-id',\n *   apiKey: 'your-api-key',\n *   systemInstruction: 'Custom instructions...',\n * });\n * \n * // Controller is now ready and listening for messages from content scripts\n * console.log('Vowel controller initialized');\n * ```\n */\nexport async function initializeExtensionVowel(\n  config: ExtensionConfig\n): Promise<ExtensionVowelController> {\n  console.log('🎤 Initializing Vowel in extension background');\n\n  const controller = new ExtensionVowelController({\n    ...extensionPreset,\n    ...config,\n  });\n\n  await controller.initialize();\n\n  console.log('✅ Vowel extension controller ready');\n\n  return controller;\n}\n\n/**\n * Initialize content script UI on web page\n * \n * This function creates and mounts the proxy UI components\n * (floating button and cursor) on the current page.\n * \n * @param config - Optional configuration for content script UI\n * @returns ContentScriptUI instance\n * \n * @example\n * ```typescript\n * // In extension content script\n * import { initializeContentScriptUI } from '@vowel.to/client/platforms/extension';\n * \n * const ui = initializeContentScriptUI({\n *   buttonPosition: { x: 20, y: 20 },\n *   showConnectionStatus: true,\n * });\n * \n * // UI is now mounted on the page\n * // Users can click the button to start/stop voice sessions\n * ```\n */\nexport function initializeContentScriptUI(\n  config?: Partial<ExtensionConfig['contentScriptUI']>\n): ContentScriptUI {\n  console.log('🎤 Initializing Vowel content script UI');\n\n  const ui = new ContentScriptUI(config);\n\n  console.log('✅ Vowel content script UI ready');\n\n  return ui;\n}\n\n"],"names":["error","ExtensionVowelController","extensionPreset","ContentScriptUI"],"mappings":";;;;;;;;;;AAeO,SAAS,iBAAA,GAA4B;AAC1C,EAAA,OAAO,CAAA,EAAG,IAAA,CAAK,GAAA,EAAK,IAAI,IAAA,CAAK,MAAA,EAAO,CAAE,QAAA,CAAS,EAAE,CAAA,CAAE,MAAA,CAAO,CAAA,EAAG,CAAC,CAAC,CAAA,CAAA;AACjE;AAeO,SAAS,aAAA,CACd,IAAA,EACA,O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