@lucern/sdk 0.2.0-alpha.5 → 0.2.0-alpha.7
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/.turbo/turbo-build.log +7 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +13 -0
- package/examples/README.md +69 -0
- package/examples/contradiction.ts +94 -0
- package/examples/investigation-context.ts +118 -0
- package/examples/questions-and-tasks.ts +55 -0
- package/examples/quickstart.ts +97 -0
- package/examples/shared.ts +318 -0
- package/examples/strict-public-types.ts +143 -0
- package/examples/worktree-lifecycle.ts +79 -0
- package/package.json +16 -59
- package/src/README.md +6 -0
- package/src/adminClient.ts +789 -0
- package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
- package/src/audiencesClient.ts +209 -0
- package/src/auditClient.ts +50 -0
- package/src/beliefsClient.ts +319 -0
- package/src/client.ts +2647 -0
- package/src/contextClient.ts +130 -0
- package/src/contextFacade.ts +15 -0
- package/src/contextPackCompiler.ts +828 -0
- package/src/contextPackSchema.ts +251 -0
- package/src/contextTypes.ts +153 -0
- package/src/contracts/api-enums.contract.ts +202 -0
- package/src/contracts/auth-session.contract.ts +109 -0
- package/src/contracts/context-pack.contract.ts +700 -0
- package/src/contracts/contextPack.ts +1 -0
- package/src/contracts/index.ts +10 -0
- package/src/contracts/lens-filter.contract.ts +183 -0
- package/src/contracts/lens-workflow.contract.ts +162 -0
- package/src/contracts/lensFilter.ts +1 -0
- package/src/contracts/lensWorkflow.ts +1 -0
- package/src/contracts/mcp-tools.contract.ts +3636 -0
- package/src/contracts/mcpTools.ts +1 -0
- package/src/contracts/prompt.contract.ts +50 -0
- package/src/contracts/prompt.ts +1 -0
- package/src/contracts/sdk-tools.contract.ts +1457 -0
- package/src/contracts/sdkTools.ts +1 -0
- package/src/contracts/workflow-runtime.contract.ts +440 -0
- package/src/contracts/workflowRuntime.ts +1 -0
- package/src/controlObjectOwnership.ts +286 -0
- package/src/coreClient.ts +570 -0
- package/src/customTools.ts +398 -0
- package/src/decisionsClient.ts +286 -0
- package/src/domainContext.ts +15 -0
- package/src/events.ts +531 -0
- package/src/eventsCore.ts +168 -0
- package/src/facade/beliefs.ts +83 -0
- package/src/facade/context.ts +110 -0
- package/src/facade/contradictions.ts +29 -0
- package/src/facade/edges.ts +30 -0
- package/src/facade/events.ts +23 -0
- package/src/facade/evidence.ts +41 -0
- package/src/facade/graph.ts +38 -0
- package/src/facade/identity.ts +16 -0
- package/src/facade/ontologies.ts +34 -0
- package/src/facade/questions.ts +59 -0
- package/src/facade/search.ts +16 -0
- package/src/facade/tasks.ts +37 -0
- package/src/facade/topics.ts +42 -0
- package/src/facade/webhooks.ts +58 -0
- package/src/facade/worktrees.ts +51 -0
- package/src/gatewayFacades.ts +1666 -0
- package/src/graphClient.ts +529 -0
- package/src/harnessClient.ts +585 -0
- package/src/identityClient.ts +278 -0
- package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +3 -0
- package/src/learningClient.ts +95 -0
- package/src/mcpParityClient.ts +240 -0
- package/src/mcpParitySurface.ts +70 -0
- package/src/ontologyClient.ts +275 -0
- package/src/packRuntime.ts +3 -0
- package/src/packsClient.ts +260 -0
- package/src/policyClient.ts +572 -0
- package/src/promptCatalog.ts +1 -0
- package/src/realtime/index.ts +51 -0
- package/src/realtime/refs.ts +17 -0
- package/src/reportsClient.ts +99 -0
- package/src/schemaClient.ts +129 -0
- package/src/sdkSurface.ts +190 -0
- package/src/topicsClient.ts +243 -0
- package/src/types.ts +807 -0
- package/src/workflowClient.ts +826 -0
- package/tsconfig.json +9 -0
- package/dist/.generated +0 -2
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- 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.d.ts +0 -404
- package/dist/lib/platform/sdk/adminClient.js +0 -384
- package/dist/lib/platform/sdk/answersClient.js +0 -21
- package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
- 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.d.ts +0 -157
- package/dist/lib/platform/sdk/beliefsClient.js +0 -124
- package/dist/lib/platform/sdk/client.d.ts +0 -2369
- package/dist/lib/platform/sdk/client.js +0 -1831
- package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
- package/dist/lib/platform/sdk/contextClient.js +0 -86
- package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
- package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
- package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
- package/dist/lib/platform/sdk/contextTypes.js +0 -1
- package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
- package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
- package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
- package/dist/lib/platform/sdk/coreClient.js +0 -366
- package/dist/lib/platform/sdk/customTools.d.ts +0 -83
- package/dist/lib/platform/sdk/customTools.js +0 -247
- package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
- 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/gatewayFacades.d.ts +0 -586
- package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
- package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
- package/dist/lib/platform/sdk/graphClient.js +0 -235
- package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
- package/dist/lib/platform/sdk/harnessClient.js +0 -219
- package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
- package/dist/lib/platform/sdk/identityClient.js +0 -131
- package/dist/lib/platform/sdk/index.js +0 -46
- package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
- package/dist/lib/platform/sdk/learningClient.js +0 -53
- package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
- 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.d.ts +0 -131
- 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.d.ts +0 -126
- package/dist/lib/platform/sdk/packsClient.js +0 -157
- package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
- 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.d.ts +0 -59
- 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.d.ts +0 -78
- package/dist/lib/platform/sdk/topicsClient.js +0 -118
- package/dist/lib/platform/sdk/types.d.ts +0 -692
- package/dist/lib/platform/sdk/types.js +0 -1
- package/dist/lib/platform/sdk/version.d.ts +0 -2
- package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
- 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/lens-filter.contract.d.ts +0 -70
- 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/lib/platform/sdk/version.js → src/version.ts} +0 -0
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { type GatewayClientConfig, LucernApiError } from "./coreClient";
|
|
2
|
-
import type { DeleteEdgeResponse, GraphAnalyticsMetric, GraphAnalyticsResponse, GraphNeighborhoodResponse, GraphPathResponse, JsonObject, ListResult, PlatformGraphEdge, PlatformGraphNode, TextAliasInput, TopicIdentifierInput } from "./types";
|
|
3
|
-
export { LucernApiError };
|
|
4
|
-
export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
|
|
5
|
-
export type { CreateEdgeResponse, CreateNodeResponse, DeleteEdgeResponse, GraphAnalyticsMetric, GraphAnalyticsResponse, GraphNeighborhoodResponse, GraphPathResponse, ListResult, QueryEdgesResponse, QueryNodesResponse, UpdateNodeResponse, } from "./types";
|
|
6
|
-
/** Configuration for the graph client. */
|
|
7
|
-
export type GraphClientConfig = GatewayClientConfig;
|
|
8
|
-
/** Filter parameters for listing graph nodes. */
|
|
9
|
-
export type ListNodesInput = {
|
|
10
|
-
nodeId?: string;
|
|
11
|
-
globalId?: string;
|
|
12
|
-
topicId?: string;
|
|
13
|
-
nodeType?: string;
|
|
14
|
-
limit?: number;
|
|
15
|
-
} & TopicIdentifierInput;
|
|
16
|
-
/** Paginated list response containing graph nodes. */
|
|
17
|
-
export type ListNodesResponse = ListResult<PlatformGraphNode, "nodes">;
|
|
18
|
-
/** @deprecated Use ListNodesInput. */
|
|
19
|
-
export type QueryNodesInput = ListNodesInput;
|
|
20
|
-
/** Input for creating a new graph node. */
|
|
21
|
-
export type CreateNodeInput = {
|
|
22
|
-
text?: string;
|
|
23
|
-
/** @deprecated Use text. */
|
|
24
|
-
canonicalText?: string;
|
|
25
|
-
nodeType: string;
|
|
26
|
-
topicId?: string;
|
|
27
|
-
content?: string;
|
|
28
|
-
contentHash?: string;
|
|
29
|
-
globalId?: string;
|
|
30
|
-
sourceType?: string;
|
|
31
|
-
subtype?: string;
|
|
32
|
-
title?: string;
|
|
33
|
-
confidence?: number;
|
|
34
|
-
status?: string;
|
|
35
|
-
tags?: string[];
|
|
36
|
-
metadata?: JsonObject;
|
|
37
|
-
verificationStatus?: string;
|
|
38
|
-
} & TextAliasInput & TopicIdentifierInput;
|
|
39
|
-
/** Input for updating an existing graph node. */
|
|
40
|
-
export type UpdateNodeInput = {
|
|
41
|
-
nodeId: string;
|
|
42
|
-
text?: string;
|
|
43
|
-
canonicalText?: string;
|
|
44
|
-
content?: string;
|
|
45
|
-
contentHash?: string;
|
|
46
|
-
title?: string;
|
|
47
|
-
subtype?: string;
|
|
48
|
-
confidence?: number;
|
|
49
|
-
status?: string;
|
|
50
|
-
tags?: string[];
|
|
51
|
-
metadata?: JsonObject;
|
|
52
|
-
verificationStatus?: string;
|
|
53
|
-
} & TextAliasInput;
|
|
54
|
-
/** Input for retrieving a single graph node by canonical identifier. */
|
|
55
|
-
export type GetNodeInput = {
|
|
56
|
-
nodeId?: string;
|
|
57
|
-
globalId?: string;
|
|
58
|
-
};
|
|
59
|
-
/** Filter parameters for listing graph edges. */
|
|
60
|
-
export type ListEdgesInput = {
|
|
61
|
-
edgeId?: string;
|
|
62
|
-
topicId?: string;
|
|
63
|
-
fromNodeId?: string;
|
|
64
|
-
toNodeId?: string;
|
|
65
|
-
edgeType?: string;
|
|
66
|
-
limit?: number;
|
|
67
|
-
} & TopicIdentifierInput;
|
|
68
|
-
/** Paginated list response containing graph edges. */
|
|
69
|
-
export type ListEdgesResponse = ListResult<PlatformGraphEdge, "edges">;
|
|
70
|
-
/** @deprecated Use ListEdgesInput. */
|
|
71
|
-
export type QueryEdgesInput = ListEdgesInput;
|
|
72
|
-
/** Input for creating a typed edge between two graph nodes. */
|
|
73
|
-
export type CreateEdgeInput = {
|
|
74
|
-
fromNodeId: string;
|
|
75
|
-
toNodeId: string;
|
|
76
|
-
edgeType: string;
|
|
77
|
-
globalId?: string;
|
|
78
|
-
topicId?: string;
|
|
79
|
-
confidence?: number;
|
|
80
|
-
weight?: number;
|
|
81
|
-
context?: string;
|
|
82
|
-
derivationType?: string;
|
|
83
|
-
} & TopicIdentifierInput;
|
|
84
|
-
/** Filter for selecting edges to delete. */
|
|
85
|
-
export type DeleteEdgeInput = {
|
|
86
|
-
edgeId?: string;
|
|
87
|
-
fromNodeId?: string;
|
|
88
|
-
toNodeId?: string;
|
|
89
|
-
edgeType?: string;
|
|
90
|
-
};
|
|
91
|
-
/** Input for batch-creating multiple graph nodes. */
|
|
92
|
-
export type BatchCreateNodesInput = {
|
|
93
|
-
nodes: Array<CreateNodeInput>;
|
|
94
|
-
};
|
|
95
|
-
/** Input for superseding an existing graph node with a new version. */
|
|
96
|
-
export type SupersedeNodeInput = {
|
|
97
|
-
oldNodeId?: string;
|
|
98
|
-
nodeId?: string;
|
|
99
|
-
newGlobalId?: string;
|
|
100
|
-
newCanonicalText?: string;
|
|
101
|
-
text?: string;
|
|
102
|
-
canonicalText?: string;
|
|
103
|
-
newContentHash?: string;
|
|
104
|
-
reason?: string;
|
|
105
|
-
};
|
|
106
|
-
/** Input for updating a node's verification state. */
|
|
107
|
-
export type VerifyNodeInput = {
|
|
108
|
-
nodeId?: string;
|
|
109
|
-
id?: string;
|
|
110
|
-
verificationStatus: string;
|
|
111
|
-
confidence?: number;
|
|
112
|
-
};
|
|
113
|
-
/** Input for permanently deleting a node via admin-only API. */
|
|
114
|
-
export type HardDeleteNodeInput = {
|
|
115
|
-
nodeId?: string;
|
|
116
|
-
id?: string;
|
|
117
|
-
reason: string;
|
|
118
|
-
allowBeliefHardDelete?: boolean;
|
|
119
|
-
};
|
|
120
|
-
/** Input for retrieving the local neighborhood around a graph node. */
|
|
121
|
-
export type NeighborhoodInput = {
|
|
122
|
-
globalId?: string;
|
|
123
|
-
globalIds?: string;
|
|
124
|
-
maxDepth?: number;
|
|
125
|
-
};
|
|
126
|
-
/** Input for finding the shortest path between two graph nodes. */
|
|
127
|
-
export type PathInput = {
|
|
128
|
-
fromGlobalId: string;
|
|
129
|
-
toGlobalId: string;
|
|
130
|
-
maxDepth?: number;
|
|
131
|
-
};
|
|
132
|
-
/** Input for retrieving a specific graph analytics metric. */
|
|
133
|
-
export type AnalyticsInput = {
|
|
134
|
-
metric?: GraphAnalyticsMetric;
|
|
135
|
-
limit?: number;
|
|
136
|
-
};
|
|
137
|
-
/** Input for traversing the graph from a starting node. */
|
|
138
|
-
export type TraverseInput = {
|
|
139
|
-
startNode: string;
|
|
140
|
-
direction?: string;
|
|
141
|
-
maxDepth?: number;
|
|
142
|
-
topicId?: string;
|
|
143
|
-
} & TopicIdentifierInput;
|
|
144
|
-
/** Input for structural analysis of a topic graph. */
|
|
145
|
-
export type AnalyzeInput = {
|
|
146
|
-
topicId?: string;
|
|
147
|
-
metric?: GraphAnalyticsMetric;
|
|
148
|
-
limit?: number;
|
|
149
|
-
} & TopicIdentifierInput;
|
|
150
|
-
/** Input for detecting confirmation-bias patterns in a topic graph. */
|
|
151
|
-
export type BiasInput = {
|
|
152
|
-
topicId?: string;
|
|
153
|
-
threshold?: number;
|
|
154
|
-
limit?: number;
|
|
155
|
-
} & TopicIdentifierInput;
|
|
156
|
-
/** Input for finding beliefs without sufficient testing questions. */
|
|
157
|
-
export type GapsInput = {
|
|
158
|
-
topicId?: string;
|
|
159
|
-
minConfidence?: number;
|
|
160
|
-
} & TopicIdentifierInput;
|
|
161
|
-
/** Input for cross-resource search within a topic scope. */
|
|
162
|
-
export type SearchInput = {
|
|
163
|
-
q?: string;
|
|
164
|
-
query?: string;
|
|
165
|
-
topicId?: string;
|
|
166
|
-
types?: string[];
|
|
167
|
-
status?: string;
|
|
168
|
-
minConfidence?: number;
|
|
169
|
-
limit?: number;
|
|
170
|
-
cursor?: string;
|
|
171
|
-
} & TopicIdentifierInput;
|
|
172
|
-
/**
|
|
173
|
-
* Create the low-level graph client for nodes, edges, and graph analytics.
|
|
174
|
-
* @param config - Gateway transport configuration.
|
|
175
|
-
* @returns An object with methods for CRUD on nodes/edges plus analytics, traversal, and search.
|
|
176
|
-
*/
|
|
177
|
-
export declare function createGraphClient(config?: GraphClientConfig): {
|
|
178
|
-
/**
|
|
179
|
-
* List graph nodes matching the provided filters.
|
|
180
|
-
*/
|
|
181
|
-
listNodes(query: ListNodesInput): Promise<import("./coreClient").PlatformGatewaySuccess<ListResult<PlatformGraphNode, "nodes">>>;
|
|
182
|
-
/**
|
|
183
|
-
* @deprecated Use listNodes.
|
|
184
|
-
*/
|
|
185
|
-
queryNodes(query: QueryNodesInput): Promise<import("./coreClient").PlatformGatewaySuccess<ListResult<PlatformGraphNode, "nodes">>>;
|
|
186
|
-
/**
|
|
187
|
-
* Retrieve a single graph node by nodeId or globalId.
|
|
188
|
-
*/
|
|
189
|
-
getNode(query: GetNodeInput): Promise<import("./coreClient").PlatformGatewaySuccess<PlatformGraphNode>>;
|
|
190
|
-
/**
|
|
191
|
-
* Create a graph node.
|
|
192
|
-
*/
|
|
193
|
-
createNode(input: CreateNodeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<PlatformGraphNode>>;
|
|
194
|
-
/**
|
|
195
|
-
* Update a graph node.
|
|
196
|
-
*/
|
|
197
|
-
updateNode(input: UpdateNodeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<PlatformGraphNode>>;
|
|
198
|
-
/**
|
|
199
|
-
* Batch create graph nodes through the admin route surface.
|
|
200
|
-
*/
|
|
201
|
-
batchCreateNodes(input: BatchCreateNodesInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
202
|
-
/**
|
|
203
|
-
* Supersede an existing graph node with a new canonical version.
|
|
204
|
-
*/
|
|
205
|
-
supersedeNode(input: SupersedeNodeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
206
|
-
/**
|
|
207
|
-
* Update a node's verification status.
|
|
208
|
-
*/
|
|
209
|
-
verifyNode(input: VerifyNodeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
210
|
-
/**
|
|
211
|
-
* Permanently delete a node via the admin-only hard-delete route.
|
|
212
|
-
*/
|
|
213
|
-
hardDeleteNode(input: HardDeleteNodeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
214
|
-
/**
|
|
215
|
-
* List graph edges matching the provided filters.
|
|
216
|
-
*/
|
|
217
|
-
listEdges(query: ListEdgesInput): Promise<import("./coreClient").PlatformGatewaySuccess<ListResult<PlatformGraphEdge, "edges">>>;
|
|
218
|
-
/**
|
|
219
|
-
* @deprecated Use listEdges.
|
|
220
|
-
*/
|
|
221
|
-
queryEdges(query: QueryEdgesInput): Promise<import("./coreClient").PlatformGatewaySuccess<ListResult<PlatformGraphEdge, "edges">>>;
|
|
222
|
-
/**
|
|
223
|
-
* Create a graph edge.
|
|
224
|
-
*/
|
|
225
|
-
createEdge(input: CreateEdgeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<PlatformGraphEdge>>;
|
|
226
|
-
/**
|
|
227
|
-
* Delete one or more edges matching the provided filter.
|
|
228
|
-
*/
|
|
229
|
-
deleteEdge(query: DeleteEdgeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<DeleteEdgeResponse>>;
|
|
230
|
-
/**
|
|
231
|
-
* Retrieve a graph neighborhood around a root node.
|
|
232
|
-
*/
|
|
233
|
-
neighborhood(query: NeighborhoodInput): Promise<import("./coreClient").PlatformGatewaySuccess<GraphNeighborhoodResponse>>;
|
|
234
|
-
/**
|
|
235
|
-
* Traverse the graph from a starting node.
|
|
236
|
-
*/
|
|
237
|
-
traverse(query: TraverseInput): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
238
|
-
/**
|
|
239
|
-
* Analyze graph structure for a topic.
|
|
240
|
-
*/
|
|
241
|
-
analyze(query?: AnalyzeInput): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
242
|
-
/**
|
|
243
|
-
* Detect confirmation-bias patterns for a topic graph.
|
|
244
|
-
*/
|
|
245
|
-
bias(query?: BiasInput): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
246
|
-
/**
|
|
247
|
-
* Find graph gaps for beliefs that still need testing.
|
|
248
|
-
*/
|
|
249
|
-
gaps(query: GapsInput): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
250
|
-
/**
|
|
251
|
-
* Search across graph resources within a topic.
|
|
252
|
-
*/
|
|
253
|
-
search(query: SearchInput): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
254
|
-
/**
|
|
255
|
-
* Retrieve a graph neighborhood around a root node.
|
|
256
|
-
*/
|
|
257
|
-
getNeighborhood(query: NeighborhoodInput): Promise<import("./coreClient").PlatformGatewaySuccess<GraphNeighborhoodResponse>>;
|
|
258
|
-
/**
|
|
259
|
-
* Retrieve the shortest known path between two graph nodes.
|
|
260
|
-
*/
|
|
261
|
-
getPath(query: PathInput): Promise<import("./coreClient").PlatformGatewaySuccess<GraphPathResponse>>;
|
|
262
|
-
/**
|
|
263
|
-
* Retrieve graph analytics for the requested metric.
|
|
264
|
-
*/
|
|
265
|
-
getAnalytics(query?: AnalyticsInput): Promise<import("./coreClient").PlatformGatewaySuccess<GraphAnalyticsResponse>>;
|
|
266
|
-
};
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
|
|
2
|
-
import { mapAliasedList, mapGatewayData, normalizeNodeWriteInput, normalizeNodeVerificationStatus, normalizeTopicQuery, withSdkAliases, } from "./sdkSurface.js";
|
|
3
|
-
export { LucernApiError };
|
|
4
|
-
/**
|
|
5
|
-
* Create the low-level graph client for nodes, edges, and graph analytics.
|
|
6
|
-
* @param config - Gateway transport configuration.
|
|
7
|
-
* @returns An object with methods for CRUD on nodes/edges plus analytics, traversal, and search.
|
|
8
|
-
*/
|
|
9
|
-
export function createGraphClient(config = {}) {
|
|
10
|
-
const gateway = createGatewayRequestClient(config);
|
|
11
|
-
return {
|
|
12
|
-
/**
|
|
13
|
-
* List graph nodes matching the provided filters.
|
|
14
|
-
*/
|
|
15
|
-
async listNodes(query) {
|
|
16
|
-
return gateway.request({
|
|
17
|
-
path: `/api/platform/v1/graph/nodes${toQueryString(normalizeTopicQuery(query))}`,
|
|
18
|
-
}).then((response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes")));
|
|
19
|
-
},
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Use listNodes.
|
|
22
|
-
*/
|
|
23
|
-
async queryNodes(query) {
|
|
24
|
-
return this.listNodes(query);
|
|
25
|
-
},
|
|
26
|
-
/**
|
|
27
|
-
* Retrieve a single graph node by nodeId or globalId.
|
|
28
|
-
*/
|
|
29
|
-
async getNode(query) {
|
|
30
|
-
return gateway.request({
|
|
31
|
-
path: `/api/platform/v1/graph/nodes${toQueryString(query)}`,
|
|
32
|
-
}).then((response) => mapGatewayData(response, (data) => withSdkAliases(data)));
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* Create a graph node.
|
|
36
|
-
*/
|
|
37
|
-
async createNode(input, idempotencyKey) {
|
|
38
|
-
return gateway.request({
|
|
39
|
-
path: "/api/platform/v1/graph/nodes",
|
|
40
|
-
method: "POST",
|
|
41
|
-
body: normalizeNodeWriteInput(input),
|
|
42
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
43
|
-
}).then((response) => mapGatewayData(response, (data) => withSdkAliases(data)));
|
|
44
|
-
},
|
|
45
|
-
/**
|
|
46
|
-
* Update a graph node.
|
|
47
|
-
*/
|
|
48
|
-
async updateNode(input, idempotencyKey) {
|
|
49
|
-
return gateway.request({
|
|
50
|
-
path: "/api/platform/v1/graph/nodes",
|
|
51
|
-
method: "PUT",
|
|
52
|
-
body: normalizeNodeWriteInput(input),
|
|
53
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
54
|
-
}).then((response) => mapGatewayData(response, (data) => withSdkAliases(data)));
|
|
55
|
-
},
|
|
56
|
-
/**
|
|
57
|
-
* Batch create graph nodes through the admin route surface.
|
|
58
|
-
*/
|
|
59
|
-
async batchCreateNodes(input, idempotencyKey) {
|
|
60
|
-
return gateway.request({
|
|
61
|
-
path: "/api/platform/v1/graph/nodes/batch",
|
|
62
|
-
method: "POST",
|
|
63
|
-
body: {
|
|
64
|
-
nodes: input.nodes.map((node) => normalizeNodeWriteInput(node)),
|
|
65
|
-
},
|
|
66
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* Supersede an existing graph node with a new canonical version.
|
|
71
|
-
*/
|
|
72
|
-
async supersedeNode(input, idempotencyKey) {
|
|
73
|
-
return gateway.request({
|
|
74
|
-
path: "/api/platform/v1/graph/nodes/supersede",
|
|
75
|
-
method: "POST",
|
|
76
|
-
body: input,
|
|
77
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* Update a node's verification status.
|
|
82
|
-
*/
|
|
83
|
-
async verifyNode(input, idempotencyKey) {
|
|
84
|
-
const verificationStatus = normalizeNodeVerificationStatus(input.verificationStatus) ??
|
|
85
|
-
input.verificationStatus;
|
|
86
|
-
return gateway.request({
|
|
87
|
-
path: "/api/platform/v1/graph/nodes/verify",
|
|
88
|
-
method: "POST",
|
|
89
|
-
body: {
|
|
90
|
-
...input,
|
|
91
|
-
verificationStatus,
|
|
92
|
-
},
|
|
93
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
/**
|
|
97
|
-
* Permanently delete a node via the admin-only hard-delete route.
|
|
98
|
-
*/
|
|
99
|
-
async hardDeleteNode(input, idempotencyKey) {
|
|
100
|
-
return gateway.request({
|
|
101
|
-
path: "/api/platform/v1/graph/nodes/hard-delete",
|
|
102
|
-
method: "POST",
|
|
103
|
-
body: input,
|
|
104
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
/**
|
|
108
|
-
* List graph edges matching the provided filters.
|
|
109
|
-
*/
|
|
110
|
-
async listEdges(query) {
|
|
111
|
-
return gateway.request({
|
|
112
|
-
path: `/api/platform/v1/graph/edges${toQueryString(normalizeTopicQuery(query))}`,
|
|
113
|
-
}).then((response) => mapGatewayData(response, (data) => mapAliasedList(data, "edges")));
|
|
114
|
-
},
|
|
115
|
-
/**
|
|
116
|
-
* @deprecated Use listEdges.
|
|
117
|
-
*/
|
|
118
|
-
async queryEdges(query) {
|
|
119
|
-
return this.listEdges(query);
|
|
120
|
-
},
|
|
121
|
-
/**
|
|
122
|
-
* Create a graph edge.
|
|
123
|
-
*/
|
|
124
|
-
async createEdge(input, idempotencyKey) {
|
|
125
|
-
return gateway.request({
|
|
126
|
-
path: "/api/platform/v1/graph/edges",
|
|
127
|
-
method: "POST",
|
|
128
|
-
body: normalizeTopicQuery(input),
|
|
129
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
/**
|
|
133
|
-
* Delete one or more edges matching the provided filter.
|
|
134
|
-
*/
|
|
135
|
-
async deleteEdge(query, idempotencyKey) {
|
|
136
|
-
return gateway.request({
|
|
137
|
-
path: `/api/platform/v1/graph/edges${toQueryString(query)}`,
|
|
138
|
-
method: "DELETE",
|
|
139
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
/**
|
|
143
|
-
* Retrieve a graph neighborhood around a root node.
|
|
144
|
-
*/
|
|
145
|
-
async neighborhood(query) {
|
|
146
|
-
return gateway.request({
|
|
147
|
-
path: `/api/platform/v1/graph/neighborhood${toQueryString(query)}`,
|
|
148
|
-
});
|
|
149
|
-
},
|
|
150
|
-
/**
|
|
151
|
-
* Traverse the graph from a starting node.
|
|
152
|
-
*/
|
|
153
|
-
async traverse(query) {
|
|
154
|
-
return gateway.request({
|
|
155
|
-
path: "/api/platform/v1/graph/traverse",
|
|
156
|
-
method: "POST",
|
|
157
|
-
body: normalizeTopicQuery(query),
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
/**
|
|
161
|
-
* Analyze graph structure for a topic.
|
|
162
|
-
*/
|
|
163
|
-
async analyze(query = {}) {
|
|
164
|
-
const normalized = normalizeTopicQuery(query);
|
|
165
|
-
return gateway.request({
|
|
166
|
-
path: `/api/platform/v1/graph/analyze${toQueryString({
|
|
167
|
-
topicId: typeof normalized.topicId === "string" ? normalized.topicId : undefined,
|
|
168
|
-
metric: typeof normalized.metric === "string" ? normalized.metric : undefined,
|
|
169
|
-
limit: typeof normalized.limit === "number" ? normalized.limit : undefined,
|
|
170
|
-
})}`,
|
|
171
|
-
});
|
|
172
|
-
},
|
|
173
|
-
/**
|
|
174
|
-
* Detect confirmation-bias patterns for a topic graph.
|
|
175
|
-
*/
|
|
176
|
-
async bias(query = {}) {
|
|
177
|
-
const normalized = normalizeTopicQuery(query);
|
|
178
|
-
return gateway.request({
|
|
179
|
-
path: `/api/platform/v1/graph/bias${toQueryString({
|
|
180
|
-
topicId: typeof normalized.topicId === "string" ? normalized.topicId : undefined,
|
|
181
|
-
threshold: typeof normalized.threshold === "number"
|
|
182
|
-
? normalized.threshold
|
|
183
|
-
: undefined,
|
|
184
|
-
limit: typeof normalized.limit === "number" ? normalized.limit : undefined,
|
|
185
|
-
})}`,
|
|
186
|
-
});
|
|
187
|
-
},
|
|
188
|
-
/**
|
|
189
|
-
* Find graph gaps for beliefs that still need testing.
|
|
190
|
-
*/
|
|
191
|
-
async gaps(query) {
|
|
192
|
-
const normalized = normalizeTopicQuery(query);
|
|
193
|
-
return gateway.request({
|
|
194
|
-
path: `/api/platform/v1/graph/gaps${toQueryString({
|
|
195
|
-
topicId: typeof normalized.topicId === "string" ? normalized.topicId : undefined,
|
|
196
|
-
minConfidence: typeof normalized.minConfidence === "number"
|
|
197
|
-
? normalized.minConfidence
|
|
198
|
-
: undefined,
|
|
199
|
-
})}`,
|
|
200
|
-
});
|
|
201
|
-
},
|
|
202
|
-
/**
|
|
203
|
-
* Search across graph resources within a topic.
|
|
204
|
-
*/
|
|
205
|
-
async search(query) {
|
|
206
|
-
return gateway.request({
|
|
207
|
-
path: "/api/platform/v1/search",
|
|
208
|
-
method: "POST",
|
|
209
|
-
body: normalizeTopicQuery(query),
|
|
210
|
-
});
|
|
211
|
-
},
|
|
212
|
-
/**
|
|
213
|
-
* Retrieve a graph neighborhood around a root node.
|
|
214
|
-
*/
|
|
215
|
-
async getNeighborhood(query) {
|
|
216
|
-
return this.neighborhood(query);
|
|
217
|
-
},
|
|
218
|
-
/**
|
|
219
|
-
* Retrieve the shortest known path between two graph nodes.
|
|
220
|
-
*/
|
|
221
|
-
async getPath(query) {
|
|
222
|
-
return gateway.request({
|
|
223
|
-
path: `/api/platform/v1/graph/path${toQueryString(query)}`,
|
|
224
|
-
});
|
|
225
|
-
},
|
|
226
|
-
/**
|
|
227
|
-
* Retrieve graph analytics for the requested metric.
|
|
228
|
-
*/
|
|
229
|
-
async getAnalytics(query = {}) {
|
|
230
|
-
return gateway.request({
|
|
231
|
-
path: `/api/platform/v1/graph/analytics${toQueryString(query)}`,
|
|
232
|
-
});
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
}
|