effect 4.0.5 → 4.0.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 (985) hide show
  1. package/ai-docs/package.json +1 -1
  2. package/ai-docs/src/06_schedule/10_schedules.ts +5 -4
  3. package/ai-docs/tsconfig.json +3 -1
  4. package/dist/Array.d.ts +117 -52
  5. package/dist/Array.d.ts.map +1 -1
  6. package/dist/Array.js +41 -20
  7. package/dist/Array.js.map +1 -1
  8. package/dist/Bytes.d.ts +79 -0
  9. package/dist/Bytes.d.ts.map +1 -0
  10. package/dist/Bytes.js +109 -0
  11. package/dist/Bytes.js.map +1 -0
  12. package/dist/Channel.d.ts +181 -13
  13. package/dist/Channel.d.ts.map +1 -1
  14. package/dist/Channel.js +125 -30
  15. package/dist/Channel.js.map +1 -1
  16. package/dist/ChannelSchema.d.ts.map +1 -1
  17. package/dist/ChannelSchema.js.map +1 -1
  18. package/dist/Chunk.d.ts +39 -21
  19. package/dist/Chunk.d.ts.map +1 -1
  20. package/dist/Chunk.js +26 -17
  21. package/dist/Chunk.js.map +1 -1
  22. package/dist/Config.d.ts.map +1 -1
  23. package/dist/Config.js +8 -3
  24. package/dist/Config.js.map +1 -1
  25. package/dist/ConfigProvider.d.ts.map +1 -1
  26. package/dist/ConfigProvider.js +2 -1
  27. package/dist/ConfigProvider.js.map +1 -1
  28. package/dist/Cron.d.ts +2 -2
  29. package/dist/Cron.d.ts.map +1 -1
  30. package/dist/Cron.js +6 -3
  31. package/dist/Cron.js.map +1 -1
  32. package/dist/Duration.d.ts.map +1 -1
  33. package/dist/Duration.js +56 -16
  34. package/dist/Duration.js.map +1 -1
  35. package/dist/Effect.d.ts +487 -163
  36. package/dist/Effect.d.ts.map +1 -1
  37. package/dist/Effect.js +203 -37
  38. package/dist/Effect.js.map +1 -1
  39. package/dist/Equivalence.d.ts +2 -1
  40. package/dist/Equivalence.d.ts.map +1 -1
  41. package/dist/Equivalence.js +12 -8
  42. package/dist/Equivalence.js.map +1 -1
  43. package/dist/Exit.d.ts +24 -9
  44. package/dist/Exit.d.ts.map +1 -1
  45. package/dist/Exit.js +8 -3
  46. package/dist/Exit.js.map +1 -1
  47. package/dist/FiberHandle.d.ts +2 -0
  48. package/dist/FiberHandle.d.ts.map +1 -1
  49. package/dist/FiberHandle.js +9 -4
  50. package/dist/FiberHandle.js.map +1 -1
  51. package/dist/FiberMap.d.ts +2 -0
  52. package/dist/FiberMap.d.ts.map +1 -1
  53. package/dist/FiberMap.js +5 -2
  54. package/dist/FiberMap.js.map +1 -1
  55. package/dist/FileSystem.d.ts +5 -0
  56. package/dist/FileSystem.d.ts.map +1 -1
  57. package/dist/FileSystem.js +3 -0
  58. package/dist/FileSystem.js.map +1 -1
  59. package/dist/Graph.d.ts.map +1 -1
  60. package/dist/Graph.js.map +1 -1
  61. package/dist/HashSet.d.ts.map +1 -1
  62. package/dist/HashSet.js.map +1 -1
  63. package/dist/Iterable.d.ts.map +1 -1
  64. package/dist/Iterable.js +18 -17
  65. package/dist/Iterable.js.map +1 -1
  66. package/dist/JsonSchema.d.ts +9 -3
  67. package/dist/JsonSchema.d.ts.map +1 -1
  68. package/dist/JsonSchema.js +19 -3
  69. package/dist/JsonSchema.js.map +1 -1
  70. package/dist/Layer.d.ts.map +1 -1
  71. package/dist/Layer.js +2 -2
  72. package/dist/Layer.js.map +1 -1
  73. package/dist/ManagedRuntime.d.ts +19 -1
  74. package/dist/ManagedRuntime.d.ts.map +1 -1
  75. package/dist/ManagedRuntime.js +62 -6
  76. package/dist/ManagedRuntime.js.map +1 -1
  77. package/dist/Metric.d.ts +132 -0
  78. package/dist/Metric.d.ts.map +1 -1
  79. package/dist/Metric.js +197 -25
  80. package/dist/Metric.js.map +1 -1
  81. package/dist/MutableHashMap.d.ts.map +1 -1
  82. package/dist/MutableHashMap.js.map +1 -1
  83. package/dist/Number.js +2 -2
  84. package/dist/Number.js.map +1 -1
  85. package/dist/Optic.d.ts.map +1 -1
  86. package/dist/Optic.js.map +1 -1
  87. package/dist/Path.d.ts.map +1 -1
  88. package/dist/Path.js +8 -1
  89. package/dist/Path.js.map +1 -1
  90. package/dist/PubSub.d.ts.map +1 -1
  91. package/dist/PubSub.js +12 -7
  92. package/dist/PubSub.js.map +1 -1
  93. package/dist/Queue.d.ts +4 -1
  94. package/dist/Queue.d.ts.map +1 -1
  95. package/dist/Queue.js +4 -1
  96. package/dist/Queue.js.map +1 -1
  97. package/dist/Random.d.ts.map +1 -1
  98. package/dist/Random.js +1 -1
  99. package/dist/Random.js.map +1 -1
  100. package/dist/RcMap.d.ts +12 -7
  101. package/dist/RcMap.d.ts.map +1 -1
  102. package/dist/RcMap.js +9 -6
  103. package/dist/RcMap.js.map +1 -1
  104. package/dist/Record.d.ts +51 -0
  105. package/dist/Record.d.ts.map +1 -1
  106. package/dist/Record.js +17 -0
  107. package/dist/Record.js.map +1 -1
  108. package/dist/Ref.d.ts.map +1 -1
  109. package/dist/Ref.js.map +1 -1
  110. package/dist/References.d.ts +5 -4
  111. package/dist/References.d.ts.map +1 -1
  112. package/dist/References.js +5 -4
  113. package/dist/References.js.map +1 -1
  114. package/dist/RequestResolver.d.ts +31 -1
  115. package/dist/RequestResolver.d.ts.map +1 -1
  116. package/dist/RequestResolver.js +39 -4
  117. package/dist/RequestResolver.js.map +1 -1
  118. package/dist/Resource.js +1 -1
  119. package/dist/Resource.js.map +1 -1
  120. package/dist/Runtime.d.ts +3 -3
  121. package/dist/Runtime.d.ts.map +1 -1
  122. package/dist/Runtime.js +18 -15
  123. package/dist/Runtime.js.map +1 -1
  124. package/dist/Schedule.d.ts.map +1 -1
  125. package/dist/Schedule.js.map +1 -1
  126. package/dist/Schema.d.ts +384 -332
  127. package/dist/Schema.d.ts.map +1 -1
  128. package/dist/Schema.js +333 -19
  129. package/dist/Schema.js.map +1 -1
  130. package/dist/SchemaAST.d.ts +5 -5
  131. package/dist/SchemaAST.d.ts.map +1 -1
  132. package/dist/SchemaAST.js +24 -8
  133. package/dist/SchemaAST.js.map +1 -1
  134. package/dist/SchemaGetter.d.ts +8 -3
  135. package/dist/SchemaGetter.d.ts.map +1 -1
  136. package/dist/SchemaGetter.js +15 -5
  137. package/dist/SchemaGetter.js.map +1 -1
  138. package/dist/SchemaIssue.d.ts +4 -4
  139. package/dist/SchemaIssue.d.ts.map +1 -1
  140. package/dist/SchemaIssue.js +29 -51
  141. package/dist/SchemaIssue.js.map +1 -1
  142. package/dist/SchemaRepresentation.d.ts +56 -1
  143. package/dist/SchemaRepresentation.d.ts.map +1 -1
  144. package/dist/SchemaRepresentation.js +18 -0
  145. package/dist/SchemaRepresentation.js.map +1 -1
  146. package/dist/SchemaTransformation.d.ts +1 -1
  147. package/dist/SchemaTransformation.js +1 -1
  148. package/dist/Scope.d.ts +12 -2
  149. package/dist/Scope.d.ts.map +1 -1
  150. package/dist/Scope.js +5 -0
  151. package/dist/Scope.js.map +1 -1
  152. package/dist/ScopedCache.d.ts +10 -7
  153. package/dist/ScopedCache.d.ts.map +1 -1
  154. package/dist/ScopedCache.js +9 -5
  155. package/dist/ScopedCache.js.map +1 -1
  156. package/dist/SemVer.d.ts +1196 -0
  157. package/dist/SemVer.d.ts.map +1 -0
  158. package/dist/SemVer.js +756 -0
  159. package/dist/SemVer.js.map +1 -0
  160. package/dist/SemVerRange.d.ts +559 -0
  161. package/dist/SemVerRange.d.ts.map +1 -0
  162. package/dist/SemVerRange.js +551 -0
  163. package/dist/SemVerRange.js.map +1 -0
  164. package/dist/Sink.d.ts.map +1 -1
  165. package/dist/Sink.js +6 -2
  166. package/dist/Sink.js.map +1 -1
  167. package/dist/Stream.d.ts +235 -8
  168. package/dist/Stream.d.ts.map +1 -1
  169. package/dist/Stream.js +145 -60
  170. package/dist/Stream.js.map +1 -1
  171. package/dist/String.d.ts +4 -2
  172. package/dist/String.d.ts.map +1 -1
  173. package/dist/String.js +8 -6
  174. package/dist/String.js.map +1 -1
  175. package/dist/TextDiff.d.ts +399 -0
  176. package/dist/TextDiff.d.ts.map +1 -0
  177. package/dist/TextDiff.js +634 -0
  178. package/dist/TextDiff.js.map +1 -0
  179. package/dist/TxHashMap.d.ts.map +1 -1
  180. package/dist/TxHashMap.js.map +1 -1
  181. package/dist/TxHashSet.d.ts.map +1 -1
  182. package/dist/TxHashSet.js.map +1 -1
  183. package/dist/ai/AiError.d.ts +68 -4
  184. package/dist/ai/AiError.d.ts.map +1 -1
  185. package/dist/ai/AiError.js +50 -2
  186. package/dist/ai/AiError.js.map +1 -1
  187. package/dist/ai/Chat.d.ts +1 -2
  188. package/dist/ai/Chat.d.ts.map +1 -1
  189. package/dist/ai/Chat.js +6 -3
  190. package/dist/ai/Chat.js.map +1 -1
  191. package/dist/ai/Decision.d.ts +46 -1
  192. package/dist/ai/Decision.d.ts.map +1 -1
  193. package/dist/ai/Decision.js.map +1 -1
  194. package/dist/ai/DecisionModel.d.ts +129 -11
  195. package/dist/ai/DecisionModel.d.ts.map +1 -1
  196. package/dist/ai/DecisionModel.js +182 -94
  197. package/dist/ai/DecisionModel.js.map +1 -1
  198. package/dist/ai/EmbeddingModel.d.ts +10 -0
  199. package/dist/ai/EmbeddingModel.d.ts.map +1 -1
  200. package/dist/ai/EmbeddingModel.js +21 -7
  201. package/dist/ai/EmbeddingModel.js.map +1 -1
  202. package/dist/ai/McpClient.d.ts +289 -0
  203. package/dist/ai/McpClient.d.ts.map +1 -0
  204. package/dist/ai/McpClient.js +819 -0
  205. package/dist/ai/McpClient.js.map +1 -0
  206. package/dist/ai/McpClientError.d.ts +254 -0
  207. package/dist/ai/McpClientError.d.ts.map +1 -0
  208. package/dist/ai/McpClientError.js +260 -0
  209. package/dist/ai/McpClientError.js.map +1 -0
  210. package/dist/ai/McpProtocol.d.ts +2 -2
  211. package/dist/ai/McpProtocol.d.ts.map +1 -1
  212. package/dist/ai/McpSchema.d.ts +368 -235
  213. package/dist/ai/McpSchema.d.ts.map +1 -1
  214. package/dist/ai/McpSchema.js +94 -24
  215. package/dist/ai/McpSchema.js.map +1 -1
  216. package/dist/ai/McpServer.d.ts.map +1 -1
  217. package/dist/ai/McpServer.js +25 -22
  218. package/dist/ai/McpServer.js.map +1 -1
  219. package/dist/ai/Prompt.d.ts +22 -20
  220. package/dist/ai/Prompt.d.ts.map +1 -1
  221. package/dist/ai/Prompt.js +23 -1
  222. package/dist/ai/Prompt.js.map +1 -1
  223. package/dist/ai/Response.d.ts +147 -3
  224. package/dist/ai/Response.d.ts.map +1 -1
  225. package/dist/ai/Response.js +35 -37
  226. package/dist/ai/Response.js.map +1 -1
  227. package/dist/ai/Tool.d.ts +12 -4
  228. package/dist/ai/Tool.d.ts.map +1 -1
  229. package/dist/ai/Tool.js.map +1 -1
  230. package/dist/ai/Toolkit.d.ts +48 -1
  231. package/dist/ai/Toolkit.d.ts.map +1 -1
  232. package/dist/ai/Toolkit.js +65 -12
  233. package/dist/ai/Toolkit.js.map +1 -1
  234. package/dist/ai/index.d.ts +10 -0
  235. package/dist/ai/index.d.ts.map +1 -1
  236. package/dist/ai/index.js +10 -0
  237. package/dist/ai/index.js.map +1 -1
  238. package/dist/ai/internal/mcpCore.js.map +1 -1
  239. package/dist/ai/internal/mcpProtocol/v2024_11_05.js +1 -1
  240. package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
  241. package/dist/ai/internal/mcpProtocol/v2025_03_26.js +1 -1
  242. package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
  243. package/dist/ai/internal/mcpProtocol/v2025_06_18.js +2 -2
  244. package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
  245. package/dist/ai/internal/mcpProtocol/v2025_11_25.js +2 -2
  246. package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
  247. package/dist/ai/internal/mcpProtocol/v2026_07_28.js +4 -7
  248. package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
  249. package/dist/ai/internal/mcpProtocol.js +16 -2
  250. package/dist/ai/internal/mcpProtocol.js.map +1 -1
  251. package/dist/ai/internal/mcpRuntime.js +3 -4
  252. package/dist/ai/internal/mcpRuntime.js.map +1 -1
  253. package/dist/ai/internal/mcpSchema/v2024_11_05.js +19 -13
  254. package/dist/ai/internal/mcpSchema/v2024_11_05.js.map +1 -1
  255. package/dist/ai/internal/mcpSchema/v2025_03_26.js +3 -2
  256. package/dist/ai/internal/mcpSchema/v2025_03_26.js.map +1 -1
  257. package/dist/ai/internal/mcpSchema/v2025_06_18.js +7 -7
  258. package/dist/ai/internal/mcpSchema/v2025_06_18.js.map +1 -1
  259. package/dist/ai/internal/mcpSchema/v2025_11_25.js +8 -8
  260. package/dist/ai/internal/mcpSchema/v2025_11_25.js.map +1 -1
  261. package/dist/ai/internal/mcpSchema/v2026_07_28.js +43 -42
  262. package/dist/ai/internal/mcpSchema/v2026_07_28.js.map +1 -1
  263. package/dist/cli/CliError.d.ts +42 -2
  264. package/dist/cli/CliError.d.ts.map +1 -1
  265. package/dist/cli/CliError.js +44 -5
  266. package/dist/cli/CliError.js.map +1 -1
  267. package/dist/cli/Command.d.ts +286 -2
  268. package/dist/cli/Command.d.ts.map +1 -1
  269. package/dist/cli/Command.js +107 -6
  270. package/dist/cli/Command.js.map +1 -1
  271. package/dist/cli/Completions.d.ts +5 -0
  272. package/dist/cli/Completions.d.ts.map +1 -1
  273. package/dist/cli/Completions.js.map +1 -1
  274. package/dist/cli/Flag.d.ts +115 -0
  275. package/dist/cli/Flag.d.ts.map +1 -1
  276. package/dist/cli/Flag.js +56 -0
  277. package/dist/cli/Flag.js.map +1 -1
  278. package/dist/cli/GlobalFlag.d.ts.map +1 -1
  279. package/dist/cli/GlobalFlag.js +3 -3
  280. package/dist/cli/GlobalFlag.js.map +1 -1
  281. package/dist/cli/Param.d.ts +107 -0
  282. package/dist/cli/Param.d.ts.map +1 -1
  283. package/dist/cli/Param.js +56 -0
  284. package/dist/cli/Param.js.map +1 -1
  285. package/dist/cli/TerminalCapabilities.d.ts +84 -0
  286. package/dist/cli/TerminalCapabilities.d.ts.map +1 -0
  287. package/dist/cli/TerminalCapabilities.js +122 -0
  288. package/dist/cli/TerminalCapabilities.js.map +1 -0
  289. package/dist/cli/index.d.ts +5 -0
  290. package/dist/cli/index.d.ts.map +1 -1
  291. package/dist/cli/index.js +5 -0
  292. package/dist/cli/index.js.map +1 -1
  293. package/dist/cli/internal/command.d.ts +2 -1
  294. package/dist/cli/internal/command.d.ts.map +1 -1
  295. package/dist/cli/internal/command.js +5 -2
  296. package/dist/cli/internal/command.js.map +1 -1
  297. package/dist/cli/internal/completions/bash.js +4 -3
  298. package/dist/cli/internal/completions/bash.js.map +1 -1
  299. package/dist/cli/internal/completions/descriptor.js +9 -1
  300. package/dist/cli/internal/completions/descriptor.js.map +1 -1
  301. package/dist/cli/internal/completions/fish.js +10 -8
  302. package/dist/cli/internal/completions/fish.js.map +1 -1
  303. package/dist/cli/internal/completions/powershell.js +18 -9
  304. package/dist/cli/internal/completions/powershell.js.map +1 -1
  305. package/dist/cli/internal/completions/zsh.js +8 -5
  306. package/dist/cli/internal/completions/zsh.js.map +1 -1
  307. package/dist/cli/internal/formatter.d.ts +2 -0
  308. package/dist/cli/internal/formatter.d.ts.map +1 -0
  309. package/dist/cli/internal/formatter.js +15 -0
  310. package/dist/cli/internal/formatter.js.map +1 -0
  311. package/dist/cli/internal/lexer.js +24 -10
  312. package/dist/cli/internal/lexer.js.map +1 -1
  313. package/dist/cli/internal/parser.js +24 -12
  314. package/dist/cli/internal/parser.js.map +1 -1
  315. package/dist/cluster/ClusterCron.d.ts +29 -1
  316. package/dist/cluster/ClusterCron.d.ts.map +1 -1
  317. package/dist/cluster/ClusterCron.js +64 -32
  318. package/dist/cluster/ClusterCron.js.map +1 -1
  319. package/dist/cluster/ClusterMetrics.d.ts +143 -7
  320. package/dist/cluster/ClusterMetrics.d.ts.map +1 -1
  321. package/dist/cluster/ClusterMetrics.js +151 -7
  322. package/dist/cluster/ClusterMetrics.js.map +1 -1
  323. package/dist/cluster/ClusterWorkflowEngine.d.ts +1 -1
  324. package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  325. package/dist/cluster/ClusterWorkflowEngine.js +37 -11
  326. package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
  327. package/dist/cluster/Entity.d.ts +2 -0
  328. package/dist/cluster/Entity.d.ts.map +1 -1
  329. package/dist/cluster/Entity.js.map +1 -1
  330. package/dist/cluster/MessageStorage.d.ts +21 -0
  331. package/dist/cluster/MessageStorage.d.ts.map +1 -1
  332. package/dist/cluster/MessageStorage.js.map +1 -1
  333. package/dist/cluster/Runners.d.ts.map +1 -1
  334. package/dist/cluster/Runners.js +54 -15
  335. package/dist/cluster/Runners.js.map +1 -1
  336. package/dist/cluster/Sharding.d.ts +1 -0
  337. package/dist/cluster/Sharding.d.ts.map +1 -1
  338. package/dist/cluster/Sharding.js +95 -32
  339. package/dist/cluster/Sharding.js.map +1 -1
  340. package/dist/cluster/ShardingConfig.d.ts +20 -0
  341. package/dist/cluster/ShardingConfig.d.ts.map +1 -1
  342. package/dist/cluster/ShardingConfig.js +4 -0
  343. package/dist/cluster/ShardingConfig.js.map +1 -1
  344. package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
  345. package/dist/cluster/SqlMessageStorage.js +40 -50
  346. package/dist/cluster/SqlMessageStorage.js.map +1 -1
  347. package/dist/cluster/SqlRunnerStorage.d.ts +2 -2
  348. package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
  349. package/dist/cluster/SqlRunnerStorage.js +10 -4
  350. package/dist/cluster/SqlRunnerStorage.js.map +1 -1
  351. package/dist/cluster/internal/entityManager.js +65 -8
  352. package/dist/cluster/internal/entityManager.js.map +1 -1
  353. package/dist/devtools/DevTools.d.ts +3 -2
  354. package/dist/devtools/DevTools.d.ts.map +1 -1
  355. package/dist/devtools/DevTools.js +3 -2
  356. package/dist/devtools/DevTools.js.map +1 -1
  357. package/dist/devtools/DevToolsClient.d.ts +11 -0
  358. package/dist/devtools/DevToolsClient.d.ts.map +1 -1
  359. package/dist/devtools/DevToolsClient.js +31 -4
  360. package/dist/devtools/DevToolsClient.js.map +1 -1
  361. package/dist/encoding/Base64Url.d.ts +29 -0
  362. package/dist/encoding/Base64Url.d.ts.map +1 -1
  363. package/dist/encoding/Base64Url.js +29 -0
  364. package/dist/encoding/Base64Url.js.map +1 -1
  365. package/dist/encoding/Ini.d.ts.map +1 -1
  366. package/dist/encoding/Ini.js +3 -0
  367. package/dist/encoding/Ini.js.map +1 -1
  368. package/dist/encoding/JsonArray.d.ts +270 -0
  369. package/dist/encoding/JsonArray.d.ts.map +1 -0
  370. package/dist/encoding/JsonArray.js +691 -0
  371. package/dist/encoding/JsonArray.js.map +1 -0
  372. package/dist/encoding/Ndjson.d.ts +43 -4
  373. package/dist/encoding/Ndjson.d.ts.map +1 -1
  374. package/dist/encoding/Ndjson.js +169 -18
  375. package/dist/encoding/Ndjson.js.map +1 -1
  376. package/dist/encoding/SchemaBinary.d.ts +9 -1
  377. package/dist/encoding/SchemaBinary.d.ts.map +1 -1
  378. package/dist/encoding/SchemaBinary.js +12 -19
  379. package/dist/encoding/SchemaBinary.js.map +1 -1
  380. package/dist/encoding/Tar.d.ts +309 -0
  381. package/dist/encoding/Tar.d.ts.map +1 -0
  382. package/dist/encoding/Tar.js +1182 -0
  383. package/dist/encoding/Tar.js.map +1 -0
  384. package/dist/encoding/Toml.js +3 -3
  385. package/dist/encoding/Toml.js.map +1 -1
  386. package/dist/encoding/Xml.d.ts +464 -0
  387. package/dist/encoding/Xml.d.ts.map +1 -0
  388. package/dist/encoding/Xml.js +1619 -0
  389. package/dist/encoding/Xml.js.map +1 -0
  390. package/dist/encoding/Yaml.d.ts +6 -2
  391. package/dist/encoding/Yaml.d.ts.map +1 -1
  392. package/dist/encoding/Yaml.js +97 -34
  393. package/dist/encoding/Yaml.js.map +1 -1
  394. package/dist/encoding/Zip.d.ts +413 -0
  395. package/dist/encoding/Zip.d.ts.map +1 -0
  396. package/dist/encoding/Zip.js +1255 -0
  397. package/dist/encoding/Zip.js.map +1 -0
  398. package/dist/encoding/index.d.ts +20 -0
  399. package/dist/encoding/index.d.ts.map +1 -1
  400. package/dist/encoding/index.js +20 -0
  401. package/dist/encoding/index.js.map +1 -1
  402. package/dist/eventlog/EventJournal.d.ts +90 -5
  403. package/dist/eventlog/EventJournal.d.ts.map +1 -1
  404. package/dist/eventlog/EventJournal.js +488 -228
  405. package/dist/eventlog/EventJournal.js.map +1 -1
  406. package/dist/eventlog/EventLog.d.ts +180 -12
  407. package/dist/eventlog/EventLog.d.ts.map +1 -1
  408. package/dist/eventlog/EventLog.js +394 -146
  409. package/dist/eventlog/EventLog.js.map +1 -1
  410. package/dist/eventlog/EventLogEncryption.d.ts +36 -30
  411. package/dist/eventlog/EventLogEncryption.d.ts.map +1 -1
  412. package/dist/eventlog/EventLogEncryption.js +97 -38
  413. package/dist/eventlog/EventLogEncryption.js.map +1 -1
  414. package/dist/eventlog/EventLogMessage.d.ts +74 -34
  415. package/dist/eventlog/EventLogMessage.d.ts.map +1 -1
  416. package/dist/eventlog/EventLogMessage.js +45 -11
  417. package/dist/eventlog/EventLogMessage.js.map +1 -1
  418. package/dist/eventlog/EventLogRemote.d.ts +45 -8
  419. package/dist/eventlog/EventLogRemote.d.ts.map +1 -1
  420. package/dist/eventlog/EventLogRemote.js +51 -14
  421. package/dist/eventlog/EventLogRemote.js.map +1 -1
  422. package/dist/eventlog/EventLogServer.d.ts +46 -3
  423. package/dist/eventlog/EventLogServer.d.ts.map +1 -1
  424. package/dist/eventlog/EventLogServer.js +119 -19
  425. package/dist/eventlog/EventLogServer.js.map +1 -1
  426. package/dist/eventlog/EventLogServerEncrypted.d.ts +23 -33
  427. package/dist/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  428. package/dist/eventlog/EventLogServerEncrypted.js +97 -70
  429. package/dist/eventlog/EventLogServerEncrypted.js.map +1 -1
  430. package/dist/eventlog/EventLogServerUnencrypted.d.ts +39 -5
  431. package/dist/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  432. package/dist/eventlog/EventLogServerUnencrypted.js +151 -69
  433. package/dist/eventlog/EventLogServerUnencrypted.js.map +1 -1
  434. package/dist/eventlog/EventRow.d.ts +288 -0
  435. package/dist/eventlog/EventRow.d.ts.map +1 -0
  436. package/dist/eventlog/EventRow.js +435 -0
  437. package/dist/eventlog/EventRow.js.map +1 -0
  438. package/dist/eventlog/SqlEventJournal.d.ts +18 -18
  439. package/dist/eventlog/SqlEventJournal.d.ts.map +1 -1
  440. package/dist/eventlog/SqlEventJournal.js +387 -159
  441. package/dist/eventlog/SqlEventJournal.js.map +1 -1
  442. package/dist/eventlog/SqlEventLogServerEncrypted.d.ts +10 -18
  443. package/dist/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
  444. package/dist/eventlog/SqlEventLogServerEncrypted.js +179 -69
  445. package/dist/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  446. package/dist/eventlog/SqlEventLogServerUnencrypted.d.ts +23 -3
  447. package/dist/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  448. package/dist/eventlog/SqlEventLogServerUnencrypted.js +102 -51
  449. package/dist/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  450. package/dist/eventlog/index.d.ts +5 -0
  451. package/dist/eventlog/index.d.ts.map +1 -1
  452. package/dist/eventlog/index.js +5 -0
  453. package/dist/eventlog/index.js.map +1 -1
  454. package/dist/eventlog/internal/conflicts.d.ts +47 -0
  455. package/dist/eventlog/internal/conflicts.d.ts.map +1 -0
  456. package/dist/eventlog/internal/conflicts.js +92 -0
  457. package/dist/eventlog/internal/conflicts.js.map +1 -0
  458. package/dist/graphql/GraphQLClientError.d.ts +2 -2
  459. package/dist/graphql/GraphQLClientError.d.ts.map +1 -1
  460. package/dist/graphql/GraphQLClientError.js +4 -18
  461. package/dist/graphql/GraphQLClientError.js.map +1 -1
  462. package/dist/graphql/GraphQLProtocol.d.ts +12 -9
  463. package/dist/graphql/GraphQLProtocol.d.ts.map +1 -1
  464. package/dist/graphql/GraphQLProtocol.js +4 -3
  465. package/dist/graphql/GraphQLProtocol.js.map +1 -1
  466. package/dist/graphql/GraphQLResolver.d.ts +2 -0
  467. package/dist/graphql/GraphQLResolver.d.ts.map +1 -1
  468. package/dist/graphql/GraphQLResolver.js +74 -32
  469. package/dist/graphql/GraphQLResolver.js.map +1 -1
  470. package/dist/http/FetchHttpClient.d.ts +8 -1
  471. package/dist/http/FetchHttpClient.d.ts.map +1 -1
  472. package/dist/http/FetchHttpClient.js +51 -4
  473. package/dist/http/FetchHttpClient.js.map +1 -1
  474. package/dist/http/FindMyWay/internal/router.js +10 -0
  475. package/dist/http/FindMyWay/internal/router.js.map +1 -1
  476. package/dist/http/Headers.d.ts +227 -0
  477. package/dist/http/Headers.d.ts.map +1 -1
  478. package/dist/http/Headers.js +261 -0
  479. package/dist/http/Headers.js.map +1 -1
  480. package/dist/http/HttpClient.d.ts +93 -0
  481. package/dist/http/HttpClient.d.ts.map +1 -1
  482. package/dist/http/HttpClient.js +55 -16
  483. package/dist/http/HttpClient.js.map +1 -1
  484. package/dist/http/HttpClientRequest.d.ts +127 -3
  485. package/dist/http/HttpClientRequest.d.ts.map +1 -1
  486. package/dist/http/HttpClientRequest.js +44 -2
  487. package/dist/http/HttpClientRequest.js.map +1 -1
  488. package/dist/http/HttpClientResponse.d.ts +53 -0
  489. package/dist/http/HttpClientResponse.d.ts.map +1 -1
  490. package/dist/http/HttpClientResponse.js +47 -0
  491. package/dist/http/HttpClientResponse.js.map +1 -1
  492. package/dist/http/HttpEffect.d.ts +6 -2
  493. package/dist/http/HttpEffect.d.ts.map +1 -1
  494. package/dist/http/HttpEffect.js +21 -17
  495. package/dist/http/HttpEffect.js.map +1 -1
  496. package/dist/http/HttpIncomingMessage.d.ts +2 -1
  497. package/dist/http/HttpIncomingMessage.d.ts.map +1 -1
  498. package/dist/http/HttpIncomingMessage.js +3 -23
  499. package/dist/http/HttpIncomingMessage.js.map +1 -1
  500. package/dist/http/HttpMiddleware.d.ts +119 -2
  501. package/dist/http/HttpMiddleware.d.ts.map +1 -1
  502. package/dist/http/HttpMiddleware.js +159 -13
  503. package/dist/http/HttpMiddleware.js.map +1 -1
  504. package/dist/http/HttpRouter.d.ts.map +1 -1
  505. package/dist/http/HttpRouter.js +7 -2
  506. package/dist/http/HttpRouter.js.map +1 -1
  507. package/dist/http/HttpServerError.d.ts +5 -2
  508. package/dist/http/HttpServerError.d.ts.map +1 -1
  509. package/dist/http/HttpServerError.js +5 -3
  510. package/dist/http/HttpServerError.js.map +1 -1
  511. package/dist/http/HttpServerRequest.d.ts +25 -5
  512. package/dist/http/HttpServerRequest.d.ts.map +1 -1
  513. package/dist/http/HttpServerRequest.js +36 -10
  514. package/dist/http/HttpServerRequest.js.map +1 -1
  515. package/dist/http/HttpServerResponse.d.ts +17 -8
  516. package/dist/http/HttpServerResponse.d.ts.map +1 -1
  517. package/dist/http/HttpServerResponse.js +37 -21
  518. package/dist/http/HttpServerResponse.js.map +1 -1
  519. package/dist/http/HttpStaticServer.d.ts +0 -12
  520. package/dist/http/HttpStaticServer.d.ts.map +1 -1
  521. package/dist/http/HttpStaticServer.js +21 -7
  522. package/dist/http/HttpStaticServer.js.map +1 -1
  523. package/dist/http/MultipartParser/internal/contentType.d.ts +15 -1
  524. package/dist/http/MultipartParser/internal/contentType.d.ts.map +1 -1
  525. package/dist/http/MultipartParser/internal/contentType.js +87 -5
  526. package/dist/http/MultipartParser/internal/contentType.js.map +1 -1
  527. package/dist/http/MultipartParser/internal/headers.d.ts.map +1 -1
  528. package/dist/http/MultipartParser/internal/headers.js +4 -12
  529. package/dist/http/MultipartParser/internal/headers.js.map +1 -1
  530. package/dist/http/MultipartParser/internal/multipart.d.ts.map +1 -1
  531. package/dist/http/MultipartParser/internal/multipart.js +6 -27
  532. package/dist/http/MultipartParser/internal/multipart.js.map +1 -1
  533. package/dist/http/Url.d.ts.map +1 -1
  534. package/dist/http/Url.js +6 -1
  535. package/dist/http/Url.js.map +1 -1
  536. package/dist/http/internal/decompression.js +17 -11
  537. package/dist/http/internal/decompression.js.map +1 -1
  538. package/dist/http/internal/lazyStream.d.ts +2 -0
  539. package/dist/http/internal/lazyStream.d.ts.map +1 -0
  540. package/dist/http/internal/lazyStream.js +18 -0
  541. package/dist/http/internal/lazyStream.js.map +1 -0
  542. package/dist/http/internal/requestState.d.ts +2 -0
  543. package/dist/http/internal/requestState.d.ts.map +1 -0
  544. package/dist/http/internal/requestState.js +28 -0
  545. package/dist/http/internal/requestState.js.map +1 -0
  546. package/dist/http/internal/webResponse.d.ts +2 -0
  547. package/dist/http/internal/webResponse.d.ts.map +1 -0
  548. package/dist/http/internal/webResponse.js +12 -0
  549. package/dist/http/internal/webResponse.js.map +1 -0
  550. package/dist/http-api/HttpApi.js +1 -1
  551. package/dist/http-api/HttpApi.js.map +1 -1
  552. package/dist/http-api/HttpApiBuilder.d.ts.map +1 -1
  553. package/dist/http-api/HttpApiBuilder.js +121 -18
  554. package/dist/http-api/HttpApiBuilder.js.map +1 -1
  555. package/dist/http-api/HttpApiClient.d.ts +29 -4
  556. package/dist/http-api/HttpApiClient.d.ts.map +1 -1
  557. package/dist/http-api/HttpApiClient.js +83 -23
  558. package/dist/http-api/HttpApiClient.js.map +1 -1
  559. package/dist/http-api/HttpApiEndpoint.d.ts +55 -29
  560. package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
  561. package/dist/http-api/HttpApiEndpoint.js +49 -5
  562. package/dist/http-api/HttpApiEndpoint.js.map +1 -1
  563. package/dist/http-api/HttpApiError.d.ts +58 -0
  564. package/dist/http-api/HttpApiError.d.ts.map +1 -1
  565. package/dist/http-api/HttpApiError.js +38 -12
  566. package/dist/http-api/HttpApiError.js.map +1 -1
  567. package/dist/http-api/HttpApiScalar.d.ts +2 -1
  568. package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
  569. package/dist/http-api/HttpApiScalar.js +6 -3
  570. package/dist/http-api/HttpApiScalar.js.map +1 -1
  571. package/dist/http-api/HttpApiSchema.d.ts +191 -9
  572. package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
  573. package/dist/http-api/HttpApiSchema.js +137 -4
  574. package/dist/http-api/HttpApiSchema.js.map +1 -1
  575. package/dist/http-api/HttpApiSwagger.d.ts +5 -0
  576. package/dist/http-api/HttpApiSwagger.d.ts.map +1 -1
  577. package/dist/http-api/HttpApiSwagger.js +14 -4
  578. package/dist/http-api/HttpApiSwagger.js.map +1 -1
  579. package/dist/http-api/HttpApiTest.d.ts +13 -2
  580. package/dist/http-api/HttpApiTest.d.ts.map +1 -1
  581. package/dist/http-api/HttpApiTest.js +30 -9
  582. package/dist/http-api/HttpApiTest.js.map +1 -1
  583. package/dist/http-api/OpenApi.d.ts +17 -3
  584. package/dist/http-api/OpenApi.d.ts.map +1 -1
  585. package/dist/http-api/OpenApi.js +57 -32
  586. package/dist/http-api/OpenApi.js.map +1 -1
  587. package/dist/http-api/internal/path.js +35 -10
  588. package/dist/http-api/internal/path.js.map +1 -1
  589. package/dist/index.d.ts +20 -0
  590. package/dist/index.d.ts.map +1 -1
  591. package/dist/index.js +20 -0
  592. package/dist/index.js.map +1 -1
  593. package/dist/internal/core.js +1 -1
  594. package/dist/internal/core.js.map +1 -1
  595. package/dist/internal/dateTime.js +19 -7
  596. package/dist/internal/dateTime.js.map +1 -1
  597. package/dist/internal/effect.js +85 -74
  598. package/dist/internal/effect.js.map +1 -1
  599. package/dist/internal/hashMap.js +2 -2
  600. package/dist/internal/hashMap.js.map +1 -1
  601. package/dist/internal/hydration.d.ts +2 -0
  602. package/dist/internal/hydration.d.ts.map +1 -0
  603. package/dist/internal/hydration.js +15 -0
  604. package/dist/internal/hydration.js.map +1 -0
  605. package/dist/internal/inflate.d.ts +2 -0
  606. package/dist/internal/inflate.d.ts.map +1 -0
  607. package/dist/internal/inflate.js +680 -0
  608. package/dist/internal/inflate.js.map +1 -0
  609. package/dist/internal/record.js +6 -0
  610. package/dist/internal/record.js.map +1 -1
  611. package/dist/internal/request.js +20 -7
  612. package/dist/internal/request.js.map +1 -1
  613. package/dist/internal/schedule.js +17 -22
  614. package/dist/internal/schedule.js.map +1 -1
  615. package/dist/internal/schema/fromJsonSchemaDocument.js +136 -126
  616. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
  617. package/dist/internal/schema/interpreter.js +51 -36
  618. package/dist/internal/schema/interpreter.js.map +1 -1
  619. package/dist/internal/schema/standardSchema.js +34 -33
  620. package/dist/internal/schema/standardSchema.js.map +1 -1
  621. package/dist/internal/schema/toCodeDocument.js +7 -2
  622. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  623. package/dist/internal/schema/toCodec.js +86 -1
  624. package/dist/internal/schema/toCodec.js.map +1 -1
  625. package/dist/internal/schema/toFormatter.js +5 -5
  626. package/dist/internal/schema/toFormatter.js.map +1 -1
  627. package/dist/internal/schema/toJsonSchemaDocument.js +60 -38
  628. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  629. package/dist/internal/trie.js +1 -3
  630. package/dist/internal/trie.js.map +1 -1
  631. package/dist/internal/uuid.js +7 -3
  632. package/dist/internal/uuid.js.map +1 -1
  633. package/dist/internal/version.js +1 -1
  634. package/dist/net/NetAddress.d.ts.map +1 -1
  635. package/dist/net/NetAddress.js +2 -8
  636. package/dist/net/NetAddress.js.map +1 -1
  637. package/dist/observability/OtlpExporter.d.ts.map +1 -1
  638. package/dist/observability/OtlpExporter.js +5 -12
  639. package/dist/observability/OtlpExporter.js.map +1 -1
  640. package/dist/observability/OtlpMetrics.d.ts.map +1 -1
  641. package/dist/observability/OtlpMetrics.js +5 -3
  642. package/dist/observability/OtlpMetrics.js.map +1 -1
  643. package/dist/observability/OtlpResource.d.ts +3 -1
  644. package/dist/observability/OtlpResource.d.ts.map +1 -1
  645. package/dist/observability/OtlpResource.js +11 -4
  646. package/dist/observability/OtlpResource.js.map +1 -1
  647. package/dist/observability/OtlpSerialization.d.ts +5 -0
  648. package/dist/observability/OtlpSerialization.d.ts.map +1 -1
  649. package/dist/observability/OtlpSerialization.js +14 -3
  650. package/dist/observability/OtlpSerialization.js.map +1 -1
  651. package/dist/observability/internal/protobuf.d.ts +0 -9
  652. package/dist/observability/internal/protobuf.d.ts.map +1 -1
  653. package/dist/observability/internal/protobuf.js +2 -10
  654. package/dist/observability/internal/protobuf.js.map +1 -1
  655. package/dist/persistence/PersistedCache.d.ts.map +1 -1
  656. package/dist/persistence/PersistedCache.js +1 -1
  657. package/dist/persistence/PersistedCache.js.map +1 -1
  658. package/dist/persistence/PersistedQueue.d.ts +6 -2
  659. package/dist/persistence/PersistedQueue.d.ts.map +1 -1
  660. package/dist/persistence/PersistedQueue.js +162 -84
  661. package/dist/persistence/PersistedQueue.js.map +1 -1
  662. package/dist/persistence/Persistence.d.ts +28 -0
  663. package/dist/persistence/Persistence.d.ts.map +1 -1
  664. package/dist/persistence/Persistence.js +36 -8
  665. package/dist/persistence/Persistence.js.map +1 -1
  666. package/dist/persistence/RateLimiter.d.ts.map +1 -1
  667. package/dist/persistence/RateLimiter.js +8 -12
  668. package/dist/persistence/RateLimiter.js.map +1 -1
  669. package/dist/persistence/UserDirectories.d.ts +129 -0
  670. package/dist/persistence/UserDirectories.d.ts.map +1 -0
  671. package/dist/persistence/UserDirectories.js +178 -0
  672. package/dist/persistence/UserDirectories.js.map +1 -0
  673. package/dist/persistence/index.d.ts +5 -0
  674. package/dist/persistence/index.d.ts.map +1 -1
  675. package/dist/persistence/index.js +5 -0
  676. package/dist/persistence/index.js.map +1 -1
  677. package/dist/process/ChildProcess.d.ts +2 -1
  678. package/dist/process/ChildProcess.d.ts.map +1 -1
  679. package/dist/process/ChildProcess.js.map +1 -1
  680. package/dist/reactivity/AsyncResult.d.ts.map +1 -1
  681. package/dist/reactivity/AsyncResult.js +1 -1
  682. package/dist/reactivity/AsyncResult.js.map +1 -1
  683. package/dist/reactivity/Atom.d.ts +69 -30
  684. package/dist/reactivity/Atom.d.ts.map +1 -1
  685. package/dist/reactivity/Atom.js +40 -15
  686. package/dist/reactivity/Atom.js.map +1 -1
  687. package/dist/reactivity/AtomHttpApi.d.ts +5 -5
  688. package/dist/reactivity/AtomHttpApi.d.ts.map +1 -1
  689. package/dist/reactivity/AtomHttpApi.js +1 -1
  690. package/dist/reactivity/AtomHttpApi.js.map +1 -1
  691. package/dist/reactivity/AtomRegistry.d.ts +2 -2
  692. package/dist/reactivity/AtomRegistry.d.ts.map +1 -1
  693. package/dist/reactivity/AtomRegistry.js +44 -9
  694. package/dist/reactivity/AtomRegistry.js.map +1 -1
  695. package/dist/reactivity/AtomRpc.d.ts +3 -3
  696. package/dist/reactivity/AtomRpc.d.ts.map +1 -1
  697. package/dist/reactivity/AtomRpc.js +1 -1
  698. package/dist/reactivity/AtomRpc.js.map +1 -1
  699. package/dist/reactivity/Hydration.d.ts.map +1 -1
  700. package/dist/reactivity/Hydration.js +46 -12
  701. package/dist/reactivity/Hydration.js.map +1 -1
  702. package/dist/reactivity/Reactivity.d.ts +71 -7
  703. package/dist/reactivity/Reactivity.d.ts.map +1 -1
  704. package/dist/reactivity/Reactivity.js +21 -12
  705. package/dist/reactivity/Reactivity.js.map +1 -1
  706. package/dist/rpc/Rpc.d.ts +18 -0
  707. package/dist/rpc/Rpc.d.ts.map +1 -1
  708. package/dist/rpc/Rpc.js +20 -0
  709. package/dist/rpc/Rpc.js.map +1 -1
  710. package/dist/rpc/RpcClient.d.ts +26 -2
  711. package/dist/rpc/RpcClient.d.ts.map +1 -1
  712. package/dist/rpc/RpcClient.js +196 -60
  713. package/dist/rpc/RpcClient.js.map +1 -1
  714. package/dist/rpc/RpcSerialization.d.ts +15 -0
  715. package/dist/rpc/RpcSerialization.d.ts.map +1 -1
  716. package/dist/rpc/RpcSerialization.js +21 -5
  717. package/dist/rpc/RpcSerialization.js.map +1 -1
  718. package/dist/rpc/RpcServer.d.ts.map +1 -1
  719. package/dist/rpc/RpcServer.js +9 -18
  720. package/dist/rpc/RpcServer.js.map +1 -1
  721. package/dist/schema/Model.d.ts +1 -1
  722. package/dist/schema/VariantSchema.d.ts +22 -3
  723. package/dist/schema/VariantSchema.d.ts.map +1 -1
  724. package/dist/schema/VariantSchema.js +32 -18
  725. package/dist/schema/VariantSchema.js.map +1 -1
  726. package/dist/socket/Socket.d.ts +23 -1
  727. package/dist/socket/Socket.d.ts.map +1 -1
  728. package/dist/socket/Socket.js +36 -3
  729. package/dist/socket/Socket.js.map +1 -1
  730. package/dist/sql/Migrator.d.ts.map +1 -1
  731. package/dist/sql/Migrator.js +15 -3
  732. package/dist/sql/Migrator.js.map +1 -1
  733. package/dist/sql/SqlClient.d.ts +143 -5
  734. package/dist/sql/SqlClient.d.ts.map +1 -1
  735. package/dist/sql/SqlClient.js +148 -27
  736. package/dist/sql/SqlClient.js.map +1 -1
  737. package/dist/sql/SqlResolver.d.ts +9 -0
  738. package/dist/sql/SqlResolver.d.ts.map +1 -1
  739. package/dist/sql/SqlResolver.js +9 -0
  740. package/dist/sql/SqlResolver.js.map +1 -1
  741. package/dist/sql/Statement.d.ts +3 -1
  742. package/dist/sql/Statement.d.ts.map +1 -1
  743. package/dist/sql/Statement.js +24 -5
  744. package/dist/sql/Statement.js.map +1 -1
  745. package/dist/testing/TestClock.d.ts.map +1 -1
  746. package/dist/testing/TestClock.js +4 -2
  747. package/dist/testing/TestClock.js.map +1 -1
  748. package/dist/testing/TestSchema.d.ts +7 -1
  749. package/dist/testing/TestSchema.d.ts.map +1 -1
  750. package/dist/testing/TestSchema.js +9 -3
  751. package/dist/testing/TestSchema.js.map +1 -1
  752. package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
  753. package/dist/workflow/WorkflowEngine.js +18 -4
  754. package/dist/workflow/WorkflowEngine.js.map +1 -1
  755. package/package.json +13 -3
  756. package/src/Array.ts +128 -55
  757. package/src/Bytes.ts +111 -0
  758. package/src/Channel.ts +263 -436
  759. package/src/ChannelSchema.ts +1 -49
  760. package/src/Chunk.ts +55 -61
  761. package/src/Config.ts +12 -86
  762. package/src/ConfigProvider.ts +2 -1
  763. package/src/Cron.ts +6 -3
  764. package/src/Duration.ts +66 -16
  765. package/src/Effect.ts +502 -167
  766. package/src/Equivalence.ts +7 -4
  767. package/src/Exit.ts +24 -9
  768. package/src/FiberHandle.ts +10 -9
  769. package/src/FiberMap.ts +13 -66
  770. package/src/FileSystem.ts +10 -0
  771. package/src/Graph.ts +171 -1263
  772. package/src/HashSet.ts +0 -60
  773. package/src/Iterable.ts +15 -14
  774. package/src/JsonSchema.ts +28 -3
  775. package/src/Layer.ts +2 -2
  776. package/src/ManagedRuntime.ts +72 -6
  777. package/src/Metric.ts +249 -507
  778. package/src/MutableHashMap.ts +4 -473
  779. package/src/Number.ts +2 -2
  780. package/src/Optic.ts +17 -332
  781. package/src/Path.ts +9 -1
  782. package/src/PubSub.ts +12 -7
  783. package/src/Queue.ts +5 -37
  784. package/src/Random.ts +1 -1
  785. package/src/RcMap.ts +14 -8
  786. package/src/Record.ts +51 -0
  787. package/src/Ref.ts +7 -104
  788. package/src/References.ts +5 -4
  789. package/src/RequestResolver.ts +46 -87
  790. package/src/Resource.ts +1 -1
  791. package/src/Runtime.ts +19 -18
  792. package/src/Schedule.ts +2 -94
  793. package/src/Schema.ts +591 -356
  794. package/src/SchemaAST.ts +20 -9
  795. package/src/SchemaGetter.ts +22 -5
  796. package/src/SchemaIssue.ts +44 -53
  797. package/src/SchemaRepresentation.ts +64 -1
  798. package/src/SchemaTransformation.ts +1 -1
  799. package/src/Scope.ts +12 -2
  800. package/src/ScopedCache.ts +17 -142
  801. package/src/SemVer.ts +1528 -0
  802. package/src/SemVerRange.ts +883 -0
  803. package/src/Sink.ts +6 -2
  804. package/src/Stream.ts +334 -1011
  805. package/src/String.ts +8 -8
  806. package/src/TextDiff.ts +766 -0
  807. package/src/TxHashMap.ts +1 -103
  808. package/src/TxHashSet.ts +48 -753
  809. package/src/ai/AiError.ts +66 -4
  810. package/src/ai/Chat.ts +10 -5
  811. package/src/ai/Decision.ts +49 -1
  812. package/src/ai/DecisionModel.ts +264 -108
  813. package/src/ai/EmbeddingModel.ts +25 -13
  814. package/src/ai/McpClient.ts +1211 -0
  815. package/src/ai/McpClientError.ts +329 -0
  816. package/src/ai/McpProtocol.ts +2 -2
  817. package/src/ai/McpSchema.ts +153 -35
  818. package/src/ai/McpServer.ts +217 -220
  819. package/src/ai/Prompt.ts +49 -35
  820. package/src/ai/Response.ts +195 -65
  821. package/src/ai/Tool.ts +12 -4
  822. package/src/ai/Toolkit.ts +78 -10
  823. package/src/ai/index.ts +12 -0
  824. package/src/ai/internal/mcpCore.ts +13 -14
  825. package/src/ai/internal/mcpProtocol/v2024_11_05.ts +1 -1
  826. package/src/ai/internal/mcpProtocol/v2025_03_26.ts +1 -1
  827. package/src/ai/internal/mcpProtocol/v2025_06_18.ts +3 -3
  828. package/src/ai/internal/mcpProtocol/v2025_11_25.ts +3 -3
  829. package/src/ai/internal/mcpProtocol/v2026_07_28.ts +12 -14
  830. package/src/ai/internal/mcpProtocol.ts +22 -2
  831. package/src/ai/internal/mcpRuntime.ts +3 -4
  832. package/src/ai/internal/mcpSchema/v2024_11_05.ts +20 -13
  833. package/src/ai/internal/mcpSchema/v2025_03_26.ts +4 -2
  834. package/src/ai/internal/mcpSchema/v2025_06_18.ts +7 -7
  835. package/src/ai/internal/mcpSchema/v2025_11_25.ts +8 -8
  836. package/src/ai/internal/mcpSchema/v2026_07_28.ts +44 -42
  837. package/src/cli/CliError.ts +49 -4
  838. package/src/cli/Command.ts +316 -9
  839. package/src/cli/Completions.ts +5 -0
  840. package/src/cli/Flag.ts +117 -0
  841. package/src/cli/GlobalFlag.ts +3 -3
  842. package/src/cli/Param.ts +122 -0
  843. package/src/cli/TerminalCapabilities.ts +156 -0
  844. package/src/cli/index.ts +6 -0
  845. package/src/cli/internal/command.ts +8 -3
  846. package/src/cli/internal/completions/bash.ts +4 -3
  847. package/src/cli/internal/completions/descriptor.ts +11 -1
  848. package/src/cli/internal/completions/fish.ts +10 -8
  849. package/src/cli/internal/completions/powershell.ts +23 -14
  850. package/src/cli/internal/completions/zsh.ts +8 -5
  851. package/src/cli/internal/formatter.ts +18 -0
  852. package/src/cli/internal/lexer.ts +12 -5
  853. package/src/cli/internal/parser.ts +31 -11
  854. package/src/cluster/ClusterCron.ts +94 -35
  855. package/src/cluster/ClusterMetrics.ts +149 -7
  856. package/src/cluster/ClusterWorkflowEngine.ts +84 -41
  857. package/src/cluster/Entity.ts +4 -0
  858. package/src/cluster/MessageStorage.ts +7 -0
  859. package/src/cluster/Runners.ts +76 -25
  860. package/src/cluster/Sharding.ts +118 -38
  861. package/src/cluster/ShardingConfig.ts +15 -0
  862. package/src/cluster/SqlMessageStorage.ts +58 -55
  863. package/src/cluster/SqlRunnerStorage.ts +10 -4
  864. package/src/cluster/internal/entityManager.ts +80 -10
  865. package/src/devtools/DevTools.ts +3 -2
  866. package/src/devtools/DevToolsClient.ts +27 -10
  867. package/src/encoding/Base64Url.ts +31 -0
  868. package/src/encoding/Ini.ts +3 -0
  869. package/src/encoding/JsonArray.ts +849 -0
  870. package/src/encoding/Ndjson.ts +211 -20
  871. package/src/encoding/SchemaBinary.ts +14 -48
  872. package/src/encoding/Tar.ts +1417 -0
  873. package/src/encoding/Toml.ts +3 -3
  874. package/src/encoding/Xml.ts +2037 -0
  875. package/src/encoding/Yaml.ts +108 -36
  876. package/src/encoding/Zip.ts +1558 -0
  877. package/src/encoding/index.ts +24 -0
  878. package/src/eventlog/EventJournal.ts +611 -227
  879. package/src/eventlog/EventLog.ts +496 -196
  880. package/src/eventlog/EventLogEncryption.ts +128 -43
  881. package/src/eventlog/EventLogMessage.ts +62 -11
  882. package/src/eventlog/EventLogRemote.ts +77 -21
  883. package/src/eventlog/EventLogServer.ts +162 -20
  884. package/src/eventlog/EventLogServerEncrypted.ts +121 -80
  885. package/src/eventlog/EventLogServerUnencrypted.ts +180 -77
  886. package/src/eventlog/EventRow.ts +706 -0
  887. package/src/eventlog/SqlEventJournal.ts +453 -173
  888. package/src/eventlog/SqlEventLogServerEncrypted.ts +212 -83
  889. package/src/eventlog/SqlEventLogServerUnencrypted.ts +141 -62
  890. package/src/eventlog/index.ts +6 -0
  891. package/src/eventlog/internal/conflicts.ts +123 -0
  892. package/src/graphql/GraphQLClientError.ts +5 -12
  893. package/src/graphql/GraphQLProtocol.ts +12 -9
  894. package/src/graphql/GraphQLResolver.ts +90 -239
  895. package/src/http/FetchHttpClient.ts +56 -6
  896. package/src/http/FindMyWay/internal/router.ts +11 -0
  897. package/src/http/Headers.ts +337 -154
  898. package/src/http/HttpClient.ts +126 -135
  899. package/src/http/HttpClientRequest.ts +142 -4
  900. package/src/http/HttpClientResponse.ts +71 -0
  901. package/src/http/HttpEffect.ts +25 -33
  902. package/src/http/HttpIncomingMessage.ts +3 -23
  903. package/src/http/HttpMiddleware.ts +180 -23
  904. package/src/http/HttpRouter.ts +8 -2
  905. package/src/http/HttpServerError.ts +6 -3
  906. package/src/http/HttpServerRequest.ts +71 -12
  907. package/src/http/HttpServerResponse.ts +49 -23
  908. package/src/http/HttpStaticServer.ts +25 -9
  909. package/src/http/MultipartParser/internal/contentType.ts +107 -6
  910. package/src/http/MultipartParser/internal/headers.ts +4 -16
  911. package/src/http/MultipartParser/internal/multipart.ts +10 -32
  912. package/src/http/Url.ts +6 -1
  913. package/src/http/internal/decompression.ts +26 -17
  914. package/src/http/internal/lazyStream.ts +25 -0
  915. package/src/http/internal/requestState.ts +33 -0
  916. package/src/http/internal/webResponse.ts +20 -0
  917. package/src/http-api/HttpApi.ts +1 -1
  918. package/src/http-api/HttpApiBuilder.ts +151 -23
  919. package/src/http-api/HttpApiClient.ts +158 -30
  920. package/src/http-api/HttpApiEndpoint.ts +144 -33
  921. package/src/http-api/HttpApiError.ts +55 -0
  922. package/src/http-api/HttpApiScalar.ts +4 -3
  923. package/src/http-api/HttpApiSchema.ts +275 -13
  924. package/src/http-api/HttpApiSwagger.ts +11 -4
  925. package/src/http-api/HttpApiTest.ts +33 -9
  926. package/src/http-api/OpenApi.ts +84 -42
  927. package/src/http-api/internal/path.ts +40 -12
  928. package/src/index.ts +24 -0
  929. package/src/internal/core.ts +1 -1
  930. package/src/internal/dateTime.ts +20 -7
  931. package/src/internal/effect.ts +120 -84
  932. package/src/internal/hashMap.ts +2 -2
  933. package/src/internal/hydration.ts +15 -0
  934. package/src/internal/inflate.ts +710 -0
  935. package/src/internal/record.ts +6 -0
  936. package/src/internal/request.ts +21 -6
  937. package/src/internal/schedule.ts +20 -39
  938. package/src/internal/schema/fromJsonSchemaDocument.ts +262 -193
  939. package/src/internal/schema/interpreter.ts +58 -45
  940. package/src/internal/schema/standardSchema.ts +32 -30
  941. package/src/internal/schema/toCodeDocument.ts +8 -3
  942. package/src/internal/schema/toCodec.ts +116 -1
  943. package/src/internal/schema/toFormatter.ts +6 -6
  944. package/src/internal/schema/toJsonSchemaDocument.ts +69 -39
  945. package/src/internal/trie.ts +1 -3
  946. package/src/internal/uuid.ts +15 -10
  947. package/src/internal/version.ts +1 -1
  948. package/src/net/NetAddress.ts +2 -9
  949. package/src/observability/OtlpExporter.ts +5 -12
  950. package/src/observability/OtlpMetrics.ts +5 -3
  951. package/src/observability/OtlpResource.ts +16 -6
  952. package/src/observability/OtlpSerialization.ts +17 -3
  953. package/src/observability/internal/protobuf.ts +2 -10
  954. package/src/persistence/PersistedCache.ts +3 -1
  955. package/src/persistence/PersistedQueue.ts +223 -153
  956. package/src/persistence/Persistence.ts +64 -30
  957. package/src/persistence/RateLimiter.ts +18 -21
  958. package/src/persistence/UserDirectories.ts +273 -0
  959. package/src/persistence/index.ts +6 -0
  960. package/src/process/ChildProcess.ts +2 -1
  961. package/src/reactivity/AsyncResult.ts +4 -38
  962. package/src/reactivity/Atom.ts +134 -166
  963. package/src/reactivity/AtomHttpApi.ts +10 -16
  964. package/src/reactivity/AtomRegistry.ts +50 -29
  965. package/src/reactivity/AtomRpc.ts +6 -22
  966. package/src/reactivity/Hydration.ts +53 -12
  967. package/src/reactivity/Reactivity.ts +97 -39
  968. package/src/rpc/Rpc.ts +21 -0
  969. package/src/rpc/RpcClient.ts +279 -103
  970. package/src/rpc/RpcSerialization.ts +21 -5
  971. package/src/rpc/RpcServer.ts +11 -20
  972. package/src/schema/VariantSchema.ts +86 -22
  973. package/src/socket/Socket.ts +45 -20
  974. package/src/sql/Migrator.ts +19 -9
  975. package/src/sql/SqlClient.ts +266 -29
  976. package/src/sql/SqlResolver.ts +9 -0
  977. package/src/sql/Statement.ts +35 -8
  978. package/src/testing/TestClock.ts +4 -1
  979. package/src/testing/TestSchema.ts +9 -3
  980. package/src/workflow/WorkflowEngine.ts +34 -10
  981. package/dist/http/internal/preResponseHandler.d.ts +0 -2
  982. package/dist/http/internal/preResponseHandler.d.ts.map +0 -1
  983. package/dist/http/internal/preResponseHandler.js +0 -14
  984. package/dist/http/internal/preResponseHandler.js.map +0 -1
  985. package/src/http/internal/preResponseHandler.ts +0 -19
