Add cua to mode - #1432
Add cua to mode#1432
Conversation
🦋 Changeset detectedLatest commit: 1f1b807 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
Greptile SummaryMoves CUA configuration from a boolean Key changes:
Issues found:
Migration path: Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant V3Agent
participant Validator
participant CuaHandler
participant Cache
User->>V3Agent: agent({ mode: "cua" })
Note over V3Agent: Detect CUA mode
V3Agent->>V3Agent: isCuaMode = mode === "cua" || cua === true
alt cua: true (deprecated)
V3Agent->>V3Agent: Log deprecation warning
V3Agent->>User: console.warn()
end
V3Agent->>Validator: validateExperimentalFeatures(agentConfig)
Validator->>Validator: isCuaMode = mode === "cua" || cua === true
alt CUA mode enabled
Validator->>Validator: Check unsupported features (streaming, abort, messages)
alt Unsupported features found
Validator-->>V3Agent: throw StagehandInvalidArgumentError
end
end
alt Not experimental mode
Validator->>Validator: Check experimental features (integrations, tools)
alt Experimental features found
Validator-->>V3Agent: throw ExperimentalNotConfiguredError
end
end
V3Agent->>Cache: buildConfigSignature(agentConfig)
Note over Cache: Should check both mode and cua flag
Cache-->>V3Agent: configSignature
V3Agent->>CuaHandler: Create CUA agent handler
CuaHandler-->>V3Agent: agent instance
V3Agent-->>User: return agent
|
There was a problem hiding this comment.
Additional Comments (2)
-
packages/core/lib/v3/cache/AgentCache.ts, line 115 (link)logic: cache signature doesn't account for
mode: "cua"—only checks deprecatedcuaboolean -
packages/core/lib/v3/cache/AgentCache.ts, line 117 (link)logic: should also check
mode === "cua"to match the pattern used elsewhereNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
4 files reviewed, 2 comments
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.0.7 ### Patch Changes - [#1461](#1461) [`0f3991e`](0f3991e) Thanks [@tkattkat](https://github.com/tkattkat)! - Move hybrid mode out of experimental - [#1433](#1433) [`e0e22e0`](e0e22e0) Thanks [@tkattkat](https://github.com/tkattkat)! - Put hybrid mode behind experimental - [#1456](#1456) [`f261051`](f261051) Thanks [@shrey150](https://github.com/shrey150)! - Invoke page.hover for agent move action - [#1473](#1473) [`e021674`](e021674) Thanks [@shrey150](https://github.com/shrey150)! - Add safety confirmation support for OpenAI + Google CUA - [#1399](#1399) [`6a5496f`](6a5496f) Thanks [@tkattkat](https://github.com/tkattkat)! - Ensure cua agent is killed when stagehand.close is called - [#1436](#1436) [`fea1700`](fea1700) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix auto-load key for act/extract/observe parametrized models on api - [#1439](#1439) [`5b288d9`](5b288d9) Thanks [@tkattkat](https://github.com/tkattkat)! - Remove base64 from agent actions array ( still present in messages object ) - [#1408](#1408) [`e822f5a`](e822f5a) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - allow for act() cache hit when variable values change - [#1472](#1472) [`638efc7`](638efc7) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: agent cache not refreshed on action failure - [#1424](#1424) [`a890f16`](a890f16) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: "Error: -32000 Failed to convert response to JSON: CBOR: stack limit exceeded" - [#1418](#1418) [`934f492`](934f492) Thanks [@miguelg719](https://github.com/miguelg719)! - Cleanup handlers and bus listeners on close - [#1430](#1430) [`bd2db92`](bd2db92) Thanks [@shrey150](https://github.com/shrey150)! - Fix CUA model coordinate translation - [#1465](#1465) [`51e0170`](51e0170) Thanks [@miguelg719](https://github.com/miguelg719)! - Add media resolution high provider option to gemini 3 hybrid agent - [#1431](#1431) [`05f5580`](05f5580) Thanks [@tkattkat](https://github.com/tkattkat)! - Update the cache handling for agent - [#1432](#1432) [`f56a9c2`](f56a9c2) Thanks [@tkattkat](https://github.com/tkattkat)! - Deprecate cua: true in favor of mode: "cua" - [#1406](#1406) [`b40ae11`](b40ae11) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for hovering with coordinates ( page.hover ) - [#1407](#1407) [`0d2b398`](0d2b398) Thanks [@tkattkat](https://github.com/tkattkat)! - Clean up page methods - [#1412](#1412) [`cd01f29`](cd01f29) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: load GOOGLE_API_KEY from .env - [#1462](#1462) [`a734fca`](a734fca) Thanks [@shrey150](https://github.com/shrey150)! - fix: correctly pass userDataDir to chrome launcher - [#1466](#1466) [`b342acf`](b342acf) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - move playwright to optional dependencies - [#1440](#1440) [`2987cd1`](2987cd1) Thanks [@tkattkat](https://github.com/tkattkat)! - [Feature] support excluding tools from agent - [#1455](#1455) [`dfab1d5`](dfab1d5) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - update aisdk client to better enforce structured output with deepseek models - [#1428](#1428) [`4d71162`](4d71162) Thanks [@tkattkat](https://github.com/tkattkat)! - Add "hybrid" mode to stagehand agent ## @browserbasehq/stagehand-server@3.2.0 ### Minor Changes - [#1459](#1459) [`abb3469`](abb3469) Thanks [@monadoid](https://github.com/monadoid)! - Added building of binaries - [#1457](#1457) [`5fc1281`](5fc1281) Thanks [@monadoid](https://github.com/monadoid)! - First changeset for stagehand-server - [#1469](#1469) [`d634d45`](d634d45) Thanks [@monadoid](https://github.com/monadoid)! - Bump to test binary builds ### Patch Changes - Updated dependencies \[[`0f3991e`](0f3991e), [`e0e22e0`](e0e22e0), [`f261051`](f261051), [`e021674`](e021674), [`6a5496f`](6a5496f), [`fea1700`](fea1700), [`5b288d9`](5b288d9), [`e822f5a`](e822f5a), [`638efc7`](638efc7), [`a890f16`](a890f16), [`934f492`](934f492), [`bd2db92`](bd2db92), [`51e0170`](51e0170), [`05f5580`](05f5580), [`f56a9c2`](f56a9c2), [`b40ae11`](b40ae11), [`0d2b398`](0d2b398), [`cd01f29`](cd01f29), [`a734fca`](a734fca), [`b342acf`](b342acf), [`2987cd1`](2987cd1), [`dfab1d5`](dfab1d5), [`4d71162`](4d71162)]: - @browserbasehq/stagehand@3.0.7 ## @browserbasehq/stagehand-evals@1.1.6 ### Patch Changes - [#1373](#1373) [`cadd192`](cadd192) Thanks [@tkattkat](https://github.com/tkattkat)! - Update screenshot collector in agent evals cli - Updated dependencies \[[`0f3991e`](0f3991e), [`e0e22e0`](e0e22e0), [`f261051`](f261051), [`e021674`](e021674), [`6a5496f`](6a5496f), [`fea1700`](fea1700), [`5b288d9`](5b288d9), [`e822f5a`](e822f5a), [`638efc7`](638efc7), [`a890f16`](a890f16), [`934f492`](934f492), [`bd2db92`](bd2db92), [`51e0170`](51e0170), [`05f5580`](05f5580), [`f56a9c2`](f56a9c2), [`b40ae11`](b40ae11), [`0d2b398`](0d2b398), [`cd01f29`](cd01f29), [`a734fca`](a734fca), [`b342acf`](b342acf), [`2987cd1`](2987cd1), [`dfab1d5`](dfab1d5), [`4d71162`](4d71162)]: - @browserbasehq/stagehand@3.0.7 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# why Move cua to mode enum for consistency across modes # what changed deprecated cua: true, in favor of mode: "cua" # test plan tested locally <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Move CUA config from a boolean flag to the mode enum for consistency across agent modes. Use mode: "cua"; cua: true is deprecated and now emits a runtime warning. - **Refactors** - Added "cua" to AgentToolMode and updated public types/tests. - Deprecated AgentConfig.cua with a deprecation warning. - Centralized CUA detection (mode: "cua" or legacy cua: true) in validation, cache, and agent creation. - Improved agent logging to include mode and unified CUA feature checks. - **Migration** - Replace AgentConfig cua: true with mode: "cua". <sup>Written for commit 1f1b807. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
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.0.7 ### Patch Changes - [browserbase#1461](browserbase#1461) [`0f3991e`](browserbase@0f3991e) Thanks [@tkattkat](https://github.com/tkattkat)! - Move hybrid mode out of experimental - [browserbase#1433](browserbase#1433) [`e0e22e0`](browserbase@e0e22e0) Thanks [@tkattkat](https://github.com/tkattkat)! - Put hybrid mode behind experimental - [browserbase#1456](browserbase#1456) [`f261051`](browserbase@f261051) Thanks [@shrey150](https://github.com/shrey150)! - Invoke page.hover for agent move action - [browserbase#1473](browserbase#1473) [`e021674`](browserbase@e021674) Thanks [@shrey150](https://github.com/shrey150)! - Add safety confirmation support for OpenAI + Google CUA - [browserbase#1399](browserbase#1399) [`6a5496f`](browserbase@6a5496f) Thanks [@tkattkat](https://github.com/tkattkat)! - Ensure cua agent is killed when stagehand.close is called - [browserbase#1436](browserbase#1436) [`fea1700`](browserbase@fea1700) Thanks [@miguelg719](https://github.com/miguelg719)! - Fix auto-load key for act/extract/observe parametrized models on api - [browserbase#1439](browserbase#1439) [`5b288d9`](browserbase@5b288d9) Thanks [@tkattkat](https://github.com/tkattkat)! - Remove base64 from agent actions array ( still present in messages object ) - [browserbase#1408](browserbase#1408) [`e822f5a`](browserbase@e822f5a) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - allow for act() cache hit when variable values change - [browserbase#1472](browserbase#1472) [`638efc7`](browserbase@638efc7) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: agent cache not refreshed on action failure - [browserbase#1424](browserbase#1424) [`a890f16`](browserbase@a890f16) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: "Error: -32000 Failed to convert response to JSON: CBOR: stack limit exceeded" - [browserbase#1418](browserbase#1418) [`934f492`](browserbase@934f492) Thanks [@miguelg719](https://github.com/miguelg719)! - Cleanup handlers and bus listeners on close - [browserbase#1430](browserbase#1430) [`bd2db92`](browserbase@bd2db92) Thanks [@shrey150](https://github.com/shrey150)! - Fix CUA model coordinate translation - [browserbase#1465](browserbase#1465) [`51e0170`](browserbase@51e0170) Thanks [@miguelg719](https://github.com/miguelg719)! - Add media resolution high provider option to gemini 3 hybrid agent - [browserbase#1431](browserbase#1431) [`05f5580`](browserbase@05f5580) Thanks [@tkattkat](https://github.com/tkattkat)! - Update the cache handling for agent - [browserbase#1432](browserbase#1432) [`f56a9c2`](browserbase@f56a9c2) Thanks [@tkattkat](https://github.com/tkattkat)! - Deprecate cua: true in favor of mode: "cua" - [browserbase#1406](browserbase#1406) [`b40ae11`](browserbase@b40ae11) Thanks [@tkattkat](https://github.com/tkattkat)! - Add support for hovering with coordinates ( page.hover ) - [browserbase#1407](browserbase#1407) [`0d2b398`](browserbase@0d2b398) Thanks [@tkattkat](https://github.com/tkattkat)! - Clean up page methods - [browserbase#1412](browserbase#1412) [`cd01f29`](browserbase@cd01f29) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - fix: load GOOGLE_API_KEY from .env - [browserbase#1462](browserbase#1462) [`a734fca`](browserbase@a734fca) Thanks [@shrey150](https://github.com/shrey150)! - fix: correctly pass userDataDir to chrome launcher - [browserbase#1466](browserbase#1466) [`b342acf`](browserbase@b342acf) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - move playwright to optional dependencies - [browserbase#1440](browserbase#1440) [`2987cd1`](browserbase@2987cd1) Thanks [@tkattkat](https://github.com/tkattkat)! - [Feature] support excluding tools from agent - [browserbase#1455](browserbase#1455) [`dfab1d5`](browserbase@dfab1d5) Thanks [@seanmcguire12](https://github.com/seanmcguire12)! - update aisdk client to better enforce structured output with deepseek models - [browserbase#1428](browserbase#1428) [`4d71162`](browserbase@4d71162) Thanks [@tkattkat](https://github.com/tkattkat)! - Add "hybrid" mode to stagehand agent ## @browserbasehq/stagehand-server@3.2.0 ### Minor Changes - [browserbase#1459](browserbase#1459) [`abb3469`](browserbase@abb3469) Thanks [@monadoid](https://github.com/monadoid)! - Added building of binaries - [browserbase#1457](browserbase#1457) [`5fc1281`](browserbase@5fc1281) Thanks [@monadoid](https://github.com/monadoid)! - First changeset for stagehand-server - [browserbase#1469](browserbase#1469) [`d634d45`](browserbase@d634d45) Thanks [@monadoid](https://github.com/monadoid)! - Bump to test binary builds ### Patch Changes - Updated dependencies \[[`0f3991e`](browserbase@0f3991e), [`e0e22e0`](browserbase@e0e22e0), [`f261051`](browserbase@f261051), [`e021674`](browserbase@e021674), [`6a5496f`](browserbase@6a5496f), [`fea1700`](browserbase@fea1700), [`5b288d9`](browserbase@5b288d9), [`e822f5a`](browserbase@e822f5a), [`638efc7`](browserbase@638efc7), [`a890f16`](browserbase@a890f16), [`934f492`](browserbase@934f492), [`bd2db92`](browserbase@bd2db92), [`51e0170`](browserbase@51e0170), [`05f5580`](browserbase@05f5580), [`f56a9c2`](browserbase@f56a9c2), [`b40ae11`](browserbase@b40ae11), [`0d2b398`](browserbase@0d2b398), [`cd01f29`](browserbase@cd01f29), [`a734fca`](browserbase@a734fca), [`b342acf`](browserbase@b342acf), [`2987cd1`](browserbase@2987cd1), [`dfab1d5`](browserbase@dfab1d5), [`4d71162`](browserbase@4d71162)]: - @browserbasehq/stagehand@3.0.7 ## @browserbasehq/stagehand-evals@1.1.6 ### Patch Changes - [browserbase#1373](browserbase#1373) [`cadd192`](browserbase@cadd192) Thanks [@tkattkat](https://github.com/tkattkat)! - Update screenshot collector in agent evals cli - Updated dependencies \[[`0f3991e`](browserbase@0f3991e), [`e0e22e0`](browserbase@e0e22e0), [`f261051`](browserbase@f261051), [`e021674`](browserbase@e021674), [`6a5496f`](browserbase@6a5496f), [`fea1700`](browserbase@fea1700), [`5b288d9`](browserbase@5b288d9), [`e822f5a`](browserbase@e822f5a), [`638efc7`](browserbase@638efc7), [`a890f16`](browserbase@a890f16), [`934f492`](browserbase@934f492), [`bd2db92`](browserbase@bd2db92), [`51e0170`](browserbase@51e0170), [`05f5580`](browserbase@05f5580), [`f56a9c2`](browserbase@f56a9c2), [`b40ae11`](browserbase@b40ae11), [`0d2b398`](browserbase@0d2b398), [`cd01f29`](browserbase@cd01f29), [`a734fca`](browserbase@a734fca), [`b342acf`](browserbase@b342acf), [`2987cd1`](browserbase@2987cd1), [`dfab1d5`](browserbase@dfab1d5), [`4d71162`](browserbase@4d71162)]: - @browserbasehq/stagehand@3.0.7
why
Move cua to mode enum for consistency across modes
what changed
deprecated cua: true, in favor of mode: "cua"
test plan
tested locally
Summary by cubic
Move CUA config from a boolean flag to the mode enum for consistency across agent modes. Use mode: "cua"; cua: true is deprecated and now emits a runtime warning.
Refactors
Migration
Written for commit 1f1b807. Summary will update automatically on new commits.