[fix] Anthropic CUA triple_click mapping#2104
Open
chromiebot wants to merge 5 commits intobrowserbase:mainfrom
Open
[fix] Anthropic CUA triple_click mapping#2104chromiebot wants to merge 5 commits intobrowserbase:mainfrom
triple_click mapping#2104chromiebot wants to merge 5 commits intobrowserbase:mainfrom
Conversation
Verifies that the AnthropicCUAClient correctly converts triple_click actions (with both coordinate-array and x/y formats) into tripleClick actions consumed by v3CuaAgentHandler.
AnthropicCUAClient.convertToolUseToAction() had no explicit handler for the triple_click action that Claude can emit via the computer tool. The action fell through to the generic handler which: 1. Kept the snake_case type "triple_click" instead of normalizing to "tripleClick" expected by v3CuaAgentHandler.executeAction(). 2. Did not extract coordinates from Anthropic's coordinate array format. This adds: - Explicit triple_click/tripleClick mapping in the Anthropic client, following the same pattern as the existing double_click handler. - A "triple_click" case alias in v3CuaAgentHandler.executeAction(), matching how "double_click" and "doubleClick" are both handled.
🦋 Changeset detectedLatest commit: 7a54548 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
Contributor
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
Contributor
There was a problem hiding this comment.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant AnthropicAPI as Anthropic API
participant CUA as AnthropicCUAClient
participant Handler as V3CuaAgentHandler
Note over AnthropicAPI,Handler: Triple Click Action Flow
AnthropicAPI->>CUA: tool_use (action: "triple_click", coordinate: [x,y])
anthropicAPI->>CUA: tool_use (action: "tripleClick", x: number, y: number)
CUA->>CUA: Normalize action to internal "tripleClick"
alt coordinate array format
CUA->>CUA: Extract x = coordinate[0], y = coordinate[1]
else x/y fields format
CUA->>CUA: Use x, y directly
end
CUA->>CUA: Map to { type: "tripleClick", x, y }
CUA->>Handler: Execute action (type: "tripleClick", x, y)
alt Recording mode
Handler->>Handler: Record action for replay
end
Handler->>Handler: Perform triple click at (x, y)
Handler-->>CUA: { success: true }
CUA-->>AnthropicAPI: Tool result sent back (via next API call)
…r-pr-https-g chore: add changeset for Anthropic CUA triple_click fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
AnthropicCUAClient.convertToolUseToAction()handled actions likeclick,double_click, andleft_click, but did not explicitly supporttriple_click.Two issues:
triple_click) instead of being normalized totripleClick— the format expected byv3CuaAgentHandler.executeAction().As a result, Anthropic triple-click actions were silently ignored by the handler switch.
What Changed
AnthropicCUAClient.ts
v3CuaAgentHandler.ts
Test Plan
Added
anthropic-cua-triple-click.test.ts(Vitest) covering:All existing unit tests continue to pass.
Summary by cubic
Fix incorrect handling of Anthropic CUA
triple_clickso triple-click actions run and coordinates are parsed correctly. Adds unit tests for both coordinate-array and x/y formats, and a changeset for a patch release.Bug Fixes
triple_click/tripleClickto internaltripleClickinAnthropicCUAClient, extractingx/yfromcoordinateor explicit fields."triple_click"case toV3CuaAgentHandlerso both naming styles execute consistently.Dependencies
@browserbasehq/stagehand.Written for commit 7a54548. Summary will update on new commits.