@sixb/core 0.1.25 → 0.1.26

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 (446) hide show
  1. package/dist/actions/index.js +35 -35
  2. package/dist/agents/attachment-keys.d.ts +25 -0
  3. package/dist/agents/attachment-keys.d.ts.map +1 -0
  4. package/dist/agents/cancel.d.ts +12 -0
  5. package/dist/agents/cancel.d.ts.map +1 -1
  6. package/dist/agents/children.d.ts.map +1 -1
  7. package/dist/agents/dispatch.d.ts +1 -9
  8. package/dist/agents/dispatch.d.ts.map +1 -1
  9. package/dist/agents/execution.d.ts +5 -0
  10. package/dist/agents/execution.d.ts.map +1 -1
  11. package/dist/agents/index.d.ts +31 -6
  12. package/dist/agents/index.d.ts.map +1 -1
  13. package/dist/agents/index.js +154 -66
  14. package/dist/agents/index.js.map +1 -1
  15. package/dist/agents/model-loop.d.ts +3 -5
  16. package/dist/agents/model-loop.d.ts.map +1 -1
  17. package/dist/agents/model-routing.d.ts +4 -1
  18. package/dist/agents/model-routing.d.ts.map +1 -1
  19. package/dist/agents/request.d.ts +9 -1
  20. package/dist/agents/request.d.ts.map +1 -1
  21. package/dist/agents/run-after-finish.d.ts +11 -0
  22. package/dist/agents/run-after-finish.d.ts.map +1 -0
  23. package/dist/agents/run-artifacts.d.ts +56 -0
  24. package/dist/agents/run-artifacts.d.ts.map +1 -0
  25. package/dist/agents/run-events.d.ts +49 -0
  26. package/dist/agents/run-events.d.ts.map +1 -0
  27. package/dist/agents/run-fence.d.ts +38 -0
  28. package/dist/agents/run-fence.d.ts.map +1 -0
  29. package/dist/agents/run-liveness.d.ts +36 -0
  30. package/dist/agents/run-liveness.d.ts.map +1 -0
  31. package/dist/agents/run-plan.d.ts +110 -0
  32. package/dist/agents/run-plan.d.ts.map +1 -0
  33. package/dist/agents/run-session-children.d.ts +89 -0
  34. package/dist/agents/run-session-children.d.ts.map +1 -0
  35. package/dist/agents/run-session-http.d.ts +37 -0
  36. package/dist/agents/run-session-http.d.ts.map +1 -0
  37. package/dist/agents/run-session-serve.d.ts +24 -0
  38. package/dist/agents/run-session-serve.d.ts.map +1 -0
  39. package/dist/agents/run-session-wire.d.ts +31 -0
  40. package/dist/agents/run-session-wire.d.ts.map +1 -0
  41. package/dist/agents/run-session.d.ts +239 -0
  42. package/dist/agents/run-session.d.ts.map +1 -0
  43. package/dist/agents/run-token.d.ts +40 -0
  44. package/dist/agents/run-token.d.ts.map +1 -0
  45. package/dist/agents/run-tools.d.ts +68 -0
  46. package/dist/agents/run-tools.d.ts.map +1 -0
  47. package/dist/agents/run-turn.d.ts +59 -0
  48. package/dist/agents/run-turn.d.ts.map +1 -0
  49. package/dist/agents/streams/index.js +1 -1
  50. package/dist/agents/streams/internal.d.ts +1 -1
  51. package/dist/agents/streams/internal.d.ts.map +1 -1
  52. package/dist/agents/streams/internal.js +2 -4
  53. package/dist/agents/streams/internal.js.map +1 -1
  54. package/dist/agents/streams/protocol.d.ts +1 -96
  55. package/dist/agents/streams/protocol.d.ts.map +1 -1
  56. package/dist/agents/subagent-runs.d.ts +7 -1
  57. package/dist/agents/subagent-runs.d.ts.map +1 -1
  58. package/dist/agents/tool-files.d.ts +34 -0
  59. package/dist/agents/tool-files.d.ts.map +1 -0
  60. package/dist/agents/workflow-node-session.d.ts +99 -0
  61. package/dist/agents/workflow-node-session.d.ts.map +1 -0
  62. package/dist/artifacts/frames/index.js +1 -1
  63. package/dist/artifacts/frames/index.js.map +1 -1
  64. package/dist/artifacts/index.js.map +1 -1
  65. package/dist/artifacts/publish/index.d.ts +1 -1
  66. package/dist/artifacts/publish/index.d.ts.map +1 -1
  67. package/dist/artifacts/publish/index.js +19 -19
  68. package/dist/auth/index.js +8 -8
  69. package/dist/authorization/index.js +4 -4
  70. package/dist/bootstrap/index.js +45 -43
  71. package/dist/bootstrap/index.js.map +2 -2
  72. package/dist/{chunk-2fn60nvs.js → chunk-06sg8s4z.js} +2 -2
  73. package/dist/{chunk-2fn60nvs.js.map → chunk-06sg8s4z.js.map} +1 -1
  74. package/dist/chunk-07kkp2e1.js.map +1 -1
  75. package/dist/{chunk-9ntbsnke.js → chunk-0bc3w0zq.js} +7 -7
  76. package/dist/{chunk-9ntbsnke.js.map → chunk-0bc3w0zq.js.map} +2 -2
  77. package/dist/{chunk-d2m879s4.js → chunk-0kk2wt0h.js} +27 -27
  78. package/dist/chunk-0kk2wt0h.js.map +12 -0
  79. package/dist/chunk-16a9dmfy.js.map +1 -1
  80. package/dist/chunk-18sk89cg.js.map +2 -2
  81. package/dist/{chunk-3qms4nax.js → chunk-1vg43g9q.js} +20 -20
  82. package/dist/{chunk-3qms4nax.js.map → chunk-1vg43g9q.js.map} +4 -4
  83. package/dist/{chunk-hqsp2sx4.js → chunk-1xvqgg88.js} +31 -33
  84. package/dist/{chunk-hqsp2sx4.js.map → chunk-1xvqgg88.js.map} +6 -6
  85. package/dist/chunk-2adz0h75.js.map +1 -1
  86. package/dist/{chunk-fm62y49k.js → chunk-2pk5hjj9.js} +5 -3
  87. package/dist/{chunk-fm62y49k.js.map → chunk-2pk5hjj9.js.map} +5 -5
  88. package/dist/{chunk-vrf90dkv.js → chunk-2vjnyz1s.js} +1 -1
  89. package/dist/{chunk-vrf90dkv.js.map → chunk-2vjnyz1s.js.map} +1 -1
  90. package/dist/{chunk-4f3ydv7t.js → chunk-315qye3g.js} +1 -1
  91. package/dist/{chunk-4f3ydv7t.js.map → chunk-315qye3g.js.map} +1 -1
  92. package/dist/{chunk-rap5w0x0.js → chunk-31khg3g0.js} +1 -1
  93. package/dist/{chunk-rap5w0x0.js.map → chunk-31khg3g0.js.map} +1 -1
  94. package/dist/chunk-45ngkxkp.js.map +1 -1
  95. package/dist/chunk-48jezz3j.js.map +1 -1
  96. package/dist/{chunk-vr3j63jq.js → chunk-4jq2bg8t.js} +78 -78
  97. package/dist/{chunk-vr3j63jq.js.map → chunk-4jq2bg8t.js.map} +4 -4
  98. package/dist/chunk-4ymrcdbm.js.map +1 -1
  99. package/dist/chunk-58geavnf.js.map +1 -1
  100. package/dist/{chunk-6y0mkhex.js → chunk-59kf345w.js} +2 -2
  101. package/dist/{chunk-6y0mkhex.js.map → chunk-59kf345w.js.map} +1 -1
  102. package/dist/{chunk-3p93tb91.js → chunk-6qn7nmd3.js} +102 -102
  103. package/dist/{chunk-3p93tb91.js.map → chunk-6qn7nmd3.js.map} +4 -4
  104. package/dist/chunk-73j0v4qv.js +355 -0
  105. package/dist/chunk-73j0v4qv.js.map +13 -0
  106. package/dist/{chunk-2gjj5dx3.js → chunk-78ymxrn0.js} +1 -1
  107. package/dist/{chunk-6bkbyer5.js → chunk-7ex2p3zp.js} +3 -3
  108. package/dist/{chunk-6bkbyer5.js.map → chunk-7ex2p3zp.js.map} +1 -1
  109. package/dist/{chunk-5tfev0fv.js → chunk-7hf6tkgs.js} +167 -167
  110. package/dist/{chunk-5tfev0fv.js.map → chunk-7hf6tkgs.js.map} +4 -4
  111. package/dist/{chunk-8z4726jz.js → chunk-7wn5z7mq.js} +10 -10
  112. package/dist/{chunk-8z4726jz.js.map → chunk-7wn5z7mq.js.map} +2 -2
  113. package/dist/{chunk-6n69k945.js → chunk-8mb7mt8n.js} +2 -2
  114. package/dist/chunk-8ncg20rd.js.map +1 -1
  115. package/dist/{chunk-68wghpdf.js → chunk-8v5a54qz.js} +50 -11
  116. package/dist/{chunk-68wghpdf.js.map → chunk-8v5a54qz.js.map} +3 -3
  117. package/dist/{chunk-gqm0b7vd.js → chunk-8v6xzwgr.js} +92 -76
  118. package/dist/{chunk-gqm0b7vd.js.map → chunk-8v6xzwgr.js.map} +6 -6
  119. package/dist/{chunk-m36fw8ft.js → chunk-8wsjr52f.js} +1 -1
  120. package/dist/{chunk-vd1rk42q.js → chunk-8xnz9vvp.js} +4 -4
  121. package/dist/{chunk-vd1rk42q.js.map → chunk-8xnz9vvp.js.map} +1 -1
  122. package/dist/chunk-9mab3dvg.js.map +1 -1
  123. package/dist/chunk-9tc8dxmn.js.map +1 -1
  124. package/dist/chunk-9x8dybsb.js.map +2 -2
  125. package/dist/chunk-a3faa34j.js.map +1 -1
  126. package/dist/{chunk-62a63pr6.js → chunk-axb4ss9a.js} +7 -7
  127. package/dist/{chunk-62a63pr6.js.map → chunk-axb4ss9a.js.map} +2 -2
  128. package/dist/{chunk-z3ryd53f.js → chunk-b6ghvap7.js} +35 -11
  129. package/dist/{chunk-z3ryd53f.js.map → chunk-b6ghvap7.js.map} +3 -3
  130. package/dist/{chunk-sqfvnvqj.js → chunk-c14ap3s9.js} +2 -2
  131. package/dist/{chunk-sqfvnvqj.js.map → chunk-c14ap3s9.js.map} +1 -1
  132. package/dist/{chunk-661ezhks.js → chunk-cbcgs9f7.js} +87 -8
  133. package/dist/chunk-cbcgs9f7.js.map +11 -0
  134. package/dist/chunk-cwdzcv37.js.map +1 -1
  135. package/dist/{chunk-bab05bhg.js → chunk-dgtd0836.js} +1 -1
  136. package/dist/{chunk-1j6j0rht.js → chunk-e24fvw8g.js} +1 -1
  137. package/dist/{chunk-1j6j0rht.js.map → chunk-e24fvw8g.js.map} +1 -1
  138. package/dist/chunk-e5wf5vz0.js.map +1 -1
  139. package/dist/chunk-eptrvnby.js.map +1 -1
  140. package/dist/chunk-ey1nk510.js.map +1 -1
  141. package/dist/{chunk-j936th07.js → chunk-fakrpfy3.js} +58 -58
  142. package/dist/{chunk-j936th07.js.map → chunk-fakrpfy3.js.map} +5 -5
  143. package/dist/chunk-fb3feg1e.js.map +1 -1
  144. package/dist/chunk-ff5xkv0p.js.map +1 -1
  145. package/dist/chunk-fntqb7qy.js.map +1 -1
  146. package/dist/{chunk-7ny9mjgm.js → chunk-ft3w5ahs.js} +1 -1
  147. package/dist/chunk-g663fahq.js.map +1 -1
  148. package/dist/{chunk-cdk3egjj.js → chunk-h1na2cxc.js} +1 -1
  149. package/dist/{chunk-cdk3egjj.js.map → chunk-h1na2cxc.js.map} +1 -1
  150. package/dist/chunk-hn2r7z41.js.map +1 -1
  151. package/dist/{chunk-24bqx0dx.js → chunk-hn76sanm.js} +1 -1
  152. package/dist/{chunk-24bqx0dx.js.map → chunk-hn76sanm.js.map} +1 -1
  153. package/dist/chunk-jmfet9r4.js.map +1 -1
  154. package/dist/{chunk-bnr4a734.js → chunk-jn3ysaf2.js} +24 -22
  155. package/dist/{chunk-bnr4a734.js.map → chunk-jn3ysaf2.js.map} +5 -5
  156. package/dist/{chunk-4y26vs3v.js → chunk-jspskey0.js} +16 -3
  157. package/dist/chunk-jspskey0.js.map +10 -0
  158. package/dist/{chunk-r6szek0x.js → chunk-jt3r6thp.js} +2 -135
  159. package/dist/chunk-jt3r6thp.js.map +10 -0
  160. package/dist/chunk-kfee1h52.js.map +1 -1
  161. package/dist/{chunk-qx00vjrj.js → chunk-kwfhd1g0.js} +23 -23
  162. package/dist/{chunk-qx00vjrj.js.map → chunk-kwfhd1g0.js.map} +4 -4
  163. package/dist/chunk-m427qgq0.js.map +1 -1
  164. package/dist/chunk-mbsbxarb.js.map +1 -1
  165. package/dist/{chunk-et017krg.js → chunk-mdxmt0n3.js} +8657 -8704
  166. package/dist/{chunk-et017krg.js.map → chunk-mdxmt0n3.js.map} +37 -37
  167. package/dist/chunk-mmagke4x.js.map +1 -1
  168. package/dist/{chunk-2x19q6k6.js → chunk-mqx25wwh.js} +319 -154
  169. package/dist/chunk-mqx25wwh.js.map +18 -0
  170. package/dist/chunk-mzx71snp.js.map +1 -1
  171. package/dist/chunk-n8q5j6y5.js.map +1 -1
  172. package/dist/chunk-npcr0228.js.map +1 -1
  173. package/dist/{chunk-m2nevja0.js → chunk-phm3c7b9.js} +1 -1
  174. package/dist/{chunk-m2nevja0.js.map → chunk-phm3c7b9.js.map} +1 -1
  175. package/dist/chunk-qf954wje.js.map +1 -1
  176. package/dist/{chunk-65pyhyas.js → chunk-qgvbxfqv.js} +6 -8
  177. package/dist/{chunk-65pyhyas.js.map → chunk-qgvbxfqv.js.map} +2 -2
  178. package/dist/{chunk-hk38wahh.js → chunk-qst145py.js} +4 -4
  179. package/dist/{chunk-hk38wahh.js.map → chunk-qst145py.js.map} +1 -1
  180. package/dist/{chunk-c844dkwd.js → chunk-qtzftvxa.js} +4 -5
  181. package/dist/{chunk-c844dkwd.js.map → chunk-qtzftvxa.js.map} +2 -2
  182. package/dist/chunk-ratkv4zc.js +3 -0
  183. package/dist/chunk-ratkv4zc.js.map +9 -0
  184. package/dist/{chunk-nzapm6p0.js → chunk-s3we74h8.js} +1 -2
  185. package/dist/chunk-s3we74h8.js.map +12 -0
  186. package/dist/{chunk-0xmt5p5y.js → chunk-t3brw0wd.js} +1 -2
  187. package/dist/{chunk-0xmt5p5y.js.map → chunk-t3brw0wd.js.map} +2 -2
  188. package/dist/chunk-t5608tkq.js.map +1 -1
  189. package/dist/chunk-tdxfsg1c.js.map +1 -1
  190. package/dist/{chunk-1t6k1avb.js → chunk-tnhqtfea.js} +1 -1
  191. package/dist/chunk-vhbw5sqm.js.map +1 -1
  192. package/dist/{chunk-rp9wwk7b.js → chunk-vx4e4zv4.js} +30 -30
  193. package/dist/{chunk-rp9wwk7b.js.map → chunk-vx4e4zv4.js.map} +4 -4
  194. package/dist/chunk-waqk73p1.js.map +1 -1
  195. package/dist/chunk-x0v3jd47.js.map +1 -1
  196. package/dist/{chunk-yecwnwpq.js → chunk-xm8qgbqm.js} +58 -29
  197. package/dist/{chunk-yecwnwpq.js.map → chunk-xm8qgbqm.js.map} +7 -7
  198. package/dist/{chunk-97wr6p2g.js → chunk-y7j6x4h0.js} +8 -8
  199. package/dist/{chunk-97wr6p2g.js.map → chunk-y7j6x4h0.js.map} +4 -4
  200. package/dist/{chunk-xe0732g0.js → chunk-yavhtnac.js} +12 -8
  201. package/dist/{chunk-xe0732g0.js.map → chunk-yavhtnac.js.map} +4 -4
  202. package/dist/chunk-yd00vzqr.js +3394 -0
  203. package/dist/chunk-yd00vzqr.js.map +37 -0
  204. package/dist/{chunk-n9w3n38q.js → chunk-ye5c8016.js} +54 -8
  205. package/dist/chunk-ye5c8016.js.map +23 -0
  206. package/dist/chunk-yw9pyg66.js.map +1 -1
  207. package/dist/{chunk-nydf3dbe.js → chunk-z9mg7wya.js} +37 -20
  208. package/dist/chunk-z9mg7wya.js.map +13 -0
  209. package/dist/chunk-zbc929zg.js.map +1 -1
  210. package/dist/chunk-zhh1jd89.js +290 -0
  211. package/dist/chunk-zhh1jd89.js.map +10 -0
  212. package/dist/connectors/connections/authorizations.d.ts +2 -2
  213. package/dist/connectors/connections/authorizations.d.ts.map +1 -1
  214. package/dist/connectors/connections/service.d.ts.map +1 -1
  215. package/dist/connectors/connections/tokens.d.ts +2 -2
  216. package/dist/connectors/connections/tokens.d.ts.map +1 -1
  217. package/dist/connectors/connections/validation.d.ts +5 -0
  218. package/dist/connectors/connections/validation.d.ts.map +1 -1
  219. package/dist/connectors/types.d.ts +9 -2
  220. package/dist/connectors/types.d.ts.map +1 -1
  221. package/dist/datasets/write.js +3 -3
  222. package/dist/deploy/internal.js +2 -5
  223. package/dist/deploy/internal.js.map +3 -3
  224. package/dist/deploy/types.d.ts +0 -2
  225. package/dist/deploy/types.d.ts.map +1 -1
  226. package/dist/execution/agent.d.ts +2 -2
  227. package/dist/execution/agent.d.ts.map +1 -1
  228. package/dist/execution/agent.js +38 -38
  229. package/dist/execution/agent.js.map +1 -1
  230. package/dist/execution/primitive.js +35 -35
  231. package/dist/execution/request.js +37 -37
  232. package/dist/execution/request.js.map +2 -2
  233. package/dist/http/api-routes.d.ts +12 -11
  234. package/dist/http/api-routes.d.ts.map +1 -1
  235. package/dist/http/index.js +1 -1
  236. package/dist/index.d.ts +3 -3
  237. package/dist/index.d.ts.map +1 -1
  238. package/dist/index.js +53 -51
  239. package/dist/index.js.map +1 -1
  240. package/dist/lake-storage/index.js +3 -3
  241. package/dist/logging/internal.js +1 -1
  242. package/dist/materializer/index.js +17 -17
  243. package/dist/models/execution/errors.d.ts +5 -0
  244. package/dist/models/execution/errors.d.ts.map +1 -1
  245. package/dist/models/execution/index.d.ts +2 -1
  246. package/dist/models/execution/index.d.ts.map +1 -1
  247. package/dist/models/execution/index.js +55 -50
  248. package/dist/models/execution/index.js.map +1 -1
  249. package/dist/models/execution/model-call-recorder.d.ts +7 -2
  250. package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
  251. package/dist/models/execution.d.ts.map +1 -1
  252. package/dist/models/language-call.d.ts +51 -0
  253. package/dist/models/language-call.d.ts.map +1 -0
  254. package/dist/objects/index.js +35 -35
  255. package/dist/objects/query/index.js +17 -17
  256. package/dist/ontology/docs-markdown.d.ts.map +1 -1
  257. package/dist/ontology/index.d.ts +1 -1
  258. package/dist/ontology/index.d.ts.map +1 -1
  259. package/dist/ontology/index.js +4 -4
  260. package/dist/ontology/internal.js +8 -275
  261. package/dist/ontology/internal.js.map +3 -4
  262. package/dist/ontology/user-ref.d.ts +21 -3
  263. package/dist/ontology/user-ref.d.ts.map +1 -1
  264. package/dist/pipelines/index.js +19 -19
  265. package/dist/projections/builders.d.ts +13 -2
  266. package/dist/projections/builders.d.ts.map +1 -1
  267. package/dist/projections/index.d.ts +1 -1
  268. package/dist/projections/index.d.ts.map +1 -1
  269. package/dist/projections/internal.js +17 -17
  270. package/dist/projections/types.d.ts +7 -0
  271. package/dist/projections/types.d.ts.map +1 -1
  272. package/dist/projections/validation.d.ts +2 -0
  273. package/dist/projections/validation.d.ts.map +1 -1
  274. package/dist/query.js +2 -2
  275. package/dist/queues/in-memory.d.ts +0 -1
  276. package/dist/queues/in-memory.d.ts.map +1 -1
  277. package/dist/queues/index.d.ts +1 -1
  278. package/dist/queues/index.d.ts.map +1 -1
  279. package/dist/queues/index.js +1 -1
  280. package/dist/queues/types.d.ts +0 -8
  281. package/dist/queues/types.d.ts.map +1 -1
  282. package/dist/runtime/internal.js +23 -23
  283. package/dist/runtime/internal.js.map +1 -1
  284. package/dist/sandboxes/configuration.d.ts +4 -6
  285. package/dist/sandboxes/configuration.d.ts.map +1 -1
  286. package/dist/sandboxes/environment.d.ts.map +1 -1
  287. package/dist/sandboxes/exec.d.ts +5 -3
  288. package/dist/sandboxes/exec.d.ts.map +1 -1
  289. package/dist/sandboxes/guest-credentials.d.ts +61 -0
  290. package/dist/sandboxes/guest-credentials.d.ts.map +1 -0
  291. package/dist/sandboxes/index.d.ts +2 -0
  292. package/dist/sandboxes/index.d.ts.map +1 -1
  293. package/dist/sandboxes/index.js +23 -9
  294. package/dist/sandboxes/index.js.map +1 -1
  295. package/dist/sandboxes/sandbox.d.ts +18 -4
  296. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  297. package/dist/security/internal.js +1 -1
  298. package/dist/security/internal.js.map +1 -1
  299. package/dist/shares/internal.js +17 -17
  300. package/dist/shares/internal.js.map +1 -1
  301. package/dist/storage/agents/in-memory.d.ts +3 -1
  302. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  303. package/dist/storage/agents/index.d.ts +1 -1
  304. package/dist/storage/agents/index.d.ts.map +1 -1
  305. package/dist/storage/agents/provider.d.ts +6 -0
  306. package/dist/storage/agents/provider.d.ts.map +1 -1
  307. package/dist/storage/agents/provider.js +8 -2
  308. package/dist/storage/agents/provider.js.map +1 -1
  309. package/dist/storage/agents/types.d.ts +63 -7
  310. package/dist/storage/agents/types.d.ts.map +1 -1
  311. package/dist/storage/ai-cost/provider.js +2 -2
  312. package/dist/storage/connector-connections/provider.js.map +1 -1
  313. package/dist/storage/file-upload-sessions/provider.js +9 -9
  314. package/dist/storage/index.d.ts +1 -1
  315. package/dist/storage/index.d.ts.map +1 -1
  316. package/dist/storage/index.js +15 -15
  317. package/dist/storage/ontology/provider.js +1 -1
  318. package/dist/storage/share-grants/provider.js +3 -3
  319. package/dist/storage/types.d.ts +1 -1
  320. package/dist/storage/types.d.ts.map +1 -1
  321. package/dist/storage/workflow-runs/provider.js +9 -9
  322. package/dist/syncs/index.js +20 -20
  323. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  324. package/dist/testing/index.d.ts +2 -0
  325. package/dist/testing/index.d.ts.map +1 -1
  326. package/dist/testing/index.js +677 -352
  327. package/dist/testing/index.js.map +9 -7
  328. package/dist/testing/queues-contract.d.ts.map +1 -1
  329. package/dist/testing/sandbox-credentials-contract.d.ts +27 -0
  330. package/dist/testing/sandbox-credentials-contract.d.ts.map +1 -0
  331. package/dist/testing/sandboxes-contract.d.ts.map +1 -1
  332. package/dist/testing/users.d.ts +20 -0
  333. package/dist/testing/users.d.ts.map +1 -0
  334. package/dist/users/execution.d.ts +6 -2
  335. package/dist/users/execution.d.ts.map +1 -1
  336. package/dist/users/index.d.ts +1 -1
  337. package/dist/users/index.d.ts.map +1 -1
  338. package/dist/webhooks/internal.js +17 -17
  339. package/dist/webhooks/internal.js.map +1 -1
  340. package/dist/workers/index.js.map +1 -1
  341. package/dist/workflows/index.js +41 -39
  342. package/dist/workflows/index.js.map +1 -1
  343. package/package.json +1 -1
  344. package/src/agents/README.md +136 -0
  345. package/src/agents/attachment-keys.ts +83 -0
  346. package/src/agents/cancel.ts +16 -1
  347. package/src/agents/children.ts +5 -3
  348. package/src/agents/dispatch.ts +6 -58
  349. package/src/agents/execution.ts +18 -0
  350. package/src/agents/index.ts +127 -21
  351. package/src/agents/model-loop.ts +23 -73
  352. package/src/agents/model-routing.ts +7 -2
  353. package/src/agents/request.ts +69 -20
  354. package/src/agents/run-after-finish.ts +133 -0
  355. package/src/agents/run-artifacts.ts +257 -0
  356. package/src/agents/run-events.ts +302 -0
  357. package/src/agents/run-fence.ts +71 -0
  358. package/src/agents/run-liveness.ts +122 -0
  359. package/src/agents/run-plan.ts +316 -0
  360. package/src/agents/run-session-children.ts +303 -0
  361. package/src/agents/run-session-http.ts +397 -0
  362. package/src/agents/run-session-serve.ts +479 -0
  363. package/src/agents/run-session-wire.ts +189 -0
  364. package/src/agents/run-session.ts +802 -0
  365. package/src/agents/run-token.ts +124 -0
  366. package/src/agents/run-tools.ts +180 -0
  367. package/src/agents/run-turn.ts +265 -0
  368. package/src/agents/streams/internal.ts +0 -1
  369. package/src/agents/streams/protocol.ts +0 -292
  370. package/src/agents/subagent-runs.ts +19 -1
  371. package/src/agents/tool-files.ts +225 -0
  372. package/src/agents/workflow-node-session.ts +387 -0
  373. package/src/artifacts/publish/index.ts +1 -0
  374. package/src/connectors/connections/authorizations.ts +3 -2
  375. package/src/connectors/connections/service.ts +5 -1
  376. package/src/connectors/connections/tokens.ts +41 -5
  377. package/src/connectors/connections/validation.ts +21 -0
  378. package/src/connectors/types.ts +12 -2
  379. package/src/deploy/types.ts +0 -2
  380. package/src/deploy/validation.ts +1 -4
  381. package/src/execution/agent.ts +2 -2
  382. package/src/execution/authorized-object-reader.ts +28 -1
  383. package/src/http/api-routes.ts +114 -27
  384. package/src/index.ts +3 -1
  385. package/src/models/execution/README.md +15 -1
  386. package/src/models/execution/errors.ts +14 -0
  387. package/src/models/execution/index.ts +2 -1
  388. package/src/models/execution/model-call-recorder.ts +12 -10
  389. package/src/models/execution.ts +9 -11
  390. package/src/models/language-call.ts +247 -0
  391. package/src/ontology/docs-markdown.ts +14 -0
  392. package/src/ontology/index.ts +1 -1
  393. package/src/ontology/user-ref.ts +40 -6
  394. package/src/projections/builders.ts +48 -4
  395. package/src/projections/index.ts +1 -0
  396. package/src/projections/registry.ts +1 -0
  397. package/src/projections/revision.ts +10 -0
  398. package/src/projections/types.ts +8 -0
  399. package/src/projections/validation.ts +52 -6
  400. package/src/queues/in-memory.ts +0 -5
  401. package/src/queues/index.ts +0 -2
  402. package/src/queues/types.ts +0 -13
  403. package/src/runtime/host.ts +1 -1
  404. package/src/sandboxes/README.md +17 -6
  405. package/src/sandboxes/configuration.ts +7 -9
  406. package/src/sandboxes/environment.ts +1 -0
  407. package/src/sandboxes/exec.ts +17 -9
  408. package/src/sandboxes/guest-credentials.ts +262 -0
  409. package/src/sandboxes/index.ts +14 -0
  410. package/src/sandboxes/sandbox.ts +19 -4
  411. package/src/storage/agents/in-memory.ts +53 -0
  412. package/src/storage/agents/index.ts +2 -0
  413. package/src/storage/agents/provider.ts +56 -11
  414. package/src/storage/agents/types.ts +59 -7
  415. package/src/storage/index.ts +2 -0
  416. package/src/storage/types.ts +1 -0
  417. package/src/testing/agent-storage-contract.ts +175 -2
  418. package/src/testing/ai-model-call-groups-contract.ts +0 -1
  419. package/src/testing/index.ts +5 -0
  420. package/src/testing/queues-contract.ts +0 -16
  421. package/src/testing/sandbox-credentials-contract.ts +284 -0
  422. package/src/testing/sandboxes-contract.ts +21 -0
  423. package/src/testing/users.ts +39 -0
  424. package/src/users/execution.ts +33 -7
  425. package/src/users/index.ts +7 -1
  426. package/dist/agents/api-gateway.d.ts +0 -26
  427. package/dist/agents/api-gateway.d.ts.map +0 -1
  428. package/dist/chunk-2x19q6k6.js.map +0 -17
  429. package/dist/chunk-4y26vs3v.js.map +0 -10
  430. package/dist/chunk-661ezhks.js.map +0 -11
  431. package/dist/chunk-d2m879s4.js.map +0 -12
  432. package/dist/chunk-n9w3n38q.js.map +0 -23
  433. package/dist/chunk-nydf3dbe.js.map +0 -13
  434. package/dist/chunk-nzapm6p0.js.map +0 -12
  435. package/dist/chunk-r6szek0x.js.map +0 -10
  436. package/dist/chunk-vabga7fk.js +0 -176
  437. package/dist/chunk-vabga7fk.js.map +0 -12
  438. package/dist/chunk-vpgwq5nf.js +0 -810
  439. package/dist/chunk-vpgwq5nf.js.map +0 -21
  440. package/src/agents/api-gateway.ts +0 -68
  441. /package/dist/{chunk-2gjj5dx3.js.map → chunk-78ymxrn0.js.map} +0 -0
  442. /package/dist/{chunk-6n69k945.js.map → chunk-8mb7mt8n.js.map} +0 -0
  443. /package/dist/{chunk-m36fw8ft.js.map → chunk-8wsjr52f.js.map} +0 -0
  444. /package/dist/{chunk-bab05bhg.js.map → chunk-dgtd0836.js.map} +0 -0
  445. /package/dist/{chunk-7ny9mjgm.js.map → chunk-ft3w5ahs.js.map} +0 -0
  446. /package/dist/{chunk-1t6k1avb.js.map → chunk-tnhqtfea.js.map} +0 -0
