puppeteer-bidi 0.0.1.beta1 → 0.0.1.beta3

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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CLAUDE.md +50 -4
  3. data/README.md +8 -1
  4. data/Steepfile +36 -0
  5. data/lib/puppeteer/bidi/async_utils.rb +1 -0
  6. data/lib/puppeteer/bidi/browser.rb +38 -24
  7. data/lib/puppeteer/bidi/browser_context.rb +13 -4
  8. data/lib/puppeteer/bidi/browser_launcher.rb +1 -0
  9. data/lib/puppeteer/bidi/connection.rb +26 -9
  10. data/lib/puppeteer/bidi/core/browser.rb +15 -14
  11. data/lib/puppeteer/bidi/core/browsing_context.rb +64 -46
  12. data/lib/puppeteer/bidi/core/disposable.rb +10 -3
  13. data/lib/puppeteer/bidi/core/errors.rb +18 -1
  14. data/lib/puppeteer/bidi/core/event_emitter.rb +18 -9
  15. data/lib/puppeteer/bidi/core/navigation.rb +4 -3
  16. data/lib/puppeteer/bidi/core/realm.rb +29 -26
  17. data/lib/puppeteer/bidi/core/request.rb +33 -29
  18. data/lib/puppeteer/bidi/core/session.rb +14 -11
  19. data/lib/puppeteer/bidi/core/user_context.rb +17 -16
  20. data/lib/puppeteer/bidi/core/user_prompt.rb +8 -7
  21. data/lib/puppeteer/bidi/core.rb +1 -0
  22. data/lib/puppeteer/bidi/deserializer.rb +1 -0
  23. data/lib/puppeteer/bidi/element_handle.rb +52 -52
  24. data/lib/puppeteer/bidi/errors.rb +1 -0
  25. data/lib/puppeteer/bidi/file_chooser.rb +1 -0
  26. data/lib/puppeteer/bidi/frame.rb +70 -70
  27. data/lib/puppeteer/bidi/http_response.rb +1 -0
  28. data/lib/puppeteer/bidi/injected_source.rb +1 -0
  29. data/lib/puppeteer/bidi/js_handle.rb +23 -23
  30. data/lib/puppeteer/bidi/keyboard.rb +24 -13
  31. data/lib/puppeteer/bidi/lazy_arg.rb +1 -0
  32. data/lib/puppeteer/bidi/mouse.rb +31 -18
  33. data/lib/puppeteer/bidi/page.rb +87 -87
  34. data/lib/puppeteer/bidi/query_handler.rb +3 -0
  35. data/lib/puppeteer/bidi/realm.rb +70 -6
  36. data/lib/puppeteer/bidi/serializer.rb +1 -0
  37. data/lib/puppeteer/bidi/target.rb +24 -0
  38. data/lib/puppeteer/bidi/task_manager.rb +9 -3
  39. data/lib/puppeteer/bidi/timeout_settings.rb +1 -0
  40. data/lib/puppeteer/bidi/transport.rb +1 -0
  41. data/lib/puppeteer/bidi/version.rb +1 -1
  42. data/lib/puppeteer/bidi/wait_task.rb +1 -0
  43. data/lib/puppeteer/bidi.rb +8 -4
  44. data/sig/_external.rbs +128 -0
  45. data/sig/_supplementary.rbs +20 -0
  46. data/sig/puppeteer/bidi/async_utils.rbs +68 -0
  47. data/sig/puppeteer/bidi/browser.rbs +35 -26
  48. data/sig/puppeteer/bidi/browser_context.rbs +39 -0
  49. data/sig/puppeteer/bidi/browser_launcher.rbs +45 -0
  50. data/sig/puppeteer/bidi/connection.rbs +67 -0
  51. data/sig/puppeteer/bidi/core/browser.rbs +79 -0
  52. data/sig/puppeteer/bidi/core/browsing_context.rbs +210 -0
  53. data/sig/puppeteer/bidi/core/disposable.rbs +42 -0
  54. data/sig/puppeteer/bidi/core/errors.rbs +65 -0
  55. data/sig/puppeteer/bidi/core/event_emitter.rbs +50 -0
  56. data/sig/puppeteer/bidi/core/navigation.rbs +37 -0
  57. data/sig/puppeteer/bidi/core/realm.rbs +132 -0
  58. data/sig/puppeteer/bidi/core/request.rbs +120 -0
  59. data/sig/puppeteer/bidi/core/session.rbs +65 -0
  60. data/sig/puppeteer/bidi/core/user_context.rbs +72 -0
  61. data/sig/puppeteer/bidi/core/user_prompt.rbs +52 -0
  62. data/sig/puppeteer/bidi/core.rbs +9 -0
  63. data/sig/puppeteer/bidi/deserializer.rbs +28 -0
  64. data/sig/puppeteer/bidi/element_handle.rbs +52 -52
  65. data/sig/puppeteer/bidi/errors.rbs +34 -0
  66. data/sig/puppeteer/bidi/file_chooser.rbs +27 -0
  67. data/sig/puppeteer/bidi/frame.rbs +70 -70
  68. data/sig/puppeteer/bidi/http_response.rbs +18 -0
  69. data/sig/puppeteer/bidi/injected_source.rbs +21 -0
  70. data/sig/puppeteer/bidi/js_handle.rbs +23 -23
  71. data/sig/puppeteer/bidi/keyboard.rbs +57 -0
  72. data/sig/puppeteer/bidi/lazy_arg.rbs +15 -0
  73. data/sig/puppeteer/bidi/mouse.rbs +73 -0
  74. data/sig/puppeteer/bidi/page.rbs +87 -87
  75. data/sig/puppeteer/bidi/query_handler.rbs +113 -0
  76. data/sig/puppeteer/bidi/realm.rbs +141 -0
  77. data/sig/puppeteer/bidi/serializer.rbs +31 -0
  78. data/sig/puppeteer/bidi/target.rbs +68 -0
  79. data/sig/puppeteer/bidi/task_manager.rbs +36 -0
  80. data/sig/puppeteer/bidi/timeout_settings.rbs +14 -0
  81. data/sig/puppeteer/bidi/transport.rbs +43 -0
  82. data/sig/puppeteer/bidi/wait_task.rbs +62 -0
  83. data/sig/puppeteer/bidi.rbs +8 -4
  84. metadata +36 -1
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  module Puppeteer
4
5
  module Bidi
