@agent-os-sdk/client 0.9.26 → 0.9.27

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 (209) hide show
  1. package/dist/client/AgentOsClient.d.ts +141 -0
  2. package/dist/client/AgentOsClient.d.ts.map +1 -0
  3. package/{src/client/AgentOsClient.ts → dist/client/AgentOsClient.js} +61 -105
  4. package/dist/client/HttpRequestBuilder.d.ts +50 -0
  5. package/dist/client/HttpRequestBuilder.d.ts.map +1 -0
  6. package/{src/client/HttpRequestBuilder.ts → dist/client/HttpRequestBuilder.js} +9 -41
  7. package/{src/client/OperationContext.ts → dist/client/OperationContext.d.ts} +6 -9
  8. package/dist/client/OperationContext.d.ts.map +1 -0
  9. package/dist/client/OperationContext.js +13 -0
  10. package/dist/client/OperationContextProvider.d.ts +54 -0
  11. package/dist/client/OperationContextProvider.d.ts.map +1 -0
  12. package/{src/client/OperationContextProvider.ts → dist/client/OperationContextProvider.js} +17 -35
  13. package/{src/client/auth.ts → dist/client/auth.d.ts} +29 -65
  14. package/dist/client/auth.d.ts.map +1 -0
  15. package/dist/client/auth.js +38 -0
  16. package/dist/client/config.d.ts +49 -0
  17. package/dist/client/config.d.ts.map +1 -0
  18. package/{src/client/config.ts → dist/client/config.js} +5 -43
  19. package/dist/client/helpers.d.ts +63 -0
  20. package/dist/client/helpers.d.ts.map +1 -0
  21. package/{src/client/helpers.ts → dist/client/helpers.js} +9 -52
  22. package/dist/client/pagination.d.ts +105 -0
  23. package/dist/client/pagination.d.ts.map +1 -0
  24. package/{src/client/pagination.ts → dist/client/pagination.js} +15 -116
  25. package/dist/client/raw.d.ts +277 -0
  26. package/dist/client/raw.d.ts.map +1 -0
  27. package/dist/client/raw.js +337 -0
  28. package/dist/client/retry.d.ts +37 -0
  29. package/dist/client/retry.d.ts.map +1 -0
  30. package/{src/client/retry.ts → dist/client/retry.js} +13 -55
  31. package/dist/client/sanitize.d.ts +19 -0
  32. package/dist/client/sanitize.d.ts.map +1 -0
  33. package/{src/client/sanitize.ts → dist/client/sanitize.js} +4 -7
  34. package/dist/client/timeout.d.ts +26 -0
  35. package/dist/client/timeout.d.ts.map +1 -0
  36. package/{src/client/timeout.ts → dist/client/timeout.js} +10 -18
  37. package/dist/errors/factory.d.ts +22 -0
  38. package/dist/errors/factory.d.ts.map +1 -0
  39. package/{src/errors/factory.ts → dist/errors/factory.js} +18 -57
  40. package/dist/errors/index.d.ts +210 -0
  41. package/dist/errors/index.d.ts.map +1 -0
  42. package/{src/errors/index.ts → dist/errors/index.js} +74 -156
  43. package/{src/generated/client.ts → dist/generated/client.d.ts} +5 -17
  44. package/dist/generated/client.d.ts.map +1 -0
  45. package/dist/generated/client.js +15 -0
  46. package/{src/generated/index.ts → dist/generated/index.d.ts} +1 -1
  47. package/dist/generated/index.d.ts.map +1 -0
  48. package/dist/generated/index.js +1 -0
  49. package/{src/generated/openapi.ts → dist/generated/openapi.d.ts} +1 -1
  50. package/dist/generated/openapi.d.ts.map +1 -0
  51. package/dist/generated/openapi.js +5 -0
  52. package/dist/index.d.ts +69 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/{src/index.ts → dist/index.js} +13 -63
  55. package/dist/modules/a2a.d.ts +48 -0
  56. package/dist/modules/a2a.d.ts.map +1 -0
  57. package/dist/modules/a2a.js +37 -0
  58. package/dist/modules/agents.d.ts +346 -0
  59. package/dist/modules/agents.d.ts.map +1 -0
  60. package/dist/modules/agents.js +296 -0
  61. package/dist/modules/apiTokens.d.ts +62 -0
  62. package/dist/modules/apiTokens.d.ts.map +1 -0
  63. package/dist/modules/apiTokens.js +56 -0
  64. package/dist/modules/approvals.d.ts +75 -0
  65. package/dist/modules/approvals.d.ts.map +1 -0
  66. package/dist/modules/approvals.js +91 -0
  67. package/dist/modules/audit.d.ts +78 -0
  68. package/dist/modules/audit.d.ts.map +1 -0
  69. package/{src/modules/audit.ts → dist/modules/audit.js} +23 -74
  70. package/{src/modules/auth.ts → dist/modules/auth.d.ts} +6 -11
  71. package/dist/modules/auth.d.ts.map +1 -0
  72. package/dist/modules/auth.js +22 -0
  73. package/dist/modules/builder.d.ts +242 -0
  74. package/dist/modules/builder.d.ts.map +1 -0
  75. package/dist/modules/builder.js +248 -0
  76. package/dist/modules/catalog.d.ts +142 -0
  77. package/dist/modules/catalog.d.ts.map +1 -0
  78. package/dist/modules/catalog.js +136 -0
  79. package/dist/modules/chatwoot.d.ts +59 -0
  80. package/dist/modules/chatwoot.d.ts.map +1 -0
  81. package/dist/modules/chatwoot.js +200 -0
  82. package/dist/modules/checkpoints.d.ts +62 -0
  83. package/dist/modules/checkpoints.d.ts.map +1 -0
  84. package/dist/modules/checkpoints.js +48 -0
  85. package/dist/modules/contracts.d.ts +48 -0
  86. package/dist/modules/contracts.d.ts.map +1 -0
  87. package/dist/modules/contracts.js +25 -0
  88. package/dist/modules/credentials.d.ts +105 -0
  89. package/dist/modules/credentials.d.ts.map +1 -0
  90. package/dist/modules/credentials.js +135 -0
  91. package/dist/modules/crons.d.ts +73 -0
  92. package/dist/modules/crons.d.ts.map +1 -0
  93. package/dist/modules/crons.js +67 -0
  94. package/dist/modules/datasets.d.ts +80 -0
  95. package/dist/modules/datasets.d.ts.map +1 -0
  96. package/dist/modules/datasets.js +91 -0
  97. package/{src/modules/evaluation.ts → dist/modules/evaluation.d.ts} +23 -109
  98. package/dist/modules/evaluation.d.ts.map +1 -0
  99. package/dist/modules/evaluation.js +108 -0
  100. package/dist/modules/files.d.ts +89 -0
  101. package/dist/modules/files.d.ts.map +1 -0
  102. package/dist/modules/files.js +133 -0
  103. package/dist/modules/graphs.d.ts +120 -0
  104. package/dist/modules/graphs.d.ts.map +1 -0
  105. package/dist/modules/graphs.js +69 -0
  106. package/{src/modules/improvements.ts → dist/modules/improvements.d.ts} +8 -27
  107. package/dist/modules/improvements.d.ts.map +1 -0
  108. package/dist/modules/improvements.js +27 -0
  109. package/dist/modules/info.d.ts +76 -0
  110. package/dist/modules/info.d.ts.map +1 -0
  111. package/{src/modules/info.ts → dist/modules/info.js} +16 -66
  112. package/dist/modules/knowledge.d.ts +91 -0
  113. package/dist/modules/knowledge.d.ts.map +1 -0
  114. package/dist/modules/knowledge.js +80 -0
  115. package/{src/modules/me.ts → dist/modules/me.d.ts} +7 -23
  116. package/dist/modules/me.d.ts.map +1 -0
  117. package/dist/modules/me.js +28 -0
  118. package/dist/modules/members.d.ts +124 -0
  119. package/dist/modules/members.d.ts.map +1 -0
  120. package/dist/modules/members.js +142 -0
  121. package/dist/modules/memberships.d.ts +25 -0
  122. package/dist/modules/memberships.d.ts.map +1 -0
  123. package/dist/modules/memberships.js +20 -0
  124. package/{src/modules/metaAgent.ts → dist/modules/metaAgent.d.ts} +8 -44
  125. package/dist/modules/metaAgent.d.ts.map +1 -0
  126. package/dist/modules/metaAgent.js +32 -0
  127. package/dist/modules/metrics.d.ts +20 -0
  128. package/dist/modules/metrics.d.ts.map +1 -0
  129. package/{src/modules/metrics.ts → dist/modules/metrics.js} +7 -14
  130. package/dist/modules/observability.d.ts +19 -0
  131. package/dist/modules/observability.d.ts.map +1 -0
  132. package/dist/modules/observability.js +14 -0
  133. package/dist/modules/playground.d.ts +42 -0
  134. package/dist/modules/playground.d.ts.map +1 -0
  135. package/dist/modules/playground.js +48 -0
  136. package/dist/modules/presets.d.ts +32 -0
  137. package/dist/modules/presets.d.ts.map +1 -0
  138. package/dist/modules/presets.js +199 -0
  139. package/dist/modules/prompts.d.ts +87 -0
  140. package/dist/modules/prompts.d.ts.map +1 -0
  141. package/dist/modules/prompts.js +87 -0
  142. package/dist/modules/roles.d.ts +64 -0
  143. package/dist/modules/roles.d.ts.map +1 -0
  144. package/dist/modules/roles.js +79 -0
  145. package/dist/modules/runs.d.ts +451 -0
  146. package/dist/modules/runs.d.ts.map +1 -0
  147. package/{src/modules/runs.ts → dist/modules/runs.js} +96 -438
  148. package/dist/modules/store.d.ts +37 -0
  149. package/dist/modules/store.d.ts.map +1 -0
  150. package/dist/modules/store.js +48 -0
  151. package/{src/modules/templates.ts → dist/modules/templates.d.ts} +8 -32
  152. package/dist/modules/templates.d.ts.map +1 -0
  153. package/dist/modules/templates.js +26 -0
  154. package/dist/modules/tenants.d.ts +49 -0
  155. package/dist/modules/tenants.d.ts.map +1 -0
  156. package/dist/modules/tenants.js +56 -0
  157. package/dist/modules/threads.d.ts +205 -0
  158. package/dist/modules/threads.d.ts.map +1 -0
  159. package/dist/modules/threads.js +225 -0
  160. package/dist/modules/tools.d.ts +62 -0
  161. package/dist/modules/tools.d.ts.map +1 -0
  162. package/dist/modules/tools.js +45 -0
  163. package/dist/modules/traces.d.ts +89 -0
  164. package/dist/modules/traces.d.ts.map +1 -0
  165. package/dist/modules/traces.js +65 -0
  166. package/{src/modules/triggers.ts → dist/modules/triggers.d.ts} +24 -153
  167. package/dist/modules/triggers.d.ts.map +1 -0
  168. package/dist/modules/triggers.js +176 -0
  169. package/{src/modules/usage.ts → dist/modules/usage.d.ts} +14 -46
  170. package/dist/modules/usage.d.ts.map +1 -0
  171. package/dist/modules/usage.js +43 -0
  172. package/dist/modules/vectorStores.d.ts +100 -0
  173. package/dist/modules/vectorStores.d.ts.map +1 -0
  174. package/dist/modules/vectorStores.js +159 -0
  175. package/dist/modules/workspaces.d.ts +138 -0
  176. package/dist/modules/workspaces.d.ts.map +1 -0
  177. package/dist/modules/workspaces.js +121 -0
  178. package/dist/sse/client.d.ts +140 -0
  179. package/dist/sse/client.d.ts.map +1 -0
  180. package/{src/sse/client.ts → dist/sse/client.js} +24 -100
  181. package/package.json +8 -15
  182. package/src/client/raw.ts +0 -609
  183. package/src/generated/swagger.json +0 -17014
  184. package/src/modules/a2a.ts +0 -64
  185. package/src/modules/agents.ts +0 -604
  186. package/src/modules/apiTokens.ts +0 -101
  187. package/src/modules/approvals.ts +0 -151
  188. package/src/modules/catalog.ts +0 -241
  189. package/src/modules/chatwoot.ts +0 -242
  190. package/src/modules/checkpoints.ts +0 -87
  191. package/src/modules/contracts.ts +0 -80
  192. package/src/modules/credentials.ts +0 -216
  193. package/src/modules/crons.ts +0 -115
  194. package/src/modules/datasets.ts +0 -142
  195. package/src/modules/files.ts +0 -208
  196. package/src/modules/members.ts +0 -199
  197. package/src/modules/memberships.ts +0 -42
  198. package/src/modules/observability.ts +0 -28
  199. package/src/modules/playground.ts +0 -68
  200. package/src/modules/presets.ts +0 -246
  201. package/src/modules/prompts.ts +0 -147
  202. package/src/modules/roles.ts +0 -112
  203. package/src/modules/store.ts +0 -65
  204. package/src/modules/tenants.ts +0 -79
  205. package/src/modules/threads.ts +0 -343
  206. package/src/modules/tools.ts +0 -91
  207. package/src/modules/traces.ts +0 -133
  208. package/src/modules/vectorStores.ts +0 -257
  209. package/src/modules/workspaces.ts +0 -216
