import { type BrowserContext } from 'playwright'; import type { BrowserStorageState } from './types.js'; /** Chromium flags for server-side headless operation (used by pool and standalone launches). */ export declare const CHROMIUM_ARGS: string[]; /** * Cloud Run NVIDIA L4 GPU launch flags for HEADLESS screenshot capture. Returns * null off Cloud Run (Vercel/local have no GPU → keep software rasterization). * * The clip path (Browser.forClipCapture) proves the L4 binds via ANGLE/Vulkan on * this image; screenshots don't need Xvfb (no ffmpeg x11grab), so we use Chromium * NEW headless (`--headless=new` — the OLD `--headless` has no GPU) and strip * Playwright's default `--headless` so the two don't clash. Verify the binding * with the `[gpu-check]` log below: "NVIDIA"/"ANGLE (NVIDIA…)" = hardware, * "SwiftShader"/"llvmpipe" = it fell back to software (then we'd need Xvfb). * The GPU accelerates page render/composite (the win for animated/blur-heavy * pages); the final PNG encode stays CPU-bound. */ export declare function resolveCloudGpuLaunch(): { args: string[]; ignoreDefaultArgs: string[]; } | null; declare class BrowserPool { private browser; private launchPromise; private captureCount; private activeContexts; private readonly queue; /** * Acquire an isolated browser context from the shared Chromium process. * Blocks until a slot is available if MAX_CONCURRENT is reached. */ acquireContext(viewport: { width: number; height: number; }, deviceScaleFactor?: number, options?: { lang?: string; colorScheme?: 'light' | 'dark'; storageState?: BrowserStorageState; extraHttpHeaders?: Record; blockAnalytics?: boolean; }): Promise; /** * Release a context back to the pool. Closes the context and unblocks * the next queued request. Triggers a periodic browser restart when idle. */ releaseContext(context: BrowserContext): Promise; private ensureBrowser; private launchBrowser; /** Read-only snapshot of pool state for monitoring. */ getStats(): { activeContexts: number; queueLength: number; captureCount: number; maxConcurrent: number; }; private restartBrowser; } /** Shared browser pool for server-side (web API) captures. */ export declare const browserPool: BrowserPool; export {};