@sixb/core 0.1.25 → 0.1.26
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 +35 -35
- package/dist/agents/attachment-keys.d.ts +25 -0
- package/dist/agents/attachment-keys.d.ts.map +1 -0
- package/dist/agents/cancel.d.ts +12 -0
- package/dist/agents/cancel.d.ts.map +1 -1
- package/dist/agents/children.d.ts.map +1 -1
- package/dist/agents/dispatch.d.ts +1 -9
- package/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +5 -0
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/index.d.ts +31 -6
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +154 -66
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-loop.d.ts +3 -5
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/model-routing.d.ts +4 -1
- package/dist/agents/model-routing.d.ts.map +1 -1
- package/dist/agents/request.d.ts +9 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-after-finish.d.ts +11 -0
- package/dist/agents/run-after-finish.d.ts.map +1 -0
- package/dist/agents/run-artifacts.d.ts +56 -0
- package/dist/agents/run-artifacts.d.ts.map +1 -0
- package/dist/agents/run-events.d.ts +49 -0
- package/dist/agents/run-events.d.ts.map +1 -0
- package/dist/agents/run-fence.d.ts +38 -0
- package/dist/agents/run-fence.d.ts.map +1 -0
- package/dist/agents/run-liveness.d.ts +36 -0
- package/dist/agents/run-liveness.d.ts.map +1 -0
- package/dist/agents/run-plan.d.ts +110 -0
- package/dist/agents/run-plan.d.ts.map +1 -0
- package/dist/agents/run-session-children.d.ts +89 -0
- package/dist/agents/run-session-children.d.ts.map +1 -0
- package/dist/agents/run-session-http.d.ts +37 -0
- package/dist/agents/run-session-http.d.ts.map +1 -0
- package/dist/agents/run-session-serve.d.ts +24 -0
- package/dist/agents/run-session-serve.d.ts.map +1 -0
- package/dist/agents/run-session-wire.d.ts +31 -0
- package/dist/agents/run-session-wire.d.ts.map +1 -0
- package/dist/agents/run-session.d.ts +239 -0
- package/dist/agents/run-session.d.ts.map +1 -0
- package/dist/agents/run-token.d.ts +40 -0
- package/dist/agents/run-token.d.ts.map +1 -0
- package/dist/agents/run-tools.d.ts +68 -0
- package/dist/agents/run-tools.d.ts.map +1 -0
- package/dist/agents/run-turn.d.ts +59 -0
- package/dist/agents/run-turn.d.ts.map +1 -0
- package/dist/agents/streams/index.js +1 -1
- package/dist/agents/streams/internal.d.ts +1 -1
- package/dist/agents/streams/internal.d.ts.map +1 -1
- package/dist/agents/streams/internal.js +2 -4
- package/dist/agents/streams/internal.js.map +1 -1
- package/dist/agents/streams/protocol.d.ts +1 -96
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/subagent-runs.d.ts +7 -1
- package/dist/agents/subagent-runs.d.ts.map +1 -1
- package/dist/agents/tool-files.d.ts +34 -0
- package/dist/agents/tool-files.d.ts.map +1 -0
- package/dist/agents/workflow-node-session.d.ts +99 -0
- package/dist/agents/workflow-node-session.d.ts.map +1 -0
- package/dist/artifacts/frames/index.js +1 -1
- package/dist/artifacts/frames/index.js.map +1 -1
- package/dist/artifacts/index.js.map +1 -1
- package/dist/artifacts/publish/index.d.ts +1 -1
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +19 -19
- package/dist/auth/index.js +8 -8
- package/dist/authorization/index.js +4 -4
- package/dist/bootstrap/index.js +45 -43
- package/dist/bootstrap/index.js.map +2 -2
- package/dist/{chunk-2fn60nvs.js → chunk-06sg8s4z.js} +2 -2
- package/dist/{chunk-2fn60nvs.js.map → chunk-06sg8s4z.js.map} +1 -1
- package/dist/chunk-07kkp2e1.js.map +1 -1
- package/dist/{chunk-9ntbsnke.js → chunk-0bc3w0zq.js} +7 -7
- package/dist/{chunk-9ntbsnke.js.map → chunk-0bc3w0zq.js.map} +2 -2
- package/dist/{chunk-d2m879s4.js → chunk-0kk2wt0h.js} +27 -27
- package/dist/chunk-0kk2wt0h.js.map +12 -0
- package/dist/chunk-16a9dmfy.js.map +1 -1
- package/dist/chunk-18sk89cg.js.map +2 -2
- package/dist/{chunk-3qms4nax.js → chunk-1vg43g9q.js} +20 -20
- package/dist/{chunk-3qms4nax.js.map → chunk-1vg43g9q.js.map} +4 -4
- package/dist/{chunk-hqsp2sx4.js → chunk-1xvqgg88.js} +31 -33
- package/dist/{chunk-hqsp2sx4.js.map → chunk-1xvqgg88.js.map} +6 -6
- package/dist/chunk-2adz0h75.js.map +1 -1
- package/dist/{chunk-fm62y49k.js → chunk-2pk5hjj9.js} +5 -3
- package/dist/{chunk-fm62y49k.js.map → chunk-2pk5hjj9.js.map} +5 -5
- package/dist/{chunk-vrf90dkv.js → chunk-2vjnyz1s.js} +1 -1
- package/dist/{chunk-vrf90dkv.js.map → chunk-2vjnyz1s.js.map} +1 -1
- package/dist/{chunk-4f3ydv7t.js → chunk-315qye3g.js} +1 -1
- package/dist/{chunk-4f3ydv7t.js.map → chunk-315qye3g.js.map} +1 -1
- package/dist/{chunk-rap5w0x0.js → chunk-31khg3g0.js} +1 -1
- package/dist/{chunk-rap5w0x0.js.map → chunk-31khg3g0.js.map} +1 -1
- package/dist/chunk-45ngkxkp.js.map +1 -1
- package/dist/chunk-48jezz3j.js.map +1 -1
- package/dist/{chunk-vr3j63jq.js → chunk-4jq2bg8t.js} +78 -78
- package/dist/{chunk-vr3j63jq.js.map → chunk-4jq2bg8t.js.map} +4 -4
- package/dist/chunk-4ymrcdbm.js.map +1 -1
- package/dist/chunk-58geavnf.js.map +1 -1
- package/dist/{chunk-6y0mkhex.js → chunk-59kf345w.js} +2 -2
- package/dist/{chunk-6y0mkhex.js.map → chunk-59kf345w.js.map} +1 -1
- package/dist/{chunk-3p93tb91.js → chunk-6qn7nmd3.js} +102 -102
- package/dist/{chunk-3p93tb91.js.map → chunk-6qn7nmd3.js.map} +4 -4
- package/dist/chunk-73j0v4qv.js +355 -0
- package/dist/chunk-73j0v4qv.js.map +13 -0
- package/dist/{chunk-2gjj5dx3.js → chunk-78ymxrn0.js} +1 -1
- package/dist/{chunk-6bkbyer5.js → chunk-7ex2p3zp.js} +3 -3
- package/dist/{chunk-6bkbyer5.js.map → chunk-7ex2p3zp.js.map} +1 -1
- package/dist/{chunk-5tfev0fv.js → chunk-7hf6tkgs.js} +167 -167
- package/dist/{chunk-5tfev0fv.js.map → chunk-7hf6tkgs.js.map} +4 -4
- package/dist/{chunk-8z4726jz.js → chunk-7wn5z7mq.js} +10 -10
- package/dist/{chunk-8z4726jz.js.map → chunk-7wn5z7mq.js.map} +2 -2
- package/dist/{chunk-6n69k945.js → chunk-8mb7mt8n.js} +2 -2
- package/dist/chunk-8ncg20rd.js.map +1 -1
- package/dist/{chunk-68wghpdf.js → chunk-8v5a54qz.js} +50 -11
- package/dist/{chunk-68wghpdf.js.map → chunk-8v5a54qz.js.map} +3 -3
- package/dist/{chunk-gqm0b7vd.js → chunk-8v6xzwgr.js} +92 -76
- package/dist/{chunk-gqm0b7vd.js.map → chunk-8v6xzwgr.js.map} +6 -6
- package/dist/{chunk-m36fw8ft.js → chunk-8wsjr52f.js} +1 -1
- package/dist/{chunk-vd1rk42q.js → chunk-8xnz9vvp.js} +4 -4
- package/dist/{chunk-vd1rk42q.js.map → chunk-8xnz9vvp.js.map} +1 -1
- package/dist/chunk-9mab3dvg.js.map +1 -1
- package/dist/chunk-9tc8dxmn.js.map +1 -1
- package/dist/chunk-9x8dybsb.js.map +2 -2
- package/dist/chunk-a3faa34j.js.map +1 -1
- package/dist/{chunk-62a63pr6.js → chunk-axb4ss9a.js} +7 -7
- package/dist/{chunk-62a63pr6.js.map → chunk-axb4ss9a.js.map} +2 -2
- package/dist/{chunk-z3ryd53f.js → chunk-b6ghvap7.js} +35 -11
- package/dist/{chunk-z3ryd53f.js.map → chunk-b6ghvap7.js.map} +3 -3
- package/dist/{chunk-sqfvnvqj.js → chunk-c14ap3s9.js} +2 -2
- package/dist/{chunk-sqfvnvqj.js.map → chunk-c14ap3s9.js.map} +1 -1
- package/dist/{chunk-661ezhks.js → chunk-cbcgs9f7.js} +87 -8
- package/dist/chunk-cbcgs9f7.js.map +11 -0
- package/dist/chunk-cwdzcv37.js.map +1 -1
- package/dist/{chunk-bab05bhg.js → chunk-dgtd0836.js} +1 -1
- package/dist/{chunk-1j6j0rht.js → chunk-e24fvw8g.js} +1 -1
- package/dist/{chunk-1j6j0rht.js.map → chunk-e24fvw8g.js.map} +1 -1
- package/dist/chunk-e5wf5vz0.js.map +1 -1
- package/dist/chunk-eptrvnby.js.map +1 -1
- package/dist/chunk-ey1nk510.js.map +1 -1
- package/dist/{chunk-j936th07.js → chunk-fakrpfy3.js} +58 -58
- package/dist/{chunk-j936th07.js.map → chunk-fakrpfy3.js.map} +5 -5
- package/dist/chunk-fb3feg1e.js.map +1 -1
- package/dist/chunk-ff5xkv0p.js.map +1 -1
- package/dist/chunk-fntqb7qy.js.map +1 -1
- package/dist/{chunk-7ny9mjgm.js → chunk-ft3w5ahs.js} +1 -1
- package/dist/chunk-g663fahq.js.map +1 -1
- package/dist/{chunk-cdk3egjj.js → chunk-h1na2cxc.js} +1 -1
- package/dist/{chunk-cdk3egjj.js.map → chunk-h1na2cxc.js.map} +1 -1
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-24bqx0dx.js → chunk-hn76sanm.js} +1 -1
- package/dist/{chunk-24bqx0dx.js.map → chunk-hn76sanm.js.map} +1 -1
- package/dist/chunk-jmfet9r4.js.map +1 -1
- package/dist/{chunk-bnr4a734.js → chunk-jn3ysaf2.js} +24 -22
- package/dist/{chunk-bnr4a734.js.map → chunk-jn3ysaf2.js.map} +5 -5
- package/dist/{chunk-4y26vs3v.js → chunk-jspskey0.js} +16 -3
- package/dist/chunk-jspskey0.js.map +10 -0
- package/dist/{chunk-r6szek0x.js → chunk-jt3r6thp.js} +2 -135
- package/dist/chunk-jt3r6thp.js.map +10 -0
- package/dist/chunk-kfee1h52.js.map +1 -1
- package/dist/{chunk-qx00vjrj.js → chunk-kwfhd1g0.js} +23 -23
- package/dist/{chunk-qx00vjrj.js.map → chunk-kwfhd1g0.js.map} +4 -4
- package/dist/chunk-m427qgq0.js.map +1 -1
- package/dist/chunk-mbsbxarb.js.map +1 -1
- package/dist/{chunk-et017krg.js → chunk-mdxmt0n3.js} +8657 -8704
- package/dist/{chunk-et017krg.js.map → chunk-mdxmt0n3.js.map} +37 -37
- package/dist/chunk-mmagke4x.js.map +1 -1
- package/dist/{chunk-2x19q6k6.js → chunk-mqx25wwh.js} +319 -154
- package/dist/chunk-mqx25wwh.js.map +18 -0
- package/dist/chunk-mzx71snp.js.map +1 -1
- package/dist/chunk-n8q5j6y5.js.map +1 -1
- package/dist/chunk-npcr0228.js.map +1 -1
- package/dist/{chunk-m2nevja0.js → chunk-phm3c7b9.js} +1 -1
- package/dist/{chunk-m2nevja0.js.map → chunk-phm3c7b9.js.map} +1 -1
- package/dist/chunk-qf954wje.js.map +1 -1
- package/dist/{chunk-65pyhyas.js → chunk-qgvbxfqv.js} +6 -8
- package/dist/{chunk-65pyhyas.js.map → chunk-qgvbxfqv.js.map} +2 -2
- package/dist/{chunk-hk38wahh.js → chunk-qst145py.js} +4 -4
- package/dist/{chunk-hk38wahh.js.map → chunk-qst145py.js.map} +1 -1
- package/dist/{chunk-c844dkwd.js → chunk-qtzftvxa.js} +4 -5
- package/dist/{chunk-c844dkwd.js.map → chunk-qtzftvxa.js.map} +2 -2
- package/dist/chunk-ratkv4zc.js +3 -0
- package/dist/chunk-ratkv4zc.js.map +9 -0
- package/dist/{chunk-nzapm6p0.js → chunk-s3we74h8.js} +1 -2
- package/dist/chunk-s3we74h8.js.map +12 -0
- package/dist/{chunk-0xmt5p5y.js → chunk-t3brw0wd.js} +1 -2
- package/dist/{chunk-0xmt5p5y.js.map → chunk-t3brw0wd.js.map} +2 -2
- package/dist/chunk-t5608tkq.js.map +1 -1
- package/dist/chunk-tdxfsg1c.js.map +1 -1
- package/dist/{chunk-1t6k1avb.js → chunk-tnhqtfea.js} +1 -1
- package/dist/chunk-vhbw5sqm.js.map +1 -1
- package/dist/{chunk-rp9wwk7b.js → chunk-vx4e4zv4.js} +30 -30
- package/dist/{chunk-rp9wwk7b.js.map → chunk-vx4e4zv4.js.map} +4 -4
- package/dist/chunk-waqk73p1.js.map +1 -1
- package/dist/chunk-x0v3jd47.js.map +1 -1
- package/dist/{chunk-yecwnwpq.js → chunk-xm8qgbqm.js} +58 -29
- package/dist/{chunk-yecwnwpq.js.map → chunk-xm8qgbqm.js.map} +7 -7
- package/dist/{chunk-97wr6p2g.js → chunk-y7j6x4h0.js} +8 -8
- package/dist/{chunk-97wr6p2g.js.map → chunk-y7j6x4h0.js.map} +4 -4
- package/dist/{chunk-xe0732g0.js → chunk-yavhtnac.js} +12 -8
- package/dist/{chunk-xe0732g0.js.map → chunk-yavhtnac.js.map} +4 -4
- package/dist/chunk-yd00vzqr.js +3394 -0
- package/dist/chunk-yd00vzqr.js.map +37 -0
- package/dist/{chunk-n9w3n38q.js → chunk-ye5c8016.js} +54 -8
- package/dist/chunk-ye5c8016.js.map +23 -0
- package/dist/chunk-yw9pyg66.js.map +1 -1
- package/dist/{chunk-nydf3dbe.js → chunk-z9mg7wya.js} +37 -20
- package/dist/chunk-z9mg7wya.js.map +13 -0
- package/dist/chunk-zbc929zg.js.map +1 -1
- package/dist/chunk-zhh1jd89.js +290 -0
- package/dist/chunk-zhh1jd89.js.map +10 -0
- package/dist/connectors/connections/authorizations.d.ts +2 -2
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/connections/tokens.d.ts +2 -2
- package/dist/connectors/connections/tokens.d.ts.map +1 -1
- package/dist/connectors/connections/validation.d.ts +5 -0
- package/dist/connectors/connections/validation.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +9 -2
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/write.js +3 -3
- package/dist/deploy/internal.js +2 -5
- package/dist/deploy/internal.js.map +3 -3
- package/dist/deploy/types.d.ts +0 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/execution/agent.d.ts +2 -2
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +38 -38
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/primitive.js +35 -35
- package/dist/execution/request.js +37 -37
- package/dist/execution/request.js.map +2 -2
- package/dist/http/api-routes.d.ts +12 -11
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -51
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +3 -3
- package/dist/logging/internal.js +1 -1
- package/dist/materializer/index.js +17 -17
- package/dist/models/execution/errors.d.ts +5 -0
- package/dist/models/execution/errors.d.ts.map +1 -1
- package/dist/models/execution/index.d.ts +2 -1
- package/dist/models/execution/index.d.ts.map +1 -1
- package/dist/models/execution/index.js +55 -50
- package/dist/models/execution/index.js.map +1 -1
- package/dist/models/execution/model-call-recorder.d.ts +7 -2
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
- package/dist/models/execution.d.ts.map +1 -1
- package/dist/models/language-call.d.ts +51 -0
- package/dist/models/language-call.d.ts.map +1 -0
- package/dist/objects/index.js +35 -35
- package/dist/objects/query/index.js +17 -17
- package/dist/ontology/docs-markdown.d.ts.map +1 -1
- package/dist/ontology/index.d.ts +1 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +4 -4
- package/dist/ontology/internal.js +8 -275
- package/dist/ontology/internal.js.map +3 -4
- package/dist/ontology/user-ref.d.ts +21 -3
- package/dist/ontology/user-ref.d.ts.map +1 -1
- package/dist/pipelines/index.js +19 -19
- package/dist/projections/builders.d.ts +13 -2
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +1 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.js +17 -17
- package/dist/projections/types.d.ts +7 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts +2 -0
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/query.js +2 -2
- package/dist/queues/in-memory.d.ts +0 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +0 -8
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/internal.js +23 -23
- package/dist/runtime/internal.js.map +1 -1
- package/dist/sandboxes/configuration.d.ts +4 -6
- package/dist/sandboxes/configuration.d.ts.map +1 -1
- package/dist/sandboxes/environment.d.ts.map +1 -1
- package/dist/sandboxes/exec.d.ts +5 -3
- package/dist/sandboxes/exec.d.ts.map +1 -1
- package/dist/sandboxes/guest-credentials.d.ts +61 -0
- package/dist/sandboxes/guest-credentials.d.ts.map +1 -0
- package/dist/sandboxes/index.d.ts +2 -0
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +23 -9
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/sandboxes/sandbox.d.ts +18 -4
- package/dist/sandboxes/sandbox.d.ts.map +1 -1
- package/dist/security/internal.js +1 -1
- package/dist/security/internal.js.map +1 -1
- package/dist/shares/internal.js +17 -17
- package/dist/shares/internal.js.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +3 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +1 -1
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +6 -0
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +8 -2
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +63 -7
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +2 -2
- package/dist/storage/connector-connections/provider.js.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +9 -9
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +15 -15
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/share-grants/provider.js +3 -3
- package/dist/storage/types.d.ts +1 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +9 -9
- package/dist/syncs/index.js +20 -20
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +677 -352
- package/dist/testing/index.js.map +9 -7
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/sandbox-credentials-contract.d.ts +27 -0
- package/dist/testing/sandbox-credentials-contract.d.ts.map +1 -0
- package/dist/testing/sandboxes-contract.d.ts.map +1 -1
- package/dist/testing/users.d.ts +20 -0
- package/dist/testing/users.d.ts.map +1 -0
- package/dist/users/execution.d.ts +6 -2
- package/dist/users/execution.d.ts.map +1 -1
- package/dist/users/index.d.ts +1 -1
- package/dist/users/index.d.ts.map +1 -1
- package/dist/webhooks/internal.js +17 -17
- package/dist/webhooks/internal.js.map +1 -1
- package/dist/workers/index.js.map +1 -1
- package/dist/workflows/index.js +41 -39
- package/dist/workflows/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/README.md +136 -0
- package/src/agents/attachment-keys.ts +83 -0
- package/src/agents/cancel.ts +16 -1
- package/src/agents/children.ts +5 -3
- package/src/agents/dispatch.ts +6 -58
- package/src/agents/execution.ts +18 -0
- package/src/agents/index.ts +127 -21
- package/src/agents/model-loop.ts +23 -73
- package/src/agents/model-routing.ts +7 -2
- package/src/agents/request.ts +69 -20
- package/src/agents/run-after-finish.ts +133 -0
- package/src/agents/run-artifacts.ts +257 -0
- package/src/agents/run-events.ts +302 -0
- package/src/agents/run-fence.ts +71 -0
- package/src/agents/run-liveness.ts +122 -0
- package/src/agents/run-plan.ts +316 -0
- package/src/agents/run-session-children.ts +303 -0
- package/src/agents/run-session-http.ts +397 -0
- package/src/agents/run-session-serve.ts +479 -0
- package/src/agents/run-session-wire.ts +189 -0
- package/src/agents/run-session.ts +802 -0
- package/src/agents/run-token.ts +124 -0
- package/src/agents/run-tools.ts +180 -0
- package/src/agents/run-turn.ts +265 -0
- package/src/agents/streams/internal.ts +0 -1
- package/src/agents/streams/protocol.ts +0 -292
- package/src/agents/subagent-runs.ts +19 -1
- package/src/agents/tool-files.ts +225 -0
- package/src/agents/workflow-node-session.ts +387 -0
- package/src/artifacts/publish/index.ts +1 -0
- package/src/connectors/connections/authorizations.ts +3 -2
- package/src/connectors/connections/service.ts +5 -1
- package/src/connectors/connections/tokens.ts +41 -5
- package/src/connectors/connections/validation.ts +21 -0
- package/src/connectors/types.ts +12 -2
- package/src/deploy/types.ts +0 -2
- package/src/deploy/validation.ts +1 -4
- package/src/execution/agent.ts +2 -2
- package/src/execution/authorized-object-reader.ts +28 -1
- package/src/http/api-routes.ts +114 -27
- package/src/index.ts +3 -1
- package/src/models/execution/README.md +15 -1
- package/src/models/execution/errors.ts +14 -0
- package/src/models/execution/index.ts +2 -1
- package/src/models/execution/model-call-recorder.ts +12 -10
- package/src/models/execution.ts +9 -11
- package/src/models/language-call.ts +247 -0
- package/src/ontology/docs-markdown.ts +14 -0
- package/src/ontology/index.ts +1 -1
- package/src/ontology/user-ref.ts +40 -6
- package/src/projections/builders.ts +48 -4
- package/src/projections/index.ts +1 -0
- package/src/projections/registry.ts +1 -0
- package/src/projections/revision.ts +10 -0
- package/src/projections/types.ts +8 -0
- package/src/projections/validation.ts +52 -6
- package/src/queues/in-memory.ts +0 -5
- package/src/queues/index.ts +0 -2
- package/src/queues/types.ts +0 -13
- package/src/runtime/host.ts +1 -1
- package/src/sandboxes/README.md +17 -6
- package/src/sandboxes/configuration.ts +7 -9
- package/src/sandboxes/environment.ts +1 -0
- package/src/sandboxes/exec.ts +17 -9
- package/src/sandboxes/guest-credentials.ts +262 -0
- package/src/sandboxes/index.ts +14 -0
- package/src/sandboxes/sandbox.ts +19 -4
- package/src/storage/agents/in-memory.ts +53 -0
- package/src/storage/agents/index.ts +2 -0
- package/src/storage/agents/provider.ts +56 -11
- package/src/storage/agents/types.ts +59 -7
- package/src/storage/index.ts +2 -0
- package/src/storage/types.ts +1 -0
- package/src/testing/agent-storage-contract.ts +175 -2
- package/src/testing/ai-model-call-groups-contract.ts +0 -1
- package/src/testing/index.ts +5 -0
- package/src/testing/queues-contract.ts +0 -16
- package/src/testing/sandbox-credentials-contract.ts +284 -0
- package/src/testing/sandboxes-contract.ts +21 -0
- package/src/testing/users.ts +39 -0
- package/src/users/execution.ts +33 -7
- package/src/users/index.ts +7 -1
- package/dist/agents/api-gateway.d.ts +0 -26
- package/dist/agents/api-gateway.d.ts.map +0 -1
- package/dist/chunk-2x19q6k6.js.map +0 -17
- package/dist/chunk-4y26vs3v.js.map +0 -10
- package/dist/chunk-661ezhks.js.map +0 -11
- package/dist/chunk-d2m879s4.js.map +0 -12
- package/dist/chunk-n9w3n38q.js.map +0 -23
- package/dist/chunk-nydf3dbe.js.map +0 -13
- package/dist/chunk-nzapm6p0.js.map +0 -12
- package/dist/chunk-r6szek0x.js.map +0 -10
- package/dist/chunk-vabga7fk.js +0 -176
- package/dist/chunk-vabga7fk.js.map +0 -12
- package/dist/chunk-vpgwq5nf.js +0 -810
- package/dist/chunk-vpgwq5nf.js.map +0 -21
- package/src/agents/api-gateway.ts +0 -68
- /package/dist/{chunk-2gjj5dx3.js.map → chunk-78ymxrn0.js.map} +0 -0
- /package/dist/{chunk-6n69k945.js.map → chunk-8mb7mt8n.js.map} +0 -0
- /package/dist/{chunk-m36fw8ft.js.map → chunk-8wsjr52f.js.map} +0 -0
- /package/dist/{chunk-bab05bhg.js.map → chunk-dgtd0836.js.map} +0 -0
- /package/dist/{chunk-7ny9mjgm.js.map → chunk-ft3w5ahs.js.map} +0 -0
- /package/dist/{chunk-1t6k1avb.js.map → chunk-tnhqtfea.js.map} +0 -0
package/src/http/api-routes.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* The single source of truth for the Sixb HTTP API surface and its auth capabilities.
|
|
3
3
|
*
|
|
4
4
|
* Two views are derived from this one table:
|
|
5
|
-
* - `AGENT_API_ROUTES` (@sixb/core
|
|
5
|
+
* - `AGENT_API_ROUTES` (@sixb/core run tokens) = the `agentApi` rows, projected to {method, path}.
|
|
6
6
|
* - `ACCESS_TOKEN_ROUTES` (@sixb/server bearer boundary) = the `accessToken` rows, with operationId.
|
|
7
7
|
*
|
|
8
|
-
* Because both views are projections of this table,
|
|
8
|
+
* Because both views are projections of this table, what a run token may call is structurally a
|
|
9
9
|
* subset of the bearer boundary — the invariant below enforces `agentApi ⇒ accessToken` at load
|
|
10
10
|
* time. This table lives in @sixb/core (never @sixb/server) because @sixb/server depends on core,
|
|
11
11
|
* not the reverse; the operationId strings are opaque here.
|
|
@@ -17,11 +17,11 @@ export interface SixbApiRoute {
|
|
|
17
17
|
readonly path: string
|
|
18
18
|
/** The route accepts a bearer access token (enforced by the server access-token boundary). */
|
|
19
19
|
readonly accessToken: boolean
|
|
20
|
-
/**
|
|
20
|
+
/** A run token may call the route (a strict subset of the accessToken routes). */
|
|
21
21
|
readonly agentApi: boolean
|
|
22
22
|
/**
|
|
23
|
-
* What the route changes when the Agent calls it, for every `agentApi` route but a GET.
|
|
24
|
-
*
|
|
23
|
+
* What the route changes when the Agent calls it, for every `agentApi` route but a GET. A run
|
|
24
|
+
* token's `action` and `workflow` calls wait for the requester's approval when their mode asks.
|
|
25
25
|
*/
|
|
26
26
|
readonly agentEffect?: AgentApiEffect
|
|
27
27
|
/** The canonical handler may run under an explicitly selected shared session. */
|
|
@@ -30,9 +30,17 @@ export interface SixbApiRoute {
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* `read` changes nothing (a read sent as POST); `memory` writes the Agent's own notes; `file` stores
|
|
33
|
-
* a blob nothing points at yet; `model` costs what AI limits already bound
|
|
33
|
+
* a blob nothing points at yet; `model` costs what AI limits already bound; `artifact` publishes
|
|
34
|
+
* into the run's conversation.
|
|
34
35
|
*/
|
|
35
|
-
export type AgentApiEffect =
|
|
36
|
+
export type AgentApiEffect =
|
|
37
|
+
| "read"
|
|
38
|
+
| "action"
|
|
39
|
+
| "workflow"
|
|
40
|
+
| "memory"
|
|
41
|
+
| "file"
|
|
42
|
+
| "model"
|
|
43
|
+
| "artifact"
|
|
36
44
|
|
|
37
45
|
export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
38
46
|
{
|
|
@@ -230,8 +238,8 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
|
230
238
|
},
|
|
231
239
|
// The four write routes. Bearer-capable because their execution facade enforces authorization
|
|
232
240
|
// (`edit:object` / `append:telemetry`), which is exactly the precondition this table requires.
|
|
233
|
-
// NOT
|
|
234
|
-
//
|
|
241
|
+
// NOT open to run tokens: letting an agent turn write objects on its own is a separate decision,
|
|
242
|
+
// and a run token's request already runs as its run, so flipping `agentApi` later needs no
|
|
235
243
|
// authorization work — only that decision.
|
|
236
244
|
{
|
|
237
245
|
operationId: "upsertObject",
|
|
@@ -295,10 +303,8 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
|
295
303
|
sharedSession: true,
|
|
296
304
|
},
|
|
297
305
|
{
|
|
298
|
-
// Bearer-capable (CLI/programmatic existence + range probes) but NOT
|
|
299
|
-
//
|
|
300
|
-
// size already travels in its FileRef). Keeping this agentApi:true would throw at gateway
|
|
301
|
-
// registration ("Unsupported agent API gateway method 'HEAD'") and stop the server booting.
|
|
306
|
+
// Bearer-capable (CLI/programmatic existence + range probes) but NOT open to run tokens: an
|
|
307
|
+
// agent gains nothing from HEAD over GET (a file's size already travels in its FileRef).
|
|
302
308
|
operationId: "headObjectFileContent",
|
|
303
309
|
method: "HEAD",
|
|
304
310
|
path: "/api/objects/:objectTypeId/:objectId/files/content",
|
|
@@ -477,7 +483,7 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
|
477
483
|
agentApi: false,
|
|
478
484
|
},
|
|
479
485
|
// The Agent reads and saves its memory with `sixb memory` in its sandbox. Its history and deleting
|
|
480
|
-
// a repo are for people, so
|
|
486
|
+
// a repo are for people, so run tokens can't reach them.
|
|
481
487
|
{
|
|
482
488
|
operationId: "getAgentMemory",
|
|
483
489
|
method: "GET",
|
|
@@ -507,28 +513,29 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
|
507
513
|
accessToken: true,
|
|
508
514
|
agentApi: false,
|
|
509
515
|
},
|
|
510
|
-
// Artifacts are reachable with an access token, so the CLI and integrations can publish them.
|
|
511
|
-
//
|
|
516
|
+
// Artifacts are reachable with an access token, so the CLI and integrations can publish them. A
|
|
517
|
+
// run token reads them as the run's requester, and publishes into the run's conversation.
|
|
512
518
|
{
|
|
513
519
|
operationId: "listArtifacts",
|
|
514
520
|
method: "GET",
|
|
515
521
|
path: "/api/artifacts",
|
|
516
522
|
accessToken: true,
|
|
517
|
-
agentApi:
|
|
523
|
+
agentApi: true,
|
|
518
524
|
},
|
|
519
525
|
{
|
|
520
526
|
operationId: "createArtifact",
|
|
521
527
|
method: "POST",
|
|
522
528
|
path: "/api/artifacts",
|
|
523
529
|
accessToken: true,
|
|
524
|
-
agentApi:
|
|
530
|
+
agentApi: true,
|
|
531
|
+
agentEffect: "artifact",
|
|
525
532
|
},
|
|
526
533
|
{
|
|
527
534
|
operationId: "getArtifact",
|
|
528
535
|
method: "GET",
|
|
529
536
|
path: "/api/artifacts/:artifactId",
|
|
530
537
|
accessToken: true,
|
|
531
|
-
agentApi:
|
|
538
|
+
agentApi: true,
|
|
532
539
|
},
|
|
533
540
|
{
|
|
534
541
|
operationId: "deleteArtifact",
|
|
@@ -570,21 +577,22 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
|
570
577
|
method: "POST",
|
|
571
578
|
path: "/api/artifacts/:artifactId/versions",
|
|
572
579
|
accessToken: true,
|
|
573
|
-
agentApi:
|
|
580
|
+
agentApi: true,
|
|
581
|
+
agentEffect: "artifact",
|
|
574
582
|
},
|
|
575
583
|
{
|
|
576
584
|
operationId: "getArtifactVersion",
|
|
577
585
|
method: "GET",
|
|
578
586
|
path: "/api/artifacts/:artifactId/versions/:version",
|
|
579
587
|
accessToken: true,
|
|
580
|
-
agentApi:
|
|
588
|
+
agentApi: true,
|
|
581
589
|
},
|
|
582
590
|
{
|
|
583
591
|
operationId: "getArtifactQuery",
|
|
584
592
|
method: "GET",
|
|
585
593
|
path: "/api/artifacts/:artifactId/versions/:version/queries/:name",
|
|
586
594
|
accessToken: true,
|
|
587
|
-
agentApi:
|
|
595
|
+
agentApi: true,
|
|
588
596
|
},
|
|
589
597
|
{
|
|
590
598
|
operationId: "createArtifactFrame",
|
|
@@ -598,7 +606,7 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
|
598
606
|
method: "GET",
|
|
599
607
|
path: "/api/artifacts/:artifactId/versions/:version/content",
|
|
600
608
|
accessToken: true,
|
|
601
|
-
agentApi:
|
|
609
|
+
agentApi: true,
|
|
602
610
|
},
|
|
603
611
|
{
|
|
604
612
|
operationId: "headArtifactFileContent",
|
|
@@ -703,6 +711,85 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
|
703
711
|
accessToken: true,
|
|
704
712
|
agentApi: true,
|
|
705
713
|
},
|
|
714
|
+
// Data reads, for people and agents alike: datasets need dataset.view and redact marked columns;
|
|
715
|
+
// syncs and pipelines list only what the caller may run. Running them stays session-only.
|
|
716
|
+
{
|
|
717
|
+
operationId: "listDatasets",
|
|
718
|
+
method: "GET",
|
|
719
|
+
path: "/api/datasets",
|
|
720
|
+
accessToken: true,
|
|
721
|
+
agentApi: true,
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
operationId: "getDataset",
|
|
725
|
+
method: "GET",
|
|
726
|
+
path: "/api/datasets/:datasetId",
|
|
727
|
+
accessToken: true,
|
|
728
|
+
agentApi: true,
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
operationId: "listDatasetVersions",
|
|
732
|
+
method: "GET",
|
|
733
|
+
path: "/api/datasets/:datasetId/versions",
|
|
734
|
+
accessToken: true,
|
|
735
|
+
agentApi: true,
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
operationId: "listDatasetRows",
|
|
739
|
+
method: "GET",
|
|
740
|
+
path: "/api/datasets/:datasetId/rows",
|
|
741
|
+
accessToken: true,
|
|
742
|
+
agentApi: true,
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
operationId: "listSyncs",
|
|
746
|
+
method: "GET",
|
|
747
|
+
path: "/api/syncs",
|
|
748
|
+
accessToken: true,
|
|
749
|
+
agentApi: true,
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
operationId: "getSync",
|
|
753
|
+
method: "GET",
|
|
754
|
+
path: "/api/syncs/:syncId",
|
|
755
|
+
accessToken: true,
|
|
756
|
+
agentApi: true,
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
operationId: "listSyncRuns",
|
|
760
|
+
method: "GET",
|
|
761
|
+
path: "/api/sync-runs",
|
|
762
|
+
accessToken: true,
|
|
763
|
+
agentApi: true,
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
operationId: "listPipelines",
|
|
767
|
+
method: "GET",
|
|
768
|
+
path: "/api/pipelines",
|
|
769
|
+
accessToken: true,
|
|
770
|
+
agentApi: true,
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
operationId: "getPipeline",
|
|
774
|
+
method: "GET",
|
|
775
|
+
path: "/api/pipelines/:pipelineId",
|
|
776
|
+
accessToken: true,
|
|
777
|
+
agentApi: true,
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
operationId: "listPipelineRuns",
|
|
781
|
+
method: "GET",
|
|
782
|
+
path: "/api/pipeline-runs",
|
|
783
|
+
accessToken: true,
|
|
784
|
+
agentApi: true,
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
operationId: "getPipelineRun",
|
|
788
|
+
method: "GET",
|
|
789
|
+
path: "/api/pipeline-runs/:runId",
|
|
790
|
+
accessToken: true,
|
|
791
|
+
agentApi: true,
|
|
792
|
+
},
|
|
706
793
|
{
|
|
707
794
|
operationId: "listModels",
|
|
708
795
|
method: "GET",
|
|
@@ -829,10 +916,10 @@ export const SIXB_API_ROUTES: readonly SixbApiRoute[] = [
|
|
|
829
916
|
]
|
|
830
917
|
|
|
831
918
|
/**
|
|
832
|
-
* The table's invariants, enforced at module load. A
|
|
833
|
-
* route, or
|
|
834
|
-
*
|
|
835
|
-
*
|
|
919
|
+
* The table's invariants, enforced at module load. A route open to run tokens must also be a bearer
|
|
920
|
+
* route, or run tokens would reach a surface the access-token boundary does not recognize. One that
|
|
921
|
+
* can change state names what it changes, so a route added later cannot skip the approval gate by
|
|
922
|
+
* accident.
|
|
836
923
|
*/
|
|
837
924
|
export function assertSixbApiRoutes(routes: readonly SixbApiRoute[]): void {
|
|
838
925
|
for (const route of routes) {
|
package/src/index.ts
CHANGED
|
@@ -45,6 +45,7 @@ export type {
|
|
|
45
45
|
SchemaOrRef,
|
|
46
46
|
SixbObjectTypeMap,
|
|
47
47
|
SixbValueTypeMap,
|
|
48
|
+
UserEmailColumn,
|
|
48
49
|
UserRef,
|
|
49
50
|
ValueType,
|
|
50
51
|
ValueTypeRefSchema,
|
|
@@ -445,7 +446,7 @@ export type {
|
|
|
445
446
|
// ── Member directory ──────────────────────────────────────
|
|
446
447
|
|
|
447
448
|
export type { UserStatus } from "./storage"
|
|
448
|
-
export type { ListUsersInput, UserProfile, UsersPage, UsersRuntime } from "./users"
|
|
449
|
+
export type { ListUsersInput, UserLookup, UserProfile, UsersPage, UsersRuntime } from "./users"
|
|
449
450
|
|
|
450
451
|
// ── Security Definitions ───────────────────────────────────
|
|
451
452
|
|
|
@@ -1351,6 +1352,7 @@ export type {
|
|
|
1351
1352
|
ProjectionForeignKeyInput,
|
|
1352
1353
|
ProjectionTarget,
|
|
1353
1354
|
ProjectionTargetByKind,
|
|
1355
|
+
ProjectionUserKey,
|
|
1354
1356
|
SourceEditConflictResolution,
|
|
1355
1357
|
TelemetryProjectionDefinition,
|
|
1356
1358
|
TelemetryProjectionPropertyMapping,
|
|
@@ -10,6 +10,20 @@ uses the durable execution's requester-group snapshot, so redelivery cannot chan
|
|
|
10
10
|
Language execution and the scoped embedding catalog share that recorder and its failure state.
|
|
11
11
|
Object authorization happens before embedding inference; wrapping a catalog does not grant access.
|
|
12
12
|
|
|
13
|
+
## Language flow
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
recorder.wrapModel(model).stream(request)
|
|
17
|
+
→ admit the call: reserve capacity before the provider sees it
|
|
18
|
+
→ provider stream, handed on event by event (reportModelCalls, ../language-call.ts)
|
|
19
|
+
→ at its finish: record usage and valuation, then pass the finish on
|
|
20
|
+
→ cancelled, failed or unfinished: record it with its usage unknown
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The model records each call itself, whoever reads its stream: the Agent's loop, direct generation,
|
|
24
|
+
or a server that streams it to a remote runner. A call whose record cannot be written fails before
|
|
25
|
+
its reader sees it finish, and the record goes to recovery.
|
|
26
|
+
|
|
13
27
|
## Embedding flow
|
|
14
28
|
|
|
15
29
|
```text
|
|
@@ -44,7 +58,7 @@ replays accounting only, never inference; see the
|
|
|
44
58
|
[worker recovery contract](../../../../agent-worker/docs/usage-accounting.md).
|
|
45
59
|
|
|
46
60
|
An Agent run binds its own recorder to its SDK, so calls from its tools share the run's admission,
|
|
47
|
-
failure state and cancellation. A request
|
|
61
|
+
failure state and cancellation. A request with the run's token is served by the server,
|
|
48
62
|
not by the run's worker: it gets its own recorder on the run's execution and current attempt, and
|
|
49
63
|
only its own request cancels it. Direct provider calls bypass this session. Webhook handlers have no
|
|
50
64
|
bound model execution attempt; they must dispatch an action for accounted calls. A process crash
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isSixbError } from "../../errors/internal"
|
|
2
|
+
|
|
1
3
|
/** A provider call was not recorded synchronously, so its execution must stop. */
|
|
2
4
|
export class ModelUsageRecordingError extends Error {
|
|
3
5
|
readonly name = "ModelUsageRecordingError"
|
|
@@ -16,3 +18,15 @@ export class ModelUsageRecordingError extends Error {
|
|
|
16
18
|
)
|
|
17
19
|
}
|
|
18
20
|
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A model call refused or left unrecorded by the run's accounting: its AI limits refused it, or its
|
|
24
|
+
* record could not be written. The run ends with this failure, never one that relabels it.
|
|
25
|
+
*/
|
|
26
|
+
export function isModelCallAccountingFailure(error: unknown): boolean {
|
|
27
|
+
return (
|
|
28
|
+
error instanceof ModelUsageRecordingError ||
|
|
29
|
+
(isSixbError(error) &&
|
|
30
|
+
(error.code === "ai.usage_limit_exceeded" || error.code === "ai.usage_limit_unavailable"))
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -3,8 +3,9 @@ export {
|
|
|
3
3
|
isLanguageModelTier,
|
|
4
4
|
selectLanguageModel,
|
|
5
5
|
} from "../catalog"
|
|
6
|
+
export { reportModelCalls } from "../language-call"
|
|
6
7
|
export { resolveLanguageModel } from "../resolve"
|
|
7
|
-
export { ModelUsageRecordingError } from "./errors"
|
|
8
|
+
export { isModelCallAccountingFailure, ModelUsageRecordingError } from "./errors"
|
|
8
9
|
export type {
|
|
9
10
|
AiModelCallAdmissionDecision,
|
|
10
11
|
AiModelCallAdmissionInput,
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type RecordAiModelCallInput,
|
|
7
7
|
} from "../../storage"
|
|
8
8
|
import type { ModelCallEndEvent, ModelUsage } from "../events"
|
|
9
|
+
import { reportModelCalls } from "../language-call"
|
|
9
10
|
import type { LanguageModel } from "../language-model"
|
|
10
11
|
import { ModelUsageRecordingError } from "./errors"
|
|
11
12
|
import {
|
|
@@ -48,7 +49,7 @@ interface AiModelCallRecorderInternals {
|
|
|
48
49
|
readonly recordAccounting?: (input: RecoverAiModelCallInput) => Promise<void>
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
/**
|
|
52
|
+
/** Admit every model call against the execution's limits, and record each before it is over. */
|
|
52
53
|
export class AiModelCallRecorder {
|
|
53
54
|
private readonly generateId: () => string
|
|
54
55
|
private readonly now: () => Date
|
|
@@ -85,16 +86,17 @@ export class AiModelCallRecorder {
|
|
|
85
86
|
return this.input.attempt
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Wrap the resolved model so every call it makes is admitted against the execution's limits and
|
|
91
|
+
* records itself: the wrapper reads the stream it hands on, and records the call when it finishes,
|
|
92
|
+
* before its `finish` event reaches the reader, or when it ends otherwise, its usage unknown. Who
|
|
93
|
+
* reads the stream never reports what the call used.
|
|
94
|
+
*/
|
|
89
95
|
wrapModel(model: LanguageModel): LanguageModel {
|
|
96
|
+
const recorded = reportModelCalls(model, this.onModelCallEnd)
|
|
97
|
+
// Its settings carried over, which whoever calls the model reads.
|
|
90
98
|
return {
|
|
91
|
-
|
|
92
|
-
modelId: model.modelId,
|
|
93
|
-
definition: model.definition,
|
|
94
|
-
costEstimator: model.costEstimator,
|
|
95
|
-
...(model.validateResponseFormat === undefined
|
|
96
|
-
? {}
|
|
97
|
-
: { validateResponseFormat: model.validateResponseFormat.bind(model) }),
|
|
99
|
+
...recorded,
|
|
98
100
|
stream: async (request) => {
|
|
99
101
|
this.assertHealthy()
|
|
100
102
|
const inputTokens = estimateAiModelCallInputTokens({
|
|
@@ -113,7 +115,7 @@ export class AiModelCallRecorder {
|
|
|
113
115
|
estimatedTotalTokens: estimatedAiModelCallTotalTokens(inputTokens, outputTokenAllowance),
|
|
114
116
|
})
|
|
115
117
|
try {
|
|
116
|
-
return await
|
|
118
|
+
return await recorded.stream(request)
|
|
117
119
|
} catch (error) {
|
|
118
120
|
await this.markCallUnknown(request.callId)
|
|
119
121
|
throw error
|
package/src/models/execution.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto"
|
|
1
2
|
import { runModelLoop } from "../agents/model-loop"
|
|
2
3
|
import { assertModelAccess, canAccessModels } from "../authorization"
|
|
3
4
|
import type { BlobStorage } from "../blob-storage/types"
|
|
@@ -8,7 +9,6 @@ import { createModelCallsRuntime, type ModelCallRunVisibility } from "./calls"
|
|
|
8
9
|
import { type ModelCatalog, selectLanguageModel } from "./catalog"
|
|
9
10
|
import { createDecisionRuntime } from "./decision/runtime"
|
|
10
11
|
import { ModelProviderError, ModelStreamError, UnsupportedModelFeatureError } from "./errors"
|
|
11
|
-
import type { ModelCallEndEvent } from "./events"
|
|
12
12
|
import { registerModelExecutionBinding } from "./execution/binding"
|
|
13
13
|
import { aiModelCallOutputTokenAllowance } from "./execution/model-call-admission"
|
|
14
14
|
import type { ModelExecutionSession } from "./execution/session"
|
|
@@ -85,9 +85,11 @@ export function createModelsRuntime(
|
|
|
85
85
|
const accounting = await session.accounting()
|
|
86
86
|
accounting.assertHealthy()
|
|
87
87
|
signal.throwIfAborted()
|
|
88
|
-
|
|
88
|
+
// The wrapped model records the call; its one step says what the call used and cost.
|
|
89
|
+
const callId = `model_call_${randomUUID()}`
|
|
89
90
|
const options = {
|
|
90
91
|
model: accounting.wrapModel(model),
|
|
92
|
+
generateCallId: () => callId,
|
|
91
93
|
messages,
|
|
92
94
|
maxSteps: 1,
|
|
93
95
|
rejectLocalToolCalls: true,
|
|
@@ -95,10 +97,6 @@ export function createModelsRuntime(
|
|
|
95
97
|
reasoning,
|
|
96
98
|
caching: input.caching,
|
|
97
99
|
signal,
|
|
98
|
-
onModelCallEnd: async (completed: ModelCallEndEvent) => {
|
|
99
|
-
await accounting.onModelCallEnd(completed)
|
|
100
|
-
event = completed
|
|
101
|
-
},
|
|
102
100
|
}
|
|
103
101
|
const result = output ? await runModelLoop({ ...options, output }) : await runModelLoop(options)
|
|
104
102
|
if (result.status === "aborted") {
|
|
@@ -112,13 +110,13 @@ export function createModelsRuntime(
|
|
|
112
110
|
model.modelId
|
|
113
111
|
)
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
const [step] = result.steps
|
|
114
|
+
if (!step) throw new ModelStreamError("[SixbModels] Generation completed without a model call.")
|
|
117
115
|
return {
|
|
118
116
|
output: result.output,
|
|
119
|
-
usage:
|
|
120
|
-
cost:
|
|
121
|
-
callId
|
|
117
|
+
usage: step.usage,
|
|
118
|
+
cost: step.cost,
|
|
119
|
+
callId,
|
|
122
120
|
finishReason: result.finishReason,
|
|
123
121
|
}
|
|
124
122
|
}
|