effect 4.0.0-beta.101 → 4.0.0-beta.103

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 (1580) hide show
  1. package/dist/Array.d.ts +971 -1037
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +462 -412
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +433 -756
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +200 -325
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +207 -267
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +107 -135
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +146 -188
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +64 -84
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.js.map +1 -1
  18. package/dist/Cache.d.ts +405 -254
  19. package/dist/Cache.d.ts.map +1 -1
  20. package/dist/Cache.js +166 -101
  21. package/dist/Cache.js.map +1 -1
  22. package/dist/Cause.d.ts +167 -277
  23. package/dist/Cause.d.ts.map +1 -1
  24. package/dist/Cause.js +122 -176
  25. package/dist/Cause.js.map +1 -1
  26. package/dist/Channel.d.ts +729 -768
  27. package/dist/Channel.d.ts.map +1 -1
  28. package/dist/Channel.js +541 -449
  29. package/dist/Channel.js.map +1 -1
  30. package/dist/ChannelSchema.d.ts +1 -1
  31. package/dist/ChannelSchema.d.ts.map +1 -1
  32. package/dist/ChannelSchema.js.map +1 -1
  33. package/dist/Chunk.d.ts +834 -1173
  34. package/dist/Chunk.d.ts.map +1 -1
  35. package/dist/Chunk.js +326 -439
  36. package/dist/Chunk.js.map +1 -1
  37. package/dist/Clock.d.ts +180 -49
  38. package/dist/Clock.d.ts.map +1 -1
  39. package/dist/Clock.js +96 -31
  40. package/dist/Clock.js.map +1 -1
  41. package/dist/Combiner.d.ts +20 -33
  42. package/dist/Combiner.d.ts.map +1 -1
  43. package/dist/Combiner.js +18 -30
  44. package/dist/Combiner.js.map +1 -1
  45. package/dist/Config.d.ts +226 -174
  46. package/dist/Config.d.ts.map +1 -1
  47. package/dist/Config.js +339 -267
  48. package/dist/Config.js.map +1 -1
  49. package/dist/ConfigProvider.d.ts +194 -68
  50. package/dist/ConfigProvider.d.ts.map +1 -1
  51. package/dist/ConfigProvider.js +122 -87
  52. package/dist/ConfigProvider.js.map +1 -1
  53. package/dist/Console.d.ts +233 -33
  54. package/dist/Console.d.ts.map +1 -1
  55. package/dist/Console.js +232 -32
  56. package/dist/Console.js.map +1 -1
  57. package/dist/Context.d.ts +151 -274
  58. package/dist/Context.d.ts.map +1 -1
  59. package/dist/Context.js +171 -214
  60. package/dist/Context.js.map +1 -1
  61. package/dist/Cron.d.ts +68 -77
  62. package/dist/Cron.d.ts.map +1 -1
  63. package/dist/Cron.js +57 -66
  64. package/dist/Cron.js.map +1 -1
  65. package/dist/Crypto.d.ts +13 -15
  66. package/dist/Crypto.d.ts.map +1 -1
  67. package/dist/Crypto.js +9 -10
  68. package/dist/Crypto.js.map +1 -1
  69. package/dist/Data.d.ts +60 -80
  70. package/dist/Data.d.ts.map +1 -1
  71. package/dist/Data.js +18 -24
  72. package/dist/Data.js.map +1 -1
  73. package/dist/DateTime.d.ts +562 -660
  74. package/dist/DateTime.d.ts.map +1 -1
  75. package/dist/DateTime.js +307 -362
  76. package/dist/DateTime.js.map +1 -1
  77. package/dist/Deferred.d.ts +253 -256
  78. package/dist/Deferred.d.ts.map +1 -1
  79. package/dist/Deferred.js +104 -96
  80. package/dist/Deferred.js.map +1 -1
  81. package/dist/Duration.d.ts +216 -308
  82. package/dist/Duration.d.ts.map +1 -1
  83. package/dist/Duration.js +132 -186
  84. package/dist/Duration.js.map +1 -1
  85. package/dist/Effect.d.ts +2897 -3342
  86. package/dist/Effect.d.ts.map +1 -1
  87. package/dist/Effect.js +1383 -1580
  88. package/dist/Effect.js.map +1 -1
  89. package/dist/Effectable.js.map +1 -1
  90. package/dist/Encoding.d.ts +22 -40
  91. package/dist/Encoding.d.ts.map +1 -1
  92. package/dist/Encoding.js +22 -40
  93. package/dist/Encoding.js.map +1 -1
  94. package/dist/Equal.d.ts +33 -37
  95. package/dist/Equal.d.ts.map +1 -1
  96. package/dist/Equal.js +29 -21
  97. package/dist/Equal.js.map +1 -1
  98. package/dist/Equivalence.d.ts +103 -105
  99. package/dist/Equivalence.d.ts.map +1 -1
  100. package/dist/Equivalence.js +77 -79
  101. package/dist/Equivalence.js.map +1 -1
  102. package/dist/ErrorReporter.d.ts +51 -27
  103. package/dist/ErrorReporter.d.ts.map +1 -1
  104. package/dist/ErrorReporter.js +50 -26
  105. package/dist/ErrorReporter.js.map +1 -1
  106. package/dist/ExecutionPlan.d.ts +13 -55
  107. package/dist/ExecutionPlan.d.ts.map +1 -1
  108. package/dist/ExecutionPlan.js +7 -28
  109. package/dist/ExecutionPlan.js.map +1 -1
  110. package/dist/Exit.d.ts +116 -192
  111. package/dist/Exit.d.ts.map +1 -1
  112. package/dist/Exit.js +82 -130
  113. package/dist/Exit.js.map +1 -1
  114. package/dist/Fiber.d.ts +82 -146
  115. package/dist/Fiber.d.ts.map +1 -1
  116. package/dist/Fiber.js +48 -87
  117. package/dist/Fiber.js.map +1 -1
  118. package/dist/FiberHandle.d.ts +152 -105
  119. package/dist/FiberHandle.d.ts.map +1 -1
  120. package/dist/FiberHandle.js +109 -75
  121. package/dist/FiberHandle.js.map +1 -1
  122. package/dist/FiberMap.d.ts +213 -168
  123. package/dist/FiberMap.d.ts.map +1 -1
  124. package/dist/FiberMap.js +114 -89
  125. package/dist/FiberMap.js.map +1 -1
  126. package/dist/FiberSet.d.ts +123 -81
  127. package/dist/FiberSet.d.ts.map +1 -1
  128. package/dist/FiberSet.js +85 -59
  129. package/dist/FiberSet.js.map +1 -1
  130. package/dist/FileSystem.d.ts +153 -264
  131. package/dist/FileSystem.d.ts.map +1 -1
  132. package/dist/FileSystem.js +42 -147
  133. package/dist/FileSystem.js.map +1 -1
  134. package/dist/Filter.d.ts +61 -33
  135. package/dist/Filter.d.ts.map +1 -1
  136. package/dist/Filter.js +26 -15
  137. package/dist/Filter.js.map +1 -1
  138. package/dist/Formatter.d.ts +25 -33
  139. package/dist/Formatter.d.ts.map +1 -1
  140. package/dist/Formatter.js +48 -49
  141. package/dist/Formatter.js.map +1 -1
  142. package/dist/Function.d.ts +76 -145
  143. package/dist/Function.d.ts.map +1 -1
  144. package/dist/Function.js +40 -57
  145. package/dist/Function.js.map +1 -1
  146. package/dist/Graph.d.ts +360 -714
  147. package/dist/Graph.d.ts.map +1 -1
  148. package/dist/Graph.js +168 -297
  149. package/dist/Graph.js.map +1 -1
  150. package/dist/HKT.d.ts +12 -6
  151. package/dist/HKT.d.ts.map +1 -1
  152. package/dist/Hash.d.ts +47 -83
  153. package/dist/Hash.d.ts.map +1 -1
  154. package/dist/Hash.js +46 -68
  155. package/dist/Hash.js.map +1 -1
  156. package/dist/HashMap.d.ts +319 -411
  157. package/dist/HashMap.d.ts.map +1 -1
  158. package/dist/HashMap.js +122 -166
  159. package/dist/HashMap.js.map +1 -1
  160. package/dist/HashRing.d.ts.map +1 -1
  161. package/dist/HashRing.js +1 -0
  162. package/dist/HashRing.js.map +1 -1
  163. package/dist/HashSet.d.ts +177 -284
  164. package/dist/HashSet.d.ts.map +1 -1
  165. package/dist/HashSet.js +68 -109
  166. package/dist/HashSet.js.map +1 -1
  167. package/dist/Inspectable.d.ts +12 -12
  168. package/dist/Inspectable.js +8 -8
  169. package/dist/Inspectable.js.map +1 -1
  170. package/dist/Iterable.d.ts +620 -786
  171. package/dist/Iterable.d.ts.map +1 -1
  172. package/dist/Iterable.js +230 -307
  173. package/dist/Iterable.js.map +1 -1
  174. package/dist/JsonPatch.d.ts +11 -13
  175. package/dist/JsonPatch.d.ts.map +1 -1
  176. package/dist/JsonPatch.js +46 -103
  177. package/dist/JsonPatch.js.map +1 -1
  178. package/dist/JsonPointer.d.ts +8 -8
  179. package/dist/JsonPointer.js +8 -8
  180. package/dist/JsonPointer.js.map +1 -1
  181. package/dist/JsonSchema.d.ts +98 -44
  182. package/dist/JsonSchema.d.ts.map +1 -1
  183. package/dist/JsonSchema.js +300 -239
  184. package/dist/JsonSchema.js.map +1 -1
  185. package/dist/Latch.d.ts +23 -35
  186. package/dist/Latch.d.ts.map +1 -1
  187. package/dist/Latch.js +16 -28
  188. package/dist/Latch.js.map +1 -1
  189. package/dist/Layer.d.ts +359 -260
  190. package/dist/Layer.d.ts.map +1 -1
  191. package/dist/Layer.js +195 -175
  192. package/dist/Layer.js.map +1 -1
  193. package/dist/LayerMap.d.ts +42 -29
  194. package/dist/LayerMap.d.ts.map +1 -1
  195. package/dist/LayerMap.js +31 -21
  196. package/dist/LayerMap.js.map +1 -1
  197. package/dist/LayerRef.d.ts +6 -2
  198. package/dist/LayerRef.d.ts.map +1 -1
  199. package/dist/LayerRef.js +6 -2
  200. package/dist/LayerRef.js.map +1 -1
  201. package/dist/LogLevel.d.ts +114 -214
  202. package/dist/LogLevel.d.ts.map +1 -1
  203. package/dist/LogLevel.js +41 -76
  204. package/dist/LogLevel.js.map +1 -1
  205. package/dist/Logger.d.ts +218 -467
  206. package/dist/Logger.d.ts.map +1 -1
  207. package/dist/Logger.js +207 -452
  208. package/dist/Logger.js.map +1 -1
  209. package/dist/ManagedRuntime.d.ts +16 -5
  210. package/dist/ManagedRuntime.d.ts.map +1 -1
  211. package/dist/ManagedRuntime.js +10 -5
  212. package/dist/ManagedRuntime.js.map +1 -1
  213. package/dist/Match.d.ts +217 -252
  214. package/dist/Match.d.ts.map +1 -1
  215. package/dist/Match.js +150 -183
  216. package/dist/Match.js.map +1 -1
  217. package/dist/Metric.d.ts +442 -993
  218. package/dist/Metric.d.ts.map +1 -1
  219. package/dist/Metric.js +202 -645
  220. package/dist/Metric.js.map +1 -1
  221. package/dist/MutableHashMap.d.ts +144 -173
  222. package/dist/MutableHashMap.d.ts.map +1 -1
  223. package/dist/MutableHashMap.js +68 -79
  224. package/dist/MutableHashMap.js.map +1 -1
  225. package/dist/MutableHashSet.d.ts +84 -89
  226. package/dist/MutableHashSet.d.ts.map +1 -1
  227. package/dist/MutableHashSet.js +44 -47
  228. package/dist/MutableHashSet.js.map +1 -1
  229. package/dist/MutableList.d.ts +71 -370
  230. package/dist/MutableList.d.ts.map +1 -1
  231. package/dist/MutableList.js +59 -284
  232. package/dist/MutableList.js.map +1 -1
  233. package/dist/MutableRef.d.ts +420 -243
  234. package/dist/MutableRef.d.ts.map +1 -1
  235. package/dist/MutableRef.js +209 -120
  236. package/dist/MutableRef.js.map +1 -1
  237. package/dist/Newtype.d.ts +21 -14
  238. package/dist/Newtype.d.ts.map +1 -1
  239. package/dist/Newtype.js +15 -13
  240. package/dist/Newtype.js.map +1 -1
  241. package/dist/NonEmptyIterable.d.ts +7 -137
  242. package/dist/NonEmptyIterable.d.ts.map +1 -1
  243. package/dist/NonEmptyIterable.js +5 -93
  244. package/dist/NonEmptyIterable.js.map +1 -1
  245. package/dist/Number.d.ts +196 -233
  246. package/dist/Number.d.ts.map +1 -1
  247. package/dist/Number.js +90 -109
  248. package/dist/Number.js.map +1 -1
  249. package/dist/Optic.d.ts +97 -189
  250. package/dist/Optic.d.ts.map +1 -1
  251. package/dist/Optic.js +190 -292
  252. package/dist/Optic.js.map +1 -1
  253. package/dist/Option.d.ts +447 -812
  254. package/dist/Option.d.ts.map +1 -1
  255. package/dist/Option.js +213 -393
  256. package/dist/Option.js.map +1 -1
  257. package/dist/Order.d.ts +109 -109
  258. package/dist/Order.js +91 -91
  259. package/dist/Order.js.map +1 -1
  260. package/dist/Ordering.d.ts +20 -23
  261. package/dist/Ordering.d.ts.map +1 -1
  262. package/dist/Ordering.js +8 -9
  263. package/dist/Ordering.js.map +1 -1
  264. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  265. package/dist/PartitionedSemaphore.js +1 -4
  266. package/dist/PartitionedSemaphore.js.map +1 -1
  267. package/dist/Path.d.ts +38 -41
  268. package/dist/Path.d.ts.map +1 -1
  269. package/dist/Path.js +3 -4
  270. package/dist/Path.js.map +1 -1
  271. package/dist/Pipeable.d.ts +6 -5
  272. package/dist/Pipeable.d.ts.map +1 -1
  273. package/dist/Pipeable.js +2 -2
  274. package/dist/Pipeable.js.map +1 -1
  275. package/dist/PlatformError.d.ts +4 -4
  276. package/dist/PlatformError.js +3 -3
  277. package/dist/PlatformError.js.map +1 -1
  278. package/dist/Pool.d.ts +4 -2
  279. package/dist/Pool.d.ts.map +1 -1
  280. package/dist/Pool.js +4 -2
  281. package/dist/Pool.js.map +1 -1
  282. package/dist/Predicate.d.ts +200 -181
  283. package/dist/Predicate.d.ts.map +1 -1
  284. package/dist/Predicate.js +100 -108
  285. package/dist/Predicate.js.map +1 -1
  286. package/dist/PrimaryKey.d.ts +7 -7
  287. package/dist/PrimaryKey.js +5 -5
  288. package/dist/PrimaryKey.js.map +1 -1
  289. package/dist/PubSub.d.ts +425 -494
  290. package/dist/PubSub.d.ts.map +1 -1
  291. package/dist/PubSub.js +373 -362
  292. package/dist/PubSub.js.map +1 -1
  293. package/dist/Pull.d.ts +24 -18
  294. package/dist/Pull.d.ts.map +1 -1
  295. package/dist/Pull.js +11 -9
  296. package/dist/Pull.js.map +1 -1
  297. package/dist/Queue.d.ts +200 -159
  298. package/dist/Queue.d.ts.map +1 -1
  299. package/dist/Queue.js +162 -132
  300. package/dist/Queue.js.map +1 -1
  301. package/dist/Random.d.ts +49 -74
  302. package/dist/Random.d.ts.map +1 -1
  303. package/dist/Random.js +35 -54
  304. package/dist/Random.js.map +1 -1
  305. package/dist/RcMap.d.ts +121 -63
  306. package/dist/RcMap.d.ts.map +1 -1
  307. package/dist/RcMap.js +42 -21
  308. package/dist/RcMap.js.map +1 -1
  309. package/dist/RcRef.d.ts +24 -13
  310. package/dist/RcRef.d.ts.map +1 -1
  311. package/dist/RcRef.js +15 -9
  312. package/dist/RcRef.js.map +1 -1
  313. package/dist/Record.d.ts +361 -466
  314. package/dist/Record.d.ts.map +1 -1
  315. package/dist/Record.js +163 -216
  316. package/dist/Record.js.map +1 -1
  317. package/dist/Redactable.d.ts +6 -2
  318. package/dist/Redactable.d.ts.map +1 -1
  319. package/dist/Redactable.js +7 -2
  320. package/dist/Redactable.js.map +1 -1
  321. package/dist/Redacted.d.ts +25 -25
  322. package/dist/Redacted.d.ts.map +1 -1
  323. package/dist/Redacted.js +19 -20
  324. package/dist/Redacted.js.map +1 -1
  325. package/dist/Reducer.d.ts +8 -15
  326. package/dist/Reducer.d.ts.map +1 -1
  327. package/dist/Reducer.js +6 -12
  328. package/dist/Reducer.js.map +1 -1
  329. package/dist/Ref.d.ts +95 -165
  330. package/dist/Ref.d.ts.map +1 -1
  331. package/dist/Ref.js +75 -122
  332. package/dist/Ref.js.map +1 -1
  333. package/dist/References.d.ts +102 -213
  334. package/dist/References.d.ts.map +1 -1
  335. package/dist/References.js +102 -213
  336. package/dist/References.js.map +1 -1
  337. package/dist/RegExp.d.ts +10 -14
  338. package/dist/RegExp.d.ts.map +1 -1
  339. package/dist/RegExp.js +10 -14
  340. package/dist/RegExp.js.map +1 -1
  341. package/dist/Request.d.ts +31 -21
  342. package/dist/Request.d.ts.map +1 -1
  343. package/dist/Request.js +25 -19
  344. package/dist/Request.js.map +1 -1
  345. package/dist/RequestResolver.d.ts +201 -90
  346. package/dist/RequestResolver.d.ts.map +1 -1
  347. package/dist/RequestResolver.js +87 -41
  348. package/dist/RequestResolver.js.map +1 -1
  349. package/dist/Resource.js.map +1 -1
  350. package/dist/Result.d.ts +302 -470
  351. package/dist/Result.d.ts.map +1 -1
  352. package/dist/Result.js +135 -218
  353. package/dist/Result.js.map +1 -1
  354. package/dist/Runtime.d.ts +50 -75
  355. package/dist/Runtime.d.ts.map +1 -1
  356. package/dist/Runtime.js +39 -60
  357. package/dist/Runtime.js.map +1 -1
  358. package/dist/Schedule.d.ts +290 -1636
  359. package/dist/Schedule.d.ts.map +1 -1
  360. package/dist/Schedule.js +162 -803
  361. package/dist/Schedule.js.map +1 -1
  362. package/dist/Scheduler.d.ts +5 -5
  363. package/dist/Scheduler.d.ts.map +1 -1
  364. package/dist/Scheduler.js +18 -6
  365. package/dist/Scheduler.js.map +1 -1
  366. package/dist/Schema.d.ts +1835 -1060
  367. package/dist/Schema.d.ts.map +1 -1
  368. package/dist/Schema.js +2708 -1050
  369. package/dist/Schema.js.map +1 -1
  370. package/dist/SchemaAST.d.ts +29 -52
  371. package/dist/SchemaAST.d.ts.map +1 -1
  372. package/dist/SchemaAST.js +537 -391
  373. package/dist/SchemaAST.js.map +1 -1
  374. package/dist/SchemaError.d.ts +7 -6
  375. package/dist/SchemaError.d.ts.map +1 -1
  376. package/dist/SchemaError.js +8 -7
  377. package/dist/SchemaError.js.map +1 -1
  378. package/dist/SchemaGetter.d.ts +230 -185
  379. package/dist/SchemaGetter.d.ts.map +1 -1
  380. package/dist/SchemaGetter.js +252 -209
  381. package/dist/SchemaGetter.js.map +1 -1
  382. package/dist/SchemaIssue.d.ts +62 -190
  383. package/dist/SchemaIssue.d.ts.map +1 -1
  384. package/dist/SchemaIssue.js +74 -266
  385. package/dist/SchemaIssue.js.map +1 -1
  386. package/dist/SchemaParser.d.ts +2 -2
  387. package/dist/SchemaParser.d.ts.map +1 -1
  388. package/dist/SchemaParser.js +123 -86
  389. package/dist/SchemaParser.js.map +1 -1
  390. package/dist/SchemaRepresentation.d.ts +398 -1513
  391. package/dist/SchemaRepresentation.d.ts.map +1 -1
  392. package/dist/SchemaRepresentation.js +290 -2854
  393. package/dist/SchemaRepresentation.js.map +1 -1
  394. package/dist/SchemaTransformation.d.ts +116 -76
  395. package/dist/SchemaTransformation.d.ts.map +1 -1
  396. package/dist/SchemaTransformation.js +123 -88
  397. package/dist/SchemaTransformation.js.map +1 -1
  398. package/dist/Scope.d.ts +123 -151
  399. package/dist/Scope.d.ts.map +1 -1
  400. package/dist/Scope.js +72 -92
  401. package/dist/Scope.js.map +1 -1
  402. package/dist/ScopedCache.js.map +1 -1
  403. package/dist/ScopedRef.d.ts +3 -3
  404. package/dist/ScopedRef.js +2 -2
  405. package/dist/ScopedRef.js.map +1 -1
  406. package/dist/Semaphore.d.ts +101 -13
  407. package/dist/Semaphore.d.ts.map +1 -1
  408. package/dist/Semaphore.js +78 -39
  409. package/dist/Semaphore.js.map +1 -1
  410. package/dist/Sink.d.ts +117 -107
  411. package/dist/Sink.d.ts.map +1 -1
  412. package/dist/Sink.js +107 -100
  413. package/dist/Sink.js.map +1 -1
  414. package/dist/Stdio.d.ts +1 -1
  415. package/dist/Stdio.js.map +1 -1
  416. package/dist/Stream.d.ts +2430 -2958
  417. package/dist/Stream.d.ts.map +1 -1
  418. package/dist/Stream.js +1124 -1397
  419. package/dist/Stream.js.map +1 -1
  420. package/dist/String.d.ts +262 -308
  421. package/dist/String.d.ts.map +1 -1
  422. package/dist/String.js +184 -215
  423. package/dist/String.js.map +1 -1
  424. package/dist/Struct.d.ts +109 -114
  425. package/dist/Struct.d.ts.map +1 -1
  426. package/dist/Struct.js +46 -54
  427. package/dist/Struct.js.map +1 -1
  428. package/dist/SubscriptionRef.d.ts +282 -250
  429. package/dist/SubscriptionRef.d.ts.map +1 -1
  430. package/dist/SubscriptionRef.js +104 -92
  431. package/dist/SubscriptionRef.js.map +1 -1
  432. package/dist/Symbol.d.ts +3 -3
  433. package/dist/Symbol.js +3 -3
  434. package/dist/Symbol.js.map +1 -1
  435. package/dist/SynchronizedRef.js.map +1 -1
  436. package/dist/Take.js.map +1 -1
  437. package/dist/Terminal.d.ts +2 -2
  438. package/dist/Terminal.js +1 -1
  439. package/dist/Terminal.js.map +1 -1
  440. package/dist/Tracer.d.ts +100 -54
  441. package/dist/Tracer.d.ts.map +1 -1
  442. package/dist/Tracer.js +41 -24
  443. package/dist/Tracer.js.map +1 -1
  444. package/dist/Trie.d.ts +287 -679
  445. package/dist/Trie.d.ts.map +1 -1
  446. package/dist/Trie.js +109 -251
  447. package/dist/Trie.js.map +1 -1
  448. package/dist/Tuple.d.ts +92 -127
  449. package/dist/Tuple.d.ts.map +1 -1
  450. package/dist/Tuple.js +42 -57
  451. package/dist/Tuple.js.map +1 -1
  452. package/dist/TxChunk.d.ts +201 -121
  453. package/dist/TxChunk.d.ts.map +1 -1
  454. package/dist/TxChunk.js +85 -56
  455. package/dist/TxChunk.js.map +1 -1
  456. package/dist/TxDeferred.d.ts +62 -46
  457. package/dist/TxDeferred.d.ts.map +1 -1
  458. package/dist/TxDeferred.js +30 -22
  459. package/dist/TxDeferred.js.map +1 -1
  460. package/dist/TxHashMap.d.ts +631 -779
  461. package/dist/TxHashMap.d.ts.map +1 -1
  462. package/dist/TxHashMap.js +268 -330
  463. package/dist/TxHashMap.js.map +1 -1
  464. package/dist/TxHashSet.d.ts +297 -236
  465. package/dist/TxHashSet.d.ts.map +1 -1
  466. package/dist/TxHashSet.js +130 -100
  467. package/dist/TxHashSet.js.map +1 -1
  468. package/dist/TxPriorityQueue.d.ts +126 -95
  469. package/dist/TxPriorityQueue.d.ts.map +1 -1
  470. package/dist/TxPriorityQueue.js +74 -56
  471. package/dist/TxPriorityQueue.js.map +1 -1
  472. package/dist/TxPubSub.d.ts +101 -88
  473. package/dist/TxPubSub.d.ts.map +1 -1
  474. package/dist/TxPubSub.js +87 -66
  475. package/dist/TxPubSub.js.map +1 -1
  476. package/dist/TxQueue.d.ts +200 -180
  477. package/dist/TxQueue.d.ts.map +1 -1
  478. package/dist/TxQueue.js +160 -136
  479. package/dist/TxQueue.js.map +1 -1
  480. package/dist/TxReentrantLock.d.ts +97 -66
  481. package/dist/TxReentrantLock.d.ts.map +1 -1
  482. package/dist/TxReentrantLock.js +67 -45
  483. package/dist/TxReentrantLock.js.map +1 -1
  484. package/dist/TxRef.d.ts +51 -32
  485. package/dist/TxRef.d.ts.map +1 -1
  486. package/dist/TxRef.js +23 -15
  487. package/dist/TxRef.js.map +1 -1
  488. package/dist/TxSemaphore.d.ts +129 -95
  489. package/dist/TxSemaphore.d.ts.map +1 -1
  490. package/dist/TxSemaphore.js +85 -70
  491. package/dist/TxSemaphore.js.map +1 -1
  492. package/dist/TxSubscriptionRef.d.ts +97 -70
  493. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  494. package/dist/TxSubscriptionRef.js +44 -34
  495. package/dist/TxSubscriptionRef.js.map +1 -1
  496. package/dist/Types.d.ts +127 -70
  497. package/dist/Types.d.ts.map +1 -1
  498. package/dist/UndefinedOr.js.map +1 -1
  499. package/dist/Unify.d.ts +45 -65
  500. package/dist/Unify.d.ts.map +1 -1
  501. package/dist/Unify.js +6 -9
  502. package/dist/Unify.js.map +1 -1
  503. package/dist/Utils.d.ts +23 -16
  504. package/dist/Utils.d.ts.map +1 -1
  505. package/dist/Utils.js +3 -7
  506. package/dist/Utils.js.map +1 -1
  507. package/dist/index.d.ts +0 -4
  508. package/dist/index.d.ts.map +1 -1
  509. package/dist/index.js +0 -4
  510. package/dist/index.js.map +1 -1
  511. package/dist/internal/array.js.map +1 -1
  512. package/dist/internal/core.js +3 -2
  513. package/dist/internal/core.js.map +1 -1
  514. package/dist/internal/dateTime.js +4 -0
  515. package/dist/internal/dateTime.js.map +1 -1
  516. package/dist/internal/doNotation.js.map +1 -1
  517. package/dist/internal/effect.js +141 -61
  518. package/dist/internal/effect.js.map +1 -1
  519. package/dist/internal/equal.js.map +1 -1
  520. package/dist/internal/errors.js.map +1 -1
  521. package/dist/internal/executionPlan.js.map +1 -1
  522. package/dist/internal/hashMap.js.map +1 -1
  523. package/dist/internal/hashSet.js.map +1 -1
  524. package/dist/internal/layer.js.map +1 -1
  525. package/dist/internal/matcher.js +1 -1
  526. package/dist/internal/matcher.js.map +1 -1
  527. package/dist/internal/metric.js.map +1 -1
  528. package/dist/internal/option.js.map +1 -1
  529. package/dist/internal/persistence.d.ts +2 -0
  530. package/dist/internal/persistence.d.ts.map +1 -0
  531. package/dist/internal/persistence.js +3 -0
  532. package/dist/internal/persistence.js.map +1 -0
  533. package/dist/internal/random.js.map +1 -1
  534. package/dist/internal/rcRef.js.map +1 -1
  535. package/dist/internal/record.d.ts +0 -3
  536. package/dist/internal/record.d.ts.map +1 -1
  537. package/dist/internal/record.js +10 -5
  538. package/dist/internal/record.js.map +1 -1
  539. package/dist/internal/redacted.js.map +1 -1
  540. package/dist/internal/references.js +3 -4
  541. package/dist/internal/references.js.map +1 -1
  542. package/dist/internal/request.js.map +1 -1
  543. package/dist/internal/result.js.map +1 -1
  544. package/dist/internal/schedule.js.map +1 -1
  545. package/dist/internal/schema/annotations.js +12 -0
  546. package/dist/internal/schema/annotations.js.map +1 -1
  547. package/dist/internal/schema/cause.js.map +1 -1
  548. package/dist/internal/schema/fromJsonSchemaDocument.d.ts +2 -0
  549. package/dist/internal/schema/fromJsonSchemaDocument.d.ts.map +1 -0
  550. package/dist/internal/schema/fromJsonSchemaDocument.js +745 -0
  551. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -0
  552. package/dist/internal/schema/fromRepresentation.d.ts +2 -0
  553. package/dist/internal/schema/fromRepresentation.d.ts.map +1 -0
  554. package/dist/internal/schema/fromRepresentation.js +245 -0
  555. package/dist/internal/schema/fromRepresentation.js.map +1 -0
  556. package/dist/internal/schema/parser.d.ts +14 -0
  557. package/dist/internal/schema/parser.d.ts.map +1 -0
  558. package/dist/internal/schema/parser.js +13 -0
  559. package/dist/internal/schema/parser.js.map +1 -0
  560. package/dist/internal/schema/schema.js +28 -40
  561. package/dist/internal/schema/schema.js.map +1 -1
  562. package/dist/internal/schema/{arbitrary.d.ts → toArbitrary.d.ts} +1 -1
  563. package/dist/internal/schema/toArbitrary.d.ts.map +1 -0
  564. package/dist/internal/schema/{arbitrary.js → toArbitrary.js} +8 -9
  565. package/dist/internal/schema/toArbitrary.js.map +1 -0
  566. package/dist/internal/schema/toCodeDocument.d.ts +2 -0
  567. package/dist/internal/schema/toCodeDocument.d.ts.map +1 -0
  568. package/dist/internal/schema/toCodeDocument.js +438 -0
  569. package/dist/internal/schema/toCodeDocument.js.map +1 -0
  570. package/dist/internal/schema/toEquivalence.d.ts +2 -0
  571. package/dist/internal/schema/toEquivalence.d.ts.map +1 -0
  572. package/dist/internal/schema/{equivalence.js → toEquivalence.js} +15 -13
  573. package/dist/internal/schema/toEquivalence.js.map +1 -0
  574. package/dist/internal/schema/toJsonSchemaDocument.d.ts +2 -0
  575. package/dist/internal/schema/toJsonSchemaDocument.d.ts.map +1 -0
  576. package/dist/internal/schema/toJsonSchemaDocument.js +508 -0
  577. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -0
  578. package/dist/internal/schema/toRepresentation.d.ts +2 -0
  579. package/dist/internal/schema/toRepresentation.d.ts.map +1 -0
  580. package/dist/internal/schema/toRepresentation.js +349 -0
  581. package/dist/internal/schema/toRepresentation.js.map +1 -0
  582. package/dist/internal/stackTraceLimit.js +3 -6
  583. package/dist/internal/stackTraceLimit.js.map +1 -1
  584. package/dist/internal/stream.js.map +1 -1
  585. package/dist/internal/tracer.js.map +1 -1
  586. package/dist/internal/trie.js +13 -9
  587. package/dist/internal/trie.js.map +1 -1
  588. package/dist/testing/FastCheck.d.ts +8 -7
  589. package/dist/testing/FastCheck.d.ts.map +1 -1
  590. package/dist/testing/FastCheck.js +8 -7
  591. package/dist/testing/FastCheck.js.map +1 -1
  592. package/dist/testing/TestClock.d.ts +57 -28
  593. package/dist/testing/TestClock.d.ts.map +1 -1
  594. package/dist/testing/TestClock.js +54 -19
  595. package/dist/testing/TestClock.js.map +1 -1
  596. package/dist/testing/TestConsole.d.ts +32 -31
  597. package/dist/testing/TestConsole.d.ts.map +1 -1
  598. package/dist/testing/TestConsole.js +24 -22
  599. package/dist/testing/TestConsole.js.map +1 -1
  600. package/dist/testing/TestSchema.d.ts +29 -29
  601. package/dist/testing/TestSchema.js +25 -25
  602. package/dist/testing/TestSchema.js.map +1 -1
  603. package/dist/testing/index.js.map +1 -1
  604. package/dist/unstable/ai/AiError.d.ts +121 -144
  605. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  606. package/dist/unstable/ai/AiError.js +99 -121
  607. package/dist/unstable/ai/AiError.js.map +1 -1
  608. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +22 -7
  609. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  610. package/dist/unstable/ai/AnthropicStructuredOutput.js +87 -317
  611. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  612. package/dist/unstable/ai/Chat.d.ts +132 -97
  613. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  614. package/dist/unstable/ai/Chat.js +55 -51
  615. package/dist/unstable/ai/Chat.js.map +1 -1
  616. package/dist/unstable/ai/EmbeddingModel.d.ts +1 -1
  617. package/dist/unstable/ai/EmbeddingModel.js +1 -1
  618. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  619. package/dist/unstable/ai/IdGenerator.d.ts +32 -28
  620. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  621. package/dist/unstable/ai/IdGenerator.js +26 -21
  622. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  623. package/dist/unstable/ai/LanguageModel.d.ts +111 -68
  624. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  625. package/dist/unstable/ai/LanguageModel.js +123 -81
  626. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  627. package/dist/unstable/ai/McpProtocol.d.ts +30 -0
  628. package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
  629. package/dist/unstable/ai/McpProtocol.js +20 -0
  630. package/dist/unstable/ai/McpProtocol.js.map +1 -0
  631. package/dist/unstable/ai/McpSchema.d.ts +316 -250
  632. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  633. package/dist/unstable/ai/McpSchema.js +71 -63
  634. package/dist/unstable/ai/McpSchema.js.map +1 -1
  635. package/dist/unstable/ai/McpServer.d.ts +71 -62
  636. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  637. package/dist/unstable/ai/McpServer.js +765 -245
  638. package/dist/unstable/ai/McpServer.js.map +1 -1
  639. package/dist/unstable/ai/Model.d.ts +8 -19
  640. package/dist/unstable/ai/Model.d.ts.map +1 -1
  641. package/dist/unstable/ai/Model.js +9 -20
  642. package/dist/unstable/ai/Model.js.map +1 -1
  643. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +33 -11
  644. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  645. package/dist/unstable/ai/OpenAiStructuredOutput.js +194 -378
  646. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  647. package/dist/unstable/ai/Prompt.d.ts +112 -38
  648. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  649. package/dist/unstable/ai/Prompt.js +53 -17
  650. package/dist/unstable/ai/Prompt.js.map +1 -1
  651. package/dist/unstable/ai/Response.d.ts +47 -33
  652. package/dist/unstable/ai/Response.d.ts.map +1 -1
  653. package/dist/unstable/ai/Response.js +23 -18
  654. package/dist/unstable/ai/Response.js.map +1 -1
  655. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  656. package/dist/unstable/ai/Telemetry.d.ts +46 -13
  657. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  658. package/dist/unstable/ai/Telemetry.js +18 -7
  659. package/dist/unstable/ai/Telemetry.js.map +1 -1
  660. package/dist/unstable/ai/Tokenizer.d.ts +14 -3
  661. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  662. package/dist/unstable/ai/Tokenizer.js +10 -2
  663. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  664. package/dist/unstable/ai/Tool.d.ts +63 -44
  665. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  666. package/dist/unstable/ai/Tool.js +59 -42
  667. package/dist/unstable/ai/Tool.js.map +1 -1
  668. package/dist/unstable/ai/Toolkit.d.ts +35 -9
  669. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  670. package/dist/unstable/ai/Toolkit.js +32 -14
  671. package/dist/unstable/ai/Toolkit.js.map +1 -1
  672. package/dist/unstable/ai/index.d.ts +4 -0
  673. package/dist/unstable/ai/index.d.ts.map +1 -1
  674. package/dist/unstable/ai/index.js +4 -0
  675. package/dist/unstable/ai/index.js.map +1 -1
  676. package/dist/unstable/ai/internal/codec-transformer.js +15 -12
  677. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  678. package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
  679. package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
  680. package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
  681. package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
  682. package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
  683. package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
  684. package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
  685. package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
  686. package/dist/unstable/ai/internal/structured-output.d.ts +2 -0
  687. package/dist/unstable/ai/internal/structured-output.d.ts.map +1 -0
  688. package/dist/unstable/ai/internal/structured-output.js +315 -0
  689. package/dist/unstable/ai/internal/structured-output.js.map +1 -0
  690. package/dist/unstable/cli/Argument.d.ts +273 -69
  691. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  692. package/dist/unstable/cli/Argument.js +111 -33
  693. package/dist/unstable/cli/Argument.js.map +1 -1
  694. package/dist/unstable/cli/CliConfig.js.map +1 -1
  695. package/dist/unstable/cli/CliError.d.ts +105 -74
  696. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  697. package/dist/unstable/cli/CliError.js +98 -63
  698. package/dist/unstable/cli/CliError.js.map +1 -1
  699. package/dist/unstable/cli/CliOutput.d.ts +35 -54
  700. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  701. package/dist/unstable/cli/CliOutput.js +26 -42
  702. package/dist/unstable/cli/CliOutput.js.map +1 -1
  703. package/dist/unstable/cli/Command.d.ts +705 -107
  704. package/dist/unstable/cli/Command.d.ts.map +1 -1
  705. package/dist/unstable/cli/Command.js +252 -47
  706. package/dist/unstable/cli/Command.js.map +1 -1
  707. package/dist/unstable/cli/Completions.js.map +1 -1
  708. package/dist/unstable/cli/Flag.d.ts +418 -138
  709. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  710. package/dist/unstable/cli/Flag.js +197 -71
  711. package/dist/unstable/cli/Flag.js.map +1 -1
  712. package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
  713. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  714. package/dist/unstable/cli/HelpDoc.d.ts +12 -4
  715. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  716. package/dist/unstable/cli/Param.d.ts +292 -78
  717. package/dist/unstable/cli/Param.d.ts.map +1 -1
  718. package/dist/unstable/cli/Param.js +131 -49
  719. package/dist/unstable/cli/Param.js.map +1 -1
  720. package/dist/unstable/cli/Primitive.d.ts +370 -149
  721. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  722. package/dist/unstable/cli/Primitive.js +345 -137
  723. package/dist/unstable/cli/Primitive.js.map +1 -1
  724. package/dist/unstable/cli/Prompt.d.ts +23 -14
  725. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  726. package/dist/unstable/cli/Prompt.js +23 -14
  727. package/dist/unstable/cli/Prompt.js.map +1 -1
  728. package/dist/unstable/cli/index.js.map +1 -1
  729. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  730. package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
  731. package/dist/unstable/cli/internal/command.d.ts +3 -1
  732. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  733. package/dist/unstable/cli/internal/command.js +11 -4
  734. package/dist/unstable/cli/internal/command.js.map +1 -1
  735. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  736. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  737. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  738. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  739. package/dist/unstable/cli/internal/config.d.ts +0 -48
  740. package/dist/unstable/cli/internal/config.d.ts.map +1 -1
  741. package/dist/unstable/cli/internal/config.js +8 -10
  742. package/dist/unstable/cli/internal/config.js.map +1 -1
  743. package/dist/unstable/cli/internal/help.js.map +1 -1
  744. package/dist/unstable/cli/internal/lexer.js +17 -7
  745. package/dist/unstable/cli/internal/lexer.js.map +1 -1
  746. package/dist/unstable/cli/internal/parser.js +2 -2
  747. package/dist/unstable/cli/internal/parser.js.map +1 -1
  748. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  749. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  750. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  751. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  752. package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
  753. package/dist/unstable/cluster/ClusterSchema.js +8 -8
  754. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  755. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  756. package/dist/unstable/cluster/ClusterWorkflowEngine.js +6 -2
  757. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  758. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  759. package/dist/unstable/cluster/Entity.d.ts +10 -10
  760. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  761. package/dist/unstable/cluster/Entity.js +9 -9
  762. package/dist/unstable/cluster/Entity.js.map +1 -1
  763. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  764. package/dist/unstable/cluster/EntityId.js.map +1 -1
  765. package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
  766. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  767. package/dist/unstable/cluster/EntityProxy.js +4 -2
  768. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  769. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  770. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  771. package/dist/unstable/cluster/EntityResource.js +2 -2
  772. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  773. package/dist/unstable/cluster/EntityType.js.map +1 -1
  774. package/dist/unstable/cluster/Envelope.d.ts +3 -3
  775. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  776. package/dist/unstable/cluster/Envelope.js +5 -4
  777. package/dist/unstable/cluster/Envelope.js.map +1 -1
  778. package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
  779. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  780. package/dist/unstable/cluster/HttpRunner.js +6 -4
  781. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  782. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  783. package/dist/unstable/cluster/MachineId.js.map +1 -1
  784. package/dist/unstable/cluster/Message.d.ts +9 -9
  785. package/dist/unstable/cluster/Message.js +6 -6
  786. package/dist/unstable/cluster/Message.js.map +1 -1
  787. package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
  788. package/dist/unstable/cluster/MessageStorage.js +5 -5
  789. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  790. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  791. package/dist/unstable/cluster/Reply.js +5 -5
  792. package/dist/unstable/cluster/Reply.js.map +1 -1
  793. package/dist/unstable/cluster/Runner.d.ts +1 -1
  794. package/dist/unstable/cluster/Runner.js +1 -1
  795. package/dist/unstable/cluster/Runner.js.map +1 -1
  796. package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
  797. package/dist/unstable/cluster/RunnerAddress.js +1 -1
  798. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  799. package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
  800. package/dist/unstable/cluster/RunnerHealth.js +1 -1
  801. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  802. package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
  803. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  804. package/dist/unstable/cluster/RunnerServer.js +16 -16
  805. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  806. package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
  807. package/dist/unstable/cluster/RunnerStorage.js +1 -1
  808. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  809. package/dist/unstable/cluster/Runners.d.ts +6 -6
  810. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  811. package/dist/unstable/cluster/Runners.js +19 -10
  812. package/dist/unstable/cluster/Runners.js.map +1 -1
  813. package/dist/unstable/cluster/ShardId.js +1 -1
  814. package/dist/unstable/cluster/ShardId.js.map +1 -1
  815. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  816. package/dist/unstable/cluster/Sharding.js +128 -26
  817. package/dist/unstable/cluster/Sharding.js.map +1 -1
  818. package/dist/unstable/cluster/ShardingConfig.d.ts +13 -5
  819. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  820. package/dist/unstable/cluster/ShardingConfig.js +3 -3
  821. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  822. package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
  823. package/dist/unstable/cluster/SingleRunner.d.ts +4 -2
  824. package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
  825. package/dist/unstable/cluster/SingleRunner.js +2 -1
  826. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  827. package/dist/unstable/cluster/Singleton.js.map +1 -1
  828. package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
  829. package/dist/unstable/cluster/SingletonAddress.js +1 -1
  830. package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
  831. package/dist/unstable/cluster/Snowflake.d.ts +8 -8
  832. package/dist/unstable/cluster/Snowflake.js +8 -8
  833. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  834. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  835. package/dist/unstable/cluster/SqlMessageStorage.d.ts +7 -4
  836. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  837. package/dist/unstable/cluster/SqlMessageStorage.js +56 -25
  838. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  839. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  840. package/dist/unstable/cluster/SqlRunnerStorage.js +127 -65
  841. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  842. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  843. package/dist/unstable/cluster/index.js.map +1 -1
  844. package/dist/unstable/cluster/internal/entityManager.js +24 -12
  845. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  846. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  847. package/dist/unstable/cluster/internal/hash.js.map +1 -1
  848. package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
  849. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  850. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  851. package/dist/unstable/cluster/internal/shardLock.d.ts +2 -0
  852. package/dist/unstable/cluster/internal/shardLock.d.ts.map +1 -0
  853. package/dist/unstable/cluster/internal/shardLock.js +4 -0
  854. package/dist/unstable/cluster/internal/shardLock.js.map +1 -0
  855. package/dist/unstable/devtools/DevTools.js.map +1 -1
  856. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  857. package/dist/unstable/devtools/DevToolsSchema.d.ts +20 -20
  858. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  859. package/dist/unstable/devtools/DevToolsSchema.js +8 -5
  860. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  861. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  862. package/dist/unstable/devtools/index.js.map +1 -1
  863. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  864. package/dist/unstable/encoding/Msgpack.js +6 -8
  865. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  866. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  867. package/dist/unstable/encoding/Sse.d.ts +72 -8
  868. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  869. package/dist/unstable/encoding/Sse.js +58 -8
  870. package/dist/unstable/encoding/Sse.js.map +1 -1
  871. package/dist/unstable/encoding/index.js.map +1 -1
  872. package/dist/unstable/eventlog/Event.d.ts +20 -20
  873. package/dist/unstable/eventlog/Event.js.map +1 -1
  874. package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
  875. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  876. package/dist/unstable/eventlog/EventJournal.d.ts +16 -16
  877. package/dist/unstable/eventlog/EventJournal.js +14 -14
  878. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  879. package/dist/unstable/eventlog/EventLog.d.ts +3 -3
  880. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  881. package/dist/unstable/eventlog/EventLog.js +18 -14
  882. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  883. package/dist/unstable/eventlog/EventLogEncryption.d.ts +2 -2
  884. package/dist/unstable/eventlog/EventLogEncryption.js +2 -2
  885. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  886. package/dist/unstable/eventlog/EventLogMessage.d.ts +6 -6
  887. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  888. package/dist/unstable/eventlog/EventLogMessage.js +9 -4
  889. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  890. package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
  891. package/dist/unstable/eventlog/EventLogRemote.js +1 -1
  892. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  893. package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
  894. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  895. package/dist/unstable/eventlog/EventLogServer.js +45 -21
  896. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  897. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
  898. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  899. package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
  900. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  901. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
  902. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  903. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
  904. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  905. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
  906. package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
  907. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  908. package/dist/unstable/eventlog/SqlEventJournal.js +2 -2
  909. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  910. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +1 -1
  911. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  912. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +3 -3
  913. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  914. package/dist/unstable/eventlog/index.js.map +1 -1
  915. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
  916. package/dist/unstable/http/Cookies.d.ts +2 -2
  917. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  918. package/dist/unstable/http/Cookies.js +54 -40
  919. package/dist/unstable/http/Cookies.js.map +1 -1
  920. package/dist/unstable/http/Etag.d.ts +1 -1
  921. package/dist/unstable/http/Etag.js +1 -1
  922. package/dist/unstable/http/Etag.js.map +1 -1
  923. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  924. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  925. package/dist/unstable/http/Headers.d.ts +2 -2
  926. package/dist/unstable/http/Headers.js +10 -10
  927. package/dist/unstable/http/Headers.js.map +1 -1
  928. package/dist/unstable/http/HttpBody.d.ts +5 -3
  929. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  930. package/dist/unstable/http/HttpBody.js +11 -5
  931. package/dist/unstable/http/HttpBody.js.map +1 -1
  932. package/dist/unstable/http/HttpClient.d.ts +51 -44
  933. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  934. package/dist/unstable/http/HttpClient.js +46 -17
  935. package/dist/unstable/http/HttpClient.js.map +1 -1
  936. package/dist/unstable/http/HttpClientError.js.map +1 -1
  937. package/dist/unstable/http/HttpClientRequest.d.ts +44 -0
  938. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  939. package/dist/unstable/http/HttpClientRequest.js +16 -0
  940. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  941. package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
  942. package/dist/unstable/http/HttpClientResponse.js +2 -2
  943. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  944. package/dist/unstable/http/HttpEffect.d.ts +6 -6
  945. package/dist/unstable/http/HttpEffect.js +3 -3
  946. package/dist/unstable/http/HttpEffect.js.map +1 -1
  947. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  948. package/dist/unstable/http/HttpMethod.d.ts +6 -9
  949. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  950. package/dist/unstable/http/HttpMethod.js +6 -9
  951. package/dist/unstable/http/HttpMethod.js.map +1 -1
  952. package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
  953. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  954. package/dist/unstable/http/HttpMiddleware.js +164 -39
  955. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  956. package/dist/unstable/http/HttpPlatform.d.ts +76 -0
  957. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  958. package/dist/unstable/http/HttpPlatform.js +32 -0
  959. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  960. package/dist/unstable/http/HttpRouter.d.ts +88 -89
  961. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  962. package/dist/unstable/http/HttpRouter.js +78 -79
  963. package/dist/unstable/http/HttpRouter.js.map +1 -1
  964. package/dist/unstable/http/HttpServer.d.ts +13 -13
  965. package/dist/unstable/http/HttpServer.js +6 -6
  966. package/dist/unstable/http/HttpServer.js.map +1 -1
  967. package/dist/unstable/http/HttpServerError.d.ts +2 -2
  968. package/dist/unstable/http/HttpServerError.js +2 -2
  969. package/dist/unstable/http/HttpServerError.js.map +1 -1
  970. package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
  971. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  972. package/dist/unstable/http/HttpServerRequest.js +9 -8
  973. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  974. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  975. package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
  976. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  977. package/dist/unstable/http/HttpServerResponse.js +10 -0
  978. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  979. package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
  980. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  981. package/dist/unstable/http/HttpStaticServer.js +35 -7
  982. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  983. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  984. package/dist/unstable/http/Multipart.d.ts +6 -6
  985. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  986. package/dist/unstable/http/Multipart.js +22 -20
  987. package/dist/unstable/http/Multipart.js.map +1 -1
  988. package/dist/unstable/http/Template.js +1 -1
  989. package/dist/unstable/http/Template.js.map +1 -1
  990. package/dist/unstable/http/Url.d.ts +33 -63
  991. package/dist/unstable/http/Url.d.ts.map +1 -1
  992. package/dist/unstable/http/Url.js +14 -28
  993. package/dist/unstable/http/Url.js.map +1 -1
  994. package/dist/unstable/http/UrlParams.d.ts +10 -18
  995. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  996. package/dist/unstable/http/UrlParams.js +26 -31
  997. package/dist/unstable/http/UrlParams.js.map +1 -1
  998. package/dist/unstable/http/index.js.map +1 -1
  999. package/dist/unstable/http/internal/compression.d.ts +2 -0
  1000. package/dist/unstable/http/internal/compression.d.ts.map +1 -0
  1001. package/dist/unstable/http/internal/compression.js +155 -0
  1002. package/dist/unstable/http/internal/compression.js.map +1 -0
  1003. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
  1004. package/dist/unstable/httpapi/HttpApi.js +3 -3
  1005. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  1006. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
  1007. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  1008. package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
  1009. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  1010. package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
  1011. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  1012. package/dist/unstable/httpapi/HttpApiClient.js +16 -18
  1013. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  1014. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
  1015. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  1016. package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
  1017. package/dist/unstable/httpapi/HttpApiError.js +13 -13
  1018. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  1019. package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
  1020. package/dist/unstable/httpapi/HttpApiGroup.js +1 -1
  1021. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  1022. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
  1023. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  1024. package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
  1025. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  1026. package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
  1027. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  1028. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  1029. package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
  1030. package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
  1031. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  1032. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  1033. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  1034. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  1035. package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
  1036. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  1037. package/dist/unstable/httpapi/OpenApi.js +50 -37
  1038. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  1039. package/dist/unstable/httpapi/index.js.map +1 -1
  1040. package/dist/unstable/httpapi/internal/html.js.map +1 -1
  1041. package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
  1042. package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
  1043. package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
  1044. package/dist/unstable/observability/Otlp.js.map +1 -1
  1045. package/dist/unstable/observability/OtlpExporter.d.ts +70 -1
  1046. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  1047. package/dist/unstable/observability/OtlpExporter.js +84 -6
  1048. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  1049. package/dist/unstable/observability/OtlpLogger.d.ts +4 -3
  1050. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  1051. package/dist/unstable/observability/OtlpLogger.js +2 -2
  1052. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  1053. package/dist/unstable/observability/OtlpMetrics.d.ts +11 -4
  1054. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  1055. package/dist/unstable/observability/OtlpMetrics.js +5 -2
  1056. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  1057. package/dist/unstable/observability/OtlpResource.d.ts +16 -7
  1058. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  1059. package/dist/unstable/observability/OtlpResource.js +21 -12
  1060. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  1061. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  1062. package/dist/unstable/observability/OtlpTracer.d.ts +4 -3
  1063. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  1064. package/dist/unstable/observability/OtlpTracer.js +2 -2
  1065. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  1066. package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
  1067. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  1068. package/dist/unstable/observability/PrometheusMetrics.js +10 -3
  1069. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  1070. package/dist/unstable/observability/index.js.map +1 -1
  1071. package/dist/unstable/observability/internal/otlpEnv.js +1 -1
  1072. package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
  1073. package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
  1074. package/dist/unstable/observability/internal/protobuf.js +3 -0
  1075. package/dist/unstable/observability/internal/protobuf.js.map +1 -1
  1076. package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
  1077. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  1078. package/dist/unstable/persistence/KeyValueStore.js +22 -13
  1079. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  1080. package/dist/unstable/persistence/Persistable.d.ts +8 -8
  1081. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  1082. package/dist/unstable/persistence/Persistable.js +2 -1
  1083. package/dist/unstable/persistence/Persistable.js.map +1 -1
  1084. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  1085. package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
  1086. package/dist/unstable/persistence/PersistedQueue.js +6 -6
  1087. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  1088. package/dist/unstable/persistence/Persistence.d.ts +3 -3
  1089. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  1090. package/dist/unstable/persistence/Persistence.js +91 -15
  1091. package/dist/unstable/persistence/Persistence.js.map +1 -1
  1092. package/dist/unstable/persistence/RateLimiter.d.ts +28 -17
  1093. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  1094. package/dist/unstable/persistence/RateLimiter.js +26 -15
  1095. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  1096. package/dist/unstable/persistence/Redis.d.ts +2 -2
  1097. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  1098. package/dist/unstable/persistence/Redis.js +3 -3
  1099. package/dist/unstable/persistence/Redis.js.map +1 -1
  1100. package/dist/unstable/persistence/index.js.map +1 -1
  1101. package/dist/unstable/process/ChildProcess.d.ts +64 -21
  1102. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1103. package/dist/unstable/process/ChildProcess.js +14 -5
  1104. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1105. package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
  1106. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1107. package/dist/unstable/process/ChildProcessSpawner.js +4 -2
  1108. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1109. package/dist/unstable/process/index.js.map +1 -1
  1110. package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
  1111. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  1112. package/dist/unstable/reactivity/AsyncResult.js +14 -13
  1113. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1114. package/dist/unstable/reactivity/Atom.d.ts +105 -19
  1115. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1116. package/dist/unstable/reactivity/Atom.js +44 -12
  1117. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1118. package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
  1119. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1120. package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
  1121. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1122. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  1123. package/dist/unstable/reactivity/AtomRegistry.js +25 -4
  1124. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1125. package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
  1126. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1127. package/dist/unstable/reactivity/AtomRpc.js +4 -1
  1128. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1129. package/dist/unstable/reactivity/Hydration.d.ts +1 -1
  1130. package/dist/unstable/reactivity/Hydration.js +1 -1
  1131. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  1132. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1133. package/dist/unstable/reactivity/index.js.map +1 -1
  1134. package/dist/unstable/rpc/Rpc.d.ts +35 -33
  1135. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1136. package/dist/unstable/rpc/Rpc.js +4 -2
  1137. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1138. package/dist/unstable/rpc/RpcClient.d.ts +12 -12
  1139. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1140. package/dist/unstable/rpc/RpcClient.js +14 -12
  1141. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1142. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  1143. package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
  1144. package/dist/unstable/rpc/RpcGroup.js +1 -1
  1145. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1146. package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
  1147. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  1148. package/dist/unstable/rpc/RpcMessage.js +6 -6
  1149. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  1150. package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
  1151. package/dist/unstable/rpc/RpcMiddleware.js +1 -1
  1152. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1153. package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
  1154. package/dist/unstable/rpc/RpcSchema.js +3 -3
  1155. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1156. package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
  1157. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1158. package/dist/unstable/rpc/RpcSerialization.js +175 -96
  1159. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1160. package/dist/unstable/rpc/RpcServer.d.ts +13 -13
  1161. package/dist/unstable/rpc/RpcServer.js +17 -13
  1162. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1163. package/dist/unstable/rpc/RpcTest.js.map +1 -1
  1164. package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
  1165. package/dist/unstable/rpc/RpcWorker.js +4 -4
  1166. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1167. package/dist/unstable/rpc/Utils.js.map +1 -1
  1168. package/dist/unstable/rpc/index.js.map +1 -1
  1169. package/dist/unstable/schema/Model.d.ts +52 -50
  1170. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1171. package/dist/unstable/schema/Model.js +35 -33
  1172. package/dist/unstable/schema/Model.js.map +1 -1
  1173. package/dist/unstable/schema/VariantSchema.d.ts +6 -7
  1174. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  1175. package/dist/unstable/schema/VariantSchema.js +15 -12
  1176. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1177. package/dist/unstable/schema/index.js.map +1 -1
  1178. package/dist/unstable/socket/Socket.d.ts +12 -4
  1179. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1180. package/dist/unstable/socket/Socket.js +10 -5
  1181. package/dist/unstable/socket/Socket.js.map +1 -1
  1182. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1183. package/dist/unstable/socket/index.js.map +1 -1
  1184. package/dist/unstable/sql/Migrator.js.map +1 -1
  1185. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  1186. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1187. package/dist/unstable/sql/SqlClient.js +2 -2
  1188. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1189. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1190. package/dist/unstable/sql/SqlError.d.ts +2 -2
  1191. package/dist/unstable/sql/SqlError.js +2 -2
  1192. package/dist/unstable/sql/SqlError.js.map +1 -1
  1193. package/dist/unstable/sql/SqlModel.d.ts +2 -2
  1194. package/dist/unstable/sql/SqlModel.js +2 -2
  1195. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1196. package/dist/unstable/sql/SqlResolver.d.ts +5 -5
  1197. package/dist/unstable/sql/SqlResolver.js +2 -2
  1198. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1199. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1200. package/dist/unstable/sql/SqlStream.js.map +1 -1
  1201. package/dist/unstable/sql/Statement.d.ts +6 -6
  1202. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  1203. package/dist/unstable/sql/Statement.js +22 -21
  1204. package/dist/unstable/sql/Statement.js.map +1 -1
  1205. package/dist/unstable/sql/index.js.map +1 -1
  1206. package/dist/unstable/workers/Transferable.d.ts +1 -1
  1207. package/dist/unstable/workers/Transferable.js +1 -1
  1208. package/dist/unstable/workers/Transferable.js.map +1 -1
  1209. package/dist/unstable/workers/Worker.d.ts +2 -2
  1210. package/dist/unstable/workers/Worker.js +2 -2
  1211. package/dist/unstable/workers/Worker.js.map +1 -1
  1212. package/dist/unstable/workers/WorkerError.d.ts +7 -7
  1213. package/dist/unstable/workers/WorkerError.js +6 -6
  1214. package/dist/unstable/workers/WorkerError.js.map +1 -1
  1215. package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
  1216. package/dist/unstable/workers/WorkerRunner.js +1 -1
  1217. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1218. package/dist/unstable/workers/index.js.map +1 -1
  1219. package/dist/unstable/workflow/Activity.d.ts +2 -2
  1220. package/dist/unstable/workflow/Activity.js +2 -2
  1221. package/dist/unstable/workflow/Activity.js.map +1 -1
  1222. package/dist/unstable/workflow/DurableClock.d.ts +1 -1
  1223. package/dist/unstable/workflow/DurableClock.js +1 -1
  1224. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1225. package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
  1226. package/dist/unstable/workflow/DurableDeferred.js +5 -5
  1227. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1228. package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
  1229. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  1230. package/dist/unstable/workflow/DurableQueue.js +22 -20
  1231. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  1232. package/dist/unstable/workflow/Workflow.d.ts +21 -21
  1233. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1234. package/dist/unstable/workflow/Workflow.js +13 -14
  1235. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1236. package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
  1237. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1238. package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
  1239. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  1240. package/dist/unstable/workflow/WorkflowProxy.js +4 -2
  1241. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  1242. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1243. package/dist/unstable/workflow/index.js.map +1 -1
  1244. package/dist/unstable/workflow/internal/crypto.js.map +1 -1
  1245. package/package.json +5 -6
  1246. package/src/Array.ts +1068 -1070
  1247. package/src/BigDecimal.ts +433 -756
  1248. package/src/BigInt.ts +213 -269
  1249. package/src/Boolean.ts +146 -188
  1250. package/src/Cache.ts +409 -255
  1251. package/src/Cause.ts +167 -277
  1252. package/src/Channel.ts +923 -830
  1253. package/src/ChannelSchema.ts +1 -1
  1254. package/src/Chunk.ts +841 -1181
  1255. package/src/Clock.ts +181 -49
  1256. package/src/Combiner.ts +20 -33
  1257. package/src/Config.ts +618 -334
  1258. package/src/ConfigProvider.ts +221 -127
  1259. package/src/Console.ts +289 -39
  1260. package/src/Context.ts +319 -378
  1261. package/src/Cron.ts +68 -77
  1262. package/src/Crypto.ts +13 -15
  1263. package/src/Data.ts +63 -82
  1264. package/src/DateTime.ts +564 -660
  1265. package/src/Deferred.ts +253 -256
  1266. package/src/Duration.ts +216 -308
  1267. package/src/Effect.ts +2958 -3390
  1268. package/src/Encoding.ts +22 -40
  1269. package/src/Equal.ts +49 -39
  1270. package/src/Equivalence.ts +103 -105
  1271. package/src/ErrorReporter.ts +51 -27
  1272. package/src/ExecutionPlan.ts +13 -55
  1273. package/src/Exit.ts +116 -192
  1274. package/src/Fiber.ts +81 -148
  1275. package/src/FiberHandle.ts +155 -107
  1276. package/src/FiberMap.ts +225 -174
  1277. package/src/FiberSet.ts +124 -82
  1278. package/src/FileSystem.ts +155 -263
  1279. package/src/Filter.ts +61 -33
  1280. package/src/Formatter.ts +54 -56
  1281. package/src/Function.ts +76 -145
  1282. package/src/Graph.ts +416 -770
  1283. package/src/HKT.ts +12 -6
  1284. package/src/Hash.ts +52 -83
  1285. package/src/HashMap.ts +319 -411
  1286. package/src/HashRing.ts +1 -0
  1287. package/src/HashSet.ts +177 -284
  1288. package/src/Inspectable.ts +12 -12
  1289. package/src/Iterable.ts +622 -787
  1290. package/src/JsonPatch.ts +60 -113
  1291. package/src/JsonPointer.ts +8 -8
  1292. package/src/JsonSchema.ts +405 -249
  1293. package/src/Latch.ts +23 -35
  1294. package/src/Layer.ts +359 -260
  1295. package/src/LayerMap.ts +49 -29
  1296. package/src/LayerRef.ts +6 -2
  1297. package/src/LogLevel.ts +114 -214
  1298. package/src/Logger.ts +347 -699
  1299. package/src/ManagedRuntime.ts +20 -5
  1300. package/src/Match.ts +217 -252
  1301. package/src/Metric.ts +520 -1092
  1302. package/src/MutableHashMap.ts +218 -255
  1303. package/src/MutableHashSet.ts +84 -89
  1304. package/src/MutableList.ts +73 -370
  1305. package/src/MutableRef.ts +420 -243
  1306. package/src/Newtype.ts +21 -14
  1307. package/src/NonEmptyIterable.ts +7 -137
  1308. package/src/Number.ts +196 -233
  1309. package/src/Optic.ts +246 -385
  1310. package/src/Option.ts +449 -813
  1311. package/src/Order.ts +109 -109
  1312. package/src/Ordering.ts +20 -23
  1313. package/src/PartitionedSemaphore.ts +1 -4
  1314. package/src/Path.ts +38 -41
  1315. package/src/Pipeable.ts +6 -5
  1316. package/src/PlatformError.ts +4 -4
  1317. package/src/Pool.ts +4 -2
  1318. package/src/Predicate.ts +200 -181
  1319. package/src/PrimaryKey.ts +7 -7
  1320. package/src/PubSub.ts +526 -552
  1321. package/src/Pull.ts +24 -18
  1322. package/src/Queue.ts +200 -159
  1323. package/src/Random.ts +49 -74
  1324. package/src/RcMap.ts +121 -63
  1325. package/src/RcRef.ts +24 -13
  1326. package/src/Record.ts +387 -487
  1327. package/src/Redactable.ts +10 -3
  1328. package/src/Redacted.ts +25 -25
  1329. package/src/Reducer.ts +8 -15
  1330. package/src/Ref.ts +221 -361
  1331. package/src/References.ts +102 -214
  1332. package/src/RegExp.ts +10 -14
  1333. package/src/Request.ts +36 -28
  1334. package/src/RequestResolver.ts +202 -91
  1335. package/src/Result.ts +314 -485
  1336. package/src/Runtime.ts +50 -75
  1337. package/src/Schedule.ts +308 -1734
  1338. package/src/Scheduler.ts +20 -7
  1339. package/src/Schema.ts +3156 -1634
  1340. package/src/SchemaAST.ts +676 -489
  1341. package/src/SchemaError.ts +8 -7
  1342. package/src/SchemaGetter.ts +277 -218
  1343. package/src/SchemaIssue.ts +90 -276
  1344. package/src/SchemaParser.ts +179 -116
  1345. package/src/SchemaRepresentation.ts +698 -3417
  1346. package/src/SchemaTransformation.ts +132 -91
  1347. package/src/Scope.ts +123 -151
  1348. package/src/ScopedRef.ts +4 -4
  1349. package/src/Semaphore.ts +157 -54
  1350. package/src/Sink.ts +128 -113
  1351. package/src/Stdio.ts +1 -1
  1352. package/src/Stream.ts +2665 -3142
  1353. package/src/String.ts +275 -312
  1354. package/src/Struct.ts +114 -118
  1355. package/src/SubscriptionRef.ts +284 -252
  1356. package/src/Symbol.ts +3 -3
  1357. package/src/Terminal.ts +2 -2
  1358. package/src/Tracer.ts +102 -55
  1359. package/src/Trie.ts +287 -679
  1360. package/src/Tuple.ts +92 -127
  1361. package/src/TxChunk.ts +201 -121
  1362. package/src/TxDeferred.ts +62 -46
  1363. package/src/TxHashMap.ts +645 -799
  1364. package/src/TxHashSet.ts +443 -356
  1365. package/src/TxPriorityQueue.ts +130 -98
  1366. package/src/TxPubSub.ts +107 -80
  1367. package/src/TxQueue.ts +214 -183
  1368. package/src/TxReentrantLock.ts +97 -66
  1369. package/src/TxRef.ts +51 -32
  1370. package/src/TxSemaphore.ts +129 -95
  1371. package/src/TxSubscriptionRef.ts +97 -70
  1372. package/src/Types.ts +127 -70
  1373. package/src/Unify.ts +45 -65
  1374. package/src/Utils.ts +23 -16
  1375. package/src/index.ts +0 -5
  1376. package/src/internal/core.ts +5 -4
  1377. package/src/internal/dateTime.ts +6 -0
  1378. package/src/internal/effect.ts +160 -79
  1379. package/src/internal/matcher.ts +1 -1
  1380. package/src/internal/persistence.ts +2 -0
  1381. package/src/internal/record.ts +11 -7
  1382. package/src/internal/references.ts +3 -7
  1383. package/src/internal/schema/annotations.ts +44 -0
  1384. package/src/internal/schema/fromJsonSchemaDocument.ts +959 -0
  1385. package/src/internal/schema/fromRepresentation.ts +339 -0
  1386. package/src/internal/schema/parser.ts +22 -0
  1387. package/src/internal/schema/schema.ts +45 -46
  1388. package/src/internal/schema/{arbitrary.ts → toArbitrary.ts} +8 -10
  1389. package/src/internal/schema/toCodeDocument.ts +572 -0
  1390. package/src/internal/schema/{equivalence.ts → toEquivalence.ts} +12 -7
  1391. package/src/internal/schema/toJsonSchemaDocument.ts +529 -0
  1392. package/src/internal/schema/toRepresentation.ts +386 -0
  1393. package/src/internal/stackTraceLimit.ts +3 -7
  1394. package/src/internal/trie.ts +10 -11
  1395. package/src/testing/FastCheck.ts +8 -7
  1396. package/src/testing/TestClock.ts +73 -31
  1397. package/src/testing/TestConsole.ts +32 -31
  1398. package/src/testing/TestSchema.ts +29 -29
  1399. package/src/unstable/ai/AiError.ts +100 -122
  1400. package/src/unstable/ai/AnthropicStructuredOutput.ts +103 -334
  1401. package/src/unstable/ai/Chat.ts +132 -97
  1402. package/src/unstable/ai/EmbeddingModel.ts +1 -1
  1403. package/src/unstable/ai/IdGenerator.ts +32 -28
  1404. package/src/unstable/ai/LanguageModel.ts +137 -95
  1405. package/src/unstable/ai/McpProtocol.ts +48 -0
  1406. package/src/unstable/ai/McpSchema.ts +75 -65
  1407. package/src/unstable/ai/McpServer.ts +1045 -303
  1408. package/src/unstable/ai/Model.ts +9 -20
  1409. package/src/unstable/ai/OpenAiStructuredOutput.ts +231 -396
  1410. package/src/unstable/ai/Prompt.ts +145 -43
  1411. package/src/unstable/ai/Response.ts +52 -38
  1412. package/src/unstable/ai/Telemetry.ts +46 -13
  1413. package/src/unstable/ai/Tokenizer.ts +14 -3
  1414. package/src/unstable/ai/Tool.ts +81 -48
  1415. package/src/unstable/ai/Toolkit.ts +45 -15
  1416. package/src/unstable/ai/index.ts +5 -0
  1417. package/src/unstable/ai/internal/codec-transformer.ts +13 -7
  1418. package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
  1419. package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
  1420. package/src/unstable/ai/internal/structured-output.ts +453 -0
  1421. package/src/unstable/cli/Argument.ts +273 -69
  1422. package/src/unstable/cli/CliError.ts +116 -77
  1423. package/src/unstable/cli/CliOutput.ts +44 -58
  1424. package/src/unstable/cli/Command.ts +709 -111
  1425. package/src/unstable/cli/Flag.ts +418 -138
  1426. package/src/unstable/cli/GlobalFlag.ts +1 -1
  1427. package/src/unstable/cli/HelpDoc.ts +12 -4
  1428. package/src/unstable/cli/Param.ts +295 -81
  1429. package/src/unstable/cli/Primitive.ts +371 -150
  1430. package/src/unstable/cli/Prompt.ts +28 -14
  1431. package/src/unstable/cli/internal/command.ts +13 -5
  1432. package/src/unstable/cli/internal/config.ts +8 -10
  1433. package/src/unstable/cli/internal/lexer.ts +8 -2
  1434. package/src/unstable/cli/internal/parser.ts +2 -2
  1435. package/src/unstable/cluster/ClusterSchema.ts +8 -8
  1436. package/src/unstable/cluster/ClusterWorkflowEngine.ts +8 -4
  1437. package/src/unstable/cluster/Entity.ts +16 -17
  1438. package/src/unstable/cluster/EntityProxy.ts +4 -2
  1439. package/src/unstable/cluster/EntityResource.ts +2 -2
  1440. package/src/unstable/cluster/Envelope.ts +5 -4
  1441. package/src/unstable/cluster/HttpRunner.ts +6 -4
  1442. package/src/unstable/cluster/Message.ts +9 -9
  1443. package/src/unstable/cluster/MessageStorage.ts +15 -15
  1444. package/src/unstable/cluster/Reply.ts +5 -7
  1445. package/src/unstable/cluster/Runner.ts +1 -1
  1446. package/src/unstable/cluster/RunnerAddress.ts +1 -1
  1447. package/src/unstable/cluster/RunnerHealth.ts +1 -1
  1448. package/src/unstable/cluster/RunnerServer.ts +41 -8
  1449. package/src/unstable/cluster/RunnerStorage.ts +2 -2
  1450. package/src/unstable/cluster/Runners.ts +23 -12
  1451. package/src/unstable/cluster/ShardId.ts +1 -1
  1452. package/src/unstable/cluster/Sharding.ts +168 -42
  1453. package/src/unstable/cluster/ShardingConfig.ts +8 -4
  1454. package/src/unstable/cluster/SingleRunner.ts +4 -2
  1455. package/src/unstable/cluster/SingletonAddress.ts +1 -1
  1456. package/src/unstable/cluster/Snowflake.ts +8 -8
  1457. package/src/unstable/cluster/SqlMessageStorage.ts +84 -36
  1458. package/src/unstable/cluster/SqlRunnerStorage.ts +205 -119
  1459. package/src/unstable/cluster/internal/entityManager.ts +42 -25
  1460. package/src/unstable/cluster/internal/shardLock.ts +9 -0
  1461. package/src/unstable/devtools/DevToolsSchema.ts +10 -5
  1462. package/src/unstable/encoding/Msgpack.ts +6 -8
  1463. package/src/unstable/encoding/Sse.ts +98 -16
  1464. package/src/unstable/eventlog/Event.ts +20 -20
  1465. package/src/unstable/eventlog/EventGroup.ts +4 -4
  1466. package/src/unstable/eventlog/EventJournal.ts +16 -16
  1467. package/src/unstable/eventlog/EventLog.ts +24 -14
  1468. package/src/unstable/eventlog/EventLogEncryption.ts +2 -2
  1469. package/src/unstable/eventlog/EventLogMessage.ts +12 -5
  1470. package/src/unstable/eventlog/EventLogRemote.ts +1 -1
  1471. package/src/unstable/eventlog/EventLogServer.ts +41 -7
  1472. package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
  1473. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
  1474. package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
  1475. package/src/unstable/eventlog/SqlEventJournal.ts +2 -2
  1476. package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +1 -1
  1477. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +6 -3
  1478. package/src/unstable/http/Cookies.ts +64 -45
  1479. package/src/unstable/http/Etag.ts +1 -1
  1480. package/src/unstable/http/FetchHttpClient.ts +3 -1
  1481. package/src/unstable/http/Headers.ts +10 -10
  1482. package/src/unstable/http/HttpBody.ts +20 -5
  1483. package/src/unstable/http/HttpClient.ts +83 -55
  1484. package/src/unstable/http/HttpClientRequest.ts +59 -0
  1485. package/src/unstable/http/HttpClientResponse.ts +4 -4
  1486. package/src/unstable/http/HttpEffect.ts +8 -8
  1487. package/src/unstable/http/HttpMethod.ts +6 -9
  1488. package/src/unstable/http/HttpMiddleware.ts +202 -39
  1489. package/src/unstable/http/HttpPlatform.ts +95 -0
  1490. package/src/unstable/http/HttpRouter.ts +102 -98
  1491. package/src/unstable/http/HttpServer.ts +13 -13
  1492. package/src/unstable/http/HttpServerError.ts +2 -2
  1493. package/src/unstable/http/HttpServerRequest.ts +9 -8
  1494. package/src/unstable/http/HttpServerResponse.ts +30 -0
  1495. package/src/unstable/http/HttpStaticServer.ts +35 -7
  1496. package/src/unstable/http/Multipart.ts +22 -19
  1497. package/src/unstable/http/Template.ts +1 -1
  1498. package/src/unstable/http/Url.ts +33 -63
  1499. package/src/unstable/http/UrlParams.ts +27 -32
  1500. package/src/unstable/http/internal/compression.ts +196 -0
  1501. package/src/unstable/httpapi/HttpApi.ts +3 -3
  1502. package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
  1503. package/src/unstable/httpapi/HttpApiClient.ts +19 -19
  1504. package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
  1505. package/src/unstable/httpapi/HttpApiError.ts +13 -13
  1506. package/src/unstable/httpapi/HttpApiGroup.ts +16 -16
  1507. package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
  1508. package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
  1509. package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
  1510. package/src/unstable/httpapi/OpenApi.ts +65 -41
  1511. package/src/unstable/observability/OtlpExporter.ts +126 -10
  1512. package/src/unstable/observability/OtlpLogger.ts +5 -5
  1513. package/src/unstable/observability/OtlpMetrics.ts +12 -5
  1514. package/src/unstable/observability/OtlpResource.ts +26 -17
  1515. package/src/unstable/observability/OtlpTracer.ts +8 -4
  1516. package/src/unstable/observability/PrometheusMetrics.ts +13 -4
  1517. package/src/unstable/observability/internal/otlpEnv.ts +1 -1
  1518. package/src/unstable/observability/internal/protobuf.ts +3 -0
  1519. package/src/unstable/persistence/KeyValueStore.ts +72 -49
  1520. package/src/unstable/persistence/Persistable.ts +11 -10
  1521. package/src/unstable/persistence/PersistedQueue.ts +6 -6
  1522. package/src/unstable/persistence/Persistence.ts +126 -19
  1523. package/src/unstable/persistence/RateLimiter.ts +28 -17
  1524. package/src/unstable/persistence/Redis.ts +4 -4
  1525. package/src/unstable/process/ChildProcess.ts +64 -21
  1526. package/src/unstable/process/ChildProcessSpawner.ts +22 -11
  1527. package/src/unstable/reactivity/AsyncResult.ts +16 -16
  1528. package/src/unstable/reactivity/Atom.ts +117 -22
  1529. package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
  1530. package/src/unstable/reactivity/AtomRegistry.ts +25 -4
  1531. package/src/unstable/reactivity/AtomRpc.ts +5 -4
  1532. package/src/unstable/reactivity/Hydration.ts +1 -1
  1533. package/src/unstable/rpc/Rpc.ts +35 -33
  1534. package/src/unstable/rpc/RpcClient.ts +18 -16
  1535. package/src/unstable/rpc/RpcGroup.ts +8 -8
  1536. package/src/unstable/rpc/RpcMessage.ts +31 -30
  1537. package/src/unstable/rpc/RpcMiddleware.ts +10 -10
  1538. package/src/unstable/rpc/RpcSchema.ts +4 -4
  1539. package/src/unstable/rpc/RpcSerialization.ts +167 -68
  1540. package/src/unstable/rpc/RpcServer.ts +18 -15
  1541. package/src/unstable/rpc/RpcWorker.ts +5 -5
  1542. package/src/unstable/schema/Model.ts +52 -50
  1543. package/src/unstable/schema/VariantSchema.ts +19 -29
  1544. package/src/unstable/socket/Socket.ts +18 -5
  1545. package/src/unstable/sql/SqlClient.ts +5 -6
  1546. package/src/unstable/sql/SqlError.ts +2 -2
  1547. package/src/unstable/sql/SqlModel.ts +2 -2
  1548. package/src/unstable/sql/SqlResolver.ts +5 -5
  1549. package/src/unstable/sql/Statement.ts +31 -29
  1550. package/src/unstable/workers/Transferable.ts +1 -1
  1551. package/src/unstable/workers/Worker.ts +2 -2
  1552. package/src/unstable/workers/WorkerError.ts +7 -7
  1553. package/src/unstable/workers/WorkerRunner.ts +1 -1
  1554. package/src/unstable/workflow/Activity.ts +2 -2
  1555. package/src/unstable/workflow/DurableClock.ts +1 -1
  1556. package/src/unstable/workflow/DurableDeferred.ts +10 -10
  1557. package/src/unstable/workflow/DurableQueue.ts +22 -20
  1558. package/src/unstable/workflow/Workflow.ts +23 -23
  1559. package/src/unstable/workflow/WorkflowEngine.ts +1 -1
  1560. package/src/unstable/workflow/WorkflowProxy.ts +4 -2
  1561. package/dist/SchemaUtils.d.ts +0 -28
  1562. package/dist/SchemaUtils.d.ts.map +0 -1
  1563. package/dist/SchemaUtils.js +0 -45
  1564. package/dist/SchemaUtils.js.map +0 -1
  1565. package/dist/internal/schema/arbitrary.d.ts.map +0 -1
  1566. package/dist/internal/schema/arbitrary.js.map +0 -1
  1567. package/dist/internal/schema/equivalence.d.ts +0 -2
  1568. package/dist/internal/schema/equivalence.d.ts.map +0 -1
  1569. package/dist/internal/schema/equivalence.js.map +0 -1
  1570. package/dist/internal/schema/representation.d.ts +0 -2
  1571. package/dist/internal/schema/representation.d.ts.map +0 -1
  1572. package/dist/internal/schema/representation.js +0 -865
  1573. package/dist/internal/schema/representation.js.map +0 -1
  1574. package/dist/internal/version.d.ts +0 -3
  1575. package/dist/internal/version.d.ts.map +0 -1
  1576. package/dist/internal/version.js +0 -2
  1577. package/dist/internal/version.js.map +0 -1
  1578. package/src/SchemaUtils.ts +0 -51
  1579. package/src/internal/schema/representation.ts +0 -795
  1580. package/src/internal/version.ts +0 -2
