effect 4.0.0-rc.112 → 4.0.0-rc.113

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 (1229) hide show
  1. package/AGENTS.md +24 -9
  2. package/CLAUDE.md +24 -9
  3. package/ai-docs/package.json +2 -2
  4. package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +18 -5
  5. package/ai-docs/src/01_effect/01_basics/index.md +5 -3
  6. package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
  7. package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +2 -2
  8. package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +2 -2
  9. package/ai-docs/src/03_stream/30_encoding.ts +5 -7
  10. package/ai-docs/src/08_observability/10_logging.ts +1 -1
  11. package/ai-docs/src/70_cli/10_basics.ts +7 -7
  12. package/ai-docs/src/71_ai/10_language-model.ts +2 -2
  13. package/ai-docs/src/71_ai/20_tools.ts +1 -1
  14. package/ai-docs/src/71_ai/30_chat.ts +1 -1
  15. package/dist/Array.d.ts +86 -50
  16. package/dist/Array.d.ts.map +1 -1
  17. package/dist/Array.js +58 -32
  18. package/dist/Array.js.map +1 -1
  19. package/dist/BigDecimal.d.ts +5 -1
  20. package/dist/BigDecimal.d.ts.map +1 -1
  21. package/dist/BigDecimal.js +40 -23
  22. package/dist/BigDecimal.js.map +1 -1
  23. package/dist/ByteSize.d.ts +633 -0
  24. package/dist/ByteSize.d.ts.map +1 -0
  25. package/dist/ByteSize.js +524 -0
  26. package/dist/ByteSize.js.map +1 -0
  27. package/dist/Cache.d.ts.map +1 -1
  28. package/dist/Cache.js +17 -3
  29. package/dist/Cache.js.map +1 -1
  30. package/dist/Cause.d.ts +1 -1
  31. package/dist/Cause.d.ts.map +1 -1
  32. package/dist/Channel.d.ts +97 -24
  33. package/dist/Channel.d.ts.map +1 -1
  34. package/dist/Channel.js +66 -39
  35. package/dist/Channel.js.map +1 -1
  36. package/dist/Chunk.d.ts +49 -28
  37. package/dist/Chunk.d.ts.map +1 -1
  38. package/dist/Chunk.js +27 -18
  39. package/dist/Chunk.js.map +1 -1
  40. package/dist/Config.d.ts +162 -201
  41. package/dist/Config.d.ts.map +1 -1
  42. package/dist/Config.js +103 -212
  43. package/dist/Config.js.map +1 -1
  44. package/dist/ConfigProvider.d.ts +4 -4
  45. package/dist/ConfigProvider.d.ts.map +1 -1
  46. package/dist/ConfigProvider.js +7 -7
  47. package/dist/ConfigProvider.js.map +1 -1
  48. package/dist/Context.d.ts +31 -0
  49. package/dist/Context.d.ts.map +1 -1
  50. package/dist/Context.js.map +1 -1
  51. package/dist/Cron.d.ts +2 -2
  52. package/dist/Cron.d.ts.map +1 -1
  53. package/dist/Cron.js +2 -2
  54. package/dist/Cron.js.map +1 -1
  55. package/dist/Crypto.d.ts +1 -1
  56. package/dist/Crypto.d.ts.map +1 -1
  57. package/dist/Crypto.js +3 -2
  58. package/dist/Crypto.js.map +1 -1
  59. package/dist/DateTime.d.ts +2 -2
  60. package/dist/DateTime.d.ts.map +1 -1
  61. package/dist/Deferred.d.ts.map +1 -1
  62. package/dist/Deferred.js +6 -6
  63. package/dist/Deferred.js.map +1 -1
  64. package/dist/Duration.d.ts +1 -1
  65. package/dist/Duration.d.ts.map +1 -1
  66. package/dist/Duration.js +1 -1
  67. package/dist/Duration.js.map +1 -1
  68. package/dist/Effect.d.ts +220 -113
  69. package/dist/Effect.d.ts.map +1 -1
  70. package/dist/Effect.js +27 -26
  71. package/dist/Effect.js.map +1 -1
  72. package/dist/Effectable.d.ts +58 -2
  73. package/dist/Effectable.d.ts.map +1 -1
  74. package/dist/Effectable.js +58 -6
  75. package/dist/Effectable.js.map +1 -1
  76. package/dist/Encoding.d.ts +3 -1
  77. package/dist/Encoding.d.ts.map +1 -1
  78. package/dist/Encoding.js +40 -10
  79. package/dist/Encoding.js.map +1 -1
  80. package/dist/Equal.d.ts +1 -1
  81. package/dist/Equal.d.ts.map +1 -1
  82. package/dist/Equal.js +1 -1
  83. package/dist/Equal.js.map +1 -1
  84. package/dist/ExecutionPlan.d.ts.map +1 -1
  85. package/dist/ExecutionPlan.js +1 -0
  86. package/dist/ExecutionPlan.js.map +1 -1
  87. package/dist/Fiber.d.ts +32 -8
  88. package/dist/Fiber.d.ts.map +1 -1
  89. package/dist/Fiber.js.map +1 -1
  90. package/dist/FiberHandle.js +3 -3
  91. package/dist/FiberHandle.js.map +1 -1
  92. package/dist/FiberMap.d.ts +12 -6
  93. package/dist/FiberMap.d.ts.map +1 -1
  94. package/dist/FiberMap.js +11 -6
  95. package/dist/FiberMap.js.map +1 -1
  96. package/dist/FileSystem.d.ts +42 -210
  97. package/dist/FileSystem.d.ts.map +1 -1
  98. package/dist/FileSystem.js +16 -148
  99. package/dist/FileSystem.js.map +1 -1
  100. package/dist/Formatter.d.ts +1 -0
  101. package/dist/Formatter.d.ts.map +1 -1
  102. package/dist/Formatter.js +19 -3
  103. package/dist/Formatter.js.map +1 -1
  104. package/dist/Graph.d.ts +48 -20
  105. package/dist/Graph.d.ts.map +1 -1
  106. package/dist/Graph.js +20 -5
  107. package/dist/Graph.js.map +1 -1
  108. package/dist/Hash.d.ts +1 -1
  109. package/dist/Hash.d.ts.map +1 -1
  110. package/dist/Hash.js +5 -14
  111. package/dist/Hash.js.map +1 -1
  112. package/dist/HashMap.d.ts +1 -1
  113. package/dist/HashMap.d.ts.map +1 -1
  114. package/dist/HashRing.d.ts +6 -1
  115. package/dist/HashRing.d.ts.map +1 -1
  116. package/dist/HashRing.js +9 -2
  117. package/dist/HashRing.js.map +1 -1
  118. package/dist/HashSet.d.ts +1 -1
  119. package/dist/HashSet.d.ts.map +1 -1
  120. package/dist/HashSet.js.map +1 -1
  121. package/dist/Iterable.d.ts +33 -15
  122. package/dist/Iterable.d.ts.map +1 -1
  123. package/dist/Iterable.js +58 -45
  124. package/dist/Iterable.js.map +1 -1
  125. package/dist/JsonPatch.js +4 -4
  126. package/dist/JsonPatch.js.map +1 -1
  127. package/dist/JsonPointer.d.ts +68 -4
  128. package/dist/JsonPointer.d.ts.map +1 -1
  129. package/dist/JsonPointer.js +90 -4
  130. package/dist/JsonPointer.js.map +1 -1
  131. package/dist/JsonSchema.js +8 -22
  132. package/dist/JsonSchema.js.map +1 -1
  133. package/dist/Layer.d.ts +47 -4
  134. package/dist/Layer.d.ts.map +1 -1
  135. package/dist/Layer.js +4 -6
  136. package/dist/Layer.js.map +1 -1
  137. package/dist/LayerMap.d.ts +1 -3
  138. package/dist/LayerMap.d.ts.map +1 -1
  139. package/dist/LayerMap.js +7 -5
  140. package/dist/LayerMap.js.map +1 -1
  141. package/dist/LayerRef.d.ts.map +1 -1
  142. package/dist/LayerRef.js +7 -5
  143. package/dist/LayerRef.js.map +1 -1
  144. package/dist/Logger.d.ts +114 -9
  145. package/dist/Logger.d.ts.map +1 -1
  146. package/dist/Logger.js +109 -9
  147. package/dist/Logger.js.map +1 -1
  148. package/dist/ManagedRuntime.js +1 -1
  149. package/dist/ManagedRuntime.js.map +1 -1
  150. package/dist/Match.d.ts +43 -31
  151. package/dist/Match.d.ts.map +1 -1
  152. package/dist/Match.js +5 -2
  153. package/dist/Match.js.map +1 -1
  154. package/dist/Metric.d.ts +11 -4
  155. package/dist/Metric.d.ts.map +1 -1
  156. package/dist/Metric.js +14 -18
  157. package/dist/Metric.js.map +1 -1
  158. package/dist/MutableHashMap.d.ts +1 -1
  159. package/dist/MutableHashMap.d.ts.map +1 -1
  160. package/dist/MutableHashMap.js +1 -1
  161. package/dist/MutableHashMap.js.map +1 -1
  162. package/dist/MutableHashSet.d.ts +1 -1
  163. package/dist/MutableHashSet.d.ts.map +1 -1
  164. package/dist/MutableHashSet.js +1 -1
  165. package/dist/MutableHashSet.js.map +1 -1
  166. package/dist/MutableList.d.ts +13 -2
  167. package/dist/MutableList.d.ts.map +1 -1
  168. package/dist/MutableList.js +18 -2
  169. package/dist/MutableList.js.map +1 -1
  170. package/dist/Number.d.ts +6 -0
  171. package/dist/Number.d.ts.map +1 -1
  172. package/dist/Number.js +3 -1
  173. package/dist/Number.js.map +1 -1
  174. package/dist/Optic.d.ts.map +1 -1
  175. package/dist/Optic.js +5 -4
  176. package/dist/Optic.js.map +1 -1
  177. package/dist/Option.d.ts +1 -1
  178. package/dist/Option.d.ts.map +1 -1
  179. package/dist/Option.js +1 -1
  180. package/dist/Option.js.map +1 -1
  181. package/dist/Order.d.ts +1 -0
  182. package/dist/Order.d.ts.map +1 -1
  183. package/dist/Order.js +3 -1
  184. package/dist/Order.js.map +1 -1
  185. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  186. package/dist/PartitionedSemaphore.js +1 -2
  187. package/dist/PartitionedSemaphore.js.map +1 -1
  188. package/dist/Path.d.ts +1 -1
  189. package/dist/Path.d.ts.map +1 -1
  190. package/dist/Path.js +1 -1
  191. package/dist/Path.js.map +1 -1
  192. package/dist/PlatformError.d.ts +1 -1
  193. package/dist/PlatformError.d.ts.map +1 -1
  194. package/dist/PlatformError.js +1 -1
  195. package/dist/PlatformError.js.map +1 -1
  196. package/dist/Pool.d.ts +38 -1
  197. package/dist/Pool.d.ts.map +1 -1
  198. package/dist/Pool.js +81 -5
  199. package/dist/Pool.js.map +1 -1
  200. package/dist/PrimaryKey.d.ts +1 -1
  201. package/dist/PrimaryKey.d.ts.map +1 -1
  202. package/dist/PrimaryKey.js +1 -1
  203. package/dist/PrimaryKey.js.map +1 -1
  204. package/dist/PubSub.d.ts +21 -9
  205. package/dist/PubSub.d.ts.map +1 -1
  206. package/dist/PubSub.js +18 -14
  207. package/dist/PubSub.js.map +1 -1
  208. package/dist/Queue.d.ts +82 -6
  209. package/dist/Queue.d.ts.map +1 -1
  210. package/dist/Queue.js +116 -27
  211. package/dist/Queue.js.map +1 -1
  212. package/dist/Random.d.ts +17 -4
  213. package/dist/Random.d.ts.map +1 -1
  214. package/dist/Random.js +1 -1
  215. package/dist/Random.js.map +1 -1
  216. package/dist/RcMap.d.ts.map +1 -1
  217. package/dist/RcMap.js +15 -9
  218. package/dist/RcMap.js.map +1 -1
  219. package/dist/Redacted.d.ts +1 -1
  220. package/dist/Redacted.d.ts.map +1 -1
  221. package/dist/Redacted.js +1 -1
  222. package/dist/Redacted.js.map +1 -1
  223. package/dist/RequestResolver.d.ts +15 -9
  224. package/dist/RequestResolver.d.ts.map +1 -1
  225. package/dist/RequestResolver.js +33 -15
  226. package/dist/RequestResolver.js.map +1 -1
  227. package/dist/Result.d.ts +1 -1
  228. package/dist/Result.d.ts.map +1 -1
  229. package/dist/Result.js +1 -1
  230. package/dist/Result.js.map +1 -1
  231. package/dist/Scheduler.d.ts.map +1 -1
  232. package/dist/Scheduler.js +19 -10
  233. package/dist/Scheduler.js.map +1 -1
  234. package/dist/Schema.d.ts +2155 -2415
  235. package/dist/Schema.d.ts.map +1 -1
  236. package/dist/Schema.js +2755 -4174
  237. package/dist/Schema.js.map +1 -1
  238. package/dist/SchemaAST.d.ts +354 -183
  239. package/dist/SchemaAST.d.ts.map +1 -1
  240. package/dist/SchemaAST.js +277 -601
  241. package/dist/SchemaAST.js.map +1 -1
  242. package/dist/SchemaGetter.d.ts +46 -22
  243. package/dist/SchemaGetter.d.ts.map +1 -1
  244. package/dist/SchemaGetter.js +56 -53
  245. package/dist/SchemaGetter.js.map +1 -1
  246. package/dist/SchemaIssue.d.ts +122 -188
  247. package/dist/SchemaIssue.d.ts.map +1 -1
  248. package/dist/SchemaIssue.js +48 -263
  249. package/dist/SchemaIssue.js.map +1 -1
  250. package/dist/SchemaParser.js +2 -9
  251. package/dist/SchemaParser.js.map +1 -1
  252. package/dist/SchemaRepresentation.d.ts +1099 -16
  253. package/dist/SchemaRepresentation.d.ts.map +1 -1
  254. package/dist/SchemaRepresentation.js +1341 -20
  255. package/dist/SchemaRepresentation.js.map +1 -1
  256. package/dist/SchemaTransformation.d.ts +49 -16
  257. package/dist/SchemaTransformation.d.ts.map +1 -1
  258. package/dist/SchemaTransformation.js +75 -98
  259. package/dist/SchemaTransformation.js.map +1 -1
  260. package/dist/ScopedCache.d.ts.map +1 -1
  261. package/dist/ScopedCache.js +10 -3
  262. package/dist/ScopedCache.js.map +1 -1
  263. package/dist/Sink.d.ts +9 -4
  264. package/dist/Sink.d.ts.map +1 -1
  265. package/dist/Sink.js +49 -31
  266. package/dist/Sink.js.map +1 -1
  267. package/dist/Stream.d.ts +221 -35
  268. package/dist/Stream.d.ts.map +1 -1
  269. package/dist/Stream.js +168 -84
  270. package/dist/Stream.js.map +1 -1
  271. package/dist/String.d.ts +16 -6
  272. package/dist/String.d.ts.map +1 -1
  273. package/dist/String.js +12 -5
  274. package/dist/String.js.map +1 -1
  275. package/dist/Struct.d.ts.map +1 -1
  276. package/dist/Struct.js +7 -4
  277. package/dist/Struct.js.map +1 -1
  278. package/dist/SynchronizedRef.d.ts +3 -2
  279. package/dist/SynchronizedRef.d.ts.map +1 -1
  280. package/dist/SynchronizedRef.js.map +1 -1
  281. package/dist/Terminal.d.ts +3 -3
  282. package/dist/Terminal.d.ts.map +1 -1
  283. package/dist/Terminal.js +3 -3
  284. package/dist/Terminal.js.map +1 -1
  285. package/dist/Tracer.d.ts +27 -7
  286. package/dist/Tracer.d.ts.map +1 -1
  287. package/dist/Tracer.js +38 -13
  288. package/dist/Tracer.js.map +1 -1
  289. package/dist/Trie.d.ts +1 -1
  290. package/dist/Trie.d.ts.map +1 -1
  291. package/dist/Tuple.d.ts +2 -1
  292. package/dist/Tuple.d.ts.map +1 -1
  293. package/dist/Tuple.js.map +1 -1
  294. package/dist/TxChunk.d.ts +1 -1
  295. package/dist/TxChunk.d.ts.map +1 -1
  296. package/dist/TxChunk.js +1 -1
  297. package/dist/TxChunk.js.map +1 -1
  298. package/dist/TxDeferred.d.ts +1 -1
  299. package/dist/TxDeferred.d.ts.map +1 -1
  300. package/dist/TxDeferred.js +1 -1
  301. package/dist/TxDeferred.js.map +1 -1
  302. package/dist/TxHashMap.d.ts +1 -1
  303. package/dist/TxHashMap.d.ts.map +1 -1
  304. package/dist/TxHashMap.js +1 -1
  305. package/dist/TxHashMap.js.map +1 -1
  306. package/dist/TxHashSet.d.ts +1 -1
  307. package/dist/TxHashSet.d.ts.map +1 -1
  308. package/dist/TxHashSet.js +1 -1
  309. package/dist/TxHashSet.js.map +1 -1
  310. package/dist/TxPriorityQueue.d.ts +1 -1
  311. package/dist/TxPriorityQueue.d.ts.map +1 -1
  312. package/dist/TxPriorityQueue.js +1 -1
  313. package/dist/TxPriorityQueue.js.map +1 -1
  314. package/dist/TxPubSub.d.ts +1 -1
  315. package/dist/TxPubSub.d.ts.map +1 -1
  316. package/dist/TxPubSub.js +1 -1
  317. package/dist/TxPubSub.js.map +1 -1
  318. package/dist/TxQueue.d.ts +9 -9
  319. package/dist/TxQueue.d.ts.map +1 -1
  320. package/dist/TxQueue.js +93 -86
  321. package/dist/TxQueue.js.map +1 -1
  322. package/dist/TxReentrantLock.d.ts +29 -1
  323. package/dist/TxReentrantLock.d.ts.map +1 -1
  324. package/dist/TxReentrantLock.js +29 -1
  325. package/dist/TxReentrantLock.js.map +1 -1
  326. package/dist/TxRef.d.ts +1 -1
  327. package/dist/TxRef.d.ts.map +1 -1
  328. package/dist/TxRef.js +1 -1
  329. package/dist/TxRef.js.map +1 -1
  330. package/dist/TxSemaphore.d.ts +1 -1
  331. package/dist/TxSemaphore.d.ts.map +1 -1
  332. package/dist/TxSemaphore.js +1 -1
  333. package/dist/TxSemaphore.js.map +1 -1
  334. package/dist/TxSubscriptionRef.d.ts +1 -1
  335. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  336. package/dist/TxSubscriptionRef.js +1 -1
  337. package/dist/TxSubscriptionRef.js.map +1 -1
  338. package/dist/Types.d.ts +33 -19
  339. package/dist/Types.d.ts.map +1 -1
  340. package/dist/Utils.d.ts.map +1 -1
  341. package/dist/Utils.js +2 -1
  342. package/dist/Utils.js.map +1 -1
  343. package/dist/index.d.ts +4 -0
  344. package/dist/index.d.ts.map +1 -1
  345. package/dist/index.js +4 -0
  346. package/dist/index.js.map +1 -1
  347. package/dist/internal/arbitrary/model.d.ts +2 -0
  348. package/dist/internal/arbitrary/model.d.ts.map +1 -0
  349. package/dist/internal/arbitrary/model.js +495 -0
  350. package/dist/internal/arbitrary/model.js.map +1 -0
  351. package/dist/internal/arbitrary/regexp.d.ts +2 -0
  352. package/dist/internal/arbitrary/regexp.d.ts.map +1 -0
  353. package/dist/internal/arbitrary/regexp.js +789 -0
  354. package/dist/internal/arbitrary/regexp.js.map +1 -0
  355. package/dist/internal/arbitrary/runner.d.ts +2 -0
  356. package/dist/internal/arbitrary/runner.d.ts.map +1 -0
  357. package/dist/internal/arbitrary/runner.js +496 -0
  358. package/dist/internal/arbitrary/runner.js.map +1 -0
  359. package/dist/internal/arbitrary/schema.d.ts.map +1 -0
  360. package/dist/internal/arbitrary/schema.js +1340 -0
  361. package/dist/internal/arbitrary/schema.js.map +1 -0
  362. package/dist/internal/core.js +27 -13
  363. package/dist/internal/core.js.map +1 -1
  364. package/dist/internal/count.d.ts +2 -0
  365. package/dist/internal/count.d.ts.map +1 -0
  366. package/dist/internal/count.js +14 -0
  367. package/dist/internal/count.js.map +1 -0
  368. package/dist/internal/dateTime.js +4 -10
  369. package/dist/internal/dateTime.js.map +1 -1
  370. package/dist/internal/effect.js +386 -251
  371. package/dist/internal/effect.js.map +1 -1
  372. package/dist/internal/graph.js +3 -1
  373. package/dist/internal/graph.js.map +1 -1
  374. package/dist/internal/hashMap.js +5 -3
  375. package/dist/internal/hashMap.js.map +1 -1
  376. package/dist/internal/hashSet.js +1 -1
  377. package/dist/internal/hashSet.js.map +1 -1
  378. package/dist/internal/matcher.js +1 -1
  379. package/dist/internal/matcher.js.map +1 -1
  380. package/dist/internal/metric.js +1 -1
  381. package/dist/internal/metric.js.map +1 -1
  382. package/dist/internal/option.js +6 -5
  383. package/dist/internal/option.js.map +1 -1
  384. package/dist/internal/random.js +17 -0
  385. package/dist/internal/random.js.map +1 -1
  386. package/dist/internal/rcRef.js +10 -7
  387. package/dist/internal/rcRef.js.map +1 -1
  388. package/dist/internal/references.js +1 -0
  389. package/dist/internal/references.js.map +1 -1
  390. package/dist/internal/request.js +13 -6
  391. package/dist/internal/request.js.map +1 -1
  392. package/dist/internal/result.js +11 -9
  393. package/dist/internal/result.js.map +1 -1
  394. package/dist/internal/schema/annotations.js +1 -1
  395. package/dist/internal/schema/annotations.js.map +1 -1
  396. package/dist/internal/schema/fromJsonSchemaDocument.js +14 -12
  397. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
  398. package/dist/internal/schema/fromRepresentation.js +5 -5
  399. package/dist/internal/schema/fromRepresentation.js.map +1 -1
  400. package/dist/internal/schema/make.d.ts +2 -0
  401. package/dist/internal/schema/make.d.ts.map +1 -0
  402. package/dist/internal/schema/{schema.js → make.js} +1 -25
  403. package/dist/internal/schema/make.js.map +1 -0
  404. package/dist/internal/schema/parser.d.ts +0 -12
  405. package/dist/internal/schema/parser.d.ts.map +1 -1
  406. package/dist/internal/schema/parser.js +7 -0
  407. package/dist/internal/schema/parser.js.map +1 -1
  408. package/dist/internal/schema/standardSchema.d.ts +2 -0
  409. package/dist/internal/schema/standardSchema.d.ts.map +1 -0
  410. package/dist/internal/schema/standardSchema.js +112 -0
  411. package/dist/internal/schema/standardSchema.js.map +1 -0
  412. package/dist/internal/schema/toCodeDocument.js +34 -22
  413. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  414. package/dist/internal/schema/toCodec.d.ts +2 -0
  415. package/dist/internal/schema/toCodec.d.ts.map +1 -0
  416. package/dist/internal/schema/toCodec.js +242 -0
  417. package/dist/internal/schema/toCodec.js.map +1 -0
  418. package/dist/internal/schema/toDifferJsonPatch.d.ts +2 -0
  419. package/dist/internal/schema/toDifferJsonPatch.d.ts.map +1 -0
  420. package/dist/internal/schema/toDifferJsonPatch.js +20 -0
  421. package/dist/internal/schema/toDifferJsonPatch.js.map +1 -0
  422. package/dist/internal/schema/toEncoderXml.d.ts +2 -0
  423. package/dist/internal/schema/toEncoderXml.d.ts.map +1 -0
  424. package/dist/internal/schema/toEncoderXml.js +104 -0
  425. package/dist/internal/schema/toEncoderXml.js.map +1 -0
  426. package/dist/internal/schema/toEquivalence.js +66 -0
  427. package/dist/internal/schema/toEquivalence.js.map +1 -1
  428. package/dist/internal/schema/toFormatter.d.ts +2 -0
  429. package/dist/internal/schema/toFormatter.d.ts.map +1 -0
  430. package/dist/internal/schema/toFormatter.js +227 -0
  431. package/dist/internal/schema/toFormatter.js.map +1 -0
  432. package/dist/internal/schema/toIso.d.ts +2 -0
  433. package/dist/internal/schema/toIso.d.ts.map +1 -0
  434. package/dist/internal/schema/toIso.js +17 -0
  435. package/dist/internal/schema/toIso.js.map +1 -0
  436. package/dist/internal/schema/toJsonSchemaDocument.js +122 -71
  437. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  438. package/dist/internal/schema/toRepresentation.js +3 -1
  439. package/dist/internal/schema/toRepresentation.js.map +1 -1
  440. package/dist/internal/schemaError.d.ts +4 -0
  441. package/dist/internal/schemaError.d.ts.map +1 -0
  442. package/dist/internal/schemaError.js +6 -0
  443. package/dist/internal/schemaError.js.map +1 -0
  444. package/dist/internal/stream.js +5 -6
  445. package/dist/internal/stream.js.map +1 -1
  446. package/dist/internal/tracer.d.ts +1 -3
  447. package/dist/internal/tracer.d.ts.map +1 -1
  448. package/dist/internal/tracer.js +6 -0
  449. package/dist/internal/tracer.js.map +1 -1
  450. package/dist/internal/trie.js +2 -2
  451. package/dist/internal/trie.js.map +1 -1
  452. package/dist/internal/uuid.d.ts +1 -2
  453. package/dist/internal/uuid.d.ts.map +1 -1
  454. package/dist/internal/uuid.js +2 -0
  455. package/dist/internal/uuid.js.map +1 -1
  456. package/dist/testing/TestSchema.d.ts +9 -11
  457. package/dist/testing/TestSchema.d.ts.map +1 -1
  458. package/dist/testing/TestSchema.js +20 -18
  459. package/dist/testing/TestSchema.js.map +1 -1
  460. package/dist/testing/index.d.ts +0 -4
  461. package/dist/testing/index.d.ts.map +1 -1
  462. package/dist/testing/index.js +0 -4
  463. package/dist/testing/index.js.map +1 -1
  464. package/dist/unstable/ai/AiError.d.ts +74 -23
  465. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  466. package/dist/unstable/ai/AiError.js +59 -5
  467. package/dist/unstable/ai/AiError.js.map +1 -1
  468. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  469. package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -1
  470. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  471. package/dist/unstable/ai/Chat.d.ts +27 -32
  472. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  473. package/dist/unstable/ai/Chat.js +10 -13
  474. package/dist/unstable/ai/Chat.js.map +1 -1
  475. package/dist/unstable/ai/EmbeddingModel.d.ts +23 -16
  476. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
  477. package/dist/unstable/ai/EmbeddingModel.js +13 -11
  478. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  479. package/dist/unstable/ai/LanguageModel.d.ts +48 -37
  480. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  481. package/dist/unstable/ai/LanguageModel.js +150 -47
  482. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  483. package/dist/unstable/ai/McpServer.d.ts +2 -2
  484. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  485. package/dist/unstable/ai/McpServer.js +21 -12
  486. package/dist/unstable/ai/McpServer.js.map +1 -1
  487. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  488. package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -1
  489. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  490. package/dist/unstable/ai/Prompt.d.ts +1 -1
  491. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  492. package/dist/unstable/ai/Prompt.js +15 -4
  493. package/dist/unstable/ai/Prompt.js.map +1 -1
  494. package/dist/unstable/ai/Response.d.ts +37 -94
  495. package/dist/unstable/ai/Response.d.ts.map +1 -1
  496. package/dist/unstable/ai/Response.js +46 -96
  497. package/dist/unstable/ai/Response.js.map +1 -1
  498. package/dist/unstable/ai/Tokenizer.js +4 -5
  499. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  500. package/dist/unstable/ai/Tool.d.ts +38 -20
  501. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  502. package/dist/unstable/ai/Tool.js +27 -1
  503. package/dist/unstable/ai/Tool.js.map +1 -1
  504. package/dist/unstable/ai/Toolkit.d.ts +1 -1
  505. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  506. package/dist/unstable/ai/Toolkit.js +30 -18
  507. package/dist/unstable/ai/Toolkit.js.map +1 -1
  508. package/dist/unstable/ai/internal/structured-output.js +8 -5
  509. package/dist/unstable/ai/internal/structured-output.js.map +1 -1
  510. package/dist/unstable/arbitrary/Arbitrary.d.ts +626 -0
  511. package/dist/unstable/arbitrary/Arbitrary.d.ts.map +1 -0
  512. package/dist/unstable/arbitrary/Arbitrary.js +238 -0
  513. package/dist/unstable/arbitrary/Arbitrary.js.map +1 -0
  514. package/dist/unstable/arbitrary/index.d.ts +8 -0
  515. package/dist/unstable/arbitrary/index.d.ts.map +1 -0
  516. package/dist/unstable/arbitrary/index.js +9 -0
  517. package/dist/unstable/arbitrary/index.js.map +1 -0
  518. package/dist/unstable/cli/Argument.d.ts +104 -108
  519. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  520. package/dist/unstable/cli/Argument.js +56 -57
  521. package/dist/unstable/cli/Argument.js.map +1 -1
  522. package/dist/unstable/cli/CliError.d.ts +2 -0
  523. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  524. package/dist/unstable/cli/CliError.js +2 -0
  525. package/dist/unstable/cli/CliError.js.map +1 -1
  526. package/dist/unstable/cli/CliOutput.js +26 -3
  527. package/dist/unstable/cli/CliOutput.js.map +1 -1
  528. package/dist/unstable/cli/Command.d.ts +73 -73
  529. package/dist/unstable/cli/Command.js +18 -18
  530. package/dist/unstable/cli/Completions.d.ts +4 -4
  531. package/dist/unstable/cli/Completions.d.ts.map +1 -1
  532. package/dist/unstable/cli/Flag.d.ts +150 -161
  533. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  534. package/dist/unstable/cli/Flag.js +79 -90
  535. package/dist/unstable/cli/Flag.js.map +1 -1
  536. package/dist/unstable/cli/GlobalFlag.d.ts +3 -3
  537. package/dist/unstable/cli/GlobalFlag.js +13 -13
  538. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  539. package/dist/unstable/cli/Param.d.ts +118 -126
  540. package/dist/unstable/cli/Param.d.ts.map +1 -1
  541. package/dist/unstable/cli/Param.js +104 -113
  542. package/dist/unstable/cli/Param.js.map +1 -1
  543. package/dist/unstable/cli/Primitive.d.ts +69 -58
  544. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  545. package/dist/unstable/cli/Primitive.js +65 -66
  546. package/dist/unstable/cli/Primitive.js.map +1 -1
  547. package/dist/unstable/cli/Prompt.d.ts +23 -24
  548. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  549. package/dist/unstable/cli/Prompt.js +68 -63
  550. package/dist/unstable/cli/Prompt.js.map +1 -1
  551. package/dist/unstable/cli/internal/completions/descriptor.js +23 -11
  552. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  553. package/dist/unstable/cli/internal/completions/zsh.js +2 -2
  554. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  555. package/dist/unstable/cli/internal/config.js +4 -4
  556. package/dist/unstable/cli/internal/parser.js +1 -1
  557. package/dist/unstable/cli/internal/parser.js.map +1 -1
  558. package/dist/unstable/cli/internal/wizard.d.ts.map +1 -1
  559. package/dist/unstable/cli/internal/wizard.js +14 -13
  560. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  561. package/dist/unstable/cluster/ClusterSchema.d.ts +13 -0
  562. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  563. package/dist/unstable/cluster/ClusterSchema.js +16 -1
  564. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  565. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  566. package/dist/unstable/cluster/ClusterWorkflowEngine.js +57 -14
  567. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  568. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  569. package/dist/unstable/cluster/Entity.js +2 -0
  570. package/dist/unstable/cluster/Entity.js.map +1 -1
  571. package/dist/unstable/cluster/EntityProxyServer.d.ts +2 -2
  572. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  573. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  574. package/dist/unstable/cluster/Envelope.d.ts +4 -4
  575. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  576. package/dist/unstable/cluster/Envelope.js +2 -3
  577. package/dist/unstable/cluster/Envelope.js.map +1 -1
  578. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  579. package/dist/unstable/cluster/HttpRunner.js +5 -2
  580. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  581. package/dist/unstable/cluster/MessageStorage.d.ts +34 -4
  582. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  583. package/dist/unstable/cluster/MessageStorage.js +28 -9
  584. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  585. package/dist/unstable/cluster/Reply.d.ts +1 -1
  586. package/dist/unstable/cluster/Sharding.d.ts +1 -1
  587. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  588. package/dist/unstable/cluster/Sharding.js +32 -17
  589. package/dist/unstable/cluster/Sharding.js.map +1 -1
  590. package/dist/unstable/cluster/ShardingConfig.js +23 -23
  591. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  592. package/dist/unstable/cluster/SocketRunner.d.ts +2 -2
  593. package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
  594. package/dist/unstable/cluster/SocketRunner.js +4 -3
  595. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  596. package/dist/unstable/cluster/SqlMessageStorage.js +11 -8
  597. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  598. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  599. package/dist/unstable/cluster/SqlRunnerStorage.js +11 -4
  600. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  601. package/dist/unstable/cluster/internal/clusterAbandon.d.ts +5 -0
  602. package/dist/unstable/cluster/internal/clusterAbandon.d.ts.map +1 -0
  603. package/dist/unstable/cluster/internal/clusterAbandon.js +9 -0
  604. package/dist/unstable/cluster/internal/clusterAbandon.js.map +1 -0
  605. package/dist/unstable/cluster/internal/entityManager.js +7 -4
  606. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  607. package/dist/unstable/cluster/internal/interruptors.js +30 -1
  608. package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
  609. package/dist/unstable/cluster/internal/resourceRef.js +12 -7
  610. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  611. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  612. package/dist/unstable/devtools/DevToolsClient.js +12 -7
  613. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  614. package/dist/unstable/encoding/Ini.d.ts +2 -0
  615. package/dist/unstable/encoding/Ini.d.ts.map +1 -1
  616. package/dist/unstable/encoding/Ini.js +2 -0
  617. package/dist/unstable/encoding/Ini.js.map +1 -1
  618. package/dist/unstable/encoding/SchemaBinary.d.ts +27 -3
  619. package/dist/unstable/encoding/SchemaBinary.d.ts.map +1 -1
  620. package/dist/unstable/encoding/SchemaBinary.js +108 -39
  621. package/dist/unstable/encoding/SchemaBinary.js.map +1 -1
  622. package/dist/unstable/encoding/Sse.js +1 -1
  623. package/dist/unstable/encoding/Sse.js.map +1 -1
  624. package/dist/unstable/encoding/Toml.d.ts +2 -0
  625. package/dist/unstable/encoding/Toml.d.ts.map +1 -1
  626. package/dist/unstable/encoding/Toml.js +6 -4
  627. package/dist/unstable/encoding/Toml.js.map +1 -1
  628. package/dist/unstable/encoding/Yaml.d.ts +2 -0
  629. package/dist/unstable/encoding/Yaml.d.ts.map +1 -1
  630. package/dist/unstable/encoding/Yaml.js +16 -5
  631. package/dist/unstable/encoding/Yaml.js.map +1 -1
  632. package/dist/unstable/encoding/index.d.ts +0 -4
  633. package/dist/unstable/encoding/index.d.ts.map +1 -1
  634. package/dist/unstable/encoding/index.js +0 -4
  635. package/dist/unstable/encoding/index.js.map +1 -1
  636. package/dist/unstable/eventlog/Event.d.ts +5 -5
  637. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  638. package/dist/unstable/eventlog/Event.js +3 -3
  639. package/dist/unstable/eventlog/Event.js.map +1 -1
  640. package/dist/unstable/eventlog/EventJournal.d.ts +7 -7
  641. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  642. package/dist/unstable/eventlog/EventJournal.js +9 -9
  643. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  644. package/dist/unstable/eventlog/EventLog.d.ts +1 -1
  645. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  646. package/dist/unstable/eventlog/EventLog.js +4 -4
  647. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  648. package/dist/unstable/eventlog/EventLogMessage.d.ts +11 -5
  649. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  650. package/dist/unstable/eventlog/EventLogMessage.js +25 -15
  651. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  652. package/dist/unstable/eventlog/EventLogRemote.d.ts +7 -1
  653. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  654. package/dist/unstable/eventlog/EventLogRemote.js +13 -3
  655. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  656. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +2 -2
  657. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  658. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  659. package/dist/unstable/eventlog/SqlEventJournal.js +26 -13
  660. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  661. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  662. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +5 -1
  663. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  664. package/dist/unstable/http/Cookies.d.ts +1 -45
  665. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  666. package/dist/unstable/http/Cookies.js +2 -64
  667. package/dist/unstable/http/Cookies.js.map +1 -1
  668. package/dist/unstable/http/FetchHttpClient.js +1 -1
  669. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  670. package/dist/unstable/http/FindMyWay/internal/router.js +124 -33
  671. package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -1
  672. package/dist/unstable/http/FindMyWay.d.ts +15 -5
  673. package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
  674. package/dist/unstable/http/FindMyWay.js +3 -1
  675. package/dist/unstable/http/FindMyWay.js.map +1 -1
  676. package/dist/unstable/http/Headers.d.ts +0 -22
  677. package/dist/unstable/http/Headers.d.ts.map +1 -1
  678. package/dist/unstable/http/Headers.js +3 -34
  679. package/dist/unstable/http/Headers.js.map +1 -1
  680. package/dist/unstable/http/HttpBody.d.ts +41 -10
  681. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  682. package/dist/unstable/http/HttpBody.js +64 -10
  683. package/dist/unstable/http/HttpBody.js.map +1 -1
  684. package/dist/unstable/http/HttpClient.d.ts +1 -1
  685. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  686. package/dist/unstable/http/HttpClient.js +28 -18
  687. package/dist/unstable/http/HttpClient.js.map +1 -1
  688. package/dist/unstable/http/HttpClientRequest.d.ts +28 -6
  689. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  690. package/dist/unstable/http/HttpClientRequest.js +8 -19
  691. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  692. package/dist/unstable/http/HttpClientResponse.d.ts +6 -1
  693. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  694. package/dist/unstable/http/HttpClientResponse.js +10 -6
  695. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  696. package/dist/unstable/http/HttpEffect.d.ts +16 -0
  697. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  698. package/dist/unstable/http/HttpEffect.js +121 -65
  699. package/dist/unstable/http/HttpEffect.js.map +1 -1
  700. package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -3
  701. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  702. package/dist/unstable/http/HttpIncomingMessage.js +1 -13
  703. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  704. package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
  705. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  706. package/dist/unstable/http/HttpMiddleware.js +29 -21
  707. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  708. package/dist/unstable/http/HttpPlatform.d.ts +12 -11
  709. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  710. package/dist/unstable/http/HttpPlatform.js +36 -10
  711. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  712. package/dist/unstable/http/HttpRouter.d.ts +5 -1
  713. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  714. package/dist/unstable/http/HttpRouter.js +22 -8
  715. package/dist/unstable/http/HttpRouter.js.map +1 -1
  716. package/dist/unstable/http/HttpServer.d.ts +11 -42
  717. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  718. package/dist/unstable/http/HttpServer.js +16 -20
  719. package/dist/unstable/http/HttpServer.js.map +1 -1
  720. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  721. package/dist/unstable/http/HttpServerRequest.js +11 -11
  722. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  723. package/dist/unstable/http/HttpServerRespondable.js +1 -1
  724. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  725. package/dist/unstable/http/HttpServerResponse.d.ts +9 -13
  726. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  727. package/dist/unstable/http/HttpServerResponse.js +34 -44
  728. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  729. package/dist/unstable/http/HttpStaticServer.d.ts +2 -2
  730. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  731. package/dist/unstable/http/HttpStaticServer.js +19 -19
  732. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  733. package/dist/unstable/http/Mime.d.ts +28 -0
  734. package/dist/unstable/http/Mime.d.ts.map +1 -0
  735. package/dist/unstable/http/Mime.js +72 -0
  736. package/dist/unstable/http/Mime.js.map +1 -0
  737. package/dist/unstable/http/Multipart.d.ts +22 -9
  738. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  739. package/dist/unstable/http/Multipart.js +26 -10
  740. package/dist/unstable/http/Multipart.js.map +1 -1
  741. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +1 -1
  742. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -1
  743. package/dist/unstable/http/MultipartParser/internal/multipart.js +8 -3
  744. package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -1
  745. package/dist/unstable/http/MultipartParser.d.ts +4 -3
  746. package/dist/unstable/http/MultipartParser.d.ts.map +1 -1
  747. package/dist/unstable/http/MultipartParser.js.map +1 -1
  748. package/dist/unstable/http/UrlParams.d.ts +0 -97
  749. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  750. package/dist/unstable/http/UrlParams.js +3 -104
  751. package/dist/unstable/http/UrlParams.js.map +1 -1
  752. package/dist/unstable/http/index.d.ts +4 -0
  753. package/dist/unstable/http/index.d.ts.map +1 -1
  754. package/dist/unstable/http/index.js +4 -0
  755. package/dist/unstable/http/index.js.map +1 -1
  756. package/dist/unstable/http/internal/compression.js +8 -11
  757. package/dist/unstable/http/internal/compression.js.map +1 -1
  758. package/dist/unstable/http/internal/headers.d.ts +2 -0
  759. package/dist/unstable/http/internal/headers.d.ts.map +1 -0
  760. package/dist/unstable/http/internal/headers.js +5 -0
  761. package/dist/unstable/http/internal/headers.js.map +1 -0
  762. package/dist/unstable/http/internal/httpBody.js +8 -0
  763. package/dist/unstable/http/internal/httpBody.js.map +1 -1
  764. package/dist/unstable/http/internal/mimeTypes.d.ts +361 -0
  765. package/dist/unstable/http/internal/mimeTypes.d.ts.map +1 -0
  766. package/dist/unstable/http/internal/mimeTypes.js +363 -0
  767. package/dist/unstable/http/internal/mimeTypes.js.map +1 -0
  768. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +13 -0
  769. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  770. package/dist/unstable/httpapi/HttpApiBuilder.js +23 -6
  771. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  772. package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -3
  773. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  774. package/dist/unstable/httpapi/HttpApiClient.js +25 -13
  775. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  776. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +8 -3
  777. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  778. package/dist/unstable/httpapi/HttpApiEndpoint.js +9 -6
  779. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  780. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  781. package/dist/unstable/httpapi/HttpApiError.js +3 -1
  782. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  783. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  784. package/dist/unstable/httpapi/HttpApiMiddleware.js +7 -5
  785. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  786. package/dist/unstable/httpapi/HttpApiSchema.d.ts +12 -0
  787. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  788. package/dist/unstable/httpapi/HttpApiSchema.js +8 -10
  789. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  790. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  791. package/dist/unstable/httpapi/HttpApiTest.js +8 -2
  792. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  793. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  794. package/dist/unstable/httpapi/OpenApi.js +31 -20
  795. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  796. package/dist/unstable/net/IpInterface.d.ts +140 -0
  797. package/dist/unstable/net/IpInterface.d.ts.map +1 -0
  798. package/dist/unstable/net/IpInterface.js +149 -0
  799. package/dist/unstable/net/IpInterface.js.map +1 -0
  800. package/dist/unstable/net/IpNetwork.d.ts +227 -0
  801. package/dist/unstable/net/IpNetwork.d.ts.map +1 -0
  802. package/dist/unstable/net/IpNetwork.js +239 -0
  803. package/dist/unstable/net/IpNetwork.js.map +1 -0
  804. package/dist/unstable/net/NetAddress.d.ts +705 -0
  805. package/dist/unstable/net/NetAddress.d.ts.map +1 -0
  806. package/dist/unstable/net/NetAddress.js +956 -0
  807. package/dist/unstable/net/NetAddress.js.map +1 -0
  808. package/dist/unstable/net/index.d.ts +16 -0
  809. package/dist/unstable/net/index.d.ts.map +1 -0
  810. package/dist/unstable/net/index.js +17 -0
  811. package/dist/unstable/net/index.js.map +1 -0
  812. package/dist/unstable/observability/OtlpExporter.d.ts +1 -0
  813. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  814. package/dist/unstable/observability/OtlpExporter.js +4 -6
  815. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  816. package/dist/unstable/observability/OtlpLogger.js +9 -9
  817. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  818. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  819. package/dist/unstable/observability/OtlpMetrics.js +9 -8
  820. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  821. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  822. package/dist/unstable/observability/OtlpResource.js +2 -2
  823. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  824. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  825. package/dist/unstable/observability/OtlpTracer.js +82 -55
  826. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  827. package/dist/unstable/observability/internal/otlpEnv.d.ts +1 -1
  828. package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
  829. package/dist/unstable/observability/internal/otlpEnv.js +5 -9
  830. package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
  831. package/dist/unstable/persistence/PersistedCache.js +1 -1
  832. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  833. package/dist/unstable/persistence/PersistedQueue.d.ts +114 -14
  834. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  835. package/dist/unstable/persistence/PersistedQueue.js +799 -234
  836. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  837. package/dist/unstable/persistence/RateLimiter.d.ts +28 -15
  838. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  839. package/dist/unstable/persistence/RateLimiter.js +33 -41
  840. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  841. package/dist/unstable/process/ChildProcess.d.ts +8 -2
  842. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  843. package/dist/unstable/process/ChildProcess.js +7 -2
  844. package/dist/unstable/process/ChildProcess.js.map +1 -1
  845. package/dist/unstable/process/ChildProcessSpawner.d.ts +1 -1
  846. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  847. package/dist/unstable/process/ChildProcessSpawner.js +1 -1
  848. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  849. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  850. package/dist/unstable/reactivity/Atom.js +6 -3
  851. package/dist/unstable/reactivity/Atom.js.map +1 -1
  852. package/dist/unstable/reactivity/AtomHttpApi.d.ts +3 -6
  853. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  854. package/dist/unstable/reactivity/AtomHttpApi.js +6 -3
  855. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  856. package/dist/unstable/reactivity/AtomRegistry.js +2 -3
  857. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  858. package/dist/unstable/reactivity/AtomRpc.d.ts +2 -2
  859. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  860. package/dist/unstable/reactivity/AtomRpc.js +1 -1
  861. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  862. package/dist/unstable/reactivity/Hydration.d.ts +6 -4
  863. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  864. package/dist/unstable/reactivity/Hydration.js +20 -6
  865. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  866. package/dist/unstable/reactivity/Reactivity.d.ts +26 -26
  867. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  868. package/dist/unstable/reactivity/Reactivity.js +10 -12
  869. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  870. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  871. package/dist/unstable/rpc/RpcClient.js +64 -64
  872. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  873. package/dist/unstable/rpc/RpcClientError.d.ts +1 -1
  874. package/dist/unstable/rpc/RpcMessage.d.ts +3 -1
  875. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  876. package/dist/unstable/rpc/RpcMessage.js +1 -1
  877. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  878. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  879. package/dist/unstable/rpc/RpcMiddleware.js +7 -5
  880. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  881. package/dist/unstable/rpc/RpcSerialization.d.ts +5 -39
  882. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  883. package/dist/unstable/rpc/RpcSerialization.js +22 -115
  884. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  885. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  886. package/dist/unstable/rpc/RpcServer.js +104 -57
  887. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  888. package/dist/unstable/schema/Model.d.ts.map +1 -1
  889. package/dist/unstable/schema/Model.js +7 -6
  890. package/dist/unstable/schema/Model.js.map +1 -1
  891. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  892. package/dist/unstable/schema/VariantSchema.js +3 -0
  893. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  894. package/dist/unstable/socket/Socket.d.ts +287 -102
  895. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  896. package/dist/unstable/socket/Socket.js +408 -215
  897. package/dist/unstable/socket/Socket.js.map +1 -1
  898. package/dist/unstable/socket/SocketServer.d.ts +5 -32
  899. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  900. package/dist/unstable/socket/SocketServer.js +3 -3
  901. package/dist/unstable/socket/SocketServer.js.map +1 -1
  902. package/dist/unstable/sql/SqlClient.d.ts +20 -0
  903. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  904. package/dist/unstable/sql/SqlClient.js +14 -7
  905. package/dist/unstable/sql/SqlClient.js.map +1 -1
  906. package/dist/unstable/sql/SqlConnection.d.ts +15 -0
  907. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  908. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  909. package/dist/unstable/sql/SqlModel.d.ts +1 -1
  910. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  911. package/dist/unstable/sql/Statement.d.ts +13 -5
  912. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  913. package/dist/unstable/sql/Statement.js +29 -15
  914. package/dist/unstable/sql/Statement.js.map +1 -1
  915. package/dist/unstable/workers/Transferable.js +1 -1
  916. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  917. package/dist/unstable/workers/Worker.js +3 -1
  918. package/dist/unstable/workers/Worker.js.map +1 -1
  919. package/dist/unstable/workflow/Activity.d.ts +7 -0
  920. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  921. package/dist/unstable/workflow/Activity.js +14 -4
  922. package/dist/unstable/workflow/Activity.js.map +1 -1
  923. package/dist/unstable/workflow/DurableClock.js +1 -1
  924. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  925. package/dist/unstable/workflow/DurableDeferred.d.ts +2 -2
  926. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  927. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  928. package/dist/unstable/workflow/DurableQueue.d.ts +8 -0
  929. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  930. package/dist/unstable/workflow/DurableQueue.js +8 -0
  931. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  932. package/dist/unstable/workflow/Workflow.d.ts +5 -0
  933. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  934. package/dist/unstable/workflow/Workflow.js +70 -12
  935. package/dist/unstable/workflow/Workflow.js.map +1 -1
  936. package/dist/unstable/workflow/WorkflowEngine.d.ts +6 -0
  937. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  938. package/dist/unstable/workflow/WorkflowEngine.js +11 -0
  939. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  940. package/package.json +7 -9
  941. package/src/Array.ts +118 -67
  942. package/src/BigDecimal.ts +50 -28
  943. package/src/ByteSize.ts +838 -0
  944. package/src/Cache.ts +17 -3
  945. package/src/Cause.ts +1 -1
  946. package/src/Channel.ts +183 -48
  947. package/src/Chunk.ts +65 -36
  948. package/src/Config.ts +237 -248
  949. package/src/ConfigProvider.ts +7 -8
  950. package/src/Context.ts +31 -0
  951. package/src/Cron.ts +2 -2
  952. package/src/Crypto.ts +3 -2
  953. package/src/Deferred.ts +7 -6
  954. package/src/Duration.ts +1 -1
  955. package/src/Effect.ts +226 -122
  956. package/src/Effectable.ts +78 -9
  957. package/src/Encoding.ts +101 -11
  958. package/src/Equal.ts +1 -1
  959. package/src/ExecutionPlan.ts +3 -0
  960. package/src/Fiber.ts +33 -8
  961. package/src/FiberHandle.ts +3 -3
  962. package/src/FiberMap.ts +19 -10
  963. package/src/FileSystem.ts +55 -230
  964. package/src/Formatter.ts +21 -3
  965. package/src/Graph.ts +55 -25
  966. package/src/Hash.ts +5 -16
  967. package/src/HashRing.ts +9 -2
  968. package/src/HashSet.ts +56 -0
  969. package/src/Iterable.ts +66 -41
  970. package/src/JsonPatch.ts +4 -4
  971. package/src/JsonPointer.ts +97 -4
  972. package/src/JsonSchema.ts +8 -26
  973. package/src/Layer.ts +59 -18
  974. package/src/LayerMap.ts +8 -6
  975. package/src/LayerRef.ts +7 -5
  976. package/src/Logger.ts +125 -18
  977. package/src/ManagedRuntime.ts +1 -1
  978. package/src/Match.ts +33 -14
  979. package/src/Metric.ts +24 -21
  980. package/src/MutableHashMap.ts +1 -1
  981. package/src/MutableHashSet.ts +1 -1
  982. package/src/MutableList.ts +18 -2
  983. package/src/Number.ts +7 -1
  984. package/src/Optic.ts +8 -4
  985. package/src/Option.ts +1 -1
  986. package/src/Order.ts +3 -1
  987. package/src/PartitionedSemaphore.ts +1 -2
  988. package/src/Path.ts +1 -1
  989. package/src/PlatformError.ts +1 -1
  990. package/src/Pool.ts +125 -8
  991. package/src/PrimaryKey.ts +1 -1
  992. package/src/PubSub.ts +32 -20
  993. package/src/Queue.ts +119 -28
  994. package/src/Random.ts +20 -6
  995. package/src/RcMap.ts +20 -13
  996. package/src/Redacted.ts +1 -1
  997. package/src/RequestResolver.ts +49 -26
  998. package/src/Result.ts +1 -1
  999. package/src/Scheduler.ts +21 -11
  1000. package/src/Schema.ts +4809 -6368
  1001. package/src/SchemaAST.ts +1031 -284
  1002. package/src/SchemaGetter.ts +75 -21
  1003. package/src/SchemaIssue.ts +259 -15
  1004. package/src/SchemaParser.ts +2 -12
  1005. package/src/SchemaRepresentation.ts +1593 -29
  1006. package/src/SchemaTransformation.ts +145 -22
  1007. package/src/ScopedCache.ts +10 -3
  1008. package/src/Sink.ts +31 -15
  1009. package/src/Stream.ts +294 -76
  1010. package/src/String.ts +20 -9
  1011. package/src/Struct.ts +8 -4
  1012. package/src/SynchronizedRef.ts +3 -5
  1013. package/src/Terminal.ts +3 -3
  1014. package/src/Tracer.ts +43 -14
  1015. package/src/Tuple.ts +3 -1
  1016. package/src/TxChunk.ts +1 -1
  1017. package/src/TxDeferred.ts +1 -1
  1018. package/src/TxHashMap.ts +1 -1
  1019. package/src/TxHashSet.ts +92 -11
  1020. package/src/TxPriorityQueue.ts +1 -1
  1021. package/src/TxPubSub.ts +1 -1
  1022. package/src/TxQueue.ts +22 -17
  1023. package/src/TxReentrantLock.ts +29 -1
  1024. package/src/TxRef.ts +1 -1
  1025. package/src/TxSemaphore.ts +1 -1
  1026. package/src/TxSubscriptionRef.ts +1 -1
  1027. package/src/Types.ts +40 -17
  1028. package/src/Utils.ts +3 -1
  1029. package/src/index.ts +5 -0
  1030. package/src/internal/arbitrary/model.ts +701 -0
  1031. package/src/internal/arbitrary/regexp.ts +855 -0
  1032. package/src/internal/arbitrary/runner.ts +608 -0
  1033. package/src/internal/arbitrary/schema.ts +1800 -0
  1034. package/src/internal/core.ts +48 -22
  1035. package/src/internal/count.ts +14 -0
  1036. package/src/internal/dateTime.ts +8 -10
  1037. package/src/internal/effect.ts +475 -295
  1038. package/src/internal/graph.ts +6 -1
  1039. package/src/internal/hashMap.ts +5 -3
  1040. package/src/internal/hashSet.ts +1 -1
  1041. package/src/internal/matcher.ts +34 -19
  1042. package/src/internal/metric.ts +1 -1
  1043. package/src/internal/option.ts +8 -6
  1044. package/src/internal/random.ts +20 -7
  1045. package/src/internal/rcRef.ts +10 -7
  1046. package/src/internal/references.ts +1 -0
  1047. package/src/internal/request.ts +12 -7
  1048. package/src/internal/result.ts +15 -11
  1049. package/src/internal/schema/annotations.ts +3 -3
  1050. package/src/internal/schema/fromJsonSchemaDocument.ts +14 -29
  1051. package/src/internal/schema/fromRepresentation.ts +5 -3
  1052. package/src/internal/schema/{schema.ts → make.ts} +0 -40
  1053. package/src/internal/schema/parser.ts +8 -0
  1054. package/src/internal/schema/standardSchema.ts +125 -0
  1055. package/src/internal/schema/toCodeDocument.ts +58 -44
  1056. package/src/internal/schema/toCodec.ts +312 -0
  1057. package/src/internal/schema/toDifferJsonPatch.ts +24 -0
  1058. package/src/internal/schema/toEncoderXml.ts +110 -0
  1059. package/src/internal/schema/toEquivalence.ts +76 -0
  1060. package/src/internal/schema/toFormatter.ts +230 -0
  1061. package/src/internal/schema/toIso.ts +20 -0
  1062. package/src/internal/schema/toJsonSchemaDocument.ts +125 -67
  1063. package/src/internal/schema/toRepresentation.ts +1 -1
  1064. package/src/internal/schemaError.ts +8 -0
  1065. package/src/internal/stream.ts +14 -6
  1066. package/src/internal/tracer.ts +4 -0
  1067. package/src/internal/trie.ts +5 -2
  1068. package/src/internal/uuid.ts +4 -0
  1069. package/src/testing/TestSchema.ts +36 -30
  1070. package/src/testing/index.ts +0 -5
  1071. package/src/unstable/ai/AiError.ts +69 -5
  1072. package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -1
  1073. package/src/unstable/ai/Chat.ts +35 -36
  1074. package/src/unstable/ai/EmbeddingModel.ts +27 -15
  1075. package/src/unstable/ai/LanguageModel.ts +283 -100
  1076. package/src/unstable/ai/McpServer.ts +36 -20
  1077. package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -1
  1078. package/src/unstable/ai/Prompt.ts +19 -4
  1079. package/src/unstable/ai/Response.ts +107 -189
  1080. package/src/unstable/ai/Tokenizer.ts +4 -5
  1081. package/src/unstable/ai/Tool.ts +58 -35
  1082. package/src/unstable/ai/Toolkit.ts +43 -37
  1083. package/src/unstable/ai/internal/structured-output.ts +5 -5
  1084. package/src/unstable/arbitrary/Arbitrary.ts +715 -0
  1085. package/src/unstable/arbitrary/index.ts +10 -0
  1086. package/src/unstable/cli/Argument.ts +111 -115
  1087. package/src/unstable/cli/CliError.ts +2 -0
  1088. package/src/unstable/cli/CliOutput.ts +40 -3
  1089. package/src/unstable/cli/Command.ts +74 -74
  1090. package/src/unstable/cli/Completions.ts +4 -4
  1091. package/src/unstable/cli/Flag.ts +158 -169
  1092. package/src/unstable/cli/GlobalFlag.ts +13 -13
  1093. package/src/unstable/cli/Param.ts +150 -159
  1094. package/src/unstable/cli/Primitive.ts +75 -76
  1095. package/src/unstable/cli/Prompt.ts +88 -87
  1096. package/src/unstable/cli/internal/completions/descriptor.ts +23 -11
  1097. package/src/unstable/cli/internal/completions/zsh.ts +2 -2
  1098. package/src/unstable/cli/internal/config.ts +4 -4
  1099. package/src/unstable/cli/internal/parser.ts +1 -1
  1100. package/src/unstable/cli/internal/wizard.ts +18 -13
  1101. package/src/unstable/cluster/ClusterSchema.ts +19 -1
  1102. package/src/unstable/cluster/ClusterWorkflowEngine.ts +66 -16
  1103. package/src/unstable/cluster/Entity.ts +3 -0
  1104. package/src/unstable/cluster/EntityProxyServer.ts +6 -2
  1105. package/src/unstable/cluster/Envelope.ts +3 -3
  1106. package/src/unstable/cluster/HttpRunner.ts +7 -2
  1107. package/src/unstable/cluster/MessageStorage.ts +62 -21
  1108. package/src/unstable/cluster/Reply.ts +2 -2
  1109. package/src/unstable/cluster/Sharding.ts +44 -19
  1110. package/src/unstable/cluster/ShardingConfig.ts +23 -23
  1111. package/src/unstable/cluster/SocketRunner.ts +5 -4
  1112. package/src/unstable/cluster/SqlMessageStorage.ts +12 -8
  1113. package/src/unstable/cluster/SqlRunnerStorage.ts +18 -10
  1114. package/src/unstable/cluster/internal/clusterAbandon.ts +14 -0
  1115. package/src/unstable/cluster/internal/entityManager.ts +12 -4
  1116. package/src/unstable/cluster/internal/interruptors.ts +58 -1
  1117. package/src/unstable/cluster/internal/resourceRef.ts +15 -7
  1118. package/src/unstable/devtools/DevToolsClient.ts +13 -3
  1119. package/src/unstable/encoding/Ini.ts +2 -0
  1120. package/src/unstable/encoding/SchemaBinary.ts +150 -44
  1121. package/src/unstable/encoding/Sse.ts +1 -1
  1122. package/src/unstable/encoding/Toml.ts +7 -5
  1123. package/src/unstable/encoding/Yaml.ts +18 -5
  1124. package/src/unstable/encoding/index.ts +0 -5
  1125. package/src/unstable/eventlog/Event.ts +7 -7
  1126. package/src/unstable/eventlog/EventJournal.ts +9 -9
  1127. package/src/unstable/eventlog/EventLog.ts +5 -5
  1128. package/src/unstable/eventlog/EventLogMessage.ts +25 -15
  1129. package/src/unstable/eventlog/EventLogRemote.ts +15 -4
  1130. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +2 -2
  1131. package/src/unstable/eventlog/SqlEventJournal.ts +32 -9
  1132. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +11 -1
  1133. package/src/unstable/http/Cookies.ts +2 -102
  1134. package/src/unstable/http/FetchHttpClient.ts +1 -1
  1135. package/src/unstable/http/FindMyWay/internal/router.ts +139 -33
  1136. package/src/unstable/http/FindMyWay.ts +15 -5
  1137. package/src/unstable/http/Headers.ts +3 -48
  1138. package/src/unstable/http/HttpBody.ts +107 -36
  1139. package/src/unstable/http/HttpClient.ts +41 -30
  1140. package/src/unstable/http/HttpClientRequest.ts +32 -18
  1141. package/src/unstable/http/HttpClientResponse.ts +16 -3
  1142. package/src/unstable/http/HttpEffect.ts +145 -73
  1143. package/src/unstable/http/HttpIncomingMessage.ts +4 -4
  1144. package/src/unstable/http/HttpMiddleware.ts +43 -24
  1145. package/src/unstable/http/HttpPlatform.ts +62 -20
  1146. package/src/unstable/http/HttpRouter.ts +27 -16
  1147. package/src/unstable/http/HttpServer.ts +18 -57
  1148. package/src/unstable/http/HttpServerRequest.ts +17 -15
  1149. package/src/unstable/http/HttpServerRespondable.ts +1 -1
  1150. package/src/unstable/http/HttpServerResponse.ts +49 -40
  1151. package/src/unstable/http/HttpStaticServer.ts +30 -28
  1152. package/src/unstable/http/Mime.ts +76 -0
  1153. package/src/unstable/http/Multipart.ts +35 -18
  1154. package/src/unstable/http/MultipartParser/internal/multipart.ts +10 -3
  1155. package/src/unstable/http/MultipartParser.ts +4 -3
  1156. package/src/unstable/http/UrlParams.ts +3 -161
  1157. package/src/unstable/http/index.ts +5 -0
  1158. package/src/unstable/http/internal/compression.ts +11 -12
  1159. package/src/unstable/http/internal/headers.ts +7 -0
  1160. package/src/unstable/http/internal/httpBody.ts +9 -0
  1161. package/src/unstable/http/internal/mimeTypes.ts +395 -0
  1162. package/src/unstable/httpapi/HttpApiBuilder.ts +52 -6
  1163. package/src/unstable/httpapi/HttpApiClient.ts +44 -24
  1164. package/src/unstable/httpapi/HttpApiEndpoint.ts +24 -11
  1165. package/src/unstable/httpapi/HttpApiError.ts +3 -1
  1166. package/src/unstable/httpapi/HttpApiMiddleware.ts +7 -5
  1167. package/src/unstable/httpapi/HttpApiSchema.ts +14 -7
  1168. package/src/unstable/httpapi/HttpApiTest.ts +6 -1
  1169. package/src/unstable/httpapi/OpenApi.ts +32 -22
  1170. package/src/unstable/net/IpInterface.ts +242 -0
  1171. package/src/unstable/net/IpNetwork.ts +357 -0
  1172. package/src/unstable/net/NetAddress.ts +1271 -0
  1173. package/src/unstable/net/index.ts +20 -0
  1174. package/src/unstable/observability/OtlpExporter.ts +5 -6
  1175. package/src/unstable/observability/OtlpLogger.ts +9 -9
  1176. package/src/unstable/observability/OtlpMetrics.ts +9 -8
  1177. package/src/unstable/observability/OtlpResource.ts +5 -4
  1178. package/src/unstable/observability/OtlpTracer.ts +103 -81
  1179. package/src/unstable/observability/internal/otlpEnv.ts +10 -13
  1180. package/src/unstable/persistence/PersistedCache.ts +1 -1
  1181. package/src/unstable/persistence/PersistedQueue.ts +1100 -291
  1182. package/src/unstable/persistence/RateLimiter.ts +64 -58
  1183. package/src/unstable/process/ChildProcess.ts +15 -4
  1184. package/src/unstable/process/ChildProcessSpawner.ts +1 -1
  1185. package/src/unstable/reactivity/Atom.ts +6 -3
  1186. package/src/unstable/reactivity/AtomHttpApi.ts +21 -10
  1187. package/src/unstable/reactivity/AtomRegistry.ts +2 -4
  1188. package/src/unstable/reactivity/AtomRpc.ts +6 -5
  1189. package/src/unstable/reactivity/Hydration.ts +26 -7
  1190. package/src/unstable/reactivity/Reactivity.ts +49 -36
  1191. package/src/unstable/rpc/RpcClient.ts +62 -59
  1192. package/src/unstable/rpc/RpcMessage.ts +3 -1
  1193. package/src/unstable/rpc/RpcMiddleware.ts +7 -5
  1194. package/src/unstable/rpc/RpcSerialization.ts +27 -117
  1195. package/src/unstable/rpc/RpcServer.ts +143 -80
  1196. package/src/unstable/schema/Model.ts +8 -7
  1197. package/src/unstable/schema/VariantSchema.ts +3 -0
  1198. package/src/unstable/socket/Socket.ts +714 -383
  1199. package/src/unstable/socket/SocketServer.ts +5 -35
  1200. package/src/unstable/sql/SqlClient.ts +42 -7
  1201. package/src/unstable/sql/SqlConnection.ts +18 -0
  1202. package/src/unstable/sql/SqlModel.ts +1 -1
  1203. package/src/unstable/sql/Statement.ts +46 -20
  1204. package/src/unstable/workers/Transferable.ts +1 -1
  1205. package/src/unstable/workers/Worker.ts +3 -1
  1206. package/src/unstable/workflow/Activity.ts +20 -9
  1207. package/src/unstable/workflow/DurableClock.ts +1 -1
  1208. package/src/unstable/workflow/DurableDeferred.ts +6 -0
  1209. package/src/unstable/workflow/DurableQueue.ts +8 -0
  1210. package/src/unstable/workflow/Workflow.ts +105 -28
  1211. package/src/unstable/workflow/WorkflowEngine.ts +22 -0
  1212. package/dist/internal/schema/schema.d.ts.map +0 -1
  1213. package/dist/internal/schema/schema.js.map +0 -1
  1214. package/dist/internal/schema/toArbitrary.d.ts +0 -2
  1215. package/dist/internal/schema/toArbitrary.d.ts.map +0 -1
  1216. package/dist/internal/schema/toArbitrary.js +0 -705
  1217. package/dist/internal/schema/toArbitrary.js.map +0 -1
  1218. package/dist/testing/FastCheck.d.ts +0 -90
  1219. package/dist/testing/FastCheck.d.ts.map +0 -1
  1220. package/dist/testing/FastCheck.js +0 -90
  1221. package/dist/testing/FastCheck.js.map +0 -1
  1222. package/dist/unstable/encoding/Msgpack.d.ts +0 -185
  1223. package/dist/unstable/encoding/Msgpack.d.ts.map +0 -1
  1224. package/dist/unstable/encoding/Msgpack.js +0 -227
  1225. package/dist/unstable/encoding/Msgpack.js.map +0 -1
  1226. package/src/internal/schema/toArbitrary.ts +0 -843
  1227. package/src/testing/FastCheck.ts +0 -90
  1228. package/src/unstable/encoding/Msgpack.ts +0 -432
  1229. /package/dist/internal/{schema → arbitrary}/schema.d.ts +0 -0
