@demlik/tea 0.12.0 → 0.14.0

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 (368) hide show
  1. package/README.md +11 -9
  2. package/dist/agent/index.d.ts +638 -45
  3. package/dist/agent/index.js +9 -19
  4. package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
  5. package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
  6. package/dist/chunk-AQ6ZIMEA.js +421 -0
  7. package/dist/chunk-AQ6ZIMEA.js.map +1 -0
  8. package/dist/{chunk-MUUROGIH.js → chunk-BLJ2JQSH.js} +62 -12
  9. package/dist/chunk-BLJ2JQSH.js.map +1 -0
  10. package/dist/{chunk-7SVIRMC6.js → chunk-F2US5BW6.js} +25 -5
  11. package/dist/chunk-F2US5BW6.js.map +1 -0
  12. package/dist/{batch-window/index.js → chunk-F7FMAWLA.js} +4 -8
  13. package/dist/chunk-F7FMAWLA.js.map +1 -0
  14. package/dist/{chunk-7V4EVLZA.js → chunk-HUKZQX6U.js} +20 -16
  15. package/dist/chunk-HUKZQX6U.js.map +1 -0
  16. package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
  17. package/dist/chunk-HWVW4AXC.js.map +1 -0
  18. package/dist/{chunk-WLGO64WC.js → chunk-HYDWG35Q.js} +23 -6
  19. package/dist/chunk-HYDWG35Q.js.map +1 -0
  20. package/dist/{chunk-I5OV65MS.js → chunk-I5MQMJDW.js} +57 -7
  21. package/dist/chunk-I5MQMJDW.js.map +1 -0
  22. package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
  23. package/dist/chunk-LFZUK6J2.js.map +1 -0
  24. package/dist/{chunk-ZVJZ72HY.js → chunk-LYLTKJWM.js} +25 -11
  25. package/dist/chunk-LYLTKJWM.js.map +1 -0
  26. package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
  27. package/dist/chunk-MYXFNWAJ.js.map +1 -0
  28. package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
  29. package/dist/chunk-PR6TB3BL.js.map +1 -0
  30. package/dist/chunk-RQULHGYH.js +1804 -0
  31. package/dist/chunk-RQULHGYH.js.map +1 -0
  32. package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
  33. package/dist/chunk-TXN2KFHF.js.map +1 -0
  34. package/dist/{chunk-Q2UM7BXU.js → chunk-VBDU4JL6.js} +2 -2
  35. package/dist/chunk-VBDU4JL6.js.map +1 -0
  36. package/dist/chunk-Z2L3LSNV.js +1470 -0
  37. package/dist/chunk-Z2L3LSNV.js.map +1 -0
  38. package/dist/core-CTzMJ82M.d.ts +562 -0
  39. package/dist/devtools/index.d.ts +2 -2
  40. package/dist/devtools/index.js +207 -2
  41. package/dist/devtools/index.js.map +1 -1
  42. package/dist/do/index.d.ts +48 -31
  43. package/dist/do/index.js +36 -25
  44. package/dist/do/index.js.map +1 -1
  45. package/dist/{durable-effects-D8SqU_if.d.ts → durable-effects-B0-qGQDy.d.ts} +2 -2
  46. package/dist/extension/index.d.ts +301 -3
  47. package/dist/extension/index.js +596 -5
  48. package/dist/extension/index.js.map +1 -1
  49. package/dist/flow/index.d.ts +1295 -0
  50. package/dist/flow/index.js +732 -0
  51. package/dist/flow/index.js.map +1 -0
  52. package/dist/idempotency/index.d.ts +90 -116
  53. package/dist/idempotency/index.js +4 -1
  54. package/dist/{batch-window/index.d.ts → index-4vZzljCD.d.ts} +7 -11
  55. package/dist/{fan-out/index.d.ts → index-6A7dB8f6.d.ts} +7 -8
  56. package/dist/index-B5BZ-_cT.d.ts +616 -0
  57. package/dist/index-Bc40JWVl.d.ts +131 -0
  58. package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
  59. package/dist/index-DJWIER_3.d.ts +69 -0
  60. package/dist/{snapshot/index.d.ts → index-DMCeMPMJ.d.ts} +15 -77
  61. package/dist/{monitored-run/index.d.ts → index-NjrT3fL2.d.ts} +37 -12
  62. package/dist/{recorder/index.d.ts → index-TvRb1KVf.d.ts} +4 -6
  63. package/dist/{deadline/index.d.ts → index-q0hXFeZ0.d.ts} +155 -8
  64. package/dist/index.d.ts +719 -6
  65. package/dist/index.js +1 -2
  66. package/dist/jev/index.d.ts +634 -0
  67. package/dist/jev/index.js +433 -0
  68. package/dist/jev/index.js.map +1 -0
  69. package/dist/machine-CdIcN2Xm.d.ts +1773 -0
  70. package/dist/machine-viz/index.d.ts +2 -1
  71. package/dist/machine-viz/index.js +12 -5
  72. package/dist/machine-viz/index.js.map +1 -1
  73. package/dist/mem/index.d.ts +19 -3
  74. package/dist/mem/index.js +22 -2
  75. package/dist/mem/index.js.map +1 -1
  76. package/dist/node/index.d.ts +130 -4
  77. package/dist/node/index.js +222 -10
  78. package/dist/node/index.js.map +1 -1
  79. package/dist/{paginator → paginate}/index.d.ts +151 -6
  80. package/dist/paginate/index.js +7 -0
  81. package/dist/parity/index.d.ts +5 -10
  82. package/dist/parity/index.js +4 -7
  83. package/dist/parity/index.js.map +1 -1
  84. package/dist/pbt/index.d.ts +248 -5
  85. package/dist/pbt/index.js +124 -5
  86. package/dist/pbt/index.js.map +1 -1
  87. package/dist/{trace-replay → persistence}/index.d.ts +7 -4
  88. package/dist/persistence/index.js +6 -0
  89. package/dist/react/index.d.ts +4 -3
  90. package/dist/react/index.js +1 -2
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/resilience/index.d.ts +743 -0
  93. package/dist/resilience/index.js +657 -0
  94. package/dist/resilience/index.js.map +1 -0
  95. package/dist/retry-backoff/index.d.ts +3 -2
  96. package/dist/retry-backoff/index.js +1 -1
  97. package/dist/runtime-types-LWDoi943.d.ts +998 -0
  98. package/dist/testing/index.d.ts +3 -2
  99. package/dist/testing/index.js +1 -2
  100. package/dist/testing/index.js.map +1 -1
  101. package/dist/{throttled-input → timing}/index.d.ts +144 -12
  102. package/dist/{throttled-input → timing}/index.js +57 -12
  103. package/dist/timing/index.js.map +1 -0
  104. package/dist/{types-D7u9DkH7.d.ts → types-DP3f5NIl.d.ts} +1 -1
  105. package/dist/work-queue/index.d.ts +131 -54
  106. package/dist/work-queue/index.js +3 -2
  107. package/dist/work-queue/index.js.map +1 -1
  108. package/package.json +50 -216
  109. package/dist/authed-call/index.d.ts +0 -119
  110. package/dist/authed-call/index.js +0 -134
  111. package/dist/authed-call/index.js.map +0 -1
  112. package/dist/await-terminal/index.d.ts +0 -100
  113. package/dist/await-terminal/index.js +0 -76
  114. package/dist/await-terminal/index.js.map +0 -1
  115. package/dist/batch-window/index.js.map +0 -1
  116. package/dist/cache/index.d.ts +0 -151
  117. package/dist/cache/index.js +0 -8
  118. package/dist/chart/index.d.ts +0 -217
  119. package/dist/chart/index.js +0 -16
  120. package/dist/chart/index.js.map +0 -1
  121. package/dist/chart/inspect/index.d.ts +0 -85
  122. package/dist/chart/inspect/index.js +0 -5
  123. package/dist/chart/inspect/react.d.ts +0 -112
  124. package/dist/chart/inspect/react.js +0 -11
  125. package/dist/chart/inspect/react.js.map +0 -1
  126. package/dist/chart/inspect/styles.css +0 -286
  127. package/dist/chart/lane/index.d.ts +0 -361
  128. package/dist/chart/lane/index.js +0 -9
  129. package/dist/chart/lane/index.js.map +0 -1
  130. package/dist/chart/lane/react.d.ts +0 -83
  131. package/dist/chart/lane/react.js +0 -559
  132. package/dist/chart/lane/react.js.map +0 -1
  133. package/dist/chart/lane/server.d.ts +0 -148
  134. package/dist/chart/lane/server.js +0 -209
  135. package/dist/chart/lane/server.js.map +0 -1
  136. package/dist/chart/lane/styles.css +0 -498
  137. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
  138. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
  139. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
  140. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
  141. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
  142. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
  143. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
  144. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
  145. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
  146. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
  147. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
  148. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
  149. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
  150. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
  151. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
  152. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
  153. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
  154. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
  155. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
  156. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
  157. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
  158. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
  159. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
  160. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
  161. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
  162. package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
  163. package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
  164. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
  165. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
  166. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
  167. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
  168. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
  169. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
  170. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
  171. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
  172. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
  173. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
  174. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
  175. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
  176. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
  177. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
  178. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
  179. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
  180. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
  181. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
  182. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
  183. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
  184. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
  185. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
  186. package/dist/chart/lane/viewer/index.html +0 -15
  187. package/dist/chart/report/index.d.ts +0 -116
  188. package/dist/chart/report/index.js +0 -32
  189. package/dist/chart/report/index.js.map +0 -1
  190. package/dist/chunk-2YFLOCWX.js +0 -15
  191. package/dist/chunk-2YFLOCWX.js.map +0 -1
  192. package/dist/chunk-3JU6657S.js +0 -372
  193. package/dist/chunk-3JU6657S.js.map +0 -1
  194. package/dist/chunk-4KTWLPL5.js +0 -33
  195. package/dist/chunk-4KTWLPL5.js.map +0 -1
  196. package/dist/chunk-5EHLEUTL.js +0 -686
  197. package/dist/chunk-5EHLEUTL.js.map +0 -1
  198. package/dist/chunk-5KJKJOFC.js +0 -758
  199. package/dist/chunk-5KJKJOFC.js.map +0 -1
  200. package/dist/chunk-7SVIRMC6.js.map +0 -1
  201. package/dist/chunk-7V4EVLZA.js.map +0 -1
  202. package/dist/chunk-A56OR5RF.js +0 -184
  203. package/dist/chunk-A56OR5RF.js.map +0 -1
  204. package/dist/chunk-AZZLE7XR.js +0 -62
  205. package/dist/chunk-AZZLE7XR.js.map +0 -1
  206. package/dist/chunk-B5VXOFMZ.js +0 -266
  207. package/dist/chunk-B5VXOFMZ.js.map +0 -1
  208. package/dist/chunk-BYQUGDD3.js +0 -16
  209. package/dist/chunk-BYQUGDD3.js.map +0 -1
  210. package/dist/chunk-D736QUGF.js.map +0 -1
  211. package/dist/chunk-E6GEDSF4.js +0 -307
  212. package/dist/chunk-E6GEDSF4.js.map +0 -1
  213. package/dist/chunk-EUF7XOEE.js +0 -223
  214. package/dist/chunk-EUF7XOEE.js.map +0 -1
  215. package/dist/chunk-EWJP3YYP.js.map +0 -1
  216. package/dist/chunk-FV3Z5MBE.js.map +0 -1
  217. package/dist/chunk-HCEVHFJ7.js +0 -54
  218. package/dist/chunk-HCEVHFJ7.js.map +0 -1
  219. package/dist/chunk-I5OV65MS.js.map +0 -1
  220. package/dist/chunk-J6527VRQ.js.map +0 -1
  221. package/dist/chunk-JELSZN25.js +0 -47
  222. package/dist/chunk-JELSZN25.js.map +0 -1
  223. package/dist/chunk-JER5O7PQ.js +0 -416
  224. package/dist/chunk-JER5O7PQ.js.map +0 -1
  225. package/dist/chunk-JGVL3WPL.js +0 -26
  226. package/dist/chunk-JGVL3WPL.js.map +0 -1
  227. package/dist/chunk-JP5D6GSL.js +0 -71
  228. package/dist/chunk-JP5D6GSL.js.map +0 -1
  229. package/dist/chunk-K575PT4S.js.map +0 -1
  230. package/dist/chunk-MU6MCIAC.js +0 -15
  231. package/dist/chunk-MU6MCIAC.js.map +0 -1
  232. package/dist/chunk-MUUROGIH.js.map +0 -1
  233. package/dist/chunk-ND3DH6KM.js +0 -88
  234. package/dist/chunk-ND3DH6KM.js.map +0 -1
  235. package/dist/chunk-Q2UM7BXU.js.map +0 -1
  236. package/dist/chunk-S2EGRPCM.js +0 -47
  237. package/dist/chunk-S2EGRPCM.js.map +0 -1
  238. package/dist/chunk-SINXE47Y.js +0 -55
  239. package/dist/chunk-SINXE47Y.js.map +0 -1
  240. package/dist/chunk-SUST46KO.js +0 -53
  241. package/dist/chunk-SUST46KO.js.map +0 -1
  242. package/dist/chunk-TP5UPGLY.js +0 -61
  243. package/dist/chunk-TP5UPGLY.js.map +0 -1
  244. package/dist/chunk-UF4MZSLT.js +0 -53
  245. package/dist/chunk-UF4MZSLT.js.map +0 -1
  246. package/dist/chunk-UOC2PL46.js +0 -13
  247. package/dist/chunk-UOC2PL46.js.map +0 -1
  248. package/dist/chunk-WLGO64WC.js.map +0 -1
  249. package/dist/chunk-WRAA7GVZ.js +0 -209
  250. package/dist/chunk-WRAA7GVZ.js.map +0 -1
  251. package/dist/chunk-ZCL7SCBK.js +0 -685
  252. package/dist/chunk-ZCL7SCBK.js.map +0 -1
  253. package/dist/chunk-ZD6PNZBK.js +0 -457
  254. package/dist/chunk-ZD6PNZBK.js.map +0 -1
  255. package/dist/chunk-ZF6WDK2D.js +0 -519
  256. package/dist/chunk-ZF6WDK2D.js.map +0 -1
  257. package/dist/chunk-ZJ5AOYBH.js +0 -8
  258. package/dist/chunk-ZJ5AOYBH.js.map +0 -1
  259. package/dist/chunk-ZVJZ72HY.js.map +0 -1
  260. package/dist/circuit-breaker/index.d.ts +0 -197
  261. package/dist/circuit-breaker/index.js +0 -3
  262. package/dist/circuit-breaker/index.js.map +0 -1
  263. package/dist/core-Bjc0bS8j.d.ts +0 -326
  264. package/dist/deadline/index.js +0 -6
  265. package/dist/deadline/index.js.map +0 -1
  266. package/dist/debounce/index.js +0 -3
  267. package/dist/debounce/index.js.map +0 -1
  268. package/dist/extension/react.d.ts +0 -121
  269. package/dist/extension/react.js +0 -75
  270. package/dist/extension/react.js.map +0 -1
  271. package/dist/extension/subs/index.d.ts +0 -44
  272. package/dist/extension/subs/index.js +0 -80
  273. package/dist/extension/subs/index.js.map +0 -1
  274. package/dist/extension/test-utils.d.ts +0 -128
  275. package/dist/extension/test-utils.js +0 -277
  276. package/dist/extension/test-utils.js.map +0 -1
  277. package/dist/fan-out/index.js +0 -5
  278. package/dist/fan-out/index.js.map +0 -1
  279. package/dist/fold-Blbhru48.d.ts +0 -435
  280. package/dist/graph-CcjWZVrd.d.ts +0 -923
  281. package/dist/idempotency/adapter.d.ts +0 -62
  282. package/dist/idempotency/adapter.js +0 -4
  283. package/dist/idempotency/adapter.js.map +0 -1
  284. package/dist/idempotent-intake/index.d.ts +0 -187
  285. package/dist/idempotent-intake/index.js +0 -7
  286. package/dist/idempotent-intake/index.js.map +0 -1
  287. package/dist/llm-call/index.d.ts +0 -310
  288. package/dist/llm-call/index.js +0 -16
  289. package/dist/llm-call/index.js.map +0 -1
  290. package/dist/machine-0OmPvsy_.d.ts +0 -804
  291. package/dist/monitored-run/index.js +0 -10
  292. package/dist/monitored-run/index.js.map +0 -1
  293. package/dist/paginated-walk/index.d.ts +0 -234
  294. package/dist/paginated-walk/index.js +0 -16
  295. package/dist/paginated-walk/index.js.map +0 -1
  296. package/dist/paginator/index.js +0 -3
  297. package/dist/paginator/index.js.map +0 -1
  298. package/dist/pbt/arbitraries/index.d.ts +0 -135
  299. package/dist/pbt/arbitraries/index.js +0 -3
  300. package/dist/pbt/arbitraries/index.js.map +0 -1
  301. package/dist/pbt/runners/index.d.ts +0 -117
  302. package/dist/pbt/runners/index.js +0 -5
  303. package/dist/pbt/runners/index.js.map +0 -1
  304. package/dist/poller/index.d.ts +0 -351
  305. package/dist/poller/index.js +0 -115
  306. package/dist/poller/index.js.map +0 -1
  307. package/dist/prediction/index.d.ts +0 -130
  308. package/dist/prediction/index.js +0 -4
  309. package/dist/prediction/index.js.map +0 -1
  310. package/dist/protocol-B5YmJr0d.d.ts +0 -45
  311. package/dist/pure/index.d.ts +0 -2
  312. package/dist/pure/index.js +0 -4
  313. package/dist/pure/index.js.map +0 -1
  314. package/dist/rate-limit/index.d.ts +0 -115
  315. package/dist/rate-limit/index.js +0 -3
  316. package/dist/rate-limit/index.js.map +0 -1
  317. package/dist/reconciler/index.d.ts +0 -192
  318. package/dist/reconciler/index.js +0 -164
  319. package/dist/reconciler/index.js.map +0 -1
  320. package/dist/recorder/index.js +0 -3
  321. package/dist/recorder/index.js.map +0 -1
  322. package/dist/reducer-BqyoVyBG.d.ts +0 -447
  323. package/dist/resilient-call/index.d.ts +0 -319
  324. package/dist/resilient-call/index.js +0 -14
  325. package/dist/resilient-call/index.js.map +0 -1
  326. package/dist/retry-to-success/index.d.ts +0 -109
  327. package/dist/retry-to-success/index.js +0 -37
  328. package/dist/retry-to-success/index.js.map +0 -1
  329. package/dist/run-BVeqJDBF.d.ts +0 -713
  330. package/dist/runtime-types-Bxc637bp.d.ts +0 -502
  331. package/dist/saga/index.d.ts +0 -240
  332. package/dist/saga/index.js +0 -150
  333. package/dist/saga/index.js.map +0 -1
  334. package/dist/samples-DCt6nF8H.d.ts +0 -59
  335. package/dist/snapshot/index.js +0 -5
  336. package/dist/snapshot/index.js.map +0 -1
  337. package/dist/subs/index.d.ts +0 -471
  338. package/dist/subs/index.js +0 -7
  339. package/dist/subs/index.js.map +0 -1
  340. package/dist/throttle/index.d.ts +0 -134
  341. package/dist/throttle/index.js +0 -3
  342. package/dist/throttle/index.js.map +0 -1
  343. package/dist/throttled-input/index.js.map +0 -1
  344. package/dist/token-refresh/index.d.ts +0 -215
  345. package/dist/token-refresh/index.js +0 -6
  346. package/dist/token-refresh/index.js.map +0 -1
  347. package/dist/trace-replay/index.js +0 -6
  348. package/dist/trace-replay/index.js.map +0 -1
  349. package/dist/with-deadline/index.d.ts +0 -196
  350. package/dist/with-deadline/index.js +0 -111
  351. package/dist/with-deadline/index.js.map +0 -1
  352. package/dist/with-resilience/index.d.ts +0 -224
  353. package/dist/with-resilience/index.js +0 -240
  354. package/dist/with-resilience/index.js.map +0 -1
  355. package/dist/with-telemetry/index.d.ts +0 -149
  356. package/dist/with-telemetry/index.js +0 -70
  357. package/dist/with-telemetry/index.js.map +0 -1
  358. package/dist/work-queue/adapter.d.ts +0 -83
  359. package/dist/work-queue/adapter.js +0 -4
  360. package/dist/work-queue/adapter.js.map +0 -1
  361. package/dist/work-queue/ops.d.ts +0 -70
  362. package/dist/work-queue/ops.js +0 -3
  363. package/dist/work-queue/ops.js.map +0 -1
  364. package/dist/workflow/index.d.ts +0 -484
  365. package/dist/workflow/index.js +0 -244
  366. package/dist/workflow/index.js.map +0 -1
  367. /package/dist/{cache → paginate}/index.js.map +0 -0
  368. /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
