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