@cadenya/cadenya 0.62.0 → 0.63.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 (66) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +13 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +13 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +13 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +13 -0
  9. package/client.mjs.map +1 -1
  10. package/internal/types.d.mts +6 -6
  11. package/internal/types.d.mts.map +1 -1
  12. package/internal/types.d.ts +6 -6
  13. package/internal/types.d.ts.map +1 -1
  14. package/package.json +1 -1
  15. package/resources/bulk-workspace-resources/bulk-workspace-resources.d.mts +288 -0
  16. package/resources/bulk-workspace-resources/bulk-workspace-resources.d.mts.map +1 -0
  17. package/resources/bulk-workspace-resources/bulk-workspace-resources.d.ts +288 -0
  18. package/resources/bulk-workspace-resources/bulk-workspace-resources.d.ts.map +1 -0
  19. package/resources/bulk-workspace-resources/bulk-workspace-resources.js +51 -0
  20. package/resources/bulk-workspace-resources/bulk-workspace-resources.js.map +1 -0
  21. package/resources/bulk-workspace-resources/bulk-workspace-resources.mjs +46 -0
  22. package/resources/bulk-workspace-resources/bulk-workspace-resources.mjs.map +1 -0
  23. package/resources/bulk-workspace-resources/index.d.mts +3 -0
  24. package/resources/bulk-workspace-resources/index.d.mts.map +1 -0
  25. package/resources/bulk-workspace-resources/index.d.ts +3 -0
  26. package/resources/bulk-workspace-resources/index.d.ts.map +1 -0
  27. package/resources/bulk-workspace-resources/index.js +9 -0
  28. package/resources/bulk-workspace-resources/index.js.map +1 -0
  29. package/resources/bulk-workspace-resources/index.mjs +4 -0
  30. package/resources/bulk-workspace-resources/index.mjs.map +1 -0
  31. package/resources/bulk-workspace-resources/results.d.mts +638 -0
  32. package/resources/bulk-workspace-resources/results.d.mts.map +1 -0
  33. package/resources/bulk-workspace-resources/results.d.ts +638 -0
  34. package/resources/bulk-workspace-resources/results.d.ts.map +1 -0
  35. package/resources/bulk-workspace-resources/results.js +27 -0
  36. package/resources/bulk-workspace-resources/results.js.map +1 -0
  37. package/resources/bulk-workspace-resources/results.mjs +23 -0
  38. package/resources/bulk-workspace-resources/results.mjs.map +1 -0
  39. package/resources/bulk-workspace-resources.d.mts +2 -0
  40. package/resources/bulk-workspace-resources.d.mts.map +1 -0
  41. package/resources/bulk-workspace-resources.d.ts +2 -0
  42. package/resources/bulk-workspace-resources.d.ts.map +1 -0
  43. package/resources/bulk-workspace-resources.js +6 -0
  44. package/resources/bulk-workspace-resources.js.map +1 -0
  45. package/resources/bulk-workspace-resources.mjs +3 -0
  46. package/resources/bulk-workspace-resources.mjs.map +1 -0
  47. package/resources/index.d.mts +1 -0
  48. package/resources/index.d.mts.map +1 -1
  49. package/resources/index.d.ts +1 -0
  50. package/resources/index.d.ts.map +1 -1
  51. package/resources/index.js +3 -1
  52. package/resources/index.js.map +1 -1
  53. package/resources/index.mjs +1 -0
  54. package/resources/index.mjs.map +1 -1
  55. package/src/client.ts +51 -0
  56. package/src/internal/types.ts +6 -8
  57. package/src/resources/bulk-workspace-resources/bulk-workspace-resources.ts +409 -0
  58. package/src/resources/bulk-workspace-resources/index.ts +37 -0
  59. package/src/resources/bulk-workspace-resources/results.ts +821 -0
  60. package/src/resources/bulk-workspace-resources.ts +3 -0
  61. package/src/resources/index.ts +19 -0
  62. package/src/version.ts +1 -1
  63. package/version.d.mts +1 -1
  64. package/version.d.ts +1 -1
  65. package/version.js +1 -1
  66. package/version.mjs +1 -1