@@ -2,10 +2,10 @@
2
2
  * The single source of truth for the Sixb HTTP API surface and its auth capabilities.
3
3
  *
4
4
  * Two views are derived from this one table:
5
- * - `AGENT_API_ROUTES` (@sixb/core agent gateway) = the `agentApi` rows, projected to {method, path}.
5
+ * - `AGENT_API_ROUTES` (@sixb/core run tokens) = the `agentApi` rows, projected to {method, path}.
6
6
  * - `ACCESS_TOKEN_ROUTES` (@sixb/server bearer boundary) = the `accessToken` rows, with operationId.
7
7
  *
8
- * Because both views are projections of this table, the agent gateway allow-list is structurally a
8
+ * Because both views are projections of this table, what a run token may call is structurally a
9
9
  * subset of the bearer boundary — the invariant below enforces `agentApi ⇒ accessToken` at load
10
10
  * time. This table lives in @sixb/core (never @sixb/server) because @sixb/server depends on core,
11
11
  * not the reverse; the operationId strings are opaque here.
@@ -17,11 +17,11 @@ export interface SixbApiRoute {
17
17
  readonly path: string
18
18
  /** The route accepts a bearer access token (enforced by the server access-token boundary). */
19
19
  readonly accessToken: boolean
20
- /** The route is proxied by the agent API gateway (a strict subset of the accessToken routes). */
20
+ /** A run token may call the route (a strict subset of the accessToken routes). */
21
21
  readonly agentApi: boolean
22
22
  /**
23
- * What the route changes when the Agent calls it, for every `agentApi` route but a GET. The
24
- * gateway holds `action` and `workflow` calls for the requester's approval when their mode asks.
23
+ * What the route changes when the Agent calls it, for every `agentApi` route but a GET. A run
24
+ * token's `action` and `workflow` calls wait for the requester's approval when their mode asks.
25
25
  */
26
26
  readonly agentEffect?: AgentApiEffect
27
27
  /** The canonical handler may run under an explicitly selected shared session. */
@@ -30,9 +30,17 @@ export interface SixbApiRoute {
30
30
 
31
31
  /**
32
32
  * `read` changes nothing (a read sent as POST); `memory` writes the Agent's own notes; `file` stores
33
- * a blob nothing points at yet; `model` costs what AI limits already bound.
33
+ * a blob nothing points at yet; `model` costs what AI limits already bound; `artifact` publishes
34
+ * into the run's conversation.
34
35
  */
35
- export type AgentApiEffect = "read" | "action" | "workflow" | "memory" | "file" | "model"
36
+ export type AgentApiEffect =
37
+ | "read"
38
+ | "action"
39
+ | "workflow"
40
+ | "memory"
41
+ | "file"
42
+ | "model"
43
+ | "artifact"
36
44
 
37
45
  export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
38
46
  {
@@ -230,8 +238,8 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
230
238
  },
231
239
  // The four write routes. Bearer-capable because their execution facade enforces authorization
232
240
  // (`edit:object` / `append:telemetry`), which is exactly the precondition this table requires.
233
- // NOT agent-proxied: letting an agent turn write objects on its own is a separate decision, and
234
- // the gateway already hands routes an execution SDK, so flipping `agentApi` later needs no
241
+ // NOT open to run tokens: letting an agent turn write objects on its own is a separate decision,
242
+ // and a run token's request already runs as its run, so flipping `agentApi` later needs no
235
243
  // authorization work — only that decision.
236
244
  {
237
245
  operationId: "upsertObject",
@@ -295,10 +303,8 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
295
303
  sharedSession: true,
296
304
  },
297
305
  {
298
- // Bearer-capable (CLI/programmatic existence + range probes) but NOT agent-proxied: the agent
299
- // API gateway only forwards GET/POST, and an agent gains nothing from HEAD over GET (a file's
300
- // size already travels in its FileRef). Keeping this agentApi:true would throw at gateway
301
- // registration ("Unsupported agent API gateway method 'HEAD'") and stop the server booting.
306
+ // Bearer-capable (CLI/programmatic existence + range probes) but NOT open to run tokens: an
307
+ // agent gains nothing from HEAD over GET (a file's size already travels in its FileRef).
302
308
  operationId: "headObjectFileContent",
303
309
  method: "HEAD",
304
310
  path: "/api/objects/:objectTypeId/:objectId/files/content",
@@ -477,7 +483,7 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
477
483
  agentApi: false,
478
484
  },
479
485
  // The Agent reads and saves its memory with `sixb memory` in its sandbox. Its history and deleting
480
- // a repo are for people, so they stay off the gateway.
486
+ // a repo are for people, so run tokens can't reach them.
481
487
  {
482
488
  operationId: "getAgentMemory",
483
489
  method: "GET",
@@ -507,28 +513,29 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
507
513
  accessToken: true,
508
514
  agentApi: false,
509
515
  },
510
- // Artifacts are reachable with an access token, so the CLI and integrations can publish them. The
511
- // Agent publishes through its own tool, not the gateway.
516
+ // Artifacts are reachable with an access token, so the CLI and integrations can publish them. A
517
+ // run token reads them as the run's requester, and publishes into the run's conversation.
512
518
  {
513
519
  operationId: "listArtifacts",
514
520
  method: "GET",
515
521
  path: "/api/artifacts",
516
522
  accessToken: true,
517
- agentApi: false,
523
+ agentApi: true,
518
524
  },
519
525
  {
520
526
  operationId: "createArtifact",
521
527
  method: "POST",
522
528
  path: "/api/artifacts",
523
529
  accessToken: true,
524
- agentApi: false,
530
+ agentApi: true,
531
+ agentEffect: "artifact",
525
532
  },
526
533
  {
527
534
  operationId: "getArtifact",
528
535
  method: "GET",
529
536
  path: "/api/artifacts/:artifactId",
530
537
  accessToken: true,
531
- agentApi: false,
538
+ agentApi: true,
532
539
  },
533
540
  {
534
541
  operationId: "deleteArtifact",
@@ -570,21 +577,22 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
570
577
  method: "POST",
571
578
  path: "/api/artifacts/:artifactId/versions",
572
579
  accessToken: true,
573
- agentApi: false,
580
+ agentApi: true,
581
+ agentEffect: "artifact",
574
582
  },
575
583
  {
576
584
  operationId: "getArtifactVersion",
577
585
  method: "GET",
578
586
  path: "/api/artifacts/:artifactId/versions/:version",
579
587
  accessToken: true,
580
- agentApi: false,
588
+ agentApi: true,
581
589
  },
582
590
  {
583
591
  operationId: "getArtifactQuery",
584
592
  method: "GET",
585
593
  path: "/api/artifacts/:artifactId/versions/:version/queries/:name",
586
594
  accessToken: true,
587
- agentApi: false,
595
+ agentApi: true,
588
596
  },
589
597
  {
590
598
  operationId: "createArtifactFrame",
@@ -598,7 +606,7 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
598
606
  method: "GET",
599
607
  path: "/api/artifacts/:artifactId/versions/:version/content",
600
608
  accessToken: true,
601
- agentApi: false,
609
+ agentApi: true,
602
610
  },
603
611
  {
604
612
  operationId: "headArtifactFileContent",
@@ -703,6 +711,85 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
703
711
  accessToken: true,
704
712
  agentApi: true,
705
713
  },
714
+ // Data reads, for people and agents alike: datasets need dataset.view and redact marked columns;
715
+ // syncs and pipelines list only what the caller may run. Running them stays session-only.
716
+ {
717
+ operationId: "listDatasets",
718
+ method: "GET",
719
+ path: "/api/datasets",
720
+ accessToken: true,
721
+ agentApi: true,
722
+ },
723
+ {
724
+ operationId: "getDataset",
725
+ method: "GET",
726
+ path: "/api/datasets/:datasetId",
727
+ accessToken: true,
728
+ agentApi: true,
729
+ },
730
+ {
731
+ operationId: "listDatasetVersions",
732
+ method: "GET",
733
+ path: "/api/datasets/:datasetId/versions",
734
+ accessToken: true,
735
+ agentApi: true,
736
+ },
737
+ {
738
+ operationId: "listDatasetRows",
739
+ method: "GET",
740
+ path: "/api/datasets/:datasetId/rows",
741
+ accessToken: true,
742
+ agentApi: true,
743
+ },
744
+ {
745
+ operationId: "listSyncs",
746
+ method: "GET",
747
+ path: "/api/syncs",
748
+ accessToken: true,
749
+ agentApi: true,
750
+ },
751
+ {
752
+ operationId: "getSync",
753
+ method: "GET",
754
+ path: "/api/syncs/:syncId",
755
+ accessToken: true,
756
+ agentApi: true,
757
+ },
758
+ {
759
+ operationId: "listSyncRuns",
760
+ method: "GET",
761
+ path: "/api/sync-runs",
762
+ accessToken: true,
763
+ agentApi: true,
764
+ },
765
+ {
766
+ operationId: "listPipelines",
767
+ method: "GET",
768
+ path: "/api/pipelines",
769
+ accessToken: true,
770
+ agentApi: true,
771
+ },
772
+ {
773
+ operationId: "getPipeline",
774
+ method: "GET",
775
+ path: "/api/pipelines/:pipelineId",
776
+ accessToken: true,
777
+ agentApi: true,
778
+ },
779
+ {
780
+ operationId: "listPipelineRuns",
781
+ method: "GET",
782
+ path: "/api/pipeline-runs",
783
+ accessToken: true,
784
+ agentApi: true,
785
+ },
786
+ {
787
+ operationId: "getPipelineRun",
788
+ method: "GET",
789
+ path: "/api/pipeline-runs/:runId",
790
+ accessToken: true,
791
+ agentApi: true,
792
+ },
706
793
  {
707
794
  operationId: "listModels",
708
795
  method: "GET",
@@ -829,10 +916,10 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
829
916
  ]
830
917
 
831
918
  /**
832
- * The table's invariants, enforced at module load. A gateway-proxied route must also be a bearer
833
- * route, or the gateway would expose a surface the access-token boundary does not recognize. A
834
- * gateway-proxied route that can change state names what it changes, so a route added later cannot
835
- * skip the approval gate by accident.
919
+ * The table's invariants, enforced at module load. A route open to run tokens must also be a bearer
920
+ * route, or run tokens would reach a surface the access-token boundary does not recognize. One that
921
+ * can change state names what it changes, so a route added later cannot skip the approval gate by
922
+ * accident.
836
923
  */
837
924
  export function assertSixbApiRoutes(routes: readonly SixbApiRoute[]): void {
838
925
  for (const route of routes) {
package/src/index.ts CHANGED
@@ -45,6 +45,7 @@ export type {
45
45
  SchemaOrRef,
46
46
  SixbObjectTypeMap,
47
47
  SixbValueTypeMap,
48
+ UserEmailColumn,
48
49
  UserRef,
49
50
  ValueType,
50
51
  ValueTypeRefSchema,
@@ -445,7 +446,7 @@ export type {
445
446
  // ── Member directory ──────────────────────────────────────
446
447
 
447
448
  export type { UserStatus } from "./storage"
448
- export type { ListUsersInput, UserProfile, UsersPage, UsersRuntime } from "./users"
449
+ export type { ListUsersInput, UserLookup, UserProfile, UsersPage, UsersRuntime } from "./users"
449
450
 
450
451
  // ── Security Definitions ───────────────────────────────────
451
452
 
@@ -1351,6 +1352,7 @@ export type {
1351
1352
  ProjectionForeignKeyInput,
1352
1353
  ProjectionTarget,
1353
1354
  ProjectionTargetByKind,
1355
+ ProjectionUserKey,
1354
1356
  SourceEditConflictResolution,
1355
1357
  TelemetryProjectionDefinition,
1356
1358
  TelemetryProjectionPropertyMapping,
@@ -10,6 +10,20 @@ uses the durable execution's requester-group snapshot, so redelivery cannot chan
10
10
  Language execution and the scoped embedding catalog share that recorder and its failure state.
11
11
  Object authorization happens before embedding inference; wrapping a catalog does not grant access.
12
12
 
13
+ ## Language flow
14
+
15
+ ```text
16
+ recorder.wrapModel(model).stream(request)
17
+ → admit the call: reserve capacity before the provider sees it
18
+ → provider stream, handed on event by event (reportModelCalls, ../language-call.ts)
19
+ → at its finish: record usage and valuation, then pass the finish on
20
+ → cancelled, failed or unfinished: record it with its usage unknown
21
+ ```
22
+
23
+ The model records each call itself, whoever reads its stream: the Agent's loop, direct generation,
24
+ or a server that streams it to a remote runner. A call whose record cannot be written fails before
25
+ its reader sees it finish, and the record goes to recovery.
26
+
13
27
  ## Embedding flow
14
28
 
15
29
  ```text
@@ -44,7 +58,7 @@ replays accounting only, never inference; see the
44
58
  [worker recovery contract](../../../../agent-worker/docs/usage-accounting.md).
45
59
 
46
60
  An Agent run binds its own recorder to its SDK, so calls from its tools share the run's admission,
47
- failure state and cancellation. A request through the agent API gateway is served by the server,
61
+ failure state and cancellation. A request with the run's token is served by the server,
48
62
  not by the run's worker: it gets its own recorder on the run's execution and current attempt, and
49
63
  only its own request cancels it. Direct provider calls bypass this session. Webhook handlers have no
50
64
  bound model execution attempt; they must dispatch an action for accounted calls. A process crash
@@ -1,3 +1,5 @@
1
+ import { isSixbError } from "../../errors/internal"
2
+
1
3
  /** A provider call was not recorded synchronously, so its execution must stop. */
2
4
  export class ModelUsageRecordingError extends Error {
3
5
  readonly name = "ModelUsageRecordingError"
@@ -16,3 +18,15 @@ export class ModelUsageRecordingError extends Error {
16
18
  )
17
19
  }
18
20
  }
21
+
22
+ /**
23
+ * A model call refused or left unrecorded by the run's accounting: its AI limits refused it, or its
24
+ * record could not be written. The run ends with this failure, never one that relabels it.
25
+ */
26
+ export function isModelCallAccountingFailure(error: unknown): boolean {
27
+ return (
28
+ error instanceof ModelUsageRecordingError ||
29
+ (isSixbError(error) &&
30
+ (error.code === "ai.usage_limit_exceeded" || error.code === "ai.usage_limit_unavailable"))
31
+ )
32
+ }
@@ -3,8 +3,9 @@ export {
3
3
  isLanguageModelTier,
4
4
  selectLanguageModel,
5
5
  } from "../catalog"
6
+ export { reportModelCalls } from "../language-call"
6
7
  export { resolveLanguageModel } from "../resolve"
7
- export { ModelUsageRecordingError } from "./errors"
8
+ export { isModelCallAccountingFailure, ModelUsageRecordingError } from "./errors"
8
9
  export type {
9
10
  AiModelCallAdmissionDecision,
10
11
  AiModelCallAdmissionInput,
@@ -6,6 +6,7 @@ import {
6
6
  type RecordAiModelCallInput,
7
7
  } from "../../storage"
8
8
  import type { ModelCallEndEvent, ModelUsage } from "../events"
9
+ import { reportModelCalls } from "../language-call"
9
10
  import type { LanguageModel } from "../language-model"
10
11
  import { ModelUsageRecordingError } from "./errors"
11
12
  import {
@@ -48,7 +49,7 @@ interface AiModelCallRecorderInternals {
48
49
  readonly recordAccounting?: (input: RecoverAiModelCallInput) => Promise<void>
49
50
  }
50
51
 
51
- /** Persist every completed provider call before another billable loop step can start. */
52
+ /** Admit every model call against the execution's limits, and record each before it is over. */
52
53
  export class AiModelCallRecorder {
53
54
  private readonly generateId: () => string
54
55
  private readonly now: () => Date
@@ -85,16 +86,17 @@ export class AiModelCallRecorder {
85
86
  return this.input.attempt
86
87
  }
87
88
 
88
- /** Wrap the resolved model so all calls in an execution share admission. */
89
+ /**
90
+ * Wrap the resolved model so every call it makes is admitted against the execution's limits and
91
+ * records itself: the wrapper reads the stream it hands on, and records the call when it finishes,
92
+ * before its `finish` event reaches the reader, or when it ends otherwise, its usage unknown. Who
93
+ * reads the stream never reports what the call used.
94
+ */
89
95
  wrapModel(model: LanguageModel): LanguageModel {
96
+ const recorded = reportModelCalls(model, this.onModelCallEnd)
97
+ // Its settings carried over, which whoever calls the model reads.
90
98
  return {
91
- providerId: model.providerId,
92
- modelId: model.modelId,
93
- definition: model.definition,
94
- costEstimator: model.costEstimator,
95
- ...(model.validateResponseFormat === undefined
96
- ? {}
97
- : { validateResponseFormat: model.validateResponseFormat.bind(model) }),
99
+ ...recorded,
98
100
  stream: async (request) => {
99
101
  this.assertHealthy()
100
102
  const inputTokens = estimateAiModelCallInputTokens({
@@ -113,7 +115,7 @@ export class AiModelCallRecorder {
113
115
  estimatedTotalTokens: estimatedAiModelCallTotalTokens(inputTokens, outputTokenAllowance),
114
116
  })
115
117
  try {
116
- return await model.stream(request)
118
+ return await recorded.stream(request)
117
119
  } catch (error) {
118
120
  await this.markCallUnknown(request.callId)
119
121
  throw error
@@ -1,3 +1,4 @@
1
+ import { randomUUID } from "node:crypto"
1
2
  import { runModelLoop } from "../agents/model-loop"
2
3
  import { assertModelAccess, canAccessModels } from "../authorization"
3
4
  import type { BlobStorage } from "../blob-storage/types"
@@ -8,7 +9,6 @@ import { createModelCallsRuntime, type ModelCallRunVisibility } from "./calls"
8
9
  import { type ModelCatalog, selectLanguageModel } from "./catalog"
9
10
  import { createDecisionRuntime } from "./decision/runtime"
10
11
  import { ModelProviderError, ModelStreamError, UnsupportedModelFeatureError } from "./errors"
11
- import type { ModelCallEndEvent } from "./events"
12
12
  import { registerModelExecutionBinding } from "./execution/binding"
13
13
  import { aiModelCallOutputTokenAllowance } from "./execution/model-call-admission"
14
14
  import type { ModelExecutionSession } from "./execution/session"
@@ -85,9 +85,11 @@ export function createModelsRuntime(
85
85
  const accounting = await session.accounting()
86
86
  accounting.assertHealthy()
87
87
  signal.throwIfAborted()
88
- let event: ModelCallEndEvent | undefined
88
+ // The wrapped model records the call; its one step says what the call used and cost.
89
+ const callId = `model_call_${randomUUID()}`
89
90
  const options = {
90
91
  model: accounting.wrapModel(model),
92
+ generateCallId: () => callId,
91
93
  messages,
92
94
  maxSteps: 1,
93
95
  rejectLocalToolCalls: true,
@@ -95,10 +97,6 @@ export function createModelsRuntime(
95
97
  reasoning,
96
98
  caching: input.caching,
97
99
  signal,
98
- onModelCallEnd: async (completed: ModelCallEndEvent) => {
99
- await accounting.onModelCallEnd(completed)
100
- event = completed
101
- },
102
100
  }
103
101
  const result = output ? await runModelLoop({ ...options, output }) : await runModelLoop(options)
104
102
  if (result.status === "aborted") {
@@ -112,13 +110,13 @@ export function createModelsRuntime(
112
110
  model.modelId
113
111
  )
114
112
  }
115
- if (!event)
116
- throw new ModelStreamError("[SixbModels] Generation completed without accounting metadata.")
113
+ const [step] = result.steps
114
+ if (!step) throw new ModelStreamError("[SixbModels] Generation completed without a model call.")
117
115
  return {
118
116
  output: result.output,
119
- usage: event.usage,
120
- cost: event.cost,
121
- callId: event.callId,
117
+ usage: step.usage,
118
+ cost: step.cost,
119
+ callId,
122
120
  finishReason: result.finishReason,
123
121
  }
124
122
  }