@demlik/tea 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/README.md +11 -9
  2. package/dist/agent/index.d.ts +638 -45
  3. package/dist/agent/index.js +9 -19
  4. package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
  5. package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
  6. package/dist/chunk-AQ6ZIMEA.js +421 -0
  7. package/dist/chunk-AQ6ZIMEA.js.map +1 -0
  8. package/dist/{chunk-MUUROGIH.js → chunk-BLJ2JQSH.js} +62 -12
  9. package/dist/chunk-BLJ2JQSH.js.map +1 -0
  10. package/dist/{chunk-7SVIRMC6.js → chunk-F2US5BW6.js} +25 -5
  11. package/dist/chunk-F2US5BW6.js.map +1 -0
  12. package/dist/{batch-window/index.js → chunk-F7FMAWLA.js} +4 -8
  13. package/dist/chunk-F7FMAWLA.js.map +1 -0
  14. package/dist/{chunk-7V4EVLZA.js → chunk-HUKZQX6U.js} +20 -16
  15. package/dist/chunk-HUKZQX6U.js.map +1 -0
  16. package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
  17. package/dist/chunk-HWVW4AXC.js.map +1 -0
  18. package/dist/{chunk-WLGO64WC.js → chunk-HYDWG35Q.js} +23 -6
  19. package/dist/chunk-HYDWG35Q.js.map +1 -0
  20. package/dist/{chunk-I5OV65MS.js → chunk-I5MQMJDW.js} +57 -7
  21. package/dist/chunk-I5MQMJDW.js.map +1 -0
  22. package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
  23. package/dist/chunk-LFZUK6J2.js.map +1 -0
  24. package/dist/{chunk-ZVJZ72HY.js → chunk-LYLTKJWM.js} +25 -11
  25. package/dist/chunk-LYLTKJWM.js.map +1 -0
  26. package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
  27. package/dist/chunk-MYXFNWAJ.js.map +1 -0
  28. package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
  29. package/dist/chunk-PR6TB3BL.js.map +1 -0
  30. package/dist/chunk-RQULHGYH.js +1804 -0
  31. package/dist/chunk-RQULHGYH.js.map +1 -0
  32. package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
  33. package/dist/chunk-TXN2KFHF.js.map +1 -0
  34. package/dist/{chunk-Q2UM7BXU.js → chunk-VBDU4JL6.js} +2 -2
  35. package/dist/chunk-VBDU4JL6.js.map +1 -0
  36. package/dist/chunk-Z2L3LSNV.js +1470 -0
  37. package/dist/chunk-Z2L3LSNV.js.map +1 -0
  38. package/dist/core-CTzMJ82M.d.ts +562 -0
  39. package/dist/devtools/index.d.ts +2 -2
  40. package/dist/devtools/index.js +207 -2
  41. package/dist/devtools/index.js.map +1 -1
  42. package/dist/do/index.d.ts +48 -31
  43. package/dist/do/index.js +36 -25
  44. package/dist/do/index.js.map +1 -1
  45. package/dist/{durable-effects-D8SqU_if.d.ts → durable-effects-B0-qGQDy.d.ts} +2 -2
  46. package/dist/extension/index.d.ts +301 -3
  47. package/dist/extension/index.js +596 -5
  48. package/dist/extension/index.js.map +1 -1
  49. package/dist/flow/index.d.ts +1295 -0
  50. package/dist/flow/index.js +732 -0
  51. package/dist/flow/index.js.map +1 -0
  52. package/dist/idempotency/index.d.ts +90 -116
  53. package/dist/idempotency/index.js +4 -1
  54. package/dist/{batch-window/index.d.ts → index-4vZzljCD.d.ts} +7 -11
  55. package/dist/{fan-out/index.d.ts → index-6A7dB8f6.d.ts} +7 -8
  56. package/dist/index-B5BZ-_cT.d.ts +616 -0
  57. package/dist/index-Bc40JWVl.d.ts +131 -0
  58. package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
  59. package/dist/index-DJWIER_3.d.ts +69 -0
  60. package/dist/{snapshot/index.d.ts → index-DMCeMPMJ.d.ts} +15 -77
  61. package/dist/{monitored-run/index.d.ts → index-NjrT3fL2.d.ts} +37 -12
  62. package/dist/{recorder/index.d.ts → index-TvRb1KVf.d.ts} +4 -6
  63. package/dist/{deadline/index.d.ts → index-q0hXFeZ0.d.ts} +155 -8
  64. package/dist/index.d.ts +719 -6
  65. package/dist/index.js +1 -2
  66. package/dist/jev/index.d.ts +634 -0
  67. package/dist/jev/index.js +433 -0
  68. package/dist/jev/index.js.map +1 -0
  69. package/dist/machine-CdIcN2Xm.d.ts +1773 -0
  70. package/dist/machine-viz/index.d.ts +2 -1
  71. package/dist/machine-viz/index.js +12 -5
  72. package/dist/machine-viz/index.js.map +1 -1
  73. package/dist/mem/index.d.ts +19 -3
  74. package/dist/mem/index.js +22 -2
  75. package/dist/mem/index.js.map +1 -1
  76. package/dist/node/index.d.ts +130 -4
  77. package/dist/node/index.js +222 -10
  78. package/dist/node/index.js.map +1 -1
  79. package/dist/{paginator → paginate}/index.d.ts +151 -6
  80. package/dist/paginate/index.js +7 -0
  81. package/dist/parity/index.d.ts +5 -10
  82. package/dist/parity/index.js +4 -7
  83. package/dist/parity/index.js.map +1 -1
  84. package/dist/pbt/index.d.ts +248 -5
  85. package/dist/pbt/index.js +124 -5
  86. package/dist/pbt/index.js.map +1 -1
  87. package/dist/{trace-replay → persistence}/index.d.ts +7 -4
  88. package/dist/persistence/index.js +6 -0
  89. package/dist/react/index.d.ts +4 -3
  90. package/dist/react/index.js +1 -2
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/resilience/index.d.ts +743 -0
  93. package/dist/resilience/index.js +657 -0
  94. package/dist/resilience/index.js.map +1 -0
  95. package/dist/retry-backoff/index.d.ts +3 -2
  96. package/dist/retry-backoff/index.js +1 -1
  97. package/dist/runtime-types-LWDoi943.d.ts +998 -0
  98. package/dist/testing/index.d.ts +3 -2
  99. package/dist/testing/index.js +1 -2
  100. package/dist/testing/index.js.map +1 -1
  101. package/dist/{throttled-input → timing}/index.d.ts +144 -12
  102. package/dist/{throttled-input → timing}/index.js +57 -12
  103. package/dist/timing/index.js.map +1 -0
  104. package/dist/{types-D7u9DkH7.d.ts → types-DP3f5NIl.d.ts} +1 -1
  105. package/dist/work-queue/index.d.ts +131 -54
  106. package/dist/work-queue/index.js +3 -2
  107. package/dist/work-queue/index.js.map +1 -1
  108. package/package.json +50 -216
  109. package/dist/authed-call/index.d.ts +0 -119
  110. package/dist/authed-call/index.js +0 -134
  111. package/dist/authed-call/index.js.map +0 -1
  112. package/dist/await-terminal/index.d.ts +0 -100
  113. package/dist/await-terminal/index.js +0 -76
  114. package/dist/await-terminal/index.js.map +0 -1
  115. package/dist/batch-window/index.js.map +0 -1
  116. package/dist/cache/index.d.ts +0 -151
  117. package/dist/cache/index.js +0 -8
  118. package/dist/chart/index.d.ts +0 -217
  119. package/dist/chart/index.js +0 -16
  120. package/dist/chart/index.js.map +0 -1
  121. package/dist/chart/inspect/index.d.ts +0 -85
  122. package/dist/chart/inspect/index.js +0 -5
  123. package/dist/chart/inspect/react.d.ts +0 -112
  124. package/dist/chart/inspect/react.js +0 -11
  125. package/dist/chart/inspect/react.js.map +0 -1
  126. package/dist/chart/inspect/styles.css +0 -286
  127. package/dist/chart/lane/index.d.ts +0 -361
  128. package/dist/chart/lane/index.js +0 -9
  129. package/dist/chart/lane/index.js.map +0 -1
  130. package/dist/chart/lane/react.d.ts +0 -83
  131. package/dist/chart/lane/react.js +0 -559
  132. package/dist/chart/lane/react.js.map +0 -1
  133. package/dist/chart/lane/server.d.ts +0 -148
  134. package/dist/chart/lane/server.js +0 -209
  135. package/dist/chart/lane/server.js.map +0 -1
  136. package/dist/chart/lane/styles.css +0 -498
  137. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
  138. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
  139. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
  140. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
  141. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
  142. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
  143. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
  144. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
  145. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
  146. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
  147. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
  148. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
  149. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
  150. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
  151. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
  152. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
  153. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
  154. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
  155. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
  156. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
  157. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
  158. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
  159. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
  160. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
  161. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
  162. package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
  163. package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
  164. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
  165. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
  166. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
  167. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
  168. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
  169. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
  170. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
  171. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
  172. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
  173. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
  174. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
  175. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
  176. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
  177. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
  178. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
  179. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
  180. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
  181. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
  182. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
  183. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
  184. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
  185. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
  186. package/dist/chart/lane/viewer/index.html +0 -15
  187. package/dist/chart/report/index.d.ts +0 -116
  188. package/dist/chart/report/index.js +0 -32
  189. package/dist/chart/report/index.js.map +0 -1
  190. package/dist/chunk-2YFLOCWX.js +0 -15
  191. package/dist/chunk-2YFLOCWX.js.map +0 -1
  192. package/dist/chunk-3JU6657S.js +0 -372
  193. package/dist/chunk-3JU6657S.js.map +0 -1
  194. package/dist/chunk-4KTWLPL5.js +0 -33
  195. package/dist/chunk-4KTWLPL5.js.map +0 -1
  196. package/dist/chunk-5EHLEUTL.js +0 -686
  197. package/dist/chunk-5EHLEUTL.js.map +0 -1
  198. package/dist/chunk-5KJKJOFC.js +0 -758
  199. package/dist/chunk-5KJKJOFC.js.map +0 -1
  200. package/dist/chunk-7SVIRMC6.js.map +0 -1
  201. package/dist/chunk-7V4EVLZA.js.map +0 -1
  202. package/dist/chunk-A56OR5RF.js +0 -184
  203. package/dist/chunk-A56OR5RF.js.map +0 -1
  204. package/dist/chunk-AZZLE7XR.js +0 -62
  205. package/dist/chunk-AZZLE7XR.js.map +0 -1
  206. package/dist/chunk-B5VXOFMZ.js +0 -266
  207. package/dist/chunk-B5VXOFMZ.js.map +0 -1
  208. package/dist/chunk-BYQUGDD3.js +0 -16
  209. package/dist/chunk-BYQUGDD3.js.map +0 -1
  210. package/dist/chunk-D736QUGF.js.map +0 -1
  211. package/dist/chunk-E6GEDSF4.js +0 -307
  212. package/dist/chunk-E6GEDSF4.js.map +0 -1
  213. package/dist/chunk-EUF7XOEE.js +0 -223
  214. package/dist/chunk-EUF7XOEE.js.map +0 -1
  215. package/dist/chunk-EWJP3YYP.js.map +0 -1
  216. package/dist/chunk-FV3Z5MBE.js.map +0 -1
  217. package/dist/chunk-HCEVHFJ7.js +0 -54
  218. package/dist/chunk-HCEVHFJ7.js.map +0 -1
  219. package/dist/chunk-I5OV65MS.js.map +0 -1
  220. package/dist/chunk-J6527VRQ.js.map +0 -1
  221. package/dist/chunk-JELSZN25.js +0 -47
  222. package/dist/chunk-JELSZN25.js.map +0 -1
  223. package/dist/chunk-JER5O7PQ.js +0 -416
  224. package/dist/chunk-JER5O7PQ.js.map +0 -1
  225. package/dist/chunk-JGVL3WPL.js +0 -26
  226. package/dist/chunk-JGVL3WPL.js.map +0 -1
  227. package/dist/chunk-JP5D6GSL.js +0 -71
  228. package/dist/chunk-JP5D6GSL.js.map +0 -1
  229. package/dist/chunk-K575PT4S.js.map +0 -1
  230. package/dist/chunk-MU6MCIAC.js +0 -15
  231. package/dist/chunk-MU6MCIAC.js.map +0 -1
  232. package/dist/chunk-MUUROGIH.js.map +0 -1
  233. package/dist/chunk-ND3DH6KM.js +0 -88
  234. package/dist/chunk-ND3DH6KM.js.map +0 -1
  235. package/dist/chunk-Q2UM7BXU.js.map +0 -1
  236. package/dist/chunk-S2EGRPCM.js +0 -47
  237. package/dist/chunk-S2EGRPCM.js.map +0 -1
  238. package/dist/chunk-SINXE47Y.js +0 -55
  239. package/dist/chunk-SINXE47Y.js.map +0 -1
  240. package/dist/chunk-SUST46KO.js +0 -53
  241. package/dist/chunk-SUST46KO.js.map +0 -1
  242. package/dist/chunk-TP5UPGLY.js +0 -61
  243. package/dist/chunk-TP5UPGLY.js.map +0 -1
  244. package/dist/chunk-UF4MZSLT.js +0 -53
  245. package/dist/chunk-UF4MZSLT.js.map +0 -1
  246. package/dist/chunk-UOC2PL46.js +0 -13
  247. package/dist/chunk-UOC2PL46.js.map +0 -1
  248. package/dist/chunk-WLGO64WC.js.map +0 -1
  249. package/dist/chunk-WRAA7GVZ.js +0 -209
  250. package/dist/chunk-WRAA7GVZ.js.map +0 -1
  251. package/dist/chunk-ZCL7SCBK.js +0 -685
  252. package/dist/chunk-ZCL7SCBK.js.map +0 -1
  253. package/dist/chunk-ZD6PNZBK.js +0 -457
  254. package/dist/chunk-ZD6PNZBK.js.map +0 -1
  255. package/dist/chunk-ZF6WDK2D.js +0 -519
  256. package/dist/chunk-ZF6WDK2D.js.map +0 -1
  257. package/dist/chunk-ZJ5AOYBH.js +0 -8
  258. package/dist/chunk-ZJ5AOYBH.js.map +0 -1
  259. package/dist/chunk-ZVJZ72HY.js.map +0 -1
  260. package/dist/circuit-breaker/index.d.ts +0 -197
  261. package/dist/circuit-breaker/index.js +0 -3
  262. package/dist/circuit-breaker/index.js.map +0 -1
  263. package/dist/core-Bjc0bS8j.d.ts +0 -326
  264. package/dist/deadline/index.js +0 -6
  265. package/dist/deadline/index.js.map +0 -1
  266. package/dist/debounce/index.js +0 -3
  267. package/dist/debounce/index.js.map +0 -1
  268. package/dist/extension/react.d.ts +0 -121
  269. package/dist/extension/react.js +0 -75
  270. package/dist/extension/react.js.map +0 -1
  271. package/dist/extension/subs/index.d.ts +0 -44
  272. package/dist/extension/subs/index.js +0 -80
  273. package/dist/extension/subs/index.js.map +0 -1
  274. package/dist/extension/test-utils.d.ts +0 -128
  275. package/dist/extension/test-utils.js +0 -277
  276. package/dist/extension/test-utils.js.map +0 -1
  277. package/dist/fan-out/index.js +0 -5
  278. package/dist/fan-out/index.js.map +0 -1
  279. package/dist/fold-Blbhru48.d.ts +0 -435
  280. package/dist/graph-CcjWZVrd.d.ts +0 -923
  281. package/dist/idempotency/adapter.d.ts +0 -62
  282. package/dist/idempotency/adapter.js +0 -4
  283. package/dist/idempotency/adapter.js.map +0 -1
  284. package/dist/idempotent-intake/index.d.ts +0 -187
  285. package/dist/idempotent-intake/index.js +0 -7
  286. package/dist/idempotent-intake/index.js.map +0 -1
  287. package/dist/llm-call/index.d.ts +0 -310
  288. package/dist/llm-call/index.js +0 -16
  289. package/dist/llm-call/index.js.map +0 -1
  290. package/dist/machine-0OmPvsy_.d.ts +0 -804
  291. package/dist/monitored-run/index.js +0 -10
  292. package/dist/monitored-run/index.js.map +0 -1
  293. package/dist/paginated-walk/index.d.ts +0 -234
  294. package/dist/paginated-walk/index.js +0 -16
  295. package/dist/paginated-walk/index.js.map +0 -1
  296. package/dist/paginator/index.js +0 -3
  297. package/dist/paginator/index.js.map +0 -1
  298. package/dist/pbt/arbitraries/index.d.ts +0 -135
  299. package/dist/pbt/arbitraries/index.js +0 -3
  300. package/dist/pbt/arbitraries/index.js.map +0 -1
  301. package/dist/pbt/runners/index.d.ts +0 -117
  302. package/dist/pbt/runners/index.js +0 -5
  303. package/dist/pbt/runners/index.js.map +0 -1
  304. package/dist/poller/index.d.ts +0 -351
  305. package/dist/poller/index.js +0 -115
  306. package/dist/poller/index.js.map +0 -1
  307. package/dist/prediction/index.d.ts +0 -130
  308. package/dist/prediction/index.js +0 -4
  309. package/dist/prediction/index.js.map +0 -1
  310. package/dist/protocol-B5YmJr0d.d.ts +0 -45
  311. package/dist/pure/index.d.ts +0 -2
  312. package/dist/pure/index.js +0 -4
  313. package/dist/pure/index.js.map +0 -1
  314. package/dist/rate-limit/index.d.ts +0 -115
  315. package/dist/rate-limit/index.js +0 -3
  316. package/dist/rate-limit/index.js.map +0 -1
  317. package/dist/reconciler/index.d.ts +0 -192
  318. package/dist/reconciler/index.js +0 -164
  319. package/dist/reconciler/index.js.map +0 -1
  320. package/dist/recorder/index.js +0 -3
  321. package/dist/recorder/index.js.map +0 -1
  322. package/dist/reducer-BqyoVyBG.d.ts +0 -447
  323. package/dist/resilient-call/index.d.ts +0 -319
  324. package/dist/resilient-call/index.js +0 -14
  325. package/dist/resilient-call/index.js.map +0 -1
  326. package/dist/retry-to-success/index.d.ts +0 -109
  327. package/dist/retry-to-success/index.js +0 -37
  328. package/dist/retry-to-success/index.js.map +0 -1
  329. package/dist/run-BVeqJDBF.d.ts +0 -713
  330. package/dist/runtime-types-Bxc637bp.d.ts +0 -502
  331. package/dist/saga/index.d.ts +0 -240
  332. package/dist/saga/index.js +0 -150
  333. package/dist/saga/index.js.map +0 -1
  334. package/dist/samples-DCt6nF8H.d.ts +0 -59
  335. package/dist/snapshot/index.js +0 -5
  336. package/dist/snapshot/index.js.map +0 -1
  337. package/dist/subs/index.d.ts +0 -471
  338. package/dist/subs/index.js +0 -7
  339. package/dist/subs/index.js.map +0 -1
  340. package/dist/throttle/index.d.ts +0 -134
  341. package/dist/throttle/index.js +0 -3
  342. package/dist/throttle/index.js.map +0 -1
  343. package/dist/throttled-input/index.js.map +0 -1
  344. package/dist/token-refresh/index.d.ts +0 -215
  345. package/dist/token-refresh/index.js +0 -6
  346. package/dist/token-refresh/index.js.map +0 -1
  347. package/dist/trace-replay/index.js +0 -6
  348. package/dist/trace-replay/index.js.map +0 -1
  349. package/dist/with-deadline/index.d.ts +0 -196
  350. package/dist/with-deadline/index.js +0 -111
  351. package/dist/with-deadline/index.js.map +0 -1
  352. package/dist/with-resilience/index.d.ts +0 -224
  353. package/dist/with-resilience/index.js +0 -240
  354. package/dist/with-resilience/index.js.map +0 -1
  355. package/dist/with-telemetry/index.d.ts +0 -149
  356. package/dist/with-telemetry/index.js +0 -70
  357. package/dist/with-telemetry/index.js.map +0 -1
  358. package/dist/work-queue/adapter.d.ts +0 -83
  359. package/dist/work-queue/adapter.js +0 -4
  360. package/dist/work-queue/adapter.js.map +0 -1
  361. package/dist/work-queue/ops.d.ts +0 -70
  362. package/dist/work-queue/ops.js +0 -3
  363. package/dist/work-queue/ops.js.map +0 -1
  364. package/dist/workflow/index.d.ts +0 -484
  365. package/dist/workflow/index.js +0 -244
  366. package/dist/workflow/index.js.map +0 -1
  367. /package/dist/{cache → paginate}/index.js.map +0 -0
  368. /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
