@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.
Files changed (166) hide show
  1. package/.turbo/turbo-build.log +7 -0
  2. package/.turbo/turbo-typecheck.log +4 -0
  3. package/CHANGELOG.md +13 -0
  4. package/examples/README.md +69 -0
  5. package/examples/contradiction.ts +94 -0
  6. package/examples/investigation-context.ts +118 -0
  7. package/examples/questions-and-tasks.ts +55 -0
  8. package/examples/quickstart.ts +97 -0
  9. package/examples/shared.ts +318 -0
  10. package/examples/strict-public-types.ts +143 -0
  11. package/examples/worktree-lifecycle.ts +79 -0
  12. package/package.json +16 -59
  13. package/src/README.md +6 -0
  14. package/src/adminClient.ts +789 -0
  15. package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
  16. package/src/audiencesClient.ts +209 -0
  17. package/src/auditClient.ts +50 -0
  18. package/src/beliefsClient.ts +319 -0
  19. package/src/client.ts +2647 -0
  20. package/src/contextClient.ts +130 -0
  21. package/src/contextFacade.ts +15 -0
  22. package/src/contextPackCompiler.ts +828 -0
  23. package/src/contextPackSchema.ts +251 -0
  24. package/src/contextTypes.ts +153 -0
  25. package/src/contracts/api-enums.contract.ts +202 -0
  26. package/src/contracts/auth-session.contract.ts +109 -0
  27. package/src/contracts/context-pack.contract.ts +700 -0
  28. package/src/contracts/contextPack.ts +1 -0
  29. package/src/contracts/index.ts +10 -0
  30. package/src/contracts/lens-filter.contract.ts +183 -0
  31. package/src/contracts/lens-workflow.contract.ts +162 -0
  32. package/src/contracts/lensFilter.ts +1 -0
  33. package/src/contracts/lensWorkflow.ts +1 -0
  34. package/src/contracts/mcp-tools.contract.ts +3636 -0
  35. package/src/contracts/mcpTools.ts +1 -0
  36. package/src/contracts/prompt.contract.ts +50 -0
  37. package/src/contracts/prompt.ts +1 -0
  38. package/src/contracts/sdk-tools.contract.ts +1457 -0
  39. package/src/contracts/sdkTools.ts +1 -0
  40. package/src/contracts/workflow-runtime.contract.ts +440 -0
  41. package/src/contracts/workflowRuntime.ts +1 -0
  42. package/src/controlObjectOwnership.ts +286 -0
  43. package/src/coreClient.ts +570 -0
  44. package/src/customTools.ts +398 -0
  45. package/src/decisionsClient.ts +286 -0
  46. package/src/domainContext.ts +15 -0
  47. package/src/events.ts +531 -0
  48. package/src/eventsCore.ts +168 -0
  49. package/src/facade/beliefs.ts +83 -0
  50. package/src/facade/context.ts +110 -0
  51. package/src/facade/contradictions.ts +29 -0
  52. package/src/facade/edges.ts +30 -0
  53. package/src/facade/events.ts +23 -0
  54. package/src/facade/evidence.ts +41 -0
  55. package/src/facade/graph.ts +38 -0
  56. package/src/facade/identity.ts +16 -0
  57. package/src/facade/ontologies.ts +34 -0
  58. package/src/facade/questions.ts +59 -0
  59. package/src/facade/search.ts +16 -0
  60. package/src/facade/tasks.ts +37 -0
  61. package/src/facade/topics.ts +42 -0
  62. package/src/facade/webhooks.ts +58 -0
  63. package/src/facade/worktrees.ts +51 -0
  64. package/src/gatewayFacades.ts +1666 -0
  65. package/src/graphClient.ts +529 -0
  66. package/src/harnessClient.ts +585 -0
  67. package/src/identityClient.ts +278 -0
  68. package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +3 -0
  69. package/src/learningClient.ts +95 -0
  70. package/src/mcpParityClient.ts +240 -0
  71. package/src/mcpParitySurface.ts +70 -0
  72. package/src/ontologyClient.ts +275 -0
  73. package/src/packRuntime.ts +3 -0
  74. package/src/packsClient.ts +260 -0
  75. package/src/policyClient.ts +572 -0
  76. package/src/promptCatalog.ts +1 -0
  77. package/src/realtime/index.ts +51 -0
  78. package/src/realtime/refs.ts +17 -0
  79. package/src/reportsClient.ts +99 -0
  80. package/src/schemaClient.ts +129 -0
  81. package/src/sdkSurface.ts +190 -0
  82. package/src/topicsClient.ts +243 -0
  83. package/src/types.ts +807 -0
  84. package/src/workflowClient.ts +826 -0
  85. package/tsconfig.json +9 -0
  86. package/dist/.generated +0 -2
  87. package/dist/index.d.ts +0 -3
  88. package/dist/index.js +0 -3
  89. package/dist/lib/platform/auth/credentials.d.ts +0 -5
  90. package/dist/lib/platform/auth/credentials.js +0 -40
  91. package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
  92. package/dist/lib/platform/sdk/adminClient.js +0 -384
  93. package/dist/lib/platform/sdk/answersClient.js +0 -21
  94. package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
  95. package/dist/lib/platform/sdk/audiencesClient.js +0 -111
  96. package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
  97. package/dist/lib/platform/sdk/auditClient.js +0 -21
  98. package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
  99. package/dist/lib/platform/sdk/beliefsClient.js +0 -124
  100. package/dist/lib/platform/sdk/client.d.ts +0 -2369
  101. package/dist/lib/platform/sdk/client.js +0 -1831
  102. package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
  103. package/dist/lib/platform/sdk/contextClient.js +0 -86
  104. package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
  105. package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
  106. package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
  107. package/dist/lib/platform/sdk/contextTypes.js +0 -1
  108. package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
  109. package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
  110. package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
  111. package/dist/lib/platform/sdk/coreClient.js +0 -366
  112. package/dist/lib/platform/sdk/customTools.d.ts +0 -83
  113. package/dist/lib/platform/sdk/customTools.js +0 -247
  114. package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
  115. package/dist/lib/platform/sdk/decisionsClient.js +0 -129
  116. package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
  117. package/dist/lib/platform/sdk/domainContext.js +0 -1
  118. package/dist/lib/platform/sdk/events.d.ts +0 -176
  119. package/dist/lib/platform/sdk/events.js +0 -261
  120. package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
  121. package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
  122. package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
  123. package/dist/lib/platform/sdk/graphClient.js +0 -235
  124. package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
  125. package/dist/lib/platform/sdk/harnessClient.js +0 -219
  126. package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
  127. package/dist/lib/platform/sdk/identityClient.js +0 -131
  128. package/dist/lib/platform/sdk/index.js +0 -46
  129. package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
  130. package/dist/lib/platform/sdk/learningClient.js +0 -53
  131. package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
  132. package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
  133. package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
  134. package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
  135. package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
  136. package/dist/lib/platform/sdk/ontologyClient.js +0 -161
  137. package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
  138. package/dist/lib/platform/sdk/packRuntime.js +0 -1
  139. package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
  140. package/dist/lib/platform/sdk/packsClient.js +0 -157
  141. package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
  142. package/dist/lib/platform/sdk/policyClient.js +0 -277
  143. package/dist/lib/platform/sdk/promptCatalog.d.ts +0 -1
  144. package/dist/lib/platform/sdk/promptCatalog.js +0 -1
  145. package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
  146. package/dist/lib/platform/sdk/reportsClient.js +0 -64
  147. package/dist/lib/platform/sdk/schemaClient.d.ts +0 -59
  148. package/dist/lib/platform/sdk/schemaClient.js +0 -71
  149. package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
  150. package/dist/lib/platform/sdk/sdkSurface.js +0 -140
  151. package/dist/lib/platform/sdk/topicsClient.d.ts +0 -78
  152. package/dist/lib/platform/sdk/topicsClient.js +0 -118
  153. package/dist/lib/platform/sdk/types.d.ts +0 -692
  154. package/dist/lib/platform/sdk/types.js +0 -1
  155. package/dist/lib/platform/sdk/version.d.ts +0 -2
  156. package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
  157. package/dist/lib/platform/sdk/workflowClient.js +0 -366
  158. package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
  159. package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
  160. package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
  161. package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
  162. package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
  163. package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
  164. package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
  165. package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
  166. /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
