stagehand 3.18.0 → 3.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74284602dc9bdaf010605da5b97177bfa1335a28e7e2048f924a0025298f5a8d
4
- data.tar.gz: 45de340a9ce93503b5cd851e87ebc862311fd7c59e5940c5b2b507b8d67ab56a
3
+ metadata.gz: f3995180e65110d8a64695b7be8cb095b24e8d6fb3bc2627f13df4c0acaa15f2
4
+ data.tar.gz: a0b8bcd2648d2429b55c13b50d60fb7ec46da97118390900d1acfe0989e728d4
5
5
  SHA512:
6
- metadata.gz: f50f38f6542f249eb99c63399f8d963f37b447e78d40d641c9f535076f671a04c70a9850d31c9f7533dd105d0fa20bf6305b5fdb3928fc38f839f9524285cd00
7
- data.tar.gz: cc10728334054f28603904751f0a4b69a773ea6b4445dfd3b336e9a4eae0a029a8b819208b925cb317a1499bbf298f97233355e0c07d59b9a82f6ea3d2facc72
6
+ metadata.gz: 83eae8bebac5087cda9551141db3d62bff7a0caa065ff675799610237d3ebf5114b62bb519403a3063e147b9384721d6bc0fdca28ce222c08691326f0a8b5e82
7
+ data.tar.gz: 7461914b6798606c6f0a672074ed3eaba504a82794e97becf1974de15cf701ce25ceec987d6969bb833d2ef098a5562da41f7faad6b1e871c75bba3ed4b4cda9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.19.3 (2026-04-03)
4
+
5
+ Full Changelog: [v3.18.0...v3.19.3](https://github.com/browserbase/stagehand-ruby/compare/v3.18.0...v3.19.3)
6
+
7
+ ### Features
8
+
9
+ * Replace default model used in server-v3 api spec examples ([0460af2](https://github.com/browserbase/stagehand-ruby/commit/0460af273ab6ba521a01847fe943032b619f7922))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * align path encoding with RFC 3986 section 3.3 ([4f07e2e](https://github.com/browserbase/stagehand-ruby/commit/4f07e2eb4439a53ed1d830f0471b563656f19832))
15
+ * **internal:** correct multipart form field name encoding ([2478726](https://github.com/browserbase/stagehand-ruby/commit/247872691f0c955d19b06cdfac5a4feb13477c1f))
16
+ * variable name typo ([41c9b71](https://github.com/browserbase/stagehand-ruby/commit/41c9b719de177dc28c3f5b167bb96a136336866d))
17
+
18
+
19
+ ### Chores
20
+
21
+ * **ci:** support opting out of skipping builds on metadata-only commits ([cb20c91](https://github.com/browserbase/stagehand-ruby/commit/cb20c91371c9be0282616f9137e51a2414b8a969))
22
+
3
23
  ## 3.18.0 (2026-03-25)
4
24
 
5
25
  Full Changelog: [v3.7.1...v3.18.0](https://github.com/browserbase/stagehand-ruby/compare/v3.7.1...v3.18.0)
data/README.md CHANGED
@@ -213,7 +213,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
213
213
 
214
214
  ```ruby
215
215
  begin
216
- session = stagehand.sessions.start(model_name: "anthropic/claude-sonnet-4-6")
216
+ session = stagehand.sessions.start(model_name: "openai/gpt-5.4-mini")
217
217
  rescue Stagehand::Errors::APIConnectionError => e
218
218
  puts("The server could not be reached")
219
219
  puts(e.cause) # an underlying Exception, likely raised within `net/http`
@@ -256,7 +256,7 @@ stagehand = Stagehand::Client.new(
256
256
  )
257
257
 
258
258
  # Or, configure per-request:
259
- stagehand.sessions.start(model_name: "anthropic/claude-sonnet-4-6", request_options: {max_retries: 5})
259
+ stagehand.sessions.start(model_name: "openai/gpt-5.4-mini", request_options: {max_retries: 5})
260
260
  ```
261
261
 
262
262
  ### Timeouts
@@ -270,7 +270,7 @@ stagehand = Stagehand::Client.new(
270
270
  )
271
271
 
272
272
  # Or, configure per-request:
273
- stagehand.sessions.start(model_name: "anthropic/claude-sonnet-4-6", request_options: {timeout: 5})
273
+ stagehand.sessions.start(model_name: "openai/gpt-5.4-mini", request_options: {timeout: 5})
274
274
  ```
275
275
 
276
276
  On timeout, `Stagehand::Errors::APITimeoutError` is raised.
@@ -157,7 +157,7 @@ module Stagehand
157
157
  in Hash | nil => coerced
158
158
  coerced
159
159
  else
160
- message = "Expected a #{Hash} or #{Stagehand::Internal::Type::BaseModel}, got #{data.inspect}"
160
+ message = "Expected a #{Hash} or #{Stagehand::Internal::Type::BaseModel}, got #{input.inspect}"
161
161
  raise ArgumentError.new(message)
162
162
  end
163
163
  end
@@ -237,6 +237,11 @@ module Stagehand
237
237
  end
238
238
  end
239
239
 
240
+ # @type [Regexp]
241
+ #
242
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
243
+ RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
244
+
240
245
  class << self
241
246
  # @api private
242
247
  #
@@ -247,6 +252,15 @@ module Stagehand
247
252
  "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
253
  end
249
254
 
255
+ # @api private
256
+ #
257
+ # @param path [String, Integer]
258
+ #
259
+ # @return [String]
260
+ def encode_path(path)
261
+ path.to_s.gsub(Stagehand::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
262
+ end
263
+
250
264
  # @api private
251
265
  #
252
266
  # @param path [String, Array<String>]
@@ -259,7 +273,7 @@ module Stagehand
259
273
  in []
260
274
  ""
261
275
  in [String => p, *interpolations]
262
- encoded = interpolations.map { ERB::Util.url_encode(_1) }
276
+ encoded = interpolations.map { encode_path(_1) }
263
277
  format(p, *encoded)
264
278
  end
265
279
  end
@@ -571,16 +585,15 @@ module Stagehand
571
585
  y << "Content-Disposition: form-data"
572
586
 
573
587
  unless key.nil?
574
- name = ERB::Util.url_encode(key.to_s)
575
- y << "; name=\"#{name}\""
588
+ y << "; name=\"#{key}\""
576
589
  end
577
590
 
578
591
  case val
579
592
  in Stagehand::FilePart unless val.filename.nil?
580
- filename = ERB::Util.url_encode(val.filename)
593
+ filename = encode_path(val.filename)
581
594
  y << "; filename=\"#{filename}\""
582
595
  in Pathname | IO
583
- filename = ERB::Util.url_encode(::File.basename(val.to_path))
596
+ filename = encode_path(::File.basename(val.to_path))
584
597
  y << "; filename=\"#{filename}\""
585
598
  else
586
599
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stagehand
4
- VERSION = "3.18.0"
4
+ VERSION = "3.19.3"
5
5
  end
@@ -148,12 +148,20 @@ module Stagehand
148
148
  end
149
149
  end
150
150
 
151
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
152
+ RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)
153
+
151
154
  class << self
152
155
  # @api private
153
156
  sig { params(uri: URI::Generic).returns(String) }
154
157
  def uri_origin(uri)
155
158
  end
156
159
 
160
+ # @api private
161
+ sig { params(path: T.any(String, Integer)).returns(String) }
162
+ def encode_path(path)
163
+ end
164
+
157
165
  # @api private
158
166
  sig { params(path: T.any(String, T::Array[String])).returns(String) }
159
167
  def interpolate_path(path)
@@ -45,8 +45,12 @@ module Stagehand
45
45
  -> top?
46
46
  } -> top?
47
47
 
48
+ RFC_3986_NOT_PCHARS: Regexp
49
+
48
50
  def self?.uri_origin: (URI::Generic uri) -> String
49
51
 
52
+ def self?.encode_path: (String | Integer path) -> String
53
+
50
54
  def self?.interpolate_path: (String | ::Array[String] path) -> String
51
55
 
52
56
  def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stagehand
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.18.0
4
+ version: 3.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stagehand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-25 00:00:00.000000000 Z
11
+ date: 2026-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi