@sixb/core 0.2.6 → 0.2.8

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 (691) hide show
  1. package/dist/actions/index.js +53 -50
  2. package/dist/actions/index.js.map +1 -1
  3. package/dist/actions/request.d.ts.map +1 -1
  4. package/dist/actions/run/context.d.ts.map +1 -1
  5. package/dist/actions/run/execute.d.ts +3 -0
  6. package/dist/actions/run/execute.d.ts.map +1 -1
  7. package/dist/actions/run/executor.d.ts +3 -0
  8. package/dist/actions/run/executor.d.ts.map +1 -1
  9. package/dist/actions/run/normalize.d.ts.map +1 -1
  10. package/dist/actions/run/types.d.ts +6 -0
  11. package/dist/actions/run/types.d.ts.map +1 -1
  12. package/dist/actions/types/context.d.ts +7 -0
  13. package/dist/actions/types/context.d.ts.map +1 -1
  14. package/dist/agents/context/entries.d.ts +17 -0
  15. package/dist/agents/context/entries.d.ts.map +1 -1
  16. package/dist/agents/context/index.js +3 -2
  17. package/dist/agents/context/index.js.map +1 -1
  18. package/dist/agents/context-model.d.ts.map +1 -1
  19. package/dist/agents/context-resolution.d.ts.map +1 -1
  20. package/dist/agents/execution.d.ts +7 -0
  21. package/dist/agents/execution.d.ts.map +1 -1
  22. package/dist/agents/index.d.ts +1 -1
  23. package/dist/agents/index.d.ts.map +1 -1
  24. package/dist/agents/index.js +62 -57
  25. package/dist/agents/index.js.map +1 -1
  26. package/dist/agents/model-call-retry.d.ts +28 -0
  27. package/dist/agents/model-call-retry.d.ts.map +1 -0
  28. package/dist/agents/model-loop.d.ts +4 -2
  29. package/dist/agents/model-loop.d.ts.map +1 -1
  30. package/dist/agents/model-routing.d.ts +15 -4
  31. package/dist/agents/model-routing.d.ts.map +1 -1
  32. package/dist/agents/request.d.ts.map +1 -1
  33. package/dist/agents/run-artifacts.d.ts +2 -0
  34. package/dist/agents/run-artifacts.d.ts.map +1 -1
  35. package/dist/agents/run-plan.d.ts +1 -1
  36. package/dist/agents/run-plan.d.ts.map +1 -1
  37. package/dist/agents/run-session-http.d.ts.map +1 -1
  38. package/dist/agents/run-session-serve.d.ts.map +1 -1
  39. package/dist/agents/run-session-wire.d.ts +6 -0
  40. package/dist/agents/run-session-wire.d.ts.map +1 -1
  41. package/dist/agents/run-token.d.ts +6 -0
  42. package/dist/agents/run-token.d.ts.map +1 -1
  43. package/dist/agents/streams/index.js +1 -1
  44. package/dist/agents/streams/internal.js +2 -2
  45. package/dist/agents/thread-access.d.ts +13 -0
  46. package/dist/agents/thread-access.d.ts.map +1 -1
  47. package/dist/agents/tool-files.d.ts.map +1 -1
  48. package/dist/artifacts/caller.d.ts +10 -0
  49. package/dist/artifacts/caller.d.ts.map +1 -0
  50. package/dist/artifacts/comment-place.d.ts +26 -0
  51. package/dist/artifacts/comment-place.d.ts.map +1 -0
  52. package/dist/artifacts/comment-text.d.ts +12 -4
  53. package/dist/artifacts/comment-text.d.ts.map +1 -1
  54. package/dist/artifacts/comments.d.ts +8 -2
  55. package/dist/artifacts/comments.d.ts.map +1 -1
  56. package/dist/artifacts/errors.d.ts +1 -1
  57. package/dist/artifacts/errors.d.ts.map +1 -1
  58. package/dist/artifacts/execution.d.ts +73 -5
  59. package/dist/artifacts/execution.d.ts.map +1 -1
  60. package/dist/artifacts/frames/assets.d.ts +27 -7
  61. package/dist/artifacts/frames/assets.d.ts.map +1 -1
  62. package/dist/artifacts/frames/entries.d.ts +5 -4
  63. package/dist/artifacts/frames/entries.d.ts.map +1 -1
  64. package/dist/artifacts/frames/hyperframes.d.ts +12 -0
  65. package/dist/artifacts/frames/hyperframes.d.ts.map +1 -0
  66. package/dist/artifacts/frames/index.d.ts +3 -1
  67. package/dist/artifacts/frames/index.d.ts.map +1 -1
  68. package/dist/artifacts/frames/index.js +20 -6
  69. package/dist/artifacts/frames/index.js.map +3 -3
  70. package/dist/artifacts/frames/kit.d.ts.map +1 -1
  71. package/dist/artifacts/frames/protocol.d.ts +33 -0
  72. package/dist/artifacts/frames/protocol.d.ts.map +1 -1
  73. package/dist/artifacts/frames/video-runtime.d.ts +21 -0
  74. package/dist/artifacts/frames/video-runtime.d.ts.map +1 -0
  75. package/dist/artifacts/html.d.ts +23 -0
  76. package/dist/artifacts/html.d.ts.map +1 -1
  77. package/dist/artifacts/index.d.ts +5 -3
  78. package/dist/artifacts/index.d.ts.map +1 -1
  79. package/dist/artifacts/index.js +71 -10
  80. package/dist/artifacts/index.js.map +4 -4
  81. package/dist/artifacts/kinds.d.ts +1 -1
  82. package/dist/artifacts/kinds.d.ts.map +1 -1
  83. package/dist/artifacts/limits.d.ts +37 -0
  84. package/dist/artifacts/limits.d.ts.map +1 -1
  85. package/dist/artifacts/live/document.d.ts.map +1 -1
  86. package/dist/artifacts/live/index.d.ts +6 -2
  87. package/dist/artifacts/live/index.d.ts.map +1 -1
  88. package/dist/artifacts/live/index.js +3432 -13
  89. package/dist/artifacts/live/index.js.map +6 -3
  90. package/dist/artifacts/live/presence.d.ts +7 -5
  91. package/dist/artifacts/live/presence.d.ts.map +1 -1
  92. package/dist/artifacts/live/protocol.d.ts +4 -2
  93. package/dist/artifacts/live/protocol.d.ts.map +1 -1
  94. package/dist/artifacts/live/server.d.ts +1 -1
  95. package/dist/artifacts/live/server.d.ts.map +1 -1
  96. package/dist/artifacts/live/server.js +36 -31
  97. package/dist/artifacts/live/server.js.map +1 -1
  98. package/dist/artifacts/live/state.d.ts +2 -2
  99. package/dist/artifacts/media/media.d.ts +96 -0
  100. package/dist/artifacts/media/media.d.ts.map +1 -0
  101. package/dist/artifacts/media/transcriber.d.ts +29 -0
  102. package/dist/artifacts/media/transcriber.d.ts.map +1 -0
  103. package/dist/artifacts/outline.d.ts +26 -1
  104. package/dist/artifacts/outline.d.ts.map +1 -1
  105. package/dist/artifacts/publish/files.d.ts +5 -2
  106. package/dist/artifacts/publish/files.d.ts.map +1 -1
  107. package/dist/artifacts/publish/index.d.ts +11 -2
  108. package/dist/artifacts/publish/index.d.ts.map +1 -1
  109. package/dist/artifacts/publish/index.js +110 -33
  110. package/dist/artifacts/publish/index.js.map +1 -1
  111. package/dist/artifacts/publish/pdf.d.ts.map +1 -1
  112. package/dist/artifacts/publish/previews.d.ts +7 -2
  113. package/dist/artifacts/publish/previews.d.ts.map +1 -1
  114. package/dist/artifacts/publish/publish.d.ts.map +1 -1
  115. package/dist/artifacts/publish/validate/html.d.ts +5 -4
  116. package/dist/artifacts/publish/validate/html.d.ts.map +1 -1
  117. package/dist/artifacts/publish/validate/video.d.ts +36 -0
  118. package/dist/artifacts/publish/validate/video.d.ts.map +1 -0
  119. package/dist/artifacts/publish/video.d.ts +79 -0
  120. package/dist/artifacts/publish/video.d.ts.map +1 -0
  121. package/dist/artifacts/resolve.d.ts +9 -0
  122. package/dist/artifacts/resolve.d.ts.map +1 -1
  123. package/dist/artifacts/video/composition.d.ts +183 -0
  124. package/dist/artifacts/video/composition.d.ts.map +1 -0
  125. package/dist/artifacts/video/edit.d.ts +298 -0
  126. package/dist/artifacts/video/edit.d.ts.map +1 -0
  127. package/dist/artifacts/video/export.d.ts +142 -0
  128. package/dist/artifacts/video/export.d.ts.map +1 -0
  129. package/dist/artifacts/video/looks.d.ts +133 -0
  130. package/dist/artifacts/video/looks.d.ts.map +1 -0
  131. package/dist/artifacts/video/project.d.ts +74 -0
  132. package/dist/artifacts/video/project.d.ts.map +1 -0
  133. package/dist/artifacts/video/stills.d.ts +65 -0
  134. package/dist/artifacts/video/stills.d.ts.map +1 -0
  135. package/dist/artifacts/video/timeline.d.ts +153 -0
  136. package/dist/artifacts/video/timeline.d.ts.map +1 -0
  137. package/dist/auth/index.js +9 -8
  138. package/dist/auth/index.js.map +1 -1
  139. package/dist/authorization/index.js +5 -4
  140. package/dist/authorization/index.js.map +1 -1
  141. package/dist/blob-storage/browser.d.ts +1 -1
  142. package/dist/blob-storage/browser.d.ts.map +1 -1
  143. package/dist/blob-storage/browser.js +8 -4
  144. package/dist/blob-storage/browser.js.map +1 -1
  145. package/dist/blob-storage/constants.d.ts +8 -3
  146. package/dist/blob-storage/constants.d.ts.map +1 -1
  147. package/dist/blob-storage/download-urls.d.ts +2 -2
  148. package/dist/blob-storage/download-urls.d.ts.map +1 -1
  149. package/dist/blob-storage/index.d.ts +1 -1
  150. package/dist/blob-storage/index.d.ts.map +1 -1
  151. package/dist/blob-storage/index.js +9 -5
  152. package/dist/blob-storage/index.js.map +1 -1
  153. package/dist/blob-storage/internal.d.ts +2 -2
  154. package/dist/blob-storage/internal.d.ts.map +1 -1
  155. package/dist/blob-storage/internal.js +10 -4
  156. package/dist/blob-storage/internal.js.map +1 -1
  157. package/dist/blob-storage/media-type.d.ts +12 -3
  158. package/dist/blob-storage/media-type.d.ts.map +1 -1
  159. package/dist/bootstrap/discovery.d.ts +6 -0
  160. package/dist/bootstrap/discovery.d.ts.map +1 -1
  161. package/dist/bootstrap/index.js +63 -60
  162. package/dist/bootstrap/index.js.map +2 -2
  163. package/dist/{chunk-az95tsh3.js → chunk-0fjryajn.js} +3 -2
  164. package/dist/chunk-0fjryajn.js.map +11 -0
  165. package/dist/{chunk-9tpmfh3n.js → chunk-0mk8qqp9.js} +3 -3
  166. package/dist/{chunk-9tpmfh3n.js.map → chunk-0mk8qqp9.js.map} +3 -3
  167. package/dist/{chunk-88xeh6zx.js → chunk-1g4me5f2.js} +182 -7
  168. package/dist/{chunk-88xeh6zx.js.map → chunk-1g4me5f2.js.map} +3 -3
  169. package/dist/{chunk-7mhbs9yy.js → chunk-1z8ccj53.js} +1 -1
  170. package/dist/{chunk-wkv3h3q7.js → chunk-2138b0ng.js} +115 -8
  171. package/dist/chunk-2138b0ng.js.map +12 -0
  172. package/dist/chunk-23eaayw4.js +3757 -0
  173. package/dist/chunk-23eaayw4.js.map +22 -0
  174. package/dist/{chunk-s8xxef60.js → chunk-2mxq1yd9.js} +48 -41
  175. package/dist/{chunk-s8xxef60.js.map → chunk-2mxq1yd9.js.map} +6 -6
  176. package/dist/{chunk-dmnd9ea6.js → chunk-30a0ftnm.js} +2 -2
  177. package/dist/{chunk-nxysqbt0.js → chunk-389ybvw9.js} +6 -2
  178. package/dist/chunk-389ybvw9.js.map +10 -0
  179. package/dist/{chunk-qbd282aa.js → chunk-39q9ybav.js} +2 -2
  180. package/dist/{chunk-9c9yknwt.js → chunk-3d9w8t4n.js} +111 -23
  181. package/dist/{chunk-9c9yknwt.js.map → chunk-3d9w8t4n.js.map} +5 -5
  182. package/dist/chunk-3dvcdn9w.js +8 -0
  183. package/dist/chunk-3dvcdn9w.js.map +10 -0
  184. package/dist/{chunk-bcz9dxtf.js → chunk-3x902cja.js} +3 -3
  185. package/dist/{chunk-c4nrycdy.js → chunk-4q4a5a96.js} +1 -1
  186. package/dist/{chunk-7r9mqpva.js → chunk-4tdm3fsj.js} +100 -36
  187. package/dist/{chunk-7r9mqpva.js.map → chunk-4tdm3fsj.js.map} +10 -10
  188. package/dist/{chunk-ykchk644.js → chunk-4w8qzy9w.js} +6 -6
  189. package/dist/{chunk-c29729me.js → chunk-4z9xtxke.js} +8 -7
  190. package/dist/chunk-4z9xtxke.js.map +12 -0
  191. package/dist/chunk-5278qwax.js +270 -0
  192. package/dist/chunk-5278qwax.js.map +11 -0
  193. package/dist/{chunk-kft7mp7z.js → chunk-5xkqasvn.js} +1 -1
  194. package/dist/{chunk-k1g14kk3.js → chunk-6a4hp405.js} +4 -5
  195. package/dist/{chunk-k1g14kk3.js.map → chunk-6a4hp405.js.map} +3 -3
  196. package/dist/{chunk-xavet0qs.js → chunk-6whr25gw.js} +2 -2
  197. package/dist/{chunk-mbwsgjn7.js → chunk-7zygtcqq.js} +14 -2
  198. package/dist/chunk-7zygtcqq.js.map +11 -0
  199. package/dist/chunk-88s9z5pf.js +3 -0
  200. package/dist/{chunk-de5sfbc3.js.map → chunk-88s9z5pf.js.map} +1 -1
  201. package/dist/{chunk-ygvay56w.js → chunk-896te58g.js} +2 -2
  202. package/dist/{chunk-pqj8vff9.js → chunk-8eqqqc1h.js} +3 -3
  203. package/dist/{chunk-425ydk65.js → chunk-8tefbhdx.js} +14 -14
  204. package/dist/{chunk-425ydk65.js.map → chunk-8tefbhdx.js.map} +1 -1
  205. package/dist/{chunk-jka26v8c.js → chunk-8x1bsp68.js} +1 -1
  206. package/dist/{chunk-wzcjhv54.js → chunk-93e4w7te.js} +113 -1
  207. package/dist/chunk-93e4w7te.js.map +11 -0
  208. package/dist/{chunk-ym1bqd98.js → chunk-990a5bkc.js} +424 -76
  209. package/dist/chunk-990a5bkc.js.map +21 -0
  210. package/dist/{chunk-fmgf9h5e.js → chunk-9az7kjv4.js} +6 -6
  211. package/dist/{chunk-eg6xqef7.js → chunk-9e5t53z0.js} +3 -3
  212. package/dist/{chunk-eg6xqef7.js.map → chunk-9e5t53z0.js.map} +3 -3
  213. package/dist/{chunk-bs1sd0e0.js → chunk-9p7kyeqz.js} +4 -4
  214. package/dist/chunk-a68zz4r0.js +537 -0
  215. package/dist/chunk-a68zz4r0.js.map +11 -0
  216. package/dist/{chunk-d7vyc7k6.js → chunk-a700gjc8.js} +10 -2
  217. package/dist/chunk-a700gjc8.js.map +10 -0
  218. package/dist/{chunk-gfdh9kqa.js → chunk-a9qzjaz2.js} +2 -5
  219. package/dist/chunk-a9qzjaz2.js.map +10 -0
  220. package/dist/{chunk-ats8y3d9.js → chunk-as94vcty.js} +688 -504
  221. package/dist/{chunk-ats8y3d9.js.map → chunk-as94vcty.js.map} +21 -21
  222. package/dist/{chunk-brybqw5k.js → chunk-bkxm2dzx.js} +1 -1
  223. package/dist/{chunk-ppxf7gw2.js → chunk-d7t9jnym.js} +3 -3
  224. package/dist/{chunk-tapdssb5.js → chunk-e3b1r4d2.js} +8 -7
  225. package/dist/{chunk-tapdssb5.js.map → chunk-e3b1r4d2.js.map} +4 -4
  226. package/dist/{chunk-cg7cygfj.js → chunk-fdmvaz7x.js} +1 -1
  227. package/dist/{chunk-191jz8a6.js → chunk-ff0qdk7z.js} +1 -1
  228. package/dist/{chunk-9vsc919v.js → chunk-fgxvrxx4.js} +22 -2
  229. package/dist/chunk-fgxvrxx4.js.map +10 -0
  230. package/dist/{chunk-wx7smkn2.js → chunk-fq8drkp0.js} +1 -1
  231. package/dist/{chunk-60662fyv.js → chunk-fqms1a8c.js} +132 -4
  232. package/dist/{chunk-60662fyv.js.map → chunk-fqms1a8c.js.map} +8 -6
  233. package/dist/{chunk-v8a1qjzp.js → chunk-hpswfrjj.js} +1 -1
  234. package/dist/{chunk-qttqe1ah.js → chunk-jbg905hn.js} +80 -13
  235. package/dist/chunk-jbg905hn.js.map +25 -0
  236. package/dist/{chunk-bz5bnjjt.js → chunk-jjte0h4p.js} +1 -1
  237. package/dist/{chunk-jt012fxq.js → chunk-jwjwvzj1.js} +797 -51
  238. package/dist/chunk-jwjwvzj1.js.map +38 -0
  239. package/dist/{chunk-f05994as.js → chunk-k3vd2vyz.js} +6 -2
  240. package/dist/chunk-k3vd2vyz.js.map +10 -0
  241. package/dist/chunk-kcqpk9w1.js.map +2 -2
  242. package/dist/chunk-mvz89age.js.map +2 -2
  243. package/dist/{chunk-xrmbhap8.js → chunk-mwg0nwkb.js} +1 -1
  244. package/dist/{chunk-a3faa34j.js → chunk-nfjt8k8j.js} +1 -1
  245. package/dist/{chunk-394zjzjs.js → chunk-nhgqz3g3.js} +3 -3
  246. package/dist/{chunk-bqr703h4.js → chunk-p0c5kkhn.js} +23 -6
  247. package/dist/{chunk-bqr703h4.js.map → chunk-p0c5kkhn.js.map} +3 -3
  248. package/dist/{chunk-92wrka15.js → chunk-q150fnj9.js} +1 -1
  249. package/dist/{chunk-w3t94hm6.js → chunk-qk3zq25v.js} +1 -1
  250. package/dist/{chunk-6hfbz4d0.js → chunk-r588h4ev.js} +1 -1
  251. package/dist/chunk-rtkqczbr.js.map +2 -2
  252. package/dist/{chunk-3qtk0070.js → chunk-ssqbrts1.js} +86 -9
  253. package/dist/chunk-ssqbrts1.js.map +14 -0
  254. package/dist/{chunk-5qqmndhm.js → chunk-szzhrn3e.js} +1 -1
  255. package/dist/{chunk-n1hbwc6y.js → chunk-t6pfch4e.js} +1 -1
  256. package/dist/{chunk-xtztwpkh.js → chunk-v6h4tc2v.js} +86 -5
  257. package/dist/chunk-v6h4tc2v.js.map +12 -0
  258. package/dist/{chunk-brhp9d97.js → chunk-vmqjndb3.js} +2 -2
  259. package/dist/chunk-vtjzwymr.js.map +2 -2
  260. package/dist/{chunk-t19wjmnc.js → chunk-wpba6hhd.js} +54 -20
  261. package/dist/{chunk-t19wjmnc.js.map → chunk-wpba6hhd.js.map} +3 -3
  262. package/dist/{chunk-htdzx40w.js → chunk-wrb1x1ss.js} +12 -4
  263. package/dist/{chunk-htdzx40w.js.map → chunk-wrb1x1ss.js.map} +3 -3
  264. package/dist/{chunk-5sswe5ej.js → chunk-wsv23wvr.js} +2 -2
  265. package/dist/{chunk-90nqenq8.js → chunk-x0hqc54n.js} +4 -4
  266. package/dist/{chunk-sgx82nnt.js → chunk-xg31er4p.js} +43 -4
  267. package/dist/chunk-xg31er4p.js.map +10 -0
  268. package/dist/{chunk-3neam1y5.js → chunk-y3qb965a.js} +2 -2
  269. package/dist/{chunk-gaj8djsw.js → chunk-y57eawng.js} +10 -5
  270. package/dist/{chunk-gaj8djsw.js.map → chunk-y57eawng.js.map} +3 -3
  271. package/dist/{chunk-8ncg20rd.js → chunk-yah25st6.js} +5 -5
  272. package/dist/chunk-yah25st6.js.map +10 -0
  273. package/dist/{chunk-grt2j5vp.js → chunk-ywvxcmqj.js} +106 -13
  274. package/dist/{chunk-grt2j5vp.js.map → chunk-ywvxcmqj.js.map} +8 -7
  275. package/dist/{chunk-xf76csps.js → chunk-zmq9xc9s.js} +70 -31
  276. package/dist/{chunk-xf76csps.js.map → chunk-zmq9xc9s.js.map} +4 -3
  277. package/dist/datasets/write.js +8 -7
  278. package/dist/datasets/write.js.map +1 -1
  279. package/dist/deploy/index.d.ts +1 -1
  280. package/dist/deploy/index.d.ts.map +1 -1
  281. package/dist/deploy/internal.js +2 -2
  282. package/dist/deploy/internal.js.map +2 -2
  283. package/dist/deploy/types.d.ts +8 -58
  284. package/dist/deploy/types.d.ts.map +1 -1
  285. package/dist/env/index.d.ts +10 -3
  286. package/dist/env/index.d.ts.map +1 -1
  287. package/dist/env/index.js.map +2 -2
  288. package/dist/errors/catalog.d.ts.map +1 -1
  289. package/dist/execution/agent.js +53 -50
  290. package/dist/execution/agent.js.map +1 -1
  291. package/dist/execution/kernel-operation.d.ts +1 -0
  292. package/dist/execution/kernel-operation.d.ts.map +1 -1
  293. package/dist/execution/primitive.js +53 -50
  294. package/dist/execution/primitive.js.map +1 -1
  295. package/dist/execution/request.js +54 -51
  296. package/dist/execution/request.js.map +2 -2
  297. package/dist/execution/types.d.ts +5 -0
  298. package/dist/execution/types.d.ts.map +1 -1
  299. package/dist/http/api-routes.d.ts.map +1 -1
  300. package/dist/http/index.js +1 -1
  301. package/dist/index.d.ts +7 -5
  302. package/dist/index.d.ts.map +1 -1
  303. package/dist/index.js +73 -67
  304. package/dist/index.js.map +1 -1
  305. package/dist/lake-storage/index.js +9 -8
  306. package/dist/lake-storage/index.js.map +1 -1
  307. package/dist/maintenance/index.js +9 -8
  308. package/dist/maintenance/index.js.map +2 -2
  309. package/dist/materializer/index.js +26 -24
  310. package/dist/materializer/index.js.map +1 -1
  311. package/dist/models/audio/runtime.d.ts +3 -1
  312. package/dist/models/audio/runtime.d.ts.map +1 -1
  313. package/dist/models/audio/speech.d.ts +2 -2
  314. package/dist/models/audio/speech.d.ts.map +1 -1
  315. package/dist/models/audio/types.d.ts +23 -3
  316. package/dist/models/audio/types.d.ts.map +1 -1
  317. package/dist/models/calls.d.ts +7 -0
  318. package/dist/models/calls.d.ts.map +1 -1
  319. package/dist/models/catalog.d.ts +5 -0
  320. package/dist/models/catalog.d.ts.map +1 -1
  321. package/dist/models/definitions.d.ts +3 -2
  322. package/dist/models/definitions.d.ts.map +1 -1
  323. package/dist/models/errors.d.ts +5 -3
  324. package/dist/models/errors.d.ts.map +1 -1
  325. package/dist/models/events.d.ts +2 -0
  326. package/dist/models/events.d.ts.map +1 -1
  327. package/dist/models/execution/index.d.ts +1 -0
  328. package/dist/models/execution/index.d.ts.map +1 -1
  329. package/dist/models/execution/index.js +33 -28
  330. package/dist/models/execution/index.js.map +1 -1
  331. package/dist/models/execution/model-call-limits.d.ts.map +1 -1
  332. package/dist/models/execution/model-call-recorder.d.ts +8 -0
  333. package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
  334. package/dist/models/execution/session.d.ts +12 -0
  335. package/dist/models/execution/session.d.ts.map +1 -1
  336. package/dist/models/execution/usage.d.ts.map +1 -1
  337. package/dist/models/execution.d.ts +1 -1
  338. package/dist/models/execution.d.ts.map +1 -1
  339. package/dist/models/generation-types.d.ts +2 -0
  340. package/dist/models/generation-types.d.ts.map +1 -1
  341. package/dist/models/index.d.ts +4 -2
  342. package/dist/models/index.d.ts.map +1 -1
  343. package/dist/models/index.js +2 -2
  344. package/dist/models/input-file.d.ts.map +1 -1
  345. package/dist/models/pricing.d.ts +2 -1
  346. package/dist/models/pricing.d.ts.map +1 -1
  347. package/dist/models/rate-card.d.ts +6 -0
  348. package/dist/models/rate-card.d.ts.map +1 -1
  349. package/dist/models/tools.d.ts +5 -0
  350. package/dist/models/tools.d.ts.map +1 -1
  351. package/dist/models/video/catalog.d.ts +13 -0
  352. package/dist/models/video/catalog.d.ts.map +1 -0
  353. package/dist/models/video/check.d.ts +76 -0
  354. package/dist/models/video/check.d.ts.map +1 -0
  355. package/dist/models/video/runtime.d.ts +21 -0
  356. package/dist/models/video/runtime.d.ts.map +1 -0
  357. package/dist/models/video/types.d.ts +188 -0
  358. package/dist/models/video/types.d.ts.map +1 -0
  359. package/dist/objects/execution.d.ts.map +1 -1
  360. package/dist/objects/index.js +53 -50
  361. package/dist/objects/index.js.map +1 -1
  362. package/dist/objects/query/index.js +25 -23
  363. package/dist/objects/query/index.js.map +1 -1
  364. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  365. package/dist/ontology/index.js +4 -4
  366. package/dist/ontology/internal.js +4 -4
  367. package/dist/pipelines/index.js +28 -26
  368. package/dist/pipelines/index.js.map +1 -1
  369. package/dist/projections/internal.js +26 -24
  370. package/dist/projections/internal.js.map +1 -1
  371. package/dist/queues/index.d.ts +1 -1
  372. package/dist/queues/index.d.ts.map +1 -1
  373. package/dist/queues/types.d.ts +103 -6
  374. package/dist/queues/types.d.ts.map +1 -1
  375. package/dist/runtime/create.d.ts.map +1 -1
  376. package/dist/runtime/definitions.d.ts +14 -0
  377. package/dist/runtime/definitions.d.ts.map +1 -1
  378. package/dist/runtime/host.d.ts +3 -1
  379. package/dist/runtime/host.d.ts.map +1 -1
  380. package/dist/runtime/index.d.ts +1 -1
  381. package/dist/runtime/index.d.ts.map +1 -1
  382. package/dist/runtime/internal.d.ts +3 -1
  383. package/dist/runtime/internal.d.ts.map +1 -1
  384. package/dist/runtime/internal.js +49 -43
  385. package/dist/runtime/internal.js.map +2 -2
  386. package/dist/runtime/resolve-definitions.d.ts +2 -1
  387. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  388. package/dist/runtime/sixb.d.ts.map +1 -1
  389. package/dist/sandboxes/errors.d.ts +19 -0
  390. package/dist/sandboxes/errors.d.ts.map +1 -1
  391. package/dist/sandboxes/exec.d.ts +2 -0
  392. package/dist/sandboxes/exec.d.ts.map +1 -1
  393. package/dist/sandboxes/index.d.ts +1 -1
  394. package/dist/sandboxes/index.d.ts.map +1 -1
  395. package/dist/sandboxes/index.js +14 -8
  396. package/dist/sandboxes/index.js.map +1 -1
  397. package/dist/sandboxes/sandbox.d.ts +15 -1
  398. package/dist/sandboxes/sandbox.d.ts.map +1 -1
  399. package/dist/security/public.d.ts +6 -4
  400. package/dist/security/public.d.ts.map +1 -1
  401. package/dist/security/public.js +5 -3
  402. package/dist/security/public.js.map +1 -1
  403. package/dist/shares/internal.js +25 -23
  404. package/dist/shares/internal.js.map +2 -2
  405. package/dist/storage/agents/in-memory.d.ts +2 -1
  406. package/dist/storage/agents/in-memory.d.ts.map +1 -1
  407. package/dist/storage/agents/index.d.ts +1 -1
  408. package/dist/storage/agents/index.d.ts.map +1 -1
  409. package/dist/storage/agents/provider.d.ts.map +1 -1
  410. package/dist/storage/agents/provider.js +5 -5
  411. package/dist/storage/agents/types.d.ts +27 -1
  412. package/dist/storage/agents/types.d.ts.map +1 -1
  413. package/dist/storage/ai-cost/analytics.d.ts +1 -0
  414. package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
  415. package/dist/storage/ai-cost/groups.d.ts +2 -0
  416. package/dist/storage/ai-cost/groups.d.ts.map +1 -1
  417. package/dist/storage/ai-cost/provider.js +5 -5
  418. package/dist/storage/ai-cost/types.d.ts +2 -1
  419. package/dist/storage/ai-cost/types.d.ts.map +1 -1
  420. package/dist/storage/ai-cost/validation.d.ts.map +1 -1
  421. package/dist/storage/ai-limits/enforcement.js +3 -3
  422. package/dist/storage/ai-limits/provider.js +2 -2
  423. package/dist/storage/ai-usage/in-memory.d.ts +8 -1
  424. package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
  425. package/dist/storage/ai-usage/index.d.ts +2 -2
  426. package/dist/storage/ai-usage/index.d.ts.map +1 -1
  427. package/dist/storage/ai-usage/record.d.ts +11 -1
  428. package/dist/storage/ai-usage/record.d.ts.map +1 -1
  429. package/dist/storage/ai-usage/types.d.ts +80 -1
  430. package/dist/storage/ai-usage/types.d.ts.map +1 -1
  431. package/dist/storage/ai-usage/usage.d.ts +1 -1
  432. package/dist/storage/ai-usage/usage.d.ts.map +1 -1
  433. package/dist/storage/artifacts/in-memory.d.ts +25 -2
  434. package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
  435. package/dist/storage/artifacts/index.d.ts +1 -1
  436. package/dist/storage/artifacts/index.d.ts.map +1 -1
  437. package/dist/storage/artifacts/record.d.ts +12 -1
  438. package/dist/storage/artifacts/record.d.ts.map +1 -1
  439. package/dist/storage/artifacts/types.d.ts +198 -6
  440. package/dist/storage/artifacts/types.d.ts.map +1 -1
  441. package/dist/storage/executions/provider.js +3 -2
  442. package/dist/storage/executions/provider.js.map +1 -1
  443. package/dist/storage/file-upload-sessions/provider.js +10 -9
  444. package/dist/storage/file-upload-sessions/provider.js.map +1 -1
  445. package/dist/storage/in-memory/index.d.ts.map +1 -1
  446. package/dist/storage/index.d.ts +4 -4
  447. package/dist/storage/index.d.ts.map +1 -1
  448. package/dist/storage/index.js +25 -23
  449. package/dist/storage/index.js.map +1 -1
  450. package/dist/storage/internal.d.ts +2 -2
  451. package/dist/storage/internal.d.ts.map +1 -1
  452. package/dist/storage/internal.js +34 -14
  453. package/dist/storage/internal.js.map +2 -2
  454. package/dist/storage/workflow-runs/provider.js +10 -9
  455. package/dist/storage/workflow-runs/provider.js.map +1 -1
  456. package/dist/syncs/index.js +29 -27
  457. package/dist/syncs/index.js.map +1 -1
  458. package/dist/testing/agent-storage-contract.d.ts.map +1 -1
  459. package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
  460. package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
  461. package/dist/testing/artifact-storage-contract.d.ts +3 -0
  462. package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
  463. package/dist/testing/execution-storage-contract.d.ts.map +1 -1
  464. package/dist/testing/index.js +686 -75
  465. package/dist/testing/index.js.map +10 -10
  466. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  467. package/dist/testing/queues-contract.d.ts.map +1 -1
  468. package/dist/testing/sandboxes-contract.d.ts.map +1 -1
  469. package/dist/webhooks/internal.js +26 -24
  470. package/dist/webhooks/internal.js.map +2 -2
  471. package/dist/workers/index.js +5 -5
  472. package/dist/workers/index.js.map +1 -1
  473. package/dist/workflows/index.js +60 -57
  474. package/dist/workflows/index.js.map +1 -1
  475. package/package.json +3 -1
  476. package/src/actions/request.ts +2 -0
  477. package/src/actions/run/context.ts +1 -0
  478. package/src/actions/run/execute.ts +5 -1
  479. package/src/actions/run/executor.ts +4 -0
  480. package/src/actions/run/normalize.ts +4 -0
  481. package/src/actions/run/types.ts +6 -0
  482. package/src/actions/types/context.ts +7 -0
  483. package/src/agents/README.md +3 -1
  484. package/src/agents/context/entries.ts +63 -9
  485. package/src/agents/context-model.ts +9 -0
  486. package/src/agents/context-resolution.ts +7 -0
  487. package/src/agents/execution.ts +39 -0
  488. package/src/agents/index.ts +1 -0
  489. package/src/agents/model-call-retry.ts +69 -0
  490. package/src/agents/model-loop.ts +86 -12
  491. package/src/agents/model-routing.ts +104 -38
  492. package/src/agents/request.ts +27 -1
  493. package/src/agents/run-artifacts.ts +10 -5
  494. package/src/agents/run-plan.ts +2 -1
  495. package/src/agents/run-session-http.ts +1 -0
  496. package/src/agents/run-session-serve.ts +23 -2
  497. package/src/agents/run-session-wire.ts +45 -0
  498. package/src/agents/run-token.ts +7 -0
  499. package/src/agents/thread-access.ts +34 -1
  500. package/src/agents/tool-files.ts +23 -7
  501. package/src/artifacts/caller.ts +42 -0
  502. package/src/artifacts/comment-place.ts +51 -0
  503. package/src/artifacts/comment-text.ts +50 -7
  504. package/src/artifacts/comments.ts +132 -34
  505. package/src/artifacts/errors.ts +1 -0
  506. package/src/artifacts/execution.ts +249 -5
  507. package/src/artifacts/frames/assets.ts +93 -15
  508. package/src/artifacts/frames/entries.ts +7 -4
  509. package/src/artifacts/frames/generated/hyperframes-notices.txt +290 -0
  510. package/src/artifacts/frames/generated/hyperframes.txt +1145 -0
  511. package/src/artifacts/frames/generated.d.ts +5 -0
  512. package/src/artifacts/frames/hyperframes.ts +14 -0
  513. package/src/artifacts/frames/index.ts +5 -0
  514. package/src/artifacts/frames/kit.ts +7 -3
  515. package/src/artifacts/frames/protocol.ts +56 -0
  516. package/src/artifacts/frames/video-runtime.ts +165 -0
  517. package/src/artifacts/html.ts +13 -0
  518. package/src/artifacts/index.ts +7 -0
  519. package/src/artifacts/kinds.ts +9 -1
  520. package/src/artifacts/limits.ts +43 -0
  521. package/src/artifacts/live/document.ts +27 -3
  522. package/src/artifacts/live/index.ts +58 -2
  523. package/src/artifacts/live/presence.ts +17 -5
  524. package/src/artifacts/live/protocol.ts +4 -2
  525. package/src/artifacts/live/server.ts +1 -1
  526. package/src/artifacts/live/state.ts +3 -3
  527. package/src/artifacts/media/README.md +75 -0
  528. package/src/artifacts/media/media.ts +316 -0
  529. package/src/artifacts/media/transcriber.ts +84 -0
  530. package/src/artifacts/outline.ts +28 -0
  531. package/src/artifacts/publish/files.ts +19 -6
  532. package/src/artifacts/publish/index.ts +49 -2
  533. package/src/artifacts/publish/pdf.ts +3 -1
  534. package/src/artifacts/publish/previews.ts +22 -8
  535. package/src/artifacts/publish/publish.ts +4 -1
  536. package/src/artifacts/publish/validate/html.ts +23 -18
  537. package/src/artifacts/publish/validate/video.ts +309 -0
  538. package/src/artifacts/publish/video.ts +235 -0
  539. package/src/artifacts/resolve.ts +45 -0
  540. package/src/artifacts/video/README.md +402 -0
  541. package/src/artifacts/video/composition.ts +898 -0
  542. package/src/artifacts/video/edit.ts +3967 -0
  543. package/src/artifacts/video/export.ts +352 -0
  544. package/src/artifacts/video/looks.ts +694 -0
  545. package/src/artifacts/video/project.ts +198 -0
  546. package/src/artifacts/video/stills.ts +168 -0
  547. package/src/artifacts/video/timeline.ts +658 -0
  548. package/src/blob-storage/browser.ts +1 -1
  549. package/src/blob-storage/constants.ts +9 -3
  550. package/src/blob-storage/download-urls.ts +5 -3
  551. package/src/blob-storage/index.ts +1 -0
  552. package/src/blob-storage/internal.ts +13 -2
  553. package/src/blob-storage/media-type.ts +149 -8
  554. package/src/bootstrap/discovery.ts +61 -11
  555. package/src/deploy/index.ts +0 -5
  556. package/src/deploy/types.ts +8 -63
  557. package/src/deploy/validation.ts +1 -1
  558. package/src/env/index.ts +10 -4
  559. package/src/errors/catalog.ts +2 -1
  560. package/src/execution/authorization.ts +2 -2
  561. package/src/execution/kernel-operation.ts +14 -0
  562. package/src/execution/types.ts +2 -0
  563. package/src/http/api-routes.ts +117 -0
  564. package/src/index.ts +21 -1
  565. package/src/lake-storage/definition-updates.ts +3 -9
  566. package/src/models/audio/runtime.ts +48 -3
  567. package/src/models/audio/speech.ts +2 -2
  568. package/src/models/audio/types.ts +24 -3
  569. package/src/models/calls.ts +35 -18
  570. package/src/models/catalog.ts +9 -2
  571. package/src/models/definitions.ts +4 -2
  572. package/src/models/errors.ts +5 -3
  573. package/src/models/events.ts +2 -0
  574. package/src/models/execution/README.md +68 -2
  575. package/src/models/execution/index.ts +1 -0
  576. package/src/models/execution/model-call-limits.ts +11 -5
  577. package/src/models/execution/model-call-recorder.ts +14 -0
  578. package/src/models/execution/session.ts +52 -23
  579. package/src/models/execution/usage.ts +1 -0
  580. package/src/models/execution.ts +13 -2
  581. package/src/models/generation-types.ts +2 -0
  582. package/src/models/index.ts +20 -1
  583. package/src/models/input-file.ts +7 -2
  584. package/src/models/pricing.ts +19 -1
  585. package/src/models/rate-card.ts +15 -3
  586. package/src/models/tools.ts +5 -0
  587. package/src/models/video/catalog.ts +101 -0
  588. package/src/models/video/check.ts +441 -0
  589. package/src/models/video/runtime.ts +550 -0
  590. package/src/models/video/types.ts +194 -0
  591. package/src/objects/execution.ts +2 -0
  592. package/src/objects/sdk/object-set.ts +2 -0
  593. package/src/queues/index.ts +5 -0
  594. package/src/queues/types.ts +126 -5
  595. package/src/runtime/create.ts +1 -0
  596. package/src/runtime/definitions.ts +25 -0
  597. package/src/runtime/host.ts +6 -1
  598. package/src/runtime/index.ts +6 -1
  599. package/src/runtime/internal.ts +3 -1
  600. package/src/runtime/resolve-definitions.ts +7 -1
  601. package/src/runtime/sixb.ts +12 -4
  602. package/src/sandboxes/README.md +12 -2
  603. package/src/sandboxes/errors.ts +27 -0
  604. package/src/sandboxes/exec.ts +3 -1
  605. package/src/sandboxes/index.ts +3 -0
  606. package/src/sandboxes/sandbox.ts +15 -1
  607. package/src/security/public.ts +6 -4
  608. package/src/storage/agents/in-memory.ts +39 -0
  609. package/src/storage/agents/index.ts +1 -0
  610. package/src/storage/agents/provider.ts +8 -0
  611. package/src/storage/agents/types.ts +32 -1
  612. package/src/storage/ai-cost/analytics.ts +2 -0
  613. package/src/storage/ai-cost/codec.ts +1 -0
  614. package/src/storage/ai-cost/groups.ts +7 -0
  615. package/src/storage/ai-cost/types.ts +2 -0
  616. package/src/storage/ai-cost/validation.ts +2 -0
  617. package/src/storage/ai-usage/in-memory.ts +93 -0
  618. package/src/storage/ai-usage/index.ts +10 -0
  619. package/src/storage/ai-usage/record.ts +106 -0
  620. package/src/storage/ai-usage/types.ts +102 -1
  621. package/src/storage/ai-usage/usage.ts +2 -0
  622. package/src/storage/artifacts/in-memory.ts +108 -11
  623. package/src/storage/artifacts/index.ts +14 -0
  624. package/src/storage/artifacts/record.ts +203 -1
  625. package/src/storage/artifacts/types.ts +199 -6
  626. package/src/storage/executions/validation.ts +2 -2
  627. package/src/storage/in-memory/index.ts +1 -1
  628. package/src/storage/index.ts +22 -1
  629. package/src/storage/internal.ts +9 -0
  630. package/src/testing/agent-storage-contract.ts +135 -0
  631. package/src/testing/ai-cost-storage-contract.ts +1 -0
  632. package/src/testing/ai-usage-storage-contract.ts +145 -1
  633. package/src/testing/artifact-storage-contract.ts +330 -0
  634. package/src/testing/execution-storage-contract.ts +10 -2
  635. package/src/testing/lake-storage-contract.ts +27 -0
  636. package/src/testing/queues-contract.ts +71 -0
  637. package/src/testing/sandboxes-contract.ts +50 -0
  638. package/dist/chunk-3723kgba.js +0 -29
  639. package/dist/chunk-3723kgba.js.map +0 -10
  640. package/dist/chunk-3qtk0070.js.map +0 -14
  641. package/dist/chunk-8ncg20rd.js.map +0 -10
  642. package/dist/chunk-9vsc919v.js.map +0 -10
  643. package/dist/chunk-az95tsh3.js.map +0 -11
  644. package/dist/chunk-c29729me.js.map +0 -12
  645. package/dist/chunk-d7vyc7k6.js.map +0 -10
  646. package/dist/chunk-de5sfbc3.js +0 -3
  647. package/dist/chunk-f05994as.js.map +0 -10
  648. package/dist/chunk-gfdh9kqa.js.map +0 -11
  649. package/dist/chunk-jt012fxq.js.map +0 -34
  650. package/dist/chunk-mbwsgjn7.js.map +0 -11
  651. package/dist/chunk-nxysqbt0.js.map +0 -10
  652. package/dist/chunk-qttqe1ah.js.map +0 -24
  653. package/dist/chunk-sgx82nnt.js.map +0 -10
  654. package/dist/chunk-vs2s3p8n.js +0 -2274
  655. package/dist/chunk-vs2s3p8n.js.map +0 -20
  656. package/dist/chunk-wkv3h3q7.js.map +0 -12
  657. package/dist/chunk-wzcjhv54.js.map +0 -11
  658. package/dist/chunk-xtztwpkh.js.map +0 -12
  659. package/dist/chunk-ym1bqd98.js.map +0 -19
  660. /package/dist/{chunk-7mhbs9yy.js.map → chunk-1z8ccj53.js.map} +0 -0
  661. /package/dist/{chunk-dmnd9ea6.js.map → chunk-30a0ftnm.js.map} +0 -0
  662. /package/dist/{chunk-qbd282aa.js.map → chunk-39q9ybav.js.map} +0 -0
  663. /package/dist/{chunk-bcz9dxtf.js.map → chunk-3x902cja.js.map} +0 -0
  664. /package/dist/{chunk-c4nrycdy.js.map → chunk-4q4a5a96.js.map} +0 -0
  665. /package/dist/{chunk-ykchk644.js.map → chunk-4w8qzy9w.js.map} +0 -0
  666. /package/dist/{chunk-kft7mp7z.js.map → chunk-5xkqasvn.js.map} +0 -0
  667. /package/dist/{chunk-xavet0qs.js.map → chunk-6whr25gw.js.map} +0 -0
  668. /package/dist/{chunk-ygvay56w.js.map → chunk-896te58g.js.map} +0 -0
  669. /package/dist/{chunk-pqj8vff9.js.map → chunk-8eqqqc1h.js.map} +0 -0
  670. /package/dist/{chunk-jka26v8c.js.map → chunk-8x1bsp68.js.map} +0 -0
  671. /package/dist/{chunk-fmgf9h5e.js.map → chunk-9az7kjv4.js.map} +0 -0
  672. /package/dist/{chunk-bs1sd0e0.js.map → chunk-9p7kyeqz.js.map} +0 -0
  673. /package/dist/{chunk-brybqw5k.js.map → chunk-bkxm2dzx.js.map} +0 -0
  674. /package/dist/{chunk-ppxf7gw2.js.map → chunk-d7t9jnym.js.map} +0 -0
  675. /package/dist/{chunk-cg7cygfj.js.map → chunk-fdmvaz7x.js.map} +0 -0
  676. /package/dist/{chunk-191jz8a6.js.map → chunk-ff0qdk7z.js.map} +0 -0
  677. /package/dist/{chunk-wx7smkn2.js.map → chunk-fq8drkp0.js.map} +0 -0
  678. /package/dist/{chunk-v8a1qjzp.js.map → chunk-hpswfrjj.js.map} +0 -0
  679. /package/dist/{chunk-bz5bnjjt.js.map → chunk-jjte0h4p.js.map} +0 -0
  680. /package/dist/{chunk-xrmbhap8.js.map → chunk-mwg0nwkb.js.map} +0 -0
  681. /package/dist/{chunk-a3faa34j.js.map → chunk-nfjt8k8j.js.map} +0 -0
  682. /package/dist/{chunk-394zjzjs.js.map → chunk-nhgqz3g3.js.map} +0 -0
  683. /package/dist/{chunk-92wrka15.js.map → chunk-q150fnj9.js.map} +0 -0
  684. /package/dist/{chunk-w3t94hm6.js.map → chunk-qk3zq25v.js.map} +0 -0
  685. /package/dist/{chunk-6hfbz4d0.js.map → chunk-r588h4ev.js.map} +0 -0
  686. /package/dist/{chunk-5qqmndhm.js.map → chunk-szzhrn3e.js.map} +0 -0
  687. /package/dist/{chunk-n1hbwc6y.js.map → chunk-t6pfch4e.js.map} +0 -0
  688. /package/dist/{chunk-brhp9d97.js.map → chunk-vmqjndb3.js.map} +0 -0
  689. /package/dist/{chunk-5sswe5ej.js.map → chunk-wsv23wvr.js.map} +0 -0
  690. /package/dist/{chunk-90nqenq8.js.map → chunk-x0hqc54n.js.map} +0 -0
  691. /package/dist/{chunk-3neam1y5.js.map → chunk-y3qb965a.js.map} +0 -0
