@demlik/tea 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. package/README.md +11 -9
  2. package/dist/agent/index.d.ts +638 -45
  3. package/dist/agent/index.js +9 -19
  4. package/dist/{chunk-RH5EFRVJ.js → chunk-22POWGFA.js} +31 -5
  5. package/dist/chunk-22POWGFA.js.map +1 -0
  6. package/dist/{chunk-DMYGQB4O.js → chunk-3B5X7SBB.js} +23 -6
  7. package/dist/chunk-3B5X7SBB.js.map +1 -0
  8. package/dist/chunk-66PY5WYF.js +1816 -0
  9. package/dist/chunk-66PY5WYF.js.map +1 -0
  10. package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
  11. package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
  12. package/dist/chunk-AYS5N6WY.js +505 -0
  13. package/dist/chunk-AYS5N6WY.js.map +1 -0
  14. package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
  15. package/dist/chunk-HWVW4AXC.js.map +1 -0
  16. package/dist/{chunk-O4MVQTEJ.js → chunk-L3TND7LA.js} +20 -16
  17. package/dist/chunk-L3TND7LA.js.map +1 -0
  18. package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
  19. package/dist/chunk-LFZUK6J2.js.map +1 -0
  20. package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
  21. package/dist/chunk-MYXFNWAJ.js.map +1 -0
  22. package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
  23. package/dist/chunk-PR6TB3BL.js.map +1 -0
  24. package/dist/{chunk-YUXP55T2.js → chunk-Q5CQTBFA.js} +57 -7
  25. package/dist/chunk-Q5CQTBFA.js.map +1 -0
  26. package/dist/{batch-window/index.js → chunk-QPEVCJ5Q.js} +4 -8
  27. package/dist/chunk-QPEVCJ5Q.js.map +1 -0
  28. package/dist/chunk-TCLBCERH.js +1480 -0
  29. package/dist/chunk-TCLBCERH.js.map +1 -0
  30. package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
  31. package/dist/chunk-TXN2KFHF.js.map +1 -0
  32. package/dist/{chunk-MUUROGIH.js → chunk-V46HSVCK.js} +62 -12
  33. package/dist/chunk-V46HSVCK.js.map +1 -0
  34. package/dist/{chunk-Q2UM7BXU.js → chunk-VBDU4JL6.js} +2 -2
  35. package/dist/chunk-VBDU4JL6.js.map +1 -0
  36. package/dist/{chunk-ZVJZ72HY.js → chunk-VTQI2NHP.js} +25 -11
  37. package/dist/chunk-VTQI2NHP.js.map +1 -0
  38. package/dist/{core-Co0LWkIA.d.ts → core-DnzqWy6u.d.ts} +72 -23
  39. package/dist/devtools/index.d.ts +2 -2
  40. package/dist/devtools/index.js +207 -2
  41. package/dist/devtools/index.js.map +1 -1
  42. package/dist/do/index.d.ts +43 -29
  43. package/dist/do/index.js +36 -25
  44. package/dist/do/index.js.map +1 -1
  45. package/dist/{durable-effects-C6uwzjb5.d.ts → durable-effects-CWzA-o2B.d.ts} +2 -2
  46. package/dist/extension/index.d.ts +300 -3
  47. package/dist/extension/index.js +596 -5
  48. package/dist/extension/index.js.map +1 -1
  49. package/dist/flow/index.d.ts +1284 -0
  50. package/dist/flow/index.js +732 -0
  51. package/dist/flow/index.js.map +1 -0
  52. package/dist/idempotency/index.d.ts +90 -116
  53. package/dist/idempotency/index.js +4 -1
  54. package/dist/index-Bc40JWVl.d.ts +131 -0
  55. package/dist/{batch-window/index.d.ts → index-C2DwkjlP.d.ts} +7 -12
  56. package/dist/index-CA_7I5g9.d.ts +806 -0
  57. package/dist/index-CSyMYDAB.d.ts +69 -0
  58. package/dist/{fan-out/index.d.ts → index-CuNO9m8i.d.ts} +7 -9
  59. package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
  60. package/dist/{recorder/index.d.ts → index-DrIRb_Ch.d.ts} +4 -7
  61. package/dist/index-HSYgG2Yt.d.ts +380 -0
  62. package/dist/{monitored-run/index.d.ts → index-KXqTRJyb.d.ts} +37 -13
  63. package/dist/{snapshot/index.d.ts → index-ZCMhnVKN.d.ts} +15 -78
  64. package/dist/index.d.ts +771 -6
  65. package/dist/index.js +1 -2
  66. package/dist/jev/index.d.ts +646 -0
  67. package/dist/jev/index.js +485 -0
  68. package/dist/jev/index.js.map +1 -0
  69. package/dist/machine-DGlPWCWI.d.ts +1781 -0
  70. package/dist/machine-viz/index.d.ts +1 -1
  71. package/dist/machine-viz/index.js +12 -5
  72. package/dist/machine-viz/index.js.map +1 -1
  73. package/dist/mem/index.d.ts +18 -3
  74. package/dist/mem/index.js +22 -2
  75. package/dist/mem/index.js.map +1 -1
  76. package/dist/node/index.d.ts +104 -6
  77. package/dist/node/index.js +132 -9
  78. package/dist/node/index.js.map +1 -1
  79. package/dist/{paginator → paginate}/index.d.ts +140 -6
  80. package/dist/paginate/index.js +7 -0
  81. package/dist/parity/index.d.ts +4 -10
  82. package/dist/parity/index.js +4 -7
  83. package/dist/parity/index.js.map +1 -1
  84. package/dist/pbt/index.d.ts +247 -5
  85. package/dist/pbt/index.js +124 -5
  86. package/dist/pbt/index.js.map +1 -1
  87. package/dist/{trace-replay → persistence}/index.d.ts +7 -5
  88. package/dist/persistence/index.js +6 -0
  89. package/dist/{protocol-B5YmJr0d.d.ts → protocol-D8VbH-VH.d.ts} +10 -1
  90. package/dist/react/index.d.ts +2 -2
  91. package/dist/react/index.js +1 -2
  92. package/dist/react/index.js.map +1 -1
  93. package/dist/resilience/index.d.ts +744 -0
  94. package/dist/resilience/index.js +657 -0
  95. package/dist/resilience/index.js.map +1 -0
  96. package/dist/retry-backoff/index.d.ts +3 -2
  97. package/dist/retry-backoff/index.js +1 -1
  98. package/dist/runtime-types-CMF13BBh.d.ts +998 -0
  99. package/dist/testing/index.d.ts +147 -3
  100. package/dist/testing/index.js +95 -3
  101. package/dist/testing/index.js.map +1 -1
  102. package/dist/{throttled-input → timing}/index.d.ts +143 -12
  103. package/dist/{throttled-input → timing}/index.js +57 -12
  104. package/dist/timing/index.js.map +1 -0
  105. package/dist/{types-XS_miRnB.d.ts → types-BseNPIhr.d.ts} +1 -1
  106. package/dist/work-queue/index.d.ts +130 -54
  107. package/dist/work-queue/index.js +3 -2
  108. package/dist/work-queue/index.js.map +1 -1
  109. package/package.json +45 -218
  110. package/dist/authed-call/index.d.ts +0 -120
  111. package/dist/authed-call/index.js +0 -134
  112. package/dist/authed-call/index.js.map +0 -1
  113. package/dist/await-terminal/index.d.ts +0 -101
  114. package/dist/await-terminal/index.js +0 -76
  115. package/dist/await-terminal/index.js.map +0 -1
  116. package/dist/batch-window/index.js.map +0 -1
  117. package/dist/cache/index.d.ts +0 -152
  118. package/dist/cache/index.js +0 -8
  119. package/dist/chart/index.d.ts +0 -218
  120. package/dist/chart/index.js +0 -16
  121. package/dist/chart/index.js.map +0 -1
  122. package/dist/chart/inspect/index.d.ts +0 -86
  123. package/dist/chart/inspect/index.js +0 -5
  124. package/dist/chart/inspect/react.d.ts +0 -113
  125. package/dist/chart/inspect/react.js +0 -11
  126. package/dist/chart/inspect/react.js.map +0 -1
  127. package/dist/chart/inspect/styles.css +0 -286
  128. package/dist/chart/lane/index.d.ts +0 -362
  129. package/dist/chart/lane/index.js +0 -9
  130. package/dist/chart/lane/index.js.map +0 -1
  131. package/dist/chart/lane/react.d.ts +0 -84
  132. package/dist/chart/lane/react.js +0 -559
  133. package/dist/chart/lane/react.js.map +0 -1
  134. package/dist/chart/lane/server.d.ts +0 -148
  135. package/dist/chart/lane/server.js +0 -209
  136. package/dist/chart/lane/server.js.map +0 -1
  137. package/dist/chart/lane/styles.css +0 -498
  138. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
  139. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
  140. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
  141. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
  142. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
  143. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
  144. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
  145. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
  146. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
  147. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
  148. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
  149. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
  150. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
  151. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
  152. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
  153. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
  154. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
  155. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
  156. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
  157. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
  158. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
  159. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
  160. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
  161. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
  162. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
  163. package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
  164. package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
  165. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
  166. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
  167. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
  168. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
  169. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
  170. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
  171. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
  172. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
  173. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
  174. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
  175. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
  176. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
  177. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
  178. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
  179. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
  180. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
  181. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
  182. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
  183. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
  184. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
  185. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
  186. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
  187. package/dist/chart/lane/viewer/index.html +0 -15
  188. package/dist/chart/report/index.d.ts +0 -117
  189. package/dist/chart/report/index.js +0 -32
  190. package/dist/chart/report/index.js.map +0 -1
  191. package/dist/chunk-2YFLOCWX.js +0 -15
  192. package/dist/chunk-2YFLOCWX.js.map +0 -1
  193. package/dist/chunk-3I52QZZ5.js +0 -519
  194. package/dist/chunk-3I52QZZ5.js.map +0 -1
  195. package/dist/chunk-3ZAFFRRB.js +0 -457
  196. package/dist/chunk-3ZAFFRRB.js.map +0 -1
  197. package/dist/chunk-4EQZ76JC.js +0 -33
  198. package/dist/chunk-4EQZ76JC.js.map +0 -1
  199. package/dist/chunk-4KLG43GY.js +0 -223
  200. package/dist/chunk-4KLG43GY.js.map +0 -1
  201. package/dist/chunk-7FRZ2CT2.js +0 -424
  202. package/dist/chunk-7FRZ2CT2.js.map +0 -1
  203. package/dist/chunk-AZZLE7XR.js +0 -62
  204. package/dist/chunk-AZZLE7XR.js.map +0 -1
  205. package/dist/chunk-BYQUGDD3.js +0 -16
  206. package/dist/chunk-BYQUGDD3.js.map +0 -1
  207. package/dist/chunk-CIQG5L42.js +0 -685
  208. package/dist/chunk-CIQG5L42.js.map +0 -1
  209. package/dist/chunk-CLM6ERNO.js +0 -61
  210. package/dist/chunk-CLM6ERNO.js.map +0 -1
  211. package/dist/chunk-COS5MSTO.js +0 -88
  212. package/dist/chunk-COS5MSTO.js.map +0 -1
  213. package/dist/chunk-CRPZJVD2.js +0 -71
  214. package/dist/chunk-CRPZJVD2.js.map +0 -1
  215. package/dist/chunk-D62FDQKE.js +0 -53
  216. package/dist/chunk-D62FDQKE.js.map +0 -1
  217. package/dist/chunk-D736QUGF.js.map +0 -1
  218. package/dist/chunk-DGE4PV4A.js +0 -26
  219. package/dist/chunk-DGE4PV4A.js.map +0 -1
  220. package/dist/chunk-DMYGQB4O.js.map +0 -1
  221. package/dist/chunk-EWJP3YYP.js.map +0 -1
  222. package/dist/chunk-FV3Z5MBE.js.map +0 -1
  223. package/dist/chunk-HCEVHFJ7.js +0 -54
  224. package/dist/chunk-HCEVHFJ7.js.map +0 -1
  225. package/dist/chunk-J6527VRQ.js.map +0 -1
  226. package/dist/chunk-JELSZN25.js +0 -47
  227. package/dist/chunk-JELSZN25.js.map +0 -1
  228. package/dist/chunk-K575PT4S.js.map +0 -1
  229. package/dist/chunk-L57ZOT5K.js +0 -184
  230. package/dist/chunk-L57ZOT5K.js.map +0 -1
  231. package/dist/chunk-MU6MCIAC.js +0 -15
  232. package/dist/chunk-MU6MCIAC.js.map +0 -1
  233. package/dist/chunk-MUUROGIH.js.map +0 -1
  234. package/dist/chunk-NR7BU22N.js +0 -758
  235. package/dist/chunk-NR7BU22N.js.map +0 -1
  236. package/dist/chunk-O4MVQTEJ.js.map +0 -1
  237. package/dist/chunk-OOYD44JI.js +0 -317
  238. package/dist/chunk-OOYD44JI.js.map +0 -1
  239. package/dist/chunk-Q2UM7BXU.js.map +0 -1
  240. package/dist/chunk-RH5EFRVJ.js.map +0 -1
  241. package/dist/chunk-S2EGRPCM.js +0 -47
  242. package/dist/chunk-S2EGRPCM.js.map +0 -1
  243. package/dist/chunk-SINXE47Y.js +0 -55
  244. package/dist/chunk-SINXE47Y.js.map +0 -1
  245. package/dist/chunk-UF4MZSLT.js +0 -53
  246. package/dist/chunk-UF4MZSLT.js.map +0 -1
  247. package/dist/chunk-UOC2PL46.js +0 -13
  248. package/dist/chunk-UOC2PL46.js.map +0 -1
  249. package/dist/chunk-VYFAZN3F.js +0 -372
  250. package/dist/chunk-VYFAZN3F.js.map +0 -1
  251. package/dist/chunk-WRAA7GVZ.js +0 -209
  252. package/dist/chunk-WRAA7GVZ.js.map +0 -1
  253. package/dist/chunk-XGELA764.js +0 -163
  254. package/dist/chunk-XGELA764.js.map +0 -1
  255. package/dist/chunk-YUXP55T2.js.map +0 -1
  256. package/dist/chunk-YWIKDKHY.js +0 -307
  257. package/dist/chunk-YWIKDKHY.js.map +0 -1
  258. package/dist/chunk-ZJ5AOYBH.js +0 -8
  259. package/dist/chunk-ZJ5AOYBH.js.map +0 -1
  260. package/dist/chunk-ZSUUOEPL.js +0 -731
  261. package/dist/chunk-ZSUUOEPL.js.map +0 -1
  262. package/dist/chunk-ZVJZ72HY.js.map +0 -1
  263. package/dist/circuit-breaker/index.d.ts +0 -197
  264. package/dist/circuit-breaker/index.js +0 -3
  265. package/dist/circuit-breaker/index.js.map +0 -1
  266. package/dist/deadline/index.d.ts +0 -199
  267. package/dist/deadline/index.js +0 -6
  268. package/dist/deadline/index.js.map +0 -1
  269. package/dist/debounce/index.js +0 -3
  270. package/dist/debounce/index.js.map +0 -1
  271. package/dist/extension/react.d.ts +0 -121
  272. package/dist/extension/react.js +0 -75
  273. package/dist/extension/react.js.map +0 -1
  274. package/dist/extension/subs/index.d.ts +0 -45
  275. package/dist/extension/subs/index.js +0 -80
  276. package/dist/extension/subs/index.js.map +0 -1
  277. package/dist/extension/test-utils.d.ts +0 -128
  278. package/dist/extension/test-utils.js +0 -277
  279. package/dist/extension/test-utils.js.map +0 -1
  280. package/dist/fan-out/index.js +0 -5
  281. package/dist/fan-out/index.js.map +0 -1
  282. package/dist/fold-BJPdjc9w.d.ts +0 -435
  283. package/dist/graph-B3L5e0N1.d.ts +0 -923
  284. package/dist/idempotency/adapter.d.ts +0 -62
  285. package/dist/idempotency/adapter.js +0 -4
  286. package/dist/idempotency/adapter.js.map +0 -1
  287. package/dist/idempotent-intake/index.d.ts +0 -188
  288. package/dist/idempotent-intake/index.js +0 -7
  289. package/dist/idempotent-intake/index.js.map +0 -1
  290. package/dist/journal/index.d.ts +0 -373
  291. package/dist/journal/index.js +0 -3
  292. package/dist/journal/index.js.map +0 -1
  293. package/dist/llm-call/index.d.ts +0 -311
  294. package/dist/llm-call/index.js +0 -16
  295. package/dist/llm-call/index.js.map +0 -1
  296. package/dist/machine-BtFWQmmq.d.ts +0 -804
  297. package/dist/monitored-run/index.js +0 -10
  298. package/dist/monitored-run/index.js.map +0 -1
  299. package/dist/paginated-walk/index.d.ts +0 -235
  300. package/dist/paginated-walk/index.js +0 -16
  301. package/dist/paginated-walk/index.js.map +0 -1
  302. package/dist/paginator/index.js +0 -3
  303. package/dist/paginator/index.js.map +0 -1
  304. package/dist/pbt/arbitraries/index.d.ts +0 -136
  305. package/dist/pbt/arbitraries/index.js +0 -3
  306. package/dist/pbt/arbitraries/index.js.map +0 -1
  307. package/dist/pbt/runners/index.d.ts +0 -118
  308. package/dist/pbt/runners/index.js +0 -5
  309. package/dist/pbt/runners/index.js.map +0 -1
  310. package/dist/poller/index.d.ts +0 -352
  311. package/dist/poller/index.js +0 -115
  312. package/dist/poller/index.js.map +0 -1
  313. package/dist/prediction/index.d.ts +0 -131
  314. package/dist/prediction/index.js +0 -4
  315. package/dist/prediction/index.js.map +0 -1
  316. package/dist/pure/index.d.ts +0 -3
  317. package/dist/pure/index.js +0 -4
  318. package/dist/pure/index.js.map +0 -1
  319. package/dist/rate-limit/index.d.ts +0 -115
  320. package/dist/rate-limit/index.js +0 -3
  321. package/dist/rate-limit/index.js.map +0 -1
  322. package/dist/reconciler/index.d.ts +0 -193
  323. package/dist/reconciler/index.js +0 -164
  324. package/dist/reconciler/index.js.map +0 -1
  325. package/dist/recorder/index.js +0 -3
  326. package/dist/recorder/index.js.map +0 -1
  327. package/dist/reducer-4GNR6b8B.d.ts +0 -447
  328. package/dist/resilient-call/index.d.ts +0 -320
  329. package/dist/resilient-call/index.js +0 -14
  330. package/dist/resilient-call/index.js.map +0 -1
  331. package/dist/retry-to-success/index.d.ts +0 -109
  332. package/dist/retry-to-success/index.js +0 -37
  333. package/dist/retry-to-success/index.js.map +0 -1
  334. package/dist/run-pAcmBpah.d.ts +0 -713
  335. package/dist/runtime-types-CNLmhWif.d.ts +0 -517
  336. package/dist/saga/index.d.ts +0 -241
  337. package/dist/saga/index.js +0 -150
  338. package/dist/saga/index.js.map +0 -1
  339. package/dist/samples-B3My5oh2.d.ts +0 -59
  340. package/dist/snapshot/index.js +0 -5
  341. package/dist/snapshot/index.js.map +0 -1
  342. package/dist/subs/index.d.ts +0 -472
  343. package/dist/subs/index.js +0 -7
  344. package/dist/subs/index.js.map +0 -1
  345. package/dist/throttle/index.d.ts +0 -134
  346. package/dist/throttle/index.js +0 -3
  347. package/dist/throttle/index.js.map +0 -1
  348. package/dist/throttled-input/index.js.map +0 -1
  349. package/dist/token-refresh/index.d.ts +0 -216
  350. package/dist/token-refresh/index.js +0 -6
  351. package/dist/token-refresh/index.js.map +0 -1
  352. package/dist/trace-replay/index.js +0 -6
  353. package/dist/trace-replay/index.js.map +0 -1
  354. package/dist/with-deadline/index.d.ts +0 -197
  355. package/dist/with-deadline/index.js +0 -111
  356. package/dist/with-deadline/index.js.map +0 -1
  357. package/dist/with-resilience/index.d.ts +0 -225
  358. package/dist/with-resilience/index.js +0 -240
  359. package/dist/with-resilience/index.js.map +0 -1
  360. package/dist/with-telemetry/index.d.ts +0 -150
  361. package/dist/with-telemetry/index.js +0 -70
  362. package/dist/with-telemetry/index.js.map +0 -1
  363. package/dist/work-queue/adapter.d.ts +0 -84
  364. package/dist/work-queue/adapter.js +0 -4
  365. package/dist/work-queue/adapter.js.map +0 -1
  366. package/dist/work-queue/ops.d.ts +0 -71
  367. package/dist/work-queue/ops.js +0 -3
  368. package/dist/work-queue/ops.js.map +0 -1
  369. package/dist/workflow/index.d.ts +0 -485
  370. package/dist/workflow/index.js +0 -244
  371. package/dist/workflow/index.js.map +0 -1
  372. /package/dist/{cache → paginate}/index.js.map +0 -0
  373. /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
