import WebSocket from "ws"; import { isLoopbackHost } from "../gateway/net.js"; import { type SsrFPolicy } from "../infra/net/ssrf.js"; export { isLoopbackHost }; /** * Returns true when the URL uses a WebSocket protocol (ws: or wss:). * Used to distinguish direct-WebSocket CDP endpoints * from HTTP(S) endpoints that require /json/version discovery. */ export declare function isWebSocketUrl(url: string): boolean; export declare function assertCdpEndpointAllowed(cdpUrl: string, ssrfPolicy?: SsrFPolicy): Promise; export declare function redactCdpUrl(cdpUrl: string | null | undefined): string | null | undefined; export type CdpSendFn = (method: string, params?: Record, sessionId?: string) => Promise; export declare function getHeadersWithAuth(url: string, headers?: Record): { [x: string]: string; }; export declare function appendCdpPath(cdpUrl: string, path: string): string; export declare function normalizeCdpHttpBaseForJsonEndpoints(cdpUrl: string): string; export declare function fetchJson(url: string, timeoutMs?: number, init?: RequestInit): Promise; export declare function fetchCdpChecked(url: string, timeoutMs?: number, init?: RequestInit): Promise; export declare function fetchOk(url: string, timeoutMs?: number, init?: RequestInit): Promise; export declare function openCdpWebSocket(wsUrl: string, opts?: { headers?: Record; handshakeTimeoutMs?: number; }): WebSocket; export declare function withCdpSocket(wsUrl: string, fn: (send: CdpSendFn) => Promise, opts?: { headers?: Record; handshakeTimeoutMs?: number; }): Promise;