@greatwait/contracts 0.1.0-alpha.6 → 0.1.0-alpha.7

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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/attempt-diagnostics.d.ts +8 -0
  3. package/dist/attempt-diagnostics.js +68 -0
  4. package/dist/billing.d.ts +11 -10
  5. package/dist/billing.js +7 -4
  6. package/dist/delivery.d.ts +17 -40
  7. package/dist/delivery.js +12 -37
  8. package/dist/effective-limits.d.ts +4 -4
  9. package/dist/endpoints.d.ts +6 -6
  10. package/dist/first-value-journey.js +4 -4
  11. package/dist/identity.d.ts +3 -3
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.js +2 -1
  14. package/dist/mcp.d.ts +1 -1
  15. package/dist/members.d.ts +4 -4
  16. package/dist/operations.d.ts +296 -98
  17. package/dist/scheduling-records.d.ts +112 -8
  18. package/dist/scheduling.d.ts +253 -22
  19. package/dist/scheduling.js +46 -5
  20. package/dist/signatures.d.ts +1 -1
  21. package/dist/test-sink.d.ts +27 -41
  22. package/dist/test-sink.js +12 -31
  23. package/generated/v1/callback-receiver.json +4 -4
  24. package/generated/v1/first-value-journey.json +4 -4
  25. package/generated/v1/manifest.json +0 -1
  26. package/generated/v1/openapi.json +810 -10
  27. package/generated/v1/schemas/attempts.list.response.json +105 -0
  28. package/generated/v1/schemas/attempts.read.response.json +105 -0
  29. package/generated/v1/schemas/billing.notices.response.json +16 -6
  30. package/generated/v1/schemas/occurrences.redeliver.response.json +105 -0
  31. package/generated/v1/schemas/schedules.archive.response.json +50 -0
  32. package/generated/v1/schemas/schedules.cancel.response.json +50 -0
  33. package/generated/v1/schemas/schedules.create.request.json +14 -0
  34. package/generated/v1/schemas/schedules.create.response.json +50 -0
  35. package/generated/v1/schemas/schedules.list.response.json +50 -0
  36. package/generated/v1/schemas/schedules.pause.response.json +50 -0
  37. package/generated/v1/schemas/schedules.read.response.json +50 -0
  38. package/generated/v1/schemas/schedules.replace.request.json +14 -0
  39. package/generated/v1/schemas/schedules.replace.response.json +50 -0
  40. package/generated/v1/schemas/schedules.resume.response.json +50 -0
  41. package/package.json +1 -1
@@ -36,12 +36,23 @@ import { type CallbackTrigger, type ResponseClass } from "./signatures.js";
36
36
  */
37
37
  export declare const SCHEDULE_STATUSES: readonly ["active", "paused", "cancelled", "completed"];
38
38
  export declare const scheduleStatusSchema: import("zod").ZodEnum<{
39
- active: "active";
40
- completed: "completed";
41
39
  paused: "paused";
40
+ active: "active";
42
41
  cancelled: "cancelled";
42
+ completed: "completed";
43
43
  }>;
44
44
  export type ScheduleStatus = z.infer<typeof scheduleStatusSchema>;
45
+ /** A recurring schedule pauses after this many failed runs; "never" disables it. */
46
+ export declare const DEFAULT_AUTO_PAUSE_AFTER_FAILURES = 5;
47
+ export declare const autoPauseAfterFailuresSchema: import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodLiteral<"never">]>;
48
+ export type AutoPauseAfterFailures = z.infer<typeof autoPauseAfterFailuresSchema>;
49
+ export declare const autoPauseReasonSchema: import("zod").ZodObject<{
50
+ failedRuns: import("zod").ZodNumber;
51
+ status: import("zod").ZodOptional<import("zod").ZodNumber>;
52
+ diagnostic: import("zod").ZodString;
53
+ pausedAt: import("zod").ZodString;
54
+ }, import("zod/v4/core").$strip>;
55
+ export type AutoPauseReason = z.infer<typeof autoPauseReasonSchema>;
45
56
  /**
46
57
  * The statuses a schedule never leaves, and from which it never fires again on
47
58
  * its own.
@@ -337,9 +348,9 @@ export type PartitionKey = z.infer<typeof partitionKeySchema>;
337
348
  */
338
349
  export declare const OCCURRENCE_STATES: readonly ["planned", "due", "dispatching", "retry_wait", "ambiguous", "succeeded", "terminal_failed", "cancelled", "skipped_stale"];
