@demlik/tea 0.13.0 → 0.15.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 (373) 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-RH5EFRVJ.js → chunk-22POWGFA.js} +31 -5
  5. package/dist/chunk-22POWGFA.js.map +1 -0
  6. package/dist/{chunk-DMYGQB4O.js → chunk-3B5X7SBB.js} +23 -6
  7. package/dist/chunk-3B5X7SBB.js.map +1 -0
  8. package/dist/chunk-66PY5WYF.js +1816 -0
  9. package/dist/chunk-66PY5WYF.js.map +1 -0
  10. package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
  11. package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
  12. package/dist/chunk-AYS5N6WY.js +505 -0
  13. package/dist/chunk-AYS5N6WY.js.map +1 -0
  14. package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
  15. package/dist/chunk-HWVW4AXC.js.map +1 -0
  16. package/dist/{chunk-O4MVQTEJ.js → chunk-L3TND7LA.js} +20 -16
  17. package/dist/chunk-L3TND7LA.js.map +1 -0
  18. package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
  19. package/dist/chunk-LFZUK6J2.js.map +1 -0
  20. package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
  21. package/dist/chunk-MYXFNWAJ.js.map +1 -0
  22. package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
  23. package/dist/chunk-PR6TB3BL.js.map +1 -0
  24. package/dist/{chunk-YUXP55T2.js → chunk-Q5CQTBFA.js} +57 -7
  25. package/dist/chunk-Q5CQTBFA.js.map +1 -0
  26. package/dist/{batch-window/index.js → chunk-QPEVCJ5Q.js} +4 -8
  27. package/dist/chunk-QPEVCJ5Q.js.map +1 -0
  28. package/dist/chunk-TCLBCERH.js +1480 -0
  29. package/dist/chunk-TCLBCERH.js.map +1 -0
  30. package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
  31. package/dist/chunk-TXN2KFHF.js.map +1 -0
  32. package/dist/{chunk-MUUROGIH.js → chunk-V46HSVCK.js} +62 -12
  33. package/dist/chunk-V46HSVCK.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-ZVJZ72HY.js → chunk-VTQI2NHP.js} +25 -11
  37. package/dist/chunk-VTQI2NHP.js.map +1 -0
  38. package/dist/{core-Co0LWkIA.d.ts → core-DnzqWy6u.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 +43 -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-CWzA-o2B.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 +1284 -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/index-Bc40JWVl.d.ts +131 -0
  55. package/dist/{batch-window/index.d.ts → index-C2DwkjlP.d.ts} +7 -12
  56. package/dist/index-CA_7I5g9.d.ts +806 -0
  57. package/dist/index-CSyMYDAB.d.ts +69 -0
  58. package/dist/{fan-out/index.d.ts → index-CuNO9m8i.d.ts} +7 -9
  59. package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
  60. package/dist/{recorder/index.d.ts → index-DrIRb_Ch.d.ts} +4 -7
  61. package/dist/index-HSYgG2Yt.d.ts +380 -0
  62. package/dist/{monitored-run/index.d.ts → index-KXqTRJyb.d.ts} +37 -13
  63. package/dist/{snapshot/index.d.ts → index-ZCMhnVKN.d.ts} +15 -78
  64. package/dist/index.d.ts +771 -6
  65. package/dist/index.js +1 -2
  66. package/dist/jev/index.d.ts +646 -0
  67. package/dist/jev/index.js +485 -0
  68. package/dist/jev/index.js.map +1 -0
  69. package/dist/machine-DGlPWCWI.d.ts +1781 -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 +140 -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/{protocol-B5YmJr0d.d.ts → protocol-D8VbH-VH.d.ts} +10 -1
  90. package/dist/react/index.d.ts +2 -2
  91. package/dist/react/index.js +1 -2
  92. package/dist/react/index.js.map +1 -1
  93. package/dist/resilience/index.d.ts +744 -0
  94. package/dist/resilience/index.js +657 -0
  95. package/dist/resilience/index.js.map +1 -0
  96. package/dist/retry-backoff/index.d.ts +3 -2
  97. package/dist/retry-backoff/index.js +1 -1
  98. package/dist/runtime-types-CMF13BBh.d.ts +998 -0
  99. package/dist/testing/index.d.ts +147 -3
  100. package/dist/testing/index.js +95 -3
  101. package/dist/testing/index.js.map +1 -1
  102. package/dist/{throttled-input → timing}/index.d.ts +143 -12
  103. package/dist/{throttled-input → timing}/index.js +57 -12
  104. package/dist/timing/index.js.map +1 -0
  105. package/dist/{types-XS_miRnB.d.ts → types-BseNPIhr.d.ts} +1 -1
  106. package/dist/work-queue/index.d.ts +130 -54
  107. package/dist/work-queue/index.js +3 -2
  108. package/dist/work-queue/index.js.map +1 -1
  109. package/package.json +45 -218
  110. package/dist/authed-call/index.d.ts +0 -120
  111. package/dist/authed-call/index.js +0 -134
  112. package/dist/authed-call/index.js.map +0 -1
  113. package/dist/await-terminal/index.d.ts +0 -101
  114. package/dist/await-terminal/index.js +0 -76
  115. package/dist/await-terminal/index.js.map +0 -1
  116. package/dist/batch-window/index.js.map +0 -1
  117. package/dist/cache/index.d.ts +0 -152
  118. package/dist/cache/index.js +0 -8
  119. package/dist/chart/index.d.ts +0 -218
  120. package/dist/chart/index.js +0 -16
  121. package/dist/chart/index.js.map +0 -1
  122. package/dist/chart/inspect/index.d.ts +0 -86
  123. package/dist/chart/inspect/index.js +0 -5
  124. package/dist/chart/inspect/react.d.ts +0 -113
  125. package/dist/chart/inspect/react.js +0 -11
  126. package/dist/chart/inspect/react.js.map +0 -1
  127. package/dist/chart/inspect/styles.css +0 -286
  128. package/dist/chart/lane/index.d.ts +0 -362
  129. package/dist/chart/lane/index.js +0 -9
  130. package/dist/chart/lane/index.js.map +0 -1
  131. package/dist/chart/lane/react.d.ts +0 -84
  132. package/dist/chart/lane/react.js +0 -559
  133. package/dist/chart/lane/react.js.map +0 -1
  134. package/dist/chart/lane/server.d.ts +0 -148
  135. package/dist/chart/lane/server.js +0 -209
  136. package/dist/chart/lane/server.js.map +0 -1
  137. package/dist/chart/lane/styles.css +0 -498
  138. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
  139. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
  140. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
  141. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
  142. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
  143. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
  144. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
  145. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
  146. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
  147. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
  148. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
  149. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
  150. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
  151. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
  152. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
  153. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
  154. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
  155. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
  156. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
  157. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
  158. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
  159. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
  160. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
  161. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
  162. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
  163. package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
  164. package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
  165. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
  166. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
  167. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
  168. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
  169. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
  170. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
  171. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
  172. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
  173. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
  174. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
  175. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
  176. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
  177. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
  178. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
  179. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
  180. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
  181. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
  182. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
  183. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
  184. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
  185. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
  186. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
  187. package/dist/chart/lane/viewer/index.html +0 -15
  188. package/dist/chart/report/index.d.ts +0 -117
  189. package/dist/chart/report/index.js +0 -32
  190. package/dist/chart/report/index.js.map +0 -1
  191. package/dist/chunk-2YFLOCWX.js +0 -15
  192. package/dist/chunk-2YFLOCWX.js.map +0 -1
  193. package/dist/chunk-3I52QZZ5.js +0 -519
  194. package/dist/chunk-3I52QZZ5.js.map +0 -1
  195. package/dist/chunk-3ZAFFRRB.js +0 -457
  196. package/dist/chunk-3ZAFFRRB.js.map +0 -1
  197. package/dist/chunk-4EQZ76JC.js +0 -33
  198. package/dist/chunk-4EQZ76JC.js.map +0 -1
  199. package/dist/chunk-4KLG43GY.js +0 -223
  200. package/dist/chunk-4KLG43GY.js.map +0 -1
  201. package/dist/chunk-7FRZ2CT2.js +0 -424
  202. package/dist/chunk-7FRZ2CT2.js.map +0 -1
  203. package/dist/chunk-AZZLE7XR.js +0 -62
  204. package/dist/chunk-AZZLE7XR.js.map +0 -1
  205. package/dist/chunk-BYQUGDD3.js +0 -16
  206. package/dist/chunk-BYQUGDD3.js.map +0 -1
  207. package/dist/chunk-CIQG5L42.js +0 -685
  208. package/dist/chunk-CIQG5L42.js.map +0 -1
  209. package/dist/chunk-CLM6ERNO.js +0 -61
  210. package/dist/chunk-CLM6ERNO.js.map +0 -1
  211. package/dist/chunk-COS5MSTO.js +0 -88
  212. package/dist/chunk-COS5MSTO.js.map +0 -1
  213. package/dist/chunk-CRPZJVD2.js +0 -71
  214. package/dist/chunk-CRPZJVD2.js.map +0 -1
  215. package/dist/chunk-D62FDQKE.js +0 -53
  216. package/dist/chunk-D62FDQKE.js.map +0 -1
  217. package/dist/chunk-D736QUGF.js.map +0 -1
  218. package/dist/chunk-DGE4PV4A.js +0 -26
  219. package/dist/chunk-DGE4PV4A.js.map +0 -1
  220. package/dist/chunk-DMYGQB4O.js.map +0 -1
  221. package/dist/chunk-EWJP3YYP.js.map +0 -1
  222. package/dist/chunk-FV3Z5MBE.js.map +0 -1
  223. package/dist/chunk-HCEVHFJ7.js +0 -54
  224. package/dist/chunk-HCEVHFJ7.js.map +0 -1
  225. package/dist/chunk-J6527VRQ.js.map +0 -1
  226. package/dist/chunk-JELSZN25.js +0 -47
  227. package/dist/chunk-JELSZN25.js.map +0 -1
  228. package/dist/chunk-K575PT4S.js.map +0 -1
  229. package/dist/chunk-L57ZOT5K.js +0 -184
  230. package/dist/chunk-L57ZOT5K.js.map +0 -1
  231. package/dist/chunk-MU6MCIAC.js +0 -15
  232. package/dist/chunk-MU6MCIAC.js.map +0 -1
  233. package/dist/chunk-MUUROGIH.js.map +0 -1
  234. package/dist/chunk-NR7BU22N.js +0 -758
  235. package/dist/chunk-NR7BU22N.js.map +0 -1
  236. package/dist/chunk-O4MVQTEJ.js.map +0 -1
  237. package/dist/chunk-OOYD44JI.js +0 -317
  238. package/dist/chunk-OOYD44JI.js.map +0 -1
  239. package/dist/chunk-Q2UM7BXU.js.map +0 -1
  240. package/dist/chunk-RH5EFRVJ.js.map +0 -1
  241. package/dist/chunk-S2EGRPCM.js +0 -47
  242. package/dist/chunk-S2EGRPCM.js.map +0 -1
  243. package/dist/chunk-SINXE47Y.js +0 -55
  244. package/dist/chunk-SINXE47Y.js.map +0 -1
  245. package/dist/chunk-UF4MZSLT.js +0 -53
  246. package/dist/chunk-UF4MZSLT.js.map +0 -1
  247. package/dist/chunk-UOC2PL46.js +0 -13
  248. package/dist/chunk-UOC2PL46.js.map +0 -1
  249. package/dist/chunk-VYFAZN3F.js +0 -372
  250. package/dist/chunk-VYFAZN3F.js.map +0 -1
  251. package/dist/chunk-WRAA7GVZ.js +0 -209
  252. package/dist/chunk-WRAA7GVZ.js.map +0 -1
  253. package/dist/chunk-XGELA764.js +0 -163
  254. package/dist/chunk-XGELA764.js.map +0 -1
  255. package/dist/chunk-YUXP55T2.js.map +0 -1
  256. package/dist/chunk-YWIKDKHY.js +0 -307
  257. package/dist/chunk-YWIKDKHY.js.map +0 -1
  258. package/dist/chunk-ZJ5AOYBH.js +0 -8
  259. package/dist/chunk-ZJ5AOYBH.js.map +0 -1
  260. package/dist/chunk-ZSUUOEPL.js +0 -731
  261. package/dist/chunk-ZSUUOEPL.js.map +0 -1
  262. package/dist/chunk-ZVJZ72HY.js.map +0 -1
  263. package/dist/circuit-breaker/index.d.ts +0 -197
  264. package/dist/circuit-breaker/index.js +0 -3
  265. package/dist/circuit-breaker/index.js.map +0 -1
  266. package/dist/deadline/index.d.ts +0 -199
  267. package/dist/deadline/index.js +0 -6
  268. package/dist/deadline/index.js.map +0 -1
  269. package/dist/debounce/index.js +0 -3
  270. package/dist/debounce/index.js.map +0 -1
  271. package/dist/extension/react.d.ts +0 -121
  272. package/dist/extension/react.js +0 -75
  273. package/dist/extension/react.js.map +0 -1
  274. package/dist/extension/subs/index.d.ts +0 -45
  275. package/dist/extension/subs/index.js +0 -80
  276. package/dist/extension/subs/index.js.map +0 -1
  277. package/dist/extension/test-utils.d.ts +0 -128
  278. package/dist/extension/test-utils.js +0 -277
  279. package/dist/extension/test-utils.js.map +0 -1
  280. package/dist/fan-out/index.js +0 -5
  281. package/dist/fan-out/index.js.map +0 -1
  282. package/dist/fold-BJPdjc9w.d.ts +0 -435
  283. package/dist/graph-B3L5e0N1.d.ts +0 -923
  284. package/dist/idempotency/adapter.d.ts +0 -62
  285. package/dist/idempotency/adapter.js +0 -4
  286. package/dist/idempotency/adapter.js.map +0 -1
  287. package/dist/idempotent-intake/index.d.ts +0 -188
  288. package/dist/idempotent-intake/index.js +0 -7
  289. package/dist/idempotent-intake/index.js.map +0 -1
  290. package/dist/journal/index.d.ts +0 -373
  291. package/dist/journal/index.js +0 -3
  292. package/dist/journal/index.js.map +0 -1
  293. package/dist/llm-call/index.d.ts +0 -311
  294. package/dist/llm-call/index.js +0 -16
  295. package/dist/llm-call/index.js.map +0 -1
  296. package/dist/machine-BtFWQmmq.d.ts +0 -804
  297. package/dist/monitored-run/index.js +0 -10
  298. package/dist/monitored-run/index.js.map +0 -1
  299. package/dist/paginated-walk/index.d.ts +0 -235
  300. package/dist/paginated-walk/index.js +0 -16
  301. package/dist/paginated-walk/index.js.map +0 -1
  302. package/dist/paginator/index.js +0 -3
  303. package/dist/paginator/index.js.map +0 -1
  304. package/dist/pbt/arbitraries/index.d.ts +0 -136
  305. package/dist/pbt/arbitraries/index.js +0 -3
  306. package/dist/pbt/arbitraries/index.js.map +0 -1
  307. package/dist/pbt/runners/index.d.ts +0 -118
  308. package/dist/pbt/runners/index.js +0 -5
  309. package/dist/pbt/runners/index.js.map +0 -1
  310. package/dist/poller/index.d.ts +0 -352
  311. package/dist/poller/index.js +0 -115
  312. package/dist/poller/index.js.map +0 -1
  313. package/dist/prediction/index.d.ts +0 -131
  314. package/dist/prediction/index.js +0 -4
  315. package/dist/prediction/index.js.map +0 -1
  316. package/dist/pure/index.d.ts +0 -3
  317. package/dist/pure/index.js +0 -4
  318. package/dist/pure/index.js.map +0 -1
  319. package/dist/rate-limit/index.d.ts +0 -115
  320. package/dist/rate-limit/index.js +0 -3
  321. package/dist/rate-limit/index.js.map +0 -1
  322. package/dist/reconciler/index.d.ts +0 -193
  323. package/dist/reconciler/index.js +0 -164
  324. package/dist/reconciler/index.js.map +0 -1
  325. package/dist/recorder/index.js +0 -3
  326. package/dist/recorder/index.js.map +0 -1
  327. package/dist/reducer-4GNR6b8B.d.ts +0 -447
  328. package/dist/resilient-call/index.d.ts +0 -320
  329. package/dist/resilient-call/index.js +0 -14
  330. package/dist/resilient-call/index.js.map +0 -1
  331. package/dist/retry-to-success/index.d.ts +0 -109
  332. package/dist/retry-to-success/index.js +0 -37
  333. package/dist/retry-to-success/index.js.map +0 -1
  334. package/dist/run-pAcmBpah.d.ts +0 -713
  335. package/dist/runtime-types-CNLmhWif.d.ts +0 -517
  336. package/dist/saga/index.d.ts +0 -241
  337. package/dist/saga/index.js +0 -150
  338. package/dist/saga/index.js.map +0 -1
  339. package/dist/samples-B3My5oh2.d.ts +0 -59
  340. package/dist/snapshot/index.js +0 -5
  341. package/dist/snapshot/index.js.map +0 -1
  342. package/dist/subs/index.d.ts +0 -472
  343. package/dist/subs/index.js +0 -7
  344. package/dist/subs/index.js.map +0 -1
  345. package/dist/throttle/index.d.ts +0 -134
  346. package/dist/throttle/index.js +0 -3
  347. package/dist/throttle/index.js.map +0 -1
  348. package/dist/throttled-input/index.js.map +0 -1
  349. package/dist/token-refresh/index.d.ts +0 -216
  350. package/dist/token-refresh/index.js +0 -6
  351. package/dist/token-refresh/index.js.map +0 -1
  352. package/dist/trace-replay/index.js +0 -6
  353. package/dist/trace-replay/index.js.map +0 -1
  354. package/dist/with-deadline/index.d.ts +0 -197
  355. package/dist/with-deadline/index.js +0 -111
  356. package/dist/with-deadline/index.js.map +0 -1
  357. package/dist/with-resilience/index.d.ts +0 -225
  358. package/dist/with-resilience/index.js +0 -240
  359. package/dist/with-resilience/index.js.map +0 -1
  360. package/dist/with-telemetry/index.d.ts +0 -150
  361. package/dist/with-telemetry/index.js +0 -70
  362. package/dist/with-telemetry/index.js.map +0 -1
  363. package/dist/work-queue/adapter.d.ts +0 -84
  364. package/dist/work-queue/adapter.js +0 -4
  365. package/dist/work-queue/adapter.js.map +0 -1
  366. package/dist/work-queue/ops.d.ts +0 -71
  367. package/dist/work-queue/ops.js +0 -3
  368. package/dist/work-queue/ops.js.map +0 -1
  369. package/dist/workflow/index.d.ts +0 -485
  370. package/dist/workflow/index.js +0 -244
  371. package/dist/workflow/index.js.map +0 -1
  372. /package/dist/{cache → paginate}/index.js.map +0 -0
  373. /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
@@ -1,758 +0,0 @@
1
- import { chartMermaid, edgeKey } from './chunk-YWIKDKHY.js';
2
-
3
- // src/chart/report/draw.ts
4
- function drawTask(chart, opts = {}) {
5
- return chartMermaid(chart, {
6
- polarity: true,
7
- ...opts.current === void 0 ? {} : { highlight: opts.current },
8
- ...opts.walked === void 0 ? {} : { walked: opts.walked }
9
- });
10
- }
11
- function walkedEdges(steps) {
12
- const counts = /* @__PURE__ */ new Map();
13
- for (const step of steps) {
14
- counts.set(step.edge, (counts.get(step.edge) ?? 0) + 1);
15
- }
16
- return counts;
17
- }
18
-
19
- // src/chart/report/workflow.ts
20
- var bareEvent = (event) => {
21
- const dot = event.indexOf(".");
22
- return dot === -1 ? event : event.slice(dot + 1);
23
- };
24
- var WorkflowImportError = class extends Error {
25
- constructor(defects) {
26
- super(
27
- `@demlik/tea: this workflow.json does not compile to charts \u2014
28
- ` + defects.map((d) => ` \u2022 ${d}`).join("\n")
29
- );
30
- this.defects = defects;
31
- }
32
- defects;
33
- name = "WorkflowImportError";
34
- _tag = "WorkflowImportError";
35
- };
36
- var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
37
- var nodeType = (node) => isRecord(node) && typeof node.type === "string" ? node.type : void 0;
38
- var RETRY_BUDGET = 2;
39
- var DEFAULT_GUARD = "retries remain";
40
- function importRegion(taskId, region) {
41
- const defects = [];
42
- if (!isRecord(region) || !isRecord(region.states) || typeof region.initial !== "string") {
43
- return {
44
- defects: [
45
- `task "${taskId}": region must carry string \`initial\` and \`states\``
46
- ]
47
- };
48
- }
49
- const states = region.states;
50
- const initialState = region.initial;
51
- if (states[initialState] === void 0) {
52
- defects.push(
53
- `task "${taskId}": initial state "${initialState}" is not in \`states\``
54
- );
55
- }
56
- const finals = /* @__PURE__ */ new Set();
57
- for (const [name, node] of Object.entries(states)) {
58
- if (nodeType(node) === "final") finals.add(name);
59
- }
60
- const errorFinals = /* @__PURE__ */ new Set();
61
- const on = {};
62
- for (const [stateName, node] of Object.entries(states)) {
63
- if (nodeType(node) === "history") continue;
64
- const edges = {};
65
- on[stateName] = edges;
66
- if (!isRecord(node)) {
67
- defects.push(`task "${taskId}": state "${stateName}" is not an object`);
68
- continue;
69
- }
70
- const raw = node.on ?? {};
71
- if (!isRecord(raw)) {
72
- defects.push(
73
- `task "${taskId}": state "${stateName}" carries a non-object \`on\``
74
- );
75
- continue;
76
- }
77
- const spelledAs = /* @__PURE__ */ new Map();
78
- for (const [eventName, transition] of Object.entries(raw)) {
79
- const event = bareEvent(eventName);
80
- if (event === "") {
81
- defects.push(
82
- `task "${taskId}": state "${stateName}" listens for "${eventName}", which names no event once its namespace is stripped`
83
- );
84
- continue;
85
- }
86
- const already = spelledAs.get(event);
87
- if (already !== void 0) {
88
- defects.push(
89
- `task "${taskId}": state "${stateName}" spells the same event twice \u2014 "${already}" and "${eventName}" are both \`${event}\`, and a state routes each event once`
90
- );
91
- continue;
92
- }
93
- spelledAs.set(event, eventName);
94
- if (Array.isArray(transition)) {
95
- const arms = transition.map(
96
- (arm) => isRecord(arm) && typeof arm.target === "string" ? arm.target : void 0
97
- );
98
- const [retry, fallthrough] = arms;
99
- if (transition.length !== 2 || retry === void 0 || fallthrough === void 0) {
100
- defects.push(
101
- `task "${taskId}": guarded "${eventName}" must be a two-arm array of \`{target}\` \u2014 [retry-while-retries-remain, else-fallthrough]`
102
- );
103
- continue;
104
- }
105
- for (const target of [retry, fallthrough]) {
106
- if (states[target] === void 0) {
107
- defects.push(
108
- `task "${taskId}": "${eventName}" targets unknown state "${target}"`
109
- );
110
- }
111
- }
112
- if (finals.has(fallthrough)) errorFinals.add(fallthrough);
113
- const head = transition[0];
114
- const when = isRecord(head) && typeof head.guard === "string" ? head.guard : DEFAULT_GUARD;
115
- edges[event] = { target: retry, when, otherwise: fallthrough };
116
- continue;
117
- }
118
- if (typeof transition !== "string") {
119
- defects.push(
120
- `task "${taskId}": "${eventName}" is neither a target nor a guarded array`
121
- );
122
- continue;
123
- }
124
- if (states[transition] === void 0) {
125
- defects.push(
126
- `task "${taskId}": "${eventName}" targets unknown state "${transition}"`
127
- );
128
- continue;
129
- }
130
- edges[event] = nodeType(states[transition]) === "history" ? { resume: { fallback: initialState } } : { target: transition };
131
- }
132
- }
133
- if (defects.length > 0) return { defects };
134
- const out = {};
135
- for (const [name, node] of Object.entries(states)) {
136
- if (nodeType(node) === "history") continue;
137
- const edges = on[name] ?? {};
138
- const isFinal = finals.has(name);
139
- out[name] = {
140
- ...name === initialState ? { initial: true } : {},
141
- ...Object.keys(edges).length > 0 ? { on: edges } : {},
142
- ...isFinal ? { end: errorFinals.has(name) ? "error" : true } : {}
143
- };
144
- }
145
- return { node: out, defects: [] };
146
- }
147
- function onDoneTargets(phaseName, onDone) {
148
- const defect = `phase "${phaseName}": \`onDone\` must be a two-arm array of \`{target}\` \u2014 [{target, guard}, {target}]`;
149
- if (!Array.isArray(onDone) || onDone.length !== 2) return { defect };
150
- const [success, trip] = onDone.map(
151
- (arm) => isRecord(arm) && typeof arm.target === "string" ? arm.target : void 0
152
- );
153
- return success === void 0 || trip === void 0 ? { defect } : { targets: [success, trip] };
154
- }
155
- function chartFromWorkflow(document, options = {}) {
156
- const defects = [];
157
- const machineDef = isRecord(document) ? document.machine : void 0;
158
- if (!isRecord(machineDef) || !isRecord(machineDef.states)) {
159
- throw new WorkflowImportError([
160
- "document must carry a `machine.states` object"
161
- ]);
162
- }
163
- const documentContext = isRecord(machineDef.context) ? machineDef.context : {};
164
- const declaredTrigger = isRecord(document) ? document.trigger : void 0;
165
- if (declaredTrigger !== void 0 && typeof declaredTrigger !== "string") {
166
- defects.push(
167
- "document `trigger` must be a string naming what fires this lane"
168
- );
169
- }
170
- const machineStates = machineDef.states;
171
- const charts = {};
172
- const context = {};
173
- const phases = [];
174
- const gateTargets = /* @__PURE__ */ new Set();
175
- let terminals;
176
- for (const [phaseName, node] of Object.entries(machineStates)) {
177
- if (nodeType(node) !== "parallel" || !isRecord(node)) continue;
178
- const regions = node.states;
179
- if (!isRecord(regions) || Object.keys(regions).length === 0) {
180
- defects.push(
181
- `phase "${phaseName}": a parallel phase must carry task regions in \`states\``
182
- );
183
- continue;
184
- }
185
- const phaseTasks = [];
186
- for (const [taskId, region] of Object.entries(regions)) {
187
- const imported = importRegion(taskId, region);
188
- defects.push(...imported.defects);
189
- if (imported.node !== void 0) {
190
- const events = {};
191
- for (const edges of Object.values(imported.node)) {
192
- for (const event of Object.keys(edges.on ?? {})) {
193
- const origin = options.from?.[event];
194
- events[event] = origin === void 0 ? { scope: "edges" } : { scope: "edges", from: origin };
195
- }
196
- }
197
- charts[taskId] = { events, states: { [phaseName]: imported.node } };
198
- }
199
- const ctx = documentContext[taskId];
200
- const bag = isRecord(ctx) ? ctx : {};
201
- const { maxRetries: rawMax, retries: _retries, ...extras } = bag;
202
- context[taskId] = {
203
- maxRetries: typeof rawMax === "number" ? rawMax : RETRY_BUDGET,
204
- extras
205
- };
206
- phaseTasks.push(taskId);
207
- }
208
- phases.push({ name: phaseName, tasks: phaseTasks });
209
- const gate = onDoneTargets(phaseName, node.onDone);
210
- if (gate.defect !== void 0) defects.push(gate.defect);
211
- if (gate.targets !== void 0) {
212
- for (const target of gate.targets) {
213
- gateTargets.add(target);
214
- if (machineStates[target] === void 0) {
215
- defects.push(
216
- `phase "${phaseName}": \`onDone\` targets unknown machine-level state "${target}"`
217
- );
218
- }
219
- }
220
- terminals = { complete: gate.targets[0], tripped: gate.targets[1] };
221
- }
222
- }
223
- for (const [name, node] of Object.entries(machineStates)) {
224
- if (nodeType(node) === "parallel" && isRecord(node)) continue;
225
- if (nodeType(node) !== "final") {
226
- defects.push(
227
- `machine-level state "${name}" is neither a \`parallel\` phase nor a \`final\` terminal`
228
- );
229
- } else if (!gateTargets.has(name)) {
230
- defects.push(
231
- `machine-level final "${name}" is targeted by no phase's \`onDone\` pair`
232
- );
233
- }
234
- }
235
- if (phases.length === 0)
236
- defects.push("machine holds no `parallel` phase state");
237
- if (defects.length > 0) throw new WorkflowImportError(defects);
238
- if (terminals === void 0) {
239
- throw new WorkflowImportError([
240
- "no phase carried a readable `onDone` pair"
241
- ]);
242
- }
243
- const id = isRecord(document) && typeof document.id === "string" ? document.id : void 0;
244
- const lane = {
245
- ...id === void 0 ? {} : { id },
246
- ...typeof declaredTrigger === "string" ? { trigger: declaredTrigger } : {},
247
- phases,
248
- terminals,
249
- charts,
250
- context
251
- };
252
- if (options.strictFrom === true) {
253
- const declared = new Set(eventAlphabet(lane));
254
- const strays = Object.keys(options.from ?? {}).filter(
255
- (event) => !declared.has(event)
256
- );
257
- if (strays.length > 0) {
258
- throw new WorkflowImportError(
259
- strays.map(
260
- (event) => `\`from\` names "${event}", which no state in this document routes \u2014 the map is keyed by the BARE event name`
261
- )
262
- );
263
- }
264
- }
265
- return lane;
266
- }
267
- function chartFromWorkflowText(text, options = {}) {
268
- let parsed;
269
- try {
270
- parsed = JSON.parse(text);
271
- } catch {
272
- throw new WorkflowImportError(["the document is not JSON"]);
273
- }
274
- return chartFromWorkflow(parsed, options);
275
- }
276
- function statesOf(chart) {
277
- const out = /* @__PURE__ */ new Map();
278
- for (const group of Object.values(chart.states)) {
279
- for (const [name, node] of Object.entries(group)) out.set(name, node);
280
- }
281
- return out;
282
- }
283
- function initialOf(chart) {
284
- for (const [name, node] of statesOf(chart)) {
285
- if (node.initial === true) return name;
286
- }
287
- throw new Error("@demlik/tea: imported chart marks no initial state");
288
- }
289
- function eventAlphabet(lane) {
290
- const out = /* @__PURE__ */ new Set();
291
- for (const chart of Object.values(lane.charts)) {
292
- for (const event of Object.keys(chart.events)) out.add(event);
293
- }
294
- return [...out];
295
- }
296
- function originOf(chart, event) {
297
- return chart.events[event]?.from;
298
- }
299
- function endPolarityOf(node) {
300
- if (node?.end === void 0) return false;
301
- return node.end;
302
- }
303
-
304
- // src/chart/report/fold.ts
305
- function walkedEdgeKey(chart, from, event, to) {
306
- const declared = statesOf(chart).get(from)?.on?.[event];
307
- const drawn = declared !== void 0 && "resume" in declared ? declared.resume.fallback : to;
308
- return edgeKey(from, event, drawn);
309
- }
310
- var UnreplayableLogError = class extends Error {
311
- constructor(defects) {
312
- super(
313
- `@demlik/tea: this events log does not replay against this workflow \u2014
314
- ` + defects.map((d) => ` \u2022 ${d}`).join("\n")
315
- );
316
- this.defects = defects;
317
- }
318
- defects;
319
- name = "UnreplayableLogError";
320
- _tag = "UnreplayableLogError";
321
- };
322
- function parseEventsJsonl(text) {
323
- const defects = [];
324
- const entries = [];
325
- for (const [index, line] of text.split("\n").entries()) {
326
- if (line.trim() === "") continue;
327
- let parsed;
328
- try {
329
- parsed = JSON.parse(line);
330
- } catch {
331
- defects.push(`line ${index + 1} is not JSON`);
332
- continue;
333
- }
334
- const entry = asLogEntry(parsed);
335
- if (entry === void 0) {
336
- defects.push(
337
- `line ${index + 1} does not carry string \`task\`/\`event\`/\`at\``
338
- );
339
- continue;
340
- }
341
- entries.push(entry);
342
- }
343
- if (defects.length > 0) throw new UnreplayableLogError(defects);
344
- return entries;
345
- }
346
- function asLogEntry(value) {
347
- if (typeof value !== "object" || value === null) return void 0;
348
- const record = value;
349
- if (typeof record.task !== "string" || typeof record.event !== "string" || typeof record.at !== "string") {
350
- return void 0;
351
- }
352
- return { task: record.task, event: record.event, at: record.at };
353
- }
354
- function parseHistoryJson(text) {
355
- let parsed;
356
- try {
357
- parsed = JSON.parse(text);
358
- } catch {
359
- throw new UnreplayableLogError(["`lane history` output is not JSON"]);
360
- }
361
- if (!Array.isArray(parsed)) {
362
- throw new UnreplayableLogError([
363
- "`lane history` output is not a JSON array of entries"
364
- ]);
365
- }
366
- const entries = [];
367
- for (const [index, raw] of parsed.entries()) {
368
- const entry = asLogEntry(raw);
369
- if (entry === void 0) {
370
- throw new UnreplayableLogError([
371
- `history entry ${index} does not carry string \`task\`/\`event\`/\`at\``
372
- ]);
373
- }
374
- entries.push(entry);
375
- }
376
- return entries;
377
- }
378
- var unknownTaskDefects = (lane, entries) => {
379
- const seen = /* @__PURE__ */ new Set();
380
- const defects = [];
381
- for (const entry of entries) {
382
- if (lane.charts[entry.task] !== void 0 || seen.has(entry.task)) continue;
383
- seen.add(entry.task);
384
- defects.push(
385
- `log names task "${entry.task}", which is not in this lane's machine`
386
- );
387
- }
388
- return defects;
389
- };
390
- var chartOf = (lane, taskId) => {
391
- const chart = lane.charts[taskId];
392
- if (chart === void 0) {
393
- throw new UnreplayableLogError([
394
- `log names task "${taskId}", which is not in this lane's machine`
395
- ]);
396
- }
397
- return chart;
398
- };
399
- function initialStates(lane) {
400
- const out = {};
401
- for (const [taskId, chart] of Object.entries(lane.charts)) {
402
- out[taskId] = {
403
- type: initialOf(chart),
404
- retries: 0,
405
- maxRetries: lane.context[taskId]?.maxRetries ?? RETRY_BUDGET
406
- };
407
- }
408
- return out;
409
- }
410
- function stepTask(chart, state, event, taskId) {
411
- const node = statesOf(chart).get(state.type);
412
- const edge = node?.on?.[event];
413
- if (edge === void 0) {
414
- if (chart.refusals?.[state.type]?.includes(event) === true) return state;
415
- throw new UnreplayableLogError([
416
- `${taskId === void 0 ? "" : `task "${taskId}": `}state "${state.type}" holds no cell for "${event}"`
417
- ]);
418
- }
419
- if ("resume" in edge) {
420
- return { ...state, type: state.was ?? edge.resume.fallback };
421
- }
422
- if ("when" in edge) {
423
- return state.retries < state.maxRetries ? {
424
- ...state,
425
- type: edge.target,
426
- retries: state.retries + 1,
427
- was: state.type
428
- } : { ...state, type: edge.otherwise, was: state.type };
429
- }
430
- return { ...state, type: edge.target, was: state.type };
431
- }
432
- function foldLane(lane, entries) {
433
- const unknown = unknownTaskDefects(lane, entries);
434
- if (unknown.length > 0) throw new UnreplayableLogError(unknown);
435
- const states = { ...initialStates(lane) };
436
- for (const entry of entries) {
437
- const chart = chartOf(lane, entry.task);
438
- const current = states[entry.task];
439
- if (current === void 0) {
440
- throw new UnreplayableLogError([
441
- `log names task "${entry.task}", which is not in this lane's machine`
442
- ]);
443
- }
444
- states[entry.task] = stepTask(
445
- chart,
446
- current,
447
- bareEvent(entry.event),
448
- entry.task
449
- );
450
- }
451
- return states;
452
- }
453
- function timeline(lane, entries) {
454
- const unknown = unknownTaskDefects(lane, entries);
455
- if (unknown.length > 0) throw new UnreplayableLogError(unknown);
456
- const states = { ...initialStates(lane) };
457
- const steps = [];
458
- for (const [index, entry] of entries.entries()) {
459
- const chart = chartOf(lane, entry.task);
460
- const before = states[entry.task];
461
- if (before === void 0) {
462
- throw new UnreplayableLogError([
463
- `log names task "${entry.task}", which is not in this lane's machine`
464
- ]);
465
- }
466
- const event = bareEvent(entry.event);
467
- const after = stepTask(chart, before, event, entry.task);
468
- states[entry.task] = after;
469
- steps.push({
470
- index,
471
- at: entry.at,
472
- task: entry.task,
473
- event: entry.event,
474
- from: before.type,
475
- to: after.type,
476
- edge: walkedEdgeKey(chart, before.type, event, after.type)
477
- });
478
- }
479
- return steps;
480
- }
481
- function trippedTasks(lane, states) {
482
- return Object.keys(states).filter(
483
- (taskId) => endPolarityOf(nodeOf(lane, taskId, states)) === "error"
484
- );
485
- }
486
- function phaseStandings(lane, states) {
487
- const isFinal = (taskId) => endPolarityOf(nodeOf(lane, taskId, states)) !== false;
488
- const errors = trippedTasks(lane, states);
489
- let stopped = false;
490
- return lane.phases.map((phase, index) => {
491
- const tripped = phase.tasks.filter((taskId) => errors.includes(taskId));
492
- const base = { name: phase.name, index, tasks: phase.tasks, tripped };
493
- if (stopped) return { ...base, standing: "waiting" };
494
- if (!phase.tasks.every(isFinal)) {
495
- stopped = true;
496
- return { ...base, standing: "active" };
497
- }
498
- if (tripped.length > 0) {
499
- stopped = true;
500
- return { ...base, standing: "tripped" };
501
- }
502
- return { ...base, standing: "complete" };
503
- });
504
- }
505
- function laneTerminalReached(stands, terminals) {
506
- if (stands.some((stand) => stand.standing === "tripped"))
507
- return terminals.tripped;
508
- if (stands.some((stand) => stand.standing === "active")) return void 0;
509
- return terminals.complete;
510
- }
511
- function deriveLaneStatus(lane, states) {
512
- const errors = trippedTasks(lane, states);
513
- const context = {};
514
- for (const [taskId, state] of Object.entries(states)) {
515
- context[taskId] = {
516
- retries: state.retries,
517
- maxRetries: state.maxRetries,
518
- ...lane.context[taskId]?.extras ?? {}
519
- };
520
- }
521
- context.errors = errors;
522
- const stands = phaseStandings(lane, states);
523
- const terminal = laneTerminalReached(stands, lane.terminals);
524
- if (terminal !== void 0) {
525
- return { stateValue: terminal, status: "done", context };
526
- }
527
- const active = stands.find((stand) => stand.standing === "active");
528
- if (active === void 0) {
529
- return { stateValue: lane.terminals.complete, status: "done", context };
530
- }
531
- const stateValue = {
532
- [active.name]: Object.fromEntries(
533
- active.tasks.map((taskId) => [taskId, states[taskId]?.type ?? "?"])
534
- )
535
- };
536
- for (const stand of stands.slice(active.index + 1)) {
537
- stateValue[stand.name] = "waiting";
538
- }
539
- return { stateValue, status: "active", context };
540
- }
541
- function nodeOf(lane, taskId, states) {
542
- const chart = lane.charts[taskId];
543
- const state = states[taskId];
544
- if (chart === void 0 || state === void 0) return void 0;
545
- return statesOf(chart).get(state.type);
546
- }
547
- function parseStatusJson(text) {
548
- let parsed;
549
- try {
550
- parsed = JSON.parse(text);
551
- } catch {
552
- throw new UnreplayableLogError(["`lane status` output is not JSON"]);
553
- }
554
- if (typeof parsed !== "object" || parsed === null) {
555
- throw new UnreplayableLogError(["`lane status` output is not an object"]);
556
- }
557
- const record = parsed;
558
- if (record.status !== "active" && record.status !== "done") {
559
- throw new UnreplayableLogError([
560
- '`lane status` output carries no `status` of "active" | "done"'
561
- ]);
562
- }
563
- if (record.stateValue === void 0) {
564
- throw new UnreplayableLogError([
565
- "`lane status` output carries no `stateValue`"
566
- ]);
567
- }
568
- return {
569
- stateValue: record.stateValue,
570
- status: record.status,
571
- context: typeof record.context === "object" && record.context !== null ? record.context : {}
572
- };
573
- }
574
-
575
- // src/chart/report/report.ts
576
- var isImportedLane = (v) => typeof v === "object" && v !== null && Array.isArray(v.phases) && typeof v.charts === "object";
577
- function activePhaseName(status) {
578
- if (typeof status.stateValue === "string") return void 0;
579
- for (const [name, value] of Object.entries(status.stateValue)) {
580
- if (typeof value === "object") return name;
581
- }
582
- return void 0;
583
- }
584
- var listed = (events) => events.map((e) => `\`${e}\``).join(", ");
585
- function phrase(origin, state, events) {
586
- if (origin === "cmd") {
587
- return `the work \`${state}\` dispatched \u2014 ${listed(events)}`;
588
- }
589
- if (origin === "sub") {
590
- return `the source \`${state}\` is subscribed to \u2014 ${listed(events)}`;
591
- }
592
- return `${origin.world}'s ${listed(events)}`;
593
- }
594
- var originKey = (origin) => typeof origin === "string" ? origin : `world:${origin.world}`;
595
- function waitingOn(chart, state) {
596
- const node = statesOf(chart).get(state);
597
- if (node?.end !== void 0) return null;
598
- const events = Object.keys(node?.on ?? {});
599
- if (events.length === 0) {
600
- return `\`${state}\` accepts no events, and it is not a final`;
601
- }
602
- const groups = /* @__PURE__ */ new Map();
603
- const undeclared = [];
604
- for (const event of events) {
605
- const origin = originOf(chart, event);
606
- if (origin === void 0) {
607
- undeclared.push(event);
608
- continue;
609
- }
610
- const key = originKey(origin);
611
- const group = groups.get(key);
612
- if (group === void 0) groups.set(key, { origin, events: [event] });
613
- else group.events.push(event);
614
- }
615
- if (groups.size === 0) return `\`${state}\` accepts ${listed(events)}`;
616
- const parts = [...groups.values()].map(
617
- (g) => phrase(g.origin, state, g.events)
618
- );
619
- if (undeclared.length > 0) {
620
- parts.push(`${listed(undeclared)}, from somewhere the chart does not say`);
621
- }
622
- return parts.join(" \xB7 ");
623
- }
624
- function retryLine(chart, state) {
625
- if (state.retries <= 0) return null;
626
- const budget = `${state.retries}/${state.maxRetries}`;
627
- if (state.retries < state.maxRetries) return `**retries:** ${budget}`;
628
- const node = statesOf(chart).get(state.type);
629
- for (const [event, edge] of Object.entries(node?.on ?? {})) {
630
- if ("when" in edge) {
631
- return `**retries:** ${budget} \u2014 spent; one \`${event}\` from \`${edge.otherwise}\``;
632
- }
633
- }
634
- return `**retries:** ${budget} \u2014 spent`;
635
- }
636
- function phaseLine(stand, states) {
637
- const count = `${stand.tasks.length} task${stand.tasks.length === 1 ? "" : "s"}`;
638
- if (stand.standing === "waiting") {
639
- return `**${stand.name}:** waiting \u2014 ${count}, not started.`;
640
- }
641
- const leaves = stand.tasks.map(
642
- (taskId) => `\`${taskId}\` = \`${states[taskId]?.type ?? "?"}\`${stand.tripped.includes(taskId) ? " **(tripped)**" : ""}`
643
- ).join(", ");
644
- return `**${stand.name}:** ${stand.standing} \u2014 ${count}: ${leaves}`;
645
- }
646
- function timelineTable(steps) {
647
- if (steps.length === 0)
648
- return "_no events yet \u2014 the lane is at its initial state._";
649
- const rows = steps.map(
650
- (s) => `| ${s.index + 1} | ${s.at} | \`${s.task}\` | \`${s.event}\` | \`${s.from}\` \u2192 \`${s.to}\` |`
651
- );
652
- return [
653
- "| # | at | task | event | from \u2192 to |",
654
- "|---|---|---|---|---|",
655
- ...rows
656
- ].join("\n");
657
- }
658
- function laneReport(input) {
659
- const lane = isImportedLane(input.workflow) ? input.workflow : chartFromWorkflow(input.workflow);
660
- const entries = input.entries;
661
- const states = foldLane(lane, entries);
662
- const status = input.status ?? deriveLaneStatus(lane, states);
663
- const steps = timeline(lane, entries);
664
- const title = input.title ?? lane.id ?? "lane";
665
- const out = [`## ${title} \u2014 ${status.status}`, ""];
666
- out.push(`**where it is:** ${describeStateValue(status.stateValue)}`);
667
- if (lane.trigger !== void 0) out.push(`**fired by:** \`${lane.trigger}\``);
668
- const errors = status.context.errors;
669
- if (Array.isArray(errors) && errors.length > 0) {
670
- out.push(
671
- `**tripped:** ${errors.map((t) => `\`${String(t)}\``).join(", ")} \u2014 the lane lands on \`${lane.terminals.tripped}\``
672
- );
673
- }
674
- out.push("");
675
- const stands = phaseStandings(lane, states);
676
- const named = activePhaseName(status);
677
- const active = stands.find((s) => s.name === named) ?? stands.find((s) => s.standing === "active");
678
- for (const stand of stands) {
679
- if (stand === active) {
680
- const untouched = [];
681
- for (const taskId of stand.tasks) {
682
- const chart = lane.charts[taskId];
683
- const state = states[taskId];
684
- if (chart === void 0 || state === void 0) continue;
685
- if (state.type === initialOf(chart)) untouched.push(taskId);
686
- }
687
- if (untouched.length === stand.tasks.length) untouched.shift();
688
- for (const taskId of stand.tasks) {
689
- const chart = lane.charts[taskId];
690
- const state = states[taskId];
691
- if (chart === void 0 || state === void 0) continue;
692
- if (untouched.includes(taskId)) continue;
693
- const polarity = endPolarityOf(statesOf(chart).get(state.type));
694
- out.push(
695
- `### ${taskId} \u2014 \`${state.type}\`${polarity === "error" ? " \u2014 TRIPPED" : ""}`
696
- );
697
- const waiting = waitingOn(chart, state.type);
698
- out.push(
699
- waiting !== null ? `**waiting on:** ${waiting}` : polarity === "error" ? (
700
- // The distinction `end: "error"` bought, spent where it is worth
701
- // something: this task is as finished as a shipped one, and the
702
- // phase it is in is going to trip the lane when its siblings
703
- // finish. A report that said "final" for both would bury that.
704
- `**waiting on:** nothing \u2014 this task landed on the error final \`${state.type}\`, and \`${stand.name}\` will trip the lane when its siblings finish.`
705
- ) : "**waiting on:** nothing \u2014 this task is final."
706
- );
707
- const retries = retryLine(chart, state);
708
- if (retries !== null) out.push(retries);
709
- out.push("");
710
- out.push("```mermaid");
711
- out.push(
712
- drawTask(chart, {
713
- current: state.type,
714
- walked: walkedEdges(steps.filter((s) => s.task === taskId))
715
- })
716
- );
717
- out.push("```");
718
- out.push("");
719
- }
720
- if (untouched.length > 0) {
721
- const chart = lane.charts[untouched[0]];
722
- const at = chart === void 0 ? "their entry state" : `\`${initialOf(chart)}\``;
723
- out.push(
724
- `**not started yet:** ${untouched.map((t) => `\`${t}\``).join(", ")} \u2014 still at ${at}.`
725
- );
726
- out.push("");
727
- }
728
- continue;
729
- }
730
- out.push(phaseLine(stand, states));
731
- out.push("");
732
- }
733
- out.push("### timeline");
734
- out.push("");
735
- out.push(timelineTable(steps));
736
- out.push("");
737
- return {
738
- markdown: `${out.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd()}
739
- `
740
- };
741
- }
742
- function describeStateValue(value) {
743
- if (typeof value === "string") return `\`${value}\` \u2014 the workflow is done.`;
744
- const parts = [];
745
- for (const [phase, leaf] of Object.entries(value)) {
746
- if (typeof leaf === "string") {
747
- parts.push(`\`${phase}\`: ${leaf}`);
748
- continue;
749
- }
750
- const inner = Object.entries(leaf).map(([task, state]) => `\`${task}\` = \`${state}\``).join(", ");
751
- parts.push(`\`${phase}\` \u2192 ${inner}`);
752
- }
753
- return parts.join(" \xB7 ");
754
- }
755
-
756
- export { RETRY_BUDGET, UnreplayableLogError, WorkflowImportError, bareEvent, chartFromWorkflow, chartFromWorkflowText, deriveLaneStatus, drawTask, endPolarityOf, eventAlphabet, foldLane, initialOf, initialStates, laneReport, laneTerminalReached, originOf, parseEventsJsonl, parseHistoryJson, parseStatusJson, phaseStandings, statesOf, stepTask, timeline, trippedTasks, waitingOn, walkedEdgeKey, walkedEdges };
757
- //# sourceMappingURL=chunk-NR7BU22N.js.map
758
- //# sourceMappingURL=chunk-NR7BU22N.js.map