Skip to content

feat(cua-driver): consolidate type_text; remove get_accessibility_tree - #1416

Merged
f-trycua merged 1 commit into
mainfrom
feat/cua-driver-consolidate-tools-v2
May 1, 2026
Merged

feat(cua-driver): consolidate type_text; remove get_accessibility_tree#1416
f-trycua merged 1 commit into
mainfrom
feat/cua-driver-consolidate-tools-v2

Conversation

@f-trycua

@f-trycua f-trycua commented May 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

type_text consolidation

  • type_text_chars is deleted. type_text now auto-falls back to CGEvent character synthesis (CGEvent.postToPid) when the AX attribute write is rejected — covers Chromium/Electron inputs transparently.
  • New delay_ms param (0–200, default 30ms) controls inter-character delay in the CGEvent fallback path; ignored when the AX path succeeds.
  • Response summary notes which path was taken (via AX or via CGEvent (AX fallback)).
  • All references updated in docs, skills (SKILL.md, RECORDING.md, TESTS.md, WEB_APPS.md), mcp-tools.mdx, cli-reference.mdx.

get_accessibility_tree removal

  • Tool deleted — its functionality (running apps + visible windows list) is fully covered by list_apps and list_windows.
  • Removed from ToolRegistry; stale references updated to point at list_windows.

Test plan

  • swift build clean ✅
  • type_text on a Cocoa text field → summary says via AX
  • type_text on a Chrome input → falls back to CGEvent, summary says via CGEvent (AX fallback)
  • cua-driver get_accessibility_treeUnknown tool error
  • list_apps and list_windows still work

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Removed Features

    • Removed type_text_chars and get_accessibility_tree tools
  • Improvements

    • type_text tool now automatically handles typing in Chromium and Electron applications with seamless fallback
    • Added optional delay_ms parameter to type_text for controlling fallback timing (0-200ms, default 30ms)
  • Bug Fixes

    • Fixed screenshot output file path parameter in daemon command calls

type_text now auto-falls back to CGEvent character synthesis when the AX
write is rejected — covers Chromium/Electron inputs without requiring the
caller to choose between two tools. Adds delay_ms param (default 30ms,
used only in the CGEvent path). TypeTextCharsTool deleted; all references
updated to type_text throughout docs, skills, and tests.

get_accessibility_tree removed — its functionality (running apps + window
list) is fully covered by list_apps and list_windows. Tool file deleted,
removed from ToolRegistry, stale doc references updated to list_windows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Building Building Preview, Comment May 1, 2026 5:11am

Request Review

@f-trycua
f-trycua merged commit 604628f into main May 1, 2026
4 of 7 checks passed
@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 90f886b1-178c-48d2-88c8-cf498357ccd0

📥 Commits

Reviewing files that changed from the base of the PR and between 9d623c0 and 46fd384.

📒 Files selected for processing (13)
  • docs/content/docs/cua-driver/reference/cli-reference.mdx
  • docs/content/docs/cua-driver/reference/mcp-tools.mdx
  • libs/cua-driver/Skills/cua-driver/RECORDING.md
  • libs/cua-driver/Skills/cua-driver/SKILL.md
  • libs/cua-driver/Skills/cua-driver/TESTS.md
  • libs/cua-driver/Skills/cua-driver/WEB_APPS.md
  • libs/cua-driver/Sources/CuaDriverCLI/CallCommand.swift
  • libs/cua-driver/Sources/CuaDriverCore/Capture/WindowCapture.swift
  • libs/cua-driver/Sources/CuaDriverServer/ToolRegistry.swift
  • libs/cua-driver/Sources/CuaDriverServer/Tools/GetAccessibilityTreeTool.swift
  • libs/cua-driver/Sources/CuaDriverServer/Tools/ScreenshotTool.swift
  • libs/cua-driver/Sources/CuaDriverServer/Tools/TypeTextCharsTool.swift
  • libs/cua-driver/Sources/CuaDriverServer/Tools/TypeTextTool.swift

📝 Walkthrough

Walkthrough

This PR consolidates typing functionality by removing type_text_chars and get_accessibility_tree tools, updating type_text to include automatic CGEvent fallback behavior, and updating documentation and tool registries to reflect these changes across the CUA driver codebase.

Changes

Cohort / File(s) Summary
Documentation Updates
docs/content/docs/cua-driver/reference/cli-reference.mdx, docs/content/docs/cua-driver/reference/mcp-tools.mdx, libs/cua-driver/Skills/cua-driver/RECORDING.md, libs/cua-driver/Skills/cua-driver/SKILL.md, libs/cua-driver/Skills/cua-driver/TESTS.md, libs/cua-driver/Skills/cua-driver/WEB_APPS.md
Removes references to type_text_chars and get_accessibility_tree tools; updates documentation to describe type_text with automatic AX-to-CGEvent fallback behavior and new delay_ms parameter.
Tool Implementation Cleanup
libs/cua-driver/Sources/CuaDriverServer/Tools/GetAccessibilityTreeTool.swift, libs/cua-driver/Sources/CuaDriverServer/Tools/TypeTextCharsTool.swift
Removes two tool implementations entirely from the codebase.
Tool Logic Enhancement
libs/cua-driver/Sources/CuaDriverServer/Tools/TypeTextTool.swift
Adds AX-first text insertion with automatic fallback to character-by-character CGEvent synthesis when AX is unavailable; introduces configurable delay_ms parameter (0–200ms, default 30).
Infrastructure Updates
libs/cua-driver/Sources/CuaDriverServer/ToolRegistry.swift, libs/cua-driver/Sources/CuaDriverServer/Tools/ScreenshotTool.swift, libs/cua-driver/Sources/CuaDriverCLI/CallCommand.swift, libs/cua-driver/Sources/CuaDriverCore/Capture/WindowCapture.swift
Removes handler registrations for deleted tools; updates documentation references from get_accessibility_tree to list_windows; fixes parameter naming in daemon call.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant TypeTextHandler as TypeTextTool Handler
    participant AXInput as AXInput
    participant KeyboardInput as KeyboardInput
    participant System as OS

    Client->>TypeTextHandler: type_text(element_index, text, delay_ms)
    TypeTextHandler->>AXInput: Try setAttribute("AXSelectedText")
    alt AX Success
        AXInput->>TypeTextHandler: Success
        TypeTextHandler->>Client: ✓ Text inserted via AX
    else AX Fails
        AXInput->>TypeTextHandler: AXInputError
        TypeTextHandler->>KeyboardInput: typeCharacters(text, pid, delay_ms)
        KeyboardInput->>System: CGEvent.postToPid (per-character)
        System->>KeyboardInput: Events posted
        KeyboardInput->>TypeTextHandler: Success
        TypeTextHandler->>Client: ✓ Text inserted via CGEvent (AX fallback)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • ddupont808

Poem

🐰 Hop, skip, and type with grace,
One tool replaces the old chars race,
With fallback magic, from AX to keys,
The text flows freely where it pleases!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cua-driver-consolidate-tools-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant