@demlik/tea 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/README.md +11 -9
  2. package/dist/agent/index.d.ts +637 -45
  3. package/dist/agent/index.js +9 -19
  4. package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
  5. package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
  6. package/dist/chunk-AQ6ZIMEA.js +421 -0
  7. package/dist/chunk-AQ6ZIMEA.js.map +1 -0
  8. package/dist/{chunk-MUUROGIH.js → chunk-BLJ2JQSH.js} +62 -12
  9. package/dist/chunk-BLJ2JQSH.js.map +1 -0
  10. package/dist/{chunk-RH5EFRVJ.js → chunk-F2US5BW6.js} +25 -5
  11. package/dist/chunk-F2US5BW6.js.map +1 -0
  12. package/dist/{batch-window/index.js → chunk-F7FMAWLA.js} +4 -8
  13. package/dist/chunk-F7FMAWLA.js.map +1 -0
  14. package/dist/{chunk-O4MVQTEJ.js → chunk-HUKZQX6U.js} +20 -16
  15. package/dist/chunk-HUKZQX6U.js.map +1 -0
  16. package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
  17. package/dist/chunk-HWVW4AXC.js.map +1 -0
  18. package/dist/{chunk-DMYGQB4O.js → chunk-HYDWG35Q.js} +23 -6
  19. package/dist/chunk-HYDWG35Q.js.map +1 -0
  20. package/dist/{chunk-YUXP55T2.js → chunk-I5MQMJDW.js} +57 -7
  21. package/dist/chunk-I5MQMJDW.js.map +1 -0
  22. package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
  23. package/dist/chunk-LFZUK6J2.js.map +1 -0
  24. package/dist/{chunk-ZVJZ72HY.js → chunk-LYLTKJWM.js} +25 -11
  25. package/dist/chunk-LYLTKJWM.js.map +1 -0
  26. package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
  27. package/dist/chunk-MYXFNWAJ.js.map +1 -0
  28. package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
  29. package/dist/chunk-PR6TB3BL.js.map +1 -0
  30. package/dist/chunk-RQULHGYH.js +1804 -0
  31. package/dist/chunk-RQULHGYH.js.map +1 -0
  32. package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
  33. package/dist/chunk-TXN2KFHF.js.map +1 -0
  34. package/dist/{chunk-Q2UM7BXU.js → chunk-VBDU4JL6.js} +2 -2
  35. package/dist/chunk-VBDU4JL6.js.map +1 -0
  36. package/dist/chunk-Z2L3LSNV.js +1470 -0
  37. package/dist/chunk-Z2L3LSNV.js.map +1 -0
  38. package/dist/{core-Co0LWkIA.d.ts → core-CTzMJ82M.d.ts} +72 -23
  39. package/dist/devtools/index.d.ts +2 -2
  40. package/dist/devtools/index.js +207 -2
  41. package/dist/devtools/index.js.map +1 -1
  42. package/dist/do/index.d.ts +42 -29
  43. package/dist/do/index.js +36 -25
  44. package/dist/do/index.js.map +1 -1
  45. package/dist/{durable-effects-C6uwzjb5.d.ts → durable-effects-B0-qGQDy.d.ts} +2 -2
  46. package/dist/extension/index.d.ts +300 -3
  47. package/dist/extension/index.js +596 -5
  48. package/dist/extension/index.js.map +1 -1
  49. package/dist/flow/index.d.ts +1295 -0
  50. package/dist/flow/index.js +732 -0
  51. package/dist/flow/index.js.map +1 -0
  52. package/dist/idempotency/index.d.ts +90 -116
  53. package/dist/idempotency/index.js +4 -1
  54. package/dist/{batch-window/index.d.ts → index-4vZzljCD.d.ts} +7 -12
  55. package/dist/{fan-out/index.d.ts → index-6A7dB8f6.d.ts} +7 -9
  56. package/dist/index-B5BZ-_cT.d.ts +616 -0
  57. package/dist/index-Bc40JWVl.d.ts +131 -0
  58. package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
  59. package/dist/index-DJWIER_3.d.ts +69 -0
  60. package/dist/{snapshot/index.d.ts → index-DMCeMPMJ.d.ts} +15 -78
  61. package/dist/{monitored-run/index.d.ts → index-NjrT3fL2.d.ts} +37 -13
  62. package/dist/{recorder/index.d.ts → index-TvRb1KVf.d.ts} +4 -7
  63. package/dist/{deadline/index.d.ts → index-q0hXFeZ0.d.ts} +155 -9
  64. package/dist/index.d.ts +711 -6
  65. package/dist/index.js +1 -2
  66. package/dist/jev/index.d.ts +634 -0
  67. package/dist/jev/index.js +433 -0
  68. package/dist/jev/index.js.map +1 -0
  69. package/dist/machine-CdIcN2Xm.d.ts +1773 -0
  70. package/dist/machine-viz/index.d.ts +1 -1
  71. package/dist/machine-viz/index.js +12 -5
  72. package/dist/machine-viz/index.js.map +1 -1
  73. package/dist/mem/index.d.ts +18 -3
  74. package/dist/mem/index.js +22 -2
  75. package/dist/mem/index.js.map +1 -1
  76. package/dist/node/index.d.ts +104 -6
  77. package/dist/node/index.js +132 -9
  78. package/dist/node/index.js.map +1 -1
  79. package/dist/{paginator → paginate}/index.d.ts +151 -6
  80. package/dist/paginate/index.js +7 -0
  81. package/dist/parity/index.d.ts +4 -10
  82. package/dist/parity/index.js +4 -7
  83. package/dist/parity/index.js.map +1 -1
  84. package/dist/pbt/index.d.ts +247 -5
  85. package/dist/pbt/index.js +124 -5
  86. package/dist/pbt/index.js.map +1 -1
  87. package/dist/{trace-replay → persistence}/index.d.ts +7 -5
  88. package/dist/persistence/index.js +6 -0
  89. package/dist/react/index.d.ts +2 -2
  90. package/dist/react/index.js +1 -2
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/resilience/index.d.ts +743 -0
  93. package/dist/resilience/index.js +657 -0
  94. package/dist/resilience/index.js.map +1 -0
  95. package/dist/retry-backoff/index.d.ts +3 -2
  96. package/dist/retry-backoff/index.js +1 -1
  97. package/dist/runtime-types-LWDoi943.d.ts +998 -0
  98. package/dist/testing/index.d.ts +2 -2
  99. package/dist/testing/index.js +1 -2
  100. package/dist/testing/index.js.map +1 -1
  101. package/dist/{throttled-input → timing}/index.d.ts +143 -12
  102. package/dist/{throttled-input → timing}/index.js +57 -12
  103. package/dist/timing/index.js.map +1 -0
  104. package/dist/{types-XS_miRnB.d.ts → types-DP3f5NIl.d.ts} +1 -1
  105. package/dist/work-queue/index.d.ts +130 -54
  106. package/dist/work-queue/index.js +3 -2
  107. package/dist/work-queue/index.js.map +1 -1
  108. package/package.json +45 -218
  109. package/dist/authed-call/index.d.ts +0 -120
  110. package/dist/authed-call/index.js +0 -134
  111. package/dist/authed-call/index.js.map +0 -1
  112. package/dist/await-terminal/index.d.ts +0 -101
  113. package/dist/await-terminal/index.js +0 -76
  114. package/dist/await-terminal/index.js.map +0 -1
  115. package/dist/batch-window/index.js.map +0 -1
  116. package/dist/cache/index.d.ts +0 -152
  117. package/dist/cache/index.js +0 -8
  118. package/dist/chart/index.d.ts +0 -218
  119. package/dist/chart/index.js +0 -16
  120. package/dist/chart/index.js.map +0 -1
  121. package/dist/chart/inspect/index.d.ts +0 -86
  122. package/dist/chart/inspect/index.js +0 -5
  123. package/dist/chart/inspect/react.d.ts +0 -113
  124. package/dist/chart/inspect/react.js +0 -11
  125. package/dist/chart/inspect/react.js.map +0 -1
  126. package/dist/chart/inspect/styles.css +0 -286
  127. package/dist/chart/lane/index.d.ts +0 -362
  128. package/dist/chart/lane/index.js +0 -9
  129. package/dist/chart/lane/index.js.map +0 -1
  130. package/dist/chart/lane/react.d.ts +0 -84
  131. package/dist/chart/lane/react.js +0 -559
  132. package/dist/chart/lane/react.js.map +0 -1
  133. package/dist/chart/lane/server.d.ts +0 -148
  134. package/dist/chart/lane/server.js +0 -209
  135. package/dist/chart/lane/server.js.map +0 -1
  136. package/dist/chart/lane/styles.css +0 -498
  137. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
  138. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
  139. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
  140. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
  141. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
  142. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
  143. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
  144. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
  145. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
  146. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
  147. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
  148. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
  149. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
  150. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
  151. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
  152. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
  153. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
  154. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
  155. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
  156. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
  157. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
  158. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
  159. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
  160. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
  161. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
  162. package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
  163. package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
  164. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
  165. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
  166. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
  167. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
  168. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
  169. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
  170. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
  171. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
  172. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
  173. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
  174. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
  175. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
  176. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
  177. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
  178. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
  179. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
  180. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
  181. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
  182. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
  183. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
  184. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
  185. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
  186. package/dist/chart/lane/viewer/index.html +0 -15
  187. package/dist/chart/report/index.d.ts +0 -117
  188. package/dist/chart/report/index.js +0 -32
  189. package/dist/chart/report/index.js.map +0 -1
  190. package/dist/chunk-2YFLOCWX.js +0 -15
  191. package/dist/chunk-2YFLOCWX.js.map +0 -1
  192. package/dist/chunk-3I52QZZ5.js +0 -519
  193. package/dist/chunk-3I52QZZ5.js.map +0 -1
  194. package/dist/chunk-3ZAFFRRB.js +0 -457
  195. package/dist/chunk-3ZAFFRRB.js.map +0 -1
  196. package/dist/chunk-4EQZ76JC.js +0 -33
  197. package/dist/chunk-4EQZ76JC.js.map +0 -1
  198. package/dist/chunk-4KLG43GY.js +0 -223
  199. package/dist/chunk-4KLG43GY.js.map +0 -1
  200. package/dist/chunk-7FRZ2CT2.js +0 -424
  201. package/dist/chunk-7FRZ2CT2.js.map +0 -1
  202. package/dist/chunk-AZZLE7XR.js +0 -62
  203. package/dist/chunk-AZZLE7XR.js.map +0 -1
  204. package/dist/chunk-BYQUGDD3.js +0 -16
  205. package/dist/chunk-BYQUGDD3.js.map +0 -1
  206. package/dist/chunk-CIQG5L42.js +0 -685
  207. package/dist/chunk-CIQG5L42.js.map +0 -1
  208. package/dist/chunk-CLM6ERNO.js +0 -61
  209. package/dist/chunk-CLM6ERNO.js.map +0 -1
  210. package/dist/chunk-COS5MSTO.js +0 -88
  211. package/dist/chunk-COS5MSTO.js.map +0 -1
  212. package/dist/chunk-CRPZJVD2.js +0 -71
  213. package/dist/chunk-CRPZJVD2.js.map +0 -1
  214. package/dist/chunk-D62FDQKE.js +0 -53
  215. package/dist/chunk-D62FDQKE.js.map +0 -1
  216. package/dist/chunk-D736QUGF.js.map +0 -1
  217. package/dist/chunk-DGE4PV4A.js +0 -26
  218. package/dist/chunk-DGE4PV4A.js.map +0 -1
  219. package/dist/chunk-DMYGQB4O.js.map +0 -1
  220. package/dist/chunk-EWJP3YYP.js.map +0 -1
  221. package/dist/chunk-FV3Z5MBE.js.map +0 -1
  222. package/dist/chunk-HCEVHFJ7.js +0 -54
  223. package/dist/chunk-HCEVHFJ7.js.map +0 -1
  224. package/dist/chunk-J6527VRQ.js.map +0 -1
  225. package/dist/chunk-JELSZN25.js +0 -47
  226. package/dist/chunk-JELSZN25.js.map +0 -1
  227. package/dist/chunk-K575PT4S.js.map +0 -1
  228. package/dist/chunk-L57ZOT5K.js +0 -184
  229. package/dist/chunk-L57ZOT5K.js.map +0 -1
  230. package/dist/chunk-MU6MCIAC.js +0 -15
  231. package/dist/chunk-MU6MCIAC.js.map +0 -1
  232. package/dist/chunk-MUUROGIH.js.map +0 -1
  233. package/dist/chunk-NR7BU22N.js +0 -758
  234. package/dist/chunk-NR7BU22N.js.map +0 -1
  235. package/dist/chunk-O4MVQTEJ.js.map +0 -1
  236. package/dist/chunk-OOYD44JI.js +0 -317
  237. package/dist/chunk-OOYD44JI.js.map +0 -1
  238. package/dist/chunk-Q2UM7BXU.js.map +0 -1
  239. package/dist/chunk-RH5EFRVJ.js.map +0 -1
  240. package/dist/chunk-S2EGRPCM.js +0 -47
  241. package/dist/chunk-S2EGRPCM.js.map +0 -1
  242. package/dist/chunk-SINXE47Y.js +0 -55
  243. package/dist/chunk-SINXE47Y.js.map +0 -1
  244. package/dist/chunk-UF4MZSLT.js +0 -53
  245. package/dist/chunk-UF4MZSLT.js.map +0 -1
  246. package/dist/chunk-UOC2PL46.js +0 -13
  247. package/dist/chunk-UOC2PL46.js.map +0 -1
  248. package/dist/chunk-VYFAZN3F.js +0 -372
  249. package/dist/chunk-VYFAZN3F.js.map +0 -1
  250. package/dist/chunk-WRAA7GVZ.js +0 -209
  251. package/dist/chunk-WRAA7GVZ.js.map +0 -1
  252. package/dist/chunk-XGELA764.js +0 -163
  253. package/dist/chunk-XGELA764.js.map +0 -1
  254. package/dist/chunk-YUXP55T2.js.map +0 -1
  255. package/dist/chunk-YWIKDKHY.js +0 -307
  256. package/dist/chunk-YWIKDKHY.js.map +0 -1
  257. package/dist/chunk-ZJ5AOYBH.js +0 -8
  258. package/dist/chunk-ZJ5AOYBH.js.map +0 -1
  259. package/dist/chunk-ZSUUOEPL.js +0 -731
  260. package/dist/chunk-ZSUUOEPL.js.map +0 -1
  261. package/dist/chunk-ZVJZ72HY.js.map +0 -1
  262. package/dist/circuit-breaker/index.d.ts +0 -197
  263. package/dist/circuit-breaker/index.js +0 -3
  264. package/dist/circuit-breaker/index.js.map +0 -1
  265. package/dist/deadline/index.js +0 -6
  266. package/dist/deadline/index.js.map +0 -1
  267. package/dist/debounce/index.js +0 -3
  268. package/dist/debounce/index.js.map +0 -1
  269. package/dist/extension/react.d.ts +0 -121
  270. package/dist/extension/react.js +0 -75
  271. package/dist/extension/react.js.map +0 -1
  272. package/dist/extension/subs/index.d.ts +0 -45
  273. package/dist/extension/subs/index.js +0 -80
  274. package/dist/extension/subs/index.js.map +0 -1
  275. package/dist/extension/test-utils.d.ts +0 -128
  276. package/dist/extension/test-utils.js +0 -277
  277. package/dist/extension/test-utils.js.map +0 -1
  278. package/dist/fan-out/index.js +0 -5
  279. package/dist/fan-out/index.js.map +0 -1
  280. package/dist/fold-BJPdjc9w.d.ts +0 -435
  281. package/dist/graph-B3L5e0N1.d.ts +0 -923
  282. package/dist/idempotency/adapter.d.ts +0 -62
  283. package/dist/idempotency/adapter.js +0 -4
  284. package/dist/idempotency/adapter.js.map +0 -1
  285. package/dist/idempotent-intake/index.d.ts +0 -188
  286. package/dist/idempotent-intake/index.js +0 -7
  287. package/dist/idempotent-intake/index.js.map +0 -1
  288. package/dist/journal/index.d.ts +0 -373
  289. package/dist/journal/index.js +0 -3
  290. package/dist/journal/index.js.map +0 -1
  291. package/dist/llm-call/index.d.ts +0 -311
  292. package/dist/llm-call/index.js +0 -16
  293. package/dist/llm-call/index.js.map +0 -1
  294. package/dist/machine-BtFWQmmq.d.ts +0 -804
  295. package/dist/monitored-run/index.js +0 -10
  296. package/dist/monitored-run/index.js.map +0 -1
  297. package/dist/paginated-walk/index.d.ts +0 -235
  298. package/dist/paginated-walk/index.js +0 -16
  299. package/dist/paginated-walk/index.js.map +0 -1
  300. package/dist/paginator/index.js +0 -3
  301. package/dist/paginator/index.js.map +0 -1
  302. package/dist/pbt/arbitraries/index.d.ts +0 -136
  303. package/dist/pbt/arbitraries/index.js +0 -3
  304. package/dist/pbt/arbitraries/index.js.map +0 -1
  305. package/dist/pbt/runners/index.d.ts +0 -118
  306. package/dist/pbt/runners/index.js +0 -5
  307. package/dist/pbt/runners/index.js.map +0 -1
  308. package/dist/poller/index.d.ts +0 -352
  309. package/dist/poller/index.js +0 -115
  310. package/dist/poller/index.js.map +0 -1
  311. package/dist/prediction/index.d.ts +0 -131
  312. package/dist/prediction/index.js +0 -4
  313. package/dist/prediction/index.js.map +0 -1
  314. package/dist/protocol-B5YmJr0d.d.ts +0 -45
  315. package/dist/pure/index.d.ts +0 -3
  316. package/dist/pure/index.js +0 -4
  317. package/dist/pure/index.js.map +0 -1
  318. package/dist/rate-limit/index.d.ts +0 -115
  319. package/dist/rate-limit/index.js +0 -3
  320. package/dist/rate-limit/index.js.map +0 -1
  321. package/dist/reconciler/index.d.ts +0 -193
  322. package/dist/reconciler/index.js +0 -164
  323. package/dist/reconciler/index.js.map +0 -1
  324. package/dist/recorder/index.js +0 -3
  325. package/dist/recorder/index.js.map +0 -1
  326. package/dist/reducer-4GNR6b8B.d.ts +0 -447
  327. package/dist/resilient-call/index.d.ts +0 -320
  328. package/dist/resilient-call/index.js +0 -14
  329. package/dist/resilient-call/index.js.map +0 -1
  330. package/dist/retry-to-success/index.d.ts +0 -109
  331. package/dist/retry-to-success/index.js +0 -37
  332. package/dist/retry-to-success/index.js.map +0 -1
  333. package/dist/run-pAcmBpah.d.ts +0 -713
  334. package/dist/runtime-types-CNLmhWif.d.ts +0 -517
  335. package/dist/saga/index.d.ts +0 -241
  336. package/dist/saga/index.js +0 -150
  337. package/dist/saga/index.js.map +0 -1
  338. package/dist/samples-B3My5oh2.d.ts +0 -59
  339. package/dist/snapshot/index.js +0 -5
  340. package/dist/snapshot/index.js.map +0 -1
  341. package/dist/subs/index.d.ts +0 -472
  342. package/dist/subs/index.js +0 -7
  343. package/dist/subs/index.js.map +0 -1
  344. package/dist/throttle/index.d.ts +0 -134
  345. package/dist/throttle/index.js +0 -3
  346. package/dist/throttle/index.js.map +0 -1
  347. package/dist/throttled-input/index.js.map +0 -1
  348. package/dist/token-refresh/index.d.ts +0 -216
  349. package/dist/token-refresh/index.js +0 -6
  350. package/dist/token-refresh/index.js.map +0 -1
  351. package/dist/trace-replay/index.js +0 -6
  352. package/dist/trace-replay/index.js.map +0 -1
  353. package/dist/with-deadline/index.d.ts +0 -197
  354. package/dist/with-deadline/index.js +0 -111
  355. package/dist/with-deadline/index.js.map +0 -1
  356. package/dist/with-resilience/index.d.ts +0 -225
  357. package/dist/with-resilience/index.js +0 -240
  358. package/dist/with-resilience/index.js.map +0 -1
  359. package/dist/with-telemetry/index.d.ts +0 -150
  360. package/dist/with-telemetry/index.js +0 -70
  361. package/dist/with-telemetry/index.js.map +0 -1
  362. package/dist/work-queue/adapter.d.ts +0 -84
  363. package/dist/work-queue/adapter.js +0 -4
  364. package/dist/work-queue/adapter.js.map +0 -1
  365. package/dist/work-queue/ops.d.ts +0 -71
  366. package/dist/work-queue/ops.js +0 -3
  367. package/dist/work-queue/ops.js.map +0 -1
  368. package/dist/workflow/index.d.ts +0 -485
  369. package/dist/workflow/index.js +0 -244
  370. package/dist/workflow/index.js.map +0 -1
  371. /package/dist/{cache → paginate}/index.js.map +0 -0
  372. /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export { DispatchDiscardedError, DisposeTimeoutNotice, IdentityDropNotice, PortNameCollisionError, QuiescenceTimeoutError, RuntimeDiscardNotice, RuntimeDiscardedError, SubIdCollisionError, __resetPortRegistry, absurd, asReducer, defineMachine, definePort, historyTracker, noop, replay, run, schemaMigrate, settle, tryApplyCell, tryFoldMsgs, tryInterpret, wrapDetached } from './chunk-ZSUUOEPL.js';
