@lucern/events 1.0.12 → 1.0.14

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.
@@ -41,5 +41,5 @@
41
41
  "convex-validators",
42
42
  "proof-attestation"
43
43
  ],
44
- "signedAt": 1780254164781
44
+ "signedAt": 1780303941512
45
45
  }
package/dist/types.js CHANGED
@@ -546,7 +546,7 @@ var SEARCH_EVIDENCE = {
546
546
  };
547
547
  var CREATE_EVIDENCE = {
548
548
  name: "create_evidence",
549
- description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs. Optionally links the evidence to a belief or question in the same operation.",
549
+ description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs. Optionally links the evidence to a belief or question in the same operation. When evidence bears on beliefs, state whether it supports or contradicts; SL confidence is derived from these evidence relations.",
550
550
  parameters: {
551
551
  topicId: { type: "string", description: "Topic scope" },
552
552
  text: { type: "string", description: "Canonical evidence text" },
@@ -557,7 +557,20 @@ var CREATE_EVIDENCE = {
557
557
  },
558
558
  weight: {
559
559
  type: "number",
560
- description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
560
+ description: "Optional support weight: -1.0 (contradicts) to +1.0 (supports). If omitted, evidenceRelation + confidence determine the weight."
561
+ },
562
+ evidenceRelation: {
563
+ type: "string",
564
+ enum: ["supports", "contradicts"],
565
+ description: "Canonical relation to targetId/linkedBeliefNodeId. Prefer this over relying on signed weight inference."
566
+ },
567
+ confidence: {
568
+ type: "number",
569
+ description: "Confidence in the evidence relation, 0.0 to 1.0"
570
+ },
571
+ beliefRelations: {
572
+ type: "array",
573
+ description: "Optional additional belief relations: [{ beliefId|beliefNodeId|targetId, evidenceRelation|relation, confidence?, weight?, rationale? }]. Use one evidence node with multiple relations when the same fact supports or contradicts several beliefs."
561
574
  },
562
575
  metadata: {
563
576
  type: "object",
@@ -667,7 +680,7 @@ var LINK_EVIDENCE = {
667
680
  };
668
681
  var LINK_EVIDENCE_TO_BELIEF = {
669
682
  name: "link_evidence_to_belief",
670
- description: "Link evidence to a belief with a support weight. Like `git add` \u2014 stages evidence in support of (or against) a belief. The weight ranges from -1.0 (strongly contradicts) to +1.0 (strongly supports).",
683
+ description: "Link evidence to a belief with a support weight. Like `git add` \u2014 stages evidence in support of (or against) a belief. The weight ranges from -1.0 (strongly contradicts) to +1.0 (strongly supports). This relation appends to the SL confidence ledger; do not hand-write confidence separately.",
671
684
  parameters: {
672
685
  evidenceId: { type: "string", description: "The evidence node ID" },
673
686
  beliefId: { type: "string", description: "The belief node ID" },
@@ -675,9 +688,18 @@ var LINK_EVIDENCE_TO_BELIEF = {
675
688
  type: "number",
676
689
  description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
677
690
  },
691
+ evidenceRelation: {
692
+ type: "string",
693
+ enum: ["supports", "contradicts"],
694
+ description: "Canonical semantic relation. If omitted, the sign of weight is used."
695
+ },
696
+ confidence: {
697
+ type: "number",
698
+ description: "Confidence in this evidence-to-belief relation, 0.0 to 1.0"
699
+ },
678
700
  rationale: { type: "string", description: "Why this evidence is relevant" }
679
701
  },
680
- required: ["evidenceId", "beliefId", "weight"],
702
+ required: ["evidenceId", "beliefId"],
681
703
  response: {
682
704
  description: "The created edge linking evidence to belief",
683
705
  fields: {
@@ -695,7 +717,7 @@ var LINK_EVIDENCE_TO_BELIEF = {
695
717
  // ../contracts/src/tool-contracts.lifecycle.ts
696
718
  var CREATE_BELIEF = {
697
719
  name: "create_belief",
698
- description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; use modulate_confidence to record the first evidential update.",
720
+ description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; attach supporting or contradicting evidence with create_evidence or link_evidence_to_belief to record evidential updates.",
699
721
  parameters: {
700
722
  canonicalText: {
701
723
  type: "string",
@@ -781,7 +803,7 @@ var REFINE_BELIEF = {
781
803
  };
782
804
  var MODULATE_CONFIDENCE = {
783
805
  name: "modulate_confidence",
784
- description: "Record a confidence change for a belief. Like `git commit` to the credence log \u2014 an atomic, append-only write. Each modulation is a new entry in the history, not an overwrite. Scoring happens via merge; this tool records the individual data points. Pass the full subjective-logic tuple (`belief`, `disbelief`, `uncertainty`, `baseRate`) directly. If a caller only has a scalar probability, use `@lucern/sdk` helpers `opinionFromBaseRate`, `opinionFromDogmatic`, or `opinionFromProjected` to name the intended interpretation before calling this tool. Every modulation must cite a truth-bearing artifact: triggeringEvidenceId, triggeringQuestionId, triggeringAnswerId, triggeringContradictionId, or triggeringWorktreeId. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction.",
806
+ description: "Internal-only subjective-logic ledger append. Like `git commit` to the credence log for the scoring engine \u2014 never an operator-facing way to assert confidence. Agents, SDK callers, CLI users, and MCP clients must instead create or link evidence with `evidenceRelation: supports|contradicts`; the kernel derives the next opinion from that evidence. This compatibility primitive is reserved for governed system scoring paths that already hold a full subjective-logic tuple and truth-bearing provenance.",
785
807
  parameters: {
786
808
  nodeId: { type: "string", description: "The belief to score" },
787
809
  belief: {
@@ -1471,10 +1493,11 @@ var LUCERN_ORIENT = {
1471
1493
  workflow: "array - recommended branch -> investigate -> prove gate -> merge workflow",
1472
1494
  grammarMap: "array - primitive-to-git-analogy map for topics, campaigns, worktrees, beliefs, questions, evidence, edges, contradictions, and gates",
1473
1495
  firstMoves: "array - recommended first tools for a cold-start agent",
1474
- receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, and noDefaultGlobalScan",
1496
+ receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, narrativeCoverage, synthesisLints, and noDefaultGlobalScan",
1475
1497
  safetyRules: "array - mutation and completion rules that preserve reasoning lineage",
1476
1498
  toolMap: "array | undefined - situation-to-tool routing map when requested",
1477
1499
  examples: "array | undefined - concrete tool-call examples when requested",
1500
+ futureCapabilities: "array | undefined - exemplar, gauntlet, trace-corpus, and native-model-training capabilities when requested",
1478
1501
  suggestedNextCalls: "array - safe next tool calls for the current situation"
1479
1502
  }
1480
1503
  },
@@ -4055,7 +4078,9 @@ var COMPILE_CONTEXT = {
4055
4078
  recentEvidence: "array \u2014 recent evidence ranked for this query",
4056
4079
  contradictions: "array \u2014 unresolved contradiction records",
4057
4080
  relatedEntities: "array | undefined \u2014 ranked ontological entities in scope",
4058
- contextNarrative: "array \u2014 guidance for prompt assembly",
4081
+ contextNarrative: "array \u2014 ordered synthesis blocks with kind/text, starting with executive_summary and canonical narrative blocks before raw objects",
4082
+ retrievalReceipt: "object \u2014 candidateCounts, coverageWarning, narrativeCoverage, synthesisLints, and suggestedNextActions",
4083
+ narrativeCoverage: "object \u2014 recordsSynthesized, recordsNamed, recordsOmitted, and blocksEmitted for the narrative",
4059
4084
  injectionPolicy: "object \u2014 token-budgeted section selections",
4060
4085
  diagnostics: "object \u2014 scoring and utilization telemetry"
4061
4086
  }
@@ -11594,6 +11619,23 @@ function defineProjection(def) {
11594
11619
 
11595
11620
  // ../contracts/src/projections/create-evidence.projection.ts
11596
11621
  var jsonRecordSchema = z.record(z.unknown());
11622
+ var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
11623
+ var evidenceRelationAliasSchema = z.enum([
11624
+ "supports",
11625
+ "contradicts",
11626
+ "supporting",
11627
+ "contradicting"
11628
+ ]);
11629
+ var beliefRelationSchema = z.object({
11630
+ beliefId: z.string().optional(),
11631
+ beliefNodeId: z.string().optional(),
11632
+ targetId: z.string().optional(),
11633
+ relation: evidenceRelationAliasSchema.optional(),
11634
+ evidenceRelation: evidenceRelationSchema.optional(),
11635
+ confidence: z.number().optional(),
11636
+ weight: z.number().optional(),
11637
+ rationale: z.string().optional()
11638
+ });
11597
11639
  var createEvidenceInputSchemaBase = z.object({
11598
11640
  projectId: z.string().optional(),
11599
11641
  topicId: z.string().optional(),
@@ -11615,7 +11657,8 @@ var createEvidenceInputSchemaBase = z.object({
11615
11657
  targetId: z.string().optional(),
11616
11658
  targetNodeId: z.string().optional(),
11617
11659
  linkedBeliefNodeId: z.string().optional(),
11618
- evidenceRelation: z.enum(["supports", "contradicts"]).optional(),
11660
+ evidenceRelation: evidenceRelationSchema.optional(),
11661
+ beliefRelations: z.array(beliefRelationSchema).optional(),
11619
11662
  confidence: z.number().optional(),
11620
11663
  weight: z.number().optional(),
11621
11664
  reasoning: z.string().optional(),
@@ -11623,11 +11666,55 @@ var createEvidenceInputSchemaBase = z.object({
11623
11666
  metadata: jsonRecordSchema.optional(),
11624
11667
  trustedBypassAccessCheck: z.boolean().optional()
11625
11668
  }).passthrough();
11626
- var createEvidenceInputSchema = createEvidenceInputSchemaBase.refine(
11627
- (input) => Boolean(input.text ?? input.canonicalText),
11628
- {
11629
- message: "create_evidence requires text",
11630
- path: ["text"]
11669
+ function hasNonzeroWeight(value) {
11670
+ return typeof value === "number" && Number.isFinite(value) && value !== 0;
11671
+ }
11672
+ function hasRelationSignal(value, weight) {
11673
+ return Boolean(normalizeRelation(value, weight));
11674
+ }
11675
+ var createEvidenceInputSchema = createEvidenceInputSchemaBase.superRefine(
11676
+ (input, ctx) => {
11677
+ if (!input.text && !input.canonicalText) {
11678
+ ctx.addIssue({
11679
+ code: z.ZodIssueCode.custom,
11680
+ message: "create_evidence requires text",
11681
+ path: ["text"]
11682
+ });
11683
+ }
11684
+ const target = input.targetId ?? input.targetNodeId;
11685
+ const kind = targetKind(target);
11686
+ const linksPrimaryBelief = Boolean(
11687
+ input.linkedBeliefNodeId || kind === "belief" || kind === "unknown" && target
11688
+ );
11689
+ const weight = typeof input.weight === "number" ? input.weight : void 0;
11690
+ if (linksPrimaryBelief && !hasRelationSignal(input.evidenceRelation, weight)) {
11691
+ ctx.addIssue({
11692
+ code: z.ZodIssueCode.custom,
11693
+ message: "belief-targeted evidence requires evidenceRelation='supports'|'contradicts' or a nonzero signed weight",
11694
+ path: ["evidenceRelation"]
11695
+ });
11696
+ }
11697
+ input.beliefRelations?.forEach((relation, index) => {
11698
+ const beliefNodeId = relation.beliefNodeId ?? relation.beliefId ?? relation.targetId;
11699
+ if (!beliefNodeId) {
11700
+ ctx.addIssue({
11701
+ code: z.ZodIssueCode.custom,
11702
+ message: "beliefRelations entries require beliefId, beliefNodeId, or targetId",
11703
+ path: ["beliefRelations", index, "beliefNodeId"]
11704
+ });
11705
+ }
11706
+ const relationWeight2 = typeof relation.weight === "number" ? relation.weight : void 0;
11707
+ if (beliefNodeId && !hasRelationSignal(
11708
+ relation.evidenceRelation ?? relation.relation,
11709
+ relationWeight2
11710
+ )) {
11711
+ ctx.addIssue({
11712
+ code: z.ZodIssueCode.custom,
11713
+ message: "beliefRelations entries require evidenceRelation='supports'|'contradicts' or a nonzero signed weight",
11714
+ path: ["beliefRelations", index, "evidenceRelation"]
11715
+ });
11716
+ }
11717
+ });
11631
11718
  }
11632
11719
  );
11633
11720
  function compactRecord(input) {
@@ -11679,6 +11766,47 @@ function targetKind(targetId) {
11679
11766
  }
11680
11767
  return "unknown";
11681
11768
  }
11769
+ function normalizeRelation(value, weight) {
11770
+ if (value === "supports" || value === "supporting") {
11771
+ return "supports";
11772
+ }
11773
+ if (value === "contradicts" || value === "contradicting") {
11774
+ return "contradicts";
11775
+ }
11776
+ if (weight === void 0 || !hasNonzeroWeight(weight)) {
11777
+ return void 0;
11778
+ }
11779
+ return weight < 0 ? "contradicts" : "supports";
11780
+ }
11781
+ function normalizeConfidence(confidence, weight) {
11782
+ if (confidence !== void 0) {
11783
+ return Math.min(1, Math.max(0, confidence));
11784
+ }
11785
+ if (weight === void 0) {
11786
+ return void 0;
11787
+ }
11788
+ return Math.min(1, Math.max(0, Math.abs(weight)));
11789
+ }
11790
+ function normalizeBeliefRelation(relation) {
11791
+ const beliefNodeId = relation.beliefNodeId ?? relation.beliefId ?? relation.targetId;
11792
+ if (!beliefNodeId) {
11793
+ return void 0;
11794
+ }
11795
+ const weight = typeof relation.weight === "number" ? relation.weight : void 0;
11796
+ const evidenceRelation = normalizeRelation(
11797
+ relation.evidenceRelation ?? relation.relation,
11798
+ weight
11799
+ );
11800
+ if (!evidenceRelation) {
11801
+ return void 0;
11802
+ }
11803
+ return compactRecord({
11804
+ beliefNodeId,
11805
+ relation: evidenceRelation,
11806
+ confidence: normalizeConfidence(relation.confidence, weight),
11807
+ rationale: relation.rationale
11808
+ });
11809
+ }
11682
11810
  var createEvidenceProjection = defineProjection({
11683
11811
  contractName: "create_evidence",
11684
11812
  inputSchema: createEvidenceInputSchema,
@@ -11689,6 +11817,11 @@ var createEvidenceProjection = defineProjection({
11689
11817
  const kind = targetKind(target);
11690
11818
  const linkedWorktreeId = kind === "worktree" ? normalizeWorktreeId(target) : void 0;
11691
11819
  const linkedBeliefNodeId = input.linkedBeliefNodeId ?? (kind === "belief" || kind === "unknown" ? input.targetNodeId ?? input.targetId : void 0);
11820
+ const evidenceRelation = linkedBeliefNodeId ? normalizeRelation(input.evidenceRelation, weight) : void 0;
11821
+ const confidence = evidenceRelation ? normalizeConfidence(input.confidence, weight) : void 0;
11822
+ const beliefRelations = input.beliefRelations?.map(normalizeBeliefRelation).filter(
11823
+ (relation) => relation !== void 0
11824
+ );
11692
11825
  return compactRecord({
11693
11826
  projectId: input.projectId,
11694
11827
  topicId: normalizeTopicIdForKernel(input.topicId),
@@ -11717,8 +11850,9 @@ var createEvidenceProjection = defineProjection({
11717
11850
  rationale: input.rationale
11718
11851
  }),
11719
11852
  linkedBeliefNodeId,
11720
- evidenceRelation: input.evidenceRelation ?? (weight === void 0 ? void 0 : weight < 0 ? "contradicts" : "supports"),
11721
- confidence: input.confidence ?? (weight === void 0 ? void 0 : Math.min(1, Math.max(0, Math.abs(weight)))),
11853
+ evidenceRelation,
11854
+ confidence,
11855
+ beliefRelations: beliefRelations && beliefRelations.length > 0 ? beliefRelations : void 0,
11722
11856
  rationale: input.rationale,
11723
11857
  trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
11724
11858
  });
@@ -11747,6 +11881,16 @@ var createEvidenceProjection = defineProjection({
11747
11881
  v.literal("contradicts")
11748
11882
  )
11749
11883
  ),
11884
+ beliefRelations: v.optional(
11885
+ v.array(
11886
+ v.object({
11887
+ beliefNodeId: v.string(),
11888
+ relation: v.union(v.literal("supports"), v.literal("contradicts")),
11889
+ confidence: v.optional(v.number()),
11890
+ rationale: v.optional(v.string())
11891
+ })
11892
+ )
11893
+ ),
11750
11894
  confidence: v.optional(v.number()),
11751
11895
  rationale: v.string(),
11752
11896
  trustedBypassAccessCheck: v.optional(v.boolean())
@@ -11980,6 +12124,12 @@ var internalSystem = {
11980
12124
  mcp: "internal",
11981
12125
  cli: "internal"
11982
12126
  };
12127
+ var internalSdkRestOnly = {
12128
+ sdk: "internal",
12129
+ rest: "internal",
12130
+ mcp: "none",
12131
+ cli: "none"
12132
+ };
11983
12133
  var publicWithInternalMcp = {
11984
12134
  sdk: "public",
11985
12135
  rest: "public",
@@ -12029,7 +12179,6 @@ var MCP_CORE_OPERATION_NAMES = [
12029
12179
  "get_belief",
12030
12180
  "list_beliefs",
12031
12181
  "refine_belief",
12032
- "modulate_confidence",
12033
12182
  "fork_belief",
12034
12183
  "archive_belief",
12035
12184
  "search_beliefs",
@@ -12297,6 +12446,13 @@ var LUCERN_OPERATION_MANIFEST = {
12297
12446
  internalSystem,
12298
12447
  "Lucern system/background operation. Available to platform code paths, hidden from public MCP discovery."
12299
12448
  ),
12449
+ modulate_confidence: {
12450
+ name: "modulate_confidence",
12451
+ surfaceClass: "platform_internal",
12452
+ surfaceIntent: "system",
12453
+ surfaces: internalSdkRestOnly,
12454
+ rationale: "Internal SL ledger append primitive. Public callers attach evidence or contradiction relations; confidence is derived algorithmically."
12455
+ },
12300
12456
  ...entries(
12301
12457
  LEGACY_COMPAT_OPERATION_NAMES,
12302
12458
  "legacy_compat",
@@ -13000,11 +13156,11 @@ var beliefsContracts = [
13000
13156
  name: "modulate_confidence",
13001
13157
  kind: "mutation",
13002
13158
  domain: "beliefs",
13003
- surfaceClass: "platform_public",
13159
+ surfaceClass: "platform_internal",
13004
13160
  path: "/beliefs/confidence",
13005
13161
  sdkNamespace: "beliefs",
13006
13162
  sdkMethod: "modulateConfidence",
13007
- summary: "Append a belief confidence modulation.",
13163
+ summary: "Internal SL ledger append. Public callers should attach evidence or contradiction relations instead.",
13008
13164
  convex: {
13009
13165
  module: "beliefs",
13010
13166
  functionName: "modulateConfidence",
@@ -13110,17 +13266,34 @@ var beliefsContracts = [
13110
13266
  })
13111
13267
  ];
13112
13268
  var jsonRecordSchema4 = z.record(z.unknown());
13113
- var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
13269
+ var evidenceRelationSchema2 = z.enum(["supports", "contradicts"]);
13270
+ var beliefRelationSchema2 = z.object({
13271
+ beliefId: z.string().optional().describe("Belief ID this evidence bears on."),
13272
+ beliefNodeId: z.string().optional().describe("Belief node ID this evidence bears on."),
13273
+ targetId: z.string().optional().describe("Belief target ID alias for beliefId/beliefNodeId."),
13274
+ relation: z.enum(["supports", "contradicts", "supporting", "contradicting"]).optional().describe("Relation alias for how the evidence bears on the belief."),
13275
+ evidenceRelation: evidenceRelationSchema2.optional().describe("Canonical relation: supports or contradicts."),
13276
+ confidence: z.number().optional().describe("Confidence in this evidence-to-belief relation."),
13277
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0 for this belief."),
13278
+ rationale: z.string().optional().describe("Why this relation exists.")
13279
+ });
13114
13280
  var createEvidenceArgs = z.object({
13115
13281
  topicId: z.string().optional().describe("Topic scope for the evidence."),
13116
13282
  text: z.string().describe("Canonical evidence text."),
13117
13283
  source: z.string().optional().describe("Source URL or source label."),
13118
13284
  sourceUrl: z.string().optional().describe("Canonical source URL."),
13119
- targetId: z.string().optional().describe("Belief, question, or worktree identifier to link or preserve on the evidence record."),
13285
+ targetId: z.string().optional().describe(
13286
+ "Belief, question, or worktree identifier to link or preserve on the evidence record. Belief targets require evidenceRelation or a nonzero signed weight."
13287
+ ),
13120
13288
  linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
13121
- evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
13289
+ evidenceRelation: evidenceRelationSchema2.optional().describe(
13290
+ "How the evidence relates to the linked belief. Use supports for proof/fixes; use contradicts for bugs, regressions, or falsifying observations."
13291
+ ),
13292
+ beliefRelations: z.array(beliefRelationSchema2).optional().describe(
13293
+ "Additional belief relations for one evidence record. Use when the same evidence supports or contradicts multiple beliefs."
13294
+ ),
13122
13295
  confidence: z.number().optional().describe("Confidence in the evidence relation."),
13123
- weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
13296
+ weight: z.number().optional().describe("Nonzero support weight from -1.0 to +1.0."),
13124
13297
  metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
13125
13298
  rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
13126
13299
  reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
@@ -13161,6 +13334,35 @@ var createEvidenceInput = (input, context) => {
13161
13334
  context
13162
13335
  );
13163
13336
  };
13337
+ function relationWeight(input) {
13338
+ if (typeof input.weight === "number" && Number.isFinite(input.weight) && input.weight !== 0) {
13339
+ return input.weight;
13340
+ }
13341
+ const relation = String(
13342
+ input.evidenceRelation ?? input.relation ?? input.type ?? ""
13343
+ );
13344
+ if (relation !== "supports" && relation !== "supporting" && relation !== "contradicts" && relation !== "contradicting") {
13345
+ throw new Error(
13346
+ "Belief evidence links require evidenceRelation='supports'|'contradicts' or a nonzero signed weight."
13347
+ );
13348
+ }
13349
+ const confidence = typeof input.confidence === "number" ? Math.max(0, Math.min(1, input.confidence)) : 0.7;
13350
+ return relation === "contradicts" || relation === "contradicting" ? -confidence : confidence;
13351
+ }
13352
+ var linkEvidenceToBeliefInput = (input, context) => {
13353
+ const weight = relationWeight(input);
13354
+ return withUserId(
13355
+ compactRecord4({
13356
+ beliefNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
13357
+ insightId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
13358
+ type: weight < 0 ? "contradicting" : "supporting",
13359
+ confidence: Math.min(1, Math.abs(weight)),
13360
+ rationale: input.rationale ?? input.context,
13361
+ trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
13362
+ }),
13363
+ context
13364
+ );
13365
+ };
13164
13366
  var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
13165
13367
  compactRecord4({
13166
13368
  fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
@@ -13171,7 +13373,7 @@ var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
13171
13373
  )}:${String(
13172
13374
  input.beliefNodeId ?? input.beliefId ?? input.targetId
13173
13375
  )}:informs`,
13174
- weight: typeof input.weight === "number" ? input.weight : input.type === "contradicting" ? -1 : 1,
13376
+ weight: relationWeight(input),
13175
13377
  context: input.rationale ?? input.context,
13176
13378
  skipLayerValidation: true,
13177
13379
  topicId: input.topicId,
@@ -13303,10 +13505,10 @@ var evidenceContracts = [
13303
13505
  sdkMethod: "linkEvidenceToBelief",
13304
13506
  summary: "Link evidence to a belief.",
13305
13507
  convex: {
13306
- module: "edges",
13307
- functionName: "create",
13508
+ module: "beliefs",
13509
+ functionName: "linkEvidence",
13308
13510
  kind: "mutation",
13309
- inputProjection: linkEvidenceToBeliefEdgeInput
13511
+ inputProjection: linkEvidenceToBeliefInput
13310
13512
  }
13311
13513
  }),
13312
13514
  surfaceContract({