@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
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
|
|
2
|
+
import { createListResult, mapGatewayData, normalizeTopicQuery } from "./sdkSurface.js";
|
|
3
|
+
export { LucernApiError };
|
|
4
|
+
/**
|
|
5
|
+
* Create the harness client for agent and tool registry operations.
|
|
6
|
+
*/
|
|
7
|
+
export function createHarnessClient(config = {}) {
|
|
8
|
+
const gateway = createGatewayRequestClient(config);
|
|
9
|
+
return {
|
|
10
|
+
/**
|
|
11
|
+
* List agent definitions.
|
|
12
|
+
*/
|
|
13
|
+
async listAgentDefinitions(scope = {}) {
|
|
14
|
+
return gateway.request({
|
|
15
|
+
path: `/api/platform/v1/harness/agents${toQueryString(scope)}`,
|
|
16
|
+
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "agents")));
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* Get an agent definition.
|
|
20
|
+
*/
|
|
21
|
+
async getAgentDefinition(agentId, scope = {}) {
|
|
22
|
+
return gateway.request({
|
|
23
|
+
path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}${toQueryString(scope)}`,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Create an agent definition.
|
|
28
|
+
*/
|
|
29
|
+
async createAgentDefinition(input, idempotencyKey) {
|
|
30
|
+
return gateway.request({
|
|
31
|
+
path: "/api/platform/v1/harness/agents",
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: input,
|
|
34
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use createAgentDefinition.
|
|
39
|
+
*/
|
|
40
|
+
async registerAgentDefinition(input, idempotencyKey) {
|
|
41
|
+
return this.createAgentDefinition(input, idempotencyKey);
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Update an agent definition.
|
|
45
|
+
*/
|
|
46
|
+
async updateAgentDefinition(agentId, input, idempotencyKey) {
|
|
47
|
+
return gateway.request({
|
|
48
|
+
path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}`,
|
|
49
|
+
method: "PUT",
|
|
50
|
+
body: input,
|
|
51
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Invoke a managed agent definition.
|
|
56
|
+
*/
|
|
57
|
+
async invokeManagedAgentDefinition(agentId, input, idempotencyKey) {
|
|
58
|
+
return gateway.request({
|
|
59
|
+
path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}/runs`,
|
|
60
|
+
method: "POST",
|
|
61
|
+
body: {
|
|
62
|
+
agentDefinitionId: agentId,
|
|
63
|
+
...input,
|
|
64
|
+
},
|
|
65
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* List runs for an agent definition.
|
|
70
|
+
*/
|
|
71
|
+
async listAgentRuns(agentId, scope = {}) {
|
|
72
|
+
return gateway.request({
|
|
73
|
+
path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}/runs${toQueryString(scope)}`,
|
|
74
|
+
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "runs")));
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use listAgentRuns.
|
|
78
|
+
*/
|
|
79
|
+
async listRunsForAgent(agentId, scope = {}) {
|
|
80
|
+
return this.listAgentRuns(agentId, scope);
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* List tool definitions.
|
|
84
|
+
*/
|
|
85
|
+
async listToolDefinitions(scope = {}) {
|
|
86
|
+
return gateway.request({
|
|
87
|
+
path: `/api/platform/v1/harness/tools${toQueryString(scope)}`,
|
|
88
|
+
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "tools")));
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Get a tool definition.
|
|
92
|
+
*/
|
|
93
|
+
async getToolDefinition(toolId, scope = {}) {
|
|
94
|
+
return gateway.request({
|
|
95
|
+
path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}${toQueryString(scope)}`,
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Create a tool definition.
|
|
100
|
+
*/
|
|
101
|
+
async createToolDefinition(input, idempotencyKey) {
|
|
102
|
+
return gateway.request({
|
|
103
|
+
path: "/api/platform/v1/harness/tools",
|
|
104
|
+
method: "POST",
|
|
105
|
+
body: input,
|
|
106
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated Use createToolDefinition.
|
|
111
|
+
*/
|
|
112
|
+
async registerToolDefinition(input, idempotencyKey) {
|
|
113
|
+
return this.createToolDefinition(input, idempotencyKey);
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* Update a tool definition.
|
|
117
|
+
*/
|
|
118
|
+
async updateToolDefinition(toolId, input, idempotencyKey) {
|
|
119
|
+
return gateway.request({
|
|
120
|
+
path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}`,
|
|
121
|
+
method: "PUT",
|
|
122
|
+
body: input,
|
|
123
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* Execute a tool definition.
|
|
128
|
+
*/
|
|
129
|
+
async executeToolDefinition(toolId, input = {}) {
|
|
130
|
+
return gateway.request({
|
|
131
|
+
path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}/execute`,
|
|
132
|
+
method: "POST",
|
|
133
|
+
body: input,
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* List run ledger entries.
|
|
138
|
+
*/
|
|
139
|
+
async listRunEntries(scope = {}) {
|
|
140
|
+
return gateway.request({
|
|
141
|
+
path: `/api/platform/v1/harness/runs${toQueryString(scope)}`,
|
|
142
|
+
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "runs")));
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated Use listRunEntries.
|
|
146
|
+
*/
|
|
147
|
+
async listRunLedgerEntries(scope = {}) {
|
|
148
|
+
return this.listRunEntries(scope);
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Create a harness run.
|
|
152
|
+
*/
|
|
153
|
+
async startHarnessRun(input, idempotencyKey) {
|
|
154
|
+
return gateway.request({
|
|
155
|
+
path: "/api/platform/v1/harness/runs",
|
|
156
|
+
method: "POST",
|
|
157
|
+
body: normalizeTopicQuery(input),
|
|
158
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Get a run ledger entry.
|
|
163
|
+
*/
|
|
164
|
+
async getRunLedgerEntry(runId) {
|
|
165
|
+
return gateway.request({
|
|
166
|
+
path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}`,
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* Update a harness run with a ledger event.
|
|
171
|
+
*/
|
|
172
|
+
async reportHarnessRunEvent(runId, input, idempotencyKey) {
|
|
173
|
+
return gateway.request({
|
|
174
|
+
path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/report`,
|
|
175
|
+
method: "POST",
|
|
176
|
+
body: input,
|
|
177
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* Update a harness run heartbeat.
|
|
182
|
+
*/
|
|
183
|
+
async heartbeatHarnessRun(runId, input, idempotencyKey) {
|
|
184
|
+
return gateway.request({
|
|
185
|
+
path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/heartbeat`,
|
|
186
|
+
method: "POST",
|
|
187
|
+
body: input,
|
|
188
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
/**
|
|
192
|
+
* Complete a harness run.
|
|
193
|
+
*/
|
|
194
|
+
async completeHarnessRun(runId, input, idempotencyKey) {
|
|
195
|
+
return gateway.request({
|
|
196
|
+
path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/complete`,
|
|
197
|
+
method: "POST",
|
|
198
|
+
body: input,
|
|
199
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* List prompt resolutions.
|
|
204
|
+
*/
|
|
205
|
+
async listPromptResolutions(query = {}) {
|
|
206
|
+
return gateway.request({
|
|
207
|
+
path: `/api/platform/v1/harness/prompts${toQueryString(query)}`,
|
|
208
|
+
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "prompts")));
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Get the harness scope taxonomy.
|
|
212
|
+
*/
|
|
213
|
+
async getScopeTaxonomy() {
|
|
214
|
+
return gateway.request({
|
|
215
|
+
path: "/api/platform/v1/harness/scopes",
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
@@ -1,19 +1,45 @@
|
|
|
1
|
-
import { type GatewayClientConfig, type GatewayScope, LucernApiError } from "./coreClient";
|
|
2
|
-
import type { JsonObject } from "./types";
|
|
3
|
-
|
|
4
|
-
export type
|
|
1
|
+
import { type GatewayClientConfig, type GatewayScope, type PlatformGatewaySuccess, LucernApiError } from "./coreClient";
|
|
2
|
+
import type { JsonObject, SdkPrincipalContext } from "./types";
|
|
3
|
+
/** Summary of the currently authenticated principal and their scopes. */
|
|
4
|
+
export type IdentitySummary = SdkPrincipalContext;
|
|
5
|
+
/** Gateway response wrapping an identity summary payload. */
|
|
6
|
+
export type IdentityWhoamiResponse = PlatformGatewaySuccess<IdentitySummary>;
|
|
5
7
|
export { LucernApiError };
|
|
6
8
|
export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
|
|
9
|
+
/** Configuration for the identity client. */
|
|
7
10
|
export type IdentityClientConfig = GatewayClientConfig;
|
|
8
|
-
export type
|
|
11
|
+
export type ClerkUserSearchResult = {
|
|
12
|
+
clerkId: string;
|
|
13
|
+
email: string | null;
|
|
14
|
+
firstName: string | null;
|
|
15
|
+
lastName: string | null;
|
|
16
|
+
displayName: string | null;
|
|
17
|
+
imageUrl: string | null;
|
|
18
|
+
};
|
|
9
19
|
/**
|
|
10
20
|
* Create the identity client for principals and API keys.
|
|
21
|
+
* @param config - Gateway transport configuration.
|
|
22
|
+
* @returns An object with methods for whoami, principal management, and key management.
|
|
11
23
|
*/
|
|
12
24
|
export declare function createIdentityClient(config?: IdentityClientConfig): {
|
|
13
25
|
/**
|
|
14
26
|
* Resolve the current authenticated identity summary.
|
|
15
27
|
*/
|
|
16
|
-
whoami(): Promise<
|
|
28
|
+
whoami(): Promise<PlatformGatewaySuccess<{
|
|
29
|
+
principalId: string;
|
|
30
|
+
principalType: "user" | "human" | "service" | "group" | "external_viewer" | "agent";
|
|
31
|
+
tenantId: string | null;
|
|
32
|
+
workspaceId: string | null;
|
|
33
|
+
scopes: string[];
|
|
34
|
+
roles: string[];
|
|
35
|
+
isPlatformAdmin: boolean;
|
|
36
|
+
isTenantAdmin: boolean;
|
|
37
|
+
isWorkspaceAdmin: boolean;
|
|
38
|
+
authMode: string | undefined;
|
|
39
|
+
sessionId: string | undefined;
|
|
40
|
+
delegatedBy: string | undefined;
|
|
41
|
+
expiresAt: number | undefined;
|
|
42
|
+
}>>;
|
|
17
43
|
/**
|
|
18
44
|
* List principals in the current identity scope.
|
|
19
45
|
*/
|
|
@@ -22,7 +48,7 @@ export declare function createIdentityClient(config?: IdentityClientConfig): {
|
|
|
22
48
|
principalType?: string;
|
|
23
49
|
query?: string;
|
|
24
50
|
limit?: number;
|
|
25
|
-
}): Promise<
|
|
51
|
+
}): Promise<PlatformGatewaySuccess<import("./types").ListResult<any, "principals">>>;
|
|
26
52
|
/**
|
|
27
53
|
* Create a principal.
|
|
28
54
|
*/
|
|
@@ -34,7 +60,7 @@ export declare function createIdentityClient(config?: IdentityClientConfig): {
|
|
|
34
60
|
displayName?: string;
|
|
35
61
|
status?: "active" | "disabled" | "revoked";
|
|
36
62
|
metadata?: JsonObject;
|
|
37
|
-
}, idempotencyKey?: string): Promise<
|
|
63
|
+
}, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
|
|
38
64
|
/**
|
|
39
65
|
* Update a principal.
|
|
40
66
|
*/
|
|
@@ -46,7 +72,7 @@ export declare function createIdentityClient(config?: IdentityClientConfig): {
|
|
|
46
72
|
displayName?: string;
|
|
47
73
|
status?: "active" | "disabled" | "revoked";
|
|
48
74
|
metadata?: JsonObject;
|
|
49
|
-
}, idempotencyKey?: string): Promise<
|
|
75
|
+
}, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
|
|
50
76
|
/**
|
|
51
77
|
* @deprecated Use createPrincipal or updatePrincipal.
|
|
52
78
|
*/
|
|
@@ -58,7 +84,7 @@ export declare function createIdentityClient(config?: IdentityClientConfig): {
|
|
|
58
84
|
displayName?: string;
|
|
59
85
|
status?: "active" | "disabled" | "revoked";
|
|
60
86
|
metadata?: JsonObject;
|
|
61
|
-
}, idempotencyKey?: string): Promise<
|
|
87
|
+
}, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
|
|
62
88
|
/**
|
|
63
89
|
* List keys in the current identity scope.
|
|
64
90
|
*/
|
|
@@ -66,7 +92,7 @@ export declare function createIdentityClient(config?: IdentityClientConfig): {
|
|
|
66
92
|
principalId?: string;
|
|
67
93
|
status?: string;
|
|
68
94
|
limit?: number;
|
|
69
|
-
}): Promise<
|
|
95
|
+
}): Promise<PlatformGatewaySuccess<import("./types").ListResult<any, "keys">>>;
|
|
70
96
|
/**
|
|
71
97
|
* Create an API key.
|
|
72
98
|
*/
|
|
@@ -79,7 +105,7 @@ export declare function createIdentityClient(config?: IdentityClientConfig): {
|
|
|
79
105
|
expiresInDays?: number;
|
|
80
106
|
rateLimitTier?: "free" | "developer" | "partner";
|
|
81
107
|
metadata?: JsonObject;
|
|
82
|
-
}, idempotencyKey?: string): Promise<
|
|
108
|
+
}, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
|
|
83
109
|
/**
|
|
84
110
|
* Rotate an API key.
|
|
85
111
|
*/
|
|
@@ -88,17 +114,21 @@ export declare function createIdentityClient(config?: IdentityClientConfig): {
|
|
|
88
114
|
replacementToken?: string;
|
|
89
115
|
replacementExpiresInDays?: number;
|
|
90
116
|
gracePeriodHours?: number;
|
|
91
|
-
}, idempotencyKey?: string): Promise<
|
|
117
|
+
}, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
|
|
92
118
|
/**
|
|
93
119
|
* Delete an API key by revoking it.
|
|
94
120
|
*/
|
|
95
121
|
deleteKey(keyId: string, input?: {
|
|
96
122
|
reason?: string;
|
|
97
|
-
}, idempotencyKey?: string): Promise<
|
|
123
|
+
}, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
|
|
98
124
|
/**
|
|
99
125
|
* @deprecated Use deleteKey.
|
|
100
126
|
*/
|
|
101
127
|
revokeKey(keyId: string, input?: {
|
|
102
128
|
reason?: string;
|
|
103
|
-
}, idempotencyKey?: string): Promise<
|
|
129
|
+
}, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
|
|
130
|
+
/**
|
|
131
|
+
* Search Clerk users by email or display attributes.
|
|
132
|
+
*/
|
|
133
|
+
searchClerkUsers(q: string): Promise<PlatformGatewaySuccess<ClerkUserSearchResult[]>>;
|
|
104
134
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
|
|
2
|
+
import { createListResult, mapGatewayData } from "./sdkSurface.js";
|
|
3
|
+
function createIdentityWhoamiClient(config = {}) {
|
|
4
|
+
const gateway = createGatewayRequestClient(config);
|
|
5
|
+
return {
|
|
6
|
+
async whoami() {
|
|
7
|
+
return gateway.request({
|
|
8
|
+
path: "/api/platform/v1/identity/whoami",
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export { LucernApiError };
|
|
14
|
+
/**
|
|
15
|
+
* Create the identity client for principals and API keys.
|
|
16
|
+
* @param config - Gateway transport configuration.
|
|
17
|
+
* @returns An object with methods for whoami, principal management, and key management.
|
|
18
|
+
*/
|
|
19
|
+
export function createIdentityClient(config = {}) {
|
|
20
|
+
const gateway = createGatewayRequestClient(config);
|
|
21
|
+
const whoamiClient = createIdentityWhoamiClient(config);
|
|
22
|
+
const requestPrincipalWrite = (method, input, idempotencyKey) => gateway.request({
|
|
23
|
+
path: "/api/platform/v1/identity/principals",
|
|
24
|
+
method,
|
|
25
|
+
body: input,
|
|
26
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the current authenticated identity summary.
|
|
31
|
+
*/
|
|
32
|
+
async whoami() {
|
|
33
|
+
return whoamiClient.whoami().then((response) => mapGatewayData(response, (data) => ({
|
|
34
|
+
principalId: data.principalId,
|
|
35
|
+
principalType: data.principalType,
|
|
36
|
+
tenantId: data.tenantId ?? null,
|
|
37
|
+
workspaceId: data.workspaceId ?? null,
|
|
38
|
+
scopes: Array.isArray(data.scopes) ? data.scopes : [],
|
|
39
|
+
roles: Array.isArray(data.roles) ? data.roles : [],
|
|
40
|
+
isPlatformAdmin: data.isPlatformAdmin === true,
|
|
41
|
+
isTenantAdmin: data.isTenantAdmin === true,
|
|
42
|
+
isWorkspaceAdmin: data.isWorkspaceAdmin === true,
|
|
43
|
+
authMode: data.authMode,
|
|
44
|
+
sessionId: data.sessionId,
|
|
45
|
+
delegatedBy: data.delegatedBy,
|
|
46
|
+
expiresAt: data.expiresAt,
|
|
47
|
+
})));
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* List principals in the current identity scope.
|
|
51
|
+
*/
|
|
52
|
+
async listPrincipals(query = {}) {
|
|
53
|
+
return gateway.request({
|
|
54
|
+
path: `/api/platform/v1/identity/principals${toQueryString(query)}`,
|
|
55
|
+
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "principals")));
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Create a principal.
|
|
59
|
+
*/
|
|
60
|
+
async createPrincipal(input, idempotencyKey) {
|
|
61
|
+
return requestPrincipalWrite("POST", input, idempotencyKey);
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Update a principal.
|
|
65
|
+
*/
|
|
66
|
+
async updatePrincipal(input, idempotencyKey) {
|
|
67
|
+
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated Use createPrincipal or updatePrincipal.
|
|
71
|
+
*/
|
|
72
|
+
async upsertPrincipal(input, idempotencyKey) {
|
|
73
|
+
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* List keys in the current identity scope.
|
|
77
|
+
*/
|
|
78
|
+
async listKeys(query = {}) {
|
|
79
|
+
return gateway.request({
|
|
80
|
+
path: `/api/platform/v1/identity/keys${toQueryString(query)}`,
|
|
81
|
+
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "keys")));
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Create an API key.
|
|
85
|
+
*/
|
|
86
|
+
async createKey(input, idempotencyKey) {
|
|
87
|
+
return gateway.request({
|
|
88
|
+
path: "/api/platform/v1/identity/keys",
|
|
89
|
+
method: "POST",
|
|
90
|
+
body: input,
|
|
91
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* Rotate an API key.
|
|
96
|
+
*/
|
|
97
|
+
async rotateKey(keyId, input = {}, idempotencyKey) {
|
|
98
|
+
return gateway.request({
|
|
99
|
+
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/rotate`,
|
|
100
|
+
method: "POST",
|
|
101
|
+
body: input,
|
|
102
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Delete an API key by revoking it.
|
|
107
|
+
*/
|
|
108
|
+
async deleteKey(keyId, input = {}, idempotencyKey) {
|
|
109
|
+
return gateway.request({
|
|
110
|
+
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
111
|
+
method: "POST",
|
|
112
|
+
body: input,
|
|
113
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated Use deleteKey.
|
|
118
|
+
*/
|
|
119
|
+
async revokeKey(keyId, input = {}, idempotencyKey) {
|
|
120
|
+
return this.deleteKey(keyId, input, idempotencyKey);
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* Search Clerk users by email or display attributes.
|
|
124
|
+
*/
|
|
125
|
+
async searchClerkUsers(q) {
|
|
126
|
+
return gateway.request({
|
|
127
|
+
path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`,
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -1,27 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/sdk — The reasoning operating system for AI-native applications.
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point. It re-exports all client factories,
|
|
5
|
+
* types, contracts, and utilities from domain modules.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
1
9
|
export * from "./adminClient";
|
|
2
10
|
export * from "./answersClient";
|
|
3
11
|
export * from "./audiencesClient";
|
|
4
12
|
export * from "./auditClient";
|
|
5
13
|
export * from "./beliefsClient";
|
|
6
14
|
export * from "./client";
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "
|
|
9
|
-
export * from "@lucern/contracts/workflow-runtime.contract";
|
|
15
|
+
export * from "./contextFacade";
|
|
16
|
+
export * from "./contextPackCompiler";
|
|
10
17
|
export * from "./controlObjectOwnership";
|
|
11
18
|
export * from "./coreClient";
|
|
12
19
|
export * from "./contextClient";
|
|
20
|
+
export * from "./contracts/api-enums.contract";
|
|
21
|
+
export * from "./contracts/auth-session.contract";
|
|
22
|
+
export { MAX_ENTITY_LIMIT } from "./contracts/contextPack";
|
|
23
|
+
export * from "./contracts/lensFilter";
|
|
24
|
+
export * from "./contracts/lensWorkflow";
|
|
25
|
+
export * from "./contracts/mcpTools";
|
|
26
|
+
export * from "./contracts/prompt";
|
|
27
|
+
export * from "./contracts/workflowRuntime";
|
|
28
|
+
export * from "./domainContext";
|
|
13
29
|
export * from "./customTools";
|
|
14
30
|
export * from "./decisionsClient";
|
|
31
|
+
export * from "./events";
|
|
32
|
+
export * from "./eventsCore";
|
|
15
33
|
export * from "./graphClient";
|
|
16
34
|
export * from "./harnessClient";
|
|
17
35
|
export * from "./identityClient";
|
|
18
36
|
export * from "./learningClient";
|
|
19
37
|
export * from "./mcpParityClient";
|
|
38
|
+
export * from "./mcpParitySurface";
|
|
20
39
|
export * from "./ontologyClient";
|
|
40
|
+
export * from "./packRuntime";
|
|
21
41
|
export * from "./packsClient";
|
|
22
42
|
export * from "./policyClient";
|
|
23
43
|
export * from "./reportsClient";
|
|
24
44
|
export * from "./schemaClient";
|
|
45
|
+
export * from "./sdkSurface";
|
|
25
46
|
export * from "./topicsClient";
|
|
26
47
|
export * from "./types";
|
|
27
48
|
export * from "./version";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/sdk — The reasoning operating system for AI-native applications.
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point. It re-exports all client factories,
|
|
5
|
+
* types, contracts, and utilities from domain modules.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export * from "./adminClient.js";
|
|
10
|
+
export * from "./answersClient.js";
|
|
11
|
+
export * from "./audiencesClient.js";
|
|
12
|
+
export * from "./auditClient.js";
|
|
13
|
+
export * from "./beliefsClient.js";
|
|
14
|
+
export * from "./client.js";
|
|
15
|
+
export * from "./contextFacade.js";
|
|
16
|
+
export * from "./contextPackCompiler.js";
|
|
17
|
+
export * from "./controlObjectOwnership.js";
|
|
18
|
+
export * from "./coreClient.js";
|
|
19
|
+
export * from "./contextClient.js";
|
|
20
|
+
export * from "./contracts/api-enums.contract.js";
|
|
21
|
+
export * from "./contracts/auth-session.contract.js";
|
|
22
|
+
export { MAX_ENTITY_LIMIT } from "./contracts/contextPack.js";
|
|
23
|
+
export * from "./contracts/lensFilter.js";
|
|
24
|
+
export * from "./contracts/lensWorkflow.js";
|
|
25
|
+
export * from "./contracts/mcpTools.js";
|
|
26
|
+
export * from "./contracts/prompt.js";
|
|
27
|
+
export * from "./contracts/workflowRuntime.js";
|
|
28
|
+
export * from "./domainContext.js";
|
|
29
|
+
export * from "./customTools.js";
|
|
30
|
+
export * from "./decisionsClient.js";
|
|
31
|
+
export * from "./events.js";
|
|
32
|
+
export * from "./eventsCore.js";
|
|
33
|
+
export * from "./graphClient.js";
|
|
34
|
+
export * from "./harnessClient.js";
|
|
35
|
+
export * from "./identityClient.js";
|
|
36
|
+
export * from "./learningClient.js";
|
|
37
|
+
export * from "./mcpParityClient.js";
|
|
38
|
+
export * from "./mcpParitySurface.js";
|
|
39
|
+
export * from "./ontologyClient.js";
|
|
40
|
+
export * from "./packRuntime.js";
|
|
41
|
+
export * from "./packsClient.js";
|
|
42
|
+
export * from "./policyClient.js";
|
|
43
|
+
export * from "./reportsClient.js";
|
|
44
|
+
export * from "./schemaClient.js";
|
|
45
|
+
export * from "./sdkSurface.js";
|
|
46
|
+
export * from "./topicsClient.js";
|
|
47
|
+
export * from "./types.js";
|
|
48
|
+
export * from "./version.js";
|
|
49
|
+
export * from "./workflowClient.js";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { type GatewayClientConfig } from "./coreClient";
|
|
2
2
|
import type { TopicIdentifierInput } from "./types";
|
|
3
|
+
/** Configuration for the learning client. */
|
|
3
4
|
export type LearningClientConfig = GatewayClientConfig;
|
|
4
5
|
/**
|
|
5
6
|
* Create the learning client for execution telemetry reads.
|
|
7
|
+
* @param config - Gateway transport configuration.
|
|
8
|
+
* @returns An object with methods to list executions and retrieve stats.
|
|
6
9
|
*/
|
|
7
10
|
export declare function createLearningClient(config?: LearningClientConfig): {
|
|
8
11
|
/**
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createGatewayRequestClient, toQueryString, } from "./coreClient.js";
|
|
2
|
+
import { createListResult, mapGatewayData, normalizeTopicQuery } from "./sdkSurface.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create the learning client for execution telemetry reads.
|
|
5
|
+
* @param config - Gateway transport configuration.
|
|
6
|
+
* @returns An object with methods to list executions and retrieve stats.
|
|
7
|
+
*/
|
|
8
|
+
export function createLearningClient(config = {}) {
|
|
9
|
+
const gateway = createGatewayRequestClient(config);
|
|
10
|
+
return {
|
|
11
|
+
/**
|
|
12
|
+
* List recent execution records.
|
|
13
|
+
*/
|
|
14
|
+
async listRecentExecutions(args = {}) {
|
|
15
|
+
return gateway.request({
|
|
16
|
+
path: `/api/platform/v1/learning/executions/recent${toQueryString({
|
|
17
|
+
...normalizeTopicQuery(args),
|
|
18
|
+
namespace: args.namespace,
|
|
19
|
+
audienceMode: args.audienceMode,
|
|
20
|
+
success: typeof args.success === "boolean"
|
|
21
|
+
? args.success
|
|
22
|
+
? "true"
|
|
23
|
+
: "false"
|
|
24
|
+
: undefined,
|
|
25
|
+
limit: typeof args.limit === "number" && Number.isFinite(args.limit)
|
|
26
|
+
? String(args.limit)
|
|
27
|
+
: undefined,
|
|
28
|
+
})}`,
|
|
29
|
+
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "executions")));
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use listRecentExecutions.
|
|
33
|
+
*/
|
|
34
|
+
async getRecentExecutions(args = {}) {
|
|
35
|
+
return this.listRecentExecutions(args);
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Get aggregate execution statistics.
|
|
39
|
+
*/
|
|
40
|
+
async getExecutionStats(args = {}) {
|
|
41
|
+
return gateway.request({
|
|
42
|
+
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
43
|
+
...normalizeTopicQuery(args),
|
|
44
|
+
namespace: args.namespace,
|
|
45
|
+
audienceMode: args.audienceMode,
|
|
46
|
+
hours: typeof args.hours === "number" && Number.isFinite(args.hours)
|
|
47
|
+
? String(args.hours)
|
|
48
|
+
: undefined,
|
|
49
|
+
})}`,
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type GatewayClientConfig, type PlatformGatewaySuccess } from "./coreClient";
|
|
2
2
|
import type { JsonObject } from "./types";
|
|
3
|
+
/** Configuration for the MCP parity client. Inherits gateway transport settings. */
|
|
3
4
|
export type McpParityClientConfig = GatewayClientConfig;
|
|
4
5
|
type ToolArgs = JsonObject;
|
|
5
6
|
type ToolResult<T = unknown> = Promise<PlatformGatewaySuccess<T>>;
|