@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
@@ -1,22 +1,606 @@
1
- import { C as Cmd } from '../core-Co0LWkIA.js';
2
- export { LlmCall, LlmErr, LlmFailMsg, LlmOk, LlmRunCmd, LlmSucceedMsg, MessageLoader, ModelFactory, Schema } from '../llm-call/index.js';
3
- import { A as AgentTurn, a as AgentConfigCore, C as CompactionPolicy, b as AgentKnob } from '../machine-BtFWQmmq.js';
4
- export { c as AgentBootMsg, d as AgentCmd, e as AgentCompactErrMsg, f as AgentCompactOkMsg, g as AgentCompactRunCmd, h as AgentCompactionConfig, i as AgentConfig, j as AgentDetachedHandlers, k as AgentEvent, l as AgentFailure, m as AgentLlmErrMsg, n as AgentLlmOkMsg, o as AgentLlmRunCmd, p as AgentMachineMsg, q as AgentPorts, r as AgentSnapshotConfig, s as AgentState, t as AgentStatus, u as AgentTerminalFailure, v as AgentTimerMsg, w as AgentToMachine, x as Awaiting, y as COMPACTION_PURPOSE, z as CompactInterpret, B as CompactionOutputs, D as CompactionPurpose, E as CompactionSummary, F as Conversation, S as SnapshotInterpret, T as ToolCall, G as ToolOutcome, H as ToolRecord, I as agentBootMsg, J as agentEvents, K as agentTurnSchema, L as compactionSummarySchema, M as isAgentTurn, N as isCompactionSummary, O as liftAgent, P as mergeInterpret, Q as status } from '../machine-BtFWQmmq.js';
5
- export { MonitoredRunCmd, RunFailure } from '../monitored-run/index.js';
6
- export { DeadlineSub, deadlineSub, subscribeDeadline } from '../deadline/index.js';
1
+ import { R as RequiredCtx, M as Machine, I as Interpret, C as Cmd } from '../core-DnzqWy6u.js';
2
+ import { T as ToolCall, a as ToolOutcome, C as Conversation, A as AnyToolDef, P as PlainModel, b as AgentTurn, S as StreamingModel, c as AgentState, d as ToolResult, e as ToolFailureOf, f as ToolCmd, g as AgentEvent, h as TurnChunk, i as AgentMachineMsg, W as WiredToolMsg, j as AgentCmd, k as AgentConfigCore, l as CompactionPolicy, m as AgentKnob } from '../machine-DGlPWCWI.js';
3
+ export { n as AgentBootMsg, o as AgentCancelMsg, p as AgentCompactErrMsg, q as AgentCompactOkMsg, r as AgentCompactRunCmd, s as AgentCompactionConfig, t as AgentConfig, u as AgentDetachedHandlers, v as AgentFailure, w as AgentLlmErrMsg, x as AgentLlmOkMsg, y as AgentLlmRunCmd, z as AgentPorts, B as AgentSnapshotConfig, D as AgentStatus, E as AgentTerminalFailure, F as AgentTimerMsg, G as AgentToMachine, H as Awaiting, I as COMPACTION_PURPOSE, J as CompactInterpret, K as CompactionOutputs, L as CompactionPurpose, M as CompactionSummary, N as LlmCall, O as LlmErr, Q as LlmFailMsg, R as LlmOk, U as LlmRunCmd, V as LlmSucceedMsg, X as MessageLoader, Y as ModelFactory, Z as ModelPort, _ as ModelStream, $ as PLAIN_MODEL_MISROUTE_REASON, a0 as ReservedToolName, a1 as Schema, a2 as SnapshotInterpret, a3 as TOOL_RETRY_EXHAUSTED_TAG, a4 as TOOL_TIMEOUT_TAG, a5 as TaggedFailure, a6 as ToolConstructors, a7 as ToolDef, a8 as ToolError, a9 as ToolFail, aa as ToolFailure, ab as ToolHandler, ac as ToolInput, ad as ToolMsg, ae as ToolOk, af as ToolRecord, ag as ToolRejectedCmd, ah as ToolRejection, ai as ToolResilience, aj as ToolResilienceError, ak as ToolRetryExhausted, al as ToolRouter, am as ToolSettlement, an as ToolThrown, ao as ToolTimedOut, ap as WiredToolCmd, aq as agentBootMsg, ar as agentCancelMsg, as as agentEvents, at as agentTurnSchema, au as compactionSummarySchema, av as fanOutInterpret, aw as isAgentTurn, ax as isCompactionSummary, ay as isReservedToolName, az as isStreamingModel, aA as liftAgent, aB as mergeInterpret, aC as plainModel, aD as status, aE as tool, aF as toolErrorReason, aG as toolRouter } from '../machine-DGlPWCWI.js';
4
+ import { a as ScopedCtxArg, S as Store } from '../runtime-types-CMF13BBh.js';
5
+ import { E as EndedRun } from '../index-KXqTRJyb.js';
6
+ export { M as MonitoredRunCmd, R as RunFailure } from '../index-KXqTRJyb.js';
7
+ import { RetryPolicy } from '../retry-backoff/index.js';
8
+ import { a as DeadlineSub } from '../index-HSYgG2Yt.js';
9
+ export { b as deadlineSub, s as subscribeDeadline } from '../index-HSYgG2Yt.js';
7
10
  import 'zod';
8
- import '../resilient-call/index.js';
9
- import '../cache/index.js';
10
- import '../types-XS_miRnB.js';
11
- import '../circuit-breaker/index.js';
12
- import '../protocol-B5YmJr0d.js';
13
- import '../rate-limit/index.js';
14
- import '../retry-backoff/index.js';
15
- import '../fan-out/index.js';
16
- import '../work-queue/index.js';
17
- import '../runtime-types-CNLmhWif.js';
11
+ import '../index-CA_7I5g9.js';
12
+ import '../protocol-D8VbH-VH.js';
13
+ import '../index-CuNO9m8i.js';
14
+ import '../index-CSyMYDAB.js';
18
15
  import 'better-result';
