@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/webhooks.js CHANGED
@@ -4675,17 +4675,44 @@ z.object({
4675
4675
  message: "SL invariant b+d+u=1 violated at API boundary"
4676
4676
  }
4677
4677
  );
4678
- var EpistemicNodeTypeSchema = z.enum([
4678
+
4679
+ // ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
4680
+ var NODE_TYPES = [
4681
+ "decision",
4679
4682
  "belief",
4680
- "evidence",
4681
4683
  "question",
4682
- "answer",
4684
+ "theme",
4685
+ "deal",
4683
4686
  "topic",
4687
+ "claim",
4688
+ "evidence",
4689
+ "synthesis",
4690
+ "answer",
4691
+ "atomic_fact",
4692
+ "excerpt",
4693
+ "source",
4694
+ "company",
4695
+ "person",
4696
+ "investor",
4697
+ "function",
4698
+ "value_chain"
4699
+ ];
4700
+ new Set(NODE_TYPES);
4701
+
4702
+ // ../contracts/src/types/graph-ref.ts
4703
+ var GRAPH_REF_EXTRA_NODE_TYPES = [
4684
4704
  "edge",
4685
4705
  "ontology",
4686
4706
  "lens",
4687
4707
  "contradiction"
4688
- ]);
4708
+ ];
4709
+ var GRAPH_REF_NODE_TYPES = [
4710
+ ...NODE_TYPES,
4711
+ ...GRAPH_REF_EXTRA_NODE_TYPES
4712
+ ];
4713
+ var EpistemicNodeTypeSchema = z.enum(
4714
+ GRAPH_REF_NODE_TYPES
4715
+ );
4689
4716
  var GraphRefSchema = z.discriminatedUnion("kind", [
4690
4717
  z.object({
4691
4718
  kind: z.literal("epistemic_node"),
@@ -4733,33 +4760,14 @@ function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
4733
4760
  }
4734
4761
 
4735
4762
  // ../contracts/src/manifests/edge-policy-manifest.data.ts
4763
+ var publicEpistemicNodeEdgePolicy = (edgeType) => ({
4764
+ edgeType,
4765
+ fromKinds: ["epistemic_node"],
4766
+ toKinds: ["epistemic_node"],
4767
+ description: "Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics."
4768
+ });
4736
4769
  var edgePolicyManifest = {
4737
- policies: [
4738
- {
4739
- edgeType: "evidence_derived_from_evidence",
4740
- fromKinds: ["epistemic_node"],
4741
- fromNodeTypes: ["evidence"],
4742
- toKinds: ["epistemic_node"],
4743
- toNodeTypes: ["evidence"],
4744
- description: "Evidence E2 was synthesized from evidence E1 by a transformation. Provides chain-of-evidence lineage."
4745
- },
4746
- {
4747
- edgeType: "evidence_supports_belief",
4748
- fromKinds: ["epistemic_node"],
4749
- fromNodeTypes: ["evidence"],
4750
- toKinds: ["epistemic_node"],
4751
- toNodeTypes: ["belief"],
4752
- description: "Existing link_evidence_to_belief semantics promoted to the create_edge policy source."
4753
- },
4754
- {
4755
- edgeType: "evidence_supports_question",
4756
- fromKinds: ["epistemic_node"],
4757
- fromNodeTypes: ["evidence"],
4758
- toKinds: ["epistemic_node"],
4759
- toNodeTypes: ["question"],
4760
- description: "Existing link_evidence_to_question semantics promoted to the create_edge policy source."
4761
- }
4762
- ]
4770
+ policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy)
4763
4771
  };
4764
4772
 
4765
4773
  // ../contracts/src/tenant-client.contract.ts
@@ -7315,15 +7323,15 @@ var IDENTITY_WHOAMI = {
7315
7323
  };
7316
7324
  var COMPILE_CONTEXT = {
7317
7325
  name: "compile_context",
7318
- 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.",
7326
+ 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.",
7319
7327
  parameters: {
7320
7328
  topicId: {
7321
7329
  type: "string",
7322
- description: "Topic scope ID to compile"
7330
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
7323
7331
  },
7324
7332
  query: {
7325
7333
  type: "string",
7326
- description: "Optional focus query used to rank context items"
7334
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
7327
7335
  },
7328
7336
  budget: {
7329
7337
  type: "number",
@@ -7347,7 +7355,7 @@ var COMPILE_CONTEXT = {
7347
7355
  description: "Include related ontological entities in the compiled result"
7348
7356
  }
7349
7357
  },
7350
- required: ["topicId"],
7358
+ required: [],
7351
7359
  response: {
7352
7360
  description: "Compiled context pack for the requested topic",
7353
7361
  fields: {
@@ -9846,7 +9854,7 @@ var contextContracts = [
9846
9854
  path: "/context/compile",
9847
9855
  sdkNamespace: "context",
9848
9856
  sdkMethod: "compileContext",
9849
- summary: "Compile a focused reasoning context for a topic.",
9857
+ summary: "Compile a focused reasoning context, resolving topic from query when omitted.",
9850
9858
  convex: {
9851
9859
  module: "contextCompiler",
9852
9860
  functionName: "compile",
@@ -10312,12 +10320,12 @@ var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
10312
10320
  compactRecord4({
10313
10321
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
10314
10322
  toNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
10315
- edgeType: "evidence_supports_belief",
10323
+ edgeType: "informs",
10316
10324
  globalId: input.globalId ?? `edge:${String(
10317
10325
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
10318
10326
  )}:${String(
10319
10327
  input.beliefNodeId ?? input.beliefId ?? input.targetId
10320
- )}:evidence_supports_belief`,
10328
+ )}:informs`,
10321
10329
  weight: typeof input.weight === "number" ? input.weight : input.type === "contradicting" ? -1 : 1,
10322
10330
  context: input.rationale ?? input.context,
10323
10331
  skipLayerValidation: true,
@@ -10330,12 +10338,12 @@ var linkEvidenceToQuestionEdgeInput = (input, context) => withCreatedBy(
10330
10338
  compactRecord4({
10331
10339
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
10332
10340
  toNodeId: input.questionId ?? input.questionNodeId ?? input.targetId,
10333
- edgeType: "evidence_supports_question",
10341
+ edgeType: "responds_to",
10334
10342
  globalId: input.globalId ?? `edge:${String(
10335
10343
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
10336
10344
  )}:${String(
10337
10345
  input.questionId ?? input.questionNodeId ?? input.targetId
10338
- )}:evidence_supports_question`,
10346
+ )}:responds_to`,
10339
10347
  weight: input.impactScore ?? input.weight,
10340
10348
  context: input.rationale ?? input.context,
10341
10349
  skipLayerValidation: true,
@@ -11840,10 +11848,13 @@ var tasksContracts = [
11840
11848
  }
11841
11849
  })
11842
11850
  ];
11851
+ var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
11852
+ (policy) => policy.edgeType
11853
+ );
11843
11854
  var createEdgeArgs = z.object({
11844
11855
  from: GraphRefSchema,
11845
11856
  to: GraphRefSchema,
11846
- edgeType: z.string(),
11857
+ edgeType: z.enum(CREATE_EDGE_TYPES),
11847
11858
  globalId: z.string().optional(),
11848
11859
  weight: z.number().optional(),
11849
11860
  confidence: z.number().optional(),