effect 4.0.0-beta.102 → 4.0.0-beta.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1451) hide show
  1. package/dist/Array.d.ts +971 -1037
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +381 -407
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +433 -756
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +200 -325
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +207 -267
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +107 -135
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +146 -188
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +64 -84
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.js.map +1 -1
  18. package/dist/Cache.d.ts +405 -254
  19. package/dist/Cache.d.ts.map +1 -1
  20. package/dist/Cache.js +166 -101
  21. package/dist/Cache.js.map +1 -1
  22. package/dist/Cause.d.ts +167 -277
  23. package/dist/Cause.d.ts.map +1 -1
  24. package/dist/Cause.js +122 -176
  25. package/dist/Cause.js.map +1 -1
  26. package/dist/Channel.d.ts +729 -768
  27. package/dist/Channel.d.ts.map +1 -1
  28. package/dist/Channel.js +514 -440
  29. package/dist/Channel.js.map +1 -1
  30. package/dist/ChannelSchema.d.ts +1 -1
  31. package/dist/ChannelSchema.d.ts.map +1 -1
  32. package/dist/ChannelSchema.js.map +1 -1
  33. package/dist/Chunk.d.ts +834 -1173
  34. package/dist/Chunk.d.ts.map +1 -1
  35. package/dist/Chunk.js +326 -439
  36. package/dist/Chunk.js.map +1 -1
  37. package/dist/Clock.d.ts +180 -49
  38. package/dist/Clock.d.ts.map +1 -1
  39. package/dist/Clock.js +96 -31
  40. package/dist/Clock.js.map +1 -1
  41. package/dist/Combiner.d.ts +20 -33
  42. package/dist/Combiner.d.ts.map +1 -1
  43. package/dist/Combiner.js +18 -30
  44. package/dist/Combiner.js.map +1 -1
  45. package/dist/Config.d.ts +225 -173
  46. package/dist/Config.d.ts.map +1 -1
  47. package/dist/Config.js +336 -265
  48. package/dist/Config.js.map +1 -1
  49. package/dist/ConfigProvider.d.ts +194 -68
  50. package/dist/ConfigProvider.d.ts.map +1 -1
  51. package/dist/ConfigProvider.js +115 -80
  52. package/dist/ConfigProvider.js.map +1 -1
  53. package/dist/Console.d.ts +233 -33
  54. package/dist/Console.d.ts.map +1 -1
  55. package/dist/Console.js +232 -32
  56. package/dist/Console.js.map +1 -1
  57. package/dist/Context.d.ts +151 -274
  58. package/dist/Context.d.ts.map +1 -1
  59. package/dist/Context.js +171 -214
  60. package/dist/Context.js.map +1 -1
  61. package/dist/Cron.d.ts +68 -77
  62. package/dist/Cron.d.ts.map +1 -1
  63. package/dist/Cron.js +57 -66
  64. package/dist/Cron.js.map +1 -1
  65. package/dist/Crypto.d.ts +13 -15
  66. package/dist/Crypto.d.ts.map +1 -1
  67. package/dist/Crypto.js +9 -10
  68. package/dist/Crypto.js.map +1 -1
  69. package/dist/Data.d.ts +60 -80
  70. package/dist/Data.d.ts.map +1 -1
  71. package/dist/Data.js +16 -23
  72. package/dist/Data.js.map +1 -1
  73. package/dist/DateTime.d.ts +562 -660
  74. package/dist/DateTime.d.ts.map +1 -1
  75. package/dist/DateTime.js +307 -362
  76. package/dist/DateTime.js.map +1 -1
  77. package/dist/Deferred.d.ts +253 -256
  78. package/dist/Deferred.d.ts.map +1 -1
  79. package/dist/Deferred.js +104 -96
  80. package/dist/Deferred.js.map +1 -1
  81. package/dist/Duration.d.ts +216 -308
  82. package/dist/Duration.d.ts.map +1 -1
  83. package/dist/Duration.js +132 -186
  84. package/dist/Duration.js.map +1 -1
  85. package/dist/Effect.d.ts +2841 -3247
  86. package/dist/Effect.d.ts.map +1 -1
  87. package/dist/Effect.js +1322 -1546
  88. package/dist/Effect.js.map +1 -1
  89. package/dist/Effectable.js.map +1 -1
  90. package/dist/Encoding.d.ts +22 -40
  91. package/dist/Encoding.d.ts.map +1 -1
  92. package/dist/Encoding.js +22 -40
  93. package/dist/Encoding.js.map +1 -1
  94. package/dist/Equal.d.ts +33 -37
  95. package/dist/Equal.d.ts.map +1 -1
  96. package/dist/Equal.js +29 -21
  97. package/dist/Equal.js.map +1 -1
  98. package/dist/Equivalence.d.ts +103 -105
  99. package/dist/Equivalence.d.ts.map +1 -1
  100. package/dist/Equivalence.js +77 -79
  101. package/dist/Equivalence.js.map +1 -1
  102. package/dist/ErrorReporter.d.ts +51 -27
  103. package/dist/ErrorReporter.d.ts.map +1 -1
  104. package/dist/ErrorReporter.js +50 -26
  105. package/dist/ErrorReporter.js.map +1 -1
  106. package/dist/ExecutionPlan.d.ts +13 -55
  107. package/dist/ExecutionPlan.d.ts.map +1 -1
  108. package/dist/ExecutionPlan.js +7 -28
  109. package/dist/ExecutionPlan.js.map +1 -1
  110. package/dist/Exit.d.ts +116 -192
  111. package/dist/Exit.d.ts.map +1 -1
  112. package/dist/Exit.js +82 -130
  113. package/dist/Exit.js.map +1 -1
  114. package/dist/Fiber.d.ts +82 -146
  115. package/dist/Fiber.d.ts.map +1 -1
  116. package/dist/Fiber.js +48 -87
  117. package/dist/Fiber.js.map +1 -1
  118. package/dist/FiberHandle.d.ts +152 -105
  119. package/dist/FiberHandle.d.ts.map +1 -1
  120. package/dist/FiberHandle.js +106 -73
  121. package/dist/FiberHandle.js.map +1 -1
  122. package/dist/FiberMap.d.ts +213 -168
  123. package/dist/FiberMap.d.ts.map +1 -1
  124. package/dist/FiberMap.js +114 -89
  125. package/dist/FiberMap.js.map +1 -1
  126. package/dist/FiberSet.d.ts +123 -81
  127. package/dist/FiberSet.d.ts.map +1 -1
  128. package/dist/FiberSet.js +85 -59
  129. package/dist/FiberSet.js.map +1 -1
  130. package/dist/FileSystem.d.ts +153 -264
  131. package/dist/FileSystem.d.ts.map +1 -1
  132. package/dist/FileSystem.js +42 -147
  133. package/dist/FileSystem.js.map +1 -1
  134. package/dist/Filter.d.ts +61 -33
  135. package/dist/Filter.d.ts.map +1 -1
  136. package/dist/Filter.js +26 -15
  137. package/dist/Filter.js.map +1 -1
  138. package/dist/Formatter.d.ts +25 -33
  139. package/dist/Formatter.d.ts.map +1 -1
  140. package/dist/Formatter.js +48 -49
  141. package/dist/Formatter.js.map +1 -1
  142. package/dist/Function.d.ts +76 -145
  143. package/dist/Function.d.ts.map +1 -1
  144. package/dist/Function.js +40 -57
  145. package/dist/Function.js.map +1 -1
  146. package/dist/Graph.d.ts +360 -714
  147. package/dist/Graph.d.ts.map +1 -1
  148. package/dist/Graph.js +168 -297
  149. package/dist/Graph.js.map +1 -1
  150. package/dist/HKT.d.ts +12 -6
  151. package/dist/HKT.d.ts.map +1 -1
  152. package/dist/Hash.d.ts +47 -83
  153. package/dist/Hash.d.ts.map +1 -1
  154. package/dist/Hash.js +46 -68
  155. package/dist/Hash.js.map +1 -1
  156. package/dist/HashMap.d.ts +319 -411
  157. package/dist/HashMap.d.ts.map +1 -1
  158. package/dist/HashMap.js +122 -166
  159. package/dist/HashMap.js.map +1 -1
  160. package/dist/HashRing.d.ts.map +1 -1
  161. package/dist/HashRing.js +1 -0
  162. package/dist/HashRing.js.map +1 -1
  163. package/dist/HashSet.d.ts +177 -284
  164. package/dist/HashSet.d.ts.map +1 -1
  165. package/dist/HashSet.js +68 -109
  166. package/dist/HashSet.js.map +1 -1
  167. package/dist/Inspectable.d.ts +12 -12
  168. package/dist/Inspectable.js +8 -8
  169. package/dist/Inspectable.js.map +1 -1
  170. package/dist/Iterable.d.ts +620 -786
  171. package/dist/Iterable.d.ts.map +1 -1
  172. package/dist/Iterable.js +228 -306
  173. package/dist/Iterable.js.map +1 -1
  174. package/dist/JsonPatch.d.ts +11 -13
  175. package/dist/JsonPatch.d.ts.map +1 -1
  176. package/dist/JsonPatch.js +44 -102
  177. package/dist/JsonPatch.js.map +1 -1
  178. package/dist/JsonPointer.d.ts +8 -8
  179. package/dist/JsonPointer.js +8 -8
  180. package/dist/JsonPointer.js.map +1 -1
  181. package/dist/JsonSchema.d.ts +98 -44
  182. package/dist/JsonSchema.d.ts.map +1 -1
  183. package/dist/JsonSchema.js +297 -234
  184. package/dist/JsonSchema.js.map +1 -1
  185. package/dist/Latch.d.ts +23 -35
  186. package/dist/Latch.d.ts.map +1 -1
  187. package/dist/Latch.js +16 -28
  188. package/dist/Latch.js.map +1 -1
  189. package/dist/Layer.d.ts +359 -260
  190. package/dist/Layer.d.ts.map +1 -1
  191. package/dist/Layer.js +195 -175
  192. package/dist/Layer.js.map +1 -1
  193. package/dist/LayerMap.d.ts +42 -29
  194. package/dist/LayerMap.d.ts.map +1 -1
  195. package/dist/LayerMap.js +31 -21
  196. package/dist/LayerMap.js.map +1 -1
  197. package/dist/LayerRef.d.ts +6 -2
  198. package/dist/LayerRef.d.ts.map +1 -1
  199. package/dist/LayerRef.js +6 -2
  200. package/dist/LayerRef.js.map +1 -1
  201. package/dist/LogLevel.d.ts +114 -214
  202. package/dist/LogLevel.d.ts.map +1 -1
  203. package/dist/LogLevel.js +41 -76
  204. package/dist/LogLevel.js.map +1 -1
  205. package/dist/Logger.d.ts +218 -467
  206. package/dist/Logger.d.ts.map +1 -1
  207. package/dist/Logger.js +204 -450
  208. package/dist/Logger.js.map +1 -1
  209. package/dist/ManagedRuntime.d.ts +7 -5
  210. package/dist/ManagedRuntime.d.ts.map +1 -1
  211. package/dist/ManagedRuntime.js +7 -5
  212. package/dist/ManagedRuntime.js.map +1 -1
  213. package/dist/Match.d.ts +217 -252
  214. package/dist/Match.d.ts.map +1 -1
  215. package/dist/Match.js +150 -183
  216. package/dist/Match.js.map +1 -1
  217. package/dist/Metric.d.ts +442 -993
  218. package/dist/Metric.d.ts.map +1 -1
  219. package/dist/Metric.js +198 -642
  220. package/dist/Metric.js.map +1 -1
  221. package/dist/MutableHashMap.d.ts +144 -173
  222. package/dist/MutableHashMap.d.ts.map +1 -1
  223. package/dist/MutableHashMap.js +68 -79
  224. package/dist/MutableHashMap.js.map +1 -1
  225. package/dist/MutableHashSet.d.ts +84 -89
  226. package/dist/MutableHashSet.d.ts.map +1 -1
  227. package/dist/MutableHashSet.js +44 -47
  228. package/dist/MutableHashSet.js.map +1 -1
  229. package/dist/MutableList.d.ts +71 -370
  230. package/dist/MutableList.d.ts.map +1 -1
  231. package/dist/MutableList.js +59 -284
  232. package/dist/MutableList.js.map +1 -1
  233. package/dist/MutableRef.d.ts +420 -243
  234. package/dist/MutableRef.d.ts.map +1 -1
  235. package/dist/MutableRef.js +209 -120
  236. package/dist/MutableRef.js.map +1 -1
  237. package/dist/Newtype.d.ts +21 -14
  238. package/dist/Newtype.d.ts.map +1 -1
  239. package/dist/Newtype.js +15 -13
  240. package/dist/Newtype.js.map +1 -1
  241. package/dist/NonEmptyIterable.d.ts +7 -137
  242. package/dist/NonEmptyIterable.d.ts.map +1 -1
  243. package/dist/NonEmptyIterable.js +5 -93
  244. package/dist/NonEmptyIterable.js.map +1 -1
  245. package/dist/Number.d.ts +196 -233
  246. package/dist/Number.d.ts.map +1 -1
  247. package/dist/Number.js +90 -109
  248. package/dist/Number.js.map +1 -1
  249. package/dist/Optic.d.ts +97 -189
  250. package/dist/Optic.d.ts.map +1 -1
  251. package/dist/Optic.js +187 -290
  252. package/dist/Optic.js.map +1 -1
  253. package/dist/Option.d.ts +447 -812
  254. package/dist/Option.d.ts.map +1 -1
  255. package/dist/Option.js +211 -392
  256. package/dist/Option.js.map +1 -1
  257. package/dist/Order.d.ts +109 -109
  258. package/dist/Order.js +91 -91
  259. package/dist/Order.js.map +1 -1
  260. package/dist/Ordering.d.ts +20 -23
  261. package/dist/Ordering.d.ts.map +1 -1
  262. package/dist/Ordering.js +8 -9
  263. package/dist/Ordering.js.map +1 -1
  264. package/dist/PartitionedSemaphore.js.map +1 -1
  265. package/dist/Path.d.ts +38 -41
  266. package/dist/Path.d.ts.map +1 -1
  267. package/dist/Path.js +3 -4
  268. package/dist/Path.js.map +1 -1
  269. package/dist/Pipeable.d.ts +6 -5
  270. package/dist/Pipeable.d.ts.map +1 -1
  271. package/dist/Pipeable.js +2 -2
  272. package/dist/Pipeable.js.map +1 -1
  273. package/dist/PlatformError.d.ts +4 -4
  274. package/dist/PlatformError.js +3 -3
  275. package/dist/PlatformError.js.map +1 -1
  276. package/dist/Pool.d.ts +4 -2
  277. package/dist/Pool.d.ts.map +1 -1
  278. package/dist/Pool.js +4 -2
  279. package/dist/Pool.js.map +1 -1
  280. package/dist/Predicate.d.ts +200 -181
  281. package/dist/Predicate.d.ts.map +1 -1
  282. package/dist/Predicate.js +100 -108
  283. package/dist/Predicate.js.map +1 -1
  284. package/dist/PrimaryKey.d.ts +7 -7
  285. package/dist/PrimaryKey.js +5 -5
  286. package/dist/PrimaryKey.js.map +1 -1
  287. package/dist/PubSub.d.ts +425 -494
  288. package/dist/PubSub.d.ts.map +1 -1
  289. package/dist/PubSub.js +373 -362
  290. package/dist/PubSub.js.map +1 -1
  291. package/dist/Pull.d.ts +24 -18
  292. package/dist/Pull.d.ts.map +1 -1
  293. package/dist/Pull.js +11 -9
  294. package/dist/Pull.js.map +1 -1
  295. package/dist/Queue.d.ts +200 -159
  296. package/dist/Queue.d.ts.map +1 -1
  297. package/dist/Queue.js +162 -132
  298. package/dist/Queue.js.map +1 -1
  299. package/dist/Random.d.ts +49 -74
  300. package/dist/Random.d.ts.map +1 -1
  301. package/dist/Random.js +35 -54
  302. package/dist/Random.js.map +1 -1
  303. package/dist/RcMap.d.ts +121 -63
  304. package/dist/RcMap.d.ts.map +1 -1
  305. package/dist/RcMap.js +42 -21
  306. package/dist/RcMap.js.map +1 -1
  307. package/dist/RcRef.d.ts +24 -13
  308. package/dist/RcRef.d.ts.map +1 -1
  309. package/dist/RcRef.js +15 -9
  310. package/dist/RcRef.js.map +1 -1
  311. package/dist/Record.d.ts +291 -488
  312. package/dist/Record.d.ts.map +1 -1
  313. package/dist/Record.js +111 -202
  314. package/dist/Record.js.map +1 -1
  315. package/dist/Redactable.d.ts +6 -2
  316. package/dist/Redactable.d.ts.map +1 -1
  317. package/dist/Redactable.js +7 -2
  318. package/dist/Redactable.js.map +1 -1
  319. package/dist/Redacted.d.ts +25 -25
  320. package/dist/Redacted.d.ts.map +1 -1
  321. package/dist/Redacted.js +19 -20
  322. package/dist/Redacted.js.map +1 -1
  323. package/dist/Reducer.d.ts +8 -15
  324. package/dist/Reducer.d.ts.map +1 -1
  325. package/dist/Reducer.js +6 -12
  326. package/dist/Reducer.js.map +1 -1
  327. package/dist/Ref.d.ts +95 -165
  328. package/dist/Ref.d.ts.map +1 -1
  329. package/dist/Ref.js +75 -122
  330. package/dist/Ref.js.map +1 -1
  331. package/dist/References.d.ts +102 -168
  332. package/dist/References.d.ts.map +1 -1
  333. package/dist/References.js +102 -168
  334. package/dist/References.js.map +1 -1
  335. package/dist/RegExp.d.ts +10 -14
  336. package/dist/RegExp.d.ts.map +1 -1
  337. package/dist/RegExp.js +10 -14
  338. package/dist/RegExp.js.map +1 -1
  339. package/dist/Request.d.ts +31 -21
  340. package/dist/Request.d.ts.map +1 -1
  341. package/dist/Request.js +16 -13
  342. package/dist/Request.js.map +1 -1
  343. package/dist/RequestResolver.d.ts +201 -90
  344. package/dist/RequestResolver.d.ts.map +1 -1
  345. package/dist/RequestResolver.js +87 -41
  346. package/dist/RequestResolver.js.map +1 -1
  347. package/dist/Resource.js.map +1 -1
  348. package/dist/Result.d.ts +302 -470
  349. package/dist/Result.d.ts.map +1 -1
  350. package/dist/Result.js +133 -217
  351. package/dist/Result.js.map +1 -1
  352. package/dist/Runtime.d.ts +50 -75
  353. package/dist/Runtime.d.ts.map +1 -1
  354. package/dist/Runtime.js +39 -60
  355. package/dist/Runtime.js.map +1 -1
  356. package/dist/Schedule.d.ts +290 -1636
  357. package/dist/Schedule.d.ts.map +1 -1
  358. package/dist/Schedule.js +162 -803
  359. package/dist/Schedule.js.map +1 -1
  360. package/dist/Scheduler.d.ts +5 -5
  361. package/dist/Scheduler.d.ts.map +1 -1
  362. package/dist/Scheduler.js +18 -6
  363. package/dist/Scheduler.js.map +1 -1
  364. package/dist/Schema.d.ts +644 -642
  365. package/dist/Schema.d.ts.map +1 -1
  366. package/dist/Schema.js +491 -527
  367. package/dist/Schema.js.map +1 -1
  368. package/dist/SchemaAST.d.ts +27 -50
  369. package/dist/SchemaAST.d.ts.map +1 -1
  370. package/dist/SchemaAST.js +366 -279
  371. package/dist/SchemaAST.js.map +1 -1
  372. package/dist/SchemaError.d.ts +7 -6
  373. package/dist/SchemaError.d.ts.map +1 -1
  374. package/dist/SchemaError.js +7 -6
  375. package/dist/SchemaError.js.map +1 -1
  376. package/dist/SchemaGetter.d.ts +217 -174
  377. package/dist/SchemaGetter.d.ts.map +1 -1
  378. package/dist/SchemaGetter.js +218 -185
  379. package/dist/SchemaGetter.js.map +1 -1
  380. package/dist/SchemaIssue.d.ts +62 -190
  381. package/dist/SchemaIssue.d.ts.map +1 -1
  382. package/dist/SchemaIssue.js +73 -265
  383. package/dist/SchemaIssue.js.map +1 -1
  384. package/dist/SchemaParser.d.ts +2 -2
  385. package/dist/SchemaParser.d.ts.map +1 -1
  386. package/dist/SchemaParser.js +123 -75
  387. package/dist/SchemaParser.js.map +1 -1
  388. package/dist/SchemaRepresentation.d.ts +22 -36
  389. package/dist/SchemaRepresentation.d.ts.map +1 -1
  390. package/dist/SchemaRepresentation.js +20 -26
  391. package/dist/SchemaRepresentation.js.map +1 -1
  392. package/dist/SchemaTransformation.d.ts +114 -74
  393. package/dist/SchemaTransformation.d.ts.map +1 -1
  394. package/dist/SchemaTransformation.js +120 -85
  395. package/dist/SchemaTransformation.js.map +1 -1
  396. package/dist/Scope.d.ts +123 -151
  397. package/dist/Scope.d.ts.map +1 -1
  398. package/dist/Scope.js +72 -92
  399. package/dist/Scope.js.map +1 -1
  400. package/dist/ScopedCache.js.map +1 -1
  401. package/dist/ScopedRef.d.ts +3 -3
  402. package/dist/ScopedRef.js +2 -2
  403. package/dist/ScopedRef.js.map +1 -1
  404. package/dist/Semaphore.d.ts +96 -10
  405. package/dist/Semaphore.d.ts.map +1 -1
  406. package/dist/Semaphore.js +78 -39
  407. package/dist/Semaphore.js.map +1 -1
  408. package/dist/Sink.d.ts +117 -107
  409. package/dist/Sink.d.ts.map +1 -1
  410. package/dist/Sink.js +107 -100
  411. package/dist/Sink.js.map +1 -1
  412. package/dist/Stdio.d.ts +1 -1
  413. package/dist/Stdio.js.map +1 -1
  414. package/dist/Stream.d.ts +2415 -2949
  415. package/dist/Stream.d.ts.map +1 -1
  416. package/dist/Stream.js +1078 -1381
  417. package/dist/Stream.js.map +1 -1
  418. package/dist/String.d.ts +262 -308
  419. package/dist/String.d.ts.map +1 -1
  420. package/dist/String.js +184 -215
  421. package/dist/String.js.map +1 -1
  422. package/dist/Struct.d.ts +109 -114
  423. package/dist/Struct.d.ts.map +1 -1
  424. package/dist/Struct.js +41 -50
  425. package/dist/Struct.js.map +1 -1
  426. package/dist/SubscriptionRef.d.ts +282 -250
  427. package/dist/SubscriptionRef.d.ts.map +1 -1
  428. package/dist/SubscriptionRef.js +104 -92
  429. package/dist/SubscriptionRef.js.map +1 -1
  430. package/dist/Symbol.d.ts +3 -3
  431. package/dist/Symbol.js +3 -3
  432. package/dist/Symbol.js.map +1 -1
  433. package/dist/SynchronizedRef.js.map +1 -1
  434. package/dist/Take.js.map +1 -1
  435. package/dist/Terminal.d.ts +2 -2
  436. package/dist/Terminal.js +1 -1
  437. package/dist/Terminal.js.map +1 -1
  438. package/dist/Tracer.d.ts +100 -54
  439. package/dist/Tracer.d.ts.map +1 -1
  440. package/dist/Tracer.js +41 -24
  441. package/dist/Tracer.js.map +1 -1
  442. package/dist/Trie.d.ts +287 -679
  443. package/dist/Trie.d.ts.map +1 -1
  444. package/dist/Trie.js +109 -251
  445. package/dist/Trie.js.map +1 -1
  446. package/dist/Tuple.d.ts +92 -127
  447. package/dist/Tuple.d.ts.map +1 -1
  448. package/dist/Tuple.js +42 -57
  449. package/dist/Tuple.js.map +1 -1
  450. package/dist/TxChunk.d.ts +201 -121
  451. package/dist/TxChunk.d.ts.map +1 -1
  452. package/dist/TxChunk.js +85 -56
  453. package/dist/TxChunk.js.map +1 -1
  454. package/dist/TxDeferred.d.ts +62 -46
  455. package/dist/TxDeferred.d.ts.map +1 -1
  456. package/dist/TxDeferred.js +30 -22
  457. package/dist/TxDeferred.js.map +1 -1
  458. package/dist/TxHashMap.d.ts +631 -779
  459. package/dist/TxHashMap.d.ts.map +1 -1
  460. package/dist/TxHashMap.js +268 -330
  461. package/dist/TxHashMap.js.map +1 -1
  462. package/dist/TxHashSet.d.ts +297 -236
  463. package/dist/TxHashSet.d.ts.map +1 -1
  464. package/dist/TxHashSet.js +130 -100
  465. package/dist/TxHashSet.js.map +1 -1
  466. package/dist/TxPriorityQueue.d.ts +126 -95
  467. package/dist/TxPriorityQueue.d.ts.map +1 -1
  468. package/dist/TxPriorityQueue.js +74 -56
  469. package/dist/TxPriorityQueue.js.map +1 -1
  470. package/dist/TxPubSub.d.ts +101 -88
  471. package/dist/TxPubSub.d.ts.map +1 -1
  472. package/dist/TxPubSub.js +87 -66
  473. package/dist/TxPubSub.js.map +1 -1
  474. package/dist/TxQueue.d.ts +200 -180
  475. package/dist/TxQueue.d.ts.map +1 -1
  476. package/dist/TxQueue.js +160 -136
  477. package/dist/TxQueue.js.map +1 -1
  478. package/dist/TxReentrantLock.d.ts +97 -66
  479. package/dist/TxReentrantLock.d.ts.map +1 -1
  480. package/dist/TxReentrantLock.js +67 -45
  481. package/dist/TxReentrantLock.js.map +1 -1
  482. package/dist/TxRef.d.ts +51 -32
  483. package/dist/TxRef.d.ts.map +1 -1
  484. package/dist/TxRef.js +23 -15
  485. package/dist/TxRef.js.map +1 -1
  486. package/dist/TxSemaphore.d.ts +129 -95
  487. package/dist/TxSemaphore.d.ts.map +1 -1
  488. package/dist/TxSemaphore.js +85 -70
  489. package/dist/TxSemaphore.js.map +1 -1
  490. package/dist/TxSubscriptionRef.d.ts +97 -70
  491. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  492. package/dist/TxSubscriptionRef.js +44 -34
  493. package/dist/TxSubscriptionRef.js.map +1 -1
  494. package/dist/Types.d.ts +126 -67
  495. package/dist/Types.d.ts.map +1 -1
  496. package/dist/UndefinedOr.js.map +1 -1
  497. package/dist/Unify.d.ts +45 -65
  498. package/dist/Unify.d.ts.map +1 -1
  499. package/dist/Unify.js +6 -9
  500. package/dist/Unify.js.map +1 -1
  501. package/dist/Utils.d.ts +23 -16
  502. package/dist/Utils.d.ts.map +1 -1
  503. package/dist/Utils.js +3 -7
  504. package/dist/Utils.js.map +1 -1
  505. package/dist/index.js.map +1 -1
  506. package/dist/internal/array.js.map +1 -1
  507. package/dist/internal/core.js +1 -1
  508. package/dist/internal/core.js.map +1 -1
  509. package/dist/internal/dateTime.js +4 -0
  510. package/dist/internal/dateTime.js.map +1 -1
  511. package/dist/internal/doNotation.js.map +1 -1
  512. package/dist/internal/effect.js +77 -40
  513. package/dist/internal/effect.js.map +1 -1
  514. package/dist/internal/equal.js.map +1 -1
  515. package/dist/internal/errors.js.map +1 -1
  516. package/dist/internal/executionPlan.js.map +1 -1
  517. package/dist/internal/hashMap.js.map +1 -1
  518. package/dist/internal/hashSet.js.map +1 -1
  519. package/dist/internal/layer.js.map +1 -1
  520. package/dist/internal/matcher.js.map +1 -1
  521. package/dist/internal/metric.js.map +1 -1
  522. package/dist/internal/option.js.map +1 -1
  523. package/dist/internal/persistence.d.ts +2 -0
  524. package/dist/internal/persistence.d.ts.map +1 -0
  525. package/dist/internal/persistence.js +3 -0
  526. package/dist/internal/persistence.js.map +1 -0
  527. package/dist/internal/random.js.map +1 -1
  528. package/dist/internal/rcRef.js.map +1 -1
  529. package/dist/internal/record.js.map +1 -1
  530. package/dist/internal/redacted.js.map +1 -1
  531. package/dist/internal/references.js +3 -0
  532. package/dist/internal/references.js.map +1 -1
  533. package/dist/internal/request.js.map +1 -1
  534. package/dist/internal/result.js.map +1 -1
  535. package/dist/internal/schedule.js.map +1 -1
  536. package/dist/internal/schema/annotations.js.map +1 -1
  537. package/dist/internal/schema/cause.js.map +1 -1
  538. package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
  539. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
  540. package/dist/internal/schema/fromRepresentation.js +8 -15
  541. package/dist/internal/schema/fromRepresentation.js.map +1 -1
  542. package/dist/internal/schema/parser.d.ts +14 -0
  543. package/dist/internal/schema/parser.d.ts.map +1 -0
  544. package/dist/internal/schema/parser.js +13 -0
  545. package/dist/internal/schema/parser.js.map +1 -0
  546. package/dist/internal/schema/schema.js.map +1 -1
  547. package/dist/internal/schema/toArbitrary.js.map +1 -1
  548. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  549. package/dist/internal/schema/toEquivalence.js.map +1 -1
  550. package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
  551. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  552. package/dist/internal/schema/toRepresentation.js +87 -107
  553. package/dist/internal/schema/toRepresentation.js.map +1 -1
  554. package/dist/internal/stackTraceLimit.js.map +1 -1
  555. package/dist/internal/stream.js.map +1 -1
  556. package/dist/internal/tracer.js.map +1 -1
  557. package/dist/internal/trie.js +13 -9
  558. package/dist/internal/trie.js.map +1 -1
  559. package/dist/testing/FastCheck.d.ts +8 -7
  560. package/dist/testing/FastCheck.d.ts.map +1 -1
  561. package/dist/testing/FastCheck.js +8 -7
  562. package/dist/testing/FastCheck.js.map +1 -1
  563. package/dist/testing/TestClock.d.ts +57 -28
  564. package/dist/testing/TestClock.d.ts.map +1 -1
  565. package/dist/testing/TestClock.js +50 -18
  566. package/dist/testing/TestClock.js.map +1 -1
  567. package/dist/testing/TestConsole.d.ts +32 -31
  568. package/dist/testing/TestConsole.d.ts.map +1 -1
  569. package/dist/testing/TestConsole.js +24 -22
  570. package/dist/testing/TestConsole.js.map +1 -1
  571. package/dist/testing/TestSchema.d.ts +29 -29
  572. package/dist/testing/TestSchema.js +25 -25
  573. package/dist/testing/TestSchema.js.map +1 -1
  574. package/dist/testing/index.js.map +1 -1
  575. package/dist/unstable/ai/AiError.d.ts +95 -118
  576. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  577. package/dist/unstable/ai/AiError.js +94 -117
  578. package/dist/unstable/ai/AiError.js.map +1 -1
  579. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  580. package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
  581. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  582. package/dist/unstable/ai/Chat.d.ts +132 -97
  583. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  584. package/dist/unstable/ai/Chat.js +55 -51
  585. package/dist/unstable/ai/Chat.js.map +1 -1
  586. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  587. package/dist/unstable/ai/IdGenerator.d.ts +32 -28
  588. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  589. package/dist/unstable/ai/IdGenerator.js +26 -21
  590. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  591. package/dist/unstable/ai/LanguageModel.d.ts +107 -67
  592. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  593. package/dist/unstable/ai/LanguageModel.js +104 -64
  594. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  595. package/dist/unstable/ai/McpProtocol.d.ts +30 -0
  596. package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
  597. package/dist/unstable/ai/McpProtocol.js +20 -0
  598. package/dist/unstable/ai/McpProtocol.js.map +1 -0
  599. package/dist/unstable/ai/McpSchema.d.ts +141 -75
  600. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  601. package/dist/unstable/ai/McpSchema.js +58 -50
  602. package/dist/unstable/ai/McpSchema.js.map +1 -1
  603. package/dist/unstable/ai/McpServer.d.ts +68 -59
  604. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  605. package/dist/unstable/ai/McpServer.js +694 -241
  606. package/dist/unstable/ai/McpServer.js.map +1 -1
  607. package/dist/unstable/ai/Model.d.ts +8 -19
  608. package/dist/unstable/ai/Model.d.ts.map +1 -1
  609. package/dist/unstable/ai/Model.js +9 -20
  610. package/dist/unstable/ai/Model.js.map +1 -1
  611. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  612. package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
  613. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  614. package/dist/unstable/ai/Prompt.d.ts +112 -38
  615. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  616. package/dist/unstable/ai/Prompt.js +53 -17
  617. package/dist/unstable/ai/Prompt.js.map +1 -1
  618. package/dist/unstable/ai/Response.d.ts +28 -14
  619. package/dist/unstable/ai/Response.d.ts.map +1 -1
  620. package/dist/unstable/ai/Response.js +9 -4
  621. package/dist/unstable/ai/Response.js.map +1 -1
  622. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  623. package/dist/unstable/ai/Telemetry.d.ts +46 -13
  624. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  625. package/dist/unstable/ai/Telemetry.js +18 -7
  626. package/dist/unstable/ai/Telemetry.js.map +1 -1
  627. package/dist/unstable/ai/Tokenizer.d.ts +14 -3
  628. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  629. package/dist/unstable/ai/Tokenizer.js +10 -2
  630. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  631. package/dist/unstable/ai/Tool.d.ts +59 -44
  632. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  633. package/dist/unstable/ai/Tool.js +48 -39
  634. package/dist/unstable/ai/Tool.js.map +1 -1
  635. package/dist/unstable/ai/Toolkit.d.ts +26 -8
  636. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  637. package/dist/unstable/ai/Toolkit.js +18 -4
  638. package/dist/unstable/ai/Toolkit.js.map +1 -1
  639. package/dist/unstable/ai/index.d.ts +4 -0
  640. package/dist/unstable/ai/index.d.ts.map +1 -1
  641. package/dist/unstable/ai/index.js +4 -0
  642. package/dist/unstable/ai/index.js.map +1 -1
  643. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  644. package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
  645. package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
  646. package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
  647. package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
  648. package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
  649. package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
  650. package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
  651. package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
  652. package/dist/unstable/ai/internal/structured-output.js +14 -15
  653. package/dist/unstable/ai/internal/structured-output.js.map +1 -1
  654. package/dist/unstable/cli/Argument.d.ts +273 -69
  655. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  656. package/dist/unstable/cli/Argument.js +111 -33
  657. package/dist/unstable/cli/Argument.js.map +1 -1
  658. package/dist/unstable/cli/CliConfig.js.map +1 -1
  659. package/dist/unstable/cli/CliError.d.ts +69 -76
  660. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  661. package/dist/unstable/cli/CliError.js +57 -61
  662. package/dist/unstable/cli/CliError.js.map +1 -1
  663. package/dist/unstable/cli/CliOutput.d.ts +35 -54
  664. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  665. package/dist/unstable/cli/CliOutput.js +26 -42
  666. package/dist/unstable/cli/CliOutput.js.map +1 -1
  667. package/dist/unstable/cli/Command.d.ts +705 -107
  668. package/dist/unstable/cli/Command.d.ts.map +1 -1
  669. package/dist/unstable/cli/Command.js +238 -42
  670. package/dist/unstable/cli/Command.js.map +1 -1
  671. package/dist/unstable/cli/Completions.js.map +1 -1
  672. package/dist/unstable/cli/Flag.d.ts +418 -138
  673. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  674. package/dist/unstable/cli/Flag.js +197 -71
  675. package/dist/unstable/cli/Flag.js.map +1 -1
  676. package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
  677. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  678. package/dist/unstable/cli/HelpDoc.d.ts +12 -4
  679. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  680. package/dist/unstable/cli/Param.d.ts +292 -78
  681. package/dist/unstable/cli/Param.d.ts.map +1 -1
  682. package/dist/unstable/cli/Param.js +128 -46
  683. package/dist/unstable/cli/Param.js.map +1 -1
  684. package/dist/unstable/cli/Primitive.d.ts +370 -149
  685. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  686. package/dist/unstable/cli/Primitive.js +344 -136
  687. package/dist/unstable/cli/Primitive.js.map +1 -1
  688. package/dist/unstable/cli/Prompt.d.ts +23 -14
  689. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  690. package/dist/unstable/cli/Prompt.js +23 -14
  691. package/dist/unstable/cli/Prompt.js.map +1 -1
  692. package/dist/unstable/cli/index.js.map +1 -1
  693. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  694. package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
  695. package/dist/unstable/cli/internal/command.js.map +1 -1
  696. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  697. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  698. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  699. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  700. package/dist/unstable/cli/internal/config.js.map +1 -1
  701. package/dist/unstable/cli/internal/help.js.map +1 -1
  702. package/dist/unstable/cli/internal/lexer.js +17 -7
  703. package/dist/unstable/cli/internal/lexer.js.map +1 -1
  704. package/dist/unstable/cli/internal/parser.js +2 -2
  705. package/dist/unstable/cli/internal/parser.js.map +1 -1
  706. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  707. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  708. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  709. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  710. package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
  711. package/dist/unstable/cluster/ClusterSchema.js +8 -8
  712. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  713. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  714. package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
  715. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  716. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  717. package/dist/unstable/cluster/Entity.d.ts +10 -10
  718. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  719. package/dist/unstable/cluster/Entity.js +8 -8
  720. package/dist/unstable/cluster/Entity.js.map +1 -1
  721. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  722. package/dist/unstable/cluster/EntityId.js.map +1 -1
  723. package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
  724. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  725. package/dist/unstable/cluster/EntityProxy.js +4 -2
  726. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  727. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  728. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  729. package/dist/unstable/cluster/EntityResource.js +2 -2
  730. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  731. package/dist/unstable/cluster/EntityType.js.map +1 -1
  732. package/dist/unstable/cluster/Envelope.d.ts +3 -3
  733. package/dist/unstable/cluster/Envelope.js +3 -3
  734. package/dist/unstable/cluster/Envelope.js.map +1 -1
  735. package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
  736. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  737. package/dist/unstable/cluster/HttpRunner.js +6 -4
  738. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  739. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  740. package/dist/unstable/cluster/MachineId.js.map +1 -1
  741. package/dist/unstable/cluster/Message.d.ts +9 -9
  742. package/dist/unstable/cluster/Message.js +6 -6
  743. package/dist/unstable/cluster/Message.js.map +1 -1
  744. package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
  745. package/dist/unstable/cluster/MessageStorage.js +5 -5
  746. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  747. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  748. package/dist/unstable/cluster/Reply.js +4 -4
  749. package/dist/unstable/cluster/Reply.js.map +1 -1
  750. package/dist/unstable/cluster/Runner.js.map +1 -1
  751. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  752. package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
  753. package/dist/unstable/cluster/RunnerHealth.js +1 -1
  754. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  755. package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
  756. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  757. package/dist/unstable/cluster/RunnerServer.js +16 -16
  758. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  759. package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
  760. package/dist/unstable/cluster/RunnerStorage.js +1 -1
  761. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  762. package/dist/unstable/cluster/Runners.d.ts +6 -6
  763. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  764. package/dist/unstable/cluster/Runners.js +19 -10
  765. package/dist/unstable/cluster/Runners.js.map +1 -1
  766. package/dist/unstable/cluster/ShardId.js.map +1 -1
  767. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  768. package/dist/unstable/cluster/Sharding.js +3 -2
  769. package/dist/unstable/cluster/Sharding.js.map +1 -1
  770. package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
  771. package/dist/unstable/cluster/ShardingConfig.js +3 -3
  772. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  773. package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
  774. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  775. package/dist/unstable/cluster/Singleton.js.map +1 -1
  776. package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
  777. package/dist/unstable/cluster/SingletonAddress.js +1 -1
  778. package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
  779. package/dist/unstable/cluster/Snowflake.d.ts +8 -8
  780. package/dist/unstable/cluster/Snowflake.js +8 -8
  781. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  782. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  783. package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
  784. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  785. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  786. package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
  787. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  788. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  789. package/dist/unstable/cluster/index.js.map +1 -1
  790. package/dist/unstable/cluster/internal/entityManager.js +5 -5
  791. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  792. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  793. package/dist/unstable/cluster/internal/hash.js.map +1 -1
  794. package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
  795. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  796. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  797. package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
  798. package/dist/unstable/devtools/DevTools.js.map +1 -1
  799. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  800. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  801. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  802. package/dist/unstable/devtools/index.js.map +1 -1
  803. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  804. package/dist/unstable/encoding/Msgpack.js +6 -8
  805. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  806. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  807. package/dist/unstable/encoding/Sse.d.ts +72 -8
  808. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  809. package/dist/unstable/encoding/Sse.js +58 -8
  810. package/dist/unstable/encoding/Sse.js.map +1 -1
  811. package/dist/unstable/encoding/index.js.map +1 -1
  812. package/dist/unstable/eventlog/Event.d.ts +20 -20
  813. package/dist/unstable/eventlog/Event.js.map +1 -1
  814. package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
  815. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  816. package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
  817. package/dist/unstable/eventlog/EventJournal.js +13 -13
  818. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  819. package/dist/unstable/eventlog/EventLog.d.ts +3 -3
  820. package/dist/unstable/eventlog/EventLog.js +3 -3
  821. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  822. package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
  823. package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
  824. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  825. package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
  826. package/dist/unstable/eventlog/EventLogMessage.js +1 -1
  827. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  828. package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
  829. package/dist/unstable/eventlog/EventLogRemote.js +1 -1
  830. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  831. package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
  832. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  833. package/dist/unstable/eventlog/EventLogServer.js +45 -21
  834. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  835. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
  836. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  837. package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
  838. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  839. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
  840. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  841. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
  842. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  843. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
  844. package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
  845. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  846. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  847. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  848. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  849. package/dist/unstable/eventlog/index.js.map +1 -1
  850. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
  851. package/dist/unstable/http/Cookies.d.ts +2 -2
  852. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  853. package/dist/unstable/http/Cookies.js +30 -18
  854. package/dist/unstable/http/Cookies.js.map +1 -1
  855. package/dist/unstable/http/Etag.d.ts +1 -1
  856. package/dist/unstable/http/Etag.js +1 -1
  857. package/dist/unstable/http/Etag.js.map +1 -1
  858. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  859. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  860. package/dist/unstable/http/Headers.d.ts +2 -2
  861. package/dist/unstable/http/Headers.js +2 -2
  862. package/dist/unstable/http/Headers.js.map +1 -1
  863. package/dist/unstable/http/HttpBody.d.ts +5 -3
  864. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  865. package/dist/unstable/http/HttpBody.js +11 -5
  866. package/dist/unstable/http/HttpBody.js.map +1 -1
  867. package/dist/unstable/http/HttpClient.d.ts +51 -44
  868. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  869. package/dist/unstable/http/HttpClient.js +46 -17
  870. package/dist/unstable/http/HttpClient.js.map +1 -1
  871. package/dist/unstable/http/HttpClientError.js.map +1 -1
  872. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  873. package/dist/unstable/http/HttpClientRequest.js +2 -0
  874. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  875. package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
  876. package/dist/unstable/http/HttpClientResponse.js +2 -2
  877. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  878. package/dist/unstable/http/HttpEffect.d.ts +6 -6
  879. package/dist/unstable/http/HttpEffect.js +3 -3
  880. package/dist/unstable/http/HttpEffect.js.map +1 -1
  881. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  882. package/dist/unstable/http/HttpMethod.d.ts +6 -9
  883. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  884. package/dist/unstable/http/HttpMethod.js +6 -9
  885. package/dist/unstable/http/HttpMethod.js.map +1 -1
  886. package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
  887. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  888. package/dist/unstable/http/HttpMiddleware.js +164 -39
  889. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  890. package/dist/unstable/http/HttpPlatform.d.ts +76 -0
  891. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  892. package/dist/unstable/http/HttpPlatform.js +32 -0
  893. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  894. package/dist/unstable/http/HttpRouter.d.ts +88 -89
  895. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  896. package/dist/unstable/http/HttpRouter.js +78 -79
  897. package/dist/unstable/http/HttpRouter.js.map +1 -1
  898. package/dist/unstable/http/HttpServer.d.ts +13 -13
  899. package/dist/unstable/http/HttpServer.js +6 -6
  900. package/dist/unstable/http/HttpServer.js.map +1 -1
  901. package/dist/unstable/http/HttpServerError.d.ts +2 -2
  902. package/dist/unstable/http/HttpServerError.js +2 -2
  903. package/dist/unstable/http/HttpServerError.js.map +1 -1
  904. package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
  905. package/dist/unstable/http/HttpServerRequest.js +4 -4
  906. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  907. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  908. package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
  909. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  910. package/dist/unstable/http/HttpServerResponse.js +10 -0
  911. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  912. package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
  913. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  914. package/dist/unstable/http/HttpStaticServer.js +35 -7
  915. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  916. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  917. package/dist/unstable/http/Multipart.d.ts +6 -6
  918. package/dist/unstable/http/Multipart.js +5 -5
  919. package/dist/unstable/http/Multipart.js.map +1 -1
  920. package/dist/unstable/http/Template.js.map +1 -1
  921. package/dist/unstable/http/Url.d.ts +33 -63
  922. package/dist/unstable/http/Url.d.ts.map +1 -1
  923. package/dist/unstable/http/Url.js +14 -28
  924. package/dist/unstable/http/Url.js.map +1 -1
  925. package/dist/unstable/http/UrlParams.d.ts +10 -18
  926. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  927. package/dist/unstable/http/UrlParams.js +9 -17
  928. package/dist/unstable/http/UrlParams.js.map +1 -1
  929. package/dist/unstable/http/index.js.map +1 -1
  930. package/dist/unstable/http/internal/compression.d.ts +2 -0
  931. package/dist/unstable/http/internal/compression.d.ts.map +1 -0
  932. package/dist/unstable/http/internal/compression.js +155 -0
  933. package/dist/unstable/http/internal/compression.js.map +1 -0
  934. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
  935. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  936. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
  937. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  938. package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
  939. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  940. package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
  941. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  942. package/dist/unstable/httpapi/HttpApiClient.js +11 -13
  943. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  944. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
  945. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  946. package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
  947. package/dist/unstable/httpapi/HttpApiError.js +13 -13
  948. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  949. package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
  950. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  951. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
  952. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  953. package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
  954. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  955. package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
  956. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  957. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  958. package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
  959. package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
  960. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  961. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  962. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  963. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  964. package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
  965. package/dist/unstable/httpapi/OpenApi.js +13 -13
  966. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  967. package/dist/unstable/httpapi/index.js.map +1 -1
  968. package/dist/unstable/httpapi/internal/html.js.map +1 -1
  969. package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
  970. package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
  971. package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
  972. package/dist/unstable/observability/Otlp.js.map +1 -1
  973. package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
  974. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  975. package/dist/unstable/observability/OtlpExporter.js +17 -4
  976. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  977. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  978. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
  979. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  980. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  981. package/dist/unstable/observability/OtlpResource.d.ts +16 -7
  982. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  983. package/dist/unstable/observability/OtlpResource.js +21 -12
  984. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  985. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  986. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  987. package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
  988. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  989. package/dist/unstable/observability/PrometheusMetrics.js +10 -3
  990. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  991. package/dist/unstable/observability/index.js.map +1 -1
  992. package/dist/unstable/observability/internal/otlpEnv.js +1 -1
  993. package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
  994. package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
  995. package/dist/unstable/observability/internal/protobuf.js +3 -0
  996. package/dist/unstable/observability/internal/protobuf.js.map +1 -1
  997. package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
  998. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  999. package/dist/unstable/persistence/KeyValueStore.js +22 -13
  1000. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  1001. package/dist/unstable/persistence/Persistable.d.ts +8 -8
  1002. package/dist/unstable/persistence/Persistable.js.map +1 -1
  1003. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  1004. package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
  1005. package/dist/unstable/persistence/PersistedQueue.js +6 -6
  1006. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  1007. package/dist/unstable/persistence/Persistence.d.ts +3 -3
  1008. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  1009. package/dist/unstable/persistence/Persistence.js +91 -15
  1010. package/dist/unstable/persistence/Persistence.js.map +1 -1
  1011. package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
  1012. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  1013. package/dist/unstable/persistence/RateLimiter.js +24 -13
  1014. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  1015. package/dist/unstable/persistence/Redis.d.ts +2 -2
  1016. package/dist/unstable/persistence/Redis.js +1 -1
  1017. package/dist/unstable/persistence/Redis.js.map +1 -1
  1018. package/dist/unstable/persistence/index.js.map +1 -1
  1019. package/dist/unstable/process/ChildProcess.d.ts +64 -21
  1020. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1021. package/dist/unstable/process/ChildProcess.js +14 -5
  1022. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1023. package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
  1024. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1025. package/dist/unstable/process/ChildProcessSpawner.js +1 -1
  1026. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1027. package/dist/unstable/process/index.js.map +1 -1
  1028. package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
  1029. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  1030. package/dist/unstable/reactivity/AsyncResult.js +10 -10
  1031. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1032. package/dist/unstable/reactivity/Atom.d.ts +25 -22
  1033. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1034. package/dist/unstable/reactivity/Atom.js +14 -13
  1035. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1036. package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
  1037. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1038. package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
  1039. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1040. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  1041. package/dist/unstable/reactivity/AtomRegistry.js +24 -3
  1042. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1043. package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
  1044. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1045. package/dist/unstable/reactivity/AtomRpc.js +4 -1
  1046. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1047. package/dist/unstable/reactivity/Hydration.d.ts +1 -1
  1048. package/dist/unstable/reactivity/Hydration.js +1 -1
  1049. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  1050. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1051. package/dist/unstable/reactivity/index.js.map +1 -1
  1052. package/dist/unstable/rpc/Rpc.d.ts +35 -33
  1053. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1054. package/dist/unstable/rpc/Rpc.js +4 -2
  1055. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1056. package/dist/unstable/rpc/RpcClient.d.ts +12 -12
  1057. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1058. package/dist/unstable/rpc/RpcClient.js +12 -11
  1059. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1060. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  1061. package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
  1062. package/dist/unstable/rpc/RpcGroup.js +1 -1
  1063. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1064. package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
  1065. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  1066. package/dist/unstable/rpc/RpcMessage.js +6 -6
  1067. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  1068. package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
  1069. package/dist/unstable/rpc/RpcMiddleware.js +1 -1
  1070. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1071. package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
  1072. package/dist/unstable/rpc/RpcSchema.js +3 -3
  1073. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1074. package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
  1075. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1076. package/dist/unstable/rpc/RpcSerialization.js +175 -96
  1077. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1078. package/dist/unstable/rpc/RpcServer.d.ts +13 -13
  1079. package/dist/unstable/rpc/RpcServer.js +17 -13
  1080. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1081. package/dist/unstable/rpc/RpcTest.js.map +1 -1
  1082. package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
  1083. package/dist/unstable/rpc/RpcWorker.js +4 -4
  1084. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1085. package/dist/unstable/rpc/Utils.js.map +1 -1
  1086. package/dist/unstable/rpc/index.js.map +1 -1
  1087. package/dist/unstable/schema/Model.d.ts +52 -50
  1088. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1089. package/dist/unstable/schema/Model.js +35 -33
  1090. package/dist/unstable/schema/Model.js.map +1 -1
  1091. package/dist/unstable/schema/VariantSchema.d.ts +5 -5
  1092. package/dist/unstable/schema/VariantSchema.js +2 -2
  1093. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1094. package/dist/unstable/schema/index.js.map +1 -1
  1095. package/dist/unstable/socket/Socket.d.ts +11 -3
  1096. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1097. package/dist/unstable/socket/Socket.js +9 -4
  1098. package/dist/unstable/socket/Socket.js.map +1 -1
  1099. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1100. package/dist/unstable/socket/index.js.map +1 -1
  1101. package/dist/unstable/sql/Migrator.js.map +1 -1
  1102. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  1103. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1104. package/dist/unstable/sql/SqlClient.js +2 -2
  1105. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1106. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1107. package/dist/unstable/sql/SqlError.js.map +1 -1
  1108. package/dist/unstable/sql/SqlModel.d.ts +2 -2
  1109. package/dist/unstable/sql/SqlModel.js +2 -2
  1110. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1111. package/dist/unstable/sql/SqlResolver.d.ts +5 -5
  1112. package/dist/unstable/sql/SqlResolver.js +2 -2
  1113. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1114. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1115. package/dist/unstable/sql/SqlStream.js.map +1 -1
  1116. package/dist/unstable/sql/Statement.d.ts +6 -6
  1117. package/dist/unstable/sql/Statement.js +15 -15
  1118. package/dist/unstable/sql/Statement.js.map +1 -1
  1119. package/dist/unstable/sql/index.js.map +1 -1
  1120. package/dist/unstable/workers/Transferable.d.ts +1 -1
  1121. package/dist/unstable/workers/Transferable.js +1 -1
  1122. package/dist/unstable/workers/Transferable.js.map +1 -1
  1123. package/dist/unstable/workers/Worker.d.ts +2 -2
  1124. package/dist/unstable/workers/Worker.js +2 -2
  1125. package/dist/unstable/workers/Worker.js.map +1 -1
  1126. package/dist/unstable/workers/WorkerError.d.ts +7 -7
  1127. package/dist/unstable/workers/WorkerError.js +6 -6
  1128. package/dist/unstable/workers/WorkerError.js.map +1 -1
  1129. package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
  1130. package/dist/unstable/workers/WorkerRunner.js +1 -1
  1131. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1132. package/dist/unstable/workers/index.js.map +1 -1
  1133. package/dist/unstable/workflow/Activity.d.ts +2 -2
  1134. package/dist/unstable/workflow/Activity.js +2 -2
  1135. package/dist/unstable/workflow/Activity.js.map +1 -1
  1136. package/dist/unstable/workflow/DurableClock.d.ts +1 -1
  1137. package/dist/unstable/workflow/DurableClock.js +1 -1
  1138. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1139. package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
  1140. package/dist/unstable/workflow/DurableDeferred.js +5 -5
  1141. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1142. package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
  1143. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  1144. package/dist/unstable/workflow/DurableQueue.js +22 -20
  1145. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  1146. package/dist/unstable/workflow/Workflow.d.ts +21 -21
  1147. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1148. package/dist/unstable/workflow/Workflow.js +13 -14
  1149. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1150. package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
  1151. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1152. package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
  1153. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  1154. package/dist/unstable/workflow/WorkflowProxy.js +4 -2
  1155. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  1156. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1157. package/dist/unstable/workflow/index.js.map +1 -1
  1158. package/dist/unstable/workflow/internal/crypto.js.map +1 -1
  1159. package/package.json +5 -6
  1160. package/src/Array.ts +982 -1045
  1161. package/src/BigDecimal.ts +433 -756
  1162. package/src/BigInt.ts +213 -269
  1163. package/src/Boolean.ts +146 -188
  1164. package/src/Cache.ts +409 -255
  1165. package/src/Cause.ts +167 -277
  1166. package/src/Channel.ts +891 -816
  1167. package/src/ChannelSchema.ts +1 -1
  1168. package/src/Chunk.ts +841 -1181
  1169. package/src/Clock.ts +181 -49
  1170. package/src/Combiner.ts +20 -33
  1171. package/src/Config.ts +615 -332
  1172. package/src/ConfigProvider.ts +214 -120
  1173. package/src/Console.ts +289 -39
  1174. package/src/Context.ts +319 -378
  1175. package/src/Cron.ts +68 -77
  1176. package/src/Crypto.ts +13 -15
  1177. package/src/Data.ts +60 -80
  1178. package/src/DateTime.ts +564 -660
  1179. package/src/Deferred.ts +253 -256
  1180. package/src/Duration.ts +216 -308
  1181. package/src/Effect.ts +2893 -3279
  1182. package/src/Encoding.ts +22 -40
  1183. package/src/Equal.ts +49 -39
  1184. package/src/Equivalence.ts +103 -105
  1185. package/src/ErrorReporter.ts +51 -27
  1186. package/src/ExecutionPlan.ts +13 -55
  1187. package/src/Exit.ts +116 -192
  1188. package/src/Fiber.ts +81 -148
  1189. package/src/FiberHandle.ts +152 -105
  1190. package/src/FiberMap.ts +225 -174
  1191. package/src/FiberSet.ts +124 -82
  1192. package/src/FileSystem.ts +155 -263
  1193. package/src/Filter.ts +61 -33
  1194. package/src/Formatter.ts +54 -56
  1195. package/src/Function.ts +76 -145
  1196. package/src/Graph.ts +416 -770
  1197. package/src/HKT.ts +12 -6
  1198. package/src/Hash.ts +52 -83
  1199. package/src/HashMap.ts +319 -411
  1200. package/src/HashRing.ts +1 -0
  1201. package/src/HashSet.ts +177 -284
  1202. package/src/Inspectable.ts +12 -12
  1203. package/src/Iterable.ts +620 -786
  1204. package/src/JsonPatch.ts +58 -112
  1205. package/src/JsonPointer.ts +8 -8
  1206. package/src/JsonSchema.ts +402 -244
  1207. package/src/Latch.ts +23 -35
  1208. package/src/Layer.ts +359 -260
  1209. package/src/LayerMap.ts +49 -29
  1210. package/src/LayerRef.ts +6 -2
  1211. package/src/LogLevel.ts +114 -214
  1212. package/src/Logger.ts +344 -697
  1213. package/src/ManagedRuntime.ts +7 -5
  1214. package/src/Match.ts +217 -252
  1215. package/src/Metric.ts +516 -1089
  1216. package/src/MutableHashMap.ts +218 -255
  1217. package/src/MutableHashSet.ts +84 -89
  1218. package/src/MutableList.ts +73 -370
  1219. package/src/MutableRef.ts +420 -243
  1220. package/src/Newtype.ts +21 -14
  1221. package/src/NonEmptyIterable.ts +7 -137
  1222. package/src/Number.ts +196 -233
  1223. package/src/Optic.ts +243 -383
  1224. package/src/Option.ts +447 -812
  1225. package/src/Order.ts +109 -109
  1226. package/src/Ordering.ts +20 -23
  1227. package/src/Path.ts +38 -41
  1228. package/src/Pipeable.ts +6 -5
  1229. package/src/PlatformError.ts +4 -4
  1230. package/src/Pool.ts +4 -2
  1231. package/src/Predicate.ts +200 -181
  1232. package/src/PrimaryKey.ts +7 -7
  1233. package/src/PubSub.ts +526 -552
  1234. package/src/Pull.ts +24 -18
  1235. package/src/Queue.ts +200 -159
  1236. package/src/Random.ts +49 -74
  1237. package/src/RcMap.ts +121 -63
  1238. package/src/RcRef.ts +24 -13
  1239. package/src/Record.ts +291 -488
  1240. package/src/Redactable.ts +10 -3
  1241. package/src/Redacted.ts +25 -25
  1242. package/src/Reducer.ts +8 -15
  1243. package/src/Ref.ts +221 -361
  1244. package/src/References.ts +102 -168
  1245. package/src/RegExp.ts +10 -14
  1246. package/src/Request.ts +31 -21
  1247. package/src/RequestResolver.ts +202 -91
  1248. package/src/Result.ts +312 -484
  1249. package/src/Runtime.ts +50 -75
  1250. package/src/Schedule.ts +308 -1734
  1251. package/src/Scheduler.ts +20 -7
  1252. package/src/Schema.ts +716 -745
  1253. package/src/SchemaAST.ts +466 -358
  1254. package/src/SchemaError.ts +7 -6
  1255. package/src/SchemaGetter.ts +242 -190
  1256. package/src/SchemaIssue.ts +89 -275
  1257. package/src/SchemaParser.ts +180 -93
  1258. package/src/SchemaRepresentation.ts +22 -40
  1259. package/src/SchemaTransformation.ts +129 -88
  1260. package/src/Scope.ts +123 -151
  1261. package/src/ScopedRef.ts +4 -4
  1262. package/src/Semaphore.ts +152 -51
  1263. package/src/Sink.ts +128 -113
  1264. package/src/Stdio.ts +1 -1
  1265. package/src/Stream.ts +2602 -3123
  1266. package/src/String.ts +275 -312
  1267. package/src/Struct.ts +109 -114
  1268. package/src/SubscriptionRef.ts +284 -252
  1269. package/src/Symbol.ts +3 -3
  1270. package/src/Terminal.ts +2 -2
  1271. package/src/Tracer.ts +102 -55
  1272. package/src/Trie.ts +287 -679
  1273. package/src/Tuple.ts +92 -127
  1274. package/src/TxChunk.ts +201 -121
  1275. package/src/TxDeferred.ts +62 -46
  1276. package/src/TxHashMap.ts +645 -799
  1277. package/src/TxHashSet.ts +443 -356
  1278. package/src/TxPriorityQueue.ts +130 -98
  1279. package/src/TxPubSub.ts +107 -80
  1280. package/src/TxQueue.ts +214 -183
  1281. package/src/TxReentrantLock.ts +97 -66
  1282. package/src/TxRef.ts +51 -32
  1283. package/src/TxSemaphore.ts +129 -95
  1284. package/src/TxSubscriptionRef.ts +97 -70
  1285. package/src/Types.ts +126 -67
  1286. package/src/Unify.ts +45 -65
  1287. package/src/Utils.ts +23 -16
  1288. package/src/internal/core.ts +2 -2
  1289. package/src/internal/dateTime.ts +6 -0
  1290. package/src/internal/effect.ts +93 -48
  1291. package/src/internal/persistence.ts +2 -0
  1292. package/src/internal/references.ts +3 -2
  1293. package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
  1294. package/src/internal/schema/fromRepresentation.ts +10 -16
  1295. package/src/internal/schema/parser.ts +22 -0
  1296. package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
  1297. package/src/internal/schema/toRepresentation.ts +104 -119
  1298. package/src/internal/trie.ts +10 -11
  1299. package/src/testing/FastCheck.ts +8 -7
  1300. package/src/testing/TestClock.ts +72 -30
  1301. package/src/testing/TestConsole.ts +32 -31
  1302. package/src/testing/TestSchema.ts +29 -29
  1303. package/src/unstable/ai/AiError.ts +95 -118
  1304. package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
  1305. package/src/unstable/ai/Chat.ts +132 -97
  1306. package/src/unstable/ai/IdGenerator.ts +32 -28
  1307. package/src/unstable/ai/LanguageModel.ts +107 -67
  1308. package/src/unstable/ai/McpProtocol.ts +48 -0
  1309. package/src/unstable/ai/McpSchema.ts +60 -50
  1310. package/src/unstable/ai/McpServer.ts +930 -304
  1311. package/src/unstable/ai/Model.ts +9 -20
  1312. package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
  1313. package/src/unstable/ai/Prompt.ts +145 -43
  1314. package/src/unstable/ai/Response.ts +28 -14
  1315. package/src/unstable/ai/Telemetry.ts +46 -13
  1316. package/src/unstable/ai/Tokenizer.ts +14 -3
  1317. package/src/unstable/ai/Tool.ts +59 -44
  1318. package/src/unstable/ai/Toolkit.ts +26 -8
  1319. package/src/unstable/ai/index.ts +5 -0
  1320. package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
  1321. package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
  1322. package/src/unstable/ai/internal/structured-output.ts +13 -18
  1323. package/src/unstable/cli/Argument.ts +273 -69
  1324. package/src/unstable/cli/CliError.ts +69 -76
  1325. package/src/unstable/cli/CliOutput.ts +44 -58
  1326. package/src/unstable/cli/Command.ts +705 -107
  1327. package/src/unstable/cli/Flag.ts +418 -138
  1328. package/src/unstable/cli/GlobalFlag.ts +1 -1
  1329. package/src/unstable/cli/HelpDoc.ts +12 -4
  1330. package/src/unstable/cli/Param.ts +292 -78
  1331. package/src/unstable/cli/Primitive.ts +370 -149
  1332. package/src/unstable/cli/Prompt.ts +28 -14
  1333. package/src/unstable/cli/internal/lexer.ts +8 -2
  1334. package/src/unstable/cli/internal/parser.ts +2 -2
  1335. package/src/unstable/cluster/ClusterSchema.ts +8 -8
  1336. package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
  1337. package/src/unstable/cluster/Entity.ts +15 -16
  1338. package/src/unstable/cluster/EntityProxy.ts +4 -2
  1339. package/src/unstable/cluster/EntityResource.ts +2 -2
  1340. package/src/unstable/cluster/Envelope.ts +3 -3
  1341. package/src/unstable/cluster/HttpRunner.ts +6 -4
  1342. package/src/unstable/cluster/Message.ts +9 -9
  1343. package/src/unstable/cluster/MessageStorage.ts +15 -15
  1344. package/src/unstable/cluster/Reply.ts +4 -6
  1345. package/src/unstable/cluster/RunnerHealth.ts +1 -1
  1346. package/src/unstable/cluster/RunnerServer.ts +41 -8
  1347. package/src/unstable/cluster/RunnerStorage.ts +2 -2
  1348. package/src/unstable/cluster/Runners.ts +23 -12
  1349. package/src/unstable/cluster/Sharding.ts +7 -8
  1350. package/src/unstable/cluster/ShardingConfig.ts +3 -3
  1351. package/src/unstable/cluster/SingletonAddress.ts +1 -1
  1352. package/src/unstable/cluster/Snowflake.ts +8 -8
  1353. package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
  1354. package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
  1355. package/src/unstable/cluster/internal/entityManager.ts +11 -15
  1356. package/src/unstable/encoding/Msgpack.ts +6 -8
  1357. package/src/unstable/encoding/Sse.ts +98 -16
  1358. package/src/unstable/eventlog/Event.ts +20 -20
  1359. package/src/unstable/eventlog/EventGroup.ts +4 -4
  1360. package/src/unstable/eventlog/EventJournal.ts +15 -15
  1361. package/src/unstable/eventlog/EventLog.ts +3 -3
  1362. package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
  1363. package/src/unstable/eventlog/EventLogMessage.ts +2 -2
  1364. package/src/unstable/eventlog/EventLogRemote.ts +1 -1
  1365. package/src/unstable/eventlog/EventLogServer.ts +41 -7
  1366. package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
  1367. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
  1368. package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
  1369. package/src/unstable/http/Cookies.ts +35 -21
  1370. package/src/unstable/http/Etag.ts +1 -1
  1371. package/src/unstable/http/FetchHttpClient.ts +3 -1
  1372. package/src/unstable/http/Headers.ts +2 -2
  1373. package/src/unstable/http/HttpBody.ts +20 -5
  1374. package/src/unstable/http/HttpClient.ts +83 -55
  1375. package/src/unstable/http/HttpClientRequest.ts +2 -0
  1376. package/src/unstable/http/HttpClientResponse.ts +4 -4
  1377. package/src/unstable/http/HttpEffect.ts +8 -8
  1378. package/src/unstable/http/HttpMethod.ts +6 -9
  1379. package/src/unstable/http/HttpMiddleware.ts +202 -39
  1380. package/src/unstable/http/HttpPlatform.ts +95 -0
  1381. package/src/unstable/http/HttpRouter.ts +102 -98
  1382. package/src/unstable/http/HttpServer.ts +13 -13
  1383. package/src/unstable/http/HttpServerError.ts +2 -2
  1384. package/src/unstable/http/HttpServerRequest.ts +4 -4
  1385. package/src/unstable/http/HttpServerResponse.ts +30 -0
  1386. package/src/unstable/http/HttpStaticServer.ts +35 -7
  1387. package/src/unstable/http/Multipart.ts +6 -6
  1388. package/src/unstable/http/Url.ts +33 -63
  1389. package/src/unstable/http/UrlParams.ts +10 -18
  1390. package/src/unstable/http/internal/compression.ts +196 -0
  1391. package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
  1392. package/src/unstable/httpapi/HttpApiClient.ts +14 -14
  1393. package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
  1394. package/src/unstable/httpapi/HttpApiError.ts +13 -13
  1395. package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
  1396. package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
  1397. package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
  1398. package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
  1399. package/src/unstable/httpapi/OpenApi.ts +13 -13
  1400. package/src/unstable/observability/OtlpExporter.ts +31 -19
  1401. package/src/unstable/observability/OtlpMetrics.ts +4 -1
  1402. package/src/unstable/observability/OtlpResource.ts +26 -17
  1403. package/src/unstable/observability/PrometheusMetrics.ts +13 -4
  1404. package/src/unstable/observability/internal/otlpEnv.ts +1 -1
  1405. package/src/unstable/observability/internal/protobuf.ts +3 -0
  1406. package/src/unstable/persistence/KeyValueStore.ts +72 -49
  1407. package/src/unstable/persistence/Persistable.ts +8 -8
  1408. package/src/unstable/persistence/PersistedQueue.ts +6 -6
  1409. package/src/unstable/persistence/Persistence.ts +126 -19
  1410. package/src/unstable/persistence/RateLimiter.ts +26 -15
  1411. package/src/unstable/persistence/Redis.ts +2 -2
  1412. package/src/unstable/process/ChildProcess.ts +64 -21
  1413. package/src/unstable/process/ChildProcessSpawner.ts +21 -10
  1414. package/src/unstable/reactivity/AsyncResult.ts +12 -13
  1415. package/src/unstable/reactivity/Atom.ts +28 -25
  1416. package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
  1417. package/src/unstable/reactivity/AtomRegistry.ts +24 -3
  1418. package/src/unstable/reactivity/AtomRpc.ts +5 -4
  1419. package/src/unstable/reactivity/Hydration.ts +1 -1
  1420. package/src/unstable/rpc/Rpc.ts +35 -33
  1421. package/src/unstable/rpc/RpcClient.ts +16 -15
  1422. package/src/unstable/rpc/RpcGroup.ts +8 -8
  1423. package/src/unstable/rpc/RpcMessage.ts +31 -30
  1424. package/src/unstable/rpc/RpcMiddleware.ts +10 -10
  1425. package/src/unstable/rpc/RpcSchema.ts +4 -4
  1426. package/src/unstable/rpc/RpcSerialization.ts +167 -68
  1427. package/src/unstable/rpc/RpcServer.ts +18 -15
  1428. package/src/unstable/rpc/RpcWorker.ts +5 -5
  1429. package/src/unstable/schema/Model.ts +52 -50
  1430. package/src/unstable/schema/VariantSchema.ts +5 -5
  1431. package/src/unstable/socket/Socket.ts +17 -4
  1432. package/src/unstable/sql/SqlClient.ts +5 -6
  1433. package/src/unstable/sql/SqlModel.ts +2 -2
  1434. package/src/unstable/sql/SqlResolver.ts +5 -5
  1435. package/src/unstable/sql/Statement.ts +24 -23
  1436. package/src/unstable/workers/Transferable.ts +1 -1
  1437. package/src/unstable/workers/Worker.ts +2 -2
  1438. package/src/unstable/workers/WorkerError.ts +7 -7
  1439. package/src/unstable/workers/WorkerRunner.ts +1 -1
  1440. package/src/unstable/workflow/Activity.ts +2 -2
  1441. package/src/unstable/workflow/DurableClock.ts +1 -1
  1442. package/src/unstable/workflow/DurableDeferred.ts +10 -10
  1443. package/src/unstable/workflow/DurableQueue.ts +22 -20
  1444. package/src/unstable/workflow/Workflow.ts +23 -23
  1445. package/src/unstable/workflow/WorkflowEngine.ts +1 -1
  1446. package/src/unstable/workflow/WorkflowProxy.ts +4 -2
  1447. package/dist/internal/version.d.ts +0 -3
  1448. package/dist/internal/version.d.ts.map +0 -1
  1449. package/dist/internal/version.js +0 -2
  1450. package/dist/internal/version.js.map +0 -1
  1451. package/src/internal/version.ts +0 -2
