@agent-os-sdk/client 0.4.3 → 0.4.4
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 +0 -9
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +0 -10
- package/dist/generated/openapi.d.ts +93 -0
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/modules/agents.d.ts +9 -113
- package/dist/modules/agents.d.ts.map +1 -1
- package/dist/modules/agents.js +0 -81
- package/dist/modules/runs.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/AgentOsClient.ts +1 -19
- package/src/generated/openapi.ts +93 -0
- package/src/generated/swagger.json +142 -0
- package/src/modules/agents.ts +10 -166
package/src/modules/agents.ts
CHANGED
|
@@ -11,7 +11,11 @@ import type { RawClient, APIResponse, components } from "../client/raw.js";
|
|
|
11
11
|
import type { PaginationParams, PaginatedResponse } from "../client/helpers.js";
|
|
12
12
|
|
|
13
13
|
// Type aliases for this module
|
|
14
|
+
|
|
14
15
|
type AgentSchema = components["schemas"]["AgentExportAgent"];
|
|
16
|
+
// Bundle types from schema
|
|
17
|
+
type AgentBundleSchema = components["schemas"]["AgentExportBundle"];
|
|
18
|
+
|
|
15
19
|
// Response types
|
|
16
20
|
export interface Agent {
|
|
17
21
|
id: string;
|
|
@@ -21,57 +25,12 @@ export interface Agent {
|
|
|
21
25
|
tenant_id: string;
|
|
22
26
|
created_at: string;
|
|
23
27
|
updated_at: string;
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface AgentVersion {
|
|
28
|
-
id: string;
|
|
29
|
-
agent_id: string;
|
|
30
|
-
version_tag: string;
|
|
31
|
-
artifact_uri?: string;
|
|
32
|
-
artifact_hash?: string;
|
|
33
|
-
format?: string;
|
|
34
|
-
graph_spec?: unknown;
|
|
35
|
-
created_at: string;
|
|
36
|
-
draft_state?: string | null;
|
|
37
|
-
base_version_id?: string | null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface CreateDraftRequest {
|
|
41
|
-
/** Base type: "live" (current live version) or "version" (specific version) */
|
|
42
|
-
base?: "live" | "version";
|
|
43
|
-
/** Required when base="version" */
|
|
44
|
-
base_version_id?: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface CreateDraftResponse {
|
|
48
|
-
draft_version_id: string;
|
|
49
|
-
agent_id: string;
|
|
50
|
-
base_version_id?: string | null;
|
|
51
|
-
created_at: string;
|
|
28
|
+
live_bundle_id?: string | null;
|
|
52
29
|
}
|
|
53
30
|
|
|
54
|
-
export interface AgentBundle {
|
|
55
|
-
schema_version: string;
|
|
56
|
-
exported_at: string;
|
|
57
|
-
agent?: AgentBundleAgent;
|
|
58
|
-
versions?: AgentBundleVersion[];
|
|
59
|
-
}
|
|
60
31
|
|
|
61
|
-
export interface AgentBundleAgent {
|
|
62
|
-
id: string;
|
|
63
|
-
name: string;
|
|
64
|
-
live_version_id?: string | null;
|
|
65
|
-
}
|
|
66
32
|
|
|
67
|
-
export interface
|
|
68
|
-
id: string;
|
|
69
|
-
version_tag: string;
|
|
70
|
-
artifact_uri: string;
|
|
71
|
-
artifact_hash?: string;
|
|
72
|
-
format?: string;
|
|
73
|
-
created_at: string;
|
|
74
|
-
}
|
|
33
|
+
export interface AgentBundle extends AgentBundleSchema { }
|
|
75
34
|
|
|
76
35
|
export interface ImportAgentResponse {
|
|
77
36
|
agent_id: string;
|
|
@@ -79,30 +38,12 @@ export interface ImportAgentResponse {
|
|
|
79
38
|
versions_imported: number;
|
|
80
39
|
}
|
|
81
40
|
|
|
82
|
-
export interface
|
|
83
|
-
id: string;
|
|
41
|
+
export interface ImportAgentResponse {
|
|
84
42
|
agent_id: string;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface AgentVersionBundleResponse {
|
|
90
|
-
version: AgentVersionMetadata;
|
|
91
|
-
graph_spec: unknown;
|
|
92
|
-
artifact_hash: string;
|
|
93
|
-
format: string;
|
|
94
|
-
resolved_at: string;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface UpdateAgentVersionRequest {
|
|
98
|
-
graph_spec?: unknown;
|
|
43
|
+
message: string;
|
|
44
|
+
versions_imported: number;
|
|
99
45
|
}
|
|
100
46
|
|
|
101
|
-
export interface PublishAgentVersionResponse {
|
|
102
|
-
agent_id: string;
|
|
103
|
-
live_version_id: string;
|
|
104
|
-
status: string;
|
|
105
|
-
}
|
|
106
47
|
|
|
107
48
|
export interface AgentGraphResponse {
|
|
108
49
|
mermaid?: string;
|
|
@@ -116,7 +57,6 @@ export interface GraphValidationResponse {
|
|
|
116
57
|
}
|
|
117
58
|
|
|
118
59
|
export type AgentListResponse = PaginatedResponse<Agent>;
|
|
119
|
-
export type AgentVersionListResponse = PaginatedResponse<AgentVersion>;
|
|
120
60
|
|
|
121
61
|
export class AgentsModule {
|
|
122
62
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
@@ -181,7 +121,7 @@ export class AgentsModule {
|
|
|
181
121
|
async update(agentId: string, body: {
|
|
182
122
|
name?: string;
|
|
183
123
|
description?: string;
|
|
184
|
-
|
|
124
|
+
live_bundle_id?: string;
|
|
185
125
|
}): Promise<APIResponse<Agent>> {
|
|
186
126
|
return this.client.PUT<Agent>("/v1/api/agents/{agentId}", {
|
|
187
127
|
params: { path: { agentId } },
|
|
@@ -200,102 +140,6 @@ export class AgentsModule {
|
|
|
200
140
|
});
|
|
201
141
|
}
|
|
202
142
|
|
|
203
|
-
// ======================== Versions ========================
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* List all versions of an agent.
|
|
207
|
-
* @example
|
|
208
|
-
* ```ts
|
|
209
|
-
* const { data } = await client.agents.listVersions("agent-uuid");
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
async listVersions(agentId: string): Promise<APIResponse<AgentVersion[]>> {
|
|
213
|
-
return this.client.GET<AgentVersion[]>("/v1/api/agents/{agentId}/versions", {
|
|
214
|
-
params: { path: { agentId } },
|
|
215
|
-
headers: this.headers(),
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/** Alias for listVersions (convenience) */
|
|
220
|
-
versions = (agentId: string) => this.listVersions(agentId);
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Create a new version of an agent.
|
|
224
|
-
*/
|
|
225
|
-
async createVersion(agentId: string, body: {
|
|
226
|
-
version_tag: string;
|
|
227
|
-
artifact_uri?: string;
|
|
228
|
-
artifact_hash?: string;
|
|
229
|
-
format?: string;
|
|
230
|
-
graph_spec?: unknown;
|
|
231
|
-
}): Promise<APIResponse<AgentVersion>> {
|
|
232
|
-
return this.client.POST<AgentVersion>("/v1/api/agents/{agentId}/versions", {
|
|
233
|
-
params: { path: { agentId } },
|
|
234
|
-
body,
|
|
235
|
-
headers: this.headers(),
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Get a specific version of an agent.
|
|
241
|
-
*/
|
|
242
|
-
async getVersion(agentId: string, versionId: string): Promise<APIResponse<AgentVersion>> {
|
|
243
|
-
return this.client.GET<AgentVersion>("/v1/api/agents/{agentId}/versions/{versionId}", {
|
|
244
|
-
params: { path: { agentId, versionId } },
|
|
245
|
-
headers: this.headers(),
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Create or retrieve an active draft version for editing.
|
|
251
|
-
* This endpoint is idempotent - calling it multiple times returns the same draft.
|
|
252
|
-
* @example
|
|
253
|
-
* ```ts
|
|
254
|
-
* const { data } = await client.agents.createDraft("agent-uuid", { base: "live" });
|
|
255
|
-
* console.log(data?.draft_version_id);
|
|
256
|
-
* // Then call getBundle(draftVersionId) to load the graph
|
|
257
|
-
* ```
|
|
258
|
-
*/
|
|
259
|
-
async createDraft(agentId: string, body?: CreateDraftRequest): Promise<APIResponse<CreateDraftResponse>> {
|
|
260
|
-
return this.client.POST<CreateDraftResponse>("/v1/api/agents/{agentId}/versions/draft", {
|
|
261
|
-
params: { path: { agentId } },
|
|
262
|
-
body: body ?? { base: "live" },
|
|
263
|
-
headers: this.headers(),
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Get the full bundle for a version (including resolved graph_spec).
|
|
269
|
-
*/
|
|
270
|
-
async getBundle(agentId: string, versionId: string): Promise<APIResponse<AgentVersionBundleResponse>> {
|
|
271
|
-
return this.client.GET<AgentVersionBundleResponse>("/v1/api/agents/{agentId}/versions/{versionId}/bundle", {
|
|
272
|
-
params: { path: { agentId, versionId } },
|
|
273
|
-
headers: this.headers(),
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Update a draft version.
|
|
279
|
-
* Only allowed if draft_state="active".
|
|
280
|
-
*/
|
|
281
|
-
async updateVersion(agentId: string, versionId: string, body: UpdateAgentVersionRequest): Promise<APIResponse<AgentVersion>> {
|
|
282
|
-
return this.client.PATCH<AgentVersion>("/v1/api/agents/{agentId}/versions/{versionId}", {
|
|
283
|
-
params: { path: { agentId, versionId } },
|
|
284
|
-
body,
|
|
285
|
-
headers: this.headers(),
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Publish a draft version to live.
|
|
291
|
-
*/
|
|
292
|
-
async publishVersion(agentId: string, versionId: string): Promise<APIResponse<PublishAgentVersionResponse>> {
|
|
293
|
-
return this.client.POST<PublishAgentVersionResponse>("/v1/api/agents/{agentId}/versions/{versionId}/publish", {
|
|
294
|
-
params: { path: { agentId, versionId } },
|
|
295
|
-
headers: this.headers(),
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
143
|
// ======================== Portability ========================
|
|
300
144
|
|
|
301
145
|
/**
|