@lucern/sdk 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 CHANGED
@@ -5,6 +5,9 @@ All notable changes to `@lucern/sdk` will be documented in this file.
5
5
  ## [Unreleased]
6
6
  - No unreleased changes yet.
7
7
 
8
+ ## [1.0.17] - 2026-06-01
9
+ - Release notes pending.
10
+
8
11
  ## [1.0.16] - 2026-06-01
9
12
  - Release notes pending.
10
13
 
@@ -18,7 +21,7 @@ All notable changes to `@lucern/sdk` will be documented in this file.
18
21
  - Exposes the Campaign 1 closeout headless surface: MCP output-schema
19
22
  metadata, richer retrieval receipts, synthesis narrative coverage, and
20
23
  evidence relation fields for supporting or contradicting belief links.
21
- - Deprecates direct public confidence modulation in favor of evidence-backed
24
+ - Deprecates direct public SL scoring in favor of evidence-backed
22
25
  Subjective Logic accumulation.
23
26
 
24
27
  ## [1.0.12] - 2026-05-31
package/README.md CHANGED
@@ -194,49 +194,51 @@ const performanceTopic = await lucern.topics.create({
194
194
  type: "theme",
195
195
  parentTopicId: codeQuality.data.topicId,
196
196
  });
197
+
198
+ const topicGlobalId =
199
+ securityTopic.data.topicGlobalId ?? securityTopic.data.globalId;
200
+ const topicId = topicGlobalId; // Compatibility projection for read/query APIs.
197
201
  ```
198
202
 
199
203
  ### 2. Populate the Graph With What You Know
200
204
 
201
- Beliefs represent understanding at different epistemic levels: facts (verified), beliefs (confident), hypotheses (testing), and assumptions (untested).
205
+ Beliefs move through deterministic lifecycle states: `assumption` when raw, `hypothesis` when testable, `active` once evidence attaches, then `superseded`, `resolved_true`, or `resolved_false` as evidence and time settle the claim.
202
206
 
203
207
  ```typescript
204
- const topicId = securityTopic.data.topicId;
205
-
206
208
  // A fact — verified and anchored
207
209
  const sqlFact = await lucern.beliefs.create({
208
- topicId,
210
+ topicGlobalId,
209
211
  canonicalText: "Parameterized queries prevent SQL injection in all major database drivers",
210
212
  beliefType: "fact",
211
213
  });
212
214
  const sqlFactEvidence = await lucern.evidence.create({
213
- topicId,
215
+ topicId: topicGlobalId,
214
216
  text: "OWASP SQL Injection Prevention guidance identifies parameterized queries as the primary defense.",
215
217
  sourceUrl: "https://owasp.org/www-community/attacks/SQL_Injection",
216
218
  targetId: sqlFact.data.nodeId,
217
219
  evidenceRelation: "supports",
218
- confidence: 0.95,
220
+ weight: 0.95,
219
221
  rationale: "OWASP verified, industry standard for 20+ years",
220
222
  });
221
223
 
222
224
  // A belief — confident from observation
223
225
  const patternBelief = await lucern.beliefs.create({
224
- topicId,
226
+ topicGlobalId,
225
227
  canonicalText: "Most security vulnerabilities in our codebase come from unvalidated user input at API boundaries, not from cryptographic weaknesses",
226
228
  });
227
229
  const patternEvidence = await lucern.evidence.create({
228
- topicId,
230
+ topicId: topicGlobalId,
229
231
  text: "Last 6 months of security audits found 14 input validation issues and 1 cryptographic issue.",
230
232
  sourceUrl: "audit://security/findings-last-6-months",
231
233
  targetId: patternBelief.data.nodeId,
232
234
  evidenceRelation: "supports",
233
- confidence: 0.82,
235
+ weight: 0.82,
234
236
  rationale: "Last 6 months of security audits: 14 input validation issues, 1 crypto issue",
235
237
  });
236
238
 
237
239
  // A hypothesis — under active testing
238
240
  const hypothesis = await lucern.beliefs.create({
239
- topicId,
241
+ topicGlobalId,
240
242
  canonicalText: "Automated static analysis catches fewer than 30% of the input validation vulnerabilities that human reviewers find",
241
243
  beliefType: "hypothesis",
242
244
  });