package/dist/Metric.d.ts CHANGED
@@ -38,12 +38,8 @@ import type { Contravariant, Covariant } from "./Types.ts";
38
38
  *
39
39
  * **Example** (Using multiple metric types)
40
40
  *
41
- * ```ts
42
- * import { Data, Effect, Metric } from "effect"
43
- *
44
- * class MetricExample extends Data.TaggedError("MetricExample")<{
45
- * readonly operation: string
46
- * }> {}
41
+ * ```ts import.meta.vitest
42
+ * import { Effect, Metric } from "effect"
47
43
  *
48
44
  * const program = Effect.gen(function*() {
49
45
  * // Create different types of metrics
@@ -89,6 +85,13 @@ import type { Contravariant, Covariant } from "./Types.ts";
89
85
  * }
90
86
  * }
91
87
  * })
88
+ *
89
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
90
+ * const values = [
91
+ * result.counter.state.count,
92
+ * result.gauge.state.value,
93
+ * result.frequency.state.occurrences.get("200")
94
+ * ] // => [1, 128, 1]
92
95
  * ```
93
96
  *
94
97
  * @category models
@@ -116,12 +119,8 @@ export interface Metric<in Input, out State> extends Pipeable {
116
119
  *
117
120
  * **Example** (Using counter metrics)
118
121
  *
119
- * ```ts
120
- * import { Data, Effect, Metric } from "effect"
121
- *
122
- * class CounterInterfaceError extends Data.TaggedError("CounterInterfaceError")<{
123
- * readonly operation: string
124
- * }> {}
122
+ * ```ts import.meta.vitest
123
+ * import { Effect, Metric } from "effect"
125
124
  *
126
125
  * const program = Effect.gen(function*() {
127
126
  * // Create different types of counters
@@ -167,9 +166,12 @@ export interface Metric<in Input, out State> extends Pipeable {
167
166
  * bytes: { count: bytesState.count, incremental: bytesState.incremental }
168
167
  * }
169
168
  * })
169
+ *
170
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
171
+ * const counts = [result.requests.count, result.bytes.count] // => [6, 1024n]
170
172
  * ```