19
- import '../snapshot/index.js';
16
+ import '../index-ZCMhnVKN.js';
17
+ import '../types-BseNPIhr.js';
18
+
19
+ /**
20
+ * @demlik/tea/agent — `defineAgent`, the convenience layer over `createAgent`.
21
+ *
22
+ * `defineAgent({ model, tools, instructions })` is the three-line door: it
23
+ * defaults the single-stage wiring (`stages`, `turnOf`, `schemas`), derives the
24
+ * tool handlers from `toolRouter`, renders the prompt off the Model, and absorbs
25
+ * the drive loop through `driveToDone`. It hides wiring, never state (ADR
26
+ * 0015): the Model it runs is the same `AgentState` a hand-wired `createAgent`
27
+ * produces, under the same keys, and `machine(input)` is the door down to the
28
+ * raw kernel `run`. Each hidden thing is a named helper below.
29
+ */
30
+
31
+ /**
32
+ * One message a `defineAgent` `model` receives. Plain data the adapter renders into
33
+ * its provider's shape: the head is the `instructions` (when set) and the
34
+ * run's `input`; then, per model turn, the `assistant` turn followed by the
35
+ * `tool` outcomes that turn asked for. A tool outcome rides as data — the
36
+ * adapter decides how a failure reads to its model. An `assistant` message
37
+ * carries the turn's opaque `provider` slot exactly as the adapter returned it
38
+ * (see `AgentTurn`), present only when the stored turn has one.
39
+ */
40
+ type AgentMessage = {
41
+ readonly role: "system";
42
+ readonly content: string;
43
+ } | {
44
+ readonly role: "user";
45
+ readonly content: string;
46
+ } | {
47
+ readonly role: "assistant";
48
+ readonly content: string;
49
+ readonly toolCalls: readonly ToolCall[];
50
+ readonly provider?: unknown;
51
+ } | {
52
+ readonly role: "tool";
53
+ readonly callId: string;
54
+ readonly name: string;
55
+ readonly outcome: ToolOutcome<unknown>;
56
+ };
57
+ /**
58
+ * The brain-call payload `defineAgent` builds from the durable state — everything
59
+ * `messagesOf` renders, so the prompt is a pure function of the Model and the
60
+ * resilient slice carries exactly what was sent.
61
+ */
62
+ interface AgentPrompt<R> {
63
+ readonly instructions: string | null;
64
+ readonly input: string | null;
65
+ readonly conversation: Conversation<R>;
66
+ }
67
+ /** The one purpose a `defineAgent` agent runs. */
68
+ type LidPurpose = "act";
69
+ type LidOutputs = {
70
+ readonly [K in LidPurpose]: AgentTurn;
71
+ };
72
+ /** The Model a defined agent runs — a hand-wired `createAgent`'s, key for key. */
73
+ type DefinedAgentState<T extends AnyToolDef> = AgentState<string, LidPurpose, LidOutputs, ToolResult<T>>;
74
+ /**
75
+ * The Model `run` RESOLVES with — {@link DefinedAgentState} whose `run` slice is
76
+ * narrowed to the ended phases ({@link EndedRun}).
77
+ *
78
+ * `run`'s terminal predicate is `done || cancelled` and its `failed` one rejects,
79
+ * so the never-started `idle` arm is unreachable on the resolved value. Typing
80
+ * the promise as the whole Model published that unreachable arm anyway, and
81
+ * `idle` carries no `runId` — so `(await agent.run(input)).run.runId`, a field
82
+ * every resolved run has, did not typecheck (#155). The narrow is on what `run`
83
+ * can RESOLVE; the `idle` arm is untouched and still carries no `runId`.
84
+ *
85
+ * `DefinedAgentState` itself stays wide, because it is the DURABLE Model: an
86
+ * `init` slice is `idle`, and a `Store<DefinedAgentState<T>>` has to hold one.
87
+ */
88
+ type DefinedAgentResolvedState<T extends AnyToolDef> = Omit<DefinedAgentState<T>, "run"> & {
89
+ readonly run: EndedRun<string>;
90
+ };
91
+ /** The ctx the tools' `needs` demand, intersected — what `run` asks for. */
92
+ type DefinedAgentCtx<T extends AnyToolDef> = RequiredCtx<ToolCmd<T>>;
93
+ /** The Msg union a defined agent's machine folds. */
94
+ type DefinedAgentMsg<T extends AnyToolDef> = AgentMachineMsg<LidPurpose, LidOutputs, ToolResult<T>> | WiredToolMsg<T>;
95
+ /**
96
+ * The Cmd union a defined agent's machine emits — one interpret cell per member.
97
+ *
98
+ * Snapshotting is fixed OFF (the lid checkpoints through the run's `store`, not
99
+ * the monitored-run cadence), so `snapshot_write` is out of the union.
100
+ * Compaction is fixed ON, which is the SUPERSET of the two machines
101
+ * `defineAgent` builds: with the knob set the `compact_run` cell is the one the
102
+ * lid wires, and without it the reducer provably emits no such Cmd, so the
103
+ * machine carries no cell for it and the union simply has a member nothing
104
+ * reaches. Naming the superset is what lets one type describe both arms — and
105
+ * it is why `with` may wrap `compact_run` on a compacting agent and gets
106
+ * `overlaid`'s "this machine has none of that cell" throw on one without.
107
+ */
108
+ type DefinedAgentCmd<T extends AnyToolDef> = AgentCmd<LidPurpose, ToolCmd<T>, false, true>;
109
+ /**
110
+ * The interpret table of the machine `defineAgent` wired: one cell per
111
+ * {@link DefinedAgentCmd}, keyed by its `type` — a tool's own Cmd type, the
112
+ * router's `tool_rejected`, and the agent-owned brain call.
113
+ */
114
+ type DefinedAgentInterpret<T extends AnyToolDef> = Interpret<DefinedAgentMsg<T>, DefinedAgentCmd<T>, DefinedAgentCtx<T>>;
115
+ /** The wired machine `defineAgent` builds per `input` — feed it to the raw `run`. */
116
+ type DefinedAgentMachine<T extends AnyToolDef> = Machine<DefinedAgentState<T>, DefinedAgentMsg<T>, DefinedAgentCmd<T>, DeadlineSub, DefinedAgentCtx<T>>;
117
+ /**
118
+ * The brain a defined agent runs, in either of its two shapes:
119
+ *
120
+ * - `async (messages) => turn` — the plain port, and the common path.
121
+ * - `async (messages, { onChunk }) => turn` — the same call, plus a side
122
+ * channel it may write token deltas to while the turn is in flight.
123
+ *
124
+ * `defineAgent` takes one field for both and tells them apart by arity
125
+ * (`isStreamingModel`), so there is no config flag saying which you passed and
126
+ * no way for that flag to disagree with the function. Whichever shape you
127
+ * write, the run's Model is the same: the turn it RESOLVES is what the reducer
128
+ * folds, and the deltas end at the `onChunk` run option (see
129
+ * {@link DefinedAgentRunOptions}).
130
+ *
131
+ * Both members are unions of one signature so a model written inline still gets
132
+ * its `messages` parameter typed from the config field.
133
+ */
134
+ type DefinedAgentModel = PlainModel<AgentMessage, AgentTurn> | StreamingModel<AgentMessage, AgentTurn>;
135
+ /**
136
+ * What `defineAgent` takes: the model, the tools and the instructions, plus the
137
+ * four optional guards that stop a run — `maxTurns`, `deadlineMs`,
138
+ * `maxElapsedMs` and `stopWhen` — and the one that keeps a run going, `retry`,
139
+ * the brain call's backoff ladder. Omit every guard and the run is unbounded:
140
+ * it ends only when the model stops asking for tools.
141
+ *
142
+ * Two more knobs bound what a run COSTS rather than whether it ends:
143
+ * `compaction`, which stops the transcript growing, and `toolConcurrency`,
144
+ * which says how many of a turn's tool calls go out at once.
145
+ */
146
+ interface DefineAgentConfig<T extends AnyToolDef> {
147
+ /** The brain — either {@link DefinedAgentModel} shape. */
148
+ readonly model: DefinedAgentModel;
149
+ /** The `tool()`s the model may call. */
150
+ readonly tools: readonly T[];
151
+ /**
152
+ * The system prompt — stored on the Model at `init` (ADR 0004) and never
153
+ * re-read, so a resumed run keeps the prompt it started with even across a
154
+ * redeploy that changed this string; to replace a bad prompt already in
155
+ * flight, end that run and start a new one rather than resuming it.
156
+ */
157
+ readonly instructions: string;
158
+ /**
159
+ * Stops a run that keeps going: the maximum number of model round-trips it
160
+ * may take. Once the completed-turn count reaches it the run fails rather
161
+ * than calling the model again. Omit → no limit on turns.
162
+ */
163
+ readonly maxTurns?: number;
164
+ /**
165
+ * Stops a run that stops progressing: milliseconds the run may sit without
166
+ * advancing before it fails. The budget is a no-progress watchdog, not a
167
+ * total wall-clock cap — it restarts each time the run moves. Omit → no
168
+ * watchdog.
169
+ */
170
+ readonly deadlineMs?: number;
171
+ /**
172
+ * Stops a run that keeps going, by the clock: total milliseconds from the
173
+ * run's start it may take before it fails. This is the total wall-clock cap
174
+ * `deadlineMs` is not — the budget never restarts, so a run that keeps
175
+ * progressing is bounded by it where `deadlineMs` would let it run forever,
176
+ * and it counts elapsed time where `maxTurns` counts round-trips. It is read
177
+ * at the turn boundary, so like both of those it stops the run rather than
178
+ * cancelling the work already in flight. Omit → no wall-clock cap.
179
+ *
180
+ * The run's start time is on the durable Model, so a run killed and resumed
181
+ * continues the ORIGINAL budget — the time it spent dead counts against it.
182
+ *
183
+ * The same name on a `DurationRetryPolicy` (`retry`, and a tool's own) is the
184
+ * same idea one altitude down: that one bounds how long ONE call's retry
185
+ * ladder may keep climbing, this one how long the whole run may take.
186
+ */
187
+ readonly maxElapsedMs?: number;
188
+ /**
189
+ * Stops a run on a condition only you can see: a predicate consulted at the
190
+ * turn boundary, after the other three guards have passed, over the run's
191
+ * durable Model. Answer `true` and the run ends there — settled `cancelled`,
192
+ * the same terminal an aborted `signal` reaches, with the transcript intact
193
+ * and no further model call made. Where `maxTurns` and `maxElapsedMs` bound
194
+ * a quantity the agent counts for you and `deadlineMs` watches for a stall,
195
+ * this bounds whatever you name — a token ledger you keep, an external flag,
196
+ * a condition on the turns so far. Omit → no predicate.
197
+ *
198
+ * It must be PURE: the reducer calls it, so a replay hands it the same state
199
+ * and must get the same answer. And it is config rather than Model — a
200
+ * resumed run consults the predicate the config passed to THIS boot, exactly
201
+ * as it uses the `maxTurns` passed to this boot.
202
+ */
203
+ readonly stopWhen?: (state: DefinedAgentState<T>) => boolean;
204
+ /**
205
+ * The backoff ladder a FAILED BRAIN CALL climbs — the same `RetryPolicy`
206
+ * shape `AgentConfigCore.retry` takes, threaded straight to it, so the ladder
207
+ * runs in the resilient slice that already exists and lives on the Model:
208
+ * each failure is recorded there and the next attempt is armed as a timer
209
+ * Sub, which is what makes the wait durable and the attempt count survive a
210
+ * reload.
211
+ *
212
+ * The per-tool knob grows no lid option because a `tool()` is a spec object
213
+ * that declares its own policy (`ToolResilience.retry`). A
214
+ * `defineAgent` `model` is a bare function with no spec object, so the lid is
215
+ * the only declaration site a brain-call policy has.
216
+ *
217
+ * Omit → NO backoff, exactly as before: one throw from `model` ends the run
218
+ * after a single attempt. Nothing is defaulted on your behalf — a silent
219
+ * default would change the failure timing of every existing caller.
220
+ */
221
+ readonly retry?: RetryPolicy;
222
+ /**
223
+ * Observe a tool call that failed, typed against THIS agent's tools: the
224
+ * outcome is `{ kind: "error", _tag, …payload, reason }` over
225
+ * `ToolError`'s union — declared tags, `thrown`, `malformed_result`,
226
+ * `unknown_tool`, `malformed_args` — so a `switch` on `_tag` is exhaustive and an
227
+ * unhandled failure mode is a compile error rather than a silent turn (#115).
228
+ * The model still reads `reason` next turn either way — this is the host's
229
+ * channel beside it, never instead of it.
230
+ *
231
+ * Called ONCE per failed call, at the interpret boundary: after the handler
232
+ * settled, before the failure is folded into the conversation. It is awaited,
233
+ * so an async hook holds the settle until it resolves — keep it short, and put
234
+ * anything slow on your own queue.
235
+ *
236
+ * A resume calls it for the calls THIS process runs and no others: an outcome
237
+ * a previous process already folded is in the Model the Store handed back and
238
+ * is never re-interpreted, so a durable run does not re-fire the hook over its
239
+ * history.
240
+ *
241
+ * The hook is CONTAINED, exactly as `onEvent` is: a throw (or a rejected
242
+ * promise) is warned about and the run goes on, so `run`'s contract does not
243
+ * depend on the hook's.
244
+ *
245
+ * Omit → the router is wired unwrapped and nothing observes failures.
246
+ */
247
+ readonly onToolError?: (outcome: ToolFailureOf<T>, ctx: ToolErrorContext) => void | Promise<void>;
248
+ /**
249
+ * Bounds a run that keeps going without ever failing: the transcript budget,
250
+ * past which the OLDEST turns are folded into one model-written summary
251
+ * before the next brain call, so a long run's prompt stops growing instead of
252
+ * climbing until the provider rejects it.
253
+ *
254
+ * The knob is a THRESHOLD, not a policy function — see
255
+ * {@link DefineAgentCompaction}. `compaction` is what a run tolerates, and the
256
+ * summarize round-trip that enforces it is wiring, so the lid takes the
257
+ * former and supplies the latter from the `model` it already has.
258
+ *
259
+ * Omit → NO compaction, exactly as before: the transcript grows for as long
260
+ * as the model keeps asking for tools. Nothing is defaulted on your behalf —
261
+ * a silent budget would change the prompt every existing caller sends.
262
+ */
263
+ readonly compaction?: DefineAgentCompaction;
264
+ /**
265
+ * How many of ONE turn's tool calls a transition launches at once. At the
266
+ * default `1` a turn's calls go out one at a time, each waiting for the last
267
+ * to settle; raise it and up to that many are launched together, so they are
268
+ * all in flight in the fan-out ledger rather than queued behind each other.
269
+ * A turn asking for more calls than this runs them in waves.
270
+ *
271
+ * Launched together means overlapping on the clock: a turn of two slow tools
272
+ * costs the slower of them, not their sum. The overlap lives inside the tool
273
+ * Cmds' own handlers and NOT in the kernel — `runInterpret` still interprets
274
+ * a transition's Cmds one after another and never interleaves two handlers,
275
+ * which is ADR 0018's ruling and the reason a replay is unaffected. Settle
276
+ * Msgs fold in Cmd-EMISSION order whichever call finishes first, so raising
277
+ * the knob changes the turn's latency and nothing about its Model.
278
+ *
279
+ * Omit (or `1`) → serial dispatch, exactly as before.
280
+ */
281
+ readonly toolConcurrency?: number;
282
+ }
283
+ /**
284
+ * The lid's compaction budget: the two numbers that say when a transcript is
285
+ * too long and how much of it survives the fold. Both are plain counts, so the
286
+ * trigger they build is PURE — a replay re-decides identically, and no clock or
287
+ * token estimate enters the Model (ADR 0004).
288
+ *
289
+ * This is deliberately a threshold rather than the core's `planCompaction`
290
+ * function: a policy function is a second place a lid agent would have to learn
291
+ * the conversation shape, and the lid hides wiring, never state (ADR 0015). A
292
+ * run that needs its own heuristic descends to `createAgent`, whose
293
+ * `CompactionPolicy` this is built from.
294
+ */
295
+ interface DefineAgentCompaction {
296
+ /**
297
+ * Fold once the conversation holds at least this many turns, counted BEFORE
298
+ * the brain call about to fire. Must be at least `1`.
299
+ */
300
+ readonly afterTurns: number;
301
+ /**
302
+ * How many of the NEWEST turns survive the fold intact, beside the summary.
303
+ * Everything older becomes the summary's one synthetic head turn. Omit → `0`:
304
+ * the whole transcript folds into the summary.
305
+ *
306
+ * A fold worth fewer than two turns is skipped by the agent itself — one turn
307
+ * replaced by one summary shrinks nothing — so `keepTurns` within one of
308
+ * `afterTurns` is a policy that never fires.
309
+ */
310
+ readonly keepTurns?: number;
311
+ }
312
+ /**
313
+ * Which call an `onToolError` failure belongs to: the model's `callId` — the
314
+ * fan-out identity the outcome folds back on — and the tool `name` the model
315
+ * asked for, which for an `unknown_tool` is the name it invented rather than
316
+ * any declared tool.
317
+ */
318
+ interface ToolErrorContext {
319
+ readonly callId: string;
320
+ readonly name: string;
321
+ }
322
+ /**
323
+ * One lifecycle event a defined agent's run emits — {@link AgentEvent} with the
324
+ * tool results typed against this agent's own tool set.
325
+ */
326
+ type DefinedAgentEvent<T extends AnyToolDef> = AgentEvent<ToolResult<T>>;
327
+ /**
328
+ * Host wiring for one `run`: the store, the ctx the tools need, a runId, a clock.
329
+ *
330
+ * `ctx` is `ScopedCtxArg`, the same widening `run` itself takes: an agent's tools
331
+ * are exactly the handlers a scoped resource is for, so a `provide({ … })` graph
332
+ * is accepted here in place of the object and gets the same acquire-at-boot /
333
+ * release-at-terminal lifetime.
334
+ */
335
+ type DefinedAgentRunOptions<T extends AnyToolDef> = ScopedCtxArg<DefinedAgentCtx<T>> & {
336
+ readonly store?: Store<DefinedAgentState<T>>;
337
+ /** The run's identity. Omit → a fresh UUID. */
338
+ readonly runId?: string;
339
+ /** The clock that stamps `at`. Omit → `Date.now`. */
340
+ readonly clock?: () => number;
341
+ /**
342
+ * Observe the run's turn-level lifecycle events — `TurnSettled`,
343
+ * `ToolSettled`, `RunDone` — in the order the kernel settles them. This is
344
+ * the progress seam: without it the only way to see anything mid-run is
345
+ * `machine(input)` plus the raw kernel loop.
346
+ *
347
+ * It forwards the runtime's existing semantic stream (`agentEvents()` /
348
+ * `runtime.on`); it mints no vocabulary of its own, so a consumer folds the
349
+ * same {@link AgentEvent}s a hand-wired `run` would.
350
+ *
351
+ * The listener is CONTAINED: a throw is caught and warned, never allowed to
352
+ * take the run down, and never observable in `run`'s resolution. Only
353
+ * transitions applied by THIS process project events, so a store-backed
354
+ * resume replays nothing that settled before the boot.
355
+ *
356
+ * Omit → no projector is wired and the run behaves exactly as before.
357
+ */
358
+ readonly onEvent?: (event: DefinedAgentEvent<T>) => void;
359
+ /**
360
+ * Observe the token deltas of the turn being produced right now — the
361
+ * granularity below `onEvent`'s. Wired only when the configured `model` is
362
+ * the streaming shape (`async (messages, { onChunk }) => turn`); a plain
363
+ * model has no deltas to give, so passing this beside one is silent.
364
+ *
365
+ * Chunks ride a SIDE CHANNEL, never state. They are not projected off
366
+ * transitions like an {@link AgentEvent} is, because nothing about a chunk is
367
+ * a transition: it is never journaled, never written to the `Store`, and
368
+ * never folded into the Model. That is the whole rule this option obeys — a
369
+ * delta that has not settled is not an outcome, so a run that dies mid-turn
370
+ * loses its chunks and resumes from the last SETTLED turn, and a resumed run
371
+ * re-emits nothing it did not itself re-produce.
372
+ *
373
+ * The listener is CONTAINED exactly as `onEvent`'s is: a throw is caught and
374
+ * warned, never allowed to fail the model call it fired from.
375
+ *
376
+ * Omit → the streaming model is still invoked in its streaming shape, with a
377
+ * sink that drops every chunk.
378
+ */
379
+ readonly onChunk?: (chunk: TurnChunk) => void;
380
+ /**
381
+ * Stop the run from outside — the stop button's seam. On abort the run settles
382
+ * on a CANCELLED terminal Model and `run` RESOLVES with it; it does not reject,
383
+ * and no `DriveFailedError` is thrown. Read the outcome with `status(state)`,
384
+ * which answers `{ kind: "cancelled", at }` — distinct from `failed`, because a
385
+ * run someone stopped did not fail.
386
+ *
387
+ * The outcome is durable, so it is also the answer on the next boot: a process
388
+ * killed after an abort resumes reading a run that ENDED, not one to restart.
389
+ * A signal already aborted when `run` is called ends it before the first model
390
+ * call is made.
391
+ *
392
+ * It stops DISPATCH, not the work already in flight — a promise cannot be
393
+ * cancelled, so a tool handler mid-call runs to its own end. Those late results
394
+ * reach no `onEvent`, no `onToolError` and no Model, and they do not hold the
395
+ * runtime's teardown. Propagating the signal INTO handlers is a separate seam
396
+ * this option does not open.
397
+ *
398
+ * Omit → the run has no stop button and every path behaves exactly as before.
399
+ */
400
+ readonly signal?: AbortSignal;
401
+ };
402
+ /**
403
+ * One decorator per interpret cell you name: it receives the cell the agent
404
+ * wired (`next`) and returns the cell that runs in its place. Every key is
405
+ * optional and a cell nobody names is passed through by REFERENCE, so an
406
+ * overlay that wraps one tool leaves the others the exact functions
407
+ * `defineAgent` built.
408
+ *
409
+ * The wrapper's signature is the cell's, so calling `next(cmd, ctx, dispatch)`
410
+ * is how the wrapped work happens — that is the typed Cmd→Msg edge
411
+ * (`Cmd.define`'s `_ok` / `_err` Msgs), and returning its Msg is what keeps the
412
+ * fold, and therefore a replay, identical to the unwrapped run's.
413
+ */
414
+ type InterpretOverlay<T extends AnyToolDef> = CellWrappers<DefinedAgentInterpret<T>>;
415
+ /**
416
+ * The decorator table over an interpret table `I`. Written over a bare type
417
+ * parameter because `I[K]` is only indexable when `I` is one: applying the
418
+ * mapped type to `DefinedAgentInterpret<T>` inline leaves TypeScript indexing
419
+ * an unreduced generic mapped type, which it refuses.
420
+ */
421
+ type CellWrappers<I> = {
422
+ readonly [K in keyof I]?: (next: I[K]) => I[K];
423
+ };
424
+ /**
425
+ * What `defineAgent(cfg).with(...)` takes — the one documented wrap point over
426
+ * the machine the lid built.
427
+ */
428
+ interface DefinedAgentOverlay<T extends AnyToolDef> {
429
+ readonly interpret: InterpretOverlay<T>;
430
+ }
431
+ /** What `defineAgent` returns. */
432
+ interface DefinedAgent<T extends AnyToolDef> {
433
+ /**
434
+ * Run `input` to its terminal Model. Resolves on `run.phase: "done"`; a
435
+ * failed run rejects with `DriveFailedError` carrying the failed Model.
436
+ *
437
+ * With a `store`, the same call is also the resume: a Model the Store hands
438
+ * back mid-run is booted (`agent_boot`) at its one outstanding effect —
439
+ * same `runId`, no tool re-run — and one already `done` resolves as it is.
440
+ * A fresh start needs an empty Store.
441
+ *
442
+ * It resolves with {@link DefinedAgentResolvedState} — the Model whose `run`
443
+ * slice is narrowed to the ENDED phases, so `(await agent.run(i)).run.runId`
444
+ * reads without a guard against an `idle` arm this promise cannot produce.
445
+ */
446
+ readonly run: (input: string, ...opts: [Record<never, never>] extends [DefinedAgentCtx<T>] ? [opts?: DefinedAgentRunOptions<T>] : [opts: DefinedAgentRunOptions<T>]) => Promise<DefinedAgentResolvedState<T>>;
447
+ /** The machine `run` drives for `input` — the door down to the raw kernel. */
448
+ readonly machine: (input: string) => DefinedAgentMachine<T>;
449
+ /**
450
+ * The ramp between the lid and `createAgent`: wrap ONE interpret cell of the
451
+ * machine this agent builds and get back a NEW defined agent that runs the
452
+ * wrapped table. The agent it is called on is untouched, and so is every cell
453
+ * the overlay does not name.
454
+ *
455
+ * const traced = agent.with({
456
+ * interpret: {
457
+ * fetch_rate: (next) => async (cmd, ctx, dispatch) => {
458
+ * console.time(cmd.callId);
459
+ * try { return await next(cmd, ctx, dispatch); }
460
+ * finally { console.timeEnd(cmd.callId); }
461
+ * },
462
+ * },
463
+ * });
464
+ *
465
+ * The wrapped cell settles through the SAME typed Cmd→Msg edge as the cell it
466
+ * wraps — it returns whatever `next` returned — so the reducer folds the same
467
+ * Msgs and a replay of a wrapped run is the unwrapped run's replay. That is
468
+ * the whole contract: the door is one over the effect boundary, never over
469
+ * the fold. A cell that must settle DIFFERENTLY is a different machine, and
470
+ * `createAgent` is still where you build one.
471
+ *
472
+ * `with` composes — `agent.with(a).with(b)` puts `b`'s wrapper OUTSIDE `a`'s,
473
+ * so `b` is entered first and `a`'s cell is what its `next` calls. Naming a
474
+ * cell the machine has none of throws at `machine(input)`, where the table it
475
+ * is checked against exists.
476
+ */
477
+ readonly with: (overlay: DefinedAgentOverlay<T>) => DefinedAgent<T>;
478
+ }
479
+ /**
480
+ * Define an agent from a model, the tools it may call and its instructions, and
481
+ * get back `run(input)` — a promise of the finished state — plus `machine(input)`
482
+ * for driving the same run yourself, which is the entry point a newcomer picks,
483
+ * `createAgent` being the layer underneath that you drop to only to walk a stage
484
+ * pipeline of your own.
485
+ *
486
+ * Add `maxTurns`, `deadlineMs`, `maxElapsedMs` or `stopWhen` to bound the run;
487
+ * all four are described on `DefineAgentConfig`. The run's `input` is its single stage, so it is durable
488
+ * beside `instructions`, and the prompt is rendered from those two and the
489
+ * conversation on every model call.
490
+ *
491
+ * One unusual requirement does not cost you the lid: `.with({ interpret })`
492
+ * wraps one interpret cell of the machine this built and hands back another
493
+ * defined agent, so `createAgent` is for a rebuild rather than for a detour.
494
+ */
495
+ declare function defineAgent<T extends AnyToolDef>(config: DefineAgentConfig<T>): DefinedAgent<T>;
496
+ /** The prompt as messages: the head, then each turn with its tool outcomes. PURE. */
497
+ declare function renderPrompt(prompt: AgentPrompt<unknown>): AgentMessage[];
498
+
499
+ /**
500
+ * @packageDocumentation
501
+ * The transcript collector — the built-in way to KEEP a run's turns, given that
502
+ * a finished run's Model does not.
503
+ *
504
+ * A run that reaches `phase: "done"` clears `conversation` to `null` on
505
+ * purpose: the terminating turn is stamped onto `output` first, so the answer
506
+ * survives, and the history that would otherwise grow without bound in storage
507
+ * kept for its state is dropped (`docs/explanation/durability-model.md`). That
508
+ * policy is not what this module changes. What it changes is that every
509
+ * consumer wanting the history had to hand-write the same fold over `onEvent`.
510
+ *
511
+ * So this is a COLLECTOR over the event stream that already exists, not a knob
512
+ * on the Model. Nothing here is durable, nothing here is written to a `Store`,
513
+ * and a run with a collector attached is byte for byte the run it was without
514
+ * one — the same reason `onChunk` rides a side channel rather than state.
515
+ *
516
+ * const t = transcript<ToolResult<typeof tools>>();
517
+ * const final = await agent.run(input, { store, onEvent: t.onEvent });
518
+ * t.read().turns; // every turn this process settled
519
+ *
520
+ * ## What a resume needs from you
521
+ *
522
+ * Events are projected off the transitions THIS process applies, so a run
523
+ * resumed from a `Store` re-emits nothing the killed process already settled.
524
+ * A collector that only ever listened would therefore hold the tail of a
525
+ * resumed run and call it the whole thing. Hence the seed: hand
526
+ * {@link transcript} the Model the `Store` handed back and it starts from that
527
+ * Model's live conversation, so the resumed collector reads as the whole run
528
+ * rather than its last leg.
529
+ */
530
+
531
+ /**
532
+ * One tool call the run settled OK, as the transcript keeps it — the `callId`
533
+ * and the result, which is exactly what the `ToolSettled` event carries.
534
+ *
535
+ * A tool that FAILED is absent, and that is the event stream's shape rather
536
+ * than a choice made here: `ToolSettled` is projected off the OK settle alone.
537
+ * Branch on failures through `onToolError`, whose argument is typed per tag.
538
+ */
539
+ interface TranscriptToolResult<R> {
540
+ readonly callId: string;
541
+ readonly result: R;
542
+ }
543
+ /**
544
+ * Whether the run has finished, and its terminal turn once it has.
545
+ *
546
+ * The two cases are a union rather than a nullable `output` field because
547
+ * `output` is legitimately `null` on a finished run — a `RunDone` with no
548
+ * terminating turn — and a single field would make "not finished yet" and
549
+ * "finished with nothing" the same reading.
550
+ */
551
+ type TranscriptOutcome = {
552
+ readonly kind: "running";
553
+ } | {
554
+ readonly kind: "done";
555
+ readonly output: AgentTurn | null;
556
+ };
557
+ /** What a collector holds right now — a plain, immutable read. */
558
+ interface TranscriptSnapshot<R> {
559
+ /** Every model turn the transcript holds, in order. */
560
+ readonly turns: readonly AgentTurn[];
561
+ /** Every tool call that settled OK, in settle order. */
562
+ readonly tools: readonly TranscriptToolResult<R>[];
563
+ /** Whether `RunDone` has been seen, and the terminal turn if so. */
564
+ readonly outcome: TranscriptOutcome;
565
+ }
566
+ /**
567
+ * The Model a resumed collector starts from — structural on purpose, so any
568
+ * agent state (`DefinedAgentState<T>`, `AgentState<…>`) satisfies it without
569
+ * this module importing the lid, and a bare `{ conversation }` object works in
570
+ * a test.
571
+ */
572
+ interface TranscriptSeed<R> {
573
+ readonly conversation: Conversation<R> | null;
574
+ }
575
+ /**
576
+ * A live transcript: the listener you wire, and the read you take off it.
577
+ *
578
+ * `onEvent` is a bound function, so `{ onEvent: t.onEvent }` is the whole
579
+ * wiring — there is no `this` to lose.
580
+ */
581
+ interface Transcript<R> {
582
+ /** Wire this to `run`'s `onEvent`. */
583
+ readonly onEvent: (event: AgentEvent<R>) => void;
584
+ /** The transcript as of now. Each call returns a fresh immutable snapshot. */
585
+ readonly read: () => TranscriptSnapshot<R>;
586
+ }
587
+ /**
588
+ * Open a transcript collector over an agent run's event stream.
589
+ *
590
+ * Wire `onEvent` to `run`'s `onEvent` option and `read()` gives you the turns
591
+ * and settled tool results afterwards — the transcript the finished Model no
592
+ * longer carries.
593
+ *
594
+ * Pass `seed` when the run is a RESUME: the Model the `Store` handed back still
595
+ * holds the live conversation the killed process built, and seeding from it is
596
+ * what makes the collector hold the whole run rather than the leg this process
597
+ * ran. One collector per process is the honest unit; a fresh run needs no seed.
598
+ *
599
+ * A seed taken from an already-finished Model contributes nothing, and
600
+ * correctly so: that Model's `conversation` is `null` and its answer is its
601
+ * `output`, which you already hold.
602
+ */
603
+ declare function transcript<R>(seed?: TranscriptSeed<R>): Transcript<R>;
20
604
 