@@ -245,7 +247,7 @@ const hypothesis = await lucern.beliefs.create({
245
247
 
246
248
  // An assumption — untested but used as a basis for decisions
247
249
  const assumption = await lucern.beliefs.create({
248
- topicId,
250
+ topicGlobalId,
249
251
  canonicalText: "Our CI pipeline runs all static analysis rules on every PR",
250
252
  beliefType: "assumption",
251
253
  });
@@ -365,7 +367,6 @@ await lucern.evidence.linkToBelief({
365
367
  beliefId: hypothesis.data.nodeId,
366
368
  weight: -0.8,
367
369
  evidenceRelation: "contradicts",
368
- confidence: 0.8,
369
370
  rationale: "Static analysis catches 53% overall, not <30%. But the category breakdown reveals something more important.",
370
371
  });
371
372
 
@@ -380,13 +381,12 @@ await lucern.evidence.linkToBelief({
380
381
  beliefId: evolved.data.nodeId,
381
382
  weight: 0.88,
382
383
  evidenceRelation: "supports",
383
- confidence: 0.88,
384
384
  rationale: "Direct comparison data: 0/7 business logic flaws caught, 0/2 race conditions caught, while input validation catch rate was 12/22 (55%)",
385
385
  });
386
386
 
387
387
  // This creates a new actionable belief
388
388
  const actionable = await lucern.beliefs.create({
389
- topicId,
389
+ topicGlobalId,
390
390
  canonicalText: "Human code review should focus on business logic and concurrency — the categories where static analysis provides zero coverage",
391
391
  beliefType: "belief",
392
392
  });
@@ -397,7 +397,7 @@ await lucern.evidence.create({
397
397
  sourceUrl: `worktree://${investigation.data.worktreeId}`,
398
398
  targetId: actionable.data.nodeId,
399
399
  evidenceRelation: "supports",
400
- confidence: 0.85,
400
+ weight: 0.85,
401
401
  rationale: "Direct implication of the comparison study findings",
402
402
  });
403
403
 
@@ -741,7 +741,7 @@ Record what you learned:
741
741
  \`\`\`typescript
742
742
  // Create a belief for decisions made
743
743
  await lucern.beliefs.create({
744
- topicId,
744
+ topicGlobalId,
745
745
  canonicalText: "<what you now believe to be true>",
746
746
  });
747
747
 
@@ -825,18 +825,8 @@ When the investigation is complete, merge findings into the main graph:
825
825
  ```typescript
826
826
  await lucern.worktrees.merge(worktreeId, {
827
827
  summary: "Static analysis catches 53% of vulns overall but has zero coverage for business logic flaws",
828
- outcomes: [
829
- {
830
- beliefId: hypothesis.data.nodeId,
831
- confidence: 0.2,
832
- rationale: "Overall catch rate was 53%, not <30% — but the category breakdown is more important",
833
- },
834
- {
835
- beliefId: evolved.data.nodeId,
836
- confidence: 0.88,
837
- rationale: "Direct comparison data confirms the coverage gap hypothesis at category level",
838
- },
839
- ],
828
+ rationale:
829
+ "Contradicting evidence is attached to the old belief and supporting evidence is attached to the forked belief before merge.",
840
830
  });
841
831
  ```
842
832
 
@@ -21,8 +21,6 @@ export declare function createBeliefsClient(config?: BeliefsClientConfig): {
21
21
  rationale?: string;
22
22
  }, rationale?: string) => any;
23
23
  forkBelief: (nodeId: string, input: import("../clientConfig").BeliefsCompatForkInput) => any;
24
- /** @deprecated Attach supporting or contradicting evidence instead. */
25
- modulateBeliefConfidence(): never;
26
24
  archiveBelief: (nodeId: string, input?: string | {
27
25
  reason?: string;
28
26
  rationale?: string;
@@ -36,9 +34,6 @@ export declare function createBeliefsClient(config?: BeliefsClientConfig): {
36
34
  text: string;
37
35
  rationale?: string;
38
36
  }, rationale?: string): any;
39
- updateConfidence(nodeId: string, input: import("../clientConfig").BeliefsCompatUpdateConfidenceInput): any;
40
- modulateConfidence(nodeId: string, input: import("../clientConfig").BeliefsCompatUpdateConfidenceInput): any;
41
- updateStatus(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
42
37
  updateRationale(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
43
38
  linkBeliefs(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
44
39
  unlinkEvidence(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
@@ -11,10 +11,6 @@ export function createBeliefsClient(config = {}) {
11
11
  searchBeliefs: beliefs.search,
12
12
  refineBelief: beliefs.refine,
13
13
  forkBelief: beliefs.fork,
14
- /** @deprecated Attach supporting or contradicting evidence instead. */
15
- modulateBeliefConfidence() {
16
- throw new Error("Belief confidence is SL-derived. Use lucern.evidence.create(...) or lucern.evidence.linkToBelief(...) with evidenceRelation instead.");
17
- },
18
14
  archiveBelief: beliefs.archive,
19
15
  getBeliefLineage: beliefs.lineage,
20
16
  getBeliefConfidenceHistory: beliefs.confidenceHistory,
@@ -1,9 +1,8 @@
1
1
  import { type GatewayClientConfig, LucernApiError, type PlatformGatewaySuccess } from "./coreClient";
2
- import { type Opinion } from "./opinion";
3
- import type { ForkBeliefResponse, JsonObject, ModulateConfidenceResponse } from "./types";
2
+ import type { ForkBeliefResponse, JsonObject } from "./types";
4
3
  export { LucernApiError };
5
4
  export type { PlatformGatewaySuccess } from "./coreClient";
6
- export type { CreateBeliefResponse, ForkBeliefResponse, ModulateConfidenceResponse, } from "./types";
5
+ export type { CreateBeliefResponse, ForkBeliefResponse, } from "./types";
7
6
  export type { Opinion } from "./opinion";
8
7
  /** Configuration for the beliefs client. Inherits gateway transport settings. */
9
8
  export type BeliefsClientConfig = GatewayClientConfig;
@@ -34,6 +33,11 @@ export declare function mapOpinionHistoryEntriesFromGatewayData(payload: Gateway
34
33
  * `baseRate` defaults to the canonical neutral prior `0.5`.
35
34
  */
36
35
  export type CreateBeliefInput = {
36
+ /** Required topic epistemicNodes globalId. */
37
+ topicGlobalId?: string;
38
+ /** Optional internal epistemicNodes _id for the topic anchor. */
39
+ topicNodeId?: string;
40
+ /** @deprecated Use topicGlobalId. Must identify a topic epistemicNode, not a legacy topics-table row. */
37
41
  topicId?: string;
38
42
  /** Preferred belief statement alias. */
39
43
  text?: string;
@@ -67,43 +71,17 @@ export type RefineBeliefInput = {
67
71
  rationale?: string;
68
72
  title?: string;
69
73
  };
70
- type BeliefConfidenceTrigger = "evidence_added" | "evidence_removed" | "contradiction_detected" | "contradiction_resolved" | "agent_assessment" | "worktree_outcome" | "worktree_completed" | "fusion" | "discount" | "deduction";
71
- type ModulateConfidenceInputBase = {
72
- trigger: BeliefConfidenceTrigger;
73
- rationale: string;
74
- triggeringEvidenceId?: string;
75
- triggeringQuestionId?: string;
76
- triggeringAnswerId?: string;
77
- triggeringContradictionId?: string;
78
- triggeringWorktreeId?: string;
79
- maxInlinePropagationTargets?: number;
80
- };
81
- /**
82
- * @deprecated Public callers should not submit confidence tuples directly.
83
- * Attach supporting or contradicting evidence and let the kernel derive the
84
- * next subjective-logic opinion.
85
- */
86
- export type ModulateConfidenceOpinionInput = ModulateConfidenceInputBase & {
87
- opinion: Opinion;
88
- };
89
- export type ModulateConfidenceInput = ModulateConfidenceOpinionInput;
90
74
  /**
91
- * Input for forking a scored belief into a new formulation.
92
- * Scored beliefs are immutable fork to evolve understanding.
75
+ * Input for forking an evidence-bearing belief into a new formulation.
76
+ * Every fork must cite evidence already attached to the parent through SL.
93
77
  */
94
78
  export type ForkBeliefInput = {
95
79
  newFormulation: string;
96
- forkReason?: "refinement" | "contradiction_response" | "scope_change" | "confidence_collapse" | "manual";
80
+ forkReason: "refinement" | "contradiction_response" | "scope_change" | "confidence_collapse";
81
+ forkMode?: "supersede" | "branch";
82
+ triggeringEvidenceId: string;
97
83
  rationale?: string;
98
84
  };
99
- /** Input for changing a belief's lifecycle status. */
100
- export type UpdateBeliefStatusInput = {
101
- id?: string;
102
- nodeId?: string;
103
- beliefId?: string;
104
- status: "active" | "superseded" | "archived";
105
- reason?: string;
106
- };
107
85
  /** Input for updating a belief's rationale without refining its text. */
108
86
  export type UpdateBeliefRationaleInput = {
109
87
  id?: string;
@@ -168,10 +146,6 @@ export declare function createBeliefsClient(config?: BeliefsClientConfig): {
168
146
  * Refine a draft belief in place.
169
147
  */
170
148
  refineBelief(beliefId: string, input: RefineBeliefInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<import("./types").PlatformBeliefRecord>>;
171
- /**
172
- * Record a confidence change for an existing belief.
173
- */
174
- modulateConfidence: (beliefId: string, input: ModulateConfidenceOpinionInput, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<ModulateConfidenceResponse>>;
175
149
  /**
176
150
  * Returns the belief's confidence trajectory as a chronological array.
177
151
  *
@@ -192,10 +166,6 @@ export declare function createBeliefsClient(config?: BeliefsClientConfig): {
192
166
  * Fork a scored belief into a new formulation.
193
167
  */
194
168
  forkBelief(beliefId: string, input: ForkBeliefInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<ForkBeliefResponse>>;
195
- /**
196
- * Update a belief's lifecycle status.
197
- */
198
- updateBeliefStatus(input: UpdateBeliefStatusInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
199
169
  /**
200
170
  * Update a belief's rationale without changing its text.
201
171
  */
@@ -101,13 +101,6 @@ export function createBeliefsClient(config = {}) {
101
101
  }
102
102
  return normalized;
103
103
  }
104
- /** @deprecated Use evidence.create or evidence.linkToBelief with evidenceRelation. */
105
- const modulateConfidence = async (beliefId, input, idempotencyKey) => {
106
- void beliefId;
107
- void input;
108
- void idempotencyKey;
109
- throw new Error("Belief confidence is SL-derived. Use lucern.evidence.create({ targetId, evidenceRelation: 'supports'|'contradicts', confidence, rationale }) or lucern.evidence.linkToBelief(...) instead.");
110
- };
111
104
  const getOpinionHistory = async (beliefId) => {
112
105
  const response = await gateway.request({
113
106
  path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`,
@@ -141,10 +134,6 @@ export function createBeliefsClient(config = {}) {
141
134
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
142
135
  });
143
136
  },