171
173
  *
172
- * @category metrics
174
+ * @category models
173
175
  * @since 2.0.0
174
176
  */
175
177
  export interface Counter<in Input extends number | bigint> extends Metric<Input, CounterState<Input>> {
@@ -179,12 +181,8 @@ export interface Counter<in Input extends number | bigint> extends Metric<Input,
179
181
  *
180
182
  * **Example** (Reading counter state)
181
183
  *
182
- * ```ts
183
- * import { Data, Effect, Metric } from "effect"
184
- *
185
- * class CounterStateError extends Data.TaggedError("CounterStateError")<{
186
- * readonly operation: string
187
- * }> {}
184
+ * ```ts import.meta.vitest
185
+ * import { Effect, Metric } from "effect"
188
186
  *
189
187
  * const program = Effect.gen(function*() {
190
188
  * // Create different types of counters
@@ -209,7 +207,6 @@ export interface Counter<in Input extends number | bigint> extends Metric<Input,
209
207
  * const byteState: Metric.CounterState<bigint> = yield* Metric.value(
210
208
  * byteCounter
211
209
  * )
212
- *
213
210
  * // CounterState contains:
214
211
  * // - count: current count value (number or bigint based on counter type)
215
212
  * // - incremental: whether counter only allows increases
@@ -229,9 +226,12 @@ export interface Counter<in Input extends number | bigint> extends Metric<Input,
229
226
  * }
230
227
  * }
231
228
  * })
