/** * Shared types for the desktop-control (computer-use) extension. * * The extension injects real mouse/keyboard input into the user's desktop. * Every mutating action is wrapped by a safety layer in index.ts: * screenshot BEFORE -> execute -> screenshot AFTER, with an interactive * confirmation gate, headless deny-by-default, dry-run mode and an optional * app allowlist. */ export type MouseButton = "left" | "right" | "middle"; /** Kinds of native actions an adapter can support. `hotkey` covers both desktop_press_key and desktop_hotkey. */ export type ActionKind = "mouse_move" | "mouse_click" | "mouse_drag" | "scroll" | "type_text" | "hotkey" | "focus_window"; /** * Normalized action description, platform-agnostic. * Scroll semantics: dy > 0 scrolls DOWN, dx > 0 scrolls RIGHT (units: lines). */ export type DesktopAction = { kind: "mouse_move"; x: number; y: number; } | { kind: "mouse_click"; x: number; y: number; button: MouseButton; clickCount: number; } | { kind: "mouse_drag"; fromX: number; fromY: number; toX: number; toY: number; } | { kind: "scroll"; x?: number; y?: number; dx: number; dy: number; } | { kind: "type_text"; text: string; } | { kind: "hotkey"; tokens: string[]; } | { kind: "focus_window"; title: string; owner?: string; windowId?: string | number; }; /** Result of a permission/capability probe. */ export interface PermissionCheck { ok: boolean; error?: string; } /** * Per-OS backend. Adapters only build and run native commands; all safety * policy lives in safety.ts / index.ts. Builders are exported separately so * unit tests can assert generated osascript / .ps1 / xdotool argv without * executing anything. */ export interface DesktopAdapter { platform: string; capabilities: ActionKind[]; /** Optional TCC/permission probe (macOS accessibility, etc.). */ checkPermissions?(): Promise; /** Name (or "proc title") of the frontmost app, or null if unavailable. */ frontmostApp(): Promise; /** Human-readable command that WOULD run (used by dry-run plans). */ buildPlan(action: DesktopAction): string; /** * Execute the action natively. May return a short read-back string with the * post-action state (macOS: "x,y" cursor position from CGEventGetLocation) * so the safety layer can surface it and detect silent injection failures; * null/undefined when the adapter has nothing to report. */ execute(action: DesktopAction): Promise; } //# sourceMappingURL=types.d.ts.map