@cadenya/cadenya 0.81.0 → 0.84.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 (103) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +8 -17
  3. package/client.d.mts +9 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +9 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js +3 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +3 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/account.d.mts +3 -1
  13. package/resources/account.d.mts.map +1 -1
  14. package/resources/account.d.ts +3 -1
  15. package/resources/account.d.ts.map +1 -1
  16. package/resources/account.js.map +1 -1
  17. package/resources/account.mjs.map +1 -1
  18. package/resources/ai-provider-keys.d.mts +142 -0
  19. package/resources/ai-provider-keys.d.mts.map +1 -0
  20. package/resources/ai-provider-keys.d.ts +142 -0
  21. package/resources/ai-provider-keys.d.ts.map +1 -0
  22. package/resources/ai-provider-keys.js +51 -0
  23. package/resources/ai-provider-keys.js.map +1 -0
  24. package/resources/ai-provider-keys.mjs +47 -0
  25. package/resources/ai-provider-keys.mjs.map +1 -0
  26. package/resources/index.d.mts +5 -4
  27. package/resources/index.d.mts.map +1 -1
  28. package/resources/index.d.ts +5 -4
  29. package/resources/index.d.ts.map +1 -1
  30. package/resources/index.js +3 -1
  31. package/resources/index.js.map +1 -1
  32. package/resources/index.mjs +1 -0
  33. package/resources/index.mjs.map +1 -1
  34. package/resources/models.d.mts +63 -1
  35. package/resources/models.d.mts.map +1 -1
  36. package/resources/models.d.ts +63 -1
  37. package/resources/models.d.ts.map +1 -1
  38. package/resources/models.js +10 -0
  39. package/resources/models.js.map +1 -1
  40. package/resources/models.mjs +10 -0
  41. package/resources/models.mjs.map +1 -1
  42. package/resources/objectives/index.d.mts +1 -1
  43. package/resources/objectives/index.d.mts.map +1 -1
  44. package/resources/objectives/index.d.ts +1 -1
  45. package/resources/objectives/index.d.ts.map +1 -1
  46. package/resources/objectives/index.js.map +1 -1
  47. package/resources/objectives/index.mjs.map +1 -1
  48. package/resources/objectives/objectives.d.mts +149 -98
  49. package/resources/objectives/objectives.d.mts.map +1 -1
  50. package/resources/objectives/objectives.d.ts +149 -98
  51. package/resources/objectives/objectives.d.ts.map +1 -1
  52. package/resources/objectives/objectives.js +3 -3
  53. package/resources/objectives/objectives.js.map +1 -1
  54. package/resources/objectives/objectives.mjs +3 -3
  55. package/resources/objectives/objectives.mjs.map +1 -1
  56. package/resources/objectives/tool-calls.d.mts +1 -1
  57. package/resources/objectives/tool-calls.d.mts.map +1 -1
  58. package/resources/objectives/tool-calls.d.ts +1 -1
  59. package/resources/objectives/tool-calls.d.ts.map +1 -1
  60. package/resources/objectives/tool-calls.js +2 -2
  61. package/resources/objectives/tool-calls.js.map +1 -1
  62. package/resources/objectives/tool-calls.mjs +2 -2
  63. package/resources/objectives/tool-calls.mjs.map +1 -1
  64. package/resources/workspace-admin/index.d.mts +2 -1
  65. package/resources/workspace-admin/index.d.mts.map +1 -1
  66. package/resources/workspace-admin/index.d.ts +2 -1
  67. package/resources/workspace-admin/index.d.ts.map +1 -1
  68. package/resources/workspace-admin/index.js +3 -1
  69. package/resources/workspace-admin/index.js.map +1 -1
  70. package/resources/workspace-admin/index.mjs +1 -0
  71. package/resources/workspace-admin/index.mjs.map +1 -1
  72. package/resources/workspace-admin/profiles.d.mts +32 -0
  73. package/resources/workspace-admin/profiles.d.mts.map +1 -0
  74. package/resources/workspace-admin/profiles.d.ts +32 -0
  75. package/resources/workspace-admin/profiles.d.ts.map +1 -0
  76. package/resources/workspace-admin/profiles.js +28 -0
  77. package/resources/workspace-admin/profiles.js.map +1 -0
  78. package/resources/workspace-admin/profiles.mjs +24 -0
  79. package/resources/workspace-admin/profiles.mjs.map +1 -0
  80. package/resources/workspace-admin/workspace-admin.d.mts +47 -1
  81. package/resources/workspace-admin/workspace-admin.d.mts.map +1 -1
  82. package/resources/workspace-admin/workspace-admin.d.ts +47 -1
  83. package/resources/workspace-admin/workspace-admin.d.ts.map +1 -1
  84. package/resources/workspace-admin/workspace-admin.js +10 -0
  85. package/resources/workspace-admin/workspace-admin.js.map +1 -1
  86. package/resources/workspace-admin/workspace-admin.mjs +10 -0
  87. package/resources/workspace-admin/workspace-admin.mjs.map +1 -1
  88. package/src/client.ts +35 -6
  89. package/src/resources/account.ts +4 -1
  90. package/src/resources/ai-provider-keys.ts +216 -0
  91. package/src/resources/index.ts +17 -3
  92. package/src/resources/models.ts +80 -0
  93. package/src/resources/objectives/index.ts +2 -3
  94. package/src/resources/objectives/objectives.ts +171 -120
  95. package/src/resources/objectives/tool-calls.ts +11 -11
  96. package/src/resources/workspace-admin/index.ts +2 -0
  97. package/src/resources/workspace-admin/profiles.ts +45 -0
  98. package/src/resources/workspace-admin/workspace-admin.ts +60 -0
  99. package/src/version.ts +1 -1
  100. package/version.d.mts +1 -1
  101. package/version.d.ts +1 -1
  102. package/version.js +1 -1
  103. package/version.mjs +1 -1
