@macro-inc/sdk 0.4.1 → 0.6.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 (228) hide show
  1. package/README.md +316 -21
  2. package/dist/{chunk-PTX2RV2N.js → chunk-4MI52GWV.js} +93 -1
  3. package/dist/{chunk-XFA7NCJ5.js → chunk-HO75UE4Z.js} +146 -15
  4. package/dist/{chunk-P4DTO6VD.js → chunk-MCSQNZ4E.js} +6 -0
  5. package/dist/{chunk-ZLBDES7U.js → chunk-SJ6S2GAT.js} +1271 -87
  6. package/dist/{chunk-AZJUIUIV.js → chunk-SK5CMXRV.js} +100 -14
  7. package/dist/{chunk-PZPTJI6F.js → chunk-TMTYN2UK.js} +229 -2
  8. package/dist/{chunk-PPR7IWZ7.js → chunk-ZYBAKW25.js} +2 -1
  9. package/dist/generated/agent-fold/index.d.ts +202 -14
  10. package/dist/generated/agent-harness/index.d.ts +1 -1
  11. package/dist/generated/agent-harness/index.js +1 -1
  12. package/dist/generated/agent-harness/sdk.gen.d.ts +49 -2
  13. package/dist/generated/agent-harness/types.gen.d.ts +527 -9
  14. package/dist/generated/agent-reviews/index.d.ts +11 -9
  15. package/dist/generated/auth/index.d.ts +1 -1
  16. package/dist/generated/auth/index.js +1 -1
  17. package/dist/generated/auth/sdk.gen.d.ts +82 -16
  18. package/dist/generated/auth/types.gen.d.ts +768 -18
  19. package/dist/generated/calendar/types.gen.d.ts +10 -3
  20. package/dist/generated/cognition/index.d.ts +1 -1
  21. package/dist/generated/cognition/index.js +1 -1
  22. package/dist/generated/cognition/sdk.gen.d.ts +60 -6
  23. package/dist/generated/cognition/types.gen.d.ts +663 -106
  24. package/dist/generated/connection/types.gen.d.ts +1 -1
  25. package/dist/generated/contacts/index.d.ts +1 -1
  26. package/dist/generated/contacts/index.js +1 -1
  27. package/dist/generated/contacts/sdk.gen.d.ts +5 -1
  28. package/dist/generated/contacts/types.gen.d.ts +56 -0
  29. package/dist/generated/email/types.gen.d.ts +8 -2
  30. package/dist/generated/notification/index.d.ts +1 -1
  31. package/dist/generated/notification/index.js +1 -1
  32. package/dist/generated/notification/sdk.gen.d.ts +2 -1
  33. package/dist/generated/notification/types.gen.d.ts +174 -1
  34. package/dist/generated/scheduled-action/index.d.ts +1 -1
  35. package/dist/generated/scheduled-action/index.js +1 -1
  36. package/dist/generated/scheduled-action/sdk.gen.d.ts +107 -2
  37. package/dist/generated/scheduled-action/types.gen.d.ts +2451 -479
  38. package/dist/generated/search/index.d.ts +1 -1
  39. package/dist/generated/search/types.gen.d.ts +50 -11
  40. package/dist/generated/storage/index.d.ts +1 -1
  41. package/dist/generated/storage/index.js +1 -1
  42. package/dist/generated/storage/sdk.gen.d.ts +511 -18
  43. package/dist/generated/storage/types.gen.d.ts +18528 -11395
  44. package/dist/src/entities/account-managers/grant.d.ts +28 -5
  45. package/dist/src/entities/account-managers/namespace.d.ts +15 -3
  46. package/dist/src/entities/activity/entity.d.ts +7 -0
  47. package/dist/src/entities/activity/namespace.d.ts +58 -0
  48. package/dist/src/entities/activity/namespace.test.d.ts +1 -0
  49. package/dist/src/entities/agent-sessions/activity.d.ts +12 -3
  50. package/dist/src/entities/agent-sessions/agent-session.d.ts +209 -22
  51. package/dist/src/entities/agent-sessions/code-execution.d.ts +15 -3
  52. package/dist/src/entities/agent-sessions/conversation.d.ts +46 -9
  53. package/dist/src/entities/agent-sessions/namespace.d.ts +72 -16
  54. package/dist/src/entities/agent-sessions/origin.d.ts +1 -1
  55. package/dist/src/entities/agent-sessions/queued-action.d.ts +17 -3
  56. package/dist/src/entities/agent-sessions/review.d.ts +56 -5
  57. package/dist/src/entities/agent-sessions/tool-approval.d.ts +5 -1
  58. package/dist/src/entities/agents/agent.d.ts +98 -3
  59. package/dist/src/entities/agents/namespace.d.ts +52 -8
  60. package/dist/src/entities/ai/namespace.d.ts +10 -2
  61. package/dist/src/entities/api-keys/api-key.d.ts +6 -1
  62. package/dist/src/entities/api-keys/namespace.d.ts +18 -3
  63. package/dist/src/entities/bots/bot.d.ts +44 -9
  64. package/dist/src/entities/bots/namespace.d.ts +13 -1
  65. package/dist/src/entities/bots/token.d.ts +6 -1
  66. package/dist/src/entities/calendar/booking-link.d.ts +7 -1
  67. package/dist/src/entities/calendar/booking-namespace.d.ts +14 -1
  68. package/dist/src/entities/calendar/booking.d.ts +15 -0
  69. package/dist/src/entities/calendar/calendar.d.ts +10 -3
  70. package/dist/src/entities/calendar/event.d.ts +68 -9
  71. package/dist/src/entities/calendar/namespace.d.ts +91 -12
  72. package/dist/src/entities/calendar/replacement.d.ts +19 -3
  73. package/dist/src/entities/calls/call-record.d.ts +107 -17
  74. package/dist/src/entities/calls/connection.d.ts +7 -1
  75. package/dist/src/entities/calls/message.d.ts +27 -5
  76. package/dist/src/entities/calls/namespace.d.ts +15 -3
  77. package/dist/src/entities/canvases/canvas.d.ts +329 -0
  78. package/dist/src/entities/channels/access-request.d.ts +10 -2
  79. package/dist/src/entities/channels/activity.d.ts +20 -4
  80. package/dist/src/entities/channels/channel.d.ts +154 -27
  81. package/dist/src/entities/channels/labels.d.ts +41 -7
  82. package/dist/src/entities/channels/message.d.ts +105 -8
  83. package/dist/src/entities/channels/message.test.d.ts +1 -0
  84. package/dist/src/entities/channels/namespace.d.ts +37 -7
  85. package/dist/src/entities/channels/post.d.ts +13 -7
  86. package/dist/src/entities/channels/post.test.d.ts +1 -0
  87. package/dist/src/entities/channels/share.d.ts +9 -0
  88. package/dist/src/entities/channels/share.test.d.ts +1 -0
  89. package/dist/src/entities/channels/thread.d.ts +24 -4
  90. package/dist/src/entities/chats/chat.d.ts +57 -7
  91. package/dist/src/entities/chats/generation.d.ts +11 -2
  92. package/dist/src/entities/chats/namespace.d.ts +10 -2
  93. package/dist/src/entities/connected-apps/connected-app.d.ts +16 -2
  94. package/dist/src/entities/connected-apps/connector.d.ts +3 -0
  95. package/dist/src/entities/connected-apps/namespace.d.ts +18 -0
  96. package/dist/src/entities/crm/company.d.ts +64 -16
  97. package/dist/src/entities/crm/contact.d.ts +102 -14
  98. package/dist/src/entities/crm/namespace.d.ts +113 -22
  99. package/dist/src/entities/crm/pipeline-entry.d.ts +109 -0
  100. package/dist/src/entities/crm/pipeline.d.ts +292 -29
  101. package/dist/src/entities/crm/pipelines.d.ts +69 -4
  102. package/dist/src/entities/crm-email-privacy/email-privacy.d.ts +238 -0
  103. package/dist/src/entities/crm-email-privacy/email-rule-preview.d.ts +55 -0
  104. package/dist/src/entities/crm-email-privacy/email-rule-revision.d.ts +27 -0
  105. package/dist/src/entities/crm-email-privacy/email-rules.d.ts +32 -0
  106. package/dist/src/entities/databases/column.d.ts +54 -7
  107. package/dist/src/entities/databases/database.d.ts +160 -18
  108. package/dist/src/entities/databases/namespace.d.ts +40 -8
  109. package/dist/src/entities/databases/row.d.ts +2 -0
  110. package/dist/src/entities/databases/saved-query.d.ts +151 -0
  111. package/dist/src/entities/databases/table.d.ts +73 -10
  112. package/dist/src/entities/databases/view.d.ts +37 -5
  113. package/dist/src/entities/databases/webhook.d.ts +8 -1
  114. package/dist/src/entities/documents/ai-edit.d.ts +2 -0
  115. package/dist/src/entities/documents/anchor.d.ts +12 -2
  116. package/dist/src/entities/documents/comment.d.ts +29 -5
  117. package/dist/src/entities/documents/create.test.d.ts +1 -0
  118. package/dist/src/entities/documents/document.d.ts +284 -26
  119. package/dist/src/entities/documents/markdown.d.ts +25 -0
  120. package/dist/src/entities/documents/namespace.d.ts +146 -13
  121. package/dist/src/entities/documents/skills.test.d.ts +1 -0
  122. package/dist/src/entities/documents/system-skill.d.ts +21 -1
  123. package/dist/src/entities/documents/text-comment.d.ts +41 -0
  124. package/dist/src/entities/documents/text-comment.test.d.ts +1 -0
  125. package/dist/src/entities/documents/version.d.ts +5 -1
  126. package/dist/src/entities/email/attachment.d.ts +3 -0
  127. package/dist/src/entities/email/draft.d.ts +61 -9
  128. package/dist/src/entities/email/filter.d.ts +12 -2
  129. package/dist/src/entities/email/label.d.ts +7 -1
  130. package/dist/src/entities/email/link.d.ts +5 -1
  131. package/dist/src/entities/email/message.d.ts +72 -14
  132. package/dist/src/entities/email/namespace.d.ts +134 -24
  133. package/dist/src/entities/email/thread.d.ts +124 -18
  134. package/dist/src/entities/entity-mentions/mention.d.ts +6 -1
  135. package/dist/src/entities/entity-mentions/namespace.d.ts +5 -1
  136. package/dist/src/entities/entity.d.ts +65 -6
  137. package/dist/src/entities/external-chat/chat.d.ts +80 -12
  138. package/dist/src/entities/external-chat/message.d.ts +1 -1
  139. package/dist/src/entities/external-chat/namespace.d.ts +5 -1
  140. package/dist/src/entities/external-chat/send.d.ts +10 -2
  141. package/dist/src/entities/favorites/namespace.d.ts +20 -3
  142. package/dist/src/entities/foreign/foreign-entity.d.ts +5 -1
  143. package/dist/src/entities/foreign/namespace.d.ts +5 -1
  144. package/dist/src/entities/forms/form.d.ts +91 -14
  145. package/dist/src/entities/forms/namespace.d.ts +10 -2
  146. package/dist/src/entities/forms/question.d.ts +35 -7
  147. package/dist/src/entities/forms/response.d.ts +25 -5
  148. package/dist/src/entities/forms/section.d.ts +15 -3
  149. package/dist/src/entities/github-pull-requests/namespace.d.ts +5 -1
  150. package/dist/src/entities/github-pull-requests/pull-request.d.ts +15 -3
  151. package/dist/src/entities/harnesses/harness.d.ts +51 -3
  152. package/dist/src/entities/harnesses/namespace.d.ts +54 -8
  153. package/dist/src/entities/harnesses/pairing.d.ts +13 -2
  154. package/dist/src/entities/images/image.d.ts +16 -5
  155. package/dist/src/entities/images/namespace.d.ts +8 -1
  156. package/dist/src/entities/imports/entry.d.ts +65 -0
  157. package/dist/src/entities/imports/namespace.d.ts +103 -0
  158. package/dist/src/entities/imports/namespace.test.d.ts +1 -0
  159. package/dist/src/entities/initiatives/initiative.d.ts +128 -4
  160. package/dist/src/entities/initiatives/initiative.test.d.ts +1 -0
  161. package/dist/src/entities/initiatives/namespace.d.ts +71 -7
  162. package/dist/src/entities/me/namespace.d.ts +28 -3
  163. package/dist/src/entities/meetings/meeting.d.ts +46 -8
  164. package/dist/src/entities/meetings/namespace.d.ts +20 -4
  165. package/dist/src/entities/memory/namespace.d.ts +49 -0
  166. package/dist/src/entities/memory/namespace.test.d.ts +1 -0
  167. package/dist/src/entities/messages/discussion.d.ts +84 -0
  168. package/dist/src/entities/messages/thread.d.ts +19 -5
  169. package/dist/src/entities/notifications/namespace.d.ts +41 -7
  170. package/dist/src/entities/notifications/notification.d.ts +31 -6
  171. package/dist/src/entities/passwords/item.d.ts +118 -0
  172. package/dist/src/entities/passwords/namespace.d.ts +45 -0
  173. package/dist/src/entities/pins/namespace.d.ts +23 -4
  174. package/dist/src/entities/projects/namespace.d.ts +29 -0
  175. package/dist/src/entities/projects/project.d.ts +58 -7
  176. package/dist/src/entities/properties/namespace.d.ts +67 -11
  177. package/dist/src/entities/properties/namespace.test.d.ts +1 -0
  178. package/dist/src/entities/properties/property-definition.d.ts +30 -5
  179. package/dist/src/entities/properties/property-option.d.ts +14 -2
  180. package/dist/src/entities/referrals/namespace.d.ts +8 -1
  181. package/dist/src/entities/routines/namespace.d.ts +198 -14
  182. package/dist/src/entities/routines/routine.d.ts +174 -27
  183. package/dist/src/entities/routines/suggestion.d.ts +38 -0
  184. package/dist/src/entities/saved-views/namespace.d.ts +58 -0
  185. package/dist/src/entities/saved-views/saved-view.d.ts +78 -0
  186. package/dist/src/entities/search/exclusions.d.ts +6 -0
  187. package/dist/src/entities/search/namespace.d.ts +9 -3
  188. package/dist/src/entities/search/options.d.ts +3 -2
  189. package/dist/src/entities/sharing/access.d.ts +50 -9
  190. package/dist/src/entities/spreadsheets/spreadsheet.d.ts +201 -0
  191. package/dist/src/entities/suggestions/namespace.d.ts +118 -0
  192. package/dist/src/entities/suggestions/suggestion.d.ts +172 -0
  193. package/dist/src/entities/suggestions/suggestion.test.d.ts +1 -0
  194. package/dist/src/entities/tasks/namespace.d.ts +18 -5
  195. package/dist/src/entities/tasks/task.d.ts +21 -3
  196. package/dist/src/entities/teams/invite.d.ts +3 -0
  197. package/dist/src/entities/teams/namespace.d.ts +10 -2
  198. package/dist/src/entities/teams/team.d.ts +22 -2
  199. package/dist/src/entities/ui/app-link.d.ts +24 -0
  200. package/dist/src/entities/ui/namespace.d.ts +75 -0
  201. package/dist/src/entities/unfurls/namespace.d.ts +12 -2
  202. package/dist/src/entities/users/namespace.d.ts +26 -4
  203. package/dist/src/entities/users/profile-picture.d.ts +29 -0
  204. package/dist/src/entities/users/profile-picture.test.d.ts +1 -0
  205. package/dist/src/entities/users/user.d.ts +52 -1
  206. package/dist/src/entities/web/namespace.d.ts +6 -0
  207. package/dist/src/entities/webhooks/namespace.d.ts +5 -0
  208. package/dist/src/entities/webhooks/webhook.d.ts +47 -7
  209. package/dist/src/entities/whatsapp/account.d.ts +5 -1
  210. package/dist/src/entities/whatsapp/chat.d.ts +9 -1
  211. package/dist/src/entities/whatsapp/namespace.d.ts +7 -1
  212. package/dist/src/entities/workspace/namespace.d.ts +12 -4
  213. package/dist/src/entities/workspace/query.d.ts +5 -1
  214. package/dist/src/entities/workspace/query.test.d.ts +1 -0
  215. package/dist/src/events/hydrate/document.d.ts +5 -0
  216. package/dist/src/events/hydrate/user.d.ts +14 -0
  217. package/dist/src/events/receiver.d.ts +2 -0
  218. package/dist/src/events/types.d.ts +2 -1
  219. package/dist/src/macro.d.ts +59 -6
  220. package/dist/src/macro.js +18710 -10355
  221. package/dist/src/utils/activity.d.ts +2 -0
  222. package/dist/src/utils/index.d.ts +1 -1
  223. package/dist/src/utils/lazy.d.ts +20 -1
  224. package/dist/src/utils/options.d.ts +7 -0
  225. package/dist/src/utils/pagination.d.ts +16 -0
  226. package/dist/src/utils/verbs.d.ts +3 -0
  227. package/package.json +1 -1
  228. package/dist/src/entities/crm/comment.d.ts +0 -64
@@ -1,6 +1,17 @@
1
1
  export type ClientOptions = {
2
2
  baseUrl: `${string}://${string}` | (string & {});
3
3
  };
4
+ /**
5
+ * Acting on a suggestion, as the caller's copy of it shows it.
6
+ */
7
+ export type AcceptSuggestionRequest = {
8
+ /**
9
+ * The suggestion's `updatedAt` as the caller read it. A background suggestion runs
10
+ * only if it is unchanged since and no run of it is still settling;
11
+ * otherwise the answer is 409.
12
+ */
13
+ updatedAt: string;
14
+ };
4
15
  /**
5
16
  * Client configuration, the create body. Ownership and execution state are
6
17
  * server-owned.
@@ -17,9 +28,7 @@ export type ActionConfiguration = {
17
28
  * Omitted by clients that predate the setting; runs then start unlisted.
18
29
  */
19
30
  run_visibility?: RunVisibility;
20
- task: {
21
- [key: string]: unknown;
22
- };
31
+ task: RoutineTask;
23
32
  trigger: ActionTrigger;
24
33
  };
25
34
  /**
@@ -41,9 +50,7 @@ export type ActionConfigurationUpdate = {
41
50
  kind: ActionKind;
42
51
  name: string;
43
52
  run_visibility?: null | RunVisibility;
44
- task: {
45
- [key: string]: unknown;
46
- };
53
+ task: RoutineTask;
47
54
  trigger: ActionTrigger;
48
55
  };
49
56
  export type ActionExecutionRecord = {
@@ -96,6 +103,21 @@ export type AgentMcpServer = {
96
103
  */
97
104
  server_name: string;
98
105
  };
106
+ /**
107
+ * Hand the run to a model running as Macro, or to an agent.
108
+ */
109
+ export type AgentStep = {
110
+ agent?: null | AgentTaskAgent;
111
+ /**
112
+ * What the model or agent should do. It also sees the triggering event
113
+ * and what earlier steps in this run did.
114
+ */
115
+ instructions: string;
116
+ /**
117
+ * Required when no agent is selected; otherwise overrides the agent's default model.
118
+ */
119
+ model?: string | null;
120
+ };
99
121
  /**
100
122
  * The single agent task: how routines were stored before they had steps,
101
123
  * and still how a routine that is only an agent is saved.
@@ -140,6 +162,203 @@ export type AiAdmissionErrorBody = {
140
162
  */
141
163
  error: string;
142
164
  };
165
+ /**
166
+ * Named tint keys from the shared tag color palette.
167
+ */
168
+ export type AppearanceColor = 'gray' | 'red' | 'tomato' | 'orange' | 'amber' | 'yellow' | 'green' | 'teal' | 'blue' | 'indigo' | 'purple' | 'pink';
169
+ /**
170
+ * The source of an entity's custom icon.
171
+ */
172
+ export type AppearanceIcon = {
173
+ kind: 'macro';
174
+ /**
175
+ * Catalog name without the SVG extension.
176
+ */
177
+ name: string;
178
+ } | {
179
+ kind: 'emoji';
180
+ /**
181
+ * Unicode emoji text, not markup or a URL.
182
+ */
183
+ value: string;
184
+ };
185
+ /**
186
+ * A reply draft a session wrote for an open reply suggestion, as the user,
187
+ * through `macro.email.createDraft`. It replaces the suggestion's draft, if any;
188
+ * nothing is ever sent.
189
+ */
190
+ export type AttachDraft = {
191
+ /**
192
+ * The email draft: an unsent draft in one of the user's own inboxes, in
193
+ * the thread the suggestion is about.
194
+ */
195
+ emailDraftId: string;
196
+ /**
197
+ * Why, for the change log.
198
+ */
199
+ reason: string;
200
+ };
201
+ /**
202
+ * One of Macro's routines, ready to start a new routine from.
203
+ */
204
+ export type CatalogEntry = {
205
+ /**
206
+ * What it does, in a few words, for the line beside its trigger.
207
+ */
208
+ action: string;
209
+ /**
210
+ * It changes or sends what other people see.
211
+ */
212
+ affectsOthers: boolean;
213
+ code?: null | RoutineStep;
214
+ /**
215
+ * What it does, in a short line.
216
+ */
217
+ description: string;
218
+ /**
219
+ * The Ask AI step's instructions: its only step without code, and the
220
+ * step to use where code can't be saved.
221
+ */
222
+ instructions: string;
223
+ /**
224
+ * Names it, e.g. `inbox`.
225
+ */
226
+ key: string;
227
+ /**
228
+ * The code step's text knobs whose value names one of the owner's
229
+ * items (a tag, channel or label), by knob name.
230
+ */
231
+ namedKnobs: {
232
+ [key: string]: NamedItemKind;
233
+ };
234
+ /**
235
+ * What someone asks for, with when it runs.
236
+ */
237
+ request: string;
238
+ /**
239
+ * It may be switched on before its owner changes anything.
240
+ */
241
+ safeDefault: boolean;
242
+ /**
243
+ * Offered unpicked as a suggestion from Macro.
244
+ */
245
+ suggest: boolean;
246
+ /**
247
+ * Where it is offered, first the part of the app it belongs to most.
248
+ */
249
+ surfaces: Array<Surface>;
250
+ /**
251
+ * Offered among the templates when someone creates a routine.
252
+ */
253
+ template: boolean;
254
+ /**
255
+ * Its name once saved.
256
+ */
257
+ title: string;
258
+ /**
259
+ * When it runs; schedules are in the zone the catalog was asked for.
260
+ */
261
+ trigger: ActionTrigger;
262
+ };
263
+ /**
264
+ * A filter on the feed. Not kinds: a suggestion may have several.
265
+ */
266
+ export type Category = 'important' | 'revisit' | 'save_money' | 'make_money';
267
+ /**
268
+ * A routine to check, as the create body takes it.
269
+ */
270
+ export type CheckRoutineRequest = {
271
+ /**
272
+ * What a routine draft's session created for the routine to use, such as
273
+ * the database it writes to; kept with its draft for the person to see.
274
+ */
275
+ created?: Array<CreatedItem>;
276
+ routine: ActionConfiguration;
277
+ };
278
+ /**
279
+ * A routine the session handed back, as a person watching reads it: never
280
+ * its code.
281
+ */
282
+ export type CheckSummary = {
283
+ /**
284
+ * How many checks the session made so far, this one included.
285
+ */
286
+ checks: number;
287
+ name: string;
288
+ /**
289
+ * Whether it passed.
290
+ */
291
+ ok: boolean;
292
+ /**
293
+ * How many problems it has, its code's included.
294
+ */
295
+ problems: number;
296
+ /**
297
+ * Its steps, in order.
298
+ */
299
+ steps: Array<StepTitle>;
300
+ /**
301
+ * When it would run.
302
+ */
303
+ trigger: ActionTrigger;
304
+ };
305
+ /**
306
+ * A code step that doesn't type-check.
307
+ */
308
+ export type CheckedStepProblems = {
309
+ /**
310
+ * Its place among the routine's steps, from zero.
311
+ */
312
+ index: number;
313
+ /**
314
+ * What the type checker reports, first problems first.
315
+ */
316
+ problems: Array<string>;
317
+ /**
318
+ * Its title.
319
+ */
320
+ title: string;
321
+ };
322
+ /**
323
+ * Who a routine's code steps write as.
324
+ */
325
+ export type CodeIdentity = 'agent' | 'owner';
326
+ /**
327
+ * TypeScript written against Macro's SDK, usually by the AI that built the
328
+ * routine. It is type-checked before it is saved and runs with its owner's
329
+ * access.
330
+ */
331
+ export type CodeStep = {
332
+ id?: null | StepId;
333
+ /**
334
+ * Values its owner can change without new code, which the code reads
335
+ * as `knobs.<name>`.
336
+ */
337
+ knobs?: Array<RoutineKnob>;
338
+ /**
339
+ * What it does as one sentence for its owner, with `{name}` where a
340
+ * knob's value shows and `{?name}` where a question knob's question
341
+ * shows, e.g. "Label it {label} when {?aboutMoney}". Saving checks every
342
+ * slot names one of its knobs.
343
+ */
344
+ sentence?: string | null;
345
+ /**
346
+ * A module exporting `async function main({ macro, run, routine,
347
+ * trigger, steps }: StepContext)`: `run` is this run (its time, zone and
348
+ * the previous run), `trigger` what started it (a schedule, an event and
349
+ * its item, or a person), `steps` the typed outputs of the steps before
350
+ * it. What `main` returns, as JSON of at most 64 KB, is the step's output.
351
+ */
352
+ source: string;
353
+ /**
354
+ * One or two sentences on how, for the routine's owner.
355
+ */
356
+ summary?: string;
357
+ /**
358
+ * What the step does, in a few words, e.g. "Label invoices".
359
+ */
360
+ title: string;
361
+ };
143
362
  /**
144
363
  * One time a routine's code was brought to a new SDK.
145
364
  */
