@lucern/sdk 0.2.0-alpha.6 → 0.2.0-alpha.8
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 +13 -0
- package/dist/{lib/platform/sdk/adminClient.d.ts → adminClient.d.ts} +56 -51
- package/dist/adminClient.js +755 -0
- package/dist/adminClient.js.map +1 -0
- package/dist/answersClient.d.ts +23 -0
- package/dist/answersClient.js +333 -0
- package/dist/answersClient.js.map +1 -0
- package/dist/{lib/platform/sdk/audiencesClient.d.ts → audiencesClient.d.ts} +24 -18
- package/dist/audiencesClient.js +472 -0
- package/dist/audiencesClient.js.map +1 -0
- package/dist/auditClient.d.ts +29 -0
- package/dist/auditClient.js +386 -0
- package/dist/auditClient.js.map +1 -0
- package/dist/{lib/platform/sdk/beliefsClient.d.ts → beliefsClient.d.ts} +32 -27
- package/dist/beliefsClient.js +477 -0
- package/dist/beliefsClient.js.map +1 -0
- package/dist/{lib/platform/sdk/client.d.ts → client.d.ts} +404 -395
- package/dist/client.js +6134 -0
- package/dist/client.js.map +1 -0
- package/dist/{lib/platform/sdk/contextClient.d.ts → contextClient.d.ts} +13 -7
- package/dist/contextClient.js +396 -0
- package/dist/contextClient.js.map +1 -0
- package/dist/contextFacade.d.ts +2 -0
- package/dist/contextFacade.js +73 -0
- package/dist/contextFacade.js.map +1 -0
- package/dist/{lib/platform/sdk/contextPackCompiler.d.ts → contextPackCompiler.d.ts} +11 -9
- package/dist/contextPackCompiler.js +1091 -0
- package/dist/contextPackCompiler.js.map +1 -0
- package/dist/contextPackPolicy.d.ts +84 -0
- package/dist/contextPackPolicy.js +347 -0
- package/dist/contextPackPolicy.js.map +1 -0
- package/dist/contextPackSchema.d.ts +7 -0
- package/dist/contextPackSchema.js +203 -0
- package/dist/contextPackSchema.js.map +1 -0
- package/dist/{lib/platform/sdk/contextTypes.d.ts → contextTypes.d.ts} +15 -13
- package/dist/contextTypes.js +3 -0
- package/dist/contextTypes.js.map +1 -0
- package/dist/contracts/api-enums.contract.d.ts +81 -0
- package/dist/contracts/api-enums.contract.js +92 -0
- package/dist/contracts/api-enums.contract.js.map +1 -0
- package/dist/contracts/auth-session.contract.d.ts +55 -0
- package/dist/contracts/auth-session.contract.js +48 -0
- package/dist/contracts/auth-session.contract.js.map +1 -0
- package/dist/{lucern/contracts/src → contracts}/context-pack.contract.d.ts +56 -58
- package/dist/contracts/context-pack.contract.js +98 -0
- package/dist/contracts/context-pack.contract.js.map +1 -0
- package/dist/contracts/contextPack.d.ts +1 -0
- package/dist/contracts/contextPack.js +98 -0
- package/dist/contracts/contextPack.js.map +1 -0
- package/dist/contracts/index.d.ts +9 -0
- package/dist/contracts/index.js +4892 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/{lucern/contracts/src → contracts}/lens-filter.contract.d.ts +10 -8
- package/dist/contracts/lens-filter.contract.js +71 -0
- package/dist/contracts/lens-filter.contract.js.map +1 -0
- package/dist/contracts/lens-workflow.contract.d.ts +87 -0
- package/dist/contracts/lens-workflow.contract.js +123 -0
- package/dist/contracts/lens-workflow.contract.js.map +1 -0
- package/dist/contracts/lensFilter.d.ts +1 -0
- package/dist/contracts/lensFilter.js +71 -0
- package/dist/contracts/lensFilter.js.map +1 -0
- package/dist/contracts/lensWorkflow.d.ts +2 -0
- package/dist/contracts/lensWorkflow.js +123 -0
- package/dist/contracts/lensWorkflow.js.map +1 -0
- package/dist/contracts/mcp-tools.contract.d.ts +1 -0
- package/dist/contracts/mcp-tools.contract.js +2986 -0
- package/dist/contracts/mcp-tools.contract.js.map +1 -0
- package/dist/contracts/mcpTools.d.ts +1 -0
- package/dist/contracts/mcpTools.js +2986 -0
- package/dist/contracts/mcpTools.js.map +1 -0
- package/dist/{lucern/contracts/src → contracts}/prompt.contract.d.ts +5 -3
- package/dist/contracts/prompt.contract.js +12 -0
- package/dist/contracts/prompt.contract.js.map +1 -0
- package/dist/contracts/prompt.d.ts +1 -0
- package/dist/contracts/prompt.js +12 -0
- package/dist/contracts/prompt.js.map +1 -0
- package/dist/contracts/sdk-tools.contract.d.ts +2 -0
- package/dist/contracts/sdk-tools.contract.js +4134 -0
- package/dist/contracts/sdk-tools.contract.js.map +1 -0
- package/dist/contracts/sdkTools.d.ts +2 -0
- package/dist/contracts/sdkTools.js +4134 -0
- package/dist/contracts/sdkTools.js.map +1 -0
- package/dist/contracts/workflow-runtime.contract.d.ts +163 -0
- package/dist/contracts/workflow-runtime.contract.js +245 -0
- package/dist/contracts/workflow-runtime.contract.js.map +1 -0
- package/dist/contracts/workflowRuntime.d.ts +1 -0
- package/dist/contracts/workflowRuntime.js +245 -0
- package/dist/contracts/workflowRuntime.js.map +1 -0
- package/dist/{lib/platform/sdk/controlObjectOwnership.d.ts → controlObjectOwnership.d.ts} +20 -18
- package/dist/controlObjectOwnership.js +215 -0
- package/dist/controlObjectOwnership.js.map +1 -0
- package/dist/{lib/platform/sdk/coreClient.d.ts → coreClient.d.ts} +19 -14
- package/dist/coreClient.js +339 -0
- package/dist/coreClient.js.map +1 -0
- package/dist/{lib/platform/sdk/customTools.d.ts → customTools.d.ts} +21 -16
- package/dist/customTools.js +248 -0
- package/dist/customTools.js.map +1 -0
- package/dist/{lib/platform/sdk/decisionsClient.d.ts → decisionsClient.d.ts} +29 -24
- package/dist/decisionsClient.js +522 -0
- package/dist/decisionsClient.js.map +1 -0
- package/dist/domainContext.d.ts +1 -0
- package/dist/domainContext.js +3 -0
- package/dist/domainContext.js.map +1 -0
- package/dist/events.d.ts +178 -0
- package/dist/events.js +249 -0
- package/dist/events.js.map +1 -0
- package/dist/eventsCore.d.ts +49 -0
- package/dist/eventsCore.js +429 -0
- package/dist/eventsCore.js.map +1 -0
- package/dist/facade/context.d.ts +18 -0
- package/dist/facade/context.js +73 -0
- package/dist/facade/context.js.map +1 -0
- package/dist/{lib/platform/sdk/gatewayFacades.d.ts → gatewayFacades.d.ts} +31 -26
- package/dist/gatewayFacades.js +1953 -0
- package/dist/gatewayFacades.js.map +1 -0
- package/dist/{lib/platform/sdk/graphClient.d.ts → graphClient.d.ts} +57 -52
- package/dist/graphClient.js +698 -0
- package/dist/graphClient.js.map +1 -0
- package/dist/{lib/platform/sdk/harnessClient.d.ts → harnessClient.d.ts} +44 -39
- package/dist/harnessClient.js +607 -0
- package/dist/harnessClient.js.map +1 -0
- package/dist/{lib/platform/sdk/identityClient.d.ts → identityClient.d.ts} +17 -11
- package/dist/identityClient.js +497 -0
- package/dist/identityClient.js.map +1 -0
- package/dist/index.d.ts +42 -3
- package/dist/index.js +11381 -3
- package/dist/index.js.map +1 -0
- package/dist/{lib/platform/sdk/learningClient.d.ts → learningClient.d.ts} +13 -7
- package/dist/learningClient.js +409 -0
- package/dist/learningClient.js.map +1 -0
- package/dist/{lib/platform/sdk/mcpParityClient.d.ts → mcpParityClient.d.ts} +10 -5
- package/dist/mcpParityClient.js +516 -0
- package/dist/mcpParityClient.js.map +1 -0
- package/dist/mcpParitySurface.d.ts +12 -0
- package/dist/mcpParitySurface.js +65 -0
- package/dist/mcpParitySurface.js.map +1 -0
- package/dist/mcpTools-DPZxowDX.d.ts +254 -0
- package/dist/{lib/platform/sdk/ontologyClient.d.ts → ontologyClient.d.ts} +28 -22
- package/dist/ontologyClient.js +513 -0
- package/dist/ontologyClient.js.map +1 -0
- package/dist/packRuntime.d.ts +2 -0
- package/dist/packRuntime.js +3 -0
- package/dist/packRuntime.js.map +1 -0
- package/dist/{lib/platform/sdk/packsClient.d.ts → packsClient.d.ts} +34 -29
- package/dist/packsClient.js +525 -0
- package/dist/packsClient.js.map +1 -0
- package/dist/{lib/platform/sdk/policyClient.d.ts → policyClient.d.ts} +26 -20
- package/dist/policyClient.js +625 -0
- package/dist/policyClient.js.map +1 -0
- package/dist/realtime/index.d.ts +29 -0
- package/dist/realtime/index.js +23 -0
- package/dist/realtime/index.js.map +1 -0
- package/dist/realtime/refs.d.ts +17 -0
- package/dist/realtime/refs.js +9 -0
- package/dist/realtime/refs.js.map +1 -0
- package/dist/reportsClient.d.ts +41 -0
- package/dist/reportsClient.js +418 -0
- package/dist/reportsClient.js.map +1 -0
- package/dist/{lib/platform/sdk/schemaClient.d.ts → schemaClient.d.ts} +20 -15
- package/dist/schemaClient.js +434 -0
- package/dist/schemaClient.js.map +1 -0
- package/dist/sdkSurface.d.ts +61 -0
- package/dist/sdkSurface.js +112 -0
- package/dist/sdkSurface.js.map +1 -0
- package/dist/sdkTools-CwXJDACb.d.ts +150 -0
- package/dist/{lib/platform/sdk/topicsClient.d.ts → topicsClient.d.ts} +24 -18
- package/dist/topicsClient.js +492 -0
- package/dist/topicsClient.js.map +1 -0
- package/dist/{lib/platform/sdk/types.d.ts → types.d.ts} +84 -80
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/{lib/platform/sdk/workflowClient.d.ts → workflowClient.d.ts} +60 -57
- package/dist/workflowClient.js +830 -0
- package/dist/workflowClient.js.map +1 -0
- package/package.json +25 -43
- package/dist/.generated +0 -2
- package/dist/lib/platform/auth/credentials.d.ts +0 -5
- package/dist/lib/platform/auth/credentials.js +0 -40
- package/dist/lib/platform/sdk/adminClient.js +0 -384
- package/dist/lib/platform/sdk/answersClient.d.ts +0 -16
- package/dist/lib/platform/sdk/answersClient.js +0 -21
- package/dist/lib/platform/sdk/audiencesClient.js +0 -111
- package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
- package/dist/lib/platform/sdk/auditClient.js +0 -21
- package/dist/lib/platform/sdk/beliefsClient.js +0 -124
- package/dist/lib/platform/sdk/client.js +0 -1831
- package/dist/lib/platform/sdk/contextClient.js +0 -86
- package/dist/lib/platform/sdk/contextFacade.d.ts +0 -10
- package/dist/lib/platform/sdk/contextFacade.js +0 -10
- package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
- package/dist/lib/platform/sdk/contextTypes.js +0 -1
- package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
- package/dist/lib/platform/sdk/coreClient.js +0 -366
- package/dist/lib/platform/sdk/customTools.js +0 -247
- package/dist/lib/platform/sdk/decisionsClient.js +0 -129
- package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
- package/dist/lib/platform/sdk/domainContext.js +0 -1
- package/dist/lib/platform/sdk/events.d.ts +0 -176
- package/dist/lib/platform/sdk/events.js +0 -261
- package/dist/lib/platform/sdk/eventsCore.d.ts +0 -13
- package/dist/lib/platform/sdk/eventsCore.js +0 -13
- package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
- package/dist/lib/platform/sdk/graphClient.js +0 -235
- package/dist/lib/platform/sdk/harnessClient.js +0 -219
- package/dist/lib/platform/sdk/identityClient.js +0 -131
- package/dist/lib/platform/sdk/index.d.ts +0 -49
- package/dist/lib/platform/sdk/index.js +0 -49
- package/dist/lib/platform/sdk/learningClient.js +0 -53
- package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
- package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
- package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
- package/dist/lib/platform/sdk/ontologyClient.js +0 -161
- package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
- package/dist/lib/platform/sdk/packRuntime.js +0 -1
- package/dist/lib/platform/sdk/packsClient.js +0 -157
- package/dist/lib/platform/sdk/policyClient.js +0 -277
- package/dist/lib/platform/sdk/promptCatalog.d.ts +0 -1
- package/dist/lib/platform/sdk/promptCatalog.js +0 -1
- package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
- package/dist/lib/platform/sdk/reportsClient.js +0 -64
- package/dist/lib/platform/sdk/schemaClient.js +0 -71
- package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
- package/dist/lib/platform/sdk/sdkSurface.js +0 -140
- package/dist/lib/platform/sdk/topicsClient.js +0 -118
- package/dist/lib/platform/sdk/types.js +0 -1
- package/dist/lib/platform/sdk/version.d.ts +0 -2
- package/dist/lib/platform/sdk/version.js +0 -2
- package/dist/lib/platform/sdk/workflowClient.js +0 -366
- package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
- package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
- package/dist/lucern/contracts/src/auth-context.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-context.contract.js +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.js +0 -8
- package/dist/lucern/contracts/src/auth.contract.d.ts +0 -88
- package/dist/lucern/contracts/src/auth.contract.js +0 -57
- package/dist/lucern/contracts/src/context-pack.contract.js +0 -169
- package/dist/lucern/contracts/src/convex-admin.contract.d.ts +0 -5
- package/dist/lucern/contracts/src/convex-admin.contract.js +0 -1
- package/dist/lucern/contracts/src/events-types.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/events-types.contract.js +0 -8
- package/dist/lucern/contracts/src/events.contract.d.ts +0 -176
- package/dist/lucern/contracts/src/events.contract.js +0 -159
- package/dist/lucern/contracts/src/gateway.contract.d.ts +0 -74
- package/dist/lucern/contracts/src/gateway.contract.js +0 -19
- package/dist/lucern/contracts/src/ids.contract.d.ts +0 -7
- package/dist/lucern/contracts/src/ids.contract.js +0 -24
- package/dist/lucern/contracts/src/index.d.ts +0 -29
- package/dist/lucern/contracts/src/index.js +0 -29
- package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
- package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
- package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
- package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
- package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
- package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/ontology-matching.contract.js +0 -8
- package/dist/lucern/contracts/src/prompt.contract.js +0 -24
- package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +0 -358
- package/dist/lucern/contracts/src/sdk-methods.contract.js +0 -19
- package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +0 -92
- package/dist/lucern/contracts/src/sdk-tools.contract.js +0 -1398
- package/dist/lucern/contracts/src/text-matching.contract.d.ts +0 -53
- package/dist/lucern/contracts/src/text-matching.contract.js +0 -277
- package/dist/lucern/contracts/src/topic-scope.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/topic-scope.contract.js +0 -8
- package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
- package/dist/lucern/contracts/src/workflow-runtime.contract.js +0 -257
- package/dist/realtime-refs.d.ts +0 -1
- package/dist/realtime-refs.js +0 -1
- package/dist/realtime.d.ts +0 -1
- package/dist/realtime.js +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
1
|
+
import { GatewayClientConfig, PlatformGatewaySuccess } from './coreClient.js';
|
|
2
|
+
export { LucernApiError } from './coreClient.js';
|
|
3
|
+
import { JsonObject, PlatformBeliefRecord, ModulateConfidenceResponse, ForkBeliefResponse } from './types.js';
|
|
4
|
+
export { CreateBeliefResponse } from './types.js';
|
|
5
|
+
import './contracts/workflow-runtime.contract.js';
|
|
6
|
+
import './contracts/lens-workflow.contract.js';
|
|
7
|
+
import './contracts/lens-filter.contract.js';
|
|
8
|
+
|
|
6
9
|
/** Configuration for the beliefs client. Inherits gateway transport settings. */
|
|
7
|
-
|
|
10
|
+
type BeliefsClientConfig = GatewayClientConfig;
|
|
8
11
|
/**
|
|
9
12
|
* Input for creating a new belief within a topic scope.
|
|
10
13
|
*
|
|
@@ -12,7 +15,7 @@ export type BeliefsClientConfig = GatewayClientConfig;
|
|
|
12
15
|
* `canonicalText` remains available as a legacy alias for backwards compatibility.
|
|
13
16
|
* Beliefs start as unscored drafts and can be scored via confidence modulation.
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
type CreateBeliefInput = {
|
|
16
19
|
topicId?: string;
|
|
17
20
|
/** Preferred belief statement alias. */
|
|
18
21
|
text?: string;
|
|
@@ -35,7 +38,7 @@ export type CreateBeliefInput = {
|
|
|
35
38
|
* Input for recording a confidence change on a belief.
|
|
36
39
|
* Confidence modulation is append-only — each call adds a new credence history entry.
|
|
37
40
|
*/
|
|
38
|
-
|
|
41
|
+
type ModulateConfidenceInput = {
|
|
39
42
|
confidence: number;
|
|
40
43
|
trigger?: "evidence_added" | "evidence_removed" | "contradiction_detected" | "contradiction_resolved" | "manual" | "decay" | "agent_assessment" | "merge_outcome" | "worktree_outcome" | "worktree_completed";
|
|
41
44
|
rationale: string;
|
|
@@ -45,13 +48,13 @@ export type ModulateConfidenceInput = {
|
|
|
45
48
|
* Input for forking a scored belief into a new formulation.
|
|
46
49
|
* Scored beliefs are immutable — fork to evolve understanding.
|
|
47
50
|
*/
|
|
48
|
-
|
|
51
|
+
type ForkBeliefInput = {
|
|
49
52
|
newFormulation: string;
|
|
50
53
|
forkReason?: "refinement" | "contradiction_response" | "scope_change" | "confidence_collapse" | "manual";
|
|
51
54
|
rationale?: string;
|
|
52
55
|
};
|
|
53
56
|
/** Input for changing a belief's lifecycle status. */
|
|
54
|
-
|
|
57
|
+
type UpdateBeliefStatusInput = {
|
|
55
58
|
id?: string;
|
|
56
59
|
nodeId?: string;
|
|
57
60
|
beliefId?: string;
|
|
@@ -59,14 +62,14 @@ export type UpdateBeliefStatusInput = {
|
|
|
59
62
|
reason?: string;
|
|
60
63
|
};
|
|
61
64
|
/** Input for updating a belief's rationale without refining its text. */
|
|
62
|
-
|
|
65
|
+
type UpdateBeliefRationaleInput = {
|
|
63
66
|
id?: string;
|
|
64
67
|
nodeId?: string;
|
|
65
68
|
beliefId?: string;
|
|
66
69
|
rationale?: string;
|
|
67
70
|
};
|
|
68
71
|
/** Input for creating a belief-to-belief reasoning edge. */
|
|
69
|
-
|
|
72
|
+
type LinkBeliefsInput = {
|
|
70
73
|
fromNodeId: string;
|
|
71
74
|
toNodeId: string;
|
|
72
75
|
edgeType: string;
|
|
@@ -74,7 +77,7 @@ export type LinkBeliefsInput = {
|
|
|
74
77
|
context?: string;
|
|
75
78
|
};
|
|
76
79
|
/** Input for unlinking a belief from an attached evidence item. */
|
|
77
|
-
|
|
80
|
+
type UnlinkBeliefEvidenceInput = {
|
|
78
81
|
beliefNodeId?: string;
|
|
79
82
|
beliefId?: string;
|
|
80
83
|
nodeId?: string;
|
|
@@ -82,14 +85,14 @@ export type UnlinkBeliefEvidenceInput = {
|
|
|
82
85
|
evidenceId?: string;
|
|
83
86
|
};
|
|
84
87
|
/** Input for updating a belief's criticality classification. */
|
|
85
|
-
|
|
88
|
+
type UpdateBeliefCriticalityInput = {
|
|
86
89
|
id?: string;
|
|
87
90
|
nodeId?: string;
|
|
88
91
|
beliefId?: string;
|
|
89
92
|
criticality: "blocking" | "important" | "supporting" | "essential" | "nice_to_have";
|
|
90
93
|
};
|
|
91
94
|
/** Input for bulk-updating multiple beliefs' criticality. */
|
|
92
|
-
|
|
95
|
+
type BatchUpdateBeliefCriticalityInput = {
|
|
93
96
|
updates: Array<{
|
|
94
97
|
beliefId: string;
|
|
95
98
|
criticality: "blocking" | "important" | "supporting" | "essential" | "nice_to_have";
|
|
@@ -101,7 +104,7 @@ export type BatchUpdateBeliefCriticalityInput = {
|
|
|
101
104
|
}>;
|
|
102
105
|
};
|
|
103
106
|
/** Input for moving beliefs into a different topic scope. */
|
|
104
|
-
|
|
107
|
+
type ReassignBeliefsTopicInput = {
|
|
105
108
|
beliefNodeIds?: string[];
|
|
106
109
|
beliefIds?: string[];
|
|
107
110
|
targetTopicId: string;
|
|
@@ -113,45 +116,47 @@ export type ReassignBeliefsTopicInput = {
|
|
|
113
116
|
* @param config - Gateway transport configuration.
|
|
114
117
|
* @returns An object with `createBelief`, `modulateConfidence`, and `forkBelief` methods.
|
|
115
118
|
*/
|
|
116
|
-
|
|
119
|
+
declare function createBeliefsClient(config?: BeliefsClientConfig): {
|
|
117
120
|
/**
|
|
118
121
|
* Create a belief within a topic scope.
|
|
119
122
|
*/
|
|
120
|
-
createBelief(input: CreateBeliefInput, idempotencyKey?: string): Promise<
|
|
123
|
+
createBelief(input: CreateBeliefInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<PlatformBeliefRecord>>;
|
|
121
124
|
/**
|
|
122
125
|
* Record a confidence change for an existing belief.
|
|
123
126
|
*/
|
|
124
|
-
modulateConfidence(beliefId: string, input: ModulateConfidenceInput, idempotencyKey?: string): Promise<
|
|
127
|
+
modulateConfidence(beliefId: string, input: ModulateConfidenceInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<ModulateConfidenceResponse>>;
|
|
125
128
|
/**
|
|
126
129
|
* Fork a scored belief into a new formulation.
|
|
127
130
|
*/
|
|
128
|
-
forkBelief(beliefId: string, input: ForkBeliefInput, idempotencyKey?: string): Promise<
|
|
131
|
+
forkBelief(beliefId: string, input: ForkBeliefInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<ForkBeliefResponse>>;
|
|
129
132
|
/**
|
|
130
133
|
* Update a belief's lifecycle status.
|
|
131
134
|
*/
|
|
132
|
-
updateBeliefStatus(input: UpdateBeliefStatusInput, idempotencyKey?: string): Promise<
|
|
135
|
+
updateBeliefStatus(input: UpdateBeliefStatusInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
133
136
|
/**
|
|
134
137
|
* Update a belief's rationale without changing its text.
|
|
135
138
|
*/
|
|
136
|
-
updateBeliefRationale(input: UpdateBeliefRationaleInput, idempotencyKey?: string): Promise<
|
|
139
|
+
updateBeliefRationale(input: UpdateBeliefRationaleInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
137
140
|
/**
|
|
138
141
|
* Create a typed relationship between two beliefs.
|
|
139
142
|
*/
|
|
140
|
-
linkBeliefs(input: LinkBeliefsInput, idempotencyKey?: string): Promise<
|
|
143
|
+
linkBeliefs(input: LinkBeliefsInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
141
144
|
/**
|
|
142
145
|
* Remove an evidence attachment from a belief.
|
|
143
146
|
*/
|
|
144
|
-
unlinkBeliefEvidence(input: UnlinkBeliefEvidenceInput, idempotencyKey?: string): Promise<
|
|
147
|
+
unlinkBeliefEvidence(input: UnlinkBeliefEvidenceInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
145
148
|
/**
|
|
146
149
|
* Update a belief's criticality metadata.
|
|
147
150
|
*/
|
|
148
|
-
updateBeliefCriticality(input: UpdateBeliefCriticalityInput, idempotencyKey?: string): Promise<
|
|
151
|
+
updateBeliefCriticality(input: UpdateBeliefCriticalityInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
149
152
|
/**
|
|
150
153
|
* Update multiple beliefs' criticality in one mutation.
|
|
151
154
|
*/
|
|
152
|
-
batchUpdateBeliefCriticality(input: BatchUpdateBeliefCriticalityInput, idempotencyKey?: string): Promise<
|
|
155
|
+
batchUpdateBeliefCriticality(input: BatchUpdateBeliefCriticalityInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
153
156
|
/**
|
|
154
157
|
* Reassign beliefs to a different topic scope.
|
|
155
158
|
*/
|
|
156
|
-
reassignBeliefsTopic(input: ReassignBeliefsTopicInput, idempotencyKey?: string): Promise<
|
|
159
|
+
reassignBeliefsTopic(input: ReassignBeliefsTopicInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
157
160
|
};
|
|
161
|
+
|
|
162
|
+
export { type BatchUpdateBeliefCriticalityInput, type BeliefsClientConfig, type CreateBeliefInput, type ForkBeliefInput, ForkBeliefResponse, type LinkBeliefsInput, type ModulateConfidenceInput, ModulateConfidenceResponse, PlatformGatewaySuccess, type ReassignBeliefsTopicInput, type UnlinkBeliefEvidenceInput, type UpdateBeliefCriticalityInput, type UpdateBeliefRationaleInput, type UpdateBeliefStatusInput, createBeliefsClient };
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
// src/coreClient.ts
|
|
2
|
+
var LucernApiError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
status;
|
|
5
|
+
invariant;
|
|
6
|
+
suggestion;
|
|
7
|
+
details;
|
|
8
|
+
requestId;
|
|
9
|
+
correlationId;
|
|
10
|
+
policyTraceId;
|
|
11
|
+
constructor(args) {
|
|
12
|
+
super(args.message);
|
|
13
|
+
this.name = "LucernApiError";
|
|
14
|
+
this.code = args.code;
|
|
15
|
+
this.status = args.status;
|
|
16
|
+
this.invariant = args.invariant;
|
|
17
|
+
this.suggestion = args.suggestion;
|
|
18
|
+
this.details = args.details;
|
|
19
|
+
this.requestId = args.requestId;
|
|
20
|
+
this.correlationId = args.correlationId;
|
|
21
|
+
this.policyTraceId = args.policyTraceId;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
function fillRandomBytes(length) {
|
|
25
|
+
const bytes = new Uint8Array(length);
|
|
26
|
+
if (typeof globalThis.crypto?.getRandomValues === "function") {
|
|
27
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
28
|
+
return bytes;
|
|
29
|
+
}
|
|
30
|
+
for (let index = 0; index < length; index += 1) {
|
|
31
|
+
bytes[index] = Math.floor(Math.random() * 256);
|
|
32
|
+
}
|
|
33
|
+
return bytes;
|
|
34
|
+
}
|
|
35
|
+
function generatePortableRequestId() {
|
|
36
|
+
if (typeof globalThis.crypto?.randomUUID === "function") {
|
|
37
|
+
return globalThis.crypto.randomUUID();
|
|
38
|
+
}
|
|
39
|
+
const bytes = fillRandomBytes(16);
|
|
40
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
41
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
42
|
+
const hex = Array.from(bytes, (value) => value.toString(16).padStart(2, "0"));
|
|
43
|
+
return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(
|
|
44
|
+
6,
|
|
45
|
+
8
|
|
46
|
+
).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
|
|
47
|
+
}
|
|
48
|
+
function randomIdempotencyKey() {
|
|
49
|
+
return generatePortableRequestId();
|
|
50
|
+
}
|
|
51
|
+
function isRetryableStatus(status) {
|
|
52
|
+
return status >= 500 || status === 408 || status === 429;
|
|
53
|
+
}
|
|
54
|
+
function fallbackErrorCode(status) {
|
|
55
|
+
if (status === 401) {
|
|
56
|
+
return "AUTHENTICATION_REQUIRED";
|
|
57
|
+
}
|
|
58
|
+
if (status === 403) {
|
|
59
|
+
return "FORBIDDEN";
|
|
60
|
+
}
|
|
61
|
+
if (status === 404) {
|
|
62
|
+
return "NOT_FOUND";
|
|
63
|
+
}
|
|
64
|
+
if (status === 408) {
|
|
65
|
+
return "UPSTREAM_ERROR";
|
|
66
|
+
}
|
|
67
|
+
if (status === 409) {
|
|
68
|
+
return "CONFLICT";
|
|
69
|
+
}
|
|
70
|
+
if (status === 429) {
|
|
71
|
+
return "RATE_LIMIT_EXCEEDED";
|
|
72
|
+
}
|
|
73
|
+
if (status >= 500) {
|
|
74
|
+
return "UPSTREAM_ERROR";
|
|
75
|
+
}
|
|
76
|
+
return "INTERNAL_ERROR";
|
|
77
|
+
}
|
|
78
|
+
function delay(ms) {
|
|
79
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
80
|
+
}
|
|
81
|
+
function parseRetryAfterMs(value) {
|
|
82
|
+
if (!value) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const trimmed = value.trim();
|
|
86
|
+
if (!trimmed) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const numeric = Number(trimmed);
|
|
90
|
+
if (Number.isFinite(numeric)) {
|
|
91
|
+
return Math.max(0, Math.round(numeric * 1e3));
|
|
92
|
+
}
|
|
93
|
+
const parsedDate = Date.parse(trimmed);
|
|
94
|
+
if (Number.isFinite(parsedDate)) {
|
|
95
|
+
return Math.max(0, parsedDate - Date.now());
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
function computeRetryDelayMs(args) {
|
|
100
|
+
const baseDelay = args.status === 429 ? Math.max(
|
|
101
|
+
args.retryAfterMs ?? 0,
|
|
102
|
+
Math.min(1e3 * 2 ** args.attempt, 1e4)
|
|
103
|
+
) : Math.min(1e3 * 2 ** args.attempt, 4e3);
|
|
104
|
+
if (args.status !== 429) {
|
|
105
|
+
return baseDelay;
|
|
106
|
+
}
|
|
107
|
+
const jitterWindow = Math.max(250, Math.round(baseDelay * 0.25));
|
|
108
|
+
return baseDelay + Math.round(Math.random() * jitterWindow);
|
|
109
|
+
}
|
|
110
|
+
function timeoutError(timeoutMs) {
|
|
111
|
+
const error = new Error(`Request timed out after ${timeoutMs}ms`);
|
|
112
|
+
error.name = "AbortError";
|
|
113
|
+
return error;
|
|
114
|
+
}
|
|
115
|
+
function readPolicySummaryFromDetails(details) {
|
|
116
|
+
if (!details || typeof details !== "object" || Array.isArray(details)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const directSummary = details.summary;
|
|
120
|
+
if (typeof directSummary === "string" && directSummary.trim().length > 0) {
|
|
121
|
+
return directSummary.trim();
|
|
122
|
+
}
|
|
123
|
+
const policy = details.policy;
|
|
124
|
+
if (!policy || typeof policy !== "object" || Array.isArray(policy)) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const explanation = policy.explanation;
|
|
128
|
+
if (!explanation || typeof explanation !== "object" || Array.isArray(explanation)) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
const nestedSummary = explanation.summary;
|
|
132
|
+
if (typeof nestedSummary === "string" && nestedSummary.trim().length > 0) {
|
|
133
|
+
return nestedSummary.trim();
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
function createGatewayRequestClient(config = {}) {
|
|
138
|
+
const fetchImpl = config.fetchImpl ?? fetch;
|
|
139
|
+
const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
140
|
+
const maxRetries = config.maxRetries ?? 2;
|
|
141
|
+
const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
|
|
142
|
+
async function resolveAuthHeaders() {
|
|
143
|
+
if (!config.getAuthHeaders) {
|
|
144
|
+
return {};
|
|
145
|
+
}
|
|
146
|
+
return await config.getAuthHeaders();
|
|
147
|
+
}
|
|
148
|
+
async function fetchWithTimeout(url, init, timeoutMs) {
|
|
149
|
+
const controller = new AbortController();
|
|
150
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
151
|
+
try {
|
|
152
|
+
return await fetchImpl(url, { ...init, signal: controller.signal });
|
|
153
|
+
} catch (error) {
|
|
154
|
+
if (controller.signal.aborted) {
|
|
155
|
+
throw timeoutError(timeoutMs);
|
|
156
|
+
}
|
|
157
|
+
throw error;
|
|
158
|
+
} finally {
|
|
159
|
+
clearTimeout(timer);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function parsePayload(response) {
|
|
163
|
+
const text = await response.text();
|
|
164
|
+
if (!text) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
return JSON.parse(text);
|
|
169
|
+
} catch {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function resolveTimeoutMs(method, requestTimeoutMs) {
|
|
174
|
+
if (typeof requestTimeoutMs === "number") {
|
|
175
|
+
return requestTimeoutMs;
|
|
176
|
+
}
|
|
177
|
+
const methodTimeoutMs = config.timeoutMsByMethod?.[method];
|
|
178
|
+
if (typeof methodTimeoutMs === "number") {
|
|
179
|
+
return methodTimeoutMs;
|
|
180
|
+
}
|
|
181
|
+
return config.timeoutMs ?? 15e3;
|
|
182
|
+
}
|
|
183
|
+
function buildApiError(args) {
|
|
184
|
+
const failure = args.failure;
|
|
185
|
+
const legacyError = failure && typeof failure.error === "object" && failure.error !== null ? failure.error : failure?.legacyError;
|
|
186
|
+
const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
|
|
187
|
+
const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
|
|
188
|
+
const details = failure?.details ?? legacyError?.details;
|
|
189
|
+
const policySummary = readPolicySummaryFromDetails(details);
|
|
190
|
+
return new LucernApiError({
|
|
191
|
+
code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
|
|
192
|
+
message: policySummary ?? (typeof failure?.error === "string" ? failure.error : legacyError?.message ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed.")),
|
|
193
|
+
status: args.response.status,
|
|
194
|
+
invariant: failure?.invariant,
|
|
195
|
+
suggestion: failure?.suggestion,
|
|
196
|
+
details,
|
|
197
|
+
requestId: args.requestId,
|
|
198
|
+
correlationId,
|
|
199
|
+
policyTraceId
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
async function request(args) {
|
|
203
|
+
const authHeaders = await resolveAuthHeaders();
|
|
204
|
+
const method = args.method ?? "GET";
|
|
205
|
+
const timeoutMs = resolveTimeoutMs(method, args.timeoutMs);
|
|
206
|
+
const headers = new Headers({
|
|
207
|
+
"content-type": "application/json",
|
|
208
|
+
...authHeaders
|
|
209
|
+
});
|
|
210
|
+
if (args.idempotencyKey) {
|
|
211
|
+
headers.set("idempotency-key", args.idempotencyKey);
|
|
212
|
+
}
|
|
213
|
+
const requestId = headers.get("x-correlation-id")?.trim() || headers.get("x-request-id")?.trim() || args.requestId || requestIdFactory();
|
|
214
|
+
if (!headers.has("x-correlation-id") && !headers.has("x-request-id")) {
|
|
215
|
+
headers.set("x-correlation-id", requestId);
|
|
216
|
+
}
|
|
217
|
+
const url = `${baseUrl}${args.path}`;
|
|
218
|
+
const serializedBody = args.body ? JSON.stringify(args.body) : void 0;
|
|
219
|
+
const init = {
|
|
220
|
+
method,
|
|
221
|
+
headers,
|
|
222
|
+
body: serializedBody
|
|
223
|
+
};
|
|
224
|
+
let lastError;
|
|
225
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
226
|
+
const hookRequestContext = {
|
|
227
|
+
requestId,
|
|
228
|
+
attempt,
|
|
229
|
+
maxRetries,
|
|
230
|
+
method,
|
|
231
|
+
path: args.path,
|
|
232
|
+
url,
|
|
233
|
+
headers: new Headers(headers),
|
|
234
|
+
body: serializedBody,
|
|
235
|
+
timeoutMs
|
|
236
|
+
};
|
|
237
|
+
await config.onRequest?.(hookRequestContext);
|
|
238
|
+
const startedAt = Date.now();
|
|
239
|
+
try {
|
|
240
|
+
const response = await fetchWithTimeout(url, init, timeoutMs);
|
|
241
|
+
const responseClone = response.clone();
|
|
242
|
+
const payload = await parsePayload(response);
|
|
243
|
+
const retryAfterMs = parseRetryAfterMs(
|
|
244
|
+
response.headers.get("Retry-After")
|
|
245
|
+
);
|
|
246
|
+
if (!response.ok || !payload?.success) {
|
|
247
|
+
const failure = payload && !payload.success ? payload : null;
|
|
248
|
+
const apiError = buildApiError({
|
|
249
|
+
requestId,
|
|
250
|
+
response,
|
|
251
|
+
failure
|
|
252
|
+
});
|
|
253
|
+
const willRetry = attempt < maxRetries && isRetryableStatus(response.status);
|
|
254
|
+
await config.onResponse?.({
|
|
255
|
+
...hookRequestContext,
|
|
256
|
+
durationMs: Date.now() - startedAt,
|
|
257
|
+
status: response.status,
|
|
258
|
+
response: responseClone,
|
|
259
|
+
error: apiError,
|
|
260
|
+
correlationId: apiError.correlationId ?? requestId,
|
|
261
|
+
policyTraceId: apiError.policyTraceId ?? null,
|
|
262
|
+
retryAfterMs,
|
|
263
|
+
willRetry
|
|
264
|
+
});
|
|
265
|
+
if (willRetry) {
|
|
266
|
+
lastError = apiError;
|
|
267
|
+
await delay(
|
|
268
|
+
computeRetryDelayMs({
|
|
269
|
+
attempt,
|
|
270
|
+
status: response.status,
|
|
271
|
+
retryAfterMs
|
|
272
|
+
})
|
|
273
|
+
);
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
throw apiError;
|
|
277
|
+
}
|
|
278
|
+
const successPayload = payload;
|
|
279
|
+
await config.onResponse?.({
|
|
280
|
+
...hookRequestContext,
|
|
281
|
+
durationMs: Date.now() - startedAt,
|
|
282
|
+
status: response.status,
|
|
283
|
+
response: responseClone,
|
|
284
|
+
correlationId: successPayload.correlationId ?? response.headers.get("x-lucern-correlation-id")?.trim() ?? requestId,
|
|
285
|
+
policyTraceId: successPayload.policyTraceId ?? response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null,
|
|
286
|
+
idempotentReplay: successPayload.idempotentReplay,
|
|
287
|
+
retryAfterMs,
|
|
288
|
+
willRetry: false
|
|
289
|
+
});
|
|
290
|
+
return successPayload;
|
|
291
|
+
} catch (fetchError) {
|
|
292
|
+
if (fetchError instanceof LucernApiError) {
|
|
293
|
+
throw fetchError;
|
|
294
|
+
}
|
|
295
|
+
const willRetry = attempt < maxRetries;
|
|
296
|
+
await config.onResponse?.({
|
|
297
|
+
...hookRequestContext,
|
|
298
|
+
durationMs: Date.now() - startedAt,
|
|
299
|
+
error: fetchError,
|
|
300
|
+
correlationId: requestId,
|
|
301
|
+
policyTraceId: null,
|
|
302
|
+
willRetry
|
|
303
|
+
});
|
|
304
|
+
lastError = fetchError;
|
|
305
|
+
if (willRetry) {
|
|
306
|
+
await delay(computeRetryDelayMs({ attempt }));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
throw lastError instanceof Error ? lastError : new Error("Platform API request failed after retries.");
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
request
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// src/sdkSurface.ts
|
|
318
|
+
function cleanString(value) {
|
|
319
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
320
|
+
}
|
|
321
|
+
function normalizeVerificationStatus(value) {
|
|
322
|
+
const status = cleanString(value);
|
|
323
|
+
if (!status) {
|
|
324
|
+
return void 0;
|
|
325
|
+
}
|
|
326
|
+
if (status === "verified") {
|
|
327
|
+
return "human_verified";
|
|
328
|
+
}
|
|
329
|
+
if (status === "rejected") {
|
|
330
|
+
return "contradicted";
|
|
331
|
+
}
|
|
332
|
+
return status;
|
|
333
|
+
}
|
|
334
|
+
function resolveTopicId(value) {
|
|
335
|
+
return cleanString(value.topicId);
|
|
336
|
+
}
|
|
337
|
+
function resolveText(value) {
|
|
338
|
+
return cleanString(value.text) ?? cleanString(value.canonicalText);
|
|
339
|
+
}
|
|
340
|
+
function normalizeNodeWriteInput(value) {
|
|
341
|
+
const topicId = resolveTopicId(value);
|
|
342
|
+
const text = resolveText(value);
|
|
343
|
+
const verificationStatus = normalizeVerificationStatus(value.verificationStatus);
|
|
344
|
+
const next = { ...value };
|
|
345
|
+
if (topicId) {
|
|
346
|
+
next.topicId = topicId;
|
|
347
|
+
}
|
|
348
|
+
if (text) {
|
|
349
|
+
next.text = text;
|
|
350
|
+
next.canonicalText = text;
|
|
351
|
+
}
|
|
352
|
+
if (verificationStatus) {
|
|
353
|
+
next.verificationStatus = verificationStatus;
|
|
354
|
+
}
|
|
355
|
+
return next;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// src/beliefsClient.ts
|
|
359
|
+
function createBeliefsClient(config = {}) {
|
|
360
|
+
const gateway = createGatewayRequestClient(config);
|
|
361
|
+
return {
|
|
362
|
+
/**
|
|
363
|
+
* Create a belief within a topic scope.
|
|
364
|
+
*/
|
|
365
|
+
async createBelief(input, idempotencyKey) {
|
|
366
|
+
return gateway.request({
|
|
367
|
+
path: "/api/platform/v1/beliefs",
|
|
368
|
+
method: "POST",
|
|
369
|
+
body: normalizeNodeWriteInput(input),
|
|
370
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
371
|
+
});
|
|
372
|
+
},
|
|
373
|
+
/**
|
|
374
|
+
* Record a confidence change for an existing belief.
|
|
375
|
+
*/
|
|
376
|
+
async modulateConfidence(beliefId, input, idempotencyKey) {
|
|
377
|
+
return gateway.request({
|
|
378
|
+
path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence`,
|
|
379
|
+
method: "POST",
|
|
380
|
+
body: input,
|
|
381
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
382
|
+
});
|
|
383
|
+
},
|
|
384
|
+
/**
|
|
385
|
+
* Fork a scored belief into a new formulation.
|
|
386
|
+
*/
|
|
387
|
+
async forkBelief(beliefId, input, idempotencyKey) {
|
|
388
|
+
return gateway.request({
|
|
389
|
+
path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/fork`,
|
|
390
|
+
method: "POST",
|
|
391
|
+
body: input,
|
|
392
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
393
|
+
});
|
|
394
|
+
},
|
|
395
|
+
/**
|
|
396
|
+
* Update a belief's lifecycle status.
|
|
397
|
+
*/
|
|
398
|
+
async updateBeliefStatus(input, idempotencyKey) {
|
|
399
|
+
return gateway.request({
|
|
400
|
+
path: "/api/platform/v1/beliefs/update-status",
|
|
401
|
+
method: "POST",
|
|
402
|
+
body: input,
|
|
403
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
404
|
+
});
|
|
405
|
+
},
|
|
406
|
+
/**
|
|
407
|
+
* Update a belief's rationale without changing its text.
|
|
408
|
+
*/
|
|
409
|
+
async updateBeliefRationale(input, idempotencyKey) {
|
|
410
|
+
return gateway.request({
|
|
411
|
+
path: "/api/platform/v1/beliefs/update-rationale",
|
|
412
|
+
method: "POST",
|
|
413
|
+
body: input,
|
|
414
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
415
|
+
});
|
|
416
|
+
},
|
|
417
|
+
/**
|
|
418
|
+
* Create a typed relationship between two beliefs.
|
|
419
|
+
*/
|
|
420
|
+
async linkBeliefs(input, idempotencyKey) {
|
|
421
|
+
return gateway.request({
|
|
422
|
+
path: "/api/platform/v1/beliefs/link",
|
|
423
|
+
method: "POST",
|
|
424
|
+
body: input,
|
|
425
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
/**
|
|
429
|
+
* Remove an evidence attachment from a belief.
|
|
430
|
+
*/
|
|
431
|
+
async unlinkBeliefEvidence(input, idempotencyKey) {
|
|
432
|
+
return gateway.request({
|
|
433
|
+
path: "/api/platform/v1/beliefs/unlink-evidence",
|
|
434
|
+
method: "POST",
|
|
435
|
+
body: input,
|
|
436
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
437
|
+
});
|
|
438
|
+
},
|
|
439
|
+
/**
|
|
440
|
+
* Update a belief's criticality metadata.
|
|
441
|
+
*/
|
|
442
|
+
async updateBeliefCriticality(input, idempotencyKey) {
|
|
443
|
+
return gateway.request({
|
|
444
|
+
path: "/api/platform/v1/beliefs/update-criticality",
|
|
445
|
+
method: "POST",
|
|
446
|
+
body: input,
|
|
447
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
448
|
+
});
|
|
449
|
+
},
|
|
450
|
+
/**
|
|
451
|
+
* Update multiple beliefs' criticality in one mutation.
|
|
452
|
+
*/
|
|
453
|
+
async batchUpdateBeliefCriticality(input, idempotencyKey) {
|
|
454
|
+
return gateway.request({
|
|
455
|
+
path: "/api/platform/v1/beliefs/batch-update-criticality",
|
|
456
|
+
method: "POST",
|
|
457
|
+
body: input,
|
|
458
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
/**
|
|
462
|
+
* Reassign beliefs to a different topic scope.
|
|
463
|
+
*/
|
|
464
|
+
async reassignBeliefsTopic(input, idempotencyKey) {
|
|
465
|
+
return gateway.request({
|
|
466
|
+
path: "/api/platform/v1/beliefs/reassign-topic",
|
|
467
|
+
method: "POST",
|
|
468
|
+
body: input,
|
|
469
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export { LucernApiError, createBeliefsClient };
|
|
476
|
+
//# sourceMappingURL=beliefsClient.js.map
|
|
477
|
+
//# sourceMappingURL=beliefsClient.js.map
|