@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/outbox.js CHANGED
@@ -4766,17 +4766,44 @@ z.object({
4766
4766
  message: "SL invariant b+d+u=1 violated at API boundary"
4767
4767
  }
4768
4768
  );
4769
- var EpistemicNodeTypeSchema = z.enum([
4769
+
4770
+ // ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
4771
+ var NODE_TYPES = [
4772
+ "decision",
4770
4773
  "belief",
4771
- "evidence",
4772
4774
  "question",
4773
- "answer",
4775
+ "theme",
4776
+ "deal",
4774
4777
  "topic",
4778
+ "claim",
4779
+ "evidence",
4780
+ "synthesis",
4781
+ "answer",
4782
+ "atomic_fact",
4783
+ "excerpt",
4784
+ "source",
4785
+ "company",
4786
+ "person",
4787
+ "investor",
4788
+ "function",
4789
+ "value_chain"
4790
+ ];
4791
+ new Set(NODE_TYPES);
4792
+
4793
+ // ../contracts/src/types/graph-ref.ts
4794
+ var GRAPH_REF_EXTRA_NODE_TYPES = [
4775
4795
  "edge",
4776
4796
  "ontology",
4777
4797
  "lens",
4778
4798
  "contradiction"
4779
- ]);
4799
+ ];
4800
+ var GRAPH_REF_NODE_TYPES = [
4801
+ ...NODE_TYPES,
4802
+ ...GRAPH_REF_EXTRA_NODE_TYPES
4803
+ ];
4804
+ var EpistemicNodeTypeSchema = z.enum(
4805
+ GRAPH_REF_NODE_TYPES
4806
+ );
4780
4807
  var GraphRefSchema = z.discriminatedUnion("kind", [
4781
4808
  z.object({
4782
4809
  kind: z.literal("epistemic_node"),
@@ -4824,33 +4851,14 @@ function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
4824
4851
  }
4825
4852
 
4826
4853
  // ../contracts/src/manifests/edge-policy-manifest.data.ts
4854
+ var publicEpistemicNodeEdgePolicy = (edgeType) => ({
4855
+ edgeType,
4856
+ fromKinds: ["epistemic_node"],
4857
+ toKinds: ["epistemic_node"],
4858
+ description: "Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics."
4859
+ });
4827
4860
  var edgePolicyManifest = {
4828
- policies: [
4829
- {
4830
- edgeType: "evidence_derived_from_evidence",
4831
- fromKinds: ["epistemic_node"],
4832
- fromNodeTypes: ["evidence"],
4833
- toKinds: ["epistemic_node"],
4834
- toNodeTypes: ["evidence"],
4835
- description: "Evidence E2 was synthesized from evidence E1 by a transformation. Provides chain-of-evidence lineage."
4836
- },
4837
- {
4838
- edgeType: "evidence_supports_belief",
4839
- fromKinds: ["epistemic_node"],
4840
- fromNodeTypes: ["evidence"],
4841
- toKinds: ["epistemic_node"],
4842
- toNodeTypes: ["belief"],
4843
- description: "Existing link_evidence_to_belief semantics promoted to the create_edge policy source."
4844
- },
4845
- {
4846
- edgeType: "evidence_supports_question",
4847
- fromKinds: ["epistemic_node"],
4848
- fromNodeTypes: ["evidence"],
4849
- toKinds: ["epistemic_node"],
4850
- toNodeTypes: ["question"],
4851
- description: "Existing link_evidence_to_question semantics promoted to the create_edge policy source."
4852
- }
4853
- ]
4861
+ policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy)
4854
4862
  };
4855
4863
 
4856
4864
  // ../contracts/src/tenant-client.contract.ts
@@ -7406,15 +7414,15 @@ var IDENTITY_WHOAMI = {
7406
7414
  };
7407
7415
  var COMPILE_CONTEXT = {
7408
7416
  name: "compile_context",
7409
- 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.",
7417
+ 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.",
7410
7418
  parameters: {
7411
7419
  topicId: {
7412
7420
  type: "string",
7413
- description: "Topic scope ID to compile"
7421
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
7414
7422
  },
7415
7423
  query: {
7416
7424
  type: "string",
7417
- description: "Optional focus query used to rank context items"
7425
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
7418
7426
  },
7419
7427
  budget: {
7420
7428
  type: "number",
@@ -7438,7 +7446,7 @@ var COMPILE_CONTEXT = {
7438
7446
  description: "Include related ontological entities in the compiled result"
7439
7447
  }
7440
7448
  },
7441
- required: ["topicId"],
7449
+ required: [],
7442
7450
  response: {
7443
7451
  description: "Compiled context pack for the requested topic",
7444
7452
  fields: {
@@ -9937,7 +9945,7 @@ var contextContracts = [
9937
9945
  path: "/context/compile",
9938
9946
  sdkNamespace: "context",
9939
9947
  sdkMethod: "compileContext",
9940
- summary: "Compile a focused reasoning context for a topic.",
9948
+ summary: "Compile a focused reasoning context, resolving topic from query when omitted.",
9941
9949
  convex: {
9942
9950
  module: "contextCompiler",
9943
9951
  functionName: "compile",
@@ -10403,12 +10411,12 @@ var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
10403
10411
  compactRecord4({
10404
10412
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
10405
10413
  toNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
10406
- edgeType: "evidence_supports_belief",
10414
+ edgeType: "informs",
10407
10415
  globalId: input.globalId ?? `edge:${String(
10408
10416
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
10409
10417
  )}:${String(
10410
10418
  input.beliefNodeId ?? input.beliefId ?? input.targetId
10411
- )}:evidence_supports_belief`,
10419
+ )}:informs`,
10412
10420
  weight: typeof input.weight === "number" ? input.weight : input.type === "contradicting" ? -1 : 1,
10413
10421
  context: input.rationale ?? input.context,
10414
10422
  skipLayerValidation: true,
@@ -10421,12 +10429,12 @@ var linkEvidenceToQuestionEdgeInput = (input, context) => withCreatedBy(
10421
10429
  compactRecord4({
10422
10430
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
10423
10431
  toNodeId: input.questionId ?? input.questionNodeId ?? input.targetId,
10424
- edgeType: "evidence_supports_question",
10432
+ edgeType: "responds_to",
10425
10433
  globalId: input.globalId ?? `edge:${String(
10426
10434
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
10427
10435
  )}:${String(
10428
10436
  input.questionId ?? input.questionNodeId ?? input.targetId
10429
- )}:evidence_supports_question`,
10437
+ )}:responds_to`,
10430
10438
  weight: input.impactScore ?? input.weight,
10431
10439
  context: input.rationale ?? input.context,
10432
10440
  skipLayerValidation: true,
@@ -11931,10 +11939,13 @@ var tasksContracts = [
11931
11939
  }
11932
11940
  })
11933
11941
  ];
11942
+ var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
11943
+ (policy) => policy.edgeType
11944
+ );
11934
11945
  var createEdgeArgs = z.object({
11935
11946
  from: GraphRefSchema,
11936
11947
  to: GraphRefSchema,
11937
- edgeType: z.string(),
11948
+ edgeType: z.enum(CREATE_EDGE_TYPES),
11938
11949
  globalId: z.string().optional(),
11939
11950
  weight: z.number().optional(),
11940
11951
  confidence: z.number().optional(),