stagehand 3.20.0 → 3.21.0

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.
@@ -52,10 +52,16 @@ module Stagehand
52
52
  # @param request_options [Stagehand::RequestOptions, Hash{Symbol=>Object}]
53
53
 
54
54
  class Options < Stagehand::Internal::Type::BaseModel
55
+ # @!attribute ignore_selectors
56
+ # Selectors for elements and subtrees that should be excluded from observation
57
+ #
58
+ # @return [Array<String>, nil]
59
+ optional :ignore_selectors, Stagehand::Internal::Type::ArrayOf[String], api_name: :ignoreSelectors
60
+
55
61
  # @!attribute model
56
62
  # Model configuration object or model name string (e.g., 'openai/gpt-5-nano')
57
63
  #
58
- # @return [Stagehand::Models::ModelConfig, String, nil]
64
+ # @return [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject, Stagehand::Models::SessionObserveParams::Options::Model::GenericModelConfigObject, String, nil]
59
65
  optional :model, union: -> { Stagehand::SessionObserveParams::Options::Model }
60
66
 
61
67
  # @!attribute selector
@@ -79,11 +85,13 @@ module Stagehand
79
85
  optional :variables,
80
86
  -> { Stagehand::Internal::Type::HashOf[union: Stagehand::SessionObserveParams::Options::Variable] }
81
87
 
82
- # @!method initialize(model: nil, selector: nil, timeout: nil, variables: nil)
88
+ # @!method initialize(ignore_selectors: nil, model: nil, selector: nil, timeout: nil, variables: nil)
83
89
  # Some parameter documentations has been truncated, see
84
90
  # {Stagehand::Models::SessionObserveParams::Options} for more details.
85
91
  #
86
- # @param model [Stagehand::Models::ModelConfig, String] Model configuration object or model name string (e.g., 'openai/gpt-5-nano')
92
+ # @param ignore_selectors [Array<String>] Selectors for elements and subtrees that should be excluded from observation
93
+ #
94
+ # @param model [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject, Stagehand::Models::SessionObserveParams::Options::Model::GenericModelConfigObject, String] Model configuration object or model name string (e.g., 'openai/gpt-5-nano')
87
95
  #
88
96
  # @param selector [String] CSS selector to scope observation to a specific element
89
97
  #
@@ -97,12 +105,339 @@ module Stagehand
97
105
  module Model
98
106
  extend Stagehand::Internal::Type::Union
99
107
 
100
- variant -> { Stagehand::ModelConfig }
108
+ variant -> { Stagehand::SessionObserveParams::Options::Model::VertexModelConfigObject }
109
+
110
+ variant -> { Stagehand::SessionObserveParams::Options::Model::GenericModelConfigObject }
101
111
 
102
112
  variant String
103
113
 