@@ -1,64 +0,0 @@
1
- /**
2
- * A2A Module - Fully Typed (Agent-to-Agent Protocol)
3
- */
4
-
5
- import type { RawClient, APIResponse } from "../client/raw.js";
6
-
7
- export interface JsonRpcRequest {
8
- jsonrpc: "2.0";
9
- method: string;
10
- params?: unknown;
11
- id?: string | number;
12
- }
13
-
14
- export interface JsonRpcResponse {
15
- jsonrpc: "2.0";
16
- result?: unknown;
17
- error?: {
18
- code: number;
19
- message: string;
20
- data?: unknown;
21
- };
22
- id?: string | number;
23
- }
24
-
25
- export interface A2aAgentCard {
26
- agent_id: string;
27
- name: string;
28
- description?: string;
29
- capabilities?: string[];
30
- endpoint: string;
31
- }
32
-
33
- export class A2aModule {
34
- constructor(private client: RawClient, private headers: () => Record<string, string>) { }
35
-
36
- /**
37
- * Send a JSON-RPC request to an agent.
38
- */
39
- async call(request: JsonRpcRequest): Promise<APIResponse<JsonRpcResponse>> {
40
- return this.client.POST<JsonRpcResponse>("/v1/api/a2a", {
41
- body: request,
42
- headers: this.headers(),
43
- });
44
- }
45
-
46
- /**
47
- * Get agent card (discovery).
48
- */
49
- async getAgentCard(agentId: string): Promise<APIResponse<A2aAgentCard>> {
50
- return this.client.GET<A2aAgentCard>("/v1/api/a2a/agents/{id}/card", {
51
- params: { path: { id: agentId } },
52
- headers: this.headers(),
53
- });
54
- }
55
-
56
- /**
57
- * List available A2A agents.
58
- */
59
- async listAgents(): Promise<APIResponse<{ items: A2aAgentCard[]; total: number }>> {
60
- return this.client.GET<{ items: A2aAgentCard[]; total: number }>("/v1/api/a2a/agents", {
61
- headers: this.headers(),
62
- });
63
- }
64
- }
@@ -1,604 +0,0 @@
1
- /**
2
- * Agents Module - Fully Typed
3
- *
4
- * Naming conventions:
5
- * - get* for singular items: getAgent(id)
6
- * - list* for collections: listAgents()
7
- * - create*, update*, delete* for mutations
8
- */
9
-
10
- import type { PaginatedResponse, PaginationParams } from "../client/helpers.js";
11
- import type { APIResponse, components, RawClient } from "../client/raw.js";
12
-
13
- // Type aliases for this module
14
-
15
- type AgentSchema = components["schemas"]["AgentExportAgent"];
16
- // Bundle types from schema
17
- type AgentBundleSchema = components["schemas"]["AgentExportBundle"];
18
-
19
- // Response types
20
- export interface Agent {
21
- id: string;
22
- name: string;
23
- workspace_id: string;
24
- tenant_id: string;
25
- created_at: string;
26
- updated_at: string;
27
- live_bundle_id?: string | null;
28
- // Dashboard fields (P1 fix)
29
- status?: "live" | "draft";
30
- has_draft?: boolean;
31
- last_run_id?: string | null;
32
- last_run_status?: string | null;
33
- last_run_at?: string | null;
34
- metadata?: any | null;
35
- }
36
-
37
- export interface AgentBundle extends AgentBundleSchema { }
38
-
39
- export interface ImportAgentResponse {
40
- agent_id: string;
41
- message: string;
42
- versions_imported: number;
43
- }
44
-
45
- export interface AgentGraphResponse {
46
- mermaid?: string;
47
- json?: unknown;
48
- }
49
-
50
- export interface GraphValidationResponse {
51
- valid: boolean;
52
- errors?: string[];
53
- warnings?: string[];
54
- }
55
-
56
- export interface PublishPreviewIssue {
57
- code: string;
58
- message: string;
59
- severity: string;
60
- path?: string;
61
- node_id?: string;
62
- hint?: string;
63
- }
64
-
65
- export interface PublishPreviewValidationResult {
66
- valid: boolean;
67
- errors: PublishPreviewIssue[];
68
- warnings: PublishPreviewIssue[];
69
- }
70
-
71
- export interface PublishPreviewCapabilityItem {
72
- node_id: string;
73
- capability_ref: string;
74
- capability_version: string;
75
- execution_binding: string;
76
- required_credentials: string[];
77
- }
78
-
79
- export interface PublishPreviewBindingItem {
80
- binding_key: string;
81
- status: "bound" | "missing" | "ambiguous";
82
- required_by_capabilities: string[];
83
- credential_instance_refs: string[];
84
- credential_type_refs: string[];
85
- }
86
-
87
- export interface PublishPreviewDraftDiff {
88
- added_node_ids: string[];
89
- removed_node_ids: string[];
90
- modified_node_ids: string[];
91
- added_capability_refs: string[];
92
- removed_capability_refs: string[];
93
- binding_keys_impacted: string[];
94
- }
95
-
96
- export interface PublishPreviewResponse {
97
- agent_id: string;
98
- draft_ir_revision: string;
99
- ready: boolean;
100
- validation_result: PublishPreviewValidationResult;
101
- capabilities: PublishPreviewCapabilityItem[];
102
- bindings: PublishPreviewBindingItem[];
103
- draft_diff: PublishPreviewDraftDiff;
104
- blockers: PublishPreviewIssue[];
105
- warnings: PublishPreviewIssue[];
106
- }
107
-
108
- export interface AgentPublishHistoryChangeSummary {
109
- added_capability_refs: string[];
110
- removed_capability_refs: string[];
111
- }
112
-
113
- export interface AgentPublishHistoryItem {
114
- release_id: string;
115
- agent_id: string;
116
- bundle_id: string;
117
- previous_bundle_id?: string | null;
118
- graph_version?: string | null;
119
- runtime_package_hash: string;
120
- content_hash: string;
121
- action: "publish" | "rollback";
122
- activated: boolean;
123
- is_live: boolean;
124
- status: "live" | "historical";
125
- actor: string;
126
- published_at: string;
127
- reason?: string | null;
128
- label?: string | null;
129
- summary: string;
130
- change_summary: AgentPublishHistoryChangeSummary;
131
- }
132
-
133
- export interface AgentPublishHistoryResponse {
134
- agent_id: string;
135
- live_bundle_id?: string | null;
136
- items: AgentPublishHistoryItem[];
137
- count: number;
138
- }
139
-
140
- export interface RollbackAgentRequest {
141
- target_bundle_id: string;
142
- reason?: string;
143
- }
144
-
145
- export interface AgentRollbackResponse {
146
- agent_id: string;
147
- live_bundle_id: string;
148
- rollback_release: AgentPublishHistoryItem;
149
- }
150
-
151
- export interface AgentDraftIrResponse {
152
- id: string;
153
- name: string;
154
- draft_ir_revision?: string | null;
155
- draftIrRevision?: string | null;
156
- draft_updated_at?: string | null;
157
- draftUpdatedAt?: string | null;
158
- live_bundle_id?: string | null;
159
- liveBundleId?: string | null;
160
- etag?: string;
161
- e_tag?: string;
162
- eTag?: string;
163
- ir_json?: Record<string, unknown> | null;
164
- irJson?: Record<string, unknown> | null;
165
- }
166
-
167
- export interface UpsertAgentCredentialBindingRequest {
168
- credential_instance_ref: string;
169
- binding_key: string;
170
- priority?: number;
171
- }
172
-
173
- export interface AgentCredentialBindingUpsertResponse {
174
- id: string;
175
- updated: boolean;
176
- agent_id: string;
177
- binding_key: string;
178
- priority: number;
179
- credential_instance_ref: string;
180
- credential_type_ref: string;
181
- credential_type_key: string;
182
- }
183
-
184
- export interface AgentCredentialBinding {
185
- id: string;
186
- agent_id: string;
187
- binding_key: string;
188
- priority: number;
189
- credential_instance_ref: string;
190
- credential_type_ref: string;
191
- credential_type_key: string;
192
- credential_name: string;
193
- }
194
-
195
- export interface AgentCredentialBindingListResponse {
196
- items: AgentCredentialBinding[];
197
- count: number;
198
- }
199
-
200
- export type AgentListResponse = PaginatedResponse<Agent>;
201
-
202
- export interface AgentRuntimeContext {
203
- agent_id: string;
204
- context_key: string;
205
- version_key: string;
206
- version_number: number;
207
- content_sha256: string;
208
- content_length: number;
209
- content: string;
210
- updated_at: string;
211
- source?: string | null;
212
- }
213
-
214
- export interface AgentRuntimeContextListResponse {
215
- items: AgentRuntimeContext[];
216
- }
217
-
218
- export interface UpsertAgentRuntimeContextRequest {
219
- content: string;
220
- source?: string | null;
221
- }
222
-
223
- export class AgentsModule {
224
- constructor(private client: RawClient, private headers: () => Record<string, string>) { }
225
-
226
- // ======================== CRUD ========================
227
-
228
- /**
229
- * List all agents in the workspace.
230
- * @example
231
- * ```ts
232
- * const { data } = await client.agents.list({ limit: 10 });
233
- * data?.items.forEach(agent => console.log(agent.name));
234
- * ```
235
- */
236
- async list(params?: PaginationParams & {
237
- workspace_id?: string;
238
- }): Promise<APIResponse<AgentListResponse>> {
239
- return this.client.GET<AgentListResponse>("/v1/api/agents", {
240
- params: { query: params },
241
- headers: this.headers(),
242
- });
243
- }
244
-
245
- /**
246
- * Get a single agent by ID.
247
- * @example
248
- * ```ts
249
- * const { data: agent } = await client.agents.get("agent-uuid");
250
- * ```
251
- */
252
- async get(agentId: string): Promise<APIResponse<Agent>> {
253
- return this.client.GET<Agent>("/v1/api/agents/{agentId}", {
254
- params: { path: { agentId } },
255
- headers: this.headers(),
256
- });
257
- }
258
-
259
- /**
260
- * Create a new agent.
261
- * Backend only accepts `name` per CreateAgentRequest DTO.
262
- * @example
263
- * ```ts
264
- * const { data: agent } = await client.agents.create({ name: "My Agent" });
265
- *
266
- * // With idempotency (safe to retry)
267
- * const { data: agent } = await client.agents.create({
268
- * name: "My Agent",
269
- * idempotency_key: "unique-key"
270
- * });
271
- * ```
272
- */
273
- async create(body: {
274
- name: string;
275
- metadata?: any | null;
276
- /** Idempotency key for safe retries. When set, duplicate requests with the same key return 409 Conflict. */
277
- idempotency_key?: string;
278
- }): Promise<APIResponse<Agent>> {
279
- const headers: Record<string, string> = { ...this.headers() };
280
- if (body.idempotency_key) {
281
- headers["X-Idempotency-Key"] = body.idempotency_key;
282
- }
283
-
284
- return this.client.POST<Agent>("/v1/api/agents", {
285
- body: {
286
- name: body.name,
287
- metadata: body.metadata
288
- },
289
- headers,
290
- });
291
- }
292
-
293
- /**
294
- * Update an existing agent.
295
- * Uses PATCH per backend AgentsController.
296
- */
297
- async update(agentId: string, body: {
298
- name?: string;
299
- live_bundle_id?: string;
300
- metadata?: any | null;
301
- }): Promise<APIResponse<Agent>> {
302
- return this.client.PATCH<Agent>("/v1/api/agents/{id}", {
303
- params: { path: { id: agentId } },
304
- body,
305
- headers: this.headers(),
306
- });
307
- }
308
-
309
- /**
310
- * Delete an agent.
311
- */
312
- async delete(agentId: string): Promise<APIResponse<void>> {
313
- return this.client.DELETE<void>("/v1/api/agents/{agentId}", {
314
- params: { path: { agentId } },
315
- headers: this.headers(),
316
- });
317
- }
318
-
319
- // ======================== Runtime Contexts ========================
320
-
321
- /**
322
- * List current runtime contexts for an agent.
323
- */
324
- async listRuntimeContexts(agentId: string): Promise<APIResponse<AgentRuntimeContextListResponse>> {
325
- return this.client.GET<AgentRuntimeContextListResponse>("/v1/api/agents/{agentId}/runtime-contexts", {
326
- params: { path: { agentId } },
327
- headers: this.headers(),
328
- });
329
- }
330
-
331
- /**
332
- * Get the current runtime context for a given key.
333
- */
334
- async getRuntimeContext(agentId: string, contextKey: string): Promise<APIResponse<AgentRuntimeContext>> {
335
- return this.client.GET<AgentRuntimeContext>("/v1/api/agents/{agentId}/runtime-contexts/{contextKey}", {
336
- params: { path: { agentId, contextKey } },
337
- headers: this.headers(),
338
- });
339
- }
340
-
341
- /**
342
- * Create or update the current runtime context for a given key.
343
- */
344
- async upsertRuntimeContext(
345
- agentId: string,
346
- contextKey: string,
347
- body: UpsertAgentRuntimeContextRequest
348
- ): Promise<APIResponse<AgentRuntimeContext>> {
349
- return this.client.PUT<AgentRuntimeContext>("/v1/api/agents/{agentId}/runtime-contexts/{contextKey}", {
350
- params: { path: { agentId, contextKey } },
351
- body: {
352
- content: body.content,
353
- source: body.source ?? null,
354
- },
355
- headers: this.headers(),
356
- });
357
- }
358
-
359
- // ======================== Portability ========================
360
-
361
- /**
362
- * Export an agent as a JSON bundle.
363
- */
364
- async export(agentId: string): Promise<APIResponse<AgentBundle>> {
365
- return this.client.GET<AgentBundle>("/v1/api/agents/{id}/export", {
366
- params: { path: { id: agentId } },
367
- headers: this.headers(),
368
- });
369
- }
370
-
371
- /**
372
- * Import an agent bundle.
373
- */
374
- async import(bundle: AgentBundle): Promise<APIResponse<ImportAgentResponse>> {
375
- return this.client.POST<ImportAgentResponse>("/v1/api/agents/import", {
376
- body: bundle,
377
- headers: this.headers(),
378
- });
379
- }
380
-
381
- // ======================== Graph ========================
382
-
383
- /**
384
- * Get the graph for an agent (Mermaid or JSON).
385
- */
386
- async getGraph(agentId: string, format?: "mermaid" | "json"): Promise<APIResponse<AgentGraphResponse>> {
387
- return this.client.GET<AgentGraphResponse>("/v1/api/agents/{agentId}/graph", {
388
- params: { path: { agentId }, query: { format } },
389
- headers: this.headers(),
390
- });
391
- }
392
-
393
- /** Alias for getGraph (convenience) */
394
- graph = (agentId: string, format?: "mermaid" | "json") => this.getGraph(agentId, format);
395
-
396
- /**
397
- * Validate the graph configuration.
398
- */
399
- async validateGraph(agentId: string): Promise<APIResponse<GraphValidationResponse>> {
400
- return this.client.POST<GraphValidationResponse>("/v1/api/agents/{agentId}/graph/validate", {
401
- params: { path: { agentId } },
402
- headers: this.headers(),
403
- });
404
- }
405
-
406
- async getPublishPreview(
407
- agentId: string,
408
- irJson?: Record<string, unknown>
409
- ): Promise<APIResponse<PublishPreviewResponse>> {
410
- if (irJson) {
411
- return this.client.POST<PublishPreviewResponse>("/v1/api/agents/{id}/publish-preview", {
412
- params: { path: { id: agentId } },
413
- body: { ir_json: irJson } as any,
414
- headers: this.headers(),
415
- });
416
- }
417
-
418
- return this.client.GET<PublishPreviewResponse>("/v1/api/agents/{id}/publish-preview", {
419
- params: { path: { id: agentId } },
420
- headers: this.headers(),
421
- });
422
- }
423
-
424
- // ======================== Draft IR ========================
425
-
426
- async getDraftIr(agentId: string): Promise<APIResponse<AgentDraftIrResponse>> {
427
- return this.client.GET<AgentDraftIrResponse>("/v1/api/agents/{id}/draft/ir", {
428
- params: { path: { id: agentId } },
429
- headers: this.headers(),
430
- });
431
- }
432
-
433
- async updateDraftIr(
434
- agentId: string,
435
- irJson: Record<string, unknown>,
436
- options?: { if_match?: string }
437
- ): Promise<APIResponse<AgentDraftIrResponse>> {
438
- const headers: Record<string, string> = { ...this.headers() };
439
- if (options?.if_match) {
440
- headers["If-Match"] = options.if_match;
441
- }
442
-
443
- const response = await this.client.PUT<AgentDraftIrResponse | { data?: AgentDraftIrResponse }>("/v1/api/agents/{id}/draft/ir", {
444
- params: { path: { id: agentId } },
445
- body: {
446
- ir_json: irJson,
447
- } as any,
448
- headers,
449
- });
450
-
451
- const unwrapped =
452
- response.data &&
453
- typeof response.data === "object" &&
454
- "data" in response.data &&
455
- typeof (response.data as { data?: unknown }).data === "object"
456
- ? ((response.data as { data?: AgentDraftIrResponse }).data ?? undefined)
457
- : (response.data as AgentDraftIrResponse | undefined);
458
-
459
- return {
460
- ...response,
461
- data: unwrapped,
462
- };
463
- }
464
-
465
- // ======================== Publishing ========================
466
-
467
- /**
468
- * Publish the committed agent artifact pointed to by the current authoring revision.
469
- * The client does not send authoring JSON anymore.
470
- * @param agentId The agent UUID
471
- * @param options Optional settings: version_label for tagging, set_as_live to make this the active version, idempotency_key for safe retries
472
- * @returns Bundle response with version details
473
- * @example
474
- * ```ts
475
- * const { data: bundle } = await client.agents.publish(agentId, {
476
- * idempotency_key: "publish-unique-key"
477
- * });
478
- * ```
479
- */
480
- async publish(
481
- agentId: string,
482
- options?: {
483
- version_label?: string | null;
484
- set_as_live?: boolean;
485
- required_tools?: string[];
486
- /** Idempotency key for safe retries */
487
- idempotency_key?: string;
488
- }
489
- ): Promise<APIResponse<components["schemas"]["BundleResponse"]>> {
490
- const headers: Record<string, string> = { ...this.headers() };
491
- if (options?.idempotency_key) {
492
- headers["X-Idempotency-Key"] = options.idempotency_key;
493
- }
494
-
495
- return this.client.POST<components["schemas"]["BundleResponse"]>("/v1/api/agents/{id}/publish", {
496
- params: { path: { id: agentId } },
497
- body: {
498
- version_label: options?.version_label ?? null,
499
- set_as_live: options?.set_as_live ?? true,
500
- required_tools: options?.required_tools ?? []
501
- } as any,
502
- headers
503
- });
504
- }
505
-
506
- async listPublishes(agentId: string): Promise<APIResponse<AgentPublishHistoryResponse>> {
507
- return this.client.GET<AgentPublishHistoryResponse>("/v1/api/agents/{id}/publishes", {
508
- params: { path: { id: agentId } },
509
- headers: this.headers(),
510
- });
511
- }
512
-
513
- async rollback(
514
- agentId: string,
515
- body: RollbackAgentRequest
516
- ): Promise<APIResponse<AgentRollbackResponse>> {
517
- return this.client.POST<AgentRollbackResponse>("/v1/api/agents/{id}/rollback", {
518
- params: { path: { id: agentId } },
519
- body,
520
- headers: this.headers(),
521
- });
522
- }
523
-
524
- // ======================== Bundles ========================
525
-
526
- /**
527
- * Get the manifest for a specific bundle.
528
- * Returns artifact metadata only.
529
- * @example
530
- * ```ts
531
- * const { data } = await client.agents.getBundleManifest(agentId, bundleId);
532
- * console.log(data?.artifact_hash);
533
- * ```
534
- */
535
- async getBundleManifest(agentId: string, bundleId: string): Promise<APIResponse<BundleManifestResponse>> {
536
- return this.client.GET<BundleManifestResponse>("/v1/api/agents/{agentId}/bundles/{bundleId}/manifest", {
537
- params: { path: { agentId, bundleId } },
538
- headers: this.headers(),
539
- });
540
- }
541
-
542
- /**
543
- * Get Mermaid diagram for a specific bundle graph.
544
- */
545
- async getBundleMermaid(agentId: string, bundleId: string): Promise<APIResponse<BundleMermaidResponse>> {
546
- return this.client.GET<BundleMermaidResponse>("/v1/api/agents/{agentId}/bundles/{bundleId}/graph/mermaid", {
547
- params: { path: { agentId, bundleId } },
548
- headers: this.headers(),
549
- });
550
- }
551
-
552
- /**
553
- * Creates or updates an agent credential binding by binding key.
554
- */
555
- async upsertCredentialBinding(
556
- agentId: string,
557
- body: UpsertAgentCredentialBindingRequest
558
- ): Promise<APIResponse<AgentCredentialBindingUpsertResponse>> {
559
- return this.client.POST<AgentCredentialBindingUpsertResponse>("/v1/api/agents/{id}/credential-bindings", {
560
- params: { path: { id: agentId } },
561
- body: {
562
- credential_instance_ref: body.credential_instance_ref,
563
- binding_key: body.binding_key,
564
- priority: body.priority ?? 0,
565
- },
566
- headers: this.headers(),
567
- });
568
- }
569
-
570
- /**
571
- * Lists credential bindings for an agent.
572
- */
573
- async listCredentialBindings(
574
- agentId: string
575
- ): Promise<APIResponse<AgentCredentialBindingListResponse>> {
576
- return this.client.GET<AgentCredentialBindingListResponse>("/v1/api/agents/{id}/credential-bindings", {
577
- params: { path: { id: agentId } },
578
- headers: this.headers(),
579
- });
580
- }
581
-
582
- }
583
-
584
- // Bundle manifest response type
585
- export interface BundleManifestResponse {
586
- agent_id: string;
587
- bundle_id: string;
588
- agent_name: string;
589
- artifact_uri?: string;
590
- artifact_hash?: string;
591
- content_hash?: string;
592
- format?: string;
593
- schema_version?: string;
594
- created_at?: string;
595
- }
596
-
597
- export interface BundleMermaidResponse {
598
- bundle_id: string;
599
- agent_id: string;
600
- mermaid: string;
601
- format?: string;
602
- node_count?: number;
603
- edge_count?: number;
604
- }