@lucern/contracts 0.3.0-alpha.1 → 0.3.0-alpha.11
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/CHANGELOG.md +4 -0
- package/dist/api-enums.contract.d.ts +5 -3
- package/dist/api-enums.contract.js +14 -12
- package/dist/api-enums.contract.js.map +1 -1
- package/dist/component-boundary.contract.d.ts +14 -0
- package/dist/component-boundary.contract.js +174 -0
- package/dist/component-boundary.contract.js.map +1 -0
- package/dist/component-host-boundary.contract.d.ts +46 -0
- package/dist/component-host-boundary.contract.js +60 -0
- package/dist/component-host-boundary.contract.js.map +1 -0
- package/dist/context-pack.contract.d.ts +5 -3
- package/dist/context-pack.contract.js.map +1 -1
- package/dist/{defineTable-CBQ03FXl.d.ts → defineTable-t1wr5wgn.d.ts} +1 -1
- package/dist/{dsl-BgpoVOVQ.d.ts → dsl-DVPthQGY.d.ts} +2 -2
- package/dist/dsl.d.ts +2 -2
- package/dist/dsl.js +1 -4
- package/dist/dsl.js.map +1 -1
- package/dist/edge-policy-manifest-Dw5IhT1L.d.ts +133 -0
- package/dist/function-registry/beliefs.d.ts +54 -41
- package/dist/function-registry/beliefs.js +759 -38
- package/dist/function-registry/beliefs.js.map +1 -1
- package/dist/function-registry/coding.d.ts +9 -0
- package/dist/function-registry/coding.js +811 -39
- package/dist/function-registry/coding.js.map +1 -1
- package/dist/function-registry/context.d.ts +19 -13
- package/dist/function-registry/context.js +750 -42
- package/dist/function-registry/context.js.map +1 -1
- package/dist/function-registry/contracts.d.ts +6 -0
- package/dist/function-registry/contracts.js +715 -35
- package/dist/function-registry/contracts.js.map +1 -1
- package/dist/function-registry/coordination.d.ts +12 -0
- package/dist/function-registry/coordination.js +715 -35
- package/dist/function-registry/coordination.js.map +1 -1
- package/dist/function-registry/edges.d.ts +165 -0
- package/dist/function-registry/edges.js +923 -67
- package/dist/function-registry/edges.js.map +1 -1
- package/dist/function-registry/evidence.d.ts +44 -33
- package/dist/function-registry/evidence.js +769 -47
- package/dist/function-registry/evidence.js.map +1 -1
- package/dist/function-registry/graph.d.ts +149 -53
- package/dist/function-registry/graph.js +831 -42
- package/dist/function-registry/graph.js.map +1 -1
- package/dist/function-registry/helpers.d.ts +6 -3
- package/dist/function-registry/helpers.js +716 -36
- package/dist/function-registry/helpers.js.map +1 -1
- package/dist/function-registry/identity.d.ts +6 -0
- package/dist/function-registry/identity.js +715 -35
- package/dist/function-registry/identity.js.map +1 -1
- package/dist/function-registry/index.d.ts +5 -3
- package/dist/function-registry/index.js +722 -39
- package/dist/function-registry/index.js.map +1 -1
- package/dist/function-registry/judgments.d.ts +14 -9
- package/dist/function-registry/judgments.js +727 -38
- package/dist/function-registry/judgments.js.map +1 -1
- package/dist/function-registry/legacy.d.ts +4 -0
- package/dist/function-registry/legacy.js +715 -35
- package/dist/function-registry/legacy.js.map +1 -1
- package/dist/function-registry/lenses.d.ts +24 -17
- package/dist/function-registry/lenses.js +738 -38
- package/dist/function-registry/lenses.js.map +1 -1
- package/dist/function-registry/manifest.d.ts +6 -6
- package/dist/function-registry/manifest.js +18 -2
- package/dist/function-registry/manifest.js.map +1 -1
- package/dist/function-registry/nodes.d.ts +412 -0
- package/dist/function-registry/nodes.js +5303 -0
- package/dist/function-registry/nodes.js.map +1 -0
- package/dist/function-registry/ontologies.d.ts +59 -45
- package/dist/function-registry/ontologies.js +733 -41
- package/dist/function-registry/ontologies.js.map +1 -1
- package/dist/function-registry/pipeline.d.ts +19 -13
- package/dist/function-registry/pipeline.js +724 -38
- package/dist/function-registry/pipeline.js.map +1 -1
- package/dist/function-registry/questions.d.ts +64 -49
- package/dist/function-registry/questions.js +812 -43
- package/dist/function-registry/questions.js.map +1 -1
- package/dist/function-registry/tasks.d.ts +24 -17
- package/dist/function-registry/tasks.js +776 -44
- package/dist/function-registry/tasks.js.map +1 -1
- package/dist/function-registry/topics.d.ts +109 -21
- package/dist/function-registry/topics.js +797 -39
- package/dist/function-registry/topics.js.map +1 -1
- package/dist/function-registry/types.d.ts +6 -2
- package/dist/function-registry/worktrees.d.ts +94 -41
- package/dist/function-registry/worktrees.js +854 -47
- package/dist/function-registry/worktrees.js.map +1 -1
- package/dist/function-registry-input-audit.d.ts +13 -0
- package/dist/function-registry-input-audit.js +166 -0
- package/dist/function-registry-input-audit.js.map +1 -0
- package/dist/gateway.contract.d.ts +5 -0
- package/dist/gateway.contract.js.map +1 -1
- package/dist/generated/convexSchemas.d.ts +3 -3
- package/dist/generated/convexSchemas.js +38 -18
- package/dist/generated/convexSchemas.js.map +1 -1
- package/dist/generated/infisicalRuntimeEnv.d.ts +70 -0
- package/dist/generated/infisicalRuntimeEnv.js +26572 -0
- package/dist/generated/infisicalRuntimeEnv.js.map +1 -0
- package/dist/generated/lucernGatewayEnv.d.ts +17 -0
- package/dist/generated/lucernGatewayEnv.js +38 -0
- package/dist/generated/lucernGatewayEnv.js.map +1 -0
- package/dist/generated/lucernWebPublicEnv.d.ts +26 -0
- package/dist/generated/lucernWebPublicEnv.js +32 -0
- package/dist/generated/lucernWebPublicEnv.js.map +1 -0
- package/dist/generated/lucernWebServerEnv.d.ts +33 -0
- package/dist/generated/lucernWebServerEnv.js +51 -0
- package/dist/generated/lucernWebServerEnv.js.map +1 -0
- package/dist/generated/schema-manifest.json +1199 -138
- package/dist/generated/tableOwnership.d.ts +47 -27
- package/dist/generated/tableOwnership.js +66 -26
- package/dist/generated/tableOwnership.js.map +1 -1
- package/dist/generated/tier-expectations.json +62 -8
- package/dist/graph-intelligence.contract.d.ts +506 -0
- package/dist/graph-intelligence.contract.js +595 -0
- package/dist/graph-intelligence.contract.js.map +1 -0
- package/dist/graph-types/index.d.ts +5 -1
- package/dist/graph-types/index.js +15 -4
- package/dist/graph-types/index.js.map +1 -1
- package/dist/index-CM1Pl_vI.d.ts +28 -0
- package/dist/index.d.ts +29 -414
- package/dist/index.js +34791 -1088
- package/dist/index.js.map +1 -1
- package/dist/infisical-runtime.contract.d.ts +1768 -0
- package/dist/infisical-runtime.contract.js +3093 -0
- package/dist/infisical-runtime.contract.js.map +1 -0
- package/dist/lens-filter.contract.js +4 -3
- package/dist/lens-filter.contract.js.map +1 -1
- package/dist/lens-workflow.contract.js +4 -3
- package/dist/lens-workflow.contract.js.map +1 -1
- package/dist/manifests/edge-policy-manifest.d.ts +2 -0
- package/dist/manifests/edge-policy-manifest.data.d.ts +13 -0
- package/dist/manifests/edge-policy-manifest.data.js +26 -0
- package/dist/manifests/edge-policy-manifest.data.js.map +1 -0
- package/dist/manifests/edge-policy-manifest.js +92 -0
- package/dist/manifests/edge-policy-manifest.js.map +1 -0
- package/dist/manifests/infisical-runtime-manifest.d.ts +1672 -0
- package/dist/manifests/infisical-runtime-manifest.js +2948 -0
- package/dist/manifests/infisical-runtime-manifest.js.map +1 -0
- package/dist/manifests/invariant-manifest.d.ts +65 -0
- package/dist/manifests/invariant-manifest.js +18 -0
- package/dist/manifests/invariant-manifest.js.map +1 -0
- package/dist/manifests/invariants/ast-utils.d.ts +14 -0
- package/dist/manifests/invariants/ast-utils.js +54 -0
- package/dist/manifests/invariants/ast-utils.js.map +1 -0
- package/dist/manifests/invariants/index.d.ts +15 -0
- package/dist/manifests/invariants/index.js +183 -0
- package/dist/manifests/invariants/index.js.map +1 -0
- package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +12 -0
- package/dist/manifests/invariants/inv-1-beliefs-append-only.js +94 -0
- package/dist/manifests/invariants/inv-1-beliefs-append-only.js.map +1 -0
- package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +12 -0
- package/dist/manifests/invariants/inv-14-no-silent-transitions.js +99 -0
- package/dist/manifests/invariants/inv-14-no-silent-transitions.js.map +1 -0
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +12 -0
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +42 -0
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -0
- package/dist/manifests/tenant-client-manifest.d.ts +322 -0
- package/dist/manifests/tenant-client-manifest.js +432 -0
- package/dist/manifests/tenant-client-manifest.js.map +1 -0
- package/dist/mcp-gateway-boundary.contract.d.ts +201 -0
- package/dist/mcp-gateway-boundary.contract.js +45 -0
- package/dist/mcp-gateway-boundary.contract.js.map +1 -0
- package/dist/projections/check-convex-args-shape.d.ts +3 -0
- package/dist/projections/check-convex-args-shape.js +403 -0
- package/dist/projections/check-convex-args-shape.js.map +1 -0
- package/dist/projections/create-evidence.projection.d.ts +176 -0
- package/dist/projections/create-evidence.projection.js +130 -0
- package/dist/projections/create-evidence.projection.js.map +1 -0
- package/dist/projections/index.d.ts +102 -0
- package/dist/projections/index.js +352 -0
- package/dist/projections/index.js.map +1 -0
- package/dist/projections/list-beliefs.projection.d.ts +36 -0
- package/dist/projections/list-beliefs.projection.js +54 -0
- package/dist/projections/list-beliefs.projection.js.map +1 -0
- package/dist/projections/list-tasks.projection.d.ts +44 -0
- package/dist/projections/list-tasks.projection.js +57 -0
- package/dist/projections/list-tasks.projection.js.map +1 -0
- package/dist/projections/modulate-confidence.projection.d.ts +219 -0
- package/dist/projections/modulate-confidence.projection.js +148 -0
- package/dist/projections/modulate-confidence.projection.js.map +1 -0
- package/dist/projections/projection-dsl.d.ts +11 -0
- package/dist/projections/projection-dsl.js +8 -0
- package/dist/projections/projection-dsl.js.map +1 -0
- package/dist/proof-attestation.json +45 -0
- package/dist/schema-helpers/enumValidation.js +2 -5
- package/dist/schema-helpers/enumValidation.js.map +1 -1
- package/dist/schema-helpers/spine/nodes/decision.js +2 -1
- package/dist/schema-helpers/spine/nodes/decision.js.map +1 -1
- package/dist/schema-helpers/spine/tables/epistemicNodes.js +27 -27
- package/dist/schema-helpers/spine/tables/epistemicNodes.js.map +1 -1
- package/dist/schemas/component-table-manifest.d.ts +6 -6
- package/dist/schemas/component-table-manifest.js +2 -2
- package/dist/schemas/component-table-manifest.js.map +1 -1
- package/dist/schemas/enums.d.ts +5 -2
- package/dist/schemas/enums.js +5 -2
- package/dist/schemas/enums.js.map +1 -1
- package/dist/schemas/index.d.ts +3 -3
- package/dist/schemas/index.js +1129 -139
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/manifest.d.ts +2979 -949
- package/dist/schemas/manifest.js +1127 -137
- package/dist/schemas/manifest.js.map +1 -1
- package/dist/schemas/sl-opinion.d.ts +4 -4
- package/dist/schemas/tables/controlPlane/accessControl.d.ts +260 -0
- package/dist/schemas/tables/controlPlane/accessControl.js +653 -0
- package/dist/schemas/tables/controlPlane/accessControl.js.map +1 -0
- package/dist/schemas/tables/{identity → controlPlane}/agent.d.ts +1 -1
- package/dist/schemas/tables/{identity → controlPlane}/agent.js +3 -3
- package/dist/schemas/tables/controlPlane/agent.js.map +1 -0
- package/dist/schemas/tables/{identity → controlPlane}/epistemic.d.ts +1 -1
- package/dist/schemas/tables/{identity → controlPlane}/epistemic.js +3 -3
- package/dist/schemas/tables/controlPlane/epistemic.js.map +1 -0
- package/dist/schemas/tables/{identity → controlPlane}/model.d.ts +1 -1
- package/dist/schemas/tables/{identity → controlPlane}/model.js +6 -6
- package/dist/schemas/tables/controlPlane/model.js.map +1 -0
- package/dist/schemas/tables/{identity → controlPlane}/platform.d.ts +11 -11
- package/dist/schemas/tables/{identity → controlPlane}/platform.js +18 -18
- package/dist/schemas/tables/controlPlane/platform.js.map +1 -0
- package/dist/schemas/tables/{identity → controlPlane}/project.d.ts +1 -1
- package/dist/schemas/tables/{identity → controlPlane}/project.js +3 -3
- package/dist/schemas/tables/controlPlane/project.js.map +1 -0
- package/dist/schemas/tables/{identity → controlPlane}/user.d.ts +1 -1
- package/dist/schemas/tables/{identity → controlPlane}/user.js +3 -3
- package/dist/schemas/tables/controlPlane/user.js.map +1 -0
- package/dist/schemas/tables/kernel/config.d.ts +1 -1
- package/dist/schemas/tables/kernel/config.js.map +1 -1
- package/dist/schemas/tables/kernel/coordination.d.ts +1 -1
- package/dist/schemas/tables/kernel/coordination.js.map +1 -1
- package/dist/schemas/tables/kernel/decision.d.ts +1 -1
- package/dist/schemas/tables/kernel/decision.js.map +1 -1
- package/dist/schemas/tables/kernel/embedding.d.ts +1 -1
- package/dist/schemas/tables/kernel/embedding.js.map +1 -1
- package/dist/schemas/tables/kernel/epistemic.d.ts +7 -7
- package/dist/schemas/tables/kernel/epistemic.js.map +1 -1
- package/dist/schemas/tables/kernel/idempotency.d.ts +1 -1
- package/dist/schemas/tables/kernel/idempotency.js.map +1 -1
- package/dist/schemas/tables/kernel/infra.d.ts +5 -5
- package/dist/schemas/tables/kernel/infra.js.map +1 -1
- package/dist/schemas/tables/kernel/intelligence.d.ts +11 -11
- package/dist/schemas/tables/kernel/intelligence.js.map +1 -1
- package/dist/schemas/tables/kernel/lens.d.ts +5 -5
- package/dist/schemas/tables/kernel/lens.js.map +1 -1
- package/dist/schemas/tables/kernel/ontology.d.ts +1 -1
- package/dist/schemas/tables/kernel/ontology.js.map +1 -1
- package/dist/schemas/tables/kernel/platform.d.ts +13 -13
- package/dist/schemas/tables/kernel/platform.js.map +1 -1
- package/dist/schemas/tables/kernel/spine.d.ts +5 -4
- package/dist/schemas/tables/kernel/spine.js +6 -2
- package/dist/schemas/tables/kernel/spine.js.map +1 -1
- package/dist/schemas/tables/kernel/task.d.ts +43 -43
- package/dist/schemas/tables/kernel/task.js.map +1 -1
- package/dist/schemas/tables/kernel/topic.d.ts +1 -1
- package/dist/schemas/tables/kernel/topic.js +5 -1
- package/dist/schemas/tables/kernel/topic.js.map +1 -1
- package/dist/schemas/tables/kernel/workflow.d.ts +1 -1
- package/dist/schemas/tables/kernel/workflow.js.map +1 -1
- package/dist/schemas/tables/kernel/worktree.d.ts +55 -55
- package/dist/schemas/tables/kernel/worktree.js.map +1 -1
- package/dist/schemas/tables/mc/identity.d.ts +44 -4
- package/dist/schemas/tables/mc/identity.js +66 -1
- package/dist/schemas/tables/mc/identity.js.map +1 -1
- package/dist/schemas/tables/mc/methodology.d.ts +1 -1
- package/dist/schemas/tables/mc/methodology.js.map +1 -1
- package/dist/schemas/tables/mc/pack.d.ts +21 -21
- package/dist/schemas/tables/mc/pack.js.map +1 -1
- package/dist/schemas/tables/mc/policy.d.ts +2 -2
- package/dist/schemas/tables/mc/policy.js +1 -1
- package/dist/schemas/tables/mc/policy.js.map +1 -1
- package/dist/schemas/tables/mc/registry.d.ts +5 -5
- package/dist/schemas/tables/mc/registry.js.map +1 -1
- package/dist/schemas/tables/mc/runtime.d.ts +109 -3
- package/dist/schemas/tables/mc/runtime.js +330 -104
- package/dist/schemas/tables/mc/runtime.js.map +1 -1
- package/dist/schemas/tables/mc/tenant.d.ts +3 -2
- package/dist/schemas/tables/mc/tenant.js +2 -1
- package/dist/schemas/tables/mc/tenant.js.map +1 -1
- package/dist/schemas/tables/mc/workspace.d.ts +28 -5
- package/dist/schemas/tables/mc/workspace.js +36 -2
- package/dist/schemas/tables/mc/workspace.js.map +1 -1
- package/dist/sdk-methods.contract.d.ts +2 -2
- package/dist/{sdk-tools.contract-S4ia0TTo.d.ts → sdk-tools.contract-BNklQDfB.d.ts} +2 -2
- package/dist/sdk-tools.contract.d.ts +2 -2
- package/dist/sdk-tools.contract.js +672 -24
- package/dist/sdk-tools.contract.js.map +1 -1
- package/dist/tenant-bootstrap-seed.contract.d.ts +1269 -0
- package/dist/tenant-bootstrap-seed.contract.js +751 -0
- package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
- package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
- package/dist/tenant-bootstrap-seed.defaults.js +303 -0
- package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
- package/dist/tenant-client.contract.d.ts +349 -0
- package/dist/tenant-client.contract.js +488 -0
- package/dist/tenant-client.contract.js.map +1 -0
- package/dist/{tool-contracts-C92-9ueT.d.ts → tool-contracts-BevD9Ho2.d.ts} +36 -2
- package/dist/tool-contracts.d.ts +1 -1
- package/dist/tool-contracts.js +673 -25
- package/dist/tool-contracts.js.map +1 -1
- package/package.json +30 -1
- package/dist/index-CV-0_VWJ.d.ts +0 -25
- package/dist/schemas/tables/identity/agent.js.map +0 -1
- package/dist/schemas/tables/identity/epistemic.js.map +0 -1
- package/dist/schemas/tables/identity/model.js.map +0 -1
- package/dist/schemas/tables/identity/platform.js.map +0 -1
- package/dist/schemas/tables/identity/project.js.map +0 -1
- package/dist/schemas/tables/identity/user.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lens-filter.contract.ts","../src/lens-workflow.contract.ts"],"names":[],"mappings":";AA4EO,SAAS,qBACd,KAAA,EAC6B;AAC7B,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,UAAU,OAAO,KAAA;AAChD,EAAA,MAAM,GAAA,GAAM,KAAA;AACZ,EAAA,OAAO,OAAO,GAAA,CAAI,OAAA,KAAY,QAAA,IAAY,OAAO,IAAI,IAAA,KAAS,QAAA;AAChE;AAEO,SAAS,2BACd,KAAA,EACmC;AACnC,EAAA,IAAI,CAAC,oBAAA,CAAqB,KAAK,CAAA,EAAG,OAAO,KAAA;AACzC,EAAA,OAAO,KAAA,CAAM,OAAA,KAAY,CAAA,IAAK,KAAA,CAAM,IAAA,KAAS,UAAA;AAC/C;AAcO,SAAS,uBACd,KAAA,EACwB;AACxB,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM;AACzC,IAAA,OAAO,EAAE,OAAO,IAAA,EAAK;AAAA,EACvB;AAEA,EAAA,IAAI,CAAC,oBAAA,CAAqB,KAAK,CAAA,EAAG;AAChC,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,KAAA;AAAA,MACP,MAAA,EAAQ;AAAA,QACN;AAAA;AACF,KACF;AAAA,EACF;AAEA,EAAA,IAAI,0BAAA,CAA2B,KAAK,CAAA,EAAG;AACrC,IAAA,OAAO,yBAAyB,KAAK,CAAA;AAAA,EACvC;AAIA,EAAA,MAAM,GAAA,GAAM,KAAA;AACZ,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,KAAA;AAAA,IACP,MAAA,EA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AAA;AAAA,IACjB,eAAA;AAAA,IACA,OAAA,EACE,qHAAA;AAAA,IACF,gBAAA,EAAkB;AAAA,MAChB,MAAM,IAAA,CAAK,IAAA;AAAA,MACX,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB;AAAA;AACF,GACF;AACF;AAEO,SAAS,8BAA8B,IAAA,EAMjB;AAC3B,EAAA,OAAO;AAAA,IACL,UAAA,EAAY,IAAA;AAAA,IACZ,kBAAA,EAAoB,0BAAA;AAAA,IACpB,cAAA,EAAgB,oBAAoB,IAAI;AAAA,GAC1C;AACF","file":"lens-workflow.contract.js","sourcesContent":["/**\n * Lens Filter Criteria Contract\n *\n * Version-discriminated filter DSL for lenses. Each filter criteria document\n * carries a `version` and `kind` discriminator so future shapes can coexist\n * without schema migrations. The Convex `filterCriteria` field remains v.any()\n * — all type enforcement happens here at the TypeScript contract layer.\n *\n * Forward-compatibility guarantees:\n * - `version` field: new versions add fields, never remove or rename existing ones\n * - `kind` field: new filter kinds (temporal, confidence-range) can be added\n * without touching taxonomy code paths\n * - `entityTypeFilters` array items are open to extension in future versions\n * - Resolution logic switches on `version` + `kind` to select the right resolver\n *\n * @module lucern/contracts/src/lens-filter\n */\n\n// ---------------------------------------------------------------------------\n// V1: Taxonomy Filter — entity type + subtype matching\n// ---------------------------------------------------------------------------\n\n/**\n * A single entity type filter entry. Matches nodes whose `nodeType` equals\n * `entityTypeValue`, optionally further narrowed by subtype membership.\n *\n * V2 will add `propertyMatchers` here for arbitrary JSON Schema facet queries.\n */\nexport type EntityTypeFilterV1 = {\n /** References ontologyVersion.entityTypes[].value, e.g. \"company\" */\n entityTypeValue: string;\n\n /** Optional subtype narrowing. If omitted or empty, all subtypes match. */\n subtypeValues?: string[];\n};\n\n/**\n * Optional scope to restrict which ontology the filter resolves against.\n * If omitted, resolution uses whatever ontology is active in the workspace.\n */\nexport type OntologyScope = {\n /** Restrict to a specific ontology by key, e.g. \"vc-investment\" */\n ontologyKey?: string;\n};\n\n/**\n * Taxonomy filter criteria v1: entity type + subtype matching over ontology.\n */\nexport type TaxonomyFilterCriteriaV1 = {\n version: 1;\n kind: \"taxonomy\";\n entityTypeFilters: EntityTypeFilterV1[];\n ontologyScope?: OntologyScope;\n};\n\n// ---------------------------------------------------------------------------\n// Union: All filter criteria versions and kinds\n// ---------------------------------------------------------------------------\n\n/**\n * Discriminated union of all supported filter criteria.\n * Resolution logic switches on `version` + `kind`.\n *\n * To add a new filter kind:\n * 1. Define a new type (e.g., TemporalFilterCriteriaV1)\n * 2. Add it to this union\n * 3. Add a resolver in taxonomy-filter.ts\n * 4. No schema migration needed — filterCriteria is v.any()\n */\nexport type LensFilterCriteria = TaxonomyFilterCriteriaV1;\n// Future: | TemporalFilterCriteriaV1 | ConfidenceRangeFilterCriteriaV1 | ...\n\n// ---------------------------------------------------------------------------\n// Type guards\n// ---------------------------------------------------------------------------\n\nexport function isLensFilterCriteria(\n value: unknown\n): value is LensFilterCriteria {\n if (!value || typeof value !== \"object\") return false;\n const obj = value as Record<string, unknown>;\n return typeof obj.version === \"number\" && typeof obj.kind === \"string\";\n}\n\nexport function isTaxonomyFilterCriteriaV1(\n value: unknown\n): value is TaxonomyFilterCriteriaV1 {\n if (!isLensFilterCriteria(value)) return false;\n return value.version === 1 && value.kind === \"taxonomy\";\n}\n\n// ---------------------------------------------------------------------------\n// Validation\n// ---------------------------------------------------------------------------\n\nexport type FilterValidationResult =\n | { valid: true }\n | { valid: false; errors: string[] };\n\n/**\n * Validate a filter criteria document at the contract layer.\n * This runs before persisting to Convex.\n */\nexport function validateFilterCriteria(\n value: unknown\n): FilterValidationResult {\n if (value === undefined || value === null) {\n return { valid: true }; // filterCriteria is optional\n }\n\n if (!isLensFilterCriteria(value)) {\n return {\n valid: false,\n errors: [\n 'filterCriteria must have numeric \"version\" and string \"kind\" fields',\n ],\n };\n }\n\n if (isTaxonomyFilterCriteriaV1(value)) {\n return validateTaxonomyFilterV1(value);\n }\n\n // Cast to access properties — TypeScript narrows to `never` when all union\n // members are exhausted, but at runtime unknown version/kind combos are possible.\n const raw = value as { version: number; kind: string };\n return {\n valid: false,\n errors: [\n `Unsupported filter criteria: version=${raw.version}, kind=${raw.kind}`,\n ],\n };\n}\n\nfunction validateTaxonomyFilterV1(\n criteria: TaxonomyFilterCriteriaV1\n): FilterValidationResult {\n const errors: string[] = [];\n\n if (!Array.isArray(criteria.entityTypeFilters)) {\n errors.push(\"entityTypeFilters must be an array\");\n return { valid: false, errors };\n }\n\n if (criteria.entityTypeFilters.length === 0) {\n errors.push(\"entityTypeFilters must contain at least one entry\");\n return { valid: false, errors };\n }\n\n for (let i = 0; i < criteria.entityTypeFilters.length; i++) {\n const filter = criteria.entityTypeFilters[i];\n if (!filter || typeof filter.entityTypeValue !== \"string\") {\n errors.push(\n `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`\n );\n continue;\n }\n if (filter.entityTypeValue.trim().length === 0) {\n errors.push(\n `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`\n );\n }\n if (\n filter.subtypeValues !== undefined &&\n !Array.isArray(filter.subtypeValues)\n ) {\n errors.push(`entityTypeFilters[${i}].subtypeValues must be an array`);\n }\n }\n\n if (criteria.ontologyScope !== undefined) {\n if (\n typeof criteria.ontologyScope !== \"object\" ||\n criteria.ontologyScope === null\n ) {\n errors.push(\"ontologyScope must be an object\");\n }\n }\n\n return errors.length === 0\n ? { valid: true }\n : { valid: false, errors };\n}\n","/**\n * Canonical lens workflow contract shared across schema, SDK, and MCP surfaces.\n */\n\n// Re-export filter criteria types for consumers who import from lens-workflow\nexport type {\n LensFilterCriteria,\n TaxonomyFilterCriteriaV1,\n EntityTypeFilterV1,\n OntologyScope,\n FilterValidationResult,\n} from \"./lens-filter.contract\";\nexport {\n validateFilterCriteria,\n isLensFilterCriteria,\n isTaxonomyFilterCriteriaV1,\n} from \"./lens-filter.contract\";\n\nexport const LENS_PERSPECTIVE_TYPES = [\n \"investigation\",\n \"monitoring\",\n \"analysis\",\n \"comparison\",\n \"taxonomy\",\n] as const;\n\nexport type LensPerspectiveType = (typeof LENS_PERSPECTIVE_TYPES)[number];\n\nexport const LENS_STATUSES = [\"draft\", \"active\", \"archived\"] as const;\n\nexport type LensStatus = (typeof LENS_STATUSES)[number];\n\nexport const LENS_TASK_TEMPLATE_PRIORITIES = [\n \"critical\",\n \"high\",\n \"medium\",\n \"low\",\n] as const;\n\nexport type LensTaskTemplatePriority =\n (typeof LENS_TASK_TEMPLATE_PRIORITIES)[number];\n\nexport type LensLooseMetadata = Record<string, unknown>;\n\nexport type LensPromptTemplateReference = {\n key: string;\n promptRef: string;\n phase?: string;\n role?: string;\n version?: string;\n required?: boolean;\n metadata?: LensLooseMetadata;\n};\n\nexport type LensWorkflowStepTemplate = {\n key: string;\n title: string;\n description?: string;\n promptTemplateKey?: string;\n taskTemplateKeys?: string[];\n metadata?: LensLooseMetadata;\n};\n\nexport type LensWorkflowTemplate = {\n key: string;\n name: string;\n description?: string;\n steps: LensWorkflowStepTemplate[];\n metadata?: LensLooseMetadata;\n};\n\nexport type LensTaskTemplate = {\n key: string;\n title: string;\n description?: string;\n priority?: LensTaskTemplatePriority;\n phase?: string;\n metadata?: LensLooseMetadata;\n};\n\nexport type LensQuestionTemplate = {\n key: string;\n text: string;\n priority?: LensTaskTemplatePriority;\n linkedBeliefKey?: string;\n metadata?: LensLooseMetadata;\n};\n\nexport type LensBranchMigrationSuggestion = {\n recommendedTool: \"create_lens\";\n perspectiveType: LensPerspectiveType;\n message: string;\n suggestedPayload: {\n name: string;\n description?: string;\n topicId?: string;\n workspaceId?: string;\n perspectiveType: LensPerspectiveType;\n };\n};\n\nexport const BRANCH_DEPRECATION_MESSAGE =\n \"Branches are deprecated for operational framing. Create a workspace-scoped lens instead.\";\n\nexport type DeprecatedBranchMetadata = {\n deprecated: true;\n deprecationMessage: string;\n lensSuggestion: LensBranchMigrationSuggestion;\n};\n\nexport function inferLensPerspectiveTypeFromBranchSchema(\n schema?: string | null\n): LensPerspectiveType {\n const normalized = schema?.trim().toLowerCase();\n if (normalized === \"phase\") {\n return \"monitoring\";\n }\n if (normalized === \"axis\" || normalized === \"dimension\") {\n return \"comparison\";\n }\n if (normalized === \"track\") {\n return \"investigation\";\n }\n return \"analysis\";\n}\n\nexport function migrateBranchToLens(args: {\n name: string;\n description?: string;\n topicId?: string;\n workspaceId?: string;\n schema?: string | null;\n}): LensBranchMigrationSuggestion {\n const perspectiveType = inferLensPerspectiveTypeFromBranchSchema(args.schema);\n return {\n recommendedTool: \"create_lens\",\n perspectiveType,\n message:\n \"Branches are deprecated for operational framing. Create a workspace-scoped lens with the suggested payload instead.\",\n suggestedPayload: {\n name: args.name,\n description: args.description,\n topicId: args.topicId,\n workspaceId: args.workspaceId,\n perspectiveType,\n },\n };\n}\n\nexport function buildDeprecatedBranchMetadata(args: {\n name: string;\n description?: string;\n topicId?: string;\n workspaceId?: string;\n schema?: string | null;\n}): DeprecatedBranchMetadata {\n return {\n deprecated: true,\n deprecationMessage: BRANCH_DEPRECATION_MESSAGE,\n lensSuggestion: migrateBranchToLens(args),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/lens-filter.contract.ts","../src/lens-workflow.contract.ts"],"names":[],"mappings":";AA4EO,SAAS,qBACd,KAAA,EAC6B;AAC7B,EAAA,OAAO,QAAA,CAAS,KAAK,CAAA,IAAK,OAAO,MAAM,OAAA,KAAY,QAAA,IAAY,OAAO,KAAA,CAAM,IAAA,KAAS,QAAA;AACvF;AAEO,SAAS,2BACd,KAAA,EACmC;AACnC,EAAA,IAAI,CAAC,oBAAA,CAAqB,KAAK,CAAA,EAAG,OAAO,KAAA;AACzC,EAAA,OAAO,KAAA,CAAM,OAAA,KAAY,CAAA,IAAK,KAAA,CAAM,IAAA,KAAS,UAAA;AAC/C;AAcO,SAAS,uBACd,KAAA,EACwB;AACxB,EAAA,IAAI,KAAA,KAAU,MAAA,I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A,MAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF;AAgEO,IAAM,0BAAA,GACX;AAQK,SAAS,yCACd,MAAA,EACqB;AACrB,EAAA,MAAM,UAAA,GAAa,MAAA,EAAQ,IAAA,EAAK,CAAE,WAAA,EAAY;AAC9C,EAAA,IAAI,eAAe,OAAA,EAAS;AAC1B,IAAA,OAAO,YAAA;AAAA,EACT;AACA,EAAA,IAAI,UAAA,KAAe,MAAA,IAAU,UAAA,KAAe,WAAA,EAAa;AACvD,IAAA,OAAO,YAAA;AAAA,EACT;AACA,EAAA,IAAI,eAAe,OAAA,EAAS;AAC1B,IAAA,OAAO,eAAA;AAAA,EACT;AACA,EAAA,OAAO,UAAA;AACT;AAEO,SAAS,oBAAoB,IAAA,EAMF;AAChC,EAAA,MAAM,eAAA,GAAkB,wCAAA,CAAyC,IAAA,CAAK,MAAM,CAAA;AAC5E,EAAA,OAAO;AAAA,IACL,eAAA,EAAiB,aAAA;AAAA,IACjB,eAAA;AAAA,IACA,OAAA,EACE,qHAAA;AAAA,IACF,gBAAA,EAAkB;AAAA,MAChB,MAAM,IAAA,CAAK,IAAA;AAAA,MACX,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB;AAAA;AACF,GACF;AACF;AAEO,SAAS,8BAA8B,IAAA,EAMjB;AAC3B,EAAA,OAAO;AAAA,IACL,UAAA,EAAY,IAAA;AAAA,IACZ,kBAAA,EAAoB,0BAAA;AAAA,IACpB,cAAA,EAAgB,oBAAoB,IAAI;AAAA,GAC1C;AACF","file":"lens-workflow.contract.js","sourcesContent":["/**\n * Lens Filter Criteria Contract\n *\n * Version-discriminated filter DSL for lenses. Each filter criteria document\n * carries a `version` and `kind` discriminator so future shapes can coexist\n * without schema migrations. The Convex `filterCriteria` field remains v.any()\n * — all type enforcement happens here at the TypeScript contract layer.\n *\n * Forward-compatibility guarantees:\n * - `version` field: new versions add fields, never remove or rename existing ones\n * - `kind` field: new filter kinds (temporal, confidence-range) can be added\n * without touching taxonomy code paths\n * - `entityTypeFilters` array items are open to extension in future versions\n * - Resolution logic switches on `version` + `kind` to select the right resolver\n *\n * @module lucern/contracts/src/lens-filter\n */\n\n// ---------------------------------------------------------------------------\n// V1: Taxonomy Filter — entity type + subtype matching\n// ---------------------------------------------------------------------------\n\n/**\n * A single entity type filter entry. Matches nodes whose `nodeType` equals\n * `entityTypeValue`, optionally further narrowed by subtype membership.\n *\n * V2 will add `propertyMatchers` here for arbitrary JSON Schema facet queries.\n */\nexport type EntityTypeFilterV1 = {\n /** References ontologyVersion.entityTypes[].value, e.g. \"company\" */\n entityTypeValue: string;\n\n /** Optional subtype narrowing. If omitted or empty, all subtypes match. */\n subtypeValues?: string[];\n};\n\n/**\n * Optional scope to restrict which ontology the filter resolves against.\n * If omitted, resolution uses whatever ontology is active in the workspace.\n */\nexport type OntologyScope = {\n /** Restrict to a specific ontology by key, e.g. \"vc-investment\" */\n ontologyKey?: string;\n};\n\n/**\n * Taxonomy filter criteria v1: entity type + subtype matching over ontology.\n */\nexport type TaxonomyFilterCriteriaV1 = {\n version: 1;\n kind: \"taxonomy\";\n entityTypeFilters: EntityTypeFilterV1[];\n ontologyScope?: OntologyScope;\n};\n\n// ---------------------------------------------------------------------------\n// Union: All filter criteria versions and kinds\n// ---------------------------------------------------------------------------\n\n/**\n * Discriminated union of all supported filter criteria.\n * Resolution logic switches on `version` + `kind`.\n *\n * To add a new filter kind:\n * 1. Define a new type (e.g., TemporalFilterCriteriaV1)\n * 2. Add it to this union\n * 3. Add a resolver in taxonomy-filter.ts\n * 4. No schema migration needed — filterCriteria is v.any()\n */\nexport type LensFilterCriteria = TaxonomyFilterCriteriaV1;\n// Future: | TemporalFilterCriteriaV1 | ConfidenceRangeFilterCriteriaV1 | ...\n\n// ---------------------------------------------------------------------------\n// Type guards\n// ---------------------------------------------------------------------------\n\nexport function isLensFilterCriteria(\n value: unknown\n): value is LensFilterCriteria {\n return isRecord(value) && typeof value.version === \"number\" && typeof value.kind === \"string\";\n}\n\nexport function isTaxonomyFilterCriteriaV1(\n value: unknown\n): value is TaxonomyFilterCriteriaV1 {\n if (!isLensFilterCriteria(value)) return false;\n return value.version === 1 && value.kind === \"taxonomy\";\n}\n\n// ---------------------------------------------------------------------------\n// Validation\n// ---------------------------------------------------------------------------\n\nexport type FilterValidationResult =\n | { valid: true }\n | { valid: false; errors: string[] };\n\n/**\n * Validate a filter criteria document at the contract layer.\n * This runs before persisting to Convex.\n */\nexport function validateFilterCriteria(\n value: unknown\n): FilterValidationResult {\n if (value === undefined || value === null) {\n return { valid: true }; // filterCriteria is optional\n }\n\n if (!isLensFilterCriteria(value)) {\n return {\n valid: false,\n errors: [\n 'filterCriteria must have numeric \"version\" and string \"kind\" fields',\n ],\n };\n }\n\n if (isTaxonomyFilterCriteriaV1(value)) {\n return validateTaxonomyFilterV1(value);\n }\n\n // Cast to access properties — TypeScript narrows to `never` when all union\n // members are exhausted, but at runtime unknown version/kind combos are possible.\n const raw = value as { version: number; kind: string };\n return {\n valid: false,\n errors: [\n `Unsupported filter criteria: version=${raw.version}, kind=${raw.kind}`,\n ],\n };\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction validateTaxonomyFilterV1(\n criteria: TaxonomyFilterCriteriaV1\n): FilterValidationResult {\n const errors: string[] = [];\n\n if (!Array.isArray(criteria.entityTypeFilters)) {\n errors.push(\"entityTypeFilters must be an array\");\n return { valid: false, errors };\n }\n\n if (criteria.entityTypeFilters.length === 0) {\n errors.push(\"entityTypeFilters must contain at least one entry\");\n return { valid: false, errors };\n }\n\n for (let i = 0; i < criteria.entityTypeFilters.length; i++) {\n const filter = criteria.entityTypeFilters[i];\n if (!filter || typeof filter.entityTypeValue !== \"string\") {\n errors.push(\n `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`\n );\n continue;\n }\n if (filter.entityTypeValue.trim().length === 0) {\n errors.push(\n `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`\n );\n }\n if (\n filter.subtypeValues !== undefined &&\n !Array.isArray(filter.subtypeValues)\n ) {\n errors.push(`entityTypeFilters[${i}].subtypeValues must be an array`);\n }\n }\n\n if (criteria.ontologyScope !== undefined) {\n if (\n typeof criteria.ontologyScope !== \"object\" ||\n criteria.ontologyScope === null\n ) {\n errors.push(\"ontologyScope must be an object\");\n }\n }\n\n return errors.length === 0\n ? { valid: true }\n : { valid: false, errors };\n}\n","/**\n * Canonical lens workflow contract shared across schema, SDK, and MCP surfaces.\n */\n\n// Re-export filter criteria types for consumers who import from lens-workflow\nexport type {\n LensFilterCriteria,\n TaxonomyFilterCriteriaV1,\n EntityTypeFilterV1,\n OntologyScope,\n FilterValidationResult,\n} from \"./lens-filter.contract\";\nexport {\n validateFilterCriteria,\n isLensFilterCriteria,\n isTaxonomyFilterCriteriaV1,\n} from \"./lens-filter.contract\";\n\nexport const LENS_PERSPECTIVE_TYPES = [\n \"investigation\",\n \"monitoring\",\n \"analysis\",\n \"comparison\",\n \"taxonomy\",\n] as const;\n\nexport type LensPerspectiveType = (typeof LENS_PERSPECTIVE_TYPES)[number];\n\nexport const LENS_STATUSES = [\"draft\", \"active\", \"archived\"] as const;\n\nexport type LensStatus = (typeof LENS_STATUSES)[number];\n\nexport const LENS_TASK_TEMPLATE_PRIORITIES = [\n \"critical\",\n \"high\",\n \"medium\",\n \"low\",\n] as const;\n\nexport type LensTaskTemplatePriority =\n (typeof LENS_TASK_TEMPLATE_PRIORITIES)[number];\n\nexport type LensLooseMetadata = Record<string, unknown>;\n\nexport type LensPromptTemplateReference = {\n key: string;\n promptRef: string;\n phase?: string;\n role?: string;\n version?: string;\n required?: boolean;\n metadata?: LensLooseMetadata;\n};\n\nexport type LensWorkflowStepTemplate = {\n key: string;\n title: string;\n description?: string;\n promptTemplateKey?: string;\n taskTemplateKeys?: string[];\n metadata?: LensLooseMetadata;\n};\n\nexport type LensWorkflowTemplate = {\n key: string;\n name: string;\n description?: string;\n steps: LensWorkflowStepTemplate[];\n metadata?: LensLooseMetadata;\n};\n\nexport type LensTaskTemplate = {\n key: string;\n title: string;\n description?: string;\n priority?: LensTaskTemplatePriority;\n phase?: string;\n metadata?: LensLooseMetadata;\n};\n\nexport type LensQuestionTemplate = {\n key: string;\n text: string;\n priority?: LensTaskTemplatePriority;\n linkedBeliefKey?: string;\n metadata?: LensLooseMetadata;\n};\n\nexport type LensBranchMigrationSuggestion = {\n recommendedTool: \"create_lens\";\n perspectiveType: LensPerspectiveType;\n message: string;\n suggestedPayload: {\n name: string;\n description?: string;\n topicId?: string;\n workspaceId?: string;\n perspectiveType: LensPerspectiveType;\n };\n};\n\nexport const BRANCH_DEPRECATION_MESSAGE =\n \"Branches are deprecated for operational framing. Create a workspace-scoped lens instead.\";\n\nexport type DeprecatedBranchMetadata = {\n deprecated: true;\n deprecationMessage: string;\n lensSuggestion: LensBranchMigrationSuggestion;\n};\n\nexport function inferLensPerspectiveTypeFromBranchSchema(\n schema?: string | null\n): LensPerspectiveType {\n const normalized = schema?.trim().toLowerCase();\n if (normalized === \"phase\") {\n return \"monitoring\";\n }\n if (normalized === \"axis\" || normalized === \"dimension\") {\n return \"comparison\";\n }\n if (normalized === \"track\") {\n return \"investigation\";\n }\n return \"analysis\";\n}\n\nexport function migrateBranchToLens(args: {\n name: string;\n description?: string;\n topicId?: string;\n workspaceId?: string;\n schema?: string | null;\n}): LensBranchMigrationSuggestion {\n const perspectiveType = inferLensPerspectiveTypeFromBranchSchema(args.schema);\n return {\n recommendedTool: \"create_lens\",\n perspectiveType,\n message:\n \"Branches are deprecated for operational framing. Create a workspace-scoped lens with the suggested payload instead.\",\n suggestedPayload: {\n name: args.name,\n description: args.description,\n topicId: args.topicId,\n workspaceId: args.workspaceId,\n perspectiveType,\n },\n };\n}\n\nexport function buildDeprecatedBranchMetadata(args: {\n name: string;\n description?: string;\n topicId?: string;\n workspaceId?: string;\n schema?: string | null;\n}): DeprecatedBranchMetadata {\n return {\n deprecated: true,\n deprecationMessage: BRANCH_DEPRECATION_MESSAGE,\n lensSuggestion: migrateBranchToLens(args),\n };\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const edgePolicyManifest: {
|
|
2
|
+
manifestVersion: "1.0.0";
|
|
3
|
+
policies: {
|
|
4
|
+
description: string;
|
|
5
|
+
edgeType: string;
|
|
6
|
+
fromKinds: ("epistemic_node" | "external_belief")[];
|
|
7
|
+
toKinds: ("epistemic_node" | "external_belief")[];
|
|
8
|
+
fromNodeTypes?: ("function" | "belief" | "evidence" | "question" | "edge" | "contradiction" | "topic" | "ontology" | "source" | "lens" | "decision" | "claim" | "answer" | "theme" | "deal" | "synthesis" | "atomic_fact" | "excerpt" | "company" | "person" | "investor" | "value_chain")[] | undefined;
|
|
9
|
+
toNodeTypes?: ("function" | "belief" | "evidence" | "question" | "edge" | "contradiction" | "topic" | "ontology" | "source" | "lens" | "decision" | "claim" | "answer" | "theme" | "deal" | "synthesis" | "atomic_fact" | "excerpt" | "company" | "person" | "investor" | "value_chain")[] | undefined;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { edgePolicyManifest };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/schemas/enums.ts
|
|
4
|
+
z.enum(["decision", "belief", "question", "theme", "deal", "topic", "claim", "evidence", "synthesis", "answer", "atomic_fact", "excerpt", "source", "company", "person", "investor", "function", "value_chain"]);
|
|
5
|
+
var EDGE_TYPE_VALUES = ["supports", "informs", "depends_on", "derived_from", "contains", "tests", "supersedes", "responds_to", "belongs_to", "relates_to_thesis", "works_at", "invested_in", "competes_with", "participates_in", "founded_by", "evaluates", "performs", "function_in", "impacts", "raised_from", "mentioned_in", "perspective_on", "plays_theme", "answers", "explores", "qualifies", "based_on", "based_on_belief", "based_on_question", "blocked_by_contradiction", "informed_by_theme", "same_as", "reinforces", "parent_of", "child_of", "falsified_by", "exclusive_with", "collapses_if", "cascade_from", "counterfactual_of", "cascade_to", "mutually_exclusive", "correlates_with", "amplifies", "precondition_for", "in_tension_with", "strengthened_by", "weakened_by", "alternative_to", "subsumes", "validated_by", "required_for", "blocks", "prerequisite_for", "parallel_to", "corroborates", "extends", "same_source_as", "same_theme_as", "assumes", "would_predict", "analogous_to", "independent_of", "implements", "violates", "co_changes_with", "migrating_from", "migrating_to", "scoped_by", "about_entity", "entity_referenced_in", "contradicts", "cites", "summarizes", "related_to", "partially_answers", "refines", "branches_from"];
|
|
6
|
+
var STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, "extracted_from"];
|
|
7
|
+
z.enum(EDGE_TYPE_VALUES);
|
|
8
|
+
z.enum(STORAGE_EDGE_TYPE_VALUES);
|
|
9
|
+
z.enum(["active", "archived", "watching"]);
|
|
10
|
+
z.enum(["private", "team", "firm", "external", "public"]);
|
|
11
|
+
|
|
12
|
+
// src/manifests/edge-policy-manifest.data.ts
|
|
13
|
+
var publicEpistemicNodeEdgePolicy = (edgeType) => ({
|
|
14
|
+
edgeType,
|
|
15
|
+
fromKinds: ["epistemic_node"],
|
|
16
|
+
toKinds: ["epistemic_node"],
|
|
17
|
+
description: "Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics."
|
|
18
|
+
});
|
|
19
|
+
var edgePolicyManifest = {
|
|
20
|
+
manifestVersion: "1.0.0",
|
|
21
|
+
policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy)
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { edgePolicyManifest };
|
|
25
|
+
//# sourceMappingURL=edge-policy-manifest.data.js.map
|
|
26
|
+
//# sourceMappingURL=edge-policy-manifest.data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/enums.ts","../../src/manifests/edge-policy-manifest.data.ts"],"names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,CAAA;AAErD,CAAA,CAAE,IAAA,CAAK,gBAAgB;AAIf,CAAA,CAAE,IAAA,CAAK,wBAAwB;AAEpC,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,UAAA,EAAY,UAAU,CAAC;AAErC,EAAE,IAAA,CAAK,CAAC,WAAW,MAAA,EAAQ,MAAA,EAAQ,UAAA,EAAY,QAAQ,CAAC;;;ACdxF,IAAM,6BAAA,GAAgC,CACpC,QAAA,MACqB;AAAA,EACrB,QAAA;AAAA,EACA,SAAA,EAAW,CAAC,gBAAgB,CAAA;AAAA,EAC5B,OAAA,EAAS,CAAC,gBAAgB,CAAA;AAAA,EAC1B,WAAA,EACE;AACJ,CAAA,CAAA;AAEO,IAAM,kBAAA,GAAqB;AAAA,EAChC,eAAA,EAAiB,OAAA;AAAA,EACjB,QAAA,EAAU,gBAAA,CAAiB,GAAA,CAAI,6BAA6B;AAC9D","file":"edge-policy-manifest.data.js","sourcesContent":["/**\n * Shared schema enums referenced by the initial table manifest.\n */\n\nimport { z } from 'zod';\n\nexport const NODE_TYPE = z.enum([\"decision\", \"belief\", \"question\", \"theme\", \"deal\", \"topic\", \"claim\", \"evidence\", \"synthesis\", \"answer\", \"atomic_fact\", \"excerpt\", \"source\", \"company\", \"person\", \"investor\", \"function\", \"value_chain\"]);\n\nexport const EDGE_TYPE_VALUES = [\"supports\", \"informs\", \"depends_on\", \"derived_from\", \"contains\", \"tests\", \"supersedes\", \"responds_to\", \"belongs_to\", \"relates_to_thesis\", \"works_at\", \"invested_in\", \"competes_with\", \"participates_in\", \"founded_by\", \"evaluates\", \"performs\", \"function_in\", \"impacts\", \"raised_from\", \"mentioned_in\", \"perspective_on\", \"plays_theme\", \"answers\", \"explores\", \"qualifies\", \"based_on\", \"based_on_belief\", \"based_on_question\", \"blocked_by_contradiction\", \"informed_by_theme\", \"same_as\", \"reinforces\", \"parent_of\", \"child_of\", \"falsified_by\", \"exclusive_with\", \"collapses_if\", \"cascade_from\", \"counterfactual_of\", \"cascade_to\", \"mutually_exclusive\", \"correlates_with\", \"amplifies\", \"precondition_for\", \"in_tension_with\", \"strengthened_by\", \"weakened_by\", \"alternative_to\", \"subsumes\", \"validated_by\", \"required_for\", \"blocks\", \"prerequisite_for\", \"parallel_to\", \"corroborates\", \"extends\", \"same_source_as\", \"same_theme_as\", \"assumes\", \"would_predict\", \"analogous_to\", \"independent_of\", \"implements\", \"violates\", \"co_changes_with\", \"migrating_from\", \"migrating_to\", \"scoped_by\", \"about_entity\", \"entity_referenced_in\", \"contradicts\", \"cites\", \"summarizes\", \"related_to\", \"partially_answers\", \"refines\", \"branches_from\"] as const;\n\nexport const STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, \"extracted_from\"] as const;\n\nexport const EDGE_TYPE = z.enum(EDGE_TYPE_VALUES);\n\n// Storage accepts the legacy provenance spelling while existing rows migrate.\n// Public surfaces should continue to expose EDGE_TYPE only.\nexport const STORAGE_EDGE_TYPE = z.enum(STORAGE_EDGE_TYPE_VALUES);\n\nexport const TOPIC_STATUS = z.enum([\"active\", \"archived\", \"watching\"]);\n\nexport const TOPIC_VISIBILITY = z.enum([\"private\", \"team\", \"firm\", \"external\", \"public\"]);\n","import { EDGE_TYPE_VALUES } from \"../schemas/enums.js\";\nimport type {\n EdgePolicyEntry,\n EdgePolicyManifest,\n} from \"./edge-policy-manifest.js\";\n\nconst publicEpistemicNodeEdgePolicy = (\n edgeType: (typeof EDGE_TYPE_VALUES)[number]\n): EdgePolicyEntry => ({\n edgeType,\n fromKinds: [\"epistemic_node\"],\n toKinds: [\"epistemic_node\"],\n description:\n \"Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics.\",\n});\n\nexport const edgePolicyManifest = {\n manifestVersion: \"1.0.0\",\n policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy),\n} satisfies EdgePolicyManifest;\n"]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/manifests/edge-policy-manifest.ts
|
|
4
|
+
|
|
5
|
+
// src/schema-helpers/spine/tables/epistemicNodes.ts
|
|
6
|
+
var NODE_TYPES = [
|
|
7
|
+
"decision",
|
|
8
|
+
"belief",
|
|
9
|
+
"question",
|
|
10
|
+
"theme",
|
|
11
|
+
"deal",
|
|
12
|
+
"topic",
|
|
13
|
+
"claim",
|
|
14
|
+
"evidence",
|
|
15
|
+
"synthesis",
|
|
16
|
+
"answer",
|
|
17
|
+
"atomic_fact",
|
|
18
|
+
"excerpt",
|
|
19
|
+
"source",
|
|
20
|
+
"company",
|
|
21
|
+
"person",
|
|
22
|
+
"investor",
|
|
23
|
+
"function",
|
|
24
|
+
"value_chain"
|
|
25
|
+
];
|
|
26
|
+
new Set(NODE_TYPES);
|
|
27
|
+
|
|
28
|
+
// src/types/graph-ref.ts
|
|
29
|
+
var GRAPH_REF_EXTRA_NODE_TYPES = [
|
|
30
|
+
"edge",
|
|
31
|
+
"ontology",
|
|
32
|
+
"lens",
|
|
33
|
+
"contradiction"
|
|
34
|
+
];
|
|
35
|
+
var GRAPH_REF_NODE_TYPES = [
|
|
36
|
+
...NODE_TYPES,
|
|
37
|
+
...GRAPH_REF_EXTRA_NODE_TYPES
|
|
38
|
+
];
|
|
39
|
+
var EpistemicNodeTypeSchema = z.enum(
|
|
40
|
+
GRAPH_REF_NODE_TYPES
|
|
41
|
+
);
|
|
42
|
+
z.discriminatedUnion("kind", [
|
|
43
|
+
z.object({
|
|
44
|
+
kind: z.literal("epistemic_node"),
|
|
45
|
+
nodeId: z.string(),
|
|
46
|
+
nodeType: EpistemicNodeTypeSchema
|
|
47
|
+
}),
|
|
48
|
+
z.object({
|
|
49
|
+
kind: z.literal("external_belief"),
|
|
50
|
+
ref: z.object({
|
|
51
|
+
tenantId: z.string(),
|
|
52
|
+
beliefId: z.string()
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
// src/manifests/edge-policy-manifest.ts
|
|
58
|
+
var graphRefKind = z.enum(["epistemic_node", "external_belief"]);
|
|
59
|
+
var EdgePolicyEntrySchema = z.object({
|
|
60
|
+
edgeType: z.string(),
|
|
61
|
+
fromKinds: z.array(graphRefKind),
|
|
62
|
+
fromNodeTypes: z.array(EpistemicNodeTypeSchema).optional(),
|
|
63
|
+
toKinds: z.array(graphRefKind),
|
|
64
|
+
toNodeTypes: z.array(EpistemicNodeTypeSchema).optional(),
|
|
65
|
+
description: z.string()
|
|
66
|
+
});
|
|
67
|
+
var EdgePolicyManifestSchema = z.object({
|
|
68
|
+
manifestVersion: z.literal("1.0.0"),
|
|
69
|
+
policies: z.array(EdgePolicyEntrySchema)
|
|
70
|
+
});
|
|
71
|
+
function findEdgePolicy(manifest, edgeType) {
|
|
72
|
+
return manifest.policies.find((policy) => policy.edgeType === edgeType);
|
|
73
|
+
}
|
|
74
|
+
function nodeTypeAllowed(allowed, ref) {
|
|
75
|
+
return ref.kind !== "epistemic_node" || !allowed || allowed.includes(ref.nodeType);
|
|
76
|
+
}
|
|
77
|
+
function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
|
|
78
|
+
const policy = findEdgePolicy(manifest, edgeType);
|
|
79
|
+
const allowed = Boolean(policy) && policy.fromKinds.includes(from.kind) && policy.toKinds.includes(to.kind) && nodeTypeAllowed(policy.fromNodeTypes, from) && nodeTypeAllowed(policy.toNodeTypes, to);
|
|
80
|
+
if (!allowed) {
|
|
81
|
+
const error = new Error(
|
|
82
|
+
`Edge policy violation for ${edgeType}: ${from.kind} -> ${to.kind}`
|
|
83
|
+
);
|
|
84
|
+
error.code = "POLICY_VIOLATION";
|
|
85
|
+
error.details = { code: "POLICY_VIOLATION", edgeType, from, to };
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { EdgePolicyEntrySchema, EdgePolicyManifestSchema, assertEdgePolicyAllowed, findEdgePolicy };
|
|
91
|
+
//# sourceMappingURL=edge-policy-manifest.js.map
|
|
92
|
+
//# sourceMappingURL=edge-policy-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema-helpers/spine/tables/epistemicNodes.ts","../../src/types/graph-ref.ts","../../src/manifests/edge-policy-manifest.ts"],"names":["z"],"mappings":";;;;;AA4BO,IAAM,UAAA,GAAa;AAAA,EACxB,UAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA,aAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA;AAEsB,IAAI,GAAA,CAAY,UAAU;;;AC9ChD,IAAM,0BAAA,GAA6B;AAAA,EACjC,MAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA;AAEO,IAAM,oBAAA,GAAuB;AAAA,EAClC,GAAG,UAAA;AAAA,EACH,GAAG;AACL,CAAA;AAIO,IAAM,0BAA0B,CAAA,CAAE,IAAA;AAAA,EACvC;AACF,CAAA;AAQ8B,CAAA,CAAE,kBAAA,CAAmB,MAAA,EAAQ;AAAA,EACzD,EAAE,MAAA,CAAO;AAAA,IACP,IAAA,EAAM,CAAA,CAAE,OAAA,CAAQ,gBAAgB,CAAA;AAAA,IAChC,MAAA,EAAQ,EAAE,MAAA,EAAO;AAAA,IACjB,QAAA,EAAU;AAAA,GACX,CAAA;AAAA,EACD,EAAE,MAAA,CAAO;AAAA,IACP,IAAA,EAAM,CAAA,CAAE,OAAA,CAAQ,iBAAiB,CAAA;AAAA,IACjC,GAAA,EAAK,EAAE,MAAA,CAAO;AAAA,MACZ,QAAA,EAAU,EAAE,MAAA,EAAO;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MAAM,CAAA,IACd,MAAA,CAAQ,UAAU,QAAA,CAAS,IAAA,CAAK,IAAI,CAAA,IACpC,MAAA,CAAQ,OAAA,CAAQ,SAAS,EAAA,CAAG,IAAI,CAAA,IAChC,eAAA,CAAgB,MAAA,CAAQ,aAAA,EAAe,IAAI,CAAA,IAC3C,eAAA,CAAgB,MAAA,CAAQ,WAAA,EAAa,EAAE,CAAA;AAEzC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,QAAQ,IAAI,KAAA;AAAA,MAChB,6BAA6B,QAAQ,CAAA,EAAA,EAAK,KAAK,IAAI,CAAA,IAAA,EAAO,GAAG,IAAI,CAAA;AAAA,KACnE;AACA,IAAA,KAAA,CAAM,IAAA,GAAO,kBAAA;AACb,IAAA,KAAA,CAAM,UAAU,EAAE,IAAA,EAAM,kBAAA,EAAoB,QAAA,EAAU,MAAM,EAAA,EAAG;AAC/D,IAAA,MAAM,KAAA;AAAA,EACR;AACF","file":"edge-policy-manifest.js","sourcesContent":["export type NodeType =\n | \"decision\"\n | \"belief\"\n | \"question\"\n | \"theme\"\n | \"deal\"\n | \"topic\"\n | \"claim\"\n | \"evidence\"\n | \"synthesis\"\n | \"answer\"\n | \"atomic_fact\"\n | \"excerpt\"\n | \"source\"\n | \"company\"\n | \"person\"\n | \"investor\"\n | \"function\"\n | \"value_chain\";\n\nexport type EpistemicLayer =\n | \"L4\"\n | \"L3\"\n | \"L2\"\n | \"L1\"\n | \"ontological\"\n | \"organizational\";\n\nexport const NODE_TYPES = [\n \"decision\",\n \"belief\",\n \"question\",\n \"theme\",\n \"deal\",\n \"topic\",\n \"claim\",\n \"evidence\",\n \"synthesis\",\n \"answer\",\n \"atomic_fact\",\n \"excerpt\",\n \"source\",\n \"company\",\n \"person\",\n \"investor\",\n \"function\",\n \"value_chain\",\n] as const satisfies readonly NodeType[];\n\nconst NODE_TYPE_SET = new Set<string>(NODE_TYPES);\nconst NODE_TYPE_TO_LAYER = new Map<NodeType, EpistemicLayer>([\n [\"decision\", \"L4\"],\n [\"belief\", \"L3\"],\n [\"question\", \"L3\"],\n [\"theme\", \"L3\"],\n [\"deal\", \"L3\"],\n [\"claim\", \"L2\"],\n [\"evidence\", \"L2\"],\n [\"synthesis\", \"L2\"],\n [\"answer\", \"L2\"],\n [\"atomic_fact\", \"L1\"],\n [\"excerpt\", \"L1\"],\n [\"source\", \"L1\"],\n [\"topic\", \"organizational\"],\n [\"company\", \"ontological\"],\n [\"person\", \"ontological\"],\n [\"investor\", \"ontological\"],\n [\"function\", \"ontological\"],\n [\"value_chain\", \"ontological\"],\n]);\n\n// Backward compatibility type guard: callers depend on the exported predicate.\nexport function isNodeType(value: string): value is NodeType {\n return NODE_TYPE_SET.has(value);\n}\n\nexport function getLayerForNodeType(type: NodeType): EpistemicLayer {\n const layer = NODE_TYPE_TO_LAYER.get(type);\n if (!layer) {\n throw new Error(`Unknown node type: ${type}`);\n }\n return layer;\n}\n\nexport function resolveKnownLayerForNodeType(\n type: string\n): EpistemicLayer | undefined {\n return isNodeType(type) ? NODE_TYPE_TO_LAYER.get(type) : undefined;\n}\n\nexport function isEpistemicNodeType(type: NodeType): boolean {\n return getLayerForNodeType(type) !== \"ontological\";\n}\n","import { z } from \"zod\";\nimport { NODE_TYPES } from \"../schema-helpers/spine/tables/epistemicNodes.js\";\n\nconst GRAPH_REF_EXTRA_NODE_TYPES = [\n \"edge\",\n \"ontology\",\n \"lens\",\n \"contradiction\",\n] as const;\n\nexport const GRAPH_REF_NODE_TYPES = [\n ...NODE_TYPES,\n ...GRAPH_REF_EXTRA_NODE_TYPES,\n] as const;\n\ntype GraphRefNodeType = (typeof GRAPH_REF_NODE_TYPES)[number];\n\nexport const EpistemicNodeTypeSchema = z.enum(\n GRAPH_REF_NODE_TYPES as unknown as [GraphRefNodeType, ...GraphRefNodeType[]]\n);\n\nexport type EpistemicNodeType = z.infer<typeof EpistemicNodeTypeSchema>;\n\nexport type GraphRef =\n | { kind: \"epistemic_node\"; nodeId: string; nodeType: EpistemicNodeType }\n | { kind: \"external_belief\"; ref: { tenantId: string; beliefId: string } };\n\nexport const GraphRefSchema = z.discriminatedUnion(\"kind\", [\n z.object({\n kind: z.literal(\"epistemic_node\"),\n nodeId: z.string(),\n nodeType: EpistemicNodeTypeSchema,\n }),\n z.object({\n kind: z.literal(\"external_belief\"),\n ref: z.object({\n tenantId: z.string(),\n beliefId: z.string(),\n }),\n }),\n]);\n","import { z } from \"zod\";\nimport {\n EpistemicNodeTypeSchema,\n type EpistemicNodeType,\n type GraphRef,\n} from \"../types/graph-ref.js\";\n\nconst graphRefKind = z.enum([\"epistemic_node\", \"external_belief\"]);\n\nexport const EdgePolicyEntrySchema = z.object({\n edgeType: z.string(),\n fromKinds: z.array(graphRefKind),\n fromNodeTypes: z.array(EpistemicNodeTypeSchema).optional(),\n toKinds: z.array(graphRefKind),\n toNodeTypes: z.array(EpistemicNodeTypeSchema).optional(),\n description: z.string(),\n});\n\nexport const EdgePolicyManifestSchema = z.object({\n manifestVersion: z.literal(\"1.0.0\"),\n policies: z.array(EdgePolicyEntrySchema),\n});\n\nexport type EdgePolicyEntry = z.infer<typeof EdgePolicyEntrySchema>;\nexport type EdgePolicyManifest = z.infer<typeof EdgePolicyManifestSchema>;\n\nexport type EdgePolicyViolation = {\n code: \"POLICY_VIOLATION\";\n edgeType: string;\n from: GraphRef;\n to: GraphRef;\n};\n\nexport function findEdgePolicy(\n manifest: EdgePolicyManifest,\n edgeType: string\n): EdgePolicyEntry | undefined {\n return manifest.policies.find((policy) => policy.edgeType === edgeType);\n}\n\nfunction nodeTypeAllowed(\n allowed: EpistemicNodeType[] | undefined,\n ref: GraphRef\n): boolean {\n return (\n ref.kind !== \"epistemic_node\" ||\n !allowed ||\n allowed.includes(ref.nodeType)\n );\n}\n\nexport function assertEdgePolicyAllowed(\n manifest: EdgePolicyManifest,\n edgeType: string,\n from: GraphRef,\n to: GraphRef\n): void {\n const policy = findEdgePolicy(manifest, edgeType);\n const allowed =\n Boolean(policy) &&\n policy!.fromKinds.includes(from.kind) &&\n policy!.toKinds.includes(to.kind) &&\n nodeTypeAllowed(policy!.fromNodeTypes, from) &&\n nodeTypeAllowed(policy!.toNodeTypes, to);\n\n if (!allowed) {\n const error = new Error(\n `Edge policy violation for ${edgeType}: ${from.kind} -> ${to.kind}`\n ) as Error & { code: \"POLICY_VIOLATION\"; details: EdgePolicyViolation };\n error.code = \"POLICY_VIOLATION\";\n error.details = { code: \"POLICY_VIOLATION\", edgeType, from, to };\n throw error;\n }\n}\n"]}
|