@@ -1,416 +0,0 @@
1
- import { describeChart, describeReducerChart, inspectState, inspectReducerState, captureCmds } from './chunk-ZD6PNZBK.js';
2
- import { compile, initFrom, compileReducer, reducerInitFrom, chartMermaid, reducerMermaid } from './chunk-E6GEDSF4.js';
3
- import { recorder } from './chunk-MUUROGIH.js';
4
- import { useMsgHistory, StateInspector, StateDiff, MsgLog } from './chunk-WRAA7GVZ.js';
5
- import { run, replay } from './chunk-5EHLEUTL.js';
6
- import { useMemo, useState, useEffect, useReducer, useRef } from 'react';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
-
9
- function useInspectorRuntime(machine, ctx, epoch) {
10
- const booting = useMemo(
11
- () => run(machine, { ctx }),
12
- [machine, ctx, epoch]
13
- );
14
- const rec = useMemo(() => recorder(booting), [booting]);
15
- const [rt, setRt] = useState(null);
16
- useEffect(() => {
17
- let live = true;
18
- setRt(null);
19
- booting.ready.then(
20
- (r) => {
21
- if (live) setRt(r);
22
- },
23
- () => {
24
- }
25
- );
26
- return () => {
27
- live = false;
28
- rec.stop();
29
- booting.stop().catch(() => {
30
- });
31
- };
32
- }, [booting, rec]);
33
- return { rt, rec };
34
- }
35
- function ChartInspector(props) {
36
- const { chart, parts, boot, ctx } = props;
37
- const [epoch, reset] = useReducer((n) => n + 1, 0);
38
- const machine = useMemo(
39
- () => ({
40
- init: initFrom(chart, boot),
41
- // The one cast, at the construction boundary: `compile` returns a
42
- // `Transitions` over the chart's OWN derivations, and `S`/`M`/`K` are
43
- // the caller's names for exactly those.
44
- update: compile(chart, parts)
45
- }),
46
- [chart, parts, boot]
47
- );
48
- const { rt, rec } = useInspectorRuntime(machine, ctx, epoch);
49
- const desc = useMemo(() => describeChart(chart), [chart]);
50
- const view = useMemo(
51
- () => gridView(desc, chart, parts, props.title, props.direction),
52
- [desc, chart, parts, props.title, props.direction]
53
- );
54
- if (rt === null) {
55
- return /* @__PURE__ */ jsx("div", { className: containerClass(props.className), children: /* @__PURE__ */ jsx("div", { className: "tea-ci-boot", children: "booting\u2026" }) });
56
- }
57
- return /* @__PURE__ */ jsx(
58
- InspectorView,
59
- {
60
- view,
61
- samples: props.samples,
62
- runtime: rt,
63
- rec,
64
- machine,
65
- ctx,
66
- title: props.title,
67
- className: props.className,
68
- onReset: reset
69
- },
70
- epoch
71
- );
72
- }
73
- function ReducerChartInspector(props) {
74
- const { chart, parts, boot, ctx } = props;
75
- const [epoch, reset] = useReducer((n) => n + 1, 0);
76
- const machine = useMemo(
77
- () => ({
78
- init: reducerInitFrom(chart, boot),
79
- // The one cast, for the same reason as the grid form's: `compileReducer`
80
- // returns a `Reducer` over the chart's OWN derivations.
81
- update: compileReducer(chart, parts)
82
- }),
83
- [chart, parts, boot]
84
- );
85
- const { rt, rec } = useInspectorRuntime(machine, ctx, epoch);
86
- const desc = useMemo(() => describeReducerChart(chart), [chart]);
87
- const view = useMemo(
88
- () => reducerView(desc, chart, parts),
89
- [desc, chart, parts]
90
- );
91
- if (rt === null) {
92
- return /* @__PURE__ */ jsx("div", { className: containerClass(props.className), children: /* @__PURE__ */ jsx("div", { className: "tea-ci-boot", children: "booting\u2026" }) });
93
- }
94
- return /* @__PURE__ */ jsx(
95
- InspectorView,
96
- {
97
- view,
98
- samples: props.samples,
99
- runtime: rt,
100
- rec,
101
- machine,
102
- ctx,
103
- title: props.title,
104
- className: props.className,
105
- onReset: reset
106
- },
107
- epoch
108
- );
109
- }
110
- function containerClass(extra) {
111
- return `tea-ci${extra ? ` ${extra}` : ""}`;
112
- }
113
- function gridView(desc, chart, parts, title, direction) {
114
- return {
115
- events: desc.events,
116
- controls: (state, samples) => inspectState(desc, state, { parts, samples }).map(
117
- gridControl
118
- ),
119
- mermaid: (state) => chartMermaid(chart, {
120
- highlight: state.type,
121
- phases: true,
122
- direction,
123
- title
124
- }),
125
- header: (state) => {
126
- const here = desc.states.find((s) => s.name === state.type);
127
- return {
128
- ...here === void 0 ? {} : { phase: here.phase },
129
- tags: [
130
- ...here?.end === true ? ["end"] : [],
131
- ...here?.parking === true ? ["parking"] : []
132
- ]
133
- };
134
- },
135
- omits: []
136
- };
137
- }
138
- function reducerView(desc, chart, parts) {
139
- return {
140
- events: desc.events,
141
- controls: (state, samples) => inspectReducerState(desc, state, {
142
- parts,
143
- samples
144
- }).map(reducerControl),
145
- // No `highlight`: every edge leaves the one `any` node, so there is no
146
- // node that IS the current state to light up.
147
- mermaid: () => reducerMermaid(chart),
148
- // No phase, no `end`, no `parking` — this form declares none of the three.
149
- header: () => ({ tags: [] }),
150
- omits: [desc.phases, desc.refusals, desc.scope]
151
- };
152
- }
153
- function gridControl(v) {
154
- const refused = v.status === "refused";
155
- return {
156
- event: v.event,
157
- kind: refused ? v.reason?.kind ?? "undeclared" : "legal",
158
- refused,
159
- ...v.why === void 0 ? {} : { why: v.why },
160
- outcome: describeOutcome(v),
161
- ...v.msg === void 0 ? {} : { msg: v.msg }
162
- };
163
- }
164
- function reducerControl(v) {
165
- return {
166
- event: v.event,
167
- kind: "legal",
168
- refused: false,
169
- outcome: describeOutcome(v),
170
- ...v.msg === void 0 ? {} : { msg: v.msg }
171
- };
172
- }
173
- function InspectorView({
174
- view,
175
- samples,
176
- runtime,
177
- rec,
178
- machine,
179
- ctx,
180
- title,
181
- className,
182
- onReset
183
- }) {
184
- const [tick, bump] = useReducer((n) => n + 1, 0);
185
- useEffect(() => runtime.subscribe(bump), [runtime]);
186
- const liveState = runtime.getState();
187
- const [history, send] = useMsgHistory(runtime.dispatch);
188
- const [drafts, setDrafts] = useState(
189
- () => seedDrafts(view.events, samples)
190
- );
191
- const effective = useMemo(() => parseDrafts(drafts), [drafts]);
192
- const [at, setAt] = useState(null);
193
- const trace = safeDump(rec, liveState);
194
- const total = trace.msgs.length;
195
- const cursor = at === null ? total : Math.min(at, total);
196
- const scrubbed = at !== null && cursor < total;
197
- const shown = replayPrefix(machine, trace, ctx, cursor, liveState);
198
- const previous = replayPrefix(
199
- machine,
200
- trace,
201
- ctx,
202
- Math.max(0, cursor - 1),
203
- liveState
204
- );
205
- const verdicts = view.controls(shown, effective);
206
- const here = view.header(shown);
207
- const tape = useRef(trace);
208
- tape.current = trace;
209
- const capture = useMemo(
210
- () => captureCmds(machine, {
211
- msgs: tape.current.msgs,
212
- ctx,
213
- loaded: tape.current.loaded
214
- }),
215
- [machine, ctx, total]
216
- );
217
- return /* @__PURE__ */ jsxs("div", { className: containerClass(className), children: [
218
- /* @__PURE__ */ jsxs("header", { className: "tea-ci-head", children: [
219
- /* @__PURE__ */ jsx("span", { className: "tea-ci-title", children: title ?? "chart inspector" }),
220
- /* @__PURE__ */ jsxs("span", { className: "tea-ci-now", children: [
221
- here.phase === void 0 ? null : /* @__PURE__ */ jsx("span", { className: "tea-ci-phase", children: here.phase }),
222
- /* @__PURE__ */ jsx("span", { className: "tea-ci-state", children: shown.type }),
223
- here.tags.map((t) => /* @__PURE__ */ jsx("span", { className: "tea-ci-tag", children: t }, t))
224
- ] }),
225
- scrubbed ? /* @__PURE__ */ jsxs("span", { className: "tea-ci-warn", children: [
226
- "time-travelling \u2014 step ",
227
- cursor,
228
- " of ",
229
- total
230
- ] }) : null
231
- ] }),
232
- /* @__PURE__ */ jsx("section", { className: "tea-ci-panel tea-ci-events", children: verdicts.map((v) => /* @__PURE__ */ jsx(
233
- EventControl,
234
- {
235
- control: v,
236
- disabled: scrubbed,
237
- draft: drafts[v.event],
238
- onDraft: (text) => setDrafts((d) => ({ ...d, [v.event]: text })),
239
- onSend: () => {
240
- setAt(null);
241
- if (v.msg !== void 0) send(v.msg);
242
- }
243
- },
244
- v.event
245
- )) }),
246
- /* @__PURE__ */ jsxs("div", { className: "tea-ci-cols", children: [
247
- /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel", children: [
248
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "state" }),
249
- /* @__PURE__ */ jsx(StateInspector, { state: shown, flashKey: cursor + tick }),
250
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "diff vs previous step" }),
251
- /* @__PURE__ */ jsx(StateDiff, { expected: previous, actual: shown })
252
- ] }),
253
- /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel", children: [
254
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "diagram" }),
255
- /* @__PURE__ */ jsx("pre", { className: "mermaid tea-ci-mermaid", children: view.mermaid(shown) }, view.mermaid(shown))
256
- ] })
257
- ] }),
258
- /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel tea-ci-fired", children: [
259
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "cmds fired" }),
260
- /* @__PURE__ */ jsx("ol", { className: "tea-ci-firelog", children: capture.steps.map((s) => /* @__PURE__ */ jsxs(
261
- "li",
262
- {
263
- className: `tea-ci-fire${s.step === cursor ? " tea-ci-fire-now" : ""}`,
264
- "data-step": s.step,
265
- "data-fired": s.cmds.length,
266
- children: [
267
- /* @__PURE__ */ jsx("span", { className: "tea-ci-fire-by", children: s.by?.type ?? "init" }),
268
- /* @__PURE__ */ jsx("span", { className: "tea-ci-fire-cmds", children: s.cmds.length === 0 ? "\u2014" : s.cmds.map((c) => c.type).join(", ") })
269
- ]
270
- },
271
- s.step
272
- )) }),
273
- capture.stoppedAt === void 0 ? null : /* @__PURE__ */ jsxs("span", { className: "tea-ci-why", children: [
274
- "capture stopped at step ",
275
- capture.stoppedAt.step,
276
- ":",
277
- " ",
278
- capture.stoppedAt.error
279
- ] })
280
- ] }),
281
- view.omits.length === 0 ? null : /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel tea-ci-omits", children: [
282
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "not available in this form" }),
283
- /* @__PURE__ */ jsx("ul", { children: view.omits.map((o) => /* @__PURE__ */ jsxs("li", { "data-omitted": o.question, children: [
284
- /* @__PURE__ */ jsx("b", { children: o.question }),
285
- " \u2014 ",
286
- o.why
287
- ] }, o.question)) })
288
- ] }),
289
- /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel tea-ci-travel", children: [
290
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "time travel" }),
291
- /* @__PURE__ */ jsxs("div", { className: "tea-ci-scrub", children: [
292
- /* @__PURE__ */ jsx(
293
- "input",
294
- {
295
- type: "range",
296
- min: 0,
297
- max: total,
298
- value: cursor,
299
- "aria-label": "transition",
300
- onChange: (e) => setAt(Number(e.target.value))
301
- }
302
- ),
303
- /* @__PURE__ */ jsxs("span", { className: "tea-ci-step", children: [
304
- cursor,
305
- " / ",
306
- total,
307
- cursor > 0 ? ` \xB7 ${String(trace.msgs[cursor - 1]?.type)}` : ""
308
- ] }),
309
- /* @__PURE__ */ jsx(
310
- "button",
311
- {
312
- type: "button",
313
- onClick: () => setAt(null),
314
- disabled: !scrubbed,
315
- children: "live"
316
- }
317
- ),
318
- /* @__PURE__ */ jsx("button", { type: "button", onClick: onReset, children: "reset" })
319
- ] }),
320
- /* @__PURE__ */ jsx(MsgLog, { history })
321
- ] })
322
- ] });
323
- }
324
- function EventControl({
325
- control,
326
- disabled,
327
- draft,
328
- onDraft,
329
- onSend
330
- }) {
331
- const { event, refused, kind, why, outcome, msg } = control;
332
- const blocked = refused || disabled || msg === void 0;
333
- return /* @__PURE__ */ jsxs(
334
- "div",
335
- {
336
- className: `tea-ci-ev tea-ci-ev-${kind}`,
337
- "data-event": event,
338
- "data-status": refused ? "refused" : "legal",
339
- children: [
340
- /* @__PURE__ */ jsx(
341
- "button",
342
- {
343
- type: "button",
344
- className: "tea-ci-btn",
345
- disabled: blocked,
346
- title: why ?? outcome,
347
- onClick: onSend,
348
- children: event
349
- }
350
- ),
351
- refused ? /* @__PURE__ */ jsx("span", { className: "tea-ci-why", children: why }) : /* @__PURE__ */ jsx("span", { className: "tea-ci-to", children: outcome }),
352
- draft === void 0 ? null : /* @__PURE__ */ jsx(
353
- "textarea",
354
- {
355
- className: "tea-ci-sample",
356
- "aria-label": `${event} payload`,
357
- rows: 1,
358
- value: draft,
359
- onChange: (e) => onDraft(e.target.value)
360
- }
361
- ),
362
- msg === void 0 && !refused ? /* @__PURE__ */ jsx("span", { className: "tea-ci-why", children: "no sample \u2014 cannot dispatch" }) : null
363
- ]
364
- }
365
- );
366
- }
367
- function describeOutcome(v) {
368
- const cmds = v.cmds.length > 0 ? ` / ${v.cmds.join(", ")}` : "";
369
- if (v.guard !== void 0) {
370
- return v.guard.branch === "unknown" ? `${v.targets.join(" | ")} \u2014 ${v.guard.guard}? (${v.guard.why})` : `\u2192 ${v.guard.target} [${v.guard.branch === "then" ? "" : "!"}${v.guard.guard}]${cmds}`;
371
- }
372
- if (v.resolved !== void 0) return `\u2192 ${v.resolved}${cmds}`;
373
- return `${v.targets.join(" | ")}${cmds}`;
374
- }
375
- function seedDrafts(events, samples) {
376
- const bag = samples ?? {};
377
- const out = {};
378
- for (const e of events) {
379
- if (!e.hasPayload) continue;
380
- out[e.name] = JSON.stringify(bag[e.name] ?? {});
381
- }
382
- return out;
383
- }
384
- function parseDrafts(drafts) {
385
- const out = {};
386
- for (const [k, text] of Object.entries(drafts)) {
387
- try {
388
- const v = JSON.parse(text);
389
- if (typeof v === "object" && v !== null) out[k] = v;
390
- } catch {
391
- }
392
- }
393
- return out;
394
- }
395
- function safeDump(rec, live) {
396
- try {
397
- return rec.dump();
398
- } catch {
399
- return { loaded: null, msgs: [], finalState: live };
400
- }
401
- }
402
- function replayPrefix(machine, trace, ctx, n, live) {
403
- try {
404
- return replay(machine, {
405
- msgs: trace.msgs.slice(0, n),
406
- ctx,
407
- loaded: trace.loaded
408
- }).state;
409
- } catch {
410
- return live;
411
- }
412
- }
413
-
414
- export { ChartInspector, ReducerChartInspector, useInspectorRuntime };
415
- //# sourceMappingURL=chunk-JER5O7PQ.js.map
416
- //# sourceMappingURL=chunk-JER5O7PQ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/chart/inspect/react.tsx"],"names":[],"mappings":";;;;;;;;AA8LO,SAAS,mBAAA,CAMd,OAAA,EACA,GAAA,EACA,KAAA,EACqE;AAMrE,EAAA,MAAM,OAAA,GAAU,OAAA;AAAA,IACd,MAAM,GAAA,CAAI,OAAA,EAAS,EAAE,KAAK,CAAA;AAAA,IAC1B,CAAC,OAAA,EAAS,GA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AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"chunk-JER5O7PQ.js","sourcesContent":["/**\n * @packageDocumentation\n * @demlik/tea/chart/inspect/react — the chart inspector, as one component.\n *\n * ```tsx\n * <ChartInspector chart={lane} parts={{ assign, guards }} samples={samples}\n * boot={() => ({ retries: 0, maxRetries: 3 })} />\n * ```\n *\n * That is the whole page: a button per message, a live state panel, a state\n * diagram with the current node lit, and a time-travel scrubber over every\n * transition. None of it is configured. The message list, the state names, the\n * phases, which control is legal right now and why the others are refused are\n * all READ OFF THE CHART by `../inspect`'s headless core — which is the point:\n * a hand-built debugger page encodes those four facts a second time, and this\n * one cannot, because it never learns them from anywhere but the chart.\n *\n * WHAT THE AUTHOR STILL SUPPLIES, and why none of it is derivable:\n *\n * - `parts` — the code the chart deliberately does not own (payload builders,\n * guard bodies, cells). It is the same bag `compile` demands; the inspector\n * compiles the machine itself rather than asking for one, so the diagram and\n * the runtime provably come from the same chart.\n * - `boot` — the initial state's DATA. The chart says which state is the entry\n * (`initial: true`); it cannot say what `maxRetries` is.\n * - `samples` — one payload per event that declares one. `ty<T>()` is `{}` at\n * runtime, so no derivation recovers the shape. Typed by the chart all the\n * same (see `Samples<C>`), and rendered as EDITABLE JSON so the operator can\n * vary a payload and watch a guard's branch flip.\n * - `ctx` — the runtime environment, which is not a property of the machine.\n *\n * WHAT WOULD FIRE, AND WHAT DID. The button row shows the cmds an edge\n * DECLARES — the before question, and empty by declaration on a `{ to, cell }`\n * edge, because the cell builds its cmds in its body. The \"cmds fired\" panel\n * shows what the recorded run ACTUALLY emitted, per step, tagged with the msg\n * that caused it. Two panels, because they answer two questions; the second is\n * the only place a cell-built effect is visible at all.\n *\n * THE REDUCER FORM has its own component, `<ReducerChartInspector>`, over the\n * same view. It renders the panels that apply and NAMES the ones that do not:\n * no phase on the header, no refusal on any control, no highlighted node in the\n * drawing — each listed in a \"not available in this form\" panel with the reason,\n * rather than quietly missing.\n *\n * TIME TRAVEL IS PURE. The runtime is recorded with `@demlik/tea/recorder`, and\n * scrubbing re-folds a PREFIX of the recorded msgs through `replay` — init +\n * update only, never `interpret`, never a Store, never a live subscription. So\n * dragging the scrubber backwards cannot re-fire an effect, which is the one\n * thing a naive time-travel implementation gets wrong.\n *\n * Styling follows `@demlik/tea/devtools`: one stylesheet, every class prefixed\n * (`tea-ci-*`), wired to the consumer's design tokens, no framework and no new\n * dependency. Import `@demlik/tea/chart/inspect/styles.css` (and devtools'\n * stylesheet, since the state/log/diff panels are devtools components).\n */\n\n\"use client\";\n\nimport { useEffect, useMemo, useReducer, useRef, useState } from \"react\";\nimport {\n MsgLog,\n StateDiff,\n StateInspector,\n useMsgHistory,\n} from \"../../devtools\";\nimport {\n type BootingRuntime,\n type Cmd,\n type Machine,\n type Runtime,\n replay,\n run,\n type Sub,\n} from \"../../index\";\nimport type { Reducer, Transitions } from \"../../pure/core\";\nimport { type Recorder, recorder, type Trace } from \"../../recorder\";\nimport {\n chartMermaid,\n compile,\n compileReducer,\n initFrom,\n type Parts,\n type RParts,\n reducerInitFrom,\n reducerMermaid,\n} from \"../compile\";\nimport type {\n Chart,\n CmdOf,\n InitialData,\n MsgOf,\n ReducerChart,\n RStateOf,\n StateOf,\n} from \"../graph\";\nimport {\n type ChartDescription,\n type CmdCapture,\n captureCmds,\n describeChart,\n describeReducerChart,\n type EventPreview,\n inspectReducerState,\n inspectState,\n type ReducerChartDescription,\n type ReducerEventPreview,\n type RtSamples,\n type Samples,\n} from \"./index\";\n\n// ── props ─────────────────────────────────────────────────────────────────\n\n/**\n * Everything `<ChartInspector>` needs. Four fields, and every one of them is a\n * fact the chart genuinely does not carry — see the module doc. Anything the\n * chart DOES carry (events, states, phases, guards, cmds, refusals) has no prop\n * here by design: a prop that restated one would be the fact said twice.\n */\nexport interface ChartInspectorProps<\n C,\n S extends { type: string },\n M extends { type: string },\n Ctx,\n> {\n /** The chart. Everything the UI draws is read off this value. */\n readonly chart: C;\n /** The parts bag `compile` demands — assign, plus guards/cmds/cells if used. */\n readonly parts: Parts<C, S, M>;\n /** The entry state's data. The chart names the state; you supply its ctx. */\n readonly boot: () => InitialData<C, S>;\n /** One payload per event that declares one. Typed by the chart. */\n readonly samples?: Samples<C>;\n /** The runtime ctx. Omit for a machine that reads nothing from one. */\n readonly ctx?: Ctx;\n /** Diagram title. Cosmetic — defaults to no title. */\n readonly title?: string;\n /** Diagram direction. Default `\"TB\"`. */\n readonly direction?: \"TB\" | \"LR\";\n /** Appended to the container's class list. */\n readonly className?: string;\n}\n\n/**\n * Everything `<ReducerChartInspector>` needs — the same four undecidable facts,\n * over the form that has no phase dimension.\n *\n * There is no `direction` prop, and its absence is the honest kind: the reducer\n * drawing has one `any` node with every edge leaving it (that is what having no\n * phase dimension MEANS), so a layout knob would be a knob over nothing.\n */\nexport interface ReducerChartInspectorProps<\n C,\n S extends { type: string },\n M extends { type: string },\n Ctx,\n> {\n /** The reducer chart. Everything the UI draws is read off this value. */\n readonly chart: C;\n /** The parts bag `compileReducer` demands. */\n readonly parts: RParts<C, S, M>;\n /** The entry state's data — for this form, the whole state minus its tag. */\n readonly boot: () => Omit<RStateOf<C>, \"type\">;\n /** One payload per event that declares one. Typed by the chart. */\n readonly samples?: Samples<C>;\n /** The runtime ctx. Omit for a machine that reads nothing from one. */\n readonly ctx?: Ctx;\n /** Panel title. Cosmetic — defaults to no title. */\n readonly title?: string;\n /** Appended to the container's class list. */\n readonly className?: string;\n}\n\n// ── the runtime lifecycle, shared by both forms ───────────────────────────\n\n/**\n * Own a runtime for the component's lifetime (built with `run`, stopped on\n * unmount or reset) so the recorder has something to attach to — `useMachine`\n * hides the runtime, and the recorder needs it. The booted `Runtime` is\n * consumed with `useRuntime`'s contract: the component that owns the lifecycle\n * stops it.\n *\n * Shared by both chart forms because none of it is form-specific: a compiled\n * `Transitions` and a compiled `Reducer` are both just a `Machine[\"update\"]`.\n *\n * EXPORTED for the one other component with the same lifecycle to own:\n * `@demlik/tea/chart/lane/react`'s live lane, whose `update` is `runLane`'s.\n * A lane is not a chart form, but \"own a runtime for the component's lifetime,\n * record it, and stop it on unmount\" is not a fact about charts either — and a\n * second copy of it is a second place for the recorder's stop to be forgotten.\n */\nexport function useInspectorRuntime<\n S,\n M extends { type: string },\n K extends Cmd,\n Ctx,\n>(\n machine: Machine<S, M, K, Sub<never>, Ctx>,\n ctx: Ctx,\n epoch: number,\n): { readonly rt: Runtime<S, M> | null; readonly rec: Recorder<S, M> } {\n // `epoch` is not read inside the memo, and it is still a real dependency: it\n // IS the reset lever. Bumping it is how \"start over\" rebuilds the runtime, so\n // re-booting the machine from `init` rather than pretending some message\n // means \"go back to the beginning\" — no chart has one.\n // biome-ignore lint/correctness/useExhaustiveDependencies: `epoch` is the reset lever — the memo must re-run when it bumps, which is the whole point of the value\n const booting = useMemo<BootingRuntime<S, M>>(\n () => run(machine, { ctx }),\n [machine, ctx, epoch],\n );\n const rec = useMemo<Recorder<S, M>>(() => recorder(booting), [booting]);\n\n // The booted handle. Until `ready` resolves there is no total `getState`, so\n // there is nothing honest to render — one frame of \"booting\" beats inventing\n // a state the machine has not produced.\n const [rt, setRt] = useState<Runtime<S, M> | null>(null);\n useEffect(() => {\n let live = true;\n setRt(null);\n booting.ready.then(\n (r) => {\n if (live) setRt(r);\n },\n () => {},\n );\n return () => {\n live = false;\n rec.stop();\n booting.stop().catch(() => {});\n };\n }, [booting, rec]);\n\n return { rt, rec };\n}\n\n// ── the components ────────────────────────────────────────────────────────\n\n/**\n * The self-building debugger for any GRID-form chart.\n */\nexport function ChartInspector<\n const C extends Chart<C>,\n S extends { type: string } = StateOf<C>,\n M extends { type: string } = MsgOf<C>,\n K extends Cmd = CmdOf<C>,\n Ctx = Record<never, never>,\n>(props: ChartInspectorProps<C, S, M, Ctx>) {\n const { chart, parts, boot, ctx } = props;\n // The reset lever: a fresh epoch rebuilds the runtime, which re-boots the\n // machine from `init`. Resetting by dispatching would be a lie — there is no\n // \"go back to the start\" message in any chart.\n const [epoch, reset] = useReducer((n: number) => n + 1, 0);\n\n const machine = useMemo(\n () =>\n ({\n init: initFrom<C, S, K>(chart, boot),\n // The one cast, at the construction boundary: `compile` returns a\n // `Transitions` over the chart's OWN derivations, and `S`/`M`/`K` are\n // the caller's names for exactly those.\n update: compile(chart, parts) as unknown as Transitions<S, M, K>,\n }) as unknown as Machine<S, M, K, Sub<never>, Ctx>,\n [chart, parts, boot],\n );\n const { rt, rec } = useInspectorRuntime(machine, ctx as Ctx, epoch);\n\n const desc = useMemo(() => describeChart(chart), [chart]);\n const view = useMemo<FormView<S>>(\n () => gridView(desc, chart, parts, props.title, props.direction),\n [desc, chart, parts, props.title, props.direction],\n );\n\n if (rt === null) {\n return (\n <div className={containerClass(props.className)}>\n <div className=\"tea-ci-boot\">booting…</div>\n </div>\n );\n }\n return (\n <InspectorView\n key={epoch}\n view={view}\n samples={props.samples}\n runtime={rt}\n rec={rec}\n machine={machine}\n ctx={ctx as Ctx}\n title={props.title}\n className={props.className}\n onReset={reset}\n />\n );\n}\n\n/**\n * The same debugger for a REDUCER-form chart — the panels that apply, and the\n * ones that do not left out with the reason on screen.\n *\n * What is missing here is missing because the form does not have it: no phase\n * on the header, no refusal on any control (this form cannot refuse an event),\n * and no highlighted node in the drawing (every edge leaves the one `any`\n * node). The \"not available in this form\" panel names each one, so the\n * omission reads as a property of the chart rather than a hole in the tool.\n */\nexport function ReducerChartInspector<\n const C extends ReducerChart<C>,\n S extends { type: string } = RStateOf<C>,\n M extends { type: string } = MsgOf<C>,\n K extends Cmd = CmdOf<C>,\n Ctx = Record<never, never>,\n>(props: ReducerChartInspectorProps<C, S, M, Ctx>) {\n const { chart, parts, boot, ctx } = props;\n const [epoch, reset] = useReducer((n: number) => n + 1, 0);\n\n const machine = useMemo(\n () =>\n ({\n init: reducerInitFrom<C, S, K>(chart, boot),\n // The one cast, for the same reason as the grid form's: `compileReducer`\n // returns a `Reducer` over the chart's OWN derivations.\n update: compileReducer(chart, parts) as unknown as Reducer<S, M, K>,\n }) as unknown as Machine<S, M, K, Sub<never>, Ctx>,\n [chart, parts, boot],\n );\n const { rt, rec } = useInspectorRuntime(machine, ctx as Ctx, epoch);\n\n const desc = useMemo(() => describeReducerChart(chart), [chart]);\n const view = useMemo<FormView<S>>(\n () => reducerView(desc, chart, parts),\n [desc, chart, parts],\n );\n\n if (rt === null) {\n return (\n <div className={containerClass(props.className)}>\n <div className=\"tea-ci-boot\">booting…</div>\n </div>\n );\n }\n return (\n <InspectorView\n key={epoch}\n view={view}\n samples={props.samples}\n runtime={rt}\n rec={rec}\n machine={machine}\n ctx={ctx as Ctx}\n title={props.title}\n className={props.className}\n onReset={reset}\n />\n );\n}\n\nfunction containerClass(extra: string | undefined): string {\n return `tea-ci${extra ? ` ${extra}` : \"\"}`;\n}\n\n// ── the form seam ─────────────────────────────────────────────────────────\n\n/** One event control, normalized so the two chart forms render through one row. */\ninterface ControlModel {\n readonly event: string;\n /** `\"legal\"` or the refusal's kind — the class suffix, and the CSS hook. */\n readonly kind: string;\n readonly refused: boolean;\n /** The refusal's one-line explanation. Present iff refused. */\n readonly why?: string;\n /** \"where would this go, and what would it fire\" — the DECLARED answer. */\n readonly outcome: string;\n /** The msg a click would dispatch, or `undefined` when no sample was given. */\n readonly msg?: { readonly type: string };\n}\n\n/**\n * The three things that differ between the chart forms, and nothing else.\n *\n * Everything below this line — the runtime, the recorder, time travel, the\n * drafts, the captured cmds — is identical for a grid chart and a reducer\n * chart, because none of it depends on there being a phase dimension. So the\n * view takes the difference as data rather than branching on it: `header`\n * returns no phase where there is no phase, `controls` returns rows that cannot\n * be refused where nothing can refuse them, and `omits` names each panel the\n * form cannot honestly fill.\n */\ninterface FormView<S extends { type: string }> {\n /** The alphabet, for seeding one payload draft per event that declares one. */\n readonly events: readonly {\n readonly name: string;\n readonly hasPayload: boolean;\n }[];\n readonly controls: (state: S, samples: RtSamples) => readonly ControlModel[];\n readonly mermaid: (state: S) => string;\n readonly header: (state: S) => {\n readonly phase?: string;\n readonly tags: readonly string[];\n };\n /** The questions this form cannot answer, each with the reason. */\n readonly omits: readonly {\n readonly question: string;\n readonly why: string;\n }[];\n}\n\nfunction gridView<C, S extends { type: string }, M extends { type: string }>(\n desc: ChartDescription,\n chart: C,\n parts: Parts<C, S, M>,\n title: string | undefined,\n direction: \"TB\" | \"LR\" | undefined,\n): FormView<S> {\n return {\n events: desc.events,\n controls: (state, samples) =>\n inspectState(desc, state, { parts: parts as never, samples }).map(\n gridControl,\n ),\n mermaid: (state) =>\n chartMermaid(chart as never, {\n highlight: state.type,\n phases: true,\n direction,\n title,\n }),\n header: (state) => {\n const here = desc.states.find((s) => s.name === state.type);\n return {\n ...(here === undefined ? {} : { phase: here.phase }),\n tags: [\n ...(here?.end === true ? [\"end\"] : []),\n ...(here?.parking === true ? [\"parking\"] : []),\n ],\n };\n },\n omits: [],\n };\n}\n\nfunction reducerView<C, S extends { type: string }, M extends { type: string }>(\n desc: ReducerChartDescription,\n chart: C,\n parts: RParts<C, S, M>,\n): FormView<S> {\n return {\n events: desc.events,\n controls: (state, samples) =>\n inspectReducerState(desc, state, {\n parts: parts as never,\n samples,\n }).map(reducerControl),\n // No `highlight`: every edge leaves the one `any` node, so there is no\n // node that IS the current state to light up.\n mermaid: () => reducerMermaid(chart as never),\n // No phase, no `end`, no `parking` — this form declares none of the three.\n header: () => ({ tags: [] }),\n omits: [desc.phases, desc.refusals, desc.scope],\n };\n}\n\n/** An `EventPreview` as a row: legality is a real question in the grid form. */\nfunction gridControl(v: EventPreview): ControlModel {\n const refused = v.status === \"refused\";\n return {\n event: v.event,\n kind: refused ? (v.reason?.kind ?? \"undeclared\") : \"legal\",\n refused,\n ...(v.why === undefined ? {} : { why: v.why }),\n outcome: describeOutcome(v),\n ...(v.msg === undefined ? {} : { msg: v.msg }),\n };\n}\n\n/** A `ReducerEventPreview` as a row. It can never be refused — there is no\n * mechanism in this form with which to refuse it. */\nfunction reducerControl(v: ReducerEventPreview): ControlModel {\n return {\n event: v.event,\n kind: \"legal\",\n refused: false,\n outcome: describeOutcome(v),\n ...(v.msg === undefined ? {} : { msg: v.msg }),\n };\n}\n\n// ── the view ──────────────────────────────────────────────────────────────\n\ninterface ViewProps<\n C,\n S extends { type: string },\n M extends { type: string },\n K extends Cmd,\n Ctx,\n> {\n readonly view: FormView<S>;\n readonly samples: Samples<C> | undefined;\n readonly runtime: Runtime<S, M>;\n readonly rec: Recorder<S, M>;\n readonly machine: Machine<S, M, K, Sub<never>, Ctx>;\n readonly ctx: Ctx;\n readonly title: string | undefined;\n readonly className: string | undefined;\n readonly onReset: () => void;\n}\n\nfunction InspectorView<\n C,\n S extends { type: string },\n M extends { type: string },\n K extends Cmd,\n Ctx,\n>({\n view,\n samples,\n runtime,\n rec,\n machine,\n ctx,\n title,\n className,\n onReset,\n}: ViewProps<C, S, M, K, Ctx>) {\n // The live state, straight off the runtime (`useRuntime`'s subscription,\n // inlined here because this component also needs the recorder's view).\n const [tick, bump] = useReducer((n: number) => n + 1, 0);\n useEffect(() => runtime.subscribe(bump), [runtime]);\n const liveState = runtime.getState();\n\n // Every dispatch goes through `useMsgHistory`, so the MsgLog rows and the\n // recorder's replay tape are fed by the same action.\n const [history, send] = useMsgHistory<M>(runtime.dispatch);\n\n // The editable payloads. Seeded from `samples`, then owned by the operator —\n // varying one is what makes the guard preview interactive.\n const [drafts, setDrafts] = useState<Readonly<Record<string, string>>>(() =>\n seedDrafts(view.events, samples),\n );\n const effective = useMemo(() => parseDrafts(drafts), [drafts]);\n\n // Time travel. `at === null` is live; otherwise it is a msg-prefix length,\n // and the displayed state is that prefix re-folded through `replay`.\n const [at, setAt] = useState<number | null>(null);\n const trace = safeDump(rec, liveState);\n const total = trace.msgs.length;\n const cursor = at === null ? total : Math.min(at, total);\n const scrubbed = at !== null && cursor < total;\n\n const shown = replayPrefix(machine, trace, ctx, cursor, liveState);\n const previous = replayPrefix(\n machine,\n trace,\n ctx,\n Math.max(0, cursor - 1),\n liveState,\n );\n\n const verdicts = view.controls(shown, effective);\n const here = view.header(shown);\n\n // WHAT ACTUALLY FIRED, per step — the after question, folded from the same\n // recorded prefix the scrubber is already folding. `cursor` indexes both, so\n // the highlighted row is the transition on screen.\n // `rec.dump()` allocates a fresh tape every render, so the msgs ARRAY has a\n // new identity each time and keying the memo on it would re-fold the whole run\n // on every keystroke in a payload box. The tape only ever grows, so its LENGTH\n // is the honest key, and the tape itself is read through a ref.\n const tape = useRef(trace);\n tape.current = trace;\n // biome-ignore lint/correctness/useExhaustiveDependencies: `total` is not read in the body and is the whole point of the memo — it is the tape's length, the one thing that changes what the capture returns\n const capture = useMemo<CmdCapture<M, K>>(\n () =>\n captureCmds(machine, {\n msgs: tape.current.msgs,\n ctx,\n loaded: tape.current.loaded,\n }),\n [machine, ctx, total],\n );\n\n return (\n <div className={containerClass(className)}>\n <header className=\"tea-ci-head\">\n <span className=\"tea-ci-title\">{title ?? \"chart inspector\"}</span>\n <span className=\"tea-ci-now\">\n {here.phase === undefined ? null : (\n <span className=\"tea-ci-phase\">{here.phase}</span>\n )}\n <span className=\"tea-ci-state\">{shown.type}</span>\n {here.tags.map((t) => (\n <span className=\"tea-ci-tag\" key={t}>\n {t}\n </span>\n ))}\n </span>\n {scrubbed ? (\n <span className=\"tea-ci-warn\">\n time-travelling — step {cursor} of {total}\n </span>\n ) : null}\n </header>\n\n {/* 1 — the button row. One control per DECLARED event; a refused one is\n drawn as refused, with the reason, never omitted. */}\n <section className=\"tea-ci-panel tea-ci-events\">\n {verdicts.map((v) => (\n <EventControl\n key={v.event}\n control={v}\n disabled={scrubbed}\n draft={drafts[v.event]}\n onDraft={(text) => setDrafts((d) => ({ ...d, [v.event]: text }))}\n onSend={() => {\n setAt(null);\n if (v.msg !== undefined) send(v.msg as unknown as M);\n }}\n />\n ))}\n </section>\n\n <div className=\"tea-ci-cols\">\n {/* 2 — the live state, and what the last step changed. */}\n <section className=\"tea-ci-panel\">\n <h3 className=\"tea-ci-h\">state</h3>\n <StateInspector state={shown} flashKey={cursor + tick} />\n <h3 className=\"tea-ci-h\">diff vs previous step</h3>\n <StateDiff expected={previous} actual={shown} />\n </section>\n\n {/* 3 — the diagram, with the current node lit where the form has one.\n `<pre class=\"mermaid\">` is the shape a mermaid host renders in\n place; the text is readable either way, so the panel is useful with\n no renderer at all. */}\n <section className=\"tea-ci-panel\">\n <h3 className=\"tea-ci-h\">diagram</h3>\n {/* Keyed by the diagram, for the reason `chart/lane/react.tsx` records:\n a mermaid host marks rendered nodes and skips them, React rewrites\n only the text, and the picture silently stops updating after the\n first frame. The key forces a genuinely new node. */}\n <pre key={view.mermaid(shown)} className=\"mermaid tea-ci-mermaid\">\n {view.mermaid(shown)}\n </pre>\n </section>\n </div>\n\n {/* 4 — WHAT ACTUALLY FIRED. The button row above says what an edge\n DECLARES it would fire; this says what the recorded run did fire, per\n step, tagged with the msg that caused it — the only place a cmd built\n inside a cell body is visible at all. */}\n <section className=\"tea-ci-panel tea-ci-fired\">\n <h3 className=\"tea-ci-h\">cmds fired</h3>\n <ol className=\"tea-ci-firelog\">\n {capture.steps.map((s) => (\n <li\n key={s.step}\n className={`tea-ci-fire${s.step === cursor ? \" tea-ci-fire-now\" : \"\"}`}\n data-step={s.step}\n data-fired={s.cmds.length}\n >\n <span className=\"tea-ci-fire-by\">{s.by?.type ?? \"init\"}</span>\n <span className=\"tea-ci-fire-cmds\">\n {s.cmds.length === 0\n ? \"—\"\n : s.cmds.map((c) => c.type).join(\", \")}\n </span>\n </li>\n ))}\n </ol>\n {capture.stoppedAt === undefined ? null : (\n <span className=\"tea-ci-why\">\n capture stopped at step {capture.stoppedAt.step}:{\" \"}\n {capture.stoppedAt.error}\n </span>\n )}\n </section>\n\n {/* 5 — the questions this chart form cannot answer, named rather than\n silently missing. Empty for a grid chart, which answers all three. */}\n {view.omits.length === 0 ? null : (\n <section className=\"tea-ci-panel tea-ci-omits\">\n <h3 className=\"tea-ci-h\">not available in this form</h3>\n <ul>\n {view.omits.map((o) => (\n <li key={o.question} data-omitted={o.question}>\n <b>{o.question}</b> — {o.why}\n </li>\n ))}\n </ul>\n </section>\n )}\n\n {/* 6 — time travel over every recorded transition. */}\n <section className=\"tea-ci-panel tea-ci-travel\">\n <h3 className=\"tea-ci-h\">time travel</h3>\n <div className=\"tea-ci-scrub\">\n <input\n type=\"range\"\n min={0}\n max={total}\n value={cursor}\n aria-label=\"transition\"\n onChange={(e) => setAt(Number(e.target.value))}\n />\n <span className=\"tea-ci-step\">\n {cursor} / {total}\n {cursor > 0 ? ` · ${String(trace.msgs[cursor - 1]?.type)}` : \"\"}\n </span>\n <button\n type=\"button\"\n onClick={() => setAt(null)}\n disabled={!scrubbed}\n >\n live\n </button>\n <button type=\"button\" onClick={onReset}>\n reset\n </button>\n </div>\n <MsgLog history={history} />\n </section>\n </div>\n );\n}\n\n// ── one event control ─────────────────────────────────────────────────────\n\nfunction EventControl({\n control,\n disabled,\n draft,\n onDraft,\n onSend,\n}: {\n readonly control: ControlModel;\n readonly disabled: boolean;\n readonly draft: string | undefined;\n readonly onDraft: (text: string) => void;\n readonly onSend: () => void;\n}) {\n const { event, refused, kind, why, outcome, msg } = control;\n const blocked = refused || disabled || msg === undefined;\n return (\n <div\n className={`tea-ci-ev tea-ci-ev-${kind}`}\n data-event={event}\n data-status={refused ? \"refused\" : \"legal\"}\n >\n <button\n type=\"button\"\n className=\"tea-ci-btn\"\n disabled={blocked}\n title={why ?? outcome}\n onClick={onSend}\n >\n {event}\n </button>\n {refused ? (\n <span className=\"tea-ci-why\">{why}</span>\n ) : (\n <span className=\"tea-ci-to\">{outcome}</span>\n )}\n {draft === undefined ? null : (\n <textarea\n className=\"tea-ci-sample\"\n aria-label={`${event} payload`}\n rows={1}\n value={draft}\n onChange={(e) => onDraft(e.target.value)}\n />\n )}\n {msg === undefined && !refused ? (\n <span className=\"tea-ci-why\">no sample — cannot dispatch</span>\n ) : null}\n </div>\n );\n}\n\n/**\n * The one-line \"where would this go, and what would it DECLARE it fires\".\n *\n * Structural in its parameter, because a grid preview and a reducer preview\n * agree on exactly the four fields it reads — and disagree only about the\n * refusal, which never reaches here.\n */\nfunction describeOutcome(v: {\n readonly guard?: EventPreview[\"guard\"];\n readonly cmds: readonly string[];\n readonly targets: readonly string[];\n readonly resolved?: string;\n}): string {\n const cmds = v.cmds.length > 0 ? ` / ${v.cmds.join(\", \")}` : \"\";\n if (v.guard !== undefined) {\n return v.guard.branch === \"unknown\"\n ? `${v.targets.join(\" | \")} — ${v.guard.guard}? (${v.guard.why})`\n : `→ ${v.guard.target} [${v.guard.branch === \"then\" ? \"\" : \"!\"}${v.guard.guard}]${cmds}`;\n }\n if (v.resolved !== undefined) return `→ ${v.resolved}${cmds}`;\n return `${v.targets.join(\" | \")}${cmds}`;\n}\n\n// ── helpers ───────────────────────────────────────────────────────────────\n\n/** One JSON draft per event that declares a payload. */\nfunction seedDrafts(\n events: readonly { readonly name: string; readonly hasPayload: boolean }[],\n samples: unknown,\n): Record<string, string> {\n const bag = (samples ?? {}) as Record<string, unknown>;\n const out: Record<string, string> = {};\n for (const e of events) {\n if (!e.hasPayload) continue;\n out[e.name] = JSON.stringify(bag[e.name] ?? {});\n }\n return out;\n}\n\n/**\n * Parse the drafts back into a samples bag. An unparseable draft contributes\n * NOTHING rather than a stale value — which surfaces as the honest \"no sample\"\n * degradation in the guard preview instead of a silently ignored edit.\n */\nfunction parseDrafts(\n drafts: Readonly<Record<string, string>>,\n): Record<string, object | undefined> {\n const out: Record<string, object | undefined> = {};\n for (const [k, text] of Object.entries(drafts)) {\n try {\n const v: unknown = JSON.parse(text);\n if (typeof v === \"object\" && v !== null) out[k] = v;\n } catch {\n // left absent on purpose — see the doc above.\n }\n }\n return out;\n}\n\n/**\n * The recorder's tape. `dump()` throws before the boot observe has fired; the\n * view only renders post-boot, so the fallback is a formality — and a formality\n * beats a blank screen.\n */\nfunction safeDump<S, M extends { type: string }>(\n rec: Recorder<S, M>,\n live: S,\n): Trace<S, M> {\n try {\n return rec.dump();\n } catch {\n return { loaded: null, msgs: [], finalState: live };\n }\n}\n\n/**\n * The state after the first `n` recorded msgs, by PURE replay.\n *\n * `replay` runs `init` + `update` only. No `interpret`, no Store, no live\n * subscription — so scrubbing backwards re-derives history rather than\n * re-performing it, which is the whole difference between time travel and\n * re-running the app.\n */\nfunction replayPrefix<\n S extends { type: string },\n M extends { type: string },\n K extends Cmd,\n Ctx,\n>(\n machine: Machine<S, M, K, Sub<never>, Ctx>,\n trace: Trace<S, M>,\n ctx: Ctx,\n n: number,\n live: S,\n): S {\n try {\n return replay(machine, {\n msgs: trace.msgs.slice(0, n),\n ctx,\n loaded: trace.loaded,\n }).state;\n } catch {\n return live;\n }\n}\n"]}
@@ -1,26 +0,0 @@
1
- import { fromTimeout } from './chunk-2YFLOCWX.js';
2
- import { subId } from './chunk-B5VXOFMZ.js';
3
-
4
- // src/deadline/index.ts
5
- function deadlineSub(id, atMs, opts) {
6
- return { ...opts, id: subId(id), type: "deadline", atMs };
7
- }
8
- function subscribeWith(armTimer) {
9
- return (sub, _ctx, dispatch) => armTimer(sub.id, sub.atMs, deadlineExceeded(sub.id, sub.atMs), dispatch);
10
- }
11
- function setTimeoutArmTimer() {
12
- return (id, atMs, msg, dispatch) => {
13
- const delayMs = Math.max(0, atMs - Date.now());
14
- return fromTimeout(
15
- () => msg
16
- )({ id, type: "deadline", delayMs }, void 0, dispatch);
17
- };
18
- }
19
- var subscribeDeadline = subscribeWith(setTimeoutArmTimer());
20
- function deadlineExceeded(id, atMs) {
21
- return { type: "deadline_exceeded", id, atMs };
22
- }
23
-
24
- export { deadlineExceeded, deadlineSub, setTimeoutArmTimer, subscribeDeadline, subscribeWith };
25
- //# sourceMappingURL=chunk-JGVL3WPL.js.map
26
- //# sourceMappingURL=chunk-JGVL3WPL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/deadline/index.ts"],"names":[],"mappings":";;;;AA6HO,SAAS,WAAA,CACd,EAAA,EACA,IAAA,EACA,IAAA,EACa;AACb,EAAA,OAAO,EAAE,GAAG,IAAA,EAAM,EAAA,EAAI,MAAM,EAAE,CAAA,EAAG,IAAA,EAAM,UAAA,EAAY,IAAA,EAAK;AAC1D;AA6CO,SAAS,cACd,QAAA,EAC0D;AAC1D,EAAA,OAAO,CAAC,GAAA,EAAK,IAAA,EAAM,QAAA,KACjB,SAAS,GAAA,CAAI,EAAA,EAAI,GAAA,CAAI,IAAA,EAAM,iBAAiB,GAAA,CAAI,EAAA,EAAI,GAAA,CAAI,IAAI,GAAG,QAAQ,CAAA;AAC3E;AAeO,SAAS,kBAAA,GAAiD;AAC/D,EAAA,OAAO,CAAC,EAAA,EAAI,IAAA,EAAM,GAAA,EAAK,QAAA,KAAa;AAGlC,IAAA,MAAM,UAAU,IAAA,CAAK,GAAA,CAAI,GAAG,IAAA,GAAO,IAAA,CAAK,KAAK,CAAA;AAC7C,IAAA,OAAO,WAAA;AAAA,MACL,MAAM;AAAA,KACR,CAAE,EAAE,EAAA,EAAI,IAAA,EAAM,YAAY,OAAA,EAAQ,EAAG,QAAW,QAAQ,CAAA;AAAA,EAC1D,CAAA;AACF;AAkBO,IAAM,iBAAA,GAIT,aAAA,CAAc,kBAAA,EAAoB;AAO/B,SAAS,gBAAA,CAAiB,IAAY,IAAA,EAAgC;AAC3E,EAAA,OAAO,EAAE,IAAA,EAAM,mBAAA,EAAqB,EAAA,EAAI,IAAA,EAAK;AAC/C","file":"chunk-JGVL3WPL.js","sourcesContent":["/**\n * @demlik/tea/deadline — a one-shot Sub that fires when an ABSOLUTE wall-clock\n * deadline is reached.\n *\n * Generalizes the recurring \"auto-fail a machine at T+N\" / \"15-minute stale\n * guard\" pattern: a Sub whose `subscriptions(state)` returns it only while the\n * deadline should be armed, and which dispatches a single `DeadlineExceeded`\n * Msg when the wall clock crosses `atMs`.\n *\n * Difference from `fromTimeout` (relative — \"fire after N ms\"): a deadline is\n * an ABSOLUTE target. The delay is computed at subscribe time as\n * `max(0, atMs - Date.now())`. The consequence that matters: subscribing LATE —\n * e.g. after a `Store` rehydrate that resumes a machine whose deadline was set\n * before the page reloaded — still fires at the correct absolute moment,\n * because the remaining delay is recomputed from the current clock, not stored\n * in the Sub. A deadline already in the past at subscribe time yields delay `0`,\n * so `setTimeout(fn, 0)` fires on the NEXT tick (never synchronously inside the\n * reconcile pass — the substrate must finish wiring all subs before any Msg\n * lands).\n *\n * Composition over reinvention: the timer lifecycle is `fromTimeout`'s, not\n * redrawn here. `deadlineSub` produces the Sub literal carrying `atMs`; the\n * `subscribe` cell (`subscribeDeadline`) translates `atMs` → a relative delay\n * and delegates the `setTimeout` / `clearTimeout` to `fromTimeout`. The clock\n * read (`Date.now()`) lives only in the subscribe handler — never in a reducer\n * (invariant 2) — and is exercised in tests via vitest fake timers, matching\n * the no-injection convention of the `fromTimeout` / `fromInterval` exemplars.\n *\n * WHAT BACKS THE TIMER IS THE HOST'S CHOICE. `setTimeout` is the universal\n * default, but it is not universal: a Durable Object that hibernates has no\n * live `setTimeout` to wake it, so its deadline must be backed by a `do_alarm`\n * registered on the alarm registry; a test host wants a fake-timer schedule.\n * That backing is the `ArmTimer` seam — `subscribeWith(armTimer)` builds the\n * `subscribe.deadline` cell from a host-plugged timer, and `subscribeDeadline`\n * IS `subscribeWith(setTimeoutArmTimer())`. One deadline surface, three hosts;\n * there is no second Sub type and no second `atMs` anchor to keep in sync.\n *\n * The anchor is what makes the seam safe. `atMs` is ABSOLUTE, so whatever backs\n * it arms to a fixed wall-clock instant: the host computes the gap itself\n * (`atMs - Date.now()`), and on a host that just rehydrated after hibernation\n * that gap is the SHRUNKEN remainder — the deadline honours the original target\n * rather than resetting to a fresh full-length window.\n *\n * Strengthens invariant 4 (external time is a subscription — the deadline is a\n * `Sub` the runtime reconciles, never a `setTimeout` leaked into a reducer) and\n * invariant 7 (identity is explicit — the Sub carries a stable `SubId`, so the\n * reconcile pass leaves it running across transitions instead of churning it).\n */\n\nimport { type Sub, type SubId, subId } from \"../index\";\nimport { fromTimeout } from \"../subs/from-timeout\";\nimport type { SubscribeHandler } from \"../subs/types\";\n\n/**\n * The Sub variant a deadline produces. `atMs` is the absolute target — epoch\n * milliseconds (the `Date.now()` / `Date.parse(...)` scale), NOT a relative\n * delay. It rides on the Sub so the reconcile pass keys identity by `id`\n * alone: the same `id` across transitions means the same armed timer, even if\n * a later `subscriptions(state)` recomputes the literal.\n *\n * Lowercase `\"deadline\"` discriminant per the Sub naming convention (a source\n * noun that doubles as the SubId family); same shape family as the\n * `TimeoutSubData` the `fromTimeout` factory consumes.\n */\nexport type DeadlineSub = Sub<\"deadline\"> & {\n readonly atMs: number;\n} & DeadlineOpts;\n\n/**\n * Additive options the `deadlineSub` factory folds onto the Sub literal. This\n * is the extension seam (invariant 5 — composition by reduction): future fields\n * — `repeatMs` for a re-arming deadline, `jitterMs` for spread, etc. — land HERE\n * as optional members, and every existing call site keeps compiling because the\n * factory's third parameter is optional and the fields are `readonly` optionals\n * on `DeadlineSub`. Callers are insulated from the concrete `DeadlineSub` shape:\n * they ask for what they need by name, never positionally, so a shape extension\n * never rewrites the ~13 `deadlineSub(id, atMs)` call sites.\n *\n * Empty today on purpose — the seam exists before the first extension does, so\n * the first field is a one-line additive change, not a 13-site migration.\n */\n// biome-ignore lint/complexity/noBannedTypes: intentional empty extension seam — fields are added additively (see doc above).\nexport type DeadlineOpts = {};\n\n/**\n * The Msg the deadline dispatches when the wall clock crosses `atMs`. Exported\n * as a tagged shape so consumers can union it into their machine's Msg type and\n * handle it in a reducer cell. `id` lets a reducer disambiguate WHICH deadline\n * fired when a machine arms several at once; `atMs` echoes the target the timer\n * was scheduled against (useful for assertions / observability).\n *\n * Snake-shaped `\"deadline_exceeded\"` matches the tagged-Msg style this module's\n * orchestrator requested; the actor-in-name PascalCase convention\n * (`TimerFiredDeadline`) is the consumer's to apply at their own boundary if\n * they prefer — `deadlineExceeded(...)` only fixes the wire shape, not the\n * consumer's local dialect.\n */\nexport type DeadlineExceeded = {\n readonly type: \"deadline_exceeded\";\n readonly id: string;\n readonly atMs: number;\n};\n\n/**\n * Build a deadline Sub literal. Pure data — no clock read, no timer; the timer\n * is armed later by the `subscribe` cell. `id` is branded via `subId(...)` so\n * accidental raw-string drift fails at the type level (invariant 7).\n *\n * Return the result directly from `subscriptions(state)` while the deadline\n * should be armed; drop it (return `[]`, or stop returning this id) to disarm —\n * the reconcile pass calls the cleanup, clearing the pending timer before it\n * fires. That is the \"cancel on state exit\" lifecycle, identical to\n * `fromTimeout`'s.\n *\n * @param id Stable identity for this deadline. Same `id` across transitions =\n * same armed timer (no churn). Use distinct ids for distinct\n * deadlines on the same machine.\n * @param atMs Absolute target in epoch milliseconds (e.g. `Date.now() + 900_000`\n * for a 15-minute guard, or a persisted `expiresAt`).\n * @param opts Optional additive fields folded onto the Sub literal (see\n * {@link DeadlineOpts}). Omit it for the common case; pass it when a\n * future field (e.g. `repeatMs`) needs to ride on the deadline. The\n * optionality is the future-proofing seam — extending the shape\n * never breaks an existing `deadlineSub(id, atMs)` call site.\n */\nexport function deadlineSub(\n id: string,\n atMs: number,\n opts?: DeadlineOpts,\n): DeadlineSub {\n return { ...opts, id: subId(id), type: \"deadline\", atMs };\n}\n\n/**\n * The host-plugged timer backing. Given the deadline's stable `id`, its\n * absolute `atMs`, and the Msg to fire, arm the platform-appropriate timer\n * (DO alarm registry, `setTimeout`, fake timer) and return a cleanup that\n * cancels the pending fire.\n *\n * `id` is the Sub's reconcile id — a registry-backed host (the DO alarm slot)\n * keys its entry on `id` so the cleanup deletes the EXACT entry the substrate\n * reconciled. A `setTimeout`-backed host ignores `id` (the closure holds the\n * handle).\n *\n * The host computes the gap itself: `atMs - Date.now()` is the REMAINING time.\n * On a host that just rehydrated after hibernation that gap is the shrunken\n * remainder — the deadline is NOT reset to its full length. That recomputation\n * is the reason `atMs` rides on the Sub as an absolute instant rather than a\n * delay: the anchor is what every backing agrees on.\n */\nexport type ArmTimer<M> = (\n id: SubId,\n atMs: number,\n msg: M,\n dispatch: (msg: M) => void,\n) => () => void;\n\n/**\n * Build the `subscribe[\"deadline\"]` cell from a host-plugged `armTimer`. This\n * module owns the Sub shape, the anchor, and the Msg; the HOST owns what backs\n * the timer. The returned handler reads `id` + `atMs` off the Sub, builds the\n * `deadlineExceeded(...)` Msg, and hands all three to `armTimer`.\n *\n * Use it when `setTimeout` is the wrong backing — most concretely a Durable\n * Object, which hibernates and must register a `do_alarm` instead:\n *\n * subscribe: {\n * deadline: subscribeWith((id, atMs, msg, dispatch) =>\n * alarms.register(id, atMs, () => dispatch(msg)),\n * ),\n * }\n *\n * For the `setTimeout` default, use {@link subscribeDeadline} — it is exactly\n * `subscribeWith(setTimeoutArmTimer())`, so there is one deadline surface and\n * one anchor, not a second one per host.\n */\nexport function subscribeWith(\n armTimer: ArmTimer<DeadlineExceeded>,\n): SubscribeHandler<DeadlineSub, DeadlineExceeded, unknown> {\n return (sub, _ctx, dispatch) =>\n armTimer(sub.id, sub.atMs, deadlineExceeded(sub.id, sub.atMs), dispatch);\n}\n\n/**\n * The `setTimeout` timer backing — for node / browser / any host whose timer is\n * a plain `setTimeout`. Arms for the REMAINING time (`max(0, atMs - Date.now())`,\n * floored at 0 so an already-past deadline fires on the NEXT tick rather than\n * synchronously inside the reconcile pass), so a deadline re-derived after a\n * rehydrate fires at the original instant, not a fresh full window.\n *\n * Composes on `fromTimeout` rather than redrawing `setTimeout` /\n * `clearTimeout`: this package has ONE timer lifecycle, and the arm-timer seam\n * plugs into it instead of forking it. A hibernating host does NOT use this —\n * it plugs its own `armTimer` (a `do_alarm` registration) into\n * {@link subscribeWith}.\n */\nexport function setTimeoutArmTimer(): ArmTimer<DeadlineExceeded> {\n return (id, atMs, msg, dispatch) => {\n // Recompute the remaining delay from the CURRENT clock so a late subscribe\n // (post-rehydrate) still targets the correct absolute moment.\n const delayMs = Math.max(0, atMs - Date.now());\n return fromTimeout<Sub<\"deadline\"> & { delayMs: number }, DeadlineExceeded>(\n () => msg,\n )({ id, type: \"deadline\", delayMs }, undefined, dispatch);\n };\n}\n\n/**\n * The `subscribe[\"deadline\"]` cell for the DEFAULT `setTimeout` backing. Arms a\n * one-shot timer for the remaining delay `max(0, atMs - Date.now())` and\n * dispatches `deadlineExceeded(...)` when it fires; returns a cleanup that\n * clears the pending timer.\n *\n * It is `subscribeWith(setTimeoutArmTimer())` — the default backing named, not\n * a separate implementation, so the host-plugged path and the default path can\n * never disagree about the anchor.\n *\n * Assign directly to a `Subscribe` cell:\n *\n * subscribe: {\n * deadline: subscribeDeadline,\n * }\n */\nexport const subscribeDeadline: SubscribeHandler<\n DeadlineSub,\n DeadlineExceeded,\n unknown\n> = subscribeWith(setTimeoutArmTimer());\n\n/**\n * Construct the Msg the deadline dispatches. Exported so consumers can build /\n * assert the same shape (and so the subscribe cell and tests share one\n * constructor rather than two literals that can drift).\n */\nexport function deadlineExceeded(id: string, atMs: number): DeadlineExceeded {\n return { type: \"deadline_exceeded\", id, atMs };\n}\n"]}
@@ -1,71 +0,0 @@
1
- import { replay } from './chunk-5EHLEUTL.js';
2
- import { applyCell } from './chunk-B5VXOFMZ.js';
3
- import * as fc from 'fast-check';
4
-
5
- // src/pbt/runners/replay-fold.ts
6
- function foldEvents(machine, ctx, loaded, msgs) {
7
- const { state: initialState } = replay(machine, {
8
- msgs: [],
9
- ctx,
10
- loaded: loaded ?? null
11
- });
12
- const states = [initialState];
13
- const steps = [];
14
- let current = initialState;
15
- for (const msg of msgs) {
16
- const [next, emitted] = applyCell(machine, current, msg);
17
- steps.push({ prev: current, msg, next, cmds: [...emitted] });
18
- states.push(next);
19
- current = next;
20
- }
21
- return { states, steps, finalState: current };
22
- }
23
-
24
- // src/pbt/runners/property.ts
25
- function resolveFcParams(opts) {
26
- return {
27
- numRuns: opts?.numRuns ?? 200,
28
- ...opts?.seed !== void 0 ? { seed: opts.seed } : {}
29
- };
30
- }
31
- function runProperty(machine, ctx, seqArb, opts, check) {
32
- fc.assert(
33
- fc.property(seqArb, (msgs) => {
34
- check(foldEvents(machine, ctx, opts?.loaded ?? null, msgs));
35
- }),
36
- resolveFcParams(opts)
37
- );
38
- }
39
- function propertyTerminates(machine, ctx, seqArb, terminal, opts) {
40
- runProperty(machine, ctx, seqArb, opts, ({ finalState }) => {
41
- if (!terminal(finalState)) {
42
- throw new Error(
43
- `propertyTerminates: final state did not match terminal predicate. Final: ${JSON.stringify(finalState)}`
44
- );
45
- }
46
- });
47
- }
48
- function propertyInvariant(machine, ctx, seqArb, invariant, opts) {
49
- runProperty(machine, ctx, seqArb, opts, ({ steps }) => {
50
- for (const step of steps) {
51
- if (!invariant(step)) {
52
- throw new Error(
53
- `propertyInvariant: failed at step msg=${JSON.stringify(step.msg)} prev=${JSON.stringify(step.prev)} next=${JSON.stringify(step.next)} cmds=${JSON.stringify(step.cmds)}`
54
- );
55
- }
56
- }
57
- });
58
- }
59
- function propertyTrace(machine, ctx, seqArb, predicate, opts) {
60
- runProperty(machine, ctx, seqArb, opts, ({ steps, finalState }) => {
61
- if (!predicate(steps, finalState)) {
62
- throw new Error(
63
- `propertyTrace: predicate failed on trace length=${steps.length}, final=${JSON.stringify(finalState)}`
64
- );
65
- }
66
- });
67
- }
68
-
69
- export { foldEvents, propertyInvariant, propertyTerminates, propertyTrace };
70
- //# sourceMappingURL=chunk-JP5D6GSL.js.map
71
- //# sourceMappingURL=chunk-JP5D6GSL.js.map