/** * CDP (Chrome DevTools Protocol) handler for the Browser Agent tool. * Provides WebSocket endpoint for frontend to control Chrome tabs via CDP. * * Flow: * 1. Frontend connects to ws://localhost:48242/cdp?port=9222 * 2. Bridge connects to Chrome's CDP WebSocket * 3. Frontend sends commands (listTabs, screenshot, click, type, scroll) * 4. Bridge forwards to Chrome and returns results */ import WebSocket from 'ws'; export interface CdpTabInfo { targetId: string; title: string; url: string; active: boolean; } export interface CdpConnection { ws: WebSocket; cdpWs: WebSocket | null; port: number; tabs: CdpTabInfo[]; activeSessionId: string | null; } /** * Handle a new CDP WebSocket connection from the frontend. */ export declare function handleCdpConnection(clientWs: WebSocket, port: number): void;