@@ -1,502 +0,0 @@
1
- import { Result } from 'better-result';
2
- import { a as Port, N as NoCellError, C as Cmd, R as Reducer, S as Sub, M as Machine, T as Transitions, U as UpdateForm, c as InterpretDetached, P as PortEmitter } from './core-Bjc0bS8j.js';
3
-
4
- /**
5
- * @demlik/tea runtime interface surface + pure helpers — the public types,
6
- * interfaces, and construction/composition helpers the runtime (`./run`)
7
- * implements against: `Store`, the error-sink and supervision contracts, the
8
- * `RuntimeRef` / `BootingRuntime` / `Runtime` handle hierarchy, `definePort`, the
9
- * identity-typed constructors `defineMachine` / `asReducer`, and the pure tools
10
- * `replay` (compose without running) and `tryInterpret` (Railway).
11
- */
12
-
13
- declare const ReducerBrand: unique symbol;
14
- type Branded<T> = T & {
15
- readonly [ReducerBrand]: true;
16
- };
17
- /**
18
- * Compile-time exhaustiveness assertion for default branches of switches over
19
- * discriminated unions narrowed by hand (Sub handlers, message-bridge
20
- * dispatchers, port fanouts) — TS narrows the operand to `never` only if every
21
- * variant is covered, so adding one produces a compile error at the `absurd(x)`
22
- * site. Strengthens invariant 7 (identity is explicit).
23
- *
24
- * @example
25
- * switch (msg.type) {
26
- * case "a": return ...;
27
- * case "b": return ...;
28
- * default: return absurd(msg); // compile error if a "c" is added
29
- * }
30
- */
31
- declare function absurd(x: never): never;
32
- declare const noop: <S, M, C extends Cmd>(state: S, _msg: M) => readonly [S, readonly C[]];
33
- /**
34
- * Thrown by `definePort` when a name has already been registered in the current
35
- * process. Symmetric with `SubIdCollisionError` (thrown by `reconcileSubs`) —
36
- * both mechanize invariant 7 (identity is explicit) at the runtime layer the
37
- * type system cannot reach (string names compared at runtime).
38
- */
39
- declare class PortNameCollisionError extends Error {
40
- readonly name = "PortNameCollisionError";
41
- readonly _tag: "PortNameCollisionError";
42
- constructor(portName: string);
43
- }
44
- /**
45
- * Thrown by `reconcileSubs` when, within ONE desired subscription set, two subs
46
- * share an `id` but declare different `type`s — a silent bug class the type
47
- * system cannot reach (ids are strings compared at runtime). The symmetric twin
48
- * of `PortNameCollisionError`: both mechanize invariant 7 (identity is explicit)
49
- * at the runtime layer. Same id across transitions is the no-churn case and does
50
- * NOT throw; only a within-set type conflict does.
51
- */
52
- declare class SubIdCollisionError extends Error {
53
- readonly name = "SubIdCollisionError";
54
- readonly _tag: "SubIdCollisionError";
55
- constructor(id: string, declaredType: string, conflictingType: string);
56
- }
57
- /**
58
- * Test-only escape hatch — clears the module-level port-name registry so the
59
- * collision assert in `definePort` doesn't false-positive across vitest's
60
- * non-isolated runs. Production code MUST NOT call this.
61
- *
62
- * @internal test-only
63
- */
64
- declare function __resetPortRegistry(): void;
65
- /**
66
- * Which otherwise-unattributable runtime path produced an error. Every fanout is
67
- * throw-isolated so one bad consumer never strands its siblings, and the
68
- * isolated throw routes to the `OnError` sink rather than a bare `console.error`.
69
- *
70
- * - `"follow-up"` — a follow-up Msg an interpret handler returned rejected when
71
- * re-dispatched (the original dispatcher already resolved, so no caller).
72
- * A rejection caused by `stop()`'s own teardown is NOT this phase — see
73
- * `"discard"`.
74
- * - `"stop-save"` — the final `store.save(state)` inside `stop()` threw
75
- * (`stop()` resolves regardless, so without the sink this was silent loss).
76
- * - `"reduce"` — the pure `update` (reducer) threw synchronously; the configured
77
- * `Supervision` strategy decides what happens next, but the throw is surfaced
78
- * here as data first.
79
- * - `"listener"` — a `runtime.subscribe(...)` listener threw during fanout.
80
- * - `"observer"` — a `runtime.observe(...)` observer threw during fanout.
81
- * - `"event"` — the `events` projector or an `on(type, ...)` handler threw.
82
- * - `"boot"` — an `onBoot` handler threw (boot fanout, or a late registration).
83
- * - `"port-emit"` — a `subscribePort` listener threw during a port emission.
84
- * - `"sub-cleanup"` — a subscription's cleanup threw (reconcile-removal or
85
- * `stop()` teardown).
86
- * - `"discard"` — work lost to a teardown the host asked for. Two witnesses,
87
- * both carrying a `RuntimeDiscardNotice`: `stop()` was called while interpret
88
- * handlers were still awaiting (`RuntimeDiscardedError`), and a Msg that
89
- * arrived DURING `stop()`'s drain and so could not be delivered
90
- * (`DispatchDiscardedError`), and teardown work that did not settle inside
91
- * `disposeTimeoutMs` (`DisposeTimeoutNotice`). The one phase that is a
92
- * LIFECYCLE report rather than a failure: legal, merely lossy.
93
- * - `"identity-drop"` — the `Identity` filter dropped a message addressed to a
94
- * different instance (`IdentityDropNotice`). Its own phase rather than
95
- * `"discard"`: the loss is the FILTER WORKING, not a teardown, and a host
96
- * routing it (a metric, a 409 back to the caller) wants it apart from
97
- * unmount-time noise. Warn-only, like every `RuntimeDiscardNotice`.
98
- *
99
- * The phase never decides fatality — the ERROR CLASS does (`RuntimeDiscardNotice`
100
- * warns, everything else rethrows). A phase is attached by the report site, so a
101
- * consumer sink that throws while handling a `"discard"` report inherits that
102
- * phase; keying the warn-only path on it would make the sink's own defect vanish.
103
- */
104
- type RuntimeErrorPhase = "follow-up" | "stop-save" | "reduce" | "listener" | "observer" | "event" | "boot" | "port-emit" | "sub-cleanup" | "discard" | "identity-drop";
105
- /** Context handed to an `OnError` sink alongside the error itself. */
106
- interface RuntimeErrorContext {
107
- readonly phase: RuntimeErrorPhase;
108
- }
109
- /**
110
- * Sink for runtime failures that have no caller to reject at. Configured via
111
- * `run(machine, { onError })`. Should be total — a throw inside the sink is
112
- * itself surfaced via the default sink, so it can never re-introduce a silent
113
- * failure.
114
- */
115
- type OnError = (error: unknown, context: RuntimeErrorContext) => void;
116
- /** The three declared reducer-throw supervision strategies. */
117
- type SupervisionStrategy = "stop" | "escalate" | "restart";
118
- /**
119
- * Declared supervision policy for a reducer (`update`) throw, at
120
- * `run(machine, { supervision })`. The bare-string shorthands (`"stop"` /
121
- * `"escalate"`) are accepted for the two strategies that need no host data;
122
- * `restart` MUST be the object form because it carries the `rehydrate` callback,
123
- * which MUST return a valid `S` synchronously (the reducer is synchronous, so
124
- * recovery is too — no suspension across the single-writer slot).
125
- */
126
- type Supervision<S, M extends {
127
- type: string;
128
- }> = "stop" | "escalate" | {
129
- readonly strategy: "stop";
130
- } | {
131
- readonly strategy: "escalate";
132
- } | {
133
- readonly strategy: "restart";
134
- /**
135
- * Host-provided rehydration to last-known-good state. Invoked when the
136
- * reducer throws; its return value becomes the new state and the transition
137
- * continues from there. Receives the pre-throw `state`, the `msg` that
138
- * triggered the throw, and the thrown `error` so the host can route by
139
- * cause.
140
- */
141
- readonly rehydrate: (state: S, msg: M, error: unknown) => S;
142
- };
143
- /**
144
- * Raised by `idle()` when the quiescence wait hits its iteration cap without the
145
- * dispatch tail stabilizing — `idle()` REJECTS rather than silently resolving,
146
- * so a livelocking machine surfaces instead of masquerading as quiescent.
147
- * Mechanizes invariant 6 at the runtime layer, the role `PortNameCollisionError`
148
- * plays for invariant 7.
149
- */
150
- declare class QuiescenceTimeoutError extends Error {
151
- readonly iterations: number;
152
- readonly name = "QuiescenceTimeoutError";
153
- readonly _tag: "QuiescenceTimeoutError";
154
- constructor(iterations: number);
155
- }
156
- /**
157
- * Base of the LOSSY-BUT-LEGAL teardown facts: work the host discarded by letting
158
- * go of a runtime that still had something outstanding. Reported under
159
- * `phase: "discard"`, never raised.
160
- *
161
- * It exists so "is this fatal?" has ONE definition — `error instanceof
162
- * RuntimeDiscardNotice` — that the default sink can ask about any error from any
163
- * site. The phase cannot answer it: a report site attaches the phase, so a
164
- * consumer sink that throws while handling a `"discard"` report carries that
165
- * phase into the sink-failure path, and a phase-keyed warn branch would swallow
166
- * the sink's own defect. Sub-classing is how a new teardown fact opts into the
167
- * warn-only treatment; nothing else can.
168
- */
169
- declare abstract class RuntimeDiscardNotice extends Error {
170
- }
171
- /**
172
- * Reported to the `OnError` sink under `phase: "discard"` when `stop()` is
173
- * called while `interpret` handlers are still awaiting. The host is dropping
174
- * its only handle on that work: `stop()` drains the tail, but the listeners,
175
- * observers and event handlers that would have consumed the resulting
176
- * transitions are gone, so the Cmds' results reach nobody.
177
- *
178
- * The motivating shape is `@demlik/tea/react`'s `useMachine`, which memoizes on
179
- * `[machine, ctx, store]` — a ctx re-derived mid-flight replaces the runtime,
180
- * and the in-flight mutation's response arrives for a runtime the UI no longer
181
- * renders, silently rewinding the visible state. Never a throw: tearing a
182
- * runtime down mid-flight is legal (a navigation does it every time), so this
183
- * is surfaced as data, not raised. Mechanizes invariant 6 (no silent failures)
184
- * at the teardown seam, the role `QuiescenceTimeoutError` plays for `idle()`.
185
- */
186
- declare class RuntimeDiscardedError extends RuntimeDiscardNotice {
187
- readonly pendingCmds: number;
188
- readonly name = "RuntimeDiscardedError";
189
- readonly _tag: "RuntimeDiscardedError";
190
- constructor(pendingCmds: number);
191
- }
192
- /**
193
- * Reported to the `OnError` sink under `phase: "identity-drop"` when the
194
- * `Identity` filter drops a message addressed to a different instance.
195
- *
196
- * The drop itself is the feature — it is what lets a reducer stop repeating
197
- * `if (msg.runId !== state.runId) return`. What was missing is that it was
198
- * INVISIBLE: the dispatch resolved exactly like an applied one, so a reusable
199
- * Durable Object serving run A and then run B lost every run-B message and
200
- * reported success to each caller. The comment claiming "the one observable
201
- * enforcement point" described this notice before it existed.
202
- *
203
- * Never fatal (`RuntimeDiscardNotice`): a mis-addressed message is a normal
204
- * consequence of instance reuse, not a defect. A host that wants to act on it
205
- * — a metric, a 409 to the caller, a re-route — reads `phase: "identity-drop"`
206
- * in its own sink.
207
- */
208
- declare class IdentityDropNotice extends RuntimeDiscardNotice {
209
- readonly msgType: string;
210
- readonly name = "IdentityDropNotice";
211
- readonly _tag: "IdentityDropNotice";
212
- constructor(msgType: string);
213
- }
214
- /**
215
- * Reported to the `OnError` sink under `phase: "discard"` when `stop()`'s wait
216
- * for async teardown work hits `disposeTimeoutMs`.
217
- *
218
- * `stop()` awaits the disposals it started so `await runtime.stop()` can mean
219
- * "safe to evict". A `release` that never settles must not turn that guarantee
220
- * into a host that never shuts down, so the wait is bounded and expiry is
221
- * REPORTED rather than silently tolerated — the resource is genuinely still
222
- * open at that point, and only the host can decide what that costs.
223
- */
224
- declare class DisposeTimeoutNotice extends RuntimeDiscardNotice {
225
- readonly pendingDisposals: number;
226
- readonly timeoutMs: number;
227
- readonly name = "DisposeTimeoutNotice";
228
- readonly _tag: "DisposeTimeoutNotice";
229
- constructor(pendingDisposals: number, timeoutMs: number);
230
- }
231
- /**
232
- * The rejection of a dispatch that arrived DURING `stop()`'s drain — an in-flight
233
- * interpret handler's follow-up Msg, a detached handler's terminal Msg, or a Sub
234
- * that is still live because subs are torn down only after the drain. The stop
235
- * barrier is absolute (the Msg is refused, never folded), so this names the loss.
236
- *
237
- * It is the SECOND witness of `RuntimeDiscardedError`'s fact, and it is why the
238
- * drain window is a distinct runtime state rather than a plain `stopped` flag:
239
- * a Msg refused inside the window was discarded BY the teardown, while the same
240
- * refusal after `stop()` has returned is a consumer dispatching into a runtime it
241
- * already retired — a real error, and still loud (`phase: "follow-up"`, or the
242
- * caller's own rejection). The distinction is the state at refusal time, never
243
- * the message text.
244
- */
245
- declare class DispatchDiscardedError extends RuntimeDiscardNotice {
246
- readonly msgType: string;
247
- readonly name = "DispatchDiscardedError";
248
- readonly _tag: "DispatchDiscardedError";
249
- constructor(msgType: string);
250
- }
251
- /**
252
- * Define a typed port. `name` is metadata (devtools / debug logs); port identity
253
- * is by reference. Each definePort call must use a unique `name` — a second call
254
- * with the same name throws `PortNameCollisionError`. Use ports for "data leaving
255
- * the runtime selectively" (cursor announcements, DOM-mutation broadcasts,
256
- * telemetry) that should NOT be folded into State. Strengthens invariant 7.
257
- */
258
- declare function definePort<T>(name: string): Port<T>;
259
- interface Store<S> {
260
- load(): Promise<unknown>;
261
- save(state: S): Promise<void>;
262
- migrate(raw: unknown): S | null;
263
- }
264
- interface Schema<S> {
265
- safeParse(raw: unknown): {
266
- success: true;
267
- data: S;
268
- } | {
269
- success: false;
270
- };
271
- }
272
- /**
273
- * Build a `Store.migrate` from a schema (job 1) and an optional thin `upcast`
274
- * (job 2). `upcast` maps a recognized-but-OLD raw shape forward into the shape
275
- * the schema validates; it defaults to identity (no version migration yet).
276
- *
277
- * Never throws — a shape the schema rejects returns `null`, the substrate's
278
- * fresh-boot path, per the `Store.migrate` contract. An `upcast` that itself
279
- * throws on a corrupt blob is caught and collapses to `null` (same posture).
280
- */
281
- declare function schemaMigrate<S>(schema: Schema<S>, upcast?: (raw: unknown) => unknown): (raw: unknown) => S | null;
282
- type DispatchSettle = "quiescent" | "once";
283
- interface RuntimeRef<M extends {
284
- type: string;
285
- }> {
286
- /**
287
- * Put a Msg in the runtime's inbox and resolve once processed. Runs to
288
- * QUIESCENCE by default: settles only after the dispatched Msg AND every
289
- * transitive interpret follow-up has drained. Pass `{ settle: "once" }` (or
290
- * call `dispatchOnce`) for the single-step case.
291
- *
292
- * Rejection ordering: the ONE dispatched transition's own failure surfaces
293
- * first, here. If it succeeds but the follow-up chain never stabilizes, the
294
- * quiescent drain rejects with `QuiescenceTimeoutError`. Follow-up Msg
295
- * rejections themselves route to the `onError` sink, never here.
296
- */
297
- dispatch(msg: M, opts?: {
298
- readonly settle?: DispatchSettle;
299
- }): Promise<void>;
300
- /**
301
- * Dispatch `msg` and resolve after exactly ONE transition's effects settle,
302
- * WITHOUT draining the follow-up chain — equivalent to
303
- * `dispatch(msg, { settle: "once" })`. Prefer plain `dispatch` unless you will
304
- * `await runtime.idle()` yourself; the un-awaited follow-up chain is the
305
- * footgun the quiescent default removed.
306
- */
307
- dispatchOnce(msg: M): Promise<void>;
308
- }
309
- interface BootingRuntime<S, M extends {
310
- type: string;
311
- }, E extends {
312
- type: string;
313
- } = never> extends RuntimeRef<M> {
314
- dispatch(msg: M, opts?: {
315
- readonly settle?: DispatchSettle;
316
- }): Promise<void>;
317
- dispatchOnce(msg: M): Promise<void>;
318
- subscribe(listener: () => void): () => void;
319
- observe(observer: (msg: M, state: S) => void): () => void;
320
- /**
321
- * Subscribe to the INITIAL State — the boot transition. Fires exactly once:
322
- * immediately if boot already completed (so a late subscriber never misses
323
- * it), otherwise on the boot fanout. Returns a cleanup (a no-op once fired).
324
- */
325
- onBoot(handler: (state: S) => void): () => void;
326
- /**
327
- * Subscribe to a SEMANTIC event of `type`. The handler receives exactly the
328
- * `E` member whose `type` matches `K`, so a consumer never touches another
329
- * event's shape and never references the machine's PRIVATE Msg names. Multiple
330
- * handlers per type; fanout is synchronous and throw-isolated. Fires only when
331
- * the machine's `events` projector (wired on `run`) emits that type.
332
- */
333
- on<K extends E["type"]>(type: K, handler: (event: Extract<E, {
334
- type: K;
335
- }>) => void): () => void;
336
- /**
337
- * Subscribe to a typed Port. Multiple listeners per port; fanout is synchronous
338
- * and isolated. Ports are for "data leaving the runtime selectively" (see
339
- * `definePort`) — distinct from `observe` (every transition) and State.
340
- */
341
- subscribePort<T>(port: Port<T>, listener: (value: T) => void): () => void;
342
- /**
343
- * Emit a value on a Port from OUTSIDE an interpret handler — same synchronous
344
- * fanout as `ctx.emit`. The canonical use is `observe`-driven emission (one
345
- * runtime publishing a state-derived signal another subscribes to via
346
- * `subscribePort`) without spawning a "tell the outside world" Cmd per
347
- * transition.
348
- */
349
- emitPort<T>(port: Port<T>, value: T): void;
350
- /**
351
- * Resolves to the booted `Runtime<S, M>` after boot completes (or rejects with
352
- * the boot error). This is the ONLY way to obtain a `Runtime` — and a
353
- * `Runtime` is the only handle whose `getState()` is total. Awaiting `ready` is
354
- * the single gate between "boot in flight" and "State exists":
355
- *
356
- * ```ts
357
- * const runtime = await run(machine, opts).ready;
358
- * runtime.getState(); // total — never throws-before-boot
359
- * ```
360
- *
361
- * Idempotent — the same settled promise, resolving to the same `Runtime`, comes
362
- * back on every read. Expresses canon §2.3 (boot is a named, awaitable moment).
363
- */
364
- ready: Promise<Runtime<S, M, E>>;
365
- stop(): Promise<void>;
366
- }
367
- interface Runtime<S, M extends {
368
- type: string;
369
- }, E extends {
370
- type: string;
371
- } = never> extends BootingRuntime<S, M, E> {
372
- /**
373
- * The current State. TOTAL — never throws. Obtaining a `Runtime` requires
374
- * awaiting `ready`, which only resolves AFTER boot has run `init` and set the
375
- * initial State.
376
- */
377
- getState(): S;
378
- /** Resolves to this same `Runtime` once boot completes. Idempotent. */
379
- ready: Promise<Runtime<S, M, E>>;
380
- /**
381
- * Resolves once the runtime has reached QUIESCENCE — every dispatched Msg AND
382
- * every transitive interpret follow-up has been processed, with no further step
383
- * pending on the tail. Since plain `dispatch` already runs to quiescence, this
384
- * is mainly for follow-ups left by a `dispatchOnce` single step, or a chain
385
- * kicked off by a Sub / boot `init` cmds with no `dispatch` to await.
386
- *
387
- * Idempotent and re-entrant-safe. Tail rejections are NOT surfaced here (a
388
- * failing dispatch surfaces on its OWN promise; follow-up rejections route to
389
- * `onError`). The one rejection `idle()` produces is `QuiescenceTimeoutError`
390
- * on hitting the iteration cap — so a livelock stays distinguishable from a
391
- * genuine quiesce (invariant 6). A poll is still correct when waiting on an
392
- * EXTERNAL event the runtime cannot enqueue itself.
393
- */
394
- idle(): Promise<void>;
395
- /**
396
- * The terminal State of the run, or `undefined` while in flight — "terminal"
397
- * per the `terminal` predicate passed to `run()` (no predicate → never
398
- * terminal → always `undefined`). The first-class result read: the run's
399
- * product off the State the machine already owns, NOT scraped off the `observe`
400
- * firehose by matching an internal Msg name. Total — never throws.
401
- */
402
- result(): S | undefined;
403
- /**
404
- * Resolves with the terminal State the first time the run reaches one (per the
405
- * `terminal` predicate). If ALREADY terminal, resolves immediately; otherwise
406
- * on the transition that first makes `terminal` hold. The awaitable companion
407
- * to `result()`. With no predicate this never resolves. Idempotent and
408
- * multi-caller safe.
409
- */
410
- done(): Promise<S>;
411
- }
412
- declare function defineMachine<S, M extends {
413
- type: string;
414
- }, C extends Cmd, U extends Sub, Ctx>(m: Omit<Machine<S, M, C, U, Ctx>, "update"> & {
415
- update: [S] extends [{
416
- type: string;
417
- }] ? Transitions<S, M, C> : never;
418
- }): Machine<S, M, C, U, Ctx>;
419
- declare function defineMachine<S, M extends {
420
- type: string;
421
- }, C extends Cmd, U extends Sub, Ctx>(m: Omit<Machine<S, M, C, U, Ctx>, "update"> & {
422
- update: Reducer<S, M, C>;
423
- }): Machine<S, M, C, U, Ctx>;
424
- declare function asReducer<S, M extends {
425
- type: string;
426
- }, C extends Cmd>(reducer: Reducer<S, M, C>): Branded<Reducer<S, M, C>>;
427
- type CtxArg<Ctx> = [Record<never, never>] extends [Ctx] ? {
428
- ctx?: Ctx;
429
- } : {
430
- ctx: Ctx;
431
- };
432
- declare function replay<S, M extends {
433
- type: string;
434
- }, C extends Cmd, U extends Sub, Ctx>(machine: Machine<S, M, C, U, Ctx>, opts: {
435
- msgs: readonly M[];
436
- ctx: Ctx;
437
- loaded?: S | null;
438
- }): {
439
- state: S;
440
- cmds: C[];
441
- subs: U[];
442
- depSubs: {
443
- index: number;
444
- id: string;
445
- }[];
446
- };
447
- declare function wrapDetached<C extends Cmd, M extends {
448
- type: string;
449
- }, Allowed extends M, Ctx>(handler: InterpretDetached<C, Allowed, Ctx>): (cmd: C, ctx: Ctx & PortEmitter, dispatch?: (msg: M) => void) => Promise<void>;
450
- /**
451
- * `applyCell` with the missing-cell case in the return type.
452
- *
453
- * `Ok` carries the cell's `[nextState, cmds]` verbatim; `Err` carries the same
454
- * `NoCellError` (msg.type + state name) `applyCell` would have thrown. Dispatch
455
- * inside `run` keeps using the throwing `applyCell` — this is for callers that
456
- * step a machine themselves.
457
- */
458
- declare function tryApplyCell<S, M extends {
459
- type: string;
460
- }, C extends Cmd>(machine: {
461
- update: object;
462
- __form?: UpdateForm;
463
- }, state: S, msg: M): Result<readonly [S, readonly C[]], NoCellError>;
464
- /**
465
- * The refusal `tryFoldMsgs` reports: WHICH msg in the log had no cell, where.
466
- *
467
- * A plain record, not a new `Error` subclass — it is a `Result` payload, never
468
- * thrown, and the actual error is the existing `NoCellError` it carries. The
469
- * package's thrown-error idiom (`class extends Error` + `_tag`, pinned by
470
- * `error-idiom.test.ts`) applies to errors raised at the runtime edge; this one
471
- * is never raised, so adding a class would state a promise it does not make.
472
- */
473
- interface FoldRefusal<M> {
474
- /** Index into the `msgs` array the fold was given. */
475
- readonly index: number;
476
- /** The offending Msg itself — so the caller can print it, not just point. */
477
- readonly msg: M;
478
- /** The underlying cell-lookup failure, carrying msg.type + state name. */
479
- readonly error: NoCellError;
480
- }
481
- /**
482
- * `foldMsgs` with the missing-cell case in the return type, INCLUDING which
483
- * message failed.
484
- *
485
- * The motivating use is "this persisted log does not replay — tell the user
486
- * where". A bare `Result<S, NoCellError>` cannot: the error names the msg.type
487
- * and the state, but a log usually contains that type many times, so the
488
- * INDEX is the load-bearing fact. The fold stops at the first refusal (state
489
- * past that point is not defined) and returns it.
490
- *
491
- * Shares `foldMsgs`' dev-mode discipline: `deepFreeze` the input state,
492
- * `assertPureResult` the cell's return. Both compile out of production.
493
- */
494
- declare function tryFoldMsgs<S, M extends {
495
- type: string;
496
- }, C extends Cmd>(machine: {
497
- update: object;
498
- __form?: UpdateForm;
499
- }, base: S, msgs: readonly M[]): Result<S, FoldRefusal<M>>;
500
- declare function tryInterpret<C extends Cmd, Ok, M, Ctx>(work: (cmd: C, ctx: Ctx) => Promise<Ok>, onOk: (value: Ok, cmd: C) => M, onErr: (error: unknown, cmd: C) => M): (cmd: C, ctx: Ctx) => Promise<M>;
501
-
502
- export { type BootingRuntime as B, type CtxArg as C, DispatchDiscardedError as D, type FoldRefusal as F, IdentityDropNotice as I, type OnError as O, PortNameCollisionError as P, QuiescenceTimeoutError as Q, type Runtime as R, type Store as S, __resetPortRegistry as _, type Supervision as a, type Branded as b, type DispatchSettle as c, DisposeTimeoutNotice as d, RuntimeDiscardNotice as e, RuntimeDiscardedError as f, type RuntimeErrorContext as g, type RuntimeErrorPhase as h, type RuntimeRef as i, type Schema as j, SubIdCollisionError as k, type SupervisionStrategy as l, absurd as m, asReducer as n, defineMachine as o, definePort as p, noop as q, replay as r, schemaMigrate as s, tryApplyCell as t, tryFoldMsgs as u, tryInterpret as v, wrapDetached as w };