package/dist/Channel.js CHANGED
@@ -23,6 +23,7 @@ import { addSpanStackTrace } from "./internal/tracer.js";
23
23
  import * as Iterable from "./Iterable.js";
24
24
  import * as Latch from "./Latch.js";
25
25
  import * as Layer from "./Layer.js";
26
+ import * as MutableRef from "./MutableRef.js";
26
27
  import * as Option from "./Option.js";
27
28
  import { pipeArguments } from "./Pipeable.js";
28
29
  import { hasProperty, isTagged } from "./Predicate.js";
@@ -50,12 +51,12 @@ export const TypeId = "~effect/Channel";
50
51
  *
51
52
  * **Example** (Checking for channels)
52
53
  *
53
- * ```ts
54
+ * ```ts import.meta.vitest
54
55
  * import { Channel } from "effect"
55
56
  *
56
57
  * const channel = Channel.succeed(42)
57
- * console.log(Channel.isChannel(channel)) // true
58
- * console.log(Channel.isChannel("not a channel")) // false
58
+ * Channel.isChannel(channel) // => true
59
+ * Channel.isChannel("not a channel") // => false
59
60
  * ```
60
61
  *
61
62
  * @category guards
@@ -82,12 +83,13 @@ const ChannelProto = {
82
83
  *
83
84
  * **Example** (Creating channels from transforms)
84
85
  *
85
- * ```ts
86
+ * ```ts import.meta.vitest
86
87
  * import { Channel, Effect } from "effect"
87
88
  *
88
89
  * const channel = Channel.fromTransform((upstream, scope) =>
89
90
  * Effect.succeed(upstream)
90
91
  * )
92
+ * await Effect.runPromise(Channel.runCollect(channel)) // => []
91
93
  * ```
