@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/index.js CHANGED
@@ -4830,17 +4830,44 @@ z.object({
4830
4830
  message: "SL invariant b+d+u=1 violated at API boundary"
4831
4831
  }
4832
4832
  );
4833
- var EpistemicNodeTypeSchema = z.enum([
4833
+
4834
+ // ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
4835
+ var NODE_TYPES = [
4836
+ "decision",
4834
4837
  "belief",
4835
- "evidence",
4836
4838
  "question",
4837
- "answer",
4839
+ "theme",
4840
+ "deal",
4838
4841
  "topic",
4842
+ "claim",
4843
+ "evidence",
4844
+ "synthesis",
4845
+ "answer",
4846
+ "atomic_fact",
4847
+ "excerpt",
4848
+ "source",
4849
+ "company",
4850
+ "person",
4851
+ "investor",
4852
+ "function",
4853
+ "value_chain"
4854
+ ];
4855
+ new Set(NODE_TYPES);
4856
+
4857
+ // ../contracts/src/types/graph-ref.ts
4858
+ var GRAPH_REF_EXTRA_NODE_TYPES = [
4839
4859
  "edge",
4840
4860
  "ontology",
4841
4861
  "lens",
4842
4862
  "contradiction"
4843
- ]);
4863
+ ];
4864
+ var GRAPH_REF_NODE_TYPES = [
4865
+ ...NODE_TYPES,
4866
+ ...GRAPH_REF_EXTRA_NODE_TYPES
4867
+ ];
4868
+ var EpistemicNodeTypeSchema = z.enum(
4869
+ GRAPH_REF_NODE_TYPES
4870
+ );
4844
4871
  var GraphRefSchema = z.discriminatedUnion("kind", [
4845
4872
  z.object({
4846
4873
  kind: z.literal("epistemic_node"),
@@ -4888,33 +4915,14 @@ function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
4888
4915
  }
4889
4916
 
4890
4917
  // ../contracts/src/manifests/edge-policy-manifest.data.ts
4918
+ var publicEpistemicNodeEdgePolicy = (edgeType) => ({
4919
+ edgeType,
4920
+ fromKinds: ["epistemic_node"],
4921
+ toKinds: ["epistemic_node"],
4922
+ description: "Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics."
4923
+ });
4891
4924
  var edgePolicyManifest = {
4892
- policies: [
4893
- {
4894
- edgeType: "evidence_derived_from_evidence",
4895
- fromKinds: ["epistemic_node"],
4896
- fromNodeTypes: ["evidence"],
4897
- toKinds: ["epistemic_node"],
4898
- toNodeTypes: ["evidence"],
4899
- description: "Evidence E2 was synthesized from evidence E1 by a transformation. Provides chain-of-evidence lineage."
4900
- },
4901
- {
4902
- edgeType: "evidence_supports_belief",
4903
- fromKinds: ["epistemic_node"],
4904
- fromNodeTypes: ["evidence"],
4905
- toKinds: ["epistemic_node"],
4906
- toNodeTypes: ["belief"],
4907
- description: "Existing link_evidence_to_belief semantics promoted to the create_edge policy source."
4908
- },
4909
- {
4910
- edgeType: "evidence_supports_question",
4911
- fromKinds: ["epistemic_node"],
4912
- fromNodeTypes: ["evidence"],
4913
- toKinds: ["epistemic_node"],
4914
- toNodeTypes: ["question"],
4915
- description: "Existing link_evidence_to_question semantics promoted to the create_edge policy source."
4916
- }
4917
- ]
4925
+ policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy)
4918
4926
  };
4919
4927
 
4920
4928
  // ../contracts/src/tenant-client.contract.ts
@@ -7470,15 +7478,15 @@ var IDENTITY_WHOAMI = {
7470
7478
  };
7471
7479
  var COMPILE_CONTEXT = {
7472
7480
  name: "compile_context",
7473
- 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.",
7481
+ 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.",
7474
7482
  parameters: {
7475
7483
  topicId: {
7476
7484
  type: "string",
7477
- description: "Topic scope ID to compile"
7485
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
7478
7486
  },
7479
7487
  query: {
7480
7488
  type: "string",
7481
- description: "Optional focus query used to rank context items"
7489
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
7482
7490
  },
7483
7491
  budget: {
7484
7492
  type: "number",
@@ -7502,7 +7510,7 @@ var COMPILE_CONTEXT = {
7502
7510
  description: "Include related ontological entities in the compiled result"
7503
7511
  }
7504
7512
  },
7505
- required: ["topicId"],
7513
+ required: [],
7506
7514
  response: {
7507
7515
  description: "Compiled context pack for the requested topic",
7508
7516
  fields: {
@@ -10001,7 +10009,7 @@ var contextContracts = [
10001
10009
  path: "/context/compile",
10002
10010
  sdkNamespace: "context",
10003
10011
  sdkMethod: "compileContext",
10004
- summary: "Compile a focused reasoning context for a topic.",
10012
+ summary: "Compile a focused reasoning context, resolving topic from query when omitted.",
10005
10013
  convex: {
10006
10014
  module: "contextCompiler",
10007
10015
  functionName: "compile",
@@ -10467,12 +10475,12 @@ var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
10467
10475
  compactRecord4({
10468
10476
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
10469
10477
  toNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
10470
- edgeType: "evidence_supports_belief",
10478
+ edgeType: "informs",
10471
10479
  globalId: input.globalId ?? `edge:${String(
10472
10480
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
10473
10481
  )}:${String(
10474
10482
  input.beliefNodeId ?? input.beliefId ?? input.targetId
10475
- )}:evidence_supports_belief`,
10483
+ )}:informs`,
10476
10484
  weight: typeof input.weight === "number" ? input.weight : input.type === "contradicting" ? -1 : 1,
10477
10485
  context: input.rationale ?? input.context,
10478
10486
  skipLayerValidation: true,
@@ -10485,12 +10493,12 @@ var linkEvidenceToQuestionEdgeInput = (input, context) => withCreatedBy(
10485
10493
  compactRecord4({
10486
10494
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
10487
10495
  toNodeId: input.questionId ?? input.questionNodeId ?? input.targetId,
10488
- edgeType: "evidence_supports_question",
10496
+ edgeType: "responds_to",
10489
10497
  globalId: input.globalId ?? `edge:${String(
10490
10498
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
10491
10499
  )}:${String(
10492
10500
  input.questionId ?? input.questionNodeId ?? input.targetId
10493
- )}:evidence_supports_question`,
10501
+ )}:responds_to`,
10494
10502
  weight: input.impactScore ?? input.weight,
10495
10503
  context: input.rationale ?? input.context,
10496
10504
  skipLayerValidation: true,
@@ -11995,10 +12003,13 @@ var tasksContracts = [
11995
12003
  }
11996
12004
  })
11997
12005
  ];
12006
+ var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
12007
+ (policy) => policy.edgeType
12008
+ );
11998
12009
  var createEdgeArgs = z.object({
11999
12010
  from: GraphRefSchema,
12000
12011
  to: GraphRefSchema,
12001
- edgeType: z.string(),
12012
+ edgeType: z.enum(CREATE_EDGE_TYPES),
12002
12013
  globalId: z.string().optional(),
12003
12014
  weight: z.number().optional(),
12004
12015
  confidence: z.number().optional(),