@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
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto"
|
|
2
|
+
import { assertModelAccess } from "../../authorization"
|
|
3
|
+
import { createFileDownloadUrl } from "../../blob-storage/download-urls"
|
|
4
|
+
import type { BlobStorage, FileRef } from "../../blob-storage/types"
|
|
5
|
+
import type { ExecutionContext } from "../../execution"
|
|
6
|
+
import type { ReadonlyJsonObject } from "../../json"
|
|
7
|
+
import type { SixbRuntimeContext } from "../../runtime/types"
|
|
8
|
+
import type { AiModelCallOperationRecord, AiUsageStorage } from "../../storage"
|
|
9
|
+
import type { ModelCatalog } from "../catalog"
|
|
10
|
+
import { ModelProviderError } from "../errors"
|
|
11
|
+
import type { ModelExecutionSession } from "../execution/session"
|
|
12
|
+
import { prepareModelInputFile, readModelInputFile } from "../input-file"
|
|
13
|
+
import type { ModelMoney } from "../pricing"
|
|
14
|
+
import { assertVideoModel } from "./catalog"
|
|
15
|
+
import {
|
|
16
|
+
abandonVideoOperation,
|
|
17
|
+
checkVideoOperation,
|
|
18
|
+
isWarnings,
|
|
19
|
+
resolveVideoModel,
|
|
20
|
+
type StoredVideoRequest,
|
|
21
|
+
scheduleVideoCheck,
|
|
22
|
+
storedVideoRequest,
|
|
23
|
+
storedVideoResult,
|
|
24
|
+
} from "./check"
|
|
25
|
+
import type {
|
|
26
|
+
VideoGenerateInput,
|
|
27
|
+
VideoGeneration,
|
|
28
|
+
VideoInputImage,
|
|
29
|
+
VideoModel,
|
|
30
|
+
VideoModelStart,
|
|
31
|
+
VideoModelsRuntime,
|
|
32
|
+
VideoReservationInput,
|
|
33
|
+
} from "./types"
|
|
34
|
+
|
|
35
|
+
/** How often `generate()` checks on its job: providers take minutes, and bill per job, not per look. */
|
|
36
|
+
const POLL_INTERVAL_MS = 5_000
|
|
37
|
+
/** A provider may queue a job before it fetches its input images. */
|
|
38
|
+
const INPUT_URL_EXPIRY_MS = 60 * 60_000
|
|
39
|
+
|
|
40
|
+
interface PreparedImage {
|
|
41
|
+
readonly file: FileRef
|
|
42
|
+
readonly mediaType: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface PreparedRequest {
|
|
46
|
+
readonly prompt: string
|
|
47
|
+
readonly n: number
|
|
48
|
+
readonly durationSeconds?: number
|
|
49
|
+
readonly resolution?: string
|
|
50
|
+
readonly aspectRatio?: string
|
|
51
|
+
readonly audio?: boolean
|
|
52
|
+
readonly seed?: number
|
|
53
|
+
readonly firstFrame?: PreparedImage
|
|
54
|
+
readonly lastFrame?: PreparedImage
|
|
55
|
+
readonly referenceImages: readonly PreparedImage[]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface VideoRuntimeDependencies {
|
|
59
|
+
readonly blobs: BlobStorage | undefined
|
|
60
|
+
/** Whether the caller sees what an execution's model calls produced. */
|
|
61
|
+
readonly canReadCallsOf: (executionId: string) => Promise<boolean>
|
|
62
|
+
/** Where the API is reachable from outside, to hand the provider URLs to input images. */
|
|
63
|
+
readonly apiPublicOrigin: () => string | undefined
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Video generation outlives the request that starts it. `start` admits the call, starts the job
|
|
68
|
+
* and keeps the provider's handle in storage; any later `get` checks on the job, and the one that
|
|
69
|
+
* sees it end records the call under the execution attempt that admitted it, then stores the
|
|
70
|
+
* videos. `generate` is both, in one process.
|
|
71
|
+
*/
|
|
72
|
+
export function createVideoRuntime(
|
|
73
|
+
runtime: SixbRuntimeContext,
|
|
74
|
+
execution: ExecutionContext,
|
|
75
|
+
catalog: ModelCatalog | undefined,
|
|
76
|
+
session: ModelExecutionSession,
|
|
77
|
+
dependencies: VideoRuntimeDependencies
|
|
78
|
+
): VideoModelsRuntime {
|
|
79
|
+
const projectId = runtime.projectId
|
|
80
|
+
|
|
81
|
+
async function start(
|
|
82
|
+
input: VideoGenerateInput
|
|
83
|
+
): Promise<{ readonly generation: VideoGeneration; readonly model: VideoModel }> {
|
|
84
|
+
assertModelAccess(runtime, execution, "models.video.generate")
|
|
85
|
+
|
|
86
|
+
const request = prepareRequest(input)
|
|
87
|
+
const blobs = requireBlobs(dependencies.blobs)
|
|
88
|
+
const operations = requireOperationStorage(runtime.storage.aiUsage)
|
|
89
|
+
|
|
90
|
+
const signal = session.signal(input.signal)
|
|
91
|
+
signal.throwIfAborted()
|
|
92
|
+
|
|
93
|
+
const binding = selectModel(catalog, input.model)
|
|
94
|
+
assertVideoModel(binding)
|
|
95
|
+
assertRequestSupport(binding, request)
|
|
96
|
+
|
|
97
|
+
const accounting = await session.accounting()
|
|
98
|
+
accounting.assertHealthy()
|
|
99
|
+
|
|
100
|
+
const model = await resolveVideoModel(binding)
|
|
101
|
+
assertRequestSupport(model, request)
|
|
102
|
+
|
|
103
|
+
const images = {
|
|
104
|
+
...(request.firstFrame
|
|
105
|
+
? { firstFrame: await inputImage(blobs, request.firstFrame, signal) }
|
|
106
|
+
: {}),
|
|
107
|
+
...(request.lastFrame
|
|
108
|
+
? { lastFrame: await inputImage(blobs, request.lastFrame, signal) }
|
|
109
|
+
: {}),
|
|
110
|
+
referenceImages: await Promise.all(
|
|
111
|
+
request.referenceImages.map((image) => inputImage(blobs, image, signal))
|
|
112
|
+
),
|
|
113
|
+
}
|
|
114
|
+
accounting.assertHealthy()
|
|
115
|
+
|
|
116
|
+
const imageCount = countImages(request)
|
|
117
|
+
const promptTokens = Math.ceil(new TextEncoder().encode(request.prompt).byteLength / 4)
|
|
118
|
+
const callId = `call_${randomUUID()}`
|
|
119
|
+
await accounting.admitCall({
|
|
120
|
+
callId,
|
|
121
|
+
providerId: model.providerId,
|
|
122
|
+
modelId: model.modelId,
|
|
123
|
+
modelKind: "video",
|
|
124
|
+
inputTokens:
|
|
125
|
+
imageCount > 0
|
|
126
|
+
? { status: "unavailable", reason: "nonTextInput" }
|
|
127
|
+
: { status: "estimated", tokens: promptTokens, method: "utf8BytesDividedByFour" },
|
|
128
|
+
outputTokenAllowance: 0,
|
|
129
|
+
reservationCost: estimateReservationCost(model, {
|
|
130
|
+
n: request.n,
|
|
131
|
+
...optional("durationSeconds", request.durationSeconds),
|
|
132
|
+
...optional("resolution", request.resolution),
|
|
133
|
+
...optional("audio", request.audio),
|
|
134
|
+
promptTokens,
|
|
135
|
+
inputImages: imageCount,
|
|
136
|
+
}),
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
// Kept, with its check queued, before the provider has it: a job the provider bills always
|
|
140
|
+
// has a record, and a check that settles it if this process stops.
|
|
141
|
+
const initial: StoredVideoRequest = {
|
|
142
|
+
n: request.n,
|
|
143
|
+
...optional("durationSeconds", request.durationSeconds),
|
|
144
|
+
warnings: [],
|
|
145
|
+
}
|
|
146
|
+
let record: AiModelCallOperationRecord
|
|
147
|
+
try {
|
|
148
|
+
record = await operations.createModelCallOperation({
|
|
149
|
+
projectId,
|
|
150
|
+
callId,
|
|
151
|
+
executionId: accounting.executionId,
|
|
152
|
+
attempt: accounting.attempt,
|
|
153
|
+
modelKind: "video",
|
|
154
|
+
providerId: model.providerId,
|
|
155
|
+
modelId: model.modelId,
|
|
156
|
+
request: initial as unknown as ReadonlyJsonObject,
|
|
157
|
+
reserved: accounting.hasReservation(callId),
|
|
158
|
+
})
|
|
159
|
+
} catch (error) {
|
|
160
|
+
await accounting.markCallUnknown(callId)
|
|
161
|
+
throw error
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let started: VideoModelStart
|
|
165
|
+
try {
|
|
166
|
+
await scheduleVideoCheck(runtime.queues.agents, record)
|
|
167
|
+
signal.throwIfAborted()
|
|
168
|
+
started = await model.start({
|
|
169
|
+
callId,
|
|
170
|
+
prompt: request.prompt,
|
|
171
|
+
n: request.n,
|
|
172
|
+
...optional("durationSeconds", request.durationSeconds),
|
|
173
|
+
...optional("resolution", request.resolution),
|
|
174
|
+
...optional("aspectRatio", request.aspectRatio),
|
|
175
|
+
...optional("audio", request.audio),
|
|
176
|
+
...optional("seed", request.seed),
|
|
177
|
+
...images,
|
|
178
|
+
signal,
|
|
179
|
+
})
|
|
180
|
+
if (!isStart(started)) {
|
|
181
|
+
throw new ModelProviderError(
|
|
182
|
+
"[SixbModels] Invalid video start response.",
|
|
183
|
+
model.providerId,
|
|
184
|
+
model.modelId,
|
|
185
|
+
{ code: "invalid_video_response", retryable: false }
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
} catch (error) {
|
|
189
|
+
// A start that failed may still have reached the provider: its budget becomes unknown.
|
|
190
|
+
await abandonVideoOperation(operations, record, accounting, "The video could not be started.")
|
|
191
|
+
throw error
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// The job runs now, whatever happens to this request: its handle must be kept.
|
|
195
|
+
const stored: StoredVideoRequest = {
|
|
196
|
+
...initial,
|
|
197
|
+
...optional("dimensions", started.pricingDimensions),
|
|
198
|
+
warnings: [...(started.warnings ?? [])],
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
const kept = await operations.startModelCallOperation({
|
|
202
|
+
projectId,
|
|
203
|
+
callId,
|
|
204
|
+
operation: started.operation,
|
|
205
|
+
request: stored as unknown as ReadonlyJsonObject,
|
|
206
|
+
})
|
|
207
|
+
if (!kept) throw new Error(`[SixbModels] Video generation '${callId}' disappeared.`)
|
|
208
|
+
record = kept
|
|
209
|
+
} catch (error) {
|
|
210
|
+
// The queued check settles it at the ceiling, its budget unknown.
|
|
211
|
+
await accounting.markCallUnknown(callId)
|
|
212
|
+
throw new Error(
|
|
213
|
+
`[SixbModels] Video generation '${callId}' started, but Sixb could not keep track of it.`,
|
|
214
|
+
{ cause: error }
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return { generation: await generationFrom(record), model }
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async function check(
|
|
222
|
+
callId: string,
|
|
223
|
+
binding?: VideoModel,
|
|
224
|
+
callerSignal?: AbortSignal
|
|
225
|
+
): Promise<VideoGeneration | null> {
|
|
226
|
+
if (typeof callId !== "string" || !callId.trim()) {
|
|
227
|
+
throw new TypeError("[SixbModels] A model call ID must be a nonblank string.")
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const operations = requireOperationStorage(runtime.storage.aiUsage)
|
|
231
|
+
const record = await operations.getModelCallOperation({ projectId, callId })
|
|
232
|
+
if (!record || record.modelKind !== "video") return null
|
|
233
|
+
if (!(await dependencies.canReadCallsOf(record.executionId))) return null
|
|
234
|
+
if (record.status !== "pending") return generationFrom(record)
|
|
235
|
+
|
|
236
|
+
const checked = await checkVideoOperation(
|
|
237
|
+
{
|
|
238
|
+
projectId,
|
|
239
|
+
storage: { executions: runtime.storage.executions, aiUsage: operations },
|
|
240
|
+
catalog,
|
|
241
|
+
blobs: dependencies.blobs,
|
|
242
|
+
accountingFor: (origin, attempt) => session.accountingFor(origin, attempt),
|
|
243
|
+
},
|
|
244
|
+
record,
|
|
245
|
+
{ ...(binding ? { binding } : {}), signal: session.signal(callerSignal) }
|
|
246
|
+
)
|
|
247
|
+
return generationFrom(checked)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async function generationFrom(record: AiModelCallOperationRecord): Promise<VideoGeneration> {
|
|
251
|
+
const stored = storedVideoRequest(record)
|
|
252
|
+
const base = {
|
|
253
|
+
callId: record.callId,
|
|
254
|
+
model: { providerId: record.providerId, modelId: record.modelId },
|
|
255
|
+
createdAt: record.createdAt,
|
|
256
|
+
}
|
|
257
|
+
if (record.status === "pending") {
|
|
258
|
+
return { ...base, status: "pending", files: [], warnings: [...stored.warnings] }
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const result = storedVideoResult(record)
|
|
262
|
+
const files =
|
|
263
|
+
record.status === "completed"
|
|
264
|
+
? ((await runtime.storage.aiUsage?.getModelCallFiles({ projectId, callId: record.callId }))
|
|
265
|
+
?.files ?? [])
|
|
266
|
+
: []
|
|
267
|
+
return {
|
|
268
|
+
...base,
|
|
269
|
+
status: record.status,
|
|
270
|
+
files,
|
|
271
|
+
warnings: [...result.warnings],
|
|
272
|
+
...optional("error", record.error),
|
|
273
|
+
usage: result.usage,
|
|
274
|
+
cost: result.cost,
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async function inputImage(
|
|
279
|
+
blobs: BlobStorage,
|
|
280
|
+
image: PreparedImage,
|
|
281
|
+
signal: AbortSignal
|
|
282
|
+
): Promise<VideoInputImage> {
|
|
283
|
+
// A URL keeps the start request small; a provider cannot reach a loopback origin.
|
|
284
|
+
const origin = dependencies.apiPublicOrigin()
|
|
285
|
+
if (isReachableOrigin(origin) && runtime.storage.fileDownloadGrants) {
|
|
286
|
+
const download = await createFileDownloadUrl(
|
|
287
|
+
{
|
|
288
|
+
projectId,
|
|
289
|
+
storage: runtime.storage,
|
|
290
|
+
blobStorage: blobs,
|
|
291
|
+
executionId: execution.id,
|
|
292
|
+
apiPublicOrigin: origin,
|
|
293
|
+
},
|
|
294
|
+
image.file,
|
|
295
|
+
{ expiresInMs: INPUT_URL_EXPIRY_MS }
|
|
296
|
+
)
|
|
297
|
+
return { url: download.url, mediaType: image.mediaType }
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return { data: await readModelInputFile(blobs, image.file, signal), mediaType: image.mediaType }
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return {
|
|
304
|
+
async generate(input) {
|
|
305
|
+
const { generation, model } = await start(input)
|
|
306
|
+
|
|
307
|
+
// Past the ceiling a check settles the generation, so the wait ends.
|
|
308
|
+
let current = generation
|
|
309
|
+
while (current.status === "pending") {
|
|
310
|
+
await delay(POLL_INTERVAL_MS, session.signal(input.signal))
|
|
311
|
+
const next = await check(generation.callId, model, input.signal)
|
|
312
|
+
if (!next) {
|
|
313
|
+
throw new Error(`[SixbModels] Video generation '${generation.callId}' disappeared.`)
|
|
314
|
+
}
|
|
315
|
+
current = next
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (current.status === "failed") {
|
|
319
|
+
throw new ModelProviderError(
|
|
320
|
+
`[SixbModels] Video generation failed: ${current.error}`,
|
|
321
|
+
model.providerId,
|
|
322
|
+
model.modelId
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
files: current.files,
|
|
327
|
+
warnings: current.warnings,
|
|
328
|
+
usage: current.usage ?? {},
|
|
329
|
+
cost: current.cost ?? { status: "unpriceable", reason: "missing-usage" },
|
|
330
|
+
callId: current.callId,
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
async start(input) {
|
|
335
|
+
return (await start(input)).generation
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
get(callId) {
|
|
339
|
+
return check(callId)
|
|
340
|
+
},
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** Validate and snapshot the caller's request before the first await. */
|
|
345
|
+
function prepareRequest(input: VideoGenerateInput): PreparedRequest {
|
|
346
|
+
if (typeof input?.prompt !== "string" || !input.prompt.trim()) {
|
|
347
|
+
throw new TypeError("[SixbModels] Video generation requires a nonblank prompt.")
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const n = input.n ?? 1
|
|
351
|
+
if (!Number.isSafeInteger(n) || n <= 0) {
|
|
352
|
+
throw new TypeError("[SixbModels] Video count 'n' must be a positive safe integer.")
|
|
353
|
+
}
|
|
354
|
+
if (
|
|
355
|
+
input.duration !== undefined &&
|
|
356
|
+
(!Number.isSafeInteger(input.duration) || input.duration <= 0)
|
|
357
|
+
) {
|
|
358
|
+
throw new TypeError("[SixbModels] Video duration must be a positive whole number of seconds.")
|
|
359
|
+
}
|
|
360
|
+
if (
|
|
361
|
+
input.resolution !== undefined &&
|
|
362
|
+
(typeof input.resolution !== "string" || !/^[1-9]\d*x[1-9]\d*$/.test(input.resolution))
|
|
363
|
+
) {
|
|
364
|
+
throw new TypeError("[SixbModels] Video resolution must be a frame size such as '1280x720'.")
|
|
365
|
+
}
|
|
366
|
+
if (
|
|
367
|
+
input.aspectRatio !== undefined &&
|
|
368
|
+
(typeof input.aspectRatio !== "string" || !input.aspectRatio.trim())
|
|
369
|
+
) {
|
|
370
|
+
throw new TypeError("[SixbModels] Video aspectRatio must be a nonblank string.")
|
|
371
|
+
}
|
|
372
|
+
if (input.audio !== undefined && typeof input.audio !== "boolean") {
|
|
373
|
+
throw new TypeError("[SixbModels] Video audio must be a boolean.")
|
|
374
|
+
}
|
|
375
|
+
if (input.seed !== undefined && !Number.isSafeInteger(input.seed)) {
|
|
376
|
+
throw new TypeError("[SixbModels] Video seed must be a safe integer.")
|
|
377
|
+
}
|
|
378
|
+
if (input.referenceImages !== undefined && !Array.isArray(input.referenceImages)) {
|
|
379
|
+
throw new TypeError("[SixbModels] Reference images must be an array of FileRefs.")
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return {
|
|
383
|
+
prompt: input.prompt,
|
|
384
|
+
n,
|
|
385
|
+
...optional("durationSeconds", input.duration),
|
|
386
|
+
...optional("resolution", input.resolution),
|
|
387
|
+
...optional("aspectRatio", input.aspectRatio),
|
|
388
|
+
...optional("audio", input.audio),
|
|
389
|
+
...optional("seed", input.seed),
|
|
390
|
+
...(input.firstFrame ? { firstFrame: prepareModelInputFile(input.firstFrame, "image") } : {}),
|
|
391
|
+
...(input.lastFrame ? { lastFrame: prepareModelInputFile(input.lastFrame, "image") } : {}),
|
|
392
|
+
referenceImages: (input.referenceImages ?? []).map((image) =>
|
|
393
|
+
prepareModelInputFile(image, "image")
|
|
394
|
+
),
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
function selectModel(
|
|
399
|
+
catalog: ModelCatalog | undefined,
|
|
400
|
+
requested: VideoModel | undefined
|
|
401
|
+
): VideoModel {
|
|
402
|
+
const videos = catalog?.video
|
|
403
|
+
if (!videos) throw new Error("[SixbModels] Configure models.video in createSixb().")
|
|
404
|
+
if (!requested) return videos.default.model
|
|
405
|
+
|
|
406
|
+
// A later check, in any process, finds the job's model in the catalog.
|
|
407
|
+
const ref = { provider: requested.providerId, modelId: requested.modelId }
|
|
408
|
+
if (!videos.getByRef(ref)) {
|
|
409
|
+
throw new Error(
|
|
410
|
+
`[SixbModels] Video model '${ref.provider}/${ref.modelId}' is not in models.video: list it in createSixb() to generate with it.`
|
|
411
|
+
)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return requested
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function assertRequestSupport(model: VideoModel, request: PreparedRequest): void {
|
|
418
|
+
const definition = model.definition
|
|
419
|
+
if (definition.maxVideosPerCall !== undefined && request.n > definition.maxVideosPerCall) {
|
|
420
|
+
throw new RangeError(
|
|
421
|
+
`[SixbModels] The selected model returns at most ${definition.maxVideosPerCall} videos per call.`
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
for (const [field, list] of [
|
|
425
|
+
["resolution", definition.resolutions],
|
|
426
|
+
["aspectRatio", definition.aspectRatios],
|
|
427
|
+
] as const) {
|
|
428
|
+
const value = request[field]
|
|
429
|
+
if (value !== undefined && list && !list.includes(value)) {
|
|
430
|
+
throw new TypeError(
|
|
431
|
+
`[SixbModels] Video ${field} '${value}' is not supported by the selected model. Use one of: ${list.join(", ")}.`
|
|
432
|
+
)
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
const durations = definition.durations
|
|
436
|
+
if (
|
|
437
|
+
request.durationSeconds !== undefined &&
|
|
438
|
+
durations &&
|
|
439
|
+
!durations.includes(request.durationSeconds)
|
|
440
|
+
) {
|
|
441
|
+
throw new TypeError(
|
|
442
|
+
`[SixbModels] A ${request.durationSeconds}-second video is not supported by the selected model. Use one of: ${durations.join(", ")} seconds.`
|
|
443
|
+
)
|
|
444
|
+
}
|
|
445
|
+
if (request.audio === true && definition.audio === false) {
|
|
446
|
+
throw new TypeError("[SixbModels] The selected model makes videos without sound.")
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const images = [
|
|
450
|
+
...(request.firstFrame ? [request.firstFrame] : []),
|
|
451
|
+
...(request.lastFrame ? [request.lastFrame] : []),
|
|
452
|
+
...request.referenceImages,
|
|
453
|
+
]
|
|
454
|
+
if (images.length === 0) return
|
|
455
|
+
|
|
456
|
+
const accepted = definition.inputImages
|
|
457
|
+
if (!accepted) {
|
|
458
|
+
throw new TypeError("[SixbModels] The selected model does not accept input images.")
|
|
459
|
+
}
|
|
460
|
+
if (images.length > accepted.maxCount) {
|
|
461
|
+
throw new RangeError(
|
|
462
|
+
`[SixbModels] The selected model accepts at most ${accepted.maxCount} input images.`
|
|
463
|
+
)
|
|
464
|
+
}
|
|
465
|
+
for (const image of images) {
|
|
466
|
+
if (image.file.sizeBytes > accepted.maxBytes) {
|
|
467
|
+
throw new RangeError(
|
|
468
|
+
`[SixbModels] Input image exceeds the model's ${accepted.maxBytes}-byte input limit.`
|
|
469
|
+
)
|
|
470
|
+
}
|
|
471
|
+
if (accepted.mediaTypes && !accepted.mediaTypes.includes(image.mediaType)) {
|
|
472
|
+
throw new TypeError(
|
|
473
|
+
`[SixbModels] Image media type '${image.mediaType}' is not supported by the selected model.`
|
|
474
|
+
)
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function countImages(request: PreparedRequest): number {
|
|
480
|
+
return (request.firstFrame ? 1 : 0) + (request.lastFrame ? 1 : 0) + request.referenceImages.length
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function estimateReservationCost(
|
|
484
|
+
model: VideoModel,
|
|
485
|
+
input: VideoReservationInput
|
|
486
|
+
): ModelMoney | undefined {
|
|
487
|
+
try {
|
|
488
|
+
return model.costEstimator?.estimateReservation?.(input)
|
|
489
|
+
} catch {
|
|
490
|
+
// Optional pricing cannot bypass an enforced budget: admission fails closed without it.
|
|
491
|
+
return undefined
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function requireBlobs(blobs: BlobStorage | undefined): BlobStorage {
|
|
496
|
+
if (!blobs) throw new Error("[SixbModels] Video generation requires blob storage.")
|
|
497
|
+
return blobs
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function requireOperationStorage(storage: AiUsageStorage | undefined): AiUsageStorage {
|
|
501
|
+
if (!storage) throw new Error("[SixbModels] Video generation requires storage.aiUsage.")
|
|
502
|
+
return storage
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** Whether a provider on the internet can fetch a URL at this origin. */
|
|
506
|
+
function isReachableOrigin(origin: string | undefined): origin is string {
|
|
507
|
+
if (!origin) return false
|
|
508
|
+
|
|
509
|
+
const host = new URL(origin).hostname
|
|
510
|
+
return !(
|
|
511
|
+
host === "localhost" ||
|
|
512
|
+
host.endsWith(".localhost") ||
|
|
513
|
+
host === "[::1]" ||
|
|
514
|
+
host === "0.0.0.0" ||
|
|
515
|
+
host.startsWith("127.")
|
|
516
|
+
)
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function isStart(value: unknown): value is VideoModelStart {
|
|
520
|
+
const start = value as Partial<VideoModelStart> | null
|
|
521
|
+
return (
|
|
522
|
+
start !== null &&
|
|
523
|
+
typeof start === "object" &&
|
|
524
|
+
start.operation !== undefined &&
|
|
525
|
+
start.operation !== null &&
|
|
526
|
+
(start.warnings === undefined || isWarnings(start.warnings))
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
function optional<TKey extends string, TValue>(
|
|
531
|
+
key: TKey,
|
|
532
|
+
value: TValue | undefined
|
|
533
|
+
): { [K in TKey]?: TValue } {
|
|
534
|
+
return (value === undefined ? {} : { [key]: value }) as { [K in TKey]?: TValue }
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function delay(ms: number, signal: AbortSignal): Promise<void> {
|
|
538
|
+
return new Promise((resolve, reject) => {
|
|
539
|
+
signal.throwIfAborted()
|
|
540
|
+
const timer = setTimeout(() => {
|
|
541
|
+
signal.removeEventListener("abort", abort)
|
|
542
|
+
resolve()
|
|
543
|
+
}, ms)
|
|
544
|
+
const abort = () => {
|
|
545
|
+
clearTimeout(timer)
|
|
546
|
+
reject(signal.reason)
|
|
547
|
+
}
|
|
548
|
+
signal.addEventListener("abort", abort, { once: true })
|
|
549
|
+
})
|
|
550
|
+
}
|