@macro-inc/sdk 0.0.1 → 0.2.2

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 (165) hide show
  1. package/README.md +628 -21
  2. package/dist/{chunk-5HAKQN23.js → chunk-7LVVPVNT.js} +70 -57
  3. package/dist/{chunk-JXIQT5TH.js → chunk-7YJ6Y7HJ.js} +234 -16
  4. package/dist/chunk-LMJW65ML.js +836 -0
  5. package/dist/{chunk-SGAHIERJ.js → chunk-OGE7WXJE.js} +16 -0
  6. package/dist/chunk-PRUFPW3B.js +943 -0
  7. package/dist/{chunk-CTKR64MY.js → chunk-QVBNNMQS.js} +242 -367
  8. package/dist/{chunk-QNUS5BC5.js → chunk-SUINKDXF.js} +30 -84
  9. package/dist/{chunk-77EI4LSQ.js → chunk-ZQXOHNDB.js} +1518 -386
  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 +174 -4
  13. package/dist/generated/agent-harness/types.gen.d.ts +2511 -189
  14. package/dist/generated/auth/index.d.ts +1 -1
  15. package/dist/generated/auth/index.js +1 -1
  16. package/dist/generated/auth/sdk.gen.d.ts +106 -8
  17. package/dist/generated/auth/types.gen.d.ts +1473 -116
  18. package/dist/generated/calendar/client/client.gen.d.ts +2 -0
  19. package/dist/generated/calendar/client/index.d.ts +10 -0
  20. package/dist/generated/calendar/client/types.gen.d.ts +120 -0
  21. package/dist/generated/calendar/client/utils.gen.d.ts +37 -0
  22. package/dist/generated/calendar/client.gen.d.ts +12 -0
  23. package/dist/generated/calendar/core/auth.gen.d.ts +25 -0
  24. package/dist/generated/calendar/core/bodySerializer.gen.d.ts +25 -0
  25. package/dist/generated/calendar/core/params.gen.d.ts +43 -0
  26. package/dist/generated/calendar/core/pathSerializer.gen.d.ts +33 -0
  27. package/dist/generated/calendar/core/queryKeySerializer.gen.d.ts +18 -0
  28. package/dist/generated/calendar/core/serverSentEvents.gen.d.ts +71 -0
  29. package/dist/generated/calendar/core/types.gen.d.ts +83 -0
  30. package/dist/generated/calendar/core/utils.gen.d.ts +19 -0
  31. package/dist/generated/calendar/index.d.ts +2 -0
  32. package/dist/generated/calendar/index.js +6 -0
  33. package/dist/generated/calendar/sdk.gen.d.ts +95 -0
  34. package/dist/generated/calendar/types.gen.d.ts +1091 -0
  35. package/dist/generated/cognition/index.d.ts +1 -1
  36. package/dist/generated/cognition/index.js +1 -1
  37. package/dist/generated/cognition/sdk.gen.d.ts +6 -1
  38. package/dist/generated/cognition/types.gen.d.ts +304 -36
  39. package/dist/generated/connection/types.gen.d.ts +1 -1
  40. package/dist/generated/email/index.d.ts +1 -1
  41. package/dist/generated/email/index.js +1 -1
  42. package/dist/generated/email/sdk.gen.d.ts +32 -27
  43. package/dist/generated/email/types.gen.d.ts +586 -409
  44. package/dist/generated/notification/index.d.ts +1 -1
  45. package/dist/generated/notification/types.gen.d.ts +384 -19
  46. package/dist/generated/properties/types.gen.d.ts +8 -5
  47. package/dist/generated/scheduled-action/index.d.ts +1 -1
  48. package/dist/generated/scheduled-action/index.js +3 -842
  49. package/dist/generated/scheduled-action/sdk.gen.d.ts +3 -1
  50. package/dist/generated/scheduled-action/types.gen.d.ts +277 -41
  51. package/dist/generated/search/index.d.ts +1 -1
  52. package/dist/generated/search/types.gen.d.ts +262 -43
  53. package/dist/generated/storage/index.d.ts +1 -1
  54. package/dist/generated/storage/index.js +1 -1
  55. package/dist/generated/storage/sdk.gen.d.ts +678 -107
  56. package/dist/generated/storage/types.gen.d.ts +14827 -5995
  57. package/dist/generated/unfurl/index.d.ts +1 -1
  58. package/dist/generated/unfurl/index.js +3 -832
  59. package/dist/generated/unfurl/types.gen.d.ts +20 -0
  60. package/dist/src/config.d.ts +33 -13
  61. package/dist/src/entities/agent-sessions/agent-session.d.ts +150 -6
  62. package/dist/src/entities/agent-sessions/code-execution.d.ts +43 -0
  63. package/dist/src/entities/agent-sessions/conversation.d.ts +54 -0
  64. package/dist/src/entities/agent-sessions/namespace.d.ts +23 -5
  65. package/dist/src/entities/agent-sessions/queued-action.d.ts +46 -0
  66. package/dist/src/entities/agent-sessions/review.d.ts +107 -0
  67. package/dist/src/entities/agent-sessions/tool-approval.d.ts +21 -0
  68. package/dist/src/entities/agents/agent.d.ts +47 -0
  69. package/dist/src/entities/agents/namespace.d.ts +13 -0
  70. package/dist/src/entities/ai/namespace.d.ts +24 -0
  71. package/dist/src/entities/api-keys/api-key.d.ts +17 -0
  72. package/dist/src/entities/api-keys/namespace.d.ts +18 -0
  73. package/dist/src/entities/calendar/calendar.d.ts +35 -0
  74. package/dist/src/entities/calendar/event.d.ts +123 -0
  75. package/dist/src/entities/calendar/event.test.d.ts +1 -0
  76. package/dist/src/entities/calendar/namespace.d.ts +111 -0
  77. package/dist/src/entities/calendar/replacement.d.ts +15 -0
  78. package/dist/src/entities/calls/call-record.d.ts +62 -6
  79. package/dist/src/entities/calls/message.d.ts +33 -0
  80. package/dist/src/entities/channels/activity.d.ts +24 -0
  81. package/dist/src/entities/channels/channel.d.ts +44 -3
  82. package/dist/src/entities/channels/labels.d.ts +39 -0
  83. package/dist/src/entities/channels/message.d.ts +9 -17
  84. package/dist/src/entities/channels/namespace.d.ts +6 -0
  85. package/dist/src/entities/channels/picture.d.ts +11 -0
  86. package/dist/src/entities/channels/post.d.ts +1 -1
  87. package/dist/src/entities/channels/thread.d.ts +5 -0
  88. package/dist/src/entities/chats/chat.d.ts +11 -1
  89. package/dist/src/entities/chats/generation.d.ts +46 -0
  90. package/dist/src/entities/crm/comment.d.ts +55 -34
  91. package/dist/src/entities/crm/company.d.ts +42 -10
  92. package/dist/src/entities/crm/contact.d.ts +42 -10
  93. package/dist/src/entities/crm/namespace.d.ts +18 -1
  94. package/dist/src/entities/crm/pipeline.d.ts +122 -0
  95. package/dist/src/entities/crm/pipelines.d.ts +14 -0
  96. package/dist/src/entities/databases/column.d.ts +75 -0
  97. package/dist/src/entities/databases/database.d.ts +272 -0
  98. package/dist/src/entities/databases/namespace.d.ts +21 -0
  99. package/dist/src/entities/databases/query.d.ts +86 -0
  100. package/dist/src/entities/databases/row.d.ts +27 -0
  101. package/dist/src/entities/databases/table.d.ts +61 -0
  102. package/dist/src/entities/databases/view.d.ts +40 -0
  103. package/dist/src/entities/databases/webhook.d.ts +32 -0
  104. package/dist/src/entities/documents/anchor.d.ts +29 -0
  105. package/dist/src/entities/documents/comment.d.ts +25 -22
  106. package/dist/src/entities/documents/document.d.ts +60 -12
  107. package/dist/src/entities/documents/namespace.d.ts +30 -0
  108. package/dist/src/entities/documents/version.d.ts +22 -0
  109. package/dist/src/entities/email/draft.d.ts +79 -0
  110. package/dist/src/entities/email/filter.d.ts +34 -0
  111. package/dist/src/entities/email/link.d.ts +6 -4
  112. package/dist/src/entities/email/message.d.ts +12 -1
  113. package/dist/src/entities/email/namespace.d.ts +34 -1
  114. package/dist/src/entities/email/thread.d.ts +23 -1
  115. package/dist/src/entities/entity-mentions/mention.d.ts +16 -0
  116. package/dist/src/entities/entity-mentions/namespace.d.ts +12 -0
  117. package/dist/src/entities/entity.d.ts +7 -0
  118. package/dist/src/entities/favorites/namespace.d.ts +14 -2
  119. package/dist/src/entities/foreign/foreign-entity.d.ts +2 -0
  120. package/dist/src/entities/foreign/namespace.d.ts +40 -0
  121. package/dist/src/entities/forms/form.d.ts +227 -0
  122. package/dist/src/entities/forms/namespace.d.ts +18 -0
  123. package/dist/src/entities/forms/question.d.ts +37 -0
  124. package/dist/src/entities/forms/response.d.ts +32 -0
  125. package/dist/src/entities/forms/section.d.ts +19 -0
  126. package/dist/src/entities/github-pull-requests/namespace.d.ts +12 -0
  127. package/dist/src/entities/github-pull-requests/pull-request.d.ts +52 -0
  128. package/dist/src/entities/harnesses/harness.d.ts +19 -0
  129. package/dist/src/entities/harnesses/namespace.d.ts +33 -0
  130. package/dist/src/entities/harnesses/pairing.d.ts +39 -0
  131. package/dist/src/entities/initiatives/initiative.d.ts +50 -0
  132. package/dist/src/entities/initiatives/namespace.d.ts +13 -0
  133. package/dist/src/entities/meetings/meeting.d.ts +38 -0
  134. package/dist/src/entities/meetings/namespace.d.ts +18 -0
  135. package/dist/src/entities/messages/thread.d.ts +101 -0
  136. package/dist/src/entities/notifications/notification.d.ts +6 -3
  137. package/dist/src/entities/notifications/notification.test.d.ts +1 -0
  138. package/dist/src/entities/projects/project.d.ts +7 -0
  139. package/dist/src/entities/reference.d.ts +82 -0
  140. package/dist/src/entities/routines/namespace.d.ts +15 -0
  141. package/dist/src/entities/routines/routine.d.ts +115 -0
  142. package/dist/src/entities/sharing/access.d.ts +65 -0
  143. package/dist/src/entities/sharing/permissions.d.ts +13 -0
  144. package/dist/src/entities/tasks/namespace.d.ts +4 -0
  145. package/dist/src/entities/tasks/task.d.ts +6 -0
  146. package/dist/src/entities/unfurls/namespace.d.ts +10 -0
  147. package/dist/src/entities/webhooks/webhook.d.ts +3 -1
  148. package/dist/src/entities/workspace/items.d.ts +7 -0
  149. package/dist/src/entities/workspace/namespace.d.ts +83 -0
  150. package/dist/src/entities/workspace/query.d.ts +12 -0
  151. package/dist/src/entities/workspace/types.d.ts +96 -0
  152. package/dist/src/events/hydrate/agentSession.d.ts +192 -0
  153. package/dist/src/events/hydrate/channel.d.ts +2 -39
  154. package/dist/src/events/hydrate/message.d.ts +70 -0
  155. package/dist/src/events/receiver.d.ts +57 -19
  156. package/dist/src/events/types.d.ts +3 -1
  157. package/dist/src/macro.d.ts +80 -3
  158. package/dist/src/macro.js +8832 -2784
  159. package/dist/src/utils/activity.d.ts +11 -0
  160. package/dist/src/utils/activity.test.d.ts +1 -0
  161. package/dist/src/utils/client.d.ts +10 -1
  162. package/dist/src/utils/concurrency.d.ts +5 -0
  163. package/dist/src/utils/index.d.ts +1 -0
  164. package/dist/src/utils/pagination.d.ts +9 -4
  165. package/package.json +11 -3
