@sixb/core 0.1.26 → 0.2.1
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 +55 -55
- 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-fntqb7qy.js → chunk-57g0215c.js} +1 -1
- 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-b6ghvap7.js → chunk-8yzhjawq.js} +7 -7
- package/dist/{chunk-2vjnyz1s.js → chunk-9rh8ncs5.js} +2 -2
- package/dist/{chunk-pgrf64hp.js → chunk-agn8d8ys.js} +1 -1
- package/dist/{chunk-6qn7nmd3.js → chunk-aqyjb86c.js} +9 -9
- package/dist/{chunk-4jq2bg8t.js → chunk-ax10ft8d.js} +6 -6
- package/dist/{chunk-mqx25wwh.js → chunk-b7a97n8b.js} +12 -10
- package/dist/{chunk-mqx25wwh.js.map → chunk-b7a97n8b.js.map} +3 -3
- package/dist/{chunk-8v5a54qz.js → chunk-cb21tx14.js} +165 -42
- package/dist/{chunk-8v5a54qz.js.map → chunk-cb21tx14.js.map} +12 -12
- package/dist/{chunk-7ex2p3zp.js → chunk-cgznz22f.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-fe8zwt8b.js → chunk-e6xgz4h4.js} +22 -4
- package/dist/{chunk-fe8zwt8b.js.map → chunk-e6xgz4h4.js.map} +5 -3
- package/dist/{chunk-dgtd0836.js → chunk-e7v3trpz.js} +1 -1
- package/dist/{chunk-z9mg7wya.js → chunk-edx8xcsm.js} +111 -11
- package/dist/chunk-edx8xcsm.js.map +13 -0
- package/dist/{chunk-0bc3w0zq.js → chunk-epyfm23v.js} +38 -11
- package/dist/chunk-epyfm23v.js.map +11 -0
- 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-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-axb4ss9a.js → chunk-h05rg3bx.js} +43 -12
- package/dist/chunk-h05rg3bx.js.map +12 -0
- package/dist/{chunk-06sg8s4z.js → chunk-j1ny5fwh.js} +37 -13
- package/dist/chunk-j1ny5fwh.js.map +15 -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-phm3c7b9.js → chunk-jjmggm9a.js} +2 -2
- 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-xm8qgbqm.js → chunk-ks87m383.js} +55 -45
- package/dist/{chunk-xm8qgbqm.js.map → chunk-ks87m383.js.map} +5 -5
- package/dist/{chunk-ft3w5ahs.js → chunk-m3qe54bb.js} +1 -1
- package/dist/{chunk-y7j6x4h0.js → chunk-neftrg0n.js} +3 -3
- package/dist/{chunk-07kkp2e1.js → chunk-nghc7eq0.js} +2 -2
- package/dist/{chunk-vx4e4zv4.js → chunk-nqnfz3jg.js} +4 -4
- package/dist/{chunk-1xvqgg88.js → chunk-nz7815t3.js} +18 -2
- package/dist/chunk-nz7815t3.js.map +14 -0
- package/dist/{chunk-e24fvw8g.js → chunk-qbrmpgvv.js} +1 -1
- package/dist/{chunk-dp0cdtj2.js → chunk-qsg8rw04.js} +2 -2
- package/dist/{chunk-0kk2wt0h.js → chunk-r1cxq7vv.js} +2 -2
- package/dist/{chunk-yd00vzqr.js → chunk-ratj7t3t.js} +1009 -354
- package/dist/chunk-ratj7t3t.js.map +45 -0
- package/dist/{chunk-yavhtnac.js → chunk-rjeeyssy.js} +89 -43
- package/dist/{chunk-yavhtnac.js.map → chunk-rjeeyssy.js.map} +3 -3
- 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-9mab3dvg.js → chunk-s038wa5v.js} +9 -1
- package/dist/{chunk-9mab3dvg.js.map → chunk-s038wa5v.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-8xnz9vvp.js → chunk-t5daew4g.js} +23 -19
- package/dist/chunk-t5daew4g.js.map +12 -0
- package/dist/{chunk-7wn5z7mq.js → chunk-t9xyr7y9.js} +5 -5
- package/dist/{chunk-qst145py.js → chunk-tvbmh7tj.js} +24 -14
- package/dist/chunk-tvbmh7tj.js.map +18 -0
- 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-45ngkxkp.js → chunk-w122ymx4.js} +2 -2
- package/dist/{chunk-jn3ysaf2.js → chunk-w53trr0c.js} +12 -12
- package/dist/{chunk-jn3ysaf2.js.map → chunk-w53trr0c.js.map} +1 -1
- package/dist/{chunk-48jezz3j.js → chunk-w976a4me.js} +1 -1
- package/dist/{chunk-qtzftvxa.js → chunk-wx7smkn2.js} +1 -1
- 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-mdxmt0n3.js → chunk-z3evap21.js} +1074 -122
- package/dist/chunk-z3evap21.js.map +129 -0
- 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 +4 -4
- package/dist/events/selectors/index.js +1 -1
- package/dist/events/selectors/predicate.d.ts.map +1 -1
- package/dist/events/types/datasets.d.ts +6 -0
- package/dist/events/types/datasets.d.ts.map +1 -1
- 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 +67 -67
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +2 -2
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +10 -6
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/source-ordering.d.ts +7 -0
- package/dist/lake-storage/source-ordering.d.ts.map +1 -1
- package/dist/lake-storage/types.d.ts +18 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/lake-storage/version-inputs.d.ts +11 -3
- package/dist/lake-storage/version-inputs.d.ts.map +1 -1
- 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 +33 -33
- package/dist/pipelines/run-dispatch.d.ts +2 -0
- package/dist/pipelines/run-dispatch.d.ts.map +1 -1
- 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/schedules/index.js +2 -2
- 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.d.ts +2 -0
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +11 -7
- package/dist/storage/internal.js.map +1 -1
- 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/pipeline-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/transitions.d.ts +7 -0
- package/dist/storage/pipeline-runs/transitions.d.ts.map +1 -0
- package/dist/storage/projection-runs/provider.js +2 -2
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/sync-runs/transitions.d.ts +7 -0
- package/dist/storage/sync-runs/transitions.d.ts.map +1 -0
- package/dist/storage/workflow-runs/provider.js +10 -10
- package/dist/syncs/index.js +34 -34
- package/dist/syncs/run-dispatch.d.ts +2 -0
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- 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/dataset-sequence-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 +4514 -3530
- package/dist/testing/index.js.map +13 -12
- package/dist/testing/lake-changes-contract.d.ts.map +1 -1
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- 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.d.ts +1 -0
- package/dist/workers/index.d.ts.map +1 -1
- package/dist/workers/index.js +13 -3
- package/dist/workers/index.js.map +5 -4
- package/dist/workers/unstarted-run.d.ts +10 -0
- package/dist/workers/unstarted-run.d.ts.map +1 -0
- package/dist/workflows/builders.d.ts.map +1 -1
- package/dist/workflows/index.js +54 -54
- 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 +91 -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/events/selectors/predicate.ts +15 -0
- package/src/events/types/datasets.ts +6 -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/lake-storage/in-memory.ts +30 -20
- package/src/lake-storage/index.ts +2 -1
- package/src/lake-storage/source-ordering.ts +31 -4
- package/src/lake-storage/types.ts +18 -0
- package/src/lake-storage/version-inputs.ts +21 -5
- 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/pipelines/run-dispatch.ts +53 -6
- 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/internal.ts +2 -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/storage/pipeline-runs/in-memory.ts +2 -5
- package/src/storage/pipeline-runs/transitions.ts +14 -0
- package/src/storage/sync-runs/in-memory.ts +2 -5
- package/src/storage/sync-runs/transitions.ts +11 -0
- package/src/syncs/run-dispatch.ts +68 -13
- 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/dataset-sequence-contract.ts +81 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/lake-changes-contract.ts +2 -1
- package/src/testing/lake-storage-contract.ts +112 -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/workers/index.ts +1 -0
- package/src/workers/unstarted-run.ts +18 -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-06sg8s4z.js.map +0 -15
- package/dist/chunk-0bc3w0zq.js.map +0 -11
- 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-axb4ss9a.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-fntqb7qy.js.map → chunk-57g0215c.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-b6ghvap7.js.map → chunk-8yzhjawq.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-6qn7nmd3.js.map → chunk-aqyjb86c.js.map} +0 -0
- /package/dist/{chunk-4jq2bg8t.js.map → chunk-ax10ft8d.js.map} +0 -0
- /package/dist/{chunk-7ex2p3zp.js.map → chunk-cgznz22f.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-59kf345w.js.map → chunk-jbw70d6t.js.map} +0 -0
- /package/dist/{chunk-78ymxrn0.js.map → chunk-jhbk10wf.js.map} +0 -0
- /package/dist/{chunk-phm3c7b9.js.map → chunk-jjmggm9a.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-vx4e4zv4.js.map → chunk-nqnfz3jg.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-7wn5z7mq.js.map → chunk-t9xyr7y9.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-c14ap3s9.js.map → chunk-y2x2935j.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
MODEL_KINDS,
|
|
4
4
|
TOKENLESS_MODEL_KINDS2
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-tvefbgvw.js";
|
|
6
6
|
import {
|
|
7
7
|
AiUsageStorageError2,
|
|
8
8
|
normalizeAiModelCallUsage2,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
normalizeAiModelCallFilesRecord2,
|
|
12
12
|
assertSameCallExecution2,
|
|
13
13
|
assertAiUsageExecutionId2
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-agn8d8ys.js";
|
|
15
15
|
import {
|
|
16
16
|
assertJsonObject2
|
|
17
17
|
} from "./chunk-wy0qdqfm.js";
|
|
@@ -178,14 +178,45 @@ function normalizeAiAccountingQuery2(input) {
|
|
|
178
178
|
assertNonBlank(input.providerId, "accounting providerId");
|
|
179
179
|
if (input.modelId !== undefined)
|
|
180
180
|
assertNonBlank(input.modelId, "accounting modelId");
|
|
181
|
+
if (input.requester !== undefined && input.requester !== "none") {
|
|
182
|
+
if (input.requester.type !== "user" && input.requester.type !== "serviceAccount") {
|
|
183
|
+
throw new TypeError("[Sixb] AI accounting requester must be a user or a service account.");
|
|
184
|
+
}
|
|
185
|
+
assertNonBlank(input.requester.id, "accounting requester id");
|
|
186
|
+
}
|
|
187
|
+
if (input.source?.kind === "workflow" && input.source.workflowId !== undefined) {
|
|
188
|
+
assertNonBlank(input.source.workflowId, "accounting source workflowId");
|
|
189
|
+
}
|
|
190
|
+
if (input.modelKind !== undefined)
|
|
191
|
+
aiAccountingModelKind2(input.modelKind);
|
|
181
192
|
return {
|
|
182
193
|
projectId: input.projectId,
|
|
183
194
|
from: new Date(input.from),
|
|
184
195
|
to: new Date(input.to),
|
|
185
196
|
...input.providerId === undefined ? {} : { providerId: input.providerId },
|
|
186
|
-
...input.modelId === undefined ? {} : { modelId: input.modelId }
|
|
197
|
+
...input.modelId === undefined ? {} : { modelId: input.modelId },
|
|
198
|
+
...input.requester === undefined ? {} : { requester: input.requester },
|
|
199
|
+
...input.source === undefined ? {} : { source: input.source },
|
|
200
|
+
...input.modelKind === undefined ? {} : { modelKind: input.modelKind }
|
|
187
201
|
};
|
|
188
202
|
}
|
|
203
|
+
function aiAccountingSource(attribution) {
|
|
204
|
+
switch (attribution?.kind) {
|
|
205
|
+
case "agent":
|
|
206
|
+
case "subagent":
|
|
207
|
+
return { kind: "agent" };
|
|
208
|
+
case "workflow":
|
|
209
|
+
case "workflowAgent":
|
|
210
|
+
return { kind: "workflow", workflowId: attribution.workflowId };
|
|
211
|
+
case "action":
|
|
212
|
+
return { kind: "action" };
|
|
213
|
+
default:
|
|
214
|
+
return { kind: "other" };
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function matchesSource(source, filter) {
|
|
218
|
+
return source.kind === filter.kind && (filter.kind !== "workflow" || filter.workflowId === undefined || source.kind === "workflow" && source.workflowId === filter.workflowId);
|
|
219
|
+
}
|
|
189
220
|
function normalizeAiModelCallAccountingQuery2(input) {
|
|
190
221
|
const query = normalizeAiAccountingQuery2(input);
|
|
191
222
|
if (input.executionId !== undefined) {
|
|
@@ -202,7 +233,7 @@ function normalizeAiModelCallAccountingQuery2(input) {
|
|
|
202
233
|
}
|
|
203
234
|
function aiAccountingItemMatchesQuery(item, query) {
|
|
204
235
|
const occurredAt = item.usage.occurredAt.getTime();
|
|
205
|
-
return item.usage.projectId === query.projectId && occurredAt >= query.from.getTime() && occurredAt < query.to.getTime() && (query.providerId === undefined || item.usage.providerId === query.providerId) && (query.modelId === undefined || item.usage.requestedModelId === query.modelId);
|
|
236
|
+
return item.usage.projectId === query.projectId && occurredAt >= query.from.getTime() && occurredAt < query.to.getTime() && (query.providerId === undefined || item.usage.providerId === query.providerId) && (query.modelId === undefined || item.usage.requestedModelId === query.modelId) && (query.modelKind === undefined || item.usage.modelKind === query.modelKind) && (query.source === undefined || matchesSource(aiAccountingSource(item.attribution), query.source)) && (query.requester === undefined || (query.requester === "none" ? item.requester === undefined : item.requester?.type === query.requester.type && item.requester.id === query.requester.id));
|
|
206
237
|
}
|
|
207
238
|
function buildAiAccountingOverview(input, source) {
|
|
208
239
|
const query = normalizeAiAccountingQuery2(input);
|
|
@@ -211,14 +242,24 @@ function buildAiAccountingOverview(input, source) {
|
|
|
211
242
|
const periods = accountingPeriods(query.from, query.to, input.bucket);
|
|
212
243
|
const periodItems = new Map(periods.map((period) => [period.start.getTime(), []]));
|
|
213
244
|
const modelItems = new Map;
|
|
245
|
+
const modelPeriodItems = new Map;
|
|
214
246
|
const kindItems = new Map;
|
|
247
|
+
const personItems = new Map;
|
|
215
248
|
const agentItems = new Map;
|
|
216
249
|
const workflowItems = new Map;
|
|
217
250
|
for (const item of items) {
|
|
218
251
|
const periodStart = aiAccountingBucketStart(item.usage.occurredAt, input.bucket).getTime();
|
|
219
252
|
periodItems.get(periodStart)?.push(item);
|
|
220
|
-
|
|
253
|
+
const modelKey = JSON.stringify([item.usage.providerId, item.usage.requestedModelId]);
|
|
254
|
+
appendGrouped(modelItems, modelKey, item);
|
|
255
|
+
let modelPeriods = modelPeriodItems.get(modelKey);
|
|
256
|
+
if (!modelPeriods) {
|
|
257
|
+
modelPeriods = new Map;
|
|
258
|
+
modelPeriodItems.set(modelKey, modelPeriods);
|
|
259
|
+
}
|
|
260
|
+
appendGrouped(modelPeriods, periodStart, item);
|
|
221
261
|
appendGrouped(kindItems, item.usage.modelKind ?? "", item);
|
|
262
|
+
appendGrouped(personItems, JSON.stringify(item.requester ? [item.requester.type, item.requester.id] : []), item);
|
|
222
263
|
if (item.attribution?.kind === "agent") {
|
|
223
264
|
appendGrouped(agentItems, JSON.stringify(["agent"]), item);
|
|
224
265
|
} else if (item.attribution?.kind === "workflowAgent") {
|
|
@@ -240,7 +281,19 @@ function buildAiAccountingOverview(input, source) {
|
|
|
240
281
|
const [providerId, modelId] = JSON.parse(key);
|
|
241
282
|
return { providerId, modelId, ...aggregateAccountingItems(grouped) };
|
|
242
283
|
}).sort(compareModelBreakdowns);
|
|
284
|
+
const modelSeries = [...modelPeriodItems].map(([key, grouped]) => {
|
|
285
|
+
const [providerId, modelId] = JSON.parse(key);
|
|
286
|
+
return {
|
|
287
|
+
providerId,
|
|
288
|
+
modelId,
|
|
289
|
+
series: periods.map((period) => ({
|
|
290
|
+
...period,
|
|
291
|
+
...aggregateAccountingItems(grouped.get(period.start.getTime()) ?? [])
|
|
292
|
+
}))
|
|
293
|
+
};
|
|
294
|
+
}).sort(compareModelSeries);
|
|
243
295
|
const kinds = [...kindItems].map(([kind, grouped]) => kindBreakdown(kind, aggregateAccountingItems(grouped))).sort(compareKindBreakdowns);
|
|
296
|
+
const people = [...personItems].map(([key, grouped]) => personBreakdown(key, aggregateAccountingItems(grouped))).sort(compareModelCost);
|
|
244
297
|
const agents = [...agentItems].map(([key, grouped]) => {
|
|
245
298
|
const [kind, workflowId, agentStepId] = JSON.parse(key);
|
|
246
299
|
return kind === "agent" ? { kind, ...aggregateAccountingItems(grouped) } : {
|
|
@@ -256,8 +309,10 @@ function buildAiAccountingOverview(input, source) {
|
|
|
256
309
|
bucket: input.bucket,
|
|
257
310
|
totals: aggregateAccountingItems(items),
|
|
258
311
|
series,
|
|
312
|
+
modelSeries,
|
|
259
313
|
models,
|
|
260
314
|
kinds,
|
|
315
|
+
people,
|
|
261
316
|
agents,
|
|
262
317
|
workflows
|
|
263
318
|
});
|
|
@@ -276,7 +331,9 @@ function buildAiAccountingOverviewFromFragments2(input, fragments) {
|
|
|
276
331
|
const totals = aggregateFragmentAccumulator();
|
|
277
332
|
const series = new Map(periods.map((period) => [period.start.getTime(), aggregateFragmentAccumulator()]));
|
|
278
333
|
const models = new Map;
|
|
334
|
+
const modelSeries = new Map;
|
|
279
335
|
const kinds = new Map;
|
|
336
|
+
const people = new Map;
|
|
280
337
|
const agents = new Map;
|
|
281
338
|
const workflows = new Map;
|
|
282
339
|
for (const fragment of fragments) {
|
|
@@ -300,9 +357,25 @@ function buildAiAccountingOverviewFromFragments2(input, fragments) {
|
|
|
300
357
|
requiredFragmentString(fragment.modelId, "modelId")
|
|
301
358
|
]));
|
|
302
359
|
break;
|
|
360
|
+
case "modelSeries": {
|
|
361
|
+
const key = JSON.stringify([
|
|
362
|
+
requiredFragmentString(fragment.providerId, "providerId"),
|
|
363
|
+
requiredFragmentString(fragment.modelId, "modelId")
|
|
364
|
+
]);
|
|
365
|
+
let periodsOfModel = modelSeries.get(key);
|
|
366
|
+
if (!periodsOfModel) {
|
|
367
|
+
periodsOfModel = new Map;
|
|
368
|
+
modelSeries.set(key, periodsOfModel);
|
|
369
|
+
}
|
|
370
|
+
target = getFragmentAccumulator(periodsOfModel, requiredFragmentDate(fragment.start, "model series start").getTime());
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
303
373
|
case "kind":
|
|
304
374
|
target = getFragmentAccumulator(kinds, fragment.modelKind ?? "");
|
|
305
375
|
break;
|
|
376
|
+
case "person":
|
|
377
|
+
target = getFragmentAccumulator(people, JSON.stringify(fragment.requesterType && fragment.requesterId ? [fragment.requesterType, fragment.requesterId] : []));
|
|
378
|
+
break;
|
|
306
379
|
case "agent":
|
|
307
380
|
target = getFragmentAccumulator(agents, JSON.stringify([
|
|
308
381
|
requiredFragmentString(fragment.agentKind, "agentKind"),
|
|
@@ -328,7 +401,19 @@ function buildAiAccountingOverviewFromFragments2(input, fragments) {
|
|
|
328
401
|
const [providerId, modelId] = JSON.parse(key);
|
|
329
402
|
return { providerId, modelId, ...finishAggregateFragment(value) };
|
|
330
403
|
}).sort(compareModelBreakdowns),
|
|
404
|
+
modelSeries: [...modelSeries].map(([key, byStart]) => {
|
|
405
|
+
const [providerId, modelId] = JSON.parse(key);
|
|
406
|
+
return {
|
|
407
|
+
providerId,
|
|
408
|
+
modelId,
|
|
409
|
+
series: periods.map((period) => ({
|
|
410
|
+
...period,
|
|
411
|
+
...finishAggregateFragment(byStart.get(period.start.getTime()) ?? aggregateFragmentAccumulator())
|
|
412
|
+
}))
|
|
413
|
+
};
|
|
414
|
+
}).sort(compareModelSeries),
|
|
331
415
|
kinds: [...kinds].map(([kind, value]) => kindBreakdown(kind, finishAggregateFragment(value))).sort(compareKindBreakdowns),
|
|
416
|
+
people: [...people].map(([key, value]) => personBreakdown(key, finishAggregateFragment(value))).sort(compareModelCost),
|
|
332
417
|
agents: [...agents].map(([key, value]) => {
|
|
333
418
|
const [kind, workflowId, agentStepId] = JSON.parse(key);
|
|
334
419
|
return kind === "agent" ? { kind, ...finishAggregateFragment(value) } : {
|
|
@@ -594,6 +679,20 @@ function agentBreakdownKey(value) {
|
|
|
594
679
|
function compareWorkflowBreakdowns(left, right) {
|
|
595
680
|
return right.modelCallCount - left.modelCallCount || left.workflowId.localeCompare(right.workflowId);
|
|
596
681
|
}
|
|
682
|
+
function personBreakdown(key, aggregate) {
|
|
683
|
+
const [type, id] = JSON.parse(key);
|
|
684
|
+
return type && id ? { requester: { type, id }, ...aggregate } : aggregate;
|
|
685
|
+
}
|
|
686
|
+
function compareModelCost(left, right) {
|
|
687
|
+
return costNanos(right) - costNanos(left) || right.modelCallCount - left.modelCallCount;
|
|
688
|
+
}
|
|
689
|
+
function costNanos(value) {
|
|
690
|
+
return value.costs.amounts.reduce((sum, amount) => sum + Number(amount.amountNanos), 0);
|
|
691
|
+
}
|
|
692
|
+
function compareModelSeries(left, right) {
|
|
693
|
+
const total = (value) => value.series.reduce((sum, bucket) => sum + costNanos(bucket), 0);
|
|
694
|
+
return total(right) - total(left) || left.providerId.localeCompare(right.providerId) || left.modelId.localeCompare(right.modelId);
|
|
695
|
+
}
|
|
597
696
|
function kindBreakdown(kind, aggregate) {
|
|
598
697
|
return kind ? { modelKind: kind, ...aggregate } : aggregate;
|
|
599
698
|
}
|
|
@@ -633,6 +732,16 @@ function directModelCallAttribution2(kind, id, primitiveId) {
|
|
|
633
732
|
}
|
|
634
733
|
|
|
635
734
|
// src/storage/ai-cost/groups.ts
|
|
735
|
+
function aiModelCallGroupKey(root) {
|
|
736
|
+
switch (root.attribution?.kind) {
|
|
737
|
+
case "agent":
|
|
738
|
+
return `thread:${root.attribution.threadId}`;
|
|
739
|
+
case "workflowAgent":
|
|
740
|
+
return `workflowRun:${root.attribution.workflowRunId}`;
|
|
741
|
+
default:
|
|
742
|
+
return root.executionId;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
636
745
|
function aiModelCallGroupFragmentFromRow2(row) {
|
|
637
746
|
let attribution = directModelCallAttribution2(row.executor_kind, row.executor_id, row.primitive_id);
|
|
638
747
|
if (row.root_agent_run_id && row.root_thread_id) {
|
|
@@ -651,8 +760,10 @@ function aiModelCallGroupFragmentFromRow2(row) {
|
|
|
651
760
|
};
|
|
652
761
|
}
|
|
653
762
|
const executionAttribution = row.direct_kind === "subagent" && row.direct_run_id && row.parent_run_id ? { kind: "subagent", subagentRunId: row.direct_run_id, parentRunId: row.parent_run_id } : attribution;
|
|
763
|
+
const requester = row.requested_by_user_id ? { type: "user", id: row.requested_by_user_id } : row.requested_by_service_account_id ? { type: "serviceAccount", id: row.requested_by_service_account_id } : undefined;
|
|
654
764
|
return {
|
|
655
|
-
|
|
765
|
+
group: row.group_key,
|
|
766
|
+
root: { executionId: row.root_execution_id, attribution, ...requester ? { requester } : {} },
|
|
656
767
|
execution: { executionId: row.execution_id, attribution: executionAttribution },
|
|
657
768
|
model: { providerId: row.provider_id, modelId: row.requested_model_id },
|
|
658
769
|
firstCallAt: new Date(row.first_call_at),
|
|
@@ -661,6 +772,8 @@ function aiModelCallGroupFragmentFromRow2(row) {
|
|
|
661
772
|
tokenCount: row.token_count,
|
|
662
773
|
tokenlessCount: row.tokenless_count,
|
|
663
774
|
totalTokens: row.total_tokens,
|
|
775
|
+
inputTokens: row.input_tokens,
|
|
776
|
+
cacheReadInputTokens: row.cache_read_input_tokens,
|
|
664
777
|
outputImages: row.output_images,
|
|
665
778
|
inputCharacters: row.input_characters,
|
|
666
779
|
audioDurationMs: row.audio_duration_ms,
|
|
@@ -673,34 +786,60 @@ function aiModelCallGroupFragmentFromRow2(row) {
|
|
|
673
786
|
}
|
|
674
787
|
};
|
|
675
788
|
}
|
|
676
|
-
function
|
|
677
|
-
|
|
789
|
+
function normalizeAiModelCallGroupSort2(sort) {
|
|
790
|
+
if (sort === undefined || sort === "recent")
|
|
791
|
+
return "recent";
|
|
792
|
+
if (sort === "cost")
|
|
793
|
+
return "cost";
|
|
794
|
+
throw new TypeError("[Sixb] AI model-call groups sort by 'recent' or 'cost'.");
|
|
795
|
+
}
|
|
796
|
+
function buildAiModelCallGroupsFromFragments2(fragments, sort = "recent") {
|
|
797
|
+
const groups = new Map;
|
|
678
798
|
for (const fragment of fragments)
|
|
679
|
-
append(
|
|
680
|
-
return [...
|
|
681
|
-
const first = rootFragments[0];
|
|
799
|
+
append(groups, fragment.group, fragment);
|
|
800
|
+
return [...groups.values()].map((groupFragments) => {
|
|
682
801
|
const executions = new Map;
|
|
683
|
-
for (const fragment of
|
|
802
|
+
for (const fragment of groupFragments)
|
|
684
803
|
append(executions, fragment.execution.executionId, fragment);
|
|
685
|
-
|
|
686
|
-
...
|
|
687
|
-
...summarize(
|
|
688
|
-
...timeRange(
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
804
|
+
const summaries = [...executions.values()].map((items) => ({
|
|
805
|
+
...items[0].execution,
|
|
806
|
+
...summarize(items),
|
|
807
|
+
...timeRange(items),
|
|
808
|
+
models: modelSummaries(items)
|
|
809
|
+
})).sort((a, b) => a.firstCallAt.getTime() - b.firstCallAt.getTime() || compareText(a.executionId, b.executionId));
|
|
810
|
+
const root = groupFragments.reduce((first, fragment) => fragment.firstCallAt < first.firstCallAt ? fragment : first).root;
|
|
811
|
+
const requester = groupFragments.find((fragment) => fragment.root.requester)?.root.requester;
|
|
812
|
+
const group = {
|
|
813
|
+
...root,
|
|
814
|
+
...requester ? { requester } : {},
|
|
815
|
+
...summarize(groupFragments),
|
|
816
|
+
...timeRange(groupFragments),
|
|
817
|
+
executions: summaries
|
|
697
818
|
};
|
|
698
|
-
|
|
819
|
+
return { group, cost: totalNanos(group.costs) };
|
|
820
|
+
}).sort((a, b) => (sort === "cost" ? compareBig(b.cost, a.cost) : 0) || b.group.lastCallAt.getTime() - a.group.lastCallAt.getTime() || compareText(a.group.executionId, b.group.executionId)).map(({ group }) => group);
|
|
821
|
+
}
|
|
822
|
+
function modelSummaries(items) {
|
|
823
|
+
const models = new Map;
|
|
824
|
+
for (const item of items)
|
|
825
|
+
append(models, JSON.stringify(item.model), item);
|
|
826
|
+
return [...models.values()].map((fragments) => {
|
|
827
|
+
const { modelCallCount, costs } = summarize(fragments);
|
|
828
|
+
return { ...fragments[0].model, modelCallCount, costs };
|
|
829
|
+
}).sort((a, b) => compareText(a.providerId, b.providerId) || compareText(a.modelId, b.modelId));
|
|
830
|
+
}
|
|
831
|
+
function totalNanos(costs) {
|
|
832
|
+
return costs.amounts.reduce((total, amount) => total + BigInt(amount.amountNanos), 0n);
|
|
833
|
+
}
|
|
834
|
+
function compareBig(a, b) {
|
|
835
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
699
836
|
}
|
|
700
837
|
function buildAiModelCallGroups(input, source) {
|
|
701
838
|
const query = normalizeAiModelCallAccountingQuery2(input);
|
|
839
|
+
const sort = normalizeAiModelCallGroupSort2(input.sort);
|
|
702
840
|
const fragments = source.filter((item) => aiAccountingItemMatchesQuery(item, query) && (query.valuationStatus === undefined || (item.cost?.status ?? "unvalued") === query.valuationStatus)).map((item) => ({
|
|
703
|
-
|
|
841
|
+
group: aiModelCallGroupKey(item.root),
|
|
842
|
+
root: item.requester ? { ...item.root, requester: item.requester } : item.root,
|
|
704
843
|
execution: { executionId: item.usage.executionId, attribution: item.attribution },
|
|
705
844
|
model: { providerId: item.usage.providerId, modelId: item.usage.requestedModelId },
|
|
706
845
|
firstCallAt: item.usage.occurredAt,
|
|
@@ -709,13 +848,15 @@ function buildAiModelCallGroups(input, source) {
|
|
|
709
848
|
tokenCount: item.usage.usage.totalTokens === undefined ? "0" : "1",
|
|
710
849
|
tokenlessCount: item.usage.usage.totalTokens === undefined && item.usage.modelKind !== undefined && TOKENLESS_MODEL_KINDS2.includes(item.usage.modelKind) ? "1" : "0",
|
|
711
850
|
totalTokens: item.usage.usage.totalTokens?.toString() ?? null,
|
|
851
|
+
inputTokens: item.usage.usage.inputTokens?.toString() ?? null,
|
|
852
|
+
cacheReadInputTokens: item.usage.usage.cacheReadInputTokens?.toString() ?? null,
|
|
712
853
|
outputImages: item.usage.usage.outputImages?.toString() ?? null,
|
|
713
854
|
inputCharacters: item.usage.usage.inputCharacters?.toString() ?? null,
|
|
714
855
|
audioDurationMs: item.usage.usage.audioDurationMs?.toString() ?? null,
|
|
715
856
|
valuationStatus: item.cost?.status ?? "unvalued",
|
|
716
857
|
...item.cost && item.cost.status !== "unpriceable" ? { money: item.cost.money } : {}
|
|
717
858
|
}));
|
|
718
|
-
const groups = buildAiModelCallGroupsFromFragments2(fragments);
|
|
859
|
+
const groups = buildAiModelCallGroupsFromFragments2(fragments, sort);
|
|
719
860
|
const items = groups.slice(query.offset, query.offset + query.limit);
|
|
720
861
|
return structuredClone({
|
|
721
862
|
items,
|
|
@@ -729,6 +870,8 @@ function summarize(items) {
|
|
|
729
870
|
let tokenless = 0n;
|
|
730
871
|
let tokens = 0n;
|
|
731
872
|
const media = {
|
|
873
|
+
inputTokens: undefined,
|
|
874
|
+
cacheReadInputTokens: undefined,
|
|
732
875
|
outputImages: undefined,
|
|
733
876
|
inputCharacters: undefined,
|
|
734
877
|
audioDurationMs: undefined
|
|
@@ -741,7 +884,13 @@ function summarize(items) {
|
|
|
741
884
|
tokenCount += BigInt(item.tokenCount);
|
|
742
885
|
tokenless += BigInt(item.tokenlessCount);
|
|
743
886
|
tokens += BigInt(item.totalTokens ?? "0");
|
|
744
|
-
for (const field of [
|
|
887
|
+
for (const field of [
|
|
888
|
+
"inputTokens",
|
|
889
|
+
"cacheReadInputTokens",
|
|
890
|
+
"outputImages",
|
|
891
|
+
"inputCharacters",
|
|
892
|
+
"audioDurationMs"
|
|
893
|
+
]) {
|
|
745
894
|
const value = item[field];
|
|
746
895
|
if (value !== null)
|
|
747
896
|
media[field] = (media[field] ?? 0n) + BigInt(value);
|
|
@@ -759,6 +908,8 @@ function summarize(items) {
|
|
|
759
908
|
return {
|
|
760
909
|
modelCallCount: safeCount(calls),
|
|
761
910
|
...tokenCount > 0n && calls === tokenCount + tokenless ? { totalTokens: safeCount(tokens) } : {},
|
|
911
|
+
...media.inputTokens === undefined ? {} : { inputTokens: safeCount(media.inputTokens) },
|
|
912
|
+
...media.cacheReadInputTokens === undefined ? {} : { cacheReadInputTokens: safeCount(media.cacheReadInputTokens) },
|
|
762
913
|
...media.outputImages === undefined ? {} : { outputImages: safeCount(media.outputImages) },
|
|
763
914
|
...media.inputCharacters === undefined ? {} : { inputCharacters: safeCount(media.inputCharacters) },
|
|
764
915
|
...media.audioDurationMs === undefined ? {} : { audioDurationMs: safeCount(media.audioDurationMs) },
|
|
@@ -1189,6 +1340,6 @@ function cloneDate(value, field) {
|
|
|
1189
1340
|
return new Date(value);
|
|
1190
1341
|
}
|
|
1191
1342
|
|
|
1192
|
-
export { InMemoryAiUsageStorage2, normalizeAiAccountingQuery2, normalizeAiModelCallAccountingQuery2, buildAiAccountingOverview, aiAccountingModelKind2, buildAiAccountingOverviewFromFragments2, buildAiModelCallAccountingList, toAccountingItem2, directModelCallAttribution2, aiModelCallGroupFragmentFromRow2, buildAiModelCallGroupsFromFragments2, buildAiModelCallGroups, normalizeAiPricingContext2, normalizeAiModelCallCostRecord2, aiModelCallCostMatchesUsage2, normalizeAiCostEstimate };
|
|
1343
|
+
export { InMemoryAiUsageStorage2, normalizeAiAccountingQuery2, normalizeAiModelCallAccountingQuery2, buildAiAccountingOverview, aiAccountingModelKind2, buildAiAccountingOverviewFromFragments2, buildAiModelCallAccountingList, toAccountingItem2, directModelCallAttribution2, aiModelCallGroupFragmentFromRow2, normalizeAiModelCallGroupSort2, buildAiModelCallGroupsFromFragments2, buildAiModelCallGroups, normalizeAiPricingContext2, normalizeAiModelCallCostRecord2, aiModelCallCostMatchesUsage2, normalizeAiCostEstimate };
|
|
1193
1344
|
|
|
1194
|
-
//# debugId=
|
|
1345
|
+
//# debugId=84A7B06B14B6C26564756E2164756E21
|