@cadenya/cadenya 0.124.0 → 0.126.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 (278) hide show
  1. package/CHANGELOG.md +17 -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/agents/agents.d.mts +115 -28
  15. package/resources/agents/agents.d.mts.map +1 -1
  16. package/resources/agents/agents.d.ts +115 -28
  17. package/resources/agents/agents.d.ts.map +1 -1
  18. package/resources/agents/agents.js +93 -13
  19. package/resources/agents/agents.js.map +1 -1
  20. package/resources/agents/agents.mjs +93 -13
  21. package/resources/agents/agents.mjs.map +1 -1
  22. package/resources/agents/feedback.d.mts +13 -2
  23. package/resources/agents/feedback.d.mts.map +1 -1
  24. package/resources/agents/feedback.d.ts +13 -2
  25. package/resources/agents/feedback.d.ts.map +1 -1
  26. package/resources/agents/feedback.js +13 -2
  27. package/resources/agents/feedback.js.map +1 -1
  28. package/resources/agents/feedback.mjs +13 -2
  29. package/resources/agents/feedback.mjs.map +1 -1
  30. package/resources/agents/index.d.mts +1 -1
  31. package/resources/agents/index.d.mts.map +1 -1
  32. package/resources/agents/index.d.ts +1 -1
  33. package/resources/agents/index.d.ts.map +1 -1
  34. package/resources/agents/index.js.map +1 -1
  35. package/resources/agents/index.mjs.map +1 -1
  36. package/resources/agents/schedules.d.mts +100 -52
  37. package/resources/agents/schedules.d.mts.map +1 -1
  38. package/resources/agents/schedules.d.ts +100 -52
  39. package/resources/agents/schedules.d.ts.map +1 -1
  40. package/resources/agents/schedules.js +99 -21
  41. package/resources/agents/schedules.js.map +1 -1
  42. package/resources/agents/schedules.mjs +99 -21
  43. package/resources/agents/schedules.mjs.map +1 -1
  44. package/resources/agents/variations.d.mts +252 -105
  45. package/resources/agents/variations.d.mts.map +1 -1
  46. package/resources/agents/variations.d.ts +252 -105
  47. package/resources/agents/variations.d.ts.map +1 -1
  48. package/resources/agents/variations.js +138 -27
  49. package/resources/agents/variations.js.map +1 -1
  50. package/resources/agents/variations.mjs +138 -27
  51. package/resources/agents/variations.mjs.map +1 -1
  52. package/resources/agents/webhook-deliveries.d.mts +13 -2
  53. package/resources/agents/webhook-deliveries.d.mts.map +1 -1
  54. package/resources/agents/webhook-deliveries.d.ts +13 -2
  55. package/resources/agents/webhook-deliveries.d.ts.map +1 -1
  56. package/resources/agents/webhook-deliveries.js +13 -2
  57. package/resources/agents/webhook-deliveries.js.map +1 -1
  58. package/resources/agents/webhook-deliveries.mjs +13 -2
  59. package/resources/agents/webhook-deliveries.mjs.map +1 -1
  60. package/resources/ai-provider-keys.d.mts +125 -110
  61. package/resources/ai-provider-keys.d.mts.map +1 -1
  62. package/resources/ai-provider-keys.d.ts +125 -110
  63. package/resources/ai-provider-keys.d.ts.map +1 -1
  64. package/resources/ai-provider-keys.js +11 -9
  65. package/resources/ai-provider-keys.js.map +1 -1
  66. package/resources/ai-provider-keys.mjs +11 -9
  67. package/resources/ai-provider-keys.mjs.map +1 -1
  68. package/resources/api-keys.d.mts +28 -20
  69. package/resources/api-keys.d.mts.map +1 -1
  70. package/resources/api-keys.d.ts +28 -20
  71. package/resources/api-keys.d.ts.map +1 -1
  72. package/resources/api-keys.js +14 -12
  73. package/resources/api-keys.js.map +1 -1
  74. package/resources/api-keys.mjs +14 -12
  75. package/resources/api-keys.mjs.map +1 -1
  76. package/resources/index.d.mts +4 -4
  77. package/resources/index.d.mts.map +1 -1
  78. package/resources/index.d.ts +4 -4
  79. package/resources/index.d.ts.map +1 -1
  80. package/resources/index.js.map +1 -1
  81. package/resources/index.mjs.map +1 -1
  82. package/resources/memory-layers/entries.d.mts +27 -30
  83. package/resources/memory-layers/entries.d.mts.map +1 -1
  84. package/resources/memory-layers/entries.d.ts +27 -30
  85. package/resources/memory-layers/entries.d.ts.map +1 -1
  86. package/resources/memory-layers/entries.js +12 -12
  87. package/resources/memory-layers/entries.js.map +1 -1
  88. package/resources/memory-layers/entries.mjs +12 -12
  89. package/resources/memory-layers/entries.mjs.map +1 -1
  90. package/resources/memory-layers/index.d.mts +1 -1
  91. package/resources/memory-layers/index.d.mts.map +1 -1
  92. package/resources/memory-layers/index.d.ts +1 -1
  93. package/resources/memory-layers/index.d.ts.map +1 -1
  94. package/resources/memory-layers/index.js.map +1 -1
  95. package/resources/memory-layers/index.mjs.map +1 -1
  96. package/resources/memory-layers/memory-layers.d.mts +34 -22
  97. package/resources/memory-layers/memory-layers.d.mts.map +1 -1
  98. package/resources/memory-layers/memory-layers.d.ts +34 -22
  99. package/resources/memory-layers/memory-layers.d.ts.map +1 -1
  100. package/resources/memory-layers/memory-layers.js +11 -9
  101. package/resources/memory-layers/memory-layers.js.map +1 -1
  102. package/resources/memory-layers/memory-layers.mjs +11 -9
  103. package/resources/memory-layers/memory-layers.mjs.map +1 -1
  104. package/resources/models.d.mts +32 -24
  105. package/resources/models.d.mts.map +1 -1
  106. package/resources/models.d.ts +32 -24
  107. package/resources/models.d.ts.map +1 -1
  108. package/resources/models.js +10 -8
  109. package/resources/models.js.map +1 -1
  110. package/resources/models.mjs +10 -8
  111. package/resources/models.mjs.map +1 -1
  112. package/resources/objectives/feedback.d.mts +27 -3
  113. package/resources/objectives/feedback.d.mts.map +1 -1
  114. package/resources/objectives/feedback.d.ts +27 -3
  115. package/resources/objectives/feedback.d.ts.map +1 -1
  116. package/resources/objectives/feedback.js +27 -3
  117. package/resources/objectives/feedback.js.map +1 -1
  118. package/resources/objectives/feedback.mjs +27 -3
  119. package/resources/objectives/feedback.mjs.map +1 -1
  120. package/resources/objectives/index.d.mts +2 -2
  121. package/resources/objectives/index.d.mts.map +1 -1
  122. package/resources/objectives/index.d.ts +2 -2
  123. package/resources/objectives/index.d.ts.map +1 -1
  124. package/resources/objectives/index.js.map +1 -1
  125. package/resources/objectives/index.mjs.map +1 -1
  126. package/resources/objectives/objectives.d.mts +273 -102
  127. package/resources/objectives/objectives.d.mts.map +1 -1
  128. package/resources/objectives/objectives.d.ts +273 -102
  129. package/resources/objectives/objectives.d.ts.map +1 -1
  130. package/resources/objectives/objectives.js +112 -17
  131. package/resources/objectives/objectives.js.map +1 -1
  132. package/resources/objectives/objectives.mjs +112 -17
  133. package/resources/objectives/objectives.mjs.map +1 -1
  134. package/resources/objectives/tasks.d.mts +25 -8
  135. package/resources/objectives/tasks.d.mts.map +1 -1
  136. package/resources/objectives/tasks.d.ts +25 -8
  137. package/resources/objectives/tasks.d.ts.map +1 -1
  138. package/resources/objectives/tasks.js +26 -5
  139. package/resources/objectives/tasks.js.map +1 -1
  140. package/resources/objectives/tasks.mjs +26 -5
  141. package/resources/objectives/tasks.mjs.map +1 -1
  142. package/resources/objectives/tool-calls.d.mts +99 -42
  143. package/resources/objectives/tool-calls.d.mts.map +1 -1
  144. package/resources/objectives/tool-calls.d.ts +99 -42
  145. package/resources/objectives/tool-calls.d.ts.map +1 -1
  146. package/resources/objectives/tool-calls.js +73 -14
  147. package/resources/objectives/tool-calls.js.map +1 -1
  148. package/resources/objectives/tool-calls.mjs +73 -14
  149. package/resources/objectives/tool-calls.mjs.map +1 -1
  150. package/resources/objectives/tools.d.mts +13 -2
  151. package/resources/objectives/tools.d.mts.map +1 -1
  152. package/resources/objectives/tools.d.ts +13 -2
  153. package/resources/objectives/tools.d.ts.map +1 -1
  154. package/resources/objectives/tools.js +13 -2
  155. package/resources/objectives/tools.js.map +1 -1
  156. package/resources/objectives/tools.mjs +13 -2
  157. package/resources/objectives/tools.mjs.map +1 -1
  158. package/resources/search.d.mts +11 -2
  159. package/resources/search.d.mts.map +1 -1
  160. package/resources/search.d.ts +11 -2
  161. package/resources/search.d.ts.map +1 -1
  162. package/resources/search.js +3 -2
  163. package/resources/search.js.map +1 -1
  164. package/resources/search.mjs +3 -2
  165. package/resources/search.mjs.map +1 -1
  166. package/resources/tool-sets/index.d.mts +2 -2
  167. package/resources/tool-sets/index.d.mts.map +1 -1
  168. package/resources/tool-sets/index.d.ts +2 -2
  169. package/resources/tool-sets/index.d.ts.map +1 -1
  170. package/resources/tool-sets/index.js.map +1 -1
  171. package/resources/tool-sets/index.mjs.map +1 -1
  172. package/resources/tool-sets/secrets.d.mts +9 -24
  173. package/resources/tool-sets/secrets.d.mts.map +1 -1
  174. package/resources/tool-sets/secrets.d.ts +9 -24
  175. package/resources/tool-sets/secrets.d.ts.map +1 -1
  176. package/resources/tool-sets/secrets.js +12 -12
  177. package/resources/tool-sets/secrets.js.map +1 -1
  178. package/resources/tool-sets/secrets.mjs +12 -12
  179. package/resources/tool-sets/secrets.mjs.map +1 -1
  180. package/resources/tool-sets/tool-sets.d.mts +149 -64
  181. package/resources/tool-sets/tool-sets.d.mts.map +1 -1
  182. package/resources/tool-sets/tool-sets.d.ts +149 -64
  183. package/resources/tool-sets/tool-sets.d.ts.map +1 -1
  184. package/resources/tool-sets/tool-sets.js +17 -15
  185. package/resources/tool-sets/tool-sets.js.map +1 -1
  186. package/resources/tool-sets/tool-sets.mjs +17 -15
  187. package/resources/tool-sets/tool-sets.mjs.map +1 -1
  188. package/resources/tool-sets/tools.d.mts +33 -43
  189. package/resources/tool-sets/tools.d.mts.map +1 -1
  190. package/resources/tool-sets/tools.d.ts +33 -43
  191. package/resources/tool-sets/tools.d.ts.map +1 -1
  192. package/resources/tool-sets/tools.js +18 -18
  193. package/resources/tool-sets/tools.js.map +1 -1
  194. package/resources/tool-sets/tools.mjs +18 -18
  195. package/resources/tool-sets/tools.mjs.map +1 -1
  196. package/resources/uploads.d.mts +14 -6
  197. package/resources/uploads.d.mts.map +1 -1
  198. package/resources/uploads.d.ts +14 -6
  199. package/resources/uploads.d.ts.map +1 -1
  200. package/resources/uploads.js +5 -4
  201. package/resources/uploads.js.map +1 -1
  202. package/resources/uploads.mjs +5 -4
  203. package/resources/uploads.mjs.map +1 -1
  204. package/resources/workspace-admin/index.d.mts +1 -1
  205. package/resources/workspace-admin/index.d.mts.map +1 -1
  206. package/resources/workspace-admin/index.d.ts +1 -1
  207. package/resources/workspace-admin/index.d.ts.map +1 -1
  208. package/resources/workspace-admin/index.js.map +1 -1
  209. package/resources/workspace-admin/index.mjs.map +1 -1
  210. package/resources/workspace-admin/members.d.mts +41 -6
  211. package/resources/workspace-admin/members.d.mts.map +1 -1
  212. package/resources/workspace-admin/members.d.ts +41 -6
  213. package/resources/workspace-admin/members.d.ts.map +1 -1
  214. package/resources/workspace-admin/members.js +34 -6
  215. package/resources/workspace-admin/members.js.map +1 -1
  216. package/resources/workspace-admin/members.mjs +34 -6
  217. package/resources/workspace-admin/members.mjs.map +1 -1
  218. package/resources/workspace-admin/profiles.d.mts +8 -0
  219. package/resources/workspace-admin/profiles.d.mts.map +1 -1
  220. package/resources/workspace-admin/profiles.d.ts +8 -0
  221. package/resources/workspace-admin/profiles.d.ts.map +1 -1
  222. package/resources/workspace-admin/profiles.js +8 -0
  223. package/resources/workspace-admin/profiles.js.map +1 -1
  224. package/resources/workspace-admin/profiles.mjs +8 -0
  225. package/resources/workspace-admin/profiles.mjs.map +1 -1
  226. package/resources/workspace-admin/workspace-admin.d.mts +65 -9
  227. package/resources/workspace-admin/workspace-admin.d.mts.map +1 -1
  228. package/resources/workspace-admin/workspace-admin.d.ts +65 -9
  229. package/resources/workspace-admin/workspace-admin.d.ts.map +1 -1
  230. package/resources/workspace-admin/workspace-admin.js +46 -6
  231. package/resources/workspace-admin/workspace-admin.js.map +1 -1
  232. package/resources/workspace-admin/workspace-admin.mjs +46 -6
  233. package/resources/workspace-admin/workspace-admin.mjs.map +1 -1
  234. package/resources/workspace-secrets.d.mts +27 -15
  235. package/resources/workspace-secrets.d.mts.map +1 -1
  236. package/resources/workspace-secrets.d.ts +27 -15
  237. package/resources/workspace-secrets.d.ts.map +1 -1
  238. package/resources/workspace-secrets.js +11 -9
  239. package/resources/workspace-secrets.js.map +1 -1
  240. package/resources/workspace-secrets.mjs +11 -9
  241. package/resources/workspace-secrets.mjs.map +1 -1
  242. package/src/client.ts +102 -5
  243. package/src/internal/request-options.ts +1 -1
  244. package/src/resources/agents/agents.ts +147 -37
  245. package/src/resources/agents/feedback.ts +14 -3
  246. package/src/resources/agents/index.ts +6 -0
  247. package/src/resources/agents/schedules.ts +143 -71
  248. package/src/resources/agents/variations.ts +319 -125
  249. package/src/resources/agents/webhook-deliveries.ts +14 -3
  250. package/src/resources/ai-provider-keys.ts +155 -127
  251. package/src/resources/api-keys.ts +48 -29
  252. package/src/resources/index.ts +44 -1
  253. package/src/resources/memory-layers/entries.ts +56 -40
  254. package/src/resources/memory-layers/index.ts +2 -0
  255. package/src/resources/memory-layers/memory-layers.ts +53 -30
  256. package/src/resources/models.ts +46 -31
  257. package/src/resources/objectives/feedback.ts +29 -5
  258. package/src/resources/objectives/index.ts +26 -0
  259. package/src/resources/objectives/objectives.ts +373 -125
  260. package/src/resources/objectives/tasks.ts +33 -12
  261. package/src/resources/objectives/tool-calls.ts +123 -46
  262. package/src/resources/objectives/tools.ts +14 -3
  263. package/src/resources/search.ts +14 -4
  264. package/src/resources/tool-sets/index.ts +23 -3
  265. package/src/resources/tool-sets/secrets.ts +32 -35
  266. package/src/resources/tool-sets/tool-sets.ts +239 -79
  267. package/src/resources/tool-sets/tools.ts +79 -61
  268. package/src/resources/uploads.ts +22 -8
  269. package/src/resources/workspace-admin/index.ts +2 -0
  270. package/src/resources/workspace-admin/members.ts +53 -12
  271. package/src/resources/workspace-admin/profiles.ts +8 -0
  272. package/src/resources/workspace-admin/workspace-admin.ts +80 -11
  273. package/src/resources/workspace-secrets.ts +40 -25
  274. package/src/version.ts +1 -1
  275. package/version.d.mts +1 -1
  276. package/version.d.ts +1 -1
  277. package/version.js +1 -1
  278. package/version.mjs +1 -1
