@sixb/core 0.1.6 → 0.1.8
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/delegated-admission.d.ts +24 -0
- package/dist/actions/delegated-admission.d.ts.map +1 -0
- package/dist/actions/descriptor.d.ts +29 -0
- package/dist/actions/descriptor.d.ts.map +1 -0
- package/dist/actions/execution.d.ts +5 -5
- package/dist/actions/execution.d.ts.map +1 -1
- package/dist/actions/index.js +50 -40
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run-authorization.d.ts +20 -0
- package/dist/actions/run-authorization.d.ts.map +1 -0
- package/dist/actions/run-dispatch.d.ts +3 -1
- package/dist/actions/run-dispatch.d.ts.map +1 -1
- package/dist/actions/worker.js +5 -5
- package/dist/actions/worker.js.map +1 -1
- package/dist/agents/adapters.d.ts +6 -166
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/authority.d.ts +22 -6
- package/dist/agents/authority.d.ts.map +1 -1
- package/dist/agents/builders.d.ts +3 -11
- package/dist/agents/builders.d.ts.map +1 -1
- package/dist/agents/context-resolution.d.ts.map +1 -1
- package/dist/agents/context.js +2 -2
- package/dist/agents/dispatch.d.ts +9 -1
- package/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +1 -10
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +9 -10
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/identity.d.ts +3 -0
- package/dist/agents/identity.d.ts.map +1 -0
- package/dist/agents/ids.d.ts +4 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +15 -11
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +90 -78
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/message.d.ts +19 -13
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +58 -0
- package/dist/agents/model-loop.d.ts.map +1 -0
- package/dist/agents/reference.d.ts +4 -0
- package/dist/agents/reference.d.ts.map +1 -0
- package/dist/agents/request.d.ts +10 -8
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/retired-config.d.ts +4 -0
- package/dist/agents/retired-config.d.ts.map +1 -0
- package/dist/agents/streams.d.ts +13 -8
- package/dist/agents/streams.d.ts.map +1 -1
- package/dist/agents/streams.js +7 -5
- package/dist/agents/streams.js.map +1 -1
- package/dist/agents/tool-catalog.d.ts +9 -0
- package/dist/agents/tool-catalog.d.ts.map +1 -0
- package/dist/agents/tool-definition.d.ts +1 -1
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/types.d.ts +31 -68
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +3 -13
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/ai-usage/execution.d.ts +53 -0
- package/dist/ai-usage/execution.d.ts.map +1 -0
- package/dist/ai-usage/index.d.ts +3 -0
- package/dist/ai-usage/index.d.ts.map +1 -0
- package/dist/auth/index.js +12 -9
- package/dist/auth/index.js.map +1 -1
- package/dist/authorization/decision.d.ts +14 -3
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +25 -8
- 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 +12 -7
- package/dist/authorization/index.js.map +1 -1
- package/dist/authorization/resolve.d.ts +3 -3
- package/dist/authorization/resolve.d.ts.map +1 -1
- package/dist/authorization/types.d.ts +7 -5
- package/dist/authorization/types.d.ts.map +1 -1
- package/dist/blob-storage/browser.js +2 -2
- package/dist/blob-storage/index.js +3 -3
- package/dist/bootstrap/discovery.d.ts +6 -6
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.js +62 -51
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
- package/dist/broker/index.js +2 -2
- package/dist/{chunk-zqysyfjt.js → chunk-08m3b6w8.js} +1 -1
- package/dist/chunk-19jp6g9d.js +131 -0
- package/dist/chunk-19jp6g9d.js.map +11 -0
- package/dist/{chunk-3j7573mj.js → chunk-2dw777qw.js} +50 -5
- package/dist/{chunk-3j7573mj.js.map → chunk-2dw777qw.js.map} +4 -3
- package/dist/{chunk-0172wgm9.js → chunk-2xns679x.js} +10 -2
- package/dist/{chunk-0172wgm9.js.map → chunk-2xns679x.js.map} +3 -3
- package/dist/chunk-359jm1jw.js +147 -0
- package/dist/chunk-359jm1jw.js.map +10 -0
- package/dist/{chunk-dy311asx.js → chunk-3xep5cjx.js} +58 -23
- package/dist/chunk-3xep5cjx.js.map +15 -0
- package/dist/{chunk-n4spznws.js → chunk-3z1qec12.js} +83 -12
- package/dist/chunk-3z1qec12.js.map +12 -0
- package/dist/{chunk-z3zp0bj1.js → chunk-407j3msh.js} +1 -1
- package/dist/{chunk-rhrbz7d4.js → chunk-4a849fr1.js} +1 -1
- package/dist/{chunk-cy0n5dms.js → chunk-4jjp5k14.js} +1 -1
- package/dist/chunk-4qfkag59.js +1568 -0
- package/dist/chunk-4qfkag59.js.map +20 -0
- package/dist/{chunk-1e8m6yn3.js → chunk-4sm0aznx.js} +685 -86
- package/dist/chunk-4sm0aznx.js.map +43 -0
- package/dist/chunk-4yqmp43v.js +159 -0
- package/dist/chunk-4yqmp43v.js.map +11 -0
- package/dist/{chunk-rdeagz6b.js → chunk-5e3pq99w.js} +3 -7
- package/dist/{chunk-rdeagz6b.js.map → chunk-5e3pq99w.js.map} +3 -3
- package/dist/{chunk-ezake7g1.js → chunk-5ntny1qx.js} +1 -1
- package/dist/{chunk-dm72y8wt.js → chunk-7y0f6rf1.js} +29 -16
- package/dist/chunk-7y0f6rf1.js.map +10 -0
- package/dist/{chunk-72q2y8hn.js → chunk-8tsf6dmc.js} +2 -2
- package/dist/{chunk-qewtks41.js → chunk-9nbmsvn5.js} +123 -20
- package/dist/chunk-9nbmsvn5.js.map +11 -0
- package/dist/{chunk-5sxb1168.js → chunk-aa2pen2v.js} +256 -82
- package/dist/chunk-aa2pen2v.js.map +34 -0
- package/dist/{chunk-819wnjz8.js → chunk-ajnan18g.js} +13 -10
- package/dist/chunk-ajnan18g.js.map +12 -0
- package/dist/chunk-c15dr03f.js +43 -0
- package/dist/chunk-c15dr03f.js.map +10 -0
- package/dist/{chunk-t0jjkep3.js → chunk-d8qkxt2v.js} +4 -2
- package/dist/chunk-d8qkxt2v.js.map +10 -0
- package/dist/{chunk-vybf6pkp.js → chunk-dbc80ad7.js} +1 -1
- package/dist/{chunk-nkbfrt0c.js → chunk-f26bck4t.js} +7 -7
- package/dist/{chunk-x2yw73hy.js → chunk-fvt9rjsa.js} +23 -7
- package/dist/chunk-fvt9rjsa.js.map +10 -0
- package/dist/{chunk-znagycq7.js → chunk-gbejpkex.js} +5 -5
- package/dist/{chunk-znagycq7.js.map → chunk-gbejpkex.js.map} +1 -1
- package/dist/{chunk-e42bc6m3.js → chunk-gzasd5b6.js} +5 -5
- package/dist/{chunk-e42bc6m3.js.map → chunk-gzasd5b6.js.map} +3 -3
- package/dist/{chunk-rnshztfq.js → chunk-h0k55pc7.js} +6 -6
- package/dist/{chunk-rnshztfq.js.map → chunk-h0k55pc7.js.map} +1 -1
- package/dist/chunk-h5vqbfmd.js +1537 -0
- package/dist/chunk-h5vqbfmd.js.map +19 -0
- package/dist/chunk-j1sbhm7p.js +45 -0
- package/dist/chunk-j1sbhm7p.js.map +10 -0
- package/dist/chunk-jecn6t54.js +307 -0
- package/dist/chunk-jecn6t54.js.map +12 -0
- package/dist/{chunk-dsrkgtnh.js → chunk-jq43kdvk.js} +1 -1
- package/dist/{chunk-wtmzkcht.js → chunk-k34z5rvh.js} +1 -1
- package/dist/{chunk-f6erf2vv.js → chunk-k522z7v6.js} +10 -5
- package/dist/chunk-k522z7v6.js.map +10 -0
- package/dist/{chunk-htq0qh7z.js → chunk-ka3a2ft3.js} +2 -2
- package/dist/{chunk-ckxfnx7f.js → chunk-mth82m8t.js} +129 -95
- package/dist/chunk-mth82m8t.js.map +14 -0
- package/dist/{chunk-5gynx4xn.js → chunk-mwsxn98e.js} +79 -77
- package/dist/{chunk-5gynx4xn.js.map → chunk-mwsxn98e.js.map} +8 -8
- package/dist/{chunk-f2rt4vkh.js → chunk-n2w475r0.js} +3 -3
- package/dist/chunk-n4khvw9n.js +111 -0
- package/dist/chunk-n4khvw9n.js.map +11 -0
- package/dist/{chunk-t8t39h7v.js → chunk-n6jxh8sw.js} +10 -2
- package/dist/chunk-n6jxh8sw.js.map +10 -0
- package/dist/chunk-nn0tekr1.js +284 -0
- package/dist/chunk-nn0tekr1.js.map +12 -0
- package/dist/chunk-nx7k8tpr.js +436 -0
- package/dist/chunk-nx7k8tpr.js.map +12 -0
- package/dist/{chunk-drjqm1aa.js → chunk-p03r0h5s.js} +310 -28
- package/dist/chunk-p03r0h5s.js.map +16 -0
- package/dist/{chunk-1g8negke.js → chunk-p1rzczbt.js} +93 -8
- package/dist/chunk-p1rzczbt.js.map +12 -0
- package/dist/{chunk-f83ka50g.js → chunk-p1x242ad.js} +652 -77
- package/dist/chunk-p1x242ad.js.map +25 -0
- package/dist/chunk-p2vqaxkc.js +528 -0
- package/dist/chunk-p2vqaxkc.js.map +15 -0
- package/dist/{chunk-a31h57d5.js → chunk-pc7ys28c.js} +70 -7
- package/dist/chunk-pc7ys28c.js.map +14 -0
- package/dist/{chunk-md8k0r54.js → chunk-q0k9nc5a.js} +281 -89
- package/dist/chunk-q0k9nc5a.js.map +14 -0
- package/dist/{chunk-bhxaq2nn.js → chunk-qw9gvjv5.js} +1 -1
- package/dist/chunk-r8jrnexe.js +403 -0
- package/dist/chunk-r8jrnexe.js.map +10 -0
- package/dist/{chunk-h9kxd41f.js → chunk-rafagrwr.js} +48 -7
- package/dist/chunk-rafagrwr.js.map +11 -0
- package/dist/{chunk-dysw7nsm.js → chunk-rv2hkwwa.js} +2 -2
- package/dist/{chunk-ghteq96b.js → chunk-s5y30bc9.js} +2 -2
- package/dist/{chunk-t624af60.js → chunk-sbzzr4kx.js} +1848 -757
- package/dist/chunk-sbzzr4kx.js.map +63 -0
- package/dist/{chunk-6gjqgd3d.js → chunk-tpnd31c1.js} +2 -1
- package/dist/chunk-tpnd31c1.js.map +11 -0
- package/dist/chunk-trxxmgnf.js +68 -0
- package/dist/chunk-trxxmgnf.js.map +11 -0
- package/dist/{chunk-0hc5j867.js → chunk-v1xppd0y.js} +17 -13
- package/dist/{chunk-0hc5j867.js.map → chunk-v1xppd0y.js.map} +2 -2
- package/dist/chunk-v4en4jc2.js +252 -0
- package/dist/chunk-v4en4jc2.js.map +10 -0
- package/dist/{chunk-xkthy56g.js → chunk-w1tvjszy.js} +1 -1
- package/dist/{chunk-8b55ygje.js → chunk-w3e09qqk.js} +1 -1
- package/dist/{chunk-8gv5z0zm.js → chunk-w9tg6yyb.js} +13 -8
- package/dist/{chunk-8gv5z0zm.js.map → chunk-w9tg6yyb.js.map} +3 -3
- package/dist/{chunk-62c7t4jc.js → chunk-wdage1eb.js} +1 -1
- package/dist/{chunk-tg5mee00.js → chunk-wtf06et8.js} +11 -7
- package/dist/{chunk-tg5mee00.js.map → chunk-wtf06et8.js.map} +3 -3
- package/dist/{chunk-nva1xkjz.js → chunk-xajtptbw.js} +1237 -1434
- package/dist/chunk-xajtptbw.js.map +40 -0
- package/dist/{chunk-xc7hq65b.js → chunk-yp8ee62z.js} +49 -2
- package/dist/chunk-yp8ee62z.js.map +11 -0
- package/dist/chunk-z4ccwbkz.js +139 -0
- package/dist/chunk-z4ccwbkz.js.map +10 -0
- package/dist/datasets/builders.d.ts +11 -2
- package/dist/datasets/builders.d.ts.map +1 -1
- package/dist/datasets/changes.d.ts +14 -4
- package/dist/datasets/changes.d.ts.map +1 -1
- package/dist/datasets/execution.d.ts +15 -1
- package/dist/datasets/execution.d.ts.map +1 -1
- package/dist/datasets/index.d.ts +1 -0
- package/dist/datasets/index.d.ts.map +1 -1
- package/dist/datasets/sequence.d.ts +7 -0
- package/dist/datasets/sequence.d.ts.map +1 -0
- package/dist/datasets/types.d.ts +1 -0
- package/dist/datasets/types.d.ts.map +1 -1
- package/dist/datasets/validation.d.ts.map +1 -1
- package/dist/datasets/write.d.ts +37 -0
- package/dist/datasets/write.d.ts.map +1 -0
- package/dist/datasets/write.js +17 -0
- package/dist/datasets/write.js.map +9 -0
- package/dist/error-reporting/internal.js +4 -4
- package/dist/error-reporting/types.d.ts +7 -2
- package/dist/error-reporting/types.d.ts.map +1 -1
- package/dist/errors/catalog.d.ts +8 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/internal.js +2 -2
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.js +4 -4
- package/dist/events/types/datasets.d.ts +2 -6
- package/dist/events/types/datasets.d.ts.map +1 -1
- package/dist/execution/agent.d.ts +18 -9
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +62 -46
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorization.d.ts +68 -20
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +69 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -0
- package/dist/execution/durable.d.ts.map +1 -1
- package/dist/execution/index.d.ts +1 -1
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/primitive.js +55 -46
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.d.ts +14 -1
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +92 -54
- package/dist/execution/request.js.map +3 -3
- package/dist/execution/scopes.d.ts +16 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/types.d.ts +10 -1
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts +2 -0
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +128 -109
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +2 -0
- package/dist/json.d.ts.map +1 -1
- package/dist/lake-storage/definition-updates.d.ts.map +1 -1
- package/dist/lake-storage/errors.d.ts +5 -1
- package/dist/lake-storage/errors.d.ts.map +1 -1
- package/dist/lake-storage/in-memory.d.ts +1 -0
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +6 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +27 -10
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/merge-validation.d.ts.map +1 -1
- package/dist/lake-storage/merge.d.ts +13 -2
- package/dist/lake-storage/merge.d.ts.map +1 -1
- package/dist/lake-storage/source-ordering.d.ts +19 -0
- package/dist/lake-storage/source-ordering.d.ts.map +1 -0
- package/dist/lake-storage/sql-transforms.d.ts +2 -1
- package/dist/lake-storage/sql-transforms.d.ts.map +1 -1
- package/dist/lake-storage/types.d.ts +10 -5
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/lake-storage/version-inputs.d.ts +4 -0
- package/dist/lake-storage/version-inputs.d.ts.map +1 -0
- package/dist/logging/index.js +3 -3
- package/dist/logging/types.js +2 -2
- package/dist/materialization/index.js +2 -2
- package/dist/materializer/index.js +38 -31
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/catalog.d.ts +40 -0
- package/dist/models/catalog.d.ts.map +1 -0
- package/dist/models/definitions.d.ts +25 -0
- package/dist/models/definitions.d.ts.map +1 -0
- package/dist/models/errors.d.ts +52 -0
- package/dist/models/errors.d.ts.map +1 -0
- package/dist/models/events.d.ts +192 -0
- package/dist/models/events.d.ts.map +1 -0
- package/dist/models/index.d.ts +17 -39
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +50 -0
- package/dist/models/index.js.map +9 -0
- package/dist/models/language-model.d.ts +90 -0
- package/dist/models/language-model.d.ts.map +1 -0
- package/dist/models/messages.d.ts +74 -0
- package/dist/models/messages.d.ts.map +1 -0
- package/dist/models/pricing.d.ts +69 -0
- package/dist/models/pricing.d.ts.map +1 -0
- package/dist/models/rate-card.d.ts +24 -0
- package/dist/models/rate-card.d.ts.map +1 -0
- package/dist/models/tools.d.ts +24 -0
- package/dist/models/tools.d.ts.map +1 -0
- package/dist/objects/authorized-ontology-view.d.ts +25 -0
- package/dist/objects/authorized-ontology-view.d.ts.map +1 -0
- package/dist/objects/execution.d.ts +1 -1
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +43 -36
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/link/authorization.d.ts +2 -7
- package/dist/objects/link/authorization.d.ts.map +1 -1
- package/dist/objects/query/executor.d.ts +4 -2
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.js +36 -29
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/links.d.ts +22 -1
- package/dist/objects/query/links.d.ts.map +1 -1
- package/dist/objects/query/selected-read-admission.d.ts +27 -0
- package/dist/objects/query/selected-read-admission.d.ts.map +1 -0
- package/dist/objects/query/validate.d.ts +60 -2
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/object-handle.d.ts.map +1 -1
- package/dist/objects/sdk/object-set.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts +2 -7
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
- package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
- package/dist/objects/service/list-service.d.ts +2 -3
- package/dist/objects/service/list-service.d.ts.map +1 -1
- package/dist/objects/telemetry/history.d.ts +8 -6
- package/dist/objects/telemetry/history.d.ts.map +1 -1
- package/dist/objects/telemetry/index.d.ts +2 -2
- package/dist/objects/telemetry/index.d.ts.map +1 -1
- package/dist/objects/telemetry/workload.d.ts +11 -0
- package/dist/objects/telemetry/workload.d.ts.map +1 -0
- package/dist/ontology/index.d.ts +2 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +15 -14
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/inference/index.d.ts +2 -1
- package/dist/ontology/inference/index.d.ts.map +1 -1
- package/dist/ontology/internal.d.ts +0 -1
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +5 -10
- package/dist/ontology/internal.js.map +3 -3
- package/dist/ontology/json-schema.d.ts +10 -6
- package/dist/ontology/json-schema.d.ts.map +1 -1
- package/dist/ontology/link-path-selection.d.ts +35 -0
- package/dist/ontology/link-path-selection.d.ts.map +1 -0
- package/dist/ontology/refs.d.ts +2 -0
- package/dist/ontology/refs.d.ts.map +1 -1
- package/dist/ontology/tokens.d.ts +2 -1
- package/dist/ontology/tokens.d.ts.map +1 -1
- package/dist/pipelines/execution.d.ts.map +1 -1
- package/dist/pipelines/index.js +41 -36
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/request.d.ts.map +1 -1
- package/dist/projections/execution.d.ts.map +1 -1
- package/dist/projections/internal.js +39 -32
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +3 -2
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +3 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +15 -3
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/rules/execution.d.ts.map +1 -1
- package/dist/runtime/create.d.ts +7 -4
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +4 -2
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +5 -2
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +4 -2
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts +8 -2
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +3 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/schedules/execution.d.ts +2 -1
- package/dist/schedules/execution.d.ts.map +1 -1
- package/dist/security/every.d.ts +4 -4
- package/dist/security/every.d.ts.map +1 -1
- package/dist/security/grants.d.ts +12 -6
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/registry.d.ts +2 -1
- package/dist/security/registry.d.ts.map +1 -1
- package/dist/security/types.d.ts +19 -5
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts +6 -2
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/shares/access-plan.d.ts +22 -0
- package/dist/shares/access-plan.d.ts.map +1 -0
- package/dist/shares/builders.d.ts +14 -0
- package/dist/shares/builders.d.ts.map +1 -0
- package/dist/shares/compiler.d.ts +14 -0
- package/dist/shares/compiler.d.ts.map +1 -0
- package/dist/shares/errors.d.ts +4 -0
- package/dist/shares/errors.d.ts.map +1 -0
- package/dist/shares/execution.d.ts +57 -0
- package/dist/shares/execution.d.ts.map +1 -0
- package/dist/shares/index.d.ts +10 -0
- package/dist/shares/index.d.ts.map +1 -0
- package/dist/shares/internal.d.ts +3 -0
- package/dist/shares/internal.d.ts.map +1 -0
- package/dist/shares/internal.js +239 -0
- package/dist/shares/internal.js.map +10 -0
- package/dist/shares/intersection.d.ts +9 -0
- package/dist/shares/intersection.d.ts.map +1 -0
- package/dist/shares/session-protocol.d.ts +41 -0
- package/dist/shares/session-protocol.d.ts.map +1 -0
- package/dist/shares/types.d.ts +51 -0
- package/dist/shares/types.d.ts.map +1 -0
- package/dist/shares/validation.d.ts +11 -0
- package/dist/shares/validation.d.ts.map +1 -0
- package/dist/storage/action-runs/failure.js +3 -3
- package/dist/storage/action-runs/provider.js +2 -2
- package/dist/storage/agents/errors.d.ts +1 -1
- package/dist/storage/agents/errors.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +3 -2
- 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 +11 -4
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +18 -15
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +65 -17
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +2 -1
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/codec.d.ts +3 -2
- package/dist/storage/ai-cost/codec.d.ts.map +1 -1
- package/dist/storage/ai-cost/groups.d.ts +51 -0
- package/dist/storage/ai-cost/groups.d.ts.map +1 -0
- package/dist/storage/ai-cost/in-memory.d.ts +11 -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 +2 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +29 -13
- package/dist/storage/ai-cost/provider.js.map +3 -3
- package/dist/storage/ai-cost/types.d.ts +64 -15
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/validation.d.ts +2 -1
- package/dist/storage/ai-cost/validation.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.d.ts +14 -0
- package/dist/storage/ai-limits/enforcement.d.ts.map +1 -0
- package/dist/storage/ai-limits/enforcement.js +21 -0
- package/dist/storage/ai-limits/enforcement.js.map +9 -0
- package/dist/storage/ai-limits/errors.d.ts +8 -0
- package/dist/storage/ai-limits/errors.d.ts.map +1 -0
- package/dist/storage/ai-limits/in-memory.d.ts +78 -0
- package/dist/storage/ai-limits/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-limits/index.d.ts +7 -0
- package/dist/storage/ai-limits/index.d.ts.map +1 -0
- package/dist/storage/ai-limits/period.d.ts +4 -0
- package/dist/storage/ai-limits/period.d.ts.map +1 -0
- package/dist/storage/ai-limits/provider.d.ts +85 -0
- package/dist/storage/ai-limits/provider.d.ts.map +1 -0
- package/dist/storage/ai-limits/provider.js +62 -0
- package/dist/storage/ai-limits/provider.js.map +9 -0
- package/dist/storage/ai-limits/types.d.ts +175 -0
- package/dist/storage/ai-limits/types.d.ts.map +1 -0
- package/dist/storage/ai-usage/in-memory.d.ts +4 -0
- package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-usage/record.d.ts.map +1 -1
- package/dist/storage/ai-usage/types.d.ts +6 -2
- package/dist/storage/ai-usage/types.d.ts.map +1 -1
- package/dist/storage/auth/errors.d.ts +1 -1
- package/dist/storage/auth/errors.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts +4 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/device-authorizations.d.ts +29 -0
- package/dist/storage/auth/in-memory/device-authorizations.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/shared.d.ts +3 -1
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
- package/dist/storage/auth/index.d.ts +2 -1
- package/dist/storage/auth/index.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +66 -0
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +2 -2
- package/dist/storage/executions/in-memory.d.ts +3 -0
- package/dist/storage/executions/in-memory.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +4 -1
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +23 -3
- package/dist/storage/executions/provider.js.map +3 -3
- package/dist/storage/executions/run-link.d.ts +14 -2
- package/dist/storage/executions/run-link.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts +6 -0
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts +12 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +15 -6
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +78 -36
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/objects/execution-limits.d.ts +25 -0
- package/dist/storage/objects/execution-limits.d.ts.map +1 -0
- package/dist/storage/objects/guard.d.ts +16 -0
- package/dist/storage/objects/guard.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/index.d.ts +3 -0
- package/dist/storage/objects/in-memory/index.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/keys.d.ts +10 -0
- package/dist/storage/objects/in-memory/keys.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/query.d.ts +31 -0
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/read-scope.d.ts +18 -0
- package/dist/storage/objects/in-memory/read-scope.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/read-source.d.ts +10 -0
- package/dist/storage/objects/in-memory/read-source.d.ts.map +1 -0
- package/dist/storage/objects/in-memory/selected-reader.d.ts +9 -0
- package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -0
- package/dist/storage/objects/{in-memory.d.ts → in-memory/storage.d.ts} +13 -10
- package/dist/storage/objects/in-memory/storage.d.ts.map +1 -0
- package/dist/storage/objects/index.d.ts +4 -1
- package/dist/storage/objects/index.d.ts.map +1 -1
- package/dist/storage/objects/keys.d.ts +1 -1
- package/dist/storage/objects/keys.d.ts.map +1 -1
- package/dist/storage/objects/read-scope.d.ts +25 -0
- package/dist/storage/objects/read-scope.d.ts.map +1 -0
- package/dist/storage/objects/types.d.ts +114 -22
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +3 -3
- package/dist/storage/operation-scope.d.ts +3 -0
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +4 -2
- package/dist/storage/operation-scope.js.map +1 -1
- package/dist/storage/pipeline-runs/provider.js +2 -2
- package/dist/storage/projection-runs/provider.js +4 -4
- package/dist/storage/share-grants/errors.d.ts +8 -0
- package/dist/storage/share-grants/errors.d.ts.map +1 -0
- package/dist/storage/share-grants/in-memory.d.ts +11 -0
- package/dist/storage/share-grants/in-memory.d.ts.map +1 -0
- package/dist/storage/share-grants/index.d.ts +5 -0
- package/dist/storage/share-grants/index.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.d.ts +4 -0
- package/dist/storage/share-grants/provider.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.js +24 -0
- package/dist/storage/share-grants/provider.js.map +9 -0
- package/dist/storage/share-grants/record.d.ts +11 -0
- package/dist/storage/share-grants/record.d.ts.map +1 -0
- package/dist/storage/share-grants/types.d.ts +97 -0
- package/dist/storage/share-grants/types.d.ts.map +1 -0
- package/dist/storage/share-sessions/errors.d.ts +8 -0
- package/dist/storage/share-sessions/errors.d.ts.map +1 -0
- package/dist/storage/share-sessions/in-memory.d.ts +14 -0
- package/dist/storage/share-sessions/in-memory.d.ts.map +1 -0
- package/dist/storage/share-sessions/index.d.ts +5 -0
- package/dist/storage/share-sessions/index.d.ts.map +1 -0
- package/dist/storage/share-sessions/provider.d.ts +3 -0
- package/dist/storage/share-sessions/provider.d.ts.map +1 -0
- package/dist/storage/share-sessions/provider.js +20 -0
- package/dist/storage/share-sessions/provider.js.map +9 -0
- package/dist/storage/share-sessions/record.d.ts +8 -0
- package/dist/storage/share-sessions/record.d.ts.map +1 -0
- package/dist/storage/share-sessions/types.d.ts +50 -0
- package/dist/storage/share-sessions/types.d.ts.map +1 -0
- package/dist/storage/sync-runs/provider.js +2 -2
- package/dist/storage/transaction.d.ts +2 -1
- package/dist/storage/transaction.d.ts.map +1 -1
- package/dist/storage/types.d.ts +13 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/provider.js +2 -2
- package/dist/storage/workflow-runs/provider.d.ts +1 -1
- package/dist/storage/workflow-runs/provider.js +14 -12
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +5 -4
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/execution.d.ts.map +1 -1
- package/dist/syncs/index.js +41 -36
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/testing/agent-execution.d.ts +3 -1
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-limit-storage-contract.d.ts +18 -0
- package/dist/testing/ai-limit-storage-contract.d.ts.map +1 -0
- package/dist/testing/ai-model-call-groups-contract.d.ts +6 -0
- package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -0
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/dataset-sequence-contract.d.ts +4 -0
- package/dist/testing/dataset-sequence-contract.d.ts.map +1 -0
- package/dist/testing/effective-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts +4 -0
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5392 -2070
- package/dist/testing/index.js.map +21 -15
- package/dist/testing/lake-merge-storage-contract.d.ts +1 -0
- package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-read-scope-contract.d.ts +22 -0
- package/dist/testing/object-read-scope-contract.d.ts.map +1 -0
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/share-grant-storage-contract.d.ts +10 -0
- package/dist/testing/share-grant-storage-contract.d.ts.map +1 -0
- package/dist/testing/share-session-storage-contract.d.ts +9 -0
- package/dist/testing/share-session-storage-contract.d.ts.map +1 -0
- package/dist/webhooks/internal.js +36 -29
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +2 -2
- package/dist/workflows/agent-step-identity.d.ts +3 -0
- package/dist/workflows/agent-step-identity.d.ts.map +1 -0
- package/dist/workflows/builders.d.ts +2 -3
- package/dist/workflows/builders.d.ts.map +1 -1
- package/dist/workflows/execution.d.ts +1 -1
- package/dist/workflows/execution.d.ts.map +1 -1
- package/dist/workflows/failure.d.ts +1 -1
- package/dist/workflows/failure.d.ts.map +1 -1
- package/dist/workflows/index.d.ts +3 -2
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/index.js +63 -48
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +26 -11
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/validation.d.ts +7 -1
- package/dist/workflows/validation.d.ts.map +1 -1
- package/package.json +43 -4
- package/src/actions/delegated-admission.ts +72 -0
- package/src/actions/descriptor.ts +58 -0
- package/src/actions/execution.ts +99 -24
- package/src/actions/request.ts +136 -19
- package/src/actions/run-authorization.ts +53 -0
- package/src/actions/run-dispatch.ts +8 -1
- package/src/agents/adapters.ts +60 -456
- package/src/agents/authority.ts +215 -34
- package/src/agents/builders.ts +3 -50
- package/src/agents/context-compaction.ts +4 -0
- package/src/agents/context-resolution.ts +1 -4
- package/src/agents/dispatch.ts +59 -2
- package/src/agents/errors.ts +4 -11
- package/src/agents/execution.ts +65 -56
- package/src/agents/identity.ts +4 -0
- package/src/agents/ids.ts +16 -1
- package/src/agents/index.ts +23 -30
- package/src/agents/message.ts +20 -12
- package/src/agents/model-loop.ts +1071 -0
- package/src/agents/reference.ts +7 -0
- package/src/agents/request.ts +157 -77
- package/src/agents/retired-config.ts +20 -0
- package/src/agents/streams.ts +45 -19
- package/src/agents/tool-catalog.ts +21 -0
- package/src/agents/tool-definition.ts +9 -5
- package/src/agents/types.ts +39 -81
- package/src/agents/validation.ts +11 -216
- package/src/ai-usage/execution.ts +189 -0
- package/src/ai-usage/index.ts +15 -0
- package/src/authorization/decision.ts +54 -22
- package/src/authorization/grant-kinds.ts +72 -15
- package/src/authorization/index.ts +2 -0
- package/src/authorization/resolve.ts +12 -5
- package/src/authorization/types.ts +7 -5
- package/src/bootstrap/discovery.ts +3 -3
- package/src/bootstrap/ontology-type-manifest.ts +12 -6
- package/src/datasets/builders.ts +23 -2
- package/src/datasets/changes.ts +16 -4
- package/src/datasets/execution.ts +76 -5
- package/src/datasets/index.ts +1 -0
- package/src/datasets/sequence.ts +77 -0
- package/src/datasets/types.ts +1 -0
- package/src/datasets/validation.ts +26 -0
- package/src/datasets/write.ts +240 -0
- package/src/error-reporting/types.ts +4 -2
- package/src/errors/catalog.ts +8 -0
- package/src/events/execution.ts +57 -7
- package/src/events/types/datasets.ts +2 -6
- package/src/execution/agent.ts +129 -25
- package/src/execution/authorization.ts +493 -83
- package/src/execution/authorized-object-reader.ts +695 -0
- package/src/execution/durable.ts +10 -2
- package/src/execution/index.ts +1 -0
- package/src/execution/request.ts +67 -14
- package/src/execution/scopes.ts +36 -6
- package/src/execution/types.ts +9 -1
- package/src/http/api-routes.ts +108 -0
- package/src/index.ts +72 -22
- package/src/json.ts +9 -0
- package/src/lake-storage/definition-updates.ts +9 -0
- package/src/lake-storage/errors.ts +6 -1
- package/src/lake-storage/in-memory.ts +53 -17
- package/src/lake-storage/index.ts +10 -1
- package/src/lake-storage/merge-validation.ts +12 -2
- package/src/lake-storage/merge.ts +40 -2
- package/src/lake-storage/source-ordering.ts +95 -0
- package/src/lake-storage/sql-transforms.ts +2 -1
- package/src/lake-storage/types.ts +10 -5
- package/src/lake-storage/version-inputs.ts +14 -0
- package/src/models/catalog.ts +137 -0
- package/src/models/definitions.ts +202 -0
- package/src/models/errors.ts +83 -0
- package/src/models/events.ts +198 -0
- package/src/models/index.ts +89 -71
- package/src/models/language-model.ts +143 -0
- package/src/models/messages.ts +78 -0
- package/src/models/pricing.ts +390 -0
- package/src/models/rate-card.ts +101 -0
- package/src/models/tools.ts +29 -0
- package/src/objects/authorized-ontology-view.ts +512 -0
- package/src/objects/execution.ts +98 -143
- package/src/objects/link/authorization.ts +3 -2
- package/src/objects/query/executor.ts +45 -34
- package/src/objects/query/links.ts +84 -25
- package/src/objects/query/selected-read-admission.ts +310 -0
- package/src/objects/query/validate.ts +353 -36
- package/src/objects/sdk/object-handle.ts +2 -8
- package/src/objects/sdk/object-set.ts +10 -11
- package/src/objects/sdk/runtime-query-executor.ts +8 -28
- package/src/objects/sdk/telemetry-channel.ts +11 -7
- package/src/objects/service/list-service.ts +15 -29
- package/src/objects/telemetry/history.ts +297 -17
- package/src/objects/telemetry/index.ts +2 -2
- package/src/objects/telemetry/workload.ts +79 -0
- package/src/ontology/index.ts +7 -1
- package/src/ontology/inference/index.ts +4 -1
- package/src/ontology/internal.ts +0 -1
- package/src/ontology/json-schema.ts +13 -12
- package/src/ontology/link-path-selection.ts +193 -0
- package/src/ontology/refs.ts +19 -0
- package/src/ontology/tokens.ts +15 -8
- package/src/pipelines/execution.ts +30 -7
- package/src/pipelines/request.ts +5 -0
- package/src/projections/execution.ts +72 -11
- package/src/projections/run-dispatch.ts +6 -12
- package/src/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +11 -0
- package/src/queues/types.ts +20 -3
- package/src/rules/execution.ts +20 -8
- package/src/runtime/create.ts +11 -5
- package/src/runtime/definitions.ts +4 -2
- package/src/runtime/host.ts +28 -8
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +22 -36
- package/src/runtime/sixb.ts +29 -10
- package/src/runtime/types.ts +3 -0
- package/src/schedules/execution.ts +24 -2
- package/src/security/every.ts +4 -4
- package/src/security/grants.ts +100 -14
- package/src/security/index.ts +3 -0
- package/src/security/registry.ts +9 -5
- package/src/security/types.ts +23 -4
- package/src/security/validation.ts +33 -9
- package/src/shares/access-plan.ts +225 -0
- package/src/shares/builders.ts +381 -0
- package/src/shares/compiler.ts +359 -0
- package/src/shares/errors.ts +3 -0
- package/src/shares/execution.ts +394 -0
- package/src/shares/index.ts +28 -0
- package/src/shares/internal.ts +9 -0
- package/src/shares/intersection.ts +178 -0
- package/src/shares/session-protocol.ts +258 -0
- package/src/shares/types.ts +76 -0
- package/src/shares/validation.ts +40 -0
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +121 -11
- package/src/storage/agents/index.ts +7 -0
- package/src/storage/agents/provider.ts +150 -6
- package/src/storage/agents/types.ts +73 -16
- package/src/storage/ai-cost/analytics.ts +63 -6
- package/src/storage/ai-cost/codec.ts +37 -12
- package/src/storage/ai-cost/groups.ts +248 -0
- package/src/storage/ai-cost/in-memory.ts +42 -0
- package/src/storage/ai-cost/index.ts +6 -0
- package/src/storage/ai-cost/provider.ts +7 -0
- package/src/storage/ai-cost/types.ts +76 -14
- package/src/storage/ai-cost/validation.ts +147 -17
- package/src/storage/ai-limits/enforcement.ts +68 -0
- package/src/storage/ai-limits/errors.ts +23 -0
- package/src/storage/ai-limits/in-memory.ts +671 -0
- package/src/storage/ai-limits/index.ts +31 -0
- package/src/storage/ai-limits/period.ts +11 -0
- package/src/storage/ai-limits/provider.ts +430 -0
- package/src/storage/ai-limits/types.ts +195 -0
- package/src/storage/ai-usage/in-memory.ts +13 -0
- package/src/storage/ai-usage/record.ts +17 -0
- package/src/storage/ai-usage/types.ts +6 -2
- package/src/storage/auth/errors.ts +6 -0
- package/src/storage/auth/in-memory/auth-storage.ts +69 -0
- package/src/storage/auth/in-memory/device-authorizations.ts +145 -0
- package/src/storage/auth/in-memory/shared.ts +7 -0
- package/src/storage/auth/index.ts +7 -0
- package/src/storage/auth/types.ts +73 -0
- package/src/storage/executions/in-memory.ts +9 -1
- package/src/storage/executions/provider.ts +30 -1
- package/src/storage/executions/run-link.ts +45 -6
- package/src/storage/executions/validation.ts +82 -7
- package/src/storage/in-memory/index.ts +69 -6
- package/src/storage/index.ts +102 -1
- package/src/storage/objects/execution-limits.ts +283 -0
- package/src/storage/objects/guard.ts +55 -0
- package/src/storage/objects/in-memory/index.ts +2 -0
- package/src/storage/objects/in-memory/keys.ts +46 -0
- package/src/storage/objects/in-memory/query.ts +754 -0
- package/src/storage/objects/in-memory/read-scope.ts +211 -0
- package/src/storage/objects/in-memory/read-source.ts +10 -0
- package/src/storage/objects/in-memory/selected-reader.ts +252 -0
- package/src/storage/objects/in-memory/storage.ts +589 -0
- package/src/storage/objects/index.ts +21 -0
- package/src/storage/objects/keys.ts +1 -1
- package/src/storage/objects/read-scope.ts +672 -0
- package/src/storage/objects/types.ts +123 -19
- package/src/storage/operation-scope.ts +16 -0
- package/src/storage/share-grants/errors.ts +14 -0
- package/src/storage/share-grants/in-memory.ts +107 -0
- package/src/storage/share-grants/index.ts +14 -0
- package/src/storage/share-grants/provider.ts +11 -0
- package/src/storage/share-grants/record.ts +347 -0
- package/src/storage/share-grants/types.ts +112 -0
- package/src/storage/share-sessions/errors.ts +14 -0
- package/src/storage/share-sessions/in-memory.ts +105 -0
- package/src/storage/share-sessions/index.ts +11 -0
- package/src/storage/share-sessions/provider.ts +9 -0
- package/src/storage/share-sessions/record.ts +176 -0
- package/src/storage/share-sessions/types.ts +57 -0
- package/src/storage/transaction.ts +14 -2
- package/src/storage/types.ts +64 -0
- package/src/storage/workflow-runs/in-memory.ts +3 -3
- package/src/storage/workflow-runs/provider.ts +2 -2
- package/src/storage/workflow-runs/types.ts +6 -3
- package/src/syncs/execution.ts +25 -5
- package/src/syncs/request.ts +5 -0
- package/src/testing/agent-execution.ts +40 -28
- package/src/testing/agent-storage-contract.ts +249 -28
- package/src/testing/ai-cost-storage-contract.ts +96 -8
- package/src/testing/ai-limit-storage-contract.ts +1134 -0
- package/src/testing/ai-model-call-groups-contract.ts +353 -0
- package/src/testing/ai-usage-storage-contract.ts +31 -0
- package/src/testing/auth-storage-contract.ts +85 -0
- package/src/testing/dataset-sequence-contract.ts +373 -0
- package/src/testing/effective-storage-contract.ts +34 -0
- package/src/testing/execution-storage-contract.ts +81 -2
- package/src/testing/index.ts +26 -0
- package/src/testing/lake-merge-storage-contract.ts +3 -0
- package/src/testing/lake-storage-contract.ts +58 -0
- package/src/testing/object-read-scope-contract.ts +939 -0
- package/src/testing/queues-contract.ts +36 -1
- package/src/testing/share-grant-storage-contract.ts +325 -0
- package/src/testing/share-session-storage-contract.ts +235 -0
- package/src/workflows/agent-step-identity.ts +4 -0
- package/src/workflows/builders.ts +95 -9
- package/src/workflows/execution.ts +55 -16
- package/src/workflows/failure.ts +2 -2
- package/src/workflows/index.ts +3 -0
- package/src/workflows/request.ts +5 -0
- package/src/workflows/types.ts +23 -11
- package/src/workflows/validation.ts +100 -7
- package/dist/chunk-1e8m6yn3.js.map +0 -37
- package/dist/chunk-1g8negke.js.map +0 -11
- package/dist/chunk-4gz41why.js +0 -72
- package/dist/chunk-4gz41why.js.map +0 -11
- package/dist/chunk-5sxb1168.js.map +0 -34
- package/dist/chunk-6gjqgd3d.js.map +0 -11
- package/dist/chunk-819wnjz8.js.map +0 -12
- package/dist/chunk-a31h57d5.js.map +0 -13
- package/dist/chunk-a44d5zgd.js +0 -556
- package/dist/chunk-a44d5zgd.js.map +0 -16
- package/dist/chunk-ckxfnx7f.js.map +0 -13
- package/dist/chunk-dm72y8wt.js.map +0 -10
- package/dist/chunk-drjqm1aa.js.map +0 -15
- package/dist/chunk-dy311asx.js.map +0 -14
- package/dist/chunk-f6erf2vv.js.map +0 -10
- package/dist/chunk-f83ka50g.js.map +0 -23
- package/dist/chunk-fe5ev6mr.js +0 -55
- package/dist/chunk-fe5ev6mr.js.map +0 -11
- package/dist/chunk-h9kxd41f.js.map +0 -11
- package/dist/chunk-hceck7dq.js +0 -137
- package/dist/chunk-hceck7dq.js.map +0 -10
- package/dist/chunk-md8k0r54.js.map +0 -14
- package/dist/chunk-n4spznws.js.map +0 -11
- package/dist/chunk-nva1xkjz.js.map +0 -46
- package/dist/chunk-qewtks41.js.map +0 -11
- package/dist/chunk-t0jjkep3.js.map +0 -10
- package/dist/chunk-t624af60.js.map +0 -56
- package/dist/chunk-t8t39h7v.js.map +0 -10
- package/dist/chunk-t9xghkva.js +0 -28
- package/dist/chunk-t9xghkva.js.map +0 -10
- package/dist/chunk-x2yw73hy.js.map +0 -10
- package/dist/chunk-xc7hq65b.js.map +0 -10
- package/dist/storage/objects/in-memory.d.ts.map +0 -1
- package/src/storage/objects/in-memory.ts +0 -1241
- /package/dist/{chunk-zqysyfjt.js.map → chunk-08m3b6w8.js.map} +0 -0
- /package/dist/{chunk-z3zp0bj1.js.map → chunk-407j3msh.js.map} +0 -0
- /package/dist/{chunk-rhrbz7d4.js.map → chunk-4a849fr1.js.map} +0 -0
- /package/dist/{chunk-cy0n5dms.js.map → chunk-4jjp5k14.js.map} +0 -0
- /package/dist/{chunk-ezake7g1.js.map → chunk-5ntny1qx.js.map} +0 -0
- /package/dist/{chunk-72q2y8hn.js.map → chunk-8tsf6dmc.js.map} +0 -0
- /package/dist/{chunk-vybf6pkp.js.map → chunk-dbc80ad7.js.map} +0 -0
- /package/dist/{chunk-nkbfrt0c.js.map → chunk-f26bck4t.js.map} +0 -0
- /package/dist/{chunk-dsrkgtnh.js.map → chunk-jq43kdvk.js.map} +0 -0
- /package/dist/{chunk-wtmzkcht.js.map → chunk-k34z5rvh.js.map} +0 -0
- /package/dist/{chunk-htq0qh7z.js.map → chunk-ka3a2ft3.js.map} +0 -0
- /package/dist/{chunk-f2rt4vkh.js.map → chunk-n2w475r0.js.map} +0 -0
- /package/dist/{chunk-bhxaq2nn.js.map → chunk-qw9gvjv5.js.map} +0 -0
- /package/dist/{chunk-dysw7nsm.js.map → chunk-rv2hkwwa.js.map} +0 -0
- /package/dist/{chunk-ghteq96b.js.map → chunk-s5y30bc9.js.map} +0 -0
- /package/dist/{chunk-xkthy56g.js.map → chunk-w1tvjszy.js.map} +0 -0
- /package/dist/{chunk-8b55ygje.js.map → chunk-w3e09qqk.js.map} +0 -0
- /package/dist/{chunk-62c7t4jc.js.map → chunk-wdage1eb.js.map} +0 -0
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/storage/agents/errors.ts", "../src/storage/agents/provider.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"export type AgentStorageErrorCode =\n | \"thread_not_found\"\n | \"active_run_exists\"\n | \"run_not_found\"\n | \"invalid_input\"\n | \"invalid_state\"\n | \"execution_lost\"\n | \"duplicate_id\"\n\n/**\n * Error for agent-storage invariants and invalid state transitions (single-flight, execution\n * ownership, run lifecycle, message append). Callers branch on `code` rather than message text.\n */\nexport class AgentStorageError extends Error {\n readonly name = \"AgentStorageError\"\n\n constructor(\n readonly code: AgentStorageErrorCode,\n message: string\n ) {\n super(message)\n }\n}\n",
|
|
6
|
-
"import { agentServiceAccountId } from \"../../agents/authority\"\nimport type { ExecutionStorage } from \"../executions\"\nimport { findAgentRunExecution } from \"../executions/run-link\"\nimport { AgentStorageError } from \"./errors\"\nimport type {\n AgentContextCheckpointRecord,\n AgentMessageRecord,\n AgentRunRecord,\n AgentThreadRecord,\n CreateAgentContextCheckpointInput,\n} from \"./types\"\n\n/** Validate the semantic link between a conversational Agent run and its immutable execution. */\nexport async function assertAgentRunExecution(input: {\n readonly executions: ExecutionStorage\n readonly projectId: string\n readonly executionId: string\n readonly runId: string\n readonly agentId: string\n}): Promise<void> {\n const execution = await findAgentRunExecution({\n executions: input.executions,\n projectId: input.projectId,\n executionId: input.executionId,\n runId: input.runId,\n serviceAccountId: agentServiceAccountId(input.agentId),\n })\n if (!execution) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[Sixb] Execution '${input.executionId}' does not authorize Agent run '${input.runId}'.`\n )\n }\n}\n\n/** Validate provider-independent checkpoint fields before entering a storage critical section. */\nexport function assertCreateAgentContextCheckpointInput(\n input: CreateAgentContextCheckpointInput,\n prefix = \"Sixb\"\n): void {\n for (const [name, value] of [\n [\"id\", input.id],\n [\"projectId\", input.projectId],\n [\"threadId\", input.threadId],\n [\"createdByRunId\", input.createdByRunId],\n [\"executionToken\", input.executionToken],\n [\"summary\", input.summary],\n [\"summaryModelId\", input.summaryModelId],\n ] as const) {\n if (value.trim().length === 0) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint '${name}' must not be empty.`\n )\n }\n }\n\n if (input.summaryFormatVersion !== 1) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint summary format version must be 1.`\n )\n }\n if (input.reason !== \"threshold\" && input.reason !== \"overflow\") {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint reason must be 'threshold' or 'overflow'.`\n )\n }\n if (\n input.expectedPreviousCheckpointId !== null &&\n input.expectedPreviousCheckpointId.trim().length === 0\n ) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint expected previous id must not be empty.`\n )\n }\n if (input.createdAt && !Number.isFinite(input.createdAt.getTime())) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint createdAt must be a valid date.`\n )\n }\n\n for (const [name, value, minimum] of [\n [\"expectedHeadSeq\", input.expectedHeadSeq, 1],\n [\"summarizedThroughSeq\", input.summarizedThroughSeq, 1],\n [\"observedHeadSeq\", input.observedHeadSeq, 1],\n [\"estimatedInputTokensBefore\", input.estimatedInputTokensBefore, 0],\n [\"estimatedInputTokensAfter\", input.estimatedInputTokensAfter, 0],\n ] as const) {\n if (!Number.isSafeInteger(value) || value < minimum) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint '${name}' must be a safe integer greater than or equal to ${minimum}.`\n )\n }\n }\n\n if (input.observedHeadSeq !== input.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint observed head must equal its expected message head.`\n )\n }\n if (input.summarizedThroughSeq >= input.observedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint must retain the triggering head message.`\n )\n }\n}\n\n/** Assert that the current delivery still owns the active conversational run. */\nexport function assertAgentContextCheckpointAuthority(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly run: AgentRunRecord | null\n readonly thread: AgentThreadRecord | null\n readonly prefix?: string\n}): asserts input is typeof input & {\n readonly run: AgentRunRecord\n readonly thread: AgentThreadRecord\n} {\n const { create, run, thread } = input\n const prefix = input.prefix ?? \"Sixb\"\n if (!run) {\n throw new AgentStorageError(\n \"run_not_found\",\n `[${prefix}] Agent run '${create.createdByRunId}' not found for project '${create.projectId}'.`\n )\n }\n if (!thread) {\n throw new AgentStorageError(\n \"thread_not_found\",\n `[${prefix}] Agent thread '${create.threadId}' not found for project '${create.projectId}'.`\n )\n }\n if (run.threadId !== create.threadId) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent run '${run.id}' does not belong to thread '${create.threadId}'.`\n )\n }\n if (run.status !== \"running\") {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent run '${run.id}' is not running (status '${run.status}').`\n )\n }\n if (!run.execution || run.execution.token !== create.executionToken) {\n throw new AgentStorageError(\n \"execution_lost\",\n `[${prefix}] Execution token is no longer current on agent run '${run.id}'.`\n )\n }\n if (thread.activeRunId !== run.id) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent run '${run.id}' no longer owns thread '${thread.id}'.`\n )\n }\n}\n\n/** Assert both compare-and-swap anchors and the retained-turn boundary. */\nexport function assertAgentContextCheckpointAnchors(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly latest: AgentContextCheckpointRecord | null\n readonly headSeq: number\n readonly firstRetained: AgentMessageRecord | null\n readonly prefix?: string\n}): void {\n const { create, latest, headSeq, firstRetained } = input\n const prefix = input.prefix ?? \"Sixb\"\n if (headSeq !== create.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${create.threadId}' message head changed from ${create.expectedHeadSeq} to ${headSeq}.`\n )\n }\n\n const latestId = latest?.id ?? null\n if (latestId !== create.expectedPreviousCheckpointId) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${create.threadId}' checkpoint head changed.`\n )\n }\n if (latest && create.summarizedThroughSeq <= latest.summarizedThroughSeq) {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint boundary must advance beyond sequence ${latest.summarizedThroughSeq}.`\n )\n }\n if (!firstRetained || firstRetained.seq !== create.summarizedThroughSeq + 1) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent context checkpoint boundary does not align with stored thread messages.`\n )\n }\n if (firstRetained.role !== \"user\") {\n throw new AgentStorageError(\n \"invalid_input\",\n `[${prefix}] Agent context checkpoint must retain a complete turn beginning with a user message.`\n )\n }\n}\n\n/** Validate the mutable anchors again before returning an idempotently created checkpoint. */\nexport function assertAgentContextCheckpointReplayState(input: {\n readonly create: CreateAgentContextCheckpointInput\n readonly existing: AgentContextCheckpointRecord\n readonly latest: AgentContextCheckpointRecord | null\n readonly headSeq: number\n readonly prefix?: string\n}): void {\n const prefix = input.prefix ?? \"Sixb\"\n if (input.headSeq !== input.create.expectedHeadSeq) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${input.create.threadId}' message head changed from ${input.create.expectedHeadSeq} to ${input.headSeq}.`\n )\n }\n if (input.latest?.id !== input.existing.id) {\n throw new AgentStorageError(\n \"invalid_state\",\n `[${prefix}] Agent thread '${input.create.threadId}' checkpoint head changed after '${input.existing.id}'.`\n )\n }\n}\n\n/** Compare the durable semantic payload; delivery token and generated timestamp are not content. */\nexport function agentContextCheckpointMatchesCreateInput(\n record: AgentContextCheckpointRecord,\n input: CreateAgentContextCheckpointInput\n): boolean {\n return (\n record.id === input.id &&\n record.projectId === input.projectId &&\n record.threadId === input.threadId &&\n record.createdByRunId === input.createdByRunId &&\n (record.previousCheckpointId ?? null) === input.expectedPreviousCheckpointId &&\n record.reason === input.reason &&\n record.summary === input.summary &&\n record.summaryFormatVersion === input.summaryFormatVersion &&\n record.summarizedThroughSeq === input.summarizedThroughSeq &&\n record.observedHeadSeq === input.observedHeadSeq &&\n record.estimatedInputTokensBefore === input.estimatedInputTokensBefore &&\n record.estimatedInputTokensAfter === input.estimatedInputTokensAfter &&\n record.summaryModelId === input.summaryModelId\n )\n}\n"
|
|
7
|
-
],
|
|
8
|
-
"mappings": ";;;;;;;;;AAaO,MAAM,0BAA0B,MAAM;AAAA,EAIhC;AAAA,EAHF,OAAO;AAAA,EAEhB,WAAW,CACA,MACT,SACA;AAAA,IACA,MAAM,OAAO;AAAA,IAHJ;AAAA;AAKb;;;ACTA,eAAsB,uBAAuB,CAAC,OAM5B;AAAA,EAChB,MAAM,YAAY,MAAM,sBAAsB;AAAA,IAC5C,YAAY,MAAM;AAAA,IAClB,WAAW,MAAM;AAAA,IACjB,aAAa,MAAM;AAAA,IACnB,OAAO,MAAM;AAAA,IACb,kBAAkB,sBAAsB,MAAM,OAAO;AAAA,EACvD,CAAC;AAAA,EACD,IAAI,CAAC,WAAW;AAAA,IACd,MAAM,IAAI,kBACR,iBACA,qBAAqB,MAAM,8CAA8C,MAAM,SACjF;AAAA,EACF;AAAA;AAIK,SAAS,uCAAuC,CACrD,OACA,SAAS,QACH;AAAA,EACN,YAAY,MAAM,UAAU;AAAA,IAC1B,CAAC,MAAM,MAAM,EAAE;AAAA,IACf,CAAC,aAAa,MAAM,SAAS;AAAA,IAC7B,CAAC,YAAY,MAAM,QAAQ;AAAA,IAC3B,CAAC,kBAAkB,MAAM,cAAc;AAAA,IACvC,CAAC,kBAAkB,MAAM,cAAc;AAAA,IACvC,CAAC,WAAW,MAAM,OAAO;AAAA,IACzB,CAAC,kBAAkB,MAAM,cAAc;AAAA,EACzC,GAAY;AAAA,IACV,IAAI,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Id": "C4E16AF3EE9252A464756E2164756E21",
|
|
10
|
-
"names": []
|
|
11
|
-
}
|
package/dist/chunk-4gz41why.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
isRecord,
|
|
4
|
-
validateSchemaValue
|
|
5
|
-
} from "./chunk-rnshztfq.js";
|
|
6
|
-
import {
|
|
7
|
-
OntologyValidationError
|
|
8
|
-
} from "./chunk-dktq02ne.js";
|
|
9
|
-
|
|
10
|
-
// src/ontology/refs.ts
|
|
11
|
-
function ref(objectType) {
|
|
12
|
-
return {
|
|
13
|
-
type: "objectRef",
|
|
14
|
-
objectTypeId: objectType.id
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function isObjectRefSchema(schema) {
|
|
18
|
-
return typeof schema === "object" && schema !== null && schema.type === "objectRef";
|
|
19
|
-
}
|
|
20
|
-
function validateSchemaOrRefValue(schema, value, path, valueTypesById) {
|
|
21
|
-
if (isObjectRefSchema(schema)) {
|
|
22
|
-
validateObjectRefValue(schema, value, path);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
validateSchemaValue(schema, value, path, valueTypesById);
|
|
26
|
-
}
|
|
27
|
-
function validateObjectRefValue(schema, value, path) {
|
|
28
|
-
if (!isRecord(value)) {
|
|
29
|
-
throw new OntologyValidationError(`[Sixb] Property ${path} must be an objectRef`);
|
|
30
|
-
}
|
|
31
|
-
const allowedFields = new Set(["objectTypeId", "primaryId"]);
|
|
32
|
-
for (const fieldId of Object.keys(value)) {
|
|
33
|
-
if (!allowedFields.has(fieldId)) {
|
|
34
|
-
throw new OntologyValidationError(`[Sixb] Unknown field '${path}.${fieldId}'`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (value.objectTypeId !== schema.objectTypeId) {
|
|
38
|
-
throw new OntologyValidationError(`[Sixb] Property ${path}.objectTypeId must be "${schema.objectTypeId}"`);
|
|
39
|
-
}
|
|
40
|
-
if (typeof value.primaryId !== "string") {
|
|
41
|
-
throw new OntologyValidationError(`[Sixb] Property ${path}.primaryId must be a string`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// src/ontology/tokens.ts
|
|
46
|
-
function createPropertyTokenMap(objectType) {
|
|
47
|
-
const tokenEntries = objectType.properties.map((property) => {
|
|
48
|
-
const token = {
|
|
49
|
-
objectTypeId: objectType.id,
|
|
50
|
-
id: property.id,
|
|
51
|
-
property
|
|
52
|
-
};
|
|
53
|
-
return [property.id, token];
|
|
54
|
-
});
|
|
55
|
-
return Object.fromEntries(tokenEntries);
|
|
56
|
-
}
|
|
57
|
-
function createLinkTokenMap(objectType) {
|
|
58
|
-
const tokenEntries = objectType.links.map((link) => {
|
|
59
|
-
const token = {
|
|
60
|
-
objectTypeId: objectType.id,
|
|
61
|
-
id: link.id,
|
|
62
|
-
targetObjectTypeId: link.targetObjectTypeId,
|
|
63
|
-
link
|
|
64
|
-
};
|
|
65
|
-
return [link.id, token];
|
|
66
|
-
});
|
|
67
|
-
return Object.fromEntries(tokenEntries);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { ref, isObjectRefSchema, validateSchemaOrRefValue, createPropertyTokenMap, createLinkTokenMap };
|
|
71
|
-
|
|
72
|
-
//# debugId=912178D6A694401B64756E2164756E21
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/ontology/refs.ts", "../src/ontology/tokens.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { OntologyValidationError } from \"./errors\"\nimport type { InferSchema } from \"./inference\"\nimport type { ObjectType, Schema, ValueType } from \"./types\"\nimport { isRecord, validateSchemaValue } from \"./validation\"\n\nexport type ObjectRef<TObjectTypeId extends string = string> = {\n objectTypeId: TObjectTypeId\n primaryId: string\n}\n\nexport interface ObjectRefSchema<TObjectTypeId extends string = string> {\n readonly type: \"objectRef\"\n readonly objectTypeId: TObjectTypeId\n}\n\nexport type SchemaOrRef = Schema | ObjectRefSchema\n\nexport type InferSchemaOrRef<\n TSchema extends SchemaOrRef,\n TValueTypes extends readonly ValueType[] = [],\n> =\n TSchema extends ObjectRefSchema<infer TObjectTypeId>\n ? ObjectRef<TObjectTypeId>\n : TSchema extends Schema\n ? InferSchema<TSchema, TValueTypes>\n : never\n\nexport function ref<const TObjectType extends ObjectType>(\n objectType: TObjectType\n): ObjectRefSchema<TObjectType[\"id\"]> {\n return {\n type: \"objectRef\",\n objectTypeId: objectType.id,\n }\n}\n\nexport function isObjectRefSchema(schema: SchemaOrRef): schema is ObjectRefSchema {\n return (\n typeof schema === \"object\" &&\n schema !== null &&\n (schema as { type?: unknown }).type === \"objectRef\"\n )\n}\n\nexport function validateSchemaOrRefValue(\n schema: SchemaOrRef,\n value: unknown,\n path: string,\n valueTypesById: ReadonlyMap<string, ValueType>\n): void {\n if (isObjectRefSchema(schema)) {\n validateObjectRefValue(schema, value, path)\n return\n }\n\n validateSchemaValue(schema, value, path, valueTypesById)\n}\n\nfunction validateObjectRefValue(schema: ObjectRefSchema, value: unknown, path: string): void {\n if (!isRecord(value)) {\n throw new OntologyValidationError(`[Sixb] Property ${path} must be an objectRef`)\n }\n\n const allowedFields = new Set([\"objectTypeId\", \"primaryId\"])\n for (const fieldId of Object.keys(value)) {\n if (!allowedFields.has(fieldId)) {\n throw new OntologyValidationError(`[Sixb] Unknown field '${path}.${fieldId}'`)\n }\n }\n\n if (value.objectTypeId !== schema.objectTypeId) {\n throw new OntologyValidationError(\n `[Sixb] Property ${path}.objectTypeId must be \"${schema.objectTypeId}\"`\n )\n }\n\n if (typeof value.primaryId !== \"string\") {\n throw new OntologyValidationError(`[Sixb] Property ${path}.primaryId must be a string`)\n }\n}\n",
|
|
6
|
-
"import type { ObjectLink, ObjectType, Property } from \"./types\"\n\ndeclare const propertyTokenBrand: unique symbol\ndeclare const linkTokenBrand: unique symbol\n\n/**\n * Strongly-typed handle to a property on a specific object type.\n *\n * Tokens let runtime APIs accept object properties without using string ids.\n */\nexport type PropertyToken<\n TObjectTypeId extends string = string,\n TPropertyId extends string = string,\n TProperty extends Property = Property,\n> = {\n readonly [propertyTokenBrand]?: never\n readonly objectTypeId: TObjectTypeId\n readonly id: TPropertyId\n readonly property: TProperty\n}\n\nexport type PropertyTokenMap<TObjectType extends ObjectType> = {\n readonly [P in TObjectType[\"properties\"][number] as P[\"id\"]]: PropertyToken<\n TObjectType[\"id\"],\n P[\"id\"],\n P\n >\n}\n\nexport type LinkToken<\n TObjectTypeId extends string = string,\n TLinkId extends string = string,\n TTargetObjectTypeId extends string | readonly string[] = string | readonly string[],\n TLink extends ObjectLink = ObjectLink,\n> = {\n readonly [linkTokenBrand]?: never\n readonly objectTypeId: TObjectTypeId\n readonly id: TLinkId\n readonly targetObjectTypeId: TTargetObjectTypeId\n readonly link: TLink\n}\n\nexport type LinkTokenMap<TObjectType extends ObjectType> = {\n readonly [L in TObjectType[\"links\"][number] as L[\"id\"]]: LinkToken<\n TObjectType[\"id\"],\n L[\"id\"],\n L[\"targetObjectTypeId\"],\n L\n >\n}\n\n/**\n * Object type with property tokens (`p.*`).\n *\n * The original ontology shape is preserved; this only adds typed handles.\n */\nexport type ObjectTypeWithPropertyTokens<TObjectType extends ObjectType = ObjectType> =\n TObjectType & {\n readonly p: PropertyTokenMap<TObjectType>\n }\n\n/**\n * Object type with property tokens (`p.*`) and link tokens (`l.*`).\n *\n * `links` is a plain array for iteration.\n * `l` provides keyed token access (`Room.l.hasThermostat`).\n */\nexport type ObjectTypeWithTokens<TObjectType extends ObjectType = ObjectType> =\n ObjectTypeWithPropertyTokens<TObjectType> & {\n readonly l: LinkTokenMap<TObjectType>\n }\n\n/**\n * Build the `objectType.p.*` token map once when the object type is defined.\n */\nexport function createPropertyTokenMap<TObjectType extends ObjectType>(\n objectType: TObjectType\n): PropertyTokenMap<TObjectType> {\n const tokenEntries = objectType.properties.map((property) => {\n const token: PropertyToken<TObjectType[\"id\"], typeof property.id, typeof property> = {\n objectTypeId: objectType.id,\n id: property.id,\n property,\n }\n return [property.id, token] as const\n })\n\n return Object.fromEntries(tokenEntries) as PropertyTokenMap<TObjectType>\n}\n\n/**\n * Build the `objectType.l.*` link token map once when the object type is defined.\n */\nexport function createLinkTokenMap<TObjectType extends ObjectType>(\n objectType: TObjectType\n): LinkTokenMap<TObjectType> {\n const tokenEntries = objectType.links.map((link) => {\n const token: LinkToken<\n TObjectType[\"id\"],\n typeof link.id,\n typeof link.targetObjectTypeId,\n typeof link\n > = {\n objectTypeId: objectType.id,\n id: link.id,\n targetObjectTypeId: link.targetObjectTypeId,\n link,\n }\n return [link.id, token] as const\n })\n\n return Object.fromEntries(tokenEntries) as LinkTokenMap<TObjectType>\n}\n"
|
|
7
|
-
],
|
|
8
|
-
"mappings": ";;;;;;;;;;AA2BO,SAAS,GAAyC,CACvD,YACoC;AAAA,EACpC,OAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc,WAAW;AAAA,EAC3B;AAAA;AAGK,SAAS,iBAAiB,CAAC,QAAgD;AAAA,EAChF,OACE,OAAO,WAAW,YAClB,WAAW,QACV,OAA8B,SAAS;AAAA;AAIrC,SAAS,wBAAwB,CACtC,QACA,OACA,MACA,gBACM;AAAA,EACN,IAAI,kBAAkB,MAAM,GAAG;AAAA,IAC7B,uBAAuB,QAAQ,OAAO,IAAI;AAAA,IAC1C;AAAA,EACF;AAAA,EAEA,oBAAoB,QAAQ,OAAO,MAAM,cAAc;AAAA;AAGzD,SAAS,sBAAsB,CAAC,QAAyB,OAAgB,MAAoB;AAAA,EAC3F,IAAI,CAAC,SAAS,KAAK,GAAG;AAAA,IACpB,MAAM,IAAI,wBAAwB,mBAAmB,2BAA2B;AAAA,EAClF;AAAA,EAEA,MAAM,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,WAAW,CAAC;AAAA,EAC3D,WAAW,WAAW,OAAO,KAAK,KAAK,GAAG;AAAA,IACxC,IAAI,CAAC,cAAc,IAAI,OAAO,GAAG;AAAA,MAC/B,MAAM,IAAI,wBAAwB,yBAAyB,QAAQ,UAAU;AAAA,IAC/E;AAAA,EACF;AAAA,EAEA,IAAI,MAAM,iBAAiB,OAAO,cAAc;AAAA,IAC9C,MAAM,IAAI,wBACR,mBAAmB,8BAA8B,OAAO,eAC1D;AAAA,EACF;AAAA,EAEA,IAAI,OAAO,MAAM,cAAc,UAAU;AAAA,IACvC,MAAM,IAAI,wBAAwB,mBAAmB,iCAAiC;AAAA,EACxF;AAAA;;;ACHK,SAAS,sBAAsD,CACpE,YAC+B;AAAA,EAC/B,MAAM,eAAe,WAAW,WAAW,IAAI,CAAC,aAAa;AAAA,IAC3D,MAAM,QAA+E;AAAA,MACnF,cAAc,WAAW;AAAA,MACzB,IAAI,SAAS;AAAA,MACb;AAAA,IACF;AAAA,IACA,OAAO,CAAC,SAAS,IAAI,KAAK;AAAA,GAC3B;AAAA,EAED,OAAO,OAAO,YAAY,YAAY;AAAA;AAMjC,SAAS,kBAAkD,CAChE,YAC2B;AAAA,EAC3B,MAAM,eAAe,WAAW,MAAM,IAAI,CAAC,SAAS;AAAA,IAClD,MAAM,QAKF;AAAA,MACF,cAAc,WAAW;AAAA,MACzB,IAAI,KAAK;AAAA,MACT,oBAAoB,KAAK;AAAA,MACzB;AAAA,IACF;AAAA,IACA,OAAO,CAAC,KAAK,IAAI,KAAK;AAAA,GACvB;AAAA,EAED,OAAO,OAAO,YAAY,YAAY;AAAA;",
|
|
9
|
-
"debugId": "912178D6A694401B64756E2164756E21",
|
|
10
|
-
"names": []
|
|
11
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/objects/action/request.ts", "../src/objects/errors.ts", "../src/objects/materializer-adapter.ts", "../src/objects/link/authorization.ts", "../src/objects/link/remove.ts", "../src/objects/link/endpoints.ts", "../src/objects/link/upsert.ts", "../src/objects/runtime-batch.ts", "../src/objects/link/upsert-batch.ts", "../src/objects/object/delete.ts", "../src/objects/object/upsert.ts", "../src/objects/object/upsert-batch.ts", "../src/objects/telemetry/write-batch.ts", "../src/objects/telemetry/append-batch.ts", "../src/objects/telemetry/history.ts", "../src/objects/context/resolve.ts", "../src/objects/sdk/telemetry-channel.ts", "../src/objects/sdk/object-handle.ts", "../src/objects/sdk/runtime-query-executor.ts", "../src/objects/sdk/object-set.ts", "../src/objects/service/action-service.ts", "../src/objects/service/link-service.ts", "../src/objects/service/list-service.ts", "../src/objects/service/object-service.ts", "../src/objects/service/telemetry-service.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Compatibility leaf operation: request an action on an object.\n *\n * The canonical action request path lives in `actions/request.ts`; object-bound\n * helpers delegate here by supplying an object subject.\n */\nimport {\n type RequestActionAndWaitOptions,\n type RequestActionOptions,\n type RequestActionResult,\n requestAction as requestRuntimeAction,\n requestActionAndWait as requestRuntimeActionAndWait,\n} from \"../../actions/request\"\nimport type { ActionRunRecord } from \"../../storage\"\nimport type { ExecutionObjectContext } from \"../context\"\n\nexport type { RequestActionAndWaitOptions, RequestActionOptions }\n\nexport async function requestAction(\n ctx: ExecutionObjectContext,\n params: {\n primaryId: string\n actionId: string\n params?: Record<string, unknown>\n options?: RequestActionOptions\n }\n): Promise<RequestActionResult> {\n return requestRuntimeAction(ctx, ctx.execution, {\n actionId: params.actionId,\n subject: {\n kind: \"object\",\n objectTypeId: ctx.objectType.id,\n primaryId: params.primaryId,\n },\n params: params.params,\n runId: params.options?.runId,\n signal: params.options?.signal,\n })\n}\n\nexport async function requestActionAndWait(\n ctx: ExecutionObjectContext,\n params: {\n primaryId: string\n actionId: string\n params?: Record<string, unknown>\n options?: RequestActionAndWaitOptions\n }\n): Promise<ActionRunRecord> {\n return requestRuntimeActionAndWait(ctx, ctx.execution, {\n actionId: params.actionId,\n subject: {\n kind: \"object\",\n objectTypeId: ctx.objectType.id,\n primaryId: params.primaryId,\n },\n params: params.params,\n runId: params.options?.runId,\n timeoutMs: params.options?.timeoutMs,\n signal: params.options?.signal,\n onRequested: params.options?.onRequested,\n })\n}\n",
|
|
6
|
-
"/**\n * Error for runtime invariants and failures specific to the objects module\n * (e.g., unexpected event results after appending an object/link event).\n */\nexport class ObjectError extends Error {\n readonly name = \"ObjectError\"\n}\n",
|
|
7
|
-
"/**\n * Runtime translation onto the ontology Materializer.\n *\n * Every typed and dynamic object/link mutation lowers to canonical Materializer operations here and\n * every Materializer result is mapped back to the public runtime shapes. The adapter owns no\n * ontology semantics: authority classification, effective resolution, validation, and event\n * construction all happen inside the Materializer's single commit.\n */\n\nimport { randomUUID } from \"node:crypto\"\nimport type { JsonValue } from \"../json\"\nimport type {\n EditCommitResult,\n EffectiveObjectSnapshot,\n MaterializationItemError,\n OntologyEditOperation,\n OntologyLinkRef,\n OntologyObjectRef,\n OntologyOperationOutcome,\n} from \"../materialization/model\"\nimport { normalizeJsonProperties } from \"../materializer\"\nimport type { ObjectLink, ValueType } from \"../ontology\"\nimport { OntologyValidationError } from \"../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport {\n assertKnownProperties,\n assertLinkTargetType,\n normalizeLinkProperties,\n normalizeObjectProperties,\n validateLinkProperties,\n validateObjectProperties,\n} from \"../ontology/validation\"\nimport { getOntologyMutationRuntime } from \"../runtime/ontology-mutations\"\nimport type { SixbRuntimeContext } from \"../runtime/types\"\nimport type { ObjectRow } from \"../storage\"\nimport { ObjectError } from \"./errors\"\n\n/** The runtime pieces one commit needs. */\nexport type RuntimeMaterializerContext = Pick<SixbRuntimeContext, \"projectId\" | \"storage\">\n\n/** One caller-supplied batch item, lowered to the operations it contributes. */\nexport interface RuntimeBatchGroup {\n /** Position in the caller's input array; item errors are reported against it. */\n readonly index: number\n readonly operations: readonly OntologyEditOperation[]\n}\n\nexport interface RuntimeBatchCommit {\n readonly commit: EditCommitResult | null\n /** Outcomes per input position, in the order the item's operations were submitted. */\n readonly outcomes: ReadonlyMap<number, readonly OntologyOperationOutcome[]>\n}\n\n/**\n * Commits ordered operations as one atomic runtime commit.\n *\n * A fresh request id per call keeps each runtime mutation its own commit; the Materializer's\n * idempotency replay then only collapses a retry of the very same request.\n */\nexport async function commitRuntimeOperations(\n ctx: RuntimeMaterializerContext,\n operations: readonly OntologyEditOperation[]\n): Promise<EditCommitResult> {\n const mutations = getOntologyMutationRuntime(ctx)\n const commit = await mutations.commitEdits({\n mode: \"atomic\",\n source: { kind: \"runtime\", requestId: randomUUID() },\n operations,\n expectedObjects: [],\n expectedLinks: [],\n expectedLinkScopes: [],\n })\n return commit\n}\n\n/**\n * Commits grouped batch operations as one ordered continue-mode transaction.\n *\n * Successful items apply against one evolving authority state while semantic failures are recorded\n * per item. Provider, serialization, and CAS failures still roll the whole transaction back.\n *\n * An item that lowers to several operations is declared as one operation group so the Materializer\n * rolls the whole item back rather than committing the operations that ran before the failure.\n */\nexport async function commitRuntimeBatch(\n ctx: RuntimeMaterializerContext,\n groups: readonly RuntimeBatchGroup[]\n): Promise<RuntimeBatchCommit> {\n const operations = groups.flatMap((group) => group.operations)\n if (operations.length === 0) {\n return { commit: null, outcomes: new Map() }\n }\n\n const operationGroups = groups\n .filter((group) => group.operations.length > 1)\n .map((group) => group.operations.map((operation) => operation.id))\n\n const mutations = getOntologyMutationRuntime(ctx)\n const commit = await mutations.commitEdits({\n mode: \"continue\",\n source: { kind: \"runtime\", requestId: randomUUID() },\n operations,\n ...(operationGroups.length > 0 ? { operationGroups } : {}),\n })\n\n const byId = new Map(commit.outcomes.map((outcome) => [outcome.id, outcome]))\n const outcomes = new Map<number, readonly OntologyOperationOutcome[]>()\n for (const group of groups) {\n outcomes.set(\n group.index,\n group.operations.map((operation) => requireOutcome(byId, operation.id))\n )\n }\n return { commit, outcomes }\n}\n\n/**\n * Assigns the canonical operation id for one batch item.\n *\n * Ids derive from the caller's original ordinal so outcomes map back to input positions even when\n * earlier items failed local validation and never reached the Materializer.\n */\nexport function runtimeOperationId(index: number, subOrdinal = 0): string {\n return subOrdinal === 0 ? `op:${index}` : `op:${index}.${subOrdinal}`\n}\n\nexport interface NormalizedRuntimeObject {\n readonly primaryId: string\n /** Managed authority values; identity lives in the object ref, never in the properties. */\n readonly properties: Readonly<Record<string, JsonValue>>\n}\n\n/**\n * Validates and normalizes one runtime object input at the SDK/service boundary.\n *\n * Shape and value-type errors surface here so a batch can report them against the caller's original\n * position. Authority classification, required-property enforcement, and cardinality stay in the\n * Materializer, which validates the resolved effective object instead of the request.\n */\nexport function normalizeRuntimeObject(input: {\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly primaryPropertyId: string\n readonly properties: Record<string, unknown>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n}): NormalizedRuntimeObject {\n const { objectType, primaryPropertyId, properties, valueTypesById } = input\n assertKnownProperties(objectType, properties)\n validateObjectProperties(objectType, properties, valueTypesById)\n\n const primaryValue = properties[primaryPropertyId]\n if (primaryValue === undefined || primaryValue === null) {\n throw new OntologyValidationError(\n `[Sixb] Missing primary property '${primaryPropertyId}' in upsert for '${objectType.id}'`\n )\n }\n\n const normalized = normalizeObjectProperties(\n objectType.properties,\n properties,\n valueTypesById,\n objectType.id\n )\n const { [primaryPropertyId]: _identity, ...managed } = normalized\n return {\n primaryId: String(primaryValue),\n properties: normalizeJsonProperties(managed, `${objectType.id} properties`),\n }\n}\n\n/**\n * Validates and normalizes one runtime link input.\n *\n * Managed link authority carries the complete property set, so required link properties must be\n * present in the request rather than inherited from the stored edge.\n */\nexport function normalizeRuntimeLink(input: {\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly linkDefinition: ObjectLink\n readonly linkId: string\n readonly targetTypeId: string\n readonly properties?: Record<string, unknown>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n readonly isValidLinkTarget: (expected: string | string[], actual: string) => boolean\n}): Readonly<Record<string, JsonValue>> | undefined {\n const { objectType, linkDefinition, linkId, targetTypeId, properties, valueTypesById } = input\n assertLinkTargetType(objectType.id, linkId, linkDefinition, targetTypeId, input.isValidLinkTarget)\n validateLinkProperties(objectType, linkDefinition, properties, undefined, valueTypesById)\n const normalized = normalizeLinkProperties(objectType, linkDefinition, properties, valueTypesById)\n if (normalized === undefined) return undefined\n return normalizeJsonProperties(normalized, `${objectType.id}.${linkId} properties`)\n}\n\nexport function objectUpsertOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n readonly properties: Readonly<Record<string, JsonValue>>\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.upsert\", ref: input.ref, properties: input.properties }\n}\n\nexport function objectDeleteOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.delete\", ref: input.ref }\n}\n\nexport function objectRestoreOperation(input: {\n readonly id: string\n readonly ref: OntologyObjectRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"object.restore\", ref: input.ref }\n}\n\nexport function linkUpsertOperation(input: {\n readonly id: string\n readonly ref: OntologyLinkRef\n readonly properties?: Readonly<Record<string, JsonValue>>\n}): OntologyEditOperation {\n return {\n id: input.id,\n kind: \"link.upsert\",\n ref: input.ref,\n ...(input.properties !== undefined ? { properties: input.properties } : {}),\n }\n}\n\nexport function linkDeleteOperation(input: {\n readonly id: string\n readonly ref: OntologyLinkRef\n}): OntologyEditOperation {\n return { id: input.id, kind: \"link.delete\", ref: input.ref }\n}\n\n/** Reads the outcomes one batch item produced; the commit returns one per submitted operation. */\nexport function requireItemOutcomes(\n commit: RuntimeBatchCommit,\n index: number\n): readonly OntologyOperationOutcome[] {\n const outcomes = commit.outcomes.get(index)\n if (!outcomes || outcomes.length === 0) {\n throw new ObjectError(`[Sixb] Materializer returned no outcome for batch item ${index}.`)\n }\n return outcomes\n}\n\n/** Reads the effective object an ok outcome produced; runtime object writes always resolve one. */\nexport function requireEffectiveObject(outcome: OntologyOperationOutcome): EffectiveObjectSnapshot {\n if (!outcome.ok || !outcome.object) {\n throw new ObjectError(`[Sixb] Materializer returned no effective object for '${outcome.id}'.`)\n }\n return outcome.object\n}\n\nexport function toObjectRow(projectId: string, snapshot: EffectiveObjectSnapshot): ObjectRow {\n return {\n projectId,\n objectTypeId: snapshot.ref.objectTypeId,\n primaryId: snapshot.ref.primaryId,\n properties: structuredClone(snapshot.properties) as Record<string, unknown>,\n createdAt: new Date(snapshot.createdAt),\n updatedAt: new Date(snapshot.updatedAt),\n version: snapshot.version,\n lastCommitId: snapshot.lastCommitId,\n }\n}\n\n/** Rehydrates a persisted item error into the public runtime error type. */\nexport function toItemError(error: MaterializationItemError): Error {\n switch (error.code) {\n case \"validation\":\n return new OntologyValidationError(error.message)\n }\n}\n\nfunction requireOutcome(\n outcomes: ReadonlyMap<string, OntologyOperationOutcome>,\n id: string\n): OntologyOperationOutcome {\n const outcome = outcomes.get(id)\n if (!outcome) {\n throw new ObjectError(`[Sixb] Materializer returned no outcome for '${id}'.`)\n }\n return outcome\n}\n",
|
|
8
|
-
"/**\n * The authorization rule for writing a link, in one place because all three link leaves need it.\n */\nimport { type AuthorizationContext, assertAuthorized, assertCanEdit } from \"../../authorization\"\n\n/**\n * Assert a principal may create or remove a link.\n *\n * `edit` on the **source** type, `view` on the **target**: a link is declared on the source type\n * (`objectType.links`), and writing one changes the source's edges, not the target's properties.\n * Requiring `edit` on the target too would mean a clerk needs write access to every customer before\n * attaching an invoice to one.\n *\n * `view` on the target is still required, and for two reasons: it matches how links are *read* —\n * `canViewLink` already demands `view` on both endpoints — and without it the endpoint-existence\n * check that follows would answer whether a target the principal cannot see exists.\n *\n * Call this *before* any endpoint lookup, for that second reason.\n */\nexport function assertCanWriteLink(\n ctx: { readonly authorization?: AuthorizationContext },\n endpoints: { readonly sourceTypeId: string; readonly targetTypeId: string }\n): void {\n assertCanEdit(ctx, endpoints.sourceTypeId)\n assertAuthorized(ctx, { kind: \"object.view\", objectTypeId: endpoints.targetTypeId })\n}\n",
|
|
9
|
-
"/**\n * Leaf operation: remove a single link through the ontology Materializer.\n */\nimport { assertLinkTargetType } from \"../../ontology/validation\"\nimport type { ResolvedLinkContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n linkDeleteOperation,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { assertCanWriteLink } from \"./authorization\"\n\nexport async function removeLink(\n ctx: ResolvedLinkContext,\n params: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n }\n): Promise<void> {\n const { objectType, linkDefinition, ontology } = ctx\n const { sourceId, linkId, targetTypeId, targetId } = params\n assertCanWriteLink(ctx, { sourceTypeId: objectType.id, targetTypeId })\n\n assertLinkTargetType(objectType.id, linkId, linkDefinition, targetTypeId, (expected, actual) =>\n ontology.isValidLinkTarget(expected, actual)\n )\n\n // A missing link is a no-op: the delete records managed authority only when an effective edge\n // exists, so the commit reports `unchanged` instead of failing.\n await commitRuntimeOperations(ctx, [\n linkDeleteOperation({\n id: runtimeOperationId(0),\n ref: {\n source: { objectTypeId: objectType.id, primaryId: sourceId },\n linkId,\n target: { objectTypeId: targetTypeId, primaryId: targetId },\n },\n }),\n ])\n}\n",
|
|
10
|
-
"/**\n * Shared endpoint existence reads for runtime link batches.\n *\n * The Materializer independently refuses a link whose endpoints are not effective. These reads exist\n * only so batch callers keep receiving the public {@link ObjectNotFoundError} for a missing endpoint\n * instead of a generic per-item validation error.\n */\n\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport { objectBatchKey } from \"../../storage\"\nimport { ObjectNotFoundError } from \"../../storage/errors\"\n\nexport interface LinkEndpointItem {\n readonly objectType: { readonly id: string }\n readonly sourceId: string\n readonly targetTypeId: string\n readonly targetId: string\n}\n\nexport type EndpointExistence = ReadonlySet<string>\n\nexport function collectEndpointLookups(\n items: readonly LinkEndpointItem[]\n): { objectTypeId: string; primaryId: string }[] {\n const lookups: { objectTypeId: string; primaryId: string }[] = []\n const seen = new Set<string>()\n\n for (const item of items) {\n for (const endpoint of [\n { objectTypeId: item.objectType.id, primaryId: item.sourceId },\n { objectTypeId: item.targetTypeId, primaryId: item.targetId },\n ]) {\n const key = endpointKey(endpoint.objectTypeId, endpoint.primaryId)\n if (seen.has(key)) continue\n seen.add(key)\n lookups.push(endpoint)\n }\n }\n\n return lookups\n}\n\nexport async function loadEndpointExistence(\n ctx: Pick<SixbRuntimeContext, \"projectId\" | \"storage\">,\n lookups: readonly { objectTypeId: string; primaryId: string }[]\n): Promise<EndpointExistence> {\n if (lookups.length === 0) return new Set()\n const rows = await ctx.storage.objects.getByPrimaryIdBatch({\n projectId: ctx.projectId,\n items: lookups,\n })\n return new Set(rows.keys())\n}\n\n/** Throws {@link ObjectNotFoundError} for the first endpoint the read did not find. */\nexport function requireEndpoints(item: LinkEndpointItem, existing: EndpointExistence): void {\n if (!existing.has(endpointKey(item.objectType.id, item.sourceId))) {\n throw new ObjectNotFoundError(item.objectType.id, item.sourceId, \"Source object not found\")\n }\n if (!existing.has(endpointKey(item.targetTypeId, item.targetId))) {\n throw new ObjectNotFoundError(item.targetTypeId, item.targetId, \"Target object not found\")\n }\n}\n\nfunction endpointKey(objectTypeId: string, primaryId: string): string {\n return objectBatchKey(objectTypeId, primaryId)\n}\n",
|
|
11
|
-
"/**\n * Leaf operation: upsert a single link through the ontology Materializer.\n */\nimport type { ResolvedLinkContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n linkUpsertOperation,\n normalizeRuntimeLink,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { assertCanWriteLink } from \"./authorization\"\nimport { collectEndpointLookups, loadEndpointExistence, requireEndpoints } from \"./endpoints\"\n\nexport async function upsertLink(\n ctx: ResolvedLinkContext,\n params: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n properties?: Record<string, unknown>\n }\n): Promise<void> {\n const { objectType, linkDefinition, ontology } = ctx\n const { sourceId, linkId, targetTypeId, targetId, properties } = params\n assertCanWriteLink(ctx, { sourceTypeId: objectType.id, targetTypeId })\n const endpoints = { objectType, sourceId, targetTypeId, targetId }\n\n // Endpoint reads keep the public `ObjectNotFoundError` contract; the Materializer independently\n // refuses a link whose endpoints are not effective when it commits. This runs before property\n // normalization so the same input reports the same error class here and through the batch APIs,\n // which check endpoints first inside `plan`.\n requireEndpoints(endpoints, await loadEndpointExistence(ctx, collectEndpointLookups([endpoints])))\n\n const normalizedProperties = normalizeRuntimeLink({\n objectType,\n linkDefinition,\n linkId,\n targetTypeId,\n properties,\n valueTypesById: ontology.getValueTypesById(),\n isValidLinkTarget: (expected, actual) => ontology.isValidLinkTarget(expected, actual),\n })\n\n await commitRuntimeOperations(ctx, [\n linkUpsertOperation({\n id: runtimeOperationId(0),\n ref: {\n source: { objectTypeId: objectType.id, primaryId: sourceId },\n linkId,\n target: { objectTypeId: targetTypeId, primaryId: targetId },\n },\n ...(normalizedProperties !== undefined ? { properties: normalizedProperties } : {}),\n }),\n ])\n}\n",
|
|
12
|
-
"/**\n * Per-item mechanics shared by every runtime batch.\n *\n * One place owns the rules the public batch APIs promise: a local failure stays at its own input\n * position, an identical repeat collapses onto the first item and shares its result, a conflicting\n * repeat is rejected, and each item's Materializer outcomes map back to the position they came from.\n */\n\nimport type { OntologyEditOperation, OntologyOperationOutcome } from \"../materialization/model\"\nimport { OntologyValidationError } from \"../ontology/errors\"\nimport type { BatchItemResult } from \"../runtime/types\"\nimport {\n commitRuntimeBatch,\n type RuntimeMaterializerContext,\n requireItemOutcomes,\n toItemError,\n} from \"./materializer-adapter\"\n\nexport interface RuntimeBatchItemPlan {\n /** Identity this item claims. A later item claiming it must be identical. */\n readonly key: string\n /** How that identity reads in an error message, e.g. `object 'room:r1'`. */\n readonly label: string\n /** Canonical content, so an identical repeat is recognized as one. */\n readonly fingerprint: string\n readonly operations: readonly OntologyEditOperation[]\n}\n\nexport interface RuntimeItemBatch<TItem, TValue> {\n readonly ctx: RuntimeMaterializerContext\n readonly items: readonly TItem[]\n /** Lowers one item, throwing to record a local failure at that item's position. */\n plan(item: TItem, index: number): RuntimeBatchItemPlan\n /** Maps the outcomes of a fully successful item to its public value. */\n value(outcomes: readonly OntologyOperationOutcome[]): TValue\n}\n\ninterface PlannedItem {\n readonly index: number\n readonly operations: readonly OntologyEditOperation[]\n}\n\ninterface ClaimedIdentity {\n readonly index: number\n readonly fingerprint: string\n}\n\nexport async function runRuntimeItemBatch<TItem, TValue>(\n batch: RuntimeItemBatch<TItem, TValue>\n): Promise<readonly BatchItemResult<TValue>[]> {\n const { items } = batch\n if (items.length === 0) return []\n\n const results: BatchItemResult<TValue>[] = new Array(items.length)\n const planned: PlannedItem[] = []\n const claims = new Map<string, ClaimedIdentity>()\n /** Positions that repeat an earlier identical item and share its result. */\n const aliases = new Map<number, number>()\n\n for (const [index, item] of items.entries()) {\n let plan: RuntimeBatchItemPlan\n try {\n plan = batch.plan(item, index)\n } catch (error) {\n results[index] = {\n ok: false,\n error: error instanceof Error ? error : new Error(String(error)),\n }\n continue\n }\n\n const claimed = claims.get(plan.key)\n if (claimed) {\n if (claimed.fingerprint !== plan.fingerprint) {\n results[index] = {\n ok: false,\n error: new OntologyValidationError(\n `[Sixb] Conflicting duplicate ${plan.label} at batch positions ${claimed.index} and ${index}`\n ),\n }\n continue\n }\n aliases.set(index, claimed.index)\n continue\n }\n\n claims.set(plan.key, { index, fingerprint: plan.fingerprint })\n planned.push({ index, operations: plan.operations })\n }\n\n const commit = await commitRuntimeBatch(batch.ctx, planned)\n\n for (const { index } of planned) {\n const outcomes = requireItemOutcomes(commit, index)\n const failed = outcomes.find((outcome) => !outcome.ok)\n results[index] =\n failed?.ok === false\n ? { ok: false, error: toItemError(failed.error) }\n : { ok: true, value: batch.value(outcomes) }\n }\n for (const [index, source] of aliases) {\n results[index] = results[source]\n }\n return results\n}\n",
|
|
13
|
-
"/**\n * Leaf operation: batch upsert links through the ontology Materializer.\n *\n * Takes SixbRuntimeContext (shared infra) + per-item pre-resolved data, because each item can target\n * a different objectType + linkDefinition. Everything valid is submitted as one ordered\n * continue-mode commit.\n */\n\nimport { stableJsonStringify } from \"../../json\"\nimport { linkRefKey } from \"../../materialization/refs\"\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkBatchItem } from \"../context\"\nimport {\n linkUpsertOperation,\n normalizeRuntimeLink,\n runtimeOperationId,\n} from \"../materializer-adapter\"\nimport { runRuntimeItemBatch } from \"../runtime-batch\"\nimport { assertCanWriteLink } from \"./authorization\"\nimport { collectEndpointLookups, loadEndpointExistence, requireEndpoints } from \"./endpoints\"\n\nexport async function upsertLinkBatch(\n ctx: SixbRuntimeContext,\n items: readonly ResolvedLinkBatchItem[]\n): Promise<readonly BatchItemResult<void>[]> {\n const { ontology } = ctx\n if (items.length === 0) return []\n\n // Every item, up front, and before the endpoint lookup below. Authorization is a precondition, not\n // a per-item validation: a refused item must not become one failed `BatchItemResult` while the\n // rest of the batch commits. Asserting inside `plan` would do exactly that, and would also let the\n // existence lookup answer for targets the principal cannot see.\n for (const item of items) {\n assertCanWriteLink(ctx, {\n sourceTypeId: item.objectType.id,\n targetTypeId: item.targetTypeId,\n })\n }\n\n const existing = await loadEndpointExistence(ctx, collectEndpointLookups(items))\n const valueTypesById = ontology.getValueTypesById()\n\n return runRuntimeItemBatch({\n ctx,\n items,\n plan(item, index) {\n requireEndpoints(item, existing)\n const properties = normalizeRuntimeLink({\n objectType: item.objectType,\n linkDefinition: item.linkDefinition,\n linkId: item.linkId,\n targetTypeId: item.targetTypeId,\n properties: item.properties,\n valueTypesById,\n isValidLinkTarget: (expected, actual) => ontology.isValidLinkTarget(expected, actual),\n })\n const ref = {\n source: { objectTypeId: item.objectType.id, primaryId: item.sourceId },\n linkId: item.linkId,\n target: { objectTypeId: item.targetTypeId, primaryId: item.targetId },\n }\n const edge = linkRefKey(ref)\n return {\n key: edge,\n // The key is a JSON array, which is unreadable in the error an operator sees on a failed\n // link projection. Name the edge the way the object path names an object.\n label: `link '${item.objectType.id}:${item.sourceId}.${item.linkId} -> ${item.targetTypeId}:${item.targetId}'`,\n fingerprint: stableJsonStringify(properties ?? null),\n operations: [\n linkUpsertOperation({\n id: runtimeOperationId(index),\n ref,\n ...(properties !== undefined ? { properties } : {}),\n }),\n ],\n }\n },\n value: () => undefined,\n })\n}\n",
|
|
14
|
-
"/**\n * Leaf operations: delete and restore a single object through the ontology Materializer.\n *\n * Both are thin wrappers over one materializer operation, exactly like `removeLink` — the cascade\n * over links and the effective-state bookkeeping happen inside the commit.\n */\nimport { assertCanEdit } from \"../../authorization\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n objectDeleteOperation,\n objectRestoreOperation,\n runtimeOperationId,\n} from \"../materializer-adapter\"\n\n/**\n * Delete the object with this primary id.\n *\n * A missing object is a no-op: the delete records managed authority only where effective state\n * exists, so the commit reports `unchanged` rather than failing. An object a projection also writes\n * stays hidden even while the projection keeps asserting it — `restore()` is what reveals it again.\n */\nexport async function deleteObject(ctx: ResolvedObjectContext, primaryId: string): Promise<void> {\n assertCanEdit(ctx, ctx.objectType.id)\n await commitRuntimeOperations(ctx, [\n objectDeleteOperation({\n id: runtimeOperationId(0),\n ref: { objectTypeId: ctx.objectType.id, primaryId },\n }),\n ])\n}\n\n/**\n * Withdraw a previous delete.\n *\n * For an object written only from code this is a no-op — there is nothing left to reveal, so write it\n * again instead. For an object a projection also writes, it makes the projected state visible again.\n */\nexport async function restoreObject(ctx: ResolvedObjectContext, primaryId: string): Promise<void> {\n assertCanEdit(ctx, ctx.objectType.id)\n await commitRuntimeOperations(ctx, [\n objectRestoreOperation({\n id: runtimeOperationId(0),\n ref: { objectTypeId: ctx.objectType.id, primaryId },\n }),\n ])\n}\n",
|
|
15
|
-
"/**\n * Leaf operation: upsert a single object through the ontology Materializer.\n */\n\nimport { assertCanEdit } from \"../../authorization\"\nimport type { ObjectRow } from \"../../storage\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n commitRuntimeOperations,\n normalizeRuntimeObject,\n objectUpsertOperation,\n requireEffectiveObject,\n runtimeOperationId,\n toObjectRow,\n} from \"../materializer-adapter\"\n\nexport async function upsertObject(\n ctx: ResolvedObjectContext,\n properties: Record<string, unknown>\n): Promise<ObjectRow> {\n assertCanEdit(ctx, ctx.objectType.id)\n const { objectType, primaryPropertyId, ontology } = ctx\n\n const normalized = normalizeRuntimeObject({\n objectType,\n primaryPropertyId,\n properties,\n valueTypesById: ontology.getValueTypesById(),\n })\n const ref = { objectTypeId: objectType.id, primaryId: normalized.primaryId }\n\n // The Materializer classifies this as an independent create, a patch over source authority, or a\n // restore plus patch inside its own transaction.\n const commit = await commitRuntimeOperations(ctx, [\n objectUpsertOperation({ id: runtimeOperationId(0), ref, properties: normalized.properties }),\n ])\n return toObjectRow(ctx.projectId, requireEffectiveObject(commit.outcomes[0]))\n}\n",
|
|
16
|
-
"/**\n * Leaf operation: batch upsert objects of a single type through the ontology Materializer.\n *\n * Everything that survives local normalization is submitted as one ordered continue-mode commit, so\n * later items observe earlier ones and a provider failure rolls the whole batch back.\n */\nimport { assertCanEdit } from \"../../authorization\"\nimport { stableJsonStringify } from \"../../json\"\nimport type { BatchItemResult } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport {\n normalizeRuntimeObject,\n objectUpsertOperation,\n requireEffectiveObject,\n runtimeOperationId,\n toObjectRow,\n} from \"../materializer-adapter\"\nimport { runRuntimeItemBatch } from \"../runtime-batch\"\n\nexport async function upsertObjectBatch(\n ctx: ResolvedObjectContext,\n items: readonly { properties: Record<string, unknown> }[]\n): Promise<readonly BatchItemResult<ObjectRow>[]> {\n assertCanEdit(ctx, ctx.objectType.id)\n const { objectType, primaryPropertyId, ontology } = ctx\n const valueTypesById = ontology.getValueTypesById()\n\n return runRuntimeItemBatch({\n ctx,\n items,\n plan(item, index) {\n const normalized = normalizeRuntimeObject({\n objectType,\n primaryPropertyId,\n properties: item.properties,\n valueTypesById,\n })\n const ref = { objectTypeId: objectType.id, primaryId: normalized.primaryId }\n return {\n // One commit resolves one authority state per object, so two items for the same identity are\n // unambiguous only when they ask for the same thing.\n key: `${ref.objectTypeId}:${ref.primaryId}`,\n label: `object '${ref.objectTypeId}:${ref.primaryId}'`,\n fingerprint: stableJsonStringify(normalized.properties),\n operations: [\n objectUpsertOperation({\n id: runtimeOperationId(index),\n ref,\n properties: normalized.properties,\n }),\n ],\n }\n },\n value: ([outcome]) => toObjectRow(ctx.projectId, requireEffectiveObject(outcome)),\n })\n}\n",
|
|
17
|
-
"/**\n * Low-level write: append normalized telemetry points through the ontology Materializer.\n *\n * Shared by the batch operation and the per-property appenders in ObjectByIdHandle. The Materializer\n * persists immutable point history, derives latest telemetry state, and writes the commit's outbox\n * facts in one transaction, so this leaf never appends events or writes providers itself.\n */\nimport { randomUUID } from \"node:crypto\"\nimport type { AuthorizationContext } from \"../../authorization\"\nimport { assertCanAppendTelemetry } from \"../../authorization\"\nimport { MaterializationObjectNotFoundError } from \"../../materialization/errors\"\nimport type { TelemetryCommitResult, TelemetryPointWrite } from \"../../materialization/model\"\nimport { getOntologyMutationRuntime } from \"../../runtime/ontology-mutations\"\nimport { ObjectNotFoundError } from \"../../storage/errors\"\nimport type { RuntimeMaterializerContext } from \"../materializer-adapter\"\n\nexport type TelemetryWriteContext = RuntimeMaterializerContext & {\n readonly authorization?: AuthorizationContext\n}\n\nexport async function writeTelemetryBatch(\n ctx: TelemetryWriteContext,\n points: readonly TelemetryPointWrite[]\n): Promise<TelemetryCommitResult | null> {\n // Asserted from the points rather than a resolved context: this leaf is the low-level choke point\n // for both `appendTelemetryBatch` and the per-property `TelemetryChannel`, and only the points know\n // which object types the call actually touches.\n for (const objectTypeId of new Set(points.map((point) => point.series.object.objectTypeId))) {\n assertCanAppendTelemetry(ctx, objectTypeId)\n }\n if (points.length === 0) return null\n\n let commit: TelemetryCommitResult\n try {\n commit = await getOntologyMutationRuntime(ctx).appendTelemetry({\n source: { kind: \"runtime\", requestId: randomUUID() },\n points,\n })\n } catch (error) {\n if (error instanceof MaterializationObjectNotFoundError) {\n throw new ObjectNotFoundError(\n error.objectTypeId,\n error.primaryId,\n \"Object not found for telemetry append\"\n )\n }\n throw error\n }\n return commit\n}\n",
|
|
18
|
-
"/**\n * Leaf operation: batch telemetry append for multiple objects of a single type.\n */\nimport { assertCanAppendTelemetry } from \"../../authorization\"\nimport type { TelemetryPointWrite } from \"../../materialization/model\"\nimport { telemetryPointKey } from \"../../materialization/refs\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport { assertTelemetryProperty } from \"../../ontology/validation\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport { writeTelemetryBatch } from \"./write-batch\"\n\n/**\n * Type guard for telemetry values that carry an explicit unit.\n *\n * Matches only the exact `{ value, unit }` wrapper (a string `unit` and no other\n * keys) so a legitimate JSON/object telemetry value is not silently\n * reinterpreted as value+unit. A fully explicit batch contract (passing units\n * out-of-band like the single-property appender) is tracked as a follow-up;\n * this narrows the heuristic without changing the public batch API.\n */\nfunction isUnitBearingValue(raw: unknown): raw is { value: unknown; unit: string } {\n if (raw === null || typeof raw !== \"object\") {\n return false\n }\n const record = raw as Record<string, unknown>\n return \"value\" in record && typeof record.unit === \"string\" && Object.keys(record).length === 2\n}\n\nexport async function appendTelemetryBatch(\n ctx: ResolvedObjectContext,\n items: readonly {\n id: string\n properties: Record<string, unknown | { value: unknown; unit: string }>\n at?: Date\n }[]\n): Promise<void> {\n // `writeTelemetryBatch` asserts again from the points it receives. Asserting here as well is not\n // redundant: it reports the type by name before any property is resolved, and it still refuses an\n // empty batch, which produces no points to assert over.\n assertCanAppendTelemetry(ctx, ctx.objectType.id)\n const { objectType } = ctx\n // Telemetry identity is `(series, at)`, so a repeated instant inside one call is an upsert: the\n // last value wins rather than failing the whole batch.\n const points = new Map<string, TelemetryPointWrite>()\n\n for (const item of items) {\n const at = (item.at ?? new Date()).toISOString()\n\n for (const [propertyId, rawValue] of Object.entries(item.properties)) {\n const propertyToken = objectType.p[propertyId]\n if (!propertyToken) {\n throw new OntologyValidationError(`Unknown property '${objectType.id}.${propertyId}'`)\n }\n\n assertTelemetryProperty(propertyToken.property)\n\n // Value and unit validation, plus schema normalization, happen inside the Materializer.\n const series = {\n object: { objectTypeId: objectType.id, primaryId: item.id },\n propertyId: propertyToken.id,\n }\n points.set(telemetryPointKey(series, at), {\n series,\n value: isUnitBearingValue(rawValue)\n ? (rawValue.value as TelemetryPointWrite[\"value\"])\n : (rawValue as TelemetryPointWrite[\"value\"]),\n ...(isUnitBearingValue(rawValue) ? { unit: rawValue.unit } : {}),\n at,\n })\n }\n }\n\n await writeTelemetryBatch(ctx, [...points.values()])\n}\n",
|
|
19
|
-
"import { type AuthorizationContext, assertAuthorized } from \"../../authorization\"\nimport type { RuntimeAuthorization } from \"../../execution\"\nimport type {\n TimeseriesHistoryBatchInput,\n TimeseriesHistoryBatchResult,\n TimeseriesHistorySeriesInput,\n TimeseriesStorage,\n} from \"../../storage\"\n\nexport interface TelemetryHistoryOptions {\n readonly storage: TimeseriesStorage\n readonly runtimeAuthorization?: RuntimeAuthorization\n readonly authorization?: AuthorizationContext | null\n}\n\nexport async function getTelemetryHistoryBatch(\n input: TimeseriesHistoryBatchInput,\n options: TelemetryHistoryOptions\n): Promise<readonly TimeseriesHistoryBatchResult[]> {\n assertTelemetrySeriesViewable(input.series, options)\n return options.storage.getHistoryBatch(input)\n}\n\nfunction assertTelemetrySeriesViewable(\n series: readonly TimeseriesHistorySeriesInput[],\n authorization: Pick<TelemetryHistoryOptions, \"authorization\" | \"runtimeAuthorization\">\n): void {\n for (const objectTypeId of new Set(series.map((entry) => entry.objectTypeId))) {\n assertAuthorized(\n {\n runtimeAuthorization: authorization.runtimeAuthorization,\n authorization: authorization.authorization ?? undefined,\n },\n { kind: \"object.view\", objectTypeId }\n )\n }\n}\n",
|
|
20
|
-
"/**\n * Context resolution factories.\n *\n * Resolve ontology identifiers into concrete type data so leaf functions\n * receive all structural information pre-resolved.\n */\n\nimport type { ObjectLink } from \"../../ontology\"\nimport { OntologyNotFoundError } from \"../../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkContext, ResolvedObjectContext } from \"./types\"\n\n/** Look up a link definition on an object type, throwing if not found. */\nexport function requireLinkDefinition(\n objectType: ObjectTypeWithPropertyTokens,\n linkId: string\n): ObjectLink {\n const def = objectType.links.find((l) => l.id === linkId)\n if (!def) throw new OntologyNotFoundError(`Unknown link '${objectType.id}.${linkId}'`)\n return def\n}\n\n/**\n * Resolve an object type id to a full ResolvedObjectContext.\n *\n * Uses ontology.resolveObjectType() and getPrimaryPropertyId() — these\n * are structural resolution calls that belong in factories, not leaf functions.\n */\nexport function resolveObjectContext(\n runtime: SixbRuntimeContext,\n objectTypeId: string\n): ResolvedObjectContext {\n const objectType = runtime.ontology.resolveObjectType(objectTypeId)\n const primaryPropertyId = runtime.ontology.getPrimaryPropertyId(objectTypeId)\n return { ...runtime, objectType, primaryPropertyId }\n}\n\n/**\n * Resolve a link id to a full ResolvedLinkContext.\n *\n * Uses requireLinkDefinition to look up the link definition on the\n * already-resolved object type.\n */\nexport function resolveLinkContext(\n objCtx: ResolvedObjectContext,\n linkId: string\n): ResolvedLinkContext {\n const linkDefinition = requireLinkDefinition(objCtx.objectType, linkId)\n return { ...objCtx, linkDefinition }\n}\n",
|
|
21
|
-
"/**\n * Telemetry channel factory for ObjectByIdHandle.\n *\n * Creates a per-property channel that writes through the low-level `writeTelemetryBatch` leaf and\n * reads the same series back through `getTelemetryHistoryBatch`, both keyed by the property token.\n */\nimport type { TelemetryPointWrite } from \"../../materialization/model\"\nimport type { ValueType } from \"../../ontology\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport {\n assertPropertyTokenBelongsToObjectType,\n assertTelemetryProperty,\n} from \"../../ontology/validation\"\nimport { RuntimeError } from \"../../runtime/errors\"\nimport type {\n TelemetryChannel,\n TelemetryHistoryInput,\n TelemetryPropertyToken,\n} from \"../../runtime/types\"\nimport type { ResolvedObjectContext } from \"../context\"\nimport { getTelemetryHistoryBatch, writeTelemetryBatch } from \"../telemetry\"\n\nexport function createTelemetryChannel<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(ctx: ResolvedObjectContext, primaryId: string) {\n return <TToken extends TelemetryPropertyToken<TObjectType>>(\n property: TToken\n ): TelemetryChannel<TToken, TValueTypes> => {\n const { objectType } = ctx\n assertPropertyTokenBelongsToObjectType(objectType, property)\n assertTelemetryProperty(property.property)\n\n const series = { objectTypeId: objectType.id, objectId: primaryId, propertyId: property.id }\n\n const channel = {\n append: async (input: { value: unknown; unit?: string; at: Date }) => {\n // Value and unit validation, plus schema normalization, happen inside the Materializer.\n await writeTelemetryBatch(ctx, [\n {\n series: {\n object: { objectTypeId: objectType.id, primaryId },\n propertyId: property.id,\n },\n value: input.value as TelemetryPointWrite[\"value\"],\n ...(input.unit !== undefined ? { unit: input.unit } : {}),\n at: input.at.toISOString(),\n },\n ])\n },\n\n history: async (input: TelemetryHistoryInput = {}) => {\n const timeseries = ctx.storage.timeseries\n if (!timeseries) {\n throw new RuntimeError(\"[Sixb] Reading telemetry requires storage.timeseries support.\")\n }\n\n const [result] = await getTelemetryHistoryBatch(\n {\n projectId: ctx.projectId,\n series: [series],\n ...(input.from !== undefined ? { from: input.from } : {}),\n ...(input.to !== undefined ? { to: input.to } : {}),\n ...(input.limit !== undefined ? { limitPerSeries: input.limit } : {}),\n ...(input.order !== undefined ? { order: input.order } : {}),\n },\n {\n storage: timeseries,\n runtimeAuthorization: ctx.runtimeAuthorization,\n authorization: ctx.authorization,\n }\n )\n\n return (result?.points ?? []).map((point) => ({\n value: point.value,\n at: point.at,\n ...(point.unit !== undefined ? { unit: point.unit } : {}),\n }))\n },\n }\n\n // Cast needed: generic token inference boundary — TToken is narrower than what `channel` sees\n return channel as unknown as TelemetryChannel<TToken, TValueTypes>\n }\n}\n",
|
|
22
|
-
"/**\n * ObjectByIdHandle binds operations to a specific object id within an ObjectSet.\n * Created via `sixb.objects(MyType).byId(\"id-1\")`, it provides link/unlink and\n * per-property telemetry appenders with compile-time unit and value type safety.\n */\nimport type { ActionDefinition } from \"../../actions\"\nimport { assertAuthorized, assertPrivileged } from \"../../authorization\"\nimport type { ObjectLink, ObjectRef, ValueType } from \"../../ontology\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport type { LinkToken, ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport { assertLinkTokenBelongsToObjectType } from \"../../ontology/validation\"\nimport type { ObjectByIdHandle, TwinObject } from \"../../runtime/types\"\nimport {\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport type { ExecutionObjectContext, ResolvedLinkContext } from \"../context\"\nimport { removeLink as removeLinkLeaf, upsertLink as upsertLinkLeaf } from \"../link\"\nimport { deleteObject, restoreObject } from \"../object\"\nimport { createTelemetryChannel } from \"./telemetry-channel\"\n\ntype ObjectRefInput = ObjectRef\ntype AnyLinkToken = LinkToken<string, string, string | readonly string[], ObjectLink>\n\nexport function createObjectByIdHandle<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(ctx: ExecutionObjectContext, primaryId: string): ObjectByIdHandle<TObjectType, TValueTypes> {\n const objectHandle = {\n get: async () => {\n assertAuthorized(ctx, { kind: \"object.view\", objectTypeId: ctx.objectType.id })\n const row = await ctx.storage.objects.getByPrimaryId({\n projectId: ctx.projectId,\n objectTypeId: ctx.objectType.id,\n primaryId,\n })\n return row ? (row as unknown as TwinObject<TObjectType, TValueTypes>) : null\n },\n\n listLinks: async (linkToken?: AnyLinkToken) => {\n // Link rows reveal target types; no link grant semantics exist yet.\n assertPrivileged(ctx, \"listLinks\")\n if (linkToken) {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n }\n return ctx.storage.objects.listLinks({\n projectId: ctx.projectId,\n objectTypeId: ctx.objectType.id,\n objectId: primaryId,\n linkId: linkToken?.id,\n })\n },\n\n link: async (\n linkToken: AnyLinkToken,\n target: ObjectRefInput,\n options?: { properties?: Record<string, unknown> }\n ) => {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n\n const linkCtx: ResolvedLinkContext = { ...ctx, linkDefinition: linkToken.link }\n await upsertLinkLeaf(linkCtx, {\n sourceId: primaryId,\n linkId: linkToken.id,\n targetTypeId: target.objectTypeId,\n targetId: target.primaryId,\n properties: options?.properties,\n })\n },\n\n unlink: async (linkToken: AnyLinkToken, target: ObjectRefInput) => {\n assertLinkTokenBelongsToObjectType(ctx.objectType, linkToken)\n\n const linkCtx: ResolvedLinkContext = { ...ctx, linkDefinition: linkToken.link }\n await removeLinkLeaf(linkCtx, {\n sourceId: primaryId,\n linkId: linkToken.id,\n targetTypeId: target.objectTypeId,\n targetId: target.primaryId,\n })\n },\n\n delete: async () => {\n await deleteObject(ctx, primaryId)\n },\n\n restore: async () => {\n await restoreObject(ctx, primaryId)\n },\n\n requestAction: async (input: {\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n runId?: string\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestAction requires either 'action' or 'actionId'\"\n )\n }\n return requestActionLeaf(ctx, {\n primaryId,\n actionId,\n params: input.params,\n options: { runId: input.runId },\n })\n },\n\n requestActionAndWait: async (input: {\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n timeoutMs?: number\n signal?: AbortSignal\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestActionAndWait requires either 'action' or 'actionId'\"\n )\n }\n return requestActionAndWaitLeaf(ctx, {\n primaryId,\n actionId,\n params: input.params,\n options: {\n timeoutMs: input.timeoutMs,\n signal: input.signal,\n },\n })\n },\n\n telemetry: createTelemetryChannel<TObjectType, TValueTypes>(ctx, primaryId),\n }\n\n return objectHandle as unknown as ObjectByIdHandle<TObjectType, TValueTypes>\n}\n",
|
|
23
|
-
"/**\n * Server-side ObjectQueryExecutor backed by the shared query executor and storage.\n * Validation, planning, fallback, and execution all run in-process here; the\n * HTTP executor in `@sixb/client` is the remote counterpart.\n */\n\nimport type { AuthorizationContext } from \"../../authorization\"\nimport type { RuntimeAuthorization } from \"../../execution/types\"\nimport type { OntologyRegistry } from \"../../ontology\"\nimport type { Storage } from \"../../storage\"\nimport {\n countObjects,\n executeObjectQuery,\n existsObjects,\n facetObjects,\n ObjectQueryPlanningError,\n} from \"../query\"\nimport { explainObjectQuery } from \"../query/explain\"\nimport type { ObjectQuery } from \"../query/ir\"\nimport { validateObjectQuery } from \"../query/validate\"\nimport type { ObjectQueryExecutor, ObjectQueryExecutorFacetRequest } from \"./query-executor\"\n\nexport function createRuntimeQueryExecutor(params: {\n projectId: string\n ontology: OntologyRegistry\n storage: Storage\n runtimeAuthorization?: RuntimeAuthorization\n authorization?: AuthorizationContext\n}): ObjectQueryExecutor {\n const { projectId, ontology, storage, runtimeAuthorization, authorization } = params\n const executorOptions = {\n ontology,\n storage: storage.objects,\n runtimeAuthorization,\n authorization,\n }\n\n return {\n async list(query: ObjectQuery, options?: { includeTotal?: boolean }) {\n try {\n return await executeObjectQuery(\n { projectId, query, includeTotal: options?.includeTotal },\n executorOptions\n )\n } catch (error) {\n if (error instanceof ObjectQueryPlanningError) {\n throw addSdkPlanningHints(error)\n }\n throw error\n }\n },\n\n async count(query: ObjectQuery) {\n const result = await countObjects({ projectId, query }, executorOptions)\n return result.count\n },\n\n async exists(query: ObjectQuery) {\n const result = await existsObjects({ projectId, query }, executorOptions)\n return result.exists\n },\n\n async facets(query: ObjectQuery, facets: readonly ObjectQueryExecutorFacetRequest[]) {\n const result = await facetObjects({ projectId, query, facets }, executorOptions)\n return result.facets.map((facet) => ({\n propertyId: facet.propertyId,\n buckets: [...facet.buckets],\n }))\n },\n\n validate(query: ObjectQuery) {\n return validateObjectQuery(query, { ontology, normalize: false })\n },\n\n explain(query: ObjectQuery) {\n return explainObjectQuery(query, { ontology, normalize: false })\n },\n }\n}\n\nfunction addSdkPlanningHints(error: ObjectQueryPlanningError): ObjectQueryPlanningError {\n if (!error.issues.some((issue) => issue.code === \"fallback_requires_bound\")) return error\n\n return new ObjectQueryPlanningError(\n error.issues.map((issue) =>\n issue.code === \"fallback_requires_bound\"\n ? {\n ...issue,\n message:\n \"Object query fallback requires an explicit result bound. Add .limit(n) or .page({ pageSize: n }) before .list().\",\n }\n : issue\n )\n )\n}\n",
|
|
24
|
-
"/**\n * ObjectSet provides a type-safe collection API for objects of a given type.\n * Created via `sixb.objects(MyType)`, it exposes upsert, query, and telemetry batch operations\n * while preserving compile-time property types inferred from the ontology definition.\n */\n\nimport type { ActionDefinition } from \"../../actions\"\nimport type { AuthorizationContext } from \"../../authorization\"\nimport { assertAuthorized } from \"../../authorization\"\nimport { shareSixbErrorReporter } from \"../../error-reporting/capability\"\nimport type { ExecutionContext } from \"../../execution\"\nimport type { ValueType } from \"../../ontology\"\nimport { OntologyValidationError } from \"../../ontology/errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"../../ontology/tokens\"\nimport { shareOntologyMutationRuntime } from \"../../runtime/ontology-mutations\"\nimport type {\n ObjectSet,\n ObjectSetListInput,\n SixbRuntimeContext,\n TwinObject,\n} from \"../../runtime/types\"\nimport {\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport type { ExecutionObjectContext, ResolvedLinkContext } from \"../context\"\nimport { requireLinkDefinition } from \"../context\"\nimport { removeLink as removeLinkLeaf, upsertLink as upsertLinkLeaf } from \"../link\"\nimport { upsertObject as upsertObjectLeaf } from \"../object\"\nimport { appendTelemetryBatch as appendTelemetryBatchLeaf } from \"../telemetry\"\nimport { createObjectByIdHandle } from \"./object-handle\"\nimport { createObjectQueryBuilder } from \"./query-builder\"\nimport { createRuntimeQueryExecutor } from \"./runtime-query-executor\"\n\nexport function createObjectSet<\n TObjectType extends ObjectTypeWithPropertyTokens,\n TRegisteredObjectTypes extends ObjectTypeWithPropertyTokens,\n TValueTypes extends readonly ValueType[],\n>(\n params: SixbRuntimeContext & {\n readonly execution: ExecutionContext\n readonly objectType: TObjectType\n readonly authorization?: AuthorizationContext\n }\n): ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes> {\n const { objectType } = params\n const primaryProp = objectType.properties.find((p) => p.primary)\n if (!primaryProp) {\n throw new OntologyValidationError(`Object type '${objectType.id}' has no primary property`)\n }\n const primaryPropertyId = primaryProp.id\n\n const {\n projectId,\n broker,\n ontology,\n actionRegistry,\n events,\n storage,\n queues,\n runtimeAuthorization,\n authorization,\n execution,\n } = params\n const queryExecutor = createRuntimeQueryExecutor({\n projectId,\n ontology,\n storage,\n runtimeAuthorization,\n authorization,\n })\n\n const resolvedCtx: ExecutionObjectContext = {\n projectId,\n broker,\n ontology,\n actionRegistry,\n events,\n storage,\n queues,\n runtimeAuthorization,\n authorization,\n execution,\n objectType,\n primaryPropertyId,\n }\n shareOntologyMutationRuntime(params, resolvedCtx)\n shareSixbErrorReporter(params, resolvedCtx)\n\n const objectSet = {\n get: async (id: string) => {\n assertAuthorized(resolvedCtx, { kind: \"object.view\", objectTypeId: objectType.id })\n const row = await storage.objects.getByPrimaryId({\n projectId,\n objectTypeId: objectType.id,\n primaryId: id,\n })\n return row ? (row as unknown as TwinObject<TObjectType, TValueTypes>) : null\n },\n\n upsert: async (input: { properties: Record<string, unknown> }) => {\n const row = await upsertObjectLeaf(resolvedCtx, input.properties)\n return row as unknown as TwinObject<TObjectType, TValueTypes>\n },\n\n query: () =>\n createObjectQueryBuilder<TObjectType, TRegisteredObjectTypes, TValueTypes>({\n query: { kind: \"start\", objectTypeId: objectType.id },\n executor: queryExecutor,\n }),\n\n byId: (id: string) => createObjectByIdHandle<TObjectType, TValueTypes>(resolvedCtx, id),\n\n list: async (input?: ObjectSetListInput) => {\n assertAuthorized(resolvedCtx, { kind: \"object.view\", objectTypeId: objectType.id })\n const result = await storage.objects.list({\n projectId,\n objectTypeId: objectType.id,\n primaryIdPrefix: input?.idPrefix,\n primaryIdSuffix: input?.idSuffix,\n updatedAfter: input?.updatedAfter,\n updatedBefore: input?.updatedBefore,\n createdAfter: input?.createdAfter,\n createdBefore: input?.createdBefore,\n limit: input?.limit,\n offset: input?.offset,\n orderBy: input?.orderBy,\n order: input?.order,\n })\n\n return {\n objects: result.objects.map(\n (row) => row as unknown as TwinObject<TObjectType, TValueTypes>\n ),\n hasMore: result.hasMore,\n total: result.total ?? result.objects.length,\n }\n },\n\n appendTelemetryBatch: async (\n items: readonly {\n id: string\n properties: Record<string, unknown | { value: unknown; unit: string }>\n at?: Date\n }[]\n ) => {\n await appendTelemetryBatchLeaf(resolvedCtx, items)\n },\n\n requestAction: async (input: {\n id: string\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n runId?: string\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestAction requires either 'action' or 'actionId'\"\n )\n }\n return requestActionLeaf(resolvedCtx, {\n primaryId: input.id,\n actionId,\n params: input.params,\n options: { runId: input.runId },\n })\n },\n\n requestActionAndWait: async (input: {\n id: string\n action?: ActionDefinition\n actionId?: string\n params?: Record<string, unknown>\n timeoutMs?: number\n signal?: AbortSignal\n }) => {\n const actionId = input.action?.id ?? input.actionId\n if (!actionId) {\n throw new OntologyValidationError(\n \"[Sixb] requestActionAndWait requires either 'action' or 'actionId'\"\n )\n }\n return requestActionAndWaitLeaf(resolvedCtx, {\n primaryId: input.id,\n actionId,\n params: input.params,\n options: {\n timeoutMs: input.timeoutMs,\n signal: input.signal,\n },\n })\n },\n\n upsertLink: async (input: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n properties?: Record<string, unknown>\n }) => {\n const linkDefinition = requireLinkDefinition(objectType, input.linkId)\n const linkCtx: ResolvedLinkContext = { ...resolvedCtx, linkDefinition }\n\n await upsertLinkLeaf(linkCtx, {\n sourceId: input.sourceId,\n linkId: input.linkId,\n targetTypeId: input.targetTypeId,\n targetId: input.targetId,\n properties: input.properties,\n })\n },\n\n removeLink: async (input: {\n sourceId: string\n linkId: string\n targetTypeId: string\n targetId: string\n }) => {\n const linkDefinition = requireLinkDefinition(objectType, input.linkId)\n const linkCtx: ResolvedLinkContext = { ...resolvedCtx, linkDefinition }\n\n await removeLinkLeaf(linkCtx, {\n sourceId: input.sourceId,\n linkId: input.linkId,\n targetTypeId: input.targetTypeId,\n targetId: input.targetId,\n })\n },\n }\n\n return objectSet as unknown as ObjectSet<TObjectType, TValueTypes, TRegisteredObjectTypes>\n}\n",
|
|
25
|
-
"/**\n * Service layer for action operations.\n *\n * Resolves objectTypeId to a typed context and delegates to the leaf function.\n */\n\nimport type { RequestActionResult } from \"../../actions/request\"\nimport type { ExecutionContext } from \"../../execution\"\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ActionRunRecord } from \"../../storage\"\nimport {\n type RequestActionAndWaitOptions,\n type RequestActionOptions,\n requestActionAndWait as requestActionAndWaitLeaf,\n requestAction as requestActionLeaf,\n} from \"../action\"\nimport { resolveObjectContext } from \"../context\"\n\nexport async function requestAction(\n runtime: SixbRuntimeContext,\n execution: ExecutionContext,\n objectTypeId: string,\n primaryId: string,\n actionId: string,\n params?: Record<string, unknown>,\n options?: RequestActionOptions\n): Promise<RequestActionResult> {\n const ctx = { ...resolveObjectContext(runtime, objectTypeId), execution }\n return requestActionLeaf(ctx, { primaryId, actionId, params, options })\n}\n\nexport async function requestActionAndWait(\n runtime: SixbRuntimeContext,\n execution: ExecutionContext,\n objectTypeId: string,\n primaryId: string,\n actionId: string,\n params?: Record<string, unknown>,\n options?: RequestActionAndWaitOptions\n): Promise<ActionRunRecord> {\n const ctx = { ...resolveObjectContext(runtime, objectTypeId), execution }\n return requestActionAndWaitLeaf(ctx, { primaryId, actionId, params, options })\n}\n",
|
|
26
|
-
"/**\n * Service layer for link operations.\n *\n * Resolves objectTypeId to a typed context and delegates to leaf functions.\n */\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ResolvedLinkBatchItem } from \"../context\"\nimport { requireLinkDefinition, resolveLinkContext, resolveObjectContext } from \"../context\"\nimport {\n removeLink as removeLinkLeaf,\n upsertLinkBatch as upsertLinkBatchLeaf,\n upsertLink as upsertLinkLeaf,\n} from \"../link\"\n\nexport async function upsertLink(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n const linkCtx = resolveLinkContext(ctx, linkId)\n await upsertLinkLeaf(linkCtx, {\n sourceId,\n linkId,\n targetTypeId: target.targetTypeId,\n targetId: target.targetId,\n properties: target.properties,\n })\n}\n\nexport async function upsertLinkBatch(\n runtime: SixbRuntimeContext,\n items: readonly {\n objectTypeId: string\n sourceId: string\n linkId: string\n target: { targetTypeId: string; targetId: string; properties?: Record<string, unknown> }\n }[]\n): Promise<readonly BatchItemResult<void>[]> {\n const resolvedItems: ResolvedLinkBatchItem[] = items.map((item) => {\n const objectType = runtime.ontology.resolveObjectType(item.objectTypeId)\n const linkDefinition = requireLinkDefinition(objectType, item.linkId)\n return {\n objectType,\n linkDefinition,\n sourceId: item.sourceId,\n linkId: item.linkId,\n targetTypeId: item.target.targetTypeId,\n targetId: item.target.targetId,\n properties: item.target.properties,\n }\n })\n\n return upsertLinkBatchLeaf(runtime, resolvedItems)\n}\n\nexport async function removeLink(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n sourceId: string,\n linkId: string,\n target: { targetTypeId: string; targetId: string }\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n const linkCtx = resolveLinkContext(ctx, linkId)\n await removeLinkLeaf(linkCtx, {\n sourceId,\n linkId,\n targetTypeId: target.targetTypeId,\n targetId: target.targetId,\n })\n}\n",
|
|
27
|
-
"/**\n * Cross-type object listing for dashboards and search.\n *\n * On principal-bound runtimes the type filter is authorized before the storage call:\n * explicitly requested types must all be viewable, and unfiltered listings\n * narrow to the principal's viewable types instead of post-filtering rows.\n */\n\nimport { assertAuthorized } from \"../../authorization\"\nimport type { ListResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\n\nexport interface ListObjectsParams {\n objectTypeIds?: readonly string[]\n idPrefix?: string\n idSuffix?: string\n updatedAfter?: Date\n updatedBefore?: Date\n createdAfter?: Date\n createdBefore?: Date\n limit?: number\n offset?: number\n orderBy?: \"createdAt\" | \"updatedAt\" | \"primaryId\"\n order?: \"asc\" | \"desc\"\n}\n\nexport async function listObjects(\n runtime: SixbRuntimeContext,\n params: ListObjectsParams\n): Promise<ListResult<ObjectRow>> {\n const objectTypeIds = resolveAuthorizedTypeFilter(runtime, params.objectTypeIds)\n\n if (runtime.authorization && objectTypeIds !== undefined && objectTypeIds.length === 0) {\n return { objects: [], hasMore: false, total: 0 }\n }\n\n const result = await runtime.storage.objects.list({\n projectId: runtime.projectId,\n objectTypeId: objectTypeIds?.length === 1 ? objectTypeIds[0] : objectTypeIds,\n primaryIdPrefix: params.idPrefix,\n primaryIdSuffix: params.idSuffix,\n updatedAfter: params.updatedAfter,\n updatedBefore: params.updatedBefore,\n createdAfter: params.createdAfter,\n createdBefore: params.createdBefore,\n limit: params.limit,\n offset: params.offset,\n orderBy: params.orderBy,\n order: params.order,\n })\n\n return {\n objects: [...result.objects],\n hasMore: result.hasMore,\n total: result.total,\n }\n}\n\nfunction resolveAuthorizedTypeFilter(\n runtime: SixbRuntimeContext,\n requested: readonly string[] | undefined\n): readonly string[] | undefined {\n if (requested) {\n for (const objectTypeId of requested) {\n runtime.ontology.resolveObjectType(objectTypeId)\n }\n }\n\n const expanded = requested\n ? [...new Set(requested.flatMap((id) => [id, ...runtime.ontology.listSubTypes(id)]))]\n : undefined\n\n if (!runtime.authorization) {\n return expanded\n }\n\n if (!expanded) {\n // Broad listings narrow to the visible universe rather than failing. The\n // set already contains every registered type when \"all\" was granted.\n return [...runtime.authorization.grants[\"view:object\"]]\n }\n\n // Explicitly requested types must all be viewable.\n for (const objectTypeId of expanded) {\n assertAuthorized(runtime, { kind: \"object.view\", objectTypeId })\n }\n\n return expanded\n}\n",
|
|
28
|
-
"/**\n * Service layer for object upsert operations.\n *\n * Resolves objectTypeId to a typed context and delegates to leaf functions.\n */\nimport type { BatchItemResult, SixbRuntimeContext } from \"../../runtime/types\"\nimport type { ObjectRow } from \"../../storage\"\nimport { resolveObjectContext } from \"../context\"\nimport {\n upsertObjectBatch as upsertObjectBatchLeaf,\n upsertObject as upsertObjectLeaf,\n} from \"../object\"\n\nexport async function upsertObject(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n properties: Record<string, unknown>\n): Promise<ObjectRow> {\n return upsertObjectLeaf(resolveObjectContext(runtime, objectTypeId), properties)\n}\n\nexport async function upsertObjectBatch(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n items: readonly { properties: Record<string, unknown> }[]\n): Promise<readonly BatchItemResult<ObjectRow>[]> {\n return upsertObjectBatchLeaf(resolveObjectContext(runtime, objectTypeId), items)\n}\n",
|
|
29
|
-
"/**\n * Service layer for telemetry operations.\n *\n * Resolves objectTypeId to a typed context and delegates to the leaf function.\n */\nimport type { SixbRuntimeContext } from \"../../runtime/types\"\nimport { resolveObjectContext } from \"../context\"\nimport { appendTelemetryBatch as appendTelemetryBatchLeaf } from \"../telemetry\"\n\nexport async function appendTelemetry(\n runtime: SixbRuntimeContext,\n objectTypeId: string,\n items: readonly { id: string; properties: Record<string, unknown>; at?: Date }[]\n): Promise<void> {\n const ctx = resolveObjectContext(runtime, objectTypeId)\n await appendTelemetryBatchLeaf(ctx, items)\n}\n"
|
|
30
|
-
],
|
|
31
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,eAAsB,cAAa,CAC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AGA,WAAW,gBAAgB,UAAU;AAAA,IACnC,iBAAiB,SAAS,EAAE,MAAM,eAAe,aAAa,CAAC;AAAA,EACjE;AAAA,EAEA,OAAO;AAAA;;AC1ET,eAAsB,aAAY,CAChC,SACA,cACA,YACoB;AAAA,EACpB,OAAO,aAAiB,qBAAqB,SAAS,YAAY,GAAG,UAAU;AAAA;AAGjF,eAAsB,kBAAiB,CACrC,SACA,cACA,OACgD;AAAA,EAChD,OAAO,kBAAsB,qBAAqB,SAAS,YAAY,GAAG,KAAK;AAAA;;ACjBjF,eAAsB,eAAe,CACnC,SACA,cACA,OACe;AAAA,EACf,MAAM,MAAM,qBAAqB,SAAS,YAAY;AAAA,EACtD,MAAM,qBAAyB,KAAK,KAAK;AAAA;",
|
|
32
|
-
"debugId": "790282B822F7382564756E2164756E21",
|
|
33
|
-
"names": []
|
|
34
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/queues/errors.ts", "../src/queues/in-memory.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Error for queue invariants and invalid queue operations.\n */\nexport class QueueError extends Error {\n readonly name = \"QueueError\"\n}\n",
|
|
6
|
-
"import { randomUUID } from \"node:crypto\"\nimport type { SixbErrorCode } from \"../errors/types\"\nimport { QueueError } from \"./errors\"\nimport type {\n ActionQueueJobFailureCode,\n ActionRunRequestedQueueJob,\n AgentQueueJob,\n AgentQueueJobFailureCode,\n ClaimedQueueJob,\n NewQueueJob,\n PipelineQueueJobFailureCode,\n PipelineRunRequestedQueueJob,\n ProjectionQueueJobFailureCode,\n ProjectionRunRequestedQueueJob,\n Queue,\n QueueJob,\n QueueJobFailure,\n Queues,\n SyncQueueJobFailureCode,\n SyncRunRequestedQueueJob,\n WorkflowQueueJob,\n WorkflowQueueJobFailureCode,\n} from \"./types\"\n\ntype QueueRecordState = \"queued\" | \"completed\" | \"failed\"\n\ninterface QueueRecord<TQueueJob extends QueueJob = QueueJob> {\n readonly sequence: number\n readonly queueId: string\n job: TQueueJob\n // A leased job stays \"queued\" until a worker completes or fails it.\n state: QueueRecordState\n failure: QueueJobFailure | null\n leaseId: string | null\n claimedAt: string | null\n leaseExpiresAt: string | null\n}\n\nfunction assertNonEmpty(value: string, fieldName: string): void {\n if (value.trim().length === 0) {\n throw new QueueError(`[Sixb] Queue ${fieldName} must not be empty`)\n }\n}\n\nfunction parseTimestamp(value: string, fieldName: string): number {\n const timestamp = Date.parse(value)\n\n if (Number.isNaN(timestamp)) {\n throw new QueueError(`[Sixb] Queue ${fieldName} must be a valid timestamp`)\n }\n\n return timestamp\n}\n\nfunction assertPositiveNumber(value: number, fieldName: string): void {\n if (!Number.isFinite(value) || value <= 0) {\n throw new QueueError(`[Sixb] Queue ${fieldName} must be greater than 0`)\n }\n}\n\nfunction clearLease(record: QueueRecord): void {\n record.leaseId = null\n record.claimedAt = null\n record.leaseExpiresAt = null\n}\n\n// Best-effort ordering is part of the contract; this keeps the in-memory provider deterministic.\nfunction compareQueueRecords(left: QueueRecord, right: QueueRecord): number {\n const availableDifference =\n parseTimestamp(left.job.availableAt, \"job.availableAt\") -\n parseTimestamp(right.job.availableAt, \"job.availableAt\")\n\n if (availableDifference !== 0) {\n return availableDifference\n }\n\n const createdDifference =\n parseTimestamp(left.job.createdAt, \"job.createdAt\") -\n parseTimestamp(right.job.createdAt, \"job.createdAt\")\n\n if (createdDifference !== 0) {\n return createdDifference\n }\n\n return left.sequence - right.sequence\n}\n\nfunction createQueueJob<TQueueJob extends QueueJob>(\n projectId: string,\n newJob: NewQueueJob<TQueueJob>\n): TQueueJob {\n const createdAt = new Date().toISOString()\n const availableAt = newJob.availableAt ?? createdAt\n parseTimestamp(availableAt, \"availableAt\")\n\n return {\n id: newJob.id ?? randomUUID(),\n projectId,\n createdAt,\n availableAt,\n attempt: 0,\n metadata: newJob.metadata ? structuredClone(newJob.metadata) : undefined,\n type: newJob.type,\n payload: structuredClone(newJob.payload),\n } as TQueueJob\n}\n\nfunction leaseExpiresAtMs(record: QueueRecord): number | null {\n if (!record.leaseId || !record.leaseExpiresAt) {\n return null\n }\n\n return parseTimestamp(record.leaseExpiresAt, \"leaseExpiresAt\")\n}\n\nfunction toClaimedQueueJob<TQueueJob extends QueueJob>(\n record: QueueRecord<TQueueJob>\n): ClaimedQueueJob<TQueueJob> {\n if (!record.leaseId || !record.claimedAt || !record.leaseExpiresAt) {\n throw new QueueError(`[Sixb] Queue job '${record.job.id}' is not currently leased`)\n }\n\n return {\n leaseId: record.leaseId,\n claimedAt: record.claimedAt,\n leaseExpiresAt: record.leaseExpiresAt,\n job: structuredClone(record.job),\n }\n}\n\nclass InMemoryQueueStore {\n private readonly recordsByProject = new Map<string, QueueRecord[]>()\n private nextSequence = 1\n\n add<TQueueJob extends QueueJob>(projectId: string, queueId: string, job: TQueueJob): void {\n const records = this.getOrCreateRecords(projectId)\n records.push({\n sequence: this.nextSequence,\n queueId,\n job,\n state: \"queued\",\n failure: null,\n leaseId: null,\n claimedAt: null,\n leaseExpiresAt: null,\n })\n this.nextSequence += 1\n }\n\n list<TQueueJob extends QueueJob>(projectId: string, queueId: string): QueueRecord<TQueueJob>[] {\n const records = this.recordsByProject.get(projectId) ?? []\n return records.filter((record) => record.queueId === queueId) as QueueRecord<TQueueJob>[]\n }\n\n find<TQueueJob extends QueueJob>(\n projectId: string,\n queueId: string,\n jobId: string\n ): QueueRecord<TQueueJob> | null {\n return (\n this.list<TQueueJob>(projectId, queueId).find((record) => record.job.id === jobId) ?? null\n )\n }\n\n private getOrCreateRecords(projectId: string): QueueRecord[] {\n const existing = this.recordsByProject.get(projectId)\n if (existing) {\n return existing\n }\n\n const records: QueueRecord[] = []\n this.recordsByProject.set(projectId, records)\n return records\n }\n}\n\nclass InMemoryQueue<TQueueJob extends QueueJob, TFailureCode extends SixbErrorCode>\n implements Queue<TQueueJob, TFailureCode>\n{\n constructor(\n private readonly store: InMemoryQueueStore,\n private readonly queueId: string\n ) {\n assertNonEmpty(queueId, \"queueId\")\n }\n\n async enqueue(params: {\n projectId: string\n jobs: readonly NewQueueJob<TQueueJob>[]\n }): Promise<readonly TQueueJob[]> {\n assertNonEmpty(params.projectId, \"projectId\")\n\n if (params.jobs.length === 0) {\n return []\n }\n\n const createdJobs = params.jobs.map((job) => {\n if (job.id !== undefined) assertNonEmpty(job.id, \"job.id\")\n const existing = job.id\n ? this.store.find<TQueueJob>(params.projectId, this.queueId, job.id)\n : null\n if (existing) return existing.job\n\n const created = createQueueJob(params.projectId, job)\n this.store.add(params.projectId, this.queueId, created)\n return created\n })\n\n return createdJobs.map((job) => structuredClone(job))\n }\n\n async claim(params: {\n projectId: string\n workerId: string\n limit?: number\n leaseMs?: number\n }): Promise<readonly ClaimedQueueJob<TQueueJob>[]> {\n assertNonEmpty(params.projectId, \"projectId\")\n assertNonEmpty(params.workerId, \"workerId\")\n\n const limit = params.limit ?? 1\n if (limit <= 0) {\n return []\n }\n\n const leaseMs = params.leaseMs ?? 30_000\n assertPositiveNumber(leaseMs, \"leaseMs\")\n\n const now = Date.now()\n const claimable = this.store\n .list<TQueueJob>(params.projectId, this.queueId)\n .filter((record) => {\n if (record.state !== \"queued\") {\n return false\n }\n\n if (parseTimestamp(record.job.availableAt, \"job.availableAt\") > now) {\n return false\n }\n\n const expiresAt = leaseExpiresAtMs(record)\n return expiresAt === null || expiresAt <= now\n })\n .sort(compareQueueRecords)\n .slice(0, limit)\n\n const claimedAt = new Date(now).toISOString()\n\n return claimable.map((record) => {\n // Attempts count claims so redelivery after lease expiry or retry is visible to workers.\n record.job = {\n ...record.job,\n attempt: record.job.attempt + 1,\n }\n record.leaseId = randomUUID()\n record.claimedAt = claimedAt\n record.leaseExpiresAt = new Date(now + leaseMs).toISOString()\n\n return toClaimedQueueJob(record)\n })\n }\n\n async complete(params: { projectId: string; jobId: string; leaseId: string }): Promise<void> {\n const record = this.requireActiveLease(params)\n record.state = \"completed\"\n clearLease(record)\n }\n\n async retry(params: {\n projectId: string\n jobId: string\n leaseId: string\n availableAt?: string\n }): Promise<void> {\n const record = this.requireActiveLease(params)\n const availableAt = params.availableAt ?? new Date().toISOString()\n parseTimestamp(availableAt, \"availableAt\")\n\n record.job = {\n ...record.job,\n availableAt,\n }\n clearLease(record)\n }\n\n async fail(params: {\n projectId: string\n jobId: string\n leaseId: string\n failure: QueueJobFailure<TFailureCode>\n }): Promise<void> {\n const record = this.requireActiveLease(params)\n record.state = \"failed\"\n record.failure = structuredClone(params.failure)\n clearLease(record)\n }\n\n async renewLease(params: {\n projectId: string\n jobId: string\n leaseId: string\n leaseMs: number\n }): Promise<ClaimedQueueJob<TQueueJob> | null> {\n assertPositiveNumber(params.leaseMs, \"leaseMs\")\n\n const record = this.store.find<TQueueJob>(params.projectId, this.queueId, params.jobId)\n if (!record || record.state !== \"queued\") {\n return null\n }\n\n const now = Date.now()\n const expiresAt = leaseExpiresAtMs(record)\n if (record.leaseId !== params.leaseId || expiresAt === null) {\n return null\n }\n\n if (expiresAt <= now) {\n return null\n }\n\n record.leaseExpiresAt = new Date(now + params.leaseMs).toISOString()\n return toClaimedQueueJob(record)\n }\n\n private requireActiveLease(params: {\n projectId: string\n jobId: string\n leaseId: string\n }): QueueRecord<TQueueJob> {\n assertNonEmpty(params.projectId, \"projectId\")\n assertNonEmpty(params.jobId, \"jobId\")\n assertNonEmpty(params.leaseId, \"leaseId\")\n\n const record = this.store.find<TQueueJob>(params.projectId, this.queueId, params.jobId)\n\n if (!record) {\n throw new QueueError(`[Sixb] Unknown queue job '${params.jobId}'`)\n }\n\n if (record.state !== \"queued\") {\n throw new QueueError(`[Sixb] Queue job '${params.jobId}' is no longer active`)\n }\n\n if (record.leaseId !== params.leaseId || !record.leaseExpiresAt) {\n throw new QueueError(`[Sixb] Lease mismatch for queue job '${params.jobId}'`)\n }\n\n const expiresAt = leaseExpiresAtMs(record)\n if (expiresAt === null || expiresAt <= Date.now()) {\n throw new QueueError(`[Sixb] Lease for queue job '${params.jobId}' has expired`)\n }\n\n return record\n }\n}\n\nexport class InMemoryQueues implements Queues {\n readonly scope = \"process\" as const\n private readonly store = new InMemoryQueueStore()\n\n readonly syncRuns = new InMemoryQueue<SyncRunRequestedQueueJob, SyncQueueJobFailureCode>(\n this.store,\n \"sync.runs\"\n )\n readonly pipelines = new InMemoryQueue<PipelineRunRequestedQueueJob, PipelineQueueJobFailureCode>(\n this.store,\n \"pipeline.runs\"\n )\n readonly projections = new InMemoryQueue<\n ProjectionRunRequestedQueueJob,\n ProjectionQueueJobFailureCode\n >(this.store, \"projection.runs\")\n readonly workflows = new InMemoryQueue<WorkflowQueueJob, WorkflowQueueJobFailureCode>(\n this.store,\n \"workflow.runs\"\n )\n readonly actions = new InMemoryQueue<ActionRunRequestedQueueJob, ActionQueueJobFailureCode>(\n this.store,\n \"action.runs\"\n )\n readonly agents = new InMemoryQueue<AgentQueueJob, AgentQueueJobFailureCode>(\n this.store,\n \"agent.runs\"\n )\n\n /** Nothing to reach: the store is a field of this object. */\n health(): Promise<void> {\n return Promise.resolve()\n }\n}\n"
|
|
7
|
-
],
|
|
8
|
-
"mappings": ";;AAGO,MAAM,mBAAmB,MAAM;AAAA,EAC3B,OAAO;AAClB;;ACLA;AAsCA,SAAS,cAAc,CAAC,OAAe,WAAyB;AAAA,EAC9D,IAAI,MAAM,KAAK,EAAE,WAAW,GAAG;AAAA,IAC7B,MAAM,IAAI,WAAW,gBAAgB,6BAA6B;AAAA,EACpE;AAAA;AAGF,SAAS,cAAc,CAAC,OAAe,WAA2B;AAAA,EAChE,MAAM,YAAY,KAAK,MAAM,KAAK;AAAA,EAElC,IAAI,OAAO,MAAM,SAAS,GAAG;AAAA,IAC3B,MAAM,IAAI,WAAW,gBAAgB,qCAAqC;AAAA,EAC5E;AAAA,EAEA,OAAO;AAAA;AAGT,SAAS,oBAAoB,CAAC,OAAe,WAAyB;AAAA,EACpE,IAAI,CAAC,OAAO,SAAS,KAAK,KAAK,SAAS,GAAG;AAAA,IACzC,MAA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IAAI,cACtB,KAAK,OACL,WACF;AAAA,EACS,YAAY,IAAI,cACvB,KAAK,OACL,eACF;AAAA,EACS,cAAc,IAAI,cAGzB,KAAK,OAAO,iBAAiB;AAAA,EACtB,YAAY,IAAI,cACvB,KAAK,OACL,eACF;AAAA,EACS,UAAU,IAAI,cACrB,KAAK,OACL,aACF;AAAA,EACS,SAAS,IAAI,cACpB,KAAK,OACL,YACF;AAAA,EAGA,MAAM,GAAkB;AAAA,IACtB,OAAO,QAAQ,QAAQ;AAAA;AAE3B;",
|
|
9
|
-
"debugId": "CCF3BA9256C63ED464756E2164756E21",
|
|
10
|
-
"names": []
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/projections/capability.ts", "../src/projections/run-dispatch.ts", "../src/projections/run-id.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import type { ProjectionRegistry } from \"./registry\"\nimport type { ProjectionDispatchDescriptor } from \"./types\"\n\nconst projectionRegistryKey: unique symbol = Symbol(\"sixb.projectionRegistry\")\n\ninterface ProjectionRegistryOwner {\n readonly [projectionRegistryKey]?: ProjectionRegistry\n}\n\nexport function registerProjectionRegistry(owner: object, registry: ProjectionRegistry): void {\n const registered = (owner as ProjectionRegistryOwner)[projectionRegistryKey]\n if (registered && registered !== registry) {\n throw new Error(\"[Sixb] Projection registry is already registered for this owner.\")\n }\n Object.defineProperty(owner, projectionRegistryKey, {\n configurable: false,\n enumerable: false,\n value: registry,\n writable: false,\n })\n}\n\nexport function getProjectionRegistry(owner: object): ProjectionRegistry {\n const registry = (owner as ProjectionRegistryOwner)[projectionRegistryKey]\n if (registry) return registry\n throw new Error(\"[Sixb] Projection registry is not registered for this runtime.\")\n}\n\nexport function getProjectionDispatchDescriptors(\n owner: object\n): readonly ProjectionDispatchDescriptor[] {\n return getProjectionRegistry(owner).getDispatchDescriptors()\n}\n\nexport function shareProjectionRegistry(source: object, target: object): void {\n registerProjectionRegistry(target, getProjectionRegistry(source))\n}\n",
|
|
6
|
-
"import { randomUUID } from \"node:crypto\"\nimport { reportRunFailure } from \"../error-reporting/capability\"\nimport { createSixbError, toSixbFailure } from \"../errors/internal\"\nimport type { SixbFailure } from \"../errors/types\"\nimport type { RunDispatcher } from \"../execution/dispatch\"\nimport { createPrimitiveExecutionRecord } from \"../execution/durable\"\nimport type { LakeStorage } from \"../lake-storage\"\nimport type { Queues } from \"../queues\"\nimport type { SixbDefinitions } from \"../runtime/definitions\"\nimport type { ExecutionRecord, ProjectionRunRecord, Storage } from \"../storage\"\nimport { ProjectionRunError } from \"../storage\"\nimport { findPrimitiveRunExecution } from \"../storage/executions/run-link\"\nimport {\n assertProjectionRunDurableExecution,\n assertProjectionRunIdentityMatches,\n} from \"../storage/projection-runs/provider\"\nimport { getProjectionRegistry } from \"./capability\"\nimport { ProjectionValidationError } from \"./errors\"\nimport { createProjectionRunId } from \"./run-id\"\nimport {\n PROJECTION_RUN_FAILURE_CODES,\n type ProjectionDefinition,\n type ProjectionRunFailureCode,\n} from \"./types\"\n\n/** Target maximum mapped points per telemetry commit; a single-property projection reads 500 rows. */\nexport const PROJECTION_TELEMETRY_BATCH_SIZE = 500\n\nexport interface ProjectionRunDispatchInput {\n readonly projectionId: string\n readonly datasetVersion: {\n readonly datasetId: string\n readonly versionId: string\n readonly createdAt: string\n }\n readonly metadata?: Readonly<Record<string, string>>\n}\n\nexport interface ProjectionRunDispatchResult {\n readonly projectionId: string\n readonly runId: string\n readonly queuedAt: string\n readonly jobId?: string\n readonly created: boolean\n}\n\nexport type ProjectionRunDispatchPort = RunDispatcher<\n ProjectionRunDispatchInput,\n ProjectionRunDispatchResult\n>\n\nexport interface ProjectionRunDispatcherDependencies {\n readonly id: string\n readonly definitions: Pick<SixbDefinitions, \"projections\">\n readonly lakeStorage: Pick<LakeStorage, \"getVersion\">\n readonly storage: Storage\n readonly queues: Pick<Queues, \"projections\">\n}\n\ntype PersistedProjectionRun =\n | { readonly publish: false; readonly run: ProjectionRunRecord }\n | {\n readonly publish: true\n readonly run: ProjectionRunRecord\n readonly queuedAt: Date\n readonly created: boolean\n }\n\n/** Core-owned durable dispatch boundary for immutable dataset-version materialization. */\nexport class ProjectionRunDispatcher implements ProjectionRunDispatchPort {\n constructor(private readonly dependencies: ProjectionRunDispatcherDependencies) {}\n\n async dispatch(input: ProjectionRunDispatchInput): Promise<ProjectionRunDispatchResult> {\n assertDispatchInput(input)\n const registry = getProjectionRegistry(this.dependencies)\n const descriptor = registry.resolveDispatch(input.projectionId)\n if (descriptor.datasetId !== input.datasetVersion.datasetId) {\n throw new ProjectionValidationError(\n `[Sixb] Projection '${input.projectionId}' consumes dataset '${descriptor.datasetId}', not '${input.datasetVersion.datasetId}'.`\n )\n }\n const projection = this.dependencies.definitions.projections.getById(input.projectionId)\n if (!projection) {\n throw new ProjectionValidationError(`[Sixb] Unknown projection '${input.projectionId}'.`)\n }\n const version = await this.dependencies.lakeStorage.getVersion(\n input.datasetVersion.datasetId,\n input.datasetVersion.versionId\n )\n if (!version || version.createdAt.toISOString() !== input.datasetVersion.createdAt) {\n throw new ProjectionValidationError(\n `[Sixb] Dataset '${input.datasetVersion.datasetId}' version '${input.datasetVersion.versionId}' does not match its immutable metadata.`\n )\n }\n if (version.mode === \"schema\") {\n throw new ProjectionValidationError(\n `[Sixb] Projection '${input.projectionId}' cannot materialize a schema-only dataset version.`\n )\n }\n\n const { datasetId: _datasetId, ...semanticIdentity } = descriptor\n const identity = {\n ...semanticIdentity,\n datasetVersion: structuredClone(input.datasetVersion),\n }\n const runId = createProjectionRunId(this.dependencies.id, identity)\n const projectionRuns = requireProjectionRunStorage(this.dependencies.storage)\n const existing = await projectionRuns.getById({ projectId: this.dependencies.id, id: runId })\n const persisted = existing\n ? await reuseProjectionRun(this.dependencies, existing, identity)\n : await persistProjectionRun({\n dependencies: this.dependencies,\n runId,\n identity,\n projection,\n producerExecution: await resolveProducerExecution(\n this.dependencies.storage,\n this.dependencies.id,\n version.producer\n ),\n })\n\n if (!persisted.publish) return existingResult(persisted.run)\n return publishProjectionRun(this.dependencies, input.metadata, persisted)\n }\n}\n\nasync function persistProjectionRun(input: {\n readonly dependencies: ProjectionRunDispatcherDependencies\n readonly runId: string\n readonly identity: ProjectionRunRecord[\"identity\"]\n readonly projection: ProjectionDefinition\n readonly producerExecution: ExecutionRecord | null\n}): Promise<PersistedProjectionRun> {\n const execution = createPrimitiveExecutionRecord({\n id: `exec_${randomUUID()}`,\n primitive: { kind: \"projection\", id: input.identity.projectionId, runId: input.runId },\n origin: {\n type: \"automatic\",\n projectId: input.dependencies.id,\n source: {\n type: \"datasetVersion\",\n datasetId: input.identity.datasetVersion.datasetId,\n versionId: input.identity.datasetVersion.versionId,\n },\n correlationId: input.producerExecution?.correlationId ?? input.runId,\n ...(input.producerExecution?.requestedBy === undefined\n ? {}\n : { requestedBy: input.producerExecution.requestedBy }),\n },\n })\n const queuedAt = new Date()\n\n try {\n return await input.dependencies.storage.transaction(\n async (tx): Promise<PersistedProjectionRun> => {\n const projectionRuns = requireProjectionRunStorage(tx)\n const raced = await projectionRuns.getById({\n projectId: input.dependencies.id,\n id: input.runId,\n })\n if (raced) {\n await assertExistingRun(tx, raced, input.identity)\n return { publish: false, run: raced }\n }\n await tx.executions.create(execution)\n const run = await queueProjectionRun(projectionRuns, {\n id: input.runId,\n projectId: input.dependencies.id,\n executionId: execution.id,\n identity: input.identity,\n projection: input.projection,\n queuedAt,\n })\n return { publish: true, run, queuedAt, created: true }\n },\n { isolation: \"serializable\" }\n )\n } catch (error) {\n if (!(error instanceof ProjectionRunError)) throw error\n const raced = await requireProjectionRunStorage(input.dependencies.storage).getById({\n projectId: input.dependencies.id,\n id: input.runId,\n })\n if (!raced) throw error\n await assertExistingRun(input.dependencies.storage, raced, input.identity)\n return { publish: false, run: raced }\n }\n}\n\nasync function reuseProjectionRun(\n dependencies: ProjectionRunDispatcherDependencies,\n existing: ProjectionRunRecord,\n identity: ProjectionRunRecord[\"identity\"]\n): Promise<PersistedProjectionRun> {\n await assertExistingRun(dependencies.storage, existing, identity)\n if (\n existing.status !== \"failed\" ||\n existing.error?.code !== \"queue.enqueue_failed\" ||\n !existing.error.retryable\n ) {\n return { publish: false, run: existing }\n }\n const queuedAt = new Date()\n const projectionRuns = requireProjectionRunStorage(dependencies.storage)\n try {\n const run = await requeueProjectionRun(projectionRuns, existing, queuedAt)\n return { publish: true, run, queuedAt, created: false }\n } catch (error) {\n if (!(error instanceof ProjectionRunError)) throw error\n const raced = await projectionRuns.getById({ projectId: existing.projectId, id: existing.id })\n if (\n !raced ||\n (raced.status === \"failed\" &&\n raced.error?.code === \"queue.enqueue_failed\" &&\n raced.error.retryable)\n ) {\n throw error\n }\n await assertExistingRun(dependencies.storage, raced, identity)\n return { publish: false, run: raced }\n }\n}\n\nasync function publishProjectionRun(\n dependencies: ProjectionRunDispatcherDependencies,\n metadata: Readonly<Record<string, string>> | undefined,\n persisted: Extract<PersistedProjectionRun, { readonly publish: true }>\n): Promise<ProjectionRunDispatchResult> {\n try {\n const [job] = await dependencies.queues.projections.enqueue({\n projectId: dependencies.id,\n jobs: [\n {\n id: persisted.run.id,\n type: \"projection.run.requested\",\n payload: { runId: persisted.run.id },\n ...(metadata === undefined ? {} : { metadata }),\n },\n ],\n })\n return {\n projectionId: persisted.run.identity.projectionId,\n runId: persisted.run.id,\n queuedAt: persisted.queuedAt.toISOString(),\n ...(job?.id ? { jobId: job.id } : {}),\n created: persisted.created,\n }\n } catch (error) {\n const failedAt = new Date()\n const failure = toEnqueueFailure(error, persisted.run, failedAt)\n const failed = await requireProjectionRunStorage(dependencies.storage).failEnqueue({\n projectId: dependencies.id,\n id: persisted.run.id,\n finishedAt: failedAt,\n error: failure,\n })\n reportRunFailure(dependencies, error, {\n projectId: dependencies.id,\n runKind: \"projection\",\n run: {\n runId: failed.id,\n projectionId: failed.identity.projectionId,\n projectionKind: failed.identity.projectionKind,\n },\n failure,\n })\n throw error\n }\n}\n\nasync function assertExistingRun(\n storage: Storage,\n run: ProjectionRunRecord,\n identity: ProjectionRunRecord[\"identity\"]\n): Promise<void> {\n assertProjectionRunIdentityMatches(run, identity)\n await assertProjectionRunDurableExecution({\n executions: storage.executions,\n projectId: run.projectId,\n executionId: run.executionId,\n runId: run.id,\n projectionId: run.identity.projectionId,\n datasetId: run.identity.datasetVersion.datasetId,\n datasetVersionId: run.identity.datasetVersion.versionId,\n })\n}\n\nasync function resolveProducerExecution(\n storage: Storage,\n projectId: string,\n producer:\n | {\n readonly kind: \"sync\" | \"pipeline\"\n readonly id?: string\n readonly runId?: string\n }\n | undefined\n): Promise<ExecutionRecord | null> {\n if (!producer?.runId) return null\n if (producer.kind === \"sync\") {\n const run = await storage.syncRuns?.getById({ projectId, id: producer.runId })\n if (!run) return null\n assertProducerId(producer, run.syncId)\n return requireProducerExecution({\n executions: storage.executions,\n projectId,\n executionId: run.executionId,\n primitive: { kind: \"sync\", id: run.syncId, runId: run.id },\n })\n }\n\n const run = await storage.pipelineRuns?.getById({ projectId, id: producer.runId })\n if (!run) return null\n assertProducerId(producer, run.pipelineId)\n return requireProducerExecution({\n executions: storage.executions,\n projectId,\n executionId: run.executionId,\n primitive: { kind: \"pipeline\", id: run.pipelineId, runId: run.id },\n })\n}\n\nasync function requireProducerExecution(input: {\n readonly executions: Storage[\"executions\"]\n readonly projectId: string\n readonly executionId: string\n readonly primitive:\n | { readonly kind: \"sync\"; readonly id: string; readonly runId: string }\n | { readonly kind: \"pipeline\"; readonly id: string; readonly runId: string }\n}): Promise<ExecutionRecord> {\n const execution = await findPrimitiveRunExecution({\n executions: input.executions,\n projectId: input.projectId,\n executionId: input.executionId,\n primitive: input.primitive,\n sourceTypes: [\"execution\", \"schedule\", \"event\"],\n })\n if (execution) return execution\n throw new ProjectionValidationError(\n `[Sixb] Dataset producer run '${input.primitive.runId}' references an invalid execution.`\n )\n}\n\nfunction assertProducerId(\n producer: { readonly kind: \"sync\" | \"pipeline\"; readonly id?: string; readonly runId?: string },\n runOwnerId: string\n): void {\n if (producer.id === undefined || producer.id === runOwnerId) return\n throw new ProjectionValidationError(\n `[Sixb] Dataset producer '${producer.kind}:${producer.id}' does not match run '${producer.runId}'.`\n )\n}\n\nfunction requireProjectionRunStorage(storage: Storage): NonNullable<Storage[\"projectionRuns\"]> {\n if (storage.projectionRuns) return storage.projectionRuns\n throw new ProjectionValidationError(\"[Sixb] Projection run storage is not configured.\")\n}\n\nfunction queueProjectionRun(\n storage: NonNullable<Storage[\"projectionRuns\"]>,\n input: {\n readonly id: string\n readonly projectId: string\n readonly executionId: string\n readonly identity: ProjectionRunRecord[\"identity\"]\n readonly projection: ProjectionDefinition\n readonly queuedAt: Date\n }\n): Promise<ProjectionRunRecord> {\n const common = {\n id: input.id,\n projectId: input.projectId,\n executionId: input.executionId,\n queuedAt: input.queuedAt,\n }\n switch (input.projection._tag) {\n case \"ObjectProjectionDefinition\":\n if (input.identity.projectionKind !== \"object\") {\n throw invalidProjectionDefinition(input.id)\n }\n return storage.queue({\n ...common,\n identity: input.identity,\n target: { objectTypeId: input.projection.objectTypeId },\n })\n case \"LinkProjectionDefinition\":\n if (input.identity.projectionKind !== \"link\") {\n throw invalidProjectionDefinition(input.id)\n }\n return storage.queue({\n ...common,\n identity: input.identity,\n target: {\n sourceObjectTypeId: input.projection.sourceObjectTypeId,\n targetObjectTypeId: input.projection.targetObjectTypeId,\n },\n })\n case \"TelemetryProjectionDefinition\":\n if (input.identity.projectionKind !== \"telemetry\") {\n throw invalidProjectionDefinition(input.id)\n }\n return storage.queue({\n ...common,\n identity: input.identity,\n target: { objectTypeId: input.projection.objectTypeId },\n fixedBatchSize: telemetryProjectionBatchRowCount(input.projection),\n })\n }\n}\n\nfunction telemetryProjectionBatchRowCount(\n projection: Extract<ProjectionDefinition, { readonly _tag: \"TelemetryProjectionDefinition\" }>\n): number {\n const mappedPropertyCount = Object.keys(projection.properties).length\n if (mappedPropertyCount === 0) throw invalidProjectionDefinition(projection.id)\n return Math.max(1, Math.floor(PROJECTION_TELEMETRY_BATCH_SIZE / mappedPropertyCount))\n}\n\nfunction requeueProjectionRun(\n storage: NonNullable<Storage[\"projectionRuns\"]>,\n run: ProjectionRunRecord,\n queuedAt: Date\n): Promise<ProjectionRunRecord> {\n const common = {\n id: run.id,\n projectId: run.projectId,\n executionId: run.executionId,\n queuedAt,\n }\n switch (run.identity.projectionKind) {\n case \"object\": {\n if (!(\"objectTypeId\" in run.target)) throw invalidProjectionDefinition(run.id)\n return storage.queue({ ...common, identity: run.identity, target: run.target })\n }\n case \"link\": {\n if (!(\"sourceObjectTypeId\" in run.target)) throw invalidProjectionDefinition(run.id)\n return storage.queue({ ...common, identity: run.identity, target: run.target })\n }\n case \"telemetry\": {\n if (!(\"objectTypeId\" in run.target) || !run.telemetryCheckpoint) {\n throw invalidProjectionDefinition(run.id)\n }\n return storage.queue({\n ...common,\n identity: run.identity,\n target: run.target,\n fixedBatchSize: run.telemetryCheckpoint.fixedBatchSize,\n })\n }\n }\n}\n\nfunction invalidProjectionDefinition(runId: string): ProjectionValidationError {\n return new ProjectionValidationError(\n `[Sixb] Projection run '${runId}' has inconsistent definition metadata.`\n )\n}\n\nfunction existingResult(run: ProjectionRunRecord): ProjectionRunDispatchResult {\n return {\n projectionId: run.identity.projectionId,\n runId: run.id,\n queuedAt: run.queuedAt.toISOString(),\n created: false,\n }\n}\n\nfunction assertDispatchInput(input: ProjectionRunDispatchInput): void {\n for (const [field, value] of [\n [\"projectionId\", input.projectionId],\n [\"datasetId\", input.datasetVersion.datasetId],\n [\"versionId\", input.datasetVersion.versionId],\n ] as const) {\n if (!value.trim())\n throw new ProjectionValidationError(`[Sixb] Projection ${field} is required.`)\n }\n const timestamp = Date.parse(input.datasetVersion.createdAt)\n if (\n !Number.isFinite(timestamp) ||\n new Date(timestamp).toISOString() !== input.datasetVersion.createdAt\n ) {\n throw new ProjectionValidationError(\"[Sixb] Projection dataset version timestamp is invalid.\")\n }\n}\n\nfunction toEnqueueFailure(\n error: unknown,\n run: ProjectionRunRecord,\n at: Date\n): SixbFailure<ProjectionRunFailureCode> {\n const enqueueError = createSixbError(\n \"queue.enqueue_failed\",\n `[Sixb] Could not enqueue Projection run '${run.id}'.`,\n {\n cause: error,\n details: {\n projectionId: run.identity.projectionId,\n projectionKind: run.identity.projectionKind,\n runId: run.id,\n phase: \"enqueue\",\n },\n }\n )\n return toSixbFailure(enqueueError, { allowedCodes: PROJECTION_RUN_FAILURE_CODES, at })\n}\n",
|
|
7
|
-
"import { sha256Canonical } from \"../materialization/identity\"\nimport type { ProjectionMaterializationIdentity } from \"../materialization/model\"\n\nexport function createProjectionRunId(\n projectId: string,\n identity: ProjectionMaterializationIdentity\n): string {\n return sha256Canonical({\n projectId,\n projectionId: identity.projectionId,\n projectionKind: identity.projectionKind,\n protocol: identity.protocol,\n datasetId: identity.datasetVersion.datasetId,\n versionId: identity.datasetVersion.versionId,\n createdAt: identity.datasetVersion.createdAt,\n ontologyRevision: identity.ontologyRevision,\n projectionRevision: identity.projectionRevision,\n ownershipHash: identity.ownershipHash,\n })\n}\n"
|
|
8
|
-
],
|
|
9
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,wBAAuC,OAAO,yBAAyB;AAMtE,SAAS,0BAA0B,CAAC,OAAe,UAAoC;AAAA,EAC5F,MAAM,aAAc,MAAkC;AAAA,EACtD,IAAI,cAAc,eAAe,UAAU;AAAA,IACzC,MAAM,IAAI,MAAM,kEAAkE;AAAA,EACpF;AAAA,EACA,OAAO,eAAe,OAAO,uBAAuB;AAAA,IAClD,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,UAAU;AAAA,EACZ,CAAC;AAAA;AAGI,SAAS,qBAAqB,CAAC,OAAmC;AAAA,EACvE,MAAM,WAAY,MAAkC;AAAA,EACpD,IAAI;AAAA,IAAU,OAAO;AAAA,EACrB,MAAM,IAAI,MAAM,gEAAgE;AAAA;AAG3E,SAAS,gCAA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