@@ -8,11 +8,10 @@ import {
8
8
  } from "./chunk-7j4yydm2.js";
9
9
  import {
10
10
  canonicalMediaType2,
11
- isFileRef2,
12
11
  isValidFileRef,
13
12
  supportsDirectUpload2,
14
13
  supportsRangeRead2
15
- } from "./chunk-wkv3h3q7.js";
14
+ } from "./chunk-2138b0ng.js";
16
15
  import {
17
16
  withFailureMessage2
18
17
  } from "./chunk-6eqsgvxk.js";
@@ -35,11 +34,11 @@ import {
35
34
  normalizeLinkProperties2,
36
35
  validateLinkProperties2,
37
36
  assertTelemetryProperty2
38
- } from "./chunk-7mhbs9yy.js";
37
+ } from "./chunk-1z8ccj53.js";
39
38
  import {
40
39
  isObjectRefSchema2,
41
40
  validateSchemaOrRefValue2
42
- } from "./chunk-brybqw5k.js";
41
+ } from "./chunk-bkxm2dzx.js";
43
42
  import {
44
43
  ActionDefinitionError2,
45
44
  missingActionMutationMessage,
@@ -60,7 +59,7 @@ import {
60
59
  createUsersRuntime,
61
60
  SYSTEM_PRINCIPAL2,
62
61
  principalsEqual2
63
- } from "./chunk-394zjzjs.js";
62
+ } from "./chunk-nhgqz3g3.js";
64
63
  import {
65
64
  ActionValidationError2,
66
65
  SIXB_ERROR_CODES2,
@@ -97,7 +96,7 @@ import {
97
96
  canViewProjectionRun2,
98
97
  canViewPrimitiveRun2,
99
98
  canViewProjection2
100
- } from "./chunk-tapdssb5.js";
99
+ } from "./chunk-e3b1r4d2.js";
101
100
  import {
102
101
  compileSelectedObjectReadScope2
103
102
  } from "./chunk-rt9deb92.js";
