/** * OpenKernel — Browser Controller * * Default browser layer: Playwright. * Browser Worker → Browser Controller → DOM → Page → Events * * Playwright is an optional peer dependency. If unavailable, the controller * falls back to a fetch-based read-only mode (no JS execution, no events). * The worker handler detects which mode is active and adapts. */ import type { Artifact } from '../types.js'; export interface BrowserAction { type: 'navigate' | 'click' | 'type' | 'extract' | 'screenshot' | 'evaluate' | 'wait' | 'scroll'; selector?: string; url?: string; text?: string; script?: string; ms?: number; } export interface BrowserActionResult { ok: boolean; url?: string; title?: string; text?: string; html?: string; markdown?: string; screenshotPath?: string; error?: string; } export interface BrowserControllerOptions { headless?: boolean; /** Override browser choice; default chromium. */ browser?: 'chromium' | 'firefox' | 'webkit'; /** Default navigation timeout ms. */ timeoutMs?: number; /** Working directory for screenshots. */ screenshotDir?: string; } export declare class BrowserController { private playwright; private browser; private page; private mode; private opts; constructor(opts?: BrowserControllerOptions); init(): Promise; getMode(): 'playwright' | 'fetch' | 'unavailable'; runAction(action: BrowserAction): Promise; close(): Promise; private ensurePage; private runPlaywright; private runFetch; } export declare function htmlToMarkdown(html: string): string; export declare function stripHtml(html: string): string; export declare function extractTitle(html: string): string; export declare function actionArtifacts(results: BrowserActionResult[]): Artifact[];