@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.
- package/dist/actions/index.js +53 -50
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run/context.d.ts.map +1 -1
- package/dist/actions/run/execute.d.ts +3 -0
- package/dist/actions/run/execute.d.ts.map +1 -1
- package/dist/actions/run/executor.d.ts +3 -0
- package/dist/actions/run/executor.d.ts.map +1 -1
- package/dist/actions/run/normalize.d.ts.map +1 -1
- package/dist/actions/run/types.d.ts +6 -0
- package/dist/actions/run/types.d.ts.map +1 -1
- package/dist/actions/types/context.d.ts +7 -0
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/agents/context/entries.d.ts +17 -0
- package/dist/agents/context/entries.d.ts.map +1 -1
- package/dist/agents/context/index.js +3 -2
- package/dist/agents/context/index.js.map +1 -1
- package/dist/agents/context-model.d.ts.map +1 -1
- package/dist/agents/context-resolution.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +7 -0
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +62 -57
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-call-retry.d.ts +28 -0
- package/dist/agents/model-call-retry.d.ts.map +1 -0
- package/dist/agents/model-loop.d.ts +4 -2
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/model-routing.d.ts +15 -4
- package/dist/agents/model-routing.d.ts.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-artifacts.d.ts +2 -0
- package/dist/agents/run-artifacts.d.ts.map +1 -1
- package/dist/agents/run-plan.d.ts +1 -1
- package/dist/agents/run-plan.d.ts.map +1 -1
- package/dist/agents/run-session-http.d.ts.map +1 -1
- package/dist/agents/run-session-serve.d.ts.map +1 -1
- package/dist/agents/run-session-wire.d.ts +6 -0
- package/dist/agents/run-session-wire.d.ts.map +1 -1
- package/dist/agents/run-token.d.ts +6 -0
- package/dist/agents/run-token.d.ts.map +1 -1
- package/dist/agents/streams/index.js +1 -1
- package/dist/agents/streams/internal.js +2 -2
- package/dist/agents/thread-access.d.ts +13 -0
- package/dist/agents/thread-access.d.ts.map +1 -1
- package/dist/agents/tool-files.d.ts.map +1 -1
- package/dist/artifacts/caller.d.ts +10 -0
- package/dist/artifacts/caller.d.ts.map +1 -0
- package/dist/artifacts/comment-place.d.ts +26 -0
- package/dist/artifacts/comment-place.d.ts.map +1 -0
- package/dist/artifacts/comment-text.d.ts +12 -4
- package/dist/artifacts/comment-text.d.ts.map +1 -1
- package/dist/artifacts/comments.d.ts +8 -2
- package/dist/artifacts/comments.d.ts.map +1 -1
- package/dist/artifacts/errors.d.ts +1 -1
- package/dist/artifacts/errors.d.ts.map +1 -1
- package/dist/artifacts/execution.d.ts +73 -5
- package/dist/artifacts/execution.d.ts.map +1 -1
- package/dist/artifacts/frames/assets.d.ts +27 -7
- package/dist/artifacts/frames/assets.d.ts.map +1 -1
- package/dist/artifacts/frames/entries.d.ts +5 -4
- package/dist/artifacts/frames/entries.d.ts.map +1 -1
- package/dist/artifacts/frames/hyperframes.d.ts +12 -0
- package/dist/artifacts/frames/hyperframes.d.ts.map +1 -0
- package/dist/artifacts/frames/index.d.ts +3 -1
- package/dist/artifacts/frames/index.d.ts.map +1 -1
- package/dist/artifacts/frames/index.js +20 -6
- package/dist/artifacts/frames/index.js.map +3 -3
- package/dist/artifacts/frames/kit.d.ts.map +1 -1
- package/dist/artifacts/frames/protocol.d.ts +33 -0
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/video-runtime.d.ts +21 -0
- package/dist/artifacts/frames/video-runtime.d.ts.map +1 -0
- package/dist/artifacts/html.d.ts +23 -0
- package/dist/artifacts/html.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +5 -3
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +71 -10
- package/dist/artifacts/index.js.map +4 -4
- package/dist/artifacts/kinds.d.ts +1 -1
- package/dist/artifacts/kinds.d.ts.map +1 -1
- package/dist/artifacts/limits.d.ts +37 -0
- package/dist/artifacts/limits.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts.map +1 -1
- package/dist/artifacts/live/index.d.ts +6 -2
- package/dist/artifacts/live/index.d.ts.map +1 -1
- package/dist/artifacts/live/index.js +3432 -13
- package/dist/artifacts/live/index.js.map +6 -3
- package/dist/artifacts/live/presence.d.ts +7 -5
- package/dist/artifacts/live/presence.d.ts.map +1 -1
- package/dist/artifacts/live/protocol.d.ts +4 -2
- package/dist/artifacts/live/protocol.d.ts.map +1 -1
- package/dist/artifacts/live/server.d.ts +1 -1
- package/dist/artifacts/live/server.d.ts.map +1 -1
- package/dist/artifacts/live/server.js +36 -31
- package/dist/artifacts/live/server.js.map +1 -1
- package/dist/artifacts/live/state.d.ts +2 -2
- package/dist/artifacts/media/media.d.ts +96 -0
- package/dist/artifacts/media/media.d.ts.map +1 -0
- package/dist/artifacts/media/transcriber.d.ts +29 -0
- package/dist/artifacts/media/transcriber.d.ts.map +1 -0
- package/dist/artifacts/outline.d.ts +26 -1
- package/dist/artifacts/outline.d.ts.map +1 -1
- package/dist/artifacts/publish/files.d.ts +5 -2
- package/dist/artifacts/publish/files.d.ts.map +1 -1
- package/dist/artifacts/publish/index.d.ts +11 -2
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +110 -33
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/pdf.d.ts.map +1 -1
- package/dist/artifacts/publish/previews.d.ts +7 -2
- package/dist/artifacts/publish/previews.d.ts.map +1 -1
- package/dist/artifacts/publish/publish.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/html.d.ts +5 -4
- package/dist/artifacts/publish/validate/html.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/video.d.ts +36 -0
- package/dist/artifacts/publish/validate/video.d.ts.map +1 -0
- package/dist/artifacts/publish/video.d.ts +79 -0
- package/dist/artifacts/publish/video.d.ts.map +1 -0
- package/dist/artifacts/resolve.d.ts +9 -0
- package/dist/artifacts/resolve.d.ts.map +1 -1
- package/dist/artifacts/video/composition.d.ts +183 -0
- package/dist/artifacts/video/composition.d.ts.map +1 -0
- package/dist/artifacts/video/edit.d.ts +298 -0
- package/dist/artifacts/video/edit.d.ts.map +1 -0
- package/dist/artifacts/video/export.d.ts +142 -0
- package/dist/artifacts/video/export.d.ts.map +1 -0
- package/dist/artifacts/video/looks.d.ts +133 -0
- package/dist/artifacts/video/looks.d.ts.map +1 -0
- package/dist/artifacts/video/project.d.ts +74 -0
- package/dist/artifacts/video/project.d.ts.map +1 -0
- package/dist/artifacts/video/stills.d.ts +65 -0
- package/dist/artifacts/video/stills.d.ts.map +1 -0
- package/dist/artifacts/video/timeline.d.ts +153 -0
- package/dist/artifacts/video/timeline.d.ts.map +1 -0
- package/dist/auth/index.js +9 -8
- package/dist/auth/index.js.map +1 -1
- package/dist/authorization/index.js +5 -4
- package/dist/authorization/index.js.map +1 -1
- package/dist/blob-storage/browser.d.ts +1 -1
- package/dist/blob-storage/browser.d.ts.map +1 -1
- package/dist/blob-storage/browser.js +8 -4
- package/dist/blob-storage/browser.js.map +1 -1
- package/dist/blob-storage/constants.d.ts +8 -3
- package/dist/blob-storage/constants.d.ts.map +1 -1
- package/dist/blob-storage/download-urls.d.ts +2 -2
- package/dist/blob-storage/download-urls.d.ts.map +1 -1
- package/dist/blob-storage/index.d.ts +1 -1
- package/dist/blob-storage/index.d.ts.map +1 -1
- package/dist/blob-storage/index.js +9 -5
- package/dist/blob-storage/index.js.map +1 -1
- package/dist/blob-storage/internal.d.ts +2 -2
- package/dist/blob-storage/internal.d.ts.map +1 -1
- package/dist/blob-storage/internal.js +10 -4
- package/dist/blob-storage/internal.js.map +1 -1
- package/dist/blob-storage/media-type.d.ts +12 -3
- package/dist/blob-storage/media-type.d.ts.map +1 -1
- package/dist/bootstrap/discovery.d.ts +6 -0
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.js +63 -60
- package/dist/bootstrap/index.js.map +2 -2
- package/dist/{chunk-az95tsh3.js → chunk-0fjryajn.js} +3 -2
- package/dist/chunk-0fjryajn.js.map +11 -0
- package/dist/{chunk-9tpmfh3n.js → chunk-0mk8qqp9.js} +3 -3
- package/dist/{chunk-9tpmfh3n.js.map → chunk-0mk8qqp9.js.map} +3 -3
- package/dist/{chunk-88xeh6zx.js → chunk-1g4me5f2.js} +182 -7
- package/dist/{chunk-88xeh6zx.js.map → chunk-1g4me5f2.js.map} +3 -3
- package/dist/{chunk-7mhbs9yy.js → chunk-1z8ccj53.js} +1 -1
- package/dist/{chunk-wkv3h3q7.js → chunk-2138b0ng.js} +115 -8
- package/dist/chunk-2138b0ng.js.map +12 -0
- package/dist/chunk-23eaayw4.js +3757 -0
- package/dist/chunk-23eaayw4.js.map +22 -0
- package/dist/{chunk-s8xxef60.js → chunk-2mxq1yd9.js} +48 -41
- package/dist/{chunk-s8xxef60.js.map → chunk-2mxq1yd9.js.map} +6 -6
- package/dist/{chunk-dmnd9ea6.js → chunk-30a0ftnm.js} +2 -2
- package/dist/{chunk-nxysqbt0.js → chunk-389ybvw9.js} +6 -2
- package/dist/chunk-389ybvw9.js.map +10 -0
- package/dist/{chunk-qbd282aa.js → chunk-39q9ybav.js} +2 -2
- package/dist/{chunk-9c9yknwt.js → chunk-3d9w8t4n.js} +111 -23
- package/dist/{chunk-9c9yknwt.js.map → chunk-3d9w8t4n.js.map} +5 -5
- package/dist/chunk-3dvcdn9w.js +8 -0
- package/dist/chunk-3dvcdn9w.js.map +10 -0
- package/dist/{chunk-bcz9dxtf.js → chunk-3x902cja.js} +3 -3
- package/dist/{chunk-c4nrycdy.js → chunk-4q4a5a96.js} +1 -1
- package/dist/{chunk-7r9mqpva.js → chunk-4tdm3fsj.js} +100 -36
- package/dist/{chunk-7r9mqpva.js.map → chunk-4tdm3fsj.js.map} +10 -10
- package/dist/{chunk-ykchk644.js → chunk-4w8qzy9w.js} +6 -6
- package/dist/{chunk-c29729me.js → chunk-4z9xtxke.js} +8 -7
- package/dist/chunk-4z9xtxke.js.map +12 -0
- package/dist/chunk-5278qwax.js +270 -0
- package/dist/chunk-5278qwax.js.map +11 -0
- package/dist/{chunk-kft7mp7z.js → chunk-5xkqasvn.js} +1 -1
- package/dist/{chunk-k1g14kk3.js → chunk-6a4hp405.js} +4 -5
- package/dist/{chunk-k1g14kk3.js.map → chunk-6a4hp405.js.map} +3 -3
- package/dist/{chunk-xavet0qs.js → chunk-6whr25gw.js} +2 -2
- package/dist/{chunk-mbwsgjn7.js → chunk-7zygtcqq.js} +14 -2
- package/dist/chunk-7zygtcqq.js.map +11 -0
- package/dist/chunk-88s9z5pf.js +3 -0
- package/dist/{chunk-de5sfbc3.js.map → chunk-88s9z5pf.js.map} +1 -1
- package/dist/{chunk-ygvay56w.js → chunk-896te58g.js} +2 -2
- package/dist/{chunk-pqj8vff9.js → chunk-8eqqqc1h.js} +3 -3
- package/dist/{chunk-425ydk65.js → chunk-8tefbhdx.js} +14 -14
- package/dist/{chunk-425ydk65.js.map → chunk-8tefbhdx.js.map} +1 -1
- package/dist/{chunk-jka26v8c.js → chunk-8x1bsp68.js} +1 -1
- package/dist/{chunk-wzcjhv54.js → chunk-93e4w7te.js} +113 -1
- package/dist/chunk-93e4w7te.js.map +11 -0
- package/dist/{chunk-ym1bqd98.js → chunk-990a5bkc.js} +424 -76
- package/dist/chunk-990a5bkc.js.map +21 -0
- package/dist/{chunk-fmgf9h5e.js → chunk-9az7kjv4.js} +6 -6
- package/dist/{chunk-eg6xqef7.js → chunk-9e5t53z0.js} +3 -3
- package/dist/{chunk-eg6xqef7.js.map → chunk-9e5t53z0.js.map} +3 -3
- package/dist/{chunk-bs1sd0e0.js → chunk-9p7kyeqz.js} +4 -4
- package/dist/chunk-a68zz4r0.js +537 -0
- package/dist/chunk-a68zz4r0.js.map +11 -0
- package/dist/{chunk-d7vyc7k6.js → chunk-a700gjc8.js} +10 -2
- package/dist/chunk-a700gjc8.js.map +10 -0
- package/dist/{chunk-gfdh9kqa.js → chunk-a9qzjaz2.js} +2 -5
- package/dist/chunk-a9qzjaz2.js.map +10 -0
- package/dist/{chunk-ats8y3d9.js → chunk-as94vcty.js} +688 -504
- package/dist/{chunk-ats8y3d9.js.map → chunk-as94vcty.js.map} +21 -21
- package/dist/{chunk-brybqw5k.js → chunk-bkxm2dzx.js} +1 -1
- package/dist/{chunk-ppxf7gw2.js → chunk-d7t9jnym.js} +3 -3
- package/dist/{chunk-tapdssb5.js → chunk-e3b1r4d2.js} +8 -7
- package/dist/{chunk-tapdssb5.js.map → chunk-e3b1r4d2.js.map} +4 -4
- package/dist/{chunk-cg7cygfj.js → chunk-fdmvaz7x.js} +1 -1
- package/dist/{chunk-191jz8a6.js → chunk-ff0qdk7z.js} +1 -1
- package/dist/{chunk-9vsc919v.js → chunk-fgxvrxx4.js} +22 -2
- package/dist/chunk-fgxvrxx4.js.map +10 -0
- package/dist/{chunk-wx7smkn2.js → chunk-fq8drkp0.js} +1 -1
- package/dist/{chunk-60662fyv.js → chunk-fqms1a8c.js} +132 -4
- package/dist/{chunk-60662fyv.js.map → chunk-fqms1a8c.js.map} +8 -6
- package/dist/{chunk-v8a1qjzp.js → chunk-hpswfrjj.js} +1 -1
- package/dist/{chunk-qttqe1ah.js → chunk-jbg905hn.js} +80 -13
- package/dist/chunk-jbg905hn.js.map +25 -0
- package/dist/{chunk-bz5bnjjt.js → chunk-jjte0h4p.js} +1 -1
- package/dist/{chunk-jt012fxq.js → chunk-jwjwvzj1.js} +797 -51
- package/dist/chunk-jwjwvzj1.js.map +38 -0
- package/dist/{chunk-f05994as.js → chunk-k3vd2vyz.js} +6 -2
- package/dist/chunk-k3vd2vyz.js.map +10 -0
- package/dist/chunk-kcqpk9w1.js.map +2 -2
- package/dist/chunk-mvz89age.js.map +2 -2
- package/dist/{chunk-xrmbhap8.js → chunk-mwg0nwkb.js} +1 -1
- package/dist/{chunk-a3faa34j.js → chunk-nfjt8k8j.js} +1 -1
- package/dist/{chunk-394zjzjs.js → chunk-nhgqz3g3.js} +3 -3
- package/dist/{chunk-bqr703h4.js → chunk-p0c5kkhn.js} +23 -6
- package/dist/{chunk-bqr703h4.js.map → chunk-p0c5kkhn.js.map} +3 -3
- package/dist/{chunk-92wrka15.js → chunk-q150fnj9.js} +1 -1
- package/dist/{chunk-w3t94hm6.js → chunk-qk3zq25v.js} +1 -1
- package/dist/{chunk-6hfbz4d0.js → chunk-r588h4ev.js} +1 -1
- package/dist/chunk-rtkqczbr.js.map +2 -2
- package/dist/{chunk-3qtk0070.js → chunk-ssqbrts1.js} +86 -9
- package/dist/chunk-ssqbrts1.js.map +14 -0
- package/dist/{chunk-5qqmndhm.js → chunk-szzhrn3e.js} +1 -1
- package/dist/{chunk-n1hbwc6y.js → chunk-t6pfch4e.js} +1 -1
- package/dist/{chunk-xtztwpkh.js → chunk-v6h4tc2v.js} +86 -5
- package/dist/chunk-v6h4tc2v.js.map +12 -0
- package/dist/{chunk-brhp9d97.js → chunk-vmqjndb3.js} +2 -2
- package/dist/chunk-vtjzwymr.js.map +2 -2
- package/dist/{chunk-t19wjmnc.js → chunk-wpba6hhd.js} +54 -20
- package/dist/{chunk-t19wjmnc.js.map → chunk-wpba6hhd.js.map} +3 -3
- package/dist/{chunk-htdzx40w.js → chunk-wrb1x1ss.js} +12 -4
- package/dist/{chunk-htdzx40w.js.map → chunk-wrb1x1ss.js.map} +3 -3
- package/dist/{chunk-5sswe5ej.js → chunk-wsv23wvr.js} +2 -2
- package/dist/{chunk-90nqenq8.js → chunk-x0hqc54n.js} +4 -4
- package/dist/{chunk-sgx82nnt.js → chunk-xg31er4p.js} +43 -4
- package/dist/chunk-xg31er4p.js.map +10 -0
- package/dist/{chunk-3neam1y5.js → chunk-y3qb965a.js} +2 -2
- package/dist/{chunk-gaj8djsw.js → chunk-y57eawng.js} +10 -5
- package/dist/{chunk-gaj8djsw.js.map → chunk-y57eawng.js.map} +3 -3
- package/dist/{chunk-8ncg20rd.js → chunk-yah25st6.js} +5 -5
- package/dist/chunk-yah25st6.js.map +10 -0
- package/dist/{chunk-grt2j5vp.js → chunk-ywvxcmqj.js} +106 -13
- package/dist/{chunk-grt2j5vp.js.map → chunk-ywvxcmqj.js.map} +8 -7
- package/dist/{chunk-xf76csps.js → chunk-zmq9xc9s.js} +70 -31
- package/dist/{chunk-xf76csps.js.map → chunk-zmq9xc9s.js.map} +4 -3
- package/dist/datasets/write.js +8 -7
- package/dist/datasets/write.js.map +1 -1
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/internal.js +2 -2
- package/dist/deploy/internal.js.map +2 -2
- package/dist/deploy/types.d.ts +8 -58
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/env/index.d.ts +10 -3
- package/dist/env/index.d.ts.map +1 -1
- package/dist/env/index.js.map +2 -2
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/execution/agent.js +53 -50
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/kernel-operation.d.ts +1 -0
- package/dist/execution/kernel-operation.d.ts.map +1 -1
- package/dist/execution/primitive.js +53 -50
- package/dist/execution/primitive.js.map +1 -1
- package/dist/execution/request.js +54 -51
- package/dist/execution/request.js.map +2 -2
- package/dist/execution/types.d.ts +5 -0
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -67
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +9 -8
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/maintenance/index.js +9 -8
- package/dist/maintenance/index.js.map +2 -2
- package/dist/materializer/index.js +26 -24
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/audio/runtime.d.ts +3 -1
- package/dist/models/audio/runtime.d.ts.map +1 -1
- package/dist/models/audio/speech.d.ts +2 -2
- package/dist/models/audio/speech.d.ts.map +1 -1
- package/dist/models/audio/types.d.ts +23 -3
- package/dist/models/audio/types.d.ts.map +1 -1
- package/dist/models/calls.d.ts +7 -0
- package/dist/models/calls.d.ts.map +1 -1
- package/dist/models/catalog.d.ts +5 -0
- package/dist/models/catalog.d.ts.map +1 -1
- package/dist/models/definitions.d.ts +3 -2
- package/dist/models/definitions.d.ts.map +1 -1
- package/dist/models/errors.d.ts +5 -3
- package/dist/models/errors.d.ts.map +1 -1
- package/dist/models/events.d.ts +2 -0
- package/dist/models/events.d.ts.map +1 -1
- package/dist/models/execution/index.d.ts +1 -0
- package/dist/models/execution/index.d.ts.map +1 -1
- package/dist/models/execution/index.js +33 -28
- package/dist/models/execution/index.js.map +1 -1
- package/dist/models/execution/model-call-limits.d.ts.map +1 -1
- package/dist/models/execution/model-call-recorder.d.ts +8 -0
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
- package/dist/models/execution/session.d.ts +12 -0
- package/dist/models/execution/session.d.ts.map +1 -1
- package/dist/models/execution/usage.d.ts.map +1 -1
- package/dist/models/execution.d.ts +1 -1
- package/dist/models/execution.d.ts.map +1 -1
- package/dist/models/generation-types.d.ts +2 -0
- package/dist/models/generation-types.d.ts.map +1 -1
- package/dist/models/index.d.ts +4 -2
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +2 -2
- package/dist/models/input-file.d.ts.map +1 -1
- package/dist/models/pricing.d.ts +2 -1
- package/dist/models/pricing.d.ts.map +1 -1
- package/dist/models/rate-card.d.ts +6 -0
- package/dist/models/rate-card.d.ts.map +1 -1
- package/dist/models/tools.d.ts +5 -0
- package/dist/models/tools.d.ts.map +1 -1
- package/dist/models/video/catalog.d.ts +13 -0
- package/dist/models/video/catalog.d.ts.map +1 -0
- package/dist/models/video/check.d.ts +76 -0
- package/dist/models/video/check.d.ts.map +1 -0
- package/dist/models/video/runtime.d.ts +21 -0
- package/dist/models/video/runtime.d.ts.map +1 -0
- package/dist/models/video/types.d.ts +188 -0
- package/dist/models/video/types.d.ts.map +1 -0
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +53 -50
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/index.js +25 -23
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/sdk/object-set.d.ts.map +1 -1
- package/dist/ontology/index.js +4 -4
- package/dist/ontology/internal.js +4 -4
- package/dist/pipelines/index.js +28 -26
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/internal.js +26 -24
- package/dist/projections/internal.js.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/types.d.ts +103 -6
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +14 -0
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +3 -1
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +3 -1
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +49 -43
- package/dist/runtime/internal.js.map +2 -2
- package/dist/runtime/resolve-definitions.d.ts +2 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/errors.d.ts +19 -0
- package/dist/sandboxes/errors.d.ts.map +1 -1
- package/dist/sandboxes/exec.d.ts +2 -0
- package/dist/sandboxes/exec.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +1 -1
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +14 -8
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/sandboxes/sandbox.d.ts +15 -1
- package/dist/sandboxes/sandbox.d.ts.map +1 -1
- package/dist/security/public.d.ts +6 -4
- package/dist/security/public.d.ts.map +1 -1
- package/dist/security/public.js +5 -3
- package/dist/security/public.js.map +1 -1
- package/dist/shares/internal.js +25 -23
- package/dist/shares/internal.js.map +2 -2
- package/dist/storage/agents/in-memory.d.ts +2 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +1 -1
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +5 -5
- package/dist/storage/agents/types.d.ts +27 -1
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +1 -0
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/groups.d.ts +2 -0
- package/dist/storage/ai-cost/groups.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +5 -5
- package/dist/storage/ai-cost/types.d.ts +2 -1
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/validation.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.js +3 -3
- package/dist/storage/ai-limits/provider.js +2 -2
- package/dist/storage/ai-usage/in-memory.d.ts +8 -1
- package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-usage/index.d.ts +2 -2
- package/dist/storage/ai-usage/index.d.ts.map +1 -1
- package/dist/storage/ai-usage/record.d.ts +11 -1
- package/dist/storage/ai-usage/record.d.ts.map +1 -1
- package/dist/storage/ai-usage/types.d.ts +80 -1
- package/dist/storage/ai-usage/types.d.ts.map +1 -1
- package/dist/storage/ai-usage/usage.d.ts +1 -1
- package/dist/storage/ai-usage/usage.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts +25 -2
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
- package/dist/storage/artifacts/index.d.ts +1 -1
- package/dist/storage/artifacts/index.d.ts.map +1 -1
- package/dist/storage/artifacts/record.d.ts +12 -1
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +198 -6
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +3 -2
- package/dist/storage/executions/provider.js.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +10 -9
- package/dist/storage/file-upload-sessions/provider.js.map +1 -1
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +4 -4
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +25 -23
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +2 -2
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +34 -14
- package/dist/storage/internal.js.map +2 -2
- package/dist/storage/workflow-runs/provider.js +10 -9
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/syncs/index.js +29 -27
- package/dist/syncs/index.js.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
- package/dist/testing/artifact-storage-contract.d.ts +3 -0
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.js +686 -75
- package/dist/testing/index.js.map +10 -10
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/sandboxes-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +26 -24
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +5 -5
- package/dist/workers/index.js.map +1 -1
- package/dist/workflows/index.js +60 -57
- package/dist/workflows/index.js.map +1 -1
- package/package.json +3 -1
- package/src/actions/request.ts +2 -0
- package/src/actions/run/context.ts +1 -0
- package/src/actions/run/execute.ts +5 -1
- package/src/actions/run/executor.ts +4 -0
- package/src/actions/run/normalize.ts +4 -0
- package/src/actions/run/types.ts +6 -0
- package/src/actions/types/context.ts +7 -0
- package/src/agents/README.md +3 -1
- package/src/agents/context/entries.ts +63 -9
- package/src/agents/context-model.ts +9 -0
- package/src/agents/context-resolution.ts +7 -0
- package/src/agents/execution.ts +39 -0
- package/src/agents/index.ts +1 -0
- package/src/agents/model-call-retry.ts +69 -0
- package/src/agents/model-loop.ts +86 -12
- package/src/agents/model-routing.ts +104 -38
- package/src/agents/request.ts +27 -1
- package/src/agents/run-artifacts.ts +10 -5
- package/src/agents/run-plan.ts +2 -1
- package/src/agents/run-session-http.ts +1 -0
- package/src/agents/run-session-serve.ts +23 -2
- package/src/agents/run-session-wire.ts +45 -0
- package/src/agents/run-token.ts +7 -0
- package/src/agents/thread-access.ts +34 -1
- package/src/agents/tool-files.ts +23 -7
- package/src/artifacts/caller.ts +42 -0
- package/src/artifacts/comment-place.ts +51 -0
- package/src/artifacts/comment-text.ts +50 -7
- package/src/artifacts/comments.ts +132 -34
- package/src/artifacts/errors.ts +1 -0
- package/src/artifacts/execution.ts +249 -5
- package/src/artifacts/frames/assets.ts +93 -15
- package/src/artifacts/frames/entries.ts +7 -4
- package/src/artifacts/frames/generated/hyperframes-notices.txt +290 -0
- package/src/artifacts/frames/generated/hyperframes.txt +1145 -0
- package/src/artifacts/frames/generated.d.ts +5 -0
- package/src/artifacts/frames/hyperframes.ts +14 -0
- package/src/artifacts/frames/index.ts +5 -0
- package/src/artifacts/frames/kit.ts +7 -3
- package/src/artifacts/frames/protocol.ts +56 -0
- package/src/artifacts/frames/video-runtime.ts +165 -0
- package/src/artifacts/html.ts +13 -0
- package/src/artifacts/index.ts +7 -0
- package/src/artifacts/kinds.ts +9 -1
- package/src/artifacts/limits.ts +43 -0
- package/src/artifacts/live/document.ts +27 -3
- package/src/artifacts/live/index.ts +58 -2
- package/src/artifacts/live/presence.ts +17 -5
- package/src/artifacts/live/protocol.ts +4 -2
- package/src/artifacts/live/server.ts +1 -1
- package/src/artifacts/live/state.ts +3 -3
- package/src/artifacts/media/README.md +75 -0
- package/src/artifacts/media/media.ts +316 -0
- package/src/artifacts/media/transcriber.ts +84 -0
- package/src/artifacts/outline.ts +28 -0
- package/src/artifacts/publish/files.ts +19 -6
- package/src/artifacts/publish/index.ts +49 -2
- package/src/artifacts/publish/pdf.ts +3 -1
- package/src/artifacts/publish/previews.ts +22 -8
- package/src/artifacts/publish/publish.ts +4 -1
- package/src/artifacts/publish/validate/html.ts +23 -18
- package/src/artifacts/publish/validate/video.ts +309 -0
- package/src/artifacts/publish/video.ts +235 -0
- package/src/artifacts/resolve.ts +45 -0
- package/src/artifacts/video/README.md +402 -0
- package/src/artifacts/video/composition.ts +898 -0
- package/src/artifacts/video/edit.ts +3967 -0
- package/src/artifacts/video/export.ts +352 -0
- package/src/artifacts/video/looks.ts +694 -0
- package/src/artifacts/video/project.ts +198 -0
- package/src/artifacts/video/stills.ts +168 -0
- package/src/artifacts/video/timeline.ts +658 -0
- package/src/blob-storage/browser.ts +1 -1
- package/src/blob-storage/constants.ts +9 -3
- package/src/blob-storage/download-urls.ts +5 -3
- package/src/blob-storage/index.ts +1 -0
- package/src/blob-storage/internal.ts +13 -2
- package/src/blob-storage/media-type.ts +149 -8
- package/src/bootstrap/discovery.ts +61 -11
- package/src/deploy/index.ts +0 -5
- package/src/deploy/types.ts +8 -63
- package/src/deploy/validation.ts +1 -1
- package/src/env/index.ts +10 -4
- package/src/errors/catalog.ts +2 -1
- package/src/execution/authorization.ts +2 -2
- package/src/execution/kernel-operation.ts +14 -0
- package/src/execution/types.ts +2 -0
- package/src/http/api-routes.ts +117 -0
- package/src/index.ts +21 -1
- package/src/lake-storage/definition-updates.ts +3 -9
- package/src/models/audio/runtime.ts +48 -3
- package/src/models/audio/speech.ts +2 -2
- package/src/models/audio/types.ts +24 -3
- package/src/models/calls.ts +35 -18
- package/src/models/catalog.ts +9 -2
- package/src/models/definitions.ts +4 -2
- package/src/models/errors.ts +5 -3
- package/src/models/events.ts +2 -0
- package/src/models/execution/README.md +68 -2
- package/src/models/execution/index.ts +1 -0
- package/src/models/execution/model-call-limits.ts +11 -5
- package/src/models/execution/model-call-recorder.ts +14 -0
- package/src/models/execution/session.ts +52 -23
- package/src/models/execution/usage.ts +1 -0
- package/src/models/execution.ts +13 -2
- package/src/models/generation-types.ts +2 -0
- package/src/models/index.ts +20 -1
- package/src/models/input-file.ts +7 -2
- package/src/models/pricing.ts +19 -1
- package/src/models/rate-card.ts +15 -3
- package/src/models/tools.ts +5 -0
- package/src/models/video/catalog.ts +101 -0
- package/src/models/video/check.ts +441 -0
- package/src/models/video/runtime.ts +550 -0
- package/src/models/video/types.ts +194 -0
- package/src/objects/execution.ts +2 -0
- package/src/objects/sdk/object-set.ts +2 -0
- package/src/queues/index.ts +5 -0
- package/src/queues/types.ts +126 -5
- package/src/runtime/create.ts +1 -0
- package/src/runtime/definitions.ts +25 -0
- package/src/runtime/host.ts +6 -1
- package/src/runtime/index.ts +6 -1
- package/src/runtime/internal.ts +3 -1
- package/src/runtime/resolve-definitions.ts +7 -1
- package/src/runtime/sixb.ts +12 -4
- package/src/sandboxes/README.md +12 -2
- package/src/sandboxes/errors.ts +27 -0
- package/src/sandboxes/exec.ts +3 -1
- package/src/sandboxes/index.ts +3 -0
- package/src/sandboxes/sandbox.ts +15 -1
- package/src/security/public.ts +6 -4
- package/src/storage/agents/in-memory.ts +39 -0
- package/src/storage/agents/index.ts +1 -0
- package/src/storage/agents/provider.ts +8 -0
- package/src/storage/agents/types.ts +32 -1
- package/src/storage/ai-cost/analytics.ts +2 -0
- package/src/storage/ai-cost/codec.ts +1 -0
- package/src/storage/ai-cost/groups.ts +7 -0
- package/src/storage/ai-cost/types.ts +2 -0
- package/src/storage/ai-cost/validation.ts +2 -0
- package/src/storage/ai-usage/in-memory.ts +93 -0
- package/src/storage/ai-usage/index.ts +10 -0
- package/src/storage/ai-usage/record.ts +106 -0
- package/src/storage/ai-usage/types.ts +102 -1
- package/src/storage/ai-usage/usage.ts +2 -0
- package/src/storage/artifacts/in-memory.ts +108 -11
- package/src/storage/artifacts/index.ts +14 -0
- package/src/storage/artifacts/record.ts +203 -1
- package/src/storage/artifacts/types.ts +199 -6
- package/src/storage/executions/validation.ts +2 -2
- package/src/storage/in-memory/index.ts +1 -1
- package/src/storage/index.ts +22 -1
- package/src/storage/internal.ts +9 -0
- package/src/testing/agent-storage-contract.ts +135 -0
- package/src/testing/ai-cost-storage-contract.ts +1 -0
- package/src/testing/ai-usage-storage-contract.ts +145 -1
- package/src/testing/artifact-storage-contract.ts +330 -0
- package/src/testing/execution-storage-contract.ts +10 -2
- package/src/testing/lake-storage-contract.ts +27 -0
- package/src/testing/queues-contract.ts +71 -0
- package/src/testing/sandboxes-contract.ts +50 -0
- package/dist/chunk-3723kgba.js +0 -29
- package/dist/chunk-3723kgba.js.map +0 -10
- package/dist/chunk-3qtk0070.js.map +0 -14
- package/dist/chunk-8ncg20rd.js.map +0 -10
- package/dist/chunk-9vsc919v.js.map +0 -10
- package/dist/chunk-az95tsh3.js.map +0 -11
- package/dist/chunk-c29729me.js.map +0 -12
- package/dist/chunk-d7vyc7k6.js.map +0 -10
- package/dist/chunk-de5sfbc3.js +0 -3
- package/dist/chunk-f05994as.js.map +0 -10
- package/dist/chunk-gfdh9kqa.js.map +0 -11
- package/dist/chunk-jt012fxq.js.map +0 -34
- package/dist/chunk-mbwsgjn7.js.map +0 -11
- package/dist/chunk-nxysqbt0.js.map +0 -10
- package/dist/chunk-qttqe1ah.js.map +0 -24
- package/dist/chunk-sgx82nnt.js.map +0 -10
- package/dist/chunk-vs2s3p8n.js +0 -2274
- package/dist/chunk-vs2s3p8n.js.map +0 -20
- package/dist/chunk-wkv3h3q7.js.map +0 -12
- package/dist/chunk-wzcjhv54.js.map +0 -11
- package/dist/chunk-xtztwpkh.js.map +0 -12
- package/dist/chunk-ym1bqd98.js.map +0 -19
- /package/dist/{chunk-7mhbs9yy.js.map → chunk-1z8ccj53.js.map} +0 -0
- /package/dist/{chunk-dmnd9ea6.js.map → chunk-30a0ftnm.js.map} +0 -0
- /package/dist/{chunk-qbd282aa.js.map → chunk-39q9ybav.js.map} +0 -0
- /package/dist/{chunk-bcz9dxtf.js.map → chunk-3x902cja.js.map} +0 -0
- /package/dist/{chunk-c4nrycdy.js.map → chunk-4q4a5a96.js.map} +0 -0
- /package/dist/{chunk-ykchk644.js.map → chunk-4w8qzy9w.js.map} +0 -0
- /package/dist/{chunk-kft7mp7z.js.map → chunk-5xkqasvn.js.map} +0 -0
- /package/dist/{chunk-xavet0qs.js.map → chunk-6whr25gw.js.map} +0 -0
- /package/dist/{chunk-ygvay56w.js.map → chunk-896te58g.js.map} +0 -0
- /package/dist/{chunk-pqj8vff9.js.map → chunk-8eqqqc1h.js.map} +0 -0
- /package/dist/{chunk-jka26v8c.js.map → chunk-8x1bsp68.js.map} +0 -0
- /package/dist/{chunk-fmgf9h5e.js.map → chunk-9az7kjv4.js.map} +0 -0
- /package/dist/{chunk-bs1sd0e0.js.map → chunk-9p7kyeqz.js.map} +0 -0
- /package/dist/{chunk-brybqw5k.js.map → chunk-bkxm2dzx.js.map} +0 -0
- /package/dist/{chunk-ppxf7gw2.js.map → chunk-d7t9jnym.js.map} +0 -0
- /package/dist/{chunk-cg7cygfj.js.map → chunk-fdmvaz7x.js.map} +0 -0
- /package/dist/{chunk-191jz8a6.js.map → chunk-ff0qdk7z.js.map} +0 -0
- /package/dist/{chunk-wx7smkn2.js.map → chunk-fq8drkp0.js.map} +0 -0
- /package/dist/{chunk-v8a1qjzp.js.map → chunk-hpswfrjj.js.map} +0 -0
- /package/dist/{chunk-bz5bnjjt.js.map → chunk-jjte0h4p.js.map} +0 -0
- /package/dist/{chunk-xrmbhap8.js.map → chunk-mwg0nwkb.js.map} +0 -0
- /package/dist/{chunk-a3faa34j.js.map → chunk-nfjt8k8j.js.map} +0 -0
- /package/dist/{chunk-394zjzjs.js.map → chunk-nhgqz3g3.js.map} +0 -0
- /package/dist/{chunk-92wrka15.js.map → chunk-q150fnj9.js.map} +0 -0
- /package/dist/{chunk-w3t94hm6.js.map → chunk-qk3zq25v.js.map} +0 -0
- /package/dist/{chunk-6hfbz4d0.js.map → chunk-r588h4ev.js.map} +0 -0
- /package/dist/{chunk-5qqmndhm.js.map → chunk-szzhrn3e.js.map} +0 -0
- /package/dist/{chunk-n1hbwc6y.js.map → chunk-t6pfch4e.js.map} +0 -0
- /package/dist/{chunk-brhp9d97.js.map → chunk-vmqjndb3.js.map} +0 -0
- /package/dist/{chunk-5sswe5ej.js.map → chunk-wsv23wvr.js.map} +0 -0
- /package/dist/{chunk-90nqenq8.js.map → chunk-x0hqc54n.js.map} +0 -0
- /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-
|
|
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-
|
|
37
|
+
} from "./chunk-1z8ccj53.js";
|
|
39
38
|
import {
|
|
40
39
|
isObjectRefSchema2,
|
|
41
40
|
validateSchemaOrRefValue2
|
|
42
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
159
|
+
} from "./chunk-1g4me5f2.js";
|
|
164
160
|
import {
|
|
165
161
|
ExecutionStorageError2
|
|
166
|
-
} from "./chunk-
|
|
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-
|
|
173
|
+
} from "./chunk-3d9w8t4n.js";
|
|
178
174
|
import {
|
|
179
175
|
explainObjectQuery2
|
|
180
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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
|
-
|
|
225
|
-
|
|
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-
|
|
230
|
+
} from "./chunk-5xkqasvn.js";
|
|
233
231
|
import {
|
|
234
232
|
aiLimitSubjectsFromAttribution2,
|
|
235
233
|
applicableAiLimitPolicyStatuses2,
|
|
236
234
|
aiUsageLimitExceededError2,
|
|
237
235
|
aiUsageLimitUnavailableError2
|
|
238
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-szzhrn3e.js";
|
|
239
237
|
import {
|
|
240
238
|
normalizeAgentContextEntries2
|
|
241
|
-
} from "./chunk-
|
|
239
|
+
} from "./chunk-xg31er4p.js";
|
|
242
240
|
import {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
} from "./chunk-
|
|
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-
|
|
249
|
+
} from "./chunk-t6pfch4e.js";
|
|
252
250
|
import {
|
|
253
251
|
DatasetValidationError2
|
|
254
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-fq8drkp0.js";
|
|
255
253
|
import {
|
|
256
254
|
lakeDatasetDefinition2,
|
|
257
255
|
validateDatasetMergeChanges2
|
|
258
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-d7t9jnym.js";
|
|
259
257
|
import {
|
|
260
258
|
datasetDefinitionHash,
|
|
261
259
|
tryEnqueueIngestFlush
|
|
262
|
-
} from "./chunk-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
305
|
+
} from "./chunk-39q9ybav.js";
|
|
297
306
|
import {
|
|
298
307
|
requestPipelineRun2
|
|
299
|
-
} from "./chunk-
|
|
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-
|
|
324
|
+
} from "./chunk-wrb1x1ss.js";
|
|
312
325
|
import {
|
|
313
326
|
executionRecordInputFromRuntime,
|
|
314
327
|
ensureExecutionRecord2,
|
|
315
328
|
createPrimitiveExecutionRecord,
|
|
316
329
|
restoreTrustedPrimitiveExecutionScope
|
|
317
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
398
|
+
} from "./chunk-389ybvw9.js";
|
|
389
399
|
import {
|
|
390
400
|
resolveFileRefAtPath2,
|
|
391
401
|
openFileRef2,
|
|
392
402
|
jsonPointerSegment2
|
|
393
|
-
} from "./chunk-
|
|
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
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
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
|
|
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
|
-
|
|
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(
|
|
2349
|
-
const
|
|
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,
|
|
2403
|
+
model: turnModel(language, tier, last),
|
|
2353
2404
|
...tierProbabilities ? { tierProbabilities } : {}
|
|
2354
2405
|
};
|
|
2355
2406
|
}
|
|
2356
2407
|
};
|
|
2357
2408
|
}
|
|
2358
|
-
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
4833
|
+
return createFileDownloadUrl2(downloadUrlContext(), file, options);
|
|
4725
4834
|
},
|
|
4726
4835
|
revokeDownloadUrl: async (id) => {
|
|
4727
4836
|
assertAccess();
|
|
4728
|
-
return
|
|
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
|
|
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
|
-
|
|
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 &&
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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/
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
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
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
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
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
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
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
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
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
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
|
|
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 =
|
|
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 =
|
|
7734
|
+
const binding = selectModel(catalog, input.model);
|
|
7910
7735
|
assertImageModel(binding);
|
|
7911
|
-
|
|
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
|
-
|
|
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_${
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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_${
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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_${
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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=
|
|
13078
|
+
//# debugId=F9483E747CF0F2C264756E2164756E21
|