@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isArtifactId } from "../../artifacts/ids"
|
|
1
2
|
import type { JsonValue } from "../../json"
|
|
2
3
|
import { cloneJsonValue, getInvalidJsonValueReason, stableJsonStringify } from "../../json"
|
|
3
4
|
import type { ObjectRef } from "../../ontology/refs"
|
|
@@ -13,6 +14,16 @@ export type AgentContextInput =
|
|
|
13
14
|
*/
|
|
14
15
|
readonly label?: string
|
|
15
16
|
}
|
|
17
|
+
| {
|
|
18
|
+
readonly kind: "artifact"
|
|
19
|
+
/** The artifact's id, such as `art_k3m9q2x7tp`. */
|
|
20
|
+
readonly id: string
|
|
21
|
+
/**
|
|
22
|
+
* What the chat shows for this artifact instead of its title. Display only: it is not part
|
|
23
|
+
* of the context's identity and is never sent to the model.
|
|
24
|
+
*/
|
|
25
|
+
readonly label?: string
|
|
26
|
+
}
|
|
16
27
|
| {
|
|
17
28
|
readonly kind: "app-state"
|
|
18
29
|
readonly id: string
|
|
@@ -58,6 +69,26 @@ export const agentContext = {
|
|
|
58
69
|
}
|
|
59
70
|
},
|
|
60
71
|
|
|
72
|
+
/** The artifact the person has open, such as the video they edit beside the chat. */
|
|
73
|
+
artifact(artifactId: string, options: { readonly label?: string } = {}) {
|
|
74
|
+
const fail = (message: string): never => {
|
|
75
|
+
throw new TypeError(`[Sixb] ${message}.`)
|
|
76
|
+
}
|
|
77
|
+
if (!isArtifactId(artifactId)) {
|
|
78
|
+
fail("agentContext.artifact() takes an artifact id, such as 'art_k3m9q2x7tp'")
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const label =
|
|
82
|
+
options.label === undefined
|
|
83
|
+
? undefined
|
|
84
|
+
: objectContextLabel(options.label, "agentContext.artifact() label", fail)
|
|
85
|
+
return {
|
|
86
|
+
kind: "artifact" as const,
|
|
87
|
+
id: artifactId,
|
|
88
|
+
...(label === undefined ? {} : { label }),
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
61
92
|
appState<const TValue extends JsonValue>(
|
|
62
93
|
id: string,
|
|
63
94
|
input: {
|
|
@@ -72,9 +103,10 @@ export const agentContext = {
|
|
|
72
103
|
|
|
73
104
|
/** Stable identity shared by core deduplication and context-aware clients. */
|
|
74
105
|
export function agentContextIdentity(context: AgentContextInput): string {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
106
|
+
if (context.kind === "object") {
|
|
107
|
+
return `object:${encodeURIComponent(context.ref.objectTypeId)}:${encodeURIComponent(context.ref.primaryId)}`
|
|
108
|
+
}
|
|
109
|
+
return `${context.kind}:${encodeURIComponent(context.id)}`
|
|
78
110
|
}
|
|
79
111
|
|
|
80
112
|
/** Stable semantic key for client-side comparisons. */
|
|
@@ -104,11 +136,7 @@ export function normalizeAgentContextEntries(
|
|
|
104
136
|
const identity = agentContextIdentity(entry.context)
|
|
105
137
|
// A label is display only, so two entries that differ only by label are the same entry; the
|
|
106
138
|
// first one's label is kept.
|
|
107
|
-
const serialized = stableJsonStringify(
|
|
108
|
-
entry.context.kind === "object"
|
|
109
|
-
? { ...entry, context: { kind: "object", ref: entry.context.ref } }
|
|
110
|
-
: entry
|
|
111
|
-
)
|
|
139
|
+
const serialized = stableJsonStringify(withoutLabel(entry))
|
|
112
140
|
const existing = byIdentity.get(identity)
|
|
113
141
|
|
|
114
142
|
if (existing !== undefined) {
|
|
@@ -170,6 +198,23 @@ function normalizeEntry(rawEntry: unknown, index: number): AgentContextEntryInpu
|
|
|
170
198
|
}
|
|
171
199
|
}
|
|
172
200
|
|
|
201
|
+
if (context.kind === "artifact") {
|
|
202
|
+
const id = requireNonEmptyString(context.id, `context[${index}].context.id`)
|
|
203
|
+
if (!isArtifactId(id)) {
|
|
204
|
+
invalidContext(
|
|
205
|
+
`context[${index}].context.id must be an artifact id, such as 'art_k3m9q2x7tp'`
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
const label =
|
|
209
|
+
context.label === undefined
|
|
210
|
+
? undefined
|
|
211
|
+
: objectContextLabel(context.label, `context[${index}].context.label`, invalidContext)
|
|
212
|
+
return {
|
|
213
|
+
context: { kind: "artifact", id, ...(label === undefined ? {} : { label }) },
|
|
214
|
+
origin: rawEntry.origin,
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
173
218
|
if (context.kind === "app-state") {
|
|
174
219
|
const id = requireNonEmptyString(context.id, `context[${index}].context.id`)
|
|
175
220
|
const label = requireNonEmptyString(context.label, `context[${index}].context.label`)
|
|
@@ -193,7 +238,16 @@ function normalizeEntry(rawEntry: unknown, index: number): AgentContextEntryInpu
|
|
|
193
238
|
}
|
|
194
239
|
}
|
|
195
240
|
|
|
196
|
-
invalidContext(`context[${index}].context.kind must be 'object' or 'app-state'`)
|
|
241
|
+
invalidContext(`context[${index}].context.kind must be 'object', 'artifact' or 'app-state'`)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** The entry as its identity compares it: an object's or an artifact's label is display only. */
|
|
245
|
+
function withoutLabel(entry: AgentContextEntryInput): AgentContextEntryInput {
|
|
246
|
+
const { context } = entry
|
|
247
|
+
if (context.kind === "object") return { ...entry, context: { kind: "object", ref: context.ref } }
|
|
248
|
+
if (context.kind === "artifact")
|
|
249
|
+
return { ...entry, context: { kind: "artifact", id: context.id } }
|
|
250
|
+
return entry
|
|
197
251
|
}
|
|
198
252
|
|
|
199
253
|
function objectContextLabel(
|
|
@@ -19,6 +19,15 @@ export function serializeAgentContextForModel(
|
|
|
19
19
|
continue
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
if (part.context.kind === "artifact") {
|
|
23
|
+
lines.push(
|
|
24
|
+
" <artifact_context>",
|
|
25
|
+
` <artifact_id>${escapeXml(part.context.id)}</artifact_id>`,
|
|
26
|
+
" </artifact_context>"
|
|
27
|
+
)
|
|
28
|
+
continue
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
lines.push(
|
|
23
32
|
" <app_state_context>",
|
|
24
33
|
` <id>${escapeXml(part.context.id)}</id>`,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCallerArtifacts } from "../artifacts/caller"
|
|
1
2
|
import type { SixbRuntimeContext } from "../runtime/types"
|
|
2
3
|
import {
|
|
3
4
|
type AgentContextEntryInput,
|
|
@@ -14,6 +15,12 @@ export async function resolveAgentContextParts(
|
|
|
14
15
|
const entries = normalizeAgentContextEntries(input)
|
|
15
16
|
|
|
16
17
|
for (const entry of entries) {
|
|
18
|
+
if (entry.context.kind === "artifact") {
|
|
19
|
+
// As the sender reads it: one they cannot read is unknown, as a missing one is.
|
|
20
|
+
const artifact = await getCallerArtifacts(runtime).get(entry.context.id)
|
|
21
|
+
if (!artifact) invalidContext(`context references an unknown artifact '${entry.context.id}'`)
|
|
22
|
+
continue
|
|
23
|
+
}
|
|
17
24
|
if (entry.context.kind !== "object") continue
|
|
18
25
|
const { objectTypeId, primaryId } = entry.context.ref
|
|
19
26
|
|
package/src/agents/execution.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCallerArtifacts } from "../artifacts/caller"
|
|
1
2
|
import { principalsEqual, type UserPrincipal } from "../auth"
|
|
2
3
|
import { AuthorizationError, assertAuthorized, isRuntimeAllowed } from "../authorization"
|
|
3
4
|
import type { BlobStorage } from "../blob-storage/types"
|
|
@@ -167,6 +168,13 @@ export type AgentThreadsRuntime<TParams extends Record<string, unknown> = Record
|
|
|
167
168
|
getById(threadId: string): Promise<AgentThreadView | null>
|
|
168
169
|
/** The caller's own threads, or with `sharedWithMe` the ones other users added it to. */
|
|
169
170
|
list(input?: ListExecutionAgentThreadsInput): Promise<ListAgentThreadViewsResult>
|
|
171
|
+
/**
|
|
172
|
+
* The conversations about an artifact, among those the caller reads, theirs or another's they
|
|
173
|
+
* take part in, most recently updated first: each one the Agent wrote it from, the fork it was
|
|
174
|
+
* copied for, and each one a message brought it to with `agentContext.artifact()`, though the
|
|
175
|
+
* Agent has not written it yet. `null` when the caller cannot read the artifact.
|
|
176
|
+
*/
|
|
177
|
+
listForArtifact(artifactId: string): Promise<readonly AgentThreadView[] | null>
|
|
170
178
|
/**
|
|
171
179
|
* Record that the caller's reading of a thread reached a message, or its newest when omitted,
|
|
172
180
|
* which is what a Done button sends. It never moves backwards, so another device that read
|
|
@@ -1161,6 +1169,37 @@ export function createAgentRuntime<
|
|
|
1161
1169
|
const views = await agentThreadViews(runtime, result.threads)
|
|
1162
1170
|
return { ...result, threads: await withThreadState(views, readViewer()) }
|
|
1163
1171
|
},
|
|
1172
|
+
listForArtifact: async (artifactId) => {
|
|
1173
|
+
if (!(await getCallerArtifacts(runtime).get(artifactId))) return null
|
|
1174
|
+
|
|
1175
|
+
const scope = rule.scope()
|
|
1176
|
+
if (scope === "none") return []
|
|
1177
|
+
|
|
1178
|
+
// The conversations the artifact is shared in, and those a message brought it to as
|
|
1179
|
+
// context, before the Agent wrote it or without it ever doing so: only the caller's, or
|
|
1180
|
+
// those they take part in, asked of storage as such, so the cost is theirs.
|
|
1181
|
+
const projectId = runtime.projectId
|
|
1182
|
+
const reader = scope === "every" ? {} : { reader: scope.reader }
|
|
1183
|
+
const [shared, carried] = await Promise.all([
|
|
1184
|
+
runtime.storage.artifacts?.listThreadIds({ projectId, id: artifactId, ...reader }) ?? [],
|
|
1185
|
+
runtime.storage.agents?.messages.listThreadIdsByArtifactContext({
|
|
1186
|
+
projectId,
|
|
1187
|
+
artifactId,
|
|
1188
|
+
...reader,
|
|
1189
|
+
}) ?? [],
|
|
1190
|
+
])
|
|
1191
|
+
|
|
1192
|
+
// Each as the caller reads it still: an artifact they read opens no conversation they
|
|
1193
|
+
// do not.
|
|
1194
|
+
const readable = await rule.readConversations([...shared, ...carried])
|
|
1195
|
+
const threads = readable
|
|
1196
|
+
.map(({ thread }) => thread)
|
|
1197
|
+
.sort(
|
|
1198
|
+
(left, right) =>
|
|
1199
|
+
right.updatedAt.getTime() - left.updatedAt.getTime() || (left.id < right.id ? 1 : -1)
|
|
1200
|
+
)
|
|
1201
|
+
return withThreadState(threads, readViewer())
|
|
1202
|
+
},
|
|
1164
1203
|
participants: {
|
|
1165
1204
|
add: (threadId, users) =>
|
|
1166
1205
|
addAgentThreadParticipants(runtime, rule, security, threadId, users),
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ModelProviderError } from "../models/errors"
|
|
2
|
+
import { type BackoffPolicy, backoffDelay } from "../shared/backoff"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How a step asks again an interrupted call (see {@link modelCallInterrupted}): at most `retries` more
|
|
6
|
+
* calls, each after a wait that doubles from `initialMs`, at most 15 seconds of waiting in all.
|
|
7
|
+
*/
|
|
8
|
+
export const MODEL_CALL_RETRY: BackoffPolicy & { readonly retries: number } = {
|
|
9
|
+
retries: 4,
|
|
10
|
+
initialMs: 1_000,
|
|
11
|
+
maxMs: 8_000,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// What Bun's fetch (on the error) and Node's (on its `cause`) say when a connection fails: refused,
|
|
15
|
+
// reset or closed before its response ended, timed out, or its host briefly unreachable.
|
|
16
|
+
const CONNECTION_LOST_CODES = new Set([
|
|
17
|
+
"ECONNREFUSED",
|
|
18
|
+
"ECONNRESET",
|
|
19
|
+
"ECONNABORTED",
|
|
20
|
+
"EPIPE",
|
|
21
|
+
"ETIMEDOUT",
|
|
22
|
+
"EAI_AGAIN",
|
|
23
|
+
"EHOSTUNREACH",
|
|
24
|
+
"ENETUNREACH",
|
|
25
|
+
"ConnectionRefused",
|
|
26
|
+
"ConnectionClosed",
|
|
27
|
+
"FailedToOpenSocket",
|
|
28
|
+
"UND_ERR_SOCKET",
|
|
29
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
30
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
31
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
32
|
+
])
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The code of the connection a model call lost, such as `ECONNRESET`, or undefined when the call
|
|
36
|
+
* failed otherwise. A lost connection is not a provider's answer: whether the call was billed is
|
|
37
|
+
* unknown, and the same request may well succeed a moment later.
|
|
38
|
+
*/
|
|
39
|
+
export function lostConnectionCode(error: unknown): string | undefined {
|
|
40
|
+
const code = errorCode(error) ?? (error instanceof TypeError ? errorCode(error.cause) : undefined)
|
|
41
|
+
return code !== undefined && CONNECTION_LOST_CODES.has(code) ? code : undefined
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Whether a model call broke off for a reason that has nothing to do with its request, so the same
|
|
46
|
+
* request may succeed when it is made again: its connection was lost, or its provider interrupted
|
|
47
|
+
* the response it had started (an error event saying it was overloaded, rate limited or failing,
|
|
48
|
+
* or a stream closed before its end, as the protocols mark them). A refusal before the response,
|
|
49
|
+
* which the binding already retried, is not one.
|
|
50
|
+
*/
|
|
51
|
+
export function modelCallInterrupted(error: unknown): boolean {
|
|
52
|
+
if (lostConnectionCode(error) !== undefined) return true
|
|
53
|
+
return error instanceof ModelProviderError && error.reason === "interrupted"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* How long the step waits before retry `retry`, counted from 0: between half and all of the
|
|
58
|
+
* policy's delay, so the calls a dropped connection failed together do not come back together.
|
|
59
|
+
*/
|
|
60
|
+
export function modelCallRetryDelay(retry: number): number {
|
|
61
|
+
const ceiling = backoffDelay(retry, MODEL_CALL_RETRY)
|
|
62
|
+
return Math.round(ceiling / 2 + (Math.random() * ceiling) / 2)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function errorCode(error: unknown): string | undefined {
|
|
66
|
+
if (typeof error !== "object" || error === null) return undefined
|
|
67
|
+
const code: unknown = Reflect.get(error, "code")
|
|
68
|
+
return typeof code === "string" ? code : undefined
|
|
69
|
+
}
|
package/src/agents/model-loop.ts
CHANGED
|
@@ -34,6 +34,8 @@ import type {
|
|
|
34
34
|
} from "../models/messages"
|
|
35
35
|
import type { ModelCallCost, ModelReportedCost } from "../models/pricing"
|
|
36
36
|
import type { ModelOutput, ModelTool } from "../models/tools"
|
|
37
|
+
import { waitUnlessAborted } from "../shared/backoff"
|
|
38
|
+
import { MODEL_CALL_RETRY, modelCallInterrupted, modelCallRetryDelay } from "./model-call-retry"
|
|
37
39
|
import { coerceToolInput } from "./tool-input-coercion"
|
|
38
40
|
|
|
39
41
|
const MAX_PROVIDER_DATA_BYTES = 256 * 1024
|
|
@@ -158,8 +160,10 @@ interface ParsedToolCall {
|
|
|
158
160
|
/**
|
|
159
161
|
* Run a provider-neutral, streaming model/tool loop.
|
|
160
162
|
*
|
|
161
|
-
* One step is
|
|
162
|
-
*
|
|
163
|
+
* One step is one provider call, made again as a new call when it is interrupted (see
|
|
164
|
+
* {@link MODEL_CALL_RETRY}) or `recoverStep` asks it again. Lifecycle and stream callbacks are
|
|
165
|
+
* awaited so the caller controls backpressure and can fail closed before another billable call
|
|
166
|
+
* starts.
|
|
163
167
|
* Completed steps and partial content contain validated JSON payloads and normalized provider
|
|
164
168
|
* metadata. Trace adapters may project these results directly; storage owns write validation.
|
|
165
169
|
*/
|
|
@@ -215,7 +219,9 @@ export async function runModelLoop(
|
|
|
215
219
|
let callId: string
|
|
216
220
|
let cost: ModelCallCost
|
|
217
221
|
let completed: CompletedResponse
|
|
218
|
-
|
|
222
|
+
let recoveryAsked = false
|
|
223
|
+
let retries = 0
|
|
224
|
+
for (;;) {
|
|
219
225
|
callId = generateCallId()
|
|
220
226
|
if (!callId || callIds.has(callId)) {
|
|
221
227
|
throw new ModelStreamError(`[SixbModels] Model call IDs must be nonempty and unique.`)
|
|
@@ -236,6 +242,24 @@ export async function runModelLoop(
|
|
|
236
242
|
return { status: "aborted", steps, partialContent: accumulator.partialContent() }
|
|
237
243
|
}
|
|
238
244
|
|
|
245
|
+
// A call interrupted before it answered or while it streamed (its connection lost, its
|
|
246
|
+
// provider overloaded or failing) is made again as a new call, admitted and recorded on its
|
|
247
|
+
// own: the interrupted one may have been billed, so it stays recorded with its usage
|
|
248
|
+
// unknown. Nothing it streamed was acted on, and its reader drops it.
|
|
249
|
+
if (call.failure?.interrupted && retries < MODEL_CALL_RETRY.retries) {
|
|
250
|
+
const delayMs = modelCallRetryDelay(retries)
|
|
251
|
+
retries += 1
|
|
252
|
+
console.warn(
|
|
253
|
+
`[SixbModels] Model call '${callId}' was interrupted; asking again in ${delayMs} ms.`,
|
|
254
|
+
call.failure.error
|
|
255
|
+
)
|
|
256
|
+
if (accumulator.streamed) await input.onEvent?.({ type: "start-step", retry: true })
|
|
257
|
+
|
|
258
|
+
await waitUnlessAborted(delayMs, input.signal)
|
|
259
|
+
if (input.signal.aborted) return { status: "aborted", steps, partialContent: [] }
|
|
260
|
+
continue
|
|
261
|
+
}
|
|
262
|
+
|
|
239
263
|
// A stream that failed after its finish is still read whole first: a malformed one fails
|
|
240
264
|
// as such.
|
|
241
265
|
const finished =
|
|
@@ -256,7 +280,8 @@ export async function runModelLoop(
|
|
|
256
280
|
),
|
|
257
281
|
}
|
|
258
282
|
: undefined)
|
|
259
|
-
if (failure &&
|
|
283
|
+
if (failure && !recoveryAsked && input.recoverStep) {
|
|
284
|
+
recoveryAsked = true
|
|
260
285
|
let recovered: PrepareModelStepResult | undefined
|
|
261
286
|
try {
|
|
262
287
|
recovered = await input.recoverStep({
|
|
@@ -381,8 +406,10 @@ export async function runModelLoop(
|
|
|
381
406
|
return { status: "completed", output, steps, finishReason: response.finishReason }
|
|
382
407
|
}
|
|
383
408
|
|
|
384
|
-
const toolResults = await
|
|
385
|
-
localCalls
|
|
409
|
+
const toolResults = await executeToolCalls(
|
|
410
|
+
localCalls,
|
|
411
|
+
(call) => tools.get(call.part.toolName)?.readOnly === true,
|
|
412
|
+
(call) => executeToolCall(call, tools, callId, input.signal, input.onEvent)
|
|
386
413
|
)
|
|
387
414
|
const step = modelStep(response, responseId, [...response.content, ...toolResults], cost)
|
|
388
415
|
steps.push(step)
|
|
@@ -432,7 +459,7 @@ export async function runModelLoop(
|
|
|
432
459
|
/**
|
|
433
460
|
* One provider call of a step, streamed into its accumulator. A cancel, or an abort error, leaves
|
|
434
461
|
* what arrived partial; any other error is the call's failure, whether it came before the
|
|
435
|
-
* stream's finish or after it.
|
|
462
|
+
* stream's finish or after it, and says whether the call was interrupted.
|
|
436
463
|
*/
|
|
437
464
|
async function callModel(
|
|
438
465
|
input: RunModelLoopInput<unknown>,
|
|
@@ -447,7 +474,7 @@ async function callModel(
|
|
|
447
474
|
): Promise<{
|
|
448
475
|
readonly cost: ModelCallCost
|
|
449
476
|
readonly aborted: boolean
|
|
450
|
-
readonly failure?: { readonly error: unknown }
|
|
477
|
+
readonly failure?: { readonly error: unknown; readonly interrupted: boolean }
|
|
451
478
|
}> {
|
|
452
479
|
const { accumulator } = call
|
|
453
480
|
const maxOutputTokens =
|
|
@@ -456,7 +483,7 @@ async function callModel(
|
|
|
456
483
|
: Math.min(call.maxOutputTokens, input.maxOutputTokens ?? Number.POSITIVE_INFINITY)
|
|
457
484
|
let accepted = false
|
|
458
485
|
let cost: ModelCallCost = { status: "unpriceable", reason: "missing-usage" }
|
|
459
|
-
let failure: { readonly error: unknown } | undefined
|
|
486
|
+
let failure: { readonly error: unknown; readonly interrupted: boolean } | undefined
|
|
460
487
|
let cancelled = false
|
|
461
488
|
try {
|
|
462
489
|
const stream = await input.model.stream({
|
|
@@ -488,8 +515,12 @@ async function callModel(
|
|
|
488
515
|
} catch (error) {
|
|
489
516
|
// A call that could not be recorded fails the run, even one that was being cancelled.
|
|
490
517
|
if (error instanceof ModelUsageRecordingError) throw error
|
|
491
|
-
if (input.signal.aborted || isAbortError(error))
|
|
492
|
-
|
|
518
|
+
if (input.signal.aborted || isAbortError(error)) {
|
|
519
|
+
cancelled = true
|
|
520
|
+
} else {
|
|
521
|
+
const interrupted = !accumulator.readerFailed && modelCallInterrupted(error)
|
|
522
|
+
failure = { error, interrupted }
|
|
523
|
+
}
|
|
493
524
|
} finally {
|
|
494
525
|
// The step's cost, as the model records the call: the model is what records it (see
|
|
495
526
|
// AiModelCallRecorder.wrapModel), never the loop that reads it.
|
|
@@ -611,6 +642,31 @@ function modelStep(
|
|
|
611
642
|
}
|
|
612
643
|
}
|
|
613
644
|
|
|
645
|
+
/**
|
|
646
|
+
* Run a step's calls in the order the model gave them. Read-only calls run together with the
|
|
647
|
+
* read-only calls next to them; every other call runs alone, once the calls before it have
|
|
648
|
+
* finished. An edit and the test the model runs after it in the same step then see each other.
|
|
649
|
+
*/
|
|
650
|
+
async function executeToolCalls(
|
|
651
|
+
calls: readonly ParsedToolCall[],
|
|
652
|
+
readOnly: (call: ParsedToolCall) => boolean,
|
|
653
|
+
execute: (call: ParsedToolCall) => Promise<ModelToolResultPart>
|
|
654
|
+
): Promise<ModelToolResultPart[]> {
|
|
655
|
+
const results: ModelToolResultPart[] = []
|
|
656
|
+
let reads: ParsedToolCall[] = []
|
|
657
|
+
for (const call of calls) {
|
|
658
|
+
if (readOnly(call)) {
|
|
659
|
+
reads.push(call)
|
|
660
|
+
continue
|
|
661
|
+
}
|
|
662
|
+
results.push(...(await Promise.all(reads.map(execute))))
|
|
663
|
+
reads = []
|
|
664
|
+
results.push(await execute(call))
|
|
665
|
+
}
|
|
666
|
+
results.push(...(await Promise.all(reads.map(execute))))
|
|
667
|
+
return results
|
|
668
|
+
}
|
|
669
|
+
|
|
614
670
|
async function executeToolCall(
|
|
615
671
|
call: ParsedToolCall,
|
|
616
672
|
tools: ReadonlyMap<string, ModelTool>,
|
|
@@ -619,6 +675,17 @@ async function executeToolCall(
|
|
|
619
675
|
onEvent: RunModelLoopInput["onEvent"]
|
|
620
676
|
): Promise<ModelToolResultPart> {
|
|
621
677
|
const { part } = call
|
|
678
|
+
// A step's calls can run one after another: none starts once the run has stopped.
|
|
679
|
+
if (signal.aborted) {
|
|
680
|
+
const errorText = "The run stopped before this call started."
|
|
681
|
+
await onEvent?.({
|
|
682
|
+
type: "tool-output-error",
|
|
683
|
+
toolCallId: part.toolCallId,
|
|
684
|
+
toolName: part.toolName,
|
|
685
|
+
errorText,
|
|
686
|
+
})
|
|
687
|
+
return toolErrorResult(part, errorText)
|
|
688
|
+
}
|
|
622
689
|
if (call.inputError) {
|
|
623
690
|
const errorText = `Tool input is not valid JSON: ${call.inputError.message}`
|
|
624
691
|
await onEvent?.({
|
|
@@ -777,6 +844,8 @@ class StreamAccumulator {
|
|
|
777
844
|
private contextWindowExceeded = false
|
|
778
845
|
/** Whether the call handed its reader anything. */
|
|
779
846
|
streamed = false
|
|
847
|
+
/** Whether its reader failed: that failure is the reader's own, never the provider's. */
|
|
848
|
+
readerFailed = false
|
|
780
849
|
/** Who served the call, what it used and what the provider charged. */
|
|
781
850
|
readonly meter = new LanguageModelCallMeter()
|
|
782
851
|
private projectionError: Error | undefined
|
|
@@ -785,7 +854,12 @@ class StreamAccumulator {
|
|
|
785
854
|
|
|
786
855
|
private async onEvent(chunk: ModelUiChunk): Promise<void> {
|
|
787
856
|
this.streamed = true
|
|
788
|
-
|
|
857
|
+
try {
|
|
858
|
+
await this.reader?.(chunk)
|
|
859
|
+
} catch (error) {
|
|
860
|
+
this.readerFailed = true
|
|
861
|
+
throw error
|
|
862
|
+
}
|
|
789
863
|
}
|
|
790
864
|
|
|
791
865
|
isFinished(): boolean {
|
|
@@ -50,6 +50,8 @@ export interface AgentRunArtifacts {
|
|
|
50
50
|
getVersion: ArtifactsRuntime["getVersion"]
|
|
51
51
|
listVersions: ArtifactsRuntime["listVersions"]
|
|
52
52
|
query: ArtifactsRuntime["query"]
|
|
53
|
+
/** What is derived of a video or a sound a version holds, which a video's copy lists. */
|
|
54
|
+
media: ArtifactsRuntime["media"]
|
|
53
55
|
/**
|
|
54
56
|
* The artifact, when the run may write it: its requester owns it, or the conversation shares it
|
|
55
57
|
* and they take part. Another is `null`, even one they could update from another conversation:
|
|
@@ -145,6 +147,7 @@ export function agentRunArtifacts(
|
|
|
145
147
|
getVersion: async (...args) => (await sdk()).artifacts.getVersion(...args),
|
|
146
148
|
listVersions: async (...args) => (await sdk()).artifacts.listVersions(...args),
|
|
147
149
|
query: async (...args) => (await sdk()).artifacts.query(...args),
|
|
150
|
+
media: async (...args) => (await sdk()).artifacts.media(...args),
|
|
148
151
|
updatable,
|
|
149
152
|
|
|
150
153
|
async publish(input) {
|
|
@@ -218,9 +221,11 @@ export function agentRunArtifacts(
|
|
|
218
221
|
return { prepared, stored }
|
|
219
222
|
}
|
|
220
223
|
|
|
221
|
-
// What
|
|
224
|
+
// What a canvas or a video showed before, so that its viewers learn which boards or scenes
|
|
225
|
+
// the turn changes.
|
|
226
|
+
const announces = kind === "canvas" || kind === "video"
|
|
222
227
|
const before =
|
|
223
|
-
|
|
228
|
+
announces && "artifactId" in input
|
|
224
229
|
? await latestVersionOf(requireArtifacts(storage), projectId, input.artifactId)
|
|
225
230
|
: null
|
|
226
231
|
|
|
@@ -250,10 +255,10 @@ export function agentRunArtifacts(
|
|
|
250
255
|
merged: false,
|
|
251
256
|
}
|
|
252
257
|
if ("artifactId" in input) await announceArtifactUpdates(host.domainEvents, [stored.version])
|
|
253
|
-
if (
|
|
258
|
+
if (announces) await announceAgentBoards(host, turnRunId, before, stored.version)
|
|
254
259
|
|
|
255
260
|
// The render worker pictures what the boards miss, with their queries answered now, as the
|
|
256
|
-
// requester.
|
|
261
|
+
// requester, and derives what its media need.
|
|
257
262
|
await artifactPreviewRequester(reader)(stored.version)
|
|
258
263
|
|
|
259
264
|
return {
|
|
@@ -281,7 +286,7 @@ async function latestVersionOf(
|
|
|
281
286
|
}
|
|
282
287
|
|
|
283
288
|
/**
|
|
284
|
-
* Tells whoever has the canvas open which boards the turn is changing. The write is stored by
|
|
289
|
+
* Tells whoever has the canvas or the video open which boards or scenes the turn is changing. The write is stored by
|
|
285
290
|
* now: a broker that refuses only leaves its viewers without the notice.
|
|
286
291
|
*/
|
|
287
292
|
async function announceAgentBoards(
|
package/src/agents/run-plan.ts
CHANGED
|
@@ -85,7 +85,7 @@ export interface AgentRunDelegationModel extends LanguageModelRef {
|
|
|
85
85
|
readonly defaultReasoning?: AgentReasoning
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
export type SandboxModelKind = "language" | "image" | "speech" | "transcription"
|
|
88
|
+
export type SandboxModelKind = "language" | "image" | "video" | "speech" | "transcription"
|
|
89
89
|
|
|
90
90
|
/** One model the agent reaches through `sixb models`, as its prompt describes it. */
|
|
91
91
|
export interface SandboxModel {
|
|
@@ -220,6 +220,7 @@ export function listSandboxModels(models: ModelCatalog | undefined): readonly Sa
|
|
|
220
220
|
const media = (
|
|
221
221
|
[
|
|
222
222
|
["image", models?.image],
|
|
223
|
+
["video", models?.video],
|
|
223
224
|
["speech", models?.audio?.speech],
|
|
224
225
|
["transcription", models?.audio?.transcription],
|
|
225
226
|
] as const
|
|
@@ -184,6 +184,7 @@ export function createHttpAgentRunSession<TRun extends AgentRunRecord>(
|
|
|
184
184
|
getVersion: (...args) => call("artifacts.getVersion", args),
|
|
185
185
|
listVersions: (...args) => call("artifacts.listVersions", args),
|
|
186
186
|
query: (...args) => call("artifacts.query", args),
|
|
187
|
+
media: (...args) => call("artifacts.media", args),
|
|
187
188
|
updatable: (artifactId) => call("artifacts.updatable", [artifactId]),
|
|
188
189
|
publish: (publish) => call("artifacts.publish", [publish]),
|
|
189
190
|
turnWrites: () => call("artifacts.turnWrites", []),
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
AGENT_RUN_STOPPED_HEADER,
|
|
20
20
|
decodeWireValue,
|
|
21
|
+
encodeModelCallError,
|
|
21
22
|
encodeWireError,
|
|
22
23
|
encodeWireValue,
|
|
23
24
|
parseAgentRunSessionPath,
|
|
@@ -108,6 +109,8 @@ const OPERATIONS: Readonly<Record<string, Operation>> = {
|
|
|
108
109
|
),
|
|
109
110
|
"artifacts.query": (session, args) =>
|
|
110
111
|
session.artifacts.query(...(args as Parameters<AgentRunSession["artifacts"]["query"]>)),
|
|
112
|
+
"artifacts.media": (session, args) =>
|
|
113
|
+
session.artifacts.media(...(args as Parameters<AgentRunSession["artifacts"]["media"]>)),
|
|
111
114
|
"artifacts.updatable": (session, [artifactId]) =>
|
|
112
115
|
session.artifacts.updatable(artifactId as string),
|
|
113
116
|
"artifacts.publish": (session, [input]) =>
|
|
@@ -444,7 +447,18 @@ async function streamModelCall(session: AgentRunSession, request: Request): Prom
|
|
|
444
447
|
measures?: unknown
|
|
445
448
|
}
|
|
446
449
|
const model = await session.models.language(ref, { measures: measures !== false })
|
|
447
|
-
|
|
450
|
+
|
|
451
|
+
let opened: Awaited<ReturnType<typeof model.stream>>
|
|
452
|
+
try {
|
|
453
|
+
opened = await model.stream({ ...call, signal: request.signal })
|
|
454
|
+
} catch (error) {
|
|
455
|
+
// The call failed before it answered: it crosses as a call that fails while it streams does.
|
|
456
|
+
// No stream will close the session, so this does.
|
|
457
|
+
await session.close()
|
|
458
|
+
const wire = encodeModelCallError(error)
|
|
459
|
+
return json({ error: wire }, wireErrorStatus(wire))
|
|
460
|
+
}
|
|
461
|
+
|
|
448
462
|
const encoder = new TextEncoder()
|
|
449
463
|
const iterator = opened.events[Symbol.asyncIterator]()
|
|
450
464
|
const body = new ReadableStream<Uint8Array>({
|
|
@@ -456,10 +470,17 @@ async function streamModelCall(session: AgentRunSession, request: Request): Prom
|
|
|
456
470
|
await session.close()
|
|
457
471
|
return
|
|
458
472
|
}
|
|
473
|
+
|
|
474
|
+
// An error event crosses as the error it carries, which the runner throws as its model
|
|
475
|
+
// loop would in process. Letting the call go records it, as the loop's reader does.
|
|
476
|
+
if (next.value.type === "error") {
|
|
477
|
+
await iterator.return?.()
|
|
478
|
+
throw next.value.error
|
|
479
|
+
}
|
|
459
480
|
controller.enqueue(encoder.encode(`${encodeWireValue({ event: next.value })}\n`))
|
|
460
481
|
} catch (error) {
|
|
461
482
|
controller.enqueue(
|
|
462
|
-
encoder.encode(`${encodeWireValue({ error:
|
|
483
|
+
encoder.encode(`${encodeWireValue({ error: encodeModelCallError(error) })}\n`)
|
|
463
484
|
)
|
|
464
485
|
controller.close()
|
|
465
486
|
await session.close()
|