@cadenya/cadenya 0.82.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 (95) hide show
  1. package/CHANGELOG.md +31 -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 +1 -1
  13. package/resources/account.d.mts.map +1 -1
  14. package/resources/account.d.ts +1 -1
  15. package/resources/account.d.ts.map +1 -1
  16. package/resources/ai-provider-keys.d.mts +142 -0
  17. package/resources/ai-provider-keys.d.mts.map +1 -0
  18. package/resources/ai-provider-keys.d.ts +142 -0
  19. package/resources/ai-provider-keys.d.ts.map +1 -0
  20. package/resources/ai-provider-keys.js +51 -0
  21. package/resources/ai-provider-keys.js.map +1 -0
  22. package/resources/ai-provider-keys.mjs +47 -0
  23. package/resources/ai-provider-keys.mjs.map +1 -0
  24. package/resources/index.d.mts +4 -3
  25. package/resources/index.d.mts.map +1 -1
  26. package/resources/index.d.ts +4 -3
  27. package/resources/index.d.ts.map +1 -1
  28. package/resources/index.js +3 -1
  29. package/resources/index.js.map +1 -1
  30. package/resources/index.mjs +1 -0
  31. package/resources/index.mjs.map +1 -1
  32. package/resources/models.d.mts +63 -1
  33. package/resources/models.d.mts.map +1 -1
  34. package/resources/models.d.ts +63 -1
  35. package/resources/models.d.ts.map +1 -1
  36. package/resources/models.js +10 -0
  37. package/resources/models.js.map +1 -1
  38. package/resources/models.mjs +10 -0
  39. package/resources/models.mjs.map +1 -1
  40. package/resources/objectives/index.d.mts +1 -1
  41. package/resources/objectives/index.d.mts.map +1 -1
  42. package/resources/objectives/index.d.ts +1 -1
  43. package/resources/objectives/index.d.ts.map +1 -1
  44. package/resources/objectives/index.js.map +1 -1
  45. package/resources/objectives/index.mjs.map +1 -1
  46. package/resources/objectives/objectives.d.mts +149 -98
  47. package/resources/objectives/objectives.d.mts.map +1 -1
  48. package/resources/objectives/objectives.d.ts +149 -98
  49. package/resources/objectives/objectives.d.ts.map +1 -1
  50. package/resources/objectives/objectives.js +3 -3
  51. package/resources/objectives/objectives.js.map +1 -1
  52. package/resources/objectives/objectives.mjs +3 -3
  53. package/resources/objectives/objectives.mjs.map +1 -1
  54. package/resources/objectives/tool-calls.d.mts +1 -1
  55. package/resources/objectives/tool-calls.d.mts.map +1 -1
  56. package/resources/objectives/tool-calls.d.ts +1 -1
  57. package/resources/objectives/tool-calls.d.ts.map +1 -1
  58. package/resources/objectives/tool-calls.js +2 -2
  59. package/resources/objectives/tool-calls.js.map +1 -1
  60. package/resources/objectives/tool-calls.mjs +2 -2
  61. package/resources/objectives/tool-calls.mjs.map +1 -1
  62. package/resources/workspace-admin/index.d.mts +1 -1
  63. package/resources/workspace-admin/index.d.mts.map +1 -1
  64. package/resources/workspace-admin/index.d.ts +1 -1
  65. package/resources/workspace-admin/index.d.ts.map +1 -1
  66. package/resources/workspace-admin/index.js.map +1 -1
  67. package/resources/workspace-admin/index.mjs.map +1 -1
  68. package/resources/workspace-admin/profiles.d.mts +1 -6
  69. package/resources/workspace-admin/profiles.d.mts.map +1 -1
  70. package/resources/workspace-admin/profiles.d.ts +1 -6
  71. package/resources/workspace-admin/profiles.d.ts.map +1 -1
  72. package/resources/workspace-admin/workspace-admin.d.mts +43 -1
  73. package/resources/workspace-admin/workspace-admin.d.mts.map +1 -1
  74. package/resources/workspace-admin/workspace-admin.d.ts +43 -1
  75. package/resources/workspace-admin/workspace-admin.d.ts.map +1 -1
  76. package/resources/workspace-admin/workspace-admin.js +6 -0
  77. package/resources/workspace-admin/workspace-admin.js.map +1 -1
  78. package/resources/workspace-admin/workspace-admin.mjs +6 -0
  79. package/resources/workspace-admin/workspace-admin.mjs.map +1 -1
  80. package/src/client.ts +35 -6
  81. package/src/resources/account.ts +1 -1
  82. package/src/resources/ai-provider-keys.ts +216 -0
  83. package/src/resources/index.ts +16 -3
  84. package/src/resources/models.ts +80 -0
  85. package/src/resources/objectives/index.ts +2 -3
  86. package/src/resources/objectives/objectives.ts +171 -120
  87. package/src/resources/objectives/tool-calls.ts +11 -11
  88. package/src/resources/workspace-admin/index.ts +1 -0
  89. package/src/resources/workspace-admin/profiles.ts +1 -7
  90. package/src/resources/workspace-admin/workspace-admin.ts +54 -0
  91. package/src/version.ts +1 -1
  92. package/version.d.mts +1 -1
  93. package/version.d.ts +1 -1
  94. package/version.js +1 -1
  95. package/version.mjs +1 -1
