/** * Internal infrastructure for driving the iOS Simulator UI from inside leak/perf * workflows (replayScenario, captureScenarioState). NOT a generic UI automation * surface, the public tool contract stays scoped to leak/perf debug. * * Wraps Cameron Cooke's `axe` CLI (https://github.com/cameroncooke/AXe). * `axe` is a soft dependency: we detect it on first use and emit a structured * install hint when missing, instead of hard-failing or bundling it. */ export interface AxeAvailability { available: boolean; /** Absolute path to the `axe` binary when found. */ binaryPath?: string; /** Human-readable install instructions when `available === false`. */ installHint?: string; } /** * Check whether `axe` is available on the system. Cached at module load via * `which` lookup so callers can skip the call when they already know. */ export declare function checkAxeAvailable(): Promise; export interface AxFrame { x: number; y: number; width: number; height: number; } export interface UIElement { label?: string; identifier?: string; role?: string; frame?: AxFrame; /** Raw axe payload preserved so callers can extract additional fields. */ raw?: Record; children?: UIElement[]; } /** * Run `axe describe-ui --udid ` and parse the tree into normalized * `UIElement` nodes. Returns the root element. */ export declare function describeUI(udid: string): Promise; /** Pure: parse `axe describe-ui` JSON output into normalized UIElement tree. */ export declare function parseAxeDescribeUI(stdout: string): UIElement; /** * Pure: parse an `AXFrame`-style frame from a node. Accepts both AppKit-style * dictionaries `{AXX: 0, AXY: 0, AXWidth: 100, AXHeight: 100}` and CGRect * strings `"{{0,0},{100,100}}"`. */ export declare function parseAxFrame(obj: Record): AxFrame | undefined; /** * Pure: find the first descendant whose label or identifier matches `query` * (exact match preferred, falls back to substring). Walks the tree * depth-first. */ export declare function findElementByLabel(root: UIElement, query: string): UIElement | null; /** Pure: compute the center point of an `AxFrame` for tap targeting. */ export declare function centerOf(frame: AxFrame): { x: number; y: number; }; export type TapTarget = { kind: "label"; value: string; } | { kind: "elementId"; value: string; } | { kind: "coords"; x: number; y: number; }; /** * Tap on the simulator. Resolves label/elementId targets via `describe-ui` * before issuing the tap. */ export declare function tap(udid: string, target: TapTarget): Promise; /** Swipe between two coordinates with optional duration in milliseconds. */ export declare function swipe(udid: string, from: { x: number; y: number; }, to: { x: number; y: number; }, durationMs?: number): Promise; /** Type a string into the currently focused field. */ export declare function typeText(udid: string, text: string): Promise;