@lucern/sdk 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +24 -27
- package/dist/beliefs/index.d.ts +2 -1
- package/dist/beliefs/index.js +4 -1
- package/dist/beliefsClient.d.ts +4 -3
- package/dist/beliefsClient.js +8 -24
- package/dist/client.d.ts +18 -1
- package/dist/clientEvidenceCompat.d.ts +17 -0
- package/dist/clientEvidenceCompat.js +6 -0
- package/dist/clientKnowledgeNamespaces.d.ts +18 -1
- package/dist/clientKnowledgeNamespaces.js +4 -0
- package/dist/evidence/index.d.ts +33 -1
- package/dist/gatewayFacades.d.ts +14 -0
- package/dist/gatewayFacades.factories.js +6 -23
- package/dist/generated/functionSurface.js +1 -1
- package/dist/proof-attestation.json +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ 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.14] - 2026-06-01
|
|
9
|
+
- Release notes pending.
|
|
10
|
+
|
|
11
|
+
## [1.0.13] - 2026-06-01
|
|
12
|
+
- Exposes the Campaign 1 closeout headless surface: MCP output-schema
|
|
13
|
+
metadata, richer retrieval receipts, synthesis narrative coverage, and
|
|
14
|
+
evidence relation fields for supporting or contradicting belief links.
|
|
15
|
+
- Deprecates direct public confidence modulation in favor of evidence-backed
|
|
16
|
+
Subjective Logic accumulation.
|
|
17
|
+
|
|
8
18
|
## [1.0.12] - 2026-05-31
|
|
9
19
|
- Release notes pending.
|
|
10
20
|
|
package/README.md
CHANGED
|
@@ -90,7 +90,6 @@ IA-7 closes the remaining SDK surface gaps needed for SDK-first clients:
|
|
|
90
90
|
```typescript
|
|
91
91
|
import {
|
|
92
92
|
createLucernClient,
|
|
93
|
-
opinionFromDogmatic,
|
|
94
93
|
type PlatformBeliefRecord,
|
|
95
94
|
type SdkPrincipalContext,
|
|
96
95
|
type WorkflowWorktreeRecord,
|
|
@@ -215,12 +214,8 @@ const sqlFactEvidence = await lucern.evidence.create({
|
|
|
215
214
|
text: "OWASP SQL Injection Prevention guidance identifies parameterized queries as the primary defense.",
|
|
216
215
|
sourceUrl: "https://owasp.org/www-community/attacks/SQL_Injection",
|
|
217
216
|
targetId: sqlFact.data.nodeId,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
await lucern.beliefs.modulateConfidence(sqlFact.data.nodeId, {
|
|
221
|
-
opinion: opinionFromDogmatic(0.95, 0.5),
|
|
222
|
-
trigger: "evidence_added",
|
|
223
|
-
triggeringEvidenceId: sqlFactEvidence.data.nodeId,
|
|
217
|
+
evidenceRelation: "supports",
|
|
218
|
+
confidence: 0.95,
|
|
224
219
|
rationale: "OWASP verified, industry standard for 20+ years",
|
|
225
220
|
});
|
|
226
221
|
|
|
@@ -234,12 +229,8 @@ const patternEvidence = await lucern.evidence.create({
|
|
|
234
229
|
text: "Last 6 months of security audits found 14 input validation issues and 1 cryptographic issue.",
|
|
235
230
|
sourceUrl: "audit://security/findings-last-6-months",
|
|
236
231
|
targetId: patternBelief.data.nodeId,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
await lucern.beliefs.modulateConfidence(patternBelief.data.nodeId, {
|
|
240
|
-
opinion: opinionFromDogmatic(0.82, 0.5),
|
|
241
|
-
trigger: "evidence_added",
|
|
242
|
-
triggeringEvidenceId: patternEvidence.data.nodeId,
|
|
232
|
+
evidenceRelation: "supports",
|
|
233
|
+
confidence: 0.82,
|
|
243
234
|
rationale: "Last 6 months of security audits: 14 input validation issues, 1 crypto issue",
|
|
244
235
|
});
|
|
245
236
|
|
|
@@ -368,11 +359,13 @@ const comparisonAnswer = await lucern.questions.answer(comparisonQuestion.data.q
|
|
|
368
359
|
The original hypothesis said "less than 30%." The data shows 53% — but the story is more nuanced. Fork the belief to capture the evolved understanding.
|
|
369
360
|
|
|
370
361
|
```typescript
|
|
371
|
-
//
|
|
372
|
-
await lucern.
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
362
|
+
// Attach contradicting evidence to the original (it was too pessimistic about overall catch rate)
|
|
363
|
+
await lucern.evidence.linkToBelief({
|
|
364
|
+
evidenceId: humanEvidence.data.nodeId,
|
|
365
|
+
beliefId: hypothesis.data.nodeId,
|
|
366
|
+
weight: -0.8,
|
|
367
|
+
evidenceRelation: "contradicts",
|
|
368
|
+
confidence: 0.8,
|
|
376
369
|
rationale: "Static analysis catches 53% overall, not <30%. But the category breakdown reveals something more important.",
|
|
377
370
|
});
|
|
378
371
|
|
|
@@ -382,11 +375,12 @@ const evolved = await lucern.beliefs.fork(hypothesis.data.nodeId, {
|
|
|
382
375
|
forkReason: "refinement",
|
|
383
376
|
});
|
|
384
377
|
|
|
385
|
-
await lucern.
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
378
|
+
await lucern.evidence.linkToBelief({
|
|
379
|
+
evidenceId: humanEvidence.data.nodeId,
|
|
380
|
+
beliefId: evolved.data.nodeId,
|
|
381
|
+
weight: 0.88,
|
|
382
|
+
evidenceRelation: "supports",
|
|
383
|
+
confidence: 0.88,
|
|
390
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%)",
|
|
391
385
|
});
|
|
392
386
|
|
|
@@ -397,10 +391,13 @@ const actionable = await lucern.beliefs.create({
|
|
|
397
391
|
beliefType: "belief",
|
|
398
392
|
});
|
|
399
393
|
|
|
400
|
-
await lucern.
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
394
|
+
await lucern.evidence.create({
|
|
395
|
+
topicId,
|
|
396
|
+
text: "The comparison study makes business logic and concurrency the highest-value human review targets.",
|
|
397
|
+
sourceUrl: `worktree://${investigation.data.worktreeId}`,
|
|
398
|
+
targetId: actionable.data.nodeId,
|
|
399
|
+
evidenceRelation: "supports",
|
|
400
|
+
confidence: 0.85,
|
|
404
401
|
rationale: "Direct implication of the comparison study findings",
|
|
405
402
|
});
|
|
406
403
|
|
package/dist/beliefs/index.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ 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
|
-
|
|
24
|
+
/** @deprecated Attach supporting or contradicting evidence instead. */
|
|
25
|
+
modulateBeliefConfidence(): never;
|
|
25
26
|
archiveBelief: (nodeId: string, input?: string | {
|
|
26
27
|
reason?: string;
|
|
27
28
|
rationale?: string;
|
package/dist/beliefs/index.js
CHANGED
|
@@ -11,7 +11,10 @@ export function createBeliefsClient(config = {}) {
|
|
|
11
11
|
searchBeliefs: beliefs.search,
|
|
12
12
|
refineBelief: beliefs.refine,
|
|
13
13
|
forkBelief: beliefs.fork,
|
|
14
|
-
|
|
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
|
+
},
|
|
15
18
|
archiveBelief: beliefs.archive,
|
|
16
19
|
getBeliefLineage: beliefs.lineage,
|
|
17
20
|
getBeliefConfidenceHistory: beliefs.confidenceHistory,
|
package/dist/beliefsClient.d.ts
CHANGED
|
@@ -79,8 +79,9 @@ type ModulateConfidenceInputBase = {
|
|
|
79
79
|
maxInlinePropagationTargets?: number;
|
|
80
80
|
};
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
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.
|
|
84
85
|
*/
|
|
85
86
|
export type ModulateConfidenceOpinionInput = ModulateConfidenceInputBase & {
|
|
86
87
|
opinion: Opinion;
|
|
@@ -156,7 +157,7 @@ export type ReassignBeliefsTopicInput = {
|
|
|
156
157
|
* Create the beliefs client for belief lifecycle operations.
|
|
157
158
|
*
|
|
158
159
|
* @param config - Gateway transport configuration.
|
|
159
|
-
* @returns An object with
|
|
160
|
+
* @returns An object with belief lifecycle methods. Confidence is updated by evidence writes.
|
|
160
161
|
*/
|
|
161
162
|
export declare function createBeliefsClient(config?: BeliefsClientConfig): {
|
|
162
163
|
/**
|
package/dist/beliefsClient.js
CHANGED
|
@@ -85,28 +85,11 @@ export function mapOpinionHistoryEntriesFromGatewayData(payload) {
|
|
|
85
85
|
})
|
|
86
86
|
.sort((left, right) => left.t - right.t);
|
|
87
87
|
}
|
|
88
|
-
function normalizeModulateConfidenceInput(input) {
|
|
89
|
-
const opinion = input.opinion;
|
|
90
|
-
return {
|
|
91
|
-
belief: opinion.b,
|
|
92
|
-
disbelief: opinion.d,
|
|
93
|
-
uncertainty: opinion.u,
|
|
94
|
-
baseRate: opinion.a,
|
|
95
|
-
trigger: input.trigger,
|
|
96
|
-
rationale: input.rationale,
|
|
97
|
-
triggeringEvidenceId: input.triggeringEvidenceId,
|
|
98
|
-
triggeringQuestionId: input.triggeringQuestionId,
|
|
99
|
-
triggeringAnswerId: input.triggeringAnswerId,
|
|
100
|
-
triggeringContradictionId: input.triggeringContradictionId,
|
|
101
|
-
triggeringWorktreeId: input.triggeringWorktreeId,
|
|
102
|
-
maxInlinePropagationTargets: input.maxInlinePropagationTargets,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
88
|
/**
|
|
106
89
|
* Create the beliefs client for belief lifecycle operations.
|
|
107
90
|
*
|
|
108
91
|
* @param config - Gateway transport configuration.
|
|
109
|
-
* @returns An object with
|
|
92
|
+
* @returns An object with belief lifecycle methods. Confidence is updated by evidence writes.
|
|
110
93
|
*/
|
|
111
94
|
export function createBeliefsClient(config = {}) {
|
|
112
95
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -118,12 +101,13 @@ export function createBeliefsClient(config = {}) {
|
|
|
118
101
|
}
|
|
119
102
|
return normalized;
|
|
120
103
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
+
};
|
|
127
111
|
const getOpinionHistory = async (beliefId) => {
|
|
128
112
|
const response = await gateway.request({
|
|
129
113
|
path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`,
|
package/dist/client.d.ts
CHANGED
|
@@ -521,11 +521,24 @@ export declare function createLucernClient(config?: LucernClientConfig): {
|
|
|
521
521
|
sourceUrl?: string;
|
|
522
522
|
targetId?: string;
|
|
523
523
|
weight?: number;
|
|
524
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
525
|
+
confidence?: number;
|
|
526
|
+
beliefRelations?: Array<{
|
|
527
|
+
beliefId?: string;
|
|
528
|
+
beliefNodeId?: string;
|
|
529
|
+
targetId?: string;
|
|
530
|
+
relation?: "supports" | "contradicts" | "supporting" | "contradicting";
|
|
531
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
532
|
+
confidence?: number;
|
|
533
|
+
weight?: number;
|
|
534
|
+
rationale?: string;
|
|
535
|
+
}>;
|
|
524
536
|
metadata?: import("./types").JsonObject;
|
|
525
537
|
title?: string;
|
|
526
538
|
content?: string;
|
|
527
539
|
contentType?: string;
|
|
528
540
|
kind?: string;
|
|
541
|
+
rationale?: string;
|
|
529
542
|
supports?: {
|
|
530
543
|
nodeId: string;
|
|
531
544
|
weight: number;
|
|
@@ -556,12 +569,16 @@ export declare function createLucernClient(config?: LucernClientConfig): {
|
|
|
556
569
|
questionId?: string;
|
|
557
570
|
targetType?: "belief" | "question" | string;
|
|
558
571
|
weight?: number;
|
|
572
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
573
|
+
confidence?: number;
|
|
559
574
|
rationale?: string;
|
|
560
575
|
}): any;
|
|
561
576
|
linkToBelief(args: {
|
|
562
577
|
evidenceId: string;
|
|
563
578
|
beliefId: string;
|
|
564
|
-
weight
|
|
579
|
+
weight?: number;
|
|
580
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
581
|
+
confidence?: number;
|
|
565
582
|
rationale?: string;
|
|
566
583
|
}): any;
|
|
567
584
|
classifyEvidence(beliefId: string, evidenceId: string, config?: Parameters<any>[2], idempotencyKey?: string): any;
|
|
@@ -8,6 +8,18 @@ export type EvidenceCompatInput = {
|
|
|
8
8
|
sourceUrl?: string;
|
|
9
9
|
targetId?: string;
|
|
10
10
|
weight?: number;
|
|
11
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
12
|
+
confidence?: number;
|
|
13
|
+
beliefRelations?: Array<{
|
|
14
|
+
beliefId?: string;
|
|
15
|
+
beliefNodeId?: string;
|
|
16
|
+
targetId?: string;
|
|
17
|
+
relation?: "supports" | "contradicts" | "supporting" | "contradicting";
|
|
18
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
19
|
+
confidence?: number;
|
|
20
|
+
weight?: number;
|
|
21
|
+
rationale?: string;
|
|
22
|
+
}>;
|
|
11
23
|
metadata?: JsonObject;
|
|
12
24
|
title?: string;
|
|
13
25
|
content?: string;
|
|
@@ -27,6 +39,9 @@ type EvidenceFacadeLike = {
|
|
|
27
39
|
source?: string;
|
|
28
40
|
targetId?: string;
|
|
29
41
|
weight?: number;
|
|
42
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
43
|
+
confidence?: number;
|
|
44
|
+
beliefRelations?: EvidenceCompatInput["beliefRelations"];
|
|
30
45
|
rationale: string;
|
|
31
46
|
metadata?: JsonObject;
|
|
32
47
|
title?: string;
|
|
@@ -38,6 +53,8 @@ type EvidenceFacadeLike = {
|
|
|
38
53
|
evidenceId: string;
|
|
39
54
|
targetId: string;
|
|
40
55
|
weight: number;
|
|
56
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
57
|
+
confidence?: number;
|
|
41
58
|
rationale?: string;
|
|
42
59
|
}): Promise<PlatformGatewaySuccess<{
|
|
43
60
|
edgeId?: string;
|
|
@@ -18,6 +18,9 @@ export async function createEvidenceCompat(evidenceFacade, args) {
|
|
|
18
18
|
source: args.source ?? args.sourceUrl,
|
|
19
19
|
targetId: args.targetId ?? args.supports?.nodeId,
|
|
20
20
|
weight: args.weight ?? args.supports?.weight,
|
|
21
|
+
evidenceRelation: args.evidenceRelation,
|
|
22
|
+
confidence: args.confidence,
|
|
23
|
+
beliefRelations: args.beliefRelations,
|
|
21
24
|
rationale,
|
|
22
25
|
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
|
|
23
26
|
title: args.title,
|
|
@@ -43,6 +46,9 @@ export async function addEvidenceCompat(evidenceFacade, args) {
|
|
|
43
46
|
evidenceId,
|
|
44
47
|
targetId: args.supports.nodeId,
|
|
45
48
|
weight: args.supports.weight,
|
|
49
|
+
evidenceRelation: args.evidenceRelation ??
|
|
50
|
+
(args.supports.weight < 0 ? "contradicts" : "supports"),
|
|
51
|
+
confidence: args.confidence ?? Math.min(1, Math.abs(args.supports.weight)),
|
|
46
52
|
rationale: args.supports.reasoning,
|
|
47
53
|
});
|
|
48
54
|
return {
|
|
@@ -104,11 +104,24 @@ export declare function createClientKnowledgeNamespaces(ctx: ClientNamespaceCont
|
|
|
104
104
|
sourceUrl?: string;
|
|
105
105
|
targetId?: string;
|
|
106
106
|
weight?: number;
|
|
107
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
108
|
+
confidence?: number;
|
|
109
|
+
beliefRelations?: Array<{
|
|
110
|
+
beliefId?: string;
|
|
111
|
+
beliefNodeId?: string;
|
|
112
|
+
targetId?: string;
|
|
113
|
+
relation?: "supports" | "contradicts" | "supporting" | "contradicting";
|
|
114
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
115
|
+
confidence?: number;
|
|
116
|
+
weight?: number;
|
|
117
|
+
rationale?: string;
|
|
118
|
+
}>;
|
|
107
119
|
metadata?: JsonObject;
|
|
108
120
|
title?: string;
|
|
109
121
|
content?: string;
|
|
110
122
|
contentType?: string;
|
|
111
123
|
kind?: string;
|
|
124
|
+
rationale?: string;
|
|
112
125
|
supports?: {
|
|
113
126
|
nodeId: string;
|
|
114
127
|
weight: number;
|
|
@@ -139,12 +152,16 @@ export declare function createClientKnowledgeNamespaces(ctx: ClientNamespaceCont
|
|
|
139
152
|
questionId?: string;
|
|
140
153
|
targetType?: "belief" | "question" | string;
|
|
141
154
|
weight?: number;
|
|
155
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
156
|
+
confidence?: number;
|
|
142
157
|
rationale?: string;
|
|
143
158
|
}): any;
|
|
144
159
|
linkToBelief(args: {
|
|
145
160
|
evidenceId: string;
|
|
146
161
|
beliefId: string;
|
|
147
|
-
weight
|
|
162
|
+
weight?: number;
|
|
163
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
164
|
+
confidence?: number;
|
|
148
165
|
rationale?: string;
|
|
149
166
|
}): any;
|
|
150
167
|
classifyEvidence(beliefId: string, evidenceId: string, config?: Parameters<any>[2], idempotencyKey?: string): any;
|
|
@@ -292,6 +292,8 @@ export function createClientKnowledgeNamespaces(ctx) {
|
|
|
292
292
|
targetId,
|
|
293
293
|
targetType: targetType,
|
|
294
294
|
weight: args.weight,
|
|
295
|
+
evidenceRelation: args.evidenceRelation,
|
|
296
|
+
confidence: args.confidence,
|
|
295
297
|
rationale: args.rationale,
|
|
296
298
|
})
|
|
297
299
|
.then(exposeGatewayData);
|
|
@@ -302,6 +304,8 @@ export function createClientKnowledgeNamespaces(ctx) {
|
|
|
302
304
|
evidenceId: args.evidenceId,
|
|
303
305
|
targetId: args.beliefId,
|
|
304
306
|
weight: args.weight,
|
|
307
|
+
evidenceRelation: args.evidenceRelation,
|
|
308
|
+
confidence: args.confidence,
|
|
305
309
|
rationale: args.rationale,
|
|
306
310
|
})
|
|
307
311
|
.then((response) => ({
|
package/dist/evidence/index.d.ts
CHANGED
|
@@ -12,11 +12,24 @@ export declare function createEvidenceClient(config?: EvidenceClientConfig): {
|
|
|
12
12
|
sourceUrl?: string;
|
|
13
13
|
targetId?: string;
|
|
14
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
|
+
}>;
|
|
15
27
|
metadata?: import("..").JsonObject;
|
|
16
28
|
title?: string;
|
|
17
29
|
content?: string;
|
|
18
30
|
contentType?: string;
|
|
19
31
|
kind?: string;
|
|
32
|
+
rationale?: string;
|
|
20
33
|
supports?: {
|
|
21
34
|
nodeId: string;
|
|
22
35
|
weight: number;
|
|
@@ -46,6 +59,8 @@ export declare function createEvidenceClient(config?: EvidenceClientConfig): {
|
|
|
46
59
|
questionId?: string;
|
|
47
60
|
targetType?: "belief" | "question" | string;
|
|
48
61
|
weight?: number;
|
|
62
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
63
|
+
confidence?: number;
|
|
49
64
|
rationale?: string;
|
|
50
65
|
}) => any;
|
|
51
66
|
classifyEvidence: (beliefId: string, evidenceId: string, config?: Parameters<any>[2], idempotencyKey?: string) => any;
|
|
@@ -59,11 +74,24 @@ export declare function createEvidenceClient(config?: EvidenceClientConfig): {
|
|
|
59
74
|
sourceUrl?: string;
|
|
60
75
|
targetId?: string;
|
|
61
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
|
+
}>;
|
|
62
89
|
metadata?: import("..").JsonObject;
|
|
63
90
|
title?: string;
|
|
64
91
|
content?: string;
|
|
65
92
|
contentType?: string;
|
|
66
93
|
kind?: string;
|
|
94
|
+
rationale?: string;
|
|
67
95
|
supports?: {
|
|
68
96
|
nodeId: string;
|
|
69
97
|
weight: number;
|
|
@@ -94,12 +122,16 @@ export declare function createEvidenceClient(config?: EvidenceClientConfig): {
|
|
|
94
122
|
questionId?: string;
|
|
95
123
|
targetType?: "belief" | "question" | string;
|
|
96
124
|
weight?: number;
|
|
125
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
126
|
+
confidence?: number;
|
|
97
127
|
rationale?: string;
|
|
98
128
|
}): any;
|
|
99
129
|
linkToBelief(args: {
|
|
100
130
|
evidenceId: string;
|
|
101
131
|
beliefId: string;
|
|
102
|
-
weight
|
|
132
|
+
weight?: number;
|
|
133
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
134
|
+
confidence?: number;
|
|
103
135
|
rationale?: string;
|
|
104
136
|
}): any;
|
|
105
137
|
classifyEvidence(beliefId: string, evidenceId: string, config?: Parameters<any>[2], idempotencyKey?: string): any;
|
package/dist/gatewayFacades.d.ts
CHANGED
|
@@ -153,6 +153,18 @@ export type EvidenceCreateInput = {
|
|
|
153
153
|
source?: string;
|
|
154
154
|
targetId?: string;
|
|
155
155
|
weight?: number;
|
|
156
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
157
|
+
confidence?: number;
|
|
158
|
+
beliefRelations?: Array<{
|
|
159
|
+
beliefId?: string;
|
|
160
|
+
beliefNodeId?: string;
|
|
161
|
+
targetId?: string;
|
|
162
|
+
relation?: "supports" | "contradicts" | "supporting" | "contradicting";
|
|
163
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
164
|
+
confidence?: number;
|
|
165
|
+
weight?: number;
|
|
166
|
+
rationale?: string;
|
|
167
|
+
}>;
|
|
156
168
|
rationale: string;
|
|
157
169
|
metadata?: JsonObject;
|
|
158
170
|
title?: string;
|
|
@@ -179,6 +191,8 @@ export type EvidenceLinkInput = {
|
|
|
179
191
|
targetId: string;
|
|
180
192
|
targetType?: "belief" | "question";
|
|
181
193
|
weight?: number;
|
|
194
|
+
evidenceRelation?: "supports" | "contradicts";
|
|
195
|
+
confidence?: number;
|
|
182
196
|
rationale?: string;
|
|
183
197
|
};
|
|
184
198
|
export type QuestionsListQuery = {
|
|
@@ -2,23 +2,6 @@ import { createGatewayRequestClient, randomIdempotencyKey, toQueryString, } from
|
|
|
2
2
|
import { createGraphClient } from "./graphClient.js";
|
|
3
3
|
import { createIdentityClient } from "./identityClient.js";
|
|
4
4
|
import { createOntologyClient } from "./ontologyClient.js";
|
|
5
|
-
function normalizeBeliefConfidenceInput(input) {
|
|
6
|
-
const opinion = input.opinion;
|
|
7
|
-
return {
|
|
8
|
-
belief: opinion.b,
|
|
9
|
-
disbelief: opinion.d,
|
|
10
|
-
uncertainty: opinion.u,
|
|
11
|
-
baseRate: opinion.a,
|
|
12
|
-
trigger: input.trigger,
|
|
13
|
-
rationale: input.rationale,
|
|
14
|
-
triggeringEvidenceId: input.triggeringEvidenceId,
|
|
15
|
-
triggeringQuestionId: input.triggeringQuestionId,
|
|
16
|
-
triggeringAnswerId: input.triggeringAnswerId,
|
|
17
|
-
triggeringContradictionId: input.triggeringContradictionId,
|
|
18
|
-
triggeringWorktreeId: input.triggeringWorktreeId,
|
|
19
|
-
maxInlinePropagationTargets: input.maxInlinePropagationTargets,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
5
|
function serializeTypes(types) {
|
|
23
6
|
return Array.isArray(types) && types.length > 0 ? types.join(",") : undefined;
|
|
24
7
|
}
|
|
@@ -67,12 +50,10 @@ export function createBeliefsFacade(config = {}) {
|
|
|
67
50
|
});
|
|
68
51
|
},
|
|
69
52
|
async updateConfidence(id, input, idempotencyKey = randomIdempotencyKey()) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
idempotencyKey,
|
|
75
|
-
});
|
|
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.");
|
|
76
57
|
},
|
|
77
58
|
async updateStatus(input, idempotencyKey = randomIdempotencyKey()) {
|
|
78
59
|
return gateway.request({
|
|
@@ -304,6 +285,8 @@ export function createEvidenceFacade(config = {}) {
|
|
|
304
285
|
targetId: input.targetId,
|
|
305
286
|
targetType: input.targetType,
|
|
306
287
|
weight: input.weight,
|
|
288
|
+
evidenceRelation: input.evidenceRelation,
|
|
289
|
+
confidence: input.confidence,
|
|
307
290
|
rationale: input.rationale,
|
|
308
291
|
},
|
|
309
292
|
idempotencyKey,
|
|
@@ -243,7 +243,7 @@ const CONTRACTS = {
|
|
|
243
243
|
"match_entity_type": { method: "POST", path: "/ontologies/match-entity-type", kind: "query", idempotent: false, surfaceIntent: "mcp_workflow" },
|
|
244
244
|
"materialize_topic_graph": { method: "POST", path: "/topics/materialize-graph", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
|
|
245
245
|
"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: "
|
|
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" },
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucern/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
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.
|
|
117
|
-
"@lucern/reasoning-kernel": "1.0.
|
|
118
|
-
"@lucern/secrets": "1.0.
|
|
119
|
-
"@lucern/transport-core": "1.0.
|
|
116
|
+
"@lucern/contracts": "1.0.14",
|
|
117
|
+
"@lucern/reasoning-kernel": "1.0.14",
|
|
118
|
+
"@lucern/secrets": "1.0.14",
|
|
119
|
+
"@lucern/transport-core": "1.0.14",
|
|
120
120
|
"effect": "^3.21.2",
|
|
121
121
|
"zod": "^3.25.76"
|
|
122
122
|
},
|