/** * Desktop Client - communicates with Kotlin companion app via JSON-RPC */ import { EventEmitter } from "events"; export { APP_PATH_ALLOWLIST, BLOCKED_COMMS, findCompanionAppPath, getBundleIdFromAppPath, resolvePidByBundleId, validateAndResolveAppPath, validateAttachPid, } from "./permission-allowlist.js"; export { LogRing } from "./log-ring.js"; export { normalizeLaunchOptions } from "./launch-options.js"; export { AttachLauncher, BundleAppLauncher, GradleAppLauncher, NoOpLauncher, type AppLaunchStrategy, } from "./launchers.js"; import type { RawLaunchOptions, ScreenshotOptions, ScreenshotResult, UiHierarchy, WindowInfo, LogEntry, LogOptions, PerformanceMetrics, DesktopState, PermissionStatus, MonitorInfo, TapByTextResult } from "./types.js"; export declare class DesktopClient extends EventEmitter { private process; private activeStrategy; private gradleLauncher; private requestId; private pendingRequests; private readonly logRing; private state; private lastLaunchOptions; private readline; /** PID of the user's app — set after native launch or attach. Auto-passed to tap/input/key. */ targetPid: number | undefined; constructor(); /** * Get current state */ getState(): DesktopState; /** * Check if running */ isRunning(): boolean; /** * Launch desktop automation. Accepts the flat RawLaunchOptions (backward-compatible) * and normalizes internally to the discriminated-union LaunchOptions. */ launch(options: RawLaunchOptions): Promise; private selectStrategy; getTargetPid(): number | null; /** * Wait for the companion app to be ready */ private waitForReady; /** * Stop desktop app */ stop(): Promise; /** * Handle incoming line from stdout */ private handleLine; /** * Handle JSON-RPC response */ private handleResponse; /** * Handle process exit */ private handleExit; /** * Detach the old (dead/dying) companion process and its associated handles * so they don't linger until GC when launch() respawns a replacement. * Safe to call when there's nothing to detach. */ private detachProcess; /** * Handle crash with auto-restart */ private handleCrash; /** * Send JSON-RPC request */ private sendRequest; /** * Add log entry (delegates to LogRing) */ private addLog; /** * Take screenshot */ screenshotRaw(options?: ScreenshotOptions): Promise; /** * Take screenshot and return base64 */ screenshot(options?: ScreenshotOptions): Promise; /** * Get screenshot with metadata */ screenshotWithMeta(options?: ScreenshotOptions): Promise; /** * Tap at coordinates * @param targetPid - Optional PID to send click without stealing focus (macOS only) */ tap(x: number, y: number, targetPid?: number): Promise; /** * Tap an element by its text content using Accessibility API * This does NOT move the cursor - perfect for background automation (macOS only) * @param text - The text to search for (partial match, case-insensitive) * @param pid - The process ID of the target application * @param exactMatch - If true, requires exact text match */ tapByText(text: string, pid?: number, exactMatch?: boolean): Promise; /** * Long press at coordinates */ longPress(x: number, y: number, durationMs?: number): Promise; /** * Swipe gesture */ swipe(x1: number, y1: number, x2: number, y2: number, durationMs?: number): Promise; /** * Swipe in direction */ swipeDirection(direction: "up" | "down" | "left" | "right", distance?: number): Promise; /** * Input text * @param targetPid - Optional PID to send input without stealing focus (macOS only) */ inputText(text: string, targetPid?: number): Promise; /** * Press key * @param targetPid - Optional PID to send key without stealing focus (macOS only) */ pressKey(key: string, modifiers?: string[], targetPid?: number): Promise; /** * Get the PID of the focused window (for background input) */ getFocusedWindowPid(): Promise; /** * Get UI hierarchy */ getUiHierarchy(windowId?: string): Promise; /** * Get UI hierarchy as XML string (for compatibility) */ getUiHierarchyXml(): string; /** * Get window information */ getWindowInfo(): Promise; /** * Focus a window */ focusWindow(windowId: string): Promise; /** * Resize a window */ resizeWindow(width: number, height: number, windowId?: string): Promise; /** * Get clipboard content */ getClipboard(): Promise; /** * Set clipboard content */ setClipboard(text: string): Promise; /** * Check accessibility permissions */ checkPermissions(): Promise; /** * Get logs */ getLogs(options?: LogOptions): LogEntry[]; /** * Clear logs */ clearLogs(): void; /** * Get performance metrics */ getPerformanceMetrics(): Promise; /** * Get screen size */ getScreenSize(): Promise<{ width: number; height: number; }>; /** * Get list of connected monitors (multi-monitor support) */ getMonitors(): Promise; /** * Launch app by bundle ID (for compatibility with mobile interface). * If companion is running, launches native macOS app and resolves PID. */ launchApp(packageName: string): string; /** * Stop app (for compatibility) */ stopApp(packageName: string): void; /** * Shell command (not supported) */ shell(command: string): string; } //# sourceMappingURL=client.d.ts.map