92
94
  *
93
95
  * @category constructors
@@ -103,7 +105,7 @@ export const fromTransform = transform => {
103
105
  *
104
106
  * **Example** (Transforming pull behavior)
105
107
  *
106
- * ```ts
108
+ * ```ts import.meta.vitest
107
109
  * import { Channel, Effect } from "effect"
108
110
  *
109
111
  * // Transform a channel by modifying its pull behavior
@@ -116,7 +118,7 @@ export const fromTransform = transform => {
116
118
  * Effect.map(pull, (value) => value * 2)
117
119
  * )
118
120
  * )
119
- * // Outputs: 2, 4, 6
121
+ * await Effect.runPromise(Channel.runCollect(transformedChannel)) // => [2, 4, 6]
120
122
  * ```
121
123
  *
122
124
  * @category constructors
@@ -128,12 +130,18 @@ export const transformPull = (self, f) => fromTransform((upstream, scope) => Eff
128
130
  *
129
131
  * **Example** (Creating channels from pulls)
130
132
  *
131
- * ```ts
132
- * import { Channel, Effect } from "effect"
133
+ * ```ts import.meta.vitest
134
+ * import { Cause, Channel, Effect } from "effect"
133
135
  *
134
- * const channel = Channel.fromPull(
135
- * Effect.succeed(Effect.succeed(42))
136
- * )
136
+ * const channel = Channel.fromPull(Effect.sync(() => {
137
+ * let emitted = false
138
+ * return Effect.suspend(() => {
139
+ * if (emitted) return Cause.done()
140
+ * emitted = true
141
+ * return Effect.succeed(42)
142
+ * })
143
+ * }))
144
+ * await Effect.runPromise(Channel.runCollect(channel)) // => [42]
137
145
  * ```
