import { k as AIUsageInfo, R as Rect, j as ElementTreeNode, B as BaseElement, U as UIContext, ax as ReferenceImage, p as AIElementLocatorResponse, O as ElementById, s as AIDataExtractionResponse, u as AIAssertionResponse, av as PageType, Y as PlanningAIResponse } from './types-81ea39fa.js';
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam } from 'openai/resources';

type AIArgs = [
    ChatCompletionSystemMessageParam,
    ChatCompletionUserMessageParam
];
declare enum AIActionType {
    ASSERT = 0,
    INSPECT_ELEMENT = 1,
    EXTRACT_DATA = 2,
    PLAN = 3,
    DESCRIBE_ELEMENT = 4
}
declare function callAiFn<T>(msgs: AIArgs, AIActionTypeValue: AIActionType): Promise<{
    content: T;
    usage?: AIUsageInfo;
}>;
declare function adaptBboxToRect(bbox: number[], width: number, height: number, offsetX?: number, offsetY?: number): Rect;

declare function elementByPositionWithElementInfo(treeRoot: ElementTreeNode<BaseElement>, position: {
    x: number;
    y: number;
}, options?: {
    requireStrictDistance?: boolean;
    filterPositionElements?: boolean;
}): BaseElement | undefined;
declare function describeUserPage<ElementType extends BaseElement = BaseElement>(context: Omit<UIContext<ElementType>, 'describer'>, opt?: {
    truncateTextLength?: number;
    filterNonTextContent?: boolean;
}): Promise<{
    description: string;
    elementById(idOrIndexId: string): ElementType;
    elementByPosition(position: {
        x: number;
        y: number;
    }, size: {
        width: number;
        height: number;
    }): BaseElement | undefined;
    insertElementByPosition(position: {
        x: number;
        y: number;
    }): ElementType;
    size: {
        width: number;
        height: number;
    };
}>;

declare function AiLocateElement<ElementType extends BaseElement = BaseElement>(options: {
    context: UIContext<ElementType>;
    targetElementDescription: string;
    referenceImage?: ReferenceImage;
    callAI?: typeof callAiFn<AIElementResponse | [number, number]>;
    searchConfig?: Awaited<ReturnType<typeof AiLocateSection>>;
}): Promise<{
    parseResult: AIElementLocatorResponse;
    rect?: Rect;
    rawResponse: string;
    elementById: ElementById;
    usage?: AIUsageInfo;
}>;
declare function AiLocateSection(options: {
    context: UIContext<BaseElement>;
    sectionDescription: string;
    callAI?: typeof callAiFn<AISectionLocatorResponse>;
}): Promise<{
    rect?: Rect;
    imageBase64?: string;
    error?: string;
    rawResponse: string;
    usage?: AIUsageInfo;
}>;
declare function AiExtractElementInfo<T, ElementType extends BaseElement = BaseElement>(options: {
    dataQuery: string | Record<string, string>;
    context: UIContext<ElementType>;
}): Promise<{
    parseResult: AIDataExtractionResponse<T>;
    elementById: (idOrIndexId: string) => ElementType;
    usage: AIUsageInfo | undefined;
}>;
declare function AiAssert<ElementType extends BaseElement = BaseElement>(options: {
    assertion: string;
    context: UIContext<ElementType>;
}): Promise<{
    content: AIAssertionResponse;
    usage: AIUsageInfo | undefined;
}>;

declare function plan(userInstruction: string, opts: {
    context: UIContext;
    pageType: PageType;
    callAI?: typeof callAiFn<PlanningAIResponse>;
    log?: string;
    actionContext?: string;
}): Promise<PlanningAIResponse>;

export { AiLocateElement as A, AiAssert as a, AIActionType as b, callAiFn as c, describeUserPage as d, elementByPositionWithElementInfo as e, AiExtractElementInfo as f, AiLocateSection as g, adaptBboxToRect as h, plan as p };
