@cadenya/cadenya 1.5.0 → 1.6.0
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/api.md +48 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-pools.d.ts +214 -0
- package/dist/resources/agent-pools.d.ts.map +1 -0
- package/dist/resources/agent-pools.js +157 -0
- package/dist/resources/agent-pools.js.map +1 -0
- package/dist/types.d.ts +275 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +22 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +3 -0
- package/src/index.ts +1 -0
- package/src/resources/agent-pools.ts +287 -0
- package/src/types.ts +315 -16
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ApiKeys } from './resources/api-keys.js';
|
|
|
8
8
|
import { WorkspaceAdmin } from './resources/workspace-admin.js';
|
|
9
9
|
import { Profiles } from './resources/profiles.js';
|
|
10
10
|
import { Workspaces } from './resources/workspaces.js';
|
|
11
|
+
import { AgentPools } from './resources/agent-pools.js';
|
|
11
12
|
import { Agents } from './resources/agents.js';
|
|
12
13
|
import { AiProviderKeys } from './resources/ai-provider-keys.js';
|
|
13
14
|
import { Models } from './resources/models.js';
|
|
@@ -55,6 +56,7 @@ export class Cadenya {
|
|
|
55
56
|
readonly workspaceAdmin: WorkspaceAdmin;
|
|
56
57
|
readonly profiles: Profiles;
|
|
57
58
|
readonly workspaces: Workspaces;
|
|
59
|
+
readonly agentPools: AgentPools;
|
|
58
60
|
readonly agents: Agents;
|
|
59
61
|
readonly aiProviderKeys: AiProviderKeys;
|
|
60
62
|
readonly models: Models;
|
|
@@ -97,6 +99,7 @@ export class Cadenya {
|
|
|
97
99
|
this.workspaceAdmin = new WorkspaceAdmin(this._client);
|
|
98
100
|
this.profiles = new Profiles(this._client);
|
|
99
101
|
this.workspaces = new Workspaces(this._client);
|
|
102
|
+
this.agentPools = new AgentPools(this._client);
|
|
100
103
|
this.agents = new Agents(this._client);
|
|
101
104
|
this.aiProviderKeys = new AiProviderKeys(this._client);
|
|
102
105
|
this.models = new Models(this._client);
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './resources/api-keys.js';
|
|
|
17
17
|
export * from './resources/workspace-admin.js';
|
|
18
18
|
export * from './resources/profiles.js';
|
|
19
19
|
export * from './resources/workspaces.js';
|
|
20
|
+
export * from './resources/agent-pools.js';
|
|
20
21
|
export * from './resources/agents.js';
|
|
21
22
|
export * from './resources/agent-schedules.js';
|
|
22
23
|
export * from './resources/agent-variations.js';
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// Generated by redwood. Do not edit by hand.
|
|
2
|
+
|
|
3
|
+
import { HttpClient, RequestOptions, APIPromise, pathSegment, snapshotParams } from '../core/http.js';
|
|
4
|
+
import { Page } from '../core/pagination.js';
|
|
5
|
+
import type { AgentPool, AgentPoolServiceListAgentPoolsState, AgentPoolSpec, AgentPoolUpdateSpec, CreateResourceMetadata, ListAgentPoolsResponse, UpdateResourceMetadata } from '../types.js';
|
|
6
|
+
|
|
7
|
+
export interface AgentPoolListParams {
|
|
8
|
+
/**
|
|
9
|
+
* Workspace ID.
|
|
10
|
+
*
|
|
11
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
12
|
+
*/
|
|
13
|
+
workspaceId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Maximum number of results to return
|
|
16
|
+
*/
|
|
17
|
+
limit?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Pagination cursor from previous response
|
|
20
|
+
*/
|
|
21
|
+
cursor?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Filter expression (query param: prefix)
|
|
24
|
+
*/
|
|
25
|
+
prefix?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Free-form search query
|
|
28
|
+
*/
|
|
29
|
+
query?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Filter by lifecycle state. Unspecified returns active and inactive pools;
|
|
32
|
+
* explicitly select ARCHIVED to list archived pools.
|
|
33
|
+
*/
|
|
34
|
+
state?: AgentPoolServiceListAgentPoolsState;
|
|
35
|
+
/**
|
|
36
|
+
* Filters by metadata labels. Comma-separated key=value pairs,
|
|
37
|
+
* e.g. "env=prod,team=ai". A resource matches only if every pair
|
|
38
|
+
* matches exactly (AND semantics).
|
|
39
|
+
*/
|
|
40
|
+
labels?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Sort order for results (asc or desc by creation time)
|
|
43
|
+
*/
|
|
44
|
+
sortOrder?: string;
|
|
45
|
+
/**
|
|
46
|
+
* When true, the `info` field on each returned agent pool is populated. Requests
|
|
47
|
+
* with this flag count more against your rate limit.
|
|
48
|
+
*/
|
|
49
|
+
includeInfo?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface AgentPoolCreateParams {
|
|
53
|
+
metadata: CreateResourceMetadata;
|
|
54
|
+
spec: AgentPoolSpec;
|
|
55
|
+
/**
|
|
56
|
+
* Workspace ID.
|
|
57
|
+
*
|
|
58
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
59
|
+
*/
|
|
60
|
+
workspaceId?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface AgentPoolRetrieveParams {
|
|
64
|
+
/**
|
|
65
|
+
* Workspace ID.
|
|
66
|
+
*
|
|
67
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
68
|
+
*/
|
|
69
|
+
workspaceId?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface AgentPoolDeleteParams {
|
|
73
|
+
/**
|
|
74
|
+
* Workspace ID.
|
|
75
|
+
*
|
|
76
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
77
|
+
*/
|
|
78
|
+
workspaceId?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface AgentPoolUpdateParams {
|
|
82
|
+
/**
|
|
83
|
+
* Workspace ID.
|
|
84
|
+
*
|
|
85
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
86
|
+
*/
|
|
87
|
+
workspaceId?: string;
|
|
88
|
+
metadata?: UpdateResourceMetadata;
|
|
89
|
+
spec?: AgentPoolUpdateSpec;
|
|
90
|
+
/**
|
|
91
|
+
* Fields to update. Only metadata and spec are mutable; top-level state and info
|
|
92
|
+
* paths are invalid. spec.assignments replaces the entire membership list.
|
|
93
|
+
* A spec mask replaces the full spec; * replaces all mutable fields.
|
|
94
|
+
* Without a mask, infer paths from non-empty fields. Empty or omitted
|
|
95
|
+
* membership then leaves the existing list unchanged. Element/index paths
|
|
96
|
+
* are invalid. Validate the merged pool atomically: an empty description
|
|
97
|
+
* or membership (including an explicitly masked empty list) is invalid.
|
|
98
|
+
*/
|
|
99
|
+
updateMask?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface AgentPoolActivateParams {
|
|
103
|
+
/**
|
|
104
|
+
* Workspace ID.
|
|
105
|
+
*
|
|
106
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
107
|
+
*/
|
|
108
|
+
workspaceId?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface AgentPoolArchiveParams {
|
|
112
|
+
/**
|
|
113
|
+
* Workspace ID.
|
|
114
|
+
*
|
|
115
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
116
|
+
*/
|
|
117
|
+
workspaceId?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface AgentPoolDeactivateParams {
|
|
121
|
+
/**
|
|
122
|
+
* Workspace ID.
|
|
123
|
+
*
|
|
124
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
125
|
+
*/
|
|
126
|
+
workspaceId?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface AgentPoolUnarchiveParams {
|
|
130
|
+
/**
|
|
131
|
+
* Workspace ID.
|
|
132
|
+
*
|
|
133
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
134
|
+
*/
|
|
135
|
+
workspaceId?: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export class AgentPools {
|
|
139
|
+
constructor(private readonly _client: HttpClient) {}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* List agent pools
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* const page = await client.agentPools.list();
|
|
147
|
+
* for await (const item of page) {
|
|
148
|
+
* // auto-fetches every page
|
|
149
|
+
* }
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
async list(params?: AgentPoolListParams, options?: RequestOptions): Promise<Page<AgentPool>> {
|
|
153
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
154
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
155
|
+
const _base = snapshotParams(params);
|
|
156
|
+
const response = await this._client.request<ListAgentPoolsResponse>({ method: 'GET', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools`, query: { limit: params?.limit, cursor: params?.cursor, prefix: params?.prefix, query: params?.query, state: params?.state, labels: params?.labels, sortOrder: params?.sortOrder, includeInfo: params?.includeInfo } }, options);
|
|
157
|
+
return new Page(response.items ?? [], response.pagination?.nextCursor, (cursor) => this.list({ ..._base, cursor: cursor }, options));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Create a new agent pool
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* const agentPool = await client.agentPools.create({ metadata: { name: 'sample' }, spec: { assignments: [{ agentId: 'sample' }], description: 'sample' } });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
create(params: AgentPoolCreateParams, options?: RequestOptions): APIPromise<AgentPool> {
|
|
169
|
+
return this._client.requestAPI<AgentPool>(() => {
|
|
170
|
+
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
171
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
172
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools`, body: { metadata: params.metadata, spec: params.spec } };
|
|
173
|
+
}, options);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Get an agent pool by ID
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* const agentPool = await client.agentPools.retrieve('_123');
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
retrieve(id: string, params?: AgentPoolRetrieveParams, options?: RequestOptions): APIPromise<AgentPool> {
|
|
185
|
+
return this._client.requestAPI<AgentPool>(() => {
|
|
186
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
187
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
188
|
+
return { method: 'GET', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools/${pathSegment('id', id)}` };
|
|
189
|
+
}, options);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Delete an agent pool
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* await client.agentPools.delete('_123');
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
delete(id: string, params?: AgentPoolDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
201
|
+
return this._client.requestAPI<void>(() => {
|
|
202
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
203
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
204
|
+
return { method: 'DELETE', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools/${pathSegment('id', id)}`, void: true };
|
|
205
|
+
}, options);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Update an agent pool
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* const agentPool = await client.agentPools.update('_123');
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
update(id: string, params?: AgentPoolUpdateParams, options?: RequestOptions): APIPromise<AgentPool> {
|
|
217
|
+
return this._client.requestAPI<AgentPool>(() => {
|
|
218
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
219
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
220
|
+
return { method: 'PATCH', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools/${pathSegment('id', id)}`, body: { metadata: params?.metadata, spec: params?.spec, updateMask: params?.updateMask } };
|
|
221
|
+
}, options);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Activate an agent pool
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* const agentPool = await client.agentPools.activate('_123');
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
activate(id: string, params?: AgentPoolActivateParams, options?: RequestOptions): APIPromise<AgentPool> {
|
|
233
|
+
return this._client.requestAPI<AgentPool>(() => {
|
|
234
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
235
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
236
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools/${pathSegment('id', id)}:activate` };
|
|
237
|
+
}, options);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Archive an agent pool
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```ts
|
|
245
|
+
* const agentPool = await client.agentPools.archive('_123');
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
archive(id: string, params?: AgentPoolArchiveParams, options?: RequestOptions): APIPromise<AgentPool> {
|
|
249
|
+
return this._client.requestAPI<AgentPool>(() => {
|
|
250
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
251
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
252
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools/${pathSegment('id', id)}:archive` };
|
|
253
|
+
}, options);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Deactivate an agent pool
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* const agentPool = await client.agentPools.deactivate('_123');
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
deactivate(id: string, params?: AgentPoolDeactivateParams, options?: RequestOptions): APIPromise<AgentPool> {
|
|
265
|
+
return this._client.requestAPI<AgentPool>(() => {
|
|
266
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
267
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
268
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools/${pathSegment('id', id)}:deactivate` };
|
|
269
|
+
}, options);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Unarchive an agent pool
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* const agentPool = await client.agentPools.unarchive('_123');
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
unarchive(id: string, params?: AgentPoolUnarchiveParams, options?: RequestOptions): APIPromise<AgentPool> {
|
|
281
|
+
return this._client.requestAPI<AgentPool>(() => {
|
|
282
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
283
|
+
if (workspaceId === undefined) throw new Error("Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.");
|
|
284
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agent_pools/${pathSegment('id', id)}:unarchive` };
|
|
285
|
+
}, options);
|
|
286
|
+
}
|
|
287
|
+
}
|