@cadenya/cadenya 1.5.0 → 1.7.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 +71 -3
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -1
- 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/resources/objectives.d.ts +179 -14
- package/dist/resources/objectives.d.ts.map +1 -1
- package/dist/resources/objectives.js +73 -3
- package/dist/resources/objectives.js.map +1 -1
- package/dist/resources/profiles.d.ts +3 -3
- package/dist/resources/profiles.d.ts.map +1 -1
- package/dist/resources/profiles.js +1 -1
- package/dist/resources/profiles.js.map +1 -1
- package/dist/types.d.ts +611 -41
- 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 +4 -1
- package/src/index.ts +1 -0
- package/src/resources/agent-pools.ts +287 -0
- package/src/resources/objectives.ts +213 -16
- package/src/resources/profiles.ts +4 -4
- package/src/types.ts +681 -42
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;
|
|
@@ -85,7 +87,7 @@ export class Cadenya {
|
|
|
85
87
|
authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),
|
|
86
88
|
maxRetries: options.maxRetries ?? 0,
|
|
87
89
|
timeout: options.timeout,
|
|
88
|
-
defaultHeaders: { ...nodeUserAgent('cadenya-typescript/1.
|
|
90
|
+
defaultHeaders: { ...nodeUserAgent('cadenya-typescript/1.6.0 (api 1.0)'), ...options.defaultHeaders },
|
|
89
91
|
fetch: options.fetch,
|
|
90
92
|
logger: options.logger,
|
|
91
93
|
logLevel: options.logLevel,
|
|
@@ -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
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { HttpClient, RequestOptions, RequestSpec, APIPromise, pathSegment, snapshotParams } from '../core/http.js';
|
|
4
4
|
import { Page } from '../core/pagination.js';
|
|
5
5
|
import { Stream } from '../core/sse.js';
|
|
6
|
-
import type { AgentVariationSpec_CompactionConfig,
|
|
6
|
+
import type { AgentVariationSpec_CompactionConfig, ContinueObjectiveResponse, CreateAndStreamObjectiveRequest_Metadata, CreateAndStreamObjectiveResponse, CreateObjectiveRequest_Secret, CreateOperationMetadata, GetObjectiveDiagnosticsResponse, ListObjectiveContextWindowsResponse, ListObjectiveEventsResponse, ListObjectiveFeedbackResponse, ListObjectiveQueuedActionsResponse, ListObjectiveToolCallsResponse, ListObjectiveToolsResponse, ListObjectivesResponse, MemoryReference, Objective, ObjectiveContextWindow, ObjectiveEpisodicConfigParam, ObjectiveEvent, ObjectiveFeedback, ObjectiveFeedbackData, ObjectiveQueuedAction, ObjectiveServiceListObjectiveQueuedActionsState, ObjectiveServiceListObjectiveToolCallsExecutionStatus, ObjectiveServiceListObjectiveToolCallsStatus, ObjectiveServiceListObjectivesState, ObjectiveTool, ObjectiveToolCall, ObjectiveToolCallWithResult, SetToolCallContentRequest_ContentBlock, SubjectAssertion, TenantAssertion } from '../types.js';
|
|
7
7
|
import { wireObjectiveEpisodicConfig } from '../types.js';
|
|
8
8
|
|
|
9
9
|
export interface ObjectiveListParams {
|
|
@@ -75,12 +75,6 @@ export interface ObjectiveListParams {
|
|
|
75
75
|
|
|
76
76
|
export interface ObjectiveCreateParams {
|
|
77
77
|
agentId: string;
|
|
78
|
-
/**
|
|
79
|
-
* Arbitrary data rendered into the selected variation's system_prompt_template
|
|
80
|
-
* (liquid) to produce the objective's system prompt. If the agent has a
|
|
81
|
-
* system_prompt_data_schema, this must satisfy it.
|
|
82
|
-
*/
|
|
83
|
-
systemPromptData: Record<string, unknown>;
|
|
84
78
|
/**
|
|
85
79
|
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
86
80
|
*/
|
|
@@ -90,6 +84,12 @@ export interface ObjectiveCreateParams {
|
|
|
90
84
|
*/
|
|
91
85
|
variationId?: string;
|
|
92
86
|
metadata?: CreateOperationMetadata;
|
|
87
|
+
/**
|
|
88
|
+
* Arbitrary data rendered into the selected variation's system_prompt_template
|
|
89
|
+
* (liquid) to produce the objective's system prompt. If the agent has a
|
|
90
|
+
* system_prompt_data_schema, this must satisfy it.
|
|
91
|
+
*/
|
|
92
|
+
systemPromptData?: Record<string, unknown>;
|
|
93
93
|
/**
|
|
94
94
|
* Optional explicit first user message for the LLM chat history. When not set,
|
|
95
95
|
* the selected variation's first_user_message_template is rendered with
|
|
@@ -267,6 +267,36 @@ export interface ObjectiveCreateFeedbackParams {
|
|
|
267
267
|
workspaceId?: string;
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
+
export interface ObjectiveListQueuedActionsParams {
|
|
271
|
+
/**
|
|
272
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
273
|
+
*/
|
|
274
|
+
workspaceId?: string;
|
|
275
|
+
/**
|
|
276
|
+
* Maximum number of results to return
|
|
277
|
+
*/
|
|
278
|
+
limit?: number;
|
|
279
|
+
/**
|
|
280
|
+
* Pagination cursor from previous response
|
|
281
|
+
*/
|
|
282
|
+
cursor?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Only return actions in this state. When unset, actions in every state are returned.
|
|
285
|
+
*/
|
|
286
|
+
state?: ObjectiveServiceListObjectiveQueuedActionsState;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface ObjectiveRemoveQueuedActionParams {
|
|
290
|
+
/**
|
|
291
|
+
* The ID of the queued action to remove.
|
|
292
|
+
*/
|
|
293
|
+
queuedActionId: string;
|
|
294
|
+
/**
|
|
295
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
296
|
+
*/
|
|
297
|
+
workspaceId?: string;
|
|
298
|
+
}
|
|
299
|
+
|
|
270
300
|
export interface ObjectiveListToolCallsParams {
|
|
271
301
|
/**
|
|
272
302
|
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
@@ -379,7 +409,7 @@ export interface ObjectiveCompactParams {
|
|
|
379
409
|
|
|
380
410
|
export interface ObjectiveContinueParams {
|
|
381
411
|
/**
|
|
382
|
-
* The message to
|
|
412
|
+
* The user message to send to the objective.
|
|
383
413
|
*/
|
|
384
414
|
message: string;
|
|
385
415
|
/**
|
|
@@ -387,11 +417,108 @@ export interface ObjectiveContinueParams {
|
|
|
387
417
|
*/
|
|
388
418
|
workspaceId?: string;
|
|
389
419
|
/**
|
|
390
|
-
* When
|
|
420
|
+
* When false, the objective must be waiting and the message is sent immediately.
|
|
421
|
+
* When true, a waiting objective still receives the message immediately; an
|
|
422
|
+
* objective whose agent loop is busy queues it instead, and the agent picks it
|
|
423
|
+
* up before its next assistant turn. Queued messages can be listed and removed
|
|
424
|
+
* until then.
|
|
391
425
|
*/
|
|
392
426
|
enqueue?: boolean;
|
|
393
427
|
}
|
|
394
428
|
|
|
429
|
+
export interface ObjectiveInterruptParams {
|
|
430
|
+
/**
|
|
431
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
432
|
+
*/
|
|
433
|
+
workspaceId?: string;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export interface ObjectiveCreateAndStreamParams {
|
|
437
|
+
agentId: string;
|
|
438
|
+
/**
|
|
439
|
+
* Required here, though Create objective leaves it optional: the external
|
|
440
|
+
* ID inside it is the idempotency key that makes a retry of this request
|
|
441
|
+
* resume the objective instead of starting another.
|
|
442
|
+
*/
|
|
443
|
+
metadata: CreateAndStreamObjectiveRequest_Metadata;
|
|
444
|
+
/**
|
|
445
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
446
|
+
*/
|
|
447
|
+
workspaceId?: string;
|
|
448
|
+
/**
|
|
449
|
+
* Optional explicit variation selection. Overrides the agent's variation_selection_mode.
|
|
450
|
+
*/
|
|
451
|
+
variationId?: string;
|
|
452
|
+
/**
|
|
453
|
+
* Arbitrary data rendered into the selected variation's system_prompt_template
|
|
454
|
+
* (liquid) to produce the objective's system prompt. If the agent has a
|
|
455
|
+
* system_prompt_data_schema, this must satisfy it.
|
|
456
|
+
*/
|
|
457
|
+
systemPromptData?: Record<string, unknown>;
|
|
458
|
+
/**
|
|
459
|
+
* Optional explicit first user message for the LLM chat history. When not set,
|
|
460
|
+
* the selected variation's first_user_message_template is rendered with
|
|
461
|
+
* first_user_message_data instead. If neither this field nor a
|
|
462
|
+
* first_user_message_template is present, the request is rejected with InvalidArgument.
|
|
463
|
+
*/
|
|
464
|
+
firstUserMessage?: string;
|
|
465
|
+
/**
|
|
466
|
+
* Secrets that can be used in the headers for tool calls using the secret interpolation format.
|
|
467
|
+
*/
|
|
468
|
+
secrets?: Array<CreateObjectiveRequest_Secret>;
|
|
469
|
+
/**
|
|
470
|
+
* Memory layers/entries layered over the baseline cascade inherited
|
|
471
|
+
* from the selected variation — element-level rules over inherited
|
|
472
|
+
* styles, in CSS terms.
|
|
473
|
+
*
|
|
474
|
+
* Array order is resolution order: EARLIER elements are more specific
|
|
475
|
+
* and are consulted first. Entries pinned via memory_entry_id behave
|
|
476
|
+
* as single-entry layers at their position.
|
|
477
|
+
*
|
|
478
|
+
* System-managed layers (e.g., episodic) cannot be referenced here;
|
|
479
|
+
* they attach themselves automatically based on the episodic key.
|
|
480
|
+
*
|
|
481
|
+
* Size cap: the TOTAL effective cascade (this field + the variation's
|
|
482
|
+
* memory layer assignments) must not exceed 10 entries. A request
|
|
483
|
+
* that would produce a larger cascade is rejected with
|
|
484
|
+
* InvalidArgument.
|
|
485
|
+
*/
|
|
486
|
+
memoryCascade?: Array<MemoryReference>;
|
|
487
|
+
/**
|
|
488
|
+
* Arbitrary data rendered into the selected variation's first_user_message_template
|
|
489
|
+
* (liquid) to produce the first user message. Separate from `system_prompt_data`,
|
|
490
|
+
* which renders the system prompt template.
|
|
491
|
+
*/
|
|
492
|
+
firstUserMessageData?: Record<string, unknown>;
|
|
493
|
+
/**
|
|
494
|
+
* If the agent variation that is selected has episodic memory enabled, then this key is used to create/update a memory layer
|
|
495
|
+
* specific to the episodic memory. The layer may have a TTL configured by the variation.
|
|
496
|
+
*/
|
|
497
|
+
episodicMemory?: ObjectiveEpisodicConfigParam;
|
|
498
|
+
/**
|
|
499
|
+
* Optional tenant assertion — the customer's org/company identifier for the
|
|
500
|
+
* end user this objective serves. Upserts the tenant record in the
|
|
501
|
+
* workspace and associates the objective with it.
|
|
502
|
+
*/
|
|
503
|
+
tenant?: TenantAssertion;
|
|
504
|
+
/**
|
|
505
|
+
* Optional subject assertion — the person within the tenant this objective
|
|
506
|
+
* serves. Requires `tenant`; a subject asserted without a tenant is
|
|
507
|
+
* rejected with InvalidArgument.
|
|
508
|
+
*/
|
|
509
|
+
subject?: SubjectAssertion;
|
|
510
|
+
/**
|
|
511
|
+
* Parameters forced onto this objective's tool calls. A pinned parameter
|
|
512
|
+
* is removed from the tool schema the LLM sees, and its value is always
|
|
513
|
+
* overwritten server-side with the pinned value — the model cannot choose
|
|
514
|
+
* a different value for it. By default a pinned key applies to every tool
|
|
515
|
+
* with a top-level parameter of the same name; a tool set's overlays
|
|
516
|
+
* (ToolSetSpec.overlays) can bind pinned keys to nested paths, differently
|
|
517
|
+
* named parameters, or a subset of tools.
|
|
518
|
+
*/
|
|
519
|
+
pinnedParameters?: Record<string, string>;
|
|
520
|
+
}
|
|
521
|
+
|
|
395
522
|
export class Objectives {
|
|
396
523
|
constructor(private readonly _client: HttpClient) {}
|
|
397
524
|
|
|
@@ -419,7 +546,7 @@ export class Objectives {
|
|
|
419
546
|
*
|
|
420
547
|
* @example
|
|
421
548
|
* ```ts
|
|
422
|
-
* const objective = await client.objectives.create({ agentId: 'sample'
|
|
549
|
+
* const objective = await client.objectives.create({ agentId: 'sample' });
|
|
423
550
|
* ```
|
|
424
551
|
*/
|
|
425
552
|
create(params: ObjectiveCreateParams, options?: RequestOptions): APIPromise<Objective> {
|
|
@@ -554,6 +681,41 @@ export class Objectives {
|
|
|
554
681
|
}, options);
|
|
555
682
|
}
|
|
556
683
|
|
|
684
|
+
/**
|
|
685
|
+
* List objective queued actions
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* ```ts
|
|
689
|
+
* const page = await client.objectives.listQueuedActions('objective_123');
|
|
690
|
+
* for await (const item of page) {
|
|
691
|
+
* // auto-fetches every page
|
|
692
|
+
* }
|
|
693
|
+
* ```
|
|
694
|
+
*/
|
|
695
|
+
async listQueuedActions(objectiveId: string, params?: ObjectiveListQueuedActionsParams, options?: RequestOptions): Promise<Page<ObjectiveQueuedAction>> {
|
|
696
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
697
|
+
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.");
|
|
698
|
+
const _base = snapshotParams(params);
|
|
699
|
+
const response = await this._client.request<ListObjectiveQueuedActionsResponse>({ method: 'GET', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/objectives/${pathSegment('objectiveId', objectiveId)}/queued_actions`, query: { limit: params?.limit, cursor: params?.cursor, state: params?.state } }, options);
|
|
700
|
+
return new Page(response.items ?? [], response.pagination?.nextCursor, (cursor) => this.listQueuedActions(objectiveId, { ..._base, cursor: cursor }, options));
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Remove a queued action
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* ```ts
|
|
708
|
+
* const objectiveQueuedAction = await client.objectives.removeQueuedAction('objective_123', { queuedActionId: 'queued_action_123' });
|
|
709
|
+
* ```
|
|
710
|
+
*/
|
|
711
|
+
removeQueuedAction(objectiveId: string, params: ObjectiveRemoveQueuedActionParams, options?: RequestOptions): APIPromise<ObjectiveQueuedAction> {
|
|
712
|
+
return this._client.requestAPI<ObjectiveQueuedAction>(() => {
|
|
713
|
+
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
714
|
+
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.");
|
|
715
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/objectives/${pathSegment('objectiveId', objectiveId)}/queued_actions/${pathSegment('queuedActionId', params.queuedActionId)}:remove` };
|
|
716
|
+
}, options);
|
|
717
|
+
}
|
|
718
|
+
|
|
557
719
|
/**
|
|
558
720
|
* List objective tool calls
|
|
559
721
|
*
|
|
@@ -677,11 +839,11 @@ export class Objectives {
|
|
|
677
839
|
*
|
|
678
840
|
* @example
|
|
679
841
|
* ```ts
|
|
680
|
-
* const
|
|
842
|
+
* const objectiveQueuedAction = await client.objectives.compact('objective_123');
|
|
681
843
|
* ```
|
|
682
844
|
*/
|
|
683
|
-
compact(objectiveId: string, params?: ObjectiveCompactParams, options?: RequestOptions): APIPromise<
|
|
684
|
-
return this._client.requestAPI<
|
|
845
|
+
compact(objectiveId: string, params?: ObjectiveCompactParams, options?: RequestOptions): APIPromise<ObjectiveQueuedAction> {
|
|
846
|
+
return this._client.requestAPI<ObjectiveQueuedAction>(() => {
|
|
685
847
|
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
686
848
|
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.");
|
|
687
849
|
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/objectives/${pathSegment('objectiveId', objectiveId)}:compact`, body: { compactionConfig: params?.compactionConfig } };
|
|
@@ -693,14 +855,49 @@ export class Objectives {
|
|
|
693
855
|
*
|
|
694
856
|
* @example
|
|
695
857
|
* ```ts
|
|
696
|
-
* const
|
|
858
|
+
* const continueObjectiveResponse = await client.objectives.continue('objective_123', { message: 'sample' });
|
|
697
859
|
* ```
|
|
698
860
|
*/
|
|
699
|
-
continue(objectiveId: string, params: ObjectiveContinueParams, options?: RequestOptions): APIPromise<
|
|
700
|
-
return this._client.requestAPI<
|
|
861
|
+
continue(objectiveId: string, params: ObjectiveContinueParams, options?: RequestOptions): APIPromise<ContinueObjectiveResponse> {
|
|
862
|
+
return this._client.requestAPI<ContinueObjectiveResponse>(() => {
|
|
701
863
|
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
702
864
|
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.");
|
|
703
865
|
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/objectives/${pathSegment('objectiveId', objectiveId)}:continue`, body: { message: params.message, enqueue: params.enqueue } };
|
|
704
866
|
}, options);
|
|
705
867
|
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Interrupt an objective
|
|
871
|
+
*
|
|
872
|
+
* @example
|
|
873
|
+
* ```ts
|
|
874
|
+
* const objectiveEvent = await client.objectives.interrupt('objective_123');
|
|
875
|
+
* ```
|
|
876
|
+
*/
|
|
877
|
+
interrupt(objectiveId: string, params?: ObjectiveInterruptParams, options?: RequestOptions): APIPromise<ObjectiveEvent> {
|
|
878
|
+
return this._client.requestAPI<ObjectiveEvent>(() => {
|
|
879
|
+
const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
880
|
+
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.");
|
|
881
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/objectives/${pathSegment('objectiveId', objectiveId)}:interrupt` };
|
|
882
|
+
}, options);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Create an objective and stream its events
|
|
887
|
+
*
|
|
888
|
+
* @example
|
|
889
|
+
* ```ts
|
|
890
|
+
* const stream = await client.objectives.createAndStream({ agentId: 'sample', metadata: { externalId: 'sample' } });
|
|
891
|
+
* for await (const event of stream) {
|
|
892
|
+
* // typed event payloads; housekeeping frames are skipped
|
|
893
|
+
* }
|
|
894
|
+
* ```
|
|
895
|
+
*/
|
|
896
|
+
async createAndStream(params: ObjectiveCreateAndStreamParams, options?: RequestOptions): Promise<Stream<CreateAndStreamObjectiveResponse>> {
|
|
897
|
+
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
898
|
+
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.");
|
|
899
|
+
const _spec: RequestSpec = { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/objectives:stream`, body: { agentId: params.agentId, variationId: params.variationId, metadata: params.metadata, systemPromptData: params.systemPromptData, firstUserMessage: params.firstUserMessage, secrets: params.secrets, memoryCascade: params.memoryCascade, firstUserMessageData: params.firstUserMessageData, episodicMemory: wireObjectiveEpisodicConfig(params.episodicMemory), tenant: params.tenant, subject: params.subject, pinnedParameters: params.pinnedParameters }, stream: true };
|
|
900
|
+
const response = await this._client.rawRequest(_spec, options);
|
|
901
|
+
return new Stream<CreateAndStreamObjectiveResponse>(response, options?.signal, options?.lastEventId, ['ping', 'open'], options?.reconnect === false ? undefined : (lastEventId, signal) => this._client.rawRequest(_spec, { ...options, lastEventId, signal }));
|
|
902
|
+
}
|
|
706
903
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by redwood. Do not edit by hand.
|
|
2
2
|
|
|
3
3
|
import { HttpClient, RequestOptions, APIPromise } from '../core/http.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { WhoamiResponse } from '../types.js';
|
|
5
5
|
|
|
6
6
|
export class Profiles {
|
|
7
7
|
constructor(private readonly _client: HttpClient) {}
|
|
@@ -11,11 +11,11 @@ export class Profiles {
|
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
|
-
* const
|
|
14
|
+
* const whoamiResponse = await client.profiles.whoami();
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
whoami(options?: RequestOptions): APIPromise<
|
|
18
|
-
return this._client.requestAPI<
|
|
17
|
+
whoami(options?: RequestOptions): APIPromise<WhoamiResponse> {
|
|
18
|
+
return this._client.requestAPI<WhoamiResponse>(() => {
|
|
19
19
|
return { method: 'GET', path: `/v1/whoami` };
|
|
20
20
|
}, options);
|
|
21
21
|
}
|