138
146
  *
139
147
  * @category constructors
@@ -166,12 +174,13 @@ export const fromTransformBracket = f => fromTransform(Effect.fnUntraced(functio
166
174
  *
167
175
  * **Example** (Extracting channel transforms)
168
176
  *
169
- * ```ts
170
- * import { Channel } from "effect"
177
+ * ```ts import.meta.vitest
178
+ * import { Channel, Effect } from "effect"
171
179
  *
172
180
  * const channel = Channel.succeed(42)
173
181
  * const transform = Channel.toTransform(channel)
174
- * // transform can now be used directly
182
+ * typeof transform // => "function"
183
+ * Effect.runSync(Channel.runCollect(channel)) // => [42]
175
184
  * ```
176
185
  *
177
186
  * @category destructors
@@ -183,10 +192,10 @@ export const toTransform = channel => channel.transform;
183
192
  *
184
193
  * **Example** (Reading the default chunk size)
185
194
  *
186
- * ```ts
195
+ * ```ts import.meta.vitest
187
196
  * import { Channel } from "effect"
188
197
  *
189
- * console.log(Channel.DefaultChunkSize) // 4096
198
+ * Channel.DefaultChunkSize // => 4096
190
199
  * ```
191
200
  *
192
201
  * @category constants
@@ -202,7 +211,7 @@ const asyncQueue = (scope, f, options) => Queue.make({
202
211
  *
203
212
  * **Example** (Creating channels from callbacks)
204
213
  *
205
- * ```ts
214
+ * ```ts import.meta.vitest
206
215
  * import { Channel, Effect, Queue } from "effect"
207
216
  *
208
217
  * const channel = Channel.callback<number>((queue) =>
@@ -210,8 +219,10 @@ const asyncQueue = (scope, f, options) => Queue.make({
210
219
  * yield* Queue.offer(queue, 1)
211
220
  * yield* Queue.offer(queue, 2)
212
221
  * yield* Queue.offer(queue, 3)
222
+ * yield* Queue.end(queue)
213
223
  * })
214
224
  * )
225
+ * await Effect.runPromise(Channel.runCollect(channel)) // => [1, 2, 3]
215
226
  * ```
216
227
  *
217
228
  * @category constructors
@@ -223,14 +234,15 @@ export const callback = (f, options) => fromTransform((_, scope) => Effect.map(a
223
234
  *
224
235
  * **Example** (Creating array channels from callbacks)
225
236
  *
226
- * ```ts
237
+ * ```ts import.meta.vitest
227
238
  * import { Channel, Effect, Queue } from "effect"
228
239
  *
229
240
  * const channel = Channel.callbackArray<number>(Effect.fn(function*(queue) {
230
241
  * yield* Queue.offer(queue, 1)
231
242
  * yield* Queue.offer(queue, 2)
243
+ * yield* Queue.end(queue)
232
244
  * }))
233
- * // Emits arrays of numbers instead of individual numbers
245
+ * await Effect.runPromise(Channel.runCollect(channel)) // => [[1, 2]]
234
246
  * ```
235
247
  *
236
248
  * @category constructors
@@ -242,11 +254,11 @@ export const callbackArray = (f, options) => fromTransform((_, scope) => Effect.
242
254
  *
243
255
  * **Example** (Suspending channel creation)
244
256
  *
245
- * ```ts
246
- * import { Channel } from "effect"
257
+ * ```ts import.meta.vitest
258
+ * import { Channel, Effect } from "effect"
247
259
  *
248
260
  * const channel = Channel.suspend(() => Channel.succeed(42))
249
- * // The inner channel is not created until the suspended channel is run
261
+ * Effect.runSync(Channel.runCollect(channel)) // => [42]
250
262
  * ```
251
263
  *
252
264
  * @category constructors
@@ -265,14 +277,16 @@ export const suspend = evaluate => fromTransform((upstream, scope) => Effect.sus
265
277
  *
266
278
  * **Example** (Managing resources with acquire-use-release)
267
279
  *
268
- * ```ts
280
+ * ```ts import.meta.vitest
269
281
  * import { Channel, Effect } from "effect"
270
282
  *
283
+ * const released: Array<string> = []
271
284
  * const channel = Channel.acquireUseRelease(
272
285
  * Effect.succeed("resource"),
273
286
  * (resource) => Channel.succeed(resource.toUpperCase()),
274
- * (resource, exit) => Effect.log(`Released: ${resource}`)
287
+ * (resource, exit) => Effect.sync(() => released.push(resource))
275
288
  * )
289
+ * const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["RESOURCE"], ["resource"]]
276
290
  * ```
277
291
  *
278
292
  * @category constructors
@@ -297,13 +311,15 @@ export const acquireUseRelease = (acquire, use, release) => fromTransformBracket
297
311
  *
298
312
  * **Example** (Managing resources with acquire-release)
299
313
  *
300
- * ```ts
314
+ * ```ts import.meta.vitest
301
315
  * import { Channel, Effect } from "effect"
302
316
  *
317
+ * const released: Array<string> = []
303
318
  * const channel = Channel.acquireRelease(
304
319
  * Effect.succeed("resource"),
305
- * (resource, exit) => Effect.log(`Released: ${resource}`)
320
+ * (resource, exit) => Effect.sync(() => released.push(resource))
306
321
  * )
322
+ * const observed = [await Effect.runPromise(Channel.runCollect(channel)), released] // => [["resource"], ["resource"]]
307
323
  * ```
308
324
  *
309
325
  * @category constructors
@@ -315,12 +331,12 @@ export const acquireRelease = /*#__PURE__*/dual(2, (self, release) => unwrap(Eff
315
331
  *
316
332
  * **Example** (Creating channels from iterators)
317
333
  *
318
- * ```ts
319
- * import { Channel } from "effect"
334
+ * ```ts import.meta.vitest
335
+ * import { Channel, Effect } from "effect"
320
336
  *
321
337
  * const numbers = [1, 2, 3, 4, 5]
322
338
  * const channel = Channel.fromIterator(() => numbers[Symbol.iterator]())
323
- * // Emits: 1, 2, 3, 4, 5
339
+ * Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3, 4, 5]
324
340
  * ```
325
341
  *
326
342
  * @category constructors
@@ -338,11 +354,11 @@ export const fromIterator = iterator => fromPull(Effect.sync(() => {
338
354
  *
339
355
  * **Example** (Creating channels from arrays)
340
356
  *
341
- * ```ts
342
- * import { Channel } from "effect"
357
+ * ```ts import.meta.vitest
358
+ * import { Channel, Effect } from "effect"
343
359
  *
344
360
  * const channel = Channel.fromArray([1, 2, 3, 4, 5])
345
- * // Emits: 1, 2, 3, 4, 5
361
+ * Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3, 4, 5]
346
362
  * ```
347
363
  *
348
364
  * @category constructors
@@ -357,12 +373,12 @@ export const fromArray = array => fromPull(Effect.sync(() => {
357
373
  *
358
374
  * **Example** (Creating channels from chunks)
359
375
  *
360
- * ```ts
361
- * import { Channel, Chunk } from "effect"
376
+ * ```ts import.meta.vitest
377
+ * import { Channel, Chunk, Effect } from "effect"
362
378
  *
363
379
  * const chunk = Chunk.make(1, 2, 3)
364
380
  * const channel = Channel.fromChunk(chunk)
365
- * // Emits: 1, 2, 3
381
+ * Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3]
366
382
  * ```
367
383
  *
368
384
  * @category constructors
@@ -374,8 +390,8 @@ export const fromChunk = chunk => fromArray(Chunk.toReadonlyArray(chunk));
374
390
  *
375
391
  * **Example** (Batching iterator output)
376
392
  *
377
- * ```ts
378
- * import { Channel } from "effect"
393
+ * ```ts import.meta.vitest
394
+ * import { Channel, Effect } from "effect"
379
395
  *
380
396
  * // Create a channel from a simple iterator
381
397
  * const numberIterator = (): Iterator<number, string> => {
@@ -391,13 +407,13 @@ export const fromChunk = chunk => fromArray(Chunk.toReadonlyArray(chunk));
391
407
  * }
392
408
  *
393
409
  * const channel = Channel.fromIteratorArray(() => numberIterator(), 2)
394
- * // This will emit arrays: [0, 1], [2], then complete with "finished"
410
+ * Effect.runSync(Channel.runCollect(channel)) // => [[0, 1], [2]]
395
411
  * ```
396
412
  *
397
413
  * **Example** (Batching generator output)
398
414
  *
399
- * ```ts
400
- * import { Channel } from "effect"
415
+ * ```ts import.meta.vitest
416
+ * import { Channel, Effect } from "effect"
401
417
  *
402
418
  * // Create channel from a generator function
403
419
  * function* fibonacci(): Generator<number, void, unknown> {
@@ -409,7 +425,7 @@ export const fromChunk = chunk => fromArray(Chunk.toReadonlyArray(chunk));
409
425
  * }
410
426
  *
411
427
  * const fibChannel = Channel.fromIteratorArray(() => fibonacci(), 3)
412
- * // Emits: [0, 1, 1], [2, 3], then completes
428
+ * Effect.runSync(Channel.runCollect(fibChannel)) // => [[0, 1, 1], [2, 3]]
413
429
  * ```
414
430
  *
415
431
  * @category constructors
@@ -440,12 +456,12 @@ export const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => fro
440
456
  *
441
457
  * **Example** (Creating channels from iterables)
442
458
  *
443
- * ```ts
444
- * import { Channel } from "effect"
459
+ * ```ts import.meta.vitest
460
+ * import { Channel, Effect } from "effect"
445
461
  *
446
462
  * const set = new Set([1, 2, 3])
447
463
  * const channel = Channel.fromIterable(set)
448
- * // Emits: 1, 2, 3
464
+ * Effect.runSync(Channel.runCollect(channel)) // => [1, 2, 3]
449
465
  * ```
450
466
  *
451
467
  * @category constructors
@@ -457,12 +473,12 @@ export const fromIterable = iterable => fromIterator(() => iterable[Symbol.itera
457
473
  *
458
474
  * **Example** (Batching iterable output)
459
475
  *
460
- * ```ts
461
- * import { Channel } from "effect"
476
+ * ```ts import.meta.vitest
477
+ * import { Channel, Effect } from "effect"
462
478
  *
463
479
  * const numbers = [1, 2, 3, 4, 5]
464
- * const channel = Channel.fromIterableArray(numbers)
465
- * // Emits arrays like: [1, 2, 3, 4], [5] (based on chunk size)
480
+ * const channel = Channel.fromIterableArray(numbers, 4)
481
+ * Effect.runSync(Channel.runCollect(channel)) // => [[1, 2, 3, 4], [5]]
466
482
  * ```
467
483
  *
468
484
  * @category constructors
@@ -474,11 +490,11 @@ export const fromIterableArray = (iterable, chunkSize = DefaultChunkSize) => fro
474
490
  *
475
491
  * **Example** (Creating channels that succeed)
476
492
  *
477
- * ```ts
478
- * import { Channel } from "effect"
493
+ * ```ts import.meta.vitest
494
+ * import { Channel, Effect } from "effect"
479
495
  *
480
496
  * const channel = Channel.succeed(42)
481
- * // Emits: 42
497
+ * Effect.runSync(Channel.runCollect(channel)) // => [42]
482
498
  * ```
483
499
  *
484
500
  * @category constructors
@@ -490,11 +506,11 @@ export const succeed = value => fromEffect(Effect.succeed(value));
490
506
  *
491
507
  * **Example** (Ending with a value)
492
508
  *
493
- * ```ts
494
- * import { Channel } from "effect"
509
+ * ```ts import.meta.vitest
510
+ * import { Channel, Effect } from "effect"
495
511
  *
496
512
  * const channel = Channel.end("done")
497
- * // Ends immediately with "done", emits nothing
513
+ * Effect.runSync(Channel.runCollect(channel)) // => []
498
514
  * ```
499
515
  *
500
516
  * @category constructors
@@ -513,8 +529,8 @@ export const endSync = evaluate => fromPull(Effect.sync(() => Cause.done(evaluat
513
529
  *
514
530
  * **Example** (Computing values lazily)
515
531
  *
516
- * ```ts
517
- * import { Channel } from "effect"
532
+ * ```ts import.meta.vitest
533
+ * import { Channel, Effect } from "effect"
518
534
  *
519
535
  * let requests = 0
520
536
  *
@@ -522,7 +538,7 @@ export const endSync = evaluate => fromPull(Effect.sync(() => Cause.done(evaluat
522
538
  * requests += 1
523
539
  * return `request-${requests}`
524
540
  * })
525
- * // Emits "request-1" when the channel runs for the first time
541
+ * Effect.runSync(Channel.runCollect(channel)) // => ["request-1"]
526
542
  * ```
527
543
  *
528
544
  * @category constructors
@@ -534,8 +550,8 @@ export const sync = evaluate => fromEffect(Effect.sync(evaluate));
534
550
  *
535
551
  * **Example** (Creating empty channels)
536
552
  *
537
- * ```ts
538
- * import { Channel } from "effect"
553
+ * ```ts import.meta.vitest
554
+ * import { Channel, Effect } from "effect"
539
555
  *
540
556
  * // Create an empty channel
541
557
  * const emptyChannel = Channel.empty
@@ -547,6 +563,8 @@ export const sync = evaluate => fromEffect(Effect.sync(evaluate));
547
563
  * // Empty channel can be used as a no-op in conditional logic
548
564
  * const conditionalChannel = (shouldEmit: boolean) =>
549
565
  * shouldEmit ? Channel.succeed("data") : Channel.empty
566
+ *
567
+ * Effect.runSync(Channel.runCollect(conditionalChannel(true))) // => ["data"]
550
568
  * ```
551
569
  *
552
570
  * @category constructors
@@ -558,7 +576,7 @@ export const empty = /*#__PURE__*/fromPull(/*#__PURE__*/Effect.succeed(/*#__PURE
558
576
  *
559
577
  * **Example** (Creating non-terminating channels)
560
578
  *
561
- * ```ts
579
+ * ```ts import.meta.vitest
562
580
  * import { Channel } from "effect"
563
581
  *
564
582
  * // Create a channel that never completes
@@ -573,6 +591,8 @@ export const empty = /*#__PURE__*/fromPull(/*#__PURE__*/Effect.succeed(/*#__PURE
573
591
  * // Never channel is useful for testing or as a placeholder
574
592
  * const conditionalChannel = (shouldComplete: boolean) =>
575
593
  * shouldComplete ? Channel.succeed("done") : Channel.never
594
+ *
595
+ * Channel.isChannel(conditionalChannel(false)) // => true
576
596
  * ```
577
597
  *
578
598
  * @category constructors
@@ -584,26 +604,11 @@ export const never = /*#__PURE__*/fromPull(/*#__PURE__*/Effect.succeed(Effect.ne
584
604
  *
585
605
  * **Example** (Failing with an error)
586
606
  *
587
- * ```ts
588
- * import { Channel } from "effect"
607
+ * ```ts import.meta.vitest
608
+ * import { Channel, Effect, Exit } from "effect"
589
609
  *
590
- * // Create a channel that fails with a string error
591
610
  * const failedChannel = Channel.fail("Something went wrong")
592
- *
593
- * // Create a channel that fails with a custom error
594
- * class CustomError extends Error {
595
- * constructor(message: string) {
596
- * super(message)
597
- * this.name = "CustomError"
598
- * }
599
- * }
600
- * const customErrorChannel = Channel.fail(new CustomError("Custom error"))
601
- *
602
- * // Use in error handling by piping to another channel
603
- * const channelWithFallback = Channel.concatWith(
604
- * failedChannel,
605
- * () => Channel.succeed("fallback value")
606
- * )
611
+ * Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))) // => Exit.fail("Something went wrong")
607
612
  * ```
608
613
  *
609
614
  * @category constructors
@@ -621,27 +626,18 @@ export const fail = error => fromPull(Effect.succeed(Effect.fail(error)));
621
626
  *
622
627
  * **Example** (Failing with a lazy error)
623
628
  *
624
- * ```ts
625
- * import { Channel } from "effect"
626
- *
627
- * // Create a channel that fails with a lazily computed error
628
- * const failedChannel = Channel.failSync(() => {
629
- * console.log("Computing error...")
630
- * return new Error("Computed at runtime")
631
- * })
629
+ * ```ts import.meta.vitest
630
+ * import { Channel, Effect, Exit } from "effect"
632
631
  *
633
- * // The error computation is deferred until the channel runs
634
632
  * let attempts = 0
635
633
  * const conditionalError = Channel.failSync(() => {
636
634
  * attempts += 1
637
635
  * return `Error after attempt ${attempts}`
638
636
  * })
639
- *
640
- * // Use with expensive error construction
641
- * const expensiveError = Channel.failSync(() => {
642
- * const requestId = "request-123"
643
- * return new Error(`Failed while processing ${requestId}`)
644
- * })
637
+ * const observed = [
638
+ * Effect.runSync(Effect.exit(Channel.runCollect(conditionalError))),
639
+ * attempts
640
+ * ] // => [Exit.fail("Error after attempt 1"), 1]
645
641
  * ```
646
642
  *
647
643
  * @category constructors
@@ -658,20 +654,12 @@ export const failSync = evaluate => fromPull(Effect.failSync(evaluate));
658
654
  *
659
655
  * **Example** (Failing with causes)
660
656
  *
661
- * ```ts
662
- * import { Cause, Channel } from "effect"
657
+ * ```ts import.meta.vitest
658
+ * import { Cause, Channel, Effect, Exit } from "effect"
663
659
  *
664
- * // Create a channel that fails with a simple cause
665
660
  * const simpleCause = Cause.fail("Simple error")
666
661
  * const failedChannel = Channel.failCause(simpleCause)
667
- *
668
- * // Create a channel with a die cause
669
- * const dieCause = Cause.die(new Error("System error"))
670
- * const dieFailure = Channel.failCause(dieCause)
671
- *
672
- * // Create a channel with a simple fail cause
673
- * const failCause = Cause.fail("Simple error")
674
- * const simpleFail = Channel.failCause(failCause)
662
+ * Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))) // => Exit.failCause(simpleCause)
675
663
  * ```
676
664
  *
677
665
  * @category constructors
@@ -684,8 +672,8 @@ export const failCause = cause => fromPull(Effect.failCause(cause));
684
672
  *
685
673
  * **Example** (Failing with lazy causes)
686
674
  *
687
- * ```ts
688
- * import { Cause, Channel } from "effect"
675
+ * ```ts import.meta.vitest
676
+ * import { Cause, Channel, Effect, Exit } from "effect"
689
677
  *
690
678
  * // Create a channel that fails with a lazily computed cause
691
679
  * let attempts = 0
@@ -694,11 +682,10 @@ export const failCause = cause => fromPull(Effect.failCause(cause));
694
682
  * return Cause.fail(`Runtime error after attempt ${attempts}`)
695
683
  * })
696
684
  *
697
- * // Create a channel with die cause computation
698
- * const dieCauseChannel = Channel.failCauseSync(() => {
699
- * const operation = "load-profile"
700
- * return Cause.die(`Unexpected defect during ${operation}`)
701
- * })
685
+ * const observed = [
686
+ * Effect.runSync(Effect.exit(Channel.runCollect(failedChannel))),
687
+ * attempts
688
+ * ] // => [Exit.fail("Runtime error after attempt 1"), 1]
702
689
  * ```
703
690
  *
704
691
  * @category constructors
@@ -710,20 +697,12 @@ export const failCauseSync = evaluate => fromPull(Effect.failCauseSync(evaluate)
710
697
  *
711
698
  * **Example** (Dying with defects)
712
699
  *
713
- * ```ts
714
- * import { Channel } from "effect"
715
- *
716
- * // Create a channel that dies with a string defect
717
- * const diedChannel = Channel.die("Unrecoverable error")
718
- *
719
- * // Create a channel that dies with an Error object
720
- * const errorDefect = Channel.die(new Error("System failure"))
700
+ * ```ts import.meta.vitest
701
+ * import { Cause, Channel, Effect, Exit } from "effect"
721
702
  *
722
- * // Die with any value as a defect
723
- * const objectDefect = Channel.die({
724
- * code: "SYSTEM_FAILURE",
725
- * details: "Critical system component failed"
726
- * })
703
+ * const defect = "Unrecoverable error"
704
+ * const diedChannel = Channel.die(defect)
705
+ * Effect.runSync(Effect.exit(Channel.runCollect(diedChannel))) // => Exit.failCause(Cause.die(defect))
727
706
  * ```
728
707
  *
729
708
  * @category constructors
@@ -735,33 +714,13 @@ export const die = defect => failCause(Cause.die(defect));
735
714
  *
736
715
  * **Example** (Creating channels from effects)
737
716
  *
738
- * ```ts
739
- * import { Channel, Data, Effect } from "effect"
740
- *
741
- * class DatabaseError extends Data.TaggedError("DatabaseError")<{
742
- * readonly message: string
743
- * }> {}
717
+ * ```ts import.meta.vitest
718
+ * import { Channel, Effect } from "effect"
744
719
  *
745
- * // Create a channel from a successful effect
746
720
  * const successChannel = Channel.fromEffect(
747
721
  * Effect.succeed("Hello from effect!")
748
722
  * )
749
- *
750
- * // Create a channel from an effect that might fail
751
- * const fetchUserChannel = Channel.fromEffect(
752
- * Effect.tryPromise({
753
- * try: () => fetch("/api/user").then((res) => res.json()),
754
- * catch: (error) => new DatabaseError({ message: String(error) })
755
- * })
756
- * )
757
- *
758
- * // Channel from effect with async computation
759
- * const asyncChannel = Channel.fromEffect(
760
- * Effect.gen(function*() {
761
- * yield* Effect.sleep("100 millis")
762
- * return "Async result"
763
- * })
764
- * )
723
+ * Effect.runSync(Channel.runCollect(successChannel)) // => ["Hello from effect!"]
765
724
  * ```
766
725
  *
767
726
  * @category constructors
@@ -812,35 +771,17 @@ export const fromEffectTake = effect => fromPull(Effect.succeed(Effect.flatMap(e
812
771
  *
813
772
  * **Example** (Creating channels from queues)
814
773
  *
815
- * ```ts
816
- * import { Channel, Data, Effect, Queue } from "effect"
817
- *
818
- * class QueueError extends Data.TaggedError("QueueError")<{
819
- * readonly reason: string
820
- * }> {}
774
+ * ```ts import.meta.vitest
775
+ * import { Cause, Channel, Effect, Queue } from "effect"
821
776
  *
822
777
  * const program = Effect.gen(function*() {
823
- * // Create a bounded queue
824
- * const queue = yield* Queue.bounded<string, QueueError>(10)
825
- *
826
- * // Add some items to the queue
827
- * yield* Queue.offer(queue, "item1")
828
- * yield* Queue.offer(queue, "item2")
829
- * yield* Queue.offer(queue, "item3")
830
- *
831
- * // Create a channel from the queue
778
+ * const queue = yield* Queue.bounded<string, Cause.Done>(3)
779
+ * yield* Queue.offerAll(queue, ["item1", "item2", "item3"])
780
+ * yield* Queue.end(queue)
832
781
  * const channel = Channel.fromQueue(queue)
833
- *
834
- * // The channel will read items from the queue one by one
835
- * return channel
836
- * })
837
- *
838
- * // Sliding queue example
839
- * const slidingProgram = Effect.gen(function*() {
840
- * const slidingQueue = yield* Queue.sliding<number, QueueError>(5)
841
- * yield* Queue.offerAll(slidingQueue, [1, 2, 3, 4, 5, 6])
842
- * return Channel.fromQueue(slidingQueue)
782
+ * return yield* Channel.runCollect(channel)
843
783
  * })
784
+ * await Effect.runPromise(program) // => ["item1", "item2", "item3"]
844
785
  * ```
845
786
  *
846
787
  * @category constructors
@@ -852,39 +793,17 @@ export const fromQueue = queue => fromPull(Effect.succeed(Queue.take(queue)));
852
793
  *
853
794
  * **Example** (Creating batched channels from queues)
854
795
  *
855
- * ```ts
856
- * import { Channel, Data, Effect, Queue } from "effect"
857
- *
858
- * class ProcessingError extends Data.TaggedError("ProcessingError")<{
859
- * readonly stage: string
860
- * }> {}
796
+ * ```ts import.meta.vitest
797
+ * import { Cause, Channel, Effect, Queue } from "effect"
861
798
  *
862
799
  * const program = Effect.gen(function*() {
863
- * // Create a queue for batch processing
864
- * const queue = yield* Queue.bounded<number, ProcessingError>(100)
865
- *
866
- * // Fill queue with data
867
- * yield* Queue.offerAll(queue, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
868
- *
869
- * // Create a channel that reads arrays from the queue
800
+ * const queue = yield* Queue.bounded<number, Cause.Done>(4)
801
+ * yield* Queue.offerAll(queue, [1, 2, 3, 4])
802
+ * yield* Queue.end(queue)
870
803
  * const arrayChannel = Channel.fromQueueArray(queue)
871
- *
872
- * // This will emit non-empty arrays of elements instead of individual items
873
- * // Useful for batch processing scenarios
874
- * return arrayChannel
875
- * })
876
- *
877
- * // High-throughput processing example
878
- * const batchProcessor = Effect.gen(function*() {
879
- * const dataQueue = yield* Queue.dropping<string, ProcessingError>(1000)
880
- * const batchChannel = Channel.fromQueueArray(dataQueue)
881
- *
882
- * // Process data in batches for better performance
883
- * return Channel.map(
884
- * batchChannel,
885
- * (batch) => batch.map((item) => item.toUpperCase())
886
- * )
804
+ * return yield* Channel.runCollect(arrayChannel)
887
805
  * })
806
+ * await Effect.runPromise(program) // => [[1, 2, 3, 4]]
888
807
  * ```
889
808
  *
890
809
  * @category constructors
@@ -904,8 +823,8 @@ export const identity = () => fromTransform((upstream, _scope) => Effect.succeed
904
823
  *
905
824
  * **Example** (Creating channels from subscriptions)
906
825
  *
907
- * ```ts
908
- * import { Channel, Data, Effect, PubSub } from "effect"
826
+ * ```ts import.meta.vitest
827
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
909
828
  *
910
829
  * class SubscriptionError extends Data.TaggedError("SubscriptionError")<{
911
830
  * readonly reason: string
@@ -930,6 +849,8 @@ export const identity = () => fromTransform((upstream, _scope) => Effect.succeed
930
849
  * // The channel will receive all published messages
931
850
  * return channel
932
851
  * })
852
+ * const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
853
+ * await Effect.runPromise(result) // => Option.some("Hello")
933
854
  *
934
855
  * // Real-time notifications example
935
856
  * const notificationChannel = Effect.gen(function*() {
@@ -955,8 +876,8 @@ export const fromSubscription = subscription => fromPull(Effect.succeed(Effect.o
955
876
  *
956
877
  * **Example** (Batching subscription values)
957
878
  *
958
- * ```ts
959
- * import { Channel, Data, Effect, PubSub } from "effect"
879
+ * ```ts import.meta.vitest
880
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
960
881
  *
961
882
  * class StreamError extends Data.TaggedError("StreamError")<{
962
883
  * readonly message: string
@@ -978,12 +899,14 @@ export const fromSubscription = subscription => fromPull(Effect.succeed(Effect.o
978
899
  * // The channel will output arrays like [1, 2, 3] and [4]
979
900
  * return channel
980
901
  * })
902
+ * const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
903
+ * await Effect.runPromise(result) // => Option.some([1, 2, 3, 4])
981
904
  * ```
982
905
  *
983
906
  * **Example** (Processing subscription values in batches)
984
907
  *
985
- * ```ts
986
- * import { Channel, Data, Effect, PubSub } from "effect"
908
+ * ```ts import.meta.vitest
909
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
987
910
  *
988
911
  * class BatchProcessingError extends Data.TaggedError("BatchProcessingError")<{
989
912
  * readonly reason: string
@@ -997,19 +920,21 @@ export const fromSubscription = subscription => fromPull(Effect.succeed(Effect.o
997
920
  * const batchChannel = Channel.fromSubscriptionArray(subscription)
998
921
  *
999
922
  * // Transform to process each batch
1000
- * const processedChannel = Channel.map(batchChannel, (batch) => {
1001
- * console.log(`Processing batch of ${batch.length} items:`, batch)
1002
- * return batch.map((item) => item.toUpperCase())
1003
- * })
923
+ * const processedChannel = Channel.map(batchChannel, (batch) =>
924
+ * batch.map((item) => item.toUpperCase())
925
+ * )
1004
926
  *
927
+ * yield* PubSub.publishAll(pubsub, ["one", "two"])
1005
928
  * return processedChannel
1006
929
  * })
930
+ * const batch = Effect.scoped(Effect.flatMap(batchProcessor, Channel.runHead))
931
+ * await Effect.runPromise(batch) // => Option.some(["ONE", "TWO"])
1007
932
  * ```
1008
933
  *
1009
934
  * **Example** (Aggregating subscription metrics)
1010
935
  *
1011
- * ```ts
1012
- * import { Channel, Effect, PubSub } from "effect"
936
+ * ```ts import.meta.vitest
937
+ * import { Channel, Effect, Option, PubSub } from "effect"
1013
938
  *
1014
939
  * const metricsAggregator = Effect.gen(function*() {
1015
940
  * const metricsPubSub = yield* PubSub.bounded<
@@ -1039,8 +964,12 @@ export const fromSubscription = subscription => fromPull(Effect.succeed(Effect.o
1039
964
  * }
1040
965
  * })
1041
966
  *
967
+ * yield* PubSub.publish(metricsPubSub, { timestamp: 1, value: 10 })
1042
968
  * return aggregatedChannel
1043
969
  * })
970
+ * const metric = Effect.scoped(Effect.flatMap(metricsAggregator, Channel.runHead))
971
+ * const result = await Effect.runPromise(metric)
972
+ * Option.map(result, ({ count, sum, average, min, max }) => ({ count, sum, average, min, max })) // => Option.some({ count: 1, sum: 10, average: 10, min: 10, max: 10 })
1044
973
  * ```
1045
974
  *
1046
975
  * @category constructors
@@ -1058,15 +987,15 @@ export const fromSubscriptionArray = subscription => fromPull(Effect.succeed(Eff
1058
987
  *
1059
988
  * **Example** (Creating channels from PubSubs)
1060
989
  *
1061
- * ```ts
1062
- * import { Channel, Data, Effect, PubSub } from "effect"
990
+ * ```ts import.meta.vitest
991
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
1063
992
  *
1064
993
  * class StreamError extends Data.TaggedError("StreamError")<{
1065
994
  * readonly message: string
1066
995
  * }> {}
1067
996
  *
1068
997
  * const program = Effect.gen(function*() {
1069
- * const pubsub = yield* PubSub.bounded<number>(16)
998
+ * const pubsub = yield* PubSub.unbounded<number>({ replay: 3 })
1070
999
  *
1071
1000
  * // Create a channel that reads individual values
1072
1001
  * const channel = Channel.fromPubSub(pubsub)
@@ -1079,15 +1008,17 @@ export const fromSubscriptionArray = subscription => fromPull(Effect.succeed(Eff
1079
1008
  * // The channel will output: 1, 2, 3 (individual values)
1080
1009
  * return channel
1081
1010
  * })
1011
+ * const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
1012
+ * await Effect.runPromise(result) // => Option.some(1)
1082
1013
  * ```
1083
1014
  *
1084
1015
  * **Example** (Streaming PubSub notifications)
1085
1016
  *
1086
- * ```ts
1087
- * import { Channel, Effect, PubSub } from "effect"
1017
+ * ```ts import.meta.vitest
1018
+ * import { Channel, Effect, Option, PubSub } from "effect"
1088
1019
  *
1089
1020
  * const notificationService = Effect.gen(function*() {
1090
- * const notificationPubSub = yield* PubSub.bounded<string>(50)
1021
+ * const notificationPubSub = yield* PubSub.unbounded<string>({ replay: 1 })
1091
1022
  *
1092
1023
  * // Create a channel for real-time notifications
1093
1024
  * const notificationChannel = Channel.fromPubSub(notificationPubSub)
@@ -1100,14 +1031,17 @@ export const fromSubscriptionArray = subscription => fromPull(Effect.succeed(Eff
1100
1031
  * id: `notification:${message}`
1101
1032
  * }))
1102
1033
  *
1034
+ * yield* PubSub.publish(notificationPubSub, "ready")
1103
1035
  * return timestampedChannel
1104
1036
  * })
1037
+ * const notification = Effect.scoped(Effect.flatMap(notificationService, Channel.runHead))
1038
+ * await Effect.runPromise(notification) // => Option.some({ message: "ready", receivedAt: "2024-01-01T00:00:00.000Z", id: "notification:ready" })
1105
1039
  * ```
1106
1040
  *
1107
1041
  * **Example** (Processing PubSub events)
1108
1042
  *
1109
- * ```ts
1110
- * import { Channel, Effect, PubSub } from "effect"
1043
+ * ```ts import.meta.vitest
1044
+ * import { Channel, Effect, Option, PubSub } from "effect"
1111
1045
  *
1112
1046
  * interface DomainEvent {
1113
1047
  * readonly type: string
@@ -1116,7 +1050,7 @@ export const fromSubscriptionArray = subscription => fromPull(Effect.succeed(Eff
1116
1050
  * }
1117
1051
  *
1118
1052
  * const eventProcessor = Effect.gen(function*() {
1119
- * const eventPubSub = yield* PubSub.bounded<DomainEvent>(100)
1053
+ * const eventPubSub = yield* PubSub.unbounded<DomainEvent>({ replay: 1 })
1120
1054
  *
1121
1055
  * // Create a channel for processing domain events
1122
1056
  * const eventChannel = Channel.fromPubSub(eventPubSub)
@@ -1133,8 +1067,11 @@ export const fromSubscriptionArray = subscription => fromPull(Effect.succeed(Eff
1133
1067
  * return event
1134
1068
  * })
1135
1069
  *
1070
+ * yield* PubSub.publish(eventPubSub, { type: "user.created", payload: {}, timestamp: 1 })
1136
1071
  * return processedChannel
1137
1072
  * })
1073
+ * const event = Effect.scoped(Effect.flatMap(eventProcessor, Channel.runHead))
1074
+ * const result = await Effect.runPromise(event) // => Option.some({ type: "user.created", payload: {}, timestamp: 1, processed: true, processedAt: 2 })
1138
1075
  * ```
1139
1076
  *
1140
1077
  * @category constructors
@@ -1152,15 +1089,15 @@ export const fromPubSub = pubsub => unwrap(Effect.map(PubSub.subscribe(pubsub),
1152
1089
  *
1153
1090
  * **Example** (Batching PubSub values)
1154
1091
  *
1155
- * ```ts
1156
- * import { Channel, Data, Effect, PubSub } from "effect"
1092
+ * ```ts import.meta.vitest
1093
+ * import { Channel, Data, Effect, Option, PubSub } from "effect"
1157
1094
  *
1158
1095
  * class BatchError extends Data.TaggedError("BatchError")<{
1159
1096
  * readonly message: string
1160
1097
  * }> {}
1161
1098
  *
1162
1099
  * const program = Effect.gen(function*() {
1163
- * const pubsub = yield* PubSub.bounded<number>(16)
1100
+ * const pubsub = yield* PubSub.unbounded<number>({ replay: 4 })
1164
1101
  *
1165
1102
  * // Create a channel that reads arrays of values
1166
1103
  * const channel = Channel.fromPubSubArray(pubsub)
@@ -1174,12 +1111,14 @@ export const fromPubSub = pubsub => unwrap(Effect.map(PubSub.subscribe(pubsub),
1174
1111
  * // The channel will output arrays like [1, 2, 3] and [4]
1175
1112
  * return channel
1176
1113
  * })
1114
+ * const result = Effect.scoped(Effect.flatMap(program, Channel.runHead))
1115
+ * await Effect.runPromise(result) // => Option.some([1, 2, 3, 4])
1177
1116
  * ```
1178
1117
  *
1179
1118
  * **Example** (Processing PubSub orders in batches)
1180
1119
  *
1181
- * ```ts
1182
- * import { Channel, Effect, PubSub } from "effect"
1120
+ * ```ts import.meta.vitest
1121
+ * import { Channel, Effect, Option, PubSub } from "effect"
1183
1122
  *
1184
1123
  * interface Order {
1185
1124
  * readonly id: string
@@ -1190,7 +1129,7 @@ export const fromPubSub = pubsub => unwrap(Effect.map(PubSub.subscribe(pubsub),
1190
1129
  * }
1191
1130
  *
1192
1131
  * const orderBatchProcessor = Effect.gen(function*() {
1193
- * const orderPubSub = yield* PubSub.bounded<Order>(100)
1132
+ * const orderPubSub = yield* PubSub.unbounded<Order>({ replay: 1 })
1194
1133
  *
1195
1134
  * // Create a channel that processes orders in batches
1196
1135
  * const orderChannel = Channel.fromPubSubArray(orderPubSub)
@@ -1211,14 +1150,20 @@ export const fromPubSub = pubsub => unwrap(Effect.map(PubSub.subscribe(pubsub),
1211
1150
  * }
1212
1151
  * })
1213
1152
  *
1153
+ * yield* PubSub.publish(orderPubSub, {
1154
+ * id: "1", customerId: "a", items: ["book"], total: 10, submittedAt: 1
1155
+ * })
1214
1156
  * return processedChannel
1215
1157
  * })
1158
+ * const order = Effect.scoped(Effect.flatMap(orderBatchProcessor, Channel.runHead))
1159
+ * const result = await Effect.runPromise(order)
1160
+ * Option.map(result, (batch) => [batch.batchSize, batch.totalRevenue, batch.uniqueCustomers]) // => Option.some([1, 10, 1])
1216
1161
  * ```
1217
1162
  *
1218
1163
  * **Example** (Processing PubSub logs in batches)
1219
1164
  *
1220
- * ```ts
1221
- * import { Channel, Effect, PubSub } from "effect"
1165
+ * ```ts import.meta.vitest
1166
+ * import { Channel, Effect, Option, PubSub } from "effect"
1222
1167
  *
1223
1168
  * interface LogEntry {
1224
1169
  * readonly timestamp: number
@@ -1228,7 +1173,7 @@ export const fromPubSub = pubsub => unwrap(Effect.map(PubSub.subscribe(pubsub),
1228
1173
  * }
1229
1174
  *
1230
1175
  * const logAggregator = Effect.gen(function*() {
1231
- * const logPubSub = yield* PubSub.bounded<LogEntry>(500)
1176
+ * const logPubSub = yield* PubSub.unbounded<LogEntry>({ replay: 1 })
1232
1177
  *
1233
1178
  * // Create a channel that collects logs in batches
1234
1179
  * const logChannel = Channel.fromPubSubArray(logPubSub)
@@ -1255,8 +1200,17 @@ export const fromPubSub = pubsub => unwrap(Effect.map(PubSub.subscribe(pubsub),
1255
1200
  * }
1256
1201
  * })
1257
1202
  *
1203
+ * yield* PubSub.publish(logPubSub, {
1204
+ * timestamp: 1,
1205
+ * level: "info",
1206
+ * message: "ready",
1207
+ * source: "app"
1208
+ * } satisfies LogEntry)
1258
1209
  * return analysisChannel
1259
1210
  * })
1211
+ * const log = Effect.scoped(Effect.flatMap(logAggregator, Channel.runHead))
1212
+ * const result = await Effect.runPromise(log)
1213
+ * Option.map(result, (batch) => [batch.batchId, batch.totalEntries, batch.infoCount]) // => Option.some(["1-1", 1, 1])
1260
1214
  * ```
1261
1215
  *
1262
1216
  * @category constructors
@@ -1282,6 +1236,162 @@ export const fromPubSubTake = pubsub => unwrap(Effect.map(PubSub.subscribe(pubsu
1282
1236
  * @since 4.0.0
1283
1237
  */
1284
1238
  export const fromSchedule = schedule => fromPull(Effect.map(Schedule.toStepWithSleep(schedule), step => step(void 0)));
1239
+ /**
1240
+ * Creates a channel from a lazily supplied Web `ReadableStream`.
1241
+ *
1242
+ * **Example** (Reading from a Web stream)
1243
+ *
1244
+ * ```ts import.meta.vitest
1245
+ * import { Channel, Effect } from "effect"
1246
+ *
1247
+ * const channel = Channel.fromReadableStream({
1248
+ * evaluate: () => new ReadableStream({
1249
+ * start(controller) {
1250
+ * controller.enqueue(1)
1251
+ * controller.close()
1252
+ * }
1253
+ * }),
1254
+ * onError: (cause) => new Error(String(cause))
1255
+ * })
1256
+ *
1257
+ * await Effect.runPromise(Channel.runCollect(channel)) // => [[1]]
1258
+ * ```
1259
+ *
1260
+ * @category constructors
1261
+ * @since 4.0.0
1262
+ */
1263
+ export const fromReadableStream = options => fromTransform((_, scope) => readableStreamToPullUnsafe({
1264
+ scope,
1265
+ readable: options.evaluate(),
1266
+ onError: options.onError,
1267
+ releaseLockOnEnd: options.releaseLockOnEnd
1268
+ }));
1269
+ /** @internal */
1270
+ export const pullIntoWritableStream = options => Effect.acquireUseRelease(Effect.sync(() => options.writable.getWriter()), writer => {
1271
+ const loop = options.pull.pipe(Effect.flatMap(chunk => Effect.forEach(chunk, value => Effect.tryPromise({
1272
+ try: () => writer.ready.then(() => writer.write(value)),
1273
+ catch: options.onError
1274
+ }), {
1275
+ discard: true
1276
+ })), Effect.forever({
1277
+ disableYield: true
1278
+ }));
1279
+ const withClose = options.closeOnDone !== false ? Pull.catchDone(loop, done => Effect.andThen(Effect.tryPromise({
1280
+ try: () => writer.close(),
1281
+ catch: options.onError
1282
+ }), Cause.done(done))) : loop;
1283
+ return Effect.onError(withClose, cause => Pull.isDoneCause(cause) ? Effect.void : Effect.promise(() => writer.abort(cause).catch(constVoid)));
1284
+ }, writer => Effect.sync(() => writer.releaseLock()));
1285
+ /**
1286
+ * Creates a channel that writes upstream values to a lazily supplied Web
1287
+ * `WritableStream`.
1288
+ *
1289
+ * **Example** (Writing channel input)
1290
+ *
1291
+ * ```ts import.meta.vitest
1292
+ * import { Channel, Effect } from "effect"
1293
+ *
1294
+ * const written: Array<number> = []
1295
+ * const sink = Channel.fromWritableStream<never, Error, number>({
1296
+ * evaluate: () => new WritableStream({
1297
+ * write(value) {
1298
+ * written.push(value)
1299
+ * }
1300
+ * }),
1301
+ * onError: (cause) => new Error(String(cause))
1302
+ * })
1303
+ *
1304
+ * const program = Channel.fromArray([[1, 2] as [number, number]]).pipe(
1305
+ * Channel.pipeTo(sink),
1306
+ * Channel.runDrain
1307
+ * )
1308
+ *
1309
+ * await Effect.runPromise(program)
1310
+ * written // => [1, 2]
1311
+ * ```
1312
+ *
1313
+ * @category constructors
1314
+ * @since 4.0.0
1315
+ */
1316
+ export const fromWritableStream = options => fromTransform(pull => {
1317
+ const writable = options.evaluate();
1318
+ return Effect.succeed(pullIntoWritableStream({
1319
+ ...options,
1320
+ writable,
1321
+ pull
1322
+ }));
1323
+ });
1324
+ /**
1325
+ * Creates a channel backed by a Web `TransformStream`, writing upstream values
1326
+ * while emitting transformed values from its readable side.
1327
+ *
1328
+ * **Example** (Transforming channel input)
1329
+ *
1330
+ * ```ts import.meta.vitest
1331
+ * import { Channel, Effect } from "effect"
1332
+ *
1333
+ * const transform = Channel.fromTransformStream<never, number, number, Error>({
1334
+ * evaluate: () => new TransformStream({
1335
+ * transform(value, controller) {
1336
+ * controller.enqueue(value * 2)
1337
+ * }
1338
+ * }),
1339
+ * onError: (cause) => new Error(String(cause))
1340
+ * })
1341
+ *
1342
+ * const program = Channel.fromArray([[1, 2] as [number, number]]).pipe(
1343
+ * Channel.pipeTo(transform),
1344
+ * Channel.runCollect
1345
+ * )
1346
+ *
1347
+ * await Effect.runPromise(program) // => [[2], [4]]
1348
+ * ```
1349
+ *
1350
+ * @category constructors
1351
+ * @since 4.0.0
1352
+ */
1353
+ export const fromTransformStream = options => fromTransform((upstream, scope) => {
1354
+ const transform = options.evaluate();
1355
+ const exit = MutableRef.make(undefined);
1356
+ return pullIntoWritableStream({
1357
+ pull: upstream,
1358
+ writable: transform.writable,
1359
+ onError: options.onError,
1360
+ closeOnDone: options.closeOnDone
1361
+ }).pipe(Effect.catchCause(cause => {
1362
+ if (!Pull.isDoneCause(cause)) {
1363
+ exit.current = Exit.failCause(cause);
1364
+ }
1365
+ return Effect.void;
1366
+ }), Effect.forkIn(scope), Effect.flatMap(() => readableStreamToPullUnsafe({
1367
+ scope,
1368
+ exit,
1369
+ readable: transform.readable,
1370
+ onError: options.onError,
1371
+ releaseLockOnEnd: options.releaseLockOnEnd
1372
+ })));
1373
+ });
1374
+ const readableStreamToPullUnsafe = options => {
1375
+ const reader = options.readable.getReader();
1376
+ const exit = options.exit ?? MutableRef.make(undefined);
1377
+ const pull = Effect.suspend(() => {
1378
+ if (exit.current) return exit.current;
1379
+ return Effect.matchCauseEffect(Effect.tryPromise({
1380
+ try: () => reader.read(),
1381
+ catch: options.onError
1382
+ }), {
1383
+ onFailure: cause => exit.current ?? Effect.failCause(cause),
1384
+ onSuccess: ({
1385
+ done,
1386
+ value
1387
+ }) => {
1388
+ if (exit.current) return exit.current;
1389
+ return done ? Cause.done() : Effect.succeed(Arr.of(value));
1390
+ }
1391
+ });
1392
+ });
1393
+ return Effect.as(Scope.addFinalizer(options.scope, options.releaseLockOnEnd ? Effect.sync(() => reader.releaseLock()) : Effect.promise(() => reader.cancel().catch(constVoid))), pull);
1394
+ };
1285
1395
  /**
1286
1396
  * Creates a channel that pulls values from an `AsyncIterable`.
1287
1397
  *
@@ -1324,8 +1434,8 @@ export const fromAsyncIterableArray = (iterable, onError) => map(fromAsyncIterab
1324
1434
  *
1325
1435
  * **Example** (Mapping channel output)
1326
1436
  *
1327
- * ```ts
1328
- * import { Channel, Data } from "effect"
1437
+ * ```ts import.meta.vitest
1438
+ * import { Channel, Data, Effect } from "effect"
1329
1439
  *
1330
1440
  * class TransformError extends Data.TaggedError("TransformError")<{
1331
1441
  * readonly reason: string
@@ -1334,12 +1444,12 @@ export const fromAsyncIterableArray = (iterable, onError) => map(fromAsyncIterab
1334
1444
  * // Basic mapping of channel values
1335
1445
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
1336
1446
  * const doubledChannel = Channel.map(numbersChannel, (n) => n * 2)
1337
- * // Outputs: 2, 4, 6, 8, 10
1447
+ * Effect.runSync(Channel.runCollect(doubledChannel)) // => [2, 4, 6, 8, 10]
1338
1448
  *
1339
1449
  * // Transform string data
1340
1450
  * const wordsChannel = Channel.fromIterable(["hello", "world", "effect"])
1341
1451
  * const upperCaseChannel = Channel.map(wordsChannel, (word) => word.toUpperCase())
1342
- * // Outputs: "HELLO", "WORLD", "EFFECT"
1452
+ * Effect.runSync(Channel.runCollect(upperCaseChannel)) // => ["HELLO", "WORLD", "EFFECT"]
1343
1453
  *
1344
1454
  * // Complex object transformation
1345
1455
  * type User = { id: number; name: string }
@@ -1353,6 +1463,7 @@ export const fromAsyncIterableArray = (iterable, onError) => map(fromAsyncIterab
1353
1463
  * displayName: `User: ${user.name}`,
1354
1464
  * isActive: true
1355
1465
  * }))
1466
+ * Effect.runSync(Channel.runCollect(displayChannel)) // => [{ displayName: "User: Alice", isActive: true }, { displayName: "User: Bob", isActive: true }]
1356
1467
  * ```
1357
1468
  *
1358
1469
  * @category sequencing
@@ -1400,40 +1511,15 @@ const concurrencyIsSequential = concurrency => concurrency === undefined || conc
1400
1511
  *
1401
1512
  * **Example** (Mapping channel output with effects)
1402
1513
  *
1403
- * ```ts
1404
- * import { Channel, Data, Effect } from "effect"
1405
- *
1406
- * class NetworkError extends Data.TaggedError("NetworkError")<{
1407
- * readonly url: string
1408
- * }> {}
1409
- *
1410
- * // Transform values using effectful operations
1411
- * const urlsChannel = Channel.fromIterable([
1412
- * "/api/users/1",
1413
- * "/api/users/2",
1414
- * "/api/users/3"
1415
- * ])
1416
- *
1417
- * const fetchDataChannel = Channel.mapEffect(
1418
- * urlsChannel,
1419
- * (url) =>
1420
- * Effect.tryPromise({
1421
- * try: () => fetch(url).then((res) => res.json()),
1422
- * catch: () => new NetworkError({ url })
1423
- * })
1424
- * )
1514
+ * ```ts import.meta.vitest
1515
+ * import { Channel, Effect } from "effect"
1425
1516
  *
1426
- * // Concurrent processing with options
1427
1517
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
1428
1518
  * const processedChannel = Channel.mapEffect(
1429
1519
  * numbersChannel,
1430
- * (n) =>
1431
- * Effect.gen(function*() {
1432
- * yield* Effect.sleep("100 millis") // Simulate async work
1433
- * return n * n
1434
- * }),
1435
- * { concurrency: 3, unordered: true }
1520
+ * (n) => Effect.succeed(n * n)
1436
1521
  * )
1522
+ * await Effect.runPromise(Channel.runCollect(processedChannel)) // => [1, 4, 9, 16, 25]
1437
1523
  * ```
1438
1524
  *
1439
1525
  * @category sequencing
@@ -1523,8 +1609,8 @@ export const mapInputError = /*#__PURE__*/dual(2, (self, f) => fromTransform((up
1523
1609
  *
1524
1610
  * **Example** (Tapping channel output)
1525
1611
  *
1526
- * ```ts
1527
- * import { Channel, Console, Data } from "effect"
1612
+ * ```ts import.meta.vitest
1613
+ * import { Channel, Data, Effect } from "effect"
1528
1614
  *
1529
1615
  * class LogError extends Data.TaggedError("LogError")<{
1530
1616
  * readonly message: string
@@ -1534,13 +1620,13 @@ export const mapInputError = /*#__PURE__*/dual(2, (self, f) => fromTransform((up
1534
1620
  * const numberChannel = Channel.fromIterable([1, 2, 3])
1535
1621
  *
1536
1622
  * // Tap into each output element to perform side effects
1623
+ * const processed: Array<number> = []
1537
1624
  * const tappedChannel = Channel.tap(
1538
1625
  * numberChannel,
1539
- * (n) => Console.log(`Processing number: ${n}`)
1626
+ * (n) => Effect.sync(() => processed.push(n))
1540
1627
  * )
1541
1628
  *
1542
- * // The channel still outputs the same elements but logs each one
1543
- * // Outputs: 1, 2, 3 (while logging each)
1629
+ * const observed = [await Effect.runPromise(Channel.runCollect(tappedChannel)), processed] // => [[1, 2, 3], [1, 2, 3]]
1544
1630
  * ```
1545
1631
  *
1546
1632
  * @category sequencing
@@ -1560,8 +1646,8 @@ export const tap = /*#__PURE__*/dual(args => isChannel(args[0]), (self, f, optio
1560
1646
  *
1561
1647
  * **Example** (Flat mapping channel output)
1562
1648
  *
1563
- * ```ts
1564
- * import { Channel, Data } from "effect"
1649
+ * ```ts import.meta.vitest
1650
+ * import { Channel, Data, Effect } from "effect"
1565
1651
  *
1566
1652
  * class ProcessError extends Data.TaggedError("ProcessError")<{
1567
1653
  * readonly cause: string
@@ -1577,8 +1663,7 @@ export const tap = /*#__PURE__*/dual(args => isChannel(args[0]), (self, f, optio
1577
1663
  * Channel.fromIterable(Array.from({ length: n }, (_, i) => `item-${n}-${i}`))
1578
1664
  * )
1579
1665
  *
1580
- * // Flattens nested channels into a single stream
1581
- * // Outputs: "item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"
1666
+ * Effect.runSync(Channel.runCollect(flatMappedChannel)) // => ["item-1-0", "item-2-0", "item-2-1", "item-3-0", "item-3-1", "item-3-2"]
1582
1667
  * ```
1583
1668
  *
1584
1669
  * @category sequencing
@@ -1614,8 +1699,8 @@ const flatMapConcurrent = (self, f, options) => self.pipe(map(f), mergeAll(optio
1614
1699
  *
1615
1700
  * **Example** (Concatenating with completion values)
1616
1701
  *
1617
- * ```ts
1618
- * import { Channel, Data } from "effect"
1702
+ * ```ts import.meta.vitest
1703
+ * import { Channel, Data, Effect } from "effect"
1619
1704
  *
1620
1705
  * class ConcatError extends Data.TaggedError("ConcatError")<{
1621
1706
  * readonly reason: string
@@ -1626,8 +1711,7 @@ const flatMapConcurrent = (self, f, options) => self.pipe(map(f), mergeAll(optio
1626
1711
  * Channel.concatWith((sum: void) => Channel.succeed(`Completed processing`))
1627
1712
  * )
1628
1713
  *
1629
- * // Concatenates additional channel based on completion value
1630
- * // Outputs: 1, 2, 3, then "Completed processing"
1714
+ * Effect.runSync(Channel.runCollect(numberChannel)) // => [1, 2, 3, "Completed processing"]
1631
1715
  * ```
1632
1716
  *
1633
1717
  * @category sequencing
@@ -1653,8 +1737,8 @@ export const concatWith = /*#__PURE__*/dual(2, (self, f) => fromTransform((upstr
1653
1737
  *
1654
1738
  * **Example** (Concatenating channels)
1655
1739
  *
1656
- * ```ts
1657
- * import { Channel, Data } from "effect"
1740
+ * ```ts import.meta.vitest
1741
+ * import { Channel, Data, Effect } from "effect"
1658
1742
  *
1659
1743
  * class ConcatError extends Data.TaggedError("ConcatError")<{
1660
1744
  * readonly reason: string
@@ -1667,7 +1751,7 @@ export const concatWith = /*#__PURE__*/dual(2, (self, f) => fromTransform((upstr
1667
1751
  * // Concatenate them
1668
1752
  * const concatenatedChannel = Channel.concat(firstChannel, secondChannel)
1669
1753
  *
1670
- * // Outputs: 1, 2, 3, "a", "b", "c"
1754
+ * Effect.runSync(Channel.runCollect(concatenatedChannel)) // => [1, 2, 3, "a", "b", "c"]
1671
1755
  * ```
1672
1756
  *
1673
1757
  * @category sequencing
@@ -1737,8 +1821,8 @@ export const orElseIfEmpty = /*#__PURE__*/dual(2, (self, f) => fromTransform((up
1737
1821
  *
1738
1822
  * **Example** (Flattening nested channels)
1739
1823
  *
1740
- * ```ts
1741
- * import { Channel, Data } from "effect"
1824
+ * ```ts import.meta.vitest
1825
+ * import { Channel, Data, Effect } from "effect"
1742
1826
  *
1743
1827
  * class FlattenError extends Data.TaggedError("FlattenError")<{
1744
1828
  * readonly cause: string
@@ -1754,7 +1838,7 @@ export const orElseIfEmpty = /*#__PURE__*/dual(2, (self, f) => fromTransform((up
1754
1838
  * // Flatten the nested channels
1755
1839
  * const flattenedChannel = Channel.flatten(nestedChannels)
1756
1840
  *
1757
- * // Outputs: 1, 2, 3, 4, 5, 6
1841
+ * Effect.runSync(Channel.runCollect(flattenedChannel)) // => [1, 2, 3, 4, 5, 6]
1758
1842
  * ```
1759
1843
  *
1760
1844
  * @category constructors
@@ -1766,8 +1850,8 @@ export const flatten = channels => flatMap(channels, identity_);
1766
1850
  *
1767
1851
  * **Example** (Flattening arrays of channel output)
1768
1852
  *
1769
- * ```ts
1770
- * import { Channel, Data } from "effect"
1853
+ * ```ts import.meta.vitest
1854
+ * import { Channel, Data, Effect } from "effect"
1771
1855
  *
1772
1856
  * class FlattenError extends Data.TaggedError("FlattenError")<{
1773
1857
  * readonly message: string
@@ -1783,7 +1867,7 @@ export const flatten = channels => flatMap(channels, identity_);
1783
1867
  * // Flatten the arrays into individual elements
1784
1868
  * const flattenedChannel = Channel.flattenArray(arrayChannel)
1785
1869
  *
1786
- * // Outputs: 1, 2, 3, 4, 5, 6, 7, 8, 9
1870
+ * Effect.runSync(Channel.runCollect(flattenedChannel)) // => [1, 2, 3, 4, 5, 6, 7, 8, 9]
1787
1871
  * ```
1788
1872
  *
1789
1873
  * @category transforming
@@ -1836,8 +1920,8 @@ export const flattenTake = self => mapEffectSequential(self, Take.toPull);
1836
1920
  *
1837
1921
  * **Example** (Draining channel output)
1838
1922
  *
1839
- * ```ts
1840
- * import { Channel } from "effect"
1923
+ * ```ts import.meta.vitest
1924
+ * import { Channel, Effect } from "effect"
1841
1925
  *
1842
1926
  * // Create a channel that outputs values
1843
1927
  * const sourceChannel = Channel.fromIterable([1, 2, 3, 4, 5])
@@ -1845,8 +1929,7 @@ export const flattenTake = self => mapEffectSequential(self, Take.toPull);
1845
1929
  * // Drain all output, keeping only the completion
1846
1930
  * const drainedChannel = Channel.drain(sourceChannel)
1847
1931
  *
1848
- * // The channel completes but emits no values
1849
- * // Useful for consuming side effects without collecting output
1932
+ * Effect.runSync(Channel.runCollect(drainedChannel)) // => []
1850
1933
  * ```
1851
1934
  *
1852
1935
  * @category constructors
@@ -1900,15 +1983,15 @@ export const schedule = /*#__PURE__*/dual(2, (self, schedule) => transformPull(s
1900
1983
  *
1901
1984
  * **Example** (Filtering channel output)
1902
1985
  *
1903
- * ```ts
1904
- * import { Channel } from "effect"
1986
+ * ```ts import.meta.vitest
1987
+ * import { Channel, Effect } from "effect"
1905
1988
  *
1906
1989
  * // Create a channel with mixed numbers
1907
1990
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5, 6, 7, 8])
1908
1991
  *
1909
1992
  * // Filter to keep only even numbers
1910
1993
  * const evenChannel = Channel.filter(numbersChannel, (n) => n % 2 === 0)
1911
- * // Outputs: 2, 4, 6, 8
1994
+ * Effect.runSync(Channel.runCollect(evenChannel)) // => [2, 4, 6, 8]
1912
1995
  *
1913
1996
  * // Filter with type refinement
1914
1997
  * const mixedChannel = Channel.fromIterable([1, "hello", 2, "world", 3])
@@ -1916,7 +1999,7 @@ export const schedule = /*#__PURE__*/dual(2, (self, schedule) => transformPull(s
1916
1999
  * mixedChannel,
1917
2000
  * (value): value is number => typeof value === "number"
1918
2001
  * )
1919
- * // Outputs: 1, 2, 3 (all typed as numbers)
2002
+ * Effect.runSync(Channel.runCollect(numbersOnlyChannel)) // => [1, 2, 3]
1920
2003
  * ```
1921
2004
  *
1922
2005
  * @category filtering
@@ -2001,8 +2084,8 @@ export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromTransf
2001
2084
  *
2002
2085
  * **Example** (Filtering array output)
2003
2086
  *
2004
- * ```ts
2005
- * import { Array, Channel } from "effect"
2087
+ * ```ts import.meta.vitest
2088
+ * import { Array, Channel, Effect } from "effect"
2006
2089
  *
2007
2090
  * const nonEmptyArrayPredicate = Array.isReadonlyArrayNonEmpty
2008
2091
  *
@@ -2015,7 +2098,7 @@ export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromTransf
2015
2098
  *
2016
2099
  * // Filter arrays to keep only even numbers
2017
2100
  * const evenArraysChannel = Channel.filterArray(arrayChannel, (n) => n % 2 === 0)
2018
- * // Outputs: [2, 4], [6, 8, 10], [12, 14]
2101
+ * Effect.runSync(Channel.runCollect(evenArraysChannel)) // => [[2, 4], [6, 8, 10], [12, 14]]
2019
2102
  * // Note: Only non-empty filtered arrays are emitted
2020
2103
  *
2021
2104
  * // Arrays that would become empty after filtering are discarded entirely
@@ -2025,7 +2108,7 @@ export const filterMapEffect = /*#__PURE__*/dual(2, (self, filter) => fromTransf
2025
2108
  * Array.make(7, 9)
2026
2109
  * ]).pipe(Channel.filter(nonEmptyArrayPredicate))
2027
2110
  * const filteredOddChannel = Channel.filterArray(oddChannel, (n) => n % 2 === 0)
2028
- * // Outputs: [2, 4] (the arrays [1,3,5] and [7,9] are discarded)
2111
+ * Effect.runSync(Channel.runCollect(filteredOddChannel)) // => [[2, 4]]
2029
2112
  * ```
2030
2113
  *
2031
2114
  * @category filtering
@@ -2112,7 +2195,7 @@ export const filterMapArrayEffect = /*#__PURE__*/dual(2, (self, filter) => trans
2112
2195
  *
2113
2196
  * **Example** (Mapping with accumulated state)
2114
2197
  *
2115
- * ```ts
2198
+ * ```ts import.meta.vitest
2116
2199
  * import { Channel, Effect } from "effect"
2117
2200
  *
2118
2201
  * // Create a channel with numbers
@@ -2128,8 +2211,6 @@ export const filterMapArrayEffect = /*#__PURE__*/dual(2, (self, filter) => trans
2128
2211
  * return [newSum, [current, newSum]] as const
2129
2212
  * }
2130
2213
  * )
2131
- * // Outputs: 1, 1, 2, 3, 3, 6, 4, 10
2132
- *
2133
2214
  * // Using with Effect for async processing
2134
2215
  * const asyncMapAccum = Channel.mapAccum(
2135
2216
  * numbersChannel,
@@ -2140,6 +2221,8 @@ export const filterMapArrayEffect = /*#__PURE__*/dual(2, (self, filter) => trans
2140
2221
  * return [newAcc, [`${value}-processed`, newAcc]] as const
2141
2222
  * })
2142
2223
  * )
2224
+ * Effect.runSync(Channel.runCollect(runningSum)) // => [1, 1, 2, 3, 3, 6, 4, 10]
2225
+ * Effect.runSync(Channel.runCollect(asyncMapAccum)) // => ["1-processed", "1", "2-processed", "12", "3-processed", "123", "4-processed", "1234"]
2143
2226
  * ```
2144
2227
  *
2145
2228
  * @category sequencing
@@ -2190,15 +2273,15 @@ export const mapAccum = /*#__PURE__*/dual(args => isChannel(args[0]), (self, ini
2190
2273
  *
2191
2274
  * **Example** (Scanning channel output)
2192
2275
  *
2193
- * ```ts
2194
- * import { Channel } from "effect"
2276
+ * ```ts import.meta.vitest
2277
+ * import { Channel, Effect } from "effect"
2195
2278
  *
2196
2279
  * // Create a channel with numbers
2197
2280
  * const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
2198
2281
  *
2199
2282
  * // Scan to create running sum
2200
2283
  * const runningSumChannel = Channel.scan(numbersChannel, 0, (sum, n) => sum + n)
2201
- * // Outputs: 0, 1, 3, 6, 10, 15
2284
+ * Effect.runSync(Channel.runCollect(runningSumChannel)) // => [0, 1, 3, 6, 10, 15]
2202
2285
  * // Note: emits the initial value and each intermediate result
2203
2286
  *
2204
2287
  * // Scan with string concatenation
@@ -2208,7 +2291,7 @@ export const mapAccum = /*#__PURE__*/dual(args => isChannel(args[0]), (self, ini
2208
2291
  * "",
2209
2292
  * (sentence, word) => sentence === "" ? word : `${sentence} ${word}`
2210
2293
  * )
2211
- * // Outputs: "", "hello", "hello world", "hello world from", "hello world from effect"
2294
+ * Effect.runSync(Channel.runCollect(sentenceChannel)) // => ["", "hello", "hello world", "hello world from", "hello world from effect"]
2212
2295
  * ```
2213
2296
  *
2214
2297
  * @category sequencing
@@ -2226,7 +2309,7 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => scanEffect(self,
2226
2309
  *
2227
2310
  * **Example** (Scanning channel output with effects)
2228
2311
  *
2229
- * ```ts
2312
+ * ```ts import.meta.vitest
2230
2313
  * import { Channel, Data, Effect } from "effect"
2231
2314
  *
2232
2315
  * class ScanError extends Data.TaggedError("ScanError")<{
@@ -2242,12 +2325,10 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => scanEffect(self,
2242
2325
  * "",
2243
2326
  * (acc, value) =>
2244
2327
  * Effect.gen(function*() {
2245
- * // Simulate async work
2246
- * yield* Effect.sleep("10 millis")
2247
2328
  * return acc + value.toString()
2248
2329
  * })
2249
2330
  * )
2250
- * // Outputs: "", "1", "12", "123", "1234"
2331
+ * await Effect.runPromise(Channel.runCollect(asyncScanChannel)) // => ["", "1", "12", "123", "1234"]
2251
2332
  *
2252
2333
  * // Scan with error handling
2253
2334
  * const errorHandlingScan = Channel.scanEffect(
@@ -2260,6 +2341,7 @@ export const scan = /*#__PURE__*/dual(3, (self, initial, f) => scanEffect(self,
2260
2341
  * return Effect.succeed(sum + n)
2261
2342
  * }
2262
2343
  * )
2344
+ * await Effect.runPromise(Channel.runCollect(errorHandlingScan)) // => [0, 1, 3, 6, 10]
2263
2345
  * ```
2264
2346
  *
2265
2347
  * @category sequencing
@@ -2285,8 +2367,8 @@ export const scanEffect = /*#__PURE__*/dual(3, (self, initial, f) => fromTransfo
2285
2367
  *
2286
2368
  * **Example** (Recovering from failure causes)
2287
2369
  *
2288
- * ```ts
2289
- * import { Cause, Channel, Data } from "effect"
2370
+ * ```ts import.meta.vitest
2371
+ * import { Cause, Channel, Data, Effect } from "effect"
2290
2372
  *
2291
2373
  * class ProcessError extends Data.TaggedError("ProcessError")<{
2292
2374
  * readonly reason: string
@@ -2309,7 +2391,7 @@ export const scanEffect = /*#__PURE__*/dual(3, (self, initial, f) => fromTransfo
2309
2391
  * return Channel.succeed("Recovered from interruption")
2310
2392
  * })
2311
2393
  *
2312
- * // The channel recovers gracefully from errors
2394
+ * Effect.runSync(Channel.runCollect(recoveredChannel)) // => ["Recovered from failure"]
2313
2395
  * ```
2314
2396
  *
2315
2397
  * @category error handling
@@ -2494,8 +2576,8 @@ export const catchTag = /*#__PURE__*/dual(args => isChannel(args[0]), (self, k,
2494
2576
  *
2495
2577
  * **Example** (Recovering from nested reasons)
2496
2578
  *
2497
- * ```ts
2498
- * import { Channel, Data } from "effect"
2579
+ * ```ts import.meta.vitest
2580
+ * import { Channel, Data, Effect } from "effect"
2499
2581
  *
2500
2582
  * class RateLimitError extends Data.TaggedError("RateLimitError")<{
2501
2583
  * retryAfter: number
@@ -2509,15 +2591,15 @@ export const catchTag = /*#__PURE__*/dual(args => isChannel(args[0]), (self, k,
2509
2591
  * reason: RateLimitError | QuotaExceededError
2510
2592
  * }> {}
2511
2593
  *
2512
- * const channel = Channel.fail(
2513
- * new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
2514
- * )
2594
+ * const reason = new RateLimitError({ retryAfter: 60 })
2595
+ * const channel = Channel.fail(new AiError({ reason }))
2515
2596
  *
2516
2597
  * const recovered = channel.pipe(
2517
2598
  * Channel.catchReason("AiError", "RateLimitError", (reason) =>
2518
2599
  * Channel.succeed(`retry: ${reason.retryAfter}`)
2519
2600
  * )
2520
2601
  * )
2602
+ * Effect.runSync(Channel.runCollect(recovered)) // => ["retry: 60"]
2521
2603
  * ```
2522
2604
  *
2523
2605
  * @category error handling
@@ -2558,8 +2640,8 @@ export const catchReasons = /*#__PURE__*/dual(args => isChannel(args[0]), (self,
2558
2640
  *
2559
2641
  * **Example** (Promoting nested reasons)
2560
2642
  *
2561
- * ```ts
2562
- * import { Channel, Data } from "effect"
2643
+ * ```ts import.meta.vitest
2644
+ * import { Channel, Data, Effect, Exit } from "effect"
2563
2645
  *
2564
2646
  * class RateLimitError extends Data.TaggedError("RateLimitError")<{
2565
2647
  * retryAfter: number
@@ -2573,11 +2655,11 @@ export const catchReasons = /*#__PURE__*/dual(args => isChannel(args[0]), (self,
2573
2655
  * reason: RateLimitError | QuotaExceededError
2574
2656
  * }> {}
2575
2657
  *
2576
- * const channel = Channel.fail(
2577
- * new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
2578
- * )
2658
+ * const reason = new RateLimitError({ retryAfter: 60 })
2659
+ * const channel = Channel.fail(new AiError({ reason }))
2579
2660
  *
2580
2661
  * const unwrapped = channel.pipe(Channel.unwrapReason("AiError"))
2662
+ * Effect.runSync(Effect.exit(Channel.runCollect(unwrapped))) // => Exit.fail(reason)
2581
2663
  * ```
2582
2664
  *
2583
2665
  * @category error handling
@@ -2599,20 +2681,21 @@ export const mapError = /*#__PURE__*/dual(2, (self, f) => catch_(self, err => fa
2599
2681
  *
2600
2682
  * **Example** (Converting failures to defects)
2601
2683
  *
2602
- * ```ts
2603
- * import { Channel, Data } from "effect"
2684
+ * ```ts import.meta.vitest
2685
+ * import { Cause, Channel, Data, Effect, Exit } from "effect"
2604
2686
  *
2605
2687
  * class ValidationError extends Data.TaggedError("ValidationError")<{
2606
2688
  * readonly field: string
2607
2689
  * }> {}
2608
2690
  *
2609
2691
  * // Create a channel that might fail
2610
- * const failingChannel = Channel.fail(new ValidationError({ field: "email" }))
2692
+ * const error = new ValidationError({ field: "email" })
2693
+ * const failingChannel = Channel.fail(error)
2611
2694
  *
2612
2695
  * // Convert failures to defects
2613
2696
  * const fatalChannel = Channel.orDie(failingChannel)
2614
2697
  *
2615
- * // Any failure will now become a defect (uncaught exception)
2698
+ * Effect.runSync(Effect.exit(Channel.runCollect(fatalChannel))) // => Exit.failCause(Cause.die(error))
2616
2699
  * ```
2617
2700
  *
2618
2701
  * @category error handling
@@ -2694,8 +2777,8 @@ export const retry = /*#__PURE__*/dual(2, (self, schedule) => suspend(() => {
2694
2777
  *
2695
2778
  * **Example** (Switching mapped channels)
2696
2779
  *
2697
- * ```ts
2698
- * import { Channel, Data } from "effect"
2780
+ * ```ts import.meta.vitest
2781
+ * import { Channel, Data, Effect } from "effect"
2699
2782
  *
2700
2783
  * class SwitchError extends Data.TaggedError("SwitchError")<{
2701
2784
  * readonly reason: string
@@ -2710,7 +2793,7 @@ export const retry = /*#__PURE__*/dual(2, (self, schedule) => suspend(() => {
2710
2793
  * (n) => Channel.fromIterable([`value-${n}`])
2711
2794
  * )
2712
2795
  *
2713
- * // Outputs: "value-1", "value-2", "value-3"
2796
+ * await Effect.runPromise(Channel.runCollect(switchedChannel)) // => ["value-3"]
2714
2797
  * ```
2715
2798
  *
2716
2799
  * @category sequencing
@@ -2731,8 +2814,8 @@ export const switchMap = /*#__PURE__*/dual(args => isChannel(args[0]), (self, f,
2731
2814
  *
2732
2815
  * **Example** (Merging nested channels)
2733
2816
  *
2734
- * ```ts
2735
- * import { Channel, Data } from "effect"
2817
+ * ```ts import.meta.vitest
2818
+ * import { Channel, Data, Effect } from "effect"
2736
2819
  *
2737
2820
  * class MergeAllError extends Data.TaggedError("MergeAllError")<{
2738
2821
  * readonly reason: string
@@ -2747,11 +2830,11 @@ export const switchMap = /*#__PURE__*/dual(args => isChannel(args[0]), (self, f,
2747
2830
  *
2748
2831
  * // Merge all channels with bounded concurrency
2749
2832
  * const mergedChannel = Channel.mergeAll({
2750
- * concurrency: 2,
2833
+ * concurrency: 1,
2751
2834
  * bufferSize: 16
2752
2835
  * })(nestedChannels)
2753
2836
  *
2754
- * // Outputs: 1, 2, 3, 4, 5, 6 (order may vary due to concurrency)
2837
+ * await Effect.runPromise(Channel.runCollect(mergedChannel)) // => [1, 2, 3, 4, 5, 6]
2755
2838
  * ```
2756
2839
  *
2757
2840
  * @category combining
@@ -2771,8 +2854,16 @@ export const mergeAll = /*#__PURE__*/dual(2, (channels, {
2771
2854
  const pull = yield* toTransform(channels)(upstream, scope);
2772
2855
  yield* Effect.gen(function* () {
2773
2856
  while (true) {
2774
- if (semaphore) yield* semaphore.take(1);
2775
- const channel = yield* pull;
2857
+ let pullFiber;
2858
+ if (semaphore) {
2859
+ if (fibers.size < concurrencyN) {
2860
+ yield* semaphore.take(1);
2861
+ } else {
2862
+ pullFiber = yield* Effect.forkChild(pull);
2863
+ yield* Effect.raceFirst(semaphore.take(1), Effect.andThen(Fiber.join(pullFiber), Effect.never));
2864
+ }
2865
+ }
2866
+ const channel = pullFiber === undefined ? yield* pull : yield* Fiber.join(pullFiber);
2776
2867
  const childScope = Scope.forkUnsafe(forkedScope);
2777
2868
  const childPull = yield* toTransform(channel)(upstream, childScope);
2778
2869
  while (fibers.size >= concurrencyN) {
@@ -2796,7 +2887,13 @@ export const mergeAll = /*#__PURE__*/dual(2, (channels, {
2796
2887
  doneLatch.closeUnsafe();
2797
2888
  fibers.add(fiber);
2798
2889
  }
2799
- }).pipe(Effect.catchCause(cause => doneLatch.whenOpen(Queue.failCause(queue, cause))), Effect.forkIn(forkedScope));
2890
+ }).pipe(Effect.catchCause(cause => {
2891
+ const halt = Pull.filterDone(cause);
2892
+ if (Result.isSuccess(halt)) {
2893
+ return doneLatch.whenOpen(Queue.failCause(queue, cause));
2894
+ }
2895
+ return Queue.failCause(queue, cause);
2896
+ }), Effect.forkIn(forkedScope));
2800
2897
  return Queue.take(queue);
2801
2898
  })));
2802
2899
  /**
@@ -2805,24 +2902,18 @@ export const mergeAll = /*#__PURE__*/dual(2, (channels, {
2805
2902
  *
2806
2903
  * **Example** (Merging channels)
2807
2904
  *
2808
- * ```ts
2809
- * import { Channel, Data } from "effect"
2810
- *
2811
- * class MergeError extends Data.TaggedError("MergeError")<{
2812
- * readonly source: string
2813
- * }> {}
2905
+ * ```ts import.meta.vitest
2906
+ * import { Channel, Effect } from "effect"
2814
2907
  *
2815
2908
  * // Create two channels
2816
2909
  * const leftChannel = Channel.fromIterable([1, 2, 3])
2817
2910
  * const rightChannel = Channel.fromIterable(["a", "b", "c"])
2818
2911
  *
2819
- * // Merge them with "either" halt strategy
2820
- * const mergedChannel = Channel.merge(leftChannel, rightChannel, {
2821
- * haltStrategy: "either"
2822
- * })
2912
+ * // The default "both" strategy waits for both channels to complete
2913
+ * const mergedChannel = Channel.merge(leftChannel, rightChannel)
2823
2914
  *
2824
- * // Outputs elements from both channels concurrently
2825
- * // Order may vary: 1, "a", 2, "b", 3, "c"
2915
+ * const values = await Effect.runPromise(Channel.runCollect(mergedChannel))
2916
+ * values.map(String).sort() // => ["1", "2", "3", "a", "b", "c"]
2826
2917
  * ```
2827
2918
  *
2828
2919
  * @category combining
@@ -2893,19 +2984,16 @@ export const mergeEffect = /*#__PURE__*/dual(2, (self, effect) => merge(self, fr
2893
2984
  *
2894
2985
  * **Example** (Splitting string chunks into lines)
2895
2986
  *
2896
- * ```ts
2987
+ * ```ts import.meta.vitest
2897
2988
  * import { Effect, Stream } from "effect"
2898
2989
  *
2899
- * Effect.runPromise(Effect.gen(function*() {
2900
- * const result = yield* Stream.runCollect(
2901
- * Stream.splitLines(Stream.make("hel", "lo\r\nwor", "ld\n"))
2902
- * )
2903
- * console.log(result)
2904
- * // [ 'hello', 'world' ]
2905
- * }))
2990
+ * const result = await Effect.runPromise(Stream.runCollect(
2991
+ * Stream.splitLines(Stream.make("hel", "lo\r\nwor", "ld\n"))
2992
+ * ))
2993
+ * result // => ["hello", "world"]
2906
2994
  * ```
2907
2995
  *
2908
- * @category String manipulation
2996
+ * @category splitting
2909
2997
  * @since 2.0.0
2910
2998
  */
2911
2999
  export const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(() => {
@@ -3002,7 +3090,7 @@ export const splitLines = () => fromTransform((upstream, _scope) => Effect.sync(
3002
3090
  * span `Uint8Array` boundaries. The optional `encoding` and `options` are
3003
3091
  * passed to `TextDecoder`.
3004
3092
  *
3005
- * @category String manipulation
3093
+ * @category decoding
3006
3094
  * @since 4.0.0
3007
3095
  */
3008
3096
  export const decodeText = (encoding, options) => fromTransform((upstream, _scope) => Effect.sync(() => {
@@ -3019,7 +3107,7 @@ export const decodeText = (encoding, options) => fromTransform((upstream, _scope
3019
3107
  *
3020
3108
  * Each string inside an emitted array is encoded independently.
3021
3109
  *
3022
- * @category String manipulation
3110
+ * @category encoding
3023
3111
  * @since 4.0.0
3024
3112
  */
3025
3113
  export const encodeText = () => fromTransform((upstream, _scope) => Effect.sync(() => {
@@ -3034,8 +3122,8 @@ export const encodeText = () => fromTransform((upstream, _scope) => Effect.sync(
3034
3122
  *
3035
3123
  * **Example** (Piping one channel into another)
3036
3124
  *
3037
- * ```ts
3038
- * import { Channel, Data } from "effect"
3125
+ * ```ts import.meta.vitest
3126
+ * import { Channel, Data, Effect } from "effect"
3039
3127
  *
3040
3128
  * class PipeError extends Data.TaggedError("PipeError")<{
3041
3129
  * readonly stage: string
@@ -3048,7 +3136,7 @@ export const encodeText = () => fromTransform((upstream, _scope) => Effect.sync(
3048
3136
  * // Pipe the source into the transform
3049
3137
  * const pipedChannel = Channel.pipeTo(sourceChannel, transformChannel)
3050
3138
  *
3051
- * // Outputs: 2, 4, 6
3139
+ * Effect.runSync(Channel.runCollect(pipedChannel)) // => [2, 4, 6]
3052
3140
  * ```
3053
3141
  *
3054
3142
  * @category sequencing
@@ -3062,21 +3150,22 @@ export const pipeTo = /*#__PURE__*/dual(2, (self, that) => fromTransform((upstre
3062
3150
  *
3063
3151
  * **Example** (Piping while preserving failures)
3064
3152
  *
3065
- * ```ts
3066
- * import { Channel, Data } from "effect"
3153
+ * ```ts import.meta.vitest
3154
+ * import { Channel, Data, Effect, Exit } from "effect"
3067
3155
  *
3068
3156
  * class SourceError extends Data.TaggedError("SourceError")<{
3069
3157
  * readonly code: number
3070
3158
  * }> {}
3071
3159
  *
3072
3160
  * // Create a failing source channel
3073
- * const failingSource = Channel.fail(new SourceError({ code: 404 }))
3074
- * const safeTransform = Channel.succeed("transformed")
3161
+ * const error = new SourceError({ code: 404 })
3162
+ * const failingSource = Channel.fail(error)
3163
+ * const safeTransform = Channel.identity<never, never, never>()
3075
3164
  *
3076
3165
  * // Pipe while preserving source failures
3077
3166
  * const safePipedChannel = Channel.pipeToOrFail(failingSource, safeTransform)
3078
3167
  *
3079
- * // Source errors are preserved and not sent to transform channel
3168
+ * Effect.runSync(Effect.exit(Channel.runCollect(safePipedChannel))) // => Exit.fail(error)
3080
3169
  * ```
3081
3170
  *
3082
3171
  * @category sequencing
@@ -3092,7 +3181,7 @@ export const pipeToOrFail = /*#__PURE__*/dual(2, (self, that) => fromTransform((
3092
3181
  *
3093
3182
  * **Example** (Unwrapping channel effects)
3094
3183
  *
3095
- * ```ts
3184
+ * ```ts import.meta.vitest
3096
3185
  * import { Channel, Data, Effect } from "effect"
3097
3186
  *
3098
3187
  * class UnwrapError extends Data.TaggedError("UnwrapError")<{
@@ -3107,7 +3196,7 @@ export const pipeToOrFail = /*#__PURE__*/dual(2, (self, that) => fromTransform((
3107
3196
  * // Unwrap the effect to get the channel
3108
3197
  * const unwrappedChannel = Channel.unwrap(channelEffect)
3109
3198
  *
3110
- * // The resulting channel outputs: 1, 2, 3
3199
+ * Effect.runSync(Channel.runCollect(unwrappedChannel)) // => [1, 2, 3]
3111
3200
  * ```
3112
3201
  *
3113
3202
  * @category constructors
@@ -3139,7 +3228,7 @@ export const scoped = self => fromTransformBracket((upstream, scope, forkedScope
3139
3228
  *
3140
3229
  * **Example** (Embedding custom input handling)
3141
3230
  *
3142
- * ```ts
3231
+ * ```ts import.meta.vitest
3143
3232
  * import { Channel, Effect } from "effect"
3144
3233
  *
3145
3234
  * // Create a base channel
@@ -3150,13 +3239,11 @@ export const scoped = self => fromTransformBracket((upstream, scope, forkedScope
3150
3239
  * baseChannel,
3151
3240
  * (upstream) =>
3152
3241
  * upstream.pipe(
3153
- * Effect.tap((message) =>
3154
- * Effect.sync(() => console.log(message))
3155
- * ),
3156
3242
  * Effect.forever,
3157
3243
  * Effect.ignore
3158
3244
  * )
3159
3245
  * )
3246
+ * await Effect.runPromise(Channel.runCollect(embeddedChannel)) // => [1, 2, 3]
3160
3247
  * ```
3161
3248
  *
3162
3249
  * @category sequencing
@@ -3185,7 +3272,7 @@ export const embedInput = /*#__PURE__*/dual(2, (self, input) => fromTransformBra
3185
3272
  *
3186
3273
  * @see {@link bufferArray} for buffering elements from array outputs
3187
3274
  *
3188
- * @category Buffering
3275
+ * @category buffering
3189
3276
  * @since 2.0.0
3190
3277
  */
3191
3278
  export const buffer = /*#__PURE__*/dual(2, (self, options) => fromTransform(Effect.fnUntraced(function* (upstream, scope) {
@@ -3224,7 +3311,7 @@ export const buffer = /*#__PURE__*/dual(2, (self, options) => fromTransform(Effe
3224
3311
  *
3225
3312
  * @see {@link buffer} for buffering output elements without flattening arrays
3226
3313
  *
3227
- * @category Buffering
3314
+ * @category buffering
3228
3315
  * @since 4.0.0
3229
3316
  */
3230
3317
  export const bufferArray = /*#__PURE__*/dual(2, (self, options) => fromTransform(Effect.fnUntraced(function* (upstream, scope) {
@@ -3274,12 +3361,16 @@ export const interruptWhen = /*#__PURE__*/dual(2, (self, effect) => merge(self,
3274
3361
  */
3275
3362
  export const haltWhen = /*#__PURE__*/dual(2, (self, effect) => fromTransformBracket(Effect.fnUntraced(function* (upstream, scope, forkedScope) {
3276
3363
  const pull = yield* toTransform(self)(upstream, scope);
3277
- let haltCause = undefined;
3278
- yield* effect.pipe(Effect.catchCause(cause => {
3279
- haltCause = cause;
3280
- return Effect.void;
3281
- }), Effect.forkIn(forkedScope));
3282
- return Effect.suspend(() => haltCause ? Effect.failCause(haltCause) : pull);
3364
+ const fiber = yield* Effect.forkIn(effect, forkedScope, {
3365
+ startImmediately: true
3366
+ });
3367
+ return Effect.suspend(() => {
3368
+ const exit = fiber.pollUnsafe();
3369
+ return exit === undefined ? pull : Exit.match(exit, {
3370
+ onFailure: Effect.failCause,
3371
+ onSuccess: Cause.done
3372
+ });
3373
+ });
3283
3374
  })));
3284
3375
  /**
3285
3376
  * Attaches a finalizer that runs only when the channel exits with failure.
@@ -3299,8 +3390,8 @@ export const onError = /*#__PURE__*/dual(2, (self, finalizer) => onExit(self, ex
3299
3390
  *
3300
3391
  * **Example** (Running exit finalizers)
3301
3392
  *
3302
- * ```ts
3303
- * import { Channel, Console, Data, Exit } from "effect"
3393
+ * ```ts import.meta.vitest
3394
+ * import { Channel, Data, Effect, Exit } from "effect"
3304
3395
  *
3305
3396
  * class ExitError extends Data.TaggedError("ExitError")<{
3306
3397
  * readonly stage: string
@@ -3310,13 +3401,12 @@ export const onError = /*#__PURE__*/dual(2, (self, finalizer) => onExit(self, ex
3310
3401
  * const dataChannel = Channel.fromIterable([1, 2, 3])
3311
3402
  *
3312
3403
  * // Attach exit handler
3404
+ * const exits: Array<Exit.Exit<void, ExitError>> = []
3313
3405
  * const channelWithExit = Channel.onExit(dataChannel, (exit) => {
3314
- * if (Exit.isSuccess(exit)) {
3315
- * return Console.log(`Channel completed successfully with: ${exit.value}`)
3316
- * } else {
3317
- * return Console.log(`Channel failed with: ${exit.cause}`)
3318
- * }
3406
+ * exits.push(exit)
3407
+ * return Effect.void
3319
3408
  * })
3409
+ * const observed = [await Effect.runPromise(Channel.runCollect(channelWithExit)), exits] // => [[1, 2, 3], [Exit.void]]
3320
3410
  * ```
3321
3411
  *
3322
3412
  * @category resource management
@@ -3379,8 +3469,8 @@ export const onEnd = /*#__PURE__*/dual(2, (self, onEnd) => transformPull(self, p
3379
3469
  *
3380
3470
  * **Example** (Ensuring cleanup runs)
3381
3471
  *
3382
- * ```ts
3383
- * import { Channel, Console, Data } from "effect"
3472
+ * ```ts import.meta.vitest
3473
+ * import { Channel, Data, Effect } from "effect"
3384
3474
  *
3385
3475
  * class EnsureError extends Data.TaggedError("EnsureError")<{
3386
3476
  * readonly operation: string
@@ -3390,10 +3480,12 @@ export const onEnd = /*#__PURE__*/dual(2, (self, onEnd) => transformPull(self, p
3390
3480
  * const dataChannel = Channel.fromIterable([1, 2, 3])
3391
3481
  *
3392
3482
  * // Ensure cleanup always runs
3483
+ * const events: Array<string> = []
3393
3484
  * const channelWithCleanup = Channel.ensuring(
3394
3485
  * dataChannel,
3395
- * Console.log("Cleanup executed regardless of success or failure")
3486
+ * Effect.sync(() => events.push("cleanup"))
3396
3487
  * )
3488
+ * const observed = [await Effect.runPromise(Channel.runCollect(channelWithCleanup)), events] // => [[1, 2, 3], ["cleanup"]]
3397
3489
  * ```
3398
3490
  *
3399
3491
  * @category resource management
@@ -3408,7 +3500,7 @@ const runWith = (self, f, onHalt) => Effect.suspend(() => {
3408
3500
  /**
3409
3501
  * Creates a channel from the specified services.
3410
3502
  *
3411
- * @category services
3503
+ * @category accessors
3412
3504
  * @since 2.0.0
3413
3505
  */
3414
3506
  export const contextWith = f => fromTransform((upstream, scope) => Effect.contextWith(context => toTransform(f(context))(upstream, scope)));
@@ -3416,7 +3508,7 @@ export const contextWith = f => fromTransform((upstream, scope) => Effect.contex
3416
3508
  * Provides a `Context` to the channel, removing the corresponding service
3417
3509
  * requirements from the returned channel.
3418
3510
  *
3419
- * @category services
3511
+ * @category providing services
3420
3512
  * @since 2.0.0
3421
3513
  */
3422
3514
  export const provideContext = /*#__PURE__*/dual(2, (self, context) => fromTransform((upstream, scope) => Effect.map(Effect.provideContext(toTransform(self)(upstream, scope), context), Effect.provideContext(context))));
@@ -3424,7 +3516,7 @@ export const provideContext = /*#__PURE__*/dual(2, (self, context) => fromTransf
3424
3516
  * Provides a concrete service for a context key, removing that service
3425
3517
  * requirement from the returned channel.
3426
3518
  *
3427
- * @category services
3519
+ * @category providing services
3428
3520
  * @since 2.0.0
3429
3521
  */
3430
3522
  export const provideService = /*#__PURE__*/dual(3, (self, key, service) => fromTransform((upstream, scope) => Effect.map(Effect.provideService(toTransform(self)(upstream, scope), key, service), Effect.provideService(key, service))));
@@ -3441,7 +3533,7 @@ export const provideService = /*#__PURE__*/dual(3, (self, key, service) => fromT
3441
3533
  * If the service effect fails, the returned channel fails. The provided service
3442
3534
  * removes the corresponding service requirement from the returned channel.
3443
3535
  *
3444
- * @category services
3536
+ * @category providing services
3445
3537
  * @since 4.0.0
3446
3538
  */
3447
3539
  export const provideServiceEffect = /*#__PURE__*/dual(3, (self, key, service) => fromTransform((upstream, scope) => Effect.flatMap(service, s => toTransform(provideService(self, key, s))(upstream, scope))));
@@ -3455,7 +3547,7 @@ export const provideServiceEffect = /*#__PURE__*/dual(3, (self, key, service) =>
3455
3547
  * builds the layer in the channel scope. Use `options.local` to build a fresh
3456
3548
  * layer instance for this provision.
3457
3549
  *
3458
- * @category services
3550
+ * @category providing services
3459
3551
  * @since 4.0.0
3460
3552
  */
3461
3553
  export const provide = /*#__PURE__*/dual(args => isChannel(args[0]), (self, layer, options) => Context.isContext(layer) ? provideContext(self, layer) : fromTransform((upstream, scope) => Effect.flatMap(options?.local ? Layer.buildWithMemoMap(layer, Layer.makeMemoMapUnsafe(), scope) : Layer.buildWithScope(layer, scope), context => Effect.map(Effect.provideContext(toTransform(self)(upstream, scope), context), Effect.provideContext(context)))));
@@ -3468,7 +3560,7 @@ export const provide = /*#__PURE__*/dual(args => isChannel(args[0]), (self, laye
3468
3560
  * provide to the channel. The returned channel requires the services needed to
3469
3561
  * build that context.
3470
3562
  *
3471
- * @category services
3563
+ * @category providing services
3472
3564
  * @since 4.0.0
3473
3565
  */
3474
3566
  export const updateContext = /*#__PURE__*/dual(2, (self, f) => fromTransform((upstream, scope) => Effect.contextWith(context => {
@@ -3483,7 +3575,7 @@ export const updateContext = /*#__PURE__*/dual(2, (self, f) => fromTransform((up
3483
3575
  * The existing service is read from the context. The updated service is
3484
3576
  * provided to the channel under the same key.
3485
3577
  *
3486
- * @category services
3578
+ * @category providing services
3487
3579
  * @since 2.0.0
3488
3580
  */
3489
3581
  export const updateService = /*#__PURE__*/dual(3, (self, service, f) => updateContext(self, context => Context.add(context, service, f(Context.get(context, service)))));
@@ -3516,7 +3608,7 @@ const withSpanImpl = (self, name, options) => acquireUseRelease(Effect.makeSpan(
3516
3608
  /**
3517
3609
  * The starting channel for Do notation, emitting an empty object.
3518
3610
  *
3519
- * @category do notation
3611
+ * @category constructors
3520
3612
  * @since 4.0.0
3521
3613
  */
3522
3614
  export const Do = /*#__PURE__*/succeed({});
@@ -3528,7 +3620,7 @@ export {
3528
3620
  /**
3529
3621
  * Adds a computed field to each object emitted by a channel.
3530
3622
  *
3531
- * @category do notation
3623
+ * @category mapping
3532
3624
  * @since 4.0.0
3533
3625
  */
3534
3626
  let_ as let };
@@ -3542,7 +3634,7 @@ let_ as let };
3542
3634
  * channel's output becomes the value of the new field. `options.concurrency`
3543
3635
  * and `options.bufferSize` control how derived channels are flattened.
3544
3636
  *
3545
- * @category do notation
3637
+ * @category sequencing
3546
3638
  * @since 4.0.0
3547
3639
  */
3548
3640
  export const bind = /*#__PURE__*/dual(args => isChannel(args[0]), (self, name, f, options) => flatMap(self, elem => map(f(elem), b => ({
@@ -3561,7 +3653,7 @@ export const bind = /*#__PURE__*/dual(args => isChannel(args[0]), (self, name, f
3561
3653
  * @see {@link bind} for adding a field produced by another channel
3562
3654
  * @see {@link let_ let} for adding a computed field
3563
3655
  *
3564
- * @category do notation
3656
+ * @category mapping
3565
3657
  * @since 4.0.0
3566
3658
  */
3567
3659
  export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, elem => ({
@@ -3572,8 +3664,8 @@ export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, elem => ({
3572
3664
  *
3573
3665
  * **Example** (Counting channel output)
3574
3666
  *
3575
- * ```ts
3576
- * import { Channel, Data } from "effect"
3667
+ * ```ts import.meta.vitest
3668
+ * import { Channel, Data, Effect } from "effect"
3577
3669
  *
3578
3670
  * class CountError extends Data.TaggedError("CountError")<{
3579
3671
  * readonly reason: string
@@ -3585,10 +3677,10 @@ export const bindTo = /*#__PURE__*/dual(2, (self, name) => map(self, elem => ({
3585
3677
  * // Count the elements
3586
3678
  * const countEffect = Channel.runCount(numbersChannel)
3587
3679
  *
3588
- * // Effect.runSync(countEffect) // Returns: 5
3680
+ * Effect.runSync(countEffect) // => 5
3589
3681
  * ```
3590
3682
  *
3591
- * @category execution
3683
+ * @category running
3592
3684
  * @since 4.0.0
3593
3685
  */
3594
3686
  export const runCount = self => runFold(self, () => 0, acc => acc + 1);
@@ -3597,8 +3689,8 @@ export const runCount = self => runFold(self, () => 0, acc => acc + 1);
3597
3689
  *
3598
3690
  * **Example** (Draining channel output at runtime)
3599
3691
  *
3600
- * ```ts
3601
- * import { Channel, Data } from "effect"
3692
+ * ```ts import.meta.vitest
3693
+ * import { Channel, Data, Effect } from "effect"
3602
3694
  *
3603
3695
  * class DrainError extends Data.TaggedError("DrainError")<{
3604
3696
  * readonly stage: string
@@ -3606,18 +3698,15 @@ export const runCount = self => runFold(self, () => 0, acc => acc + 1);
3606
3698
  *
3607
3699
  * // Create a channel that outputs elements and completes with a result
3608
3700
  * const resultChannel = Channel.fromIterable([1, 2, 3])
3609
- * const completedChannel = Channel.concatWith(
3610
- * resultChannel,
3611
- * () => Channel.succeed("completed")
3612
- * )
3701
+ * const completedChannel = Channel.concat(resultChannel, Channel.end("completed"))
3613
3702
  *
3614
3703
  * // Drain all elements and get only the final result
3615
3704
  * const drainEffect = Channel.runDrain(completedChannel)
3616
3705
  *
3617
- * // Effect.runSync(drainEffect) // Returns: "completed"
3706
+ * Effect.runSync(drainEffect) // => "completed"
3618
3707
  * ```
3619
3708
  *
3620
- * @category execution
3709
+ * @category running
3621
3710
  * @since 2.0.0
3622
3711
  */
3623
3712
  export const runDrain = self => runWith(self, pull => Effect.forever(pull, {
@@ -3628,8 +3717,8 @@ export const runDrain = self => runWith(self, pull => Effect.forever(pull, {
3628
3717
  *
3629
3718
  * **Example** (Running effects for each output)
3630
3719
  *
3631
- * ```ts
3632
- * import { Channel, Console, Data } from "effect"
3720
+ * ```ts import.meta.vitest
3721
+ * import { Channel, Data, Effect } from "effect"
3633
3722
  *
3634
3723
  * class ForEachError extends Data.TaggedError("ForEachError")<{
3635
3724
  * readonly element: unknown
@@ -3638,16 +3727,18 @@ export const runDrain = self => runWith(self, pull => Effect.forever(pull, {
3638
3727
  * // Create a channel with numbers
3639
3728
  * const numbersChannel = Channel.fromIterable([1, 2, 3])
3640
3729
  *
3641
- * // Run forEach to log each element
3730
+ * // Run forEach to process each element
3731
+ * const processed: Array<number> = []
3642
3732
  * const forEachEffect = Channel.runForEach(
3643
3733
  * numbersChannel,
3644
- * (n) => Console.log(`Processing: ${n}`)
3734
+ * (n) => Effect.sync(() => processed.push(n))
3645
3735
  * )
3646
3736
  *
3647
- * // Logs: "Processing: 1", "Processing: 2", "Processing: 3"
3737
+ * await Effect.runPromise(forEachEffect)
3738
+ * processed // => [1, 2, 3]
3648
3739
  * ```
3649
3740
  *
3650
- * @category execution
3741
+ * @category running
3651
3742
  * @since 4.0.0
3652
3743
  */
3653
3744
  export const runForEach = /*#__PURE__*/dual(2, (self, f) => runWith(self, pull => Effect.forever(Effect.flatMap(pull, f), {
@@ -3662,7 +3753,7 @@ export const runForEach = /*#__PURE__*/dual(2, (self, f) => runWith(self, pull =
3662
3753
  * Returning `true` continues consuming the channel. Returning `false` stops
3663
3754
  * consumption early. The returned effect completes with `void`.
3664
3755
  *
3665
- * @category execution
3756
+ * @category running
3666
3757
  * @since 4.0.0
3667
3758
  */
3668
3759
  export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => runWith(self, pull => pull.pipe(Effect.flatMap(f), Effect.flatMap(cont => cont ? Effect.void : Cause.done()), Effect.forever({
@@ -3673,8 +3764,8 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => runWith(self, p
3673
3764
  *
3674
3765
  * **Example** (Collecting channel output)
3675
3766
  *
3676
- * ```ts
3677
- * import { Channel, Data } from "effect"
3767
+ * ```ts import.meta.vitest
3768
+ * import { Channel, Data, Effect } from "effect"
3678
3769
  *
3679
3770
  * class CollectError extends Data.TaggedError("CollectError")<{
3680
3771
  * readonly reason: string
@@ -3686,10 +3777,10 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => runWith(self, p
3686
3777
  * // Collect all elements into an array
3687
3778
  * const collectEffect = Channel.runCollect(numbersChannel)
3688
3779
  *
3689
- * // Effect.runSync(collectEffect) // Returns: [1, 2, 3, 4, 5]
3780
+ * Effect.runSync(collectEffect) // => [1, 2, 3, 4, 5]
3690
3781
  * ```
3691
3782
  *
3692
- * @category execution
3783
+ * @category running
3693
3784
  * @since 2.0.0
3694
3785
  */
3695
3786
  export const runCollect = self => runFold(self, () => [], (acc, o) => {
@@ -3699,7 +3790,7 @@ export const runCollect = self => runFold(self, () => [], (acc, o) => {
3699
3790
  /**
3700
3791
  * Runs a channel and outputs the done value.
3701
3792
  *
3702
- * @category execution
3793
+ * @category running
3703
3794
  * @since 4.0.0
3704
3795
  */
3705
3796
  export const runDone = self => runWith(self, identity_, Effect.succeed);
@@ -3712,7 +3803,7 @@ export const runDone = self => runWith(self, identity_, Effect.succeed);
3712
3803
  * Returns `Option.some` with the first output element, or `Option.none` if the
3713
3804
  * channel completes without emitting output.
3714
3805
  *
3715
- * @category execution
3806
+ * @category running
3716
3807
  * @since 4.0.0
3717
3808
  */
3718
3809
  export const runHead = self => Effect.suspend(() => {
@@ -3731,7 +3822,7 @@ export const runHead = self => Effect.suspend(() => {
3731
3822
  * Returns `Option.some` with the last emitted element, or `Option.none` if the
3732
3823
  * channel completes without emitting output.
3733
3824
  *
3734
- * @category execution
3825
+ * @category running
3735
3826
  * @since 4.0.0
3736
3827
  */
3737
3828
  export const runLast = self => Effect.suspend(() => {
@@ -3749,8 +3840,8 @@ export const runLast = self => Effect.suspend(() => {
3749
3840
  *
3750
3841
  * **Example** (Folding channel output)
3751
3842
  *
3752
- * ```ts
3753
- * import { Channel, Data } from "effect"
3843
+ * ```ts import.meta.vitest
3844
+ * import { Channel, Data, Effect } from "effect"
3754
3845
  *
3755
3846
  * class FoldError extends Data.TaggedError("FoldError")<{
3756
3847
  * readonly operation: string
@@ -3762,10 +3853,10 @@ export const runLast = self => Effect.suspend(() => {
3762
3853
  * // Fold to calculate sum
3763
3854
  * const sumEffect = Channel.runFold(numbersChannel, () => 0, (acc, n) => acc + n)
3764
3855
  *
3765
- * // Effect.runSync(sumEffect) // Returns: 15
3856
+ * Effect.runSync(sumEffect) // => 15
3766
3857
  * ```
3767
3858
  *
3768
- * @category execution
3859
+ * @category running
3769
3860
  * @since 4.0.0
3770
3861
  */
3771
3862
  export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Effect.suspend(() => {
@@ -3792,7 +3883,7 @@ export const runFold = /*#__PURE__*/dual(3, (self, initial, f) => Effect.suspend
3792
3883
  * the effectful accumulator function. The returned effect succeeds with the
3793
3884
  * final accumulator value.
3794
3885
  *
3795
- * @category execution
3886
+ * @category running
3796
3887
  * @since 4.0.0
3797
3888
  */
3798
3889
  export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Effect.suspend(() => {
@@ -3816,7 +3907,7 @@ export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Effect.s
3816
3907
  *
3817
3908
  * **Example** (Converting channels to pulls)
3818
3909
  *
3819
- * ```ts
3910
+ * ```ts import.meta.vitest
3820
3911
  * import { Channel, Data, Effect } from "effect"
3821
3912
  *
3822
3913
  * class PullError extends Data.TaggedError("PullError")<{
@@ -3826,12 +3917,11 @@ export const runFoldEffect = /*#__PURE__*/dual(3, (self, initial, f) => Effect.s
3826
3917
  * // Create a channel
3827
3918
  * const numbersChannel = Channel.fromIterable([1, 2, 3])
3828
3919
  *
3829
- * // Convert to Pull within a scope
3830
- * const pullEffect = Effect.scoped(
3831
- * Channel.toPull(numbersChannel)
3832
- * )
3833
- *
3834
- * // Use the Pull to manually consume elements
3920
+ * const program = Effect.scoped(Effect.gen(function*() {
3921
+ * const pull = yield* Channel.toPull(numbersChannel)
3922
+ * return [yield* pull, yield* pull, yield* pull]
3923
+ * }))
3924
+ * await Effect.runPromise(program) // => [1, 2, 3]
3835
3925
  * ```
3836
3926
  *
3837
3927
  * @category destructors
@@ -3852,7 +3942,7 @@ Effect.catchCause(cause => Effect.succeed(Effect.failCause(cause))));
3852
3942
  *
3853
3943
  * **Example** (Converting channels to scoped pulls)
3854
3944
  *
3855
- * ```ts
3945
+ * ```ts import.meta.vitest
3856
3946
  * import { Channel, Data, Effect, Scope } from "effect"
3857
3947
  *
3858
3948
  * class ScopedPullError extends Data.TaggedError("ScopedPullError")<{
@@ -3864,10 +3954,11 @@ Effect.catchCause(cause => Effect.succeed(Effect.failCause(cause))));
3864
3954
  *
3865
3955
  * // Convert to Pull with explicit scope
3866
3956
  * const scopedPullEffect = Effect.gen(function*() {
3867
- * const scope = yield* Scope.make()
3957
+ * const scope = yield* Effect.scope
3868
3958
  * const pull = yield* Channel.toPullScoped(numbersChannel, scope)
3869
- * return pull
3959
+ * return [yield* pull, yield* pull, yield* pull]
3870
3960
  * })
3961
+ * await Effect.runPromise(Effect.scoped(scopedPullEffect)) // => [1, 2, 3]
3871
3962
  * ```
3872
3963
  *
3873
3964
  * @category destructors
@@ -3927,8 +4018,8 @@ export const runIntoQueueArray = /*#__PURE__*/dual(args => isChannel(args[0]), (
3927
4018
  *
3928
4019
  * **Example** (Converting channels to queues)
3929
4020
  *
3930
- * ```ts
3931
- * import { Channel, Data } from "effect"
4021
+ * ```ts import.meta.vitest
4022
+ * import { Channel, Data, Effect, Queue } from "effect"
3932
4023
  *
3933
4024
  * class QueueError extends Data.TaggedError("QueueError")<{
3934
4025
  * readonly operation: string
@@ -3938,10 +4029,11 @@ export const runIntoQueueArray = /*#__PURE__*/dual(args => isChannel(args[0]), (
3938
4029
  * const dataChannel = Channel.fromIterable([1, 2, 3, 4, 5])
3939
4030
  *
3940
4031
  * // Convert to queue for concurrent processing
3941
- * const queueEffect = Channel.toQueue(dataChannel, { capacity: 32 })
3942
- *
3943
- * // The queue can be used for concurrent consumption
3944
- * // Multiple consumers can read from the queue
4032
+ * const program = Effect.scoped(Effect.gen(function*() {
4033
+ * const queue = yield* Channel.toQueue(dataChannel, { capacity: 32 })
4034
+ * return yield* Queue.takeBetween(queue, 5, 5)
4035
+ * }))
4036
+ * await Effect.runPromise(program) // => [1, 2, 3, 4, 5]
3945
4037
  * ```
3946
4038
  *
3947
4039
  * @category destructors