229
+ *
230
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
231
+ * const counts = [result.requests.total, result.errors.total, result.bytes.total] // => [3, 3, 1024000n]
232
232
  * ```
233
233
  *
234
- * @category Counter
234
+ * @category models
235
235
  * @since 4.0.0
236
236
  */
237
237
  export interface CounterState<in Input extends number | bigint> {
@@ -249,32 +249,16 @@ export interface CounterState<in Input extends number | bigint> {
249
249
  *
250
250
  * **Example** (Using frequency metrics)
251
251
  *
252
- * ```ts
253
- * import { Data, Effect, Metric } from "effect"
254
- *
255
- * class FrequencyInterfaceError
256
- * extends Data.TaggedError("FrequencyInterfaceError")<{
257
- * readonly operation: string
258
- * }>
259
- * {}
252
+ * ```ts import.meta.vitest
253
+ * import { Effect, Metric } from "effect"
260
254
  *
261
255
  * // Function that accepts any Frequency metric
262
- * const logFrequencyMetric = (freq: Metric.Frequency) =>
256
+ * const analyzeFrequencyMetric = (freq: Metric.Frequency) =>
263
257
  * Effect.gen(function*() {
264
258
  * const state = yield* Metric.value(freq)
265
259
  *
266
- * yield* Effect.log(`Frequency Metric: ${freq.id}`)
267
- * yield* Effect.log(`Description: ${freq.description ?? "No description"}`)
268
- * yield* Effect.log(`Type: ${freq.type}`) // "Frequency"
269
- *
270
260
  * // Access the frequency state
271
261
  * const occurrences: ReadonlyMap<string, number> = state.occurrences
272
- * yield* Effect.log(`Total unique values: ${occurrences.size}`)
273
- *
274
- * // Iterate through all occurrences
275
- * for (const [value, count] of occurrences) {
276
- * yield* Effect.log(` "${value}": ${count} occurrences`)
277
- * }
278
262
  *
279
263
  * // Find most frequent value
280
264
  * let maxCount = 0
@@ -311,14 +295,16 @@ export interface CounterState<in Input extends number | bigint> {
311
295
  * yield* Metric.update(userActions, "login")
312
296
  *
313
297
  * // Use the function with different frequency metrics
314
- * const statusAnalysis = yield* logFrequencyMetric(statusCodes)
315
- * const actionAnalysis = yield* logFrequencyMetric(userActions)
316
- *
298
+ * const statusAnalysis = yield* analyzeFrequencyMetric(statusCodes)
299
+ * const actionAnalysis = yield* analyzeFrequencyMetric(userActions)
317
300
  * return { statusAnalysis, actionAnalysis }
318
301
  * })
302
+ *
303
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
304
+ * const values = [result.statusAnalysis.mostFrequent, result.actionAnalysis.mostFrequent] // => ["200", "login"]
319
305
  * ```
320
306
  *
321
- * @category metrics
307
+ * @category models
322
308
  * @since 2.0.0
323
309
  */
