import type { Browser, Page } from "puppeteer-core"; /** * Allocate an unused TCP port on 127.0.0.1 by binding to port 0 and reading * back the kernel-assigned port. There's a small race between close and the * subsequent bind in the launched app, but Chromium's listener will retry. */ export declare function findFreeCdpPort(): Promise; /** Poll `${cdpUrl}/json/version` until it responds with 200, with abort + timeout support. */ export declare function waitForCdp(cdpUrl: string, timeoutMs: number, signal?: AbortSignal): Promise; /** * Pull a `--remote-debugging-port=` value out of an argv array (Chromium * accepts both `--flag=value` and `--flag value`). Returns null if absent or * malformed. */ export declare function findCdpPortInArgsForTest(args: string[]): number | null; export declare function findCdpAddressInArgsForTest(args: readonly string[]): string | null; export declare function isSafeCdpAddressForTest(address: string | null): boolean; export declare function argsMatchChromeProfileForTest(args: readonly string[], profile: { userDataDir: string; profileDirectory: string; }): boolean; export declare function findReusableCdp(exe: string, signal?: AbortSignal): Promise<{ cdpUrl: string; pid: number; } | null>; export interface RunningChromeProfile { pid: number; cdpUrl: string | null; unsafeCdpReason?: string; } export declare function findRunningChromeProfile(exe: string, profile: { userDataDir: string; profileDirectory: string; }, signal?: AbortSignal): Promise; interface ProfileProcessScanOptions { platform?: NodeJS.Platform; linuxPids?: readonly number[]; linuxExecutablePaths?: ReadonlyMap; signal?: AbortSignal; } export declare function findRunningChromeProfileForTest(exe: string, profile: { userDataDir: string; profileDirectory: string; }, options: ProfileProcessScanOptions): Promise; /** * Pick the best page target on an attached browser. Without a matcher, prefer * a page that doesn't look like a helper window (devtools, request handler, * background pages); with a matcher, return the first url+title substring hit. */ export declare function pickElectronTarget(browser: Browser, matcher?: string): Promise; /** * SIGTERM the process tree, wait briefly, then SIGKILL anything still alive. * Single-process variant for our own spawned children. */ export declare function gracefulKillTreeOnce(pid: number, gracePeriodMs?: number): Promise; /** * Multi-process variant for attach: find every PID running `executablePath` * (single-instance apps may keep an orphan around) and tear them all down. */ export declare function killExistingByPath(executablePath: string, signal?: AbortSignal): Promise; export {};