@lucern/mcp 0.3.0-alpha.8 → 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
@@ -5278,17 +5278,44 @@ z.object({
5278
5278
  message: "SL invariant b+d+u=1 violated at API boundary"
5279
5279
  }
5280
5280
  );
5281
- var EpistemicNodeTypeSchema = z.enum([
5281
+
5282
+ // ../contracts/src/schema-helpers/spine/tables/epistemicNodes.ts
5283
+ var NODE_TYPES = [
5284
+ "decision",
5282
5285
  "belief",
5283
- "evidence",
5284
5286
  "question",
5285
- "answer",
5287
+ "theme",
5288
+ "deal",
5286
5289
  "topic",
5290
+ "claim",
5291
+ "evidence",
5292
+ "synthesis",
5293
+ "answer",
5294
+ "atomic_fact",
5295
+ "excerpt",
5296
+ "source",
5297
+ "company",
5298
+ "person",
5299
+ "investor",
5300
+ "function",
5301
+ "value_chain"
5302
+ ];
5303
+ new Set(NODE_TYPES);
5304
+
5305
+ // ../contracts/src/types/graph-ref.ts
5306
+ var GRAPH_REF_EXTRA_NODE_TYPES = [
5287
5307
  "edge",
5288
5308
  "ontology",
5289
5309
  "lens",
5290
5310
  "contradiction"
5291
- ]);
5311
+ ];
5312
+ var GRAPH_REF_NODE_TYPES = [
5313
+ ...NODE_TYPES,
5314
+ ...GRAPH_REF_EXTRA_NODE_TYPES
5315
+ ];
5316
+ var EpistemicNodeTypeSchema = z.enum(
5317
+ GRAPH_REF_NODE_TYPES
5318
+ );
5292
5319
  var GraphRefSchema = z.discriminatedUnion("kind", [
5293
5320
  z.object({
5294
5321
  kind: z.literal("epistemic_node"),
@@ -5336,33 +5363,14 @@ function assertEdgePolicyAllowed(manifest, edgeType, from, to) {
5336
5363
  }
5337
5364
 
5338
5365
  // ../contracts/src/manifests/edge-policy-manifest.data.ts
5366
+ var publicEpistemicNodeEdgePolicy = (edgeType) => ({
5367
+ edgeType,
5368
+ fromKinds: ["epistemic_node"],
5369
+ toKinds: ["epistemic_node"],
5370
+ description: "Canonical public create_edge policy for graph-node relationships. The policy layer gates edge-type membership, not endpoint semantics."
5371
+ });
5339
5372
  var edgePolicyManifest = {
5340
- policies: [
5341
- {
5342
- edgeType: "evidence_derived_from_evidence",
5343
- fromKinds: ["epistemic_node"],
5344
- fromNodeTypes: ["evidence"],
5345
- toKinds: ["epistemic_node"],
5346
- toNodeTypes: ["evidence"],
5347
- description: "Evidence E2 was synthesized from evidence E1 by a transformation. Provides chain-of-evidence lineage."
5348
- },
5349
- {
5350
- edgeType: "evidence_supports_belief",
5351
- fromKinds: ["epistemic_node"],
5352
- fromNodeTypes: ["evidence"],
5353
- toKinds: ["epistemic_node"],
5354
- toNodeTypes: ["belief"],
5355
- description: "Existing link_evidence_to_belief semantics promoted to the create_edge policy source."
5356
- },
5357
- {
5358
- edgeType: "evidence_supports_question",
5359
- fromKinds: ["epistemic_node"],
5360
- fromNodeTypes: ["evidence"],
5361
- toKinds: ["epistemic_node"],
5362
- toNodeTypes: ["question"],
5363
- description: "Existing link_evidence_to_question semantics promoted to the create_edge policy source."
5364
- }
5365
- ]
5373
+ policies: EDGE_TYPE_VALUES.map(publicEpistemicNodeEdgePolicy)
5366
5374
  };
5367
5375
 
5368
5376
  // ../contracts/src/tenant-client.contract.ts
@@ -11097,12 +11105,12 @@ var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
11097
11105
  compactRecord4({
11098
11106
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
11099
11107
  toNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
11100
- edgeType: "evidence_supports_belief",
11108
+ edgeType: "informs",
11101
11109
  globalId: input.globalId ?? `edge:${String(
11102
11110
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
11103
11111
  )}:${String(
11104
11112
  input.beliefNodeId ?? input.beliefId ?? input.targetId
11105
- )}:evidence_supports_belief`,
11113
+ )}:informs`,
11106
11114
  weight: typeof input.weight === "number" ? input.weight : input.type === "contradicting" ? -1 : 1,
11107
11115
  context: input.rationale ?? input.context,
11108
11116
  skipLayerValidation: true,
@@ -11115,12 +11123,12 @@ var linkEvidenceToQuestionEdgeInput = (input, context) => withCreatedBy(
11115
11123
  compactRecord4({
11116
11124
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
11117
11125
  toNodeId: input.questionId ?? input.questionNodeId ?? input.targetId,
11118
- edgeType: "evidence_supports_question",
11126
+ edgeType: "responds_to",
11119
11127
  globalId: input.globalId ?? `edge:${String(
11120
11128
  input.insightId ?? input.evidenceNodeId ?? input.evidenceId
11121
11129
  )}:${String(
11122
11130
  input.questionId ?? input.questionNodeId ?? input.targetId
11123
- )}:evidence_supports_question`,
11131
+ )}:responds_to`,
11124
11132
  weight: input.impactScore ?? input.weight,
11125
11133
  context: input.rationale ?? input.context,
11126
11134
  skipLayerValidation: true,
@@ -12625,10 +12633,13 @@ var tasksContracts = [
12625
12633
  }
12626
12634
  })
12627
12635
  ];
12636
+ var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
12637
+ (policy) => policy.edgeType
12638
+ );
12628
12639
  var createEdgeArgs = z.object({
12629
12640
  from: GraphRefSchema,
12630
12641
  to: GraphRefSchema,
12631
- edgeType: z.string(),
12642
+ edgeType: z.enum(CREATE_EDGE_TYPES),
12632
12643
  globalId: z.string().optional(),
12633
12644
  weight: z.number().optional(),
12634
12645
  confidence: z.number().optional(),
@@ -21437,6 +21448,21 @@ function createSchemaClient(config = {}) {
21437
21448
  }
21438
21449
 
21439
21450
  // ../sdk/src/clientHelpers.ts
21451
+ function normalizeCustomNamespace(namespace) {
21452
+ return namespace.trim() || "custom";
21453
+ }
21454
+ function normalizeCustomToolPayload(input) {
21455
+ return input && typeof input === "object" && !Array.isArray(input) ? input : {};
21456
+ }
21457
+ function resolveCustomToolFullName(name) {
21458
+ return name.includes(".") ? name : `custom.${name}`;
21459
+ }
21460
+ function buildBeliefsRefinePayload(textOrInput, rationale) {
21461
+ return typeof textOrInput === "string" ? { text: textOrInput, rationale } : { text: textOrInput.text, rationale: textOrInput.rationale };
21462
+ }
21463
+ function buildBeliefsArchivePayload(input) {
21464
+ return typeof input === "string" ? { reason: input } : input ? { reason: input.reason ?? input.rationale } : void 0;
21465
+ }
21440
21466
  function asNodeArray(data) {
21441
21467
  const rows = asListItems(data, "nodes");
21442
21468
  if (rows.length > 0) {
@@ -21814,7 +21840,7 @@ function createToolRegistryClient(config = {}) {
21814
21840
  }
21815
21841
 
21816
21842
  // ../sdk/src/version.ts
21817
- var LUCERN_SDK_VERSION = "0.3.0-alpha.8";
21843
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.9";
21818
21844
 
21819
21845
  // ../sdk/src/workflowClient.ts
21820
21846
  function normalizeLensQuery(value) {
@@ -22335,11 +22361,11 @@ function createLucernClient(config = {}) {
22335
22361
  }
22336
22362
  }
22337
22363
  const invokeCustomTool = async (fullName, input = {}) => {
22338
- const payload = input && typeof input === "object" && !Array.isArray(input) ? input : {};
22364
+ const payload = normalizeCustomToolPayload(input);
22339
22365
  return invokeRegisteredCustomTool(fullName, payload, { source: "sdk" });
22340
22366
  };
22341
22367
  const getCustomNamespace = (namespace) => {
22342
- const normalized = namespace.trim() || "custom";
22368
+ const normalized = normalizeCustomNamespace(namespace);
22343
22369
  const cached = customNamespaceCache.get(normalized);
22344
22370
  if (cached) {
22345
22371
  return cached;
@@ -22799,10 +22825,7 @@ function createLucernClient(config = {}) {
22799
22825
  return beliefsFacade.get(nodeId).then(exposeGatewayData);
22800
22826
  },
22801
22827
  refine(nodeId, textOrInput, rationale) {
22802
- const payload = typeof textOrInput === "string" ? { text: textOrInput, rationale } : {
22803
- text: textOrInput.text,
22804
- rationale: textOrInput.rationale
22805
- };
22828
+ const payload = buildBeliefsRefinePayload(textOrInput, rationale);
22806
22829
  return beliefsFacade.refine(nodeId, payload).then(exposeGatewayData);
22807
22830
  },
22808
22831
  updateConfidence(nodeId, input) {
@@ -22840,7 +22863,7 @@ function createLucernClient(config = {}) {
22840
22863
  }).then(exposeGatewayData);
22841
22864
  },
22842
22865
  archive(nodeId, input) {
22843
- const payload = typeof input === "string" ? { reason: input } : input ? { reason: input.reason ?? input.rationale } : void 0;
22866
+ const payload = buildBeliefsArchivePayload(input);
22844
22867
  return beliefsFacade.archive(nodeId, payload).then(exposeGatewayData);
22845
22868
  },
22846
22869
  list(args) {
@@ -23880,7 +23903,7 @@ function createLucernClient(config = {}) {
23880
23903
  list: listRegisteredCustomTools,
23881
23904
  clear: clearRegisteredCustomTools,
23882
23905
  invoke(name, input = {}) {
23883
- const fullName = name.includes(".") ? name : `custom.${name}`;
23906
+ const fullName = resolveCustomToolFullName(name);
23884
23907
  return invokeCustomTool(fullName, input);
23885
23908
  },
23886
23909
  namespace: getCustomNamespace
@@ -28559,7 +28582,7 @@ function createLucernStandaloneMcpServer(options) {
28559
28582
  });
28560
28583
  const server = new McpServer({
28561
28584
  name: "lucern-mcp",
28562
- version: "0.3.0-alpha.8"
28585
+ version: "0.3.0-alpha.9"
28563
28586
  });
28564
28587
  registerTools(server, runtime);
28565
28588
  const resources = registerResources(server, runtime, observationStore);