@@ -0,0 +1,69 @@
1
+ import { S as Store } from './runtime-types-CMF13BBh.js';
2
+
3
+ /**
4
+ * internal/work-queue — substrate-agnostic work-queue lifecycle on `Store<S>`.
5
+ *
6
+ * Two public surfaces, one shape:
7
+ * - `createQueue(store)` (this file) is the in-process adapter — it binds the
8
+ * pure ops to an injected `Store` and runs `load → mutate → save`.
9
+ * - `internal/work-queue/ops` (`./ops`) is the BLESSED, importable surface
10
+ * of those same pure ops. L2 compositions that own their own Model slice
11
+ * (`monitored-run`, `idempotent-intake`, …) import the ops directly and
12
+ * delegate status flips to them instead of re-rolling the transitions.
13
+ * Both routes call the identical ops, so the lifecycle rules live in exactly
14
+ * one place. This mirrors `@demlik/tea/do`'s one-shape-per-package rule.
15
+ *
16
+ * The package is generic in the input payload `I` (audit-specific fields go
17
+ * here in the extension host). `output` is a free-form side-channel correlation
18
+ * token (a backend id, URL, trace id) — typed as `string` because that's its
19
+ * only honest type. Consumers that need structured per-item data persist it in
20
+ * their own store and put the foreign-key string in `output`.
21
+ */
22
+
23
+ type QueueItemStatus = "pending" | "running" | "done" | "failed" | "cancelled";
24
+ /**
25
+ * A single queue entry. Every field is `readonly`: a persisted slice is
26
+ * immutable, so a transition returns a NEW item (the ops always spread —
27
+ * `{ ...item, status: … }`) rather than mutating in place. This type-enforces
28
+ * the durability invariant the consumers already honor by convention, and
29
+ * keeps a slice round-trippable through JSON unchanged across a reload.
30
+ */
31
+ interface QueueItem<I> {
32
+ readonly id: string;
33
+ readonly status: QueueItemStatus;
34
+ readonly input: I;
35
+ readonly enqueuedAt: number;
36
+ readonly startedAt?: number;
37
+ readonly finishedAt?: number;
38
+ readonly output?: string;
39
+ readonly error?: string;
40
+ }
41
+ /**
42
+ * Caller-facing enqueue payload. Just `I` today — kept named so future
43
+ * variants (priority, deferUntil, …) can grow without breaking callers.
44
+ */
45
+ type EnqueueInput<I> = I;
46
+ /**
47
+ * Adapter that binds the pure ops to an injected `Store<QueueItem<I>[]>`.
48
+ *
49
+ * `load → mutate → save` is the only durability discipline this package
50
+ * imposes. The store decides what "save" means (chrome.storage, KV, DO
51
+ * storage, in-memory) — that decision belongs at the caller.
52
+ *
53
+ * Ops that don't change the queue (e.g. `markDone` on an unknown id) skip the
54
+ * save call so the underlying store doesn't observe a write churn.
55
+ */
56
+ declare function createQueue<I>(store: Store<QueueItem<I>[]>): {
57
+ enqueue: (input: EnqueueInput<I>) => Promise<QueueItem<I>>;
58
+ claimNext: () => Promise<QueueItem<I> | null>;
59
+ markDone: (id: string) => Promise<void>;
60
+ markFailed: (id: string, error: string) => Promise<void>;
61
+ markCancelled: (id: string) => Promise<void>;
62
+ resetRunningToPending: () => Promise<void>;
63
+ removeItem: (id: string) => Promise<void>;
64
+ retryItem: (id: string) => Promise<void>;
65
+ bindOutput: (id: string, value: string) => Promise<void>;
66
+ list: () => Promise<QueueItem<I>[]>;
67
+ };
68
+
69
+ export { type EnqueueInput as E, type QueueItem as Q, type QueueItemStatus as a, createQueue as c };
@@ -1,11 +1,8 @@
1
- import { C as Cmd, a as Port } from '../core-Co0LWkIA.js';
2
- import { QueueItem } from '../work-queue/index.js';
3
- import 'zod';
4
- import '../runtime-types-CNLmhWif.js';
5
- import 'better-result';
1
+ import { C as Cmd, P as Port } from './core-DnzqWy6u.js';
2
+ import { Q as QueueItem } from './index-CSyMYDAB.js';
6
3
 