@@ -1,5 +1,5 @@
1
1
  import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';
2
- import type { CreateScheduledActionData, CreateScheduledActionErrors, CreateScheduledActionResponses, DeleteScheduledActionData, DeleteScheduledActionErrors, DeleteScheduledActionResponses, ExecuteScheduledActionNowData, ExecuteScheduledActionNowErrors, ExecuteScheduledActionNowResponses, ListScheduledActionHistoryData, ListScheduledActionHistoryErrors, ListScheduledActionHistoryResponses, ListScheduledActionsData, ListScheduledActionsErrors, ListScheduledActionsResponses, ScheduledActionHealthData, ScheduledActionHealthResponses, UpdateScheduledActionData, UpdateScheduledActionErrors, UpdateScheduledActionResponses } from './types.gen';
2
+ import type { CreateScheduledActionData, CreateScheduledActionErrors, CreateScheduledActionResponses, DeleteScheduledActionData, DeleteScheduledActionErrors, DeleteScheduledActionResponses, ExecuteScheduledActionNowData, ExecuteScheduledActionNowErrors, ExecuteScheduledActionNowResponses, GetScheduledActionData, GetScheduledActionErrors, GetScheduledActionResponses, ListScheduledActionHistoryData, ListScheduledActionHistoryErrors, ListScheduledActionHistoryResponses, ListScheduledActionsData, ListScheduledActionsErrors, ListScheduledActionsResponses, ScheduledActionHealthData, ScheduledActionHealthResponses, SetScheduledActionEnabledData, SetScheduledActionEnabledErrors, SetScheduledActionEnabledResponses, UpdateScheduledActionData, UpdateScheduledActionErrors, UpdateScheduledActionResponses } from './types.gen';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -35,7 +35,9 @@ export declare class Sdk extends HeyApiClient {
35
35
  listScheduledActions<ThrowOnError extends boolean = false>(options?: Options<ListScheduledActionsData, ThrowOnError>): RequestResult<ListScheduledActionsResponses, ListScheduledActionsErrors, ThrowOnError>;
36
36
  createScheduledAction<ThrowOnError extends boolean = false>(options: Options<CreateScheduledActionData, ThrowOnError>): RequestResult<CreateScheduledActionResponses, CreateScheduledActionErrors, ThrowOnError>;
37
37
  deleteScheduledAction<ThrowOnError extends boolean = false>(options: Options<DeleteScheduledActionData, ThrowOnError>): RequestResult<DeleteScheduledActionResponses, DeleteScheduledActionErrors, ThrowOnError>;
38
+ getScheduledAction<ThrowOnError extends boolean = false>(options: Options<GetScheduledActionData, ThrowOnError>): RequestResult<GetScheduledActionResponses, GetScheduledActionErrors, ThrowOnError>;
38
39
  updateScheduledAction<ThrowOnError extends boolean = false>(options: Options<UpdateScheduledActionData, ThrowOnError>): RequestResult<UpdateScheduledActionResponses, UpdateScheduledActionErrors, ThrowOnError>;
40
+ setScheduledActionEnabled<ThrowOnError extends boolean = false>(options: Options<SetScheduledActionEnabledData, ThrowOnError>): RequestResult<SetScheduledActionEnabledResponses, SetScheduledActionEnabledErrors, ThrowOnError>;
39
41
  executeScheduledActionNow<ThrowOnError extends boolean = false>(options: Options<ExecuteScheduledActionNowData, ThrowOnError>): RequestResult<ExecuteScheduledActionNowResponses, ExecuteScheduledActionNowErrors, ThrowOnError>;
40
42
  listScheduledActionHistory<ThrowOnError extends boolean = false>(options: Options<ListScheduledActionHistoryData, ThrowOnError>): RequestResult<ListScheduledActionHistoryResponses, ListScheduledActionHistoryErrors, ThrowOnError>;
41
43
  }
