@lucern/sdk 0.2.0-alpha.7 → 0.2.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adminClient.d.ts +409 -0
- package/dist/adminClient.js +755 -0
- package/dist/adminClient.js.map +1 -0
- package/dist/answersClient.d.ts +23 -0
- package/dist/answersClient.js +333 -0
- package/dist/answersClient.js.map +1 -0
- package/dist/audiencesClient.d.ts +99 -0
- package/dist/audiencesClient.js +472 -0
- package/dist/audiencesClient.js.map +1 -0
- package/dist/auditClient.d.ts +29 -0
- package/dist/auditClient.js +386 -0
- package/dist/auditClient.js.map +1 -0
- package/dist/beliefsClient.d.ts +162 -0
- package/dist/beliefsClient.js +477 -0
- package/dist/beliefsClient.js.map +1 -0
- package/dist/client.d.ts +2378 -0
- package/dist/client.js +6134 -0
- package/dist/client.js.map +1 -0
- package/dist/contextClient.d.ts +27 -0
- package/dist/contextClient.js +396 -0
- package/dist/contextClient.js.map +1 -0
- package/dist/contextFacade.d.ts +2 -0
- package/dist/contextFacade.js +73 -0
- package/dist/contextFacade.js.map +1 -0
- package/dist/contextPackCompiler.d.ts +102 -0
- package/dist/contextPackCompiler.js +1091 -0
- package/dist/contextPackCompiler.js.map +1 -0
- package/dist/contextPackPolicy.d.ts +84 -0
- package/dist/contextPackPolicy.js +347 -0
- package/dist/contextPackPolicy.js.map +1 -0
- package/dist/contextPackSchema.d.ts +7 -0
- package/{src/contextPackSchema.ts → dist/contextPackSchema.js} +22 -70
- package/dist/contextPackSchema.js.map +1 -0
- package/dist/contextTypes.d.ts +135 -0
- package/dist/contextTypes.js +3 -0
- package/dist/contextTypes.js.map +1 -0
- package/dist/contracts/api-enums.contract.d.ts +81 -0
- package/dist/contracts/api-enums.contract.js +92 -0
- package/dist/contracts/api-enums.contract.js.map +1 -0
- package/dist/contracts/auth-session.contract.d.ts +55 -0
- package/dist/contracts/auth-session.contract.js +48 -0
- package/dist/contracts/auth-session.contract.js.map +1 -0
- package/dist/contracts/context-pack.contract.d.ts +492 -0
- package/dist/contracts/context-pack.contract.js +98 -0
- package/dist/contracts/context-pack.contract.js.map +1 -0
- package/dist/contracts/contextPack.d.ts +1 -0
- package/dist/contracts/contextPack.js +98 -0
- package/dist/contracts/contextPack.js.map +1 -0
- package/dist/contracts/index.d.ts +9 -0
- package/dist/contracts/index.js +4892 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/lens-filter.contract.d.ts +72 -0
- package/dist/contracts/lens-filter.contract.js +71 -0
- package/dist/contracts/lens-filter.contract.js.map +1 -0
- package/dist/contracts/lens-workflow.contract.d.ts +87 -0
- package/dist/contracts/lens-workflow.contract.js +123 -0
- package/dist/contracts/lens-workflow.contract.js.map +1 -0
- package/dist/contracts/lensFilter.d.ts +1 -0
- package/dist/contracts/lensFilter.js +71 -0
- package/dist/contracts/lensFilter.js.map +1 -0
- package/dist/contracts/lensWorkflow.d.ts +2 -0
- package/dist/contracts/lensWorkflow.js +123 -0
- package/dist/contracts/lensWorkflow.js.map +1 -0
- package/dist/contracts/mcp-tools.contract.d.ts +1 -0
- package/dist/contracts/mcp-tools.contract.js +2986 -0
- package/dist/contracts/mcp-tools.contract.js.map +1 -0
- package/dist/contracts/mcpTools.d.ts +1 -0
- package/dist/contracts/mcpTools.js +2986 -0
- package/dist/contracts/mcpTools.js.map +1 -0
- package/dist/contracts/prompt.contract.d.ts +26 -0
- package/dist/contracts/prompt.contract.js +12 -0
- package/dist/contracts/prompt.contract.js.map +1 -0
- package/dist/contracts/prompt.d.ts +1 -0
- package/dist/contracts/prompt.js +12 -0
- package/dist/contracts/prompt.js.map +1 -0
- package/dist/contracts/sdk-tools.contract.d.ts +2 -0
- package/dist/contracts/sdk-tools.contract.js +4134 -0
- package/dist/contracts/sdk-tools.contract.js.map +1 -0
- package/dist/contracts/sdkTools.d.ts +2 -0
- package/dist/contracts/sdkTools.js +4134 -0
- package/dist/contracts/sdkTools.js.map +1 -0
- package/dist/contracts/workflow-runtime.contract.d.ts +163 -0
- package/dist/contracts/workflow-runtime.contract.js +245 -0
- package/dist/contracts/workflow-runtime.contract.js.map +1 -0
- package/dist/contracts/workflowRuntime.d.ts +1 -0
- package/dist/contracts/workflowRuntime.js +245 -0
- package/dist/contracts/workflowRuntime.js.map +1 -0
- package/dist/controlObjectOwnership.d.ts +310 -0
- package/{src/controlObjectOwnership.ts → dist/controlObjectOwnership.js} +53 -124
- package/dist/controlObjectOwnership.js.map +1 -0
- package/dist/coreClient.d.ts +144 -0
- package/dist/coreClient.js +339 -0
- package/dist/coreClient.js.map +1 -0
- package/dist/customTools.d.ts +88 -0
- package/dist/customTools.js +248 -0
- package/dist/customTools.js.map +1 -0
- package/dist/decisionsClient.d.ts +111 -0
- package/dist/decisionsClient.js +522 -0
- package/dist/decisionsClient.js.map +1 -0
- package/dist/domainContext.d.ts +1 -0
- package/dist/domainContext.js +3 -0
- package/dist/domainContext.js.map +1 -0
- package/dist/events.d.ts +178 -0
- package/dist/events.js +249 -0
- package/dist/events.js.map +1 -0
- package/dist/eventsCore.d.ts +49 -0
- package/dist/eventsCore.js +429 -0
- package/dist/eventsCore.js.map +1 -0
- package/dist/facade/context.d.ts +18 -0
- package/dist/facade/context.js +73 -0
- package/dist/facade/context.js.map +1 -0
- package/dist/gatewayFacades.d.ts +591 -0
- package/dist/gatewayFacades.js +1953 -0
- package/dist/gatewayFacades.js.map +1 -0
- package/dist/graphClient.d.ts +271 -0
- package/dist/graphClient.js +698 -0
- package/dist/graphClient.js.map +1 -0
- package/dist/harnessClient.d.ts +314 -0
- package/dist/harnessClient.js +607 -0
- package/dist/harnessClient.js.map +1 -0
- package/dist/identityClient.d.ts +140 -0
- package/dist/identityClient.js +497 -0
- package/dist/identityClient.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +11381 -0
- package/dist/index.js.map +1 -0
- package/dist/learningClient.d.ts +46 -0
- package/dist/learningClient.js +409 -0
- package/dist/learningClient.js.map +1 -0
- package/dist/mcpParityClient.d.ts +74 -0
- package/dist/mcpParityClient.js +516 -0
- package/dist/mcpParityClient.js.map +1 -0
- package/dist/mcpParitySurface.d.ts +12 -0
- package/{src/mcpParitySurface.ts → dist/mcpParitySurface.js} +9 -14
- package/dist/mcpParitySurface.js.map +1 -0
- package/dist/mcpTools-DPZxowDX.d.ts +254 -0
- package/dist/ontologyClient.d.ts +137 -0
- package/dist/ontologyClient.js +513 -0
- package/dist/ontologyClient.js.map +1 -0
- package/dist/packRuntime.d.ts +2 -0
- package/dist/packRuntime.js +3 -0
- package/dist/packRuntime.js.map +1 -0
- package/dist/packsClient.d.ts +131 -0
- package/dist/packsClient.js +525 -0
- package/dist/packsClient.js.map +1 -0
- package/dist/policyClient.d.ts +299 -0
- package/dist/policyClient.js +625 -0
- package/dist/policyClient.js.map +1 -0
- package/dist/realtime/index.d.ts +29 -0
- package/dist/realtime/index.js +23 -0
- package/dist/realtime/index.js.map +1 -0
- package/{src/realtime/refs.ts → dist/realtime/refs.d.ts} +5 -5
- package/dist/realtime/refs.js +9 -0
- package/dist/realtime/refs.js.map +1 -0
- package/dist/reportsClient.d.ts +41 -0
- package/dist/reportsClient.js +418 -0
- package/dist/reportsClient.js.map +1 -0
- package/dist/schemaClient.d.ts +64 -0
- package/dist/schemaClient.js +434 -0
- package/dist/schemaClient.js.map +1 -0
- package/dist/sdkSurface.d.ts +61 -0
- package/dist/sdkSurface.js +112 -0
- package/dist/sdkSurface.js.map +1 -0
- package/dist/sdkTools-CwXJDACb.d.ts +150 -0
- package/dist/topicsClient.d.ts +84 -0
- package/dist/topicsClient.js +492 -0
- package/dist/topicsClient.js.map +1 -0
- package/dist/types.d.ts +696 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/workflowClient.d.ts +316 -0
- package/dist/workflowClient.js +830 -0
- package/dist/workflowClient.js.map +1 -0
- package/package.json +31 -7
- package/.turbo/turbo-build.log +0 -7
- package/.turbo/turbo-typecheck.log +0 -4
- package/examples/README.md +0 -69
- package/examples/contradiction.ts +0 -94
- package/examples/investigation-context.ts +0 -118
- package/examples/questions-and-tasks.ts +0 -55
- package/examples/quickstart.ts +0 -97
- package/examples/shared.ts +0 -318
- package/examples/strict-public-types.ts +0 -143
- package/examples/worktree-lifecycle.ts +0 -79
- package/src/README.md +0 -6
- package/src/adminClient.ts +0 -789
- package/src/answersClient.ts +0 -29
- package/src/audiencesClient.ts +0 -209
- package/src/auditClient.ts +0 -50
- package/src/beliefsClient.ts +0 -319
- package/src/client.ts +0 -2647
- package/src/contextClient.ts +0 -130
- package/src/contextFacade.ts +0 -15
- package/src/contextPackCompiler.ts +0 -828
- package/src/contextTypes.ts +0 -153
- package/src/contracts/api-enums.contract.ts +0 -202
- package/src/contracts/auth-session.contract.ts +0 -109
- package/src/contracts/context-pack.contract.ts +0 -700
- package/src/contracts/contextPack.ts +0 -1
- package/src/contracts/index.ts +0 -10
- package/src/contracts/lens-filter.contract.ts +0 -183
- package/src/contracts/lens-workflow.contract.ts +0 -162
- package/src/contracts/lensFilter.ts +0 -1
- package/src/contracts/lensWorkflow.ts +0 -1
- package/src/contracts/mcp-tools.contract.ts +0 -3636
- package/src/contracts/mcpTools.ts +0 -1
- package/src/contracts/prompt.contract.ts +0 -50
- package/src/contracts/prompt.ts +0 -1
- package/src/contracts/sdk-tools.contract.ts +0 -1457
- package/src/contracts/sdkTools.ts +0 -1
- package/src/contracts/workflow-runtime.contract.ts +0 -440
- package/src/contracts/workflowRuntime.ts +0 -1
- package/src/coreClient.ts +0 -570
- package/src/customTools.ts +0 -398
- package/src/decisionsClient.ts +0 -286
- package/src/domainContext.ts +0 -15
- package/src/events.ts +0 -531
- package/src/eventsCore.ts +0 -168
- package/src/facade/beliefs.ts +0 -83
- package/src/facade/context.ts +0 -110
- package/src/facade/contradictions.ts +0 -29
- package/src/facade/edges.ts +0 -30
- package/src/facade/events.ts +0 -23
- package/src/facade/evidence.ts +0 -41
- package/src/facade/graph.ts +0 -38
- package/src/facade/identity.ts +0 -16
- package/src/facade/ontologies.ts +0 -34
- package/src/facade/questions.ts +0 -59
- package/src/facade/search.ts +0 -16
- package/src/facade/tasks.ts +0 -37
- package/src/facade/topics.ts +0 -42
- package/src/facade/webhooks.ts +0 -58
- package/src/facade/worktrees.ts +0 -51
- package/src/gatewayFacades.ts +0 -1666
- package/src/graphClient.ts +0 -529
- package/src/harnessClient.ts +0 -585
- package/src/identityClient.ts +0 -278
- package/src/index.ts +0 -49
- package/src/learningClient.ts +0 -95
- package/src/mcpParityClient.ts +0 -240
- package/src/ontologyClient.ts +0 -275
- package/src/packRuntime.ts +0 -3
- package/src/packsClient.ts +0 -260
- package/src/policyClient.ts +0 -572
- package/src/promptCatalog.ts +0 -1
- package/src/realtime/index.ts +0 -51
- package/src/reportsClient.ts +0 -99
- package/src/schemaClient.ts +0 -129
- package/src/sdkSurface.ts +0 -190
- package/src/topicsClient.ts +0 -243
- package/src/types.ts +0 -807
- package/src/version.ts +0 -2
- package/src/workflowClient.ts +0 -826
- package/tsconfig.json +0 -9
package/src/harnessClient.ts
DELETED
|
@@ -1,585 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createGatewayRequestClient,
|
|
3
|
-
type GatewayClientConfig,
|
|
4
|
-
type GatewayScope,
|
|
5
|
-
LucernApiError,
|
|
6
|
-
randomIdempotencyKey,
|
|
7
|
-
toQueryString,
|
|
8
|
-
} from "./coreClient";
|
|
9
|
-
import { createListResult, mapGatewayData, normalizeTopicQuery } from "./sdkSurface";
|
|
10
|
-
import type { JsonObject, JsonValue, TopicIdentifierInput } from "./types";
|
|
11
|
-
|
|
12
|
-
export { LucernApiError };
|
|
13
|
-
export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
|
|
14
|
-
|
|
15
|
-
/** Configuration for the harness client. Inherits gateway transport settings. */
|
|
16
|
-
export type HarnessClientConfig = GatewayClientConfig;
|
|
17
|
-
|
|
18
|
-
export type HarnessAgentGuardrails = {
|
|
19
|
-
isolationMode?: "direct" | "sandbox";
|
|
20
|
-
maxExecutionMs?: number;
|
|
21
|
-
heartbeatIntervalMs?: number;
|
|
22
|
-
maxToolCalls?: number;
|
|
23
|
-
allowNetworkEgress?: boolean;
|
|
24
|
-
allowedOrigins?: string[];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type HarnessAgentRuntimeConfig = {
|
|
28
|
-
entryPoint?: string;
|
|
29
|
-
callbackUrl?: string;
|
|
30
|
-
modelRouting?: "model_machine" | "tenant_proxy" | "bring_your_own";
|
|
31
|
-
auditMode?: "harness" | "master_control";
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** Input for creating or updating an agent definition in the harness registry. */
|
|
35
|
-
export type HarnessAgentWriteInput = GatewayScope & {
|
|
36
|
-
agentDefinitionId?: string;
|
|
37
|
-
agentKey: string;
|
|
38
|
-
displayName: string;
|
|
39
|
-
description: string;
|
|
40
|
-
version: string;
|
|
41
|
-
status?: "active" | "deprecated" | "disabled";
|
|
42
|
-
executionAdapter:
|
|
43
|
-
| "convex_mutation"
|
|
44
|
-
| "convex_action"
|
|
45
|
-
| "http_callback"
|
|
46
|
-
| "mcp_tool"
|
|
47
|
-
| "sdk_invocation"
|
|
48
|
-
| "external_observed";
|
|
49
|
-
scopeRequirements?: string[];
|
|
50
|
-
promptReleaseChannel?: "dev" | "staging" | "prod";
|
|
51
|
-
promptName?: string;
|
|
52
|
-
systemPrompt?: string;
|
|
53
|
-
toolIds?: string[];
|
|
54
|
-
modelSlot?: string;
|
|
55
|
-
requiredModelCapabilities?: string[];
|
|
56
|
-
parameterSchema?: JsonObject;
|
|
57
|
-
outputSchema?: JsonObject;
|
|
58
|
-
guardrails?: HarnessAgentGuardrails;
|
|
59
|
-
runtimeConfig?: HarnessAgentRuntimeConfig;
|
|
60
|
-
exampleInvocations?: Array<{
|
|
61
|
-
input: JsonObject;
|
|
62
|
-
expectedOutput?: JsonValue;
|
|
63
|
-
}>;
|
|
64
|
-
metadata?: JsonObject;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/** Input for creating or updating a tool definition in the harness registry. */
|
|
68
|
-
export type HarnessToolWriteInput = GatewayScope & {
|
|
69
|
-
toolId?: string;
|
|
70
|
-
toolName: string;
|
|
71
|
-
description: string;
|
|
72
|
-
version: string;
|
|
73
|
-
status?: "draft" | "active" | "deprecated" | "disabled";
|
|
74
|
-
executionAdapter:
|
|
75
|
-
| "convex_mutation"
|
|
76
|
-
| "convex_action"
|
|
77
|
-
| "http_callback"
|
|
78
|
-
| "mcp_tool"
|
|
79
|
-
| "sdk_invocation"
|
|
80
|
-
| "external_observed";
|
|
81
|
-
gateClassification?: "core" | "shimmed";
|
|
82
|
-
scopeRequirements?: string[];
|
|
83
|
-
requiredRole?: string;
|
|
84
|
-
requiredAction?: string;
|
|
85
|
-
surfaces?: string[];
|
|
86
|
-
category?: string;
|
|
87
|
-
parameterSchema?: JsonObject;
|
|
88
|
-
returnSchema?: JsonObject;
|
|
89
|
-
handlerRef?: string;
|
|
90
|
-
callbackUrl?: string;
|
|
91
|
-
safetyMetadata: {
|
|
92
|
-
readOnly?: boolean;
|
|
93
|
-
idempotent?: boolean;
|
|
94
|
-
sideEffectLevel: "none" | "low" | "high";
|
|
95
|
-
};
|
|
96
|
-
exampleInvocations?: Array<{
|
|
97
|
-
input: JsonObject;
|
|
98
|
-
expectedOutput?: JsonValue;
|
|
99
|
-
}>;
|
|
100
|
-
metadata?: JsonObject;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export type HarnessExecuteToolInput = GatewayScope & {
|
|
104
|
-
input?: JsonObject;
|
|
105
|
-
version?: string;
|
|
106
|
-
transportKind?: string;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export type HarnessExecuteToolResult = {
|
|
110
|
-
tool: {
|
|
111
|
-
toolId: string;
|
|
112
|
-
toolName: string;
|
|
113
|
-
version: string;
|
|
114
|
-
status: "active" | "deprecated" | "disabled";
|
|
115
|
-
executionAdapter:
|
|
116
|
-
| "convex_mutation"
|
|
117
|
-
| "convex_action"
|
|
118
|
-
| "http_callback"
|
|
119
|
-
| "mcp_tool"
|
|
120
|
-
| "sdk_invocation"
|
|
121
|
-
| "external_observed";
|
|
122
|
-
gateClassification: "core" | "shimmed";
|
|
123
|
-
scopeRequirements: string[];
|
|
124
|
-
safetyMetadata: {
|
|
125
|
-
readOnly: boolean;
|
|
126
|
-
idempotent: boolean;
|
|
127
|
-
sideEffectLevel: "none" | "low" | "high";
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
execution: {
|
|
131
|
-
input: JsonObject;
|
|
132
|
-
transportKind: string;
|
|
133
|
-
startedAt: number;
|
|
134
|
-
completedAt: number;
|
|
135
|
-
durationMs: number;
|
|
136
|
-
};
|
|
137
|
-
envelope: JsonObject | null;
|
|
138
|
-
audit: {
|
|
139
|
-
toolName: string;
|
|
140
|
-
contractName: string;
|
|
141
|
-
transportKind: string;
|
|
142
|
-
authMode: string;
|
|
143
|
-
requiredScopes: string[];
|
|
144
|
-
source: "gateway_envelope";
|
|
145
|
-
isError: boolean;
|
|
146
|
-
code?: string;
|
|
147
|
-
status?: number;
|
|
148
|
-
correlationId?: string | null;
|
|
149
|
-
policyTraceId?: string | null;
|
|
150
|
-
invariant?: string | null;
|
|
151
|
-
} | null;
|
|
152
|
-
output: {
|
|
153
|
-
isError: boolean;
|
|
154
|
-
parsed: JsonValue;
|
|
155
|
-
raw: JsonValue;
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/** Input for starting a new harness run (agent execution session). */
|
|
160
|
-
export type HarnessStartRunInput = GatewayScope & {
|
|
161
|
-
agentDefinitionId: string;
|
|
162
|
-
agentVersion: string;
|
|
163
|
-
executionAdapter:
|
|
164
|
-
| "convex_mutation"
|
|
165
|
-
| "convex_action"
|
|
166
|
-
| "http_callback"
|
|
167
|
-
| "mcp_tool"
|
|
168
|
-
| "sdk_invocation"
|
|
169
|
-
| "external_observed";
|
|
170
|
-
promptReleaseChannel?: "dev" | "staging" | "prod";
|
|
171
|
-
chatId?: string;
|
|
172
|
-
worktreeId?: string;
|
|
173
|
-
topicId?: string;
|
|
174
|
-
langfuseTraceId?: string;
|
|
175
|
-
metadata?: JsonObject;
|
|
176
|
-
} & TopicIdentifierInput;
|
|
177
|
-
|
|
178
|
-
export type HarnessInvokeManagedAgentInput = GatewayScope & {
|
|
179
|
-
agentDefinitionId: string;
|
|
180
|
-
input?: JsonObject;
|
|
181
|
-
metadata?: JsonObject;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
/** Input for reporting a ledger event (tool call, prompt resolution, or policy decision) within a run. */
|
|
185
|
-
export type HarnessRunReportInput = {
|
|
186
|
-
reportingToken: string;
|
|
187
|
-
type: "tool_call" | "prompt_resolution" | "policy_decision";
|
|
188
|
-
metadata?: JsonObject;
|
|
189
|
-
toolCallId?: string;
|
|
190
|
-
toolName?: string;
|
|
191
|
-
executionAdapter?:
|
|
192
|
-
| "convex_mutation"
|
|
193
|
-
| "convex_action"
|
|
194
|
-
| "http_callback"
|
|
195
|
-
| "mcp_tool"
|
|
196
|
-
| "sdk_invocation"
|
|
197
|
-
| "external_observed";
|
|
198
|
-
policyDecisionId?: string;
|
|
199
|
-
requiredScopes?: string[];
|
|
200
|
-
policyResult?: "allowed" | "denied";
|
|
201
|
-
policyReasonCode?: string;
|
|
202
|
-
inputHash?: string;
|
|
203
|
-
outputHash?: string;
|
|
204
|
-
durationMs?: number;
|
|
205
|
-
success?: boolean;
|
|
206
|
-
startedAt?: number;
|
|
207
|
-
completedAt?: number;
|
|
208
|
-
input?: JsonObject;
|
|
209
|
-
result?: JsonValue;
|
|
210
|
-
promptKey?: string;
|
|
211
|
-
promptVersion?: string;
|
|
212
|
-
decision?: string;
|
|
213
|
-
reasonCode?: string;
|
|
214
|
-
latencyMs?: number;
|
|
215
|
-
error?:
|
|
216
|
-
| string
|
|
217
|
-
| {
|
|
218
|
-
code?: string;
|
|
219
|
-
message: string;
|
|
220
|
-
details?: JsonValue;
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
/** Input for completing a harness run with a terminal status. */
|
|
225
|
-
export type HarnessCompleteRunInput = {
|
|
226
|
-
reportingToken: string;
|
|
227
|
-
status: "completed" | "failed" | "timeout";
|
|
228
|
-
error?: {
|
|
229
|
-
category:
|
|
230
|
-
| "policy_denied"
|
|
231
|
-
| "tool_execution"
|
|
232
|
-
| "prompt_resolution"
|
|
233
|
-
| "model_error"
|
|
234
|
-
| "timeout"
|
|
235
|
-
| "heartbeat_timeout"
|
|
236
|
-
| "input_validation"
|
|
237
|
-
| "internal"
|
|
238
|
-
| "external_service";
|
|
239
|
-
message: string;
|
|
240
|
-
code?: string;
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Create the harness client for agent and tool registry operations.
|
|
246
|
-
*/
|
|
247
|
-
export function createHarnessClient(config: HarnessClientConfig = {}) {
|
|
248
|
-
const gateway = createGatewayRequestClient(config);
|
|
249
|
-
|
|
250
|
-
return {
|
|
251
|
-
/**
|
|
252
|
-
* List agent definitions.
|
|
253
|
-
*/
|
|
254
|
-
async listAgentDefinitions(
|
|
255
|
-
scope: GatewayScope & {
|
|
256
|
-
status?: string;
|
|
257
|
-
limit?: number;
|
|
258
|
-
cursor?: string;
|
|
259
|
-
} = {}
|
|
260
|
-
) {
|
|
261
|
-
return gateway.request<unknown>({
|
|
262
|
-
path: `/api/platform/v1/harness/agents${toQueryString(scope)}`,
|
|
263
|
-
}).then((response) =>
|
|
264
|
-
mapGatewayData(response, (data) =>
|
|
265
|
-
createListResult(Array.isArray(data) ? data : [], "agents")
|
|
266
|
-
)
|
|
267
|
-
);
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Get an agent definition.
|
|
272
|
-
*/
|
|
273
|
-
async getAgentDefinition(agentId: string, scope: GatewayScope = {}) {
|
|
274
|
-
return gateway.request<unknown>({
|
|
275
|
-
path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}${toQueryString(scope)}`,
|
|
276
|
-
});
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Create an agent definition.
|
|
281
|
-
*/
|
|
282
|
-
async createAgentDefinition(
|
|
283
|
-
input: HarnessAgentWriteInput,
|
|
284
|
-
idempotencyKey?: string
|
|
285
|
-
) {
|
|
286
|
-
return gateway.request<unknown>({
|
|
287
|
-
path: "/api/platform/v1/harness/agents",
|
|
288
|
-
method: "POST",
|
|
289
|
-
body: input,
|
|
290
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
291
|
-
});
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* @deprecated Use createAgentDefinition.
|
|
296
|
-
*/
|
|
297
|
-
async registerAgentDefinition(
|
|
298
|
-
input: HarnessAgentWriteInput,
|
|
299
|
-
idempotencyKey?: string
|
|
300
|
-
) {
|
|
301
|
-
return this.createAgentDefinition(input, idempotencyKey);
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Update an agent definition.
|
|
306
|
-
*/
|
|
307
|
-
async updateAgentDefinition(
|
|
308
|
-
agentId: string,
|
|
309
|
-
input: HarnessAgentWriteInput,
|
|
310
|
-
idempotencyKey?: string
|
|
311
|
-
) {
|
|
312
|
-
return gateway.request<unknown>({
|
|
313
|
-
path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}`,
|
|
314
|
-
method: "PUT",
|
|
315
|
-
body: input,
|
|
316
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
317
|
-
});
|
|
318
|
-
},
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Invoke a managed agent definition.
|
|
322
|
-
*/
|
|
323
|
-
async invokeManagedAgentDefinition(
|
|
324
|
-
agentId: string,
|
|
325
|
-
input: Omit<HarnessInvokeManagedAgentInput, "agentDefinitionId">,
|
|
326
|
-
idempotencyKey?: string
|
|
327
|
-
) {
|
|
328
|
-
return gateway.request<unknown>({
|
|
329
|
-
path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}/runs`,
|
|
330
|
-
method: "POST",
|
|
331
|
-
body: {
|
|
332
|
-
agentDefinitionId: agentId,
|
|
333
|
-
...input,
|
|
334
|
-
},
|
|
335
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
336
|
-
});
|
|
337
|
-
},
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* List runs for an agent definition.
|
|
341
|
-
*/
|
|
342
|
-
async listAgentRuns(
|
|
343
|
-
agentId: string,
|
|
344
|
-
scope: GatewayScope & {
|
|
345
|
-
status?: string;
|
|
346
|
-
limit?: number;
|
|
347
|
-
cursor?: string;
|
|
348
|
-
} = {}
|
|
349
|
-
) {
|
|
350
|
-
return gateway.request<unknown>({
|
|
351
|
-
path: `/api/platform/v1/harness/agents/${encodeURIComponent(agentId)}/runs${toQueryString(scope)}`,
|
|
352
|
-
}).then((response) =>
|
|
353
|
-
mapGatewayData(response, (data) =>
|
|
354
|
-
createListResult(Array.isArray(data) ? data : [], "runs")
|
|
355
|
-
)
|
|
356
|
-
);
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* @deprecated Use listAgentRuns.
|
|
361
|
-
*/
|
|
362
|
-
async listRunsForAgent(
|
|
363
|
-
agentId: string,
|
|
364
|
-
scope: GatewayScope & {
|
|
365
|
-
status?: string;
|
|
366
|
-
limit?: number;
|
|
367
|
-
cursor?: string;
|
|
368
|
-
} = {}
|
|
369
|
-
) {
|
|
370
|
-
return this.listAgentRuns(agentId, scope);
|
|
371
|
-
},
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* List tool definitions.
|
|
375
|
-
*/
|
|
376
|
-
async listToolDefinitions(
|
|
377
|
-
scope: GatewayScope & {
|
|
378
|
-
status?: string;
|
|
379
|
-
limit?: number;
|
|
380
|
-
cursor?: string;
|
|
381
|
-
gateClassification?: string;
|
|
382
|
-
} = {}
|
|
383
|
-
) {
|
|
384
|
-
return gateway.request<unknown>({
|
|
385
|
-
path: `/api/platform/v1/harness/tools${toQueryString(scope)}`,
|
|
386
|
-
}).then((response) =>
|
|
387
|
-
mapGatewayData(response, (data) =>
|
|
388
|
-
createListResult(Array.isArray(data) ? data : [], "tools")
|
|
389
|
-
)
|
|
390
|
-
);
|
|
391
|
-
},
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Get a tool definition.
|
|
395
|
-
*/
|
|
396
|
-
async getToolDefinition(toolId: string, scope: GatewayScope = {}) {
|
|
397
|
-
return gateway.request<unknown>({
|
|
398
|
-
path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}${toQueryString(scope)}`,
|
|
399
|
-
});
|
|
400
|
-
},
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Create a tool definition.
|
|
404
|
-
*/
|
|
405
|
-
async createToolDefinition(
|
|
406
|
-
input: HarnessToolWriteInput,
|
|
407
|
-
idempotencyKey?: string
|
|
408
|
-
) {
|
|
409
|
-
return gateway.request<unknown>({
|
|
410
|
-
path: "/api/platform/v1/harness/tools",
|
|
411
|
-
method: "POST",
|
|
412
|
-
body: input,
|
|
413
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
414
|
-
});
|
|
415
|
-
},
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* @deprecated Use createToolDefinition.
|
|
419
|
-
*/
|
|
420
|
-
async registerToolDefinition(
|
|
421
|
-
input: HarnessToolWriteInput,
|
|
422
|
-
idempotencyKey?: string
|
|
423
|
-
) {
|
|
424
|
-
return this.createToolDefinition(input, idempotencyKey);
|
|
425
|
-
},
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Update a tool definition.
|
|
429
|
-
*/
|
|
430
|
-
async updateToolDefinition(
|
|
431
|
-
toolId: string,
|
|
432
|
-
input: HarnessToolWriteInput,
|
|
433
|
-
idempotencyKey?: string
|
|
434
|
-
) {
|
|
435
|
-
return gateway.request<unknown>({
|
|
436
|
-
path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}`,
|
|
437
|
-
method: "PUT",
|
|
438
|
-
body: input,
|
|
439
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
440
|
-
});
|
|
441
|
-
},
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Execute a tool definition.
|
|
445
|
-
*/
|
|
446
|
-
async executeToolDefinition(
|
|
447
|
-
toolId: string,
|
|
448
|
-
input: HarnessExecuteToolInput = {}
|
|
449
|
-
) {
|
|
450
|
-
return gateway.request<HarnessExecuteToolResult>({
|
|
451
|
-
path: `/api/platform/v1/harness/tools/${encodeURIComponent(toolId)}/execute`,
|
|
452
|
-
method: "POST",
|
|
453
|
-
body: input,
|
|
454
|
-
});
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* List run ledger entries.
|
|
459
|
-
*/
|
|
460
|
-
async listRunEntries(
|
|
461
|
-
scope: GatewayScope & {
|
|
462
|
-
status?: string;
|
|
463
|
-
limit?: number;
|
|
464
|
-
cursor?: string;
|
|
465
|
-
} = {}
|
|
466
|
-
) {
|
|
467
|
-
return gateway.request<unknown>({
|
|
468
|
-
path: `/api/platform/v1/harness/runs${toQueryString(scope)}`,
|
|
469
|
-
}).then((response) =>
|
|
470
|
-
mapGatewayData(response, (data) =>
|
|
471
|
-
createListResult(Array.isArray(data) ? data : [], "runs")
|
|
472
|
-
)
|
|
473
|
-
);
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* @deprecated Use listRunEntries.
|
|
478
|
-
*/
|
|
479
|
-
async listRunLedgerEntries(
|
|
480
|
-
scope: GatewayScope & {
|
|
481
|
-
status?: string;
|
|
482
|
-
limit?: number;
|
|
483
|
-
cursor?: string;
|
|
484
|
-
} = {}
|
|
485
|
-
) {
|
|
486
|
-
return this.listRunEntries(scope);
|
|
487
|
-
},
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Create a harness run.
|
|
491
|
-
*/
|
|
492
|
-
async startHarnessRun(
|
|
493
|
-
input: HarnessStartRunInput,
|
|
494
|
-
idempotencyKey?: string
|
|
495
|
-
) {
|
|
496
|
-
return gateway.request<unknown>({
|
|
497
|
-
path: "/api/platform/v1/harness/runs",
|
|
498
|
-
method: "POST",
|
|
499
|
-
body: normalizeTopicQuery(input),
|
|
500
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
501
|
-
});
|
|
502
|
-
},
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Get a run ledger entry.
|
|
506
|
-
*/
|
|
507
|
-
async getRunLedgerEntry(runId: string) {
|
|
508
|
-
return gateway.request<unknown>({
|
|
509
|
-
path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}`,
|
|
510
|
-
});
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Update a harness run with a ledger event.
|
|
515
|
-
*/
|
|
516
|
-
async reportHarnessRunEvent(
|
|
517
|
-
runId: string,
|
|
518
|
-
input: HarnessRunReportInput,
|
|
519
|
-
idempotencyKey?: string
|
|
520
|
-
) {
|
|
521
|
-
return gateway.request<unknown>({
|
|
522
|
-
path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/report`,
|
|
523
|
-
method: "POST",
|
|
524
|
-
body: input,
|
|
525
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
526
|
-
});
|
|
527
|
-
},
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Update a harness run heartbeat.
|
|
531
|
-
*/
|
|
532
|
-
async heartbeatHarnessRun(
|
|
533
|
-
runId: string,
|
|
534
|
-
input: { reportingToken: string },
|
|
535
|
-
idempotencyKey?: string
|
|
536
|
-
) {
|
|
537
|
-
return gateway.request<unknown>({
|
|
538
|
-
path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/heartbeat`,
|
|
539
|
-
method: "POST",
|
|
540
|
-
body: input,
|
|
541
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
542
|
-
});
|
|
543
|
-
},
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Complete a harness run.
|
|
547
|
-
*/
|
|
548
|
-
async completeHarnessRun(
|
|
549
|
-
runId: string,
|
|
550
|
-
input: HarnessCompleteRunInput,
|
|
551
|
-
idempotencyKey?: string
|
|
552
|
-
) {
|
|
553
|
-
return gateway.request<unknown>({
|
|
554
|
-
path: `/api/platform/v1/harness/runs/${encodeURIComponent(runId)}/complete`,
|
|
555
|
-
method: "POST",
|
|
556
|
-
body: input,
|
|
557
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
558
|
-
});
|
|
559
|
-
},
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* List prompt resolutions.
|
|
563
|
-
*/
|
|
564
|
-
async listPromptResolutions(
|
|
565
|
-
query: { runId?: string; promptName?: string; limit?: number } = {}
|
|
566
|
-
) {
|
|
567
|
-
return gateway.request<unknown>({
|
|
568
|
-
path: `/api/platform/v1/harness/prompts${toQueryString(query)}`,
|
|
569
|
-
}).then((response) =>
|
|
570
|
-
mapGatewayData(response, (data) =>
|
|
571
|
-
createListResult(Array.isArray(data) ? data : [], "prompts")
|
|
572
|
-
)
|
|
573
|
-
);
|
|
574
|
-
},
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Get the harness scope taxonomy.
|
|
578
|
-
*/
|
|
579
|
-
async getScopeTaxonomy() {
|
|
580
|
-
return gateway.request<unknown>({
|
|
581
|
-
path: "/api/platform/v1/harness/scopes",
|
|
582
|
-
});
|
|
583
|
-
},
|
|
584
|
-
};
|
|
585
|
-
}
|