effect 4.0.0-beta.4 → 4.0.0-beta.41

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 (1235) hide show
  1. package/dist/Array.d.ts +213 -385
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +149 -102
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +82 -45
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +87 -38
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +39 -32
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +32 -29
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Brand.d.ts +1 -1
  14. package/dist/Brand.d.ts.map +1 -1
  15. package/dist/Brand.js +1 -1
  16. package/dist/Brand.js.map +1 -1
  17. package/dist/Cache.d.ts +2 -2
  18. package/dist/Cache.d.ts.map +1 -1
  19. package/dist/Cache.js +6 -5
  20. package/dist/Cache.js.map +1 -1
  21. package/dist/Cause.d.ts +33 -2
  22. package/dist/Cause.d.ts.map +1 -1
  23. package/dist/Cause.js +19 -0
  24. package/dist/Cause.js.map +1 -1
  25. package/dist/Channel.d.ts +130 -35
  26. package/dist/Channel.d.ts.map +1 -1
  27. package/dist/Channel.js +96 -45
  28. package/dist/Channel.js.map +1 -1
  29. package/dist/Chunk.d.ts +112 -304
  30. package/dist/Chunk.d.ts.map +1 -1
  31. package/dist/Chunk.js +56 -88
  32. package/dist/Chunk.js.map +1 -1
  33. package/dist/Combiner.d.ts +280 -13
  34. package/dist/Combiner.d.ts.map +1 -1
  35. package/dist/Combiner.js +198 -7
  36. package/dist/Combiner.js.map +1 -1
  37. package/dist/Config.d.ts +169 -9
  38. package/dist/Config.d.ts.map +1 -1
  39. package/dist/Config.js +69 -11
  40. package/dist/Config.js.map +1 -1
  41. package/dist/ConfigProvider.d.ts +1 -1
  42. package/dist/Cron.d.ts +11 -7
  43. package/dist/Cron.d.ts.map +1 -1
  44. package/dist/Cron.js +120 -63
  45. package/dist/Cron.js.map +1 -1
  46. package/dist/Data.d.ts +535 -366
  47. package/dist/Data.d.ts.map +1 -1
  48. package/dist/Data.js +132 -79
  49. package/dist/Data.js.map +1 -1
  50. package/dist/DateTime.d.ts +72 -253
  51. package/dist/DateTime.d.ts.map +1 -1
  52. package/dist/DateTime.js +15 -60
  53. package/dist/DateTime.js.map +1 -1
  54. package/dist/Deferred.d.ts +7 -5
  55. package/dist/Deferred.d.ts.map +1 -1
  56. package/dist/Deferred.js +7 -5
  57. package/dist/Deferred.js.map +1 -1
  58. package/dist/Duration.d.ts +62 -32
  59. package/dist/Duration.d.ts.map +1 -1
  60. package/dist/Duration.js +108 -78
  61. package/dist/Duration.js.map +1 -1
  62. package/dist/Effect.d.ts +1225 -951
  63. package/dist/Effect.d.ts.map +1 -1
  64. package/dist/Effect.js +398 -338
  65. package/dist/Effect.js.map +1 -1
  66. package/dist/Encoding.d.ts +194 -0
  67. package/dist/Encoding.d.ts.map +1 -0
  68. package/dist/Encoding.js +352 -0
  69. package/dist/Encoding.js.map +1 -0
  70. package/dist/Equal.d.ts +276 -109
  71. package/dist/Equal.d.ts.map +1 -1
  72. package/dist/Equal.js +124 -48
  73. package/dist/Equal.js.map +1 -1
  74. package/dist/Equivalence.d.ts +60 -3
  75. package/dist/Equivalence.d.ts.map +1 -1
  76. package/dist/Equivalence.js +70 -13
  77. package/dist/Equivalence.js.map +1 -1
  78. package/dist/ErrorReporter.d.ts +374 -0
  79. package/dist/ErrorReporter.d.ts.map +1 -0
  80. package/dist/ErrorReporter.js +245 -0
  81. package/dist/ErrorReporter.js.map +1 -0
  82. package/dist/Exit.d.ts +24 -12
  83. package/dist/Exit.d.ts.map +1 -1
  84. package/dist/Exit.js +8 -4
  85. package/dist/Exit.js.map +1 -1
  86. package/dist/Fiber.d.ts +5 -3
  87. package/dist/Fiber.d.ts.map +1 -1
  88. package/dist/Fiber.js.map +1 -1
  89. package/dist/FiberHandle.d.ts +9 -8
  90. package/dist/FiberHandle.d.ts.map +1 -1
  91. package/dist/FiberHandle.js +8 -7
  92. package/dist/FiberHandle.js.map +1 -1
  93. package/dist/FiberMap.d.ts +20 -19
  94. package/dist/FiberMap.d.ts.map +1 -1
  95. package/dist/FiberMap.js +6 -6
  96. package/dist/FiberMap.js.map +1 -1
  97. package/dist/FileSystem.d.ts +18 -17
  98. package/dist/FileSystem.d.ts.map +1 -1
  99. package/dist/FileSystem.js +17 -13
  100. package/dist/FileSystem.js.map +1 -1
  101. package/dist/Filter.d.ts +34 -38
  102. package/dist/Filter.d.ts.map +1 -1
  103. package/dist/Filter.js +15 -13
  104. package/dist/Filter.js.map +1 -1
  105. package/dist/Formatter.d.ts +131 -47
  106. package/dist/Formatter.d.ts.map +1 -1
  107. package/dist/Formatter.js +229 -51
  108. package/dist/Formatter.js.map +1 -1
  109. package/dist/Function.d.ts +1 -9
  110. package/dist/Function.d.ts.map +1 -1
  111. package/dist/Function.js +2 -10
  112. package/dist/Function.js.map +1 -1
  113. package/dist/Graph.d.ts +65 -65
  114. package/dist/Graph.d.ts.map +1 -1
  115. package/dist/Graph.js +60 -62
  116. package/dist/Graph.js.map +1 -1
  117. package/dist/HashMap.d.ts +26 -19
  118. package/dist/HashMap.d.ts.map +1 -1
  119. package/dist/HashMap.js +7 -5
  120. package/dist/HashMap.js.map +1 -1
  121. package/dist/Iterable.d.ts +50 -50
  122. package/dist/Iterable.d.ts.map +1 -1
  123. package/dist/Iterable.js +106 -34
  124. package/dist/Iterable.js.map +1 -1
  125. package/dist/JsonSchema.d.ts +299 -10
  126. package/dist/JsonSchema.d.ts.map +1 -1
  127. package/dist/JsonSchema.js +323 -4
  128. package/dist/JsonSchema.js.map +1 -1
  129. package/dist/Latch.d.ts +175 -0
  130. package/dist/Latch.d.ts.map +1 -0
  131. package/dist/Latch.js +130 -0
  132. package/dist/Latch.js.map +1 -0
  133. package/dist/Layer.d.ts +306 -129
  134. package/dist/Layer.d.ts.map +1 -1
  135. package/dist/Layer.js +93 -48
  136. package/dist/Layer.js.map +1 -1
  137. package/dist/LayerMap.d.ts +9 -8
  138. package/dist/LayerMap.d.ts.map +1 -1
  139. package/dist/LayerMap.js +3 -3
  140. package/dist/LayerMap.js.map +1 -1
  141. package/dist/LogLevel.d.ts +32 -0
  142. package/dist/LogLevel.d.ts.map +1 -1
  143. package/dist/LogLevel.js +28 -100
  144. package/dist/LogLevel.js.map +1 -1
  145. package/dist/Logger.d.ts +29 -95
  146. package/dist/Logger.d.ts.map +1 -1
  147. package/dist/Logger.js +2 -3
  148. package/dist/Logger.js.map +1 -1
  149. package/dist/ManagedRuntime.d.ts +2 -2
  150. package/dist/ManagedRuntime.d.ts.map +1 -1
  151. package/dist/ManagedRuntime.js +21 -9
  152. package/dist/ManagedRuntime.js.map +1 -1
  153. package/dist/Metric.d.ts +4 -6
  154. package/dist/Metric.d.ts.map +1 -1
  155. package/dist/Metric.js +3 -5
  156. package/dist/Metric.js.map +1 -1
  157. package/dist/MutableHashMap.d.ts +7 -0
  158. package/dist/MutableHashMap.d.ts.map +1 -1
  159. package/dist/MutableHashMap.js +8 -0
  160. package/dist/MutableHashMap.js.map +1 -1
  161. package/dist/MutableHashSet.d.ts +7 -0
  162. package/dist/MutableHashSet.d.ts.map +1 -1
  163. package/dist/MutableHashSet.js +8 -0
  164. package/dist/MutableHashSet.js.map +1 -1
  165. package/dist/Newtype.d.ts +291 -0
  166. package/dist/Newtype.d.ts.map +1 -0
  167. package/dist/Newtype.js +161 -0
  168. package/dist/Newtype.js.map +1 -0
  169. package/dist/Number.d.ts +74 -18
  170. package/dist/Number.d.ts.map +1 -1
  171. package/dist/Number.js +34 -15
  172. package/dist/Number.js.map +1 -1
  173. package/dist/Optic.d.ts +947 -18
  174. package/dist/Optic.d.ts.map +1 -1
  175. package/dist/Optic.js +454 -5
  176. package/dist/Optic.js.map +1 -1
  177. package/dist/Option.d.ts +25 -16
  178. package/dist/Option.d.ts.map +1 -1
  179. package/dist/Option.js +15 -9
  180. package/dist/Option.js.map +1 -1
  181. package/dist/Order.d.ts +6 -1
  182. package/dist/Order.d.ts.map +1 -1
  183. package/dist/Order.js +19 -14
  184. package/dist/Order.js.map +1 -1
  185. package/dist/PartitionedSemaphore.d.ts +146 -15
  186. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  187. package/dist/PartitionedSemaphore.js +174 -61
  188. package/dist/PartitionedSemaphore.js.map +1 -1
  189. package/dist/Pipeable.d.ts +17 -0
  190. package/dist/Pipeable.d.ts.map +1 -1
  191. package/dist/Pipeable.js +19 -1
  192. package/dist/Pipeable.js.map +1 -1
  193. package/dist/PlatformError.d.ts +10 -9
  194. package/dist/PlatformError.d.ts.map +1 -1
  195. package/dist/PlatformError.js +2 -2
  196. package/dist/PlatformError.js.map +1 -1
  197. package/dist/Pool.d.ts +6 -4
  198. package/dist/Pool.d.ts.map +1 -1
  199. package/dist/Pool.js +7 -5
  200. package/dist/Pool.js.map +1 -1
  201. package/dist/PubSub.d.ts +8 -6
  202. package/dist/PubSub.d.ts.map +1 -1
  203. package/dist/PubSub.js +18 -10
  204. package/dist/PubSub.js.map +1 -1
  205. package/dist/Pull.d.ts.map +1 -1
  206. package/dist/Pull.js +1 -1
  207. package/dist/Pull.js.map +1 -1
  208. package/dist/Queue.d.ts +9 -6
  209. package/dist/Queue.d.ts.map +1 -1
  210. package/dist/Queue.js +7 -5
  211. package/dist/Queue.js.map +1 -1
  212. package/dist/Random.d.ts +35 -1
  213. package/dist/Random.d.ts.map +1 -1
  214. package/dist/Random.js +46 -12
  215. package/dist/Random.js.map +1 -1
  216. package/dist/RcMap.d.ts +2 -2
  217. package/dist/RcMap.d.ts.map +1 -1
  218. package/dist/RcMap.js +1 -1
  219. package/dist/RcMap.js.map +1 -1
  220. package/dist/RcRef.d.ts +1 -1
  221. package/dist/RcRef.d.ts.map +1 -1
  222. package/dist/Record.d.ts +63 -160
  223. package/dist/Record.d.ts.map +1 -1
  224. package/dist/Record.js +37 -56
  225. package/dist/Record.js.map +1 -1
  226. package/dist/Reducer.d.ts +166 -7
  227. package/dist/Reducer.d.ts.map +1 -1
  228. package/dist/Reducer.js +135 -1
  229. package/dist/Reducer.js.map +1 -1
  230. package/dist/References.d.ts +242 -226
  231. package/dist/References.d.ts.map +1 -1
  232. package/dist/References.js +240 -247
  233. package/dist/References.js.map +1 -1
  234. package/dist/Request.d.ts +1 -1
  235. package/dist/Request.d.ts.map +1 -1
  236. package/dist/Request.js +2 -1
  237. package/dist/Request.js.map +1 -1
  238. package/dist/RequestResolver.d.ts +25 -45
  239. package/dist/RequestResolver.d.ts.map +1 -1
  240. package/dist/RequestResolver.js +10 -30
  241. package/dist/RequestResolver.js.map +1 -1
  242. package/dist/Resource.d.ts.map +1 -1
  243. package/dist/Resource.js +2 -1
  244. package/dist/Resource.js.map +1 -1
  245. package/dist/Result.d.ts +1 -1
  246. package/dist/Result.d.ts.map +1 -1
  247. package/dist/Result.js +1 -2
  248. package/dist/Result.js.map +1 -1
  249. package/dist/Runtime.d.ts +66 -0
  250. package/dist/Runtime.d.ts.map +1 -1
  251. package/dist/Runtime.js +79 -6
  252. package/dist/Runtime.js.map +1 -1
  253. package/dist/Schedule.d.ts +174 -291
  254. package/dist/Schedule.d.ts.map +1 -1
  255. package/dist/Schedule.js +160 -134
  256. package/dist/Schedule.js.map +1 -1
  257. package/dist/Scheduler.d.ts +34 -123
  258. package/dist/Scheduler.d.ts.map +1 -1
  259. package/dist/Scheduler.js +31 -123
  260. package/dist/Scheduler.js.map +1 -1
  261. package/dist/Schema.d.ts +2722 -247
  262. package/dist/Schema.d.ts.map +1 -1
  263. package/dist/Schema.js +1947 -224
  264. package/dist/Schema.js.map +1 -1
  265. package/dist/SchemaAST.d.ts +7 -2
  266. package/dist/SchemaAST.d.ts.map +1 -1
  267. package/dist/SchemaAST.js +131 -25
  268. package/dist/SchemaAST.js.map +1 -1
  269. package/dist/SchemaGetter.d.ts +5 -5
  270. package/dist/SchemaGetter.d.ts.map +1 -1
  271. package/dist/SchemaGetter.js +18 -18
  272. package/dist/SchemaGetter.js.map +1 -1
  273. package/dist/SchemaParser.d.ts +44 -54
  274. package/dist/SchemaParser.d.ts.map +1 -1
  275. package/dist/SchemaParser.js +55 -2
  276. package/dist/SchemaParser.js.map +1 -1
  277. package/dist/SchemaRepresentation.d.ts +46 -45
  278. package/dist/SchemaRepresentation.d.ts.map +1 -1
  279. package/dist/SchemaRepresentation.js +49 -24
  280. package/dist/SchemaRepresentation.js.map +1 -1
  281. package/dist/SchemaTransformation.d.ts +107 -3
  282. package/dist/SchemaTransformation.d.ts.map +1 -1
  283. package/dist/SchemaTransformation.js +173 -13
  284. package/dist/SchemaTransformation.js.map +1 -1
  285. package/dist/ScopedCache.d.ts +2 -2
  286. package/dist/ScopedCache.d.ts.map +1 -1
  287. package/dist/ScopedCache.js +1 -1
  288. package/dist/ScopedCache.js.map +1 -1
  289. package/dist/Semaphore.d.ts +307 -0
  290. package/dist/Semaphore.d.ts.map +1 -0
  291. package/dist/Semaphore.js +222 -0
  292. package/dist/Semaphore.js.map +1 -0
  293. package/dist/ServiceMap.d.ts +76 -52
  294. package/dist/ServiceMap.d.ts.map +1 -1
  295. package/dist/ServiceMap.js +45 -29
  296. package/dist/ServiceMap.js.map +1 -1
  297. package/dist/Sink.d.ts +18 -15
  298. package/dist/Sink.d.ts.map +1 -1
  299. package/dist/Sink.js +53 -6
  300. package/dist/Sink.js.map +1 -1
  301. package/dist/Stdio.d.ts +16 -4
  302. package/dist/Stdio.d.ts.map +1 -1
  303. package/dist/Stdio.js +18 -0
  304. package/dist/Stdio.js.map +1 -1
  305. package/dist/Stream.d.ts +284 -431
  306. package/dist/Stream.d.ts.map +1 -1
  307. package/dist/Stream.js +189 -88
  308. package/dist/Stream.js.map +1 -1
  309. package/dist/String.d.ts +114 -47
  310. package/dist/String.d.ts.map +1 -1
  311. package/dist/String.js +29 -47
  312. package/dist/String.js.map +1 -1
  313. package/dist/Struct.d.ts +23 -7
  314. package/dist/Struct.d.ts.map +1 -1
  315. package/dist/Struct.js +22 -0
  316. package/dist/Struct.js.map +1 -1
  317. package/dist/SubscriptionRef.d.ts +3 -3
  318. package/dist/SubscriptionRef.d.ts.map +1 -1
  319. package/dist/SubscriptionRef.js +85 -117
  320. package/dist/SubscriptionRef.js.map +1 -1
  321. package/dist/SynchronizedRef.d.ts +2 -1
  322. package/dist/SynchronizedRef.d.ts.map +1 -1
  323. package/dist/SynchronizedRef.js +2 -1
  324. package/dist/SynchronizedRef.js.map +1 -1
  325. package/dist/Terminal.d.ts +2 -1
  326. package/dist/Terminal.d.ts.map +1 -1
  327. package/dist/Terminal.js.map +1 -1
  328. package/dist/Tracer.d.ts +5 -4
  329. package/dist/Tracer.d.ts.map +1 -1
  330. package/dist/Tracer.js +2 -1
  331. package/dist/Tracer.js.map +1 -1
  332. package/dist/Trie.d.ts +44 -31
  333. package/dist/Trie.d.ts.map +1 -1
  334. package/dist/Trie.js +13 -9
  335. package/dist/Trie.js.map +1 -1
  336. package/dist/TxChunk.d.ts +37 -37
  337. package/dist/TxChunk.d.ts.map +1 -1
  338. package/dist/TxChunk.js +3 -3
  339. package/dist/TxChunk.js.map +1 -1
  340. package/dist/TxDeferred.d.ts +328 -0
  341. package/dist/TxDeferred.d.ts.map +1 -0
  342. package/dist/TxDeferred.js +197 -0
  343. package/dist/TxDeferred.js.map +1 -0
  344. package/dist/TxHashMap.d.ts +159 -140
  345. package/dist/TxHashMap.d.ts.map +1 -1
  346. package/dist/TxHashMap.js +51 -44
  347. package/dist/TxHashMap.js.map +1 -1
  348. package/dist/TxHashSet.d.ts +36 -36
  349. package/dist/TxHashSet.d.ts.map +1 -1
  350. package/dist/TxHashSet.js +16 -15
  351. package/dist/TxHashSet.js.map +1 -1
  352. package/dist/TxPriorityQueue.d.ts +609 -0
  353. package/dist/TxPriorityQueue.d.ts.map +1 -0
  354. package/dist/TxPriorityQueue.js +416 -0
  355. package/dist/TxPriorityQueue.js.map +1 -0
  356. package/dist/TxPubSub.d.ts +585 -0
  357. package/dist/TxPubSub.d.ts.map +1 -0
  358. package/dist/TxPubSub.js +521 -0
  359. package/dist/TxPubSub.js.map +1 -0
  360. package/dist/TxQueue.d.ts +32 -32
  361. package/dist/TxQueue.d.ts.map +1 -1
  362. package/dist/TxQueue.js +26 -26
  363. package/dist/TxQueue.js.map +1 -1
  364. package/dist/TxReentrantLock.d.ts +523 -0
  365. package/dist/TxReentrantLock.d.ts.map +1 -0
  366. package/dist/TxReentrantLock.js +504 -0
  367. package/dist/TxReentrantLock.js.map +1 -0
  368. package/dist/TxRef.d.ts +34 -34
  369. package/dist/TxRef.d.ts.map +1 -1
  370. package/dist/TxRef.js +21 -14
  371. package/dist/TxRef.js.map +1 -1
  372. package/dist/TxSemaphore.d.ts +170 -10
  373. package/dist/TxSemaphore.d.ts.map +1 -1
  374. package/dist/TxSemaphore.js +23 -8
  375. package/dist/TxSemaphore.js.map +1 -1
  376. package/dist/TxSubscriptionRef.d.ts +508 -0
  377. package/dist/TxSubscriptionRef.d.ts.map +1 -0
  378. package/dist/TxSubscriptionRef.js +293 -0
  379. package/dist/TxSubscriptionRef.js.map +1 -0
  380. package/dist/Types.d.ts +80 -23
  381. package/dist/Types.d.ts.map +1 -1
  382. package/dist/Utils.d.ts +137 -65
  383. package/dist/Utils.d.ts.map +1 -1
  384. package/dist/Utils.js +38 -66
  385. package/dist/Utils.js.map +1 -1
  386. package/dist/index.d.ts +806 -55
  387. package/dist/index.d.ts.map +1 -1
  388. package/dist/index.js +806 -55
  389. package/dist/index.js.map +1 -1
  390. package/dist/internal/core.js +11 -3
  391. package/dist/internal/core.js.map +1 -1
  392. package/dist/internal/dateTime.js +77 -71
  393. package/dist/internal/dateTime.js.map +1 -1
  394. package/dist/internal/effect.js +284 -201
  395. package/dist/internal/effect.js.map +1 -1
  396. package/dist/internal/hashMap.js +7 -5
  397. package/dist/internal/hashMap.js.map +1 -1
  398. package/dist/internal/option.js +6 -0
  399. package/dist/internal/option.js.map +1 -1
  400. package/dist/internal/random.d.ts +2 -0
  401. package/dist/internal/random.d.ts.map +1 -0
  402. package/dist/internal/random.js +13 -0
  403. package/dist/internal/random.js.map +1 -0
  404. package/dist/internal/rcRef.js +3 -2
  405. package/dist/internal/rcRef.js.map +1 -1
  406. package/dist/internal/references.d.ts +2 -0
  407. package/dist/internal/references.d.ts.map +1 -0
  408. package/dist/internal/references.js +51 -0
  409. package/dist/internal/references.js.map +1 -0
  410. package/dist/internal/request.js +2 -2
  411. package/dist/internal/request.js.map +1 -1
  412. package/dist/internal/schema/annotations.js +2 -0
  413. package/dist/internal/schema/annotations.js.map +1 -1
  414. package/dist/internal/schema/representation.js +75 -106
  415. package/dist/internal/schema/representation.js.map +1 -1
  416. package/dist/internal/schema/schema.js +1 -0
  417. package/dist/internal/schema/schema.js.map +1 -1
  418. package/dist/internal/schema/to-codec.js +7 -10
  419. package/dist/internal/schema/to-codec.js.map +1 -1
  420. package/dist/internal/trie.js +8 -7
  421. package/dist/internal/trie.js.map +1 -1
  422. package/dist/testing/TestClock.d.ts +8 -7
  423. package/dist/testing/TestClock.d.ts.map +1 -1
  424. package/dist/testing/TestClock.js +6 -4
  425. package/dist/testing/TestClock.js.map +1 -1
  426. package/dist/testing/TestSchema.d.ts +266 -32
  427. package/dist/testing/TestSchema.d.ts.map +1 -1
  428. package/dist/testing/TestSchema.js +296 -23
  429. package/dist/testing/TestSchema.js.map +1 -1
  430. package/dist/testing/index.d.ts +64 -1
  431. package/dist/testing/index.d.ts.map +1 -1
  432. package/dist/testing/index.js +64 -1
  433. package/dist/testing/index.js.map +1 -1
  434. package/dist/unstable/ai/AiError.d.ts +136 -54
  435. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  436. package/dist/unstable/ai/AiError.js +28 -23
  437. package/dist/unstable/ai/AiError.js.map +1 -1
  438. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  439. package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
  440. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  441. package/dist/unstable/ai/Chat.d.ts +35 -7
  442. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  443. package/dist/unstable/ai/Chat.js +38 -44
  444. package/dist/unstable/ai/Chat.js.map +1 -1
  445. package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
  446. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
  447. package/dist/unstable/ai/EmbeddingModel.js +127 -0
  448. package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
  449. package/dist/unstable/ai/LanguageModel.d.ts +117 -47
  450. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  451. package/dist/unstable/ai/LanguageModel.js +258 -59
  452. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  453. package/dist/unstable/ai/McpSchema.d.ts +183 -88
  454. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  455. package/dist/unstable/ai/McpSchema.js +57 -12
  456. package/dist/unstable/ai/McpSchema.js.map +1 -1
  457. package/dist/unstable/ai/McpServer.d.ts +66 -13
  458. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  459. package/dist/unstable/ai/McpServer.js +193 -51
  460. package/dist/unstable/ai/McpServer.js.map +1 -1
  461. package/dist/unstable/ai/Model.d.ts +25 -7
  462. package/dist/unstable/ai/Model.d.ts.map +1 -1
  463. package/dist/unstable/ai/Model.js +22 -6
  464. package/dist/unstable/ai/Model.js.map +1 -1
  465. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  466. package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
  467. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  468. package/dist/unstable/ai/Prompt.d.ts +20 -20
  469. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  470. package/dist/unstable/ai/Response.d.ts +26 -26
  471. package/dist/unstable/ai/Response.d.ts.map +1 -1
  472. package/dist/unstable/ai/Response.js +1 -1
  473. package/dist/unstable/ai/Response.js.map +1 -1
  474. package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
  475. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
  476. package/dist/unstable/ai/ResponseIdTracker.js +68 -0
  477. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
  478. package/dist/unstable/ai/Tool.d.ts +34 -4
  479. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  480. package/dist/unstable/ai/Tool.js +28 -10
  481. package/dist/unstable/ai/Tool.js.map +1 -1
  482. package/dist/unstable/ai/Toolkit.d.ts +1 -1
  483. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  484. package/dist/unstable/ai/Toolkit.js +4 -11
  485. package/dist/unstable/ai/Toolkit.js.map +1 -1
  486. package/dist/unstable/ai/index.d.ts +22 -1
  487. package/dist/unstable/ai/index.d.ts.map +1 -1
  488. package/dist/unstable/ai/index.js +22 -1
  489. package/dist/unstable/ai/index.js.map +1 -1
  490. package/dist/unstable/ai/internal/codec-transformer.js +0 -5
  491. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  492. package/dist/unstable/cli/Argument.d.ts +2 -4
  493. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  494. package/dist/unstable/cli/Argument.js +1 -3
  495. package/dist/unstable/cli/Argument.js.map +1 -1
  496. package/dist/unstable/cli/CliError.d.ts +27 -60
  497. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  498. package/dist/unstable/cli/CliError.js +25 -57
  499. package/dist/unstable/cli/CliError.js.map +1 -1
  500. package/dist/unstable/cli/CliOutput.d.ts +3 -2
  501. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  502. package/dist/unstable/cli/CliOutput.js +65 -10
  503. package/dist/unstable/cli/CliOutput.js.map +1 -1
  504. package/dist/unstable/cli/Command.d.ts +371 -58
  505. package/dist/unstable/cli/Command.d.ts.map +1 -1
  506. package/dist/unstable/cli/Command.js +328 -67
  507. package/dist/unstable/cli/Command.js.map +1 -1
  508. package/dist/unstable/cli/Completions.d.ts +16 -0
  509. package/dist/unstable/cli/Completions.d.ts.map +1 -0
  510. package/dist/unstable/cli/Completions.js +23 -0
  511. package/dist/unstable/cli/Completions.js.map +1 -0
  512. package/dist/unstable/cli/Flag.d.ts +2 -2
  513. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  514. package/dist/unstable/cli/Flag.js +1 -1
  515. package/dist/unstable/cli/Flag.js.map +1 -1
  516. package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
  517. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
  518. package/dist/unstable/cli/GlobalFlag.js +118 -0
  519. package/dist/unstable/cli/GlobalFlag.js.map +1 -0
  520. package/dist/unstable/cli/HelpDoc.d.ts +81 -11
  521. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  522. package/dist/unstable/cli/Param.d.ts +4 -4
  523. package/dist/unstable/cli/Param.d.ts.map +1 -1
  524. package/dist/unstable/cli/Param.js +7 -7
  525. package/dist/unstable/cli/Param.js.map +1 -1
  526. package/dist/unstable/cli/Primitive.d.ts +2 -2
  527. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  528. package/dist/unstable/cli/Primitive.js +1 -1
  529. package/dist/unstable/cli/Primitive.js.map +1 -1
  530. package/dist/unstable/cli/Prompt.js +259 -85
  531. package/dist/unstable/cli/Prompt.js.map +1 -1
  532. package/dist/unstable/cli/index.d.ts +8 -0
  533. package/dist/unstable/cli/index.d.ts.map +1 -1
  534. package/dist/unstable/cli/index.js +8 -0
  535. package/dist/unstable/cli/index.js.map +1 -1
  536. package/dist/unstable/cli/internal/command.d.ts +40 -14
  537. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  538. package/dist/unstable/cli/internal/command.js +72 -46
  539. package/dist/unstable/cli/internal/command.js.map +1 -1
  540. package/dist/unstable/cli/internal/completions/CommandDescriptor.js +16 -4
  541. package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
  542. package/dist/unstable/cli/internal/config.js +42 -0
  543. package/dist/unstable/cli/internal/config.js.map +1 -1
  544. package/dist/unstable/cli/internal/help.d.ts +33 -0
  545. package/dist/unstable/cli/internal/help.d.ts.map +1 -0
  546. package/dist/unstable/cli/internal/help.js +125 -0
  547. package/dist/unstable/cli/internal/help.js.map +1 -0
  548. package/dist/unstable/cli/internal/parser.js +61 -43
  549. package/dist/unstable/cli/internal/parser.js.map +1 -1
  550. package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
  551. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  552. package/dist/unstable/cluster/ClusterCron.js +1 -1
  553. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  554. package/dist/unstable/cluster/ClusterSchema.d.ts +18 -0
  555. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  556. package/dist/unstable/cluster/ClusterSchema.js +21 -1
  557. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  558. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
  559. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  560. package/dist/unstable/cluster/ClusterWorkflowEngine.js +35 -29
  561. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  562. package/dist/unstable/cluster/DeliverAt.js +1 -1
  563. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  564. package/dist/unstable/cluster/Entity.d.ts +10 -8
  565. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  566. package/dist/unstable/cluster/Entity.js +8 -7
  567. package/dist/unstable/cluster/Entity.js.map +1 -1
  568. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  569. package/dist/unstable/cluster/EntityAddress.js +1 -1
  570. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  571. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  572. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  573. package/dist/unstable/cluster/Envelope.d.ts +1 -1
  574. package/dist/unstable/cluster/K8sHttpClient.d.ts +1 -1
  575. package/dist/unstable/cluster/K8sHttpClient.js +4 -4
  576. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  577. package/dist/unstable/cluster/Message.d.ts +18 -15
  578. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  579. package/dist/unstable/cluster/Message.js +15 -7
  580. package/dist/unstable/cluster/Message.js.map +1 -1
  581. package/dist/unstable/cluster/MessageStorage.d.ts +33 -10
  582. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  583. package/dist/unstable/cluster/MessageStorage.js +36 -20
  584. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  585. package/dist/unstable/cluster/Reply.d.ts +8 -7
  586. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  587. package/dist/unstable/cluster/Reply.js +4 -3
  588. package/dist/unstable/cluster/Reply.js.map +1 -1
  589. package/dist/unstable/cluster/Runner.d.ts +1 -1
  590. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  591. package/dist/unstable/cluster/Runner.js +1 -1
  592. package/dist/unstable/cluster/Runner.js.map +1 -1
  593. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  594. package/dist/unstable/cluster/RunnerAddress.js +1 -1
  595. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  596. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  597. package/dist/unstable/cluster/RunnerServer.js +9 -8
  598. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  599. package/dist/unstable/cluster/Runners.d.ts +2 -1
  600. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  601. package/dist/unstable/cluster/Runners.js +11 -9
  602. package/dist/unstable/cluster/Runners.js.map +1 -1
  603. package/dist/unstable/cluster/ShardId.js +3 -3
  604. package/dist/unstable/cluster/ShardId.js.map +1 -1
  605. package/dist/unstable/cluster/Sharding.d.ts +2 -2
  606. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  607. package/dist/unstable/cluster/Sharding.js +51 -39
  608. package/dist/unstable/cluster/Sharding.js.map +1 -1
  609. package/dist/unstable/cluster/ShardingConfig.d.ts +26 -25
  610. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  611. package/dist/unstable/cluster/ShardingConfig.js +24 -24
  612. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  613. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  614. package/dist/unstable/cluster/SqlMessageStorage.js +25 -19
  615. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  616. package/dist/unstable/cluster/SqlRunnerStorage.js +1 -1
  617. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  618. package/dist/unstable/cluster/internal/entityManager.js +24 -18
  619. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  620. package/dist/unstable/cluster/internal/entityReaper.js +2 -1
  621. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  622. package/dist/unstable/cluster/internal/resourceRef.js +2 -1
  623. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  624. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  625. package/dist/unstable/devtools/DevToolsClient.js +4 -3
  626. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  627. package/dist/unstable/devtools/DevToolsSchema.d.ts +40 -40
  628. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  629. package/dist/unstable/devtools/DevToolsSchema.js +9 -2
  630. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  631. package/dist/unstable/encoding/Msgpack.d.ts +1 -1
  632. package/dist/unstable/encoding/Ndjson.d.ts +9 -9
  633. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  634. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  635. package/dist/unstable/encoding/Sse.d.ts +4 -4
  636. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  637. package/dist/unstable/encoding/Sse.js +1 -1
  638. package/dist/unstable/encoding/Sse.js.map +1 -1
  639. package/dist/unstable/eventlog/EventJournal.d.ts +2 -2
  640. package/dist/unstable/eventlog/EventJournal.js +2 -2
  641. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  642. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  643. package/dist/unstable/eventlog/EventLog.js +3 -2
  644. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  645. package/dist/unstable/eventlog/EventLogRemote.d.ts +6 -6
  646. package/dist/unstable/eventlog/SqlEventLogJournal.js +2 -2
  647. package/dist/unstable/eventlog/SqlEventLogJournal.js.map +1 -1
  648. package/dist/unstable/http/Cookies.d.ts +52 -7
  649. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  650. package/dist/unstable/http/Cookies.js +27 -6
  651. package/dist/unstable/http/Cookies.js.map +1 -1
  652. package/dist/unstable/http/Etag.d.ts.map +1 -1
  653. package/dist/unstable/http/Etag.js +5 -1
  654. package/dist/unstable/http/Etag.js.map +1 -1
  655. package/dist/unstable/http/Headers.d.ts +19 -2
  656. package/dist/unstable/http/Headers.d.ts.map +1 -1
  657. package/dist/unstable/http/Headers.js +40 -11
  658. package/dist/unstable/http/Headers.js.map +1 -1
  659. package/dist/unstable/http/HttpBody.d.ts +1 -1
  660. package/dist/unstable/http/HttpClient.d.ts +117 -15
  661. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  662. package/dist/unstable/http/HttpClient.js +191 -13
  663. package/dist/unstable/http/HttpClient.js.map +1 -1
  664. package/dist/unstable/http/HttpClientError.d.ts +7 -7
  665. package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
  666. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  667. package/dist/unstable/http/HttpClientRequest.js +131 -21
  668. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  669. package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
  670. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  671. package/dist/unstable/http/HttpClientResponse.js +6 -1
  672. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  673. package/dist/unstable/http/HttpEffect.d.ts +7 -5
  674. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  675. package/dist/unstable/http/HttpEffect.js +46 -54
  676. package/dist/unstable/http/HttpEffect.js.map +1 -1
  677. package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -2
  678. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  679. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  680. package/dist/unstable/http/HttpMethod.d.ts +4 -4
  681. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  682. package/dist/unstable/http/HttpMethod.js +3 -3
  683. package/dist/unstable/http/HttpMethod.js.map +1 -1
  684. package/dist/unstable/http/HttpMiddleware.d.ts +1 -6
  685. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  686. package/dist/unstable/http/HttpMiddleware.js +24 -32
  687. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  688. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  689. package/dist/unstable/http/HttpPlatform.js +3 -2
  690. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  691. package/dist/unstable/http/HttpRouter.d.ts +2 -1
  692. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  693. package/dist/unstable/http/HttpRouter.js +7 -7
  694. package/dist/unstable/http/HttpRouter.js.map +1 -1
  695. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  696. package/dist/unstable/http/HttpServer.js +2 -2
  697. package/dist/unstable/http/HttpServer.js.map +1 -1
  698. package/dist/unstable/http/HttpServerError.d.ts +22 -34
  699. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  700. package/dist/unstable/http/HttpServerError.js +39 -45
  701. package/dist/unstable/http/HttpServerError.js.map +1 -1
  702. package/dist/unstable/http/HttpServerRequest.d.ts +15 -3
  703. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  704. package/dist/unstable/http/HttpServerRequest.js +301 -7
  705. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  706. package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
  707. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  708. package/dist/unstable/http/HttpServerRespondable.js +5 -5
  709. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  710. package/dist/unstable/http/HttpServerResponse.d.ts +50 -3
  711. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  712. package/dist/unstable/http/HttpServerResponse.js +236 -1
  713. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  714. package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
  715. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
  716. package/dist/unstable/http/HttpStaticServer.js +353 -0
  717. package/dist/unstable/http/HttpStaticServer.js.map +1 -0
  718. package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
  719. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  720. package/dist/unstable/http/HttpTraceContext.js +27 -15
  721. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  722. package/dist/unstable/http/Multipart.d.ts +3 -3
  723. package/dist/unstable/http/Url.d.ts +604 -0
  724. package/dist/unstable/http/Url.d.ts.map +1 -0
  725. package/dist/unstable/http/Url.js +256 -0
  726. package/dist/unstable/http/Url.js.map +1 -0
  727. package/dist/unstable/http/UrlParams.d.ts +19 -10
  728. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  729. package/dist/unstable/http/UrlParams.js +6 -7
  730. package/dist/unstable/http/UrlParams.js.map +1 -1
  731. package/dist/unstable/http/index.d.ts +8 -0
  732. package/dist/unstable/http/index.d.ts.map +1 -1
  733. package/dist/unstable/http/index.js +8 -0
  734. package/dist/unstable/http/index.js.map +1 -1
  735. package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
  736. package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
  737. package/dist/unstable/http/internal/preResponseHandler.js +10 -0
  738. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
  739. package/dist/unstable/httpapi/HttpApi.d.ts +4 -4
  740. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  741. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  742. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +11 -5
  743. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  744. package/dist/unstable/httpapi/HttpApiBuilder.js +40 -27
  745. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  746. package/dist/unstable/httpapi/HttpApiClient.d.ts +83 -7
  747. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  748. package/dist/unstable/httpapi/HttpApiClient.js +78 -10
  749. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  750. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +207 -101
  751. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  752. package/dist/unstable/httpapi/HttpApiEndpoint.js +49 -43
  753. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  754. package/dist/unstable/httpapi/HttpApiError.d.ts +31 -14
  755. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  756. package/dist/unstable/httpapi/HttpApiError.js +125 -32
  757. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  758. package/dist/unstable/httpapi/HttpApiGroup.d.ts +4 -3
  759. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  760. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  761. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +46 -15
  762. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  763. package/dist/unstable/httpapi/HttpApiMiddleware.js +32 -3
  764. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  765. package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
  766. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  767. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  768. package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -3
  769. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  770. package/dist/unstable/httpapi/HttpApiSchema.js +20 -2
  771. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  772. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +2 -2
  773. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  774. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  775. package/dist/unstable/httpapi/OpenApi.d.ts +1 -0
  776. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  777. package/dist/unstable/httpapi/OpenApi.js +34 -26
  778. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  779. package/dist/unstable/observability/Otlp.d.ts +12 -12
  780. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  781. package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
  782. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  783. package/dist/unstable/observability/OtlpExporter.js +3 -3
  784. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  785. package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
  786. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  787. package/dist/unstable/observability/OtlpLogger.js +7 -4
  788. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  789. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
  790. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  791. package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
  792. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  793. package/dist/unstable/observability/OtlpTracer.js +7 -3
  794. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  795. package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
  796. package/dist/unstable/persistence/KeyValueStore.js +6 -6
  797. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  798. package/dist/unstable/persistence/Persistable.d.ts +2 -2
  799. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  800. package/dist/unstable/persistence/Persistable.js +1 -1
  801. package/dist/unstable/persistence/Persistable.js.map +1 -1
  802. package/dist/unstable/persistence/PersistedCache.d.ts +6 -5
  803. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  804. package/dist/unstable/persistence/PersistedCache.js +2 -1
  805. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  806. package/dist/unstable/persistence/PersistedQueue.d.ts +12 -12
  807. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  808. package/dist/unstable/persistence/PersistedQueue.js +12 -11
  809. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  810. package/dist/unstable/persistence/Persistence.d.ts +1 -1
  811. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  812. package/dist/unstable/persistence/Persistence.js +2 -2
  813. package/dist/unstable/persistence/Persistence.js.map +1 -1
  814. package/dist/unstable/persistence/RateLimiter.d.ts +3 -3
  815. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  816. package/dist/unstable/persistence/RateLimiter.js +1 -1
  817. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  818. package/dist/unstable/process/ChildProcess.d.ts +5 -128
  819. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  820. package/dist/unstable/process/ChildProcess.js +1 -65
  821. package/dist/unstable/process/ChildProcess.js.map +1 -1
  822. package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -7
  823. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  824. package/dist/unstable/process/ChildProcessSpawner.js +21 -1
  825. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  826. package/dist/unstable/reactivity/Atom.d.ts +73 -12
  827. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  828. package/dist/unstable/reactivity/Atom.js +108 -25
  829. package/dist/unstable/reactivity/Atom.js.map +1 -1
  830. package/dist/unstable/reactivity/AtomHttpApi.d.ts +17 -15
  831. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  832. package/dist/unstable/reactivity/AtomHttpApi.js +45 -15
  833. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  834. package/dist/unstable/reactivity/AtomRegistry.d.ts +6 -0
  835. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  836. package/dist/unstable/reactivity/AtomRegistry.js +54 -11
  837. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  838. package/dist/unstable/reactivity/AtomRpc.d.ts +9 -9
  839. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  840. package/dist/unstable/reactivity/AtomRpc.js +47 -21
  841. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  842. package/dist/unstable/reactivity/Hydration.d.ts +39 -0
  843. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -0
  844. package/dist/unstable/reactivity/Hydration.js +76 -0
  845. package/dist/unstable/reactivity/Hydration.js.map +1 -0
  846. package/dist/unstable/reactivity/index.d.ts +4 -0
  847. package/dist/unstable/reactivity/index.d.ts.map +1 -1
  848. package/dist/unstable/reactivity/index.js +4 -0
  849. package/dist/unstable/reactivity/index.js.map +1 -1
  850. package/dist/unstable/rpc/Rpc.d.ts +6 -5
  851. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  852. package/dist/unstable/rpc/Rpc.js +4 -3
  853. package/dist/unstable/rpc/Rpc.js.map +1 -1
  854. package/dist/unstable/rpc/RpcClient.d.ts +5 -26
  855. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  856. package/dist/unstable/rpc/RpcClient.js +53 -43
  857. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  858. package/dist/unstable/rpc/RpcGroup.d.ts +3 -5
  859. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  860. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  861. package/dist/unstable/rpc/RpcMiddleware.d.ts +8 -8
  862. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  863. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  864. package/dist/unstable/rpc/RpcSchema.d.ts +13 -0
  865. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  866. package/dist/unstable/rpc/RpcSchema.js +17 -2
  867. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  868. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  869. package/dist/unstable/rpc/RpcSerialization.js +39 -11
  870. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  871. package/dist/unstable/rpc/RpcServer.d.ts +6 -10
  872. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  873. package/dist/unstable/rpc/RpcServer.js +20 -19
  874. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  875. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  876. package/dist/unstable/rpc/Utils.js +3 -2
  877. package/dist/unstable/rpc/Utils.js.map +1 -1
  878. package/dist/unstable/schema/Model.d.ts +22 -1
  879. package/dist/unstable/schema/Model.d.ts.map +1 -1
  880. package/dist/unstable/schema/Model.js +15 -0
  881. package/dist/unstable/schema/Model.js.map +1 -1
  882. package/dist/unstable/schema/VariantSchema.d.ts +6 -6
  883. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  884. package/dist/unstable/schema/VariantSchema.js +6 -6
  885. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  886. package/dist/unstable/socket/Socket.d.ts +6 -5
  887. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  888. package/dist/unstable/socket/Socket.js +12 -9
  889. package/dist/unstable/socket/Socket.js.map +1 -1
  890. package/dist/unstable/socket/SocketServer.d.ts +3 -3
  891. package/dist/unstable/sql/Migrator.d.ts +1 -1
  892. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  893. package/dist/unstable/sql/Migrator.js +2 -2
  894. package/dist/unstable/sql/Migrator.js.map +1 -1
  895. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  896. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  897. package/dist/unstable/sql/SqlClient.js +1 -1
  898. package/dist/unstable/sql/SqlClient.js.map +1 -1
  899. package/dist/unstable/sql/SqlError.d.ts +237 -17
  900. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  901. package/dist/unstable/sql/SqlError.js +260 -4
  902. package/dist/unstable/sql/SqlError.js.map +1 -1
  903. package/dist/unstable/sql/SqlModel.d.ts +2 -2
  904. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  905. package/dist/unstable/sql/SqlModel.js +3 -3
  906. package/dist/unstable/sql/SqlModel.js.map +1 -1
  907. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  908. package/dist/unstable/sql/SqlResolver.js +17 -8
  909. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  910. package/dist/unstable/sql/SqlSchema.d.ts +17 -6
  911. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  912. package/dist/unstable/sql/SqlSchema.js +17 -7
  913. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  914. package/dist/unstable/sql/Statement.js +0 -1
  915. package/dist/unstable/sql/Statement.js.map +1 -1
  916. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  917. package/dist/unstable/workers/Worker.js +2 -1
  918. package/dist/unstable/workers/Worker.js.map +1 -1
  919. package/dist/unstable/workflow/Activity.d.ts +5 -0
  920. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  921. package/dist/unstable/workflow/Activity.js +13 -0
  922. package/dist/unstable/workflow/Activity.js.map +1 -1
  923. package/dist/unstable/workflow/DurableClock.d.ts +3 -3
  924. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  925. package/dist/unstable/workflow/DurableClock.js +3 -3
  926. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  927. package/dist/unstable/workflow/DurableDeferred.js +8 -8
  928. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  929. package/dist/unstable/workflow/Workflow.d.ts +5 -4
  930. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  931. package/dist/unstable/workflow/Workflow.js +1 -1
  932. package/dist/unstable/workflow/Workflow.js.map +1 -1
  933. package/dist/unstable/workflow/WorkflowEngine.d.ts +17 -5
  934. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  935. package/dist/unstable/workflow/WorkflowEngine.js +153 -12
  936. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  937. package/package.json +2 -2
  938. package/src/Array.ts +304 -447
  939. package/src/BigDecimal.ts +117 -66
  940. package/src/BigInt.ts +49 -41
  941. package/src/Brand.ts +1 -1
  942. package/src/Cache.ts +9 -8
  943. package/src/Cause.ts +37 -2
  944. package/src/Channel.ts +582 -154
  945. package/src/Chunk.ts +149 -331
  946. package/src/Combiner.ts +280 -13
  947. package/src/Config.ts +195 -25
  948. package/src/Cron.ts +155 -63
  949. package/src/Data.ts +539 -376
  950. package/src/DateTime.ts +75 -256
  951. package/src/Deferred.ts +8 -6
  952. package/src/Duration.ts +122 -66
  953. package/src/Effect.ts +1484 -1157
  954. package/src/Encoding.ts +879 -0
  955. package/src/Equal.ts +278 -111
  956. package/src/Equivalence.ts +114 -52
  957. package/src/ErrorReporter.ts +458 -0
  958. package/src/Exit.ts +24 -12
  959. package/src/Fiber.ts +12 -3
  960. package/src/FiberHandle.ts +10 -9
  961. package/src/FiberMap.ts +22 -22
  962. package/src/FileSystem.ts +34 -31
  963. package/src/Filter.ts +52 -63
  964. package/src/Formatter.ts +253 -51
  965. package/src/Function.ts +2 -10
  966. package/src/Graph.ts +131 -117
  967. package/src/HashMap.ts +26 -19
  968. package/src/Iterable.ts +117 -63
  969. package/src/JsonSchema.ts +383 -10
  970. package/src/Latch.ts +194 -0
  971. package/src/Layer.ts +394 -160
  972. package/src/LayerMap.ts +11 -9
  973. package/src/LogLevel.ts +37 -0
  974. package/src/Logger.ts +33 -100
  975. package/src/ManagedRuntime.ts +35 -22
  976. package/src/Metric.ts +6 -8
  977. package/src/MutableHashMap.ts +9 -0
  978. package/src/MutableHashSet.ts +9 -0
  979. package/src/Newtype.ts +308 -0
  980. package/src/Number.ts +85 -26
  981. package/src/Optic.ts +948 -19
  982. package/src/Option.ts +34 -24
  983. package/src/Order.ts +39 -32
  984. package/src/PartitionedSemaphore.ts +288 -56
  985. package/src/Pipeable.ts +32 -1
  986. package/src/PlatformError.ts +5 -5
  987. package/src/Pool.ts +13 -11
  988. package/src/PubSub.ts +30 -20
  989. package/src/Pull.ts +1 -1
  990. package/src/Queue.ts +11 -9
  991. package/src/Random.ts +51 -14
  992. package/src/RcMap.ts +5 -5
  993. package/src/RcRef.ts +1 -1
  994. package/src/Record.ts +94 -199
  995. package/src/Reducer.ts +166 -7
  996. package/src/References.ts +283 -287
  997. package/src/Request.ts +3 -2
  998. package/src/RequestResolver.ts +29 -49
  999. package/src/Resource.ts +2 -1
  1000. package/src/Result.ts +2 -4
  1001. package/src/Runtime.ts +102 -6
  1002. package/src/Schedule.ts +458 -449
  1003. package/src/Scheduler.ts +49 -126
  1004. package/src/Schema.ts +3298 -392
  1005. package/src/SchemaAST.ts +172 -33
  1006. package/src/SchemaGetter.ts +19 -21
  1007. package/src/SchemaParser.ts +92 -27
  1008. package/src/SchemaRepresentation.ts +51 -26
  1009. package/src/SchemaTransformation.ts +198 -13
  1010. package/src/ScopedCache.ts +3 -3
  1011. package/src/Semaphore.ts +444 -0
  1012. package/src/ServiceMap.ts +144 -97
  1013. package/src/Sink.ts +83 -28
  1014. package/src/Stdio.ts +27 -4
  1015. package/src/Stream.ts +687 -617
  1016. package/src/String.ts +122 -69
  1017. package/src/Struct.ts +33 -7
  1018. package/src/SubscriptionRef.ts +101 -120
  1019. package/src/SynchronizedRef.ts +3 -2
  1020. package/src/Terminal.ts +2 -1
  1021. package/src/Tracer.ts +6 -5
  1022. package/src/Trie.ts +44 -31
  1023. package/src/TxChunk.ts +72 -53
  1024. package/src/TxDeferred.ts +394 -0
  1025. package/src/TxHashMap.ts +409 -343
  1026. package/src/TxHashSet.ts +113 -118
  1027. package/src/TxPriorityQueue.ts +766 -0
  1028. package/src/TxPubSub.ts +789 -0
  1029. package/src/TxQueue.ts +241 -251
  1030. package/src/TxReentrantLock.ts +753 -0
  1031. package/src/TxRef.ts +50 -38
  1032. package/src/TxSemaphore.ts +217 -44
  1033. package/src/TxSubscriptionRef.ts +639 -0
  1034. package/src/Types.ts +73 -19
  1035. package/src/Utils.ts +137 -111
  1036. package/src/index.ts +816 -56
  1037. package/src/internal/core.ts +12 -5
  1038. package/src/internal/dateTime.ts +91 -96
  1039. package/src/internal/effect.ts +844 -432
  1040. package/src/internal/hashMap.ts +12 -10
  1041. package/src/internal/option.ts +7 -0
  1042. package/src/internal/random.ts +20 -0
  1043. package/src/internal/rcRef.ts +4 -3
  1044. package/src/internal/references.ts +72 -0
  1045. package/src/internal/request.ts +2 -2
  1046. package/src/internal/schema/annotations.ts +2 -0
  1047. package/src/internal/schema/representation.ts +73 -94
  1048. package/src/internal/schema/schema.ts +1 -0
  1049. package/src/internal/schema/to-codec.ts +7 -17
  1050. package/src/internal/trie.ts +21 -15
  1051. package/src/testing/TestClock.ts +13 -11
  1052. package/src/testing/TestSchema.ts +332 -35
  1053. package/src/testing/index.ts +64 -1
  1054. package/src/unstable/ai/AiError.ts +111 -54
  1055. package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
  1056. package/src/unstable/ai/Chat.ts +134 -85
  1057. package/src/unstable/ai/EmbeddingModel.ts +209 -0
  1058. package/src/unstable/ai/LanguageModel.ts +683 -253
  1059. package/src/unstable/ai/McpSchema.ts +73 -13
  1060. package/src/unstable/ai/McpServer.ts +271 -61
  1061. package/src/unstable/ai/Model.ts +40 -9
  1062. package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
  1063. package/src/unstable/ai/Prompt.ts +37 -37
  1064. package/src/unstable/ai/Response.ts +25 -25
  1065. package/src/unstable/ai/ResponseIdTracker.ts +97 -0
  1066. package/src/unstable/ai/Tool.ts +42 -16
  1067. package/src/unstable/ai/Toolkit.ts +5 -14
  1068. package/src/unstable/ai/index.ts +24 -1
  1069. package/src/unstable/ai/internal/codec-transformer.ts +0 -7
  1070. package/src/unstable/cli/Argument.ts +2 -4
  1071. package/src/unstable/cli/CliError.ts +47 -59
  1072. package/src/unstable/cli/CliOutput.ts +85 -13
  1073. package/src/unstable/cli/Command.ts +801 -192
  1074. package/src/unstable/cli/Completions.ts +36 -0
  1075. package/src/unstable/cli/Flag.ts +2 -2
  1076. package/src/unstable/cli/GlobalFlag.ts +242 -0
  1077. package/src/unstable/cli/HelpDoc.ts +91 -11
  1078. package/src/unstable/cli/Param.ts +15 -11
  1079. package/src/unstable/cli/Primitive.ts +2 -2
  1080. package/src/unstable/cli/Prompt.ts +265 -101
  1081. package/src/unstable/cli/index.ts +10 -0
  1082. package/src/unstable/cli/internal/command.ts +109 -63
  1083. package/src/unstable/cli/internal/completions/CommandDescriptor.ts +10 -4
  1084. package/src/unstable/cli/internal/config.ts +49 -0
  1085. package/src/unstable/cli/internal/help.ts +171 -0
  1086. package/src/unstable/cli/internal/parser.ts +71 -63
  1087. package/src/unstable/cluster/ClusterCron.ts +2 -2
  1088. package/src/unstable/cluster/ClusterSchema.ts +29 -1
  1089. package/src/unstable/cluster/ClusterWorkflowEngine.ts +62 -37
  1090. package/src/unstable/cluster/DeliverAt.ts +1 -1
  1091. package/src/unstable/cluster/Entity.ts +25 -22
  1092. package/src/unstable/cluster/EntityAddress.ts +1 -1
  1093. package/src/unstable/cluster/EntityResource.ts +4 -4
  1094. package/src/unstable/cluster/Envelope.ts +1 -1
  1095. package/src/unstable/cluster/K8sHttpClient.ts +5 -5
  1096. package/src/unstable/cluster/Message.ts +28 -15
  1097. package/src/unstable/cluster/MessageStorage.ts +66 -36
  1098. package/src/unstable/cluster/Reply.ts +7 -4
  1099. package/src/unstable/cluster/Runner.ts +1 -1
  1100. package/src/unstable/cluster/RunnerAddress.ts +1 -1
  1101. package/src/unstable/cluster/RunnerServer.ts +10 -13
  1102. package/src/unstable/cluster/Runners.ts +14 -12
  1103. package/src/unstable/cluster/ShardId.ts +2 -2
  1104. package/src/unstable/cluster/Sharding.ts +66 -49
  1105. package/src/unstable/cluster/ShardingConfig.ts +36 -37
  1106. package/src/unstable/cluster/SqlMessageStorage.ts +31 -19
  1107. package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
  1108. package/src/unstable/cluster/internal/entityManager.ts +50 -34
  1109. package/src/unstable/cluster/internal/entityReaper.ts +2 -1
  1110. package/src/unstable/cluster/internal/resourceRef.ts +2 -1
  1111. package/src/unstable/devtools/DevToolsClient.ts +23 -18
  1112. package/src/unstable/devtools/DevToolsSchema.ts +16 -3
  1113. package/src/unstable/encoding/Ndjson.ts +17 -17
  1114. package/src/unstable/encoding/Sse.ts +3 -5
  1115. package/src/unstable/eventlog/EventJournal.ts +2 -2
  1116. package/src/unstable/eventlog/EventLog.ts +3 -2
  1117. package/src/unstable/eventlog/SqlEventLogJournal.ts +2 -2
  1118. package/src/unstable/http/Cookies.ts +94 -11
  1119. package/src/unstable/http/Etag.ts +5 -3
  1120. package/src/unstable/http/Headers.ts +68 -18
  1121. package/src/unstable/http/HttpClient.ts +376 -34
  1122. package/src/unstable/http/HttpClientRequest.ts +151 -39
  1123. package/src/unstable/http/HttpClientResponse.ts +12 -6
  1124. package/src/unstable/http/HttpEffect.ts +54 -68
  1125. package/src/unstable/http/HttpIncomingMessage.ts +3 -2
  1126. package/src/unstable/http/HttpMethod.ts +16 -4
  1127. package/src/unstable/http/HttpMiddleware.ts +25 -39
  1128. package/src/unstable/http/HttpPlatform.ts +3 -2
  1129. package/src/unstable/http/HttpRouter.ts +9 -9
  1130. package/src/unstable/http/HttpServer.ts +3 -9
  1131. package/src/unstable/http/HttpServerError.ts +45 -47
  1132. package/src/unstable/http/HttpServerRequest.ts +407 -16
  1133. package/src/unstable/http/HttpServerRespondable.ts +6 -6
  1134. package/src/unstable/http/HttpServerResponse.ts +345 -7
  1135. package/src/unstable/http/HttpStaticServer.ts +456 -0
  1136. package/src/unstable/http/HttpTraceContext.ts +31 -17
  1137. package/src/unstable/http/Multipart.ts +2 -2
  1138. package/src/unstable/http/Url.ts +650 -0
  1139. package/src/unstable/http/UrlParams.ts +31 -19
  1140. package/src/unstable/http/index.ts +10 -0
  1141. package/src/unstable/http/internal/preResponseHandler.ts +15 -0
  1142. package/src/unstable/httpapi/HttpApi.ts +6 -6
  1143. package/src/unstable/httpapi/HttpApiBuilder.ts +106 -41
  1144. package/src/unstable/httpapi/HttpApiClient.ts +180 -28
  1145. package/src/unstable/httpapi/HttpApiEndpoint.ts +216 -104
  1146. package/src/unstable/httpapi/HttpApiError.ts +108 -30
  1147. package/src/unstable/httpapi/HttpApiGroup.ts +7 -6
  1148. package/src/unstable/httpapi/HttpApiMiddleware.ts +83 -22
  1149. package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
  1150. package/src/unstable/httpapi/HttpApiSchema.ts +21 -3
  1151. package/src/unstable/httpapi/HttpApiSecurity.ts +3 -3
  1152. package/src/unstable/httpapi/OpenApi.ts +44 -29
  1153. package/src/unstable/observability/Otlp.ts +12 -12
  1154. package/src/unstable/observability/OtlpExporter.ts +8 -5
  1155. package/src/unstable/observability/OtlpLogger.ts +13 -9
  1156. package/src/unstable/observability/OtlpMetrics.ts +4 -4
  1157. package/src/unstable/observability/OtlpTracer.ts +12 -8
  1158. package/src/unstable/persistence/KeyValueStore.ts +6 -6
  1159. package/src/unstable/persistence/Persistable.ts +3 -3
  1160. package/src/unstable/persistence/PersistedCache.ts +20 -9
  1161. package/src/unstable/persistence/PersistedQueue.ts +25 -24
  1162. package/src/unstable/persistence/Persistence.ts +3 -3
  1163. package/src/unstable/persistence/RateLimiter.ts +4 -4
  1164. package/src/unstable/process/ChildProcess.ts +6 -208
  1165. package/src/unstable/process/ChildProcessSpawner.ts +75 -14
  1166. package/src/unstable/reactivity/Atom.ts +212 -54
  1167. package/src/unstable/reactivity/AtomHttpApi.ts +81 -41
  1168. package/src/unstable/reactivity/AtomRegistry.ts +66 -12
  1169. package/src/unstable/reactivity/AtomRpc.ts +51 -20
  1170. package/src/unstable/reactivity/Hydration.ts +112 -0
  1171. package/src/unstable/reactivity/index.ts +5 -0
  1172. package/src/unstable/rpc/Rpc.ts +12 -12
  1173. package/src/unstable/rpc/RpcClient.ts +67 -96
  1174. package/src/unstable/rpc/RpcGroup.ts +7 -7
  1175. package/src/unstable/rpc/RpcMiddleware.ts +15 -9
  1176. package/src/unstable/rpc/RpcSchema.ts +23 -5
  1177. package/src/unstable/rpc/RpcSerialization.ts +49 -11
  1178. package/src/unstable/rpc/RpcServer.ts +31 -35
  1179. package/src/unstable/rpc/Utils.ts +3 -2
  1180. package/src/unstable/schema/Model.ts +31 -0
  1181. package/src/unstable/schema/VariantSchema.ts +10 -10
  1182. package/src/unstable/socket/Socket.ts +31 -27
  1183. package/src/unstable/sql/Migrator.ts +7 -5
  1184. package/src/unstable/sql/SqlClient.ts +6 -4
  1185. package/src/unstable/sql/SqlError.ts +365 -11
  1186. package/src/unstable/sql/SqlModel.ts +5 -5
  1187. package/src/unstable/sql/SqlResolver.ts +17 -7
  1188. package/src/unstable/sql/SqlSchema.ts +42 -26
  1189. package/src/unstable/sql/Statement.ts +0 -1
  1190. package/src/unstable/workers/Worker.ts +2 -1
  1191. package/src/unstable/workflow/Activity.ts +23 -0
  1192. package/src/unstable/workflow/DurableClock.ts +8 -8
  1193. package/src/unstable/workflow/DurableDeferred.ts +8 -8
  1194. package/src/unstable/workflow/Workflow.ts +7 -3
  1195. package/src/unstable/workflow/WorkflowEngine.ts +211 -19
  1196. package/dist/NullOr.d.ts +0 -149
  1197. package/dist/NullOr.d.ts.map +0 -1
  1198. package/dist/NullOr.js +0 -152
  1199. package/dist/NullOr.js.map +0 -1
  1200. package/dist/encoding/Base64.d.ts +0 -67
  1201. package/dist/encoding/Base64.d.ts.map +0 -1
  1202. package/dist/encoding/Base64.js +0 -146
  1203. package/dist/encoding/Base64.js.map +0 -1
  1204. package/dist/encoding/Base64Url.d.ts +0 -60
  1205. package/dist/encoding/Base64Url.d.ts.map +0 -1
  1206. package/dist/encoding/Base64Url.js +0 -89
  1207. package/dist/encoding/Base64Url.js.map +0 -1
  1208. package/dist/encoding/EncodingError.d.ts +0 -31
  1209. package/dist/encoding/EncodingError.d.ts.map +0 -1
  1210. package/dist/encoding/EncodingError.js +0 -22
  1211. package/dist/encoding/EncodingError.js.map +0 -1
  1212. package/dist/encoding/Hex.d.ts +0 -61
  1213. package/dist/encoding/Hex.d.ts.map +0 -1
  1214. package/dist/encoding/Hex.js +0 -115
  1215. package/dist/encoding/Hex.js.map +0 -1
  1216. package/dist/encoding/index.d.ts +0 -26
  1217. package/dist/encoding/index.d.ts.map +0 -1
  1218. package/dist/encoding/index.js +0 -27
  1219. package/dist/encoding/index.js.map +0 -1
  1220. package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
  1221. package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
  1222. package/dist/unstable/cli/internal/builtInFlags.js +0 -44
  1223. package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
  1224. package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
  1225. package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
  1226. package/dist/unstable/cli/internal/completions/Completions.js +0 -23
  1227. package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
  1228. package/src/NullOr.ts +0 -204
  1229. package/src/encoding/Base64.ts +0 -366
  1230. package/src/encoding/Base64Url.ts +0 -104
  1231. package/src/encoding/EncodingError.ts +0 -35
  1232. package/src/encoding/Hex.ts +0 -390
  1233. package/src/encoding/index.ts +0 -31
  1234. package/src/unstable/cli/internal/builtInFlags.ts +0 -78
  1235. package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/dist/Effect.js CHANGED
