@demlik/tea 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/README.md +11 -9
  2. package/dist/agent/index.d.ts +637 -45
  3. package/dist/agent/index.js +9 -19
  4. package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
  5. package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
  6. package/dist/chunk-AQ6ZIMEA.js +421 -0
  7. package/dist/chunk-AQ6ZIMEA.js.map +1 -0
  8. package/dist/{chunk-MUUROGIH.js → chunk-BLJ2JQSH.js} +62 -12
  9. package/dist/chunk-BLJ2JQSH.js.map +1 -0
  10. package/dist/{chunk-RH5EFRVJ.js → chunk-F2US5BW6.js} +25 -5
  11. package/dist/chunk-F2US5BW6.js.map +1 -0
  12. package/dist/{batch-window/index.js → chunk-F7FMAWLA.js} +4 -8
  13. package/dist/chunk-F7FMAWLA.js.map +1 -0
  14. package/dist/{chunk-O4MVQTEJ.js → chunk-HUKZQX6U.js} +20 -16
  15. package/dist/chunk-HUKZQX6U.js.map +1 -0
  16. package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
  17. package/dist/chunk-HWVW4AXC.js.map +1 -0
  18. package/dist/{chunk-DMYGQB4O.js → chunk-HYDWG35Q.js} +23 -6
  19. package/dist/chunk-HYDWG35Q.js.map +1 -0
  20. package/dist/{chunk-YUXP55T2.js → chunk-I5MQMJDW.js} +57 -7
  21. package/dist/chunk-I5MQMJDW.js.map +1 -0
  22. package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
  23. package/dist/chunk-LFZUK6J2.js.map +1 -0
  24. package/dist/{chunk-ZVJZ72HY.js → chunk-LYLTKJWM.js} +25 -11
  25. package/dist/chunk-LYLTKJWM.js.map +1 -0
  26. package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
  27. package/dist/chunk-MYXFNWAJ.js.map +1 -0
  28. package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
  29. package/dist/chunk-PR6TB3BL.js.map +1 -0
  30. package/dist/chunk-RQULHGYH.js +1804 -0
  31. package/dist/chunk-RQULHGYH.js.map +1 -0
  32. package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
  33. package/dist/chunk-TXN2KFHF.js.map +1 -0
  34. package/dist/{chunk-Q2UM7BXU.js → chunk-VBDU4JL6.js} +2 -2
  35. package/dist/chunk-VBDU4JL6.js.map +1 -0
  36. package/dist/chunk-Z2L3LSNV.js +1470 -0
  37. package/dist/chunk-Z2L3LSNV.js.map +1 -0
  38. package/dist/{core-Co0LWkIA.d.ts → core-CTzMJ82M.d.ts} +72 -23
  39. package/dist/devtools/index.d.ts +2 -2
  40. package/dist/devtools/index.js +207 -2
  41. package/dist/devtools/index.js.map +1 -1
  42. package/dist/do/index.d.ts +42 -29
  43. package/dist/do/index.js +36 -25
  44. package/dist/do/index.js.map +1 -1
  45. package/dist/{durable-effects-C6uwzjb5.d.ts → durable-effects-B0-qGQDy.d.ts} +2 -2
  46. package/dist/extension/index.d.ts +300 -3
  47. package/dist/extension/index.js +596 -5
  48. package/dist/extension/index.js.map +1 -1
  49. package/dist/flow/index.d.ts +1295 -0
  50. package/dist/flow/index.js +732 -0
  51. package/dist/flow/index.js.map +1 -0
  52. package/dist/idempotency/index.d.ts +90 -116
  53. package/dist/idempotency/index.js +4 -1
  54. package/dist/{batch-window/index.d.ts → index-4vZzljCD.d.ts} +7 -12
  55. package/dist/{fan-out/index.d.ts → index-6A7dB8f6.d.ts} +7 -9
  56. package/dist/index-B5BZ-_cT.d.ts +616 -0
  57. package/dist/index-Bc40JWVl.d.ts +131 -0
  58. package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
  59. package/dist/index-DJWIER_3.d.ts +69 -0
  60. package/dist/{snapshot/index.d.ts → index-DMCeMPMJ.d.ts} +15 -78
  61. package/dist/{monitored-run/index.d.ts → index-NjrT3fL2.d.ts} +37 -13
  62. package/dist/{recorder/index.d.ts → index-TvRb1KVf.d.ts} +4 -7
  63. package/dist/{deadline/index.d.ts → index-q0hXFeZ0.d.ts} +155 -9
  64. package/dist/index.d.ts +711 -6
  65. package/dist/index.js +1 -2
  66. package/dist/jev/index.d.ts +634 -0
  67. package/dist/jev/index.js +433 -0
  68. package/dist/jev/index.js.map +1 -0
  69. package/dist/machine-CdIcN2Xm.d.ts +1773 -0
  70. package/dist/machine-viz/index.d.ts +1 -1
  71. package/dist/machine-viz/index.js +12 -5
  72. package/dist/machine-viz/index.js.map +1 -1
  73. package/dist/mem/index.d.ts +18 -3
  74. package/dist/mem/index.js +22 -2
  75. package/dist/mem/index.js.map +1 -1
  76. package/dist/node/index.d.ts +104 -6
  77. package/dist/node/index.js +132 -9
  78. package/dist/node/index.js.map +1 -1
  79. package/dist/{paginator → paginate}/index.d.ts +151 -6
  80. package/dist/paginate/index.js +7 -0
  81. package/dist/parity/index.d.ts +4 -10
  82. package/dist/parity/index.js +4 -7
  83. package/dist/parity/index.js.map +1 -1
  84. package/dist/pbt/index.d.ts +247 -5
  85. package/dist/pbt/index.js +124 -5
  86. package/dist/pbt/index.js.map +1 -1
  87. package/dist/{trace-replay → persistence}/index.d.ts +7 -5
  88. package/dist/persistence/index.js +6 -0
  89. package/dist/react/index.d.ts +2 -2
  90. package/dist/react/index.js +1 -2
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/resilience/index.d.ts +743 -0
  93. package/dist/resilience/index.js +657 -0
  94. package/dist/resilience/index.js.map +1 -0
  95. package/dist/retry-backoff/index.d.ts +3 -2
  96. package/dist/retry-backoff/index.js +1 -1
  97. package/dist/runtime-types-LWDoi943.d.ts +998 -0
  98. package/dist/testing/index.d.ts +2 -2
  99. package/dist/testing/index.js +1 -2
  100. package/dist/testing/index.js.map +1 -1
  101. package/dist/{throttled-input → timing}/index.d.ts +143 -12
  102. package/dist/{throttled-input → timing}/index.js +57 -12
  103. package/dist/timing/index.js.map +1 -0
  104. package/dist/{types-XS_miRnB.d.ts → types-DP3f5NIl.d.ts} +1 -1
  105. package/dist/work-queue/index.d.ts +130 -54
  106. package/dist/work-queue/index.js +3 -2
  107. package/dist/work-queue/index.js.map +1 -1
  108. package/package.json +45 -218
  109. package/dist/authed-call/index.d.ts +0 -120
  110. package/dist/authed-call/index.js +0 -134
  111. package/dist/authed-call/index.js.map +0 -1
  112. package/dist/await-terminal/index.d.ts +0 -101
  113. package/dist/await-terminal/index.js +0 -76
  114. package/dist/await-terminal/index.js.map +0 -1
  115. package/dist/batch-window/index.js.map +0 -1
  116. package/dist/cache/index.d.ts +0 -152
  117. package/dist/cache/index.js +0 -8
  118. package/dist/chart/index.d.ts +0 -218
  119. package/dist/chart/index.js +0 -16
  120. package/dist/chart/index.js.map +0 -1
  121. package/dist/chart/inspect/index.d.ts +0 -86
  122. package/dist/chart/inspect/index.js +0 -5
  123. package/dist/chart/inspect/react.d.ts +0 -113
  124. package/dist/chart/inspect/react.js +0 -11
  125. package/dist/chart/inspect/react.js.map +0 -1
  126. package/dist/chart/inspect/styles.css +0 -286
  127. package/dist/chart/lane/index.d.ts +0 -362
  128. package/dist/chart/lane/index.js +0 -9
  129. package/dist/chart/lane/index.js.map +0 -1
  130. package/dist/chart/lane/react.d.ts +0 -84
  131. package/dist/chart/lane/react.js +0 -559
  132. package/dist/chart/lane/react.js.map +0 -1
  133. package/dist/chart/lane/server.d.ts +0 -148
  134. package/dist/chart/lane/server.js +0 -209
  135. package/dist/chart/lane/server.js.map +0 -1
  136. package/dist/chart/lane/styles.css +0 -498
  137. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
  138. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
  139. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
  140. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
  141. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
  142. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
  143. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
  144. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
  145. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
  146. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
  147. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
  148. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
  149. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
  150. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
  151. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
  152. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
  153. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
  154. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
  155. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
  156. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
  157. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
  158. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
  159. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
  160. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
  161. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
  162. package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
  163. package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
  164. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
  165. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
  166. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
  167. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
  168. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
  169. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
  170. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
  171. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
  172. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
  173. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
  174. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
  175. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
  176. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
  177. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
  178. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
  179. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
  180. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
  181. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
  182. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
  183. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
  184. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
  185. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
  186. package/dist/chart/lane/viewer/index.html +0 -15
  187. package/dist/chart/report/index.d.ts +0 -117
  188. package/dist/chart/report/index.js +0 -32
  189. package/dist/chart/report/index.js.map +0 -1
  190. package/dist/chunk-2YFLOCWX.js +0 -15
  191. package/dist/chunk-2YFLOCWX.js.map +0 -1
  192. package/dist/chunk-3I52QZZ5.js +0 -519
  193. package/dist/chunk-3I52QZZ5.js.map +0 -1
  194. package/dist/chunk-3ZAFFRRB.js +0 -457
  195. package/dist/chunk-3ZAFFRRB.js.map +0 -1
  196. package/dist/chunk-4EQZ76JC.js +0 -33
  197. package/dist/chunk-4EQZ76JC.js.map +0 -1
  198. package/dist/chunk-4KLG43GY.js +0 -223
  199. package/dist/chunk-4KLG43GY.js.map +0 -1
  200. package/dist/chunk-7FRZ2CT2.js +0 -424
  201. package/dist/chunk-7FRZ2CT2.js.map +0 -1
  202. package/dist/chunk-AZZLE7XR.js +0 -62
  203. package/dist/chunk-AZZLE7XR.js.map +0 -1
  204. package/dist/chunk-BYQUGDD3.js +0 -16
  205. package/dist/chunk-BYQUGDD3.js.map +0 -1
  206. package/dist/chunk-CIQG5L42.js +0 -685
  207. package/dist/chunk-CIQG5L42.js.map +0 -1
  208. package/dist/chunk-CLM6ERNO.js +0 -61
  209. package/dist/chunk-CLM6ERNO.js.map +0 -1
  210. package/dist/chunk-COS5MSTO.js +0 -88
  211. package/dist/chunk-COS5MSTO.js.map +0 -1
  212. package/dist/chunk-CRPZJVD2.js +0 -71
  213. package/dist/chunk-CRPZJVD2.js.map +0 -1
  214. package/dist/chunk-D62FDQKE.js +0 -53
  215. package/dist/chunk-D62FDQKE.js.map +0 -1
  216. package/dist/chunk-D736QUGF.js.map +0 -1
  217. package/dist/chunk-DGE4PV4A.js +0 -26
  218. package/dist/chunk-DGE4PV4A.js.map +0 -1
  219. package/dist/chunk-DMYGQB4O.js.map +0 -1
  220. package/dist/chunk-EWJP3YYP.js.map +0 -1
  221. package/dist/chunk-FV3Z5MBE.js.map +0 -1
  222. package/dist/chunk-HCEVHFJ7.js +0 -54
  223. package/dist/chunk-HCEVHFJ7.js.map +0 -1
  224. package/dist/chunk-J6527VRQ.js.map +0 -1
  225. package/dist/chunk-JELSZN25.js +0 -47
  226. package/dist/chunk-JELSZN25.js.map +0 -1
  227. package/dist/chunk-K575PT4S.js.map +0 -1
  228. package/dist/chunk-L57ZOT5K.js +0 -184
  229. package/dist/chunk-L57ZOT5K.js.map +0 -1
  230. package/dist/chunk-MU6MCIAC.js +0 -15
  231. package/dist/chunk-MU6MCIAC.js.map +0 -1
  232. package/dist/chunk-MUUROGIH.js.map +0 -1
  233. package/dist/chunk-NR7BU22N.js +0 -758
  234. package/dist/chunk-NR7BU22N.js.map +0 -1
  235. package/dist/chunk-O4MVQTEJ.js.map +0 -1
  236. package/dist/chunk-OOYD44JI.js +0 -317
  237. package/dist/chunk-OOYD44JI.js.map +0 -1
  238. package/dist/chunk-Q2UM7BXU.js.map +0 -1
  239. package/dist/chunk-RH5EFRVJ.js.map +0 -1
  240. package/dist/chunk-S2EGRPCM.js +0 -47
  241. package/dist/chunk-S2EGRPCM.js.map +0 -1
  242. package/dist/chunk-SINXE47Y.js +0 -55
  243. package/dist/chunk-SINXE47Y.js.map +0 -1
  244. package/dist/chunk-UF4MZSLT.js +0 -53
  245. package/dist/chunk-UF4MZSLT.js.map +0 -1
  246. package/dist/chunk-UOC2PL46.js +0 -13
  247. package/dist/chunk-UOC2PL46.js.map +0 -1
  248. package/dist/chunk-VYFAZN3F.js +0 -372
  249. package/dist/chunk-VYFAZN3F.js.map +0 -1
  250. package/dist/chunk-WRAA7GVZ.js +0 -209
  251. package/dist/chunk-WRAA7GVZ.js.map +0 -1
  252. package/dist/chunk-XGELA764.js +0 -163
  253. package/dist/chunk-XGELA764.js.map +0 -1
  254. package/dist/chunk-YUXP55T2.js.map +0 -1
  255. package/dist/chunk-YWIKDKHY.js +0 -307
  256. package/dist/chunk-YWIKDKHY.js.map +0 -1
  257. package/dist/chunk-ZJ5AOYBH.js +0 -8
  258. package/dist/chunk-ZJ5AOYBH.js.map +0 -1
  259. package/dist/chunk-ZSUUOEPL.js +0 -731
  260. package/dist/chunk-ZSUUOEPL.js.map +0 -1
  261. package/dist/chunk-ZVJZ72HY.js.map +0 -1
  262. package/dist/circuit-breaker/index.d.ts +0 -197
  263. package/dist/circuit-breaker/index.js +0 -3
  264. package/dist/circuit-breaker/index.js.map +0 -1
  265. package/dist/deadline/index.js +0 -6
  266. package/dist/deadline/index.js.map +0 -1
  267. package/dist/debounce/index.js +0 -3
  268. package/dist/debounce/index.js.map +0 -1
  269. package/dist/extension/react.d.ts +0 -121
  270. package/dist/extension/react.js +0 -75
  271. package/dist/extension/react.js.map +0 -1
  272. package/dist/extension/subs/index.d.ts +0 -45
  273. package/dist/extension/subs/index.js +0 -80
  274. package/dist/extension/subs/index.js.map +0 -1
  275. package/dist/extension/test-utils.d.ts +0 -128
  276. package/dist/extension/test-utils.js +0 -277
  277. package/dist/extension/test-utils.js.map +0 -1
  278. package/dist/fan-out/index.js +0 -5
  279. package/dist/fan-out/index.js.map +0 -1
  280. package/dist/fold-BJPdjc9w.d.ts +0 -435
  281. package/dist/graph-B3L5e0N1.d.ts +0 -923
  282. package/dist/idempotency/adapter.d.ts +0 -62
  283. package/dist/idempotency/adapter.js +0 -4
  284. package/dist/idempotency/adapter.js.map +0 -1
  285. package/dist/idempotent-intake/index.d.ts +0 -188
  286. package/dist/idempotent-intake/index.js +0 -7
  287. package/dist/idempotent-intake/index.js.map +0 -1
  288. package/dist/journal/index.d.ts +0 -373
  289. package/dist/journal/index.js +0 -3
  290. package/dist/journal/index.js.map +0 -1
  291. package/dist/llm-call/index.d.ts +0 -311
  292. package/dist/llm-call/index.js +0 -16
  293. package/dist/llm-call/index.js.map +0 -1
  294. package/dist/machine-BtFWQmmq.d.ts +0 -804
  295. package/dist/monitored-run/index.js +0 -10
  296. package/dist/monitored-run/index.js.map +0 -1
  297. package/dist/paginated-walk/index.d.ts +0 -235
  298. package/dist/paginated-walk/index.js +0 -16
  299. package/dist/paginated-walk/index.js.map +0 -1
  300. package/dist/paginator/index.js +0 -3
  301. package/dist/paginator/index.js.map +0 -1
  302. package/dist/pbt/arbitraries/index.d.ts +0 -136
  303. package/dist/pbt/arbitraries/index.js +0 -3
  304. package/dist/pbt/arbitraries/index.js.map +0 -1
  305. package/dist/pbt/runners/index.d.ts +0 -118
  306. package/dist/pbt/runners/index.js +0 -5
  307. package/dist/pbt/runners/index.js.map +0 -1
  308. package/dist/poller/index.d.ts +0 -352
  309. package/dist/poller/index.js +0 -115
  310. package/dist/poller/index.js.map +0 -1
  311. package/dist/prediction/index.d.ts +0 -131
  312. package/dist/prediction/index.js +0 -4
  313. package/dist/prediction/index.js.map +0 -1
  314. package/dist/protocol-B5YmJr0d.d.ts +0 -45
  315. package/dist/pure/index.d.ts +0 -3
  316. package/dist/pure/index.js +0 -4
  317. package/dist/pure/index.js.map +0 -1
  318. package/dist/rate-limit/index.d.ts +0 -115
  319. package/dist/rate-limit/index.js +0 -3
  320. package/dist/rate-limit/index.js.map +0 -1
  321. package/dist/reconciler/index.d.ts +0 -193
  322. package/dist/reconciler/index.js +0 -164
  323. package/dist/reconciler/index.js.map +0 -1
  324. package/dist/recorder/index.js +0 -3
  325. package/dist/recorder/index.js.map +0 -1
  326. package/dist/reducer-4GNR6b8B.d.ts +0 -447
  327. package/dist/resilient-call/index.d.ts +0 -320
  328. package/dist/resilient-call/index.js +0 -14
  329. package/dist/resilient-call/index.js.map +0 -1
  330. package/dist/retry-to-success/index.d.ts +0 -109
  331. package/dist/retry-to-success/index.js +0 -37
  332. package/dist/retry-to-success/index.js.map +0 -1
  333. package/dist/run-pAcmBpah.d.ts +0 -713
  334. package/dist/runtime-types-CNLmhWif.d.ts +0 -517
  335. package/dist/saga/index.d.ts +0 -241
  336. package/dist/saga/index.js +0 -150
  337. package/dist/saga/index.js.map +0 -1
  338. package/dist/samples-B3My5oh2.d.ts +0 -59
  339. package/dist/snapshot/index.js +0 -5
  340. package/dist/snapshot/index.js.map +0 -1
  341. package/dist/subs/index.d.ts +0 -472
  342. package/dist/subs/index.js +0 -7
  343. package/dist/subs/index.js.map +0 -1
  344. package/dist/throttle/index.d.ts +0 -134
  345. package/dist/throttle/index.js +0 -3
  346. package/dist/throttle/index.js.map +0 -1
  347. package/dist/throttled-input/index.js.map +0 -1
  348. package/dist/token-refresh/index.d.ts +0 -216
  349. package/dist/token-refresh/index.js +0 -6
  350. package/dist/token-refresh/index.js.map +0 -1
  351. package/dist/trace-replay/index.js +0 -6
  352. package/dist/trace-replay/index.js.map +0 -1
  353. package/dist/with-deadline/index.d.ts +0 -197
  354. package/dist/with-deadline/index.js +0 -111
  355. package/dist/with-deadline/index.js.map +0 -1
  356. package/dist/with-resilience/index.d.ts +0 -225
  357. package/dist/with-resilience/index.js +0 -240
  358. package/dist/with-resilience/index.js.map +0 -1
  359. package/dist/with-telemetry/index.d.ts +0 -150
  360. package/dist/with-telemetry/index.js +0 -70
  361. package/dist/with-telemetry/index.js.map +0 -1
  362. package/dist/work-queue/adapter.d.ts +0 -84
  363. package/dist/work-queue/adapter.js +0 -4
  364. package/dist/work-queue/adapter.js.map +0 -1
  365. package/dist/work-queue/ops.d.ts +0 -71
  366. package/dist/work-queue/ops.js +0 -3
  367. package/dist/work-queue/ops.js.map +0 -1
  368. package/dist/workflow/index.d.ts +0 -485
  369. package/dist/workflow/index.js +0 -244
  370. package/dist/workflow/index.js.map +0 -1
  371. /package/dist/{cache → paginate}/index.js.map +0 -0
  372. /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
