effect 4.1.4 → 4.1.6

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 (890) hide show
  1. package/THIRD_PARTY_NOTICES.md +88 -0
  2. package/ai-docs/package.json +2 -2
  3. package/dist/Arbitrary.d.ts +44 -2
  4. package/dist/Arbitrary.d.ts.map +1 -1
  5. package/dist/Arbitrary.js +9 -1
  6. package/dist/Arbitrary.js.map +1 -1
  7. package/dist/BigInt.d.ts +200 -1
  8. package/dist/BigInt.d.ts.map +1 -1
  9. package/dist/BigInt.js +105 -9
  10. package/dist/BigInt.js.map +1 -1
  11. package/dist/Cache.d.ts.map +1 -1
  12. package/dist/Cache.js +4 -2
  13. package/dist/Cache.js.map +1 -1
  14. package/dist/Cause.d.ts +3 -3
  15. package/dist/Cause.js +1 -1
  16. package/dist/Channel.d.ts +104 -7
  17. package/dist/Channel.d.ts.map +1 -1
  18. package/dist/Channel.js +73 -4
  19. package/dist/Channel.js.map +1 -1
  20. package/dist/Chunk.d.ts +5 -0
  21. package/dist/Chunk.d.ts.map +1 -1
  22. package/dist/Chunk.js +7 -2
  23. package/dist/Chunk.js.map +1 -1
  24. package/dist/Clock.d.ts +5 -2
  25. package/dist/Clock.d.ts.map +1 -1
  26. package/dist/Clock.js +2 -1
  27. package/dist/Clock.js.map +1 -1
  28. package/dist/Codegen.d.ts +300 -0
  29. package/dist/Codegen.d.ts.map +1 -0
  30. package/dist/Codegen.js +526 -0
  31. package/dist/Codegen.js.map +1 -0
  32. package/dist/Config.d.ts +31 -2
  33. package/dist/Config.d.ts.map +1 -1
  34. package/dist/Config.js +12 -1
  35. package/dist/Config.js.map +1 -1
  36. package/dist/ConfigProvider.d.ts +11 -1
  37. package/dist/ConfigProvider.d.ts.map +1 -1
  38. package/dist/ConfigProvider.js +17 -6
  39. package/dist/ConfigProvider.js.map +1 -1
  40. package/dist/Effect.d.ts +1008 -127
  41. package/dist/Effect.d.ts.map +1 -1
  42. package/dist/Effect.js +410 -49
  43. package/dist/Effect.js.map +1 -1
  44. package/dist/Equal.d.ts +4 -4
  45. package/dist/Equal.d.ts.map +1 -1
  46. package/dist/Equal.js +78 -65
  47. package/dist/Equal.js.map +1 -1
  48. package/dist/Equivalence.d.ts +11 -9
  49. package/dist/Equivalence.d.ts.map +1 -1
  50. package/dist/Equivalence.js +15 -12
  51. package/dist/Equivalence.js.map +1 -1
  52. package/dist/Fiber.d.ts +58 -8
  53. package/dist/Fiber.d.ts.map +1 -1
  54. package/dist/Fiber.js +28 -4
  55. package/dist/Fiber.js.map +1 -1
  56. package/dist/FiberHandle.d.ts +81 -10
  57. package/dist/FiberHandle.d.ts.map +1 -1
  58. package/dist/FiberHandle.js +40 -8
  59. package/dist/FiberHandle.js.map +1 -1
  60. package/dist/FiberMap.d.ts +80 -10
  61. package/dist/FiberMap.d.ts.map +1 -1
  62. package/dist/FiberMap.js +37 -6
  63. package/dist/FiberMap.js.map +1 -1
  64. package/dist/FiberSet.d.ts +93 -8
  65. package/dist/FiberSet.d.ts.map +1 -1
  66. package/dist/FiberSet.js +46 -4
  67. package/dist/FiberSet.js.map +1 -1
  68. package/dist/Formatter.d.ts +2 -0
  69. package/dist/Formatter.d.ts.map +1 -1
  70. package/dist/Formatter.js +2 -0
  71. package/dist/Formatter.js.map +1 -1
  72. package/dist/Hash.d.ts.map +1 -1
  73. package/dist/Hash.js +24 -17
  74. package/dist/Hash.js.map +1 -1
  75. package/dist/LayerMap.d.ts +12 -3
  76. package/dist/LayerMap.d.ts.map +1 -1
  77. package/dist/LayerMap.js +12 -2
  78. package/dist/LayerMap.js.map +1 -1
  79. package/dist/LayerRef.d.ts +3 -3
  80. package/dist/LayerRef.d.ts.map +1 -1
  81. package/dist/LayerRef.js +3 -3
  82. package/dist/LayerRef.js.map +1 -1
  83. package/dist/Logger.d.ts +37 -13
  84. package/dist/Logger.d.ts.map +1 -1
  85. package/dist/Logger.js +39 -10
  86. package/dist/Logger.js.map +1 -1
  87. package/dist/Match.d.ts +35 -23
  88. package/dist/Match.d.ts.map +1 -1
  89. package/dist/Match.js +16 -0
  90. package/dist/Match.js.map +1 -1
  91. package/dist/Metric.js +1 -1
  92. package/dist/Metric.js.map +1 -1
  93. package/dist/Option.d.ts +4 -1
  94. package/dist/Option.d.ts.map +1 -1
  95. package/dist/Option.js +6 -2
  96. package/dist/Option.js.map +1 -1
  97. package/dist/Order.d.ts +7 -5
  98. package/dist/Order.d.ts.map +1 -1
  99. package/dist/Order.js +8 -3
  100. package/dist/Order.js.map +1 -1
  101. package/dist/Pool.d.ts +4 -3
  102. package/dist/Pool.d.ts.map +1 -1
  103. package/dist/Pool.js +21 -18
  104. package/dist/Pool.js.map +1 -1
  105. package/dist/Predicate.d.ts +4 -1
  106. package/dist/Predicate.d.ts.map +1 -1
  107. package/dist/Predicate.js +5 -1
  108. package/dist/Predicate.js.map +1 -1
  109. package/dist/Queue.d.ts +69 -22
  110. package/dist/Queue.d.ts.map +1 -1
  111. package/dist/Queue.js +40 -18
  112. package/dist/Queue.js.map +1 -1
  113. package/dist/Rational.d.ts +179 -0
  114. package/dist/Rational.d.ts.map +1 -1
  115. package/dist/Rational.js +63 -0
  116. package/dist/Rational.js.map +1 -1
  117. package/dist/Request.d.ts +20 -0
  118. package/dist/Request.d.ts.map +1 -1
  119. package/dist/Request.js +20 -0
  120. package/dist/Request.js.map +1 -1
  121. package/dist/Result.d.ts +3 -1
  122. package/dist/Result.d.ts.map +1 -1
  123. package/dist/Result.js +5 -2
  124. package/dist/Result.js.map +1 -1
  125. package/dist/Schema.d.ts +90 -19
  126. package/dist/Schema.d.ts.map +1 -1
  127. package/dist/Schema.js +92 -414
  128. package/dist/Schema.js.map +1 -1
  129. package/dist/SchemaAST.d.ts.map +1 -1
  130. package/dist/SchemaAST.js +11 -7
  131. package/dist/SchemaAST.js.map +1 -1
  132. package/dist/SchemaGetter.d.ts +5 -6
  133. package/dist/SchemaGetter.d.ts.map +1 -1
  134. package/dist/SchemaGetter.js +14 -10
  135. package/dist/SchemaGetter.js.map +1 -1
  136. package/dist/SchemaRepresentation.d.ts +19 -64
  137. package/dist/SchemaRepresentation.d.ts.map +1 -1
  138. package/dist/SchemaRepresentation.js +1 -28
  139. package/dist/SchemaRepresentation.js.map +1 -1
  140. package/dist/SchemaTransformation.d.ts +11 -10
  141. package/dist/SchemaTransformation.d.ts.map +1 -1
  142. package/dist/SchemaTransformation.js +12 -11
  143. package/dist/SchemaTransformation.js.map +1 -1
  144. package/dist/Scope.d.ts +12 -6
  145. package/dist/Scope.d.ts.map +1 -1
  146. package/dist/Scope.js +12 -6
  147. package/dist/Scope.js.map +1 -1
  148. package/dist/ScopedCache.d.ts.map +1 -1
  149. package/dist/ScopedCache.js +8 -5
  150. package/dist/ScopedCache.js.map +1 -1
  151. package/dist/Semaphore.d.ts.map +1 -1
  152. package/dist/Semaphore.js +18 -4
  153. package/dist/Semaphore.js.map +1 -1
  154. package/dist/Stream.d.ts +128 -5
  155. package/dist/Stream.d.ts.map +1 -1
  156. package/dist/Stream.js +179 -43
  157. package/dist/Stream.js.map +1 -1
  158. package/dist/String.d.ts +57 -3
  159. package/dist/String.d.ts.map +1 -1
  160. package/dist/String.js +63 -5
  161. package/dist/String.js.map +1 -1
  162. package/dist/Struct.d.ts +135 -1
  163. package/dist/Struct.d.ts.map +1 -1
  164. package/dist/Struct.js +64 -5
  165. package/dist/Struct.js.map +1 -1
  166. package/dist/TextDiff.d.ts +105 -0
  167. package/dist/TextDiff.d.ts.map +1 -1
  168. package/dist/TextDiff.js +137 -24
  169. package/dist/TextDiff.js.map +1 -1
  170. package/dist/Tracer.d.ts +10 -0
  171. package/dist/Tracer.d.ts.map +1 -1
  172. package/dist/Tracer.js +2 -0
  173. package/dist/Tracer.js.map +1 -1
  174. package/dist/TxPriorityQueue.js +2 -2
  175. package/dist/TxPriorityQueue.js.map +1 -1
  176. package/dist/ai/LanguageModel.d.ts.map +1 -1
  177. package/dist/ai/LanguageModel.js +1 -1
  178. package/dist/ai/LanguageModel.js.map +1 -1
  179. package/dist/ai/McpServer.d.ts +199 -4
  180. package/dist/ai/McpServer.d.ts.map +1 -1
  181. package/dist/ai/McpServer.js +143 -18
  182. package/dist/ai/McpServer.js.map +1 -1
  183. package/dist/ai/Prompt.d.ts +3 -1
  184. package/dist/ai/Prompt.d.ts.map +1 -1
  185. package/dist/ai/Prompt.js +17 -3
  186. package/dist/ai/Prompt.js.map +1 -1
  187. package/dist/ai/Skill.d.ts +172 -0
  188. package/dist/ai/Skill.d.ts.map +1 -0
  189. package/dist/ai/Skill.js +209 -0
  190. package/dist/ai/Skill.js.map +1 -0
  191. package/dist/ai/Tool.d.ts +3 -2
  192. package/dist/ai/Tool.d.ts.map +1 -1
  193. package/dist/ai/Tool.js +3 -2
  194. package/dist/ai/Tool.js.map +1 -1
  195. package/dist/ai/Toolkit.d.ts.map +1 -1
  196. package/dist/ai/Toolkit.js +5 -1
  197. package/dist/ai/Toolkit.js.map +1 -1
  198. package/dist/ai/index.d.ts +5 -0
  199. package/dist/ai/index.d.ts.map +1 -1
  200. package/dist/ai/index.js +5 -0
  201. package/dist/ai/index.js.map +1 -1
  202. package/dist/chat/Chat.d.ts +90 -0
  203. package/dist/chat/Chat.d.ts.map +1 -0
  204. package/dist/chat/Chat.js +127 -0
  205. package/dist/chat/Chat.js.map +1 -0
  206. package/dist/chat/ChatAdapter.d.ts +386 -0
  207. package/dist/chat/ChatAdapter.d.ts.map +1 -0
  208. package/dist/chat/ChatAdapter.js +110 -0
  209. package/dist/chat/ChatAdapter.js.map +1 -0
  210. package/dist/chat/ChatError.d.ts +500 -0
  211. package/dist/chat/ChatError.d.ts.map +1 -0
  212. package/dist/chat/ChatError.js +521 -0
  213. package/dist/chat/ChatError.js.map +1 -0
  214. package/dist/chat/ChatEvent.d.ts +321 -0
  215. package/dist/chat/ChatEvent.d.ts.map +1 -0
  216. package/dist/chat/ChatEvent.js +163 -0
  217. package/dist/chat/ChatEvent.js.map +1 -0
  218. package/dist/chat/ChatHandler.d.ts +81 -0
  219. package/dist/chat/ChatHandler.d.ts.map +1 -0
  220. package/dist/chat/ChatHandler.js +85 -0
  221. package/dist/chat/ChatHandler.js.map +1 -0
  222. package/dist/chat/ChatInteraction.d.ts +1519 -0
  223. package/dist/chat/ChatInteraction.d.ts.map +1 -0
  224. package/dist/chat/ChatInteraction.js +1052 -0
  225. package/dist/chat/ChatInteraction.js.map +1 -0
  226. package/dist/chat/ChatMarkdown.d.ts +280 -0
  227. package/dist/chat/ChatMarkdown.d.ts.map +1 -0
  228. package/dist/chat/ChatMarkdown.js +1172 -0
  229. package/dist/chat/ChatMarkdown.js.map +1 -0
  230. package/dist/chat/ChatMessage.d.ts +224 -0
  231. package/dist/chat/ChatMessage.d.ts.map +1 -0
  232. package/dist/chat/ChatMessage.js +172 -0
  233. package/dist/chat/ChatMessage.js.map +1 -0
  234. package/dist/chat/ChatTest.d.ts +407 -0
  235. package/dist/chat/ChatTest.d.ts.map +1 -0
  236. package/dist/chat/ChatTest.js +2145 -0
  237. package/dist/chat/ChatTest.js.map +1 -0
  238. package/dist/chat/ChatThread.d.ts +92 -0
  239. package/dist/chat/ChatThread.d.ts.map +1 -0
  240. package/dist/chat/ChatThread.js +116 -0
  241. package/dist/chat/ChatThread.js.map +1 -0
  242. package/dist/chat/ChatUi.d.ts +362 -0
  243. package/dist/chat/ChatUi.d.ts.map +1 -0
  244. package/dist/chat/ChatUi.js +209 -0
  245. package/dist/chat/ChatUi.js.map +1 -0
  246. package/dist/chat/index.d.ts +60 -0
  247. package/dist/chat/index.d.ts.map +1 -0
  248. package/dist/chat/index.js +61 -0
  249. package/dist/chat/index.js.map +1 -0
  250. package/dist/chat/internal/retries.d.ts +2 -0
  251. package/dist/chat/internal/retries.d.ts.map +1 -0
  252. package/dist/chat/internal/retries.js +7 -0
  253. package/dist/chat/internal/retries.js.map +1 -0
  254. package/dist/cli/CliOutput.d.ts.map +1 -1
  255. package/dist/cli/CliOutput.js +6 -7
  256. package/dist/cli/CliOutput.js.map +1 -1
  257. package/dist/cli/Command.d.ts +20 -2
  258. package/dist/cli/Command.d.ts.map +1 -1
  259. package/dist/cli/Command.js +4 -0
  260. package/dist/cli/Command.js.map +1 -1
  261. package/dist/cli/Prompt.d.ts +5 -6
  262. package/dist/cli/Prompt.d.ts.map +1 -1
  263. package/dist/cli/Prompt.js +9 -4
  264. package/dist/cli/Prompt.js.map +1 -1
  265. package/dist/cli/internal/command.d.ts +1 -1
  266. package/dist/cli/internal/command.d.ts.map +1 -1
  267. package/dist/cli/internal/config.d.ts +1 -1
  268. package/dist/cli/internal/config.d.ts.map +1 -1
  269. package/dist/cli/internal/config.js +3 -3
  270. package/dist/cli/internal/config.js.map +1 -1
  271. package/dist/cluster/ClusterCron.d.ts +21 -1
  272. package/dist/cluster/ClusterCron.d.ts.map +1 -1
  273. package/dist/cluster/ClusterCron.js +24 -6
  274. package/dist/cluster/ClusterCron.js.map +1 -1
  275. package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  276. package/dist/cluster/ClusterWorkflowEngine.js +183 -103
  277. package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
  278. package/dist/cluster/MessageStorage.d.ts +56 -0
  279. package/dist/cluster/MessageStorage.d.ts.map +1 -1
  280. package/dist/cluster/MessageStorage.js +18 -2
  281. package/dist/cluster/MessageStorage.js.map +1 -1
  282. package/dist/cluster/Sharding.d.ts.map +1 -1
  283. package/dist/cluster/Sharding.js +15 -3
  284. package/dist/cluster/Sharding.js.map +1 -1
  285. package/dist/cluster/ShardingConfig.d.ts +6 -0
  286. package/dist/cluster/ShardingConfig.d.ts.map +1 -1
  287. package/dist/cluster/ShardingConfig.js.map +1 -1
  288. package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
  289. package/dist/cluster/SqlMessageStorage.js +58 -37
  290. package/dist/cluster/SqlMessageStorage.js.map +1 -1
  291. package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
  292. package/dist/cluster/SqlRunnerStorage.js +18 -8
  293. package/dist/cluster/SqlRunnerStorage.js.map +1 -1
  294. package/dist/cluster/internal/entityActivation.js +2 -0
  295. package/dist/cluster/internal/entityActivation.js.map +1 -1
  296. package/dist/cluster/internal/entityManager.js +20 -13
  297. package/dist/cluster/internal/entityManager.js.map +1 -1
  298. package/dist/cluster/internal/entityReaper.js +1 -1
  299. package/dist/cluster/internal/entityReaper.js.map +1 -1
  300. package/dist/crypto/Kdf.d.ts +2 -1
  301. package/dist/crypto/Kdf.d.ts.map +1 -1
  302. package/dist/crypto/Kdf.js +2 -1
  303. package/dist/crypto/Kdf.js.map +1 -1
  304. package/dist/crypto/Password.d.ts +162 -0
  305. package/dist/crypto/Password.d.ts.map +1 -0
  306. package/dist/crypto/Password.js +217 -0
  307. package/dist/crypto/Password.js.map +1 -0
  308. package/dist/crypto/index.d.ts +5 -0
  309. package/dist/crypto/index.d.ts.map +1 -1
  310. package/dist/crypto/index.js +5 -0
  311. package/dist/crypto/index.js.map +1 -1
  312. package/dist/encoding/Base64.d.ts +63 -0
  313. package/dist/encoding/Base64.d.ts.map +1 -1
  314. package/dist/encoding/Base64.js +82 -1
  315. package/dist/encoding/Base64.js.map +1 -1
  316. package/dist/encoding/Base64Url.d.ts +1 -0
  317. package/dist/encoding/Base64Url.d.ts.map +1 -1
  318. package/dist/encoding/Base64Url.js +7 -1
  319. package/dist/encoding/Base64Url.js.map +1 -1
  320. package/dist/encoding/Csv.d.ts.map +1 -1
  321. package/dist/encoding/Csv.js +44 -16
  322. package/dist/encoding/Csv.js.map +1 -1
  323. package/dist/encoding/Hex.d.ts +5 -0
  324. package/dist/encoding/Hex.d.ts.map +1 -1
  325. package/dist/encoding/Hex.js +5 -0
  326. package/dist/encoding/Hex.js.map +1 -1
  327. package/dist/encoding/SchemaBinary.d.ts.map +1 -1
  328. package/dist/encoding/SchemaBinary.js +13 -124
  329. package/dist/encoding/SchemaBinary.js.map +1 -1
  330. package/dist/encoding/Sse.d.ts +1 -0
  331. package/dist/encoding/Sse.d.ts.map +1 -1
  332. package/dist/encoding/Sse.js +7 -5
  333. package/dist/encoding/Sse.js.map +1 -1
  334. package/dist/encoding/Xml.d.ts +153 -18
  335. package/dist/encoding/Xml.d.ts.map +1 -1
  336. package/dist/encoding/Xml.js +379 -57
  337. package/dist/encoding/Xml.js.map +1 -1
  338. package/dist/eventlog/EventJournal.d.ts.map +1 -1
  339. package/dist/eventlog/EventJournal.js +3 -8
  340. package/dist/eventlog/EventJournal.js.map +1 -1
  341. package/dist/eventlog/SqlEventLogServerEncrypted.js +6 -8
  342. package/dist/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  343. package/dist/http/FetchHttpClient.d.ts +2 -1
  344. package/dist/http/FetchHttpClient.d.ts.map +1 -1
  345. package/dist/http/FetchHttpClient.js +14 -10
  346. package/dist/http/FetchHttpClient.js.map +1 -1
  347. package/dist/http/FindMyWay/internal/router.js +163 -116
  348. package/dist/http/FindMyWay/internal/router.js.map +1 -1
  349. package/dist/http/FindMyWay.d.ts +99 -0
  350. package/dist/http/FindMyWay.d.ts.map +1 -1
  351. package/dist/http/FindMyWay.js +39 -0
  352. package/dist/http/FindMyWay.js.map +1 -1
  353. package/dist/http/Headers.d.ts +201 -3
  354. package/dist/http/Headers.d.ts.map +1 -1
  355. package/dist/http/Headers.js +205 -3
  356. package/dist/http/Headers.js.map +1 -1
  357. package/dist/http/HttpClient.d.ts.map +1 -1
  358. package/dist/http/HttpClient.js +12 -8
  359. package/dist/http/HttpClient.js.map +1 -1
  360. package/dist/http/HttpClientError.d.ts +1 -0
  361. package/dist/http/HttpClientError.d.ts.map +1 -1
  362. package/dist/http/HttpClientError.js +32 -9
  363. package/dist/http/HttpClientError.js.map +1 -1
  364. package/dist/http/HttpClientRequest.d.ts +46 -0
  365. package/dist/http/HttpClientRequest.d.ts.map +1 -1
  366. package/dist/http/HttpClientRequest.js +15 -0
  367. package/dist/http/HttpClientRequest.js.map +1 -1
  368. package/dist/http/HttpClientResponse.d.ts +132 -0
  369. package/dist/http/HttpClientResponse.d.ts.map +1 -1
  370. package/dist/http/HttpClientResponse.js +83 -0
  371. package/dist/http/HttpClientResponse.js.map +1 -1
  372. package/dist/http/HttpMiddleware.d.ts.map +1 -1
  373. package/dist/http/HttpMiddleware.js +16 -9
  374. package/dist/http/HttpMiddleware.js.map +1 -1
  375. package/dist/http/HttpRouter.d.ts +49 -1
  376. package/dist/http/HttpRouter.d.ts.map +1 -1
  377. package/dist/http/HttpRouter.js +70 -20
  378. package/dist/http/HttpRouter.js.map +1 -1
  379. package/dist/http/HttpServerResponse.d.ts +118 -0
  380. package/dist/http/HttpServerResponse.d.ts.map +1 -1
  381. package/dist/http/HttpServerResponse.js +67 -58
  382. package/dist/http/HttpServerResponse.js.map +1 -1
  383. package/dist/http/Mime.d.ts.map +1 -1
  384. package/dist/http/Mime.js +3 -2
  385. package/dist/http/Mime.js.map +1 -1
  386. package/dist/http/Multipart.d.ts.map +1 -1
  387. package/dist/http/Multipart.js +0 -5
  388. package/dist/http/Multipart.js.map +1 -1
  389. package/dist/http/MultipartParser/internal/contentType.d.ts +6 -0
  390. package/dist/http/MultipartParser/internal/contentType.d.ts.map +1 -1
  391. package/dist/http/MultipartParser/internal/contentType.js +1 -1
  392. package/dist/http/MultipartParser/internal/contentType.js.map +1 -1
  393. package/dist/http/internal/clientPath.d.ts +2 -0
  394. package/dist/http/internal/clientPath.d.ts.map +1 -0
  395. package/dist/http/internal/clientPath.js +24 -0
  396. package/dist/http/internal/clientPath.js.map +1 -0
  397. package/dist/http/internal/compression.d.ts.map +1 -1
  398. package/dist/http/internal/compression.js +2 -2
  399. package/dist/http/internal/compression.js.map +1 -1
  400. package/dist/http/internal/mediaType.d.ts.map +1 -0
  401. package/dist/{http-api → http}/internal/mediaType.js +4 -0
  402. package/dist/{http-api → http}/internal/mediaType.js.map +1 -1
  403. package/dist/http/internal/redactedPath.d.ts +2 -0
  404. package/dist/http/internal/redactedPath.d.ts.map +1 -0
  405. package/dist/http/internal/redactedPath.js +140 -0
  406. package/dist/http/internal/redactedPath.js.map +1 -0
  407. package/dist/http/internal/requestState.js +1 -0
  408. package/dist/http/internal/requestState.js.map +1 -1
  409. package/dist/http/internal/tracing.js +5 -3
  410. package/dist/http/internal/tracing.js.map +1 -1
  411. package/dist/http-api/HttpApi.d.ts +13 -2
  412. package/dist/http-api/HttpApi.d.ts.map +1 -1
  413. package/dist/http-api/HttpApi.js +43 -6
  414. package/dist/http-api/HttpApi.js.map +1 -1
  415. package/dist/http-api/HttpApiBuilder.d.ts.map +1 -1
  416. package/dist/http-api/HttpApiBuilder.js +7 -3
  417. package/dist/http-api/HttpApiBuilder.js.map +1 -1
  418. package/dist/http-api/HttpApiClient.d.ts.map +1 -1
  419. package/dist/http-api/HttpApiClient.js +29 -12
  420. package/dist/http-api/HttpApiClient.js.map +1 -1
  421. package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
  422. package/dist/http-api/HttpApiEndpoint.js +1 -1
  423. package/dist/http-api/HttpApiEndpoint.js.map +1 -1
  424. package/dist/http-api/HttpApiScalar.d.ts +4 -0
  425. package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
  426. package/dist/http-api/HttpApiScalar.js +10 -1
  427. package/dist/http-api/HttpApiScalar.js.map +1 -1
  428. package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
  429. package/dist/http-api/HttpApiSchema.js +1 -1
  430. package/dist/http-api/HttpApiSchema.js.map +1 -1
  431. package/dist/http-api/OpenApi.d.ts +2 -0
  432. package/dist/http-api/OpenApi.d.ts.map +1 -1
  433. package/dist/http-api/internal/httpApiScalar.js +5 -2
  434. package/dist/http-api/internal/httpApiScalar.js.map +1 -1
  435. package/dist/http-api/internal/redactedKeys.d.ts +2 -0
  436. package/dist/http-api/internal/redactedKeys.d.ts.map +1 -0
  437. package/dist/http-api/internal/redactedKeys.js +37 -0
  438. package/dist/http-api/internal/redactedKeys.js.map +1 -0
  439. package/dist/index.d.ts +5 -0
  440. package/dist/index.d.ts.map +1 -1
  441. package/dist/index.js +5 -0
  442. package/dist/index.js.map +1 -1
  443. package/dist/internal/arbitrary/model.js +0 -5
  444. package/dist/internal/arbitrary/model.js.map +1 -1
  445. package/dist/internal/arbitrary/regexp.js +2 -1
  446. package/dist/internal/arbitrary/regexp.js.map +1 -1
  447. package/dist/internal/arbitrary/runner.d.ts.map +1 -1
  448. package/dist/internal/arbitrary/runner.js +21 -16
  449. package/dist/internal/arbitrary/runner.js.map +1 -1
  450. package/dist/internal/arbitrary/schema.js +140 -23
  451. package/dist/internal/arbitrary/schema.js.map +1 -1
  452. package/dist/internal/base64.js +34 -2
  453. package/dist/internal/base64.js.map +1 -1
  454. package/dist/internal/codegen.d.ts +2 -0
  455. package/dist/internal/codegen.d.ts.map +1 -0
  456. package/dist/internal/codegen.js +59 -0
  457. package/dist/internal/codegen.js.map +1 -0
  458. package/dist/internal/core.js +3 -3
  459. package/dist/internal/core.js.map +1 -1
  460. package/dist/internal/dateTime.js +61 -29
  461. package/dist/internal/dateTime.js.map +1 -1
  462. package/dist/internal/effect.js +30 -8
  463. package/dist/internal/effect.js.map +1 -1
  464. package/dist/internal/equal.js +14 -13
  465. package/dist/internal/equal.js.map +1 -1
  466. package/dist/internal/hash.js +4 -1
  467. package/dist/internal/hash.js.map +1 -1
  468. package/dist/internal/hashMap.js +7 -7
  469. package/dist/internal/hashMap.js.map +1 -1
  470. package/dist/internal/matcher.js +19 -18
  471. package/dist/internal/matcher.js.map +1 -1
  472. package/dist/internal/record.js +18 -4
  473. package/dist/internal/record.js.map +1 -1
  474. package/dist/internal/result.js +1 -1
  475. package/dist/internal/result.js.map +1 -1
  476. package/dist/internal/schema/codeExpression.d.ts +4 -0
  477. package/dist/internal/schema/codeExpression.d.ts.map +1 -0
  478. package/dist/internal/schema/codeExpression.js +179 -0
  479. package/dist/internal/schema/codeExpression.js.map +1 -0
  480. package/dist/internal/schema/codeImports.d.ts +8 -0
  481. package/dist/internal/schema/codeImports.d.ts.map +1 -0
  482. package/dist/internal/schema/codeImports.js +135 -0
  483. package/dist/internal/schema/codeImports.js.map +1 -0
  484. package/dist/internal/schema/codeTokens.d.ts +8 -0
  485. package/dist/internal/schema/codeTokens.d.ts.map +1 -0
  486. package/dist/internal/schema/codeTokens.js +17 -0
  487. package/dist/internal/schema/codeTokens.js.map +1 -0
  488. package/dist/internal/schema/passthrough.d.ts +2 -0
  489. package/dist/internal/schema/passthrough.d.ts.map +1 -0
  490. package/dist/internal/schema/passthrough.js +8 -0
  491. package/dist/internal/schema/passthrough.js.map +1 -0
  492. package/dist/internal/schema/schemaCodegen.d.ts +2 -0
  493. package/dist/internal/schema/schemaCodegen.d.ts.map +1 -0
  494. package/dist/internal/schema/schemaCodegen.js +378 -0
  495. package/dist/internal/schema/schemaCodegen.js.map +1 -0
  496. package/dist/internal/schema/schemaCodegenBuiltIns.d.ts +2 -0
  497. package/dist/internal/schema/schemaCodegenBuiltIns.d.ts.map +1 -0
  498. package/dist/internal/schema/schemaCodegenBuiltIns.js +425 -0
  499. package/dist/internal/schema/schemaCodegenBuiltIns.js.map +1 -0
  500. package/dist/internal/schema/toEquivalence.js +3 -4
  501. package/dist/internal/schema/toEquivalence.js.map +1 -1
  502. package/dist/internal/schema/toJsonSchemaDocument.js +11 -4
  503. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  504. package/dist/internal/trie.js +51 -64
  505. package/dist/internal/trie.js.map +1 -1
  506. package/dist/internal/utf8.d.ts +2 -0
  507. package/dist/internal/utf8.d.ts.map +1 -0
  508. package/dist/internal/utf8.js +151 -0
  509. package/dist/internal/utf8.js.map +1 -0
  510. package/dist/internal/version.js +1 -1
  511. package/dist/jose/JoseError.d.ts +51 -1
  512. package/dist/jose/JoseError.d.ts.map +1 -1
  513. package/dist/jose/JoseError.js +25 -18
  514. package/dist/jose/JoseError.js.map +1 -1
  515. package/dist/jose/Jwks.d.ts +13 -0
  516. package/dist/jose/Jwks.d.ts.map +1 -1
  517. package/dist/jose/Jwks.js +10 -2
  518. package/dist/jose/Jwks.js.map +1 -1
  519. package/dist/jose/internal/compact.js +10 -5
  520. package/dist/jose/internal/compact.js.map +1 -1
  521. package/dist/observability/Otlp.d.ts +19 -0
  522. package/dist/observability/Otlp.d.ts.map +1 -1
  523. package/dist/observability/Otlp.js +10 -0
  524. package/dist/observability/Otlp.js.map +1 -1
  525. package/dist/observability/OtlpExporter.d.ts +49 -13
  526. package/dist/observability/OtlpExporter.d.ts.map +1 -1
  527. package/dist/observability/OtlpExporter.js +133 -50
  528. package/dist/observability/OtlpExporter.js.map +1 -1
  529. package/dist/observability/OtlpLogger.d.ts +14 -0
  530. package/dist/observability/OtlpLogger.d.ts.map +1 -1
  531. package/dist/observability/OtlpLogger.js +15 -5
  532. package/dist/observability/OtlpLogger.js.map +1 -1
  533. package/dist/observability/OtlpMetrics.d.ts.map +1 -1
  534. package/dist/observability/OtlpMetrics.js +2 -0
  535. package/dist/observability/OtlpMetrics.js.map +1 -1
  536. package/dist/observability/OtlpTracer.d.ts +14 -0
  537. package/dist/observability/OtlpTracer.d.ts.map +1 -1
  538. package/dist/observability/OtlpTracer.js +10 -2
  539. package/dist/observability/OtlpTracer.js.map +1 -1
  540. package/dist/observability/internal/otlpProtobuf.d.ts +4 -2
  541. package/dist/observability/internal/otlpProtobuf.d.ts.map +1 -1
  542. package/dist/observability/internal/otlpProtobuf.js +238 -156
  543. package/dist/observability/internal/otlpProtobuf.js.map +1 -1
  544. package/dist/persistence/KeyValueStore.d.ts.map +1 -1
  545. package/dist/persistence/KeyValueStore.js +6 -4
  546. package/dist/persistence/KeyValueStore.js.map +1 -1
  547. package/dist/persistence/PersistedQueue.d.ts.map +1 -1
  548. package/dist/persistence/PersistedQueue.js +20 -3
  549. package/dist/persistence/PersistedQueue.js.map +1 -1
  550. package/dist/protobuf/ProtobufDescriptor.d.ts +377 -0
  551. package/dist/protobuf/ProtobufDescriptor.d.ts.map +1 -0
  552. package/dist/protobuf/ProtobufDescriptor.js +135 -0
  553. package/dist/protobuf/ProtobufDescriptor.js.map +1 -0
  554. package/dist/protobuf/ProtobufDescriptorProto.d.ts +2083 -0
  555. package/dist/protobuf/ProtobufDescriptorProto.d.ts.map +1 -0
  556. package/dist/protobuf/ProtobufDescriptorProto.js +2674 -0
  557. package/dist/protobuf/ProtobufDescriptorProto.js.map +1 -0
  558. package/dist/protobuf/ProtobufMessage.d.ts +183 -0
  559. package/dist/protobuf/ProtobufMessage.d.ts.map +1 -0
  560. package/dist/protobuf/ProtobufMessage.js +232 -0
  561. package/dist/protobuf/ProtobufMessage.js.map +1 -0
  562. package/dist/protobuf/ProtobufReader.d.ts +350 -0
  563. package/dist/protobuf/ProtobufReader.d.ts.map +1 -0
  564. package/dist/protobuf/ProtobufReader.js +698 -0
  565. package/dist/protobuf/ProtobufReader.js.map +1 -0
  566. package/dist/protobuf/ProtobufWriter.d.ts +224 -0
  567. package/dist/protobuf/ProtobufWriter.d.ts.map +1 -0
  568. package/dist/protobuf/ProtobufWriter.js +483 -0
  569. package/dist/protobuf/ProtobufWriter.js.map +1 -0
  570. package/dist/protobuf/index.d.ts +30 -0
  571. package/dist/protobuf/index.d.ts.map +1 -0
  572. package/dist/protobuf/index.js +31 -0
  573. package/dist/protobuf/index.js.map +1 -0
  574. package/dist/protobuf/internal/binary.d.ts +2 -0
  575. package/dist/protobuf/internal/binary.d.ts.map +1 -0
  576. package/dist/protobuf/internal/binary.js +966 -0
  577. package/dist/protobuf/internal/binary.js.map +1 -0
  578. package/dist/protobuf/internal/resolve.d.ts +2 -0
  579. package/dist/protobuf/internal/resolve.d.ts.map +1 -0
  580. package/dist/protobuf/internal/resolve.js +463 -0
  581. package/dist/protobuf/internal/resolve.js.map +1 -0
  582. package/dist/protobuf/internal/wireType.d.ts +2 -0
  583. package/dist/protobuf/internal/wireType.d.ts.map +1 -0
  584. package/dist/protobuf/internal/wireType.js +10 -0
  585. package/dist/protobuf/internal/wireType.js.map +1 -0
  586. package/dist/reactivity/AsyncResult.d.ts +3 -0
  587. package/dist/reactivity/AsyncResult.d.ts.map +1 -1
  588. package/dist/reactivity/AsyncResult.js +4 -1
  589. package/dist/reactivity/AsyncResult.js.map +1 -1
  590. package/dist/reactivity/Atom.d.ts +10 -4
  591. package/dist/reactivity/Atom.d.ts.map +1 -1
  592. package/dist/reactivity/Atom.js +48 -22
  593. package/dist/reactivity/Atom.js.map +1 -1
  594. package/dist/reactivity/AtomHttpApi.d.ts +5 -0
  595. package/dist/reactivity/AtomHttpApi.d.ts.map +1 -1
  596. package/dist/reactivity/AtomHttpApi.js +5 -1
  597. package/dist/reactivity/AtomHttpApi.js.map +1 -1
  598. package/dist/reactivity/AtomRegistry.js +13 -0
  599. package/dist/reactivity/AtomRegistry.js.map +1 -1
  600. package/dist/reactivity/AtomRpc.d.ts +5 -0
  601. package/dist/reactivity/AtomRpc.d.ts.map +1 -1
  602. package/dist/reactivity/AtomRpc.js +6 -1
  603. package/dist/reactivity/AtomRpc.js.map +1 -1
  604. package/dist/rpc/Rpc.d.ts +25 -0
  605. package/dist/rpc/Rpc.d.ts.map +1 -1
  606. package/dist/rpc/Rpc.js +18 -0
  607. package/dist/rpc/Rpc.js.map +1 -1
  608. package/dist/rpc/RpcClient.d.ts.map +1 -1
  609. package/dist/rpc/RpcClient.js +70 -22
  610. package/dist/rpc/RpcClient.js.map +1 -1
  611. package/dist/rpc/RpcGroup.d.ts +6 -1
  612. package/dist/rpc/RpcGroup.d.ts.map +1 -1
  613. package/dist/rpc/RpcGroup.js +4 -0
  614. package/dist/rpc/RpcGroup.js.map +1 -1
  615. package/dist/rpc/RpcMiddleware.d.ts +9 -0
  616. package/dist/rpc/RpcMiddleware.d.ts.map +1 -1
  617. package/dist/rpc/RpcMiddleware.js.map +1 -1
  618. package/dist/rpc/RpcSerialization.d.ts +7 -1
  619. package/dist/rpc/RpcSerialization.d.ts.map +1 -1
  620. package/dist/rpc/RpcSerialization.js +22 -5
  621. package/dist/rpc/RpcSerialization.js.map +1 -1
  622. package/dist/rpc/RpcServer.d.ts.map +1 -1
  623. package/dist/rpc/RpcServer.js +33 -18
  624. package/dist/rpc/RpcServer.js.map +1 -1
  625. package/dist/schema/SchemaCompiler/runtime.js +2 -1
  626. package/dist/schema/SchemaCompiler/runtime.js.map +1 -1
  627. package/dist/schema/VariantSchema.d.ts +10 -2
  628. package/dist/schema/VariantSchema.d.ts.map +1 -1
  629. package/dist/schema/VariantSchema.js +7 -1
  630. package/dist/schema/VariantSchema.js.map +1 -1
  631. package/dist/socket/Socket.d.ts +24 -10
  632. package/dist/socket/Socket.d.ts.map +1 -1
  633. package/dist/socket/Socket.js +52 -17
  634. package/dist/socket/Socket.js.map +1 -1
  635. package/dist/sql/Migrator.d.ts +3 -0
  636. package/dist/sql/Migrator.d.ts.map +1 -1
  637. package/dist/sql/Migrator.js +12 -6
  638. package/dist/sql/Migrator.js.map +1 -1
  639. package/dist/sql/SqlClient.d.ts.map +1 -1
  640. package/dist/sql/SqlClient.js +5 -1
  641. package/dist/sql/SqlClient.js.map +1 -1
  642. package/dist/sql/SqlModel.d.ts.map +1 -1
  643. package/dist/sql/SqlModel.js +1 -0
  644. package/dist/sql/SqlModel.js.map +1 -1
  645. package/dist/testing/TestConsole.d.ts +96 -0
  646. package/dist/testing/TestConsole.d.ts.map +1 -1
  647. package/dist/testing/TestConsole.js +78 -6
  648. package/dist/testing/TestConsole.js.map +1 -1
  649. package/dist/testing/TestSchema.d.ts +5 -1
  650. package/dist/testing/TestSchema.d.ts.map +1 -1
  651. package/dist/testing/TestSchema.js +7 -2
  652. package/dist/testing/TestSchema.js.map +1 -1
  653. package/dist/workers/SharedMemory.d.ts +115 -0
  654. package/dist/workers/SharedMemory.d.ts.map +1 -0
  655. package/dist/workers/SharedMemory.js +149 -0
  656. package/dist/workers/SharedMemory.js.map +1 -0
  657. package/dist/workers/Transferable.d.ts.map +1 -1
  658. package/dist/workers/Transferable.js +1 -4
  659. package/dist/workers/Transferable.js.map +1 -1
  660. package/dist/workers/index.d.ts +5 -0
  661. package/dist/workers/index.d.ts.map +1 -1
  662. package/dist/workers/index.js +5 -0
  663. package/dist/workers/index.js.map +1 -1
  664. package/dist/workflow/Activity.d.ts +18 -0
  665. package/dist/workflow/Activity.d.ts.map +1 -1
  666. package/dist/workflow/Activity.js +13 -4
  667. package/dist/workflow/Activity.js.map +1 -1
  668. package/dist/workflow/Workflow.d.ts +10 -9
  669. package/dist/workflow/Workflow.d.ts.map +1 -1
  670. package/dist/workflow/Workflow.js +33 -22
  671. package/dist/workflow/Workflow.js.map +1 -1
  672. package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
  673. package/dist/workflow/WorkflowEngine.js +28 -12
  674. package/dist/workflow/WorkflowEngine.js.map +1 -1
  675. package/dist/workflow/internal/retry.d.ts +2 -0
  676. package/dist/workflow/internal/retry.d.ts.map +1 -0
  677. package/dist/workflow/internal/retry.js +11 -0
  678. package/dist/workflow/internal/retry.js.map +1 -0
  679. package/dist/workflow/internal/scope.d.ts +2 -0
  680. package/dist/workflow/internal/scope.d.ts.map +1 -0
  681. package/dist/workflow/internal/scope.js +26 -0
  682. package/dist/workflow/internal/scope.js.map +1 -0
  683. package/package.json +8 -5
  684. package/src/Arbitrary.ts +60 -3
  685. package/src/BigInt.ts +247 -9
  686. package/src/Cache.ts +4 -2
  687. package/src/Cause.ts +3 -3
  688. package/src/Channel.ts +105 -8
  689. package/src/Chunk.ts +7 -3
  690. package/src/Clock.ts +5 -2
  691. package/src/Codegen.ts +746 -0
  692. package/src/Config.ts +35 -4
  693. package/src/ConfigProvider.ts +24 -7
  694. package/src/Effect.ts +1095 -157
  695. package/src/Equal.ts +85 -79
  696. package/src/Equivalence.ts +16 -13
  697. package/src/Fiber.ts +58 -8
  698. package/src/FiberHandle.ts +86 -12
  699. package/src/FiberMap.ts +83 -10
  700. package/src/FiberSet.ts +96 -8
  701. package/src/Formatter.ts +2 -0
  702. package/src/Hash.ts +30 -22
  703. package/src/LayerMap.ts +14 -4
  704. package/src/LayerRef.ts +8 -6
  705. package/src/Logger.ts +68 -25
  706. package/src/Match.ts +94 -50
  707. package/src/Metric.ts +1 -1
  708. package/src/Option.ts +9 -5
  709. package/src/Order.ts +10 -5
  710. package/src/Pool.ts +22 -17
  711. package/src/Predicate.ts +7 -3
  712. package/src/Queue.ts +84 -31
  713. package/src/Rational.ts +198 -0
  714. package/src/Request.ts +20 -0
  715. package/src/Result.ts +9 -6
  716. package/src/Schema.ts +145 -325
  717. package/src/SchemaAST.ts +15 -5
  718. package/src/SchemaGetter.ts +17 -10
  719. package/src/SchemaRepresentation.ts +19 -74
  720. package/src/SchemaTransformation.ts +12 -11
  721. package/src/Scope.ts +12 -6
  722. package/src/ScopedCache.ts +8 -5
  723. package/src/Semaphore.ts +18 -4
  724. package/src/Stream.ts +233 -53
  725. package/src/String.ts +84 -7
  726. package/src/Struct.ts +138 -5
  727. package/src/TextDiff.ts +186 -30
  728. package/src/Tracer.ts +10 -0
  729. package/src/TxPriorityQueue.ts +2 -2
  730. package/src/ai/LanguageModel.ts +2 -1
  731. package/src/ai/McpServer.ts +306 -26
  732. package/src/ai/Prompt.ts +20 -3
  733. package/src/ai/Skill.ts +236 -0
  734. package/src/ai/Tool.ts +3 -2
  735. package/src/ai/Toolkit.ts +3 -1
  736. package/src/ai/index.ts +6 -0
  737. package/src/chat/Chat.ts +164 -0
  738. package/src/chat/ChatAdapter.ts +444 -0
  739. package/src/chat/ChatError.ts +684 -0
  740. package/src/chat/ChatEvent.ts +221 -0
  741. package/src/chat/ChatHandler.ts +102 -0
  742. package/src/chat/ChatInteraction.ts +1979 -0
  743. package/src/chat/ChatMarkdown.ts +1406 -0
  744. package/src/chat/ChatMessage.ts +213 -0
  745. package/src/chat/ChatTest.ts +2606 -0
  746. package/src/chat/ChatThread.ts +132 -0
  747. package/src/chat/ChatUi.ts +320 -0
  748. package/src/chat/index.ts +72 -0
  749. package/src/chat/internal/retries.ts +7 -0
  750. package/src/cli/CliOutput.ts +4 -5
  751. package/src/cli/Command.ts +20 -2
  752. package/src/cli/Prompt.ts +15 -9
  753. package/src/cli/internal/config.ts +8 -8
  754. package/src/cluster/ClusterCron.ts +33 -10
  755. package/src/cluster/ClusterWorkflowEngine.ts +214 -119
  756. package/src/cluster/MessageStorage.ts +51 -2
  757. package/src/cluster/Sharding.ts +17 -3
  758. package/src/cluster/ShardingConfig.ts +3 -0
  759. package/src/cluster/SqlMessageStorage.ts +97 -54
  760. package/src/cluster/SqlRunnerStorage.ts +21 -8
  761. package/src/cluster/internal/entityActivation.ts +6 -0
  762. package/src/cluster/internal/entityManager.ts +27 -14
  763. package/src/cluster/internal/entityReaper.ts +1 -1
  764. package/src/crypto/Kdf.ts +2 -1
  765. package/src/crypto/Password.ts +258 -0
  766. package/src/crypto/index.ts +6 -0
  767. package/src/encoding/Base64.ts +84 -1
  768. package/src/encoding/Base64Url.ts +7 -1
  769. package/src/encoding/Csv.ts +47 -20
  770. package/src/encoding/Hex.ts +5 -0
  771. package/src/encoding/SchemaBinary.ts +13 -79
  772. package/src/encoding/Sse.ts +7 -5
  773. package/src/encoding/Xml.ts +485 -68
  774. package/src/eventlog/EventJournal.ts +3 -8
  775. package/src/eventlog/SqlEventLogServerEncrypted.ts +9 -9
  776. package/src/http/FetchHttpClient.ts +8 -5
  777. package/src/http/FindMyWay/internal/router.ts +181 -129
  778. package/src/http/FindMyWay.ts +106 -0
  779. package/src/http/Headers.ts +309 -3
  780. package/src/http/HttpClient.ts +21 -8
  781. package/src/http/HttpClientError.ts +42 -9
  782. package/src/http/HttpClientRequest.ts +51 -0
  783. package/src/http/HttpClientResponse.ts +156 -0
  784. package/src/http/HttpMiddleware.ts +23 -10
  785. package/src/http/HttpRouter.ts +84 -20
  786. package/src/http/HttpServerResponse.ts +159 -61
  787. package/src/http/Mime.ts +3 -2
  788. package/src/http/Multipart.ts +0 -5
  789. package/src/http/MultipartParser/internal/contentType.ts +1 -1
  790. package/src/http/internal/clientPath.ts +39 -0
  791. package/src/http/internal/compression.ts +2 -2
  792. package/src/{http-api → http}/internal/mediaType.ts +4 -0
  793. package/src/http/internal/redactedPath.ts +148 -0
  794. package/src/http/internal/requestState.ts +2 -0
  795. package/src/http/internal/tracing.ts +6 -3
  796. package/src/http-api/HttpApi.ts +50 -6
  797. package/src/http-api/HttpApiBuilder.ts +11 -3
  798. package/src/http-api/HttpApiClient.ts +40 -13
  799. package/src/http-api/HttpApiEndpoint.ts +1 -1
  800. package/src/http-api/HttpApiScalar.ts +9 -1
  801. package/src/http-api/HttpApiSchema.ts +1 -1
  802. package/src/http-api/OpenApi.ts +2 -0
  803. package/src/http-api/internal/httpApiScalar.ts +5 -1
  804. package/src/http-api/internal/redactedKeys.ts +40 -0
  805. package/src/index.ts +6 -0
  806. package/src/internal/arbitrary/model.ts +3 -9
  807. package/src/internal/arbitrary/regexp.ts +3 -1
  808. package/src/internal/arbitrary/runner.ts +28 -14
  809. package/src/internal/arbitrary/schema.ts +140 -35
  810. package/src/internal/base64.ts +57 -2
  811. package/src/internal/codegen.ts +53 -0
  812. package/src/internal/core.ts +3 -3
  813. package/src/internal/dateTime.ts +73 -37
  814. package/src/internal/effect.ts +56 -111
  815. package/src/internal/equal.ts +37 -17
  816. package/src/internal/hash.ts +5 -1
  817. package/src/internal/hashMap.ts +8 -7
  818. package/src/internal/matcher.ts +36 -114
  819. package/src/internal/record.ts +19 -4
  820. package/src/internal/result.ts +1 -1
  821. package/src/internal/schema/codeExpression.ts +179 -0
  822. package/src/internal/schema/codeImports.ts +142 -0
  823. package/src/internal/schema/codeTokens.ts +39 -0
  824. package/src/internal/schema/passthrough.ts +8 -0
  825. package/src/internal/schema/schemaCodegen.ts +544 -0
  826. package/src/internal/schema/schemaCodegenBuiltIns.ts +343 -0
  827. package/src/internal/schema/toEquivalence.ts +3 -5
  828. package/src/internal/schema/toJsonSchemaDocument.ts +13 -4
  829. package/src/internal/trie.ts +46 -60
  830. package/src/internal/utf8.ts +106 -0
  831. package/src/internal/version.ts +1 -1
  832. package/src/jose/JoseError.ts +34 -0
  833. package/src/jose/Jwks.ts +23 -4
  834. package/src/jose/internal/compact.ts +14 -5
  835. package/src/observability/Otlp.ts +29 -0
  836. package/src/observability/OtlpExporter.ts +209 -76
  837. package/src/observability/OtlpLogger.ts +29 -5
  838. package/src/observability/OtlpMetrics.ts +2 -0
  839. package/src/observability/OtlpTracer.ts +24 -3
  840. package/src/observability/internal/otlpProtobuf.ts +386 -457
  841. package/src/persistence/KeyValueStore.ts +17 -14
  842. package/src/persistence/PersistedQueue.ts +21 -4
  843. package/src/protobuf/ProtobufDescriptor.ts +503 -0
  844. package/src/protobuf/ProtobufDescriptorProto.ts +3611 -0
  845. package/src/protobuf/ProtobufMessage.ts +277 -0
  846. package/src/protobuf/ProtobufReader.ts +756 -0
  847. package/src/protobuf/ProtobufWriter.ts +530 -0
  848. package/src/protobuf/index.ts +36 -0
  849. package/src/protobuf/internal/binary.ts +1215 -0
  850. package/src/protobuf/internal/resolve.ts +533 -0
  851. package/src/protobuf/internal/wireType.ts +9 -0
  852. package/src/reactivity/AsyncResult.ts +6 -1
  853. package/src/reactivity/Atom.ts +67 -34
  854. package/src/reactivity/AtomHttpApi.ts +10 -1
  855. package/src/reactivity/AtomRegistry.ts +16 -0
  856. package/src/reactivity/AtomRpc.ts +11 -1
  857. package/src/rpc/Rpc.ts +31 -0
  858. package/src/rpc/RpcClient.ts +56 -22
  859. package/src/rpc/RpcGroup.ts +9 -1
  860. package/src/rpc/RpcMiddleware.ts +9 -0
  861. package/src/rpc/RpcSerialization.ts +26 -6
  862. package/src/rpc/RpcServer.ts +33 -20
  863. package/src/schema/SchemaCompiler/runtime.ts +2 -3
  864. package/src/schema/VariantSchema.ts +12 -4
  865. package/src/socket/Socket.ts +67 -20
  866. package/src/sql/Migrator.ts +10 -12
  867. package/src/sql/SqlClient.ts +14 -8
  868. package/src/sql/SqlModel.ts +4 -0
  869. package/src/testing/TestConsole.ts +119 -9
  870. package/src/testing/TestSchema.ts +8 -3
  871. package/src/workers/SharedMemory.ts +227 -0
  872. package/src/workers/Transferable.ts +1 -5
  873. package/src/workers/index.ts +6 -0
  874. package/src/workflow/Activity.ts +28 -4
  875. package/src/workflow/Workflow.ts +68 -44
  876. package/src/workflow/WorkflowEngine.ts +41 -16
  877. package/src/workflow/internal/retry.ts +12 -0
  878. package/src/workflow/internal/scope.ts +36 -0
  879. package/dist/http-api/internal/mediaType.d.ts.map +0 -1
  880. package/dist/internal/schema/toCodeDocument.d.ts +0 -2
  881. package/dist/internal/schema/toCodeDocument.d.ts.map +0 -1
  882. package/dist/internal/schema/toCodeDocument.js +0 -447
  883. package/dist/internal/schema/toCodeDocument.js.map +0 -1
  884. package/dist/observability/internal/protobuf.d.ts +0 -2
  885. package/dist/observability/internal/protobuf.d.ts.map +0 -1
  886. package/dist/observability/internal/protobuf.js +0 -169
  887. package/dist/observability/internal/protobuf.js.map +0 -1
  888. package/src/internal/schema/toCodeDocument.ts +0 -578
  889. package/src/observability/internal/protobuf.ts +0 -225
  890. /package/dist/{http-api → http}/internal/mediaType.d.ts +0 -0
