import type { Locator, Page } from "playwright-core";
/**
 * Post-action verification: an action that succeeds at the Playwright level
 * (e.g. a click() didn't throw) can still leave the page in a state where
 * the user-visible task hasn't actually happened — the message didn't post,
 * the search didn't navigate, the rich-text editor didn't accept the input.
 *
 * `BrowserExpectation` lets the LLM assert what the page should look like
 * after the action. The verifier polls until either the assertion passes
 * or `timeoutMs` runs out.
 *
 * Each field is independently optional. When multiple fields are set, ALL
 * must pass within the timeout window — useful for "url changed AND
 * loading spinner gone".
 */
export interface BrowserExpectation {
    /** Page or element text contains this substring. */
    text?: string;
    /** Text disappears (matches our wait `textGone` semantics). */
    textGone?: string;
    /**
     * A selector resolves to a visible element. Alias `selectorVisible` is
     * preferred and exposed in the LLM-facing prompts because "visible" is
     * the semantic the model actually wants — DOM presence is rarely enough
     * on SPAs that mount nodes empty before populating them.
     */
    selector?: string;
    selectorVisible?: string;
    /**
     * A selector is no longer visible (or resolves to nothing). `selectorGone`
     * and `selectorHidden` are aliases — both go through the same `state:
     * "hidden"` Playwright path.
     */
    selectorGone?: string;
    selectorHidden?: string;
    /** location.href contains this substring. */
    urlContains?: string;
    /** location.href matches this regex (string compiled with `new RegExp`). */
    urlMatches?: string;
    /** Verify an input/textarea/contenteditable carries the given text. */
    inputValue?: {
        selector?: string;
        ref?: string;
        contains?: string;
        equals?: string;
    };
    /** Total budget for the whole expectation block (default 8000ms). */
    timeoutMs?: number;
}
export interface ExpectResult {
    ok: boolean;
    /** Short human-readable summary suitable for tool result text. */
    summary: string;
    /** Per-field outcomes for diagnostics. */
    details: Array<{
        field: string;
        ok: boolean;
        message?: string;
    }>;
}
/**
 * Run all expectation fields against the page. Returns a structured result
 * the caller can stitch into a tool result string. Never throws — every
 * failure mode is captured as a `details` entry.
 */
export declare function runExpectation(page: Page, expect: BrowserExpectation): Promise<ExpectResult>;
export declare function waitForNoVisibleMatches(locator: Locator, timeoutMs: number): Promise<{
    ok: boolean;
    visibleCount: number;
    totalCount: number;
}>;