7
4
  /**
8
- * @demlik/tea/fan-out — scatter-gather over a bounded-concurrency work list.
5
+ * internal/flow/fan-out — scatter-gather over a bounded-concurrency work list.
9
6
  *
10
7
  * The Level-2 combinator that fans a batch of items out across at most
11
8
  * `concurrency` in-flight effects, gathers each item's result (or error), and
@@ -68,8 +65,9 @@ import 'better-result';
68
65
  * than through the `join` Cmd.
69
66
  *
70
67
  * NOT a substrate primitive: it depends only on `../work-queue`'s pure types +
71
- * blessed ops and `../index`'s `Cmd` / `Port` types. Consumers reach it via the
72
- * `@demlik/tea/fan-out` subpath.
68
+ * blessed ops and the core `Cmd` / `Port` types. Internal since #48 — not
69
+ * published on any subpath; reached from inside the package as
70
+ * `internal/flow/fan-out`.
73
71
  */
74
72
 
75
73
  /**
@@ -238,4 +236,4 @@ declare function createFanOut<I, R, C extends Cmd = Cmd, J extends Cmd = Cmd>(co
238
236
  };
239
237
  };
240
238
 
241
- export { type FanOutConfig, type FanOutDone, type FanOutFailed, type FanOutPorts, type FanOutState, createFanOut, initFanOut, isComplete };
239
+ export { type FanOutState as F, type FanOutConfig as a, type FanOutDone as b, type FanOutFailed as c, type FanOutPorts as d, createFanOut as e, isComplete as f, initFanOut as i };
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @demlik/tea/debounce — a timer-based call transformer that coalesces a burst
2
+ * internal/timing/debounce — a timer-based call transformer that coalesces a burst
3
3
  * of calls into a single fire.
4
4
  *
5
- * Sibling of `@demlik/tea/throttle` — the two share a SYMMETRIC surface
5
+ * Sibling of `../throttle` — the two share a SYMMETRIC surface
6
6
  * (`Debounced<A>` / `Throttled<A>`, both callable + `.cancel()` + `.flush()`,
7
7
  * both `{ leading?, trailing? }`) so they read as a pair. They are kept in
8
8
  * separate files with NO cross-import: each is a self-contained timer, and the
9
9
  * coalesce-vs-drop policies are different enough that sharing code would hide
10
10
  * the distinction. Read one to understand the other; do not couple them.
11
11
  *
12
- * Layering with `@demlik/tea/throttled-input`: `debounce` and `throttle` are
12
+ * Layering with `../throttled-input`: `debounce` and `throttle` are
13
13
  * the two host-boundary PRIMITIVES — two distinct algorithms (collapse-a-burst
14
14
  * vs at-most-once-per-window) behind one signature shape. `throttled-input` is
15
15
  * NOT a third primitive: it is a TEA machine composed OVER them that
@@ -39,9 +39,9 @@
39
39
  * window.addEventListener("resize", onResized);
40
40
  * // cleanup: onResized.cancel(); window.removeEventListener("resize", onResized);
41
41
  *
42
- * NOT exported from the package root — reached via the `@demlik/tea/debounce`
43
- * subpath, same one-shape-per-package rule as `rate-limit`, `deadline`, and
44
- * `work-queue`.
42
+ * Internal since #47 — not published on any subpath; reached from inside the
43
+ * package as `internal/timing/debounce`. Same one-shape-per-package rule as
44
+ * `rate-limit`, `deadline`, and `work-queue`.
45
45
  *
46
46
  * Uses the universal `setTimeout` / `clearTimeout` timer idiom (same discipline
47
47
  * as `subs/from-timeout.ts`): exactly one live handle at a time, every arm
@@ -117,4 +117,4 @@ declare function debounce<A extends readonly unknown[]>(fn: (...args: A) => void
117
117
  trailing?: boolean;
118
118
  }): Debounced<A>;
119
119
 
120
- export { type Debounced, debounce };
120
+ export { type Debounced as D, debounce as d };
@@ -1,7 +1,4 @@
1
- import { B as BootingRuntime } from '../runtime-types-CNLmhWif.js';
2
- import 'better-result';
3
- import '../core-Co0LWkIA.js';
4
- import 'zod';
1
+ import { B as BootingRuntime } from './runtime-types-CMF13BBh.js';
5
2
 
6
3
  /**
7
4
  * A recorded run, sufficient to reproduce it via `../trace-replay`.
@@ -221,7 +218,7 @@ interface TraceAttachment {
221
218
  *
222
219
  * ```ts
223
220
  * import * as Sentry from "@sentry/browser"; // or "@sentry/node"
224
- * import { traceAttachment } from "@demlik/tea/recorder";
221
+ * import { traceAttachment } from "./internal/persistence/recorder"; // internal module
225
222
  * Sentry.getCurrentScope().addAttachment(traceAttachment(rec.dump()));
226
223
  * ```
227
224
  *
@@ -279,7 +276,7 @@ interface BreadcrumbsOptions<M> {
279
276
  *
280
277
  * ```ts
281
278
  * import * as Sentry from "@sentry/browser"; // or "@sentry/node"
282
- * import { breadcrumbsFromTrace } from "@demlik/tea/recorder";
279
+ * import { breadcrumbsFromTrace } from "./internal/persistence/recorder"; // internal module
283
280
  * for (const b of breadcrumbsFromTrace(rec.dump())) Sentry.addBreadcrumb(b);
284
281
  * ```
285
282
  *
@@ -290,4 +287,4 @@ declare function breadcrumbsFromTrace<S, M extends {
290
287
  type: string;
291
288
  }>(trace: Trace<S, M>, opts?: BreadcrumbsOptions<M>): TraceBreadcrumb[];
292
289
 
293
- export { type BreadcrumbsOptions, type Recorder, type RecorderOptions, type Trace, type TraceAttachment, type TraceBreadcrumb, breadcrumbsFromTrace, parseJSONL, recorder, traceAttachment };
290
+ export { type BreadcrumbsOptions as B, type RecorderOptions as R, type Trace as T, type Recorder as a, type TraceAttachment as b, type TraceBreadcrumb as c, breadcrumbsFromTrace as d, parseJSONL as p, recorder as r, traceAttachment as t };
@@ -0,0 +1,380 @@
1
+ import { S as Sub, c as SubId } from './core-DnzqWy6u.js';
2
+ import { S as SubscribeHandler } from './types-BseNPIhr.js';
3
+
4
+ /**
5
+ * internal/resilience/cache — a TTL cache as pure state, PLUS a periodic eviction Sub.
6
+ *
7
+ * Same pure-state-ops shape as `../../idempotency/` and
8
+ * `../../work-queue/ops.ts`: a state type plus pure transition functions. Host-
9
+ * agnostic by construction — no `Date.now()`, no timers, no I/O inside the ops.
10
+ * The caller injects the clock (`nowMs`) and folds the result through its own
11
+ * reducer, keeping the store inside TEA's invariant 2 (transitions are pure:
12
+ * same inputs → same outputs) so a consumer can exercise it with `replay`
13
+ * without a fake clock.
14
+ *
15
+ * Every op returns a NEW cache value and never mutates its input (invariant 1 —
16
+ * state is a value, not a place). `get` / `has` are read-shaped; `set` /
17
+ * `remove` / `evictExpired` return a new cache.
18
+ *
19
+ * **Distinct from `/idempotency`.** Both are TTL-bounded key maps, but they
20
+ * answer different questions and so carry different shapes:
21
+ *
22
+ * - `/idempotency` is DEDUPE-focused — "have I already processed this key?"
23
+ * TTL is a single store-level policy (`ttlMs`), each entry stores the
24
+ * `atMs` it was remembered at, and expiry is derived (`now - atMs >=
25
+ * ttlMs`). It carries an `order` ledger + `capacity` because the use case
26
+ * (webhook receivers, retried messages) needs bounded LRU eviction.
27
+ * - `/cache` is RETRIEVAL-focused — "what is the value for this key right
28
+ * now?" TTL is set PER ENTRY at write time: `set(key, value, nowMs,
29
+ * ttlMs)` bakes the absolute `expiresAtMs = nowMs + ttlMs` into the entry.
30
+ * Different keys can carry different lifetimes (a hot key cached for 1s, a
31
+ * cold one for 1h) — the dimension idempotency's single store-level
32
+ * `ttlMs` cannot express. No `order`, no `capacity`: a cache bounds itself
33
+ * by TTL + periodic eviction, not by LRU count.
34
+ *
35
+ * The eviction Sub is the "eviction is a Msg" half: a `setInterval`-shaped Sub
36
+ * (composed directly on `fromInterval`, from `src/subs/`) that periodically
37
+ * dispatches a `cache_evict` Msg the consumer's reducer handles by calling
38
+ * `evictExpired`. Time still never enters the reducer — the Sub fires the Msg,
39
+ * the reducer reads `nowMs` off the Msg (the consumer stamps it at the Sub
40
+ * boundary), and `evictExpired` does the pure drop.
41
+ *
42
+ * Internal to the package (`src/internal/resilience/`), not a published
43
+ * subpath (#46); same one-shape-per-module rule as `work-queue`, `idempotency`,
44
+ * and `rate-limit`.
45
+ */
46
+
47
+ /**
48
+ * A cached entry: the `value` and the absolute clock reading `expiresAtMs` it
49
+ * expires at. Unlike `/idempotency`'s entry (which stores `atMs` and derives
50
+ * expiry from a store-level `ttlMs`), the expiry instant is baked in at write
51
+ * time — so per-entry TTLs are a first-class capability. Both fields are plain
52
+ * data so the whole cache is trivially JSON-serializable into a consumer's
53
+ * `Store<S>`.
54
+ */
55
+ interface CacheEntry<V> {
56
+ readonly value: V;
57
+ readonly expiresAtMs: number;
58
+ }
59
+ /**
60
+ * The cache: a map of `key → entry`. No `order` ledger and no `capacity` (cf.
61
+ * `/idempotency`) — a TTL cache bounds itself by expiry + periodic eviction,
62
+ * not by LRU count. Each entry carries its own `expiresAtMs`, so the cache
63
+ * needs no store-level TTL policy field.
64
+ */
65
+ interface TtlCache<V> {
66
+ readonly entries: Readonly<Record<string, CacheEntry<V>>>;
67
+ }
68
+ /** Create an empty cache. */
69
+ declare function initCache<V>(): TtlCache<V>;
70
+ /**
71
+ * The cached `value` for `key` iff present AND unexpired at `nowMs`, else
72
+ * `undefined`. An expired entry reads as absent even though it is physically
73
+ * still in `entries` until the next `evictExpired` (or an overwriting `set`)
74
+ * drops it. PURE — reads only, never mutates.
75
+ */
76
+ declare function get<V>(cache: TtlCache<V>, key: string, nowMs: number): V | undefined;
77
+ /**
78
+ * True iff `key` is present AND unexpired at `nowMs`. The boolean sibling of
79
+ * `get` for callers that only need presence, not the value. PURE.
80
+ */
81
+ declare function has<V>(cache: TtlCache<V>, key: string, nowMs: number): boolean;
82
+ /**
83
+ * Write `key → value` with an absolute expiry of `nowMs + ttlMs`. Re-`set`ting
84
+ * an existing key overwrites both the value and the expiry — the TTL clock
85
+ * restarts from the new `nowMs`. PURE — returns a new cache; the input is
86
+ * untouched (a fresh shallow copy of `entries`).
87
+ */
88
+ declare function set<V>(cache: TtlCache<V>, key: string, value: V, nowMs: number, ttlMs: number): TtlCache<V>;
89
+ /**
90
+ * Drop `key` regardless of expiry. PURE — returns a new cache; the input is
91
+ * untouched. Removing an absent key returns an equivalent cache (the shallow
92
+ * copy still happens, but no entry is dropped).
93
+ */
94
+ declare function remove<V>(cache: TtlCache<V>, key: string): TtlCache<V>;
95
+ /**
96
+ * Physically drop every entry expired at `nowMs` (`nowMs >= expiresAtMs`).
97
+ * Returns a NEW cache with the survivors. This is the pure work the eviction
98
+ * Sub's `cache_evict` Msg triggers — `get` / `has` already treat expired
99
+ * entries as absent, so eviction is purely a memory-reclaim pass, not a
100
+ * correctness one. PURE — the input cache is never mutated.
101
+ */
102
+ declare function evictExpired<V>(cache: TtlCache<V>, nowMs: number): TtlCache<V>;
103
+ /**
104
+ * The Msg the eviction Sub dispatches each tick. `id` is the Sub's own id so a
105
+ * consumer with multiple caches can route the tick to the matching cache. The
106
+ * reducer reads `Date.now()`-free time by stamping `nowMs` itself at the Sub
107
+ * boundary if needed; the canonical reducer cell is
108
+ * `cache_evict: (s) => [{ ...s, cache: evictExpired(s.cache, nowMs) }, []]`.
109
+ */
110
+ interface CacheEvictMsg {
111
+ readonly type: "cache_evict";
112
+ readonly id: string;
113
+ }
114
+ /** Construct a `cache_evict` Msg for the cache identified by `id`. */
115
+ declare function cacheEvictMsg(id: string): CacheEvictMsg;
116
+ /**
117
+ * The Sub shape the eviction factory installs: a `setInterval`-shaped Sub
118
+ * carrying its tick period (`intervalMs`) per the substrate's
119
+ * reconcile-by-id-with-data-on-the-Sub contract. `type: "cache"` is the
120
+ * lowercase source-noun Sub convention (canon §2.5 / naming-style).
121
+ */
122
+ type CacheEvictionSub = Sub<"cache"> & {
123
+ readonly intervalMs: number;
124
+ };
125
+ /**
126
+ * Declare an eviction Sub for the cache identified by `id`, ticking every
127
+ * `everyMs`. Drop the result into `subscriptions(state)`:
128
+ *
129
+ * subscriptions: (s) => [cacheEvictionSub("session-cache", 30_000)]
130
+ *
131
+ * Same id ⇒ same running interval across transitions (no reconcile churn);
132
+ * changing `everyMs` alone will NOT re-arm the timer (the substrate leaves a
133
+ * same-id Sub running) — change the `id` too if the period must change. This
134
+ * mirrors `fromInterval`'s data-on-the-Sub tradeoff exactly.
135
+ */
136
+ declare function cacheEvictionSub(id: string, everyMs: number): CacheEvictionSub;
137
+ /**
138
+ * The `subscribe` cell for the eviction Sub. Assign it to
139
+ * `machine.subscribe.cache`:
140
+ *
141
+ * subscribe: { cache: cacheEvictionSubscribe }
142
+ *
143
+ * Composed directly on `fromInterval` — it owns the `setInterval` /
144
+ * `clearInterval` lifecycle; this cell only pins the Msg the tick dispatches
145
+ * (`cacheEvictMsg(sub.id)`). The cleanup `fromInterval` returns stops the
146
+ * interval when the Sub is reconciled out (the cache's state exits the phase
147
+ * that declared it).
148
+ */
149
+ declare const cacheEvictionSubscribe: SubscribeHandler<CacheEvictionSub, CacheEvictMsg, unknown>;
150
+
151
+ /**
152
+ * internal/resilience/deadline — a one-shot Sub that fires when an ABSOLUTE wall-clock
153
+ * deadline is reached.
154
+ *
155
+ * Generalizes the recurring "auto-fail a machine at T+N" / "15-minute stale
156
+ * guard" pattern: a Sub whose `subscriptions(state)` returns it only while the
157
+ * deadline should be armed, and which dispatches a single `DeadlineExceeded`
158
+ * Msg when the wall clock crosses `atMs`.
159
+ *
160
+ * Difference from `fromTimeout` (relative — "fire after N ms"): a deadline is
161
+ * an ABSOLUTE target. The delay is computed at subscribe time as
162
+ * `max(0, atMs - Date.now())`. The consequence that matters: subscribing LATE —
163
+ * e.g. after a `Store` rehydrate that resumes a machine whose deadline was set
164
+ * before the page reloaded — still fires at the correct absolute moment,
165
+ * because the remaining delay is recomputed from the current clock, not stored
166
+ * in the Sub. A deadline already in the past at subscribe time yields delay `0`,
167
+ * so `setTimeout(fn, 0)` fires on the NEXT tick (never synchronously inside the
168
+ * reconcile pass — the substrate must finish wiring all subs before any Msg
169
+ * lands).
170
+ *
171
+ * Composition over reinvention: the timer lifecycle is `fromTimeout`'s, not
172
+ * redrawn here. `deadlineSub` produces the Sub literal carrying `atMs`; the
173
+ * `subscribe` handler (`subscribeDeadline`) translates `atMs` → a relative delay
174
+ * and delegates the `setTimeout` / `clearTimeout` to `fromTimeout`. The clock
175
+ * read (`Date.now()`) lives only in the subscribe handler — never in a reducer
176
+ * (invariant 2) — and is exercised in tests via vitest fake timers, matching
177
+ * the no-injection convention of the `fromTimeout` / `fromInterval` exemplars.
178
+ *
179
+ * WHAT BACKS THE TIMER IS THE HOST'S CHOICE. `setTimeout` is the universal
180
+ * default, but it is not universal: a Durable Object that hibernates has no
181
+ * live `setTimeout` to wake it, so its deadline must be backed by a `do_alarm`
182
+ * registered on the alarm registry; a test host wants a fake-timer schedule.
183
+ * That backing is the `ArmTimer` seam — `subscribeWith(armTimer)` builds the
184
+ * `subscribe.deadline` handler from a host-plugged timer, and `subscribeDeadline`
185
+ * IS `subscribeWith(setTimeoutArmTimer())`. One deadline surface, three hosts;
186
+ * there is no second Sub type and no second `atMs` anchor to keep in sync.
187
+ *
188
+ * The anchor is what makes the seam safe. `atMs` is ABSOLUTE, so whatever backs
189
+ * it arms to a fixed wall-clock instant: the host computes the gap itself
190
+ * (`atMs - Date.now()`), and on a host that just rehydrated after hibernation
191
+ * that gap is the SHRUNKEN remainder — the deadline honours the original target
192
+ * rather than resetting to a fresh full-length window.
193
+ *
194
+ * Strengthens invariant 4 (external time is a subscription — the deadline is a
195
+ * `Sub` the runtime reconciles, never a `setTimeout` leaked into a reducer) and
196
+ * invariant 7 (identity is explicit — the Sub carries a stable `SubId`, so the
197
+ * reconcile pass leaves it running across transitions instead of churning it).
198
+ */
199
+
200
+ /**
201
+ * The Sub variant a deadline produces. `atMs` is the absolute target — epoch
202
+ * milliseconds (the `Date.now()` / `Date.parse(...)` scale), NOT a relative
203
+ * delay. It rides on the Sub so the reconcile pass keys identity by `id`
204
+ * alone: the same `id` across transitions means the same armed timer, even if
205
+ * a later `subscriptions(state)` recomputes the literal.
206
+ *
207
+ * Lowercase `"deadline"` discriminant per the Sub naming convention (a source
208
+ * noun that doubles as the SubId family); same shape family as the
209
+ * `TimeoutSubData` the `fromTimeout` factory consumes.
210
+ */
211
+ type DeadlineSub<N extends string | undefined = undefined> = Sub<"deadline"> & {
212
+ readonly atMs: number;
213
+ } & DeadlineOpts<N>;
214
+ /**
215
+ * Additive options the `deadlineSub` factory folds onto the Sub literal. This
216
+ * is the extension seam (invariant 5 — composition by reduction): future fields
217
+ * — `repeatMs` for a re-arming deadline, `jitterMs` for spread, etc. — land HERE
218
+ * as optional members, and every existing call site keeps compiling because the
219
+ * factory's third parameter is optional and the fields are `readonly` optionals
220
+ * on `DeadlineSub`. Callers are insulated from the concrete `DeadlineSub` shape:
221
+ * they ask for what they need by name, never positionally, so a shape extension
222
+ * never rewrites the ~13 `deadlineSub(id, atMs)` call sites.
223
+ *
224
+ * The first field to land here is {@link DeadlineOpts.name} — the knob name the
225
+ * dispatched Msg tag is derived from — and it landed exactly that way: one
226
+ * optional member, zero rewritten call sites.
227
+ */
228
+ type DeadlineOpts<N extends string | undefined = undefined> = {
229
+ /**
230
+ * The knob this deadline belongs to. Present → the dispatched Msg's tag is
231
+ * `` `${name}_deadline` ``; absent → the tag stays the bare
232
+ * `"deadline_exceeded"` every machine wired before this field is already
233
+ * handling. `N` is the name as a TYPE as well as a value, so a consumer's
234
+ * cell key and the Msg type are derived from one place and cannot drift.
235
+ *
236
+ * Name a deadline when a machine arms more than one family of them. The Sub
237
+ * *id* was already scoped (`` `${name}:deadline:${key}` ``); this scopes the
238
+ * Msg the Sub dispatches, which is what a reducer cell keys off.
239
+ */
240
+ readonly name?: N;
241
+ };
242
+ /**
243
+ * The Msg the deadline dispatches when the wall clock crosses `atMs`. Exported
244
+ * as a tagged shape so consumers can union it into their machine's Msg type and
245
+ * handle it in a reducer cell. `id` lets a reducer disambiguate WHICH deadline
246
+ * fired when a machine arms several at once; `atMs` echoes the target the timer
247
+ * was scheduled against (useful for assertions / observability).
248
+ *
249
+ * Snake-shaped `"deadline_exceeded"` matches the tagged-Msg style this module's
250
+ * orchestrator requested; the actor-in-name PascalCase convention
251
+ * (`TimerFiredDeadline`) is the consumer's to apply at their own boundary if
252
+ * they prefer — `deadlineExceeded(...)` only fixes the wire shape, not the
253
+ * consumer's local dialect.
254
+ */
255
+ type DeadlineExceeded<N extends string | undefined = undefined> = {
256
+ readonly type: DeadlineMsgType<N>;
257
+ readonly id: string;
258
+ readonly atMs: number;
259
+ };
260
+ /**
261
+ * The dispatched Msg's tag, derived from the deadline's optional name. A named
262
+ * deadline speaks `` `${N}_deadline` ``; an unnamed one speaks the bare
263
+ * `"deadline_exceeded"` literal, which is what `DeadlineExceeded` with no type
264
+ * argument still means — so every machine wired before the name existed keeps
265
+ * the exact type it had.
266
+ */
267
+ type DeadlineMsgType<N extends string | undefined> = N extends string ? `${N}_deadline` : "deadline_exceeded";
268
+ /**
269
+ * Build a deadline Sub literal. Pure data — no clock read, no timer; the timer
270
+ * is armed later by the `subscribe` cell. `id` is branded via `subId(...)` so
271
+ * accidental raw-string drift fails at the type level (invariant 7).
272
+ *
273
+ * Return the result directly from `subscriptions(state)` while the deadline
274
+ * should be armed; drop it (return `[]`, or stop returning this id) to disarm —
275
+ * the reconcile pass calls the cleanup, clearing the pending timer before it
276
+ * fires. That is the "cancel on state exit" lifecycle, identical to
277
+ * `fromTimeout`'s.
278
+ *
279
+ * @param id Stable identity for this deadline. Same `id` across transitions =
280
+ * same armed timer (no churn). Use distinct ids for distinct
281
+ * deadlines on the same machine.
282
+ * @param atMs Absolute target in epoch milliseconds (e.g. `Date.now() + 900_000`
283
+ * for a 15-minute guard, or a persisted `expiresAt`).
284
+ * @param opts Optional additive fields folded onto the Sub literal (see
285
+ * {@link DeadlineOpts}). Omit it for the common case; pass it when a
286
+ * future field (e.g. `repeatMs`) needs to ride on the deadline. The
287
+ * optionality is the future-proofing seam — extending the shape
288
+ * never breaks an existing `deadlineSub(id, atMs)` call site.
289
+ */
290
+ declare function deadlineSub<N extends string | undefined = undefined>(id: string, atMs: number, opts?: DeadlineOpts<N>): DeadlineSub<N>;
291
+ /**
292
+ * The host-plugged timer backing. Given the deadline's stable `id`, its
293
+ * absolute `atMs`, and the Msg to fire, arm the platform-appropriate timer
294
+ * (DO alarm registry, `setTimeout`, fake timer) and return a cleanup that
295
+ * cancels the pending fire.
296
+ *
297
+ * `id` is the Sub's reconcile id — a registry-backed host (the DO alarm slot)
298
+ * keys its entry on `id` so the cleanup deletes the EXACT entry the substrate
299
+ * reconciled. A `setTimeout`-backed host ignores `id` (the closure holds the
300
+ * handle).
301
+ *
302
+ * The host computes the gap itself: `atMs - Date.now()` is the REMAINING time.
303
+ * On a host that just rehydrated after hibernation that gap is the shrunken
304
+ * remainder — the deadline is NOT reset to its full length. That recomputation
305
+ * is the reason `atMs` rides on the Sub as an absolute instant rather than a
306
+ * delay: the anchor is what every backing agrees on.
307
+ */
308
+ type ArmTimer<M> = (id: SubId, atMs: number, msg: M, dispatch: (msg: M) => void) => () => void;
309
+ /**
310
+ * Build the `subscribe["deadline"]` cell from a host-plugged `armTimer`. This
311
+ * module owns the Sub shape, the anchor, and the Msg; the HOST owns what backs
312
+ * the timer. The returned handler reads `id` + `atMs` off the Sub, builds the
313
+ * `deadlineExceeded(...)` Msg, and hands all three to `armTimer`.
314
+ *
315
+ * Use it when `setTimeout` is the wrong backing — most concretely a Durable
316
+ * Object, which hibernates and must register a `do_alarm` instead:
317
+ *
318
+ * subscribe: {
319
+ * deadline: subscribeWith((id, atMs, msg, dispatch) =>
320
+ * alarms.register(id, atMs, () => dispatch(msg)),
321
+ * ),
322
+ * }
323
+ *
324
+ * For the `setTimeout` default, use {@link subscribeDeadline} — it is exactly
325
+ * `subscribeWith(setTimeoutArmTimer())`, so there is one deadline surface and
326
+ * one anchor, not a second one per host.
327
+ */
328
+ declare function subscribeWith<N extends string | undefined = undefined>(armTimer: ArmTimer<DeadlineExceeded<N>>): SubscribeHandler<DeadlineSub<N>, DeadlineExceeded<N>, unknown>;
329
+ /**
330
+ * The `setTimeout` timer backing — for node / browser / any host whose timer is
331
+ * a plain `setTimeout`. Arms for the REMAINING time (`max(0, atMs - Date.now())`,
332
+ * floored at 0 so an already-past deadline fires on the NEXT tick rather than
333
+ * synchronously inside the reconcile pass), so a deadline re-derived after a
334
+ * rehydrate fires at the original instant, not a fresh full window.
335
+ *
336
+ * Composes on `fromTimeout` rather than redrawing `setTimeout` /
337
+ * `clearTimeout`: this package has ONE timer lifecycle, and the arm-timer seam
338
+ * plugs into it instead of forking it. A hibernating host does NOT use this —
339
+ * it plugs its own `armTimer` (a `do_alarm` registration) into
340
+ * {@link subscribeWith}.
341
+ */
342
+ declare function setTimeoutArmTimer<N extends string | undefined = undefined>(): ArmTimer<DeadlineExceeded<N>>;
343
+ /**
344
+ * The `subscribe["deadline"]` handler for the DEFAULT `setTimeout` backing. Arms a
345
+ * one-shot timer for the remaining delay `max(0, atMs - Date.now())` and
346
+ * dispatches `deadlineExceeded(...)` when it fires; returns a cleanup that
347
+ * clears the pending timer.
348
+ *
349
+ * It is `subscribeWith(setTimeoutArmTimer())` — the default backing named, not
350
+ * a separate implementation, so the host-plugged path and the default path can
351
+ * never disagree about the anchor.
352
+ *
353
+ * Assign directly to a `Subscribe` handler:
354
+ *
355
+ * subscribe: {
356
+ * deadline: subscribeDeadline,
357
+ * }
358
+ *
359
+ * Generic in the deadline's name so ONE handler serves every knob in a machine:
360
+ * the tag it dispatches is read off the Sub's own `name`, so a machine mounting
361
+ * a named knob beside an unnamed one wires this same cell once and each Sub
362
+ * still dispatches its own tag.
363
+ */
364
+ declare const subscribeDeadline: <N extends string | undefined = undefined>(sub: DeadlineSub<N>, ctx: unknown, dispatch: (msg: DeadlineExceeded<N>) => void) => () => void;
365
+ /**
366
+ * Construct the Msg the deadline dispatches. Exported so consumers can build /
367
+ * assert the same shape (and so the subscribe cell and tests share one
368
+ * constructor rather than two literals that can drift).
369
+ */
370
+ declare function deadlineExceeded<N extends string | undefined = undefined>(id: string, atMs: number, name?: N): DeadlineExceeded<N>;
371
+ /**
372
+ * The one place the named tag is spelled. `undefined` → the bare
373
+ * `"deadline_exceeded"` literal; a name → `` `${name}_deadline` ``. Exported so
374
+ * a consumer keying a reducer cell off a named deadline derives the key from
375
+ * the same function the Sub dispatches through, instead of re-spelling the
376
+ * template and drifting.
377
+ */
378
+ declare function deadlineMsgType<N extends string | undefined>(name?: N): DeadlineMsgType<N>;
379
+
380
+ export { type ArmTimer as A, type CacheEvictionSub as C, type DeadlineExceeded as D, type TtlCache as T, type DeadlineSub as a, deadlineSub as b, type CacheEvictMsg as c, deadlineExceeded as d, type CacheEntry as e, type DeadlineMsgType as f, type DeadlineOpts as g, cacheEvictMsg as h, cacheEvictionSub as i, cacheEvictionSubscribe as j, deadlineMsgType as k, evictExpired as l, get as m, has as n, initCache as o, set as p, setTimeoutArmTimer as q, remove as r, subscribeDeadline as s, subscribeWith as t };
@@ -1,15 +1,10 @@
1
- import { DeadlineExceeded, DeadlineSub } from '../deadline/index.js';
2
- export { deadlineSub, subscribeDeadline } from '../deadline/index.js';
3
- import { I as Interpret, C as Cmd } from '../core-Co0LWkIA.js';
4
- import { SnapshotWriteCmd, SnapshotState, SnapshotStore, SnapshotSavedMsg, SnapshotFailedMsg, SnapshotLoadedMsg, SnapshotLoadFailedMsg, SnapshotLoadCmd } from '../snapshot/index.js';
5
- import { QueueItem } from '../work-queue/index.js';
6
- import '../types-XS_miRnB.js';
7
- import 'zod';
8
- import '../runtime-types-CNLmhWif.js';
9
- import 'better-result';
1
+ import { I as Interpret, C as Cmd } from './core-DnzqWy6u.js';
2
+ import { S as SnapshotWriteCmd, a as SnapshotState, b as SnapshotStore, c as SnapshotSavedMsg, d as SnapshotFailedMsg, e as SnapshotLoadedMsg, f as SnapshotLoadFailedMsg, g as SnapshotLoadCmd } from './index-ZCMhnVKN.js';
3
+ import { D as DeadlineExceeded, a as DeadlineSub } from './index-HSYgG2Yt.js';
4
+ import { Q as QueueItem } from './index-CSyMYDAB.js';
10
5
 
