@lucern/sdk 1.0.18 → 1.0.20

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,12 @@ 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.20] - 2026-06-05
9
+ - Release notes pending.
10
+
11
+ ## [1.0.19] - 2026-06-04
12
+ - Release notes pending.
13
+
8
14
  ## [1.0.18] - 2026-06-02
9
15
  - Release notes pending.
10
16
 
@@ -29,16 +29,14 @@ export declare function mapOpinionHistoryEntriesFromGatewayData(payload: Gateway
29
29
  *
30
30
  * Use `text` as the canonical belief statement.
31
31
  * `canonicalText` remains available as a legacy alias for backwards compatibility.
32
+ * `topicGlobalId` is a required UUIDv7 topic epistemic-node globalId; SDK
33
+ * creation no longer translates `topicId` or `topicNodeId` into a write anchor.
32
34
  * Beliefs start as drafts with a vacuous prior `(0, 0, 1, a)`. When omitted,
33
35
  * `baseRate` defaults to the canonical neutral prior `0.5`.
34
36
  */
35
37
  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. */
41
- topicId?: string;
38
+ /** Required UUIDv7 topic epistemicNodes globalId. */
39
+ topicGlobalId: string;
42
40
  /** Preferred belief statement alias. */
43
41
  text?: string;
44
42
  /** @deprecated Use text. */
@@ -1,5 +1,6 @@
1
1
  import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, } from "./coreClient.js";
2
2
  import { normalizeNodeWriteInput } from "./sdkSurface.js";
3
+ import { isUuidV7 } from "@lucern/contracts/ids";
3
4
  export { LucernApiError };
4
5
  function asRecord(value) {
5
6
  return value && typeof value === "object" && !Array.isArray(value)
@@ -101,6 +102,21 @@ export function createBeliefsClient(config = {}) {
101
102
  }
102
103
  return normalized;
103
104
  }
