@cadenya/cadenya 1.1.0 → 1.2.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 +7 -7
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/resources/agent-variations.d.ts +42 -32
- package/dist/resources/agent-variations.d.ts.map +1 -1
- package/dist/resources/agent-variations.js +22 -20
- package/dist/resources/agent-variations.js.map +1 -1
- package/dist/resources/agents.d.ts +3 -1
- package/dist/resources/agents.d.ts.map +1 -1
- package/dist/resources/agents.js.map +1 -1
- package/dist/resources/tool-search.d.ts +1 -1
- package/dist/resources/tool-search.js +1 -1
- package/dist/resources/tool-search.js.map +1 -1
- package/dist/types.d.ts +217 -67
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +40 -0
- package/dist/types.js.map +1 -1
- package/dist/webhooks.d.ts +7 -1
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/resources/agent-variations.ts +59 -47
- package/src/resources/agents.ts +3 -1
- package/src/resources/tool-search.ts +1 -1
- package/src/types.ts +266 -69
- package/src/webhooks.ts +7 -1
package/dist/webhooks.d.ts
CHANGED
|
@@ -78,7 +78,13 @@ export type ObjectiveEventMemoryReadWebhookEvent = ObjectiveEventWebhookData & {
|
|
|
78
78
|
export type ObjectiveEventReasoningWebhookEvent = ObjectiveEventWebhookData & {
|
|
79
79
|
type: 'objective_event.reasoning';
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Objective state changed event
|
|
83
|
+
*/
|
|
84
|
+
export type ObjectiveEventStateChangedWebhookEvent = ObjectiveEventWebhookData & {
|
|
85
|
+
type: 'objective_event.state_changed';
|
|
86
|
+
};
|
|
87
|
+
export type UnwrapWebhookEvent = ObjectiveEventUserMessageWebhookEvent | ObjectiveEventAssistantMessageWebhookEvent | ObjectiveEventToolResultWebhookEvent | ObjectiveEventToolApprovalRequestedWebhookEvent | ObjectiveEventToolCalledWebhookEvent | ObjectiveEventToolApprovedWebhookEvent | ObjectiveEventToolDeniedWebhookEvent | ObjectiveEventToolErrorWebhookEvent | ObjectiveEventSubAgentSpawnedWebhookEvent | ObjectiveEventSubAgentUpdatedWebhookEvent | ObjectiveEventErrorWebhookEvent | ObjectiveEventMemoryReadWebhookEvent | ObjectiveEventReasoningWebhookEvent | ObjectiveEventStateChangedWebhookEvent;
|
|
82
88
|
export declare class Webhooks {
|
|
83
89
|
private readonly secret;
|
|
84
90
|
constructor(secret: string | undefined);
|
package/dist/webhooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC3F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,8BAA8B,CAAA;CAAE,CAAC;AAEzH;;GAEG;AACH,MAAM,MAAM,0CAA0C,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,mCAAmC,CAAA;CAAE,CAAC;AAEnI;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,6BAA6B,CAAA;CAAE,CAAC;AAEvH;;GAEG;AACH,MAAM,MAAM,+CAA+C,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,yCAAyC,CAAA;CAAE,CAAC;AAE9I;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,6BAA6B,CAAA;CAAE,CAAC;AAEvH;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,+BAA+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mCAAmC,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,2BAA2B,CAAA;CAAE,CAAC;AAEpH;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,+BAA+B,CAAA;CAAE,CAAC;AAE3H,MAAM,MAAM,kBAAkB,GAC1B,qCAAqC,GACrC,0CAA0C,GAC1C,oCAAoC,GACpC,+CAA+C,GAC/C,oCAAoC,GACpC,sCAAsC,GACtC,oCAAoC,GACpC,mCAAmC,GACnC,yCAAyC,GACzC,yCAAyC,GACzC,+BAA+B,GAC/B,oCAAoC,GACpC,mCAAmC,GACnC,sCAAsC,CAAC;AAE3C,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM,GAAG,SAAS;IAEvD;;;OAGG;IACG,MAAM,CACV,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GACnD,OAAO,CAAC,kBAAkB,CAAC;CAU/B"}
|
package/dist/webhooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAAE,eAAe,EAAwC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAAE,eAAe,EAAwC,MAAM,oBAAoB,CAAC;AAyF3F,MAAM,OAAO,QAAQ;IACU;IAA7B,YAA6B,MAA0B;QAA1B,WAAM,GAAN,MAAM,CAAoB;IAAG,CAAC;IAE3D;;;OAGG;IACH,KAAK,CAAC,MAAM,CACV,OAAe,EACf,OAAuB,EACvB,OAAoD;QAEpD,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC;QACxD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,2IAA2I,CAC5I,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAuB,CAAC;IACnD,CAAC;CACF","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\nimport { WebhookVerifier, WebhookHeaders, WebhookVerifyOptions } from './core/webhooks.js';\nimport type { ObjectiveEventWebhookData } from './types.js';\n\n/**\n * Objective user message event\n */\nexport type ObjectiveEventUserMessageWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.user_message' };\n\n/**\n * Objective assistant message event\n */\nexport type ObjectiveEventAssistantMessageWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.assistant_message' };\n\n/**\n * Objective tool result event\n */\nexport type ObjectiveEventToolResultWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.tool_result' };\n\n/**\n * Objective tool approval requested event\n */\nexport type ObjectiveEventToolApprovalRequestedWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.tool_approval_requested' };\n\n/**\n * Objective tool called event\n */\nexport type ObjectiveEventToolCalledWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.tool_called' };\n\n/**\n * Objective tool approved event\n */\nexport type ObjectiveEventToolApprovedWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.tool_approved' };\n\n/**\n * Objective tool denied event\n */\nexport type ObjectiveEventToolDeniedWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.tool_denied' };\n\n/**\n * Objective tool error event\n */\nexport type ObjectiveEventToolErrorWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.tool_error' };\n\n/**\n * Objective sub-agent spawned event\n */\nexport type ObjectiveEventSubAgentSpawnedWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.sub_agent_spawned' };\n\n/**\n * Objective sub-agent updated event\n */\nexport type ObjectiveEventSubAgentUpdatedWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.sub_agent_updated' };\n\n/**\n * Objective error event\n */\nexport type ObjectiveEventErrorWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.error' };\n\n/**\n * Objective memory read event\n */\nexport type ObjectiveEventMemoryReadWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.memory_read' };\n\n/**\n * Objective reasoning event\n */\nexport type ObjectiveEventReasoningWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.reasoning' };\n\n/**\n * Objective state changed event\n */\nexport type ObjectiveEventStateChangedWebhookEvent = ObjectiveEventWebhookData & { type: 'objective_event.state_changed' };\n\nexport type UnwrapWebhookEvent =\n | ObjectiveEventUserMessageWebhookEvent\n | ObjectiveEventAssistantMessageWebhookEvent\n | ObjectiveEventToolResultWebhookEvent\n | ObjectiveEventToolApprovalRequestedWebhookEvent\n | ObjectiveEventToolCalledWebhookEvent\n | ObjectiveEventToolApprovedWebhookEvent\n | ObjectiveEventToolDeniedWebhookEvent\n | ObjectiveEventToolErrorWebhookEvent\n | ObjectiveEventSubAgentSpawnedWebhookEvent\n | ObjectiveEventSubAgentUpdatedWebhookEvent\n | ObjectiveEventErrorWebhookEvent\n | ObjectiveEventMemoryReadWebhookEvent\n | ObjectiveEventReasoningWebhookEvent\n | ObjectiveEventStateChangedWebhookEvent;\n\nexport class Webhooks {\n constructor(private readonly secret: string | undefined) {}\n\n /**\n * Verify a Standard Webhooks delivery (webhook-id / webhook-timestamp /\n * webhook-signature headers) and return its typed payload.\n */\n async unwrap(\n payload: string,\n headers: WebhookHeaders,\n options?: WebhookVerifyOptions & { secret?: string },\n ): Promise<UnwrapWebhookEvent> {\n const secret = (options?.secret ?? this.secret)?.trim();\n if (!secret) {\n throw new Error(\n \"Missing webhook secret. Pass { secret }, construct the client with webhookSecret, or set the CADENYA_WEBHOOK_SECRET environment variable.\",\n );\n }\n await new WebhookVerifier(secret).verify(payload, headers, options);\n return JSON.parse(payload) as UnwrapWebhookEvent;\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -85,7 +85,7 @@ export class Cadenya {
|
|
|
85
85
|
authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),
|
|
86
86
|
maxRetries: options.maxRetries ?? 0,
|
|
87
87
|
timeout: options.timeout,
|
|
88
|
-
defaultHeaders: { 'User-Agent': 'cadenya-typescript/1.0
|
|
88
|
+
defaultHeaders: { 'User-Agent': 'cadenya-typescript/1.2.0 (api 1.0)', ...options.defaultHeaders },
|
|
89
89
|
fetch: options.fetch,
|
|
90
90
|
logger: options.logger,
|
|
91
91
|
logLevel: options.logLevel,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { HttpClient, RequestOptions, APIPromise, pathSegment, snapshotParams } from '../core/http.js';
|
|
4
4
|
import { Page } from '../core/pagination.js';
|
|
5
|
-
import type { AddAgentVariationAssignmentRequestParam, AgentVariation, AgentVariationSpec, CreateResourceMetadata, ListAgentVariationsResponse,
|
|
6
|
-
import { wireAddAgentVariationAssignmentRequest } from '../types.js';
|
|
5
|
+
import type { AddAgentVariationAssignmentRequestParam, AgentVariation, AgentVariationSpec, CreateResourceMetadata, ListAgentVariationsResponse, RemoveAgentVariationAssignmentRequestParam, UpdateResourceMetadata } from '../types.js';
|
|
6
|
+
import { wireAddAgentVariationAssignmentRequest, wireRemoveAgentVariationAssignmentRequest } from '../types.js';
|
|
7
7
|
|
|
8
8
|
export interface AgentVariationListParams {
|
|
9
9
|
/**
|
|
@@ -76,32 +76,25 @@ export interface AgentVariationUpdateParams {
|
|
|
76
76
|
metadata?: UpdateResourceMetadata;
|
|
77
77
|
spec?: AgentVariationSpec;
|
|
78
78
|
/**
|
|
79
|
-
* Fields to update
|
|
79
|
+
* Fields to update. Assignment lists are replaced as a whole, never merged.
|
|
80
|
+
* Select spec.assignments or spec.memory_layer_assignments to replace/clear
|
|
81
|
+
* one list. Selecting spec replaces the entire spec (including omitted lists);
|
|
82
|
+
* * replaces all mutable fields. Element/index paths are not supported.
|
|
83
|
+
* Without a mask, infer paths from non-empty fields: non-empty assignment
|
|
84
|
+
* lists replace existing lists, while omitted/empty lists remain unchanged.
|
|
85
|
+
* To clear a list, explicitly include its path in the mask.
|
|
80
86
|
*/
|
|
81
87
|
updateMask?: string;
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
export
|
|
85
|
-
/**
|
|
86
|
-
* The request body, sent as-is.
|
|
87
|
-
*/
|
|
88
|
-
body: AddAgentVariationAssignmentRequestParam;
|
|
89
|
-
/**
|
|
90
|
-
* Workspace ID.
|
|
91
|
-
*
|
|
92
|
-
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
93
|
-
*/
|
|
94
|
-
workspaceId?: string;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface AgentVariationRemoveAssignmentParams {
|
|
90
|
+
export type AgentVariationAddAssignmentParams = AddAgentVariationAssignmentRequestParam & {
|
|
98
91
|
/**
|
|
99
92
|
* Workspace ID.
|
|
100
93
|
*
|
|
101
94
|
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
102
95
|
*/
|
|
103
96
|
workspaceId?: string;
|
|
104
|
-
}
|
|
97
|
+
};
|
|
105
98
|
|
|
106
99
|
export interface AgentVariationAddMemoryLayerParams {
|
|
107
100
|
/**
|
|
@@ -122,26 +115,43 @@ export interface AgentVariationAddMemoryLayerParams {
|
|
|
122
115
|
position?: number;
|
|
123
116
|
}
|
|
124
117
|
|
|
125
|
-
export
|
|
118
|
+
export type AgentVariationRemoveAssignmentParams = RemoveAgentVariationAssignmentRequestParam & {
|
|
126
119
|
/**
|
|
127
120
|
* Workspace ID.
|
|
128
121
|
*
|
|
129
122
|
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
130
123
|
*/
|
|
131
124
|
workspaceId?: string;
|
|
132
|
-
}
|
|
125
|
+
};
|
|
133
126
|
|
|
134
|
-
export interface
|
|
127
|
+
export interface AgentVariationRemoveMemoryLayerParams {
|
|
128
|
+
/**
|
|
129
|
+
* Layer to detach. Accepts memlyr_… or external_id:<value>.
|
|
130
|
+
*/
|
|
131
|
+
memoryLayerId: string;
|
|
135
132
|
/**
|
|
136
133
|
* Workspace ID.
|
|
137
134
|
*
|
|
138
135
|
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
139
136
|
*/
|
|
140
137
|
workspaceId?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface AgentVariationUpdateMemoryLayerParams {
|
|
141
|
+
/**
|
|
142
|
+
* Layer to reposition. Accepts memlyr_… or external_id:<value>.
|
|
143
|
+
*/
|
|
144
|
+
memoryLayerId: string;
|
|
141
145
|
/**
|
|
142
146
|
* New position. Only field currently updatable on an assignment.
|
|
143
147
|
*/
|
|
144
|
-
position
|
|
148
|
+
position: number;
|
|
149
|
+
/**
|
|
150
|
+
* Workspace ID.
|
|
151
|
+
*
|
|
152
|
+
* Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.
|
|
153
|
+
*/
|
|
154
|
+
workspaceId?: string;
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
export class AgentVariations {
|
|
@@ -235,46 +245,48 @@ export class AgentVariations {
|
|
|
235
245
|
*
|
|
236
246
|
* @example
|
|
237
247
|
* ```ts
|
|
238
|
-
* const
|
|
248
|
+
* const agentVariation = await client.agents.variations.addAssignment('agent_123', 'variation_123', { toolId: 'sample', type: 'toolId' });
|
|
239
249
|
* ```
|
|
240
250
|
*/
|
|
241
|
-
addAssignment(agentId: string, variationId: string, params: AgentVariationAddAssignmentParams, options?: RequestOptions): APIPromise<
|
|
242
|
-
return this._client.requestAPI<
|
|
251
|
+
addAssignment(agentId: string, variationId: string, params: AgentVariationAddAssignmentParams, options?: RequestOptions): APIPromise<AgentVariation> {
|
|
252
|
+
return this._client.requestAPI<AgentVariation>(() => {
|
|
253
|
+
const { workspaceId: _bodyParam0, ..._body } = params;
|
|
243
254
|
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
244
255
|
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.");
|
|
245
|
-
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agents/${pathSegment('agentId', agentId)}/variations/${pathSegment('variationId', variationId)}
|
|
256
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agents/${pathSegment('agentId', agentId)}/variations/${pathSegment('variationId', variationId)}:addAssignment`, body: wireAddAgentVariationAssignmentRequest(_body) };
|
|
246
257
|
}, options);
|
|
247
258
|
}
|
|
248
259
|
|
|
249
260
|
/**
|
|
250
|
-
*
|
|
261
|
+
* Attach a memory layer to a variation
|
|
251
262
|
*
|
|
252
263
|
* @example
|
|
253
264
|
* ```ts
|
|
254
|
-
* await client.agents.variations.
|
|
265
|
+
* const agentVariation = await client.agents.variations.addMemoryLayer('agent_123', 'variation_123', { memoryLayerId: 'sample' });
|
|
255
266
|
* ```
|
|
256
267
|
*/
|
|
257
|
-
|
|
258
|
-
return this._client.requestAPI<
|
|
259
|
-
const workspaceId = String(params
|
|
268
|
+
addMemoryLayer(agentId: string, variationId: string, params: AgentVariationAddMemoryLayerParams, options?: RequestOptions): APIPromise<AgentVariation> {
|
|
269
|
+
return this._client.requestAPI<AgentVariation>(() => {
|
|
270
|
+
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
260
271
|
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.");
|
|
261
|
-
return { method: '
|
|
272
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agents/${pathSegment('agentId', agentId)}/variations/${pathSegment('variationId', variationId)}:addMemoryLayer`, body: { memoryLayerId: params.memoryLayerId, position: params.position } };
|
|
262
273
|
}, options);
|
|
263
274
|
}
|
|
264
275
|
|
|
265
276
|
/**
|
|
266
|
-
*
|
|
277
|
+
* Remove an assignment from a variation
|
|
267
278
|
*
|
|
268
279
|
* @example
|
|
269
280
|
* ```ts
|
|
270
|
-
* const
|
|
281
|
+
* const agentVariation = await client.agents.variations.removeAssignment('agent_123', 'variation_123', { toolId: 'sample', type: 'toolId' });
|
|
271
282
|
* ```
|
|
272
283
|
*/
|
|
273
|
-
|
|
274
|
-
return this._client.requestAPI<
|
|
284
|
+
removeAssignment(agentId: string, variationId: string, params: AgentVariationRemoveAssignmentParams, options?: RequestOptions): APIPromise<AgentVariation> {
|
|
285
|
+
return this._client.requestAPI<AgentVariation>(() => {
|
|
286
|
+
const { workspaceId: _bodyParam0, ..._body } = params;
|
|
275
287
|
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
276
288
|
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.");
|
|
277
|
-
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agents/${pathSegment('agentId', agentId)}/variations/${pathSegment('variationId', variationId)}
|
|
289
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agents/${pathSegment('agentId', agentId)}/variations/${pathSegment('variationId', variationId)}:removeAssignment`, body: wireRemoveAgentVariationAssignmentRequest(_body) };
|
|
278
290
|
}, options);
|
|
279
291
|
}
|
|
280
292
|
|
|
@@ -283,14 +295,14 @@ export class AgentVariations {
|
|
|
283
295
|
*
|
|
284
296
|
* @example
|
|
285
297
|
* ```ts
|
|
286
|
-
* await client.agents.variations.removeMemoryLayer('agent_123', 'variation_123', '
|
|
298
|
+
* const agentVariation = await client.agents.variations.removeMemoryLayer('agent_123', 'variation_123', { memoryLayerId: 'sample' });
|
|
287
299
|
* ```
|
|
288
300
|
*/
|
|
289
|
-
removeMemoryLayer(agentId: string, variationId: string,
|
|
290
|
-
return this._client.requestAPI<
|
|
291
|
-
const workspaceId = String(params
|
|
301
|
+
removeMemoryLayer(agentId: string, variationId: string, params: AgentVariationRemoveMemoryLayerParams, options?: RequestOptions): APIPromise<AgentVariation> {
|
|
302
|
+
return this._client.requestAPI<AgentVariation>(() => {
|
|
303
|
+
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
292
304
|
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.");
|
|
293
|
-
return { method: '
|
|
305
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agents/${pathSegment('agentId', agentId)}/variations/${pathSegment('variationId', variationId)}:removeMemoryLayer`, body: { memoryLayerId: params.memoryLayerId } };
|
|
294
306
|
}, options);
|
|
295
307
|
}
|
|
296
308
|
|
|
@@ -299,14 +311,14 @@ export class AgentVariations {
|
|
|
299
311
|
*
|
|
300
312
|
* @example
|
|
301
313
|
* ```ts
|
|
302
|
-
* const
|
|
314
|
+
* const agentVariation = await client.agents.variations.updateMemoryLayer('agent_123', 'variation_123', { memoryLayerId: 'sample', position: 1 });
|
|
303
315
|
* ```
|
|
304
316
|
*/
|
|
305
|
-
updateMemoryLayer(agentId: string, variationId: string,
|
|
306
|
-
return this._client.requestAPI<
|
|
307
|
-
const workspaceId = String(params
|
|
317
|
+
updateMemoryLayer(agentId: string, variationId: string, params: AgentVariationUpdateMemoryLayerParams, options?: RequestOptions): APIPromise<AgentVariation> {
|
|
318
|
+
return this._client.requestAPI<AgentVariation>(() => {
|
|
319
|
+
const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;
|
|
308
320
|
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.");
|
|
309
|
-
return { method: '
|
|
321
|
+
return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/agents/${pathSegment('agentId', agentId)}/variations/${pathSegment('variationId', variationId)}:updateMemoryLayer`, body: { memoryLayerId: params.memoryLayerId, position: params.position } };
|
|
310
322
|
}, options);
|
|
311
323
|
}
|
|
312
324
|
}
|
package/src/resources/agents.ts
CHANGED
|
@@ -65,7 +65,9 @@ export interface AgentCreateParams {
|
|
|
65
65
|
*/
|
|
66
66
|
workspaceId?: string;
|
|
67
67
|
/**
|
|
68
|
-
* Optional default variation to add to the agent on create
|
|
68
|
+
* Optional default variation to add to the agent on create. Its spec accepts
|
|
69
|
+
* assignments and memory_layer_assignments using the same atomic validation
|
|
70
|
+
* as CreateAgentVariation. Failure rejects the entire agent creation.
|
|
69
71
|
*/
|
|
70
72
|
defaultVariation?: CreateAgentVariationRequestParam;
|
|
71
73
|
}
|
|
@@ -21,7 +21,7 @@ export class ToolSearch {
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
24
|
-
* const searchToolsOrToolSetsResponse = await client.toolSearch.searchOrSets({ query: '
|
|
24
|
+
* const searchToolsOrToolSetsResponse = await client.toolSearch.searchOrSets({ query: 'sample' });
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
searchOrSets(params: ToolSearchSearchOrSetsParams, options?: RequestOptions): APIPromise<SearchToolsOrToolSetsResponse> {
|