@trigger.dev/core 4.7.2 → 4.7.3

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 (121) hide show
  1. package/dist/commonjs/v3/apiClient/index.d.ts +103 -1
  2. package/dist/commonjs/v3/apiClient/index.js +42 -0
  3. package/dist/commonjs/v3/apiClient/index.js.map +1 -1
  4. package/dist/commonjs/v3/isomorphic/friendlyId.d.ts +5 -0
  5. package/dist/commonjs/v3/isomorphic/friendlyId.js +8 -0
  6. package/dist/commonjs/v3/isomorphic/friendlyId.js.map +1 -1
  7. package/dist/commonjs/v3/resource-catalog/catalog.d.ts +7 -5
  8. package/dist/commonjs/v3/resource-catalog/index.d.ts +7 -5
  9. package/dist/commonjs/v3/resource-catalog/index.js +14 -8
  10. package/dist/commonjs/v3/resource-catalog/index.js.map +1 -1
  11. package/dist/commonjs/v3/resource-catalog/noopResourceCatalog.d.ts +7 -5
  12. package/dist/commonjs/v3/resource-catalog/noopResourceCatalog.js +10 -4
  13. package/dist/commonjs/v3/resource-catalog/noopResourceCatalog.js.map +1 -1
  14. package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.d.ts +11 -8
  15. package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.js +29 -20
  16. package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.js.map +1 -1
  17. package/dist/commonjs/v3/runEngineWorker/index.d.ts +1 -0
  18. package/dist/commonjs/v3/runEngineWorker/index.js +1 -0
  19. package/dist/commonjs/v3/runEngineWorker/index.js.map +1 -1
  20. package/dist/commonjs/v3/runEngineWorker/supervisor/http.d.ts +6 -1
  21. package/dist/commonjs/v3/runEngineWorker/supervisor/http.js +12 -0
  22. package/dist/commonjs/v3/runEngineWorker/supervisor/http.js.map +1 -1
  23. package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.d.ts +4 -2
  24. package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.js +11 -4
  25. package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.js.map +1 -1
  26. package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.d.ts +40 -1
  27. package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.js +25 -10
  28. package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.js.map +1 -1
  29. package/dist/commonjs/v3/runEngineWorker/supervisor/session.d.ts +2 -1
  30. package/dist/commonjs/v3/runEngineWorker/supervisor/session.js +1 -1
  31. package/dist/commonjs/v3/runEngineWorker/supervisor/session.js.map +1 -1
  32. package/dist/commonjs/v3/runEngineWorker/workerQueue.d.ts +121 -0
  33. package/dist/commonjs/v3/runEngineWorker/workerQueue.js +121 -0
  34. package/dist/commonjs/v3/runEngineWorker/workerQueue.js.map +1 -0
  35. package/dist/commonjs/v3/schemas/api.d.ts +26 -9
  36. package/dist/commonjs/v3/schemas/build.d.ts +48 -18
  37. package/dist/commonjs/v3/schemas/build.js +2 -1
  38. package/dist/commonjs/v3/schemas/build.js.map +1 -1
  39. package/dist/commonjs/v3/schemas/checkpoints.d.ts +2 -0
  40. package/dist/commonjs/v3/schemas/messages.d.ts +24 -9
  41. package/dist/commonjs/v3/schemas/resources.d.ts +50 -19
  42. package/dist/commonjs/v3/schemas/resources.js +9 -5
  43. package/dist/commonjs/v3/schemas/resources.js.map +1 -1
  44. package/dist/commonjs/v3/schemas/runEngine.d.ts +4 -0
  45. package/dist/commonjs/v3/schemas/runEngine.js +4 -0
  46. package/dist/commonjs/v3/schemas/runEngine.js.map +1 -1
  47. package/dist/commonjs/v3/schemas/schemas.d.ts +38 -29
  48. package/dist/commonjs/v3/schemas/schemas.js +12 -8
  49. package/dist/commonjs/v3/schemas/schemas.js.map +1 -1
  50. package/dist/commonjs/v3/schemas/webhookApi.d.ts +199 -8
  51. package/dist/commonjs/v3/schemas/webhookApi.js +100 -7
  52. package/dist/commonjs/v3/schemas/webhookApi.js.map +1 -1
  53. package/dist/commonjs/v3/schemas/webhookConfig.d.ts +64 -0
  54. package/dist/commonjs/v3/schemas/webhookConfig.js +36 -9
  55. package/dist/commonjs/v3/schemas/webhookConfig.js.map +1 -1
  56. package/dist/commonjs/v3/types/webhooks.d.ts +23 -2
  57. package/dist/commonjs/v3/webhooks/index.d.ts +5 -0
  58. package/dist/commonjs/v3/webhooks/index.js +29 -1
  59. package/dist/commonjs/v3/webhooks/index.js.map +1 -1
  60. package/dist/commonjs/version.js +1 -1
  61. package/dist/esm/v3/apiClient/index.d.ts +103 -1
  62. package/dist/esm/v3/apiClient/index.js +43 -1
  63. package/dist/esm/v3/apiClient/index.js.map +1 -1
  64. package/dist/esm/v3/isomorphic/friendlyId.d.ts +5 -0
  65. package/dist/esm/v3/isomorphic/friendlyId.js +7 -0
  66. package/dist/esm/v3/isomorphic/friendlyId.js.map +1 -1
  67. package/dist/esm/v3/resource-catalog/catalog.d.ts +7 -5
  68. package/dist/esm/v3/resource-catalog/index.d.ts +7 -5
  69. package/dist/esm/v3/resource-catalog/index.js +14 -8
  70. package/dist/esm/v3/resource-catalog/index.js.map +1 -1
  71. package/dist/esm/v3/resource-catalog/noopResourceCatalog.d.ts +7 -5
  72. package/dist/esm/v3/resource-catalog/noopResourceCatalog.js +10 -4
  73. package/dist/esm/v3/resource-catalog/noopResourceCatalog.js.map +1 -1
  74. package/dist/esm/v3/resource-catalog/standardResourceCatalog.d.ts +11 -8
  75. package/dist/esm/v3/resource-catalog/standardResourceCatalog.js +29 -20
  76. package/dist/esm/v3/resource-catalog/standardResourceCatalog.js.map +1 -1
  77. package/dist/esm/v3/runEngineWorker/index.d.ts +1 -0
  78. package/dist/esm/v3/runEngineWorker/index.js +1 -0
  79. package/dist/esm/v3/runEngineWorker/index.js.map +1 -1
  80. package/dist/esm/v3/runEngineWorker/supervisor/http.d.ts +6 -1
  81. package/dist/esm/v3/runEngineWorker/supervisor/http.js +13 -1
  82. package/dist/esm/v3/runEngineWorker/supervisor/http.js.map +1 -1
  83. package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.d.ts +4 -2
  84. package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.js +11 -4
  85. package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.js.map +1 -1
  86. package/dist/esm/v3/runEngineWorker/supervisor/schemas.d.ts +40 -1
  87. package/dist/esm/v3/runEngineWorker/supervisor/schemas.js +24 -9
  88. package/dist/esm/v3/runEngineWorker/supervisor/schemas.js.map +1 -1
  89. package/dist/esm/v3/runEngineWorker/supervisor/session.d.ts +2 -1
  90. package/dist/esm/v3/runEngineWorker/supervisor/session.js +1 -1
  91. package/dist/esm/v3/runEngineWorker/supervisor/session.js.map +1 -1
  92. package/dist/esm/v3/runEngineWorker/workerQueue.d.ts +121 -0
  93. package/dist/esm/v3/runEngineWorker/workerQueue.js +112 -0
  94. package/dist/esm/v3/runEngineWorker/workerQueue.js.map +1 -0
  95. package/dist/esm/v3/schemas/api.d.ts +26 -9
  96. package/dist/esm/v3/schemas/build.d.ts +48 -18
  97. package/dist/esm/v3/schemas/build.js +3 -2
  98. package/dist/esm/v3/schemas/build.js.map +1 -1
  99. package/dist/esm/v3/schemas/checkpoints.d.ts +2 -0
  100. package/dist/esm/v3/schemas/messages.d.ts +24 -9
  101. package/dist/esm/v3/schemas/resources.d.ts +50 -19
  102. package/dist/esm/v3/schemas/resources.js +8 -4
  103. package/dist/esm/v3/schemas/resources.js.map +1 -1
  104. package/dist/esm/v3/schemas/runEngine.d.ts +4 -0
  105. package/dist/esm/v3/schemas/runEngine.js +4 -0
  106. package/dist/esm/v3/schemas/runEngine.js.map +1 -1
  107. package/dist/esm/v3/schemas/schemas.d.ts +38 -29
  108. package/dist/esm/v3/schemas/schemas.js +11 -7
  109. package/dist/esm/v3/schemas/schemas.js.map +1 -1
  110. package/dist/esm/v3/schemas/webhookApi.d.ts +199 -8
  111. package/dist/esm/v3/schemas/webhookApi.js +99 -6
  112. package/dist/esm/v3/schemas/webhookApi.js.map +1 -1
  113. package/dist/esm/v3/schemas/webhookConfig.d.ts +64 -0
  114. package/dist/esm/v3/schemas/webhookConfig.js +35 -8
  115. package/dist/esm/v3/schemas/webhookConfig.js.map +1 -1
  116. package/dist/esm/v3/types/webhooks.d.ts +23 -2
  117. package/dist/esm/v3/webhooks/index.d.ts +5 -0
  118. package/dist/esm/v3/webhooks/index.js +28 -0
  119. package/dist/esm/v3/webhooks/index.js.map +1 -1
  120. package/dist/esm/version.js +1 -1
  121. package/package.json +1 -1
