Skip to content

feat(ruby): M1–M2 — core interactions + full outbound surface (76/77) - #2854

Draft
filip-michalsky wants to merge 3 commits into
filipmichalsky/ap-2857-spike-effort-scoping-for-ruby-in-stagehand-v4from
filipmichalsky/ruby-sdk-m1-m2
Draft

feat(ruby): M1–M2 — core interactions + full outbound surface (76/77)#2854
filip-michalsky wants to merge 3 commits into
filipmichalsky/ap-2857-spike-effort-scoping-for-ruby-in-stagehand-v4from
filipmichalsky/ruby-sdk-m1-m2

Conversation

@filip-michalsky

Copy link
Copy Markdown
Collaborator

Part of the AP-2857 parity stack (stacked on the spike PR #2820):

Stack: #2820 (spike) ← this PR (M1–M2) ← M3 ← M4 (#2851)

M1 — core interactions

  • Locator (click/fill/type/readers/set_input_files + first/nth), FilePayload uploads (50 MiB cap)
  • Page input/evaluate/screenshot/wait_for_* family, navigation history
  • Examples: page_interactions.rb, file_upload.rb, hybrid_news.rb, search_flow.rb

M2 — complete outbound surface (76 of 77 methods)

  • Stagehand::Response for navigations (status/headers/body/security_details/finished)
  • Page events: page.on("console") { … }CDPSubscription over page.cdp_event, idempotent unsubscribe
  • Remaining page.* (drag_and_drop, snapshot, init scripts, headers, viewport, close), full context.* (cookies with String/Regexp filters, clipboard ×6, domain policy), WebMCP ×4
  • stagehand.callback_batch CDP delivery (callback source travels as live code, expression identical to Python/TS) exposed as Client#experimental_batch
  • Examples: batch.rb, page_events.rb, context_and_response.rb

Verification

  • 97 unit tests / 677 assertions, generator drift check clean, gem builds
  • Live on local Chrome and Browserbase

The one method not in this PR — inbound llm.generate — lands in the M3 PR above this one.

🤖 Generated with Claude Code

filip-michalsky and others added 3 commits August 28, 2026 21:47
Milestone 1 toward v4 parity for the Ruby SDK (release bar per PM:
parity with the other v4 languages):

- Locator (new): click/fill/type/count/text_content/inner_text/
  input_value/visible?/checked?/set_input_files, with first/nth
  chaining; created via page.locator(selector).
- FileUpload (new): path/FilePayload normalization, 50 MiB limit,
  base64 wire payloads — port of file_upload.py.
- Page: click/hover/scroll/type/key_press, evaluate, screenshot
  (base64 decode + optional path write, mask via locators),
  reload/go_back/go_forward, wait_for_load_state/selector/timeout,
  locator factory.
- Tests: shared FakeTransport extracted to test/support, new
  locator/page/file-upload suites (61 runs, 484 assertions).
- Examples: file_upload.rb (mirrors Python) and page_interactions.rb —
  both LLM-free, verified live on local Chrome AND Browserbase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…low)

Two workflow examples exercising the milestone-1 surface end to end:
hybrid_news.rb (Hacker News: locator counts, schema extract of top
stories, locator-click pagination, screenshot) and search_flow.rb
(DuckDuckGo: locator fill + Enter, wait_for_selector, schema extract
of results). Both verified live on Browserbase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Milestone 2 of the parity roadmap: every outbound protocol method is now
wrapped; only inbound llm.generate (client-side LLM) remains.

- Response: navigation methods return Stagehand::Response (all_headers,
  headers_array, security_details, server_addr, body/text/json, finished)
- Page: drag_and_drop, add_init_script, set_extra_http_headers,
  set_viewport_size, snapshot, close, page.on/off console events
  (CDPSubscription over page.cdp_event notifications), WebMCP tools
- Locator: hover, scroll_to, inner_html, centroid, highlight,
  send_click_event, select_option (all 17 locator methods)
- Context: close, init scripts, headers, domain policy, cookies
  (add/read/clear with Regexp filters), clipboard (6 methods)
- stagehand.callback_batch: CDP delivery expression (identical to the
  sibling SDKs) + Client#experimental_batch
- Examples: batch.rb, page_events.rb (canonical ports), and
  context_and_response.rb — all live-verified on local Chrome and
  Browserbase (page_events includes Gateway-backed extract)
- Tests: 97 runs / 677 assertions

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ecc1a9e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant