@cadenya/cadenya 0.82.0 → 0.85.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 (177) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +8 -17
  3. package/client.d.mts +15 -12
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +15 -12
  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/account.js +1 -1
  17. package/resources/account.js.map +1 -1
  18. package/resources/account.mjs +1 -1
  19. package/resources/account.mjs.map +1 -1
  20. package/resources/agents/agents.d.mts +55 -9
  21. package/resources/agents/agents.d.mts.map +1 -1
  22. package/resources/agents/agents.d.ts +55 -9
  23. package/resources/agents/agents.d.ts.map +1 -1
  24. package/resources/agents/agents.js +38 -0
  25. package/resources/agents/agents.js.map +1 -1
  26. package/resources/agents/agents.mjs +38 -0
  27. package/resources/agents/agents.mjs.map +1 -1
  28. package/resources/agents/index.d.mts +2 -2
  29. package/resources/agents/index.d.mts.map +1 -1
  30. package/resources/agents/index.d.ts +2 -2
  31. package/resources/agents/index.d.ts.map +1 -1
  32. package/resources/agents/index.js.map +1 -1
  33. package/resources/agents/index.mjs.map +1 -1
  34. package/resources/agents/schedules.d.mts +57 -6
  35. package/resources/agents/schedules.d.mts.map +1 -1
  36. package/resources/agents/schedules.d.ts +57 -6
  37. package/resources/agents/schedules.d.ts.map +1 -1
  38. package/resources/agents/schedules.js +34 -0
  39. package/resources/agents/schedules.js.map +1 -1
  40. package/resources/agents/schedules.mjs +34 -0
  41. package/resources/agents/schedules.mjs.map +1 -1
  42. package/resources/ai-provider-keys.d.mts +142 -0
  43. package/resources/ai-provider-keys.d.mts.map +1 -0
  44. package/resources/ai-provider-keys.d.ts +142 -0
  45. package/resources/ai-provider-keys.d.ts.map +1 -0
  46. package/resources/ai-provider-keys.js +51 -0
  47. package/resources/ai-provider-keys.js.map +1 -0
  48. package/resources/ai-provider-keys.mjs +47 -0
  49. package/resources/ai-provider-keys.mjs.map +1 -0
  50. package/resources/api-keys/api-keys.d.mts +4 -2
  51. package/resources/api-keys/api-keys.d.mts.map +1 -1
  52. package/resources/api-keys/api-keys.d.ts +4 -2
  53. package/resources/api-keys/api-keys.d.ts.map +1 -1
  54. package/resources/api-keys/api-keys.js +2 -2
  55. package/resources/api-keys/api-keys.js.map +1 -1
  56. package/resources/api-keys/api-keys.mjs +2 -2
  57. package/resources/api-keys/api-keys.mjs.map +1 -1
  58. package/resources/api-keys/index.d.mts +1 -1
  59. package/resources/api-keys/index.d.mts.map +1 -1
  60. package/resources/api-keys/index.d.ts +1 -1
  61. package/resources/api-keys/index.d.ts.map +1 -1
  62. package/resources/api-keys/index.js.map +1 -1
  63. package/resources/api-keys/index.mjs.map +1 -1
  64. package/resources/bulk-workspace-resources/bulk-workspace-resources.d.mts +23 -7
  65. package/resources/bulk-workspace-resources/bulk-workspace-resources.d.mts.map +1 -1
  66. package/resources/bulk-workspace-resources/bulk-workspace-resources.d.ts +23 -7
  67. package/resources/bulk-workspace-resources/bulk-workspace-resources.d.ts.map +1 -1
  68. package/resources/bulk-workspace-resources/bulk-workspace-resources.js.map +1 -1
  69. package/resources/bulk-workspace-resources/bulk-workspace-resources.mjs.map +1 -1
  70. package/resources/index.d.mts +7 -6
  71. package/resources/index.d.mts.map +1 -1
  72. package/resources/index.d.ts +7 -6
  73. package/resources/index.d.ts.map +1 -1
  74. package/resources/index.js +3 -1
  75. package/resources/index.js.map +1 -1
  76. package/resources/index.mjs +1 -0
  77. package/resources/index.mjs.map +1 -1
  78. package/resources/models.d.mts +84 -13
  79. package/resources/models.d.mts.map +1 -1
  80. package/resources/models.d.ts +84 -13
  81. package/resources/models.d.ts.map +1 -1
  82. package/resources/models.js +22 -3
  83. package/resources/models.js.map +1 -1
  84. package/resources/models.mjs +22 -3
  85. package/resources/models.mjs.map +1 -1
  86. package/resources/objectives/index.d.mts +1 -1
  87. package/resources/objectives/index.d.mts.map +1 -1
  88. package/resources/objectives/index.d.ts +1 -1
  89. package/resources/objectives/index.d.ts.map +1 -1
  90. package/resources/objectives/index.js.map +1 -1
  91. package/resources/objectives/index.mjs.map +1 -1
  92. package/resources/objectives/objectives.d.mts +149 -98
  93. package/resources/objectives/objectives.d.mts.map +1 -1
  94. package/resources/objectives/objectives.d.ts +149 -98
  95. package/resources/objectives/objectives.d.ts.map +1 -1
  96. package/resources/objectives/objectives.js +3 -3
  97. package/resources/objectives/objectives.js.map +1 -1
  98. package/resources/objectives/objectives.mjs +3 -3
  99. package/resources/objectives/objectives.mjs.map +1 -1
  100. package/resources/objectives/tool-calls.d.mts +1 -1
  101. package/resources/objectives/tool-calls.d.mts.map +1 -1
  102. package/resources/objectives/tool-calls.d.ts +1 -1
  103. package/resources/objectives/tool-calls.d.ts.map +1 -1
  104. package/resources/objectives/tool-calls.js +2 -2
  105. package/resources/objectives/tool-calls.js.map +1 -1
  106. package/resources/objectives/tool-calls.mjs +2 -2
  107. package/resources/objectives/tool-calls.mjs.map +1 -1
  108. package/resources/shared.d.mts +4 -0
  109. package/resources/shared.d.mts.map +1 -1
  110. package/resources/shared.d.ts +4 -0
  111. package/resources/shared.d.ts.map +1 -1
  112. package/resources/tool-sets/index.d.mts +2 -2
  113. package/resources/tool-sets/index.d.mts.map +1 -1
  114. package/resources/tool-sets/index.d.ts +2 -2
  115. package/resources/tool-sets/index.d.ts.map +1 -1
  116. package/resources/tool-sets/index.js.map +1 -1
  117. package/resources/tool-sets/index.mjs.map +1 -1
  118. package/resources/tool-sets/tool-sets.d.mts +40 -3
  119. package/resources/tool-sets/tool-sets.d.mts.map +1 -1
  120. package/resources/tool-sets/tool-sets.d.ts +40 -3
  121. package/resources/tool-sets/tool-sets.d.ts.map +1 -1
  122. package/resources/tool-sets/tool-sets.js +27 -1
  123. package/resources/tool-sets/tool-sets.js.map +1 -1
  124. package/resources/tool-sets/tool-sets.mjs +27 -1
  125. package/resources/tool-sets/tool-sets.mjs.map +1 -1
  126. package/resources/tool-sets/tools.d.mts +39 -5
  127. package/resources/tool-sets/tools.d.mts.map +1 -1
  128. package/resources/tool-sets/tools.d.ts +39 -5
  129. package/resources/tool-sets/tools.d.ts.map +1 -1
  130. package/resources/tool-sets/tools.js +23 -1
  131. package/resources/tool-sets/tools.js.map +1 -1
  132. package/resources/tool-sets/tools.mjs +23 -1
  133. package/resources/tool-sets/tools.mjs.map +1 -1
  134. package/resources/workspace-admin/index.d.mts +1 -1
  135. package/resources/workspace-admin/index.d.mts.map +1 -1
  136. package/resources/workspace-admin/index.d.ts +1 -1
  137. package/resources/workspace-admin/index.d.ts.map +1 -1
  138. package/resources/workspace-admin/index.js.map +1 -1
  139. package/resources/workspace-admin/index.mjs.map +1 -1
  140. package/resources/workspace-admin/profiles.d.mts +1 -6
  141. package/resources/workspace-admin/profiles.d.mts.map +1 -1
  142. package/resources/workspace-admin/profiles.d.ts +1 -6
  143. package/resources/workspace-admin/profiles.d.ts.map +1 -1
  144. package/resources/workspace-admin/workspace-admin.d.mts +43 -1
  145. package/resources/workspace-admin/workspace-admin.d.mts.map +1 -1
  146. package/resources/workspace-admin/workspace-admin.d.ts +43 -1
  147. package/resources/workspace-admin/workspace-admin.d.ts.map +1 -1
  148. package/resources/workspace-admin/workspace-admin.js +6 -0
  149. package/resources/workspace-admin/workspace-admin.js.map +1 -1
  150. package/resources/workspace-admin/workspace-admin.mjs +6 -0
  151. package/resources/workspace-admin/workspace-admin.mjs.map +1 -1
  152. package/src/client.ts +53 -8
  153. package/src/resources/account.ts +2 -2
  154. package/src/resources/agents/agents.ts +89 -15
  155. package/src/resources/agents/index.ts +7 -0
  156. package/src/resources/agents/schedules.ts +87 -10
  157. package/src/resources/ai-provider-keys.ts +216 -0
  158. package/src/resources/api-keys/api-keys.ts +5 -2
  159. package/src/resources/api-keys/index.ts +1 -0
  160. package/src/resources/bulk-workspace-resources/bulk-workspace-resources.ts +26 -7
  161. package/src/resources/index.ts +25 -4
  162. package/src/resources/models.ts +109 -15
  163. package/src/resources/objectives/index.ts +2 -3
  164. package/src/resources/objectives/objectives.ts +171 -120
  165. package/src/resources/objectives/tool-calls.ts +11 -11
  166. package/src/resources/shared.ts +5 -0
  167. package/src/resources/tool-sets/index.ts +4 -0
  168. package/src/resources/tool-sets/tool-sets.ts +62 -1
  169. package/src/resources/tool-sets/tools.ts +60 -12
  170. package/src/resources/workspace-admin/index.ts +1 -0
  171. package/src/resources/workspace-admin/profiles.ts +1 -7
  172. package/src/resources/workspace-admin/workspace-admin.ts +54 -0
  173. package/src/version.ts +1 -1
  174. package/version.d.mts +1 -1
  175. package/version.d.ts +1 -1
  176. package/version.js +1 -1
  177. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -28,12 +28,26 @@ import {
28
28
  ProfileSpec,
29
29
  RotateWebhookSigningKeyResponse,
30
30
  } from './resources/account';
