@sixb/core 0.1.2 → 0.1.4
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 +19 -17
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/worker.js +4 -4
- package/dist/actions/worker.js.map +1 -1
- package/dist/agents/adapters.d.ts +11 -1
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/context-compaction.d.ts +40 -0
- package/dist/agents/context-compaction.d.ts.map +1 -0
- package/dist/agents/context.js +1 -1
- package/dist/agents/errors.d.ts +1 -1
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +3 -0
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +2 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +10 -6
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +51 -35
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/streams.d.ts +17 -1
- package/dist/agents/streams.d.ts.map +1 -1
- package/dist/agents/streams.js +5 -3
- package/dist/agents/streams.js.map +1 -1
- package/dist/agents/thread-context-projection.d.ts +19 -0
- package/dist/agents/thread-context-projection.d.ts.map +1 -0
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/tool-result.d.ts +6 -0
- package/dist/agents/tool-result.d.ts.map +1 -0
- package/dist/agents/types.d.ts +46 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +2 -2
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/auth/index.js +11 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/authorization/index.js +6 -2
- package/dist/authorization/index.js.map +1 -1
- package/dist/bootstrap/index.js +33 -31
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/{chunk-ys1nse2v.js → chunk-1wk20wn3.js} +438 -246
- package/dist/{chunk-ys1nse2v.js.map → chunk-1wk20wn3.js.map} +11 -11
- package/dist/{chunk-sa4340y1.js → chunk-1yz3x65y.js} +7 -7
- package/dist/{chunk-gqdd7508.js → chunk-4rh2m6zg.js} +1 -1
- package/dist/{chunk-fmx1sz2h.js → chunk-72q2y8hn.js} +3 -3
- package/dist/{chunk-fmx1sz2h.js.map → chunk-72q2y8hn.js.map} +4 -4
- package/dist/{chunk-nnyp53zt.js → chunk-7gw7mepb.js} +259 -9
- package/dist/chunk-7gw7mepb.js.map +14 -0
- package/dist/{chunk-nten49ta.js → chunk-819wnjz8.js} +11 -5
- package/dist/chunk-819wnjz8.js.map +12 -0
- package/dist/chunk-96swp2wd.js +47 -0
- package/dist/chunk-96swp2wd.js.map +10 -0
- package/dist/{chunk-4x43bkbp.js → chunk-a09jx26t.js} +1 -1
- package/dist/{chunk-st4xgxey.js → chunk-afjpa2hs.js} +205 -48
- package/dist/chunk-afjpa2hs.js.map +45 -0
- package/dist/{chunk-0mbx247x.js → chunk-c43qr6s0.js} +427 -99
- package/dist/chunk-c43qr6s0.js.map +46 -0
- package/dist/{chunk-zg9yryhz.js → chunk-cbkm2vam.js} +3 -3
- package/dist/{chunk-57zpb99z.js → chunk-dm72y8wt.js} +26 -3
- package/dist/chunk-dm72y8wt.js.map +10 -0
- package/dist/chunk-drjqm1aa.js +913 -0
- package/dist/chunk-drjqm1aa.js.map +15 -0
- package/dist/chunk-dysw7nsm.js.map +1 -1
- package/dist/{chunk-8ryen3p3.js → chunk-f6erf2vv.js} +1 -1
- package/dist/{chunk-34bqh420.js → chunk-f83ka50g.js} +188 -44
- package/dist/chunk-f83ka50g.js.map +23 -0
- package/dist/{chunk-bct7hmfc.js → chunk-g13869yf.js} +3 -3
- package/dist/{chunk-0k4avqr2.js → chunk-hbeh8j9w.js} +2 -2
- package/dist/{chunk-qvybnnpe.js → chunk-nzw7sm3b.js} +2 -2
- package/dist/{chunk-k9pts48t.js → chunk-pn8n8sba.js} +16 -15
- package/dist/{chunk-k9pts48t.js.map → chunk-pn8n8sba.js.map} +3 -3
- package/dist/{chunk-63te770v.js → chunk-qewtks41.js} +8 -8
- package/dist/{chunk-63te770v.js.map → chunk-qewtks41.js.map} +2 -2
- package/dist/{chunk-85j5ybfj.js → chunk-rdeagz6b.js} +2 -2
- package/dist/{chunk-85j5ybfj.js.map → chunk-rdeagz6b.js.map} +3 -3
- package/dist/chunk-rhrbz7d4.js +36 -0
- package/dist/chunk-rhrbz7d4.js.map +10 -0
- package/dist/{chunk-bh6k3nc6.js → chunk-rs1wbvy6.js} +1 -1
- package/dist/{chunk-88ppkr54.js → chunk-rte5sm3z.js} +26 -2
- package/dist/chunk-rte5sm3z.js.map +12 -0
- package/dist/{chunk-n8herkry.js → chunk-s31d0qmq.js} +57 -20
- package/dist/{chunk-n8herkry.js.map → chunk-s31d0qmq.js.map} +8 -7
- package/dist/{chunk-7pc8b818.js → chunk-sxwk41qa.js} +1 -1
- package/dist/{chunk-663csy96.js → chunk-t0jjkep3.js} +2 -1
- package/dist/chunk-t0jjkep3.js.map +10 -0
- package/dist/{chunk-c6qd89g5.js → chunk-tek1qwgm.js} +6 -6
- package/dist/{chunk-c6qd89g5.js.map → chunk-tek1qwgm.js.map} +1 -1
- package/dist/{chunk-jaj13078.js → chunk-tkdscva6.js} +3 -33
- package/dist/{chunk-jaj13078.js.map → chunk-tkdscva6.js.map} +3 -4
- package/dist/{chunk-5egfka8j.js → chunk-tycbzedm.js} +2 -2
- package/dist/{chunk-g9t3kdtx.js → chunk-x2yw73hy.js} +1 -1
- package/dist/{chunk-57r1cpxx.js → chunk-xc7hq65b.js} +3 -2
- package/dist/{chunk-57r1cpxx.js.map → chunk-xc7hq65b.js.map} +3 -3
- package/dist/chunk-xdf9yswn.js +133 -0
- package/dist/chunk-xdf9yswn.js.map +11 -0
- package/dist/execution/agent.js +29 -27
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/primitive.js +29 -27
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.js +30 -28
- package/dist/execution/request.js.map +2 -2
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +60 -58
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/types.d.ts +2 -1
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/materialization/model.d.ts +4 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/edits/apply.d.ts +6 -1
- package/dist/materializer/edits/apply.d.ts.map +1 -1
- package/dist/materializer/edits/working-state.d.ts +2 -0
- package/dist/materializer/edits/working-state.d.ts.map +1 -1
- package/dist/materializer/effective/resolve.d.ts +3 -1
- package/dist/materializer/effective/resolve.d.ts.map +1 -1
- package/dist/materializer/execution/work-records.d.ts.map +1 -1
- package/dist/materializer/index.js +19 -17
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/index.d.ts +40 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/objects/execution.d.ts +6 -1
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +21 -19
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/link/endpoints.d.ts.map +1 -1
- package/dist/objects/query/executor.d.ts +1 -0
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/explain.d.ts +1 -0
- package/dist/objects/query/explain.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +3 -1
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +30 -5
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/ir.d.ts +14 -1
- package/dist/objects/query/ir.d.ts.map +1 -1
- package/dist/objects/query/links.d.ts +25 -0
- package/dist/objects/query/links.d.ts.map +1 -0
- package/dist/objects/query/normalize.d.ts.map +1 -1
- package/dist/objects/query/planner.d.ts.map +1 -1
- package/dist/objects/query/validate.d.ts +1 -0
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/pipelines/index.js +16 -15
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/builders.d.ts +52 -10
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +2 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.d.ts +4 -1
- package/dist/projections/internal.d.ts.map +1 -1
- package/dist/projections/internal.js +22 -17
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts +1 -0
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/projections/timestamp.d.ts +3 -0
- package/dist/projections/timestamp.d.ts.map +1 -0
- package/dist/projections/types.d.ts +21 -9
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts +6 -5
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/query.d.ts +2 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +2 -2
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/types.d.ts +7 -0
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/ai-cost.d.ts +8 -0
- package/dist/runtime/ai-cost.d.ts.map +1 -0
- package/dist/runtime/create.d.ts +3 -0
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +3 -0
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +2 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +2 -0
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +22 -4
- 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 +31 -0
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +22 -7
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +75 -4
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +61 -0
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -0
- package/dist/storage/ai-cost/codec.d.ts +14 -0
- package/dist/storage/ai-cost/codec.d.ts.map +1 -0
- package/dist/storage/ai-cost/errors.d.ts +7 -0
- package/dist/storage/ai-cost/errors.d.ts.map +1 -0
- package/dist/storage/ai-cost/in-memory.d.ts +32 -0
- package/dist/storage/ai-cost/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-cost/index.d.ts +6 -0
- package/dist/storage/ai-cost/index.d.ts.map +1 -0
- package/dist/storage/ai-cost/provider.d.ts +7 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -0
- package/dist/storage/ai-cost/provider.js +132 -0
- package/dist/storage/ai-cost/provider.js.map +10 -0
- package/dist/storage/ai-cost/types.d.ts +154 -0
- package/dist/storage/ai-cost/types.d.ts.map +1 -0
- package/dist/storage/ai-cost/validation.d.ts +7 -0
- package/dist/storage/ai-cost/validation.d.ts.map +1 -0
- package/dist/storage/ai-usage/in-memory.d.ts +2 -1
- package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-usage/index.d.ts +1 -1
- package/dist/storage/ai-usage/index.d.ts.map +1 -1
- package/dist/storage/ai-usage/types.d.ts +6 -0
- package/dist/storage/ai-usage/types.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts +5 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +6 -3
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +33 -21
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/objects/in-memory.d.ts +6 -3
- package/dist/storage/objects/in-memory.d.ts.map +1 -1
- package/dist/storage/objects/index.d.ts +3 -1
- package/dist/storage/objects/index.d.ts.map +1 -1
- package/dist/storage/objects/keys.d.ts +16 -0
- package/dist/storage/objects/keys.d.ts.map +1 -0
- package/dist/storage/objects/types.d.ts +33 -6
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/materializations.d.ts +3 -0
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/types.d.ts +2 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +10 -5
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/syncs/index.js +16 -15
- package/dist/syncs/index.js.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts +3 -2
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts +12 -0
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -0
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
- package/dist/testing/effective-storage-contract.d.ts +1 -1
- package/dist/testing/effective-storage-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 +2525 -1480
- package/dist/testing/index.js.map +10 -9
- 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 +1 -1
- package/dist/testing/object-query-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +14 -13
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +12 -2
- package/dist/workers/index.js.map +3 -3
- package/dist/workers/queue-worker.d.ts +2 -0
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workflows/execution.d.ts +3 -0
- package/dist/workflows/execution.d.ts.map +1 -1
- package/dist/workflows/index.js +30 -28
- package/dist/workflows/index.js.map +1 -1
- package/package.json +7 -1
- package/src/agents/adapters.ts +64 -23
- package/src/agents/builders.ts +3 -3
- package/src/agents/context-compaction.ts +261 -0
- package/src/agents/errors.ts +2 -2
- package/src/agents/execution.ts +14 -2
- package/src/agents/ids.ts +5 -0
- package/src/agents/index.ts +32 -6
- package/src/agents/request.ts +5 -0
- package/src/agents/streams.ts +56 -0
- package/src/agents/thread-context-projection.ts +93 -0
- package/src/agents/tool-definition.ts +17 -2
- package/src/agents/tool-result.ts +61 -0
- package/src/agents/types.ts +57 -1
- package/src/agents/validation.ts +36 -6
- package/src/http/api-routes.ts +7 -7
- package/src/index.ts +27 -0
- package/src/lake-storage/types.ts +2 -1
- package/src/materialization/model.ts +4 -0
- package/src/materializer/edits/apply.ts +55 -2
- package/src/materializer/edits/operations.ts +8 -1
- package/src/materializer/edits/working-state.ts +7 -0
- package/src/materializer/effective/resolve.ts +78 -9
- package/src/materializer/execution/work-records.ts +3 -1
- package/src/materializer/projections/entry-validator.ts +23 -1
- package/src/materializer/projections/replacement-plan.ts +2 -0
- package/src/materializer/shared/normalize.ts +16 -0
- package/src/materializer/telemetry/append.ts +33 -16
- package/src/models/index.ts +71 -0
- package/src/objects/execution.ts +20 -0
- package/src/objects/link/endpoints.ts +2 -1
- package/src/objects/query/executor.ts +42 -11
- package/src/objects/query/explain.ts +11 -0
- package/src/objects/query/index.ts +6 -0
- package/src/objects/query/ir.ts +16 -0
- package/src/objects/query/links.ts +308 -0
- package/src/objects/query/normalize.ts +40 -1
- package/src/objects/query/planner.ts +5 -0
- package/src/objects/query/validate.ts +58 -2
- package/src/projections/builders.ts +320 -50
- package/src/projections/index.ts +7 -0
- package/src/projections/internal.ts +4 -1
- package/src/projections/ownership.ts +5 -5
- package/src/projections/registry.ts +16 -3
- package/src/projections/revision.ts +35 -5
- package/src/projections/run-dispatch.ts +10 -1
- package/src/projections/timestamp.ts +66 -0
- package/src/projections/types.ts +20 -9
- package/src/projections/validation.ts +85 -19
- package/src/query.ts +2 -0
- package/src/queues/index.ts +1 -0
- package/src/queues/types.ts +8 -0
- package/src/runtime/ai-cost.ts +15 -0
- package/src/runtime/create.ts +4 -0
- package/src/runtime/definitions.ts +3 -0
- package/src/runtime/host.ts +2 -0
- package/src/runtime/resolve-definitions.ts +28 -0
- package/src/storage/agents/in-memory.ts +186 -4
- package/src/storage/agents/index.ts +5 -0
- package/src/storage/agents/provider.ts +225 -0
- package/src/storage/agents/types.ts +82 -3
- package/src/storage/ai-cost/analytics.ts +602 -0
- package/src/storage/ai-cost/codec.ts +136 -0
- package/src/storage/ai-cost/errors.ts +12 -0
- package/src/storage/ai-cost/in-memory.ts +164 -0
- package/src/storage/ai-cost/index.ts +35 -0
- package/src/storage/ai-cost/provider.ts +20 -0
- package/src/storage/ai-cost/types.ts +193 -0
- package/src/storage/ai-cost/validation.ts +337 -0
- package/src/storage/ai-usage/in-memory.ts +23 -0
- package/src/storage/ai-usage/index.ts +1 -0
- package/src/storage/ai-usage/types.ts +10 -0
- package/src/storage/in-memory/index.ts +50 -0
- package/src/storage/index.ts +48 -0
- package/src/storage/objects/in-memory.ts +103 -16
- package/src/storage/objects/index.ts +9 -0
- package/src/storage/objects/keys.ts +36 -0
- package/src/storage/objects/types.ts +34 -6
- package/src/storage/ontology/in-memory/materializations.ts +1 -0
- package/src/storage/ontology/materializations.ts +3 -0
- package/src/storage/ontology/provider-header-validation.ts +2 -2
- package/src/storage/operation-scope.ts +1 -0
- package/src/storage/types.ts +2 -0
- package/src/testing/agent-storage-contract.ts +353 -2
- package/src/testing/ai-cost-storage-contract.ts +320 -0
- package/src/testing/ai-usage-storage-contract.ts +35 -0
- package/src/testing/effective-storage-contract.ts +194 -4
- package/src/testing/index.ts +5 -0
- package/src/testing/lake-storage-contract.ts +56 -0
- package/src/testing/materializer-storage-contract.ts +120 -2
- package/src/testing/object-query-contract.ts +208 -1
- package/src/workers/queue-worker.ts +14 -1
- package/src/workflows/execution.ts +31 -10
- package/dist/agents/prompt.d.ts +0 -15
- package/dist/agents/prompt.d.ts.map +0 -1
- package/dist/chunk-0mbx247x.js.map +0 -43
- package/dist/chunk-34bqh420.js.map +0 -23
- package/dist/chunk-57zpb99z.js.map +0 -10
- package/dist/chunk-663csy96.js.map +0 -10
- package/dist/chunk-6wetht33.js +0 -89
- package/dist/chunk-6wetht33.js.map +0 -10
- package/dist/chunk-88ppkr54.js.map +0 -12
- package/dist/chunk-nnyp53zt.js.map +0 -13
- package/dist/chunk-nten49ta.js.map +0 -12
- package/dist/chunk-st4xgxey.js.map +0 -45
- package/dist/chunk-vp1vc6ee.js +0 -35
- package/dist/chunk-vp1vc6ee.js.map +0 -11
- package/src/agents/prompt.ts +0 -57
- /package/dist/{chunk-sa4340y1.js.map → chunk-1yz3x65y.js.map} +0 -0
- /package/dist/{chunk-gqdd7508.js.map → chunk-4rh2m6zg.js.map} +0 -0
- /package/dist/{chunk-4x43bkbp.js.map → chunk-a09jx26t.js.map} +0 -0
- /package/dist/{chunk-zg9yryhz.js.map → chunk-cbkm2vam.js.map} +0 -0
- /package/dist/{chunk-8ryen3p3.js.map → chunk-f6erf2vv.js.map} +0 -0
- /package/dist/{chunk-bct7hmfc.js.map → chunk-g13869yf.js.map} +0 -0
- /package/dist/{chunk-0k4avqr2.js.map → chunk-hbeh8j9w.js.map} +0 -0
- /package/dist/{chunk-qvybnnpe.js.map → chunk-nzw7sm3b.js.map} +0 -0
- /package/dist/{chunk-bh6k3nc6.js.map → chunk-rs1wbvy6.js.map} +0 -0
- /package/dist/{chunk-7pc8b818.js.map → chunk-sxwk41qa.js.map} +0 -0
- /package/dist/{chunk-5egfka8j.js.map → chunk-tycbzedm.js.map} +0 -0
- /package/dist/{chunk-g9t3kdtx.js.map → chunk-x2yw73hy.js.map} +0 -0
|
@@ -93,11 +93,13 @@ function applyObjectOperation(
|
|
|
93
93
|
operation,
|
|
94
94
|
sourceProperties: working.source?.assertion.properties ?? null,
|
|
95
95
|
authority: working.override,
|
|
96
|
+
editedAt: working.editedAt,
|
|
97
|
+
committedAt: identity.committedAt,
|
|
96
98
|
effectiveExists: currentEffective !== null,
|
|
97
99
|
...normalized,
|
|
98
100
|
})
|
|
99
101
|
|
|
100
|
-
applyObjectTransition(context, state, working, transition.next, journal)
|
|
102
|
+
applyObjectTransition(context, state, working, transition.next, transition.editedAt, journal)
|
|
101
103
|
|
|
102
104
|
return objectOperationOutcome(operation, working, transition.changed, context, identity)
|
|
103
105
|
}
|
|
@@ -146,21 +148,26 @@ function applyObjectTransition(
|
|
|
146
148
|
state: EditWorkingState,
|
|
147
149
|
working: WorkingObject,
|
|
148
150
|
next: WorkingObject["override"],
|
|
151
|
+
nextEditedAt: Readonly<Record<string, string>>,
|
|
149
152
|
journal?: EditUndoJournal
|
|
150
153
|
): void {
|
|
151
154
|
const previous = working.override
|
|
155
|
+
const previousEditedAt = working.editedAt
|
|
152
156
|
working.override = next
|
|
157
|
+
working.editedAt = { ...nextEditedAt }
|
|
153
158
|
try {
|
|
154
159
|
const resolved = resolveObject(context.ontology, working)
|
|
155
160
|
if (resolved) validateEffectiveObject(context.ontology, resolved.ref, resolved.properties)
|
|
156
161
|
validateWorkingCardinality(state.links.slots)
|
|
157
162
|
} catch (error) {
|
|
158
163
|
working.override = previous
|
|
164
|
+
working.editedAt = previousEditedAt
|
|
159
165
|
throw error
|
|
160
166
|
}
|
|
161
167
|
journal?.push({
|
|
162
168
|
restore: () => {
|
|
163
169
|
working.override = previous
|
|
170
|
+
working.editedAt = previousEditedAt
|
|
164
171
|
},
|
|
165
172
|
})
|
|
166
173
|
}
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
resolveEffectiveLink,
|
|
26
26
|
resolveEffectiveLinkSlot,
|
|
27
27
|
resolveEffectiveObject,
|
|
28
|
+
storedObjectEditedAt,
|
|
28
29
|
usableLinkSlotOverride,
|
|
29
30
|
} from "../effective/resolve"
|
|
30
31
|
import { linkCardinality } from "./read-set"
|
|
@@ -33,6 +34,8 @@ export interface WorkingObject {
|
|
|
33
34
|
source: MaterializationObjectState["source"]
|
|
34
35
|
originalOverride: StoredObjectOverride | null
|
|
35
36
|
override: ObjectOverride | null
|
|
37
|
+
originalEditedAt: Readonly<Record<string, string>>
|
|
38
|
+
editedAt: Record<string, string>
|
|
36
39
|
before: MaterializationObjectState["effective"]
|
|
37
40
|
latestTelemetry: StoredTelemetryPoint[]
|
|
38
41
|
}
|
|
@@ -112,11 +115,14 @@ function workingLinkSlotFromState(scope: MaterializationLinkScopeState): Working
|
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
export function workingObjectFromState(object: MaterializationObjectState): WorkingObject {
|
|
118
|
+
const editedAt = storedObjectEditedAt(object.override)
|
|
115
119
|
return {
|
|
116
120
|
ref: object.ref,
|
|
117
121
|
source: object.source,
|
|
118
122
|
originalOverride: object.override,
|
|
119
123
|
override: object.override?.value ?? null,
|
|
124
|
+
originalEditedAt: editedAt,
|
|
125
|
+
editedAt: { ...editedAt },
|
|
120
126
|
before: object.effective,
|
|
121
127
|
latestTelemetry: [...object.latestTelemetry],
|
|
122
128
|
}
|
|
@@ -141,6 +147,7 @@ export function resolveObject(
|
|
|
141
147
|
primaryPropertyId: ontology.getPrimaryPropertyId(working.ref.objectTypeId),
|
|
142
148
|
source: working.source,
|
|
143
149
|
override: working.override,
|
|
150
|
+
editedAt: working.editedAt,
|
|
144
151
|
latestTelemetry: working.latestTelemetry,
|
|
145
152
|
})
|
|
146
153
|
}
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
import { linkRefKey } from "../../materialization/refs"
|
|
12
12
|
import type {
|
|
13
13
|
StoredLinkSlotOverride,
|
|
14
|
+
StoredObjectOverride,
|
|
14
15
|
StoredSourceLinkAssertion,
|
|
15
16
|
StoredSourceObjectAssertion,
|
|
16
17
|
StoredTelemetryPoint,
|
|
@@ -46,9 +47,10 @@ export function resolveEffectiveObject(input: {
|
|
|
46
47
|
readonly primaryPropertyId: string
|
|
47
48
|
readonly source: StoredSourceObjectAssertion | null
|
|
48
49
|
readonly override: ObjectOverride | null
|
|
50
|
+
readonly editedAt: Readonly<Record<string, string>>
|
|
49
51
|
readonly latestTelemetry: readonly StoredTelemetryPoint[]
|
|
50
52
|
}): ResolvedObjectValue | null {
|
|
51
|
-
const properties = resolveObjectAuthority(input.source, input.override)
|
|
53
|
+
const properties = resolveObjectAuthority(input.source, input.override, input.editedAt)
|
|
52
54
|
if (!properties) return null
|
|
53
55
|
|
|
54
56
|
properties[input.primaryPropertyId] = input.ref.primaryId
|
|
@@ -58,31 +60,98 @@ export function resolveEffectiveObject(input: {
|
|
|
58
60
|
|
|
59
61
|
function resolveObjectAuthority(
|
|
60
62
|
source: StoredSourceObjectAssertion | null,
|
|
61
|
-
override: ObjectOverride | null
|
|
63
|
+
override: ObjectOverride | null,
|
|
64
|
+
editedAt: Readonly<Record<string, string>>
|
|
62
65
|
): Record<string, JsonValue> | null {
|
|
63
66
|
switch (override?.kind) {
|
|
64
67
|
case "delete":
|
|
65
68
|
return null
|
|
66
69
|
case "create":
|
|
67
|
-
return { ...override.properties }
|
|
70
|
+
if (!source) return { ...override.properties }
|
|
71
|
+
return resolveSourceAndEdits(source, override, editedAt)
|
|
68
72
|
case "patch":
|
|
69
73
|
if (!source) return null
|
|
70
|
-
return
|
|
74
|
+
return resolveSourceAndEdits(source, override, editedAt)
|
|
71
75
|
default:
|
|
72
76
|
if (!source) return null
|
|
73
77
|
return { ...source.assertion.properties }
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
override:
|
|
81
|
+
function resolveSourceAndEdits(
|
|
82
|
+
source: StoredSourceObjectAssertion,
|
|
83
|
+
override: Exclude<ObjectOverride, { readonly kind: "delete" }>,
|
|
84
|
+
editedAt: Readonly<Record<string, string>>
|
|
80
85
|
): Record<string, JsonValue> {
|
|
81
|
-
const properties = { ...
|
|
82
|
-
|
|
86
|
+
const properties = { ...source.assertion.properties }
|
|
87
|
+
const absentSourcePropertyIds = new Set(source.assertion.absentSourcePropertyIds ?? [])
|
|
88
|
+
|
|
89
|
+
for (const propertyId of objectEditCandidateIds(override, editedAt)) {
|
|
90
|
+
const edit = objectEditCandidate(override, propertyId)
|
|
91
|
+
const editTimestamp = editedAt[propertyId]
|
|
92
|
+
const hasSourceCandidate =
|
|
93
|
+
Object.hasOwn(source.assertion.properties, propertyId) ||
|
|
94
|
+
absentSourcePropertyIds.has(propertyId)
|
|
95
|
+
const sourceWins =
|
|
96
|
+
hasSourceCandidate &&
|
|
97
|
+
source.assertion.sourceUpdatedAt !== undefined &&
|
|
98
|
+
editTimestamp !== undefined &&
|
|
99
|
+
source.assertion.sourceUpdatedAt.localeCompare(editTimestamp) >= 0
|
|
100
|
+
|
|
101
|
+
if (!sourceWins) applyObjectEditCandidate(properties, propertyId, edit)
|
|
102
|
+
}
|
|
83
103
|
return properties
|
|
84
104
|
}
|
|
85
105
|
|
|
106
|
+
interface ObjectPropertyCandidate {
|
|
107
|
+
readonly present: boolean
|
|
108
|
+
readonly value?: JsonValue
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function objectEditCandidateIds(
|
|
112
|
+
override: Exclude<ObjectOverride, { readonly kind: "delete" }>,
|
|
113
|
+
editedAt: Readonly<Record<string, string>>
|
|
114
|
+
): string[] {
|
|
115
|
+
const ids = new Set(Object.keys(editedAt))
|
|
116
|
+
if (override.kind === "create") {
|
|
117
|
+
for (const propertyId of Object.keys(override.properties)) ids.add(propertyId)
|
|
118
|
+
} else {
|
|
119
|
+
for (const propertyId of Object.keys(override.set)) ids.add(propertyId)
|
|
120
|
+
for (const propertyId of override.unset) ids.add(propertyId)
|
|
121
|
+
}
|
|
122
|
+
return [...ids]
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function objectEditCandidate(
|
|
126
|
+
override: Exclude<ObjectOverride, { readonly kind: "delete" }>,
|
|
127
|
+
propertyId: string
|
|
128
|
+
): ObjectPropertyCandidate {
|
|
129
|
+
const values = override.kind === "create" ? override.properties : override.set
|
|
130
|
+
return Object.hasOwn(values, propertyId)
|
|
131
|
+
? { present: true, value: values[propertyId] }
|
|
132
|
+
: { present: false }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function applyObjectEditCandidate(
|
|
136
|
+
properties: Record<string, JsonValue>,
|
|
137
|
+
propertyId: string,
|
|
138
|
+
candidate: ObjectPropertyCandidate
|
|
139
|
+
): void {
|
|
140
|
+
if (candidate.present) properties[propertyId] = candidate.value as JsonValue
|
|
141
|
+
else delete properties[propertyId]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function storedObjectEditedAt(stored: StoredObjectOverride | null): Record<string, string> {
|
|
145
|
+
if (!stored || stored.value.kind === "delete") return {}
|
|
146
|
+
const editedAt = { ...(stored.editedAt ?? {}) }
|
|
147
|
+
const candidateIds =
|
|
148
|
+
stored.value.kind === "create"
|
|
149
|
+
? Object.keys(stored.value.properties)
|
|
150
|
+
: [...Object.keys(stored.value.set), ...stored.value.unset]
|
|
151
|
+
for (const propertyId of candidateIds) editedAt[propertyId] ??= stored.updatedAt
|
|
152
|
+
return editedAt
|
|
153
|
+
}
|
|
154
|
+
|
|
86
155
|
function applyLatestTelemetry(
|
|
87
156
|
properties: Record<string, JsonValue>,
|
|
88
157
|
latestTelemetry: readonly StoredTelemetryPoint[]
|
|
@@ -22,7 +22,8 @@ export function appendObjectOverrideWork(
|
|
|
22
22
|
): void {
|
|
23
23
|
if (
|
|
24
24
|
stableJsonStringify(working.originalOverride?.value ?? null) ===
|
|
25
|
-
|
|
25
|
+
stableJsonStringify(working.override) &&
|
|
26
|
+
stableJsonStringify(working.originalEditedAt) === stableJsonStringify(working.editedAt)
|
|
26
27
|
) {
|
|
27
28
|
return
|
|
28
29
|
}
|
|
@@ -32,6 +33,7 @@ export function appendObjectOverrideWork(
|
|
|
32
33
|
value: {
|
|
33
34
|
ref: working.ref,
|
|
34
35
|
value: working.override,
|
|
36
|
+
editedAt: working.editedAt,
|
|
35
37
|
expectedLastCommitId: working.originalOverride?.lastCommitId ?? null,
|
|
36
38
|
lastCommitId: identity.commitId,
|
|
37
39
|
updatedAt: identity.committedAt,
|
|
@@ -118,7 +118,29 @@ function validateObjectAssertion(
|
|
|
118
118
|
`Projection '${resolved.projectionId}' asserted unowned property '${assertion.ref.objectTypeId}.${propertyId}'.`
|
|
119
119
|
)
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
const conflictResolution = resolved.definition.conflictResolution ?? { strategy: "editsWin" }
|
|
122
|
+
if (conflictResolution.strategy !== "mostRecent") {
|
|
123
|
+
return { kind: "object", ref: assertion.ref, properties }
|
|
124
|
+
}
|
|
125
|
+
if (assertion.sourceUpdatedAt === undefined) {
|
|
126
|
+
throw new MaterializationValidationError(
|
|
127
|
+
`Projection '${resolved.projectionId}' requires source update timestamp ` +
|
|
128
|
+
`'${conflictResolution.sourceTimestamp}' on every object assertion.`
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
const primaryPropertyId = ontology.getPrimaryPropertyId(assertion.ref.objectTypeId)
|
|
132
|
+
const absentSourcePropertyIds = [...owned]
|
|
133
|
+
.filter(
|
|
134
|
+
(propertyId) => propertyId !== primaryPropertyId && !Object.hasOwn(properties, propertyId)
|
|
135
|
+
)
|
|
136
|
+
.sort()
|
|
137
|
+
return {
|
|
138
|
+
kind: "object",
|
|
139
|
+
ref: assertion.ref,
|
|
140
|
+
properties,
|
|
141
|
+
sourceUpdatedAt: assertion.sourceUpdatedAt,
|
|
142
|
+
...(absentSourcePropertyIds.length === 0 ? {} : { absentSourcePropertyIds }),
|
|
143
|
+
}
|
|
122
144
|
}
|
|
123
145
|
|
|
124
146
|
function validateLinkAssertion(
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
resolveEffectiveLink,
|
|
34
34
|
resolveEffectiveLinkSlotMember,
|
|
35
35
|
resolveEffectiveObject,
|
|
36
|
+
storedObjectEditedAt,
|
|
36
37
|
usableLinkSlotOverride,
|
|
37
38
|
} from "../effective/resolve"
|
|
38
39
|
import { validateEffectiveObject } from "../effective/validate"
|
|
@@ -374,6 +375,7 @@ function resolveReplacementObject(
|
|
|
374
375
|
primaryPropertyId: context.ontology.getPrimaryPropertyId(state.ref.objectTypeId),
|
|
375
376
|
source: state.candidateSource,
|
|
376
377
|
override: state.override?.value ?? null,
|
|
378
|
+
editedAt: storedObjectEditedAt(state.override),
|
|
377
379
|
latestTelemetry: state.latestTelemetry,
|
|
378
380
|
})
|
|
379
381
|
}
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
projectionEntityKey,
|
|
26
26
|
telemetryPointKey,
|
|
27
27
|
} from "../../materialization/refs"
|
|
28
|
+
import { parseDatasetTimestamp } from "../../projections/timestamp"
|
|
28
29
|
|
|
29
30
|
export function normalizeJsonProperties(
|
|
30
31
|
properties: Readonly<Record<string, unknown>>,
|
|
@@ -67,6 +68,16 @@ function normalizeTimestamp(value: string, label: string): string {
|
|
|
67
68
|
return new Date(milliseconds).toISOString()
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
function normalizeProjectionSourceTimestamp(value: string): string {
|
|
72
|
+
const timestamp = parseDatasetTimestamp(value)
|
|
73
|
+
if (!timestamp) {
|
|
74
|
+
throw new MaterializationValidationError(
|
|
75
|
+
"Projection source update timestamp must be a valid timestamp."
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
return timestamp.toISOString()
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
function normalizePropertyIds(values: readonly string[], label: string): readonly string[] {
|
|
71
82
|
const seen = new Set<string>()
|
|
72
83
|
const normalized: string[] = []
|
|
@@ -347,6 +358,11 @@ function normalizeProjectionAssertion(
|
|
|
347
358
|
kind: "object",
|
|
348
359
|
ref: normalizeObjectRef(assertion.ref),
|
|
349
360
|
properties: normalizeJsonProperties(assertion.properties),
|
|
361
|
+
...(assertion.sourceUpdatedAt !== undefined
|
|
362
|
+
? {
|
|
363
|
+
sourceUpdatedAt: normalizeProjectionSourceTimestamp(assertion.sourceUpdatedAt),
|
|
364
|
+
}
|
|
365
|
+
: {}),
|
|
350
366
|
})
|
|
351
367
|
: Object.freeze({
|
|
352
368
|
kind: "link",
|
|
@@ -90,7 +90,6 @@ function prepareTelemetryAppend(
|
|
|
90
90
|
points: raw.input.points.map((point) => validateTelemetryPoint(context.ontology, point)),
|
|
91
91
|
})
|
|
92
92
|
const inputPointCount = telemetryInputPointCount(input, rawInputPointCount)
|
|
93
|
-
validateTelemetryBatch(input, inputPointCount)
|
|
94
93
|
|
|
95
94
|
const ontologyRevision = context.projectionRegistry.ontologyRevision
|
|
96
95
|
const execution = prepareMaterializerExecution(context.projectId, raw.scope)
|
|
@@ -114,21 +113,6 @@ function telemetryInputPointCount(
|
|
|
114
113
|
return input.points.length
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
function validateTelemetryBatch(input: NormalizedTelemetryAppend, inputPointCount: number): void {
|
|
118
|
-
if (input.source.kind === "projection") {
|
|
119
|
-
if (input.source.sourceRowCount === 0) {
|
|
120
|
-
throw new MaterializationValidationError(
|
|
121
|
-
"Projection telemetry batches must consume at least one source row; an empty dataset produces no batch commit."
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
if (input.source.sourceRowCount !== inputPointCount + input.source.sourceRowsSkipped) {
|
|
125
|
-
throw new MaterializationValidationError(
|
|
126
|
-
"Projection telemetry sourceRowCount must equal input points plus skipped rows."
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
116
|
function prepareRuntimeTelemetry(
|
|
133
117
|
context: Pick<MaterializerContext, "projectId" | "clock">,
|
|
134
118
|
input: NormalizedTelemetryAppend,
|
|
@@ -157,6 +141,7 @@ function prepareProjectionTelemetry(
|
|
|
157
141
|
)
|
|
158
142
|
validateTelemetryProjectionDataset(resolvedProjection, source)
|
|
159
143
|
validateTelemetryOwnership(resolvedProjection, input)
|
|
144
|
+
validateTelemetryBatchCardinality(resolvedProjection, source, inputPointCount)
|
|
160
145
|
|
|
161
146
|
const runIdentity = createProjectionRunMaterializationIdentity({
|
|
162
147
|
resolved: resolvedProjection,
|
|
@@ -182,6 +167,38 @@ function prepareProjectionTelemetry(
|
|
|
182
167
|
}
|
|
183
168
|
}
|
|
184
169
|
|
|
170
|
+
function validateTelemetryBatchCardinality(
|
|
171
|
+
resolved: ResolvedTelemetryProjection,
|
|
172
|
+
source: ProjectionTelemetrySource,
|
|
173
|
+
inputPointCount: number
|
|
174
|
+
): void {
|
|
175
|
+
if (source.sourceRowCount === 0) {
|
|
176
|
+
throw new MaterializationValidationError(
|
|
177
|
+
"Projection telemetry batches must consume at least one source row; an empty dataset produces no batch commit."
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const mappedPropertyCount = resolved.ownership.telemetry.length
|
|
182
|
+
if (mappedPropertyCount === 0) {
|
|
183
|
+
throw new MaterializationValidationError(
|
|
184
|
+
`Telemetry projection '${resolved.projectionId}' must own at least one telemetry property.`
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const sourceRowsEmitted = source.sourceRowCount - source.sourceRowsSkipped
|
|
189
|
+
const maximumPointCount = sourceRowsEmitted * mappedPropertyCount
|
|
190
|
+
if (!Number.isSafeInteger(maximumPointCount)) {
|
|
191
|
+
throw new MaterializationValidationError(
|
|
192
|
+
`Telemetry projection '${resolved.projectionId}' batch point capacity exceeds the safe integer range.`
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
if (inputPointCount < sourceRowsEmitted || inputPointCount > maximumPointCount) {
|
|
196
|
+
throw new MaterializationValidationError(
|
|
197
|
+
`Telemetry projection '${resolved.projectionId}' must emit between ${sourceRowsEmitted} and ${maximumPointCount} points for ${source.sourceRowCount} source rows with ${source.sourceRowsSkipped} skipped.`
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
185
202
|
function validateTelemetryProjectionDataset(
|
|
186
203
|
resolved: ResolvedTelemetryProjection,
|
|
187
204
|
source: ProjectionTelemetrySource
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { LanguageModelV4 } from "@ai-sdk/provider"
|
|
2
|
+
import { createDefinitionCatalog, type DefinitionCatalog } from "../runtime/definitions"
|
|
3
|
+
import { RuntimeError } from "../runtime/errors"
|
|
4
|
+
|
|
5
|
+
/** The configured language models, with the project default. */
|
|
6
|
+
export interface LanguageModelCatalog extends DefinitionCatalog<LanguageModelEntry> {
|
|
7
|
+
readonly default: LanguageModelEntry
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* One configured language model.
|
|
12
|
+
*
|
|
13
|
+
* `ref` is derived, never author-supplied, and stays internal to the runtime: it identifies the
|
|
14
|
+
* configured binding, not a vendor model. The AI SDK's `provider` names the binding, so
|
|
15
|
+
* `openai.chat(...)` and `openai.responses(...)` are distinct entries even for one vendor model,
|
|
16
|
+
* and neither matches the canonical id the worker resolves for billing
|
|
17
|
+
* (`SDK_PROVIDER_BINDINGS` in `@sixb/agent-worker`). Anything user-facing should key on
|
|
18
|
+
* `provider` + `modelId` instead.
|
|
19
|
+
*/
|
|
20
|
+
export interface LanguageModelEntry {
|
|
21
|
+
readonly ref: string
|
|
22
|
+
readonly provider: string
|
|
23
|
+
readonly modelId: string
|
|
24
|
+
readonly model: LanguageModelV4
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Models a project allows Sixb to use, organized by technical model kind. */
|
|
28
|
+
export interface ModelCatalog {
|
|
29
|
+
readonly language: LanguageModelCatalog
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ModelCatalogInput {
|
|
33
|
+
/** Ordered; the first entry is the project default. */
|
|
34
|
+
readonly language: readonly LanguageModelV4[]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Identify a catalog entry by the binding its model was constructed from.
|
|
39
|
+
*
|
|
40
|
+
* `gateway("openai/gpt-5.4")` and `openai("gpt-5.4")` are different entries on purpose: they route
|
|
41
|
+
* differently and bill differently. See {@link LanguageModelEntry}.
|
|
42
|
+
*/
|
|
43
|
+
export function modelRef(model: LanguageModelV4): string {
|
|
44
|
+
return `${model.provider}/${model.modelId}`
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Build the immutable project model catalog. Rejects duplicates and an empty catalog. */
|
|
48
|
+
export function createModelCatalog(input: ModelCatalogInput): ModelCatalog {
|
|
49
|
+
const byRef = new Map<string, LanguageModelEntry>()
|
|
50
|
+
|
|
51
|
+
for (const model of input.language) {
|
|
52
|
+
const ref = modelRef(model)
|
|
53
|
+
if (byRef.has(ref)) {
|
|
54
|
+
throw new RuntimeError(
|
|
55
|
+
`[Sixb] Duplicate language model '${ref}' in 'models'. Each provider and model id pair may be configured once.`
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
byRef.set(ref, Object.freeze({ ref, provider: model.provider, modelId: model.modelId, model }))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const [defaultEntry] = byRef.values()
|
|
62
|
+
if (defaultEntry === undefined) {
|
|
63
|
+
throw new RuntimeError(
|
|
64
|
+
"[Sixb] 'models.language' needs at least one model. Configure one or omit 'models' from createSixb()."
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return Object.freeze({
|
|
69
|
+
language: Object.freeze({ ...createDefinitionCatalog(byRef), default: defaultEntry }),
|
|
70
|
+
})
|
|
71
|
+
}
|
package/src/objects/execution.ts
CHANGED
|
@@ -29,8 +29,11 @@ import {
|
|
|
29
29
|
type ExecuteObjectFacetsInput,
|
|
30
30
|
type ExecuteObjectFacetsResult,
|
|
31
31
|
type ExecuteObjectQueryInput,
|
|
32
|
+
type ExecuteObjectQueryLinksInput,
|
|
33
|
+
type ExecuteObjectQueryLinksResult,
|
|
32
34
|
type ExecuteObjectQueryResult,
|
|
33
35
|
executeObjectQuery,
|
|
36
|
+
executeObjectQueryLinks,
|
|
34
37
|
existsObjects,
|
|
35
38
|
facetObjects,
|
|
36
39
|
} from "./query"
|
|
@@ -121,6 +124,12 @@ export interface ExecutionObjectSet<
|
|
|
121
124
|
byId(id: string): ExecutionObjectByIdHandle<TObjectType, TValueTypes>
|
|
122
125
|
}
|
|
123
126
|
|
|
127
|
+
/** Public input for querying physical links incident to an object query result. */
|
|
128
|
+
export type ObjectQueryLinksInput = Omit<ExecuteObjectQueryLinksInput, "projectId">
|
|
129
|
+
|
|
130
|
+
/** Public result returned by {@link ObjectsRuntime.queryLinks}. */
|
|
131
|
+
export type ObjectQueryLinksResult = ExecuteObjectQueryLinksResult
|
|
132
|
+
|
|
124
133
|
export interface ObjectsRuntime<TOntologySources extends readonly OntologySource[]>
|
|
125
134
|
extends ExecutionObjectOperations {
|
|
126
135
|
<TObjectType extends RegisteredObjectType<TOntologySources>>(
|
|
@@ -131,6 +140,7 @@ export interface ObjectsRuntime<TOntologySources extends readonly OntologySource
|
|
|
131
140
|
RegisteredObjectType<TOntologySources>
|
|
132
141
|
>
|
|
133
142
|
executeQuery(input: Omit<ExecuteObjectQueryInput, "projectId">): Promise<ExecuteObjectQueryResult>
|
|
143
|
+
queryLinks(input: ObjectQueryLinksInput): Promise<ObjectQueryLinksResult>
|
|
134
144
|
count(input: Omit<ExecuteObjectCountInput, "projectId">): Promise<ExecuteObjectCountResult>
|
|
135
145
|
exists(input: Omit<ExecuteObjectExistsInput, "projectId">): Promise<ExecuteObjectExistsResult>
|
|
136
146
|
facet(input: Omit<ExecuteObjectFacetsInput, "projectId">): Promise<ExecuteObjectFacetsResult>
|
|
@@ -208,6 +218,16 @@ export function createObjectsRuntime<TOntologySources extends readonly OntologyS
|
|
|
208
218
|
authorization: runtime.authorization,
|
|
209
219
|
}
|
|
210
220
|
),
|
|
221
|
+
queryLinks: (input: ObjectQueryLinksInput) =>
|
|
222
|
+
executeObjectQueryLinks(
|
|
223
|
+
{ projectId: runtime.projectId, ...input },
|
|
224
|
+
{
|
|
225
|
+
ontology: runtime.ontology,
|
|
226
|
+
storage: runtime.storage.objects,
|
|
227
|
+
runtimeAuthorization: runtime.runtimeAuthorization,
|
|
228
|
+
authorization: runtime.authorization,
|
|
229
|
+
}
|
|
230
|
+
),
|
|
211
231
|
count: (input: Omit<ExecuteObjectCountInput, "projectId">) =>
|
|
212
232
|
countObjects(
|
|
213
233
|
{ projectId: runtime.projectId, ...input },
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { SixbRuntimeContext } from "../../runtime/types"
|
|
10
|
+
import { objectBatchKey } from "../../storage"
|
|
10
11
|
import { ObjectNotFoundError } from "../../storage/errors"
|
|
11
12
|
|
|
12
13
|
export interface LinkEndpointItem {
|
|
@@ -62,5 +63,5 @@ export function requireEndpoints(item: LinkEndpointItem, existing: EndpointExist
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
function endpointKey(objectTypeId: string, primaryId: string): string {
|
|
65
|
-
return
|
|
66
|
+
return objectBatchKey(objectTypeId, primaryId)
|
|
66
67
|
}
|