Skip to content

Commit 996729c

Browse files
release: 0.5.0 (#6)
* feat(api): manual updates * docs: add more examples * feat: [STG-1053] [server] Use fastify-zod-openapi + zod v4 for openapi generation * codegen metadata * codegen metadata * release: 0.5.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent a41c8c5 commit 996729c

32 files changed

Lines changed: 809 additions & 120 deletions

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.4.0"
2+
".": "0.5.0"
33
}

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-f7d6b6489159f611a2bfdc267ce0a6fc0455bed1ffa0c310044baaa5d8381b9b.yml
3-
openapi_spec_hash: cd88d8068abfde8382da0bed674e440c
4-
config_hash: 5c69fb596588b8ace08203858518c149
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-ed52466945f2f8dfd3814a29e948d7bf30af7b76a7a7689079c03b8baf64e26f.yml
3+
openapi_spec_hash: 5d57aaf2362b0d882372dbf76477ba23
4+
config_hash: 989ddfee371586e9156b4d484ec0a6cc

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 0.5.0 (2025-12-23)
4+
5+
Full Changelog: [v0.4.0...v0.5.0](https://github.com/browserbase/stagehand-ruby/compare/v0.4.0...v0.5.0)
6+
7+
### Features
8+
9+
* [STG-1053] [server] Use fastify-zod-openapi + zod v4 for openapi generation ([926a819](https://github.com/browserbase/stagehand-ruby/commit/926a819a4bbe2b260d3dbd46b860c444f60857bf))
10+
* **api:** manual updates ([0619302](https://github.com/browserbase/stagehand-ruby/commit/061930217b3efce30e29cf8b2511970b21c86c57))
11+
12+
13+
### Documentation
14+
15+
* add more examples ([3e81eba](https://github.com/browserbase/stagehand-ruby/commit/3e81eba0b962a3ec0c9a8b13fc9ae30f0961663e))
16+
317
## 0.4.0 (2025-12-19)
418

519
Full Changelog: [v0.3.0...v0.4.0](https://github.com/browserbase/stagehand-ruby/compare/v0.3.0...v0.4.0)

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GIT
1111
PATH
1212
remote: .
1313
specs:
14-
stagehand (0.4.0)
14+
stagehand (0.5.0)
1515
connection_pool
1616

1717
GEM

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
1717
<!-- x-release-please-start-version -->
1818

1919
```ruby
20-
gem "stagehand", "~> 0.4.0"
20+
gem "stagehand", "~> 0.5.0"
2121
```
2222

2323
<!-- x-release-please-end -->
@@ -39,6 +39,21 @@ response = stagehand.sessions.act("00000000-your-session-id-000000000000", input
3939
puts(response.data)
4040
```
4141

42+
### Streaming
43+
44+
We provide support for streaming responses using Server-Sent Events (SSE).
45+
46+
```ruby
47+
stream = stagehand.sessions.act_streaming(
48+
"00000000-your-session-id-000000000000",
49+
input: "click the first link on the page"
50+
)
51+
52+
stream.each do |session|
53+
puts(session.data)
54+
end
55+
```
56+
4257
### Handling errors
4358

4459
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Stagehand::Errors::APIError` will be thrown:

lib/stagehand/models/action.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ class Action < Stagehand::Internal::Type::BaseModel
2121
# @return [Array<String>, nil]
2222
optional :arguments, Stagehand::Internal::Type::ArrayOf[String]
2323

24+
# @!attribute backend_node_id
25+
# Backend node ID for the element
26+
#
27+
# @return [Float, nil]
28+
optional :backend_node_id, Float, api_name: :backendNodeId
29+
2430
# @!attribute method_
2531
# The method to execute (click, fill, etc.)
2632
#
2733
# @return [String, nil]
2834
optional :method_, String, api_name: :method
2935

30-
# @!method initialize(description:, selector:, arguments: nil, method_: nil)
36+
# @!method initialize(description:, selector:, arguments: nil, backend_node_id: nil, method_: nil)
3137
# Action object returned by observe and used by act
3238
#
3339
# @param description [String] Human-readable description of the action
@@ -36,6 +42,8 @@ class Action < Stagehand::Internal::Type::BaseModel
3642
#
3743
# @param arguments [Array<String>] Arguments to pass to the method
3844
#
45+
# @param backend_node_id [Float] Backend node ID for the element
46+
#
3947
# @param method_ [String] The method to execute (click, fill, etc.)
4048
end
4149
end

lib/stagehand/models/model_config.rb

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,35 @@ class ModelConfigObject < Stagehand::Internal::Type::BaseModel
3131
# @return [String, nil]
3232
optional :base_url, String, api_name: :baseURL
3333

34-
# @!method initialize(model_name:, api_key: nil, base_url: nil)
34+
# @!attribute provider
35+
# AI provider for the model (or provide a baseURL endpoint instead)
36+
#
37+
# @return [Symbol, Stagehand::Models::ModelConfig::ModelConfigObject::Provider, nil]
38+
optional :provider, enum: -> { Stagehand::ModelConfig::ModelConfigObject::Provider }
39+
40+
# @!method initialize(model_name:, api_key: nil, base_url: nil, provider: nil)
3541
# @param model_name [String] Model name string without prefix (e.g., 'gpt-5-nano', 'claude-4.5-opus')
3642
#
3743
# @param api_key [String] API key for the model provider
3844
#
3945
# @param base_url [String] Base URL for the model provider
46+
#
47+
# @param provider [Symbol, Stagehand::Models::ModelConfig::ModelConfigObject::Provider] AI provider for the model (or provide a baseURL endpoint instead)
48+
49+
# AI provider for the model (or provide a baseURL endpoint instead)
50+
#
51+
# @see Stagehand::Models::ModelConfig::ModelConfigObject#provider
52+
module Provider
53+
extend Stagehand::Internal::Type::Enum
54+
55+
OPENAI = :openai
56+
ANTHROPIC = :anthropic
57+
GOOGLE = :google
58+
MICROSOFT = :microsoft
59+
60+
# @!method self.values
61+
# @return [Array<Symbol>]
62+
end
4063
end
4164

4265
# @!method self.variants

lib/stagehand/models/session_act_response.rb

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ class Result < Stagehand::Internal::Type::BaseModel
5151
# @!attribute actions
5252
# List of actions that were executed
5353
#
54-
# @return [Array<Stagehand::Models::Action>]
55-
required :actions, -> { Stagehand::Internal::Type::ArrayOf[Stagehand::Action] }
54+
# @return [Array<Stagehand::Models::SessionActResponse::Data::Result::Action>]
55+
required :actions,
56+
-> { Stagehand::Internal::Type::ArrayOf[Stagehand::Models::SessionActResponse::Data::Result::Action] }
5657

5758
# @!attribute message
5859
# Human-readable result message
@@ -69,11 +70,56 @@ class Result < Stagehand::Internal::Type::BaseModel
6970
# @!method initialize(action_description:, actions:, message:, success:)
7071
# @param action_description [String] Description of the action that was performed
7172
#
72-
# @param actions [Array<Stagehand::Models::Action>] List of actions that were executed
73+
# @param actions [Array<Stagehand::Models::SessionActResponse::Data::Result::Action>] List of actions that were executed
7374
#
7475
# @param message [String] Human-readable result message
7576
#
7677
# @param success [Boolean] Whether the action completed successfully
78+
79+
class Action < Stagehand::Internal::Type::BaseModel
80+
# @!attribute description
81+
# Human-readable description of the action
82+
#
83+
# @return [String]
84+
required :description, String
85+
86+
# @!attribute selector
87+
# CSS selector or XPath for the element
88+
#
89+
# @return [String]
90+
required :selector, String
91+
92+
# @!attribute arguments
93+
# Arguments to pass to the method
94+
#
95+
# @return [Array<String>, nil]
96+
optional :arguments, Stagehand::Internal::Type::ArrayOf[String]
97+
98+
# @!attribute backend_node_id
99+
# Backend node ID for the element
100+
#
101+
# @return [Float, nil]
102+
optional :backend_node_id, Float, api_name: :backendNodeId
103+
104+
# @!attribute method_
105+
# The method to execute (click, fill, etc.)
106+
#
107+
# @return [String, nil]
108+
optional :method_, String, api_name: :method
109+
110+
# @!method initialize(description:, selector:, arguments: nil, backend_node_id: nil, method_: nil)
111+
# Action object returned by observe and used by act
112+
#
113+
# @param description [String] Human-readable description of the action
114+
#
115+
# @param selector [String] CSS selector or XPath for the element
116+
#
117+
# @param arguments [Array<String>] Arguments to pass to the method
118+
#
119+
# @param backend_node_id [Float] Backend node ID for the element
120+
#
121+
# @param method_ [String] The method to execute (click, fill, etc.)
122+
end
77123
end
78124
end
79125
end

lib/stagehand/models/session_execute_params.rb

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,44 @@ class AgentConfig < Stagehand::Internal::Type::BaseModel
8282
# @return [String, Stagehand::Models::ModelConfig::ModelConfigObject, nil]
8383
optional :model, union: -> { Stagehand::ModelConfig }
8484

85+
# @!attribute provider
86+
# AI provider for the agent (legacy, use model: openai/gpt-5-nano instead)
87+
#
88+
# @return [Symbol, Stagehand::Models::SessionExecuteParams::AgentConfig::Provider, nil]
89+
optional :provider, enum: -> { Stagehand::SessionExecuteParams::AgentConfig::Provider }
90+
8591
# @!attribute system_prompt
8692
# Custom system prompt for the agent
8793
#
8894
# @return [String, nil]
8995
optional :system_prompt, String, api_name: :systemPrompt
9096

91-
# @!method initialize(cua: nil, model: nil, system_prompt: nil)
97+
# @!method initialize(cua: nil, model: nil, provider: nil, system_prompt: nil)
9298
# Some parameter documentations has been truncated, see
9399
# {Stagehand::Models::SessionExecuteParams::AgentConfig} for more details.
94100
#
95101
# @param cua [Boolean] Enable Computer Use Agent mode
96102
#
97103
# @param model [String, Stagehand::Models::ModelConfig::ModelConfigObject] Model name string with provider prefix (e.g., 'openai/gpt-5-nano', 'anthropic/cl
98104
#
105+
# @param provider [Symbol, Stagehand::Models::SessionExecuteParams::AgentConfig::Provider] AI provider for the agent (legacy, use model: openai/gpt-5-nano instead)
106+
#
99107
# @param system_prompt [String] Custom system prompt for the agent
108+
109+
# AI provider for the agent (legacy, use model: openai/gpt-5-nano instead)
110+
#
111+
# @see Stagehand::Models::SessionExecuteParams::AgentConfig#provider
112+
module Provider
113+
extend Stagehand::Internal::Type::Enum
114+
115+
OPENAI = :openai
116+
ANTHROPIC = :anthropic
117+
GOOGLE = :google
118+
MICROSOFT = :microsoft
119+
120+
# @!method self.values
121+
# @return [Array<Symbol>]
122+
end
100123
end
101124

102125
class ExecuteOptions < Stagehand::Internal::Type::BaseModel

lib/stagehand/models/session_observe_response.rb

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ class SessionObserveResponse < Stagehand::Internal::Type::BaseModel
2626
class Data < Stagehand::Internal::Type::BaseModel
2727
# @!attribute result
2828
#
29-
# @return [Array<Stagehand::Models::Action>]
30-
required :result, -> { Stagehand::Internal::Type::ArrayOf[Stagehand::Action] }
29+
# @return [Array<Stagehand::Models::SessionObserveResponse::Data::Result>]
30+
required :result,
31+
-> { Stagehand::Internal::Type::ArrayOf[Stagehand::Models::SessionObserveResponse::Data::Result] }
3132

3233
# @!attribute action_id
3334
# Action ID for tracking
@@ -36,9 +37,54 @@ class Data < Stagehand::Internal::Type::BaseModel
3637
optional :action_id, String, api_name: :actionId
3738

3839
# @!method initialize(result:, action_id: nil)
39-
# @param result [Array<Stagehand::Models::Action>]
40+
# @param result [Array<Stagehand::Models::SessionObserveResponse::Data::Result>]
4041
#
4142
# @param action_id [String] Action ID for tracking
43+
44+
class Result < Stagehand::Internal::Type::BaseModel
45+
# @!attribute description
46+
# Human-readable description of the action
47+
#
48+
# @return [String]
49+
required :description, String
50+
51+
# @!attribute selector
52+
# CSS selector or XPath for the element
53+
#
54+
# @return [String]
55+
required :selector, String
56+
57+
# @!attribute arguments
58+
# Arguments to pass to the method
59+
#
60+
# @return [Array<String>, nil]
61+
optional :arguments, Stagehand::Internal::Type::ArrayOf[String]
62+
63+
# @!attribute backend_node_id
64+
# Backend node ID for the element
65+
#
66+
# @return [Float, nil]
67+
optional :backend_node_id, Float, api_name: :backendNodeId
68+
69+
# @!attribute method_
70+
# The method to execute (click, fill, etc.)
71+
#
72+
# @return [String, nil]
73+
optional :method_, String, api_name: :method
74+
75+
# @!method initialize(description:, selector:, arguments: nil, backend_node_id: nil, method_: nil)
76+
# Action object returned by observe and used by act
77+
#
78+
# @param description [String] Human-readable description of the action
79+
#
80+
# @param selector [String] CSS selector or XPath for the element
81+
#
82+
# @param arguments [Array<String>] Arguments to pass to the method
83+
#
84+
# @param backend_node_id [Float] Backend node ID for the element
85+
#
86+
# @param method_ [String] The method to execute (click, fill, etc.)
87+
end
4288
end
4389
end
4490
end

0 commit comments

Comments
 (0)