/** * macOS adapter for desktop-control. * * Mouse/keyboard injection via JXA (`osascript -l JavaScript`) using the ObjC * bridge to CoreGraphics: CGEventCreateMouseEvent + CGEventPost, * CGEventCreateKeyboardEvent for keys, CGEventCreateScrollWheelEvent for * scrolling. Numeric enum constants are inlined (kCGEventLeftMouseDown = 1, * kCGHIDEventTap = 0, ...) so the script never depends on enum bridging. * * type_text uses CGEvent key events for ASCII; any non-ASCII text falls back * to System Events `keystroke` via AppleScript (handles unicode). * * Every JXA action ends with a CGEventGetLocation read-back (cursor position) * that the safety layer appends to the tool result — CGEventPost itself never * errors, so the read-back is how silent injection failures surface. * * checkPermissions also preflights Screen Recording via * CGPreflightScreenCaptureAccess (read-only) so mutating actions fail with * fix instructions BEFORE the BEFORE screenshot would silently capture the * desktop wallpaper. * * Accessibility (TCC) check + frontmost app query go through a read-only * System Events query: `name of first application process whose frontmost is * true`. When accessibility is missing, osascript fails with * "osascript is not allowed assistive access" and we return guidance pointing * to System Settings > Privacy & Security > Accessibility. */ import type { DesktopAction, DesktopAdapter } from "./types.js"; export declare function buildMouseJxa(action: Extract): string; /** Build the key sequence [[keycode, shift], ...] for ASCII text; null when any char is unmappable. */ export declare function buildAsciiTypeSeq(text: string): Array<[number, boolean]> | null; export declare function buildTypeJxa(seq: Array<[number, boolean]>): string; /** Tokens: leading modifiers + exactly one key. Throws on unsupported keys. */ export declare function resolveChordTokens(tokens: string[]): { key: number; flags: number; }; export declare function buildHotkeyJxa(key: number, flags: number): string; /** System Events keystroke; \n -> `return`, \t -> `tab` via concatenation. */ export declare function buildKeystrokeAppleScript(text: string): string; export declare function buildFocusAppleScript(owner: string, title?: string): string; export declare function accessibilityError(rawStderr: string): string; export declare const SCREEN_RECORDING_ERROR: string; /** * One-shot JXA probe: CGPreflightScreenCaptureAccess() — true when Screen * Recording TCC is granted. The function is missing from CoreGraphics' * bridgesupport on current macOS, so it is bound explicitly via ObjC.bindFunction. */ export declare function buildScreenCapturePreflightJxa(): string; export declare const macosAdapter: DesktopAdapter; //# sourceMappingURL=macos.d.ts.map