Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,40 @@ on:
- 'stl-preview-base/**'

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/stagehand-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/stagehand-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork)
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: |-
bundle install

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/stagehand-ruby'
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload gem artifacts
if: github.repository == 'stainless-sdks/stagehand-ruby'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: stagehand
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.7.1"
".": "3.7.2"
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 3.7.2 (2026-03-06)

Full Changelog: [v3.7.1...v3.7.2](https://github.com/browserbase/stagehand-ruby/compare/v3.7.1...v3.7.2)

### Chores

* **ci:** add build step ([ed6573f](https://github.com/browserbase/stagehand-ruby/commit/ed6573f2ddab4f5f51d1262480cb663da5e003d0))
* **internal:** codegen related update ([f714af2](https://github.com/browserbase/stagehand-ruby/commit/f714af2d7d5b9b822362aa10f6f6facab3332eaf))
* **internal:** codegen related update ([ed9fab1](https://github.com/browserbase/stagehand-ruby/commit/ed9fab1f726c05ef48d4a55507b09212d7ced713))

## 3.7.1 (2026-02-27)

Full Changelog: [v3.7.0...v3.7.1](https://github.com/browserbase/stagehand-ruby/compare/v3.7.0...v3.7.1)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
stagehand (3.7.1)
stagehand (3.7.2)
cgi
connection_pool

Expand Down
31 changes: 31 additions & 0 deletions lib/stagehand/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,37 @@ def writable_enum(&blk)
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}

class << self
# @api private
#
# @param query [Hash{Symbol=>Object}]
#
# @return [Hash{Symbol=>Object}]
def encode_query_params(query)
out = {}
query.each { write_query_param_element!(out, _1, _2) }
out
end

# @api private
#
# @param collection [Hash{Symbol=>Object}]
# @param key [String]
# @param element [Object]
#
# @return [nil]
private def write_query_param_element!(collection, key, element)
case element
in Hash
element.each do |name, value|
write_query_param_element!(collection, "#{key}[#{name}]", value)
end
in Array
collection[key] = element.map(&:to_s).join(",")
else
collection[key] = element.to_s
end
end

# @api private
#
# @param y [Enumerator::Yielder]
Expand Down
10 changes: 9 additions & 1 deletion lib/stagehand/models/session_act_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class SessionActParams < Stagehand::Internal::Type::BaseModel
extend Stagehand::Internal::Type::RequestParameters::Converter
include Stagehand::Internal::Type::RequestParameters

# @!attribute id
# Unique session identifier
#
# @return [String]
required :id, String

# @!attribute input
# Natural language instruction or Action object
#
Expand All @@ -32,7 +38,9 @@ class SessionActParams < Stagehand::Internal::Type::BaseModel
# @return [Symbol, Stagehand::Models::SessionActParams::XStreamResponse, nil]
optional :x_stream_response, enum: -> { Stagehand::SessionActParams::XStreamResponse }

# @!method initialize(input:, frame_id: nil, options: nil, x_stream_response: nil, request_options: {})
# @!method initialize(id:, input:, frame_id: nil, options: nil, x_stream_response: nil, request_options: {})
# @param id [String] Unique session identifier
#
# @param input [String, Stagehand::Models::Action] Natural language instruction or Action object
#
# @param frame_id [String, nil] Target frame ID for the action
Expand Down
10 changes: 9 additions & 1 deletion lib/stagehand/models/session_end_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ class SessionEndParams < Stagehand::Internal::Type::BaseModel
extend Stagehand::Internal::Type::RequestParameters::Converter
include Stagehand::Internal::Type::RequestParameters

# @!attribute id
# Unique session identifier
#
# @return [String]
required :id, String

# @!attribute x_stream_response
# Whether to stream the response via SSE
#
# @return [Symbol, Stagehand::Models::SessionEndParams::XStreamResponse, nil]
optional :x_stream_response, enum: -> { Stagehand::SessionEndParams::XStreamResponse }

# @!method initialize(x_stream_response: nil, request_options: {})
# @!method initialize(id:, x_stream_response: nil, request_options: {})
# @param id [String] Unique session identifier
#
# @param x_stream_response [Symbol, Stagehand::Models::SessionEndParams::XStreamResponse] Whether to stream the response via SSE
#
# @param request_options [Stagehand::RequestOptions, Hash{Symbol=>Object}]
Expand Down
10 changes: 9 additions & 1 deletion lib/stagehand/models/session_execute_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class SessionExecuteParams < Stagehand::Internal::Type::BaseModel
extend Stagehand::Internal::Type::RequestParameters::Converter
include Stagehand::Internal::Type::RequestParameters

# @!attribute id
# Unique session identifier
#
# @return [String]
required :id, String

# @!attribute agent_config
#
# @return [Stagehand::Models::SessionExecuteParams::AgentConfig]
Expand Down Expand Up @@ -39,7 +45,9 @@ class SessionExecuteParams < Stagehand::Internal::Type::BaseModel
# @return [Symbol, Stagehand::Models::SessionExecuteParams::XStreamResponse, nil]
optional :x_stream_response, enum: -> { Stagehand::SessionExecuteParams::XStreamResponse }

# @!method initialize(agent_config:, execute_options:, frame_id: nil, should_cache: nil, x_stream_response: nil, request_options: {})
# @!method initialize(id:, agent_config:, execute_options:, frame_id: nil, should_cache: nil, x_stream_response: nil, request_options: {})
# @param id [String] Unique session identifier
#
# @param agent_config [Stagehand::Models::SessionExecuteParams::AgentConfig]
#
# @param execute_options [Stagehand::Models::SessionExecuteParams::ExecuteOptions]
Expand Down
10 changes: 9 additions & 1 deletion lib/stagehand/models/session_extract_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class SessionExtractParams < Stagehand::Internal::Type::BaseModel
extend Stagehand::Internal::Type::RequestParameters::Converter
include Stagehand::Internal::Type::RequestParameters

# @!attribute id
# Unique session identifier
#
# @return [String]
required :id, String

# @!attribute frame_id
# Target frame ID for the extraction
#
Expand Down Expand Up @@ -38,7 +44,9 @@ class SessionExtractParams < Stagehand::Internal::Type::BaseModel
# @return [Symbol, Stagehand::Models::SessionExtractParams::XStreamResponse, nil]
optional :x_stream_response, enum: -> { Stagehand::SessionExtractParams::XStreamResponse }

# @!method initialize(frame_id: nil, instruction: nil, options: nil, schema: nil, x_stream_response: nil, request_options: {})
# @!method initialize(id:, frame_id: nil, instruction: nil, options: nil, schema: nil, x_stream_response: nil, request_options: {})
# @param id [String] Unique session identifier
#
# @param frame_id [String, nil] Target frame ID for the extraction
#
# @param instruction [String] Natural language instruction for what to extract
Expand Down
10 changes: 9 additions & 1 deletion lib/stagehand/models/session_navigate_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ class SessionNavigateParams < Stagehand::Internal::Type::BaseModel
extend Stagehand::Internal::Type::RequestParameters::Converter
include Stagehand::Internal::Type::RequestParameters

# @!attribute id
# Unique session identifier
#
# @return [String]
required :id, String

# @!attribute url
# URL to navigate to
#
Expand Down Expand Up @@ -36,7 +42,9 @@ class SessionNavigateParams < Stagehand::Internal::Type::BaseModel
# @return [Symbol, Stagehand::Models::SessionNavigateParams::XStreamResponse, nil]
optional :x_stream_response, enum: -> { Stagehand::SessionNavigateParams::XStreamResponse }

# @!method initialize(url:, frame_id: nil, options: nil, stream_response: nil, x_stream_response: nil, request_options: {})
# @!method initialize(id:, url:, frame_id: nil, options: nil, stream_response: nil, x_stream_response: nil, request_options: {})
# @param id [String] Unique session identifier
#
# @param url [String] URL to navigate to
#
# @param frame_id [String, nil] Target frame ID for the navigation
Expand Down
10 changes: 9 additions & 1 deletion lib/stagehand/models/session_observe_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class SessionObserveParams < Stagehand::Internal::Type::BaseModel
extend Stagehand::Internal::Type::RequestParameters::Converter
include Stagehand::Internal::Type::RequestParameters

# @!attribute id
# Unique session identifier
#
# @return [String]
required :id, String

# @!attribute frame_id
# Target frame ID for the observation
#
Expand All @@ -32,7 +38,9 @@ class SessionObserveParams < Stagehand::Internal::Type::BaseModel
# @return [Symbol, Stagehand::Models::SessionObserveParams::XStreamResponse, nil]
optional :x_stream_response, enum: -> { Stagehand::SessionObserveParams::XStreamResponse }

# @!method initialize(frame_id: nil, instruction: nil, options: nil, x_stream_response: nil, request_options: {})
# @!method initialize(id:, frame_id: nil, instruction: nil, options: nil, x_stream_response: nil, request_options: {})
# @param id [String] Unique session identifier
#
# @param frame_id [String, nil] Target frame ID for the observation
#
# @param instruction [String] Natural language instruction for what actions to find
Expand Down
10 changes: 9 additions & 1 deletion lib/stagehand/models/session_replay_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ class SessionReplayParams < Stagehand::Internal::Type::BaseModel
extend Stagehand::Internal::Type::RequestParameters::Converter
include Stagehand::Internal::Type::RequestParameters

# @!attribute id
# Unique session identifier
#
# @return [String]
required :id, String

# @!attribute x_stream_response
# Whether to stream the response via SSE
#
# @return [Symbol, Stagehand::Models::SessionReplayParams::XStreamResponse, nil]
optional :x_stream_response, enum: -> { Stagehand::SessionReplayParams::XStreamResponse }

# @!method initialize(x_stream_response: nil, request_options: {})
# @!method initialize(id:, x_stream_response: nil, request_options: {})
# @param id [String] Unique session identifier
#
# @param x_stream_response [Symbol, Stagehand::Models::SessionReplayParams::XStreamResponse] Whether to stream the response via SSE
#
# @param request_options [Stagehand::RequestOptions, Hash{Symbol=>Object}]
Expand Down
2 changes: 1 addition & 1 deletion lib/stagehand/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Stagehand
VERSION = "3.7.1"
VERSION = "3.7.2"
end
20 changes: 20 additions & 0 deletions rbi/stagehand/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,26 @@ module Stagehand
T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)

class << self
# @api private
sig do
params(query: Stagehand::Internal::AnyHash).returns(
Stagehand::Internal::AnyHash
)
end
def encode_query_params(query)
end

# @api private
sig do
params(
collection: Stagehand::Internal::AnyHash,
key: String,
element: T.anything
).void
end
private def write_query_param_element!(collection, key, element)
end

# @api private
sig do
params(
Expand Down
8 changes: 8 additions & 0 deletions rbi/stagehand/models/session_act_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ module Stagehand
T.any(Stagehand::SessionActParams, Stagehand::Internal::AnyHash)
end

# Unique session identifier
sig { returns(String) }
attr_accessor :id

# Natural language instruction or Action object
sig { returns(T.any(String, Stagehand::Action)) }
attr_accessor :input
Expand Down Expand Up @@ -43,6 +47,7 @@ module Stagehand

sig do
params(
id: String,
input: T.any(String, Stagehand::Action::OrHash),
frame_id: T.nilable(String),
options: Stagehand::SessionActParams::Options::OrHash,
Expand All @@ -52,6 +57,8 @@ module Stagehand
).returns(T.attached_class)
end
def self.new(
# Unique session identifier
id:,
# Natural language instruction or Action object
input:,
# Target frame ID for the action
Expand All @@ -66,6 +73,7 @@ module Stagehand
sig do
override.returns(
{
id: String,
input: T.any(String, Stagehand::Action),
frame_id: T.nilable(String),
options: Stagehand::SessionActParams::Options,
Expand Down
8 changes: 8 additions & 0 deletions rbi/stagehand/models/session_end_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ module Stagehand
T.any(Stagehand::SessionEndParams, Stagehand::Internal::AnyHash)
end

# Unique session identifier
sig { returns(String) }
attr_accessor :id

# Whether to stream the response via SSE
sig do
returns(
Expand All @@ -29,12 +33,15 @@ module Stagehand

sig do
params(
id: String,
x_stream_response:
Stagehand::SessionEndParams::XStreamResponse::OrSymbol,
request_options: Stagehand::RequestOptions::OrHash
).returns(T.attached_class)
end
def self.new(
# Unique session identifier
id:,
# Whether to stream the response via SSE
x_stream_response: nil,
request_options: {}
Expand All @@ -44,6 +51,7 @@ module Stagehand
sig do
override.returns(
{
id: String,
x_stream_response:
Stagehand::SessionEndParams::XStreamResponse::OrSymbol,
request_options: Stagehand::RequestOptions
Expand Down
Loading