package/src/Effect.ts CHANGED
@@ -10,6 +10,25 @@
10
10
  * creating effects, combining them, handling failures, managing resources, and
11
11
  * running effect programs.
12
12
  *
13
+ * A fiber runs in either an interruptible or an uninterruptible region.
14
+ * `interruptible`, `uninterruptible`, and `uninterruptibleMask` change the
15
+ * region for the effect they wrap.
16
+ *
17
+ * Interrupting a fiber records a request. In an interruptible region the
18
+ * fiber stops its current work. In an uninterruptible region it continues
19
+ * until it next enters an interruptible region, where the request takes effect.
20
+ *
21
+ * An interrupted fiber skips ordinary continuations and failure handlers in
22
+ * interruptible regions. By default, `onExit` runs cleanup and `Scope.close`
23
+ * runs registered finalizers in an uninterruptible region.
24
+ *
25
+ * Fork and run APIs start fibers in an interruptible region by default,
26
+ * regardless of the caller's region. Concurrent `all` and `forEach` effects
27
+ * inherit the caller's region. Any contender a race or timeout starts is
28
+ * initially interruptible.
29
+ *
30
+ * `Fiber.interrupt` waits for the fiber to finish, including its cleanup.
31
+ *
13
32
  * @stability stable
14
33
  * @since 2.0.0
