@sixb/core 0.2.7 → 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 +52 -49
- 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.js +57 -54
- 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/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/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/index.js +61 -58
- 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-m1cwncee.js → chunk-2mxq1yd9.js} +45 -40
- package/dist/{chunk-m1cwncee.js.map → chunk-2mxq1yd9.js.map} +3 -3
- package/dist/{chunk-dmnd9ea6.js → chunk-30a0ftnm.js} +2 -2
- package/dist/chunk-389ybvw9.js.map +2 -2
- package/dist/{chunk-qbd282aa.js → chunk-39q9ybav.js} +2 -2
- package/dist/{chunk-06kpaqg4.js → chunk-3d9w8t4n.js} +110 -22
- package/dist/{chunk-06kpaqg4.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-fdk0ks9p.js → chunk-3x902cja.js} +3 -3
- package/dist/{chunk-c4nrycdy.js → chunk-4q4a5a96.js} +1 -1
- package/dist/{chunk-9cyq87qa.js → chunk-4tdm3fsj.js} +95 -32
- package/dist/{chunk-9cyq87qa.js.map → chunk-4tdm3fsj.js.map} +9 -9
- package/dist/{chunk-cpy282b8.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-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-pfdq1ga6.js → chunk-8eqqqc1h.js} +3 -3
- package/dist/{chunk-yyj009tv.js → chunk-8tefbhdx.js} +14 -14
- package/dist/{chunk-yyj009tv.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-phs5fbff.js → chunk-990a5bkc.js} +424 -76
- package/dist/chunk-990a5bkc.js.map +21 -0
- package/dist/{chunk-6md802cc.js → chunk-9az7kjv4.js} +6 -6
- package/dist/{chunk-95ps0k5q.js → chunk-9e5t53z0.js} +1 -1
- package/dist/{chunk-js9e6487.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-8qmp9fpa.js → chunk-as94vcty.js} +619 -482
- package/dist/{chunk-8qmp9fpa.js.map → chunk-as94vcty.js.map} +19 -19
- 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-hvq8xs66.js → chunk-jwjwvzj1.js} +797 -51
- package/dist/chunk-jwjwvzj1.js.map +38 -0
- package/dist/{chunk-k29rdc3h.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-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-fycac8e9.js → chunk-wpba6hhd.js} +10 -10
- package/dist/{chunk-fycac8e9.js.map → chunk-wpba6hhd.js.map} +1 -1
- package/dist/{chunk-t58sktr5.js → chunk-wrb1x1ss.js} +2 -2
- package/dist/{chunk-5sswe5ej.js → chunk-wsv23wvr.js} +2 -2
- package/dist/{chunk-04r2fdsd.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-5pz3htbe.js → chunk-y57eawng.js} +3 -3
- package/dist/{chunk-8ncg20rd.js → chunk-yah25st6.js} +5 -5
- package/dist/chunk-yah25st6.js.map +10 -0
- package/dist/{chunk-mrs7jy17.js → chunk-ywvxcmqj.js} +106 -13
- package/dist/{chunk-mrs7jy17.js.map → chunk-ywvxcmqj.js.map} +8 -7
- package/dist/{chunk-44hrfmbk.js → chunk-zmq9xc9s.js} +70 -31
- package/dist/{chunk-44hrfmbk.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/errors/catalog.d.ts.map +1 -1
- package/dist/execution/agent.js +52 -49
- 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 +52 -49
- package/dist/execution/primitive.js.map +1 -1
- package/dist/execution/request.js +53 -50
- 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 +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -65
- 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 +52 -49
- 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/host.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/sixb.d.ts.map +1 -1
- package/dist/sandboxes/index.js +6 -6
- 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.js +4 -4
- package/dist/storage/agents/types.d.ts +13 -0
- 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 +24 -22
- 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 +619 -72
- package/dist/testing/index.js.map +9 -9
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-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 +58 -55
- 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/model-call-retry.ts +69 -0
- package/src/agents/model-loop.ts +86 -12
- 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/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/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 +18 -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/host.ts +3 -0
- package/src/runtime/internal.ts +3 -1
- package/src/runtime/sixb.ts +12 -4
- package/src/sandboxes/README.md +3 -2
- 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/types.ts +14 -0
- 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 +108 -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 +320 -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/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-gfdh9kqa.js.map +0 -11
- package/dist/chunk-hvq8xs66.js.map +0 -34
- package/dist/chunk-k29rdc3h.js.map +0 -10
- package/dist/chunk-mbwsgjn7.js.map +0 -11
- package/dist/chunk-phs5fbff.js.map +0 -19
- 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-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-fdk0ks9p.js.map → chunk-3x902cja.js.map} +0 -0
- /package/dist/{chunk-c4nrycdy.js.map → chunk-4q4a5a96.js.map} +0 -0
- /package/dist/{chunk-cpy282b8.js.map → chunk-4w8qzy9w.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-pfdq1ga6.js.map → chunk-8eqqqc1h.js.map} +0 -0
- /package/dist/{chunk-jka26v8c.js.map → chunk-8x1bsp68.js.map} +0 -0
- /package/dist/{chunk-6md802cc.js.map → chunk-9az7kjv4.js.map} +0 -0
- /package/dist/{chunk-95ps0k5q.js.map → chunk-9e5t53z0.js.map} +0 -0
- /package/dist/{chunk-js9e6487.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-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-t58sktr5.js.map → chunk-wrb1x1ss.js.map} +0 -0
- /package/dist/{chunk-5sswe5ej.js.map → chunk-wsv23wvr.js.map} +0 -0
- /package/dist/{chunk-04r2fdsd.js.map → chunk-x0hqc54n.js.map} +0 -0
- /package/dist/{chunk-3neam1y5.js.map → chunk-y3qb965a.js.map} +0 -0
- /package/dist/{chunk-5pz3htbe.js.map → chunk-y57eawng.js.map} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/blob-storage/download-urls.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { createHash, randomBytes, randomUUID } from \"node:crypto\"\nimport type { FileDownloadGrantRecord, FileDownloadGrantStorage, Storage } from \"../storage\"\nimport { BlobStorageError } from \"./errors\"\nimport type { BlobStorage, FileRef } from \"./types\"\nimport { isFileRef } from \"./validation\"\n\n/**\n * Download URLs let a third party that cannot hold a Sixb session — a social network fetching\n * media to publish, for instance — read one file for a bounded time.\n *\n * Each URL carries a random token. Storage keeps only its SHA-256, with the file, the expiry, and\n * the execution that issued it. The API looks the token up on every request, so any process\n * sharing the storage can issue a URL, and a URL can be revoked before it expires.\n *\n * The API serves the bytes itself rather than redirecting to the blob provider: fetchers such as\n * TikTok refuse redirects and accept only hosts whose ownership the developer verified.\n */\n\n/** Path prefix of the public route that serves download URLs. */\nexport const FILE_DOWNLOAD_ROUTE_PREFIX = \"/api/files/downloads/\"\n\nconst DEFAULT_EXPIRY_MS = 60 * 60 * 1000\n// SQLite compares ISO timestamps as text, which orders them correctly only for four-digit years.\nconst LATEST_EXPIRY_MS = Date.UTC(9999, 11, 31, 23, 59, 59, 999)\n/** 32 random bytes in base64url. */\nconst TOKEN_PATTERN = /^[A-Za-z0-9_-]{43}$/\n\nexport interface CreateFileDownloadUrlOptions {\n /** How long the URL stays valid. Defaults to one hour. */\n readonly expiresInMs?: number\n}\n\nexport interface FileDownloadUrl {\n /** Pass to `blobs.revokeDownloadUrl()` to stop the URL before it expires. */\n readonly id: string\n readonly url: string\n readonly expiresAt: Date\n}\n\n/** What issuing and revoking need from the execution that asks. */\nexport interface FileDownloadUrlContext {\n readonly projectId: string\n readonly storage: Pick<Storage, \"fileDownloadGrants\">\n readonly blobStorage: Pick<BlobStorage, \"stat\">\n readonly executionId: string\n readonly apiPublicOrigin: string | undefined\n}\n\nexport async function createFileDownloadUrl(\n context: FileDownloadUrlContext,\n file: FileRef,\n options: CreateFileDownloadUrlOptions = {}\n): Promise<FileDownloadUrl> {\n if (!isFileRef(file)) {\n throw new Error(\"[Sixb] blobs.createDownloadUrl() requires a valid file reference.\")\n }\n const createdAt = new Date()\n const expiresAt = expiryFrom(createdAt, options.expiresInMs ?? DEFAULT_EXPIRY_MS)\n const grants = requireGrantStorage(context.storage)\n if (context.apiPublicOrigin === undefined) {\n throw new Error(\n \"[Sixb] blobs.createDownloadUrl() needs the API's public origin. Set SIXB_API_PUBLIC_ORIGIN for the API and every worker.\"\n )\n }\n // Fail here, not when a third party fetches the URL minutes later and gets a bare 404.\n const stat = await context.blobStorage.stat(file.blobId)\n if (!stat || stat.digest !== file.digest || stat.sizeBytes !== file.sizeBytes) {\n throw new BlobStorageError(`[Sixb] No stored blob matches file '${file.blobId}'.`)\n }\n\n const token = randomBytes(32).toString(\"base64url\")\n const { logicalPath: _logicalPath, ...served } = file\n const grant: FileDownloadGrantRecord = {\n id: `filedownload_${randomUUID()}`,\n projectId: context.projectId,\n tokenHash: hashToken(token),\n file: served,\n executionId: context.executionId,\n createdAt,\n expiresAt,\n }\n await grants.create(grant)\n\n return {\n id: grant.id,\n url: new URL(`${FILE_DOWNLOAD_ROUTE_PREFIX}${token}`, context.apiPublicOrigin).toString(),\n expiresAt: grant.expiresAt,\n }\n}\n\nexport async function revokeFileDownloadUrl(\n context: FileDownloadUrlContext,\n id: string\n): Promise<void> {\n const revoked = await requireGrantStorage(context.storage).revoke({\n projectId: context.projectId,\n id,\n revokedAt: new Date(),\n })\n if (!revoked) {\n throw new Error(`[Sixb] Download URL '${id}' does not exist.`)\n }\n}\n\n/** The file a token serves, or `null` when the token is unknown, expired, or revoked. */\nexport async function resolveFileDownload(\n host: { readonly id: string; readonly storage: Storage },\n token: string\n): Promise<FileRef | null> {\n const grants = host.storage.fileDownloadGrants\n if (!grants || !TOKEN_PATTERN.test(token)) return null\n\n const grant = await grants.findByTokenHash({ projectId: host.id, tokenHash: hashToken(token) })\n if (!grant || grant.revokedAt || grant.expiresAt.getTime() <= Date.now()) return null\n return grant.file\n}\n\nfunction hashToken(token: string): string {\n return createHash(\"sha256\").update(token).digest(\"hex\")\n}\n\nfunction requireGrantStorage(\n storage: Pick<Storage, \"fileDownloadGrants\">\n): FileDownloadGrantStorage {\n if (!storage.fileDownloadGrants) {\n throw new Error(\"[Sixb] Download URLs require storage.fileDownloadGrants.\")\n }\n return storage.fileDownloadGrants\n}\n\nfunction expiryFrom(createdAt: Date, expiresInMs: number): Date {\n if (!Number.isSafeInteger(expiresInMs) || expiresInMs <= 0) {\n throw new Error(\"[Sixb] expiresInMs must be a positive integer.\")\n }\n const expiresAt = createdAt.getTime() + expiresInMs\n if (expiresAt > LATEST_EXPIRY_MS) {\n throw new Error(\"[Sixb] expiresInMs must end before the year 10000.\")\n }\n return new Date(expiresAt)\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;AAAA;AAmBO,IAAM,8BAA6B;AAE1C,IAAM,oBAAoB,KAAK,KAAK;AAEpC,IAAM,mBAAmB,KAAK,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;AAE/D,IAAM,gBAAgB;AAuBf,eAAe,sBAAqB,CACzC,SACA,MACA,UAAwC,CAAC,GACf;AAAA,EAC1B,IAAI,CAAC,WAAU,IAAI,GAAG;AAAA,IACpB,MAAM,IAAI,MAAM,mEAAmE;AAAA,EACrF;AAAA,EACA,MAAM,YAAY,IAAI;AAAA,EACtB,MAAM,YAAY,WAAW,WAAW,QAAQ,eAAe,iBAAiB;AAAA,EAChF,MAAM,SAAS,oBAAoB,QAAQ,OAAO;AAAA,EAClD,IAAI,QAAQ,oBAAoB,WAAW;AAAA,IACzC,MAAM,IAAI,MACR,0HACF;AAAA,EACF;AAAA,EAEA,MAAM,OAAO,MAAM,QAAQ,YAAY,KAAK,KAAK,MAAM;AAAA,EACvD,IAAI,CAAC,QAAQ,KAAK,WAAW,KAAK,UAAU,KAAK,cAAc,KAAK,WAAW;AAAA,IAC7E,MAAM,IAAI,kBAAiB,uCAAuC,KAAK,UAAU;AAAA,EACnF;AAAA,EAEA,MAAM,QAAQ,YAAY,EAAE,EAAE,SAAS,WAAW;AAAA,EAClD,QAAQ,aAAa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AAA,IAC/B,MAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AAAA,EACA,OAAO,QAAQ;AAAA;AAGjB,SAAS,UAAU,CAAC,WAAiB,aAA2B;AAAA,EAC9D,IAAI,CAAC,OAAO,cAAc,WAAW,KAAK,eAAe,GAAG;AAAA,IAC1D,MAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AAAA,EACA,MAAM,YAAY,UAAU,QAAQ,IAAI;AAAA,EACxC,IAAI,YAAY,kBAAkB;AAAA,IAChC,MAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AAAA,EACA,OAAO,IAAI,KAAK,SAAS;AAAA;",
|
|
8
|
+
"debugId": "5CD4634187CD92CD64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -6,28 +6,32 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
normalizeAiModelCallCostRecord2,
|
|
8
8
|
aiModelCallCostMatchesUsage2
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ssqbrts1.js";
|
|
10
|
+
import {
|
|
11
|
+
estimateModelCall,
|
|
12
|
+
rateModelCall2
|
|
13
|
+
} from "./chunk-jbg905hn.js";
|
|
10
14
|
import {
|
|
11
15
|
AiLimitStorageError2,
|
|
12
16
|
aiLimitMeterApplies2
|
|
13
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4q4a5a96.js";
|
|
18
|
+
import {
|
|
19
|
+
AiCostStorageError2
|
|
20
|
+
} from "./chunk-3d9w8t4n.js";
|
|
14
21
|
import {
|
|
15
22
|
aiLimitSubjectsFromAttribution2,
|
|
16
23
|
applicableAiLimitPolicies2,
|
|
17
24
|
aiUsageLimitExceededError2,
|
|
18
25
|
aiUsageLimitUnavailableError2
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
estimateModelCall,
|
|
22
|
-
rateModelCall2
|
|
23
|
-
} from "./chunk-qttqe1ah.js";
|
|
26
|
+
} from "./chunk-szzhrn3e.js";
|
|
24
27
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
executionRecordInputFromRuntime,
|
|
29
|
+
ensureExecutionRecord2
|
|
30
|
+
} from "./chunk-6whr25gw.js";
|
|
27
31
|
import {
|
|
28
32
|
AiUsageStorageError2,
|
|
29
33
|
normalizeAiModelCallRecord2
|
|
30
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-v6h4tc2v.js";
|
|
31
35
|
import {
|
|
32
36
|
ModelStreamError2
|
|
33
37
|
} from "./chunk-rtkqczbr.js";
|
|
@@ -446,6 +450,9 @@ function createAiModelCallLimitController2(input) {
|
|
|
446
450
|
try {
|
|
447
451
|
await input.storage.aiLimits.markReservationUnknown(identity);
|
|
448
452
|
} catch (error) {
|
|
453
|
+
if (error instanceof AiLimitStorageError2 && error.code === "invalid_reservation_state") {
|
|
454
|
+
throw error;
|
|
455
|
+
}
|
|
449
456
|
throw limitStorageUnavailable(error);
|
|
450
457
|
}
|
|
451
458
|
}
|
|
@@ -506,7 +513,8 @@ function aiModelCallUsageFromModel(usage) {
|
|
|
506
513
|
...usage.imageOutputTokens === undefined ? {} : { imageOutputTokens: usage.imageOutputTokens },
|
|
507
514
|
...usage.audioOutputTokens === undefined ? {} : { audioOutputTokens: usage.audioOutputTokens },
|
|
508
515
|
...usage.outputImages === undefined ? {} : { outputImages: usage.outputImages },
|
|
509
|
-
...usage.inputCharacters === undefined ? {} : { inputCharacters: usage.inputCharacters }
|
|
516
|
+
...usage.inputCharacters === undefined ? {} : { inputCharacters: usage.inputCharacters },
|
|
517
|
+
...usage.outputVideoMs === undefined ? {} : { outputVideoMs: usage.outputVideoMs }
|
|
510
518
|
};
|
|
511
519
|
}
|
|
512
520
|
|
|
@@ -660,6 +668,13 @@ class AiModelCallRecorder2 {
|
|
|
660
668
|
throw error;
|
|
661
669
|
}
|
|
662
670
|
}
|
|
671
|
+
hasReservation(callId) {
|
|
672
|
+
return this.reservations.has(callId);
|
|
673
|
+
}
|
|
674
|
+
resumeCall(callId, reserved) {
|
|
675
|
+
if (reserved)
|
|
676
|
+
this.reservations.add(callId);
|
|
677
|
+
}
|
|
663
678
|
async markCallUnknown(callId) {
|
|
664
679
|
if (!this.reservations.has(callId))
|
|
665
680
|
return;
|
|
@@ -779,6 +794,84 @@ async function enqueueAiModelCallRecovery2(queue, input) {
|
|
|
779
794
|
}
|
|
780
795
|
}
|
|
781
796
|
|
|
782
|
-
|
|
797
|
+
// src/models/execution/session.ts
|
|
798
|
+
class ModelExecutionSession {
|
|
799
|
+
runtime;
|
|
800
|
+
execution;
|
|
801
|
+
binding;
|
|
802
|
+
recorder;
|
|
803
|
+
constructor(runtime, execution) {
|
|
804
|
+
this.runtime = runtime;
|
|
805
|
+
this.execution = execution;
|
|
806
|
+
}
|
|
807
|
+
bind(input) {
|
|
808
|
+
if (this.binding)
|
|
809
|
+
throw new Error("[SixbModels] Execution attempt is already bound.");
|
|
810
|
+
this.binding = { ...input };
|
|
811
|
+
}
|
|
812
|
+
signal(signal) {
|
|
813
|
+
const binding = this.requireBinding();
|
|
814
|
+
return signal ? AbortSignal.any([binding.signal, signal]) : binding.signal;
|
|
815
|
+
}
|
|
816
|
+
async admitEmbeddingCall(admit) {
|
|
817
|
+
const admission = this.requireBinding().embeddingAdmission;
|
|
818
|
+
if (admission)
|
|
819
|
+
await admission(admit);
|
|
820
|
+
else
|
|
821
|
+
await admit();
|
|
822
|
+
}
|
|
823
|
+
accounting() {
|
|
824
|
+
const { accounting } = this.requireBinding();
|
|
825
|
+
this.recorder ??= accounting ? Promise.resolve(accounting) : this.createRecorder();
|
|
826
|
+
return this.recorder;
|
|
827
|
+
}
|
|
828
|
+
async accountingFor(execution, attempt) {
|
|
829
|
+
const binding = this.requireBinding();
|
|
830
|
+
if (execution.id === this.execution.id && attempt === binding.attempt) {
|
|
831
|
+
return this.accounting();
|
|
832
|
+
}
|
|
833
|
+
return this.recorderFor(execution, attempt);
|
|
834
|
+
}
|
|
835
|
+
requireBinding() {
|
|
836
|
+
if (!this.binding) {
|
|
837
|
+
throw new Error("[SixbModels] Model calls require a bound request or worker execution attempt.");
|
|
838
|
+
}
|
|
839
|
+
return this.binding;
|
|
840
|
+
}
|
|
841
|
+
async createRecorder() {
|
|
842
|
+
const { attempt } = this.requireBinding();
|
|
843
|
+
const record = await ensureExecutionRecord2(this.runtime.storage.executions, executionRecordInputFromRuntime({
|
|
844
|
+
execution: this.execution,
|
|
845
|
+
runtimeAuthorization: this.runtime.runtimeAuthorization
|
|
846
|
+
}));
|
|
847
|
+
return this.recorderFor(record, attempt);
|
|
848
|
+
}
|
|
849
|
+
recorderFor(execution, attempt) {
|
|
850
|
+
return createExecutionRecorder(this.runtime, execution, attempt);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
function createExecutionRecorder(host, execution, attempt) {
|
|
854
|
+
const storage = {
|
|
855
|
+
...requireAccountingCapabilities(host.storage),
|
|
856
|
+
transaction: host.storage.transaction.bind(host.storage)
|
|
857
|
+
};
|
|
858
|
+
const requesterGroupIds = execution.requesterGroupIds;
|
|
859
|
+
return new AiModelCallRecorder2({
|
|
860
|
+
storage,
|
|
861
|
+
projectId: host.projectId,
|
|
862
|
+
executionId: execution.id,
|
|
863
|
+
attempt,
|
|
864
|
+
requesterGroupIds,
|
|
865
|
+
limits: createAiModelCallLimitController2({
|
|
866
|
+
storage,
|
|
867
|
+
projectId: host.projectId,
|
|
868
|
+
requestedBy: execution.requestedBy,
|
|
869
|
+
requesterGroupIds
|
|
870
|
+
}),
|
|
871
|
+
recoverAiModelCall: (input) => enqueueAiModelCallRecovery2(host.queues.agents, input)
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export { AI_MODEL_CALL_OUTPUT_TOKEN_ALLOWANCE, aiModelCallOutputTokenAllowance, ModelUsageRecordingError2, isModelCallAccountingFailure2, LanguageModelCallMeter, reportModelCalls2, createAiModelCallLimitController2, recordRecoveredAiModelCall2, isPermanentAiUsageRecoveryError2, AiModelCallRecorder2, enqueueAiModelCallRecovery2, ModelExecutionSession, createExecutionRecorder };
|
|
783
876
|
|
|
784
|
-
//# debugId=
|
|
877
|
+
//# debugId=06382717B231353C64756E2164756E21
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/models/execution/model-call-admission.ts", "../src/models/execution/errors.ts", "../src/models/language-call.ts", "../src/models/execution/model-call-accounting.ts", "../src/models/execution/model-call-limits.ts", "../src/models/execution/model-call-recorder.ts", "../src/models/execution/usage.ts", "../src/models/execution/model-call-recovery.ts", "../src/models/execution/recovery-queue.ts"],
|
|
3
|
+
"sources": ["../src/models/execution/model-call-admission.ts", "../src/models/execution/errors.ts", "../src/models/language-call.ts", "../src/models/execution/model-call-accounting.ts", "../src/models/execution/model-call-limits.ts", "../src/models/execution/model-call-recorder.ts", "../src/models/execution/usage.ts", "../src/models/execution/model-call-recovery.ts", "../src/models/execution/recovery-queue.ts", "../src/models/execution/session.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { AiModelCallReservationIdentity } from \"../../storage\"\nimport type { ModelKind } from \"../definitions\"\nimport type { ModelCostEstimator, ModelMoney } from \"../pricing\"\n\n/** Default output ceiling when a call and its resolved model supply no limit. */\nexport const AI_MODEL_CALL_OUTPUT_TOKEN_ALLOWANCE = 4_096\n\nexport type AiModelCallInputTokenEstimate =\n | {\n readonly status: \"estimated\"\n readonly tokens: number\n readonly method: \"utf8BytesDividedByFour\"\n }\n | {\n readonly status: \"unavailable\"\n readonly reason: \"nonTextInput\" | \"unserializableInput\"\n }\n\n/** Provider-neutral snapshot passed to aggregate-budget admission before a provider request. */\nexport interface AiModelCallAdmissionInput {\n readonly projectId: string\n readonly executionId: string\n readonly attempt: number\n readonly requesterGroupIds: readonly string[]\n readonly callId: string\n readonly providerId: string\n readonly modelId: string\n /** Selects the applicable limit meters; transcription and reranking skip token limits. */\n readonly modelKind?: ModelKind\n readonly costEstimator?: ModelCostEstimator\n /** A non-token estimate, computed by the resolved binding before inference. */\n readonly reservationCost?: ModelMoney\n readonly inputTokens: AiModelCallInputTokenEstimate\n readonly outputTokenAllowance: number\n readonly estimatedTotalTokens?: number\n}\n\nexport interface AiModelCallAdmissionDecision {\n /** Active means accounting must reconcile the reservation for this provider attempt. */\n readonly reservation: \"active\" | \"none\"\n}\n\nexport type BeforeAiModelCall = (\n input: AiModelCallAdmissionInput\n) => AiModelCallAdmissionDecision | Promise<AiModelCallAdmissionDecision>\n\nexport type MarkAiModelCallUnknown = (input: AiModelCallReservationIdentity) => void | Promise<void>\n\n/**\n * Estimate the exact, prepared provider request without requiring a provider-specific tokenizer.\n *\n * The heuristic is intentionally explicit so reservations are reproducible. Non-text inputs are\n * reported as unavailable; an enforced token or cost policy can then fail closed instead of\n * pretending that an image, file, or provider-defined payload has no token cost.\n */\nexport function estimateAiModelCallInputTokens(input: {\n readonly prompt: unknown\n readonly tools: unknown\n readonly responseFormat: unknown\n}): AiModelCallInputTokenEstimate {\n if (containsNonTextInput(input.prompt)) {\n return { status: \"unavailable\", reason: \"nonTextInput\" }\n }\n\n let serialized: string | undefined\n try {\n serialized = JSON.stringify(input)\n } catch {\n return { status: \"unavailable\", reason: \"unserializableInput\" }\n }\n if (serialized === undefined) {\n return { status: \"unavailable\", reason: \"unserializableInput\" }\n }\n\n const bytes = new TextEncoder().encode(serialized).byteLength\n return {\n status: \"estimated\",\n tokens: Math.ceil(bytes / 4),\n method: \"utf8BytesDividedByFour\",\n }\n}\n\nexport function aiModelCallOutputTokenAllowance(maxOutputTokens: number | undefined): number {\n if (maxOutputTokens === undefined) return AI_MODEL_CALL_OUTPUT_TOKEN_ALLOWANCE\n if (!Number.isSafeInteger(maxOutputTokens) || maxOutputTokens <= 0) {\n throw new TypeError(\n \"[SixbModels] AI model-call maxOutputTokens must be a positive safe integer.\"\n )\n }\n return maxOutputTokens\n}\n\nexport function estimatedAiModelCallTotalTokens(\n inputTokens: AiModelCallInputTokenEstimate,\n outputTokenAllowance: number\n): number | undefined {\n if (inputTokens.status !== \"estimated\") return undefined\n const total = inputTokens.tokens + outputTokenAllowance\n if (!Number.isSafeInteger(total)) {\n throw new TypeError(\"[SixbModels] AI model-call token estimate exceeds the safe range.\")\n }\n return total\n}\n\nfunction containsNonTextInput(value: unknown, seen = new WeakSet<object>()): boolean {\n if (value === null || typeof value !== \"object\") return false\n if (\n value instanceof URL ||\n value instanceof ArrayBuffer ||\n ArrayBuffer.isView(value) ||\n (typeof Blob !== \"undefined\" && value instanceof Blob)\n ) {\n return true\n }\n if (seen.has(value)) return false\n seen.add(value)\n\n if (!Array.isArray(value)) {\n const type = Reflect.get(value, \"type\")\n if (\n type === \"image\" ||\n type === \"file\" ||\n type === \"reasoning-file\" ||\n type === \"custom\" ||\n type === \"provider-state\"\n ) {\n return true\n }\n }\n\n return Object.values(value).some((entry) => containsNonTextInput(entry, seen))\n}\n",
|
|
6
6
|
"import { isSixbError } from \"../../errors/internal\"\n\n/** A provider call was not recorded synchronously, so its execution must stop. */\nexport class ModelUsageRecordingError extends Error {\n readonly name = \"ModelUsageRecordingError\"\n\n constructor(\n readonly executionId: string,\n readonly callId: string,\n readonly recoveryScheduled: boolean,\n options?: ErrorOptions\n ) {\n super(\n recoveryScheduled\n ? `[SixbModels] AI usage for call '${callId}' in execution '${executionId}' was deferred to durable recovery.`\n : `[SixbModels] Could not preserve AI usage for call '${callId}' in execution '${executionId}'.`,\n options\n )\n }\n}\n\n/**\n * A model call refused or left unrecorded by the run's accounting: its AI limits refused it, or its\n * record could not be written. The run ends with this failure, never one that relabels it.\n */\nexport function isModelCallAccountingFailure(error: unknown): boolean {\n return (\n error instanceof ModelUsageRecordingError ||\n (isSixbError(error) &&\n (error.code === \"ai.usage_limit_exceeded\" || error.code === \"ai.usage_limit_unavailable\"))\n )\n}\n",
|
|
7
7
|
"import { ModelStreamError } from \"./errors\"\nimport type {\n LanguageModelStreamEvent,\n ModelCallEndEvent,\n ModelProviderIds,\n ModelRoute,\n ModelUsage,\n} from \"./events\"\nimport type {\n LanguageModel,\n LanguageModelRequest,\n LanguageModelStream,\n ModelReasoning,\n} from \"./language-model\"\nimport {\n estimateModelCall,\n type ModelCallCost,\n type ModelReportedCost,\n rateModelCall,\n} from \"./pricing\"\n\n/**\n * What a language model call's stream says about the call: who served it, what it used and what\n * the provider charged. Only its `finish` event settles the meters, so a call that ends without one\n * is recorded with its usage unknown.\n */\nexport class LanguageModelCallMeter {\n private usage: ModelUsage = {}\n private responseId: string | undefined\n private providerIds: ModelProviderIds | undefined\n private responseModelId: string | undefined\n private reportedCost: ModelReportedCost | undefined\n private route: ModelRoute | undefined\n private settled = false\n\n /** Whether the stream finished, so its meters are final. */\n get finished(): boolean {\n return this.settled\n }\n\n accept(event: LanguageModelStreamEvent): void {\n if (event.type === \"response-metadata\") {\n this.responseId = event.id ?? this.responseId\n if (event.providerIds) this.providerIds = { ...this.providerIds, ...event.providerIds }\n this.responseModelId = event.modelId ?? this.responseModelId\n } else if (event.type === \"finish\") {\n this.settled = true\n this.usage = event.usage\n this.reportedCost = event.reportedCost\n this.route = event.route\n }\n }\n\n /** The meters as the stream reported them. */\n facts() {\n return {\n usage: this.usage,\n ...(this.responseId === undefined ? {} : { responseId: this.responseId }),\n ...(this.providerIds === undefined ? {} : { providerIds: this.providerIds }),\n ...(this.responseModelId === undefined ? {} : { responseModelId: this.responseModelId }),\n ...(this.reportedCost === undefined ? {} : { reportedCost: this.reportedCost }),\n ...(this.route === undefined ? {} : { route: this.route }),\n }\n }\n\n /**\n * How the call ended, as it is recorded: rated from the provider's charge when it reported one,\n * else estimated from the model's rate card. An unfinished call's usage stays unknown, never free.\n */\n end(call: {\n readonly model: Pick<LanguageModel, \"providerId\" | \"modelId\" | \"costEstimator\">\n readonly callId: string\n readonly requestedReasoning?: ModelReasoning\n }): ModelCallEndEvent {\n const facts = this.facts()\n const estimate: ModelCallCost = this.settled\n ? estimateModelCall(call.model, facts)\n : { status: \"unpriceable\", reason: \"missing-usage\" }\n const cost = facts.reportedCost\n ? rateModelCall({ usage: facts.usage, reported: facts.reportedCost })\n : estimate\n return {\n callId: call.callId,\n modelKind: \"language\",\n providerId: call.model.providerId,\n modelId: call.model.modelId,\n responseId: facts.responseId ?? `${call.callId}:response`,\n providerIds: facts.providerIds,\n responseModelId: facts.responseModelId,\n usage: facts.usage,\n cost,\n ...(facts.reportedCost === undefined ? {} : { estimate }),\n ...(call.requestedReasoning === undefined\n ? {}\n : { requestedReasoning: call.requestedReasoning }),\n ...(facts.route === undefined ? {} : { route: facts.route }),\n }\n }\n}\n\n/**\n * A call whose provider sends nothing for this long fails, its usage recorded unknown. A model\n * thinking at length still streams: providers keep a reasoning stream alive with events.\n */\nexport const MODEL_CALL_IDLE_MS = 10 * 60_000\n\n/**\n * The model, with each call it makes reported once as it ends: when it finishes, before its\n * `finish` event reaches the reader, or however it ends instead, its usage then unknown: failed,\n * silent past {@link MODEL_CALL_IDLE_MS}, or let go by its reader, even before its first event. A\n * call is reported by the model that served it, never by whoever reads its stream.\n */\nexport function reportModelCalls(\n model: LanguageModel,\n onEnd: (event: ModelCallEndEvent) => void | Promise<void>\n): LanguageModel {\n const { providerId, modelId, definition, costEstimator, rateCard } = model\n const { defaultReasoning, maxOutputTokens } = model\n // Read and bound once: a provider's model keeps its state in private fields.\n return {\n providerId,\n modelId,\n definition,\n ...(costEstimator === undefined ? {} : { costEstimator }),\n ...(rateCard === undefined ? {} : { rateCard }),\n ...(defaultReasoning === undefined ? {} : { defaultReasoning }),\n ...(maxOutputTokens === undefined ? {} : { maxOutputTokens }),\n ...(model.validateResponseFormat === undefined\n ? {}\n : { validateResponseFormat: model.validateResponseFormat.bind(model) }),\n stream: async (request) => {\n // Aborted once the provider goes silent, or the reader lets the call go.\n const stop = new AbortController()\n const opening = model.stream({\n ...request,\n signal: AbortSignal.any([request.signal, stop.signal]),\n })\n // A response that never comes is not a call: nothing was accepted, so nothing is reported.\n const opened = await withinIdle(opening, stop, (late) => closeEvents(late.events))\n return { ...opened, events: reportedEvents(model, request, opened, stop, onEnd) }\n },\n }\n}\n\nfunction reportedEvents(\n model: LanguageModel,\n request: LanguageModelRequest,\n stream: LanguageModelStream,\n stop: AbortController,\n onEnd: (event: ModelCallEndEvent) => void | Promise<void>\n): AsyncIterable<LanguageModelStreamEvent> {\n const meter = new LanguageModelCallMeter()\n let reported: Promise<void> | undefined\n // Once accepted, a call is reported exactly once, however it ends.\n const report = () => {\n reported ??= (async () =>\n onEnd(\n meter.end({\n model,\n callId: request.callId,\n ...(request.reasoning === undefined ? {} : { requestedReasoning: request.reasoning }),\n })\n ))()\n return reported\n }\n let source: AsyncIterator<LanguageModelStreamEvent> | undefined\n let done = false\n\n // An iterator of its own, not a generator: a generator's `finally` never runs for a reader that\n // lets go before its first `next()`, so that call would go unreported.\n const events: AsyncIterator<LanguageModelStreamEvent> = {\n async next() {\n if (done) return { done: true, value: undefined }\n source ??= stream.events[Symbol.asyncIterator]()\n let result: IteratorResult<LanguageModelStreamEvent>\n try {\n result = await withinIdle(source.next(), stop)\n } catch (error) {\n done = true\n if (stop.signal.aborted) closeEvents(source)\n await report()\n throw error\n }\n if (result.done) {\n done = true\n await report()\n return result\n }\n meter.accept(result.value)\n if (result.value.type === \"finish\") await report()\n return result\n },\n async return(value) {\n done = true\n if (!reported) stop.abort(new DOMException(\"The reader let the model call go.\", \"AbortError\"))\n if (source) closeEvents(source)\n else closeEvents(stream.events)\n try {\n await report()\n } catch (error) {\n // Thrown to a reader that broke off, but lost on one that threw: say it here too.\n console.error(\n `[SixbModels] Model call '${request.callId}' ended early, and recording it failed.`,\n error\n )\n throw error\n }\n return { done: true, value }\n },\n }\n return { [Symbol.asyncIterator]: () => events }\n}\n\n/** Settle with `pending`, or fail once the provider has been silent for {@link MODEL_CALL_IDLE_MS}. */\nasync function withinIdle<T>(\n pending: Promise<T>,\n stop: AbortController,\n onLate?: (value: T) => void\n): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined\n const silence = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n const error = new ModelStreamError(\n `[SixbModels] The model sent nothing for ${MODEL_CALL_IDLE_MS / 60_000} minutes.`\n )\n // A provider that honors its signal stops; one that does not is left behind.\n stop.abort(error)\n reject(error)\n }, MODEL_CALL_IDLE_MS)\n })\n try {\n return await Promise.race([pending, silence])\n } finally {\n clearTimeout(timer)\n if (stop.signal.aborted) pending.then(onLate, () => {})\n }\n}\n\n/** Close a provider's stream without waiting on it: one that ignores its signal may never settle. */\nfunction closeEvents(\n events: AsyncIterable<LanguageModelStreamEvent> | AsyncIterator<LanguageModelStreamEvent>\n): void {\n const iterator = Symbol.asyncIterator in events ? events[Symbol.asyncIterator]() : events\n void Promise.resolve()\n .then(() => iterator.return?.())\n .catch(() => {})\n}\n",
|
|
8
8
|
"import { createHash } from \"node:crypto\"\nimport { assertJsonObject } from \"../../json\"\nimport type {\n AiBillableMeter,\n AiCostStorage,\n AiLimitStorage,\n AiModelCallCostRecord,\n AiModelCallUsageRecord,\n AiPricingContext,\n AiUsageStorage,\n RecordAiModelCallResult,\n Storage,\n} from \"../../storage\"\nimport {\n aiModelCallCostMatchesUsage,\n normalizeAiModelCallCostRecord,\n} from \"../../storage/ai-cost/provider\"\nimport { normalizeAiModelCallRecord } from \"../../storage/ai-usage/record\"\nimport type { ModelCostEstimate } from \"../pricing\"\nimport type { ModelCallAccountingStorage, RecoverAiModelCallInput } from \"./types\"\n\ninterface RecordAiModelCallAccountingInput extends RecoverAiModelCallInput {\n readonly storage: Pick<ModelCallAccountingStorage, \"transaction\">\n}\n\ninterface AiAccountingCapabilities {\n readonly aiUsage: AiUsageStorage\n readonly aiCosts: AiCostStorage\n readonly aiLimits: AiLimitStorage\n}\n\n/** Atomically append one provider call's usage and the valuation captured by the model runtime. */\nexport async function recordAiModelCallAccounting(\n input: RecordAiModelCallAccountingInput\n): Promise<RecordAiModelCallResult> {\n return input.storage.transaction(async (tx) => {\n const { aiUsage, aiCosts, aiLimits } = requireAccountingCapabilities(tx)\n const usage = await aiUsage.recordModelCall(input.usage)\n // Usage deduplicates provider lifecycle replays by execution/call identity. Always attach the\n // valuation to the canonical row it returns, not the fresh candidate ID from a replay.\n const canonical = normalizeModelCallAccounting({\n ...input,\n usage: usage.record,\n ratedAt: usage.record.recordedAt,\n })\n const record = modelCostRecord(canonical, usage.record.id)\n const estimate =\n canonical.cost.status !== \"reported\" || canonical.estimate === undefined\n ? undefined\n : modelCostRecord({ ...canonical, cost: canonical.estimate }, usage.record.id)\n await aiCosts.recordModelCallCost({\n ...record,\n ...(estimate === undefined\n ? {}\n : {\n estimate:\n estimate.status === \"rated\"\n ? { status: \"rated\", money: estimate.money, components: estimate.components }\n : {\n status: \"unpriceable\",\n reason: estimate.reason,\n ...(estimate.missingMeters === undefined\n ? {}\n : { missingMeters: estimate.missingMeters }),\n },\n }),\n })\n if (usage.created) {\n await aiLimits.recordModelCallActuals({\n projectId: usage.record.projectId,\n usageRecordId: usage.record.id,\n recordedAt: input.ratedAt,\n })\n }\n if (input.reconcileLimitReservation) {\n await aiLimits.reconcileModelCall({\n projectId: usage.record.projectId,\n executionId: usage.record.executionId,\n attempt: usage.record.attempt,\n callId: usage.record.callId,\n usageRecordId: usage.record.id,\n reconciledAt: input.ratedAt,\n })\n }\n return usage\n })\n}\n\n/** Sanitize optional enrichment before either persistence or a JSON-safe recovery handoff. */\nexport function normalizeModelCallAccounting(\n input: RecoverAiModelCallInput\n): RecoverAiModelCallInput {\n const usage = normalizeAiModelCallRecord(input.usage)\n return {\n ...input,\n cost:\n input.cost.status === \"reported\" ? input.cost : validatedEstimate(input.cost, input, usage),\n ...(input.estimate === undefined\n ? {}\n : { estimate: validatedEstimate(input.estimate, input, usage) }),\n }\n}\n\nfunction validatedEstimate(\n cost: ModelCostEstimate,\n input: RecoverAiModelCallInput,\n usage: AiModelCallUsageRecord\n): ModelCostEstimate {\n try {\n assertJsonObject(cost, \"model cost estimate\")\n const record = normalizeAiModelCallCostRecord(modelCostRecord({ ...input, cost }, usage.id))\n if (!aiModelCallCostMatchesUsage(record, usage)) {\n throw new TypeError(\"Estimate quantities do not match recorded usage.\")\n }\n return structuredClone(cost)\n } catch {\n console.warn(\n \"[SixbModels] Invalid model cost estimate; preserving call usage and provider cost.\"\n )\n return { status: \"unpriceable\", reason: \"inconsistent-usage\" }\n }\n}\n\nfunction modelCostRecord(\n input: RecoverAiModelCallInput,\n usageRecordId: string\n): AiModelCallCostRecord {\n const billingIdentity = {\n providerId: input.usage.providerId,\n modelId: input.usage.requestedModelId,\n }\n const pricingContext: AiPricingContext = {\n ...(input.route?.providerId === undefined ? {} : { routedProviderId: input.route.providerId }),\n ...(input.route?.modelId === undefined ? {} : { routedModelId: input.route.modelId }),\n }\n if (input.cost.status === \"reported\" || input.cost.status === \"rated\") {\n return {\n projectId: input.usage.projectId,\n usageRecordId,\n status: \"rated\",\n billingIdentity,\n pricingContext,\n priceSource: costPriceSource(input.usage, input.cost),\n money: input.cost.money,\n components: input.cost.status === \"rated\" ? input.cost.components : [],\n ratedAt: new Date(input.ratedAt),\n }\n }\n\n const reason =\n input.cost.reason === \"missing-rate-card\"\n ? \"missingRateCard\"\n : input.cost.reason === \"missing-usage\"\n ? \"missingUsageMeter\"\n : input.cost.reason === \"unsupported-pricing-dimension\"\n ? \"unsupportedPricingDimension\"\n : \"invalidUsageForFormula\"\n const missingMeters =\n reason === \"missingUsageMeter\" ? normalizeMissingMeters(input.cost.missingMeters) : undefined\n return {\n projectId: input.usage.projectId,\n usageRecordId,\n status: \"unpriceable\",\n billingIdentity,\n pricingContext,\n reason,\n ...(missingMeters === undefined ? {} : { missingMeters }),\n ratedAt: new Date(input.ratedAt),\n }\n}\n\nfunction costPriceSource(\n usage: RecoverAiModelCallInput[\"usage\"],\n cost: Extract<RecoverAiModelCallInput[\"cost\"], { status: \"reported\" | \"rated\" }>\n) {\n if (cost.status === \"reported\") {\n return {\n sourceId: \"provider-reported\",\n sourceEntryId: `${usage.providerId}/${usage.responseId}`,\n sourceVersion: \"response-v1\",\n observedAt: new Date(usage.occurredAt),\n }\n }\n const rates = cost.components.map(({ meter, rateAmountNanosPerMillion }) => ({\n meter,\n rateAmountNanosPerMillion,\n }))\n const version = createHash(\"sha256\").update(JSON.stringify(rates)).digest(\"hex\")\n return {\n sourceId: \"model-rate-card\",\n sourceEntryId: `${usage.providerId}/${usage.requestedModelId}`,\n sourceVersion: `sha256:${version}`,\n observedAt: new Date(usage.occurredAt),\n }\n}\n\nfunction normalizeMissingMeters(\n meters: Extract<RecoverAiModelCallInput[\"cost\"], { status: \"unpriceable\" }>[\"missingMeters\"]\n): readonly AiBillableMeter[] {\n const fallback: readonly AiBillableMeter[] = [\"tokens.input.total\", \"tokens.output.total\"]\n return [...new Set<AiBillableMeter>(meters ?? fallback)]\n}\n\nexport function requireAccountingCapabilities(\n storage: Pick<Storage, \"aiUsage\" | \"aiCosts\" | \"aiLimits\">\n): AiAccountingCapabilities {\n if (!storage.aiUsage || !storage.aiCosts || !storage.aiLimits) {\n throw new Error(\n \"[SixbModels] AI model-call accounting requires storage.aiUsage, storage.aiCosts, and storage.aiLimits.\"\n )\n }\n return { aiUsage: storage.aiUsage, aiCosts: storage.aiCosts, aiLimits: storage.aiLimits }\n}\n",
|
|
9
|
-
"import { isSixbError } from \"../../errors/internal\"\nimport type { AuthorizablePrincipal } from \"../../execution\"\nimport
|
|
10
|
-
"import { randomUUID } from \"node:crypto\"\nimport type { FileRef } from \"../../blob-storage/types\"\nimport {\n AiUsageStorageError,\n type ReadonlyJsonObject,\n type RecordAiModelCallInput,\n} from \"../../storage\"\nimport type { ModelCallEndEvent, ModelUsage } from \"../events\"\nimport { reportModelCalls } from \"../language-call\"\nimport type { LanguageModel } from \"../language-model\"\nimport { ModelUsageRecordingError } from \"./errors\"\nimport {\n normalizeModelCallAccounting,\n recordAiModelCallAccounting,\n requireAccountingCapabilities,\n} from \"./model-call-accounting\"\nimport {\n type AiModelCallAdmissionInput,\n aiModelCallOutputTokenAllowance,\n estimateAiModelCallInputTokens,\n estimatedAiModelCallTotalTokens,\n} from \"./model-call-admission\"\nimport type { AiModelCallLimitController } from \"./model-call-limits\"\nimport { isPermanentAiUsageRecoveryError } from \"./model-call-recovery\"\nimport type {\n ModelCallAccountingStorage,\n RecoverAiModelCall,\n RecoverAiModelCallInput,\n} from \"./types\"\nimport { aiModelCallUsageFromModel } from \"./usage\"\n\nconst STORAGE_RETRY_DELAYS_MS = [50, 200, 600] as const\n\nexport interface AiModelCallRecorderInput {\n readonly storage: ModelCallAccountingStorage\n readonly projectId: string\n readonly executionId: string\n readonly attempt: number\n readonly requesterGroupIds: readonly string[]\n readonly limits: AiModelCallLimitController\n readonly recoverAiModelCall: RecoverAiModelCall\n}\n\ninterface AiModelCallRecorderInternals {\n readonly generateId?: () => string\n readonly now?: () => Date\n readonly retryDelaysMs?: readonly number[]\n readonly sleep?: (ms: number) => Promise<void>\n readonly recordAccounting?: (input: RecoverAiModelCallInput) => Promise<void>\n}\n\n/** Admit every model call against the execution's limits, and record each before it is over. */\nexport class AiModelCallRecorder {\n private readonly generateId: () => string\n private readonly now: () => Date\n private readonly retryDelaysMs: readonly number[]\n private readonly sleep: (ms: number) => Promise<void>\n private readonly recordAccounting: (input: RecoverAiModelCallInput) => Promise<void>\n private readonly reservations = new Set<string>()\n private admissionError: unknown\n private recordingError: ModelUsageRecordingError | undefined\n /** When the last call it recorded ended, in milliseconds. */\n private lastOccurredAt = Number.NEGATIVE_INFINITY\n\n constructor(\n private readonly input: AiModelCallRecorderInput,\n internals: AiModelCallRecorderInternals = {}\n ) {\n requireAccountingCapabilities(input.storage)\n this.generateId = internals.generateId ?? (() => `ai_usage_${randomUUID()}`)\n this.now = internals.now ?? (() => new Date())\n this.retryDelaysMs = internals.retryDelaysMs ?? STORAGE_RETRY_DELAYS_MS\n this.sleep = internals.sleep ?? sleep\n this.recordAccounting =\n internals.recordAccounting ??\n (async (recovery) => {\n await recordAiModelCallAccounting({ storage: this.input.storage, ...recovery })\n })\n }\n\n /** The execution every call this recorder admits is attributed to. */\n get executionId(): string {\n return this.input.executionId\n }\n\n /** The execution attempt every call this recorder admits is attributed to. */\n get attempt(): number {\n return this.input.attempt\n }\n\n /**\n * Wrap the resolved model so every call it makes is admitted against the execution's limits and\n * records itself: the wrapper reads the stream it hands on, and records the call when it finishes,\n * before its `finish` event reaches the reader, or when it ends otherwise, its usage unknown. Who\n * reads the stream never reports what the call used.\n */\n wrapModel(model: LanguageModel): LanguageModel {\n const recorded = reportModelCalls(model, this.onModelCallEnd)\n // Its settings carried over, which whoever calls the model reads.\n return {\n ...recorded,\n stream: async (request) => {\n this.assertHealthy()\n const inputTokens = estimateAiModelCallInputTokens({\n prompt: request.messages,\n tools: request.tools,\n responseFormat: request.responseFormat,\n })\n const outputTokenAllowance = aiModelCallOutputTokenAllowance(request.maxOutputTokens)\n await this.admitCall({\n callId: request.callId,\n providerId: model.providerId,\n modelId: model.modelId,\n costEstimator: model.costEstimator,\n inputTokens,\n outputTokenAllowance,\n estimatedTotalTokens: estimatedAiModelCallTotalTokens(inputTokens, outputTokenAllowance),\n })\n try {\n return await recorded.stream(request)\n } catch (error) {\n await this.markCallUnknown(request.callId)\n throw error\n }\n },\n }\n }\n\n /** Admit one provider attempt, independently of its language or embedding protocol. */\n async admitCall(\n call: Omit<\n AiModelCallAdmissionInput,\n \"projectId\" | \"executionId\" | \"attempt\" | \"requesterGroupIds\"\n >\n ): Promise<void> {\n this.assertHealthy()\n try {\n const decision = await this.input.limits.beforeModelCall({\n ...call,\n projectId: this.input.projectId,\n executionId: this.input.executionId,\n attempt: this.input.attempt,\n requesterGroupIds: this.input.requesterGroupIds,\n })\n if (decision.reservation === \"active\") this.reservations.add(call.callId)\n } catch (error) {\n // Execution boundaries must retain the original coded admission failure.\n this.admissionError = error\n throw error\n }\n }\n\n /** Keep an unresolved reservation when an attempted call's billable outcome is unknown. */\n async markCallUnknown(callId: string): Promise<void> {\n if (!this.reservations.has(callId)) return\n await this.input.limits.markModelCallUnknown({\n projectId: this.input.projectId,\n executionId: this.input.executionId,\n attempt: this.input.attempt,\n callId,\n })\n }\n\n readonly onModelCallEnd = async (event: ModelCallEndEvent): Promise<void> => {\n // Calls already in flight still need their own accounting after another call fails.\n // Only admission is gated by the execution's sticky failure.\n try {\n // Each call ends after the one recorded before it, by a millisecond at least: the latest\n // call of an execution, which an agent's next turn anchors its estimate on, is the one that\n // ended last, even when two end within the same millisecond.\n const occurredAt = new Date(Math.max(this.now().getTime(), this.lastOccurredAt + 1))\n this.lastOccurredAt = occurredAt.getTime()\n const record: RecordAiModelCallInput = {\n id: this.generateId(),\n projectId: this.input.projectId,\n executionId: this.input.executionId,\n attempt: this.input.attempt,\n callId: event.callId,\n requesterGroupIds: this.input.requesterGroupIds,\n providerId: event.providerId,\n ...(event.providerIds === undefined ? {} : { providerIds: event.providerIds }),\n requestedModelId: event.modelId,\n ...(event.modelKind === undefined ? {} : { modelKind: event.modelKind }),\n ...(event.requestedReasoning === undefined\n ? {}\n : { requestedReasoning: event.requestedReasoning }),\n ...(event.responseModelId === undefined ? {} : { responseModelId: event.responseModelId }),\n responseId: event.responseId,\n usage: aiModelCallUsageFromModel(event.usage),\n ...(event.usage.raw === undefined ? {} : { rawUsage: rawUsage(event.usage) }),\n occurredAt,\n }\n const recoveryInput = normalizeModelCallAccounting({\n usage: record,\n cost: event.cost,\n ...(event.estimate === undefined ? {} : { estimate: event.estimate }),\n ...(event.route === undefined ? {} : { route: event.route }),\n ratedAt: new Date(occurredAt),\n ...(this.reservations.has(event.callId) ? { reconcileLimitReservation: true } : {}),\n })\n\n try {\n await retryOperation(\n () => this.recordAccounting(recoveryInput),\n this.retryDelaysMs,\n this.sleep,\n (error) => !isPermanentAiUsageRecoveryError(error)\n )\n } catch (storageError) {\n if (isPermanentAiUsageRecoveryError(storageError)) throw storageError\n\n try {\n await retryOperation(\n () => this.input.recoverAiModelCall(recoveryInput),\n this.retryDelaysMs,\n this.sleep,\n (error) => !isPermanentAiUsageRecoveryError(error)\n )\n } catch (recoveryError) {\n throw new AggregateError(\n [storageError, recoveryError],\n \"Direct AI accounting and durable recovery both failed.\"\n )\n }\n throw new ModelUsageRecordingError(this.input.executionId, event.callId, true, {\n cause: storageError,\n })\n }\n } catch (error) {\n const recordingError =\n error instanceof ModelUsageRecordingError\n ? error\n : new ModelUsageRecordingError(this.input.executionId, event.callId, false, {\n cause: error,\n })\n this.recordingError ??= recordingError\n throw recordingError\n }\n }\n\n /** Record the files a completed call produced; the call's readers download them through it. */\n async recordFiles(callId: string, files: readonly FileRef[]): Promise<void> {\n try {\n await retryOperation(\n () =>\n this.input.storage.aiUsage.recordModelCallFiles({\n projectId: this.input.projectId,\n executionId: this.input.executionId,\n callId,\n files,\n }),\n this.retryDelaysMs,\n this.sleep,\n (error) => !(error instanceof TypeError || error instanceof AiUsageStorageError)\n )\n } catch (error) {\n throw new Error(\n `[SixbModels] Model call '${callId}' completed, but its files could not be recorded.`,\n { cause: error }\n )\n }\n }\n\n assertHealthy(): void {\n if (this.admissionError !== undefined) throw this.admissionError\n if (this.recordingError) throw this.recordingError\n }\n}\n\nfunction rawUsage(usage: ModelUsage): ReadonlyJsonObject {\n return structuredClone(usage.raw ?? {})\n}\n\nasync function retryOperation<TResult>(\n operation: () => Promise<TResult>,\n retryDelaysMs: readonly number[],\n wait: (ms: number) => Promise<void>,\n shouldRetry: (error: unknown) => boolean\n): Promise<TResult> {\n for (let attempt = 0; ; attempt += 1) {\n try {\n return await operation()\n } catch (error) {\n if (!shouldRetry(error)) throw error\n const delay = retryDelaysMs[attempt]\n if (delay === undefined) throw error\n await wait(delay)\n }\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n",
|
|
11
|
-
"import type { AiModelCallUsageInput } from \"../../storage\"\nimport type { ModelUsage } from \"../events\"\n\n/** Map one provider-neutral model call into Sixb's durable accounting vocabulary. */\nexport function aiModelCallUsageFromModel(usage: ModelUsage): AiModelCallUsageInput {\n return {\n ...(usage.audioDurationMs === undefined ? {} : { audioDurationMs: usage.audioDurationMs }),\n ...(usage.inputTokens === undefined ? {} : { inputTokens: usage.inputTokens }),\n ...(usage.outputTokens === undefined ? {} : { outputTokens: usage.outputTokens }),\n ...(usage.uncachedInputTokens === undefined\n ? {}\n : { uncachedInputTokens: usage.uncachedInputTokens }),\n ...(usage.cacheReadInputTokens === undefined\n ? {}\n : { cacheReadInputTokens: usage.cacheReadInputTokens }),\n ...(usage.cacheWriteInputTokens === undefined\n ? {}\n : { cacheWriteInputTokens: usage.cacheWriteInputTokens }),\n ...(usage.textOutputTokens === undefined ? {} : { textOutputTokens: usage.textOutputTokens }),\n ...(usage.reasoningOutputTokens === undefined\n ? {}\n : { reasoningOutputTokens: usage.reasoningOutputTokens }),\n ...(usage.imageOutputTokens === undefined\n ? {}\n : { imageOutputTokens: usage.imageOutputTokens }),\n ...(usage.audioOutputTokens === undefined\n ? {}\n : { audioOutputTokens: usage.audioOutputTokens }),\n ...(usage.outputImages === undefined ? {} : { outputImages: usage.outputImages }),\n ...(usage.inputCharacters === undefined ? {} : { inputCharacters: usage.inputCharacters }),\n }\n}\n",
|
|
9
|
+
"import { isSixbError } from \"../../errors/internal\"\nimport type { AuthorizablePrincipal } from \"../../execution\"\nimport {\n type AiLimitPolicy,\n type AiLimitQuantity,\n AiLimitStorageError,\n type AiModelCallReservationIdentity,\n type ReserveAiModelCallResult,\n} from \"../../storage\"\nimport {\n aiLimitSubjectsFromAttribution,\n aiUsageLimitExceededError,\n aiUsageLimitUnavailableError,\n applicableAiLimitPolicies,\n} from \"../../storage/ai-limits/enforcement\"\nimport { aiLimitMeterApplies } from \"../../storage/ai-limits/provider\"\nimport type {\n AiModelCallAdmissionDecision,\n AiModelCallAdmissionInput,\n BeforeAiModelCall,\n MarkAiModelCallUnknown,\n} from \"./model-call-admission\"\nimport type { ModelCallAccountingStorage } from \"./types\"\n\nexport interface AiModelCallLimitController {\n readonly beforeModelCall: BeforeAiModelCall\n readonly markModelCallUnknown: MarkAiModelCallUnknown\n}\n\n/** Build the reservation lifecycle for model calls from any execution. */\nexport function createAiModelCallLimitController(input: {\n readonly storage: Pick<ModelCallAccountingStorage, \"aiLimits\">\n readonly projectId: string\n readonly requestedBy?: AuthorizablePrincipal\n readonly requesterGroupIds: readonly string[]\n}): AiModelCallLimitController {\n const subjects = aiLimitSubjectsFromAttribution(input.requestedBy, input.requesterGroupIds)\n\n return {\n beforeModelCall: async (admission) => {\n let applicable: readonly AiLimitPolicy[]\n try {\n const policies = await input.storage.aiLimits.listPolicies({\n projectId: input.projectId,\n })\n applicable = applicableAiLimitPolicies(policies, subjects).filter((policy) =>\n aiLimitMeterApplies(policy.limit.meter, admission.modelKind)\n )\n } catch (error) {\n throw limitStorageUnavailable(error)\n }\n // This read is the fast no-policy path. A concurrently created policy linearizes after it;\n // every later call will see it, while existing policies always continue to atomic reserve.\n if (applicable.length === 0) return { reservation: \"none\" }\n\n const estimates = reservationEstimates(\n admission,\n applicable.some((policy) => policy.limit.meter === \"cost.catalogEstimated\")\n )\n if (estimates.length === 0) {\n throw aiUsageLimitUnavailableError([\"missingEstimate\"])\n }\n\n let result: ReserveAiModelCallResult\n try {\n result = await input.storage.aiLimits.reserveModelCall({\n ...reservationIdentity(admission),\n subjects,\n estimates,\n ...(admission.modelKind === undefined ? {} : { modelKind: admission.modelKind }),\n })\n } catch (error) {\n throw limitStorageUnavailable(error)\n }\n switch (result.status) {\n case \"reserved\":\n return { reservation: \"active\" } satisfies AiModelCallAdmissionDecision\n case \"notRequired\":\n return { reservation: \"none\" } satisfies AiModelCallAdmissionDecision\n case \"denied\":\n throw aiUsageLimitExceededError(result.resetAt)\n case \"unavailable\":\n throw aiUsageLimitUnavailableError(result.reasons)\n case \"terminal\":\n throw aiUsageLimitUnavailableError([\"terminalReservationReplay\"])\n }\n },\n markModelCallUnknown: async (identity) => {\n try {\n await input.storage.aiLimits.markReservationUnknown(identity)\n } catch (error) {\n // Recording the call already reconciled the reservation: its outcome is known, and the\n // store is not unavailable. The caller decides what that means for the call.\n if (error instanceof AiLimitStorageError && error.code === \"invalid_reservation_state\") {\n throw error\n }\n throw limitStorageUnavailable(error)\n }\n },\n }\n}\n\nfunction reservationEstimates(\n input: AiModelCallAdmissionInput,\n needsCost: boolean\n): readonly AiLimitQuantity[] {\n const estimates: AiLimitQuantity[] = []\n if (input.inputTokens.status === \"estimated\" && input.estimatedTotalTokens !== undefined) {\n estimates.push({ meter: \"tokens.total\", amount: input.estimatedTotalTokens })\n }\n\n if (needsCost) {\n try {\n let money = input.reservationCost\n if (money == null && input.inputTokens.status === \"estimated\") {\n money = input.costEstimator?.estimateReservation?.({\n inputTokens: input.inputTokens.tokens,\n outputTokens: input.outputTokenAllowance,\n })\n }\n\n if (money) {\n estimates.push({ meter: \"cost.catalogEstimated\", amount: money })\n }\n } catch {\n // An unavailable price must not prevent a token-only policy from being evaluated.\n return estimates\n }\n }\n\n return estimates\n}\n\nfunction reservationIdentity(input: AiModelCallAdmissionInput): AiModelCallReservationIdentity {\n return {\n projectId: input.projectId,\n executionId: input.executionId,\n attempt: input.attempt,\n callId: input.callId,\n }\n}\n\nfunction limitStorageUnavailable(error: unknown): unknown {\n if (\n isSixbError(error) &&\n (error.code === \"ai.usage_limit_exceeded\" || error.code === \"ai.usage_limit_unavailable\")\n ) {\n return error\n }\n return aiUsageLimitUnavailableError([\"limitStorageUnavailable\"])\n}\n",
|
|
10
|
+
"import { randomUUID } from \"node:crypto\"\nimport type { FileRef } from \"../../blob-storage/types\"\nimport {\n AiUsageStorageError,\n type ReadonlyJsonObject,\n type RecordAiModelCallInput,\n} from \"../../storage\"\nimport type { ModelCallEndEvent, ModelUsage } from \"../events\"\nimport { reportModelCalls } from \"../language-call\"\nimport type { LanguageModel } from \"../language-model\"\nimport { ModelUsageRecordingError } from \"./errors\"\nimport {\n normalizeModelCallAccounting,\n recordAiModelCallAccounting,\n requireAccountingCapabilities,\n} from \"./model-call-accounting\"\nimport {\n type AiModelCallAdmissionInput,\n aiModelCallOutputTokenAllowance,\n estimateAiModelCallInputTokens,\n estimatedAiModelCallTotalTokens,\n} from \"./model-call-admission\"\nimport type { AiModelCallLimitController } from \"./model-call-limits\"\nimport { isPermanentAiUsageRecoveryError } from \"./model-call-recovery\"\nimport type {\n ModelCallAccountingStorage,\n RecoverAiModelCall,\n RecoverAiModelCallInput,\n} from \"./types\"\nimport { aiModelCallUsageFromModel } from \"./usage\"\n\nconst STORAGE_RETRY_DELAYS_MS = [50, 200, 600] as const\n\nexport interface AiModelCallRecorderInput {\n readonly storage: ModelCallAccountingStorage\n readonly projectId: string\n readonly executionId: string\n readonly attempt: number\n readonly requesterGroupIds: readonly string[]\n readonly limits: AiModelCallLimitController\n readonly recoverAiModelCall: RecoverAiModelCall\n}\n\ninterface AiModelCallRecorderInternals {\n readonly generateId?: () => string\n readonly now?: () => Date\n readonly retryDelaysMs?: readonly number[]\n readonly sleep?: (ms: number) => Promise<void>\n readonly recordAccounting?: (input: RecoverAiModelCallInput) => Promise<void>\n}\n\n/** Admit every model call against the execution's limits, and record each before it is over. */\nexport class AiModelCallRecorder {\n private readonly generateId: () => string\n private readonly now: () => Date\n private readonly retryDelaysMs: readonly number[]\n private readonly sleep: (ms: number) => Promise<void>\n private readonly recordAccounting: (input: RecoverAiModelCallInput) => Promise<void>\n private readonly reservations = new Set<string>()\n private admissionError: unknown\n private recordingError: ModelUsageRecordingError | undefined\n /** When the last call it recorded ended, in milliseconds. */\n private lastOccurredAt = Number.NEGATIVE_INFINITY\n\n constructor(\n private readonly input: AiModelCallRecorderInput,\n internals: AiModelCallRecorderInternals = {}\n ) {\n requireAccountingCapabilities(input.storage)\n this.generateId = internals.generateId ?? (() => `ai_usage_${randomUUID()}`)\n this.now = internals.now ?? (() => new Date())\n this.retryDelaysMs = internals.retryDelaysMs ?? STORAGE_RETRY_DELAYS_MS\n this.sleep = internals.sleep ?? sleep\n this.recordAccounting =\n internals.recordAccounting ??\n (async (recovery) => {\n await recordAiModelCallAccounting({ storage: this.input.storage, ...recovery })\n })\n }\n\n /** The execution every call this recorder admits is attributed to. */\n get executionId(): string {\n return this.input.executionId\n }\n\n /** The execution attempt every call this recorder admits is attributed to. */\n get attempt(): number {\n return this.input.attempt\n }\n\n /**\n * Wrap the resolved model so every call it makes is admitted against the execution's limits and\n * records itself: the wrapper reads the stream it hands on, and records the call when it finishes,\n * before its `finish` event reaches the reader, or when it ends otherwise, its usage unknown. Who\n * reads the stream never reports what the call used.\n */\n wrapModel(model: LanguageModel): LanguageModel {\n const recorded = reportModelCalls(model, this.onModelCallEnd)\n // Its settings carried over, which whoever calls the model reads.\n return {\n ...recorded,\n stream: async (request) => {\n this.assertHealthy()\n const inputTokens = estimateAiModelCallInputTokens({\n prompt: request.messages,\n tools: request.tools,\n responseFormat: request.responseFormat,\n })\n const outputTokenAllowance = aiModelCallOutputTokenAllowance(request.maxOutputTokens)\n await this.admitCall({\n callId: request.callId,\n providerId: model.providerId,\n modelId: model.modelId,\n costEstimator: model.costEstimator,\n inputTokens,\n outputTokenAllowance,\n estimatedTotalTokens: estimatedAiModelCallTotalTokens(inputTokens, outputTokenAllowance),\n })\n try {\n return await recorded.stream(request)\n } catch (error) {\n await this.markCallUnknown(request.callId)\n throw error\n }\n },\n }\n }\n\n /** Admit one provider attempt, independently of its language or embedding protocol. */\n async admitCall(\n call: Omit<\n AiModelCallAdmissionInput,\n \"projectId\" | \"executionId\" | \"attempt\" | \"requesterGroupIds\"\n >\n ): Promise<void> {\n this.assertHealthy()\n try {\n const decision = await this.input.limits.beforeModelCall({\n ...call,\n projectId: this.input.projectId,\n executionId: this.input.executionId,\n attempt: this.input.attempt,\n requesterGroupIds: this.input.requesterGroupIds,\n })\n if (decision.reservation === \"active\") this.reservations.add(call.callId)\n } catch (error) {\n // Execution boundaries must retain the original coded admission failure.\n this.admissionError = error\n throw error\n }\n }\n\n /** Whether admitting this call reserved budget that recording it must reconcile. */\n hasReservation(callId: string): boolean {\n return this.reservations.has(callId)\n }\n\n /**\n * Take over a call an earlier request of this execution attempt admitted, such as a video the\n * provider kept rendering after that request ended, so that recording its end reconciles the\n * budget it reserved.\n */\n resumeCall(callId: string, reserved: boolean): void {\n if (reserved) this.reservations.add(callId)\n }\n\n /** Keep an unresolved reservation when an attempted call's billable outcome is unknown. */\n async markCallUnknown(callId: string): Promise<void> {\n if (!this.reservations.has(callId)) return\n await this.input.limits.markModelCallUnknown({\n projectId: this.input.projectId,\n executionId: this.input.executionId,\n attempt: this.input.attempt,\n callId,\n })\n }\n\n readonly onModelCallEnd = async (event: ModelCallEndEvent): Promise<void> => {\n // Calls already in flight still need their own accounting after another call fails.\n // Only admission is gated by the execution's sticky failure.\n try {\n // Each call ends after the one recorded before it, by a millisecond at least: the latest\n // call of an execution, which an agent's next turn anchors its estimate on, is the one that\n // ended last, even when two end within the same millisecond.\n const occurredAt = new Date(Math.max(this.now().getTime(), this.lastOccurredAt + 1))\n this.lastOccurredAt = occurredAt.getTime()\n const record: RecordAiModelCallInput = {\n id: this.generateId(),\n projectId: this.input.projectId,\n executionId: this.input.executionId,\n attempt: this.input.attempt,\n callId: event.callId,\n requesterGroupIds: this.input.requesterGroupIds,\n providerId: event.providerId,\n ...(event.providerIds === undefined ? {} : { providerIds: event.providerIds }),\n requestedModelId: event.modelId,\n ...(event.modelKind === undefined ? {} : { modelKind: event.modelKind }),\n ...(event.requestedReasoning === undefined\n ? {}\n : { requestedReasoning: event.requestedReasoning }),\n ...(event.responseModelId === undefined ? {} : { responseModelId: event.responseModelId }),\n responseId: event.responseId,\n usage: aiModelCallUsageFromModel(event.usage),\n ...(event.usage.raw === undefined ? {} : { rawUsage: rawUsage(event.usage) }),\n occurredAt,\n }\n const recoveryInput = normalizeModelCallAccounting({\n usage: record,\n cost: event.cost,\n ...(event.estimate === undefined ? {} : { estimate: event.estimate }),\n ...(event.route === undefined ? {} : { route: event.route }),\n ratedAt: new Date(occurredAt),\n ...(this.reservations.has(event.callId) ? { reconcileLimitReservation: true } : {}),\n })\n\n try {\n await retryOperation(\n () => this.recordAccounting(recoveryInput),\n this.retryDelaysMs,\n this.sleep,\n (error) => !isPermanentAiUsageRecoveryError(error)\n )\n } catch (storageError) {\n if (isPermanentAiUsageRecoveryError(storageError)) throw storageError\n\n try {\n await retryOperation(\n () => this.input.recoverAiModelCall(recoveryInput),\n this.retryDelaysMs,\n this.sleep,\n (error) => !isPermanentAiUsageRecoveryError(error)\n )\n } catch (recoveryError) {\n throw new AggregateError(\n [storageError, recoveryError],\n \"Direct AI accounting and durable recovery both failed.\"\n )\n }\n throw new ModelUsageRecordingError(this.input.executionId, event.callId, true, {\n cause: storageError,\n })\n }\n } catch (error) {\n const recordingError =\n error instanceof ModelUsageRecordingError\n ? error\n : new ModelUsageRecordingError(this.input.executionId, event.callId, false, {\n cause: error,\n })\n this.recordingError ??= recordingError\n throw recordingError\n }\n }\n\n /** Record the files a completed call produced; the call's readers download them through it. */\n async recordFiles(callId: string, files: readonly FileRef[]): Promise<void> {\n try {\n await retryOperation(\n () =>\n this.input.storage.aiUsage.recordModelCallFiles({\n projectId: this.input.projectId,\n executionId: this.input.executionId,\n callId,\n files,\n }),\n this.retryDelaysMs,\n this.sleep,\n (error) => !(error instanceof TypeError || error instanceof AiUsageStorageError)\n )\n } catch (error) {\n throw new Error(\n `[SixbModels] Model call '${callId}' completed, but its files could not be recorded.`,\n { cause: error }\n )\n }\n }\n\n assertHealthy(): void {\n if (this.admissionError !== undefined) throw this.admissionError\n if (this.recordingError) throw this.recordingError\n }\n}\n\nfunction rawUsage(usage: ModelUsage): ReadonlyJsonObject {\n return structuredClone(usage.raw ?? {})\n}\n\nasync function retryOperation<TResult>(\n operation: () => Promise<TResult>,\n retryDelaysMs: readonly number[],\n wait: (ms: number) => Promise<void>,\n shouldRetry: (error: unknown) => boolean\n): Promise<TResult> {\n for (let attempt = 0; ; attempt += 1) {\n try {\n return await operation()\n } catch (error) {\n if (!shouldRetry(error)) throw error\n const delay = retryDelaysMs[attempt]\n if (delay === undefined) throw error\n await wait(delay)\n }\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n",
|
|
11
|
+
"import type { AiModelCallUsageInput } from \"../../storage\"\nimport type { ModelUsage } from \"../events\"\n\n/** Map one provider-neutral model call into Sixb's durable accounting vocabulary. */\nexport function aiModelCallUsageFromModel(usage: ModelUsage): AiModelCallUsageInput {\n return {\n ...(usage.audioDurationMs === undefined ? {} : { audioDurationMs: usage.audioDurationMs }),\n ...(usage.inputTokens === undefined ? {} : { inputTokens: usage.inputTokens }),\n ...(usage.outputTokens === undefined ? {} : { outputTokens: usage.outputTokens }),\n ...(usage.uncachedInputTokens === undefined\n ? {}\n : { uncachedInputTokens: usage.uncachedInputTokens }),\n ...(usage.cacheReadInputTokens === undefined\n ? {}\n : { cacheReadInputTokens: usage.cacheReadInputTokens }),\n ...(usage.cacheWriteInputTokens === undefined\n ? {}\n : { cacheWriteInputTokens: usage.cacheWriteInputTokens }),\n ...(usage.textOutputTokens === undefined ? {} : { textOutputTokens: usage.textOutputTokens }),\n ...(usage.reasoningOutputTokens === undefined\n ? {}\n : { reasoningOutputTokens: usage.reasoningOutputTokens }),\n ...(usage.imageOutputTokens === undefined\n ? {}\n : { imageOutputTokens: usage.imageOutputTokens }),\n ...(usage.audioOutputTokens === undefined\n ? {}\n : { audioOutputTokens: usage.audioOutputTokens }),\n ...(usage.outputImages === undefined ? {} : { outputImages: usage.outputImages }),\n ...(usage.inputCharacters === undefined ? {} : { inputCharacters: usage.inputCharacters }),\n ...(usage.outputVideoMs === undefined ? {} : { outputVideoMs: usage.outputVideoMs }),\n }\n}\n",
|
|
12
12
|
"import type { RecordAiModelCallInput, RecordAiModelCallResult } from \"../../storage\"\nimport { AiCostStorageError, AiLimitStorageError, AiUsageStorageError } from \"../../storage\"\nimport { normalizeAiModelCallRecord } from \"../../storage/ai-usage/record\"\nimport { recordAiModelCallAccounting } from \"./model-call-accounting\"\nimport type {\n AiModelCallAccountingPayload,\n AiModelCallRecordPayload,\n AiModelCallRecoveryRecord,\n ModelCallAccountingStorage,\n RecoverAiModelCallInput,\n} from \"./types\"\nimport { aiModelCallUsageFromModel } from \"./usage\"\n\nclass InvalidAiUsageRecoveryJobError extends Error {\n readonly name = \"InvalidAiUsageRecoveryJobError\"\n\n constructor(message: string, options?: ErrorOptions) {\n super(`[SixbModels] ${message}`, options)\n }\n}\n\n/** Encode one failed accounting transaction for a durable, JSON-safe handoff. */\nexport function modelCallRecoveryPayload(input: RecoverAiModelCallInput): {\n readonly record: AiModelCallRecordPayload\n readonly accounting: AiModelCallAccountingPayload\n} {\n normalizeAiModelCallRecord(input.usage)\n return {\n record: toQueuePayload(input.usage),\n accounting: toAccountingPayload(input),\n }\n}\n\n/** Replay one durable handoff through the idempotent atomic accounting boundary. */\nexport async function recordRecoveredAiModelCall(\n storage: Pick<ModelCallAccountingStorage, \"transaction\">,\n job: AiModelCallRecoveryRecord\n): Promise<RecordAiModelCallResult> {\n const usage = fromQueuePayload(job)\n const accounting = accountingFromQueuePayload(job)\n return recordAiModelCallAccounting({ storage, usage, ...accounting })\n}\n\n/** Validation and referential-integrity failures cannot become valid through queue redelivery. */\nexport function isPermanentAiUsageRecoveryError(error: unknown): boolean {\n return (\n error instanceof InvalidAiUsageRecoveryJobError ||\n error instanceof TypeError ||\n (error instanceof AiUsageStorageError &&\n (error.code === \"duplicate_id\" || error.code === \"missing_execution\")) ||\n (error instanceof AiCostStorageError &&\n (error.code === \"missing_usage\" || error.code === \"cost_mismatch\")) ||\n (error instanceof AiLimitStorageError &&\n (error.code === \"missing_execution\" ||\n error.code === \"missing_reservation\" ||\n error.code === \"missing_usage_record\" ||\n error.code === \"usage_mismatch\" ||\n error.code === \"reservation_conflict\" ||\n error.code === \"reconciliation_conflict\" ||\n error.code === \"invalid_reservation_state\"))\n )\n}\n\nfunction toQueuePayload(record: RecordAiModelCallInput): AiModelCallRecordPayload {\n return {\n id: record.id,\n executionId: record.executionId,\n attempt: record.attempt,\n callId: record.callId,\n requesterGroupIds: [...record.requesterGroupIds],\n providerId: record.providerId,\n ...(record.providerIds === undefined\n ? {}\n : { providerIds: structuredClone(record.providerIds) }),\n requestedModelId: record.requestedModelId,\n ...(record.modelKind === undefined ? {} : { modelKind: record.modelKind }),\n ...(record.requestedReasoning === undefined\n ? {}\n : { requestedReasoning: structuredClone(record.requestedReasoning) }),\n ...(record.responseModelId === undefined ? {} : { responseModelId: record.responseModelId }),\n responseId: record.responseId,\n usage: aiModelCallUsageFromModel(record.usage),\n ...(record.rawUsage === undefined ? {} : { rawUsage: structuredClone(record.rawUsage) }),\n occurredAt: record.occurredAt.toISOString(),\n }\n}\n\nfunction toAccountingPayload(input: RecoverAiModelCallInput): AiModelCallAccountingPayload {\n return {\n cost: structuredClone(input.cost),\n ...(input.estimate === undefined ? {} : { estimate: structuredClone(input.estimate) }),\n ...(input.route === undefined ? {} : { route: structuredClone(input.route) }),\n ratedAt: input.ratedAt.toISOString(),\n ...(input.reconcileLimitReservation ? { reconcileLimitReservation: true } : {}),\n }\n}\n\nfunction fromQueuePayload(job: AiModelCallRecoveryRecord): RecordAiModelCallInput {\n const occurredAt = parseDate(job.payload.record.occurredAt, job.id, \"occurredAt\")\n return { ...job.payload.record, projectId: job.projectId, occurredAt }\n}\n\nfunction accountingFromQueuePayload(\n job: AiModelCallRecoveryRecord\n): Omit<RecoverAiModelCallInput, \"usage\"> {\n const accounting = job.payload.accounting\n return {\n cost: structuredClone(accounting.cost),\n ...(accounting.estimate === undefined\n ? {}\n : { estimate: structuredClone(accounting.estimate) }),\n ...(accounting.route === undefined ? {} : { route: structuredClone(accounting.route) }),\n ratedAt: parseDate(accounting.ratedAt, job.id, \"ratedAt\"),\n reconcileLimitReservation: accounting.reconcileLimitReservation === true,\n }\n}\n\nfunction parseDate(value: string, jobId: string, field: string): Date {\n const date = new Date(value)\n if (!Number.isFinite(date.getTime())) {\n throw new InvalidAiUsageRecoveryJobError(\n `AI usage recovery job '${jobId}' has an invalid ${field} timestamp.`\n )\n }\n return date\n}\n",
|
|
13
|
-
"import { createSixbError } from \"../../errors/internal\"\nimport type { AgentQueueJob, Queue } from \"../../queues\"\nimport { modelCallRecoveryPayload } from \"./model-call-recovery\"\nimport type { RecoverAiModelCallInput } from \"./types\"\n\n/** Stable queue identity: a lost enqueue response can safely retry the same accounting handoff. */\nfunction agentAiUsageRecoveryJobId(recordId: string): string {\n return `agt_usage_job_${recordId}`\n}\n\n/** Transport adapter for the agent worker's existing durable recovery lane. */\nexport async function enqueueAiModelCallRecovery(\n queue: Pick<Queue<AgentQueueJob>, \"enqueue\">,\n input: RecoverAiModelCallInput\n): Promise<void> {\n const payload = modelCallRecoveryPayload(input)\n const record = input.usage\n const jobId = agentAiUsageRecoveryJobId(record.id)\n const [job] = await queue.enqueue({\n projectId: record.projectId,\n jobs: [{ id: jobId, type: \"agent.ai-usage.record.requested\", payload }],\n })\n\n if (job?.id !== jobId || job.type !== \"agent.ai-usage.record.requested\") {\n throw createSixbError(\n \"internal.unexpected\",\n `[SixbModels] Agent queue did not confirm AI usage recovery job '${jobId}'.`,\n { details: { jobId } }\n )\n }\n}\n"
|
|
13
|
+
"import { createSixbError } from \"../../errors/internal\"\nimport type { AgentQueueJob, Queue } from \"../../queues\"\nimport { modelCallRecoveryPayload } from \"./model-call-recovery\"\nimport type { RecoverAiModelCallInput } from \"./types\"\n\n/** Stable queue identity: a lost enqueue response can safely retry the same accounting handoff. */\nfunction agentAiUsageRecoveryJobId(recordId: string): string {\n return `agt_usage_job_${recordId}`\n}\n\n/** Transport adapter for the agent worker's existing durable recovery lane. */\nexport async function enqueueAiModelCallRecovery(\n queue: Pick<Queue<AgentQueueJob>, \"enqueue\">,\n input: RecoverAiModelCallInput\n): Promise<void> {\n const payload = modelCallRecoveryPayload(input)\n const record = input.usage\n const jobId = agentAiUsageRecoveryJobId(record.id)\n const [job] = await queue.enqueue({\n projectId: record.projectId,\n jobs: [{ id: jobId, type: \"agent.ai-usage.record.requested\", payload }],\n })\n\n if (job?.id !== jobId || job.type !== \"agent.ai-usage.record.requested\") {\n throw createSixbError(\n \"internal.unexpected\",\n `[SixbModels] Agent queue did not confirm AI usage recovery job '${jobId}'.`,\n { details: { jobId } }\n )\n }\n}\n",
|
|
14
|
+
"import type { ExecutionContext, RuntimeAuthorization } from \"../../execution\"\nimport { ensureExecutionRecord, executionRecordInputFromRuntime } from \"../../execution/durable\"\nimport type { SixbHostContext } from \"../../runtime/types\"\nimport type { ExecutionRecord } from \"../../storage/executions\"\nimport type { ModelExecutionAttempt } from \"./binding\"\nimport { requireAccountingCapabilities } from \"./model-call-accounting\"\nimport { createAiModelCallLimitController } from \"./model-call-limits\"\nimport { AiModelCallRecorder } from \"./model-call-recorder\"\nimport { enqueueAiModelCallRecovery } from \"./recovery-queue\"\n\n/** One accounting boundary shared by all model protocols in a bound execution. */\nexport class ModelExecutionSession {\n private binding?: ModelExecutionAttempt\n private recorder?: Promise<AiModelCallRecorder>\n\n constructor(\n private readonly runtime: SixbHostContext & { runtimeAuthorization: RuntimeAuthorization },\n private readonly execution: ExecutionContext\n ) {}\n\n bind(input: ModelExecutionAttempt): void {\n if (this.binding) throw new Error(\"[SixbModels] Execution attempt is already bound.\")\n this.binding = { ...input }\n }\n\n signal(signal?: AbortSignal): AbortSignal {\n const binding = this.requireBinding()\n return signal ? AbortSignal.any([binding.signal, signal]) : binding.signal\n }\n\n async admitEmbeddingCall(admit: () => Promise<void>): Promise<void> {\n const admission = this.requireBinding().embeddingAdmission\n if (admission) await admission(admit)\n else await admit()\n }\n\n accounting(): Promise<AiModelCallRecorder> {\n const { accounting } = this.requireBinding()\n this.recorder ??= accounting ? Promise.resolve(accounting) : this.createRecorder()\n return this.recorder\n }\n\n /**\n * The recorder of the execution attempt that admitted a call, to record how it ended when a\n * later request learns it: a video generation outlives the request that started it.\n */\n async accountingFor(execution: ExecutionRecord, attempt: number): Promise<AiModelCallRecorder> {\n const binding = this.requireBinding()\n if (execution.id === this.execution.id && attempt === binding.attempt) {\n return this.accounting()\n }\n\n return this.recorderFor(execution, attempt)\n }\n\n private requireBinding(): ModelExecutionAttempt {\n if (!this.binding) {\n throw new Error(\n \"[SixbModels] Model calls require a bound request or worker execution attempt.\"\n )\n }\n return this.binding\n }\n\n private async createRecorder(): Promise<AiModelCallRecorder> {\n const { attempt } = this.requireBinding()\n const record = await ensureExecutionRecord(\n this.runtime.storage.executions,\n executionRecordInputFromRuntime({\n execution: this.execution,\n runtimeAuthorization: this.runtime.runtimeAuthorization,\n })\n )\n return this.recorderFor(record, attempt)\n }\n\n private recorderFor(execution: ExecutionRecord, attempt: number): AiModelCallRecorder {\n return createExecutionRecorder(this.runtime, execution, attempt)\n }\n}\n\n/**\n * A recorder for one execution attempt, outside any bound request: a queue job that learns how a\n * call ended records it as the attempt that admitted it.\n */\nexport function createExecutionRecorder(\n host: Pick<SixbHostContext, \"projectId\" | \"storage\" | \"queues\">,\n execution: ExecutionRecord,\n attempt: number\n): AiModelCallRecorder {\n const storage = {\n ...requireAccountingCapabilities(host.storage),\n transaction: host.storage.transaction.bind(host.storage),\n }\n const requesterGroupIds = execution.requesterGroupIds\n return new AiModelCallRecorder({\n storage,\n projectId: host.projectId,\n executionId: execution.id,\n attempt,\n requesterGroupIds,\n limits: createAiModelCallLimitController({\n storage,\n projectId: host.projectId,\n requestedBy: execution.requestedBy,\n requesterGroupIds,\n }),\n recoverAiModelCall: (input) => enqueueAiModelCallRecovery(host.queues.agents, input),\n })\n}\n"
|
|
14
15
|
],
|
|
15
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,uCAAuC;AAkD7C,SAAS,8BAA8B,CAAC,OAIb;AAAA,EAChC,IAAI,qBAAqB,MAAM,MAAM,GAAG;AAAA,IACtC,OAAO,EAAE,QAAQ,eAAe,QAAQ,eAAe;AAAA,EACzD;AAAA,EAEA,IAAI;AAAA,EACJ,IAAI;AAAA,IACF,aAAa,KAAK,UAAU,KAAK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AAC;AAAA,IACD,oBAAoB,CAAC,UAAU,4BAA2B,KAAK,OAAO,QAAQ,KAAK;AAAA,EACrF,CAAC;AAAA;",
|
|
17
|
+
"debugId": "06382717B231353C64756E2164756E21",
|
|
17
18
|
"names": []
|
|
18
19
|
}
|
|
@@ -4,6 +4,27 @@ import {
|
|
|
4
4
|
captureSixbFailure2,
|
|
5
5
|
isSixbError2
|
|
6
6
|
} from "./chunk-mvz89age.js";
|
|
7
|
+
import {
|
|
8
|
+
createKernelRuntimeAuthorization
|
|
9
|
+
} from "./chunk-e3b1r4d2.js";
|
|
10
|
+
import {
|
|
11
|
+
INDEXING_EMBEDDING_TIMEOUT_MS,
|
|
12
|
+
vectorConfiguration,
|
|
13
|
+
vectorSources,
|
|
14
|
+
normalizeVector2
|
|
15
|
+
} from "./chunk-nhgqz3g3.js";
|
|
16
|
+
import {
|
|
17
|
+
estimateModelCall
|
|
18
|
+
} from "./chunk-jbg905hn.js";
|
|
19
|
+
import {
|
|
20
|
+
DatasetIngestLeaseLostError2
|
|
21
|
+
} from "./chunk-pk539cwv.js";
|
|
22
|
+
import {
|
|
23
|
+
VECTOR_INDEXING_FAILURE_CODES2
|
|
24
|
+
} from "./chunk-3d9w8t4n.js";
|
|
25
|
+
import {
|
|
26
|
+
ModelExecutionSession
|
|
27
|
+
} from "./chunk-ywvxcmqj.js";
|
|
7
28
|
import {
|
|
8
29
|
reportVectorIndexingFailure,
|
|
9
30
|
reportDatasetIngestFlushFailure2,
|
|
@@ -11,53 +32,35 @@ import {
|
|
|
11
32
|
} from "./chunk-czct88ht.js";
|
|
12
33
|
import {
|
|
13
34
|
DatasetValidationError2
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
DatasetIngestLeaseLostError2
|
|
17
|
-
} from "./chunk-pk539cwv.js";
|
|
35
|
+
} from "./chunk-fq8drkp0.js";
|
|
18
36
|
import {
|
|
19
37
|
findProducedVersion2,
|
|
20
38
|
writeDataset2
|
|
21
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-d7t9jnym.js";
|
|
22
40
|
import {
|
|
23
41
|
datasetDefinitionHash,
|
|
24
42
|
tryEnqueueIngestFlush
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import {
|
|
27
|
-
createKernelRuntimeAuthorization
|
|
28
|
-
} from "./chunk-tapdssb5.js";
|
|
29
|
-
import {
|
|
30
|
-
INDEXING_EMBEDDING_TIMEOUT_MS,
|
|
31
|
-
vectorConfiguration,
|
|
32
|
-
vectorSources,
|
|
33
|
-
normalizeVector2
|
|
34
|
-
} from "./chunk-394zjzjs.js";
|
|
43
|
+
} from "./chunk-ff0qdk7z.js";
|
|
35
44
|
import {
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
datasetSequenceChange2,
|
|
46
|
+
DatasetSequenceConflictError2
|
|
47
|
+
} from "./chunk-30a0ftnm.js";
|
|
38
48
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./chunk-
|
|
49
|
+
createAudioRuntime
|
|
50
|
+
} from "./chunk-990a5bkc.js";
|
|
41
51
|
import {
|
|
42
52
|
waitUnlessAborted2
|
|
43
53
|
} from "./chunk-mwcqz3e3.js";
|
|
44
|
-
import {
|
|
45
|
-
datasetSequenceChange2,
|
|
46
|
-
DatasetSequenceConflictError2
|
|
47
|
-
} from "./chunk-dmnd9ea6.js";
|
|
48
|
-
import {
|
|
49
|
-
ModelExecutionSession
|
|
50
|
-
} from "./chunk-phs5fbff.js";
|
|
51
54
|
import {
|
|
52
55
|
executionRecordInputFromRuntime,
|
|
53
56
|
ensureExecutionRecord2
|
|
54
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-6whr25gw.js";
|
|
55
58
|
import {
|
|
56
59
|
lakeRetentionJobId
|
|
57
60
|
} from "./chunk-n2ay51px.js";
|
|
58
61
|
import {
|
|
59
62
|
getDatasetPrimaryKeyColumns2
|
|
60
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-qk3zq25v.js";
|
|
61
64
|
import {
|
|
62
65
|
LakeConcurrencyError2,
|
|
63
66
|
LakeValueRefusedError2
|
|
@@ -74,6 +77,42 @@ import {
|
|
|
74
77
|
EmbeddingModelResponseError2
|
|
75
78
|
} from "./chunk-rtkqczbr.js";
|
|
76
79
|
|
|
80
|
+
// src/artifacts/media/transcriber.ts
|
|
81
|
+
function createMediaTranscriber(context, catalog) {
|
|
82
|
+
const model = catalog?.audio?.transcription?.default.model;
|
|
83
|
+
return {
|
|
84
|
+
model: model ? { maxInputBytes: model.definition.maxInputBytes } : null,
|
|
85
|
+
async transcribe(input) {
|
|
86
|
+
const operation = { type: "artifacts.transcribeMedia", digest: input.digest };
|
|
87
|
+
const name = input.digest.replace(/^sha256:/, "");
|
|
88
|
+
const execution = {
|
|
89
|
+
id: `exec_media_${name}`,
|
|
90
|
+
projectId: context.projectId,
|
|
91
|
+
executor: { type: "kernel", operation },
|
|
92
|
+
source: { type: "event", eventId: input.jobId },
|
|
93
|
+
correlationId: `media_${name}`
|
|
94
|
+
};
|
|
95
|
+
const authorization = createKernelRuntimeAuthorization({ execution, operation });
|
|
96
|
+
await ensureExecutionRecord2(context.storage.executions, {
|
|
97
|
+
...executionRecordInputFromRuntime({ execution, runtimeAuthorization: authorization }),
|
|
98
|
+
requesterGroupIds: []
|
|
99
|
+
});
|
|
100
|
+
const session = new ModelExecutionSession({ ...context, runtimeAuthorization: authorization }, execution);
|
|
101
|
+
session.bind({ attempt: input.attempt, signal: input.signal });
|
|
102
|
+
const audio = createAudioRuntime({ projectId: context.projectId, runtimeAuthorization: authorization }, execution, catalog, session, undefined);
|
|
103
|
+
const result = await audio.transcribe({ audio: input.audio, signal: input.signal });
|
|
104
|
+
return result.output;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
var transcribers = new WeakMap;
|
|
109
|
+
function registerMediaTranscriber(host, transcriber) {
|
|
110
|
+
transcribers.set(host, transcriber);
|
|
111
|
+
}
|
|
112
|
+
function findMediaTranscriber2(host) {
|
|
113
|
+
return transcribers.get(host);
|
|
114
|
+
}
|
|
115
|
+
|
|
77
116
|
// src/datasets/ingest-flush.ts
|
|
78
117
|
import { randomUUID } from "crypto";
|
|
79
118
|
|
|
@@ -1298,7 +1337,7 @@ var apiPublicOrigins = new WeakMap;
|
|
|
1298
1337
|
function setApiPublicOrigin2(host, origin) {
|
|
1299
1338
|
apiPublicOrigins.set(host, normalizeOrigin(origin));
|
|
1300
1339
|
}
|
|
1301
|
-
function
|
|
1340
|
+
function getApiPublicOrigin2(host) {
|
|
1302
1341
|
return apiPublicOrigins.get(host);
|
|
1303
1342
|
}
|
|
1304
1343
|
function normalizeOrigin(value) {
|
|
@@ -1317,6 +1356,6 @@ function normalizeOrigin(value) {
|
|
|
1317
1356
|
return url.origin;
|
|
1318
1357
|
}
|
|
1319
1358
|
|
|
1320
|
-
export { DatasetIngestFlushError2, createDatasetIngestRuntime, registerDatasetIngestRuntime, findDatasetIngestRuntime2, getDatasetIngestRuntime2, parseDuration2, lakeRetentionPass, operationalStatus, LakeRetention, registerLakeRetentionRuntime, getLakeRetentionRuntime2, bindEmbeddingModels, VectorIndexingDeferred2, createVectorIndexingRuntime, registerVectorIndexingRuntime, getVectorIndexingRuntime2, setApiPublicOrigin2,
|
|
1359
|
+
export { createMediaTranscriber, registerMediaTranscriber, findMediaTranscriber2, DatasetIngestFlushError2, createDatasetIngestRuntime, registerDatasetIngestRuntime, findDatasetIngestRuntime2, getDatasetIngestRuntime2, parseDuration2, lakeRetentionPass, operationalStatus, LakeRetention, registerLakeRetentionRuntime, getLakeRetentionRuntime2, bindEmbeddingModels, VectorIndexingDeferred2, createVectorIndexingRuntime, registerVectorIndexingRuntime, getVectorIndexingRuntime2, setApiPublicOrigin2, getApiPublicOrigin2 };
|
|
1321
1360
|
|
|
1322
|
-
//# debugId=
|
|
1361
|
+
//# debugId=158BE6430F9112E364756E2164756E21
|