import type { Browser, CDPSession, Page, default as Puppeteer, Target } from "puppeteer-core"; export declare const DEFAULT_VIEWPORT: { width: number; height: number; deviceScaleFactor: number; }; /** * Per-CDP-message timeout applied to every puppeteer launch/connect. Set above * `TOOL_TIMEOUTS.browser.max` (30s) so the agent-side wall-clock is the canonical * limit; this constant only catches genuinely stuck CDP sockets (renderer wedged, * connection dropped, etc.). */ export declare const BROWSER_PROTOCOL_TIMEOUT_MS = 60000; export declare function loadPuppeteer(): Promise; export declare function loadPuppeteerInWorker(safeDir: string): Promise; /** Test seam: the browser launch overrides as resolved from trusted env. */ export declare function resolveBrowserEnvOverridesForTest(): { executablePath: string | undefined; proxy: string | undefined; proxyBypassLoopback: boolean; ignoreCertErrors: boolean; programFiles: string | undefined; programFilesX86: string | undefined; localAppData: string | undefined; }; /** True for a Microsoft Edge executable path (excluded from Chrome profile mode). */ export declare function isEdgeExecutable(candidate: string): boolean; /** True only for executable names owned by Google Chrome or Chromium. */ export declare function isChromeProfileExecutable(candidate: string): boolean; /** * Validate the executable identity used for profile mode. Most symlinks are * judged by their resolved target so a renamed cross-brand browser cannot pass * by alias. Snap's canonical `/snap/bin/chromium` launcher is the exception: * it resolves to the generic `/usr/bin/snap` dispatcher by design. */ export declare function isChromeProfileExecutableForLaunch(candidate: string, resolvedCandidate: string): boolean; /** * Installed Chrome/Chromium executable for saved-profile mode, or undefined when * none is present. Edge is excluded on purpose: a discovered Chrome user data * directory must never be opened by a different browser brand. */ export declare function resolveSystemChromeForProfile(): string | undefined; export interface LaunchHeadlessOptions { headless: boolean; viewport?: { width: number; height: number; deviceScaleFactor?: number; }; /** * Optional isolated warm-up profile directory (see profile-reuse.ts). When * set, the headless browser launches against this isolated copy of the user's * real Chrome profile so sessions inherit real cookies/storage/cache for * stronger stealth. Callers resolve this via resolveProfileReuse and MUST * pass an isolated copy, never a live profile dir. */ profileWarmupDir?: string; /** * Optional opt-in geo alignment (see settings browser.geo.*). When set, the * browser is launched with a matching timezone (TZ env) and/or UI language * (--lang) at the source. Default unset = strict no-op: the real environment * timezone/locale are preserved (never half-spoof). Only align these to a * coherent value (e.g. one matching a configured proxy egress). */ geo?: { timezone?: string; locale?: string; }; } export declare function launchHeadlessBrowser(opts: LaunchHeadlessOptions): Promise; export declare function applyViewport(page: Page, viewport?: { width: number; height: number; deviceScaleFactor?: number; }): Promise; export interface UserAgentOverride { userAgent: string; platform: string; acceptLanguage: string; userAgentMetadata: { brands: Array<{ brand: string; version: string; }>; fullVersion: string; platform: string; platformVersion: string; architecture: string; model: string; mobile: boolean; }; } export interface UserAgentSession { override: UserAgentOverride; browserSession: CDPSession | null; } /** Builds the browser-page stealth bootstrap source for regression tests. */ export declare function buildStealthInjectionScriptForTest(scripts?: readonly string[]): string; /** Apply stealth patches + UA override to a headless page. Idempotent within a tab. */ export declare function applyStealthPatches(browser: Browser, page: Page, state: { browserSession: CDPSession | null; override: UserAgentOverride | null; }, geo?: { readonly timezone?: string; readonly locale?: string; }): Promise; export declare function targetSupportsUserAgentOverrideForTest(target: Target): boolean; export declare function configureUserAgentTargetsForTest(browser: Browser, state: { browserSession: CDPSession | null; override: UserAgentOverride; }, targetTimeoutMs?: number): Promise;