export interface BrowserLease { file?: string; nonce: string; beginLaunch(): Promise; release(): Promise; } interface Receipt { protocol: 2; nonce: string; pid: number; start: string; state: 'reserved' | 'launching'; at: string; identity?: string; } /** Same world-pool sizing as the workspace helper (scripts/lib/headless-browser.mjs): min(cores x 0.5, (GB - 8) / 2.5), clamped to 2..8. * Measured 2026-10-10 on an M4 Max (16 cores, 128 GB) under normal agent load: 8 real WebGL world captures at once ran 26-30 fps, * 12 did not finish (7 of 12, 176 s, load 724). The workspace helper also has light and shared-context pools; this CLI only * launches world browsers, so only the world pool lives here. */ export declare function defaultBrowserCap(hw?: { cores: number; memGb: number; }): number; export declare function hostBrowserCap(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, hw?: { cores: number; memGb: number; }): number; interface ProcessRow { pid: number; ppid: number; start: string; command: string; } /** * Could a browser launched under this (dead) owner's receipt still be running? * A persistent launch records its profile as `identity`: any process holding that --user-data-dir * is the browser. Otherwise (Playwright's own temp profile) fall back to the only thing a dead * Playwright owner can leave behind: an orphaned (ppid 1) pipe-driven Chromium main process born * after the owner. Anything unmeasurable answers 'unknown', which keeps the lease. */ export declare function browserMayStillRun(owner: { identity?: string; start: string; }, procs?: ProcessRow[] | null): boolean | 'unknown'; export declare function slotIsStale(file: string, alive?: (pid: number) => boolean | 'unknown', birth?: (pid: number) => string, browser?: (owner: Receipt) => boolean | 'unknown'): { stale: boolean; raw: string | null; }; /** One unique lease per actual launch; callers must beginLaunch immediately before launching. */ export declare function acquireHostBrowserSlot(options?: { signal?: AbortSignal; identity?: string; }): Promise; /** Explicit lease only; there is no process-wide release that could free live browsers. */ export declare function releaseHostBrowserSlot(lease: BrowserLease): Promise; interface ManagedBrowser { close(...args: any[]): Promise; once?(event: any, listener: () => void): unknown; } /** Bind admission to actual teardown. A rejected close keeps the lease unless an * independent close/disconnected event confirms the browser is gone. */ export declare function bindBrowserLease(browser: T, lease: BrowserLease, event: 'close' | 'disconnected'): T; /** A launch rejection means Playwright completed its failed-launch cleanup. */ export declare function launchWithBrowserSlot(launch: () => Promise, event: 'close' | 'disconnected', options?: { signal?: AbortSignal; identity?: string; }): Promise; export {};