@demlik/tea 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/README.md +11 -9
  2. package/dist/agent/index.d.ts +638 -45
  3. package/dist/agent/index.js +9 -19
  4. package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
  5. package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
  6. package/dist/chunk-AQ6ZIMEA.js +421 -0
  7. package/dist/chunk-AQ6ZIMEA.js.map +1 -0
  8. package/dist/{chunk-MUUROGIH.js → chunk-BLJ2JQSH.js} +62 -12
  9. package/dist/chunk-BLJ2JQSH.js.map +1 -0
  10. package/dist/{chunk-7SVIRMC6.js → chunk-F2US5BW6.js} +25 -5
  11. package/dist/chunk-F2US5BW6.js.map +1 -0
  12. package/dist/{batch-window/index.js → chunk-F7FMAWLA.js} +4 -8
  13. package/dist/chunk-F7FMAWLA.js.map +1 -0
  14. package/dist/{chunk-7V4EVLZA.js → chunk-HUKZQX6U.js} +20 -16
  15. package/dist/chunk-HUKZQX6U.js.map +1 -0
  16. package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
  17. package/dist/chunk-HWVW4AXC.js.map +1 -0
  18. package/dist/{chunk-WLGO64WC.js → chunk-HYDWG35Q.js} +23 -6
  19. package/dist/chunk-HYDWG35Q.js.map +1 -0
  20. package/dist/{chunk-I5OV65MS.js → chunk-I5MQMJDW.js} +57 -7
  21. package/dist/chunk-I5MQMJDW.js.map +1 -0
  22. package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
  23. package/dist/chunk-LFZUK6J2.js.map +1 -0
  24. package/dist/{chunk-ZVJZ72HY.js → chunk-LYLTKJWM.js} +25 -11
  25. package/dist/chunk-LYLTKJWM.js.map +1 -0
  26. package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
  27. package/dist/chunk-MYXFNWAJ.js.map +1 -0
  28. package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
  29. package/dist/chunk-PR6TB3BL.js.map +1 -0
  30. package/dist/chunk-RQULHGYH.js +1804 -0
  31. package/dist/chunk-RQULHGYH.js.map +1 -0
  32. package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
  33. package/dist/chunk-TXN2KFHF.js.map +1 -0
  34. package/dist/{chunk-Q2UM7BXU.js → chunk-VBDU4JL6.js} +2 -2
  35. package/dist/chunk-VBDU4JL6.js.map +1 -0
  36. package/dist/chunk-Z2L3LSNV.js +1470 -0
  37. package/dist/chunk-Z2L3LSNV.js.map +1 -0
  38. package/dist/core-CTzMJ82M.d.ts +562 -0
  39. package/dist/devtools/index.d.ts +2 -2
  40. package/dist/devtools/index.js +207 -2
  41. package/dist/devtools/index.js.map +1 -1
  42. package/dist/do/index.d.ts +48 -31
  43. package/dist/do/index.js +36 -25
  44. package/dist/do/index.js.map +1 -1
  45. package/dist/{durable-effects-D8SqU_if.d.ts → durable-effects-B0-qGQDy.d.ts} +2 -2
  46. package/dist/extension/index.d.ts +301 -3
  47. package/dist/extension/index.js +596 -5
  48. package/dist/extension/index.js.map +1 -1
  49. package/dist/flow/index.d.ts +1295 -0
  50. package/dist/flow/index.js +732 -0
  51. package/dist/flow/index.js.map +1 -0
  52. package/dist/idempotency/index.d.ts +90 -116
  53. package/dist/idempotency/index.js +4 -1
  54. package/dist/{batch-window/index.d.ts → index-4vZzljCD.d.ts} +7 -11
  55. package/dist/{fan-out/index.d.ts → index-6A7dB8f6.d.ts} +7 -8
  56. package/dist/index-B5BZ-_cT.d.ts +616 -0
  57. package/dist/index-Bc40JWVl.d.ts +131 -0
  58. package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
  59. package/dist/index-DJWIER_3.d.ts +69 -0
  60. package/dist/{snapshot/index.d.ts → index-DMCeMPMJ.d.ts} +15 -77
  61. package/dist/{monitored-run/index.d.ts → index-NjrT3fL2.d.ts} +37 -12
  62. package/dist/{recorder/index.d.ts → index-TvRb1KVf.d.ts} +4 -6
  63. package/dist/{deadline/index.d.ts → index-q0hXFeZ0.d.ts} +155 -8
  64. package/dist/index.d.ts +719 -6
  65. package/dist/index.js +1 -2
  66. package/dist/jev/index.d.ts +634 -0
  67. package/dist/jev/index.js +433 -0
  68. package/dist/jev/index.js.map +1 -0
  69. package/dist/machine-CdIcN2Xm.d.ts +1773 -0
  70. package/dist/machine-viz/index.d.ts +2 -1
  71. package/dist/machine-viz/index.js +12 -5
  72. package/dist/machine-viz/index.js.map +1 -1
  73. package/dist/mem/index.d.ts +19 -3
  74. package/dist/mem/index.js +22 -2
  75. package/dist/mem/index.js.map +1 -1
  76. package/dist/node/index.d.ts +130 -4
  77. package/dist/node/index.js +222 -10
  78. package/dist/node/index.js.map +1 -1
  79. package/dist/{paginator → paginate}/index.d.ts +151 -6
  80. package/dist/paginate/index.js +7 -0
  81. package/dist/parity/index.d.ts +5 -10
  82. package/dist/parity/index.js +4 -7
  83. package/dist/parity/index.js.map +1 -1
  84. package/dist/pbt/index.d.ts +248 -5
  85. package/dist/pbt/index.js +124 -5
  86. package/dist/pbt/index.js.map +1 -1
  87. package/dist/{trace-replay → persistence}/index.d.ts +7 -4
  88. package/dist/persistence/index.js +6 -0
  89. package/dist/react/index.d.ts +4 -3
  90. package/dist/react/index.js +1 -2
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/resilience/index.d.ts +743 -0
  93. package/dist/resilience/index.js +657 -0
  94. package/dist/resilience/index.js.map +1 -0
  95. package/dist/retry-backoff/index.d.ts +3 -2
  96. package/dist/retry-backoff/index.js +1 -1
  97. package/dist/runtime-types-LWDoi943.d.ts +998 -0
  98. package/dist/testing/index.d.ts +3 -2
  99. package/dist/testing/index.js +1 -2
  100. package/dist/testing/index.js.map +1 -1
  101. package/dist/{throttled-input → timing}/index.d.ts +144 -12
  102. package/dist/{throttled-input → timing}/index.js +57 -12
  103. package/dist/timing/index.js.map +1 -0
  104. package/dist/{types-D7u9DkH7.d.ts → types-DP3f5NIl.d.ts} +1 -1
  105. package/dist/work-queue/index.d.ts +131 -54
  106. package/dist/work-queue/index.js +3 -2
  107. package/dist/work-queue/index.js.map +1 -1
  108. package/package.json +50 -216
  109. package/dist/authed-call/index.d.ts +0 -119
  110. package/dist/authed-call/index.js +0 -134
  111. package/dist/authed-call/index.js.map +0 -1
  112. package/dist/await-terminal/index.d.ts +0 -100
  113. package/dist/await-terminal/index.js +0 -76
  114. package/dist/await-terminal/index.js.map +0 -1
  115. package/dist/batch-window/index.js.map +0 -1
  116. package/dist/cache/index.d.ts +0 -151
  117. package/dist/cache/index.js +0 -8
  118. package/dist/chart/index.d.ts +0 -217
  119. package/dist/chart/index.js +0 -16
  120. package/dist/chart/index.js.map +0 -1
  121. package/dist/chart/inspect/index.d.ts +0 -85
  122. package/dist/chart/inspect/index.js +0 -5
  123. package/dist/chart/inspect/react.d.ts +0 -112
  124. package/dist/chart/inspect/react.js +0 -11
  125. package/dist/chart/inspect/react.js.map +0 -1
  126. package/dist/chart/inspect/styles.css +0 -286
  127. package/dist/chart/lane/index.d.ts +0 -361
  128. package/dist/chart/lane/index.js +0 -9
  129. package/dist/chart/lane/index.js.map +0 -1
  130. package/dist/chart/lane/react.d.ts +0 -83
  131. package/dist/chart/lane/react.js +0 -559
  132. package/dist/chart/lane/react.js.map +0 -1
  133. package/dist/chart/lane/server.d.ts +0 -148
  134. package/dist/chart/lane/server.js +0 -209
  135. package/dist/chart/lane/server.js.map +0 -1
  136. package/dist/chart/lane/styles.css +0 -498
  137. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
  138. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
  139. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
  140. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
  141. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
  142. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
  143. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
  144. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
  145. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
  146. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
  147. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
  148. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
  149. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
  150. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
  151. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
  152. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
  153. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
  154. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
  155. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
  156. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
  157. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
  158. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
  159. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
  160. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
  161. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
  162. package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
  163. package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
  164. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
  165. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
  166. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
  167. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
  168. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
  169. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
  170. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
  171. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
  172. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
  173. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
  174. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
  175. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
  176. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
  177. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
  178. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
  179. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
  180. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
  181. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
  182. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
  183. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
  184. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
  185. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
  186. package/dist/chart/lane/viewer/index.html +0 -15
  187. package/dist/chart/report/index.d.ts +0 -116
  188. package/dist/chart/report/index.js +0 -32
  189. package/dist/chart/report/index.js.map +0 -1
  190. package/dist/chunk-2YFLOCWX.js +0 -15
  191. package/dist/chunk-2YFLOCWX.js.map +0 -1
  192. package/dist/chunk-3JU6657S.js +0 -372
  193. package/dist/chunk-3JU6657S.js.map +0 -1
  194. package/dist/chunk-4KTWLPL5.js +0 -33
  195. package/dist/chunk-4KTWLPL5.js.map +0 -1
  196. package/dist/chunk-5EHLEUTL.js +0 -686
  197. package/dist/chunk-5EHLEUTL.js.map +0 -1
  198. package/dist/chunk-5KJKJOFC.js +0 -758
  199. package/dist/chunk-5KJKJOFC.js.map +0 -1
  200. package/dist/chunk-7SVIRMC6.js.map +0 -1
  201. package/dist/chunk-7V4EVLZA.js.map +0 -1
  202. package/dist/chunk-A56OR5RF.js +0 -184
  203. package/dist/chunk-A56OR5RF.js.map +0 -1
  204. package/dist/chunk-AZZLE7XR.js +0 -62
  205. package/dist/chunk-AZZLE7XR.js.map +0 -1
  206. package/dist/chunk-B5VXOFMZ.js +0 -266
  207. package/dist/chunk-B5VXOFMZ.js.map +0 -1
  208. package/dist/chunk-BYQUGDD3.js +0 -16
  209. package/dist/chunk-BYQUGDD3.js.map +0 -1
  210. package/dist/chunk-D736QUGF.js.map +0 -1
  211. package/dist/chunk-E6GEDSF4.js +0 -307
  212. package/dist/chunk-E6GEDSF4.js.map +0 -1
  213. package/dist/chunk-EUF7XOEE.js +0 -223
  214. package/dist/chunk-EUF7XOEE.js.map +0 -1
  215. package/dist/chunk-EWJP3YYP.js.map +0 -1
  216. package/dist/chunk-FV3Z5MBE.js.map +0 -1
  217. package/dist/chunk-HCEVHFJ7.js +0 -54
  218. package/dist/chunk-HCEVHFJ7.js.map +0 -1
  219. package/dist/chunk-I5OV65MS.js.map +0 -1
  220. package/dist/chunk-J6527VRQ.js.map +0 -1
  221. package/dist/chunk-JELSZN25.js +0 -47
  222. package/dist/chunk-JELSZN25.js.map +0 -1
  223. package/dist/chunk-JER5O7PQ.js +0 -416
  224. package/dist/chunk-JER5O7PQ.js.map +0 -1
  225. package/dist/chunk-JGVL3WPL.js +0 -26
  226. package/dist/chunk-JGVL3WPL.js.map +0 -1
  227. package/dist/chunk-JP5D6GSL.js +0 -71
  228. package/dist/chunk-JP5D6GSL.js.map +0 -1
  229. package/dist/chunk-K575PT4S.js.map +0 -1
  230. package/dist/chunk-MU6MCIAC.js +0 -15
  231. package/dist/chunk-MU6MCIAC.js.map +0 -1
  232. package/dist/chunk-MUUROGIH.js.map +0 -1
  233. package/dist/chunk-ND3DH6KM.js +0 -88
  234. package/dist/chunk-ND3DH6KM.js.map +0 -1
  235. package/dist/chunk-Q2UM7BXU.js.map +0 -1
  236. package/dist/chunk-S2EGRPCM.js +0 -47
  237. package/dist/chunk-S2EGRPCM.js.map +0 -1
  238. package/dist/chunk-SINXE47Y.js +0 -55
  239. package/dist/chunk-SINXE47Y.js.map +0 -1
  240. package/dist/chunk-SUST46KO.js +0 -53
  241. package/dist/chunk-SUST46KO.js.map +0 -1
  242. package/dist/chunk-TP5UPGLY.js +0 -61
  243. package/dist/chunk-TP5UPGLY.js.map +0 -1
  244. package/dist/chunk-UF4MZSLT.js +0 -53
  245. package/dist/chunk-UF4MZSLT.js.map +0 -1
  246. package/dist/chunk-UOC2PL46.js +0 -13
  247. package/dist/chunk-UOC2PL46.js.map +0 -1
  248. package/dist/chunk-WLGO64WC.js.map +0 -1
  249. package/dist/chunk-WRAA7GVZ.js +0 -209
  250. package/dist/chunk-WRAA7GVZ.js.map +0 -1
  251. package/dist/chunk-ZCL7SCBK.js +0 -685
  252. package/dist/chunk-ZCL7SCBK.js.map +0 -1
  253. package/dist/chunk-ZD6PNZBK.js +0 -457
  254. package/dist/chunk-ZD6PNZBK.js.map +0 -1
  255. package/dist/chunk-ZF6WDK2D.js +0 -519
  256. package/dist/chunk-ZF6WDK2D.js.map +0 -1
  257. package/dist/chunk-ZJ5AOYBH.js +0 -8
  258. package/dist/chunk-ZJ5AOYBH.js.map +0 -1
  259. package/dist/chunk-ZVJZ72HY.js.map +0 -1
  260. package/dist/circuit-breaker/index.d.ts +0 -197
  261. package/dist/circuit-breaker/index.js +0 -3
  262. package/dist/circuit-breaker/index.js.map +0 -1
  263. package/dist/core-Bjc0bS8j.d.ts +0 -326
  264. package/dist/deadline/index.js +0 -6
  265. package/dist/deadline/index.js.map +0 -1
  266. package/dist/debounce/index.js +0 -3
  267. package/dist/debounce/index.js.map +0 -1
  268. package/dist/extension/react.d.ts +0 -121
  269. package/dist/extension/react.js +0 -75
  270. package/dist/extension/react.js.map +0 -1
  271. package/dist/extension/subs/index.d.ts +0 -44
  272. package/dist/extension/subs/index.js +0 -80
  273. package/dist/extension/subs/index.js.map +0 -1
  274. package/dist/extension/test-utils.d.ts +0 -128
  275. package/dist/extension/test-utils.js +0 -277
  276. package/dist/extension/test-utils.js.map +0 -1
  277. package/dist/fan-out/index.js +0 -5
  278. package/dist/fan-out/index.js.map +0 -1
  279. package/dist/fold-Blbhru48.d.ts +0 -435
  280. package/dist/graph-CcjWZVrd.d.ts +0 -923
  281. package/dist/idempotency/adapter.d.ts +0 -62
  282. package/dist/idempotency/adapter.js +0 -4
  283. package/dist/idempotency/adapter.js.map +0 -1
  284. package/dist/idempotent-intake/index.d.ts +0 -187
  285. package/dist/idempotent-intake/index.js +0 -7
  286. package/dist/idempotent-intake/index.js.map +0 -1
  287. package/dist/llm-call/index.d.ts +0 -310
  288. package/dist/llm-call/index.js +0 -16
  289. package/dist/llm-call/index.js.map +0 -1
  290. package/dist/machine-0OmPvsy_.d.ts +0 -804
  291. package/dist/monitored-run/index.js +0 -10
  292. package/dist/monitored-run/index.js.map +0 -1
  293. package/dist/paginated-walk/index.d.ts +0 -234
  294. package/dist/paginated-walk/index.js +0 -16
  295. package/dist/paginated-walk/index.js.map +0 -1
  296. package/dist/paginator/index.js +0 -3
  297. package/dist/paginator/index.js.map +0 -1
  298. package/dist/pbt/arbitraries/index.d.ts +0 -135
  299. package/dist/pbt/arbitraries/index.js +0 -3
  300. package/dist/pbt/arbitraries/index.js.map +0 -1
  301. package/dist/pbt/runners/index.d.ts +0 -117
  302. package/dist/pbt/runners/index.js +0 -5
  303. package/dist/pbt/runners/index.js.map +0 -1
  304. package/dist/poller/index.d.ts +0 -351
  305. package/dist/poller/index.js +0 -115
  306. package/dist/poller/index.js.map +0 -1
  307. package/dist/prediction/index.d.ts +0 -130
  308. package/dist/prediction/index.js +0 -4
  309. package/dist/prediction/index.js.map +0 -1
  310. package/dist/protocol-B5YmJr0d.d.ts +0 -45
  311. package/dist/pure/index.d.ts +0 -2
  312. package/dist/pure/index.js +0 -4
  313. package/dist/pure/index.js.map +0 -1
  314. package/dist/rate-limit/index.d.ts +0 -115
  315. package/dist/rate-limit/index.js +0 -3
  316. package/dist/rate-limit/index.js.map +0 -1
  317. package/dist/reconciler/index.d.ts +0 -192
  318. package/dist/reconciler/index.js +0 -164
  319. package/dist/reconciler/index.js.map +0 -1
  320. package/dist/recorder/index.js +0 -3
  321. package/dist/recorder/index.js.map +0 -1
  322. package/dist/reducer-BqyoVyBG.d.ts +0 -447
  323. package/dist/resilient-call/index.d.ts +0 -319
  324. package/dist/resilient-call/index.js +0 -14
  325. package/dist/resilient-call/index.js.map +0 -1
  326. package/dist/retry-to-success/index.d.ts +0 -109
  327. package/dist/retry-to-success/index.js +0 -37
  328. package/dist/retry-to-success/index.js.map +0 -1
  329. package/dist/run-BVeqJDBF.d.ts +0 -713
  330. package/dist/runtime-types-Bxc637bp.d.ts +0 -502
  331. package/dist/saga/index.d.ts +0 -240
  332. package/dist/saga/index.js +0 -150
  333. package/dist/saga/index.js.map +0 -1
  334. package/dist/samples-DCt6nF8H.d.ts +0 -59
  335. package/dist/snapshot/index.js +0 -5
  336. package/dist/snapshot/index.js.map +0 -1
  337. package/dist/subs/index.d.ts +0 -471
  338. package/dist/subs/index.js +0 -7
  339. package/dist/subs/index.js.map +0 -1
  340. package/dist/throttle/index.d.ts +0 -134
  341. package/dist/throttle/index.js +0 -3
  342. package/dist/throttle/index.js.map +0 -1
  343. package/dist/throttled-input/index.js.map +0 -1
  344. package/dist/token-refresh/index.d.ts +0 -215
  345. package/dist/token-refresh/index.js +0 -6
  346. package/dist/token-refresh/index.js.map +0 -1
  347. package/dist/trace-replay/index.js +0 -6
  348. package/dist/trace-replay/index.js.map +0 -1
  349. package/dist/with-deadline/index.d.ts +0 -196
  350. package/dist/with-deadline/index.js +0 -111
  351. package/dist/with-deadline/index.js.map +0 -1
  352. package/dist/with-resilience/index.d.ts +0 -224
  353. package/dist/with-resilience/index.js +0 -240
  354. package/dist/with-resilience/index.js.map +0 -1
  355. package/dist/with-telemetry/index.d.ts +0 -149
  356. package/dist/with-telemetry/index.js +0 -70
  357. package/dist/with-telemetry/index.js.map +0 -1
  358. package/dist/work-queue/adapter.d.ts +0 -83
  359. package/dist/work-queue/adapter.js +0 -4
  360. package/dist/work-queue/adapter.js.map +0 -1
  361. package/dist/work-queue/ops.d.ts +0 -70
  362. package/dist/work-queue/ops.js +0 -3
  363. package/dist/work-queue/ops.js.map +0 -1
  364. package/dist/workflow/index.d.ts +0 -484
  365. package/dist/workflow/index.js +0 -244
  366. package/dist/workflow/index.js.map +0 -1
  367. /package/dist/{cache → paginate}/index.js.map +0 -0
  368. /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