@@ -0,0 +1,409 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as AccountAPI from '../account';
5
+ import * as Shared from '../shared';
6
+ import * as AgentsAPI from '../agents/agents';
7
+ import * as SchedulesAPI from '../agents/schedules';
8
+ import * as VariationsAPI from '../agents/variations';
9
+ import * as ResultsAPI from './results';
10
+ import {
11
+ BulkWorkspaceApplyResult,
12
+ BulkWorkspaceApplyResultData,
13
+ BulkWorkspaceApplyResultDataAgentOutcome,
14
+ BulkWorkspaceApplyResultDataAgentScheduleOutcome,
15
+ BulkWorkspaceApplyResultDataAgentVariationOutcome,
16
+ BulkWorkspaceApplyResultDataMemoryEntryOutcome,
17
+ BulkWorkspaceApplyResultDataMemoryLayerOutcome,
18
+ BulkWorkspaceApplyResultDataToolOutcome,
19
+ BulkWorkspaceApplyResultDataToolSetOutcome,
20
+ BulkWorkspaceApplyResultDataVariationAssignmentOutcome,
21
+ BulkWorkspaceApplyResultDataVariationMemoryLayerOutcome,
22
+ BulkWorkspaceApplyResultsCursorPagination,
23
+ ResultListParams,
24
+ Results,
25
+ } from './results';
26
+ import * as MemoryLayersAPI from '../memory-layers/memory-layers';
27
+ import * as ToolSetsAPI from '../tool-sets/tool-sets';
28
+ import * as ToolsAPI from '../tool-sets/tools';
29
+ import { APIPromise } from '../../core/api-promise';
30
+ import { CursorPagination, type CursorPaginationParams, PagePromise } from '../../core/pagination';
31
+ import { RequestOptions } from '../../internal/request-options';
32
+ import { path } from '../../internal/utils/path';
33
+
34
+ /**
35
+ * BulkWorkspaceResources is the workspace-scoped service that applies
36
+ * a declarative bundle of workspace resources (tool sets, memory
37
+ * layers, agents, variations, assignments, schedules) in one async
38
+ * operation. See docs/superpowers/specs/2026-05-02-bulk-workspace-resources-design.md
39
+ * for the full design.
40
+ *
41
+ * Authentication: Bearer token (JWT)
42
+ * Scope: Workspace-level operations
43
+ */
44
+ export class BulkWorkspaceResources extends APIResource {
45
+ results: ResultsAPI.Results = new ResultsAPI.Results(this._client);
46
+
47
+ /**
48
+ * Retrieves a bulk workspace apply operation by ID.
49
+ */
50
+ retrieve(id: string, options?: RequestOptions): APIPromise<BulkWorkspaceApply> {
51
+ return this._client.get(path`/v1/bulk_workspace_applies/${id}`, options);
52
+ }
53
+
54
+ /**
55
+ * Lists past and in-flight bulk workspace apply operations in the workspace.
56
+ */
57
+ list(
58
+ query: BulkWorkspaceResourceListParams | null | undefined = {},
59
+ options?: RequestOptions,
60
+ ): PagePromise<BulkWorkspaceAppliesCursorPagination, BulkWorkspaceApply> {
61
+ return this._client.getAPIList('/v1/bulk_workspace_applies', CursorPagination<BulkWorkspaceApply>, {
62
+ query,
63
+ ...options,
64
+ });
65
+ }
66
+
67
+ /**
68
+ * Asynchronously applies a declarative bundle of workspace resources. Returns the
69
+ * operation immediately in PENDING; clients poll Get to track progress.
70
+ */
71
+ apply(body: BulkWorkspaceResourceApplyParams, options?: RequestOptions): APIPromise<BulkWorkspaceApply> {
72
+ return this._client.post('/v1/bulk_workspace_applies', { body, ...options });
73
+ }
74
+ }
75
+
76
+ export type BulkWorkspaceAppliesCursorPagination = CursorPagination<BulkWorkspaceApply>;
77
+
78
+ export interface AgentEntry {
79
+ name: string;
80
+
81
+ /**
82
+ * Agent specification (user-provided configuration)
83
+ */
84
+ spec: AgentsAPI.AgentSpec;
85
+
86
+ labels?: { [key: string]: string };
87
+
88
+ /**
89
+ * Schedules under this agent, keyed by external_id.
90
+ */
91
+ schedules?: { [key: string]: AgentScheduleEntry };
92
+
93
+ /**
94
+ * Variations under this agent, keyed by external_id.
95
+ */
96
+ variations?: { [key: string]: AgentVariationEntry };
97
+ }
98
+
99
+ export interface AgentScheduleEntry {
100
+ name: string;
101
+
102
+ /**
103
+ * AgentScheduleSpec is the user-provided configuration for a schedule.
104
+ */
105
+ spec: SchedulesAPI.AgentScheduleSpec;
106
+
107
+ labels?: { [key: string]: string };
108
+ }
109
+
110
+ export interface AgentVariationEntry {
111
+ name: string;
112
+
113
+ /**
114
+ * AgentVariationSpec defines the operational configuration for a variation
115
+ */
116
+ spec: VariationsAPI.AgentVariationSpec;
117
+
118
+ /**
119
+ * Reconciled list — server adjusts the variation's assignments to exactly this set
120
+ * when the variation is bundle-owned.
121
+ */
122
+ assignments?: Array<VariationAssignmentEntry>;
123
+
124
+ labels?: { [key: string]: string };
125
+
126
+ /**
127
+ * Reconciled list — capped at 10 to match the existing variation
128
+ * memory-layer-assignment cap.
129
+ */
130
+ memoryLayers?: Array<VariationMemoryLayerEntry>;
131
+ }
132
+
133
+ /**
134
+ * BulkWorkspaceApply is the operation resource produced by a call to
135
+ * BulkWorkspaceResources.Apply. It is operation-typed (uses OperationMetadata,
136
+ * like Objective and ObjectiveEvent) and carries the input bundle in `data`, the
137
+ * lifecycle state in `status`, and aggregate counts in `info`.
138
+ */
139
+ export interface BulkWorkspaceApply {
140
+ data: BulkWorkspaceApplyData;
141
+
142
+ /**
143
+ * Metadata for ephemeral operations and activities (e.g., objectives, executions,
144
+ * runs)
145
+ */
146
+ metadata: Shared.OperationMetadata;
147
+
148
+ status: BulkWorkspaceApplyStatus;
149
+
150
+ info?: BulkWorkspaceApplyInfo;
151
+ }
152
+
153
+ export interface BulkWorkspaceApplyData {
154
+ /**
155
+ * Required. Bundle ownership key. Resources created or updated by an Apply with
156
+ * this key are tagged with the reserved label
157
+ * `bulk.cadenya.com/managed-by=<managed_by_key>`; on subsequent applies with the
158
+ * same key, resources currently bearing the label but absent from the spec are
159
+ * soft-deleted.
160
+ */
161
+ managedByKey: string;
162
+
163
+ /**
164
+ * Agents to upsert, keyed by external_id.
165
+ */
166
+ agents?: { [key: string]: AgentEntry };
167
+
168
+ /**
169
+ * Memory layers to upsert, keyed by external_id.
170
+ */
171
+ memoryLayers?: { [key: string]: MemoryLayerEntry };
172
+
173
+ /**
174
+ * Optional URL pointing to the source of this apply (GitHub PR, Jenkins build,
175
+ * GitLab pipeline, etc.). Surfaced in the dashboard so users can jump from an
176
+ * apply back to the change that produced it. Free-form HTTPS URI; not interpreted
177
+ * by the server.
178
+ */
179
+ sourceUrl?: string;
180
+
181
+ /**
182
+ * Tool sets to upsert, keyed by external_id.
183
+ */
184
+ toolSets?: { [key: string]: ToolSetEntry };
185
+ }
186
+
187
+ export interface BulkWorkspaceApplyInfo {
188
+ completedAt?: string;
189
+
190
+ /**
191
+ * Profile represents a human user at the account level. Profiles are
192
+ * account-scoped resources that can be associated with multiple workspaces through
193
+ * the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS).
194
+ */
195
+ createdBy?: AccountAPI.Profile;
196
+
197
+ createdCount?: number;
198
+
199
+ deletedCount?: number;
200
+
201
+ failedCount?: number;
202
+
203
+ startedAt?: string;
204
+
205
+ totalCount?: number;
206
+
207
+ unchangedCount?: number;
208
+
209
+ updatedCount?: number;
210
+ }
211
+
212
+ export interface BulkWorkspaceApplyStatus {
213
+ state:
214
+ | 'STATE_UNSPECIFIED'
215
+ | 'STATE_PENDING'
216
+ | 'STATE_VALIDATING'
217
+ | 'STATE_RUNNING'
218
+ | 'STATE_SUCCEEDED'
219
+ | 'STATE_PARTIALLY_APPLIED'
220
+ | 'STATE_FAILED';
221
+
222
+ message?: string;
223
+
224
+ /**
225
+ * The `Status` type defines a logical error model that is suitable for different
226
+ * programming environments, including REST APIs and RPC APIs. It is used by
227
+ * [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of
228
+ * data: error code, error message, and error details. You can find out more about
229
+ * this error model and how to work with it in the
230
+ * [API Design Guide](https://cloud.google.com/apis/design/errors).
231
+ */
232
+ preflightError?: BulkWorkspaceApplyStatus.PreflightError;
233
+ }
234
+
235
+ export namespace BulkWorkspaceApplyStatus {
236
+ /**
237
+ * The `Status` type defines a logical error model that is suitable for different
238
+ * programming environments, including REST APIs and RPC APIs. It is used by
239
+ * [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of
240
+ * data: error code, error message, and error details. You can find out more about
241
+ * this error model and how to work with it in the
242
+ * [API Design Guide](https://cloud.google.com/apis/design/errors).
243
+ */
244
+ export interface PreflightError {
245
+ /**
246
+ * The status code, which should be an enum value of
247
+ * [google.rpc.Code][google.rpc.Code].
248
+ */
249
+ code?: number;
250
+
251
+ /**
252
+ * A list of messages that carry the error details. There is a common set of
253
+ * message types for APIs to use.
254
+ */
255
+ details?: Array<PreflightError.Detail>;
256
+
257
+ /**
258
+ * A developer-facing error message, which should be in English. Any user-facing
259
+ * error message should be localized and sent in the
260
+ * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by
261
+ * the client.
262
+ */
263
+ message?: string;
264
+ }
265
+
266
+ export namespace PreflightError {
267
+ /**
268
+ * Contains an arbitrary serialized message along with a @type that describes the
269
+ * type of the serialized message.
270
+ */
271
+ export interface Detail {
272
+ /**
273
+ * The type of the serialized message.
274
+ */
275
+ '@type'?: string;
276
+
277
+ [k: string]: unknown;
278
+ }
279
+ }
280
+ }
281
+
282
+ export interface MemoryEntryItem {
283
+ key: string;
284
+
285
+ content?: string;
286
+
287
+ description?: string;
288
+
289
+ uploadId?: string;
290
+ }
291
+
292
+ export interface MemoryLayerEntry {
293
+ name: string;
294
+
295
+ spec: MemoryLayersAPI.MemoryLayerSpec;
296
+
297
+ /**
298
+ * Memory entries in this layer, keyed by external_id.
299
+ */
300
+ entries?: { [key: string]: MemoryEntryItem };
301
+
302
+ labels?: { [key: string]: string };
303
+ }
304
+
305
+ export interface ToolEntry {
306
+ name: string;
307
+
308
+ spec: ToolsAPI.ToolSpec;
309
+
310
+ labels?: { [key: string]: string };
311
+ }
312
+
313
+ export interface ToolSetEntry {
314
+ name: string;
315
+
316
+ spec: ToolSetsAPI.ToolSetSpec;
317
+
318
+ labels?: { [key: string]: string };
319
+
320
+ /**
321
+ * Tools in this tool set, keyed by external_id.
322
+ */
323
+ tools?: { [key: string]: ToolEntry };
324
+ }
325
+
326
+ export interface VariationAssignmentEntry {
327
+ subAgentId?: string;
328
+
329
+ toolId?: string;
330
+
331
+ toolSetId?: string;
332
+ }
333
+
334
+ export interface VariationMemoryLayerEntry {
335
+ /**
336
+ * external_id:<value> form. Canonical IDs are rejected.
337
+ */
338
+ memoryLayerId?: string;
339
+
340
+ position?: number;
341
+ }
342
+
343
+ export interface BulkWorkspaceResourceListParams extends CursorPaginationParams {
344
+ /**
345
+ * Filter by managed_by_key — list every apply for a given bundle.
346
+ */
347
+ managedByKey?: string;
348
+
349
+ /**
350
+ * Sort order for results (asc or desc by creation time)
351
+ */
352
+ sortOrder?: string;
353
+
354
+ /**
355
+ * Filter by lifecycle state.
356
+ */
357
+ state?:
358
+ | 'STATE_UNSPECIFIED'
359
+ | 'STATE_PENDING'
360
+ | 'STATE_VALIDATING'
361
+ | 'STATE_RUNNING'
362
+ | 'STATE_SUCCEEDED'
363
+ | 'STATE_PARTIALLY_APPLIED'
364
+ | 'STATE_FAILED';
365
+ }
366
+
367
+ export interface BulkWorkspaceResourceApplyParams {
368
+ data: BulkWorkspaceApplyData;
369
+ }
370
+
371
+ BulkWorkspaceResources.Results = Results;
372
+
373
+ export declare namespace BulkWorkspaceResources {
374
+ export {
375
+ type AgentEntry as AgentEntry,
376
+ type AgentScheduleEntry as AgentScheduleEntry,
377
+ type AgentVariationEntry as AgentVariationEntry,
378
+ type BulkWorkspaceApply as BulkWorkspaceApply,
379
+ type BulkWorkspaceApplyData as BulkWorkspaceApplyData,
380
+ type BulkWorkspaceApplyInfo as BulkWorkspaceApplyInfo,
381
+ type BulkWorkspaceApplyStatus as BulkWorkspaceApplyStatus,
382
+ type MemoryEntryItem as MemoryEntryItem,
383
+ type MemoryLayerEntry as MemoryLayerEntry,
384
+ type ToolEntry as ToolEntry,
385
+ type ToolSetEntry as ToolSetEntry,
386
+ type VariationAssignmentEntry as VariationAssignmentEntry,
387
+ type VariationMemoryLayerEntry as VariationMemoryLayerEntry,
388
+ type BulkWorkspaceAppliesCursorPagination as BulkWorkspaceAppliesCursorPagination,
389
+ type BulkWorkspaceResourceListParams as BulkWorkspaceResourceListParams,
390
+ type BulkWorkspaceResourceApplyParams as BulkWorkspaceResourceApplyParams,
391
+ };
392
+
393
+ export {
394
+ Results as Results,
395
+ type BulkWorkspaceApplyResult as BulkWorkspaceApplyResult,
396
+ type BulkWorkspaceApplyResultData as BulkWorkspaceApplyResultData,
397
+ type BulkWorkspaceApplyResultDataAgentOutcome as BulkWorkspaceApplyResultDataAgentOutcome,
398
+ type BulkWorkspaceApplyResultDataAgentScheduleOutcome as BulkWorkspaceApplyResultDataAgentScheduleOutcome,
399
+ type BulkWorkspaceApplyResultDataAgentVariationOutcome as BulkWorkspaceApplyResultDataAgentVariationOutcome,
400
+ type BulkWorkspaceApplyResultDataMemoryEntryOutcome as BulkWorkspaceApplyResultDataMemoryEntryOutcome,
401
+ type BulkWorkspaceApplyResultDataMemoryLayerOutcome as BulkWorkspaceApplyResultDataMemoryLayerOutcome,
402
+ type BulkWorkspaceApplyResultDataToolOutcome as BulkWorkspaceApplyResultDataToolOutcome,
403
+ type BulkWorkspaceApplyResultDataToolSetOutcome as BulkWorkspaceApplyResultDataToolSetOutcome,
404
+ type BulkWorkspaceApplyResultDataVariationAssignmentOutcome as BulkWorkspaceApplyResultDataVariationAssignmentOutcome,
405
+ type BulkWorkspaceApplyResultDataVariationMemoryLayerOutcome as BulkWorkspaceApplyResultDataVariationMemoryLayerOutcome,
406
+ type BulkWorkspaceApplyResultsCursorPagination as BulkWorkspaceApplyResultsCursorPagination,
407
+ type ResultListParams as ResultListParams,
408
+ };
409
+ }
@@ -0,0 +1,37 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ BulkWorkspaceResources,
5
+ type AgentEntry,
6
+ type AgentScheduleEntry,
7
+ type AgentVariationEntry,
8
+ type BulkWorkspaceApply,
9
+ type BulkWorkspaceApplyData,
10
+ type BulkWorkspaceApplyInfo,
11
+ type BulkWorkspaceApplyStatus,
12
+ type MemoryEntryItem,
13
+ type MemoryLayerEntry,
14
+ type ToolEntry,
15
+ type ToolSetEntry,
16
+ type VariationAssignmentEntry,
17
+ type VariationMemoryLayerEntry,
18
+ type BulkWorkspaceResourceListParams,
19
+ type BulkWorkspaceResourceApplyParams,
20
+ type BulkWorkspaceAppliesCursorPagination,
21
+ } from './bulk-workspace-resources';
22
+ export {
23
+ Results,
24
+ type BulkWorkspaceApplyResult,
25
+ type BulkWorkspaceApplyResultData,
26
+ type BulkWorkspaceApplyResultDataAgentOutcome,
27
+ type BulkWorkspaceApplyResultDataAgentScheduleOutcome,
28
+ type BulkWorkspaceApplyResultDataAgentVariationOutcome,
29
+ type BulkWorkspaceApplyResultDataMemoryEntryOutcome,
30
+ type BulkWorkspaceApplyResultDataMemoryLayerOutcome,
31
+ type BulkWorkspaceApplyResultDataToolOutcome,
32
+ type BulkWorkspaceApplyResultDataToolSetOutcome,
33
+ type BulkWorkspaceApplyResultDataVariationAssignmentOutcome,
34
+ type BulkWorkspaceApplyResultDataVariationMemoryLayerOutcome,
35
+ type ResultListParams,
36
+ type BulkWorkspaceApplyResultsCursorPagination,
37
+ } from './results';