@@ -12,13 +12,24 @@ import { path } from '../../internal/utils/path';
12
12
  export class WebhookDeliveries extends APIResource {
13
13
  /**
14
14
  * Lists all webhook deliveries for an agent
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // Automatically fetches more pages as needed.
19
+ * for await (const webhookDelivery of client.agents.webhookDeliveries.list(
20
+ * 'agent_01HXKD2E5NQM3T9AYWCFMGWT9Y',
21
+ * { workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q' },
22
+ * )) {
23
+ * // ...
24
+ * }
25
+ * ```
15
26
  */
16
27
  list(
17
28
  agentID: string,
18
- params: WebhookDeliveryListParams,
29
+ params: WebhookDeliveryListParams | null | undefined = {},
19
30
  options?: RequestOptions,
20
31
  ): PagePromise<WebhookDeliveriesCursorPagination, WebhookDelivery> {
21
- const { workspaceId, ...query } = params;
32
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
22
33
  return this._client.getAPIList(
23
34
  path`/v1/workspaces/${workspaceId}/agents/${agentID}/webhook_deliveries`,
24
35
  CursorPagination<WebhookDelivery>,
@@ -117,7 +128,7 @@ export interface WebhookDeliveryListParams extends CursorPaginationParams {
117
128
  /**
118
129
  * Path param: Workspace ID.
119
130
  */
120
- workspaceId: string;
131
+ workspaceId?: string;
121
132
 
122
133
  /**
123
134
  * Query param: Optional filter by event type
@@ -12,12 +12,9 @@ export class AIProviderKeys extends APIResource {
12
12
  /**
13
13
  * Creates a new customer-provided AI provider key in the workspace
14
14
  */
15
- create(
16
- workspaceID: string,
17
- body: AIProviderKeyCreateParams,
18
- options?: RequestOptions,
19
- ): APIPromise<AIProviderKey> {
20
- return this._client.post(path`/v1/workspaces/${workspaceID}/ai_provider_keys`, { body, ...options });
15
+ create(params: AIProviderKeyCreateParams, options?: RequestOptions): APIPromise<AIProviderKey> {
16
+ const { workspaceId = this._client.workspaceID, ...body } = params;
17
+ return this._client.post(path`/v1/workspaces/${workspaceId}/ai_provider_keys`, { body, ...options });
21
18
  }
22
19
 
23
20
  /**
@@ -25,10 +22,10 @@ export class AIProviderKeys extends APIResource {
25
22
  */
26
23
  retrieve(
27
24
  id: string,
28
- params: AIProviderKeyRetrieveParams,
25
+ params: AIProviderKeyRetrieveParams | null | undefined = {},
29
26
  options?: RequestOptions,
30
27
  ): APIPromise<AIProviderKey> {
31
- const { workspaceId } = params;
28
+ const { workspaceId = this._client.workspaceID } = params ?? {};
32
29
  return this._client.get(path`/v1/workspaces/${workspaceId}/ai_provider_keys/${id}`, options);
33
30
  }
34
31
 
@@ -36,7 +33,7 @@ export class AIProviderKeys extends APIResource {
36
33
  * Updates an AI provider key's name or key value in the workspace
37
34
  */
38
35
  update(id: string, params: AIProviderKeyUpdateParams, options?: RequestOptions): APIPromise<AIProviderKey> {
39
- const { workspaceId, ...body } = params;
36
+ const { workspaceId = this._client.workspaceID, ...body } = params;
40
37
  return this._client.patch(path`/v1/workspaces/${workspaceId}/ai_provider_keys/${id}`, {
41
38
  body,
42
39
  ...options,
@@ -47,12 +44,12 @@ export class AIProviderKeys extends APIResource {
47
44
  * Lists all customer-provided AI provider keys in the workspace
48
45
  */
49
46
  list(
50
- workspaceID: string,
51
- query: AIProviderKeyListParams | null | undefined = {},
47
+ params: AIProviderKeyListParams | null | undefined = {},
52
48
  options?: RequestOptions,
53
49
  ): PagePromise<AIProviderKeysCursorPagination, AIProviderKey> {
50
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
54
51
  return this._client.getAPIList(
55
- path`/v1/workspaces/${workspaceID}/ai_provider_keys`,
52
+ path`/v1/workspaces/${workspaceId}/ai_provider_keys`,
56
53
  CursorPagination<AIProviderKey>,
57
54
  { query, ...options },
58
55
  );
@@ -61,8 +58,12 @@ export class AIProviderKeys extends APIResource {
61
58
  /**
62
59
  * Deletes an AI provider key from the workspace
63
60
  */
64
- delete(id: string, params: AIProviderKeyDeleteParams, options?: RequestOptions): APIPromise<void> {
65
- const { workspaceId } = params;
61
+ delete(
62
+ id: string,
63
+ params: AIProviderKeyDeleteParams | null | undefined = {},
64
+ options?: RequestOptions,
65
+ ): APIPromise<void> {
66
+ const { workspaceId = this._client.workspaceID } = params ?? {};
66
67
  return this._client.delete(path`/v1/workspaces/${workspaceId}/ai_provider_keys/${id}`, {
67
68
  ...options,
68
69
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
@@ -72,6 +73,113 @@ export class AIProviderKeys extends APIResource {
72
73
 
73
74
  export type AIProviderKeysCursorPagination = CursorPagination<AIProviderKey>;
74
75
 
76
+ export interface AIProviderConfigOpenAI {
77
+ /**
78
+ * OpenAIConfig holds OpenAI-specific settings.
79
+ */
80
+ openai: AIProviderConfigOpenAI.OpenAI;
81
+
82
+ type: 'openai';
83
+ }
84
+
85
+ export namespace AIProviderConfigOpenAI {
86
+ /**
87
+ * OpenAIConfig holds OpenAI-specific settings.
88
+ */
89
+ export interface OpenAI {
90
+ /**
91
+ * Sent as the OpenAI-Organization header when set.
92
+ */
93
+ organizationId?: string;
94
+
95
+ /**
96
+ * Sent as the OpenAI-Project header when set.
97
+ */
98
+ projectId?: string;
99
+ }
100
+ }
101
+
102
+ export interface AIProviderConfigOpenAICompatible {
103
+ /**
104
+ * OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
105
+ * Completions API. The base URL is required and its model catalog is discovered
106
+ * live via GET {base_url}/models.
107
+ */
108
+ openaiCompatible: AIProviderConfigOpenAICompatible.OpenAICompatible;
109
+
110
+ type: 'openaiCompatible';
111
+ }
112
+
113
+ export namespace AIProviderConfigOpenAICompatible {
114
+ /**
115
+ * OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
116
+ * Completions API. The base URL is required and its model catalog is discovered
117
+ * live via GET {base_url}/models.
118
+ */
119
+ export interface OpenAICompatible {
120
+ baseUrl: string;
121
+ }
122
+ }
123
+
124
+ export interface AIProviderConfigOpenrouter {
125
+ /**
126
+ * OpenRouterConfig holds OpenRouter-specific settings.
127
+ */
128
+ openrouter: AIProviderConfigOpenrouter.Openrouter;
129
+
130
+ type: 'openrouter';
131
+ }
132
+
133
+ export namespace AIProviderConfigOpenrouter {
134
+ /**
135
+ * OpenRouterConfig holds OpenRouter-specific settings.
136
+ */
137
+ export interface Openrouter {
138
+ /**
139
+ * Data-residency region (e.g. "us", "eu"). Empty uses the provider default.
140
+ */
141
+ region?: string;
142
+ }
143
+ }
144
+
145
+ export interface AIProviderCredentialAPIKey {
146
+ /**
147
+ * CredentialAPIKey carries a single bearer/header API key.
148
+ */
149
+ apiKey: AIProviderCredentialAPIKey.APIKey;
150
+
151
+ type: 'apiKey';
152
+ }
153
+
154
+ export namespace AIProviderCredentialAPIKey {
155
+ /**
156
+ * CredentialAPIKey carries a single bearer/header API key.
157
+ */
158
+ export interface APIKey {
159
+ apiKey?: string;
160
+ }
161
+ }
162
+
163
+ export interface AIProviderCredentialHeaders {
164
+ /**
165
+ * CredentialHeaders carries arbitrary HTTP headers sent with every request to the
166
+ * provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
167
+ */
168
+ headers: AIProviderCredentialHeaders.Headers;
169
+
170
+ type: 'headers';
171
+ }
172
+
173
+ export namespace AIProviderCredentialHeaders {
174
+ /**
175
+ * CredentialHeaders carries arbitrary HTTP headers sent with every request to the
176
+ * provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
177
+ */
178
+ export interface Headers {
179
+ headers?: { [key: string]: string };
180
+ }
181
+ }
182
+
75
183
  /**
76
184
  * AIProviderKey is a credential for an AI provider, scoped to a workspace. Most
77
185
  * keys are customer-provided (BYOK); Cadenya also provisions promotional keys (see
@@ -125,14 +233,14 @@ export interface AIProviderKeySpec {
125
233
  * intentionally not overridable here; use the OpenAI-compatible provider to target
126
234
  * a custom endpoint.
127
235
  */
128
- config?: AIProviderKeySpec.Config;
236
+ config?: AIProviderConfigOpenrouter | AIProviderConfigOpenAI | AIProviderConfigOpenAICompatible;
129
237
 
130
238
  /**
131
239
  * AIProviderCredential is the secret material used to authenticate with a
132
240
  * provider. The set case must correspond to AIProviderKeySpec.provider. The server
133
241
  * encrypts the serialized message at rest and never returns it on reads.
134
242
  */
135
- credentials?: AIProviderKeySpec.Credentials;
243
+ credentials?: AIProviderCredentialAPIKey | AIProviderCredentialHeaders;
136
244
 
137
245
  /**
138
246
  * The AI provider this key authenticates against.
@@ -146,113 +254,23 @@ export interface AIProviderKeySpec {
146
254
  | 'AI_PROVIDER_OPENAI_COMPATIBLE';
147
255
  }
148
256
 
149
- export namespace AIProviderKeySpec {
257
+ export interface AIProviderKeyCreateParams {
150
258
  /**
151
- * AIProviderConfig holds non-secret, provider-specific settings. The set case must
152
- * correspond to AIProviderKeySpec.provider. Providers with no settings (Anthropic,
153
- * Gemini) simply leave this unset. The endpoint of a named provider is fixed and
154
- * intentionally not overridable here; use the OpenAI-compatible provider to target
155
- * a custom endpoint.
259
+ * Path param: The workspace that will own this key.
156
260
  */
157
- export interface Config {
158
- /**
159
- * OpenAIConfig holds OpenAI-specific settings.
160
- */
161
- openai?: Config.OpenAI;
162
-
163
- /**
164
- * OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
165
- * Completions API. The base URL is required and its model catalog is discovered
166
- * live via GET {base_url}/models.
167
- */
168
- openaiCompatible?: Config.OpenAICompatible;
169
-
170
- /**
171
- * OpenRouterConfig holds OpenRouter-specific settings.
172
- */
173
- openrouter?: Config.Openrouter;
174
- }
175
-
176
- export namespace Config {
177
- /**
178
- * OpenAIConfig holds OpenAI-specific settings.
179
- */
180
- export interface OpenAI {
181
- /**
182
- * Sent as the OpenAI-Organization header when set.
183
- */
184
- organizationId?: string;
185
-
186
- /**
187
- * Sent as the OpenAI-Project header when set.
188
- */
189
- projectId?: string;
190
- }
191
-
192
- /**
193
- * OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
194
- * Completions API. The base URL is required and its model catalog is discovered
195
- * live via GET {base_url}/models.
196
- */
197
- export interface OpenAICompatible {
198
- baseUrl?: string;
199
- }
200
-
201
- /**
202
- * OpenRouterConfig holds OpenRouter-specific settings.
203
- */
204
- export interface Openrouter {
205
- /**
206
- * Data-residency region (e.g. "us", "eu"). Empty uses the provider default.
207
- */
208
- region?: string;
209
- }
210
- }
261
+ workspaceId?: string;
211
262
 
212
263
  /**
213
- * AIProviderCredential is the secret material used to authenticate with a
214
- * provider. The set case must correspond to AIProviderKeySpec.provider. The server
215
- * encrypts the serialized message at rest and never returns it on reads.
264
+ * Body param: CreateResourceMetadata contains the user-provided fields for
265
+ * creating a workspace-scoped resource. Read-only fields (id, account_id,
266
+ * workspace_id, profile_id, created_at) are excluded since they are set by the
267
+ * server.
216
268
  */
217
- export interface Credentials {
218
- /**
219
- * CredentialAPIKey carries a single bearer/header API key.
220
- */
221
- apiKey?: Credentials.APIKey;
222
-
223
- /**
224
- * CredentialHeaders carries arbitrary HTTP headers sent with every request to the
225
- * provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
226
- */
227
- headers?: Credentials.Headers;
228
- }
229
-
230
- export namespace Credentials {
231
- /**
232
- * CredentialAPIKey carries a single bearer/header API key.
233
- */
234
- export interface APIKey {
235
- apiKey?: string;
236
- }
237
-
238
- /**
239
- * CredentialHeaders carries arbitrary HTTP headers sent with every request to the
240
- * provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
241
- */
242
- export interface Headers {
243
- headers?: { [key: string]: string };
244
- }
245
- }
246
- }
269
+ metadata: Shared.CreateResourceMetadata;
247
270
 
248
- export interface AIProviderKeyCreateParams {
249
271
  /**
250
- * CreateResourceMetadata contains the user-provided fields for creating a
251
- * workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
252
- * profile_id, created_at) are excluded since they are set by the server.
272
+ * Body param
253
273
  */
254
- metadata: Shared.CreateResourceMetadata;
255
-
256
274
  spec: AIProviderKeySpec;
257
275
  }
258
276
 
@@ -260,14 +278,14 @@ export interface AIProviderKeyRetrieveParams {
260
278
  /**
261
279
  * The workspace the key belongs to.
262
280
  */
263
- workspaceId: string;
281
+ workspaceId?: string;
264
282
  }
265
283
 
266
284
  export interface AIProviderKeyUpdateParams {
267
285
  /**
268
286
  * Path param: The workspace the key belongs to.
269
287
  */
270
- workspaceId: string;
288
+ workspaceId?: string;
271
289
 
272
290
  /**
273
291
  * Body param: UpdateResourceMetadata contains the user-provided fields for
@@ -290,37 +308,42 @@ export interface AIProviderKeyUpdateParams {
290
308
 
291
309
  export interface AIProviderKeyListParams extends CursorPaginationParams {
292
310
  /**
293
- * When true, populate each item's info (model counts), at the cost of extra
294
- * lookups.
311
+ * Path param: The workspace whose keys will be listed.
312
+ */
313
+ workspaceId?: string;
314
+
315
+ /**
316
+ * Query param: When true, populate each item's info (model counts), at the cost of
317
+ * extra lookups.
295
318
  */
296
319
  includeInfo?: boolean;
297
320
 
298
321
  /**
299
- * Filters by metadata labels. Comma-separated key=value pairs, e.g.
322
+ * Query param: Filters by metadata labels. Comma-separated key=value pairs, e.g.
300
323
  * "env=prod,team=ai". A resource matches only if every pair matches exactly (AND
301
324
  * semantics).
302
325
  */
303
326
  labels?: string;
304
327
 
305
328
  /**
306
- * Filter expression (query param: prefix)
329
+ * Query param: Filter expression (query param: prefix)
307
330
  */
308
331
  prefix?: string;
309
332
 
310
333
  /**
311
- * When true, return only promotional keys (provided by Cadenya, e.g. for
312
- * onboarding). Defaults to returning all keys, customer-provided and promotional
313
- * alike.
334
+ * Query param: When true, return only promotional keys (provided by Cadenya, e.g.
335
+ * for onboarding). Defaults to returning all keys, customer-provided and
336
+ * promotional alike.
314
337
  */
315
338
  promotional?: boolean;
316
339
 
317
340
  /**
318
- * Free-form search query
341
+ * Query param: Free-form search query
319
342
  */
320
343
  query?: string;
321
344
 
322
345
  /**
323
- * Sort order for results (asc or desc by creation time)
346
+ * Query param: Sort order for results (asc or desc by creation time)
324
347
  */
325
348
  sortOrder?: string;
326
349
  }
@@ -329,11 +352,16 @@ export interface AIProviderKeyDeleteParams {
329
352
  /**
330
353
  * The workspace the key belongs to.
331
354
  */
332
- workspaceId: string;
355
+ workspaceId?: string;
333
356
  }
334
357
 
335
358
  export declare namespace AIProviderKeys {
336
359
  export {
360
+ type AIProviderConfigOpenAI as AIProviderConfigOpenAI,
361
+ type AIProviderConfigOpenAICompatible as AIProviderConfigOpenAICompatible,
362
+ type AIProviderConfigOpenrouter as AIProviderConfigOpenrouter,
363
+ type AIProviderCredentialAPIKey as AIProviderCredentialAPIKey,
364
+ type AIProviderCredentialHeaders as AIProviderCredentialHeaders,
337
365
  type AIProviderKey as AIProviderKey,
338
366
  type AIProviderKeySpec as AIProviderKeySpec,
339
367
  type AIProviderKeysCursorPagination as AIProviderKeysCursorPagination,
@@ -18,15 +18,20 @@ export class APIKeys extends APIResource {
18
18
  /**
19
19
  * Creates a new API key in the workspace.
20
20
  */
21
- create(workspaceID: string, body: APIKeyCreateParams, options?: RequestOptions): APIPromise<APIKey> {
22
- return this._client.post(path`/v1/workspaces/${workspaceID}/api_keys`, { body, ...options });
21
+ create(params: APIKeyCreateParams, options?: RequestOptions): APIPromise<APIKey> {
22
+ const { workspaceId = this._client.workspaceID, ...body } = params;
23
+ return this._client.post(path`/v1/workspaces/${workspaceId}/api_keys`, { body, ...options });
23
24
  }
24
25
 
25
26
  /**
26
27
  * Retrieves an API key by ID.
27
28
  */
28
- retrieve(id: string, params: APIKeyRetrieveParams, options?: RequestOptions): APIPromise<APIKey> {
29
- const { workspaceId } = params;
29
+ retrieve(
30
+ id: string,
31
+ params: APIKeyRetrieveParams | null | undefined = {},
32
+ options?: RequestOptions,
33
+ ): APIPromise<APIKey> {
34
+ const { workspaceId = this._client.workspaceID } = params ?? {};
30
35
  return this._client.get(path`/v1/workspaces/${workspaceId}/api_keys/${id}`, options);
31
36
  }
32
37
 
@@ -34,7 +39,7 @@ export class APIKeys extends APIResource {
34
39
  * Updates an API key.
35
40
  */
36
41
  update(id: string, params: APIKeyUpdateParams, options?: RequestOptions): APIPromise<APIKey> {
37
- const { workspaceId, ...body } = params;
42
+ const { workspaceId = this._client.workspaceID, ...body } = params;
38
43
  return this._client.patch(path`/v1/workspaces/${workspaceId}/api_keys/${id}`, { body, ...options });
39
44
  }
40
45
 
@@ -42,11 +47,11 @@ export class APIKeys extends APIResource {
42
47
  * Lists the workspace's API keys.
43
48
  */
44
49
  list(
45
- workspaceID: string,
46
- query: APIKeyListParams | null | undefined = {},
50
+ params: APIKeyListParams | null | undefined = {},
47
51
  options?: RequestOptions,
48
52
  ): PagePromise<APIKeysCursorPagination, APIKey> {
49
- return this._client.getAPIList(path`/v1/workspaces/${workspaceID}/api_keys`, CursorPagination<APIKey>, {
53
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
54
+ return this._client.getAPIList(path`/v1/workspaces/${workspaceId}/api_keys`, CursorPagination<APIKey>, {
50
55
  query,
51
56
  ...options,
52
57
  });
@@ -55,8 +60,12 @@ export class APIKeys extends APIResource {
55
60
  /**
56
61
  * Deletes an API key.
57
62
  */
58
- delete(id: string, params: APIKeyDeleteParams, options?: RequestOptions): APIPromise<void> {
59
- const { workspaceId } = params;
63
+ delete(
64
+ id: string,
65
+ params: APIKeyDeleteParams | null | undefined = {},
66
+ options?: RequestOptions,
67
+ ): APIPromise<void> {
68
+ const { workspaceId = this._client.workspaceID } = params ?? {};
60
69
  return this._client.delete(path`/v1/workspaces/${workspaceId}/api_keys/${id}`, {
61
70
  ...options,
62
71
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
@@ -68,7 +77,7 @@ export class APIKeys extends APIResource {
68
77
  * authentication on every endpoint; the key is retained. Idempotent.
69
78
  */
70
79
  disable(id: string, params: APIKeyDisableParams, options?: RequestOptions): APIPromise<APIKey> {
71
- const { workspaceId, ...body } = params;
80
+ const { workspaceId = this._client.workspaceID, ...body } = params;
72
81
  return this._client.post(path`/v1/workspaces/${workspaceId}/api_keys/${id}:disable`, {
73
82
  body,
74
83
  ...options,
@@ -79,7 +88,7 @@ export class APIKeys extends APIResource {
79
88
  * Re-enables a disabled API key so its token authenticates again. Idempotent.
80
89
  */
81
90
  enable(id: string, params: APIKeyEnableParams, options?: RequestOptions): APIPromise<APIKey> {
82
- const { workspaceId, ...body } = params;
91
+ const { workspaceId = this._client.workspaceID, ...body } = params;
83
92
  return this._client.post(path`/v1/workspaces/${workspaceId}/api_keys/${id}:enable`, { body, ...options });
84
93
  }
85
94
 
@@ -88,7 +97,7 @@ export class APIKeys extends APIResource {
88
97
  * invalidated.
89
98
  */
90
99
  rotate(id: string, params: APIKeyRotateParams, options?: RequestOptions): APIPromise<APIKey> {
91
- const { workspaceId, ...body } = params;
100
+ const { workspaceId = this._client.workspaceID, ...body } = params;
92
101
  return this._client.post(path`/v1/workspaces/${workspaceId}/api_keys/${id}:rotate`, { body, ...options });
93
102
  }
94
103
  }
@@ -170,14 +179,19 @@ export interface APIKeySpec {
170
179
 
171
180
  export interface APIKeyCreateParams {
172
181
  /**
173
- * CreateAccountResourceMetadata contains the user-provided fields for creating an
174
- * account-scoped resource. Read-only fields (id, account_id, profile_id) are
175
- * excluded since they are set by the server.
182
+ * Path param: The workspace this API key belongs to (path).
183
+ */
184
+ workspaceId?: string;
185
+
186
+ /**
187
+ * Body param: CreateAccountResourceMetadata contains the user-provided fields for
188
+ * creating an account-scoped resource. Read-only fields (id, account_id,
189
+ * profile_id) are excluded since they are set by the server.
176
190
  */
177
191
  metadata: APIKeyCreateParams.Metadata;
178
192
 
179
193
  /**
180
- * Configuration for an API key.
194
+ * Body param: Configuration for an API key.
181
195
  */
182
196
  spec: APIKeySpec;
183
197
  }
@@ -215,14 +229,14 @@ export interface APIKeyRetrieveParams {
215
229
  /**
216
230
  * The workspace the API key belongs to (path).
217
231
  */
218
- workspaceId: string;
232
+ workspaceId?: string;
219
233
  }
220
234
 
221
235
  export interface APIKeyUpdateParams {
222
236
  /**
223
237
  * Path param: The workspace the API key belongs to (path).
224
238
  */
225
- workspaceId: string;
239
+ workspaceId?: string;
226
240
 
227
241
  /**
228
242
  * Body param: UpdateAccountResourceMetadata contains the user-provided fields for
@@ -273,30 +287,35 @@ export namespace APIKeyUpdateParams {
273
287
 
274
288
  export interface APIKeyListParams extends CursorPaginationParams {
275
289
  /**
276
- * When true, included info fields are populated. Requests with this flag count
277
- * more against your rate limit.
290
+ * Path param: The workspace whose API keys will be listed (path).
291
+ */
292
+ workspaceId?: string;
293
+
294
+ /**
295
+ * Query param: When true, included info fields are populated. Requests with this
296
+ * flag count more against your rate limit.
278
297
  */
279
298
  includeInfo?: boolean;
280
299
 
281
300
  /**
282
- * Filters by metadata labels. Comma-separated key=value pairs, e.g.
301
+ * Query param: Filters by metadata labels. Comma-separated key=value pairs, e.g.
283
302
  * "env=prod,team=ai". A resource matches only if every pair matches exactly (AND
284
303
  * semantics).
285
304
  */
286
305
  labels?: string;
287
306
 
288
307
  /**
289
- * Filter by ID prefix.
308
+ * Query param: Filter by ID prefix.
290
309
  */
291
310
  prefix?: string;
292
311
 
293
312
  /**
294
- * Free-form search query.
313
+ * Query param: Free-form search query.
295
314
  */
296
315
  query?: string;
297
316
 
298
317
  /**
299
- * Sort order for results (asc or desc by creation time).
318
+ * Query param: Sort order for results (asc or desc by creation time).
300
319
  */
301
320
  sortOrder?: string;
302
321
  }
@@ -305,28 +324,28 @@ export interface APIKeyDeleteParams {
305
324
  /**
306
325
  * The workspace the API key belongs to (path).
307
326
  */
308
- workspaceId: string;
327
+ workspaceId?: string;
309
328
  }
310
329
 
311
330
  export interface APIKeyDisableParams {
312
331
  /**
313
332
  * The workspace the API key belongs to (path).
314
333
  */
315
- workspaceId: string;
334
+ workspaceId?: string;
316
335
  }
317
336
 
318
337
  export interface APIKeyEnableParams {
319
338
  /**
320
339
  * The workspace the API key belongs to (path).
321
340
  */
322
- workspaceId: string;
341
+ workspaceId?: string;
323
342
  }
324
343
 
325
344
  export interface APIKeyRotateParams {
326
345
  /**
327
346
  * The workspace the API key belongs to (path).
328
347
  */
329
- workspaceId: string;
348
+ workspaceId?: string;
330
349
  }
331
350
 
332
351
  export declare namespace APIKeys {