@@ -0,0 +1,216 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as Shared from './shared';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { CursorPagination, type CursorPaginationParams, PagePromise } from '../core/pagination';
7
+ import { buildHeaders } from '../internal/headers';
8
+ import { RequestOptions } from '../internal/request-options';
9
+ import { path } from '../internal/utils/path';
10
+
11
+ export class AIProviderKeys extends APIResource {
12
+ /**
13
+ * Creates a new customer-provided AI provider key in the workspace
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 });
21
+ }
22
+
23
+ /**
24
+ * Retrieves an AI provider key by ID from the workspace
25
+ */
26
+ retrieve(
27
+ id: string,
28
+ params: AIProviderKeyRetrieveParams,
29
+ options?: RequestOptions,
30
+ ): APIPromise<AIProviderKey> {
31
+ const { workspaceId } = params;
32
+ return this._client.get(path`/v1/workspaces/${workspaceId}/ai_provider_keys/${id}`, options);
33
+ }
34
+
35
+ /**
36
+ * Updates an AI provider key's name or key value in the workspace
37
+ */
38
+ update(id: string, params: AIProviderKeyUpdateParams, options?: RequestOptions): APIPromise<AIProviderKey> {
39
+ const { workspaceId, ...body } = params;
40
+ return this._client.patch(path`/v1/workspaces/${workspaceId}/ai_provider_keys/${id}`, {
41
+ body,
42
+ ...options,
43
+ });
44
+ }
45
+
46
+ /**
47
+ * Lists all customer-provided AI provider keys in the workspace
48
+ */
49
+ list(
50
+ workspaceID: string,
51
+ query: AIProviderKeyListParams | null | undefined = {},
52
+ options?: RequestOptions,
53
+ ): PagePromise<AIProviderKeysCursorPagination, AIProviderKey> {
54
+ return this._client.getAPIList(
55
+ path`/v1/workspaces/${workspaceID}/ai_provider_keys`,
56
+ CursorPagination<AIProviderKey>,
57
+ { query, ...options },
58
+ );
59
+ }
60
+
61
+ /**
62
+ * Deletes an AI provider key from the workspace
63
+ */
64
+ delete(id: string, params: AIProviderKeyDeleteParams, options?: RequestOptions): APIPromise<void> {
65
+ const { workspaceId } = params;
66
+ return this._client.delete(path`/v1/workspaces/${workspaceId}/ai_provider_keys/${id}`, {
67
+ ...options,
68
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
69
+ });
70
+ }
71
+ }
72
+
73
+ export type AIProviderKeysCursorPagination = CursorPagination<AIProviderKey>;
74
+
75
+ /**
76
+ * AIProviderKey is a customer-provided (BYOK) credential for an AI provider,
77
+ * scoped to a workspace. The secret value is never returned in responses.
78
+ */
79
+ export interface AIProviderKey {
80
+ /**
81
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
82
+ */
83
+ metadata: Shared.ResourceMetadata;
84
+
85
+ spec: AIProviderKeySpec;
86
+
87
+ /**
88
+ * AIProviderKeyInfo carries server-derived, read-only details about a key, for AI
89
+ * provider management UIs.
90
+ */
91
+ info?: AIProviderKey.Info;
92
+ }
93
+
94
+ export namespace AIProviderKey {
95
+ /**
96
+ * AIProviderKeyInfo carries server-derived, read-only details about a key, for AI
97
+ * provider management UIs.
98
+ */
99
+ export interface Info {
100
+ /**
101
+ * Number of disabled models provisioned on this key.
102
+ */
103
+ disabledModelCount?: number;
104
+
105
+ /**
106
+ * Number of enabled models provisioned on this key.
107
+ */
108
+ enabledModelCount?: number;
109
+ }
110
+ }
111
+
112
+ export interface AIProviderKeySpec {
113
+ /**
114
+ * The provider credential. Accepted on create/update; never populated in responses
115
+ * (the server returns an empty value to avoid leaking it).
116
+ */
117
+ apiKey?: string;
118
+
119
+ /**
120
+ * OpenRouterConfig holds OpenRouter-specific settings. Empty for now; it exists as
121
+ * the oneof seam so provider-specific options (region, base URL, etc.) can be
122
+ * added later without restructuring the spec.
123
+ */
124
+ openrouter?: unknown;
125
+
126
+ /**
127
+ * The AI provider this key authenticates against.
128
+ */
129
+ provider?: 'AI_PROVIDER_UNSPECIFIED' | 'AI_PROVIDER_OPENROUTER';
130
+ }
131
+
132
+ export interface AIProviderKeyCreateParams {
133
+ /**
134
+ * CreateResourceMetadata contains the user-provided fields for creating a
135
+ * workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
136
+ * profile_id, created_at) are excluded since they are set by the server.
137
+ */
138
+ metadata: Shared.CreateResourceMetadata;
139
+
140
+ spec: AIProviderKeySpec;
141
+ }
142
+
143
+ export interface AIProviderKeyRetrieveParams {
144
+ /**
145
+ * The workspace the key belongs to.
146
+ */
147
+ workspaceId: string;
148
+ }
149
+
150
+ export interface AIProviderKeyUpdateParams {
151
+ /**
152
+ * Path param: The workspace the key belongs to.
153
+ */
154
+ workspaceId: string;
155
+
156
+ /**
157
+ * Body param: UpdateResourceMetadata contains the user-provided fields for
158
+ * updating a workspace-scoped resource. Read-only fields (id, account_id,
159
+ * workspace_id, profile_id, created_at) are excluded since they are set by the
160
+ * server.
161
+ */
162
+ metadata?: Shared.UpdateResourceMetadata;
163
+
164
+ /**
165
+ * Body param
166
+ */
167
+ spec?: AIProviderKeySpec;
168
+
169
+ /**
170
+ * Body param: Fields to update.
171
+ */
172
+ updateMask?: string;
173
+ }
174
+
175
+ export interface AIProviderKeyListParams extends CursorPaginationParams {
176
+ /**
177
+ * When true, populate each item's info (model counts), at the cost of extra
178
+ * lookups.
179
+ */
180
+ includeInfo?: boolean;
181
+
182
+ /**
183
+ * Filter expression (query param: prefix)
184
+ */
185
+ prefix?: string;
186
+
187
+ /**
188
+ * Free-form search query
189
+ */
190
+ query?: string;
191
+
192
+ /**
193
+ * Sort order for results (asc or desc by creation time)
194
+ */
195
+ sortOrder?: string;
196
+ }
197
+
198
+ export interface AIProviderKeyDeleteParams {
199
+ /**
200
+ * The workspace the key belongs to.
201
+ */
202
+ workspaceId: string;
203
+ }
204
+
205
+ export declare namespace AIProviderKeys {
206
+ export {
207
+ type AIProviderKey as AIProviderKey,
208
+ type AIProviderKeySpec as AIProviderKeySpec,
209
+ type AIProviderKeysCursorPagination as AIProviderKeysCursorPagination,
210
+ type AIProviderKeyCreateParams as AIProviderKeyCreateParams,
211
+ type AIProviderKeyRetrieveParams as AIProviderKeyRetrieveParams,
212
+ type AIProviderKeyUpdateParams as AIProviderKeyUpdateParams,
213
+ type AIProviderKeyListParams as AIProviderKeyListParams,
214
+ type AIProviderKeyDeleteParams as AIProviderKeyDeleteParams,
215
+ };
216
+ }
@@ -1,6 +1,17 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  export * from './shared';
4
+ export {
5
+ AIProviderKeys,
6
+ type AIProviderKey,
7
+ type AIProviderKeySpec,
8
+ type AIProviderKeyCreateParams,
9
+ type AIProviderKeyRetrieveParams,
10
+ type AIProviderKeyUpdateParams,
11
+ type AIProviderKeyListParams,
12
+ type AIProviderKeyDeleteParams,
13
+ type AIProviderKeysCursorPagination,
14
+ } from './ai-provider-keys';
4
15
  export {
5
16
  APIKeys,
6
17
  type APIKey,
@@ -19,6 +30,7 @@ export {
19
30
  type Profile,
20
31
  type ProfileSpec,
21
32
  type RotateWebhookSigningKeyResponse,
33
+ type ProfilesCursorPagination,
22
34
  } from './account';
23
35
  export {
24
36
  Agents,
@@ -69,9 +81,11 @@ export {
69
81
  Models,
70
82
  type Model,
71
83
  type ModelSpec,
84
+ type ModelSwapResponse,
72
85
  type ModelRetrieveParams,
73
86
  type ModelListParams,
74
87
  type ModelSetStatusParams,
88
+ type ModelSwapParams,
75
89
  type ModelsCursorPagination,
76
90
  } from './models';
77
91
  export {
@@ -83,16 +97,15 @@ export {
83
97
  type MemoryRead,
84
98
  type MemoryReference,
85
99
  type Objective,
100
+ type ObjectiveConfigSnapshot,
86
101
  type ObjectiveContextWindow,
87
102
  type ObjectiveContextWindowData,
88
- type ObjectiveData,
89
- type ObjectiveDataSecret,
90
103
  type ObjectiveError,
91
104
  type ObjectiveEventData,
92
105
  type ObjectiveEventInfo,
93
106
  type ObjectiveEventWebhookData,
94
107
  type ObjectiveInfo,
95
- type ObjectiveStatus,
108
+ type ObjectiveSecret,
96
109
  type SubAgentSpawned,
97
110
  type SubAgentUpdated,
98
111
  type ToolApprovalRequested,
@@ -164,6 +177,7 @@ export {
164
177
  WorkspaceAdmin,
165
178
  type WorkspaceMember,
166
179
  type WorkspaceAdminCreateParams,
180
+ type WorkspaceAdminUpdateParams,
167
181
  type WorkspaceAdminListParams,
168
182
  type WorkspaceMembersCursorPagination,
169
183
  } from './workspace-admin/workspace-admin';
@@ -42,6 +42,17 @@ export class Models extends APIResource {
42
42
  const { workspaceId, ...body } = params;
43
43
  return this._client.put(path`/v1/workspaces/${workspaceId}/models/${id}/status`, { body, ...options });
44
44
  }
45
+
46
+ /**
47
+ * Reassigns agent variations from one model to another in bulk. Runs
48
+ * asynchronously and returns immediately.
49
+ */
50
+ swap(workspaceID: string, body: ModelSwapParams, options?: RequestOptions): APIPromise<unknown> {
51
+ return this._client.post(path`/v1/workspaces/${workspaceID}/models:swapModelOnVariations`, {
52
+ body,
53
+ ...options,
54
+ });
55
+ }
45
56
  }
46
57
 
47
58
  export type ModelsCursorPagination = CursorPagination<Model>;
@@ -56,6 +67,34 @@ export interface Model {
56
67
  * Model specification
57
68
  */
58
69
  spec: ModelSpec;
70
+
71
+ /**
72
+ * ModelInfo carries server-derived, read-only details about a model.
73
+ */
74
+ info?: Model.Info;
75
+ }
76
+
77
+ export namespace Model {
78
+ /**
79
+ * ModelInfo carries server-derived, read-only details about a model.
80
+ */
81
+ export interface Info {
82
+ /**
83
+ * Number of agent variations currently provisioned on this model. Useful for
84
+ * previewing how many variations a swap would affect.
85
+ */
86
+ agentVariationCount?: number;
87
+
88
+ /**
89
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
90
+ */
91
+ aiProviderKey?: Shared.ResourceMetadata;
92
+
93
+ /**
94
+ * The AI provider this model routes through (via its provider key).
95
+ */
96
+ provider?: 'AI_PROVIDER_UNSPECIFIED' | 'AI_PROVIDER_OPENROUTER';
97
+ }
59
98
  }
60
99
 
61
100
  export interface ModelSpec {
@@ -95,6 +134,12 @@ export interface ModelSpec {
95
134
  status?: 'MODEL_STATUS_UNSPECIFIED' | 'MODEL_STATUS_ENABLED' | 'MODEL_STATUS_DISABLED';
96
135
  }
97
136
 
137
+ /**
138
+ * Swap model on variations response. Empty: the work runs asynchronously, so no
139
+ * counts are returned (a large data set would make the call slow).
140
+ */
141
+ export type ModelSwapResponse = unknown;
142
+
98
143
  export interface ModelRetrieveParams {
99
144
  /**
100
145
  * Workspace ID.
@@ -103,11 +148,23 @@ export interface ModelRetrieveParams {
103
148
  }
104
149
 
105
150
  export interface ModelListParams extends CursorPaginationParams {
151
+ /**
152
+ * Filter to models provisioned on a specific AI provider key. Accepts the key's id
153
+ * or an "external_id:"-prefixed slug.
154
+ */
155
+ aiProviderKeyId?: string;
156
+
106
157
  /**
107
158
  * Filter by bundle_key — return only resources owned by this bundle.
108
159
  */
109
160
  bundleKey?: string;
110
161
 
162
+ /**
163
+ * When true, populate each item's info (e.g. the AI provider), at the cost of
164
+ * extra lookups.
165
+ */
166
+ includeInfo?: boolean;
167
+
111
168
  /**
112
169
  * Filter by name prefix
113
170
  */
@@ -141,13 +198,36 @@ export interface ModelSetStatusParams {
141
198
  status?: 'MODEL_STATUS_UNSPECIFIED' | 'MODEL_STATUS_ENABLED' | 'MODEL_STATUS_DISABLED';
142
199
  }
143
200
 
201
+ export interface ModelSwapParams {
202
+ /**
203
+ * The swaps to perform.
204
+ */
205
+ modelSwaps?: Array<ModelSwapParams.ModelSwap>;
206
+ }
207
+
208
+ export namespace ModelSwapParams {
209
+ export interface ModelSwap {
210
+ /**
211
+ * The model variations are currently on. Accepts an id or "external_id:" slug.
212
+ */
213
+ currentModelId?: string;
214
+
215
+ /**
216
+ * The model to move variations to. Accepts an id or "external_id:" slug.
217
+ */
218
+ nextModelId?: string;
219
+ }
220
+ }
221
+
144
222
  export declare namespace Models {
145
223
  export {
146
224
  type Model as Model,
147
225
  type ModelSpec as ModelSpec,
226
+ type ModelSwapResponse as ModelSwapResponse,
148
227
  type ModelsCursorPagination as ModelsCursorPagination,
149
228
  type ModelRetrieveParams as ModelRetrieveParams,
150
229
  type ModelListParams as ModelListParams,
151
230
  type ModelSetStatusParams as ModelSetStatusParams,
231
+ type ModelSwapParams as ModelSwapParams,
152
232
  };
153
233
  }
@@ -18,16 +18,15 @@ export {
18
18
  type MemoryRead,
19
19
  type MemoryReference,
20
20
  type Objective,
21
+ type ObjectiveConfigSnapshot,
21
22
  type ObjectiveContextWindow,
22
23
  type ObjectiveContextWindowData,
23
- type ObjectiveData,
24
- type ObjectiveDataSecret,
25
24
  type ObjectiveError,
26
25
  type ObjectiveEventData,
27
26
  type ObjectiveEventInfo,
28
27
  type ObjectiveEventWebhookData,
29
28
  type ObjectiveInfo,
30
- type ObjectiveStatus,
29
+ type ObjectiveSecret,
31
30
  type SubAgentSpawned,
32
31
  type SubAgentUpdated,
33
32
  type ToolApprovalRequested,