@@ -107,7 +106,7 @@ import {
107
106
  resolveAgentExecutionAuthorization2,
108
107
  userCanRunAgent2,
109
108
  resolveInheritedAgentExecutionAuthorization2
110
- } from "./chunk-5sswe5ej.js";
109
+ } from "./chunk-wsv23wvr.js";
111
110
  import {
112
111
  ACTION_RUN_FAILURE_CODES2,
113
112
  parseActionRunFailure2
@@ -115,12 +114,8 @@ import {
115
114
  import {
116
115
  isModelReasoning2,
117
116
  modelReasoningSupportIssue2
118
- } from "./chunk-az95tsh3.js";
117
+ } from "./chunk-0fjryajn.js";
119
118
  import {
120
- TranscriptionModelResponseError2,
121
- SpeechModelResponseError2,
122
- assertTranscriptionModel,
123
- assertSpeechModel,
124
119
  assertDecisionContent,
125
120
  assertDecisionQuestions,
126
121
  assertDecisionModel,
@@ -128,6 +123,7 @@ import {
128
123
  supportsQuestion,
129
124
  validateDecisionAnswers,
130
125
  assertImageModel,
126
+ assertVideoModel,
131
127
  LANGUAGE_MODEL_TIERS2,
132
128
  isLanguageModelTier2,
133
129
  selectLanguageModel2,
@@ -136,7 +132,7 @@ import {
136
132
  question2,
137
133
  ImageModelResponseError2,
138
134
  estimateModelCall
139
- } from "./chunk-qttqe1ah.js";
135
+ } from "./chunk-jbg905hn.js";
140
136
  import {
141
137
  AgentStorageError2,
142
138
  createAgentThreadId2,
@@ -151,7 +147,7 @@ import {
151
147
  runPlaceKey2,
152
148
  isAgentApprovalMode2,
153
149
  agentApprovalHoldsRun2
154
- } from "./chunk-gaj8djsw.js";
150
+ } from "./chunk-y57eawng.js";
155
151
  import {
156
152
  canonicalLocale,
157
153
  canonicalTimeZone2
@@ -160,10 +156,10 @@ import {
160
156
  actionRunRequestsEqual,
161
157
  ObjectNotFoundError2,
162
158
  ArtifactStorageError
163
- } from "./chunk-88xeh6zx.js";
159
+ } from "./chunk-1g4me5f2.js";
164
160
  import {
165
161
  ExecutionStorageError2
166
- } from "./chunk-c29729me.js";
162
+ } from "./chunk-4z9xtxke.js";
167
163
  import {
168
164
  objectRefKey2,
169
165
  linkRefKey2,
@@ -174,10 +170,10 @@ import {
174
170
  objectBatchKey2,
175
171
  matchesPredicate,
176
172
  WORKFLOW_RUN_FAILURE_CODES2
177
- } from "./chunk-9c9yknwt.js";
173
+ } from "./chunk-3d9w8t4n.js";
178
174
  import {
179
175
  explainObjectQuery2
180
- } from "./chunk-bs1sd0e0.js";
176
+ } from "./chunk-9p7kyeqz.js";
181
177
  import {
182
178
  redactDomainEvent,
183
179
  uniqueLookupKeyOf,
@@ -187,7 +183,7 @@ import {
187
183
  readerClearance,
188
184
  readerEventClearance,
189
185
  readerViewConditions
190
- } from "./chunk-fmgf9h5e.js";
186
+ } from "./chunk-9az7kjv4.js";
191
187
  import {
192
188
  agentRunEndedShort,
193
189
  createAgentThreadAccessRule,
@@ -200,7 +196,7 @@ import {
200
196
  transactionArtifactAccessRules,
201
197
  updatableArtifactIds,
202
198
  createArtifactsRuntime
203
- } from "./chunk-jt012fxq.js";
199
+ } from "./chunk-jwjwvzj1.js";
204
200
  import {
205
201
  shareSixbErrorReporter2,
206
202
  reportActionPhaseFailure2,
@@ -221,51 +217,64 @@ import {
221
217
  createActivityRuntime,
222
218
  createActivityCaptureRuntime,
223
219
  registerActivityCaptureRuntime,
224
- ModelExecutionSession
225
- } from "./chunk-ym1bqd98.js";
220
+ prepareModelInputFile,
221
+ readModelInputFile,
222
+ createAudioRuntime
223
+ } from "./chunk-990a5bkc.js";
226
224
  import {
227
225
  publishAgentThreadMoved2,
228
226
  publishAgentApprovalActivity,
229
227
  publishAgentRunActivity2,
230
228
  publishAgentRunCancel2,
231
229
  publishAgentRunFinished2
232
- } from "./chunk-kft7mp7z.js";
230
+ } from "./chunk-5xkqasvn.js";
233
231
  import {
234
232
  aiLimitSubjectsFromAttribution2,
235
233
  applicableAiLimitPolicyStatuses2,
236
234
  aiUsageLimitExceededError2,
237
235
  aiUsageLimitUnavailableError2
238
- } from "./chunk-5qqmndhm.js";
236
+ } from "./chunk-szzhrn3e.js";
239
237
  import {
240
238
  normalizeAgentContextEntries2
241
- } from "./chunk-sgx82nnt.js";
239
+ } from "./chunk-xg31er4p.js";
242
240
  import {
243
- createFileDownloadUrl,
244
- revokeFileDownloadUrl
245
- } from "./chunk-8ncg20rd.js";
241
+ createFileDownloadUrl2,
242
+ revokeFileDownloadUrl2
243
+ } from "./chunk-yah25st6.js";
246
244
  import {
247
245
  registerConnectorConnectionsRuntime
248
246
  } from "./chunk-0pmpwn3g.js";