324
310
  export interface Frequency extends Metric<string, FrequencyState> {
@@ -328,12 +314,8 @@ export interface Frequency extends Metric<string, FrequencyState> {
328
314
  *
329
315
  * **Example** (Reading frequency state)
330
316
  *
331
- * ```ts
332
- * import { Data, Effect, Metric } from "effect"
333
- *
334
- * class FrequencyStateError extends Data.TaggedError("FrequencyStateError")<{
335
- * readonly operation: string
336
- * }> {}
317
+ * ```ts import.meta.vitest
318
+ * import { Effect, Metric } from "effect"
337
319
  *
338
320
  * const program = Effect.gen(function*() {
339
321
  * // Create frequency metrics for different categories
@@ -381,7 +363,6 @@ export interface Frequency extends Metric<string, FrequencyState> {
381
363
  *
382
364
  * const topStatus = getMostFrequent(statusState.occurrences)
383
365
  * const topAction = getMostFrequent(actionState.occurrences)
384
- *
385
366
  * return {
386
367
  * statusCodes: {
387
368
  * totalResponses: Array.from(statusState.occurrences.values()).reduce(
@@ -401,9 +382,13 @@ export interface Frequency extends Metric<string, FrequencyState> {
401
382
  * }
402
383
  * }
403
384
  * })
385
+ *
386
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
387
+ * const mostCommon = [result.statusCodes.mostCommon, result.userActions.mostCommon]
388
+ * mostCommon.map(({ key, count }) => [key, count]) // => [["200", 3], ["click", 3]]
404
389
  * ```
405
390
  *
406
- * @category metrics
391
+ * @category models
407
392
  * @since 4.0.0
408
393
  */
409
394
  export interface FrequencyState {
@@ -419,12 +404,8 @@ export interface FrequencyState {
419
404
  *
420
405
  * **Example** (Using gauge metrics)
421
406
  *
422
- * ```ts
423
- * import { Data, Effect, Metric } from "effect"
424
- *
425
- * class GaugeInterfaceError extends Data.TaggedError("GaugeInterfaceError")<{
426
- * readonly operation: string
427
- * }> {}
407
+ * ```ts import.meta.vitest
408
+ * import { Effect, Metric } from "effect"
428
409
  *
429
410
  * const program = Effect.gen(function*() {
430
411
  * // Create different types of gauges
@@ -454,7 +435,6 @@ export interface FrequencyState {
454
435
  * const diskState: Metric.GaugeState<bigint> = yield* Metric.value(
455
436
  * diskSpaceGauge
456
437
  * )
457
- *
458
438
  * // Gauge state contains:
459
439
  * // - value: current instantaneous value
460
440
  *
@@ -463,9 +443,12 @@ export interface FrequencyState {
463
443
  * disk: { currentValue: diskState.value } // 5000000000n
464
444
  * }
465
445
  * })
446
+ *
447
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
448
+ * const values = [result.memory.currentValue, result.disk.currentValue] // => [704, 5000000000n]
466
449
  * ```
467
450
  *
468
- * @category metrics
451
+ * @category models
469
452
  * @since 2.0.0
470
453
  */
471
454
  export interface Gauge<in Input extends number | bigint> extends Metric<Input, GaugeState<Input>> {
@@ -475,12 +458,8 @@ export interface Gauge<in Input extends number | bigint> extends Metric<Input, G
475
458
  *
476
459
  * **Example** (Reading gauge state)
477
460
  *
478
- * ```ts
479
- * import { Data, Effect, Metric } from "effect"
480
- *
481
- * class GaugeStateError extends Data.TaggedError("GaugeStateError")<{
482
- * readonly operation: string
483
- * }> {}
461
+ * ```ts import.meta.vitest
462
+ * import { Effect, Metric } from "effect"
484
463
  *
485
464
  * const program = Effect.gen(function*() {
486
465
  * // Create different types of gauges
@@ -516,7 +495,6 @@ export interface Gauge<in Input extends number | bigint> extends Metric<Input, G
516
495
  * const queueState: Metric.GaugeState<number> = yield* Metric.value(
517
496
  * queueSizeGauge
518
497
  * )
519
- *
520
498
  * // GaugeState contains:
521
499
  * // - value: current instantaneous value (number or bigint based on gauge type)
522
500
  *
@@ -532,9 +510,13 @@ export interface Gauge<in Input extends number | bigint> extends Metric<Input, G
532
510
  * }
533
511
  * }
534
512
  * })
513
+ *
514
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
515
+ * const values = [result.environment.temperature, result.system.diskUsage, result.system.queueSize]
516
+ * values // => [23.1, 5000000000n, 15]
535
517
  * ```
536
518
  *
537
- * @category metrics
519
+ * @category models
538
520
  * @since 4.0.0
539
521
  */
540
522
  export interface GaugeState<in Input extends number | bigint> {
@@ -550,14 +532,8 @@ export interface GaugeState<in Input extends number | bigint> {
550
532
  *
551
533
  * **Example** (Using histogram metrics)
552
534
  *
553
- * ```ts
554
- * import { Data, Effect, Metric } from "effect"
555
- *
556
- * class HistogramInterfaceError
557
- * extends Data.TaggedError("HistogramInterfaceError")<{
558
- * readonly operation: string
559
- * }>
560
- * {}
535
+ * ```ts import.meta.vitest
536
+ * import { Effect, Metric } from "effect"
561
537
  *
562
538
  * const program = Effect.gen(function*() {
563
539
  * // Create histograms with different boundary strategies
@@ -565,7 +541,7 @@ export interface GaugeState<in Input extends number | bigint> {
565
541
  * "http_response_time_ms",
566
542
  * {
567
543
  * description: "HTTP response time distribution in milliseconds",
568
- * boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 20 }) // 0, 50, 100, ..., 950
544
+ * boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 20 }) // 50, 100, ..., 900, Infinity
569
545
  * }
570
546
  * )
571
547
  *
@@ -598,7 +574,6 @@ export interface GaugeState<in Input extends number | bigint> {
598
574
  * const fileSizeState: Metric.HistogramState = yield* Metric.value(
599
575
  * fileSizeHistogram
600
576
  * )
601
- *
602
577
  * // Histogram state contains:
603
578
  * // - buckets: Array of [boundary, cumulativeCount] pairs
604
579
  * // - count: total number of observations
@@ -622,9 +597,13 @@ export interface GaugeState<in Input extends number | bigint> {
622
597
  * }
623
598
  * }
624
599
  * })
600
+ *
601
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
602
+ * const values = [result.responseTime.totalRequests, result.responseTime.totalTime, result.fileSize.totalBytes]
603
+ * values // => [4, 445, 118]
625
604
  * ```
626
605
  *
627
- * @category metrics
606
+ * @category models
628
607
  * @since 2.0.0
629
608
  */
630
609
  export interface Histogram<Input> extends Metric<Input, HistogramState> {
@@ -634,18 +613,14 @@ export interface Histogram<Input> extends Metric<Input, HistogramState> {
634
613
  *
635
614
  * **Example** (Reading histogram state)
636
615
  *
637
- * ```ts
638
- * import { Data, Effect, Metric } from "effect"
639
- *
640
- * class HistogramStateError extends Data.TaggedError("HistogramStateError")<{
641
- * readonly operation: string
642
- * }> {}
616
+ * ```ts import.meta.vitest
617
+ * import { Effect, Metric } from "effect"
643
618
  *
644
619
  * const program = Effect.gen(function*() {
645
620
  * // Create histogram with linear boundaries
646
621
  * const responseTimeHistogram = Metric.histogram("api_response_time_ms", {
647
622
  * description: "API response time distribution",
648
- * boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 }) // 0, 100, 200, ..., 900
623
+ * boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 }) // 100, 200, ..., 800, Infinity
649
624
  * })
650
625
  *
651
626
  * // Record observations
@@ -692,7 +667,6 @@ export interface Histogram<Input> extends Metric<Input, HistogramState> {
692
667
  * }
693
668
  *
694
669
  * const bucketAnalysis = analyzeBuckets(state.buckets)
695
- *
696
670
  * return {
697
671
  * responseTime: {
698
672
  * totalRequests: state.count, // 5
@@ -709,9 +683,14 @@ export interface Histogram<Input> extends Metric<Input, HistogramState> {
709
683
  * }
710
684
  * }
711
685
  * })
686
+ *
687
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
688
+ * const stats = result.responseTime
689
+ * const values = [stats.totalRequests, stats.fastestResponse, stats.slowestResponse, stats.totalTime]
690
+ * values // => [5, 50, 750, 1295]
712
691
  * ```
713
692
  *
714
- * @category metrics
693
+ * @category models
715
694
  * @since 4.0.0
716
695
  */
717
696
  export interface HistogramState {
@@ -732,12 +711,8 @@ export interface HistogramState {
732
711
  *
733
712
  * **Example** (Using summary metrics)
734
713
  *
735
- * ```ts
736
- * import { Data, Effect, Metric } from "effect"
737
- *
738
- * class SummaryInterfaceError extends Data.TaggedError("SummaryInterfaceError")<{
739
- * readonly operation: string
740
- * }> {}
714
+ * ```ts import.meta.vitest
715
+ * import { Effect, Metric } from "effect"
741
716
  *
742
717
  * const program = Effect.gen(function*() {
743
718
  * // Create summaries with different quantile configurations
@@ -796,7 +771,6 @@ export interface HistogramState {
796
771
  * const median = getQuantileValue(responseTimeState.quantiles, 0.5)
797
772
  * const p95 = getQuantileValue(responseTimeState.quantiles, 0.95)
798
773
  * const p99 = getQuantileValue(responseTimeState.quantiles, 0.99)
799
- *
800
774
  * return {
801
775
  * responseTime: {
802
776
  * totalRequests: responseTimeState.count, // 5
@@ -814,9 +788,13 @@ export interface HistogramState {
814
788
  * }
815
789
  * }
816
790
  * })
791
+ *
792
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
793
+ * const counts = [result.responseTime.totalRequests, result.responseTime.totalTime, result.requestSize.totalRequests]
794
+ * counts // => [5, 1461, 3]
817
795
  * ```
818
796
  *
819
- * @category metrics
797
+ * @category models
820
798
  * @since 2.0.0
821
799
  */
822
800
  export interface Summary<Input> extends Metric<Input, SummaryState> {
@@ -826,12 +804,8 @@ export interface Summary<Input> extends Metric<Input, SummaryState> {
826
804
  *
827
805
  * **Example** (Reading summary state)
828
806
  *
829
- * ```ts
830
- * import { Data, Effect, Metric } from "effect"
831
- *
832
- * class SummaryStateError extends Data.TaggedError("SummaryStateError")<{
833
- * readonly operation: string
834
- * }> {}
807
+ * ```ts import.meta.vitest
808
+ * import { Effect, Metric } from "effect"
835
809
  *
836
810
  * const program = Effect.gen(function*() {
837
811
  * // Create summary with specific quantiles
@@ -874,7 +848,6 @@ export interface Summary<Input> extends Metric<Input, SummaryState> {
874
848
  * }
875
849
  *
876
850
  * const quantileValues = extractQuantiles(state.quantiles)
877
- *
878
851
  * return {
879
852
  * latencyAnalysis: {
880
853
  * totalRequests: state.count, // 7
@@ -896,9 +869,14 @@ export interface Summary<Input> extends Metric<Input, SummaryState> {
896
869
  * }
897
870
  * }
898
871
  * })
872
+ *
873
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
874
+ * const analysis = result.latencyAnalysis
875
+ * const values = [analysis.totalRequests, analysis.fastestResponse, analysis.slowestResponse, analysis.totalLatency]
876
+ * values // => [7, 45, 890, 1879]
899
877
  * ```
900
878
  *
901
- * @category metrics
879
+ * @category models
902
880
  * @since 4.0.0
903
881
  */
904
882
  export interface SummaryState {
@@ -914,12 +892,8 @@ export interface SummaryState {
914
892
  *
915
893
  * **Example** (Collecting application metrics)
916
894
  *
917
- * ```ts
918
- * import { Data, Effect, Metric } from "effect"
919
- *
920
- * class MetricsError extends Data.TaggedError("MetricsError")<{
921
- * readonly operation: string
922
- * }> {}
895
+ * ```ts import.meta.vitest
896
+ * import { Effect, Metric } from "effect"
923
897
  *
924
898
  * const program = Effect.gen(function*() {
925
899
  * // Create different types of metrics
@@ -949,6 +923,9 @@ export interface SummaryState {
949
923
  * frequency: frequencyValue
950
924
  * }
951
925
  * })
926
+ *
927
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
928
+ * const values = [result.counter.count, result.gauge.value] // => [1, 12]
952
929
  * ```
953
930
  *
954
931
  * @since 2.0.0
@@ -959,78 +936,28 @@ export declare namespace Metric {
959
936
  *
960
937
  * **Example** (Inspecting metric types)
961
938
  *
962
- * ```ts
963
- * import { Data, Effect, Metric } from "effect"
964
- *
965
- * class MetricTypeError extends Data.TaggedError("MetricTypeError")<{
966
- * readonly operation: string
967
- * }> {}
939
+ * ```ts import.meta.vitest
940
+ * import { Metric } from "effect"
968
941
  *
969
- * const program = Effect.gen(function*() {
970
- * // Create different metric types
971
- * const counter = Metric.counter("requests_total")
972
- * const gauge = Metric.gauge("cpu_usage")
973
- * const frequency = Metric.frequency("status_codes")
974
- * const histogram = Metric.histogram("response_time", {
942
+ * const metrics: ReadonlyArray<Metric.Metric<any, any>> = [
943
+ * Metric.counter("requests_total"),
944
+ * Metric.gauge("cpu_usage"),
945
+ * Metric.frequency("status_codes"),
946
+ * Metric.histogram("response_time", {
975
947
  * boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 10 })
976
- * })
977
- * const summary = Metric.summary("latency", {
948
+ * }),
949
+ * Metric.summary("latency", {
978
950
  * maxAge: "5 minutes",
979
951
  * maxSize: 1000,
980
952
  * quantiles: [0.5, 0.95, 0.99]
981
953
  * })
954
+ * ]
982
955
  *
983
- * // Function that checks metric type
984
- * const getMetricInfo = (metric: Metric.Metric<any, any>) => ({
985
- * name: metric.id,
986
- * type: metric.type
987
- * })
988
- *
989
- * // Get type information for each metric
990
- * const counterInfo = getMetricInfo(counter) // { name: "requests_total", type: "Counter" }
991
- * const gaugeInfo = getMetricInfo(gauge) // { name: "cpu_usage", type: "Gauge" }
992
- * const frequencyInfo = getMetricInfo(frequency) // { name: "status_codes", type: "Frequency" }
993
- * const histogramInfo = getMetricInfo(histogram) // { name: "response_time", type: "Histogram" }
994
- * const summaryInfo = getMetricInfo(summary) // { name: "latency", type: "Summary" }
995
- *
996
- * // Pattern match on metric type
997
- * const describeMetric = (type: string): string => {
998
- * switch (type) {
999
- * case "Counter":
1000
- * return "Cumulative values that increase over time"
1001
- * case "Gauge":
1002
- * return "Instantaneous values that can go up or down"
1003
- * case "Frequency":
1004
- * return "Counts of discrete string occurrences"
1005
- * case "Histogram":
1006
- * return "Distribution of values across buckets"
1007
- * case "Summary":
1008
- * return "Quantile calculations over time windows"
1009
- * default:
1010
- * return "Unknown metric type"
1011
- * }
1012
- * }
1013
- *
1014
- * return {
1015
- * metrics: [
1016
- * counterInfo,
1017
- * gaugeInfo,
1018
- * frequencyInfo,
1019
- * histogramInfo,
1020
- * summaryInfo
1021
- * ],
1022
- * descriptions: {
1023
- * Counter: describeMetric("Counter"),
1024
- * Gauge: describeMetric("Gauge"),
1025
- * Frequency: describeMetric("Frequency"),
1026
- * Histogram: describeMetric("Histogram"),
1027
- * Summary: describeMetric("Summary")
1028
- * }
1029
- * }
1030
- * })
956
+ * const types: ReadonlyArray<Metric.Metric.Type> = metrics.map((metric) => metric.type)
957
+ * const actual = types // => ["Counter", "Gauge", "Frequency", "Histogram", "Summary"]
1031
958
  * ```
1032
959
  *
1033
- * @category types
960
+ * @category models
1034
961
  * @since 4.0.0
1035
962
  */
1036
963
  type Type = "Counter" | "Frequency" | "Gauge" | "Histogram" | "Summary";
@@ -1039,12 +966,8 @@ export declare namespace Metric {
1039
966
  *
1040
967
  * **Example** (Providing attributes in different formats)
1041
968
  *
1042
- * ```ts
1043
- * import { Data, Effect, Metric } from "effect"
1044
- *
1045
- * class AttributesError extends Data.TaggedError("AttributesError")<{
1046
- * readonly operation: string
1047
- * }> {}
969
+ * ```ts import.meta.vitest
970
+ * import { Effect, Metric } from "effect"
1048
971
  *
1049
972
  * const program = Effect.gen(function*() {
1050
973
  * // Different ways to specify attributes
@@ -1093,19 +1016,22 @@ export declare namespace Metric {
1093
1016
  * // Both formats result in the same internal representation
1094
1017
  * const normalizedObject = normalizeAttributes(attributesAsObject)
1095
1018
  * const normalizedArray = normalizeAttributes(attributesAsArray)
1096
- *
1097
1019
  * return {
1098
1020
  * attributeFormats: {
1099
1021
  * object: normalizedObject, // { service: "api", environment: "production", version: "1.2.3" }
1100
- * array: normalizedArray, // { service: "api", environment: "production", version: "1.2.3" }
1101
- * areEqual:
1102
- * JSON.stringify(normalizedObject) === JSON.stringify(normalizedArray) // true
1022
+ * array: normalizedArray // { service: "api", environment: "production", version: "1.2.3" }
1103
1023
  * }
1104
1024
  * }
1105
1025
  * })
1026
+ *
1027
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1028
+ * const objectAttributes = result.attributeFormats.object
1029
+ * const arrayAttributes = result.attributeFormats.array
1030
+ * const sameAttributes = [objectAttributes, arrayAttributes]
1031
+ * sameAttributes // => [{ service: "api", environment: "production", version: "1.2.3" }, { service: "api", environment: "production", version: "1.2.3" }]
1106
1032
  * ```
1107
1033
  *
1108
- * @category types
1034
+ * @category models
1109
1035
  * @since 4.0.0
1110
1036
  */
1111
1037
  type Attributes = AttributeSet | ReadonlyArray<[string, string]>;
@@ -1114,12 +1040,8 @@ export declare namespace Metric {
1114
1040
  *
1115
1041
  * **Example** (Combining metric attribute sets)
1116
1042
  *
1117
- * ```ts
1118
- * import { Data, Effect, Metric } from "effect"
1119
- *
1120
- * class AttributeSetError extends Data.TaggedError("AttributeSetError")<{
1121
- * readonly operation: string
1122
- * }> {}
1043
+ * ```ts import.meta.vitest
1044
+ * import { Effect, Metric } from "effect"
1123
1045
  *
1124
1046
  * const program = Effect.gen(function*() {
1125
1047
  * // Define attribute sets for different contexts
@@ -1180,9 +1102,12 @@ export declare namespace Metric {
1180
1102
  * }
1181
1103
  * }
1182
1104
  * })
1105
+ *
1106
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1107
+ * const validation = [result.attributes.isValid, result.attributes.totalKeys] // => [true, 9]
1183
1108
  * ```
1184
1109
  *
1185
- * @category types
1110
+ * @category models
1186
1111
  * @since 4.0.0
1187
1112
  */
1188
1113
  type AttributeSet = Readonly<Record<string, string>>;
@@ -1191,7 +1116,7 @@ export declare namespace Metric {
1191
1116
  *
1192
1117
  * **Example** (Extracting metric input types)
1193
1118
  *
1194
- * ```ts
1119
+ * ```ts import.meta.vitest
1195
1120
  * import { Metric } from "effect"
1196
1121
  *
1197
1122
  * // Create various metric types
@@ -1229,9 +1154,11 @@ export declare namespace Metric {
1229
1154
  * // Metric.update(numberCounter, "abc") // ✗ Type error
1230
1155
  * // Metric.update(stringFrequency, "ok") // ✓ Valid (string)
1231
1156
  * // Metric.update(stringFrequency, 404) // ✗ Type error
1157
+ * const metricIds = metrics.map(({ id, type }) => `${id}:${type}`)
1158
+ * metricIds // => ["requests:Counter", "bytes:Counter", "status_codes:Frequency", "cpu_usage:Gauge", "response_time:Histogram"]
1232
1159
  * ```
1233
1160
  *
1234
- * @category types
1161
+ * @category utility types
1235
1162
  * @since 4.0.0
1236
1163
  */
1237
1164
  type Input<A> = A extends Metric<infer _Input, infer _State> ? _Input : never;
@@ -1240,7 +1167,7 @@ export declare namespace Metric {
1240
1167
  *
1241
1168
  * **Example** (Extracting metric state types)
1242
1169
  *
1243
- * ```ts
1170
+ * ```ts import.meta.vitest
1244
1171
  * import { Effect, Metric } from "effect"
1245
1172
  *
1246
1173
  * // Create various metric types
@@ -1278,7 +1205,6 @@ export declare namespace Metric {
1278
1205
  * const frequencyState = yield* Metric.value(statusFrequency)
1279
1206
  * const histogramState = yield* Metric.value(responseHistogram)
1280
1207
  * const summaryState = yield* Metric.value(latencySummary)
1281
- *
1282
1208
  * return {
1283
1209
  * counter: { count: counterState.count }, // { count: 10 }
1284
1210
  * gauge: { value: gaugeState.value }, // { value: 85.5 }
@@ -1287,9 +1213,13 @@ export declare namespace Metric {
1287
1213
  * summary: { observations: summaryState.count } // { observations: 1 }
1288
1214
  * }
1289
1215
  * })
1216
+ *
1217
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1218
+ * const values = [result.counter.count, result.gauge.value, result.frequency.uniqueValues]
1219
+ * values // => [10, 85.5, 1]
1290
1220
  * ```
1291
1221
  *
1292
- * @category types
1222
+ * @category utility types
1293
1223
  * @since 4.0.0
1294
1224
  */
1295
1225
  type State<A> = A extends Metric<infer _Input, infer _State> ? _State : never;
@@ -1298,12 +1228,8 @@ export declare namespace Metric {
1298
1228
  *
1299
1229
  * **Example** (Using metric hooks)
1300
1230
  *
1301
- * ```ts
1302
- * import { Data, Effect, Metric } from "effect"
1303
- *
1304
- * class HooksError extends Data.TaggedError("HooksError")<{
1305
- * readonly operation: string
1306
- * }> {}
1231
+ * ```ts import.meta.vitest
1232
+ * import { Effect, Metric } from "effect"
1307
1233
  *
1308
1234
  * const program = Effect.gen(function*() {
1309
1235
  * // Create a counter metric
@@ -1331,9 +1257,12 @@ export declare namespace Metric {
1331
1257
  * isIncremental: state.incremental // false
1332
1258
  * }
1333
1259
  * })
1260
+ *
1261
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1262
+ * const state = result // => { currentCount: 6, isIncremental: false }
1334
1263
  * ```
1335
1264
  *
1336
- * @category interfaces
1265
+ * @category models
1337
1266
  * @since 4.0.0
1338
1267
  */
1339
1268
  interface Hooks<in Input, out State> {
@@ -1346,12 +1275,8 @@ export declare namespace Metric {
1346
1275
  *
1347
1276
  * **Example** (Inspecting metric metadata)
1348
1277
  *
1349
- * ```ts
1350
- * import { Data, Effect, Metric } from "effect"
1351
- *
1352
- * class MetadataError extends Data.TaggedError("MetadataError")<{
1353
- * readonly operation: string
1354
- * }> {}
1278
+ * ```ts import.meta.vitest
1279
+ * import { Effect, Metric } from "effect"
1355
1280
  *
1356
1281
  * const program = Effect.gen(function*() {
1357
1282
  * // Create metrics with different configurations
@@ -1396,9 +1321,12 @@ export declare namespace Metric {
1396
1321
  * }
1397
1322
  * }
1398
1323
  * })
1324
+ *
1325
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1326
+ * const types = [result.counter.type, result.gauge.type, result.frequency.type] // => ["Counter", "Gauge", "Frequency"]
1399
1327
  * ```
1400
1328
  *
1401
- * @category interfaces
1329
+ * @category models
1402
1330
  * @since 4.0.0
1403
1331
  */
1404
1332
  interface Metadata<in Input, out State> {
@@ -1413,12 +1341,8 @@ export declare namespace Metric {
1413
1341
  *
1414
1342
  * **Example** (Inspecting metric snapshot protocols)
1415
1343
  *
1416
- * ```ts
1417
- * import { Data, Effect, Metric } from "effect"
1418
- *
1419
- * class SnapshotProtoError extends Data.TaggedError("SnapshotProtoError")<{
1420
- * readonly operation: string
1421
- * }> {}
1344
+ * ```ts import.meta.vitest
1345
+ * import { Effect, Metric } from "effect"
1422
1346
  *
1423
1347
  * const program = Effect.gen(function*() {
1424
1348
  * // Create and update metrics
@@ -1468,9 +1392,12 @@ export declare namespace Metric {
1468
1392
  * null
1469
1393
  * }
1470
1394
  * })
1395
+ *
1396
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1397
+ * const counts = [result.counter?.count, result.histogram?.observations] // => [25, 2]
1471
1398
  * ```
1472
1399
  *
1473
- * @category interfaces
1400
+ * @category models
1474
1401
  * @since 4.0.0
1475
1402
  */
1476
1403
  interface SnapshotProto<T extends Type, State> {
@@ -1485,12 +1412,8 @@ export declare namespace Metric {
1485
1412
  *
1486
1413
  * **Example** (Analyzing metric snapshots)
1487
1414
  *
1488
- * ```ts
1489
- * import { Data, Effect, Metric } from "effect"
1490
- *
1491
- * class SnapshotError extends Data.TaggedError("SnapshotError")<{
1492
- * readonly operation: string
1493
- * }> {}
1415
+ * ```ts import.meta.vitest
1416
+ * import { Effect, Metric } from "effect"
1494
1417
  *
1495
1418
  * const program = Effect.gen(function*() {
1496
1419
  * // Create different types of metrics
@@ -1544,9 +1467,12 @@ export declare namespace Metric {
1544
1467
  * analysis
1545
1468
  * }
1546
1469
  * })
1470
+ *
1471
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1472
+ * const types = result.metricTypes // => ["Counter", "Gauge", "Frequency", "Histogram", "Summary"]
1547
1473
  * ```
1548
1474
  *
1549
- * @category types
1475
+ * @category models
1550
1476
  * @since 4.0.0
1551
1477
  */
1552
1478
  type Snapshot = SnapshotProto<"Counter", CounterState<number | bigint>> | SnapshotProto<"Gauge", GaugeState<number | bigint>> | SnapshotProto<"Frequency", FrequencyState> | SnapshotProto<"Histogram", HistogramState> | SnapshotProto<"Summary", SummaryState>;
@@ -1556,12 +1482,8 @@ export declare namespace Metric {
1556
1482
  *
1557
1483
  * **Example** (Accessing the current metric attributes key)
1558
1484
  *
1559
- * ```ts
1560
- * import { Data, Effect, Metric } from "effect"
1561
- *
1562
- * class AttributesKeyError extends Data.TaggedError("AttributesKeyError")<{
1563
- * readonly operation: string
1564
- * }> {}
1485
+ * ```ts import.meta.vitest
1486
+ * import { Effect, Metric } from "effect"
1565
1487
  *
1566
1488
  * const program = Effect.gen(function*() {
1567
1489
  * // The key is used internally by the Effect runtime to manage metric attributes
@@ -1595,9 +1517,12 @@ export declare namespace Metric {
1595
1517
  * isConstant: key === "effect/Metric/CurrentMetricAttributes" // true
1596
1518
  * }
1597
1519
  * })
1520
+ *
1521
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1522
+ * const key = result // => { keyValue: "effect/Metric/CurrentMetricAttributes", keyType: "string", isConstant: true }
1598
1523
  * ```
1599
1524
  *
1600
- * @category references
1525
+ * @category constants
1601
1526
  * @since 4.0.0
1602
1527
  */
1603
1528
  export declare const CurrentMetricAttributesKey: "effect/Metric/CurrentMetricAttributes";
@@ -1618,17 +1543,12 @@ export declare const CurrentMetricAttributesKey: "effect/Metric/CurrentMetricAtt
1618
1543
  *
1619
1544
  * **Example** (Providing current metric attributes)
1620
1545
  *
1621
- * ```ts
1622
- * import { Data, Effect, Metric } from "effect"
1623
- *
1624
- * class AttributesError extends Data.TaggedError("AttributesError")<{
1625
- * readonly operation: string
1626
- * }> {}
1546
+ * ```ts import.meta.vitest
1547
+ * import { Effect, Metric } from "effect"
1627
1548
  *
1628
1549
  * const program = Effect.gen(function*() {
1629
1550
  * // Access current metric attributes
1630
- * const attributes = yield* Metric.CurrentMetricAttributes
1631
- * console.log("Current attributes:", attributes)
1551
+ * yield* Metric.CurrentMetricAttributes
1632
1552
  *
1633
1553
  * // Set new attributes context
1634
1554
  * const newAttributes = { service: "api", version: "1.0" }
@@ -1643,9 +1563,12 @@ export declare const CurrentMetricAttributesKey: "effect/Metric/CurrentMetricAtt
1643
1563
  *
1644
1564
  * return result
1645
1565
  * })
1566
+ *
1567
+ * const attributes = await Effect.runPromise(program)
1568
+ * const actual = attributes // => { service: "api", version: "1.0" }
1646
1569
  * ```
1647
1570
  *
1648
- * @category references
1571
+ * @category services
1649
1572
  * @since 4.0.0
1650
1573
  */
1651
1574
  export declare const CurrentMetricAttributes: Context.Reference<Readonly<Record<string, string>>>;
@@ -1672,7 +1595,7 @@ export declare const CurrentMetricAttributes: Context.Reference<Readonly<Record<
1672
1595
  * @see {@link snapshot} for reading all registered metrics from the current `Effect` context
1673
1596
  * @see {@link snapshotUnsafe} for reading all registered metrics from an explicit `Context`
1674
1597
  *
1675
- * @category references
1598
+ * @category services
1676
1599
  * @since 4.0.0
1677
1600
  */
1678
1601
  export declare const MetricRegistry: Context.Reference<Map<string, Metric.Metadata<any, any>>>;
@@ -1687,23 +1610,17 @@ declare const TypeId = "~effect/observability/Metric";
1687
1610
  *
1688
1611
  * **Example** (Checking metric values)
1689
1612
  *
1690
- * ```ts
1613
+ * ```ts import.meta.vitest
1691
1614
  * import { Metric } from "effect"
1692
1615
  *
1693
- * const counter = Metric.counter("requests")
1694
- * const gauge = Metric.gauge("temperature")
1695
- * const notAMetric = { name: "fake-metric" }
1696
- *
1697
- * console.log(Metric.isMetric(counter)) // true
1698
- * console.log(Metric.isMetric(gauge)) // true
1699
- * console.log(Metric.isMetric(notAMetric)) // false
1700
- * console.log(Metric.isMetric(null)) // false
1616
+ * Metric.isMetric(Metric.counter("requests")) // => true
1617
+ * Metric.isMetric({ name: "requests" }) // => false
1701
1618
  * ```
1702
1619
  *
1703
1620
  * @category guards
1704
1621
  * @since 4.0.0
1705
1622
  */
1706
- export declare const isMetric: (u: unknown) => u is Metric<unknown, never>;
1623
+ export declare const isMetric: (u: unknown) => u is Metric<never, unknown>;
1707
1624
  /**
1708
1625
  * Represents a Counter metric that tracks cumulative numerical values over
1709
1626
  * time. Counters can be incremented and decremented and provide a running total
@@ -1718,12 +1635,8 @@ export declare const isMetric: (u: unknown) => u is Metric<unknown, never>;
1718
1635
  *
1719
1636
  * **Example** (Creating counter metrics)
1720
1637
  *
1721
- * ```ts
1722
- * import { Data, Effect, Metric } from "effect"
1723
- *
1724
- * class CounterError extends Data.TaggedError("CounterError")<{
1725
- * readonly operation: string
1726
- * }> {}
1638
+ * ```ts import.meta.vitest
1639
+ * import { Effect, Metric } from "effect"
1727
1640
  *
1728
1641
  * const program = Effect.gen(function*() {
1729
1642
  * // Create a basic counter for tracking requests
@@ -1757,6 +1670,9 @@ export declare const isMetric: (u: unknown) => u is Metric<unknown, never>;
1757
1670
  *
1758
1671
  * return { requestValue, eventValue, bytesValue }
1759
1672
  * })
1673
+ *
1674
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1675
+ * const counts = [result.requestValue.count, result.eventValue.count, result.bytesValue.count] // => [6, 1, 1024n]
1760
1676
  * ```
1761
1677
  *
1762
1678
  * @category constructors
@@ -1777,12 +1693,8 @@ export declare const counter: {
1777
1693
  *
1778
1694
  * **Example** (Creating counter metrics)
1779
1695
  *
1780
- * ```ts
1781
- * import { Data, Effect, Metric } from "effect"
1782
- *
1783
- * class CounterError extends Data.TaggedError("CounterError")<{
1784
- * readonly operation: string
1785
- * }> {}
1696
+ * ```ts import.meta.vitest
1697
+ * import { Effect, Metric } from "effect"
1786
1698
  *
1787
1699
  * const program = Effect.gen(function*() {
1788
1700
  * // Create a basic counter for tracking requests
@@ -1816,6 +1728,9 @@ export declare const counter: {
1816
1728
  *
1817
1729
  * return { requestValue, eventValue, bytesValue }
1818
1730
  * })
1731
+ *
1732
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1733
+ * const counts = [result.requestValue.count, result.eventValue.count, result.bytesValue.count] // => [6, 1, 1024n]
1819
1734
  * ```
1820
1735
  *
1821
1736
  * @category constructors
@@ -1841,12 +1756,8 @@ export declare const counter: {
1841
1756
  *
1842
1757
  * **Example** (Creating counter metrics)
1843
1758
  *
1844
- * ```ts
1845
- * import { Data, Effect, Metric } from "effect"
1846
- *
1847
- * class CounterError extends Data.TaggedError("CounterError")<{
1848
- * readonly operation: string
1849
- * }> {}
1759
+ * ```ts import.meta.vitest
1760
+ * import { Effect, Metric } from "effect"
1850
1761
  *
1851
1762
  * const program = Effect.gen(function*() {
1852
1763
  * // Create a basic counter for tracking requests
@@ -1880,6 +1791,9 @@ export declare const counter: {
1880
1791
  *
1881
1792
  * return { requestValue, eventValue, bytesValue }
1882
1793
  * })
1794
+ *
1795
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1796
+ * const counts = [result.requestValue.count, result.eventValue.count, result.bytesValue.count] // => [6, 1, 1024n]
1883
1797
  * ```
1884
1798
  *
1885
1799
  * @category constructors
@@ -1909,12 +1823,8 @@ export declare const counter: {
1909
1823
  *
1910
1824
  * **Example** (Creating gauge metrics)
1911
1825
  *
1912
- * ```ts
1913
- * import { Data, Effect, Metric } from "effect"
1914
- *
1915
- * class GaugeError extends Data.TaggedError("GaugeError")<{
1916
- * readonly operation: string
1917
- * }> {}
1826
+ * ```ts import.meta.vitest
1827
+ * import { Effect, Metric } from "effect"
1918
1828
  *
1919
1829
  * const program = Effect.gen(function*() {
1920
1830
  * // Create a gauge for tracking memory usage
@@ -1953,6 +1863,9 @@ export declare const counter: {
1953
1863
  *
1954
1864
  * return { memoryValue, cpuValue, diskValue }
1955
1865
  * })
1866
+ *
1867
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1868
+ * const values = [result.memoryValue.value, result.cpuValue.value, result.diskValue.value] // => [800, 75, 1024000000n]
1956
1869
  * ```
1957
1870
  *
1958
1871
  * @category constructors
@@ -1976,12 +1889,8 @@ export declare const gauge: {
1976
1889
  *
1977
1890
  * **Example** (Creating gauge metrics)
1978
1891
  *
1979
- * ```ts
1980
- * import { Data, Effect, Metric } from "effect"
1981
- *
1982
- * class GaugeError extends Data.TaggedError("GaugeError")<{
1983
- * readonly operation: string
1984
- * }> {}
1892
+ * ```ts import.meta.vitest
1893
+ * import { Effect, Metric } from "effect"
1985
1894
  *
1986
1895
  * const program = Effect.gen(function*() {
1987
1896
  * // Create a gauge for tracking memory usage
@@ -2020,6 +1929,9 @@ export declare const gauge: {
2020
1929
  *
2021
1930
  * return { memoryValue, cpuValue, diskValue }
2022
1931
  * })
1932
+ *
1933
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
1934
+ * const values = [result.memoryValue.value, result.cpuValue.value, result.diskValue.value] // => [800, 75, 1024000000n]
2023
1935
  * ```
2024
1936
  *
2025
1937
  * @category constructors
@@ -2047,12 +1959,8 @@ export declare const gauge: {
2047
1959
  *
2048
1960
  * **Example** (Creating gauge metrics)
2049
1961
  *
2050
- * ```ts
2051
- * import { Data, Effect, Metric } from "effect"
2052
- *
2053
- * class GaugeError extends Data.TaggedError("GaugeError")<{
2054
- * readonly operation: string
2055
- * }> {}
1962
+ * ```ts import.meta.vitest
1963
+ * import { Effect, Metric } from "effect"
2056
1964
  *
2057
1965
  * const program = Effect.gen(function*() {
2058
1966
  * // Create a gauge for tracking memory usage
@@ -2091,6 +1999,9 @@ export declare const gauge: {
2091
1999
  *
2092
2000
  * return { memoryValue, cpuValue, diskValue }
2093
2001
  * })
2002
+ *
2003
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2004
+ * const values = [result.memoryValue.value, result.cpuValue.value, result.diskValue.value] // => [800, 75, 1024000000n]
2094
2005
  * ```
2095
2006
  *
2096
2007
  * @category constructors
@@ -2119,12 +2030,8 @@ export declare const gauge: {
2119
2030
  *
2120
2031
  * **Example** (Creating frequency metrics)
2121
2032
  *
2122
- * ```ts
2123
- * import { Data, Effect, Metric } from "effect"
2124
- *
2125
- * class FrequencyError extends Data.TaggedError("FrequencyError")<{
2126
- * readonly operation: string
2127
- * }> {}
2033
+ * ```ts import.meta.vitest
2034
+ * import { Effect, Metric } from "effect"
2128
2035
  *
2129
2036
  * const program = Effect.gen(function*() {
2130
2037
  * // Create a frequency metric for HTTP status codes
@@ -2174,6 +2081,14 @@ export declare const gauge: {
2174
2081
  *
2175
2082
  * return { statusCounts, actionCounts, errorCounts }
2176
2083
  * })
2084
+ *
2085
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2086
+ * const counts = [
2087
+ * result.statusCounts.occurrences.get("200"),
2088
+ * result.actionCounts.occurrences.get("login"),
2089
+ * result.errorCounts.occurrences.get("ValidationError")
2090
+ * ]
2091
+ * counts // => [3, 2, 2]
2177
2092
  * ```
2178
2093
  *
2179
2094
  * @category constructors
@@ -2200,19 +2115,15 @@ export declare const frequency: (name: string, options?: {
2200
2115
  *
2201
2116
  * **Example** (Creating histogram metrics)
2202
2117
  *
2203
- * ```ts
2204
- * import { Data, Effect, Metric } from "effect"
2205
- *
2206
- * class HistogramError extends Data.TaggedError("HistogramError")<{
2207
- * readonly operation: string
2208
- * }> {}
2118
+ * ```ts import.meta.vitest
2119
+ * import { Effect, Metric } from "effect"
2209
2120
  *
2210
2121
  * const program = Effect.gen(function*() {
2211
2122
  * // Create a histogram for API response times
2212
2123
  * const responseTimeHistogram = Metric.histogram("api_response_time", {
2213
2124
  * description: "Distribution of API response times in milliseconds",
2214
2125
  * boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 10 })
2215
- * // Creates buckets: 0-50ms, 50-100ms, 100-150ms, ..., 400-450ms, 450ms+
2126
+ * // Creates buckets: 0-50ms, 50-100ms, 100-150ms, ..., 350-400ms, 400ms+
2216
2127
  * })
2217
2128
  *
2218
2129
  * // Create a histogram for request payload sizes
@@ -2252,6 +2163,10 @@ export declare const frequency: (name: string, options?: {
2252
2163
  *
2253
2164
  * return { responseTimeState, payloadSizeState }
2254
2165
  * })
2166
+ *
2167
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2168
+ * const values = [result.responseTimeState.count, result.responseTimeState.sum, result.payloadSizeState.count]
2169
+ * values // => [5, 500, 3]
2255
2170
  * ```
2256
2171
  *
2257
2172
  * @category constructors
@@ -2280,12 +2195,8 @@ export declare const histogram: (name: string, options: {
2280
2195
  *
2281
2196
  * **Example** (Creating summary metrics)
2282
2197
  *
2283
- * ```ts
2284
- * import { Data, Duration, Effect, Metric } from "effect"
2285
- *
2286
- * class SummaryError extends Data.TaggedError("SummaryError")<{
2287
- * readonly operation: string
2288
- * }> {}
2198
+ * ```ts import.meta.vitest
2199
+ * import { Duration, Effect, Metric } from "effect"
2289
2200
  *
2290
2201
  * const program = Effect.gen(function*() {
2291
2202
  * // Create a summary for API response times
@@ -2321,24 +2232,16 @@ export declare const histogram: (name: string, options: {
2321
2232
  * const responseStats = yield* Metric.value(responseTimeSummary)
2322
2233
  * const payloadStats = yield* Metric.value(payloadSizeSummary)
2323
2234
  *
2324
- * console.log({
2325
- * count: responseStats.count,
2326
- * min: responseStats.min,
2327
- * max: responseStats.max,
2328
- * sum: responseStats.sum
2329
- * }) // { count: 8, min: 82, max: 240, sum: 1155 }
2330
- *
2331
- * console.log({
2332
- * count: payloadStats.count,
2333
- * min: payloadStats.min,
2334
- * max: payloadStats.max,
2335
- * sum: payloadStats.sum
2336
- * }) // { count: 4, min: 1.2, max: 15.6, sum: 26 }
2337
- *
2338
2235
  * // Both summaries include quantile information for their configured windows.
2339
2236
  *
2340
2237
  * return { responseStats, payloadStats }
2341
2238
  * })
2239
+ *
2240
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2241
+ * const response = result.responseStats
2242
+ * const payload = result.payloadStats
2243
+ * const responseValues = [response.count, response.min, response.max, response.sum] // => [8, 82, 240, 1155]
2244
+ * const payloadValues = [payload.count, payload.min, payload.max, payload.sum] // => [4, 1.2, 15.6, 26]
2342
2245
  * ```
2343
2246
  *
2344
2247
  * @category constructors
@@ -2372,7 +2275,7 @@ export declare const summary: (name: string, options: {
2372
2275
  *
2373
2276
  * **Example** (Creating summaries with explicit timestamps)
2374
2277
  *
2375
- * ```ts
2278
+ * ```ts import.meta.vitest
2376
2279
  * import { Metric } from "effect"
2377
2280
  *
2378
2281
  * const responseTimesSummary = Metric.summaryWithTimestamp(
@@ -2384,6 +2287,7 @@ export declare const summary: (name: string, options: {
2384
2287
  * quantiles: [0.5, 0.9, 0.99] // Calculate 50th, 90th, and 99th quantiles.
2385
2288
  * }
2386
2289
  * )
2290
+ * const metadata = [responseTimesSummary.id, responseTimesSummary.type] // => ["response_times_summary", "Summary"]
2387
2291
  * ```
2388
2292
  *
2389
2293
  * @category constructors
@@ -2410,12 +2314,8 @@ export declare const summaryWithTimestamp: (name: string, options: {
2410
2314
  *
2411
2315
  * **Example** (Recording durations with a timer)
2412
2316
  *
2413
- * ```ts
2414
- * import { Data, Duration, Effect, Metric } from "effect"
2415
- *
2416
- * class TimerError extends Data.TaggedError("TimerError")<{
2417
- * readonly operation: string
2418
- * }> {}
2317
+ * ```ts import.meta.vitest
2318
+ * import { Duration, Effect, Metric } from "effect"
2419
2319
  *
2420
2320
  * // Create a timer metric to track API request durations
2421
2321
  * const apiRequestTimer = Metric.timer("api_request_duration", {
@@ -2429,13 +2329,17 @@ export declare const summaryWithTimestamp: (name: string, options: {
2429
2329
  * yield* Metric.update(apiRequestTimer, duration)
2430
2330
  *
2431
2331
  * const state = yield* Metric.value(apiRequestTimer)
2432
- * console.log({
2332
+ * return {
2433
2333
  * count: state.count,
2434
2334
  * min: state.min,
2435
2335
  * max: state.max,
2436
2336
  * sum: state.sum
2437
- * }) // { count: 1, min: 120, max: 120, sum: 120 }
2337
+ * }
2438
2338
  * })
2339
+ *
2340
+ * await Effect.runPromise(
2341
+ * Effect.provideService(apiOperation, Metric.MetricRegistry, new Map())
2342
+ * ) // => { count: 1, min: 120, max: 120, sum: 120 }
2439
2343
  * ```
2440
2344
  *
2441
2345
  * @category constructors
@@ -2460,10 +2364,10 @@ export declare const timer: (name: string, options?: {
2460
2364
  *
2461
2365
  * **Example** (Reading metric state)
2462
2366
  *
2463
- * ```ts
2367
+ * ```ts import.meta.vitest
2464
2368
  * import { Effect, Metric } from "effect"
2465
2369
  *
2466
- * const requestCounter = Metric.counter("requests")
2370
+ * const requestCounter = Metric.counter("modify_requests")
2467
2371
  * const responseTime = Metric.histogram("response_time", {
2468
2372
  * boundaries: [100, 500, 1000, 2000]
2469
2373
  * })
@@ -2475,16 +2379,19 @@ export declare const timer: (name: string, options?: {
2475
2379
  *
2476
2380
  * // Get current values
2477
2381
  * const counterState = yield* Metric.value(requestCounter)
2478
- * console.log(`Request count: ${counterState.count}`)
2479
- *
2480
2382
  * const histogramState = yield* Metric.value(responseTime)
2481
- * console.log(`Response time stats:`, {
2383
+ * return {
2384
+ * requestCount: counterState.count,
2482
2385
  * count: histogramState.count,
2483
2386
  * min: histogramState.min,
2484
2387
  * max: histogramState.max,
2485
2388
  * average: histogramState.sum / histogramState.count
2486
- * })
2389
+ * }
2487
2390
  * })
2391
+ *
2392
+ * await Effect.runPromise(
2393
+ * Effect.provideService(program, Metric.MetricRegistry, new Map())
2394
+ * ) // => { requestCount: 1, count: 1, min: 750, max: 750, average: 750 }
2488
2395
  * ```
2489
2396
  *
2490
2397
  * @category getters
@@ -2504,7 +2411,7 @@ export declare const value: <Input, State>(self: Metric<Input, State>) => Effect
2504
2411
  *
2505
2412
  * **Example** (Modifying metric values)
2506
2413
  *
2507
- * ```ts
2414
+ * ```ts import.meta.vitest
2508
2415
  * import { Effect, Metric } from "effect"
2509
2416
  *
2510
2417
  * const temperatureGauge = Metric.gauge("temperature")
@@ -2524,10 +2431,10 @@ export declare const value: <Input, State>(self: Metric<Input, State>) => Effect
2524
2431
  *
2525
2432
  * const temp = yield* Metric.value(temperatureGauge)
2526
2433
  * const requests = yield* Metric.value(requestCounter)
2527
- *
2528
- * console.log(`Temperature: ${temp.value}°C`) // 22°C
2529
- * console.log(`Requests: ${requests.count}`) // 15
2434
+ * return [temp.value, requests.count] as const
2530
2435
  * })
2436
+ *
2437
+ * await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [22, 15]
2531
2438
  * ```
2532
2439
  *
2533
2440
  * @category mutations
@@ -2547,7 +2454,7 @@ export declare const modify: {
2547
2454
  *
2548
2455
  * **Example** (Modifying metric values)
2549
2456
  *
2550
- * ```ts
2457
+ * ```ts import.meta.vitest
2551
2458
  * import { Effect, Metric } from "effect"
2552
2459
  *
2553
2460
  * const temperatureGauge = Metric.gauge("temperature")
@@ -2567,10 +2474,10 @@ export declare const modify: {
2567
2474
  *
2568
2475
  * const temp = yield* Metric.value(temperatureGauge)
2569
2476
  * const requests = yield* Metric.value(requestCounter)
2570
- *
2571
- * console.log(`Temperature: ${temp.value}°C`) // 22°C
2572
- * console.log(`Requests: ${requests.count}`) // 15
2477
+ * return [temp.value, requests.count] as const
2573
2478
  * })
2479
+ *
2480
+ * await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [22, 15]
2574
2481
  * ```
2575
2482
  *
2576
2483
  * @category mutations
@@ -2590,7 +2497,7 @@ export declare const modify: {
2590
2497
  *
2591
2498
  * **Example** (Modifying metric values)
2592
2499
  *
2593
- * ```ts
2500
+ * ```ts import.meta.vitest
2594
2501
  * import { Effect, Metric } from "effect"
2595
2502
  *
2596
2503
  * const temperatureGauge = Metric.gauge("temperature")
@@ -2610,10 +2517,10 @@ export declare const modify: {
2610
2517
  *
2611
2518
  * const temp = yield* Metric.value(temperatureGauge)
2612
2519
  * const requests = yield* Metric.value(requestCounter)
2613
- *
2614
- * console.log(`Temperature: ${temp.value}°C`) // 22°C
2615
- * console.log(`Requests: ${requests.count}`) // 15
2520
+ * return [temp.value, requests.count] as const
2616
2521
  * })
2522
+ *
2523
+ * await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [22, 15]
2617
2524
  * ```
2618
2525
  *
2619
2526
  * @category mutations
@@ -2634,7 +2541,7 @@ export declare const modify: {
2634
2541
  *
2635
2542
  * **Example** (Updating metric values)
2636
2543
  *
2637
- * ```ts
2544
+ * ```ts import.meta.vitest
2638
2545
  * import { Effect, Metric } from "effect"
2639
2546
  *
2640
2547
  * const cpuUsage = Metric.gauge("cpu_usage_percent")
@@ -2662,11 +2569,10 @@ export declare const modify: {
2662
2569
  * const cpu = yield* Metric.value(cpuUsage)
2663
2570
  * const statuses = yield* Metric.value(httpStatus)
2664
2571
  * const times = yield* Metric.value(responseTime)
2665
- *
2666
- * console.log(`CPU Usage: ${cpu.value}%`)
2667
- * console.log(`Status 200 count: ${statuses.occurrences.get("200")}`) // 2
2668
- * console.log(`Response time samples: ${times.count}`) // 3
2572
+ * return [cpu.value, statuses.occurrences.get("200"), times.count] as const
2669
2573
  * })
2574
+ *
2575
+ * await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [67.8, 2, 3]
2670
2576
  * ```
2671
2577
  *
2672
2578
  * @category mutations
@@ -2686,7 +2592,7 @@ export declare const update: {
2686
2592
  *
2687
2593
  * **Example** (Updating metric values)
2688
2594
  *
2689
- * ```ts
2595
+ * ```ts import.meta.vitest
2690
2596
  * import { Effect, Metric } from "effect"
2691
2597
  *
2692
2598
  * const cpuUsage = Metric.gauge("cpu_usage_percent")
@@ -2714,11 +2620,10 @@ export declare const update: {
2714
2620
  * const cpu = yield* Metric.value(cpuUsage)
2715
2621
  * const statuses = yield* Metric.value(httpStatus)
2716
2622
  * const times = yield* Metric.value(responseTime)
2717
- *
2718
- * console.log(`CPU Usage: ${cpu.value}%`)
2719
- * console.log(`Status 200 count: ${statuses.occurrences.get("200")}`) // 2
2720
- * console.log(`Response time samples: ${times.count}`) // 3
2623
+ * return [cpu.value, statuses.occurrences.get("200"), times.count] as const
2721
2624
  * })
2625
+ *
2626
+ * await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [67.8, 2, 3]
2722
2627
  * ```
2723
2628
  *
2724
2629
  * @category mutations
@@ -2738,7 +2643,7 @@ export declare const update: {
2738
2643
  *
2739
2644
  * **Example** (Updating metric values)
2740
2645
  *
2741
- * ```ts
2646
+ * ```ts import.meta.vitest
2742
2647
  * import { Effect, Metric } from "effect"
2743
2648
  *
2744
2649
  * const cpuUsage = Metric.gauge("cpu_usage_percent")
@@ -2766,11 +2671,10 @@ export declare const update: {
2766
2671
  * const cpu = yield* Metric.value(cpuUsage)
2767
2672
  * const statuses = yield* Metric.value(httpStatus)
2768
2673
  * const times = yield* Metric.value(responseTime)
2769
- *
2770
- * console.log(`CPU Usage: ${cpu.value}%`)
2771
- * console.log(`Status 200 count: ${statuses.occurrences.get("200")}`) // 2
2772
- * console.log(`Response time samples: ${times.count}`) // 3
2674
+ * return [cpu.value, statuses.occurrences.get("200"), times.count] as const
2773
2675
  * })
2676
+ *
2677
+ * await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [67.8, 2, 3]
2774
2678
  * ```
2775
2679
  *
2776
2680
  * @category mutations
@@ -2785,36 +2689,30 @@ export declare const update: {
2785
2689
  *
2786
2690
  * **Example** (Mapping metric inputs)
2787
2691
  *
2788
- * ```ts
2789
- * import { Data, Effect, Metric } from "effect"
2790
- *
2791
- * class MetricError extends Data.TaggedError("MetricError")<{
2792
- * readonly operation: string
2793
- * }> {}
2692
+ * ```ts import.meta.vitest
2693
+ * import { Effect, Metric } from "effect"
2794
2694
  *
2795
- * // Create a histogram that expects Duration values
2796
2695
  * const durationHistogram = Metric.histogram("request_duration_ms", {
2797
2696
  * description: "Request duration in milliseconds",
2798
2697
  * boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 })
2799
2698
  * })
2800
2699
  *
2801
- * // Transform to accept number values representing milliseconds
2802
- * const numberHistogram = Metric.mapInput(
2700
+ * // Accept duration strings while recording numeric milliseconds
2701
+ * const durationStringHistogram = Metric.mapInput(
2803
2702
  * durationHistogram,
2804
- * (ms: number) => ms // Direct mapping from number to expected input
2703
+ * (input: string) => Number(input)
2805
2704
  * )
2806
2705
  *
2807
2706
  * const program = Effect.gen(function*() {
2808
- * // Now we can update with a plain number
2809
- * yield* Metric.update(numberHistogram, 250)
2810
- *
2811
- * // Get metric value to see the recorded state
2812
- * const value = yield* Metric.value(numberHistogram)
2813
- * return value
2707
+ * yield* Metric.update(durationStringHistogram, "250")
2708
+ * return yield* Metric.value(durationStringHistogram)
2814
2709
  * })
2710
+ *
2711
+ * const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2712
+ * const values = [value.count, value.sum] // => [1, 250]
2815
2713
  * ```
2816
2714
  *
2817
- * @category mapping
2715
+ * @category annotations
2818
2716
  * @since 2.0.0
2819
2717
  */
2820
2718
  export declare const mapInput: {
@@ -2825,36 +2723,30 @@ export declare const mapInput: {
2825
2723
  *
2826
2724
  * **Example** (Mapping metric inputs)
2827
2725
  *
2828
- * ```ts
2829
- * import { Data, Effect, Metric } from "effect"
2830
- *
2831
- * class MetricError extends Data.TaggedError("MetricError")<{
2832
- * readonly operation: string
2833
- * }> {}
2726
+ * ```ts import.meta.vitest
2727
+ * import { Effect, Metric } from "effect"
2834
2728
  *
2835
- * // Create a histogram that expects Duration values
2836
2729
  * const durationHistogram = Metric.histogram("request_duration_ms", {
2837
2730
  * description: "Request duration in milliseconds",
2838
2731
  * boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 })
2839
2732
  * })
2840
2733
  *
2841
- * // Transform to accept number values representing milliseconds
2842
- * const numberHistogram = Metric.mapInput(
2734
+ * // Accept duration strings while recording numeric milliseconds
2735
+ * const durationStringHistogram = Metric.mapInput(
2843
2736
  * durationHistogram,
2844
- * (ms: number) => ms // Direct mapping from number to expected input
2737
+ * (input: string) => Number(input)
2845
2738
  * )
2846
2739
  *
2847
2740
  * const program = Effect.gen(function*() {
2848
- * // Now we can update with a plain number
2849
- * yield* Metric.update(numberHistogram, 250)
2850
- *
2851
- * // Get metric value to see the recorded state
2852
- * const value = yield* Metric.value(numberHistogram)
2853
- * return value
2741
+ * yield* Metric.update(durationStringHistogram, "250")
2742
+ * return yield* Metric.value(durationStringHistogram)
2854
2743
  * })
2744
+ *
2745
+ * const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2746
+ * const values = [value.count, value.sum] // => [1, 250]
2855
2747
  * ```
2856
2748
  *
2857
- * @category mapping
2749
+ * @category annotations
2858
2750
  * @since 2.0.0
2859
2751
  */
2860
2752
  <Input, Input2 extends Input>(f: (input: Input2, context: Context.Context<never>) => Input): <State>(self: Metric<Input, State>) => Metric<Input2, State>;
@@ -2865,36 +2757,30 @@ export declare const mapInput: {
2865
2757
  *
2866
2758
  * **Example** (Mapping metric inputs)
2867
2759
  *
2868
- * ```ts
2869
- * import { Data, Effect, Metric } from "effect"
2870
- *
2871
- * class MetricError extends Data.TaggedError("MetricError")<{
2872
- * readonly operation: string
2873
- * }> {}
2760
+ * ```ts import.meta.vitest
2761
+ * import { Effect, Metric } from "effect"
2874
2762
  *
2875
- * // Create a histogram that expects Duration values
2876
2763
  * const durationHistogram = Metric.histogram("request_duration_ms", {
2877
2764
  * description: "Request duration in milliseconds",
2878
2765
  * boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 })
2879
2766
  * })
2880
2767
  *
2881
- * // Transform to accept number values representing milliseconds
2882
- * const numberHistogram = Metric.mapInput(
2768
+ * // Accept duration strings while recording numeric milliseconds
2769
+ * const durationStringHistogram = Metric.mapInput(
2883
2770
  * durationHistogram,
2884
- * (ms: number) => ms // Direct mapping from number to expected input
2771
+ * (input: string) => Number(input)
2885
2772
  * )
2886
2773
  *
2887
2774
  * const program = Effect.gen(function*() {
2888
- * // Now we can update with a plain number
2889
- * yield* Metric.update(numberHistogram, 250)
2890
- *
2891
- * // Get metric value to see the recorded state
2892
- * const value = yield* Metric.value(numberHistogram)
2893
- * return value
2775
+ * yield* Metric.update(durationStringHistogram, "250")
2776
+ * return yield* Metric.value(durationStringHistogram)
2894
2777
  * })
2778
+ *
2779
+ * const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2780
+ * const values = [value.count, value.sum] // => [1, 250]
2895
2781
  * ```
2896
2782
  *
2897
- * @category mapping
2783
+ * @category annotations
2898
2784
  * @since 2.0.0
2899
2785
  */
2900
2786
  <Input, State, Input2>(self: Metric<Input, State>, f: (input: Input2, context: Context.Context<never>) => Input): Metric<Input2, State>;
@@ -2906,12 +2792,8 @@ export declare const mapInput: {
2906
2792
  *
2907
2793
  * **Example** (Ignoring inputs with a constant value)
2908
2794
  *
2909
- * ```ts
2910
- * import { Data, Effect, Metric } from "effect"
2911
- *
2912
- * class MetricError extends Data.TaggedError("MetricError")<{
2913
- * readonly operation: string
2914
- * }> {}
2795
+ * ```ts import.meta.vitest
2796
+ * import { Effect, Metric } from "effect"
2915
2797
  *
2916
2798
  * // Create a counter that normally expects a number increment
2917
2799
  * const requestCounter = Metric.counter("total_requests", {
@@ -2930,9 +2812,12 @@ export declare const mapInput: {
2930
2812
  * const value = yield* Metric.value(simpleRequestCounter)
2931
2813
  * return value // Counter state will show count: 3
2932
2814
  * })
2815
+ *
2816
+ * const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2817
+ * const count = value.count // => 3
2933
2818
  * ```
2934
2819
  *
2935
- * @category Input
2820
+ * @category mapping
2936
2821
  * @since 2.0.0
2937
2822
  */
2938
2823
  export declare const withConstantInput: {
@@ -2943,12 +2828,8 @@ export declare const withConstantInput: {
2943
2828
  *
2944
2829
  * **Example** (Ignoring inputs with a constant value)
2945
2830
  *
2946
- * ```ts
2947
- * import { Data, Effect, Metric } from "effect"
2948
- *
2949
- * class MetricError extends Data.TaggedError("MetricError")<{
2950
- * readonly operation: string
2951
- * }> {}
2831
+ * ```ts import.meta.vitest
2832
+ * import { Effect, Metric } from "effect"
2952
2833
  *
2953
2834
  * // Create a counter that normally expects a number increment
2954
2835
  * const requestCounter = Metric.counter("total_requests", {
@@ -2967,9 +2848,12 @@ export declare const withConstantInput: {
2967
2848
  * const value = yield* Metric.value(simpleRequestCounter)
2968
2849
  * return value // Counter state will show count: 3
2969
2850
  * })
2851
+ *
2852
+ * const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2853
+ * const count = value.count // => 3
2970
2854
  * ```
2971
2855
  *
2972
- * @category Input
2856
+ * @category mapping
2973
2857
  * @since 2.0.0
2974
2858
  */
2975
2859
  <Input>(input: Input): <State>(self: Metric<Input, State>) => Metric<unknown, State>;
@@ -2980,12 +2864,8 @@ export declare const withConstantInput: {
2980
2864
  *
2981
2865
  * **Example** (Ignoring inputs with a constant value)
2982
2866
  *
2983
- * ```ts
2984
- * import { Data, Effect, Metric } from "effect"
2985
- *
2986
- * class MetricError extends Data.TaggedError("MetricError")<{
2987
- * readonly operation: string
2988
- * }> {}
2867
+ * ```ts import.meta.vitest
2868
+ * import { Effect, Metric } from "effect"
2989
2869
  *
2990
2870
  * // Create a counter that normally expects a number increment
2991
2871
  * const requestCounter = Metric.counter("total_requests", {
@@ -3004,9 +2884,12 @@ export declare const withConstantInput: {
3004
2884
  * const value = yield* Metric.value(simpleRequestCounter)
3005
2885
  * return value // Counter state will show count: 3
3006
2886
  * })
2887
+ *
2888
+ * const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
2889
+ * const count = value.count // => 3
3007
2890
  * ```
3008
2891
  *
3009
- * @category Input
2892
+ * @category mapping
3010
2893
  * @since 2.0.0
3011
2894
  */
3012
2895
  <Input, State>(self: Metric<Input, State>, input: Input): Metric<unknown, State>;
@@ -3022,7 +2905,7 @@ export declare const withConstantInput: {
3022
2905
  *
3023
2906
  * **Example** (Applying metric attributes)
3024
2907
  *
3025
- * ```ts
2908
+ * ```ts import.meta.vitest
3026
2909
  * import { Effect, Metric } from "effect"
3027
2910
  *
3028
2911
  * const requestCounter = Metric.counter("http_requests_total", {
@@ -3055,18 +2938,17 @@ export declare const withConstantInput: {
3055
2938
  * yield* Metric.update(taggedMetric, 1) // http_requests_total{service="user-api", version="v1"}
3056
2939
  * })
3057
2940
  *
3058
- * // When taking snapshots, each attribute combination appears as a separate metric
3059
- * const viewMetrics = Effect.gen(function*() {
3060
- * const snapshots = yield* Metric.snapshot
3061
- * for (const metric of snapshots) {
3062
- * if (metric.id === "http_requests_total") {
3063
- * console.log(`${metric.id}`, metric.attributes, metric.state)
3064
- * }
3065
- * }
2941
+ * const result = Effect.gen(function*() {
2942
+ * yield* program
2943
+ * const get = yield* Metric.value(getRequests)
2944
+ * const post = yield* Metric.value(postRequests)
2945
+ * return [get.count, post.count] as const
3066
2946
  * })
2947
+ *
2948
+ * await Effect.runPromise(Effect.provideService(result, Metric.MetricRegistry, new Map())) // => [2, 1]
3067
2949
  * ```
3068
2950
  *
3069
- * @category Attributes
2951
+ * @category mapping
3070
2952
  * @since 4.0.0
3071
2953
  */
3072
2954
  export declare const withAttributes: {
@@ -3081,7 +2963,7 @@ export declare const withAttributes: {
3081
2963
  *
3082
2964
  * **Example** (Applying metric attributes)
3083
2965
  *
3084
- * ```ts
2966
+ * ```ts import.meta.vitest
3085
2967
  * import { Effect, Metric } from "effect"
3086
2968
  *
3087
2969
  * const requestCounter = Metric.counter("http_requests_total", {
@@ -3114,18 +2996,17 @@ export declare const withAttributes: {
3114
2996
  * yield* Metric.update(taggedMetric, 1) // http_requests_total{service="user-api", version="v1"}
3115
2997
  * })
3116
2998
  *
3117
- * // When taking snapshots, each attribute combination appears as a separate metric
3118
- * const viewMetrics = Effect.gen(function*() {
3119
- * const snapshots = yield* Metric.snapshot
3120
- * for (const metric of snapshots) {
3121
- * if (metric.id === "http_requests_total") {
3122
- * console.log(`${metric.id}`, metric.attributes, metric.state)
3123
- * }
3124
- * }
2999
+ * const result = Effect.gen(function*() {
3000
+ * yield* program
3001
+ * const get = yield* Metric.value(getRequests)
3002
+ * const post = yield* Metric.value(postRequests)
3003
+ * return [get.count, post.count] as const
3125
3004
  * })
3005
+ *
3006
+ * await Effect.runPromise(Effect.provideService(result, Metric.MetricRegistry, new Map())) // => [2, 1]
3126
3007
  * ```
3127
3008
  *
3128
- * @category Attributes
3009
+ * @category mapping
3129
3010
  * @since 4.0.0
3130
3011
  */
3131
3012
  (attributes: Metric.Attributes): <Input, State>(self: Metric<Input, State>) => Metric<Input, State>;
@@ -3140,7 +3021,7 @@ export declare const withAttributes: {
3140
3021
  *
3141
3022
  * **Example** (Applying metric attributes)
3142
3023
  *
3143
- * ```ts
3024
+ * ```ts import.meta.vitest
3144
3025
  * import { Effect, Metric } from "effect"
3145
3026
  *
3146
3027
  * const requestCounter = Metric.counter("http_requests_total", {
@@ -3173,18 +3054,17 @@ export declare const withAttributes: {
3173
3054
  * yield* Metric.update(taggedMetric, 1) // http_requests_total{service="user-api", version="v1"}
3174
3055
  * })
3175
3056
  *
3176
- * // When taking snapshots, each attribute combination appears as a separate metric
3177
- * const viewMetrics = Effect.gen(function*() {
3178
- * const snapshots = yield* Metric.snapshot
3179
- * for (const metric of snapshots) {
3180
- * if (metric.id === "http_requests_total") {
3181
- * console.log(`${metric.id}`, metric.attributes, metric.state)
3182
- * }
3183
- * }
3057
+ * const result = Effect.gen(function*() {
3058
+ * yield* program
3059
+ * const get = yield* Metric.value(getRequests)
3060
+ * const post = yield* Metric.value(postRequests)
3061
+ * return [get.count, post.count] as const
3184
3062
  * })
3063
+ *
3064
+ * await Effect.runPromise(Effect.provideService(result, Metric.MetricRegistry, new Map())) // => [2, 1]
3185
3065
  * ```
3186
3066
  *
3187
- * @category Attributes
3067
+ * @category mapping
3188
3068
  * @since 4.0.0
3189
3069
  */
3190
3070
  <Input, State>(self: Metric<Input, State>, attributes: Metric.Attributes): Metric<Input, State>;
@@ -3199,12 +3079,8 @@ export declare const withAttributes: {
3199
3079
  *
3200
3080
  * **Example** (Capturing metric snapshots)
3201
3081
  *
3202
- * ```ts
3203
- * import { Console, Data, Effect, Metric } from "effect"
3204
- *
3205
- * class SnapshotError extends Data.TaggedError("SnapshotError")<{
3206
- * readonly operation: string
3207
- * }> {}
3082
+ * ```ts import.meta.vitest
3083
+ * import { Effect, Metric } from "effect"
3208
3084
  *
3209
3085
  * const program = Effect.gen(function*() {
3210
3086
  * // Create and update some metrics
@@ -3225,19 +3101,16 @@ export declare const withAttributes: {
3225
3101
  * // Take a snapshot of all metrics
3226
3102
  * const snapshots = yield* Metric.snapshot
3227
3103
  *
3228
- * // Examine the snapshots
3229
- * for (const snapshot of snapshots) {
3230
- * yield* Console.log(`Metric: ${snapshot.id}`)
3231
- * yield* Console.log(`Description: ${snapshot.description}`)
3232
- * yield* Console.log(`Type: ${snapshot.type}`)
3233
- * yield* Console.log(`State:`, snapshot.state)
3234
- * }
3235
- *
3236
3104
  * return snapshots
3237
3105
  * })
3106
+ *
3107
+ * const snapshots = await Effect.runPromise(
3108
+ * Effect.provideService(program, Metric.MetricRegistry, new Map())
3109
+ * )
3110
+ * const ids = snapshots.map((snapshot) => snapshot.id).sort() // => ["http_requests", "response_time_ms"]
3238
3111
  * ```
3239
3112
  *
3240
- * @category Snapshotting
3113
+ * @category snapshotting
3241
3114
  * @since 2.0.0
3242
3115
  */
3243
3116
  export declare const snapshot: Effect<ReadonlyArray<Metric.Snapshot>>;
@@ -3253,12 +3126,8 @@ export declare const snapshot: Effect<ReadonlyArray<Metric.Snapshot>>;
3253
3126
  *
3254
3127
  * **Example** (Dumping metrics as text)
3255
3128
  *
3256
- * ```ts
3257
- * import { Console, Data, Effect, Metric } from "effect"
3258
- *
3259
- * class DumpError extends Data.TaggedError("DumpError")<{
3260
- * readonly operation: string
3261
- * }> {}
3129
+ * ```ts import.meta.vitest
3130
+ * import { Effect, Metric } from "effect"
3262
3131
  *
3263
3132
  * const program = Effect.gen(function*() {
3264
3133
  * // Create and update some metrics for demonstration
@@ -3282,20 +3151,21 @@ export declare const snapshot: Effect<ReadonlyArray<Metric.Snapshot>>;
3282
3151
  *
3283
3152
  * // Get formatted dump of all metrics
3284
3153
  * const metricsReport = yield* Metric.dump
3285
- * yield* Console.log("Current Metrics:")
3286
- * yield* Console.log(metricsReport)
3287
- *
3288
- * // Output will look like a formatted table:
3289
- * // Name Description Type State
3290
- * // http_requests_total Total HTTP requests Counter [count: 2]
3291
- * // response_time_ms Current response time in milliseconds Gauge [value: 125]
3292
- * // http_status_codes Frequency of HTTP status codes Frequency [occurrences: 200 -> 2, 404 -> 1]
3293
- *
3294
3154
  * return metricsReport
3295
3155
  * })
3156
+ *
3157
+ * const report = await Effect.runPromise(
3158
+ * Effect.provideService(program, Metric.MetricRegistry, new Map())
3159
+ * )
3160
+ * const included = [
3161
+ * report.includes("http_requests_total"),
3162
+ * report.includes("response_time_ms"),
3163
+ * report.includes("http_status_codes")
3164
+ * ]
3165
+ * included // => [true, true, true]
3296
3166
  * ```
3297
3167
  *
3298
- * @category Debugging
3168
+ * @category formatting
3299
3169
  * @since 4.0.0
3300
3170
  */
3301
3171
  export declare const dump: Effect<string>;
@@ -3316,56 +3186,20 @@ export declare const dump: Effect<string>;
3316
3186
  *
3317
3187
  * **Example** (Capturing snapshots from a context)
3318
3188
  *
3319
- * ```ts
3320
- * import { Data, Effect, Metric } from "effect"
3321
- *
3322
- * class UnsafeSnapshotError extends Data.TaggedError("UnsafeSnapshotError")<{
3323
- * readonly operation: string
3324
- * }> {}
3325
- *
3326
- * // Use unsafeSnapshot in performance-critical scenarios or internal implementations
3327
- * const performanceMetricsExporter = Effect.gen(function*() {
3328
- * // Create some metrics first
3329
- * const requestCounter = Metric.counter("http_requests", {
3330
- * description: "Total HTTP requests"
3331
- * })
3332
- * const responseTime = Metric.gauge("response_time_ms", {
3333
- * description: "Current response time"
3334
- * })
3189
+ * ```ts import.meta.vitest
3190
+ * import { Effect, Metric } from "effect"
3335
3191
  *
3336
- * // Update metrics
3192
+ * const requestCounter = Metric.counter("http_requests")
3193
+ * const program = Effect.gen(function*() {
3337
3194
  * yield* Metric.update(requestCounter, 1)
3338
- * yield* Metric.update(responseTime, 150)
3339
- *
3340
- * // Get services context for unsafe operations
3341
- * const services = yield* Effect.context()
3342
- *
3343
- * // Use snapshotUnsafe for direct, synchronous access
3344
- * const snapshots = Metric.snapshotUnsafe(services)
3345
- * const exportBatchCreatedAt = 1_700_000_000_000
3346
- *
3347
- * // Process snapshots immediately (useful for exporters, debugging tools)
3348
- * const exportData = snapshots.map((snapshot) => ({
3349
- * name: snapshot.id,
3350
- * type: snapshot.type,
3351
- * value: snapshot.state,
3352
- * timestamp: exportBatchCreatedAt
3353
- * }))
3354
- *
3355
- * // This is synchronous and doesn't involve Effect overhead
3356
- * // Useful for performance-critical metric export operations
3357
- * return exportData
3195
+ * const context = yield* Effect.context()
3196
+ * return Metric.snapshotUnsafe(context).map((snapshot) => snapshot.id)
3358
3197
  * })
3359
3198
  *
3360
- * // For normal application use, prefer the safe snapshot function:
3361
- * const safeSnapshotExample = Effect.gen(function*() {
3362
- * // This automatically handles the services context
3363
- * const snapshots = yield* Metric.snapshot
3364
- * return snapshots
3365
- * })
3199
+ * await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => ["http_requests"]
3366
3200
  * ```
3367
3201
  *
3368
- * @category Snapshotting
3202
+ * @category snapshotting
3369
3203
  * @since 4.0.0
3370
3204
  */
3371
3205
  export declare const snapshotUnsafe: (context: Context.Context<never>) => ReadonlyArray<Metric.Snapshot>;
@@ -3380,60 +3214,13 @@ export declare const snapshotUnsafe: (context: Context.Context<never>) => Readon
3380
3214
  *
3381
3215
  * **Example** (Creating boundaries from values)
3382
3216
  *
3383
- * ```ts
3384
- * import { Data, Effect, Metric } from "effect"
3385
- *
3386
- * class BoundaryError extends Data.TaggedError("BoundaryError")<{
3387
- * readonly operation: string
3388
- * }> {}
3389
- *
3390
- * // Create boundaries from an array of custom values
3391
- * const customBoundaries = Metric.boundariesFromIterable([
3392
- * 10,
3393
- * 25,
3394
- * 50,
3395
- * 100,
3396
- * 250,
3397
- * 500,
3398
- * 1000
3399
- * ])
3400
- * console.log(customBoundaries) // [10, 25, 50, 100, 250, 500, 1000, Infinity]
3401
- *
3402
- * // Automatically removes duplicates and negative values
3403
- * const messyBoundaries = Metric.boundariesFromIterable([
3404
- * -5,
3405
- * 0,
3406
- * 10,
3407
- * 10,
3408
- * 25,
3409
- * 25,
3410
- * 50,
3411
- * -1
3412
- * ])
3413
- * console.log(messyBoundaries) // [10, 25, 50, Infinity]
3414
- *
3415
- * // Works with any iterable (Set, generator functions, etc.)
3416
- * const setBoundaries = Metric.boundariesFromIterable(
3417
- * new Set([100, 200, 300, 200, 100])
3418
- * )
3419
- * console.log(setBoundaries) // [100, 200, 300, Infinity]
3420
- *
3421
- * // Use with histogram metric
3422
- * const responseTimeHistogram = Metric.histogram("response_times", {
3423
- * description: "API response time distribution",
3424
- * boundaries: customBoundaries
3425
- * })
3426
- *
3427
- * const program = Effect.gen(function*() {
3428
- * yield* Metric.update(responseTimeHistogram, 75) // Goes in 50-100ms bucket
3429
- * yield* Metric.update(responseTimeHistogram, 150) // Goes in 100-250ms bucket
3217
+ * ```ts import.meta.vitest
3218
+ * import { Metric } from "effect"
3430
3219
  *
3431
- * const value = yield* Metric.value(responseTimeHistogram)
3432
- * return value
3433
- * })
3220
+ * Metric.boundariesFromIterable([-5, 0, 10, 10, 25, 50]) // => [10, 25, 50, Infinity]
3434
3221
  * ```
3435
3222
  *
3436
- * @category boundaries
3223
+ * @category constructors
3437
3224
  * @since 4.0.0
3438
3225
  */
3439
3226
  export declare const boundariesFromIterable: (iterable: Iterable<number>) => ReadonlyArray<number>;
@@ -3443,46 +3230,20 @@ export declare const boundariesFromIterable: (iterable: Iterable<number>) => Rea
3443
3230
  *
3444
3231
  * **Details**
3445
3232
  *
3446
- * Generates `count - 1` finite boundaries using `start + width + index` for
3233
+ * Generates `count - 1` candidate boundaries using `start + index * width` for
3447
3234
  * each zero-based index, then applies the same normalization as
3448
3235
  * `boundariesFromIterable`: non-positive values are removed, duplicates are
3449
3236
  * collapsed, and `Infinity` is appended.
3450
3237
  *
3451
3238
  * **Example** (Creating linear boundaries)
3452
3239
  *
3453
- * ```ts
3454
- * import { Data, Effect, Metric } from "effect"
3455
- *
3456
- * class BoundaryError extends Data.TaggedError("BoundaryError")<{
3457
- * readonly operation: string
3458
- * }> {}
3459
- *
3460
- * // Create boundaries for response time histogram
3461
- * const responseBoundaries = Metric.linearBoundaries({
3462
- * start: 0, // Starting point
3463
- * width: 100, // Offset used for the first boundary
3464
- * count: 5 // Creates 4 boundaries + infinity
3465
- * })
3466
- * console.log(responseBoundaries) // [100, 101, 102, 103, Infinity]
3467
- *
3468
- * // Create a histogram using these boundaries
3469
- * const responseTimeHistogram = Metric.histogram("api_response_time", {
3470
- * description: "API response time distribution",
3471
- * boundaries: responseBoundaries
3472
- * })
3473
- *
3474
- * const program = Effect.gen(function*() {
3475
- * // Record some response times
3476
- * yield* Metric.update(responseTimeHistogram, 85)
3477
- * yield* Metric.update(responseTimeHistogram, 101)
3478
- * yield* Metric.update(responseTimeHistogram, 450)
3240
+ * ```ts import.meta.vitest
3241
+ * import { Metric } from "effect"
3479
3242
  *
3480
- * const value = yield* Metric.value(responseTimeHistogram)
3481
- * return value
3482
- * })
3243
+ * Metric.linearBoundaries({ start: 10, width: 20, count: 5 }) // => [10, 30, 50, 70, Infinity]
3483
3244
  * ```
3484
3245
  *
3485
- * @category boundaries
3246
+ * @category constructors
3486
3247
  * @since 4.0.0
3487
3248
  */
3488
3249
  export declare const linearBoundaries: (options: {
@@ -3500,47 +3261,13 @@ export declare const linearBoundaries: (options: {
3500
3261
  *
3501
3262
  * **Example** (Creating exponential boundaries)
3502
3263
  *
3503
- * ```ts
3504
- * import { Data, Effect, Metric } from "effect"
3505
- *
3506
- * class BoundaryError extends Data.TaggedError("BoundaryError")<{
3507
- * readonly operation: string
3508
- * }> {}
3509
- *
3510
- * // Create exponential boundaries for request size histogram
3511
- * // Buckets: 0-1KB, 1-2KB, 2-4KB, 4-8KB, 8KB+
3512
- * const sizeBoundaries = Metric.exponentialBoundaries({
3513
- * start: 1, // Starting at 1KB
3514
- * factor: 2, // Each boundary doubles the previous
3515
- * count: 5 // Creates 4 boundaries + infinity
3516
- * })
3517
- * console.log(sizeBoundaries) // [1, 2, 4, 8, Infinity]
3518
- *
3519
- * // Create a histogram for tracking request payload sizes
3520
- * const requestSizeHistogram = Metric.histogram("request_size_kb", {
3521
- * description: "Request payload size distribution in KB",
3522
- * boundaries: sizeBoundaries
3523
- * })
3524
- *
3525
- * // For very wide ranges, use larger factors
3526
- * const latencyBoundaries = Metric.exponentialBoundaries({
3527
- * start: 0.1, // Start at 0.1ms
3528
- * factor: 10, // Each boundary is 10x larger
3529
- * count: 6 // Creates ranges: 0.1ms, 1ms, 10ms, 100ms, 1000ms+
3530
- * })
3531
- *
3532
- * const program = Effect.gen(function*() {
3533
- * // Record different request sizes
3534
- * yield* Metric.update(requestSizeHistogram, 1.5) // Goes in 1-2KB bucket
3535
- * yield* Metric.update(requestSizeHistogram, 3.2) // Goes in 2-4KB bucket
3536
- * yield* Metric.update(requestSizeHistogram, 12) // Goes in 8KB+ bucket
3264
+ * ```ts import.meta.vitest
3265
+ * import { Metric } from "effect"
3537
3266
  *
3538
- * const value = yield* Metric.value(requestSizeHistogram)
3539
- * return value
3540
- * })
3267
+ * Metric.exponentialBoundaries({ start: 1, factor: 2, count: 5 }) // => [1, 2, 4, 8, Infinity]
3541
3268
  * ```
3542
3269
  *
3543
- * @category boundaries
3270
+ * @category constructors
3544
3271
  * @since 4.0.0
3545
3272
  */
3546
3273
  export declare const exponentialBoundaries: (options: {
@@ -3553,36 +3280,13 @@ export declare const exponentialBoundaries: (options: {
3553
3280
  *
3554
3281
  * **Example** (Accessing the fiber runtime metrics key)
3555
3282
  *
3556
- * ```ts
3557
- * import { Data, Effect, Layer, Metric } from "effect"
3558
- *
3559
- * class MetricsError extends Data.TaggedError("MetricsError")<{
3560
- * readonly operation: string
3561
- * }> {}
3562
- *
3563
- * const program = Effect.gen(function*() {
3564
- * // The key is used internally by the Effect runtime to manage fiber metrics
3565
- * const key = Metric.FiberRuntimeMetricsKey
3566
- * console.log("Fiber metrics key:", key)
3567
- *
3568
- * // Enable runtime metrics using the key
3569
- * const layer = Layer.succeed(Metric.FiberRuntimeMetrics)(
3570
- * Metric.FiberRuntimeMetricsImpl
3571
- * )
3572
- *
3573
- * return yield* Effect.gen(function*() {
3574
- * // This Effect will have fiber metrics automatically collected
3575
- * yield* Effect.sleep("100 millis")
3283
+ * ```ts import.meta.vitest
3284
+ * import { Metric } from "effect"
3576
3285
  *
3577
- * // Create a test counter to demonstrate the key usage
3578
- * const testCounter = Metric.counter("test_counter")
3579
- * yield* Metric.update(testCounter, 1)
3580
- * return yield* Metric.value(testCounter)
3581
- * }).pipe(Effect.provide(layer))
3582
- * })
3286
+ * Metric.FiberRuntimeMetricsKey // => "effect/observability/Metric/FiberRuntimeMetricsKey"
3583
3287
  * ```
3584
3288
  *
3585
- * @category metrics
3289
+ * @category constants
3586
3290
  * @since 4.0.0
3587
3291
  */
3588
3292
  export declare const FiberRuntimeMetricsKey: "effect/observability/Metric/FiberRuntimeMetricsKey";
@@ -3591,38 +3295,25 @@ export declare const FiberRuntimeMetricsKey: "effect/observability/Metric/FiberR
3591
3295
  *
3592
3296
  * **Example** (Providing a custom fiber metrics service)
3593
3297
  *
3594
- * ```ts
3595
- * import { Data, Effect, Layer, Metric } from "effect"
3596
- * import type { Context, Exit } from "effect"
3298
+ * ```ts import.meta.vitest
3299
+ * import { Context, Exit, Metric } from "effect"
3597
3300
  *
3598
- * class MetricsError extends Data.TaggedError("MetricsError")<{
3599
- * readonly operation: string
3600
- * }> {}
3601
- *
3602
- * // Custom implementation of the metrics service
3301
+ * const events: Array<string> = []
3603
3302
  * const customMetricsService: Metric.FiberRuntimeMetricsService = {
3604
- * recordFiberStart: (context: Context.Context<never>) => {
3605
- * console.log("Fiber started")
3606
- * // Custom logic for tracking fiber starts
3303
+ * recordFiberStart: () => {
3304
+ * events.push("start")
3607
3305
  * },
3608
- * recordFiberEnd: (
3609
- * context: Context.Context<never>,
3610
- * exit: Exit.Exit<unknown, unknown>
3611
- * ) => {
3612
- * console.log("Fiber completed with exit:", exit)
3613
- * // Custom logic for tracking fiber completion based on exit status
3306
+ * recordFiberEnd: (_context, exit) => {
3307
+ * events.push(Exit.isSuccess(exit) ? "success" : "failure")
3614
3308
  * }
3615
3309
  * }
3616
3310
  *
3617
- * const program = Effect.gen(function*() {
3618
- * // Use the custom metrics service
3619
- * const layer = Layer.succeed(Metric.FiberRuntimeMetrics)(customMetricsService)
3620
- *
3621
- * return yield* Effect.sleep("100 millis").pipe(Effect.provide(layer))
3622
- * })
3311
+ * customMetricsService.recordFiberStart(Context.empty())
3312
+ * customMetricsService.recordFiberEnd(Context.empty(), Exit.succeed("ok"))
3313
+ * events // => ["start", "success"]
3623
3314
  * ```
3624
3315
  *
3625
- * @category metrics
3316
+ * @category services
3626
3317
  * @since 4.0.0
3627
3318
  */
3628
3319
  export interface FiberRuntimeMetricsService {
@@ -3646,45 +3337,21 @@ export interface FiberRuntimeMetricsService {
3646
3337
  *
3647
3338
  * **Example** (Accessing the fiber runtime metrics service)
3648
3339
  *
3649
- * ```ts
3650
- * import { Data, Effect, Metric } from "effect"
3651
- *
3652
- * class MetricsError extends Data.TaggedError("MetricsError")<{
3653
- * readonly operation: string
3654
- * }> {}
3340
+ * ```ts import.meta.vitest
3341
+ * import { Effect, Metric } from "effect"
3655
3342
  *
3656
3343
  * const program = Effect.gen(function*() {
3657
- * // Access the fiber runtime metrics service
3658
3344
  * const metricsService = yield* Metric.FiberRuntimeMetrics
3659
- *
3660
- * if (metricsService) {
3661
- * console.log("Runtime metrics are enabled")
3662
- * } else {
3663
- * console.log("Runtime metrics are disabled")
3664
- * }
3665
- *
3666
- * // Enable runtime metrics for the application
3667
- * const enabledLayer = Metric.enableRuntimeMetricsLayer
3668
- *
3669
- * return yield* Effect.gen(function*() {
3670
- * // Create some concurrent fibers to see metrics in action
3671
- * yield* Effect.all([
3672
- * Effect.sleep("100 millis"),
3673
- * Effect.sleep("200 millis"),
3674
- * Effect.sleep("300 millis")
3675
- * ], { concurrency: "unbounded" })
3676
- *
3677
- * // Create test metrics to demonstrate the service
3678
- * const testCounter = Metric.counter("test_counter")
3679
- * yield* Metric.update(testCounter, 5)
3680
- * const counterValue = yield* Metric.value(testCounter)
3681
- *
3682
- * return { counterValue, metricsEnabled: true }
3683
- * }).pipe(Effect.provide(enabledLayer))
3345
+ * return metricsService === Metric.FiberRuntimeMetricsImpl
3684
3346
  * })
3347
+ *
3348
+ * const result = await Effect.runPromise(
3349
+ * Effect.provideService(program, Metric.FiberRuntimeMetrics, Metric.FiberRuntimeMetricsImpl)
3350
+ * )
3351
+ * const isDefault = result // => true
3685
3352
  * ```
3686
3353
  *
3687
- * @category runtime metrics
3354
+ * @category services
3688
3355
  * @since 4.0.0
3689
3356
  */
3690
3357
  export declare const FiberRuntimeMetrics: Context.Reference<FiberRuntimeMetricsService | undefined>;
@@ -3693,44 +3360,16 @@ export declare const FiberRuntimeMetrics: Context.Reference<FiberRuntimeMetricsS
3693
3360
  *
3694
3361
  * **Example** (Accessing the default fiber metrics implementation)
3695
3362
  *
3696
- * ```ts
3697
- * import { Data, Effect, Layer, Metric } from "effect"
3698
- *
3699
- * class MetricsError extends Data.TaggedError("MetricsError")<{
3700
- * readonly operation: string
3701
- * }> {}
3702
- *
3703
- * const program = Effect.gen(function*() {
3704
- * // Use the default metrics implementation
3705
- * const metrics = Metric.FiberRuntimeMetricsImpl
3706
- * console.log("Metrics implementation:", metrics)
3707
- *
3708
- * // Enable runtime metrics using the default implementation
3709
- * const layer = Layer.succeed(Metric.FiberRuntimeMetrics)(metrics)
3710
- *
3711
- * return yield* Effect.gen(function*() {
3712
- * // Run some Effects to trigger metric collection
3713
- * yield* Effect.forkChild(Effect.sleep("50 millis"))
3714
- * yield* Effect.forkChild(Effect.sleep("100 millis"))
3715
- *
3716
- * // Wait a bit and check the metrics
3717
- * yield* Effect.sleep("200 millis")
3718
- *
3719
- * // Create test metrics to demonstrate the implementation
3720
- * const testCounter = Metric.counter("test_counter")
3721
- * const testGauge = Metric.gauge("test_gauge")
3722
- * yield* Metric.update(testCounter, 3)
3723
- * yield* Metric.update(testGauge, 42)
3724
- *
3725
- * const counterValue = yield* Metric.value(testCounter)
3726
- * const gaugeValue = yield* Metric.value(testGauge)
3363
+ * ```ts import.meta.vitest
3364
+ * import { Metric } from "effect"
3727
3365
  *
3728
- * return { counter: counterValue, gauge: gaugeValue }
3729
- * }).pipe(Effect.provide(layer))
3730
- * })
3366
+ * [
3367
+ * typeof Metric.FiberRuntimeMetricsImpl.recordFiberStart,
3368
+ * typeof Metric.FiberRuntimeMetricsImpl.recordFiberEnd
3369
+ * ] // => ["function", "function"]
3731
3370
  * ```
3732
3371
  *
3733
- * @category metrics
3372
+ * @category services
3734
3373
  * @since 4.0.0
3735
3374
  */
3736
3375
  export declare const FiberRuntimeMetricsImpl: FiberRuntimeMetricsService;
@@ -3745,91 +3384,18 @@ export declare const FiberRuntimeMetricsImpl: FiberRuntimeMetricsService;
3745
3384
  *
3746
3385
  * **Example** (Enabling runtime metrics with a layer)
3747
3386
  *
3748
- * ```ts
3749
- * import { Console, Data, Effect, Layer, Metric } from "effect"
3750
- *
3751
- * class AppError extends Data.TaggedError("AppError")<{
3752
- * readonly operation: string
3753
- * }> {}
3754
- *
3755
- * // Define your application logic
3756
- * const userService = Effect.gen(function*() {
3757
- * // Simulate user operations with concurrent processing
3758
- * const fetchUser = (id: number) =>
3759
- * Effect.gen(function*() {
3760
- * yield* Effect.sleep(`${50 + id * 10} millis`)
3761
- * if (id % 7 === 0) {
3762
- * return yield* new AppError({ operation: `fetch-user-${id}` })
3763
- * }
3764
- * return { id, name: `User ${id}`, email: `user${id}@example.com` }
3765
- * })
3766
- *
3767
- * // Process multiple users concurrently (ignoring failures for demo)
3768
- * const userIds = Array.from({ length: 10 }, (_, i) => i + 1)
3769
- * const userTasks = userIds.map((id) =>
3770
- * fetchUser(id).pipe(Effect.catchTag("AppError", () => Effect.succeed(null)))
3771
- * )
3772
- * const allUsers = yield* Effect.all(userTasks, { concurrency: 4 })
3773
- * const successfulUsers = allUsers.filter((user) => user !== null)
3774
- * return successfulUsers
3775
- * })
3776
- *
3777
- * const analyticsService = Effect.gen(function*() {
3778
- * // Simulate analytics processing
3779
- * const tasks = Array.from({ length: 8 }, (_, i) =>
3780
- * Effect.gen(function*() {
3781
- * yield* Effect.sleep(`${100 + i * 25} millis`)
3782
- * return `Analytics task ${i} completed`
3783
- * }))
3784
- * return yield* Effect.all(tasks, { concurrency: 3 })
3785
- * })
3786
- *
3787
- * // Main application that uses multiple services
3788
- * const application = Effect.gen(function*() {
3789
- * yield* Console.log("Starting application with runtime metrics...")
3790
- *
3791
- * // Run services concurrently
3792
- * const [users, analytics] = yield* Effect.all([
3793
- * userService,
3794
- * analyticsService
3795
- * ], { concurrency: 2 })
3796
- *
3797
- * yield* Console.log(
3798
- * `Processed ${users.length} users and ${analytics.length} analytics tasks`
3799
- * )
3800
- *
3801
- * // Inspect the automatically collected runtime metrics
3802
- * const metrics = yield* Metric.snapshot
3803
- * const runtimeMetrics = metrics.filter((m) => m.id.startsWith("child_fiber"))
3804
- *
3805
- * yield* Console.log("Runtime Metrics Collected:")
3806
- * for (const metric of runtimeMetrics) {
3807
- * yield* Console.log(` ${metric.id}: ${JSON.stringify(metric.state)}`)
3808
- * }
3387
+ * ```ts import.meta.vitest
3388
+ * import { Effect, Metric } from "effect"
3809
3389
  *
3810
- * return { users, analytics, metricsCount: runtimeMetrics.length }
3390
+ * const program = Effect.gen(function*() {
3391
+ * const service = yield* Metric.FiberRuntimeMetrics
3392
+ * return service === Metric.FiberRuntimeMetricsImpl
3811
3393
  * })
3812
3394
  *
3813
- * // Create the base application layer
3814
- * const AppLayer = Layer.empty // Add your application layers here (database, HTTP, etc.)
3815
- *
3816
- * // Add runtime metrics layer at the end
3817
- * const AppLayerWithMetrics = AppLayer.pipe(
3818
- * Layer.provide(Metric.enableRuntimeMetricsLayer)
3819
- * )
3820
- *
3821
- * // Run the application with runtime metrics enabled
3822
- * const program = application.pipe(
3823
- * Effect.provide(AppLayerWithMetrics)
3824
- * )
3825
- *
3826
- * // Alternative: Provide runtime metrics directly to the application
3827
- * const programWithDirectMetrics = application.pipe(
3828
- * Effect.provide(Metric.enableRuntimeMetricsLayer)
3829
- * )
3395
+ * await Effect.runPromise(Effect.provide(program, Metric.enableRuntimeMetricsLayer)) // => true
3830
3396
  * ```
3831
3397
  *
3832
- * @category metrics
3398
+ * @category layers
3833
3399
  * @since 4.0.0
3834
3400
  */
3835
3401
  export declare const enableRuntimeMetricsLayer: Layer.Layer<never, never, never>;
@@ -3838,12 +3404,8 @@ export declare const enableRuntimeMetricsLayer: Layer.Layer<never, never, never>
3838
3404
  *
3839
3405
  * **Example** (Disabling runtime metrics with a layer)
3840
3406
  *
3841
- * ```ts
3842
- * import { Data, Effect, Metric } from "effect"
3843
- *
3844
- * class MetricsError extends Data.TaggedError("MetricsError")<{
3845
- * readonly operation: string
3846
- * }> {}
3407
+ * ```ts import.meta.vitest
3408
+ * import { Effect, Metric } from "effect"
3847
3409
  *
3848
3410
  * const program = Effect.gen(function*() {
3849
3411
  * // Disable runtime metrics collection
@@ -3852,7 +3414,6 @@ export declare const enableRuntimeMetricsLayer: Layer.Layer<never, never, never>
3852
3414
  * return yield* Effect.gen(function*() {
3853
3415
  * // Check that metrics service is disabled
3854
3416
  * const metricsService = yield* Metric.FiberRuntimeMetrics
3855
- * console.log("Metrics enabled:", metricsService !== undefined) // false
3856
3417
  *
3857
3418
  * // Run some Effects - no metrics will be collected
3858
3419
  * yield* Effect.forkChild(Effect.sleep("50 millis"))
@@ -3867,9 +3428,12 @@ export declare const enableRuntimeMetricsLayer: Layer.Layer<never, never, never>
3867
3428
  * return { counterValue, metricsEnabled: metricsService !== undefined }
3868
3429
  * }).pipe(Effect.provide(disabledLayer))
3869
3430
  * })
3431
+ *
3432
+ * const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
3433
+ * const values = [result.counterValue.count, result.metricsEnabled] // => [1, false]
3870
3434
  * ```
3871
3435
  *
3872
- * @category metrics
3436
+ * @category layers
3873
3437
  * @since 4.0.0
3874
3438
  */
3875
3439
  export declare const disableRuntimeMetricsLayer: Layer.Layer<never, never, never>;
@@ -3884,75 +3448,18 @@ export declare const disableRuntimeMetricsLayer: Layer.Layer<never, never, never
3884
3448
  *
3885
3449
  * **Example** (Enabling runtime metrics for an effect)
3886
3450
  *
3887
- * ```ts
3888
- * import { Console, Data, Effect, Layer, Metric } from "effect"
3889
- *
3890
- * class RuntimeMetricsError extends Data.TaggedError("RuntimeMetricsError")<{
3891
- * readonly operation: string
3892
- * }> {}
3451
+ * ```ts import.meta.vitest
3452
+ * import { Effect, Metric } from "effect"
3893
3453
  *
3894
3454
  * const program = Effect.gen(function*() {
3895
- * // Create a concurrent workload to demonstrate fiber metrics
3896
- * const heavyWorkload = Effect.gen(function*() {
3897
- * // Simulate concurrent operations
3898
- * const tasks = Array.from({ length: 10 }, (_, i) =>
3899
- * Effect.gen(function*() {
3900
- * yield* Effect.sleep(`${100 + i * 50} millis`)
3901
- * if (i % 4 === 0) {
3902
- * // Simulate some failures
3903
- * return yield* new RuntimeMetricsError({ operation: `task-${i}` })
3904
- * }
3905
- * return `Task ${i} completed`
3906
- * }).pipe(
3907
- * Effect.catchTag("RuntimeMetricsError", () =>
3908
- * Effect.succeed(`Task ${i} failed`))
3909
- * ))
3910
- *
3911
- * // Run tasks concurrently
3912
- * const results = yield* Effect.all(tasks, { concurrency: 5 })
3913
- * return results
3914
- * })
3915
- *
3916
- * // Enable runtime metrics collection for our workload
3917
- * const workloadWithMetrics = Metric.enableRuntimeMetrics(heavyWorkload)
3918
- *
3919
- * // Execute the workload
3920
- * const results = yield* workloadWithMetrics
3921
- *
3922
- * // After execution, we can inspect the runtime metrics
3923
- * // The following metrics are automatically collected:
3924
- * // - child_fibers_active: Current number of active child fibers (Gauge)
3925
- * // - child_fibers_started: Total child fibers started (Counter, incremental)
3926
- * // - child_fiber_successes: Total successful child fibers (Counter, incremental)
3927
- * // - child_fiber_failures: Total failed child fibers (Counter, incremental)
3928
- *
3929
- * yield* Console.log(`Workload completed with ${results.length} results`)
3930
- *
3931
- * // Get all metrics including the runtime metrics
3932
- * const allMetrics = yield* Metric.snapshot
3933
- * const runtimeMetrics = allMetrics.filter((m) =>
3934
- * m.id.startsWith("child_fiber") || m.id.includes("fiber")
3935
- * )
3936
- *
3937
- * yield* Console.log("Runtime Metrics:")
3938
- * for (const metric of runtimeMetrics) {
3939
- * yield* Console.log(` ${metric.id}: ${JSON.stringify(metric.state)}`)
3940
- * }
3941
- *
3942
- * return results
3455
+ * const service = yield* Metric.FiberRuntimeMetrics
3456
+ * return service === Metric.FiberRuntimeMetricsImpl
3943
3457
  * })
3944
3458
  *
3945
- * // Alternative: Use the layer version for broader application coverage
3946
- * const BaseAppLayer = Layer.empty // Your base application layers
3947
- * const AppLayerWithMetrics = BaseAppLayer.pipe(
3948
- * Layer.provide(Metric.enableRuntimeMetricsLayer)
3949
- * )
3950
- * const programWithLayer = program.pipe(
3951
- * Effect.provide(AppLayerWithMetrics)
3952
- * )
3459
+ * await Effect.runPromise(Metric.enableRuntimeMetrics(program)) // => true
3953
3460
  * ```
3954
3461
  *
3955
- * @category metrics
3462
+ * @category providing services
3956
3463
  * @since 4.0.0
3957
3464
  */
3958
3465
  export declare const enableRuntimeMetrics: <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
@@ -3966,76 +3473,18 @@ export declare const enableRuntimeMetrics: <A, E, R>(self: Effect<A, E, R>) => E
3966
3473
  *
3967
3474
  * **Example** (Disabling runtime metrics for an effect)
3968
3475
  *
3969
- * ```ts
3970
- * import { Console, Data, Effect, Layer, Metric } from "effect"
3971
- *
3972
- * class DisableMetricsError extends Data.TaggedError("DisableMetricsError")<{
3973
- * readonly operation: string
3974
- * }> {}
3476
+ * ```ts import.meta.vitest
3477
+ * import { Effect, Metric } from "effect"
3975
3478
  *
3976
3479
  * const program = Effect.gen(function*() {
3977
- * // This section will have runtime metrics enabled
3978
- * const normalOperation = Effect.gen(function*() {
3979
- * const tasks = Array.from({ length: 5 }, (_, i) =>
3980
- * Effect.gen(function*() {
3981
- * yield* Effect.sleep(`${100 + i * 20} millis`)
3982
- * return `Normal task ${i} completed`
3983
- * }))
3984
- * return yield* Effect.all(tasks, { concurrency: 3 })
3985
- * })
3986
- *
3987
- * // This section will have runtime metrics disabled for performance
3988
- * const highPerformanceOperation = Metric.disableRuntimeMetrics(
3989
- * Effect.gen(function*() {
3990
- * // Performance-critical code where metrics overhead should be avoided
3991
- * const hotPath = Array.from(
3992
- * { length: 1000 },
3993
- * (_, i) =>
3994
- * Effect.gen(function*() {
3995
- * // Simulate intensive computation
3996
- * const result = i * i + (i % 10) / 10
3997
- * return result
3998
- * })
3999
- * )
4000
- * return yield* Effect.all(hotPath, { concurrency: 100 })
4001
- * })
4002
- * )
4003
- *
4004
- * yield* Console.log("Running operations with selective metrics...")
4005
- *
4006
- * // Run both operations
4007
- * const [normalResults, performanceResults] = yield* Effect.all([
4008
- * normalOperation, // Will generate fiber metrics
4009
- * highPerformanceOperation // Will NOT generate fiber metrics
4010
- * ])
4011
- *
4012
- * // Check collected metrics - should only see metrics from normalOperation
4013
- * const metrics = yield* Metric.snapshot
4014
- * const runtimeMetrics = metrics.filter((m) => m.id.startsWith("child_fiber"))
4015
- *
4016
- * yield* Console.log(`Normal operation results: ${normalResults.length}`)
4017
- * yield* Console.log(
4018
- * `Performance operation results: ${performanceResults.length}`
4019
- * )
4020
- * yield* Console.log(`Runtime metrics collected: ${runtimeMetrics.length}`)
4021
- *
4022
- * // The runtime metrics will only reflect the fibers from normalOperation
4023
- * // The highPerformanceOperation fibers were not tracked due to disableRuntimeMetrics
4024
- *
4025
- * return { normalResults, performanceResults, runtimeMetrics }
3480
+ * const service = yield* Metric.FiberRuntimeMetrics
3481
+ * return service === undefined
4026
3482
  * })
4027
3483
  *
4028
- * // Enable runtime metrics globally, then selectively disable where needed
4029
- * const BaseAppLayer = Layer.empty // Your base application layers
4030
- * const AppLayerWithMetrics = BaseAppLayer.pipe(
4031
- * Layer.provide(Metric.enableRuntimeMetricsLayer)
4032
- * )
4033
- * const finalProgram = program.pipe(
4034
- * Effect.provide(AppLayerWithMetrics)
4035
- * )
3484
+ * await Effect.runPromise(Metric.disableRuntimeMetrics(program)) // => true
4036
3485
  * ```
4037
3486
  *
4038
- * @category metrics
3487
+ * @category providing services
4039
3488
  * @since 4.0.0
4040
3489
  */
4041
3490
  export declare const disableRuntimeMetrics: <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;