/** * Desktop Control Extension (computer-use with a safety layer) * * Registers snake_case `desktop_*` tools that inject REAL mouse/keyboard * input via native OS commands: * - macOS: JXA (osascript -l JavaScript) + CoreGraphics CGEventPost * - Windows: PowerShell + Add-Type user32 SendInput/SetCursorPos * - Linux: xdotool (X11) / wtype (Wayland, keyboard-only) * * Tools are registered ONLY when the platform/session is capable. Every * mutating action is wrapped by the safety layer: * 1. By default there is NO confirmation prompt: enabling the extension * (enabledNativeExtensions contains "desktop-control") is the explicit * user consent, so actions run in interactive, headless, serve and RPC * sessions alike. Opt-in SPECTRAL_DESKTOP_REQUIRE_CONFIRM=1|true restores * the per-session interactive confirmation (ctx.hasUI; headless * auto-denies single actions without locking the session). * 2. Optional SPECTRAL_DESKTOP_ALLOWLIST restricts actions to matching * frontmost apps. * 3. Screenshot BEFORE -> execute -> screenshot AFTER; both images are * returned as image content so the model verifies the outcome * (spectral-vision-fallback analyzes them automatically). A pointer * read-back and a "no visible change" hint expose silent injection * failures (CGEventPost never errors). * 4. SPECTRAL_DESKTOP_DRY_RUN=1 returns action plans without executing. * * This extension is registered with defaultEnabled: false — it must be * opted in via Settings.enabledNativeExtensions: ["desktop-control"]. * * Zero external npm dependencies beyond cross-spawn (Windows PATH is trimmed * under Electron). No native modules. */ import type { ExtensionAPI, ToolDefinition } from "../../sdk/coding-agent/index.js"; import { type ScreenshotFormat, type WindowInfo } from "../desktop-screenshot/index.js"; import { DesktopActionPolicy } from "./safety.js"; import type { DesktopAdapter } from "./types.js"; export declare function createAdapter(env?: NodeJS.ProcessEnv): Promise<{ adapter: DesktopAdapter | null; reason?: string; }>; export interface DesktopControlDeps { adapter: DesktopAdapter; /** Screenshot capture (defaults to desktop-screenshot's full-screen capture). */ capture?: (options?: { format?: ScreenshotFormat; }) => Promise; /** Window listing (defaults to desktop-screenshot's listWindows). */ listWindowsFn?: () => Promise; env?: NodeJS.ProcessEnv; policy?: DesktopActionPolicy; } /** Build the 8 desktop tools supported by the adapter's capabilities. */ export declare function createDesktopTools(deps: DesktopControlDeps): Array, Record>>; export default function desktopControlExtension(ext: ExtensionAPI): Promise; //# sourceMappingURL=index.d.ts.map