@lucern/sdk 0.2.0-alpha.4 → 0.2.0-alpha.6
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/README.md +31 -0
- package/dist/.generated +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -8894
- package/dist/lib/platform/auth/credentials.d.ts +5 -0
- package/dist/lib/platform/auth/credentials.js +40 -0
- package/dist/lib/platform/sdk/adminClient.d.ts +404 -0
- package/dist/lib/platform/sdk/adminClient.js +384 -0
- package/dist/lib/platform/sdk/answersClient.d.ts +16 -0
- package/dist/lib/platform/sdk/answersClient.js +21 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/audiencesClient.d.ts +6 -0
- package/dist/lib/platform/sdk/audiencesClient.js +111 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/auditClient.d.ts +3 -0
- package/dist/lib/platform/sdk/auditClient.js +21 -0
- package/dist/lib/platform/sdk/beliefsClient.d.ts +157 -0
- package/dist/lib/platform/sdk/beliefsClient.js +124 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/client.d.ts +957 -146
- package/dist/lib/platform/sdk/client.js +1831 -0
- package/dist/lib/platform/sdk/contextClient.d.ts +21 -0
- package/dist/lib/platform/sdk/contextClient.js +86 -0
- package/dist/lib/platform/sdk/contextFacade.d.ts +10 -0
- package/dist/lib/platform/sdk/contextFacade.js +10 -0
- package/dist/{lucern/packages/domain-context/src/context-pack-compiler.d.ts → lib/platform/sdk/contextPackCompiler.d.ts} +2 -3
- package/dist/lib/platform/sdk/contextPackCompiler.js +534 -0
- package/dist/lib/platform/sdk/contextTypes.d.ts +133 -0
- package/dist/lib/platform/sdk/contextTypes.js +1 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/controlObjectOwnership.d.ts +15 -0
- package/dist/lib/platform/sdk/controlObjectOwnership.js +220 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/coreClient.d.ts +19 -0
- package/dist/lib/platform/sdk/coreClient.js +366 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/customTools.d.ts +21 -3
- package/dist/lib/platform/sdk/customTools.js +247 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/decisionsClient.d.ts +9 -0
- package/dist/lib/platform/sdk/decisionsClient.js +129 -0
- package/dist/lib/platform/sdk/domainContext.d.ts +1 -0
- package/dist/lib/platform/sdk/domainContext.js +1 -0
- package/dist/lib/platform/sdk/events.d.ts +176 -0
- package/dist/lib/platform/sdk/events.js +261 -0
- package/dist/lib/platform/sdk/eventsCore.d.ts +13 -0
- package/dist/lib/platform/sdk/eventsCore.js +13 -0
- package/dist/lib/platform/sdk/gatewayFacades.d.ts +586 -0
- package/dist/lib/platform/sdk/gatewayFacades.js +845 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/graphClient.d.ts +75 -0
- package/dist/lib/platform/sdk/graphClient.js +235 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/harnessClient.d.ts +90 -1
- package/dist/lib/platform/sdk/harnessClient.js +219 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/identityClient.d.ts +45 -15
- package/dist/lib/platform/sdk/identityClient.js +131 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/index.d.ts +24 -3
- package/dist/lib/platform/sdk/index.js +49 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/learningClient.d.ts +3 -0
- package/dist/lib/platform/sdk/learningClient.js +53 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/mcpParityClient.d.ts +1 -0
- package/dist/lib/platform/sdk/mcpParityClient.js +196 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/mcpParitySurface.d.ts +2 -0
- package/dist/lib/platform/sdk/mcpParitySurface.js +57 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/ontologyClient.d.ts +16 -0
- package/dist/lib/platform/sdk/ontologyClient.js +161 -0
- package/dist/lib/platform/sdk/packRuntime.d.ts +1 -0
- package/dist/lib/platform/sdk/packRuntime.js +1 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/packsClient.d.ts +25 -0
- package/dist/lib/platform/sdk/packsClient.js +157 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/policyClient.d.ts +90 -1
- package/dist/lib/platform/sdk/policyClient.js +277 -0
- package/dist/lib/platform/sdk/promptCatalog.d.ts +1 -0
- package/dist/lib/platform/sdk/promptCatalog.js +1 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/reportsClient.d.ts +3 -0
- package/dist/lib/platform/sdk/reportsClient.js +64 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/schemaClient.d.ts +5 -0
- package/dist/lib/platform/sdk/schemaClient.js +71 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/sdkSurface.d.ts +1 -0
- package/dist/lib/platform/sdk/sdkSurface.js +140 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/topicsClient.d.ts +33 -0
- package/dist/lib/platform/sdk/topicsClient.js +118 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/types.d.ts +224 -2
- package/dist/lib/platform/sdk/types.js +1 -0
- package/dist/lib/platform/sdk/version.js +2 -0
- package/dist/{packages/sdk/src → lib/platform/sdk}/workflowClient.d.ts +63 -2
- package/dist/lib/platform/sdk/workflowClient.js +366 -0
- package/dist/lucern/contracts/src/api-enums.contract.d.ts +58 -0
- package/dist/lucern/contracts/src/api-enums.contract.js +147 -0
- package/dist/lucern/contracts/src/auth-context.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/auth-context.contract.js +8 -0
- package/dist/lucern/contracts/src/auth-session.contract.d.ts +5 -50
- package/dist/lucern/contracts/src/auth-session.contract.js +8 -0
- package/dist/lucern/contracts/src/auth.contract.d.ts +88 -0
- package/dist/lucern/contracts/src/auth.contract.js +57 -0
- package/dist/lucern/contracts/src/context-pack.contract.js +169 -0
- package/dist/lucern/contracts/src/convex-admin.contract.d.ts +5 -0
- package/dist/lucern/contracts/src/convex-admin.contract.js +1 -0
- package/dist/lucern/contracts/src/events-types.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/events-types.contract.js +8 -0
- package/dist/lucern/{packages/events/src/types.d.ts → contracts/src/events.contract.d.ts} +25 -0
- package/dist/lucern/contracts/src/events.contract.js +159 -0
- package/dist/lucern/contracts/src/gateway.contract.d.ts +74 -0
- package/dist/lucern/contracts/src/gateway.contract.js +19 -0
- package/dist/lucern/contracts/src/ids.contract.js +24 -0
- package/dist/lucern/contracts/src/index.d.ts +29 -0
- package/dist/lucern/contracts/src/index.js +29 -0
- package/dist/lucern/contracts/src/lens-filter.contract.js +95 -0
- package/dist/lucern/contracts/src/lens-workflow.contract.js +54 -0
- package/dist/lucern/contracts/src/mcp-tools.contract.js +3281 -0
- package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/ontology-matching.contract.js +8 -0
- package/dist/lucern/contracts/src/prompt.contract.d.ts +24 -0
- package/dist/lucern/contracts/src/prompt.contract.js +24 -0
- package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +358 -0
- package/dist/lucern/contracts/src/sdk-methods.contract.js +19 -0
- package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +92 -0
- package/dist/lucern/contracts/src/sdk-tools.contract.js +1398 -0
- package/dist/lucern/contracts/src/text-matching.contract.js +277 -0
- package/dist/lucern/contracts/src/topic-scope.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/topic-scope.contract.js +8 -0
- package/dist/lucern/contracts/src/workflow-runtime.contract.js +257 -0
- package/dist/realtime-refs.d.ts +1 -0
- package/dist/realtime-refs.js +1 -0
- package/dist/realtime.d.ts +1 -0
- package/dist/realtime.js +1 -0
- package/package.json +18 -5
- package/dist/index.js.map +0 -1
- package/dist/lucern/mcp-server/src/context-pack-policy.d.ts +0 -119
- package/dist/lucern/mcp-server/src/context-pack-schema.d.ts +0 -18
- package/dist/lucern/modules/graph-primitives/src/ontology-matching.d.ts +0 -78
- package/dist/lucern/packages/client-core/src/beliefs.d.ts +0 -30
- package/dist/lucern/packages/client-core/src/context.d.ts +0 -29
- package/dist/lucern/packages/client-core/src/contradictions.d.ts +0 -11
- package/dist/lucern/packages/client-core/src/edges.d.ts +0 -11
- package/dist/lucern/packages/client-core/src/events.d.ts +0 -9
- package/dist/lucern/packages/client-core/src/evidence.d.ts +0 -21
- package/dist/lucern/packages/client-core/src/graph.d.ts +0 -17
- package/dist/lucern/packages/client-core/src/identity.d.ts +0 -7
- package/dist/lucern/packages/client-core/src/ontologies.d.ts +0 -13
- package/dist/lucern/packages/client-core/src/questions.d.ts +0 -39
- package/dist/lucern/packages/client-core/src/search.d.ts +0 -7
- package/dist/lucern/packages/client-core/src/tasks.d.ts +0 -13
- package/dist/lucern/packages/client-core/src/topics.d.ts +0 -17
- package/dist/lucern/packages/client-core/src/webhooks.d.ts +0 -35
- package/dist/lucern/packages/client-core/src/worktrees.d.ts +0 -17
- package/dist/lucern/packages/domain-beliefs/src/beliefs.d.ts +0 -283
- package/dist/lucern/packages/domain-beliefs/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-context/src/compile.d.ts +0 -11
- package/dist/lucern/packages/domain-context/src/index.d.ts +0 -4
- package/dist/lucern/packages/domain-context/src/ports.d.ts +0 -58
- package/dist/lucern/packages/domain-context/src/public-types.d.ts +0 -1
- package/dist/lucern/packages/domain-edges/src/contradictions.d.ts +0 -59
- package/dist/lucern/packages/domain-edges/src/edges.d.ts +0 -91
- package/dist/lucern/packages/domain-edges/src/index.d.ts +0 -2
- package/dist/lucern/packages/domain-evidence/src/evidence.d.ts +0 -115
- package/dist/lucern/packages/domain-evidence/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-graph/src/graph.d.ts +0 -150
- package/dist/lucern/packages/domain-identity/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-identity/src/whoami.d.ts +0 -13
- package/dist/lucern/packages/domain-ontologies/src/ontologies.d.ts +0 -123
- package/dist/lucern/packages/domain-questions/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-questions/src/questions.d.ts +0 -147
- package/dist/lucern/packages/domain-search/src/search.d.ts +0 -97
- package/dist/lucern/packages/domain-tasks/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-tasks/src/tasks.d.ts +0 -102
- package/dist/lucern/packages/domain-topics/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-topics/src/topics.d.ts +0 -147
- package/dist/lucern/packages/domain-worktrees/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-worktrees/src/worktrees.d.ts +0 -185
- package/dist/lucern/packages/events/src/index.d.ts +0 -4
- package/dist/lucern/packages/events/src/matching.d.ts +0 -3
- package/dist/lucern/packages/events/src/outbox.d.ts +0 -15
- package/dist/lucern/packages/events/src/webhooks.d.ts +0 -9
- package/dist/lucern/packages/sdk-typescript/src/facade/beliefs.d.ts +0 -15
- package/dist/lucern/packages/sdk-typescript/src/facade/context.d.ts +0 -12
- package/dist/lucern/packages/sdk-typescript/src/facade/contradictions.d.ts +0 -7
- package/dist/lucern/packages/sdk-typescript/src/facade/edges.d.ts +0 -7
- package/dist/lucern/packages/sdk-typescript/src/facade/events.d.ts +0 -6
- package/dist/lucern/packages/sdk-typescript/src/facade/evidence.d.ts +0 -21
- package/dist/lucern/packages/sdk-typescript/src/facade/graph.d.ts +0 -10
- package/dist/lucern/packages/sdk-typescript/src/facade/identity.d.ts +0 -5
- package/dist/lucern/packages/sdk-typescript/src/facade/ontologies.d.ts +0 -8
- package/dist/lucern/packages/sdk-typescript/src/facade/questions.d.ts +0 -39
- package/dist/lucern/packages/sdk-typescript/src/facade/search.d.ts +0 -5
- package/dist/lucern/packages/sdk-typescript/src/facade/tasks.d.ts +0 -8
- package/dist/lucern/packages/sdk-typescript/src/facade/topics.d.ts +0 -10
- package/dist/lucern/packages/sdk-typescript/src/facade/webhooks.d.ts +0 -16
- package/dist/lucern/packages/sdk-typescript/src/facade/worktrees.d.ts +0 -10
- package/dist/lucern/packages/sdk-typescript/src/index.d.ts +0 -28
- package/dist/packages/sdk/src/adminClient.d.ts +0 -89
- package/dist/packages/sdk/src/answersClient.d.ts +0 -5
- package/dist/packages/sdk/src/beliefsClient.d.ts +0 -52
- package/dist/packages/sdk/src/contextClient.d.ts +0 -9
- package/dist/packages/sdk/src/contracts/api-enums.contract.d.ts +0 -79
- /package/dist/{packages/sdk/src → lib/platform/sdk}/version.d.ts +0 -0
- /package/dist/lucern/{packages/client-core/src/ids.d.ts → contracts/src/ids.contract.d.ts} +0 -0
- /package/dist/lucern/{modules/graph-primitives/src/text-matching.d.ts → contracts/src/text-matching.contract.d.ts} +0 -0
|
@@ -3,7 +3,9 @@ import type { DeleteEdgeResponse, GraphAnalyticsMetric, GraphAnalyticsResponse,
|
|
|
3
3
|
export { LucernApiError };
|
|
4
4
|
export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
|
|
5
5
|
export type { CreateEdgeResponse, CreateNodeResponse, DeleteEdgeResponse, GraphAnalyticsMetric, GraphAnalyticsResponse, GraphNeighborhoodResponse, GraphPathResponse, ListResult, QueryEdgesResponse, QueryNodesResponse, UpdateNodeResponse, } from "./types";
|
|
6
|
+
/** Configuration for the graph client. */
|
|
6
7
|
export type GraphClientConfig = GatewayClientConfig;
|
|
8
|
+
/** Filter parameters for listing graph nodes. */
|
|
7
9
|
export type ListNodesInput = {
|
|
8
10
|
nodeId?: string;
|
|
9
11
|
globalId?: string;
|
|
@@ -11,8 +13,11 @@ export type ListNodesInput = {
|
|
|
11
13
|
nodeType?: string;
|
|
12
14
|
limit?: number;
|
|
13
15
|
} & TopicIdentifierInput;
|
|
16
|
+
/** Paginated list response containing graph nodes. */
|
|
14
17
|
export type ListNodesResponse = ListResult<PlatformGraphNode, "nodes">;
|
|
18
|
+
/** @deprecated Use ListNodesInput. */
|
|
15
19
|
export type QueryNodesInput = ListNodesInput;
|
|
20
|
+
/** Input for creating a new graph node. */
|
|
16
21
|
export type CreateNodeInput = {
|
|
17
22
|
text?: string;
|
|
18
23
|
/** @deprecated Use text. */
|
|
@@ -31,6 +36,7 @@ export type CreateNodeInput = {
|
|
|
31
36
|
metadata?: JsonObject;
|
|
32
37
|
verificationStatus?: string;
|
|
33
38
|
} & TextAliasInput & TopicIdentifierInput;
|
|
39
|
+
/** Input for updating an existing graph node. */
|
|
34
40
|
export type UpdateNodeInput = {
|
|
35
41
|
nodeId: string;
|
|
36
42
|
text?: string;
|
|
@@ -45,6 +51,12 @@ export type UpdateNodeInput = {
|
|
|
45
51
|
metadata?: JsonObject;
|
|
46
52
|
verificationStatus?: string;
|
|
47
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. */
|
|
48
60
|
export type ListEdgesInput = {
|
|
49
61
|
edgeId?: string;
|
|
50
62
|
topicId?: string;
|
|
@@ -53,8 +65,11 @@ export type ListEdgesInput = {
|
|
|
53
65
|
edgeType?: string;
|
|
54
66
|
limit?: number;
|
|
55
67
|
} & TopicIdentifierInput;
|
|
68
|
+
/** Paginated list response containing graph edges. */
|
|
56
69
|
export type ListEdgesResponse = ListResult<PlatformGraphEdge, "edges">;
|
|
70
|
+
/** @deprecated Use ListEdgesInput. */
|
|
57
71
|
export type QueryEdgesInput = ListEdgesInput;
|
|
72
|
+
/** Input for creating a typed edge between two graph nodes. */
|
|
58
73
|
export type CreateEdgeInput = {
|
|
59
74
|
fromNodeId: string;
|
|
60
75
|
toNodeId: string;
|
|
@@ -66,46 +81,84 @@ export type CreateEdgeInput = {
|
|
|
66
81
|
context?: string;
|
|
67
82
|
derivationType?: string;
|
|
68
83
|
} & TopicIdentifierInput;
|
|
84
|
+
/** Filter for selecting edges to delete. */
|
|
69
85
|
export type DeleteEdgeInput = {
|
|
70
86
|
edgeId?: string;
|
|
71
87
|
fromNodeId?: string;
|
|
72
88
|
toNodeId?: string;
|
|
73
89
|
edgeType?: string;
|
|
74
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. */
|
|
75
121
|
export type NeighborhoodInput = {
|
|
76
122
|
globalId?: string;
|
|
77
123
|
globalIds?: string;
|
|
78
124
|
maxDepth?: number;
|
|
79
125
|
};
|
|
126
|
+
/** Input for finding the shortest path between two graph nodes. */
|
|
80
127
|
export type PathInput = {
|
|
81
128
|
fromGlobalId: string;
|
|
82
129
|
toGlobalId: string;
|
|
83
130
|
maxDepth?: number;
|
|
84
131
|
};
|
|
132
|
+
/** Input for retrieving a specific graph analytics metric. */
|
|
85
133
|
export type AnalyticsInput = {
|
|
86
134
|
metric?: GraphAnalyticsMetric;
|
|
87
135
|
limit?: number;
|
|
88
136
|
};
|
|
137
|
+
/** Input for traversing the graph from a starting node. */
|
|
89
138
|
export type TraverseInput = {
|
|
90
139
|
startNode: string;
|
|
91
140
|
direction?: string;
|
|
92
141
|
maxDepth?: number;
|
|
93
142
|
topicId?: string;
|
|
94
143
|
} & TopicIdentifierInput;
|
|
144
|
+
/** Input for structural analysis of a topic graph. */
|
|
95
145
|
export type AnalyzeInput = {
|
|
96
146
|
topicId?: string;
|
|
97
147
|
metric?: GraphAnalyticsMetric;
|
|
98
148
|
limit?: number;
|
|
99
149
|
} & TopicIdentifierInput;
|
|
150
|
+
/** Input for detecting confirmation-bias patterns in a topic graph. */
|
|
100
151
|
export type BiasInput = {
|
|
101
152
|
topicId?: string;
|
|
102
153
|
threshold?: number;
|
|
103
154
|
limit?: number;
|
|
104
155
|
} & TopicIdentifierInput;
|
|
156
|
+
/** Input for finding beliefs without sufficient testing questions. */
|
|
105
157
|
export type GapsInput = {
|
|
106
158
|
topicId?: string;
|
|
107
159
|
minConfidence?: number;
|
|
108
160
|
} & TopicIdentifierInput;
|
|
161
|
+
/** Input for cross-resource search within a topic scope. */
|
|
109
162
|
export type SearchInput = {
|
|
110
163
|
q?: string;
|
|
111
164
|
query?: string;
|
|
@@ -118,6 +171,8 @@ export type SearchInput = {
|
|
|
118
171
|
} & TopicIdentifierInput;
|
|
119
172
|
/**
|
|
120
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.
|
|
121
176
|
*/
|
|
122
177
|
export declare function createGraphClient(config?: GraphClientConfig): {
|
|
123
178
|
/**
|
|
@@ -128,6 +183,10 @@ export declare function createGraphClient(config?: GraphClientConfig): {
|
|
|
128
183
|
* @deprecated Use listNodes.
|
|
129
184
|
*/
|
|
130
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>>;
|
|
131
190
|
/**
|
|
132
191
|
* Create a graph node.
|
|
133
192
|
*/
|
|
@@ -136,6 +195,22 @@ export declare function createGraphClient(config?: GraphClientConfig): {
|
|
|
136
195
|
* Update a graph node.
|
|
137
196
|
*/
|
|
138
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>>>;
|
|
139
214
|
/**
|
|
140
215
|
* List graph edges matching the provided filters.
|
|
141
216
|
*/
|
|
@@ -0,0 +1,235 @@
|
|
|
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
|
+
}
|
|
@@ -2,7 +2,23 @@ import { type GatewayClientConfig, type GatewayScope, LucernApiError } from "./c
|
|
|
2
2
|
import type { JsonObject, JsonValue, TopicIdentifierInput } from "./types";
|
|
3
3
|
export { LucernApiError };
|
|
4
4
|
export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
|
|
5
|
+
/** Configuration for the harness client. Inherits gateway transport settings. */
|
|
5
6
|
export type HarnessClientConfig = GatewayClientConfig;
|
|
7
|
+
export type HarnessAgentGuardrails = {
|
|
8
|
+
isolationMode?: "direct" | "sandbox";
|
|
9
|
+
maxExecutionMs?: number;
|
|
10
|
+
heartbeatIntervalMs?: number;
|
|
11
|
+
maxToolCalls?: number;
|
|
12
|
+
allowNetworkEgress?: boolean;
|
|
13
|
+
allowedOrigins?: string[];
|
|
14
|
+
};
|
|
15
|
+
export type HarnessAgentRuntimeConfig = {
|
|
16
|
+
entryPoint?: string;
|
|
17
|
+
callbackUrl?: string;
|
|
18
|
+
modelRouting?: "model_machine" | "tenant_proxy" | "bring_your_own";
|
|
19
|
+
auditMode?: "harness" | "master_control";
|
|
20
|
+
};
|
|
21
|
+
/** Input for creating or updating an agent definition in the harness registry. */
|
|
6
22
|
export type HarnessAgentWriteInput = GatewayScope & {
|
|
7
23
|
agentDefinitionId?: string;
|
|
8
24
|
agentKey: string;
|
|
@@ -13,13 +29,22 @@ export type HarnessAgentWriteInput = GatewayScope & {
|
|
|
13
29
|
executionAdapter: "convex_mutation" | "convex_action" | "http_callback" | "mcp_tool" | "sdk_invocation" | "external_observed";
|
|
14
30
|
scopeRequirements?: string[];
|
|
15
31
|
promptReleaseChannel?: "dev" | "staging" | "prod";
|
|
32
|
+
promptName?: string;
|
|
33
|
+
systemPrompt?: string;
|
|
34
|
+
toolIds?: string[];
|
|
35
|
+
modelSlot?: string;
|
|
36
|
+
requiredModelCapabilities?: string[];
|
|
16
37
|
parameterSchema?: JsonObject;
|
|
38
|
+
outputSchema?: JsonObject;
|
|
39
|
+
guardrails?: HarnessAgentGuardrails;
|
|
40
|
+
runtimeConfig?: HarnessAgentRuntimeConfig;
|
|
17
41
|
exampleInvocations?: Array<{
|
|
18
42
|
input: JsonObject;
|
|
19
43
|
expectedOutput?: JsonValue;
|
|
20
44
|
}>;
|
|
21
45
|
metadata?: JsonObject;
|
|
22
46
|
};
|
|
47
|
+
/** Input for creating or updating a tool definition in the harness registry. */
|
|
23
48
|
export type HarnessToolWriteInput = GatewayScope & {
|
|
24
49
|
toolId?: string;
|
|
25
50
|
toolName: string;
|
|
@@ -48,17 +73,72 @@ export type HarnessToolWriteInput = GatewayScope & {
|
|
|
48
73
|
}>;
|
|
49
74
|
metadata?: JsonObject;
|
|
50
75
|
};
|
|
76
|
+
export type HarnessExecuteToolInput = GatewayScope & {
|
|
77
|
+
input?: JsonObject;
|
|
78
|
+
version?: string;
|
|
79
|
+
transportKind?: string;
|
|
80
|
+
};
|
|
81
|
+
export type HarnessExecuteToolResult = {
|
|
82
|
+
tool: {
|
|
83
|
+
toolId: string;
|
|
84
|
+
toolName: string;
|
|
85
|
+
version: string;
|
|
86
|
+
status: "active" | "deprecated" | "disabled";
|
|
87
|
+
executionAdapter: "convex_mutation" | "convex_action" | "http_callback" | "mcp_tool" | "sdk_invocation" | "external_observed";
|
|
88
|
+
gateClassification: "core" | "shimmed";
|
|
89
|
+
scopeRequirements: string[];
|
|
90
|
+
safetyMetadata: {
|
|
91
|
+
readOnly: boolean;
|
|
92
|
+
idempotent: boolean;
|
|
93
|
+
sideEffectLevel: "none" | "low" | "high";
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
execution: {
|
|
97
|
+
input: JsonObject;
|
|
98
|
+
transportKind: string;
|
|
99
|
+
startedAt: number;
|
|
100
|
+
completedAt: number;
|
|
101
|
+
durationMs: number;
|
|
102
|
+
};
|
|
103
|
+
envelope: JsonObject | null;
|
|
104
|
+
audit: {
|
|
105
|
+
toolName: string;
|
|
106
|
+
contractName: string;
|
|
107
|
+
transportKind: string;
|
|
108
|
+
authMode: string;
|
|
109
|
+
requiredScopes: string[];
|
|
110
|
+
source: "gateway_envelope";
|
|
111
|
+
isError: boolean;
|
|
112
|
+
code?: string;
|
|
113
|
+
status?: number;
|
|
114
|
+
correlationId?: string | null;
|
|
115
|
+
policyTraceId?: string | null;
|
|
116
|
+
invariant?: string | null;
|
|
117
|
+
} | null;
|
|
118
|
+
output: {
|
|
119
|
+
isError: boolean;
|
|
120
|
+
parsed: JsonValue;
|
|
121
|
+
raw: JsonValue;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
/** Input for starting a new harness run (agent execution session). */
|
|
51
125
|
export type HarnessStartRunInput = GatewayScope & {
|
|
52
126
|
agentDefinitionId: string;
|
|
53
127
|
agentVersion: string;
|
|
54
128
|
executionAdapter: "convex_mutation" | "convex_action" | "http_callback" | "mcp_tool" | "sdk_invocation" | "external_observed";
|
|
55
129
|
promptReleaseChannel?: "dev" | "staging" | "prod";
|
|
56
130
|
chatId?: string;
|
|
57
|
-
|
|
131
|
+
worktreeId?: string;
|
|
58
132
|
topicId?: string;
|
|
59
133
|
langfuseTraceId?: string;
|
|
60
134
|
metadata?: JsonObject;
|
|
61
135
|
} & TopicIdentifierInput;
|
|
136
|
+
export type HarnessInvokeManagedAgentInput = GatewayScope & {
|
|
137
|
+
agentDefinitionId: string;
|
|
138
|
+
input?: JsonObject;
|
|
139
|
+
metadata?: JsonObject;
|
|
140
|
+
};
|
|
141
|
+
/** Input for reporting a ledger event (tool call, prompt resolution, or policy decision) within a run. */
|
|
62
142
|
export type HarnessRunReportInput = {
|
|
63
143
|
reportingToken: string;
|
|
64
144
|
type: "tool_call" | "prompt_resolution" | "policy_decision";
|
|
@@ -89,6 +169,7 @@ export type HarnessRunReportInput = {
|
|
|
89
169
|
details?: JsonValue;
|
|
90
170
|
};
|
|
91
171
|
};
|
|
172
|
+
/** Input for completing a harness run with a terminal status. */
|
|
92
173
|
export type HarnessCompleteRunInput = {
|
|
93
174
|
reportingToken: string;
|
|
94
175
|
status: "completed" | "failed" | "timeout";
|
|
@@ -126,6 +207,10 @@ export declare function createHarnessClient(config?: HarnessClientConfig): {
|
|
|
126
207
|
* Update an agent definition.
|
|
127
208
|
*/
|
|
128
209
|
updateAgentDefinition(agentId: string, input: HarnessAgentWriteInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
|
|
210
|
+
/**
|
|
211
|
+
* Invoke a managed agent definition.
|
|
212
|
+
*/
|
|
213
|
+
invokeManagedAgentDefinition(agentId: string, input: Omit<HarnessInvokeManagedAgentInput, "agentDefinitionId">, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
|
|
129
214
|
/**
|
|
130
215
|
* List runs for an agent definition.
|
|
131
216
|
*/
|
|
@@ -167,6 +252,10 @@ export declare function createHarnessClient(config?: HarnessClientConfig): {
|
|
|
167
252
|
* Update a tool definition.
|
|
168
253
|
*/
|
|
169
254
|
updateToolDefinition(toolId: string, input: HarnessToolWriteInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
|
|
255
|
+
/**
|
|
256
|
+
* Execute a tool definition.
|
|
257
|
+
*/
|
|
258
|
+
executeToolDefinition(toolId: string, input?: HarnessExecuteToolInput): Promise<import("./coreClient").PlatformGatewaySuccess<HarnessExecuteToolResult>>;
|
|
170
259
|
/**
|
|
171
260
|
* List run ledger entries.
|
|
172
261
|
*/
|