/** A discovered, connectable CDP endpoint on the local box. */ export type CdpEndpoint = { /** Loopback URL of the CDP HTTP endpoint, e.g. `http://127.0.0.1:9222`. */ url: string; /** The loopback port. */ port: number; /** Stable per-browser identity, parsed from `/devtools/browser/`. THE key. */ guid: string; /** Chrome product string from `/json/version` (e.g. `Chrome/126.0.0.0`), for the noise filter / display. */ product: string; /** Count of real page targets behind this endpoint (after the noise filter). */ pageCount: number; /** The first real page target's title (porthole label hint), if any. */ title?: string; }; type Fetcher = (url: string) => Promise<{ ok: boolean; status: number; json(): Promise; }>; type ExecScan = () => Promise; export type DiscoveryDeps = { /** Injectable for tests. Defaults to a short-timeout global fetch. */ fetch?: Fetcher; /** Injectable process scan returning raw `pid args` lines. Defaults to `ps -axww`. */ scanProcesses?: ExecScan; /** Read a `DevToolsActivePort` file (ephemeral-port recovery). Injectable for tests. */ readActivePort?: (userDataDir: string) => Promise; }; export type DiscoveryOptions = { /** Always-probe ports (the conventional :9222 plus any operator-configured set). */ ports: number[]; /** Also scan the process table for `--remote-debugging-port=` (default true). */ scanProcesses?: boolean; /** Ports to EXCLUDE — termfleet/lucarne's own owned endpoints (self-exclusion). */ excludePorts?: Iterable; /** Browser GUIDs to EXCLUDE — our own attach sessions + the sibling browser provider's. */ excludeGuids?: Iterable; }; /** Extract candidate ports from raw `ps` output, recovering ephemeral `=0` launches. */ export declare function candidatePortsFromProcesses(raw: string, readActivePort: (dir: string) => Promise): Promise; /** Parse the per-browser GUID out of a browser-level webSocketDebuggerUrl. */ export declare function browserGuidFromWsUrl(wsUrl: string): string | undefined; /** * Probe ONE candidate port: is it a connectable browser CDP endpoint with at least * one real page target? Returns the endpoint or undefined (not CDP / no pages / not a * browser / unreachable). Pure over the injected fetch. */ export declare function probeEndpoint(port: number, fetcher: Fetcher): Promise; /** * Discover all connectable, non-excluded, loopback CDP browser endpoints on the box. * Candidates = the configured port set ∪ ports scanned from the process table; each is * probed concurrently; self-excluded ports/GUIDs are dropped; results are deduped by * GUID (the same browser reachable on two candidate ports collapses to one). */ export declare function discoverCdpEndpoints(options: DiscoveryOptions, deps?: DiscoveryDeps): Promise; export {};