2
- export { Cmd, NoCellError, acceptsOf, applyCell, applyCellChecked, describeMachine, detectUpdateForm, foldMsgs, foldUpdates, formOf, msgKeysOf, structuralHash, subId } from './chunk-OOYD44JI.js';
1
+ export { Cmd, DispatchDiscardedError, DisposeTimeoutNotice, DriveFailedError, DriveStalledError, IdentityDropNotice, NO_ACK, NoCellError, PortNameCollisionError, ProvideFailedError, ProviderCycleError, QuiescenceTimeoutError, RuntimeDiscardNotice, RuntimeDiscardedError, StoreConflictError, SubIdCollisionError, UnknownProviderError, __resetPortRegistry, absurd, acceptedTypes, acceptsOf, ack, applyCell, applyCellChecked, asReducer, combineManagedResources, defineListener, defineMachine, defineManagedResource, definePort, dep, describeMachine, detectUpdateForm, driveToDone, foldMsgs, foldUpdates, formOf, fromBroadcastChannel, fromEventSource, fromEventTarget, fromInterval, fromPort, fromReconnectingWebSocket, fromTimeout, fromTransport, fromWebSocket, historyTracker, initAck, isFencedStore, isProvided, layer, msgKeysOf, nextSeq, noop, partitionByAck, provide, reconcile, replay, run, schemaMigrate, settle, structuralHash, subId, tagSeq, tryApplyCell, tryFoldMsgs, tryInterpret, value, wrapDetached } from './chunk-RQULHGYH.js';
3
2
  //# sourceMappingURL=index.js.map
