/** * Chrome launcher for the TeamShare debug browser. * * Spawns a Chrome/Chromium process with --remote-debugging-port for CDP * access. Used by BrowserSession/`browse` when autoLaunch is enabled. * * Lifecycle rule: the bridge NEVER closes this browser. It is launched * DETACHED (out of the launcher's Windows Job Object) so it also survives the * session process being killed, and `kill()` is a deliberate no-op once the * browser is up (see `surviveStop`). "Stop work" and session teardown leave * the window open; the human closes it (or runs `browser stop`). */ import { type ChildProcess } from 'node:child_process'; export interface ChromeInstance { port: number; process: ChildProcess; userDataDir: string; /** * True when the bridge must NEVER terminate this browser. The debug window * is the human's - they close it (or run `teamshare-agent browser stop`). */ surviveStop: boolean; kill: () => void; } export interface LaunchOptions { /** Port for CDP (default 9222). */ port?: number; /** Run in headless mode (default false: real persistent profile window). */ headless?: boolean; /** Custom user data dir (default: auto-generated temp dir). */ userDataDir?: string; /** * Keep the browser alive when the launching session ends (default true). * * The debug browser is a normal window the human may still be using - and * with `--auto-launch` it is a CHILD of the run process, so a plain session * teardown killed it. Pass `false` only for a throwaway instance the bridge * created for itself and genuinely owns. */ surviveStop?: boolean; /** * Startup page. Defaults to `about:blank` so the first tab is a real, * attachable `page` target - Chrome's default New Tab Page (`chrome://newtab`) * is excluded by the CDP tab picker and refuses to render in a scripted * profile, which made a freshly launched browser impossible to attach to. */ startUrl?: string; /** Extra Chrome CLI args. */ args?: string[]; /** Timeout to wait for Chrome to become reachable (ms, default 15000). */ timeoutMs?: number; } /** * Launch Chrome with CDP enabled. */ export declare function launchChrome(options?: LaunchOptions): Promise;