@agent-os-sdk/client 0.9.13 → 0.9.15
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/client/AgentOsClient.d.ts +8 -4
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +12 -6
- package/dist/errors/factory.d.ts +2 -0
- package/dist/errors/factory.d.ts.map +1 -1
- package/dist/errors/factory.js +5 -1
- package/dist/generated/openapi.d.ts +544 -744
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/modules/agents.d.ts +55 -7
- package/dist/modules/agents.d.ts.map +1 -1
- package/dist/modules/agents.js +68 -7
- package/dist/modules/contracts.d.ts +48 -0
- package/dist/modules/contracts.d.ts.map +1 -0
- package/dist/modules/contracts.js +25 -0
- package/dist/modules/evaluation.d.ts +64 -0
- package/dist/modules/evaluation.d.ts.map +1 -1
- package/dist/modules/evaluation.js +12 -0
- package/dist/modules/improvements.d.ts +52 -0
- package/dist/modules/improvements.d.ts.map +1 -0
- package/dist/modules/improvements.js +27 -0
- package/dist/modules/metaAgent.d.ts +62 -0
- package/dist/modules/metaAgent.d.ts.map +1 -0
- package/dist/modules/metaAgent.js +25 -0
- package/dist/modules/presets.d.ts.map +1 -1
- package/dist/modules/presets.js +113 -44
- package/dist/modules/runs.d.ts +9 -0
- package/dist/modules/runs.d.ts.map +1 -1
- package/dist/modules/runs.js +14 -1
- package/dist/modules/templates.d.ts +28 -0
- package/dist/modules/templates.d.ts.map +1 -0
- package/dist/modules/templates.js +19 -0
- package/package.json +52 -51
- package/src/client/AgentOsClient.ts +12 -6
- package/src/errors/factory.ts +7 -2
- package/src/generated/openapi.ts +544 -744
- package/src/generated/swagger.json +551 -924
- package/src/index.ts +22 -2
- package/src/modules/agents.ts +123 -8
- package/src/modules/contracts.ts +80 -0
- package/src/modules/evaluation.ts +80 -0
- package/src/modules/improvements.ts +71 -0
- package/src/modules/metaAgent.ts +87 -0
- package/src/modules/presets.ts +118 -50
- package/src/modules/runs.ts +20 -1
- package/src/modules/templates.ts +40 -0
- package/src/modules/builder.ts +0 -456
- package/src/modules/graphs.ts +0 -188
package/src/index.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* import { createClient } from "@agent-os-sdk/client";
|
|
18
18
|
*
|
|
19
19
|
* const api = createClient({ baseUrl, headers });
|
|
20
|
-
* const { data } = await api.POST("/v1/api/
|
|
20
|
+
* const { data } = await api.POST("/v1/api/contracts/validate", { body: {...} });
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
23
|
* @example Custom Client (ergonomic wrapper)
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* import { AgentOsClient } from "@agent-os-sdk/client";
|
|
26
26
|
*
|
|
27
27
|
* const client = new AgentOsClient({ baseUrl, auth: {...} });
|
|
28
|
-
* const { data } = await client.
|
|
28
|
+
* const { data } = await client.contracts.validate({...});
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
|
|
@@ -97,15 +97,35 @@ export type { SSEEvent, SSEOptions } from "./sse/client.js";
|
|
|
97
97
|
export * from "./modules/agents.js";
|
|
98
98
|
export * from "./modules/auth.js";
|
|
99
99
|
export * from "./modules/chatwoot.js";
|
|
100
|
+
export * from "./modules/catalog.js";
|
|
101
|
+
export * from "./modules/contracts.js";
|
|
100
102
|
export * from "./modules/credentials.js";
|
|
101
103
|
export * from "./modules/datasets.js";
|
|
104
|
+
export {
|
|
105
|
+
EvaluationModule,
|
|
106
|
+
type EvalDataset,
|
|
107
|
+
type DatasetListResponse,
|
|
108
|
+
type Experiment,
|
|
109
|
+
type ExperimentResults,
|
|
110
|
+
type ExperimentListResponse,
|
|
111
|
+
type DatasetExample as EvaluationDatasetExample,
|
|
112
|
+
type ExamplesListResponse,
|
|
113
|
+
type ExampleData,
|
|
114
|
+
type KpiAggregate,
|
|
115
|
+
type KpiAggregateListResponse,
|
|
116
|
+
type KpiAlert,
|
|
117
|
+
type KpiAlertListResponse
|
|
118
|
+
} from "./modules/evaluation.js";
|
|
119
|
+
export * from "./modules/improvements.js";
|
|
102
120
|
export * from "./modules/me.js";
|
|
103
121
|
export * from "./modules/members.js";
|
|
122
|
+
export * from "./modules/metaAgent.js";
|
|
104
123
|
export * from "./modules/observability.js";
|
|
105
124
|
export * from "./modules/presets.js";
|
|
106
125
|
export * from "./modules/prompts.js";
|
|
107
126
|
export * from "./modules/roles.js";
|
|
108
127
|
export * from "./modules/runs.js";
|
|
128
|
+
export * from "./modules/templates.js";
|
|
109
129
|
export * from "./modules/triggers.js";
|
|
110
130
|
export * from "./modules/usage.js";
|
|
111
131
|
export * from "./modules/workspaces.js";
|
package/src/modules/agents.ts
CHANGED
|
@@ -53,6 +53,22 @@ export interface GraphValidationResponse {
|
|
|
53
53
|
warnings?: string[];
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
export interface AgentDraftIrResponse {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
draft_ir_revision?: string | null;
|
|
60
|
+
draftIrRevision?: string | null;
|
|
61
|
+
draft_updated_at?: string | null;
|
|
62
|
+
draftUpdatedAt?: string | null;
|
|
63
|
+
live_bundle_id?: string | null;
|
|
64
|
+
liveBundleId?: string | null;
|
|
65
|
+
etag?: string;
|
|
66
|
+
e_tag?: string;
|
|
67
|
+
eTag?: string;
|
|
68
|
+
ir_json?: Record<string, unknown> | null;
|
|
69
|
+
irJson?: Record<string, unknown> | null;
|
|
70
|
+
}
|
|
71
|
+
|
|
56
72
|
export interface UpsertAgentCredentialBindingRequest {
|
|
57
73
|
credential_id: string;
|
|
58
74
|
alias: string;
|
|
@@ -70,6 +86,27 @@ export interface AgentCredentialBindingUpsertResponse {
|
|
|
70
86
|
|
|
71
87
|
export type AgentListResponse = PaginatedResponse<Agent>;
|
|
72
88
|
|
|
89
|
+
export interface AgentRuntimeContext {
|
|
90
|
+
agent_id: string;
|
|
91
|
+
context_key: string;
|
|
92
|
+
version_key: string;
|
|
93
|
+
version_number: number;
|
|
94
|
+
content_sha256: string;
|
|
95
|
+
content_length: number;
|
|
96
|
+
content: string;
|
|
97
|
+
updated_at: string;
|
|
98
|
+
source?: string | null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface AgentRuntimeContextListResponse {
|
|
102
|
+
items: AgentRuntimeContext[];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface UpsertAgentRuntimeContextRequest {
|
|
106
|
+
content: string;
|
|
107
|
+
source?: string | null;
|
|
108
|
+
}
|
|
109
|
+
|
|
73
110
|
export class AgentsModule {
|
|
74
111
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
75
112
|
|
|
@@ -166,6 +203,46 @@ export class AgentsModule {
|
|
|
166
203
|
});
|
|
167
204
|
}
|
|
168
205
|
|
|
206
|
+
// ======================== Runtime Contexts ========================
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* List current runtime contexts for an agent.
|
|
210
|
+
*/
|
|
211
|
+
async listRuntimeContexts(agentId: string): Promise<APIResponse<AgentRuntimeContextListResponse>> {
|
|
212
|
+
return this.client.GET<AgentRuntimeContextListResponse>("/v1/api/agents/{agentId}/runtime-contexts", {
|
|
213
|
+
params: { path: { agentId } },
|
|
214
|
+
headers: this.headers(),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Get the current runtime context for a given key.
|
|
220
|
+
*/
|
|
221
|
+
async getRuntimeContext(agentId: string, contextKey: string): Promise<APIResponse<AgentRuntimeContext>> {
|
|
222
|
+
return this.client.GET<AgentRuntimeContext>("/v1/api/agents/{agentId}/runtime-contexts/{contextKey}", {
|
|
223
|
+
params: { path: { agentId, contextKey } },
|
|
224
|
+
headers: this.headers(),
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Create or update the current runtime context for a given key.
|
|
230
|
+
*/
|
|
231
|
+
async upsertRuntimeContext(
|
|
232
|
+
agentId: string,
|
|
233
|
+
contextKey: string,
|
|
234
|
+
body: UpsertAgentRuntimeContextRequest
|
|
235
|
+
): Promise<APIResponse<AgentRuntimeContext>> {
|
|
236
|
+
return this.client.PUT<AgentRuntimeContext>("/v1/api/agents/{agentId}/runtime-contexts/{contextKey}", {
|
|
237
|
+
params: { path: { agentId, contextKey } },
|
|
238
|
+
body: {
|
|
239
|
+
content: body.content,
|
|
240
|
+
source: body.source ?? null,
|
|
241
|
+
},
|
|
242
|
+
headers: this.headers(),
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
169
246
|
// ======================== Portability ========================
|
|
170
247
|
|
|
171
248
|
/**
|
|
@@ -213,24 +290,64 @@ export class AgentsModule {
|
|
|
213
290
|
});
|
|
214
291
|
}
|
|
215
292
|
|
|
293
|
+
// ======================== Draft IR ========================
|
|
294
|
+
|
|
295
|
+
async getDraftIr(agentId: string): Promise<APIResponse<AgentDraftIrResponse>> {
|
|
296
|
+
return this.client.GET<AgentDraftIrResponse>("/v1/api/agents/{id}/draft/ir", {
|
|
297
|
+
params: { path: { id: agentId } },
|
|
298
|
+
headers: this.headers(),
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async updateDraftIr(
|
|
303
|
+
agentId: string,
|
|
304
|
+
irJson: Record<string, unknown>,
|
|
305
|
+
options?: { if_match?: string }
|
|
306
|
+
): Promise<APIResponse<AgentDraftIrResponse>> {
|
|
307
|
+
const headers: Record<string, string> = { ...this.headers() };
|
|
308
|
+
if (options?.if_match) {
|
|
309
|
+
headers["If-Match"] = options.if_match;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const response = await this.client.PUT<AgentDraftIrResponse | { data?: AgentDraftIrResponse }>("/v1/api/agents/{id}/draft/ir", {
|
|
313
|
+
params: { path: { id: agentId } },
|
|
314
|
+
body: {
|
|
315
|
+
ir_json: irJson,
|
|
316
|
+
} as any,
|
|
317
|
+
headers,
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
const unwrapped =
|
|
321
|
+
response.data &&
|
|
322
|
+
typeof response.data === "object" &&
|
|
323
|
+
"data" in response.data &&
|
|
324
|
+
typeof (response.data as { data?: unknown }).data === "object"
|
|
325
|
+
? ((response.data as { data?: AgentDraftIrResponse }).data ?? undefined)
|
|
326
|
+
: (response.data as AgentDraftIrResponse | undefined);
|
|
327
|
+
|
|
328
|
+
return {
|
|
329
|
+
...response,
|
|
330
|
+
data: unwrapped,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
216
334
|
// ======================== Publishing ========================
|
|
217
335
|
|
|
218
336
|
/**
|
|
219
|
-
* Publish
|
|
337
|
+
* Publish the committed agent artifact pointed to by the current authoring revision.
|
|
338
|
+
* The client does not send authoring JSON anymore.
|
|
220
339
|
* @param agentId The agent UUID
|
|
221
|
-
* @param graph_spec The graph specification to publish
|
|
222
340
|
* @param options Optional settings: version_label for tagging, set_as_live to make this the active version, idempotency_key for safe retries
|
|
223
341
|
* @returns Bundle response with version details
|
|
224
342
|
* @example
|
|
225
343
|
* ```ts
|
|
226
|
-
* const { data: bundle } = await client.agents.publish(agentId,
|
|
344
|
+
* const { data: bundle } = await client.agents.publish(agentId, {
|
|
227
345
|
* idempotency_key: "publish-unique-key"
|
|
228
346
|
* });
|
|
229
347
|
* ```
|
|
230
348
|
*/
|
|
231
349
|
async publish(
|
|
232
350
|
agentId: string,
|
|
233
|
-
graph_spec: Record<string, unknown>,
|
|
234
351
|
options?: {
|
|
235
352
|
version_label?: string | null;
|
|
236
353
|
set_as_live?: boolean;
|
|
@@ -247,7 +364,6 @@ export class AgentsModule {
|
|
|
247
364
|
return this.client.POST<components["schemas"]["BundleResponse"]>("/v1/api/agents/{id}/publish", {
|
|
248
365
|
params: { path: { id: agentId } },
|
|
249
366
|
body: {
|
|
250
|
-
graph_spec,
|
|
251
367
|
version_label: options?.version_label ?? null,
|
|
252
368
|
set_as_live: options?.set_as_live ?? true,
|
|
253
369
|
required_tools: options?.required_tools ?? []
|
|
@@ -260,11 +376,11 @@ export class AgentsModule {
|
|
|
260
376
|
|
|
261
377
|
/**
|
|
262
378
|
* Get the manifest for a specific bundle.
|
|
263
|
-
* Returns artifact metadata
|
|
379
|
+
* Returns artifact metadata only.
|
|
264
380
|
* @example
|
|
265
381
|
* ```ts
|
|
266
382
|
* const { data } = await client.agents.getBundleManifest(agentId, bundleId);
|
|
267
|
-
* console.log(data?.
|
|
383
|
+
* console.log(data?.artifact_hash);
|
|
268
384
|
* ```
|
|
269
385
|
*/
|
|
270
386
|
async getBundleManifest(agentId: string, bundleId: string): Promise<APIResponse<BundleManifestResponse>> {
|
|
@@ -315,7 +431,6 @@ export interface BundleManifestResponse {
|
|
|
315
431
|
format?: string;
|
|
316
432
|
schema_version?: string;
|
|
317
433
|
created_at?: string;
|
|
318
|
-
graph_spec?: Record<string, unknown>;
|
|
319
434
|
}
|
|
320
435
|
|
|
321
436
|
export interface BundleMermaidResponse {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { APIResponse, RawClient } from "../client/raw.js";
|
|
2
|
+
|
|
3
|
+
export interface ContractsValidationIssue {
|
|
4
|
+
code: string;
|
|
5
|
+
message: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
severity?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ContractsErrorCode =
|
|
11
|
+
| "CONTRACT_ID_INVALID"
|
|
12
|
+
| "RUNTIME_PACKAGE_COMPILE_INVALID"
|
|
13
|
+
| "INTERNAL_UNAUTHORIZED"
|
|
14
|
+
| "KERNEL_UNAVAILABLE"
|
|
15
|
+
| "KERNEL_ERROR"
|
|
16
|
+
| "INTERNAL_ERROR"
|
|
17
|
+
| "VALIDATION_ERROR";
|
|
18
|
+
|
|
19
|
+
export interface ContractsErrorResponse {
|
|
20
|
+
code: ContractsErrorCode;
|
|
21
|
+
message: string;
|
|
22
|
+
errors?: ContractsValidationIssue[];
|
|
23
|
+
supported_contract_ids?: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ContractsSupportedResponse {
|
|
27
|
+
contract_ids: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ContractsValidateRequest {
|
|
31
|
+
contract_id: string;
|
|
32
|
+
spec: unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ContractsValidateResponse {
|
|
36
|
+
contract_id: string;
|
|
37
|
+
valid: boolean;
|
|
38
|
+
errors: ContractsValidationIssue[];
|
|
39
|
+
warnings: ContractsValidationIssue[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ContractsCompileRuntimePackageRequest {
|
|
43
|
+
ir_spec: unknown;
|
|
44
|
+
capability_registry_spec: unknown;
|
|
45
|
+
policy_refs?: Record<string, unknown>;
|
|
46
|
+
runtime_config_refs?: Record<string, unknown>;
|
|
47
|
+
package_id?: string;
|
|
48
|
+
metadata?: Record<string, unknown>;
|
|
49
|
+
compiled_at?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ContractsCompileRuntimePackageResponse {
|
|
53
|
+
package_spec: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export class ContractsModule {
|
|
57
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) {}
|
|
58
|
+
|
|
59
|
+
async supported(): Promise<APIResponse<ContractsSupportedResponse>> {
|
|
60
|
+
return this.client.GET<ContractsSupportedResponse>("/v1/api/contracts/supported", {
|
|
61
|
+
headers: this.headers(),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async validate(body: ContractsValidateRequest): Promise<APIResponse<ContractsValidateResponse>> {
|
|
66
|
+
return this.client.POST<ContractsValidateResponse>("/v1/api/contracts/validate", {
|
|
67
|
+
body,
|
|
68
|
+
headers: this.headers(),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async compileRuntimePackage(
|
|
73
|
+
body: ContractsCompileRuntimePackageRequest,
|
|
74
|
+
): Promise<APIResponse<ContractsCompileRuntimePackageResponse>> {
|
|
75
|
+
return this.client.POST<ContractsCompileRuntimePackageResponse>("/v1/api/contracts/compile/runtime-package", {
|
|
76
|
+
body,
|
|
77
|
+
headers: this.headers(),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -63,6 +63,52 @@ export interface ExamplesListResponse {
|
|
|
63
63
|
total: number;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
export interface KpiAggregate {
|
|
67
|
+
kpi_key: string;
|
|
68
|
+
kpi_binding_version: string;
|
|
69
|
+
source_scope: string;
|
|
70
|
+
unit?: string | null;
|
|
71
|
+
events_n: number;
|
|
72
|
+
runs_n: number;
|
|
73
|
+
threads_n: number;
|
|
74
|
+
outcome_linked_n: number;
|
|
75
|
+
numeric_values_n: number;
|
|
76
|
+
value_number_sum?: number | null;
|
|
77
|
+
value_number_avg?: number | null;
|
|
78
|
+
value_number_min?: number | null;
|
|
79
|
+
value_number_max?: number | null;
|
|
80
|
+
first_recorded_at: string;
|
|
81
|
+
last_recorded_at: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface KpiAggregateListResponse {
|
|
85
|
+
items: KpiAggregate[];
|
|
86
|
+
total: number;
|
|
87
|
+
skip: number;
|
|
88
|
+
take: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface KpiAlert {
|
|
92
|
+
alert_code: string;
|
|
93
|
+
severity: "critical" | "warning" | "info";
|
|
94
|
+
kpi_key: string;
|
|
95
|
+
kpi_binding_version?: string | null;
|
|
96
|
+
source_scope?: string | null;
|
|
97
|
+
message: string;
|
|
98
|
+
events_n: number;
|
|
99
|
+
numeric_values_n: number;
|
|
100
|
+
outcome_linked_n: number;
|
|
101
|
+
first_recorded_at?: string | null;
|
|
102
|
+
last_recorded_at?: string | null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface KpiAlertListResponse {
|
|
106
|
+
items: KpiAlert[];
|
|
107
|
+
total: number;
|
|
108
|
+
skip: number;
|
|
109
|
+
take: number;
|
|
110
|
+
}
|
|
111
|
+
|
|
66
112
|
export class EvaluationModule {
|
|
67
113
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
68
114
|
|
|
@@ -186,4 +232,38 @@ export class EvaluationModule {
|
|
|
186
232
|
headers: this.headers(),
|
|
187
233
|
});
|
|
188
234
|
}
|
|
235
|
+
|
|
236
|
+
async listKpiAggregates(params?: {
|
|
237
|
+
runId?: string;
|
|
238
|
+
threadId?: string;
|
|
239
|
+
kpiKey?: string;
|
|
240
|
+
kpiBindingVersion?: string;
|
|
241
|
+
sourceScope?: string;
|
|
242
|
+
recordedAfter?: string;
|
|
243
|
+
recordedBefore?: string;
|
|
244
|
+
skip?: number;
|
|
245
|
+
take?: number;
|
|
246
|
+
}): Promise<APIResponse<KpiAggregateListResponse>> {
|
|
247
|
+
return this.client.GET<KpiAggregateListResponse>("/v1/api/evaluations/kpi-results/aggregates", {
|
|
248
|
+
params: { query: params },
|
|
249
|
+
headers: this.headers(),
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
async listKpiAlerts(params?: {
|
|
254
|
+
runId?: string;
|
|
255
|
+
threadId?: string;
|
|
256
|
+
kpiKey?: string;
|
|
257
|
+
sourceScope?: string;
|
|
258
|
+
recordedAfter?: string;
|
|
259
|
+
recordedBefore?: string;
|
|
260
|
+
staleAfterHours?: number;
|
|
261
|
+
skip?: number;
|
|
262
|
+
take?: number;
|
|
263
|
+
}): Promise<APIResponse<KpiAlertListResponse>> {
|
|
264
|
+
return this.client.GET<KpiAlertListResponse>("/v1/api/evaluations/kpi-results/alerts", {
|
|
265
|
+
params: { query: params },
|
|
266
|
+
headers: this.headers(),
|
|
267
|
+
});
|
|
268
|
+
}
|
|
189
269
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { APIResponse, RawClient } from "../client/raw.js";
|
|
2
|
+
|
|
3
|
+
export interface ImprovementCase {
|
|
4
|
+
id: string;
|
|
5
|
+
tenant_id: string;
|
|
6
|
+
workspace_id: string;
|
|
7
|
+
agent_id: string;
|
|
8
|
+
champion_bundle_id: string;
|
|
9
|
+
challenger_bundle_id: string;
|
|
10
|
+
eval_experiment_id?: string | null;
|
|
11
|
+
status: string;
|
|
12
|
+
trigger_kind: string;
|
|
13
|
+
improvement_policy_ref?: string | null;
|
|
14
|
+
summary?: string | null;
|
|
15
|
+
decision_comparison_id?: string | null;
|
|
16
|
+
approval_decision_reason?: string | null;
|
|
17
|
+
promotion_decision_reason?: string | null;
|
|
18
|
+
rejection_reason?: string | null;
|
|
19
|
+
rollback_reason?: string | null;
|
|
20
|
+
rollback_decision_comparison_id?: string | null;
|
|
21
|
+
rollback_source_bundle_id?: string | null;
|
|
22
|
+
rollback_target_bundle_id?: string | null;
|
|
23
|
+
created_by?: string | null;
|
|
24
|
+
approved_by?: string | null;
|
|
25
|
+
promoted_by?: string | null;
|
|
26
|
+
rejected_by?: string | null;
|
|
27
|
+
rolled_back_by?: string | null;
|
|
28
|
+
created_at: string;
|
|
29
|
+
updated_at: string;
|
|
30
|
+
approved_at?: string | null;
|
|
31
|
+
promoted_at?: string | null;
|
|
32
|
+
rejected_at?: string | null;
|
|
33
|
+
rolled_back_at?: string | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ImprovementCaseListResponse {
|
|
37
|
+
items: ImprovementCase[];
|
|
38
|
+
total: number;
|
|
39
|
+
skip: number;
|
|
40
|
+
take: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class ImprovementsModule {
|
|
44
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) {}
|
|
45
|
+
|
|
46
|
+
async list(params?: {
|
|
47
|
+
agentId?: string;
|
|
48
|
+
status?: string;
|
|
49
|
+
skip?: number;
|
|
50
|
+
take?: number;
|
|
51
|
+
}): Promise<APIResponse<ImprovementCaseListResponse>> {
|
|
52
|
+
return this.client.GET<ImprovementCaseListResponse>("/v1/api/improvements/cases", {
|
|
53
|
+
params: {
|
|
54
|
+
query: {
|
|
55
|
+
agentId: params?.agentId,
|
|
56
|
+
status: params?.status,
|
|
57
|
+
skip: params?.skip,
|
|
58
|
+
take: params?.take,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
headers: this.headers(),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async get(caseId: string): Promise<APIResponse<ImprovementCase>> {
|
|
66
|
+
return this.client.GET<ImprovementCase>("/v1/api/improvements/cases/{caseId}", {
|
|
67
|
+
params: { path: { caseId } },
|
|
68
|
+
headers: this.headers(),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { APIResponse, RawClient } from "../client/raw.js";
|
|
2
|
+
|
|
3
|
+
export interface MetaAgentPatchValidationIssue {
|
|
4
|
+
code: string;
|
|
5
|
+
message: string;
|
|
6
|
+
node_id?: string | null;
|
|
7
|
+
path?: string | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface MetaAgentPreviewValidationIssue {
|
|
11
|
+
code: string;
|
|
12
|
+
message: string;
|
|
13
|
+
path?: string | null;
|
|
14
|
+
severity?: string | null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface MetaAgentPatchOp {
|
|
18
|
+
op: string;
|
|
19
|
+
node_id?: string | null;
|
|
20
|
+
kind?: string | null;
|
|
21
|
+
label?: string | null;
|
|
22
|
+
data?: Record<string, unknown> | null;
|
|
23
|
+
set?: Record<string, unknown> | null;
|
|
24
|
+
from?: string | null;
|
|
25
|
+
to?: string | null;
|
|
26
|
+
entrypoint?: string | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface MetaAgentPatchProposal {
|
|
30
|
+
patch_id: string;
|
|
31
|
+
description?: string | null;
|
|
32
|
+
ops: MetaAgentPatchOp[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface MetaAgentPatchProposalResponse {
|
|
36
|
+
agent_id: string;
|
|
37
|
+
draft_revision?: string | null;
|
|
38
|
+
draft_etag: string;
|
|
39
|
+
source_contract: "agent_ir.v1";
|
|
40
|
+
patch?: MetaAgentPatchProposal | null;
|
|
41
|
+
preview_draft_ir?: Record<string, unknown> | null;
|
|
42
|
+
preview_valid: boolean;
|
|
43
|
+
preview_errors: MetaAgentPreviewValidationIssue[];
|
|
44
|
+
preview_warnings: MetaAgentPreviewValidationIssue[];
|
|
45
|
+
valid: boolean;
|
|
46
|
+
errors: MetaAgentPatchValidationIssue[];
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface MetaAgentApplyPatchResponse {
|
|
51
|
+
agent_id: string;
|
|
52
|
+
draft_revision?: string | null;
|
|
53
|
+
draft_etag_before: string;
|
|
54
|
+
draft_etag_after: string;
|
|
55
|
+
patch_id: string;
|
|
56
|
+
source_contract: "agent_ir.v1";
|
|
57
|
+
applied_at: string;
|
|
58
|
+
applied_by?: string | null;
|
|
59
|
+
draft_ir: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class MetaAgentModule {
|
|
63
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) {}
|
|
64
|
+
|
|
65
|
+
async propose(agentId: string, instruction: string): Promise<APIResponse<MetaAgentPatchProposalResponse>> {
|
|
66
|
+
return this.client.POST<MetaAgentPatchProposalResponse>("/v1/api/agents/{id}/meta-agent/proposals", {
|
|
67
|
+
params: { path: { id: agentId } },
|
|
68
|
+
headers: this.headers(),
|
|
69
|
+
body: { instruction },
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async apply(
|
|
74
|
+
agentId: string,
|
|
75
|
+
draftEtag: string,
|
|
76
|
+
patch: MetaAgentPatchProposal,
|
|
77
|
+
): Promise<APIResponse<MetaAgentApplyPatchResponse>> {
|
|
78
|
+
return this.client.POST<MetaAgentApplyPatchResponse>("/v1/api/agents/{id}/meta-agent/proposals/apply", {
|
|
79
|
+
params: { path: { id: agentId } },
|
|
80
|
+
headers: this.headers(),
|
|
81
|
+
body: {
|
|
82
|
+
draft_etag: draftEtag,
|
|
83
|
+
patch,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|