144
- /**
145
- * Record a confidence change for an existing belief.
146
- */
147
- modulateConfidence,
148
137
  /**
149
138
  * Returns the belief's confidence trajectory as a chronological array.
150
139
  *
@@ -172,17 +161,6 @@ export function createBeliefsClient(config = {}) {
172
161
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
173
162
  });
174
163
  },
175
- /**
176
- * Update a belief's lifecycle status.
177
- */
178
- async updateBeliefStatus(input, idempotencyKey) {
179
- return gateway.request({
180
- path: "/api/platform/v1/beliefs/update-status",
181
- method: "POST",
182
- body: input,
183
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
184
- });
185
- },
186
164
  /**
187
165
  * Update a belief's rationale without changing its text.
188
166
  */
package/dist/client.d.ts CHANGED
@@ -437,9 +437,6 @@ export declare function createLucernClient(config?: LucernClientConfig): {
437
437
  text: string;
438
438
  rationale?: string;
439
439
  }, rationale?: string): any;
440
- updateConfidence(nodeId: string, input: import("./clientConfig").BeliefsCompatUpdateConfidenceInput): any;
441
- modulateConfidence(nodeId: string, input: import("./clientConfig").BeliefsCompatUpdateConfidenceInput): any;
442
- updateStatus(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
443
440
  updateRationale(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
444
441
  linkBeliefs(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
445
442
  unlinkEvidence(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
@@ -2,7 +2,7 @@ import type { AdminClientConfig } from "./adminClient";
2
2
  import type { AnswersClientConfig } from "./answersClient";
3
3
  import type { AudiencesClientConfig } from "./audiencesClient";
4
4
  import type { AuditClientConfig } from "./auditClient";
5
- import type { BeliefsClientConfig, ModulateConfidenceInput } from "./beliefsClient";
5
+ import type { BeliefsClientConfig } from "./beliefsClient";
6
6
  import type { ContextClientConfig } from "./contextClient";
7
7
  import type { ControlPlaneIdentityClientConfig } from "./control-plane";
8
8
  import type { DecisionsClientConfig } from "./decisionsClient";
@@ -58,10 +58,11 @@ export type BeliefsCompatForkInput = {
58
58
  text?: string;
59
59
  newFormulation?: string;
60
60
  formulation?: string;
61
- forkReason?: "refinement" | "contradiction_response" | "scope_change" | "confidence_collapse" | "manual";
61
+ forkReason: "refinement" | "contradiction_response" | "scope_change" | "confidence_collapse";
62
+ forkMode?: "supersede" | "branch";
63
+ triggeringEvidenceId: string;
62
64
  rationale?: string;
63
65
  };
64
- export type BeliefsCompatUpdateConfidenceInput = ModulateConfidenceInput;
65
66
  /**
66
67
  * Configuration for the high-level Lucern SDK client.
67
68
  *
@@ -1,5 +1,5 @@
1
1
  import type { ClientNamespaceContext } from "./clientAssemblyTypes";
2
- import type { BeliefsCompatCreateInput, BeliefsCompatForkInput, BeliefsCompatUpdateConfidenceInput } from "./clientConfig";
2
+ import type { BeliefsCompatCreateInput, BeliefsCompatForkInput } from "./clientConfig";
3
3
  import type { FunctionSurfaceInput } from "./generated/functionSurface";
4
4
  import type { JsonObject } from "./types";
5
5
  export declare function createClientKnowledgeNamespaces(ctx: ClientNamespaceContext): {
@@ -20,9 +20,6 @@ export declare function createClientKnowledgeNamespaces(ctx: ClientNamespaceCont
20
20
  text: string;
21
21
  rationale?: string;
22
22
  }, rationale?: string): any;
23
- updateConfidence(nodeId: string, input: BeliefsCompatUpdateConfidenceInput): any;
24
- modulateConfidence(nodeId: string, input: BeliefsCompatUpdateConfidenceInput): any;
25
- updateStatus(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
26
23
  updateRationale(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
27
24
  linkBeliefs(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
28
25
  unlinkEvidence(input: Parameters<(...args: any[]) => any>[0], idempotencyKey?: string): any;
@@ -41,17 +41,6 @@ export function createClientKnowledgeNamespaces(ctx) {
41
41
  const payload = buildBeliefsRefinePayload(textOrInput, rationale);
42
42
  return beliefsFacade.refine(nodeId, payload).then(exposeGatewayData);
43
43
  },
44
- updateConfidence(nodeId, input) {
45
- return beliefsFacade.updateConfidence(nodeId, input).then(exposeGatewayData);
46
- },
47
- modulateConfidence(nodeId, input) {
48
- return beliefsFacade.updateConfidence(nodeId, input).then(exposeGatewayData);
49
- },
50
- updateStatus(input, idempotencyKey) {
51
- return beliefsFacade
52
- .updateStatus(input, idempotencyKey)
53
- .then(exposeGatewayData);
54
- },
55
44
  updateRationale(input, idempotencyKey) {
56
45
  return beliefsFacade
57
46
  .updateRationale(input, idempotencyKey)
@@ -87,6 +76,8 @@ export function createClientKnowledgeNamespaces(ctx) {
87
76
  .fork(nodeId, {
88
77
  text: requireText(input),
89
78
  forkReason: input.forkReason,
79
+ forkMode: input.forkMode,
80
+ triggeringEvidenceId: input.triggeringEvidenceId,
90
81
  rationale: input.rationale,
91
82
  })
92
83
  .then(exposeGatewayData);
@@ -96,7 +96,28 @@ export type PublicContextInjectionPolicy = {
96
96
  score: number;
97
97
  }>;
98
98
  };
99
+ export type PublicContextNarrativeBlock = {
100
+ kind: string;
101
+ text: string;
102
+ recordsNamed?: number;
103
+ };
104
+ export type PublicContextSupportingObjects = {
105
+ invariants?: PublicContextBelief[];
106
+ activeBeliefs?: PublicContextBelief[];
107
+ openQuestions?: PublicContextQuestion[];
108
+ recentEvidence?: PublicContextEvidence[];
109
+ contradictions?: PublicContextContradiction[];
110
+ relatedEntities?: PublicContextEntity[];
111
+ worktrees?: unknown[];
112
+ lanes?: string[];
113
+ entities?: unknown[];
114
+ };
99
115
  export type PublicCompiledContext = {
116
+ contextNarrative: Array<string | PublicContextNarrativeBlock>;
117
+ narrativeCoverage?: Record<string, unknown>;
118
+ synthesisLints?: Array<Record<string, unknown>>;
119
+ retrievalReceipt?: Record<string, unknown>;
120
+ supportingObjects?: PublicContextSupportingObjects;
100
121
  schemaVersion: string;
101
122
  topicId: string;
102
123
  topicName: string;
@@ -104,13 +125,12 @@ export type PublicCompiledContext = {
104
125
  generatedAt: number;
105
126
  ranking: ContextRankingProfile;
106
127
  summary: Record<string, unknown>;
107
- invariants: PublicContextBelief[];
108
- activeBeliefs: PublicContextBelief[];
109
- openQuestions: PublicContextQuestion[];
110
- recentEvidence: PublicContextEvidence[];
111
- contradictions: PublicContextContradiction[];
128
+ invariants?: PublicContextBelief[];
129
+ activeBeliefs?: PublicContextBelief[];
130
+ openQuestions?: PublicContextQuestion[];
131
+ recentEvidence?: PublicContextEvidence[];
132
+ contradictions?: PublicContextContradiction[];
112
133
  relatedEntities?: PublicContextEntity[];
113
- contextNarrative: string[];
114
134
  injectionPolicy: PublicContextInjectionPolicy;
115
135
  diagnostics: Record<string, unknown>;
116
136
  compilationMode?: string;
@@ -349,7 +349,28 @@ export type PublicContextInjectionPolicy = {
349
349
  score: number;
350
350
  }>;
351
351
  };
352
+ export type PublicContextNarrativeBlock = {
353
+ kind: string;
354
+ text: string;
355
+ recordsNamed?: number;
356
+ };
357
+ export type PublicContextSupportingObjects = {
358
+ invariants?: PublicContextBelief[];
359
+ activeBeliefs?: PublicContextBelief[];
360
+ openQuestions?: PublicContextQuestion[];
361
+ recentEvidence?: PublicContextEvidence[];
362
+ contradictions?: PublicContextContradiction[];
363
+ relatedEntities?: PublicContextEntity[];
364
+ worktrees?: unknown[];
365
+ lanes?: string[];
366
+ entities?: unknown[];
367
+ };
352
368
  export type PublicCompiledContext = {
369
+ contextNarrative: Array<string | PublicContextNarrativeBlock>;
370
+ narrativeCoverage?: Record<string, unknown>;
371
+ synthesisLints?: Array<Record<string, unknown>>;
372
+ retrievalReceipt?: Record<string, unknown>;
373
+ supportingObjects?: PublicContextSupportingObjects;
353
374
  schemaVersion: string;
354
375
  topicId: string;
355
376
  topicName: string;
@@ -357,13 +378,12 @@ export type PublicCompiledContext = {
357
378
  generatedAt: number;
358
379
  ranking: ContextRankingProfile;
359
380
  summary: Record<string, unknown>;
360
- invariants: PublicContextBelief[];
361
- activeBeliefs: PublicContextBelief[];
362
- openQuestions: PublicContextQuestion[];
363
- recentEvidence: PublicContextEvidence[];
364
- contradictions: PublicContextContradiction[];
381
+ invariants?: PublicContextBelief[];
382
+ activeBeliefs?: PublicContextBelief[];
383
+ openQuestions?: PublicContextQuestion[];
384
+ recentEvidence?: PublicContextEvidence[];
385
+ contradictions?: PublicContextContradiction[];
365
386
  relatedEntities?: PublicContextEntity[];
366
- contextNarrative: string[];
367
387
  injectionPolicy: PublicContextInjectionPolicy;
368
388
  diagnostics: Record<string, unknown>;
369
389
  compilationMode?: string;
@@ -1,5 +1,4 @@
1
1
  import { type GatewayClientConfig, type PlatformGatewaySuccess } from "./coreClient";
2
- import type { ModulateConfidenceInput } from "./beliefsClient";
3
2
  import { type TopicCoverageQuery, type TopicTreeQuery, type TopicUpdateInput } from "./topicsClient";
4
3
  import type { GraphAnalyticsMetric, JsonObject } from "./types";
5
4
  export type GatewayRecord = Record<string, unknown>;
@@ -108,10 +107,11 @@ export type BeliefRefineInput = {
108
107
  };
109
108
  export type BeliefForkInput = {
110
109
  text: string;
111
- forkReason?: string;
110
+ forkReason: "refinement" | "contradiction_response" | "scope_change" | "confidence_collapse";
111
+ forkMode?: "supersede" | "branch";
112
+ triggeringEvidenceId: string;
112
113
  rationale?: string;
113
114
  };
114
- export type BeliefConfidenceInput = ModulateConfidenceInput;
115
115
  export type BeliefArchiveInput = {
116
116
  reason?: string;
117
117
  rationale?: string;
@@ -1,20 +1,12 @@
1
1
  import { type GatewayClientConfig, type PlatformGatewaySuccess } from "./coreClient";
2
2
  import { type OntologyBindingInput } from "./ontologyClient";
3
- import type { BeliefArchiveInput, BeliefBisectInput, BeliefConfidenceInput, BeliefContractInput, BeliefCreateInput, BeliefForkInput, BeliefRecord, BeliefsLineageResult, BeliefsListQuery, BeliefsListResult, BeliefRefineInput, ContradictionsListResult, EdgeCreateInput, EdgeListQuery, EdgeTraverseInput, EvidenceCreateInput, EvidenceCreateResult, EvidenceListQuery, EvidenceLinkInput, EvidenceLinkResult, EvidenceSearchInput, EventsListQuery, EventsListResult, GatewayList, GatewayRecord, GraphFalsifyInput, GraphNeighborhoodInput, OntologyMatchInput, QuestionAnswerInput, QuestionArchiveInput, QuestionCreateInput, QuestionRefineInput, QuestionStatusInput, QuestionsListQuery, QuestionsListResult, ReplayEventsInput } from "./gatewayFacades";
3
+ import type { BeliefArchiveInput, BeliefBisectInput, BeliefContractInput, BeliefCreateInput, BeliefForkInput, BeliefRecord, BeliefsLineageResult, BeliefsListQuery, BeliefsListResult, BeliefRefineInput, ContradictionsListResult, EdgeCreateInput, EdgeListQuery, EdgeTraverseInput, EvidenceCreateInput, EvidenceCreateResult, EvidenceListQuery, EvidenceLinkInput, EvidenceLinkResult, EvidenceSearchInput, EventsListQuery, EventsListResult, GatewayList, GatewayRecord, GraphFalsifyInput, GraphNeighborhoodInput, OntologyMatchInput, QuestionAnswerInput, QuestionArchiveInput, QuestionCreateInput, QuestionRefineInput, QuestionStatusInput, QuestionsListQuery, QuestionsListResult, ReplayEventsInput } from "./gatewayFacades";
4
4
  export declare function createBeliefsFacade(config?: GatewayClientConfig): {
5
5
  create(input: BeliefCreateInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<BeliefRecord>>;
6
6
  get(id: string): Promise<PlatformGatewaySuccess<BeliefRecord>>;
7
7
  list(query: BeliefsListQuery): Promise<PlatformGatewaySuccess<BeliefsListResult>>;
8
8
  refine(id: string, input: BeliefRefineInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<BeliefRecord>>;
9
9
  fork(id: string, input: BeliefForkInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<BeliefRecord>>;
10
- updateConfidence(id: string, input: BeliefConfidenceInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
11
- updateStatus(input: {
12
- id?: string;
13
- nodeId?: string;
14
- beliefId?: string;
15
- status: "active" | "superseded" | "archived";
16
- reason?: string;
17
- }, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
18
10
  updateRationale(input: {
19
11
  id?: string;
20
12
  nodeId?: string;
@@ -49,20 +49,6 @@ export function createBeliefsFacade(config = {}) {
49
49
  idempotencyKey,
50
50
  });
51
51
  },
52
- async updateConfidence(id, input, idempotencyKey = randomIdempotencyKey()) {
53
- void id;
54
- void input;
55
- void idempotencyKey;
56
- throw new Error("Belief confidence is SL-derived. Use lucern.evidence.create({ targetId, evidenceRelation: 'supports'|'contradicts', confidence, rationale }) or lucern.evidence.linkToBelief(...) instead.");
57
- },
58
- async updateStatus(input, idempotencyKey = randomIdempotencyKey()) {
59
- return gateway.request({
60
- path: "/api/platform/v1/beliefs/update-status",
61
- method: "POST",
62
- body: input,
63
- idempotencyKey,
64
- });
65
- },
66
52
  async updateRationale(input, idempotencyKey = randomIdempotencyKey()) {
67
53
  return gateway.request({
68
54
  path: "/api/platform/v1/beliefs/update-rationale",
@@ -1,22 +1,5 @@
1
1
  import { createGatewayRequestClient, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
2
2
  import { createTopicsClient, } from "./topicsClient.js";
3
- function normalizeBeliefConfidenceInput(input) {
4
- const opinion = input.opinion;
5
- return {
6
- belief: opinion.b,
7
- disbelief: opinion.d,
8
- uncertainty: opinion.u,
9
- baseRate: opinion.a,
10
- trigger: input.trigger,
11
- rationale: input.rationale,
12
- triggeringEvidenceId: input.triggeringEvidenceId,
13
- triggeringQuestionId: input.triggeringQuestionId,
14
- triggeringAnswerId: input.triggeringAnswerId,
15
- triggeringContradictionId: input.triggeringContradictionId,
16
- triggeringWorktreeId: input.triggeringWorktreeId,
17
- maxInlinePropagationTargets: input.maxInlinePropagationTargets,
18
- };
19
- }
20
3
  function serializeTypes(types) {
21
4
  return Array.isArray(types) && types.length > 0 ? types.join(",") : undefined;
22
5
  }
@@ -3,7 +3,7 @@ import type { JsonObject } from "../types";
3
3
  export type FunctionSurfaceClientConfig = GatewayClientConfig;
4
4
  export type FunctionSurfaceInput = JsonObject;
5
5
  export type FunctionSurfaceResult<T = unknown> = Promise<PlatformGatewaySuccess<T>>;
6
- export declare const FUNCTION_SURFACE_METHOD_PATHS: readonly ["answers.answerQuestion", "answers.createAnswer", "answers.getAnswer", "beliefs.archiveBelief", "beliefs.bisectConfidence", "beliefs.createBelief", "beliefs.forkBelief", "beliefs.getBelief", "beliefs.getConfidenceHistory", "beliefs.listBeliefs", "beliefs.modulateConfidence", "beliefs.refineBelief", "beliefs.searchBeliefs", "bootstrap.generateSessionHandoff", "coding.getChangeHistory", "coding.getCodeContext", "coding.getFailureLog", "coding.recordAttempt", "context.analyzeTopicDensity", "context.applyAutoBranching", "context.compileContext", "context.discover", "context.discoverEntityConnections", "context.getLatticeCoverage", "context.lucernOrient", "context.recordScopeLearning", "context.seedBeliefLattice", "context.triggerBeliefReview", "contracts.createEpistemicContract", "contracts.evaluateContract", "contracts.getContractStatus", "contradictions.flagContradiction", "controlPlane.identity.resolveInteractivePrincipal", "coordination.broadcastMessage", "coordination.claimFiles", "coordination.endSession", "coordination.getAgentInbox", "coordination.heartbeatSession", "coordination.listActiveSessions", "coordination.registerSession", "coordination.sendAgentMessage", "edges.batchCreateEdges", "edges.createEdge", "edges.queryLineage", "edges.removeEdge", "edges.removeEdgesBetween", "edges.updateEdge", "embeddings.getByNodeIds", "embeddings.listMissingForTopic", "embeddings.markEmbeddingBackfillQueued", "embeddings.vectorSearchByTopic", "evidence.addEvidence", "evidence.createEvidence", "evidence.getEvidence", "evidence.linkEvidence", "evidence.linkEvidenceToBelief", "evidence.linkEvidenceToQuestion", "evidence.listEvidence", "evidence.searchEvidence", "graph.detectConfirmationBias", "graph.findContradictions", "graph.getGraphGaps", "graph.getGraphNeighborhood", "graph.getGraphStructureAnalysis", "graph.getTopicCoverage", "graph.traceEntityImpact", "graph.traverseGraph", "graphAnalysis.listGraphIntelligenceQueries", "graphAnalysis.runGraphIntelligenceQuery", "hybrid.analyzeGraphImpact", "hybrid.detectGraphDrift", "hybrid.expandGraphNeighborhood", "hybrid.findRelatedNodes", "hybrid.hybridDiscover", "hybrid.resolveTopicSemantic", "identity.checkPermission", "identity.filterByPermission", "identity.whoami", "judgments.getAuditTrail", "judgments.recordJudgment", "lenses.applyLensToTopic", "lenses.createLens", "lenses.listLenses", "lenses.removeLensFromTopic", "nodes.archiveEpistemicNode", "nodes.batchCreateEpistemicNodes", "nodes.createEpistemicNode", "nodes.getEpistemicNode", "nodes.listEpistemicNodes", "nodes.supersedeEpistemicNode", "nodes.updateEpistemicNode", "nodes.verifyEpistemicNode", "observations.getObservationContext", "observations.ingestObservation", "ontologies.applyOntology", "ontologies.archiveOntology", "ontologies.createOntology", "ontologies.createOntologyVersion", "ontologies.deprecateOntologyVersion", "ontologies.getOntology", "ontologies.listOntologies", "ontologies.matchEntityType", "ontologies.publishOntologyVersion", "ontologies.resolveEffectiveOntology", "ontologies.updateOntology", "policy.manageWritePolicy", "questions.archiveQuestion", "questions.createQuestion", "questions.findMissingQuestions", "questions.getFalsificationQuestions", "questions.getHighPriorityQuestions", "questions.getQuestion", "questions.listQuestions", "questions.refineQuestion", "questions.updateQuestionStatus", "tasks.completeTask", "tasks.createTask", "tasks.listTasks", "tasks.updateTask", "topics.createTopic", "topics.getTopic", "topics.getTopicGraphSpine", "topics.getTopicTree", "topics.listTopics", "topics.materializeTopicGraph", "topics.updateTopic", "worktrees.activateWorktree", "worktrees.addWorktree", "worktrees.beginBuildSession", "worktrees.getWorktree", "worktrees.listAllWorktrees", "worktrees.listCampaigns", "worktrees.listWorktrees", "worktrees.merge", "worktrees.openPullRequest", "worktrees.pipelineSnapshot", "worktrees.push", "worktrees.updateWorktreeMetadata", "worktrees.updateWorktreeTargets"];
6
+ export declare const FUNCTION_SURFACE_METHOD_PATHS: readonly ["answers.answerQuestion", "answers.createAnswer", "answers.getAnswer", "beliefs.appendSlScoring", "beliefs.archiveBelief", "beliefs.bisectConfidence", "beliefs.createBelief", "beliefs.forkBelief", "beliefs.getBelief", "beliefs.getConfidenceHistory", "beliefs.listBeliefs", "beliefs.refineBelief", "beliefs.searchBeliefs", "bootstrap.generateSessionHandoff", "coding.getChangeHistory", "coding.getCodeContext", "coding.getFailureLog", "coding.recordAttempt", "context.analyzeTopicDensity", "context.applyAutoBranching", "context.compileContext", "context.discover", "context.discoverEntityConnections", "context.getLatticeCoverage", "context.lucernOrient", "context.recordScopeLearning", "context.seedBeliefLattice", "context.triggerBeliefReview", "contracts.createEpistemicContract", "contracts.evaluateContract", "contracts.getContractStatus", "contradictions.flagContradiction", "controlPlane.identity.resolveInteractivePrincipal", "coordination.broadcastMessage", "coordination.claimFiles", "coordination.endSession", "coordination.getAgentInbox", "coordination.heartbeatSession", "coordination.listActiveSessions", "coordination.registerSession", "coordination.sendAgentMessage", "edges.batchCreateEdges", "edges.createEdge", "edges.queryLineage", "edges.removeEdge", "edges.removeEdgesBetween", "edges.updateEdge", "embeddings.getByNodeIds", "embeddings.listMissingForTopic", "embeddings.markEmbeddingBackfillQueued", "embeddings.vectorSearchByTopic", "evidence.addEvidence", "evidence.createEvidence", "evidence.getEvidence", "evidence.linkEvidence", "evidence.linkEvidenceToBelief", "evidence.linkEvidenceToQuestion", "evidence.listEvidence", "evidence.searchEvidence", "graph.detectConfirmationBias", "graph.findContradictions", "graph.getGraphGaps", "graph.getGraphNeighborhood", "graph.getGraphStructureAnalysis", "graph.getTopicCoverage", "graph.traceEntityImpact", "graph.traverseGraph", "graphAnalysis.listGraphIntelligenceQueries", "graphAnalysis.runGraphIntelligenceQuery", "hybrid.analyzeGraphImpact", "hybrid.detectGraphDrift", "hybrid.expandGraphNeighborhood", "hybrid.findRelatedNodes", "hybrid.hybridDiscover", "hybrid.resolveTopicSemantic", "identity.checkPermission", "identity.filterByPermission", "identity.whoami", "judgments.getAuditTrail", "judgments.recordJudgment", "lenses.applyLensToTopic", "lenses.createLens", "lenses.listLenses", "lenses.removeLensFromTopic", "nodes.archiveEpistemicNode", "nodes.batchCreateEpistemicNodes", "nodes.createEpistemicNode", "nodes.getEpistemicNode", "nodes.listEpistemicNodes", "nodes.supersedeEpistemicNode", "nodes.updateEpistemicNode", "nodes.verifyEpistemicNode", "observations.getObservationContext", "observations.ingestObservation", "ontologies.applyOntology", "ontologies.archiveOntology", "ontologies.createOntology", "ontologies.createOntologyVersion", "ontologies.deprecateOntologyVersion", "ontologies.getOntology", "ontologies.listOntologies", "ontologies.matchEntityType", "ontologies.publishOntologyVersion", "ontologies.resolveEffectiveOntology", "ontologies.updateOntology", "policy.manageWritePolicy", "questions.archiveQuestion", "questions.createQuestion", "questions.findMissingQuestions", "questions.getFalsificationQuestions", "questions.getHighPriorityQuestions", "questions.getQuestion", "questions.listQuestions", "questions.refineQuestion", "questions.updateQuestionStatus", "tasks.completeTask", "tasks.createTask", "tasks.listTasks", "tasks.updateTask", "topics.createTopic", "topics.getTopic", "topics.getTopicGraphSpine", "topics.getTopicTree", "topics.listTopics", "topics.materializeTopicGraph", "topics.updateTopic", "worktrees.activateWorktree", "worktrees.addWorktree", "worktrees.beginBuildSession", "worktrees.getWorktree", "worktrees.listAllWorktrees", "worktrees.listCampaigns", "worktrees.listWorktrees", "worktrees.merge", "worktrees.openPullRequest", "worktrees.pipelineSnapshot", "worktrees.push", "worktrees.updateWorktreeMetadata", "worktrees.updateWorktreeTargets"];
7
7
  export declare function createFunctionSurfaceClient(config?: FunctionSurfaceClientConfig): {
8
8
  sessionId: string;
9
9
  activateWorktree(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
@@ -12,6 +12,7 @@ export declare function createFunctionSurfaceClient(config?: FunctionSurfaceClie
12
12
  analyzeGraphImpact(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
13
13
  analyzeTopicDensity(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
14
14
  answerQuestion(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
15
+ appendSlScoring(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
15
16
  applyAutoBranching(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
16
17
  applyLensToTopic(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
17
18
  applyOntology(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
@@ -107,7 +108,6 @@ export declare function createFunctionSurfaceClient(config?: FunctionSurfaceClie
107
108
  matchEntityType(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
108
109
  materializeTopicGraph(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
109
110
  merge(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
110
- modulateConfidence(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
111
111
  openPullRequest(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
112
112
  pipelineSnapshot(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
113
113
  publishOntologyVersion(input?: FunctionSurfaceInput, idempotencyKey?: string): FunctionSurfaceResult<unknown>;
@@ -4,6 +4,7 @@ export const FUNCTION_SURFACE_METHOD_PATHS = [
4
4
  "answers.answerQuestion",
5
5
  "answers.createAnswer",
6
6
  "answers.getAnswer",
7
+ "beliefs.appendSlScoring",
7
8
  "beliefs.archiveBelief",
8
9
  "beliefs.bisectConfidence",
9
10
  "beliefs.createBelief",
@@ -11,7 +12,6 @@ export const FUNCTION_SURFACE_METHOD_PATHS = [
11
12
  "beliefs.getBelief",
12
13
  "beliefs.getConfidenceHistory",
13
14
  "beliefs.listBeliefs",
14
- "beliefs.modulateConfidence",
15
15
  "beliefs.refineBelief",
16
16
  "beliefs.searchBeliefs",
17
17
  "bootstrap.generateSessionHandoff",
@@ -148,6 +148,7 @@ const CONTRACTS = {
148
148
  "analyze_graph_impact": { method: "POST", path: "/hybrid/impact", kind: "action", idempotent: false, surfaceIntent: "mcp_analysis" },
149
149
  "analyze_topic_density": { method: "POST", path: "/scope/topic-density", kind: "query", idempotent: false, surfaceIntent: "mcp_analysis" },
150
150
  "answer_question": { method: "POST", path: "/questions/answer", kind: "mutation", idempotent: true, surfaceIntent: "compatibility" },
151
+ "append_sl_scoring": { method: "POST", path: "/beliefs/sl-scoring", kind: "mutation", idempotent: true, surfaceIntent: "system" },
151
152
  "apply_auto_branching": { method: "POST", path: "/scope/auto-branching", kind: "mutation", idempotent: true, surfaceIntent: "mcp_analysis" },
152
153
  "apply_lens_to_topic": { method: "POST", path: "/lenses/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
153
154
  "apply_ontology": { method: "POST", path: "/ontologies/apply", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
@@ -243,7 +244,6 @@ const CONTRACTS = {
243
244
  "match_entity_type": { method: "POST", path: "/ontologies/match-entity-type", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
244
245
  "materialize_topic_graph": { method: "POST", path: "/topics/materialize-graph", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
245
246
  "merge": { method: "POST", path: "/worktrees/merge", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
246
- "modulate_confidence": { method: "POST", path: "/beliefs/confidence", kind: "mutation", idempotent: true, surfaceIntent: "system" },
247
247
  "open_pull_request": { method: "POST", path: "/worktrees/open-pull-request", kind: "mutation", idempotent: true, surfaceIntent: "system" },
248
248
  "pipeline_snapshot": { method: "POST", path: "/worktrees/pipeline-snapshot", kind: "query", idempotent: false, surfaceIntent: "system" },
249
249
  "publish_ontology_version": { method: "POST", path: "/ontologies/versions/publish", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
@@ -345,6 +345,9 @@ export function createFunctionSurfaceClient(config = {}) {
345
345
  answerQuestion(input = {}, idempotencyKey) {
346
346
  return execute("answer_question", input, idempotencyKey);
347
347
  },
348
+ appendSlScoring(input = {}, idempotencyKey) {
349
+ return execute("append_sl_scoring", input, idempotencyKey);
350
+ },
348
351
  applyAutoBranching(input = {}, idempotencyKey) {
349
352
  return execute("apply_auto_branching", input, idempotencyKey);
350
353
  },
@@ -630,9 +633,6 @@ export function createFunctionSurfaceClient(config = {}) {
630
633
  merge(input = {}, idempotencyKey) {
631
634
  return execute("merge", input, idempotencyKey);
632
635
  },
633
- modulateConfidence(input = {}, idempotencyKey) {
634
- return execute("modulate_confidence", input, idempotencyKey);
635
- },
636
636
  openPullRequest(input = {}, idempotencyKey) {
637
637
  return execute("open_pull_request", input, idempotencyKey);
638
638
  },
@@ -31,15 +31,15 @@
31
31
  }
32
32
  ],
33
33
  "contractsCovered": [
34
+ "append_sl_scoring",
34
35
  "create_evidence",
35
36
  "list_beliefs",
36
- "list_tasks",
37
- "modulate_confidence"
37
+ "list_tasks"
38
38
  ],
39
39
  "emittersUsed": [
40
40
  "typescript-types",
41
41
  "convex-validators",
42
42
  "proof-attestation"
43
43
  ],
44
- "signedAt": 1780319940570
44
+ "signedAt": 1780348749569
45
45
  }
@@ -2,6 +2,8 @@ import type { PlatformGatewaySuccess } from "./coreClient";
2
2
  import type { JsonObject, ListResult } from "./types";
3
3
  type TopicScopedValue = {
4
4
  topicId?: string;
5
+ topicGlobalId?: string;
6
+ topicNodeId?: string;
5
7
  };
6
8
  type TextScopedValue = {
7
9
  text?: string;
@@ -29,7 +29,9 @@ function cloneWith(value, patch) {
29
29
  * Resolve the canonical topic identifier.
30
30
  */
31
31
  export function resolveTopicId(value) {
32
- return cleanString(value.topicId);
32
+ return (cleanString(value.topicGlobalId) ??
33
+ cleanString(value.topicNodeId) ??
34
+ cleanString(value.topicId));
33
35
  }
34
36
  /**
35
37
  * Resolve the canonical text field from text-first or legacy canonicalText-first inputs.
@@ -73,6 +75,9 @@ export function normalizeNodeWriteInput(value) {
73
75
  const next = { ...value };
74
76
  if (topicId) {
75
77
  next.topicId = topicId;
78
+ if (!cleanString(next.topicGlobalId)) {
79
+ next.topicGlobalId = topicId;
80
+ }
76
81
  }
77
82
  if (text) {
78
83
  next.text = text;
package/dist/types.d.ts CHANGED
@@ -17,6 +17,15 @@ export type JsonValue = null | boolean | number | string | JsonArray | JsonObjec
17
17
  * Canonical scope identifiers for SDK inputs and records.
18
18
  */
19
19
  export type TopicIdentifierInput = {
20
+ /**
21
+ * Preferred write anchor for belief creation: the globalId of a topic
22
+ * epistemicNode. `topicId` remains a compatibility projection for read/query
23
+ * surfaces and must already refer to that same topic node when used for
24
+ * belief writes.
25
+ */
26
+ topicGlobalId?: string;
27
+ /** Optional internal epistemicNodes _id for a topic node. */
28
+ topicNodeId?: string;
20
29
  topicId?: string;
21
30
  };
22
31
  /**
@@ -40,8 +49,8 @@ export type ListResult<T, LegacyKey extends string = never> = {
40
49
  * Atomic knowledge unit in the reasoning graph.
41
50
  *
42
51
  * A belief carries a confidence score, belongs to a topic scope, and follows
43
- * the knowledge-as-code lifecycle: unscored (draft) -> scored (immutable) -> forked (evolved).
44
- * Confidence is always modulated via the append-only credence log, never overwritten.
52
+ * the knowledge-as-code lifecycle: assumption -> hypothesis -> active -> resolved/superseded.
53
+ * Confidence is derived from supporting or contradicting evidence through SL scoring, never set by callers.
45
54
  */
46
55
  export type PlatformBeliefRecord = {
47
56
  nodeId: string;
@@ -52,6 +61,7 @@ export type PlatformBeliefRecord = {
52
61
  status?: string;
53
62
  confidence?: number | null;
54
63
  topicId?: string;
64
+ topicGlobalId?: string;
55
65
  title?: string;
56
66
  subtype?: string;
57
67
  domain?: string;
@@ -68,21 +78,13 @@ export type PlatformBeliefRecord = {
68
78
  };
69
79
  /** Response returned after creating a new belief node. */
70
80
  export type CreateBeliefResponse = PlatformBeliefRecord;
71
- /** Response returned after an append-only confidence modulation on a belief. */
72
- export type ModulateConfidenceResponse = {
73
- nodeId: string;
74
- newConfidence?: number;
75
- previousConfidence?: number | null;
76
- confidence?: number;
77
- trigger?: string;
78
- rationale?: string;
79
- certainty?: number;
80
- recordedAt?: number;
81
- };
82
- /** Response returned after forking a scored belief into a new formulation. The new node carries a `supersedes` edge to the parent. */
81
+ /** Response returned after forking an evidence-bearing belief into a new formulation. */
83
82
  export interface ForkBeliefResponse extends PlatformBeliefRecord {
84
83
  parentNodeId?: string;
85
84
  forkReason?: string;
85
+ forkMode?: "supersede" | "branch";
86
+ triggeringEvidenceId?: string;
87
+ triggeringEvidenceRelation?: "supports" | "contradicts";
86
88
  }
87
89
  /**
88
90
  * Generic graph node spanning L1-L4 epistemic layers.
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Current SDK package version. */
2
- export declare const LUCERN_SDK_VERSION = "1.0.16";
2
+ export declare const LUCERN_SDK_VERSION = "1.0.17";
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Current SDK package version. */
2
- export const LUCERN_SDK_VERSION = "1.0.16";
2
+ export const LUCERN_SDK_VERSION = "1.0.17";
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucern/sdk",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -113,10 +113,10 @@
113
113
  "typecheck": "tsc --project tsconfig.typecheck.json --noEmit"
114
114
  },
115
115
  "dependencies": {
116
- "@lucern/contracts": "1.0.16",
117
- "@lucern/reasoning-kernel": "1.0.16",
118
- "@lucern/secrets": "1.0.16",
119
- "@lucern/transport-core": "1.0.16",
116
+ "@lucern/contracts": "1.0.17",
117
+ "@lucern/reasoning-kernel": "1.0.17",
118
+ "@lucern/secrets": "1.0.17",
119
+ "@lucern/transport-core": "1.0.17",
120
120
  "effect": "^3.21.2",
121
121
  "zod": "^3.25.76"
122
122
  },