@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
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { LanguageModel, ModelReasoning } from "../models"
|
|
2
|
+
import type { AgentContextCheckpointReason } from "../storage/agents"
|
|
3
|
+
import { type AgentContextBudget, resolveAgentContextBudget } from "./context-budget"
|
|
4
|
+
import { estimateAgentContextMessagesTokens, fixedAgentContextSize } from "./context-compaction"
|
|
5
|
+
import { apportionAgentContextTokens } from "./context-parts"
|
|
6
|
+
import { estimateAgentThreadRequest } from "./context-request"
|
|
7
|
+
import { readAgentContextTokenRates } from "./context-token-rate"
|
|
8
|
+
import type { AgentContextPartName, AgentMessage, AgentStepRequestSize } from "./message"
|
|
9
|
+
import {
|
|
10
|
+
type AgentTurnHistory,
|
|
11
|
+
type AgentTurnHistoryHost,
|
|
12
|
+
readAgentThreadHistory,
|
|
13
|
+
} from "./run-turn"
|
|
14
|
+
import { projectAgentThreadModelContext } from "./thread-context-projection"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* What a thread's context weighs against a model's limits, as its next turn would see them: what
|
|
18
|
+
* a context meter shows.
|
|
19
|
+
*/
|
|
20
|
+
export interface AgentThreadContextUse {
|
|
21
|
+
readonly windowTokens: number
|
|
22
|
+
/** The window less the output reserve: no request crosses it, and compaction starts past it. */
|
|
23
|
+
readonly limitTokens: number
|
|
24
|
+
/**
|
|
25
|
+
* What the next request weighs, as the worker estimates it before a turn (see
|
|
26
|
+
* estimateAgentThreadRequest), with the system prompt and tools the latest call sent: the API
|
|
27
|
+
* cannot render them. Absent before the thread's first answer.
|
|
28
|
+
*/
|
|
29
|
+
readonly usedTokens?: number
|
|
30
|
+
/**
|
|
31
|
+
* `usedTokens` by part, in the order a meter lists them. The split is an estimate (see
|
|
32
|
+
* apportionAgentContextTokens); the parts add up to `usedTokens`, which is not one.
|
|
33
|
+
*/
|
|
34
|
+
readonly parts?: readonly { readonly part: AgentContextPartName; readonly tokens: number }[]
|
|
35
|
+
/** The latest call the thread's history ends with, as the provider counted it. */
|
|
36
|
+
readonly lastCall?: {
|
|
37
|
+
readonly inputTokens: number
|
|
38
|
+
readonly outputTokens?: number
|
|
39
|
+
readonly cacheReadInputTokens?: number
|
|
40
|
+
readonly occurredAt: Date
|
|
41
|
+
}
|
|
42
|
+
readonly lastCompaction?: {
|
|
43
|
+
readonly reason: AgentContextCheckpointReason
|
|
44
|
+
readonly createdAt: Date
|
|
45
|
+
readonly estimatedInputTokensBefore: number
|
|
46
|
+
readonly estimatedInputTokensAfter: number
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Read a thread's context use for `model`: its history as a turn reads it, the call that history
|
|
52
|
+
* ends with, and the model's limits resolved as the worker resolves them for a turn run with
|
|
53
|
+
* `reasoning`, from the bytes per token a turn's plan would start from.
|
|
54
|
+
*/
|
|
55
|
+
export async function readAgentThreadContextUse(
|
|
56
|
+
host: AgentTurnHistoryHost,
|
|
57
|
+
input: {
|
|
58
|
+
readonly threadId: string
|
|
59
|
+
readonly model: LanguageModel
|
|
60
|
+
readonly reasoning?: ModelReasoning
|
|
61
|
+
}
|
|
62
|
+
): Promise<AgentThreadContextUse> {
|
|
63
|
+
const history = await readAgentThreadHistory(host, input.threadId)
|
|
64
|
+
const tokenRates = await readAgentContextTokenRates({
|
|
65
|
+
tokenRates: host.storage.agents.tokenRates,
|
|
66
|
+
projectId: host.projectId,
|
|
67
|
+
model: input.model,
|
|
68
|
+
})
|
|
69
|
+
const budget = resolveAgentContextBudget({
|
|
70
|
+
model: input.model,
|
|
71
|
+
...(input.reasoning === undefined ? {} : { reasoning: input.reasoning }),
|
|
72
|
+
tokenRates,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const call = history.usageAnchor?.modelCall
|
|
76
|
+
const inputTokens = call?.usage.inputTokens
|
|
77
|
+
const lastCall =
|
|
78
|
+
call && inputTokens !== undefined && inputTokens > 0
|
|
79
|
+
? {
|
|
80
|
+
inputTokens,
|
|
81
|
+
...(call.usage.outputTokens === undefined
|
|
82
|
+
? {}
|
|
83
|
+
: { outputTokens: call.usage.outputTokens }),
|
|
84
|
+
...(call.usage.cacheReadInputTokens === undefined
|
|
85
|
+
? {}
|
|
86
|
+
: { cacheReadInputTokens: call.usage.cacheReadInputTokens }),
|
|
87
|
+
occurredAt: call.occurredAt,
|
|
88
|
+
}
|
|
89
|
+
: undefined
|
|
90
|
+
|
|
91
|
+
const used = contextUsed(history, input.model, budget)
|
|
92
|
+
const checkpoint = history.checkpoint
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
windowTokens: budget.windowTokens,
|
|
96
|
+
limitTokens: budget.inputBudgetTokens,
|
|
97
|
+
...(used ? { usedTokens: used.tokens, parts: used.parts } : {}),
|
|
98
|
+
...(lastCall ? { lastCall } : {}),
|
|
99
|
+
...(checkpoint
|
|
100
|
+
? {
|
|
101
|
+
lastCompaction: {
|
|
102
|
+
reason: checkpoint.reason,
|
|
103
|
+
createdAt: checkpoint.createdAt,
|
|
104
|
+
estimatedInputTokensBefore: checkpoint.estimatedInputTokensBefore,
|
|
105
|
+
estimatedInputTokensAfter: checkpoint.estimatedInputTokensAfter,
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
: {}),
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* What the next request to `model` weighs, split by part: the worker's estimate, with the system
|
|
114
|
+
* prompt and tools the latest call sent, as its step recorded them. Undefined before the first
|
|
115
|
+
* answer.
|
|
116
|
+
*
|
|
117
|
+
* A thread whose calls recorded nothing (they predate the record) counts no prompt nor tools, and
|
|
118
|
+
* after a compaction at least what it left and the messages after the head it saw, as of then.
|
|
119
|
+
* With a record, the request is counted as it is now: what the summary and retained messages
|
|
120
|
+
* weigh, which a compaction's own estimate, made at the rate its run started from, overstates.
|
|
121
|
+
*/
|
|
122
|
+
function contextUsed(
|
|
123
|
+
history: Pick<AgentTurnHistory, "checkpoint" | "messages" | "usageAnchor">,
|
|
124
|
+
model: LanguageModel,
|
|
125
|
+
budget: Pick<AgentContextBudget, "bytesPerToken">
|
|
126
|
+
):
|
|
127
|
+
| { readonly tokens: number; readonly parts: NonNullable<AgentThreadContextUse["parts"]> }
|
|
128
|
+
| undefined {
|
|
129
|
+
const { checkpoint, messages } = history
|
|
130
|
+
if (!checkpoint && !messages.some((message) => message.role === "assistant")) return undefined
|
|
131
|
+
|
|
132
|
+
const request = latestStepRequest(messages)
|
|
133
|
+
const systemBytes = Object.values(request?.system ?? {}).reduce(
|
|
134
|
+
(total, bytes) => total + (bytes ?? 0),
|
|
135
|
+
0
|
|
136
|
+
)
|
|
137
|
+
const estimate = estimateAgentThreadRequest({
|
|
138
|
+
usageAnchor: history.usageAnchor,
|
|
139
|
+
retainedMessages: messages,
|
|
140
|
+
modelMessages: projectAgentThreadModelContext({ checkpoint, messages }),
|
|
141
|
+
model,
|
|
142
|
+
bytesPerToken: budget.bytesPerToken,
|
|
143
|
+
fixed: fixedAgentContextSize({
|
|
144
|
+
systemBytes,
|
|
145
|
+
tools: request?.tools ?? { count: 0, bytes: 0 },
|
|
146
|
+
}),
|
|
147
|
+
...(request?.contextDirectory === undefined
|
|
148
|
+
? {}
|
|
149
|
+
: { contextDirectory: request.contextDirectory }),
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
const after = checkpoint
|
|
153
|
+
? messages.filter((message) => message.seq > checkpoint.observedHeadSeq)
|
|
154
|
+
: []
|
|
155
|
+
const tokens =
|
|
156
|
+
checkpoint && !request
|
|
157
|
+
? Math.max(
|
|
158
|
+
estimate.tokens,
|
|
159
|
+
checkpoint.estimatedInputTokensAfter +
|
|
160
|
+
estimateAgentContextMessagesTokens(after, estimate.bytesPerToken).tokens
|
|
161
|
+
)
|
|
162
|
+
: estimate.tokens
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
tokens,
|
|
166
|
+
parts: apportionAgentContextTokens({
|
|
167
|
+
totalTokens: tokens,
|
|
168
|
+
prompt: { ...request?.system, tools: request?.tools.bytes ?? 0 },
|
|
169
|
+
promptBytesPerToken: budget.bytesPerToken,
|
|
170
|
+
history: estimate.history.parts,
|
|
171
|
+
...(estimate.history.images ? { images: estimate.history.images } : {}),
|
|
172
|
+
bytesPerToken: estimate.bytesPerToken,
|
|
173
|
+
}),
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** The request the thread's latest recorded step sent: its last step-start that carries one. */
|
|
178
|
+
function latestStepRequest(messages: readonly AgentMessage[]): AgentStepRequestSize | undefined {
|
|
179
|
+
for (const message of [...messages].reverse()) {
|
|
180
|
+
if (message.role !== "assistant") continue
|
|
181
|
+
|
|
182
|
+
for (const part of [...message.parts].reverse()) {
|
|
183
|
+
if (part.type === "step-start" && part.request) return part.request
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return undefined
|
|
187
|
+
}
|
package/src/agents/dispatch.ts
CHANGED
package/src/agents/execution.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
AgentApprovalRecord,
|
|
14
14
|
AgentRunRecord,
|
|
15
15
|
AgentStorage,
|
|
16
|
+
AgentThreadComputer,
|
|
16
17
|
AgentThreadRecord,
|
|
17
18
|
ConversationAgentRunRecord,
|
|
18
19
|
ListAgentApprovalsInput,
|
|
@@ -23,6 +24,8 @@ import type {
|
|
|
23
24
|
ListAgentThreadsResult,
|
|
24
25
|
SubagentRunRecord,
|
|
25
26
|
} from "../storage/agents"
|
|
27
|
+
import { AgentStorageError } from "../storage/agents/errors"
|
|
28
|
+
import { movesComputerPlace } from "../storage/agents/provider"
|
|
26
29
|
import type { AiCostSummary } from "../storage/ai-cost"
|
|
27
30
|
import type { AiModelCallUsage } from "../storage/ai-usage"
|
|
28
31
|
import { resolveTurnAccounting } from "./accounting"
|
|
@@ -41,6 +44,7 @@ import {
|
|
|
41
44
|
resolveAgentApprovalMode,
|
|
42
45
|
resumedApprovalMode,
|
|
43
46
|
stopAgentTurn,
|
|
47
|
+
threadHoldsPausedTurn,
|
|
44
48
|
} from "./approvals"
|
|
45
49
|
import { cancelAgentRun } from "./cancel"
|
|
46
50
|
import {
|
|
@@ -60,6 +64,8 @@ import {
|
|
|
60
64
|
removeAgentThreadParticipant,
|
|
61
65
|
} from "./participants"
|
|
62
66
|
import {
|
|
67
|
+
assertComputerPlaceRequest,
|
|
68
|
+
dispatchAgentRun,
|
|
63
69
|
type RequestAgentRunInput,
|
|
64
70
|
type RequestAgentRunResult,
|
|
65
71
|
requestAgentRun,
|
|
@@ -68,6 +74,7 @@ import {
|
|
|
68
74
|
} from "./request"
|
|
69
75
|
import { assertNoAgentSelector } from "./retired-config"
|
|
70
76
|
import { normalizeSandboxBinding } from "./sandbox"
|
|
77
|
+
import { publishAgentThreadMoved } from "./streams/protocol"
|
|
71
78
|
import { listSubagentThreadRuns } from "./subagent-runs"
|
|
72
79
|
import {
|
|
73
80
|
type AgentThreadView,
|
|
@@ -102,6 +109,8 @@ export type CreateExecutionAgentThreadInput<
|
|
|
102
109
|
* that computer's folder, so it takes no sandbox, and only its owner can message it.
|
|
103
110
|
*/
|
|
104
111
|
readonly runsOn?: "computer"
|
|
112
|
+
/** The computer and folder its turns run in: required with `runsOn: "computer"`. */
|
|
113
|
+
readonly computer?: AgentThreadComputer
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
export type AgentThreadsRuntime<TParams extends Record<string, unknown> = Record<string, unknown>> =
|
|
@@ -111,6 +120,16 @@ export type AgentThreadsRuntime<TParams extends Record<string, unknown> = Record
|
|
|
111
120
|
threadId: string,
|
|
112
121
|
input: { readonly expectedSandboxName: string }
|
|
113
122
|
): Promise<AgentThreadView>
|
|
123
|
+
/**
|
|
124
|
+
* Move a computer's thread to another of its owner's computers or folders, which alone run its
|
|
125
|
+
* turns from then on. Owner only; refused while a turn runs or waits on approvals.
|
|
126
|
+
*/
|
|
127
|
+
moveToComputer(threadId: string, computer: AgentThreadComputer): Promise<AgentThreadView>
|
|
128
|
+
/**
|
|
129
|
+
* Move a computer's thread to the cloud for good, with the turn waiting for it, if any. Owner
|
|
130
|
+
* only; refused while a turn runs or waits on approvals. The files stay on the computer.
|
|
131
|
+
*/
|
|
132
|
+
moveToCloud(threadId: string): Promise<AgentThreadView>
|
|
114
133
|
create(input: CreateExecutionAgentThreadInput<TParams>): Promise<AgentThreadView>
|
|
115
134
|
/**
|
|
116
135
|
* Copy a thread of the caller's, or one shared with them, into a new one the caller owns alone,
|
|
@@ -705,6 +724,70 @@ export function createAgentRuntime<
|
|
|
705
724
|
},
|
|
706
725
|
}
|
|
707
726
|
|
|
727
|
+
const ownedComputerThread = async (threadId: string): Promise<AgentThreadRecord> => {
|
|
728
|
+
const readable = await rule.read(threadId)
|
|
729
|
+
if (!readable) throw new AgentRequestError("thread_not_found", "[Sixb] Agent thread not found.")
|
|
730
|
+
if (readable.access !== "owner") {
|
|
731
|
+
throw new AgentRequestError(
|
|
732
|
+
"not_thread_owner",
|
|
733
|
+
`[Sixb] Only the owner of Agent thread '${threadId}' moves it.`
|
|
734
|
+
)
|
|
735
|
+
}
|
|
736
|
+
if (readable.thread.runsOn !== "computer") {
|
|
737
|
+
throw new AgentRequestError(
|
|
738
|
+
"invalid_message",
|
|
739
|
+
`[Sixb] Agent thread '${threadId}' runs in the cloud, on no computer.`
|
|
740
|
+
)
|
|
741
|
+
}
|
|
742
|
+
return readable.thread
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Move a thread in one transaction, refused while a turn holds it. Held calls are asked about
|
|
747
|
+
* after the move: with the thread locked, a turn that was running has either paused by now, which
|
|
748
|
+
* this sees, or still runs, which refused the move. They were reviewed for where the turn runs.
|
|
749
|
+
*/
|
|
750
|
+
const moveThread = <T>(
|
|
751
|
+
thread: AgentThreadRecord,
|
|
752
|
+
moves: boolean,
|
|
753
|
+
move: (agents: AgentStorage) => Promise<T>
|
|
754
|
+
): Promise<T> =>
|
|
755
|
+
runtime.storage.transaction(async (tx) => {
|
|
756
|
+
const agents = tx.agents
|
|
757
|
+
if (!agents) {
|
|
758
|
+
throw new AgentRequestError(
|
|
759
|
+
"storage_unavailable",
|
|
760
|
+
"[Sixb] Agent storage is not configured."
|
|
761
|
+
)
|
|
762
|
+
}
|
|
763
|
+
const moved = await move(agents).catch((error: unknown) => {
|
|
764
|
+
throw error instanceof AgentStorageError && error.code === "active_run_exists"
|
|
765
|
+
? new AgentRequestError(
|
|
766
|
+
"active_run_exists",
|
|
767
|
+
"[Sixb] A turn is running on the computer: stop it, or let it end, first."
|
|
768
|
+
)
|
|
769
|
+
: error
|
|
770
|
+
})
|
|
771
|
+
if (moves && (await threadHoldsPausedTurn(agents, thread))) {
|
|
772
|
+
throw new AgentRequestError(
|
|
773
|
+
"active_run_exists",
|
|
774
|
+
"[Sixb] A turn is waiting for your approval: answer or stop it first."
|
|
775
|
+
)
|
|
776
|
+
}
|
|
777
|
+
return moved
|
|
778
|
+
})
|
|
779
|
+
|
|
780
|
+
/** A hint whatever has the thread open follows: a lost one is corrected by its next read. */
|
|
781
|
+
const announceThreadMoved = async (thread: AgentThreadRecord): Promise<void> => {
|
|
782
|
+
await publishAgentThreadMoved(runtime.broker, {
|
|
783
|
+
projectId: runtime.projectId,
|
|
784
|
+
ownerPrincipal: thread.ownerPrincipal,
|
|
785
|
+
threadId: thread.id,
|
|
786
|
+
}).catch((error: unknown) => {
|
|
787
|
+
console.error(`[Sixb] Could not announce the move of Agent thread '${thread.id}'.`, error)
|
|
788
|
+
})
|
|
789
|
+
}
|
|
790
|
+
|
|
708
791
|
const agentRuntime: AgentRuntime<TParams> = {
|
|
709
792
|
get: getAgent,
|
|
710
793
|
memory: createAgentMemoryRuntime(runtime),
|
|
@@ -740,6 +823,26 @@ export function createAgentRuntime<
|
|
|
740
823
|
const [view] = await agentThreadViews(runtime, [{ ...thread, sandboxState }])
|
|
741
824
|
return view ?? thread
|
|
742
825
|
},
|
|
826
|
+
moveToComputer: async (threadId, computer) => {
|
|
827
|
+
const thread = await ownedComputerThread(threadId)
|
|
828
|
+
const moves = movesComputerPlace(thread, computer)
|
|
829
|
+
const moved = await moveThread(thread, moves, (agents) =>
|
|
830
|
+
agents.threads.assignComputer({ projectId: runtime.projectId, id: threadId, computer })
|
|
831
|
+
)
|
|
832
|
+
if (moves) await announceThreadMoved(thread)
|
|
833
|
+
const [view] = await agentThreadViews(runtime, [moved])
|
|
834
|
+
return view ?? moved
|
|
835
|
+
},
|
|
836
|
+
moveToCloud: async (threadId) => {
|
|
837
|
+
const thread = await ownedComputerThread(threadId)
|
|
838
|
+
const { thread: moved, queued } = await moveThread(thread, true, (agents) =>
|
|
839
|
+
agents.threads.moveToCloud({ projectId: runtime.projectId, id: threadId })
|
|
840
|
+
)
|
|
841
|
+
if (queued) await dispatchAgentRun(runtime, requireAgents(), queued.id)
|
|
842
|
+
await announceThreadMoved(thread)
|
|
843
|
+
const [view] = await agentThreadViews(runtime, [moved])
|
|
844
|
+
return view ?? moved
|
|
845
|
+
},
|
|
743
846
|
create: async (input) => {
|
|
744
847
|
assertNoAgentSelector(input)
|
|
745
848
|
const agent = getAgent()
|
|
@@ -759,6 +862,7 @@ export function createAgentRuntime<
|
|
|
759
862
|
`[Sixb] 'runsOn' must be "computer" or omitted.`
|
|
760
863
|
)
|
|
761
864
|
}
|
|
865
|
+
assertComputerPlaceRequest(input.runsOn, input.computer)
|
|
762
866
|
if (input.runsOn === "computer" && input.sandbox !== undefined) {
|
|
763
867
|
throw new AgentRequestError(
|
|
764
868
|
"invalid_sandbox_params",
|
|
@@ -782,6 +886,7 @@ export function createAgentRuntime<
|
|
|
782
886
|
ownerPrincipal: principal,
|
|
783
887
|
...(input.title === undefined ? {} : { title: input.title }),
|
|
784
888
|
...(input.runsOn === undefined ? {} : { runsOn: input.runsOn }),
|
|
889
|
+
...(input.computer === undefined ? {} : { computer: input.computer }),
|
|
785
890
|
})
|
|
786
891
|
return { ...created, participants: [] }
|
|
787
892
|
},
|
package/src/agents/index.ts
CHANGED
|
@@ -4,13 +4,18 @@ export {
|
|
|
4
4
|
sandboxCredentialIssue,
|
|
5
5
|
staticSandboxRecipe,
|
|
6
6
|
} from "../sandboxes/configuration"
|
|
7
|
+
export {
|
|
8
|
+
AGENT_TOKEN_RATE_MIN_BYTES_PER_TOKEN,
|
|
9
|
+
AGENT_TOKEN_RATE_SAMPLES,
|
|
10
|
+
} from "../storage/agents/types"
|
|
7
11
|
export type {
|
|
8
12
|
AgentFileDataProjection,
|
|
9
13
|
AgentFileDataResolverInput,
|
|
14
|
+
AgentMessageStep,
|
|
10
15
|
AgentToolResultFileResolverInput,
|
|
11
16
|
ToModelMessagesOptions,
|
|
12
17
|
} from "./adapters"
|
|
13
|
-
export { toModelMessages } from "./adapters"
|
|
18
|
+
export { agentMessageSteps, toModelMessages } from "./adapters"
|
|
14
19
|
export type { AgentApprovalResume } from "./approval-continuation"
|
|
15
20
|
export { resumeDecidedAgentTurn } from "./approval-continuation"
|
|
16
21
|
export { getAgentApprovalExecutor } from "./approval-executor"
|
|
@@ -71,22 +76,48 @@ export {
|
|
|
71
76
|
MAX_AGENT_CONTEXT_ENTRIES,
|
|
72
77
|
normalizeAgentContextEntries,
|
|
73
78
|
} from "./context/entries"
|
|
79
|
+
export type { AgentContextBudget, AgentModelSelection } from "./context-budget"
|
|
80
|
+
export {
|
|
81
|
+
AGENT_CONTEXT_COMPACTED_SHARE,
|
|
82
|
+
AGENT_IDLE_COMPACTION_TOKENS,
|
|
83
|
+
agentOutputCapTokens,
|
|
84
|
+
contextSummaryOutputTokens,
|
|
85
|
+
DEFAULT_AGENT_CONTEXT_WINDOW_TOKENS,
|
|
86
|
+
resolveAgentContextBudget,
|
|
87
|
+
} from "./context-budget"
|
|
74
88
|
export type {
|
|
75
89
|
AgentContextCompactionBoundary,
|
|
76
90
|
AgentContextEstimateTool,
|
|
91
|
+
AgentContextSize,
|
|
77
92
|
AgentContextTokenEstimate,
|
|
78
93
|
EstimateAgentContextRequestTokensInput,
|
|
79
94
|
} from "./context-compaction"
|
|
80
95
|
export {
|
|
81
96
|
AGENT_CONTEXT_ESTIMATOR_VERSION,
|
|
97
|
+
agentContextSizeTokens,
|
|
82
98
|
estimateAgentContextMessagesTokens,
|
|
83
99
|
estimateAgentContextRequestTokens,
|
|
100
|
+
measureAgentModelRequest,
|
|
101
|
+
measureModelRequest,
|
|
84
102
|
selectAgentContextCompactionBoundary,
|
|
85
|
-
serializeAgentMessagesForSummary,
|
|
86
103
|
shouldCompactAgentContext,
|
|
87
104
|
} from "./context-compaction"
|
|
88
105
|
export { serializeAgentContextForModel } from "./context-model"
|
|
106
|
+
export type { AgentSystemPromptSize } from "./context-parts"
|
|
107
|
+
export { measureAgentStepRequest } from "./context-parts"
|
|
108
|
+
export type { AgentThreadRequestEstimateInput } from "./context-request"
|
|
109
|
+
export { estimateAgentThreadRequest } from "./context-request"
|
|
89
110
|
export { resolveAgentContextParts } from "./context-resolution"
|
|
111
|
+
export type { AgentContextTokenRateSample } from "./context-token-rate"
|
|
112
|
+
export {
|
|
113
|
+
calibrateAgentContextBytesPerToken,
|
|
114
|
+
learnedAgentContextBytesPerToken,
|
|
115
|
+
measureAgentContextTokenRate,
|
|
116
|
+
measuringAgentContextTokenRates,
|
|
117
|
+
readAgentContextTokenRates,
|
|
118
|
+
} from "./context-token-rate"
|
|
119
|
+
export type { AgentThreadContextUse } from "./context-use"
|
|
120
|
+
export { readAgentThreadContextUse } from "./context-use"
|
|
90
121
|
export type {
|
|
91
122
|
AgentRunDispatchFailure,
|
|
92
123
|
DispatchedAgentRun,
|
|
@@ -116,13 +147,17 @@ export {
|
|
|
116
147
|
createSubagentRunId,
|
|
117
148
|
createSubagentThreadId,
|
|
118
149
|
} from "./ids"
|
|
150
|
+
export { AGENT_IMAGE_INPUT_TOKENS, AGENT_INLINE_IMAGE_LIMITS } from "./inline-images"
|
|
119
151
|
export {
|
|
120
152
|
AGENT_MESSAGE_CONTENT_VERSION,
|
|
121
153
|
type AgentApprovalCaller,
|
|
122
154
|
type AgentApprovalCallSummary,
|
|
123
155
|
type AgentApprovalOutcomePart,
|
|
156
|
+
type AgentContextPartBytes,
|
|
157
|
+
type AgentContextPartName,
|
|
124
158
|
type AgentContinuationPart,
|
|
125
159
|
type AgentFilePart,
|
|
160
|
+
type AgentHistoryPartName,
|
|
126
161
|
type AgentMailPart,
|
|
127
162
|
type AgentMessage,
|
|
128
163
|
type AgentMessagePart,
|
|
@@ -130,7 +165,9 @@ export {
|
|
|
130
165
|
type AgentMessageRole,
|
|
131
166
|
type AgentProviderStatePart,
|
|
132
167
|
type AgentReasoningPart,
|
|
168
|
+
type AgentStepRequestSize,
|
|
133
169
|
type AgentStepStartPart,
|
|
170
|
+
type AgentSystemPromptPartName,
|
|
134
171
|
type AgentTextPart,
|
|
135
172
|
type AgentToolCallPart,
|
|
136
173
|
type AgentToolCallState,
|
|
@@ -140,6 +177,7 @@ export type {
|
|
|
140
177
|
PausableModelLoopResult,
|
|
141
178
|
PrepareModelStepInput,
|
|
142
179
|
PrepareModelStepResult,
|
|
180
|
+
RecoverModelStepInput,
|
|
143
181
|
RunModelLoopInput,
|
|
144
182
|
} from "./model-loop"
|
|
145
183
|
export { runModelLoop } from "./model-loop"
|
|
@@ -267,6 +305,8 @@ export type {
|
|
|
267
305
|
AgentSkillCatalog,
|
|
268
306
|
AgentSkillDefinition,
|
|
269
307
|
} from "./skills"
|
|
308
|
+
export type { AgentOptions } from "./step-limits"
|
|
309
|
+
export { UNATTENDED_AGENT_MAX_STEPS } from "./step-limits"
|
|
270
310
|
export type {
|
|
271
311
|
AgentCompactionFailureCode,
|
|
272
312
|
AgentRunControlStreamId,
|
|
@@ -302,6 +342,10 @@ export type { AgentToolCatalog } from "./tool-catalog"
|
|
|
302
342
|
export type { AgentToolCallFile, StoredAgentToolFile } from "./tool-files"
|
|
303
343
|
export {
|
|
304
344
|
AGENT_FILE_MAX_BYTES,
|
|
345
|
+
AGENT_TOOL_OUTPUTS_DIRECTORY,
|
|
346
|
+
agentToolFilePath,
|
|
347
|
+
agentToolOutputPath,
|
|
348
|
+
isAgentToolOutputFile,
|
|
305
349
|
SANDBOX_CONTEXT_DIRECTORY,
|
|
306
350
|
storeAgentToolFile,
|
|
307
351
|
} from "./tool-files"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The image data one Agent request carries inline, at most. Gemini takes 20 MB of inline request
|
|
3
|
+
* data, Anthropic 32 MB and 100 images per request, OpenAI 50 MB of images: 16 MiB of encoded
|
|
4
|
+
* images leaves even Gemini more than 3 MB for the text.
|
|
5
|
+
*/
|
|
6
|
+
export const AGENT_INLINE_IMAGE_LIMITS = {
|
|
7
|
+
maxBytes: 16 * 1024 * 1024,
|
|
8
|
+
maxImages: 100,
|
|
9
|
+
} as const
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The input tokens an inline image counts for, wherever the runtime estimates a request. Sixb sends
|
|
13
|
+
* no image above 2,000 × 2,000 px: 5,334 tokens at 750 px per token, which Anthropic models that
|
|
14
|
+
* read images at full resolution charge. Anthropic's usual downscale to 1.15 MP charges about 1,600, and
|
|
15
|
+
* other providers less: the larger figure keeps every estimate on the side that cannot overflow.
|
|
16
|
+
*/
|
|
17
|
+
export const AGENT_IMAGE_INPUT_TOKENS = 5_400
|
package/src/agents/message.ts
CHANGED
|
@@ -43,6 +43,58 @@ export interface AgentReasoningPart {
|
|
|
43
43
|
/** A step boundary between assistant loop iterations. */
|
|
44
44
|
export interface AgentStepStartPart {
|
|
45
45
|
readonly type: "step-start"
|
|
46
|
+
/**
|
|
47
|
+
* The step answered a request whose tool results the turn cleared or cut to fit its context:
|
|
48
|
+
* the provider counted less for it than replaying the stored steps sends.
|
|
49
|
+
*/
|
|
50
|
+
readonly reducedRequest?: true
|
|
51
|
+
/** What the step's request carried, part by part, as the turn sent it. */
|
|
52
|
+
readonly request?: AgentStepRequestSize
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The parts a request is made of, as a context meter shows them: Sixb's own prompt, the project's
|
|
57
|
+
* `SIXB.md`, memory, skills and ontology (their index in the prompt and the files the agent read),
|
|
58
|
+
* the tool definitions, the summary of a condensed conversation, its messages, the other tool
|
|
59
|
+
* results, and attachments and images.
|
|
60
|
+
*/
|
|
61
|
+
export type AgentContextPartName =
|
|
62
|
+
| "system"
|
|
63
|
+
| "instructions"
|
|
64
|
+
| "memory"
|
|
65
|
+
| "skills"
|
|
66
|
+
| "ontology"
|
|
67
|
+
| "tools"
|
|
68
|
+
| "summary"
|
|
69
|
+
| "messages"
|
|
70
|
+
| "toolResults"
|
|
71
|
+
| "files"
|
|
72
|
+
|
|
73
|
+
/** The parts of the system prompt. */
|
|
74
|
+
export type AgentSystemPromptPartName = Extract<
|
|
75
|
+
AgentContextPartName,
|
|
76
|
+
"system" | "instructions" | "memory" | "skills" | "ontology"
|
|
77
|
+
>
|
|
78
|
+
|
|
79
|
+
/** The parts of the history: a file the agent read counts with what it is. */
|
|
80
|
+
export type AgentHistoryPartName = Extract<
|
|
81
|
+
AgentContextPartName,
|
|
82
|
+
"summary" | "messages" | "toolResults" | "files" | "memory" | "skills" | "ontology"
|
|
83
|
+
>
|
|
84
|
+
|
|
85
|
+
/** UTF-8 bytes by part; a part the request did not carry is left out. */
|
|
86
|
+
export type AgentContextPartBytes<TPart extends AgentContextPartName> = {
|
|
87
|
+
readonly [Part in TPart]?: number
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** A step's request as sent: UTF-8 bytes by part, and the images apart, which count by the image. */
|
|
91
|
+
export interface AgentStepRequestSize {
|
|
92
|
+
readonly system: AgentContextPartBytes<AgentSystemPromptPartName>
|
|
93
|
+
readonly tools: { readonly count: number; readonly bytes: number }
|
|
94
|
+
readonly history: AgentContextPartBytes<AgentHistoryPartName>
|
|
95
|
+
readonly images?: number
|
|
96
|
+
/** Where the run's context files were, which its reads were attributed by. */
|
|
97
|
+
readonly contextDirectory?: string
|
|
46
98
|
}
|
|
47
99
|
|
|
48
100
|
/** A blob-backed file attached to a user message or produced by an agent/tool. */
|
|
@@ -137,7 +189,24 @@ export interface AgentProviderStatePart {
|
|
|
137
189
|
*/
|
|
138
190
|
export type AgentToolCallPart = AgentToolCallBase &
|
|
139
191
|
(
|
|
140
|
-
| {
|
|
192
|
+
| {
|
|
193
|
+
readonly state: "output-available"
|
|
194
|
+
readonly output: JsonValue
|
|
195
|
+
/**
|
|
196
|
+
* What the model read of `output`, when its tool projected it into something else (a
|
|
197
|
+
* summary, a file's excerpt): later turns replay these bytes instead of projecting `output`
|
|
198
|
+
* again. Internal to the runtime; the HTTP API leaves it out.
|
|
199
|
+
*/
|
|
200
|
+
readonly modelOutput?:
|
|
201
|
+
| { readonly type: "text"; readonly value: string }
|
|
202
|
+
| { readonly type: "json"; readonly value: JsonValue }
|
|
203
|
+
/**
|
|
204
|
+
* The whole output, when it was too large for the model's context: a stored file, and
|
|
205
|
+
* where the run's sandbox holds it, relative to its context directory. `output` then keeps
|
|
206
|
+
* a bounded copy, and the model read a preview with that path.
|
|
207
|
+
*/
|
|
208
|
+
readonly outputFile?: { readonly fileRef: FileRef; readonly path: string }
|
|
209
|
+
}
|
|
141
210
|
| { readonly state: "output-error"; readonly errorText: string }
|
|
142
211
|
)
|
|
143
212
|
|