@@ -19,13 +20,14 @@ module Puppeteer
19
20
  end
20
21
 
21
22
  # Get the target for script execution
22
- # @return [Hash] BiDi target descriptor
23
+ # @rbs return: Hash[Symbol, untyped] -- BiDi target descriptor
23
24
  def target
24
25
  { realm: @id }
25
26
  end
26
27
 
27
28
  # Disown handles (remove references)
28
- # @param handles [Array<String>] Handle IDs to disown
29
+ # @rbs handles: Array[String] -- Handle IDs to disown
30
+ # @rbs return: Async::Task[untyped]
29
31
  def disown(handles)
30
32
  raise RealmDestroyedError, @reason if disposed?
31
33
  session.async_send_command('script.disown', {
@@ -35,10 +37,10 @@ module Puppeteer
35
37
  end
36
38
 
37
39
  # Call a function in the realm
38
- # @param function_declaration [String] Function source code
39
- # @param await_promise [Boolean] Whether to await promise results (Note: different from returnByValue!)
40
- # @param options [Hash] Additional options (arguments, serializationOptions, resultOwnership, etc.)
41
- # @return [Hash] Evaluation result (with 'type', 'realm', and optionally 'result'/'exceptionDetails')
40
+ # @rbs function_declaration: String -- Function source code
41
+ # @rbs await_promise: bool -- Whether to await promise results
42
+ # @rbs **options: untyped -- Additional options (arguments, serializationOptions, resultOwnership, etc.)
43
+ # @rbs return: Async::Task[Hash[String, untyped]] -- Evaluation result
42
44
  def call_function(function_declaration, await_promise, **options)
43
45
  raise RealmDestroyedError, @reason if disposed?
44
46
 
@@ -58,10 +60,10 @@ module Puppeteer
58
60
  end
59
61
 
60
62
  # Evaluate an expression in the realm
61
- # @param expression [String] JavaScript expression
62
- # @param await_promise [Boolean] Whether to await promise results
63
- # @param options [Hash] Additional options (serializationOptions, resultOwnership, etc.)
64
- # @return [Hash] Evaluation result (with 'type', 'realm', and optionally 'result'/'exceptionDetails')
63
+ # @rbs expression: String -- JavaScript expression
64
+ # @rbs await_promise: bool -- Whether to await promise results
65
+ # @rbs **options: untyped -- Additional options (serializationOptions, resultOwnership, etc.)
66
+ # @rbs return: Async::Task[Hash[String, untyped]] -- Evaluation result
65
67
  def evaluate(expression, await_promise, **options)
66
68
  raise RealmDestroyedError, @reason if disposed?
67
69
 
@@ -78,7 +80,7 @@ module Puppeteer
78
80
  end
79
81
 
80
82
  # Resolve the CDP execution context ID for this realm
81
- # @return [Integer] Execution context ID
83
+ # @rbs return: Integer -- Execution context ID
82
84
  def resolve_execution_context_id
83
85
  return @execution_context_id if @execution_context_id
84
86
 
@@ -90,7 +92,7 @@ module Puppeteer
90
92
  protected
91
93
 
92
94
  # Abstract method - must be implemented by subclasses
93
- # @return [Session] The session for this realm
95
+ # @rbs return: Session -- The session for this realm
94
96
  def session
95
97
  raise NotImplementedError, 'Subclasses must implement #session'
96
98
  end
@@ -106,9 +108,9 @@ module Puppeteer
106
108
  # WindowRealm represents a JavaScript realm in a window or iframe
107
109
  class WindowRealm < Realm
108
110
  # Create a window realm
109
- # @param browsing_context [BrowsingContext] The browsing context
110
- # @param sandbox [String, nil] Sandbox name
111
- # @return [WindowRealm] New window realm
111
+ # @rbs browsing_context: BrowsingContext -- The browsing context
112
+ # @rbs sandbox: String? -- Sandbox name
113
+ # @rbs return: WindowRealm -- New window realm
112
114
  def self.from(browsing_context, sandbox = nil)
113
115
  realm = new(browsing_context, sandbox)
114
116
  realm.send(:initialize_realm)
@@ -126,19 +128,20 @@ module Puppeteer
126
128
 
127
129
  # Set the environment (Frame) for this realm
128
130
  # This is set by Frame when it's created
129
- # @param frame [Frame] The frame environment
131
+ # @rbs frame: untyped -- The frame environment
132
+ # @rbs return: void
130
133
  def environment=(frame)
131
134
  @environment = frame
132
135
  end
133
136
 
134
137
  # Get the environment (Frame) for this realm
135
- # @return [Frame] The frame environment
138
+ # @rbs return: untyped -- The frame environment
136
139
  def environment
137
140
  @environment
138
141
  end
139
142
 
140
143
  # Override target to use context-based target
141
- # @return [Hash] BiDi target descriptor
144
+ # @rbs return: Hash[Symbol, untyped] -- BiDi target descriptor
142
145
  def target
143
146
  result = { context: @browsing_context.id }
144
147
  result[:sandbox] = @sandbox if @sandbox
@@ -197,10 +200,10 @@ module Puppeteer
197
200
  # DedicatedWorkerRealm represents a JavaScript realm in a dedicated worker
198
201
  class DedicatedWorkerRealm < Realm
199
202
  # Create a dedicated worker realm
200
- # @param owner [WindowRealm, DedicatedWorkerRealm, SharedWorkerRealm] Owner realm
201
- # @param id [String] Realm ID
202
- # @param origin [String] Realm origin
203
- # @return [DedicatedWorkerRealm] New dedicated worker realm
203
+ # @rbs owner: WindowRealm | DedicatedWorkerRealm | SharedWorkerRealm -- Owner realm
204
+ # @rbs id: String -- Realm ID
205
+ # @rbs origin: String -- Realm origin
206
+ # @rbs return: DedicatedWorkerRealm -- New dedicated worker realm
204
207
  def self.from(owner, id, origin)
205
208
  realm = new(owner, id, origin)
206
209
  realm.send(:initialize_realm)
@@ -256,10 +259,10 @@ module Puppeteer
256
259
  # SharedWorkerRealm represents a JavaScript realm in a shared worker
257
260
  class SharedWorkerRealm < Realm
258
261
  # Create a shared worker realm
259
- # @param browser [Browser] Browser instance
260
- # @param id [String] Realm ID
261
- # @param origin [String] Realm origin
262
- # @return [SharedWorkerRealm] New shared worker realm
262
+ # @rbs browser: Browser -- Browser instance
263
+ # @rbs id: String -- Realm ID
264
+ # @rbs origin: String -- Realm origin
265
+ # @rbs return: SharedWorkerRealm -- New shared worker realm
263
266
  def self.from(browser, id, origin)
264
267
  realm = new(browser, id, origin)
265
268
  realm.send(:initialize_realm)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  module Puppeteer
4
5
  module Bidi
@@ -8,9 +9,9 @@ module Puppeteer
8
9
  include Disposable::DisposableMixin
9
10
 
10
11
  # Create a request instance from a beforeRequestSent event
11
- # @param browsing_context [BrowsingContext] The browsing context
12
- # @param event [Hash] The beforeRequestSent event data
13
- # @return [Request] New request instance
12
+ # @rbs browsing_context: BrowsingContext -- The browsing context
13
+ # @rbs event: Hash[String, untyped] -- The beforeRequestSent event data
14
+ # @rbs return: Request -- New request instance
14
15
  def self.from(browsing_context, event)
15
16
  request = new(browsing_context, event)
16
17
  request.send(:initialize_request)
@@ -32,43 +33,43 @@ module Puppeteer
32
33
  end
33
34
 
34
35
  # Get request ID
35
- # @return [String] Request ID
36
+ # @rbs return: String -- Request ID
36
37
  def id
37
38
  @event.dig('request', 'request')
38
39
  end
39
40
 
40
41
  # Get request URL
41
- # @return [String] Request URL
42
+ # @rbs return: String -- Request URL
42
43
  def url
43
44
  @event.dig('request', 'url')
44
45
  end
45
46
 
46
47
  # Get request method
47
- # @return [String] Request method (GET, POST, etc.)
48
+ # @rbs return: String -- Request method (GET, POST, etc.)
48
49
  def method
49
50
  @event.dig('request', 'method')
50
51
  end
51
52
 
52
53
  # Get request headers
53
- # @return [Array<Hash>] Request headers
54
+ # @rbs return: Array[Hash[String, untyped]] -- Request headers
54
55
  def headers
55
56
  @event.dig('request', 'headers') || []
56
57
  end
57
58
 
58
59
  # Get navigation ID if this is a navigation request
59
- # @return [String, nil] Navigation ID
60
+ # @rbs return: String? -- Navigation ID
60
61
  def navigation
61
62
  @event['navigation']
62
63
  end
63
64
 
64
65
  # Get redirect request if this request was redirected
65
- # @return [Request, nil] Redirect request
66
+ # @rbs return: Request? -- Redirect request
66
67
  def redirect
67
68
  @redirect
68
69
  end
69
70
 
70
71
  # Get the last redirect in the chain
71
- # @return [Request, nil] Last redirect request
72
+ # @rbs return: Request? -- Last redirect request
72
73
  def last_redirect
73
74
  redirect_request = @redirect
74
75
  while redirect_request
@@ -79,7 +80,7 @@ module Puppeteer
79
80
  end
80
81
 
81
82
  # Get request initiator information
82
- # @return [Hash, nil] Initiator info
83
+ # @rbs return: untyped -- Initiator info (mixed String/Symbol keys)
83
84
  def initiator
84
85
  initiator_data = @event['initiator']
85
86
  return nil unless initiator_data
@@ -92,41 +93,42 @@ module Puppeteer
92
93
  end
93
94
 
94
95
  # Check if the request is blocked
95
- # @return [Boolean] Whether the request is blocked
96
+ # @rbs return: bool -- Whether the request is blocked
96
97
  def blocked?
97
98
  @event['isBlocked'] == true
98
99
  end
99
100
 
100
101
  # Get resource type (non-standard)
101
- # @return [String, nil] Resource type
102
+ # @rbs return: String? -- Resource type
102
103
  def resource_type
103
104
  @event.dig('request', 'goog:resourceType')
104
105
  end
105
106
 
106
107
  # Get POST data (non-standard)
107
- # @return [String, nil] POST data
108
+ # @rbs return: String? -- POST data
108
109
  def post_data
109
110
  @event.dig('request', 'goog:postData')
110
111
  end
111
112
 
112
113
  # Check if request has POST data
113
- # @return [Boolean] Whether request has POST data
114
+ # @rbs return: bool -- Whether request has POST data
114
115
  def has_post_data?
115
116
  (@event.dig('request', 'bodySize') || 0) > 0
116
117
  end
117
118
 
118
119
  # Get timing information
119
- # @return [Hash] Timing info
120
+ # @rbs return: Hash[String, untyped] -- Timing info
120
121
  def timing
121
122
  @event.dig('request', 'timings') || {}
122
123
  end
123
124
 
124
125
  # Continue the request with optional modifications
125
- # @param url [String, nil] Modified URL
126
- # @param method [String, nil] Modified method
127
- # @param headers [Array<Hash>, nil] Modified headers
128
- # @param cookies [Array<Hash>, nil] Modified cookies
129
- # @param body [Hash, nil] Modified body
126
+ # @rbs url: String? -- Modified URL
127
+ # @rbs method: String? -- Modified method
128
+ # @rbs headers: Array[Hash[String, untyped]]? -- Modified headers
129
+ # @rbs cookies: Array[Hash[String, untyped]]? -- Modified cookies
130
+ # @rbs body: Hash[String, untyped]? -- Modified body
131
+ # @rbs return: untyped
130
132
  def continue_request(url: nil, method: nil, headers: nil, cookies: nil, body: nil)
131
133
  params = { request: id }
132
134
  params[:url] = url if url
@@ -144,10 +146,11 @@ module Puppeteer
144
146
  end
145
147
 
146
148
  # Provide a response for the request
147
- # @param status_code [Integer, nil] Response status code
148
- # @param reason_phrase [String, nil] Response reason phrase
149
- # @param headers [Array<Hash>, nil] Response headers
150
- # @param body [Hash, nil] Response body
149
+ # @rbs status_code: Integer? -- Response status code
150
+ # @rbs reason_phrase: String? -- Response reason phrase
151
+ # @rbs headers: Array[Hash[String, untyped]]? -- Response headers
152
+ # @rbs body: Hash[String, untyped]? -- Response body
153
+ # @rbs return: untyped
151
154
  def provide_response(status_code: nil, reason_phrase: nil, headers: nil, body: nil)
152
155
  params = { request: id }
153
156
  params[:statusCode] = status_code if status_code
@@ -159,7 +162,7 @@ module Puppeteer
159
162
  end
160
163
 
161
164
  # Fetch POST data for the request
162
- # @return [String, nil] POST data
165
+ # @rbs return: String? -- POST data
163
166
  def fetch_post_data
164
167
  return nil unless has_post_data?
165
168
  return @request_body_promise if @request_body_promise
@@ -180,7 +183,7 @@ module Puppeteer
180
183
  end
181
184
 
182
185
  # Get response content
183
- # @return [String] Response content as binary string
186
+ # @rbs return: String -- Response content as binary string
184
187
  def response_content
185
188
  return @response_content_promise if @response_content_promise
186
189
 
@@ -205,8 +208,9 @@ module Puppeteer
205
208
  end
206
209
 
207
210
  # Continue with authentication
208
- # @param action [String] 'provideCredentials', 'default', or 'cancel'
209
- # @param credentials [Hash, nil] Credentials hash with username and password
211
+ # @rbs action: String -- 'provideCredentials', 'default', or 'cancel'
212
+ # @rbs credentials: Hash[String, untyped]? -- Credentials hash with username and password
213
+ # @rbs return: untyped
210
214
  def continue_with_auth(action:, credentials: nil)
211
215
  params = {
212
216
  request: id,
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  module Puppeteer
4
5
  module Bidi
@@ -9,9 +10,9 @@ module Puppeteer
9
10
  include Disposable::DisposableMixin
10
11
 
11
12
  # Create a new session from an existing connection
12
- # @param connection [Puppeteer::Bidi::Connection] The BiDi connection
13
- # @param capabilities [Hash] Session capabilities
14
- # @return [Session] New session instance
13
+ # @rbs connection: Puppeteer::Bidi::Connection -- The BiDi connection
14
+ # @rbs capabilities: Hash[String, untyped] -- Session capabilities
15
+ # @rbs return: Async::Task[Session]
15
16
  def self.from(connection:, capabilities:)
16
17
  Async do
17
18
  result = connection.async_send_command('session.new', { capabilities: capabilities }).wait
@@ -45,17 +46,18 @@ module Puppeteer
45
46
  alias disposed? ended?
46
47
 
47
48
  # Send a BiDi command through this session
48
- # @param method [String] BiDi method name
49
- # @param params [Hash] Command parameters
50
- # @return [Hash] Command result
49
+ # @rbs method: String -- BiDi method name
50
+ # @rbs params: Hash[String | Symbol, untyped] -- Command parameters
51
+ # @rbs return: Async::Task[Hash[String, untyped]]
51
52
  def async_send_command(method, params = {})
52
53
  raise SessionEndedError, @reason if ended?
53
54
  @connection.async_send_command(method, params)
54
55
  end
55
56
 
56
57
  # Subscribe to BiDi events
57
- # @param events [Array<String>] Event names to subscribe to
58
- # @param contexts [Array<String>, nil] Context IDs (optional)
58
+ # @rbs events: Array[String] -- Event names to subscribe to
59
+ # @rbs contexts: Array[String]? -- Context IDs (optional)
60
+ # @rbs return: Async::Task[untyped]
59
61
  def subscribe(events, contexts = nil)
60
62
  raise SessionEndedError, @reason if ended?
61
63
  params = { events: events }
@@ -64,8 +66,9 @@ module Puppeteer
64
66
  end
65
67
 
66
68
  # Add intercepts (same as subscribe but for interception events)
67
- # @param events [Array<String>] Event names to intercept
68
- # @param contexts [Array<String>, nil] Context IDs (optional)
69
+ # @rbs events: Array[String] -- Event names to intercept
70
+ # @rbs contexts: Array[String]? -- Context IDs (optional)
71
+ # @rbs return: Async::Task[untyped]
69
72
  def add_intercepts(events, contexts = nil)
70
73
  subscribe(events, contexts)
71
74
  end
@@ -75,7 +78,7 @@ module Puppeteer
75
78
  return if ended?
76
79
 
77
80
  begin
78
- send_command('session.end', {})
81
+ async_send_command('session.end', {}).wait
79
82
  ensure
80
83
  dispose_session('Session ended')
81
84
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  module Puppeteer
4
5
  module Bidi
@@ -10,9 +11,9 @@ module Puppeteer
10
11
  DEFAULT = 'default'
11
12
 
12
13
  # Create a user context
13
- # @param browser [Browser] Parent browser
14
- # @param id [String] Context ID
15
- # @return [UserContext] New user context
14
+ # @rbs browser: Browser -- Parent browser
15
+ # @rbs id: String -- Context ID
16
+ # @rbs return: UserContext
16
17
  def self.create(browser, id)
17
18
  context = new(browser, id)
18
19
  context.send(:initialize_context)
@@ -38,16 +39,15 @@ module Puppeteer
38
39
  alias disposed? closed?
39
40
 
40
41
  # Get all browsing contexts in this user context
41
- # @return [Array<BrowsingContext>] Top-level browsing contexts
42
+ # @rbs return: Array[BrowsingContext] -- Top-level browsing contexts
42
43
  def browsing_contexts
43
44
  @browsing_contexts.values
44
45
  end
45
46
 
46
47
  # Create a new browsing context (tab or window)
47
- # @param type [String] 'tab' or 'window'
48
- # @param options [Hash] Creation options
49
- # @option options [BrowsingContext] :reference_context Reference context
50
- # @return [BrowsingContext] New browsing context
48
+ # @rbs type: String -- 'tab' or 'window'
49
+ # @rbs reference_context: BrowsingContext? -- Reference context
50
+ # @rbs return: BrowsingContext -- New browsing context
51
51
  def create_browsing_context(type, **options)
52
52
  raise UserContextClosedError, @reason if closed?
53
53
 
@@ -96,9 +96,8 @@ module Puppeteer
96
96
  end
97
97
 
98
98
  # Get cookies for this user context
99
- # @param options [Hash] Cookie filter options
100
- # @option options [String] :source_origin Source origin
101
- # @return [Array<Hash>] Cookies
99
+ # @rbs source_origin: String? -- Source origin
100
+ # @rbs return: Array[Hash[String, untyped]] -- Cookies
102
101
  def get_cookies(**options)
103
102
  raise UserContextClosedError, @reason if closed?
104
103
 
@@ -115,8 +114,9 @@ module Puppeteer
115
114
  end
116
115
 
117
116
  # Set a cookie in this user context
118
- # @param cookie [Hash] Cookie data
119
- # @option options [String] :source_origin Source origin
117
+ # @rbs cookie: Hash[String, untyped] -- Cookie data
118
+ # @rbs source_origin: String? -- Source origin
119
+ # @rbs return: void
120
120
  def set_cookie(cookie, **options)
121
121
  raise UserContextClosedError, @reason if closed?
122
122
 
@@ -134,9 +134,10 @@ module Puppeteer
134
134
  end
135
135
 
136
136
  # Set permissions for an origin
137
- # @param origin [String] Origin URL
138
- # @param descriptor [Hash] Permission descriptor
139
- # @param state [String] Permission state
137
+ # @rbs origin: String -- Origin URL
138
+ # @rbs descriptor: Hash[String, untyped] -- Permission descriptor
139
+ # @rbs state: String -- Permission state
140
+ # @rbs return: void
140
141
  def set_permissions(origin, descriptor, state)
141
142
  raise UserContextClosedError, @reason if closed?
142
143
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  module Puppeteer
4
5
  module Bidi
@@ -8,9 +9,9 @@ module Puppeteer
8
9
  include Disposable::DisposableMixin
9
10
 
10
11
  # Create a user prompt instance
11
- # @param browsing_context [BrowsingContext] The browsing context
12
- # @param info [Hash] The userPromptOpened event data
13
- # @return [UserPrompt] New user prompt instance
12
+ # @rbs browsing_context: BrowsingContext -- The browsing context
13
+ # @rbs info: Hash[String, untyped] -- The userPromptOpened event data
14
+ # @rbs return: UserPrompt -- New user prompt instance
14
15
  def self.from(browsing_context, info)
15
16
  prompt = new(browsing_context, info)
16
17
  prompt.send(:initialize_prompt)
@@ -37,7 +38,7 @@ module Puppeteer
37
38
 
38
39
  # Check if the prompt has been handled
39
40
  # Auto-handled prompts return true immediately
40
- # @return [Boolean] Whether the prompt is handled
41
+ # @rbs return: bool -- Whether the prompt is handled
41
42
  def handled?
42
43
  handler = @info['handler']
43
44
  return true if handler == 'accept' || handler == 'dismiss'
@@ -45,9 +46,9 @@ module Puppeteer
45
46
  end
46
47
 
47
48
  # Handle the user prompt
48
- # @param accept [Boolean, nil] Whether to accept the prompt
49
- # @param user_text [String, nil] Text to enter (for prompt dialogs)
50
- # @return [Hash] Result of handling the prompt
49
+ # @rbs accept: bool? -- Whether to accept the prompt
50
+ # @rbs user_text: String? -- Text to enter (for prompt dialogs)
51
+ # @rbs return: Hash[String, untyped] -- Result of handling the prompt
51
52
  def handle(accept: nil, user_text: nil)
52
53
  raise UserPromptClosedError, @reason if closed?
53
54
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  # Core module provides low-level BiDi protocol abstractions
4
5
  # This layer sits above the WebSocket transport and provides
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  require 'time'
4
5
  require 'set'