@sixb/core 0.1.24 → 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 +6 -3
- package/dist/artifacts/frames/index.js.map +3 -3
- package/dist/artifacts/frames/probe.d.ts.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/frames/probe.ts +14 -1
- 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
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { captureSixbFailure, withFailureMessage } from "../errors/internal"
|
|
2
|
+
import { AGENT_RUN_FAILURE_CODES, type AgentRunRecord } from "../storage/agents"
|
|
3
|
+
import { AgentExecutionLostError } from "./run-fence"
|
|
4
|
+
import { type AgentRunSessionHost, claimAgentRun } from "./run-session"
|
|
5
|
+
|
|
6
|
+
// A run is held by whoever renews its lease. Once the lease recorded on the run lapses, its run
|
|
7
|
+
// token fails closed and nothing may write to it any more, so the run can be ended here: by a
|
|
8
|
+
// redelivered queue job, by a worker's repair pass, or by a server that runs no queue at all.
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The runner running a turn or child stopped, or died, before finishing it. The run is recorded
|
|
12
|
+
* `cancelled` with `finishReason: "interrupted"` rather than replayed: the user already saw it
|
|
13
|
+
* stream and its model calls were billed, so running it again is their call.
|
|
14
|
+
*/
|
|
15
|
+
export class AgentTurnInterruptedError extends Error {
|
|
16
|
+
readonly name = "AgentTurnInterruptedError"
|
|
17
|
+
constructor(readonly runId: string) {
|
|
18
|
+
super(`[Sixb] Agent run '${runId}' was interrupted when the worker running it stopped.`)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* What a run that stopped with its runner records. A child's tells its parent what to do about it:
|
|
24
|
+
* nothing replays it.
|
|
25
|
+
*/
|
|
26
|
+
export function interruptedError(run: AgentRunRecord): AgentTurnInterruptedError {
|
|
27
|
+
return run.kind === "subagent"
|
|
28
|
+
? withFailureMessage(
|
|
29
|
+
new AgentTurnInterruptedError(run.id),
|
|
30
|
+
"The subagent stopped when the worker running it did. Spawn it again with a new key if its answer is still needed: what it already changed stays changed."
|
|
31
|
+
)
|
|
32
|
+
: new AgentTurnInterruptedError(run.id)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Whether the lease last recorded on a running run has run out. */
|
|
36
|
+
export function agentRunLeaseLapsed(run: AgentRunRecord, now = Date.now()): boolean {
|
|
37
|
+
return (
|
|
38
|
+
run.status === "running" &&
|
|
39
|
+
run.execution !== undefined &&
|
|
40
|
+
run.execution.queueLeaseExpiresAt.getTime() <= now
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* End a turn or child that nothing runs any more, as interrupted and without calling the model.
|
|
46
|
+
* Reclaiming it first rotates its execution token, so a runner that is only slow, not gone, can
|
|
47
|
+
* no longer write to it. Returns the ended run, or null when it ended or moved meanwhile.
|
|
48
|
+
*
|
|
49
|
+
* `leaseMs` bounds the claim this makes, which lasts only as long as recording the end.
|
|
50
|
+
*/
|
|
51
|
+
export async function endInterruptedAgentRun(
|
|
52
|
+
host: AgentRunSessionHost,
|
|
53
|
+
run: AgentRunRecord,
|
|
54
|
+
leaseMs: number
|
|
55
|
+
): Promise<AgentRunRecord | null> {
|
|
56
|
+
const session = await claimAgentRun(host, {
|
|
57
|
+
run,
|
|
58
|
+
leaseExpiresAt: new Date(Date.now() + leaseMs).toISOString(),
|
|
59
|
+
})
|
|
60
|
+
if (!session) return null
|
|
61
|
+
await session.close()
|
|
62
|
+
|
|
63
|
+
const completedAt = new Date()
|
|
64
|
+
const error = captureSixbFailure(interruptedError(run), {
|
|
65
|
+
allowedCodes: AGENT_RUN_FAILURE_CODES,
|
|
66
|
+
defaultCode: "runtime.cancelled",
|
|
67
|
+
details:
|
|
68
|
+
run.kind === "conversation"
|
|
69
|
+
? { runId: run.id, threadId: run.threadId }
|
|
70
|
+
: { parentRunId: run.parentRunId, runId: run.id },
|
|
71
|
+
at: completedAt,
|
|
72
|
+
})
|
|
73
|
+
try {
|
|
74
|
+
const ended = await session.finish({
|
|
75
|
+
status: "cancelled",
|
|
76
|
+
error,
|
|
77
|
+
completedAt,
|
|
78
|
+
finishReason: "interrupted",
|
|
79
|
+
})
|
|
80
|
+
await session.events.publishRunFinished(ended)
|
|
81
|
+
return ended
|
|
82
|
+
} catch (failure) {
|
|
83
|
+
if (failure instanceof AgentExecutionLostError) return null
|
|
84
|
+
throw failure
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* End every running turn and child whose lease lapsed. A queue redelivers a dead runner's turn
|
|
90
|
+
* sooner; this is what ends a run no delivery will come back for: one on a computer, a child, or
|
|
91
|
+
* a turn whose end could not be recorded before its job gave up. Returns how many it ended.
|
|
92
|
+
*/
|
|
93
|
+
export async function endLapsedAgentRuns(
|
|
94
|
+
host: AgentRunSessionHost,
|
|
95
|
+
input: { readonly leaseMs: number }
|
|
96
|
+
): Promise<number> {
|
|
97
|
+
let ended = 0
|
|
98
|
+
let offset = 0
|
|
99
|
+
for (;;) {
|
|
100
|
+
const page = await host.storage.agents.runs.list({
|
|
101
|
+
projectId: host.projectId,
|
|
102
|
+
kinds: ["conversation", "subagent"],
|
|
103
|
+
statuses: ["running"],
|
|
104
|
+
order: "asc",
|
|
105
|
+
limit: 100,
|
|
106
|
+
offset,
|
|
107
|
+
})
|
|
108
|
+
const now = Date.now()
|
|
109
|
+
let endedHere = 0
|
|
110
|
+
for (const run of page.runs.filter((candidate) => agentRunLeaseLapsed(candidate, now))) {
|
|
111
|
+
try {
|
|
112
|
+
if (await endInterruptedAgentRun(host, run, input.leaseMs)) endedHere += 1
|
|
113
|
+
} catch (error) {
|
|
114
|
+
console.error(`[Sixb] Could not end lapsed agent run '${run.id}'; retrying later.`, error)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
ended += endedHere
|
|
118
|
+
if (!page.hasMore) return ended
|
|
119
|
+
// Ended runs leave the running set, so the next page starts that much earlier.
|
|
120
|
+
offset += page.runs.length - endedHere
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { createSixbError } from "../errors/internal"
|
|
2
|
+
import type {
|
|
3
|
+
LanguageModelCatalog,
|
|
4
|
+
LanguageModelRef,
|
|
5
|
+
LanguageModelTier,
|
|
6
|
+
ModelCatalog,
|
|
7
|
+
} from "../models/catalog"
|
|
8
|
+
import type { LanguageModelDefinition } from "../models/definitions"
|
|
9
|
+
import type { PropertyClearance } from "../objects/property-clearance"
|
|
10
|
+
import type { OntologyDocsCatalog } from "../ontology/docs"
|
|
11
|
+
import { type RenderedOntologyDocs, renderOntologyDocs } from "../ontology/docs-markdown"
|
|
12
|
+
import type { SixbDefinitions } from "../runtime/definitions"
|
|
13
|
+
import type { Sixb } from "../runtime/sixb"
|
|
14
|
+
import type { AgentRunRecord } from "../storage/agents"
|
|
15
|
+
import { AgentMemoryError } from "./errors"
|
|
16
|
+
import type { AgentMemoryRepoName } from "./memory"
|
|
17
|
+
import type { AgentMemoryRepoView } from "./memory-execution"
|
|
18
|
+
import { type AgentToolSpec, agentToolSpec } from "./run-tools"
|
|
19
|
+
import type { AgentSkillDefinition } from "./skills"
|
|
20
|
+
import type { AgentReasoning } from "./types"
|
|
21
|
+
|
|
22
|
+
// What a run is set up with, as plain data: the project sends it, and the runner's harness, which
|
|
23
|
+
// ships its own prompt, skills and tools, builds the run from it. A runner in the worker reads it
|
|
24
|
+
// in process; one on a computer gets the same answer over HTTP.
|
|
25
|
+
|
|
26
|
+
/** What a conversation's turn or a child is set up with. */
|
|
27
|
+
export interface AgentRunPlan {
|
|
28
|
+
/** The model the run calls. */
|
|
29
|
+
readonly model: LanguageModelRef
|
|
30
|
+
/** The reasoning it asks for, frozen when the run was admitted. */
|
|
31
|
+
readonly reasoning?: AgentReasoning
|
|
32
|
+
/** The project's `SIXB.md`. */
|
|
33
|
+
readonly instructions?: string
|
|
34
|
+
/** The project's Agent Skills; the harness adds its own. */
|
|
35
|
+
readonly skills: readonly AgentSkillDefinition[]
|
|
36
|
+
/** The project tools the run offers, as the model is offered them. */
|
|
37
|
+
readonly tools: readonly AgentToolSpec[]
|
|
38
|
+
/** The models its `sixb` can call beside its own, as its prompt lists them. */
|
|
39
|
+
readonly sandboxModels: readonly SandboxModel[]
|
|
40
|
+
/** The requester's time zone and locale, when the run captured them. */
|
|
41
|
+
readonly timeZone?: string
|
|
42
|
+
readonly locale?: string
|
|
43
|
+
/** Reference docs for the object types its requester can see, from their own view. */
|
|
44
|
+
readonly ontologyDocs: RenderedOntologyDocs
|
|
45
|
+
/** The models a turn can hand a child; a child spawns none. */
|
|
46
|
+
readonly delegation?: AgentRunDelegation
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The project's language models, as a turn chooses one for a child it spawns. */
|
|
50
|
+
export interface AgentRunDelegation {
|
|
51
|
+
/** In catalog order: with tiers, light, standard then heavy. */
|
|
52
|
+
readonly models: readonly AgentRunDelegationModel[]
|
|
53
|
+
/** The project default, for a child spawned without a model. */
|
|
54
|
+
readonly defaultModel: LanguageModelRef
|
|
55
|
+
/** The tiers the project configures; empty when `models.language` is a list. */
|
|
56
|
+
readonly tiers: readonly LanguageModelTier[]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AgentRunDelegationModel extends LanguageModelRef {
|
|
60
|
+
readonly tier?: LanguageModelTier
|
|
61
|
+
/** As the model's binding configures it, never its provider's catalog. */
|
|
62
|
+
readonly definition: LanguageModelDefinition
|
|
63
|
+
readonly defaultReasoning?: AgentReasoning
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type SandboxModelKind = "language" | "image" | "speech" | "transcription"
|
|
67
|
+
|
|
68
|
+
/** One model the agent reaches through `sixb models`, as its prompt describes it. */
|
|
69
|
+
export interface SandboxModel {
|
|
70
|
+
readonly kind: SandboxModelKind
|
|
71
|
+
readonly provider: string
|
|
72
|
+
readonly modelId: string
|
|
73
|
+
/** A language model's tier, when the project configures its language models by tier. */
|
|
74
|
+
readonly tier?: LanguageModelTier
|
|
75
|
+
/** A language model's display name. */
|
|
76
|
+
readonly name?: string
|
|
77
|
+
readonly description?: string
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The definitions a run's plan is read from. */
|
|
81
|
+
export type AgentRunPlanDefinitions = Pick<
|
|
82
|
+
SixbDefinitions,
|
|
83
|
+
"agent" | "models" | "ontology" | "tools"
|
|
84
|
+
>
|
|
85
|
+
|
|
86
|
+
/** How a run's requester sees the project: through the run's SDK, with their clearance. */
|
|
87
|
+
export interface AgentRunView {
|
|
88
|
+
readonly sixb: Pick<Sixb, "objects" | "actions">
|
|
89
|
+
/** Marked properties the requester cannot read; absent when they read every property. */
|
|
90
|
+
readonly propertyClearance?: PropertyClearance
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The plan of a conversation's turn or a child. A turn offers every project tool and skill, on the
|
|
95
|
+
* model its admission froze, or the project default for a turn admitted before specs existed. A
|
|
96
|
+
* child keeps the model and tools its parent chose when it spawned it.
|
|
97
|
+
*/
|
|
98
|
+
export function readAgentRunPlan(
|
|
99
|
+
definitions: AgentRunPlanDefinitions,
|
|
100
|
+
run: AgentRunRecord,
|
|
101
|
+
view: AgentRunView
|
|
102
|
+
): AgentRunPlan {
|
|
103
|
+
const { agent, models, tools } = definitions
|
|
104
|
+
const shared = {
|
|
105
|
+
...(agent.instructions === undefined ? {} : { instructions: agent.instructions }),
|
|
106
|
+
skills: agent.skills.list(),
|
|
107
|
+
sandboxModels: listSandboxModels(models),
|
|
108
|
+
ontologyDocs: renderAgentRunOntologyDocs({ ...view, catalog: agent.ontologyDocs }),
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (run.kind === "subagent") {
|
|
112
|
+
const { model, reasoning, timeZone, locale } = run.spec
|
|
113
|
+
if (!models?.language?.getByRef(model)) {
|
|
114
|
+
throw createSixbError(
|
|
115
|
+
"agent.execution_failed",
|
|
116
|
+
`[Sixb] Subagent run '${run.id}' cannot resolve language model '${model.provider}/${model.modelId}'.`,
|
|
117
|
+
{ details: { parentRunId: run.parentRunId, runId: run.id } }
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
return Object.freeze({
|
|
121
|
+
...shared,
|
|
122
|
+
model: { provider: model.provider, modelId: model.modelId },
|
|
123
|
+
tools: toolSpecs(definitions, run.spec.toolNames),
|
|
124
|
+
...(reasoning === undefined ? {} : { reasoning }),
|
|
125
|
+
...(timeZone === undefined ? {} : { timeZone }),
|
|
126
|
+
...(locale === undefined ? {} : { locale }),
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const spec = run.spec
|
|
131
|
+
const ref = spec?.model ?? models?.language?.default
|
|
132
|
+
const entry = ref ? models?.language?.getByRef(ref) : undefined
|
|
133
|
+
if (!entry) {
|
|
134
|
+
throw createSixbError(
|
|
135
|
+
"agent.execution_failed",
|
|
136
|
+
"[Sixb] The conversation's language model is not available in models.language."
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
// Admission freezes the model's default reasoning into the spec; only runs admitted before
|
|
140
|
+
// specs existed take today's default.
|
|
141
|
+
const reasoning = spec ? spec.reasoning : entry.model.defaultReasoning
|
|
142
|
+
const language = models?.language
|
|
143
|
+
return Object.freeze({
|
|
144
|
+
...shared,
|
|
145
|
+
model: { provider: entry.provider, modelId: entry.modelId },
|
|
146
|
+
...(language ? { delegation: readAgentRunDelegation(language) } : {}),
|
|
147
|
+
tools: toolSpecs(
|
|
148
|
+
definitions,
|
|
149
|
+
tools.list().map((tool) => tool.name)
|
|
150
|
+
),
|
|
151
|
+
...(reasoning === undefined ? {} : { reasoning }),
|
|
152
|
+
...(spec?.timeZone === undefined ? {} : { timeZone: spec.timeZone }),
|
|
153
|
+
...(spec?.locale === undefined ? {} : { locale: spec.locale }),
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The project's models, with what each is for: its language models in catalog order, then each
|
|
159
|
+
* media kind's, default first. Read from each model's configured definition, never its provider
|
|
160
|
+
* catalog, so the prompt that lists them stays the same from turn to turn.
|
|
161
|
+
*/
|
|
162
|
+
export function listSandboxModels(models: ModelCatalog | undefined): readonly SandboxModel[] {
|
|
163
|
+
const language = (models?.language?.list() ?? []).map((entry): SandboxModel => {
|
|
164
|
+
const { name, description } = entry.model.definition
|
|
165
|
+
return {
|
|
166
|
+
kind: "language",
|
|
167
|
+
provider: entry.provider,
|
|
168
|
+
modelId: entry.modelId,
|
|
169
|
+
...(entry.tier === undefined ? {} : { tier: entry.tier }),
|
|
170
|
+
...(name ? { name } : {}),
|
|
171
|
+
...(description ? { description } : {}),
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
const media = (
|
|
175
|
+
[
|
|
176
|
+
["image", models?.image],
|
|
177
|
+
["speech", models?.audio?.speech],
|
|
178
|
+
["transcription", models?.audio?.transcription],
|
|
179
|
+
] as const
|
|
180
|
+
).flatMap(([kind, catalog]) =>
|
|
181
|
+
(catalog?.list() ?? []).map((entry): SandboxModel => {
|
|
182
|
+
const description = entry.model.definition.description
|
|
183
|
+
return {
|
|
184
|
+
kind,
|
|
185
|
+
provider: entry.provider,
|
|
186
|
+
modelId: entry.modelId,
|
|
187
|
+
...(description ? { description } : {}),
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
)
|
|
191
|
+
return [...language, ...media]
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** What a run reads of its memory: each repo its requester reads, now and as of a moment. */
|
|
195
|
+
export interface AgentRunMemory {
|
|
196
|
+
/** Others take part in the conversation, so the project's memory alone is read. */
|
|
197
|
+
readonly shared: boolean
|
|
198
|
+
readonly repos: readonly {
|
|
199
|
+
readonly latest: AgentMemoryRepoView
|
|
200
|
+
readonly then: AgentMemoryRepoView
|
|
201
|
+
}[]
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The repos a run's requester can read, each at its latest revision and as of `asOf`. A requester
|
|
206
|
+
* without a repo of their own, such as a service account, reads the project's alone, and so does a
|
|
207
|
+
* shared conversation: others read it, so it reaches no one's own memory.
|
|
208
|
+
*/
|
|
209
|
+
export async function readAgentRunMemory(
|
|
210
|
+
sixb: Pick<Sixb, "agent">,
|
|
211
|
+
input: { readonly shared: boolean; readonly asOf: Date }
|
|
212
|
+
): Promise<AgentRunMemory> {
|
|
213
|
+
const names: readonly AgentMemoryRepoName[] = input.shared ? ["project"] : ["user", "project"]
|
|
214
|
+
const repos = await Promise.all(
|
|
215
|
+
names.map(async (repo) => {
|
|
216
|
+
try {
|
|
217
|
+
const [latest, then] = await Promise.all([
|
|
218
|
+
sixb.agent.memory.get(repo),
|
|
219
|
+
sixb.agent.memory.get(repo, { asOf: input.asOf }),
|
|
220
|
+
])
|
|
221
|
+
return [{ latest, then }]
|
|
222
|
+
} catch (error) {
|
|
223
|
+
if (error instanceof AgentMemoryError && error.code === "not_allowed") return []
|
|
224
|
+
throw error
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
)
|
|
228
|
+
return { shared: input.shared, repos: repos.flat() }
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Requesters with the same view share rendered docs; a project has few distinct views. */
|
|
232
|
+
const renderedOntologyDocs = new WeakMap<OntologyDocsCatalog, Map<string, RenderedOntologyDocs>>()
|
|
233
|
+
const MAX_RENDERED_ONTOLOGY_VIEWS = 16
|
|
234
|
+
|
|
235
|
+
/** Reference docs for the object types a run's requester can see, from their own view. */
|
|
236
|
+
export function renderAgentRunOntologyDocs(input: {
|
|
237
|
+
/** The run's SDK, bound as its requester. */
|
|
238
|
+
readonly sixb: Pick<Sixb, "objects" | "actions">
|
|
239
|
+
readonly catalog: OntologyDocsCatalog
|
|
240
|
+
/** Marked properties the requester cannot read; absent when they read every property. */
|
|
241
|
+
readonly propertyClearance?: PropertyClearance
|
|
242
|
+
}): RenderedOntologyDocs {
|
|
243
|
+
const { sixb, propertyClearance, catalog } = input
|
|
244
|
+
const objectTypes = sixb.objects.listTypes()
|
|
245
|
+
const actionsByType = new Map(
|
|
246
|
+
objectTypes.map((objectType) => [objectType.id, sixb.actions.listForType(objectType)])
|
|
247
|
+
)
|
|
248
|
+
// Definitions are immutable, so the visible types, restricted properties, and requestable actions
|
|
249
|
+
// determine the output.
|
|
250
|
+
const key = JSON.stringify(
|
|
251
|
+
objectTypes.map((objectType) => [
|
|
252
|
+
objectType.id,
|
|
253
|
+
[...(propertyClearance?.hiddenProperties(objectType.id)?.ids ?? [])],
|
|
254
|
+
actionsByType.get(objectType.id)?.map((action) => action.id),
|
|
255
|
+
])
|
|
256
|
+
)
|
|
257
|
+
const views = renderedOntologyDocs.get(catalog) ?? new Map<string, RenderedOntologyDocs>()
|
|
258
|
+
renderedOntologyDocs.set(catalog, views)
|
|
259
|
+
const cached = views.get(key)
|
|
260
|
+
if (cached) return cached
|
|
261
|
+
|
|
262
|
+
const rendered = renderOntologyDocs({
|
|
263
|
+
catalog,
|
|
264
|
+
objectTypes,
|
|
265
|
+
valueTypesById: sixb.objects.getValueTypesById(),
|
|
266
|
+
actionsFor: (objectType) => actionsByType.get(objectType.id) ?? [],
|
|
267
|
+
...(propertyClearance === undefined
|
|
268
|
+
? {}
|
|
269
|
+
: {
|
|
270
|
+
restrictedPropertyIds: (objectTypeId) =>
|
|
271
|
+
propertyClearance.hiddenProperties(objectTypeId)?.ids,
|
|
272
|
+
}),
|
|
273
|
+
})
|
|
274
|
+
views.set(key, rendered)
|
|
275
|
+
const oldest = views.keys().next().value
|
|
276
|
+
if (views.size > MAX_RENDERED_ONTOLOGY_VIEWS && oldest !== undefined) views.delete(oldest)
|
|
277
|
+
return rendered
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** The project's language models, as a turn offers them to the children it spawns. */
|
|
281
|
+
export function readAgentRunDelegation(language: LanguageModelCatalog): AgentRunDelegation {
|
|
282
|
+
return {
|
|
283
|
+
models: language.list().map(
|
|
284
|
+
({ provider, modelId, tier, model }): AgentRunDelegationModel => ({
|
|
285
|
+
provider,
|
|
286
|
+
modelId,
|
|
287
|
+
...(tier === undefined ? {} : { tier }),
|
|
288
|
+
definition: model.definition,
|
|
289
|
+
...(model.defaultReasoning === undefined
|
|
290
|
+
? {}
|
|
291
|
+
: { defaultReasoning: model.defaultReasoning }),
|
|
292
|
+
})
|
|
293
|
+
),
|
|
294
|
+
defaultModel: { provider: language.default.provider, modelId: language.default.modelId },
|
|
295
|
+
tiers: language.tiers,
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** The specs of the project tools named, each as the model is offered it. */
|
|
300
|
+
function toolSpecs(
|
|
301
|
+
definitions: AgentRunPlanDefinitions,
|
|
302
|
+
names: readonly string[]
|
|
303
|
+
): readonly AgentToolSpec[] {
|
|
304
|
+
const valueTypesById = definitions.ontology.getValueTypesById()
|
|
305
|
+
return names.map((name) => {
|
|
306
|
+
const definition = definitions.tools.getByName(name)
|
|
307
|
+
if (!definition) {
|
|
308
|
+
throw createSixbError(
|
|
309
|
+
"agent.execution_failed",
|
|
310
|
+
`[Sixb] Project tool '${name}' is not available.`,
|
|
311
|
+
{ details: { toolName: name } }
|
|
312
|
+
)
|
|
313
|
+
}
|
|
314
|
+
return agentToolSpec(definition, valueTypesById)
|
|
315
|
+
})
|
|
316
|
+
}
|