@@ -154,19 +373,12 @@ export type CodeUpgrade = {
154
373
  /**
155
374
  * The task before.
156
375
  */
157
- previousTask: {
158
- [key: string]: unknown;
159
- };
376
+ previousTask: RoutineTask;
160
377
  /**
161
378
  * Why the routine needs its owner.
162
379
  */
163
380
  reason?: string | null;
164
- /**
165
- * The saved rewrite, or the rewrite that failed its checks.
166
- */
167
- task?: {
168
- [key: string]: unknown;
169
- } | null;
381
+ task?: null | RoutineTask;
170
382
  /**
171
383
  * The SDK it was brought to.
172
384
  */
@@ -185,6 +397,28 @@ export type ConditionResult = {
185
397
  } | {
186
398
  status: 'unavailable';
187
399
  };
400
+ /**
401
+ * Something a routine draft's session created for the routine to use, such
402
+ * as the database it writes to: it exists whether or not the routine is
403
+ * saved.
404
+ */
405
+ export type CreatedItem = {
406
+ /**
407
+ * Its id.
408
+ */
409
+ entityId: string;
410
+ /**
411
+ * What kind of item.
412
+ */
413
+ entityType: 'user' | 'chat' | 'channel' | 'channel_message' | 'document' | 'project' | 'email_thread' | 'calendar_event' | 'team' | 'call' | 'foreign_entity' | 'static_file' | 'crm_company' | 'crm_contact' | 'crm_pipeline' | 'reminder' | 'harness' | 'skill' | 'agent_session' | 'scheduled_action' | 'initiative' | 'database' | 'database_row' | 'form' | 'external_chat';
414
+ };
415
+ /**
416
+ * A routine a run created, as that run's history names it.
417
+ */
418
+ export type CreatedRoutine = {
419
+ id: string;
420
+ name: string;
421
+ };
188
422
  /**
189
423
  * What AI drafted, or why it couldn't.
190
424
  */
@@ -193,11 +427,24 @@ export type Draft = (DraftedRoutine & {
193
427
  }) | (DraftedStep & {
194
428
  outcome: 'step';
195
429
  }) | {
430
+ created?: Array<DraftCreated>;
196
431
  message: string;
197
432
  outcome: 'failed';
198
433
  };
199
434
  /**
200
- * What the drafter may write, and the person's workspace by name and id.
435
+ * What a job was asked to draft, as its owner reads it back: the kind of
436
+ * request and the words they typed, nothing it was sent with them.
437
+ */
438
+ export type DraftAsked = {
439
+ /**
440
+ * The words they typed: the description, or the change asked for.
441
+ */
442
+ description: string;
443
+ kind: DraftKind;
444
+ };
445
+ /**
446
+ * What the drafter may write. It looks up the items the person's words
447
+ * name itself, with their access.
201
448
  */
202
449
  export type DraftContext = {
203
450
  /**
@@ -218,8 +465,71 @@ export type DraftContext = {
218
465
  * IANA time zone schedules are written in, e.g. `America/New_York`.
219
466
  */
220
467
  timezone: string;
221
- workspace?: Workspace;
222
468
  };
469
+ /**
470
+ * Something a draft's session created. It exists whether or not the draft
471
+ * is saved.
472
+ */
473
+ export type DraftCreated = {
474
+ /**
475
+ * Its id.
476
+ */
477
+ entityId: string;
478
+ /**
479
+ * What kind of item.
480
+ */
481
+ entityType: 'user' | 'chat' | 'channel' | 'channel_message' | 'document' | 'project' | 'email_thread' | 'calendar_event' | 'team' | 'call' | 'foreign_entity' | 'static_file' | 'crm_company' | 'crm_contact' | 'crm_pipeline' | 'reminder' | 'harness' | 'skill' | 'agent_session' | 'scheduled_action' | 'initiative' | 'database' | 'database_row' | 'form' | 'external_chat';
482
+ /**
483
+ * Whether the drafted routine uses it. One it doesn't use was made for
484
+ * nothing, or is the routine's own work done early.
485
+ */
486
+ used: boolean;
487
+ };
488
+ /**
489
+ * A background draft, as its owner reads it.
490
+ */
491
+ export type DraftJob = DraftJobState & {
492
+ createdAt: string;
493
+ /**
494
+ * Its id: its hidden session's.
495
+ */
496
+ id: string;
497
+ progress: DraftJobProgress;
498
+ request: DraftAsked;
499
+ };
500
+ /**
501
+ * How far a draft has got: its latest stage, and what it reported on the
502
+ * way.
503
+ */
504
+ export type DraftJobProgress = {
505
+ check?: null | CheckSummary;
506
+ /**
507
+ * How many items the words name were found; absent before they were
508
+ * looked up.
509
+ */
510
+ found?: number | null;
511
+ names?: null | FoundNames;
512
+ stage: DraftStage;
513
+ };
514
+ /**
515
+ * Where a background draft is.
516
+ */
517
+ export type DraftJobState = {
518
+ state: 'drafting';
519
+ } | {
520
+ draft: Draft;
521
+ finishedAt: string;
522
+ state: 'ready';
523
+ } | {
524
+ created: Array<DraftCreated>;
525
+ finishedAt: string;
526
+ message: string;
527
+ state: 'failed';
528
+ };
529
+ /**
530
+ * What kind of draft was asked for.
531
+ */
532
+ export type DraftKind = 'routine' | 'add_step' | 'change_step';
223
533
  /**
224
534
  * What to draft.
225
535
  */
@@ -244,10 +554,31 @@ export type DraftRoutineRequest = {
244
554
  context: DraftContext;
245
555
  draft: DraftRequest;
246
556
  };
557
+ /**
558
+ * The stage a draft is at.
559
+ */
560
+ export type DraftStage = 'started' | 'found' | 'writing' | 'checked' | 'fixing';
561
+ /**
562
+ * How a background draft is going, for its owner's open apps.
563
+ */
564
+ export type DraftUpdate = {
565
+ draftId: string;
566
+ progress: DraftJobProgress;
567
+ state: DraftUpdateState;
568
+ };
569
+ /**
570
+ * Where a background draft is now; `removed` once cancelled or discarded.
571
+ */
572
+ export type DraftUpdateState = 'drafting' | 'ready' | 'failed' | 'removed';
247
573
  /**
248
574
  * A drafted routine.
249
575
  */
250
576
  export type DraftedRoutine = {
577
+ /**
578
+ * What AI created while drafting, such as the database the routine
579
+ * writes to. These exist whether or not the routine is saved.
580
+ */
581
+ created: Array<DraftCreated>;
251
582
  name: string;
252
583
  /**
253
584
  * Steps whose code still fails the type checker.
@@ -257,15 +588,18 @@ export type DraftedRoutine = {
257
588
  * What it does, in the shape a routine's task holds steps, each code
258
589
  * step named as saving names it.
259
590
  */
260
- steps: Array<{
261
- [key: string]: unknown;
262
- }>;
591
+ steps: Array<RoutineStep>;
263
592
  trigger?: null | ActionTrigger;
264
593
  };
265
594
  /**
266
595
  * A drafted step.
267
596
  */
268
597
  export type DraftedStep = {
598
+ /**
599
+ * What AI created while drafting the step. These exist whether or not
600
+ * the step is saved.
601
+ */
602
+ created: Array<DraftCreated>;
269
603
  /**
270
604
  * What the type checker still finds in its code.
271
605
  */
@@ -278,9 +612,7 @@ export type DraftedStep = {
278
612
  /**
279
613
  * The step, in the shape a routine's task holds it.
280
614
  */
281
- step: {
282
- [key: string]: unknown;
283
- };
615
+ step: RoutineStep;
284
616
  };
285
617
  /**
286
618
  * Empty response is required due to custom fetch forcing `response.json()`
@@ -288,6 +620,21 @@ export type DraftedStep = {
288
620
  export type EmptyResponse = {
289
621
  [key: string]: unknown;
290
622
  };
623
+ /**
624
+ * What an entity suggestion suggests doing about its items.
625
+ */
626
+ export type EntityAction = 'reply' | 'review' | 'follow_up';
627
+ /**
628
+ * An entity's optional icon and tint overrides; absent values retain type defaults.
629
+ */
630
+ export type EntityAppearance = {
631
+ color?: null | AppearanceColor;
632
+ icon?: null | AppearanceIcon;
633
+ };
634
+ /**
635
+ * The type of an entity in Macro
636
+ */
637
+ export type EntityType = 'user' | 'chat' | 'channel' | 'channel_message' | 'document' | 'project' | 'email_thread' | 'calendar_event' | 'team' | 'call' | 'foreign_entity' | 'static_file' | 'crm_company' | 'crm_contact' | 'crm_pipeline' | 'reminder' | 'harness' | 'skill' | 'agent_session' | 'scheduled_action' | 'initiative' | 'database' | 'database_row' | 'form' | 'external_chat';
291
638
  /**
292
639
  * An event name AND an entity ID must match within the same filter. A
293
640
  * condition further requires the event's content to answer it with yes.
@@ -321,6 +668,15 @@ export type EventFilters = Array<EventFilter>;
321
668
  * selectors. Adding a broker variant does not automatically enable routines.
322
669
  */
323
670
  export type EventName = 'document.created' | 'document.updated' | 'document.deleted' | 'task.created' | 'task.status_changed' | 'task.priority_changed' | 'task.property_changed' | 'email.message_received' | 'channel.created' | 'channel.message_posted' | 'channel.mentioned' | 'channel.message_patched' | 'channel.message_attachment_created' | 'call.started' | 'call.ended' | 'github';
671
+ /**
672
+ * A finished run, with the routines it created.
673
+ */
674
+ export type ExecutionRecordResponse = ActionExecutionRecord & {
675
+ /**
676
+ * The sub-routines this run created that still follow the routine.
677
+ */
678
+ created?: Array<CreatedRoutine>;
679
+ };
324
680
  /**
325
681
  * Transcript resource created by a run. Never infer this from current task configuration.
326
682
  */
@@ -355,773 +711,2389 @@ export type ExecutionResult = {
355
711
  version: number;
356
712
  };
357
713
  /**
358
- * Which GitHub deliveries match.
714
+ * How many of a person's shown suggestions have each status.
359
715
  */
360
- export type GithubSelector = {
716
+ export type FeedCounts = {
361
717
  /**
362
- * Payload actions, such as `completed` or `opened`; any when empty.
718
+ * Done in the last 24 hours.
363
719
  */
364
- actions?: Array<string>;
720
+ done: number;
365
721
  /**
366
- * GitHub event names, such as `workflow_run` or `pull_request`; any when empty.
722
+ * Their last run failed.
367
723
  */
368
- events?: Array<string>;
724
+ failed: number;
369
725
  /**
370
- * Also run for deliveries caused by bots and apps, including Macro's own.
726
+ * Open, nothing under way.
371
727
  */
372
- includeBots?: boolean;
728
+ open: number;
373
729
  /**
374
- * Repositories as `owner/name`, matched without regard to case; every
375
- * repository the owner's installations cover when empty. A renamed
376
- * repository stops matching until it is chosen again.
730
+ * Their run is under way.
377
731
  */
378
- repositories?: Array<string>;
379
- };
380
- export type InProgressExecution = {
381
- action_id: string;
382
- chat_id?: string | null;
383
- resource?: null | ExecutionResource;
732
+ running: number;
384
733
  };
385
734
  /**
386
- * An item and its name.
735
+ * An item found by the name the words use.
387
736
  */
388
- export type NamedItem = {
389
- id: string;
737
+ export type FoundName = {
738
+ kind: ItemKind;
739
+ /**
740
+ * Its name as stored.
741
+ */
390
742
  name: string;
391
743
  };
392
744
  /**
393
- * `path` walks objects by key; `*` steps into every element of an array and
394
- * a number into one. Give exactly one test. `notIn` also passes when the
395
- * path finds nothing.
745
+ * The items a draft's words name, as the drafter looked them up by name.
746
+ * Names only, as the person wrote them or the items are called: never
747
+ * ids.
396
748
  */
397
- export type PayloadCondition = {
398
- equals?: null | PayloadScalar;
749
+ export type FoundNames = {
399
750
  /**
400
- * Whether the path finds a non-null value.
751
+ * Each the only item of its kinds with the name the words use.
401
752
  */
402
- exists?: boolean | null;
753
+ found: Array<FoundName>;
403
754
  /**
404
- * Some text found matches this glob; `*` matches any run of characters.
755
+ * Names no item has, or several do: the draft leaves them out for the
756
+ * person to pick.
405
757
  */
406
- glob?: string | null;
758
+ left: Array<LeftName>;
759
+ };
760
+ /**
761
+ * The person's generations now, for the web app to show and poll.
762
+ */
763
+ export type GenerationOverview = {
407
764
  /**
408
- * Some value found is one of these.
765
+ * When the latest one that ended ended.
409
766
  */
410
- in?: Array<PayloadScalar> | null;
767
+ lastFinishedAt?: string | null;
768
+ lastOutcome?: null | SuggestionGenerationStatus;
411
769
  /**
412
- * No value found is one of these.
770
+ * When the person may next ask for fresh suggestions, while they may
771
+ * not; absent when they may (or must wait only for the running one).
413
772
  */
414
- notIn?: Array<PayloadScalar> | null;
773
+ regenerateAvailableAt?: string | null;
415
774
  /**
416
- * Keys from the payload's root, e.g. `["workflow_run", "conclusion"]`.
775
+ * When the running one started.
417
776
  */
418
- path: Array<string>;
777
+ startedAt?: string | null;
778
+ /**
779
+ * Whether one is running.
780
+ */
781
+ state: GenerationState;
782
+ trigger?: null | GenerationTrigger;
419
783
  };
420
784
  /**
421
- * A JSON text, number, boolean or null that payload values are compared with.
422
- */
423
- export type PayloadScalar = null | boolean | number | string;
424
- /**
425
- * Narrows a task property change filter to one property and, optionally, the
426
- * values it must gain.
785
+ * What starting a generation did.
427
786
  */
428
- export type PropertySelector = {
787
+ export type GenerationStarted = {
429
788
  /**
430
- * The property definition that must have changed.
431
- */
432
- definitionId: string;
433
- /**
434
- * Select option ids or referenced entity ids, one of which the change must
435
- * add. Any change to the property matches when empty.
789
+ * Whether a run started; false when one ran before or is running.
436
790
  */
437
- values?: Array<string>;
791
+ started: boolean;
438
792
  };
439
793
  /**
440
- * A nonblank model identifier. Runtime catalogs, not the scheduler, own availability.
794
+ * Whether one of the person's generations is running.
441
795
  */
442
- export type RoutineModelId = string;
796
+ export type GenerationState = 'idle' | 'running';
443
797
  /**
444
- * The routine a step is added to or changed in.
798
+ * Where a person's suggestions are in being generated.
445
799
  */
446
- export type RoutineSoFar = {
447
- /**
448
- * Its steps, in the shape a routine's task holds them.
449
- */
450
- steps: Array<{
451
- [key: string]: unknown;
452
- }>;
453
- /**
454
- * Its trigger as it would be saved, for AI to read; absent while it has none.
455
- */
456
- trigger?: {
457
- [key: string]: unknown;
458
- } | null;
459
- };
800
+ export type GenerationStatus = 'none' | 'generating' | 'ready' | 'failed';
460
801
  /**
461
- * A shared routine's snapshot, readable by signed-in users with sharing enabled.
802
+ * What starts a generation: a person finishing onboarding, their night, or
803
+ * the person asking for fresh suggestions. Shared by everything a
804
+ * generation's sessions write.
462
805
  */
463
- export type RoutineTemplate = {
806
+ export type GenerationTrigger = 'onboarding' | 'nightly' | 'manual';
807
+ /**
808
+ * Which GitHub deliveries match.
809
+ */
810
+ export type GithubSelector = {
464
811
  /**
465
- * Routines activated from this template, including stopped ones.
812
+ * Payload actions, such as `completed` or `opened`; any when empty.
466
813
  */
467
- active_count: number;
814
+ actions?: Array<string>;
468
815
  /**
469
- * Who shared it: the source routine's owner.
816
+ * GitHub event names, such as `workflow_run` or `pull_request`; any when empty.
470
817
  */
471
- author: string;
472
- created_at: string;
473
- description: string;
818
+ events?: Array<string>;
474
819
  /**
475
- * The routine it was shared from.
820
+ * Also run for deliveries caused by bots and apps, including Macro's own.
476
821
  */
477
- id: string;
478
- name: string;
479
- task: {
480
- [key: string]: unknown;
481
- };
482
- trigger: ActionTrigger;
483
- updated_at: string;
484
- variables: Array<TemplateVariable>;
822
+ includeBots?: boolean;
823
+ /**
824
+ * Repositories as `owner/name`, matched without regard to case; every
825
+ * repository the owner's installations cover when empty. A renamed
826
+ * repository stops matching until it is chosen again.
827
+ */
828
+ repositories?: Array<string>;
829
+ };
830
+ export type InProgressExecution = {
831
+ action_id: string;
832
+ chat_id?: string | null;
833
+ resource?: null | ExecutionResource;
485
834
  };
486
835
  /**
487
- * An individual trigger in a routine's trigger list.
836
+ * A kind of item a request can name.
488
837
  */
489
- export type RoutineTrigger = {
490
- schedule: Schedule;
491
- timezone: string;
492
- type: 'cron';
493
- } | {
494
- filters: EventFilters;
495
- type: 'events';
496
- } | {
497
- at: string;
498
- type: 'once';
499
- };
838
+ export type ItemKind = 'channel' | 'person' | 'project' | 'initiative' | 'document' | 'task' | 'database' | 'agent' | 'label' | 'tag' | 'channel_label';
500
839
  /**
501
- * Bounded schedules and one combined set of event filters.
840
+ * A suggestion's kind, without its data.
502
841
  */
503
- export type RoutineTriggers = Array<RoutineTrigger>;
842
+ export type KindName = 'prompt' | 'entity' | 'routine';
504
843
  /**
505
- * What the run page says about a run: what started it, when it counts as
506
- * happening, and since when.
844
+ * How code reads a knob: a lowercase letter, then up to 31 letters or
845
+ * digits, e.g. `dueWithinDays`.
507
846
  */
508
- export type RunInfo = {
847
+ export type KnobName = string;
848
+ /**
849
+ * A name the words use that the drafter couldn't settle on one item for.
850
+ */
851
+ export type LeftName = {
852
+ kind?: null | ItemKind;
509
853
  /**
510
- * When the run counts as happening: its trigger's time.
854
+ * How many items have it: none, or several.
511
855
  */
512
- at: string;
856
+ matches: number;
513
857
  /**
514
- * When the routine's previous finished run started.
858
+ * The name as the words use it.
515
859
  */
516
- previous_at?: string | null;
860
+ name: string;
861
+ };
862
+ /**
863
+ * What a text knob's value names: one of its owner's items, which a client
864
+ * matches by name or lets them pick.
865
+ */
866
+ export type NamedItemKind = 'tag' | 'channel' | 'label';
867
+ /**
868
+ * A new suggestion, or a new version of one with the same `dedupKey`, as a
869
+ * generation session hands it back through `macro.suggestions.suggest`.
870
+ */
871
+ export type NewSuggestion = {
517
872
  /**
518
- * What started it.
873
+ * The items it is about.
519
874
  */
520
- started_by: RunStart;
875
+ about?: Array<Target>;
876
+ action?: null | EntityAction;
521
877
  /**
522
- * The IANA time zone code reads `at` in, when the run had one.
878
+ * The feed's filters it shows under.
523
879
  */
524
- timezone?: string | null;
525
- };
526
- /**
527
- * What started a run, for its page.
528
- */
529
- export type RunStart = {
530
- kind: 'schedule';
880
+ categories?: Array<Category>;
531
881
  /**
532
- * The cron expression.
882
+ * Names the suggestion across nights; the same key updates the same suggestion.
533
883
  */
534
- schedule: string;
884
+ dedupKey: string;
535
885
  /**
536
- * Its IANA time zone.
886
+ * 0 to 100.
537
887
  */
538
- timezone: string;
539
- } | {
888
+ importance: number;
540
889
  /**
541
- * The item the event is about.
890
+ * `prompt` or `entity`; routine suggestions come from `macro.routines.suggest`.
542
891
  */
543
- entity_id?: string | null;
892
+ kind: KindName;
544
893
  /**
545
- * The event's name, e.g. `email.message_received`.
894
+ * A prompt suggestion's prompt.
546
895
  */
547
- event: string;
548
- kind: 'event';
549
- } | {
896
+ prompt?: string | null;
550
897
  /**
551
- * Who started it.
898
+ * Why, for the change log; required to bring back a suggestion the person
899
+ * dismissed.
552
900
  */
553
- by: string;
554
- kind: 'manual';
555
- };
556
- /**
557
- * Whether a routine's runs are listed in Home and the Agents list. Routines
558
- * that run often would bury the owner's own work, so runs start unlisted;
559
- * either way they stay in the routine's history. The string form is the
560
- * `scheduled_action.run_visibility` column's.
561
- */
562
- export type RunVisibility = 'listed' | 'unlisted';
563
- export type Schedule = string;
564
- export type ScheduledAction = {
565
- claimed?: string | null;
901
+ reason?: string | null;
902
+ runMode?: null | RunMode;
566
903
  /**
567
- * Independent of execution bookkeeping in `updated_at`.
904
+ * A background prompt suggestion that posts or sends: what, and where.
568
905
  */
569
- configuration_revision: number;
570
- created_at: string;
906
+ sends?: string | null;
571
907
  /**
572
- * What the routine is for, in the owner's words; empty when unset.
908
+ * Why, in a line or two.
573
909
  */
574
- description?: string;
910
+ summary: string;
575
911
  /**
576
- * When false, automatic dispatch skips this action. `run_now` remains
577
- * available regardless.
912
+ * What to do, in a few words.
578
913
  */
579
- enabled: boolean;
914
+ title: string;
915
+ };
916
+ /**
917
+ * `path` walks objects by key; `*` steps into every element of an array and
918
+ * a number into one. Give exactly one test. `notIn` also passes when the
919
+ * path finds nothing.
920
+ */
921
+ export type PayloadCondition = {
922
+ equals?: null | PayloadScalar;
580
923
  /**
581
- * Event publication boundary; absent for cron actions.
924
+ * Whether the path finds a non-null value.
582
925
  */
583
- event_activated_at?: string | null;
584
- id?: string | null;
585
- kind: ActionKind;
586
- name: string;
926
+ exists?: boolean | null;
587
927
  /**
588
- * Next cron firing, absent for event-triggered actions.
928
+ * Some text found matches this glob; `*` matches any run of characters.
589
929
  */
590
- next_run_at?: string | null;
930
+ glob?: string | null;
591
931
  /**
592
- * Who the action belongs to. Every action is user-owned today, but the
593
- * type no longer says so: the principal string on the wire and in the
594
- * `owner` column is the same, and a bot- or team-owned row decodes
595
- * rather than failing to parse.
932
+ * Some value found is one of these.
596
933
  */
597
- owner: string;
934
+ in?: Array<PayloadScalar> | null;
598
935
  /**
599
- * Whether the action's runs are listed in Home and the Agents list.
936
+ * No value found is one of these.
600
937
  */
601
- run_visibility: RunVisibility;
602
- task: {
603
- [key: string]: unknown;
604
- };
938
+ notIn?: Array<PayloadScalar> | null;
605
939
  /**
606
- * The shared template this routine was activated from, if any.
940
+ * Keys from the payload's root, e.g. `["workflow_run", "conclusion"]`.
607
941
  */
608
- template_id?: string | null;
609
- trigger: ActionTrigger;
610
- updated_at: string;
942
+ path: Array<string>;
611
943
  };
612
944
  /**
613
- * Canonical trigger plus deprecated cron fields for existing clients. Event
614
- * responses omit legacy fields rather than inventing a schedule or timezone.
945
+ * A JSON text, number, boolean or null that payload values are compared with.
615
946
  */
616
- export type ScheduledActionResponse = ScheduledAction & {
617
- last_run?: null | ActionExecutionRecord;
947
+ export type PayloadScalar = null | boolean | number | string;
948
+ /**
949
+ * Narrows a task property change filter to one property and, optionally, the
950
+ * values it must gain.
951
+ */
952
+ export type PropertySelector = {
618
953
  /**
619
- * Deprecated: use `trigger.schedule`. Present only for cron actions.
620
- *
621
- * @deprecated
954
+ * The property definition that must have changed.
622
955
  */
623
- schedule?: string | null;
956
+ definitionId: string;
624
957
  /**
625
- * Deprecated: use `trigger.timezone`. Present only for cron actions.
626
- *
627
- * @deprecated
958
+ * Select option ids or referenced entity ids, one of which the change must
959
+ * add. Any change to the property matches when empty.
628
960
  */
629
- timezone?: string | null;
961
+ values?: Array<string>;
630
962
  };
631
963
  /**
632
- * Live status update for a scheduled-action run, broadcast via the connection
633
- * gateway to the owner. Clients use the typed resource to navigate to the run
634
- * transcript and the variant tag to toggle the running indicator. `chat_id`
635
- * remains populated only for chat runs, for older clients.
636
- *
637
- * Serialized with a `type` tag (`started`/`stopped`) and delivered over the
638
- * single `scheduled_action_update` message type on the gateway.
964
+ * Fresh suggestions weren't started: the person asked within the hour.
639
965
  */
640
- export type ScheduledActionUpdate = {
641
- action_id: string;
642
- chat_id?: string | null;
643
- owner: string;
644
- resource?: null | ExecutionResource;
645
- type: 'started';
646
- } | {
647
- action_id: string;
648
- chat_id?: string | null;
649
- is_success: boolean;
650
- owner: string;
651
- resource?: null | ExecutionResource;
652
- type: 'stopped';
653
- };
654
- export type SetScheduledActionEnabled = {
655
- enabled: boolean;
966
+ export type RegenerationCooldown = {
967
+ /**
968
+ * When they may ask again.
969
+ */
970
+ availableAt: string;
656
971
  };
657
972
  /**
658
- * What the owner supplies when sharing; the rest is snapshotted from the routine.
973
+ * Why fresh suggestions weren't started.
659
974
  */
660
- export type ShareRoutineTemplate = {
661
- description: string;
662
- variables: Array<TemplateVariable>;
663
- };
975
+ export type RegenerationRefusal = 'running';
664
976
  /**
665
- * A starter routine whose step is code: offered when a routine is created,
666
- * and shown to the drafter as a worked example.
977
+ * Fresh suggestions weren't started: a generation is running.
667
978
  */
668
- export type StarterRoutine = {
979
+ export type RegenerationRunning = {
669
980
  /**
670
- * Names it, e.g. `inbox`.
981
+ * Why.
671
982
  */
672
- key: string;
983
+ reason: RegenerationRefusal;
984
+ };
985
+ /**
986
+ * Retiring an open suggestion that no longer fits.
987
+ */
988
+ export type RetireSuggestion = {
673
989
  /**
674
- * What someone asks for, with when it runs.
990
+ * Why, for the change log.
675
991
  */
676
- request: string;
992
+ reason: string;
993
+ };
994
+ /**
995
+ * Retiring an open suggestion that no longer matters.
996
+ */
997
+ export type RetireSuggestionRequest = {
677
998
  /**
678
- * Its steps, in the shape a routine's task holds them.
999
+ * Why, for the change log.
679
1000
  */
680
- steps: Array<{
681
- [key: string]: unknown;
682
- }>;
1001
+ reason: string;
683
1002
  };
684
1003
  /**
685
- * Code written once, or Ask AI each run.
1004
+ * Where one of the person's routine suggestions is.
686
1005
  */
687
- export type StepKind = 'code' | 'agent';
1006
+ export type ReviewedState = 'open' | 'dismissed' | 'retired' | 'saved';
688
1007
  /**
689
- * A drafted step whose code still fails the type checker.
1008
+ * One suggestion AI made for the person, as a routines session reviews it.
690
1009
  */
691
- export type StepProblem = {
1010
+ export type ReviewedSuggestion = SuggestedPick & {
692
1011
  /**
693
- * Its place among the steps, from zero.
1012
+ * When it was dismissed or retired.
694
1013
  */
695
- index: number;
696
- problems: Array<string>;
1014
+ closedAt?: string | null;
1015
+ /**
1016
+ * When it was suggested.
1017
+ */
1018
+ createdAt: string;
1019
+ id: string;
1020
+ keepProbability: number;
1021
+ reason: string;
1022
+ state: ReviewedState;
1023
+ surfaces: Array<Surface>;
697
1024
  };
698
1025
  /**
699
- * A user-specific part of a shared routine.
1026
+ * Changes to an open suggestion; fields left out stay.
700
1027
  */
701
- export type TemplateVariable = {
702
- fill: VariableFill;
703
- id: string;
704
- kind: 'user';
705
- label: string;
706
- } | {
1028
+ export type RewriteSuggestion = {
707
1029
  /**
708
- * The mention's block name, such as `channel` or `md`.
1030
+ * New items it is about.
1031
+ */
1032
+ about?: Array<Target> | null;
1033
+ /**
1034
+ * New categories.
1035
+ */
1036
+ categories?: Array<Category> | null;
1037
+ /**
1038
+ * A new importance.
1039
+ */
1040
+ importance?: number | null;
1041
+ /**
1042
+ * Only on prompt suggestions.
1043
+ */
1044
+ prompt?: string | null;
1045
+ /**
1046
+ * Why, for the change log.
1047
+ */
1048
+ reason: string;
1049
+ /**
1050
+ * Only on background prompt suggestions: what the run posts or sends, and
1051
+ * where.
1052
+ */
1053
+ sends?: string | null;
1054
+ /**
1055
+ * A new summary.
1056
+ */
1057
+ summary?: string | null;
1058
+ /**
1059
+ * A new title.
1060
+ */
1061
+ title?: string | null;
1062
+ };
1063
+ /**
1064
+ * What saving a routine would find wrong, without saving it: the answer to
1065
+ * `POST /scheduled-actions/check`.
1066
+ */
1067
+ export type RoutineCheck = {
1068
+ /**
1069
+ * Whether saving it would succeed: no problems and no failing steps.
1070
+ */
1071
+ ok: boolean;
1072
+ /**
1073
+ * Why saving it would fail, other than its code, for its author.
1074
+ */
1075
+ problems: Array<string>;
1076
+ /**
1077
+ * The routine as saving would store it: code steps named and the SDK
1078
+ * their code checks against stamped.
1079
+ */
1080
+ routine: ActionConfiguration;
1081
+ /**
1082
+ * Code steps that don't type-check against Macro's SDK.
1083
+ */
1084
+ steps: Array<CheckedStepProblems>;
1085
+ };
1086
+ /**
1087
+ * A value a code step reads as `knobs.<name>`, which its owner can change
1088
+ * without the step being rewritten: the label it adds, a priority, a
1089
+ * number of days, a question it asks AI. Its type is part of the step's
1090
+ * type-checked contract; its value is not, so changing it needs no check.
1091
+ */
1092
+ export type RoutineKnob = {
1093
+ /**
1094
+ * What it is, for the owner, e.g. "Label for money email".
709
1095
  */
710
- block_name: string;
711
- fill: VariableFill;
712
- id: string;
713
- kind: 'item';
714
1096
  label: string;
1097
+ /**
1098
+ * How the code reads it: `knobs.<name>`.
1099
+ */
1100
+ name: KnobName;
1101
+ type: 'text';
1102
+ /**
1103
+ * Its value.
1104
+ */
1105
+ value: string;
715
1106
  } | {
716
- fill: VariableFill;
717
- kind: 'time_zone';
1107
+ /**
1108
+ * What it is, for the owner.
1109
+ */
1110
+ label: string;
1111
+ /**
1112
+ * The largest value the owner may set.
1113
+ */
1114
+ max?: number | null;
1115
+ /**
1116
+ * The smallest value the owner may set.
1117
+ */
1118
+ min?: number | null;
1119
+ /**
1120
+ * How the code reads it: `knobs.<name>`.
1121
+ */
1122
+ name: KnobName;
1123
+ type: 'number';
1124
+ /**
1125
+ * Its value.
1126
+ */
1127
+ value: number;
1128
+ } | {
1129
+ /**
1130
+ * What it is, for the owner.
1131
+ */
1132
+ label: string;
1133
+ /**
1134
+ * How the code reads it: `knobs.<name>`.
1135
+ */
1136
+ name: KnobName;
1137
+ type: 'boolean';
1138
+ /**
1139
+ * Its value.
1140
+ */
1141
+ value: boolean;
1142
+ } | {
1143
+ /**
1144
+ * What it is, for the owner.
1145
+ */
1146
+ label: string;
1147
+ /**
1148
+ * How the code reads it: `knobs.<name>`.
1149
+ */
1150
+ name: KnobName;
1151
+ /**
1152
+ * Every option, in the order they are offered.
1153
+ */
1154
+ options: Array<string>;
1155
+ type: 'choice';
1156
+ /**
1157
+ * The chosen option.
1158
+ */
1159
+ value: string;
1160
+ } | {
1161
+ /**
1162
+ * The condition as a short clause that reads inside the step's
1163
+ * sentence, e.g. "it's about money".
1164
+ */
1165
+ label: string;
1166
+ /**
1167
+ * How the code reads it: `knobs.<name>`.
1168
+ */
1169
+ name: KnobName;
1170
+ type: 'question';
1171
+ /**
1172
+ * The question AI is asked, e.g. "Is this email about money:
1173
+ * investors, fundraising or finance?".
1174
+ */
1175
+ value: string;
1176
+ };
1177
+ /**
1178
+ * A nonblank model identifier. Runtime catalogs, not the scheduler, own availability.
1179
+ */
1180
+ export type RoutineModelId = string;
1181
+ /**
1182
+ * What a routine does each time it runs.
1183
+ */
1184
+ export type RoutineProgram = {
1185
+ /**
1186
+ * Code steps write as the owner, with no agent badge: their posts,
1187
+ * comments and emails appear written by the owner. Set only when the
1188
+ * owner explicitly asked for the routine to act or send as them; by
1189
+ * default code steps' writes are attributed to Macro's agent acting for
1190
+ * the owner. Agent ("Ask AI") steps keep their own agent attribution
1191
+ * either way: an agent session speaking as a person is a different
1192
+ * change. A single agent task has no code steps, so it never applies.
1193
+ */
1194
+ dangerously_operate_as_user?: boolean;
1195
+ /**
1196
+ * Apps the routine requires, handed to its agent on top of the agent's
1197
+ * own. The owner must have each one connected to save the routine and
1198
+ * for it to run.
1199
+ */
1200
+ mcp_servers?: Array<AgentMcpServer>;
1201
+ sdk?: null | SdkFingerprint;
1202
+ /**
1203
+ * Steps run in order. A failed step stops the run.
1204
+ */
1205
+ steps: Array<RoutineStep>;
1206
+ };
1207
+ /**
1208
+ * A part of a routine's sentence.
1209
+ */
1210
+ export type RoutineSentencePart = {
1211
+ /**
1212
+ * It is a value AI picked, which the person can change.
1213
+ */
1214
+ picked: boolean;
1215
+ /**
1216
+ * What it says.
1217
+ */
1218
+ text: string;
1219
+ };
1220
+ /**
1221
+ * The routine a step is added to or changed in.
1222
+ */
1223
+ export type RoutineSoFar = {
1224
+ /**
1225
+ * Its steps, in the shape a routine's task holds them.
1226
+ */
1227
+ steps: Array<RoutineStep>;
1228
+ /**
1229
+ * Its trigger as it would be saved, for AI to read; absent while it has none.
1230
+ */
1231
+ trigger?: {
1232
+ [key: string]: unknown;
1233
+ } | null;
1234
+ };
1235
+ /**
1236
+ * One step of a routine.
1237
+ */
1238
+ export type RoutineStep = (CodeStep & {
1239
+ type: 'code';
1240
+ }) | (AgentStep & {
1241
+ type: 'agent';
1242
+ });
1243
+ /**
1244
+ * A routine offered to one person: one AI suggested for them, or one of
1245
+ * Macro's catalog routines filling a surface.
1246
+ */
1247
+ export type RoutineSuggestion = SuggestedPick & {
1248
+ /**
1249
+ * Who suggests it: AI, for this person, or Macro, as a template.
1250
+ */
1251
+ from: SuggestionFrom;
1252
+ /**
1253
+ * Saving a routine from it passes this as `suggestion_id`; dismissing
1254
+ * it uses it too.
1255
+ */
1256
+ id: string;
1257
+ /**
1258
+ * AI's estimate, from 0 to 1, that the person keeps it on; absent on
1259
+ * Macro's templates.
1260
+ */
1261
+ keepProbability?: number | null;
1262
+ /**
1263
+ * Onboarding shows it switched on: one of at most two catalog
1264
+ * routines AI picked that are safe by default and likely kept. Never a
1265
+ * drafted routine or a template.
1266
+ */
1267
+ onByDefault: boolean;
1268
+ /**
1269
+ * Why it fits this person, in a line; absent on Macro's templates.
1270
+ */
1271
+ reason?: string | null;
1272
+ /**
1273
+ * The sidebars it shows in, first the one it belongs to most.
1274
+ * Dismissing it in one dismisses it everywhere.
1275
+ */
1276
+ surfaces: Array<Surface>;
1277
+ };
1278
+ /**
1279
+ * How a drafted routine suggestion shows in the person's Suggestions feed:
1280
+ * every routine a session drafts is also one suggestion there, kept and
1281
+ * closed with it.
1282
+ */
1283
+ export type RoutineSuggestionCard = {
1284
+ /**
1285
+ * The feed's filters it shows under.
1286
+ */
1287
+ categories?: Array<Category>;
1288
+ /**
1289
+ * 0 to 100: how much the person would regret missing it this week.
1290
+ */
1291
+ importance: number;
1292
+ /**
1293
+ * What it does for the person, in a few words.
1294
+ */
1295
+ title: string;
1296
+ };
1297
+ /**
1298
+ * A person's suggestions, and whether more are on the way.
1299
+ */
1300
+ export type RoutineSuggestions = {
1301
+ status: GenerationStatus;
1302
+ /**
1303
+ * Per surface, AI's first, best first, then Macro's templates, so each
1304
+ * surface has at least one and ideally three. A suggestion with
1305
+ * several surfaces appears once.
1306
+ */
1307
+ suggestions: Array<RoutineSuggestion>;
1308
+ };
1309
+ /**
1310
+ * A stored task's two forms, as the scheduler's API describes `task`:
1311
+ * [`RoutineProgram::from_task`] reads them.
1312
+ */
1313
+ export type RoutineTask = RoutineProgram | AgentTask;
1314
+ /**
1315
+ * A shared routine's snapshot, readable by signed-in users with sharing enabled.
1316
+ */
1317
+ export type RoutineTemplate = {
1318
+ /**
1319
+ * Routines activated from this template, including stopped ones.
1320
+ */
1321
+ active_count: number;
1322
+ appearance: EntityAppearance;
1323
+ /**
1324
+ * Who shared it: the source routine's owner.
1325
+ */
1326
+ author: string;
1327
+ created_at: string;
1328
+ description: string;
1329
+ /**
1330
+ * The routine it was shared from.
1331
+ */
1332
+ id: string;
1333
+ name: string;
1334
+ task: RoutineTask;
1335
+ trigger: ActionTrigger;
1336
+ updated_at: string;
1337
+ variables: Array<TemplateVariable>;
1338
+ };
1339
+ /**
1340
+ * How a routine suggestion's drafted routine reads on its card.
1341
+ */
1342
+ export type RoutineText = {
1343
+ /**
1344
+ * What it does: a step's sentence with the values AI picked marked, or
1345
+ * its description (else its name) as one unmarked part.
1346
+ */
1347
+ sentence: Array<RoutineSentencePart>;
1348
+ /**
1349
+ * When it runs, e.g. "Fridays at 9:00 AM" or "New email received".
1350
+ */
1351
+ when: string;
1352
+ };
1353
+ /**
1354
+ * An individual trigger in a routine's trigger list.
1355
+ */
1356
+ export type RoutineTrigger = {
1357
+ schedule: Schedule;
1358
+ timezone: string;
1359
+ type: 'cron';
1360
+ } | {
1361
+ filters: EventFilters;
1362
+ type: 'events';
1363
+ } | {
1364
+ at: string;
1365
+ type: 'once';
1366
+ };
1367
+ /**
1368
+ * Bounded schedules and one combined set of event filters.
1369
+ */
1370
+ export type RoutineTriggers = Array<RoutineTrigger>;
1371
+ /**
1372
+ * What the run page says about a run: what started it, when it counts as
1373
+ * happening, and since when.
1374
+ */
1375
+ export type RunInfo = {
1376
+ /**
1377
+ * When the run counts as happening: its trigger's time.
1378
+ */
1379
+ at: string;
1380
+ code_acts_as?: null | CodeIdentity;
1381
+ /**
1382
+ * When the routine's previous finished run started.
1383
+ */
1384
+ previous_at?: string | null;
1385
+ /**
1386
+ * What started it.
1387
+ */
1388
+ started_by: RunStart;
1389
+ /**
1390
+ * The IANA time zone code reads `at` in, when the run had one.
1391
+ */
1392
+ timezone?: string | null;
1393
+ };
1394
+ /**
1395
+ * How a prompt suggestion runs.
1396
+ */
1397
+ export type RunMode = 'composer' | 'background';
1398
+ /**
1399
+ * What started a run, for its page.
1400
+ */
1401
+ export type RunStart = {
1402
+ kind: 'schedule';
1403
+ /**
1404
+ * The cron expression.
1405
+ */
1406
+ schedule: string;
1407
+ /**
1408
+ * Its IANA time zone.
1409
+ */
718
1410
  timezone: string;
1411
+ } | {
1412
+ /**
1413
+ * The item the event is about.
1414
+ */
1415
+ entity_id?: string | null;
1416
+ /**
1417
+ * The event's name, e.g. `email.message_received`.
1418
+ */
1419
+ event: string;
1420
+ kind: 'event';
1421
+ } | {
1422
+ /**
1423
+ * Who started it.
1424
+ */
1425
+ by: string;
1426
+ kind: 'manual';
1427
+ };
1428
+ /**
1429
+ * A run's state without its data: how it is stored and served.
1430
+ */
1431
+ export type RunStateName = 'starting' | 'running' | 'waiting' | 'stopping' | 'cancelling' | 'finished' | 'failed' | 'cancelled';
1432
+ /**
1433
+ * Whether a routine's runs are listed in Home and the Agents list. Routines
1434
+ * that run often would bury the owner's own work, so runs start unlisted;
1435
+ * either way they stay in the routine's history. The string form is the
1436
+ * `scheduled_action.run_visibility` column's.
1437
+ */
1438
+ export type RunVisibility = 'listed' | 'unlisted';
1439
+ export type Schedule = string;
1440
+ export type ScheduledAction = {
1441
+ /**
1442
+ * Optional presentation overrides; absent values use routine defaults.
1443
+ */
1444
+ appearance?: EntityAppearance;
1445
+ claimed?: string | null;
1446
+ /**
1447
+ * Independent of execution bookkeeping in `updated_at`.
1448
+ */
1449
+ configuration_revision: number;
1450
+ created_at: string;
1451
+ /**
1452
+ * What the routine is for, in the owner's words; empty when unset.
1453
+ */
1454
+ description?: string;
1455
+ /**
1456
+ * When false, automatic dispatch skips this action. `run_now` remains
1457
+ * available regardless.
1458
+ */
1459
+ enabled: boolean;
1460
+ /**
1461
+ * Event publication boundary; absent for cron actions.
1462
+ */
1463
+ event_activated_at?: string | null;
1464
+ id?: string | null;
1465
+ kind: ActionKind;
1466
+ name: string;
1467
+ /**
1468
+ * Next cron firing, absent for event-triggered actions.
1469
+ */
1470
+ next_run_at?: string | null;
1471
+ /**
1472
+ * Who the action belongs to. Every action is user-owned today, but the
1473
+ * type no longer says so: the principal string on the wire and in the
1474
+ * `owner` column is the same, and a bot- or team-owned row decodes
1475
+ * rather than failing to parse.
1476
+ */
1477
+ owner: string;
1478
+ /**
1479
+ * Whether the action's runs are listed in Home and the Agents list.
1480
+ */
1481
+ run_visibility: RunVisibility;
1482
+ sub_routine?: null | SubRoutine;
1483
+ /**
1484
+ * The routine suggestion it was saved from, if any: a plain pointer
1485
+ * that stays after the suggestion is replaced.
1486
+ */
1487
+ suggestion_id?: string | null;
1488
+ task: RoutineTask;
1489
+ /**
1490
+ * The shared template this routine was activated from, if any.
1491
+ */
1492
+ template_id?: string | null;
1493
+ trigger: ActionTrigger;
1494
+ updated_at: string;
1495
+ };
1496
+ /**
1497
+ * Canonical trigger plus deprecated cron fields for existing clients. Event
1498
+ * responses omit legacy fields rather than inventing a schedule or timezone.
1499
+ */
1500
+ export type ScheduledActionResponse = ScheduledAction & {
1501
+ last_run?: null | ActionExecutionRecord;
1502
+ /**
1503
+ * Deprecated: use `trigger.schedule`. Present only for cron actions.
1504
+ *
1505
+ * @deprecated
1506
+ */
1507
+ schedule?: string | null;
1508
+ /**
1509
+ * Deprecated: use `trigger.timezone`. Present only for cron actions.
1510
+ *
1511
+ * @deprecated
1512
+ */
1513
+ timezone?: string | null;
1514
+ };
1515
+ /**
1516
+ * Live status update for a scheduled-action run, broadcast via the connection
1517
+ * gateway to the owner. Clients use the typed resource to navigate to the run
1518
+ * transcript and the variant tag to toggle the running indicator. `chat_id`
1519
+ * remains populated only for chat runs, for older clients.
1520
+ *
1521
+ * Serialized with a `type` tag (`started`/`stopped`) and delivered over the
1522
+ * single `scheduled_action_update` message type on the gateway.
1523
+ */
1524
+ export type ScheduledActionUpdate = {
1525
+ action_id: string;
1526
+ chat_id?: string | null;
1527
+ owner: string;
1528
+ resource?: null | ExecutionResource;
1529
+ type: 'started';
1530
+ } | {
1531
+ action_id: string;
1532
+ chat_id?: string | null;
1533
+ is_success: boolean;
1534
+ owner: string;
1535
+ resource?: null | ExecutionResource;
1536
+ type: 'stopped';
1537
+ };
1538
+ /**
1539
+ * Identifies the SDK API code was type-checked against: its version and a
1540
+ * hash of its declarations, e.g. `0.2.2+18cc1c19c35c`.
1541
+ */
1542
+ export type SdkFingerprint = string;
1543
+ export type SetScheduledActionEnabled = {
1544
+ enabled: boolean;
1545
+ };
1546
+ /**
1547
+ * What the owner supplies when sharing; the rest is snapshotted from the routine.
1548
+ */
1549
+ export type ShareRoutineTemplate = {
1550
+ description: string;
1551
+ variables: Array<TemplateVariable>;
1552
+ };
1553
+ /**
1554
+ * A background draft to start: what the blocking route takes, and the id
1555
+ * the client made for this start.
1556
+ */
1557
+ export type StartDraftJobRequest = {
1558
+ /**
1559
+ * Made by the client, once per start. Sent again with it (as when the
1560
+ * connection drops before the answer), the start answers with the job
1561
+ * it began, starting nothing, until that job is discarded.
1562
+ */
1563
+ clientId: string;
1564
+ context: DraftContext;
1565
+ draft: DraftRequest;
1566
+ };
1567
+ /**
1568
+ * Names a step's output: a lowercase letter, then up to 31 lowercase
1569
+ * letters, digits or underscores.
1570
+ */
1571
+ export type StepId = string;
1572
+ /**
1573
+ * Code written once, or Ask AI each run.
1574
+ */
1575
+ export type StepKind = 'code' | 'agent';
1576
+ /**
1577
+ * A drafted step whose code still fails the type checker.
1578
+ */
1579
+ export type StepProblem = {
1580
+ /**
1581
+ * Its place among the steps, from zero.
1582
+ */
1583
+ index: number;
1584
+ problems: Array<string>;
1585
+ };
1586
+ /**
1587
+ * A step of a routine handed back.
1588
+ */
1589
+ export type StepTitle = {
1590
+ kind: StepKind;
1591
+ /**
1592
+ * Its title; empty when it has none.
1593
+ */
1594
+ title: string;
1595
+ };
1596
+ /**
1597
+ * How a routine created by a routine's run belongs to that routine.
1598
+ */
1599
+ export type SubRoutine = {
1600
+ /**
1601
+ * The run that created it: the id of that run's history record, which
1602
+ * exists once the run ends.
1603
+ */
1604
+ created_by_run_id: string;
1605
+ /**
1606
+ * The name its creating code gave it, when it gave one.
1607
+ */
1608
+ key?: string | null;
1609
+ /**
1610
+ * The top-level routine it follows: pausing that routine pauses it, and
1611
+ * deleting that routine deletes it. A routine a sub-routine's run
1612
+ * creates follows the same top-level routine.
1613
+ */
1614
+ parent_id: string;
1615
+ /**
1616
+ * It is off because its parent was switched off, and resumes with it.
1617
+ */
1618
+ paused_by_parent?: boolean;
1619
+ };
1620
+ /**
1621
+ * What became of a suggestion handed back.
1622
+ */
1623
+ export type SuggestOutcome = {
1624
+ check?: null | RoutineCheck;
1625
+ /**
1626
+ * The kept suggestion's id.
1627
+ */
1628
+ id?: string | null;
1629
+ /**
1630
+ * Whether it was kept.
1631
+ */
1632
+ ok: boolean;
1633
+ /**
1634
+ * Why it wasn't, to fix and suggest again.
1635
+ */
1636
+ problems: Array<string>;
1637
+ };
1638
+ /**
1639
+ * What a suggestion session hands back through `macro.routines.suggest`.
1640
+ */
1641
+ export type SuggestRequest = {
1642
+ card?: null | RoutineSuggestionCard;
1643
+ keepProbability: number;
1644
+ key: string;
1645
+ kind: 'catalog';
1646
+ knobs?: {
1647
+ [key: string]: unknown;
1648
+ };
1649
+ reason: string;
1650
+ surfaces: Array<Surface>;
1651
+ } | {
1652
+ /**
1653
+ * How it shows in the person's Suggestions feed.
1654
+ */
1655
+ card: RoutineSuggestionCard;
1656
+ /**
1657
+ * What the session created for it, as `macro.routines.check` takes.
1658
+ */
1659
+ created?: Array<CreatedItem>;
1660
+ keepProbability: number;
1661
+ kind: 'routine';
1662
+ reason: string;
1663
+ routine: ActionConfiguration;
1664
+ surfaces: Array<Surface>;
1665
+ };
1666
+ /**
1667
+ * What is suggested: a catalog routine with its knobs, or a routine AI
1668
+ * drafted and checked.
1669
+ */
1670
+ export type SuggestedPick = {
1671
+ /**
1672
+ * The catalog routine, e.g. `inbox`.
1673
+ */
1674
+ key: string;
1675
+ kind: 'catalog';
1676
+ /**
1677
+ * Knob values by knob name; knobs left out keep the catalog's.
1678
+ */
1679
+ knobs: {
1680
+ [key: string]: unknown;
1681
+ };
1682
+ } | {
1683
+ kind: 'routine';
1684
+ routine: ActionConfiguration;
1685
+ };
1686
+ /**
1687
+ * One proactive suggestion for one person.
1688
+ */
1689
+ export type Suggestion = SuggestionKind & {
1690
+ /**
1691
+ * The items it is about.
1692
+ */
1693
+ about: Array<Target>;
1694
+ /**
1695
+ * The feed's filters it shows under.
1696
+ */
1697
+ categories: Array<Category>;
1698
+ /**
1699
+ * When it was first proposed.
1700
+ */
1701
+ createdAt: string;
1702
+ /**
1703
+ * Names the suggestion across nights: proposing the same key again changes
1704
+ * this suggestion instead of adding one.
1705
+ */
1706
+ dedupKey: string;
1707
+ /**
1708
+ * The suggestion's id.
1709
+ */
1710
+ id: string;
1711
+ /**
1712
+ * 0 to 100, for ordering.
1713
+ */
1714
+ importance: number;
1715
+ /**
1716
+ * Proposed since the person last opened their feed. Only the feed sets
1717
+ * it; false everywhere else.
1718
+ */
1719
+ isNew: boolean;
1720
+ /**
1721
+ * What acting on it produced.
1722
+ */
1723
+ produced: Array<Target>;
1724
+ result?: null | Target;
1725
+ run?: null | SuggestionRun;
1726
+ /**
1727
+ * Where it is for the person.
1728
+ */
1729
+ state: SuggestionState;
1730
+ /**
1731
+ * When its state last changed, such as when it was dismissed.
1732
+ */
1733
+ stateChangedAt: string;
1734
+ /**
1735
+ * Why it was resolved; only on resolved suggestions.
1736
+ */
1737
+ stateReason?: string | null;
1738
+ /**
1739
+ * What the card shows: whether it is open, being run, failed or done.
1740
+ */
1741
+ status: SuggestionStatus;
1742
+ /**
1743
+ * Why, in a line or two.
1744
+ */
1745
+ summary: string;
1746
+ /**
1747
+ * What to do, in a few words.
1748
+ */
1749
+ title: string;
1750
+ /**
1751
+ * When it last changed.
1752
+ */
1753
+ updatedAt: string;
1754
+ };
1755
+ /**
1756
+ * The suggestion changed since the caller read it, or can't run until its
1757
+ * last run settles.
1758
+ */
1759
+ export type SuggestionChanged = {
1760
+ /**
1761
+ * What happened.
1762
+ */
1763
+ message: string;
1764
+ /**
1765
+ * The suggestion as it is now, to show before acting on it again.
1766
+ */
1767
+ suggestion: Suggestion;
1768
+ };
1769
+ /**
1770
+ * A reply suggestion's draft.
1771
+ */
1772
+ export type SuggestionDraft = Target & {
1773
+ /**
1774
+ * The start of its plain text, as it was when attached.
1775
+ */
1776
+ preview?: string | null;
1777
+ };
1778
+ /**
1779
+ * A person's feed: their open suggestions, best first, and the ones they
1780
+ * finished in the last day, newest first. Both lists are in the order to
1781
+ * show them.
1782
+ */
1783
+ export type SuggestionFeed = {
1784
+ /**
1785
+ * How many suggestions the whole feed holds of each status, whatever the
1786
+ * `limit`.
1787
+ */
1788
+ counts: FeedCounts;
1789
+ /**
1790
+ * Suggestions done in the last 24 hours, with what they produced; left
1791
+ * out when the feed was read with a `limit`.
1792
+ */
1793
+ done?: Array<Suggestion> | null;
1794
+ /**
1795
+ * The open suggestions, at most `limit` of them.
1796
+ */
1797
+ suggestions: Array<Suggestion>;
1798
+ };
1799
+ /**
1800
+ * Who suggests a routine.
1801
+ */
1802
+ export type SuggestionFrom = 'for_you' | 'macro';
1803
+ /**
1804
+ * Where a generation is.
1805
+ */
1806
+ export type SuggestionGenerationStatus = 'generating' | 'ready' | 'partial' | 'failed' | 'cancelled' | 'interrupted';
1807
+ /**
1808
+ * What kind of suggestion it is, with that kind's data. A kind never changes.
1809
+ */
1810
+ export type SuggestionKind = {
1811
+ kind: 'prompt';
1812
+ /**
1813
+ * What the agent is asked to do.
1814
+ */
1815
+ prompt: string;
1816
+ /**
1817
+ * How it runs.
1818
+ */
1819
+ runMode: RunMode;
1820
+ /**
1821
+ * For a background run that posts or sends something: what, and
1822
+ * where, in plain words. The card shows it before Run, and running
1823
+ * it approves exactly that. None when the run posts and sends
1824
+ * nothing.
1825
+ */
1826
+ sends?: string | null;
1827
+ } | {
1828
+ /**
1829
+ * What to do about the items.
1830
+ */
1831
+ action: EntityAction;
1832
+ draft?: null | SuggestionDraft;
1833
+ /**
1834
+ * A reply suggestion's: that message's sender, by name.
1835
+ */
1836
+ from?: string | null;
1837
+ kind: 'entity';
1838
+ /**
1839
+ * A reply suggestion's: when the message the person hasn't answered
1840
+ * came, as read from its item when the suggestion was last written.
1841
+ */
1842
+ waitingSince?: string | null;
1843
+ } | {
1844
+ kind: 'routine';
1845
+ routine?: null | RoutineText;
1846
+ /**
1847
+ * The suggestion it shows.
1848
+ */
1849
+ routineSuggestionId: string;
1850
+ };
1851
+ /**
1852
+ * Every suggestion AI made for the person, for a routines session.
1853
+ */
1854
+ export type SuggestionReview = {
1855
+ /**
1856
+ * Suggestions this session may still hand back.
1857
+ */
1858
+ keptLeft: number;
1859
+ suggestions: Array<ReviewedSuggestion>;
1860
+ };
1861
+ /**
1862
+ * A run of a background prompt suggestion: a hidden agent session of the
1863
+ * person's, with the full toolset, that never stops to ask.
1864
+ */
1865
+ export type SuggestionRun = {
1866
+ /**
1867
+ * The agent session: open it to see the result.
1868
+ */
1869
+ sessionId: string;
1870
+ /**
1871
+ * When it started.
1872
+ */
1873
+ startedAt: string;
1874
+ /**
1875
+ * Where it is, as stored: reading it never asks the session.
1876
+ */
1877
+ state: RunStateName;
1878
+ /**
1879
+ * When it entered `state`.
1880
+ */
1881
+ stateChangedAt: string;
1882
+ };
1883
+ /**
1884
+ * Where a suggestion is for the person.
1885
+ */
1886
+ export type SuggestionState = 'proposed' | 'accepted' | 'done' | 'dismissed' | 'resolved' | 'retired';
1887
+ /**
1888
+ * What a suggestion's card shows, from its state and its latest run.
1889
+ */
1890
+ export type SuggestionStatus = 'open' | 'running' | 'failed' | 'done' | 'closed';
1891
+ /**
1892
+ * What became of a session's write.
1893
+ */
1894
+ export type SuggestionWriteOutcome = {
1895
+ /**
1896
+ * Whether it was applied.
1897
+ */
1898
+ ok: boolean;
1899
+ /**
1900
+ * Why it wasn't, to fix and try again.
1901
+ */
1902
+ problems: Array<string>;
1903
+ suggestion?: null | Suggestion;
1904
+ };
1905
+ /**
1906
+ * What a generation session reads before managing the person's suggestions:
1907
+ * every suggestion they have, open or not, and how many more it may add.
1908
+ */
1909
+ export type SuggestionsReview = {
1910
+ /**
1911
+ * Suggestions this generation may still add or bring back.
1912
+ */
1913
+ newLeft: number;
1914
+ /**
1915
+ * Open suggestions the person has, and the most they may have.
1916
+ */
1917
+ open: number;
1918
+ /**
1919
+ * The most open suggestions a person may have.
1920
+ */
1921
+ openLimit: number;
1922
+ /**
1923
+ * Open suggestions first, best first, then closed ones newest first. A
1924
+ * dismissed suggestion's `stateChangedAt` is when the person dismissed it.
1925
+ */
1926
+ suggestions: Array<Suggestion>;
1927
+ };
1928
+ /**
1929
+ * The part of the app a routine is about, where it is offered.
1930
+ */
1931
+ export type Surface = 'email' | 'calendar' | 'tasks' | 'files' | 'crm' | 'chat' | 'calls' | 'reviews' | 'agents';
1932
+ /**
1933
+ * An item, or a part of one such as a message in a thread.
1934
+ */
1935
+ export type Target = {
1936
+ /**
1937
+ * The item's id.
1938
+ */
1939
+ entityId: string;
1940
+ /**
1941
+ * The item's type.
1942
+ */
1943
+ entityType: EntityType;
1944
+ /**
1945
+ * A part of it, such as one message in a channel.
1946
+ */
1947
+ partId?: string | null;
1948
+ };
1949
+ /**
1950
+ * A user-specific part of a shared routine.
1951
+ */
1952
+ export type TemplateVariable = {
1953
+ fill: VariableFill;
1954
+ id: string;
1955
+ kind: 'user';
1956
+ label: string;
1957
+ } | {
1958
+ /**
1959
+ * The mention's block name, such as `channel` or `md`.
1960
+ */
1961
+ block_name: string;
1962
+ fill: VariableFill;
1963
+ id: string;
1964
+ kind: 'item';
1965
+ label: string;
1966
+ } | {
1967
+ fill: VariableFill;
1968
+ kind: 'time_zone';
1969
+ timezone: string;
1970
+ };
1971
+ /**
1972
+ * How an upgrade went.
1973
+ */
1974
+ export type UpgradeOutcome = 'running' | 'checked' | 'rewritten' | 'needs_update';
1975
+ /**
1976
+ * How a variable is filled when someone activates the template.
1977
+ */
1978
+ export type VariableFill = 'activator' | 'shared' | 'choice';
1979
+ export type ScheduledActionHealthData = {
1980
+ body?: never;
1981
+ path?: never;
1982
+ query?: never;
1983
+ url: '/health';
1984
+ };
1985
+ export type ScheduledActionHealthResponses = {
1986
+ /**
1987
+ * health
1988
+ */
1989
+ 200: EmptyResponse;
1990
+ };
1991
+ export type ScheduledActionHealthResponse = ScheduledActionHealthResponses[keyof ScheduledActionHealthResponses];
1992
+ export type ListScheduledActionsData = {
1993
+ body?: never;
1994
+ path?: never;
1995
+ query?: {
1996
+ /**
1997
+ * Backend clients must opt in to event actions; defaults to false (cron-only).
1998
+ */
1999
+ include_events?: boolean | null;
2000
+ /**
2001
+ * Also list active sub-routines, the routines other routines' runs
2002
+ * created, without finished one-time ones; defaults to false (top-level
2003
+ * routines only).
2004
+ */
2005
+ include_children?: boolean | null;
2006
+ /**
2007
+ * List only this routine's sub-routines: the active ones and its newest
2008
+ * 200 finished one-time ones.
2009
+ */
2010
+ parent?: string | null;
2011
+ };
2012
+ url: '/scheduled-actions';
2013
+ };
2014
+ export type ListScheduledActionsErrors = {
2015
+ 400: string;
2016
+ 401: string;
2017
+ 500: string;
2018
+ };
2019
+ export type ListScheduledActionsError = ListScheduledActionsErrors[keyof ListScheduledActionsErrors];
2020
+ export type ListScheduledActionsResponses = {
2021
+ 200: Array<ScheduledActionResponse>;
2022
+ };
2023
+ export type ListScheduledActionsResponse = ListScheduledActionsResponses[keyof ListScheduledActionsResponses];
2024
+ export type CreateScheduledActionData = {
2025
+ body: ActionConfiguration;
2026
+ path?: never;
2027
+ query?: {
2028
+ /**
2029
+ * The routine suggestion it is saved from, recorded on the routine.
2030
+ */
2031
+ suggestion_id?: string;
2032
+ /**
2033
+ * A name for a routine a routine's run creates: the same key under the
2034
+ * same parent updates that sub-routine instead of adding another.
2035
+ * Rejected outside a routine's run.
2036
+ */
2037
+ key?: string;
2038
+ };
2039
+ url: '/scheduled-actions';
2040
+ };
2041
+ export type CreateScheduledActionErrors = {
2042
+ 400: string;
2043
+ 401: string;
2044
+ 403: string;
2045
+ /**
2046
+ * The routine already has the most active sub-routines it can
2047
+ */
2048
+ 409: string;
2049
+ 500: string;
2050
+ };
2051
+ export type CreateScheduledActionError = CreateScheduledActionErrors[keyof CreateScheduledActionErrors];
2052
+ export type CreateScheduledActionResponses = {
2053
+ /**
2054
+ * The sub-routine its key already named, updated
2055
+ */
2056
+ 200: ScheduledActionResponse;
2057
+ 201: ScheduledActionResponse;
2058
+ };
2059
+ export type CreateScheduledActionResponse = CreateScheduledActionResponses[keyof CreateScheduledActionResponses];
2060
+ export type RoutineCatalogData = {
2061
+ body?: never;
2062
+ path?: never;
2063
+ query: {
2064
+ /**
2065
+ * IANA time zone, e.g. `America/New_York`.
2066
+ */
2067
+ timezone: string;
2068
+ };
2069
+ url: '/scheduled-actions/catalog';
2070
+ };
2071
+ export type RoutineCatalogErrors = {
2072
+ /**
2073
+ * Not a time zone
2074
+ */
2075
+ 400: string;
2076
+ 401: string;
2077
+ };
2078
+ export type RoutineCatalogError = RoutineCatalogErrors[keyof RoutineCatalogErrors];
2079
+ export type RoutineCatalogResponses = {
2080
+ /**
2081
+ * Macro's routines, with schedules in the given zone; code steps only where code can be saved
2082
+ */
2083
+ 200: Array<CatalogEntry>;
2084
+ };
2085
+ export type RoutineCatalogResponse = RoutineCatalogResponses[keyof RoutineCatalogResponses];
2086
+ export type CheckScheduledActionData = {
2087
+ body: CheckRoutineRequest;
2088
+ path?: never;
2089
+ query?: never;
2090
+ url: '/scheduled-actions/check';
2091
+ };
2092
+ export type CheckScheduledActionErrors = {
2093
+ 400: string;
2094
+ 401: string;
2095
+ 403: string;
2096
+ 500: string;
2097
+ 503: string;
2098
+ };
2099
+ export type CheckScheduledActionError = CheckScheduledActionErrors[keyof CheckScheduledActionErrors];
2100
+ export type CheckScheduledActionResponses = {
2101
+ 200: RoutineCheck;
2102
+ };
2103
+ export type CheckScheduledActionResponse = CheckScheduledActionResponses[keyof CheckScheduledActionResponses];
2104
+ export type ListRoutineDraftJobsData = {
2105
+ body?: never;
2106
+ path?: never;
2107
+ query?: never;
2108
+ url: '/scheduled-actions/draft-jobs';
2109
+ };
2110
+ export type ListRoutineDraftJobsErrors = {
2111
+ 401: string;
2112
+ 500: string;
2113
+ };
2114
+ export type ListRoutineDraftJobsError = ListRoutineDraftJobsErrors[keyof ListRoutineDraftJobsErrors];
2115
+ export type ListRoutineDraftJobsResponses = {
2116
+ /**
2117
+ * The caller's drafts that are drafting, or finished and not yet discarded, newest first
2118
+ */
2119
+ 200: Array<DraftJob>;
2120
+ };
2121
+ export type ListRoutineDraftJobsResponse = ListRoutineDraftJobsResponses[keyof ListRoutineDraftJobsResponses];
2122
+ export type StartRoutineDraftJobData = {
2123
+ body: StartDraftJobRequest;
2124
+ path?: never;
2125
+ query?: never;
2126
+ url: '/scheduled-actions/draft-jobs';
2127
+ };
2128
+ export type StartRoutineDraftJobErrors = {
2129
+ 400: string;
2130
+ 401: string;
2131
+ /**
2132
+ * AI usage limit reached
2133
+ */
2134
+ 402: AiAdmissionErrorBody;
2135
+ /**
2136
+ * Too many drafts are drafting already
2137
+ */
2138
+ 409: string;
2139
+ 500: string;
2140
+ /**
2141
+ * AI usage validation unavailable
2142
+ */
2143
+ 503: AiAdmissionErrorBody;
2144
+ };
2145
+ export type StartRoutineDraftJobError = StartRoutineDraftJobErrors[keyof StartRoutineDraftJobErrors];
2146
+ export type StartRoutineDraftJobResponses = {
2147
+ /**
2148
+ * Drafting in the background; read it, or follow `routine_draft_update` messages, until it is ready or failed. A request that can't be drafted at all comes back failed. Sent again with the same `clientId`, the job that start began, as it is now
2149
+ */
2150
+ 202: DraftJob;
2151
+ };
2152
+ export type StartRoutineDraftJobResponse = StartRoutineDraftJobResponses[keyof StartRoutineDraftJobResponses];
2153
+ export type DiscardRoutineDraftJobData = {
2154
+ body?: never;
2155
+ path: {
2156
+ /**
2157
+ * ID of the draft
2158
+ */
2159
+ id: string;
2160
+ };
2161
+ query?: never;
2162
+ url: '/scheduled-actions/draft-jobs/{id}';
2163
+ };
2164
+ export type DiscardRoutineDraftJobErrors = {
2165
+ 401: string;
2166
+ /**
2167
+ * No such draft of the caller's
2168
+ */
2169
+ 404: string;
2170
+ 500: string;
2171
+ };
2172
+ export type DiscardRoutineDraftJobError = DiscardRoutineDraftJobErrors[keyof DiscardRoutineDraftJobErrors];
2173
+ export type DiscardRoutineDraftJobResponses = {
2174
+ /**
2175
+ * Cancelled while drafting, or discarded once finished
2176
+ */
2177
+ 204: void;
2178
+ };
2179
+ export type DiscardRoutineDraftJobResponse = DiscardRoutineDraftJobResponses[keyof DiscardRoutineDraftJobResponses];
2180
+ export type GetRoutineDraftJobData = {
2181
+ body?: never;
2182
+ path: {
2183
+ /**
2184
+ * ID of the draft
2185
+ */
2186
+ id: string;
2187
+ };
2188
+ query?: never;
2189
+ url: '/scheduled-actions/draft-jobs/{id}';
2190
+ };
2191
+ export type GetRoutineDraftJobErrors = {
2192
+ 401: string;
2193
+ /**
2194
+ * No such draft of the caller's
2195
+ */
2196
+ 404: string;
2197
+ 500: string;
2198
+ };
2199
+ export type GetRoutineDraftJobError = GetRoutineDraftJobErrors[keyof GetRoutineDraftJobErrors];
2200
+ export type GetRoutineDraftJobResponses = {
2201
+ /**
2202
+ * The draft, with its routine or step when ready, or why it failed
2203
+ */
2204
+ 200: DraftJob;
2205
+ };
2206
+ export type GetRoutineDraftJobResponse = GetRoutineDraftJobResponses[keyof GetRoutineDraftJobResponses];
2207
+ export type DraftRoutineData = {
2208
+ body: DraftRoutineRequest;
2209
+ path?: never;
2210
+ query?: never;
2211
+ url: '/scheduled-actions/drafts';
2212
+ };
2213
+ export type DraftRoutineErrors = {
2214
+ 400: string;
2215
+ 401: string;
2216
+ /**
2217
+ * AI usage limit reached
2218
+ */
2219
+ 402: AiAdmissionErrorBody;
2220
+ 500: string;
2221
+ /**
2222
+ * AI usage validation unavailable
2223
+ */
2224
+ 503: AiAdmissionErrorBody;
2225
+ };
2226
+ export type DraftRoutineError = DraftRoutineErrors[keyof DraftRoutineErrors];
2227
+ export type DraftRoutineResponses = {
2228
+ /**
2229
+ * A routine or step to review before saving, with any code problems AI couldn't fix, or why AI couldn't draft it
2230
+ */
2231
+ 200: Draft;
2232
+ };
2233
+ export type DraftRoutineResponse = DraftRoutineResponses[keyof DraftRoutineResponses];
2234
+ export type ListRoutineSuggestionsData = {
2235
+ body?: never;
2236
+ path?: never;
2237
+ query?: {
2238
+ /**
2239
+ * Only this surface's; every surface's when absent.
2240
+ */
2241
+ surface?: Surface;
2242
+ };
2243
+ url: '/scheduled-actions/suggestions';
2244
+ };
2245
+ export type ListRoutineSuggestionsErrors = {
2246
+ 401: string;
2247
+ /**
2248
+ * Routine suggestions are off for the caller
2249
+ */
2250
+ 404: string;
2251
+ 500: string;
2252
+ };
2253
+ export type ListRoutineSuggestionsError = ListRoutineSuggestionsErrors[keyof ListRoutineSuggestionsErrors];
2254
+ export type ListRoutineSuggestionsResponses = {
2255
+ /**
2256
+ * Per surface, the routines AI suggested for the caller, then Macro's templates; reading never generates
2257
+ */
2258
+ 200: RoutineSuggestions;
2259
+ };
2260
+ export type ListRoutineSuggestionsResponse = ListRoutineSuggestionsResponses[keyof ListRoutineSuggestionsResponses];
2261
+ export type SuggestRoutineData = {
2262
+ body: SuggestRequest;
2263
+ path?: never;
2264
+ query?: never;
2265
+ url: '/scheduled-actions/suggestions';
2266
+ };
2267
+ export type SuggestRoutineErrors = {
2268
+ 400: string;
2269
+ 401: string;
2270
+ /**
2271
+ * Only a routine suggestion session may suggest
2272
+ */
2273
+ 403: string;
2274
+ 500: string;
2275
+ };
2276
+ export type SuggestRoutineError = SuggestRoutineErrors[keyof SuggestRoutineErrors];
2277
+ export type SuggestRoutineResponses = {
2278
+ /**
2279
+ * Whether the suggestion was kept, and what to fix when it wasn't
2280
+ */
2281
+ 200: SuggestOutcome;
2282
+ };
2283
+ export type SuggestRoutineResponse = SuggestRoutineResponses[keyof SuggestRoutineResponses];
2284
+ export type ReviewRoutineSuggestionsData = {
2285
+ body?: never;
2286
+ path?: never;
2287
+ query?: never;
2288
+ url: '/scheduled-actions/suggestions/review';
2289
+ };
2290
+ export type ReviewRoutineSuggestionsErrors = {
2291
+ 401: string;
2292
+ /**
2293
+ * Only a routines generation session may review
2294
+ */
2295
+ 403: string;
2296
+ /**
2297
+ * Routine suggestions are off for the user
2298
+ */
2299
+ 404: string;
2300
+ 500: string;
2301
+ };
2302
+ export type ReviewRoutineSuggestionsError = ReviewRoutineSuggestionsErrors[keyof ReviewRoutineSuggestionsErrors];
2303
+ export type ReviewRoutineSuggestionsResponses = {
2304
+ /**
2305
+ * Every suggestion AI made for the user, open or not
2306
+ */
2307
+ 200: SuggestionReview;
2308
+ };
2309
+ export type ReviewRoutineSuggestionsResponse = ReviewRoutineSuggestionsResponses[keyof ReviewRoutineSuggestionsResponses];
2310
+ export type DismissRoutineSuggestionData = {
2311
+ body?: never;
2312
+ path: {
2313
+ /**
2314
+ * ID of the suggestion, AI's or a template's
2315
+ */
2316
+ id: string;
2317
+ };
2318
+ query?: never;
2319
+ url: '/scheduled-actions/suggestions/{id}/dismiss';
2320
+ };
2321
+ export type DismissRoutineSuggestionErrors = {
2322
+ 401: string;
2323
+ /**
2324
+ * No such suggestion for the caller, or suggestions are off
2325
+ */
2326
+ 404: string;
2327
+ 500: string;
2328
+ };
2329
+ export type DismissRoutineSuggestionError = DismissRoutineSuggestionErrors[keyof DismissRoutineSuggestionErrors];
2330
+ export type DismissRoutineSuggestionResponses = {
2331
+ /**
2332
+ * Never suggested again, on any surface
2333
+ */
2334
+ 204: void;
2335
+ };
2336
+ export type DismissRoutineSuggestionResponse = DismissRoutineSuggestionResponses[keyof DismissRoutineSuggestionResponses];
2337
+ export type RetireRoutineSuggestionData = {
2338
+ body: RetireSuggestion;
2339
+ path: {
2340
+ /**
2341
+ * ID of the suggestion
2342
+ */
2343
+ id: string;
2344
+ };
2345
+ query?: never;
2346
+ url: '/scheduled-actions/suggestions/{id}/retire';
2347
+ };
2348
+ export type RetireRoutineSuggestionErrors = {
2349
+ 400: string;
2350
+ 401: string;
2351
+ /**
2352
+ * Only a routines generation session may retire
2353
+ */
2354
+ 403: string;
2355
+ 500: string;
2356
+ };
2357
+ export type RetireRoutineSuggestionError = RetireRoutineSuggestionErrors[keyof RetireRoutineSuggestionErrors];
2358
+ export type RetireRoutineSuggestionResponses = {
2359
+ /**
2360
+ * Whether the suggestion was retired, and why not when it wasn't
2361
+ */
2362
+ 200: SuggestOutcome;
2363
+ };
2364
+ export type RetireRoutineSuggestionResponse = RetireRoutineSuggestionResponses[keyof RetireRoutineSuggestionResponses];
2365
+ export type DeleteScheduledActionData = {
2366
+ body?: never;
2367
+ path: {
2368
+ /**
2369
+ * ID of the scheduled action
2370
+ */
2371
+ id: string;
2372
+ };
2373
+ query?: never;
2374
+ url: '/scheduled-actions/{id}';
2375
+ };
2376
+ export type DeleteScheduledActionErrors = {
2377
+ 401: string;
2378
+ 404: string;
2379
+ 500: string;
2380
+ };
2381
+ export type DeleteScheduledActionError = DeleteScheduledActionErrors[keyof DeleteScheduledActionErrors];
2382
+ export type DeleteScheduledActionResponses = {
2383
+ 204: void;
2384
+ };
2385
+ export type DeleteScheduledActionResponse = DeleteScheduledActionResponses[keyof DeleteScheduledActionResponses];
2386
+ export type GetScheduledActionData = {
2387
+ body?: never;
2388
+ path: {
2389
+ /**
2390
+ * ID of the scheduled action
2391
+ */
2392
+ id: string;
2393
+ };
2394
+ query?: never;
2395
+ url: '/scheduled-actions/{id}';
2396
+ };
2397
+ export type GetScheduledActionErrors = {
2398
+ 401: string;
2399
+ 404: string;
2400
+ 500: string;
719
2401
  };
720
- /**
721
- * How an upgrade went.
722
- */
723
- export type UpgradeOutcome = 'running' | 'checked' | 'rewritten' | 'needs_update';
724
- /**
725
- * How a variable is filled when someone activates the template.
726
- */
727
- export type VariableFill = 'activator' | 'shared' | 'choice';
728
- /**
729
- * The items AI may name in a draft. They are data for the model; saving
730
- * checks every id the draft uses.
731
- */
732
- export type Workspace = {
2402
+ export type GetScheduledActionError = GetScheduledActionErrors[keyof GetScheduledActionErrors];
2403
+ export type GetScheduledActionResponses = {
2404
+ 200: ScheduledActionResponse;
2405
+ };
2406
+ export type GetScheduledActionResponse = GetScheduledActionResponses[keyof GetScheduledActionResponses];
2407
+ export type UpdateScheduledActionData = {
2408
+ body: ActionConfigurationUpdate;
2409
+ path: {
2410
+ /**
2411
+ * ID of the scheduled action
2412
+ */
2413
+ id: string;
2414
+ };
2415
+ query?: never;
2416
+ url: '/scheduled-actions/{id}';
2417
+ };
2418
+ export type UpdateScheduledActionErrors = {
2419
+ 400: string;
2420
+ 401: string;
2421
+ 404: string;
733
2422
  /**
734
- * Agents a step may hand the run to.
2423
+ * Configuration changed or execution is active
735
2424
  */
736
- agents?: Array<WorkspaceAgent>;
737
- channels?: Array<NamedItem>;
2425
+ 409: string;
2426
+ 500: string;
2427
+ };
2428
+ export type UpdateScheduledActionError = UpdateScheduledActionErrors[keyof UpdateScheduledActionErrors];
2429
+ export type UpdateScheduledActionResponses = {
2430
+ 200: ScheduledActionResponse;
2431
+ };
2432
+ export type UpdateScheduledActionResponse = UpdateScheduledActionResponses[keyof UpdateScheduledActionResponses];
2433
+ export type SetScheduledActionAppearanceData = {
2434
+ body: EntityAppearance;
2435
+ path: {
2436
+ /**
2437
+ * ID of the scheduled action
2438
+ */
2439
+ id: string;
2440
+ };
2441
+ query?: never;
2442
+ url: '/scheduled-actions/{id}/appearance';
2443
+ };
2444
+ export type SetScheduledActionAppearanceErrors = {
2445
+ 400: unknown;
2446
+ 401: unknown;
2447
+ 404: unknown;
2448
+ };
2449
+ export type SetScheduledActionAppearanceResponses = {
2450
+ 200: EntityAppearance;
2451
+ };
2452
+ export type SetScheduledActionAppearanceResponse = SetScheduledActionAppearanceResponses[keyof SetScheduledActionAppearanceResponses];
2453
+ export type ListScheduledActionCodeUpgradesData = {
2454
+ body?: never;
2455
+ path: {
2456
+ /**
2457
+ * ID of the scheduled action
2458
+ */
2459
+ id: string;
2460
+ };
2461
+ query?: never;
2462
+ url: '/scheduled-actions/{id}/code-upgrades';
2463
+ };
2464
+ export type ListScheduledActionCodeUpgradesErrors = {
2465
+ 401: string;
2466
+ 404: string;
2467
+ 500: string;
2468
+ };
2469
+ export type ListScheduledActionCodeUpgradesError = ListScheduledActionCodeUpgradesErrors[keyof ListScheduledActionCodeUpgradesErrors];
2470
+ export type ListScheduledActionCodeUpgradesResponses = {
738
2471
  /**
739
- * Projects.
2472
+ * How the routine's code steps were brought to new SDKs, newest first
740
2473
  */
741
- folders?: Array<NamedItem>;
2474
+ 200: Array<CodeUpgrade>;
2475
+ };
2476
+ export type ListScheduledActionCodeUpgradesResponse = ListScheduledActionCodeUpgradesResponses[keyof ListScheduledActionCodeUpgradesResponses];
2477
+ export type DetachScheduledActionData = {
2478
+ body?: never;
2479
+ path: {
2480
+ /**
2481
+ * ID of the sub-routine
2482
+ */
2483
+ id: string;
2484
+ };
2485
+ query?: never;
2486
+ url: '/scheduled-actions/{id}/detach';
2487
+ };
2488
+ export type DetachScheduledActionErrors = {
742
2489
  /**
743
- * Email label names.
2490
+ * Not a sub-routine
744
2491
  */
745
- labels?: Array<string>;
746
- people?: Array<NamedItem>;
2492
+ 400: string;
2493
+ 401: string;
2494
+ 404: string;
2495
+ 500: string;
2496
+ };
2497
+ export type DetachScheduledActionError = DetachScheduledActionErrors[keyof DetachScheduledActionErrors];
2498
+ export type DetachScheduledActionResponses = {
2499
+ 200: ScheduledActionResponse;
2500
+ };
2501
+ export type DetachScheduledActionResponse = DetachScheduledActionResponses[keyof DetachScheduledActionResponses];
2502
+ export type SetScheduledActionEnabledData = {
2503
+ body: SetScheduledActionEnabled;
2504
+ path: {
2505
+ /**
2506
+ * ID of the scheduled action
2507
+ */
2508
+ id: string;
2509
+ };
2510
+ query?: never;
2511
+ url: '/scheduled-actions/{id}/enabled';
2512
+ };
2513
+ export type SetScheduledActionEnabledErrors = {
2514
+ 400: string;
2515
+ 401: string;
2516
+ 404: string;
747
2517
  /**
748
- * Tag options, by the property definition they belong to.
2518
+ * Configuration changed or execution is active
749
2519
  */
750
- tags?: Array<WorkspaceTag>;
751
- };
752
- /**
753
- * An agent and its bot id.
754
- */
755
- export type WorkspaceAgent = {
756
- botId: string;
757
- name: string;
2520
+ 409: string;
2521
+ 500: string;
758
2522
  };
759
- /**
760
- * A tag: one option of a property.
761
- */
762
- export type WorkspaceTag = {
763
- definitionId: string;
764
- label: string;
765
- optionId: string;
2523
+ export type SetScheduledActionEnabledError = SetScheduledActionEnabledErrors[keyof SetScheduledActionEnabledErrors];
2524
+ export type SetScheduledActionEnabledResponses = {
2525
+ 200: ScheduledActionResponse;
766
2526
  };
767
- export type ScheduledActionHealthData = {
2527
+ export type SetScheduledActionEnabledResponse = SetScheduledActionEnabledResponses[keyof SetScheduledActionEnabledResponses];
2528
+ export type ExecuteScheduledActionNowData = {
768
2529
  body?: never;
769
- path?: never;
2530
+ path: {
2531
+ /**
2532
+ * ID of the scheduled action
2533
+ */
2534
+ id: string;
2535
+ };
770
2536
  query?: never;
771
- url: '/health';
2537
+ url: '/scheduled-actions/{id}/execute';
772
2538
  };
773
- export type ScheduledActionHealthResponses = {
2539
+ export type ExecuteScheduledActionNowErrors = {
2540
+ 400: string;
2541
+ 401: string;
774
2542
  /**
775
- * health
2543
+ * AI allowance exhausted
776
2544
  */
777
- 200: EmptyResponse;
2545
+ 402: AiAdmissionErrorBody;
2546
+ 404: string;
2547
+ /**
2548
+ * Action is already running
2549
+ */
2550
+ 409: string;
2551
+ 500: string;
2552
+ /**
2553
+ * AI usage validation unavailable; retry later
2554
+ */
2555
+ 503: AiAdmissionErrorBody;
778
2556
  };
779
- export type ScheduledActionHealthResponse = ScheduledActionHealthResponses[keyof ScheduledActionHealthResponses];
780
- export type ListScheduledActionsData = {
2557
+ export type ExecuteScheduledActionNowError = ExecuteScheduledActionNowErrors[keyof ExecuteScheduledActionNowErrors];
2558
+ export type ExecuteScheduledActionNowResponses = {
2559
+ 200: InProgressExecution;
2560
+ };
2561
+ export type ExecuteScheduledActionNowResponse = ExecuteScheduledActionNowResponses[keyof ExecuteScheduledActionNowResponses];
2562
+ export type ListScheduledActionHistoryData = {
781
2563
  body?: never;
782
- path?: never;
783
- query?: {
2564
+ path: {
784
2565
  /**
785
- * Backend clients must opt in to event actions; defaults to false (cron-only).
2566
+ * ID of the scheduled action
786
2567
  */
787
- include_events?: boolean | null;
2568
+ id: string;
788
2569
  };
789
- url: '/scheduled-actions';
2570
+ query?: never;
2571
+ url: '/scheduled-actions/{id}/history';
790
2572
  };
791
- export type ListScheduledActionsErrors = {
2573
+ export type ListScheduledActionHistoryErrors = {
2574
+ 401: string;
2575
+ 404: string;
2576
+ 500: string;
2577
+ };
2578
+ export type ListScheduledActionHistoryError = ListScheduledActionHistoryErrors[keyof ListScheduledActionHistoryErrors];
2579
+ export type ListScheduledActionHistoryResponses = {
2580
+ 200: Array<ExecutionRecordResponse>;
2581
+ };
2582
+ export type ListScheduledActionHistoryResponse = ListScheduledActionHistoryResponses[keyof ListScheduledActionHistoryResponses];
2583
+ export type UnshareScheduledActionTemplateData = {
2584
+ body?: never;
2585
+ path: {
2586
+ /**
2587
+ * ID of the shared routine
2588
+ */
2589
+ id: string;
2590
+ };
2591
+ query?: never;
2592
+ url: '/scheduled-actions/{id}/template';
2593
+ };
2594
+ export type UnshareScheduledActionTemplateErrors = {
2595
+ 401: string;
2596
+ 404: string;
2597
+ 500: string;
2598
+ };
2599
+ export type UnshareScheduledActionTemplateError = UnshareScheduledActionTemplateErrors[keyof UnshareScheduledActionTemplateErrors];
2600
+ export type UnshareScheduledActionTemplateResponses = {
2601
+ 204: void;
2602
+ };
2603
+ export type UnshareScheduledActionTemplateResponse = UnshareScheduledActionTemplateResponses[keyof UnshareScheduledActionTemplateResponses];
2604
+ export type GetScheduledActionTemplateData = {
2605
+ body?: never;
2606
+ path: {
2607
+ /**
2608
+ * ID of the shared routine
2609
+ */
2610
+ id: string;
2611
+ };
2612
+ query?: never;
2613
+ url: '/scheduled-actions/{id}/template';
2614
+ };
2615
+ export type GetScheduledActionTemplateErrors = {
2616
+ 401: string;
2617
+ /**
2618
+ * The routine is not shared
2619
+ */
2620
+ 404: string;
2621
+ 500: string;
2622
+ };
2623
+ export type GetScheduledActionTemplateError = GetScheduledActionTemplateErrors[keyof GetScheduledActionTemplateErrors];
2624
+ export type GetScheduledActionTemplateResponses = {
2625
+ 200: RoutineTemplate;
2626
+ };
2627
+ export type GetScheduledActionTemplateResponse = GetScheduledActionTemplateResponses[keyof GetScheduledActionTemplateResponses];
2628
+ export type ShareScheduledActionTemplateData = {
2629
+ body: ShareRoutineTemplate;
2630
+ path: {
2631
+ /**
2632
+ * ID of the routine to share
2633
+ */
2634
+ id: string;
2635
+ };
2636
+ query?: never;
2637
+ url: '/scheduled-actions/{id}/template';
2638
+ };
2639
+ export type ShareScheduledActionTemplateErrors = {
792
2640
  400: string;
793
2641
  401: string;
2642
+ 404: string;
794
2643
  500: string;
795
2644
  };
796
- export type ListScheduledActionsError = ListScheduledActionsErrors[keyof ListScheduledActionsErrors];
797
- export type ListScheduledActionsResponses = {
798
- 200: Array<ScheduledActionResponse>;
2645
+ export type ShareScheduledActionTemplateError = ShareScheduledActionTemplateErrors[keyof ShareScheduledActionTemplateErrors];
2646
+ export type ShareScheduledActionTemplateResponses = {
2647
+ 200: RoutineTemplate;
799
2648
  };
800
- export type ListScheduledActionsResponse = ListScheduledActionsResponses[keyof ListScheduledActionsResponses];
801
- export type CreateScheduledActionData = {
2649
+ export type ShareScheduledActionTemplateResponse = ShareScheduledActionTemplateResponses[keyof ShareScheduledActionTemplateResponses];
2650
+ export type ActivateScheduledActionTemplateData = {
802
2651
  body: ActionConfiguration;
803
- path?: never;
2652
+ path: {
2653
+ /**
2654
+ * ID of the shared routine
2655
+ */
2656
+ id: string;
2657
+ };
804
2658
  query?: never;
805
- url: '/scheduled-actions';
2659
+ url: '/scheduled-actions/{id}/template/activate';
806
2660
  };
807
- export type CreateScheduledActionErrors = {
2661
+ export type ActivateScheduledActionTemplateErrors = {
808
2662
  400: string;
809
2663
  401: string;
810
2664
  403: string;
2665
+ /**
2666
+ * The routine is not shared
2667
+ */
2668
+ 404: string;
811
2669
  500: string;
812
2670
  };
813
- export type CreateScheduledActionError = CreateScheduledActionErrors[keyof CreateScheduledActionErrors];
814
- export type CreateScheduledActionResponses = {
2671
+ export type ActivateScheduledActionTemplateError = ActivateScheduledActionTemplateErrors[keyof ActivateScheduledActionTemplateErrors];
2672
+ export type ActivateScheduledActionTemplateResponses = {
815
2673
  201: ScheduledActionResponse;
816
2674
  };
817
- export type CreateScheduledActionResponse = CreateScheduledActionResponses[keyof CreateScheduledActionResponses];
818
- export type RoutineCodeStartersData = {
2675
+ export type ActivateScheduledActionTemplateResponse = ActivateScheduledActionTemplateResponses[keyof ActivateScheduledActionTemplateResponses];
2676
+ export type ListSuggestionsData = {
819
2677
  body?: never;
820
2678
  path?: never;
821
- query?: never;
822
- url: '/scheduled-actions/code/starters';
2679
+ query?: {
2680
+ /**
2681
+ * IANA time zone, e.g. `America/New_York`: nightly generations run in
2682
+ * the reader's night.
2683
+ */
2684
+ timezone?: string;
2685
+ /**
2686
+ * Most open suggestions to return, best first; all when unset. With a
2687
+ * limit the feed leaves out `done`; `counts` always counts every one.
2688
+ */
2689
+ limit?: number;
2690
+ };
2691
+ url: '/suggestions';
823
2692
  };
824
- export type RoutineCodeStartersErrors = {
2693
+ export type ListSuggestionsErrors = {
825
2694
  401: string;
2695
+ /**
2696
+ * A generation session may not read the feed
2697
+ */
2698
+ 403: string;
2699
+ /**
2700
+ * Suggestions are off for the caller
2701
+ */
2702
+ 404: string;
2703
+ 500: string;
826
2704
  };
827
- export type RoutineCodeStartersError = RoutineCodeStartersErrors[keyof RoutineCodeStartersErrors];
828
- export type RoutineCodeStartersResponses = {
2705
+ export type ListSuggestionsError = ListSuggestionsErrors[keyof ListSuggestionsErrors];
2706
+ export type ListSuggestionsResponses = {
829
2707
  /**
830
- * Starter routines whose step is code; empty where code steps aren't available
2708
+ * The caller's open suggestions, best first, and their done ones, latest first: only those they can open every item of
831
2709
  */
832
- 200: Array<StarterRoutine>;
2710
+ 200: SuggestionFeed;
833
2711
  };
834
- export type RoutineCodeStartersResponse = RoutineCodeStartersResponses[keyof RoutineCodeStartersResponses];
835
- export type DraftRoutineData = {
836
- body: DraftRoutineRequest;
2712
+ export type ListSuggestionsResponse = ListSuggestionsResponses[keyof ListSuggestionsResponses];
2713
+ export type AddSuggestionData = {
2714
+ body: NewSuggestion;
837
2715
  path?: never;
838
2716
  query?: never;
839
- url: '/scheduled-actions/drafts';
2717
+ url: '/suggestions';
840
2718
  };
841
- export type DraftRoutineErrors = {
2719
+ export type AddSuggestionErrors = {
842
2720
  400: string;
843
2721
  401: string;
844
2722
  /**
845
- * AI usage limit reached
2723
+ * Only a suggestions generation session may suggest
846
2724
  */
847
- 402: AiAdmissionErrorBody;
848
- 500: string;
2725
+ 403: string;
849
2726
  /**
850
- * AI usage validation unavailable
2727
+ * Suggestions are off for the user
851
2728
  */
852
- 503: AiAdmissionErrorBody;
2729
+ 404: string;
2730
+ 500: string;
853
2731
  };
854
- export type DraftRoutineError = DraftRoutineErrors[keyof DraftRoutineErrors];
855
- export type DraftRoutineResponses = {
2732
+ export type AddSuggestionError = AddSuggestionErrors[keyof AddSuggestionErrors];
2733
+ export type AddSuggestionResponses = {
856
2734
  /**
857
- * A routine or step to review before saving, with any code problems AI couldn't fix, or why AI couldn't draft it
2735
+ * Whether the suggestion was added or updated, and what to fix when it wasn't
858
2736
  */
859
- 200: Draft;
2737
+ 200: SuggestionWriteOutcome;
860
2738
  };
861
- export type DraftRoutineResponse = DraftRoutineResponses[keyof DraftRoutineResponses];
862
- export type DeleteScheduledActionData = {
2739
+ export type AddSuggestionResponse = AddSuggestionResponses[keyof AddSuggestionResponses];
2740
+ export type StartSuggestionGenerationData = {
863
2741
  body?: never;
864
- path: {
2742
+ path?: never;
2743
+ query: {
865
2744
  /**
866
- * ID of the scheduled action
2745
+ * IANA time zone, e.g. `America/New_York`.
867
2746
  */
868
- id: string;
2747
+ timezone: string;
869
2748
  };
870
- query?: never;
871
- url: '/scheduled-actions/{id}';
2749
+ url: '/suggestions/generate';
872
2750
  };
873
- export type DeleteScheduledActionErrors = {
2751
+ export type StartSuggestionGenerationErrors = {
874
2752
  401: string;
2753
+ /**
2754
+ * Neither suggestions nor routine suggestions are on for the caller
2755
+ */
875
2756
  404: string;
876
2757
  500: string;
877
2758
  };
878
- export type DeleteScheduledActionError = DeleteScheduledActionErrors[keyof DeleteScheduledActionErrors];
879
- export type DeleteScheduledActionResponses = {
880
- 204: void;
2759
+ export type StartSuggestionGenerationError = StartSuggestionGenerationErrors[keyof StartSuggestionGenerationErrors];
2760
+ export type StartSuggestionGenerationResponses = {
2761
+ /**
2762
+ * The caller's onboarding generation started in the background: their suggestions and routine suggestions, as each is on for them. Later calls start nothing
2763
+ */
2764
+ 200: GenerationStarted;
881
2765
  };
882
- export type DeleteScheduledActionResponse = DeleteScheduledActionResponses[keyof DeleteScheduledActionResponses];
883
- export type GetScheduledActionData = {
2766
+ export type StartSuggestionGenerationResponse = StartSuggestionGenerationResponses[keyof StartSuggestionGenerationResponses];
2767
+ export type GetSuggestionGenerationData = {
884
2768
  body?: never;
885
- path: {
886
- /**
887
- * ID of the scheduled action
888
- */
889
- id: string;
890
- };
2769
+ path?: never;
891
2770
  query?: never;
892
- url: '/scheduled-actions/{id}';
2771
+ url: '/suggestions/generation';
893
2772
  };
894
- export type GetScheduledActionErrors = {
2773
+ export type GetSuggestionGenerationErrors = {
895
2774
  401: string;
2775
+ /**
2776
+ * Suggestions are off for the caller
2777
+ */
896
2778
  404: string;
897
2779
  500: string;
898
2780
  };
899
- export type GetScheduledActionError = GetScheduledActionErrors[keyof GetScheduledActionErrors];
900
- export type GetScheduledActionResponses = {
901
- 200: ScheduledActionResponse;
2781
+ export type GetSuggestionGenerationError = GetSuggestionGenerationErrors[keyof GetSuggestionGenerationErrors];
2782
+ export type GetSuggestionGenerationResponses = {
2783
+ /**
2784
+ * The caller's generations now: whether one is running (poll while it is), how the last one ended, and when they may next ask for fresh suggestions
2785
+ */
2786
+ 200: GenerationOverview;
902
2787
  };
903
- export type GetScheduledActionResponse = GetScheduledActionResponses[keyof GetScheduledActionResponses];
904
- export type UpdateScheduledActionData = {
905
- body: ActionConfigurationUpdate;
906
- path: {
2788
+ export type GetSuggestionGenerationResponse = GetSuggestionGenerationResponses[keyof GetSuggestionGenerationResponses];
2789
+ export type RegenerateSuggestionsData = {
2790
+ body?: never;
2791
+ path?: never;
2792
+ query: {
907
2793
  /**
908
- * ID of the scheduled action
2794
+ * IANA time zone, e.g. `America/New_York`.
909
2795
  */
910
- id: string;
2796
+ timezone: string;
911
2797
  };
912
- query?: never;
913
- url: '/scheduled-actions/{id}';
2798
+ url: '/suggestions/regenerate';
914
2799
  };
915
- export type UpdateScheduledActionErrors = {
916
- 400: string;
2800
+ export type RegenerateSuggestionsErrors = {
917
2801
  401: string;
2802
+ /**
2803
+ * Suggestions are off for the caller
2804
+ */
918
2805
  404: string;
919
2806
  /**
920
- * Configuration changed or execution is active
2807
+ * One of the caller's generations is running
921
2808
  */
922
- 409: string;
2809
+ 409: RegenerationRunning;
2810
+ /**
2811
+ * The caller asked within the hour; `Retry-After` says in how many seconds they may ask again
2812
+ */
2813
+ 429: RegenerationCooldown;
923
2814
  500: string;
924
2815
  };
925
- export type UpdateScheduledActionError = UpdateScheduledActionErrors[keyof UpdateScheduledActionErrors];
926
- export type UpdateScheduledActionResponses = {
927
- 200: ScheduledActionResponse;
2816
+ export type RegenerateSuggestionsError = RegenerateSuggestionsErrors[keyof RegenerateSuggestionsErrors];
2817
+ export type RegenerateSuggestionsResponses = {
2818
+ /**
2819
+ * Fresh suggestions started in the background: the caller's whole workspace researched again and their feed brought up to date, with routine suggestions when the week's are due. Poll `GET /suggestions/generation` until it is idle
2820
+ */
2821
+ 202: GenerationStarted;
928
2822
  };
929
- export type UpdateScheduledActionResponse = UpdateScheduledActionResponses[keyof UpdateScheduledActionResponses];
930
- export type ListScheduledActionCodeUpgradesData = {
2823
+ export type RegenerateSuggestionsResponse = RegenerateSuggestionsResponses[keyof RegenerateSuggestionsResponses];
2824
+ export type ReviewSuggestionsData = {
931
2825
  body?: never;
932
- path: {
933
- /**
934
- * ID of the scheduled action
935
- */
936
- id: string;
937
- };
2826
+ path?: never;
938
2827
  query?: never;
939
- url: '/scheduled-actions/{id}/code-upgrades';
2828
+ url: '/suggestions/review';
940
2829
  };
941
- export type ListScheduledActionCodeUpgradesErrors = {
2830
+ export type ReviewSuggestionsErrors = {
942
2831
  401: string;
2832
+ /**
2833
+ * Only a suggestions generation session may review
2834
+ */
2835
+ 403: string;
2836
+ /**
2837
+ * Suggestions are off for the user
2838
+ */
943
2839
  404: string;
944
2840
  500: string;
945
2841
  };
946
- export type ListScheduledActionCodeUpgradesError = ListScheduledActionCodeUpgradesErrors[keyof ListScheduledActionCodeUpgradesErrors];
947
- export type ListScheduledActionCodeUpgradesResponses = {
2842
+ export type ReviewSuggestionsError = ReviewSuggestionsErrors[keyof ReviewSuggestionsErrors];
2843
+ export type ReviewSuggestionsResponses = {
948
2844
  /**
949
- * How the routine's code steps were brought to new SDKs, newest first
2845
+ * Every suggestion of the user's, open first, and how many more this generation may add
950
2846
  */
951
- 200: Array<CodeUpgrade>;
2847
+ 200: SuggestionsReview;
952
2848
  };
953
- export type ListScheduledActionCodeUpgradesResponse = ListScheduledActionCodeUpgradesResponses[keyof ListScheduledActionCodeUpgradesResponses];
954
- export type SetScheduledActionEnabledData = {
955
- body: SetScheduledActionEnabled;
956
- path: {
2849
+ export type ReviewSuggestionsResponse = ReviewSuggestionsResponses[keyof ReviewSuggestionsResponses];
2850
+ export type RecordSuggestionsSeenData = {
2851
+ body?: never;
2852
+ path?: never;
2853
+ query: {
957
2854
  /**
958
- * ID of the scheduled action
2855
+ * IANA time zone, e.g. `America/New_York`.
959
2856
  */
960
- id: string;
2857
+ timezone: string;
961
2858
  };
2859
+ url: '/suggestions/seen';
2860
+ };
2861
+ export type RecordSuggestionsSeenErrors = {
2862
+ 401: string;
2863
+ 500: string;
2864
+ };
2865
+ export type RecordSuggestionsSeenError = RecordSuggestionsSeenErrors[keyof RecordSuggestionsSeenErrors];
2866
+ export type RecordSuggestionsSeenResponses = {
2867
+ /**
2868
+ * Recorded: with suggestions on and a paid plan, the caller counts as active for nightly generations in their time zone; otherwise nothing changes
2869
+ */
2870
+ 204: void;
2871
+ };
2872
+ export type RecordSuggestionsSeenResponse = RecordSuggestionsSeenResponses[keyof RecordSuggestionsSeenResponses];
2873
+ export type RecordSuggestionsViewedData = {
2874
+ body?: never;
2875
+ path?: never;
962
2876
  query?: never;
963
- url: '/scheduled-actions/{id}/enabled';
2877
+ url: '/suggestions/viewed';
964
2878
  };
965
- export type SetScheduledActionEnabledErrors = {
966
- 400: string;
2879
+ export type RecordSuggestionsViewedErrors = {
967
2880
  401: string;
968
- 404: string;
969
2881
  /**
970
- * Configuration changed or execution is active
2882
+ * A generation session may not record a visit
971
2883
  */
972
- 409: string;
2884
+ 403: string;
2885
+ /**
2886
+ * Suggestions are off for the caller
2887
+ */
2888
+ 404: string;
973
2889
  500: string;
974
2890
  };
975
- export type SetScheduledActionEnabledError = SetScheduledActionEnabledErrors[keyof SetScheduledActionEnabledErrors];
976
- export type SetScheduledActionEnabledResponses = {
977
- 200: ScheduledActionResponse;
2891
+ export type RecordSuggestionsViewedError = RecordSuggestionsViewedErrors[keyof RecordSuggestionsViewedErrors];
2892
+ export type RecordSuggestionsViewedResponses = {
2893
+ /**
2894
+ * Recorded: suggestions proposed until now are no longer new in the feed
2895
+ */
2896
+ 204: void;
978
2897
  };
979
- export type SetScheduledActionEnabledResponse = SetScheduledActionEnabledResponses[keyof SetScheduledActionEnabledResponses];
980
- export type ExecuteScheduledActionNowData = {
981
- body?: never;
2898
+ export type RecordSuggestionsViewedResponse = RecordSuggestionsViewedResponses[keyof RecordSuggestionsViewedResponses];
2899
+ export type RewriteSuggestionData = {
2900
+ body: RewriteSuggestion;
982
2901
  path: {
983
2902
  /**
984
- * ID of the scheduled action
2903
+ * ID of the suggestion
985
2904
  */
986
2905
  id: string;
987
2906
  };
988
2907
  query?: never;
989
- url: '/scheduled-actions/{id}/execute';
2908
+ url: '/suggestions/{id}';
990
2909
  };
991
- export type ExecuteScheduledActionNowErrors = {
2910
+ export type RewriteSuggestionErrors = {
992
2911
  400: string;
993
2912
  401: string;
994
2913
  /**
995
- * AI allowance exhausted
2914
+ * Only a suggestions generation session may rewrite
996
2915
  */
997
- 402: AiAdmissionErrorBody;
998
- 404: string;
2916
+ 403: string;
999
2917
  /**
1000
- * Action is already running
2918
+ * No such suggestion for the user, or suggestions are off
1001
2919
  */
1002
- 409: string;
2920
+ 404: string;
1003
2921
  500: string;
2922
+ };
2923
+ export type RewriteSuggestionError = RewriteSuggestionErrors[keyof RewriteSuggestionErrors];
2924
+ export type RewriteSuggestionResponses = {
1004
2925
  /**
1005
- * AI usage validation unavailable; retry later
2926
+ * Whether the suggestion was rewritten, and what to fix when it wasn't
1006
2927
  */
1007
- 503: AiAdmissionErrorBody;
1008
- };
1009
- export type ExecuteScheduledActionNowError = ExecuteScheduledActionNowErrors[keyof ExecuteScheduledActionNowErrors];
1010
- export type ExecuteScheduledActionNowResponses = {
1011
- 200: InProgressExecution;
2928
+ 200: SuggestionWriteOutcome;
1012
2929
  };
1013
- export type ExecuteScheduledActionNowResponse = ExecuteScheduledActionNowResponses[keyof ExecuteScheduledActionNowResponses];
1014
- export type ListScheduledActionHistoryData = {
1015
- body?: never;
2930
+ export type RewriteSuggestionResponse = RewriteSuggestionResponses[keyof RewriteSuggestionResponses];
2931
+ export type AcceptSuggestionData = {
2932
+ body: AcceptSuggestionRequest;
1016
2933
  path: {
1017
2934
  /**
1018
- * ID of the scheduled action
2935
+ * ID of the suggestion
1019
2936
  */
1020
2937
  id: string;
1021
2938
  };
1022
2939
  query?: never;
1023
- url: '/scheduled-actions/{id}/history';
2940
+ url: '/suggestions/{id}/accept';
1024
2941
  };
1025
- export type ListScheduledActionHistoryErrors = {
2942
+ export type AcceptSuggestionErrors = {
2943
+ /**
2944
+ * A routine suggestion: the person saves its routine in the app instead
2945
+ */
2946
+ 400: string;
1026
2947
  401: string;
2948
+ /**
2949
+ * A generation session may not accept
2950
+ */
2951
+ 403: string;
2952
+ /**
2953
+ * No open or done suggestion with this id for the caller, or suggestions are off
2954
+ */
1027
2955
  404: string;
2956
+ /**
2957
+ * The suggestion changed since the caller read it, or a run of it is still settling: the body has it as it is now
2958
+ */
2959
+ 409: SuggestionChanged;
1028
2960
  500: string;
1029
2961
  };
1030
- export type ListScheduledActionHistoryError = ListScheduledActionHistoryErrors[keyof ListScheduledActionHistoryErrors];
1031
- export type ListScheduledActionHistoryResponses = {
1032
- 200: Array<ActionExecutionRecord>;
2962
+ export type AcceptSuggestionError = AcceptSuggestionErrors[keyof AcceptSuggestionErrors];
2963
+ export type AcceptSuggestionResponses = {
2964
+ /**
2965
+ * Accepted: a background prompt suggestion starts its run when the person accepts it in the app (anyone acting for them only takes it on), a reply suggestion is taken on and stays open until the person replies on its item, any other suggestion is done; accepting a done suggestion again changes nothing
2966
+ */
2967
+ 204: void;
1033
2968
  };
1034
- export type ListScheduledActionHistoryResponse = ListScheduledActionHistoryResponses[keyof ListScheduledActionHistoryResponses];
1035
- export type UnshareScheduledActionTemplateData = {
2969
+ export type AcceptSuggestionResponse = AcceptSuggestionResponses[keyof AcceptSuggestionResponses];
2970
+ export type DismissSuggestionData = {
1036
2971
  body?: never;
1037
2972
  path: {
1038
2973
  /**
1039
- * ID of the shared routine
2974
+ * ID of the suggestion
1040
2975
  */
1041
2976
  id: string;
1042
2977
  };
1043
2978
  query?: never;
1044
- url: '/scheduled-actions/{id}/template';
2979
+ url: '/suggestions/{id}/dismiss';
1045
2980
  };
1046
- export type UnshareScheduledActionTemplateErrors = {
2981
+ export type DismissSuggestionErrors = {
1047
2982
  401: string;
2983
+ /**
2984
+ * A generation session may not dismiss
2985
+ */
2986
+ 403: string;
2987
+ /**
2988
+ * No open suggestion with this id for the caller, or suggestions are off
2989
+ */
1048
2990
  404: string;
1049
2991
  500: string;
1050
2992
  };
1051
- export type UnshareScheduledActionTemplateError = UnshareScheduledActionTemplateErrors[keyof UnshareScheduledActionTemplateErrors];
1052
- export type UnshareScheduledActionTemplateResponses = {
2993
+ export type DismissSuggestionError = DismissSuggestionErrors[keyof DismissSuggestionErrors];
2994
+ export type DismissSuggestionResponses = {
2995
+ /**
2996
+ * Dismissed; generation sessions see when
2997
+ */
1053
2998
  204: void;
1054
2999
  };
1055
- export type UnshareScheduledActionTemplateResponse = UnshareScheduledActionTemplateResponses[keyof UnshareScheduledActionTemplateResponses];
1056
- export type GetScheduledActionTemplateData = {
1057
- body?: never;
3000
+ export type DismissSuggestionResponse = DismissSuggestionResponses[keyof DismissSuggestionResponses];
3001
+ export type AttachSuggestionDraftData = {
3002
+ body: AttachDraft;
1058
3003
  path: {
1059
3004
  /**
1060
- * ID of the shared routine
3005
+ * ID of the suggestion
1061
3006
  */
1062
3007
  id: string;
1063
3008
  };
1064
3009
  query?: never;
1065
- url: '/scheduled-actions/{id}/template';
3010
+ url: '/suggestions/{id}/draft';
1066
3011
  };
1067
- export type GetScheduledActionTemplateErrors = {
3012
+ export type AttachSuggestionDraftErrors = {
3013
+ 400: string;
1068
3014
  401: string;
1069
3015
  /**
1070
- * The routine is not shared
3016
+ * Only a suggestions generation session may attach a draft
3017
+ */
3018
+ 403: string;
3019
+ /**
3020
+ * No such suggestion for the user, or suggestions are off
1071
3021
  */
1072
3022
  404: string;
1073
3023
  500: string;
1074
3024
  };
1075
- export type GetScheduledActionTemplateError = GetScheduledActionTemplateErrors[keyof GetScheduledActionTemplateErrors];
1076
- export type GetScheduledActionTemplateResponses = {
1077
- 200: RoutineTemplate;
3025
+ export type AttachSuggestionDraftError = AttachSuggestionDraftErrors[keyof AttachSuggestionDraftErrors];
3026
+ export type AttachSuggestionDraftResponses = {
3027
+ /**
3028
+ * Whether the draft is now the suggestion's, replacing its old one, and what to fix when it isn't
3029
+ */
3030
+ 200: SuggestionWriteOutcome;
1078
3031
  };
1079
- export type GetScheduledActionTemplateResponse = GetScheduledActionTemplateResponses[keyof GetScheduledActionTemplateResponses];
1080
- export type ShareScheduledActionTemplateData = {
1081
- body: ShareRoutineTemplate;
3032
+ export type AttachSuggestionDraftResponse = AttachSuggestionDraftResponses[keyof AttachSuggestionDraftResponses];
3033
+ export type RestoreSuggestionData = {
3034
+ body?: never;
1082
3035
  path: {
1083
3036
  /**
1084
- * ID of the routine to share
3037
+ * ID of the suggestion
1085
3038
  */
1086
3039
  id: string;
1087
3040
  };
1088
3041
  query?: never;
1089
- url: '/scheduled-actions/{id}/template';
3042
+ url: '/suggestions/{id}/restore';
1090
3043
  };
1091
- export type ShareScheduledActionTemplateErrors = {
1092
- 400: string;
3044
+ export type RestoreSuggestionErrors = {
1093
3045
  401: string;
3046
+ /**
3047
+ * A generation session may not restore
3048
+ */
3049
+ 403: string;
3050
+ /**
3051
+ * No suggestion with this id for the caller, or suggestions are off
3052
+ */
1094
3053
  404: string;
3054
+ /**
3055
+ * Not dismissed in the last five minutes, or a routine suggestion
3056
+ */
3057
+ 409: string;
1095
3058
  500: string;
1096
3059
  };
1097
- export type ShareScheduledActionTemplateError = ShareScheduledActionTemplateErrors[keyof ShareScheduledActionTemplateErrors];
1098
- export type ShareScheduledActionTemplateResponses = {
1099
- 200: RoutineTemplate;
3060
+ export type RestoreSuggestionError = RestoreSuggestionErrors[keyof RestoreSuggestionErrors];
3061
+ export type RestoreSuggestionResponses = {
3062
+ /**
3063
+ * Open again, as proposed; a run the dismissal stopped stays stopped
3064
+ */
3065
+ 204: void;
1100
3066
  };
1101
- export type ShareScheduledActionTemplateResponse = ShareScheduledActionTemplateResponses[keyof ShareScheduledActionTemplateResponses];
1102
- export type ActivateScheduledActionTemplateData = {
1103
- body: ActionConfiguration;
3067
+ export type RestoreSuggestionResponse = RestoreSuggestionResponses[keyof RestoreSuggestionResponses];
3068
+ export type RetireSuggestionData = {
3069
+ body: RetireSuggestionRequest;
1104
3070
  path: {
1105
3071
  /**
1106
- * ID of the shared routine
3072
+ * ID of the suggestion
1107
3073
  */
1108
3074
  id: string;
1109
3075
  };
1110
3076
  query?: never;
1111
- url: '/scheduled-actions/{id}/template/activate';
3077
+ url: '/suggestions/{id}/retire';
1112
3078
  };
1113
- export type ActivateScheduledActionTemplateErrors = {
3079
+ export type RetireSuggestionErrors = {
1114
3080
  400: string;
1115
3081
  401: string;
3082
+ /**
3083
+ * Only a suggestions generation session may retire
3084
+ */
1116
3085
  403: string;
1117
3086
  /**
1118
- * The routine is not shared
3087
+ * No such suggestion for the user, or suggestions are off
1119
3088
  */
1120
3089
  404: string;
1121
3090
  500: string;
1122
3091
  };
1123
- export type ActivateScheduledActionTemplateError = ActivateScheduledActionTemplateErrors[keyof ActivateScheduledActionTemplateErrors];
1124
- export type ActivateScheduledActionTemplateResponses = {
1125
- 201: ScheduledActionResponse;
3092
+ export type RetireSuggestionError = RetireSuggestionErrors[keyof RetireSuggestionErrors];
3093
+ export type RetireSuggestionResponses = {
3094
+ /**
3095
+ * Whether the suggestion was retired, and why not when it wasn't
3096
+ */
3097
+ 200: SuggestionWriteOutcome;
1126
3098
  };
1127
- export type ActivateScheduledActionTemplateResponse = ActivateScheduledActionTemplateResponses[keyof ActivateScheduledActionTemplateResponses];
3099
+ export type RetireSuggestionResponse = RetireSuggestionResponses[keyof RetireSuggestionResponses];