249
247
  import {
250
248
  createConnectorRuntime
251
- } from "./chunk-n1hbwc6y.js";
249
+ } from "./chunk-t6pfch4e.js";
252
250
  import {
253
251
  DatasetValidationError2
254
- } from "./chunk-wx7smkn2.js";
252
+ } from "./chunk-fq8drkp0.js";
255
253
  import {
256
254
  lakeDatasetDefinition2,
257
255
  validateDatasetMergeChanges2
258
- } from "./chunk-ppxf7gw2.js";
256
+ } from "./chunk-d7t9jnym.js";
259
257
  import {
260
258
  datasetDefinitionHash,
261
259
  tryEnqueueIngestFlush
262
- } from "./chunk-191jz8a6.js";
260
+ } from "./chunk-ff0qdk7z.js";
263
261
  import {
264
262
  AI_MODEL_CALL_OUTPUT_TOKEN_ALLOWANCE,
265
263
  aiModelCallOutputTokenAllowance,
266
264
  ModelUsageRecordingError2,
267
- LanguageModelCallMeter
268
- } from "./chunk-grt2j5vp.js";
265
+ LanguageModelCallMeter,
266
+ ModelExecutionSession
267
+ } from "./chunk-ywvxcmqj.js";
268
+ import {
269
+ resolveLanguageModel2,
270
+ checkVideoOperation,
271
+ storedVideoRequest,
272
+ storedVideoResult,
273
+ scheduleVideoCheck,
274
+ abandonVideoOperation,
275
+ resolveVideoModel,
276
+ isWarnings
277
+ } from "./chunk-5278qwax.js";
269
278
  import {
270
279
  createLinkScopeFingerprint2,
271
280
  normalizeJsonProperties2,
@@ -275,7 +284,7 @@ import {
275
284
  resolveEffectiveLink,
276
285
  resolveEffectiveLinkSlotMember,
277
286
  linkCardinality
278
- } from "./chunk-ykchk644.js";
287
+ } from "./chunk-4w8qzy9w.js";
279
288
  import {
280
289
  createSyncConnections,
281
290
  mayRunConnection,
@@ -283,7 +292,7 @@ import {
283
292
  seesConnection,
284
293
  SyncValidationError2,
285
294
  requestSyncRun2
286
- } from "./chunk-90nqenq8.js";
295
+ } from "./chunk-x0hqc54n.js";
287
296
  import {
288
297
  resolveLoggingService2
289
298
  } from "./chunk-1vg43g9q.js";
@@ -293,10 +302,10 @@ import {
293
302
  } from "./chunk-m427qgq0.js";
294
303
  import {
295
304
  compileShareAccessPlan
296
- } from "./chunk-qbd282aa.js";
305
+ } from "./chunk-39q9ybav.js";
297
306
  import {
298
307
  requestPipelineRun2
299
- } from "./chunk-pqj8vff9.js";
308
+ } from "./chunk-8eqqqc1h.js";
300
309
  import {
301
310
  PipelineError2
302
311
  } from "./chunk-hke9aeen.js";
@@ -304,20 +313,21 @@ import {
304
313
  createObjectQueryBuilder2,
305
314
  decorateObjectQueryExecutor
306
315
  } from "./chunk-80nh73br.js";
316
+ import {
317
+ backoffDelay2,
318
+ waitUnlessAborted2
319
+ } from "./chunk-mwcqz3e3.js";
307
320
  import {
308
321
  SandboxError2,
309
322
  sandboxCredentialIssue2,
310
323
  staticSandboxRecipe2
311
- } from "./chunk-htdzx40w.js";
324
+ } from "./chunk-wrb1x1ss.js";
312
325
  import {
313
326
  executionRecordInputFromRuntime,
314
327
  ensureExecutionRecord2,
315
328
  createPrimitiveExecutionRecord,
316
329
  restoreTrustedPrimitiveExecutionScope
317
- } from "./chunk-xavet0qs.js";
318
- import {
319
- resolveLanguageModel2
320
- } from "./chunk-3723kgba.js";
330
+ } from "./chunk-6whr25gw.js";
321
331
  import {
322
332
  schemaRecordToJsonSchema2
323
333
  } from "./chunk-0kgrghqx.js";
@@ -331,7 +341,7 @@ import {
331
341
  } from "./chunk-d9xbwh3h.js";
332
342
  import {
333
343
  getDatasetPrimaryKeyColumns2
334
- } from "./chunk-w3t94hm6.js";
344
+ } from "./chunk-qk3zq25v.js";
335
345
  import {
336
346
  LakeValueRefusedError2
337
347
  } from "./chunk-hgj98cbb.js";
@@ -346,7 +356,7 @@ import {
346
356
  AI_USAGE_FIELDS,
347
357
  normalizeAiModelCallUsage2,
348
358
  aggregateAiModelCallUsage2
349
- } from "./chunk-xtztwpkh.js";
359
+ } from "./chunk-v6h4tc2v.js";
350
360
  import {
351
361
  RuntimeError2
352
362
  } from "./chunk-m4ehq95f.js";
@@ -361,7 +371,7 @@ import {
361
371
  } from "./chunk-0k1h5hmr.js";
362
372
  import {
363
373
  normalizeParams
364
- } from "./chunk-3neam1y5.js";
374
+ } from "./chunk-y3qb965a.js";
365
375
  import {
366
376
  MaterializationValidationError2,
367
377
  MaterializationObjectNotFoundError2,
@@ -385,12 +395,12 @@ import {
385
395
  } from "./chunk-9wr3yajk.js";
386
396
  import {
387
397
  AGENT_APPROVAL_MODES2
388
- } from "./chunk-nxysqbt0.js";
398
+ } from "./chunk-389ybvw9.js";
389
399
  import {
390
400
  resolveFileRefAtPath2,
391
401
  openFileRef2,
392
402
  jsonPointerSegment2
393
- } from "./chunk-a3faa34j.js";
403
+ } from "./chunk-nfjt8k8j.js";
394
404
  import {
395
405
  isJsonValue2,
396
406
  assertJsonValue2,
@@ -689,6 +699,32 @@ class ActionRegistry2 {
689
699
  return null;
690
700
  }
691
701
  }
702
+ // src/artifacts/caller.ts
703
+ var callerArtifactsKey = Symbol("sixb.callerArtifacts");
704
+ function registerCallerArtifacts(owner, artifacts) {
705
+ const registered = owner[callerArtifactsKey];
706
+ if (registered && registered !== artifacts) {
707
+ throw new Error("[Sixb] The caller's artifacts are already registered for this owner.");
708
+ }
709
+ Object.defineProperty(owner, callerArtifactsKey, {
710
+ configurable: false,
711
+ enumerable: true,
712
+ value: artifacts,
713
+ writable: false
714
+ });
715
+ }
716
+ function getCallerArtifacts(owner) {
717
+ const artifacts = owner[callerArtifactsKey];
718
+ if (artifacts)
719
+ return artifacts;
720
+ throw new Error("[Sixb] The caller's artifacts are not registered for this runtime context.");
721
+ }
722
+ function shareCallerArtifacts(source, target) {
723
+ const artifacts = source[callerArtifactsKey];
724
+ if (artifacts)
725
+ registerCallerArtifacts(target, artifacts);
726
+ }
727
+
692
728
  // src/execution/request-client.ts
693
729
  var MAX_USER_AGENT_LENGTH = 512;
694
730
  var requestClients = new WeakMap;
@@ -2321,22 +2357,35 @@ var HEAVY_FROM = 0.4;
2321
2357
  var LIGHT_FROM = 0.8;
2322
2358
  var DECISION_TIMEOUT_MS = 2000;
2323
2359
  var PROMPT_CACHE_TTL_MS = 5 * 60000;