4
3
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,634 @@
1
+ import { b as CmdDef, C as Cmd } from '../core-CTzMJ82M.js';
2
+ import { RetryPolicy } from '../retry-backoff/index.js';
3
+ import { R as RunCmd, F as FailMsg, S as SucceedMsg, a as ResilientState } from '../index-B5BZ-_cT.js';
4
+ import { a as DeadlineSub, D as DeadlineExceeded, T as TtlCache, C as CacheEvictionSub, c as CacheEvictMsg } from '../index-q0hXFeZ0.js';
5
+ export { b as deadlineSub, s as subscribeDeadline } from '../index-q0hXFeZ0.js';
6
+ import { S as SubscribeHandler } from '../types-DP3f5NIl.js';
7
+ import { B as BatchWindow, a as BatchWindowSub } from '../index-4vZzljCD.js';
8
+ import { F as FanOutState } from '../index-6A7dB8f6.js';
9
+ import 'zod';
10
+ import '../index-DJWIER_3.js';
11
+ import '../runtime-types-LWDoi943.js';
12
+ import 'better-result';
13
+
14
+ /**
15
+ * @packageDocumentation
16
+ * internal/jev/protocol — the wire contract of TypeSafe **Jev** (System One)
17
+ * as types plus two pure functions, and nothing that performs I/O. Internal
18
+ * since #216 — not published on any subpath; the `ask` child that opens the
19
+ * socket imports it from here.
20
+ *
21
+ * The contract is transcribed from `https://docs.typesafe.ai/api`, re-verified
22
+ * 2026-09-21: `POST https://api.typesafe.ai/v1/systemone`, `Authorization:
23
+ * Bearer <API_KEY>`, request `{ state, model, questions }`, response
24
+ * `{ model, answers, usage }`. Where this module and that page disagree, the
25
+ * page is right and this module is a bug.
26
+ *
27
+ * ## What this module is for
28
+ *
29
+ * A Jev call is a map of questions you name, and an answer comes back under
30
+ * each name. That is a shape TypeScript can hold onto, and the whole point of
31
+ * typing it here is that a **choice** question's `criteria` keys ARE its
32
+ * answer's `choice` domain — write the rubric once and the narrowing is free
33
+ * at the call site:
34
+ *
35
+ * ```ts
36
+ * const qs = jevQuestions({
37
+ * category: {
38
+ * type: "choice",
39
+ * instructions: "Which budget line is this?",
40
+ * criteria: { groceries: "Supermarkets", dining: "Restaurants" },
41
+ * },
42
+ * });
43
+ * // parsed.answers.category.choice : "groceries" | "dining"
44
+ * ```
45
+ *
46
+ * `jevQuestions` is an identity function with a `const` type parameter; it
47
+ * exists so the literal keys survive inference without every call site
48
+ * spelling `as const`. `JevAnswers<Q>` is the mapped type that turns such a
49
+ * questions map into its answers map.
50
+ *
51
+ * ## Why parsing is a pure function returning data
52
+ *
53
+ * `parseAnswers` never throws — a response that disagrees with the questions
54
+ * that produced it is a recoverable failure with an obvious next move (retry,
55
+ * re-prompt, give up on this one item), so it is DATA: a closed `JevErr`
56
+ * union of `{ _tag }` values that survives a JSON round-trip into Model
57
+ * (ADR 0011). The type-level guarantee above is a *claim about the wire*, and
58
+ * `parseAnswers` is the one place that claim is checked against a body the
59
+ * network actually produced. Every `unknown` reaches a `JevErr`; nothing
60
+ * reaches a `throw`.
61
+ *
62
+ * Both halves of a choice question's claim are checked, because both are cast
63
+ * away at the tail of `parseAnswers`: `choice` must be one of the criteria
64
+ * keys, and `probabilities` must be keyed by EXACTLY those keys — none
65
+ * missing, none extra. A partial distribution typed `Record<K, number>` is the
66
+ * representable-invalid state this module exists to refuse, and it arrives
67
+ * through this gate or not at all.
68
+ *
69
+ * ## Why status classification lives here and not in `ask`
70
+ *
71
+ * "429 and 529 back off, everything else non-2xx is terminal" is a fact about
72
+ * the protocol, published in the same reference page as the body shapes, and
73
+ * `ask` re-deriving it is how the retry policy and the wire contract drift
74
+ * apart. `classifyStatus` is the single reading.
75
+ *
76
+ * ## Bounds the API enforces and this module does not
77
+ *
78
+ * A Choice takes at most 255 options and a Score takes at most 10 levels.
79
+ * `JevScoreQuestion` encodes the *lower* bound — a Score with fewer than two
80
+ * levels does not compile — because a two-element minimum is a tuple, which
81
+ * costs nothing. The upper bounds are not encoded: spelling them as a union
82
+ * of nine tuple arities (or 255 of them) buys a compile error in place of a
83
+ * `422`, at the price of unreadable diagnostics on every ordinary Score. They
84
+ * are the API's `422`, which `classifyStatus` already calls terminal.
85
+ */
86
+ /**
87
+ * What every `instructions` and every criterion description accepts.
88
+ *
89
+ * The reference page allows a string, an object, or an array in all three
90
+ * slots: a long question carrying data it refers to is written as an object
91
+ * with the question in one field and the data in the others. Typing it as
92
+ * `string` alone would reject the documented structured form.
93
+ */
94
+ type JevText = string | Readonly<Record<string, unknown>> | readonly unknown[];
95
+ /** The three question types, as the `type` discriminant spells them. */
96
+ type JevQuestionType = "choice" | "score" | "noul";
97
+ /**
98
+ * A choice question's rubric: option key → description, or `null` where an
99
+ * option needs no extra detail. The keys are the answer's `choice` domain.
100
+ */
101
+ type JevChoiceCriteria = Readonly<Record<string, JevText | null>>;
102
+ /** Pick one option from a set you define. */
103
+ interface JevChoiceQuestion<C extends JevChoiceCriteria = JevChoiceCriteria> {
104
+ readonly type: "choice";
105
+ readonly instructions: JevText;
106
+ readonly criteria: C;
107
+ }
108
+ /**
109
+ * A score question's rubric: an ORDERED list of level descriptions, at least
110
+ * two of them. The API accepts up to ten.
111
+ */
112
+ type JevScoreCriteria = readonly [JevText, JevText, ...JevText[]];
113
+ /** Rate the state along an ordered rubric. */
114
+ interface JevScoreQuestion {
115
+ readonly type: "score";
116
+ readonly instructions: JevText;
117
+ readonly criteria: JevScoreCriteria;
118
+ }
119
+ /** A yes/no question. `criteria` is optional; both arms are required when it is present. */
120
+ interface JevNoulQuestion {
121
+ readonly type: "noul";
122
+ readonly instructions: JevText;
123
+ readonly criteria?: {
124
+ readonly true: JevText;
125
+ readonly false: JevText;
126
+ };
127
+ }
128
+ /** One typed question. */
129
+ type JevQuestion = JevChoiceQuestion | JevScoreQuestion | JevNoulQuestion;
130
+ /** The `questions` map: an id you choose → the question asked under it. */
131
+ type JevQuestionMap = Readonly<Record<string, JevQuestion>>;
132
+ /**
133
+ * Identity, with the literal keys kept.
134
+ *
135
+ * The `const` type parameter is the whole function: it preserves each choice
136
+ * question's `criteria` keys as literals, so `JevAnswers<typeof qs>` can name
137
+ * them. Without it the inferred type is `Record<string, string>` and the
138
+ * narrowing this module exists for is gone before `parseAnswers` is reached.
139
+ */
140
+ declare const jevQuestions: <const Q extends JevQuestionMap>(questions: Q) => Q;
141
+ /** The evaluation endpoint. */
142
+ declare const JEV_ENDPOINT: "https://api.typesafe.ai/v1/systemone";
143
+ /** The content to evaluate: text, or structured data. */
144
+ type JevState = string | Readonly<Record<string, unknown>> | readonly unknown[];
145
+ /** The request body of `POST /v1/systemone`. */
146
+ interface JevRequest<Q extends JevQuestionMap = JevQuestionMap> {
147
+ readonly state: JevState;
148
+ readonly model: string;
149
+ readonly questions: Q;
150
+ }
151
+ /** The yes/no answer, on a scale from 0 (no) to 1 (yes). */
152
+ interface JevNoulAnswer {
153
+ readonly type: "noul";
154
+ readonly noul: number;
155
+ }
156
+ /**
157
+ * The chosen option and the full distribution over the options.
158
+ *
159
+ * `K` is the choice question's own criteria keys, which is why `choice` is a
160
+ * union rather than a `string` and `probabilities` is total over the options.
161
+ */
162
+ interface JevChoiceAnswer<K extends string = string> {
163
+ readonly type: "choice";
164
+ readonly choice: K;
165
+ readonly probabilities: Readonly<Record<K, number>>;
166
+ readonly confidence: number;
167
+ }
168
+ /**
169
+ * The probability-weighted value across the levels — it can land BETWEEN
170
+ * levels, which is why `score` is a `number` and not an index. `legend` and
171
+ * `probabilities` are keyed by the level index as a string.
172
+ */
173
+ interface JevScoreAnswer {
174
+ readonly type: "score";
175
+ readonly score: number;
176
+ readonly legend: Readonly<Record<string, string>>;
177
+ readonly probabilities: Readonly<Record<string, number>>;
178
+ readonly confidence: number;
179
+ }
180
+ /** One typed answer. */
181
+ type JevAnswer = JevChoiceAnswer | JevScoreAnswer | JevNoulAnswer;
182
+ /** The answer a given question type yields, with the choice union carried through. */
183
+ type JevAnswerFor<Q> = Q extends {
184
+ readonly type: "choice";
185
+ readonly criteria: infer C;
186
+ } ? JevChoiceAnswer<Extract<keyof C, string>> : Q extends {
187
+ readonly type: "score";
188
+ } ? JevScoreAnswer : Q extends {
189
+ readonly type: "noul";
190
+ } ? JevNoulAnswer : never;
191
+ /** A questions map turned into its answers map, id for id. */
192
+ type JevAnswers<Q extends JevQuestionMap> = {
193
+ readonly [K in keyof Q]: JevAnswerFor<Q[K]>;
194
+ };
195
+ /** Token usage for the request. */
196
+ interface JevUsage {
197
+ readonly input_tokens: number;
198
+ readonly output_tokens: number;
199
+ }
200
+ /** The response body of `POST /v1/systemone`. */
201
+ interface JevResponse<Q extends JevQuestionMap = JevQuestionMap> {
202
+ readonly model: string;
203
+ readonly answers: JevAnswers<Q>;
204
+ readonly usage: JevUsage;
205
+ }
206
+ /**
207
+ * Every way a response can fail to be the answers to the questions asked.
208
+ *
209
+ * Closed, `{ _tag }`-discriminated, JSON-round-trippable: a consumer folds one
210
+ * of these into Model and routes on `_tag` (ADR 0011). `path` and `id` say
211
+ * WHERE, so a failure names the question it is about rather than the whole
212
+ * call.
213
+ */
214
+ type JevErr =
215
+ /** The envelope is not a Jev response at all — not an object, or `model` /
216
+ * `answers` / `usage` missing or of the wrong shape. */
217
+ {
218
+ readonly _tag: "malformed_body";
219
+ readonly reason: string;
220
+ }
221
+ /** A question id in the request has no answer under it in the response. */
222
+ | {
223
+ readonly _tag: "missing_answer";
224
+ readonly id: string;
225
+ }
226
+ /** An answer arrived, but its `type` is not its question's. */
227
+ | {
228
+ readonly _tag: "answer_type_mismatch";
229
+ readonly id: string;
230
+ readonly expected: JevQuestionType;
231
+ readonly received: string;
232
+ }
233
+ /** A choice answer picked something that is not one of its criteria keys. */
234
+ | {
235
+ readonly _tag: "off_criteria_choice";
236
+ readonly id: string;
237
+ readonly choice: string;
238
+ readonly options: readonly string[];
239
+ }
240
+ /** A choice answer's `probabilities` keys are not exactly its question's
241
+ * criteria keys. `JevChoiceAnswer<K>` types that map as TOTAL over `K`, so
242
+ * a partial or off-criteria one is the representable-invalid state this
243
+ * module exists to refuse. `missing` and `extra` say which way it failed. */
244
+ | {
245
+ readonly _tag: "off_criteria_probabilities";
246
+ readonly id: string;
247
+ readonly missing: readonly string[];
248
+ readonly extra: readonly string[];
249
+ readonly options: readonly string[];
250
+ }
251
+ /** The answer's `type` is right and its payload is not — a missing
252
+ * `confidence`, a `probabilities` that is not a number map, and so on. */
253
+ | {
254
+ readonly _tag: "malformed_answer";
255
+ readonly id: string;
256
+ readonly reason: string;
257
+ };
258
+ /**
259
+ * Is `value` a {@link JevErr}?
260
+ *
261
+ * The discriminant is the `_tag` VALUE against the closed set above, never the
262
+ * bare presence of the key. A `JevAnswers` map is keyed by the caller's own
263
+ * question ids, so a caller may legally name a question `_tag` — and then
264
+ * `"_tag" in answers` is `true`. The value under it is an ANSWER, which is
265
+ * always an object and never one of these string literals, so reading the
266
+ * value is the one test a caller's id space cannot reach.
267
+ */
268
+ declare function isJevErr(value: object): value is JevErr;
269
+ /** What `parseAnswers` returns: typed answers, or one `JevErr`. Never a throw. */
270
+ type JevParse<Q extends JevQuestionMap> = {
271
+ readonly ok: true;
272
+ readonly answers: JevAnswers<Q>;
273
+ readonly model: string;
274
+ readonly usage: JevUsage;
275
+ } | {
276
+ readonly ok: false;
277
+ readonly error: JevErr;
278
+ };
279
+ /**
280
+ * Turn an `unknown` response body into the typed answers for `questions`, or
281
+ * into one `JevErr`. Pure, total, and never throwing on any input.
282
+ *
283
+ * The walk is question-driven, not body-driven: every id the request asked
284
+ * about must be answered, and each answer is checked against ITS question's
285
+ * type and — for a choice — against that question's own criteria keys, both as
286
+ * the `choice` picked and as the exact key set of `probabilities`. An
287
+ * answer under an id nobody asked about is ignored rather than refused; the
288
+ * questions are the contract, and a wider response still satisfies it.
289
+ */
290
+ declare const parseAnswers: <Q extends JevQuestionMap>(questions: Q, body: unknown) => JevParse<Q>;
291
+ /**
292
+ * What a caller does next with an HTTP status.
293
+ *
294
+ * `retry` means back off and send it again; `terminal` means this request will
295
+ * never succeed as written. `ok` is the 2xx arm — naming it keeps the function
296
+ * total, so `ask` switches on three cases instead of testing 2xx itself and
297
+ * then asking here.
298
+ */
299
+ type JevHttpStatus = "ok" | "retry" | "terminal";
300
+ /**
301
+ * Classify one HTTP status, per the reference page's error table.
302
+ *
303
+ * 429 (rate limited) and 529 (overloaded) are the two the page tells you to
304
+ * back off on. 401 (bad key) and 422 (the body failed validation) will fail
305
+ * identically forever. Every other non-2xx is terminal by default: an
306
+ * unrecognized failure is not evidence that retrying helps, and a retry loop
307
+ * over one is the expensive way to find that out.
308
+ */
309
+ declare const classifyStatus: (status: number) => JevHttpStatus;
310
+
311
+ /**
312
+ * The injected HTTP caller — the one seam that touches the network.
313
+ *
314
+ * It returns the status and the undecoded body rather than throwing on a
315
+ * non-2xx, because WHICH non-2xx it is decides whether the call backs off, and
316
+ * a thrown adapter error has already lost that. `signal` is optional so a
317
+ * `fetch` adapter can be cancelled; resilient-call issues no signal today, and
318
+ * the slot exists so an adapter's own shape does not have to change when it
319
+ * does.
320
+ *
321
+ * A `fetch` adapter and a scripted test fake satisfy this identically, which is
322
+ * the whole reason the key lives in the adapter's closure and never in config.
323
+ */
324
+ type JevPort<Q extends JevQuestionMap = JevQuestionMap> = (request: JevRequest<Q>, signal?: AbortSignal) => Promise<{
325
+ readonly status: number;
326
+ readonly body: unknown;
327
+ }>;
328
+ /**
329
+ * The pure decider that answers when the network cannot.
330
+ *
331
+ * Called on exactly two paths: `port` is absent (the no-key case), and the
332
+ * resilient retry budget is spent. It must be a pure function of the request —
333
+ * the exhaustion path runs it inside the `fail` VERB, which replay re-runs, so
334
+ * a clock read or an I/O call here would make the machine unreplayable.
335
+ * Returning a {@link JevErr} is how a fallback says "I have no answer for
336
+ * this one"; the call then settles as that error.
337
+ */
338
+ type JevFallback<Q extends JevQuestionMap> = (request: JevRequest<Q>) => JevAnswers<Q> | JevErr;
339
+ /**
340
+ * Every way an ask can fail, as DATA.
341
+ *
342
+ * A superset of the protocol child's {@link JevErr}: a parse failure is
343
+ * reported with the protocol's own tag untouched, and the three tags below are
344
+ * the ones only a caller can observe. `{_tag}`-discriminated and
345
+ * JSON-round-trippable like the rest (ADR 0011), because it is carried on the
346
+ * settle Msg and stored in the slice's `failed` phase.
347
+ *
348
+ * `http_retry` and `port_threw` are the TRANSIENT pair — {@link isTransientJevAskErr}
349
+ * is the single reading, and `fail` backs off on exactly those two.
350
+ */
351
+ type JevAskErr = JevErr
352
+ /** 429 / 529 — the statuses `classifyStatus` says to back off on. */
353
+ | {
354
+ readonly _tag: "http_retry";
355
+ readonly status: number;
356
+ }
357
+ /** 401 / 422 / any other non-2xx — this request fails identically forever. */
358
+ | {
359
+ readonly _tag: "http_terminal";
360
+ readonly status: number;
361
+ }
362
+ /** The port itself rejected (a socket error, a DNS failure) — transient. */
363
+ | {
364
+ readonly _tag: "port_threw";
365
+ readonly reason: string;
366
+ }
367
+ /** No `port` and no `fallback`: the knob was configured with no way to answer. */
368
+ | {
369
+ readonly _tag: "no_answer_path";
370
+ };
371
+ /**
372
+ * Does this failure deserve another attempt?
373
+ *
374
+ * The one place the transient/terminal split is read. A rate limit and a dropped
375
+ * socket are the two failures a second attempt can clear; a 401, a 422 and every
376
+ * parse failure will reproduce exactly, so retrying one spends a real HTTP call
377
+ * to learn nothing.
378
+ */
379
+ declare function isTransientJevAskErr(error: JevAskErr): boolean;
380
+ /**
381
+ * The carrier that gets a {@link JevAskErr} out of the port and through
382
+ * resilient-call's throw seam intact.
383
+ *
384
+ * resilient-call routes a rejected port to a failure Msg carrying the raw
385
+ * thrown value, so throwing is the only way the handler can say "this attempt
386
+ * failed" — and a bare `Error` would arrive with its classification already
387
+ * lost. The typed payload rides on `jev`; the slice never stores this object
388
+ * (the verbs store `jev` itself), so nothing un-serializable reaches Model.
389
+ */
390
+ declare class JevAskFailure extends Error {
391
+ readonly jev: JevAskErr;
392
+ constructor(jev: JevAskErr);
393
+ }
394
+ /** The model the door asks for when config names none. */
395
+ declare const DEFAULT_JEV_MODEL = "jev-latest";
396
+ /**
397
+ * The jev-ask knob. `questions` is the load-bearing one: it is both the map
398
+ * sent on every request and the type that makes the answers narrow at the call
399
+ * site, so it belongs to the knob rather than to a call.
400
+ */
401
+ interface JevAskConfig<Q extends JevQuestionMap> {
402
+ /** The question map every request carries; its keys type the answers. */
403
+ readonly questions: Q;
404
+ /** DI port — the HTTP caller. Absent = the no-key case; `fallback` answers instead. */
405
+ readonly port?: JevPort<Q>;
406
+ /** The pure decider for the no-port and budget-spent paths. Absent → those settle as an error. */
407
+ readonly fallback?: JevFallback<Q>;
408
+ /** Backoff policy, composed into `../../resilience/resilient-call`. Omit → no backoff. */
409
+ readonly retry?: RetryPolicy;
410
+ /** The model id asked for. Defaults to {@link DEFAULT_JEV_MODEL}. */
411
+ readonly model?: string;
412
+ }
413
+ /**
414
+ * The settled answer carried on `resilient_ok`.
415
+ *
416
+ * `source` is not decoration: a fallback answer and a model answer are both
417
+ * valid answers with identical shape, and a host that routes on confidence — or
418
+ * bills on usage — has to be able to tell them apart. A fallback's `usage` is
419
+ * zero because nothing was spent.
420
+ */
421
+ interface JevOk<Q extends JevQuestionMap> {
422
+ /** The typed answers, one per question id. */
423
+ readonly answers: JevAnswers<Q>;
424
+ /** The model that answered, as the response reported it (or the requested one, for a fallback). */
425
+ readonly model: string;
426
+ /** Tokens spent. Zero on the fallback path. */
427
+ readonly usage: JevUsage;
428
+ /** Which path produced this answer. */
429
+ readonly source: "port" | "fallback";
430
+ }
431
+ /**
432
+ * The one effect this knob emits: run the ask for `key` with the plain-data
433
+ * {@link JevRequest} (ADR 0014 — a Cmd is DECLARED, so its input, ok and err
434
+ * channels are types on the constructor rather than a convention). It is
435
+ * resilient-call's `runCmdDef` specialized to this door's input and result, the
436
+ * same way `../../idempotency/idempotent-intake` mints its defs per knob: `Q` is
437
+ * a type parameter, so the def is a factory and not a module constant.
438
+ */
439
+ declare function jevAskCmdDef<Q extends JevQuestionMap>(): CmdDef<"resilient_run", {
440
+ readonly key: string;
441
+ readonly input: JevRequest<Q>;
442
+ }, JevOk<Q>, {
443
+ readonly [detail: string]: unknown;
444
+ readonly _tag: "deadline_exceeded";
445
+ } | {
446
+ readonly [detail: string]: unknown;
447
+ readonly _tag: "port_rejected";
448
+ }, unknown>;
449
+ /** The Cmd the verbs emit — `resilient_run` carrying the request. */
450
+ type JevAskCmd<Q extends JevQuestionMap> = RunCmd<JevRequest<Q>>;
451
+ /** The success settle Msg — resilient-call's, with `result` narrowed to {@link JevOk}. */
452
+ type JevSucceedMsg<Q extends JevQuestionMap> = SucceedMsg<JevOk<Q>>;
453
+ /** The failure settle Msg — resilient-call's, with `error` narrowed to {@link JevAskErr}. */
454
+ type JevFailMsg = Omit<FailMsg, "error"> & {
455
+ readonly error: JevAskErr;
456
+ };
457
+ /** The retry / deadline timer Msg — `DeadlineExceeded`, inherited. */
458
+ type JevTimerMsg = DeadlineExceeded;
459
+ /**
460
+ * Build a jev-ask knob from `config`. `rng` is injected for the inherited retry
461
+ * jitter (pass a fixed `() => 0` in tests to pin backoff; defaults to
462
+ * `Math.random`, read only at resilient-call's verb boundary).
463
+ *
464
+ * The slice and five of the six verbs are resilient-call's, forwarded. `fail` is
465
+ * the one composed verb — it reads the {@link JevAskErr} the handler typed and
466
+ * routes on it (see its docblock); it reimplements no backoff. `handlers` is the
467
+ * new piece: the port call, the status classification, the parse, and the
468
+ * enriched settle Msg.
469
+ */
470
+ declare function createJevAsk<Q extends JevQuestionMap>(config: JevAskConfig<Q>, rng?: () => number): {
471
+ init: () => ResilientState<JevRequest<Q>, JevOk<Q>>;
472
+ attempt: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, key: string, content: JevState, at: number) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q>[]];
473
+ succeed: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, key: string, msg: JevSucceedMsg<Q>) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q>[]];
474
+ fail: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, key: string, msg: JevFailMsg) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q>[]];
475
+ onTimer: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, msg: JevTimerMsg) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q>[]];
476
+ subs: (s: ResilientState<JevRequest<Q>, JevOk<Q>>) => readonly DeadlineSub[];
477
+ handlers: () => {
478
+ resilient_run: (cmd: JevAskCmd<Q>) => Promise<JevSucceedMsg<Q> | JevFailMsg>;
479
+ };
480
+ ask: (request: JevRequest<Q>, signal?: AbortSignal) => Promise<JevOk<Q>>;
481
+ };
482
+ /**
483
+ * The Cmd type a host machine declares in `types.cmd` when it splices a
484
+ * {@link createJevAsk} knob in — {@link JevAskCmd} under the name a `types`
485
+ * block reads well with. It is stated here so a host writes `cmd: {} as
486
+ * JevCmd<Questions>` rather than deriving it from the knob's shape, which is
487
+ * what `ReturnType<Ask["attempt"]>[1][number]` used to be doing at every call
488
+ * site: a spelling of the same type that breaks the moment `attempt`'s tuple
489
+ * changes, and that reads as machinery rather than as a name.
490
+ */
491
+ type JevCmd<Q extends JevQuestionMap> = JevAskCmd<Q>;
492
+ /**
493
+ * The Sub type a host machine declares in `types.sub` — the deadline Sub
494
+ * `subs` emits, inherited from resilient-call. Named here for the same reason
495
+ * as {@link JevCmd}: a host names the type, it does not re-derive it.
496
+ */
497
+ type JevSub = DeadlineSub;
498
+ /**
499
+ * Lift a knob result `[slice, cmds]` into a host `[State, cmds]` where the slice
500
+ * lives at `state.resilience` — resilient-call's convenience, re-typed for this
501
+ * door's slice so a consumer wires one import. Pure.
502
+ */
503
+ declare function liftJevAsk<S extends {
504
+ resilience: ResilientState<JevRequest<Q>, JevOk<Q>>;
505
+ }, Q extends JevQuestionMap, C extends Cmd>(state: S, result: readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly C[]]): readonly [S, readonly C[]];
506
+
507
+ /**
508
+ * The rubric every item is classified against: option key → description, or
509
+ * `null` where an option needs no extra detail. `C` is the option union, and it
510
+ * is what makes an answer's `choice` narrow at the call site.
511
+ */
512
+ type ClassifyCriteria<C extends string> = Readonly<Record<C, JevText | null>>;
513
+ /** The one `choice` question an item is asked. */
514
+ type ItemQuestion<C extends string> = JevChoiceQuestion<ClassifyCriteria<C>>;
515
+ /**
516
+ * The `questions` map of one batch: one {@link ItemQuestion} per item, keyed by
517
+ * `keyOf(item)`. This IS Jev's native batch form — the questions map is the
518
+ * fan-out over items, so nothing here wraps the items in an envelope of its own.
519
+ */
520
+ type ItemQuestions<C extends string> = Readonly<Record<string, ItemQuestion<C>>>;
521
+ /** The answer one item's question yields. */
522
+ type ItemAnswer<C extends string> = JevAnswerFor<ItemQuestion<C>>;
523
+ /**
524
+ * One flushed batch, as plain data: the items and the id fan-out addresses it
525
+ * by. `id` is a pure function of the batch's item keys (they are joined with a
526
+ * separator no sanitized key contains), which is what lets a settle Msg — whose
527
+ * `key` is that id — find its batch again after a rehydrate.
528
+ */
529
+ interface Batch<I> {
530
+ readonly id: string;
531
+ readonly items: readonly I[];
532
+ }
533
+ /** The Cmd a flushed batch becomes — `../ask`'s, carrying the native request. */
534
+ type ClassifyBatchCmd<C extends string> = JevAskCmd<ItemQuestions<C>>;
535
+ /** The success settle Msg — `../ask`'s, with the batch's answers. */
536
+ type ClassifyBatchOkMsg<C extends string> = JevSucceedMsg<ItemQuestions<C>>;
537
+ /** The failure settle Msg — `../ask`'s, with the typed {@link JevAskErr}. */
538
+ type ClassifyBatchErrMsg = JevFailMsg;
539
+ /** The default page size — the one the grill settled on for Jev. */
540
+ declare const DEFAULT_CLASSIFY_MAX_ITEMS = 25;
541
+ /** The knob. Every field is a policy this module refuses to invent. */
542
+ interface ClassifyBatchConfig<I, C extends string> {
543
+ /**
544
+ * The cache key and the question id of an item — e.g. a sanitized merchant
545
+ * string, so two transactions at the same shop share one answer. PURE.
546
+ */
547
+ readonly keyOf: (item: I) => string;
548
+ /** The rubric every item is classified against. Its keys are the answer domain. */
549
+ readonly criteria: ClassifyCriteria<C>;
550
+ /**
551
+ * The `instructions` for one item's question. Defaults to a template naming
552
+ * the item's key, which is what tells the model WHICH element of the request
553
+ * `state` the question is about.
554
+ */
555
+ readonly instructions?: (key: string, item: I) => JevText;
556
+ /** Size trigger, forwarded to the batch window. Defaults to {@link DEFAULT_CLASSIFY_MAX_ITEMS}. */
557
+ readonly maxItems?: number;
558
+ /** Latency ceiling in ms, forwarded to the batch window. */
559
+ readonly maxMs: number;
560
+ /** Max batches in flight, forwarded to fan-out. */
561
+ readonly concurrency: number;
562
+ /** How long a settled answer stays cached, forwarded to the TTL cache. */
563
+ readonly ttlMs: number;
564
+ /** Eviction tick for the TTL cache. Omit and no eviction Sub is declared. */
565
+ readonly evictEveryMs?: number;
566
+ /** The model asked for. Forwarded to `../ask`'s default when omitted. */
567
+ readonly model?: string;
568
+ /** DI port — the HTTP caller. Forwarded to `../ask`; absent is the no-key case. */
569
+ readonly port?: JevPort<ItemQuestions<C>>;
570
+ /** The pure decider for the no-port path. Forwarded to `../ask`. */
571
+ readonly fallback?: JevFallback<ItemQuestions<C>>;
572
+ }
573
+ /**
574
+ * The slice: the three batteries' own slices, plus the one fact none of them
575
+ * holds — which keys a failed batch left unanswered. All plain data.
576
+ */
577
+ interface ClassifyBatchState<I, C extends string> {
578
+ /** The open batch window — `../../flow/batch-window`'s slice. */
579
+ readonly window: BatchWindow<I>;
580
+ /** The in-flight batches — `../../flow/fan-out`'s slice. */
581
+ readonly fanOut: FanOutState<Batch<I>, JevOk<ItemQuestions<C>>>;
582
+ /** The answers, keyed by `keyOf` — `../../resilience/cache`'s slice. */
583
+ readonly cache: TtlCache<ItemAnswer<C>>;
584
+ /** Keys whose batch settled `resilient_err`, with the error that settled it. */
585
+ readonly failed: Readonly<Record<string, JevAskErr>>;
586
+ }
587
+ /** What {@link ClassifyBatchKnob.answerFor} reports about one key. */
588
+ type KeyAnswer<C extends string> =
589
+ /** Answered and unexpired: the host applies its own confidence rule to this. */
590
+ {
591
+ readonly status: "answered";
592
+ readonly answer: ItemAnswer<C>;
593
+ }
594
+ /** The batch carrying this key settled `resilient_err`. Nothing was cached. */
595
+ | {
596
+ readonly status: "failed";
597
+ readonly error: JevAskErr;
598
+ }
599
+ /** Buffered in the open window, or in a batch that has not settled. */
600
+ | {
601
+ readonly status: "pending";
602
+ }
603
+ /** Never seen, or cached and now expired. */
604
+ | {
605
+ readonly status: "absent";
606
+ };
607
+ /**
608
+ * Build a classify-batch knob from `config`.
609
+ *
610
+ * The verbs are pure and the whole composition is the four batteries'; the only
611
+ * thing this factory adds is the native-batch request shape and the bookkeeping
612
+ * that keeps one key out of two batches at once.
613
+ */
614
+ declare function createClassifyBatch<I, C extends string>(config: ClassifyBatchConfig<I, C>): {
615
+ init: () => ClassifyBatchState<I, C>;
616
+ add: (state: ClassifyBatchState<I, C>, item: I, at: number) => readonly [ClassifyBatchState<I, C>, readonly ClassifyBatchCmd<C>[]];
617
+ onWindow: (state: ClassifyBatchState<I, C>, at: number) => readonly [ClassifyBatchState<I, C>, readonly ClassifyBatchCmd<C>[]];
618
+ onBatchOk: (state: ClassifyBatchState<I, C>, msg: ClassifyBatchOkMsg<C>) => readonly [ClassifyBatchState<I, C>, readonly ClassifyBatchCmd<C>[]];
619
+ onBatchErr: (state: ClassifyBatchState<I, C>, msg: ClassifyBatchErrMsg) => readonly [ClassifyBatchState<I, C>, readonly ClassifyBatchCmd<C>[]];
620
+ onEvict: (state: ClassifyBatchState<I, C>, at: number) => readonly [ClassifyBatchState<I, C>, readonly ClassifyBatchCmd<C>[]];
621
+ answerFor: (state: ClassifyBatchState<I, C>, key: string, at: number) => KeyAnswer<C>;
622
+ subs: (state: ClassifyBatchState<I, C>, id?: string) => readonly (BatchWindowSub | CacheEvictionSub)[];
623
+ subscribers: () => {
624
+ deadline: SubscribeHandler<DeadlineSub, DeadlineExceeded, unknown>;
625
+ cache: SubscribeHandler<CacheEvictionSub, CacheEvictMsg, unknown>;
626
+ };
627
+ handlers: () => {
628
+ resilient_run: (cmd: ClassifyBatchCmd<C>) => Promise<ClassifyBatchOkMsg<C> | ClassifyBatchErrMsg>;
629
+ };
630
+ };
631
+ /** The bound knob {@link createClassifyBatch} returns. */
632
+ type ClassifyBatchKnob<I, C extends string> = ReturnType<typeof createClassifyBatch<I, C>>;
633
+
634
+ export { type Batch, type ClassifyBatchCmd, type ClassifyBatchConfig, type ClassifyBatchErrMsg, type ClassifyBatchKnob, type ClassifyBatchOkMsg, type ClassifyBatchState, type ClassifyCriteria, DEFAULT_CLASSIFY_MAX_ITEMS, DEFAULT_JEV_MODEL, DeadlineExceeded, DeadlineSub, type ItemAnswer, type ItemQuestion, type ItemQuestions, JEV_ENDPOINT, type JevAnswer, type JevAnswerFor, type JevAnswers, type JevAskCmd, type JevAskConfig, type JevAskErr, JevAskFailure, type JevChoiceAnswer, type JevChoiceCriteria, type JevChoiceQuestion, type JevCmd, type JevErr, type JevFailMsg, type JevFallback, type JevHttpStatus, type JevNoulAnswer, type JevNoulQuestion, type JevOk, type JevParse, type JevPort, type JevQuestion, type JevQuestionMap, type JevQuestionType, type JevRequest, type JevResponse, type JevScoreAnswer, type JevScoreCriteria, type JevScoreQuestion, type JevState, type JevSub, type JevSucceedMsg, type JevText, type JevTimerMsg, type JevUsage, type KeyAnswer, ResilientState, classifyStatus, createClassifyBatch, createJevAsk, isJevErr, isTransientJevAskErr, jevAskCmdDef, jevQuestions, liftJevAsk, parseAnswers };