21
605
  /**
22
606
  * @packageDocumentation
@@ -25,16 +609,15 @@ import '../snapshot/index.js';
25
609
  * drives the classic loop `llm → tools → fold → llm` until the model stops
26
610
  * asking for tools.
27
611
  *
28
- * This is the `seed/audit-agent-machine` reducer generalized: the seed's audit /
29
- * glyph / violation domain specifics are stripped, and what remains — the loop,
30
- * the durability, the boot-reconcile crash recovery, the serial-vs-fanned tool
31
- * dispatch — is yours. The consumer supplies the only things that are genuinely
32
- * domain: the tools, the prompts (via the llm-call message loader), the schemas,
33
- * and the model. `createAgent(config)` returns the uniform knob contract every
612
+ * This generalizes a production audit agent: the domain specifics are stripped,
613
+ * and what remains — the loop, the durability, the boot-reconcile crash
614
+ * recovery, the serial-vs-fanned tool dispatch — is yours. The consumer
615
+ * supplies the only things that are genuinely domain: the tools, the prompts
616
+ * (via the llm-call message loader), the schemas, and the model. `createAgent(config)` returns the uniform handle contract every
34
617
  * composition exposes (`init` / verbs returning `readonly [State, Cmd[]]` /
35
618
  * `subs`) AND a ready-to-`run` `defineMachine` (`toMachine`) — THE one wired
36
619
  * path. (`unsafeDetachedHandlers` is the hand-wiring escape hatch; its name
37
- * advertises that it does not drive the retry loop — see #54.)
620
+ * advertises that it does not drive the retry loop.)
38
621
  *
39
622
  * ## The composition (three siblings wired into ONE machine)
40
623
  *
@@ -43,18 +626,21 @@ import '../snapshot/index.js';
43
626
  * position survives eviction, the no-progress deadline auto-fails a wedged
44
627
  * run, and `boot` resumes mid-pipeline. The agent slice OWNS this slice and
45
628
  * delegates `start` / `advance` / `progress` / `onDeadline` / `boot` to it.
46
- * - `../llm-call` — every brain call (the seed's `call_llm{purpose}`). One
629
+ * - `../llm-call` — every brain call. One
47
630
  * `LlmCall` per turn, structured-output parsed, retry composed in. The agent
48
631
  * delegates the resilient slice + verbs and reuses the detached handler.
49
- * - `../fan-out` — the tool calls a turn produced. The seed dispatched tools
50
- * SERIALLY (concurrency 1); fan-out generalizes that to bounded concurrency
51
- * `config.toolConcurrency` (default 1 = the seed's serial behavior). Each
632
+ * - `../fan-out` — the tool calls a turn produced. Tools dispatch SERIALLY by
633
+ * default (concurrency 1); fan-out generalizes that to a bounded number
634
+ * LAUNCHED per transition, `config.toolConcurrency`. Above `1` a router's
635
+ * tool cells overlap on the clock while `runInterpret` stays serial — the
636
+ * fan-out is inside the Cmd handler, and its settles fold in emission
637
+ * order (ADR 0018). Each
52
638
  * tool is an `of(call)` Cmd the consumer's own interpret performs; results
53
639
  * route back through `toolOk` / `toolErr`. When the batch drains, the agent
54
640
  * folds the gathered results back into the conversation and fires the next
55
641
  * brain call (`fold → llm`).
56
642
  *
57
- * ## The flow loop, as TEA (generalized from the seed's `applyAiTurn`)
643
+ * ## The flow loop, as TEA
58
644
  *
59
645
  * 1. `start` enters the pipeline; the consumer wires the per-stage outstanding
60
646
  * effect (often a `call_llm` for the agentic stage) off the current stage.
@@ -68,10 +654,12 @@ import '../snapshot/index.js';
68
654
  * queued tool. When the batch drains, fold the gathered outcomes into the
69
655
  * conversation, bump the turn count (livelock guard), and fire the next
70
656
  * brain call — `awaiting` flips back to `llm`.
71
- * 4. The watchdog + turn-limit guard bound the loop; the deadline fires
72
- * `failed`, the turn limit fires `failed { turn_limit }`.
657
+ * 4. The watchdog bounds a stall and the turn boundary's own stop conditions
658
+ * bound the loop: the deadline fires `failed`, the turn limit fires
659
+ * `failed { turn_limit }`, the wall-clock cap `failed { elapsed_limit }`,
660
+ * and the consumer's `stopWhen` settles the run `cancelled`.
73
661
  *
74
- * ## Boot reconcile (crash recovery — the seed's `outstandingEffect`)
662
+ * ## Boot reconcile (crash recovery)
75
663
  *
76
664
  * Cold wake re-derives the ONE outstanding effect from `phase × awaiting`: a
77
665
  * brain call in flight re-fires `call_llm`; tools in flight re-fire the in-flight
@@ -98,11 +686,13 @@ import '../snapshot/index.js';
98
686
  * type RunTool = { readonly type: "run_tool" } & ToolCall;
99
687
  * const agent = createAgent<Stage, Purpose, Outputs, Result, RunTool, Msg>({
100
688
  * stages: ["plan", "act", "report"],
101
- * model: (id) => createChatModel(env, id),
689
+ * // The brain: a plain `async (messages) => turn` (the common path), or the
690
+ * // `(id) => Llm` factory when the model binds the schema itself.
691
+ * model: async (messages) => client.chat(messages),
102
692
  * schemas: { plan: planSchema, act: turnSchema, report: reportSchema },
103
693
  * turnOf: (stage) => stageToPurpose[stage], // which brain call a stage runs
104
694
  * toolOf: (call): RunTool => ({ type: "run_tool", ...call }),
105
- * toolConcurrency: 1, // serial like the seed (default)
695
+ * toolConcurrency: 1, // launched per transition
106
696
  * deadlineMs: 10 * 60_000,
107
697
  * maxTurns: 60,
108
698
  * retry: defaultRetryPolicy,
@@ -115,21 +705,24 @@ import '../snapshot/index.js';
115
705
  */