@@ -18,7 +18,6 @@ import * as Iterable from "../Iterable.ts"
18
18
  import type * as _Latch from "../Latch.ts"
19
19
  import type * as Logger from "../Logger.ts"
20
20
  import type * as LogLevel from "../LogLevel.ts"
21
- import type * as Metric from "../Metric.ts"
22
21
  import * as Option from "../Option.ts"
23
22
  import * as Order from "../Order.ts"
24
23
  import { pipeArguments } from "../Pipeable.ts"
@@ -105,7 +104,7 @@ import { addSpanStackTrace, makeStackCleaner } from "./tracer.ts"
105
104
 
106
105
  /** @internal */
107
106
  export class Interrupt extends ReasonBase<"Interrupt"> implements Cause.Interrupt {
108
- readonly fiberId: number | undefined
107
+ declare readonly fiberId: number | undefined
109
108
  constructor(
110
109
  fiberId: number | undefined,
111
110
  annotations = constEmptyAnnotations
@@ -238,6 +237,29 @@ export const causeAnnotations = <E>(
238
237
  return Context.makeUnsafe(map)
239
238
  }
240
239
 
240
+ const dedupeReasons = <E>(
241
+ self: ReadonlyArray<Cause.Reason<E>>,
242
+ that: ReadonlyArray<Cause.Reason<E>>
243
+ ): Array<Cause.Reason<E>> => {
244
+ // Keep deduplication local so causeCombine does not retain Array.ts in the core bundle.
245
+ // Snapshot both arrays before invoking user-defined hash or equality methods.
246
+ const buckets = new Map<number, Array<Cause.Reason<E>>>()
247
+ const out: Array<Cause.Reason<E>> = []
248
+ for (const reason of self.concat(that)) {
249
+ const hash = Hash.hash(reason)
250
+ const bucket = buckets.get(hash)
251
+ if (bucket === undefined) {
252
+ buckets.set(hash, [reason])
253
+ } else if (bucket.some((previous) => Equal.equals(previous, reason))) {
254
+ continue
255
+ } else {
256
+ bucket.push(reason)
257
+ }
258
+ out.push(reason)
259
+ }
260
+ return out
261
+ }
262
+
241
263
  /** @internal */
242
264
  export const causeCombine: {
243
265
  <E2>(that: Cause.Cause<E2>): <E>(self: Cause.Cause<E>) => Cause.Cause<E | E2>
@@ -251,7 +273,7 @@ export const causeCombine: {
251
273
  return self as Cause.Cause<E | E2>
252
274
  }
253
275
  const newCause = new CauseImpl<E | E2>(
254
- Arr.union(self.reasons, that.reasons)
276
+ dedupeReasons<E | E2>(self.reasons, that.reasons)
255
277
  )
256
278
  return Equal.equals(self, newCause) ? self : newCause
257
279
  }
@@ -317,7 +339,7 @@ export const causePrettyErrors = <E>(self: Cause.Cause<E>, options?: {
317
339
  if (self.reasons.length === 0) return errors
318
340
 
319
341
  const prevStackLimit = getStackTraceLimit()
320
- setStackTraceLimit(1)
342
+ if (prevStackLimit !== 0) setStackTraceLimit(1)
321
343
 
322
344
  for (const failure of self.reasons) {
323
345
  if (failure._tag === "Interrupt") {
@@ -342,7 +364,7 @@ export const causePrettyErrors = <E>(self: Cause.Cause<E>, options?: {
342
364
  errors.push(causePrettyError(error, interrupts[0].annotations, options))
343
365
  }
344
366
 
345
- setStackTraceLimit(prevStackLimit)
367
+ if (prevStackLimit !== 0) setStackTraceLimit(prevStackLimit)
346
368
  return errors
347
369
  }
348
370
 
@@ -513,14 +535,15 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
513
535
  this.currentOpCount = 0
514
536
  this.interruptible = interruptible
515
537
  this._stack = []
516
- this._observers = []
538
+ this._observers = undefined
517
539
  this._exit = undefined
518
540
  this._children = undefined
519
541
  this._interruptedCause = undefined
520
542
  this._yielded = undefined
521
543
  this._running = false
522
544
  this._deferredInterrupt = false
523
- this.runtimeMetrics?.recordFiberStart(this.context)
545
+ this._parent = undefined
546
+ this.cache.runtimeMetrics?.recordFiberStart(this.context)
524
547
  }
525
548
 
526
549
  readonly [FiberTypeId]: Fiber.Fiber.Variance<A, E>
@@ -529,29 +552,22 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
529
552
  interruptible: boolean
530
553
  currentOpCount: number
531
554
  readonly _stack: Array<Primitive>
532
- readonly _observers: Array<(exit: Exit.Exit<A, E>) => void>
555
+ _observers: Array<(exit: Exit.Exit<A, E>) => void> | undefined
533
556
  _exit: Exit.Exit<A, E> | undefined
534
557
  _children: Set<FiberImpl<any, any>> | undefined
535
558
  _interruptedCause: Cause.Cause<never> | undefined
536
559
  _yielded: Exit.Exit<any, any> | (() => void) | undefined
537
560
  _running: boolean
538
561
  _deferredInterrupt: boolean
562
+ _parent: FiberImpl<any, any> | undefined
539
563
 
540
564
  // set in setContext
541
565
  context!: Context.Context<never>
542
- currentScheduler!: Scheduler.Scheduler
543
- currentTracerContext: Tracer.Tracer["context"]
544
- currentSpan: Tracer.AnySpan | undefined
545
- currentLogLevel!: LogLevel.LogLevel
546
- minimumLogLevel!: LogLevel.LogLevel
547
- currentStackFrame: StackFrame | undefined
548
- runtimeMetrics: Metric.FiberRuntimeMetricsService | undefined
549
- maxOpsBeforeYield!: number
550
- currentPreventYield!: boolean
566
+ cache!: Fiber.Fiber.Cache
551
567
 
552
568
  _dispatcher: Scheduler.SchedulerDispatcher | undefined = undefined
553
569
  get currentDispatcher(): Scheduler.SchedulerDispatcher {
554
- return this._dispatcher ??= this.currentScheduler.makeDispatcher()
570
+ return this._dispatcher ??= this.cache.scheduler.makeDispatcher()
555
571
  }
556
572
 
557
573
  getRef<X>(ref: Context.Reference<X>): X {
@@ -562,9 +578,13 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
562
578
  cb(this._exit)
563
579
  return constVoid
564
580
  }
565
- this._observers.push(cb)
581
+ if (this._observers === undefined) {
582
+ this._observers = [cb]
583
+ } else {
584
+ this._observers.push(cb)
585
+ }
566
586
  return () => {
567
- if (this._exit) return
587
+ if (this._exit || this._observers === undefined) return
568
588
  const index = this._observers.indexOf(cb)
569
589
  if (index >= 0) {
570
590
  this._observers.splice(index, 1)
@@ -576,8 +596,8 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
576
596
  return
577
597
  }
578
598
  let cause = causeInterrupt(fiberId)
579
- if (this.currentStackFrame) {
580
- cause = causeAnnotate(cause, Context.make(CauseStackTrace, this.currentStackFrame))
599
+ if (this.cache.stackFrame) {
600
+ cause = causeAnnotate(cause, Context.make(CauseStackTrace, this.cache.stackFrame))
581
601
  }
582
602
  if (annotations) {
583
603
  cause = causeAnnotate(cause, annotations)
@@ -617,11 +637,18 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
617
637
  }
618
638
 
619
639
  this._exit = exit
620
- this.runtimeMetrics?.recordFiberEnd(this.context, this._exit)
621
- for (let i = 0; i < this._observers.length; i++) {
622
- this._observers[i](exit)
640
+ this.cache.runtimeMetrics?.recordFiberEnd(this.context, this._exit)
641
+ if (this._parent) {
642
+ this._parent._children?.delete(this)
643
+ this._parent = undefined
644
+ }
645
+ if (this._observers !== undefined) {
646
+ const observers = this._observers
647
+ this._observers = undefined
648
+ for (let i = 0; i < observers.length; i++) {
649
+ observers[i](exit)
650
+ }
623
651
  }
624
- this._observers.length = 0
625
652
  this._stack.length = 0
626
653
  this._children = undefined
627
654
  this.context = Context.empty()
@@ -641,17 +668,19 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
641
668
  current = failCause(this._interruptedCause!) as any
642
669
  }
643
670
  this.currentOpCount++
671
+ // Refresh the cache because a primitive can replace the fiber context.
672
+ const cache = this.cache
644
673
  if (
645
674
  !yielding &&
646
- !this.currentPreventYield &&
647
- this.currentScheduler.shouldYield(this as any)
675
+ !cache.preventYield &&
676
+ cache.scheduler.shouldYield(this as any)
648
677
  ) {
649
678
  yielding = true
650
679
  const prev = current
651
680
  current = flatMap(yieldNow, () => prev as any) as any
652
681
  }
653
- current = this.currentTracerContext
654
- ? this.currentTracerContext(current as any, this)
682
+ current = cache.tracerContext
683
+ ? cache.tracerContext(current as any, this)
655
684
  : (current as any)[evaluate](this)
656
685
  if (current === Yield) {
657
686
  const yielded = this._yielded!
@@ -688,10 +717,13 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
688
717
  while (true) {
689
718
  const op = this._stack.pop()
690
719
  if (!op) return undefined
691
- const cont = op[contAll] && op[contAll](this)
692
- if (cont) {
693
- ;(cont as any)[symbol] = cont
694
- return cont as any
720
+ const all = op[contAll]
721
+ if (all !== undefined) {
722
+ const cont = all.call(op, this)
723
+ if (cont) {
724
+ ;(cont as any)[symbol] = cont
725
+ return cont as any
726
+ }
695
727
  }
696
728
  if (op[symbol]) return op as any
697
729
  }
@@ -712,25 +744,38 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
712
744
  // Every key cached below opts in to Context caching, so contexts related
713
745
  // only by non-caching adds cannot have changed any of them
714
746
  if (previous !== undefined && Context.hasSameCache(previous, context)) return
715
- const scheduler = this.getRef(Scheduler.Scheduler)
716
- if (scheduler !== this.currentScheduler) {
717
- this.currentScheduler = scheduler
747
+ // Contexts sharing a cacheRoot resolve every cached key identically, so
748
+ // the derived cache object is computed once per root and shared by all
749
+ // fibers running with that root (forked fibers reuse the parent's).
750
+ const root: any = (context as any).cacheRoot
751
+ const cache: Fiber.Fiber.Cache = root._fiberCache ??= makeFiberContextCache(context)
752
+ if (this.cache !== undefined && this.cache.scheduler !== cache.scheduler) {
718
753
  this._dispatcher = undefined
719
754
  }
720
- // The string-keyed lookups keep the Tracer key values (and the native
721
- // tracer behind Tracer.Tracer's default) out of every bundle
722
- this.currentSpan = Context.getOrUndefinedUnsafe(context, Tracer.ParentSpanKey)
723
- this.currentLogLevel = this.getRef(CurrentLogLevel)
724
- this.minimumLogLevel = this.getRef(MinimumLogLevel)
725
- this.currentStackFrame = this.getRef(CurrentStackFrame)
726
- this.maxOpsBeforeYield = this.getRef(Scheduler.MaxOpsBeforeYield)
727
- this.currentPreventYield = this.getRef(Scheduler.PreventSchedulerYield)
728
- this.runtimeMetrics = Context.getOrUndefinedUnsafe(context, InternalMetric.FiberRuntimeMetricsKey)
729
- const currentTracer = Context.getOrUndefinedUnsafe<Tracer.Tracer>(context, Tracer.TracerKey)
730
- this.currentTracerContext = currentTracer ? currentTracer["context"] : undefined
755
+ this.cache = cache
731
756
  }
732
757
  get currentSpanLocal(): Tracer.Span | undefined {
733
- return this.currentSpan?._tag === "Span" ? this.currentSpan : undefined
758
+ const span = this.cache.span
759
+ return span?._tag === "Span" ? span : undefined
760
+ }
761
+ }
762
+
763
+ const makeFiberContextCache = (context: Context.Context<never>): Fiber.Fiber.Cache => {
764
+ // The string-keyed lookups keep the Tracer key values (and the native
765
+ // tracer behind Tracer.Tracer's default) out of every bundle
766
+ const currentTracer = Context.getOrUndefinedUnsafe<Tracer.Tracer>(context, Tracer.TracerKey)
767
+ return {
768
+ scheduler: Context.get(context, Scheduler.Scheduler),
769
+ tracer: currentTracer,
770
+ tracerContext: currentTracer ? currentTracer["context"] : undefined,
771
+ tracerEnabled: Context.get(context, TracerEnabled),
772
+ span: Context.getOrUndefinedUnsafe(context, Tracer.ParentSpanKey),
773
+ logLevel: Context.get(context, CurrentLogLevel),
774
+ minimumLogLevel: Context.get(context, MinimumLogLevel),
775
+ stackFrame: Context.get(context, CurrentStackFrame),
776
+ runtimeMetrics: Context.getOrUndefinedUnsafe(context, InternalMetric.FiberRuntimeMetricsKey),
777
+ maxOpsBeforeYield: Context.get(context, Scheduler.MaxOpsBeforeYield),
778
+ preventYield: Context.get(context, Scheduler.PreventSchedulerYield)
734
779
  }
735
780
  }
736
781
 
@@ -750,9 +795,9 @@ const fiberMiddleware = {
750
795
  }
751
796
 
752
797
  const fiberStackAnnotations = (fiber: Fiber.Fiber<any, any>) => {
753
- if (!fiber.currentStackFrame) return undefined
798
+ if (!fiber.cache.stackFrame) return undefined
754
799
  const annotations = new Map<string, unknown>()
755
- annotations.set(InterruptorStackTrace.key, fiber.currentStackFrame)
800
+ annotations.set(InterruptorStackTrace.key, fiber.cache.stackFrame)
756
801
  return Context.makeUnsafe(annotations)
757
802
  }
758
803
 
@@ -1106,41 +1151,50 @@ const callbackOptions: <A, E = never, R = never>(
1106
1151
  signal?: AbortSignal
1107
1152
  ) => void | Effect.Effect<void, never, R>,
1108
1153
  withSignal: boolean
1109
- ) => Effect.Effect<A, E, R> = makePrimitive({
1110
- op: "Async",
1111
- single: false,
1112
- [evaluate](fiber) {
1113
- const register = internalCall(() => this[args][0].bind(fiber.currentScheduler))
1114
- let resumed = false
1115
- let yielded: boolean | Primitive = false
1116
- const controller = this[args][1] ? new AbortController() : undefined
1117
- const onCancel = register((effect) => {
1118
- if (resumed) return
1119
- resumed = true
1120
- if (yielded) {
1121
- fiber.evaluate(effect as any)
1122
- } else {
1123
- yielded = effect as any
1154
+ ) => Effect.Effect<A, E, R> = (function() {
1155
+ const Proto = makePrimitiveProto({
1156
+ op: "Async",
1157
+ [evaluate](this: any, fiber) {
1158
+ const register = internalCall(() => this.register.bind(fiber.cache.scheduler))
1159
+ let resumed = false
1160
+ let yielded: boolean | Primitive = false
1161
+ const controller = this.withSignal ? new AbortController() : undefined
1162
+ const onCancel = register((effect: Effect.Effect<any, any, any>) => {
1163
+ if (resumed) return
1164
+ resumed = true
1165
+ if (yielded) {
1166
+ fiber.evaluate(effect as any)
1167
+ } else {
1168
+ yielded = effect as any
1169
+ }
1170
+ }, controller?.signal)
1171
+ if (yielded !== false) return yielded
1172
+ yielded = true
1173
+ fiber._yielded = () => {
1174
+ resumed = true
1124
1175
  }
1125
- }, controller?.signal)
1126
- if (yielded !== false) return yielded
1127
- yielded = true
1128
- fiber._yielded = () => {
1129
- resumed = true
1130
- }
1131
- if (controller === undefined && onCancel === undefined) {
1176
+ if (controller === undefined && onCancel === undefined) {
1177
+ return Yield
1178
+ }
1179
+ fiber._stack.push(
1180
+ asyncFinalizer(() => {
1181
+ resumed = true
1182
+ controller?.abort()
1183
+ return onCancel ?? exitVoid
1184
+ })
1185
+ )
1132
1186
  return Yield
1133
1187
  }
1134
- fiber._stack.push(
1135
- asyncFinalizer(() => {
1136
- resumed = true
1137
- controller?.abort()
1138
- return onCancel ?? exitVoid
1139
- })
1140
- )
1141
- return Yield
1142
- }
1143
- })
1188
+ })
1189
+ const AsyncImpl = function(this: any, register: any, withSignal: boolean) {
1190
+ this.register = register
1191
+ this.withSignal = withSignal
1192
+ } as unknown as PrimitiveCtor<[register: any, withSignal: boolean]>
1193
+ AsyncImpl.prototype = Proto
1194
+ return function(register: any, withSignal: boolean) {
1195
+ return new AsyncImpl(register, withSignal)
1196
+ } as any
1197
+ })()
1144
1198
 
1145
1199
  const asyncFinalizer: (
1146
1200
  onInterrupt: () => Effect.Effect<void, any, any>
@@ -1188,12 +1242,14 @@ export const gen = <
1188
1242
  [Eff] extends [never] ? never
1189
1243
  : [Eff] extends [Effect.Effect<infer _A, infer _E, infer R>] ? R
1190
1244
  : never
1191
- > =>
1192
- suspend(() =>
1193
- fromIteratorUnsafe(
1194
- args.length === 1 ? args[0]() : (args[1].call(args[0].self) as any)
1195
- )
1196
- )
1245
+ > => {
1246
+ if (args.length === 1) {
1247
+ const body = args[0]
1248
+ return suspend(() => fromIteratorUnsafe(body()))
1249
+ }
1250
+ const [options, body] = args
1251
+ return suspend(() => fromIteratorUnsafe(body.call(options.self) as any))
1252
+ }
1197
1253
 
1198
1254
  /** @internal */
1199
1255
  export const fnUntraced: Effect.fn.Untraced = (
@@ -1229,9 +1285,12 @@ export const fn: typeof Effect.fn = function() {
1229
1285
  const spanOptions = nameFirst ? arguments[1] : undefined
1230
1286
 
1231
1287
  const prevLimit = getStackTraceLimit()
1232
- setStackTraceLimit(2)
1233
- const defError = new globalThis.Error()
1234
- setStackTraceLimit(prevLimit)
1288
+ let defError: Error | undefined
1289
+ if (prevLimit !== 0) {
1290
+ setStackTraceLimit(2)
1291
+ defError = new globalThis.Error()
1292
+ setStackTraceLimit(prevLimit)
1293
+ }
1235
1294
 
1236
1295
  if (nameFirst) {
1237
1296
  return (body: Function | { readonly self: any }, ...pipeables: Array<Function>) =>
@@ -1251,7 +1310,7 @@ export const fn: typeof Effect.fn = function() {
1251
1310
  const makeFn = (
1252
1311
  name: string,
1253
1312
  bodyOrOptions: Function | { readonly self: any },
1254
- defError: Error,
1313
+ defError: Error | undefined,
1255
1314
  pipeables: Array<Function>,
1256
1315
  addSpan: boolean,
1257
1316
  spanOptions: Tracer.SpanOptionsNoTrace | undefined
@@ -1272,9 +1331,12 @@ const makeFn = (
1272
1331
  return result
1273
1332
  }
1274
1333
  const prevLimit = getStackTraceLimit()
1275
- setStackTraceLimit(2)
1276
- const callError = new globalThis.Error()
1277
- setStackTraceLimit(prevLimit)
1334
+ let callError: Error | undefined
1335
+ if (prevLimit !== 0) {
1336
+ setStackTraceLimit(2)
1337
+ callError = new globalThis.Error()
1338
+ setStackTraceLimit(prevLimit)
1339
+ }
1278
1340
  return updateService(
1279
1341
  addSpan ?
1280
1342
  useSpan(name, spanOptions!, (span) => provideParentSpan(result, span)) :
@@ -1282,10 +1344,10 @@ const makeFn = (
1282
1344
  CurrentStackFrame,
1283
1345
  (prev) => ({
1284
1346
  name,
1285
- stack: fnStackCleaner(() => callError.stack),
1347
+ stack: callError ? fnStackCleaner(() => callError.stack) : constUndefined,
1286
1348
  parent: {
1287
1349
  name: `${name} (definition)`,
1288
- stack: fnStackCleaner(() => defError.stack),
1350
+ stack: defError ? fnStackCleaner(() => defError.stack) : constUndefined,
1289
1351
  parent: prev
1290
1352
  }
1291
1353
  })
@@ -1307,7 +1369,7 @@ export const fnUntracedEager: Effect.fn.Untraced = (
1307
1369
  : function(this: any) {
1308
1370
  let effect = fromIteratorEagerUnsafe(() => body.apply(this, arguments))
1309
1371
  for (const pipeable of pipeables) {
1310
- effect = pipeable(effect)
1372
+ effect = pipeable(effect, ...arguments)
1311
1373
  }
1312
1374
  return effect
1313
1375
  }
@@ -1356,27 +1418,36 @@ const fromIteratorEagerUnsafe = (
1356
1418
  const fromIteratorUnsafe: (
1357
1419
  iterator: Iterator<Effect.Effect<any, any, any>>,
1358
1420
  initial?: undefined
1359
- ) => Effect.Effect<any, any, any> = makePrimitive({
1360
- op: "Iterator",
1361
- single: false,
1362
- [contA](value, fiber) {
1363
- const iter = this[args][0]
1364
- while (true) {
1365
- const state = iter.next(value)
1366
- if (state.done) return succeed(state.value)
1367
- if (!effectIsExit(state.value)) {
1368
- fiber._stack.push(this)
1369
- return state.value
1370
- } else if (state.value._tag === "Failure") {
1371
- return state.value
1421
+ ) => Effect.Effect<any, any, any> = (function() {
1422
+ const Proto = makePrimitiveProto({
1423
+ op: "Iterator",
1424
+ [contA](this: any, value, fiber) {
1425
+ const iter = this.iterator
1426
+ while (true) {
1427
+ const state = iter.next(value)
1428
+ if (state.done) return succeed(state.value)
1429
+ if (!effectIsExit(state.value)) {
1430
+ fiber._stack.push(this)
1431
+ return state.value
1432
+ } else if (state.value._tag === "Failure") {
1433
+ return state.value
1434
+ }
1435
+ value = state.value.value
1372
1436
  }
1373
- value = state.value.value
1437
+ },
1438
+ [evaluate](this: any, fiber: FiberImpl) {
1439
+ return this[contA](this.initial, fiber)
1374
1440
  }
1375
- },
1376
- [evaluate](this: any, fiber: FiberImpl) {
1377
- return this[contA](this[args][1], fiber)
1378
- }
1379
- })
1441
+ })
1442
+ const IteratorImpl = function(this: any, iterator: any, initial: any) {
1443
+ this.iterator = iterator
1444
+ this.initial = initial
1445
+ } as unknown as PrimitiveCtor<[iterator: any, initial: any]>
1446
+ IteratorImpl.prototype = Proto
1447
+ return function(iterator: any, initial?: undefined) {
1448
+ return new IteratorImpl(iterator, initial)
1449
+ } as any
1450
+ })()
1380
1451
 
1381
1452
  // ----------------------------------------------------------------------------
1382
1453
  // mapping & sequencing
@@ -1393,12 +1464,71 @@ export const as: {
1393
1464
  <A, E, R, B>(
1394
1465
  self: Effect.Effect<A, E, R>,
1395
1466
  value: B
1396
- ): Effect.Effect<B, E, R> => {
1397
- const b = succeed(value)
1398
- return flatMap(self, (_) => b)
1399
- }
1467
+ ): Effect.Effect<B, E, R> => new ContImpl(self, returnPayload, succeed(value))
1400
1468
  )
1401
1469
 
1470
+ const evaluateCont = function(this: any, fiber: FiberImpl): Primitive {
1471
+ fiber._stack.push(this)
1472
+ return this[args]
1473
+ }
1474
+
1475
+ interface PrimitiveCtor<Args extends Array<any>> {
1476
+ new(...args: Args): Primitive & Effect.Effect<any, any, any>
1477
+ prototype: any
1478
+ }
1479
+
1480
+ const OnSuccessProto = makePrimitiveProto({
1481
+ op: "OnSuccess",
1482
+ [evaluate]: evaluateCont
1483
+ })
1484
+
1485
+ const OnSuccessImpl = function(this: any, self: Effect.Effect<any, any, any>, f: any) {
1486
+ this[args] = self
1487
+ this[contA] = f
1488
+ } as unknown as PrimitiveCtor<[self: Effect.Effect<any, any, any>, f: any]>
1489
+ OnSuccessImpl.prototype = OnSuccessProto
1490
+
1491
+ // A success continuation with an extra payload slot. The stored continuation
1492
+ // receives the primitive as `this` and reads `this.payload`, so combinators
1493
+ // like map / as / tap / andThen can share module-level continuation functions
1494
+ // instead of allocating a closure per call.
1495
+ const ContImpl = function(
1496
+ this: any,
1497
+ self: Effect.Effect<any, any, any>,
1498
+ cont: (this: { readonly payload: any }, value: any, fiber: FiberImpl) => unknown,
1499
+ payload: unknown
1500
+ ) {
1501
+ this[args] = self
1502
+ this[contA] = cont
1503
+ this.payload = payload
1504
+ } as unknown as PrimitiveCtor<
1505
+ [
1506
+ self: Effect.Effect<any, any, any>,
1507
+ cont: (this: { readonly payload: any }, value: any, fiber: FiberImpl) => unknown,
1508
+ payload: unknown
1509
+ ]
1510
+ >
1511
+ ContImpl.prototype = OnSuccessProto
1512
+
1513
+ const returnPayload = function(this: { readonly payload: any }) {
1514
+ return this.payload
1515
+ }
1516
+ const mapCont = function(this: { readonly payload: any }, value: any) {
1517
+ const f = this.payload
1518
+ return succeed(internalCall(() => f(value)))
1519
+ }
1520
+ const andThenCont = function(this: { readonly payload: any }, value: any) {
1521
+ const f = this.payload
1522
+ return internalCall(() => f(value))
1523
+ }
1524
+ const tapCont = function(this: { readonly payload: any }, value: any) {
1525
+ const f = this.payload
1526
+ return new ContImpl(internalCall(() => f(value)), returnPayload, exitSucceed(value))
1527
+ }
1528
+ const tapEffectCont = function(this: { readonly payload: any }, value: any) {
1529
+ return new ContImpl(this.payload, returnPayload, exitSucceed(value))
1530
+ }
1531
+
1402
1532
  /** @internal */
1403
1533
  export const asSome = <A, E, R>(
1404
1534
  self: Effect.Effect<A, E, R>
@@ -1434,8 +1564,7 @@ export const andThen: {
1434
1564
  <A, E, R, B, E2, R2>(
1435
1565
  self: Effect.Effect<A, E, R>,
1436
1566
  f: ((a: A) => Effect.Effect<B, E2, R2>) | Effect.Effect<B, E2, R2>
1437
- ): Effect.Effect<B, E | E2, R | R2> =>
1438
- flatMap(self, (a) => isEffect(f) ? f : internalCall(() => (f as (a: A) => Effect.Effect<B, E2, R2>)(a)))
1567
+ ): Effect.Effect<B, E | E2, R | R2> => new ContImpl(self, isEffect(f) ? returnPayload : andThenCont, f)
1439
1568
  )
1440
1569
 
1441
1570
  /** @internal */
@@ -1459,14 +1588,13 @@ export const tap: {
1459
1588
  <A, E, R, B, E2, R2>(
1460
1589
  self: Effect.Effect<A, E, R>,
1461
1590
  f: ((a: A) => Effect.Effect<B, E2, R2>) | Effect.Effect<B, E2, R2>
1462
- ): Effect.Effect<A, E | E2, R | R2> =>
1463
- flatMap(self, (a) => as(isEffect(f) ? f : internalCall(() => (f as (a: A) => Effect.Effect<B, E2, R2>)(a)), a))
1591
+ ): Effect.Effect<A, E | E2, R | R2> => new ContImpl(self, isEffect(f) ? tapEffectCont : tapCont, f)
1464
1592
  )
1465
1593
 
1466
1594
  /** @internal */
1467
1595
  export const asVoid = <A, E, R>(
1468
1596
  self: Effect.Effect<A, E, R>
1469
- ): Effect.Effect<void, E, R> => flatMap(self, (_) => exitVoid)
1597
+ ): Effect.Effect<void, E, R> => new ContImpl(self, returnPayload, exitVoid)
1470
1598
 
1471
1599
  /** @internal */
1472
1600
  export const sandbox = <A, E, R>(
@@ -1673,20 +1801,8 @@ export const flatMap: {
1673
1801
  <A, E, R, B, E2, R2>(
1674
1802
  self: Effect.Effect<A, E, R>,
1675
1803
  f: (a: A) => Effect.Effect<B, E2, R2>
1676
- ): Effect.Effect<B, E | E2, R | R2> => {
1677
- const onSuccess = Object.create(OnSuccessProto)
1678
- onSuccess[args] = self
1679
- onSuccess[contA] = f.length !== 1 ? (a: A) => f(a) : f
1680
- return onSuccess
1681
- }
1804
+ ): Effect.Effect<B, E | E2, R | R2> => new OnSuccessImpl(self, f.length !== 1 ? (a: A) => f(a) : f)
1682
1805
  )
1683
- const OnSuccessProto = makePrimitiveProto({
1684
- op: "OnSuccess",
1685
- [evaluate](this: any, fiber: FiberImpl): Primitive {
1686
- fiber._stack.push(this)
1687
- return this[args]
1688
- }
1689
- })
1690
1806
 
1691
1807
  /** @internal */
1692
1808
  export const matchCauseEffectEager: {
@@ -1722,7 +1838,8 @@ export const matchCauseEffectEager: {
1722
1838
  )
1723
1839
 
1724
1840
  /** @internal */
1725
- export const effectIsExit = <A, E, R>(effect: Effect.Effect<A, E, R>): effect is Exit.Exit<A, E> => ExitTypeId in effect
1841
+ export const effectIsExit = <A, E, R>(effect: Effect.Effect<A, E, R>): effect is Exit.Exit<A, E> =>
1842
+ (effect as any)[ExitTypeId] !== undefined
1726
1843
 
1727
1844
  /** @internal */
1728
1845
  export const flatMapEager: {
@@ -1769,7 +1886,7 @@ export const map: {
1769
1886
  <A, E, R, B>(
1770
1887
  self: Effect.Effect<A, E, R>,
1771
1888
  f: (a: A) => B
1772
- ): Effect.Effect<B, E, R> => flatMap(self, (a) => succeed(internalCall(() => f(a))))
1889
+ ): Effect.Effect<B, E, R> => new ContImpl(self, mapCont, f)
1773
1890
  )
1774
1891
 
1775
1892
  /** @internal */
@@ -2135,7 +2252,9 @@ export const updateServiceScoped = <I, A>(
2135
2252
  const updated = update(original)
2136
2253
  fiber.setContext(Context.add(fiber.context, service, updated))
2137
2254
  return scopeAddFinalizerExit(Context.getUnsafe(fiber.context, scopeTag), (_) => {
2138
- const current = Context.getUnsafe(fiber.context, service)
2255
+ const currentOption = Context.getOption(fiber.context, service)
2256
+ if (Option.isNone(currentOption)) return void_
2257
+ const current = currentOption.value
2139
2258
  let next: A
2140
2259
  if (options?.reset === undefined) {
2141
2260
  if (current !== updated) return void_
@@ -2311,7 +2430,7 @@ export const zipWith: {
2311
2430
  // filtering & conditionals
2312
2431
  // ----------------------------------------------------------------------------
2313
2432
 
2314
- /* @internal */
2433
+ /** @internal */
2315
2434
  export const filterOrFail: {
2316
2435
  <A, E2, B extends A>(
2317
2436
  refinement: Predicate.Refinement<NoInfer<A>, B>,
@@ -2485,20 +2604,18 @@ export const catchCause: {
2485
2604
  <A, E, R, B, E2, R2>(
2486
2605
  self: Effect.Effect<A, E, R>,
2487
2606
  f: (cause: NoInfer<Cause.Cause<E>>) => Effect.Effect<B, E2, R2>
2488
- ): Effect.Effect<A | B, E2, R | R2> => {
2489
- const onFailure = Object.create(OnFailureProto)
2490
- onFailure[args] = self
2491
- onFailure[contE] = f.length !== 1 ? (cause: Cause.Cause<E>) => f(cause) : f
2492
- return onFailure
2493
- }
2607
+ ): Effect.Effect<A | B, E2, R | R2> =>
2608
+ new OnFailureImpl(self, f.length !== 1 ? (cause: Cause.Cause<E>) => f(cause) : f)
2494
2609
  )
2495
2610
  const OnFailureProto = makePrimitiveProto({
2496
2611
  op: "OnFailure",
2497
- [evaluate](this: any, fiber: FiberImpl): Primitive {
2498
- fiber._stack.push(this as any)
2499
- return this[args]
2500
- }
2612
+ [evaluate]: evaluateCont
2501
2613
  })
2614
+ const OnFailureImpl = function(this: any, self: Effect.Effect<any, any, any>, f: any) {
2615
+ this[args] = self
2616
+ this[contE] = f
2617
+ } as unknown as PrimitiveCtor<[self: Effect.Effect<any, any, any>, f: any]>
2618
+ OnFailureImpl.prototype = OnFailureProto
2502
2619
 
2503
2620
  /** @internal */
2504
2621
  export const catchCauseIf: {
@@ -2741,9 +2858,9 @@ export const tapErrorTag: {
2741
2858
 
2742
2859
  /** @internal */
2743
2860
  export const tapDefect: {
2744
- <E, B, E2, R2>(
2861
+ <B, E2, R2>(
2745
2862
  f: (defect: unknown) => Effect.Effect<B, E2, R2>
2746
- ): <A, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E2, R | R2>
2863
+ ): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E2, R | R2>
2747
2864
  <A, E, R, B, E2, R2>(
2748
2865
  self: Effect.Effect<A, E, R>,
2749
2866
  f: (defect: unknown) => Effect.Effect<B, E2, R2>
@@ -3098,7 +3215,10 @@ export const catchReason: {
3098
3215
  > =>
3099
3216
  catchIf(
3100
3217
  self,
3101
- ((e: any) => isTagged(e, errorTag) && hasProperty(e, "reason")) as any,
3218
+ ((e: any) =>
3219
+ isTagged(e, errorTag) &&
3220
+ hasProperty(e, "reason") &&
3221
+ (orElse !== undefined || isTagged(e.reason, reasonTag))) as any,
3102
3222
  (e: any): Effect.Effect<A2 | A3, E | E2 | E3, R2 | R3> => {
3103
3223
  const reason = e.reason as any
3104
3224
  if (isTagged(reason, reasonTag)) return f(reason as any, e)
@@ -3198,7 +3318,8 @@ export const catchReasons: {
3198
3318
  isTagged(e, errorTag) &&
3199
3319
  hasProperty(e, "reason") &&
3200
3320
  hasProperty(e.reason, "_tag") &&
3201
- isString(e.reason._tag)) as any,
3321
+ isString(e.reason._tag) &&
3322
+ (orElse !== undefined || (keys ??= Object.keys(cases)).includes(e.reason._tag))) as any,
3202
3323
  (e: any) => {
3203
3324
  const reason = e.reason
3204
3325
  keys ??= Object.keys(cases)
@@ -3267,7 +3388,7 @@ export const mapError: {
3267
3388
  ): Effect.Effect<A, E2, R> => catch_(self, (error) => failSync(() => f(error)))
3268
3389
  )
3269
3390
 
3270
- /* @internal */
3391
+ /** @internal */
3271
3392
  export const mapBoth: {
3272
3393
  <E, E2, A, A2>(
3273
3394
  options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2 }
@@ -3446,23 +3567,30 @@ export const matchCauseEffect: {
3446
3567
  readonly onFailure: (cause: Cause.Cause<E>) => Effect.Effect<A2, E2, R2>
3447
3568
  readonly onSuccess: (a: A) => Effect.Effect<A3, E3, R3>
3448
3569
  }
3449
- ): Effect.Effect<A2 | A3, E2 | E3, R2 | R3 | R> => {
3450
- const primitive = Object.create(OnSuccessAndFailureProto)
3451
- primitive[args] = self
3452
- primitive[contA] = options.onSuccess.length !== 1 ? (a: A) => options.onSuccess(a) : options.onSuccess
3453
- primitive[contE] = options.onFailure.length !== 1
3454
- ? (cause: Cause.Cause<E>) => options.onFailure(cause)
3455
- : options.onFailure
3456
- return primitive
3457
- }
3570
+ ): Effect.Effect<A2 | A3, E2 | E3, R2 | R3 | R> =>
3571
+ new OnSuccessAndFailureImpl(
3572
+ self,
3573
+ options.onSuccess.length !== 1 ? (a: A) => options.onSuccess(a) : options.onSuccess,
3574
+ options.onFailure.length !== 1
3575
+ ? (cause: Cause.Cause<E>) => options.onFailure(cause)
3576
+ : options.onFailure
3577
+ )
3458
3578
  )
3459
3579
  const OnSuccessAndFailureProto = makePrimitiveProto({
3460
3580
  op: "OnSuccessAndFailure",
3461
- [evaluate](this: any, fiber: FiberImpl): Primitive {
3462
- fiber._stack.push(this)
3463
- return this[args]
3464
- }
3581
+ [evaluate]: evaluateCont
3465
3582
  })
3583
+ const OnSuccessAndFailureImpl = function(
3584
+ this: any,
3585
+ self: Effect.Effect<any, any, any>,
3586
+ onSuccess: any,
3587
+ onFailure: any
3588
+ ) {
3589
+ this[args] = self
3590
+ this[contA] = onSuccess
3591
+ this[contE] = onFailure
3592
+ } as unknown as PrimitiveCtor<[self: Effect.Effect<any, any, any>, onSuccess: any, onFailure: any]>
3593
+ OnSuccessAndFailureImpl.prototype = OnSuccessAndFailureProto
3466
3594
 
3467
3595
  /** @internal */
3468
3596
  export const matchCause: {
@@ -3697,12 +3825,16 @@ export const timeoutOrElse: {
3697
3825
  readonly orElse: LazyArg<Effect.Effect<A2, E2, R2>>
3698
3826
  }
3699
3827
  ): Effect.Effect<A | A2, E | E2, R | R2> =>
3700
- raceFirst(
3701
- self,
3702
- flatMap(sleep(options.duration), options.orElse)
3828
+ flatMap(
3829
+ timeoutOption(self, options.duration),
3830
+ (option): Effect.Effect<A | A2, E2, R2> => Option.isNone(option) ? options.orElse() : succeed(option.value)
3703
3831
  )
3704
3832
  )
3705
3833
 
3834
+ /** @internal */
3835
+ const timeoutErrorFromDuration = (duration: Duration.Duration): TimeoutError =>
3836
+ new TimeoutError(`Operation timed out after '${Duration.format(duration)}'`)
3837
+
3706
3838
  /** @internal */
3707
3839
  export const timeout: {
3708
3840
  (
@@ -3719,11 +3851,13 @@ export const timeout: {
3719
3851
  <A, E, R>(
3720
3852
  self: Effect.Effect<A, E, R>,
3721
3853
  duration: Duration.Input
3722
- ): Effect.Effect<A, E | TimeoutError, R> =>
3723
- timeoutOrElse(self, {
3724
- duration,
3725
- orElse: () => fail(new TimeoutError())
3854
+ ): Effect.Effect<A, E | TimeoutError, R> => {
3855
+ const decoded = Duration.fromInputUnsafe(duration)
3856
+ return timeoutOrElse(self, {
3857
+ duration: decoded,
3858
+ orElse: () => fail(timeoutErrorFromDuration(decoded))
3726
3859
  })
3860
+ }
3727
3861
  )
3728
3862
 
3729
3863
  /** @internal */
@@ -4003,30 +4137,40 @@ export const onExitPrimitive: <A, E, R, XE = never, XR = never>(
4003
4137
  self: Effect.Effect<A, E, R>,
4004
4138
  f: (exit: Exit.Exit<A, E>) => Effect.Effect<void, XE, XR> | undefined,
4005
4139
  interruptible?: boolean
4006
- ) => Effect.Effect<A, E | XE, R | XR> = makePrimitive({
4007
- op: "OnExit",
4008
- single: false,
4009
- [evaluate](fiber: FiberImpl) {
4010
- fiber._stack.push(this)
4011
- return this[args][0]
4012
- },
4013
- [contAll](fiber) {
4014
- if (fiber.interruptible && this[args][2] !== true) {
4015
- fiber._stack.push(setInterruptibleTrue)
4016
- fiber.interruptible = false
4140
+ ) => Effect.Effect<A, E | XE, R | XR> = (function() {
4141
+ const Proto = makePrimitiveProto({
4142
+ op: "OnExit",
4143
+ [evaluate](this: any, fiber: FiberImpl) {
4144
+ fiber._stack.push(this)
4145
+ return this.effect
4146
+ },
4147
+ [contAll](this: any, fiber) {
4148
+ if (fiber.interruptible && this.interruptible !== true) {
4149
+ fiber._stack.push(setInterruptibleTrue)
4150
+ fiber.interruptible = false
4151
+ }
4152
+ },
4153
+ [contA](this: any, value, _, exit) {
4154
+ exit ??= exitSucceed(value)
4155
+ const eff = this.onExit(exit)
4156
+ return eff ? flatMap(eff, (_) => exit) : exit
4157
+ },
4158
+ [contE](this: any, cause, _, exit) {
4159
+ exit ??= exitFailCause(cause)
4160
+ const eff = this.onExit(exit)
4161
+ return eff ? flatMap(combineFinalizerCause(exit, eff), (_) => exit) : exit
4017
4162
  }
4018
- },
4019
- [contA](value, _, exit) {
4020
- exit ??= exitSucceed(value)
4021
- const eff = this[args][1](exit)
4022
- return eff ? flatMap(eff, (_) => exit) : exit
4023
- },
4024
- [contE](cause, _, exit) {
4025
- exit ??= exitFailCause(cause)
4026
- const eff = this[args][1](exit)
4027
- return eff ? flatMap(combineFinalizerCause(exit, eff), (_) => exit) : exit
4028
- }
4029
- })
4163
+ })
4164
+ const OnExitImpl = function(this: any, effect: any, onExit: any, interruptible: any) {
4165
+ this.effect = effect
4166
+ this.onExit = onExit
4167
+ this.interruptible = interruptible
4168
+ } as unknown as PrimitiveCtor<[effect: any, onExit: any, interruptible: any]>
4169
+ OnExitImpl.prototype = Proto
4170
+ return function(effect: any, onExit: any, interruptible?: boolean) {
4171
+ return new OnExitImpl(effect, onExit, interruptible)
4172
+ } as any
4173
+ })()
4030
4174
 
4031
4175
  /** @internal */
4032
4176
  export const onExit: {
@@ -4206,7 +4350,7 @@ export const acquireUseRelease = <Resource, E, R, A, E2, R2, E3, R3>(
4206
4350
  uninterruptibleMask((restore) =>
4207
4351
  flatMap(acquire, (a) =>
4208
4352
  onExitPrimitive(
4209
- restore(use(a)),
4353
+ suspend(() => restore(use(a))),
4210
4354
  (exit) => release(a, exit),
4211
4355
  true
4212
4356
  ))
@@ -4289,7 +4433,22 @@ export const cachedWithTTL: {
4289
4433
 
4290
4434
  /** @internal */
4291
4435
  export const cached = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<Effect.Effect<A, E, R>> =>
4292
- cachedWithTTL(self, Duration.infinity)
4436
+ sync(() => {
4437
+ const latch = makeLatchUnsafe(false)
4438
+ let started = false
4439
+ let exit: Exit.Exit<A, E> | undefined
4440
+ const wait = flatMap(latch.await, () => exit!)
4441
+ return suspend(() => {
4442
+ if (exit !== undefined) return exit
4443
+ if (started) return wait
4444
+ started = true
4445
+ return onExit(self, (result) =>
4446
+ sync(() => {
4447
+ exit = result
4448
+ latch.openUnsafe()
4449
+ }))
4450
+ })
4451
+ })
4293
4452
 
4294
4453
  // ----------------------------------------------------------------------------
4295
4454
  // interruption
@@ -4327,6 +4486,34 @@ const setFiberInterruptible = (fiber: FiberImpl): Effect.Effect<never> | undefin
4327
4486
  if (fiber._interruptedCause) return failCause(fiber._interruptedCause)
4328
4487
  }
4329
4488
 
4489
+ /**
4490
+ * Makes the current fiber uninterruptible for the returned effect without an
4491
+ * extra primitive. Call only within `withFiber`.
4492
+ *
4493
+ * @internal
4494
+ */
4495
+ export const fiberEnterUninterruptibleUnsafe = (fiber: Fiber.Fiber<unknown, unknown>): void => {
4496
+ const impl = fiber as FiberImpl
4497
+ if (!impl.interruptible) return
4498
+ impl.interruptible = false
4499
+ impl._stack.push(setInterruptibleTrue)
4500
+ }
4501
+
4502
+ /**
4503
+ * Makes the current fiber interruptible for the returned effect without an
4504
+ * extra primitive. Call only within `withFiber` and return any pending
4505
+ * interruption it produces.
4506
+ *
4507
+ * @internal
4508
+ */
4509
+ export const fiberEnterInterruptibleUnsafe = (
4510
+ fiber: Fiber.Fiber<unknown, unknown>
4511
+ ): Effect.Effect<never> | undefined => {
4512
+ const impl = fiber as FiberImpl
4513
+ if (impl.interruptible) return undefined
4514
+ return setFiberInterruptible(impl)
4515
+ }
4516
+
4330
4517
  /** @internal */
4331
4518
  export const interruptible = <A, E, R>(
4332
4519
  self: Effect.Effect<A, E, R>
@@ -4672,10 +4859,7 @@ export const forEach: {
4672
4859
  }
4673
4860
  ): Effect.Effect<any, E, R> =>
4674
4861
  suspend(() => {
4675
- const concurrencyOption = options?.concurrency ?? 1
4676
- const concurrency = concurrencyOption === "unbounded"
4677
- ? Number.POSITIVE_INFINITY
4678
- : Math.max(1, concurrencyOption)
4862
+ const concurrency = resolveConcurrency(options?.concurrency)
4679
4863
 
4680
4864
  if (concurrency === 1) {
4681
4865
  return forEachSequential(iterable, f, options)
@@ -4728,19 +4912,22 @@ const forEachSequential = <A, B, E, R>(
4728
4912
  )
4729
4913
  })
4730
4914
 
4731
- type IterateEagerOptions = {
4732
- readonly concurrency?: number | undefined
4733
- readonly end?: number | undefined
4734
- readonly orderedStep?: boolean | undefined
4735
- }
4915
+ /** @internal */
4916
+ export const resolveConcurrency = (concurrency: Concurrency | undefined): number =>
4917
+ concurrency === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrency ?? 1)
4736
4918
 
4737
- const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4919
+ type IterateOptions<S, A, X, E, R, E2> = {
4738
4920
  readonly onItem: (state: S, item: A, index: number) => Effect.Effect<X, E, R>
4739
4921
  readonly step: (state: NoInfer<S>, item: A, exit: Exit.Exit<X, E>, index: number) => Exit.Exit<void, E2> | void
4740
- }): (
4922
+ }
4923
+
4924
+ /** @internal */
4925
+ export const iterateEager = <S, A>() =>
4926
+ <X, E, R, E2>(options: IterateOptions<S, A, X, E, R, E2>): (
4741
4927
  initialState: S,
4742
4928
  items: ReadonlyArray<A>,
4743
- options?: IterateEagerOptions
4929
+ start?: number,
4930
+ end?: number
4744
4931
  ) => Effect.Effect<void, E | E2, R> | undefined => {
4745
4932
  const onItem = options.onItem
4746
4933
  const step = options.step
@@ -4748,8 +4935,8 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4748
4935
  const runSequential = (
4749
4936
  state: S,
4750
4937
  items: ReadonlyArray<A>,
4751
- index: number,
4752
- end: number
4938
+ index = 0,
4939
+ end = items.length
4753
4940
  ): Effect.Effect<void, E | E2, R> | undefined => {
4754
4941
  for (; index < end; index++) {
4755
4942
  const item = items[index]
@@ -4765,18 +4952,20 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4765
4952
  }
4766
4953
  }
4767
4954
 
4955
+ return runSequential
4956
+ }
4957
+
4958
+ const iterateConcurrentImpl = <S, A, X, E, R, E2>(options: IterateOptions<S, A, X, E, R, E2>) => {
4959
+ const onItem = options.onItem
4960
+ const step = options.step
4768
4961
  return (
4769
4962
  state: S,
4770
4963
  items: ReadonlyArray<A>,
4771
- opts: IterateEagerOptions | undefined
4964
+ opts: { readonly concurrency: number; readonly end?: number | undefined }
4772
4965
  ): Effect.Effect<void, E | E2, R> | undefined => {
4773
4966
  let index = 0
4774
- const end = opts?.end ?? items.length
4775
- const concurrency = opts?.concurrency ?? 1
4776
- if (concurrency === 1) {
4777
- return runSequential(state, items, 0, end)
4778
- }
4779
- const orderedStep = opts?.orderedStep === true
4967
+ const end = opts.end ?? items.length
4968
+ const concurrency = opts.concurrency
4780
4969
  let done = false
4781
4970
  let parentFiber: Fiber.Fiber<any, any> | undefined
4782
4971
  let fibers: Set<Fiber.Fiber<any, any>> | undefined
@@ -4784,8 +4973,6 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4784
4973
  let interrupted = false
4785
4974
  let terminal: Exit.Exit<void, E | E2> | void
4786
4975
  let effect: Effect.Effect<X, E, R> | undefined
4787
- let nextIndex = index
4788
- const exits: Array<Exit.Exit<X, E> | undefined> | undefined = orderedStep ? new Array(end) : undefined
4789
4976
 
4790
4977
  const failDefect = (error: unknown): Effect.Effect<void, E | E2, R> => {
4791
4978
  const defect = exitDie(error)
@@ -4797,20 +4984,6 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4797
4984
  : defect
4798
4985
  }
4799
4986
 
4800
- const runStep = (item: A, exit: Exit.Exit<X, E>, currentIndex: number): Exit.Exit<void, E | E2> | void => {
4801
- if (!orderedStep) return step(state, item, exit, currentIndex)
4802
- if (terminal) return terminal
4803
- exits![currentIndex] = exit
4804
- while (nextIndex < end) {
4805
- const nextExit = exits![nextIndex]
4806
- if (nextExit === undefined) return
4807
- exits![nextIndex] = undefined
4808
- const index = nextIndex++
4809
- const result = step(state, items[index], nextExit, index)
4810
- if (result) return result
4811
- }
4812
- }
4813
-
4814
4987
  const go = (): Effect.Effect<void, E | E2, R> | undefined => {
4815
4988
  let paused = false
4816
4989
  for (; !terminal && index < end; index++) {
@@ -4819,7 +4992,7 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4819
4992
 
4820
4993
  // fast case (already an exit)
4821
4994
  if (effectIsExit(eff)) {
4822
- terminal = runStep(item, eff, index)
4995
+ terminal = step(state, item, eff, index)
4823
4996
  if (terminal) break
4824
4997
 
4825
4998
  // We have an effect, so enter "async" mode
@@ -4850,7 +5023,7 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4850
5023
 
4851
5024
  const fiber = forkUnsafe(parentFiber, eff, true, true, "inherit")
4852
5025
  if (fiber._exit) {
4853
- terminal = runStep(item, fiber._exit, index)
5026
+ terminal = step(state, item, fiber._exit, index)
4854
5027
  if (terminal) break
4855
5028
  continue
4856
5029
  }
@@ -4874,7 +5047,7 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4874
5047
  }
4875
5048
  }
4876
5049
  } else {
4877
- const result = runStep(item, exit, currentIndex)
5050
+ const result = step(state, item, exit, currentIndex)
4878
5051
  if (result) {
4879
5052
  terminal = result._tag === "Failure"
4880
5053
  ? exitFailCause(causeFromReasons(result.cause.reasons.slice()))
@@ -4927,16 +5100,10 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
4927
5100
  }
4928
5101
 
4929
5102
  /** @internal */
4930
- export const iterateEager = <S, A>(): <X, E, R, E2>(options: {
4931
- readonly onItem: (state: S, item: A, index: number) => Effect.Effect<X, E, R>
4932
- readonly step: (state: NoInfer<S>, item: A, exit: Exit.Exit<X, E>, index: number) => Exit.Exit<void, E2> | void
4933
- }) => (
4934
- initialState: S,
4935
- items: ReadonlyArray<A>,
4936
- options?: IterateEagerOptions
4937
- ) => Effect.Effect<void, E | E2, R> | undefined => iterateEagerImpl
5103
+ export const iterateConcurrent = <S, A>() => <X, E, R, E2>(options: IterateOptions<S, A, X, E, R, E2>) =>
5104
+ iterateConcurrentImpl<S, A, X, E, R, E2>(options)
4938
5105
 
4939
- const forEachConcurrent = iterateEagerImpl({
5106
+ const forEachConcurrent = iterateConcurrentImpl({
4940
5107
  onItem(
4941
5108
  state: {
4942
5109
  readonly f: (a: any, i: number) => Effect.Effect<any, any, any>
@@ -4955,7 +5122,7 @@ const forEachConcurrent = iterateEagerImpl({
4955
5122
  }
4956
5123
  })
4957
5124
 
4958
- /* @internal */
5125
+ /** @internal */
4959
5126
  export const filterOrElse: {
4960
5127
  <A, C, E2, R2, B extends A>(
4961
5128
  refinement: Predicate.Refinement<NoInfer<A>, B>,
@@ -5011,7 +5178,7 @@ export const filterMapOrElse: {
5011
5178
  }
5012
5179
  ))
5013
5180
 
5014
- /* @internal */
5181
+ /** @internal */
5015
5182
  export const filterMapOrFail: {
5016
5183
  <A, B, X, E2>(
5017
5184
  filter: Filter.Filter<NoInfer<A>, B, X>,
@@ -5278,7 +5445,7 @@ export const forkUnsafe = <FA, FE, A, E, R>(
5278
5445
  }
5279
5446
  if (!daemon && !child._exit) {
5280
5447
  parentRuntime.children().add(child)
5281
- child.addObserver(() => parentRuntime._children!.delete(child))
5448
+ child._parent = parentRuntime
5282
5449
  }
5283
5450
  return child
5284
5451
  }
@@ -5733,7 +5900,7 @@ export const makeSpanUnsafe = <XA, XE>(
5733
5900
  ? Option.some(options.parent)
5734
5901
  : options?.root
5735
5902
  ? Option.none<Tracer.AnySpan>()
5736
- : filterDisablePropagation(fiber.currentSpan)
5903
+ : filterDisablePropagation(fiber.cache.span)
5737
5904
 
5738
5905
  let span: Tracer.Span
5739
5906
 
@@ -5766,7 +5933,7 @@ export const makeSpanUnsafe = <XA, XE>(
5766
5933
  parent,
5767
5934
  annotations: options?.annotations ?? Context.empty(),
5768
5935
  links,
5769
- startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : BigInt(0),
5936
+ startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : bigint0,
5770
5937
  kind: options?.kind ?? "internal",
5771
5938
  root: options?.root ?? Option.isNone(parent),
5772
5939
  sampled: options?.sampled ??
@@ -5910,7 +6077,10 @@ export const useSpan: {
5910
6077
  const span = makeSpanUnsafe(fiber, name, options)
5911
6078
  const clock = fiber.getRef(ClockRef)
5912
6079
  const timingEnabled = fiber.getRef(TracerTimingEnabled)
5913
- return onExit(internalCall(() => evaluate(span)), (exit) => endSpan(span, exit, clock, timingEnabled))
6080
+ return onExit(
6081
+ suspend(() => internalCall(() => evaluate(span))),
6082
+ (exit) => endSpan(span, exit, clock, timingEnabled)
6083
+ )
5914
6084
  })
5915
6085
  }
5916
6086
 
@@ -6220,7 +6390,7 @@ export class UnknownError extends TaggedError("UnknownError")<{
6220
6390
 
6221
6391
  /** @internal */
6222
6392
  export const ConsoleRef = Context.Reference<Console.Console>(
6223
- "effect/Console/CurrentConsole",
6393
+ "effect/Console",
6224
6394
  { defaultValue: (): Console.Console => globalThis.console }
6225
6395
  )
6226
6396
 
@@ -6263,7 +6433,7 @@ export const isLogLevelGreaterThan = Order.isGreaterThan(LogLevelOrder)
6263
6433
  /** @internal */
6264
6434
  export const CurrentLoggers = Context.Reference<
6265
6435
  ReadonlySet<Logger.Logger<unknown, any>>
6266
- >("effect/Loggers/CurrentLoggers", {
6436
+ >("effect/Logger/CurrentLoggers", {
6267
6437
  defaultValue: () => new Set([defaultLogger, tracerLogger])
6268
6438
  })
6269
6439
 
@@ -6293,7 +6463,7 @@ export const annotateLogsScoped: {
6293
6463
  const next = { ...current }
6294
6464
  for (let i = 0; i < entries.length; i++) {
6295
6465
  const [key, value] = entries[i]
6296
- if (current[key] !== value) continue
6466
+ if (current[key] !== value && !Object.is(current[key], value)) continue
6297
6467
  if (Object.hasOwn(prev, key)) {
6298
6468
  InternalRecord.assignProperty(next, key, prev[key])
6299
6469
  } else {
@@ -6381,8 +6551,8 @@ export const logWithLevel = (level?: LogLevel.Severity) =>
6381
6551
  cause = causeEmpty
6382
6552
  }
6383
6553
  return withFiber((fiber) => {
6384
- const logLevel = level ?? fiber.currentLogLevel
6385
- if (isLogLevelGreaterThan(fiber.minimumLogLevel, logLevel)) {
6554
+ const logLevel = level ?? fiber.cache.logLevel
6555
+ if (isLogLevelGreaterThan(fiber.cache.minimumLogLevel, logLevel)) {
6386
6556
  return void_
6387
6557
  }
6388
6558
  const clock = fiber.getRef(ClockRef)
@@ -6458,29 +6628,36 @@ export const consolePretty = (options?: {
6458
6628
  }) => {
6459
6629
  // evaluated lazily so the module-level bundle stays free of `process`
6460
6630
  // property accesses, which bundlers must retain as possible side effects
6461
- const process = (globalThis as {
6462
- readonly process?: { readonly stdout?: { readonly isTTY?: boolean } }
6463
- }).process
6631
+ const process = (globalThis as { readonly process?: { readonly stdout?: unknown } }).process
6464
6632
  const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null
6465
- const processStdoutIsTTY = hasProcessStdout &&
6466
- process.stdout.isTTY === true
6467
- const hasProcessStdoutOrDeno = hasProcessStdout || "Deno" in globalThis
6468
- const mode_ = options?.mode ?? "auto"
6469
- const mode = mode_ === "auto" ? (hasProcessStdoutOrDeno ? "tty" : "browser") : mode_
6470
- const isBrowser = mode === "browser"
6471
- const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY || isBrowser
6472
- const formatDate = options?.formatDate ?? defaultDateFormat
6473
- return isBrowser
6474
- ? prettyLoggerBrowser({ colors: showColors, formatDate })
6475
- : prettyLoggerTty({ colors: showColors, formatDate })
6633
+ const isDeno = "Deno" in globalThis
6634
+ const mode = options?.mode ?? "auto"
6635
+ const isTtyLogger = mode === "auto" ? hasProcessStdout || isDeno : mode === "tty"
6636
+
6637
+ return isTtyLogger ? prettyLoggerTty(options) : prettyLoggerBrowser(options)
6476
6638
  }
6477
6639
 
6478
- const prettyLoggerTty = (options: {
6479
- readonly colors: boolean
6480
- readonly formatDate: (date: Date) => string
6640
+ /** @internal */
6641
+ export const prettyLoggerTty = (options?: {
6642
+ readonly colors?: "auto" | boolean | undefined
6643
+ readonly formatDate?: ((date: Date) => string) | undefined
6481
6644
  }) => {
6482
- const processIsBun = (globalThis as { readonly process?: { readonly isBun?: boolean } }).process?.isBun === true
6483
- const color = options.colors ? withColor : withColorNoop
6645
+ const formatDate = options?.formatDate ?? defaultDateFormat
6646
+ // evaluated lazily so the module-level bundle stays free of `process`
6647
+ // property accesses, which bundlers must retain as possible side effects
6648
+ const process = (globalThis as {
6649
+ readonly process?: {
6650
+ readonly stdout?: { readonly isTTY?: unknown }
6651
+ readonly isBun?: boolean
6652
+ }
6653
+ }).process
6654
+
6655
+ const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null
6656
+ const processStdoutIsTTY = hasProcessStdout && process.stdout.isTTY === true
6657
+ const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY
6658
+ const color = showColors ? withColor : withColorNoop
6659
+
6660
+ const processIsBun = process?.isBun === true
6484
6661
  return loggerMake<unknown, void>(
6485
6662
  ({ cause, date, fiber, logLevel, message: message_ }) => {
6486
6663
  const console = fiber.getRef(ConsoleRef)
@@ -6489,7 +6666,7 @@ const prettyLoggerTty = (options: {
6489
6666
 
6490
6667
  const message = Array.isArray(message_) ? message_.slice() : [message_]
6491
6668
 
6492
- let firstLine = color(`[${options.formatDate(date)}]`, colors.white)
6669
+ let firstLine = color(`[${formatDate(date)}]`, colors.white)
6493
6670
  + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}`
6494
6671
  + ` (#${fiber.id})`
6495
6672
 
@@ -6534,24 +6711,27 @@ const prettyLoggerTty = (options: {
6534
6711
  )
6535
6712
  }
6536
6713
 
6537
- const prettyLoggerBrowser = (options: {
6538
- readonly colors: boolean
6539
- readonly formatDate: (date: Date) => string
6714
+ /** @internal */
6715
+ export const prettyLoggerBrowser = (options?: {
6716
+ readonly colors?: "auto" | boolean | undefined
6717
+ readonly formatDate?: ((date: Date) => string) | undefined
6540
6718
  }) => {
6541
- const color = options.colors ? "%c" : ""
6719
+ const showColors = options?.colors !== false
6720
+ const color = showColors ? "%c" : ""
6721
+ const formatDate = options?.formatDate ?? defaultDateFormat
6542
6722
  return loggerMake<unknown, void>(
6543
6723
  ({ cause, date, fiber, logLevel, message: message_ }) => {
6544
6724
  const console = fiber.getRef(ConsoleRef)
6545
6725
 
6546
6726
  const message = Array.isArray(message_) ? message_.slice() : [message_]
6547
6727
 
6548
- let firstLine = `${color}[${options.formatDate(date)}]`
6728
+ let firstLine = `${color}[${formatDate(date)}]`
6549
6729
  const firstParams = []
6550
- if (options.colors) {
6730
+ if (showColors) {
6551
6731
  firstParams.push("color:gray")
6552
6732
  }
6553
6733
  firstLine += ` ${color}${logLevel.toUpperCase()}${color} (#${fiber.id})`
6554
- if (options.colors) {
6734
+ if (showColors) {
6555
6735
  firstParams.push(logLevelStyle[logLevel], "")
6556
6736
  }
6557
6737
 
@@ -6568,7 +6748,7 @@ const prettyLoggerBrowser = (options: {
6568
6748
  const firstMaybeString = structuredMessage(message[0])
6569
6749
  if (typeof firstMaybeString === "string") {
6570
6750
  firstLine += ` ${color}${firstMaybeString}`
6571
- if (options.colors) {
6751
+ if (showColors) {
6572
6752
  firstParams.push("color:deepskyblue")
6573
6753
  }
6574
6754
  messageIndex++
@@ -6593,7 +6773,7 @@ const prettyLoggerBrowser = (options: {
6593
6773
  const annotations = fiber.getRef(CurrentLogAnnotations)
6594
6774
  for (const [key, value] of Object.entries(annotations)) {
6595
6775
  const redacted = redact(value)
6596
- if (options.colors) {
6776
+ if (showColors) {
6597
6777
  // oxlint-disable-next-line no-console
6598
6778
  console.log(`%c${key}:`, "color:gray", redacted)
6599
6779
  } else {
@@ -6634,7 +6814,7 @@ export const defaultLogger = loggerMake<unknown, void>(({ cause, date, fiber, lo
6634
6814
  export const tracerLogger = loggerMake<unknown, void>(({ cause, fiber, logLevel, message }) => {
6635
6815
  const clock = fiber.getRef(ClockRef)
6636
6816
  const annotations = fiber.getRef(CurrentLogAnnotations)
6637
- const span = fiber.currentSpan
6817
+ const span = fiber.cache.span
6638
6818
  if (span === undefined || span._tag === "ExternalSpan") return
6639
6819
  const attributes: Record<string, unknown> = {}
6640
6820
  for (const [key, value] of Object.entries(annotations)) {
@@ -6679,7 +6859,7 @@ export const withErrorReporting: <
6679
6859
  options?: {
6680
6860
  readonly defectsOnly?: boolean | undefined
6681
6861
  } | undefined
6682
- ) => [Arg] extends [Effect.Effect<infer _A, infer _E, infer _R>] ? Arg
6862
+ ) => [Arg] extends [Effect.Effect<infer A, infer E, infer R>] ? Effect.Effect<A, E, R>
6683
6863
  : <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R> = dual(
6684
6864
  (args) => isEffect(args[0]),
6685
6865
  <A, E, R>(