import { WDAElement, WDARect } from "./wda/index.js"; import type { IosDevice } from "./types.js"; import { type FindElementsCriteria } from "./wda-payloads.js"; export type { IosDevice } from "./types.js"; export declare class IosClient { private deviceId?; private wdaManager; private wdaClient?; constructor(deviceId?: string); cleanup(): void; /** True unless the device id belongs to a connected physical device. */ private isSimulatorDevice; private ensureWDA; /** Thin instance wrapper around `execSimctl` (argv-form, no shell). */ private execArgs; /** Thin instance wrapper around `execSimctlQuiet` (stderr suppressed). */ private execArgsQuiet; /** Legacy string form: whitespace-split into argv tokens, then `execSimctl`. */ private exec; /** * Get the active device ID or 'booted' */ private get targetDevice(); /** Resolve target device for a per-call override or fall back to instance default. */ private targetDeviceFor; /** * Get list of iOS devices: simulators (simctl) plus connected physical * devices (go-ios). Physical discovery is best-effort — if go-ios is not * installed it contributes nothing and simulator behaviour is unchanged. */ getDevices(): IosDevice[]; /** * Get booted simulators */ getBootedDevices(): IosDevice[]; /** * Set active device */ setDevice(deviceId: string): void; /** * Get currently configured device ID */ getDeviceId(): string | undefined; /** * Boot simulator */ boot(deviceId?: string): void; /** * Shutdown simulator */ shutdown(deviceId?: string): void; /** * Take screenshot and return raw PNG buffer */ screenshotRaw(deviceIdOverride?: string): Buffer; /** * Take screenshot and return as base64 (legacy) */ screenshot(deviceIdOverride?: string): string; /** * Async screenshot that works for physical devices too: routes physical * devices through WDA `/screenshot` (simctl io only addresses simulators), * and simulators through the fast sync simctl path. */ screenshotRawAsync(deviceIdOverride?: string): Promise; /** * Tap at coordinates */ tap(x: number, y: number, deviceIdOverride?: string): Promise; /** * Swipe gesture */ swipe(x1: number, y1: number, x2: number, y2: number, durationMs?: number, deviceIdOverride?: string): Promise; /** * Long press at coordinates via WDA Actions API */ longPress(x: number, y: number, durationMs?: number, deviceIdOverride?: string): Promise; /** * Swipe in direction (uses actual screen center from WDA, not hardcoded) */ swipeDirection(direction: "up" | "down" | "left" | "right", distance?: number): Promise; /** * Input text via WDA (types into the currently focused element) */ inputText(text: string, deviceIdOverride?: string): Promise; /** * Press key * * SECURITY: AppleScript invocations use execFileSync("osascript", ["-e", literal]) * — the script literal is a single argv slot, so /bin/sh never parses its contents. * The `key` argument is whitelisted via keyMap; only fixed AppleScript literals reach * osascript. */ pressKey(key: string): void; /** * Launch app by bundle ID */ launchApp(bundleId: string, deviceIdOverride?: string): string; /** * Terminate app */ stopApp(bundleId: string, deviceIdOverride?: string): void; /** * Install app (.app bundle or .ipa) */ installApp(path: string): string; /** * Uninstall app */ uninstallApp(bundleId: string): string; /** * Get UI hierarchy (limited on iOS simulator) * Returns accessibility info if available */ getUiHierarchy(deviceIdOverride?: string): Promise; /** * Find element by text or label */ findElement(criteria: { text?: string; label?: string; }): Promise; /** * Find multiple elements by criteria */ findElements(criteria: FindElementsCriteria): Promise>; /** * Get element rect (position + size) by element ID */ getElementRect(elementId: string): Promise; /** * Tap element by element ID */ tapElement(elementId: string): Promise; /** * Open URL in simulator * * SECURITY: URL passes as a single argv slot to xcrun (no /bin/sh -c). * Any shell metacharacters in `url` are not parsed by the host shell. * Scheme validation happens at the tool layer (validateUrl). */ openUrl(url: string): void; /** * Add photo to simulator */ addPhoto(imagePath: string): void; /** * Set location */ setLocation(lat: number, lon: number): void; /** * Get device info */ getDeviceInfo(): Record; /** * Execute arbitrary simctl command * * SECURITY: `command` is whitespace-split into argv tokens before reaching * execFileSync. Shell metacharacters (;, &, |, $(), backticks, etc.) cannot * spawn a host shell from this path. The MCP tool layer additionally validates * via validateShellCommand as defense in depth. */ shell(command: string): string; /** * Get device logs */ getLogs(options?: { predicate?: string; lines?: number; level?: "debug" | "info" | "default" | "error" | "fault"; }): string; /** * Get app-specific logs * * SECURITY: bundleId is validated against the reverse-DNS whitelist before * embedding into the simctl predicate string. The predicate itself is passed * as ONE argv slot — the host shell never parses it; simctl parses it * internally as its own DSL. */ getAppLogs(bundleId: string, lines?: number): string; /** * Clear logs (not fully supported on iOS, but we can note the timestamp) */ clearLogs(): string; /** * Grant privacy permission on iOS simulator * Services: camera, microphone, photos, location, contacts, calendar, reminders, motion, health, speech-recognition */ grantPermission(bundleId: string, service: string): string; /** * Revoke privacy permission on iOS simulator */ revokePermission(bundleId: string, service: string): string; /** * Reset all privacy permissions for an app on iOS simulator */ resetPermissions(bundleId: string): string; } //# sourceMappingURL=client.d.ts.map