@demlik/tea 0.13.0 → 0.15.0

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