@@ -1,309 +0,0 @@
1
- import { type GatewayClientConfig, type GatewayScope, LucernApiError } from "./coreClient";
2
- import type { JsonObject, JsonValue, TopicIdentifierInput } from "./types";
3
- export { LucernApiError };
4
- export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
5
- /** Configuration for the harness client. Inherits gateway transport settings. */
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. */
22
- export type HarnessAgentWriteInput = GatewayScope & {
23
- agentDefinitionId?: string;
24
- agentKey: string;
25
- displayName: string;
26
- description: string;
27
- version: string;
28
- status?: "active" | "deprecated" | "disabled";
29
- executionAdapter: "convex_mutation" | "convex_action" | "http_callback" | "mcp_tool" | "sdk_invocation" | "external_observed";
30
- scopeRequirements?: string[];
31
- promptReleaseChannel?: "dev" | "staging" | "prod";
32
- promptName?: string;
33
- systemPrompt?: string;
34
- toolIds?: string[];
35
- modelSlot?: string;
36
- requiredModelCapabilities?: string[];
37
- parameterSchema?: JsonObject;
38
- outputSchema?: JsonObject;
39
- guardrails?: HarnessAgentGuardrails;
40
- runtimeConfig?: HarnessAgentRuntimeConfig;
41
- exampleInvocations?: Array<{
42
- input: JsonObject;
43
- expectedOutput?: JsonValue;
44
- }>;
45
- metadata?: JsonObject;
46
- };
47
- /** Input for creating or updating a tool definition in the harness registry. */
48
- export type HarnessToolWriteInput = GatewayScope & {
49
- toolId?: string;
50
- toolName: string;
51
- description: string;
52
- version: string;
53
- status?: "draft" | "active" | "deprecated" | "disabled";
54
- executionAdapter: "convex_mutation" | "convex_action" | "http_callback" | "mcp_tool" | "sdk_invocation" | "external_observed";
55
- gateClassification?: "core" | "shimmed";
56
- scopeRequirements?: string[];
57
- requiredRole?: string;
58
- requiredAction?: string;
59
- surfaces?: string[];
60
- category?: string;
61
- parameterSchema?: JsonObject;
62
- returnSchema?: JsonObject;
63
- handlerRef?: string;
64
- callbackUrl?: string;
65
- safetyMetadata: {
66
- readOnly?: boolean;
67
- idempotent?: boolean;
68
- sideEffectLevel: "none" | "low" | "high";
69
- };
70
- exampleInvocations?: Array<{
71
- input: JsonObject;
72
- expectedOutput?: JsonValue;
73
- }>;
74
- metadata?: JsonObject;
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). */
125
- export type HarnessStartRunInput = GatewayScope & {
126
- agentDefinitionId: string;
127
- agentVersion: string;
128
- executionAdapter: "convex_mutation" | "convex_action" | "http_callback" | "mcp_tool" | "sdk_invocation" | "external_observed";
129
- promptReleaseChannel?: "dev" | "staging" | "prod";
130
- chatId?: string;
131
- worktreeId?: string;
132
- topicId?: string;
133
- langfuseTraceId?: string;
134
- metadata?: JsonObject;
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. */
142
- export type HarnessRunReportInput = {
143
- reportingToken: string;
144
- type: "tool_call" | "prompt_resolution" | "policy_decision";
145
- metadata?: JsonObject;
146
- toolCallId?: string;
147
- toolName?: string;
148
- executionAdapter?: "convex_mutation" | "convex_action" | "http_callback" | "mcp_tool" | "sdk_invocation" | "external_observed";
149
- policyDecisionId?: string;
150
- requiredScopes?: string[];
151
- policyResult?: "allowed" | "denied";
152
- policyReasonCode?: string;
153
- inputHash?: string;
154
- outputHash?: string;
155
- durationMs?: number;
156
- success?: boolean;
157
- startedAt?: number;
158
- completedAt?: number;
159
- input?: JsonObject;
160
- result?: JsonValue;
161
- promptKey?: string;
162
- promptVersion?: string;
163
- decision?: string;
164
- reasonCode?: string;
165
- latencyMs?: number;
166
- error?: string | {
167
- code?: string;
168
- message: string;
169
- details?: JsonValue;
170
- };
171
- };
172
- /** Input for completing a harness run with a terminal status. */
173
- export type HarnessCompleteRunInput = {
174
- reportingToken: string;
175
- status: "completed" | "failed" | "timeout";
176
- error?: {
177
- category: "policy_denied" | "tool_execution" | "prompt_resolution" | "model_error" | "timeout" | "heartbeat_timeout" | "input_validation" | "internal" | "external_service";
178
- message: string;
179
- code?: string;
180
- };
181
- };
182
- /**
183
- * Create the harness client for agent and tool registry operations.
184
- */
185
- export declare function createHarnessClient(config?: HarnessClientConfig): {
186
- /**
187
- * List agent definitions.
188
- */
189
- listAgentDefinitions(scope?: GatewayScope & {
190
- status?: string;
191
- limit?: number;
192
- cursor?: string;
193
- }): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "agents">>>;
194
- /**
195
- * Get an agent definition.
196
- */
197
- getAgentDefinition(agentId: string, scope?: GatewayScope): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
198
- /**
199
- * Create an agent definition.
200
- */
201
- createAgentDefinition(input: HarnessAgentWriteInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
202
- /**
203
- * @deprecated Use createAgentDefinition.
204
- */
205
- registerAgentDefinition(input: HarnessAgentWriteInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
206
- /**
207
- * Update an agent definition.
208
- */
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>>;
214
- /**
215
- * List runs for an agent definition.
216
- */
217
- listAgentRuns(agentId: string, scope?: GatewayScope & {
218
- status?: string;
219
- limit?: number;
220
- cursor?: string;
221
- }): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "runs">>>;
222
- /**
223
- * @deprecated Use listAgentRuns.
224
- */
225
- listRunsForAgent(agentId: string, scope?: GatewayScope & {
226
- status?: string;
227
- limit?: number;
228
- cursor?: string;
229
- }): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "runs">>>;
230
- /**
231
- * List tool definitions.
232
- */
233
- listToolDefinitions(scope?: GatewayScope & {
234
- status?: string;
235
- limit?: number;
236
- cursor?: string;
237
- gateClassification?: string;
238
- }): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "tools">>>;
239
- /**
240
- * Get a tool definition.
241
- */
242
- getToolDefinition(toolId: string, scope?: GatewayScope): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
243
- /**
244
- * Create a tool definition.
245
- */
246
- createToolDefinition(input: HarnessToolWriteInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
247
- /**
248
- * @deprecated Use createToolDefinition.
249
- */
250
- registerToolDefinition(input: HarnessToolWriteInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
251
- /**
252
- * Update a tool definition.
253
- */
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>>;
259
- /**
260
- * List run ledger entries.
261
- */
262
- listRunEntries(scope?: GatewayScope & {
263
- status?: string;
264
- limit?: number;
265
- cursor?: string;
266
- }): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "runs">>>;
267
- /**
268
- * @deprecated Use listRunEntries.
269
- */
270
- listRunLedgerEntries(scope?: GatewayScope & {
271
- status?: string;
272
- limit?: number;
273
- cursor?: string;
274
- }): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "runs">>>;
275
- /**
276
- * Create a harness run.
277
- */
278
- startHarnessRun(input: HarnessStartRunInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
279
- /**
280
- * Get a run ledger entry.
281
- */
282
- getRunLedgerEntry(runId: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
283
- /**
284
- * Update a harness run with a ledger event.
285
- */
286
- reportHarnessRunEvent(runId: string, input: HarnessRunReportInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
287
- /**
288
- * Update a harness run heartbeat.
289
- */
290
- heartbeatHarnessRun(runId: string, input: {
291
- reportingToken: string;
292
- }, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
293
- /**
294
- * Complete a harness run.
295
- */
296
- completeHarnessRun(runId: string, input: HarnessCompleteRunInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
297
- /**
298
- * List prompt resolutions.
299
- */
300
- listPromptResolutions(query?: {
301
- runId?: string;
302
- promptName?: string;
303
- limit?: number;
304
- }): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "prompts">>>;
305
- /**
306
- * Get the harness scope taxonomy.
307
- */
308
- getScopeTaxonomy(): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
309
- };
@@ -1,219 +0,0 @@
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,134 +0,0 @@
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>;
7
- export { LucernApiError };
8
- export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
9
- /** Configuration for the identity client. */
10
- export type IdentityClientConfig = GatewayClientConfig;
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
- };
19
- /**
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.
23
- */
24
- export declare function createIdentityClient(config?: IdentityClientConfig): {
25
- /**
26
- * Resolve the current authenticated identity summary.
27
- */
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
- }>>;
43
- /**
44
- * List principals in the current identity scope.
45
- */
46
- listPrincipals(query?: GatewayScope & {
47
- status?: string;
48
- principalType?: string;
49
- query?: string;
50
- limit?: number;
51
- }): Promise<PlatformGatewaySuccess<import("./types").ListResult<any, "principals">>>;
52
- /**
53
- * Create a principal.
54
- */
55
- createPrincipal(input: GatewayScope & {
56
- principalId: string;
57
- principalType: "user" | "group" | "service" | "external_viewer";
58
- clerkId?: string;
59
- email?: string;
60
- displayName?: string;
61
- status?: "active" | "disabled" | "revoked";
62
- metadata?: JsonObject;
63
- }, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
64
- /**
65
- * Update a principal.
66
- */
67
- updatePrincipal(input: GatewayScope & {
68
- principalId: string;
69
- principalType: "user" | "group" | "service" | "external_viewer";
70
- clerkId?: string;
71
- email?: string;
72
- displayName?: string;
73
- status?: "active" | "disabled" | "revoked";
74
- metadata?: JsonObject;
75
- }, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
76
- /**
77
- * @deprecated Use createPrincipal or updatePrincipal.
78
- */
79
- upsertPrincipal(input: GatewayScope & {
80
- principalId: string;
81
- principalType: "user" | "group" | "service" | "external_viewer";
82
- clerkId?: string;
83
- email?: string;
84
- displayName?: string;
85
- status?: "active" | "disabled" | "revoked";
86
- metadata?: JsonObject;
87
- }, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
88
- /**
89
- * List keys in the current identity scope.
90
- */
91
- listKeys(query?: GatewayScope & {
92
- principalId?: string;
93
- status?: string;
94
- limit?: number;
95
- }): Promise<PlatformGatewaySuccess<import("./types").ListResult<any, "keys">>>;
96
- /**
97
- * Create an API key.
98
- */
99
- createKey(input: GatewayScope & {
100
- principalId: string;
101
- keyId?: string;
102
- token?: string;
103
- scopes?: string[];
104
- environment?: "sandbox" | "production";
105
- expiresInDays?: number;
106
- rateLimitTier?: "free" | "developer" | "partner";
107
- metadata?: JsonObject;
108
- }, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
109
- /**
110
- * Rotate an API key.
111
- */
112
- rotateKey(keyId: string, input?: {
113
- replacementKeyId?: string;
114
- replacementToken?: string;
115
- replacementExpiresInDays?: number;
116
- gracePeriodHours?: number;
117
- }, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
118
- /**
119
- * Delete an API key by revoking it.
120
- */
121
- deleteKey(keyId: string, input?: {
122
- reason?: string;
123
- }, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
124
- /**
125
- * @deprecated Use deleteKey.
126
- */
127
- revokeKey(keyId: string, input?: {
128
- reason?: string;
129
- }, idempotencyKey?: string): Promise<PlatformGatewaySuccess<unknown>>;
130
- /**
131
- * Search Clerk users by email or display attributes.
132
- */
133
- searchClerkUsers(q: string): Promise<PlatformGatewaySuccess<ClerkUserSearchResult[]>>;
134
- };