@@ -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,
@@ -70,9 +81,11 @@ export {
70
81
  Models,
71
82
  type Model,
72
83
  type ModelSpec,
84
+ type ModelSwapResponse,
73
85
  type ModelRetrieveParams,
74
86
  type ModelListParams,
75
87
  type ModelSetStatusParams,
88
+ type ModelSwapParams,
76
89
  type ModelsCursorPagination,
77
90
  } from './models';
78
91
  export {
@@ -84,16 +97,15 @@ export {
84
97
  type MemoryRead,
85
98
  type MemoryReference,
86
99
  type Objective,
100
+ type ObjectiveConfigSnapshot,
87
101
  type ObjectiveContextWindow,
88
102
  type ObjectiveContextWindowData,
89
- type ObjectiveData,
90
- type ObjectiveDataSecret,
91
103
  type ObjectiveError,
92
104
  type ObjectiveEventData,
93
105
  type ObjectiveEventInfo,
94
106
  type ObjectiveEventWebhookData,
95
107
  type ObjectiveInfo,
96
- type ObjectiveStatus,
108
+ type ObjectiveSecret,
97
109
  type SubAgentSpawned,
98
110
  type SubAgentUpdated,
99
111
  type ToolApprovalRequested,
@@ -165,6 +177,7 @@ export {
165
177
  WorkspaceAdmin,
166
178
  type WorkspaceMember,
167
179
  type WorkspaceAdminCreateParams,
180
+ type WorkspaceAdminUpdateParams,
168
181
  type WorkspaceAdminListParams,
169
182
  type WorkspaceMembersCursorPagination,
170
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,
@@ -5,6 +5,7 @@ import * as ObjectivesAPI from './objectives';
5
5
  import * as AccountAPI from '../account';
6
6
  import * as Shared from '../shared';
7
7
  import * as AgentsAPI from '../agents/agents';
8
+ import * as SchedulesAPI from '../agents/schedules';
8
9
  import * as VariationsAPI from '../agents/variations';
9
10
  import * as FeedbackAPI from './feedback';
10
11
  import {
@@ -89,7 +90,7 @@ export class Objectives extends APIResource {
89
90
  options?: RequestOptions,
90
91
  ): APIPromise<Objective> {
91
92
  const { workspaceId, ...body } = params;
92
- return this._client.post(path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}/cancel`, {
93
+ return this._client.post(path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}:cancel`, {
93
94
  body,
94
95
  ...options,
95
96
  });
@@ -105,7 +106,7 @@ export class Objectives extends APIResource {
105
106
  options?: RequestOptions,
106
107
  ): APIPromise<ObjectiveCompactResponse> {
107
108
  const { workspaceId, ...body } = params;
108
- return this._client.post(path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}/compact`, {
109
+ return this._client.post(path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}:compact`, {
109
110
  body,
110
111
  ...options,
111
112
  });
@@ -120,7 +121,7 @@ export class Objectives extends APIResource {
120
121
  options?: RequestOptions,
121
122
  ): APIPromise<ObjectiveContinueResponse> {
122
123
  const { workspaceId, ...body } = params;
123
- return this._client.post(path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}/continue`, {
124
+ return this._client.post(path`/v1/workspaces/${workspaceId}/objectives/${objectiveID}:continue`, {
124
125
  body,
125
126
  ...options,
126
127
  });
@@ -276,8 +277,23 @@ export interface MemoryReference {
276
277
  memoryLayerId?: string;
277
278
  }
278
279
 
280
+ /**
281
+ * Objective is the data for an objective. It contains the snapshotted fields for
282
+ * the selected agent and variation. Secrets are returned only with their names,
283
+ * and the output definition is copied from the agent's configuration.
284
+ */
279
285
  export interface Objective {
280
- data: ObjectiveData;
286
+ /**
287
+ * ObjectiveConfigSnapshot is the point-in-time snapshot of the agent, variation,
288
+ * and (when applicable) schedule that an objective was started with.
289
+ */
290
+ configSnapshot: ObjectiveConfigSnapshot;
291
+
292
+ /**
293
+ * The initial message sent to the agent. This becomes the first user message in
294
+ * the LLM chat history.
295
+ */
296
+ initialMessage: string;
281
297
 
282
298
  /**
283
299
  * Metadata for ephemeral operations and activities (e.g., objectives, executions,
@@ -285,7 +301,27 @@ export interface Objective {
285
301
  */
286
302
  metadata: Shared.OperationMetadata;
287
303
 
288
- status: ObjectiveStatus;
304
+ /**
305
+ * The current lifecycle state of the objective.
306
+ */
307
+ state:
308
+ | 'STATE_UNSPECIFIED'
309
+ | 'STATE_PENDING'
310
+ | 'STATE_RUNNING'
311
+ | 'STATE_WAITING'
312
+ | 'STATE_FAILED'
313
+ | 'STATE_CANCELLED'
314
+ | 'STATE_FINALIZED';
315
+
316
+ /**
317
+ * system_prompt is read-only, derived from the selected variation's prompt
318
+ */
319
+ systemPrompt: string;
320
+
321
+ /**
322
+ * Arbitrary data for the objective
323
+ */
324
+ data?: { [key: string]: unknown };
289
325
 
290
326
  /**
291
327
  * ObjectiveInfo provides read-only aggregated statistics about an objective's
@@ -294,11 +330,69 @@ export interface Objective {
294
330
  info?: ObjectiveInfo;
295
331
 
296
332
  /**
297
- * Read-only list of the last five windows of execution for this objective, ordered
298
- * by most recent first. Is only included in singular RPC calls (GetObjective, for
299
- * example).
333
+ * Memory layers/entries to push onto this objective's memory stack on top of the
334
+ * baseline stack inherited from the selected variation.
335
+ *
336
+ * Array order is push order: the first element sits lower in the objective's
337
+ * contribution to the stack; the LAST element ends up on top of the effective
338
+ * stack. Entries pinned via memory_entry_id behave as single-entry layers at their
339
+ * position.
340
+ *
341
+ * System-managed layers (e.g., episodic) cannot be referenced here; they attach
342
+ * themselves automatically based on episodic_key.
343
+ *
344
+ * Stack size cap: the TOTAL effective stack (variation's memory layers
345
+ *
346
+ * - this field) must not exceed 10 entries. A request that would produce an
347
+ * effective stack larger than 10 is rejected with InvalidArgument.
348
+ */
349
+ memoryStack?: Array<MemoryReference>;
350
+
351
+ /**
352
+ * The output of the objective, populated when the objective completes. Will match
353
+ * the schema of output_json_schema or output_json_inferred. This will only be set
354
+ * if the state of the objective is set to STATE_FINALIZED
355
+ */
356
+ output?: { [key: string]: unknown };
357
+
358
+ /**
359
+ * A parent objective means the objective was spawned off using a separate agent to
360
+ * complete an objective
361
+ */
362
+ parentObjectiveId?: string;
363
+
364
+ /**
365
+ * Secrets that can be used in the headers for tool calls using the secret
366
+ * interpolation format.
367
+ */
368
+ secrets?: Array<ObjectiveSecret>;
369
+
370
+ /**
371
+ * Optional human-readable detail about the current state (e.g. a failure reason).
372
+ */
373
+ stateMessage?: string;
374
+ }
375
+
376
+ /**
377
+ * ObjectiveConfigSnapshot is the point-in-time snapshot of the agent, variation,
378
+ * and (when applicable) schedule that an objective was started with.
379
+ */
380
+ export interface ObjectiveConfigSnapshot {
381
+ /**
382
+ * Agent resource
383
+ */
384
+ agent?: AgentsAPI.Agent;
385
+
386
+ /**
387
+ * AgentSchedule resource — a recurring trigger attached to an agent that creates
388
+ * objectives on its cadence.
389
+ */
390
+ agentSchedule?: SchedulesAPI.AgentSchedule;
391
+
392
+ /**
393
+ * AgentVariation resource
300
394
  */
301
- lastFiveWindows?: Array<ObjectiveContextWindow>;
395
+ agentVariation?: VariationsAPI.AgentVariation;
302
396
  }
303
397
 
304
398
  /**
@@ -367,91 +461,6 @@ export interface ObjectiveContextWindowData {
367
461
  sequence?: number;
368
462
  }
369
463
 
370
- export interface ObjectiveData {
371
- /**
372
- * Agent resource
373
- */
374
- agent?: AgentsAPI.Agent;
375
-
376
- /**
377
- * Represents a dynamically typed value which can be either null, a number, a
378
- * string, a boolean, a recursive struct value, or a list of values.
379
- */
380
- data?: unknown;
381
-
382
- /**
383
- * The initial message sent to the agent. This becomes the first user message in
384
- * the LLM chat history.
385
- */
386
- initialMessage?: string;
387
-
388
- /**
389
- * Memory layers/entries to push onto this objective's memory stack on top of the
390
- * baseline stack inherited from the selected variation.
391
- *
392
- * Array order is push order: the first element sits lower in the objective's
393
- * contribution to the stack; the LAST element ends up on top of the effective
394
- * stack. Entries pinned via memory_entry_id behave as single-entry layers at their
395
- * position.
396
- *
397
- * System-managed layers (e.g., episodic) cannot be referenced here; they attach
398
- * themselves automatically based on episodic_key.
399
- *
400
- * Stack size cap: the TOTAL effective stack (variation's memory layers
401
- *
402
- * - this field) must not exceed 10 entries. A request that would produce an
403
- * effective stack larger than 10 is rejected with InvalidArgument.
404
- */
405
- memoryStack?: Array<MemoryReference>;
406
-
407
- /**
408
- * The output of the objective, populated when the objective completes. Will match
409
- * the schema of output_json_schema or output_json_inferred.
410
- */
411
- output?: { [key: string]: unknown };
412
-
413
- /**
414
- * Snapshot of the agent spec's output_definition at objective creation time. When
415
- * present, the objective will run an extraction step after the LLM finishes.
416
- */
417
- outputDefinition?: { [key: string]: unknown };
418
-
419
- /**
420
- * A parent objective means the objective was spawned off using a separate agent to
421
- * complete an objective
422
- */
423
- parentObjectiveId?: string;
424
-
425
- /**
426
- * Secrets that can be used in the headers for tool calls using the secret
427
- * interpolation format.
428
- */
429
- secrets?: Array<ObjectiveDataSecret>;
430
-
431
- /**
432
- * ID of the AgentSchedule that produced this objective, when applicable. Populated
433
- * when the objective is created from a schedule fire; empty when the objective was
434
- * created via CreateObjective directly.
435
- */
436
- sourceScheduleId?: string;
437
-
438
- /**
439
- * system_prompt is read-only, derived from the selected variation's prompt
440
- */
441
- systemPrompt?: string;
442
-
443
- /**
444
- * AgentVariation resource
445
- */
446
- variation?: VariationsAPI.AgentVariation;
447
- }
448
-
449
- export interface ObjectiveDataSecret {
450
- name?: string;
451
-
452
- value?: string;
453
- }
454
-
455
464
  export interface ObjectiveError {
456
465
  message?: string;
457
466
 
@@ -622,67 +631,66 @@ export interface ObjectiveInfo {
622
631
  /**
623
632
  * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
624
633
  */
625
- agent?: Shared.ResourceMetadata;
634
+ agent: Shared.ResourceMetadata;
626
635
 
627
636
  /**
628
637
  * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
629
638
  */
630
- agentVariation?: Shared.ResourceMetadata;
639
+ agentVariation: Shared.ResourceMetadata;
631
640
 
632
641
  /**
633
642
  * A profile identifies a user or non-human principal (such as an API key) at the
634
643
  * account level. Profiles are account-scoped and can be granted access to multiple
635
644
  * workspaces.
636
645
  */
637
- createdBy?: AccountAPI.Profile;
646
+ createdBy: AccountAPI.Profile;
647
+
648
+ /**
649
+ * ID of the objective's current (most recent) context window. Hydrated on demand;
650
+ * empty when the objective has not yet produced a context window.
651
+ */
652
+ currentContextWindowId: string;
638
653
 
639
654
  /**
640
655
  * The effective memory stack at objective creation time, flattened from the
641
- * variation's baseline plus ObjectiveData.memory_stack. Order is push order (last
642
- * = top). Returned on reads so clients can see exactly what stack the objective is
656
+ * variation's baseline plus Objective.memory_stack. Order is push order (last =
657
+ * top). Returned on reads so clients can see exactly what stack the objective is
643
658
  * using without having to re-join variation state.
644
659
  */
645
- effectiveMemoryStack?: Array<MemoryReference>;
660
+ effectiveMemoryStack: Array<MemoryReference>;
646
661
 
647
662
  /**
648
663
  * Total number of context windows that this objective has generated
649
664
  */
650
- totalContextWindows?: number;
665
+ totalContextWindows: number;
651
666
 
652
667
  /**
653
668
  * Total number of events generated during this objective's execution
654
669
  */
655
- totalEvents?: number;
670
+ totalEvents: number;
656
671
 
657
672
  /**
658
673
  * Total input tokens consumed across all LLM completions across all context
659
674
  * windows
660
675
  */
661
- totalInputTokens?: number;
676
+ totalInputTokens: number;
677
+
678
+ totalIterations: number;
662
679
 
663
680
  /**
664
681
  * Total output tokens generated across all LLM completions across all context
665
682
  * windows
666
683
  */
667
- totalOutputTokens?: number;
684
+ totalOutputTokens: number;
668
685
 
669
686
  /**
670
687
  * Total number of tool calls made during execution
671
688
  */
672
- totalToolCalls?: number;
689
+ totalToolCalls: number;
673
690
  }
674
691
 
675
- export interface ObjectiveStatus {
676
- state:
677
- | 'STATE_UNSPECIFIED'
678
- | 'STATE_PENDING'
679
- | 'STATE_RUNNING'
680
- | 'STATE_WAITING'
681
- | 'STATE_FAILED'
682
- | 'STATE_CANCELLED'
683
- | 'STATE_FINALIZED';
684
-
685
- message?: string;
692
+ export interface ObjectiveSecret {
693
+ name?: string;
686
694
  }
687
695
 
688
696
  export interface SubAgentSpawned {
@@ -830,7 +838,37 @@ export interface ObjectiveListEventsResponse {
830
838
  export interface ObjectiveCreateParams {
831
839
  agentId: string;
832
840
 
833
- data: ObjectiveData;
841
+ /**
842
+ * Arbitrary data for the objective. May be used in liquid templates for prompts
843
+ * configured on the agent variation
844
+ */
845
+ data: { [key: string]: unknown };
846
+
847
+ /**
848
+ * Optional override for initial message sent to the agent. This becomes the first
849
+ * user message in the LLM chat history. The agent variation is used to set this if
850
+ * not present.
851
+ */
852
+ initialMessage?: string;
853
+
854
+ /**
855
+ * Memory layers/entries to push onto this objective's memory stack on top of the
856
+ * baseline stack inherited from the selected variation.
857
+ *
858
+ * Array order is push order: the first element sits lower in the objective's
859
+ * contribution to the stack; the LAST element ends up on top of the effective
860
+ * stack. Entries pinned via memory_entry_id behave as single-entry layers at their
861
+ * position.
862
+ *
863
+ * System-managed layers (e.g., episodic) cannot be referenced here; they attach
864
+ * themselves automatically based on episodic_key.
865
+ *
866
+ * Stack size cap: the TOTAL effective stack (variation's memory layers
867
+ *
868
+ * - this field) must not exceed 10 entries. A request that would produce an
869
+ * effective stack larger than 10 is rejected with InvalidArgument.
870
+ */
871
+ memoryStack?: Array<MemoryReference>;
834
872
 
835
873
  /**
836
874
  * CreateOperationMetadata contains the user-provided fields for creating an
@@ -839,6 +877,12 @@ export interface ObjectiveCreateParams {
839
877
  */
840
878
  metadata?: Shared.CreateOperationMetadata;
841
879
 
880
+ /**
881
+ * Secrets that can be used in the headers for tool calls using the secret
882
+ * interpolation format.
883
+ */
884
+ secrets?: Array<ObjectiveCreateParams.Secret>;
885
+
842
886
  /**
843
887
  * Optional explicit variation selection. Overrides the agent's
844
888
  * variation_selection_mode.
@@ -846,6 +890,14 @@ export interface ObjectiveCreateParams {
846
890
  variationId?: string;
847
891
  }
848
892
 
893
+ export namespace ObjectiveCreateParams {
894
+ export interface Secret {
895
+ name?: string;
896
+
897
+ value?: string;
898
+ }
899
+ }
900
+
849
901
  export interface ObjectiveRetrieveParams {
850
902
  workspaceId: string;
851
903
  }
@@ -1004,16 +1056,15 @@ export declare namespace Objectives {
1004
1056
  type MemoryRead as MemoryRead,
1005
1057
  type MemoryReference as MemoryReference,
1006
1058
  type Objective as Objective,
1059
+ type ObjectiveConfigSnapshot as ObjectiveConfigSnapshot,
1007
1060
  type ObjectiveContextWindow as ObjectiveContextWindow,
1008
1061
  type ObjectiveContextWindowData as ObjectiveContextWindowData,
1009
- type ObjectiveData as ObjectiveData,
1010
- type ObjectiveDataSecret as ObjectiveDataSecret,
1011
1062
  type ObjectiveError as ObjectiveError,
1012
1063
  type ObjectiveEventData as ObjectiveEventData,
1013
1064
  type ObjectiveEventInfo as ObjectiveEventInfo,
1014
1065
  type ObjectiveEventWebhookData as ObjectiveEventWebhookData,
1015
1066
  type ObjectiveInfo as ObjectiveInfo,
1016
- type ObjectiveStatus as ObjectiveStatus,
1067
+ type ObjectiveSecret as ObjectiveSecret,
1017
1068
  type SubAgentSpawned as SubAgentSpawned,
1018
1069
  type SubAgentUpdated as SubAgentUpdated,
1019
1070
  type ToolApprovalRequested as ToolApprovalRequested,
@@ -36,8 +36,8 @@ export class ToolCalls extends APIResource {
36
36
  options?: RequestOptions,
37
37
  ): APIPromise<ObjectiveToolCall> {
38
38
  const { workspaceId, objectiveId, ...body } = params;
39
- return this._client.put(
40
- path`/v1/workspaces/${workspaceId}/objectives/${objectiveId}/tool_calls/${toolCallID}/approve`,
39
+ return this._client.post(
40
+ path`/v1/workspaces/${workspaceId}/objectives/${objectiveId}/tool_calls/${toolCallID}:approve`,
41
41
  { body, ...options },
42
42
  );
43
43
  }
@@ -53,8 +53,8 @@ export class ToolCalls extends APIResource {
53
53
  options?: RequestOptions,
54
54
  ): APIPromise<ObjectiveToolCall> {
55
55
  const { workspaceId, objectiveId, ...body } = params;
56
- return this._client.put(
57
- path`/v1/workspaces/${workspaceId}/objectives/${objectiveId}/tool_calls/${toolCallID}/deny`,
56
+ return this._client.post(
57
+ path`/v1/workspaces/${workspaceId}/objectives/${objectiveId}/tool_calls/${toolCallID}:deny`,
58
58
  { body, ...options },
59
59
  );
60
60
  }
@@ -70,6 +70,13 @@ export type ObjectiveToolCallsCursorPagination = CursorPagination<ObjectiveToolC
70
70
  export interface ObjectiveToolCall {
71
71
  data: ObjectiveToolCallData;
72
72
 
73
+ executionStatus:
74
+ | 'TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED'
75
+ | 'TOOL_CALL_EXECUTION_STATUS_PENDING'
76
+ | 'TOOL_CALL_EXECUTION_STATUS_RUNNING'
77
+ | 'TOOL_CALL_EXECUTION_STATUS_COMPLETED'
78
+ | 'TOOL_CALL_EXECUTION_STATUS_ERRORED';
79
+
73
80
  /**
74
81
  * Metadata for ephemeral operations and activities (e.g., objectives, executions,
75
82
  * runs)
@@ -86,13 +93,6 @@ export interface ObjectiveToolCall {
86
93
  | 'TOOL_CALL_STATUS_APPROVED'
87
94
  | 'TOOL_CALL_STATUS_DENIED';
88
95
 
89
- executionStatus?:
90
- | 'TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED'
91
- | 'TOOL_CALL_EXECUTION_STATUS_PENDING'
92
- | 'TOOL_CALL_EXECUTION_STATUS_RUNNING'
93
- | 'TOOL_CALL_EXECUTION_STATUS_COMPLETED'
94
- | 'TOOL_CALL_EXECUTION_STATUS_ERRORED';
95
-
96
96
  info?: ObjectiveToolCallInfo;
97
97
  }
98
98
 
@@ -6,6 +6,7 @@ export {
6
6
  WorkspaceAdmin,
7
7
  type WorkspaceMember,
8
8
  type WorkspaceAdminCreateParams,
9
+ type WorkspaceAdminUpdateParams,
9
10
  type WorkspaceAdminListParams,
10
11
  type WorkspaceMembersCursorPagination,
11
12
  } from './workspace-admin';
@@ -33,15 +33,9 @@ export class Profiles extends APIResource {
33
33
  export interface ProfileListParams extends CursorPaginationParams {
34
34
  /**
35
35
  * Free-form search over profile name and email. Case-insensitive substring match;
36
- * empty returns all profiles (subject to the type filter).
36
+ * empty returns all profiles.
37
37
  */
38
38
  query?: string;
39
-
40
- /**
41
- * Filter by profile type. Defaults to all types when unset; pass PROFILE_TYPE_USER
42
- * to list only human users (the common case for a member picker).
43
- */
44
- type?: 'PROFILE_TYPE_USER' | 'PROFILE_TYPE_API_KEY' | 'PROFILE_TYPE_SYSTEM';
45
39
  }
46
40
 
47
41
  export declare namespace Profiles {