@sixb/core 0.1.26 → 0.2.0
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 +47 -47
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run/context.d.ts +1 -0
- 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/types.d.ts +5 -0
- package/dist/actions/run/types.d.ts.map +1 -1
- package/dist/actions/types/context.d.ts +11 -0
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/agents/adapters.d.ts +30 -4
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/approvals.d.ts +8 -0
- package/dist/agents/approvals.d.ts.map +1 -1
- package/dist/agents/context-budget.d.ts +48 -0
- package/dist/agents/context-budget.d.ts.map +1 -0
- package/dist/agents/context-compaction.d.ts +89 -9
- package/dist/agents/context-compaction.d.ts.map +1 -1
- package/dist/agents/context-files.d.ts +12 -0
- package/dist/agents/context-files.d.ts.map +1 -0
- package/dist/agents/context-parts.d.ts +41 -0
- package/dist/agents/context-parts.d.ts.map +1 -0
- package/dist/agents/context-request.d.ts +47 -0
- package/dist/agents/context-request.d.ts.map +1 -0
- package/dist/agents/context-token-rate.d.ts +98 -0
- package/dist/agents/context-token-rate.d.ts.map +1 -0
- package/dist/agents/context-use.d.ts +51 -0
- package/dist/agents/context-use.d.ts.map +1 -0
- package/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +13 -1
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/index.d.ts +21 -7
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +109 -55
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/inline-images.d.ts +17 -0
- package/dist/agents/inline-images.d.ts.map +1 -0
- package/dist/agents/message.d.ts +55 -0
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +23 -3
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/request.d.ts +6 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-events.d.ts +3 -2
- package/dist/agents/run-events.d.ts.map +1 -1
- package/dist/agents/run-plan.d.ts +12 -2
- package/dist/agents/run-plan.d.ts.map +1 -1
- package/dist/agents/run-session-http.d.ts +6 -3
- package/dist/agents/run-session-http.d.ts.map +1 -1
- package/dist/agents/run-session-serve.d.ts +18 -2
- package/dist/agents/run-session-serve.d.ts.map +1 -1
- package/dist/agents/run-session.d.ts +3 -1
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/run-tools.d.ts +7 -0
- package/dist/agents/run-tools.d.ts.map +1 -1
- package/dist/agents/run-turn.d.ts +39 -4
- package/dist/agents/run-turn.d.ts.map +1 -1
- package/dist/agents/skills.d.ts +9 -2
- package/dist/agents/skills.d.ts.map +1 -1
- package/dist/agents/step-limits.d.ts +18 -0
- package/dist/agents/step-limits.d.ts.map +1 -0
- package/dist/agents/streams/index.d.ts +1 -1
- package/dist/agents/streams/index.d.ts.map +1 -1
- package/dist/agents/streams/index.js +2 -2
- 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 +7 -3
- package/dist/agents/streams/internal.js.map +1 -1
- package/dist/agents/streams/protocol.d.ts +36 -1
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/thread-context-projection.d.ts +10 -0
- package/dist/agents/thread-context-projection.d.ts.map +1 -1
- package/dist/agents/tool-files.d.ts +22 -0
- package/dist/agents/tool-files.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +26 -26
- package/dist/auth/index.js +12 -12
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +2 -0
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/auth/types.d.ts +5 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/authorization/decision.d.ts +2 -0
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +2 -2
- package/dist/authorization/grant-kinds.d.ts.map +1 -1
- package/dist/authorization/index.d.ts +1 -1
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +7 -5
- package/dist/authorization/index.js.map +1 -1
- package/dist/authorization/run-visibility.d.ts +17 -0
- package/dist/authorization/run-visibility.d.ts.map +1 -1
- package/dist/bootstrap/index.js +53 -53
- package/dist/{chunk-t3brw0wd.js → chunk-0g5nyx0k.js} +181 -30
- package/dist/chunk-0g5nyx0k.js.map +14 -0
- package/dist/{chunk-fakrpfy3.js → chunk-0k1h5hmr.js} +2 -1
- package/dist/{chunk-fakrpfy3.js.map → chunk-0k1h5hmr.js.map} +3 -3
- package/dist/{chunk-c0vk1djt.js → chunk-165c9wm6.js} +1 -1
- package/dist/{chunk-8mb7mt8n.js → chunk-21q0j5f2.js} +2 -2
- package/dist/{chunk-hn76sanm.js → chunk-23s66j86.js} +1 -1
- package/dist/{chunk-h1na2cxc.js → chunk-2g0r46hy.js} +2 -2
- package/dist/{chunk-8v6xzwgr.js → chunk-3x3bebz7.js} +95 -19
- package/dist/{chunk-8v6xzwgr.js.map → chunk-3x3bebz7.js.map} +10 -9
- package/dist/{chunk-tdxfsg1c.js → chunk-47e09r7z.js} +2 -2
- package/dist/{chunk-73j0v4qv.js → chunk-4zm1k3xj.js} +14 -2
- package/dist/{chunk-73j0v4qv.js.map → chunk-4zm1k3xj.js.map} +3 -3
- package/dist/{chunk-npcr0228.js → chunk-5kyvrtjh.js} +1 -1
- package/dist/{chunk-zhh1jd89.js → chunk-5taem5aw.js} +1 -1
- package/dist/{chunk-tnhqtfea.js → chunk-6b61s40c.js} +1 -1
- package/dist/{chunk-4ymrcdbm.js → chunk-7hd2ez3q.js} +1 -1
- package/dist/{chunk-315qye3g.js → chunk-80nh73br.js} +1 -1
- package/dist/{chunk-phm3c7b9.js → chunk-855n80en.js} +1 -1
- package/dist/{chunk-qst145py.js → chunk-8dcfj58k.js} +24 -14
- package/dist/chunk-8dcfj58k.js.map +18 -0
- package/dist/{chunk-7wn5z7mq.js → chunk-8hvfs0fr.js} +5 -5
- package/dist/{chunk-2vjnyz1s.js → chunk-9rh8ncs5.js} +2 -2
- package/dist/{chunk-pgrf64hp.js → chunk-agn8d8ys.js} +1 -1
- package/dist/{chunk-mqx25wwh.js → chunk-c78jjzhy.js} +12 -10
- package/dist/{chunk-mqx25wwh.js.map → chunk-c78jjzhy.js.map} +3 -3
- package/dist/{chunk-7ex2p3zp.js → chunk-cgznz22f.js} +2 -2
- package/dist/{chunk-06sg8s4z.js → chunk-d3t26vah.js} +2 -2
- package/dist/{chunk-vhbw5sqm.js → chunk-d7v97qxq.js} +7 -1
- package/dist/chunk-d7v97qxq.js.map +10 -0
- package/dist/chunk-de5sfbc3.js +3 -0
- package/dist/{chunk-ratkv4zc.js.map → chunk-de5sfbc3.js.map} +1 -1
- package/dist/{chunk-qgvbxfqv.js → chunk-djs3hw9p.js} +1 -1
- package/dist/{chunk-ye5c8016.js → chunk-dz7a4t3a.js} +26 -5
- package/dist/{chunk-ye5c8016.js.map → chunk-dz7a4t3a.js.map} +4 -4
- package/dist/{chunk-dgtd0836.js → chunk-e7v3trpz.js} +1 -1
- package/dist/{chunk-8v5a54qz.js → chunk-e99kp9jh.js} +161 -38
- package/dist/{chunk-8v5a54qz.js.map → chunk-e99kp9jh.js.map} +10 -10
- package/dist/{chunk-z9mg7wya.js → chunk-edx8xcsm.js} +111 -11
- package/dist/chunk-edx8xcsm.js.map +13 -0
- package/dist/{chunk-0bc3w0zq.js → chunk-ekkpzcka.js} +5 -5
- package/dist/{chunk-zbc929zg.js → chunk-escedwyt.js} +9 -1
- package/dist/{chunk-zbc929zg.js.map → chunk-escedwyt.js.map} +3 -3
- package/dist/{chunk-4jq2bg8t.js → chunk-f2w6328x.js} +6 -6
- package/dist/{chunk-b6ghvap7.js → chunk-fb3m4sa1.js} +7 -7
- package/dist/{chunk-yavhtnac.js → chunk-fdkpkkpw.js} +89 -43
- package/dist/{chunk-yavhtnac.js.map → chunk-fdkpkkpw.js.map} +3 -3
- package/dist/{chunk-jt3r6thp.js → chunk-fg1db9xx.js} +46 -6
- package/dist/chunk-fg1db9xx.js.map +10 -0
- package/dist/{chunk-73v685wb.js → chunk-frsz8wxd.js} +4 -4
- package/dist/{chunk-73v685wb.js.map → chunk-frsz8wxd.js.map} +3 -3
- package/dist/{chunk-jn3ysaf2.js → chunk-he7g39e5.js} +11 -11
- package/dist/{chunk-jn3ysaf2.js.map → chunk-he7g39e5.js.map} +1 -1
- package/dist/{chunk-yd00vzqr.js → chunk-hjy3dsws.js} +1009 -354
- package/dist/chunk-hjy3dsws.js.map +45 -0
- package/dist/{chunk-59kf345w.js → chunk-jbw70d6t.js} +2 -2
- package/dist/{chunk-cbcgs9f7.js → chunk-jftd33rc.js} +21 -21
- package/dist/chunk-jftd33rc.js.map +11 -0
- package/dist/{chunk-78ymxrn0.js → chunk-jhbk10wf.js} +1 -1
- package/dist/{chunk-18sk89cg.js → chunk-jk97v21j.js} +7 -2
- package/dist/chunk-jk97v21j.js.map +10 -0
- package/dist/chunk-kcqpk9w1.js.map +2 -2
- package/dist/{chunk-ft3w5ahs.js → chunk-m3qe54bb.js} +1 -1
- package/dist/{chunk-8xnz9vvp.js → chunk-n54k068r.js} +22 -18
- package/dist/chunk-n54k068r.js.map +12 -0
- package/dist/{chunk-y7j6x4h0.js → chunk-neftrg0n.js} +3 -3
- package/dist/{chunk-07kkp2e1.js → chunk-nghc7eq0.js} +2 -2
- package/dist/{chunk-1xvqgg88.js → chunk-nz7815t3.js} +18 -2
- package/dist/chunk-nz7815t3.js.map +14 -0
- package/dist/{chunk-fe8zwt8b.js → chunk-peggaard.js} +2 -2
- package/dist/{chunk-e24fvw8g.js → chunk-qbrmpgvv.js} +1 -1
- package/dist/{chunk-dp0cdtj2.js → chunk-qsg8rw04.js} +2 -2
- package/dist/{chunk-mdxmt0n3.js → chunk-qya541bk.js} +1071 -121
- package/dist/chunk-qya541bk.js.map +129 -0
- package/dist/{chunk-0kk2wt0h.js → chunk-r1cxq7vv.js} +2 -2
- package/dist/{chunk-kyjcwqz6.js → chunk-rtkqczbr.js} +3 -1
- package/dist/{chunk-kyjcwqz6.js.map → chunk-rtkqczbr.js.map} +3 -3
- package/dist/{chunk-2adz0h75.js → chunk-s7xqfxs9.js} +35 -3
- package/dist/chunk-s7xqfxs9.js.map +11 -0
- package/dist/{chunk-g663fahq.js → chunk-scyq22td.js} +1 -1
- package/dist/{chunk-xm8qgbqm.js → chunk-semf1yqn.js} +54 -44
- package/dist/{chunk-xm8qgbqm.js.map → chunk-semf1yqn.js.map} +5 -5
- package/dist/{chunk-pdt5cw8z.js → chunk-tvefbgvw.js} +5 -2
- package/dist/{chunk-pdt5cw8z.js.map → chunk-tvefbgvw.js.map} +3 -3
- package/dist/{chunk-vx4e4zv4.js → chunk-vkweppkw.js} +3 -3
- package/dist/{chunk-45ngkxkp.js → chunk-w122ymx4.js} +2 -2
- package/dist/{chunk-48jezz3j.js → chunk-w976a4me.js} +1 -1
- package/dist/{chunk-qtzftvxa.js → chunk-wx7smkn2.js} +1 -1
- package/dist/{chunk-6qn7nmd3.js → chunk-xj97s5js.js} +9 -9
- package/dist/{chunk-c14ap3s9.js → chunk-y2x2935j.js} +3 -3
- package/dist/{chunk-7hf6tkgs.js → chunk-ytzcxtpt.js} +5 -5
- package/dist/{chunk-7hf6tkgs.js.map → chunk-ytzcxtpt.js.map} +1 -1
- package/dist/{chunk-axb4ss9a.js → chunk-ztf5vtmp.js} +5 -5
- package/dist/datasets/execution.d.ts +26 -1
- package/dist/datasets/execution.d.ts.map +1 -1
- package/dist/datasets/index.d.ts +1 -1
- package/dist/datasets/index.d.ts.map +1 -1
- package/dist/datasets/lineage.d.ts +55 -0
- package/dist/datasets/lineage.d.ts.map +1 -0
- package/dist/datasets/write.js +5 -5
- package/dist/deploy/types.d.ts +8 -1
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/env/index.d.ts +36 -0
- package/dist/env/index.d.ts.map +1 -0
- package/dist/env/index.js +17 -0
- package/dist/env/index.js.map +10 -0
- package/dist/error-reporting/internal.js +3 -3
- package/dist/errors/catalog.d.ts +8 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/internal.js +1 -1
- package/dist/events/index.js +3 -3
- package/dist/execution/agent.js +47 -47
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/primitive.js +47 -47
- package/dist/execution/request-client.d.ts +21 -0
- package/dist/execution/request-client.d.ts.map +1 -0
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +49 -47
- package/dist/execution/request.js.map +3 -3
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +65 -65
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +5 -5
- package/dist/lineage/commits.d.ts +45 -0
- package/dist/lineage/commits.d.ts.map +1 -0
- package/dist/lineage/executors.d.ts +14 -0
- package/dist/lineage/executors.d.ts.map +1 -0
- package/dist/lineage/link.d.ts +10 -0
- package/dist/lineage/link.d.ts.map +1 -0
- package/dist/lineage/object.d.ts +10 -0
- package/dist/lineage/object.d.ts.map +1 -0
- package/dist/lineage/projections.d.ts +34 -0
- package/dist/lineage/projections.d.ts.map +1 -0
- package/dist/lineage/reader.d.ts +34 -0
- package/dist/lineage/reader.d.ts.map +1 -0
- package/dist/lineage/sources.d.ts +62 -0
- package/dist/lineage/sources.d.ts.map +1 -0
- package/dist/lineage/types.d.ts +140 -0
- package/dist/lineage/types.d.ts.map +1 -0
- package/dist/materializer/effective/resolve.d.ts +63 -6
- package/dist/materializer/effective/resolve.d.ts.map +1 -1
- package/dist/materializer/index.js +27 -27
- package/dist/models/errors.d.ts +8 -0
- package/dist/models/errors.d.ts.map +1 -1
- package/dist/models/events.d.ts +10 -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 +34 -31
- package/dist/models/execution/index.js.map +1 -1
- package/dist/models/execution/model-call-recorder.d.ts +2 -0
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
- package/dist/models/index.d.ts +2 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +3 -3
- package/dist/models/language-model.d.ts +29 -2
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/objects/execution.d.ts +4 -1
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +47 -47
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +1 -0
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +30 -28
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/ir.d.ts +16 -0
- package/dist/objects/query/ir.d.ts.map +1 -1
- package/dist/objects/query/link-endpoints.d.ts +11 -0
- package/dist/objects/query/link-endpoints.d.ts.map +1 -0
- package/dist/objects/query/normalize.d.ts.map +1 -1
- package/dist/objects/query/planner.d.ts +5 -0
- package/dist/objects/query/planner.d.ts.map +1 -1
- package/dist/objects/query/validate.d.ts +2 -0
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/object-set.d.ts +2 -0
- package/dist/objects/sdk/object-set.d.ts.map +1 -1
- package/dist/ontology/index.js +5 -5
- package/dist/ontology/internal.js +3 -3
- package/dist/pipelines/index.js +31 -31
- package/dist/projections/internal.js +27 -27
- package/dist/query.js +2 -2
- package/dist/queues/in-memory.d.ts +1 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/runtime/create.d.ts +3 -0
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/internal.js +33 -33
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +16 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/sandboxes/exec.d.ts.map +1 -1
- package/dist/sandboxes/index.js +5 -5
- package/dist/security/grants.d.ts +1 -1
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/internal.js +1 -1
- package/dist/security/project.d.ts.map +1 -1
- package/dist/security/public.js +2 -2
- package/dist/security/types.d.ts +10 -3
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/shares/execution.d.ts +9 -0
- package/dist/shares/execution.d.ts.map +1 -1
- package/dist/shares/index.d.ts +1 -1
- package/dist/shares/index.d.ts.map +1 -1
- package/dist/shares/internal.js +24 -24
- package/dist/storage/action-runs/failure.js +2 -2
- package/dist/storage/agents/in-memory.d.ts +38 -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 +43 -5
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +30 -6
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +132 -10
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +13 -5
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/groups.d.ts +19 -2
- package/dist/storage/ai-cost/groups.d.ts.map +1 -1
- package/dist/storage/ai-cost/in-memory.d.ts +6 -1
- package/dist/storage/ai-cost/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-cost/index.d.ts +1 -1
- package/dist/storage/ai-cost/index.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.d.ts +1 -1
- package/dist/storage/ai-cost/provider.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +7 -5
- package/dist/storage/ai-cost/provider.js.map +1 -1
- package/dist/storage/ai-cost/types.d.ts +65 -9
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.js +4 -4
- package/dist/storage/ai-limits/provider.js +2 -2
- package/dist/storage/connector-connections/provider.js +1 -1
- package/dist/storage/file-upload-sessions/provider.js +10 -10
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +31 -31
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.js +6 -6
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
- package/dist/storage/objects/query-preparation.d.ts +5 -0
- package/dist/storage/objects/query-preparation.d.ts.map +1 -1
- package/dist/storage/ontology/commits.d.ts +6 -1
- package/dist/storage/ontology/commits.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/commits.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts +2 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/index.d.ts +1 -1
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/materializations.d.ts +16 -0
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +6 -1
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +4 -2
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/operation-scope.d.ts +10 -0
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +7 -3
- package/dist/storage/operation-scope.js.map +1 -1
- package/dist/storage/projection-runs/provider.js +2 -2
- package/dist/storage/workflow-runs/provider.js +10 -10
- package/dist/syncs/index.js +32 -32
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/agent-token-rate-storage-contract.d.ts +14 -0
- package/dist/testing/agent-token-rate-storage-contract.d.ts.map +1 -0
- package/dist/testing/ai-model-call-groups-contract.d.ts +1 -1
- package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +4365 -3518
- package/dist/testing/index.js.map +10 -9
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-query-contract.d.ts.map +1 -1
- package/dist/testing/ontology-contract-fixture.d.ts +3 -3
- package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +25 -25
- package/dist/workers/index.js +1 -1
- package/dist/workflows/builders.d.ts.map +1 -1
- package/dist/workflows/index.js +52 -52
- package/dist/workflows/types.d.ts +6 -0
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/validation.d.ts.map +1 -1
- package/package.json +7 -1
- package/src/actions/request.ts +6 -0
- package/src/actions/run/context.ts +6 -0
- package/src/actions/run/execute.ts +8 -2
- package/src/actions/run/executor.ts +4 -0
- package/src/actions/run/types.ts +5 -0
- package/src/actions/types/context.ts +11 -0
- package/src/agents/README.md +11 -3
- package/src/agents/adapters.ts +73 -23
- package/src/agents/approvals.ts +22 -0
- package/src/agents/context-budget.ts +121 -0
- package/src/agents/context-compaction.ts +317 -150
- package/src/agents/context-files.ts +48 -0
- package/src/agents/context-parts.ts +219 -0
- package/src/agents/context-request.ts +100 -0
- package/src/agents/context-token-rate.ts +224 -0
- package/src/agents/context-use.ts +187 -0
- package/src/agents/dispatch.ts +2 -0
- package/src/agents/execution.ts +105 -0
- package/src/agents/index.ts +46 -2
- package/src/agents/inline-images.ts +17 -0
- package/src/agents/message.ts +70 -1
- package/src/agents/model-loop.ts +192 -61
- package/src/agents/request.ts +18 -1
- package/src/agents/run-events.ts +3 -2
- package/src/agents/run-plan.ts +22 -3
- package/src/agents/run-session-http.ts +8 -5
- package/src/agents/run-session-serve.ts +133 -9
- package/src/agents/run-session.ts +30 -4
- package/src/agents/run-tools.ts +10 -2
- package/src/agents/run-turn.ts +116 -26
- package/src/agents/skills.ts +9 -2
- package/src/agents/step-limits.ts +27 -0
- package/src/agents/streams/index.ts +2 -0
- package/src/agents/streams/internal.ts +2 -0
- package/src/agents/streams/protocol.ts +125 -2
- package/src/agents/thread-context-projection.ts +25 -17
- package/src/agents/tool-files.ts +41 -3
- package/src/auth/runtime.ts +30 -1
- package/src/auth/types.ts +5 -0
- package/src/authorization/decision.ts +5 -0
- package/src/authorization/grant-kinds.ts +8 -0
- package/src/authorization/index.ts +2 -0
- package/src/authorization/run-visibility.ts +37 -0
- package/src/datasets/execution.ts +89 -2
- package/src/datasets/index.ts +1 -0
- package/src/datasets/lineage.ts +194 -0
- package/src/deploy/types.ts +8 -1
- package/src/env/index.ts +46 -0
- package/src/errors/catalog.ts +12 -0
- package/src/execution/index.ts +1 -0
- package/src/execution/request-client.ts +44 -0
- package/src/execution/request.ts +2 -0
- package/src/http/api-routes.ts +24 -25
- package/src/index.ts +32 -0
- package/src/lineage/README.md +107 -0
- package/src/lineage/commits.ts +173 -0
- package/src/lineage/executors.ts +103 -0
- package/src/lineage/link.ts +138 -0
- package/src/lineage/object.ts +218 -0
- package/src/lineage/projections.ts +174 -0
- package/src/lineage/reader.ts +89 -0
- package/src/lineage/sources.ts +156 -0
- package/src/lineage/types.ts +149 -0
- package/src/materializer/effective/resolve.ts +198 -50
- package/src/models/errors.ts +10 -0
- package/src/models/events.ts +13 -1
- package/src/models/execution/index.ts +1 -0
- package/src/models/execution/model-call-recorder.ts +7 -1
- package/src/models/index.ts +3 -0
- package/src/models/language-model.ts +34 -2
- package/src/objects/execution.ts +6 -1
- package/src/objects/query/executor.ts +28 -13
- package/src/objects/query/index.ts +1 -0
- package/src/objects/query/ir.ts +16 -0
- package/src/objects/query/link-endpoints.ts +29 -0
- package/src/objects/query/normalize.ts +3 -0
- package/src/objects/query/planner.ts +5 -0
- package/src/objects/query/validate.ts +73 -3
- package/src/objects/sdk/object-set.ts +33 -1
- package/src/runtime/create.ts +6 -0
- package/src/runtime/resolve-definitions.ts +7 -0
- package/src/runtime/sixb.ts +4 -1
- package/src/runtime/types.ts +18 -0
- package/src/sandboxes/exec.ts +19 -0
- package/src/security/grants.ts +3 -0
- package/src/security/project.ts +1 -0
- package/src/security/types.ts +8 -3
- package/src/security/validation.ts +5 -4
- package/src/shares/execution.ts +35 -3
- package/src/shares/index.ts +1 -0
- package/src/storage/agents/in-memory.ts +179 -8
- package/src/storage/agents/index.ts +8 -0
- package/src/storage/agents/provider.ts +219 -6
- package/src/storage/agents/types.ts +145 -9
- package/src/storage/ai-cost/analytics.ts +177 -10
- package/src/storage/ai-cost/groups.ts +122 -35
- package/src/storage/ai-cost/in-memory.ts +10 -4
- package/src/storage/ai-cost/index.ts +5 -0
- package/src/storage/ai-cost/provider.ts +5 -1
- package/src/storage/ai-cost/types.ts +65 -9
- package/src/storage/in-memory/index.ts +10 -0
- package/src/storage/index.ts +15 -0
- package/src/storage/objects/in-memory/query.ts +5 -1
- package/src/storage/objects/query-preparation.ts +10 -0
- package/src/storage/ontology/commits.ts +6 -1
- package/src/storage/ontology/in-memory/commits.ts +7 -0
- package/src/storage/ontology/in-memory/materializations.ts +24 -0
- package/src/storage/ontology/index.ts +2 -0
- package/src/storage/ontology/materializations.ts +21 -0
- package/src/storage/ontology/provider.ts +41 -1
- package/src/storage/operation-scope.ts +41 -0
- package/src/testing/agent-storage-contract.ts +426 -20
- package/src/testing/agent-token-rate-storage-contract.ts +171 -0
- package/src/testing/ai-model-call-groups-contract.ts +225 -7
- package/src/testing/index.ts +5 -0
- package/src/testing/materializer-storage-contract.ts +294 -10
- package/src/testing/object-query-contract.ts +48 -0
- package/src/testing/ontology-contract-fixture.ts +18 -7
- package/src/testing/ontology-storage-contract.ts +42 -0
- package/src/workflows/builders.ts +8 -1
- package/src/workflows/types.ts +6 -0
- package/src/workflows/validation.ts +1 -0
- package/dist/chunk-18sk89cg.js.map +0 -10
- package/dist/chunk-1xvqgg88.js.map +0 -14
- package/dist/chunk-2adz0h75.js.map +0 -11
- package/dist/chunk-8xnz9vvp.js.map +0 -12
- package/dist/chunk-cbcgs9f7.js.map +0 -11
- package/dist/chunk-jt3r6thp.js.map +0 -10
- package/dist/chunk-mdxmt0n3.js.map +0 -120
- package/dist/chunk-qst145py.js.map +0 -18
- package/dist/chunk-ratkv4zc.js +0 -3
- package/dist/chunk-t3brw0wd.js.map +0 -14
- package/dist/chunk-vhbw5sqm.js.map +0 -10
- package/dist/chunk-yd00vzqr.js.map +0 -37
- package/dist/chunk-z9mg7wya.js.map +0 -13
- /package/dist/{chunk-c0vk1djt.js.map → chunk-165c9wm6.js.map} +0 -0
- /package/dist/{chunk-8mb7mt8n.js.map → chunk-21q0j5f2.js.map} +0 -0
- /package/dist/{chunk-hn76sanm.js.map → chunk-23s66j86.js.map} +0 -0
- /package/dist/{chunk-h1na2cxc.js.map → chunk-2g0r46hy.js.map} +0 -0
- /package/dist/{chunk-tdxfsg1c.js.map → chunk-47e09r7z.js.map} +0 -0
- /package/dist/{chunk-npcr0228.js.map → chunk-5kyvrtjh.js.map} +0 -0
- /package/dist/{chunk-zhh1jd89.js.map → chunk-5taem5aw.js.map} +0 -0
- /package/dist/{chunk-tnhqtfea.js.map → chunk-6b61s40c.js.map} +0 -0
- /package/dist/{chunk-4ymrcdbm.js.map → chunk-7hd2ez3q.js.map} +0 -0
- /package/dist/{chunk-315qye3g.js.map → chunk-80nh73br.js.map} +0 -0
- /package/dist/{chunk-phm3c7b9.js.map → chunk-855n80en.js.map} +0 -0
- /package/dist/{chunk-7wn5z7mq.js.map → chunk-8hvfs0fr.js.map} +0 -0
- /package/dist/{chunk-2vjnyz1s.js.map → chunk-9rh8ncs5.js.map} +0 -0
- /package/dist/{chunk-pgrf64hp.js.map → chunk-agn8d8ys.js.map} +0 -0
- /package/dist/{chunk-7ex2p3zp.js.map → chunk-cgznz22f.js.map} +0 -0
- /package/dist/{chunk-06sg8s4z.js.map → chunk-d3t26vah.js.map} +0 -0
- /package/dist/{chunk-qgvbxfqv.js.map → chunk-djs3hw9p.js.map} +0 -0
- /package/dist/{chunk-dgtd0836.js.map → chunk-e7v3trpz.js.map} +0 -0
- /package/dist/{chunk-0bc3w0zq.js.map → chunk-ekkpzcka.js.map} +0 -0
- /package/dist/{chunk-4jq2bg8t.js.map → chunk-f2w6328x.js.map} +0 -0
- /package/dist/{chunk-b6ghvap7.js.map → chunk-fb3m4sa1.js.map} +0 -0
- /package/dist/{chunk-59kf345w.js.map → chunk-jbw70d6t.js.map} +0 -0
- /package/dist/{chunk-78ymxrn0.js.map → chunk-jhbk10wf.js.map} +0 -0
- /package/dist/{chunk-ft3w5ahs.js.map → chunk-m3qe54bb.js.map} +0 -0
- /package/dist/{chunk-y7j6x4h0.js.map → chunk-neftrg0n.js.map} +0 -0
- /package/dist/{chunk-07kkp2e1.js.map → chunk-nghc7eq0.js.map} +0 -0
- /package/dist/{chunk-fe8zwt8b.js.map → chunk-peggaard.js.map} +0 -0
- /package/dist/{chunk-e24fvw8g.js.map → chunk-qbrmpgvv.js.map} +0 -0
- /package/dist/{chunk-dp0cdtj2.js.map → chunk-qsg8rw04.js.map} +0 -0
- /package/dist/{chunk-0kk2wt0h.js.map → chunk-r1cxq7vv.js.map} +0 -0
- /package/dist/{chunk-g663fahq.js.map → chunk-scyq22td.js.map} +0 -0
- /package/dist/{chunk-vx4e4zv4.js.map → chunk-vkweppkw.js.map} +0 -0
- /package/dist/{chunk-45ngkxkp.js.map → chunk-w122ymx4.js.map} +0 -0
- /package/dist/{chunk-48jezz3j.js.map → chunk-w976a4me.js.map} +0 -0
- /package/dist/{chunk-qtzftvxa.js.map → chunk-wx7smkn2.js.map} +0 -0
- /package/dist/{chunk-6qn7nmd3.js.map → chunk-xj97s5js.js.map} +0 -0
- /package/dist/{chunk-c14ap3s9.js.map → chunk-y2x2935j.js.map} +0 -0
- /package/dist/{chunk-axb4ss9a.js.map → chunk-ztf5vtmp.js.map} +0 -0
package/src/agents/model-loop.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { ModelUsageRecordingError } from "../models/execution/errors"
|
|
|
18
18
|
import { LanguageModelCallMeter } from "../models/language-call"
|
|
19
19
|
import type {
|
|
20
20
|
LanguageModel,
|
|
21
|
+
ModelCaching,
|
|
21
22
|
ModelReasoning,
|
|
22
23
|
ModelToolSpecification,
|
|
23
24
|
} from "../models/language-model"
|
|
@@ -41,7 +42,7 @@ interface ModelLoopOptions {
|
|
|
41
42
|
readonly tools?: readonly ModelTool[]
|
|
42
43
|
readonly reasoning?: ModelReasoning
|
|
43
44
|
readonly maxOutputTokens?: number
|
|
44
|
-
readonly caching?:
|
|
45
|
+
readonly caching?: ModelCaching
|
|
45
46
|
/** At most this many provider calls. Without it, the loop runs until the model answers. */
|
|
46
47
|
readonly maxSteps?: number
|
|
47
48
|
/** Direct generation cannot execute or synthesize local tool results. */
|
|
@@ -50,6 +51,16 @@ interface ModelLoopOptions {
|
|
|
50
51
|
readonly prepareStep?: (
|
|
51
52
|
input: PrepareModelStepInput
|
|
52
53
|
) => PrepareModelStepResult | undefined | Promise<PrepareModelStepResult | undefined>
|
|
54
|
+
/**
|
|
55
|
+
* Asked when a provider call fails before its step completes, or answers cut short by the
|
|
56
|
+
* model's context window, with what it failed with. Messages it returns replace the call's
|
|
57
|
+
* request, and the call is made again with them, once: a second failure of the same step, or no
|
|
58
|
+
* messages, fails the loop with its error, and an answer the window cut ends it as one the
|
|
59
|
+
* output limit cut short.
|
|
60
|
+
*/
|
|
61
|
+
readonly recoverStep?: (
|
|
62
|
+
input: RecoverModelStepInput
|
|
63
|
+
) => PrepareModelStepResult | undefined | Promise<PrepareModelStepResult | undefined>
|
|
53
64
|
readonly onEvent?: (event: ModelUiChunk) => void | Promise<void>
|
|
54
65
|
readonly onStepEnd?: (step: ModelStep) => void | Promise<void>
|
|
55
66
|
/**
|
|
@@ -79,13 +90,24 @@ export type RunModelLoopInput<TOutput = string> = ModelLoopOptions &
|
|
|
79
90
|
export interface PrepareModelStepInput {
|
|
80
91
|
readonly stepIndex: number
|
|
81
92
|
readonly messages: readonly ModelMessage[]
|
|
93
|
+
/** The steps the loop completed before this one, the provider's usage of each included. */
|
|
94
|
+
readonly steps: readonly ModelStep[]
|
|
82
95
|
readonly model: LanguageModel
|
|
83
96
|
readonly signal: AbortSignal
|
|
84
97
|
}
|
|
85
98
|
|
|
99
|
+
export interface RecoverModelStepInput extends PrepareModelStepInput {
|
|
100
|
+
/** What the call failed with. */
|
|
101
|
+
readonly error: unknown
|
|
102
|
+
/** What the provider counted for the call, when it finished before it failed. */
|
|
103
|
+
readonly usage?: ModelUsage
|
|
104
|
+
}
|
|
105
|
+
|
|
86
106
|
export interface PrepareModelStepResult {
|
|
87
107
|
/** Replacement history retained for this request and subsequent steps. */
|
|
88
108
|
readonly messages?: readonly ModelMessage[]
|
|
109
|
+
/** The most this request may write, when less than the loop's: what its input leaves room for. */
|
|
110
|
+
readonly maxOutputTokens?: number
|
|
89
111
|
}
|
|
90
112
|
|
|
91
113
|
export type ModelLoopResult<TOutput = string> =
|
|
@@ -94,6 +116,8 @@ export type ModelLoopResult<TOutput = string> =
|
|
|
94
116
|
readonly output: TOutput
|
|
95
117
|
readonly steps: readonly ModelStep[]
|
|
96
118
|
readonly finishReason: ModelFinishReason
|
|
119
|
+
/** The loop stopped at `maxSteps` after a step that ran tools, before the model answered. */
|
|
120
|
+
readonly stepLimitReached?: true
|
|
97
121
|
}
|
|
98
122
|
| {
|
|
99
123
|
readonly status: "aborted"
|
|
@@ -116,6 +140,7 @@ interface CompletedResponse {
|
|
|
116
140
|
readonly toolCalls: readonly ParsedToolCall[]
|
|
117
141
|
readonly finishReason: ModelFinishReason
|
|
118
142
|
readonly rawFinishReason?: string
|
|
143
|
+
readonly contextWindowExceeded?: boolean
|
|
119
144
|
readonly usage: ModelUsage
|
|
120
145
|
readonly responseId?: string
|
|
121
146
|
readonly responseModelId?: string
|
|
@@ -166,14 +191,17 @@ export async function runModelLoop(
|
|
|
166
191
|
await input.onEvent?.({ type: "start-step" })
|
|
167
192
|
|
|
168
193
|
let requestMessages: readonly ModelMessage[]
|
|
194
|
+
let requestMaxOutputTokens: number | undefined
|
|
169
195
|
try {
|
|
170
196
|
const prepared = await input.prepareStep?.({
|
|
171
197
|
stepIndex,
|
|
172
198
|
messages,
|
|
199
|
+
steps,
|
|
173
200
|
model: input.model,
|
|
174
201
|
signal: input.signal,
|
|
175
202
|
})
|
|
176
203
|
requestMessages = prepared?.messages ?? messages
|
|
204
|
+
requestMaxOutputTokens = prepared?.maxOutputTokens
|
|
177
205
|
} catch (error) {
|
|
178
206
|
if (!input.signal.aborted && !isAbortError(error)) throw error
|
|
179
207
|
return { status: "aborted", steps, partialContent: [] }
|
|
@@ -182,69 +210,82 @@ export async function runModelLoop(
|
|
|
182
210
|
return { status: "aborted", steps, partialContent: [] }
|
|
183
211
|
}
|
|
184
212
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const
|
|
213
|
+
let callId: string
|
|
214
|
+
let cost: ModelCallCost
|
|
215
|
+
let completed: CompletedResponse
|
|
216
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
217
|
+
callId = generateCallId()
|
|
218
|
+
if (!callId || callIds.has(callId)) {
|
|
219
|
+
throw new ModelStreamError(`[SixbModels] Model call IDs must be nonempty and unique.`)
|
|
220
|
+
}
|
|
221
|
+
callIds.add(callId)
|
|
222
|
+
const accumulator = new StreamAccumulator(input.onEvent)
|
|
223
|
+
const call = await callModel(input, {
|
|
196
224
|
callId,
|
|
197
225
|
messages: requestMessages,
|
|
198
226
|
tools: toolSpecifications,
|
|
199
|
-
|
|
200
|
-
...(
|
|
201
|
-
...(input.caching === undefined ? {} : { caching: input.caching }),
|
|
202
|
-
...(input.output === undefined
|
|
227
|
+
accumulator,
|
|
228
|
+
...(requestMaxOutputTokens === undefined
|
|
203
229
|
? {}
|
|
204
|
-
: {
|
|
205
|
-
responseFormat: {
|
|
206
|
-
type: "json" as const,
|
|
207
|
-
name: input.output.name,
|
|
208
|
-
...(input.output.description === undefined
|
|
209
|
-
? {}
|
|
210
|
-
: { description: input.output.description }),
|
|
211
|
-
schema: input.output.schema,
|
|
212
|
-
},
|
|
213
|
-
}),
|
|
214
|
-
// A call the provider leaves silent fails where it is recorded (see reportModelCalls).
|
|
215
|
-
signal: input.signal,
|
|
230
|
+
: { maxOutputTokens: requestMaxOutputTokens }),
|
|
216
231
|
})
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
232
|
+
cost = call.cost
|
|
233
|
+
if (call.aborted) {
|
|
234
|
+
return { status: "aborted", steps, partialContent: accumulator.partialContent() }
|
|
220
235
|
}
|
|
221
|
-
|
|
222
|
-
// A
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
236
|
+
|
|
237
|
+
// A stream that failed after its finish is still read whole first: a malformed one fails
|
|
238
|
+
// as such.
|
|
239
|
+
const finished =
|
|
240
|
+
call.failure && !accumulator.isFinished() ? undefined : accumulator.complete()
|
|
241
|
+
|
|
242
|
+
// A call that failed before its step completed, or whose answer the context window cut
|
|
243
|
+
// short, may be asked again, once, with a request the caller makes of it. Without one, a
|
|
244
|
+
// failure fails the loop, and the answer ends it as one the output limit cut short.
|
|
245
|
+
const failure =
|
|
246
|
+
call.failure ??
|
|
247
|
+
(finished?.finishReason === "length" && finished.contextWindowExceeded
|
|
248
|
+
? {
|
|
249
|
+
error: new ModelProviderError(
|
|
250
|
+
"[SixbModels] The answer filled the model's context window.",
|
|
251
|
+
input.model.providerId,
|
|
252
|
+
input.model.modelId,
|
|
253
|
+
{ reason: "context-window-exceeded" }
|
|
254
|
+
),
|
|
255
|
+
}
|
|
256
|
+
: undefined)
|
|
257
|
+
if (failure && attempt === 0 && input.recoverStep) {
|
|
258
|
+
let recovered: PrepareModelStepResult | undefined
|
|
259
|
+
try {
|
|
260
|
+
recovered = await input.recoverStep({
|
|
261
|
+
stepIndex,
|
|
262
|
+
messages: requestMessages,
|
|
263
|
+
steps,
|
|
264
|
+
model: input.model,
|
|
265
|
+
signal: input.signal,
|
|
266
|
+
error: failure.error,
|
|
267
|
+
...(finished ? { usage: finished.usage } : {}),
|
|
268
|
+
})
|
|
269
|
+
} catch (error) {
|
|
270
|
+
if (!input.signal.aborted && !isAbortError(error)) throw error
|
|
271
|
+
return { status: "aborted", steps, partialContent: [] }
|
|
272
|
+
}
|
|
273
|
+
if (input.signal.aborted) return { status: "aborted", steps, partialContent: [] }
|
|
274
|
+
|
|
275
|
+
if (recovered?.messages) {
|
|
276
|
+
requestMessages = recovered.messages
|
|
277
|
+
requestMaxOutputTokens = recovered.maxOutputTokens
|
|
278
|
+
// What the call streamed is not the step's: its reader drops it.
|
|
279
|
+
if (accumulator.streamed) await input.onEvent?.({ type: "start-step", retry: true })
|
|
280
|
+
continue
|
|
234
281
|
}
|
|
235
282
|
}
|
|
236
|
-
|
|
237
|
-
// The step's cost, as the model records the call: the model is what records it (see
|
|
238
|
-
// AiModelCallRecorder.wrapModel), never the loop that reads it.
|
|
239
|
-
if (accepted) cost = accumulator.meter.end({ model: input.model, callId }).cost
|
|
240
|
-
}
|
|
283
|
+
if (call.failure) throw call.failure.error
|
|
241
284
|
|
|
242
|
-
|
|
243
|
-
|
|
285
|
+
completed = finished!
|
|
286
|
+
break
|
|
244
287
|
}
|
|
245
|
-
const completed = accumulator.complete()
|
|
246
288
|
const responseId = completed.responseId ?? `${callId}:response`
|
|
247
|
-
if (terminalStreamError) throw terminalStreamError.error
|
|
248
289
|
if (completed.projectionError) throw completed.projectionError
|
|
249
290
|
if (input.signal.aborted) {
|
|
250
291
|
return { status: "aborted", steps, partialContent: completed.content }
|
|
@@ -373,13 +414,93 @@ export async function runModelLoop(
|
|
|
373
414
|
)
|
|
374
415
|
}
|
|
375
416
|
const output = responseText(response)
|
|
376
|
-
return {
|
|
417
|
+
return {
|
|
418
|
+
status: "completed",
|
|
419
|
+
output,
|
|
420
|
+
steps,
|
|
421
|
+
finishReason: response.finishReason,
|
|
422
|
+
stepLimitReached: true,
|
|
423
|
+
}
|
|
377
424
|
}
|
|
378
425
|
}
|
|
379
426
|
|
|
380
427
|
throw new ModelStreamError("[SixbModels] Model loop exited without a terminal result.")
|
|
381
428
|
}
|
|
382
429
|
|
|
430
|
+
/**
|
|
431
|
+
* One provider call of a step, streamed into its accumulator. A cancel, or an abort error, leaves
|
|
432
|
+
* what arrived partial; any other error is the call's failure, whether it came before the
|
|
433
|
+
* stream's finish or after it.
|
|
434
|
+
*/
|
|
435
|
+
async function callModel(
|
|
436
|
+
input: RunModelLoopInput<unknown>,
|
|
437
|
+
call: {
|
|
438
|
+
readonly callId: string
|
|
439
|
+
readonly messages: readonly ModelMessage[]
|
|
440
|
+
readonly tools: readonly ModelToolSpecification[]
|
|
441
|
+
readonly accumulator: StreamAccumulator
|
|
442
|
+
/** Its step's own cap, below the loop's. */
|
|
443
|
+
readonly maxOutputTokens?: number
|
|
444
|
+
}
|
|
445
|
+
): Promise<{
|
|
446
|
+
readonly cost: ModelCallCost
|
|
447
|
+
readonly aborted: boolean
|
|
448
|
+
readonly failure?: { readonly error: unknown }
|
|
449
|
+
}> {
|
|
450
|
+
const { accumulator } = call
|
|
451
|
+
const maxOutputTokens =
|
|
452
|
+
call.maxOutputTokens === undefined
|
|
453
|
+
? input.maxOutputTokens
|
|
454
|
+
: Math.min(call.maxOutputTokens, input.maxOutputTokens ?? Number.POSITIVE_INFINITY)
|
|
455
|
+
let accepted = false
|
|
456
|
+
let cost: ModelCallCost = { status: "unpriceable", reason: "missing-usage" }
|
|
457
|
+
let failure: { readonly error: unknown } | undefined
|
|
458
|
+
let cancelled = false
|
|
459
|
+
try {
|
|
460
|
+
const stream = await input.model.stream({
|
|
461
|
+
callId: call.callId,
|
|
462
|
+
messages: call.messages,
|
|
463
|
+
tools: call.tools,
|
|
464
|
+
...(input.reasoning === undefined ? {} : { reasoning: input.reasoning }),
|
|
465
|
+
...(maxOutputTokens === undefined ? {} : { maxOutputTokens }),
|
|
466
|
+
...(input.caching === undefined ? {} : { caching: input.caching }),
|
|
467
|
+
...(input.output === undefined
|
|
468
|
+
? {}
|
|
469
|
+
: {
|
|
470
|
+
responseFormat: {
|
|
471
|
+
type: "json" as const,
|
|
472
|
+
name: input.output.name,
|
|
473
|
+
...(input.output.description === undefined
|
|
474
|
+
? {}
|
|
475
|
+
: { description: input.output.description }),
|
|
476
|
+
schema: input.output.schema,
|
|
477
|
+
},
|
|
478
|
+
}),
|
|
479
|
+
// A call the provider leaves silent fails where it is recorded (see reportModelCalls).
|
|
480
|
+
signal: input.signal,
|
|
481
|
+
})
|
|
482
|
+
accepted = true
|
|
483
|
+
for await (const event of stream.events) {
|
|
484
|
+
await accumulator.accept(event)
|
|
485
|
+
}
|
|
486
|
+
} catch (error) {
|
|
487
|
+
// A call that could not be recorded fails the run, even one that was being cancelled.
|
|
488
|
+
if (error instanceof ModelUsageRecordingError) throw error
|
|
489
|
+
if (input.signal.aborted || isAbortError(error)) cancelled = true
|
|
490
|
+
else failure = { error }
|
|
491
|
+
} finally {
|
|
492
|
+
// The step's cost, as the model records the call: the model is what records it (see
|
|
493
|
+
// AiModelCallRecorder.wrapModel), never the loop that reads it.
|
|
494
|
+
if (accepted) cost = accumulator.meter.end({ model: input.model, callId: call.callId }).cost
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return {
|
|
498
|
+
cost,
|
|
499
|
+
aborted: (cancelled || input.signal.aborted) && !accumulator.isFinished(),
|
|
500
|
+
...(failure === undefined ? {} : { failure }),
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
383
504
|
function assertLoopInput(input: RunModelLoopInput<unknown>): void {
|
|
384
505
|
if (
|
|
385
506
|
input.maxOutputTokens !== undefined &&
|
|
@@ -651,11 +772,19 @@ class StreamAccumulator {
|
|
|
651
772
|
private finished = false
|
|
652
773
|
private finishReason: ModelFinishReason | undefined
|
|
653
774
|
private rawFinishReason: string | undefined
|
|
775
|
+
private contextWindowExceeded = false
|
|
776
|
+
/** Whether the call handed its reader anything. */
|
|
777
|
+
streamed = false
|
|
654
778
|
/** Who served the call, what it used and what the provider charged. */
|
|
655
779
|
readonly meter = new LanguageModelCallMeter()
|
|
656
780
|
private projectionError: Error | undefined
|
|
657
781
|
|
|
658
|
-
constructor(private readonly
|
|
782
|
+
constructor(private readonly reader: RunModelLoopInput["onEvent"]) {}
|
|
783
|
+
|
|
784
|
+
private async onEvent(chunk: ModelUiChunk): Promise<void> {
|
|
785
|
+
this.streamed = true
|
|
786
|
+
await this.reader?.(chunk)
|
|
787
|
+
}
|
|
659
788
|
|
|
660
789
|
isFinished(): boolean {
|
|
661
790
|
return this.finished
|
|
@@ -729,6 +858,7 @@ class StreamAccumulator {
|
|
|
729
858
|
this.finished = true
|
|
730
859
|
this.finishReason = event.finishReason
|
|
731
860
|
this.rawFinishReason = event.rawFinishReason
|
|
861
|
+
this.contextWindowExceeded = event.contextWindowExceeded === true
|
|
732
862
|
this.meter.accept(event)
|
|
733
863
|
return
|
|
734
864
|
case "error":
|
|
@@ -759,6 +889,7 @@ class StreamAccumulator {
|
|
|
759
889
|
toolCalls: parsed.toolCalls,
|
|
760
890
|
finishReason: this.finishReason,
|
|
761
891
|
...(this.rawFinishReason === undefined ? {} : { rawFinishReason: this.rawFinishReason }),
|
|
892
|
+
...(this.contextWindowExceeded ? { contextWindowExceeded: true } : {}),
|
|
762
893
|
...this.meter.facts(),
|
|
763
894
|
...(this.projectionError === undefined ? {} : { projectionError: this.projectionError }),
|
|
764
895
|
}
|
|
@@ -853,7 +984,7 @@ class StreamAccumulator {
|
|
|
853
984
|
}
|
|
854
985
|
this.spans.set(event.id, part)
|
|
855
986
|
this.parts.push(part)
|
|
856
|
-
await this.onEvent
|
|
987
|
+
await this.onEvent({ type: "text-start", id: event.id })
|
|
857
988
|
}
|
|
858
989
|
|
|
859
990
|
private async startReasoning(
|
|
@@ -870,7 +1001,7 @@ class StreamAccumulator {
|
|
|
870
1001
|
}
|
|
871
1002
|
this.spans.set(event.id, part)
|
|
872
1003
|
this.parts.push(part)
|
|
873
|
-
await this.onEvent
|
|
1004
|
+
await this.onEvent({ type: "reasoning-start", id: event.id })
|
|
874
1005
|
}
|
|
875
1006
|
|
|
876
1007
|
private async appendText(
|
|
@@ -884,7 +1015,7 @@ class StreamAccumulator {
|
|
|
884
1015
|
)
|
|
885
1016
|
}
|
|
886
1017
|
part.text += event.delta
|
|
887
|
-
await this.onEvent
|
|
1018
|
+
await this.onEvent({ type: event.type, id: event.id, delta: event.delta })
|
|
888
1019
|
}
|
|
889
1020
|
|
|
890
1021
|
private async endText(
|
|
@@ -903,7 +1034,7 @@ class StreamAccumulator {
|
|
|
903
1034
|
)
|
|
904
1035
|
part.complete = true
|
|
905
1036
|
this.spans.delete(event.id)
|
|
906
|
-
await this.onEvent
|
|
1037
|
+
await this.onEvent({ type: event.type, id: event.id })
|
|
907
1038
|
}
|
|
908
1039
|
|
|
909
1040
|
private async startTool(
|
|
@@ -934,7 +1065,7 @@ class StreamAccumulator {
|
|
|
934
1065
|
}
|
|
935
1066
|
this.toolCalls.set(event.id, part)
|
|
936
1067
|
this.parts.push(part)
|
|
937
|
-
await this.onEvent
|
|
1068
|
+
await this.onEvent({
|
|
938
1069
|
type: "tool-input-start",
|
|
939
1070
|
toolCallId: event.id,
|
|
940
1071
|
toolName: event.toolName,
|
|
@@ -951,7 +1082,7 @@ class StreamAccumulator {
|
|
|
951
1082
|
)
|
|
952
1083
|
}
|
|
953
1084
|
part.inputText += event.delta
|
|
954
|
-
await this.onEvent
|
|
1085
|
+
await this.onEvent({
|
|
955
1086
|
type: "tool-input-delta",
|
|
956
1087
|
toolCallId: event.id,
|
|
957
1088
|
toolName: part.toolName,
|
package/src/agents/request.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type AgentApprovalRecord,
|
|
27
27
|
type AgentStorage,
|
|
28
28
|
AgentStorageError,
|
|
29
|
+
type AgentThreadComputer,
|
|
29
30
|
type AgentThreadRecord,
|
|
30
31
|
type ConversationAgentRunRecord,
|
|
31
32
|
type ConversationAgentRunSpec,
|
|
@@ -101,6 +102,8 @@ export interface RequestAgentRunInput {
|
|
|
101
102
|
* omitted, in the cloud. An existing thread keeps its own.
|
|
102
103
|
*/
|
|
103
104
|
readonly runsOn?: "computer"
|
|
105
|
+
/** The computer and folder a computer's thread this creates runs in. */
|
|
106
|
+
readonly computer?: AgentThreadComputer
|
|
104
107
|
/** Explicit id for the trigger (user) message. Defaults to a generated id. */
|
|
105
108
|
readonly messageId?: string
|
|
106
109
|
/** Caller principal for privileged integrations; scoped runtimes use their authorization principal. */
|
|
@@ -184,6 +187,7 @@ export async function requestAgentRun(
|
|
|
184
187
|
if (input.runsOn !== undefined && input.runsOn !== "computer") {
|
|
185
188
|
throw new AgentRequestError("invalid_message", `[Sixb] 'runsOn' must be "computer" or omitted.`)
|
|
186
189
|
}
|
|
190
|
+
if (!existingThread) assertComputerPlaceRequest(input.runsOn, input.computer)
|
|
187
191
|
const runsOn = existingThread ? existingThread.runsOn : input.runsOn
|
|
188
192
|
// The message's mode, else the sender's in the thread.
|
|
189
193
|
const approvalMode =
|
|
@@ -219,6 +223,7 @@ export async function requestAgentRun(
|
|
|
219
223
|
title: input.title,
|
|
220
224
|
principal,
|
|
221
225
|
runsOn,
|
|
226
|
+
...(input.computer === undefined ? {} : { computer: input.computer }),
|
|
222
227
|
}))
|
|
223
228
|
|
|
224
229
|
const triggerMessageId = input.messageId ?? createAgentMessageId()
|
|
@@ -890,7 +895,7 @@ function assertRequestAuthorityCanRunAgent(runtime: SixbRuntimeContext): void {
|
|
|
890
895
|
}
|
|
891
896
|
}
|
|
892
897
|
|
|
893
|
-
async function dispatchAgentRun(
|
|
898
|
+
export async function dispatchAgentRun(
|
|
894
899
|
runtime: SixbRuntimeContext,
|
|
895
900
|
agents: AgentStorage,
|
|
896
901
|
runId: string
|
|
@@ -938,6 +943,7 @@ function createThread(
|
|
|
938
943
|
readonly title?: string
|
|
939
944
|
readonly principal: Principal
|
|
940
945
|
readonly runsOn?: "computer"
|
|
946
|
+
readonly computer?: AgentThreadComputer
|
|
941
947
|
}
|
|
942
948
|
): Promise<AgentThreadRecord> {
|
|
943
949
|
return agents.threads.create({
|
|
@@ -946,9 +952,20 @@ function createThread(
|
|
|
946
952
|
ownerPrincipal: params.principal,
|
|
947
953
|
...(params.title === undefined ? {} : { title: params.title }),
|
|
948
954
|
...(params.runsOn === undefined ? {} : { runsOn: params.runsOn }),
|
|
955
|
+
...(params.computer === undefined ? {} : { computer: params.computer }),
|
|
949
956
|
})
|
|
950
957
|
}
|
|
951
958
|
|
|
959
|
+
/** A thread runs on a computer exactly when it names the computer and the folder there. */
|
|
960
|
+
export function assertComputerPlaceRequest(runsOn: unknown, computer: unknown): void {
|
|
961
|
+
if ((runsOn === "computer") !== (computer !== undefined)) {
|
|
962
|
+
throw new AgentRequestError(
|
|
963
|
+
"invalid_message",
|
|
964
|
+
`[Sixb] A thread that runs on a computer names it and its folder: send 'runsOn: "computer"' with 'computer', or neither.`
|
|
965
|
+
)
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
952
969
|
function requireAgentStorage(runtime: SixbRuntimeContext): AgentStorage {
|
|
953
970
|
const agents = runtime.storage.agents
|
|
954
971
|
if (!agents) {
|
package/src/agents/run-events.ts
CHANGED
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
} from "./streams/protocol"
|
|
18
18
|
|
|
19
19
|
export interface CompactionStartedInput {
|
|
20
|
-
|
|
20
|
+
/** A conversation's turn, or a child compacting its own thread. */
|
|
21
|
+
readonly run: AgentRunRecord
|
|
21
22
|
readonly reason: AgentContextCheckpointReason
|
|
22
23
|
readonly estimatedInputTokensBefore: number
|
|
23
24
|
}
|
|
@@ -28,7 +29,7 @@ export interface CompactionCompletedInput extends CompactionStartedInput {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export interface CompactionFailedInput {
|
|
31
|
-
readonly run:
|
|
32
|
+
readonly run: AgentRunRecord
|
|
32
33
|
readonly reason: AgentContextCheckpointReason
|
|
33
34
|
readonly errorCode: AgentCompactionFailureCode
|
|
34
35
|
}
|
package/src/agents/run-plan.ts
CHANGED
|
@@ -12,11 +12,13 @@ import { type RenderedOntologyDocs, renderOntologyDocs } from "../ontology/docs-
|
|
|
12
12
|
import type { SixbDefinitions } from "../runtime/definitions"
|
|
13
13
|
import type { Sixb } from "../runtime/sixb"
|
|
14
14
|
import type { AgentRunRecord } from "../storage/agents"
|
|
15
|
+
import type { AgentContextTokenRateSample } from "./context-token-rate"
|
|
15
16
|
import { AgentMemoryError } from "./errors"
|
|
16
17
|
import type { AgentMemoryRepoName } from "./memory"
|
|
17
18
|
import type { AgentMemoryRepoView } from "./memory-execution"
|
|
18
19
|
import { type AgentToolSpec, agentToolSpec } from "./run-tools"
|
|
19
20
|
import type { AgentSkillDefinition } from "./skills"
|
|
21
|
+
import { UNATTENDED_AGENT_MAX_STEPS } from "./step-limits"
|
|
20
22
|
import type { AgentReasoning } from "./types"
|
|
21
23
|
|
|
22
24
|
// What a run is set up with, as plain data: the project sends it, and the runner's harness, which
|
|
@@ -42,8 +44,15 @@ export interface AgentRunPlan {
|
|
|
42
44
|
readonly locale?: string
|
|
43
45
|
/** Reference docs for the object types its requester can see, from their own view. */
|
|
44
46
|
readonly ontologyDocs: RenderedOntologyDocs
|
|
47
|
+
/** At most this many model calls. Absent: it runs until its model answers. */
|
|
48
|
+
readonly maxSteps?: number
|
|
45
49
|
/** The models a turn can hand a child; a child spawns none. */
|
|
46
50
|
readonly delegation?: AgentRunDelegation
|
|
51
|
+
/**
|
|
52
|
+
* What the project's runs measured of its model's tokenizer lately, newest first, which its
|
|
53
|
+
* context estimate starts from (see readAgentContextTokenRates).
|
|
54
|
+
*/
|
|
55
|
+
readonly tokenRates: readonly AgentContextTokenRateSample[]
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
/** The project's language models, as a turn chooses one for a child it spawns. */
|
|
@@ -54,6 +63,8 @@ export interface AgentRunDelegation {
|
|
|
54
63
|
readonly defaultModel: LanguageModelRef
|
|
55
64
|
/** The tiers the project configures; empty when `models.language` is a list. */
|
|
56
65
|
readonly tiers: readonly LanguageModelTier[]
|
|
66
|
+
/** The most steps one run of a child takes: a spawn may ask for fewer. */
|
|
67
|
+
readonly maxSteps: number
|
|
57
68
|
}
|
|
58
69
|
|
|
59
70
|
export interface AgentRunDelegationModel extends LanguageModelRef {
|
|
@@ -99,7 +110,7 @@ export function readAgentRunPlan(
|
|
|
99
110
|
definitions: AgentRunPlanDefinitions,
|
|
100
111
|
run: AgentRunRecord,
|
|
101
112
|
view: AgentRunView
|
|
102
|
-
): AgentRunPlan {
|
|
113
|
+
): Omit<AgentRunPlan, "tokenRates"> {
|
|
103
114
|
const { agent, models, tools } = definitions
|
|
104
115
|
const shared = {
|
|
105
116
|
...(agent.instructions === undefined ? {} : { instructions: agent.instructions }),
|
|
@@ -108,6 +119,7 @@ export function readAgentRunPlan(
|
|
|
108
119
|
ontologyDocs: renderAgentRunOntologyDocs({ ...view, catalog: agent.ontologyDocs }),
|
|
109
120
|
}
|
|
110
121
|
|
|
122
|
+
const subagentMaxSteps = agent.subagentMaxSteps ?? UNATTENDED_AGENT_MAX_STEPS
|
|
111
123
|
if (run.kind === "subagent") {
|
|
112
124
|
const { model, reasoning, timeZone, locale } = run.spec
|
|
113
125
|
if (!models?.language?.getByRef(model)) {
|
|
@@ -121,6 +133,8 @@ export function readAgentRunPlan(
|
|
|
121
133
|
...shared,
|
|
122
134
|
model: { provider: model.provider, modelId: model.modelId },
|
|
123
135
|
tools: toolSpecs(definitions, run.spec.toolNames),
|
|
136
|
+
// What its spawn asked for, within what the project allows now.
|
|
137
|
+
maxSteps: Math.min(run.spec.maxSteps ?? subagentMaxSteps, subagentMaxSteps),
|
|
124
138
|
...(reasoning === undefined ? {} : { reasoning }),
|
|
125
139
|
...(timeZone === undefined ? {} : { timeZone }),
|
|
126
140
|
...(locale === undefined ? {} : { locale }),
|
|
@@ -143,7 +157,8 @@ export function readAgentRunPlan(
|
|
|
143
157
|
return Object.freeze({
|
|
144
158
|
...shared,
|
|
145
159
|
model: { provider: entry.provider, modelId: entry.modelId },
|
|
146
|
-
...(
|
|
160
|
+
...(agent.maxSteps === undefined ? {} : { maxSteps: agent.maxSteps }),
|
|
161
|
+
...(language ? { delegation: readAgentRunDelegation(language, subagentMaxSteps) } : {}),
|
|
147
162
|
tools: toolSpecs(
|
|
148
163
|
definitions,
|
|
149
164
|
tools.list().map((tool) => tool.name)
|
|
@@ -278,7 +293,10 @@ export function renderAgentRunOntologyDocs(input: {
|
|
|
278
293
|
}
|
|
279
294
|
|
|
280
295
|
/** The project's language models, as a turn offers them to the children it spawns. */
|
|
281
|
-
export function readAgentRunDelegation(
|
|
296
|
+
export function readAgentRunDelegation(
|
|
297
|
+
language: LanguageModelCatalog,
|
|
298
|
+
maxSteps = UNATTENDED_AGENT_MAX_STEPS
|
|
299
|
+
): AgentRunDelegation {
|
|
282
300
|
return {
|
|
283
301
|
models: language.list().map(
|
|
284
302
|
({ provider, modelId, tier, model }): AgentRunDelegationModel => ({
|
|
@@ -293,6 +311,7 @@ export function readAgentRunDelegation(language: LanguageModelCatalog): AgentRun
|
|
|
293
311
|
),
|
|
294
312
|
defaultModel: { provider: language.default.provider, modelId: language.default.modelId },
|
|
295
313
|
tiers: language.tiers,
|
|
314
|
+
maxSteps,
|
|
296
315
|
}
|
|
297
316
|
}
|
|
298
317
|
|
|
@@ -2,6 +2,7 @@ import type { FileRef } from "../blob-storage/types"
|
|
|
2
2
|
import type { LanguageModel, LanguageModelStreamEvent } from "../models"
|
|
3
3
|
import type {
|
|
4
4
|
AgentRunRecord,
|
|
5
|
+
AgentThreadComputer,
|
|
5
6
|
ConversationAgentRunRecord,
|
|
6
7
|
SubagentRunRecord,
|
|
7
8
|
} from "../storage/agents"
|
|
@@ -167,8 +168,7 @@ export function createHttpAgentRunSession<TRun extends AgentRunRecord>(
|
|
|
167
168
|
message: (messageId) => call("threads.message", [messageId]),
|
|
168
169
|
messages: (query) => call("threads.messages", [query]),
|
|
169
170
|
},
|
|
170
|
-
callTool: (toolCall, { signal,
|
|
171
|
-
call("callTool", [toolCall, maxFileBytes === undefined ? {} : { maxFileBytes }], signal),
|
|
171
|
+
callTool: (toolCall, { signal, ...options }) => call("callTool", [toolCall, options], signal),
|
|
172
172
|
artifacts: {
|
|
173
173
|
list: (query) => call("artifacts.list", [query]),
|
|
174
174
|
getVersion: (...args) => call("artifacts.getVersion", args),
|
|
@@ -233,8 +233,11 @@ export async function claimAgentRunOverHttp(input: {
|
|
|
233
233
|
readonly runId: string
|
|
234
234
|
readonly authorization: string
|
|
235
235
|
readonly leaseExpiresAt: string
|
|
236
|
-
/**
|
|
237
|
-
|
|
236
|
+
/**
|
|
237
|
+
* The computer claiming it, and its folder: a computer's turn runs only there, where its thread
|
|
238
|
+
* runs.
|
|
239
|
+
*/
|
|
240
|
+
readonly computer?: AgentThreadComputer
|
|
238
241
|
readonly fetch?: (request: Request) => Promise<Response>
|
|
239
242
|
}): Promise<AgentRunSession<ConversationAgentRunRecord> | null> {
|
|
240
243
|
const send = input.fetch ?? ((request: Request) => fetch(request))
|
|
@@ -244,7 +247,7 @@ export async function claimAgentRunOverHttp(input: {
|
|
|
244
247
|
headers: { authorization: input.authorization, "content-type": "application/json" },
|
|
245
248
|
body: encodeWireValue({
|
|
246
249
|
leaseExpiresAt: input.leaseExpiresAt,
|
|
247
|
-
...(input.
|
|
250
|
+
...(input.computer === undefined ? {} : { computer: input.computer }),
|
|
248
251
|
}),
|
|
249
252
|
})
|
|
250
253
|
)
|