fix: support Claude 4.6 CUA tool version
Merged
SH
9mo ago+27+27+01234567890123456789-2-2-0123456789
Summary
- Claude Opus 4.6 and Sonnet 4.6 require the newer
computer_20251124tool type andcomputer-use-2025-11-24beta header for CUA mode - The previous hardcoded
computer_20250124is rejected by the Anthropic API for these models - Adds conditional tool version selection in
AnthropicCUAClient.getAction()ā older models are unaffected - Adds
claude-sonnet-4-6to model maps (Opus 4.6 was already present)
Test plan
- Direct Anthropic API calls confirmed both Opus 4.6 and Sonnet 4.6 work with
computer_20251124 - Stagehand
env: "LOCAL"CUA mode tested ā both models successfully completed tasks - Unit tests pass (18/18 in
llm-and-agents.test.ts) - Verify older models (Sonnet 4, Sonnet 4.5, Haiku 4.5) still work with
computer_20250124
š¤ Generated with Claude Code
Summary by cubic
Adds CUA support for Claude Opus 4.6 and Sonnet 4.6 by switching to the computer_20251124 tool and computer-use-2025-11-24 beta. Older models continue using computer_20250124 to avoid API rejections.
- Bug Fixes
- Select tool/beta per model in AnthropicCUAClient.getAction(), including prefixed names.
- Use new tool/beta for claude-opus-4-6, claude-sonnet-4-6, and claude-opus-4-5-20251101.
- Add claude-sonnet-4-6 to modelToAgentProviderMap and AVAILABLE_CUA_MODELS; update unit tests.