114
+ class VertexModelConfigObject < Stagehand::Internal::Type::BaseModel
115
+ # @!attribute auth
116
+ # Vertex provider authentication configuration
117
+ #
118
+ # @return [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth]
119
+ required :auth, -> { Stagehand::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth }
120
+
121
+ # @!attribute model_name
122
+ # Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
123
+ #
124
+ # @return [String]
125
+ required :model_name, String, api_name: :modelName
126
+
127
+ # @!attribute provider
128
+ # Vertex AI model provider
129
+ #
130
+ # @return [Symbol, :vertex]
131
+ required :provider, const: :vertex
132
+
133
+ # @!attribute provider_options
134
+ # Vertex provider-specific model configuration
135
+ #
136
+ # @return [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::ProviderOptions]
137
+ required :provider_options,
138
+ -> {
139
+ Stagehand::SessionObserveParams::Options::Model::VertexModelConfigObject::ProviderOptions
140
+ },
141
+ api_name: :providerOptions
142
+
143
+ # @!attribute api_key
144
+ # API key for the model provider
145
+ #
146
+ # @return [String, nil]
147
+ optional :api_key, String, api_name: :apiKey
148
+
149
+ # @!attribute base_url
150
+ # Base URL for the model provider
151
+ #
152
+ # @return [String, nil]
153
+ optional :base_url, String, api_name: :baseURL
154
+
155
+ # @!attribute headers
156
+ # Custom headers sent with every request to the model provider
157
+ #
158
+ # @return [Hash{Symbol=>String}, nil]
159
+ optional :headers, Stagehand::Internal::Type::HashOf[String]
160
+
161
+ # @!method initialize(auth:, model_name:, provider_options:, api_key: nil, base_url: nil, headers: nil, provider: :vertex)
162
+ # @param auth [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth] Vertex provider authentication configuration
163
+ #
164
+ # @param model_name [String] Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
165
+ #
166
+ # @param provider_options [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::ProviderOptions] Vertex provider-specific model configuration
167
+ #
168
+ # @param api_key [String] API key for the model provider
169
+ #
170
+ # @param base_url [String] Base URL for the model provider
171
+ #
172
+ # @param headers [Hash{Symbol=>String}] Custom headers sent with every request to the model provider
173
+ #
174
+ # @param provider [Symbol, :vertex] Vertex AI model provider
175
+
176
+ # @see Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject#auth
177
+ class Auth < Stagehand::Internal::Type::BaseModel
178
+ # @!attribute credentials
179
+ # Google Cloud service account credentials
180
+ #
181
+ # @return [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Credentials]
182
+ required :credentials,
183
+ -> { Stagehand::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Credentials }
184
+
185
+ # @!attribute type
186
+ # Use inline Google Cloud service account credentials for provider authentication
187
+ #
188
+ # @return [Symbol, :googleServiceAccount]
189
+ required :type, const: :googleServiceAccount
190
+
191
+ # @!attribute project_id
192
+ # Google Cloud project ID used by google-auth-library
193
+ #
194
+ # @return [String, nil]
195
+ optional :project_id, String, api_name: :projectId
196
+
197
+ # @!attribute scopes
198
+ # Google auth scopes for the desired API request
199
+ #
200
+ # @return [String, Array<String>, nil]
201
+ optional :scopes,
202
+ union: -> { Stagehand::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Scopes }
203
+
204
+ # @!attribute universe_domain
205
+ # Google Cloud universe domain
206
+ #
207
+ # @return [String, nil]
208
+ optional :universe_domain, String, api_name: :universeDomain
209
+
210
+ # @!method initialize(credentials:, project_id: nil, scopes: nil, universe_domain: nil, type: :googleServiceAccount)
211
+ # Vertex provider authentication configuration
212
+ #
213
+ # @param credentials [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Credentials] Google Cloud service account credentials
214
+ #
215
+ # @param project_id [String] Google Cloud project ID used by google-auth-library
216
+ #
217
+ # @param scopes [String, Array<String>] Google auth scopes for the desired API request
218
+ #
219
+ # @param universe_domain [String] Google Cloud universe domain
220
+ #
221
+ # @param type [Symbol, :googleServiceAccount] Use inline Google Cloud service account credentials for provider authentication
222
+
223
+ # @see Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth#credentials
224
+ class Credentials < Stagehand::Internal::Type::BaseModel
225
+ # @!attribute client_email
226
+ #
227
+ # @return [String]
228
+ required :client_email, String
229
+
230
+ # @!attribute private_key
231
+ #
232
+ # @return [String]
233
+ required :private_key, String
234
+
235
+ # @!attribute auth_provider_x509_cert_url
236
+ #
237
+ # @return [String, nil]
238
+ optional :auth_provider_x509_cert_url, String
239
+
240
+ # @!attribute auth_uri
241
+ #
242
+ # @return [String, nil]
243
+ optional :auth_uri, String
244
+
245
+ # @!attribute client_id
246
+ #
247
+ # @return [String, nil]
248
+ optional :client_id, String
249
+
250
+ # @!attribute client_x509_cert_url
251
+ #
252
+ # @return [String, nil]
253
+ optional :client_x509_cert_url, String
254
+
255
+ # @!attribute private_key_id
256
+ #
257
+ # @return [String, nil]
258
+ optional :private_key_id, String
259
+
260
+ # @!attribute project_id
261
+ #
262
+ # @return [String, nil]
263
+ optional :project_id, String
264
+
265
+ # @!attribute token_uri
266
+ #
267
+ # @return [String, nil]
268
+ optional :token_uri, String
269
+
270
+ # @!attribute type
271
+ #
272
+ # @return [Symbol, Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Credentials::Type, nil]
273
+ optional :type,
274
+ enum: -> { Stagehand::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Credentials::Type }
275
+
276
+ # @!attribute universe_domain
277
+ #
278
+ # @return [String, nil]
279
+ optional :universe_domain, String
280
+
281
+ # @!method initialize(client_email:, private_key:, auth_provider_x509_cert_url: nil, auth_uri: nil, client_id: nil, client_x509_cert_url: nil, private_key_id: nil, project_id: nil, token_uri: nil, type: nil, universe_domain: nil)
282
+ # Google Cloud service account credentials
283
+ #
284
+ # @param client_email [String]
285
+ # @param private_key [String]
286
+ # @param auth_provider_x509_cert_url [String]
287
+ # @param auth_uri [String]
288
+ # @param client_id [String]
289
+ # @param client_x509_cert_url [String]
290
+ # @param private_key_id [String]
291
+ # @param project_id [String]
292
+ # @param token_uri [String]
293
+ # @param type [Symbol, Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Credentials::Type]
294
+ # @param universe_domain [String]
295
+
296
+ # @see Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Credentials#type
297
+ module Type
298
+ extend Stagehand::Internal::Type::Enum
299
+
300
+ SERVICE_ACCOUNT = :service_account
301
+
302
+ # @!method self.values
303
+ # @return [Array<Symbol>]
304
+ end
305
+ end
306
+
307
+ # Google auth scopes for the desired API request
308
+ #
309
+ # @see Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth#scopes
310
+ module Scopes
311
+ extend Stagehand::Internal::Type::Union
312
+
313
+ variant String
314
+
315
+ variant -> { Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::Auth::Scopes::StringArray }
316
+
317
+ # @!method self.variants
318
+ # @return [Array(String, Array<String>)]
319
+
320
+ # @type [Stagehand::Internal::Type::Converter]
321
+ StringArray = Stagehand::Internal::Type::ArrayOf[String]
322
+ end
323
+ end
324
+
325
+ # @see Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject#provider_options
326
+ class ProviderOptions < Stagehand::Internal::Type::BaseModel
327
+ # @!attribute vertex
328
+ # Vertex AI provider-specific settings
329
+ #
330
+ # @return [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::ProviderOptions::Vertex]
331
+ required :vertex,
332
+ -> { Stagehand::SessionObserveParams::Options::Model::VertexModelConfigObject::ProviderOptions::Vertex }
333
+
334
+ # @!method initialize(vertex:)
335
+ # Vertex provider-specific model configuration
336
+ #
337
+ # @param vertex [Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::ProviderOptions::Vertex] Vertex AI provider-specific settings
338
+
339
+ # @see Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject::ProviderOptions#vertex
340
+ class Vertex < Stagehand::Internal::Type::BaseModel
341
+ # @!attribute location
342
+ # Google Cloud location for Vertex AI models
343
+ #
344
+ # @return [String]
345
+ required :location, String
346
+
347
+ # @!attribute project
348
+ # Google Cloud project ID for Vertex AI models
349
+ #
350
+ # @return [String]
351
+ required :project, String
352
+
353
+ # @!attribute base_url
354
+ # Base URL for the Vertex AI provider
355
+ #
356
+ # @return [String, nil]
357
+ optional :base_url, String, api_name: :baseURL
358
+
359
+ # @!attribute headers
360
+ # Custom headers sent with every request to the Vertex AI provider
361
+ #
362
+ # @return [Hash{Symbol=>String}, nil]
363
+ optional :headers, Stagehand::Internal::Type::HashOf[String]
364
+
365
+ # @!method initialize(location:, project:, base_url: nil, headers: nil)
366
+ # Vertex AI provider-specific settings
367
+ #
368
+ # @param location [String] Google Cloud location for Vertex AI models
369
+ #
370
+ # @param project [String] Google Cloud project ID for Vertex AI models
371
+ #
372
+ # @param base_url [String] Base URL for the Vertex AI provider
373
+ #
374
+ # @param headers [Hash{Symbol=>String}] Custom headers sent with every request to the Vertex AI provider
375
+ end
376
+ end
377
+ end
378
+
379
+ class GenericModelConfigObject < Stagehand::Internal::Type::BaseModel
380
+ # @!attribute model_name
381
+ # Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
382
+ #
383
+ # @return [String]
384
+ required :model_name, String, api_name: :modelName
385
+
386
+ # @!attribute api_key
387
+ # API key for the model provider
388
+ #
389
+ # @return [String, nil]
390
+ optional :api_key, String, api_name: :apiKey
391
+
392
+ # @!attribute base_url
393
+ # Base URL for the model provider
394
+ #
395
+ # @return [String, nil]
396
+ optional :base_url, String, api_name: :baseURL
397
+
398
+ # @!attribute headers
399
+ # Custom headers sent with every request to the model provider
400
+ #
401
+ # @return [Hash{Symbol=>String}, nil]
402
+ optional :headers, Stagehand::Internal::Type::HashOf[String]
403
+
404
+ # @!attribute provider
405
+ # AI provider for the model (or provide a baseURL endpoint instead)
406
+ #
407
+ # @return [Symbol, Stagehand::Models::SessionObserveParams::Options::Model::GenericModelConfigObject::Provider, nil]
408
+ optional :provider,
409
+ enum: -> { Stagehand::SessionObserveParams::Options::Model::GenericModelConfigObject::Provider }
410
+
411
+ # @!method initialize(model_name:, api_key: nil, base_url: nil, headers: nil, provider: nil)
412
+ # @param model_name [String] Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
413
+ #
414
+ # @param api_key [String] API key for the model provider
415
+ #
416
+ # @param base_url [String] Base URL for the model provider
417
+ #
418
+ # @param headers [Hash{Symbol=>String}] Custom headers sent with every request to the model provider
419
+ #
420
+ # @param provider [Symbol, Stagehand::Models::SessionObserveParams::Options::Model::GenericModelConfigObject::Provider] AI provider for the model (or provide a baseURL endpoint instead)
421
+
422
+ # AI provider for the model (or provide a baseURL endpoint instead)
423
+ #
424
+ # @see Stagehand::Models::SessionObserveParams::Options::Model::GenericModelConfigObject#provider
425
+ module Provider
426
+ extend Stagehand::Internal::Type::Enum
427
+
428
+ OPENAI = :openai
429
+ ANTHROPIC = :anthropic
430
+ GOOGLE = :google
431
+ MICROSOFT = :microsoft
432
+ BEDROCK = :bedrock
433
+
434
+ # @!method self.values
435
+ # @return [Array<Symbol>]
436
+ end
437
+ end
438
+
104
439
  # @!method self.variants
105
- # @return [Array(Stagehand::Models::ModelConfig, String)]
440
+ # @return [Array(Stagehand::Models::SessionObserveParams::Options::Model::VertexModelConfigObject, Stagehand::Models::SessionObserveParams::Options::Model::GenericModelConfigObject, String)]
106
441
  end
107
442
 
108
443
  module Variable
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stagehand
4
- VERSION = "3.20.0"
4
+ VERSION = "3.21.0"
5
5
  end