@lucern/events 0.3.0-alpha.7 → 0.3.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.js CHANGED
@@ -4714,17 +4714,44 @@ z.object({
4714
4714
  message: "SL invariant b+d+u=1 violated at API boundary"
4715
4715
  }
4716
4716
  );
4717
- var EpistemicNodeTypeSchema = z.enum([
4717
+
4718
+ // ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
4719
+ var NODE_TYPES = [
4720
+ "decision",
4718
4721
  "belief",
4719
- "evidence",
4720
4722
  "question",
4721
- "answer",
4723
+ "theme",
4724
+ "deal",
4722
4725
  "topic",
4726
+ "claim",
4727
+ "evidence",
4728
+ "synthesis",
4729
+ "answer",
4730
+ "atomic_fact",
4731
+ "excerpt",
4732
+ "source",
4733
+ "company",
4734
+ "person",
4735
+ "investor",
4736
+ "function",
4737
+ "value_chain"
4738
+ ];
4739
+ new Set(NODE_TYPES);
4740
+
4741
+ // ../contracts/src/types/graph-ref.ts
4742
+ var GRAPH_REF_EXTRA_NODE_TYPES = [
4723
4743
  "edge",
4724
4744
  "ontology",
4725
4745
  "lens",
4726
4746
  "contradiction"
4727
- ]);
4747
+ ];
4748
+ var GRAPH_REF_NODE_TYPES = [
4749
+ ...NODE_TYPES,
4750
+ ...GRAPH_REF_EXTRA_NODE_TYPES
4751
+ ];
4752
+ var EpistemicNodeTypeSchema = z.enum(
4753
+ GRAPH_REF_NODE_TYPES
4754
+ );
4728
4755
  var GraphRefSchema = z.discriminatedUnion("kind", [
4729
4756
  z.object({
4730
4757
  kind: z.literal("epistemic_node"),
@@ -4772,33 +4799,14 @@ function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
4772
4799
  }
4773
4800
 
4774
4801
  // ../contracts/src/manifests/edge-policy-manifest.data.ts
4802
+ var publicEpistemicNodeEdgePolicy = (edgeType) => ({
4803
+ edgeType,
4804
+ fromKinds: ["epistemic_node"],
4805
+ toKinds: ["epistemic_node"],
4806
+ description: "Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics."
4807
+ });
4775
4808
  var edgePolicyManifest = {
4776
- policies: [
4777
- {
4778
- edgeType: "evidence_derived_from_evidence",
4779
- fromKinds: ["epistemic_node"],
4780
- fromNodeTypes: ["evidence"],
4781
- toKinds: ["epistemic_node"],
4782
- toNodeTypes: ["evidence"],
4783
- description: "Evidence E2 was synthesized from evidence E1 by a transformation. Provides chain-of-evidence lineage."
4784
- },
4785
- {
4786
- edgeType: "evidence_supports_belief",
4787
- fromKinds: ["epistemic_node"],
4788
- fromNodeTypes: ["evidence"],
4789
- toKinds: ["epistemic_node"],
4790
- toNodeTypes: ["belief"],
4791
- description: "Existing link_evidence_to_belief semantics promoted to the create_edge policy source."
4792
- },
4793
- {
4794
- edgeType: "evidence_supports_question",
4795
- fromKinds: ["epistemic_node"],
4796
- fromNodeTypes: ["evidence"],
4797
- toKinds: ["epistemic_node"],
4798
- toNodeTypes: ["question"],
4799
- description: "Existing link_evidence_to_question semantics promoted to the create_edge policy source."
4800
- }
4801
- ]
4809
+ policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy)
4802
4810
  };
4803
4811
 
4804
4812
  // ../contracts/src/tenant-client.contract.ts
@@ -7354,15 +7362,15 @@ var IDENTITY_WHOAMI = {
7354
7362
  };
7355
7363
  var COMPILE_CONTEXT = {
7356
7364
  name: "compile_context",
7357
- description: "Compile a focused reasoning context for a topic. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
7365
+ description: "Compile a focused reasoning context. If topicId is omitted, Lucern resolves the best topic from the query. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
7358
7366
  parameters: {
7359
7367
  topicId: {
7360
7368
  type: "string",
7361
- description: "Topic scope ID to compile"
7369
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
7362
7370
  },
7363
7371
  query: {
7364
7372
  type: "string",
7365
- description: "Optional focus query used to rank context items"
7373
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
7366
7374
  },
7367
7375
  budget: {
7368
7376
  type: "number",
@@ -7386,7 +7394,7 @@ var COMPILE_CONTEXT = {
7386
7394
  description: "Include related ontological entities in the compiled result"
7387
7395
  }
7388
7396
  },
7389
- required: ["topicId"],
7397
+ required: [],
7390
7398
  response: {
7391
7399
  description: "Compiled context pack for the requested topic",
7392
7400
  fields: {
@@ -9885,7 +9893,7 @@ var contextContracts = [
9885
9893
  path: "/context/compile",
9886
9894
  sdkNamespace: "context",
9887
9895
  sdkMethod: "compileContext",
9888
- summary: "Compile a focused reasoning context for a topic.",
9896
+ summary: "Compile a focused reasoning context, resolving topic from query when omitted.",
9889
9897
  convex: {
9890
9898
  module: "contextCompiler",
9891
9899
  functionName: "compile",
@@ -10351,12 +10359,12 @@ var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
10351
10359
  compactRecord4({
10352
10360
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
10353
10361
  toNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
10354
- edgeType: "evidence_supports_belief",
10362
+ edgeType: "informs",
10355
10363
  globalId: input.globalId ?? `edge:${String(
10356
10364
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
10357
10365
  )}:${String(
10358
10366
  input.beliefNodeId ?? input.beliefId ?? input.targetId
10359
- )}:evidence_supports_belief`,
10367
+ )}:informs`,
10360
10368
  weight: typeof input.weight === "number" ? input.weight : input.type === "contradicting" ? -1 : 1,
10361
10369
  context: input.rationale ?? input.context,
10362
10370
  skipLayerValidation: true,
@@ -10369,12 +10377,12 @@ var linkEvidenceToQuestionEdgeInput = (input, context) => withCreatedBy(
10369
10377
  compactRecord4({
10370
10378
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
10371
10379
  toNodeId: input.questionId ?? input.questionNodeId ?? input.targetId,
10372
- edgeType: "evidence_supports_question",
10380
+ edgeType: "responds_to",
10373
10381
  globalId: input.globalId ?? `edge:${String(
10374
10382
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
10375
10383
  )}:${String(
10376
10384
  input.questionId ?? input.questionNodeId ?? input.targetId
10377
- )}:evidence_supports_question`,
10385
+ )}:responds_to`,
10378
10386
  weight: input.impactScore ?? input.weight,
10379
10387
  context: input.rationale ?? input.context,
10380
10388
  skipLayerValidation: true,
@@ -11879,10 +11887,13 @@ var tasksContracts = [
11879
11887
  }
11880
11888
  })
11881
11889
  ];
11890
+ var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
11891
+ (policy) => policy.edgeType
11892
+ );
11882
11893
  var createEdgeArgs = z.object({
11883
11894
  from: GraphRefSchema,
11884
11895
  to: GraphRefSchema,
11885
- edgeType: z.string(),
11896
+ edgeType: z.enum(CREATE_EDGE_TYPES),
11886
11897
  globalId: z.string().optional(),
11887
11898
  weight: z.number().optional(),
11888
11899
  confidence: z.number().optional(),