/** * Weavetab — tools/screenshot.ts * browser_screenshot: Capture the current tab as a base64 PNG using Page.captureScreenshot. * * Use this tool when you need pixel-level vision of the page — e.g. to verify a visual * result, read text in images, inspect canvas content, or confirm UI state that the DOM * tree cannot describe. Returns a data URL the AI can interpret visually by default. * * Do NOT use this as a replacement for browser_map — use browser_map first to interact * with elements. Use browser_screenshot only when visual confirmation is needed. * Weavetab by fy2ne */ import CDP from "chrome-remote-interface"; import type { Config } from "../config/loader.js"; export interface ScreenshotOptions { /** Capture format — "png" (lossless) or "jpeg" (smaller). Default: "png". */ format?: "png" | "jpeg"; /** JPEG quality 0–100. Only used when format is "jpeg". Default: 90. */ quality?: number; /** If true, captures the full scrollable page, not just the viewport. Default: false. */ fullPage?: boolean; /** Clip region {x, y, width, height, scale}. Overrides fullPage if set. */ clip?: { x: number; y: number; width: number; height: number; }; /** CSS selector of an element — capture is cropped to its bounding rect. */ selector?: string; /** If false, keeps the WeaveTab UI overlay visible during capture. * Default: true — overlay is always hidden from agent captures. */ hideOverlay?: boolean; } export type ScreenshotResult = { success: true; dataUrl: string; width: number; height: number; format: string; }; export declare function browserScreenshot(session: CDP.Client, options: ScreenshotOptions | undefined, _config: Config): Promise;