roast-ai 0.4.10 → 0.5.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.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/commands/docs/write-comments.md +36 -0
  3. data/.github/CODEOWNERS +1 -1
  4. data/.github/workflows/ci.yaml +10 -6
  5. data/.gitignore +0 -1
  6. data/.rubocop.yml +7 -1
  7. data/CLAUDE.md +2 -2
  8. data/CONTRIBUTING.md +2 -0
  9. data/Gemfile +19 -18
  10. data/Gemfile.lock +35 -58
  11. data/README.md +118 -1432
  12. data/README_LEGACY.md +1464 -0
  13. data/Rakefile +39 -4
  14. data/dev.yml +29 -0
  15. data/dsl/agent_sessions.rb +20 -0
  16. data/dsl/async_cogs.rb +49 -0
  17. data/dsl/async_cogs_complex.rb +67 -0
  18. data/dsl/call.rb +44 -0
  19. data/dsl/collect_from.rb +72 -0
  20. data/dsl/json_output.rb +28 -0
  21. data/dsl/map.rb +55 -0
  22. data/dsl/map_reduce.rb +37 -0
  23. data/dsl/map_with_index.rb +49 -0
  24. data/dsl/next_break.rb +40 -0
  25. data/dsl/next_break_parallel.rb +44 -0
  26. data/dsl/outputs.rb +39 -0
  27. data/dsl/outputs_bang.rb +36 -0
  28. data/dsl/parallel_map.rb +37 -0
  29. data/dsl/prompts/simple_prompt.md.erb +3 -0
  30. data/dsl/prototype.rb +5 -7
  31. data/dsl/repeat_loop_results.rb +53 -0
  32. data/dsl/ruby_cog.rb +72 -0
  33. data/dsl/simple_agent.rb +18 -0
  34. data/dsl/simple_chat.rb +15 -1
  35. data/dsl/simple_repeat.rb +29 -0
  36. data/dsl/skip.rb +36 -0
  37. data/dsl/step_communication.rb +2 -3
  38. data/dsl/targets_and_params.rb +57 -0
  39. data/dsl/temperature.rb +17 -0
  40. data/dsl/temporary_directory.rb +22 -0
  41. data/dsl/tutorial/01_your_first_workflow/README.md +179 -0
  42. data/dsl/tutorial/01_your_first_workflow/configured_chat.rb +33 -0
  43. data/dsl/tutorial/01_your_first_workflow/hello.rb +23 -0
  44. data/dsl/tutorial/02_chaining_cogs/README.md +310 -0
  45. data/dsl/tutorial/02_chaining_cogs/code_review.rb +104 -0
  46. data/dsl/tutorial/02_chaining_cogs/session_resumption.rb +92 -0
  47. data/dsl/tutorial/02_chaining_cogs/simple_chain.rb +84 -0
  48. data/dsl/tutorial/03_targets_and_params/README.md +230 -0
  49. data/dsl/tutorial/03_targets_and_params/multiple_targets.rb +65 -0
  50. data/dsl/tutorial/03_targets_and_params/single_target.rb +65 -0
  51. data/dsl/tutorial/04_configuration_options/README.md +209 -0
  52. data/dsl/tutorial/04_configuration_options/control_display_and_temperature.rb +104 -0
  53. data/dsl/tutorial/04_configuration_options/simple_config.rb +68 -0
  54. data/dsl/tutorial/05_control_flow/README.md +156 -0
  55. data/dsl/tutorial/05_control_flow/conditional_execution.rb +62 -0
  56. data/dsl/tutorial/05_control_flow/handling_failures.rb +77 -0
  57. data/dsl/tutorial/06_reusable_scopes/README.md +172 -0
  58. data/dsl/tutorial/06_reusable_scopes/accessing_scope_outputs.rb +126 -0
  59. data/dsl/tutorial/06_reusable_scopes/basic_scope.rb +63 -0
  60. data/dsl/tutorial/06_reusable_scopes/parameterized_scope.rb +78 -0
  61. data/dsl/tutorial/07_processing_collections/README.md +152 -0
  62. data/dsl/tutorial/07_processing_collections/basic_map.rb +70 -0
  63. data/dsl/tutorial/07_processing_collections/parallel_map.rb +74 -0
  64. data/dsl/tutorial/08_iterative_workflows/README.md +231 -0
  65. data/dsl/tutorial/08_iterative_workflows/basic_repeat.rb +57 -0
  66. data/dsl/tutorial/08_iterative_workflows/conditional_break.rb +57 -0
  67. data/dsl/tutorial/09_async_cogs/README.md +197 -0
  68. data/dsl/tutorial/09_async_cogs/basic_async.rb +38 -0
  69. data/dsl/tutorial/README.md +222 -0
  70. data/dsl/working_directory.rb +16 -0
  71. data/exe/roast +1 -1
  72. data/internal/documentation/architectural-notes.md +115 -0
  73. data/internal/documentation/doc-comments-external.md +686 -0
  74. data/internal/documentation/doc-comments-internal.md +342 -0
  75. data/internal/documentation/doc-comments.md +211 -0
  76. data/lib/roast/dsl/cog/config.rb +274 -3
  77. data/lib/roast/dsl/cog/input.rb +53 -10
  78. data/lib/roast/dsl/cog/output.rb +297 -8
  79. data/lib/roast/dsl/cog/registry.rb +35 -3
  80. data/lib/roast/dsl/cog/stack.rb +1 -1
  81. data/lib/roast/dsl/cog/store.rb +5 -5
  82. data/lib/roast/dsl/cog.rb +70 -14
  83. data/lib/roast/dsl/cog_input_context.rb +36 -1
  84. data/lib/roast/dsl/cog_input_manager.rb +116 -7
  85. data/lib/roast/dsl/cogs/agent/config.rb +465 -0
  86. data/lib/roast/dsl/cogs/agent/input.rb +81 -0
  87. data/lib/roast/dsl/cogs/agent/output.rb +59 -0
  88. data/lib/roast/dsl/cogs/agent/provider.rb +51 -0
  89. data/lib/roast/dsl/cogs/agent/providers/claude/claude_invocation.rb +185 -0
  90. data/lib/roast/dsl/cogs/agent/providers/claude/message.rb +73 -0
  91. data/lib/roast/dsl/cogs/agent/providers/claude/messages/assistant_message.rb +36 -0
  92. data/lib/roast/dsl/cogs/agent/providers/claude/messages/result_message.rb +61 -0
  93. data/lib/roast/dsl/cogs/agent/providers/claude/messages/system_message.rb +47 -0
  94. data/lib/roast/dsl/cogs/agent/providers/claude/messages/text_message.rb +36 -0
  95. data/lib/roast/dsl/cogs/agent/providers/claude/messages/tool_result_message.rb +47 -0
  96. data/lib/roast/dsl/cogs/agent/providers/claude/messages/tool_use_message.rb +46 -0
  97. data/lib/roast/dsl/cogs/agent/providers/claude/messages/unknown_message.rb +27 -0
  98. data/lib/roast/dsl/cogs/agent/providers/claude/messages/user_message.rb +37 -0
  99. data/lib/roast/dsl/cogs/agent/providers/claude/tool_result.rb +51 -0
  100. data/lib/roast/dsl/cogs/agent/providers/claude/tool_use.rb +48 -0
  101. data/lib/roast/dsl/cogs/agent/providers/claude.rb +31 -0
  102. data/lib/roast/dsl/cogs/agent/stats.rb +92 -0
  103. data/lib/roast/dsl/cogs/agent/usage.rb +62 -0
  104. data/lib/roast/dsl/cogs/agent.rb +75 -0
  105. data/lib/roast/dsl/cogs/chat/config.rb +453 -0
  106. data/lib/roast/dsl/cogs/chat/input.rb +92 -0
  107. data/lib/roast/dsl/cogs/chat/output.rb +64 -0
  108. data/lib/roast/dsl/cogs/chat/session.rb +68 -0
  109. data/lib/roast/dsl/cogs/chat.rb +59 -56
  110. data/lib/roast/dsl/cogs/cmd.rb +248 -61
  111. data/lib/roast/dsl/cogs/ruby.rb +171 -0
  112. data/lib/roast/dsl/command_runner.rb +191 -0
  113. data/lib/roast/dsl/config_manager.rb +58 -11
  114. data/lib/roast/dsl/control_flow.rb +41 -0
  115. data/lib/roast/dsl/execution_manager.rb +162 -32
  116. data/lib/roast/dsl/nil_assertions.rb +23 -0
  117. data/lib/roast/dsl/system_cog/params.rb +32 -0
  118. data/lib/roast/dsl/system_cog.rb +36 -0
  119. data/lib/roast/dsl/system_cogs/call.rb +162 -0
  120. data/lib/roast/dsl/system_cogs/map.rb +448 -0
  121. data/lib/roast/dsl/system_cogs/repeat.rb +242 -0
  122. data/lib/roast/dsl/workflow.rb +26 -16
  123. data/lib/roast/dsl/workflow_context.rb +20 -0
  124. data/lib/roast/dsl/workflow_params.rb +24 -0
  125. data/lib/roast/sorbet_runtime_stub.rb +154 -0
  126. data/lib/roast/tools/apply_diff.rb +1 -3
  127. data/lib/roast/tools/cmd.rb +4 -3
  128. data/lib/roast/tools/read_file.rb +1 -1
  129. data/lib/roast/tools/update_files.rb +1 -1
  130. data/lib/roast/tools/write_file.rb +1 -1
  131. data/lib/roast/version.rb +1 -1
  132. data/lib/roast/workflow/base_workflow.rb +4 -0
  133. data/lib/roast/workflow/step_loader.rb +14 -2
  134. data/lib/roast-ai.rb +4 -0
  135. data/lib/roast.rb +58 -21
  136. data/{roast.gemspec → roast-ai.gemspec} +9 -13
  137. data/sorbet/rbi/gems/async@2.34.0.rbi +1577 -0
  138. data/sorbet/rbi/gems/cli-kit@5.2.0.rbi +2063 -0
  139. data/sorbet/rbi/gems/{cli-ui@2.3.0.rbi → cli-ui@2.7.0-6bdefd1d06305e5d6ae312ac76f9c88f88658dda.rbi} +1418 -1013
  140. data/sorbet/rbi/gems/console@1.34.2.rbi +1193 -0
  141. data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +50 -0
  142. data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +35 -0
  143. data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +41 -0
  144. data/sorbet/rbi/gems/io-event@1.14.0.rbi +724 -0
  145. data/sorbet/rbi/gems/metrics@0.15.0.rbi +9 -0
  146. data/sorbet/rbi/gems/traces@0.18.2.rbi +9 -0
  147. data/sorbet/rbi/shims/lib/roast/dsl/cog_input_context.rbi +1185 -5
  148. data/sorbet/rbi/shims/lib/roast/dsl/config_context.rbi +311 -5
  149. data/sorbet/rbi/shims/lib/roast/dsl/execution_context.rbi +486 -5
  150. data/sorbet/tapioca/config.yml +6 -0
  151. data/sorbet/tapioca/require.rb +2 -0
  152. metadata +157 -30
  153. data/dsl/less_simple.rb +0 -112
  154. data/dsl/scoped_executors.rb +0 -28
  155. data/dsl/simple.rb +0 -8
  156. data/lib/roast/dsl/cogs/execute.rb +0 -46
  157. data/lib/roast/dsl/cogs/graph.rb +0 -53
  158. data/sorbet/rbi/gems/cgi@0.5.0.rbi +0 -2961
  159. data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +0 -568
  160. data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +0 -1991
  161. data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +0 -672
  162. data/sorbet/rbi/gems/dry-core@1.1.0.rbi +0 -1894
  163. data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +0 -659
  164. data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +0 -781
  165. data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +0 -1127
  166. data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +0 -3727
  167. data/sorbet/rbi/gems/dry-types@1.8.3.rbi +0 -3969
  168. data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +0 -1588
  169. data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +0 -136
  170. data/sorbet/rbi/gems/mime-types@3.7.0.rbi +0 -1342
  171. data/sorbet/rbi/gems/rack@2.2.19.rbi +0 -5676
  172. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
  173. data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18492
