/** * Browser runtime helpers for interactive login. * * Interactive login depends on Chromium DevTools Protocol interception, * so we prefer installed Chromium-based browsers (Edge/Chrome) and * fall back to Playwright's bundled Chromium when needed. */ import type { Browser, BrowserContext } from "playwright"; type LogFunction = (...arguments_: unknown[]) => void; type InteractiveBrowserChannel = "chrome" | "msedge"; export interface ChromiumBrowserLauncher { launch(options: { headless: false; channel?: InteractiveBrowserChannel; }): Promise; } export interface PersistentBrowserLauncher extends ChromiumBrowserLauncher { launchPersistentContext(userDataDir: string, options: { headless: false; channel?: InteractiveBrowserChannel; }): Promise; } export declare function getDefaultBrowserProfileDir(): string; export declare function getInteractiveBrowserChannels(platform?: NodeJS.Platform): InteractiveBrowserChannel[]; export declare function isMissingPlaywrightBrowserError(error: unknown): boolean; export declare function installBundledChromium(log: LogFunction): void; /** * Detect whether a browser launch error is caused by a locked profile * (Chromium exit code 21 or SingletonLock contention). */ export declare function isProfileLockError(error: unknown): boolean; /** * Attempt to remove a stale SingletonLock file from a browser profile. * Only removes the lock if the PID it references is not running. * Returns true if the lock was successfully cleaned. */ export declare function cleanStaleSingletonLock(profileDir: string, log: LogFunction): boolean; export declare function launchInteractiveBrowser(chromium: ChromiumBrowserLauncher, log: LogFunction, options?: { platform?: NodeJS.Platform; installBundledChromium?: (log: LogFunction) => void; }): Promise; export declare function launchInteractiveBrowserContext(chromium: PersistentBrowserLauncher, log: LogFunction, userDataDir: string, options?: { platform?: NodeJS.Platform; installBundledChromium?: (log: LogFunction) => void; }): Promise; export {}; //# sourceMappingURL=browser-runtime.d.ts.map