15
34
  */
@@ -65,6 +84,7 @@ import type {
65
84
  ExcludeTag,
66
85
  ExtractReason,
67
86
  ExtractTag,
87
+ IsUnion,
68
88
  NarrowReason,
69
89
  NoInfer,
70
90
  OmitReason,
@@ -337,7 +357,7 @@ export declare namespace All {
337
357
  * @since 2.0.0
338
358
  */
339
359
  export type ReturnObject<T, Discard extends boolean, Mode extends boolean = false> = [T] extends [
340
- Record<string, EffectAny>
360
+ Record<PropertyKey, EffectAny>
341
361
  ] ? Effect<
342
362
  Discard extends true ? void
343
363
  : {
@@ -377,7 +397,7 @@ export declare namespace All {
377
397
  * @since 2.0.0
378
398
  */
379
399
  export type Return<
380
- Arg extends Iterable<EffectAny> | Record<string, EffectAny>,
400
+ Arg extends Iterable<EffectAny> | Record<PropertyKey, EffectAny>,
381
401
  O extends {
382
402
  readonly concurrency?: Concurrency | undefined
383
403
  readonly discard?: boolean | undefined
@@ -385,7 +405,7 @@ export declare namespace All {
385
405
  }
386
406
  > = [Arg] extends [ReadonlyArray<EffectAny>] ? ReturnTuple<Arg, IsDiscard<O>, IsResult<O>>
387
407
  : [Arg] extends [Iterable<EffectAny>] ? ReturnIterable<Arg, IsDiscard<O>, IsResult<O>>
388
- : [Arg] extends [Record<string, EffectAny>] ? ReturnObject<Arg, IsDiscard<O>, IsResult<O>>
408
+ : [Arg] extends [Record<PropertyKey, EffectAny>] ? ReturnObject<Arg, IsDiscard<O>, IsResult<O>>
389
409
  : never
390
410
 
391
411
  type ObjectValues<T> = T extends unknown ? T[keyof T] : never
@@ -406,6 +426,8 @@ export declare namespace All {
406
426
  * results under the same keys. By default, the combined effect fails on the
407
427
  * first failure; with concurrent execution, effects that have already started
408
428
  * may be interrupted, while effects not yet started are skipped.
429
+ * Record inputs use own enumerable string and symbol properties.
430
+ * Non-enumerable and inherited properties are ignored.
409
431
  *
410
432
  * Options:
411
433
  *
@@ -414,6 +436,18 @@ export declare namespace All {
414
436
  * `Result` in the same output shape. Use `discard: true` to ignore successful
415
437
  * values and return `void`.
416
438
  *
439
+ * With concurrent execution, a failure requests interruption of other effects
440
+ * that have already started. The returned effect waits for those fibers to finish,
441
+ * including their finalizers. Uninterruptible regions can delay completion.
442
+ * This fail-fast behavior does not apply to `mode: "result"`. Concurrent
443
+ * effects inherit the surrounding region's interruptibility.
444
+ *
445
+ * **Gotchas**
446
+ *
447
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
448
+ * can keep running unless the operation honors cancellation. Fibers started
449
+ * with `forkDetach` are not awaited.
450
+ *
417
451
  * **Example** (Collecting tuple results in order)
418
452
  *
419
453
  * ```ts import.meta.vitest
@@ -507,7 +541,7 @@ export declare namespace All {
507
541
  export const all: <
508
542
  const Arg extends
509
543
  | Iterable<Effect<any, any, any>>
510
- | Record<string, Effect<any, any, any>>,
544
+ | Record<PropertyKey, Effect<any, any, any>>,
511
545
  O extends {
512
546
  readonly concurrency?: Concurrency | undefined
513
547
  readonly discard?: boolean | undefined
@@ -1064,8 +1098,8 @@ export const findFirstFilter: {
1064
1098
  * The `forEach` function applies a provided operation to each element in the
1065
1099
  * iterable, producing a new effect that returns an array of results.
1066
1100
  *
1067
- * If any effect fails, the iteration stops immediately (short-circuiting), and
1068
- * the error is propagated.
1101
+ * If any effect fails, the iteration short-circuits and propagates the error
1102
+ * after cleanup.
1069
1103
  *
1070
1104
  * Concurrency:
1071
1105
  *
@@ -1077,6 +1111,17 @@ export const findFirstFilter: {
1077
1111
  * If the `discard` option is set to `true`, the intermediate results are not
1078
1112
  * collected, and the final result of the operation is `void`.
1079
1113
  *
1114
+ * With concurrent execution, a failure requests interruption of other effects
1115
+ * that have already started. The returned effect waits for those fibers to finish,
1116
+ * including their finalizers. Uninterruptible regions can delay completion.
1117
+ * Concurrent effects inherit the surrounding region's interruptibility.
1118
+ *
1119
+ * **Gotchas**
1120
+ *
1121
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
1122
+ * can keep running unless the operation honors cancellation. Fibers started
1123
+ * with `forkDetach` are not awaited.
1124
+ *
1080
1125
  * **Example** (Mapping over an iterable with effects)
1081
1126
  *
1082
1127
  * ```ts import.meta.vitest
@@ -1130,8 +1175,8 @@ export const forEach: {
1130
1175
  * The `forEach` function applies a provided operation to each element in the
1131
1176
  * iterable, producing a new effect that returns an array of results.
1132
1177
  *
1133
- * If any effect fails, the iteration stops immediately (short-circuiting), and
1134
- * the error is propagated.
1178
+ * If any effect fails, the iteration short-circuits and propagates the error
1179
+ * after cleanup.
1135
1180
  *
1136
1181
  * Concurrency:
1137
1182
  *
@@ -1143,6 +1188,17 @@ export const forEach: {
1143
1188
  * If the `discard` option is set to `true`, the intermediate results are not
1144
1189
  * collected, and the final result of the operation is `void`.
1145
1190
  *
1191
+ * With concurrent execution, a failure requests interruption of other effects
1192
+ * that have already started. The returned effect waits for those fibers to finish,
1193
+ * including their finalizers. Uninterruptible regions can delay completion.
1194
+ * Concurrent effects inherit the surrounding region's interruptibility.
1195
+ *
1196
+ * **Gotchas**
1197
+ *
1198
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
1199
+ * can keep running unless the operation honors cancellation. Fibers started
1200
+ * with `forkDetach` are not awaited.
1201
+ *
1146
1202
  * **Example** (Mapping over an iterable with effects)
1147
1203
  *
1148
1204
  * ```ts import.meta.vitest
@@ -1201,8 +1257,8 @@ export const forEach: {
1201
1257
  * The `forEach` function applies a provided operation to each element in the
1202
1258
  * iterable, producing a new effect that returns an array of results.
1203
1259
  *
1204
- * If any effect fails, the iteration stops immediately (short-circuiting), and
1205
- * the error is propagated.
1260
+ * If any effect fails, the iteration short-circuits and propagates the error
1261
+ * after cleanup.
1206
1262
  *
1207
1263
  * Concurrency:
1208
1264
  *
@@ -1214,6 +1270,17 @@ export const forEach: {
1214
1270
  * If the `discard` option is set to `true`, the intermediate results are not
1215
1271
  * collected, and the final result of the operation is `void`.
1216
1272
  *
1273
+ * With concurrent execution, a failure requests interruption of other effects
1274
+ * that have already started. The returned effect waits for those fibers to finish,
1275
+ * including their finalizers. Uninterruptible regions can delay completion.
1276
+ * Concurrent effects inherit the surrounding region's interruptibility.
1277
+ *
1278
+ * **Gotchas**
1279
+ *
1280
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
1281
+ * can keep running unless the operation honors cancellation. Fibers started
1282
+ * with `forkDetach` are not awaited.
1283
+ *
1217
1284
  * **Example** (Mapping over an iterable with effects)
1218
1285
  *
1219
1286
  * ```ts import.meta.vitest
@@ -1703,6 +1770,11 @@ export const succeedSome: <A>(value: A) => Effect<Option<A>> = internal.succeedS
1703
1770
  * different effects. Any side effects or scoped captures inside the thunk are
1704
1771
  * re-executed on each invocation.
1705
1772
  *
1773
+ * **Gotchas**
1774
+ *
1775
+ * If the thunk throws, the thrown value is treated as a defect, not as a typed
1776
+ * failure. Use `Effect.try` when a throw should become a typed failure.
1777
+ *
1706
1778
  * **Example** (Lazily evaluating side effects)
1707
1779
  *
1708
1780
  * ```ts import.meta.vitest
@@ -3886,9 +3958,8 @@ export const option: <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, never
3886
3958
  * `exit` wraps an effect's success or failure inside an `Exit` type, allowing
3887
3959
  * you to handle both cases explicitly.
3888
3960
  *
3889
- * The resulting effect cannot fail because the failure is encapsulated within
3890
- * the `Exit.Failure` type. The error type is set to `never`, indicating that
3891
- * the effect is structured to never fail directly.
3961
+ * If the running fiber is interrupted in an interruptible region, `exit`
3962
+ * does not turn that interruption into an `Exit` value.
3892
3963
  *
3893
3964
  * **Example** (Capturing completion as Exit)
3894
3965
  *
@@ -3906,6 +3977,7 @@ export const option: <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, never
3906
3977
  * Effect.runSync(program2) // => Exit.fail("Something went wrong")
3907
3978
  * ```
3908
3979
  *
3980
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
3909
3981
  * @see {@link option} for a version that uses `Option` instead.
3910
3982
  * @see {@link result} for a version that uses `Result` instead.
3911
3983
  *
@@ -4834,12 +4906,13 @@ export const catchTag: {
4834
4906
  */
4835
4907
  <
4836
4908
  A,
4837
- E,
4838
- R,
4839
- const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>>,
4840
- R1,
4841
- E1,
4842
- A1,
4909
+ // Default `E` to `any` so `K` is not rejected while TS defers an inline `self` (e.g. `Effect.map(...)`)
4910
+ E = any,
4911
+ R = unknown,
4912
+ const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>> = never,
4913
+ R1 = unknown,
4914
+ E1 = unknown,
4915
+ A1 = unknown,
4843
4916
  A2 = unassigned,
4844
4917
  E2 = never,
4845
4918
  R2 = never
@@ -5311,6 +5384,22 @@ export const catchReason: {
5311
5384
  >
5312
5385
  } = internal.catchReason
5313
5386
 
5387
+ type RequiredCaseKeys<Cases> = {
5388
+ [RK in keyof Cases & string]: {} extends Record<RK, 1> ? never
5389
+ : [Cases] extends [Record<RK, (...args: Array<any>) => any>] ? RK
5390
+ : never
5391
+ }[keyof Cases & string]
5392
+
5393
+ type CaseReturn<Cases> = Cases extends unknown ? ReturnType<Extract<Cases[keyof Cases], (...args: Array<any>) => any>>
5394
+ : never
5395
+
5396
+ type UnhandledParent<E, K extends string, Handled extends string> = {} extends Record<K, 1> ? ExtractTag<E, K>
5397
+ : IsUnion<K> extends true ? ExtractTag<E, K>
5398
+ : ExtractTag<E, K> extends infer P
5399
+ ? P extends { readonly reason: { readonly _tag: string } } ? [ExcludeReason<P, Handled>] extends [never] ? never : P
5400
+ : P
5401
+ : never
5402
+
5314
5403
  /**
5315
5404
  * Catches multiple reasons within a tagged error using an object of handlers.
5316
5405
  *
@@ -5320,6 +5409,8 @@ export const catchReason: {
5320
5409
  * is converted to a defect, preserving reason order and interrupts. An
5321
5410
  * interruption alongside a typed error does not prevent recovery.
5322
5411
  *
5412
+ * Only own enumerable properties of `cases` are matched; inherited properties are ignored.
5413
+ *
5323
5414
  * **Example** (Handling multiple error reasons)
5324
5415
  *
5325
5416
  * ```ts import.meta.vitest
@@ -5367,6 +5458,8 @@ export const catchReasons: {
5367
5458
  * is converted to a defect, preserving reason order and interrupts. An
5368
5459
  * interruption alongside a typed error does not prevent recovery.
5369
5460
  *
5461
+ * Only own enumerable properties of `cases` are matched; inherited properties are ignored.
5462
+ *
5370
5463
  * **Example** (Handling multiple error reasons)
5371
5464
  *
5372
5465
  * ```ts import.meta.vitest
@@ -5413,37 +5506,105 @@ export const catchReasons: {
5413
5506
  error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
5414
5507
  ) => Effect<any, any, any>
5415
5508
  },
5416
- A2 = unassigned,
5509
+ // `A2`, `E2` and `R2` are only for calls that pass explicit type arguments.
5510
+ A2 = never,
5417
5511
  E2 = never,
5418
- R2 = never
5512
+ R2 = never,
5513
+ Ret extends Effect<any, any, any> = Effect<A2, E2, R2>
5514
+ >(
5515
+ errorTag: K,
5516
+ cases: Cases,
5517
+ orElse: (
5518
+ reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>,
5519
+ error: OmitReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>
5520
+ ) => Ret
5521
+ ): <A, R>(
5522
+ self: Effect<A, E, R>
5523
+ ) => Effect<
5524
+ A | Success<Ret | CaseReturn<Cases>>,
5525
+ | ExcludeTag<E, K>
5526
+ | UnhandledParent<E, K, string>
5527
+ | Error<Ret | CaseReturn<Cases>>,
5528
+ R | Services<Ret | CaseReturn<Cases>>
5529
+ >
5530
+ /**
5531
+ * Catches multiple reasons within a tagged error using an object of handlers.
5532
+ *
5533
+ * **Gotchas**
5534
+ *
5535
+ * If the cause contains a defect, the handler is skipped and every typed error
5536
+ * is converted to a defect, preserving reason order and interrupts. An
5537
+ * interruption alongside a typed error does not prevent recovery.
5538
+ *
5539
+ * Only own enumerable properties of `cases` are matched; inherited properties are ignored.
5540
+ *
5541
+ * **Example** (Handling multiple error reasons)
5542
+ *
5543
+ * ```ts import.meta.vitest
5544
+ * import { Data, Effect } from "effect"
5545
+ *
5546
+ * class RateLimitError extends Data.TaggedError("RateLimitError")<{
5547
+ * retryAfter: number
5548
+ * }> {}
5549
+ *
5550
+ * class QuotaExceededError extends Data.TaggedError("QuotaExceededError")<{
5551
+ * limit: number
5552
+ * }> {}
5553
+ *
5554
+ * class AiError extends Data.TaggedError("AiError")<{
5555
+ * reason: RateLimitError | QuotaExceededError
5556
+ * }> {}
5557
+ *
5558
+ * const program: Effect.Effect<string, AiError> = Effect.fail(
5559
+ * new AiError({ reason: new QuotaExceededError({ limit: 100 }) })
5560
+ * )
5561
+ *
5562
+ * const handled = program.pipe(
5563
+ * Effect.catchReasons("AiError", {
5564
+ * RateLimitError: (reason) =>
5565
+ * Effect.succeed(`Retry after ${reason.retryAfter}s`),
5566
+ * QuotaExceededError: (reason) =>
5567
+ * Effect.succeed(`Quota exceeded: ${reason.limit}`)
5568
+ * })
5569
+ * )
5570
+ *
5571
+ * Effect.runSync(handled) // => "Quota exceeded: 100"
5572
+ * ```
5573
+ *
5574
+ * @stability stable
5575
+ * @category error handling
5576
+ * @since 4.0.0
5577
+ */
5578
+ <
5579
+ K extends Tags<E>,
5580
+ E,
5581
+ Cases extends {
5582
+ [RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (
5583
+ reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>,
5584
+ error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
5585
+ ) => Effect<any, any, any>
5586
+ },
5587
+ A2 = never,
5588
+ E2 = never,
5589
+ R2 = never,
5590
+ Ret extends Effect<any, any, any> = Effect<A2, E2, R2>
5419
5591
  >(
5420
5592
  errorTag: K,
5421
5593
  cases: Cases,
5422
5594
  orElse?:
5423
5595
  | ((
5424
- reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>,
5425
- error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>
5426
- ) => Effect<A2, E2, R2>)
5596
+ reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>,
5597
+ error: OmitReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>
5598
+ ) => Ret)
5427
5599
  | undefined
5428
5600
  ): <A, R>(
5429
5601
  self: Effect<A, E, R>
5430
5602
  ) => Effect<
5431
- | A
5432
- | Exclude<A2, unassigned>
5433
- | {
5434
- [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never
5435
- }[keyof Cases],
5603
+ A | Success<Ret | CaseReturn<Cases>>,
5436
5604
  | ExcludeTag<E, K>
5437
- | E2
5438
- | (A2 extends unassigned ? ExtractTag<E, K> : never)
5439
- | {
5440
- [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never
5441
- }[keyof Cases],
5442
- | R
5443
- | R2
5444
- | {
5445
- [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, any, infer R> ? R : never
5446
- }[keyof Cases]
5605
+ | UnhandledParent<E, K, RequiredCaseKeys<Cases>>
5606
+ | Error<Ret | CaseReturn<Cases>>,
5607
+ R | Services<Ret | CaseReturn<Cases>>
5447
5608
  >
5448
5609
  /**
5449
5610
  * Catches multiple reasons within a tagged error using an object of handlers.
@@ -5454,6 +5615,8 @@ export const catchReasons: {
5454
5615
  * is converted to a defect, preserving reason order and interrupts. An
5455
5616
  * interruption alongside a typed error does not prevent recovery.
5456
5617
  *
5618
+ * Only own enumerable properties of `cases` are matched; inherited properties are ignored.
5619
+ *
5457
5620
  * **Example** (Handling multiple error reasons)
5458
5621
  *
5459
5622
  * ```ts import.meta.vitest
@@ -5502,36 +5665,104 @@ export const catchReasons: {
5502
5665
  error: NarrowReason<ExtractTag<E, K>, RK>
5503
5666
  ) => Effect<any, any, any>
5504
5667
  },
5505
- A2 = unassigned,
5668
+ A2 = never,
5506
5669
  E2 = never,
5507
- R2 = never
5670
+ R2 = never,
5671
+ Ret extends Effect<any, any, any> = Effect<A2, E2, R2>
5672
+ >(
5673
+ self: Effect<A, E, R>,
5674
+ errorTag: K,
5675
+ cases: Cases,
5676
+ orElse: (
5677
+ reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>,
5678
+ error: OmitReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>
5679
+ ) => Ret
5680
+ ): Effect<
5681
+ A | Success<Ret | CaseReturn<Cases>>,
5682
+ | ExcludeTag<E, K>
5683
+ | UnhandledParent<E, K, string>
5684
+ | Error<Ret | CaseReturn<Cases>>,
5685
+ R | Services<Ret | CaseReturn<Cases>>
5686
+ >
5687
+ /**
5688
+ * Catches multiple reasons within a tagged error using an object of handlers.
5689
+ *
5690
+ * **Gotchas**
5691
+ *
5692
+ * If the cause contains a defect, the handler is skipped and every typed error
5693
+ * is converted to a defect, preserving reason order and interrupts. An
5694
+ * interruption alongside a typed error does not prevent recovery.
5695
+ *
5696
+ * Only own enumerable properties of `cases` are matched; inherited properties are ignored.
5697
+ *
5698
+ * **Example** (Handling multiple error reasons)
5699
+ *
5700
+ * ```ts import.meta.vitest
5701
+ * import { Data, Effect } from "effect"
5702
+ *
5703
+ * class RateLimitError extends Data.TaggedError("RateLimitError")<{
5704
+ * retryAfter: number
5705
+ * }> {}
5706
+ *
5707
+ * class QuotaExceededError extends Data.TaggedError("QuotaExceededError")<{
5708
+ * limit: number
5709
+ * }> {}
5710
+ *
5711
+ * class AiError extends Data.TaggedError("AiError")<{
5712
+ * reason: RateLimitError | QuotaExceededError
5713
+ * }> {}
5714
+ *
5715
+ * const program: Effect.Effect<string, AiError> = Effect.fail(
5716
+ * new AiError({ reason: new QuotaExceededError({ limit: 100 }) })
5717
+ * )
5718
+ *
5719
+ * const handled = program.pipe(
5720
+ * Effect.catchReasons("AiError", {
5721
+ * RateLimitError: (reason) =>
5722
+ * Effect.succeed(`Retry after ${reason.retryAfter}s`),
5723
+ * QuotaExceededError: (reason) =>
5724
+ * Effect.succeed(`Quota exceeded: ${reason.limit}`)
5725
+ * })
5726
+ * )
5727
+ *
5728
+ * Effect.runSync(handled) // => "Quota exceeded: 100"
5729
+ * ```
5730
+ *
5731
+ * @stability stable
5732
+ * @category error handling
5733
+ * @since 4.0.0
5734
+ */
5735
+ <
5736
+ A,
5737
+ E,
5738
+ R,
5739
+ K extends Tags<E>,
5740
+ Cases extends {
5741
+ [RK in ReasonTags<ExtractTag<E, K>>]+?: (
5742
+ reason: ExtractReason<ExtractTag<E, K>, RK>,
5743
+ error: NarrowReason<ExtractTag<E, K>, RK>
5744
+ ) => Effect<any, any, any>
5745
+ },
5746
+ A2 = never,
5747
+ E2 = never,
5748
+ R2 = never,
5749
+ Ret extends Effect<any, any, any> = Effect<A2, E2, R2>
5508
5750
  >(
5509
5751
  self: Effect<A, E, R>,
5510
5752
  errorTag: K,
5511
5753
  cases: Cases,
5512
5754
  orElse?:
5513
5755
  | ((
5514
- reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>,
5515
- error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>
5516
- ) => Effect<A2, E2, R2>)
5756
+ reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>,
5757
+ error: OmitReason<ExtractTag<NoInfer<E>, K>, RequiredCaseKeys<Cases>>
5758
+ ) => Ret)
5517
5759
  | undefined
5518
5760
  ): Effect<
5519
- | A
5520
- | Exclude<A2, unassigned>
5521
- | {
5522
- [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never
5523
- }[keyof Cases],
5761
+ A | Success<Ret | CaseReturn<Cases>>,
5524
5762
  | ExcludeTag<E, K>
5525
- | E2
5526
- | (A2 extends unassigned ? ExtractTag<E, K> : never)
5527
- | {
5528
- [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never
5529
- }[keyof Cases],
5530
- | R
5531
- | R2
5532
- | {
5533
- [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, any, infer R> ? R : never
5534
- }[keyof Cases]
5763
+ | UnhandledParent<E, K, RequiredCaseKeys<Cases>>
5764
+ | Error<Ret | CaseReturn<Cases>>,
5765
+ R | Services<Ret | CaseReturn<Cases>>
5535
5766
  >
5536
5767
  } = internal.catchReasons
5537
5768
 
@@ -5679,8 +5910,7 @@ export const unwrapReason: {
5679
5910
  } = internal.unwrapReason
5680
5911
 
5681
5912
  /**
5682
- * Handles both recoverable and unrecoverable errors by providing a recovery
5683
- * effect.
5913
+ * Runs a recovery effect with the full cause of failure.
5684
5914
  *
5685
5915
  * **When to use**
5686
5916
  *
@@ -5690,7 +5920,15 @@ export const unwrapReason: {
5690
5920
  *
5691
5921
  * **Details**
5692
5922
  *
5693
- * When to Recover from Defects:
5923
+ * The handler can recover from an interruption in the cause, such as one from
5924
+ * `Effect.interrupt` or from joining an interrupted fiber.
5925
+ *
5926
+ * Interruption of the fiber running `catchCause` is different. In an
5927
+ * interruptible region, the handler is skipped and the fiber runs its cleanup
5928
+ * before exiting. A handler in an uninterruptible region can handle an
5929
+ * interruption delivered in an inner interruptible region. A pending request
5930
+ * alone neither invokes that handler nor adds an interruption to an unrelated
5931
+ * failure while the fiber remains uninterruptible.
5694
5932
  *
5695
5933
  * Defects are unexpected errors that typically shouldn't be recovered from, as
5696
5934
  * they often indicate serious issues. However, in some cases, such as
@@ -5725,8 +5963,7 @@ export const unwrapReason: {
5725
5963
  */
5726
5964
  export const catchCause: {
5727
5965
  /**
5728
- * Handles both recoverable and unrecoverable errors by providing a recovery
5729
- * effect.
5966
+ * Runs a recovery effect with the full cause of failure.
5730
5967
  *
5731
5968
  * **When to use**
5732
5969
  *
@@ -5736,7 +5973,15 @@ export const catchCause: {
5736
5973
  *
5737
5974
  * **Details**
5738
5975
  *
5739
- * When to Recover from Defects:
5976
+ * The handler can recover from an interruption in the cause, such as one from
5977
+ * `Effect.interrupt` or from joining an interrupted fiber.
5978
+ *
5979
+ * Interruption of the fiber running `catchCause` is different. In an
5980
+ * interruptible region, the handler is skipped and the fiber runs its cleanup
5981
+ * before exiting. A handler in an uninterruptible region can handle an
5982
+ * interruption delivered in an inner interruptible region. A pending request
5983
+ * alone neither invokes that handler nor adds an interruption to an unrelated
5984
+ * failure while the fiber remains uninterruptible.
5740
5985
  *
5741
5986
  * Defects are unexpected errors that typically shouldn't be recovered from, as
5742
5987
  * they often indicate serious issues. However, in some cases, such as
@@ -5771,8 +6016,7 @@ export const catchCause: {
5771
6016
  */
5772
6017
  <E, A2, E2, R2>(f: (cause: Cause.Cause<E>) => Effect<A2, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A2 | A, E2, R2 | R>
5773
6018
  /**
5774
- * Handles both recoverable and unrecoverable errors by providing a recovery
5775
- * effect.
6019
+ * Runs a recovery effect with the full cause of failure.
5776
6020
  *
5777
6021
  * **When to use**
5778
6022
  *
@@ -5782,7 +6026,15 @@ export const catchCause: {
5782
6026
  *
5783
6027
  * **Details**
5784
6028
  *
5785
- * When to Recover from Defects:
6029
+ * The handler can recover from an interruption in the cause, such as one from
6030
+ * `Effect.interrupt` or from joining an interrupted fiber.
6031
+ *
6032
+ * Interruption of the fiber running `catchCause` is different. In an
6033
+ * interruptible region, the handler is skipped and the fiber runs its cleanup
6034
+ * before exiting. A handler in an uninterruptible region can handle an
6035
+ * interruption delivered in an inner interruptible region. A pending request
6036
+ * alone neither invokes that handler nor adds an interruption to an unrelated
6037
+ * failure while the fiber remains uninterruptible.
5786
6038
  *
5787
6039
  * Defects are unexpected errors that typically shouldn't be recovered from, as
5788
6040
  * they often indicate serious issues. However, in some cases, such as
@@ -6418,6 +6670,9 @@ export const catchNoSuchElement: <A, E, R>(
6418
6670
  * that match a specific predicate. This is useful when you want to handle
6419
6671
  * only certain types of errors while letting others propagate.
6420
6672
  *
6673
+ * The failure handler is skipped if the running fiber is interrupted in an
6674
+ * interruptible region.
6675
+ *
6421
6676
  * **Example** (Recovering from selected causes)
6422
6677
  *
6423
6678
  * ```ts import.meta.vitest
@@ -6463,6 +6718,9 @@ export const catchCauseIf: {
6463
6718
  * that match a specific predicate. This is useful when you want to handle
6464
6719
  * only certain types of errors while letting others propagate.
6465
6720
  *
6721
+ * The failure handler is skipped if the running fiber is interrupted in an
6722
+ * interruptible region.
6723
+ *
6466
6724
  * **Example** (Recovering from selected causes)
6467
6725
  *
6468
6726
  * ```ts import.meta.vitest
@@ -6511,6 +6769,9 @@ export const catchCauseIf: {
6511
6769
  * that match a specific predicate. This is useful when you want to handle
6512
6770
  * only certain types of errors while letting others propagate.
6513
6771
  *
6772
+ * The failure handler is skipped if the running fiber is interrupted in an
6773
+ * interruptible region.
6774
+ *
6514
6775
  * **Example** (Recovering from selected causes)
6515
6776
  *
6516
6777
  * ```ts import.meta.vitest
@@ -6564,6 +6825,9 @@ export const catchCauseIf: {
6564
6825
  * receives the selected value and the original cause. When it fails, the effect
6565
6826
  * re-fails with the residual cause returned by the filter.
6566
6827
  *
6828
+ * The failure handler is skipped if the running fiber is interrupted in an
6829
+ * interruptible region.
6830
+ *
6567
6831
  * @see {@link catchCauseIf} for predicate-based cause selection
6568
6832
  * @see {@link catchFilter} for filtering typed error values instead of full causes
6569
6833
  * @see {@link catchCause} for recovering from every cause without filtering
@@ -6588,6 +6852,9 @@ export const catchCauseFilter: {
6588
6852
  * receives the selected value and the original cause. When it fails, the effect
6589
6853
  * re-fails with the residual cause returned by the filter.
6590
6854
  *
6855
+ * The failure handler is skipped if the running fiber is interrupted in an
6856
+ * interruptible region.
6857
+ *
6591
6858
  * @see {@link catchCauseIf} for predicate-based cause selection
6592
6859
  * @see {@link catchFilter} for filtering typed error values instead of full causes
6593
6860
  * @see {@link catchCause} for recovering from every cause without filtering
@@ -6615,6 +6882,9 @@ export const catchCauseFilter: {
6615
6882
  * receives the selected value and the original cause. When it fails, the effect
6616
6883
  * re-fails with the residual cause returned by the filter.
6617
6884
  *
6885
+ * The failure handler is skipped if the running fiber is interrupted in an
6886
+ * interruptible region.
6887
+ *
6618
6888
  * @see {@link catchCauseIf} for predicate-based cause selection
6619
6889
  * @see {@link catchFilter} for filtering typed error values instead of full causes
6620
6890
  * @see {@link catchCause} for recovering from every cause without filtering
@@ -7196,6 +7466,9 @@ export const tapErrorTag: {
7196
7466
  * the operation succeeds, the original cause is preserved. If the operation
7197
7467
  * fails, its error is also represented in the returned effect.
7198
7468
  *
7469
+ * The observer is skipped if the running fiber is interrupted in an
7470
+ * interruptible region.
7471
+ *
7199
7472
  * **Example** (Observing full failure causes)
7200
7473
  *
7201
7474
  * ```ts import.meta.vitest
@@ -7213,6 +7486,8 @@ export const tapErrorTag: {
7213
7486
  * output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
7214
7487
  * ```
7215
7488
  *
7489
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7490
+ *
7216
7491
  * @stability stable
7217
7492
  * @category error handling
7218
7493
  * @since 4.0.0
@@ -7233,6 +7508,9 @@ export const tapCause: {
7233
7508
  * the operation succeeds, the original cause is preserved. If the operation
7234
7509
  * fails, its error is also represented in the returned effect.
7235
7510
  *
7511
+ * The observer is skipped if the running fiber is interrupted in an
7512
+ * interruptible region.
7513
+ *
7236
7514
  * **Example** (Observing full failure causes)
7237
7515
  *
7238
7516
  * ```ts import.meta.vitest
@@ -7250,6 +7528,8 @@ export const tapCause: {
7250
7528
  * output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
7251
7529
  * ```
7252
7530
  *
7531
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7532
+ *
7253
7533
  * @stability stable
7254
7534
  * @category error handling
7255
7535
  * @since 4.0.0
@@ -7270,6 +7550,9 @@ export const tapCause: {
7270
7550
  * the operation succeeds, the original cause is preserved. If the operation
7271
7551
  * fails, its error is also represented in the returned effect.
7272
7552
  *
7553
+ * The observer is skipped if the running fiber is interrupted in an
7554
+ * interruptible region.
7555
+ *
7273
7556
  * **Example** (Observing full failure causes)
7274
7557
  *
7275
7558
  * ```ts import.meta.vitest
@@ -7287,6 +7570,8 @@ export const tapCause: {
7287
7570
  * output // => ["Logging cause: Something went wrong", Exit.fail("Something went wrong")]
7288
7571
  * ```
7289
7572
  *
7573
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7574
+ *
7290
7575
  * @stability stable
7291
7576
  * @category error handling
7292
7577
  * @since 4.0.0
@@ -7303,6 +7588,9 @@ export const tapCause: {
7303
7588
  * the cause matches a specific predicate. This is useful for conditional logging,
7304
7589
  * monitoring, or other side effects based on the type of failure.
7305
7590
  *
7591
+ * The observer is skipped if the running fiber is interrupted in an
7592
+ * interruptible region.
7593
+ *
7306
7594
  * **Example** (Observing selected failure causes)
7307
7595
  *
7308
7596
  * ```ts import.meta.vitest
@@ -7322,6 +7610,8 @@ export const tapCause: {
7322
7610
  * output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
7323
7611
  * ```
7324
7612
  *
7613
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7614
+ *
7325
7615
  * @stability stable
7326
7616
  * @category error handling
7327
7617
  * @since 4.0.0
@@ -7336,6 +7626,9 @@ export const tapCauseIf: {
7336
7626
  * the cause matches a specific predicate. This is useful for conditional logging,
7337
7627
  * monitoring, or other side effects based on the type of failure.
7338
7628
  *
7629
+ * The observer is skipped if the running fiber is interrupted in an
7630
+ * interruptible region.
7631
+ *
7339
7632
  * **Example** (Observing selected failure causes)
7340
7633
  *
7341
7634
  * ```ts import.meta.vitest
@@ -7355,6 +7648,8 @@ export const tapCauseIf: {
7355
7648
  * output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
7356
7649
  * ```
7357
7650
  *
7651
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7652
+ *
7358
7653
  * @stability stable
7359
7654
  * @category error handling
7360
7655
  * @since 4.0.0
@@ -7372,6 +7667,9 @@ export const tapCauseIf: {
7372
7667
  * the cause matches a specific predicate. This is useful for conditional logging,
7373
7668
  * monitoring, or other side effects based on the type of failure.
7374
7669
  *
7670
+ * The observer is skipped if the running fiber is interrupted in an
7671
+ * interruptible region.
7672
+ *
7375
7673
  * **Example** (Observing selected failure causes)
7376
7674
  *
7377
7675
  * ```ts import.meta.vitest
@@ -7391,6 +7689,8 @@ export const tapCauseIf: {
7391
7689
  * output // => ["Logging failure cause: Network timeout", Exit.fail("Network timeout")]
7392
7690
  * ```
7393
7691
  *
7692
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7693
+ *
7394
7694
  * @stability stable
7395
7695
  * @category error handling
7396
7696
  * @since 4.0.0
@@ -7417,6 +7717,10 @@ export const tapCauseIf: {
7417
7717
  * original cause. A failed filter result skips the side effect and preserves the
7418
7718
  * original cause.
7419
7719
  *
7720
+ * The observer is skipped if the running fiber is interrupted in an
7721
+ * interruptible region.
7722
+ *
7723
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7420
7724
  * @see {@link tapCauseIf} for selecting causes with a boolean predicate
7421
7725
  * @see {@link tapCause} for observing every failure cause
7422
7726
  * @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
@@ -7441,6 +7745,10 @@ export const tapCauseFilter: {
7441
7745
  * original cause. A failed filter result skips the side effect and preserves the
7442
7746
  * original cause.
7443
7747
  *
7748
+ * The observer is skipped if the running fiber is interrupted in an
7749
+ * interruptible region.
7750
+ *
7751
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7444
7752
  * @see {@link tapCauseIf} for selecting causes with a boolean predicate
7445
7753
  * @see {@link tapCause} for observing every failure cause
7446
7754
  * @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
@@ -7468,6 +7776,10 @@ export const tapCauseFilter: {
7468
7776
  * original cause. A failed filter result skips the side effect and preserves the
7469
7777
  * original cause.
7470
7778
  *
7779
+ * The observer is skipped if the running fiber is interrupted in an
7780
+ * interruptible region.
7781
+ *
7782
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
7471
7783
  * @see {@link tapCauseIf} for selecting causes with a boolean predicate
7472
7784
  * @see {@link tapCause} for observing every failure cause
7473
7785
  * @see {@link catchCauseFilter} for recovering from selected causes instead of only observing them
@@ -7699,6 +8011,8 @@ export declare namespace Retry {
7699
8011
  * succeeds, the returned effect succeeds with that value. If the policy stops
7700
8012
  * while the effect is still failing, the last failure is propagated.
7701
8013
  *
8014
+ * Scheduled delays use the context's `Clock`.
8015
+ *
7702
8016
  * **Gotchas**
7703
8017
  *
7704
8018
  * The source effect is always evaluated once before any retry policy is
@@ -7754,6 +8068,8 @@ export const retry: {
7754
8068
  * succeeds, the returned effect succeeds with that value. If the policy stops
7755
8069
  * while the effect is still failing, the last failure is propagated.
7756
8070
  *
8071
+ * Scheduled delays use the context's `Clock`.
8072
+ *
7757
8073
  * **Gotchas**
7758
8074
  *
7759
8075
  * The source effect is always evaluated once before any retry policy is
@@ -7809,6 +8125,8 @@ export const retry: {
7809
8125
  * succeeds, the returned effect succeeds with that value. If the policy stops
7810
8126
  * while the effect is still failing, the last failure is propagated.
7811
8127
  *
8128
+ * Scheduled delays use the context's `Clock`.
8129
+ *
7812
8130
  * **Gotchas**
7813
8131
  *
7814
8132
  * The source effect is always evaluated once before any retry policy is
@@ -7864,6 +8182,8 @@ export const retry: {
7864
8182
  * succeeds, the returned effect succeeds with that value. If the policy stops
7865
8183
  * while the effect is still failing, the last failure is propagated.
7866
8184
  *
8185
+ * Scheduled delays use the context's `Clock`.
8186
+ *
7867
8187
  * **Gotchas**
7868
8188
  *
7869
8189
  * The source effect is always evaluated once before any retry policy is
@@ -7923,6 +8243,8 @@ export const retry: {
7923
8243
  * succeeds, the returned effect succeeds with that value. If the policy stops
7924
8244
  * while the effect is still failing, the last failure is propagated.
7925
8245
  *
8246
+ * Scheduled delays use the context's `Clock`.
8247
+ *
7926
8248
  * **Gotchas**
7927
8249
  *
7928
8250
  * The source effect is always evaluated once before any retry policy is
@@ -7978,6 +8300,8 @@ export const retry: {
7978
8300
  * succeeds, the returned effect succeeds with that value. If the policy stops
7979
8301
  * while the effect is still failing, the last failure is propagated.
7980
8302
  *
8303
+ * Scheduled delays use the context's `Clock`.
8304
+ *
7981
8305
  * **Gotchas**
7982
8306
  *
7983
8307
  * The source effect is always evaluated once before any retry policy is
@@ -8033,6 +8357,8 @@ export const retry: {
8033
8357
  * succeeds, the returned effect succeeds with that value. If the policy stops
8034
8358
  * while the effect is still failing, the last failure is propagated.
8035
8359
  *
8360
+ * Scheduled delays use the context's `Clock`.
8361
+ *
8036
8362
  * **Gotchas**
8037
8363
  *
8038
8364
  * The source effect is always evaluated once before any retry policy is
@@ -8096,6 +8422,8 @@ export const retry: {
8096
8422
  * If the retries are exhausted and the effect still fails, it runs a fallback
8097
8423
  * effect instead.
8098
8424
  *
8425
+ * Scheduled delays use the context's `Clock`.
8426
+ *
8099
8427
  * **Gotchas**
8100
8428
  *
8101
8429
  * Defects take precedence over typed errors. A failure whose cause contains a
@@ -8159,6 +8487,8 @@ export const retryOrElse: {
8159
8487
  * If the retries are exhausted and the effect still fails, it runs a fallback
8160
8488
  * effect instead.
8161
8489
  *
8490
+ * Scheduled delays use the context's `Clock`.
8491
+ *
8162
8492
  * **Gotchas**
8163
8493
  *
8164
8494
  * Defects take precedence over typed errors. A failure whose cause contains a
@@ -8225,6 +8555,8 @@ export const retryOrElse: {
8225
8555
  * If the retries are exhausted and the effect still fails, it runs a fallback
8226
8556
  * effect instead.
8227
8557
  *
8558
+ * Scheduled delays use the context's `Clock`.
8559
+ *
8228
8560
  * **Gotchas**
8229
8561
  *
8230
8562
  * Defects take precedence over typed errors. A failure whose cause contains a
@@ -8287,6 +8619,9 @@ export const retryOrElse: {
8287
8619
  * failures, defects, and interruptions. Use `Effect.catch(Effect.failCause)` to
8288
8620
  * restore the original typed error channel after cause-level handling.
8289
8621
  *
8622
+ * Interrupting the running fiber in an interruptible region bypasses the
8623
+ * error channel.
8624
+ *
8290
8625
  * **Example** (Exposing failures as causes)
8291
8626
  *
8292
8627
  * ```ts import.meta.vitest
@@ -8303,6 +8638,8 @@ export const retryOrElse: {
8303
8638
  * Effect.runSync(program) // => "Caught cause: Something went wrong"
8304
8639
  * ```
8305
8640
  *
8641
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
8642
+ *
8306
8643
  * @stability stable
8307
8644
  * @category error handling
8308
8645
  * @since 2.0.0
@@ -8905,13 +9242,24 @@ export const firstSuccessOf: <Eff extends Effect<any, any, any>>(
8905
9242
  *
8906
9243
  * The `timeout` function allows you to specify a time limit for an
8907
9244
  * effect's execution. If the effect does not complete within the given time, a
8908
- * `TimeoutError` is raised. This can be useful for controlling how long your
8909
- * program waits for a task to finish, ensuring that it doesn't hang
8910
- * indefinitely if the task takes too long.
9245
+ * `TimeoutError` is raised after the source fiber finishes its cleanup.
9246
+ *
9247
+ * Any contender the timeout starts (source or timer) is initially
9248
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9249
+ * timer uses the context's `Clock`.
8911
9250
  *
8912
9251
  * **Gotchas**
8913
9252
  *
8914
- * If the timeout wins, the source effect is interrupted.
9253
+ * If the timeout wins, the source is interrupted and the returned effect waits
9254
+ * for the source fiber to finish, including its finalizers. The duration
9255
+ * determines when interruption is requested, not a deadline for completion.
9256
+ * If the source enters its own uninterruptible region, completion can be
9257
+ * delayed until that region finishes. The eventual source result is
9258
+ * discarded and the timeout failure is still returned.
9259
+ *
9260
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9261
+ * can keep running unless the operation honors cancellation. Fibers started
9262
+ * with `forkDetach` are not awaited.
8915
9263
  *
8916
9264
  * **Example** (Failing when work takes too long)
8917
9265
  *
@@ -8948,13 +9296,24 @@ export const timeout: {
8948
9296
  *
8949
9297
  * The `timeout` function allows you to specify a time limit for an
8950
9298
  * effect's execution. If the effect does not complete within the given time, a
8951
- * `TimeoutError` is raised. This can be useful for controlling how long your
8952
- * program waits for a task to finish, ensuring that it doesn't hang
8953
- * indefinitely if the task takes too long.
9299
+ * `TimeoutError` is raised after the source fiber finishes its cleanup.
9300
+ *
9301
+ * Any contender the timeout starts (source or timer) is initially
9302
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9303
+ * timer uses the context's `Clock`.
8954
9304
  *
8955
9305
  * **Gotchas**
8956
9306
  *
8957
- * If the timeout wins, the source effect is interrupted.
9307
+ * If the timeout wins, the source is interrupted and the returned effect waits
9308
+ * for the source fiber to finish, including its finalizers. The duration
9309
+ * determines when interruption is requested, not a deadline for completion.
9310
+ * If the source enters its own uninterruptible region, completion can be
9311
+ * delayed until that region finishes. The eventual source result is
9312
+ * discarded and the timeout failure is still returned.
9313
+ *
9314
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9315
+ * can keep running unless the operation honors cancellation. Fibers started
9316
+ * with `forkDetach` are not awaited.
8958
9317
  *
8959
9318
  * **Example** (Failing when work takes too long)
8960
9319
  *
@@ -8991,13 +9350,24 @@ export const timeout: {
8991
9350
  *
8992
9351
  * The `timeout` function allows you to specify a time limit for an
8993
9352
  * effect's execution. If the effect does not complete within the given time, a
8994
- * `TimeoutError` is raised. This can be useful for controlling how long your
8995
- * program waits for a task to finish, ensuring that it doesn't hang
8996
- * indefinitely if the task takes too long.
9353
+ * `TimeoutError` is raised after the source fiber finishes its cleanup.
9354
+ *
9355
+ * Any contender the timeout starts (source or timer) is initially
9356
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9357
+ * timer uses the context's `Clock`.
8997
9358
  *
8998
9359
  * **Gotchas**
8999
9360
  *
9000
- * If the timeout wins, the source effect is interrupted.
9361
+ * If the timeout wins, the source is interrupted and the returned effect waits
9362
+ * for the source fiber to finish, including its finalizers. The duration
9363
+ * determines when interruption is requested, not a deadline for completion.
9364
+ * If the source enters its own uninterruptible region, completion can be
9365
+ * delayed until that region finishes. The eventual source result is
9366
+ * discarded and the timeout failure is still returned.
9367
+ *
9368
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9369
+ * can keep running unless the operation honors cancellation. Fibers started
9370
+ * with `forkDetach` are not awaited.
9001
9371
  *
9002
9372
  * **Example** (Failing when work takes too long)
9003
9373
  *
@@ -9034,6 +9404,23 @@ export const timeout: {
9034
9404
  * interrupted and the returned effect succeeds with `Option.none`. If the
9035
9405
  * source effect fails before the timeout, that failure is preserved.
9036
9406
  *
9407
+ * Any contender the timeout starts (source or timer) is initially
9408
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9409
+ * timer uses the context's `Clock`.
9410
+ *
9411
+ * **Gotchas**
9412
+ *
9413
+ * If the timeout wins, the source is interrupted and the returned effect waits
9414
+ * for the source fiber to finish, including its finalizers. The duration
9415
+ * determines when interruption is requested, not a deadline for completion.
9416
+ * If the source enters its own uninterruptible region, completion can be
9417
+ * delayed until that region finishes. The eventual source result is
9418
+ * discarded and the timeout still produces `Option.none`.
9419
+ *
9420
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9421
+ * can keep running unless the operation honors cancellation. Fibers started
9422
+ * with `forkDetach` are not awaited.
9423
+ *
9037
9424
  * **Example** (Returning None on timeout)
9038
9425
  *
9039
9426
  * ```ts import.meta.vitest
@@ -9066,6 +9453,23 @@ export const timeoutOption: {
9066
9453
  * interrupted and the returned effect succeeds with `Option.none`. If the
9067
9454
  * source effect fails before the timeout, that failure is preserved.
9068
9455
  *
9456
+ * Any contender the timeout starts (source or timer) is initially
9457
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9458
+ * timer uses the context's `Clock`.
9459
+ *
9460
+ * **Gotchas**
9461
+ *
9462
+ * If the timeout wins, the source is interrupted and the returned effect waits
9463
+ * for the source fiber to finish, including its finalizers. The duration
9464
+ * determines when interruption is requested, not a deadline for completion.
9465
+ * If the source enters its own uninterruptible region, completion can be
9466
+ * delayed until that region finishes. The eventual source result is
9467
+ * discarded and the timeout still produces `Option.none`.
9468
+ *
9469
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9470
+ * can keep running unless the operation honors cancellation. Fibers started
9471
+ * with `forkDetach` are not awaited.
9472
+ *
9069
9473
  * **Example** (Returning None on timeout)
9070
9474
  *
9071
9475
  * ```ts import.meta.vitest
@@ -9098,6 +9502,23 @@ export const timeoutOption: {
9098
9502
  * interrupted and the returned effect succeeds with `Option.none`. If the
9099
9503
  * source effect fails before the timeout, that failure is preserved.
9100
9504
  *
9505
+ * Any contender the timeout starts (source or timer) is initially
9506
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9507
+ * timer uses the context's `Clock`.
9508
+ *
9509
+ * **Gotchas**
9510
+ *
9511
+ * If the timeout wins, the source is interrupted and the returned effect waits
9512
+ * for the source fiber to finish, including its finalizers. The duration
9513
+ * determines when interruption is requested, not a deadline for completion.
9514
+ * If the source enters its own uninterruptible region, completion can be
9515
+ * delayed until that region finishes. The eventual source result is
9516
+ * discarded and the timeout still produces `Option.none`.
9517
+ *
9518
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9519
+ * can keep running unless the operation honors cancellation. Fibers started
9520
+ * with `forkDetach` are not awaited.
9521
+ *
9101
9522
  * **Example** (Returning None on timeout)
9102
9523
  *
9103
9524
  * ```ts import.meta.vitest
@@ -9119,7 +9540,26 @@ export const timeoutOption: {
9119
9540
 
9120
9541
  /**
9121
9542
  * Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
9122
- * the source if the timeout is reached.
9543
+ * the source and waiting for its cleanup if the timeout is reached.
9544
+ *
9545
+ * **Details**
9546
+ *
9547
+ * Any contender the timeout starts (source or timer) is initially
9548
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9549
+ * timer uses the context's `Clock`.
9550
+ *
9551
+ * **Gotchas**
9552
+ *
9553
+ * If the timeout wins, the source is interrupted and the returned effect waits
9554
+ * for the source fiber to finish, including its finalizers. The duration
9555
+ * determines when interruption is requested, not a deadline for completion.
9556
+ * If the source enters its own uninterruptible region, completion can be
9557
+ * delayed until that region finishes. The eventual source result is
9558
+ * discarded and the timeout still selects `orElse`.
9559
+ *
9560
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9561
+ * can keep running unless the operation honors cancellation. Fibers started
9562
+ * with `forkDetach` are not awaited.
9123
9563
  *
9124
9564
  * **Example** (Falling back on timeout)
9125
9565
  *
@@ -9148,7 +9588,26 @@ export const timeoutOption: {
9148
9588
  export const timeoutOrElse: {
9149
9589
  /**
9150
9590
  * Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
9151
- * the source if the timeout is reached.
9591
+ * the source and waiting for its cleanup if the timeout is reached.
9592
+ *
9593
+ * **Details**
9594
+ *
9595
+ * Any contender the timeout starts (source or timer) is initially
9596
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9597
+ * timer uses the context's `Clock`.
9598
+ *
9599
+ * **Gotchas**
9600
+ *
9601
+ * If the timeout wins, the source is interrupted and the returned effect waits
9602
+ * for the source fiber to finish, including its finalizers. The duration
9603
+ * determines when interruption is requested, not a deadline for completion.
9604
+ * If the source enters its own uninterruptible region, completion can be
9605
+ * delayed until that region finishes. The eventual source result is
9606
+ * discarded and the timeout still selects `orElse`.
9607
+ *
9608
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9609
+ * can keep running unless the operation honors cancellation. Fibers started
9610
+ * with `forkDetach` are not awaited.
9152
9611
  *
9153
9612
  * **Example** (Falling back on timeout)
9154
9613
  *
@@ -9182,7 +9641,26 @@ export const timeoutOrElse: {
9182
9641
  ): <A, E, R>(self: Effect<A, E, R>) => Effect<A | A2, E | E2, R | R2>
9183
9642
  /**
9184
9643
  * Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
9185
- * the source if the timeout is reached.
9644
+ * the source and waiting for its cleanup if the timeout is reached.
9645
+ *
9646
+ * **Details**
9647
+ *
9648
+ * Any contender the timeout starts (source or timer) is initially
9649
+ * interruptible, even when the timeout runs in an uninterruptible region. The
9650
+ * timer uses the context's `Clock`.
9651
+ *
9652
+ * **Gotchas**
9653
+ *
9654
+ * If the timeout wins, the source is interrupted and the returned effect waits
9655
+ * for the source fiber to finish, including its finalizers. The duration
9656
+ * determines when interruption is requested, not a deadline for completion.
9657
+ * If the source enters its own uninterruptible region, completion can be
9658
+ * delayed until that region finishes. The eventual source result is
9659
+ * discarded and the timeout still selects `orElse`.
9660
+ *
9661
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9662
+ * can keep running unless the operation honors cancellation. Fibers started
9663
+ * with `forkDetach` are not awaited.
9186
9664
  *
9187
9665
  * **Example** (Falling back on timeout)
9188
9666
  *
@@ -9218,8 +9696,8 @@ export const timeoutOrElse: {
9218
9696
  } = internal.timeoutOrElse
9219
9697
 
9220
9698
  /**
9221
- * Returns an effect that is delayed from this effect by the specified
9222
- * `Duration`.
9699
+ * Delays the start of an effect by the specified duration using the context's
9700
+ * `Clock`.
9223
9701
  *
9224
9702
  * **Example** (Delaying an effect)
9225
9703
  *
@@ -9233,14 +9711,15 @@ export const timeoutOrElse: {
9233
9711
  * output // => ["Delayed message"]
9234
9712
  * ```
9235
9713
  *
9714
+ * @see {@link sleep} for waiting with the current clock
9236
9715
  * @stability stable
9237
9716
  * @category delays & timeouts
9238
9717
  * @since 2.0.0
9239
9718
  */
9240
9719
  export const delay: {
9241
9720
  /**
9242
- * Returns an effect that is delayed from this effect by the specified
9243
- * `Duration`.
9721
+ * Delays the start of an effect by the specified duration using the context's
9722
+ * `Clock`.
9244
9723
  *
9245
9724
  * **Example** (Delaying an effect)
9246
9725
  *
@@ -9254,14 +9733,15 @@ export const delay: {
9254
9733
  * output // => ["Delayed message"]
9255
9734
  * ```
9256
9735
  *
9736
+ * @see {@link sleep} for waiting with the current clock
9257
9737
  * @stability stable
9258
9738
  * @category delays & timeouts
9259
9739
  * @since 2.0.0
9260
9740
  */
9261
9741
  (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>
9262
9742
  /**
9263
- * Returns an effect that is delayed from this effect by the specified
9264
- * `Duration`.
9743
+ * Delays the start of an effect by the specified duration using the context's
9744
+ * `Clock`.
9265
9745
  *
9266
9746
  * **Example** (Delaying an effect)
9267
9747
  *
@@ -9275,6 +9755,7 @@ export const delay: {
9275
9755
  * output // => ["Delayed message"]
9276
9756
  * ```
9277
9757
  *
9758
+ * @see {@link sleep} for waiting with the current clock
9278
9759
  * @stability stable
9279
9760
  * @category delays & timeouts
9280
9761
  * @since 2.0.0
@@ -9284,7 +9765,7 @@ export const delay: {
9284
9765
 
9285
9766
  /**
9286
9767
  * Returns an effect that suspends the current fiber for the specified duration
9287
- * without blocking a JavaScript thread.
9768
+ * using the context's `Clock`, without blocking a JavaScript thread.
9288
9769
  *
9289
9770
  * **Example** (Pausing without blocking)
9290
9771
  *
@@ -9351,9 +9832,24 @@ export const timed: <A, E, R>(self: Effect<A, E, R>) => Effect<[duration: Durati
9351
9832
  * **Details**
9352
9833
  *
9353
9834
  * Early failures do not finish the race; `raceAll` keeps waiting until one
9354
- * effect succeeds or every effect has failed. When one effect succeeds, the
9355
- * remaining effects are interrupted. If every effect fails, the returned effect
9356
- * fails with a cause containing the collected failure reasons.
9835
+ * effect succeeds or every effect has failed. If one succeeds, any
9836
+ * still-running contenders are interrupted. If every effect fails, the
9837
+ * returned effect fails with a cause containing the collected failure reasons.
9838
+ *
9839
+ * Any contender the race starts is initially interruptible, even when the race
9840
+ * runs in an uninterruptible region.
9841
+ *
9842
+ * The returned effect completes only after the interrupted participants have
9843
+ * finished, including their finalizers.
9844
+ *
9845
+ * **Gotchas**
9846
+ *
9847
+ * If a losing effect enters its own uninterruptible region, the race waits
9848
+ * for that region to finish. The losing result is discarded.
9849
+ *
9850
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9851
+ * can keep running unless the operation honors cancellation. Fibers started
9852
+ * with `forkDetach` are not awaited.
9357
9853
  *
9358
9854
  * **Example** (Racing many effects)
9359
9855
  *
@@ -9389,9 +9885,24 @@ export const raceAll: <Eff extends Effect<any, any, any>>(
9389
9885
  *
9390
9886
  * **Details**
9391
9887
  *
9392
- * After the first effect completes, all remaining effects are interrupted. Use
9393
- * `raceAll` when early failures should be ignored until a success occurs or
9394
- * all effects fail.
9888
+ * The race requests interruption of any still-running losers. Use `raceAll`
9889
+ * when early failures should be ignored until a success occurs or all effects
9890
+ * fail.
9891
+ *
9892
+ * Any contender the race starts is initially interruptible, even when the race
9893
+ * runs in an uninterruptible region.
9894
+ *
9895
+ * The returned effect completes only after the interrupted participants have
9896
+ * finished, including their finalizers.
9897
+ *
9898
+ * **Gotchas**
9899
+ *
9900
+ * If a losing effect enters its own uninterruptible region, the race waits
9901
+ * for that region to finish. The losing result is discarded.
9902
+ *
9903
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9904
+ * can keep running unless the operation honors cancellation. Fibers started
9905
+ * with `forkDetach` are not awaited.
9395
9906
  *
9396
9907
  * **Example** (Taking the first settled result)
9397
9908
  *
@@ -9425,8 +9936,23 @@ export const raceAllFirst: <Eff extends Effect<any, any, any>>(
9425
9936
  *
9426
9937
  * **Details**
9427
9938
  *
9428
- * If one effect succeeds, the other is interrupted and `onWinner` can observe the
9429
- * winning fiber. If both fail, the race fails.
9939
+ * If one effect succeeds, `onWinner` can observe the winning fiber. The other
9940
+ * effect is interrupted if it is still running. If both fail, the race fails.
9941
+ *
9942
+ * Any contender the race starts is initially interruptible, even when the race
9943
+ * runs in an uninterruptible region.
9944
+ *
9945
+ * The returned effect completes only after the interrupted participants have
9946
+ * finished, including their finalizers.
9947
+ *
9948
+ * **Gotchas**
9949
+ *
9950
+ * If a losing effect enters its own uninterruptible region, the race waits
9951
+ * for that region to finish. The losing result is discarded.
9952
+ *
9953
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
9954
+ * can keep running unless the operation honors cancellation. Fibers started
9955
+ * with `forkDetach` are not awaited.
9430
9956
  *
9431
9957
  * **Example** (Racing two effects)
9432
9958
  *
@@ -9456,8 +9982,23 @@ export const race: {
9456
9982
  *
9457
9983
  * **Details**
9458
9984
  *
9459
- * If one effect succeeds, the other is interrupted and `onWinner` can observe the
9460
- * winning fiber. If both fail, the race fails.
9985
+ * If one effect succeeds, `onWinner` can observe the winning fiber. The other
9986
+ * effect is interrupted if it is still running. If both fail, the race fails.
9987
+ *
9988
+ * Any contender the race starts is initially interruptible, even when the race
9989
+ * runs in an uninterruptible region.
9990
+ *
9991
+ * The returned effect completes only after the interrupted participants have
9992
+ * finished, including their finalizers.
9993
+ *
9994
+ * **Gotchas**
9995
+ *
9996
+ * If a losing effect enters its own uninterruptible region, the race waits
9997
+ * for that region to finish. The losing result is discarded.
9998
+ *
9999
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
10000
+ * can keep running unless the operation honors cancellation. Fibers started
10001
+ * with `forkDetach` are not awaited.
9461
10002
  *
9462
10003
  * **Example** (Racing two effects)
9463
10004
  *
@@ -9494,8 +10035,23 @@ export const race: {
9494
10035
  *
9495
10036
  * **Details**
9496
10037
  *
9497
- * If one effect succeeds, the other is interrupted and `onWinner` can observe the
9498
- * winning fiber. If both fail, the race fails.
10038
+ * If one effect succeeds, `onWinner` can observe the winning fiber. The other
10039
+ * effect is interrupted if it is still running. If both fail, the race fails.
10040
+ *
10041
+ * Any contender the race starts is initially interruptible, even when the race
10042
+ * runs in an uninterruptible region.
10043
+ *
10044
+ * The returned effect completes only after the interrupted participants have
10045
+ * finished, including their finalizers.
10046
+ *
10047
+ * **Gotchas**
10048
+ *
10049
+ * If a losing effect enters its own uninterruptible region, the race waits
10050
+ * for that region to finish. The losing result is discarded.
10051
+ *
10052
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
10053
+ * can keep running unless the operation honors cancellation. Fibers started
10054
+ * with `forkDetach` are not awaited.
9499
10055
  *
9500
10056
  * **Example** (Racing two effects)
9501
10057
  *
@@ -9536,12 +10092,27 @@ export const race: {
9536
10092
  *
9537
10093
  * **When to use**
9538
10094
  *
9539
- * Use when any completion, including failure, should decide the race and
9540
- * interrupt the losing effect.
10095
+ * Use when any completion, including failure, should decide the race.
9541
10096
  *
9542
10097
  * **Details**
9543
10098
  *
9544
- * The losing effect is interrupted, and `onWinner` can observe the winning fiber.
10099
+ * The losing effect is interrupted if it is still running. `onWinner` can
10100
+ * observe the winning fiber.
10101
+ *
10102
+ * Any contender the race starts is initially interruptible, even when the race
10103
+ * runs in an uninterruptible region.
10104
+ *
10105
+ * The returned effect completes only after the interrupted participants have
10106
+ * finished, including their finalizers.
10107
+ *
10108
+ * **Gotchas**
10109
+ *
10110
+ * If a losing effect enters its own uninterruptible region, the race waits
10111
+ * for that region to finish. The losing result is discarded.
10112
+ *
10113
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
10114
+ * can keep running unless the operation honors cancellation. Fibers started
10115
+ * with `forkDetach` are not awaited.
9545
10116
  *
9546
10117
  * **Example** (Observing the winning fiber)
9547
10118
  *
@@ -9575,12 +10146,27 @@ export const raceFirst: {
9575
10146
  *
9576
10147
  * **When to use**
9577
10148
  *
9578
- * Use when any completion, including failure, should decide the race and
9579
- * interrupt the losing effect.
10149
+ * Use when any completion, including failure, should decide the race.
9580
10150
  *
9581
10151
  * **Details**
9582
10152
  *
9583
- * The losing effect is interrupted, and `onWinner` can observe the winning fiber.
10153
+ * The losing effect is interrupted if it is still running. `onWinner` can
10154
+ * observe the winning fiber.
10155
+ *
10156
+ * Any contender the race starts is initially interruptible, even when the race
10157
+ * runs in an uninterruptible region.
10158
+ *
10159
+ * The returned effect completes only after the interrupted participants have
10160
+ * finished, including their finalizers.
10161
+ *
10162
+ * **Gotchas**
10163
+ *
10164
+ * If a losing effect enters its own uninterruptible region, the race waits
10165
+ * for that region to finish. The losing result is discarded.
10166
+ *
10167
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
10168
+ * can keep running unless the operation honors cancellation. Fibers started
10169
+ * with `forkDetach` are not awaited.
9584
10170
  *
9585
10171
  * **Example** (Observing the winning fiber)
9586
10172
  *
@@ -9621,12 +10207,27 @@ export const raceFirst: {
9621
10207
  *
9622
10208
  * **When to use**
9623
10209
  *
9624
- * Use when any completion, including failure, should decide the race and
9625
- * interrupt the losing effect.
10210
+ * Use when any completion, including failure, should decide the race.
9626
10211
  *
9627
10212
  * **Details**
9628
10213
  *
9629
- * The losing effect is interrupted, and `onWinner` can observe the winning fiber.
10214
+ * The losing effect is interrupted if it is still running. `onWinner` can
10215
+ * observe the winning fiber.
10216
+ *
10217
+ * Any contender the race starts is initially interruptible, even when the race
10218
+ * runs in an uninterruptible region.
10219
+ *
10220
+ * The returned effect completes only after the interrupted participants have
10221
+ * finished, including their finalizers.
10222
+ *
10223
+ * **Gotchas**
10224
+ *
10225
+ * If a losing effect enters its own uninterruptible region, the race waits
10226
+ * for that region to finish. The losing result is discarded.
10227
+ *
10228
+ * Waiting for fiber cleanup does not ensure external work stops: a Promise
10229
+ * can keep running unless the operation honors cancellation. Fibers started
10230
+ * with `forkDetach` are not awaited.
9630
10231
  *
9631
10232
  * **Example** (Observing the winning fiber)
9632
10233
  *
@@ -11230,6 +11831,9 @@ export const matchEager: {
11230
11831
  * The `matchCause` function allows you to handle failures with access to the
11231
11832
  * full cause of the failure within a fiber.
11232
11833
  *
11834
+ * The failure handler is skipped if the running fiber is interrupted in an
11835
+ * interruptible region.
11836
+ *
11233
11837
  * **Example** (Matching on success or failure causes)
11234
11838
  *
11235
11839
  * ```ts import.meta.vitest
@@ -11245,6 +11849,7 @@ export const matchEager: {
11245
11849
  * Effect.runSync(program) // => "Failed: Something went wrong"
11246
11850
  * ```
11247
11851
  *
11852
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11248
11853
  * @see {@link matchCauseEffect} if you need to perform side effects in the
11249
11854
  * handlers.
11250
11855
  * @see {@link match} if you don't need to handle the cause of the failure.
@@ -11266,6 +11871,9 @@ export const matchCause: {
11266
11871
  * The `matchCause` function allows you to handle failures with access to the
11267
11872
  * full cause of the failure within a fiber.
11268
11873
  *
11874
+ * The failure handler is skipped if the running fiber is interrupted in an
11875
+ * interruptible region.
11876
+ *
11269
11877
  * **Example** (Matching on success or failure causes)
11270
11878
  *
11271
11879
  * ```ts import.meta.vitest
@@ -11281,6 +11889,7 @@ export const matchCause: {
11281
11889
  * Effect.runSync(program) // => "Failed: Something went wrong"
11282
11890
  * ```
11283
11891
  *
11892
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11284
11893
  * @see {@link matchCauseEffect} if you need to perform side effects in the
11285
11894
  * handlers.
11286
11895
  * @see {@link match} if you don't need to handle the cause of the failure.
@@ -11307,6 +11916,9 @@ export const matchCause: {
11307
11916
  * The `matchCause` function allows you to handle failures with access to the
11308
11917
  * full cause of the failure within a fiber.
11309
11918
  *
11919
+ * The failure handler is skipped if the running fiber is interrupted in an
11920
+ * interruptible region.
11921
+ *
11310
11922
  * **Example** (Matching on success or failure causes)
11311
11923
  *
11312
11924
  * ```ts import.meta.vitest
@@ -11322,6 +11934,7 @@ export const matchCause: {
11322
11934
  * Effect.runSync(program) // => "Failed: Something went wrong"
11323
11935
  * ```
11324
11936
  *
11937
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11325
11938
  * @see {@link matchCauseEffect} if you need to perform side effects in the
11326
11939
  * handlers.
11327
11940
  * @see {@link match} if you don't need to handle the cause of the failure.
@@ -11352,6 +11965,9 @@ export const matchCause: {
11352
11965
  * effects by immediately applying the matching function instead of deferring it
11353
11966
  * through the effect pipeline.
11354
11967
  *
11968
+ * Unless the effect is already an `Exit`, the failure handler is skipped if
11969
+ * the running fiber is interrupted in an interruptible region.
11970
+ *
11355
11971
  * **Example** (Eagerly matching already completed effects)
11356
11972
  *
11357
11973
  * ```ts import.meta.vitest
@@ -11364,6 +11980,8 @@ export const matchCause: {
11364
11980
  * Effect.runSync(handleResult) // => "Success: 42"
11365
11981
  * ```
11366
11982
  *
11983
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11984
+ *
11367
11985
  * @stability stable
11368
11986
  * @category pattern matching
11369
11987
  * @since 4.0.0
@@ -11383,6 +12001,9 @@ export const matchCauseEager: {
11383
12001
  * effects by immediately applying the matching function instead of deferring it
11384
12002
  * through the effect pipeline.
11385
12003
  *
12004
+ * Unless the effect is already an `Exit`, the failure handler is skipped if
12005
+ * the running fiber is interrupted in an interruptible region.
12006
+ *
11386
12007
  * **Example** (Eagerly matching already completed effects)
11387
12008
  *
11388
12009
  * ```ts import.meta.vitest
@@ -11395,6 +12016,8 @@ export const matchCauseEager: {
11395
12016
  * Effect.runSync(handleResult) // => "Success: 42"
11396
12017
  * ```
11397
12018
  *
12019
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
12020
+ *
11398
12021
  * @stability stable
11399
12022
  * @category pattern matching
11400
12023
  * @since 4.0.0
@@ -11419,6 +12042,9 @@ export const matchCauseEager: {
11419
12042
  * effects by immediately applying the matching function instead of deferring it
11420
12043
  * through the effect pipeline.
11421
12044
  *
12045
+ * Unless the effect is already an `Exit`, the failure handler is skipped if
12046
+ * the running fiber is interrupted in an interruptible region.
12047
+ *
11422
12048
  * **Example** (Eagerly matching already completed effects)
11423
12049
  *
11424
12050
  * ```ts import.meta.vitest
@@ -11431,6 +12057,8 @@ export const matchCauseEager: {
11431
12057
  * Effect.runSync(handleResult) // => "Success: 42"
11432
12058
  * ```
11433
12059
  *
12060
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
12061
+ *
11434
12062
  * @stability stable
11435
12063
  * @category pattern matching
11436
12064
  * @since 4.0.0
@@ -11457,6 +12085,10 @@ export const matchCauseEager: {
11457
12085
  * If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
11458
12086
  * {@link matchCauseEffect}.
11459
12087
  *
12088
+ * Unless the effect is already an `Exit`, the failure handler is skipped if
12089
+ * the running fiber is interrupted in an interruptible region.
12090
+ *
12091
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11460
12092
  * @see {@link matchCauseEffect} for the non-eager effectful variant
11461
12093
  * @see {@link matchCauseEager} for eager cause matching with pure handlers
11462
12094
  * @see {@link matchEffect} for effectful matching on typed failures instead of full causes
@@ -11479,6 +12111,10 @@ export const matchCauseEffectEager: {
11479
12111
  * If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
11480
12112
  * {@link matchCauseEffect}.
11481
12113
  *
12114
+ * Unless the effect is already an `Exit`, the failure handler is skipped if
12115
+ * the running fiber is interrupted in an interruptible region.
12116
+ *
12117
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11482
12118
  * @see {@link matchCauseEffect} for the non-eager effectful variant
11483
12119
  * @see {@link matchCauseEager} for eager cause matching with pure handlers
11484
12120
  * @see {@link matchEffect} for effectful matching on typed failures instead of full causes
@@ -11506,6 +12142,10 @@ export const matchCauseEffectEager: {
11506
12142
  * If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
11507
12143
  * {@link matchCauseEffect}.
11508
12144
  *
12145
+ * Unless the effect is already an `Exit`, the failure handler is skipped if
12146
+ * the running fiber is interrupted in an interruptible region.
12147
+ *
12148
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11509
12149
  * @see {@link matchCauseEffect} for the non-eager effectful variant
11510
12150
  * @see {@link matchCauseEager} for eager cause matching with pure handlers
11511
12151
  * @see {@link matchEffect} for effectful matching on typed failures instead of full causes
@@ -11540,6 +12180,9 @@ export const matchCauseEffectEager: {
11540
12180
  * you to respond accordingly while performing side effects (like logging or
11541
12181
  * other operations).
11542
12182
  *
12183
+ * The failure handler is skipped if the running fiber is interrupted in an
12184
+ * interruptible region.
12185
+ *
11543
12186
  * **Example** (Effectfully matching on causes)
11544
12187
  *
11545
12188
  * ```ts import.meta.vitest
@@ -11575,6 +12218,7 @@ export const matchCauseEffectEager: {
11575
12218
  * output // => ["Handling error: Task failed", "recovered from error"]
11576
12219
  * ```
11577
12220
  *
12221
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11578
12222
  * @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
11579
12223
  * @see {@link matchEffect} if you don't need to handle the cause of the failure.
11580
12224
  *
@@ -11600,6 +12244,9 @@ export const matchCauseEffect: {
11600
12244
  * you to respond accordingly while performing side effects (like logging or
11601
12245
  * other operations).
11602
12246
  *
12247
+ * The failure handler is skipped if the running fiber is interrupted in an
12248
+ * interruptible region.
12249
+ *
11603
12250
  * **Example** (Effectfully matching on causes)
11604
12251
  *
11605
12252
  * ```ts import.meta.vitest
@@ -11635,6 +12282,7 @@ export const matchCauseEffect: {
11635
12282
  * output // => ["Handling error: Task failed", "recovered from error"]
11636
12283
  * ```
11637
12284
  *
12285
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11638
12286
  * @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
11639
12287
  * @see {@link matchEffect} if you don't need to handle the cause of the failure.
11640
12288
  *
@@ -11665,6 +12313,9 @@ export const matchCauseEffect: {
11665
12313
  * you to respond accordingly while performing side effects (like logging or
11666
12314
  * other operations).
11667
12315
  *
12316
+ * The failure handler is skipped if the running fiber is interrupted in an
12317
+ * interruptible region.
12318
+ *
11668
12319
  * **Example** (Effectfully matching on causes)
11669
12320
  *
11670
12321
  * ```ts import.meta.vitest
@@ -11700,6 +12351,7 @@ export const matchCauseEffect: {
11700
12351
  * output // => ["Handling error: Task failed", "recovered from error"]
11701
12352
  * ```
11702
12353
  *
12354
+ * @see {@link catchCause} for fiber interruption versus interruption in a cause
11703
12355
  * @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
11704
12356
  * @see {@link matchEffect} if you don't need to handle the cause of the failure.
11705
12357
  *
@@ -13547,9 +14199,10 @@ export const scopedWith: <A, E, R>(
13547
14199
  *
13548
14200
  * **Details**
13549
14201
  *
13550
- * If acquisition succeeds, the release finalizer is added to the current scope
13551
- * and is guaranteed to run when that scope closes. The finalizer receives the
13552
- * `Exit` value used to close the scope.
14202
+ * After successful acquisition, release is registered on the scope. If the
14203
+ * scope is open, `Scope.close` runs it according to the scope's finalizer
14204
+ * strategy and passes it the closing `Exit`. If the scope is already closed,
14205
+ * release runs immediately with that `Exit`.
13553
14206
  *
13554
14207
  * By default, acquisition is protected by an uninterruptible region. Pass
13555
14208
  * `{ interruptible: true }` to allow the acquisition effect to be interrupted.
@@ -13680,8 +14333,12 @@ export const acquireDisposable: <A extends AsyncDisposable | Disposable, E, R>(
13680
14333
  * and will be executed as long as the acquisition `Effect` value
13681
14334
  * successfully acquires the resource.
13682
14335
  *
13683
- * During the time period between the acquisition and release of the resource,
13684
- * the `use` `Effect` value will be executed.
14336
+ * `use` runs with the interruptibility of the surrounding region. In an
14337
+ * interruptible region, it can be interrupted, and `release` receives an `Exit`
14338
+ * whose cause contains the interruption. In an uninterruptible region, `use`
14339
+ * runs to completion unless it explicitly restores interruptibility.
14340
+ *
14341
+ * The returned effect waits for release to finish, including when interrupted.
13685
14342
  *
13686
14343
  * If the `release` `Effect` value fails, then the entire `Effect` value will
13687
14344
  * fail, even if the `use` `Effect` value succeeds. If this fail-fast behavior
@@ -13752,8 +14409,9 @@ export const acquireUseRelease: <Resource, E, R, A, E2, R2, E3, R3>(
13752
14409
  *
13753
14410
  * **Details**
13754
14411
  *
13755
- * The finalizer runs when the surrounding scope is closed and receives the
13756
- * `Exit` value used to close the scope.
14412
+ * If the scope is open, `Scope.close` runs the finalizer according to the
14413
+ * scope's finalizer strategy and passes it the closing `Exit`. If the scope is
14414
+ * already closed, the finalizer runs immediately with that `Exit`.
13757
14415
  *
13758
14416
  * **Example** (Registering scope finalizers)
13759
14417
  *
@@ -13801,12 +14459,12 @@ export const addFinalizer: <R>(
13801
14459
  *
13802
14460
  * **Details**
13803
14461
  *
13804
- * For use cases that need access to the effect's result, see `onExit`.
13805
- *
13806
14462
  * Finalizers offer very powerful guarantees, but they are low-level, and
13807
14463
  * should generally not be used for releasing resources. For higher-level
13808
14464
  * logic built on `ensuring`, see the `acquireRelease` family of methods.
13809
14465
  *
14466
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14467
+ *
13810
14468
  * **Example** (Always running cleanup)
13811
14469
  *
13812
14470
  * ```ts import.meta.vitest
@@ -13841,12 +14499,12 @@ export const ensuring: {
13841
14499
  *
13842
14500
  * **Details**
13843
14501
  *
13844
- * For use cases that need access to the effect's result, see `onExit`.
13845
- *
13846
14502
  * Finalizers offer very powerful guarantees, but they are low-level, and
13847
14503
  * should generally not be used for releasing resources. For higher-level
13848
14504
  * logic built on `ensuring`, see the `acquireRelease` family of methods.
13849
14505
  *
14506
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14507
+ *
13850
14508
  * **Example** (Always running cleanup)
13851
14509
  *
13852
14510
  * ```ts import.meta.vitest
@@ -13881,12 +14539,12 @@ export const ensuring: {
13881
14539
  *
13882
14540
  * **Details**
13883
14541
  *
13884
- * For use cases that need access to the effect's result, see `onExit`.
13885
- *
13886
14542
  * Finalizers offer very powerful guarantees, but they are low-level, and
13887
14543
  * should generally not be used for releasing resources. For higher-level
13888
14544
  * logic built on `ensuring`, see the `acquireRelease` family of methods.
13889
14545
  *
14546
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14547
+ *
13890
14548
  * **Example** (Always running cleanup)
13891
14549
  *
13892
14550
  * ```ts import.meta.vitest
@@ -14012,6 +14670,10 @@ export const onError: {
14012
14670
  * Runs the finalizer only when this effect fails and the `Cause` matches the
14013
14671
  * provided predicate.
14014
14672
  *
14673
+ * **Details**
14674
+ *
14675
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14676
+ *
14015
14677
  * **Example** (Running cleanup for selected failures)
14016
14678
  *
14017
14679
  * ```ts import.meta.vitest
@@ -14042,6 +14704,10 @@ export const onErrorIf: {
14042
14704
  * Runs the finalizer only when this effect fails and the `Cause` matches the
14043
14705
  * provided predicate.
14044
14706
  *
14707
+ * **Details**
14708
+ *
14709
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14710
+ *
14045
14711
  * **Example** (Running cleanup for selected failures)
14046
14712
  *
14047
14713
  * ```ts import.meta.vitest
@@ -14075,6 +14741,10 @@ export const onErrorIf: {
14075
14741
  * Runs the finalizer only when this effect fails and the `Cause` matches the
14076
14742
  * provided predicate.
14077
14743
  *
14744
+ * **Details**
14745
+ *
14746
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14747
+ *
14078
14748
  * **Example** (Running cleanup for selected failures)
14079
14749
  *
14080
14750
  * ```ts import.meta.vitest
@@ -14116,6 +14786,10 @@ export const onErrorIf: {
14116
14786
  * `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
14117
14787
  * filter's pass value plus the original cause.
14118
14788
  *
14789
+ * **Details**
14790
+ *
14791
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14792
+ *
14119
14793
  * @see {@link onError} for cleanup on every failure
14120
14794
  * @see {@link onErrorIf} for selecting failures with a boolean predicate
14121
14795
  * @see {@link onExitFilter} for selecting from every exit instead of only failures
@@ -14134,6 +14808,10 @@ export const onErrorFilter: {
14134
14808
  * `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
14135
14809
  * filter's pass value plus the original cause.
14136
14810
  *
14811
+ * **Details**
14812
+ *
14813
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14814
+ *
14137
14815
  * @see {@link onError} for cleanup on every failure
14138
14816
  * @see {@link onErrorIf} for selecting failures with a boolean predicate
14139
14817
  * @see {@link onExitFilter} for selecting from every exit instead of only failures
@@ -14155,6 +14833,10 @@ export const onErrorFilter: {
14155
14833
  * `Cause` is accepted or transformed by a `Filter`, and the finalizer needs the
14156
14834
  * filter's pass value plus the original cause.
14157
14835
  *
14836
+ * **Details**
14837
+ *
14838
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
14839
+ *
14158
14840
  * @see {@link onError} for cleanup on every failure
14159
14841
  * @see {@link onErrorIf} for selecting failures with a boolean predicate
14160
14842
  * @see {@link onExitFilter} for selecting from every exit instead of only failures
@@ -14206,6 +14888,15 @@ export const onExitPrimitive: <A, E, R, XE = never, XR = never>(
14206
14888
  *
14207
14889
  * If both the effect and the cleanup function fail, the two causes are merged.
14208
14890
  *
14891
+ * Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
14892
+ * to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
14893
+ * part to be interrupted.
14894
+ *
14895
+ * **Gotchas**
14896
+ *
14897
+ * If interruption is already pending, a part of cleanup wrapped in
14898
+ * `Effect.interruptible` is interrupted before it starts.
14899
+ *
14209
14900
  * **Example** (Observing every exit)
14210
14901
  *
14211
14902
  * ```ts import.meta.vitest
@@ -14238,6 +14929,15 @@ export const onExit: {
14238
14929
  *
14239
14930
  * If both the effect and the cleanup function fail, the two causes are merged.
14240
14931
  *
14932
+ * Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
14933
+ * to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
14934
+ * part to be interrupted.
14935
+ *
14936
+ * **Gotchas**
14937
+ *
14938
+ * If interruption is already pending, a part of cleanup wrapped in
14939
+ * `Effect.interruptible` is interrupted before it starts.
14940
+ *
14241
14941
  * **Example** (Observing every exit)
14242
14942
  *
14243
14943
  * ```ts import.meta.vitest
@@ -14270,6 +14970,15 @@ export const onExit: {
14270
14970
  *
14271
14971
  * If both the effect and the cleanup function fail, the two causes are merged.
14272
14972
  *
14973
+ * Cleanup runs in an uninterruptible region. `Fiber.interrupt` waits for it
14974
+ * to finish. Wrap a part of cleanup in `Effect.interruptible` to allow that
14975
+ * part to be interrupted.
14976
+ *
14977
+ * **Gotchas**
14978
+ *
14979
+ * If interruption is already pending, a part of cleanup wrapped in
14980
+ * `Effect.interruptible` is interrupted before it starts.
14981
+ *
14273
14982
  * **Example** (Observing every exit)
14274
14983
  *
14275
14984
  * ```ts import.meta.vitest
@@ -14300,6 +15009,10 @@ export const onExit: {
14300
15009
  * Runs the cleanup effect only when the `Exit` satisfies the provided
14301
15010
  * predicate.
14302
15011
  *
15012
+ * **Details**
15013
+ *
15014
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
15015
+ *
14303
15016
  * **Example** (Observing selected exits)
14304
15017
  *
14305
15018
  * ```ts import.meta.vitest
@@ -14328,6 +15041,10 @@ export const onExitIf: {
14328
15041
  * Runs the cleanup effect only when the `Exit` satisfies the provided
14329
15042
  * predicate.
14330
15043
  *
15044
+ * **Details**
15045
+ *
15046
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
15047
+ *
14331
15048
  * **Example** (Observing selected exits)
14332
15049
  *
14333
15050
  * ```ts import.meta.vitest
@@ -14359,6 +15076,10 @@ export const onExitIf: {
14359
15076
  * Runs the cleanup effect only when the `Exit` satisfies the provided
14360
15077
  * predicate.
14361
15078
  *
15079
+ * **Details**
15080
+ *
15081
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
15082
+ *
14362
15083
  * **Example** (Observing selected exits)
14363
15084
  *
14364
15085
  * ```ts import.meta.vitest
@@ -14403,6 +15124,8 @@ export const onExitIf: {
14403
15124
  * `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
14404
15125
  * selected value and the original `Exit`.
14405
15126
  *
15127
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
15128
+ *
14406
15129
  * @see {@link onExit} for cleanup on every exit
14407
15130
  * @see {@link onExitIf} for selecting exits with a boolean predicate
14408
15131
  * @see {@link onErrorFilter} for selecting only failure causes
@@ -14426,6 +15149,8 @@ export const onExitFilter: {
14426
15149
  * `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
14427
15150
  * selected value and the original `Exit`.
14428
15151
  *
15152
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
15153
+ *
14429
15154
  * @see {@link onExit} for cleanup on every exit
14430
15155
  * @see {@link onExitIf} for selecting exits with a boolean predicate
14431
15156
  * @see {@link onErrorFilter} for selecting only failure causes
@@ -14452,6 +15177,8 @@ export const onExitFilter: {
14452
15177
  * `Result.fail` skips cleanup, and `Result.succeed` runs cleanup with the
14453
15178
  * selected value and the original `Exit`.
14454
15179
  *
15180
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
15181
+ *
14455
15182
  * @see {@link onExit} for cleanup on every exit
14456
15183
  * @see {@link onExitIf} for selecting exits with a boolean predicate
14457
15184
  * @see {@link onErrorFilter} for selecting only failure causes
@@ -15274,7 +16001,8 @@ export const cachedInvalidateWithTTL: {
15274
16001
  // -----------------------------------------------------------------------------
15275
16002
 
15276
16003
  /**
15277
- * Returns an effect that is immediately interrupted.
16004
+ * Fails with an `Interrupt` reason that names the current fiber. This does not
16005
+ * request interruption of the fiber itself, so a cause handler can recover.
15278
16006
  *
15279
16007
  * **Example** (Creating an interrupted effect)
15280
16008
  *
@@ -15289,6 +16017,8 @@ export const cachedInvalidateWithTTL: {
15289
16017
  * Effect.runSyncExit(program)._tag // => "Failure"
15290
16018
  * ```
15291
16019
  *
16020
+ * @see {@link catchCause} for recovering from an interruption in the cause
16021
+ *
15292
16022
  * @stability stable
15293
16023
  * @category interruption
15294
16024
  * @since 2.0.0
@@ -15296,7 +16026,12 @@ export const cachedInvalidateWithTTL: {
15296
16026
  export const interrupt: Effect<never> = internal.interrupt
15297
16027
 
15298
16028
  /**
15299
- * Returns a new effect that allows the effect to be interruptible.
16029
+ * Runs an effect in an interruptible region.
16030
+ *
16031
+ * **Details**
16032
+ *
16033
+ * If interruption is pending when the fiber enters this region, it takes
16034
+ * effect before the wrapped effect starts.
15300
16035
  *
15301
16036
  * **Example** (Allowing interruption)
15302
16037
  *
@@ -15309,6 +16044,8 @@ export const interrupt: Effect<never> = internal.interrupt
15309
16044
  * await Effect.runPromise(program) // => Option.none()
15310
16045
  * ```
15311
16046
  *
16047
+ * @see {@link uninterruptible} for how regions defer interruption
16048
+ *
15312
16049
  * @stability stable
15313
16050
  * @category interruption
15314
16051
  * @since 2.0.0
@@ -15320,6 +16057,10 @@ export const interruptible: <A, E, R>(
15320
16057
  /**
15321
16058
  * Runs the specified finalizer effect if this effect is interrupted.
15322
16059
  *
16060
+ * **Details**
16061
+ *
16062
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
16063
+ *
15323
16064
  * **Example** (Running cleanup on interruption)
15324
16065
  *
15325
16066
  * ```ts import.meta.vitest
@@ -15346,6 +16087,10 @@ export const onInterrupt: {
15346
16087
  /**
15347
16088
  * Runs the specified finalizer effect if this effect is interrupted.
15348
16089
  *
16090
+ * **Details**
16091
+ *
16092
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
16093
+ *
15349
16094
  * **Example** (Running cleanup on interruption)
15350
16095
  *
15351
16096
  * ```ts import.meta.vitest
@@ -15372,6 +16117,10 @@ export const onInterrupt: {
15372
16117
  /**
15373
16118
  * Runs the specified finalizer effect if this effect is interrupted.
15374
16119
  *
16120
+ * **Details**
16121
+ *
16122
+ * Like {@link onExit} cleanup, the finalizer runs in an uninterruptible region.
16123
+ *
15375
16124
  * **Example** (Running cleanup on interruption)
15376
16125
  *
15377
16126
  * ```ts import.meta.vitest
@@ -15401,7 +16150,13 @@ export const onInterrupt: {
15401
16150
  } = internal.onInterrupt
15402
16151
 
15403
16152
  /**
15404
- * Returns a new effect that disables interruption for the given effect.
16153
+ * Runs an effect in an uninterruptible region.
16154
+ *
16155
+ * **Details**
16156
+ *
16157
+ * An interruption request remains pending while the fiber is uninterruptible.
16158
+ * It takes effect when the fiber returns to an interruptible region or enters
16159
+ * one explicitly with `interruptible`.
15405
16160
  *
15406
16161
  * **Example** (Preventing interruption)
15407
16162
  *
@@ -15432,6 +16187,12 @@ export const uninterruptible: <A, E, R>(
15432
16187
  * Disables interruption and provides a restore function to restore the
15433
16188
  * interruptible state within the effect.
15434
16189
  *
16190
+ * **Details**
16191
+ *
16192
+ * `restore(effect)` runs `effect` in the surrounding region. If that region
16193
+ * was interruptible, a pending interruption takes effect before `effect`
16194
+ * starts; if it was uninterruptible, the request remains pending.
16195
+ *
15435
16196
  * **Example** (Restoring interruption in protected regions)
15436
16197
  *
15437
16198
  * ```ts import.meta.vitest
@@ -15456,6 +16217,8 @@ export const uninterruptible: <A, E, R>(
15456
16217
  * output // => ["Uninterruptible phase...", "Interruptible phase...", "Back to uninterruptible"]
15457
16218
  * ```
15458
16219
  *
16220
+ * @see {@link uninterruptible} for how regions defer interruption
16221
+ *
15459
16222
  * @stability stable
15460
16223
  * @category interruption
15461
16224
  * @since 2.0.0
@@ -15470,6 +16233,11 @@ export const uninterruptibleMask: <A, E, R>(
15470
16233
  * Runs an effect in an interruptible region while providing `restore` for
15471
16234
  * locally restoring the previous interruptibility.
15472
16235
  *
16236
+ * **Details**
16237
+ *
16238
+ * A pending interruption takes effect when the fiber enters the interruptible
16239
+ * region. Otherwise, `restore` can run a section in the surrounding region.
16240
+ *
15473
16241
  * **Example** (Controlling interruptibility locally)
15474
16242
  *
15475
16243
  * ```ts import.meta.vitest
@@ -15490,10 +16258,12 @@ export const uninterruptibleMask: <A, E, R>(
15490
16258
  * })
15491
16259
  * )
15492
16260
  *
15493
- * Effect.runSync(program)
16261
+ * Effect.runSync(Effect.uninterruptible(program))
15494
16262
  * output // => ["Interruptible phase...", "Uninterruptible phase...", "Back to interruptible"]
15495
16263
  * ```
15496
16264
  *
16265
+ * @see {@link uninterruptible} for how regions defer interruption
16266
+ *
15497
16267
  * @stability stable
15498
16268
  * @category interruption
15499
16269
  * @since 2.0.0
@@ -15639,9 +16409,7 @@ export const forever: <
15639
16409
  * If the effect succeeds, it is repeated according to the schedule. If it
15640
16410
  * fails, the repetition stops immediately, and the failure is returned.
15641
16411
  *
15642
- * The schedule can also specify delays between repetitions, making it useful
15643
- * for tasks like retrying operations with backoff, periodic execution, or
15644
- * performing a series of dependent actions.
16412
+ * Delays between repetitions use the context's `Clock`.
15645
16413
  *
15646
16414
  * You can combine schedules for more advanced repetition logic, such as adding
15647
16415
  * delays, limiting recursions, or dynamically adjusting based on the outcome of
@@ -15725,9 +16493,7 @@ export const repeat: {
15725
16493
  * If the effect succeeds, it is repeated according to the schedule. If it
15726
16494
  * fails, the repetition stops immediately, and the failure is returned.
15727
16495
  *
15728
- * The schedule can also specify delays between repetitions, making it useful
15729
- * for tasks like retrying operations with backoff, periodic execution, or
15730
- * performing a series of dependent actions.
16496
+ * Delays between repetitions use the context's `Clock`.
15731
16497
  *
15732
16498
  * You can combine schedules for more advanced repetition logic, such as adding
15733
16499
  * delays, limiting recursions, or dynamically adjusting based on the outcome of
@@ -15811,9 +16577,7 @@ export const repeat: {
15811
16577
  * If the effect succeeds, it is repeated according to the schedule. If it
15812
16578
  * fails, the repetition stops immediately, and the failure is returned.
15813
16579
  *
15814
- * The schedule can also specify delays between repetitions, making it useful
15815
- * for tasks like retrying operations with backoff, periodic execution, or
15816
- * performing a series of dependent actions.
16580
+ * Delays between repetitions use the context's `Clock`.
15817
16581
  *
15818
16582
  * You can combine schedules for more advanced repetition logic, such as adding
15819
16583
  * delays, limiting recursions, or dynamically adjusting based on the outcome of
@@ -15897,9 +16661,7 @@ export const repeat: {
15897
16661
  * If the effect succeeds, it is repeated according to the schedule. If it
15898
16662
  * fails, the repetition stops immediately, and the failure is returned.
15899
16663
  *
15900
- * The schedule can also specify delays between repetitions, making it useful
15901
- * for tasks like retrying operations with backoff, periodic execution, or
15902
- * performing a series of dependent actions.
16664
+ * Delays between repetitions use the context's `Clock`.
15903
16665
  *
15904
16666
  * You can combine schedules for more advanced repetition logic, such as adding
15905
16667
  * delays, limiting recursions, or dynamically adjusting based on the outcome of
@@ -15987,9 +16749,7 @@ export const repeat: {
15987
16749
  * If the effect succeeds, it is repeated according to the schedule. If it
15988
16750
  * fails, the repetition stops immediately, and the failure is returned.
15989
16751
  *
15990
- * The schedule can also specify delays between repetitions, making it useful
15991
- * for tasks like retrying operations with backoff, periodic execution, or
15992
- * performing a series of dependent actions.
16752
+ * Delays between repetitions use the context's `Clock`.
15993
16753
  *
15994
16754
  * You can combine schedules for more advanced repetition logic, such as adding
15995
16755
  * delays, limiting recursions, or dynamically adjusting based on the outcome of
@@ -16073,9 +16833,7 @@ export const repeat: {
16073
16833
  * If the effect succeeds, it is repeated according to the schedule. If it
16074
16834
  * fails, the repetition stops immediately, and the failure is returned.
16075
16835
  *
16076
- * The schedule can also specify delays between repetitions, making it useful
16077
- * for tasks like retrying operations with backoff, periodic execution, or
16078
- * performing a series of dependent actions.
16836
+ * Delays between repetitions use the context's `Clock`.
16079
16837
  *
16080
16838
  * You can combine schedules for more advanced repetition logic, such as adding
16081
16839
  * delays, limiting recursions, or dynamically adjusting based on the outcome of
@@ -16162,9 +16920,7 @@ export const repeat: {
16162
16920
  * If the effect succeeds, it is repeated according to the schedule. If it
16163
16921
  * fails, the repetition stops immediately, and the failure is returned.
16164
16922
  *
16165
- * The schedule can also specify delays between repetitions, making it useful
16166
- * for tasks like retrying operations with backoff, periodic execution, or
16167
- * performing a series of dependent actions.
16923
+ * Delays between repetitions use the context's `Clock`.
16168
16924
  *
16169
16925
  * You can combine schedules for more advanced repetition logic, such as adding
16170
16926
  * delays, limiting recursions, or dynamically adjusting based on the outcome of
@@ -16253,6 +17009,8 @@ export const repeat: {
16253
17009
  * otherwise it receives `None`. If the schedule completes normally, the
16254
17010
  * returned effect succeeds with the schedule's output.
16255
17011
  *
17012
+ * Scheduled delays use the context's `Clock`.
17013
+ *
16256
17014
  * **Gotchas**
16257
17015
  *
16258
17016
  * Defects take precedence over typed errors from either the effect or policy.
@@ -16313,6 +17071,8 @@ export const repeatOrElse: {
16313
17071
  * otherwise it receives `None`. If the schedule completes normally, the
16314
17072
  * returned effect succeeds with the schedule's output.
16315
17073
  *
17074
+ * Scheduled delays use the context's `Clock`.
17075
+ *
16316
17076
  * **Gotchas**
16317
17077
  *
16318
17078
  * Defects take precedence over typed errors from either the effect or policy.
@@ -16376,6 +17136,8 @@ export const repeatOrElse: {
16376
17136
  * otherwise it receives `None`. If the schedule completes normally, the
16377
17137
  * returned effect succeeds with the schedule's output.
16378
17138
  *
17139
+ * Scheduled delays use the context's `Clock`.
17140
+ *
16379
17141
  * **Gotchas**
16380
17142
  *
16381
17143
  * Defects take precedence over typed errors from either the effect or policy.
@@ -16681,6 +17443,8 @@ export const replicateEffect: {
16681
17443
  * fails, and otherwise succeeds with the schedule output when the schedule
16682
17444
  * completes.
16683
17445
  *
17446
+ * Scheduled delays use the context's `Clock`.
17447
+ *
16684
17448
  * **Example** (Scheduling repeated execution)
16685
17449
  *
16686
17450
  * ```ts import.meta.vitest
@@ -16723,6 +17487,8 @@ export const schedule: {
16723
17487
  * fails, and otherwise succeeds with the schedule output when the schedule
16724
17488
  * completes.
16725
17489
  *
17490
+ * Scheduled delays use the context's `Clock`.
17491
+ *
16726
17492
  * **Example** (Scheduling repeated execution)
16727
17493
  *
16728
17494
  * ```ts import.meta.vitest
@@ -16765,6 +17531,8 @@ export const schedule: {
16765
17531
  * fails, and otherwise succeeds with the schedule output when the schedule
16766
17532
  * completes.
16767
17533
  *
17534
+ * Scheduled delays use the context's `Clock`.
17535
+ *
16768
17536
  * **Example** (Scheduling repeated execution)
16769
17537
  *
16770
17538
  * ```ts import.meta.vitest
@@ -16807,6 +17575,8 @@ export const schedule: {
16807
17575
  * succeeds with the schedule output when the schedule completes and fails if
16808
17576
  * the effect or schedule fails.
16809
17577
  *
17578
+ * Scheduled delays use the context's `Clock`.
17579
+ *
16810
17580
  * **Example** (Scheduling from an initial value)
16811
17581
  *
16812
17582
  * ```ts import.meta.vitest
@@ -16847,6 +17617,8 @@ export const scheduleFrom: {
16847
17617
  * succeeds with the schedule output when the schedule completes and fails if
16848
17618
  * the effect or schedule fails.
16849
17619
  *
17620
+ * Scheduled delays use the context's `Clock`.
17621
+ *
16850
17622
  * **Example** (Scheduling from an initial value)
16851
17623
  *
16852
17624
  * ```ts import.meta.vitest
@@ -16887,6 +17659,8 @@ export const scheduleFrom: {
16887
17659
  * succeeds with the schedule output when the schedule completes and fails if
16888
17660
  * the effect or schedule fails.
16889
17661
  *
17662
+ * Scheduled delays use the context's `Clock`.
17663
+ *
16890
17664
  * **Example** (Scheduling from an initial value)
16891
17665
  *
16892
17666
  * ```ts import.meta.vitest
@@ -17302,6 +18076,11 @@ export const annotateSpans: {
17302
18076
  /**
17303
18077
  * Adds an annotation to the current span if available.
17304
18078
  *
18079
+ * **Details**
18080
+ *
18081
+ * Does nothing when there is no current span or when the nearest parent span is
18082
+ * an `ExternalSpan`.
18083
+ *
17305
18084
  * **Example** (Annotating the current span)
17306
18085
  *
17307
18086
  * ```ts import.meta.vitest
@@ -17327,6 +18106,11 @@ export const annotateCurrentSpan: {
17327
18106
  /**
17328
18107
  * Adds an annotation to the current span if available.
17329
18108
  *
18109
+ * **Details**
18110
+ *
18111
+ * Does nothing when there is no current span or when the nearest parent span is
18112
+ * an `ExternalSpan`.
18113
+ *
17330
18114
  * **Example** (Annotating the current span)
17331
18115
  *
17332
18116
  * ```ts import.meta.vitest
@@ -17352,6 +18136,11 @@ export const annotateCurrentSpan: {
17352
18136
  /**
17353
18137
  * Adds an annotation to the current span if available.
17354
18138
  *
18139
+ * **Details**
18140
+ *
18141
+ * Does nothing when there is no current span or when the nearest parent span is
18142
+ * an `ExternalSpan`.
18143
+ *
17355
18144
  * **Example** (Annotating the current span)
17356
18145
  *
17357
18146
  * ```ts import.meta.vitest
@@ -17381,8 +18170,9 @@ export const annotateCurrentSpan: {
17381
18170
  *
17382
18171
  * **Details**
17383
18172
  *
17384
- * The effect fails with `NoSuchElementError` when there is no active local
17385
- * `Span`.
18173
+ * The effect fails with `NoSuchElementError` when there is no parent span or
18174
+ * when the nearest parent span is an `ExternalSpan`. Use `currentParentSpan` to
18175
+ * read either kind.
17386
18176
  *
17387
18177
  * **Example** (Reading the current span)
17388
18178
  *
@@ -18192,9 +18982,7 @@ export const requestUnsafe: <A extends Request.Any>(
18192
18982
  // -----------------------------------------------------------------------------
18193
18983
 
18194
18984
  /**
18195
- * Returns an effect that forks this effect into its own separate fiber,
18196
- * returning the fiber immediately, without waiting for it to begin executing
18197
- * the effect.
18985
+ * Forks this effect into a child fiber and returns its handle.
18198
18986
  *
18199
18987
  * **Details**
18200
18988
  *
@@ -18214,6 +19002,18 @@ export const requestUnsafe: <A extends Request.Any>(
18214
19002
  * fibers leak. This behavior is called "auto supervision", and if this
18215
19003
  * behavior is not desired, you may use the `forkDetach` or `forkIn` methods.
18216
19004
  *
19005
+ * Fork options:
19006
+ *
19007
+ * - `startImmediately` defaults to `false`: the fork returns before the new
19008
+ * fiber runs, without promising a scheduler turn. With `true`, the fiber
19009
+ * runs synchronously until it suspends, yields, or completes before the fork
19010
+ * returns.
19011
+ * - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
19012
+ * With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
19013
+ * completion without replacing its result. Explicit `Effect.interruptible`
19014
+ * regions can still be interrupted. `"inherit"` copies the caller's
19015
+ * interruptibility at the fork.
19016
+ *
18217
19017
  * **Example** (Forking a child fiber)
18218
19018
  *
18219
19019
  * ```ts import.meta.vitest
@@ -18255,6 +19055,33 @@ export const forkChild: <
18255
19055
  * Forks the effect in the specified scope. The fiber will be interrupted
18256
19056
  * when the scope is closed.
18257
19057
  *
19058
+ * **Details**
19059
+ *
19060
+ * The scope owns the fiber, not the forker: it can outlive the forker's
19061
+ * completion or interruption. Closing the scope from another fiber interrupts
19062
+ * it and waits for completion, including finalizers.
19063
+ *
19064
+ * Forking and registration are interruption-safe: interrupting the forker
19065
+ * cannot leave the new fiber outside the scope. If the scope is already
19066
+ * closed, the effect is not started and the returned fiber is interrupted.
19067
+ *
19068
+ * Fork options:
19069
+ *
19070
+ * - `startImmediately` defaults to `false`: the fork returns before the new
19071
+ * fiber runs, without promising a scheduler turn. With `true`, the fiber
19072
+ * runs synchronously until it suspends, yields, or completes before the fork
19073
+ * returns.
19074
+ * - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
19075
+ * With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
19076
+ * completion without replacing its result. Explicit `Effect.interruptible`
19077
+ * regions can still be interrupted. `"inherit"` copies the caller's
19078
+ * interruptibility at the fork.
19079
+ *
19080
+ * **Gotchas**
19081
+ *
19082
+ * A fiber that closes its own scope is not interrupted or awaited by that
19083
+ * close. An uninterruptible fiber can delay scope closure.
19084
+ *
18258
19085
  * **Example** (Forking into a supplied scope)
18259
19086
  *
18260
19087
  * ```ts import.meta.vitest
@@ -18283,6 +19110,33 @@ export const forkIn: {
18283
19110
  * Forks the effect in the specified scope. The fiber will be interrupted
18284
19111
  * when the scope is closed.
18285
19112
  *
19113
+ * **Details**
19114
+ *
19115
+ * The scope owns the fiber, not the forker: it can outlive the forker's
19116
+ * completion or interruption. Closing the scope from another fiber interrupts
19117
+ * it and waits for completion, including finalizers.
19118
+ *
19119
+ * Forking and registration are interruption-safe: interrupting the forker
19120
+ * cannot leave the new fiber outside the scope. If the scope is already
19121
+ * closed, the effect is not started and the returned fiber is interrupted.
19122
+ *
19123
+ * Fork options:
19124
+ *
19125
+ * - `startImmediately` defaults to `false`: the fork returns before the new
19126
+ * fiber runs, without promising a scheduler turn. With `true`, the fiber
19127
+ * runs synchronously until it suspends, yields, or completes before the fork
19128
+ * returns.
19129
+ * - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
19130
+ * With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
19131
+ * completion without replacing its result. Explicit `Effect.interruptible`
19132
+ * regions can still be interrupted. `"inherit"` copies the caller's
19133
+ * interruptibility at the fork.
19134
+ *
19135
+ * **Gotchas**
19136
+ *
19137
+ * A fiber that closes its own scope is not interrupted or awaited by that
19138
+ * close. An uninterruptible fiber can delay scope closure.
19139
+ *
18286
19140
  * **Example** (Forking into a supplied scope)
18287
19141
  *
18288
19142
  * ```ts import.meta.vitest
@@ -18317,6 +19171,33 @@ export const forkIn: {
18317
19171
  * Forks the effect in the specified scope. The fiber will be interrupted
18318
19172
  * when the scope is closed.
18319
19173
  *
19174
+ * **Details**
19175
+ *
19176
+ * The scope owns the fiber, not the forker: it can outlive the forker's
19177
+ * completion or interruption. Closing the scope from another fiber interrupts
19178
+ * it and waits for completion, including finalizers.
19179
+ *
19180
+ * Forking and registration are interruption-safe: interrupting the forker
19181
+ * cannot leave the new fiber outside the scope. If the scope is already
19182
+ * closed, the effect is not started and the returned fiber is interrupted.
19183
+ *
19184
+ * Fork options:
19185
+ *
19186
+ * - `startImmediately` defaults to `false`: the fork returns before the new
19187
+ * fiber runs, without promising a scheduler turn. With `true`, the fiber
19188
+ * runs synchronously until it suspends, yields, or completes before the fork
19189
+ * returns.
19190
+ * - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
19191
+ * With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
19192
+ * completion without replacing its result. Explicit `Effect.interruptible`
19193
+ * regions can still be interrupted. `"inherit"` copies the caller's
19194
+ * interruptibility at the fork.
19195
+ *
19196
+ * **Gotchas**
19197
+ *
19198
+ * A fiber that closes its own scope is not interrupted or awaited by that
19199
+ * close. An uninterruptible fiber can delay scope closure.
19200
+ *
18320
19201
  * **Example** (Forking into a supplied scope)
18321
19202
  *
18322
19203
  * ```ts import.meta.vitest
@@ -18353,6 +19234,33 @@ export const forkIn: {
18353
19234
  /**
18354
19235
  * Forks the fiber in a `Scope`, interrupting it when the scope is closed.
18355
19236
  *
19237
+ * **Details**
19238
+ *
19239
+ * The scope owns the fiber, not the forker: it can outlive the forker's
19240
+ * completion or interruption. Closing the scope from another fiber interrupts
19241
+ * it and waits for completion, including finalizers.
19242
+ *
19243
+ * Forking and registration are interruption-safe: interrupting the forker
19244
+ * cannot leave the new fiber outside the scope. If the scope is already
19245
+ * closed, the effect is not started and the returned fiber is interrupted.
19246
+ *
19247
+ * Fork options:
19248
+ *
19249
+ * - `startImmediately` defaults to `false`: the fork returns before the new
19250
+ * fiber runs, without promising a scheduler turn. With `true`, the fiber
19251
+ * runs synchronously until it suspends, yields, or completes before the fork
19252
+ * returns.
19253
+ * - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
19254
+ * With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
19255
+ * completion without replacing its result. Explicit `Effect.interruptible`
19256
+ * regions can still be interrupted. `"inherit"` copies the caller's
19257
+ * interruptibility at the fork.
19258
+ *
19259
+ * **Gotchas**
19260
+ *
19261
+ * A fiber that closes its own scope is not interrupted or awaited by that
19262
+ * close. An uninterruptible fiber can delay scope closure.
19263
+ *
18356
19264
  * **Example** (Forking into the current scope)
18357
19265
  *
18358
19266
  * ```ts import.meta.vitest
@@ -18403,6 +19311,18 @@ export const forkScoped: <
18403
19311
  * until it completes or is explicitly interrupted through the returned handle,
18404
19312
  * even after the forking fiber terminates.
18405
19313
  *
19314
+ * Fork options:
19315
+ *
19316
+ * - `startImmediately` defaults to `false`: the fork returns before the new
19317
+ * fiber runs, without promising a scheduler turn. With `true`, the fiber
19318
+ * runs synchronously until it suspends, yields, or completes before the fork
19319
+ * returns.
19320
+ * - `uninterruptible` defaults to `false`, even in an uninterruptible caller.
19321
+ * With `true`, the fiber starts uninterruptible: `Fiber.interrupt` waits for
19322
+ * completion without replacing its result. Explicit `Effect.interruptible`
19323
+ * regions can still be interrupted. `"inherit"` copies the caller's
19324
+ * interruptibility at the fork.
19325
+ *
18406
19326
  * **Example** (Forking a detached fiber)
18407
19327
  *
18408
19328
  * ```ts import.meta.vitest
@@ -18525,9 +19445,9 @@ export const fiberId: Effect<number> = internal.fiberId
18525
19445
  *
18526
19446
  * **Details**
18527
19447
  *
18528
- * `signal` interrupts the fiber, `scheduler` provides the scheduler service,
18529
- * `uninterruptible` starts the fiber uninterruptibly, and `onFiberStart`
18530
- * receives the created fiber.
19448
+ * `signal` can interrupt the fiber, and `scheduler` provides the scheduler
19449
+ * service. The fiber starts interruptible unless `uninterruptible: true` is
19450
+ * set.
18531
19451
  *
18532
19452
  * @see {@link runFork} for starting a fiber with these options
18533
19453
  * @see {@link runCallback} for callback-based running with these options
@@ -18553,6 +19473,12 @@ export interface RunOptions {
18553
19473
  *
18554
19474
  * Use when you need to start an effect in the background and receive a fiber.
18555
19475
  *
19476
+ * **Details**
19477
+ *
19478
+ * The fiber starts immediately and runs synchronously until it suspends,
19479
+ * yields, or completes. It starts interruptible unless `uninterruptible: true`
19480
+ * is set.
19481
+ *
18556
19482
  * **Example** (Running an effect in the background)
18557
19483
  *
18558
19484
  * ```ts import.meta.vitest
@@ -18571,6 +19497,8 @@ export interface RunOptions {
18571
19497
  * output // => ["running...", "done"]
18572
19498
  * ```
18573
19499
  *
19500
+ * @see {@link RunOptions} for configuring the fiber
19501
+ * @see {@link forkChild} for starting a child of the current fiber
18574
19502
  * @stability stable
18575
19503
  * @category running
18576
19504
  * @since 2.0.0
@@ -18586,6 +19514,12 @@ export const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunOptions |
18586
19514
  * Use when an effect still requires services, you already have a `Context`, and
18587
19515
  * you want a background fiber.
18588
19516
  *
19517
+ * **Details**
19518
+ *
19519
+ * The fiber starts immediately and runs synchronously until it suspends,
19520
+ * yields, or completes. It starts interruptible unless `uninterruptible: true`
19521
+ * is set.
19522
+ *
18589
19523
  * **Example** (Running with services in the background)
18590
19524
  *
18591
19525
  * ```ts import.meta.vitest
@@ -18613,6 +19547,8 @@ export const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunOptions |
18613
19547
  * output // => ["Hello from service!", "done"]
18614
19548
  * ```
18615
19549
  *
19550
+ * @see {@link RunOptions} for configuring the fiber
19551
+ * @see {@link forkChild} for starting a child of the current fiber
18616
19552
  * @stability stable
18617
19553
  * @category running
18618
19554
  * @since 4.0.0
@@ -26549,6 +27485,8 @@ export const tx = <A, E, R>(
26549
27485
  if (!internal.hasInterruptsOnly(cause)) return sync(() => clearTransaction(mutable))
26550
27486
  return restore(awaitPendingTransaction(mutable))
26551
27487
  }),
27488
+ // A body that recovers the txRetry interrupt succeeds with retry still set, so wait here too.
27489
+ tap(() => mutable.retry ? restore(awaitPendingTransaction(mutable)) : void_),
26552
27490
  exit
26553
27491
  )
26554
27492
  return flatMap(