Repository navigation
Description
Summary
The computer use tools (MouseClick, MouseMove, Type, Screenshot) currently interact with the UI by actually moving the mouse and typing, and locate targets purely from pixels via the vision annotator. Every desktop platform exposes an accessibility tree that can answer "what elements are on screen and where" natively - exact positions, labels, and states, no vision model side-call, no cursor movement. Integrating it enables text-only models (like DeepSeek) to perform GUI tasks by reading the tree, with the vision pipeline as fallback.
Acceptance Criteria
- Add a
GetUIElementstool that walks the accessibility tree of the frontmost app or a named target ("dock"/"taskbar", "menubar"), returning the same{label, text, bbox}element shape as the annotator, with coordinates mapped into the standard frame space (one uniform scale conversion viaFitDims) soMouseClickand the model's coordinate space stay unchanged. - Add a
PressUIElementaction that invokes an element's default action directly without moving the cursor - eliminates the physical-mouse-interference race and coordinate risk for launches and standard controls. - Platform backends behind one interface (mirroring
internal/display's provider pattern):- macOS:
AXUIElementvia cgo/ObjC (fits the existing pattern ininternal/display/macos/client_darwin.go); the Dock isAXApplication "Dock" -> AXList -> AXDockItemwith exact AXTitle/AXPosition/AXSize. Requires the Accessibility (TCC) permission for the spawning process; degrade gracefully with a clear message when not granted. - Linux (X11/Wayland): AT-SPI2 over D-Bus - works on both display servers since it bypasses the compositor; degrade clearly when the bus or registry is unavailable.
- Windows: UI Automation (UIA) - tracked for when the CLI grows a Windows display backend.
- macOS:
- Background tasks should be able to use the accessibility tree for non-invasive UI inspection.
- Unsupported platform or missing permission degrades to the vision pipeline with a clear message, never a hard failure.
- Tool descriptions steer the model: query the tree first, fall back to
GetLatestFrame+ region zoom when the tree is empty or the app exposes nothing useful.
Context
This is a follow-up from PR #990 and PR #1083. The vision annotation pipeline already lets text-only models understand screen content via the annotator, but they still can't interact with the UI without vision. Accessibility trees provide the same element-level information the annotator extracts from screenshots, but natively.
Findings from the grounding work in PR #1083, where vision-based Dock clicking was verified end to end but measured slow (multiple frame captures + annotator round-trips per target):
- The CLI has no accessibility-tree usage today on any platform -
internal/displayuses only NSWorkspace/robotgo (macOS) and X11/Wayland capture+input, so pixels + annotator VLM is the agent's only way to locate UI. - Accessibility lookups are deterministic, instant, and token-free exactly where the annotator confabulates (small icons, dense toolbars).
- The vision pipeline from PR fix(computer-use): dock annotations, single-resample frames, saner frame retention #1083 (region zoom + annotator) stays load-bearing as the fallback for apps with poor accessibility exposure on every platform, e.g. DaVinci Resolve's custom-drawn UI.
Suggested phasing: macOS backend first (primary computer-use platform today), Linux AT-SPI second, Windows UIA when a Windows display backend exists.
For text-only models like DeepSeek, this would enable:
- Reading button labels and menu items
- Getting element positions for targeted clicks
- Understanding UI state without screenshot annotation
- Performing multi-step GUI workflows via background tasks
Related
- PR feat: add named frame sources and vision annotation pipeline #990 - Vision annotation pipeline
- PR fix(computer-use): dock annotations, single-resample frames, saner frame retention #1083 - Computer-use grounding fixes (aspect-preserving frames, region zoom, annotation salvage)
- Issue [FEATURE] Vision annotation pipeline: let cheaper/text-only models understand screen and camera frames #895 - Original feature request
- macOS Accessibility API, AT-SPI2, and Windows UI Automation documentation
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][FEATURE] macOS Accessibility API integration for computer use tools[/-][+][FEATURE] Accessibility-tree integration for computer use tools (macOS AX, Linux AT-SPI, Windows UIA)[/+]fix(computer-use): dock annotations, single-resample frames, saner fr…