339
350
  export declare const occurrenceStateSchema: import("zod").ZodEnum<{
340
- due: "due";
341
351
  succeeded: "succeeded";
342
352
  ambiguous: "ambiguous";
353
+ due: "due";
343
354
  cancelled: "cancelled";
344
355
  planned: "planned";
345
356
  dispatching: "dispatching";
@@ -362,9 +373,9 @@ export declare const projectOccurrenceListRequestSchema: import("zod").ZodObject
362
373
  endpoint: import("zod").ZodOptional<import("zod").ZodString>;
363
374
  from: import("zod").ZodOptional<import("zod").ZodString>;
364
375
  outcome: import("zod").ZodOptional<import("zod").ZodEnum<{
365
- due: "due";
366
376
  succeeded: "succeeded";
367
377
  ambiguous: "ambiguous";
378
+ due: "due";
368
379
  cancelled: "cancelled";
369
380
  planned: "planned";
370
381
  dispatching: "dispatching";
@@ -423,8 +434,8 @@ export type AttemptState = z.infer<typeof attemptStateSchema>;
423
434
  /** Safe diagnostic codes produced by the W3-03 delivery classifier. */
424
435
  export declare const attemptDiagnosticSchema: import("zod").ZodEnum<{
425
436
  rate_limited: "rate_limited";
426
- delivered: "delivered";
427
437
  completion_timed_out: "completion_timed_out";
438
+ delivered: "delivered";
428
439
  duplicate_inflight: "duplicate_inflight";
429
440
  endpoint_unavailable: "endpoint_unavailable";
430
441
  endpoint_unsafe: "endpoint_unsafe";
@@ -709,6 +720,14 @@ export declare function defaultLatenessPolicyForRecurrence(kind: Recurrence["kin
709
720
  export declare const SCHEDULE_NAME_MAX_LENGTH = 120;
710
721
  export declare const scheduleNameSchema: import("zod").ZodString;
711
722
  export declare const scheduleSchema: import("zod").ZodObject<{
723
+ autoPauseAfterFailures: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodLiteral<"never">]>>;
724
+ consecutiveFailedRuns: import("zod").ZodOptional<import("zod").ZodNumber>;
725
+ autoPauseReason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
726
+ failedRuns: import("zod").ZodNumber;
727
+ status: import("zod").ZodOptional<import("zod").ZodNumber>;
728
+ diagnostic: import("zod").ZodString;
729
+ pausedAt: import("zod").ZodString;
730
+ }, import("zod/v4/core").$strip>>>;
712
731
  http: import("zod").ZodOptional<import("zod").ZodObject<{
713
732
  method: import("zod").ZodEnum<{
714
733
  POST: "POST";
@@ -780,10 +799,10 @@ export declare const scheduleSchema: import("zod").ZodObject<{
780
799
  timeZone: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
781
800
  }, import("zod/v4/core").$strip>], "kind">;
782
801
  status: import("zod").ZodEnum<{
783
- active: "active";
784
- completed: "completed";
785
802
  paused: "paused";
803
+ active: "active";
786
804
  cancelled: "cancelled";
805
+ completed: "completed";
787
806
  }>;
788
807
  updatedAt: import("zod").ZodString;
789
808
  version: import("zod").ZodNumber;
@@ -801,6 +820,14 @@ export type Schedule = z.infer<typeof scheduleSchema>;
801
820
  */
802
821
  export declare const schedulePageSchema: import("zod").ZodObject<{
803
822
  data: import("zod").ZodArray<import("zod").ZodObject<{
823
+ autoPauseAfterFailures: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodLiteral<"never">]>>;
824
+ consecutiveFailedRuns: import("zod").ZodOptional<import("zod").ZodNumber>;
825
+ autoPauseReason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
826
+ failedRuns: import("zod").ZodNumber;
827
+ status: import("zod").ZodOptional<import("zod").ZodNumber>;
828
+ diagnostic: import("zod").ZodString;
829
+ pausedAt: import("zod").ZodString;
830
+ }, import("zod/v4/core").$strip>>>;
804
831
  http: import("zod").ZodOptional<import("zod").ZodObject<{
805
832
  method: import("zod").ZodEnum<{
806
833
  POST: "POST";
@@ -872,10 +899,10 @@ export declare const schedulePageSchema: import("zod").ZodObject<{
872
899
  timeZone: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
873
900
  }, import("zod/v4/core").$strip>], "kind">;
874
901
  status: import("zod").ZodEnum<{
875
- active: "active";
876
- completed: "completed";
877
902
  paused: "paused";
903
+ active: "active";
878
904
  cancelled: "cancelled";
905
+ completed: "completed";
879
906
  }>;
880
907
  updatedAt: import("zod").ZodString;
881
908
  version: import("zod").ZodNumber;
@@ -906,9 +933,9 @@ export declare const occurrenceSchema: import("zod").ZodObject<{
906
933
  sequence: import("zod").ZodNumber;
907
934
  settledAt: import("zod").ZodOptional<import("zod").ZodString>;
908
935
  state: import("zod").ZodEnum<{
909
- due: "due";
910
936
  succeeded: "succeeded";
911
937
  ambiguous: "ambiguous";
938
+ due: "due";
912
939
  cancelled: "cancelled";
913
940
  planned: "planned";
914
941
  dispatching: "dispatching";
@@ -976,6 +1003,61 @@ export declare const attemptFailureSnippetSchema: import("zod").ZodObject<{
976
1003
  truncated: import("zod").ZodBoolean;
977
1004
  }, import("zod/v4/core").$strip>;
978
1005
  export type AttemptFailureSnippet = z.infer<typeof attemptFailureSnippetSchema>;
1006
+ /** Stored diagnostic content, available only under the attempt's verified authority. */
1007
+ export declare const attemptCapturedBodySchema: import("zod").ZodObject<{
1008
+ contentType: import("zod").ZodString;
1009
+ encoding: import("zod").ZodEnum<{
1010
+ utf8: "utf8";
1011
+ base64: "base64";
1012
+ }>;
1013
+ content: import("zod").ZodString;
1014
+ capturedBytes: import("zod").ZodInt;
1015
+ originalBytes: import("zod").ZodOptional<import("zod").ZodInt>;
1016
+ truncated: import("zod").ZodBoolean;
1017
+ redacted: import("zod").ZodOptional<import("zod").ZodBoolean>;
1018
+ incomplete: import("zod").ZodOptional<import("zod").ZodBoolean>;
1019
+ }, import("zod/v4/core").$strip>;
1020
+ export declare const attemptResponseSchema: import("zod").ZodObject<{
1021
+ statusText: import("zod").ZodString;
1022
+ headers: import("zod").ZodArray<import("zod").ZodObject<{
1023
+ name: import("zod").ZodString;
1024
+ value: import("zod").ZodString;
1025
+ }, import("zod/v4/core").$strip>>;
1026
+ bodyState: import("zod").ZodEnum<{
1027
+ captured: "captured";
1028
+ empty: "empty";
1029
+ expired: "expired";
1030
+ not_captured: "not_captured";
1031
+ }>;
1032
+ body: import("zod").ZodOptional<import("zod").ZodObject<{
1033
+ contentType: import("zod").ZodString;
1034
+ encoding: import("zod").ZodEnum<{
1035
+ utf8: "utf8";
1036
+ base64: "base64";
1037
+ }>;
1038
+ content: import("zod").ZodString;
1039
+ capturedBytes: import("zod").ZodInt;
1040
+ originalBytes: import("zod").ZodOptional<import("zod").ZodInt>;
1041
+ truncated: import("zod").ZodBoolean;
1042
+ redacted: import("zod").ZodOptional<import("zod").ZodBoolean>;
1043
+ incomplete: import("zod").ZodOptional<import("zod").ZodBoolean>;
1044
+ }, import("zod/v4/core").$strip>>;
1045
+ }, import("zod/v4/core").$strip>;
1046
+ export type AttemptResponse = z.infer<typeof attemptResponseSchema>;
1047
+ export declare const attemptRequestSchema: import("zod").ZodObject<{
1048
+ method: import("zod").ZodEnum<{
1049
+ POST: "POST";
1050
+ PUT: "PUT";
1051
+ GET: "GET";
1052
+ }>;
1053
+ url: import("zod").ZodString;
1054
+ headers: import("zod").ZodArray<import("zod").ZodObject<{
1055
+ name: import("zod").ZodString;
1056
+ value: import("zod").ZodString;
1057
+ }, import("zod/v4/core").$strip>>;
1058
+ body: import("zod").ZodString;
1059
+ }, import("zod/v4/core").$strip>;
1060
+ export type AttemptRequest = z.infer<typeof attemptRequestSchema>;
979
1061
  export declare const attemptSchema: import("zod").ZodObject<{
980
1062
  id: import("zod").ZodString;
981
1063
  localReceiptRecoveries: import("zod").ZodOptional<import("zod").ZodInt>;
@@ -995,6 +1077,50 @@ export declare const attemptSchema: import("zod").ZodObject<{
995
1077
  text: import("zod").ZodString;
996
1078
  truncated: import("zod").ZodBoolean;
997
1079
  }, import("zod/v4/core").$strip>>;
1080
+ response: import("zod").ZodOptional<import("zod").ZodObject<{
1081
+ statusText: import("zod").ZodString;
1082
+ headers: import("zod").ZodArray<import("zod").ZodObject<{
1083
+ name: import("zod").ZodString;
1084
+ value: import("zod").ZodString;
1085
+ }, import("zod/v4/core").$strip>>;
1086
+ bodyState: import("zod").ZodEnum<{
1087
+ captured: "captured";
1088
+ empty: "empty";
1089
+ expired: "expired";
1090
+ not_captured: "not_captured";
1091
+ }>;
1092
+ body: import("zod").ZodOptional<import("zod").ZodObject<{
1093
+ contentType: import("zod").ZodString;
1094
+ encoding: import("zod").ZodEnum<{
1095
+ utf8: "utf8";
1096
+ base64: "base64";
1097
+ }>;
1098
+ content: import("zod").ZodString;
1099
+ capturedBytes: import("zod").ZodInt;
1100
+ originalBytes: import("zod").ZodOptional<import("zod").ZodInt>;
1101
+ truncated: import("zod").ZodBoolean;
1102
+ redacted: import("zod").ZodOptional<import("zod").ZodBoolean>;
1103
+ incomplete: import("zod").ZodOptional<import("zod").ZodBoolean>;
1104
+ }, import("zod/v4/core").$strip>>;
1105
+ }, import("zod/v4/core").$strip>>;
1106
+ request: import("zod").ZodOptional<import("zod").ZodObject<{
1107
+ method: import("zod").ZodEnum<{
1108
+ POST: "POST";
1109
+ PUT: "PUT";
1110
+ GET: "GET";
1111
+ }>;
1112
+ url: import("zod").ZodString;
1113
+ headers: import("zod").ZodArray<import("zod").ZodObject<{
1114
+ name: import("zod").ZodString;
1115
+ value: import("zod").ZodString;
1116
+ }, import("zod/v4/core").$strip>>;
1117
+ body: import("zod").ZodString;
1118
+ }, import("zod/v4/core").$strip>>;
1119
+ requestState: import("zod").ZodOptional<import("zod").ZodEnum<{
1120
+ captured: "captured";
1121
+ expired: "expired";
1122
+ not_captured: "not_captured";
1123
+ }>>;
998
1124
  responseHeaders: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
999
1125
  name: import("zod").ZodString;
1000
1126
  value: import("zod").ZodString;
@@ -1027,8 +1153,8 @@ export declare const attemptSchema: import("zod").ZodObject<{
1027
1153
  delivery: import("zod").ZodString;
1028
1154
  diagnostic: import("zod").ZodOptional<import("zod").ZodEnum<{
1029
1155
  rate_limited: "rate_limited";
1030
- delivered: "delivered";
1031
1156
  completion_timed_out: "completion_timed_out";
1157
+ delivered: "delivered";
1032
1158
  duplicate_inflight: "duplicate_inflight";
1033
1159
  endpoint_unavailable: "endpoint_unavailable";
1034
1160
  endpoint_unsafe: "endpoint_unsafe";
@@ -1053,9 +1179,9 @@ export declare const occurrencePageSchema: import("zod").ZodObject<{
1053
1179
  sequence: import("zod").ZodNumber;
1054
1180
  settledAt: import("zod").ZodOptional<import("zod").ZodString>;
1055
1181
  state: import("zod").ZodEnum<{
1056
- due: "due";
1057
1182
  succeeded: "succeeded";
1058
1183
  ambiguous: "ambiguous";
1184
+ due: "due";
1059
1185
  cancelled: "cancelled";
1060
1186
  planned: "planned";
1061
1187
  dispatching: "dispatching";
@@ -1090,9 +1216,9 @@ export declare const projectOccurrencePageSchema: import("zod").ZodObject<{
1090
1216
  sequence: import("zod").ZodNumber;
1091
1217
  settledAt: import("zod").ZodOptional<import("zod").ZodString>;
1092
1218
  state: import("zod").ZodEnum<{
1093
- due: "due";
1094
1219
  succeeded: "succeeded";
1095
1220
  ambiguous: "ambiguous";
1221
+ due: "due";
1096
1222
  cancelled: "cancelled";
1097
1223
  planned: "planned";
1098
1224
  dispatching: "dispatching";
@@ -1133,9 +1259,9 @@ export declare const occurrenceViewSchema: import("zod").ZodObject<{
1133
1259
  sequence: import("zod").ZodNumber;
1134
1260
  settledAt: import("zod").ZodOptional<import("zod").ZodString>;
1135
1261
  state: import("zod").ZodEnum<{
1136
- due: "due";
1137
1262
  succeeded: "succeeded";
1138
1263
  ambiguous: "ambiguous";
1264
+ due: "due";
1139
1265
  cancelled: "cancelled";
1140
1266
  planned: "planned";
1141
1267
  dispatching: "dispatching";
@@ -1177,6 +1303,50 @@ export declare const attemptPageSchema: import("zod").ZodObject<{
1177
1303
  text: import("zod").ZodString;
1178
1304
  truncated: import("zod").ZodBoolean;
1179
1305
  }, import("zod/v4/core").$strip>>;
1306
+ response: import("zod").ZodOptional<import("zod").ZodObject<{
1307
+ statusText: import("zod").ZodString;
1308
+ headers: import("zod").ZodArray<import("zod").ZodObject<{
1309
+ name: import("zod").ZodString;
1310
+ value: import("zod").ZodString;
1311
+ }, import("zod/v4/core").$strip>>;
1312
+ bodyState: import("zod").ZodEnum<{
1313
+ captured: "captured";
1314
+ empty: "empty";
1315
+ expired: "expired";
1316
+ not_captured: "not_captured";
1317
+ }>;
1318
+ body: import("zod").ZodOptional<import("zod").ZodObject<{
1319
+ contentType: import("zod").ZodString;
1320
+ encoding: import("zod").ZodEnum<{
1321
+ utf8: "utf8";
1322
+ base64: "base64";
1323
+ }>;
1324
+ content: import("zod").ZodString;
1325
+ capturedBytes: import("zod").ZodInt;
1326
+ originalBytes: import("zod").ZodOptional<import("zod").ZodInt>;
1327
+ truncated: import("zod").ZodBoolean;
1328
+ redacted: import("zod").ZodOptional<import("zod").ZodBoolean>;
1329
+ incomplete: import("zod").ZodOptional<import("zod").ZodBoolean>;
1330
+ }, import("zod/v4/core").$strip>>;
1331
+ }, import("zod/v4/core").$strip>>;
1332
+ request: import("zod").ZodOptional<import("zod").ZodObject<{
1333
+ method: import("zod").ZodEnum<{
1334
+ POST: "POST";
1335
+ PUT: "PUT";
1336
+ GET: "GET";
1337
+ }>;
1338
+ url: import("zod").ZodString;
1339
+ headers: import("zod").ZodArray<import("zod").ZodObject<{
1340
+ name: import("zod").ZodString;
1341
+ value: import("zod").ZodString;
1342
+ }, import("zod/v4/core").$strip>>;
1343
+ body: import("zod").ZodString;
1344
+ }, import("zod/v4/core").$strip>>;
1345
+ requestState: import("zod").ZodOptional<import("zod").ZodEnum<{
1346
+ captured: "captured";
1347
+ expired: "expired";
1348
+ not_captured: "not_captured";
1349
+ }>>;
1180
1350
  responseHeaders: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
1181
1351
  name: import("zod").ZodString;
1182
1352
  value: import("zod").ZodString;
@@ -1209,8 +1379,8 @@ export declare const attemptPageSchema: import("zod").ZodObject<{
1209
1379
  delivery: import("zod").ZodString;
1210
1380
  diagnostic: import("zod").ZodOptional<import("zod").ZodEnum<{
1211
1381
  rate_limited: "rate_limited";
1212
- delivered: "delivered";
1213
1382
  completion_timed_out: "completion_timed_out";
1383
+ delivered: "delivered";
1214
1384
  duplicate_inflight: "duplicate_inflight";
1215
1385
  endpoint_unavailable: "endpoint_unavailable";
1216
1386
  endpoint_unsafe: "endpoint_unsafe";
@@ -1251,6 +1421,50 @@ export declare const attemptViewSchema: import("zod").ZodObject<{
1251
1421
  text: import("zod").ZodString;
1252
1422
  truncated: import("zod").ZodBoolean;
1253
1423
  }, import("zod/v4/core").$strip>>;
1424
+ response: import("zod").ZodOptional<import("zod").ZodObject<{
1425
+ statusText: import("zod").ZodString;
1426
+ headers: import("zod").ZodArray<import("zod").ZodObject<{
1427
+ name: import("zod").ZodString;
1428
+ value: import("zod").ZodString;
1429
+ }, import("zod/v4/core").$strip>>;
1430
+ bodyState: import("zod").ZodEnum<{
1431
+ captured: "captured";
1432
+ empty: "empty";
1433
+ expired: "expired";
1434
+ not_captured: "not_captured";
1435
+ }>;
1436
+ body: import("zod").ZodOptional<import("zod").ZodObject<{
1437
+ contentType: import("zod").ZodString;
1438
+ encoding: import("zod").ZodEnum<{
1439
+ utf8: "utf8";
1440
+ base64: "base64";
1441
+ }>;
1442
+ content: import("zod").ZodString;
1443
+ capturedBytes: import("zod").ZodInt;
1444
+ originalBytes: import("zod").ZodOptional<import("zod").ZodInt>;
1445
+ truncated: import("zod").ZodBoolean;
1446
+ redacted: import("zod").ZodOptional<import("zod").ZodBoolean>;
1447
+ incomplete: import("zod").ZodOptional<import("zod").ZodBoolean>;
1448
+ }, import("zod/v4/core").$strip>>;
1449
+ }, import("zod/v4/core").$strip>>;
1450
+ request: import("zod").ZodOptional<import("zod").ZodObject<{
1451
+ method: import("zod").ZodEnum<{
1452
+ POST: "POST";
1453
+ PUT: "PUT";
1454
+ GET: "GET";
1455
+ }>;
1456
+ url: import("zod").ZodString;
1457
+ headers: import("zod").ZodArray<import("zod").ZodObject<{
1458
+ name: import("zod").ZodString;
1459
+ value: import("zod").ZodString;
1460
+ }, import("zod/v4/core").$strip>>;
1461
+ body: import("zod").ZodString;
1462
+ }, import("zod/v4/core").$strip>>;
1463
+ requestState: import("zod").ZodOptional<import("zod").ZodEnum<{
1464
+ captured: "captured";
1465
+ expired: "expired";
1466
+ not_captured: "not_captured";
1467
+ }>>;
1254
1468
  responseHeaders: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
1255
1469
  name: import("zod").ZodString;
1256
1470
  value: import("zod").ZodString;
@@ -1283,8 +1497,8 @@ export declare const attemptViewSchema: import("zod").ZodObject<{
1283
1497
  delivery: import("zod").ZodString;
1284
1498
  diagnostic: import("zod").ZodOptional<import("zod").ZodEnum<{
1285
1499
  rate_limited: "rate_limited";
1286
- delivered: "delivered";
1287
1500
  completion_timed_out: "completion_timed_out";
1501
+ delivered: "delivered";
1288
1502
  duplicate_inflight: "duplicate_inflight";
1289
1503
  endpoint_unavailable: "endpoint_unavailable";
1290
1504
  endpoint_unsafe: "endpoint_unsafe";
@@ -1320,9 +1534,9 @@ export declare const scheduleViewSchema: import("zod").ZodObject<{
1320
1534
  sequence: import("zod").ZodNumber;
1321
1535
  settledAt: import("zod").ZodOptional<import("zod").ZodString>;
1322
1536
  state: import("zod").ZodEnum<{
1323
- due: "due";
1324
1537
  succeeded: "succeeded";
1325
1538
  ambiguous: "ambiguous";
1539
+ due: "due";
1326
1540
  cancelled: "cancelled";
1327
1541
  planned: "planned";
1328
1542
  dispatching: "dispatching";
@@ -1342,6 +1556,14 @@ export declare const scheduleViewSchema: import("zod").ZodObject<{
1342
1556
  attemptCount: import("zod").ZodNumber;
1343
1557
  }, import("zod/v4/core").$strip>;
1344
1558
  schedule: import("zod").ZodObject<{
1559
+ autoPauseAfterFailures: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodLiteral<"never">]>>;
1560
+ consecutiveFailedRuns: import("zod").ZodOptional<import("zod").ZodNumber>;
1561
+ autoPauseReason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
1562
+ failedRuns: import("zod").ZodNumber;
1563
+ status: import("zod").ZodOptional<import("zod").ZodNumber>;
1564
+ diagnostic: import("zod").ZodString;
1565
+ pausedAt: import("zod").ZodString;
1566
+ }, import("zod/v4/core").$strip>>>;
1345
1567
  http: import("zod").ZodOptional<import("zod").ZodObject<{
1346
1568
  method: import("zod").ZodEnum<{
1347
1569
  POST: "POST";
@@ -1413,10 +1635,10 @@ export declare const scheduleViewSchema: import("zod").ZodObject<{
1413
1635
  timeZone: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
1414
1636
  }, import("zod/v4/core").$strip>], "kind">;
1415
1637
  status: import("zod").ZodEnum<{
1416
- active: "active";
1417
- completed: "completed";
1418
1638
  paused: "paused";
1639
+ active: "active";
1419
1640
  cancelled: "cancelled";
1641
+ completed: "completed";
1420
1642
  }>;
1421
1643
  updatedAt: import("zod").ZodString;
1422
1644
  version: import("zod").ZodNumber;
@@ -1438,9 +1660,9 @@ export declare const scheduleWrittenViewSchema: import("zod").ZodObject<{
1438
1660
  sequence: import("zod").ZodNumber;
1439
1661
  settledAt: import("zod").ZodOptional<import("zod").ZodString>;
1440
1662
  state: import("zod").ZodEnum<{
1441
- due: "due";
1442
1663
  succeeded: "succeeded";
1443
1664
  ambiguous: "ambiguous";
1665
+ due: "due";
1444
1666
  cancelled: "cancelled";
1445
1667
  planned: "planned";
1446
1668
  dispatching: "dispatching";
@@ -1460,6 +1682,14 @@ export declare const scheduleWrittenViewSchema: import("zod").ZodObject<{
1460
1682
  attemptCount: import("zod").ZodNumber;
1461
1683
  }, import("zod/v4/core").$strip>;
1462
1684
  schedule: import("zod").ZodObject<{
1685
+ autoPauseAfterFailures: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodLiteral<"never">]>>;
1686
+ consecutiveFailedRuns: import("zod").ZodOptional<import("zod").ZodNumber>;
1687
+ autoPauseReason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
1688
+ failedRuns: import("zod").ZodNumber;
1689
+ status: import("zod").ZodOptional<import("zod").ZodNumber>;
1690
+ diagnostic: import("zod").ZodString;
1691
+ pausedAt: import("zod").ZodString;
1692
+ }, import("zod/v4/core").$strip>>>;
1463
1693
  http: import("zod").ZodOptional<import("zod").ZodObject<{
1464
1694
  method: import("zod").ZodEnum<{
1465
1695
  POST: "POST";
@@ -1531,10 +1761,10 @@ export declare const scheduleWrittenViewSchema: import("zod").ZodObject<{
1531
1761
  timeZone: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
1532
1762
  }, import("zod/v4/core").$strip>], "kind">;
1533
1763
  status: import("zod").ZodEnum<{
1534
- active: "active";
1535
- completed: "completed";
1536
1764
  paused: "paused";
1765
+ active: "active";
1537
1766
  cancelled: "cancelled";
1767
+ completed: "completed";
1538
1768
  }>;
1539
1769
  updatedAt: import("zod").ZodString;
1540
1770
  version: import("zod").ZodNumber;
@@ -1571,6 +1801,7 @@ export declare const RECURRENCE_REQUEST_FIELDS: readonly ["at", "cron", "delaySe
1571
1801
  * a customer named is the worst kind of helpful.
1572
1802
  */
1573
1803
  export declare const scheduleRequestSchema: import("zod").ZodObject<{
1804
+ autoPauseAfterFailures: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodLiteral<"never">]>>;
1574
1805
  http: import("zod").ZodOptional<import("zod").ZodObject<{
1575
1806
  method: import("zod").ZodOptional<import("zod").ZodEnum<{
1576
1807
  POST: "POST";
@@ -49,6 +49,17 @@ export const SCHEDULE_STATUSES = [
49
49
  "completed",
50
50
  ];
51
51
  export const scheduleStatusSchema = z.enum(SCHEDULE_STATUSES);
52
+ /** A recurring schedule pauses after this many failed runs; "never" disables it. */
53
+ export const DEFAULT_AUTO_PAUSE_AFTER_FAILURES = 5;
54
+ export const autoPauseAfterFailuresSchema = z
55
+ .union([z.number().int().min(1).max(100), z.literal("never")])
56
+ .describe('Consecutive failed runs before automatic pause: 1–100 or "never". Defaults to 5 on create; omission on replace preserves the setting. One-shot schedules are unaffected.');
57
+ export const autoPauseReasonSchema = z.object({
58
+ failedRuns: z.number().int().positive(),
59
+ status: z.number().int().min(100).max(599).optional(),
60
+ diagnostic: z.string().max(500),
61
+ pausedAt: timestampSchema,
62
+ });
52
63
  /**
53
64
  * The statuses a schedule never leaves, and from which it never fires again on
54
65
  * its own.
@@ -820,6 +831,9 @@ export const scheduleNameSchema = z
820
831
  .min(1, "must not be blank")
821
832
  .max(SCHEDULE_NAME_MAX_LENGTH, `must be at most ${String(SCHEDULE_NAME_MAX_LENGTH)} characters`);
822
833
  export const scheduleSchema = z.object({
834
+ autoPauseAfterFailures: autoPauseAfterFailuresSchema.optional(),
835
+ consecutiveFailedRuns: z.number().int().nonnegative().optional(),
836
+ autoPauseReason: autoPauseReasonSchema.nullable().optional(),
823
837
  http: publicHttpRequestSchema.optional(),
824
838
  /**
825
839
  * When the schedule was filed away, and absent until it is.
@@ -1065,6 +1079,30 @@ export const attemptFailureSnippetSchema = z.object({
1065
1079
  text: z.string().max(ATTEMPT_FAILURE_SNIPPET_MAX_LENGTH),
1066
1080
  truncated: z.boolean(),
1067
1081
  });
1082
+ /** Stored diagnostic content, available only under the attempt's verified authority. */
1083
+ export const attemptCapturedBodySchema = z.object({
1084
+ contentType: z.string(),
1085
+ encoding: z.enum(["utf8", "base64"]),
1086
+ // Up to 10 KiB received bytes; credential masking can expand the representation.
1087
+ content: z.string().max(131_072),
1088
+ capturedBytes: z.int().min(1).max(10_240),
1089
+ originalBytes: z.int().nonnegative().optional(),
1090
+ truncated: z.boolean(),
1091
+ redacted: z.boolean().optional(),
1092
+ incomplete: z.boolean().optional(),
1093
+ });
1094
+ export const attemptResponseSchema = z.object({
1095
+ statusText: z.string(),
1096
+ headers: z.array(z.object({ name: z.string(), value: z.string() })),
1097
+ bodyState: z.enum(["captured", "empty", "expired", "not_captured"]),
1098
+ body: attemptCapturedBodySchema.optional(),
1099
+ });
1100
+ export const attemptRequestSchema = z.object({
1101
+ method: z.enum(["GET", "POST", "PUT"]),
1102
+ url: z.string(),
1103
+ headers: z.array(z.object({ name: z.string(), value: z.string() })),
1104
+ body: z.string(),
1105
+ });
1068
1106
  export const attemptSchema = z
1069
1107
  .object({
1070
1108
  attemptNumber: z.number().int().positive(),
@@ -1109,13 +1147,15 @@ export const attemptSchema = z
1109
1147
  /** Stable next-action code paired with a diagnostic when one is known. */
1110
1148
  remediation: attemptRemediationSchema.optional(),
1111
1149
  /**
1112
- * What a failing receiver said, where the plan retains it.
1113
- *
1114
- * Absent on a success, on an in-flight attempt, on a response whose media
1115
- * type is not text or JSON, and on a plan whose retention does not include
1116
- * one. Its absence is never evidence about the delivery.
1150
+ * Compatibility text prefix, up to 4 KiB, derived from the retained
1151
+ * response when its media type is supported by legacy clients. Use
1152
+ * response for all headers, media types and the full 10 KiB capture.
1153
+ * Absence is never evidence about the delivery outcome.
1117
1154
  */
1118
1155
  failureSnippet: attemptFailureSnippetSchema.optional(),
1156
+ response: attemptResponseSchema.optional(),
1157
+ request: attemptRequestSchema.optional(),
1158
+ requestState: z.enum(["captured", "expired", "not_captured"]).optional(),
1119
1159
  /** The fixed diagnostic-header allowlist, when a response carried any. */
1120
1160
  responseHeaders: z.array(attemptResponseHeaderSchema).max(8).optional(),
1121
1161
  /** Absent when no response was received at all. */
@@ -1237,6 +1277,7 @@ export const RECURRENCE_REQUEST_FIELDS = [
1237
1277
  */
1238
1278
  export const scheduleRequestSchema = z
1239
1279
  .object({
1280
+ autoPauseAfterFailures: autoPauseAfterFailuresSchema.optional(),
1240
1281
  http: httpRequestSchema.optional(),
1241
1282
  /** The instant the first occurrence is planned for. */
1242
1283
  at: timestampSchema.optional(),
@@ -182,8 +182,8 @@ export type CallbackDeferredCompletion = z.infer<typeof callbackDeferredCompleti
182
182
  */
183
183
  export declare const callbackCompletionReportSchema: import("zod").ZodObject<{
184
184
  outcome: import("zod").ZodDefault<import("zod").ZodEnum<{
185
- failed: "failed";
186
185
  succeeded: "succeeded";
186
+ failed: "failed";
187
187
  }>>;
188
188
  }, import("zod/v4/core").$strip>;
189
189
  export type CallbackCompletionReport = z.infer<typeof callbackCompletionReportSchema>;