@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.
- package/dist/index.js +229 -27
- package/dist/index.js.map +1 -1
- package/dist/outbox.js +229 -27
- package/dist/outbox.js.map +1 -1
- package/dist/proof-attestation.json +1 -1
- package/dist/types.js +229 -27
- package/dist/types.js.map +1 -1
- package/dist/webhook-delivery-machine.js +229 -27
- package/dist/webhook-delivery-machine.js.map +1 -1
- package/dist/webhooks.js +229 -27
- package/dist/webhooks.js.map +1 -1
- package/package.json +2 -2
package/dist/outbox.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: "
|
|
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"
|
|
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)`;
|
|
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: "
|
|
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
|
|
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
|
}
|
|
@@ -11646,6 +11671,23 @@ function defineProjection(def) {
|
|
|
11646
11671
|
|
|
11647
11672
|
// ../contracts/src/projections/create-evidence.projection.ts
|
|
11648
11673
|
var jsonRecordSchema = z.record(z.unknown());
|
|
11674
|
+
var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
|
|
11675
|
+
var evidenceRelationAliasSchema = z.enum([
|
|
11676
|
+
"supports",
|
|
11677
|
+
"contradicts",
|
|
11678
|
+
"supporting",
|
|
11679
|
+
"contradicting"
|
|
11680
|
+
]);
|
|
11681
|
+
var beliefRelationSchema = z.object({
|
|
11682
|
+
beliefId: z.string().optional(),
|
|
11683
|
+
beliefNodeId: z.string().optional(),
|
|
11684
|
+
targetId: z.string().optional(),
|
|
11685
|
+
relation: evidenceRelationAliasSchema.optional(),
|
|
11686
|
+
evidenceRelation: evidenceRelationSchema.optional(),
|
|
11687
|
+
confidence: z.number().optional(),
|
|
11688
|
+
weight: z.number().optional(),
|
|
11689
|
+
rationale: z.string().optional()
|
|
11690
|
+
});
|
|
11649
11691
|
var createEvidenceInputSchemaBase = z.object({
|
|
11650
11692
|
projectId: z.string().optional(),
|
|
11651
11693
|
topicId: z.string().optional(),
|
|
@@ -11667,7 +11709,8 @@ var createEvidenceInputSchemaBase = z.object({
|
|
|
11667
11709
|
targetId: z.string().optional(),
|
|
11668
11710
|
targetNodeId: z.string().optional(),
|
|
11669
11711
|
linkedBeliefNodeId: z.string().optional(),
|
|
11670
|
-
evidenceRelation:
|
|
11712
|
+
evidenceRelation: evidenceRelationSchema.optional(),
|
|
11713
|
+
beliefRelations: z.array(beliefRelationSchema).optional(),
|
|
11671
11714
|
confidence: z.number().optional(),
|
|
11672
11715
|
weight: z.number().optional(),
|
|
11673
11716
|
reasoning: z.string().optional(),
|
|
@@ -11675,11 +11718,55 @@ var createEvidenceInputSchemaBase = z.object({
|
|
|
11675
11718
|
metadata: jsonRecordSchema.optional(),
|
|
11676
11719
|
trustedBypassAccessCheck: z.boolean().optional()
|
|
11677
11720
|
}).passthrough();
|
|
11678
|
-
|
|
11679
|
-
(
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11721
|
+
function hasNonzeroWeight(value) {
|
|
11722
|
+
return typeof value === "number" && Number.isFinite(value) && value !== 0;
|
|
11723
|
+
}
|
|
11724
|
+
function hasRelationSignal(value, weight) {
|
|
11725
|
+
return Boolean(normalizeRelation(value, weight));
|
|
11726
|
+
}
|
|
11727
|
+
var createEvidenceInputSchema = createEvidenceInputSchemaBase.superRefine(
|
|
11728
|
+
(input, ctx) => {
|
|
11729
|
+
if (!input.text && !input.canonicalText) {
|
|
11730
|
+
ctx.addIssue({
|
|
11731
|
+
code: z.ZodIssueCode.custom,
|
|
11732
|
+
message: "create_evidence requires text",
|
|
11733
|
+
path: ["text"]
|
|
11734
|
+
});
|
|
11735
|
+
}
|
|
11736
|
+
const target = input.targetId ?? input.targetNodeId;
|
|
11737
|
+
const kind = targetKind(target);
|
|
11738
|
+
const linksPrimaryBelief = Boolean(
|
|
11739
|
+
input.linkedBeliefNodeId || kind === "belief" || kind === "unknown" && target
|
|
11740
|
+
);
|
|
11741
|
+
const weight = typeof input.weight === "number" ? input.weight : void 0;
|
|
11742
|
+
if (linksPrimaryBelief && !hasRelationSignal(input.evidenceRelation, weight)) {
|
|
11743
|
+
ctx.addIssue({
|
|
11744
|
+
code: z.ZodIssueCode.custom,
|
|
11745
|
+
message: "belief-targeted evidence requires evidenceRelation='supports'|'contradicts' or a nonzero signed weight",
|
|
11746
|
+
path: ["evidenceRelation"]
|
|
11747
|
+
});
|
|
11748
|
+
}
|
|
11749
|
+
input.beliefRelations?.forEach((relation, index) => {
|
|
11750
|
+
const beliefNodeId = relation.beliefNodeId ?? relation.beliefId ?? relation.targetId;
|
|
11751
|
+
if (!beliefNodeId) {
|
|
11752
|
+
ctx.addIssue({
|
|
11753
|
+
code: z.ZodIssueCode.custom,
|
|
11754
|
+
message: "beliefRelations entries require beliefId, beliefNodeId, or targetId",
|
|
11755
|
+
path: ["beliefRelations", index, "beliefNodeId"]
|
|
11756
|
+
});
|
|
11757
|
+
}
|
|
11758
|
+
const relationWeight2 = typeof relation.weight === "number" ? relation.weight : void 0;
|
|
11759
|
+
if (beliefNodeId && !hasRelationSignal(
|
|
11760
|
+
relation.evidenceRelation ?? relation.relation,
|
|
11761
|
+
relationWeight2
|
|
11762
|
+
)) {
|
|
11763
|
+
ctx.addIssue({
|
|
11764
|
+
code: z.ZodIssueCode.custom,
|
|
11765
|
+
message: "beliefRelations entries require evidenceRelation='supports'|'contradicts' or a nonzero signed weight",
|
|
11766
|
+
path: ["beliefRelations", index, "evidenceRelation"]
|
|
11767
|
+
});
|
|
11768
|
+
}
|
|
11769
|
+
});
|
|
11683
11770
|
}
|
|
11684
11771
|
);
|
|
11685
11772
|
function compactRecord(input) {
|
|
@@ -11731,6 +11818,47 @@ function targetKind(targetId) {
|
|
|
11731
11818
|
}
|
|
11732
11819
|
return "unknown";
|
|
11733
11820
|
}
|
|
11821
|
+
function normalizeRelation(value, weight) {
|
|
11822
|
+
if (value === "supports" || value === "supporting") {
|
|
11823
|
+
return "supports";
|
|
11824
|
+
}
|
|
11825
|
+
if (value === "contradicts" || value === "contradicting") {
|
|
11826
|
+
return "contradicts";
|
|
11827
|
+
}
|
|
11828
|
+
if (weight === void 0 || !hasNonzeroWeight(weight)) {
|
|
11829
|
+
return void 0;
|
|
11830
|
+
}
|
|
11831
|
+
return weight < 0 ? "contradicts" : "supports";
|
|
11832
|
+
}
|
|
11833
|
+
function normalizeConfidence(confidence, weight) {
|
|
11834
|
+
if (confidence !== void 0) {
|
|
11835
|
+
return Math.min(1, Math.max(0, confidence));
|
|
11836
|
+
}
|
|
11837
|
+
if (weight === void 0) {
|
|
11838
|
+
return void 0;
|
|
11839
|
+
}
|
|
11840
|
+
return Math.min(1, Math.max(0, Math.abs(weight)));
|
|
11841
|
+
}
|
|
11842
|
+
function normalizeBeliefRelation(relation) {
|
|
11843
|
+
const beliefNodeId = relation.beliefNodeId ?? relation.beliefId ?? relation.targetId;
|
|
11844
|
+
if (!beliefNodeId) {
|
|
11845
|
+
return void 0;
|
|
11846
|
+
}
|
|
11847
|
+
const weight = typeof relation.weight === "number" ? relation.weight : void 0;
|
|
11848
|
+
const evidenceRelation = normalizeRelation(
|
|
11849
|
+
relation.evidenceRelation ?? relation.relation,
|
|
11850
|
+
weight
|
|
11851
|
+
);
|
|
11852
|
+
if (!evidenceRelation) {
|
|
11853
|
+
return void 0;
|
|
11854
|
+
}
|
|
11855
|
+
return compactRecord({
|
|
11856
|
+
beliefNodeId,
|
|
11857
|
+
relation: evidenceRelation,
|
|
11858
|
+
confidence: normalizeConfidence(relation.confidence, weight),
|
|
11859
|
+
rationale: relation.rationale
|
|
11860
|
+
});
|
|
11861
|
+
}
|
|
11734
11862
|
var createEvidenceProjection = defineProjection({
|
|
11735
11863
|
contractName: "create_evidence",
|
|
11736
11864
|
inputSchema: createEvidenceInputSchema,
|
|
@@ -11741,6 +11869,11 @@ var createEvidenceProjection = defineProjection({
|
|
|
11741
11869
|
const kind = targetKind(target);
|
|
11742
11870
|
const linkedWorktreeId = kind === "worktree" ? normalizeWorktreeId(target) : void 0;
|
|
11743
11871
|
const linkedBeliefNodeId = input.linkedBeliefNodeId ?? (kind === "belief" || kind === "unknown" ? input.targetNodeId ?? input.targetId : void 0);
|
|
11872
|
+
const evidenceRelation = linkedBeliefNodeId ? normalizeRelation(input.evidenceRelation, weight) : void 0;
|
|
11873
|
+
const confidence = evidenceRelation ? normalizeConfidence(input.confidence, weight) : void 0;
|
|
11874
|
+
const beliefRelations = input.beliefRelations?.map(normalizeBeliefRelation).filter(
|
|
11875
|
+
(relation) => relation !== void 0
|
|
11876
|
+
);
|
|
11744
11877
|
return compactRecord({
|
|
11745
11878
|
projectId: input.projectId,
|
|
11746
11879
|
topicId: normalizeTopicIdForKernel(input.topicId),
|
|
@@ -11769,8 +11902,9 @@ var createEvidenceProjection = defineProjection({
|
|
|
11769
11902
|
rationale: input.rationale
|
|
11770
11903
|
}),
|
|
11771
11904
|
linkedBeliefNodeId,
|
|
11772
|
-
evidenceRelation
|
|
11773
|
-
confidence
|
|
11905
|
+
evidenceRelation,
|
|
11906
|
+
confidence,
|
|
11907
|
+
beliefRelations: beliefRelations && beliefRelations.length > 0 ? beliefRelations : void 0,
|
|
11774
11908
|
rationale: input.rationale,
|
|
11775
11909
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
11776
11910
|
});
|
|
@@ -11799,6 +11933,16 @@ var createEvidenceProjection = defineProjection({
|
|
|
11799
11933
|
v.literal("contradicts")
|
|
11800
11934
|
)
|
|
11801
11935
|
),
|
|
11936
|
+
beliefRelations: v.optional(
|
|
11937
|
+
v.array(
|
|
11938
|
+
v.object({
|
|
11939
|
+
beliefNodeId: v.string(),
|
|
11940
|
+
relation: v.union(v.literal("supports"), v.literal("contradicts")),
|
|
11941
|
+
confidence: v.optional(v.number()),
|
|
11942
|
+
rationale: v.optional(v.string())
|
|
11943
|
+
})
|
|
11944
|
+
)
|
|
11945
|
+
),
|
|
11802
11946
|
confidence: v.optional(v.number()),
|
|
11803
11947
|
rationale: v.string(),
|
|
11804
11948
|
trustedBypassAccessCheck: v.optional(v.boolean())
|
|
@@ -12032,6 +12176,12 @@ var internalSystem = {
|
|
|
12032
12176
|
mcp: "internal",
|
|
12033
12177
|
cli: "internal"
|
|
12034
12178
|
};
|
|
12179
|
+
var internalSdkRestOnly = {
|
|
12180
|
+
sdk: "internal",
|
|
12181
|
+
rest: "internal",
|
|
12182
|
+
mcp: "none",
|
|
12183
|
+
cli: "none"
|
|
12184
|
+
};
|
|
12035
12185
|
var publicWithInternalMcp = {
|
|
12036
12186
|
sdk: "public",
|
|
12037
12187
|
rest: "public",
|
|
@@ -12081,7 +12231,6 @@ var MCP_CORE_OPERATION_NAMES = [
|
|
|
12081
12231
|
"get_belief",
|
|
12082
12232
|
"list_beliefs",
|
|
12083
12233
|
"refine_belief",
|
|
12084
|
-
"modulate_confidence",
|
|
12085
12234
|
"fork_belief",
|
|
12086
12235
|
"archive_belief",
|
|
12087
12236
|
"search_beliefs",
|
|
@@ -12349,6 +12498,13 @@ var LUCERN_OPERATION_MANIFEST = {
|
|
|
12349
12498
|
internalSystem,
|
|
12350
12499
|
"Lucern system/background operation. Available to platform code paths, hidden from public MCP discovery."
|
|
12351
12500
|
),
|
|
12501
|
+
modulate_confidence: {
|
|
12502
|
+
name: "modulate_confidence",
|
|
12503
|
+
surfaceClass: "platform_internal",
|
|
12504
|
+
surfaceIntent: "system",
|
|
12505
|
+
surfaces: internalSdkRestOnly,
|
|
12506
|
+
rationale: "Internal SL ledger append primitive. Public callers attach evidence or contradiction relations; confidence is derived algorithmically."
|
|
12507
|
+
},
|
|
12352
12508
|
...entries(
|
|
12353
12509
|
LEGACY_COMPAT_OPERATION_NAMES,
|
|
12354
12510
|
"legacy_compat",
|
|
@@ -13052,11 +13208,11 @@ var beliefsContracts = [
|
|
|
13052
13208
|
name: "modulate_confidence",
|
|
13053
13209
|
kind: "mutation",
|
|
13054
13210
|
domain: "beliefs",
|
|
13055
|
-
surfaceClass: "
|
|
13211
|
+
surfaceClass: "platform_internal",
|
|
13056
13212
|
path: "/beliefs/confidence",
|
|
13057
13213
|
sdkNamespace: "beliefs",
|
|
13058
13214
|
sdkMethod: "modulateConfidence",
|
|
13059
|
-
summary: "
|
|
13215
|
+
summary: "Internal SL ledger append. Public callers should attach evidence or contradiction relations instead.",
|
|
13060
13216
|
convex: {
|
|
13061
13217
|
module: "beliefs",
|
|
13062
13218
|
functionName: "modulateConfidence",
|
|
@@ -13162,17 +13318,34 @@ var beliefsContracts = [
|
|
|
13162
13318
|
})
|
|
13163
13319
|
];
|
|
13164
13320
|
var jsonRecordSchema4 = z.record(z.unknown());
|
|
13165
|
-
var
|
|
13321
|
+
var evidenceRelationSchema2 = z.enum(["supports", "contradicts"]);
|
|
13322
|
+
var beliefRelationSchema2 = z.object({
|
|
13323
|
+
beliefId: z.string().optional().describe("Belief ID this evidence bears on."),
|
|
13324
|
+
beliefNodeId: z.string().optional().describe("Belief node ID this evidence bears on."),
|
|
13325
|
+
targetId: z.string().optional().describe("Belief target ID alias for beliefId/beliefNodeId."),
|
|
13326
|
+
relation: z.enum(["supports", "contradicts", "supporting", "contradicting"]).optional().describe("Relation alias for how the evidence bears on the belief."),
|
|
13327
|
+
evidenceRelation: evidenceRelationSchema2.optional().describe("Canonical relation: supports or contradicts."),
|
|
13328
|
+
confidence: z.number().optional().describe("Confidence in this evidence-to-belief relation."),
|
|
13329
|
+
weight: z.number().optional().describe("Support weight from -1.0 to +1.0 for this belief."),
|
|
13330
|
+
rationale: z.string().optional().describe("Why this relation exists.")
|
|
13331
|
+
});
|
|
13166
13332
|
var createEvidenceArgs = z.object({
|
|
13167
13333
|
topicId: z.string().optional().describe("Topic scope for the evidence."),
|
|
13168
13334
|
text: z.string().describe("Canonical evidence text."),
|
|
13169
13335
|
source: z.string().optional().describe("Source URL or source label."),
|
|
13170
13336
|
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
13171
|
-
targetId: z.string().optional().describe(
|
|
13337
|
+
targetId: z.string().optional().describe(
|
|
13338
|
+
"Belief, question, or worktree identifier to link or preserve on the evidence record. Belief targets require evidenceRelation or a nonzero signed weight."
|
|
13339
|
+
),
|
|
13172
13340
|
linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
|
|
13173
|
-
evidenceRelation:
|
|
13341
|
+
evidenceRelation: evidenceRelationSchema2.optional().describe(
|
|
13342
|
+
"How the evidence relates to the linked belief. Use supports for proof/fixes; use contradicts for bugs, regressions, or falsifying observations."
|
|
13343
|
+
),
|
|
13344
|
+
beliefRelations: z.array(beliefRelationSchema2).optional().describe(
|
|
13345
|
+
"Additional belief relations for one evidence record. Use when the same evidence supports or contradicts multiple beliefs."
|
|
13346
|
+
),
|
|
13174
13347
|
confidence: z.number().optional().describe("Confidence in the evidence relation."),
|
|
13175
|
-
weight: z.number().optional().describe("
|
|
13348
|
+
weight: z.number().optional().describe("Nonzero support weight from -1.0 to +1.0."),
|
|
13176
13349
|
metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
|
|
13177
13350
|
rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
|
|
13178
13351
|
reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
|
|
@@ -13213,6 +13386,35 @@ var createEvidenceInput = (input, context) => {
|
|
|
13213
13386
|
context
|
|
13214
13387
|
);
|
|
13215
13388
|
};
|
|
13389
|
+
function relationWeight(input) {
|
|
13390
|
+
if (typeof input.weight === "number" && Number.isFinite(input.weight) && input.weight !== 0) {
|
|
13391
|
+
return input.weight;
|
|
13392
|
+
}
|
|
13393
|
+
const relation = String(
|
|
13394
|
+
input.evidenceRelation ?? input.relation ?? input.type ?? ""
|
|
13395
|
+
);
|
|
13396
|
+
if (relation !== "supports" && relation !== "supporting" && relation !== "contradicts" && relation !== "contradicting") {
|
|
13397
|
+
throw new Error(
|
|
13398
|
+
"Belief evidence links require evidenceRelation='supports'|'contradicts' or a nonzero signed weight."
|
|
13399
|
+
);
|
|
13400
|
+
}
|
|
13401
|
+
const confidence = typeof input.confidence === "number" ? Math.max(0, Math.min(1, input.confidence)) : 0.7;
|
|
13402
|
+
return relation === "contradicts" || relation === "contradicting" ? -confidence : confidence;
|
|
13403
|
+
}
|
|
13404
|
+
var linkEvidenceToBeliefInput = (input, context) => {
|
|
13405
|
+
const weight = relationWeight(input);
|
|
13406
|
+
return withUserId(
|
|
13407
|
+
compactRecord4({
|
|
13408
|
+
beliefNodeId: input.beliefNodeId ?? input.beliefId ?? input.targetId,
|
|
13409
|
+
insightId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
|
|
13410
|
+
type: weight < 0 ? "contradicting" : "supporting",
|
|
13411
|
+
confidence: Math.min(1, Math.abs(weight)),
|
|
13412
|
+
rationale: input.rationale ?? input.context,
|
|
13413
|
+
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
13414
|
+
}),
|
|
13415
|
+
context
|
|
13416
|
+
);
|
|
13417
|
+
};
|
|
13216
13418
|
var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
|
|
13217
13419
|
compactRecord4({
|
|
13218
13420
|
fromNodeId: input.insightId ?? input.evidenceNodeId ?? input.evidenceId,
|
|
@@ -13223,7 +13425,7 @@ var linkEvidenceToBeliefEdgeInput = (input, context) => withCreatedBy(
|
|
|
13223
13425
|
)}:${String(
|
|
13224
13426
|
input.beliefNodeId ?? input.beliefId ?? input.targetId
|
|
13225
13427
|
)}:informs`,
|
|
13226
|
-
weight:
|
|
13428
|
+
weight: relationWeight(input),
|
|
13227
13429
|
context: input.rationale ?? input.context,
|
|
13228
13430
|
skipLayerValidation: true,
|
|
13229
13431
|
topicId: input.topicId,
|
|
@@ -13355,10 +13557,10 @@ var evidenceContracts = [
|
|
|
13355
13557
|
sdkMethod: "linkEvidenceToBelief",
|
|
13356
13558
|
summary: "Link evidence to a belief.",
|
|
13357
13559
|
convex: {
|
|
13358
|
-
module: "
|
|
13359
|
-
functionName: "
|
|
13560
|
+
module: "beliefs",
|
|
13561
|
+
functionName: "linkEvidence",
|
|
13360
13562
|
kind: "mutation",
|
|
13361
|
-
inputProjection:
|
|
13563
|
+
inputProjection: linkEvidenceToBeliefInput
|
|
13362
13564
|
}
|
|
13363
13565
|
}),
|
|
13364
13566
|
surfaceContract({
|