-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix key mapping in Anthropic CUA Client #1374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix key mapping in Anthropic CUA Client #1374
Conversation
🦋 Changeset detectedLatest commit: b9716b9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
Greptile OverviewGreptile SummaryFixed Anthropic CUA agents to properly handle key press actions by mapping the
This change enables Anthropic agents in CUA mode to issue key presses (like Backspace, Enter, etc.) which were previously failing. Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Agent as Anthropic Agent
participant Client as AnthropicCUAClient
participant Handler as v3CuaAgentHandler
participant Browser as Playwright Page
Agent->>Client: Tool use: {action: "key", text: "BackSpace"}
Client->>Client: convertToolUseToAction()
Note over Client: Maps "key" action to "keypress"
Note over Client: Extracts text parameter
Client->>Client: Return {type: "keypress", keys: text}
Client->>Handler: Execute keypress action
Handler->>Handler: Normalize keys to array
Handler->>Handler: Map key to Playwright format
Handler->>Browser: page.keyPress(mapped)
Browser-->>Handler: Key pressed
Handler-->>Client: Action complete
Client-->>Agent: Screenshot with result
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
why
Anthropic agents in CUA mode are unable to issue key presses (not to be confused with
typeactions)what changed
The format for the anthropic tool
computer_20250124replies with:wasn't properly mapped to our internal action abstraction:
keypress, which accepts parameterkeys. It was issued directly from the anthropic format. UpdatedAnthropicCUAClient.tsto account for this and map appropriatelytest plan
Summary by cubic
Fixes key action mapping in Anthropic CUA so agents can send key presses (e.g., Backspace) correctly instead of failing on the "key" action.
Written for commit b9716b9. Summary will update automatically on new commits.