116
706
 
117
707
  /**
118
- * Build an agent knob from `config`. The determinism seam — `config.rng`,
119
- * injected for the inherited brain-call retry jitter — lives as a named field
120
- * on the config (pass a fixed `() => 0` to pin backoff in tests; omit → defaults
121
- * to `Math.random`, read only at the resilient-call verb boundary).
708
+ * Assemble an agent from `config` — the model, the stages it walks, and how a
709
+ * tool call is turned into a command — and get back its `init`, verbs and `subs`
710
+ * plus a `toMachine()` that wires all of it into one machine you hand to `run`,
711
+ * which is the layer to reach for only once `defineAgent` cannot express the run
712
+ * you want — a newcomer starts there, not here.
122
713
  *
123
- * Returns the uniform knob contract (`init` / verbs / `subs`) plus `toMachine()`
124
- * — a `defineMachine` wiring all of it into one runnable machine — and the
125
- * `unsafeDetachedHandlers` hand-wiring escape hatch.
714
+ * Pass `snapshotEvery` to have the run persist itself every N steps, and
715
+ * `compaction` to have long conversations summarized as they grow; each one you
716
+ * pass obliges you to supply the matching handler at `toMachine`, and each one
717
+ * you omit forbids it. `rng` is the determinism seam for the retry backoff —
718
+ * pass a fixed `() => 0` to pin it in tests; omit for `Math.random`.
719
+ * `unsafeDetachedHandlers` is the hand-wiring escape hatch.
126
720
  *
127
- * `createAgent` is OVERLOADED on TWO independent discriminants — the snapshotting
128
- * (#55) and the compaction (#85) one — so each `toMachine` obligation is derived
721
+ * The four overloads exist because the two obligations are derived
129
722
  * from the `config` VALUE, never inferred. `{ snapshotEvery: number }` REQUIRES
130
723
  * the `snapshot_write` cell, `{ snapshotEvery?: never }` FORBIDS it; `{ compaction:
131
724
  * policy }` REQUIRES the `compact_run` cell, `{ compaction?: never }` FORBIDS it.
132
- * The four overloads enumerate the snapshot × compaction grid: overload resolution
725
+ * They enumerate the snapshot × compaction grid: overload resolution
133
726
  * reads the two fields off `config`, so the right `Snap`/`Compact` pair is fixed
134
727
  * even when the call site passes explicit type arguments (TS does not infer
135
728
  * trailing type params — a `Cfg`-inference scheme would silently fall back to OFF
@@ -152,4 +745,4 @@ declare function createAgent<Stage, P extends string, O extends Record<P, AgentT
152
745
  readonly compaction?: never;
153
746
  }): AgentKnob<Stage, P, O, R, TC, false, false>;
154
747
 
155
- export { AgentConfigCore, AgentKnob, AgentTurn, CompactionPolicy, createAgent };
748
+ export { AgentCmd, AgentConfigCore, AgentEvent, AgentKnob, AgentMachineMsg, type AgentMessage, type AgentPrompt, AgentState, AgentTurn, AnyToolDef, CompactionPolicy, Conversation, DeadlineSub, type DefineAgentCompaction, type DefineAgentConfig, type DefinedAgent, type DefinedAgentCmd, type DefinedAgentCtx, type DefinedAgentEvent, type DefinedAgentInterpret, type DefinedAgentMachine, type DefinedAgentModel, type DefinedAgentMsg, type DefinedAgentOverlay, type DefinedAgentResolvedState, type DefinedAgentRunOptions, type DefinedAgentState, EndedRun, type InterpretOverlay, type LidPurpose, PlainModel, StreamingModel, ToolCall, ToolCmd, type ToolErrorContext, ToolFailureOf, ToolOutcome, ToolResult, type Transcript, type TranscriptOutcome, type TranscriptSeed, type TranscriptSnapshot, type TranscriptToolResult, TurnChunk, WiredToolMsg, createAgent, defineAgent, renderPrompt, transcript };