2324
- var TIER_QUESTIONS = {
2325
- tier: question2.choice({
2326
- instructions: "A user sent this message to a data agent. The agent answers from the project's data with " + "tools: it searches and reads objects, queries and aggregates datasets, follows links, runs " + "actions and writes reports. Pick the model tier the answer needs. Judge the work the " + "answer takes, not the length or tone of the message.",
2327
- options: {
2328
- light: "A lookup, a count, a filter or a list: one or two queries with an obvious answer. " + "Greetings, thanks and short follow-ups.",
2329
- standard: "Usual analysis: several queries, comparisons, trends or aggregations, a short summary, " + "or a simple action, with a clear path to the answer.",
2330
- heavy: "Open-ended work: a multi-step investigation, explaining why something happened, " + "weighing trade-offs, building a plan, or writing a long report."
2331
- }
2332
- })
2360
+ var PREVIOUS_MESSAGE_CHARS = 2000;
2361
+ var TIER_WORK = {
2362
+ light: "A lookup, a count, a filter or a list with an obvious answer. Greetings, thanks, and short " + "questions that start no new work.",
2363
+ standard: "Usual work with a clear path: several queries or reads, a comparison, a short summary, a " + "simple action, or a small change to a few files.",
2364
+ heavy: "Open-ended or long work: a multi-step investigation, explaining why something happened, " + "weighing trade-offs, building a plan, writing a long report, or changes across many files " + "that must be checked."
2333
2365
  };
2366
+ function tierQuestions(language) {
2367
+ return {
2368
+ tier: question2.choice({
2369
+ instructions: "A user sent this message to an agent that works in a project with tools: it reads and " + "changes the project's data, runs actions, writes documents, and in a workspace runs " + "commands and edits files. Pick the model tier the answer needs. Judge the work the " + "answer takes, not the length or tone of the message. When the input holds the " + "previous message, with the tier it ran on, judge the <message> in its light: a short " + "message that carries on that work, such as approving a plan or asking for the next " + "step, takes the tier the work needs.",
2370
+ options: {
2371
+ light: tierOption(language, "light"),
2372
+ standard: tierOption(language, "standard"),
2373
+ heavy: tierOption(language, "heavy")
2374
+ }
2375
+ })
2376
+ };
2377
+ }
2378
+ function tierOption(language, tier) {
2379
+ const description = language.tiers.includes(tier) ? language.getByTier(tier).model.definition.description?.trim() : undefined;
2380
+ return description ? `${TIER_WORK[tier]} This tier's model: ${description}` : TIER_WORK[tier];
2381
+ }
2334
2382
  function assertTurnModelRouting(models) {
2335
- const tiers = models?.language?.tiers ?? [];
2383
+ const language = models?.language;
2336
2384
  const decision = models?.decision?.default;
2337
- if (tiers.length === 0 || !decision)
2385
+ if (!language || language.tiers.length === 0 || !decision)
2338
2386
  return;
2339
- if (supportsQuestion(decision.model.definition.capabilities, TIER_QUESTIONS.tier))
2387
+ const { tier } = tierQuestions(language);
2388
+ if (supportsQuestion(decision.model.definition.capabilities, tier))
2340
2389
  return;
2341
2390
  throw new RuntimeError2(`[Sixb] The default decision model '${decision.provider}/${decision.modelId}' cannot pick the tier of an Agent turn: it needs 'choice' questions with ${LANGUAGE_MODEL_TIERS2.length} options. Put a decision model that supports them first in 'models.decision', or configure 'models.language' as a list.`);
2342
2391
  }
@@ -2344,25 +2393,44 @@ function createTurnModelRouter(models, decision) {
2344
2393
  const language = models?.language;
2345
2394
  if (!language || language.tiers.length === 0 || !models?.decision)
2346
2395
  return;
2396
+ const questions = tierQuestions(language);
2347
2397
  return {
2348
- async choose(text, previous, place) {
2349
- const tierProbabilities = text.trim() ? await askTier(decision, text) : undefined;
2398
+ async choose(turn) {
2399
+ const last = turn.previous && previousTurn(language, turn.previous.run, turn.place);
2400
+ const tierProbabilities = turn.text.trim() ? await askTier(decision, questions, decisionInput(turn, last)) : undefined;
2350
2401
  const tier = tierProbabilities ? tierFor(tierProbabilities) : "standard";
2351
2402
  return {
2352
- model: turnModel(language, tier, previous, place),
2403
+ model: turnModel(language, tier, last),
2353
2404
  ...tierProbabilities ? { tierProbabilities } : {}
2354
2405
  };
2355
2406
  }
2356
2407
  };
2357
2408
  }
2358
- async function askTier(decision, text) {
2409
+ function decisionInput(turn, last) {
2410
+ const before = turn.previous?.text?.trim();
2411
+ if (!before)
2412
+ return turn.text;
2413
+ const clipped = before.length > PREVIOUS_MESSAGE_CHARS ? `${before.slice(0, PREVIOUS_MESSAGE_CHARS)}\u2026` : before;
2414
+ const tier = last ? ` tier="${last.tier}"` : "";
2415
+ return [
2416
+ `<previous_message${tier}>`,
2417
+ clipped,
2418
+ "</previous_message>",
2419
+ "",
2420
+ "<message>",
2421
+ turn.text,
2422
+ "</message>"
2423
+ ].join(`
2424
+ `);
2425
+ }
2426
+ async function askTier(decision, questions, input) {
2359
2427
  const timeout = new AbortController;
2360
2428
  const timer = setTimeout(() => {
2361
2429
  timeout.abort(new DOMException("[Sixb] The decision model did not answer in time.", "TimeoutError"));
2362
2430
  }, DECISION_TIMEOUT_MS);
2363
2431
  try {
2364
2432
  const { output } = await Promise.race([
2365
- decision.evaluate({ input: text, questions: TIER_QUESTIONS, signal: timeout.signal }),
2433
+ decision.evaluate({ input, questions, signal: timeout.signal }),
2366
2434
  rejectOnAbort(timeout.signal)
2367
2435
  ]);
2368
2436
  const { light, standard, heavy } = output.tier.probabilities;
@@ -2383,9 +2451,8 @@ function tierFor(probabilities) {
2383
2451
  return "light";
2384
2452
  return "standard";
2385
2453
  }
2386
- function turnModel(language, tier, previous, place) {
2454
+ function turnModel(language, tier, last) {
2387
2455
  const target = language.getByTier(tier);
2388
- const last = previous && previousTurn(language, previous, place);
2389
2456
  if (!last)
2390
2457
  return target;
2391
2458
  const change = tierRank(target.tier ?? tier) - tierRank(last.tier);
@@ -2569,6 +2636,12 @@ import { randomUUID as randomUUID5 } from "crypto";
2569
2636
  async function resolveAgentContextParts2(runtime, input) {
2570
2637
  const entries = normalizeAgentContextEntries2(input);
2571
2638
  for (const entry of entries) {
2639
+ if (entry.context.kind === "artifact") {
2640
+ const artifact = await getCallerArtifacts(runtime).get(entry.context.id);
2641
+ if (!artifact)
2642
+ invalidContext(`context references an unknown artifact '${entry.context.id}'`);
2643
+ continue;
2644
+ }
2572
2645
  if (entry.context.kind !== "object")
2573
2646
  continue;
2574
2647
  const { objectTypeId, primaryId } = entry.context.ref;
@@ -2720,6 +2793,8 @@ async function requestAgentRun2(runtime, execution, models, input) {
2720
2793
  const place = turnPlace2(runsOn, existingThread ? existingThread.computer : input.computer);
2721
2794
  const selected = "router" in requested ? await routedConversationRunSpec({
2722
2795
  ...requested,
2796
+ agents,
2797
+ projectId,
2723
2798
  previous: existingThread ? await latestConversationRun(agents, projectId, existingThread.id) : undefined,
2724
2799
  place,
2725
2800
  settings,
@@ -2834,6 +2909,8 @@ async function editAgentMessage2(runtime, execution, models, input, blobStorage)
2834
2909
  const place = turnPlace2(thread.runsOn, thread.computer);
2835
2910
  const selected = "router" in requested ? await routedConversationRunSpec({
2836
2911
  ...requested,
2912
+ agents,
2913
+ projectId,
2837
2914
  previous: await latestRetainedConversationRun(agents, projectId, thread.id, tail),
2838
2915
  place,
2839
2916
  settings,
@@ -3667,7 +3744,11 @@ function routedTurn(router, selection, input) {
3667
3744
  return { router, text: input.text ?? "" };
3668
3745
  }
3669
3746
  async function routedConversationRunSpec(input) {
3670
- const choice = await input.router.choose(input.text, input.previous, input.place);
3747
+ const previous = input.previous && {
3748
+ run: input.previous,
3749
+ text: await messageWords(input.agents, input.projectId, input.previous.triggerMessageId)
3750
+ };
3751
+ const choice = await input.router.choose({ text: input.text, previous, place: input.place });
3671
3752
  return resolveConversationRunSpec({
3672
3753
  models: input.language,
3673
3754
  selection: { model: choice.model },
@@ -3675,6 +3756,14 @@ async function routedConversationRunSpec(input) {
3675
3756
  tierProbabilities: choice.tierProbabilities
3676
3757
  });
3677
3758
  }
3759
+ async function messageWords(agents, projectId, messageId) {
3760
+ const message = await agents.messages.getById({ projectId, id: messageId });
3761
+ if (!message)
3762
+ return;
3763
+ const words = message.parts.flatMap((part) => part.type === "text" ? [part.text] : []).join(`
3764
+ `).trim();
3765
+ return words || undefined;
3766
+ }
3678
3767
  async function latestConversationRun(agents, projectId, threadId) {
3679
3768
  const { runs } = await agents.runs.list({
3680
3769
  projectId,
@@ -4390,6 +4479,26 @@ function createAgentRuntime(runtime, execution, models, decision, sandbox, secur
4390
4479
  const views = await agentThreadViews(runtime, result.threads);
4391
4480
  return { ...result, threads: await withThreadState(views, readViewer()) };
4392
4481
  },
4482
+ listForArtifact: async (artifactId) => {
4483
+ if (!await getCallerArtifacts(runtime).get(artifactId))
4484
+ return null;
4485
+ const scope = rule.scope();
4486
+ if (scope === "none")
4487
+ return [];
4488
+ const projectId = runtime.projectId;
4489
+ const reader = scope === "every" ? {} : { reader: scope.reader };
4490
+ const [shared, carried] = await Promise.all([
4491
+ runtime.storage.artifacts?.listThreadIds({ projectId, id: artifactId, ...reader }) ?? [],
4492
+ runtime.storage.agents?.messages.listThreadIdsByArtifactContext({
4493
+ projectId,
4494
+ artifactId,
4495
+ ...reader
4496
+ }) ?? []
4497
+ ]);
4498
+ const readable = await rule.readConversations([...shared, ...carried]);
4499
+ const threads = readable.map(({ thread }) => thread).sort((left, right) => right.updatedAt.getTime() - left.updatedAt.getTime() || (left.id < right.id ? 1 : -1));
4500
+ return withThreadState(threads, readViewer());
4501
+ },
4393
4502
  participants: {
4394
4503
  add: (threadId, users) => addAgentThreadParticipants(runtime, rule, security, threadId, users),
4395
4504
  remove: (threadId, user) => removeAgentThreadParticipant(runtime, rule, threadId, user)
@@ -4721,11 +4830,11 @@ function createBlobsRuntime(runtime, execution, blobStorage, apiPublicOrigin) {
4721
4830
  },
4722
4831
  createDownloadUrl: async (file, options) => {
4723
4832
  assertAccess();
4724
- return createFileDownloadUrl(downloadUrlContext(), file, options);
4833
+ return createFileDownloadUrl2(downloadUrlContext(), file, options);
4725
4834
  },
4726
4835
  revokeDownloadUrl: async (id) => {
4727
4836
  assertAccess();
4728
- return revokeFileDownloadUrl(downloadUrlContext(), id);
4837
+ return revokeFileDownloadUrl2(downloadUrlContext(), id);
4729
4838
  }
4730
4839
  };
4731
4840
  if (supportsRangeRead2(blobStorage)) {
@@ -6498,11 +6607,54 @@ async function recordDecision(accounting, model, callId, metadata) {
6498
6607
  }
6499
6608
 
6500
6609
  // src/models/execution.ts
6501
- import { randomUUID as randomUUID13 } from "crypto";
6610
+ import { randomUUID as randomUUID12 } from "crypto";
6502
6611
 
6503
6612
  // src/agents/model-loop.ts
6504
6613
  import { randomUUID as randomUUID9 } from "crypto";
6505
6614
 
6615
+ // src/agents/model-call-retry.ts
6616
+ var MODEL_CALL_RETRY = {
6617
+ retries: 4,
6618
+ initialMs: 1000,
6619
+ maxMs: 8000
6620
+ };
6621
+ var CONNECTION_LOST_CODES = new Set([
6622
+ "ECONNREFUSED",
6623
+ "ECONNRESET",
6624
+ "ECONNABORTED",
6625
+ "EPIPE",
6626
+ "ETIMEDOUT",
6627
+ "EAI_AGAIN",
6628
+ "EHOSTUNREACH",
6629
+ "ENETUNREACH",
6630
+ "ConnectionRefused",
6631
+ "ConnectionClosed",
6632
+ "FailedToOpenSocket",
6633
+ "UND_ERR_SOCKET",
6634
+ "UND_ERR_CONNECT_TIMEOUT",
6635
+ "UND_ERR_HEADERS_TIMEOUT",
6636
+ "UND_ERR_BODY_TIMEOUT"
6637
+ ]);
6638
+ function lostConnectionCode(error) {
6639
+ const code = errorCode(error) ?? (error instanceof TypeError ? errorCode(error.cause) : undefined);
6640
+ return code !== undefined && CONNECTION_LOST_CODES.has(code) ? code : undefined;
6641
+ }
6642
+ function modelCallInterrupted(error) {
6643
+ if (lostConnectionCode(error) !== undefined)
6644
+ return true;
6645
+ return error instanceof ModelProviderError2 && error.reason === "interrupted";
6646
+ }
6647
+ function modelCallRetryDelay(retry) {
6648
+ const ceiling = backoffDelay2(retry, MODEL_CALL_RETRY);
6649
+ return Math.round(ceiling / 2 + Math.random() * ceiling / 2);
6650
+ }
6651
+ function errorCode(error) {
6652
+ if (typeof error !== "object" || error === null)
6653
+ return;
6654
+ const code = Reflect.get(error, "code");
6655
+ return typeof code === "string" ? code : undefined;
6656
+ }
6657
+
6506
6658
  // src/agents/tool-input-coercion.ts
6507
6659
  function coerceToolInput(schema, input) {
6508
6660
  return coerce(schema, input);
@@ -6656,7 +6808,9 @@ async function runModelLoop2(input) {
6656
6808
  let callId;
6657
6809
  let cost;
6658
6810
  let completed;
6659
- for (let attempt = 0;; attempt += 1) {
6811
+ let recoveryAsked = false;
6812
+ let retries = 0;
6813
+ for (;; ) {
6660
6814
  callId = generateCallId();
6661
6815
  if (!callId || callIds.has(callId)) {
6662
6816
  throw new ModelStreamError2(`[SixbModels] Model call IDs must be nonempty and unique.`);
@@ -6674,11 +6828,23 @@ async function runModelLoop2(input) {
6674
6828
  if (call.aborted) {
6675
6829
  return { status: "aborted", steps, partialContent: accumulator.partialContent() };
6676
6830
  }
6831
+ if (call.failure?.interrupted && retries < MODEL_CALL_RETRY.retries) {
6832
+ const delayMs = modelCallRetryDelay(retries);
6833
+ retries += 1;
6834
+ console.warn(`[SixbModels] Model call '${callId}' was interrupted; asking again in ${delayMs} ms.`, call.failure.error);
6835
+ if (accumulator.streamed)
6836
+ await input.onEvent?.({ type: "start-step", retry: true });
6837
+ await waitUnlessAborted2(delayMs, input.signal);
6838
+ if (input.signal.aborted)
6839
+ return { status: "aborted", steps, partialContent: [] };
6840
+ continue;
6841
+ }
6677
6842
  const finished = call.failure && !accumulator.isFinished() ? undefined : accumulator.complete();
6678
6843
  const failure = call.failure ?? (finished?.finishReason === "length" && finished.contextWindowExceeded ? {
6679
6844
  error: new ModelProviderError2("[SixbModels] The answer filled the model's context window.", input.model.providerId, input.model.modelId, { reason: "context-window-exceeded" })
6680
6845
  } : undefined);
6681
- if (failure && attempt === 0 && input.recoverStep) {
6846
+ if (failure && !recoveryAsked && input.recoverStep) {
6847
+ recoveryAsked = true;
6682
6848
  let recovered;
6683
6849
  try {
6684
6850
  recovered = await input.recoverStep({
@@ -6786,7 +6952,7 @@ async function runModelLoop2(input) {
6786
6952
  const output = responseText(response);
6787
6953
  return { status: "completed", output, steps, finishReason: response.finishReason };
6788
6954
  }
6789
- const toolResults = await Promise.all(localCalls.map((call) => executeToolCall(call, tools, callId, input.signal, input.onEvent)));
6955
+ const toolResults = await executeToolCalls(localCalls, (call) => tools.get(call.part.toolName)?.readOnly === true, (call) => executeToolCall(call, tools, callId, input.signal, input.onEvent));
6790
6956
  const step = modelStep(response, responseId, [...response.content, ...toolResults], cost);
6791
6957
  steps.push(step);
6792
6958
  await input.onStepEnd?.(step);
@@ -6854,10 +7020,12 @@ async function callModel(input, call) {
6854
7020
  } catch (error) {
6855
7021
  if (error instanceof ModelUsageRecordingError2)
6856
7022
  throw error;
6857
- if (input.signal.aborted || isAbortError2(error))
7023
+ if (input.signal.aborted || isAbortError2(error)) {
6858
7024
  cancelled = true;
6859
- else
6860
- failure = { error };
7025
+ } else {
7026
+ const interrupted = !accumulator.readerFailed && modelCallInterrupted(error);
7027
+ failure = { error, interrupted };
7028
+ }
6861
7029
  } finally {
6862
7030
  if (accepted)
6863
7031
  cost = accumulator.meter.end({ model: input.model, callId: call.callId }).cost;
@@ -6938,8 +7106,33 @@ function modelStep(response, responseId, content, cost) {
6938
7106
  ...response.route === undefined ? {} : { route: response.route }
6939
7107
  };
6940
7108
  }
7109
+ async function executeToolCalls(calls, readOnly, execute) {
7110
+ const results = [];
7111
+ let reads = [];
7112
+ for (const call of calls) {
7113
+ if (readOnly(call)) {
7114
+ reads.push(call);
7115
+ continue;
7116
+ }
7117
+ results.push(...await Promise.all(reads.map(execute)));
7118
+ reads = [];
7119
+ results.push(await execute(call));
7120
+ }
7121
+ results.push(...await Promise.all(reads.map(execute)));
7122
+ return results;
7123
+ }
6941
7124
  async function executeToolCall(call, tools, callId, signal, onEvent) {
6942
7125
  const { part } = call;
7126
+ if (signal.aborted) {
7127
+ const errorText = "The run stopped before this call started.";
7128
+ await onEvent?.({
7129
+ type: "tool-output-error",
7130
+ toolCallId: part.toolCallId,
7131
+ toolName: part.toolName,
7132
+ errorText
7133
+ });
7134
+ return toolErrorResult(part, errorText);
7135
+ }
6943
7136
  if (call.inputError) {
6944
7137
  const errorText = `Tool input is not valid JSON: ${call.inputError.message}`;
6945
7138
  await onEvent?.({
@@ -7059,6 +7252,7 @@ class StreamAccumulator {
7059
7252
  rawFinishReason;
7060
7253
  contextWindowExceeded = false;
7061
7254
  streamed = false;
7255
+ readerFailed = false;
7062
7256
  meter = new LanguageModelCallMeter;
7063
7257
  projectionError;
7064
7258
  constructor(reader) {
@@ -7066,7 +7260,12 @@ class StreamAccumulator {
7066
7260
  }
7067
7261
  async onEvent(chunk) {
7068
7262
  this.streamed = true;
7069
- await this.reader?.(chunk);
7263
+ try {
7264
+ await this.reader?.(chunk);
7265
+ } catch (error) {
7266
+ this.readerFailed = true;
7267
+ throw error;
7268
+ }
7070
7269
  }
7071
7270
  isFinished() {
7072
7271
  return this.finished;
@@ -7453,389 +7652,27 @@ function isAbortError2(error) {
7453
7652
  return error instanceof DOMException && error.name === "AbortError" || error instanceof Error && error.name === "AbortError";
7454
7653
  }
7455
7654
 
7456
- // src/models/audio/runtime.ts
7457
- import { randomUUID as randomUUID11 } from "crypto";
7458
-
7459
- // src/models/input-file.ts
7460
- import { createHash } from "crypto";
7461
- function prepareModelInputFile(input, type) {
7462
- if (!isFileRef2(input) || !Number.isSafeInteger(input.sizeBytes) || input.sizeBytes <= 0) {
7463
- throw new TypeError(`[SixbModels] ${capitalize(type)} input must be a nonempty FileRef.`);
7464
- }
7465
- const file = { ...input };
7466
- const mediaType = modelInputMediaType(file.mediaType, type);
7467
- if (!mediaType) {
7468
- throw new TypeError(`[SixbModels] ${capitalize(type)} FileRef must declare an ${type} mediaType.`);
7469
- }
7470
- return { file, mediaType };
7471
- }
7472
- function prepareModelInputBytes(input, type) {
7473
- if (!(input.data instanceof Uint8Array) || input.data.byteLength === 0) {
7474
- throw new TypeError(`[SixbModels] ${capitalize(type)} data must be a nonempty Uint8Array.`);
7475
- }
7476
- const mediaType = modelInputMediaType(input.mediaType, type);
7477
- if (!mediaType) {
7478
- throw new TypeError(`[SixbModels] ${capitalize(type)} data must declare an ${type} mediaType.`);
7479
- }
7480
- return { bytes: input.data.slice(), mediaType };
7481
- }
7482
- function modelInputMediaType(value, type) {
7483
- if (typeof value !== "string")
7484
- return;
7485
- const mediaType = value.split(";", 1)[0]?.trim().toLowerCase();
7486
- return mediaType && new RegExp(`^${type}/[a-z0-9.+-]+$`).test(mediaType) ? mediaType : undefined;
7487
- }
7488
- function capitalize(type) {
7489
- return type === "audio" ? "Audio" : "Image";
7490
- }
7491
- async function readModelInputFile(storage, file, signal) {
7492
- const info = await storage.stat(file.blobId);
7493
- signal.throwIfAborted();
7494
- if (!info || info.blobId !== file.blobId || info.digest !== file.digest || info.sizeBytes !== file.sizeBytes) {
7495
- throw new Error("[SixbModels] File reference does not match the stored file.");
7496
- }
7497
- const stream = await storage.open(file.blobId);
7498
- const reader = stream.getReader();
7499
- const cancel = () => {
7500
- reader.cancel(signal.reason).catch(() => {
7501
- return;
7502
- });
7503
- };
7504
- signal.addEventListener("abort", cancel, { once: true });
7505
- let complete = false;
7506
- try {
7507
- signal.throwIfAborted();
7508
- const bytes = new Uint8Array(file.sizeBytes);
7509
- const hash = createHash("sha256");
7510
- let offset = 0;
7511
- while (true) {
7512
- const { value, done } = await reader.read();
7513
- signal.throwIfAborted();
7514
- if (done)
7515
- break;
7516
- if (!(value instanceof Uint8Array) || value.byteLength > bytes.byteLength - offset) {
7517
- throw new Error("[SixbModels] File stream exceeds its declared size.");
7518
- }
7519
- bytes.set(value, offset);
7520
- hash.update(value);
7521
- offset += value.byteLength;
7522
- }
7523
- if (offset !== file.sizeBytes || `sha256:${hash.digest("hex")}` !== file.digest) {
7524
- throw new Error("[SixbModels] File stream does not match its content-addressed reference.");
7525
- }
7526
- complete = true;
7527
- return bytes;
7528
- } finally {
7529
- signal.removeEventListener("abort", cancel);
7530
- if (!complete) {
7531
- reader.cancel().catch(() => {
7532
- return;
7533
- });
7534
- }
7535
- reader.releaseLock();
7536
- }
7537
- }
7538
-
7539
- // src/models/audio/speech.ts
7540
- import { randomUUID as randomUUID10 } from "crypto";
7541
- function createSpeak(runtime, execution, catalog, session, blobs) {
7542
- return async (input) => {
7543
- assertModelAccess2(runtime, execution, "models.audio.speak");
7544
- const prepared = prepareRequest(input);
7545
- if (!blobs) {
7546
- throw new Error("[SixbModels] Speech generation requires blob storage.");
7547
- }
7548
- const signal = session.signal(input.signal);
7549
- signal.throwIfAborted();
7550
- const binding = selectModel(catalog, input.model);
7551
- assertSpeechModel(binding);
7552
- assertRequestSupport(binding, withVoice(binding, prepared));
7553
- const accounting = await session.accounting();
7554
- accounting.assertHealthy();
7555
- const model = binding.resolve ? await binding.resolve() : binding;
7556
- assertSpeechModel(model);
7557
- if (model.providerId !== binding.providerId || model.modelId !== binding.modelId) {
7558
- throw new TypeError("[SixbModels] Resolved speech model identity does not match the selected model.");
7559
- }
7560
- const request = withVoice(model, prepared);
7561
- assertRequestSupport(model, request);
7562
- signal.throwIfAborted();
7563
- const callId = `call_${randomUUID10()}`;
7564
- await accounting.admitCall({
7565
- callId,
7566
- providerId: model.providerId,
7567
- modelId: model.modelId,
7568
- modelKind: "speech",
7569
- inputTokens: {
7570
- status: "estimated",
7571
- tokens: Math.ceil(new TextEncoder().encode(request.text).byteLength / 4),
7572
- method: "utf8BytesDividedByFour"
7573
- },
7574
- outputTokenAllowance: 0,
7575
- reservationCost: estimateReservationCost(model, {
7576
- text: request.text,
7577
- ...request.voice === undefined ? {} : { voice: request.voice },
7578
- ...request.instructions === undefined ? {} : { instructions: request.instructions }
7579
- })
7580
- });
7581
- let result;
7582
- try {
7583
- signal.throwIfAborted();
7584
- result = await model.speak({ ...request, signal });
7585
- } catch (error) {
7586
- await recordSpeech(accounting, model, callId, error instanceof SpeechModelResponseError2 ? error.metadata : {});
7587
- throw error;
7588
- }
7589
- const event = await recordSpeech(accounting, model, callId, result ?? {});
7590
- signal.throwIfAborted();
7591
- const audio = result?.output?.audio;
7592
- if (!(audio?.data instanceof Uint8Array) || audio.data.byteLength === 0 || typeof audio.mediaType !== "string" || !/^audio\/[a-z0-9.+-]+$/.test(audio.mediaType) || request.mediaType !== undefined && audio.mediaType !== request.mediaType || !isWarnings(result.warnings)) {
7593
- throw new SpeechModelResponseError2("[SixbModels] Invalid speech response.", model.providerId, model.modelId, result ?? {});
7594
- }
7595
- const file = await blobs.put({
7596
- body: audio.data,
7597
- expectedSizeBytes: audio.data.byteLength,
7598
- mediaType: audio.mediaType,
7599
- signal
7600
- });
7601
- await accounting.recordFiles(callId, [file]);
7602
- return {
7603
- file,
7604
- warnings: [...result.warnings ?? []],
7605
- usage: event.usage,
7606
- cost: event.cost,
7607
- callId
7608
- };
7609
- };
7610
- }
7611
- function prepareRequest(input) {
7612
- if (typeof input?.text !== "string" || !input.text.trim()) {
7613
- throw new TypeError("[SixbModels] Speech generation requires nonblank text.");
7614
- }
7615
- for (const field of ["voice", "instructions", "language"]) {
7616
- const value = input[field];
7617
- if (value !== undefined && (typeof value !== "string" || !value.trim())) {
7618
- throw new TypeError(`[SixbModels] Speech ${field} must be a nonblank string.`);
7619
- }
7620
- }
7621
- const mediaType = input.mediaType?.split(";", 1)[0]?.trim().toLowerCase();
7622
- if (input.mediaType !== undefined && !/^audio\/[a-z0-9.+-]+$/.test(mediaType ?? "")) {
7623
- throw new TypeError("[SixbModels] Speech mediaType must be an audio media type.");
7624
- }
7625
- if (input.speed !== undefined && (typeof input.speed !== "number" || !Number.isFinite(input.speed) || input.speed <= 0)) {
7626
- throw new TypeError("[SixbModels] Speech speed must be a positive number.");
7627
- }
7628
- return {
7629
- text: input.text,
7630
- ...input.voice === undefined ? {} : { voice: input.voice },
7631
- ...input.instructions === undefined ? {} : { instructions: input.instructions },
7632
- ...mediaType === undefined ? {} : { mediaType },
7633
- ...input.speed === undefined ? {} : { speed: input.speed },
7634
- ...input.language === undefined ? {} : { language: input.language }
7635
- };
7636
- }
7637
- function withVoice(model, request) {
7638
- const voice = request.voice ?? model.defaultVoice;
7639
- return voice === undefined ? request : { ...request, voice };
7640
- }
7641
- function selectModel(catalog, requested) {
7642
- const selected = requested ?? catalog?.audio?.speech?.default.model;
7643
- if (!selected) {
7644
- throw new Error("[SixbModels] Configure models.audio.speech in createSixb() or supply a model to speak().");
7645
- }
7646
- return selected;
7647
- }
7648
- function assertRequestSupport(model, request) {
7649
- const definition = model.definition;
7650
- if (definition.maxInputCharacters !== undefined && request.text.length > definition.maxInputCharacters) {
7651
- throw new RangeError(`[SixbModels] Text exceeds the model's ${definition.maxInputCharacters}-character input limit.`);
7652
- }
7653
- if (request.voice !== undefined && definition.voices && !definition.voices.includes(request.voice)) {
7654
- throw new TypeError(`[SixbModels] Voice '${request.voice}' is not supported by the selected model. Use one of: ${definition.voices.join(", ")}.`);
7655
- }
7656
- if (request.mediaType !== undefined && definition.outputMediaTypes && !definition.outputMediaTypes.includes(request.mediaType)) {
7657
- throw new TypeError(`[SixbModels] Speech media type '${request.mediaType}' is not supported by the selected model. Use one of: ${definition.outputMediaTypes.join(", ")}.`);
7658
- }
7659
- if (request.instructions !== undefined && definition.instructions === false) {
7660
- throw new TypeError("[SixbModels] The selected model does not take speech instructions.");
7661
- }
7662
- }
7663
- function estimateReservationCost(model, input) {
7664
- try {
7665
- return model.costEstimator?.estimateReservation?.(input);
7666
- } catch {
7667
- return;
7668
- }
7669
- }
7670
- async function recordSpeech(accounting, model, callId, metadata) {
7671
- const usage = metadata.usage ?? {};
7672
- const estimate = estimateModelCall(model, {
7673
- usage,
7674
- route: metadata.route,
7675
- responseModelId: metadata.responseModelId,
7676
- ...metadata.pricingDimensions === undefined ? {} : { dimensions: metadata.pricingDimensions }
7677
- });
7678
- const event = {
7679
- callId,
7680
- modelKind: "speech",
7681
- providerId: model.providerId,
7682
- modelId: model.modelId,
7683
- responseId: metadata.providerIds?.responseId ?? callId,
7684
- providerIds: metadata.providerIds,
7685
- responseModelId: metadata.responseModelId,
7686
- usage,
7687
- cost: metadata.reportedCost ? { status: "reported", ...metadata.reportedCost } : estimate,
7688
- ...metadata.reportedCost ? { estimate } : {},
7689
- route: metadata.route
7690
- };
7691
- await accounting.onModelCallEnd(event);
7692
- return event;
7693
- }
7694
- function isWarnings(value) {
7695
- return value === undefined || Array.isArray(value) && value.every((w) => typeof w === "string");
7696
- }
7697
-
7698
- // src/models/audio/runtime.ts
7699
- function createAudioRuntime(runtime, execution, catalog, session, blobs) {
7655
+ // src/models/calls.ts
7656
+ var MAX_SUBAGENT_DEPTH = 32;
7657
+ function createModelCallsRuntime(runtime, runs, executionId) {
7658
+ const canReadCallsOf = createModelCallVisibility(runtime, runs, executionId);
7700
7659
  return {
7701
- speak: createSpeak(runtime, execution, catalog, session, blobs),
7702
- async transcribe(input) {
7703
- assertModelAccess2(runtime, execution, "models.audio.transcribe");
7704
- const { mediaType, sizeBytes, read } = prepareAudio(input.audio, blobs);
7705
- const signal = session.signal(input.signal);
7706
- signal.throwIfAborted();
7707
- const binding = selectModel2(catalog, input.model);
7708
- assertTranscriptionModel(binding);
7709
- assertFileSupport(binding, sizeBytes, mediaType);
7710
- const accounting = await session.accounting();
7711
- accounting.assertHealthy();
7712
- const model = binding.resolve ? await binding.resolve() : binding;
7713
- assertTranscriptionModel(model);
7714
- if (model.providerId !== binding.providerId || model.modelId !== binding.modelId) {
7715
- throw new TypeError("[SixbModels] Resolved transcription model identity does not match the selected model.");
7660
+ async files(callId) {
7661
+ if (typeof callId !== "string" || !callId.trim()) {
7662
+ throw new TypeError("[SixbModels] A model call ID must be a nonblank string.");
7716
7663
  }
7717
- assertFileSupport(model, sizeBytes, mediaType);
7718
- signal.throwIfAborted();
7719
- const bytes = await read(signal);
7720
- accounting.assertHealthy();
7721
- const reservationCost = estimateReservationCost2(model, bytes.byteLength, mediaType);
7722
- const callId = `call_${randomUUID11()}`;
7723
- await accounting.admitCall({
7724
- callId,
7725
- providerId: model.providerId,
7726
- modelId: model.modelId,
7727
- modelKind: "transcription",
7728
- inputTokens: { status: "unavailable", reason: "nonTextInput" },
7729
- outputTokenAllowance: 0,
7730
- reservationCost
7664
+ const record = await runtime.storage.aiUsage?.getModelCallFiles({
7665
+ projectId: runtime.projectId,
7666
+ callId
7731
7667
  });
7732
- let result;
7733
- try {
7734
- signal.throwIfAborted();
7735
- result = await model.transcribe({ audio: bytes, mediaType, signal });
7736
- } catch (error) {
7737
- await recordTranscription(accounting, model, callId, error instanceof TranscriptionModelResponseError2 ? error.metadata : {});
7738
- throw error;
7739
- }
7740
- const event = await recordTranscription(accounting, model, callId, result ?? {});
7741
- signal.throwIfAborted();
7742
- const output = transcriptOutput(result, model);
7743
- return { output, usage: event.usage, cost: event.cost, callId };
7744
- }
7745
- };
7746
- }
7747
- function transcriptOutput(result, model) {
7748
- const refuse = () => new TranscriptionModelResponseError2("[SixbModels] Invalid transcription response.", model.providerId, model.modelId, result ?? {});
7749
- const output = result?.output;
7750
- if (typeof output?.text !== "string")
7751
- throw refuse();
7752
- const words = output.words;
7753
- if (words === undefined)
7754
- return { text: output.text };
7755
- if (!Array.isArray(words))
7756
- throw refuse();
7757
- const timed = [];
7758
- for (const word of words) {
7759
- const entry = word;
7760
- if (typeof entry?.text !== "string" || !entry.text || !isMillisecond(entry.startMs) || !isMillisecond(entry.endMs) || entry.endMs < entry.startMs || entry.speaker !== undefined && (typeof entry.speaker !== "string" || !entry.speaker)) {
7761
- throw refuse();
7762
- }
7763
- timed.push({
7764
- text: entry.text,
7765
- startMs: entry.startMs,
7766
- endMs: entry.endMs,
7767
- ...entry.speaker === undefined ? {} : { speaker: entry.speaker }
7768
- });
7769
- }
7770
- return timed.length ? { text: output.text, words: timed } : { text: output.text };
7771
- }
7772
- function isMillisecond(value) {
7773
- return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
7774
- }
7775
- function prepareAudio(input, blobs) {
7776
- if (typeof input === "object" && input !== null && "data" in input) {
7777
- const { bytes, mediaType } = prepareModelInputBytes(input, "audio");
7778
- return { mediaType, sizeBytes: bytes.byteLength, read: async () => bytes };
7779
- }
7780
- const { file, mediaType } = prepareModelInputFile(input, "audio");
7781
- if (!blobs) {
7782
- throw new Error("[SixbModels] Transcribing a stored file requires blob storage.");
7783
- }
7784
- return {
7785
- mediaType,
7786
- sizeBytes: file.sizeBytes,
7787
- read: (signal) => readModelInputFile(blobs, file, signal)
7788
- };
7789
- }
7790
- function selectModel2(catalog, requested) {
7791
- const selected = requested ?? catalog?.audio?.transcription?.default.model;
7792
- if (!selected) {
7793
- throw new Error("[SixbModels] Configure models.audio.transcription in createSixb() or supply a model to transcribe().");
7794
- }
7795
- return selected;
7796
- }
7797
- function assertFileSupport(model, sizeBytes, mediaType) {
7798
- if (sizeBytes > model.definition.maxInputBytes) {
7799
- throw new RangeError(`[SixbModels] Audio exceeds the model's ${model.definition.maxInputBytes}-byte input limit.`);
7800
- }
7801
- if (model.definition.mediaTypes && !model.definition.mediaTypes.includes(mediaType)) {
7802
- throw new TypeError(`[SixbModels] Audio media type '${mediaType}' is not supported by the selected model.`);
7803
- }
7804
- }
7805
- function estimateReservationCost2(model, sizeBytes, mediaType) {
7806
- try {
7807
- return model.costEstimator?.estimateReservation?.({ sizeBytes, mediaType });
7808
- } catch {
7809
- return;
7810
- }
7811
- }
7812
- async function recordTranscription(accounting, model, callId, metadata) {
7813
- const usage = metadata.usage ?? {};
7814
- const estimate = estimateModelCall(model, {
7815
- usage,
7816
- route: metadata.route,
7817
- responseModelId: metadata.responseModelId
7818
- });
7819
- const event = {
7820
- callId,
7821
- modelKind: "transcription",
7822
- providerId: model.providerId,
7823
- modelId: model.modelId,
7824
- responseId: metadata.providerIds?.responseId ?? callId,
7825
- providerIds: metadata.providerIds,
7826
- responseModelId: metadata.responseModelId,
7827
- usage,
7828
- cost: metadata.reportedCost ? { status: "reported", ...metadata.reportedCost } : estimate,
7829
- ...metadata.reportedCost ? { estimate } : {},
7830
- route: metadata.route
7668
+ if (!record)
7669
+ return null;
7670
+ const visible = { callId: record.callId, files: record.files, recordedAt: record.recordedAt };
7671
+ return await canReadCallsOf(record.executionId) ? visible : null;
7672
+ }
7831
7673
  };
7832
- await accounting.onModelCallEnd(event);
7833
- return event;
7834
7674
  }
7835
-
7836
- // src/models/calls.ts
7837
- var MAX_SUBAGENT_DEPTH = 32;
7838
- function createModelCallsRuntime(runtime, runs, executionId) {
7675
+ function createModelCallVisibility(runtime, runs, executionId) {
7839
7676
  const projectId = runtime.projectId;
7840
7677
  async function canRead(execution) {
7841
7678
  const authority = resolveRuntimeAuthorizationForProject(runtime);
@@ -7874,41 +7711,29 @@ function createModelCallsRuntime(runtime, runs, executionId) {
7874
7711
  }
7875
7712
  return false;
7876
7713
  }
7877
- return {
7878
- async files(callId) {
7879
- if (typeof callId !== "string" || !callId.trim()) {
7880
- throw new TypeError("[SixbModels] A model call ID must be a nonblank string.");
7881
- }
7882
- const record = await runtime.storage.aiUsage?.getModelCallFiles({ projectId, callId });
7883
- if (!record)
7884
- return null;
7885
- const visible = { callId: record.callId, files: record.files, recordedAt: record.recordedAt };
7886
- if (record.executionId === executionId)
7887
- return visible;
7888
- const execution = await runtime.storage.executions.getById({
7889
- projectId,
7890
- id: record.executionId
7891
- });
7892
- return execution && await canRead(execution) ? visible : null;
7893
- }
7714
+ return async (callExecutionId) => {
7715
+ if (callExecutionId === executionId)
7716
+ return true;
7717
+ const execution = await runtime.storage.executions.getById({ projectId, id: callExecutionId });
7718
+ return execution !== null && await canRead(execution);
7894
7719
  };
7895
7720
  }
7896
7721
 
7897
7722
  // src/models/image/runtime.ts
7898
- import { randomUUID as randomUUID12 } from "crypto";
7723
+ import { randomUUID as randomUUID10 } from "crypto";
7899
7724
  function createImageRuntime(runtime, execution, catalog, session, blobs) {
7900
7725
  return {
7901
7726
  async generate(input) {
7902
7727
  assertModelAccess2(runtime, execution, "models.image.generate");
7903
- const request = prepareRequest2(input);
7728
+ const request = prepareRequest(input);
7904
7729
  if (!blobs) {
7905
7730
  throw new Error("[SixbModels] Image generation requires blob storage.");
7906
7731
  }
7907
7732
  const signal = session.signal(input.signal);
7908
7733
  signal.throwIfAborted();
7909
- const binding = selectModel3(catalog, input.model);
7734
+ const binding = selectModel(catalog, input.model);
7910
7735
  assertImageModel(binding);
7911
- assertRequestSupport2(binding, request);
7736
+ assertRequestSupport(binding, request);
7912
7737
  const accounting = await session.accounting();
7913
7738
  accounting.assertHealthy();
7914
7739
  const model = binding.resolve ? await binding.resolve() : binding;
@@ -7916,7 +7741,7 @@ function createImageRuntime(runtime, execution, catalog, session, blobs) {
7916
7741
  if (model.providerId !== binding.providerId || model.modelId !== binding.modelId) {
7917
7742
  throw new TypeError("[SixbModels] Resolved image model identity does not match the selected model.");
7918
7743
  }
7919
- assertRequestSupport2(model, request);
7744
+ assertRequestSupport(model, request);
7920
7745
  const images = [];
7921
7746
  for (const image of request.images) {
7922
7747
  signal.throwIfAborted();
@@ -7928,7 +7753,7 @@ function createImageRuntime(runtime, execution, catalog, session, blobs) {
7928
7753
  accounting.assertHealthy();
7929
7754
  const dimensions = pricingDimensions(request);
7930
7755
  const promptTokens = Math.ceil(new TextEncoder().encode(request.prompt).byteLength / 4);
7931
- const callId = `call_${randomUUID12()}`;
7756
+ const callId = `call_${randomUUID10()}`;
7932
7757
  await accounting.admitCall({
7933
7758
  callId,
7934
7759
  providerId: model.providerId,
@@ -7936,7 +7761,7 @@ function createImageRuntime(runtime, execution, catalog, session, blobs) {
7936
7761
  modelKind: "image",
7937
7762
  inputTokens: images.length > 0 ? { status: "unavailable", reason: "nonTextInput" } : { status: "estimated", tokens: promptTokens, method: "utf8BytesDividedByFour" },
7938
7763
  outputTokenAllowance: 0,
7939
- reservationCost: estimateReservationCost3(model, {
7764
+ reservationCost: estimateReservationCost(model, {
7940
7765
  n: request.n,
7941
7766
  promptTokens,
7942
7767
  inputImages: images.length,
@@ -7987,7 +7812,7 @@ function createImageRuntime(runtime, execution, catalog, session, blobs) {
7987
7812
  }
7988
7813
  };
7989
7814
  }
7990
- function prepareRequest2(input) {
7815
+ function prepareRequest(input) {
7991
7816
  if (typeof input?.prompt !== "string" || !input.prompt.trim()) {
7992
7817
  throw new TypeError("[SixbModels] Image generation requires a nonblank prompt.");
7993
7818
  }
@@ -8018,14 +7843,14 @@ function prepareRequest2(input) {
8018
7843
  images: (input.images ?? []).map((image) => prepareModelInputFile(image, "image"))
8019
7844
  };
8020
7845
  }
8021
- function selectModel3(catalog, requested) {
7846
+ function selectModel(catalog, requested) {
8022
7847
  const selected = requested ?? catalog?.image?.default.model;
8023
7848
  if (!selected) {
8024
7849
  throw new Error("[SixbModels] Configure models.image in createSixb() or supply a model to generate().");
8025
7850
  }
8026
7851
  return selected;
8027
7852
  }
8028
- function assertRequestSupport2(model, request) {
7853
+ function assertRequestSupport(model, request) {
8029
7854
  const definition = model.definition;
8030
7855
  if (definition.maxImagesPerCall !== undefined && request.n > definition.maxImagesPerCall) {
8031
7856
  throw new RangeError(`[SixbModels] The selected model returns at most ${definition.maxImagesPerCall} images per call.`);
@@ -8066,7 +7891,7 @@ function pricingDimensions(request) {
8066
7891
  ...request.style === undefined ? {} : { style: request.style }
8067
7892
  };
8068
7893
  }
8069
- function estimateReservationCost3(model, input) {
7894
+ function estimateReservationCost(model, input) {
8070
7895
  try {
8071
7896
  return model.costEstimator?.estimateReservation?.(input);
8072
7897
  } catch {
@@ -8137,8 +7962,352 @@ function languageModelOutput(shape, valueTypesById) {
8137
7962
  };
8138
7963
  }
8139
7964
 
7965
+ // src/models/video/runtime.ts
7966
+ import { randomUUID as randomUUID11 } from "crypto";
7967
+ var POLL_INTERVAL_MS = 5000;
7968
+ var INPUT_URL_EXPIRY_MS = 60 * 60000;
7969
+ function createVideoRuntime(runtime, execution, catalog, session, dependencies) {
7970
+ const projectId = runtime.projectId;
7971
+ async function start(input) {
7972
+ assertModelAccess2(runtime, execution, "models.video.generate");
7973
+ const request = prepareRequest2(input);
7974
+ const blobs = requireBlobs(dependencies.blobs);
7975
+ const operations = requireOperationStorage(runtime.storage.aiUsage);
7976
+ const signal = session.signal(input.signal);
7977
+ signal.throwIfAborted();
7978
+ const binding = selectModel2(catalog, input.model);
7979
+ assertVideoModel(binding);
7980
+ assertRequestSupport2(binding, request);
7981
+ const accounting = await session.accounting();
7982
+ accounting.assertHealthy();
7983
+ const model = await resolveVideoModel(binding);
7984
+ assertRequestSupport2(model, request);
7985
+ const images = {
7986
+ ...request.firstFrame ? { firstFrame: await inputImage(blobs, request.firstFrame, signal) } : {},
7987
+ ...request.lastFrame ? { lastFrame: await inputImage(blobs, request.lastFrame, signal) } : {},
7988
+ referenceImages: await Promise.all(request.referenceImages.map((image) => inputImage(blobs, image, signal)))
7989
+ };
7990
+ accounting.assertHealthy();
7991
+ const imageCount = countImages(request);
7992
+ const promptTokens = Math.ceil(new TextEncoder().encode(request.prompt).byteLength / 4);
7993
+ const callId = `call_${randomUUID11()}`;
7994
+ await accounting.admitCall({
7995
+ callId,
7996
+ providerId: model.providerId,
7997
+ modelId: model.modelId,
7998
+ modelKind: "video",
7999
+ inputTokens: imageCount > 0 ? { status: "unavailable", reason: "nonTextInput" } : { status: "estimated", tokens: promptTokens, method: "utf8BytesDividedByFour" },
8000
+ outputTokenAllowance: 0,
8001
+ reservationCost: estimateReservationCost2(model, {
8002
+ n: request.n,
8003
+ ...optional("durationSeconds", request.durationSeconds),
8004
+ ...optional("resolution", request.resolution),
8005
+ ...optional("audio", request.audio),
8006
+ promptTokens,
8007
+ inputImages: imageCount
8008
+ })
8009
+ });
8010
+ const initial = {
8011
+ n: request.n,
8012
+ ...optional("durationSeconds", request.durationSeconds),
8013
+ warnings: []
8014
+ };
8015
+ let record;
8016
+ try {
8017
+ record = await operations.createModelCallOperation({
8018
+ projectId,
8019
+ callId,
8020
+ executionId: accounting.executionId,
8021
+ attempt: accounting.attempt,
8022
+ modelKind: "video",
8023
+ providerId: model.providerId,
8024
+ modelId: model.modelId,
8025
+ request: initial,
8026
+ reserved: accounting.hasReservation(callId)
8027
+ });
8028
+ } catch (error) {
8029
+ await accounting.markCallUnknown(callId);
8030
+ throw error;
8031
+ }
8032
+ let started;
8033
+ try {
8034
+ await scheduleVideoCheck(runtime.queues.agents, record);
8035
+ signal.throwIfAborted();
8036
+ started = await model.start({
8037
+ callId,
8038
+ prompt: request.prompt,
8039
+ n: request.n,
8040
+ ...optional("durationSeconds", request.durationSeconds),
8041
+ ...optional("resolution", request.resolution),
8042
+ ...optional("aspectRatio", request.aspectRatio),
8043
+ ...optional("audio", request.audio),
8044
+ ...optional("seed", request.seed),
8045
+ ...images,
8046
+ signal
8047
+ });
8048
+ if (!isStart(started)) {
8049
+ throw new ModelProviderError2("[SixbModels] Invalid video start response.", model.providerId, model.modelId, { code: "invalid_video_response", retryable: false });
8050
+ }
8051
+ } catch (error) {
8052
+ await abandonVideoOperation(operations, record, accounting, "The video could not be started.");
8053
+ throw error;
8054
+ }
8055
+ const stored = {
8056
+ ...initial,
8057
+ ...optional("dimensions", started.pricingDimensions),
8058
+ warnings: [...started.warnings ?? []]
8059
+ };
8060
+ try {
8061
+ const kept = await operations.startModelCallOperation({
8062
+ projectId,
8063
+ callId,
8064
+ operation: started.operation,
8065
+ request: stored
8066
+ });
8067
+ if (!kept)
8068
+ throw new Error(`[SixbModels] Video generation '${callId}' disappeared.`);
8069
+ record = kept;
8070
+ } catch (error) {
8071
+ await accounting.markCallUnknown(callId);
8072
+ throw new Error(`[SixbModels] Video generation '${callId}' started, but Sixb could not keep track of it.`, { cause: error });
8073
+ }
8074
+ return { generation: await generationFrom(record), model };
8075
+ }
8076
+ async function check(callId, binding, callerSignal) {
8077
+ if (typeof callId !== "string" || !callId.trim()) {
8078
+ throw new TypeError("[SixbModels] A model call ID must be a nonblank string.");
8079
+ }
8080
+ const operations = requireOperationStorage(runtime.storage.aiUsage);
8081
+ const record = await operations.getModelCallOperation({ projectId, callId });
8082
+ if (!record || record.modelKind !== "video")
8083
+ return null;
8084
+ if (!await dependencies.canReadCallsOf(record.executionId))
8085
+ return null;
8086
+ if (record.status !== "pending")
8087
+ return generationFrom(record);
8088
+ const checked = await checkVideoOperation({
8089
+ projectId,
8090
+ storage: { executions: runtime.storage.executions, aiUsage: operations },
8091
+ catalog,
8092
+ blobs: dependencies.blobs,
8093
+ accountingFor: (origin, attempt) => session.accountingFor(origin, attempt)
8094
+ }, record, { ...binding ? { binding } : {}, signal: session.signal(callerSignal) });
8095
+ return generationFrom(checked);
8096
+ }
8097
+ async function generationFrom(record) {
8098
+ const stored = storedVideoRequest(record);
8099
+ const base = {
8100
+ callId: record.callId,
8101
+ model: { providerId: record.providerId, modelId: record.modelId },
8102
+ createdAt: record.createdAt
8103
+ };
8104
+ if (record.status === "pending") {
8105
+ return { ...base, status: "pending", files: [], warnings: [...stored.warnings] };
8106
+ }
8107
+ const result = storedVideoResult(record);
8108
+ const files = record.status === "completed" ? (await runtime.storage.aiUsage?.getModelCallFiles({ projectId, callId: record.callId }))?.files ?? [] : [];
8109
+ return {
8110
+ ...base,
8111
+ status: record.status,
8112
+ files,
8113
+ warnings: [...result.warnings],
8114
+ ...optional("error", record.error),
8115
+ usage: result.usage,
8116
+ cost: result.cost
8117
+ };
8118
+ }
8119
+ async function inputImage(blobs, image, signal) {
8120
+ const origin = dependencies.apiPublicOrigin();
8121
+ if (isReachableOrigin(origin) && runtime.storage.fileDownloadGrants) {
8122
+ const download = await createFileDownloadUrl2({
8123
+ projectId,
8124
+ storage: runtime.storage,
8125
+ blobStorage: blobs,
8126
+ executionId: execution.id,
8127
+ apiPublicOrigin: origin
8128
+ }, image.file, { expiresInMs: INPUT_URL_EXPIRY_MS });
8129
+ return { url: download.url, mediaType: image.mediaType };
8130
+ }
8131
+ return { data: await readModelInputFile(blobs, image.file, signal), mediaType: image.mediaType };
8132
+ }
8133
+ return {
8134
+ async generate(input) {
8135
+ const { generation, model } = await start(input);
8136
+ let current = generation;
8137
+ while (current.status === "pending") {
8138
+ await delay(POLL_INTERVAL_MS, session.signal(input.signal));
8139
+ const next = await check(generation.callId, model, input.signal);
8140
+ if (!next) {
8141
+ throw new Error(`[SixbModels] Video generation '${generation.callId}' disappeared.`);
8142
+ }
8143
+ current = next;
8144
+ }
8145
+ if (current.status === "failed") {
8146
+ throw new ModelProviderError2(`[SixbModels] Video generation failed: ${current.error}`, model.providerId, model.modelId);
8147
+ }
8148
+ return {
8149
+ files: current.files,
8150
+ warnings: current.warnings,
8151
+ usage: current.usage ?? {},
8152
+ cost: current.cost ?? { status: "unpriceable", reason: "missing-usage" },
8153
+ callId: current.callId
8154
+ };
8155
+ },
8156
+ async start(input) {
8157
+ return (await start(input)).generation;
8158
+ },
8159
+ get(callId) {
8160
+ return check(callId);
8161
+ }
8162
+ };
8163
+ }
8164
+ function prepareRequest2(input) {
8165
+ if (typeof input?.prompt !== "string" || !input.prompt.trim()) {
8166
+ throw new TypeError("[SixbModels] Video generation requires a nonblank prompt.");
8167
+ }
8168
+ const n = input.n ?? 1;
8169
+ if (!Number.isSafeInteger(n) || n <= 0) {
8170
+ throw new TypeError("[SixbModels] Video count 'n' must be a positive safe integer.");
8171
+ }
8172
+ if (input.duration !== undefined && (!Number.isSafeInteger(input.duration) || input.duration <= 0)) {
8173
+ throw new TypeError("[SixbModels] Video duration must be a positive whole number of seconds.");
8174
+ }
8175
+ if (input.resolution !== undefined && (typeof input.resolution !== "string" || !/^[1-9]\d*x[1-9]\d*$/.test(input.resolution))) {
8176
+ throw new TypeError("[SixbModels] Video resolution must be a frame size such as '1280x720'.");
8177
+ }
8178
+ if (input.aspectRatio !== undefined && (typeof input.aspectRatio !== "string" || !input.aspectRatio.trim())) {
8179
+ throw new TypeError("[SixbModels] Video aspectRatio must be a nonblank string.");
8180
+ }
8181
+ if (input.audio !== undefined && typeof input.audio !== "boolean") {
8182
+ throw new TypeError("[SixbModels] Video audio must be a boolean.");
8183
+ }
8184
+ if (input.seed !== undefined && !Number.isSafeInteger(input.seed)) {
8185
+ throw new TypeError("[SixbModels] Video seed must be a safe integer.");
8186
+ }
8187
+ if (input.referenceImages !== undefined && !Array.isArray(input.referenceImages)) {
8188
+ throw new TypeError("[SixbModels] Reference images must be an array of FileRefs.");
8189
+ }
8190
+ return {
8191
+ prompt: input.prompt,
8192
+ n,
8193
+ ...optional("durationSeconds", input.duration),
8194
+ ...optional("resolution", input.resolution),
8195
+ ...optional("aspectRatio", input.aspectRatio),
8196
+ ...optional("audio", input.audio),
8197
+ ...optional("seed", input.seed),
8198
+ ...input.firstFrame ? { firstFrame: prepareModelInputFile(input.firstFrame, "image") } : {},
8199
+ ...input.lastFrame ? { lastFrame: prepareModelInputFile(input.lastFrame, "image") } : {},
8200
+ referenceImages: (input.referenceImages ?? []).map((image) => prepareModelInputFile(image, "image"))
8201
+ };
8202
+ }
8203
+ function selectModel2(catalog, requested) {
8204
+ const videos = catalog?.video;
8205
+ if (!videos)
8206
+ throw new Error("[SixbModels] Configure models.video in createSixb().");
8207
+ if (!requested)
8208
+ return videos.default.model;
8209
+ const ref = { provider: requested.providerId, modelId: requested.modelId };
8210
+ if (!videos.getByRef(ref)) {
8211
+ throw new Error(`[SixbModels] Video model '${ref.provider}/${ref.modelId}' is not in models.video: list it in createSixb() to generate with it.`);
8212
+ }
8213
+ return requested;
8214
+ }
8215
+ function assertRequestSupport2(model, request) {
8216
+ const definition = model.definition;
8217
+ if (definition.maxVideosPerCall !== undefined && request.n > definition.maxVideosPerCall) {
8218
+ throw new RangeError(`[SixbModels] The selected model returns at most ${definition.maxVideosPerCall} videos per call.`);
8219
+ }
8220
+ for (const [field, list] of [
8221
+ ["resolution", definition.resolutions],
8222
+ ["aspectRatio", definition.aspectRatios]
8223
+ ]) {
8224
+ const value = request[field];
8225
+ if (value !== undefined && list && !list.includes(value)) {
8226
+ throw new TypeError(`[SixbModels] Video ${field} '${value}' is not supported by the selected model. Use one of: ${list.join(", ")}.`);
8227
+ }
8228
+ }
8229
+ const durations = definition.durations;
8230
+ if (request.durationSeconds !== undefined && durations && !durations.includes(request.durationSeconds)) {
8231
+ throw new TypeError(`[SixbModels] A ${request.durationSeconds}-second video is not supported by the selected model. Use one of: ${durations.join(", ")} seconds.`);
8232
+ }
8233
+ if (request.audio === true && definition.audio === false) {
8234
+ throw new TypeError("[SixbModels] The selected model makes videos without sound.");
8235
+ }
8236
+ const images = [
8237
+ ...request.firstFrame ? [request.firstFrame] : [],
8238
+ ...request.lastFrame ? [request.lastFrame] : [],
8239
+ ...request.referenceImages
8240
+ ];
8241
+ if (images.length === 0)
8242
+ return;
8243
+ const accepted = definition.inputImages;
8244
+ if (!accepted) {
8245
+ throw new TypeError("[SixbModels] The selected model does not accept input images.");
8246
+ }
8247
+ if (images.length > accepted.maxCount) {
8248
+ throw new RangeError(`[SixbModels] The selected model accepts at most ${accepted.maxCount} input images.`);
8249
+ }
8250
+ for (const image of images) {
8251
+ if (image.file.sizeBytes > accepted.maxBytes) {
8252
+ throw new RangeError(`[SixbModels] Input image exceeds the model's ${accepted.maxBytes}-byte input limit.`);
8253
+ }
8254
+ if (accepted.mediaTypes && !accepted.mediaTypes.includes(image.mediaType)) {
8255
+ throw new TypeError(`[SixbModels] Image media type '${image.mediaType}' is not supported by the selected model.`);
8256
+ }
8257
+ }
8258
+ }
8259
+ function countImages(request) {
8260
+ return (request.firstFrame ? 1 : 0) + (request.lastFrame ? 1 : 0) + request.referenceImages.length;
8261
+ }
8262
+ function estimateReservationCost2(model, input) {
8263
+ try {
8264
+ return model.costEstimator?.estimateReservation?.(input);
8265
+ } catch {
8266
+ return;
8267
+ }
8268
+ }
8269
+ function requireBlobs(blobs) {
8270
+ if (!blobs)
8271
+ throw new Error("[SixbModels] Video generation requires blob storage.");
8272
+ return blobs;
8273
+ }
8274
+ function requireOperationStorage(storage) {
8275
+ if (!storage)
8276
+ throw new Error("[SixbModels] Video generation requires storage.aiUsage.");
8277
+ return storage;
8278
+ }
8279
+ function isReachableOrigin(origin) {
8280
+ if (!origin)
8281
+ return false;
8282
+ const host = new URL(origin).hostname;
8283
+ return !(host === "localhost" || host.endsWith(".localhost") || host === "[::1]" || host === "0.0.0.0" || host.startsWith("127."));
8284
+ }
8285
+ function isStart(value) {
8286
+ const start = value;
8287
+ return start !== null && typeof start === "object" && start.operation !== undefined && start.operation !== null && (start.warnings === undefined || isWarnings(start.warnings));
8288
+ }
8289
+ function optional(key, value) {
8290
+ return value === undefined ? {} : { [key]: value };
8291
+ }
8292
+ function delay(ms, signal) {
8293
+ return new Promise((resolve, reject) => {
8294
+ signal.throwIfAborted();
8295
+ const timer = setTimeout(() => {
8296
+ signal.removeEventListener("abort", abort);
8297
+ resolve();
8298
+ }, ms);
8299
+ const abort = () => {
8300
+ clearTimeout(timer);
8301
+ reject(signal.reason);
8302
+ };
8303
+ signal.addEventListener("abort", abort, { once: true });
8304
+ });
8305
+ }
8306
+
8140
8307
  // src/models/execution.ts
8141
- function createModelsRuntime(runtime, execution, catalog, session, runs, blobs) {
8308
+ function createModelsRuntime(runtime, execution, catalog, session, runs, blobs, apiPublicOrigin = () => {
8309
+ return;
8310
+ }) {
8142
8311
  async function generate(input) {
8143
8312
  assertModelAccess2(runtime, execution, "models.language.generate");
8144
8313
  const messages = generationMessages(input);
@@ -8164,7 +8333,7 @@ function createModelsRuntime(runtime, execution, catalog, session, runs, blobs)
8164
8333
  const accounting = await session.accounting();
8165
8334
  accounting.assertHealthy();
8166
8335
  signal.throwIfAborted();
8167
- const callId = `model_call_${randomUUID13()}`;
8336
+ const callId = `model_call_${randomUUID12()}`;
8168
8337
  const options = {
8169
8338
  model: accounting.wrapModel(model),
8170
8339
  generateCallId: () => callId,
@@ -8201,6 +8370,11 @@ function createModelsRuntime(runtime, execution, catalog, session, runs, blobs)
8201
8370
  decision: createDecisionRuntime(runtime, execution, catalog, session, "models"),
8202
8371
  audio: createAudioRuntime(runtime, execution, catalog, session, blobs),
8203
8372
  image: createImageRuntime(runtime, execution, catalog, session, blobs),
8373
+ video: createVideoRuntime(runtime, execution, catalog, session, {
8374
+ blobs,
8375
+ canReadCallsOf: createModelCallVisibility(runtime, runs, execution.id),
8376
+ apiPublicOrigin
8377
+ }),
8204
8378
  calls: createModelCallsRuntime(runtime, runs, execution.id)
8205
8379
  };
8206
8380
  registerModelExecutionBinding(models, (input) => {
@@ -8247,7 +8421,7 @@ async function requestAction2(ctx, params) {
8247
8421
  });
8248
8422
  }
8249
8423
  // src/objects/materializer-adapter.ts
8250
- import { randomUUID as randomUUID14 } from "crypto";
8424
+ import { randomUUID as randomUUID13 } from "crypto";
8251
8425
 
8252
8426
  // src/objects/errors.ts
8253
8427
  class ObjectError2 extends Error {
@@ -8283,7 +8457,7 @@ async function commitRuntimeOperations(ctx, operations, expectedObjects = [], un
8283
8457
  try {
8284
8458
  return await mutations.commitEdits({
8285
8459
  mode: "atomic",
8286
- source: { kind: "runtime", requestId: randomUUID14() },
8460
+ source: { kind: "runtime", requestId: randomUUID13() },
8287
8461
  operations,
8288
8462
  expectedObjects,
8289
8463
  expectedLinks: [],
@@ -8305,7 +8479,7 @@ async function commitRuntimeBatch(ctx, groups, expectedObjects = [], unchangeabl
8305
8479
  try {
8306
8480
  commit = await mutations.commitEdits({
8307
8481
  mode: "continue",
8308
- source: { kind: "runtime", requestId: randomUUID14() },
8482
+ source: { kind: "runtime", requestId: randomUUID13() },
8309
8483
  operations,
8310
8484
  ...operationGroups.length > 0 ? { operationGroups } : {},
8311
8485
  ...expectedObjects.length > 0 ? { expectedObjects } : {},
@@ -8787,7 +8961,7 @@ async function upsertObjectBatch2(ctx, items) {
8787
8961
  });
8788
8962
  }
8789
8963
  // src/objects/vectors/handle.ts
8790
- import { randomUUID as randomUUID15 } from "crypto";
8964
+ import { randomUUID as randomUUID14 } from "crypto";
8791
8965
  function createObjectVectorHandle(ctx, primaryId, profileName) {
8792
8966
  const ref = Object.freeze({ objectTypeId: ctx.objectType.id, primaryId });
8793
8967
  const profileDefinition = ctx.ontology.resolveObjectType(ref.objectTypeId).search?.vectors?.[profileName];
@@ -8841,7 +9015,7 @@ function createObjectVectorHandle(ctx, primaryId, profileName) {
8841
9015
  await assertReadable();
8842
9016
  await mutations.commitEdits({
8843
9017
  mode: "atomic",
8844
- source: { kind: "runtime", requestId: randomUUID15() },
9018
+ source: { kind: "runtime", requestId: randomUUID14() },
8845
9019
  operations: [],
8846
9020
  vectorWrites: [{ input, values }],
8847
9021
  expectedObjects: [input.expectedObject],
@@ -8895,7 +9069,7 @@ function filePropertyPath(objectTypeId, property, index) {
8895
9069
  }
8896
9070
 
8897
9071
  // src/objects/telemetry/write-batch.ts
8898
- import { randomUUID as randomUUID16 } from "crypto";
9072
+ import { randomUUID as randomUUID15 } from "crypto";
8899
9073
  async function writeTelemetryBatch2(ctx, points) {
8900
9074
  for (const objectTypeId of new Set(points.map((point) => point.series.object.objectTypeId))) {
8901
9075
  assertCanAppendTelemetry2(ctx, objectTypeId);
@@ -8905,7 +9079,7 @@ async function writeTelemetryBatch2(ctx, points) {
8905
9079
  let commit;
8906
9080
  try {
8907
9081
  commit = await getOntologyMutationRuntime2(ctx).appendTelemetry({
8908
- source: { kind: "runtime", requestId: randomUUID16() },
9082
+ source: { kind: "runtime", requestId: randomUUID15() },
8909
9083
  points
8910
9084
  });
8911
9085
  } catch (error) {
@@ -9997,6 +10171,7 @@ function createObjectSet2(params) {
9997
10171
  shareOntologyMutationRuntime2(params, resolvedCtx);
9998
10172
  shareSixbErrorReporter2(params, resolvedCtx);
9999
10173
  shareActionRunExecutor(params, resolvedCtx);
10174
+ shareCallerArtifacts(params, resolvedCtx);
10000
10175
  const objectSet = {
10001
10176
  get: async (id) => {
10002
10177
  const row = await objectReader.getByPrimaryId({
@@ -10201,6 +10376,7 @@ function createObjectsRuntime(runtime, execution, blobStorage, lineage) {
10201
10376
  shareOntologyMutationRuntime2(runtime, capturedRuntime);
10202
10377
  shareSixbErrorReporter2(runtime, capturedRuntime);
10203
10378
  shareActionRunExecutor(runtime, capturedRuntime);
10379
+ shareCallerArtifacts(runtime, capturedRuntime);
10204
10380
  Object.freeze(capturedRuntime);
10205
10381
  const ontologyView = () => getAuthorizedOntologyView(objectReader);
10206
10382
  const objects = Object.assign((objectType) => {
@@ -10529,7 +10705,7 @@ function createSchedulesRuntime(runtime, schedules) {
10529
10705
  }
10530
10706
 
10531
10707
  // src/shares/execution.ts
10532
- import { createHash as createHash2, randomBytes, randomUUID as randomUUID17 } from "crypto";
10708
+ import { createHash, randomBytes, randomUUID as randomUUID16 } from "crypto";
10533
10709
  var MAX_CREATE_ATTEMPTS = 5;
10534
10710
 
10535
10711
  class ShareError2 extends Error {
@@ -10608,7 +10784,7 @@ function createSharesRuntime(runtime, execution, definitions) {
10608
10784
  const secret = randomBytes(32).toString("base64url");
10609
10785
  try {
10610
10786
  const grant = await storage.create({
10611
- id: `shr_${randomUUID17()}`,
10787
+ id: `shr_${randomUUID16()}`,
10612
10788
  projectId: runtime.projectId,
10613
10789
  definitionId: definition.id,
10614
10790
  target,
@@ -10784,7 +10960,7 @@ function validFutureDate(value, now) {
10784
10960
  return new Date(value);
10785
10961
  }
10786
10962
  function sha256(value) {
10787
- return createHash2("sha256").update(value).digest("hex");
10963
+ return createHash("sha256").update(value).digest("hex");
10788
10964
  }
10789
10965
  function publicGrant(record) {
10790
10966
  const {
@@ -11142,6 +11318,11 @@ function isBoundSixb(value) {
11142
11318
  return typeof value === "object" && value !== null && boundSixbInstances.has(value);
11143
11319
  }
11144
11320
  function createExecutionFacades(runtime, execution, dependencies) {
11321
+ const artifacts = createArtifactsRuntime(runtime, dependencies.blobStorage, {
11322
+ rendersInSandboxes: dependencies.rendersInSandboxes,
11323
+ transcribesMedia: dependencies.definitions.models?.audio?.transcription !== undefined
11324
+ });
11325
+ registerCallerArtifacts(runtime, artifacts);
11145
11326
  const actions = createActionsRuntime(runtime, execution);
11146
11327
  const syncConnections = createSyncConnections(dependencies.connectorService);
11147
11328
  const workflows = createWorkflowsRuntime(runtime, execution, dependencies.definitions.workflows);
@@ -11160,14 +11341,12 @@ function createExecutionFacades(runtime, execution, dependencies) {
11160
11341
  projections: createProjectionsRuntime(runtime, dependencies.definitions.projections),
11161
11342
  rules: createRulesRuntime(runtime, dependencies.definitions.rules),
11162
11343
  agent,
11163
- artifacts: createArtifactsRuntime(runtime, dependencies.blobStorage, {
11164
- rendersInSandboxes: dependencies.rendersInSandboxes
11165
- }),
11344
+ artifacts,
11166
11345
  models: createModelsRuntime(runtime, execution, dependencies.definitions.models, session, {
11167
11346
  canViewActionRun: async (id) => await actions.runs.getById(id) !== null,
11168
11347
  canViewWorkflowRun: async (id) => await workflows.runs.getById(id) !== null,
11169
11348
  canViewAgentRun: async (id) => await agent.runs.getById(id) !== null
11170
- }, dependencies.blobStorage),
11349
+ }, dependencies.blobStorage, dependencies.apiPublicOrigin),
11171
11350
  aiUsage: createAiUsageRuntime(runtime, dependencies.definitions.security),
11172
11351
  events: createEventsRuntime(runtime, {
11173
11352
  visibleSyncConnectionIds: (syncIds) => visibleSyncConnectionIds(runtime, execution, syncIds.map((syncId) => dependencies.definitions.syncs.getById(syncId)), syncConnections)
@@ -11450,6 +11629,7 @@ function toLinkSnapshot(row) {
11450
11629
  // src/actions/run/context.ts
11451
11630
  function toActionRuntimeFacade(runtime) {
11452
11631
  return {
11632
+ artifacts: runtime.artifactsAsRequester,
11453
11633
  blobs: {
11454
11634
  put(input) {
11455
11635
  return runtime.sixb.blobs.put(input);
@@ -11658,6 +11838,7 @@ function translateActionPhaseError(error, phase, input) {
11658
11838
  return error;
11659
11839
  }
11660
11840
  if (error instanceof ActionValidationError2) {
11841
+ withFailureMessage2(error, error.message);
11661
11842
  return createSixbError2("action.rejected", error.message, { cause: error, details });
11662
11843
  }
11663
11844
  if (phase === "commit" && isMaterializationConflictError2(error) && error.kind === "expectation") {
@@ -11787,7 +11968,7 @@ function isValidatorErrorResult(value) {
11787
11968
  }
11788
11969
 
11789
11970
  // src/edits/recorder.ts
11790
- import { createHash as createHash3 } from "crypto";
11971
+ import { createHash as createHash2 } from "crypto";
11791
11972
 
11792
11973
  // src/edits/properties.ts
11793
11974
  function normalizeObjectEditProperties(params) {
@@ -12063,7 +12244,7 @@ function createRef(objectTypeId, primaryId) {
12063
12244
  };
12064
12245
  }
12065
12246
  function generatePrimaryId(params) {
12066
- const hash = createHash3("sha256").update(`${params.runId}:${params.operationPath}:${params.objectTypeId}`).digest("hex").slice(0, 24);
12247
+ const hash = createHash2("sha256").update(`${params.runId}:${params.operationPath}:${params.objectTypeId}`).digest("hex").slice(0, 24);
12067
12248
  return `edit_${hash}`;
12068
12249
  }
12069
12250
  function withoutPrimaryProperty(properties, primaryPropertyId) {
@@ -12507,6 +12688,7 @@ function buildActionContext(host, actionRunsStorage, execution, input) {
12507
12688
  sixb,
12508
12689
  actions: host.definitions.actions,
12509
12690
  requestedBy: execution.sixb.execution.requestedBy,
12691
+ artifactsAsRequester: input.artifactsAsRequester,
12510
12692
  client: input.client,
12511
12693
  ...readSubjectAsRequester === undefined ? {} : { readSubjectAsRequester }
12512
12694
  };
@@ -12581,6 +12763,7 @@ class ActionRunExecutor {
12581
12763
  run,
12582
12764
  execution,
12583
12765
  signal: request.signal,
12766
+ artifactsAsRequester: request.artifactsAsRequester,
12584
12767
  ...request.readSubjectAsRequester === undefined ? {} : { readSubjectAsRequester: request.readSubjectAsRequester },
12585
12768
  ...request.client === undefined ? {} : { client: request.client }
12586
12769
  });
@@ -12721,6 +12904,7 @@ async function requestAction3(runtime, execution, input) {
12721
12904
  assertCanReuse,
12722
12905
  signal: request.signal,
12723
12906
  onRequested: request.onRequested,
12907
+ artifactsAsRequester: getCallerArtifacts(runtime),
12724
12908
  ...client === undefined ? {} : { client },
12725
12909
  ...conditioned ? {
12726
12910
  readSubjectAsRequester: ({ objectTypeId, primaryId }) => objectReader.getByPrimaryId({ objectTypeId, primaryId })
@@ -12889,6 +13073,6 @@ function snapshotActionRequest(input) {
12889
13073
  ...onRequested === undefined ? {} : { onRequested }
12890
13074
  };
12891
13075
  }
12892
- export { defineAction2, param2, optional2, ActionRegistry2, bindRequestClient, bindModelExecutionAttempt, canInheritAgentRequestAuthorization2, createAgentExecutionRecord2, createInheritedAgentExecutionRecord2, bindDurableAgentExecution2, bindAgentRunRequestExecution2, bindAgentModelExecution2, restoreAgentExecutionScope2, assertAgentExecutionRecord2, resumeDecidedAgentTurn2, agentRunApprovalMode2, holdAgentApprovalCall2, approvalCallSummary2, listChildApprovalsAwaiting2, isAwaitingApprovalRun2, isPausedSubagentRun2, AGENT_APPROVAL_EXECUTION_LEASE_MS2, turnResumeReadiness2, turnPausesOnHeldCalls2, hasActiveChildren2, listTurnApprovals2, stopAgentTurn2, announceAgentApprovals2, agentApprovalCallers2, AgentRunScopeError2, resolveAgentRunExecutionScope2, createAgentApprovalExecutor, registerAgentApprovalExecutor, getAgentApprovalExecutor2, requestAgentRunCancel2, cancelQueuedRun, AGENT_QUESTION_LIMITS2, agentQuestionsText2, isChildAskTool2, isAwaitingAnswerRun2, deferredChildQuestion2, listSubagentThreadRuns2, subagentSandboxFiles2, assertTurnModelRouting, registerAgentQueuedTurn2, startQueuedAgentTurn2, resolveAgentContextParts2, agentRunQueueJobId2, workflowAgentNodeQueueJobId2, dispatchQueuedAgentRuns2, assertNoAgentDefinitions, turnAnsweredEveryMessage, requestAgentRun2, isEditableAgentMessage2, editAgentMessage2, isRetryableAgentRun2, retryAgentRun2, AGENT_MESSAGE_DELIVERIES2, sendAgentMessage2, promoteAgentInboxItem2, withdrawAgentInboxItem2, startQueuedAgentTurnFromInbox2, WorkflowDefinitionError2, WorkflowValidationError2, assertNonEmpty, isStepDefinition2, isAgentStepDefinition2, isInterventionDefinition2, isWorkflowDefinition2, validateWorkflowDefinition2, validateWorkflowsAtStartup2, validateWorkflowAgentStepGroupReferences2, validateWorkflowInput2, validateWorkflowStepInput2, validateWorkflowStepOutput2, validateWorkflowInterventionInput2, validateWorkflowInterventionResponse2, validateWorkflowInterventionDefaultResponse2, assertAgentStepSandbox, validateWorkflowAgentStepInput2, validateWorkflowAgentStepOutput2, snapshotWorkflowAgentStepInput2, snapshotWorkflowAgentStepOutput2, snapshotWorkflowInput2, snapshotWorkflowStepInput2, snapshotWorkflowStepOutput2, snapshotWorkflowInterventionInput2, snapshotWorkflowInterventionResponse2, snapshotWorkflowInterventionDefaultResponse2, snapshotWorkflowActionInput2, WorkflowRunDispatcher2, requestWorkflowRun2, prepareBoundActionRequest2, prepareBoundWorkflowRequest2, runModelLoop2, requestAction2, ObjectError2, removeLink2, upsertLink2, upsertLinkBatch2, deleteObject2, restoreObject2, upsertObject2, upsertObjectBatch2, writeTelemetryBatch2, appendTelemetryBatch2, getTelemetryHistoryBatch2, requireLinkDefinition2, resolveObjectContext2, resolveLinkContext2, createObjectSet2, exports_service, ShareError2, createBoundSixb, isBoundSixb, bindDurablePrimitiveExecution2, ACTION_RUN_DRAIN_TIMEOUT_MS2, ActionRunExecutor, registerActionRunExecutor, drainActionRuns2, requestAction3 };
13076
+ export { defineAction2, param2, optional2, ActionRegistry2, bindRequestClient, bindModelExecutionAttempt, canInheritAgentRequestAuthorization2, createAgentExecutionRecord2, createInheritedAgentExecutionRecord2, bindDurableAgentExecution2, bindAgentRunRequestExecution2, bindAgentModelExecution2, restoreAgentExecutionScope2, assertAgentExecutionRecord2, resumeDecidedAgentTurn2, agentRunApprovalMode2, holdAgentApprovalCall2, approvalCallSummary2, listChildApprovalsAwaiting2, isAwaitingApprovalRun2, isPausedSubagentRun2, AGENT_APPROVAL_EXECUTION_LEASE_MS2, turnResumeReadiness2, turnPausesOnHeldCalls2, hasActiveChildren2, listTurnApprovals2, stopAgentTurn2, announceAgentApprovals2, agentApprovalCallers2, AgentRunScopeError2, resolveAgentRunExecutionScope2, createAgentApprovalExecutor, registerAgentApprovalExecutor, getAgentApprovalExecutor2, requestAgentRunCancel2, cancelQueuedRun, AGENT_QUESTION_LIMITS2, agentQuestionsText2, isChildAskTool2, isAwaitingAnswerRun2, deferredChildQuestion2, listSubagentThreadRuns2, subagentSandboxFiles2, assertTurnModelRouting, registerAgentQueuedTurn2, startQueuedAgentTurn2, resolveAgentContextParts2, agentRunQueueJobId2, workflowAgentNodeQueueJobId2, dispatchQueuedAgentRuns2, assertNoAgentDefinitions, turnAnsweredEveryMessage, requestAgentRun2, isEditableAgentMessage2, editAgentMessage2, isRetryableAgentRun2, retryAgentRun2, AGENT_MESSAGE_DELIVERIES2, sendAgentMessage2, promoteAgentInboxItem2, withdrawAgentInboxItem2, startQueuedAgentTurnFromInbox2, WorkflowDefinitionError2, WorkflowValidationError2, assertNonEmpty, isStepDefinition2, isAgentStepDefinition2, isInterventionDefinition2, isWorkflowDefinition2, validateWorkflowDefinition2, validateWorkflowsAtStartup2, validateWorkflowAgentStepGroupReferences2, validateWorkflowInput2, validateWorkflowStepInput2, validateWorkflowStepOutput2, validateWorkflowInterventionInput2, validateWorkflowInterventionResponse2, validateWorkflowInterventionDefaultResponse2, assertAgentStepSandbox, validateWorkflowAgentStepInput2, validateWorkflowAgentStepOutput2, snapshotWorkflowAgentStepInput2, snapshotWorkflowAgentStepOutput2, snapshotWorkflowInput2, snapshotWorkflowStepInput2, snapshotWorkflowStepOutput2, snapshotWorkflowInterventionInput2, snapshotWorkflowInterventionResponse2, snapshotWorkflowInterventionDefaultResponse2, snapshotWorkflowActionInput2, WorkflowRunDispatcher2, requestWorkflowRun2, prepareBoundActionRequest2, prepareBoundWorkflowRequest2, lostConnectionCode, runModelLoop2, requestAction2, ObjectError2, removeLink2, upsertLink2, upsertLinkBatch2, deleteObject2, restoreObject2, upsertObject2, upsertObjectBatch2, writeTelemetryBatch2, appendTelemetryBatch2, getTelemetryHistoryBatch2, requireLinkDefinition2, resolveObjectContext2, resolveLinkContext2, createObjectSet2, exports_service, ShareError2, createBoundSixb, isBoundSixb, bindDurablePrimitiveExecution2, ACTION_RUN_DRAIN_TIMEOUT_MS2, ActionRunExecutor, registerActionRunExecutor, drainActionRuns2, requestAction3 };
12893
13077
 
12894
- //# debugId=6AB827512C16B65C64756E2164756E21
13078
+ //# debugId=F9483E747CF0F2C264756E2164756E21