/**
 * BrowserSession — a live, persistent browser bound to one profile.
 *
 * v1 scope: single tab, open url, screenshot, get visible text, close.
 * Built on playwright-core; no bundled browser needed if system Chromium exists.
 */
import { EventEmitter } from "node:events";
import type { CredentialBridge } from "../credentials/index.js";
import { BrowserActions, type Target } from "./browser-actions.js";
import { type ObservedSnapshot } from "./browser-observer.js";
import { BrowserSafety } from "./browser-safety.js";
export interface BrowserLaunchOptions {
    profile?: string;
    headless?: boolean;
    viewport?: {
        width: number;
        height: number;
    };
}
export interface BrowserStatus {
    profile: string;
    headless: boolean;
    url: string;
    title: string;
    tabCount: number;
}
export interface BrowserScreenshot {
    path: string;
    data: string;
    mimeType: "image/png";
}
export type ConfirmAsker = (info: {
    actionDescription: string;
    reason: string;
    url: string;
}) => Promise<boolean>;
export declare class BrowserActionDenied extends Error {
    readonly reason: string;
    readonly byUser: boolean;
    constructor(reason: string, byUser: boolean);
}
export declare class BrowserSession extends EventEmitter {
    private profiles;
    private context;
    private page;
    private profile;
    private headless;
    private _actions;
    private _safety;
    private _confirmAsker;
    private _credentials;
    private _lastSnapshot;
    get isOpen(): boolean;
    get actions(): BrowserActions;
    get safety(): BrowserSafety;
    /** Attach a shared credential bridge so password fields can auto-fill from Keychain. */
    setCredentialBridge(b: CredentialBridge | null): void;
    get credentials(): CredentialBridge | null;
    /** Hostname of the currently active tab (empty string if no page). */
    currentHost(): string;
    /** Caller (interactive-mode) provides a function that shows a TUI prompt and returns the user's answer. */
    setConfirmAsker(asker: ConfirmAsker | null): void;
    launch(opts?: BrowserLaunchOptions): Promise<BrowserStatus>;
    /** Make a specific tab (by context.pages() index) the active page. */
    setActiveTab(id: number): Promise<void>;
    /** Capture a compact DOM-lite snapshot for agent / LLM consumption. */
    observe(): Promise<ObservedSnapshot>;
    get lastSnapshot(): ObservedSnapshot | null;
    /** Look up an element from the most recent observe() by index. */
    private resolveTargetElement;
    private gate;
    click(target: Target, opts?: {
        button?: "left" | "right" | "middle";
        dblclick?: boolean;
    }): Promise<string>;
    type(target: Target, text: string, opts?: {
        clear?: boolean;
        submit?: boolean;
    }): Promise<string>;
    select(target: Target, optionText: string): Promise<string>;
    press(keys: string): Promise<string>;
    scroll(opts: {
        direction?: "up" | "down" | "top" | "bottom";
        pixels?: number;
    }): Promise<string>;
    hover(target: Target): Promise<string>;
    listTabs(): Promise<{
        id: number;
        url: string;
        title: string;
        active: boolean;
    }[]>;
    openTabAndActivate(url?: string): Promise<import("playwright-core").Page>;
    closeTab(id: number): Promise<void>;
    switchTab(id: number): Promise<void>;
    open(url: string): Promise<BrowserStatus>;
    back(): Promise<BrowserStatus>;
    forward(): Promise<BrowserStatus>;
    refresh(): Promise<BrowserStatus>;
    /** Capture screenshot of the current tab. Returns base64 png + tmp file path. */
    screenshot(fullPage?: boolean): Promise<BrowserScreenshot>;
    /** Return visible text of the page (simple evaluator, v1). */
    getVisibleText(): Promise<string>;
    status(): BrowserStatus;
    statusWithTitle(): Promise<BrowserStatus>;
    close(): Promise<void>;
    private ensurePage;
}
//# sourceMappingURL=browser-session.d.ts.map