@lucern/contracts 1.0.16 → 1.0.17
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/CHANGELOG.md +3 -0
- package/dist/api-enums.contract.d.ts +2 -2
- package/dist/api-enums.contract.js +2 -8
- package/dist/api-enums.contract.js.map +1 -1
- package/dist/context-pack.contract.d.ts +27 -7
- package/dist/context-pack.contract.js.map +1 -1
- package/dist/function-registry/beliefs.js +109 -115
- package/dist/function-registry/beliefs.js.map +1 -1
- package/dist/function-registry/coding.js +68 -91
- package/dist/function-registry/coding.js.map +1 -1
- package/dist/function-registry/context.js +68 -91
- package/dist/function-registry/context.js.map +1 -1
- package/dist/function-registry/contracts.js +68 -91
- package/dist/function-registry/contracts.js.map +1 -1
- package/dist/function-registry/coordination.js +68 -91
- package/dist/function-registry/coordination.js.map +1 -1
- package/dist/function-registry/edges.js +68 -91
- package/dist/function-registry/edges.js.map +1 -1
- package/dist/function-registry/evidence.js +182 -125
- package/dist/function-registry/evidence.js.map +1 -1
- package/dist/function-registry/graph.js +68 -91
- package/dist/function-registry/graph.js.map +1 -1
- package/dist/function-registry/helpers.js +68 -91
- package/dist/function-registry/helpers.js.map +1 -1
- package/dist/function-registry/identity.js +68 -91
- package/dist/function-registry/identity.js.map +1 -1
- package/dist/function-registry/index.js +68 -91
- package/dist/function-registry/index.js.map +1 -1
- package/dist/function-registry/judgments.js +68 -91
- package/dist/function-registry/judgments.js.map +1 -1
- package/dist/function-registry/legacy.js +68 -91
- package/dist/function-registry/legacy.js.map +1 -1
- package/dist/function-registry/lenses.js +68 -91
- package/dist/function-registry/lenses.js.map +1 -1
- package/dist/function-registry/manifest.d.ts +3 -3
- package/dist/function-registry/manifest.js +3 -3
- package/dist/function-registry/manifest.js.map +1 -1
- package/dist/function-registry/nodes.js +68 -91
- package/dist/function-registry/nodes.js.map +1 -1
- package/dist/function-registry/ontologies.js +68 -91
- package/dist/function-registry/ontologies.js.map +1 -1
- package/dist/function-registry/pipeline.js +68 -91
- package/dist/function-registry/pipeline.js.map +1 -1
- package/dist/function-registry/questions.js +68 -91
- package/dist/function-registry/questions.js.map +1 -1
- package/dist/function-registry/tasks.js +68 -91
- package/dist/function-registry/tasks.js.map +1 -1
- package/dist/function-registry/topics.js +68 -91
- package/dist/function-registry/topics.js.map +1 -1
- package/dist/function-registry/worktrees.js +68 -91
- package/dist/function-registry/worktrees.js.map +1 -1
- package/dist/generated/convexSchemas.js +2 -2
- package/dist/generated/convexSchemas.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +162 -130
- package/dist/index.js.map +1 -1
- package/dist/manifests/invariant-manifest.d.ts +1 -1
- package/dist/manifests/invariants/index.d.ts +1 -1
- package/dist/manifests/invariants/index.js +1 -1
- package/dist/manifests/invariants/index.js.map +1 -1
- package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +1 -1
- package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +1 -1
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +1 -1
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +1 -1
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -1
- package/dist/projections/{modulate-confidence.projection.d.ts → append-sl-scoring.projection.d.ts} +69 -69
- package/dist/projections/{modulate-confidence.projection.js → append-sl-scoring.projection.js} +14 -14
- package/dist/projections/append-sl-scoring.projection.js.map +1 -0
- package/dist/projections/check-convex-args-shape.js +88 -29
- package/dist/projections/check-convex-args-shape.js.map +1 -1
- package/dist/projections/create-evidence.projection.js +76 -17
- package/dist/projections/create-evidence.projection.js.map +1 -1
- package/dist/projections/index.d.ts +47 -47
- package/dist/projections/index.js +88 -29
- package/dist/projections/index.js.map +1 -1
- package/dist/proof-attestation.json +3 -3
- package/dist/schemas/index.js +6 -4
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/manifest.d.ts +110 -60
- package/dist/schemas/manifest.js +6 -4
- package/dist/schemas/manifest.js.map +1 -1
- package/dist/schemas/tables/kernel/intelligence.d.ts +20 -10
- package/dist/schemas/tables/kernel/intelligence.js +4 -2
- package/dist/schemas/tables/kernel/intelligence.js.map +1 -1
- package/dist/schemas/tables/kernel/spine.d.ts +2 -2
- package/dist/schemas/tables/kernel/spine.js +2 -2
- package/dist/schemas/tables/kernel/spine.js.map +1 -1
- package/dist/schemas.values.js +6 -4
- package/dist/schemas.values.js.map +1 -1
- package/dist/sdk-methods.contract.d.ts +6 -16
- package/dist/sdk-tools.contract.js +65 -88
- package/dist/sdk-tools.contract.js.map +1 -1
- package/dist/sdk-tools.contract.registry.js +65 -88
- package/dist/sdk-tools.contract.registry.js.map +1 -1
- package/dist/sdk-tools.contract.values.js +65 -88
- package/dist/sdk-tools.contract.values.js.map +1 -1
- package/dist/tool-contracts.d.ts +1 -1
- package/dist/tool-contracts.graph.js +3 -3
- package/dist/tool-contracts.graph.js.map +1 -1
- package/dist/tool-contracts.intelligence-evidence.js +7 -7
- package/dist/tool-contracts.intelligence-evidence.js.map +1 -1
- package/dist/tool-contracts.js +66 -89
- package/dist/tool-contracts.js.map +1 -1
- package/dist/tool-contracts.lifecycle.d.ts +2 -2
- package/dist/tool-contracts.lifecycle.js +49 -68
- package/dist/tool-contracts.lifecycle.js.map +1 -1
- package/dist/tool-contracts.pipeline-coordination.js +1 -1
- package/dist/tool-contracts.pipeline-coordination.js.map +1 -1
- package/dist/tool-contracts.questions-listing.js +5 -9
- package/dist/tool-contracts.questions-listing.js.map +1 -1
- package/dist/{tool-contracts.values-BhxfrXS5.d.ts → tool-contracts.values-CCoI3qQY.d.ts} +3 -3
- package/dist/tool-contracts.values.d.ts +1 -1
- package/dist/tool-contracts.values.js +66 -89
- package/dist/tool-contracts.values.js.map +1 -1
- package/package.json +1 -1
- package/dist/projections/modulate-confidence.projection.js.map +0 -1
|
@@ -6,15 +6,23 @@ import { v } from 'convex/values';
|
|
|
6
6
|
// src/tool-contracts.lifecycle.ts
|
|
7
7
|
var CREATE_BELIEF = {
|
|
8
8
|
name: "create_belief",
|
|
9
|
-
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.",
|
|
9
|
+
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 requires a topic epistemic-node anchor and writes a `scoped_by` edge directly from belief node to topic node; orphan beliefs are invalid. 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.",
|
|
10
10
|
parameters: {
|
|
11
11
|
canonicalText: {
|
|
12
12
|
type: "string",
|
|
13
13
|
description: "The belief statement \u2014 what the agent holds to be true"
|
|
14
14
|
},
|
|
15
|
+
topicGlobalId: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Required globalId (UUID) of the topic node in epistemicNodes that anchors the belief"
|
|
18
|
+
},
|
|
19
|
+
topicNodeId: {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "Optional internal epistemicNodes _id for the topic anchor. Prefer topicGlobalId for public callers."
|
|
22
|
+
},
|
|
15
23
|
topicId: {
|
|
16
24
|
type: "string",
|
|
17
|
-
description: "
|
|
25
|
+
description: "Deprecated compatibility alias for topicGlobalId. Must identify a topic epistemicNode, not a legacy topics-table row."
|
|
18
26
|
},
|
|
19
27
|
baseRate: {
|
|
20
28
|
type: "number",
|
|
@@ -29,7 +37,7 @@ var CREATE_BELIEF = {
|
|
|
29
37
|
description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
|
|
30
38
|
}
|
|
31
39
|
},
|
|
32
|
-
required: ["canonicalText"],
|
|
40
|
+
required: ["canonicalText", "topicGlobalId"],
|
|
33
41
|
response: {
|
|
34
42
|
description: "The created canonical belief record",
|
|
35
43
|
fields: {
|
|
@@ -38,7 +46,7 @@ var CREATE_BELIEF = {
|
|
|
38
46
|
beliefId: "string \u2014 canonical belief ID",
|
|
39
47
|
text: "string \u2014 canonical belief formulation",
|
|
40
48
|
topicId: "string",
|
|
41
|
-
|
|
49
|
+
beliefStatus: "string \u2014 assumption | hypothesis | active | superseded | resolved_true | resolved_false",
|
|
42
50
|
scoringState: "string \u2014 unscored | scored"
|
|
43
51
|
}
|
|
44
52
|
},
|
|
@@ -61,7 +69,7 @@ var GET_BELIEF = {
|
|
|
61
69
|
beliefId: "string \u2014 canonical belief ID",
|
|
62
70
|
text: "string \u2014 canonical belief formulation",
|
|
63
71
|
topicId: "string",
|
|
64
|
-
|
|
72
|
+
beliefStatus: "string \u2014 assumption | hypothesis | active | superseded | resolved_true | resolved_false",
|
|
65
73
|
scoringState: "string \u2014 unscored | scored"
|
|
66
74
|
}
|
|
67
75
|
},
|
|
@@ -90,34 +98,24 @@ var REFINE_BELIEF = {
|
|
|
90
98
|
ontologyPrimitive: "belief",
|
|
91
99
|
tier: "showcase"
|
|
92
100
|
};
|
|
93
|
-
var
|
|
94
|
-
name: "
|
|
95
|
-
description: "Internal
|
|
101
|
+
var APPEND_SL_SCORING = {
|
|
102
|
+
name: "append_sl_scoring",
|
|
103
|
+
description: "Internal evidence-backed Subjective Logic scoring append. This is not a public MCP tool: callers should attach supporting or contradicting evidence, and governed system paths append the derived SL tuple.",
|
|
96
104
|
parameters: {
|
|
97
|
-
nodeId: { type: "string", description: "The belief
|
|
98
|
-
belief: {
|
|
99
|
-
type: "number",
|
|
100
|
-
description: "Subjective-logic belief mass `b` in [0, 1]"
|
|
101
|
-
},
|
|
105
|
+
nodeId: { type: "string", description: "The belief receiving the SL score" },
|
|
106
|
+
belief: { type: "number", description: "Subjective Logic belief mass b" },
|
|
102
107
|
disbelief: {
|
|
103
108
|
type: "number",
|
|
104
|
-
description: "Subjective
|
|
109
|
+
description: "Subjective Logic disbelief mass d"
|
|
105
110
|
},
|
|
106
111
|
uncertainty: {
|
|
107
112
|
type: "number",
|
|
108
|
-
description: "Subjective
|
|
109
|
-
},
|
|
110
|
-
baseRate: {
|
|
111
|
-
type: "number",
|
|
112
|
-
description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
|
|
113
|
-
},
|
|
114
|
-
worktreeId: {
|
|
115
|
-
type: "string",
|
|
116
|
-
description: "Completed worktree that tested this belief when confidence policy requires merge-backed scoring."
|
|
113
|
+
description: "Subjective Logic uncertainty mass u"
|
|
117
114
|
},
|
|
115
|
+
baseRate: { type: "number", description: "Subjective Logic base rate a" },
|
|
118
116
|
trigger: {
|
|
119
117
|
type: "string",
|
|
120
|
-
description: "
|
|
118
|
+
description: "Evidence-bearing cause of the scoring event",
|
|
121
119
|
enum: [
|
|
122
120
|
"evidence_added",
|
|
123
121
|
"evidence_removed",
|
|
@@ -128,64 +126,39 @@ var MODULATE_CONFIDENCE = {
|
|
|
128
126
|
"worktree_completed",
|
|
129
127
|
"fusion",
|
|
130
128
|
"discount",
|
|
131
|
-
"deduction"
|
|
129
|
+
"deduction",
|
|
130
|
+
"backfill_synthetic"
|
|
132
131
|
]
|
|
133
132
|
},
|
|
134
|
-
|
|
135
|
-
type: "
|
|
136
|
-
description: "
|
|
137
|
-
},
|
|
138
|
-
triggeringQuestionId: {
|
|
139
|
-
type: "string",
|
|
140
|
-
description: "Answered question whose resolution supports this modulation"
|
|
141
|
-
},
|
|
142
|
-
triggeringAnswerId: {
|
|
143
|
-
type: "string",
|
|
144
|
-
description: "Answer node whose content supports this modulation"
|
|
145
|
-
},
|
|
146
|
-
triggeringContradictionId: {
|
|
147
|
-
type: "string",
|
|
148
|
-
description: "Contradiction record that caused a contradiction-triggered modulation"
|
|
149
|
-
},
|
|
150
|
-
triggeringWorktreeId: {
|
|
151
|
-
type: "string",
|
|
152
|
-
description: "Completed worktree whose outcome caused a worktree-triggered modulation"
|
|
133
|
+
provenance: {
|
|
134
|
+
type: "object",
|
|
135
|
+
description: "At least one of evidence, question, answer, contradiction, or worktree."
|
|
153
136
|
},
|
|
154
137
|
rationale: {
|
|
155
138
|
type: "string",
|
|
156
|
-
description: "
|
|
139
|
+
description: "Why this evidence-bearing event moved the SL tuple"
|
|
157
140
|
}
|
|
158
141
|
},
|
|
159
|
-
required: [
|
|
160
|
-
"nodeId",
|
|
161
|
-
"belief",
|
|
162
|
-
"disbelief",
|
|
163
|
-
"uncertainty",
|
|
164
|
-
"baseRate",
|
|
165
|
-
"trigger",
|
|
166
|
-
"rationale"
|
|
167
|
-
],
|
|
142
|
+
required: ["nodeId", "belief", "disbelief", "uncertainty", "baseRate", "trigger", "rationale"],
|
|
168
143
|
response: {
|
|
169
|
-
description: "
|
|
144
|
+
description: "Internal SL scoring append receipt",
|
|
170
145
|
fields: {
|
|
171
|
-
|
|
172
|
-
nodeId: "string \u2014 canonical belief ID",
|
|
173
|
-
newConfidence: "number",
|
|
146
|
+
nodeId: "string",
|
|
174
147
|
previousConfidence: "number",
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
propagationSummary: "object \u2014 bounded inline cascade summary with totalCandidateTargets, inlineTargets, and remainingTargetCount"
|
|
148
|
+
newConfidence: "number",
|
|
149
|
+
beliefConfidenceId: "string"
|
|
178
150
|
}
|
|
179
151
|
},
|
|
180
152
|
ownerModule: "graph-primitives",
|
|
181
153
|
ontologyPrimitive: "belief",
|
|
182
|
-
tier: "
|
|
154
|
+
tier: "workhorse",
|
|
155
|
+
internal: true
|
|
183
156
|
};
|
|
184
157
|
var FORK_BELIEF = {
|
|
185
158
|
name: "fork_belief",
|
|
186
|
-
description: "Branch off
|
|
159
|
+
description: "Branch off an evidence-bearing belief to create a new formulation. Like `git fork` \u2014 the parent remains immutable with full history, and every fork must cite evidence already attached to the parent through SL scoring. `forkMode=supersede` marks the parent superseded and requires contradicting evidence; `forkMode=branch` preserves the parent and creates a derived child.",
|
|
187
160
|
parameters: {
|
|
188
|
-
nodeId: { type: "string", description: "The
|
|
161
|
+
nodeId: { type: "string", description: "The belief to fork from" },
|
|
189
162
|
newFormulation: {
|
|
190
163
|
type: "string",
|
|
191
164
|
description: "The evolved belief statement"
|
|
@@ -197,12 +170,20 @@ var FORK_BELIEF = {
|
|
|
197
170
|
"refinement",
|
|
198
171
|
"contradiction_response",
|
|
199
172
|
"scope_change",
|
|
200
|
-
"confidence_collapse"
|
|
201
|
-
"manual"
|
|
173
|
+
"confidence_collapse"
|
|
202
174
|
]
|
|
175
|
+
},
|
|
176
|
+
forkMode: {
|
|
177
|
+
type: "string",
|
|
178
|
+
description: "supersede replaces the parent; branch creates a child while preserving the parent.",
|
|
179
|
+
enum: ["supersede", "branch"]
|
|
180
|
+
},
|
|
181
|
+
triggeringEvidenceId: {
|
|
182
|
+
type: "string",
|
|
183
|
+
description: "Evidence already attached to the parent belief that caused the fork."
|
|
203
184
|
}
|
|
204
185
|
},
|
|
205
|
-
required: ["nodeId", "newFormulation", "forkReason"],
|
|
186
|
+
required: ["nodeId", "newFormulation", "forkReason", "triggeringEvidenceId"],
|
|
206
187
|
response: {
|
|
207
188
|
description: "The forked canonical belief record",
|
|
208
189
|
fields: {
|
|
@@ -704,7 +685,7 @@ var REASONING_METHODS = [
|
|
|
704
685
|
// src/tool-contracts.graph.ts
|
|
705
686
|
var QUERY_LINEAGE = {
|
|
706
687
|
name: "query_lineage",
|
|
707
|
-
description: "Trace a belief's full ancestry \u2014 every fork, score, and
|
|
688
|
+
description: "Trace a belief's full ancestry \u2014 every fork, score, and SL scoring event. Like `git log --graph`. Returns the complete evolution chain showing how understanding developed over time. Lineage is permanent and can never be erased (Invariant #3).",
|
|
708
689
|
parameters: {
|
|
709
690
|
nodeId: { type: "string", description: "Starting node to trace from" },
|
|
710
691
|
depth: {
|
|
@@ -903,7 +884,7 @@ var FIND_CONTRADICTIONS = {
|
|
|
903
884
|
};
|
|
904
885
|
var BISECT_CONFIDENCE = {
|
|
905
886
|
name: "bisect_confidence",
|
|
906
|
-
description: "Find when a belief's confidence diverged from reality. Like `git bisect` \u2014 binary search through the credence history to find the inflection point. Given a belief that is now known to be wrong (or right), traces back through
|
|
887
|
+
description: "Find when a belief's confidence diverged from reality. Like `git bisect` \u2014 binary search through the credence history to find the inflection point. Given a belief that is now known to be wrong (or right), traces back through SL scoring events to identify which evidence or event caused the divergence.",
|
|
907
888
|
parameters: {
|
|
908
889
|
nodeId: { type: "string", description: "The belief to bisect" },
|
|
909
890
|
expectedDirection: {
|
|
@@ -922,7 +903,7 @@ var BISECT_CONFIDENCE = {
|
|
|
922
903
|
fields: {
|
|
923
904
|
beliefId: "string \u2014 canonical belief ID",
|
|
924
905
|
expectedDirection: "string \u2014 overconfident | underconfident",
|
|
925
|
-
inflectionEntry: "object \u2014 the
|
|
906
|
+
inflectionEntry: "object \u2014 the scoring event where divergence began",
|
|
926
907
|
triggerEvent: "string | null \u2014 what caused the divergence",
|
|
927
908
|
confidenceBefore: "number | null",
|
|
928
909
|
confidenceAfter: "number | null",
|
|
@@ -1867,18 +1848,18 @@ var SEARCH_EVIDENCE = {
|
|
|
1867
1848
|
};
|
|
1868
1849
|
var CREATE_EVIDENCE = {
|
|
1869
1850
|
name: "create_evidence",
|
|
1870
|
-
description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs.
|
|
1851
|
+
description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs. Evidence creation must link to at least one belief and must include a signed impact score. Positive scores support the belief; negative scores contradict it. SL confidence is derived from these weighted evidence relations.",
|
|
1871
1852
|
parameters: {
|
|
1872
1853
|
topicId: { type: "string", description: "Topic scope" },
|
|
1873
1854
|
text: { type: "string", description: "Canonical evidence text" },
|
|
1874
1855
|
source: { type: "string", description: "Source URL or source label" },
|
|
1875
1856
|
targetId: {
|
|
1876
1857
|
type: "string",
|
|
1877
|
-
description: "
|
|
1858
|
+
description: "Belief identifier to link immediately"
|
|
1878
1859
|
},
|
|
1879
1860
|
weight: {
|
|
1880
1861
|
type: "number",
|
|
1881
|
-
description: "
|
|
1862
|
+
description: "Required nonzero signed impact score: -1.0 (contradicts) to +1.0 (supports)."
|
|
1882
1863
|
},
|
|
1883
1864
|
evidenceRelation: {
|
|
1884
1865
|
type: "string",
|
|
@@ -1887,7 +1868,7 @@ var CREATE_EVIDENCE = {
|
|
|
1887
1868
|
},
|
|
1888
1869
|
confidence: {
|
|
1889
1870
|
type: "number",
|
|
1890
|
-
description: "
|
|
1871
|
+
description: "Deprecated hint. Runtime confidence is derived from the signed impact score."
|
|
1891
1872
|
},
|
|
1892
1873
|
beliefRelations: {
|
|
1893
1874
|
type: "array",
|
|
@@ -1909,7 +1890,7 @@ var CREATE_EVIDENCE = {
|
|
|
1909
1890
|
},
|
|
1910
1891
|
kind: { type: "string", description: "Optional evidence kind" }
|
|
1911
1892
|
},
|
|
1912
|
-
required: ["text", "rationale"],
|
|
1893
|
+
required: ["text", "rationale", "weight"],
|
|
1913
1894
|
response: {
|
|
1914
1895
|
description: "The created canonical evidence record",
|
|
1915
1896
|
fields: {
|
|
@@ -1984,7 +1965,7 @@ var LINK_EVIDENCE = {
|
|
|
1984
1965
|
},
|
|
1985
1966
|
rationale: { type: "string", description: "Why this link exists" }
|
|
1986
1967
|
},
|
|
1987
|
-
required: ["evidenceId", "targetId"],
|
|
1968
|
+
required: ["evidenceId", "targetId", "weight"],
|
|
1988
1969
|
response: {
|
|
1989
1970
|
description: "The created canonical evidence edge summary",
|
|
1990
1971
|
fields: {
|
|
@@ -2020,7 +2001,7 @@ var LINK_EVIDENCE_TO_BELIEF = {
|
|
|
2020
2001
|
},
|
|
2021
2002
|
rationale: { type: "string", description: "Why this evidence is relevant" }
|
|
2022
2003
|
},
|
|
2023
|
-
required: ["evidenceId", "beliefId"],
|
|
2004
|
+
required: ["evidenceId", "beliefId", "weight"],
|
|
2024
2005
|
response: {
|
|
2025
2006
|
description: "The created edge linking evidence to belief",
|
|
2026
2007
|
fields: {
|
|
@@ -2839,6 +2820,11 @@ var COMPILE_CONTEXT = {
|
|
|
2839
2820
|
response: {
|
|
2840
2821
|
description: "Compiled context pack for the requested topic",
|
|
2841
2822
|
fields: {
|
|
2823
|
+
contextNarrative: "array \u2014 first field; ordered synthesis blocks with kind/text, starting with executive_summary and canonical narrative blocks before raw objects",
|
|
2824
|
+
narrativeCoverage: "object \u2014 recordsSynthesized, recordsNamed, recordsOmitted, topicsSynthesized, topicsEnriched, topicContentOmitted, enrichmentMode, and blocksEmitted for the narrative",
|
|
2825
|
+
synthesisLints: "array \u2014 inline quality warnings for degenerate synthesis blocks or weak narrative coverage",
|
|
2826
|
+
retrievalReceipt: "object \u2014 candidateCounts, coverageWarning, narrativeCoverage, synthesisLints, and suggestedNextActions",
|
|
2827
|
+
supportingObjects: "object \u2014 raw graph records grouped behind the synthesis: invariants, activeBeliefs, openQuestions, recentEvidence, worktrees, lanes, entities, and contradictions",
|
|
2842
2828
|
schemaVersion: "string",
|
|
2843
2829
|
topicId: "string",
|
|
2844
2830
|
topicName: "string",
|
|
@@ -2846,15 +2832,6 @@ var COMPILE_CONTEXT = {
|
|
|
2846
2832
|
generatedAt: "number \u2014 deterministic graph-backed reference timestamp for this compilation",
|
|
2847
2833
|
ranking: "string \u2014 baseline_v1 | weighted_v1",
|
|
2848
2834
|
summary: "object \u2014 counts and scoped health signals",
|
|
2849
|
-
invariants: "array \u2014 high-confidence invariant beliefs",
|
|
2850
|
-
activeBeliefs: "array \u2014 current high-signal beliefs",
|
|
2851
|
-
openQuestions: "array \u2014 unresolved questions ranked for this query",
|
|
2852
|
-
recentEvidence: "array \u2014 recent evidence ranked for this query",
|
|
2853
|
-
contradictions: "array \u2014 unresolved contradiction records",
|
|
2854
|
-
relatedEntities: "array | undefined \u2014 ranked ontological entities in scope",
|
|
2855
|
-
contextNarrative: "array \u2014 ordered synthesis blocks with kind/text, starting with executive_summary and canonical narrative blocks before raw objects",
|
|
2856
|
-
retrievalReceipt: "object \u2014 candidateCounts, coverageWarning, narrativeCoverage, synthesisLints, and suggestedNextActions",
|
|
2857
|
-
narrativeCoverage: "object \u2014 recordsSynthesized, recordsNamed, recordsOmitted, topicsSynthesized, topicsEnriched, topicContentOmitted, enrichmentMode, and blocksEmitted for the narrative",
|
|
2858
2835
|
injectionPolicy: "object \u2014 token-budgeted section selections",
|
|
2859
2836
|
diagnostics: "object \u2014 scoring and utilization telemetry"
|
|
2860
2837
|
}
|
|
@@ -4273,7 +4250,7 @@ var TRIGGER_BELIEF_REVIEW = {
|
|
|
4273
4250
|
};
|
|
4274
4251
|
var EVALUATE_CONTRACT = {
|
|
4275
4252
|
name: "evaluate_contract",
|
|
4276
|
-
description: "Run a contract evaluation and record the append-only result. Like `git test` for a belief binding \u2014 executes the evaluator, logs the result, and applies any allowed
|
|
4253
|
+
description: "Run a contract evaluation and record the append-only result. Like `git test` for a belief binding \u2014 executes the evaluator, logs the result, and applies any allowed SL scoring action.",
|
|
4277
4254
|
parameters: {
|
|
4278
4255
|
contractId: { type: "string", description: "Which contract to evaluate" },
|
|
4279
4256
|
trigger: {
|
|
@@ -4629,7 +4606,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
4629
4606
|
create_belief: CREATE_BELIEF,
|
|
4630
4607
|
get_belief: GET_BELIEF,
|
|
4631
4608
|
refine_belief: REFINE_BELIEF,
|
|
4632
|
-
|
|
4609
|
+
append_sl_scoring: APPEND_SL_SCORING,
|
|
4633
4610
|
fork_belief: FORK_BELIEF,
|
|
4634
4611
|
archive_belief: ARCHIVE_BELIEF,
|
|
4635
4612
|
create_epistemic_contract: CREATE_EPISTEMIC_CONTRACT,
|
|
@@ -5124,12 +5101,12 @@ var LUCERN_OPERATION_MANIFEST = {
|
|
|
5124
5101
|
internalSystem,
|
|
5125
5102
|
"Lucern system/background operation. Available to platform code paths, hidden from public MCP discovery."
|
|
5126
5103
|
),
|
|
5127
|
-
|
|
5128
|
-
name: "
|
|
5104
|
+
append_sl_scoring: {
|
|
5105
|
+
name: "append_sl_scoring",
|
|
5129
5106
|
surfaceClass: "platform_internal",
|
|
5130
5107
|
surfaceIntent: "system",
|
|
5131
5108
|
surfaces: internalSdkRestOnly,
|
|
5132
|
-
rationale: "Internal SL
|
|
5109
|
+
rationale: "Internal SL scoring append primitive. Public callers attach evidence or contradiction relations; confidence is derived algorithmically."
|
|
5133
5110
|
},
|
|
5134
5111
|
...entries(
|
|
5135
5112
|
LEGACY_COMPAT_OPERATION_NAMES,
|
|
@@ -5512,7 +5489,7 @@ var slOpinionProjectionSchema = z.object({
|
|
|
5512
5489
|
uncertainty: z.number(),
|
|
5513
5490
|
baseRate: z.number()
|
|
5514
5491
|
});
|
|
5515
|
-
var
|
|
5492
|
+
var appendSlScoringInputObjectSchema = z.object({
|
|
5516
5493
|
nodeId: z.string().optional(),
|
|
5517
5494
|
beliefNodeId: z.string().optional(),
|
|
5518
5495
|
worktreeId: z.string().optional(),
|
|
@@ -5531,23 +5508,23 @@ var modulateConfidenceInputObjectSchema = z.object({
|
|
|
5531
5508
|
rationale: z.string(),
|
|
5532
5509
|
trustedBypassAccessCheck: z.boolean().optional()
|
|
5533
5510
|
});
|
|
5534
|
-
var
|
|
5511
|
+
var appendSlScoringInputSchema = appendSlScoringInputObjectSchema.superRefine((input, ctx) => {
|
|
5535
5512
|
if (hasProvenance(input)) {
|
|
5536
5513
|
return;
|
|
5537
5514
|
}
|
|
5538
5515
|
ctx.addIssue({
|
|
5539
5516
|
code: z.ZodIssueCode.custom,
|
|
5540
|
-
message: "
|
|
5517
|
+
message: "append_sl_scoring requires evidence, question, answer, contradiction, or worktree provenance",
|
|
5541
5518
|
path: ["provenance"]
|
|
5542
5519
|
});
|
|
5543
5520
|
});
|
|
5544
|
-
var
|
|
5545
|
-
contractName: "
|
|
5546
|
-
inputSchema:
|
|
5521
|
+
var appendSlScoringProjection = defineProjection({
|
|
5522
|
+
contractName: "append_sl_scoring",
|
|
5523
|
+
inputSchema: appendSlScoringInputSchema,
|
|
5547
5524
|
project: (input) => {
|
|
5548
5525
|
const nodeId = input.beliefNodeId ?? input.nodeId;
|
|
5549
5526
|
if (!nodeId) {
|
|
5550
|
-
throw new Error("
|
|
5527
|
+
throw new Error("append_sl_scoring requires beliefNodeId or nodeId");
|
|
5551
5528
|
}
|
|
5552
5529
|
const opinion = input.opinion ?? {
|
|
5553
5530
|
belief: requireNumber(input.belief, "belief"),
|
|
@@ -5604,14 +5581,14 @@ var modulateConfidenceProjection = defineProjection({
|
|
|
5604
5581
|
});
|
|
5605
5582
|
function requireNumber(value, field) {
|
|
5606
5583
|
if (value === void 0) {
|
|
5607
|
-
throw new Error(`
|
|
5584
|
+
throw new Error(`append_sl_scoring requires ${field}`);
|
|
5608
5585
|
}
|
|
5609
5586
|
return value;
|
|
5610
5587
|
}
|
|
5611
5588
|
function assertProvenance(input) {
|
|
5612
5589
|
if (!hasProvenance(input)) {
|
|
5613
5590
|
throw new Error(
|
|
5614
|
-
"
|
|
5591
|
+
"append_sl_scoring requires evidence, question, answer, contradiction, or worktree provenance"
|
|
5615
5592
|
);
|
|
5616
5593
|
}
|
|
5617
5594
|
}
|
|
@@ -5635,7 +5612,15 @@ var predictionMetaSchema = z.object({
|
|
|
5635
5612
|
});
|
|
5636
5613
|
var createBeliefArgs = z.object({
|
|
5637
5614
|
canonicalText: z.string().describe("The belief statement the agent holds to be true."),
|
|
5638
|
-
|
|
5615
|
+
topicGlobalId: z.string().describe(
|
|
5616
|
+
"Required globalId of the topic epistemicNode that anchors this belief. Belief creation creates a scoped_by edge directly to that topic node."
|
|
5617
|
+
),
|
|
5618
|
+
topicNodeId: z.string().optional().describe(
|
|
5619
|
+
"Optional internal epistemicNodes _id for the topic anchor. Prefer topicGlobalId for public callers."
|
|
5620
|
+
),
|
|
5621
|
+
topicId: z.string().optional().describe(
|
|
5622
|
+
"Deprecated compatibility alias for topicGlobalId. Must identify a topic epistemicNode, not a legacy topics-table row."
|
|
5623
|
+
),
|
|
5639
5624
|
baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
|
|
5640
5625
|
beliefType: z.string().optional().describe("Schema belief type."),
|
|
5641
5626
|
metadata: jsonRecordSchema.optional().describe("Extra metadata merged into the belief node."),
|
|
@@ -5654,9 +5639,14 @@ var forkBeliefArgs = z.object({
|
|
|
5654
5639
|
"refinement",
|
|
5655
5640
|
"contradiction_response",
|
|
5656
5641
|
"scope_change",
|
|
5657
|
-
"confidence_collapse"
|
|
5658
|
-
"manual"
|
|
5642
|
+
"confidence_collapse"
|
|
5659
5643
|
]).describe("Why this fork was created."),
|
|
5644
|
+
forkMode: z.enum(["supersede", "branch"]).optional().describe(
|
|
5645
|
+
"supersede marks the parent belief superseded; branch preserves the parent and creates a derived child."
|
|
5646
|
+
),
|
|
5647
|
+
triggeringEvidenceId: z.string().describe(
|
|
5648
|
+
"Evidence already attached to the parent belief through SL scoring; required for every fork."
|
|
5649
|
+
),
|
|
5660
5650
|
rationale: z.string().optional().describe("Why the fork is warranted.")
|
|
5661
5651
|
});
|
|
5662
5652
|
var beliefLookupInput = (input) => compactRecord({
|
|
@@ -5670,7 +5660,9 @@ var createBeliefInput = (input, context) => {
|
|
|
5670
5660
|
return withUserId(
|
|
5671
5661
|
compactRecord({
|
|
5672
5662
|
projectId: input.projectId,
|
|
5673
|
-
topicId: input.topicId,
|
|
5663
|
+
topicId: input.topicGlobalId ?? input.topicNodeId ?? input.topicId,
|
|
5664
|
+
topicGlobalId: input.topicGlobalId,
|
|
5665
|
+
topicNodeId: input.topicNodeId,
|
|
5674
5666
|
formulation: input.formulation ?? input.canonicalText,
|
|
5675
5667
|
beliefType: input.beliefType,
|
|
5676
5668
|
rationale: input.rationale,
|
|
@@ -5692,20 +5684,22 @@ var forkBeliefInput = (input, context) => withUserId(
|
|
|
5692
5684
|
parentNodeId: input.parentNodeId ?? input.nodeId ?? input.id,
|
|
5693
5685
|
newFormulation: input.newFormulation,
|
|
5694
5686
|
forkReason: input.forkReason,
|
|
5687
|
+
forkMode: input.forkMode,
|
|
5688
|
+
triggeringEvidenceId: input.triggeringEvidenceId,
|
|
5695
5689
|
rationale: input.rationale,
|
|
5696
5690
|
trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
|
|
5697
5691
|
}),
|
|
5698
5692
|
context
|
|
5699
5693
|
);
|
|
5700
|
-
var
|
|
5701
|
-
const parsed =
|
|
5694
|
+
var appendSlScoringInput = (input, context) => {
|
|
5695
|
+
const parsed = appendSlScoringProjection.inputSchema.safeParse(input);
|
|
5702
5696
|
if (!parsed.success) {
|
|
5703
5697
|
throw new Error(
|
|
5704
|
-
`
|
|
5698
|
+
`append_sl_scoring projection input rejected: ${parsed.error.message}`
|
|
5705
5699
|
);
|
|
5706
5700
|
}
|
|
5707
5701
|
return withUserId(
|
|
5708
|
-
compactRecord(
|
|
5702
|
+
compactRecord(appendSlScoringProjection.project(parsed.data)),
|
|
5709
5703
|
context
|
|
5710
5704
|
);
|
|
5711
5705
|
};
|
|
@@ -5783,21 +5777,21 @@ var beliefsContracts = [
|
|
|
5783
5777
|
}
|
|
5784
5778
|
}),
|
|
5785
5779
|
surfaceContract({
|
|
5786
|
-
name: "
|
|
5780
|
+
name: "append_sl_scoring",
|
|
5787
5781
|
kind: "mutation",
|
|
5788
5782
|
domain: "beliefs",
|
|
5789
5783
|
surfaceClass: "platform_internal",
|
|
5790
|
-
path: "/beliefs/
|
|
5784
|
+
path: "/beliefs/sl-scoring",
|
|
5791
5785
|
sdkNamespace: "beliefs",
|
|
5792
|
-
sdkMethod: "
|
|
5793
|
-
summary: "Internal SL
|
|
5786
|
+
sdkMethod: "appendSlScoring",
|
|
5787
|
+
summary: "Internal SL scoring append. Public callers attach evidence or contradiction relations instead.",
|
|
5794
5788
|
convex: {
|
|
5795
5789
|
module: "beliefs",
|
|
5796
|
-
functionName: "
|
|
5790
|
+
functionName: "appendSlScoring",
|
|
5797
5791
|
kind: "mutation",
|
|
5798
|
-
inputProjection:
|
|
5792
|
+
inputProjection: appendSlScoringInput
|
|
5799
5793
|
},
|
|
5800
|
-
args:
|
|
5794
|
+
args: appendSlScoringInputSchema
|
|
5801
5795
|
}),
|
|
5802
5796
|
surfaceContract({
|
|
5803
5797
|
name: "fork_belief",
|