export interface VerbCall {
    name: string;
    input: Record<string, unknown>;
}
export interface VerbResult {
    ok: boolean;
    result?: Record<string, unknown>;
    error?: string;
}
export interface LoopStep {
    call: VerbCall;
    result: VerbResult;
    visionFallback?: boolean;
}
export interface LoopState {
    task: string;
    steps: LoopStep[];
    visionMode: boolean;
}
export interface ModelDecision {
    toolCalls: VerbCall[];
    done?: {
        text: string;
    };
}
export type ModelResponder = (state: LoopState) => ModelDecision | Promise<ModelDecision>;
export type VerbDispatcher = (call: VerbCall) => VerbResult | Promise<VerbResult>;
export interface LoopConfig {
    task: string;
    responder: ModelResponder;
    dispatch: VerbDispatcher;
    maxSteps: number;
    onEvent?: (event: LoopEvent) => void;
}
export type LoopEvent = {
    kind: 'turn';
    index: number;
} | {
    kind: 'dispatch';
    call: VerbCall;
    result: VerbResult;
    visionFallback?: boolean;
} | {
    kind: 'vision_switch';
    describe: VerbResult;
} | {
    kind: 'done';
    text: string;
} | {
    kind: 'max_steps';
};
export interface LoopResult {
    status: 'done' | 'max_steps';
    finalText?: string;
    steps: LoopStep[];
    dispatched: string[];
    visionMode: boolean;
    turns: number;
}
export declare const AX_OPAQUE_ELEMENT_THRESHOLD = 3;
export declare function isAxOpaque(result: VerbResult): boolean;
export declare function runComputerLoop(config: LoopConfig): Promise<LoopResult>;
