import type { PortableTool } from "../portable-tool.js";
export declare const BROWSER_TOOL_NAME: "browser";
export type BrowserAction = "navigate" | "click" | "type" | "scroll" | "snapshot" | "screenshot" | "console" | "cdp";
export interface BrowserToolParams {
    /** Browser action to perform */
    action: BrowserAction;
    /** URL for navigate action */
    url?: string;
    /** Element reference (e.g. "@e5") for click/type actions */
    ref?: string;
    /** Text to type */
    text?: string;
    /** Scroll direction */
    direction?: "up" | "down" | "left" | "right";
    /** CDP method name for raw cdp action */
    method?: string;
    /** CDP params object */
    params?: Record<string, unknown>;
    /** JavaScript expression for console eval */
    expression?: string;
    /** Whether to include full accessibility tree */
    full?: boolean;
}
export declare const BROWSER_TOOL_SCHEMA: {
    readonly type: "object";
    readonly properties: {
        readonly action: {
            readonly type: "string";
            readonly enum: readonly ["navigate", "click", "type", "scroll", "snapshot", "screenshot", "console", "cdp"];
            readonly description: string;
        };
        readonly url: {
            readonly type: "string";
            readonly description: "URL to navigate to. Required for 'navigate' action.";
        };
        readonly ref: {
            readonly type: "string";
            readonly description: "Element reference like \"@e5\" from a previous snapshot. Required for click/type.";
        };
        readonly text: {
            readonly type: "string";
            readonly description: "Text to type into the referenced element. Required for 'type' action.";
        };
        readonly direction: {
            readonly type: "string";
            readonly enum: readonly ["up", "down", "left", "right"];
            readonly description: "Scroll direction. Required for 'scroll' action.";
        };
        readonly method: {
            readonly type: "string";
            readonly description: "CDP method name (e.g. 'Page.reload'). Required for 'cdp' action.";
        };
        readonly params: {
            readonly type: "object";
            readonly description: "Parameters for the CDP method. Optional for 'cdp' action.";
        };
        readonly expression: {
            readonly type: "string";
            readonly description: "JavaScript expression to evaluate. Used with 'console' action.";
        };
        readonly full: {
            readonly type: "boolean";
            readonly description: "Include full accessibility tree (default: compact). Used with 'snapshot'.";
        };
    };
    readonly required: readonly ["action"];
};
export interface BrowserSnapshot {
    elements: Array<{
        ref: string;
        role: string;
        name: string;
        text?: string;
    }>;
    url: string;
    title: string;
}
export interface BrowserScreenshot {
    base64: string;
    mimeType: string;
    width: number;
    height: number;
}
/**
 * Host-provided browser automation backend.
 * The host manages Chrome/Chromium lifecycle and CDP connections.
 */
export interface BrowserToolDeps {
    navigate(url: string): Promise<{
        snapshot: BrowserSnapshot;
    }>;
    click(ref: string): Promise<{
        success: boolean;
        error?: string;
    }>;
    type(ref: string, text: string): Promise<{
        success: boolean;
        error?: string;
    }>;
    scroll(direction: "up" | "down" | "left" | "right"): Promise<{
        success: boolean;
    }>;
    snapshot(full?: boolean): Promise<BrowserSnapshot>;
    screenshot(): Promise<BrowserScreenshot>;
    consoleEval(expression?: string): Promise<{
        result?: string;
        messages?: string[];
        errors?: string[];
    }>;
    cdp(method: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
    /** Validate URL safety (SSRF prevention). Returns error message if blocked, null if safe. */
    validateUrl(url: string): string | null;
}
export declare function createBrowserTool(deps: BrowserToolDeps): PortableTool<BrowserToolParams>;