@@ -1,471 +0,0 @@
1
- import { S as Sub, a as Port, e as Dispose, D as DepKeyedSub, b as SubId } from '../core-Bjc0bS8j.js';
2
- import { S as SubscribeHandler } from '../types-D7u9DkH7.js';
3
- import { R as Runtime } from '../runtime-types-Bxc637bp.js';
4
- import 'better-result';
5
-
6
- /**
7
- * The imperative listener target, expressed as the `add`/`remove` pair the
8
- * substrate pairs into a reconciled resource. Both halves receive the SAME
9
- * `listener` reference — the substrate builds it once — so `remove` can never
10
- * be handed a different function than `add` saw.
11
- *
12
- * `add`/`remove` also receive `(sub, ctx)` so the target may be resolved from
13
- * `ctx` (a runtime, a port, a DOM node looked up lazily) or keyed on the Sub
14
- * (an alarm name, a channel name). Resolving the target inside `add` and
15
- * closing over nothing but the listener keeps a target swap from leaking the
16
- * old target's listener — same rationale as `fromEventTarget`'s captured
17
- * target.
18
- *
19
- * `Args` is the tuple the platform invokes the listener with — `[Alarm]` for
20
- * `chrome.alarms.onAlarm`, `[message, sender, sendResponse]` for
21
- * `chrome.runtime.onMessage`, `[changes, areaName]` for
22
- * `chrome.storage.onChanged`. The substrate builds ONE function of this exact
23
- * shape and threads the IDENTICAL reference to both `add` and `remove` — so a
24
- * platform that matches `removeListener` by reference (every chrome surface)
25
- * removes exactly what it added. A consumer that wrapped the listener inside
26
- * `add` would break reference identity (leak #2 above); carrying the native
27
- * `Args` on the listener itself removes the need for any wrapper.
28
- */
29
- interface ListenerTarget<Args extends readonly unknown[], S extends Sub, Ctx> {
30
- add: (listener: (...args: Args) => void, sub: S, ctx: Ctx) => void;
31
- remove: (listener: (...args: Args) => void, sub: S, ctx: Ctx) => void;
32
- }
33
- /**
34
- * Build a listener-backed Sub factory whose cleanup is mandatory and derived.
35
- *
36
- * `Args`, `S`, `Ctx` are fixed when the target is defined — they describe the
37
- * one listener topology this factory owns (the platform arg tuple, which Sub
38
- * shape it filters on, what context resolves it). `M` is supplied at the
39
- * subscribe cell because the same listener feeds different Msgs in different
40
- * machines. Pinning `S` here (rather than at the `msgFn` step) lets
41
- * `add`/`remove` read the concrete Sub's fields — `sub.alarmName`,
42
- * `sub.channel` — with NO cast at the substrate edge: the narrowing happens in
43
- * author-land where the Sub shape is in scope.
44
- *
45
- * The returned function is a `SubscribeHandler` factory in the exact shape of
46
- * every other `@demlik/tea/subs` battery: supply the `msgFn` projection, get a
47
- * `(sub, ctx, dispatch) => cleanup` handler assignable to `machine.subscribe`.
48
- * The cleanup the author NEVER writes is `() => remove(listener, sub, ctx)`,
49
- * with `listener` the identical reference passed to `add`.
50
- */
51
- declare function defineListener<Args extends readonly unknown[], S extends Sub = Sub, Ctx = unknown>(target: ListenerTarget<Args, S, Ctx>): <M>(msgFn: (sub: S, ...args: Args) => M | null) => SubscribeHandler<S, M, Ctx>;
52
-
53
- interface MinimalEvent {
54
- readonly type: string;
55
- }
56
- interface MinimalMessageEvent extends MinimalEvent {
57
- readonly data: unknown;
58
- }
59
- interface MinimalEventTarget {
60
- addEventListener(type: string, listener: (event: MinimalEvent) => void): void;
61
- removeEventListener(type: string, listener: (event: MinimalEvent) => void): void;
62
- }
63
- interface MinimalCloseEvent extends MinimalEvent {
64
- readonly code: number;
65
- readonly reason: string;
66
- }
67
- interface MinimalWebSocket {
68
- close(code?: number, reason?: string): void;
69
- onopen: ((event: MinimalEvent) => void) | null;
70
- onmessage: ((event: MinimalMessageEvent) => void) | null;
71
- onerror: ((event: MinimalEvent) => void) | null;
72
- onclose: ((event: MinimalCloseEvent) => void) | null;
73
- }
74
-
75
- type BroadcastSubData = {
76
- channelName: string;
77
- };
78
- declare function fromBroadcastChannel<S extends Sub & BroadcastSubData, M>(msgFn: (event: MinimalMessageEvent, sub: S) => M | null): SubscribeHandler<S, M, unknown>;
79
-
80
- type EventSourceSubData = {
81
- url: string;
82
- };
83
- interface EventSourceFactoryOpts<S, M> {
84
- onMessage: (data: string, sub: S) => M | null;
85
- onError?: (event: MinimalEvent, sub: S) => M | null;
86
- onOpen?: (sub: S) => M | null;
87
- }
88
- declare function fromEventSource<S extends Sub & EventSourceSubData, M>(opts: EventSourceFactoryOpts<S, M>): SubscribeHandler<S, M, unknown>;
89
-
90
- declare function fromEventTarget<S extends Sub, M>(getTarget: () => MinimalEventTarget, eventName: string, msgFn: (event: MinimalEvent, sub: S) => M | null): SubscribeHandler<S, M, unknown>;
91
-
92
- type IntervalSubData = {
93
- intervalMs: number;
94
- };
95
- declare function fromInterval<S extends Sub & IntervalSubData, M>(msgFn: (sub: S) => M): SubscribeHandler<S, M, unknown>;
96
-
97
- declare function fromPort<S extends Sub, M, Ctx, T, RS = unknown, RM extends {
98
- type: string;
99
- } = {
100
- type: string;
101
- }>(selectRuntime: (ctx: Ctx) => Runtime<RS, RM>, port: Port<T>, msgFn: (value: T, sub: S) => M | null): SubscribeHandler<S, M, Ctx>;
102
-
103
- type WebSocketSubData = {
104
- wsUrl: string;
105
- };
106
- interface WebSocketFactoryOpts<S, M> {
107
- onMessage: (data: unknown, sub: S) => M | null;
108
- onOpen?: (sub: S) => M | null;
109
- onError?: (event: MinimalEvent, sub: S) => M | null;
110
- onClose?: (code: number, reason: string, sub: S) => M | null;
111
- }
112
- declare function fromWebSocket<S extends Sub & WebSocketSubData, M>(opts: WebSocketFactoryOpts<S, M>): SubscribeHandler<S, M, unknown>;
113
-
114
- /** Cancels a scheduled reconnect timer (the inverse of `schedule`). */
115
- type CancelTimer = () => void;
116
- interface ReconnectingWebSocketFactoryOpts<S, M> {
117
- onMessage: (data: unknown, sub: S) => M | null;
118
- onOpen?: (sub: S) => M | null;
119
- onError?: (event: MinimalEvent, sub: S) => M | null;
120
- onClose?: (code: number, reason: string, sub: S) => M | null;
121
- /**
122
- * Fires when a reconnection (any open after the first) succeeds, carrying the
123
- * 1-based reconnect count — the resync hook. Omitting drops reconnect events
124
- * silently.
125
- */
126
- onReconnect?: (attempt: number, sub: S) => M | null;
127
- /** First backoff delay in ms (doubles each failed attempt). Default 250. */
128
- backoffBaseMs?: number;
129
- /** Backoff ceiling in ms. Default 5000. */
130
- backoffMaxMs?: number;
131
- /** Inject the socket constructor (defaults to the global `WebSocket`); the test seam. */
132
- connect?: (url: string) => MinimalWebSocket;
133
- /** Inject the timer (defaults to `setTimeout`/`clearTimeout`); the test seam. */
134
- schedule?: (fn: () => void, ms: number) => CancelTimer;
135
- }
136
- declare function fromReconnectingWebSocket<S extends Sub & WebSocketSubData, M>(opts: ReconnectingWebSocketFactoryOpts<S, M>): SubscribeHandler<S, M, unknown>;
137
-
138
- type TimeoutSubData = {
139
- delayMs: number;
140
- };
141
- declare function fromTimeout<S extends Sub & TimeoutSubData, M>(msgFn: (sub: S) => M): SubscribeHandler<S, M, unknown>;
142
-
143
- /**
144
- * The Sub the battery builds. The consumer's `Sub` union includes
145
- * `ManagedResourceSub<TKey>` directly — the substrate reconciles by `id` and
146
- * `type` like any other Sub.
147
- */
148
- interface ManagedResourceSub<TKey> extends Sub<"managed_resource"> {
149
- /** The lifetime key. Stable while the resource should be held; a change
150
- * retires the old resource (release) and acquires a fresh one. */
151
- readonly key: TKey;
152
- }
153
- /**
154
- * A battery paired with a state-gate. Self-contained: it knows its `name`
155
- * (for the unique-name assert), how to derive its live Sub from a state
156
- * (`subFor`), how to handle its own `subscribe`, and whether it `owns` a given
157
- * Sub id.
158
- *
159
- * Generic in the consumer state `S`, the shared lifetime key `TKey`, and the
160
- * shared `Ctx`. `Handle` is the ONLY thing erased — each battery's handle type
161
- * differs (a checkpoint saver vs. a tool-call bridge) but never crosses this
162
- * interface, so a `combineManagedResources` array holds entries of
163
- * heterogeneous handle types with no cast. The sub type stays
164
- * `ManagedResourceSub<TKey>` end to end, so the substrate's narrowed Sub flows
165
- * straight in.
166
- */
167
- interface GatedManagedResource<S, TKey, Ctx> {
168
- /** The owning battery's `name`. The combinator asserts these are unique. */
169
- readonly name: string;
170
- /**
171
- * Derive this resource's live Sub for a given state: the battery's
172
- * `.sub(key)` when `when(state)` returns a key, or `null` when it returns
173
- * `null` (the resource should be torn down in that state).
174
- */
175
- readonly subFor: (state: S) => ManagedResourceSub<TKey> | null;
176
- /**
177
- * This battery's own `.subscribe`. The combinator routes an incoming
178
- * `managed_resource` Sub to the entry whose `owns(sub)` is true, then calls
179
- * this.
180
- */
181
- readonly subscribe: (sub: ManagedResourceSub<TKey>, ctx: Ctx, dispatch: (msg: never) => void) => Dispose;
182
- /**
183
- * Does this entry own the given Sub? `sub.id === subIdFor(sub.key)` encodes
184
- * the battery `name`, so a match is unambiguous.
185
- */
186
- readonly owns: (sub: ManagedResourceSub<TKey>) => boolean;
187
- }
188
- /**
189
- * What `combineManagedResources` returns: the single managed-resource
190
- * `subscribe` cell for the machine's `subscribe` record, and a `subs(state)`
191
- * builder for `subscriptions(state)`.
192
- */
193
- interface CombinedManagedResources<S, TKey, Ctx> {
194
- /**
195
- * Map every entry through its `when(state)`, drop the `null`s, and build the
196
- * live Subs. Spread into `subscriptions(state)`. The derived list and the
197
- * `subscribe` routing share one source — the entries — so they never drift.
198
- */
199
- readonly subs: (state: S) => ManagedResourceSub<TKey>[];
200
- /**
201
- * The SINGLE `subscribe.managed_resource` handler. Routes an incoming Sub to
202
- * the owning battery by matching `sub.id === battery.subIdFor(sub.key)` (the
203
- * id encodes the battery `name`). Throws loudly on an unrouted id — a wiring
204
- * bug, never a silent no-op resource.
205
- */
206
- readonly subscribe: (sub: ManagedResourceSub<TKey>, ctx: Ctx, dispatch: (msg: never) => void) => Dispose;
207
- }
208
- interface DefineManagedResourceOpts<TKey, Handle, Ctx> {
209
- /**
210
- * A short, stable name. The Sub id is `managed:${name}:${stringify(key)}`,
211
- * so two managed resources in one machine never collide and neither
212
- * collides with a `fromTransport` Sub keyed on the same identity.
213
- */
214
- readonly name: string;
215
- /**
216
- * Build the resource. Runs when the Sub appears in `subscriptions(state)`.
217
- * The returned Handle is the ONLY thing `release` receives — capture
218
- * everything teardown needs into it. If `acquire` throws, the substrate's
219
- * reconcile does NOT register the Sub and `release` is never called (no
220
- * dangling half-built resource).
221
- */
222
- readonly acquire: (key: TKey, ctx: Ctx) => Handle;
223
- /**
224
- * Tear the resource down. Runs when the Sub leaves the desired set (phase
225
- * exited) or when its key changes. MANDATORY — the guaranteed teardown is
226
- * the reason this battery exists.
227
- *
228
- * May be sync or async, and an async one is really awaited: the promise is
229
- * returned to the substrate, which tracks it and drains it inside `stop()`
230
- * (bounded by `run({ disposeTimeoutMs })`). So `await runtime.stop()` means
231
- * the release finished — the reading a host evicting an isolate acts on.
232
- * MID-RUN teardown (a phase exit, a key change) is still fire-and-forget
233
- * (Rule 2): the reconcile pass is synchronous by construction, so it starts
234
- * the release and moves on. A rejection is never a Msg — it reaches the
235
- * runtime's `onError` sink under `phase: "sub-cleanup"`.
236
- */
237
- readonly release: (handle: Handle) => void | Promise<void>;
238
- }
239
- /**
240
- * What the battery returns: a `.sub(key)` builder for `subscriptions`, the
241
- * `.subscribe` handler for the machine's `subscribe` record, a `.get(key)`
242
- * accessor so Cmd handlers can reach the live Handle while the resource is
243
- * held, and a `.subIdFor(key)` for tests.
244
- */
245
- interface ManagedResourceBattery<TKey, Handle, Ctx> {
246
- /**
247
- * Build the Sub for `subscriptions(state)`. The consumer calls this from
248
- * inside their `subscriptions` cell for the phases where the resource
249
- * should be live.
250
- */
251
- readonly sub: (key: TKey) => ManagedResourceSub<TKey>;
252
- /**
253
- * Pair this battery with a state-gate, producing a self-contained entry for
254
- * `combineManagedResources`. `when(state)` returns the resource's KEY when
255
- * it should be live in that state, or `null` when it should be torn down.
256
- *
257
- * Folding "is it active?" and "what key?" into ONE declaration at the
258
- * battery's own definition site is the point: a central `subscriptions(state)`
259
- * list can silently forget to gate a new phase, but a per-resource gate
260
- * travels with the resource. The combinator derives BOTH the active-sub list
261
- * and the subscribe routing from these entries, so the two can never disagree.
262
- *
263
- * Generic in the consumer's state `S` (each `.gated` call binds its own `S`).
264
- * The returned entry erases this battery's `Handle` — `combineManagedResources`
265
- * holds entries of heterogeneous handle types with no cast — while keeping
266
- * `TKey` and `Ctx` so the substrate's narrowed `ManagedResourceSub<TKey>`
267
- * flows straight into the entry's `subscribe`.
268
- */
269
- readonly gated: <S>(when: (state: S) => TKey | null) => GatedManagedResource<S, TKey, Ctx>;
270
- /**
271
- * Dep-keyed entry for the machine's `subs` array. `when(state)` returns the
272
- * resource's KEY when it should be held, or `null` when it should be torn
273
- * down — the exact gate `.gated` takes, now producing a `DepKeyedSub` the
274
- * kernel folds directly instead of an entry the `combineManagedResources`
275
- * router multiplexes.
276
- *
277
- * This is the simplification the dep-keyed kernel unlocks: two managed
278
- * resources used to COLLIDE on the single `subscribe.managed_resource` key
279
- * (both subs share `type: "managed_resource"`), forcing
280
- * `combineManagedResources` to route by SubId. A dep-keyed Sub has its OWN
281
- * reconcile slot (its array position), so there is no shared `type` to route
282
- * — each resource is one `subs` entry, no combinator, no router. `acquire` /
283
- * `release` still ride the kernel's dispose-on-change / dispose-on-null
284
- * reconcile, now via the dep-keyed source's `Dispose` instead of the
285
- * `subscribe` cell's cleanup.
286
- */
287
- readonly depKeyed: <S>(when: (state: S) => TKey | null) => DepKeyedSub<S, never, Ctx>;
288
- /**
289
- * The `subscribe.managed_resource` handler. Drop straight into the
290
- * machine's `subscribe` record. Runs `acquire` on install, holds the
291
- * Handle in the battery's handle table, and returns a cleanup that runs
292
- * `release` (and forgets the Handle) on reconcile-out.
293
- */
294
- readonly subscribe: (sub: ManagedResourceSub<TKey>, ctx: Ctx, dispatch: (msg: never) => void) => Dispose;
295
- /**
296
- * Accessor for the live Handle, keyed on `key`. Returns `undefined` when
297
- * the resource is not currently held (no active sub for that key) — the
298
- * caller decides whether that is an error. A Cmd handler wires its
299
- * `ctx.getX(key)` through this, so the handler reads the SAME owner the
300
- * reconciler holds, never a hand-built duplicate.
301
- */
302
- readonly get: (key: TKey) => Handle | undefined;
303
- /** Pre-derived subId for `(key)` — handy for tests. */
304
- readonly subIdFor: (key: TKey) => SubId;
305
- }
306
- /**
307
- * Build the battery. One call per managed resource at the machine's host
308
- * file.
309
- *
310
- * @example
311
- * const checkpointStore = defineManagedResource<RunId, CheckpointSaver, Ctx>({
312
- * name: "checkpoint",
313
- * acquire: (runId, ctx) =>
314
- * new CheckpointSaver({ storage: ctx.storage, bucket: ctx.bucket, runId }),
315
- * release: (saver) => saver.clear(),
316
- * });
317
- *
318
- * // In the machine:
319
- * subscriptions: (state) =>
320
- * state.type === "running" ? [checkpointStore.sub(state.runId)] : [],
321
- * subscribe: { managed_resource: checkpointStore.subscribe },
322
- *
323
- * // In interpret (read the live handle the reconciler holds):
324
- * start_graph: async (cmd, ctx) => {
325
- * const saver = checkpointStore.get(cmd.runId); // same owner, no rebuild
326
- * ...
327
- * }
328
- */
329
- declare function defineManagedResource<TKey, Handle, Ctx>(opts: DefineManagedResourceOpts<TKey, Handle, Ctx>): ManagedResourceBattery<TKey, Handle, Ctx>;
330
- declare function combineManagedResources<S, TKey, Ctx>(entries: readonly GatedManagedResource<S, TKey, Ctx>[]): CombinedManagedResources<S, TKey, Ctx>;
331
-
332
- /**
333
- * Duplex transport. The host (DO, worker thread, in-process bus) constructs
334
- * one from whatever the platform offers. `fromTransport` does not know what
335
- * a WebSocket is — it knows `send`, `onMessage`, `onClose`.
336
- */
337
- interface Transport {
338
- /** Send a string frame. Best-effort; failures are logged at the boundary. */
339
- send(data: string): void;
340
- /**
341
- * Subscribe to inbound frames. Returns a cleanup that removes the listener.
342
- * The battery wires this in its Sub's subscribe handler; cleanup runs when
343
- * the phase exits (the substrate's reconcileSubs).
344
- */
345
- onMessage(listener: (data: string) => void): () => void;
346
- /**
347
- * Subscribe to a one-shot close. Returns a cleanup that removes the
348
- * listener. The battery dispatches `lostMsg` on close.
349
- */
350
- onClose(listener: () => void): () => void;
351
- /** Close the underlying channel cleanly. Called by the Sub cleanup. */
352
- close(): void;
353
- }
354
- /**
355
- * Factory the consumer wires to a platform-specific transport. The battery
356
- * passes the runtime-derived key (`runId`, or whatever identity is on the
357
- * phase) so per-run transports can be addressed.
358
- */
359
- type TransportFactory<K> = (key: K) => Transport;
360
- /**
361
- * The Sub the battery builds. The consumer's `Sub` union includes
362
- * `TransportSub<TKey>` directly — no wrapping needed, the substrate
363
- * reconciles by `id` and `type` like any other Sub.
364
- */
365
- interface TransportSub<TKey> extends Sub<"transport"> {
366
- /** The phase / run identity. Stable for the lifetime of the seam. */
367
- readonly key: TKey;
368
- }
369
- interface FromTransportOpts<TKey, Inbound, Outbound, M, Ctx> {
370
- /**
371
- * A short, stable name for this seam. The Sub id is derived from
372
- * `${name}:${stringify(key)}` so two seams in the same machine (e.g.
373
- * `hands` + `worker`) never collide.
374
- */
375
- readonly name: string;
376
- /**
377
- * Build the transport. The battery owns the lifetime; the factory is the
378
- * platform-specific constructor (`new WebSocket(...)` adapter on a DO,
379
- * `MessagePort` adapter in a worker, in-memory stub in tests).
380
- */
381
- readonly openTransport: (key: TKey, ctx: Ctx) => Transport;
382
- /**
383
- * Parse one inbound frame. The battery hands `unknown` through (boundary
384
- * parse is the consumer's responsibility per invariant 8). Returning
385
- * `null` drops the frame silently — useful for frames the seam doesn't
386
- * recognize at this layer (e.g. transport-level keepalive).
387
- */
388
- readonly parseInbound: (raw: string, key: TKey) => Inbound | null;
389
- /**
390
- * Map a parsed inbound to a domain Msg. Returning `null` drops the
391
- * dispatch (e.g. a transport-level pong that doesn't change domain state).
392
- */
393
- readonly onInbound: (inbound: Inbound, key: TKey) => M | null;
394
- /**
395
- * The Msg dispatched when the transport closes (peer gone, network
396
- * dropped, normal close). ONE Msg arm, not a Sub, not a heartbeat-derived
397
- * deadline — the transport's own close signal is the truth.
398
- */
399
- readonly lostMsg: (key: TKey) => M;
400
- /**
401
- * Serialize an outbound. Called by the Cmd handler the battery wires.
402
- * Pure data → string at the seam boundary.
403
- */
404
- readonly serializeOutbound: (outbound: Outbound) => string;
405
- }
406
- /**
407
- * What the battery returns: a Sub builder (for `subscriptions`), the Sub's
408
- * `subscribe` handler (for `subscribe.transport`), and a `send(key, outbound)`
409
- * helper the consumer's Cmd handler calls. Plus a `subIdFor` factory the
410
- * consumer can use when keying related Subs (e.g. a deadline) to the same seam
411
- * identity.
412
- */
413
- interface TransportBattery<TKey, Outbound, M, Ctx> {
414
- /**
415
- * Build the Sub for `subscriptions(state)`. The consumer calls this from
416
- * inside their `subscriptions` cell when the seam should be open.
417
- */
418
- readonly sub: (key: TKey) => TransportSub<TKey>;
419
- /**
420
- * The `subscribe.transport` handler. Drop straight into the machine's
421
- * `subscribe` record — the battery wires inbound + close in one shot.
422
- */
423
- readonly subscribe: (sub: TransportSub<TKey>, ctx: Ctx, dispatch: (msg: M) => void) => () => void;
424
- /**
425
- * Outbound send. The Cmd handler calls this; the battery's handle table
426
- * (built when subscribe ran) routes to the live transport. If the seam
427
- * is closed (no active sub), the send is dropped honestly (logged, not
428
- * thrown — the reducer already moved past caring, same shape as Rule 2
429
- * fire-and-forget Cmds).
430
- */
431
- readonly send: (key: TKey, outbound: Outbound) => void;
432
- /** Pre-derived subId for `(key)` — handy for deadline Subs keyed to the same seam. */
433
- readonly subIdFor: (key: TKey) => SubId;
434
- /**
435
- * Pair this seam with a state-gate, producing a dep-keyed Sub for the
436
- * machine's `subs` array. `when(state)` returns the seam's KEY when it
437
- * should be open, or `null` when it should be torn down. The kernel derives
438
- * the id from `structuralHash(key)` and reconciles the seam's lifetime — so
439
- * the author neither lists this Sub in a central `subscriptions(state)` nor
440
- * writes its id. Replaces `subscriptions: (s) => active(s) ? [hands.sub(...)] : []`
441
- * + `subscribe: { transport: hands.subscribe }` with one `subs` entry.
442
- *
443
- * The `source` closes over the battery's own `subscribe` (open inbound +
444
- * close, wire the handle table) using the same `ctx` the kernel passes every
445
- * Sub source.
446
- */
447
- readonly depKeyed: <S>(when: (state: S) => TKey | null) => DepKeyedSub<S, M, Ctx>;
448
- }
449
- /**
450
- * Build the battery. One call per seam at the machine's host file.
451
- *
452
- * @example
453
- * const handsSeam = fromTransport<RunId, HandsInbound, HandsOutbound, Msg, Ctx>({
454
- * name: "hands",
455
- * openTransport: (runId, ctx) => ctx.openHandsWs(runId),
456
- * parseInbound: (raw) => parseHandsInbound(JSON.parse(raw)),
457
- * onInbound: (inbound, runId) => ({ type: "hands_said", runId, inbound }),
458
- * lostMsg: (runId) => ({ type: "hands_lost", runId }),
459
- * serializeOutbound: (out) => JSON.stringify(out),
460
- * });
461
- *
462
- * // In the machine:
463
- * subscriptions: (state) => state.type === "auditing" ? [handsSeam.sub(state.runId)] : [],
464
- * subscribe: { transport: handsSeam.subscribe },
465
- *
466
- * // In interpret:
467
- * send_hands: async (cmd) => { handsSeam.send(cmd.runId, cmd.outbound); },
468
- */
469
- declare function fromTransport<TKey, Inbound, Outbound, M, Ctx>(opts: FromTransportOpts<TKey, Inbound, Outbound, M, Ctx>): TransportBattery<TKey, Outbound, M, Ctx>;
470
-
471
- export { type CancelTimer, type CombinedManagedResources, type DefineManagedResourceOpts, type EventSourceFactoryOpts, type FromTransportOpts, type GatedManagedResource, type ListenerTarget, type ManagedResourceBattery, type ManagedResourceSub, type ReconnectingWebSocketFactoryOpts, SubscribeHandler, type Transport, type TransportBattery, type TransportFactory, type TransportSub, type WebSocketFactoryOpts, type WebSocketSubData, combineManagedResources, defineListener, defineManagedResource, fromBroadcastChannel, fromEventSource, fromEventTarget, fromInterval, fromPort, fromReconnectingWebSocket, fromTimeout, fromTransport, fromWebSocket };
@@ -1,7 +0,0 @@
1
- export { combineManagedResources, defineListener, defineManagedResource, fromBroadcastChannel, fromEventSource, fromEventTarget, fromInterval, fromPort, fromReconnectingWebSocket, fromTransport, fromWebSocket } from '../chunk-3JU6657S.js';
2
- export { fromTimeout } from '../chunk-2YFLOCWX.js';
3
- import '../chunk-ZJ5AOYBH.js';
4
- import '../chunk-5EHLEUTL.js';
5
- import '../chunk-B5VXOFMZ.js';
6
- //# sourceMappingURL=index.js.map
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1,134 +0,0 @@
1
- /**
2
- * @demlik/tea/throttle — a timer-based call transformer that caps invocation
3
- * to at most once per `ms` window.
4
- *
5
- * Sibling of `@demlik/tea/debounce` — the two share a SYMMETRIC surface
6
- * (`Throttled<A>` / `Debounced<A>`, both callable + `.cancel()` + `.flush()`,
7
- * both `{ leading?, trailing? }`) so they read as a pair. They are kept in
8
- * separate files with NO cross-import: each is a self-contained timer, and the
9
- * coalesce-vs-drop policies differ enough that sharing code would hide the
10
- * distinction. The contrast IS the lesson:
11
- *
12
- * - **debounce** waits for quiet — fires once AFTER a burst settles.
13
- * - **throttle** enforces a rate — fires AT MOST once per `ms` while the
14
- * burst is ongoing, dropping the calls in between.
15
- *
16
- * Layering with `@demlik/tea/throttled-input`: `throttle` and `debounce` are
17
- * the two host-boundary PRIMITIVES — two distinct algorithms
18
- * (at-most-once-per-window vs collapse-a-burst) behind one signature shape.
19
- * `throttled-input` is NOT a third primitive: it is a TEA machine composed
20
- * OVER them (the same semantics, reimplemented as pure, durable Model state)
21
- * that re-exports both. Wrapping a raw host event → these primitives; durable, replayable
22
- * gating inside a machine → `throttled-input` (see its module doc for the full
23
- * layering map).
24
- *
25
- * WHAT THIS IS NOT — and why it lives outside `update`:
26
- *
27
- * - NOT a reducer / Transitions cell. Reducers are PURE (invariant 2 — same
28
- * inputs → same outputs, no `Date.now`, no timers). A throttle holds a live
29
- * `setTimeout` handle and a window cursor; folding it into `update` would
30
- * smuggle a timer into the pure core.
31
- * - NOT a Sub. A Sub is a continuous SOURCE of Msgs the substrate reconciles
32
- * by id every transition (invariant 4). A throttle is a SINK transformer:
33
- * it wraps a `void`-returning handler (the canonical one is
34
- * `Runtime.dispatch`) so a high-frequency HOST event is rate-limited BEFORE
35
- * it ever becomes a Msg.
36
- *
37
- * It is a higher-order function at the host boundary (pattern 14 — TEA owns
38
- * state, JS owns timing). The host attaches the wrapped function to a
39
- * high-frequency event source (`mousemove`, `scroll`, `pointermove`, a game
40
- * loop) and the substrate downstream only ever sees the rate-limited Msg:
41
- *
42
- * const onMoved = throttle(
43
- * (e: PointerEvent) =>
44
- * runtime.dispatch({ type: "UserMovedCursor", x: e.clientX, y: e.clientY }),
45
- * 16, // ~60fps cap
46
- * );
47
- * window.addEventListener("pointermove", onMoved);
48
- * // cleanup: onMoved.cancel(); window.removeEventListener("pointermove", onMoved);
49
- *
50
- * NOT exported from the package root — reached via the `@demlik/tea/throttle`
51
- * subpath, same one-shape-per-package rule as `rate-limit`, `deadline`, and
52
- * `work-queue`.
53
- *
54
- * Uses the universal `setTimeout` / `clearTimeout` timer idiom (same discipline
55
- * as `subs/from-timeout.ts`): exactly one live handle at a time, the window
56
- * timer clears itself on expiry, `cancel` / `flush` clear and null it so a
57
- * stale callback can never run.
58
- */
59
- /**
60
- * A throttled wrapper around `fn`. Callable with the SAME argument tuple as
61
- * `fn` — `(...args: A) => void` — plus two control methods that share names and
62
- * shapes with `Debounced<A>` so the two modules read as a symmetric pair.
63
- */
64
- interface Throttled<A extends readonly unknown[]> {
65
- /** Invoke `fn` if the window is open, else record args for the trailing fire. */
66
- (...args: A): void;
67
- /**
68
- * Drop any pending trailing fire WITHOUT invoking `fn`, and close the active
69
- * window. Clears the timer, forgets the captured trailing args, and resets
70
- * the cursor so the next call fires immediately on the leading edge (if
71
- * `leading` is enabled). Idempotent.
72
- *
73
- * The host-cleanup partner of `removeEventListener`: cancel the pending fire
74
- * when the component unmounts / the listener detaches, so a queued
75
- * `dispatch` can't land after teardown.
76
- */
77
- cancel(): void;
78
- /**
79
- * Fire any pending trailing call IMMEDIATELY with its latest captured args,
80
- * then close the window. No-op when nothing is pending. Use to force the last
81
- * dropped call out early — e.g. flush the final cursor position when a drag
82
- * ends, so the rest state isn't a stale mid-drag sample.
83
- */
84
- flush(): void;
85
- }
86
- /**
87
- * Wrap `fn` so it runs AT MOST once per `ms` window, no matter how often it is
88
- * called.
89
- *
90
- * Leading + trailing (the default): the first call fires `fn` IMMEDIATELY (the
91
- * leading edge) and opens a `ms` window. Calls during the window are dropped
92
- * from immediate firing but their args are remembered; when the window closes,
93
- * `fn` fires ONCE more with the LATEST dropped args (the trailing edge) and a
94
- * new window opens. A call after the window has already closed leads a fresh
95
- * window immediately. Spacing every call at least `ms` apart therefore fires
96
- * each one on its own leading edge.
97
- *
98
- * @param fn The handler to rate-limit. Typically `(...) => runtime.dispatch(...)`,
99
- * but any `(...args: A) => void` works. The return value is
100
- * ignored — throttle is a fire transformer, not a value pipe.
101
- * @param ms Window length in milliseconds. `fn` fires at most once per `ms`.
102
- * @param opts.leading Fire on the FIRST call of a window (the leading edge),
103
- * immediately. Default `true`.
104
- * @param opts.trailing Fire once at window END with the latest args dropped
105
- * during the window. Default `true`.
106
- *
107
- * Edge combinations (matching lodash's settled semantics, the de-facto
108
- * standard the ecosystem rediscovered):
109
- *
110
- * - `{ leading: true, trailing: true }` (default): immediate fire + a
111
- * trailing fire per window while calls keep arriving. The trailing fire is
112
- * SUPPRESSED when no extra call arrived during the window (a lone call
113
- * already fired on the leading edge — no stale trailing double-fire).
114
- * - `{ leading: true, trailing: false }`: only the immediate fire; everything
115
- * in the window is dropped with no catch-up at the end.
116
- * - `{ leading: false, trailing: true }`: no immediate fire; the FIRST call
117
- * opens a window and `fn` fires at the window's end with the latest args.
118
- * Steady "sample every `ms`" behavior with no instant response.
119
- * - `{ leading: false, trailing: false }`: never fires. Degenerate but legal;
120
- * we don't throw — the caller asked for a no-op transformer.
121
- *
122
- * WHY a default of leading + trailing both `true`: a throttle's job is "respond
123
- * now, then keep responding at a steady rate." Leading gives the instant
124
- * response (the first `mousemove` updates immediately); trailing guarantees the
125
- * FINAL sample of a window isn't lost (the cursor ends where the user actually
126
- * left it, not one window-width behind). Dropping either loses one of those two
127
- * guarantees, so both default on.
128
- */
129
- declare function throttle<A extends readonly unknown[]>(fn: (...args: A) => void, ms: number, opts?: {
130
- leading?: boolean;
131
- trailing?: boolean;
132
- }): Throttled<A>;
133
-
134
- export { type Throttled, throttle };
@@ -1,3 +0,0 @@
1
- export { throttle } from '../chunk-HCEVHFJ7.js';
2
- //# sourceMappingURL=index.js.map
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}