@@ -1,6 +1,36 @@
1
1
  export type ClientOptions = {
2
2
  baseUrl: `${string}://${string}` | (string & {});
3
3
  };
4
+ /**
5
+ * Canonical client configuration. Ownership and execution state are server-owned.
6
+ */
7
+ export type ActionConfiguration = {
8
+ enabled: boolean;
9
+ kind: ActionKind;
10
+ name: string;
11
+ task: {
12
+ [key: string]: unknown;
13
+ };
14
+ trigger: ActionTrigger;
15
+ };
16
+ /**
17
+ * Canonical configuration replacement. Activation has its own endpoint, so
18
+ * omitting `enabled` keeps the stored value.
19
+ */
20
+ export type ActionConfigurationUpdate = {
21
+ /**
22
+ * Still sent by clients deployed before the activation endpoint.
23
+ *
24
+ * @deprecated
25
+ */
26
+ enabled?: boolean | null;
27
+ kind: ActionKind;
28
+ name: string;
29
+ task: {
30
+ [key: string]: unknown;
31
+ };
32
+ trigger: ActionTrigger;
33
+ };
4
34
  export type ActionExecutionRecord = {
5
35
  action_id: string;
6
36
  created_at: string;
@@ -8,8 +38,8 @@ export type ActionExecutionRecord = {
8
38
  id?: string | null;
9
39
  is_success: boolean;
10
40
  /**
11
- * ID of the primary resource produced by this run (e.g. a chat thread).
12
- * Opaque to the scheduler; the UI interprets it based on the action kind.
41
+ * ID of the primary resource produced by this run. Its type is recorded in
42
+ * `result`, independently of the routine's current configuration.
13
43
  */
14
44
  resource_id?: string | null;
15
45
  result: {
@@ -18,17 +48,120 @@ export type ActionExecutionRecord = {
18
48
  start_time: string;
19
49
  };
20
50
  export type ActionKind = 'Agent';
51
+ /**
52
+ * A routine may run on one trigger or any of several schedules and Macro events.
53
+ */
54
+ export type ActionTrigger = {
55
+ schedule: Schedule;
56
+ timezone: string;
57
+ type: 'cron';
58
+ } | {
59
+ filters: EventFilters;
60
+ type: 'events';
61
+ } | {
62
+ triggers: RoutineTriggers;
63
+ type: 'multiple';
64
+ };
21
65
  export type AgentTask = {
22
- model: string;
66
+ agent?: null | AgentTaskAgent;
67
+ model?: null | RoutineModelId;
23
68
  prompt: string;
24
69
  user_prompt: string;
25
70
  };
26
71
  /**
27
- * Client-supplied payload for creating a scheduled action. The server fills
28
- * in `id`, `owner` (from the authenticated user), timestamps, `claimed`, and
29
- * `next_run_at` (derived from the cron).
72
+ * A persona selection, independent of its runtime and current default model.
73
+ */
74
+ export type AgentTaskAgent = {
75
+ bot_id: string;
76
+ };
77
+ /**
78
+ * Public admission error payload. Handlers with additional fields can reuse the
79
+ * domain error's code and message and [`admission_status`].
80
+ */
81
+ export type AiAdmissionErrorBody = {
82
+ /**
83
+ * Stable denial or unavailability code.
84
+ */
85
+ code: string;
86
+ /**
87
+ * Human-readable explanation, without internal billing diagnostics.
88
+ */
89
+ error: string;
90
+ };
91
+ /**
92
+ * Why an event-triggered run was skipped before it started.
93
+ */
94
+ export type ConditionResult = {
95
+ /**
96
+ * The classifier's probability, from 0 to 1, that the answer was yes.
97
+ */
98
+ probability: number;
99
+ status: 'not_met';
100
+ } | {
101
+ status: 'unavailable';
102
+ };
103
+ /**
104
+ * Exactly one representation is accepted, even if mixed fields agree or are null.
105
+ */
106
+ export type CreateScheduledAction = ActionConfiguration | LegacyActionConfiguration;
107
+ /**
108
+ * Empty response is required due to custom fetch forcing `response.json()`
109
+ */
110
+ export type EmptyResponse = {
111
+ [key: string]: unknown;
112
+ };
113
+ /**
114
+ * An event name AND an entity ID must match within the same filter. A
115
+ * condition further requires the event's content to answer it with yes.
116
+ */
117
+ export type EventFilter = {
118
+ /**
119
+ * Yes/no question about the triggering content, e.g. "Is this email an
120
+ * invoice?". The routine runs only when the answer is yes.
121
+ */
122
+ condition?: string | null;
123
+ events: Array<EventName>;
124
+ ids?: Array<string> | null;
125
+ };
126
+ /**
127
+ * Bounded nonempty OR of filters, canonicalized to remove duplicates.
128
+ */
129
+ export type EventFilters = Array<EventFilter>;
130
+ /**
131
+ * Closed allowlist: unknown names, deletions and ambiguous attribution are not
132
+ * selectors. Adding a broker variant does not automatically enable routines.
133
+ */
134
+ 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';
135
+ /**
136
+ * Transcript resource created by a run. Never infer this from current task configuration.
30
137
  */
31
- export type CreateScheduledAction = {
138
+ export type ExecutionResource = {
139
+ id: string;
140
+ type: ExecutionResourceType;
141
+ };
142
+ /**
143
+ * Closed set of transcript destinations understood by routine clients.
144
+ */
145
+ export type ExecutionResourceType = 'chat' | 'agent';
146
+ /**
147
+ * Version 1 execution metadata stored in the existing JSON result column.
148
+ * Null/string column values predate this envelope and refer to legacy chats.
149
+ */
150
+ export type ExecutionResult = {
151
+ condition?: null | ConditionResult;
152
+ error?: string | null;
153
+ resource?: null | ExecutionResource;
154
+ version: number;
155
+ };
156
+ export type InProgressExecution = {
157
+ action_id: string;
158
+ chat_id?: string | null;
159
+ resource?: null | ExecutionResource;
160
+ };
161
+ /**
162
+ * Deprecated cron-only input, accepted during the compatibility rollout.
163
+ */
164
+ export type LegacyActionConfiguration = {
32
165
  enabled: boolean;
33
166
  kind: ActionKind;
34
167
  name: string;
@@ -39,75 +172,109 @@ export type CreateScheduledAction = {
39
172
  timezone: string;
40
173
  };
41
174
  /**
42
- * Empty response is required due to custom fetch forcing `response.json()`
175
+ * A nonblank model identifier. Runtime catalogs, not the scheduler, own availability.
43
176
  */
44
- export type EmptyResponse = {
45
- [key: string]: unknown;
46
- };
47
- export type InProgressExecution = {
48
- action_id: string;
49
- chat_id?: string | null;
177
+ export type RoutineModelId = string;
178
+ /**
179
+ * An individual trigger in a routine's trigger list.
180
+ */
181
+ export type RoutineTrigger = {
182
+ schedule: Schedule;
183
+ timezone: string;
184
+ type: 'cron';
185
+ } | {
186
+ filters: EventFilters;
187
+ type: 'events';
50
188
  };
189
+ /**
190
+ * Bounded schedules and one combined set of event filters.
191
+ */
192
+ export type RoutineTriggers = Array<RoutineTrigger>;
51
193
  export type Schedule = string;
52
194
  export type ScheduledAction = {
53
195
  claimed?: string | null;
196
+ /**
197
+ * Independent of execution bookkeeping in `updated_at`.
198
+ */
199
+ configuration_revision: number;
54
200
  created_at: string;
55
201
  /**
56
- * When false, the cron dispatcher skips this schedule. `run_now` remains
202
+ * When false, automatic dispatch skips this action. `run_now` remains
57
203
  * available regardless.
58
204
  */
59
205
  enabled: boolean;
206
+ /**
207
+ * Event publication boundary; absent for cron actions.
208
+ */
209
+ event_activated_at?: string | null;
60
210
  id?: string | null;
61
211
  kind: ActionKind;
62
212
  name: string;
63
213
  /**
64
- * Time of the next scheduled firing (derived from the cron on write). UI
65
- * uses this to render "next run" without having to parse the cron itself.
214
+ * Next cron firing, absent for event-triggered actions.
215
+ */
216
+ next_run_at?: string | null;
217
+ /**
218
+ * Who the action belongs to. Every action is user-owned today, but the
219
+ * type no longer says so: the principal string on the wire and in the
220
+ * `owner` column is the same, and a bot- or team-owned row decodes
221
+ * rather than failing to parse.
66
222
  */
67
- next_run_at: string;
68
223
  owner: string;
69
- schedule: Schedule;
70
224
  task: {
71
225
  [key: string]: unknown;
72
226
  };
73
- timezone: string;
227
+ trigger: ActionTrigger;
74
228
  updated_at: string;
75
229
  };
230
+ /**
231
+ * Canonical trigger plus deprecated cron fields for existing clients. Event
232
+ * responses omit legacy fields rather than inventing a schedule or timezone.
233
+ */
234
+ export type ScheduledActionResponse = ScheduledAction & {
235
+ /**
236
+ * Deprecated: use `trigger.schedule`. Present only for cron actions.
237
+ *
238
+ * @deprecated
239
+ */
240
+ schedule?: string | null;
241
+ /**
242
+ * Deprecated: use `trigger.timezone`. Present only for cron actions.
243
+ *
244
+ * @deprecated
245
+ */
246
+ timezone?: string | null;
247
+ };
76
248
  /**
77
249
  * Live status update for a scheduled-action run, broadcast via the connection
78
- * gateway to the owner. Clients use the `chat_id` to navigate to the run
79
- * transcript and the variant tag to toggle the running indicator.
250
+ * gateway to the owner. Clients use the typed resource to navigate to the run
251
+ * transcript and the variant tag to toggle the running indicator. `chat_id`
252
+ * remains populated only for chat runs, for older clients.
80
253
  *
81
254
  * Serialized with a `type` tag (`started`/`stopped`) and delivered over the
82
255
  * single `scheduled_action_update` message type on the gateway.
83
256
  */
84
257
  export type ScheduledActionUpdate = {
85
258
  action_id: string;
86
- chat_id: string;
259
+ chat_id?: string | null;
87
260
  owner: string;
261
+ resource?: null | ExecutionResource;
88
262
  type: 'started';
89
263
  } | {
90
264
  action_id: string;
91
- chat_id: string;
265
+ chat_id?: string | null;
92
266
  is_success: boolean;
93
267
  owner: string;
268
+ resource?: null | ExecutionResource;
94
269
  type: 'stopped';
95
270
  };
96
- /**
97
- * Client-supplied payload for updating a scheduled action. Mirrors the fields
98
- * the repository actually writes — `id`/`owner`/timestamps/`claimed`/
99
- * `next_run_at` are not client-mutable.
100
- */
101
- export type UpdateScheduledAction = {
271
+ export type SetScheduledActionEnabled = {
102
272
  enabled: boolean;
103
- kind: ActionKind;
104
- name: string;
105
- schedule: Schedule;
106
- task: {
107
- [key: string]: unknown;
108
- };
109
- timezone: string;
110
273
  };
274
+ /**
275
+ * Full replacement of client configuration, not of server-owned action state.
276
+ */
277
+ export type UpdateScheduledAction = ActionConfigurationUpdate | LegacyActionConfiguration;
111
278
  export type ScheduledActionHealthData = {
112
279
  body?: never;
113
280
  path?: never;
@@ -124,16 +291,22 @@ export type ScheduledActionHealthResponse = ScheduledActionHealthResponses[keyof
124
291
  export type ListScheduledActionsData = {
125
292
  body?: never;
126
293
  path?: never;
127
- query?: never;
294
+ query?: {
295
+ /**
296
+ * Backend clients must opt in to event actions; defaults to false (cron-only).
297
+ */
298
+ include_events?: boolean | null;
299
+ };
128
300
  url: '/scheduled-actions';
129
301
  };
130
302
  export type ListScheduledActionsErrors = {
303
+ 400: string;
131
304
  401: string;
132
305
  500: string;
133
306
  };
134
307
  export type ListScheduledActionsError = ListScheduledActionsErrors[keyof ListScheduledActionsErrors];
135
308
  export type ListScheduledActionsResponses = {
136
- 200: Array<ScheduledAction>;
309
+ 200: Array<ScheduledActionResponse>;
137
310
  };
138
311
  export type ListScheduledActionsResponse = ListScheduledActionsResponses[keyof ListScheduledActionsResponses];
139
312
  export type CreateScheduledActionData = {
@@ -143,12 +316,14 @@ export type CreateScheduledActionData = {
143
316
  url: '/scheduled-actions';
144
317
  };
145
318
  export type CreateScheduledActionErrors = {
319
+ 400: string;
146
320
  401: string;
321
+ 403: string;
147
322
  500: string;
148
323
  };
149
324
  export type CreateScheduledActionError = CreateScheduledActionErrors[keyof CreateScheduledActionErrors];
150
325
  export type CreateScheduledActionResponses = {
151
- 201: ScheduledAction;
326
+ 201: ScheduledActionResponse;
152
327
  };
153
328
  export type CreateScheduledActionResponse = CreateScheduledActionResponses[keyof CreateScheduledActionResponses];
154
329
  export type DeleteScheduledActionData = {
@@ -172,6 +347,27 @@ export type DeleteScheduledActionResponses = {
172
347
  204: void;
173
348
  };
174
349
  export type DeleteScheduledActionResponse = DeleteScheduledActionResponses[keyof DeleteScheduledActionResponses];
350
+ export type GetScheduledActionData = {
351
+ body?: never;
352
+ path: {
353
+ /**
354
+ * ID of the scheduled action
355
+ */
356
+ id: string;
357
+ };
358
+ query?: never;
359
+ url: '/scheduled-actions/{id}';
360
+ };
361
+ export type GetScheduledActionErrors = {
362
+ 401: string;
363
+ 404: string;
364
+ 500: string;
365
+ };
366
+ export type GetScheduledActionError = GetScheduledActionErrors[keyof GetScheduledActionErrors];
367
+ export type GetScheduledActionResponses = {
368
+ 200: ScheduledActionResponse;
369
+ };
370
+ export type GetScheduledActionResponse = GetScheduledActionResponses[keyof GetScheduledActionResponses];
175
371
  export type UpdateScheduledActionData = {
176
372
  body: UpdateScheduledAction;
177
373
  path: {
@@ -184,15 +380,46 @@ export type UpdateScheduledActionData = {
184
380
  url: '/scheduled-actions/{id}';
185
381
  };
186
382
  export type UpdateScheduledActionErrors = {
383
+ 400: string;
187
384
  401: string;
188
385
  404: string;
386
+ /**
387
+ * Configuration changed or execution is active
388
+ */
389
+ 409: string;
189
390
  500: string;
190
391
  };
191
392
  export type UpdateScheduledActionError = UpdateScheduledActionErrors[keyof UpdateScheduledActionErrors];
192
393
  export type UpdateScheduledActionResponses = {
193
- 200: ScheduledAction;
394
+ 200: ScheduledActionResponse;
194
395
  };
195
396
  export type UpdateScheduledActionResponse = UpdateScheduledActionResponses[keyof UpdateScheduledActionResponses];
397
+ export type SetScheduledActionEnabledData = {
398
+ body: SetScheduledActionEnabled;
399
+ path: {
400
+ /**
401
+ * ID of the scheduled action
402
+ */
403
+ id: string;
404
+ };
405
+ query?: never;
406
+ url: '/scheduled-actions/{id}/enabled';
407
+ };
408
+ export type SetScheduledActionEnabledErrors = {
409
+ 400: string;
410
+ 401: string;
411
+ 404: string;
412
+ /**
413
+ * Configuration changed or execution is active
414
+ */
415
+ 409: string;
416
+ 500: string;
417
+ };
418
+ export type SetScheduledActionEnabledError = SetScheduledActionEnabledErrors[keyof SetScheduledActionEnabledErrors];
419
+ export type SetScheduledActionEnabledResponses = {
420
+ 200: ScheduledActionResponse;
421
+ };
422
+ export type SetScheduledActionEnabledResponse = SetScheduledActionEnabledResponses[keyof SetScheduledActionEnabledResponses];
196
423
  export type ExecuteScheduledActionNowData = {
197
424
  body?: never;
198
425
  path: {
@@ -205,13 +432,22 @@ export type ExecuteScheduledActionNowData = {
205
432
  url: '/scheduled-actions/{id}/execute';
206
433
  };
207
434
  export type ExecuteScheduledActionNowErrors = {
435
+ 400: string;
208
436
  401: string;
437
+ /**
438
+ * AI allowance exhausted
439
+ */
440
+ 402: AiAdmissionErrorBody;
209
441
  404: string;
210
442
  /**
211
443
  * Action is already running
212
444
  */
213
445
  409: string;
214
446
  500: string;
447
+ /**
448
+ * AI usage validation unavailable; retry later
449
+ */
450
+ 503: AiAdmissionErrorBody;
215
451
  };
216
452
  export type ExecuteScheduledActionNowError = ExecuteScheduledActionNowErrors[keyof ExecuteScheduledActionNowErrors];
217
453
  export type ExecuteScheduledActionNowResponses = {
@@ -1,2 +1,2 @@
1
1
  export { type Options, Sdk } from './sdk.gen';
2
- export type { CalendarEventFilters, CalendarEventMetadata, CalendarEventSearchOccurrence, CalendarEventSearchResponseItem, CalendarEventSearchResponseItemWithMetadata, CalendarEventSearchResult, CalendarEventSearchTime, CallFilters, CallRecordMetadata, CallRecordSearchResponseItem, CallRecordSearchResponseItemWithMetadata, CallRecordSearchResult, CallStatus, ChannelFilters, ChannelMessageSearchResponseItem, ChannelMetadata, ChannelNameSearchResponseItem, ChannelSearchRequest, ChannelSearchResponse, ChannelSearchResponseItem, ChannelSearchResponseItemWithMetadata, ChannelSearchResult, ChannelSortTimestamp, ChannelThreadFilters, ChatFilters, ChatMessageSearchResult, ChatMetadata, ChatSearchRequest, ChatSearchResponse, ChatSearchResponseItem, ChatSearchResponseItemWithMetadata, ClientOptions, CrmCompanyFilters, CrmCompanySearchDomain, CrmCompanySearchResponseItem, DataType, DocumentFilters, DocumentMetadata, DocumentSearchRequest, DocumentSearchResponse, DocumentSearchResponseItem, DocumentSearchResponseItemWithMetadata, DocumentSearchResult, DocumentSubType, EmailFilters, EmailSearchParticipant, EmailSearchRequest, EmailSearchResponse, EmailSearchResponseItem, EmailSearchResponseItemWithMetadata, EmailSearchResult, EmptyResponse, EntityFilters, EntityReference, EntityType, ErrorResponse, FileType, ForeignEntityFilters, MatchType, NotificationFilters, ProjectFilters, ProjectMetadata, ProjectSearchMetadata, ProjectSearchRequest, ProjectSearchResponseItem, ProjectSearchResponseItemWithMetadata, ProjectSearchResult, PropertyDefinition, PropertyFilter, PropertyOwner, PropertyValue, ReminderFilters, SearchHighlight, SearchOn, SearchResponse, SharedEmailFilter, SimpleCalendarEventSearchResponseBaseItemHumanReadableTimestamp, SimpleCallRecordSearchResponseBaseItemHumanReadableTimestamp, SimpleChannelSearchReponseBaseItem, SimpleChannelSearchReponseBaseItemHumanReadableTimestamp, SimpleChannelSearchResponse, SimpleChatSearchResponse, SimpleChatSearchResponseBaseItem, SimpleChatSearchResponseBaseItemHumanReadableTimestamp, SimpleDocumentSearchResponse, SimpleDocumentSearchResponseBaseItem, SimpleDocumentSearchResponseBaseItemHumanReadableTimestamp, SimpleEmailSearchResponse, SimpleEmailSearchResponseBaseItem, SimpleEmailSearchResponseBaseItemHumanReadableTimestamp, SimpleProjectSearchResponse, SimpleProjectSearchResponseBaseItem, SimpleProjectSearchResponseBaseItemHumanReadableTimestamp, SimpleUnifiedSearchBaseResponse, SimpleUnifiedSearchData, SimpleUnifiedSearchError, SimpleUnifiedSearchErrors, SimpleUnifiedSearchResponse, SimpleUnifiedSearchResponseBaseItem, SimpleUnifiedSearchResponseBaseItemHumanReadableTimestamp, SimpleUnifiedSearchResponses, SoupProperty, TagFilterMode, TaskFilters, UnifiedSearchData, UnifiedSearchError, UnifiedSearchErrors, UnifiedSearchRequest, UnifiedSearchResponse, UnifiedSearchResponse2, UnifiedSearchResponseItem, UnifiedSearchResponses } from './types.gen';
2
+ export type { AgentSessionAuthor, AgentSessionFilters, AgentSessionSearchResponseItem, AgentSessionSearchResult, CalendarEventFilters, CalendarEventMetadata, CalendarEventOrganizer, CalendarEventSearchOccurrence, CalendarEventSearchResponseItem, CalendarEventSearchResponseItemWithMetadata, CalendarEventSearchResult, CalendarEventSearchTime, CallFilters, CallRecordMetadata, CallRecordSearchResponseItem, CallRecordSearchResponseItemWithMetadata, CallRecordSearchResult, CallStatus, ChannelFilters, ChannelMessageSearchResponseItem, ChannelMetadata, ChannelNameSearchResponseItem, ChannelSearchRequest, ChannelSearchResponse, ChannelSearchResponseItem, ChannelSearchResponseItemWithMetadata, ChannelSearchResult, ChannelSortTimestamp, ChannelThreadFilters, ChatFilters, ChatMessageSearchResult, ChatMetadata, ChatSearchRequest, ChatSearchResponse, ChatSearchResponseItem, ChatSearchResponseItemWithMetadata, ClientOptions, CrmCompanyFilters, CrmCompanySearchDomain, CrmCompanySearchResponseItem, DataType, DocumentFilters, DocumentMetadata, DocumentSearchRequest, DocumentSearchResponse, DocumentSearchResponseItem, DocumentSearchResponseItemWithMetadata, DocumentSearchResult, DocumentSubType, EmailFilters, EmailSearchParticipant, EmailSearchRequest, EmailSearchResponse, EmailSearchResponseItem, EmailSearchResponseItemWithMetadata, EmailSearchResult, EmptyResponse, EntityFilters, EntityReference, EntityType, ErrorResponse, FileType, ForeignEntityFilters, Highlight, InitiativeFilters, MatchType, NotificationFilters, NotificationState, ProjectFilters, ProjectMetadata, ProjectSearchMetadata, ProjectSearchRequest, ProjectSearchResponseItem, ProjectSearchResponseItemWithMetadata, ProjectSearchResult, PropertyDefinition, PropertyFilter, PropertyOwner, PropertyValue, SearchGotoAgentSession, SearchGotoCallRecord, SearchGotoChannel, SearchGotoChat, SearchGotoContent, SearchGotoDocument, SearchGotoEmail, SearchHighlight, SearchOn, SearchResponse, SharedEmailFilter, SimpleCalendarEventSearchResponseBaseItemHumanReadableTimestamp, SimpleCallRecordSearchResponseBaseItemHumanReadableTimestamp, SimpleChannelSearchReponseBaseItem, SimpleChannelSearchReponseBaseItemHumanReadableTimestamp, SimpleChannelSearchResponse, SimpleChatSearchResponse, SimpleChatSearchResponseBaseItem, SimpleChatSearchResponseBaseItemHumanReadableTimestamp, SimpleDocumentSearchResponse, SimpleDocumentSearchResponseBaseItem, SimpleDocumentSearchResponseBaseItemHumanReadableTimestamp, SimpleEmailSearchResponse, SimpleEmailSearchResponseBaseItem, SimpleEmailSearchResponseBaseItemHumanReadableTimestamp, SimpleProjectSearchResponse, SimpleProjectSearchResponseBaseItem, SimpleProjectSearchResponseBaseItemHumanReadableTimestamp, SimpleSearchResponse, SimpleSearchResponseItem, SimpleUnifiedSearchBaseResponse, SimpleUnifiedSearchData, SimpleUnifiedSearchError, SimpleUnifiedSearchErrors, SimpleUnifiedSearchResponse, SimpleUnifiedSearchResponseBaseItem, SimpleUnifiedSearchResponseBaseItemHumanReadableTimestamp, SimpleUnifiedSearchResponses, SoupProperty, TagFilterMode, TaskFilters, UnifiedSearchData, UnifiedSearchError, UnifiedSearchErrors, UnifiedSearchRequest, UnifiedSearchResponse, UnifiedSearchResponse2, UnifiedSearchResponseItem, UnifiedSearchResponses } from './types.gen';