/** * CloakBrowser provider — anti-fingerprint Chromium with stealth capabilities. * * Manages CloakBrowser binary download, stealth launch, CDP connection, * keep-open process reuse, and temporary profile lifecycle. * * Ported from brocli's cloak.rs to TypeScript, using Playwright's connectOverCDP * to produce a standard Browser/BrowserContext pair. */ import { ChildProcess } from 'node:child_process'; import type { Browser, BrowserContext } from 'playwright-core'; import type { CloakBrowserConfig } from './types.js'; interface PlatformInfo { tag: string; chromiumVersion: string; archiveExt: string; executableRelativePath: string; fingerprintPlatform: string; /** * Expected SHA-256 of the downloaded archive (lowercase hex). Empty string = * verification opt-out for this platform; warned but not fatal. To populate: * download the archive once, run `shasum -a 256 `, paste here. */ expectedSha256: string; } /** Test-only: enumerate platform manifests. */ export declare function listCloakBrowserPlatforms(): PlatformInfo[]; /** Test-only: resolved download URLs for a platform manifest (proxy first). */ export declare function cloakBrowserArchiveDownloadUrls(platformInfo: PlatformInfo): string[]; /** Default CloakBrowser home: ~/.xopc/bin/cloakbrowser (chromium-v*, profiles/, …). */ export declare function defaultCloakBrowserCacheDir(): string; /** Resolve configured or default CloakBrowser cache root. */ export declare function resolveCloakBrowserCacheDir(configured?: string): string; export interface CloakBrowserLaunchResult { browser?: Browser; context?: BrowserContext; childProcess: ChildProcess | null; temporaryProfileDir: string | null; cdpPort: number; userDataDir: string; reused: boolean; pid: number | null; } /** Resolve the persistent profile directory agents use (not ephemeral temp dirs). */ export declare function resolveCloakBrowserPersistentProfileDir(config?: CloakBrowserConfig): string; export interface CloakBrowserRuntimeStatus { running: boolean; port: number; userDataDir: string; temporaryProfile: boolean; } /** Probe whether CloakBrowser CDP is listening on the configured keep-open port. */ export declare function probeCloakBrowserRuntime(config?: CloakBrowserConfig): Promise; /** * Launch or connect to a CloakBrowser instance and return a Playwright Browser + Context. */ export declare function launchCloakBrowser(config?: CloakBrowserConfig): Promise; /** * Cleanup a CloakBrowser session — kill process and remove temp profile if applicable. */ export declare function cleanupCloakBrowser(childProcess: ChildProcess | null, temporaryProfileDir: string | null): Promise; export interface CloakBrowserDoctorResult { installed: boolean; version: string | null; binaryPath: string | null; platform: string; cacheDir: string; expectedSha256: string; /** Primary URL the install flow would fetch from. */ downloadUrl: string; /** Fallback URLs (rendered as alternatives in the install confirm dialog). */ fallbackUrls: string[]; /** True when `binaryPath` was user-supplied (UI should surface a warning). */ customBinaryPath: boolean; } /** * Download (if needed), launch headlessly to verify, then return doctor status. * Used by gateway install endpoints and CLI. */ export declare function installCloakBrowser(config?: CloakBrowserConfig): Promise; /** Check CloakBrowser installation status. */ export declare function cloakBrowserDoctor(config?: CloakBrowserConfig): Promise; export {};