@@ -0,0 +1,724 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `io-event` gem.
5
+ # Please instead update this file by running `bin/tapioca gem io-event`.
6
+
7
+
8
+ # source://io-event//lib/io/event/version.rb#7
9
+ class IO
10
+ include ::Enumerable
11
+ include ::File::Constants
12
+ end
13
+
14
+ class IO::Buffer
15
+ include ::Comparable
16
+
17
+ def initialize(*_arg0); end
18
+
19
+ def &(_arg0); end
20
+ def <=>(_arg0); end
21
+ def ^(_arg0); end
22
+ def and!(_arg0); end
23
+ def clear(*_arg0); end
24
+ def copy(*_arg0); end
25
+ def each(*_arg0); end
26
+ def each_byte(*_arg0); end
27
+ def empty?; end
28
+ def external?; end
29
+ def free; end
30
+ def get_string(*_arg0); end
31
+ def get_value(_arg0, _arg1); end
32
+ def get_values(_arg0, _arg1); end
33
+ def hexdump(*_arg0); end
34
+ def inspect; end
35
+ def internal?; end
36
+ def locked; end
37
+ def locked?; end
38
+ def mapped?; end
39
+ def not!; end
40
+ def null?; end
41
+ def or!(_arg0); end
42
+ def pread(*_arg0); end
43
+ def private?; end
44
+ def pwrite(*_arg0); end
45
+ def read(*_arg0); end
46
+ def readonly?; end
47
+ def resize(_arg0); end
48
+ def set_string(*_arg0); end
49
+ def set_value(_arg0, _arg1, _arg2); end
50
+ def set_values(_arg0, _arg1, _arg2); end
51
+ def shared?; end
52
+ def size; end
53
+ def slice(*_arg0); end
54
+ def to_s; end
55
+ def transfer; end
56
+ def valid?; end
57
+ def values(*_arg0); end
58
+ def write(*_arg0); end
59
+ def xor!(_arg0); end
60
+ def |(_arg0); end
61
+ def ~; end
62
+
63
+ private
64
+
65
+ def initialize_copy(_arg0); end
66
+
67
+ class << self
68
+ def for(_arg0); end
69
+ def map(*_arg0); end
70
+ def size_of(_arg0); end
71
+ def string(_arg0); end
72
+ end
73
+ end
74
+
75
+ class IO::Buffer::AccessError < ::RuntimeError; end
76
+ class IO::Buffer::AllocationError < ::RuntimeError; end
77
+ IO::Buffer::BIG_ENDIAN = T.let(T.unsafe(nil), Integer)
78
+ IO::Buffer::DEFAULT_SIZE = T.let(T.unsafe(nil), Integer)
79
+ IO::Buffer::EXTERNAL = T.let(T.unsafe(nil), Integer)
80
+ IO::Buffer::HOST_ENDIAN = T.let(T.unsafe(nil), Integer)
81
+ IO::Buffer::INTERNAL = T.let(T.unsafe(nil), Integer)
82
+ class IO::Buffer::InvalidatedError < ::RuntimeError; end
83
+ IO::Buffer::LITTLE_ENDIAN = T.let(T.unsafe(nil), Integer)
84
+ IO::Buffer::LOCKED = T.let(T.unsafe(nil), Integer)
85
+ class IO::Buffer::LockedError < ::RuntimeError; end
86
+ IO::Buffer::MAPPED = T.let(T.unsafe(nil), Integer)
87
+ class IO::Buffer::MaskError < ::ArgumentError; end
88
+ IO::Buffer::NETWORK_ENDIAN = T.let(T.unsafe(nil), Integer)
89
+ IO::Buffer::PAGE_SIZE = T.let(T.unsafe(nil), Integer)
90
+ IO::Buffer::PRIVATE = T.let(T.unsafe(nil), Integer)
91
+ IO::Buffer::READONLY = T.let(T.unsafe(nil), Integer)
92
+ IO::Buffer::SHARED = T.let(T.unsafe(nil), Integer)
93
+
94
+ class IO::ConsoleMode
95
+ def echo=(_arg0); end
96
+ def raw(*_arg0); end
97
+ def raw!(*_arg0); end
98
+
99
+ private
100
+
101
+ def initialize_copy(_arg0); end
102
+ end
103
+
104
+ class IO::EAGAINWaitReadable < ::Errno::EAGAIN
105
+ include ::IO::WaitReadable
106
+ end
107
+
108
+ class IO::EAGAINWaitWritable < ::Errno::EAGAIN
109
+ include ::IO::WaitWritable
110
+ end
111
+
112
+ class IO::EINPROGRESSWaitReadable < ::Errno::EINPROGRESS
113
+ include ::IO::WaitReadable
114
+ end
115
+
116
+ class IO::EINPROGRESSWaitWritable < ::Errno::EINPROGRESS
117
+ include ::IO::WaitWritable
118
+ end
119
+
120
+ IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable
121
+ IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable
122
+
123
+ # source://io-event//lib/io/event/version.rb#9
124
+ module IO::Event; end
125
+
126
+ # source://io-event//lib/io/event/debug/selector.rb#10
127
+ module IO::Event::Debug; end
128
+
129
+ # Enforces the selector interface and delegates operations to a wrapped selector instance.
130
+ #
131
+ # You can enable this in the default selector by setting the `IO_EVENT_DEBUG_SELECTOR` environment variable. In addition, you can log all selector operations to a file by setting the `IO_EVENT_DEBUG_SELECTOR_LOG` environment variable. This is useful for debugging and understanding the behavior of the event loop.
132
+ #
133
+ # source://io-event//lib/io/event/debug/selector.rb#14
134
+ class IO::Event::Debug::Selector
135
+ # Initialize the debug selector with the given selector and optional log.
136
+ #
137
+ # @return [Selector] a new instance of Selector
138
+ #
139
+ # source://io-event//lib/io/event/debug/selector.rb#33
140
+ def initialize(selector, log: T.unsafe(nil)); end
141
+
142
+ # Close the selector.
143
+ #
144
+ # source://io-event//lib/io/event/debug/selector.rb#78
145
+ def close; end
146
+
147
+ # The idle duration of the underlying selector.
148
+ #
149
+ # source://io-event//lib/io/event/debug/selector.rb#50
150
+ def idle_duration; end
151
+
152
+ # Read from the given IO, forwarded to the underlying selector.
153
+ #
154
+ # source://io-event//lib/io/event/debug/selector.rb#144
155
+ def io_read(fiber, io, buffer, length, offset = T.unsafe(nil)); end
156
+
157
+ # Wait for the given IO, forwarded to the underlying selector.
158
+ #
159
+ # source://io-event//lib/io/event/debug/selector.rb#138
160
+ def io_wait(fiber, io, events); end
161
+
162
+ # Write to the given IO, forwarded to the underlying selector.
163
+ #
164
+ # source://io-event//lib/io/event/debug/selector.rb#150
165
+ def io_write(fiber, io, buffer, length, offset = T.unsafe(nil)); end
166
+
167
+ # Log the given message.
168
+ #
169
+ # source://io-event//lib/io/event/debug/selector.rb#64
170
+ def log(message); end
171
+
172
+ # The current time.
173
+ #
174
+ # source://io-event//lib/io/event/debug/selector.rb#57
175
+ def now; end
176
+
177
+ # Wait for the given process, forwarded to the underlying selector.
178
+ #
179
+ # source://io-event//lib/io/event/debug/selector.rb#132
180
+ def process_wait(*arguments); end
181
+
182
+ # Push the given fiber to the selector ready list, such that it will be resumed on the next call to {select}.
183
+ #
184
+ # source://io-event//lib/io/event/debug/selector.rb#110
185
+ def push(fiber); end
186
+
187
+ # Raise the given exception on the given fiber.
188
+ #
189
+ # source://io-event//lib/io/event/debug/selector.rb#119
190
+ def raise(fiber, *arguments, **options); end
191
+
192
+ # Check if the selector is ready.
193
+ #
194
+ # @return [Boolean]
195
+ #
196
+ # source://io-event//lib/io/event/debug/selector.rb#127
197
+ def ready?; end
198
+
199
+ # Forward the given method to the underlying selector.
200
+ #
201
+ # @return [Boolean]
202
+ #
203
+ # source://io-event//lib/io/event/debug/selector.rb#156
204
+ def respond_to?(name, include_private = T.unsafe(nil)); end
205
+
206
+ # Resume the given fiber with the given arguments.
207
+ #
208
+ # source://io-event//lib/io/event/debug/selector.rb#96
209
+ def resume(*arguments); end
210
+
211
+ # Select for the given duration, forwarded to the underlying selector.
212
+ #
213
+ # source://io-event//lib/io/event/debug/selector.rb#161
214
+ def select(duration = T.unsafe(nil)); end
215
+
216
+ # Transfer from the calling fiber to the selector.
217
+ #
218
+ # source://io-event//lib/io/event/debug/selector.rb#90
219
+ def transfer; end
220
+
221
+ # Wakeup the the selector.
222
+ #
223
+ # source://io-event//lib/io/event/debug/selector.rb#73
224
+ def wakeup; end
225
+
226
+ # Yield to the selector.
227
+ #
228
+ # source://io-event//lib/io/event/debug/selector.rb#102
229
+ def yield; end
230
+
231
+ class << self
232
+ # Wrap the given selector with debugging.
233
+ #
234
+ # source://io-event//lib/io/event/debug/selector.rb#19
235
+ def wrap(selector, env = T.unsafe(nil)); end
236
+ end
237
+ end
238
+
239
+ # A thread safe synchronisation primative.
240
+ #
241
+ # source://io-event//lib/io/event/interrupt.rb#8
242
+ class IO::Event::Interrupt
243
+ # @return [Interrupt] a new instance of Interrupt
244
+ #
245
+ # source://io-event//lib/io/event/interrupt.rb#13
246
+ def initialize(selector); end
247
+
248
+ # source://io-event//lib/io/event/interrupt.rb#36
249
+ def close; end
250
+
251
+ # Send a sigle byte interrupt.
252
+ #
253
+ # source://io-event//lib/io/event/interrupt.rb#29
254
+ def signal; end
255
+
256
+ class << self
257
+ # source://io-event//lib/io/event/interrupt.rb#9
258
+ def attach(selector); end
259
+ end
260
+ end
261
+
262
+ # A priority queue implementation using a standard binary minheap. It uses straight comparison
263
+ # of its contents to determine priority.
264
+ # See <https://en.wikipedia.org/wiki/Binary_heap> for explanations of the main methods.
265
+ #
266
+ # source://io-event//lib/io/event/priority_heap.rb#12
267
+ class IO::Event::PriorityHeap
268
+ # Initializes the heap.
269
+ #
270
+ # @return [PriorityHeap] a new instance of PriorityHeap
271
+ #
272
+ # source://io-event//lib/io/event/priority_heap.rb#14
273
+ def initialize; end
274
+
275
+ # Empties out the heap, discarding all elements
276
+ #
277
+ # source://io-event//lib/io/event/priority_heap.rb#100
278
+ def clear!; end
279
+
280
+ # Add multiple elements to the heap efficiently in O(n) time.
281
+ # This is more efficient than calling push multiple times (O(n log n)).
282
+ #
283
+ # source://io-event//lib/io/event/priority_heap.rb#87
284
+ def concat(elements); end
285
+
286
+ # Remove a specific element from the heap.
287
+ #
288
+ # O(n) where n is the number of elements in the heap.
289
+ #
290
+ # source://io-event//lib/io/event/priority_heap.rb#110
291
+ def delete(element); end
292
+
293
+ # Remove elements matching the given block condition by rebuilding the heap.
294
+ #
295
+ # This is more efficient than multiple delete operations when removing many elements.
296
+ #
297
+ # O(n) where n is the number of elements in the heap.
298
+ #
299
+ # source://io-event//lib/io/event/priority_heap.rb#149
300
+ def delete_if; end
301
+
302
+ # @return [Boolean]
303
+ #
304
+ # source://io-event//lib/io/event/priority_heap.rb#32
305
+ def empty?; end
306
+
307
+ # source://io-event//lib/io/event/priority_heap.rb#22
308
+ def peek; end
309
+
310
+ # Removes and returns the smallest element in the heap, or nil if the heap is empty.
311
+ #
312
+ # source://io-event//lib/io/event/priority_heap.rb#39
313
+ def pop; end
314
+
315
+ # Add a new element to the heap, then rearrange elements until the heap invariant is true again.
316
+ #
317
+ # source://io-event//lib/io/event/priority_heap.rb#70
318
+ def push(element); end
319
+
320
+ # source://io-event//lib/io/event/priority_heap.rb#27
321
+ def size; end
322
+
323
+ # Validate the heap invariant. Every element except the root must not be smaller than its parent element. Note that it MAY be equal.
324
+ #
325
+ # @return [Boolean]
326
+ #
327
+ # source://io-event//lib/io/event/priority_heap.rb#167
328
+ def valid?; end
329
+
330
+ private
331
+
332
+ # source://io-event//lib/io/event/priority_heap.rb#206
333
+ def bubble_down(index); end
334
+
335
+ # Left here for reference, but unused.
336
+ # def swap(i, j)
337
+ # @contents[i], @contents[j] = @contents[j], @contents[i]
338
+ # end
339
+ #
340
+ # source://io-event//lib/io/event/priority_heap.rb#193
341
+ def bubble_up(index); end
342
+
343
+ # Rebuild the heap property from an arbitrary array in O(n) time.
344
+ # Uses bottom-up heapify algorithm starting from the last non-leaf node.
345
+ #
346
+ # source://io-event//lib/io/event/priority_heap.rb#176
347
+ def heapify!; end
348
+ end
349
+
350
+ # source://io-event//lib/io/event/selector/select.rb#11
351
+ module IO::Event::Selector
352
+ class << self
353
+ # The default selector implementation, which is chosen based on the environment and available implementations.
354
+ #
355
+ # source://io-event//lib/io/event/selector.rb#17
356
+ def default(env = T.unsafe(nil)); end
357
+
358
+ # Create a new selector instance, according to the best available implementation.
359
+ #
360
+ # source://io-event//lib/io/event/selector.rb#38
361
+ def new(loop, env = T.unsafe(nil)); end
362
+
363
+ # Execute the given block in non-blocking mode.
364
+ def nonblock(_arg0); end
365
+ end
366
+ end
367
+
368
+ class IO::Event::Selector::KQueue
369
+ def initialize(_arg0); end
370
+
371
+ def close; end
372
+ def idle_duration; end
373
+ def io_read(*_arg0); end
374
+ def io_wait(_arg0, _arg1, _arg2); end
375
+ def io_write(*_arg0); end
376
+ def loop; end
377
+ def process_wait(_arg0, _arg1, _arg2); end
378
+ def push(_arg0); end
379
+ def raise(*_arg0); end
380
+ def ready?; end
381
+ def resume(*_arg0); end
382
+ def select(_arg0); end
383
+ def transfer; end
384
+ def wakeup; end
385
+ def yield; end
386
+ end
387
+
388
+ # A pure-Ruby implementation of the event selector.
389
+ #
390
+ # source://io-event//lib/io/event/selector/select.rb#13
391
+ class IO::Event::Selector::Select
392
+ # Initialize the selector with the given event loop fiber.
393
+ #
394
+ # @return [Select] a new instance of Select
395
+ #
396
+ # source://io-event//lib/io/event/selector/select.rb#15
397
+ def initialize(loop); end
398
+
399
+ # Close the selector and release any resources.
400
+ #
401
+ # source://io-event//lib/io/event/selector/select.rb#49
402
+ def close; end
403
+
404
+ # Returns the value of attribute idle_duration.
405
+ #
406
+ # source://io-event//lib/io/event/selector/select.rb#35
407
+ def idle_duration; end
408
+
409
+ # Ruby 3.2, most IO::Buffer support, but slightly clunky read/write methods.
410
+ #
411
+ # source://io-event//lib/io/event/selector/select.rb#194
412
+ def io_read(fiber, io, buffer, length, offset = T.unsafe(nil)); end
413
+
414
+ # Wait for multiple IO objects to become readable or writable.
415
+ #
416
+ # source://io-event//lib/io/event/selector/select.rb#173
417
+ def io_select(readable, writable, priority, timeout); end
418
+
419
+ # Wait for the given IO to become readable or writable.
420
+ #
421
+ # source://io-event//lib/io/event/selector/select.rb#160
422
+ def io_wait(fiber, io, events); end
423
+
424
+ # Write to the given IO from the buffer.
425
+ #
426
+ # source://io-event//lib/io/event/selector/select.rb#224
427
+ def io_write(fiber, io, buffer, length, offset = T.unsafe(nil)); end
428
+
429
+ # Returns the value of attribute loop.
430
+ #
431
+ # source://io-event//lib/io/event/selector/select.rb#32
432
+ def loop; end
433
+
434
+ # Wait for a process to change state.
435
+ #
436
+ # source://io-event//lib/io/event/selector/select.rb#316
437
+ def process_wait(fiber, pid, flags); end
438
+
439
+ # Append the given fiber into the ready list.
440
+ #
441
+ # source://io-event//lib/io/event/selector/select.rb#96
442
+ def push(fiber); end
443
+
444
+ # Transfer to the given fiber and raise an exception. Put the current fiber into the ready list.
445
+ #
446
+ # source://io-event//lib/io/event/selector/select.rb#101
447
+ def raise(fiber, *arguments, **options); end
448
+
449
+ # @return [Boolean]
450
+ #
451
+ # source://io-event//lib/io/event/selector/select.rb#111
452
+ def ready?; end
453
+
454
+ # Transfer from the current fiber to the specified fiber. Put the current fiber into the ready list.
455
+ #
456
+ # source://io-event//lib/io/event/selector/select.rb#76
457
+ def resume(fiber, *arguments); end
458
+
459
+ # Wait for IO events or a timeout.
460
+ #
461
+ # source://io-event//lib/io/event/selector/select.rb#339
462
+ def select(duration = T.unsafe(nil)); end
463
+
464
+ # Transfer from the current fiber to the event loop.
465
+ #
466
+ # source://io-event//lib/io/event/selector/select.rb#71
467
+ def transfer; end
468
+
469
+ # Wake up the event loop if it is currently sleeping.
470
+ #
471
+ # source://io-event//lib/io/event/selector/select.rb#38
472
+ def wakeup; end
473
+
474
+ # Yield from the current fiber back to the event loop. Put the current fiber into the ready list.
475
+ #
476
+ # source://io-event//lib/io/event/selector/select.rb#86
477
+ def yield; end
478
+
479
+ protected
480
+
481
+ # Whether the given error code indicates that the operation should be retried.
482
+ #
483
+ # @return [Boolean]
484
+ #
485
+ # source://io-event//lib/io/event/selector/select.rb#183
486
+ def again?(errno); end
487
+
488
+ private
489
+
490
+ # source://io-event//lib/io/event/selector/select.rb#322
491
+ def pop_ready; end
492
+ end
493
+
494
+ # source://io-event//lib/io/event/selector/select.rb#179
495
+ IO::Event::Selector::Select::EAGAIN = T.let(T.unsafe(nil), Integer)
496
+
497
+ # source://io-event//lib/io/event/selector/select.rb#180
498
+ IO::Event::Selector::Select::EWOULDBLOCK = T.let(T.unsafe(nil), Integer)
499
+
500
+ # source://io-event//lib/io/event/selector/select.rb#56
501
+ class IO::Event::Selector::Select::Optional < ::Struct
502
+ # @return [Boolean]
503
+ #
504
+ # source://io-event//lib/io/event/selector/select.rb#61
505
+ def alive?; end
506
+
507
+ # Returns the value of attribute fiber
508
+ #
509
+ # @return [Object] the current value of fiber
510
+ def fiber; end
511
+
512
+ # Sets the attribute fiber
513
+ #
514
+ # @param value [Object] the value to set the attribute fiber to.
515
+ # @return [Object] the newly set value
516
+ def fiber=(_); end
517
+
518
+ # source://io-event//lib/io/event/selector/select.rb#65
519
+ def nullify; end
520
+
521
+ # source://io-event//lib/io/event/selector/select.rb#57
522
+ def transfer(*arguments); end
523
+
524
+ class << self
525
+ def [](*_arg0); end
526
+ def inspect; end
527
+ def keyword_init?; end
528
+ def members; end
529
+ def new(*_arg0); end
530
+ end
531
+ end
532
+
533
+ # source://io-event//lib/io/event/selector/select.rb#115
534
+ class IO::Event::Selector::Select::Waiter < ::Struct
535
+ # @return [Boolean]
536
+ #
537
+ # source://io-event//lib/io/event/selector/select.rb#116
538
+ def alive?; end
539
+
540
+ # Dispatch the given events to the list of waiting fibers. If the fiber was not waiting for the given events, it is reactivated by calling the given block.
541
+ #
542
+ # source://io-event//lib/io/event/selector/select.rb#121
543
+ def dispatch(events, &reactivate); end
544
+
545
+ # source://io-event//lib/io/event/selector/select.rb#146
546
+ def each(&block); end
547
+
548
+ # Returns the value of attribute events
549
+ #
550
+ # @return [Object] the current value of events
551
+ def events; end
552
+
553
+ # Sets the attribute events
554
+ #
555
+ # @param value [Object] the value to set the attribute events to.
556
+ # @return [Object] the newly set value
557
+ def events=(_); end
558
+
559
+ # Returns the value of attribute fiber
560
+ #
561
+ # @return [Object] the current value of fiber
562
+ def fiber; end
563
+
564
+ # Sets the attribute fiber
565
+ #
566
+ # @param value [Object] the value to set the attribute fiber to.
567
+ # @return [Object] the newly set value
568
+ def fiber=(_); end
569
+
570
+ # source://io-event//lib/io/event/selector/select.rb#142
571
+ def invalidate; end
572
+
573
+ # Returns the value of attribute tail
574
+ #
575
+ # @return [Object] the current value of tail
576
+ def tail; end
577
+
578
+ # Sets the attribute tail
579
+ #
580
+ # @param value [Object] the value to set the attribute tail to.
581
+ # @return [Object] the newly set value
582
+ def tail=(_); end
583
+
584
+ class << self
585
+ def [](*_arg0); end
586
+ def inspect; end
587
+ def keyword_init?; end
588
+ def members; end
589
+ def new(*_arg0); end
590
+ end
591
+ end
592
+
593
+ # Helper methods for detecting support for various features.
594
+ #
595
+ # source://io-event//lib/io/event/support.rb#9
596
+ module IO::Event::Support
597
+ class << self
598
+ # Some features are only availble if the IO::Buffer class is available.
599
+ #
600
+ # @return [Boolean]
601
+ #
602
+ # source://io-event//lib/io/event/support.rb#13
603
+ def buffer?; end
604
+
605
+ # More advanced read/write methods and blocking controls were introduced in Ruby 3.2.
606
+ #
607
+ # To be removed on 31 Mar 2026.
608
+ #
609
+ # @return [Boolean]
610
+ #
611
+ # source://io-event//lib/io/event/support.rb#20
612
+ def fiber_scheduler_v2?; end
613
+
614
+ # Updated inferfaces for read/write and IO::Buffer were introduced in Ruby 3.3, including pread/pwrite.
615
+ #
616
+ # To become the default 31 Mar 2026.
617
+ #
618
+ # @return [Boolean]
619
+ #
620
+ # source://io-event//lib/io/event/support.rb#35
621
+ def fiber_scheduler_v3?; end
622
+ end
623
+ end
624
+
625
+ # An efficient sorted set of timers.
626
+ #
627
+ # source://io-event//lib/io/event/timers.rb#11
628
+ class IO::Event::Timers
629
+ # Initialize the timers.
630
+ #
631
+ # @return [Timers] a new instance of Timers
632
+ #
633
+ # source://io-event//lib/io/event/timers.rb#62
634
+ def initialize; end
635
+
636
+ # Schedule a block to be called after a specific time offset, relative to the current time as returned by {#now}.
637
+ #
638
+ # source://io-event//lib/io/event/timers.rb#90
639
+ def after(offset, &block); end
640
+
641
+ # Fire all timers that are ready to fire.
642
+ #
643
+ # source://io-event//lib/io/event/timers.rb#118
644
+ def fire(now = T.unsafe(nil)); end
645
+
646
+ # source://io-event//lib/io/event/timers.rb#111
647
+ def now; end
648
+
649
+ # Schedule a block to be called at a specific time in the future.
650
+ #
651
+ # source://io-event//lib/io/event/timers.rb#78
652
+ def schedule(time, block); end
653
+
654
+ # source://io-event//lib/io/event/timers.rb#68
655
+ def size; end
656
+
657
+ # Compute the time interval until the next timer fires.
658
+ #
659
+ # source://io-event//lib/io/event/timers.rb#98
660
+ def wait_interval(now = T.unsafe(nil)); end
661
+
662
+ protected
663
+
664
+ # Flush all scheduled timers into the heap.
665
+ #
666
+ # This is a small optimization which assumes that most timers (timeouts) will be cancelled.
667
+ #
668
+ # source://io-event//lib/io/event/timers.rb#141
669
+ def flush!; end
670
+ end
671
+
672
+ # A handle to a scheduled timer.
673
+ #
674
+ # source://io-event//lib/io/event/timers.rb#13
675
+ class IO::Event::Timers::Handle
676
+ # Initialize the handle with the given time and block.
677
+ #
678
+ # @return [Handle] a new instance of Handle
679
+ #
680
+ # source://io-event//lib/io/event/timers.rb#18
681
+ def initialize(time, block); end
682
+
683
+ # Compare the handle with another handle.
684
+ #
685
+ # source://io-event//lib/io/event/timers.rb#33
686
+ def <(other); end
687
+
688
+ # Compare the handle with another handle.
689
+ #
690
+ # source://io-event//lib/io/event/timers.rb#41
691
+ def >(other); end
692
+
693
+ # Returns the value of attribute block.
694
+ #
695
+ # source://io-event//lib/io/event/timers.rb#27
696
+ def block; end
697
+
698
+ # Invoke the block.
699
+ #
700
+ # source://io-event//lib/io/event/timers.rb#46
701
+ def call(*_arg0, **_arg1, &_arg2); end
702
+
703
+ # Cancel the timer.
704
+ #
705
+ # source://io-event//lib/io/event/timers.rb#51
706
+ def cancel!; end
707
+
708
+ # @return [Boolean]
709
+ #
710
+ # source://io-event//lib/io/event/timers.rb#56
711
+ def cancelled?; end
712
+
713
+ # Returns the value of attribute time.
714
+ #
715
+ # source://io-event//lib/io/event/timers.rb#24
716
+ def time; end
717
+ end
718
+
719
+ # source://io-event//lib/io/event/version.rb#10
720
+ IO::Event::VERSION = T.let(T.unsafe(nil), String)
721
+
722
+ IO::PRIORITY = T.let(T.unsafe(nil), Integer)
723
+ IO::READABLE = T.let(T.unsafe(nil), Integer)
724
+ IO::WRITABLE = T.let(T.unsafe(nil), Integer)