@@ -11,11 +11,12 @@ export declare const WebhookDeliveryApiStatus: z.ZodEnum<{
11
11
  pending: "pending";
12
12
  processing: "processing";
13
13
  succeeded: "succeeded";
14
+ unmatched: "unmatched";
14
15
  }>;
15
16
  export type WebhookDeliveryApiStatus = z.infer<typeof WebhookDeliveryApiStatus>;
16
17
  export declare const WebhookEndpointObject: z.ZodObject<{
17
18
  id: z.ZodString;
18
- webhook: z.ZodString;
19
+ declaredId: z.ZodString;
19
20
  source: z.ZodString;
20
21
  status: z.ZodEnum<{
21
22
  active: "active";
@@ -38,7 +39,7 @@ export type WebhookEndpointObject = z.infer<typeof WebhookEndpointObject>;
38
39
  export declare const ListWebhookEndpointsResponse: z.ZodObject<{
39
40
  data: z.ZodArray<z.ZodObject<{
40
41
  id: z.ZodString;
41
- webhook: z.ZodString;
42
+ declaredId: z.ZodString;
42
43
  source: z.ZodString;
43
44
  status: z.ZodEnum<{
44
45
  active: "active";
@@ -59,35 +60,99 @@ export declare const ListWebhookEndpointsResponse: z.ZodObject<{
59
60
  }, z.core.$strip>>;
60
61
  }, z.core.$strip>;
61
62
  export type ListWebhookEndpointsResponse = z.infer<typeof ListWebhookEndpointsResponse>;
63
+ export declare const WebhookEndpointSubscriberObject: z.ZodObject<{
64
+ id: z.ZodString;
65
+ type: z.ZodEnum<{
66
+ session: "session";
67
+ task: "task";
68
+ }>;
69
+ taskId: z.ZodString;
70
+ filter: z.ZodNullable<z.ZodString>;
71
+ }, z.core.$strip>;
72
+ export type WebhookEndpointSubscriberObject = z.infer<typeof WebhookEndpointSubscriberObject>;
73
+ export declare const WebhookEndpointDetailObject: z.ZodObject<{
74
+ id: z.ZodString;
75
+ declaredId: z.ZodString;
76
+ source: z.ZodString;
77
+ status: z.ZodEnum<{
78
+ active: "active";
79
+ deleting: "deleting";
80
+ inactive: "inactive";
81
+ }>;
82
+ secretProvisioning: z.ZodEnum<{
83
+ either: "either";
84
+ integrator: "integrator";
85
+ provider: "provider";
86
+ }>;
87
+ secretSet: z.ZodBoolean;
88
+ tenantId: z.ZodNullable<z.ZodString>;
89
+ externalRef: z.ZodNullable<z.ZodString>;
90
+ url: z.ZodString;
91
+ createdAt: z.ZodCoercedDate<unknown>;
92
+ updatedAt: z.ZodCoercedDate<unknown>;
93
+ subscribers: z.ZodArray<z.ZodObject<{
94
+ id: z.ZodString;
95
+ type: z.ZodEnum<{
96
+ session: "session";
97
+ task: "task";
98
+ }>;
99
+ taskId: z.ZodString;
100
+ filter: z.ZodNullable<z.ZodString>;
101
+ }, z.core.$strip>>;
102
+ setupPrompt: z.ZodString;
103
+ }, z.core.$strip>;
104
+ export type WebhookEndpointDetailObject = z.infer<typeof WebhookEndpointDetailObject>;
62
105
  export declare const WebhookDeliveryListItem: z.ZodObject<{
63
106
  id: z.ZodString;
64
- webhook: z.ZodNullable<z.ZodString>;
107
+ endpoint: z.ZodNullable<z.ZodObject<{
108
+ id: z.ZodString;
109
+ declaredId: z.ZodString;
110
+ }, z.core.$strip>>;
65
111
  status: z.ZodEnum<{
66
112
  failed: "failed";
67
113
  filtered: "filtered";
68
114
  pending: "pending";
69
115
  processing: "processing";
70
116
  succeeded: "succeeded";
117
+ unmatched: "unmatched";
71
118
  }>;
72
119
  externalDeliveryId: z.ZodString;
73
- runId: z.ZodNullable<z.ZodString>;
120
+ isTest: z.ZodBoolean;
74
121
  createdAt: z.ZodCoercedDate<unknown>;
75
122
  processedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
76
123
  }, z.core.$strip>;
77
124
  export type WebhookDeliveryListItem = z.infer<typeof WebhookDeliveryListItem>;
125
+ /** Query for `GET /api/v1/webhooks/deliveries`, newest first. */
126
+ export type ListWebhookDeliveriesQuery = {
127
+ /** Declared endpoint ids or `wh_` ids. */
128
+ endpoint?: string | string[];
129
+ status?: WebhookDeliveryApiStatus | WebhookDeliveryApiStatus[];
130
+ /** A duration back from now, such as `"1h"` or `"7d"`. */
131
+ period?: string;
132
+ from?: Date;
133
+ to?: Date;
134
+ /** 1 to 100. */
135
+ limit?: number;
136
+ /** The `pagination.next` cursor from a previous page. */
137
+ after?: string;
138
+ };
78
139
  export declare const ListWebhookDeliveriesResponse: z.ZodObject<{
79
140
  data: z.ZodArray<z.ZodObject<{
80
141
  id: z.ZodString;
81
- webhook: z.ZodNullable<z.ZodString>;
142
+ endpoint: z.ZodNullable<z.ZodObject<{
143
+ id: z.ZodString;
144
+ declaredId: z.ZodString;
145
+ }, z.core.$strip>>;
82
146
  status: z.ZodEnum<{
83
147
  failed: "failed";
84
148
  filtered: "filtered";
85
149
  pending: "pending";
86
150
  processing: "processing";
87
151
  succeeded: "succeeded";
152
+ unmatched: "unmatched";
88
153
  }>;
89
154
  externalDeliveryId: z.ZodString;
90
- runId: z.ZodNullable<z.ZodString>;
155
+ isTest: z.ZodBoolean;
91
156
  createdAt: z.ZodCoercedDate<unknown>;
92
157
  processedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
93
158
  }, z.core.$strip>>;
@@ -97,18 +162,57 @@ export declare const ListWebhookDeliveriesResponse: z.ZodObject<{
97
162
  }, z.core.$strip>;
98
163
  }, z.core.$strip>;
99
164
  export type ListWebhookDeliveriesResponse = z.infer<typeof ListWebhookDeliveriesResponse>;
165
+ export declare const WebhookDeliveryTargetApiStatus: z.ZodEnum<{
166
+ failed: "failed";
167
+ filtered: "filtered";
168
+ pending: "pending";
169
+ succeeded: "succeeded";
170
+ }>;
171
+ export type WebhookDeliveryTargetApiStatus = z.infer<typeof WebhookDeliveryTargetApiStatus>;
172
+ /**
173
+ * What a delivery did for one subscriber, or (type `waiter`) the summary of the waiting runs it
174
+ * matched. `runId` and `sessionId` are friendly ids.
175
+ */
176
+ export declare const WebhookDeliveryTargetObject: z.ZodObject<{
177
+ id: z.ZodString;
178
+ type: z.ZodEnum<{
179
+ session: "session";
180
+ task: "task";
181
+ waiter: "waiter";
182
+ }>;
183
+ status: z.ZodEnum<{
184
+ failed: "failed";
185
+ filtered: "filtered";
186
+ pending: "pending";
187
+ succeeded: "succeeded";
188
+ }>;
189
+ reason: z.ZodNullable<z.ZodString>;
190
+ error: z.ZodNullable<z.ZodString>;
191
+ runId: z.ZodNullable<z.ZodString>;
192
+ sessionId: z.ZodNullable<z.ZodString>;
193
+ waiters: z.ZodNullable<z.ZodObject<{
194
+ matched: z.ZodNumber;
195
+ resumed: z.ZodNumber;
196
+ failed: z.ZodNumber;
197
+ }, z.core.$strip>>;
198
+ }, z.core.$strip>;
199
+ export type WebhookDeliveryTargetObject = z.infer<typeof WebhookDeliveryTargetObject>;
100
200
  export declare const WebhookDeliveryObject: z.ZodObject<{
101
201
  id: z.ZodString;
102
- webhook: z.ZodNullable<z.ZodString>;
202
+ endpoint: z.ZodNullable<z.ZodObject<{
203
+ id: z.ZodString;
204
+ declaredId: z.ZodString;
205
+ }, z.core.$strip>>;
103
206
  status: z.ZodEnum<{
104
207
  failed: "failed";
105
208
  filtered: "filtered";
106
209
  pending: "pending";
107
210
  processing: "processing";
108
211
  succeeded: "succeeded";
212
+ unmatched: "unmatched";
109
213
  }>;
110
214
  externalDeliveryId: z.ZodString;
111
- runId: z.ZodNullable<z.ZodString>;
215
+ isTest: z.ZodBoolean;
112
216
  createdAt: z.ZodCoercedDate<unknown>;
113
217
  processedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
114
218
  idempotencyKey: z.ZodString;
@@ -117,6 +221,29 @@ export declare const WebhookDeliveryObject: z.ZodObject<{
117
221
  rawBodyHash: z.ZodNullable<z.ZodString>;
118
222
  error: z.ZodNullable<z.ZodString>;
119
223
  filterReason: z.ZodNullable<z.ZodString>;
224
+ targets: z.ZodArray<z.ZodObject<{
225
+ id: z.ZodString;
226
+ type: z.ZodEnum<{
227
+ session: "session";
228
+ task: "task";
229
+ waiter: "waiter";
230
+ }>;
231
+ status: z.ZodEnum<{
232
+ failed: "failed";
233
+ filtered: "filtered";
234
+ pending: "pending";
235
+ succeeded: "succeeded";
236
+ }>;
237
+ reason: z.ZodNullable<z.ZodString>;
238
+ error: z.ZodNullable<z.ZodString>;
239
+ runId: z.ZodNullable<z.ZodString>;
240
+ sessionId: z.ZodNullable<z.ZodString>;
241
+ waiters: z.ZodNullable<z.ZodObject<{
242
+ matched: z.ZodNumber;
243
+ resumed: z.ZodNumber;
244
+ failed: z.ZodNumber;
245
+ }, z.core.$strip>>;
246
+ }, z.core.$strip>>;
120
247
  updatedAt: z.ZodCoercedDate<unknown>;
121
248
  }, z.core.$strip>;
122
249
  export type WebhookDeliveryObject = z.infer<typeof WebhookDeliveryObject>;
@@ -127,9 +254,73 @@ export declare const RotateWebhookEndpointSecretResponse: z.ZodObject<{
127
254
  secret: z.ZodString;
128
255
  }, z.core.$strip>;
129
256
  export type RotateWebhookEndpointSecretResponse = z.infer<typeof RotateWebhookEndpointSecretResponse>;
257
+ /** `PUT /api/v1/webhooks/endpoints/:endpointId/secret`: store a secret or public key the provider issued. */
258
+ export declare const SetWebhookEndpointSecretRequestBody: z.ZodObject<{
259
+ secret: z.ZodString;
260
+ }, z.core.$strip>;
261
+ export type SetWebhookEndpointSecretRequestBody = z.infer<typeof SetWebhookEndpointSecretRequestBody>;
262
+ export declare const SetWebhookEndpointSecretResponse: z.ZodObject<{
263
+ id: z.ZodString;
264
+ secretSet: z.ZodLiteral<true>;
265
+ }, z.core.$strip>;
266
+ export type SetWebhookEndpointSecretResponse = z.infer<typeof SetWebhookEndpointSecretResponse>;
130
267
  /** Replaying re-runs a delivery's task from its stored event as a new delivery. */
131
268
  export declare const ReplayWebhookDeliveryResponse: z.ZodObject<{
132
269
  deliveryId: z.ZodString;
133
270
  replayedFrom: z.ZodString;
134
271
  }, z.core.$strip>;
135
272
  export type ReplayWebhookDeliveryResponse = z.infer<typeof ReplayWebhookDeliveryResponse>;
273
+ /**
274
+ * `POST /api/v1/webhooks/endpoints/:endpointId/waiters`, where `:endpointId` is the declared endpoint
275
+ * id or its `wh_` id. A waiter only matches deliveries that arrive after it was created.
276
+ */
277
+ export declare const CreateWebhookWaiterRequestBody: z.ZodObject<{
278
+ match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
279
+ filter: z.ZodOptional<z.ZodString>;
280
+ timeout: z.ZodOptional<z.ZodString>;
281
+ tags: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
282
+ idempotencyKey: z.ZodOptional<z.ZodString>;
283
+ idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
284
+ endpoint: z.ZodOptional<z.ZodObject<{
285
+ tenantId: z.ZodOptional<z.ZodString>;
286
+ externalRef: z.ZodOptional<z.ZodString>;
287
+ }, z.core.$strip>>;
288
+ }, z.core.$strip>;
289
+ export type CreateWebhookWaiterRequestBody = z.infer<typeof CreateWebhookWaiterRequestBody>;
290
+ export declare const CreateWebhookWaiterResponseBody: z.ZodObject<{
291
+ id: z.ZodString;
292
+ url: z.ZodOptional<z.ZodString>;
293
+ expiresAt: z.ZodCoercedDate<unknown>;
294
+ isCached: z.ZodBoolean;
295
+ }, z.core.$strip>;
296
+ export type CreateWebhookWaiterResponseBody = z.infer<typeof CreateWebhookWaiterResponseBody>;
297
+ export declare const WebhookWaiterErrorCode: z.ZodEnum<{
298
+ invalid_request: "invalid_request";
299
+ webhook_endpoint_not_found: "webhook_endpoint_not_found";
300
+ webhook_filter_invalid: "webhook_filter_invalid";
301
+ webhook_waiter_limit: "webhook_waiter_limit";
302
+ }>;
303
+ export type WebhookWaiterErrorCode = z.infer<typeof WebhookWaiterErrorCode>;
304
+ export declare const WebhookWaiterErrorResponseBody: z.ZodObject<{
305
+ error: z.ZodString;
306
+ code: z.ZodEnum<{
307
+ invalid_request: "invalid_request";
308
+ webhook_endpoint_not_found: "webhook_endpoint_not_found";
309
+ webhook_filter_invalid: "webhook_filter_invalid";
310
+ webhook_waiter_limit: "webhook_waiter_limit";
311
+ }>;
312
+ reason: z.ZodOptional<z.ZodEnum<{
313
+ endpoint_limit: "endpoint_limit";
314
+ environment_limit: "environment_limit";
315
+ shape_limit: "shape_limit";
316
+ timeout_too_long: "timeout_too_long";
317
+ }>>;
318
+ }, z.core.$strip>;
319
+ export type WebhookWaiterErrorResponseBody = z.infer<typeof WebhookWaiterErrorResponseBody>;
320
+ /** `POST /api/v1/webhooks/waiters/:waiterId/cancel`. `too_late`: a delivery already claimed it. */
321
+ export declare const CancelWebhookWaiterResponseBody: z.ZodObject<{
322
+ cancelled: z.ZodBoolean;
323
+ reason: z.ZodOptional<z.ZodLiteral<"too_late">>;
324
+ deliveryId: z.ZodOptional<z.ZodString>;
325
+ }, z.core.$strip>;
326
+ export type CancelWebhookWaiterResponseBody = z.infer<typeof CancelWebhookWaiterResponseBody>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReplayWebhookDeliveryResponse = exports.RotateWebhookEndpointSecretResponse = exports.WebhookDeliveryObject = exports.ListWebhookDeliveriesResponse = exports.WebhookDeliveryListItem = exports.ListWebhookEndpointsResponse = exports.WebhookEndpointObject = exports.WebhookDeliveryApiStatus = exports.WebhookEndpointApiStatus = void 0;
3
+ exports.CancelWebhookWaiterResponseBody = exports.WebhookWaiterErrorResponseBody = exports.WebhookWaiterErrorCode = exports.CreateWebhookWaiterResponseBody = exports.CreateWebhookWaiterRequestBody = exports.ReplayWebhookDeliveryResponse = exports.SetWebhookEndpointSecretResponse = exports.SetWebhookEndpointSecretRequestBody = exports.RotateWebhookEndpointSecretResponse = exports.WebhookDeliveryObject = exports.WebhookDeliveryTargetObject = exports.WebhookDeliveryTargetApiStatus = exports.ListWebhookDeliveriesResponse = exports.WebhookDeliveryListItem = exports.WebhookEndpointDetailObject = exports.WebhookEndpointSubscriberObject = exports.ListWebhookEndpointsResponse = exports.WebhookEndpointObject = exports.WebhookDeliveryApiStatus = exports.WebhookEndpointApiStatus = void 0;
4
4
  const v4_1 = require("zod/v4");
5
5
  // Reuse the source-side enum (provider | integrator | either) rather than redefining it.
6
6
  const webhookConfig_js_1 = require("./webhookConfig.js");
@@ -15,12 +15,13 @@ exports.WebhookDeliveryApiStatus = v4_1.z.enum([
15
15
  "succeeded",
16
16
  "failed",
17
17
  "filtered",
18
+ "unmatched",
18
19
  ]);
19
20
  exports.WebhookEndpointObject = v4_1.z.object({
20
21
  /** Stable friendly id, e.g. `wh_...`. */
21
22
  id: v4_1.z.string(),
22
- /** The declared webhook() id this endpoint routes to. */
23
- webhook: v4_1.z.string(),
23
+ /** The id the endpoint is declared with in code (`webhooks.endpoint.define({ id })`). */
24
+ declaredId: v4_1.z.string(),
24
25
  /** Provider tag, e.g. "stripe" | "github" | "standard". */
25
26
  source: v4_1.z.string(),
26
27
  status: exports.WebhookEndpointApiStatus,
@@ -39,16 +40,27 @@ exports.WebhookEndpointObject = v4_1.z.object({
39
40
  exports.ListWebhookEndpointsResponse = v4_1.z.object({
40
41
  data: v4_1.z.array(exports.WebhookEndpointObject),
41
42
  });
43
+ exports.WebhookEndpointSubscriberObject = v4_1.z.object({
44
+ id: v4_1.z.string(),
45
+ type: v4_1.z.enum(["task", "session"]),
46
+ /** The subscribing task: the webhook() task, or the agent for a session subscriber. */
47
+ taskId: v4_1.z.string(),
48
+ filter: v4_1.z.string().nullable(),
49
+ });
50
+ exports.WebhookEndpointDetailObject = exports.WebhookEndpointObject.extend({
51
+ subscribers: v4_1.z.array(exports.WebhookEndpointSubscriberObject),
52
+ /** Instructions for an AI agent to register this endpoint with its provider. */
53
+ setupPrompt: v4_1.z.string(),
54
+ });
42
55
  exports.WebhookDeliveryListItem = v4_1.z.object({
43
56
  /** Stable friendly id, e.g. `whd_...`. */
44
57
  id: v4_1.z.string(),
45
- /** The webhook() id this delivery was routed to, if resolvable. */
46
- webhook: v4_1.z.string().nullable(),
58
+ /** The endpoint the delivery arrived on, or null if it has since been removed. */
59
+ endpoint: v4_1.z.object({ id: v4_1.z.string(), declaredId: v4_1.z.string() }).nullable(),
47
60
  status: exports.WebhookDeliveryApiStatus,
48
61
  /** Provider delivery id (Stripe event id, GitHub X-GitHub-Delivery, …). */
49
62
  externalDeliveryId: v4_1.z.string(),
50
- /** The triggered run's friendly id, if any. */
51
- runId: v4_1.z.string().nullable(),
63
+ isTest: v4_1.z.boolean(),
52
64
  createdAt: v4_1.z.coerce.date(),
53
65
  processedAt: v4_1.z.coerce.date().nullable(),
54
66
  });
@@ -59,6 +71,29 @@ exports.ListWebhookDeliveriesResponse = v4_1.z.object({
59
71
  previous: v4_1.z.string().optional(),
60
72
  }),
61
73
  });
74
+ exports.WebhookDeliveryTargetApiStatus = v4_1.z.enum([
75
+ "pending",
76
+ "succeeded",
77
+ "failed",
78
+ "filtered",
79
+ ]);
80
+ /**
81
+ * What a delivery did for one subscriber, or (type `waiter`) the summary of the waiting runs it
82
+ * matched. `runId` and `sessionId` are friendly ids.
83
+ */
84
+ exports.WebhookDeliveryTargetObject = v4_1.z.object({
85
+ /** The subscriber id on the endpoint, or `waiters` for the waiter summary. */
86
+ id: v4_1.z.string(),
87
+ type: v4_1.z.enum(["task", "session", "waiter"]),
88
+ status: exports.WebhookDeliveryTargetApiStatus,
89
+ /** Why a filtered target skipped the event. */
90
+ reason: v4_1.z.string().nullable(),
91
+ error: v4_1.z.string().nullable(),
92
+ runId: v4_1.z.string().nullable(),
93
+ sessionId: v4_1.z.string().nullable(),
94
+ /** For the waiter summary: waiting runs matched, resumed, and given up on. */
95
+ waiters: v4_1.z.object({ matched: v4_1.z.number(), resumed: v4_1.z.number(), failed: v4_1.z.number() }).nullable(),
96
+ });
62
97
  exports.WebhookDeliveryObject = exports.WebhookDeliveryListItem.extend({
63
98
  idempotencyKey: v4_1.z.string(),
64
99
  /** The size-capped, verified event body. */
@@ -69,6 +104,8 @@ exports.WebhookDeliveryObject = exports.WebhookDeliveryListItem.extend({
69
104
  error: v4_1.z.string().nullable(),
70
105
  /** For a `filtered` delivery: why it was not routed (failing clause + actual value). */
71
106
  filterReason: v4_1.z.string().nullable(),
107
+ /** One entry per subscriber, plus a waiter summary when waiting runs matched. */
108
+ targets: v4_1.z.array(exports.WebhookDeliveryTargetObject),
72
109
  updatedAt: v4_1.z.coerce.date(),
73
110
  });
74
111
  // ── Write actions ──
@@ -78,6 +115,14 @@ exports.RotateWebhookEndpointSecretResponse = v4_1.z.object({
78
115
  secretSet: v4_1.z.literal(true),
79
116
  secret: v4_1.z.string(),
80
117
  });
118
+ /** `PUT /api/v1/webhooks/endpoints/:endpointId/secret`: store a secret or public key the provider issued. */
119
+ exports.SetWebhookEndpointSecretRequestBody = v4_1.z.object({
120
+ secret: v4_1.z.string().trim().min(1).max(4096),
121
+ });
122
+ exports.SetWebhookEndpointSecretResponse = v4_1.z.object({
123
+ id: v4_1.z.string(),
124
+ secretSet: v4_1.z.literal(true),
125
+ });
81
126
  /** Replaying re-runs a delivery's task from its stored event as a new delivery. */
82
127
  exports.ReplayWebhookDeliveryResponse = v4_1.z.object({
83
128
  /** The new delivery's friendly id (GET it once processed for the run). */
@@ -85,4 +130,52 @@ exports.ReplayWebhookDeliveryResponse = v4_1.z.object({
85
130
  /** The original delivery id the replay was created from. */
86
131
  replayedFrom: v4_1.z.string(),
87
132
  });
133
+ // ── Webhook waiters ──
134
+ /**
135
+ * `POST /api/v1/webhooks/endpoints/:endpointId/waiters`, where `:endpointId` is the declared endpoint
136
+ * id or its `wh_` id. A waiter only matches deliveries that arrive after it was created.
137
+ */
138
+ exports.CreateWebhookWaiterRequestBody = v4_1.z.object({
139
+ /** Paths to expected values: `event.*` reads the body, `header.*` a header and `webhook.*` the endpoint. Omit for a URL-matched waiter. */
140
+ match: v4_1.z.record(v4_1.z.string(), v4_1.z.union([v4_1.z.string(), v4_1.z.number(), v4_1.z.boolean()])).optional(),
141
+ /** A filter the event must also pass, checked after `match`. */
142
+ filter: v4_1.z.string().optional(),
143
+ /** A duration (`"1h"`) or an ISO date. Default 24 hours, maximum 90 days. */
144
+ timeout: v4_1.z.string().optional(),
145
+ tags: v4_1.z.union([v4_1.z.string(), v4_1.z.array(v4_1.z.string())]).optional(),
146
+ idempotencyKey: v4_1.z.string().optional(),
147
+ idempotencyKeyTTL: v4_1.z.string().optional(),
148
+ /** Selects a dynamic endpoint instance. Reserved: only the declared instance is supported. */
149
+ endpoint: v4_1.z
150
+ .object({ tenantId: v4_1.z.string().optional(), externalRef: v4_1.z.string().optional() })
151
+ .optional(),
152
+ });
153
+ exports.CreateWebhookWaiterResponseBody = v4_1.z.object({
154
+ /** The waiter id, which is also its waitpoint id. */
155
+ id: v4_1.z.string(),
156
+ /** For a URL-matched waiter: the URL to hand the provider as its per-request callback. */
157
+ url: v4_1.z.string().optional(),
158
+ expiresAt: v4_1.z.coerce.date(),
159
+ isCached: v4_1.z.boolean(),
160
+ });
161
+ exports.WebhookWaiterErrorCode = v4_1.z.enum([
162
+ "webhook_waiter_limit",
163
+ "webhook_endpoint_not_found",
164
+ "webhook_filter_invalid",
165
+ "invalid_request",
166
+ ]);
167
+ exports.WebhookWaiterErrorResponseBody = v4_1.z.object({
168
+ error: v4_1.z.string(),
169
+ code: exports.WebhookWaiterErrorCode,
170
+ /** For `webhook_waiter_limit`: which limit. */
171
+ reason: v4_1.z
172
+ .enum(["environment_limit", "endpoint_limit", "shape_limit", "timeout_too_long"])
173
+ .optional(),
174
+ });
175
+ /** `POST /api/v1/webhooks/waiters/:waiterId/cancel`. `too_late`: a delivery already claimed it. */
176
+ exports.CancelWebhookWaiterResponseBody = v4_1.z.object({
177
+ cancelled: v4_1.z.boolean(),
178
+ reason: v4_1.z.literal("too_late").optional(),
179
+ deliveryId: v4_1.z.string().optional(),
180
+ });
88
181
  //# sourceMappingURL=webhookApi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhookApi.js","sourceRoot":"","sources":["../../../../src/v3/schemas/webhookApi.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,yFAAyF;AACzF,yDAA+D;AAE/D,kGAAkG;AAClG,+FAA+F;AAC/F,8FAA8F;AAC9F,4EAA4E;AAE/D,QAAA,wBAAwB,GAAG,MAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAGtE,QAAA,wBAAwB,GAAG,MAAC,CAAC,IAAI,CAAC;IAC7C,SAAS;IACT,YAAY;IACZ,WAAW;IACX,QAAQ;IACR,UAAU;CACX,CAAC,CAAC;AAGU,QAAA,qBAAqB,GAAG,MAAC,CAAC,MAAM,CAAC;IAC5C,yCAAyC;IACzC,EAAE,EAAE,MAAC,CAAC,MAAM,EAAE;IACd,yDAAyD;IACzD,OAAO,EAAE,MAAC,CAAC,MAAM,EAAE;IACnB,2DAA2D;IAC3D,MAAM,EAAE,MAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,QAAA,wBAAwB;IAChC,8EAA8E;IAC9E,kBAAkB,EAAE,4CAAyB;IAC7C,qFAAqF;IACrF,SAAS,EAAE,MAAC,CAAC,OAAO,EAAE;IACtB,mFAAmF;IACnF,QAAQ,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,uDAAuD;IACvD,GAAG,EAAE,MAAC,CAAC,MAAM,EAAE;IACf,SAAS,EAAE,MAAC,CAAC,MAAM,CAAC,IAAI,EAAE;IAC1B,SAAS,EAAE,MAAC,CAAC,MAAM,CAAC,IAAI,EAAE;CAC3B,CAAC,CAAC;AAGU,QAAA,4BAA4B,GAAG,MAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,MAAC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AM,CAAC;IACtD,SAAS,EAAE,MAAC,CAAC,OAAO,EAAE;IACtB,MAAM,EAAE,MAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;IACxC,UAAU,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod/v4";
2
+ import type { FilterAst } from "./webhookFilter.js";
2
3
  export declare const WebhookSecretProvisioning: z.ZodEnum<{
3
4
  either: "either";
4
5
  integrator: "integrator";
@@ -470,6 +471,10 @@ export type WebhookHandshakeConfig = z.infer<typeof WebhookHandshakeConfig>;
470
471
  */
471
472
  export declare const WebhookResponseConfig: z.ZodObject<{
472
473
  acceptedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<202>, z.ZodLiteral<204>]>>;
474
+ acceptedBody: z.ZodOptional<z.ZodEnum<{
475
+ empty: "empty";
476
+ json: "json";
477
+ }>>;
473
478
  rejectedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>]>>;
474
479
  }, z.core.$strip>;
475
480
  export type WebhookResponseConfig = z.infer<typeof WebhookResponseConfig>;
@@ -677,6 +682,10 @@ export declare const WebhookVerifierArtifact: import("../utils/zod.js").Compatib
677
682
  }, z.core.$strip>>;
678
683
  response: z.ZodOptional<z.ZodObject<{
679
684
  acceptedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<202>, z.ZodLiteral<204>]>>;
685
+ acceptedBody: z.ZodOptional<z.ZodEnum<{
686
+ empty: "empty";
687
+ json: "json";
688
+ }>>;
680
689
  rejectedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>]>>;
681
690
  }, z.core.$strip>>;
682
691
  }, z.core.$strip>, z.ZodObject<{
@@ -872,6 +881,10 @@ export declare const WebhookVerifierArtifact: import("../utils/zod.js").Compatib
872
881
  }, z.core.$strip>>;
873
882
  response: z.ZodOptional<z.ZodObject<{
874
883
  acceptedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<202>, z.ZodLiteral<204>]>>;
884
+ acceptedBody: z.ZodOptional<z.ZodEnum<{
885
+ empty: "empty";
886
+ json: "json";
887
+ }>>;
875
888
  rejectedStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>]>>;
876
889
  }, z.core.$strip>>;
877
890
  }, z.core.$strip>, z.ZodObject<{
@@ -880,11 +893,20 @@ export declare const WebhookVerifierArtifact: import("../utils/zod.js").Compatib
880
893
  hash: z.ZodString;
881
894
  }, z.core.$strip>]>;
882
895
  export type WebhookVerifierArtifact = z.infer<typeof WebhookVerifierArtifact>;
896
+ /**
897
+ * One subscriber of a shared endpoint. `id` is the descriptor that declared it (the `webhook()` id, or
898
+ * `agentId:eventId` / `agentId:connectorId` for a session subscriber) and is unique within the endpoint.
899
+ * `filter` is this subscriber's own delivery filter; the session variant's `startOn` separately gates
900
+ * session creation.
901
+ */
883
902
  export declare const WebhookRoutingTarget: import("../utils/zod.js").CompatibleZodDiscriminatedUnion<readonly [z.ZodObject<{
884
903
  type: z.ZodLiteral<"task">;
904
+ id: z.ZodString;
885
905
  taskId: z.ZodString;
906
+ filter: z.ZodOptional<z.ZodString>;
886
907
  }, z.core.$strip>, z.ZodObject<{
887
908
  type: z.ZodLiteral<"session">;
909
+ id: z.ZodString;
888
910
  taskIdentifier: z.ZodString;
889
911
  keyTemplate: z.ZodString;
890
912
  deliverAs: z.ZodEnum<{
@@ -895,8 +917,50 @@ export declare const WebhookRoutingTarget: import("../utils/zod.js").CompatibleZ
895
917
  connectorId: z.ZodOptional<z.ZodString>;
896
918
  triggerConfigTemplate: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
897
919
  startOn: z.ZodOptional<z.ZodString>;
920
+ filter: z.ZodOptional<z.ZodString>;
898
921
  }, z.core.$strip>]>;
899
922
  export type WebhookRoutingTarget = z.infer<typeof WebhookRoutingTarget>;
923
+ /** A routing target as stored on `WebhookEndpoint.routingTargets`, with its filter compiled at deploy. */
924
+ export type StoredWebhookRoutingTarget = WebhookRoutingTarget & {
925
+ filterAst?: FilterAst;
926
+ filterAstVersion?: number;
927
+ };
928
+ export declare const WebhookDeliveryTargetStatus: z.ZodEnum<{
929
+ FAILED: "FAILED";
930
+ FILTERED: "FILTERED";
931
+ PENDING: "PENDING";
932
+ SUCCEEDED: "SUCCEEDED";
933
+ }>;
934
+ export type WebhookDeliveryTargetStatus = z.infer<typeof WebhookDeliveryTargetStatus>;
935
+ /** One target's outcome for one delivery, stored on `WebhookDelivery.targets`. */
936
+ export declare const WebhookDeliveryTargetResult: z.ZodObject<{
937
+ id: z.ZodString;
938
+ type: z.ZodEnum<{
939
+ session: "session";
940
+ task: "task";
941
+ waiter: "waiter";
942
+ }>;
943
+ status: z.ZodEnum<{
944
+ FAILED: "FAILED";
945
+ FILTERED: "FILTERED";
946
+ PENDING: "PENDING";
947
+ SUCCEEDED: "SUCCEEDED";
948
+ }>;
949
+ reason: z.ZodOptional<z.ZodString>;
950
+ runId: z.ZodOptional<z.ZodString>;
951
+ error: z.ZodOptional<z.ZodString>;
952
+ deliverAs: z.ZodOptional<z.ZodEnum<{
953
+ action: "action";
954
+ message: "message";
955
+ }>>;
956
+ taskId: z.ZodOptional<z.ZodString>;
957
+ waiters: z.ZodOptional<z.ZodObject<{
958
+ matched: z.ZodNumber;
959
+ resumed: z.ZodNumber;
960
+ failed: z.ZodNumber;
961
+ }, z.core.$strip>>;
962
+ }, z.core.$strip>;
963
+ export type WebhookDeliveryTargetResult = z.infer<typeof WebhookDeliveryTargetResult>;
900
964
  export declare const WebhookVerifierResult: z.ZodObject<{
901
965
  ok: z.ZodBoolean;
902
966
  idempotencyKey: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebhookVerifierResult = exports.WebhookRoutingTarget = exports.WebhookVerifierArtifact = exports.WebhookGetHandshakeConfig = exports.WebhookResponseConfig = exports.WebhookHandshakeConfig = exports.WebhookVerifierConfig = exports.WebhookUrlSecretConfig = exports.WebhookSharedSecretConfig = exports.WebhookAsymmetricConfig = exports.WebhookHmacConfig = exports.WebhookFormPayload = exports.WebhookSigningString = exports.WebhookSecretTransform = exports.WebhookTimestampConfig = exports.WebhookSignatureExtraction = exports.WebhookValueSource = exports.WebhookIdempotencyField = exports.WebhookSecretProvisioning = void 0;
3
+ exports.WebhookVerifierResult = exports.WebhookDeliveryTargetResult = exports.WebhookDeliveryTargetStatus = exports.WebhookRoutingTarget = exports.WebhookVerifierArtifact = exports.WebhookGetHandshakeConfig = exports.WebhookResponseConfig = exports.WebhookHandshakeConfig = exports.WebhookVerifierConfig = exports.WebhookUrlSecretConfig = exports.WebhookSharedSecretConfig = exports.WebhookAsymmetricConfig = exports.WebhookHmacConfig = exports.WebhookFormPayload = exports.WebhookSigningString = exports.WebhookSecretTransform = exports.WebhookTimestampConfig = exports.WebhookSignatureExtraction = exports.WebhookValueSource = exports.WebhookIdempotencyField = exports.WebhookSecretProvisioning = void 0;
4
4
  const v4_1 = require("zod/v4");
5
5
  const zod_js_1 = require("../utils/zod.js");
6
6
  // Ingress webhook verification config. Kept in a LEAF module (imports only `z` and
@@ -150,6 +150,11 @@ exports.WebhookHandshakeConfig = v4_1.z.object({
150
150
  exports.WebhookResponseConfig = v4_1.z.object({
151
151
  /** Status for a recorded or deduplicated delivery. 204 sends no body. Default 200 with a JSON body. */
152
152
  acceptedStatus: v4_1.z.union([v4_1.z.literal(200), v4_1.z.literal(202), v4_1.z.literal(204)]).optional(),
153
+ /**
154
+ * Body for a recorded or deduplicated delivery. `"empty"` answers with no body, for providers
155
+ * that show a non-empty reply to the user (Slack slash commands). Default `"json"`.
156
+ */
157
+ acceptedBody: v4_1.z.enum(["json", "empty"]).optional(),
153
158
  /** Status when signature verification fails. Default 400. */
154
159
  rejectedStatus: v4_1.z.union([v4_1.z.literal(400), v4_1.z.literal(401), v4_1.z.literal(403)]).optional(),
155
160
  });
@@ -192,26 +197,48 @@ exports.WebhookVerifierArtifact = (0, zod_js_1.discriminatedUnion)("kind", [
192
197
  }),
193
198
  v4_1.z.object({ kind: v4_1.z.literal("bundle"), bundleUrl: v4_1.z.string(), hash: v4_1.z.string() }), // P3 seam
194
199
  ]);
195
- // ── Routing target: data-only tagged union stored on WebhookEndpoint.routingTarget ──
196
- // P1 implements only { type: "task" }. The session variant routes a delivery to a find-or-created
197
- // session: keyTemplate resolves the externalId, deliverAs selects the mode. "action" (chat.event)
198
- // carries actionType → the onAction envelope's action.type; "message" (channels) carries connectorId
199
- // → the run resolves the connector's inbound() mapper and runs a turn.
200
+ /**
201
+ * One subscriber of a shared endpoint. `id` is the descriptor that declared it (the `webhook()` id, or
202
+ * `agentId:eventId` / `agentId:connectorId` for a session subscriber) and is unique within the endpoint.
203
+ * `filter` is this subscriber's own delivery filter; the session variant's `startOn` separately gates
204
+ * session creation.
205
+ */
200
206
  exports.WebhookRoutingTarget = (0, zod_js_1.discriminatedUnion)("type", [
201
- v4_1.z.object({ type: v4_1.z.literal("task"), taskId: v4_1.z.string() }),
207
+ v4_1.z.object({
208
+ type: v4_1.z.literal("task"),
209
+ id: v4_1.z.string().min(1),
210
+ taskId: v4_1.z.string(),
211
+ filter: v4_1.z.string().optional(),
212
+ }),
202
213
  v4_1.z.object({
203
214
  type: v4_1.z.literal("session"),
215
+ id: v4_1.z.string().min(1),
204
216
  taskIdentifier: v4_1.z.string(),
205
217
  keyTemplate: v4_1.z.string(),
206
218
  deliverAs: v4_1.z.enum(["action", "message"]),
207
219
  actionType: v4_1.z.string().optional(),
208
220
  connectorId: v4_1.z.string().optional(),
209
221
  triggerConfigTemplate: v4_1.z.record(v4_1.z.string(), v4_1.z.unknown()).optional(),
210
- // Gate session CREATION: an event that already resolves to an existing session always resumes it,
211
- // but a key with no session is only started when the event matches this filter. Absent => always start.
212
222
  startOn: v4_1.z.string().optional(),
223
+ filter: v4_1.z.string().optional(),
213
224
  }),
214
225
  ]);
226
+ exports.WebhookDeliveryTargetStatus = v4_1.z.enum(["PENDING", "FILTERED", "SUCCEEDED", "FAILED"]);
227
+ /** One target's outcome for one delivery, stored on `WebhookDelivery.targets`. */
228
+ exports.WebhookDeliveryTargetResult = v4_1.z.object({
229
+ id: v4_1.z.string(),
230
+ type: v4_1.z.enum(["task", "session", "waiter"]),
231
+ status: exports.WebhookDeliveryTargetStatus,
232
+ reason: v4_1.z.string().optional(),
233
+ runId: v4_1.z.string().optional(),
234
+ error: v4_1.z.string().optional(),
235
+ /** For a session target: how it was delivered, kept so the result reads the same after a redeploy. */
236
+ deliverAs: v4_1.z.enum(["action", "message"]).optional(),
237
+ /** On a replay's target: the task the replay was authorized to reach. If the subscriber now points elsewhere, it fails instead of running. */
238
+ taskId: v4_1.z.string().optional(),
239
+ /** On the delivery's one waiter entry: how many waiters it matched, resumed and failed to resume. */
240
+ waiters: v4_1.z.object({ matched: v4_1.z.number(), resumed: v4_1.z.number(), failed: v4_1.z.number() }).optional(),
241
+ });
215
242
  // ── Data-only verdict the engine verifier returns (M5 consumes) ──
216
243
  exports.WebhookVerifierResult = v4_1.z.object({
217
244
  ok: v4_1.z.boolean(),