package/src/Effect.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference lib="esnext.disposable" preserve="true" />
2
+
1
3
  /**
2
4
  * Describes workflows that run only when executed by the Effect runtime.
3
5
  *
@@ -1333,8 +1335,9 @@ export const whileLoop: <A, E, R>(options: {
1333
1335
  *
1334
1336
  * **Details**
1335
1337
  *
1336
- * An optional `AbortSignal` can be provided to allow for interruption of the
1337
- * wrapped `Promise` API.
1338
+ * If `evaluate` declares a parameter, it receives an `AbortSignal` that is
1339
+ * aborted if the effect is interrupted. Zero-argument thunks do not allocate
1340
+ * an `AbortController`.
1338
1341
  *
1339
1342
  * **Gotchas**
1340
1343
  *
@@ -1344,6 +1347,13 @@ export const whileLoop: <A, E, R>(options: {
1344
1347
  * Interruption aborts the provided `AbortSignal`, but the underlying
1345
1348
  * asynchronous operation only stops if it observes that signal.
1346
1349
  *
1350
+ * The parameter check reads the `length` property of `evaluate`, which does
1351
+ * not count a rest parameter or any parameter from the first default value
1352
+ * onward. `(...args) => ...` and `(signal = fallback) => ...` therefore
1353
+ * receive `undefined` instead of a signal, as do wrappers that forward
1354
+ * arguments through rest parameters. Declare the signal as an ordinary
1355
+ * parameter: `(signal) => ...`.
1356
+ *
1347
1357
  * **Example** (Wrapping a non-rejecting Promise)
1348
1358
  *
1349
1359
  * ```ts import.meta.vitest
@@ -1388,9 +1398,10 @@ export const promise: <A>(
1388
1398
  * Passing `{ try, catch }` uses `catch` to map failures to an error of type
1389
1399
  * `E`.
1390
1400
  *
1391
- * The thunk receives an `AbortSignal` that is aborted if the effect is
1392
- * interrupted. The underlying asynchronous operation only stops if it observes
1393
- * that signal.
1401
+ * If the thunk declares a parameter, it receives an `AbortSignal` that is
1402
+ * aborted if the effect is interrupted. The underlying asynchronous operation
1403
+ * only stops if it observes that signal. Zero-argument thunks do not allocate
1404
+ * an `AbortController`.
1394
1405
  *
1395
1406
  * **Gotchas**
1396
1407
  *
@@ -1398,6 +1409,13 @@ export const promise: <A>(
1398
1409
  * defect. Return the error value you want in the error channel instead of
1399
1410
  * throwing it.
1400
1411
  *
1412
+ * The parameter check reads the thunk's `length` property, which does not
1413
+ * count a rest parameter or any parameter from the first default value
1414
+ * onward. `(...args) => ...` and `(signal = fallback) => ...` therefore
1415
+ * receive `undefined` instead of a signal, as do wrappers that forward
1416
+ * arguments through rest parameters. Declare the signal as an ordinary
1417
+ * parameter: `(signal) => ...`.
1418
+ *
1401
1419
  * **Example** (Wrapping a fetch request that may fail)
1402
1420
  *
1403
1421
  * ```ts import.meta.vitest
@@ -1460,9 +1478,10 @@ export const tryPromise: {
1460
1478
  * Passing `{ try, catch }` uses `catch` to map failures to an error of type
1461
1479
  * `E`.
1462
1480
  *
1463
- * The thunk receives an `AbortSignal` that is aborted if the effect is
1464
- * interrupted. The underlying asynchronous operation only stops if it observes
1465
- * that signal.
1481
+ * If the thunk declares a parameter, it receives an `AbortSignal` that is
1482
+ * aborted if the effect is interrupted. The underlying asynchronous operation
1483
+ * only stops if it observes that signal. Zero-argument thunks do not allocate
1484
+ * an `AbortController`.
1466
1485
  *
1467
1486
  * **Gotchas**
1468
1487
  *
@@ -1470,6 +1489,13 @@ export const tryPromise: {
1470
1489
  * defect. Return the error value you want in the error channel instead of
1471
1490
  * throwing it.
1472
1491
  *
1492
+ * The parameter check reads the thunk's `length` property, which does not
1493
+ * count a rest parameter or any parameter from the first default value
1494
+ * onward. `(...args) => ...` and `(signal = fallback) => ...` therefore
1495
+ * receive `undefined` instead of a signal, as do wrappers that forward
1496
+ * arguments through rest parameters. Declare the signal as an ordinary
1497
+ * parameter: `(signal) => ...`.
1498
+ *
1473
1499
  * **Example** (Wrapping a fetch request that may fail)
1474
1500
  *
1475
1501
  * ```ts import.meta.vitest
@@ -1532,9 +1558,10 @@ export const tryPromise: {
1532
1558
  * Passing `{ try, catch }` uses `catch` to map failures to an error of type
1533
1559
  * `E`.
1534
1560
  *
1535
- * The thunk receives an `AbortSignal` that is aborted if the effect is
1536
- * interrupted. The underlying asynchronous operation only stops if it observes
1537
- * that signal.
1561
+ * If the thunk declares a parameter, it receives an `AbortSignal` that is
1562
+ * aborted if the effect is interrupted. The underlying asynchronous operation
1563
+ * only stops if it observes that signal. Zero-argument thunks do not allocate
1564
+ * an `AbortController`.
1538
1565
  *
1539
1566
  * **Gotchas**
1540
1567
  *
@@ -1542,6 +1569,13 @@ export const tryPromise: {
1542
1569
  * defect. Return the error value you want in the error channel instead of
1543
1570
  * throwing it.
1544
1571
  *
1572
+ * The parameter check reads the thunk's `length` property, which does not
1573
+ * count a rest parameter or any parameter from the first default value
1574
+ * onward. `(...args) => ...` and `(signal = fallback) => ...` therefore
1575
+ * receive `undefined` instead of a signal, as do wrappers that forward
1576
+ * arguments through rest parameters. Declare the signal as an ordinary
1577
+ * parameter: `(signal) => ...`.
1578
+ *
1545
1579
  * **Example** (Wrapping a fetch request that may fail)
1546
1580
  *
1547
1581
  * ```ts import.meta.vitest
@@ -1823,10 +1857,20 @@ export {
1823
1857
  *
1824
1858
  * **Details**
1825
1859
  *
1826
- * The registration function receives a `resume` callback and, when requested,
1827
- * an `AbortSignal`. Call `resume` at most once with the effect that should
1828
- * complete the fiber; later calls are ignored. Return an optional cleanup
1829
- * effect from the registration function to run if the fiber is interrupted.
1860
+ * The registration function receives a `resume` callback and, if it declares
1861
+ * a second parameter, an `AbortSignal` that is aborted if the fiber is
1862
+ * interrupted. Call `resume` at most once with the effect that should complete
1863
+ * the fiber; later calls are ignored. Return an optional cleanup effect from
1864
+ * the registration function to run if the fiber is interrupted.
1865
+ *
1866
+ * **Gotchas**
1867
+ *
1868
+ * The parameter check reads the registration function's `length` property,
1869
+ * which must be at least `2` and does not count a rest parameter or any
1870
+ * parameter from the first default value onward. `(...args) => ...` and
1871
+ * `(resume, signal = fallback) => ...` therefore receive `undefined` instead
1872
+ * of a signal, as do wrappers that forward arguments through rest parameters.
1873
+ * Declare both as ordinary parameters: `(resume, signal) => ...`.
1830
1874
  *
1831
1875
  * **Example** (Integrating callback APIs)
1832
1876
  *
@@ -2667,7 +2711,9 @@ export const fromResult: <A, E>(result: Result.Result<A, E>) => Effect<A, E> = i
2667
2711
  * `Option.some` becomes a successful effect with the contained value, while
2668
2712
  * `Option.none` becomes a failed effect. By default the failure is a
2669
2713
  * `NoSuchElementError`, but you can provide an `onNone` callback to customize
2670
- * the error value.
2714
+ * the error value. For `Option.none`, `onNone` is evaluated on each execution,
2715
+ * not when the effect is constructed. It is never called for `Option.some`.
2716
+ * If `onNone` throws, the effect dies with the thrown value as a defect.
2671
2717
  *
2672
2718
  * **Example** (Converting an Option into an Effect)
2673
2719
  *
@@ -3747,9 +3793,12 @@ export const tap: {
3747
3793
  *
3748
3794
  * **Gotchas**
3749
3795
  *
3750
- * `result` only captures typed, recoverable failures. Defects and
3751
- * interruptions are not captured inside the `Result` and still fail the
3752
- * effect.
3796
+ * `result` only captures typed, recoverable failures. If the cause contains a
3797
+ * defect, nothing is captured and every typed error is converted to a defect,
3798
+ * preserving reason order and interrupts. A cause with only interruptions
3799
+ * still fails the effect, but an interruption alongside a typed error does not
3800
+ * prevent capture. The first typed error becomes a `Result.Failure` and the
3801
+ * interruption is discarded.
3753
3802
  *
3754
3803
  * **Example** (Capturing success or failure as Result)
3755
3804
  *
@@ -3791,9 +3840,12 @@ export const result: <A, E, R>(self: Effect<A, E, R>) => Effect<Result.Result<A,
3791
3840
  *
3792
3841
  * **Gotchas**
3793
3842
  *
3794
- * `option` only captures typed, recoverable failures as `Option.none`.
3795
- * Defects and interruptions are not captured inside the `Option` and still
3796
- * fail the effect.
3843
+ * `option` only captures typed, recoverable failures as `Option.none`. If the
3844
+ * cause contains a defect, nothing is captured and every typed error is
3845
+ * converted to a defect, preserving reason order and interrupts. A cause with
3846
+ * only interruptions still fails the effect, but an interruption alongside a
3847
+ * typed error does not prevent capture. The effect succeeds with
3848
+ * `Option.none()` and the interruption is discarded.
3797
3849
  *
3798
3850
  * `option` also discards typed failure values. Use `result` if the failure
3799
3851
  * value matters.
@@ -4579,6 +4631,11 @@ export {
4579
4631
  * `catch` only handles recoverable errors. It will not recover from
4580
4632
  * unrecoverable defects.
4581
4633
  *
4634
+ * Defects take precedence over typed errors. If the cause also contains a
4635
+ * defect, the handler does not run and the failure is propagated with every
4636
+ * typed error converted to a defect. An interruption alongside a typed error
4637
+ * does not prevent recovery.
4638
+ *
4582
4639
  * @see {@link catchCause} for a version that can recover from both recoverable and unrecoverable errors.
4583
4640
  *
4584
4641
  * @stability stable
@@ -4602,6 +4659,12 @@ export {
4602
4659
  * The error type must have a readonly `_tag` field. `catchTag` matches that
4603
4660
  * field and only handles errors with the requested tag.
4604
4661
  *
4662
+ * **Gotchas**
4663
+ *
4664
+ * If the cause contains a defect, the handler is skipped and every typed error
4665
+ * is converted to a defect, preserving reason order and interrupts. An
4666
+ * interruption alongside a typed error does not prevent recovery.
4667
+ *
4605
4668
  * **Example** (Handling a tagged error)
4606
4669
  *
4607
4670
  * ```ts import.meta.vitest
@@ -4651,6 +4714,12 @@ export const catchTag: {
4651
4714
  * The error type must have a readonly `_tag` field. `catchTag` matches that
4652
4715
  * field and only handles errors with the requested tag.
4653
4716
  *
4717
+ * **Gotchas**
4718
+ *
4719
+ * If the cause contains a defect, the handler is skipped and every typed error
4720
+ * is converted to a defect, preserving reason order and interrupts. An
4721
+ * interruption alongside a typed error does not prevent recovery.
4722
+ *
4654
4723
  * **Example** (Handling a tagged error)
4655
4724
  *
4656
4725
  * ```ts import.meta.vitest
@@ -4723,6 +4792,12 @@ export const catchTag: {
4723
4792
  * The error type must have a readonly `_tag` field. `catchTag` matches that
4724
4793
  * field and only handles errors with the requested tag.
4725
4794
  *
4795
+ * **Gotchas**
4796
+ *
4797
+ * If the cause contains a defect, the handler is skipped and every typed error
4798
+ * is converted to a defect, preserving reason order and interrupts. An
4799
+ * interruption alongside a typed error does not prevent recovery.
4800
+ *
4726
4801
  * **Example** (Handling a tagged error)
4727
4802
  *
4728
4803
  * ```ts import.meta.vitest
@@ -4800,6 +4875,12 @@ export const catchTag: {
4800
4875
  * The error type must have a readonly `_tag` field to use `catchTags`. This
4801
4876
  * field is used to identify and match errors.
4802
4877
  *
4878
+ * **Gotchas**
4879
+ *
4880
+ * If the cause contains a defect, the handler is skipped and every typed error
4881
+ * is converted to a defect, preserving reason order and interrupts. An
4882
+ * interruption alongside a typed error does not prevent recovery.
4883
+ *
4803
4884
  * **Example** (Handling multiple tagged errors)
4804
4885
  *
4805
4886
  * ```ts import.meta.vitest
@@ -4849,6 +4930,12 @@ export const catchTags: {
4849
4930
  * The error type must have a readonly `_tag` field to use `catchTags`. This
4850
4931
  * field is used to identify and match errors.
4851
4932
  *
4933
+ * **Gotchas**
4934
+ *
4935
+ * If the cause contains a defect, the handler is skipped and every typed error
4936
+ * is converted to a defect, preserving reason order and interrupts. An
4937
+ * interruption alongside a typed error does not prevent recovery.
4938
+ *
4852
4939
  * **Example** (Handling multiple tagged errors)
4853
4940
  *
4854
4941
  * ```ts import.meta.vitest
@@ -4927,6 +5014,12 @@ export const catchTags: {
4927
5014
  * The error type must have a readonly `_tag` field to use `catchTags`. This
4928
5015
  * field is used to identify and match errors.
4929
5016
  *
5017
+ * **Gotchas**
5018
+ *
5019
+ * If the cause contains a defect, the handler is skipped and every typed error
5020
+ * is converted to a defect, preserving reason order and interrupts. An
5021
+ * interruption alongside a typed error does not prevent recovery.
5022
+ *
4930
5023
  * **Example** (Handling multiple tagged errors)
4931
5024
  *
4932
5025
  * ```ts import.meta.vitest
@@ -5005,6 +5098,12 @@ export const catchTags: {
5005
5098
  * Use this to handle nested error causes without removing the parent error
5006
5099
  * from the error channel. The handler receives the unwrapped reason.
5007
5100
  *
5101
+ * **Gotchas**
5102
+ *
5103
+ * If the cause contains a defect, the handler is skipped and every typed error
5104
+ * is converted to a defect, preserving reason order and interrupts. An
5105
+ * interruption alongside a typed error does not prevent recovery.
5106
+ *
5008
5107
  * **Example** (Handling an error reason)
5009
5108
  *
5010
5109
  * ```ts import.meta.vitest
@@ -5056,6 +5155,12 @@ export const catchReason: {
5056
5155
  * Use this to handle nested error causes without removing the parent error
5057
5156
  * from the error channel. The handler receives the unwrapped reason.
5058
5157
  *
5158
+ * **Gotchas**
5159
+ *
5160
+ * If the cause contains a defect, the handler is skipped and every typed error
5161
+ * is converted to a defect, preserving reason order and interrupts. An
5162
+ * interruption alongside a typed error does not prevent recovery.
5163
+ *
5059
5164
  * **Example** (Handling an error reason)
5060
5165
  *
5061
5166
  * ```ts import.meta.vitest
@@ -5136,6 +5241,12 @@ export const catchReason: {
5136
5241
  * Use this to handle nested error causes without removing the parent error
5137
5242
  * from the error channel. The handler receives the unwrapped reason.
5138
5243
  *
5244
+ * **Gotchas**
5245
+ *
5246
+ * If the cause contains a defect, the handler is skipped and every typed error
5247
+ * is converted to a defect, preserving reason order and interrupts. An
5248
+ * interruption alongside a typed error does not prevent recovery.
5249
+ *
5139
5250
  * **Example** (Handling an error reason)
5140
5251
  *
5141
5252
  * ```ts import.meta.vitest
@@ -5203,6 +5314,12 @@ export const catchReason: {
5203
5314
  /**
5204
5315
  * Catches multiple reasons within a tagged error using an object of handlers.
5205
5316
  *
5317
+ * **Gotchas**
5318
+ *
5319
+ * If the cause contains a defect, the handler is skipped and every typed error
5320
+ * is converted to a defect, preserving reason order and interrupts. An
5321
+ * interruption alongside a typed error does not prevent recovery.
5322
+ *
5206
5323
  * **Example** (Handling multiple error reasons)
5207
5324
  *
5208
5325
  * ```ts import.meta.vitest
@@ -5244,6 +5361,12 @@ export const catchReasons: {
5244
5361
  /**
5245
5362
  * Catches multiple reasons within a tagged error using an object of handlers.
5246
5363
  *
5364
+ * **Gotchas**
5365
+ *
5366
+ * If the cause contains a defect, the handler is skipped and every typed error
5367
+ * is converted to a defect, preserving reason order and interrupts. An
5368
+ * interruption alongside a typed error does not prevent recovery.
5369
+ *
5247
5370
  * **Example** (Handling multiple error reasons)
5248
5371
  *
5249
5372
  * ```ts import.meta.vitest
@@ -5325,6 +5448,12 @@ export const catchReasons: {
5325
5448
  /**
5326
5449
  * Catches multiple reasons within a tagged error using an object of handlers.
5327
5450
  *
5451
+ * **Gotchas**
5452
+ *
5453
+ * If the cause contains a defect, the handler is skipped and every typed error
5454
+ * is converted to a defect, preserving reason order and interrupts. An
5455
+ * interruption alongside a typed error does not prevent recovery.
5456
+ *
5328
5457
  * **Example** (Handling multiple error reasons)
5329
5458
  *
5330
5459
  * ```ts import.meta.vitest
@@ -5707,6 +5836,12 @@ export const catchCause: {
5707
5836
  * they often indicate serious issues. In some cases, such as dynamically loaded
5708
5837
  * plugins, controlled recovery may be needed.
5709
5838
  *
5839
+ * **Gotchas**
5840
+ *
5841
+ * `catchDefect` recovers any cause that contains a defect, including causes
5842
+ * that also contain typed errors. Typed error handlers such as `catch` skip
5843
+ * those causes, so defects always take precedence.
5844
+ *
5710
5845
  * **Example** (Recovering from defects)
5711
5846
  *
5712
5847
  * ```ts import.meta.vitest
@@ -5752,6 +5887,12 @@ export const catchDefect: {
5752
5887
  * they often indicate serious issues. In some cases, such as dynamically loaded
5753
5888
  * plugins, controlled recovery may be needed.
5754
5889
  *
5890
+ * **Gotchas**
5891
+ *
5892
+ * `catchDefect` recovers any cause that contains a defect, including causes
5893
+ * that also contain typed errors. Typed error handlers such as `catch` skip
5894
+ * those causes, so defects always take precedence.
5895
+ *
5755
5896
  * **Example** (Recovering from defects)
5756
5897
  *
5757
5898
  * ```ts import.meta.vitest
@@ -5797,6 +5938,12 @@ export const catchDefect: {
5797
5938
  * they often indicate serious issues. In some cases, such as dynamically loaded
5798
5939
  * plugins, controlled recovery may be needed.
5799
5940
  *
5941
+ * **Gotchas**
5942
+ *
5943
+ * `catchDefect` recovers any cause that contains a defect, including causes
5944
+ * that also contain typed errors. Typed error handlers such as `catch` skip
5945
+ * those causes, so defects always take precedence.
5946
+ *
5800
5947
  * **Example** (Recovering from defects)
5801
5948
  *
5802
5949
  * ```ts import.meta.vitest
@@ -5839,6 +5986,12 @@ export const catchDefect: {
5839
5986
  * matching. Non-matching errors re-fail with the original cause. Defects and
5840
5987
  * interrupts are not caught.
5841
5988
  *
5989
+ * **Gotchas**
5990
+ *
5991
+ * If the cause contains a defect, the handler is skipped and every typed error
5992
+ * is converted to a defect, preserving reason order and interrupts. An
5993
+ * interruption alongside a typed error does not prevent recovery.
5994
+ *
5842
5995
  * **Example** (Recovering when a predicate matches)
5843
5996
  *
5844
5997
  * ```ts import.meta.vitest
@@ -5885,6 +6038,12 @@ export const catchIf: {
5885
6038
  * matching. Non-matching errors re-fail with the original cause. Defects and
5886
6039
  * interrupts are not caught.
5887
6040
  *
6041
+ * **Gotchas**
6042
+ *
6043
+ * If the cause contains a defect, the handler is skipped and every typed error
6044
+ * is converted to a defect, preserving reason order and interrupts. An
6045
+ * interruption alongside a typed error does not prevent recovery.
6046
+ *
5888
6047
  * **Example** (Recovering when a predicate matches)
5889
6048
  *
5890
6049
  * ```ts import.meta.vitest
@@ -5937,6 +6096,12 @@ export const catchIf: {
5937
6096
  * matching. Non-matching errors re-fail with the original cause. Defects and
5938
6097
  * interrupts are not caught.
5939
6098
  *
6099
+ * **Gotchas**
6100
+ *
6101
+ * If the cause contains a defect, the handler is skipped and every typed error
6102
+ * is converted to a defect, preserving reason order and interrupts. An
6103
+ * interruption alongside a typed error does not prevent recovery.
6104
+ *
5940
6105
  * **Example** (Recovering when a predicate matches)
5941
6106
  *
5942
6107
  * ```ts import.meta.vitest
@@ -5989,6 +6154,12 @@ export const catchIf: {
5989
6154
  * matching. Non-matching errors re-fail with the original cause. Defects and
5990
6155
  * interrupts are not caught.
5991
6156
  *
6157
+ * **Gotchas**
6158
+ *
6159
+ * If the cause contains a defect, the handler is skipped and every typed error
6160
+ * is converted to a defect, preserving reason order and interrupts. An
6161
+ * interruption alongside a typed error does not prevent recovery.
6162
+ *
5992
6163
  * **Example** (Recovering when a predicate matches)
5993
6164
  *
5994
6165
  * ```ts import.meta.vitest
@@ -6023,7 +6194,7 @@ export const catchIf: {
6023
6194
  */
