import { type FollowerToLeaderMessage } from './_shared/index.js'; /** A CDP target as returned by `/json/list`. */ export interface FederatedCdpInspectableTarget { id: string; type: string; title?: string; url: string; webSocketDebuggerUrl?: string; } /** Leader → follower CDP request (the `cdp.request` tray-sync variant). */ export interface FederatedCdpRequest { requestId: string; localTargetId: string; method: string; params?: Record; sessionId?: string; } /** * Build a `targets.advertise` message advertising the app's page targets to the * leader (which namespaces them into its aggregated `targets.registry`). Only * `page`-type targets are exposed — devtools/service-worker/etc. are not * driveable follower surfaces. `targetId` is the app's LOCAL CDP target id. */ export declare function buildTargetsAdvertise(runtimeId: string, targets: FederatedCdpInspectableTarget[]): Extract; /** * Translate a raw CDP result/error into the `cdp.response` message(s) to send * back to the leader. Delegates to the shared `sendCDPResponse` chunker so an * oversize result is split into `chunkData` frames the leader reassembles. */ export declare function buildCdpResponses(requestId: string, outcome: { result?: Record; error?: string; }): Array>; /** Translate a raw CDP event frame into a `cdp.event` tray-sync message. */ export declare function buildCdpEvent(frame: { method: string; params?: Record; sessionId?: string; }): Extract; /** * Connects to the attached app's raw CDP and relays tray-sync CDP messages * to/from a leader over an injected transport. Transparent: the leader manages * Target attachment / sessions itself (via forwarded `Target.*` requests), so * this servicer only maps `requestId ↔ CDP id` and translates envelopes. */ export declare class ElectronFederatedCdp { private readonly runtimeId; private readonly send; private ws; private nextCdpId; /** CDP frame id → leader requestId, for correlating responses. */ private readonly pending; constructor(options: { runtimeId: string; send: (message: FollowerToLeaderMessage) => void; }); /** Open the CDP connection to the browser-level debugger endpoint. */ connect(browserWebSocketDebuggerUrl: string): Promise; /** Advertise the app's page targets to the leader (from `/json/list`). */ advertiseTargets(targets: FederatedCdpInspectableTarget[]): void; /** Service one leader `cdp.request`: forward it to the app's CDP (preserving * `sessionId`) and correlate the eventual response by requestId. */ handleCdpRequest(request: FederatedCdpRequest): void; /** Close the CDP connection and reject any in-flight requests. */ stop(): void; private onCdpFrame; }