[fix] Anthropic CUA triple_click mapping (#2104) - #2107
Merged
Conversation
# Why
`AnthropicCUAClient.convertToolUseToAction()` handled actions like
`click`, `double_click`, and `left_click`, but did not explicitly
support `triple_click`.
Two issues:
1. The action type remained in snake_case (`triple_click`) instead of
being normalized to `tripleClick` — the format expected by
`v3CuaAgentHandler.executeAction()`.
2. Coordinates provided via Anthropic’s coordinate: [x, y] format were
not converted into the separate x / y fields required by the handler.
As a result, Anthropic triple-click actions were silently ignored by the
handler switch.
# What Changed
- AnthropicCUAClient.ts
- Added explicit handling for triple_click / tripleClick in
convertToolUseToAction()
- Mirrors the existing double_click implementation
- Normalizes action type to tripleClick
- Extracts coordinates from both:
- coordinate: [x, y]
- direct x / y fields
- v3CuaAgentHandler.ts
- Added "triple_click" as a switch-case alias in executeAction()
# Test Plan
Added `anthropic-cua-triple-click.test.ts` (Vitest) covering:
- triple_click with coordinate: [x, y]
- triple_click with direct x / y fields
All existing unit tests continue to pass.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fix incorrect handling of Anthropic CUA `triple_click` so 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**
- Normalize `triple_click`/`tripleClick` to internal `tripleClick` in
`AnthropicCUAClient`, extracting `x`/`y` from `coordinate` or explicit
fields.
- Add `"triple_click"` case to `V3CuaAgentHandler` so both naming styles
execute consistently.
- **Dependencies**
- Add changeset to publish a patch for `@browserbasehq/stagehand`.
<sup>Written for commit 7a54548.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: a230bfc 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 |
miguelg719
marked this pull request as ready for review
May 11, 2026 20:58
Contributor
There was a problem hiding this comment.
No issues found across 4 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant CUA as Anthropic CUA API
participant Client as AnthropicCUAClient
participant Handler as V3CuaAgentHandler
participant Browser as Browser Action Executor
Note over CUA,Browser: Triple Click Action Mapping Flow
CUA->>Client: tool_use: action="triple_click", input={coordinate=[x,y]}
Client->>Client: convertToolUseToAction()
Note over Client: Check action type
alt action == "triple_click" || action == "tripleClick"
Client->>Client: Extract coordinates from coordinate[] or direct x/y
Client->>Client: Build action: {type:"tripleClick", x, y}
end
Client-->>Handler: executeAction({type:"tripleClick", x, y})
Handler->>Handler: executeAction(action)
alt action.type == "tripleClick" || action.type == "triple_click"
Handler->>Handler: Parse x, y from action
Handler->>Browser: Click(x, y, count=3)
Browser-->>Handler: {success: true}
Handler-->>Client: {success: true}
end
tkattkat
reviewed
May 12, 2026
| return { | ||
| type: "tripleClick", | ||
| x: | ||
| (input.x as number) || |
Collaborator
There was a problem hiding this comment.
nit: we dont need as number for input.x or input.y
tkattkat
approved these changes
May 12, 2026
This was referenced May 12, 2026
Merged
This was referenced May 20, 2026
seanmcguire12
pushed a commit
that referenced
this pull request
Jun 3, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/stagehand@3.5.0 ### Minor Changes - [#2149](#2149) [`6e75725`](6e75725) Thanks [@miguelg719](https://github.com/miguelg719)! - Added a `screenshot` option to `extract()` that sends the current viewport screenshot with the a11y tree for extraction. - [#2127](#2127) [`78bcde8`](78bcde8) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Add `ignoreDefaultArgs` option to selectively remove chrome-launcher's built-in default flags (e.g. `--disable-extensions`) when running locally - [#2160](#2160) [`49575d6`](49575d6) Thanks [@monadoid](https://github.com/monadoid)! - Forward constructor and request model configuration when initializing API-backed sessions. - [#2171](#2171) [`dc1445d`](dc1445d) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add native clipboard API ### Patch Changes - [#2146](#2146) [`3a53ed4`](3a53ed4) Thanks [@shriyatheunicorn](https://github.com/shriyatheunicorn)! - Pass local browser launch options through when attaching over CDP so explicit viewport settings are respected. - [#2107](#2107) [`8fc16d2`](8fc16d2) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix Anthropic CUA `triple_click` action mapping. - [#2118](#2118) [`3e95a87`](3e95a87) Thanks [@monadoid](https://github.com/monadoid)! - Add Vertex auth parameters to the core and server API schemas. - [#2126](#2126) [`ebbdcd3`](ebbdcd3) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix(core): import ToolSet from ai public export - [#2120](#2120) [`12703a6`](12703a6) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix structuredOutputMode for newer Anthropic models - [#2170](#2170) [`1db5f1c`](1db5f1c) Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - Add Claude Opus 4.8 to the supported CUA model whitelist. - [#2116](#2116) [`cb586a1`](cb586a1) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - include "[selected]" or "[checked]" state in snapshot - [#2129](#2129) [`765861c`](765861c) Thanks [@miguelg719](https://github.com/miguelg719)! - Add a backend-selectable v3 evaluator facade while preserving the legacy evaluator path. - [#2157](#2157) [`2cd60a3`](2cd60a3) Thanks [@miguelg719](https://github.com/miguelg719)! - Add verifier trajectory, rubric, and evaluation-result types with normalized public naming. - [#2131](#2131) [`e102a89`](e102a89) Thanks [@miguelg719](https://github.com/miguelg719)! - Capture verifier trajectory evidence from agent evidence callbacks for offline scoring. ## @browserbasehq/browse-cli@0.6.1 ### Patch Changes - Updated dependencies \[[`3a53ed4`](3a53ed4), [`6e75725`](6e75725), [`8fc16d2`](8fc16d2), [`78bcde8`](78bcde8), [`3e95a87`](3e95a87), [`ebbdcd3`](ebbdcd3), [`12703a6`](12703a6), [`1db5f1c`](1db5f1c), [`cb586a1`](cb586a1), [`765861c`](765861c), [`2cd60a3`](2cd60a3), [`e102a89`](e102a89), [`49575d6`](49575d6), [`dc1445d`](dc1445d)]: - @browserbasehq/stagehand@3.5.0 ## @browserbasehq/stagehand-server-v3@3.7.0 ### Minor Changes - [#2160](#2160) [`49575d6`](49575d6) Thanks [@monadoid](https://github.com/monadoid)! - Forward constructor and request model configuration when initializing API-backed sessions. ### Patch Changes - [#2118](#2118) [`3e95a87`](3e95a87) Thanks [@monadoid](https://github.com/monadoid)! - Add Vertex auth parameters to the core and server API schemas. - [#2167](#2167) [`ce21468`](ce21468) Thanks [@monadoid](https://github.com/monadoid)! - Add SEA binary --version build metadata output. - Updated dependencies \[[`3a53ed4`](3a53ed4), [`6e75725`](6e75725), [`8fc16d2`](8fc16d2), [`78bcde8`](78bcde8), [`3e95a87`](3e95a87), [`ebbdcd3`](ebbdcd3), [`12703a6`](12703a6), [`1db5f1c`](1db5f1c), [`cb586a1`](cb586a1), [`765861c`](765861c), [`2cd60a3`](2cd60a3), [`e102a89`](e102a89), [`49575d6`](49575d6), [`dc1445d`](dc1445d)]: - @browserbasehq/stagehand@3.5.0 ## @browserbasehq/stagehand-evals@2.0.2 ### Patch Changes - Updated dependencies \[[`3a53ed4`](3a53ed4), [`6e75725`](6e75725), [`8fc16d2`](8fc16d2), [`78bcde8`](78bcde8), [`3e95a87`](3e95a87), [`ebbdcd3`](ebbdcd3), [`12703a6`](12703a6), [`1db5f1c`](1db5f1c), [`cb586a1`](cb586a1), [`765861c`](765861c), [`2cd60a3`](2cd60a3), [`e102a89`](e102a89), [`49575d6`](49575d6), [`dc1445d`](dc1445d)]: - @browserbasehq/stagehand@3.5.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
felipeofdev-ai
pushed a commit
to felipeofdev-ai/stagehand
that referenced
this pull request
Aug 4, 2026
…rbase#2107) # Why `AnthropicCUAClient.convertToolUseToAction()` handled actions like `click`, `double_click`, and `left_click`, but did not explicitly support `triple_click`. Two issues: 1. The action type remained in snake_case (`triple_click`) instead of being normalized to `tripleClick` — the format expected by `v3CuaAgentHandler.executeAction()`. 2. Coordinates provided via Anthropic’s coordinate: [x, y] format were not converted into the separate x / y fields required by the handler. As a result, Anthropic triple-click actions were silently ignored by the handler switch. # What Changed - AnthropicCUAClient.ts - Added explicit handling for triple_click / tripleClick in convertToolUseToAction() - Mirrors the existing double_click implementation - Normalizes action type to tripleClick - Extracts coordinates from both: - coordinate: [x, y] - direct x / y fields - v3CuaAgentHandler.ts - Added "triple_click" as a switch-case alias in executeAction() # Test Plan Added `anthropic-cua-triple-click.test.ts` (Vitest) covering: - triple_click with coordinate: [x, y] - triple_click with direct x / y fields All existing unit tests continue to pass. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes Anthropic CUA `triple_click` so it runs as `tripleClick` with x/y parsed from `coordinate: [x, y]` or explicit fields. Also adds a CI job to run evals unit tests. - **Bug Fixes** - Normalize `triple_click`/`tripleClick` to `tripleClick` in `AnthropicCUAClient.convertToolUseToAction()`. - Parse `x`/`y` from `coordinate: [x, y]` or direct fields. - Add `"triple_click"` alias in `v3CuaAgentHandler.executeAction()`. - **Dependencies** - Changeset to publish a patch for `@browserbasehq/stagehand`. <sup>Written for commit a230bfc. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> ---------
felipeofdev-ai
pushed a commit
to felipeofdev-ai/stagehand
that referenced
this pull request
Aug 4, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @browserbasehq/stagehand@3.5.0 ### Minor Changes - [browserbase#2149](browserbase#2149) [`6e75725`](browserbase@6e75725) Thanks [@miguelg719](https://github.com/miguelg719)! - Added a `screenshot` option to `extract()` that sends the current viewport screenshot with the a11y tree for extraction. - [browserbase#2127](browserbase#2127) [`78bcde8`](browserbase@78bcde8) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - Add `ignoreDefaultArgs` option to selectively remove chrome-launcher's built-in default flags (e.g. `--disable-extensions`) when running locally - [browserbase#2160](browserbase#2160) [`49575d6`](browserbase@49575d6) Thanks [@monadoid](https://github.com/monadoid)! - Forward constructor and request model configuration when initializing API-backed sessions. - [browserbase#2171](browserbase#2171) [`dc1445d`](browserbase@dc1445d) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - add native clipboard API ### Patch Changes - [browserbase#2146](browserbase#2146) [`3a53ed4`](browserbase@3a53ed4) Thanks [@shriyatheunicorn](https://github.com/shriyatheunicorn)! - Pass local browser launch options through when attaching over CDP so explicit viewport settings are respected. - [browserbase#2107](browserbase#2107) [`8fc16d2`](browserbase@8fc16d2) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix Anthropic CUA `triple_click` action mapping. - [browserbase#2118](browserbase#2118) [`3e95a87`](browserbase@3e95a87) Thanks [@monadoid](https://github.com/monadoid)! - Add Vertex auth parameters to the core and server API schemas. - [browserbase#2126](browserbase#2126) [`ebbdcd3`](browserbase@ebbdcd3) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix(core): import ToolSet from ai public export - [browserbase#2120](browserbase#2120) [`12703a6`](browserbase@12703a6) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix structuredOutputMode for newer Anthropic models - [browserbase#2170](browserbase#2170) [`1db5f1c`](browserbase@1db5f1c) Thanks [@Kylejeong2](https://github.com/Kylejeong2)! - Add Claude Opus 4.8 to the supported CUA model whitelist. - [browserbase#2116](browserbase#2116) [`cb586a1`](browserbase@cb586a1) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - include "[selected]" or "[checked]" state in snapshot - [browserbase#2129](browserbase#2129) [`765861c`](browserbase@765861c) Thanks [@miguelg719](https://github.com/miguelg719)! - Add a backend-selectable v3 evaluator facade while preserving the legacy evaluator path. - [browserbase#2157](browserbase#2157) [`2cd60a3`](browserbase@2cd60a3) Thanks [@miguelg719](https://github.com/miguelg719)! - Add verifier trajectory, rubric, and evaluation-result types with normalized public naming. - [browserbase#2131](browserbase#2131) [`e102a89`](browserbase@e102a89) Thanks [@miguelg719](https://github.com/miguelg719)! - Capture verifier trajectory evidence from agent evidence callbacks for offline scoring. ## @browserbasehq/browse-cli@0.6.1 ### Patch Changes - Updated dependencies \[[`3a53ed4`](browserbase@3a53ed4), [`6e75725`](browserbase@6e75725), [`8fc16d2`](browserbase@8fc16d2), [`78bcde8`](browserbase@78bcde8), [`3e95a87`](browserbase@3e95a87), [`ebbdcd3`](browserbase@ebbdcd3), [`12703a6`](browserbase@12703a6), [`1db5f1c`](browserbase@1db5f1c), [`cb586a1`](browserbase@cb586a1), [`765861c`](browserbase@765861c), [`2cd60a3`](browserbase@2cd60a3), [`e102a89`](browserbase@e102a89), [`49575d6`](browserbase@49575d6), [`dc1445d`](browserbase@dc1445d)]: - @browserbasehq/stagehand@3.5.0 ## @browserbasehq/stagehand-server-v3@3.7.0 ### Minor Changes - [browserbase#2160](browserbase#2160) [`49575d6`](browserbase@49575d6) Thanks [@monadoid](https://github.com/monadoid)! - Forward constructor and request model configuration when initializing API-backed sessions. ### Patch Changes - [browserbase#2118](browserbase#2118) [`3e95a87`](browserbase@3e95a87) Thanks [@monadoid](https://github.com/monadoid)! - Add Vertex auth parameters to the core and server API schemas. - [browserbase#2167](browserbase#2167) [`ce21468`](browserbase@ce21468) Thanks [@monadoid](https://github.com/monadoid)! - Add SEA binary --version build metadata output. - Updated dependencies \[[`3a53ed4`](browserbase@3a53ed4), [`6e75725`](browserbase@6e75725), [`8fc16d2`](browserbase@8fc16d2), [`78bcde8`](browserbase@78bcde8), [`3e95a87`](browserbase@3e95a87), [`ebbdcd3`](browserbase@ebbdcd3), [`12703a6`](browserbase@12703a6), [`1db5f1c`](browserbase@1db5f1c), [`cb586a1`](browserbase@cb586a1), [`765861c`](browserbase@765861c), [`2cd60a3`](browserbase@2cd60a3), [`e102a89`](browserbase@e102a89), [`49575d6`](browserbase@49575d6), [`dc1445d`](browserbase@dc1445d)]: - @browserbasehq/stagehand@3.5.0 ## @browserbasehq/stagehand-evals@2.0.2 ### Patch Changes - Updated dependencies \[[`3a53ed4`](browserbase@3a53ed4), [`6e75725`](browserbase@6e75725), [`8fc16d2`](browserbase@8fc16d2), [`78bcde8`](browserbase@78bcde8), [`3e95a87`](browserbase@3e95a87), [`ebbdcd3`](browserbase@ebbdcd3), [`12703a6`](browserbase@12703a6), [`1db5f1c`](browserbase@1db5f1c), [`cb586a1`](browserbase@cb586a1), [`765861c`](browserbase@765861c), [`2cd60a3`](browserbase@2cd60a3), [`e102a89`](browserbase@e102a89), [`49575d6`](browserbase@49575d6), [`dc1445d`](browserbase@dc1445d)]: - @browserbasehq/stagehand@3.5.0
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
Added explicit handling for triple_click / tripleClick in convertToolUseToAction()
v3CuaAgentHandler.ts
Test Plan
Added
anthropic-cua-triple-click.test.ts(Vitest) covering:All existing unit tests continue to pass.
Summary by cubic
Fixes Anthropic CUA
triple_clickso it runs astripleClickwith x/y parsed fromcoordinate: [x, y]or explicit fields. Also adds a CI job to run evals unit tests.Bug Fixes
triple_click/tripleClicktotripleClickinAnthropicCUAClient.convertToolUseToAction().x/yfromcoordinate: [x, y]or direct fields."triple_click"alias inv3CuaAgentHandler.executeAction().Dependencies
@browserbasehq/stagehand.Written for commit a230bfc. Summary will update on new commits.