11
6
  /**
12
- * @demlik/tea/monitored-run — a long-running operation that is BOTH staged and
7
+ * internal/flow/monitored-run — a long-running operation that is BOTH staged and
13
8
  * watched: an ordered stage pipeline whose POSITION survives eviction, wrapped
14
9
  * by a no-progress safety deadline and (optionally) a periodic durable
15
10
  * checkpoint.
@@ -46,7 +41,7 @@ import 'better-result';
46
41
  *
47
42
  * ## Why the run lifecycle is INLINE (run-tracker not extracted)
48
43
  *
49
- * The phase union (`idle` / `running` / `stale` / `done` / `failed`, a
44
+ * The phase union (`idle` / `running` / `stale` / `done` / `failed` / `cancelled`, a
50
45
  * discriminated union carrying only each phase's own data) and its bookkeeping
51
46
  * (`runId`, `startedAt`, `lastProgressAt`, `progressSeq`) live directly on this
52
47
  * slice rather than behind a `run-tracker` sub-knob.
@@ -203,10 +198,19 @@ interface RunCore<Stage> {
203
198
  * - `failed` — terminal failure; the typed `failure` reason rides ONLY this
204
199
  * arm, so it is present iff `phase === "failed"` BY CONSTRUCTION —
205
200
  * there is no nullable side field to keep in sync.
201
+ * - `cancelled` — the consumer stopped the run from outside (`cancel`). Its own
202
+ * phase rather than a `RunFailure` reason, on the same argument
203
+ * that keeps `stale` a phase: a caller who asked for the stop did
204
+ * not suffer a failure, and every "did this fail?" reader would
205
+ * otherwise have to except one reason. Terminal, so it re-enters
206
+ * no verb and arms no watchdog.
206
207
  *
207
208
  * `runId` is the host-minted run identity, stamped at `start` (the machine never
208
209
  * mints — see the audit seed's "run identity is host-minted"). It rides every
209
- * started phase, but not `idle`.
210
+ * started phase, but not `idle`. `cancelled` is the one phase reachable from BOTH
211
+ * sides of that line, so its `runId` is `string | null`: `null` says the run was
212
+ * cancelled before it ever started and there was no identity to mint, which is a
213
+ * different fact from a cancelled live run and stays a different value.
210
214
  */