105
+ function normalizeCreateBeliefInput(input) {
106
+ const topicGlobalId = readString(input.topicGlobalId);
107
+ if (!topicGlobalId || !isUuidV7(topicGlobalId)) {
108
+ throw new Error("createBelief requires topicGlobalId to be a UUIDv7 topic epistemic-node globalId.");
109
+ }
110
+ const text = readString(input.text) ?? readString(input.canonicalText);
111
+ const body = { ...input, topicGlobalId };
112
+ delete body.topicId;
113
+ delete body.topicNodeId;
114
+ if (text) {
115
+ body.text = text;
116
+ body.canonicalText = text;
117
+ }
118
+ return body;
119
+ }
104
120
  const getOpinionHistory = async (beliefId) => {
105
121
  const response = await gateway.request({
106
122
  path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`,
@@ -117,7 +133,7 @@ export function createBeliefsClient(config = {}) {
117
133
  path: "/api/platform/v1/beliefs",
118
134
  method: "POST",
119
135
  body: {
120
- ...normalizeNodeWriteInput(input),
136
+ ...normalizeCreateBeliefInput(input),
121
137
  baseRate,
122
138
  },
123
139
  idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
package/dist/client.d.ts CHANGED
@@ -511,38 +511,7 @@ export declare function createLucernClient(config?: LucernClientConfig): {
511
511
  }): any;
512
512
  };
513
513
  evidence: {
514
- create(args: {
515
- text?: string;
516
- canonicalText?: string;
517
- topicId?: string;
518
- source?: string;
519
- sourceUrl?: string;
520
- targetId?: string;
521
- weight?: number;
522
- evidenceRelation?: "supports" | "contradicts";
523
- confidence?: number;
524
- beliefRelations?: Array<{
525
- beliefId?: string;
526
- beliefNodeId?: string;
527
- targetId?: string;
528
- relation?: "supports" | "contradicts" | "supporting" | "contradicting";
529
- evidenceRelation?: "supports" | "contradicts";
530
- confidence?: number;
531
- weight?: number;
532
- rationale?: string;
533
- }>;
534
- metadata?: import("./types").JsonObject;
535
- title?: string;
536
- content?: string;
537
- contentType?: string;
538
- kind?: string;
539
- rationale?: string;
540
- supports?: {
541
- nodeId: string;
542
- weight: number;
543
- reasoning?: string;
544
- };
545
- }): any;
514
+ create(args: import("./clientEvidenceCompat").EvidenceCompatInput): any;
546
515
  add: any;
547
516
  get(evidenceId: string): any;
548
517
  list(args: {
@@ -600,7 +569,12 @@ export declare function createLucernClient(config?: LucernClientConfig): {
600
569
  metadata?: import("./types").JsonObject;
601
570
  }): any;
602
571
  get(questionId: string): any;
603
- refine(questionId: string, text: string, refinementReason?: string): any;
572
+ refine(questionId: string, input: string | {
573
+ text?: string;
574
+ question?: string;
575
+ rationale?: string;
576
+ linkedWorktreeId?: string;
577
+ }, refinementReason?: string): any;
604
578
  list(args: {
605
579
  topicId?: string;
606
580
  status?: string;
@@ -6,6 +6,7 @@ export type EvidenceCompatInput = {
6
6
  topicId?: string;
7
7
  source?: string;
8
8
  sourceUrl?: string;
9
+ externalSourceUrl?: string;
9
10
  targetId?: string;
10
11
  weight?: number;
11
12
  evidenceRelation?: "supports" | "contradicts";
@@ -25,6 +26,14 @@ export type EvidenceCompatInput = {
25
26
  content?: string;
26
27
  contentType?: string;
27
28
  kind?: string;
29
+ tags?: string[];
30
+ sourceType?: string;
31
+ externalSourceType?: string;
32
+ sourceQuestionId?: string;
33
+ methodology?: string;
34
+ informationAsymmetry?: string;
35
+ sourceQuality?: "primary" | "analyzed" | "secondary" | "tertiary" | "unknown";
36
+ sourceDescription?: string;
28
37
  rationale?: string;
29
38
  supports?: {
30
39
  nodeId: string;
@@ -48,6 +57,16 @@ type EvidenceFacadeLike = {
48
57
  content?: string;
49
58
  contentType?: string;
50
59
  kind?: string;
60
+ tags?: string[];
61
+ sourceUrl?: string;
62
+ externalSourceUrl?: string;
63
+ sourceType?: string;
64
+ externalSourceType?: string;
65
+ sourceQuestionId?: string;
66
+ methodology?: string;
67
+ informationAsymmetry?: string;
68
+ sourceQuality?: "primary" | "analyzed" | "secondary" | "tertiary" | "unknown";
69
+ sourceDescription?: string;
51
70
  }): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
52
71
  link(args: {
53
72
  evidenceId: string;
@@ -16,6 +16,8 @@ export async function createEvidenceCompat(evidenceFacade, args) {
16
16
  topicId: resolveTopicId(args),
17
17
  text,
18
18
  source: args.source ?? args.sourceUrl,
19
+ sourceUrl: args.sourceUrl,
20
+ externalSourceUrl: args.externalSourceUrl,
19
21
  targetId: args.targetId ?? args.supports?.nodeId,
20
22
  weight: args.weight ?? args.supports?.weight,
21
23
  evidenceRelation: args.evidenceRelation,
@@ -27,33 +29,31 @@ export async function createEvidenceCompat(evidenceFacade, args) {
27
29
  content: args.content,
28
30
  contentType: args.contentType,
29
31
  kind: args.kind,
32
+ tags: args.tags,
33
+ sourceType: args.sourceType,
34
+ externalSourceType: args.externalSourceType,
35
+ sourceQuestionId: args.sourceQuestionId,
36
+ methodology: args.methodology,
37
+ informationAsymmetry: args.informationAsymmetry,
38
+ sourceQuality: args.sourceQuality,
39
+ sourceDescription: args.sourceDescription,
30
40
  });
31
41
  }
32
42
  export async function addEvidenceCompat(evidenceFacade, args) {
33
- const created = await createEvidenceCompat(evidenceFacade, {
34
- ...args,
35
- targetId: args.supports ? undefined : args.targetId,
36
- weight: args.supports ? undefined : args.weight,
37
- });
38
43
  if (!args.supports) {
44
+ const created = await createEvidenceCompat(evidenceFacade, args);
39
45
  return created.data;
40
46
  }
41
- const evidenceId = created.data.id;
42
- if (typeof evidenceId !== "string" || evidenceId.length === 0) {
43
- throw new Error("evidence create did not return an id");
44
- }
45
- const linked = await evidenceFacade.link({
46
- evidenceId,
47
- targetId: args.supports.nodeId,
48
- weight: args.supports.weight,
47
+ const { supports, ...createArgs } = args;
48
+ const created = await createEvidenceCompat(evidenceFacade, {
49
+ ...createArgs,
50
+ targetId: args.targetId ?? supports.nodeId,
51
+ weight: args.weight ?? supports.weight,
49
52
  evidenceRelation: args.evidenceRelation ??
50
- (args.supports.weight < 0 ? "contradicts" : "supports"),
51
- confidence: args.confidence ?? Math.min(1, Math.abs(args.supports.weight)),
52
- rationale: args.supports.reasoning,
53
+ (supports.weight < 0 ? "contradicts" : "supports"),
54
+ confidence: args.confidence ?? Math.min(1, Math.abs(supports.weight)),
55
+ rationale: args.rationale ?? supports.reasoning,
53
56
  });
54
- return {
55
- ...created.data,
56
- edgeId: linked.data.edgeId,
57
- };
57
+ return created.data;
58
58
  }
59
59
  //# sourceMappingURL=clientEvidenceCompat.js.map
@@ -1,5 +1,6 @@
1
1
  import type { ClientNamespaceContext } from "./clientAssemblyTypes";
2
2
  import type { BeliefsCompatCreateInput, BeliefsCompatForkInput } from "./clientConfig";
3
+ import type { EvidenceCompatInput } from "./clientEvidenceCompat";
3
4
  import type { FunctionSurfaceInput } from "./generated/functionSurface";
4
5
  import type { JsonObject } from "./types";
5
6
  export declare function createClientKnowledgeNamespaces(ctx: ClientNamespaceContext): {
@@ -93,38 +94,7 @@ export declare function createClientKnowledgeNamespaces(ctx: ClientNamespaceCont
93
94
  }): any;
94
95
  };
95
96
  evidence: {
96
- create(args: {
97
- text?: string;
98
- canonicalText?: string;
99
- topicId?: string;
100
- source?: string;
101
- sourceUrl?: string;
102
- targetId?: string;
103
- weight?: number;
104
- evidenceRelation?: "supports" | "contradicts";
105
- confidence?: number;
106
- beliefRelations?: Array<{
107
- beliefId?: string;
108
- beliefNodeId?: string;
109
- targetId?: string;
110
- relation?: "supports" | "contradicts" | "supporting" | "contradicting";
111
- evidenceRelation?: "supports" | "contradicts";
112
- confidence?: number;
113
- weight?: number;
114
- rationale?: string;
115
- }>;
116
- metadata?: JsonObject;
117
- title?: string;
118
- content?: string;
119
- contentType?: string;
120
- kind?: string;
121
- rationale?: string;
122
- supports?: {
123
- nodeId: string;
124
- weight: number;
125
- reasoning?: string;
126
- };
127
- }): any;
97
+ create(args: EvidenceCompatInput): any;
128
98
  add: any;
129
99
  get(evidenceId: string): any;
130
100
  list(args: {
@@ -182,7 +152,12 @@ export declare function createClientKnowledgeNamespaces(ctx: ClientNamespaceCont
182
152
  metadata?: JsonObject;
183
153
  }): any;
184
154
  get(questionId: string): any;
185
- refine(questionId: string, text: string, refinementReason?: string): any;
155
+ refine(questionId: string, input: string | {
156
+ text?: string;
157
+ question?: string;
158
+ rationale?: string;
159
+ linkedWorktreeId?: string;
160
+ }, refinementReason?: string): any;
186
161
  list(args: {
187
162
  topicId?: string;
188
163
  status?: string;
@@ -359,12 +359,15 @@ export function createClientKnowledgeNamespaces(ctx) {
359
359
  get(questionId) {
360
360
  return questionsFacade.get(questionId).then(exposeGatewayData);
361
361
  },
362
- refine(questionId, text, refinementReason) {
362
+ refine(questionId, input, refinementReason) {
363
+ const payload = typeof input === "string"
364
+ ? {
365
+ text: input,
366
+ rationale: refinementReason,
367
+ }
368
+ : input;
363
369
  return questionsFacade
364
- .refine(questionId, {
365
- text,
366
- rationale: refinementReason,
367
- })
370
+ .refine(questionId, payload)
368
371
  .then(exposeGatewayData);
369
372
  },
370
373
  list(args) {
@@ -4,38 +4,7 @@ export * as toolSchemas from "@lucern/contracts/tool-contracts";
4
4
  export type EvidenceClientConfig = LucernClientConfig;
5
5
  export type EvidenceClient = ReturnType<typeof createEvidenceClient>;
6
6
  export declare function createEvidenceClient(config?: EvidenceClientConfig): {
7
- createEvidence: (args: {
8
- text?: string;
9
- canonicalText?: string;
10
- topicId?: string;
11
- source?: string;
12
- sourceUrl?: string;
13
- targetId?: string;
14
- weight?: number;
15
- evidenceRelation?: "supports" | "contradicts";
16
- confidence?: number;
17
- beliefRelations?: Array<{
18
- beliefId?: string;
19
- beliefNodeId?: string;
20
- targetId?: string;
21
- relation?: "supports" | "contradicts" | "supporting" | "contradicting";
22
- evidenceRelation?: "supports" | "contradicts";
23
- confidence?: number;
24
- weight?: number;
25
- rationale?: string;
26
- }>;
27
- metadata?: import("..").JsonObject;
28
- title?: string;
29
- content?: string;
30
- contentType?: string;
31
- kind?: string;
32
- rationale?: string;
33
- supports?: {
34
- nodeId: string;
35
- weight: number;
36
- reasoning?: string;
37
- };
38
- }) => any;
7
+ createEvidence: (args: import("../clientEvidenceCompat").EvidenceCompatInput) => any;
39
8
  getEvidence: (evidenceId: string) => any;
40
9
  listEvidence: (args: {
41
10
  topicId?: string;
@@ -66,38 +35,7 @@ export declare function createEvidenceClient(config?: EvidenceClientConfig): {
66
35
  classifyEvidence: (beliefId: string, evidenceId: string, config?: Parameters<any>[2], idempotencyKey?: string) => any;
67
36
  classifyEvidenceBatch: (beliefId: string, evidence: Parameters<any>[1], config?: Parameters<any>[2], idempotencyKey?: string) => any;
68
37
  raw: {
69
- create(args: {
70
- text?: string;
71
- canonicalText?: string;
72
- topicId?: string;
73
- source?: string;
74
- sourceUrl?: string;
75
- targetId?: string;
76
- weight?: number;
77
- evidenceRelation?: "supports" | "contradicts";
78
- confidence?: number;
79
- beliefRelations?: Array<{
80
- beliefId?: string;
81
- beliefNodeId?: string;
82
- targetId?: string;
83
- relation?: "supports" | "contradicts" | "supporting" | "contradicting";
84
- evidenceRelation?: "supports" | "contradicts";
85
- confidence?: number;
86
- weight?: number;
87
- rationale?: string;
88
- }>;
89
- metadata?: import("..").JsonObject;
90
- title?: string;
91
- content?: string;
92
- contentType?: string;
93
- kind?: string;
94
- rationale?: string;
95
- supports?: {
96
- nodeId: string;
97
- weight: number;
98
- reasoning?: string;
99
- };
100
- }): any;
38
+ create(args: import("../clientEvidenceCompat").EvidenceCompatInput): any;
101
39
  add: any;
102
40
  get(evidenceId: string): any;
103
41
  list(args: {
@@ -171,6 +171,16 @@ export type EvidenceCreateInput = {
171
171
  content?: string;
172
172
  contentType?: string;
173
173
  kind?: string;
174
+ tags?: string[];
175
+ sourceUrl?: string;
176
+ externalSourceUrl?: string;
177
+ sourceType?: string;
178
+ externalSourceType?: string;
179
+ sourceQuestionId?: string;
180
+ methodology?: string;
181
+ informationAsymmetry?: string;
182
+ sourceQuality?: "primary" | "analyzed" | "secondary" | "tertiary" | "unknown";
183
+ sourceDescription?: string;
174
184
  };
175
185
  export type EvidenceListQuery = {
176
186
  topicId?: string;
@@ -217,8 +227,10 @@ export type QuestionAnswerInput = {
217
227
  rationale?: string;
218
228
  };
219
229
  export type QuestionRefineInput = {
220
- text: string;
230
+ text?: string;
231
+ question?: string;
221
232
  rationale?: string;
233
+ linkedWorktreeId?: string;
222
234
  };
223
235
  export type QuestionArchiveInput = {
224
236
  reason?: string;
@@ -41,5 +41,5 @@
41
41
  "convex-validators",
42
42
  "proof-attestation"
43
43
  ],
44
- "signedAt": 1780432640939
44
+ "signedAt": 1780649268504
45
45
  }
@@ -26,7 +26,12 @@ export declare function createQuestionsClient(config?: QuestionsClientConfig): {
26
26
  evidenceIds?: string[];
27
27
  rationale?: string;
28
28
  }) => any;
29
- refineQuestion: (questionId: string, text: string, refinementReason?: string) => any;
29
+ refineQuestion: (questionId: string, input: string | {
30
+ text?: string;
31
+ question?: string;
32
+ rationale?: string;
33
+ linkedWorktreeId?: string;
34
+ }, refinementReason?: string) => any;
30
35
  updateQuestionStatus: (questionId: string, status: string, rationale?: string) => any;
31
36
  archiveQuestion: (questionId: string, reason?: string) => any;
32
37
  getHighPriorityQuestions: (args: {
@@ -47,7 +52,12 @@ export declare function createQuestionsClient(config?: QuestionsClientConfig): {
47
52
  metadata?: import("..").JsonObject;
48
53
  }): any;
49
54
  get(questionId: string): any;
50
- refine(questionId: string, text: string, refinementReason?: string): any;
55
+ refine(questionId: string, input: string | {
56
+ text?: string;
57
+ question?: string;
58
+ rationale?: string;
59
+ linkedWorktreeId?: string;
60
+ }, refinementReason?: string): any;
51
61
  list(args: {
52
62
  topicId?: string;
53
63
  status?: string;
@@ -3,7 +3,6 @@ import type { JsonObject, ListResult } from "./types";
3
3
  type TopicScopedValue = {
4
4
  topicId?: string;
5
5
  topicGlobalId?: string;
6
- topicNodeId?: string;
7
6
  };
8
7
  type TextScopedValue = {
9
8
  text?: string;
@@ -29,9 +29,7 @@ function cloneWith(value, patch) {
29
29
  * Resolve the canonical topic identifier.
30
30
  */
31
31
  export function resolveTopicId(value) {
32
- return (cleanString(value.topicGlobalId) ??
33
- cleanString(value.topicNodeId) ??
34
- cleanString(value.topicId));
32
+ return cleanString(value.topicGlobalId) ?? cleanString(value.topicId);
35
33
  }
36
34
  /**
37
35
  * Resolve the canonical text field from text-first or legacy canonicalText-first inputs.
package/dist/types.d.ts CHANGED
@@ -18,14 +18,11 @@ export type JsonValue = null | boolean | number | string | JsonArray | JsonObjec
18
18
  */
19
19
  export type TopicIdentifierInput = {
20
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.
21
+ * Preferred write anchor for belief creation: the UUIDv7 globalId of a topic
22
+ * epistemicNode. `topicId` remains a read/query scope for non-belief-write
23
+ * surfaces.
25
24
  */
26
25
  topicGlobalId?: string;
27
- /** Optional internal epistemicNodes _id for a topic node. */
28
- topicNodeId?: string;
29
26
  topicId?: string;
30
27
  };
31
28
  /**
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.18";
2
+ export declare const LUCERN_SDK_VERSION = "1.0.20";
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.18";
2
+ export const LUCERN_SDK_VERSION = "1.0.20";
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.18",
3
+ "version": "1.0.20",
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.18",
117
- "@lucern/reasoning-kernel": "1.0.18",
118
- "@lucern/secrets": "1.0.18",
119
- "@lucern/transport-core": "1.0.18",
116
+ "@lucern/contracts": "1.0.20",
117
+ "@lucern/reasoning-kernel": "1.0.20",
118
+ "@lucern/secrets": "1.0.20",
119
+ "@lucern/transport-core": "1.0.20",
120
120
  "effect": "^3.21.2",
121
121
  "zod": "^3.25.76"
122
122
  },