31
+ import {
32
+ AIProviderKey,
33
+ AIProviderKeyCreateParams,
34
+ AIProviderKeyDeleteParams,
35
+ AIProviderKeyListParams,
36
+ AIProviderKeyRetrieveParams,
37
+ AIProviderKeySpec,
38
+ AIProviderKeyUpdateParams,
39
+ AIProviderKeys,
40
+ AIProviderKeysCursorPagination,
41
+ } from './resources/ai-provider-keys';
31
42
  import {
32
43
  Model,
44
+ ModelDisableParams,
45
+ ModelEnableParams,
33
46
  ModelListParams,
34
47
  ModelRetrieveParams,
35
- ModelSetStatusParams,
36
48
  ModelSpec,
49
+ ModelSwapParams,
50
+ ModelSwapResponse,
37
51
  Models,
38
52
  ModelsCursorPagination,
39
53
  } from './resources/models';
@@ -72,12 +86,16 @@ import {
72
86
  } from './resources/workspaces';
73
87
  import {
74
88
  Agent,
89
+ AgentArchiveParams,
75
90
  AgentCreateParams,
76
91
  AgentDeleteParams,
77
92
  AgentInfo,
78
93
  AgentListParams,
94
+ AgentPublishParams,
79
95
  AgentRetrieveParams,
80
96
  AgentSpec,
97
+ AgentUnarchiveParams,
98
+ AgentUnpublishParams,
81
99
  AgentUpdateParams,
82
100
  Agents,
83
101
  AgentsCursorPagination,
@@ -88,6 +106,7 @@ import {
88
106
  APIKeyCreateParams,
89
107
  APIKeyInfo,
90
108
  APIKeyListParams,
109
+ APIKeyRotateParams,
91
110
  APIKeySpec,
92
111
  APIKeyUpdateParams,
93
112
  APIKeys,
@@ -136,14 +155,13 @@ import {
136
155
  ObjectiveCancelParams,
137
156
  ObjectiveCompactParams,
138
157
  ObjectiveCompactResponse,
158
+ ObjectiveConfigSnapshot,
139
159
  ObjectiveContextWindow,
140
160
  ObjectiveContextWindowData,
141
161
  ObjectiveContextWindowsCursorPagination,
142
162
  ObjectiveContinueParams,
143
163
  ObjectiveContinueResponse,
144
164
  ObjectiveCreateParams,
145
- ObjectiveData,
146
- ObjectiveDataSecret,
147
165
  ObjectiveError,
148
166
  ObjectiveEventData,
149
167
  ObjectiveEventInfo,
@@ -155,7 +173,7 @@ import {
155
173
  ObjectiveListEventsResponsesCursorPagination,
156
174
  ObjectiveListParams,
157
175
  ObjectiveRetrieveParams,
158
- ObjectiveStatus,
176
+ ObjectiveSecret,
159
177
  Objectives,
160
178
  ObjectivesCursorPagination,
161
179
  SubAgentSpawned,
@@ -181,6 +199,7 @@ import {
181
199
  ToolSetAdapterHTTP,
182
200
  ToolSetAdapterMcp,
183
201
  ToolSetAdapterOpenAPI,
202
+ ToolSetArchiveParams,
184
203
  ToolSetCreateParams,
185
204
  ToolSetDeleteParams,
186
205
  ToolSetEvent,
@@ -193,6 +212,7 @@ import {
193
212
  ToolSetListParams,
194
213
  ToolSetRetrieveParams,
195
214
  ToolSetSpec,
215
+ ToolSetUnarchiveParams,
196
216
  ToolSetUpdateParams,
197
217
  ToolSets,
198
218
  ToolSetsCursorPagination,
@@ -201,6 +221,7 @@ import {
201
221
  WorkspaceAdmin,
202
222
  WorkspaceAdminCreateParams,
203
223
  WorkspaceAdminListParams,
224
+ WorkspaceAdminUpdateParams,
204
225
  WorkspaceMember,
205
226
  } from './resources/workspace-admin/workspace-admin';
206
227
  import { type Fetch } from './internal/builtin-types';
@@ -947,6 +968,7 @@ export class Cadenya {
947
968
 
948
969
  static toFile = Uploads.toFile;
949
970
 
971
+ aiProviderKeys: API.AIProviderKeys = new API.AIProviderKeys(this);
950
972
  /**
951
973
  * Manage the authenticated account. Accounts are the top-level organizational
952
974
  * unit and contain one or more workspaces.
@@ -1018,6 +1040,7 @@ export class Cadenya {
1018
1040
  bulkWorkspaceResources: API.BulkWorkspaceResources = new API.BulkWorkspaceResources(this);
1019
1041
  }
1020
1042
 
1043
+ Cadenya.AIProviderKeys = AIProviderKeys;
1021
1044
  Cadenya.AccountResource = AccountResource;
1022
1045
  Cadenya.Agents = Agents;
1023
1046
  Cadenya.Objectives = Objectives;
@@ -1042,6 +1065,18 @@ export declare namespace Cadenya {
1042
1065
  type CursorPaginationResponse as CursorPaginationResponse,
1043
1066
  };
1044
1067
 
1068
+ export {
1069
+ AIProviderKeys as AIProviderKeys,
1070
+ type AIProviderKey as AIProviderKey,
1071
+ type AIProviderKeySpec as AIProviderKeySpec,
1072
+ type AIProviderKeysCursorPagination as AIProviderKeysCursorPagination,
1073
+ type AIProviderKeyCreateParams as AIProviderKeyCreateParams,
1074
+ type AIProviderKeyRetrieveParams as AIProviderKeyRetrieveParams,
1075
+ type AIProviderKeyUpdateParams as AIProviderKeyUpdateParams,
1076
+ type AIProviderKeyListParams as AIProviderKeyListParams,
1077
+ type AIProviderKeyDeleteParams as AIProviderKeyDeleteParams,
1078
+ };
1079
+
1045
1080
  export {
1046
1081
  AccountResource as AccountResource,
1047
1082
  type Account as Account,
@@ -1064,6 +1099,10 @@ export declare namespace Cadenya {
1064
1099
  type AgentUpdateParams as AgentUpdateParams,
1065
1100
  type AgentListParams as AgentListParams,
1066
1101
  type AgentDeleteParams as AgentDeleteParams,
1102
+ type AgentArchiveParams as AgentArchiveParams,
1103
+ type AgentPublishParams as AgentPublishParams,
1104
+ type AgentUnarchiveParams as AgentUnarchiveParams,
1105
+ type AgentUnpublishParams as AgentUnpublishParams,
1067
1106
  };
1068
1107
 
1069
1108
  export {
@@ -1075,16 +1114,15 @@ export declare namespace Cadenya {
1075
1114
  type MemoryRead as MemoryRead,
1076
1115
  type MemoryReference as MemoryReference,
1077
1116
  type Objective as Objective,
1117
+ type ObjectiveConfigSnapshot as ObjectiveConfigSnapshot,
1078
1118
  type ObjectiveContextWindow as ObjectiveContextWindow,
1079
1119
  type ObjectiveContextWindowData as ObjectiveContextWindowData,
1080
- type ObjectiveData as ObjectiveData,
1081
- type ObjectiveDataSecret as ObjectiveDataSecret,
1082
1120
  type ObjectiveError as ObjectiveError,
1083
1121
  type ObjectiveEventData as ObjectiveEventData,
1084
1122
  type ObjectiveEventInfo as ObjectiveEventInfo,
1085
1123
  type ObjectiveEventWebhookData as ObjectiveEventWebhookData,
1086
1124
  type ObjectiveInfo as ObjectiveInfo,
1087
- type ObjectiveStatus as ObjectiveStatus,
1125
+ type ObjectiveSecret as ObjectiveSecret,
1088
1126
  type SubAgentSpawned as SubAgentSpawned,
1089
1127
  type SubAgentUpdated as SubAgentUpdated,
1090
1128
  type ToolApprovalRequested as ToolApprovalRequested,
@@ -1136,10 +1174,13 @@ export declare namespace Cadenya {
1136
1174
  Models as Models,
1137
1175
  type Model as Model,
1138
1176
  type ModelSpec as ModelSpec,
1177
+ type ModelSwapResponse as ModelSwapResponse,
1139
1178
  type ModelsCursorPagination as ModelsCursorPagination,
1140
1179
  type ModelRetrieveParams as ModelRetrieveParams,
1141
1180
  type ModelListParams as ModelListParams,
1142
- type ModelSetStatusParams as ModelSetStatusParams,
1181
+ type ModelDisableParams as ModelDisableParams,
1182
+ type ModelEnableParams as ModelEnableParams,
1183
+ type ModelSwapParams as ModelSwapParams,
1143
1184
  };
1144
1185
 
1145
1186
  export {
@@ -1174,8 +1215,10 @@ export declare namespace Cadenya {
1174
1215
  type ToolSetUpdateParams as ToolSetUpdateParams,
1175
1216
  type ToolSetListParams as ToolSetListParams,
1176
1217
  type ToolSetDeleteParams as ToolSetDeleteParams,
1218
+ type ToolSetArchiveParams as ToolSetArchiveParams,
1177
1219
  type ToolSetGetOpenAPISpecParams as ToolSetGetOpenAPISpecParams,
1178
1220
  type ToolSetListEventsParams as ToolSetListEventsParams,
1221
+ type ToolSetUnarchiveParams as ToolSetUnarchiveParams,
1179
1222
  };
1180
1223
 
1181
1224
  export {
@@ -1187,6 +1230,7 @@ export declare namespace Cadenya {
1187
1230
  type APIKeyCreateParams as APIKeyCreateParams,
1188
1231
  type APIKeyUpdateParams as APIKeyUpdateParams,
1189
1232
  type APIKeyListParams as APIKeyListParams,
1233
+ type APIKeyRotateParams as APIKeyRotateParams,
1190
1234
  };
1191
1235
 
1192
1236
  export {
@@ -1214,6 +1258,7 @@ export declare namespace Cadenya {
1214
1258
  WorkspaceAdmin as WorkspaceAdmin,
1215
1259
  type WorkspaceMember as WorkspaceMember,
1216
1260
  type WorkspaceAdminCreateParams as WorkspaceAdminCreateParams,
1261
+ type WorkspaceAdminUpdateParams as WorkspaceAdminUpdateParams,
1217
1262
  type WorkspaceAdminListParams as WorkspaceAdminListParams,
1218
1263
  };
1219
1264
 
@@ -25,7 +25,7 @@ export class AccountResource extends APIResource {
25
25
  * Rotates the webhook signing key for the account. Returns only the new key.
26
26
  */
27
27
  rotateWebhookSigningKey(options?: RequestOptions): APIPromise<RotateWebhookSigningKeyResponse> {
28
- return this._client.post('/v1/account/rotate_webhook_signing_key', options);
28
+ return this._client.post('/v1/account:rotateWebhookSigningKey', options);
29
29
  }
30
30
  }
31
31
 
@@ -110,7 +110,7 @@ export interface ProfileSpec {
110
110
  /**
111
111
  * Whether this profile represents a human user, an API key, or a system principal.
112
112
  */
113
- type: 'PROFILE_TYPE_USER' | 'PROFILE_TYPE_API_KEY' | 'PROFILE_TYPE_SYSTEM';
113
+ type: 'PROFILE_TYPE_UNSPECIFIED' | 'PROFILE_TYPE_USER' | 'PROFILE_TYPE_API_KEY' | 'PROFILE_TYPE_SYSTEM';
114
114
 
115
115
  /**
116
116
  * Email address of the profile. Required and unique within an account for user
@@ -12,12 +12,15 @@ import {
12
12
  AgentScheduleSpec,
13
13
  AgentScheduleSpecSchedule,
14
14
  AgentSchedulesCursorPagination,
15
+ ScheduleArchiveParams,
15
16
  ScheduleCalendar,
16
17
  ScheduleCreateParams,
17
18
  ScheduleDeleteParams,
18
19
  ScheduleInterval,
19
20
  ScheduleListParams,
21
+ SchedulePauseParams,
20
22
  ScheduleRange,
23
+ ScheduleResumeParams,
21
24
  ScheduleRetrieveParams,
22
25
  ScheduleUpdateParams,
23
26
  Schedules,
@@ -120,6 +123,48 @@ export class Agents extends APIResource {
120
123
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
121
124
  });
122
125
  }
126
+
127
+ /**
128
+ * Transitions an agent to STATE_ARCHIVED. Archived agents are hidden from list
129
+ * results and cannot be used for objectives; active schedules are paused.
130
+ */
131
+ archive(id: string, params: AgentArchiveParams, options?: RequestOptions): APIPromise<Agent> {
132
+ const { workspaceId, ...body } = params;
133
+ return this._client.post(path`/v1/workspaces/${workspaceId}/agents/${id}:archive`, { body, ...options });
134
+ }
135
+
136
+ /**
137
+ * Transitions an agent to STATE_PUBLISHED, making it available for objectives. The
138
+ * agent must have at least one variation.
139
+ */
140
+ publish(id: string, params: AgentPublishParams, options?: RequestOptions): APIPromise<Agent> {
141
+ const { workspaceId, ...body } = params;
142
+ return this._client.post(path`/v1/workspaces/${workspaceId}/agents/${id}:publish`, { body, ...options });
143
+ }
144
+
145
+ /**
146
+ * Transitions an archived agent back to STATE_DRAFT. Publish the agent again to
147
+ * make it available for objectives.
148
+ */
149
+ unarchive(id: string, params: AgentUnarchiveParams, options?: RequestOptions): APIPromise<Agent> {
150
+ const { workspaceId, ...body } = params;
151
+ return this._client.post(path`/v1/workspaces/${workspaceId}/agents/${id}:unarchive`, {
152
+ body,
153
+ ...options,
154
+ });
155
+ }
156
+
157
+ /**
158
+ * Transitions a published agent back to STATE_DRAFT. Active schedules for the
159
+ * agent are paused until it is published again.
160
+ */
161
+ unpublish(id: string, params: AgentUnpublishParams, options?: RequestOptions): APIPromise<Agent> {
162
+ const { workspaceId, ...body } = params;
163
+ return this._client.post(path`/v1/workspaces/${workspaceId}/agents/${id}:unpublish`, {
164
+ body,
165
+ ...options,
166
+ });
167
+ }
123
168
  }
124
169
 
125
170
  export type AgentsCursorPagination = CursorPagination<Agent>;
@@ -138,6 +183,13 @@ export interface Agent {
138
183
  */
139
184
  spec: AgentSpec;
140
185
 
186
+ /**
187
+ * The current lifecycle state of the agent. Output only. Agents are created in
188
+ * STATE_DRAFT; use the :publish, :unpublish, :archive, and :unarchive actions to
189
+ * transition between states.
190
+ */
191
+ state: 'STATE_UNSPECIFIED' | 'STATE_DRAFT' | 'STATE_PUBLISHED' | 'STATE_ARCHIVED';
192
+
141
193
  /**
142
194
  * AgentInfo contains simple information about an agent for display or quick
143
195
  * reference
@@ -164,15 +216,6 @@ export interface AgentInfo {
164
216
  * Agent specification (user-provided configuration)
165
217
  */
166
218
  export interface AgentSpec {
167
- /**
168
- * Status of the agent
169
- */
170
- status:
171
- | 'AGENT_STATUS_UNSPECIFIED'
172
- | 'AGENT_STATUS_DRAFT'
173
- | 'AGENT_STATUS_PUBLISHED'
174
- | 'AGENT_STATUS_ARCHIVED';
175
-
176
219
  /**
177
220
  * Controls how variations are automatically selected when creating objectives
178
221
  * Defaults to RANDOM when unspecified
@@ -314,13 +357,9 @@ export interface AgentListParams extends CursorPaginationParams {
314
357
  sortOrder?: string;
315
358
 
316
359
  /**
317
- * Filter by agent publication status
360
+ * Filter by agent lifecycle state
318
361
  */
319
- status?:
320
- | 'AGENT_STATUS_UNSPECIFIED'
321
- | 'AGENT_STATUS_DRAFT'
322
- | 'AGENT_STATUS_PUBLISHED'
323
- | 'AGENT_STATUS_ARCHIVED';
362
+ state?: 'STATE_UNSPECIFIED' | 'STATE_DRAFT' | 'STATE_PUBLISHED' | 'STATE_ARCHIVED';
324
363
 
325
364
  /**
326
365
  * Filter by variation selection mode
@@ -338,6 +377,34 @@ export interface AgentDeleteParams {
338
377
  workspaceId: string;
339
378
  }
340
379
 
380
+ export interface AgentArchiveParams {
381
+ /**
382
+ * Workspace ID.
383
+ */
384
+ workspaceId: string;
385
+ }
386
+
387
+ export interface AgentPublishParams {
388
+ /**
389
+ * Workspace ID.
390
+ */
391
+ workspaceId: string;
392
+ }
393
+
394
+ export interface AgentUnarchiveParams {
395
+ /**
396
+ * Workspace ID.
397
+ */
398
+ workspaceId: string;
399
+ }
400
+
401
+ export interface AgentUnpublishParams {
402
+ /**
403
+ * Workspace ID.
404
+ */
405
+ workspaceId: string;
406
+ }
407
+
341
408
  Agents.Feedback = Feedback;
342
409
  Agents.WebhookDeliveries = WebhookDeliveries;
343
410
  Agents.Variations = Variations;
@@ -355,6 +422,10 @@ export declare namespace Agents {
355
422
  type AgentUpdateParams as AgentUpdateParams,
356
423
  type AgentListParams as AgentListParams,
357
424
  type AgentDeleteParams as AgentDeleteParams,
425
+ type AgentArchiveParams as AgentArchiveParams,
426
+ type AgentPublishParams as AgentPublishParams,
427
+ type AgentUnarchiveParams as AgentUnarchiveParams,
428
+ type AgentUnpublishParams as AgentUnpublishParams,
358
429
  };
359
430
 
360
431
  export { Feedback as Feedback, type FeedbackListParams as FeedbackListParams };
@@ -408,5 +479,8 @@ export declare namespace Agents {
408
479
  type ScheduleUpdateParams as ScheduleUpdateParams,
409
480
  type ScheduleListParams as ScheduleListParams,
410
481
  type ScheduleDeleteParams as ScheduleDeleteParams,
482
+ type ScheduleArchiveParams as ScheduleArchiveParams,
483
+ type SchedulePauseParams as SchedulePauseParams,
484
+ type ScheduleResumeParams as ScheduleResumeParams,
411
485
  };
412
486
  }
@@ -11,6 +11,10 @@ export {
11
11
  type AgentUpdateParams,
12
12
  type AgentListParams,
13
13
  type AgentDeleteParams,
14
+ type AgentArchiveParams,
15
+ type AgentPublishParams,
16
+ type AgentUnarchiveParams,
17
+ type AgentUnpublishParams,
14
18
  type AgentsCursorPagination,
15
19
  } from './agents';
16
20
  export { Feedback, type FeedbackListParams } from './feedback';
@@ -28,6 +32,9 @@ export {
28
32
  type ScheduleUpdateParams,
29
33
  type ScheduleListParams,
30
34
  type ScheduleDeleteParams,
35
+ type ScheduleArchiveParams,
36
+ type SchedulePauseParams,
37
+ type ScheduleResumeParams,
31
38
  type AgentSchedulesCursorPagination,
32
39
  } from './schedules';
33
40
  export {
@@ -70,6 +70,43 @@ export class Schedules extends APIResource {
70
70
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
71
71
  });
72
72
  }
73
+
74
+ /**
75
+ * Transitions a schedule to STATE_ARCHIVED and removes its underlying timer.
76
+ * Archiving is terminal: archived schedules never fire and cannot be reactivated;
77
+ * create a new schedule instead.
78
+ */
79
+ archive(id: string, params: ScheduleArchiveParams, options?: RequestOptions): APIPromise<AgentSchedule> {
80
+ const { workspaceId, agentId, ...body } = params;
81
+ return this._client.post(path`/v1/workspaces/${workspaceId}/agents/${agentId}/schedules/${id}:archive`, {
82
+ body,
83
+ ...options,
84
+ });
85
+ }
86
+
87
+ /**
88
+ * Transitions a schedule to STATE_PAUSED. Paused schedules retain history but do
89
+ * not fire.
90
+ */
91
+ pause(id: string, params: SchedulePauseParams, options?: RequestOptions): APIPromise<AgentSchedule> {
92
+ const { workspaceId, agentId, ...body } = params;
93
+ return this._client.post(path`/v1/workspaces/${workspaceId}/agents/${agentId}/schedules/${id}:pause`, {
94
+ body,
95
+ ...options,
96
+ });
97
+ }
98
+
99
+ /**
100
+ * Transitions a paused schedule back to STATE_ACTIVE so it fires on its cadence
101
+ * again. Archived schedules cannot be resumed.
102
+ */
103
+ resume(id: string, params: ScheduleResumeParams, options?: RequestOptions): APIPromise<AgentSchedule> {
104
+ const { workspaceId, agentId, ...body } = params;
105
+ return this._client.post(path`/v1/workspaces/${workspaceId}/agents/${agentId}/schedules/${id}:resume`, {
106
+ body,
107
+ ...options,
108
+ });
109
+ }
73
110
  }
74
111
 
75
112
  export type AgentSchedulesCursorPagination = CursorPagination<AgentSchedule>;
@@ -89,6 +126,13 @@ export interface AgentSchedule {
89
126
  */
90
127
  spec: AgentScheduleSpec;
91
128
 
129
+ /**
130
+ * The current lifecycle state of the schedule. Output only. Schedules are created
131
+ * STATE_ACTIVE; use the :pause, :resume, and :archive actions to transition
132
+ * between states.
133
+ */
134
+ state: 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_PAUSED' | 'STATE_ARCHIVED';
135
+
92
136
  /**
93
137
  * AgentScheduleInfo provides read-only runtime data about a schedule.
94
138
  */
@@ -128,7 +172,7 @@ export interface AgentScheduleInfo {
128
172
 
129
173
  /**
130
174
  * When the schedule will next fire. Computed from the spec; absent when the
131
- * schedule is PAUSED/ARCHIVED or has no future fire times.
175
+ * schedule is STATE_PAUSED/STATE_ARCHIVED or has no future fire times.
132
176
  */
133
177
  nextFireAt?: string;
134
178
 
@@ -166,15 +210,6 @@ export interface AgentScheduleSpec {
166
210
  */
167
211
  overlapPolicy?: 'OVERLAP_POLICY_UNSPECIFIED' | 'OVERLAP_POLICY_ALLOW' | 'OVERLAP_POLICY_SKIP';
168
212
 
169
- /**
170
- * Lifecycle. Defaults to ACTIVE on create when unspecified.
171
- */
172
- status?:
173
- | 'AGENT_SCHEDULE_STATUS_UNSPECIFIED'
174
- | 'AGENT_SCHEDULE_STATUS_ACTIVE'
175
- | 'AGENT_SCHEDULE_STATUS_PAUSED'
176
- | 'AGENT_SCHEDULE_STATUS_ARCHIVED';
177
-
178
213
  /**
179
214
  * Optional explicit variation. When unset, the agent's variation_selection_mode
180
215
  * chooses per fire.
@@ -364,6 +399,45 @@ export interface ScheduleDeleteParams {
364
399
  agentId: string;
365
400
  }
366
401
 
402
+ export interface ScheduleArchiveParams {
403
+ /**
404
+ * Workspace ID.
405
+ */
406
+ workspaceId: string;
407
+
408
+ /**
409
+ * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
410
+ * form.
411
+ */
412
+ agentId: string;
413
+ }
414
+
415
+ export interface SchedulePauseParams {
416
+ /**
417
+ * Workspace ID.
418
+ */
419
+ workspaceId: string;
420
+
421
+ /**
422
+ * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
423
+ * form.
424
+ */
425
+ agentId: string;
426
+ }
427
+
428
+ export interface ScheduleResumeParams {
429
+ /**
430
+ * Workspace ID.
431
+ */
432
+ workspaceId: string;
433
+
434
+ /**
435
+ * Agent ID. Accepts the canonical `agent_…` form or the `external_id:<value>`
436
+ * form.
437
+ */
438
+ agentId: string;
439
+ }
440
+
367
441
  export declare namespace Schedules {
368
442
  export {
369
443
  type AgentSchedule as AgentSchedule,
@@ -379,5 +453,8 @@ export declare namespace Schedules {
379
453
  type ScheduleUpdateParams as ScheduleUpdateParams,
380
454
  type ScheduleListParams as ScheduleListParams,
381
455
  type ScheduleDeleteParams as ScheduleDeleteParams,
456
+ type ScheduleArchiveParams as ScheduleArchiveParams,
457
+ type SchedulePauseParams as SchedulePauseParams,
458
+ type ScheduleResumeParams as ScheduleResumeParams,
382
459
  };
383
460
  }