211
215
  type MonitoredRunState<Stage> = (RunCore<Stage> & {
212
216
  readonly phase: "idle";
@@ -223,7 +227,26 @@ type MonitoredRunState<Stage> = (RunCore<Stage> & {
223
227
  readonly phase: "failed";
224
228
  readonly runId: string;
225
229
  readonly failure: RunFailure<Stage>;
230
+ }) | (RunCore<Stage> & {
231
+ readonly phase: "cancelled";
232
+ readonly runId: string | null;
233
+ readonly at: number;
226
234
  });
235
+ /**
236
+ * The ENDED phases — a run that finished (`done`) or was stopped from outside
237
+ * (`cancelled`). Every arm here was started or explicitly stopped, so `idle` is
238
+ * out and `runId` is present on the whole union: a consumer holding one of these
239
+ * reads the run identity without a `phase` guard the value can never fail.
240
+ *
241
+ * It is the resolved half of a drive: a promise that resolves only on an ended
242
+ * run should say so in its type rather than resolve `MonitoredRunState` and
243
+ * leave every reader to re-prove the `idle` arm impossible (#155). `cancelled`
244
+ * keeps its `string | null` `runId` unchanged — a run cancelled before it ever
245
+ * started genuinely has no identity, and that stays a different value here.
246
+ */
247
+ type EndedRun<Stage> = Extract<MonitoredRunState<Stage>, {
248
+ readonly phase: "done" | "cancelled";
249
+ }>;
227
250
  /**
228
251
  * The outcome a consumer reports to `advance`: the current stage either
229
252
  * succeeded (retire it, claim the next) or failed (terminate the run). Plain
@@ -259,6 +282,7 @@ declare function createMonitoredRun<Stage, V = unknown>(config?: MonitoredRunCon
259
282
  start: (s: MonitoredRunState<Stage>, runId: string, at: number) => readonly [MonitoredRunState<Stage>, readonly MonitoredRunCmd<V>[]];
260
283
  progress: (s: MonitoredRunState<Stage>, payload: V, at: number) => readonly [MonitoredRunState<Stage>, readonly MonitoredRunCmd<V>[]];
261
284
  markStale: (s: MonitoredRunState<Stage>) => readonly [MonitoredRunState<Stage>, readonly MonitoredRunCmd<V>[]];
285
+ cancel: (s: MonitoredRunState<Stage>, at: number) => readonly [MonitoredRunState<Stage>, readonly MonitoredRunCmd<V>[]];
262
286
  advance: (s: MonitoredRunState<Stage>, payload: V, result: StageResult, at: number) => readonly [MonitoredRunState<Stage>, readonly MonitoredRunCmd<V>[]];
263
287
  onDeadline: (s: MonitoredRunState<Stage>, msg: MonitoredRunTimerMsg) => readonly [MonitoredRunState<Stage>, readonly MonitoredRunCmd<V>[]];
264
288
  boot: (s: MonitoredRunState<Stage>, at: number) => readonly [MonitoredRunState<Stage>, readonly MonitoredRunCmd<V>[]];
@@ -276,4 +300,4 @@ declare function liftRun<S extends {
276
300
  run: MonitoredRunState<Stage>;
277
301
  }, Stage, C extends Cmd>(state: S, [slice, cmds]: readonly [MonitoredRunState<Stage>, readonly C[]]): readonly [S, readonly C[]];
278
302
 
279
- export { DeadlineExceeded, DeadlineSub, type MonitoredRunCmd, type MonitoredRunConfig, type MonitoredRunPorts, type MonitoredRunState, type MonitoredRunTimerMsg, type RunFailure, SnapshotSavedMsg, SnapshotWriteCmd, type StageResult, createMonitoredRun, liftRun };
303
+ export { type EndedRun as E, type MonitoredRunCmd as M, type RunFailure as R, type StageResult as S, type MonitoredRunState as a, type MonitoredRunConfig as b, type MonitoredRunPorts as c, type MonitoredRunTimerMsg as d, createMonitoredRun as e, liftRun as l };