@@ -35,7 +35,7 @@ export class YieldableClass {
35
35
  * @since 2.0.0
36
36
  * @category Guards
37
37
  */
38
- export const isEffect = u => typeof u === "object" && u !== null && TypeId in u;
38
+ export const isEffect = core.isEffect;
39
39
  /**
40
40
  * Combines multiple effects into one, returning results based on the input
41
41
  * structure.
@@ -181,7 +181,6 @@ export const isEffect = u => typeof u === "object" && u !== null && TypeId in u;
181
181
  * ```
182
182
  *
183
183
  * @see {@link forEach} for iterating over elements and applying an effect.
184
- * @see {@link allWith} for a data-last version of this function.
185
184
  *
186
185
  * @since 2.0.0
187
186
  * @category Collecting
@@ -215,6 +214,72 @@ export const all = internal.all;
215
214
  * @category Collecting
216
215
  */
217
216
  export const partition = internal.partition;
217
+ /**
218
+ * Applies an effectful function to each element and accumulates all failures.
219
+ *
220
+ * This function always evaluates every element. If at least one effect fails,
221
+ * all failures are returned as a non-empty array and successes are discarded.
222
+ * If all effects succeed, it returns all collected successes.
223
+ *
224
+ * Use `discard: true` to ignore successful values while still validating all
225
+ * elements.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * import { Effect } from "effect"
230
+ *
231
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
232
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
233
+ * )
234
+ *
235
+ * Effect.runPromiseExit(program).then(console.log)
236
+ * // {
237
+ * // _id: 'Exit',
238
+ * // _tag: 'Failure',
239
+ * // cause: {
240
+ * // _id: 'Cause',
241
+ * // reasons: [
242
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
243
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
244
+ * // ]
245
+ * // }
246
+ * // }
247
+ * ```
248
+ *
249
+ * @since 4.0.0
250
+ * @category Error Accumulation
251
+ */
252
+ export const validate = internal.validate;
253
+ /**
254
+ * Returns the first element that satisfies an effectful predicate.
255
+ *
256
+ * The predicate receives the element and its index. Evaluation short-circuits
257
+ * as soon as an element matches.
258
+ *
259
+ * @example
260
+ * ```ts
261
+ * import { Effect } from "effect"
262
+ *
263
+ * const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
264
+ *
265
+ * Effect.runPromise(program).then(console.log)
266
+ * // { _id: 'Option', _tag: 'Some', value: 3 }
267
+ * ```
268
+ *
269
+ * @since 2.0.0
270
+ * @category Collecting
271
+ */
272
+ export const findFirst = internal.findFirst;
273
+ /**
274
+ * Returns the first value that passes an effectful `FilterEffect`.
275
+ *
276
+ * The filter receives the element and index. Evaluation short-circuits on the
277
+ * first `Result.succeed` and returns the transformed value in `Option.some`.
278
+ *
279
+ * @since 4.0.0
280
+ * @category Collecting
281
+ */
282
+ export const findFirstFilter = internal.findFirstFilter;
218
283
  /**
219
284
  * Executes an effectful operation for each element in an `Iterable`.
220
285
  *
@@ -409,16 +474,18 @@ export const promise = internal.promise;
409
474
  *
410
475
  * @example Custom Error Handling
411
476
  * ```ts
412
- * import { Effect } from "effect"
477
+ * import { Data, Effect } from "effect"
478
+ *
479
+ * class TodoFetchError extends Data.TaggedError("TodoFetchError")<{ readonly cause: unknown }> {}
413
480
  *
414
481
  * const getTodo = (id: number) =>
415
482
  * Effect.tryPromise({
416
483
  * try: () => fetch(`https://jsonplaceholder.typicode.com/todos/${id}`),
417
484
  * // remap the error
418
- * catch: (unknown) => new Error(`something went wrong ${unknown}`)
485
+ * catch: (cause) => new TodoFetchError({ cause })
419
486
  * })
420
487
  *
421
- * // ┌─── Effect<Response, Error, never>
488
+ * // ┌─── Effect<Response, TodoFetchError, never>
422
489
  * // ▼
423
490
  * const program = getTodo(1)
424
491
  * ```
@@ -645,8 +712,13 @@ undefined_ as undefined };
645
712
  *
646
713
  * **When to Use**
647
714
  *
648
- * Use `Effect.async` when dealing with APIs that use callback-style instead of
715
+ * Use `Effect.callback` when dealing with APIs that use callback-style instead of
649
716
  * `async/await` or `Promise`.
717
+ * * **Previously Known As**
718
+ *
719
+ * This API replaces the following from Effect 3.x:
720
+ *
721
+ * - `Effect.async`
650
722
  *
651
723
  * @example
652
724
  * ```ts
@@ -690,6 +762,51 @@ export const callback = internal.callback;
690
762
  * @category Creating Effects
691
763
  */
692
764
  export const never = internal.never;
765
+ /**
766
+ * An `Effect` containing an empty record `{}`, used as the starting point for
767
+ * do notation chains.
768
+ *
769
+ * @example
770
+ * ```ts
771
+ * import { Effect } from "effect"
772
+ * import { pipe } from "effect/Function"
773
+ *
774
+ * const program = pipe(
775
+ * Effect.Do,
776
+ * Effect.bind("x", () => Effect.succeed(2)),
777
+ * Effect.bind("y", ({ x }) => Effect.succeed(x + 1)),
778
+ * Effect.let("sum", ({ x, y }) => x + y)
779
+ * )
780
+ * ```
781
+ *
782
+ * @since 4.0.0
783
+ * @category Do notation
784
+ */
785
+ export const Do = internal.Do;
786
+ /**
787
+ * Gives a name to the success value of an `Effect`, creating a single-key
788
+ * record used in do notation pipelines.
789
+ *
790
+ * @since 4.0.0
791
+ * @category Do notation
792
+ */
793
+ export const bindTo = internal.bindTo;
794
+ const let_ = internal.let;
795
+ export {
796
+ /**
797
+ * Adds a computed plain value to the do notation record.
798
+ *
799
+ * @since 4.0.0
800
+ * @category Do notation
801
+ */
802
+ let_ as let };
803
+ /**
804
+ * Adds an `Effect` value to the do notation record under a given name.
805
+ *
806
+ * @since 4.0.0
807
+ * @category Do notation
808
+ */
809
+ export const bind = internal.bind;
693
810
  /**
694
811
  * Provides a way to write effectful code using generator functions, simplifying
695
812
  * control flow and error handling.
@@ -707,16 +824,18 @@ export const never = internal.never;
707
824
  *
708
825
  * @example
709
826
  * ```ts
710
- * import { Effect } from "effect"
827
+ * import { Data, Effect } from "effect"
828
+ *
829
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
711
830
  *
712
831
  * const addServiceCharge = (amount: number) => amount + 1
713
832
  *
714
833
  * const applyDiscount = (
715
834
  * total: number,
716
835
  * discountRate: number
717
- * ): Effect.Effect<number, Error> =>
836
+ * ): Effect.Effect<number, DiscountRateError> =>
718
837
  * discountRate === 0
719
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
838
+ * ? Effect.fail(new DiscountRateError())
720
839
  * : Effect.succeed(total - (total * discountRate) / 100)
721
840
  *
722
841
  * const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
@@ -753,12 +872,14 @@ export const gen = internal.gen;
753
872
  * @example
754
873
  * ```ts
755
874
  * // Title: Creating a Failed Effect
756
- * import { Effect } from "effect"
875
+ * import { Data, Effect } from "effect"
876
+ *
877
+ * class OperationFailedError extends Data.TaggedError("OperationFailedError")<{}> {}
757
878
  *
758
- * // ┌─── Effect<never, Error, never>
879
+ * // ┌─── Effect<never, OperationFailedError, never>
759
880
  * // ▼
760
881
  * const failure = Effect.fail(
761
- * new Error("Operation failed due to network error")
882
+ * new OperationFailedError()
762
883
  * )
763
884
  * ```
764
885
  *
@@ -774,9 +895,11 @@ export const fail = internal.fail;
774
895
  *
775
896
  * @example
776
897
  * ```ts
777
- * import { Effect } from "effect"
898
+ * import { Data, Effect } from "effect"
899
+ *
900
+ * class ProgramError extends Data.TaggedError("ProgramError")<{ readonly failedAt: Date }> {}
778
901
  *
779
- * const program = Effect.failSync(() => new Error("Something went wrong"))
902
+ * const program = Effect.failSync(() => new ProgramError({ failedAt: new Date() }))
780
903
  *
781
904
  * Effect.runPromiseExit(program).then(console.log)
782
905
  * // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
@@ -920,12 +1043,14 @@ export {
920
1043
  *
921
1044
  * @example Custom Error Handling
922
1045
  * ```ts
923
- * import { Effect } from "effect"
1046
+ * import { Data, Effect } from "effect"
1047
+ *
1048
+ * class JsonParsingError extends Data.TaggedError("JsonParsingError")<{ readonly cause: unknown }> {}
924
1049
  *
925
1050
  * const parseJSON = (input: string) =>
926
1051
  * Effect.try({
927
1052
  * try: () => JSON.parse(input),
928
- * catch: (error) => new Error(`JSON parsing failed: ${error}`)
1053
+ * catch: (cause) => new JsonParsingError({ cause })
929
1054
  * })
930
1055
  *
931
1056
  * Effect.runPromiseExit(parseJSON("invalid json")).then(console.log)
@@ -1050,17 +1175,17 @@ export const fromOption = internal.fromOption;
1050
1175
  * ```ts
1051
1176
  * import { Console, Effect } from "effect"
1052
1177
  *
1053
- * const input: string | null = null
1054
- *
1055
- * const program = Effect.gen(function*() {
1178
+ * const program = Effect.fn(function*(input: string | null) {
1056
1179
  * const value = yield* Effect.fromNullishOr(input)
1057
1180
  * yield* Console.log(value)
1058
- * }).pipe(
1181
+ * },
1059
1182
  * Effect.catch(() => Console.log("missing"))
1060
1183
  * )
1061
1184
  *
1062
- * Effect.runPromise(program)
1185
+ * Effect.runPromise(program(null))
1063
1186
  * // Output: missing
1187
+ * Effect.runPromise(program("hello"))
1188
+ * // Output: hello
1064
1189
  * ```
1065
1190
  *
1066
1191
  * @since 4.0.0
@@ -1124,15 +1249,17 @@ export const fromYieldable = internal.fromYieldable;
1124
1249
  *
1125
1250
  * @example
1126
1251
  * ```ts
1127
- * import { Effect, pipe } from "effect"
1252
+ * import { Data, Effect, pipe } from "effect"
1253
+ *
1254
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1128
1255
  *
1129
1256
  * // Function to apply a discount safely to a transaction amount
1130
1257
  * const applyDiscount = (
1131
1258
  * total: number,
1132
1259
  * discountRate: number
1133
- * ): Effect.Effect<number, Error> =>
1260
+ * ): Effect.Effect<number, DiscountRateError> =>
1134
1261
  * discountRate === 0
1135
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1262
+ * ? Effect.fail(new DiscountRateError())
1136
1263
  * : Effect.succeed(total - (total * discountRate) / 100)
1137
1264
  *
1138
1265
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -1216,15 +1343,17 @@ export const flatten = internal.flatten;
1216
1343
  *
1217
1344
  * @example Applying a Discount Based on Fetched Amount
1218
1345
  * ```ts
1219
- * import { Effect, pipe } from "effect"
1346
+ * import { Data, Effect, pipe } from "effect"
1347
+ *
1348
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1220
1349
  *
1221
1350
  * // Function to apply a discount safely to a transaction amount
1222
1351
  * const applyDiscount = (
1223
1352
  * total: number,
1224
1353
  * discountRate: number
1225
- * ): Effect.Effect<number, Error> =>
1354
+ * ): Effect.Effect<number, DiscountRateError> =>
1226
1355
  * discountRate === 0
1227
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1356
+ * ? Effect.fail(new DiscountRateError())
1228
1357
  * : Effect.succeed(total - (total * discountRate) / 100)
1229
1358
  *
1230
1359
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -1281,16 +1410,18 @@ export const andThen = internal.andThen;
1281
1410
  * @example
1282
1411
  * ```ts
1283
1412
  * // Title: Logging a step in a pipeline
1284
- * import { Effect, pipe } from "effect"
1413
+ * import { Data, Effect, pipe } from "effect"
1285
1414
  * import { Console } from "effect"
1286
1415
  *
1416
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1417
+ *
1287
1418
  * // Function to apply a discount safely to a transaction amount
1288
1419
  * const applyDiscount = (
1289
1420
  * total: number,
1290
1421
  * discountRate: number
1291
- * ): Effect.Effect<number, Error> =>
1422
+ * ): Effect.Effect<number, DiscountRateError> =>
1292
1423
  * discountRate === 0
1293
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1424
+ * ? Effect.fail(new DiscountRateError())
1294
1425
  * : Effect.succeed(total - (total * discountRate) / 100)
1295
1426
  *
1296
1427
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -1697,12 +1828,12 @@ export {
1697
1828
  *
1698
1829
  * **Details**
1699
1830
  *
1700
- * The `catchAll` function catches any errors that may occur during the
1831
+ * The `catch` function catches any errors that may occur during the
1701
1832
  * execution of an effect and allows you to handle them by specifying a fallback
1702
1833
  * effect. This ensures that the program continues without failing by recovering
1703
1834
  * from errors using the provided fallback logic.
1704
1835
  *
1705
- * **Note**: `catchAll` only handles recoverable errors. It will not recover
1836
+ * **Note**: `catch` only handles recoverable errors. It will not recover
1706
1837
  * from unrecoverable defects.
1707
1838
  *
1708
1839
  * @see {@link catchCause} for a version that can recover from both recoverable and unrecoverable errors.
@@ -1767,7 +1898,8 @@ export const catchTag = internal.catchTag;
1767
1898
  * once. Instead of using {@link catchTag} multiple times, you can pass an
1768
1899
  * object where each key is an error type's `_tag`, and the value is the handler
1769
1900
  * for that specific error. This allows you to catch and recover from multiple
1770
- * error types in a single call.
1901
+ * error types in a single call. You can also provide a fallback handler for
1902
+ * unhandled errors.
1771
1903
  *
1772
1904
  * The error type must have a readonly `_tag` field to use `catchTag`. This
1773
1905
  * field is used to identify and match errors.
@@ -1998,15 +2130,14 @@ export const catchCause = internal.catchCause;
1998
2130
  */
1999
2131
  export const catchDefect = internal.catchDefect;
2000
2132
  /**
2001
- * Recovers from specific errors using a `Filter`, `Predicate`, or
2002
- * `Refinement`.
2133
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
2003
2134
  *
2004
2135
  * **When to Use**
2005
2136
  *
2006
- * `catchIf` lets you recover from errors that match a condition. Pass a
2007
- * `Filter` for transformation, a `Refinement` for type narrowing, or a
2008
- * `Predicate` for simple boolean matching. Non-matching errors re-fail with
2009
- * the original cause. Defects and interrupts are not caught.
2137
+ * `catchIf` lets you recover from errors that match a condition. Use a
2138
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
2139
+ * matching. Non-matching errors re-fail with the original cause. Defects and
2140
+ * interrupts are not caught.
2010
2141
  *
2011
2142
  * **Previously Known As**
2012
2143
  *
@@ -2033,7 +2164,7 @@ export const catchDefect = internal.catchDefect;
2033
2164
  *
2034
2165
  * // With a Filter
2035
2166
  * const recovered2 = program.pipe(
2036
- * Effect.catchIf(
2167
+ * Effect.catchFilter(
2037
2168
  * Filter.tagged("NotFound"),
2038
2169
  * (error) => Effect.succeed(`missing:${error.id}`)
2039
2170
  * )
@@ -2044,6 +2175,13 @@ export const catchDefect = internal.catchDefect;
2044
2175
  * @category Error Handling
2045
2176
  */
2046
2177
  export const catchIf = internal.catchIf;
2178
+ /**
2179
+ * Recovers from specific errors using a `Filter`.
2180
+ *
2181
+ * @since 4.0.0
2182
+ * @category Error Handling
2183
+ */
2184
+ export const catchFilter = internal.catchFilter;
2047
2185
  /**
2048
2186
  * Catches `NoSuchElementError` failures and converts them to `Option.none`.
2049
2187
  *
@@ -2110,6 +2248,13 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
2110
2248
  * @category Error Handling
2111
2249
  */
2112
2250
  export const catchCauseIf = internal.catchCauseIf;
2251
+ /**
2252
+ * Recovers from specific failures based on a `Filter`.
2253
+ *
2254
+ * @since 4.0.0
2255
+ * @category Error Handling
2256
+ */
2257
+ export const catchCauseFilter = internal.catchCauseFilter;
2113
2258
  /**
2114
2259
  * The `mapError` function is used to transform or modify the error
2115
2260
  * produced by an effect, without affecting its success value.
@@ -2125,17 +2270,19 @@ export const catchCauseIf = internal.catchCauseIf;
2125
2270
  *
2126
2271
  * @example
2127
2272
  * ```ts
2128
- * import { Effect } from "effect"
2273
+ * import { Data, Effect } from "effect"
2274
+ *
2275
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
2129
2276
  *
2130
2277
  * // ┌─── Effect<number, string, never>
2131
2278
  * // ▼
2132
2279
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
2133
2280
  *
2134
- * // ┌─── Effect<number, Error, never>
2281
+ * // ┌─── Effect<number, TaskError, never>
2135
2282
  * // ▼
2136
2283
  * const mapped = Effect.mapError(
2137
2284
  * simulatedTask,
2138
- * (message) => new Error(message)
2285
+ * (message) => new TaskError({ message })
2139
2286
  * )
2140
2287
  * ```
2141
2288
  *
@@ -2155,16 +2302,18 @@ export const mapError = internal.mapError;
2155
2302
  *
2156
2303
  * @example
2157
2304
  * ```ts
2158
- * import { Effect } from "effect"
2305
+ * import { Data, Effect } from "effect"
2306
+ *
2307
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
2159
2308
  *
2160
2309
  * // ┌─── Effect<number, string, never>
2161
2310
  * // ▼
2162
2311
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
2163
2312
  *
2164
- * // ┌─── Effect<boolean, Error, never>
2313
+ * // ┌─── Effect<boolean, TaskError, never>
2165
2314
  * // ▼
2166
2315
  * const modified = Effect.mapBoth(simulatedTask, {
2167
- * onFailure: (message) => new Error(message),
2316
+ * onFailure: (message) => new TaskError({ message }),
2168
2317
  * onSuccess: (n) => n > 0
2169
2318
  * })
2170
2319
  * ```
@@ -2194,11 +2343,13 @@ export const mapBoth = internal.mapBoth;
2194
2343
  * @example
2195
2344
  * ```ts
2196
2345
  * // Title: Propagating an Error as a Defect
2197
- * import { Effect } from "effect"
2346
+ * import { Data, Effect } from "effect"
2347
+ *
2348
+ * class DivideByZeroError extends Data.TaggedError("DivideByZeroError")<{}> {}
2198
2349
  *
2199
2350
  * const divide = (a: number, b: number) =>
2200
2351
  * b === 0
2201
- * ? Effect.fail(new Error("Cannot divide by zero"))
2352
+ * ? Effect.fail(new DivideByZeroError())
2202
2353
  * : Effect.succeed(a / b)
2203
2354
  *
2204
2355
  * // ┌─── Effect<number, never, never>
@@ -2207,7 +2358,7 @@ export const mapBoth = internal.mapBoth;
2207
2358
  *
2208
2359
  * Effect.runPromise(program).catch(console.error)
2209
2360
  * // Output:
2210
- * // (FiberFailure) Error: Cannot divide by zero
2361
+ * // (FiberFailure) DivideByZeroError
2211
2362
  * // ...stack trace...
2212
2363
  * ```
2213
2364
  *
@@ -2344,6 +2495,13 @@ export const tapCause = internal.tapCause;
2344
2495
  * @category Sequencing
2345
2496
  */
2346
2497
  export const tapCauseIf = internal.tapCauseIf;
2498
+ /**
2499
+ * Conditionally executes a side effect based on the cause of a failed effect.
2500
+ *
2501
+ * @since 4.0.0
2502
+ * @category Sequencing
2503
+ */
2504
+ export const tapCauseFilter = internal.tapCauseFilter;
2347
2505
  /**
2348
2506
  * Inspect severe errors or defects (non-recoverable failures) in an effect.
2349
2507
  *
@@ -2412,7 +2570,7 @@ export const tapDefect = internal.tapDefect;
2412
2570
  * attempts++
2413
2571
  * yield* Console.log(`Attempt ${attempts}`)
2414
2572
  * if (attempts < 3) {
2415
- * yield* Effect.fail("Not ready")
2573
+ * return yield* Effect.fail("Not ready")
2416
2574
  * }
2417
2575
  * return "Ready"
2418
2576
  * })
@@ -2454,13 +2612,15 @@ export const eventually = internal.eventually;
2454
2612
  *
2455
2613
  * @example
2456
2614
  * ```ts
2457
- * import { Effect, Schedule } from "effect"
2615
+ * import { Data, Effect, Schedule } from "effect"
2616
+ *
2617
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
2458
2618
  *
2459
2619
  * let attempt = 0
2460
- * const task = Effect.callback<string, Error>((resume) => {
2620
+ * const task = Effect.callback<string, AttemptError>((resume) => {
2461
2621
  * attempt++
2462
2622
  * if (attempt <= 2) {
2463
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
2623
+ * resume(Effect.fail(new AttemptError({ attempt })))
2464
2624
  * } else {
2465
2625
  * resume(Effect.succeed("Success!"))
2466
2626
  * }
@@ -2500,14 +2660,16 @@ export const retry = internalSchedule.retry;
2500
2660
  *
2501
2661
  * @example
2502
2662
  * ```ts
2503
- * import { Console, Effect, Schedule } from "effect"
2663
+ * import { Console, Data, Effect, Schedule } from "effect"
2664
+ *
2665
+ * class NetworkTimeoutError extends Data.TaggedError("NetworkTimeoutError")<{}> {}
2504
2666
  *
2505
2667
  * let attempt = 0
2506
2668
  * const networkRequest = Effect.gen(function*() {
2507
2669
  * attempt++
2508
2670
  * yield* Console.log(`Network attempt ${attempt}`)
2509
2671
  * if (attempt < 3) {
2510
- * return yield* Effect.fail(new Error("Network timeout"))
2672
+ * return yield* Effect.fail(new NetworkTimeoutError())
2511
2673
  * }
2512
2674
  * return "Network data"
2513
2675
  * })
@@ -2579,7 +2741,8 @@ export const sandbox = internal.sandbox;
2579
2741
  * it succeeds or fails. This is useful when you only care about the side
2580
2742
  * effects of the effect and do not need to handle or process its outcome.
2581
2743
  *
2582
- * Use the `log` option to emit the full {@link Cause} when the effect fails.
2744
+ * Use the `log` option to emit the full {@link Cause} when the effect fails,
2745
+ * and `message` to prepend a custom log message.
2583
2746
  *
2584
2747
  * @example
2585
2748
  * ```ts
@@ -2603,7 +2766,7 @@ export const sandbox = internal.sandbox;
2603
2766
  * const task = Effect.fail("Uh oh!")
2604
2767
  *
2605
2768
  * const program = task.pipe(Effect.ignore({ log: true }))
2606
- * const programWarn = task.pipe(Effect.ignore({ log: "Warn" }))
2769
+ * const programWarn = task.pipe(Effect.ignore({ log: "Warn", message: "Ignoring task failure" }))
2607
2770
  * ```
2608
2771
  *
2609
2772
  * **Previously Known As**
@@ -2619,7 +2782,8 @@ export const ignore = internal.ignore;
2619
2782
  /**
2620
2783
  * Ignores the effect's failure cause, including defects and interruptions.
2621
2784
  *
2622
- * Use the `log` option to emit the full {@link Cause} when the effect fails.
2785
+ * Use the `log` option to emit the full {@link Cause} when the effect fails,
2786
+ * and `message` to prepend a custom log message.
2623
2787
  *
2624
2788
  * @example
2625
2789
  * ```ts
@@ -2628,7 +2792,7 @@ export const ignore = internal.ignore;
2628
2792
  * const task = Effect.fail("boom")
2629
2793
  *
2630
2794
  * const program = task.pipe(Effect.ignoreCause)
2631
- * const programLog = task.pipe(Effect.ignoreCause({ log: true }))
2795
+ * const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
2632
2796
  * ```
2633
2797
  *
2634
2798
  * @since 4.0.0
@@ -2651,7 +2815,10 @@ export const ignoreCause = internal.ignoreCause;
2651
2815
  *
2652
2816
  * const fetchUrl = Effect.gen(function*() {
2653
2817
  * const endpoint = yield* Effect.service(Endpoint)
2654
- * return endpoint.url === "bad" ? yield* Effect.fail("Unavailable") : endpoint.url
2818
+ * if (endpoint.url === "bad") {
2819
+ * return yield* Effect.fail("Unavailable")
2820
+ * }
2821
+ * return endpoint.url
2655
2822
  * })
2656
2823
  *
2657
2824
  * const plan = ExecutionPlan.make(
@@ -2666,6 +2833,16 @@ export const ignoreCause = internal.ignoreCause;
2666
2833
  * @category Fallback
2667
2834
  */
2668
2835
  export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
2836
+ /**
2837
+ * Runs an effect and reports any errors to the configured `ErrorReporter`s.
2838
+ *
2839
+ * If the `defectsOnly` option is set to `true`, only defects (unrecoverable
2840
+ * errors) will be reported, while regular failures will be ignored.
2841
+ *
2842
+ * @since 4.0.0
2843
+ * @category Error Handling
2844
+ */
2845
+ export const withErrorReporting = internal.withErrorReporting;
2669
2846
  // -----------------------------------------------------------------------------
2670
2847
  // Fallback
2671
2848
  // -----------------------------------------------------------------------------
@@ -2830,7 +3007,7 @@ export const timeoutOption = internal.timeoutOption;
2830
3007
  * // Use cached data as fallback when timeout is reached
2831
3008
  * const program = Effect.timeoutOrElse(slowQuery, {
2832
3009
  * duration: "2 seconds",
2833
- * onTimeout: () =>
3010
+ * orElse: () =>
2834
3011
  * Effect.gen(function*() {
2835
3012
  * yield* Console.log("Query timed out, using cached data")
2836
3013
  * return "Cached result"
@@ -3042,12 +3219,12 @@ export const raceFirst = internal.raceFirst;
3042
3219
  // Filtering
3043
3220
  // -----------------------------------------------------------------------------
3044
3221
  /**
3045
- * Filters elements of an iterable using a predicate, refinement, effectful
3046
- * predicate, or `Filter.FilterEffect`.
3222
+ * Filters elements of an iterable using a predicate, refinement, or effectful
3223
+ * predicate.
3047
3224
  *
3048
3225
  * @example
3049
3226
  * ```ts
3050
- * import { Effect, Filter, Result } from "effect"
3227
+ * import { Effect } from "effect"
3051
3228
  *
3052
3229
  * // Sync predicate
3053
3230
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -3055,16 +3232,27 @@ export const raceFirst = internal.raceFirst;
3055
3232
  * // Effectful predicate
3056
3233
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
3057
3234
  *
3058
- * // FilterEffect
3059
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
3060
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
3061
- * )
3235
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
3062
3236
  * ```
3063
3237
  *
3064
3238
  * @since 2.0.0
3065
3239
  * @category Filtering
3066
3240
  */
3067
3241
  export const filter = internal.filter;
3242
+ /**
3243
+ * Filters and maps elements of an iterable with a `Filter`.
3244
+ *
3245
+ * @since 4.0.0
3246
+ * @category Filtering
3247
+ */
3248
+ export const filterMap = internal.filterMap;
3249
+ /**
3250
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
3251
+ *
3252
+ * @since 4.0.0
3253
+ * @category Filtering
3254
+ */
3255
+ export const filterMapEffect = internal.filterMapEffect;
3068
3256
  /**
3069
3257
  * Filters an effect, providing an alternative effect if the predicate fails.
3070
3258
  *
@@ -3096,6 +3284,13 @@ export const filter = internal.filter;
3096
3284
  * @category Filtering
3097
3285
  */
3098
3286
  export const filterOrElse = internal.filterOrElse;
3287
+ /**
3288
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
3289
+ *
3290
+ * @since 4.0.0
3291
+ * @category Filtering
3292
+ */
3293
+ export const filterMapOrElse = internal.filterMapOrElse;
3099
3294
  /**
3100
3295
  * Filters an effect, failing with a custom error if the predicate fails.
3101
3296
  *
@@ -3126,6 +3321,13 @@ export const filterOrElse = internal.filterOrElse;
3126
3321
  * @category Filtering
3127
3322
  */
3128
3323
  export const filterOrFail = internal.filterOrFail;
3324
+ /**
3325
+ * Filters an effect with a `Filter`, failing when the filter fails.
3326
+ *
3327
+ * @since 4.0.0
3328
+ * @category Filtering
3329
+ */
3330
+ export const filterMapOrFail = internal.filterMapOrFail;
3129
3331
  // -----------------------------------------------------------------------------
3130
3332
  // Conditional Operators
3131
3333
  // -----------------------------------------------------------------------------
@@ -3192,9 +3394,11 @@ export const when = internal.when;
3192
3394
  * @example
3193
3395
  * ```ts
3194
3396
  * // Title: Handling Both Success and Failure Cases
3195
- * import { Effect } from "effect"
3397
+ * import { Data, Effect } from "effect"
3196
3398
  *
3197
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
3399
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
3400
+ *
3401
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
3198
3402
  *
3199
3403
  * const program1 = Effect.match(success, {
3200
3404
  * onFailure: (error) => `failure: ${error.message}`,
@@ -3205,8 +3409,8 @@ export const when = internal.when;
3205
3409
  * Effect.runPromise(program1).then(console.log)
3206
3410
  * // Output: "success: 42"
3207
3411
  *
3208
- * const failure: Effect.Effect<number, Error> = Effect.fail(
3209
- * new Error("Uh oh!")
3412
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
3413
+ * new ExampleError({ message: "Uh oh!" })
3210
3414
  * )
3211
3415
  *
3212
3416
  * const program2 = Effect.match(failure, {
@@ -3350,9 +3554,11 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
3350
3554
  *
3351
3555
  * @example
3352
3556
  * ```ts
3353
- * import { Cause, Console, Effect, Result } from "effect"
3557
+ * import { Cause, Console, Data, Effect, Result } from "effect"
3558
+ *
3559
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
3354
3560
  *
3355
- * const task = Effect.fail(new Error("Task failed"))
3561
+ * const task = Effect.fail(new TaskError({ message: "Task failed" }))
3356
3562
  *
3357
3563
  * const program = Effect.matchCauseEffect(task, {
3358
3564
  * onFailure: (cause) =>
@@ -3408,11 +3614,13 @@ export const matchCauseEffect = internal.matchCauseEffect;
3408
3614
  * @example
3409
3615
  * ```ts
3410
3616
  * // Title: Handling Both Success and Failure Cases with Side Effects
3411
- * import { Effect } from "effect"
3617
+ * import { Data, Effect } from "effect"
3618
+ *
3619
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
3412
3620
  *
3413
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
3414
- * const failure: Effect.Effect<number, Error> = Effect.fail(
3415
- * new Error("Uh oh!")
3621
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
3622
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
3623
+ * new ExampleError({ message: "Uh oh!" })
3416
3624
  * )
3417
3625
  *
3418
3626
  * const program1 = Effect.matchEffect(success, {
@@ -3605,7 +3813,7 @@ export const servicesWith = internal.servicesWith;
3605
3813
  * const Database = ServiceMap.Service<Database>("Database")
3606
3814
  *
3607
3815
  * const DatabaseLive = Layer.succeed(Database)({
3608
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
3816
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
3609
3817
  * })
3610
3818
  *
3611
3819
  * const program = Effect.gen(function*() {
@@ -4245,9 +4453,11 @@ export const ensuring = internal.ensuring;
4245
4453
  *
4246
4454
  * @example
4247
4455
  * ```ts
4248
- * import { Cause, Console, Effect } from "effect"
4456
+ * import { Cause, Data, Console, Effect } from "effect"
4457
+ *
4458
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
4249
4459
  *
4250
- * const task = Effect.fail(new Error("Something went wrong"))
4460
+ * const task = Effect.fail(new TaskError({ message: "Something went wrong" }))
4251
4461
  *
4252
4462
  * const program = Effect.onError(
4253
4463
  * task,
@@ -4256,8 +4466,8 @@ export const ensuring = internal.ensuring;
4256
4466
  *
4257
4467
  * Effect.runPromise(program).catch(console.error)
4258
4468
  * // Output:
4259
- * // Cleanup on error: Error: Something went wrong
4260
- * // Error: Something went wrong
4469
+ * // Cleanup on error: TaskError: Something went wrong
4470
+ * // TaskError: Something went wrong
4261
4471
  * ```
4262
4472
  *
4263
4473
  * @since 2.0.0
@@ -4266,7 +4476,7 @@ export const ensuring = internal.ensuring;
4266
4476
  export const onError = internal.onError;
4267
4477
  /**
4268
4478
  * Runs the finalizer only when this effect fails and the `Cause` matches the
4269
- * filter, passing the filtered failure and the original cause.
4479
+ * provided predicate.
4270
4480
  *
4271
4481
  * @example
4272
4482
  * ```ts
@@ -4288,6 +4498,13 @@ export const onError = internal.onError;
4288
4498
  * @category Resource Management & Finalization
4289
4499
  */
4290
4500
  export const onErrorIf = internal.onErrorIf;
4501
+ /**
4502
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
4503
+ *
4504
+ * @since 4.0.0
4505
+ * @category Resource Management & Finalization
4506
+ */
4507
+ export const onErrorFilter = internal.onErrorFilter;
4291
4508
  /**
4292
4509
  * The low level primitive that powers `onExit`.
4293
4510
  * function is used to run a finalizer when the effect exits, regardless of the
@@ -4325,20 +4542,20 @@ export const onExitPrimitive = internal.onExitPrimitive;
4325
4542
  */
4326
4543
  export const onExit = internal.onExit;
4327
4544
  /**
4328
- * Runs the cleanup effect only when the `Exit` passes the provided filter.
4329
- *
4330
- * The cleanup is skipped when the filter returns `Filter.fail`.
4545
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
4546
+ * predicate.
4331
4547
  *
4332
4548
  * @example
4333
4549
  * ```ts
4334
- * import { Console, Effect, Exit, Filter } from "effect"
4335
- *
4336
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
4550
+ * import { Console, Effect, Exit } from "effect"
4337
4551
  *
4338
4552
  * const program = Effect.onExitIf(
4339
4553
  * Effect.succeed(42),
4340
- * exitFilter,
4341
- * (success) => Console.log(`Succeeded with: ${success.value}`)
4554
+ * Exit.isSuccess,
4555
+ * (exit) =>
4556
+ * Exit.isSuccess(exit)
4557
+ * ? Console.log(`Succeeded with: ${exit.value}`)
4558
+ * : Effect.void
4342
4559
  * )
4343
4560
  * ```
4344
4561
  *
@@ -4346,6 +4563,13 @@ export const onExit = internal.onExit;
4346
4563
  * @category Resource Management & Finalization
4347
4564
  */
4348
4565
  export const onExitIf = internal.onExitIf;
4566
+ /**
4567
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
4568
+ *
4569
+ * @since 4.0.0
4570
+ * @category Resource Management & Finalization
4571
+ */
4572
+ export const onExitFilter = internal.onExitFilter;
4349
4573
  // -----------------------------------------------------------------------------
4350
4574
  // Caching
4351
4575
  // -----------------------------------------------------------------------------
@@ -4561,8 +4785,8 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
4561
4785
  * import { Effect } from "effect"
4562
4786
  *
4563
4787
  * const program = Effect.gen(function*() {
4564
- * yield* Effect.interrupt
4565
- * yield* Effect.succeed("This won't execute")
4788
+ * return yield* Effect.interrupt
4789
+ * yield* Effect.succeed("This won't execute and is unreachable")
4566
4790
  * })
4567
4791
  *
4568
4792
  * Effect.runPromise(program).catch(console.error)
@@ -4702,124 +4926,6 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
4702
4926
  * @category Interruption
4703
4927
  */
4704
4928
  export const interruptibleMask = internal.interruptibleMask;
4705
- /**
4706
- * Unsafely creates a new Semaphore.
4707
- *
4708
- * @example
4709
- * ```ts
4710
- * import { Effect } from "effect"
4711
- *
4712
- * const semaphore = Effect.makeSemaphoreUnsafe(3)
4713
- *
4714
- * const task = (id: number) =>
4715
- * semaphore.withPermits(1)(
4716
- * Effect.gen(function*() {
4717
- * yield* Effect.log(`Task ${id} started`)
4718
- * yield* Effect.sleep("1 second")
4719
- * yield* Effect.log(`Task ${id} completed`)
4720
- * })
4721
- * )
4722
- *
4723
- * // Only 3 tasks can run concurrently
4724
- * const program = Effect.all([
4725
- * task(1),
4726
- * task(2),
4727
- * task(3),
4728
- * task(4),
4729
- * task(5)
4730
- * ], { concurrency: "unbounded" })
4731
- * ```
4732
- *
4733
- * @since 2.0.0
4734
- * @category Semaphore
4735
- */
4736
- export const makeSemaphoreUnsafe = internal.makeSemaphoreUnsafe;
4737
- /**
4738
- * Creates a new Semaphore.
4739
- *
4740
- * @example
4741
- * ```ts
4742
- * import { Effect } from "effect"
4743
- *
4744
- * const program = Effect.gen(function*() {
4745
- * const semaphore = yield* Effect.makeSemaphore(2)
4746
- *
4747
- * const task = (id: number) =>
4748
- * semaphore.withPermits(1)(
4749
- * Effect.gen(function*() {
4750
- * yield* Effect.log(`Task ${id} acquired permit`)
4751
- * yield* Effect.sleep("1 second")
4752
- * yield* Effect.log(`Task ${id} releasing permit`)
4753
- * })
4754
- * )
4755
- *
4756
- * // Run 4 tasks, but only 2 can run concurrently
4757
- * yield* Effect.all([task(1), task(2), task(3), task(4)])
4758
- * })
4759
- * ```
4760
- *
4761
- * @since 2.0.0
4762
- * @category Semaphore
4763
- */
4764
- export const makeSemaphore = internal.makeSemaphore;
4765
- /**
4766
- * Creates a new Latch.
4767
- *
4768
- * @example
4769
- * ```ts
4770
- * import { Effect } from "effect"
4771
- *
4772
- * const latch = Effect.makeLatchUnsafe(false)
4773
- *
4774
- * const waiter = Effect.gen(function*() {
4775
- * yield* Effect.log("Waiting for latch to open...")
4776
- * yield* latch.await
4777
- * yield* Effect.log("Latch opened! Continuing...")
4778
- * })
4779
- *
4780
- * const opener = Effect.gen(function*() {
4781
- * yield* Effect.sleep("2 seconds")
4782
- * yield* Effect.log("Opening latch...")
4783
- * yield* latch.open
4784
- * })
4785
- *
4786
- * const program = Effect.all([waiter, opener])
4787
- * ```
4788
- *
4789
- * @category Latch
4790
- * @since 3.8.0
4791
- */
4792
- export const makeLatchUnsafe = internal.makeLatchUnsafe;
4793
- /**
4794
- * Creates a new Latch.
4795
- *
4796
- * @example
4797
- * ```ts
4798
- * import { Effect } from "effect"
4799
- *
4800
- * const program = Effect.gen(function*() {
4801
- * const latch = yield* Effect.makeLatch(false)
4802
- *
4803
- * const waiter = Effect.gen(function*() {
4804
- * yield* Effect.log("Waiting for latch to open...")
4805
- * yield* latch.await
4806
- * yield* Effect.log("Latch opened! Continuing...")
4807
- * })
4808
- *
4809
- * const opener = Effect.gen(function*() {
4810
- * yield* Effect.sleep("2 seconds")
4811
- * yield* Effect.log("Opening latch...")
4812
- * yield* latch.open
4813
- * })
4814
- *
4815
- * yield* Effect.all([waiter, opener])
4816
- * })
4817
- * ```
4818
- *
4819
- * @category Latch
4820
- * @since 3.8.0
4821
- */
4822
- export const makeLatch = internal.makeLatch;
4823
4929
  /**
4824
4930
  * Repeats this effect forever (until the first error).
4825
4931
  *
@@ -4942,7 +5048,7 @@ export const repeat = internalSchedule.repeat;
4942
5048
  * attempt++
4943
5049
  * if (attempt <= 2) {
4944
5050
  * yield* Console.log(`Attempt ${attempt} failed`)
4945
- * yield* Effect.fail(`Error ${attempt}`)
5051
+ * return yield* Effect.fail(`Error ${attempt}`)
4946
5052
  * }
4947
5053
  * yield* Console.log(`Attempt ${attempt} succeeded`)
4948
5054
  * return "success"
@@ -5510,7 +5616,7 @@ export const withParentSpan = internal.withParentSpan;
5510
5616
  * )
5511
5617
  *
5512
5618
  * const program = Effect.gen(function*() {
5513
- * const name = yield* Effect.request(GetUser({ id: 1 }), Effect.succeed(resolver))
5619
+ * const name = yield* Effect.request(GetUser({ id: 1 }), resolver)
5514
5620
  * yield* Console.log(name)
5515
5621
  * })
5516
5622
  * ```
@@ -6568,7 +6674,7 @@ export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.upda
6568
6674
  * @since 2.0.0
6569
6675
  * @category Logging
6570
6676
  */
6571
- export const annotateLogs = /*#__PURE__*/dual(args => core.isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
6677
+ export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
6572
6678
  const newAnnotations = {
6573
6679
  ...annotations
6574
6680
  };
@@ -6579,6 +6685,32 @@ export const annotateLogs = /*#__PURE__*/dual(args => core.isEffect(args[0]), (e
6579
6685
  }
6580
6686
  return newAnnotations;
6581
6687
  }));
6688
+ /**
6689
+ * Adds log annotations to the current scope.
6690
+ *
6691
+ * This differs from `annotateLogs`, which only annotates a specific effect.
6692
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
6693
+ * restores the previous annotations when the scope closes.
6694
+ *
6695
+ * @example
6696
+ * ```ts
6697
+ * import { Effect } from "effect"
6698
+ *
6699
+ * const program = Effect.scoped(
6700
+ * Effect.gen(function*() {
6701
+ * yield* Effect.log("before")
6702
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
6703
+ * yield* Effect.log("inside scope")
6704
+ * })
6705
+ * )
6706
+ *
6707
+ * Effect.runPromise(program)
6708
+ * ```
6709
+ *
6710
+ * @since 4.0.0
6711
+ * @category Logging
6712
+ */
6713
+ export const annotateLogsScoped = internal.annotateLogsScoped;
6582
6714
  /**
6583
6715
  * Adds a span to each log line in this effect.
6584
6716
  *
@@ -6744,18 +6876,20 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
6744
6876
  *
6745
6877
  * @example
6746
6878
  * ```ts
6747
- * import { Effect, Metric } from "effect"
6879
+ * import { Data, Effect, Metric } from "effect"
6880
+ *
6881
+ * class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
6748
6882
  *
6749
6883
  * // Track error types using frequency metric
6750
6884
  * const errorTypeFrequency = Metric.frequency("error_types")
6751
6885
  *
6752
- * const program = Effect.fail(new Error("Connection failed")).pipe(
6753
- * Effect.trackErrors(errorTypeFrequency, (error: Error) => error.name)
6886
+ * const program = Effect.fail(new ConnectionFailedError()).pipe(
6887
+ * Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
6754
6888
  * )
6755
6889
  *
6756
6890
  * Effect.runPromiseExit(program).then(() =>
6757
6891
  * Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
6758
- * // Output: { occurrences: Map(1) { "Error" => 1 } }
6892
+ * // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
6759
6893
  * )
6760
6894
  * ```
6761
6895
  *
@@ -6866,7 +7000,7 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
6866
7000
  const startTime = clock.currentTimeNanosUnsafe();
6867
7001
  return onExit(self, () => {
6868
7002
  const endTime = clock.currentTimeNanosUnsafe();
6869
- const duration = Duration.subtract(Duration.fromDurationInputUnsafe(endTime), Duration.fromDurationInputUnsafe(startTime));
7003
+ const duration = Duration.subtract(Duration.fromInputUnsafe(endTime), Duration.fromInputUnsafe(startTime));
6870
7004
  const input = f === undefined ? duration : internalCall(() => f(duration));
6871
7005
  return Metric.update(metric, input);
6872
7006
  });
@@ -6897,125 +7031,63 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
6897
7031
  */
6898
7032
  export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effect/Transaction") {}
6899
7033
  /**
6900
- * Defines a transaction. Transactions are "all or nothing" with respect to changes made to
6901
- * transactional values (i.e. TxRef) that occur within the transaction body.
7034
+ * Accesses the current transaction state within an active transaction.
6902
7035
  *
6903
- * In Effect transactions are optimistic with retry, that means transactions are retried when:
6904
- *
6905
- * - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
6906
- * accessed transactional values changes.
6907
- *
6908
- * - any of the accessed transactional values change during the execution of the transaction
6909
- * due to a different transaction committing before the current.
6910
- *
6911
- * - parent transaction retry, if you have a transaction within another transaction and
6912
- * the parent retries the child will also retry together with the parent.
7036
+ * This function requires `Transaction` in the context and does NOT create or strip
7037
+ * transaction boundaries. Use it to interact with the transaction journal (e.g. in
7038
+ * `TxRef` internals). To define a transaction boundary, use {@link transaction}.
6913
7039
  *
6914
7040
  * @example
6915
7041
  * ```ts
6916
7042
  * import { Effect, TxRef } from "effect"
6917
7043
  *
6918
7044
  * const program = Effect.gen(function*() {
6919
- * const ref1 = yield* TxRef.make(0)
6920
- * const ref2 = yield* TxRef.make(0)
6921
- *
6922
- * // All operations within atomic block succeed or fail together
6923
- * yield* Effect.atomic(Effect.gen(function*() {
6924
- * yield* TxRef.set(ref1, 10)
6925
- * yield* TxRef.set(ref2, 20)
6926
- * const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
6927
- * console.log(`Transaction sum: ${sum}`)
6928
- * }))
6929
- *
6930
- * console.log(`Final ref1: ${yield* TxRef.get(ref1)}`) // 10
6931
- * console.log(`Final ref2: ${yield* TxRef.get(ref2)}`) // 20
6932
- * })
6933
- * ```
6934
- *
6935
- * @since 4.0.0
6936
- * @category Transactions
6937
- */
6938
- export const atomic = effect => atomicWith(() => effect);
6939
- /**
6940
- * Executes a function within a transaction context, providing access to the transaction state.
6941
- *
6942
- * @example
6943
- * ```ts
6944
- * import { Effect, TxRef } from "effect"
6945
- *
6946
- * const program = Effect.atomicWith((txState) =>
6947
- * Effect.gen(function*() {
6948
- * const ref = yield* TxRef.make(0)
6949
- *
6950
- * // Access transaction state for debugging
6951
- * console.log(`Journal size: ${txState.journal.size}`)
6952
- * console.log(`Retry flag: ${txState.retry}`)
7045
+ * const ref = yield* Effect.transaction(TxRef.make(0))
6953
7046
  *
7047
+ * yield* Effect.transaction(Effect.gen(function*() {
6954
7048
  * yield* TxRef.set(ref, 42)
6955
7049
  * return yield* TxRef.get(ref)
6956
- * })
6957
- * )
6958
- *
6959
- * Effect.runPromise(program).then(console.log) // 42
7050
+ * }))
7051
+ * })
6960
7052
  * ```
6961
7053
  *
6962
7054
  * @since 4.0.0
6963
7055
  * @category Transactions
6964
7056
  */
6965
- export const atomicWith = f => withFiber(fiber => {
6966
- // Check if transaction already exists and reuse it (composing behavior)
6967
- if (fiber.services.mapUnsafe.has(Transaction.key)) {
6968
- return internalCall(() => f(ServiceMap.getUnsafe(fiber.services, Transaction)));
6969
- }
6970
- // No existing transaction, create isolated one using transactionWith
6971
- return transactionWith(f);
6972
- });
7057
+ export const withTxState = f => flatMap(Transaction.asEffect(), state => internalCall(() => f(state)));
6973
7058
  /**
6974
- * Creates an isolated transaction that never composes with parent transactions.
7059
+ * Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
7060
+ * made to transactional values (i.e. TxRef) that occur within the transaction body.
6975
7061
  *
6976
- * **Details**
7062
+ * In Effect transactions are optimistic with retry, that means transactions are retried when:
6977
7063
  *
6978
- * Unlike `Effect.atomic`, which composes with parent transactions when nested,
6979
- * `Effect.transaction` always creates a new isolated transaction boundary.
6980
- * This ensures complete isolation between different transaction scopes.
7064
+ * - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
7065
+ * accessed transactional values changes.
6981
7066
  *
6982
- * **Key Differences from Effect.atomic:**
6983
- * - Always creates a new transaction, even when called within another transaction
6984
- * - Parent transaction failures don't affect isolated transactions
6985
- * - Isolated transaction failures don't affect parent transactions
6986
- * - Each transaction has its own journal and retry logic
7067
+ * - any of the accessed transactional values change during the execution of the transaction
7068
+ * due to a different transaction committing before the current.
6987
7069
  *
6988
- * **When to Use:**
6989
- * - When you need guaranteed isolation between transaction scopes
6990
- * - For implementing independent operations that shouldn't be affected by outer transactions
6991
- * - When building transaction-based systems where isolation is critical
7070
+ * Each call to `transaction` always creates a new isolated transaction boundary with its own
7071
+ * journal and retry logic.
6992
7072
  *
6993
7073
  * @example
6994
7074
  * ```ts
6995
7075
  * import { Effect, TxRef } from "effect"
6996
7076
  *
6997
7077
  * const program = Effect.gen(function*() {
6998
- * const ref1 = yield* TxRef.make(0)
6999
- * const ref2 = yield* TxRef.make(100)
7000
- *
7001
- * // Nested atomic transaction - ref1 will be part of outer transaction
7002
- * yield* Effect.atomic(Effect.gen(function*() {
7003
- * yield* TxRef.set(ref1, 10)
7004
- *
7005
- * // This atomic operation composes with the parent
7006
- * yield* Effect.atomic(Effect.gen(function*() {
7007
- * yield* TxRef.set(ref1, 20) // Part of same transaction
7008
- * }))
7009
- * }))
7078
+ * const ref1 = yield* Effect.transaction(TxRef.make(0))
7079
+ * const ref2 = yield* Effect.transaction(TxRef.make(0))
7010
7080
  *
7011
- * // Isolated transaction - ref2 will be in its own transaction
7081
+ * // All operations within transaction block succeed or fail together
7012
7082
  * yield* Effect.transaction(Effect.gen(function*() {
7013
- * yield* TxRef.set(ref2, 200)
7083
+ * yield* TxRef.set(ref1, 10)
7084
+ * yield* TxRef.set(ref2, 20)
7085
+ * const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
7086
+ * console.log(`Transaction sum: ${sum}`)
7014
7087
  * }))
7015
7088
  *
7016
- * const val1 = yield* TxRef.get(ref1) // 20
7017
- * const val2 = yield* TxRef.get(ref2) // 200
7018
- * return { ref1: val1, ref2: val2 }
7089
+ * console.log(`Final ref1: ${yield* Effect.transaction(TxRef.get(ref1))}`) // 10
7090
+ * console.log(`Final ref2: ${yield* Effect.transaction(TxRef.get(ref2))}`) // 20
7019
7091
  * })
7020
7092
  * ```
7021
7093
  *
@@ -7024,34 +7096,21 @@ export const atomicWith = f => withFiber(fiber => {
7024
7096
  */
7025
7097
  export const transaction = effect => transactionWith(() => effect);
7026
7098
  /**
7027
- * Executes a function within an isolated transaction context, providing access to the transaction state.
7099
+ * Like {@link transaction} but provides access to the transaction state.
7028
7100
  *
7029
- * This function always creates a new transaction boundary, regardless of whether it's called
7030
- * within another transaction. This ensures complete isolation between transaction scopes.
7101
+ * Always creates a new isolated transaction boundary with its own journal and retry logic.
7031
7102
  *
7032
7103
  * @example
7033
7104
  * ```ts
7034
7105
  * import { Effect, TxRef } from "effect"
7035
7106
  *
7036
- * const program = Effect.transactionWith((txState) =>
7107
+ * const program = Effect.transactionWith((_txState) =>
7037
7108
  * Effect.gen(function*() {
7038
7109
  * const ref = yield* TxRef.make(0)
7039
- *
7040
- * // This transaction is isolated - it has its own journal
7041
- * // txState.journal is independent of any parent transaction
7042
- *
7043
7110
  * yield* TxRef.set(ref, 42)
7044
7111
  * return yield* TxRef.get(ref)
7045
7112
  * })
7046
7113
  * )
7047
- *
7048
- * // Even when nested in another atomic block, this transaction is isolated
7049
- * const nestedProgram = Effect.atomic(
7050
- * Effect.gen(function*() {
7051
- * const result = yield* program // Runs in its own isolated transaction
7052
- * return result
7053
- * })
7054
- * )
7055
7114
  * ```
7056
7115
  *
7057
7116
  * @since 4.0.0
@@ -7063,7 +7122,6 @@ export const transactionWith = f => withFiber(fiber => {
7063
7122
  journal: new Map(),
7064
7123
  retry: false
7065
7124
  };
7066
- const scheduler = fiber.currentScheduler;
7067
7125
  let result;
7068
7126
  return uninterruptibleMask(restore => flatMap(whileLoop({
7069
7127
  while: () => !result,
@@ -7076,7 +7134,7 @@ export const transactionWith = f => withFiber(fiber => {
7076
7134
  return clearTransaction(state);
7077
7135
  }
7078
7136
  if (Exit.isSuccess(exit)) {
7079
- commitTransaction(scheduler, state);
7137
+ commitTransaction(fiber, state);
7080
7138
  } else {
7081
7139
  clearTransaction(state);
7082
7140
  }
@@ -7113,7 +7171,7 @@ const awaitPendingTransaction = state => suspend(() => {
7113
7171
  return sync(clearPending);
7114
7172
  });
7115
7173
  });
7116
- function commitTransaction(scheduler, state) {
7174
+ function commitTransaction(fiber, state) {
7117
7175
  for (const [ref, {
7118
7176
  value
7119
7177
  }] of state.journal) {
@@ -7122,7 +7180,7 @@ function commitTransaction(scheduler, state) {
7122
7180
  ref.value = value;
7123
7181
  }
7124
7182
  for (const pending of ref.pending.values()) {
7125
- scheduler.scheduleTask(pending, 0);
7183
+ fiber.currentDispatcher.scheduleTask(pending, 0);
7126
7184
  }
7127
7185
  ref.pending.clear();
7128
7186
  }
@@ -7146,16 +7204,16 @@ function clearTransaction(state) {
7146
7204
  *
7147
7205
  * const program = Effect.gen(function*() {
7148
7206
  * // create a transactional reference
7149
- * const ref = yield* TxRef.make(0)
7207
+ * const ref = yield* Effect.transaction(TxRef.make(0))
7150
7208
  *
7151
7209
  * // forks a fiber that increases the value of `ref` every 100 millis
7152
7210
  * yield* Effect.forkChild(Effect.forever(
7153
7211
  * // update to transactional value
7154
- * TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
7212
+ * Effect.transaction(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
7155
7213
  * ))
7156
7214
  *
7157
7215
  * // the following will retry 10 times until the `ref` value is 10
7158
- * yield* Effect.atomic(Effect.gen(function*() {
7216
+ * yield* Effect.transaction(Effect.gen(function*() {
7159
7217
  * const value = yield* TxRef.get(ref)
7160
7218
  * if (value < 10) {
7161
7219
  * yield* Effect.log(`retry due to value: ${value}`)
@@ -7259,18 +7317,20 @@ export const satisfiesSuccessType = () => effect => effect;
7259
7317
  *
7260
7318
  * @example
7261
7319
  * ```ts
7262
- * import { Effect } from "effect"
7320
+ * import { Data, Effect } from "effect"
7321
+ *
7322
+ * class ValidationError extends Data.TaggedError("ValidationError")<{}> {}
7263
7323
  *
7264
- * // Define a constraint that the error type must be an Error
7265
- * const satisfiesError = Effect.satisfiesErrorType<Error>()
7324
+ * // Define a constraint that the error type must be a ValidationError
7325
+ * const satisfiesError = Effect.satisfiesErrorType<ValidationError>()
7266
7326
  *
7267
- * // This works - Effect<number, TypeError, never> extends Effect<number, Error, never>
7268
- * const validEffect = satisfiesError(Effect.fail(new TypeError("Invalid type")))
7327
+ * // This works - Effect<number, ValidationError, never> extends the constrained type
7328
+ * const validEffect = satisfiesError(Effect.fail(new ValidationError()))
7269
7329
  *
7270
7330
  * // This would cause a TypeScript compilation error:
7271
7331
  * // const invalidEffect = satisfiesError(Effect.fail("string error"))
7272
7332
  * // ^^^^^^^^^^^^^^^^^^^^^^^^^^^
7273
- * // Type 'string' is not assignable to type 'Error'
7333
+ * // Type 'string' is not assignable to type 'ValidationError'
7274
7334
  * ```
7275
7335
  *
7276
7336
  * @since 4.0.0