@@ -1,424 +0,0 @@
1
- import { describeChart, describeReducerChart, inspectState, inspectReducerState, captureCmds } from './chunk-3ZAFFRRB.js';
2
- import { compile, initFrom, compileReducer, reducerInitFrom, chartMermaid, reducerMermaid } from './chunk-YWIKDKHY.js';
3
- import { recorder } from './chunk-MUUROGIH.js';
4
- import { run, replay } from './chunk-ZSUUOEPL.js';
5
- import { useMsgHistory, StateInspector, StateDiff, MsgLog } from './chunk-WRAA7GVZ.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(
49
- machine,
50
- ctx,
51
- epoch
52
- );
53
- const desc = useMemo(() => describeChart(chart), [chart]);
54
- const view = useMemo(
55
- () => gridView(desc, chart, parts, props.title, props.direction),
56
- [desc, chart, parts, props.title, props.direction]
57
- );
58
- if (rt === null) {
59
- return /* @__PURE__ */ jsx("div", { className: containerClass(props.className), children: /* @__PURE__ */ jsx("div", { className: "tea-ci-boot", children: "booting\u2026" }) });
60
- }
61
- return /* @__PURE__ */ jsx(
62
- InspectorView,
63
- {
64
- view,
65
- samples: props.samples,
66
- runtime: rt,
67
- rec,
68
- machine,
69
- ctx,
70
- title: props.title,
71
- className: props.className,
72
- onReset: reset
73
- },
74
- epoch
75
- );
76
- }
77
- function ReducerChartInspector(props) {
78
- const { chart, parts, boot, ctx } = props;
79
- const [epoch, reset] = useReducer((n) => n + 1, 0);
80
- const machine = useMemo(
81
- () => ({
82
- init: reducerInitFrom(chart, boot),
83
- // The one cast, for the same reason as the grid form's: `compileReducer`
84
- // returns a `Reducer` over the chart's OWN derivations.
85
- update: compileReducer(chart, parts)
86
- }),
87
- [chart, parts, boot]
88
- );
89
- const { rt, rec } = useInspectorRuntime(
90
- machine,
91
- ctx,
92
- epoch
93
- );
94
- const desc = useMemo(() => describeReducerChart(chart), [chart]);
95
- const view = useMemo(
96
- () => reducerView(desc, chart, parts),
97
- [desc, chart, parts]
98
- );
99
- if (rt === null) {
100
- return /* @__PURE__ */ jsx("div", { className: containerClass(props.className), children: /* @__PURE__ */ jsx("div", { className: "tea-ci-boot", children: "booting\u2026" }) });
101
- }
102
- return /* @__PURE__ */ jsx(
103
- InspectorView,
104
- {
105
- view,
106
- samples: props.samples,
107
- runtime: rt,
108
- rec,
109
- machine,
110
- ctx,
111
- title: props.title,
112
- className: props.className,
113
- onReset: reset
114
- },
115
- epoch
116
- );
117
- }
118
- function containerClass(extra) {
119
- return `tea-ci${extra ? ` ${extra}` : ""}`;
120
- }
121
- function gridView(desc, chart, parts, title, direction) {
122
- return {
123
- events: desc.events,
124
- controls: (state, samples) => inspectState(desc, state, { parts, samples }).map(
125
- gridControl
126
- ),
127
- mermaid: (state) => chartMermaid(chart, {
128
- highlight: state.type,
129
- phases: true,
130
- direction,
131
- title
132
- }),
133
- header: (state) => {
134
- const here = desc.states.find((s) => s.name === state.type);
135
- return {
136
- ...here === void 0 ? {} : { phase: here.phase },
137
- tags: [
138
- ...here?.end === true ? ["end"] : [],
139
- ...here?.parking === true ? ["parking"] : []
140
- ]
141
- };
142
- },
143
- omits: []
144
- };
145
- }
146
- function reducerView(desc, chart, parts) {
147
- return {
148
- events: desc.events,
149
- controls: (state, samples) => inspectReducerState(desc, state, {
150
- parts,
151
- samples
152
- }).map(reducerControl),
153
- // No `highlight`: every edge leaves the one `any` node, so there is no
154
- // node that IS the current state to light up.
155
- mermaid: () => reducerMermaid(chart),
156
- // No phase, no `end`, no `parking` — this form declares none of the three.
157
- header: () => ({ tags: [] }),
158
- omits: [desc.phases, desc.refusals, desc.scope]
159
- };
160
- }
161
- function gridControl(v) {
162
- const refused = v.status === "refused";
163
- return {
164
- event: v.event,
165
- kind: refused ? v.reason?.kind ?? "undeclared" : "legal",
166
- refused,
167
- ...v.why === void 0 ? {} : { why: v.why },
168
- outcome: describeOutcome(v),
169
- ...v.msg === void 0 ? {} : { msg: v.msg }
170
- };
171
- }
172
- function reducerControl(v) {
173
- return {
174
- event: v.event,
175
- kind: "legal",
176
- refused: false,
177
- outcome: describeOutcome(v),
178
- ...v.msg === void 0 ? {} : { msg: v.msg }
179
- };
180
- }
181
- function InspectorView({
182
- view,
183
- samples,
184
- runtime,
185
- rec,
186
- machine,
187
- ctx,
188
- title,
189
- className,
190
- onReset
191
- }) {
192
- const [tick, bump] = useReducer((n) => n + 1, 0);
193
- useEffect(() => runtime.subscribe(bump), [runtime]);
194
- const liveState = runtime.getState();
195
- const [history, send] = useMsgHistory(runtime.dispatch);
196
- const [drafts, setDrafts] = useState(
197
- () => seedDrafts(view.events, samples)
198
- );
199
- const effective = useMemo(() => parseDrafts(drafts), [drafts]);
200
- const [at, setAt] = useState(null);
201
- const trace = safeDump(rec, liveState);
202
- const total = trace.msgs.length;
203
- const cursor = at === null ? total : Math.min(at, total);
204
- const scrubbed = at !== null && cursor < total;
205
- const shown = replayPrefix(machine, trace, ctx, cursor, liveState);
206
- const previous = replayPrefix(
207
- machine,
208
- trace,
209
- ctx,
210
- Math.max(0, cursor - 1),
211
- liveState
212
- );
213
- const verdicts = view.controls(shown, effective);
214
- const here = view.header(shown);
215
- const tape = useRef(trace);
216
- tape.current = trace;
217
- const capture = useMemo(
218
- () => captureCmds(machine, {
219
- msgs: tape.current.msgs,
220
- ctx,
221
- loaded: tape.current.loaded
222
- }),
223
- [machine, ctx, total]
224
- );
225
- return /* @__PURE__ */ jsxs("div", { className: containerClass(className), children: [
226
- /* @__PURE__ */ jsxs("header", { className: "tea-ci-head", children: [
227
- /* @__PURE__ */ jsx("span", { className: "tea-ci-title", children: title ?? "chart inspector" }),
228
- /* @__PURE__ */ jsxs("span", { className: "tea-ci-now", children: [
229
- here.phase === void 0 ? null : /* @__PURE__ */ jsx("span", { className: "tea-ci-phase", children: here.phase }),
230
- /* @__PURE__ */ jsx("span", { className: "tea-ci-state", children: shown.type }),
231
- here.tags.map((t) => /* @__PURE__ */ jsx("span", { className: "tea-ci-tag", children: t }, t))
232
- ] }),
233
- scrubbed ? /* @__PURE__ */ jsxs("span", { className: "tea-ci-warn", children: [
234
- "time-travelling \u2014 step ",
235
- cursor,
236
- " of ",
237
- total
238
- ] }) : null
239
- ] }),
240
- /* @__PURE__ */ jsx("section", { className: "tea-ci-panel tea-ci-events", children: verdicts.map((v) => /* @__PURE__ */ jsx(
241
- EventControl,
242
- {
243
- control: v,
244
- disabled: scrubbed,
245
- draft: drafts[v.event],
246
- onDraft: (text) => setDrafts((d) => ({ ...d, [v.event]: text })),
247
- onSend: () => {
248
- setAt(null);
249
- if (v.msg !== void 0) send(v.msg);
250
- }
251
- },
252
- v.event
253
- )) }),
254
- /* @__PURE__ */ jsxs("div", { className: "tea-ci-cols", children: [
255
- /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel", children: [
256
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "state" }),
257
- /* @__PURE__ */ jsx(StateInspector, { state: shown, flashKey: cursor + tick }),
258
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "diff vs previous step" }),
259
- /* @__PURE__ */ jsx(StateDiff, { expected: previous, actual: shown })
260
- ] }),
261
- /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel", children: [
262
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "diagram" }),
263
- /* @__PURE__ */ jsx("pre", { className: "mermaid tea-ci-mermaid", children: view.mermaid(shown) }, view.mermaid(shown))
264
- ] })
265
- ] }),
266
- /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel tea-ci-fired", children: [
267
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "cmds fired" }),
268
- /* @__PURE__ */ jsx("ol", { className: "tea-ci-firelog", children: capture.steps.map((s) => /* @__PURE__ */ jsxs(
269
- "li",
270
- {
271
- className: `tea-ci-fire${s.step === cursor ? " tea-ci-fire-now" : ""}`,
272
- "data-step": s.step,
273
- "data-fired": s.cmds.length,
274
- children: [
275
- /* @__PURE__ */ jsx("span", { className: "tea-ci-fire-by", children: s.by?.type ?? "init" }),
276
- /* @__PURE__ */ jsx("span", { className: "tea-ci-fire-cmds", children: s.cmds.length === 0 ? "\u2014" : s.cmds.map((c) => c.type).join(", ") })
277
- ]
278
- },
279
- s.step
280
- )) }),
281
- capture.stoppedAt === void 0 ? null : /* @__PURE__ */ jsxs("span", { className: "tea-ci-why", children: [
282
- "capture stopped at step ",
283
- capture.stoppedAt.step,
284
- ":",
285
- " ",
286
- capture.stoppedAt.error
287
- ] })
288
- ] }),
289
- view.omits.length === 0 ? null : /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel tea-ci-omits", children: [
290
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "not available in this form" }),
291
- /* @__PURE__ */ jsx("ul", { children: view.omits.map((o) => /* @__PURE__ */ jsxs("li", { "data-omitted": o.question, children: [
292
- /* @__PURE__ */ jsx("b", { children: o.question }),
293
- " \u2014 ",
294
- o.why
295
- ] }, o.question)) })
296
- ] }),
297
- /* @__PURE__ */ jsxs("section", { className: "tea-ci-panel tea-ci-travel", children: [
298
- /* @__PURE__ */ jsx("h3", { className: "tea-ci-h", children: "time travel" }),
299
- /* @__PURE__ */ jsxs("div", { className: "tea-ci-scrub", children: [
300
- /* @__PURE__ */ jsx(
301
- "input",
302
- {
303
- type: "range",
304
- min: 0,
305
- max: total,
306
- value: cursor,
307
- "aria-label": "transition",
308
- onChange: (e) => setAt(Number(e.target.value))
309
- }
310
- ),
311
- /* @__PURE__ */ jsxs("span", { className: "tea-ci-step", children: [
312
- cursor,
313
- " / ",
314
- total,
315
- cursor > 0 ? ` \xB7 ${String(trace.msgs[cursor - 1]?.type)}` : ""
316
- ] }),
317
- /* @__PURE__ */ jsx(
318
- "button",
319
- {
320
- type: "button",
321
- onClick: () => setAt(null),
322
- disabled: !scrubbed,
323
- children: "live"
324
- }
325
- ),
326
- /* @__PURE__ */ jsx("button", { type: "button", onClick: onReset, children: "reset" })
327
- ] }),
328
- /* @__PURE__ */ jsx(MsgLog, { history })
329
- ] })
330
- ] });
331
- }
332
- function EventControl({
333
- control,
334
- disabled,
335
- draft,
336
- onDraft,
337
- onSend
338
- }) {
339
- const { event, refused, kind, why, outcome, msg } = control;
340
- const blocked = refused || disabled || msg === void 0;
341
- return /* @__PURE__ */ jsxs(
342
- "div",
343
- {
344
- className: `tea-ci-ev tea-ci-ev-${kind}`,
345
- "data-event": event,
346
- "data-status": refused ? "refused" : "legal",
347
- children: [
348
- /* @__PURE__ */ jsx(
349
- "button",
350
- {
351
- type: "button",
352
- className: "tea-ci-btn",
353
- disabled: blocked,
354
- title: why ?? outcome,
355
- onClick: onSend,
356
- children: event
357
- }
358
- ),
359
- refused ? /* @__PURE__ */ jsx("span", { className: "tea-ci-why", children: why }) : /* @__PURE__ */ jsx("span", { className: "tea-ci-to", children: outcome }),
360
- draft === void 0 ? null : /* @__PURE__ */ jsx(
361
- "textarea",
362
- {
363
- className: "tea-ci-sample",
364
- "aria-label": `${event} payload`,
365
- rows: 1,
366
- value: draft,
367
- onChange: (e) => onDraft(e.target.value)
368
- }
369
- ),
370
- msg === void 0 && !refused ? /* @__PURE__ */ jsx("span", { className: "tea-ci-why", children: "no sample \u2014 cannot dispatch" }) : null
371
- ]
372
- }
373
- );
374
- }
375
- function describeOutcome(v) {
376
- const cmds = v.cmds.length > 0 ? ` / ${v.cmds.join(", ")}` : "";
377
- if (v.guard !== void 0) {
378
- 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}`;
379
- }
380
- if (v.resolved !== void 0) return `\u2192 ${v.resolved}${cmds}`;
381
- return `${v.targets.join(" | ")}${cmds}`;
382
- }
383
- function seedDrafts(events, samples) {
384
- const bag = samples ?? {};
385
- const out = {};
386
- for (const e of events) {
387
- if (!e.hasPayload) continue;
388
- out[e.name] = JSON.stringify(bag[e.name] ?? {});
389
- }
390
- return out;
391
- }
392
- function parseDrafts(drafts) {
393
- const out = {};
394
- for (const [k, text] of Object.entries(drafts)) {
395
- try {
396
- const v = JSON.parse(text);
397
- if (typeof v === "object" && v !== null) out[k] = v;
398
- } catch {
399
- }
400
- }
401
- return out;
402
- }
403
- function safeDump(rec, live) {
404
- try {
405
- return rec.dump();
406
- } catch {
407
- return { loaded: null, msgs: [], finalState: live };
408
- }
409
- }
410
- function replayPrefix(machine, trace, ctx, n, live) {
411
- try {
412
- return replay(machine, {
413
- msgs: trace.msgs.slice(0, n),
414
- ctx,
415
- loaded: trace.loaded
416
- }).state;
417
- } catch {
418
- return live;
419
- }
420
- }
421
-
422
- export { ChartInspector, ReducerChartInspector, useInspectorRuntime };
423
- //# sourceMappingURL=chunk-7FRZ2CT2.js.map
424
- //# sourceMappingURL=chunk-7FRZ2CT2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/chart/inspect/react.tsx"],"names":[],"mappings":";;;;;;;;AA8LO,SAAS,mBAAA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ACF,IAAA,OAAO,OAAO,OAAA,EAAS;AAAA,MACrB,IAAA,EAAM,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,GAAG,CAAC,CAAA;AAAA,MAC3B,GAAA;AAAA,MACA,QAAQ,KAAA,CAAM;AAAA,KACf,CAAA,CAAE,KAAA;AAAA,EACL,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"chunk-7FRZ2CT2.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, RequiredCtx, 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 // What `run` demands: the machine's ctx plus every typed Cmd's `R`.\n ctx: Ctx & RequiredCtx<K>,\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(\n machine,\n ctx as Ctx & RequiredCtx<K>,\n epoch,\n );\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(\n machine,\n ctx as Ctx & RequiredCtx<K>,\n epoch,\n );\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,62 +0,0 @@
1
- import * as fc from 'fast-check';
2
-
3
- // src/pbt/arbitraries/ctx.ts
4
- function stubCtxThrowingProxy() {
5
- const handler = {
6
- get(_target, prop) {
7
- if (typeof prop === "symbol") return void 0;
8
- if (prop === "toJSON" || prop === "toString" || prop === "valueOf" || prop === "then") {
9
- return void 0;
10
- }
11
- throw new Error(
12
- `@demlik/tea/pbt: ctx access denied (PBT operates on the pure reducer; ctx field '${prop}' was read). Pass a real ctx value if the reducer's init reads from ctx.`
13
- );
14
- },
15
- has() {
16
- return false;
17
- },
18
- ownKeys() {
19
- return [];
20
- }
21
- };
22
- return new Proxy({}, handler);
23
- }
24
- function arbMsg(table, opts) {
25
- const weights = opts?.weights;
26
- const entries = Object.entries(table);
27
- if (entries.length === 0) {
28
- throw new Error("@demlik/tea/pbt: arbMsg table is empty");
29
- }
30
- const weighted = entries.map(([key, arb]) => ({
31
- arbitrary: arb,
32
- weight: weights?.[key] ?? 1
33
- }));
34
- return fc.oneof(...weighted);
35
- }
36
- function arbConstantMsg(type) {
37
- return fc.constant({ type });
38
- }
39
- function arbRecordMsg(type, fields) {
40
- const recordArbitraries = {
41
- type: fc.constant(type),
42
- ...fields
43
- };
44
- return fc.record(recordArbitraries);
45
- }
46
- function arbMsgSequence(msgArb, opts) {
47
- const minLength = opts?.minLength ?? 0;
48
- const maxLength = opts?.maxLength ?? 30;
49
- const prefix = opts?.prefix ?? [];
50
- const tail = fc.array(msgArb, { minLength, maxLength });
51
- if (prefix.length === 0) return tail;
52
- return tail.map((arr) => [...prefix, ...arr]);
53
- }
54
- function arbGuidedSequence(_machine, _ctx, _cells, _opts) {
55
- throw new Error(
56
- "@demlik/tea/pbt: arbGuidedSequence is not implemented in v1. Use arbMsgSequence with an unguided arbMsg table for now; states that don't accept a given msg should noop in the reducer (mapped-type discipline)."
57
- );
58
- }
59
-
60
- export { arbConstantMsg, arbGuidedSequence, arbMsg, arbMsgSequence, arbRecordMsg, stubCtxThrowingProxy };
61
- //# sourceMappingURL=chunk-AZZLE7XR.js.map
62
- //# sourceMappingURL=chunk-AZZLE7XR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/pbt/arbitraries/ctx.ts","../src/pbt/arbitraries/msg.ts","../src/pbt/arbitraries/sequence.ts"],"names":["fc2"],"mappings":";;;AAyCO,SAAS,oBAAA,GAAiC;AAC/C,EAAA,MAAM,OAAA,GAAgC;AAAA,IACpC,GAAA,CAAI,SAAS,IAAA,EAAgC;AAK3C,MAAA,IAAI,OAAO,IAAA,KAAS,QAAA,EAAU,OAAO,MAAA;AAKrC,MAAA,IACE,SAAS,QAAA,IACT,IAAA,KAAS,cACT,IAAA,KAAS,SAAA,IACT,SAAS,MAAA,EACT;AACA,QAAA,OAAO,MAAA;AAAA,MACT;AACA,MAAA,MAAM,IAAI,KAAA;AAAA,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ACrC,EAAA,MAAM,MAAA,GAAS,IAAA,EAAM,MAAA,IAAU,EAAC;AAChC,EAAA,MAAM,OAAUA,EAAA,CAAA,KAAA,CAAM,MAAA,EAAQ,EAAE,SAAA,EAAW,WAAW,CAAA;AACtD,EAAA,IAAI,MAAA,CAAO,MAAA,KAAW,CAAA,EAAG,OAAO,IAAA;AAChC,EAAA,OAAO,IAAA,CAAK,IAAI,CAAC,GAAA,KAAQ,CAAC,GAAG,MAAA,EAAQ,GAAG,GAAG,CAAC,CAAA;AAC9C;AAWO,SAAS,iBAAA,CAOd,QAAA,EACA,IAAA,EACA,MAAA,EAKA,KAAA,EAC4B;AAC5B,EAAA,MAAM,IAAI,KAAA;AAAA,IACR;AAAA,GAIF;AACF","file":"chunk-AZZLE7XR.js","sourcesContent":["// ---------------------------------------------------------------------------\n// `stubCtxThrowingProxy<Ctx>()` — a Proxy that satisfies the Ctx type-shape\n// at compile time but throws on every property access at runtime.\n//\n// Why this exists: PBT runs the pure reducer surface ONLY — `replay` never\n// invokes `interpret` and never starts a Sub, so Ctx should never be\n// dereferenced during property generation. But the substrate's `replay`\n// signature requires a `ctx: Ctx` value at compile time (it forwards ctx\n// into `init`, which on some machines IS pure but on others reads ctx). A\n// hand-rolled `{} as Ctx` would silently pass through any accidental ctx\n// access — exactly the silent footgun this proxy catches.\n//\n// Open question 2 (design doc): we ship this as the default. Tests that\n// genuinely need a working ctx (because their `init` reads from it) can\n// pass a real ctx value instead — the proxy is opt-in, not load-bearing.\n//\n// Strengthens invariant 6 (no silent failures — accidental ctx reads\n// produce a useful error, not a `undefined.foo` confusion later).\n// ---------------------------------------------------------------------------\n\n/**\n * Build a Ctx value whose every property access throws. Use as the `ctx`\n * argument to PBT runners when the reducer under test is pure (does not\n * read from ctx). Accidental ctx access during property generation\n * surfaces as a labelled error instead of a silent `undefined` or\n * downstream type-error.\n *\n * Returns a typed `Ctx` (via `as unknown as Ctx`) — the proxy satisfies the\n * type-shape requirement at the call site; the runtime contract is\n * \"throw on first read.\" The `as unknown` cast is the one boundary cast\n * this helper requires; the proxy is structurally a `Ctx` for every\n * property accessor.\n *\n * @example\n * import { stubCtxThrowingProxy } from \"../index\";\n * const ctx = stubCtxThrowingProxy<MyCtx>();\n * propertyTerminates(machine, ctx, ...);\n * // If anything reads ctx.someField during the run, an Error throws:\n * // \"@demlik/tea/pbt: ctx access denied (PBT operates on the pure\n * // reducer; ctx field 'someField' was read)\"\n */\nexport function stubCtxThrowingProxy<Ctx>(): Ctx {\n const handler: ProxyHandler<object> = {\n get(_target, prop: string | symbol): unknown {\n // Allow vitest / fast-check internals to introspect via Symbol-keyed\n // checks (e.g. Symbol.toStringTag, Symbol.iterator). Returning\n // undefined on symbol keys keeps property-tree walks cheap; the\n // throw fires on real domain field reads.\n if (typeof prop === \"symbol\") return undefined;\n // Some shrinkers / pretty-printers in fast-check probe a small set\n // of conventional field names (`toJSON`, `toString`, `valueOf`,\n // `then` — the last for thenable-check). Return undefined for those\n // so the proxy doesn't fail a probe before the property body runs.\n if (\n prop === \"toJSON\" ||\n prop === \"toString\" ||\n prop === \"valueOf\" ||\n prop === \"then\"\n ) {\n return undefined;\n }\n throw new Error(\n `@demlik/tea/pbt: ctx access denied (PBT operates on the pure reducer; ` +\n `ctx field '${prop}' was read). Pass a real ctx value if the reducer's ` +\n `init reads from ctx.`,\n );\n },\n has(): boolean {\n return false;\n },\n ownKeys(): ArrayLike<string | symbol> {\n return [];\n },\n };\n return new Proxy({}, handler) as unknown as Ctx;\n}\n","// ---------------------------------------------------------------------------\n// Msg arbitrary builders.\n//\n// `MsgArbitraryTable<M>` is a strict mapped type — every Msg variant must\n// have an arbitrary entry, keyed by `M[\"type\"]`, narrowing the arbitrary's\n// `T` to `Extract<M, { type: K }>`. This mirrors the load-bearing discipline\n// of `Reducer<S, M, C>` and `Transitions<S, M, C>` in the substrate: adding\n// a Msg variant without an arbitrary fails to compile, not at runtime.\n//\n// `arbMsg(table, opts?)` collapses the table into a single `fc.Arbitrary<M>`\n// via `fc.oneof`. Optional per-variant weighting for sequence-skew tests.\n//\n// `arbConstantMsg(type)` / `arbRecordMsg(type, fields)` are sugar over\n// `fc.constant({ type })` / `fc.record({ type: fc.constant(type), ...fields })`.\n// They exist because every Msg variant arbitrary either (a) carries no\n// payload — `arbConstantMsg(\"stop\")` — or (b) carries a record of fields —\n// `arbRecordMsg(\"tick\", { now: fc.integer() })`. Naming the two shapes\n// prevents callers from hand-rolling `fc.record({ type: fc.constant(\"...\") })`\n// inconsistently across test files.\n//\n// Open question 1 from the design doc (strict vs Partial table): strict by\n// default. The mapped type catches drift at compile time; `arbMsgPartial`\n// sugar is a future addition iff friction becomes real.\n// ---------------------------------------------------------------------------\n\nimport * as fc from \"fast-check\";\n\n/**\n * Strict per-variant Msg arbitrary table. Mapped type: every key in\n * `M[\"type\"]` MUST have an arbitrary entry whose `T` is the narrowed\n * variant. Adding a new Msg variant without an entry is a compile error\n * (same load-bearing discipline as `Reducer<S, M, C>` in the substrate).\n *\n * @example\n * type Msg = { type: \"start\" } | { type: \"tick\"; now: number };\n * const table: MsgArbitraryTable<Msg> = {\n * start: arbConstantMsg(\"start\"),\n * tick: arbRecordMsg(\"tick\", { now: fc.integer({ min: 0 }) }),\n * };\n */\nexport type MsgArbitraryTable<M extends { type: string }> = {\n [K in M[\"type\"]]: fc.Arbitrary<Extract<M, { type: K }>>;\n};\n\n/**\n * Build a single `fc.Arbitrary<M>` from a `MsgArbitraryTable<M>`. Picks one\n * variant per generation via `fc.oneof`; optional per-variant `weights`\n * bias the distribution (default uniform).\n *\n * @param table Per-variant arbitrary table (strict — every variant required).\n * @param opts Optional bias: `weights` is a `Partial<Record<M[\"type\"], number>>`.\n * Variants without an explicit weight default to 1.\n *\n * @example\n * const msgArb = arbMsg<Msg>({\n * start: arbConstantMsg(\"start\"),\n * tick: arbRecordMsg(\"tick\", { now: fc.integer() }),\n * stop: arbConstantMsg(\"stop\"),\n * }, { weights: { tick: 5, start: 1, stop: 1 } });\n */\nexport function arbMsg<M extends { type: string }>(\n table: MsgArbitraryTable<M>,\n opts?: { weights?: Partial<Record<M[\"type\"], number>> },\n): fc.Arbitrary<M> {\n const weights = opts?.weights;\n const entries = Object.entries(table) as [M[\"type\"], fc.Arbitrary<M>][];\n if (entries.length === 0) {\n throw new Error(\"@demlik/tea/pbt: arbMsg table is empty\");\n }\n const weighted = entries.map(([key, arb]) => ({\n arbitrary: arb,\n weight: weights?.[key] ?? 1,\n }));\n return fc.oneof(...weighted);\n}\n\n/**\n * Build a payload-free Msg variant arbitrary. Sugar for\n * `fc.constant({ type })` that narrows the result to `{ type: T }` literal.\n *\n * @example\n * arbConstantMsg(\"stop\") // fc.Arbitrary<{ type: \"stop\" }>\n */\nexport function arbConstantMsg<T extends string>(\n type: T,\n): fc.Arbitrary<{ type: T }> {\n return fc.constant({ type });\n}\n\n/**\n * Build a record-shaped Msg variant arbitrary. Sugar for\n * `fc.record({ type: fc.constant(type), ...fields })` that stamps the\n * discriminator literal and combines with the per-field arbitraries.\n *\n * @example\n * arbRecordMsg(\"tick\", { now: fc.integer({ min: 0 }) })\n * // fc.Arbitrary<{ type: \"tick\"; now: number }>\n */\nexport function arbRecordMsg<T extends string, R>(\n type: T,\n fields: { [K in keyof R]: fc.Arbitrary<R[K]> },\n): fc.Arbitrary<{ type: T } & R> {\n // `fc.record` builds an arbitrary of the merged-shape record. The\n // `type: fc.constant(type)` field stamps the literal discriminator;\n // the spread of `fields` provides every payload field's arbitrary.\n //\n // The intermediate `as Record<string, fc.Arbitrary<unknown>>` is the\n // single load-bearing cast — fc.record's parameter type is invariant in\n // its inferred field shape, and the merged literal-and-generic spread\n // doesn't unify with the strict `{ [K in keyof R]: Arbitrary<R[K]> }`\n // shape TS computes for us. The outer cast to `fc.Arbitrary<{ type: T }\n // & R>` restates the result shape we know to be correct at this\n // boundary. Mirrors the same discipline `fc.record` callers use\n // throughout the prior-art branch.\n const recordArbitraries: Record<string, fc.Arbitrary<unknown>> = {\n type: fc.constant(type),\n ...(fields as Record<string, fc.Arbitrary<unknown>>),\n };\n return fc.record(recordArbitraries) as unknown as fc.Arbitrary<\n { type: T } & R\n >;\n}\n","// ---------------------------------------------------------------------------\n// Msg-sequence arbitraries.\n//\n// `arbMsgSequence(msgArb, opts)` produces `fc.Arbitrary<readonly M[]>` —\n// fast-check's default-shrinker handles the array; the per-element shrinker\n// inside `msgArb` shrinks each variant. Optional `prefix` is prepended\n// verbatim (used by Test A: \"the bug-triggering Msg leads the sequence\").\n//\n// `arbGuidedSequence` is the state-aware sequence builder. In v1 it throws\n// — Phase 6 of the design doc lands the `fc.commands`-backed implementation.\n// The export exists today so the surface is forward-compatible: consumers\n// that need state-aware generation get a useful error pointing at the\n// design doc instead of \"is not a function.\"\n// ---------------------------------------------------------------------------\n\nimport * as fc from \"fast-check\";\nimport type { Cmd, Machine, Sub } from \"../../index\";\n\n/**\n * Build an arbitrary of Msg sequences over a per-Msg arbitrary. Optionally\n * bounded in length and / or prefixed with a fixed sequence.\n *\n * - `minLength` (default 0) and `maxLength` (default 30) bound the random\n * array length. `prefix` is prepended AFTER the random tail is built; the\n * final length is `prefix.length + tail.length`.\n * - `prefix` is the load-bearing escape hatch for \"the first msg is the\n * one that exercises the cell I care about\" (e.g. Test A's\n * `[{ type: \"ws:client:hello\" }]` prefix to land in the\n * `auditing.ws:client:hello` cell on the first transition).\n *\n * @example\n * arbMsgSequence(msgArb, { minLength: 1, maxLength: 30 });\n * arbMsgSequence(msgArb, { prefix: [{ type: \"ws:client:hello\" }], maxLength: 20 });\n */\nexport function arbMsgSequence<M extends { type: string }>(\n msgArb: fc.Arbitrary<M>,\n opts?: {\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly prefix?: readonly NoInfer<M>[];\n },\n): fc.Arbitrary<readonly M[]> {\n const minLength = opts?.minLength ?? 0;\n const maxLength = opts?.maxLength ?? 30;\n const prefix = opts?.prefix ?? [];\n const tail = fc.array(msgArb, { minLength, maxLength });\n if (prefix.length === 0) return tail;\n return tail.map((arr) => [...prefix, ...arr]);\n}\n\n/**\n * State-aware Msg sequence arbitrary — generates only msgs whose\n * precondition holds in the current state. Backed by `fc.commands`\n * internally. Planned for a later phase.\n *\n * **NOT IMPLEMENTED IN v1.** The export exists today so the surface is\n * forward-compatible; this ships in a later phase alongside\n * shrinkers. Calling it throws.\n */\nexport function arbGuidedSequence<\n S,\n M extends { type: string },\n C extends Cmd,\n U extends Sub,\n Ctx,\n>(\n _machine: Machine<S, M, C, U, Ctx>,\n _ctx: Ctx,\n _cells: {\n [K in M[\"type\"]]?: (\n state: S,\n ) => fc.Arbitrary<Extract<M, { type: K }>> | null;\n },\n _opts?: { maxLength?: number },\n): fc.Arbitrary<readonly M[]> {\n throw new Error(\n \"@demlik/tea/pbt: arbGuidedSequence is not implemented in v1. \" +\n \"Use arbMsgSequence with \" +\n \"an unguided arbMsg table for now; states that don't accept a given \" +\n \"msg should noop in the reducer (mapped-type discipline).\",\n );\n}\n"]}
@@ -1,16 +0,0 @@
1
- import { evictExpired, remember, recall, seen, initStore } from './chunk-K575PT4S.js';
2
-
3
- // src/idempotency/adapter.ts
4
- function idempotencyMemory() {
5
- return {
6
- init: (opts) => initStore(opts),
7
- isSeen: (store, key, now) => seen(store, key, now),
8
- recall: (store, key, now) => recall(store, key, now),
9
- remember: (store, key, value, now) => remember(store, key, value, now),
10
- evict: (store, now) => evictExpired(store, now)
11
- };
12
- }
13
-
14
- export { idempotencyMemory };
15
- //# sourceMappingURL=chunk-BYQUGDD3.js.map
16
- //# sourceMappingURL=chunk-BYQUGDD3.js.map