/**
 * BrowserPlanner — the agent loop.
 *
 *   observe  →  think (LLM)  →  act  →  repeat, until `done`, `abort`, or maxSteps.
 *
 * The LLM is prompted to emit a strict JSON object describing one of a small
 * set of primitive actions. We parse it, safety-gate it, execute it, and feed
 * the resulting observation back on the next turn.
 *
 * Cross-provider portable: no tool-calling APIs. Just JSON-in-text.
 */
import type { Model } from "@dotkaio/avis-ai";
import type { ModelRegistry } from "../model-registry.js";
import { type BrowserSession } from "./browser-session.js";
export type PlannerAction = {
    type: "navigate";
    url: string;
    reasoning?: string;
} | {
    type: "click";
    index: number;
    reasoning?: string;
} | {
    type: "dblclick";
    index: number;
    reasoning?: string;
} | {
    type: "type";
    index: number;
    text: string;
    submit?: boolean;
    reasoning?: string;
} | {
    type: "select";
    index: number;
    option: string;
    reasoning?: string;
} | {
    type: "press";
    keys: string;
    reasoning?: string;
} | {
    type: "scroll";
    direction?: "up" | "down" | "top" | "bottom";
    pixels?: number;
    reasoning?: string;
} | {
    type: "wait";
    seconds: number;
    reasoning?: string;
} | {
    type: "open_tab";
    url?: string;
    reasoning?: string;
} | {
    type: "switch_tab";
    id: number;
    reasoning?: string;
} | {
    type: "ask_user";
    question: string;
    reasoning?: string;
} | {
    type: "done";
    summary: string;
    success?: boolean;
} | {
    type: "abort";
    reason: string;
};
export type PlannerEvent = {
    type: "step_start";
    step: number;
    url: string;
    title: string;
    elementCount: number;
} | {
    type: "thinking";
    step: number;
} | {
    type: "action_proposed";
    step: number;
    action: PlannerAction;
} | {
    type: "action_result";
    step: number;
    action: PlannerAction;
    result: string;
} | {
    type: "action_denied";
    step: number;
    action: PlannerAction;
    reason: string;
    byUser: boolean;
} | {
    type: "parse_error";
    step: number;
    raw: string;
    attempt: number;
} | {
    type: "ask_user";
    step: number;
    question: string;
} | {
    type: "done";
    step: number;
    summary: string;
    success: boolean;
} | {
    type: "aborted";
    step: number;
    reason: string;
} | {
    type: "error";
    step: number;
    error: string;
};
export interface PlannerOptions {
    maxSteps?: number;
    signal?: AbortSignal;
    /** Invoked when the planner needs a user answer (ask_user tool). Return null -> abort. */
    onAskUser?: (question: string) => Promise<string | null>;
    /** Called for every event; synchronous fan-out. */
    onEvent?: (event: PlannerEvent) => void;
}
export interface PlannerResult {
    success: boolean;
    summary: string;
    steps: number;
    /** Final page visible text (truncated). */
    pageText?: string;
    /** Condensed log of actions taken. */
    actionLog?: string[];
    /** Final page URL. */
    finalUrl?: string;
}
export declare function runPlanner(task: string, session: BrowserSession, model: Model<any>, modelRegistry: ModelRegistry, opts?: PlannerOptions): Promise<PlannerResult>;
//# sourceMappingURL=browser-planner.d.ts.map