@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,484 +0,0 @@
1
- import { D as DeliveryId, E as EffectLedgerEvent } from '../durable-effects-D8SqU_if.js';
2
- export { a as EffectConfirmed, b as EffectOwed, e as emptyLedger } from '../durable-effects-D8SqU_if.js';
3
- import { C as Cmd } from '../core-Bjc0bS8j.js';
4
-
5
- declare function routeWorkflowMsg<A, R, F>(wf: Workflow<A, R, F>, state: WorkflowState<A, R, F>, msg: WorkflowMsg<R, F>): WorkflowReducerStep<A, R, F>;
6
-
7
- /**
8
- * @packageDocumentation
9
- * @demlik/tea/workflow — the durable-workflow runtime core (#124, the first
10
- * Phase-1 slice of the Temporal-style durable-workflow engine, epic #118).
11
- *
12
- * A workflow is a long-running, multi-step transaction whose every step (an
13
- * **activity**) is a side effect that may evict the actor mid-flight. The
14
- * substrate already solves "a state survives eviction" (the event-sourced
15
- * store) and "an owed effect survives eviction" (the `do/` pending-effects
16
- * ledger, #67). This module composes those two into the third primitive: a
17
- * **pure TEA reducer over a workflow's progress**, where each step is dispatched
18
- * as a durable owed effect and the next step is decided only after the previous
19
- * one's result is folded back in. That is exactly Temporal's contract — a
20
- * deterministic workflow function whose activities are the only impurity, so a
21
- * replay of the event log re-decides every step identically.
22
- *
23
- * The mapping onto TEA, mirroring `../raft`:
24
- *
25
- * - **Reducer** — {@link createWorkflow}'s verbs (`init`, `onActivityOk`,
26
- * `onActivityErr`) are the transition function over {@link WorkflowState}.
27
- * PURE: they read no clock and no RNG. Wall time, randomness, retries — all
28
- * impurity lives in the consumer's injected *interpret cell* (the thing that
29
- * actually performs the activity `Cmd` and dispatches its result `Msg`).
30
- * A workflow driven by a recorded result schedule re-decides bit-for-bit —
31
- * the headline replay-determinism payoff (acceptance criterion 4).
32
- * - **Cmd** — the activity dispatch is an {@link ActivityCmd}, recorded on the
33
- * #67 ledger as an `effect_owed` BEFORE it is performed and `effect_confirmed`
34
- * on its result. This module emits the Cmd literals; it performs NO side
35
- * effects. The owed/confirmed events are persisted into the same log the
36
- * reducer folds, so the ledger (and thus "which activity is still owed")
37
- * rebuilds for free on cold wake — re-emit-on-wake is idempotent by the
38
- * ledger's monotonic delivery id (acceptance criterion 3).
39
- * - **Msg** — an activity result (`activity_ok` / `activity_err`) is a `Msg`
40
- * the consumer routes back into a verb. The verb folds the result, records
41
- * the completed step, and advances to the next activity (or to `completed`
42
- * when the sequence is exhausted).
43
- *
44
- * **Invalid states unrepresentable.** The in-flight activity (`current`, with
45
- * its delivery id) lives ONLY on the `running` variant of {@link WorkflowState}.
46
- * A `completed` workflow carries its final output and no current activity; a
47
- * `failed` one carries its failure and no current activity. So "the current
48
- * activity exists only while running" is a type-level guarantee, not a runtime
49
- * convention (acceptance criterion 1).
50
- *
51
- * **Boundary with `@demlik/tea/saga` — the compensation test.** Both drive an
52
- * ordered multi-step transaction with reverse-order compensation (#125 here);
53
- * the line between them is whether every step carries a true inverse. Here
54
- * {@link WorkflowStep.compensation} is OPTIONAL — an irreversible step (a sent
55
- * email) is simply SKIPPED during the unwind, and the run still reaches a
56
- * terminal state. Saga's `SagaStep<D, U>` REQUIRES both `do` and `undo` — a
57
- * step without its inverse is unrepresentable, so full reversibility is a
58
- * type-level guarantee. Pick by the test: **every step must be reversible →
59
- * saga; some steps are irreversible but the run must finish → workflow.**
60
- * Cross to saga when you want the type system to enforce that every step can
61
- * be undone; stay here when the transaction includes steps that can't be.
62
- *
63
- * This module is the pure reducer only — like `../raft/index.ts` is the pure
64
- * Raft reducer with the DO grain deferred to its `./do` sibling (here #126).
65
- *
66
- * Generic over three opaque payloads, like raft's command generic: the activity
67
- * descriptor `A` (what a step asks to do — the consumer's interpret cell knows
68
- * how to perform it), the activity result `R`, and the failure `F`. The reducer
69
- * never inspects them; it only sequences them.
70
- *
71
- * NOT a substrate primitive: it depends only on the core `Cmd` type and the
72
- * sibling `../do` durable-effects ledger. Consumers reach it via the
73
- * `@demlik/tea/workflow` subpath.
74
- */
75
-
76
- /**
77
- * One step of a workflow: a named activity descriptor. `A` is the opaque
78
- * payload the consumer's interpret cell knows how to perform (an HTTP call, a
79
- * sibling-grain message, a tool round-trip). The reducer never inspects
80
- * `activity` — it only sequences the steps and correlates results.
81
- *
82
- * A step may declare a **compensation** — the inverse activity that undoes the
83
- * forward one (cancel the reservation, refund the charge). Compensation is the
84
- * `{ do, undo }` pair of `@demlik/tea/saga` mapped onto the workflow: the step's
85
- * `activity` is the `do`, its `compensation` is the `undo`. The pair is the unit
86
- * of reversibility — a step that completed (its forward activity succeeded) is
87
- * exactly a step whose `compensation` must run, in reverse order, if a LATER
88
- * step fails (#125). A step WITHOUT a compensation contributes nothing to the
89
- * unwind: it is skipped during the reverse walk (an irreversible step — a sent
90
- * email — that the saga model treats as a no-op `undo`).
91
- */
92
- interface WorkflowStep<A> {
93
- /** Stable, human-readable step name — appears in the completed-step record. */
94
- readonly name: string;
95
- /** The opaque activity this step performs. Interpreted by the consumer. */
96
- readonly activity: A;
97
- /**
98
- * The opaque compensating (inverse) activity, performed in reverse order on a
99
- * downstream failure (#125). Optional: a step with no compensation is skipped
100
- * during the unwind. Interpreted by the consumer's interpret cell, exactly
101
- * like {@link activity}.
102
- */
103
- readonly compensation?: A;
104
- }
105
- /**
106
- * A workflow's step sequence at construction — a NON-EMPTY tuple. A workflow
107
- * with nothing to do reaches `completed` only by carrying a final result, and an
108
- * empty sequence produces none, so "≥ 1 step" is a precondition. Encoding it as
109
- * `readonly [WorkflowStep<A>, ...WorkflowStep<A>[]]` makes the empty case a
110
- * COMPILE error at every construction boundary (`init`, `foldWorkflow`,
111
- * `workflowGrain`) — parse-don't-validate, so the reducer never needs a runtime
112
- * throw to reject a resultless workflow.
113
- */
114
- type WorkflowSteps<A> = readonly [WorkflowStep<A>, ...WorkflowStep<A>[]];
115
- /**
116
- * A completed step: the step that ran plus the result its activity produced.
117
- * The `running` state accumulates these in execution order, so the full
118
- * forward history is available to the consumer (and to #125's compensation,
119
- * which will walk it in reverse).
120
- */
121
- interface CompletedStep<A, R> {
122
- readonly step: WorkflowStep<A>;
123
- readonly result: R;
124
- }
125
- /** The activity currently in flight on a `running` workflow. */
126
- interface InFlightActivity<A> {
127
- /** The 0-based index of this step in the workflow's step sequence. */
128
- readonly index: number;
129
- /** The step whose activity is in flight. */
130
- readonly step: WorkflowStep<A>;
131
- /** The #67 ledger delivery id this activity was owed under (the dedup key). */
132
- readonly id: DeliveryId;
133
- }
134
- /**
135
- * The compensation currently in flight on a `compensating` workflow (#125). The
136
- * mirror of {@link InFlightActivity} for the reverse walk: exactly one
137
- * compensation is owed at a time, on the SAME #67 ledger, with its own monotonic
138
- * delivery id. `index` is the index (into `completed`/`steps`) of the step being
139
- * undone — the unwind walks these from high to low (strict reverse order).
140
- */
141
- interface InFlightCompensation<A> {
142
- /** The 0-based index (into the step sequence) of the step being compensated. */
143
- readonly index: number;
144
- /** The step whose compensation is in flight. */
145
- readonly step: WorkflowStep<A>;
146
- /** The #67 ledger delivery id this compensation was owed under (the dedup key). */
147
- readonly id: DeliveryId;
148
- }
149
- /**
150
- * A workflow in progress. Carries the ordered `completed` steps (forward
151
- * history), the `steps` it is sequencing, and the `current` in-flight activity
152
- * (with its ledger delivery id). `completed.length === current.index` always
153
- * holds — the current activity is the next step after the last completed one.
154
- */
155
- interface RunningWorkflow<A, R> {
156
- readonly status: "running";
157
- /** The full, static step sequence this workflow runs. */
158
- readonly steps: readonly WorkflowStep<A>[];
159
- /** Steps that have produced a result, in execution order. */
160
- readonly completed: readonly CompletedStep<A, R>[];
161
- /** The single activity in flight right now. */
162
- readonly current: InFlightActivity<A>;
163
- }
164
- /**
165
- * A workflow that ran every step to completion. `output` is the result of the
166
- * final step — the workflow's overall output. No activity is in flight.
167
- */
168
- interface CompletedWorkflow<A, R> {
169
- readonly status: "completed";
170
- readonly steps: readonly WorkflowStep<A>[];
171
- /** Every step, in execution order, with its result. */
172
- readonly completed: readonly CompletedStep<A, R>[];
173
- /** The final step's result — the workflow's output. */
174
- readonly output: R;
175
- }
176
- /**
177
- * A workflow that failed on an activity with NOTHING to compensate — the
178
- * forward failure happened with zero completed steps (the first activity
179
- * failed). `failedStep` is the step whose activity reported the failure;
180
- * `failure` is the opaque failure payload. `completed` is empty by construction:
181
- * a failure WITH completed steps pivots into {@link CompensatingWorkflow}
182
- * instead, so `failed` is precisely the empty-rollback terminal (the analogue
183
- * of saga's `aborted` reached straight from the first step). No activity is in
184
- * flight; this is terminal (#125 acceptance criterion 3).
185
- */
186
- interface FailedWorkflow<A, R, F> {
187
- readonly status: "failed";
188
- readonly steps: readonly WorkflowStep<A>[];
189
- /** Empty by construction — a failure with completed steps compensates instead. */
190
- readonly completed: readonly CompletedStep<A, R>[];
191
- /** The step whose activity failed. */
192
- readonly failedStep: WorkflowStep<A>;
193
- /** The opaque failure the activity reported. */
194
- readonly failure: F;
195
- }
196
- /**
197
- * A workflow unwinding after a forward failure (#125): the compensations of the
198
- * `completed` steps are being emitted in STRICT REVERSE order, one at a time, on
199
- * the same #67 ledger. The analogue of saga's `compensating` phase.
200
- *
201
- * `current` is the single compensation in flight (the mirror of `running`'s
202
- * in-flight activity). `compensated` records, in unwind order, the completed
203
- * steps whose compensation has confirmed — the reverse-walk's progress log, so
204
- * a cold wake resumes mid-rollback exactly. `failedStep`/`failure` carry the
205
- * forward failure that triggered the unwind (verbatim, never interpreted),
206
- * preserved for the consumer to read and to fold onto the terminal state.
207
- *
208
- * Invariant: the unwind walks `completed` from its tail toward index 0, skipping
209
- * steps with no compensation, so `current.index` is strictly below the index of
210
- * every entry in `compensated`.
211
- */
212
- interface CompensatingWorkflow<A, R, F> {
213
- readonly status: "compensating";
214
- readonly steps: readonly WorkflowStep<A>[];
215
- /** The completed forward steps, in execution order — the history being unwound. */
216
- readonly completed: readonly CompletedStep<A, R>[];
217
- /** The step whose forward activity failed, triggering the unwind. */
218
- readonly failedStep: WorkflowStep<A>;
219
- /** The opaque forward failure that triggered the unwind. Carried, never interpreted. */
220
- readonly failure: F;
221
- /** The single compensation in flight right now. */
222
- readonly current: InFlightCompensation<A>;
223
- /** Completed steps whose compensation has confirmed, in unwind (reverse) order. */
224
- readonly compensated: readonly CompletedStep<A, R>[];
225
- }
226
- /**
227
- * A workflow that failed forward and then fully unwound: every completed step's
228
- * compensation confirmed, in reverse order. Terminal. The analogue of saga's
229
- * `aborted` (fully unwound) — named `failed_compensated` to align with #125's
230
- * vocabulary. No activity or compensation is in flight.
231
- */
232
- interface FailedCompensatedWorkflow<A, R, F> {
233
- readonly status: "failed_compensated";
234
- readonly steps: readonly WorkflowStep<A>[];
235
- /** The forward steps that completed (and were each compensated), in execution order. */
236
- readonly completed: readonly CompletedStep<A, R>[];
237
- /** The step whose forward activity failed, triggering the (now-finished) unwind. */
238
- readonly failedStep: WorkflowStep<A>;
239
- /** The opaque forward failure that triggered compensation. Carried, never interpreted. */
240
- readonly failure: F;
241
- }
242
- /**
243
- * A workflow whose ROLLBACK itself failed: a compensation activity reported a
244
- * failure mid-unwind. Terminal, PARTIALLY unwound — the analogue of saga's
245
- * `compensation_failed`. A failed compensation is a real-world fact (a refund
246
- * that bounced, a hold that won't release) that must become visible terminal
247
- * state, never a workflow wedged in `compensating` forever.
248
- *
249
- * `compensated` is left intact (the steps already rolled back); `uncompensated`
250
- * is the step whose compensation bounced PLUS the steps still owed a
251
- * compensation behind it — exactly what the consumer must reconcile by hand.
252
- * `compensationFailure` is the rollback failure (distinct from `failure`, the
253
- * forward failure that started the unwind), carried verbatim.
254
- */
255
- interface CompensationFailedWorkflow<A, R, F> {
256
- readonly status: "compensation_failed";
257
- readonly steps: readonly WorkflowStep<A>[];
258
- /** The full completed-forward history, in execution order. */
259
- readonly completed: readonly CompletedStep<A, R>[];
260
- /** The step whose forward activity failed, triggering the unwind. */
261
- readonly failedStep: WorkflowStep<A>;
262
- /** The opaque forward failure that triggered compensation. Carried, never interpreted. */
263
- readonly failure: F;
264
- /** Completed steps successfully compensated before the rollback broke, in unwind order. */
265
- readonly compensated: readonly CompletedStep<A, R>[];
266
- /** The step whose compensation bounced. Its forward effect stands un-reversed. */
267
- readonly failedCompensationStep: WorkflowStep<A>;
268
- /** The opaque rollback failure (distinct from {@link failure}). Carried, never interpreted. */
269
- readonly compensationFailure: F;
270
- }
271
- /**
272
- * The workflow's state — a discriminated union on `status`. The current
273
- * in-flight activity is reachable ONLY through `running`, and the in-flight
274
- * compensation ONLY through `compensating`, making "an in-flight effect exists
275
- * only while the workflow is actively driving one" unrepresentable to violate.
276
- */
277
- type WorkflowState<A, R, F> = RunningWorkflow<A, R> | CompletedWorkflow<A, R> | FailedWorkflow<A, R, F> | CompensatingWorkflow<A, R, F> | FailedCompensatedWorkflow<A, R, F> | CompensationFailedWorkflow<A, R, F>;
278
- /** Every `status` discriminant of the {@link WorkflowState} union. */
279
- type WorkflowStatus = WorkflowState<unknown, unknown, unknown>["status"];
280
- /**
281
- * The runtime accept-set of every {@link WorkflowStatus} — the single source of
282
- * truth the boundary snapshot parse keys off (see `do.ts`). Built from an
283
- * exhaustive `Record<WorkflowStatus, true>`, so adding a variant to the union
284
- * above without listing it here is a COMPILE error: the set can never silently
285
- * drift from the union again (the #312 regression, where the #125 compensation
286
- * statuses were missing and evicted-mid-rollback grains re-seeded fresh).
287
- */
288
- declare const WORKFLOW_STATUSES: ReadonlySet<string>;
289
- /**
290
- * Dispatch the in-flight activity. Routed through the consumer's `interpret`
291
- * over an injected activity port. The reducer emits this literal; it performs
292
- * no side effect. The result MUST be dispatched back as a Msg carrying `id`.
293
- */
294
- interface ActivityCmd<A> extends Cmd<"workflow_activity"> {
295
- /** The 0-based step index this activity belongs to. */
296
- readonly index: number;
297
- /** The #67 delivery id the result Msg must echo (the dedup key). */
298
- readonly id: DeliveryId;
299
- /** The opaque activity to perform. */
300
- readonly activity: A;
301
- }
302
- /**
303
- * Dispatch a compensation (#125). Same shape + ledger discipline as
304
- * {@link ActivityCmd} — a compensation is just another durable owed effect on
305
- * the same #67 ledger, with its own delivery id — but the consumer's interpret
306
- * cell performs the inverse `compensation` payload, and the result is dispatched
307
- * back as a {@link CompensationOk}/{@link CompensationErr} carrying the SAME id.
308
- * Distinguished by `type` so the consumer routes forward vs. inverse work to the
309
- * right port, and the re-emit-on-wake stays type-correct.
310
- */
311
- interface CompensationCmd<A> extends Cmd<"workflow_compensation"> {
312
- /** The 0-based step index whose compensation this is. */
313
- readonly index: number;
314
- /** The #67 delivery id the result Msg must echo (the dedup key). */
315
- readonly id: DeliveryId;
316
- /** The opaque compensating (inverse) activity to perform. */
317
- readonly compensation: A;
318
- }
319
- /** The Cmd union this module emits: forward activity dispatches AND (#125)
320
- * reverse compensation dispatches. The owed/confirmed ledger events are not
321
- * `WorkflowCmd`s — they are Msg variants persisted into the event log (see
322
- * {@link EffectLedgerEvent}); the {@link WorkflowReducerStep} tuple carries them out
323
- * alongside the dispatch Cmd so the host persists owed-before-dispatch. Both
324
- * Cmd kinds are owed effects on the same ledger, so `survivingActivities`
325
- * re-emits either kind on cold wake. */
326
- type WorkflowCmd<A> = ActivityCmd<A> | CompensationCmd<A>;
327
- /** An activity succeeded: `id` echoes the {@link ActivityCmd} it answers; the
328
- * reducer matches it against `current.id`, records the completed step, and
329
- * advances. */
330
- interface ActivityOk<R> {
331
- readonly type: "activity_ok";
332
- readonly id: DeliveryId;
333
- readonly result: R;
334
- }
335
- /** An activity failed (retries already exhausted by the consumer's interpret
336
- * cell — this module does not retry). `id` echoes the {@link ActivityCmd};
337
- * the reducer begins compensation (or settles `failed` when nothing has
338
- * completed). */
339
- interface ActivityErr<F> {
340
- readonly type: "activity_err";
341
- readonly id: DeliveryId;
342
- readonly failure: F;
343
- }
344
- /** A compensation succeeded (#125): the inverse activity took. `id` echoes the
345
- * {@link CompensationCmd} it answers; the reducer matches it against the
346
- * in-flight compensation's id, records the step as compensated, and either
347
- * emits the next compensation (continuing in reverse) or settles
348
- * `failed_compensated` when the unwind is complete. A compensation produces no
349
- * result the workflow carries — its only signal is "the undo took". */
350
- interface CompensationOk {
351
- readonly type: "compensation_ok";
352
- readonly id: DeliveryId;
353
- }
354
- /** A compensation itself failed (#125): the inverse activity bounced (a refund
355
- * that won't go through). `id` echoes the {@link CompensationCmd}; the reducer
356
- * halts the rollback at the terminal `compensation_failed` state — never wedged
357
- * in `compensating` forever. */
358
- interface CompensationErr<F> {
359
- readonly type: "compensation_err";
360
- readonly id: DeliveryId;
361
- readonly failure: F;
362
- }
363
- /** The Msg union the reducer folds: forward activity results AND (#125) reverse
364
- * compensation results. */
365
- type WorkflowMsg<R, F> = ActivityOk<R> | ActivityErr<F> | CompensationOk | CompensationErr<F>;
366
- /** Every `type` discriminant tag of the {@link WorkflowMsg} union. */
367
- type WorkflowMsgType = WorkflowMsg<unknown, unknown>["type"];
368
- /**
369
- * The runtime accept-set of every {@link WorkflowMsgType} — the single source of
370
- * truth the boundary replay parse keys off (see `do.ts`). Built from an
371
- * exhaustive `Record<WorkflowMsgType, true>`, so adding a Msg variant to the
372
- * union above without listing it here is a COMPILE error: the set can never
373
- * silently drift from the union again (the #312 regression, where the #125
374
- * compensation result tags were missing and dropped from replay).
375
- */
376
- declare const WORKFLOW_MSG_TYPES: ReadonlySet<string>;
377
- /** A workflow reducer step: the next state, the ledger events to persist
378
- * (owed-before-dispatch), and the activity Cmds to dispatch. */
379
- interface WorkflowReducerStep<A, R, F> {
380
- readonly state: WorkflowState<A, R, F>;
381
- /** Ledger events to persist into the event log, in order, BEFORE `cmds`. */
382
- readonly ledger: readonly EffectLedgerEvent<WorkflowCmd<A>>[];
383
- /** Activity dispatch Cmds, after the ledger events are durable. */
384
- readonly cmds: readonly WorkflowCmd<A>[];
385
- }
386
- /** The hook bag returned by {@link createWorkflow}. Spread its verbs into a
387
- * machine; `init(steps)` seeds a fresh workflow and emits the first activity,
388
- * the verbs fold results and advance, and `survivingActivities` re-emits the
389
- * owed-but-unconfirmed dispatch on cold wake (idempotent by delivery id). */
390
- interface Workflow<A, R, F> {
391
- /**
392
- * Seed a fresh workflow over `steps` (a NON-EMPTY {@link WorkflowSteps}) and
393
- * dispatch its first activity → `running` with `current` = step 0, owed on the
394
- * ledger. The "≥ 1 step" precondition is carried by the tuple type: an empty
395
- * sequence is a compile error at the call site, not a runtime throw here — a
396
- * workflow with nothing to do could never reach `completed` (no final result
397
- * to carry), so it is unrepresentable by construction.
398
- */
399
- init(steps: WorkflowSteps<A>): WorkflowReducerStep<A, R, F>;
400
- /**
401
- * Fold an activity success. If `msg.id` does not match the in-flight
402
- * activity's id (a stale/duplicate result from re-emit-on-wake, or a result
403
- * for an already-advanced step), the state is returned UNCHANGED with no
404
- * effects — idempotent by delivery id (acceptance criterion 3). Otherwise:
405
- * record the completed step, confirm the owed activity on the ledger, and
406
- * either advance to the next step (owing its activity) or transition to
407
- * `completed` carrying the final result.
408
- *
409
- * Only meaningful on `running`; a result arriving for a terminal workflow is
410
- * a no-op (the workflow is done — at-least-once tolerates the late echo).
411
- */
412
- onActivityOk(state: WorkflowState<A, R, F>, msg: ActivityOk<R>): WorkflowReducerStep<A, R, F>;
413
- /**
414
- * Fold an activity failure (#125). Same id-match idempotency guard as
415
- * {@link onActivityOk}. On a match: confirm the owed activity on the ledger,
416
- * then PIVOT into compensation — walk the completed-step history in strict
417
- * reverse and owe the first declared compensation as a durable effect on the
418
- * same ledger, transitioning to `compensating`. If NO completed step declares
419
- * a compensation (the empty-rollback edge — the first activity failed, or
420
- * every completed step is irreversible), settle `failed` directly with
421
- * nothing to unwind.
422
- */
423
- onActivityErr(state: WorkflowState<A, R, F>, msg: ActivityErr<F>): WorkflowReducerStep<A, R, F>;
424
- /**
425
- * Fold a compensation success (#125). Same id-match idempotency guard against
426
- * the in-flight compensation. On a match: confirm the owed compensation,
427
- * record the step as compensated, and continue the reverse walk — owe the
428
- * next declared compensation strictly below the step just undone, or settle
429
- * `failed_compensated` when the unwind is complete. Only meaningful on
430
- * `compensating`; a result for a terminal/forward workflow is a no-op.
431
- */
432
- onCompensationOk(state: WorkflowState<A, R, F>, msg: CompensationOk): WorkflowReducerStep<A, R, F>;
433
- /**
434
- * Fold a compensation failure (#125). Same id-match idempotency guard. On a
435
- * match: confirm the owed compensation and HALT the rollback at the terminal
436
- * `compensation_failed` state — a bounced compensation is visible terminal
437
- * state to reconcile by hand, never a workflow wedged in `compensating`
438
- * forever. Mirrors `@demlik/tea/saga`'s `undoErr`.
439
- */
440
- onCompensationErr(state: WorkflowState<A, R, F>, msg: CompensationErr<F>): WorkflowReducerStep<A, R, F>;
441
- /**
442
- * The owed-but-unconfirmed dispatch(es) to re-emit on activation — a forward
443
- * activity OR (#125) a compensation, rebuilt by folding the persisted ledger
444
- * events. On a fresh / fully-settled workflow this is empty. The re-fired Cmd
445
- * carries the SAME delivery id, so a duplicate result is a no-op at the
446
- * reducer (the id-match guard). This is the cold-wake re-emit that makes both
447
- * activities AND compensations exactly-once-observable despite the
448
- * at-least-once transport (acceptance criterion 2 & 3) — including a
449
- * compensation owed mid-rollback when the actor was evicted.
450
- */
451
- survivingActivities(ledgerEvents: Iterable<EffectLedgerEvent<WorkflowCmd<A>>>): readonly WorkflowCmd<A>[];
452
- }
453
- /**
454
- * Build a workflow hook bag. The factory captures NO clock and NO RNG — pure
455
- * bookkeeping over the injected #67 recorder, exactly like
456
- * `pendingEffectsLedger`. `restore` rehydrates the monotonic delivery-id
457
- * counter from the persisted ledger events on cold wake, so re-dispatched
458
- * activities resume their ids without gaps.
459
- *
460
- * @param restore - the persisted ledger events (read back from the log) and/or
461
- * the last issued delivery id, so the id counter resumes gap-free. Omit for a
462
- * fresh workflow.
463
- */
464
- declare function createWorkflow<A, R, F>(restore?: {
465
- readonly events?: Iterable<EffectLedgerEvent<WorkflowCmd<A>>>;
466
- readonly lastId?: DeliveryId;
467
- }): Workflow<A, R, F>;
468
- /**
469
- * Replay a workflow from its event log: seed over `steps`, then fold each
470
- * activity-result `Msg` in order. Returns the final {@link WorkflowState}.
471
- *
472
- * Determinism: a freshly-constructed {@link createWorkflow} reissues delivery
473
- * ids monotonically from 0, and the reducer reads no ambient state — so two
474
- * calls with the same `steps` + `msgs` return deeply-equal states (and equal
475
- * `JSON.stringify`). This is the byte-identity property #124 pins.
476
- *
477
- * Note this folds ONLY the result Msgs; the `init` dispatch + per-step
478
- * owe/confirm ledger events are an internal effect channel reconstructed by the
479
- * fresh recorder, not part of the replayed Msg log — exactly as the activity
480
- * results are the only thing the consumer records and replays.
481
- */
482
- declare function foldWorkflow<A, R, F>(steps: WorkflowSteps<A>, msgs: Iterable<WorkflowMsg<R, F>>): WorkflowState<A, R, F>;
483
-
484
- export { type ActivityCmd, type ActivityErr, type ActivityOk, type CompensatingWorkflow, type CompensationCmd, type CompensationErr, type CompensationFailedWorkflow, type CompensationOk, type CompletedStep, type CompletedWorkflow, DeliveryId, EffectLedgerEvent, type FailedCompensatedWorkflow, type FailedWorkflow, type InFlightActivity, type InFlightCompensation, type RunningWorkflow, WORKFLOW_MSG_TYPES, WORKFLOW_STATUSES, type Workflow, type WorkflowCmd, type WorkflowMsg, type WorkflowMsgType, type WorkflowReducerStep, type WorkflowState, type WorkflowStatus, type WorkflowStep, type WorkflowSteps, createWorkflow, foldWorkflow, routeWorkflowMsg };