Add Claude native browser use through the shared facade runtime

Merged
MI
2mo ago
+4200-3

Adds Claude native browser use through the shared CUA bridge and canonical facade. Native tool instructions remain separate from internal mount instructions, and the shared autonomy policy is injected once through the native system channel. Includes package, build, and CI registration.

Retains thinking, tool-result blocks, usage presence, and screenshot evidence. API history can discard older screenshots without mutating verification events. Unmatched calls carry a missing-result failure instead of appearing successful. Diagnostic logs contain tool name/status/duration; original tool inputs stay in session evidence, and abort diagnostics are sanitized.

Tab operations use the canonical visible context and readonly page.pageId. Keeper pages cannot enter tab inventory or be selected/closed; legitimate visible blank pages remain available. Explicit tab_id actions refresh active identity before executing. A first reference action without cached tab state adds one inventory call to obtain real IDs. Typed canonical session-loss errors or runner-owned telemetry stop execution; page error text alone cannot impersonate browser loss.

Drag uses the SDK dragAndDrop primitive. Separate held-button down/up gestures and modifier clicks receive actionable unsupported errors; complete drag and ordinary clicks are supported. Partial toolset configuration preserves member defaults, literal Space is accepted, find text is capped, and transcript clipping preserves surrogate pairs.

Validation: 72 tests pass across 8 files, including 55 Claude SDK tests, native eval/runner/mount tests, and the compiled facade/MCP fixture. Tests execute generated snippets through actual canonical StagehandFacadeTools and SDK Page/BrowserContext objects over in-memory RPC. Claude SDK and full eval typechecks, matching core/Claude SDK builds, and scoped formatting pass. Generated test artifacts under dist/.turbo/node_modules leave the task cache inputs and hash unchanged. Provider responses are scripted; these checks do not establish live browser gestures, model performance, or disconnect recovery.

Stack base: evals/consolidation-15-shared-cua-bridge. Review this PR relative to its immediate predecessor.

Reviewer entry points:

Review fixes: Refresh visible tabs after coordinate and ref actions so popups appear in the same tool result while keeper tabs stay hidden. Missing page IDs now raise a typed facade error. Diagnostic tests assert member names, success status, and duration alongside secret redaction. Updated tests cover the real SDK/facade and MCP boundaries; all three review threads are resolved after passing CI.

Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.