@sixb/core 0.1.1 → 0.1.3
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/README.md +31 -20
- package/dist/actions/commit-edits.d.ts +0 -2
- package/dist/actions/commit-edits.d.ts.map +1 -1
- package/dist/actions/execution.d.ts +21 -0
- package/dist/actions/execution.d.ts.map +1 -0
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +38 -24
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/registry.d.ts +16 -7
- package/dist/actions/registry.d.ts.map +1 -1
- package/dist/actions/request.d.ts +3 -2
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run-dispatch.d.ts +21 -0
- package/dist/actions/run-dispatch.d.ts.map +1 -0
- package/dist/actions/types/context.d.ts +2 -2
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/actions/validation.d.ts +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/actions/worker.js +7 -7
- package/dist/actions/worker.js.map +1 -1
- package/dist/agents/adapters.d.ts +21 -1
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/authority.d.ts +31 -0
- package/dist/agents/authority.d.ts.map +1 -0
- package/dist/agents/context.js +2 -2
- package/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +2 -2
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +48 -0
- package/dist/agents/execution.d.ts.map +1 -0
- package/dist/agents/index.d.ts +12 -9
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +77 -18
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/prompt.d.ts +8 -2
- package/dist/agents/prompt.d.ts.map +1 -1
- package/dist/agents/request.d.ts +6 -2
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/streams.d.ts +29 -3
- package/dist/agents/streams.d.ts.map +1 -1
- package/dist/agents/streams.js +22 -3
- package/dist/agents/streams.js.map +1 -1
- package/dist/agents/thread-context-projection.d.ts +19 -0
- package/dist/agents/thread-context-projection.d.ts.map +1 -0
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/tool-result.d.ts +6 -0
- package/dist/agents/tool-result.d.ts.map +1 -0
- package/dist/agents/types.d.ts +39 -3
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +3 -3
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/auth/attribution.d.ts +17 -0
- package/dist/auth/attribution.d.ts.map +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +11 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +4 -4
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/authorization/decision.d.ts +24 -11
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +2 -1
- 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 +8 -4
- package/dist/authorization/index.js.map +1 -1
- package/dist/blob-storage/browser.js +2 -2
- package/dist/blob-storage/execution.d.ts +16 -0
- package/dist/blob-storage/execution.d.ts.map +1 -0
- package/dist/blob-storage/index.js +3 -3
- package/dist/bootstrap/discovery.d.ts +90 -24
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.d.ts +2 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +63 -60
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/broker/in-memory.d.ts.map +1 -1
- package/dist/broker/index.js +2 -2
- package/dist/broker/types.d.ts +5 -0
- package/dist/broker/types.d.ts.map +1 -1
- package/dist/chunk-0172wgm9.js +333 -0
- package/dist/chunk-0172wgm9.js.map +11 -0
- package/dist/chunk-177ed2mp.js +3118 -0
- package/dist/chunk-177ed2mp.js.map +46 -0
- package/dist/chunk-1ywq4hzk.js +607 -0
- package/dist/chunk-1ywq4hzk.js.map +14 -0
- package/dist/chunk-261ag4t4.js +252 -0
- package/dist/chunk-261ag4t4.js.map +12 -0
- package/dist/{chunk-y2ygpd0m.js → chunk-3j7573mj.js} +2 -2
- package/dist/{chunk-y2ygpd0m.js.map → chunk-3j7573mj.js.map} +2 -2
- package/dist/{chunk-p7vj8xgb.js → chunk-3rsf30p4.js} +81 -58
- package/dist/chunk-3rsf30p4.js.map +35 -0
- package/dist/chunk-4aw0jwk0.js +118 -0
- package/dist/chunk-4aw0jwk0.js.map +10 -0
- package/dist/{chunk-md9jbrm9.js → chunk-4gz41why.js} +1 -1
- package/dist/chunk-4p9rh7jj.js +164 -0
- package/dist/chunk-4p9rh7jj.js.map +12 -0
- package/dist/chunk-4z3n1dzt.js +1206 -0
- package/dist/chunk-4z3n1dzt.js.map +23 -0
- package/dist/chunk-5gd7tpv6.js +28 -0
- package/dist/chunk-5gd7tpv6.js.map +11 -0
- package/dist/{chunk-867jxh7c.js → chunk-5sz8ta9r.js} +6 -295
- package/dist/chunk-5sz8ta9r.js.map +16 -0
- package/dist/chunk-62c7t4jc.js +27 -0
- package/dist/chunk-62c7t4jc.js.map +11 -0
- package/dist/chunk-63te770v.js.map +1 -1
- package/dist/{chunk-xz5g49bp.js → chunk-6gjqgd3d.js} +3 -1
- package/dist/chunk-6gjqgd3d.js.map +11 -0
- package/dist/{chunk-6rzdtvn5.js → chunk-8b55ygje.js} +1 -1
- package/dist/chunk-8m5ejdpn.js +33 -0
- package/dist/chunk-8m5ejdpn.js.map +10 -0
- package/dist/chunk-96swp2wd.js +47 -0
- package/dist/chunk-96swp2wd.js.map +10 -0
- package/dist/chunk-979ww6b3.js +298 -0
- package/dist/chunk-979ww6b3.js.map +12 -0
- package/dist/{chunk-ya6brh8a.js → chunk-9t8f5xfx.js} +10 -5
- package/dist/chunk-9t8f5xfx.js.map +11 -0
- package/dist/{chunk-r82k4z7z.js → chunk-a31h57d5.js} +2 -2
- package/dist/{chunk-t72dvahb.js → chunk-bhxaq2nn.js} +61 -44
- package/dist/chunk-bhxaq2nn.js.map +12 -0
- package/dist/chunk-bv41fmjn.js +3294 -0
- package/dist/chunk-bv41fmjn.js.map +35 -0
- package/dist/chunk-c6cfqydk.js +128 -0
- package/dist/chunk-c6cfqydk.js.map +13 -0
- package/dist/chunk-c8bw2b6c.js +317 -0
- package/dist/chunk-c8bw2b6c.js.map +11 -0
- package/dist/{chunk-qzyemcj7.js → chunk-ckxfnx7f.js} +2 -2
- package/dist/chunk-cy0n5dms.js +27 -0
- package/dist/chunk-cy0n5dms.js.map +11 -0
- package/dist/{chunk-xt6qx9sh.js → chunk-d2adj15j.js} +91 -9
- package/dist/chunk-d2adj15j.js.map +37 -0
- package/dist/{chunk-avppcgt6.js → chunk-d6y2wsfg.js} +241 -144
- package/dist/chunk-d6y2wsfg.js.map +15 -0
- package/dist/chunk-dsrkgtnh.js +50 -0
- package/dist/chunk-dsrkgtnh.js.map +10 -0
- package/dist/{chunk-50kv63vj.js → chunk-dysw7nsm.js} +118 -26
- package/dist/chunk-dysw7nsm.js.map +14 -0
- package/dist/{chunk-rjqm6ksg.js → chunk-ettb0cy4.js} +725 -266
- package/dist/chunk-ettb0cy4.js.map +45 -0
- package/dist/chunk-ezake7g1.js +32 -0
- package/dist/chunk-ezake7g1.js.map +11 -0
- package/dist/{chunk-b1bqvhpe.js → chunk-f1cyvnrk.js} +14 -34
- package/dist/chunk-f1cyvnrk.js.map +13 -0
- package/dist/{chunk-yn947ck3.js → chunk-f2rt4vkh.js} +48 -29
- package/dist/chunk-f2rt4vkh.js.map +14 -0
- package/dist/{chunk-hb9xcx9c.js → chunk-fmx1sz2h.js} +117 -56
- package/dist/chunk-fmx1sz2h.js.map +15 -0
- package/dist/{chunk-f6kyyeef.js → chunk-ghteq96b.js} +8 -8
- package/dist/{chunk-f6kyyeef.js.map → chunk-ghteq96b.js.map} +4 -4
- package/dist/chunk-h9kxd41f.js +271 -0
- package/dist/chunk-h9kxd41f.js.map +11 -0
- package/dist/chunk-htq0qh7z.js +59 -0
- package/dist/chunk-htq0qh7z.js.map +11 -0
- package/dist/chunk-km4rkj4t.js +402 -0
- package/dist/chunk-km4rkj4t.js.map +14 -0
- package/dist/chunk-kqxgf6kv.js +898 -0
- package/dist/chunk-kqxgf6kv.js.map +15 -0
- package/dist/chunk-n5x5y80a.js +137 -0
- package/dist/chunk-n5x5y80a.js.map +10 -0
- package/dist/chunk-nf4r78r4.js +44 -0
- package/dist/chunk-nf4r78r4.js.map +10 -0
- package/dist/chunk-pxtrxm3p.js +55 -0
- package/dist/chunk-pxtrxm3p.js.map +11 -0
- package/dist/chunk-qer6am8w.js +133 -0
- package/dist/chunk-qer6am8w.js.map +11 -0
- package/dist/{chunk-sb0shdvv.js → chunk-rdeagz6b.js} +3 -3
- package/dist/{chunk-sb0shdvv.js.map → chunk-rdeagz6b.js.map} +3 -3
- package/dist/chunk-rhrbz7d4.js +36 -0
- package/dist/chunk-rhrbz7d4.js.map +10 -0
- package/dist/{chunk-53s4asfm.js → chunk-rnshztfq.js} +2 -2
- package/dist/chunk-t0jjkep3.js +35 -0
- package/dist/chunk-t0jjkep3.js.map +10 -0
- package/dist/{chunk-be9vm29v.js → chunk-t8t39h7v.js} +1 -1
- package/dist/{chunk-be9vm29v.js.map → chunk-t8t39h7v.js.map} +3 -3
- package/dist/chunk-t9xghkva.js +28 -0
- package/dist/chunk-t9xghkva.js.map +10 -0
- package/dist/{chunk-nbywkytr.js → chunk-ttba8x6z.js} +13 -33
- package/dist/chunk-ttba8x6z.js.map +15 -0
- package/dist/{chunk-8kv2sez0.js → chunk-vybf6pkp.js} +1 -1
- package/dist/chunk-wb4051cx.js +404 -0
- package/dist/chunk-wb4051cx.js.map +12 -0
- package/dist/{chunk-4tvj3ate.js → chunk-wtmzkcht.js} +4 -3
- package/dist/chunk-wtmzkcht.js.map +11 -0
- package/dist/{chunk-xqbtf4wn.js → chunk-xc7hq65b.js} +5 -3
- package/dist/{chunk-xqbtf4wn.js.map → chunk-xc7hq65b.js.map} +3 -3
- package/dist/{chunk-v5c085yp.js → chunk-xhy826cz.js} +3 -2
- package/dist/chunk-xhy826cz.js.map +10 -0
- package/dist/chunk-xkthy56g.js +33 -0
- package/dist/chunk-xkthy56g.js.map +11 -0
- package/dist/{chunk-raq0x6bd.js → chunk-xmggaxg4.js} +2199 -380
- package/dist/chunk-xmggaxg4.js.map +54 -0
- package/dist/{chunk-6zrpewy4.js → chunk-z3zp0bj1.js} +1 -1
- package/dist/chunk-z8j83gzd.js +90 -0
- package/dist/chunk-z8j83gzd.js.map +10 -0
- package/dist/chunk-zcnhxkvd.js +7 -0
- package/dist/chunk-zcnhxkvd.js.map +10 -0
- package/dist/chunk-zpw39qhj.js +194 -0
- package/dist/chunk-zpw39qhj.js.map +10 -0
- package/dist/chunk-zqqz8052.js +3 -0
- package/dist/{storage/projection-runs/lifecycle.js.map → chunk-zqqz8052.js.map} +1 -1
- package/dist/{chunk-hz8m927w.js → chunk-zqysyfjt.js} +1 -1
- package/dist/connectors/builders.d.ts +2 -1
- package/dist/connectors/builders.d.ts.map +1 -1
- package/dist/connectors/connections/authorizations.d.ts +64 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -0
- package/dist/connectors/connections/capability.d.ts +7 -0
- package/dist/connectors/connections/capability.d.ts.map +1 -0
- package/dist/connectors/connections/command-context.d.ts +23 -0
- package/dist/connectors/connections/command-context.d.ts.map +1 -0
- package/dist/connectors/connections/contracts.d.ts +127 -0
- package/dist/connectors/connections/contracts.d.ts.map +1 -0
- package/dist/connectors/connections/credential-codec.d.ts +15 -0
- package/dist/connectors/connections/credential-codec.d.ts.map +1 -0
- package/dist/connectors/connections/credential-mutations.d.ts +63 -0
- package/dist/connectors/connections/credential-mutations.d.ts.map +1 -0
- package/dist/connectors/connections/execution.d.ts +20 -0
- package/dist/connectors/connections/execution.d.ts.map +1 -0
- package/dist/connectors/connections/internal.d.ts +5 -0
- package/dist/connectors/connections/internal.d.ts.map +1 -0
- package/dist/connectors/connections/internal.js +16 -0
- package/dist/connectors/connections/internal.js.map +9 -0
- package/dist/connectors/connections/provider-operation.d.ts +7 -0
- package/dist/connectors/connections/provider-operation.d.ts.map +1 -0
- package/dist/connectors/connections/request.d.ts +84 -0
- package/dist/connectors/connections/request.d.ts.map +1 -0
- package/dist/connectors/connections/runs.d.ts +51 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -0
- package/dist/connectors/connections/service.d.ts +52 -0
- package/dist/connectors/connections/service.d.ts.map +1 -0
- package/dist/connectors/connections/storage-boundary.d.ts +3 -0
- package/dist/connectors/connections/storage-boundary.d.ts.map +1 -0
- package/dist/connectors/connections/tokens.d.ts +32 -0
- package/dist/connectors/connections/tokens.d.ts.map +1 -0
- package/dist/connectors/connections/validation.d.ts +27 -0
- package/dist/connectors/connections/validation.d.ts.map +1 -0
- package/dist/connectors/connections/views.d.ts +7 -0
- package/dist/connectors/connections/views.d.ts.map +1 -0
- package/dist/connectors/credentials.d.ts +25 -0
- package/dist/connectors/credentials.d.ts.map +1 -0
- package/dist/connectors/errors.d.ts +35 -3
- package/dist/connectors/errors.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts +19 -0
- package/dist/connectors/execution.d.ts.map +1 -0
- package/dist/connectors/index.d.ts +5 -3
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/service.d.ts +23 -0
- package/dist/connectors/service.d.ts.map +1 -0
- package/dist/connectors/types.d.ts +94 -2
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/execution.d.ts +8 -0
- package/dist/datasets/execution.d.ts.map +1 -0
- package/dist/error-reporting/capability.d.ts +4 -49
- package/dist/error-reporting/capability.d.ts.map +1 -1
- package/dist/error-reporting/internal.d.ts +2 -2
- package/dist/error-reporting/internal.d.ts.map +1 -1
- package/dist/error-reporting/internal.js +10 -4
- package/dist/error-reporting/internal.js.map +1 -1
- package/dist/error-reporting/reporter.d.ts +4 -1
- package/dist/error-reporting/reporter.d.ts.map +1 -1
- package/dist/error-reporting/reports.d.ts +64 -0
- package/dist/error-reporting/reports.d.ts.map +1 -0
- package/dist/error-reporting/types.d.ts +88 -34
- package/dist/error-reporting/types.d.ts.map +1 -1
- package/dist/errors/catalog.d.ts +141 -0
- package/dist/errors/catalog.d.ts.map +1 -0
- package/dist/errors/internal.d.ts +68 -0
- package/dist/errors/internal.d.ts.map +1 -0
- package/dist/errors/internal.js +29 -0
- package/dist/errors/internal.js.map +9 -0
- package/dist/errors/types.d.ts +20 -0
- package/dist/errors/types.d.ts.map +1 -0
- package/dist/events/definitions.d.ts +0 -1
- package/dist/events/definitions.d.ts.map +1 -1
- package/dist/events/execution.d.ts +13 -0
- package/dist/events/execution.d.ts.map +1 -0
- package/dist/events/index.d.ts +3 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +10 -8
- package/dist/events/index.js.map +1 -1
- package/dist/events/outbox-dispatcher.d.ts +4 -2
- package/dist/events/outbox-dispatcher.d.ts.map +1 -1
- package/dist/events/{runtime.d.ts → service.d.ts} +13 -14
- package/dist/events/service.d.ts.map +1 -0
- package/dist/events/types/pipelines.d.ts +4 -1
- package/dist/events/types/pipelines.d.ts.map +1 -1
- package/dist/events/types/syncs.d.ts +3 -0
- package/dist/events/types/syncs.d.ts.map +1 -1
- package/dist/events/types/workflows.d.ts +4 -2
- package/dist/events/types/workflows.d.ts.map +1 -1
- package/dist/execution/agent.d.ts +42 -0
- package/dist/execution/agent.d.ts.map +1 -0
- package/dist/execution/agent.js +73 -0
- package/dist/execution/agent.js.map +9 -0
- package/dist/execution/authorization.d.ts +60 -0
- package/dist/execution/authorization.d.ts.map +1 -0
- package/dist/execution/dispatch.d.ts +8 -0
- package/dist/execution/dispatch.d.ts.map +1 -0
- package/dist/execution/durable.d.ts +37 -0
- package/dist/execution/durable.d.ts.map +1 -0
- package/dist/execution/index.d.ts +2 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/primitive.d.ts +21 -0
- package/dist/execution/primitive.d.ts.map +1 -0
- package/dist/execution/primitive.js +91 -0
- package/dist/execution/primitive.js.map +10 -0
- package/dist/execution/request.d.ts +38 -0
- package/dist/execution/request.d.ts.map +1 -0
- package/dist/execution/request.js +100 -0
- package/dist/execution/request.js.map +10 -0
- package/dist/execution/scopes.d.ts +30 -0
- package/dist/execution/scopes.d.ts.map +1 -0
- package/dist/execution/types.d.ts +111 -0
- package/dist/execution/types.d.ts.map +1 -0
- package/dist/index.d.ts +31 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +133 -105
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +0 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/lake-storage/index.js +5 -5
- package/dist/logging/execution.d.ts +9 -0
- package/dist/logging/execution.d.ts.map +1 -0
- package/dist/logging/index.d.ts +1 -1
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/logging/index.js +8 -8
- package/dist/logging/index.js.map +1 -1
- package/dist/logging/{runtime.d.ts → service.d.ts} +7 -7
- package/dist/logging/{runtime.d.ts.map → service.d.ts.map} +1 -1
- package/dist/logging/types.js +2 -2
- package/dist/materialization/events.d.ts +1 -0
- package/dist/materialization/events.d.ts.map +1 -1
- package/dist/materialization/index.d.ts +1 -1
- package/dist/materialization/index.d.ts.map +1 -1
- package/dist/materialization/index.js +2 -2
- package/dist/materialization/model.d.ts +30 -17
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/edits/apply.d.ts +6 -1
- package/dist/materializer/edits/apply.d.ts.map +1 -1
- package/dist/materializer/edits/commit.d.ts +2 -1
- package/dist/materializer/edits/commit.d.ts.map +1 -1
- package/dist/materializer/edits/load-state.d.ts +1 -1
- package/dist/materializer/edits/load-state.d.ts.map +1 -1
- package/dist/materializer/edits/operations.d.ts +1 -13
- package/dist/materializer/edits/operations.d.ts.map +1 -1
- package/dist/materializer/edits/plan.d.ts +2 -1
- package/dist/materializer/edits/plan.d.ts.map +1 -1
- package/dist/materializer/edits/working-state.d.ts +38 -8
- package/dist/materializer/edits/working-state.d.ts.map +1 -1
- package/dist/materializer/effective/build-events.d.ts +1 -0
- package/dist/materializer/effective/build-events.d.ts.map +1 -1
- package/dist/materializer/effective/diff.d.ts +7 -0
- package/dist/materializer/effective/diff.d.ts.map +1 -1
- package/dist/materializer/effective/load-state.d.ts +0 -2
- package/dist/materializer/effective/load-state.d.ts.map +1 -1
- package/dist/materializer/effective/resolve.d.ts +19 -2
- package/dist/materializer/effective/resolve.d.ts.map +1 -1
- package/dist/materializer/execution/commit-lifecycle.d.ts +2 -2
- package/dist/materializer/execution/commit-lifecycle.d.ts.map +1 -1
- package/dist/materializer/execution/plan-stream.d.ts.map +1 -1
- package/dist/materializer/execution/scope.d.ts +26 -0
- package/dist/materializer/execution/scope.d.ts.map +1 -0
- package/dist/materializer/execution/work-executor.d.ts.map +1 -1
- package/dist/materializer/execution/work-records.d.ts +6 -5
- package/dist/materializer/execution/work-records.d.ts.map +1 -1
- package/dist/materializer/index.d.ts +2 -2
- package/dist/materializer/index.d.ts.map +1 -1
- package/dist/materializer/index.js +33 -18
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/materializer.d.ts +37 -5
- package/dist/materializer/materializer.d.ts.map +1 -1
- package/dist/materializer/projections/finish-run.d.ts +2 -1
- package/dist/materializer/projections/finish-run.d.ts.map +1 -1
- package/dist/materializer/projections/replace.d.ts +2 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +1 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/batching.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/materializer/telemetry/append.d.ts +2 -1
- package/dist/materializer/telemetry/append.d.ts.map +1 -1
- package/dist/materializer/telemetry/plan.d.ts +7 -1
- package/dist/materializer/telemetry/plan.d.ts.map +1 -1
- package/dist/objects/action/request.d.ts +3 -3
- package/dist/objects/action/request.d.ts.map +1 -1
- package/dist/objects/context/index.d.ts +1 -1
- package/dist/objects/context/index.d.ts.map +1 -1
- package/dist/objects/context/types.d.ts +5 -0
- package/dist/objects/context/types.d.ts.map +1 -1
- package/dist/objects/execution.d.ts +100 -0
- package/dist/objects/execution.d.ts.map +1 -0
- package/dist/objects/index.js +40 -24
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/materializer-adapter.d.ts +1 -1
- package/dist/objects/materializer-adapter.d.ts.map +1 -1
- package/dist/objects/query/executor.d.ts +3 -8
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +2 -2
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +9 -13
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/planner.d.ts +0 -3
- package/dist/objects/query/planner.d.ts.map +1 -1
- package/dist/objects/sdk/object-handle.d.ts +2 -2
- package/dist/objects/sdk/object-handle.d.ts.map +1 -1
- package/dist/objects/sdk/object-set.d.ts +2 -0
- package/dist/objects/sdk/object-set.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts +2 -0
- 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/action-service.d.ts +3 -2
- package/dist/objects/service/action-service.d.ts.map +1 -1
- package/dist/objects/service/list-service.d.ts +1 -1
- package/dist/objects/telemetry/history.d.ts +2 -0
- package/dist/objects/telemetry/history.d.ts.map +1 -1
- package/dist/objects/telemetry/write-batch.d.ts.map +1 -1
- package/dist/ontology/index.d.ts +1 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +5 -5
- package/dist/ontology/internal.js +4 -4
- package/dist/ontology/registry.d.ts +15 -2
- package/dist/ontology/registry.d.ts.map +1 -1
- package/dist/pipelines/execution.d.ts +19 -0
- package/dist/pipelines/execution.d.ts.map +1 -0
- package/dist/pipelines/index.d.ts +1 -0
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pipelines/index.js +68 -0
- package/dist/pipelines/index.js.map +9 -0
- package/dist/pipelines/request.d.ts +6 -9
- package/dist/pipelines/request.d.ts.map +1 -1
- package/dist/pipelines/run-dispatch.d.ts +47 -0
- package/dist/pipelines/run-dispatch.d.ts.map +1 -0
- package/dist/projections/builders.d.ts +19 -8
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/capability.d.ts +7 -0
- package/dist/projections/capability.d.ts.map +1 -0
- package/dist/projections/execution.d.ts +19 -0
- package/dist/projections/execution.d.ts.map +1 -0
- package/dist/projections/index.d.ts +5 -2
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.d.ts +8 -11
- package/dist/projections/internal.d.ts.map +1 -1
- package/dist/projections/internal.js +48 -6
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/ownership.d.ts +2 -2
- package/dist/projections/ownership.d.ts.map +1 -1
- package/dist/projections/registry.d.ts +21 -11
- package/dist/projections/registry.d.ts.map +1 -1
- package/dist/projections/revision.d.ts +2 -2
- package/dist/projections/revision.d.ts.map +1 -1
- package/dist/projections/run-dispatch.d.ts +37 -0
- package/dist/projections/run-dispatch.d.ts.map +1 -0
- package/dist/projections/run-id.d.ts +3 -0
- package/dist/projections/run-id.d.ts.map +1 -0
- package/dist/projections/timestamp.d.ts +3 -0
- package/dist/projections/timestamp.d.ts.map +1 -0
- package/dist/projections/types.d.ts +12 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts +2 -2
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +11 -10
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +59 -42
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/rules/execution.d.ts +14 -0
- package/dist/rules/execution.d.ts.map +1 -0
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/validation.d.ts +1 -2
- package/dist/rules/validation.d.ts.map +1 -1
- package/dist/runtime/ai-cost.d.ts +8 -0
- package/dist/runtime/ai-cost.d.ts.map +1 -0
- package/dist/runtime/ai-usage.d.ts +8 -0
- package/dist/runtime/ai-usage.d.ts.map +1 -0
- package/dist/runtime/create.d.ts +7 -5
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +35 -0
- package/dist/runtime/definitions.d.ts.map +1 -0
- package/dist/runtime/host.d.ts +123 -0
- package/dist/runtime/host.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +6 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +4 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +6 -2
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/ontology-mutations.d.ts +4 -2
- package/dist/runtime/ontology-mutations.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +42 -0
- package/dist/runtime/resolve-definitions.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +43 -219
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +16 -216
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts +1 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +3 -6
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/runtime.d.ts +7 -2
- package/dist/scheduler/runtime.d.ts.map +1 -1
- package/dist/schedules/execution.d.ts +6 -0
- package/dist/schedules/execution.d.ts.map +1 -0
- package/dist/schedules/index.js +9 -7
- package/dist/schedules/index.js.map +1 -1
- package/dist/schedules/types.d.ts +1 -3
- package/dist/schedules/types.d.ts.map +1 -1
- package/dist/security/every.d.ts +4 -1
- package/dist/security/every.d.ts.map +1 -1
- package/dist/security/grants.d.ts +4 -1
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +3 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/registry.d.ts +42 -0
- package/dist/security/registry.d.ts.map +1 -0
- package/dist/security/types.d.ts +7 -12
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts +2 -0
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/storage/action-runs/failure.d.ts +7 -0
- package/dist/storage/action-runs/failure.d.ts.map +1 -0
- package/dist/storage/action-runs/failure.js +14 -0
- package/dist/storage/action-runs/failure.js.map +9 -0
- package/dist/storage/action-runs/idempotency.d.ts.map +1 -1
- package/dist/storage/action-runs/in-memory.d.ts +3 -1
- package/dist/storage/action-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/action-runs/index.d.ts +2 -1
- package/dist/storage/action-runs/index.d.ts.map +1 -1
- package/dist/storage/action-runs/provider.d.ts +10 -0
- package/dist/storage/action-runs/provider.d.ts.map +1 -0
- package/dist/storage/action-runs/provider.js +13 -0
- package/dist/storage/action-runs/provider.js.map +9 -0
- package/dist/storage/action-runs/types.d.ts +37 -18
- package/dist/storage/action-runs/types.d.ts.map +1 -1
- 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 +22 -5
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +2 -2
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +41 -0
- package/dist/storage/agents/provider.d.ts.map +1 -0
- package/dist/storage/agents/provider.js +28 -0
- package/dist/storage/agents/provider.js.map +9 -0
- package/dist/storage/agents/types.d.ts +83 -26
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +61 -0
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -0
- package/dist/storage/ai-cost/codec.d.ts +14 -0
- package/dist/storage/ai-cost/codec.d.ts.map +1 -0
- package/dist/storage/ai-cost/errors.d.ts +7 -0
- package/dist/storage/ai-cost/errors.d.ts.map +1 -0
- package/dist/storage/ai-cost/in-memory.d.ts +32 -0
- package/dist/storage/ai-cost/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-cost/index.d.ts +6 -0
- package/dist/storage/ai-cost/index.d.ts.map +1 -0
- package/dist/storage/ai-cost/provider.d.ts +7 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -0
- package/dist/storage/ai-cost/provider.js +132 -0
- package/dist/storage/ai-cost/provider.js.map +10 -0
- package/dist/storage/ai-cost/types.d.ts +154 -0
- package/dist/storage/ai-cost/types.d.ts.map +1 -0
- package/dist/storage/ai-cost/validation.d.ts +7 -0
- package/dist/storage/ai-cost/validation.d.ts.map +1 -0
- package/dist/storage/ai-usage/errors.d.ts +8 -0
- package/dist/storage/ai-usage/errors.d.ts.map +1 -0
- package/dist/storage/ai-usage/in-memory.d.ts +28 -0
- package/dist/storage/ai-usage/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-usage/index.d.ts +8 -0
- package/dist/storage/ai-usage/index.d.ts.map +1 -0
- package/dist/storage/ai-usage/record.d.ts +6 -0
- package/dist/storage/ai-usage/record.d.ts.map +1 -0
- package/dist/storage/ai-usage/types.d.ts +89 -0
- package/dist/storage/ai-usage/types.d.ts.map +1 -0
- package/dist/storage/ai-usage/usage.d.ts +11 -0
- package/dist/storage/ai-usage/usage.d.ts.map +1 -0
- package/dist/storage/auth/types.d.ts +1 -0
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/errors.d.ts +12 -0
- package/dist/storage/connector-connections/errors.d.ts.map +1 -0
- package/dist/storage/connector-connections/in-memory.d.ts +81 -0
- package/dist/storage/connector-connections/in-memory.d.ts.map +1 -0
- package/dist/storage/connector-connections/index.d.ts +7 -0
- package/dist/storage/connector-connections/index.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider/authorizations.d.ts +20 -0
- package/dist/storage/connector-connections/provider/authorizations.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider/connections.d.ts +17 -0
- package/dist/storage/connector-connections/provider/connections.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider/runs.d.ts +14 -0
- package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider/shared.d.ts +74 -0
- package/dist/storage/connector-connections/provider/shared.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider.d.ts +49 -0
- package/dist/storage/connector-connections/provider.d.ts.map +1 -0
- package/dist/storage/connector-connections/provider.js +1025 -0
- package/dist/storage/connector-connections/provider.js.map +14 -0
- package/dist/storage/connector-connections/types.d.ts +402 -0
- package/dist/storage/connector-connections/types.d.ts.map +1 -0
- package/dist/storage/executions/errors.d.ts +8 -0
- package/dist/storage/executions/errors.d.ts.map +1 -0
- package/dist/storage/executions/in-memory.d.ts +21 -0
- package/dist/storage/executions/in-memory.d.ts.map +1 -0
- package/dist/storage/executions/index.d.ts +5 -0
- package/dist/storage/executions/index.d.ts.map +1 -0
- package/dist/storage/executions/provider.d.ts +29 -0
- package/dist/storage/executions/provider.d.ts.map +1 -0
- package/dist/storage/executions/provider.js +208 -0
- package/dist/storage/executions/provider.js.map +10 -0
- package/dist/storage/executions/run-link.d.ts +24 -0
- package/dist/storage/executions/run-link.d.ts.map +1 -0
- package/dist/storage/executions/types.d.ts +62 -0
- package/dist/storage/executions/types.d.ts.map +1 -0
- package/dist/storage/executions/validation.d.ts +13 -0
- package/dist/storage/executions/validation.d.ts.map +1 -0
- package/dist/storage/in-memory/index.d.ts +25 -5
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +30 -17
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +99 -29
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/ontology/commits.d.ts +1 -0
- package/dist/storage/ontology/commits.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/index.d.ts +1 -0
- package/dist/storage/ontology/in-memory/index.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations-state.d.ts +3 -2
- package/dist/storage/ontology/in-memory/materializations-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations-work.d.ts +2 -2
- package/dist/storage/ontology/in-memory/materializations-work.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts +3 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/shared-state.d.ts +7 -2
- package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
- package/dist/storage/ontology/index.d.ts +3 -2
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/materializations.d.ts +53 -5
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/outbox.d.ts +8 -2
- package/dist/storage/ontology/outbox.d.ts.map +1 -1
- package/dist/storage/ontology/provider-work.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +5 -22
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +6 -7
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/pipeline-runs/idempotency.d.ts +3 -0
- package/dist/storage/pipeline-runs/idempotency.d.ts.map +1 -0
- package/dist/storage/pipeline-runs/in-memory.d.ts +5 -1
- package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/index.d.ts +3 -1
- package/dist/storage/pipeline-runs/index.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/provider.d.ts +10 -0
- package/dist/storage/pipeline-runs/provider.d.ts.map +1 -0
- package/dist/storage/pipeline-runs/provider.js +11 -0
- package/dist/storage/pipeline-runs/provider.js.map +9 -0
- package/dist/storage/pipeline-runs/types.d.ts +30 -14
- package/dist/storage/pipeline-runs/types.d.ts.map +1 -1
- package/dist/storage/projection-runs/in-memory.d.ts +8 -3
- package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/projection-runs/index.d.ts +2 -2
- package/dist/storage/projection-runs/index.d.ts.map +1 -1
- package/dist/storage/projection-runs/lifecycle.d.ts +14 -8
- package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
- package/dist/storage/projection-runs/provider.d.ts +13 -0
- package/dist/storage/projection-runs/provider.d.ts.map +1 -0
- package/dist/storage/projection-runs/{lifecycle.js → provider.js} +15 -4
- package/dist/storage/projection-runs/provider.js.map +9 -0
- package/dist/storage/projection-runs/types.d.ts +28 -11
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/storage/run-listing.d.ts +8 -9
- package/dist/storage/run-listing.d.ts.map +1 -1
- package/dist/storage/sync-runs/idempotency.d.ts +3 -0
- package/dist/storage/sync-runs/idempotency.d.ts.map +1 -0
- package/dist/storage/sync-runs/in-memory.d.ts +5 -1
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/sync-runs/index.d.ts +3 -1
- package/dist/storage/sync-runs/index.d.ts.map +1 -1
- package/dist/storage/sync-runs/provider.d.ts +10 -0
- package/dist/storage/sync-runs/provider.d.ts.map +1 -0
- package/dist/storage/sync-runs/provider.js +11 -0
- package/dist/storage/sync-runs/provider.js.map +9 -0
- package/dist/storage/sync-runs/types.d.ts +28 -11
- package/dist/storage/sync-runs/types.d.ts.map +1 -1
- package/dist/storage/types.d.ts +22 -15
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/webhook-runs/errors.d.ts +3 -0
- package/dist/storage/webhook-runs/errors.d.ts.map +1 -1
- package/dist/storage/webhook-runs/in-memory.d.ts +13 -1
- package/dist/storage/webhook-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/webhook-runs/index.d.ts +3 -2
- package/dist/storage/webhook-runs/index.d.ts.map +1 -1
- package/dist/storage/webhook-runs/provider.d.ts +10 -0
- package/dist/storage/webhook-runs/provider.d.ts.map +1 -0
- package/dist/storage/webhook-runs/provider.js +11 -0
- package/dist/storage/webhook-runs/provider.js.map +9 -0
- package/dist/storage/webhook-runs/types.d.ts +37 -11
- package/dist/storage/webhook-runs/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/in-memory.d.ts +6 -2
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/workflow-runs/index.d.ts +2 -1
- package/dist/storage/workflow-runs/index.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.d.ts +19 -0
- package/dist/storage/workflow-runs/provider.d.ts.map +1 -0
- package/dist/storage/workflow-runs/provider.js +20 -0
- package/dist/storage/workflow-runs/provider.js.map +9 -0
- package/dist/storage/workflow-runs/types.d.ts +28 -30
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/execution.d.ts +18 -0
- package/dist/syncs/execution.d.ts.map +1 -0
- package/dist/syncs/index.d.ts +3 -1
- package/dist/syncs/index.d.ts.map +1 -1
- package/dist/syncs/index.js +67 -0
- package/dist/syncs/index.js.map +9 -0
- package/dist/syncs/request.d.ts +6 -16
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/syncs/run-dispatch.d.ts +47 -0
- package/dist/syncs/run-dispatch.d.ts.map +1 -0
- package/dist/syncs/sources.d.ts +8 -0
- package/dist/syncs/sources.d.ts.map +1 -0
- package/dist/syncs/types.d.ts +16 -9
- package/dist/syncs/types.d.ts.map +1 -1
- package/dist/testing/action-execution.d.ts +12 -0
- package/dist/testing/action-execution.d.ts.map +1 -0
- package/dist/testing/agent-execution.d.ts +14 -0
- package/dist/testing/agent-execution.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts +12 -4
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts +12 -0
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -0
- package/dist/testing/ai-usage-storage-contract.d.ts +13 -0
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -0
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/broker-contract.d.ts.map +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts +16 -0
- package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -0
- package/dist/testing/execution-storage-contract.d.ts +15 -0
- package/dist/testing/execution-storage-contract.d.ts.map +1 -0
- package/dist/testing/execution.d.ts +23 -0
- package/dist/testing/execution.d.ts.map +1 -0
- package/dist/testing/index.d.ts +13 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +4754 -1592
- package/dist/testing/index.js.map +26 -13
- package/dist/testing/materializer-fixture.d.ts +2 -2
- package/dist/testing/materializer-fixture.d.ts.map +1 -1
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/ontology-contract-fixture.d.ts +1 -0
- package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/testing/pipeline-execution.d.ts +16 -0
- package/dist/testing/pipeline-execution.d.ts.map +1 -0
- package/dist/testing/projection-execution.d.ts +20 -0
- package/dist/testing/projection-execution.d.ts.map +1 -0
- package/dist/testing/projection-run-storage-contract.d.ts +9 -4
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/sync-execution.d.ts +16 -0
- package/dist/testing/sync-execution.d.ts.map +1 -0
- package/dist/testing/webhook-execution.d.ts +12 -0
- package/dist/testing/webhook-execution.d.ts.map +1 -0
- package/dist/testing/webhook-run-storage-contract.d.ts +11 -0
- package/dist/testing/webhook-run-storage-contract.d.ts.map +1 -0
- package/dist/testing/workflow-execution.d.ts +23 -0
- package/dist/testing/workflow-execution.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +2 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.d.ts +2 -0
- package/dist/webhooks/internal.d.ts.map +1 -0
- package/dist/webhooks/internal.js +152 -0
- package/dist/webhooks/internal.js.map +10 -0
- package/dist/webhooks/registry.d.ts +18 -4
- package/dist/webhooks/registry.d.ts.map +1 -1
- package/dist/webhooks/run-admission.d.ts +25 -0
- package/dist/webhooks/run-admission.d.ts.map +1 -0
- package/dist/webhooks/types.d.ts +8 -5
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/index.js +29 -20
- package/dist/workers/index.js.map +4 -4
- package/dist/workers/queue-delivery.d.ts +7 -7
- package/dist/workers/queue-delivery.d.ts.map +1 -1
- package/dist/workers/queue-worker.d.ts +32 -11
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workflows/execution.d.ts +52 -0
- package/dist/workflows/execution.d.ts.map +1 -0
- package/dist/workflows/failure.d.ts +28 -0
- package/dist/workflows/failure.d.ts.map +1 -0
- package/dist/workflows/index.d.ts +4 -2
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/index.js +67 -36
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts +2 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +59 -0
- package/dist/workflows/run-dispatch.d.ts.map +1 -0
- package/dist/workflows/types.d.ts +38 -8
- package/dist/workflows/types.d.ts.map +1 -1
- package/package.json +113 -5
- package/src/actions/commit-edits.ts +0 -3
- package/src/actions/execution.ts +83 -0
- package/src/actions/index.ts +1 -1
- package/src/actions/registry.ts +22 -10
- package/src/actions/request.ts +55 -177
- package/src/actions/run-dispatch.ts +276 -0
- package/src/actions/types/context.ts +2 -4
- package/src/actions/validation.ts +2 -2
- package/src/agents/adapters.ts +71 -26
- package/src/agents/authority.ts +189 -0
- package/src/agents/dispatch.ts +1 -6
- package/src/agents/errors.ts +4 -2
- package/src/agents/execution.ts +266 -0
- package/src/agents/index.ts +33 -4
- package/src/agents/prompt.ts +47 -7
- package/src/agents/request.ts +158 -13
- package/src/agents/streams.ts +150 -3
- package/src/agents/thread-context-projection.ts +93 -0
- package/src/agents/tool-definition.ts +17 -2
- package/src/agents/tool-result.ts +61 -0
- package/src/agents/types.ts +49 -5
- package/src/agents/validation.ts +3 -3
- package/src/auth/attribution.ts +48 -0
- package/src/auth/index.ts +1 -0
- package/src/auth/runtime.ts +5 -5
- package/src/authorization/decision.ts +75 -14
- package/src/authorization/grant-kinds.ts +9 -0
- package/src/authorization/index.ts +2 -0
- package/src/blob-storage/execution.ts +78 -0
- package/src/bootstrap/discovery.ts +88 -268
- package/src/bootstrap/index.ts +2 -13
- package/src/broker/in-memory.ts +8 -1
- package/src/broker/types.ts +5 -0
- package/src/connectors/builders.ts +37 -2
- package/src/connectors/connections/authorizations.ts +646 -0
- package/src/connectors/connections/capability.ts +59 -0
- package/src/connectors/connections/command-context.ts +98 -0
- package/src/connectors/connections/contracts.ts +208 -0
- package/src/connectors/connections/credential-codec.ts +48 -0
- package/src/connectors/connections/credential-mutations.ts +574 -0
- package/src/connectors/connections/execution.ts +138 -0
- package/src/connectors/connections/internal.ts +17 -0
- package/src/connectors/connections/provider-operation.ts +41 -0
- package/src/connectors/connections/request.ts +447 -0
- package/src/connectors/connections/runs.ts +702 -0
- package/src/connectors/connections/service.ts +644 -0
- package/src/connectors/connections/storage-boundary.ts +13 -0
- package/src/connectors/connections/tokens.ts +292 -0
- package/src/connectors/connections/validation.ts +316 -0
- package/src/connectors/connections/views.ts +37 -0
- package/src/connectors/credentials.ts +149 -0
- package/src/connectors/errors.ts +111 -3
- package/src/connectors/execution.ts +157 -0
- package/src/connectors/index.ts +26 -2
- package/src/connectors/service.ts +142 -0
- package/src/connectors/types.ts +156 -7
- package/src/datasets/execution.ts +24 -0
- package/src/error-reporting/capability.ts +33 -106
- package/src/error-reporting/internal.ts +3 -1
- package/src/error-reporting/reporter.ts +19 -3
- package/src/error-reporting/reports.ts +172 -0
- package/src/error-reporting/types.ts +97 -43
- package/src/errors/catalog.ts +149 -0
- package/src/errors/internal.ts +322 -0
- package/src/errors/types.ts +21 -0
- package/src/events/definitions.ts +0 -4
- package/src/events/execution.ts +45 -0
- package/src/events/index.ts +15 -14
- package/src/events/outbox-dispatcher.ts +53 -18
- package/src/events/{runtime.ts → service.ts} +19 -23
- package/src/events/types/pipelines.ts +4 -1
- package/src/events/types/syncs.ts +3 -0
- package/src/events/types/workflows.ts +4 -2
- package/src/execution/agent.ts +130 -0
- package/src/execution/authorization.ts +409 -0
- package/src/execution/dispatch.ts +7 -0
- package/src/execution/durable.ts +193 -0
- package/src/execution/index.ts +12 -0
- package/src/execution/primitive.ts +50 -0
- package/src/execution/request.ts +109 -0
- package/src/execution/scopes.ts +198 -0
- package/src/execution/types.ts +113 -0
- package/src/http/api-routes.ts +3 -3
- package/src/index.ts +122 -9
- package/src/json.ts +0 -4
- package/src/logging/execution.ts +28 -0
- package/src/logging/index.ts +4 -4
- package/src/logging/{runtime.ts → service.ts} +7 -7
- package/src/materialization/events.ts +1 -0
- package/src/materialization/index.ts +2 -0
- package/src/materialization/model.ts +34 -18
- package/src/materializer/README.md +9 -13
- package/src/materializer/edits/apply.ts +55 -2
- package/src/materializer/edits/commit.ts +85 -28
- package/src/materializer/edits/load-state.ts +79 -16
- package/src/materializer/edits/operations.ts +80 -37
- package/src/materializer/edits/plan.ts +95 -22
- package/src/materializer/edits/working-state.ts +93 -55
- package/src/materializer/effective/build-events.ts +2 -0
- package/src/materializer/effective/diff.ts +22 -0
- package/src/materializer/effective/load-state.ts +0 -31
- package/src/materializer/effective/resolve.ts +140 -9
- package/src/materializer/execution/commit-lifecycle.ts +9 -1
- package/src/materializer/execution/plan-stream.ts +33 -9
- package/src/materializer/execution/scope.ts +95 -0
- package/src/materializer/execution/work-executor.ts +6 -2
- package/src/materializer/execution/work-records.ts +42 -7
- package/src/materializer/index.ts +9 -1
- package/src/materializer/materializer.ts +67 -5
- package/src/materializer/projections/entry-validator.ts +23 -1
- package/src/materializer/projections/finish-run.ts +29 -11
- package/src/materializer/projections/replace.ts +55 -22
- package/src/materializer/projections/replacement-plan.ts +39 -7
- package/src/materializer/shared/batching.ts +4 -1
- package/src/materializer/shared/normalize.ts +16 -19
- package/src/materializer/telemetry/append.ts +57 -26
- package/src/materializer/telemetry/plan.ts +15 -6
- package/src/objects/action/request.ts +5 -5
- package/src/objects/context/index.ts +1 -0
- package/src/objects/context/types.ts +6 -0
- package/src/objects/execution.ts +346 -0
- package/src/objects/materializer-adapter.ts +1 -23
- package/src/objects/query/executor.ts +15 -29
- package/src/objects/query/index.ts +1 -2
- package/src/objects/query/planner.ts +0 -6
- package/src/objects/sdk/object-handle.ts +2 -2
- package/src/objects/sdk/object-set.ts +17 -7
- package/src/objects/sdk/runtime-query-executor.ts +9 -2
- package/src/objects/sdk/telemetry-channel.ts +5 -1
- package/src/objects/service/action-service.ts +5 -2
- package/src/objects/service/list-service.ts +1 -1
- package/src/objects/telemetry/history.ts +8 -3
- package/src/objects/telemetry/write-batch.ts +0 -2
- package/src/ontology/index.ts +6 -1
- package/src/ontology/registry.ts +16 -2
- package/src/pipelines/execution.ts +105 -0
- package/src/pipelines/index.ts +7 -0
- package/src/pipelines/request.ts +32 -26
- package/src/pipelines/run-dispatch.ts +308 -0
- package/src/projections/builders.ts +100 -44
- package/src/projections/capability.ts +37 -0
- package/src/projections/execution.ts +85 -0
- package/src/projections/index.ts +8 -1
- package/src/projections/internal.ts +21 -61
- package/src/projections/ownership.ts +2 -2
- package/src/projections/registry.ts +33 -11
- package/src/projections/revision.ts +11 -5
- package/src/projections/run-dispatch.ts +497 -0
- package/src/projections/run-id.ts +20 -0
- package/src/projections/timestamp.ts +66 -0
- package/src/projections/types.ts +19 -0
- package/src/projections/validation.ts +27 -3
- package/src/queues/in-memory.ts +37 -11
- package/src/queues/index.ts +10 -2
- package/src/queues/types.ts +78 -45
- package/src/rules/execution.ts +49 -0
- package/src/rules/index.ts +0 -1
- package/src/rules/validation.ts +2 -6
- package/src/runtime/ai-cost.ts +15 -0
- package/src/runtime/ai-usage.ts +17 -0
- package/src/runtime/create.ts +28 -68
- package/src/runtime/definitions.ts +44 -0
- package/src/runtime/host.ts +377 -0
- package/src/runtime/index.ts +5 -13
- package/src/runtime/internal.ts +12 -0
- package/src/runtime/ontology-mutations.ts +5 -3
- package/src/runtime/resolve-definitions.ts +238 -0
- package/src/runtime/sixb.ts +95 -822
- package/src/runtime/types.ts +17 -290
- package/src/scheduler/index.ts +1 -1
- package/src/scheduler/runtime.ts +37 -6
- package/src/schedules/execution.ts +14 -0
- package/src/schedules/types.ts +0 -8
- package/src/security/every.ts +4 -0
- package/src/security/grants.ts +13 -1
- package/src/security/index.ts +3 -1
- package/src/security/registry.ts +107 -0
- package/src/security/types.ts +8 -12
- package/src/security/validation.ts +7 -0
- package/src/storage/action-runs/failure.ts +64 -0
- package/src/storage/action-runs/idempotency.ts +3 -1
- package/src/storage/action-runs/in-memory.ts +39 -9
- package/src/storage/action-runs/index.ts +3 -0
- package/src/storage/action-runs/provider.ts +25 -0
- package/src/storage/action-runs/types.ts +61 -27
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +219 -14
- package/src/storage/agents/index.ts +7 -1
- package/src/storage/agents/provider.ts +252 -0
- package/src/storage/agents/types.ts +96 -22
- package/src/storage/ai-cost/analytics.ts +602 -0
- package/src/storage/ai-cost/codec.ts +136 -0
- package/src/storage/ai-cost/errors.ts +12 -0
- package/src/storage/ai-cost/in-memory.ts +164 -0
- package/src/storage/ai-cost/index.ts +35 -0
- package/src/storage/ai-cost/provider.ts +20 -0
- package/src/storage/ai-cost/types.ts +193 -0
- package/src/storage/ai-cost/validation.ts +337 -0
- package/src/storage/ai-usage/errors.ts +13 -0
- package/src/storage/ai-usage/in-memory.ts +162 -0
- package/src/storage/ai-usage/index.ts +21 -0
- package/src/storage/ai-usage/record.ts +74 -0
- package/src/storage/ai-usage/types.ts +102 -0
- package/src/storage/ai-usage/usage.ts +104 -0
- package/src/storage/auth/types.ts +1 -0
- package/src/storage/connector-connections/errors.ts +24 -0
- package/src/storage/connector-connections/in-memory.ts +1377 -0
- package/src/storage/connector-connections/index.ts +66 -0
- package/src/storage/connector-connections/provider/authorizations.ts +446 -0
- package/src/storage/connector-connections/provider/connections.ts +291 -0
- package/src/storage/connector-connections/provider/runs.ts +369 -0
- package/src/storage/connector-connections/provider/shared.ts +342 -0
- package/src/storage/connector-connections/provider.ts +219 -0
- package/src/storage/connector-connections/types.ts +546 -0
- package/src/storage/executions/errors.ts +21 -0
- package/src/storage/executions/in-memory.ts +75 -0
- package/src/storage/executions/index.ts +16 -0
- package/src/storage/executions/provider.ts +292 -0
- package/src/storage/executions/run-link.ts +70 -0
- package/src/storage/executions/types.ts +49 -0
- package/src/storage/executions/validation.ts +370 -0
- package/src/storage/in-memory/index.ts +100 -16
- package/src/storage/index.ts +191 -15
- package/src/storage/ontology/commits.ts +1 -0
- package/src/storage/ontology/in-memory/index.ts +2 -0
- package/src/storage/ontology/in-memory/materializations-finalization.ts +2 -1
- package/src/storage/ontology/in-memory/materializations-state.ts +10 -0
- package/src/storage/ontology/in-memory/materializations-work.ts +2 -1
- package/src/storage/ontology/in-memory/materializations.ts +132 -9
- package/src/storage/ontology/in-memory/outbox.ts +1 -1
- package/src/storage/ontology/in-memory/shared-state.ts +12 -1
- package/src/storage/ontology/index.ts +6 -0
- package/src/storage/ontology/materializations.ts +53 -4
- package/src/storage/ontology/outbox.ts +13 -2
- package/src/storage/ontology/provider-header-validation.ts +1 -0
- package/src/storage/ontology/provider-work.ts +33 -14
- package/src/storage/ontology/provider.ts +72 -52
- package/src/storage/operation-scope.ts +2 -0
- package/src/storage/pipeline-runs/idempotency.ts +14 -0
- package/src/storage/pipeline-runs/in-memory.ts +88 -8
- package/src/storage/pipeline-runs/index.ts +5 -1
- package/src/storage/pipeline-runs/provider.ts +25 -0
- package/src/storage/pipeline-runs/types.ts +37 -14
- package/src/storage/projection-runs/in-memory.ts +93 -24
- package/src/storage/projection-runs/index.ts +4 -0
- package/src/storage/projection-runs/lifecycle.ts +165 -36
- package/src/storage/projection-runs/provider.ts +34 -0
- package/src/storage/projection-runs/types.ts +34 -11
- package/src/storage/run-listing.ts +22 -13
- package/src/storage/sync-runs/idempotency.ts +18 -0
- package/src/storage/sync-runs/in-memory.ts +90 -7
- package/src/storage/sync-runs/index.ts +4 -1
- package/src/storage/sync-runs/provider.ts +25 -0
- package/src/storage/sync-runs/types.ts +35 -11
- package/src/storage/types.ts +46 -17
- package/src/storage/webhook-runs/errors.ts +14 -0
- package/src/storage/webhook-runs/in-memory.ts +84 -9
- package/src/storage/webhook-runs/index.ts +5 -1
- package/src/storage/webhook-runs/provider.ts +30 -0
- package/src/storage/webhook-runs/types.ts +52 -11
- package/src/storage/workflow-runs/in-memory.ts +89 -55
- package/src/storage/workflow-runs/index.ts +2 -0
- package/src/storage/workflow-runs/provider.ts +70 -0
- package/src/storage/workflow-runs/types.ts +36 -25
- package/src/syncs/builders.ts +2 -2
- package/src/syncs/execution.ts +78 -0
- package/src/syncs/index.ts +13 -0
- package/src/syncs/request.ts +32 -43
- package/src/syncs/run-dispatch.ts +312 -0
- package/src/syncs/sources.ts +20 -0
- package/src/syncs/types.ts +32 -8
- package/src/testing/action-execution.ts +61 -0
- package/src/testing/agent-execution.ts +81 -0
- package/src/testing/agent-storage-contract.ts +498 -64
- package/src/testing/ai-cost-storage-contract.ts +320 -0
- package/src/testing/ai-usage-storage-contract.ts +528 -0
- package/src/testing/auth-storage-contract.ts +17 -1
- package/src/testing/broker-contract.ts +16 -1
- package/src/testing/connector-connection-storage-contract.ts +1052 -0
- package/src/testing/execution-storage-contract.ts +435 -0
- package/src/testing/execution.ts +48 -0
- package/src/testing/index.ts +57 -0
- package/src/testing/materializer-fixture.ts +11 -3
- package/src/testing/materializer-storage-contract.ts +333 -13
- package/src/testing/ontology-contract-fixture.ts +35 -2
- package/src/testing/ontology-storage-contract.ts +75 -14
- package/src/testing/pipeline-execution.ts +64 -0
- package/src/testing/projection-execution.ts +98 -0
- package/src/testing/projection-run-storage-contract.ts +215 -29
- package/src/testing/queues-contract.ts +40 -51
- package/src/testing/sync-execution.ts +61 -0
- package/src/testing/webhook-execution.ts +47 -0
- package/src/testing/webhook-run-storage-contract.ts +240 -0
- package/src/testing/workflow-execution.ts +77 -0
- package/src/webhooks/index.ts +2 -1
- package/src/webhooks/internal.ts +5 -0
- package/src/webhooks/registry.ts +60 -36
- package/src/webhooks/run-admission.ts +172 -0
- package/src/webhooks/types.ts +8 -5
- package/src/workers/queue-delivery.ts +25 -22
- package/src/workers/queue-worker.ts +76 -33
- package/src/workflows/execution.ts +313 -0
- package/src/workflows/failure.ts +63 -0
- package/src/workflows/index.ts +10 -1
- package/src/workflows/request.ts +39 -118
- package/src/workflows/run-dispatch.ts +359 -0
- package/src/workflows/types.ts +39 -8
- package/dist/actions/runtime.d.ts +0 -11
- package/dist/actions/runtime.d.ts.map +0 -1
- package/dist/agents/runtime.d.ts +0 -41
- package/dist/agents/runtime.d.ts.map +0 -1
- package/dist/chunk-4hwxq5e6.js +0 -49
- package/dist/chunk-4hwxq5e6.js.map +0 -10
- package/dist/chunk-4tvj3ate.js.map +0 -11
- package/dist/chunk-50kv63vj.js.map +0 -12
- package/dist/chunk-86459jn0.js +0 -1091
- package/dist/chunk-86459jn0.js.map +0 -22
- package/dist/chunk-867jxh7c.js.map +0 -19
- package/dist/chunk-9k3hgv8h.js +0 -352
- package/dist/chunk-9k3hgv8h.js.map +0 -13
- package/dist/chunk-avppcgt6.js.map +0 -14
- package/dist/chunk-b1bqvhpe.js.map +0 -13
- package/dist/chunk-b5dp7gaf.js +0 -1092
- package/dist/chunk-b5dp7gaf.js.map +0 -26
- package/dist/chunk-bh8bwma3.js +0 -37
- package/dist/chunk-bh8bwma3.js.map +0 -10
- package/dist/chunk-btcsywk4.js +0 -985
- package/dist/chunk-btcsywk4.js.map +0 -15
- package/dist/chunk-exrfbt2d.js +0 -354
- package/dist/chunk-exrfbt2d.js.map +0 -17
- package/dist/chunk-hb9xcx9c.js.map +0 -14
- package/dist/chunk-k25jm1x5.js +0 -102
- package/dist/chunk-k25jm1x5.js.map +0 -10
- package/dist/chunk-k6j72mtt.js +0 -9
- package/dist/chunk-k6j72mtt.js.map +0 -10
- package/dist/chunk-m9w0artv.js +0 -554
- package/dist/chunk-m9w0artv.js.map +0 -13
- package/dist/chunk-nbywkytr.js.map +0 -16
- package/dist/chunk-p7vj8xgb.js.map +0 -34
- package/dist/chunk-raq0x6bd.js.map +0 -48
- package/dist/chunk-rgzed50y.js +0 -1445
- package/dist/chunk-rgzed50y.js.map +0 -22
- package/dist/chunk-rjqm6ksg.js.map +0 -44
- package/dist/chunk-t72dvahb.js.map +0 -12
- package/dist/chunk-v5c085yp.js.map +0 -10
- package/dist/chunk-xt6qx9sh.js.map +0 -36
- package/dist/chunk-xz5g49bp.js.map +0 -11
- package/dist/chunk-ya6brh8a.js.map +0 -11
- package/dist/chunk-yn947ck3.js.map +0 -14
- package/dist/connectors/runtime.d.ts +0 -13
- package/dist/connectors/runtime.d.ts.map +0 -1
- package/dist/events/runtime.d.ts.map +0 -1
- package/dist/objects/contexts.d.ts +0 -45
- package/dist/objects/contexts.d.ts.map +0 -1
- package/dist/objects/helpers.d.ts +0 -7
- package/dist/objects/helpers.d.ts.map +0 -1
- package/dist/runtime/scoped.d.ts +0 -158
- package/dist/runtime/scoped.d.ts.map +0 -1
- package/dist/security/runtime.d.ts +0 -16
- package/dist/security/runtime.d.ts.map +0 -1
- package/dist/storage/webhook-deliveries/in-memory.d.ts +0 -18
- package/dist/storage/webhook-deliveries/in-memory.d.ts.map +0 -1
- package/dist/storage/webhook-deliveries/index.d.ts +0 -3
- package/dist/storage/webhook-deliveries/index.d.ts.map +0 -1
- package/dist/storage/webhook-deliveries/types.d.ts +0 -43
- package/dist/storage/webhook-deliveries/types.d.ts.map +0 -1
- package/dist/workflows/runtime.d.ts +0 -33
- package/dist/workflows/runtime.d.ts.map +0 -1
- package/src/actions/runtime.ts +0 -31
- package/src/agents/runtime.ts +0 -124
- package/src/connectors/runtime.ts +0 -100
- package/src/objects/contexts.ts +0 -64
- package/src/objects/helpers.ts +0 -18
- package/src/runtime/scoped.ts +0 -436
- package/src/security/runtime.ts +0 -101
- package/src/storage/webhook-deliveries/in-memory.ts +0 -108
- package/src/storage/webhook-deliveries/index.ts +0 -9
- package/src/storage/webhook-deliveries/types.ts +0 -41
- package/src/workflows/runtime.ts +0 -68
- /package/dist/{chunk-md9jbrm9.js.map → chunk-4gz41why.js.map} +0 -0
- /package/dist/{chunk-6rzdtvn5.js.map → chunk-8b55ygje.js.map} +0 -0
- /package/dist/{chunk-r82k4z7z.js.map → chunk-a31h57d5.js.map} +0 -0
- /package/dist/{chunk-qzyemcj7.js.map → chunk-ckxfnx7f.js.map} +0 -0
- /package/dist/{chunk-53s4asfm.js.map → chunk-rnshztfq.js.map} +0 -0
- /package/dist/{chunk-8kv2sez0.js.map → chunk-vybf6pkp.js.map} +0 -0
- /package/dist/{chunk-6zrpewy4.js.map → chunk-z3zp0bj1.js.map} +0 -0
- /package/dist/{chunk-hz8m927w.js.map → chunk-zqysyfjt.js.map} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/bootstrap/discovery.ts", "../src/rules/errors.ts", "../src/rules/validation.ts", "../src/rules/builders.ts", "../src/bootstrap/ontology-type-manifest.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Filesystem auto-discovery for convention-based module loading.\n *\n * Scans well-known definition directories (`ontology/`, `actions/`, etc.)\n * relative to a project root and returns typed definition arrays ready\n * for the `Sixb` constructor.\n */\n\nimport { readdir } from \"node:fs/promises\"\nimport { join, relative } from \"node:path\"\nimport { pathToFileURL } from \"node:url\"\nimport { isActionDefinition } from \"../actions\"\nimport { isAgentDefinition } from \"../agents\"\nimport { isConnectorDefinition } from \"../connectors\"\nimport { isDatasetDefinition } from \"../datasets\"\nimport type { OntologyDocumentInput, OntologySource } from \"../ontology/registry\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport type { ValueType } from \"../ontology/types\"\nimport { isPipelineDefinition } from \"../pipelines\"\nimport { isProjectionDefinition } from \"../projections/builders\"\nimport { isRuleDefinition } from \"../rules\"\nimport { RuntimeError } from \"../runtime/errors\"\nimport { isScheduleDefinition } from \"../schedules\"\nimport { isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition } from \"../security\"\nimport { isSyncDefinition } from \"../syncs\"\nimport { isWorkflowDefinition } from \"../workflows\"\n\nconst moduleExtensions = new Set([\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\"])\n\nexport async function discoverOntologySources(\n projectRoot: string\n): Promise<readonly OntologySource[]> {\n const ontologyDir = join(projectRoot, \"ontology\")\n const modulePaths = await listModuleFiles(ontologyDir)\n const exportedCandidates = await loadModuleExports({\n modulePaths,\n projectRoot,\n kind: \"ontology\",\n })\n\n const ontologyDocuments: OntologyDocumentInput[] = []\n const objectTypes: ObjectTypeWithPropertyTokens[] = []\n const valueTypes: ValueType[] = []\n\n for (const candidate of exportedCandidates) {\n if (isOntologyDocumentInput(candidate)) {\n ontologyDocuments.push(candidate)\n continue\n }\n\n if (isObjectTypeWithPropertyTokens(candidate)) {\n objectTypes.push(candidate)\n continue\n }\n\n if (isValueType(candidate)) {\n valueTypes.push(candidate)\n }\n }\n\n const discoveredSources: OntologySource[] = [...ontologyDocuments, ...objectTypes]\n if (valueTypes.length > 0) {\n discoveredSources.push({\n id: \"__sixb.discovered.value-types__\",\n version: \"0.0.0\",\n objectTypes: [],\n valueTypes,\n })\n }\n\n return discoveredSources\n}\n\ntype DiscoveryModuleKind =\n | \"action\"\n | \"agent\"\n | \"connector\"\n | \"dataset\"\n | \"group\"\n | \"membershipPolicy\"\n | \"ontology\"\n | \"pipeline\"\n | \"projection\"\n | \"role\"\n | \"rule\"\n | \"schedule\"\n | \"sync\"\n | \"workflow\"\n\ninterface DefinitionDiscoveryFamily<TDefinition> {\n readonly directory: readonly string[]\n readonly kind: Exclude<DiscoveryModuleKind, \"ontology\">\n readonly isDefinition: (value: unknown) => value is TDefinition\n}\n\nconst definitionDiscoveryRegistry = {\n actions: { directory: [\"actions\"], kind: \"action\", isDefinition: isActionDefinition },\n projections: {\n directory: [\"projections\"],\n kind: \"projection\",\n isDefinition: isProjectionDefinition,\n },\n schedules: {\n directory: [\"schedules\"],\n kind: \"schedule\",\n isDefinition: isScheduleDefinition,\n },\n syncs: { directory: [\"syncs\"], kind: \"sync\", isDefinition: isSyncDefinition },\n connectors: {\n directory: [\"connectors\"],\n kind: \"connector\",\n isDefinition: isConnectorDefinition,\n },\n pipelines: {\n directory: [\"pipelines\"],\n kind: \"pipeline\",\n isDefinition: isPipelineDefinition,\n },\n datasets: { directory: [\"datasets\"], kind: \"dataset\", isDefinition: isDatasetDefinition },\n rules: { directory: [\"rules\"], kind: \"rule\", isDefinition: isRuleDefinition },\n workflows: {\n directory: [\"workflows\"],\n kind: \"workflow\",\n isDefinition: isWorkflowDefinition,\n },\n groups: {\n directory: [\"security\", \"groups\"],\n kind: \"group\",\n isDefinition: isGroupDefinition,\n },\n roles: {\n directory: [\"security\", \"roles\"],\n kind: \"role\",\n isDefinition: isRoleDefinition,\n },\n membershipPolicies: {\n directory: [\"security\", \"policies\"],\n kind: \"membershipPolicy\",\n isDefinition: isMembershipPolicyDefinition,\n },\n agents: { directory: [\"agents\"], kind: \"agent\", isDefinition: isAgentDefinition },\n} as const satisfies Record<string, DefinitionDiscoveryFamily<unknown>>\n\ntype DefinitionFromFamily<TFamily> =\n TFamily extends DefinitionDiscoveryFamily<infer TDefinition> ? TDefinition : never\n\nexport type DiscoveredProjectDefinitions = {\n readonly [TKey in keyof typeof definitionDiscoveryRegistry]: readonly DefinitionFromFamily<\n (typeof definitionDiscoveryRegistry)[TKey]\n >[]\n}\n\nexport async function discoverProjectDefinitions(\n projectRoot: string\n): Promise<DiscoveredProjectDefinitions> {\n const entries = await Promise.all(\n Object.entries(definitionDiscoveryRegistry).map(async ([key, family]) => {\n const definitions = await discoverDefinitionFamily(projectRoot, family)\n return [key, definitions] as const\n })\n )\n\n // Object.fromEntries erases literal keys. Every entry above comes from the exact registry and its\n // definitions have passed that entry's type guard, so restoring the mapped result type is safe.\n return Object.fromEntries(entries) as DiscoveredProjectDefinitions\n}\n\nasync function discoverDefinitionFamily(\n projectRoot: string,\n family: DefinitionDiscoveryFamily<unknown>\n): Promise<readonly unknown[]> {\n const modulePaths = await listModuleFiles(join(projectRoot, ...family.directory))\n const exportedCandidates = await loadModuleExports({\n modulePaths,\n projectRoot,\n kind: family.kind,\n })\n\n return exportedCandidates.filter(family.isDefinition)\n}\n\n// ── Internal helpers ────────────────────────────────────────\n\nasync function loadModuleExports(options: {\n modulePaths: readonly string[]\n projectRoot: string\n kind: DiscoveryModuleKind\n}): Promise<unknown[]> {\n const exportedCandidates: unknown[] = []\n const seen = new Set<unknown>()\n\n for (const modulePath of options.modulePaths) {\n let moduleNamespace: Record<string, unknown>\n try {\n moduleNamespace = (await import(pathToFileURL(modulePath).href)) as Record<string, unknown>\n } catch (error) {\n const relPath = relative(options.projectRoot, modulePath)\n const reason = error instanceof Error ? error.message : String(error)\n throw new RuntimeError(`Failed to load ${options.kind} module '${relPath}': ${reason}`)\n }\n\n for (const exportedValue of Object.values(moduleNamespace)) {\n collectExportedCandidates(exportedValue, exportedCandidates, seen)\n }\n }\n\n return exportedCandidates\n}\n\nfunction collectExportedCandidates(value: unknown, target: unknown[], seen: Set<unknown>): void {\n if (Array.isArray(value)) {\n for (const item of value) {\n collectExportedCandidates(item, target, seen)\n }\n return\n }\n\n if (value === undefined) {\n return\n }\n\n if ((typeof value === \"object\" && value !== null) || typeof value === \"function\") {\n if (seen.has(value)) {\n return\n }\n seen.add(value)\n }\n\n target.push(value)\n}\n\nasync function listModuleFiles(dir: string): Promise<string[]> {\n let entries: import(\"node:fs\").Dirent[]\n try {\n entries = (await readdir(dir, { withFileTypes: true })) as import(\"node:fs\").Dirent[]\n } catch (error) {\n if (isNotFoundError(error)) {\n return []\n }\n throw error\n }\n\n const files: string[] = []\n const sortedEntries = [...entries].sort((a, b) => a.name.localeCompare(b.name))\n\n for (const entry of sortedEntries) {\n const fullPath = join(dir, entry.name)\n if (entry.isDirectory()) {\n files.push(...(await listModuleFiles(fullPath)))\n continue\n }\n\n if (!entry.isFile()) {\n continue\n }\n\n if (!hasSupportedModuleExtension(entry.name)) {\n continue\n }\n\n files.push(fullPath)\n }\n\n return files\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false\n }\n\n const code = (error as NodeJS.ErrnoException).code\n return code === \"ENOENT\" || code === \"ENOTDIR\"\n}\n\nfunction hasSupportedModuleExtension(fileName: string): boolean {\n const normalized = fileName.toLowerCase()\n for (const extension of moduleExtensions) {\n if (normalized.endsWith(extension)) {\n return true\n }\n }\n return false\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction isOntologyDocumentInput(value: unknown): value is OntologyDocumentInput {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n typeof value.version === \"string\" &&\n Array.isArray(value.objectTypes)\n )\n}\n\nfunction isObjectTypeWithPropertyTokens(value: unknown): value is ObjectTypeWithPropertyTokens {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n Array.isArray(value.properties) &&\n Array.isArray(value.links) &&\n isRecord(value.p)\n )\n}\n\nfunction isValueType(value: unknown): value is ValueType {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n typeof value.name === \"string\" &&\n \"schema\" in value &&\n !Array.isArray(value.properties) &&\n !Array.isArray(value.objectTypes)\n )\n}\n",
|
|
6
|
+
"/**\n * Base error for the rules module. `RuleValidationError` covers invalid rule\n * definitions both at builder time and during runtime startup validation.\n */\nexport class RuleError extends Error {\n readonly name: string = \"RuleError\"\n}\n\nexport class RuleValidationError extends RuleError {\n override readonly name = \"RuleValidationError\"\n}\n",
|
|
7
|
+
"import type { OntologyRegistry } from \"../ontology/registry\"\nimport type { ObjectType } from \"../ontology/types\"\nimport { assertPredicateShape } from \"../predicates\"\nimport { RuleValidationError } from \"./errors\"\nimport type { RuleDefinition, RulePredicate } from \"./types\"\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction assertNonEmptyString(\n value: unknown,\n field: string,\n createError: (message: string) => Error\n): asserts value is string {\n if (typeof value !== \"string\" || value.trim().length === 0) {\n throw createError(`${field} must not be empty.`)\n }\n}\n\n/**\n * Validate only the portable AST shape.\n *\n * This is used by discovery/type guards and by the builder after `.where(...)`.\n * Ontology-aware checks live in `validateRulesAtStartup`, once the full\n * registry has inherited properties and links resolved.\n */\nexport function assertRulePredicateShape(\n value: unknown,\n createError: (message: string) => Error = (message) => new RuleValidationError(message)\n): asserts value is RulePredicate {\n assertPredicateShape(value, { subject: \"Rule\", createError })\n}\n\n/** Validate the serializable rule envelope without consulting ontology state. */\nexport function assertRuleDefinition(\n value: unknown,\n createError: (message: string) => Error = (message) => new RuleValidationError(message)\n): asserts value is RuleDefinition {\n if (!isRecord(value)) {\n throw createError(\"Rule definition must be an object.\")\n }\n\n if (value.kind !== \"rule\") {\n throw createError(\"Rule definition kind must be 'rule'.\")\n }\n\n assertNonEmptyString(value.id, \"Rule id\", createError)\n\n if (!isRecord(value.subject) || value.subject.kind !== \"object\") {\n throw createError(`Rule '${value.id}' subject must be an object subject.`)\n }\n\n assertNonEmptyString(\n value.subject.objectTypeId,\n `Rule '${value.id}' subject objectTypeId`,\n createError\n )\n assertRulePredicateShape(value.predicate, createError)\n}\n\nexport function isRuleDefinition(value: unknown): value is RuleDefinition {\n try {\n assertRuleDefinition(value, (message) => new Error(message))\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Validate rules after the ontology registry is built.\n *\n * Startup is where we can reject references that cannot be known from the\n * serialized rule alone: duplicate ids, unknown subject types, unknown\n * properties/links, and empty logical groups.\n */\nexport function validateRulesAtStartup(\n rules: readonly RuleDefinition[],\n ontology: OntologyRegistry\n): void {\n const seenRuleIds = new Set<string>()\n\n for (const rule of rules) {\n assertRuleDefinition(rule)\n\n if (seenRuleIds.has(rule.id)) {\n throw new RuleValidationError(`Duplicate rule id: ${rule.id}`)\n }\n seenRuleIds.add(rule.id)\n\n const objectType = ontology.getObjectTypeById(rule.subject.objectTypeId)\n if (!objectType) {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": unknown object type \"${rule.subject.objectTypeId}\".`\n )\n }\n\n validatePredicateAgainstSubject(rule, objectType, rule.predicate)\n }\n}\n\n/** Walk every predicate node and check subject-scoped references. */\nfunction validatePredicateAgainstSubject(\n rule: RuleDefinition,\n objectType: ObjectType,\n predicate: RulePredicate\n): void {\n if (predicate.kind === \"all\" || predicate.kind === \"any\") {\n if (predicate.predicates.length === 0) {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": ${predicate.kind} predicate must contain at least one predicate.`\n )\n }\n\n for (const child of predicate.predicates) {\n validatePredicateAgainstSubject(rule, objectType, child)\n }\n return\n }\n\n if (predicate.kind === \"not\") {\n validatePredicateAgainstSubject(rule, objectType, predicate.predicate)\n return\n }\n\n if (predicate.kind === \"property\") {\n const propertyIds = new Set(objectType.properties.map((property) => property.id))\n if (!propertyIds.has(predicate.propertyId)) {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": unknown property \"${predicate.propertyId}\" on object type \"${objectType.id}\".`\n )\n }\n return\n }\n\n if (predicate.kind === \"field\") {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": field predicates are not supported in rule conditions.`\n )\n }\n\n const linkIds = new Set(objectType.links.map((link) => link.id))\n if (!linkIds.has(predicate.linkId)) {\n throw new RuleValidationError(\n `Rule \"${rule.id}\": unknown link \"${predicate.linkId}\" on object type \"${objectType.id}\".`\n )\n }\n}\n",
|
|
8
|
+
"import {\n allPredicates,\n anyPredicates,\n createLinkPredicateBuilder as createSharedLinkPredicateBuilder,\n createPropertyPredicateBuilder as createSharedPropertyPredicateBuilder,\n notPredicate,\n type RuntimePropertyPredicateBuilder,\n} from \"../predicates\"\nimport { RuleValidationError } from \"./errors\"\nimport type {\n RuleBuilder,\n RuleDefinition,\n RuleLinkPredicateBuilder,\n RuleObjectType,\n RulePredicate,\n RulePropertyPredicate,\n} from \"./types\"\nimport { assertRulePredicateShape } from \"./validation\"\n\n/**\n * Runtime builders stay deliberately concrete.\n *\n * The public overload below provides typed property/link keys to callers, while\n * this internal shape keeps the implementation simple and avoids asking\n * TypeScript to instantiate the full ontology mapped type while checking this\n * file.\n */\ntype RuntimeRulePropertyPredicateBuilder = RuntimePropertyPredicateBuilder<RulePropertyPredicate>\n\ntype RuntimeRuleSubjectBuilder = {\n p: Record<string, RuntimeRulePropertyPredicateBuilder>\n l: Record<string, RuleLinkPredicateBuilder>\n all(...predicates: RulePredicate[]): RulePredicate\n any(...predicates: RulePredicate[]): RulePredicate\n not(predicate: RulePredicate): RulePredicate\n}\n\nfunction assertNonEmpty(value: string, field: string): void {\n if (!value.trim()) {\n throw new RuleValidationError(`Rule ${field} must not be empty.`)\n }\n}\n\n/** Build the `tx.p.<propertyId>` API for one ontology property. */\nfunction createPropertyPredicateBuilder(propertyId: string): RuntimeRulePropertyPredicateBuilder {\n return createSharedPropertyPredicateBuilder(propertyId, {\n subject: \"Rule\",\n createError: (message) => new RuleValidationError(message),\n })\n}\n\n/** Build the `tx.l.<linkId>` API for one ontology link. */\nfunction createLinkPredicateBuilder(linkId: string): RuleLinkPredicateBuilder {\n return createSharedLinkPredicateBuilder(linkId)\n}\n\n/**\n * Build the callback subject from ontology metadata.\n *\n * This object is only used while `.where(...)` executes. The returned\n * RuleDefinition stores the predicate data produced by these methods, not this\n * builder object or the user callback.\n */\nfunction createRuleSubjectBuilder<TObjectType extends RuleObjectType>(\n objectType: TObjectType\n): RuntimeRuleSubjectBuilder {\n const properties = Object.fromEntries(\n objectType.properties.map((property) => [\n property.id,\n createPropertyPredicateBuilder(property.id),\n ])\n )\n\n const links = Object.fromEntries(\n objectType.links.map((link) => [link.id, createLinkPredicateBuilder(link.id)])\n )\n\n return {\n p: properties,\n l: links,\n all(...predicates: RulePredicate[]): RulePredicate {\n return allPredicates(predicates)\n },\n any(...predicates: RulePredicate[]): RulePredicate {\n return anyPredicates(predicates)\n },\n not(predicate: RulePredicate): RulePredicate {\n return notPredicate(predicate)\n },\n }\n}\n\n/**\n * Define an inert business rule.\n *\n * The overload preserves literal ids and typed property/link keys for users.\n * The implementation returns a concrete builder and casts at the boundary so\n * runtime code stays small while callers still get the typed DSL.\n */\nexport function defineRule<const TId extends string>(id: TId): RuleBuilder<TId>\nexport function defineRule(id: string): RuleBuilder<string> {\n assertNonEmpty(id, \"id\")\n\n const builder = {\n on(objectType: RuleObjectType) {\n return {\n where(callback: (subject: RuntimeRuleSubjectBuilder) => RulePredicate): RuleDefinition {\n const predicate = callback(createRuleSubjectBuilder(objectType))\n assertRulePredicateShape(predicate)\n\n return {\n kind: \"rule\",\n id,\n subject: {\n kind: \"object\",\n objectTypeId: objectType.id,\n },\n predicate,\n }\n },\n }\n },\n }\n\n return builder as unknown as RuleBuilder<string>\n}\n",
|
|
9
|
+
"import { mkdir, readdir, readFile, writeFile } from \"node:fs/promises\"\nimport { dirname, extname, join, relative, resolve, sep } from \"node:path\"\nimport { pathToFileURL } from \"node:url\"\nimport type { OntologyDocumentInput } from \"../ontology/registry\"\nimport type { ObjectTypeWithPropertyTokens } from \"../ontology/tokens\"\nimport { RuntimeError } from \"../runtime/errors\"\n\nconst moduleExtensions = new Set([\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\"])\n\nexport interface OntologyTypeManifestEntry {\n readonly objectTypeId: string\n readonly modulePath: string\n readonly exportName: string\n readonly typeExpression: string\n}\n\nexport interface OntologyTypeManifestDiscovery {\n readonly entries: readonly OntologyTypeManifestEntry[]\n readonly moduleCount: number\n}\n\nexport interface GenerateOntologyTypeManifestOptions {\n readonly projectRoot: string\n readonly outFile?: string\n}\n\nexport interface GenerateOntologyTypeManifestResult extends OntologyTypeManifestDiscovery {\n readonly path: string\n readonly written: boolean\n readonly skipped: boolean\n}\n\nexport async function discoverOntologyTypeManifest(\n projectRoot: string\n): Promise<OntologyTypeManifestDiscovery> {\n const resolvedProjectRoot = resolve(projectRoot)\n const ontologyDir = join(resolvedProjectRoot, \"ontology\")\n const modulePaths = await listModuleFiles(ontologyDir)\n const entries = new Map<string, OntologyTypeManifestEntry>()\n const seenObjectTypes = new Set<unknown>()\n\n for (const modulePath of modulePaths) {\n const moduleSpecifier = toGeneratedModuleSpecifier({\n fromDir: join(resolvedProjectRoot, \".sixb\", \"types\"),\n modulePath,\n })\n const moduleNamespace = await loadOntologyModule({\n modulePath,\n projectRoot: resolvedProjectRoot,\n })\n\n for (const [exportName, exportedValue] of Object.entries(moduleNamespace)) {\n collectManifestEntries({\n exportedValue,\n exportName,\n modulePath,\n moduleSpecifier,\n entries,\n seenObjectTypes,\n })\n }\n }\n\n return {\n entries: [...entries.values()].sort((a, b) => a.objectTypeId.localeCompare(b.objectTypeId)),\n moduleCount: modulePaths.length,\n }\n}\n\nexport async function generateOntologyTypeManifest(\n options: GenerateOntologyTypeManifestOptions\n): Promise<GenerateOntologyTypeManifestResult> {\n const projectRoot = resolve(options.projectRoot)\n const outFile = resolve(projectRoot, options.outFile ?? join(\".sixb\", \"types\", \"ontology.d.ts\"))\n const discovery = await discoverOntologyTypeManifest(projectRoot)\n\n if (discovery.moduleCount === 0) {\n return {\n ...discovery,\n path: outFile,\n written: false,\n skipped: true,\n }\n }\n\n const content = renderOntologyTypeManifest(discovery.entries)\n await mkdir(dirname(outFile), { recursive: true })\n const written = await writeFileIfChanged(outFile, content)\n\n return {\n ...discovery,\n path: outFile,\n written,\n skipped: false,\n }\n}\n\nfunction collectManifestEntries(input: {\n readonly exportedValue: unknown\n readonly exportName: string\n readonly modulePath: string\n readonly moduleSpecifier: string\n readonly entries: Map<string, OntologyTypeManifestEntry>\n readonly seenObjectTypes: Set<unknown>\n}): void {\n if (isObjectTypeWithPropertyTokens(input.exportedValue)) {\n addManifestEntry({\n objectType: input.exportedValue,\n modulePath: input.modulePath,\n exportName: input.exportName,\n typeExpression: `typeof import(${JSON.stringify(input.moduleSpecifier)})[${JSON.stringify(\n input.exportName\n )}]`,\n entries: input.entries,\n seenObjectTypes: input.seenObjectTypes,\n })\n return\n }\n\n if (isOntologyDocumentInput(input.exportedValue)) {\n for (const objectType of input.exportedValue.objectTypes) {\n addManifestEntry({\n objectType,\n modulePath: input.modulePath,\n exportName: input.exportName,\n typeExpression: `Extract<(typeof import(${JSON.stringify(\n input.moduleSpecifier\n )})[${JSON.stringify(input.exportName)}])[\"objectTypes\"][number], { id: ${JSON.stringify(\n objectType.id\n )} }>`,\n entries: input.entries,\n seenObjectTypes: input.seenObjectTypes,\n })\n }\n return\n }\n\n if (Array.isArray(input.exportedValue)) {\n for (const item of input.exportedValue) {\n if (!isObjectTypeWithPropertyTokens(item)) continue\n addManifestEntry({\n objectType: item,\n modulePath: input.modulePath,\n exportName: input.exportName,\n typeExpression: `Extract<(typeof import(${JSON.stringify(\n input.moduleSpecifier\n )})[${JSON.stringify(input.exportName)}])[number], { id: ${JSON.stringify(item.id)} }>`,\n entries: input.entries,\n seenObjectTypes: input.seenObjectTypes,\n })\n }\n }\n}\n\nfunction addManifestEntry(input: {\n readonly objectType: ObjectTypeWithPropertyTokens\n readonly modulePath: string\n readonly exportName: string\n readonly typeExpression: string\n readonly entries: Map<string, OntologyTypeManifestEntry>\n readonly seenObjectTypes: Set<unknown>\n}): void {\n if (input.seenObjectTypes.has(input.objectType)) {\n return\n }\n input.seenObjectTypes.add(input.objectType)\n\n const existing = input.entries.get(input.objectType.id)\n const entry: OntologyTypeManifestEntry = {\n objectTypeId: input.objectType.id,\n modulePath: input.modulePath,\n exportName: input.exportName,\n typeExpression: input.typeExpression,\n }\n\n if (!existing) {\n input.entries.set(input.objectType.id, entry)\n return\n }\n\n throw new RuntimeError(\n `[Sixb] Duplicate ontology object type id \"${input.objectType.id}\" while generating `.concat(\n `the type manifest: ${relative(process.cwd(), existing.modulePath)} and `,\n `${relative(process.cwd(), input.modulePath)}.`\n )\n )\n}\n\nfunction renderOntologyTypeManifest(entries: readonly OntologyTypeManifestEntry[]): string {\n const lines = [\n \"// This file is auto-generated by Sixb.\",\n \"// Do not edit this file directly.\",\n \"\",\n 'declare module \"@sixb/core/ontology\" {',\n \" interface SixbObjectTypeMap {\",\n ]\n\n for (const entry of entries) {\n lines.push(` ${JSON.stringify(entry.objectTypeId)}: ${entry.typeExpression}`)\n }\n\n lines.push(\" }\", \"}\", \"\", \"export {}\", \"\")\n return lines.join(\"\\n\")\n}\n\nasync function writeFileIfChanged(path: string, content: string): Promise<boolean> {\n try {\n const existing = await readFile(path, \"utf-8\")\n if (existing === content) return false\n } catch (error) {\n if (!isNotFoundError(error)) throw error\n }\n\n await writeFile(path, content, \"utf-8\")\n return true\n}\n\nasync function loadOntologyModule(input: {\n readonly modulePath: string\n readonly projectRoot: string\n}): Promise<Record<string, unknown>> {\n try {\n return (await import(pathToFileURL(input.modulePath).href)) as Record<string, unknown>\n } catch (error) {\n const relPath = relative(input.projectRoot, input.modulePath)\n const reason = error instanceof Error ? error.message : String(error)\n throw new RuntimeError(`Failed to load ontology module '${relPath}': ${reason}`)\n }\n}\n\nasync function listModuleFiles(dir: string): Promise<string[]> {\n let entries: import(\"node:fs\").Dirent[]\n try {\n entries = (await readdir(dir, { withFileTypes: true })) as import(\"node:fs\").Dirent[]\n } catch (error) {\n if (isNotFoundError(error)) {\n return []\n }\n throw error\n }\n\n const files: string[] = []\n const sortedEntries = [...entries].sort((a, b) => a.name.localeCompare(b.name))\n\n for (const entry of sortedEntries) {\n const fullPath = join(dir, entry.name)\n if (entry.isDirectory()) {\n files.push(...(await listModuleFiles(fullPath)))\n continue\n }\n\n if (!entry.isFile() || !hasSupportedModuleExtension(entry.name)) {\n continue\n }\n\n files.push(fullPath)\n }\n\n return files\n}\n\nfunction toGeneratedModuleSpecifier(input: {\n readonly fromDir: string\n readonly modulePath: string\n}): string {\n const withoutExtension = stripSupportedModuleExtension(input.modulePath)\n const relativePath = relative(input.fromDir, withoutExtension).split(sep).join(\"/\")\n return relativePath.startsWith(\".\") ? relativePath : `./${relativePath}`\n}\n\nfunction stripSupportedModuleExtension(path: string): string {\n const extension = extname(path)\n return moduleExtensions.has(extension) ? path.slice(0, -extension.length) : path\n}\n\nfunction hasSupportedModuleExtension(fileName: string): boolean {\n return moduleExtensions.has(extname(fileName).toLowerCase())\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false\n }\n\n const code = (error as NodeJS.ErrnoException).code\n return code === \"ENOENT\" || code === \"ENOTDIR\"\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction isObjectTypeWithPropertyTokens(value: unknown): value is ObjectTypeWithPropertyTokens {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n Array.isArray(value.properties) &&\n Array.isArray(value.links) &&\n isRecord(value.p)\n )\n}\n\nfunction isOntologyDocumentInput(value: unknown): value is OntologyDocumentInput {\n if (!isRecord(value)) {\n return false\n }\n\n return (\n typeof value.id === \"string\" &&\n typeof value.version === \"string\" &&\n Array.isArray(value.objectTypes)\n )\n}\n"
|
|
10
|
+
],
|
|
11
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;AACA;AACA;;;ACNO,MAAM,kBAAkB,MAAM;AAAA,EAC1B,OAAe;AAC1B;AAAA;AAEO,MAAM,4BAA4B,UAAU;AAAA,EAC/B,OAAO;AAC3B;;;ACJA,SAAS,QAAQ,CAAC,OAAkD;AAAA,EAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QA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debugId": "2CA9617BCA37783A64756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
createPrimitiveExecutionRecord,
|
|
4
|
+
ensureExecutionRecord,
|
|
5
|
+
executionRecordInputFromRuntime
|
|
6
|
+
} from "./chunk-4aw0jwk0.js";
|
|
7
|
+
import {
|
|
8
|
+
PIPELINE_RUN_FAILURE_CODES
|
|
9
|
+
} from "./chunk-xmggaxg4.js";
|
|
10
|
+
import {
|
|
11
|
+
PipelineRunError
|
|
12
|
+
} from "./chunk-cy0n5dms.js";
|
|
13
|
+
import {
|
|
14
|
+
reportRunFailure
|
|
15
|
+
} from "./chunk-dsrkgtnh.js";
|
|
16
|
+
import {
|
|
17
|
+
assertAuthorized
|
|
18
|
+
} from "./chunk-4z3n1dzt.js";
|
|
19
|
+
import {
|
|
20
|
+
createSixbError,
|
|
21
|
+
toSixbFailure
|
|
22
|
+
} from "./chunk-0172wgm9.js";
|
|
23
|
+
|
|
24
|
+
// src/pipelines/errors.ts
|
|
25
|
+
class PipelineError extends Error {
|
|
26
|
+
name = "PipelineError";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/pipelines/run-dispatch.ts
|
|
30
|
+
import { randomUUID } from "crypto";
|
|
31
|
+
class PipelineRunDispatcher {
|
|
32
|
+
dependencies;
|
|
33
|
+
constructor(dependencies) {
|
|
34
|
+
this.dependencies = dependencies;
|
|
35
|
+
}
|
|
36
|
+
async dispatch(input) {
|
|
37
|
+
assertAutomaticDispatchInput(input);
|
|
38
|
+
const pipeline = this.dependencies.definitions.pipelines.getById(input.pipelineId);
|
|
39
|
+
if (!pipeline)
|
|
40
|
+
throw new PipelineError(`[Sixb] Unknown pipeline '${input.pipelineId}'`);
|
|
41
|
+
return dispatchPipelineRun({
|
|
42
|
+
errorReporterHost: this.dependencies,
|
|
43
|
+
projectId: this.dependencies.id,
|
|
44
|
+
pipeline,
|
|
45
|
+
storage: this.dependencies.storage,
|
|
46
|
+
queue: this.dependencies.queues.pipelines,
|
|
47
|
+
runId: input.runId,
|
|
48
|
+
metadata: input.metadata,
|
|
49
|
+
validateExistingRun: (run, storage) => assertAutomaticExecutionIdentity(storage, this.dependencies.id, input, run),
|
|
50
|
+
createExecution: async (executionId, runId) => createPrimitiveExecutionRecord({
|
|
51
|
+
id: executionId,
|
|
52
|
+
primitive: { kind: "pipeline", id: pipeline.id, runId },
|
|
53
|
+
origin: {
|
|
54
|
+
type: "automatic",
|
|
55
|
+
projectId: this.dependencies.id,
|
|
56
|
+
source: input.source,
|
|
57
|
+
correlationId: input.correlationId
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function dispatchPipelineRun(input) {
|
|
64
|
+
const runId = createPipelineRunId(input.runId);
|
|
65
|
+
const persisted = await persistPipelineRun(input, runId);
|
|
66
|
+
if (!persisted.publish)
|
|
67
|
+
return existingPipelineRunResult(persisted.run);
|
|
68
|
+
return publishPipelineRun(input, persisted);
|
|
69
|
+
}
|
|
70
|
+
async function persistPipelineRun(input, runId) {
|
|
71
|
+
const pipelineRuns = requirePipelineRunStorage(input.storage);
|
|
72
|
+
const existing = await pipelineRuns.getById({ projectId: input.projectId, id: runId });
|
|
73
|
+
if (existing)
|
|
74
|
+
return reusePipelineRun(input, existing);
|
|
75
|
+
const execution = await input.createExecution(`exec_${randomUUID()}`, runId);
|
|
76
|
+
const queuedAt = new Date;
|
|
77
|
+
try {
|
|
78
|
+
return await input.storage.transaction(async (tx) => {
|
|
79
|
+
const transactionalRuns = requirePipelineRunStorage(tx);
|
|
80
|
+
const raced = await transactionalRuns.getById({ projectId: input.projectId, id: runId });
|
|
81
|
+
if (raced) {
|
|
82
|
+
assertExistingRunMatchesRequest(raced, input);
|
|
83
|
+
await input.validateExistingRun?.(raced, tx);
|
|
84
|
+
return { publish: false, run: raced };
|
|
85
|
+
}
|
|
86
|
+
await tx.executions.create(execution);
|
|
87
|
+
const run = await transactionalRuns.queue({
|
|
88
|
+
projectId: input.projectId,
|
|
89
|
+
id: runId,
|
|
90
|
+
executionId: execution.id,
|
|
91
|
+
pipelineId: input.pipeline.id,
|
|
92
|
+
queuedAt
|
|
93
|
+
});
|
|
94
|
+
return { publish: true, run, execution, queuedAt, created: true };
|
|
95
|
+
}, { isolation: "serializable" });
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (!(error instanceof PipelineRunError))
|
|
98
|
+
throw error;
|
|
99
|
+
const raced = await pipelineRuns.getById({ projectId: input.projectId, id: runId });
|
|
100
|
+
if (!raced)
|
|
101
|
+
throw error;
|
|
102
|
+
assertExistingRunMatchesRequest(raced, input);
|
|
103
|
+
await input.validateExistingRun?.(raced, input.storage);
|
|
104
|
+
return { publish: false, run: raced };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function reusePipelineRun(input, existing) {
|
|
108
|
+
assertExistingRunMatchesRequest(existing, input);
|
|
109
|
+
await input.validateExistingRun?.(existing, input.storage);
|
|
110
|
+
if (existing.status !== "failed" || existing.error?.code !== "queue.enqueue_failed" || !existing.error.retryable) {
|
|
111
|
+
return { publish: false, run: existing };
|
|
112
|
+
}
|
|
113
|
+
const execution = await input.storage.executions.getById({
|
|
114
|
+
projectId: input.projectId,
|
|
115
|
+
id: existing.executionId
|
|
116
|
+
});
|
|
117
|
+
if (!execution) {
|
|
118
|
+
throw new PipelineRunError(`[Sixb] Execution '${existing.executionId}' for Pipeline run '${existing.id}' was not found.`);
|
|
119
|
+
}
|
|
120
|
+
const queuedAt = new Date;
|
|
121
|
+
const run = await requirePipelineRunStorage(input.storage).queue({
|
|
122
|
+
projectId: input.projectId,
|
|
123
|
+
id: existing.id,
|
|
124
|
+
executionId: existing.executionId,
|
|
125
|
+
pipelineId: existing.pipelineId,
|
|
126
|
+
queuedAt
|
|
127
|
+
});
|
|
128
|
+
return { publish: true, run, execution, queuedAt, created: false };
|
|
129
|
+
}
|
|
130
|
+
async function publishPipelineRun(input, persisted) {
|
|
131
|
+
try {
|
|
132
|
+
const [job] = await input.queue.enqueue({
|
|
133
|
+
projectId: input.projectId,
|
|
134
|
+
jobs: [
|
|
135
|
+
{
|
|
136
|
+
id: persisted.run.id,
|
|
137
|
+
type: "pipeline.run.requested",
|
|
138
|
+
payload: { runId: persisted.run.id },
|
|
139
|
+
...input.metadata === undefined ? {} : { metadata: input.metadata }
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
return {
|
|
144
|
+
pipelineId: persisted.run.pipelineId,
|
|
145
|
+
runId: persisted.run.id,
|
|
146
|
+
queuedAt: persisted.queuedAt.toISOString(),
|
|
147
|
+
...job?.id ? { jobId: job.id } : {},
|
|
148
|
+
created: persisted.created
|
|
149
|
+
};
|
|
150
|
+
} catch (error) {
|
|
151
|
+
const failedAt = new Date;
|
|
152
|
+
const failure = toEnqueueFailure(error, persisted.run, failedAt);
|
|
153
|
+
const failed = await requirePipelineRunStorage(input.storage).finish({
|
|
154
|
+
projectId: input.projectId,
|
|
155
|
+
id: persisted.run.id,
|
|
156
|
+
status: "failed",
|
|
157
|
+
finishedAt: failedAt,
|
|
158
|
+
error: failure
|
|
159
|
+
});
|
|
160
|
+
reportRunFailure(input.errorReporterHost, error, {
|
|
161
|
+
projectId: input.projectId,
|
|
162
|
+
runKind: "pipeline",
|
|
163
|
+
run: { runId: failed.id, pipelineId: failed.pipelineId },
|
|
164
|
+
failure
|
|
165
|
+
});
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function assertExistingRunMatchesRequest(existing, input) {
|
|
170
|
+
if (existing.pipelineId !== input.pipeline.id) {
|
|
171
|
+
throw new PipelineRunError(`[Sixb] Pipeline run '${existing.id}' already exists with a different request payload.`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function existingPipelineRunResult(existing) {
|
|
175
|
+
return {
|
|
176
|
+
pipelineId: existing.pipelineId,
|
|
177
|
+
runId: existing.id,
|
|
178
|
+
queuedAt: existing.queuedAt.toISOString(),
|
|
179
|
+
created: false
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function requirePipelineRunStorage(storage) {
|
|
183
|
+
if (!storage.pipelineRuns) {
|
|
184
|
+
throw new PipelineError("[Sixb] Pipeline run storage is not configured.");
|
|
185
|
+
}
|
|
186
|
+
return storage.pipelineRuns;
|
|
187
|
+
}
|
|
188
|
+
function createPipelineRunId(runId) {
|
|
189
|
+
if (runId === undefined)
|
|
190
|
+
return `run_${randomUUID()}`;
|
|
191
|
+
if (!runId.trim())
|
|
192
|
+
throw new PipelineError("[Sixb] Pipeline run id must not be empty");
|
|
193
|
+
return runId;
|
|
194
|
+
}
|
|
195
|
+
function assertAutomaticDispatchInput(input) {
|
|
196
|
+
assertNonBlank(input.pipelineId, "Pipeline id");
|
|
197
|
+
assertNonBlank(input.runId, "Pipeline run id");
|
|
198
|
+
assertNonBlank(input.source.eventId, "Pipeline source event id");
|
|
199
|
+
assertNonBlank(input.correlationId, "Pipeline correlation id");
|
|
200
|
+
}
|
|
201
|
+
async function assertAutomaticExecutionIdentity(storage, projectId, input, run) {
|
|
202
|
+
const execution = await storage.executions.getById({ projectId, id: run.executionId });
|
|
203
|
+
if (!execution || execution.source.type !== input.source.type || execution.source.eventId !== input.source.eventId || execution.correlationId !== input.correlationId || execution.requestedBy !== undefined) {
|
|
204
|
+
throw new PipelineError(`[Sixb] Pipeline run '${run.id}' already exists with different automatic provenance.`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function toEnqueueFailure(error, run, at) {
|
|
208
|
+
const enqueueError = createSixbError("queue.enqueue_failed", `[Sixb] Could not enqueue Pipeline run '${run.id}'.`, {
|
|
209
|
+
cause: error,
|
|
210
|
+
details: { pipelineId: run.pipelineId, runId: run.id, phase: "enqueue" }
|
|
211
|
+
});
|
|
212
|
+
return toSixbFailure(enqueueError, { allowedCodes: PIPELINE_RUN_FAILURE_CODES, at });
|
|
213
|
+
}
|
|
214
|
+
function assertNonBlank(value, label) {
|
|
215
|
+
if (!value.trim())
|
|
216
|
+
throw new PipelineError(`[Sixb] ${label} must not be empty.`);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// src/pipelines/request.ts
|
|
220
|
+
async function requestPipelineRun(runtime, execution, pipeline, options = {}) {
|
|
221
|
+
assertAuthorized(runtime, { kind: "pipeline.run", pipelineId: pipeline.id });
|
|
222
|
+
if (!runtime.storage.pipelineRuns) {
|
|
223
|
+
throw new PipelineError("[Sixb] Pipeline run storage is not configured.");
|
|
224
|
+
}
|
|
225
|
+
const queue = runtime.queues.pipelines;
|
|
226
|
+
if (!queue) {
|
|
227
|
+
throw new PipelineError("[Sixb] Pipeline run queue is not configured.");
|
|
228
|
+
}
|
|
229
|
+
return dispatchPipelineRun({
|
|
230
|
+
errorReporterHost: runtime,
|
|
231
|
+
projectId: runtime.projectId,
|
|
232
|
+
pipeline,
|
|
233
|
+
storage: runtime.storage,
|
|
234
|
+
queue,
|
|
235
|
+
...options,
|
|
236
|
+
createExecution: async (executionId, runId) => {
|
|
237
|
+
const caller = await ensureExecutionRecord(runtime.storage.executions, executionRecordInputFromRuntime({
|
|
238
|
+
execution,
|
|
239
|
+
runtimeAuthorization: runtime.runtimeAuthorization
|
|
240
|
+
}));
|
|
241
|
+
return createPrimitiveExecutionRecord({
|
|
242
|
+
id: executionId,
|
|
243
|
+
primitive: { kind: "pipeline", id: pipeline.id, runId },
|
|
244
|
+
origin: { type: "execution", parent: caller }
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export { PipelineError, PipelineRunDispatcher, requestPipelineRun };
|
|
251
|
+
|
|
252
|
+
//# debugId=80B62AEE05E80FC964756E2164756E21
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/pipelines/errors.ts", "../src/pipelines/run-dispatch.ts", "../src/pipelines/request.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export class PipelineError extends Error {\n readonly name = \"PipelineError\"\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 { Queues } from \"../queues\"\nimport type { SixbDefinitions } from \"../runtime/definitions\"\nimport type {\n CreateExecutionInput,\n PipelineRunFailureCode,\n PipelineRunRecord,\n Storage,\n} from \"../storage\"\nimport { PIPELINE_RUN_FAILURE_CODES, PipelineRunError } from \"../storage\"\nimport { PipelineError } from \"./errors\"\nimport type { PipelineRunRequestOptions, PipelineRunRequestResult } from \"./request\"\nimport type { PipelineDefinition } from \"./types\"\n\nexport type AutomaticPipelineExecutionSource =\n | { readonly type: \"schedule\"; readonly eventId: string }\n | { readonly type: \"event\"; readonly eventId: string }\n\nexport interface AutomaticPipelineRunDispatchInput extends PipelineRunRequestOptions {\n readonly pipelineId: string\n readonly runId: string\n readonly source: AutomaticPipelineExecutionSource\n readonly correlationId: string\n readonly metadata?: Readonly<Record<string, string>>\n}\n\nexport type PipelineRunDispatchPort = RunDispatcher<\n AutomaticPipelineRunDispatchInput,\n PipelineRunRequestResult\n>\n\nexport interface PipelineRunDispatcherDependencies {\n readonly id: string\n readonly definitions: Pick<SixbDefinitions, \"pipelines\">\n readonly storage: Storage\n readonly queues: Pick<Queues, \"pipelines\">\n}\n\ninterface DispatchPipelineRunInput extends PipelineRunRequestOptions {\n readonly errorReporterHost: object\n readonly projectId: string\n readonly pipeline: PipelineDefinition\n readonly storage: Storage\n readonly queue: Queues[\"pipelines\"]\n readonly metadata?: Readonly<Record<string, string>>\n readonly createExecution: (executionId: string, runId: string) => Promise<CreateExecutionInput>\n readonly validateExistingRun?: (run: PipelineRunRecord, storage: Storage) => Promise<void>\n}\n\ntype PersistedPipelineRun =\n | { readonly publish: false; readonly run: PipelineRunRecord }\n | {\n readonly publish: true\n readonly run: PipelineRunRecord\n readonly execution: CreateExecutionInput\n readonly queuedAt: Date\n readonly created: boolean\n }\n\n/** Core-owned durable dispatch boundary used by automatic Pipeline triggers. */\nexport class PipelineRunDispatcher implements PipelineRunDispatchPort {\n constructor(private readonly dependencies: PipelineRunDispatcherDependencies) {}\n\n async dispatch(input: AutomaticPipelineRunDispatchInput): Promise<PipelineRunRequestResult> {\n assertAutomaticDispatchInput(input)\n const pipeline = this.dependencies.definitions.pipelines.getById(input.pipelineId)\n if (!pipeline) throw new PipelineError(`[Sixb] Unknown pipeline '${input.pipelineId}'`)\n\n return dispatchPipelineRun({\n errorReporterHost: this.dependencies,\n projectId: this.dependencies.id,\n pipeline,\n storage: this.dependencies.storage,\n queue: this.dependencies.queues.pipelines,\n runId: input.runId,\n metadata: input.metadata,\n validateExistingRun: (run, storage) =>\n assertAutomaticExecutionIdentity(storage, this.dependencies.id, input, run),\n createExecution: async (executionId, runId) =>\n createPrimitiveExecutionRecord({\n id: executionId,\n primitive: { kind: \"pipeline\", id: pipeline.id, runId },\n origin: {\n type: \"automatic\",\n projectId: this.dependencies.id,\n source: input.source,\n correlationId: input.correlationId,\n },\n }),\n })\n }\n}\n\n/** Persist a Pipeline execution and queued run before publishing its queue job. */\nexport async function dispatchPipelineRun(\n input: DispatchPipelineRunInput\n): Promise<PipelineRunRequestResult> {\n const runId = createPipelineRunId(input.runId)\n const persisted = await persistPipelineRun(input, runId)\n if (!persisted.publish) return existingPipelineRunResult(persisted.run)\n return publishPipelineRun(input, persisted)\n}\n\nasync function persistPipelineRun(\n input: DispatchPipelineRunInput,\n runId: string\n): Promise<PersistedPipelineRun> {\n const pipelineRuns = requirePipelineRunStorage(input.storage)\n const existing = await pipelineRuns.getById({ projectId: input.projectId, id: runId })\n if (existing) return reusePipelineRun(input, existing)\n\n const execution = await input.createExecution(`exec_${randomUUID()}`, runId)\n const queuedAt = new Date()\n try {\n return await input.storage.transaction(\n async (tx): Promise<PersistedPipelineRun> => {\n const transactionalRuns = requirePipelineRunStorage(tx)\n const raced = await transactionalRuns.getById({ projectId: input.projectId, id: runId })\n if (raced) {\n assertExistingRunMatchesRequest(raced, input)\n await input.validateExistingRun?.(raced, tx)\n return { publish: false, run: raced }\n }\n\n await tx.executions.create(execution)\n const run = await transactionalRuns.queue({\n projectId: input.projectId,\n id: runId,\n executionId: execution.id,\n pipelineId: input.pipeline.id,\n queuedAt,\n })\n return { publish: true, run, execution, queuedAt, created: true }\n },\n { isolation: \"serializable\" }\n )\n } catch (error) {\n if (!(error instanceof PipelineRunError)) throw error\n const raced = await pipelineRuns.getById({ projectId: input.projectId, id: runId })\n if (!raced) throw error\n assertExistingRunMatchesRequest(raced, input)\n await input.validateExistingRun?.(raced, input.storage)\n return { publish: false, run: raced }\n }\n}\n\nasync function reusePipelineRun(\n input: DispatchPipelineRunInput,\n existing: PipelineRunRecord\n): Promise<PersistedPipelineRun> {\n assertExistingRunMatchesRequest(existing, input)\n await input.validateExistingRun?.(existing, input.storage)\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\n const execution = await input.storage.executions.getById({\n projectId: input.projectId,\n id: existing.executionId,\n })\n if (!execution) {\n throw new PipelineRunError(\n `[Sixb] Execution '${existing.executionId}' for Pipeline run '${existing.id}' was not found.`\n )\n }\n\n const queuedAt = new Date()\n const run = await requirePipelineRunStorage(input.storage).queue({\n projectId: input.projectId,\n id: existing.id,\n executionId: existing.executionId,\n pipelineId: existing.pipelineId,\n queuedAt,\n })\n return { publish: true, run, execution, queuedAt, created: false }\n}\n\nasync function publishPipelineRun(\n input: DispatchPipelineRunInput,\n persisted: Extract<PersistedPipelineRun, { readonly publish: true }>\n): Promise<PipelineRunRequestResult> {\n try {\n const [job] = await input.queue.enqueue({\n projectId: input.projectId,\n jobs: [\n {\n id: persisted.run.id,\n type: \"pipeline.run.requested\",\n payload: { runId: persisted.run.id },\n ...(input.metadata === undefined ? {} : { metadata: input.metadata }),\n },\n ],\n })\n return {\n pipelineId: persisted.run.pipelineId,\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 requirePipelineRunStorage(input.storage).finish({\n projectId: input.projectId,\n id: persisted.run.id,\n status: \"failed\",\n finishedAt: failedAt,\n error: failure,\n })\n reportRunFailure(input.errorReporterHost, error, {\n projectId: input.projectId,\n runKind: \"pipeline\",\n run: { runId: failed.id, pipelineId: failed.pipelineId },\n failure,\n })\n throw error\n }\n}\n\nfunction assertExistingRunMatchesRequest(\n existing: PipelineRunRecord,\n input: Pick<DispatchPipelineRunInput, \"pipeline\">\n): void {\n if (existing.pipelineId !== input.pipeline.id) {\n throw new PipelineRunError(\n `[Sixb] Pipeline run '${existing.id}' already exists with a different request payload.`\n )\n }\n}\n\nfunction existingPipelineRunResult(existing: PipelineRunRecord): PipelineRunRequestResult {\n return {\n pipelineId: existing.pipelineId,\n runId: existing.id,\n queuedAt: existing.queuedAt.toISOString(),\n created: false,\n }\n}\n\nfunction requirePipelineRunStorage(storage: Storage): NonNullable<Storage[\"pipelineRuns\"]> {\n if (!storage.pipelineRuns) {\n throw new PipelineError(\"[Sixb] Pipeline run storage is not configured.\")\n }\n return storage.pipelineRuns\n}\n\nfunction createPipelineRunId(runId: string | undefined): string {\n if (runId === undefined) return `run_${randomUUID()}`\n if (!runId.trim()) throw new PipelineError(\"[Sixb] Pipeline run id must not be empty\")\n return runId\n}\n\nfunction assertAutomaticDispatchInput(input: AutomaticPipelineRunDispatchInput): void {\n assertNonBlank(input.pipelineId, \"Pipeline id\")\n assertNonBlank(input.runId, \"Pipeline run id\")\n assertNonBlank(input.source.eventId, \"Pipeline source event id\")\n assertNonBlank(input.correlationId, \"Pipeline correlation id\")\n}\n\nasync function assertAutomaticExecutionIdentity(\n storage: Storage,\n projectId: string,\n input: AutomaticPipelineRunDispatchInput,\n run: PipelineRunRecord\n): Promise<void> {\n const execution = await storage.executions.getById({ projectId, id: run.executionId })\n if (\n !execution ||\n execution.source.type !== input.source.type ||\n execution.source.eventId !== input.source.eventId ||\n execution.correlationId !== input.correlationId ||\n execution.requestedBy !== undefined\n ) {\n throw new PipelineError(\n `[Sixb] Pipeline run '${run.id}' already exists with different automatic provenance.`\n )\n }\n}\n\nfunction toEnqueueFailure(\n error: unknown,\n run: PipelineRunRecord,\n at: Date\n): SixbFailure<PipelineRunFailureCode> {\n const enqueueError = createSixbError(\n \"queue.enqueue_failed\",\n `[Sixb] Could not enqueue Pipeline run '${run.id}'.`,\n {\n cause: error,\n details: { pipelineId: run.pipelineId, runId: run.id, phase: \"enqueue\" },\n }\n )\n return toSixbFailure(enqueueError, { allowedCodes: PIPELINE_RUN_FAILURE_CODES, at })\n}\n\nfunction assertNonBlank(value: string, label: string): void {\n if (!value.trim()) throw new PipelineError(`[Sixb] ${label} must not be empty.`)\n}\n",
|
|
7
|
+
"import { assertAuthorized } from \"../authorization\"\nimport {\n createPrimitiveExecutionRecord,\n ensureExecutionRecord,\n executionRecordInputFromRuntime,\n} from \"../execution/durable\"\nimport type { ExecutionContext } from \"../execution/types\"\nimport type { SixbRuntimeContext } from \"../runtime/types\"\nimport { PipelineError } from \"./errors\"\nimport { dispatchPipelineRun } from \"./run-dispatch\"\nimport type { PipelineDefinition } from \"./types\"\n\nexport interface PipelineRunRequestOptions {\n /** Stable identity used to make dispatch idempotent. */\n readonly runId?: string\n}\n\nexport interface RequestPipelineRunInput extends PipelineRunRequestOptions {\n readonly pipelineId: string\n}\n\nexport interface PipelineRunRequestResult {\n readonly pipelineId: string\n readonly runId: string\n /** Durable time at which the run entered the queue. */\n readonly queuedAt: string\n readonly jobId?: string\n readonly created: boolean\n}\n\n/**\n * Authorize and queue a pipeline run request.\n *\n * Operates on an already-resolved definition and the shared runtime context, so the HTTP route and\n * the runtime verb cannot drift apart.\n *\n * The immutable child execution and queued run are persisted before queue publication.\n */\nexport async function requestPipelineRun(\n runtime: SixbRuntimeContext,\n execution: ExecutionContext,\n pipeline: PipelineDefinition,\n options: PipelineRunRequestOptions = {}\n): Promise<PipelineRunRequestResult> {\n assertAuthorized(runtime, { kind: \"pipeline.run\", pipelineId: pipeline.id })\n if (!runtime.storage.pipelineRuns) {\n throw new PipelineError(\"[Sixb] Pipeline run storage is not configured.\")\n }\n\n const queue = runtime.queues.pipelines\n if (!queue) {\n throw new PipelineError(\"[Sixb] Pipeline run queue is not configured.\")\n }\n\n return dispatchPipelineRun({\n errorReporterHost: runtime,\n projectId: runtime.projectId,\n pipeline,\n storage: runtime.storage,\n queue,\n ...options,\n createExecution: async (executionId, runId) => {\n const caller = await ensureExecutionRecord(\n runtime.storage.executions,\n executionRecordInputFromRuntime({\n execution,\n runtimeAuthorization: runtime.runtimeAuthorization,\n })\n )\n return createPrimitiveExecutionRecord({\n id: executionId,\n primitive: { kind: \"pipeline\", id: pipeline.id, runId },\n origin: { type: \"execution\", parent: caller },\n })\n },\n })\n}\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,sBAAsB,MAAM;AAAA,EAC9B,OAAO;AAClB;;;ACFA;AAiEO,MAAM,sBAAyD;AAAA,EACvC;AAAA,EAA7B,WAAW,CAAkB,cAAiD;AAAA,IAAjD;AAAA;AAAA,OAEvB,SAAQ,CAAC,OAA6E;AAAA,IAC1F,6BAA6B,KAAK;AAAA,IAClC,MAAM,WAAW,KAAK,aAAa,YAAY,UAAU,QAAQ,MAAM,UAAU;AAAA,IACjF,IAAI,CAAC;AAAA,MAAU,MAAM,IAAI,cAAc,4BAA4B,MAAM,aAAa;A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,iBAAiB,OAAO,aAAa,UAAU;AAAA,MAC7C,MAAM,SAAS,MAAM,sBACnB,QAAQ,QAAQ,YAChB,gCAAgC;AAAA,QAC9B;AAAA,QACA,sBAAsB,QAAQ;AAAA,MAChC,CAAC,CACH;AAAA,MACA,OAAO,+BAA+B;AAAA,QACpC,IAAI;AAAA,QACJ,WAAW,EAAE,MAAM,YAAY,IAAI,SAAS,IAAI,MAAM;AAAA,QACtD,QAAQ,EAAE,MAAM,aAAa,QAAQ,OAAO;AAAA,MAC9C,CAAC;AAAA;AAAA,EAEL,CAAC;AAAA;",
|
|
10
|
+
"debugId": "80B62AEE05E80FC964756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createLinkTokenMap,
|
|
4
4
|
createPropertyTokenMap
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4gz41why.js";
|
|
6
6
|
import {
|
|
7
7
|
validatePrimaryProperties,
|
|
8
8
|
validatePropertyDefinitions,
|
|
9
9
|
validateQueryMetadata
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-rnshztfq.js";
|
|
11
11
|
import {
|
|
12
12
|
OntologyNotFoundError,
|
|
13
13
|
OntologyValidationError,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/ontology/registry.ts", "../src/ontology/builders.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * Standalone ontology registry — owns all type state and resolution logic.\n *\n * Zero infrastructure dependencies: imports only from the `ontology/` module.\n * Other modules depend on `OntologyRegistry` instead of coupling to the full\n * `Sixb` facade.\n */\n\nimport {\n formatUnknownObjectTypeMessage,\n OntologyNotFoundError,\n OntologyValidationError,\n} from \"./errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"./tokens\"\nimport { createLinkTokenMap, createPropertyTokenMap } from \"./tokens\"\nimport type { ObjectType, Schema, ValueType } from \"./types\"\nimport {\n validatePrimaryProperties,\n validatePropertyDefinitions,\n validateQueryMetadata,\n} from \"./validation\"\n\n// ── Input types ──────────────────────────────────────────────\n\n/** Typed wrapper used by `createSixb` to register full ontology documents. */\nexport type OntologyDocumentInput = {\n readonly id: string\n readonly version: string\n readonly objectTypes: readonly ObjectTypeWithPropertyTokens[]\n readonly valueTypes?: readonly ValueType[]\n}\n\n/**\n * Runtime accepts either full ontology documents or individual object types.\n * This keeps setup flexible while preserving strict typing.\n */\nexport type OntologySource = ObjectTypeWithPropertyTokens | OntologyDocumentInput\n\nexport interface OntologyRegistryOptions {\n readonly sources: readonly OntologySource[]\n}\n\n// ── Private helpers ──────────────────────────────────────────\n\nfunction isOntologyDocumentSource(\n source: OntologySource\n): source is Exclude<OntologySource, ObjectTypeWithPropertyTokens> {\n return \"objectTypes\" in source\n}\n\n/**\n * Recursively walk a schema tree and collect ValueTypes discovered\n * via `valueTypeRef` nodes that carry a `_resolved` schema.\n *\n * This enables auto-registration: when codegen emits `valueTypeRef(VT)`,\n * it stores the resolved schema inline. We extract it here so the runtime\n * `valueTypesById` registry is populated without requiring users to pass\n * ValueTypes explicitly.\n */\nfunction extractValueTypesFromSchema(\n schema: Schema,\n collected: Map<string, ValueType>,\n seen: Set<string>\n): void {\n if (typeof schema === \"string\") return\n\n if (schema.type === \"valueTypeRef\") {\n if (schema._resolved && !seen.has(schema.valueTypeId)) {\n seen.add(schema.valueTypeId)\n const localName = schema.valueTypeId.includes(\":\")\n ? schema.valueTypeId.slice(schema.valueTypeId.indexOf(\":\") + 1)\n : schema.valueTypeId\n collected.set(schema.valueTypeId, {\n id: schema.valueTypeId,\n name: localName,\n schema: schema._resolved,\n })\n extractValueTypesFromSchema(schema._resolved, collected, seen)\n }\n return\n }\n\n if (schema.type === \"object\") {\n for (const field of Object.values(schema.properties)) {\n extractValueTypesFromSchema(field.schema, collected, seen)\n }\n return\n }\n\n if (schema.type === \"array\") {\n extractValueTypesFromSchema(schema.items, collected, seen)\n return\n }\n\n if (schema.type === \"map\") {\n extractValueTypesFromSchema(schema.valueSchema, collected, seen)\n }\n}\n\nfunction collectOntology(sources: readonly OntologySource[]): {\n objectTypes: ObjectTypeWithPropertyTokens[]\n valueTypes: ValueType[]\n} {\n const objectTypes: ObjectTypeWithPropertyTokens[] = []\n const valueTypes: ValueType[] = []\n const seenObjectTypes = new Set<ObjectTypeWithPropertyTokens>()\n\n for (const source of sources) {\n if (isOntologyDocumentSource(source)) {\n for (const ot of source.objectTypes) {\n if (!seenObjectTypes.has(ot)) {\n seenObjectTypes.add(ot)\n objectTypes.push(ot)\n }\n }\n valueTypes.push(...(source.valueTypes ?? []))\n } else {\n if (!seenObjectTypes.has(source)) {\n seenObjectTypes.add(source)\n objectTypes.push(source)\n }\n }\n }\n\n // Auto-discover ValueTypes embedded in ObjectType schemas via _resolved.\n // Explicit ValueTypes (from OntologyDocumentInput) take priority.\n const explicitIds = new Set(valueTypes.map((vt) => vt.id))\n const discovered = new Map<string, ValueType>()\n\n for (const objectType of objectTypes) {\n for (const property of objectType.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n for (const linkDef of objectType.links) {\n if (linkDef.properties) {\n for (const property of linkDef.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n }\n }\n }\n\n valueTypes.push(...discovered.values())\n\n return { objectTypes, valueTypes }\n}\n\n// ── OntologyRegistry ─────────────────────────────────────────\n\n/**\n * Self-contained registry for ontology types.\n *\n * Holds all object types, value types, the subtype graph, and the primary\n * property mapping. Validates inheritance chains and flattens inherited\n * properties at construction time.\n *\n * Exposes read-only accessors so consumers never mutate ontology state.\n */\nexport class OntologyRegistry {\n private readonly objectTypesById = new Map<string, ObjectTypeWithPropertyTokens>()\n private readonly valueTypesById = new Map<string, ValueType>()\n private readonly subTypesById = new Map<string, Set<string>>()\n private readonly primaryByTypeId: Map<string, string>\n\n constructor(options: OntologyRegistryOptions) {\n const { objectTypes, valueTypes } = collectOntology(options.sources)\n\n for (const objectType of objectTypes) {\n if (this.objectTypesById.has(objectType.id)) {\n throw new OntologyValidationError(`Duplicate object type id: ${objectType.id}`)\n }\n this.objectTypesById.set(objectType.id, objectType)\n }\n\n for (const valueType of valueTypes) {\n if (this.valueTypesById.has(valueType.id)) {\n throw new OntologyValidationError(`Duplicate value type id: ${valueType.id}`)\n }\n this.valueTypesById.set(valueType.id, valueType)\n }\n\n this.validateAndBuildExtendsRegistry()\n this.resolveInheritedProperties()\n validatePropertyDefinitions(this.objectTypesById, this.valueTypesById)\n validateQueryMetadata(this.objectTypesById, this.valueTypesById)\n this.primaryByTypeId = validatePrimaryProperties(this.objectTypesById)\n }\n\n // ── Public read API ──────────────────────────────────────\n\n /** All registered object types. */\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[] {\n return [...this.objectTypesById.values()]\n }\n\n /** Lookup an object type by id. Returns `null` if not found. */\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null {\n return this.objectTypesById.get(objectTypeId) ?? null\n }\n\n /**\n * Lookup an object type by id, throwing if it does not exist.\n *\n * Use this when the caller requires the type to exist and should fail\n * loudly on unknown types (e.g., write operations receiving a type id).\n */\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens {\n const objectType = this.objectTypesById.get(objectTypeId)\n if (!objectType) {\n throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n }\n return objectType\n }\n\n /** Get the primary property id for a given object type. Throws if unknown. */\n getPrimaryPropertyId(objectTypeId: string): string {\n const id = this.primaryByTypeId.get(objectTypeId)\n if (!id) throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n return id\n }\n\n /** Collect all transitive sub-types of the given object type id. */\n listSubTypes(objectTypeId: string): string[] {\n const result: string[] = []\n const collect = (typeId: string): void => {\n const children = this.subTypesById.get(typeId)\n if (!children) return\n for (const childId of children) {\n result.push(childId)\n collect(childId)\n }\n }\n collect(objectTypeId)\n return result\n }\n\n /** Get the structural extends chain from root ancestor to the provided type. */\n listAncestorChain(objectType: ObjectType): readonly ObjectTypeWithPropertyTokens[] {\n const chain: ObjectTypeWithPropertyTokens[] = []\n let current: ObjectTypeWithPropertyTokens | null = this.resolveObjectType(objectType.id)\n const seen = new Set<string>()\n\n while (current) {\n if (seen.has(current.id)) {\n throw new OntologyValidationError(\n `Circular extends chain detected while resolving ancestors for \"${objectType.id}\".`\n )\n }\n seen.add(current.id)\n chain.push(current)\n current = current.extends ? this.resolveObjectType(current.extends) : null\n }\n\n return chain.reverse()\n }\n\n /**\n * Check whether `actual` is a valid target for a link expecting `expected`.\n *\n * Supports wildcard `\"*\"`, single concrete types, and arrays. A type\n * matches if it equals the expected type or is a transitive subtype.\n */\n isValidLinkTarget(expected: string | string[], actual: string): boolean {\n if (expected === \"*\") return true\n const types = Array.isArray(expected) ? expected : [expected]\n if (types.includes(\"*\")) return true\n for (const type of types) {\n if (actual === type || this.listSubTypes(type).includes(actual)) return true\n }\n return false\n }\n\n // ── Map accessors (read-only views) ──────────────────────\n\n /** Read-only view of all object types by id. */\n getObjectTypesById(): ReadonlyMap<string, ObjectTypeWithPropertyTokens> {\n return this.objectTypesById\n }\n\n /** Read-only view of all value types by id. */\n getValueTypesById(): ReadonlyMap<string, ValueType> {\n return this.valueTypesById\n }\n\n /** Read-only view of primary property ids by object type id. */\n getPrimaryByTypeId(): ReadonlyMap<string, string> {\n return this.primaryByTypeId\n }\n\n // ── Private initialization ───────────────────────────────\n\n /**\n * Build the subtype graph from `extends` and `parents` declarations.\n *\n * Validates that parent types exist and detects circular `extends` chains.\n */\n private validateAndBuildExtendsRegistry(): void {\n const resolving = new Set<string>()\n const resolved = new Set<string>()\n\n const registerChild = (parentId: string, childId: string): void => {\n let children = this.subTypesById.get(parentId)\n if (!children) {\n children = new Set()\n this.subTypesById.set(parentId, children)\n }\n children.add(childId)\n }\n\n const visit = (typeId: string, chain: string[]): void => {\n if (resolved.has(typeId)) return\n\n const objectType = this.objectTypesById.get(typeId)\n if (!objectType || !objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n const parentId = objectType.extends\n\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" extends unknown type \"${parentId}\". If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n\n if (resolving.has(typeId)) {\n throw new OntologyValidationError(\n `Circular extends chain detected: ${[...chain, typeId].join(\" → \")}`\n )\n }\n\n resolving.add(typeId)\n visit(parentId, [...chain, typeId])\n\n registerChild(parentId, typeId)\n\n resolving.delete(typeId)\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n visit(typeId, [])\n }\n\n for (const [typeId, objectType] of this.objectTypesById) {\n if (!objectType.parents) continue\n for (const parentId of objectType.parents) {\n if (parentId === objectType.extends) continue\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" lists unknown parent \"${parentId}\" in parents. If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n registerChild(parentId, typeId)\n }\n }\n }\n\n /**\n * For types with string `extends`, merge parent properties/links\n * and rebuild tokens. Idempotent: no-op if already flattened (codegen case).\n */\n private resolveInheritedProperties(): void {\n const resolved = new Set<string>()\n\n const resolve = (typeId: string): void => {\n if (resolved.has(typeId)) return\n const objectType = this.objectTypesById.get(typeId)!\n\n if (!objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n resolve(objectType.extends)\n const parent = this.objectTypesById.get(objectType.extends)!\n\n const mergeById = <T extends { id: string }>(\n parentItems: readonly T[],\n childItems: readonly T[]\n ): T[] => {\n const childIds = new Set(childItems.map((item) => item.id))\n const fromParent = parentItems.filter((item) => !childIds.has(item.id))\n return [...fromParent, ...childItems]\n }\n\n const mergedProperties = mergeById(parent.properties, objectType.properties)\n const mergedLinks = mergeById(parent.links, objectType.links)\n\n const changed =\n mergedProperties.length !== objectType.properties.length ||\n mergedLinks.length !== objectType.links.length\n\n if (changed) {\n const merged: ObjectType = {\n ...objectType,\n properties: mergedProperties,\n links: mergedLinks,\n }\n const withTokens: ObjectTypeWithPropertyTokens = {\n ...merged,\n p: createPropertyTokenMap(merged),\n }\n ;(withTokens as ObjectTypeWithPropertyTokens & { l: unknown }).l =\n createLinkTokenMap(merged)\n this.objectTypesById.set(typeId, withTokens)\n }\n\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n resolve(typeId)\n }\n }\n}\n",
|
|
5
|
+
"/**\n * Standalone ontology registry — owns all type state and resolution logic.\n *\n * Zero infrastructure dependencies: imports only from the `ontology/` module.\n * Other modules depend on its read-only catalog instead of coupling to the full\n * `Sixb` facade.\n */\n\nimport {\n formatUnknownObjectTypeMessage,\n OntologyNotFoundError,\n OntologyValidationError,\n} from \"./errors\"\nimport type { ObjectTypeWithPropertyTokens } from \"./tokens\"\nimport { createLinkTokenMap, createPropertyTokenMap } from \"./tokens\"\nimport type { ObjectType, Schema, ValueType } from \"./types\"\nimport {\n validatePrimaryProperties,\n validatePropertyDefinitions,\n validateQueryMetadata,\n} from \"./validation\"\n\n// ── Input types ──────────────────────────────────────────────\n\n/** Typed wrapper used by `createSixb` to register full ontology documents. */\nexport type OntologyDocumentInput = {\n readonly id: string\n readonly version: string\n readonly objectTypes: readonly ObjectTypeWithPropertyTokens[]\n readonly valueTypes?: readonly ValueType[]\n}\n\n/**\n * Runtime accepts either full ontology documents or individual object types.\n * This keeps setup flexible while preserving strict typing.\n */\nexport type OntologySource = ObjectTypeWithPropertyTokens | OntologyDocumentInput\n\nexport interface OntologyRegistryOptions {\n readonly sources: readonly OntologySource[]\n}\n\n/** Read-only access to the host's validated ontology definitions and type graph. */\nexport interface OntologyDefinitionCatalog {\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[]\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens\n getPrimaryPropertyId(objectTypeId: string): string\n listSubTypes(objectTypeId: string): string[]\n listAncestorChain(objectType: ObjectType): readonly ObjectTypeWithPropertyTokens[]\n isValidLinkTarget(expected: string | string[], actual: string): boolean\n getObjectTypesById(): ReadonlyMap<string, ObjectTypeWithPropertyTokens>\n getValueTypesById(): ReadonlyMap<string, ValueType>\n getPrimaryByTypeId(): ReadonlyMap<string, string>\n}\n\n// ── Private helpers ──────────────────────────────────────────\n\nfunction isOntologyDocumentSource(\n source: OntologySource\n): source is Exclude<OntologySource, ObjectTypeWithPropertyTokens> {\n return \"objectTypes\" in source\n}\n\n/**\n * Recursively walk a schema tree and collect ValueTypes discovered\n * via `valueTypeRef` nodes that carry a `_resolved` schema.\n *\n * This enables auto-registration: when codegen emits `valueTypeRef(VT)`,\n * it stores the resolved schema inline. We extract it here so the runtime\n * `valueTypesById` registry is populated without requiring users to pass\n * ValueTypes explicitly.\n */\nfunction extractValueTypesFromSchema(\n schema: Schema,\n collected: Map<string, ValueType>,\n seen: Set<string>\n): void {\n if (typeof schema === \"string\") return\n\n if (schema.type === \"valueTypeRef\") {\n if (schema._resolved && !seen.has(schema.valueTypeId)) {\n seen.add(schema.valueTypeId)\n const localName = schema.valueTypeId.includes(\":\")\n ? schema.valueTypeId.slice(schema.valueTypeId.indexOf(\":\") + 1)\n : schema.valueTypeId\n collected.set(schema.valueTypeId, {\n id: schema.valueTypeId,\n name: localName,\n schema: schema._resolved,\n })\n extractValueTypesFromSchema(schema._resolved, collected, seen)\n }\n return\n }\n\n if (schema.type === \"object\") {\n for (const field of Object.values(schema.properties)) {\n extractValueTypesFromSchema(field.schema, collected, seen)\n }\n return\n }\n\n if (schema.type === \"array\") {\n extractValueTypesFromSchema(schema.items, collected, seen)\n return\n }\n\n if (schema.type === \"map\") {\n extractValueTypesFromSchema(schema.valueSchema, collected, seen)\n }\n}\n\nfunction collectOntology(sources: readonly OntologySource[]): {\n objectTypes: ObjectTypeWithPropertyTokens[]\n valueTypes: ValueType[]\n} {\n const objectTypes: ObjectTypeWithPropertyTokens[] = []\n const valueTypes: ValueType[] = []\n const seenObjectTypes = new Set<ObjectTypeWithPropertyTokens>()\n\n for (const source of sources) {\n if (isOntologyDocumentSource(source)) {\n for (const ot of source.objectTypes) {\n if (!seenObjectTypes.has(ot)) {\n seenObjectTypes.add(ot)\n objectTypes.push(ot)\n }\n }\n valueTypes.push(...(source.valueTypes ?? []))\n } else {\n if (!seenObjectTypes.has(source)) {\n seenObjectTypes.add(source)\n objectTypes.push(source)\n }\n }\n }\n\n // Auto-discover ValueTypes embedded in ObjectType schemas via _resolved.\n // Explicit ValueTypes (from OntologyDocumentInput) take priority.\n const explicitIds = new Set(valueTypes.map((vt) => vt.id))\n const discovered = new Map<string, ValueType>()\n\n for (const objectType of objectTypes) {\n for (const property of objectType.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n for (const linkDef of objectType.links) {\n if (linkDef.properties) {\n for (const property of linkDef.properties) {\n extractValueTypesFromSchema(property.schema, discovered, explicitIds)\n }\n }\n }\n }\n\n valueTypes.push(...discovered.values())\n\n return { objectTypes, valueTypes }\n}\n\n// ── OntologyRegistry ─────────────────────────────────────────\n\n/**\n * Self-contained registry for ontology types.\n *\n * Holds all object types, value types, the subtype graph, and the primary\n * property mapping. Validates inheritance chains and flattens inherited\n * properties at construction time.\n *\n * Exposes read-only accessors so consumers never mutate ontology state.\n */\nexport class OntologyRegistry implements OntologyDefinitionCatalog {\n private readonly objectTypesById = new Map<string, ObjectTypeWithPropertyTokens>()\n private readonly valueTypesById = new Map<string, ValueType>()\n private readonly subTypesById = new Map<string, Set<string>>()\n private readonly primaryByTypeId: Map<string, string>\n\n constructor(options: OntologyRegistryOptions) {\n const { objectTypes, valueTypes } = collectOntology(options.sources)\n\n for (const objectType of objectTypes) {\n if (this.objectTypesById.has(objectType.id)) {\n throw new OntologyValidationError(`Duplicate object type id: ${objectType.id}`)\n }\n this.objectTypesById.set(objectType.id, objectType)\n }\n\n for (const valueType of valueTypes) {\n if (this.valueTypesById.has(valueType.id)) {\n throw new OntologyValidationError(`Duplicate value type id: ${valueType.id}`)\n }\n this.valueTypesById.set(valueType.id, valueType)\n }\n\n this.validateAndBuildExtendsRegistry()\n this.resolveInheritedProperties()\n validatePropertyDefinitions(this.objectTypesById, this.valueTypesById)\n validateQueryMetadata(this.objectTypesById, this.valueTypesById)\n this.primaryByTypeId = validatePrimaryProperties(this.objectTypesById)\n }\n\n // ── Public read API ──────────────────────────────────────\n\n /** All registered object types. */\n listObjectTypes(): readonly ObjectTypeWithPropertyTokens[] {\n return [...this.objectTypesById.values()]\n }\n\n /** Lookup an object type by id. Returns `null` if not found. */\n getObjectTypeById(objectTypeId: string): ObjectTypeWithPropertyTokens | null {\n return this.objectTypesById.get(objectTypeId) ?? null\n }\n\n /**\n * Lookup an object type by id, throwing if it does not exist.\n *\n * Use this when the caller requires the type to exist and should fail\n * loudly on unknown types (e.g., write operations receiving a type id).\n */\n resolveObjectType(objectTypeId: string): ObjectTypeWithPropertyTokens {\n const objectType = this.objectTypesById.get(objectTypeId)\n if (!objectType) {\n throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n }\n return objectType\n }\n\n /** Get the primary property id for a given object type. Throws if unknown. */\n getPrimaryPropertyId(objectTypeId: string): string {\n const id = this.primaryByTypeId.get(objectTypeId)\n if (!id) throw new OntologyNotFoundError(formatUnknownObjectTypeMessage(objectTypeId))\n return id\n }\n\n /** Collect all transitive sub-types of the given object type id. */\n listSubTypes(objectTypeId: string): string[] {\n const result: string[] = []\n const collect = (typeId: string): void => {\n const children = this.subTypesById.get(typeId)\n if (!children) return\n for (const childId of children) {\n result.push(childId)\n collect(childId)\n }\n }\n collect(objectTypeId)\n return result\n }\n\n /** Get the structural extends chain from root ancestor to the provided type. */\n listAncestorChain(objectType: ObjectType): readonly ObjectTypeWithPropertyTokens[] {\n const chain: ObjectTypeWithPropertyTokens[] = []\n let current: ObjectTypeWithPropertyTokens | null = this.resolveObjectType(objectType.id)\n const seen = new Set<string>()\n\n while (current) {\n if (seen.has(current.id)) {\n throw new OntologyValidationError(\n `Circular extends chain detected while resolving ancestors for \"${objectType.id}\".`\n )\n }\n seen.add(current.id)\n chain.push(current)\n current = current.extends ? this.resolveObjectType(current.extends) : null\n }\n\n return chain.reverse()\n }\n\n /**\n * Check whether `actual` is a valid target for a link expecting `expected`.\n *\n * Supports wildcard `\"*\"`, single concrete types, and arrays. A type\n * matches if it equals the expected type or is a transitive subtype.\n */\n isValidLinkTarget(expected: string | string[], actual: string): boolean {\n if (expected === \"*\") return true\n const types = Array.isArray(expected) ? expected : [expected]\n if (types.includes(\"*\")) return true\n for (const type of types) {\n if (actual === type || this.listSubTypes(type).includes(actual)) return true\n }\n return false\n }\n\n // ── Map accessors (read-only views) ──────────────────────\n\n /** Read-only view of all object types by id. */\n getObjectTypesById(): ReadonlyMap<string, ObjectTypeWithPropertyTokens> {\n return this.objectTypesById\n }\n\n /** Read-only view of all value types by id. */\n getValueTypesById(): ReadonlyMap<string, ValueType> {\n return this.valueTypesById\n }\n\n /** Read-only view of primary property ids by object type id. */\n getPrimaryByTypeId(): ReadonlyMap<string, string> {\n return this.primaryByTypeId\n }\n\n // ── Private initialization ───────────────────────────────\n\n /**\n * Build the subtype graph from `extends` and `parents` declarations.\n *\n * Validates that parent types exist and detects circular `extends` chains.\n */\n private validateAndBuildExtendsRegistry(): void {\n const resolving = new Set<string>()\n const resolved = new Set<string>()\n\n const registerChild = (parentId: string, childId: string): void => {\n let children = this.subTypesById.get(parentId)\n if (!children) {\n children = new Set()\n this.subTypesById.set(parentId, children)\n }\n children.add(childId)\n }\n\n const visit = (typeId: string, chain: string[]): void => {\n if (resolved.has(typeId)) return\n\n const objectType = this.objectTypesById.get(typeId)\n if (!objectType || !objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n const parentId = objectType.extends\n\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" extends unknown type \"${parentId}\". If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n\n if (resolving.has(typeId)) {\n throw new OntologyValidationError(\n `Circular extends chain detected: ${[...chain, typeId].join(\" → \")}`\n )\n }\n\n resolving.add(typeId)\n visit(parentId, [...chain, typeId])\n\n registerChild(parentId, typeId)\n\n resolving.delete(typeId)\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n visit(typeId, [])\n }\n\n for (const [typeId, objectType] of this.objectTypesById) {\n if (!objectType.parents) continue\n for (const parentId of objectType.parents) {\n if (parentId === objectType.extends) continue\n if (!this.objectTypesById.has(parentId)) {\n throw new OntologyValidationError(\n `ObjectType \"${typeId}\" lists unknown parent \"${parentId}\" in parents. If \"${parentId}\" comes from an external ontology, add it to 'ontologies' in createSixb().`\n )\n }\n registerChild(parentId, typeId)\n }\n }\n }\n\n /**\n * For types with string `extends`, merge parent properties/links\n * and rebuild tokens. Idempotent: no-op if already flattened (codegen case).\n */\n private resolveInheritedProperties(): void {\n const resolved = new Set<string>()\n\n const resolve = (typeId: string): void => {\n if (resolved.has(typeId)) return\n const objectType = this.objectTypesById.get(typeId)!\n\n if (!objectType.extends) {\n resolved.add(typeId)\n return\n }\n\n resolve(objectType.extends)\n const parent = this.objectTypesById.get(objectType.extends)!\n\n const mergeById = <T extends { id: string }>(\n parentItems: readonly T[],\n childItems: readonly T[]\n ): T[] => {\n const childIds = new Set(childItems.map((item) => item.id))\n const fromParent = parentItems.filter((item) => !childIds.has(item.id))\n return [...fromParent, ...childItems]\n }\n\n const mergedProperties = mergeById(parent.properties, objectType.properties)\n const mergedLinks = mergeById(parent.links, objectType.links)\n\n const changed =\n mergedProperties.length !== objectType.properties.length ||\n mergedLinks.length !== objectType.links.length\n\n if (changed) {\n const merged: ObjectType = {\n ...objectType,\n properties: mergedProperties,\n links: mergedLinks,\n }\n const withTokens: ObjectTypeWithPropertyTokens = {\n ...merged,\n p: createPropertyTokenMap(merged),\n }\n ;(withTokens as ObjectTypeWithPropertyTokens & { l: unknown }).l =\n createLinkTokenMap(merged)\n this.objectTypesById.set(typeId, withTokens)\n }\n\n resolved.add(typeId)\n }\n\n for (const typeId of this.objectTypesById.keys()) {\n resolve(typeId)\n }\n }\n}\n",
|
|
6
6
|
"/**\n * Builder helpers for ontology modeling.\n *\n * These functions provide shorthand for constructing `ObjectType`, `ValueType`,\n * `Interface`, `Property`, `ObjectLink`, and `EnumSchema` values with sensible\n * defaults so you can focus on the semantics rather than boilerplate.\n *\n * ```ts\n * import { defineObjectType, prop, link, stringEnum } from \"@sixb/core\"\n *\n * const thermostat = defineObjectType({\n * id: \"thermostat\",\n * name: \"Thermostat\",\n * properties: [\n * prop(\"currentTemperature\", \"double\", {\n * name: \"Current Temperature\",\n * semanticType: \"Temperature\",\n * required: true,\n * }),\n * prop(\"mode\", stringEnum([\"off\", \"heat\", \"cool\", \"auto\"])),\n * ],\n * links: [\n * link.ref(\"controls\", \"hvacZone\", { cardinality: \"one\" }),\n * ],\n * })\n * ```\n */\n\nimport type { ObjectTypeWithPropertyTokens, ObjectTypeWithTokens, PropertyTokenMap } from \"./tokens\"\nimport { createLinkTokenMap, createPropertyTokenMap } from \"./tokens\"\nimport type {\n EnumSchema,\n Interface,\n LinkCardinality,\n ObjectLink,\n ObjectLinkTargetMetadata,\n ObjectType,\n Ontology,\n Property,\n PropertyMode,\n PropertyQueryMetadata,\n Schema,\n ValueType,\n ValueTypeRefSchema,\n} from \"./types\"\nimport type { QuantitativeTypeId } from \"./units\"\n\ntype NameFromOptions<TId extends string, TOptions> = TOptions extends {\n name: infer TName extends string\n}\n ? TName\n : TId\n\n/**\n * Preserve literal option values when an option key is provided.\n *\n * Why this exists:\n * - `prop(\"x\", \"string\", { required: true })` should keep `required` as literal `true`\n * (not widen to `boolean`) so downstream inference can treat the field as required.\n */\ntype FieldFromOptions<TOptions, TKey extends string, TFallback> =\n TOptions extends Record<TKey, infer TValue>\n ? { [K in TKey]: TValue }\n : { [K in TKey]?: TFallback }\n\nconst selfLinkTargetObjectTypeId = \"__sixb.self__\"\ntype SelfLinkTargetObjectTypeId = typeof selfLinkTargetObjectTypeId\n\ntype NormalizeSelfLink<TObjectTypeId extends string, TLink> = TLink extends {\n targetObjectTypeId: SelfLinkTargetObjectTypeId\n}\n ? Omit<TLink, \"targetObjectTypeId\"> & { targetObjectTypeId: TObjectTypeId }\n : TLink\n\ntype NormalizeSelfLinks<TObjectTypeId extends string, TLinks extends readonly ObjectLink[]> = {\n -readonly [K in keyof TLinks]: NormalizeSelfLink<TObjectTypeId, TLinks[K]>\n}\n\n// ── Extends type utilities ───────────────────────────────────\n\n/**\n * Merge parent + child collections by id. Uses built-in `Exclude` on\n * the element union — no recursion, no \"excessively deep\" errors.\n */\ntype MergedCollection<\n TParent extends readonly { id: string }[],\n TChild extends readonly { id: string }[],\n> = Array<Exclude<TParent[number], { id: TChild[number][\"id\"] }> | TChild[number]>\n\n/**\n * Extract child's own collection, normalized as a mutable tuple. Falls back to [].\n */\ntype OwnCollection<TInput, TKey extends string, TItem> =\n TInput extends Record<TKey, infer T extends readonly TItem[]> ? [...T] : []\n\ntype OwnLinks<TInput> = TInput extends { id: infer TObjectTypeId extends string }\n ? TInput extends Record<\"links\", infer TLinks extends readonly ObjectLink[]>\n ? NormalizeSelfLinks<TObjectTypeId, TLinks>\n : []\n : []\n\n/**\n * Merge two arrays by id: parent items first, child items override by id.\n */\nfunction mergeById<T extends { id: string }>(parent: readonly T[], child: readonly T[]): T[] {\n const childIds = new Set(child.map((item) => item.id))\n const fromParent = parent.filter((item) => !childIds.has(item.id))\n return [...fromParent, ...child]\n}\n\n// ── Object Type ─────────────────────────────────────────────\n\ntype DefineObjectTypeBase = Omit<ObjectType, \"properties\" | \"links\" | \"extends\" | \"parents\">\n\n/**\n * Structural constraint for the `extends` field.\n *\n * We require only the data needed for merge (id + collections), not the\n * full `ObjectTypeWithTokens<ObjectType>`. The latter requires\n * `LinkTokenMap<ObjectType>` with a `{ [id: string]: LinkToken }` index\n * signature, which is incompatible with the literal-keyed maps produced by\n * concrete `defineObjectType()` calls.\n */\ntype DefineObjectTypeInput = DefineObjectTypeBase & {\n extends?:\n | string\n | {\n readonly id: string\n readonly properties: readonly Property[]\n readonly links: readonly ObjectLink[]\n }\n parents?: readonly string[]\n properties?: readonly Property[]\n links?: readonly ObjectLink[]\n}\n\n/**\n * Normalize `parents` from readonly tuple to mutable `string[] | undefined`.\n */\ntype NormalizeParents<TInput> = TInput extends { parents: infer P extends readonly string[] }\n ? { parents: [...P] }\n : { parents?: undefined }\n\ntype DefineObjectTypeResult<TInput extends DefineObjectTypeInput> = Omit<\n TInput,\n \"properties\" | \"links\" | \"extends\" | \"parents\"\n> &\n (TInput extends {\n extends: infer TParent extends {\n id: string\n properties: readonly Property[]\n links: readonly ObjectLink[]\n }\n }\n ? NormalizeParents<TInput> & {\n extends: TParent[\"id\"]\n properties: MergedCollection<\n TParent[\"properties\"],\n OwnCollection<TInput, \"properties\", Property>\n >\n links: MergedCollection<TParent[\"links\"], OwnLinks<TInput>>\n }\n : TInput extends { extends: infer TParentId extends string }\n ? {\n extends: TParentId\n parents: string[]\n properties: OwnCollection<TInput, \"properties\", Property>\n links: OwnLinks<TInput>\n }\n : NormalizeParents<TInput> & {\n extends: undefined\n properties: OwnCollection<TInput, \"properties\", Property>\n links: OwnLinks<TInput>\n })\n\ntype DefineObjectTypeWithTokensResult<TInput extends DefineObjectTypeInput> = ObjectTypeWithTokens<\n DefineObjectTypeResult<TInput>\n>\n\n/**\n * Define an object type with sensible defaults.\n *\n * `properties` and `links` default to `[]` so you can define\n * a bare object type with just `id` and `name`.\n */\nexport function defineObjectType<const TInput extends DefineObjectTypeInput>(\n input: TInput\n): DefineObjectTypeWithTokensResult<TInput>\nexport function defineObjectType(input: DefineObjectTypeInput): ObjectTypeWithTokens<ObjectType> {\n const ext = input.extends\n\n const ownProperties = input.properties ? [...input.properties] : []\n const ownLinks = input.links\n ? input.links.map((link) => normalizeSelfLinkTarget(input.id, link))\n : []\n\n let extendsId: string | undefined\n let parentIds: string[] | undefined\n let properties: Property[]\n let links: ObjectLink[]\n\n if (typeof ext === \"string\") {\n // Pre-flattened: string extends — no merge, properties/links taken as-is\n extendsId = ext\n parentIds = [ext, ...(input.parents ?? []).filter((id) => id !== ext)]\n properties = ownProperties\n links = ownLinks\n } else if (ext != null) {\n // Object extends — merge parent collections\n extendsId = ext.id\n parentIds = [ext.id, ...(input.parents ?? []).filter((id) => id !== ext.id)]\n properties = mergeById(ext.properties, ownProperties)\n links = mergeById([...ext.links], ownLinks)\n } else {\n // No extends\n extendsId = undefined\n parentIds = input.parents ? [...input.parents] : undefined\n properties = ownProperties\n links = ownLinks\n }\n\n const objectType: ObjectType = {\n id: input.id,\n name: input.name,\n description: input.description,\n quantityKind: input.quantityKind,\n seeAlso: input.seeAlso,\n extends: extendsId,\n parents: parentIds,\n implements: input.implements,\n properties,\n links,\n search: input.search,\n }\n\n return {\n ...objectType,\n l: createLinkTokenMap(objectType),\n p: createPropertyTokenMap(objectType),\n }\n}\n\nfunction normalizeSelfLinkTarget(objectTypeId: string, link: ObjectLink): ObjectLink {\n if (link.targetObjectTypeId !== selfLinkTargetObjectTypeId) {\n return link\n }\n\n return {\n ...link,\n targetObjectTypeId: objectTypeId,\n }\n}\n\n// ── Ontology ────────────────────────────────────────────────\n\ntype DefineOntologyBase = Omit<Ontology, \"objectTypes\" | \"valueTypes\" | \"interfaces\">\n\ntype DefineOntologyInput = DefineOntologyBase & {\n objectTypes?: readonly ObjectType[]\n valueTypes?: readonly ValueType[]\n interfaces?: readonly Interface[]\n}\n\ntype DefineOntologyResult<TInput extends DefineOntologyInput> = Omit<\n TInput,\n \"objectTypes\" | \"valueTypes\" | \"interfaces\"\n> & {\n objectTypes: TInput extends { objectTypes: infer TObjectTypes extends readonly ObjectType[] }\n ? [...TObjectTypes]\n : []\n valueTypes: TInput extends { valueTypes: infer TValueTypes extends readonly ValueType[] }\n ? [...TValueTypes]\n : []\n interfaces: TInput extends { interfaces: infer TInterfaces extends readonly Interface[] }\n ? [...TInterfaces]\n : []\n}\n\n/**\n * Define a complete ontology document.\n *\n * `objectTypes`, `valueTypes`, and `interfaces` default to `[]`.\n */\nexport function defineOntology<const TInput extends DefineOntologyInput>(\n input: TInput\n): DefineOntologyResult<TInput>\nexport function defineOntology(input: DefineOntologyInput): Ontology {\n return {\n ...input,\n objectTypes: input.objectTypes ? [...input.objectTypes] : [],\n valueTypes: input.valueTypes ? [...input.valueTypes] : [],\n interfaces: input.interfaces ? [...input.interfaces] : [],\n }\n}\n\n// ── Value Type ──────────────────────────────────────────────\n\n/**\n * Define a reusable value type.\n *\n * Identity function for type inference and discoverability — the `define*`\n * prefix makes it easy to find all ontology builders.\n */\nexport function defineValueType<const TValueType extends ValueType>(input: TValueType): TValueType {\n return input\n}\n\n// ── Interface ───────────────────────────────────────────────\n\ntype DefineInterfaceBase = Omit<Interface, \"properties\" | \"links\">\n\ntype DefineInterfaceInput = DefineInterfaceBase & {\n properties?: readonly Property[]\n links?: readonly ObjectLink[]\n}\n\ntype DefineInterfaceResult<TInput extends DefineInterfaceInput> = Omit<\n TInput,\n \"properties\" | \"links\"\n> & {\n properties: TInput extends { properties: infer TProperties extends readonly Property[] }\n ? [...TProperties]\n : []\n links: TInput extends { links: infer TLinks extends readonly ObjectLink[] } ? [...TLinks] : []\n}\n\n/**\n * Define a reusable interface contract.\n *\n * `properties` and `links` default to `[]`.\n */\nexport function defineInterface<const TInput extends DefineInterfaceInput>(\n input: TInput\n): DefineInterfaceResult<TInput>\nexport function defineInterface(input: DefineInterfaceInput): Interface {\n return {\n ...input,\n properties: input.properties ? [...input.properties] : [],\n links: input.links ? [...input.links] : [],\n }\n}\n\n// ── Property shorthand ──────────────────────────────────────\n\ntype PropertyOptions = {\n name?: string\n description?: string\n required?: boolean\n nullable?: boolean\n primary?: true\n mode?: PropertyMode\n semanticType?: QuantitativeTypeId\n query?: PropertyQueryMetadata\n}\n\ntype PropertyResult<\n TId extends string,\n TSchema extends Schema,\n TOptions extends PropertyOptions | undefined,\n> = {\n id: TId\n name: NameFromOptions<TId, TOptions>\n schema: TSchema\n} & FieldFromOptions<TOptions, \"description\", string> &\n FieldFromOptions<TOptions, \"required\", boolean> &\n FieldFromOptions<TOptions, \"nullable\", boolean> &\n FieldFromOptions<TOptions, \"primary\", true> &\n FieldFromOptions<TOptions, \"mode\", PropertyMode> &\n FieldFromOptions<TOptions, \"semanticType\", QuantitativeTypeId> &\n FieldFromOptions<TOptions, \"query\", PropertyQueryMetadata>\n\n/**\n * Shorthand for creating a {@link Property}.\n *\n * `name` defaults to `id` — override via `options.name` when you need\n * a separate display name.\n *\n * ```ts\n * prop(\"currentTemperature\", \"double\", {\n * name: \"Current Temperature\",\n * semanticType: \"Temperature\",\n * required: true,\n * })\n * ```\n */\n// Overloads keep option literals (e.g. `required: true`, `mode: \"telemetry\"`) intact.\nexport function prop<const TId extends string, const TSchema extends Schema>(\n id: TId,\n schema: TSchema\n): PropertyResult<TId, TSchema, undefined>\nexport function prop<\n const TId extends string,\n const TSchema extends Schema,\n const TOptions extends PropertyOptions,\n>(id: TId, schema: TSchema, options: TOptions): PropertyResult<TId, TSchema, TOptions>\nexport function prop(id: string, schema: Schema, options?: PropertyOptions): Property {\n return {\n id,\n name: options?.name ?? id,\n schema,\n ...options,\n }\n}\n\n// ── Link shorthand ──────────────────────────────────────────\n\n/**\n * Runtime check: does a value look like an ObjectType?\n *\n * Discriminates ObjectType from LinkOptions by checking for `properties` and `links`\n * arrays — ObjectType always has them, LinkOptions never does.\n */\nfunction isObjectTypeLike(value: unknown): value is ObjectType {\n return (\n typeof value === \"object\" &&\n value !== null &&\n Array.isArray((value as Record<string, unknown>).properties) &&\n Array.isArray((value as Record<string, unknown>).links)\n )\n}\n\ntype LinkOptions = {\n name?: string\n description?: string\n cardinality?: LinkCardinality\n properties?: Property[]\n}\n\ntype LinkResult<\n TId extends string,\n TTargetObjectTypeId,\n TOptions extends LinkOptions | undefined,\n> = {\n id: TId\n name: NameFromOptions<TId, TOptions>\n targetObjectTypeId: TTargetObjectTypeId\n} & FieldFromOptions<TOptions, \"description\", string> &\n FieldFromOptions<TOptions, \"cardinality\", LinkCardinality> &\n FieldFromOptions<TOptions, \"properties\", Property[]>\n\nexport type DirectLinkResult<\n TId extends string,\n TTargetObjectTypeId,\n TOptions extends LinkOptions | undefined,\n TTarget,\n> = LinkResult<TId, TTargetObjectTypeId, TOptions> & ObjectLinkTargetMetadata<TTarget>\n\ntype ObjectTypeIdArray<TTargets extends readonly ObjectType[]> = Array<TTargets[number][\"id\"]>\nexport type DirectLinkTarget<\n TId extends string,\n TName extends string,\n TProperties extends Property[],\n> = {\n id: TId\n name: TName\n properties: TProperties\n links: ObjectLink[]\n readonly p: PropertyTokenMap<{\n id: TId\n name: TName\n properties: TProperties\n links: ObjectLink[]\n }>\n}\n\ntype DirectLinkTargetFor<TTarget extends ObjectType> = TTarget extends ObjectTypeWithPropertyTokens\n ? DirectLinkTarget<TTarget[\"id\"], TTarget[\"name\"], TTarget[\"properties\"]>\n : TTarget\n\n/**\n * Shorthand for creating an {@link ObjectLink}.\n *\n * `link(...)` accepts direct ObjectType targets and preserves their type for\n * query authoring. Use `link.ref(...)` for id-only references, `link.self(...)`\n * for recursive links, and `link.any(...)` for wildcard links.\n *\n * ```ts\n * // ObjectType target — extracts .id at runtime and preserves the target type\n * link(\"controls\", HVACZone, { cardinality: \"one\" })\n *\n * // Id target — resolved by the generated ontology type manifest\n * link.ref(\"controls\", \"hvacZone\", { cardinality: \"one\" })\n *\n * // Self target — normalized to the source object type id by defineObjectType()\n * link.self(\"parent\", { cardinality: \"one\" })\n *\n * // Multiple targets\n * link(\"rel\", [TypeA, TypeB])\n *\n * // Wildcard — accepts any target type\n * link.any(\"anything\")\n * link.any(\"anything\", { cardinality: \"many\" })\n * ```\n */\ninterface LinkCallable {\n <const TId extends string, const TTarget extends ObjectType>(\n id: TId,\n target: TTarget\n ): DirectLinkResult<TId, TTarget[\"id\"], undefined, DirectLinkTargetFor<TTarget>>\n\n <const TId extends string, const TTarget extends ObjectType, const TOptions extends LinkOptions>(\n id: TId,\n target: TTarget,\n options: TOptions\n ): DirectLinkResult<TId, TTarget[\"id\"], TOptions, DirectLinkTargetFor<TTarget>>\n\n <const TId extends string, const TTargets extends readonly ObjectType[]>(\n id: TId,\n targets: TTargets\n ): DirectLinkResult<\n TId,\n ObjectTypeIdArray<TTargets>,\n undefined,\n DirectLinkTargetFor<TTargets[number]>\n >\n\n <\n const TId extends string,\n const TTargets extends readonly ObjectType[],\n const TOptions extends LinkOptions,\n >(\n id: TId,\n targets: TTargets,\n options: TOptions\n ): DirectLinkResult<\n TId,\n ObjectTypeIdArray<TTargets>,\n TOptions,\n DirectLinkTargetFor<TTargets[number]>\n >\n}\n\ninterface LinkBuilder extends LinkCallable {\n ref: typeof linkRef\n self: typeof linkSelf\n any: typeof linkAny\n}\n\nconst linkImpl = ((\n id: string,\n targetOrTargets: ObjectType | readonly ObjectType[],\n options?: LinkOptions\n): ObjectLink => {\n if (Array.isArray(targetOrTargets)) {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: targetOrTargets.map((target) => target.id),\n ...options,\n }\n }\n\n if (isObjectTypeLike(targetOrTargets)) {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: targetOrTargets.id,\n ...options,\n }\n }\n\n throw new Error(\n `[Sixb] link(\"${id}\", ...) requires an ObjectType target. Use link.ref(...) for id references, link.self(...) for self-links, or link.any(...) for wildcard links.`\n )\n}) as LinkCallable\n\nfunction linkRef<\n const TId extends string,\n const TTargetObjectTypeId extends string | readonly string[],\n>(id: TId, targetObjectTypeId: TTargetObjectTypeId): LinkResult<TId, TTargetObjectTypeId, undefined>\nfunction linkRef<\n const TId extends string,\n const TTargetObjectTypeId extends string | readonly string[],\n const TOptions extends LinkOptions,\n>(\n id: TId,\n targetObjectTypeId: TTargetObjectTypeId,\n options: TOptions\n): LinkResult<TId, TTargetObjectTypeId, TOptions>\nfunction linkRef(\n id: string,\n targetObjectTypeId: string | readonly string[],\n options?: LinkOptions\n): ObjectLink {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId:\n typeof targetObjectTypeId === \"string\" ? targetObjectTypeId : [...targetObjectTypeId],\n ...options,\n }\n}\n\nfunction linkSelf<\n const TId extends string,\n const TOptions extends LinkOptions | undefined = undefined,\n>(id: TId, options?: TOptions): LinkResult<TId, SelfLinkTargetObjectTypeId, TOptions> {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: selfLinkTargetObjectTypeId,\n ...options,\n } as LinkResult<TId, SelfLinkTargetObjectTypeId, TOptions>\n}\n\nfunction linkAny<\n const TId extends string,\n const TOptions extends LinkOptions | undefined = undefined,\n>(id: TId, options?: TOptions): LinkResult<TId, \"*\", TOptions> {\n return {\n id,\n name: options?.name ?? id,\n targetObjectTypeId: \"*\",\n ...options,\n } as LinkResult<TId, \"*\", TOptions>\n}\n\nexport const link: LinkBuilder = Object.assign(linkImpl, {\n ref: linkRef,\n self: linkSelf,\n any: linkAny,\n})\n\n// ── ValueType ref shorthand ─────────────────────────────────\n\n/**\n * Create a value-type reference schema.\n *\n * ```ts\n * prop(\"azimuth\", valueTypeRef(\"bsh:AzimuthShape\"))\n * prop(\"area\", valueTypeRef(AreaShape)) // self-contained, no tuple needed\n * ```\n */\n// 1. String id only (existing behavior, no resolution)\nexport function valueTypeRef<const TId extends string>(\n valueTypeId: TId\n): ValueTypeRefSchema & { valueTypeId: TId }\n// 2. ValueType object (concise, self-contained)\nexport function valueTypeRef<const TVT extends ValueType>(\n valueType: TVT\n): { type: \"valueTypeRef\"; valueTypeId: TVT[\"id\"]; _resolved: TVT[\"schema\"] }\n// 3. String id + explicit schema (escape hatch)\nexport function valueTypeRef<const TId extends string, const TResolved extends Schema>(\n valueTypeId: TId,\n resolved: TResolved\n): { type: \"valueTypeRef\"; valueTypeId: TId; _resolved: TResolved }\n// Implementation\nexport function valueTypeRef(\n idOrValueType: string | ValueType,\n resolved?: Schema\n): ValueTypeRefSchema {\n if (typeof idOrValueType === \"string\") {\n if (resolved !== undefined) {\n return { type: \"valueTypeRef\", valueTypeId: idOrValueType, _resolved: resolved }\n }\n return { type: \"valueTypeRef\", valueTypeId: idOrValueType }\n }\n return {\n type: \"valueTypeRef\",\n valueTypeId: idOrValueType.id,\n _resolved: idOrValueType.schema,\n }\n}\n\n// ── Enum helpers ────────────────────────────────────────────\n\n/**\n * Create a string enum schema.\n *\n * ```ts\n * prop(\"mode\", stringEnum([\"off\", \"heat\", \"cool\", \"auto\"]))\n * ```\n */\nexport function stringEnum<const V extends readonly string[]>(\n values: V\n): EnumSchema & {\n values: [...V]\n} {\n return { type: \"enum\", valueType: \"string\", values: [...values] }\n}\n\n/**\n * Create an integer enum schema.\n *\n * ```ts\n * prop(\"fanSpeed\", integerEnum([1, 2, 3]))\n * ```\n */\nexport function integerEnum<const V extends readonly number[]>(\n values: V\n): EnumSchema & {\n values: [...V]\n} {\n return { type: \"enum\", valueType: \"integer\", values: [...values] }\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;AA4CA,SAAS,wBAAwB,CAC/B,QACiE;AAAA,EACjE,OAAO,iBAAiB;AAAA;AAY1B,SAAS,2BAA2B,CAClC,QACA,WACA,MACM;AAAA,EACN,IAAI,OAAO,WAAW;AAAA,IAAU;AAAA,EAEhC,IAAI,OAAO,SAAS,gBAAgB;AAAA,IAClC,IAAI,OAAO,aAAa,CAAC,KAAK,IAAI,OAAO,WAAW,GAAG;AAAA,MACrD,KAAK,IAAI,OAAO,WAAW;AAAA,MAC3B,MAAM,YAAY,OAAO,YAAY,SAAS,GAAG,IAC7C,OAAO,YAAY,MAAM,OAAO,YAAY,QAAQ,GAAG,IAAI,CAAC,IAC5D,OAAO;AAAA,MACX,UAAU,IAAI,OAAO,aAAa;AAAA,QAChC,IAAI,OAAO;AAAA,QACX,MAAM;AAAA,QACN,QAAQ,OAAO;AAAA,MACjB,CA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