import type { BrowserContext, Frame, Page } from 'playwright';
import { z } from 'zod/v4';
import type { FlowMetadata } from '../models/FlowMetadata';
import type { ToolCall } from '../models/ToolCall';
import type { FlowsPersistence } from '../persistence/flows/FlowsPersistence';
import type { NamedBindingCallback } from './NamedBindingCallback';
/**
 * Zod schema for validating InteractionEvent objects.
 */
export declare const InteractionEventSchema: z.ZodObject<{
    type: z.ZodString;
    key: z.ZodOptional<z.ZodString>;
    selectors: z.ZodArray<z.ZodString>;
    timestamp: z.ZodNumber;
    x: z.ZodOptional<z.ZodNumber>;
    y: z.ZodOptional<z.ZodNumber>;
    dragDistance: z.ZodOptional<z.ZodNumber>;
    keyCode: z.ZodOptional<z.ZodInt>;
    altKey: z.ZodOptional<z.ZodBoolean>;
    ctrlKey: z.ZodOptional<z.ZodBoolean>;
    metaKey: z.ZodOptional<z.ZodBoolean>;
    shiftKey: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
/**
 * TypeScript type inferred from the Zod schema.
 */
export type InteractionEvent = z.infer<typeof InteractionEventSchema>;
/**
 * Subset of flow-engine state that {@link PageInteractionTracker} needs.
 *
 * Using an interface instead of importing `DonobuFlow` directly avoids a
 * circular dependency (`WebTargetInspector → PageInteractionTracker →
 * DonobuFlow → … → WebTargetInspector`). `DonobuFlow` structurally
 * satisfies this interface.
 */
export interface InteractionTrackingHost {
    readonly metadata: FlowMetadata;
    readonly invokedToolCalls: ToolCall[];
    readonly persistence: FlowsPersistence;
}
/**
 * Tracks direct user actions that have occurred in the web browser.
 * This differs from normal Donobu flows which use GPT to analyze pages and propose actions.
 * This tracker records direct user actions for reliable replay and GPT visibility.
 */
export declare class PageInteractionTracker implements NamedBindingCallback {
    private readonly host;
    static readonly NAME = "__donobuTrackInteraction";
    static register(host: InteractionTrackingHost, browserContext: BrowserContext): Promise<PageInteractionTracker>;
    private constructor();
    name(): string;
    /**
     * Handles tracking of page interactions.
     *
     * Assumes:
     * - args is a single-element array with first element being JSON convertible to InteractionEvent
     */
    call(source: {
        context: BrowserContext;
        page: Page;
        frame: Frame;
    }, ...args: unknown[]): Promise<void>;
    private handleSyntheticToolCall;
    private handleClick;
    private handleKeyDown;
    private buildSelectorForReplay;
    private isCandidateForToolCallMerging;
    private savePageScreenshot;
}
//# sourceMappingURL=PageInteractionTracker.d.ts.map