@cadenya/cadenya 0.124.0 → 0.125.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.
Files changed (285) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +18 -7
  3. package/client.d.mts +17 -11
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +17 -11
  6. package/client.d.ts.map +1 -1
  7. package/client.js +7 -3
  8. package/client.js.map +1 -1
  9. package/client.mjs +7 -3
  10. package/client.mjs.map +1 -1
  11. package/internal/request-options.d.mts +1 -1
  12. package/internal/request-options.d.ts +1 -1
  13. package/package.json +1 -1
  14. package/resources/account.d.mts +8 -0
  15. package/resources/account.d.mts.map +1 -1
  16. package/resources/account.d.ts +8 -0
  17. package/resources/account.d.ts.map +1 -1
  18. package/resources/account.js.map +1 -1
  19. package/resources/account.mjs.map +1 -1
  20. package/resources/agents/agents.d.mts +115 -28
  21. package/resources/agents/agents.d.mts.map +1 -1
  22. package/resources/agents/agents.d.ts +115 -28
  23. package/resources/agents/agents.d.ts.map +1 -1
  24. package/resources/agents/agents.js +93 -13
  25. package/resources/agents/agents.js.map +1 -1
  26. package/resources/agents/agents.mjs +93 -13
  27. package/resources/agents/agents.mjs.map +1 -1
  28. package/resources/agents/feedback.d.mts +13 -2
  29. package/resources/agents/feedback.d.mts.map +1 -1
  30. package/resources/agents/feedback.d.ts +13 -2
  31. package/resources/agents/feedback.d.ts.map +1 -1
  32. package/resources/agents/feedback.js +13 -2
  33. package/resources/agents/feedback.js.map +1 -1
  34. package/resources/agents/feedback.mjs +13 -2
  35. package/resources/agents/feedback.mjs.map +1 -1
  36. package/resources/agents/index.d.mts +1 -1
  37. package/resources/agents/index.d.mts.map +1 -1
  38. package/resources/agents/index.d.ts +1 -1
  39. package/resources/agents/index.d.ts.map +1 -1
  40. package/resources/agents/index.js.map +1 -1
  41. package/resources/agents/index.mjs.map +1 -1
  42. package/resources/agents/schedules.d.mts +100 -52
  43. package/resources/agents/schedules.d.mts.map +1 -1
  44. package/resources/agents/schedules.d.ts +100 -52
  45. package/resources/agents/schedules.d.ts.map +1 -1
  46. package/resources/agents/schedules.js +99 -21
  47. package/resources/agents/schedules.js.map +1 -1
  48. package/resources/agents/schedules.mjs +99 -21
  49. package/resources/agents/schedules.mjs.map +1 -1
  50. package/resources/agents/variations.d.mts +252 -105
  51. package/resources/agents/variations.d.mts.map +1 -1
  52. package/resources/agents/variations.d.ts +252 -105
  53. package/resources/agents/variations.d.ts.map +1 -1
  54. package/resources/agents/variations.js +138 -27
  55. package/resources/agents/variations.js.map +1 -1
  56. package/resources/agents/variations.mjs +138 -27
  57. package/resources/agents/variations.mjs.map +1 -1
  58. package/resources/agents/webhook-deliveries.d.mts +13 -2
  59. package/resources/agents/webhook-deliveries.d.mts.map +1 -1
  60. package/resources/agents/webhook-deliveries.d.ts +13 -2
  61. package/resources/agents/webhook-deliveries.d.ts.map +1 -1
  62. package/resources/agents/webhook-deliveries.js +13 -2
  63. package/resources/agents/webhook-deliveries.js.map +1 -1
  64. package/resources/agents/webhook-deliveries.mjs +13 -2
  65. package/resources/agents/webhook-deliveries.mjs.map +1 -1
  66. package/resources/ai-provider-keys.d.mts +125 -110
  67. package/resources/ai-provider-keys.d.mts.map +1 -1
  68. package/resources/ai-provider-keys.d.ts +125 -110
  69. package/resources/ai-provider-keys.d.ts.map +1 -1
  70. package/resources/ai-provider-keys.js +11 -9
  71. package/resources/ai-provider-keys.js.map +1 -1
  72. package/resources/ai-provider-keys.mjs +11 -9
  73. package/resources/ai-provider-keys.mjs.map +1 -1
  74. package/resources/api-keys.d.mts +28 -20
  75. package/resources/api-keys.d.mts.map +1 -1
  76. package/resources/api-keys.d.ts +28 -20
  77. package/resources/api-keys.d.ts.map +1 -1
  78. package/resources/api-keys.js +14 -12
  79. package/resources/api-keys.js.map +1 -1
  80. package/resources/api-keys.mjs +14 -12
  81. package/resources/api-keys.mjs.map +1 -1
  82. package/resources/index.d.mts +4 -4
  83. package/resources/index.d.mts.map +1 -1
  84. package/resources/index.d.ts +4 -4
  85. package/resources/index.d.ts.map +1 -1
  86. package/resources/index.js.map +1 -1
  87. package/resources/index.mjs.map +1 -1
  88. package/resources/memory-layers/entries.d.mts +27 -30
  89. package/resources/memory-layers/entries.d.mts.map +1 -1
  90. package/resources/memory-layers/entries.d.ts +27 -30
  91. package/resources/memory-layers/entries.d.ts.map +1 -1
  92. package/resources/memory-layers/entries.js +12 -12
  93. package/resources/memory-layers/entries.js.map +1 -1
  94. package/resources/memory-layers/entries.mjs +12 -12
  95. package/resources/memory-layers/entries.mjs.map +1 -1
  96. package/resources/memory-layers/index.d.mts +1 -1
  97. package/resources/memory-layers/index.d.mts.map +1 -1
  98. package/resources/memory-layers/index.d.ts +1 -1
  99. package/resources/memory-layers/index.d.ts.map +1 -1
  100. package/resources/memory-layers/index.js.map +1 -1
  101. package/resources/memory-layers/index.mjs.map +1 -1
  102. package/resources/memory-layers/memory-layers.d.mts +34 -22
  103. package/resources/memory-layers/memory-layers.d.mts.map +1 -1
  104. package/resources/memory-layers/memory-layers.d.ts +34 -22
  105. package/resources/memory-layers/memory-layers.d.ts.map +1 -1
  106. package/resources/memory-layers/memory-layers.js +11 -9
  107. package/resources/memory-layers/memory-layers.js.map +1 -1
  108. package/resources/memory-layers/memory-layers.mjs +11 -9
  109. package/resources/memory-layers/memory-layers.mjs.map +1 -1
  110. package/resources/models.d.mts +32 -24
  111. package/resources/models.d.mts.map +1 -1
  112. package/resources/models.d.ts +32 -24
  113. package/resources/models.d.ts.map +1 -1
  114. package/resources/models.js +10 -8
  115. package/resources/models.js.map +1 -1
  116. package/resources/models.mjs +10 -8
  117. package/resources/models.mjs.map +1 -1
  118. package/resources/objectives/feedback.d.mts +27 -3
  119. package/resources/objectives/feedback.d.mts.map +1 -1
  120. package/resources/objectives/feedback.d.ts +27 -3
  121. package/resources/objectives/feedback.d.ts.map +1 -1
  122. package/resources/objectives/feedback.js +27 -3
  123. package/resources/objectives/feedback.js.map +1 -1
  124. package/resources/objectives/feedback.mjs +27 -3
  125. package/resources/objectives/feedback.mjs.map +1 -1
  126. package/resources/objectives/index.d.mts +2 -2
  127. package/resources/objectives/index.d.mts.map +1 -1
  128. package/resources/objectives/index.d.ts +2 -2
  129. package/resources/objectives/index.d.ts.map +1 -1
  130. package/resources/objectives/index.js.map +1 -1
  131. package/resources/objectives/index.mjs.map +1 -1
  132. package/resources/objectives/objectives.d.mts +273 -102
  133. package/resources/objectives/objectives.d.mts.map +1 -1
  134. package/resources/objectives/objectives.d.ts +273 -102
  135. package/resources/objectives/objectives.d.ts.map +1 -1
  136. package/resources/objectives/objectives.js +112 -17
  137. package/resources/objectives/objectives.js.map +1 -1
  138. package/resources/objectives/objectives.mjs +112 -17
  139. package/resources/objectives/objectives.mjs.map +1 -1
  140. package/resources/objectives/tasks.d.mts +25 -8
  141. package/resources/objectives/tasks.d.mts.map +1 -1
  142. package/resources/objectives/tasks.d.ts +25 -8
  143. package/resources/objectives/tasks.d.ts.map +1 -1
  144. package/resources/objectives/tasks.js +26 -5
  145. package/resources/objectives/tasks.js.map +1 -1
  146. package/resources/objectives/tasks.mjs +26 -5
  147. package/resources/objectives/tasks.mjs.map +1 -1
  148. package/resources/objectives/tool-calls.d.mts +99 -42
  149. package/resources/objectives/tool-calls.d.mts.map +1 -1
  150. package/resources/objectives/tool-calls.d.ts +99 -42
  151. package/resources/objectives/tool-calls.d.ts.map +1 -1
  152. package/resources/objectives/tool-calls.js +73 -14
  153. package/resources/objectives/tool-calls.js.map +1 -1
  154. package/resources/objectives/tool-calls.mjs +73 -14
  155. package/resources/objectives/tool-calls.mjs.map +1 -1
  156. package/resources/objectives/tools.d.mts +13 -2
  157. package/resources/objectives/tools.d.mts.map +1 -1
  158. package/resources/objectives/tools.d.ts +13 -2
  159. package/resources/objectives/tools.d.ts.map +1 -1
  160. package/resources/objectives/tools.js +13 -2
  161. package/resources/objectives/tools.js.map +1 -1
  162. package/resources/objectives/tools.mjs +13 -2
  163. package/resources/objectives/tools.mjs.map +1 -1
  164. package/resources/search.d.mts +11 -2
  165. package/resources/search.d.mts.map +1 -1
  166. package/resources/search.d.ts +11 -2
  167. package/resources/search.d.ts.map +1 -1
  168. package/resources/search.js +3 -2
  169. package/resources/search.js.map +1 -1
  170. package/resources/search.mjs +3 -2
  171. package/resources/search.mjs.map +1 -1
  172. package/resources/tool-sets/index.d.mts +2 -2
  173. package/resources/tool-sets/index.d.mts.map +1 -1
  174. package/resources/tool-sets/index.d.ts +2 -2
  175. package/resources/tool-sets/index.d.ts.map +1 -1
  176. package/resources/tool-sets/index.js.map +1 -1
  177. package/resources/tool-sets/index.mjs.map +1 -1
  178. package/resources/tool-sets/secrets.d.mts +9 -24
  179. package/resources/tool-sets/secrets.d.mts.map +1 -1
  180. package/resources/tool-sets/secrets.d.ts +9 -24
  181. package/resources/tool-sets/secrets.d.ts.map +1 -1
  182. package/resources/tool-sets/secrets.js +12 -12
  183. package/resources/tool-sets/secrets.js.map +1 -1
  184. package/resources/tool-sets/secrets.mjs +12 -12
  185. package/resources/tool-sets/secrets.mjs.map +1 -1
  186. package/resources/tool-sets/tool-sets.d.mts +149 -64
  187. package/resources/tool-sets/tool-sets.d.mts.map +1 -1
  188. package/resources/tool-sets/tool-sets.d.ts +149 -64
  189. package/resources/tool-sets/tool-sets.d.ts.map +1 -1
  190. package/resources/tool-sets/tool-sets.js +17 -15
  191. package/resources/tool-sets/tool-sets.js.map +1 -1
  192. package/resources/tool-sets/tool-sets.mjs +17 -15
  193. package/resources/tool-sets/tool-sets.mjs.map +1 -1
  194. package/resources/tool-sets/tools.d.mts +33 -43
  195. package/resources/tool-sets/tools.d.mts.map +1 -1
  196. package/resources/tool-sets/tools.d.ts +33 -43
  197. package/resources/tool-sets/tools.d.ts.map +1 -1
  198. package/resources/tool-sets/tools.js +18 -18
  199. package/resources/tool-sets/tools.js.map +1 -1
  200. package/resources/tool-sets/tools.mjs +18 -18
  201. package/resources/tool-sets/tools.mjs.map +1 -1
  202. package/resources/uploads.d.mts +14 -6
  203. package/resources/uploads.d.mts.map +1 -1
  204. package/resources/uploads.d.ts +14 -6
  205. package/resources/uploads.d.ts.map +1 -1
  206. package/resources/uploads.js +5 -4
  207. package/resources/uploads.js.map +1 -1
  208. package/resources/uploads.mjs +5 -4
  209. package/resources/uploads.mjs.map +1 -1
  210. package/resources/workspace-admin/index.d.mts +1 -1
  211. package/resources/workspace-admin/index.d.mts.map +1 -1
  212. package/resources/workspace-admin/index.d.ts +1 -1
  213. package/resources/workspace-admin/index.d.ts.map +1 -1
  214. package/resources/workspace-admin/index.js.map +1 -1
  215. package/resources/workspace-admin/index.mjs.map +1 -1
  216. package/resources/workspace-admin/members.d.mts +41 -6
  217. package/resources/workspace-admin/members.d.mts.map +1 -1
  218. package/resources/workspace-admin/members.d.ts +41 -6
  219. package/resources/workspace-admin/members.d.ts.map +1 -1
  220. package/resources/workspace-admin/members.js +34 -6
  221. package/resources/workspace-admin/members.js.map +1 -1
  222. package/resources/workspace-admin/members.mjs +34 -6
  223. package/resources/workspace-admin/members.mjs.map +1 -1
  224. package/resources/workspace-admin/profiles.d.mts +8 -0
  225. package/resources/workspace-admin/profiles.d.mts.map +1 -1
  226. package/resources/workspace-admin/profiles.d.ts +8 -0
  227. package/resources/workspace-admin/profiles.d.ts.map +1 -1
  228. package/resources/workspace-admin/profiles.js +8 -0
  229. package/resources/workspace-admin/profiles.js.map +1 -1
  230. package/resources/workspace-admin/profiles.mjs +8 -0
  231. package/resources/workspace-admin/profiles.mjs.map +1 -1
  232. package/resources/workspace-admin/workspace-admin.d.mts +65 -9
  233. package/resources/workspace-admin/workspace-admin.d.mts.map +1 -1
  234. package/resources/workspace-admin/workspace-admin.d.ts +65 -9
  235. package/resources/workspace-admin/workspace-admin.d.ts.map +1 -1
  236. package/resources/workspace-admin/workspace-admin.js +46 -6
  237. package/resources/workspace-admin/workspace-admin.js.map +1 -1
  238. package/resources/workspace-admin/workspace-admin.mjs +46 -6
  239. package/resources/workspace-admin/workspace-admin.mjs.map +1 -1
  240. package/resources/workspace-secrets.d.mts +27 -15
  241. package/resources/workspace-secrets.d.mts.map +1 -1
  242. package/resources/workspace-secrets.d.ts +27 -15
  243. package/resources/workspace-secrets.d.ts.map +1 -1
  244. package/resources/workspace-secrets.js +11 -9
  245. package/resources/workspace-secrets.js.map +1 -1
  246. package/resources/workspace-secrets.mjs +11 -9
  247. package/resources/workspace-secrets.mjs.map +1 -1
  248. package/src/client.ts +102 -5
  249. package/src/internal/request-options.ts +1 -1
  250. package/src/resources/account.ts +9 -0
  251. package/src/resources/agents/agents.ts +147 -37
  252. package/src/resources/agents/feedback.ts +14 -3
  253. package/src/resources/agents/index.ts +6 -0
  254. package/src/resources/agents/schedules.ts +143 -71
  255. package/src/resources/agents/variations.ts +319 -125
  256. package/src/resources/agents/webhook-deliveries.ts +14 -3
  257. package/src/resources/ai-provider-keys.ts +155 -127
  258. package/src/resources/api-keys.ts +48 -29
  259. package/src/resources/index.ts +44 -1
  260. package/src/resources/memory-layers/entries.ts +56 -40
  261. package/src/resources/memory-layers/index.ts +2 -0
  262. package/src/resources/memory-layers/memory-layers.ts +53 -30
  263. package/src/resources/models.ts +46 -31
  264. package/src/resources/objectives/feedback.ts +29 -5
  265. package/src/resources/objectives/index.ts +26 -0
  266. package/src/resources/objectives/objectives.ts +373 -125
  267. package/src/resources/objectives/tasks.ts +33 -12
  268. package/src/resources/objectives/tool-calls.ts +123 -46
  269. package/src/resources/objectives/tools.ts +14 -3
  270. package/src/resources/search.ts +14 -4
  271. package/src/resources/tool-sets/index.ts +23 -3
  272. package/src/resources/tool-sets/secrets.ts +32 -35
  273. package/src/resources/tool-sets/tool-sets.ts +239 -79
  274. package/src/resources/tool-sets/tools.ts +79 -61
  275. package/src/resources/uploads.ts +22 -8
  276. package/src/resources/workspace-admin/index.ts +2 -0
  277. package/src/resources/workspace-admin/members.ts +53 -12
  278. package/src/resources/workspace-admin/profiles.ts +8 -0
  279. package/src/resources/workspace-admin/workspace-admin.ts +80 -11
  280. package/src/resources/workspace-secrets.ts +40 -25
  281. package/src/version.ts +1 -1
  282. package/version.d.mts +1 -1
  283. package/version.d.ts +1 -1
  284. package/version.js +1 -1
  285. package/version.mjs +1 -1
