/** * Weavetab — cdp/connector.ts * CDP connection pool, browser launch, per-tab session wiring. * V3: Two-factor lock validation, networkIdle with 5s fallback, SIGTERM cleanup. * Weavetab by fy2ne */ import CDP from "chrome-remote-interface"; import type { Config } from "../config/loader.js"; export declare function getPort(): number | null; export declare function getActiveEngine(): import("../config/loader.js").BrowserEngine; export interface BrowserClient { session: CDP.Client; targetId: string; url: string; title: string; overlayScriptId?: string; overlayInstalled: boolean; agentId: string; browserContextId?: string; appName?: string; isElectron?: boolean; /** Sticky pruning state: if true, all subsequent DOM reads by action tools (click, type, etc.) will also apply pruning. */ pruneActive?: boolean; /** Port the CDP session is connected to */ port?: number; } export declare function getOrConnect(config: Config, targetApp?: string): Promise; export declare function getTabList(agentId?: string, targetApp?: string): Promise; export declare function connectToTab(targetId: string, port?: number, agentId?: string, browserContextId?: string, appName?: string): Promise; /** * Cancel analytics intervals and close the CDP WebSocket sessions without * touching the browser process. Safe to call in server mode — the browser * remains alive for the next client. */ export declare function cleanupIntervals(): Promise; /** * Full cleanup: intervals + WebSocket sessions + Browser.close(). * Only safe to call when the browser should also be terminated (non-server mode, * SIGINT, SIGTERM, explicit user-requested shutdown). */ export declare function cleanupAll(): Promise;