6024
6195
  <A, E, R, EB extends E, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(
6025
6196
  self: Effect<A, E, R>,
6026
- refinement: Predicate.Refinement<E, EB>,
6197
+ refinement: Predicate.Refinement<NoInfer<E>, EB>,
6027
6198
  f: (e: EB) => Effect<A2, E2, R2>,
6028
6199
  orElse?: ((e: Exclude<E, EB>) => Effect<A3, E3, R3>) | undefined
6029
6200
  ): Effect<A | A2 | Exclude<A3, unassigned>, E2 | E3 | (A3 extends unassigned ? Exclude<E, EB> : never), R | R2 | R3>
@@ -6040,6 +6211,12 @@ export const catchIf: {
6040
6211
  * matching. Non-matching errors re-fail with the original cause. Defects and
6041
6212
  * interrupts are not caught.
6042
6213
  *
6214
+ * **Gotchas**
6215
+ *
6216
+ * If the cause contains a defect, the handler is skipped and every typed error
6217
+ * is converted to a defect, preserving reason order and interrupts. An
6218
+ * interruption alongside a typed error does not prevent recovery.
6219
+ *
6043
6220
  * **Example** (Recovering when a predicate matches)
6044
6221
  *
6045
6222
  * ```ts import.meta.vitest
@@ -6096,6 +6273,12 @@ export const catchIf: {
6096
6273
  * `orElse` when provided. Without `orElse`, the original failure cause is
6097
6274
  * preserved.
6098
6275
  *
6276
+ * **Gotchas**
6277
+ *
6278
+ * If the cause contains a defect, the handler is skipped and every typed error
6279
+ * is converted to a defect, preserving reason order and interrupts. An
6280
+ * interruption alongside a typed error does not prevent recovery.
6281
+ *
6099
6282
  * @see {@link catchIf} for predicate-based recovery from typed errors
6100
6283
  * @see {@link catchTag} for recovering from a single tagged error
6101
6284
  * @see {@link catchTags} for recovering from several tagged errors
@@ -6122,6 +6305,12 @@ export const catchFilter: {
6122
6305
  * `orElse` when provided. Without `orElse`, the original failure cause is
6123
6306
  * preserved.
6124
6307
  *
6308
+ * **Gotchas**
6309
+ *
6310
+ * If the cause contains a defect, the handler is skipped and every typed error
6311
+ * is converted to a defect, preserving reason order and interrupts. An
6312
+ * interruption alongside a typed error does not prevent recovery.
6313
+ *
6125
6314
  * @see {@link catchIf} for predicate-based recovery from typed errors
6126
6315
  * @see {@link catchTag} for recovering from a single tagged error
6127
6316
  * @see {@link catchTags} for recovering from several tagged errors
@@ -6154,6 +6343,12 @@ export const catchFilter: {
6154
6343
  * `orElse` when provided. Without `orElse`, the original failure cause is
6155
6344
  * preserved.
6156
6345
  *
6346
+ * **Gotchas**
6347
+ *
6348
+ * If the cause contains a defect, the handler is skipped and every typed error
6349
+ * is converted to a defect, preserving reason order and interrupts. An
6350
+ * interruption alongside a typed error does not prevent recovery.
6351
+ *
6157
6352
  * @see {@link catchIf} for predicate-based recovery from typed errors
6158
6353
  * @see {@link catchTag} for recovering from a single tagged error
6159
6354
  * @see {@link catchTags} for recovering from several tagged errors
@@ -6448,6 +6643,9 @@ export const catchCauseFilter: {
6448
6643
  * Only the failure channel is transformed. The success channel and requirements
6449
6644
  * are preserved.
6450
6645
  *
6646
+ * Maps every typed error in the cause, preserving defects, interrupts and
6647
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
6648
+ *
6451
6649
  * **Example** (Transforming the error channel)
6452
6650
  *
6453
6651
  * ```ts import.meta.vitest
@@ -6489,6 +6687,9 @@ export const mapError: {
6489
6687
  * Only the failure channel is transformed. The success channel and requirements
6490
6688
  * are preserved.
6491
6689
  *
6690
+ * Maps every typed error in the cause, preserving defects, interrupts and
6691
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
6692
+ *
6492
6693
  * **Example** (Transforming the error channel)
6493
6694
  *
6494
6695
  * ```ts import.meta.vitest
@@ -6530,6 +6731,9 @@ export const mapError: {
6530
6731
  * Only the failure channel is transformed. The success channel and requirements
6531
6732
  * are preserved.
6532
6733
  *
6734
+ * Maps every typed error in the cause, preserving defects, interrupts and
6735
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
6736
+ *
6533
6737
  * **Example** (Transforming the error channel)
6534
6738
  *
6535
6739
  * ```ts import.meta.vitest
@@ -6575,6 +6779,9 @@ export const mapError: {
6575
6779
  * the error and the success values without altering the overall success or
6576
6780
  * failure status of the effect.
6577
6781
  *
6782
+ * Maps every typed error in the cause, preserving defects, interrupts and
6783
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
6784
+ *
6578
6785
  * **Example** (Transforming success and failure channels)
6579
6786
  *
6580
6787
  * ```ts import.meta.vitest
@@ -6618,6 +6825,9 @@ export const mapBoth: {
6618
6825
  * the error and the success values without altering the overall success or
6619
6826
  * failure status of the effect.
6620
6827
  *
6828
+ * Maps every typed error in the cause, preserving defects, interrupts and
6829
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
6830
+ *
6621
6831
  * **Example** (Transforming success and failure channels)
6622
6832
  *
6623
6833
  * ```ts import.meta.vitest
@@ -6663,6 +6873,9 @@ export const mapBoth: {
6663
6873
  * the error and the success values without altering the overall success or
6664
6874
  * failure status of the effect.
6665
6875
  *
6876
+ * Maps every typed error in the cause, preserving defects, interrupts and
6877
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
6878
+ *
6666
6879
  * **Example** (Transforming success and failure channels)
6667
6880
  *
6668
6881
  * ```ts import.meta.vitest
@@ -7492,7 +7705,9 @@ export declare namespace Retry {
7492
7705
  * applied. For example, `Schedule.recurs(3)` allows up to three retries after
7493
7706
  * the initial attempt.
7494
7707
  *
7495
- * Defects and interruptions are not retried.
7708
+ * Defects take precedence over typed errors. A failure whose cause contains a
7709
+ * defect is not retried and is propagated with every typed error converted to a
7710
+ * defect. A typed error alongside an interruption is retried.
7496
7711
  *
7497
7712
  * **Example** (Retrying with a schedule)
7498
7713
  *
@@ -7545,7 +7760,9 @@ export const retry: {
7545
7760
  * applied. For example, `Schedule.recurs(3)` allows up to three retries after
7546
7761
  * the initial attempt.
7547
7762
  *
7548
- * Defects and interruptions are not retried.
7763
+ * Defects take precedence over typed errors. A failure whose cause contains a
7764
+ * defect is not retried and is propagated with every typed error converted to a
7765
+ * defect. A typed error alongside an interruption is retried.
7549
7766
  *
7550
7767
  * **Example** (Retrying with a schedule)
7551
7768
  *
@@ -7598,7 +7815,9 @@ export const retry: {
7598
7815
  * applied. For example, `Schedule.recurs(3)` allows up to three retries after
7599
7816
  * the initial attempt.
7600
7817
  *
7601
- * Defects and interruptions are not retried.
7818
+ * Defects take precedence over typed errors. A failure whose cause contains a
7819
+ * defect is not retried and is propagated with every typed error converted to a
7820
+ * defect. A typed error alongside an interruption is retried.
7602
7821
  *
7603
7822
  * **Example** (Retrying with a schedule)
7604
7823
  *
@@ -7651,7 +7870,9 @@ export const retry: {
7651
7870
  * applied. For example, `Schedule.recurs(3)` allows up to three retries after
7652
7871
  * the initial attempt.
7653
7872
  *
7654
- * Defects and interruptions are not retried.
7873
+ * Defects take precedence over typed errors. A failure whose cause contains a
7874
+ * defect is not retried and is propagated with every typed error converted to a
7875
+ * defect. A typed error alongside an interruption is retried.
7655
7876
  *
7656
7877
  * **Example** (Retrying with a schedule)
7657
7878
  *
@@ -7708,7 +7929,9 @@ export const retry: {
7708
7929
  * applied. For example, `Schedule.recurs(3)` allows up to three retries after
7709
7930
  * the initial attempt.
7710
7931
  *
7711
- * Defects and interruptions are not retried.
7932
+ * Defects take precedence over typed errors. A failure whose cause contains a
7933
+ * defect is not retried and is propagated with every typed error converted to a
7934
+ * defect. A typed error alongside an interruption is retried.
7712
7935
  *
7713
7936
  * **Example** (Retrying with a schedule)
7714
7937
  *
@@ -7761,7 +7984,9 @@ export const retry: {
7761
7984
  * applied. For example, `Schedule.recurs(3)` allows up to three retries after
7762
7985
  * the initial attempt.
7763
7986
  *
7764
- * Defects and interruptions are not retried.
7987
+ * Defects take precedence over typed errors. A failure whose cause contains a
7988
+ * defect is not retried and is propagated with every typed error converted to a
7989
+ * defect. A typed error alongside an interruption is retried.
7765
7990
  *
7766
7991
  * **Example** (Retrying with a schedule)
7767
7992
  *
@@ -7814,7 +8039,9 @@ export const retry: {
7814
8039
  * applied. For example, `Schedule.recurs(3)` allows up to three retries after
7815
8040
  * the initial attempt.
7816
8041
  *
7817
- * Defects and interruptions are not retried.
8042
+ * Defects take precedence over typed errors. A failure whose cause contains a
8043
+ * defect is not retried and is propagated with every typed error converted to a
8044
+ * defect. A typed error alongside an interruption is retried.
7818
8045
  *
7819
8046
  * **Example** (Retrying with a schedule)
7820
8047
  *
@@ -7869,6 +8096,14 @@ export const retry: {
7869
8096
  * If the retries are exhausted and the effect still fails, it runs a fallback
7870
8097
  * effect instead.
7871
8098
  *
8099
+ * **Gotchas**
8100
+ *
8101
+ * Defects take precedence over typed errors. A failure whose cause contains a
8102
+ * defect is not retried and is propagated with every typed error converted to a
8103
+ * defect. A typed error alongside an interruption is retried. When the cause
8104
+ * contains a defect, `orElse` does not run.
8105
+ * This applies to source failures only; policy failures propagate unchanged.
8106
+ *
7872
8107
  * **Example** (Falling back after retries are exhausted)
7873
8108
  *
7874
8109
  * ```ts import.meta.vitest
@@ -7924,6 +8159,14 @@ export const retryOrElse: {
7924
8159
  * If the retries are exhausted and the effect still fails, it runs a fallback
7925
8160
  * effect instead.
7926
8161
  *
8162
+ * **Gotchas**
8163
+ *
8164
+ * Defects take precedence over typed errors. A failure whose cause contains a
8165
+ * defect is not retried and is propagated with every typed error converted to a
8166
+ * defect. A typed error alongside an interruption is retried. When the cause
8167
+ * contains a defect, `orElse` does not run.
8168
+ * This applies to source failures only; policy failures propagate unchanged.
8169
+ *
7927
8170
  * **Example** (Falling back after retries are exhausted)
7928
8171
  *
7929
8172
  * ```ts import.meta.vitest
@@ -7982,6 +8225,14 @@ export const retryOrElse: {
7982
8225
  * If the retries are exhausted and the effect still fails, it runs a fallback
7983
8226
  * effect instead.
7984
8227
  *
8228
+ * **Gotchas**
8229
+ *
8230
+ * Defects take precedence over typed errors. A failure whose cause contains a
8231
+ * defect is not retried and is propagated with every typed error converted to a
8232
+ * defect. A typed error alongside an interruption is retried. When the cause
8233
+ * contains a defect, `orElse` does not run.
8234
+ * This applies to source failures only; policy failures propagate unchanged.
8235
+ *
7985
8236
  * **Example** (Falling back after retries are exhausted)
7986
8237
  *
7987
8238
  * ```ts import.meta.vitest
@@ -8033,8 +8284,8 @@ export const retryOrElse: {
8033
8284
  * **Details**
8034
8285
  *
8035
8286
  * Use `sandbox` when downstream error handling needs to distinguish typed
8036
- * failures, defects, and interruptions. Use `unsandbox` to restore the original
8037
- * typed error channel after cause-level handling.
8287
+ * failures, defects, and interruptions. Use `Effect.catch(Effect.failCause)` to
8288
+ * restore the original typed error channel after cause-level handling.
8038
8289
  *
8039
8290
  * **Example** (Exposing failures as causes)
8040
8291
  *
@@ -8073,6 +8324,13 @@ export const sandbox: <A, E, R>(
8073
8324
  * Use the `log` option to emit the full {@link Cause} when the effect fails,
8074
8325
  * and `message` to prepend a custom log message.
8075
8326
  *
8327
+ * **Gotchas**
8328
+ *
8329
+ * Defects take precedence over typed errors. If the cause also contains a
8330
+ * defect, the failure is not ignored and is propagated with every typed error
8331
+ * converted to a defect. An interruption alongside a typed error does not
8332
+ * prevent the error from being ignored.
8333
+ *
8076
8334
  * **Example** (Discarding success and failure values)
8077
8335
  *
8078
8336
  * ```ts import.meta.vitest
@@ -8449,6 +8707,12 @@ export const withErrorReporting: <
8449
8707
  *
8450
8708
  * Defects and interruptions are not recovered by this operator.
8451
8709
  *
8710
+ * **Gotchas**
8711
+ *
8712
+ * If the cause contains a defect, the handler is skipped and every typed error
8713
+ * is converted to a defect, preserving reason order and interrupts. An
8714
+ * interruption alongside a typed error does not prevent recovery.
8715
+ *
8452
8716
  * **Example** (Replacing failures with a value)
8453
8717
  *
8454
8718
  * ```ts import.meta.vitest
@@ -8490,6 +8754,12 @@ export const orElseSucceed: {
8490
8754
  *
8491
8755
  * Defects and interruptions are not recovered by this operator.
8492
8756
  *
8757
+ * **Gotchas**
8758
+ *
8759
+ * If the cause contains a defect, the handler is skipped and every typed error
8760
+ * is converted to a defect, preserving reason order and interrupts. An
8761
+ * interruption alongside a typed error does not prevent recovery.
8762
+ *
8493
8763
  * **Example** (Replacing failures with a value)
8494
8764
  *
8495
8765
  * ```ts import.meta.vitest
@@ -8531,6 +8801,12 @@ export const orElseSucceed: {
8531
8801
  *
8532
8802
  * Defects and interruptions are not recovered by this operator.
8533
8803
  *
8804
+ * **Gotchas**
8805
+ *
8806
+ * If the cause contains a defect, the handler is skipped and every typed error
8807
+ * is converted to a defect, preserving reason order and interrupts. An
8808
+ * interruption alongside a typed error does not prevent recovery.
8809
+ *
8534
8810
  * **Example** (Replacing failures with a value)
8535
8811
  *
8536
8812
  * ```ts import.meta.vitest
@@ -10602,6 +10878,12 @@ export const when: {
10602
10878
  * to process the result if the effect succeeds, or handle the error if the
10603
10879
  * effect fails.
10604
10880
  *
10881
+ * **Gotchas**
10882
+ *
10883
+ * If the cause contains a defect, the handler is skipped and every typed error
10884
+ * is converted to a defect, preserving reason order and interrupts. An
10885
+ * interruption alongside a typed error does not prevent recovery.
10886
+ *
10605
10887
  * **Example** (Matching success and failure values)
10606
10888
  *
10607
10889
  * ```ts import.meta.vitest
@@ -10658,6 +10940,12 @@ export const match: {
10658
10940
  * to process the result if the effect succeeds, or handle the error if the
10659
10941
  * effect fails.
10660
10942
  *
10943
+ * **Gotchas**
10944
+ *
10945
+ * If the cause contains a defect, the handler is skipped and every typed error
10946
+ * is converted to a defect, preserving reason order and interrupts. An
10947
+ * interruption alongside a typed error does not prevent recovery.
10948
+ *
10661
10949
  * **Example** (Matching success and failure values)
10662
10950
  *
10663
10951
  * ```ts import.meta.vitest
@@ -10719,6 +11007,12 @@ export const match: {
10719
11007
  * to process the result if the effect succeeds, or handle the error if the
10720
11008
  * effect fails.
10721
11009
  *
11010
+ * **Gotchas**
11011
+ *
11012
+ * If the cause contains a defect, the handler is skipped and every typed error
11013
+ * is converted to a defect, preserving reason order and interrupts. An
11014
+ * interruption alongside a typed error does not prevent recovery.
11015
+ *
10722
11016
  * **Example** (Matching success and failure values)
10723
11017
  *
10724
11018
  * ```ts import.meta.vitest
@@ -10779,6 +11073,12 @@ export const match: {
10779
11073
  * the handlers immediately without fiber scheduling. For unresolved effects,
10780
11074
  * it falls back to the regular `match` behavior.
10781
11075
  *
11076
+ * **Gotchas**
11077
+ *
11078
+ * If the cause contains a defect, the handler is skipped and every typed error
11079
+ * is converted to a defect, preserving reason order and interrupts. An
11080
+ * interruption alongside a typed error does not prevent recovery.
11081
+ *
10782
11082
  * **Example** (Pattern matching eagerly when possible)
10783
11083
  *
10784
11084
  * ```ts import.meta.vitest
@@ -10820,6 +11120,12 @@ export const matchEager: {
10820
11120
  * the handlers immediately without fiber scheduling. For unresolved effects,
10821
11121
  * it falls back to the regular `match` behavior.
10822
11122
  *
11123
+ * **Gotchas**
11124
+ *
11125
+ * If the cause contains a defect, the handler is skipped and every typed error
11126
+ * is converted to a defect, preserving reason order and interrupts. An
11127
+ * interruption alongside a typed error does not prevent recovery.
11128
+ *
10823
11129
  * **Example** (Pattern matching eagerly when possible)
10824
11130
  *
10825
11131
  * ```ts import.meta.vitest
@@ -10866,6 +11172,12 @@ export const matchEager: {
10866
11172
  * the handlers immediately without fiber scheduling. For unresolved effects,
10867
11173
  * it falls back to the regular `match` behavior.
10868
11174
  *
11175
+ * **Gotchas**
11176
+ *
11177
+ * If the cause contains a defect, the handler is skipped and every typed error
11178
+ * is converted to a defect, preserving reason order and interrupts. An
11179
+ * interruption alongside a typed error does not prevent recovery.
11180
+ *
10869
11181
  * **Example** (Pattern matching eagerly when possible)
10870
11182
  *
10871
11183
  * ```ts import.meta.vitest
@@ -11412,6 +11724,12 @@ export const matchCauseEffect: {
11412
11724
  * performing logging, recovery, notification, or other effectful work. The
11413
11725
  * returned effect succeeds or fails according to the handler that is run.
11414
11726
  *
11727
+ * **Gotchas**
11728
+ *
11729
+ * If the cause contains a defect, the handler is skipped and every typed error
11730
+ * is converted to a defect, preserving reason order and interrupts. An
11731
+ * interruption alongside a typed error does not prevent recovery.
11732
+ *
11415
11733
  * **Example** (Matching success and failure with effectful handlers)
11416
11734
  *
11417
11735
  * ```ts import.meta.vitest
@@ -11464,6 +11782,12 @@ export const matchEffect: {
11464
11782
  * performing logging, recovery, notification, or other effectful work. The
11465
11783
  * returned effect succeeds or fails according to the handler that is run.
11466
11784
  *
11785
+ * **Gotchas**
11786
+ *
11787
+ * If the cause contains a defect, the handler is skipped and every typed error
11788
+ * is converted to a defect, preserving reason order and interrupts. An
11789
+ * interruption alongside a typed error does not prevent recovery.
11790
+ *
11467
11791
  * **Example** (Matching success and failure with effectful handlers)
11468
11792
  *
11469
11793
  * ```ts import.meta.vitest
@@ -11521,6 +11845,12 @@ export const matchEffect: {
11521
11845
  * performing logging, recovery, notification, or other effectful work. The
11522
11846
  * returned effect succeeds or fails according to the handler that is run.
11523
11847
  *
11848
+ * **Gotchas**
11849
+ *
11850
+ * If the cause contains a defect, the handler is skipped and every typed error
11851
+ * is converted to a defect, preserving reason order and interrupts. An
11852
+ * interruption alongside a typed error does not prevent recovery.
11853
+ *
11524
11854
  * **Example** (Matching success and failure with effectful handlers)
11525
11855
  *
11526
11856
  * ```ts import.meta.vitest
@@ -11751,9 +12081,9 @@ export const contextWith: <R, A, E, R2>(
11751
12081
  ) => Effect<A, E, R | R2> = internal.contextWith
11752
12082
 
11753
12083
  /**
11754
- * Provides dependencies to an effect using layers or a context. Use `options.local`
11755
- * to build the layer every time; by default, layers are shared between provide
11756
- * calls.
12084
+ * Provides dependencies to an effect using layers or a context. A layer already
12085
+ * built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
12086
+ * build their own copies. Use `options.local` to build a fresh layer subtree.
11757
12087
  *
11758
12088
  * **Example** (Providing dependencies with a layer)
11759
12089
  *
@@ -11786,9 +12116,9 @@ export const contextWith: <R, A, E, R2>(
11786
12116
  */
11787
12117
  export const provide: {
11788
12118
  /**
11789
- * Provides dependencies to an effect using layers or a context. Use `options.local`
11790
- * to build the layer every time; by default, layers are shared between provide
11791
- * calls.
12119
+ * Provides dependencies to an effect using layers or a context. A layer already
12120
+ * built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
12121
+ * build their own copies. Use `options.local` to build a fresh layer subtree.
11792
12122
  *
11793
12123
  * **Example** (Providing dependencies with a layer)
11794
12124
  *
@@ -11832,9 +12162,9 @@ export const provide: {
11832
12162
  Layer.Services<Layers[number]> | Exclude<R, Layer.Success<Layers[number]>>
11833
12163
  >
11834
12164
  /**
11835
- * Provides dependencies to an effect using layers or a context. Use `options.local`
11836
- * to build the layer every time; by default, layers are shared between provide
11837
- * calls.
12165
+ * Provides dependencies to an effect using layers or a context. A layer already
12166
+ * built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
12167
+ * build their own copies. Use `options.local` to build a fresh layer subtree.
11838
12168
  *
11839
12169
  * **Example** (Providing dependencies with a layer)
11840
12170
  *
@@ -11874,9 +12204,9 @@ export const provide: {
11874
12204
  self: Effect<A, E, R>
11875
12205
  ) => Effect<A, E | E2, RIn | Exclude<R, ROut>>
11876
12206
  /**
11877
- * Provides dependencies to an effect using layers or a context. Use `options.local`
11878
- * to build the layer every time; by default, layers are shared between provide
11879
- * calls.
12207
+ * Provides dependencies to an effect using layers or a context. A layer already
12208
+ * built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
12209
+ * build their own copies. Use `options.local` to build a fresh layer subtree.
11880
12210
  *
11881
12211
  * **Example** (Providing dependencies with a layer)
11882
12212
  *
@@ -11909,9 +12239,9 @@ export const provide: {
11909
12239
  */
11910
12240
  <R2>(context: Context.Context<R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, R2>>
11911
12241
  /**
11912
- * Provides dependencies to an effect using layers or a context. Use `options.local`
11913
- * to build the layer every time; by default, layers are shared between provide
11914
- * calls.
12242
+ * Provides dependencies to an effect using layers or a context. A layer already
12243
+ * built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
12244
+ * build their own copies. Use `options.local` to build a fresh layer subtree.
11915
12245
  *
11916
12246
  * **Example** (Providing dependencies with a layer)
11917
12247
  *
@@ -11954,9 +12284,9 @@ export const provide: {
11954
12284
  Layer.Services<Layers[number]> | Exclude<R, Layer.Success<Layers[number]>>
11955
12285
  >
11956
12286
  /**
11957
- * Provides dependencies to an effect using layers or a context. Use `options.local`
11958
- * to build the layer every time; by default, layers are shared between provide
11959
- * calls.
12287
+ * Provides dependencies to an effect using layers or a context. A layer already
12288
+ * built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
12289
+ * build their own copies. Use `options.local` to build a fresh layer subtree.
11960
12290
  *
11961
12291
  * **Example** (Providing dependencies with a layer)
11962
12292
  *
@@ -11995,9 +12325,9 @@ export const provide: {
11995
12325
  } | undefined
11996
12326
  ): Effect<A, E | E2, RIn | Exclude<R, ROut>>
11997
12327
  /**
11998
- * Provides dependencies to an effect using layers or a context. Use `options.local`
11999
- * to build the layer every time; by default, layers are shared between provide
12000
- * calls.
12328
+ * Provides dependencies to an effect using layers or a context. A layer already
12329
+ * built by an enclosing `provide` or runtime is reused. Sibling `provide` calls
12330
+ * build their own copies. Use `options.local` to build a fresh layer subtree.
12001
12331
  *
12002
12332
  * **Example** (Providing dependencies with a layer)
12003
12333
  *
@@ -12797,103 +13127,7 @@ export const provideService: {
12797
13127
  * @since 2.0.0
12798
13128
  */
12799
13129
  <I, S>(service: Context.Key<I, S>): {
12800
- /**
12801
- * Provides one concrete service implementation to an effect.
12802
- *
12803
- * **When to use**
12804
- *
12805
- * Use to satisfy one service requirement with an already-built implementation.
12806
- *
12807
- * **Details**
12808
- *
12809
- * The service requirement identified by the `Context.Key` is removed from the
12810
- * effect requirements after the implementation is provided.
12811
- *
12812
- * **Example** (Providing a service value)
12813
- *
12814
- * ```ts import.meta.vitest
12815
- * import { Context, Effect } from "effect"
12816
- * const output: Array<unknown> = []
12817
- *
12818
- * // Define a service for configuration
12819
- * const Config = Context.Service<{
12820
- * apiUrl: string
12821
- * timeout: number
12822
- * }>("Config")
12823
- *
12824
- * const fetchData = Effect.gen(function*() {
12825
- * const config = yield* Effect.service(Config)
12826
- * yield* Effect.sync(() => { output.push(`Fetching from: ${config.apiUrl}`) })
12827
- * yield* Effect.sync(() => { output.push(`Timeout: ${config.timeout}ms`) })
12828
- * return "data"
12829
- * })
12830
- *
12831
- * // Provide the service implementation
12832
- * const program = Effect.provideService(fetchData, Config, {
12833
- * apiUrl: "https://api.example.com",
12834
- * timeout: 5000
12835
- * })
12836
- *
12837
- * void output.push(Effect.runSync(program))
12838
- * output // => ["Fetching from: https://api.example.com", "Timeout: 5000ms", "data"]
12839
- * ```
12840
- *
12841
- * @see {@link provide} for providing multiple layers to an effect.
12842
- * @see {@link provideServiceEffect} for acquiring the service implementation effectfully.
12843
- * @see {@link provideContext} for providing a complete context.
12844
- * @stability stable
12845
- * @category providing services
12846
- * @since 2.0.0
12847
- */
12848
13130
  (implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>
12849
- /**
12850
- * Provides one concrete service implementation to an effect.
12851
- *
12852
- * **When to use**
12853
- *
12854
- * Use to satisfy one service requirement with an already-built implementation.
12855
- *
12856
- * **Details**
12857
- *
12858
- * The service requirement identified by the `Context.Key` is removed from the
12859
- * effect requirements after the implementation is provided.
12860
- *
12861
- * **Example** (Providing a service value)
12862
- *
12863
- * ```ts import.meta.vitest
12864
- * import { Context, Effect } from "effect"
12865
- * const output: Array<unknown> = []
12866
- *
12867
- * // Define a service for configuration
12868
- * const Config = Context.Service<{
12869
- * apiUrl: string
12870
- * timeout: number
12871
- * }>("Config")
12872
- *
12873
- * const fetchData = Effect.gen(function*() {
12874
- * const config = yield* Effect.service(Config)
12875
- * yield* Effect.sync(() => { output.push(`Fetching from: ${config.apiUrl}`) })
12876
- * yield* Effect.sync(() => { output.push(`Timeout: ${config.timeout}ms`) })
12877
- * return "data"
12878
- * })
12879
- *
12880
- * // Provide the service implementation
12881
- * const program = Effect.provideService(fetchData, Config, {
12882
- * apiUrl: "https://api.example.com",
12883
- * timeout: 5000
12884
- * })
12885
- *
12886
- * void output.push(Effect.runSync(program))
12887
- * output // => ["Fetching from: https://api.example.com", "Timeout: 5000ms", "data"]
12888
- * ```
12889
- *
12890
- * @see {@link provide} for providing multiple layers to an effect.
12891
- * @see {@link provideServiceEffect} for acquiring the service implementation effectfully.
12892
- * @see {@link provideContext} for providing a complete context.
12893
- * @stability stable
12894
- * @category providing services
12895
- * @since 2.0.0
12896
- */
12897
13131
  <A, E, R>(self: Effect<A, E, R>, implementation: S): Effect<A, E, Exclude<R, I>>
12898
13132
  }
12899
13133
  /**
@@ -15412,6 +15646,10 @@ export const forever: <
15412
15646
  * The source effect is always evaluated once before the schedule is stepped.
15413
15647
  * The schedule controls additional repetitions, not the initial execution.
15414
15648
  *
15649
+ * If the effect or policy fails with a cause that contains a defect, the
15650
+ * failure is propagated with every typed error converted to a defect.
15651
+ * An interruption alongside a typed error does not block the typed error path.
15652
+ *
15415
15653
  * **Example** (Repeating successful effects with a schedule)
15416
15654
  *
15417
15655
  * ```ts import.meta.vitest
@@ -15494,6 +15732,10 @@ export const repeat: {
15494
15732
  * The source effect is always evaluated once before the schedule is stepped.
15495
15733
  * The schedule controls additional repetitions, not the initial execution.
15496
15734
  *
15735
+ * If the effect or policy fails with a cause that contains a defect, the
15736
+ * failure is propagated with every typed error converted to a defect.
15737
+ * An interruption alongside a typed error does not block the typed error path.
15738
+ *
15497
15739
  * **Example** (Repeating successful effects with a schedule)
15498
15740
  *
15499
15741
  * ```ts import.meta.vitest
@@ -15576,6 +15818,10 @@ export const repeat: {
15576
15818
  * The source effect is always evaluated once before the schedule is stepped.
15577
15819
  * The schedule controls additional repetitions, not the initial execution.
15578
15820
  *
15821
+ * If the effect or policy fails with a cause that contains a defect, the
15822
+ * failure is propagated with every typed error converted to a defect.
15823
+ * An interruption alongside a typed error does not block the typed error path.
15824
+ *
15579
15825
  * **Example** (Repeating successful effects with a schedule)
15580
15826
  *
15581
15827
  * ```ts import.meta.vitest
@@ -15658,6 +15904,10 @@ export const repeat: {
15658
15904
  * The source effect is always evaluated once before the schedule is stepped.
15659
15905
  * The schedule controls additional repetitions, not the initial execution.
15660
15906
  *
15907
+ * If the effect or policy fails with a cause that contains a defect, the
15908
+ * failure is propagated with every typed error converted to a defect.
15909
+ * An interruption alongside a typed error does not block the typed error path.
15910
+ *
15661
15911
  * **Example** (Repeating successful effects with a schedule)
15662
15912
  *
15663
15913
  * ```ts import.meta.vitest
@@ -15744,6 +15994,10 @@ export const repeat: {
15744
15994
  * The source effect is always evaluated once before the schedule is stepped.
15745
15995
  * The schedule controls additional repetitions, not the initial execution.
15746
15996
  *
15997
+ * If the effect or policy fails with a cause that contains a defect, the
15998
+ * failure is propagated with every typed error converted to a defect.
15999
+ * An interruption alongside a typed error does not block the typed error path.
16000
+ *
15747
16001
  * **Example** (Repeating successful effects with a schedule)
15748
16002
  *
15749
16003
  * ```ts import.meta.vitest
@@ -15826,6 +16080,10 @@ export const repeat: {
15826
16080
  * The source effect is always evaluated once before the schedule is stepped.
15827
16081
  * The schedule controls additional repetitions, not the initial execution.
15828
16082
  *
16083
+ * If the effect or policy fails with a cause that contains a defect, the
16084
+ * failure is propagated with every typed error converted to a defect.
16085
+ * An interruption alongside a typed error does not block the typed error path.
16086
+ *
15829
16087
  * **Example** (Repeating successful effects with a schedule)
15830
16088
  *
15831
16089
  * ```ts import.meta.vitest
@@ -15911,6 +16169,10 @@ export const repeat: {
15911
16169
  * The source effect is always evaluated once before the schedule is stepped.
15912
16170
  * The schedule controls additional repetitions, not the initial execution.
15913
16171
  *
16172
+ * If the effect or policy fails with a cause that contains a defect, the
16173
+ * failure is propagated with every typed error converted to a defect.
16174
+ * An interruption alongside a typed error does not block the typed error path.
16175
+ *
15914
16176
  * **Example** (Repeating successful effects with a schedule)
15915
16177
  *
15916
16178
  * ```ts import.meta.vitest
@@ -15985,6 +16247,13 @@ export const repeat: {
15985
16247
  * otherwise it receives `None`. If the schedule completes normally, the
15986
16248
  * returned effect succeeds with the schedule's output.
15987
16249
  *
16250
+ * **Gotchas**
16251
+ *
16252
+ * Defects take precedence over typed errors from either the effect or policy.
16253
+ * If the cause contains a defect, `orElse` does not run and every typed error
16254
+ * is converted to a defect. An interruption alongside a typed error does not
16255
+ * prevent `orElse` from running.
16256
+ *
15988
16257
  * **Example** (Recovering after repetition stops)
15989
16258
  *
15990
16259
  * ```ts import.meta.vitest
@@ -16038,6 +16307,13 @@ export const repeatOrElse: {
16038
16307
  * otherwise it receives `None`. If the schedule completes normally, the
16039
16308
  * returned effect succeeds with the schedule's output.
16040
16309
  *
16310
+ * **Gotchas**
16311
+ *
16312
+ * Defects take precedence over typed errors from either the effect or policy.
16313
+ * If the cause contains a defect, `orElse` does not run and every typed error
16314
+ * is converted to a defect. An interruption alongside a typed error does not
16315
+ * prevent `orElse` from running.
16316
+ *
16041
16317
  * **Example** (Recovering after repetition stops)
16042
16318
  *
16043
16319
  * ```ts import.meta.vitest
@@ -16094,6 +16370,13 @@ export const repeatOrElse: {
16094
16370
  * otherwise it receives `None`. If the schedule completes normally, the
16095
16371
  * returned effect succeeds with the schedule's output.
16096
16372
  *
16373
+ * **Gotchas**
16374
+ *
16375
+ * Defects take precedence over typed errors from either the effect or policy.
16376
+ * If the cause contains a defect, `orElse` does not run and every typed error
16377
+ * is converted to a defect. An interruption alongside a typed error does not
16378
+ * prevent `orElse` from running.
16379
+ *
16097
16380
  * **Example** (Recovering after repetition stops)
16098
16381
  *
16099
16382
  * ```ts import.meta.vitest
@@ -17912,8 +18195,8 @@ export const requestUnsafe: <A extends Request.Any>(
17912
18195
  * You can use the `forkChild` method whenever you want to execute an effect in a
17913
18196
  * new fiber, concurrently and without "blocking" the fiber executing other
17914
18197
  * effects. Using fibers can be tricky, so instead of using this method
17915
- * directly, consider other higher-level methods, such as `raceWith`,
17916
- * `zipPar`, and so forth.
18198
+ * directly, consider higher-level methods such as `Effect.race`,
18199
+ * `Effect.raceFirst`, or `Effect.all` with a concurrency option.
17917
18200
  *
17918
18201
  * The fiber returned by this method has methods to interrupt the fiber and to
17919
18202
  * wait for it to finish executing the effect. See `Fiber` for more
@@ -18105,9 +18388,14 @@ export const forkScoped: <
18105
18388
  : <A, E, R>(self: Effect<A, E, R>) => Effect<Fiber<A, E>, never, R | Scope> = internal.forkScoped
18106
18389
 
18107
18390
  /**
18108
- * Forks the effect into a new fiber attached to the global scope. Because the
18109
- * new fiber is attached to the global scope, when the fiber executing the
18110
- * returned effect terminates, the forked fiber will continue running.
18391
+ * Forks the effect into a new fiber with no parent and no scope, so its lifetime
18392
+ * is independent of the forking fiber.
18393
+ *
18394
+ * **Details**
18395
+ *
18396
+ * The detached fiber inherits the forking fiber's context. It continues running
18397
+ * until it completes or is explicitly interrupted through the returned handle,
18398
+ * even after the forking fiber terminates.
18111
18399
  *
18112
18400
  * **Example** (Forking a detached fiber)
18113
18401
  *
@@ -18265,11 +18553,11 @@ export interface RunOptions {
18265
18553
  * import { Effect, Fiber } from "effect"
18266
18554
  * const output: Array<unknown> = []
18267
18555
  *
18268
- * // ┌─── Effect<number, never, never>
18556
+ * // ┌─── Effect<string, never, never>
18269
18557
  * // ▼
18270
18558
  * const program = Effect.sync(() => { output.push("running...") }).pipe(Effect.as("done"))
18271
18559
  *
18272
- * // ┌─── RuntimeFiber<number, never>
18560
+ * // ┌─── Fiber<string, never>
18273
18561
  * // ▼
18274
18562
  * const fiber = Effect.runFork(program)
18275
18563
  *
@@ -18604,9 +18892,10 @@ export const runPromiseExitWith: <R>(
18604
18892
  *
18605
18893
  * **Details**
18606
18894
  *
18607
- * If the effect fails, dies, is interrupted, or performs asynchronous work,
18608
- * `runSync` throws a `FiberFailure` instead of returning a value. Use
18609
- * `runSyncExit` when you want the failure captured as an `Exit`.
18895
+ * If the effect fails, dies, or is interrupted, `runSync` throws the squashed
18896
+ * cause instead of returning a value. Typed errors can be thrown directly,
18897
+ * including non-Error values. Asynchronous work throws `Cause.AsyncFiberError`.
18898
+ * Use `runSyncExit` when you want the failure captured as an `Exit`.
18610
18899
  *
18611
18900
  * **Example** (Running a synchronous effect)
18612
18901
  *
@@ -25829,7 +26118,7 @@ type EffectifyArgs<F extends (...args: Array<any>) => any> = Parameters<F> exten
25829
26118
  * **Details**
25830
26119
  *
25831
26120
  * The original function is called with the supplied arguments plus a final
25832
- * callback. A non-null callback error fails the returned effect, while a
26121
+ * callback. A truthy callback error fails the returned effect, while a
25833
26122
  * successful callback value becomes the effect success. Use `onError` to map
25834
26123
  * callback errors and `onSyncError` to turn synchronous throws into typed
25835
26124
  * failures; otherwise synchronous throws become defects.
@@ -25883,7 +26172,7 @@ export const effectify: {
25883
26172
  * **Details**
25884
26173
  *
25885
26174
  * The original function is called with the supplied arguments plus a final
25886
- * callback. A non-null callback error fails the returned effect, while a
26175
+ * callback. A truthy callback error fails the returned effect, while a
25887
26176
  * successful callback value becomes the effect success. Use `onError` to map
25888
26177
  * callback errors and `onSyncError` to turn synchronous throws into typed
25889
26178
  * failures; otherwise synchronous throws become defects.
@@ -25937,7 +26226,7 @@ export const effectify: {
25937
26226
  * **Details**
25938
26227
  *
25939
26228
  * The original function is called with the supplied arguments plus a final
25940
- * callback. A non-null callback error fails the returned effect, while a
26229
+ * callback. A truthy callback error fails the returned effect, while a
25941
26230
  * successful callback value becomes the effect success. Use `onError` to map
25942
26231
  * callback errors and `onSyncError` to turn synchronous throws into typed
25943
26232
  * failures; otherwise synchronous throws become defects.
@@ -25994,7 +26283,7 @@ export const effectify: {
25994
26283
  * **Details**
25995
26284
  *
25996
26285
  * The original function is called with the supplied arguments plus a final
25997
- * callback. A non-null callback error fails the returned effect, while a
26286
+ * callback. A truthy callback error fails the returned effect, while a
25998
26287
  * successful callback value becomes the effect success. Use `onError` to map
25999
26288
  * callback errors and `onSyncError` to turn synchronous throws into typed
26000
26289
  * failures; otherwise synchronous throws become defects.
@@ -26049,16 +26338,26 @@ export const effectify: {
26049
26338
  (<A>(fn: Function, onError?: (e: any, args: any) => any, onSyncError?: (e: any, args: any) => any) =>
26050
26339
  (...args: Array<any>) =>
26051
26340
  callback<A, globalThis.Error>((resume) => {
26341
+ let synchronous = true
26342
+ let pending: Effect<A, globalThis.Error> | undefined
26052
26343
  try {
26053
26344
  fn(...args, (err: globalThis.Error | null, result: A) => {
26054
- if (err) {
26055
- resume(onError ? suspend(() => fail(onError(err, args))) : fail(err))
26345
+ const effect = err
26346
+ ? onError ? suspend(() => fail(onError(err, args))) : fail(err)
26347
+ : succeed(result)
26348
+ if (synchronous) {
26349
+ // Keep the first callback result until registration succeeds.
26350
+ pending ??= effect
26056
26351
  } else {
26057
- resume(succeed(result))
26352
+ resume(effect)
26058
26353
  }
26059
26354
  })
26060
26355
  } catch (err) {
26061
- resume(onSyncError ? fail(onSyncError(err, args)) : die(err))
26356
+ pending = onSyncError ? fail(onSyncError(err, args)) : die(err)
26357
+ }
26358
+ synchronous = false
26359
+ if (pending) {
26360
+ resume(pending)
26062
26361
  }
26063
26362
  })) as any
26064
26363
 
@@ -26282,6 +26581,9 @@ export const mapEager: {
26282
26581
  * transform. Failure effects apply the mapping function immediately, and
26283
26582
  * pending effects fall back to regular `mapError` behavior.
26284
26583
  *
26584
+ * Maps every typed error in the cause, preserving defects, interrupts and
26585
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
26586
+ *
26285
26587
  * **Example** (Mapping errors eagerly when possible)
26286
26588
  *
26287
26589
  * ```ts import.meta.vitest
@@ -26326,6 +26628,9 @@ export const mapErrorEager: {
26326
26628
  * transform. Failure effects apply the mapping function immediately, and
26327
26629
  * pending effects fall back to regular `mapError` behavior.
26328
26630
  *
26631
+ * Maps every typed error in the cause, preserving defects, interrupts and
26632
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
26633
+ *
26329
26634
  * **Example** (Mapping errors eagerly when possible)
26330
26635
  *
26331
26636
  * ```ts import.meta.vitest
@@ -26370,6 +26675,9 @@ export const mapErrorEager: {
26370
26675
  * transform. Failure effects apply the mapping function immediately, and
26371
26676
  * pending effects fall back to regular `mapError` behavior.
26372
26677
  *
26678
+ * Maps every typed error in the cause, preserving defects, interrupts and
26679
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
26680
+ *
26373
26681
  * **Example** (Mapping errors eagerly when possible)
26374
26682
  *
26375
26683
  * ```ts import.meta.vitest
@@ -26415,6 +26723,9 @@ export const mapErrorEager: {
26415
26723
  * `onFailure` immediately. Pending effects fall back to regular `mapBoth`
26416
26724
  * behavior.
26417
26725
  *
26726
+ * Maps every typed error in the cause, preserving defects, interrupts and
26727
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
26728
+ *
26418
26729
  * **Example** (Mapping both channels eagerly when possible)
26419
26730
  *
26420
26731
  * ```ts import.meta.vitest
@@ -26458,6 +26769,9 @@ export const mapBothEager: {
26458
26769
  * `onFailure` immediately. Pending effects fall back to regular `mapBoth`
26459
26770
  * behavior.
26460
26771
  *
26772
+ * Maps every typed error in the cause, preserving defects, interrupts and
26773
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
26774
+ *
26461
26775
  * **Example** (Mapping both channels eagerly when possible)
26462
26776
  *
26463
26777
  * ```ts import.meta.vitest
@@ -26503,6 +26817,9 @@ export const mapBothEager: {
26503
26817
  * `onFailure` immediately. Pending effects fall back to regular `mapBoth`
26504
26818
  * behavior.
26505
26819
  *
26820
+ * Maps every typed error in the cause, preserving defects, interrupts and
26821
+ * reason order. Unlike typed recovery, mapping does not convert errors to defects.
26822
+ *
26506
26823
  * **Example** (Mapping both channels eagerly when possible)
26507
26824
  *
26508
26825
  * ```ts import.meta.vitest
@@ -26667,6 +26984,12 @@ export const flatMapEager: {
26667
26984
  * Failure effects apply the catch function immediately, and pending effects
26668
26985
  * fall back to regular `catch` behavior.
26669
26986
  *
26987
+ * **Gotchas**
26988
+ *
26989
+ * If the cause contains a defect, the handler is skipped and every typed error
26990
+ * is converted to a defect, preserving reason order and interrupts. An
26991
+ * interruption alongside a typed error does not prevent recovery.
26992
+ *
26670
26993
  * **Example** (Catching failures eagerly when possible)
26671
26994
  *
26672
26995
  * ```ts import.meta.vitest
@@ -26721,6 +27044,12 @@ export const catchEager: {
26721
27044
  * Failure effects apply the catch function immediately, and pending effects
26722
27045
  * fall back to regular `catch` behavior.
26723
27046
  *
27047
+ * **Gotchas**
27048
+ *
27049
+ * If the cause contains a defect, the handler is skipped and every typed error
27050
+ * is converted to a defect, preserving reason order and interrupts. An
27051
+ * interruption alongside a typed error does not prevent recovery.
27052
+ *
26724
27053
  * **Example** (Catching failures eagerly when possible)
26725
27054
  *
26726
27055
  * ```ts import.meta.vitest
@@ -26775,6 +27104,12 @@ export const catchEager: {
26775
27104
  * Failure effects apply the catch function immediately, and pending effects
26776
27105
  * fall back to regular `catch` behavior.
26777
27106
  *
27107
+ * **Gotchas**
27108
+ *
27109
+ * If the cause contains a defect, the handler is skipped and every typed error
27110
+ * is converted to a defect, preserving reason order and interrupts. An
27111
+ * interruption alongside a typed error does not prevent recovery.
27112
+ *
26778
27113
  * **Example** (Catching failures eagerly when possible)
26779
27114
  *
26780
27115
  * ```ts import.meta.vitest