@@ -15,13 +15,26 @@ import { path } from '../../internal/utils/path';
15
15
  export class Variations extends APIResource {
16
16
  /**
17
17
  * Creates a new variation for an agent
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const agentVariation =
22
+ * await client.agents.variations.create(
23
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
24
+ * {
25
+ * workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q',
26
+ * metadata: { name: 'name' },
27
+ * spec: {},
28
+ * },
29
+ * );
30
+ * ```
18
31
  */
19
32
  create(
20
33
  agentID: string,
21
34
  params: VariationCreateParams,
22
35
  options?: RequestOptions,
23
36
  ): APIPromise<AgentVariation> {
24
- const { workspaceId, ...body } = params;
37
+ const { workspaceId = this._client.workspaceID, ...body } = params;
25
38
  return this._client.post(path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations`, {
26
39
  body,
27
40
  ...options,
@@ -30,22 +43,48 @@ export class Variations extends APIResource {
30
43
 
31
44
  /**
32
45
  * Retrieves a variation by ID from an agent
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const agentVariation =
50
+ * await client.agents.variations.retrieve(
51
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
52
+ * 'agentvar_01HXKD2E5NQM3T9AYWCF32BSPP',
53
+ * { workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q' },
54
+ * );
55
+ * ```
33
56
  */
34
57
  retrieve(
58
+ agentID: string,
35
59
  id: string,
36
- params: VariationRetrieveParams,
60
+ params: VariationRetrieveParams | null | undefined = {},
37
61
  options?: RequestOptions,
38
62
  ): APIPromise<AgentVariation> {
39
- const { workspaceId, agentId } = params;
40
- return this._client.get(path`/v1/workspaces/${workspaceId}/agents/${agentId}/variations/${id}`, options);
63
+ const { workspaceId = this._client.workspaceID } = params ?? {};
64
+ return this._client.get(path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations/${id}`, options);
41
65
  }
42
66
 
43
67
  /**
44
68
  * Updates a variation for an agent
45
- */
46
- update(id: string, params: VariationUpdateParams, options?: RequestOptions): APIPromise<AgentVariation> {
47
- const { workspaceId, agentId, ...body } = params;
48
- return this._client.patch(path`/v1/workspaces/${workspaceId}/agents/${agentId}/variations/${id}`, {
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const agentVariation =
73
+ * await client.agents.variations.update(
74
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
75
+ * 'agentvar_01HXKD2E5NQM3T9AYWCF32BSPP',
76
+ * { workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q' },
77
+ * );
78
+ * ```
79
+ */
80
+ update(
81
+ agentID: string,
82
+ id: string,
83
+ params: VariationUpdateParams,
84
+ options?: RequestOptions,
85
+ ): APIPromise<AgentVariation> {
86
+ const { workspaceId = this._client.workspaceID, ...body } = params;
87
+ return this._client.patch(path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations/${id}`, {
49
88
  body,
50
89
  ...options,
51
90
  });
@@ -53,13 +92,24 @@ export class Variations extends APIResource {
53
92
 
54
93
  /**
55
94
  * Lists all variations for an agent
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * // Automatically fetches more pages as needed.
99
+ * for await (const agentVariation of client.agents.variations.list(
100
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
101
+ * { workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q' },
102
+ * )) {
103
+ * // ...
104
+ * }
105
+ * ```
56
106
  */
57
107
  list(
58
108
  agentID: string,
59
- params: VariationListParams,
109
+ params: VariationListParams | null | undefined = {},
60
110
  options?: RequestOptions,
61
111
  ): PagePromise<AgentVariationsCursorPagination, AgentVariation> {
62
- const { workspaceId, ...query } = params;
112
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
63
113
  return this._client.getAPIList(
64
114
  path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations`,
65
115
  CursorPagination<AgentVariation>,
@@ -69,10 +119,24 @@ export class Variations extends APIResource {
69
119
 
70
120
  /**
71
121
  * Deletes a variation from an agent
72
- */
73
- delete(id: string, params: VariationDeleteParams, options?: RequestOptions): APIPromise<void> {
74
- const { workspaceId, agentId } = params;
75
- return this._client.delete(path`/v1/workspaces/${workspaceId}/agents/${agentId}/variations/${id}`, {
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * await client.agents.variations.delete(
126
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
127
+ * 'agentvar_01HXKD2E5NQM3T9AYWCF32BSPP',
128
+ * { workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q' },
129
+ * );
130
+ * ```
131
+ */
132
+ delete(
133
+ agentID: string,
134
+ id: string,
135
+ params: VariationDeleteParams | null | undefined = {},
136
+ options?: RequestOptions,
137
+ ): APIPromise<void> {
138
+ const { workspaceId = this._client.workspaceID } = params ?? {};
139
+ return this._client.delete(path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations/${id}`, {
76
140
  ...options,
77
141
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
78
142
  });
@@ -81,15 +145,30 @@ export class Variations extends APIResource {
81
145
  /**
82
146
  * Assigns a tool, tool set, or sub-agent to a variation. Exactly one target ID
83
147
  * must be set.
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const variationAssignment =
152
+ * await client.agents.variations.addAssignment(
153
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
154
+ * 'agentvar_01HXKD2E5NQM3T9AYWCF32BSPP',
155
+ * {
156
+ * workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q',
157
+ * toolId: 'tool_01HXKD2E5NQM3T9AYWCFWVYY9K',
158
+ * type: 'toolId',
159
+ * },
160
+ * );
161
+ * ```
84
162
  */
85
163
  addAssignment(
164
+ agentID: string,
86
165
  variationID: string,
87
166
  params: VariationAddAssignmentParams,
88
167
  options?: RequestOptions,
89
168
  ): APIPromise<VariationAssignment> {
90
- const { workspaceId, agentId, ...body } = params;
169
+ const { workspaceId = this._client.workspaceID, ...body } = params;
91
170
  return this._client.post(
92
- path`/v1/workspaces/${workspaceId}/agents/${agentId}/variations/${variationID}/assignments`,
171
+ path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations/${variationID}/assignments`,
93
172
  { body, ...options },
94
173
  );
95
174
  }
@@ -97,15 +176,29 @@ export class Variations extends APIResource {
97
176
  /**
98
177
  * Attaches a memory layer to a variation at a given position in the variation's
99
178
  * baseline memory cascade.
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * const variationMemoryLayerAssignment =
183
+ * await client.agents.variations.addMemoryLayer(
184
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
185
+ * 'agentvar_01HXKD2E5NQM3T9AYWCF32BSPP',
186
+ * {
187
+ * workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q',
188
+ * memoryLayerId: 'memlyr_01HXKD2E5NQM3T9AYWCFFFBMJH',
189
+ * },
190
+ * );
191
+ * ```
100
192
  */
101
193
  addMemoryLayer(
194
+ agentID: string,
102
195
  variationID: string,
103
196
  params: VariationAddMemoryLayerParams,
104
197
  options?: RequestOptions,
105
198
  ): APIPromise<VariationMemoryLayerAssignment> {
106
- const { workspaceId, agentId, ...body } = params;
199
+ const { workspaceId = this._client.workspaceID, ...body } = params;
107
200
  return this._client.post(
108
- path`/v1/workspaces/${workspaceId}/agents/${agentId}/variations/${variationID}/memory_layer_assignments`,
201
+ path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations/${variationID}/memory_layer_assignments`,
109
202
  { body, ...options },
110
203
  );
111
204
  }
@@ -113,15 +206,27 @@ export class Variations extends APIResource {
113
206
  /**
114
207
  * Detaches an assignment from a variation, identified by the assignment ID
115
208
  * returned when it was added.
209
+ *
210
+ * @example
211
+ * ```ts
212
+ * await client.agents.variations.removeAssignment(
213
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
214
+ * 'agentvar_01HXKD2E5NQM3T9AYWCF32BSPP',
215
+ * 'avt_01HXKD2E5NQM3T9AYWCFJE6K89',
216
+ * { workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q' },
217
+ * );
218
+ * ```
116
219
  */
117
220
  removeAssignment(
221
+ agentID: string,
222
+ variationID: string,
118
223
  id: string,
119
- params: VariationRemoveAssignmentParams,
224
+ params: VariationRemoveAssignmentParams | null | undefined = {},
120
225
  options?: RequestOptions,
121
226
  ): APIPromise<void> {
122
- const { workspaceId, agentId, variationId } = params;
227
+ const { workspaceId = this._client.workspaceID } = params ?? {};
123
228
  return this._client.delete(
124
- path`/v1/workspaces/${workspaceId}/agents/${agentId}/variations/${variationId}/assignments/${id}`,
229
+ path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations/${variationID}/assignments/${id}`,
125
230
  { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
126
231
  );
127
232
  }
@@ -129,30 +234,55 @@ export class Variations extends APIResource {
129
234
  /**
130
235
  * Detaches a memory layer assignment from a variation, identified by the
131
236
  * assignment id.
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * await client.agents.variations.removeMemoryLayer(
241
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
242
+ * 'agentvar_01HXKD2E5NQM3T9AYWCF32BSPP',
243
+ * 'avml_01HXKD2E5NQM3T9AYWCFX8AF59',
244
+ * { workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q' },
245
+ * );
246
+ * ```
132
247
  */
133
248
  removeMemoryLayer(
249
+ agentID: string,
250
+ variationID: string,
134
251
  id: string,
135
- params: VariationRemoveMemoryLayerParams,
252
+ params: VariationRemoveMemoryLayerParams | null | undefined = {},
136
253
  options?: RequestOptions,
137
254
  ): APIPromise<void> {
138
- const { workspaceId, agentId, variationId } = params;
255
+ const { workspaceId = this._client.workspaceID } = params ?? {};
139
256
  return this._client.delete(
140
- path`/v1/workspaces/${workspaceId}/agents/${agentId}/variations/${variationId}/memory_layer_assignments/${id}`,
257
+ path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations/${variationID}/memory_layer_assignments/${id}`,
141
258
  { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
142
259
  );
143
260
  }
144
261
 
145
262
  /**
146
263
  * Updates the position of a memory layer assignment on a variation.
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * const variationMemoryLayerAssignment =
268
+ * await client.agents.variations.updateMemoryLayer(
269
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
270
+ * 'agentvar_01HXKD2E5NQM3T9AYWCF32BSPP',
271
+ * 'avml_01HXKD2E5NQM3T9AYWCFX8AF59',
272
+ * { workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q' },
273
+ * );
274
+ * ```
147
275
  */
148
276
  updateMemoryLayer(
277
+ agentID: string,
278
+ variationID: string,
149
279
  id: string,
150
280
  params: VariationUpdateMemoryLayerParams,
151
281
  options?: RequestOptions,
152
282
  ): APIPromise<VariationMemoryLayerAssignment> {
153
- const { workspaceId, agentId, variationId, ...body } = params;
283
+ const { workspaceId = this._client.workspaceID, ...body } = params;
154
284
  return this._client.patch(
155
- path`/v1/workspaces/${workspaceId}/agents/${agentId}/variations/${variationId}/memory_layer_assignments/${id}`,
285
+ path`/v1/workspaces/${workspaceId}/agents/${agentID}/variations/${variationID}/memory_layer_assignments/${id}`,
156
286
  { body, ...options },
157
287
  );
158
288
  }
@@ -160,6 +290,75 @@ export class Variations extends APIResource {
160
290
 
161
291
  export type AgentVariationsCursorPagination = CursorPagination<AgentVariation>;
162
292
 
293
+ export interface AddAgentVariationAssignmentRequestSubAgentID {
294
+ subAgentId: string;
295
+
296
+ type: 'subAgentId';
297
+
298
+ /**
299
+ * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
300
+ * form.
301
+ */
302
+ agentId?: string;
303
+
304
+ /**
305
+ * Variation ID. Accepts the canonical `agentvar_…` form or the
306
+ * `external_id:<value>` form.
307
+ */
308
+ variationId?: string;
309
+
310
+ /**
311
+ * Workspace ID.
312
+ */
313
+ workspaceId?: string;
314
+ }
315
+
316
+ export interface AddAgentVariationAssignmentRequestToolID {
317
+ toolId: string;
318
+
319
+ type: 'toolId';
320
+
321
+ /**
322
+ * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
323
+ * form.
324
+ */
325
+ agentId?: string;
326
+
327
+ /**
328
+ * Variation ID. Accepts the canonical `agentvar_…` form or the
329
+ * `external_id:<value>` form.
330
+ */
331
+ variationId?: string;
332
+
333
+ /**
334
+ * Workspace ID.
335
+ */
336
+ workspaceId?: string;
337
+ }
338
+
339
+ export interface AddAgentVariationAssignmentRequestToolSetID {
340
+ toolSetId: string;
341
+
342
+ type: 'toolSetId';
343
+
344
+ /**
345
+ * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
346
+ * form.
347
+ */
348
+ agentId?: string;
349
+
350
+ /**
351
+ * Variation ID. Accepts the canonical `agentvar_…` form or the
352
+ * `external_id:<value>` form.
353
+ */
354
+ variationId?: string;
355
+
356
+ /**
357
+ * Workspace ID.
358
+ */
359
+ workspaceId?: string;
360
+ }
361
+
163
362
  /**
164
363
  * AgentVariation resource
165
364
  */
@@ -420,9 +619,12 @@ export interface CompactionConfigToolResultClearingStrategy {
420
619
  * the handle used to remove the assignment. It is returned by the add endpoint and
421
620
  * present on every entry in `AgentVariationInfo.assignments`.
422
621
  */
423
- export interface VariationAssignment {
424
- id?: string;
622
+ export type VariationAssignment =
623
+ | VariationAssignmentTool
624
+ | VariationAssignmentToolSet
625
+ | VariationAssignmentAgent;
425
626
 
627
+ export interface VariationAssignmentAgent {
426
628
  /**
427
629
  * BareMetadata contains the minimal metadata for a resource: the ID and an
428
630
  * optional human-readable name. These are used for reference fields where the full
@@ -431,8 +633,14 @@ export interface VariationAssignment {
431
633
  * to an objective. Both fields are server-populated; clients provide IDs through
432
634
  * sibling fields rather than by constructing a BareMetadata themselves.
433
635
  */
434
- agent?: Shared.BareMetadata;
636
+ agent: Shared.BareMetadata;
637
+
638
+ type: 'agent';
639
+
640
+ id?: string;
641
+ }
435
642
 
643
+ export interface VariationAssignmentTool {
436
644
  /**
437
645
  * BareMetadata contains the minimal metadata for a resource: the ID and an
438
646
  * optional human-readable name. These are used for reference fields where the full
@@ -441,8 +649,14 @@ export interface VariationAssignment {
441
649
  * to an objective. Both fields are server-populated; clients provide IDs through
442
650
  * sibling fields rather than by constructing a BareMetadata themselves.
443
651
  */
444
- tool?: Shared.BareMetadata;
652
+ tool: Shared.BareMetadata;
653
+
654
+ type: 'tool';
445
655
 
656
+ id?: string;
657
+ }
658
+
659
+ export interface VariationAssignmentToolSet {
446
660
  /**
447
661
  * BareMetadata contains the minimal metadata for a resource: the ID and an
448
662
  * optional human-readable name. These are used for reference fields where the full
@@ -451,7 +665,11 @@ export interface VariationAssignment {
451
665
  * to an objective. Both fields are server-populated; clients provide IDs through
452
666
  * sibling fields rather than by constructing a BareMetadata themselves.
453
667
  */
454
- toolSet?: Shared.BareMetadata;
668
+ toolSet: Shared.BareMetadata;
669
+
670
+ type: 'toolSet';
671
+
672
+ id?: string;
455
673
  }
456
674
 
457
675
  /**
@@ -494,7 +712,7 @@ export interface VariationCreateParams {
494
712
  /**
495
713
  * Path param: Workspace ID.
496
714
  */
497
- workspaceId: string;
715
+ workspaceId?: string;
498
716
 
499
717
  /**
500
718
  * Body param: CreateResourceMetadata contains the user-provided fields for
@@ -515,26 +733,14 @@ export interface VariationRetrieveParams {
515
733
  /**
516
734
  * Workspace ID.
517
735
  */
518
- workspaceId: string;
519
-
520
- /**
521
- * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
522
- * form.
523
- */
524
- agentId: string;
736
+ workspaceId?: string;
525
737
  }
526
738
 
527
739
  export interface VariationUpdateParams {
528
740
  /**
529
741
  * Path param: Workspace ID.
530
742
  */
531
- workspaceId: string;
532
-
533
- /**
534
- * Path param: Agent ID. Accepts the canonical `agent_…` form or the
535
- * `external_id:<value>` form.
536
- */
537
- agentId: string;
743
+ workspaceId?: string;
538
744
 
539
745
  /**
540
746
  * Body param: UpdateResourceMetadata contains the user-provided fields for
@@ -560,7 +766,7 @@ export interface VariationListParams extends CursorPaginationParams {
560
766
  /**
561
767
  * Path param: Workspace ID.
562
768
  */
563
- workspaceId: string;
769
+ workspaceId?: string;
564
770
 
565
771
  /**
566
772
  * Query param: When true, the `info` field on each returned variation is
@@ -585,60 +791,78 @@ export interface VariationDeleteParams {
585
791
  /**
586
792
  * Workspace ID.
587
793
  */
588
- workspaceId: string;
589
-
590
- /**
591
- * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
592
- * form.
593
- */
594
- agentId: string;
794
+ workspaceId?: string;
595
795
  }
596
796
 
597
- export interface VariationAddAssignmentParams {
598
- /**
599
- * Path param: Workspace ID.
600
- */
601
- workspaceId: string;
602
-
603
- /**
604
- * Path param: Agent ID. Accepts the canonical `agent_…` form or the
605
- * `external_id:<value>` form.
606
- */
607
- agentId: string;
608
-
609
- /**
610
- * Body param
611
- */
612
- subAgentId?: string;
797
+ export type VariationAddAssignmentParams =
798
+ | VariationAddAssignmentParams.AddAgentVariationAssignmentRequestToolID
799
+ | VariationAddAssignmentParams.AddAgentVariationAssignmentRequestToolSetID
800
+ | VariationAddAssignmentParams.AddAgentVariationAssignmentRequestSubAgentID;
801
+
802
+ export declare namespace VariationAddAssignmentParams {
803
+ export interface AddAgentVariationAssignmentRequestToolID {
804
+ /**
805
+ * Path param: Workspace ID.
806
+ */
807
+ workspaceId?: string;
808
+
809
+ /**
810
+ * Body param
811
+ */
812
+ toolId: string;
813
+
814
+ /**
815
+ * Body param
816
+ */
817
+ type: 'toolId';
818
+ }
613
819
 
614
- /**
615
- * Body param
616
- */
617
- toolId?: string;
820
+ export interface AddAgentVariationAssignmentRequestToolSetID {
821
+ /**
822
+ * Path param: Workspace ID.
823
+ */
824
+ workspaceId?: string;
825
+
826
+ /**
827
+ * Body param
828
+ */
829
+ toolSetId: string;
830
+
831
+ /**
832
+ * Body param
833
+ */
834
+ type: 'toolSetId';
835
+ }
618
836
 
619
- /**
620
- * Body param
621
- */
622
- toolSetId?: string;
837
+ export interface AddAgentVariationAssignmentRequestSubAgentID {
838
+ /**
839
+ * Path param: Workspace ID.
840
+ */
841
+ workspaceId?: string;
842
+
843
+ /**
844
+ * Body param
845
+ */
846
+ subAgentId: string;
847
+
848
+ /**
849
+ * Body param
850
+ */
851
+ type: 'subAgentId';
852
+ }
623
853
  }
624
854
 
625
855
  export interface VariationAddMemoryLayerParams {
626
856
  /**
627
857
  * Path param: Workspace ID.
628
858
  */
629
- workspaceId: string;
630
-
631
- /**
632
- * Path param: Agent ID. Accepts the canonical `agent_…` form or the
633
- * `external_id:<value>` form.
634
- */
635
- agentId: string;
859
+ workspaceId?: string;
636
860
 
637
861
  /**
638
862
  * Body param: Layer to attach. Accepts the canonical `memlyr_…` form or the
639
863
  * `external_id:<value>` form.
640
864
  */
641
- memoryLayerId?: string;
865
+ memoryLayerId: string;
642
866
 
643
867
  /**
644
868
  * Body param: Position in the baseline cascade (lower = more specific). If
@@ -651,57 +875,21 @@ export interface VariationRemoveAssignmentParams {
651
875
  /**
652
876
  * Workspace ID.
653
877
  */
654
- workspaceId: string;
655
-
656
- /**
657
- * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
658
- * form.
659
- */
660
- agentId: string;
661
-
662
- /**
663
- * Variation ID. Accepts the canonical `av_…` form or the `external_id:<value>`
664
- * form.
665
- */
666
- variationId: string;
878
+ workspaceId?: string;
667
879
  }
668
880
 
669
881
  export interface VariationRemoveMemoryLayerParams {
670
882
  /**
671
883
  * Workspace ID.
672
884
  */
673
- workspaceId: string;
674
-
675
- /**
676
- * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
677
- * form.
678
- */
679
- agentId: string;
680
-
681
- /**
682
- * Variation ID. Accepts the canonical `av_…` form or the `external_id:<value>`
683
- * form.
684
- */
685
- variationId: string;
885
+ workspaceId?: string;
686
886
  }
687
887
 
688
888
  export interface VariationUpdateMemoryLayerParams {
689
889
  /**
690
890
  * Path param: Workspace ID.
691
891
  */
692
- workspaceId: string;
693
-
694
- /**
695
- * Path param: Agent ID. Accepts the canonical `agent_…` form or the
696
- * `external_id:<value>` form.
697
- */
698
- agentId: string;
699
-
700
- /**
701
- * Path param: Variation ID. Accepts the canonical `av_…` form or the
702
- * `external_id:<value>` form.
703
- */
704
- variationId: string;
892
+ workspaceId?: string;
705
893
 
706
894
  /**
707
895
  * Body param: New position. Only field currently updatable on an assignment.
@@ -711,6 +899,9 @@ export interface VariationUpdateMemoryLayerParams {
711
899
 
712
900
  export declare namespace Variations {
713
901
  export {
902
+ type AddAgentVariationAssignmentRequestSubAgentID as AddAgentVariationAssignmentRequestSubAgentID,
903
+ type AddAgentVariationAssignmentRequestToolID as AddAgentVariationAssignmentRequestToolID,
904
+ type AddAgentVariationAssignmentRequestToolSetID as AddAgentVariationAssignmentRequestToolSetID,
714
905
  type AgentVariation as AgentVariation,
715
906
  type AgentVariationInfo as AgentVariationInfo,
716
907
  type AgentVariationSpec as AgentVariationSpec,
@@ -721,6 +912,9 @@ export declare namespace Variations {
721
912
  type CompactionConfigSummarizationStrategy as CompactionConfigSummarizationStrategy,
722
913
  type CompactionConfigToolResultClearingStrategy as CompactionConfigToolResultClearingStrategy,
723
914
  type VariationAssignment as VariationAssignment,
915
+ type VariationAssignmentAgent as VariationAssignmentAgent,
916
+ type VariationAssignmentTool as VariationAssignmentTool,
917
+ type VariationAssignmentToolSet as VariationAssignmentToolSet,
724
918
  type VariationMemoryLayerAssignment as VariationMemoryLayerAssignment,
725
919
  type AgentVariationsCursorPagination as AgentVariationsCursorPagination,
726
920
  type VariationCreateParams as VariationCreateParams,