@closerepo/sentinel-contracts 1.1.0 → 1.2.1

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.
package/dist/index.d.ts CHANGED
@@ -1030,6 +1030,411 @@ declare const sentinelHealthReportAnySchema: z.ZodUnion<readonly [z.ZodObject<{
1030
1030
  }>;
1031
1031
  }, z.core.$strict>>;
1032
1032
  }, z.core.$strict>]>;
1033
+ declare const sentinelHealthRuntimeStatusSchema: z.ZodObject<{
1034
+ contractVersion: z.ZodLiteral<1>;
1035
+ statusType: z.ZodLiteral<"health">;
1036
+ projectId: z.ZodString;
1037
+ environment: z.ZodString;
1038
+ runtimes: z.ZodArray<z.ZodObject<{
1039
+ runtimeInstanceId: z.ZodString;
1040
+ state: z.ZodEnum<{
1041
+ unavailable: "unavailable";
1042
+ degraded: "degraded";
1043
+ healthy: "healthy";
1044
+ stale: "stale";
1045
+ }>;
1046
+ latestReport: z.ZodNullable<z.ZodObject<{
1047
+ receivedAt: z.ZodISODateTime;
1048
+ report: z.ZodUnion<readonly [z.ZodObject<{
1049
+ contractVersion: z.ZodLiteral<1>;
1050
+ projectId: z.ZodString;
1051
+ environment: z.ZodString;
1052
+ runtimeInstanceId: z.ZodString;
1053
+ reportId: z.ZodUUID;
1054
+ sequence: z.ZodNumber;
1055
+ observedAt: z.ZodISODateTime;
1056
+ components: z.ZodArray<z.ZodObject<{
1057
+ componentKey: z.ZodString;
1058
+ componentClass: z.ZodString;
1059
+ state: z.ZodEnum<{
1060
+ unknown: "unknown";
1061
+ failed: "failed";
1062
+ unavailable: "unavailable";
1063
+ degraded: "degraded";
1064
+ healthy: "healthy";
1065
+ }>;
1066
+ lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
1067
+ facts: z.ZodArray<z.ZodObject<{
1068
+ key: z.ZodString;
1069
+ value: z.ZodNumber;
1070
+ unit: z.ZodOptional<z.ZodEnum<{
1071
+ bytes: "bytes";
1072
+ count: "count";
1073
+ milliseconds: "milliseconds";
1074
+ percent: "percent";
1075
+ ratio: "ratio";
1076
+ }>>;
1077
+ }, z.core.$strict>>;
1078
+ failure: z.ZodNullable<z.ZodObject<{
1079
+ episodeId: z.ZodUUID;
1080
+ attempt: z.ZodNumber;
1081
+ terminal: z.ZodBoolean;
1082
+ operation: z.ZodString;
1083
+ stage: z.ZodString;
1084
+ code: z.ZodString;
1085
+ summary: z.ZodString;
1086
+ correlationId: z.ZodOptional<z.ZodString>;
1087
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
1088
+ upstreamCode: z.ZodOptional<z.ZodString>;
1089
+ }, z.core.$strict>>;
1090
+ }, z.core.$strict>>;
1091
+ }, z.core.$strict>, z.ZodObject<{
1092
+ contractVersion: z.ZodLiteral<2>;
1093
+ projectId: z.ZodString;
1094
+ environment: z.ZodString;
1095
+ runtimeInstanceId: z.ZodString;
1096
+ reportId: z.ZodUUID;
1097
+ sequence: z.ZodNumber;
1098
+ observedAt: z.ZodISODateTime;
1099
+ components: z.ZodArray<z.ZodObject<{
1100
+ componentKey: z.ZodString;
1101
+ componentClass: z.ZodString;
1102
+ state: z.ZodEnum<{
1103
+ unknown: "unknown";
1104
+ failed: "failed";
1105
+ unavailable: "unavailable";
1106
+ degraded: "degraded";
1107
+ healthy: "healthy";
1108
+ }>;
1109
+ lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
1110
+ facts: z.ZodArray<z.ZodObject<{
1111
+ key: z.ZodString;
1112
+ value: z.ZodNumber;
1113
+ unit: z.ZodOptional<z.ZodEnum<{
1114
+ bytes: "bytes";
1115
+ count: "count";
1116
+ milliseconds: "milliseconds";
1117
+ percent: "percent";
1118
+ ratio: "ratio";
1119
+ }>>;
1120
+ }, z.core.$strict>>;
1121
+ failure: z.ZodNullable<z.ZodObject<{
1122
+ episodeId: z.ZodUUID;
1123
+ attempt: z.ZodNumber;
1124
+ terminal: z.ZodBoolean;
1125
+ operation: z.ZodString;
1126
+ stage: z.ZodString;
1127
+ code: z.ZodString;
1128
+ summary: z.ZodString;
1129
+ correlationId: z.ZodOptional<z.ZodString>;
1130
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
1131
+ upstreamCode: z.ZodOptional<z.ZodString>;
1132
+ }, z.core.$strict>>;
1133
+ }, z.core.$strict>>;
1134
+ capabilities: z.ZodArray<z.ZodObject<{
1135
+ capabilityKey: z.ZodString;
1136
+ state: z.ZodEnum<{
1137
+ enabled: "enabled";
1138
+ disabled: "disabled";
1139
+ }>;
1140
+ }, z.core.$strict>>;
1141
+ }, z.core.$strict>]>;
1142
+ }, z.core.$strict>>;
1143
+ componentIncidents: z.ZodArray<z.ZodObject<{
1144
+ componentKey: z.ZodString;
1145
+ failure: z.ZodObject<{
1146
+ episodeId: z.ZodUUID;
1147
+ attempt: z.ZodNumber;
1148
+ terminal: z.ZodBoolean;
1149
+ operation: z.ZodString;
1150
+ stage: z.ZodString;
1151
+ code: z.ZodString;
1152
+ summary: z.ZodString;
1153
+ correlationId: z.ZodOptional<z.ZodString>;
1154
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
1155
+ upstreamCode: z.ZodOptional<z.ZodString>;
1156
+ }, z.core.$strict>;
1157
+ incidentId: z.ZodUUID;
1158
+ }, z.core.$strict>>;
1159
+ runtimeExpectationIncident: z.ZodNullable<z.ZodObject<{
1160
+ differences: z.ZodArray<z.ZodObject<{
1161
+ capabilityKey: z.ZodString;
1162
+ expected: z.ZodEnum<{
1163
+ enabled: "enabled";
1164
+ disabled: "disabled";
1165
+ }>;
1166
+ kind: z.ZodEnum<{
1167
+ mismatch: "mismatch";
1168
+ missing: "missing";
1169
+ }>;
1170
+ observed: z.ZodNullable<z.ZodEnum<{
1171
+ enabled: "enabled";
1172
+ disabled: "disabled";
1173
+ }>>;
1174
+ }, z.core.$strict>>;
1175
+ expectationRevision: z.ZodString;
1176
+ incidentId: z.ZodUUID;
1177
+ observationState: z.ZodEnum<{
1178
+ unavailable: "unavailable";
1179
+ available: "available";
1180
+ }>;
1181
+ }, z.core.$strict>>;
1182
+ staleIncident: z.ZodNullable<z.ZodObject<{
1183
+ incidentId: z.ZodUUID;
1184
+ openedAt: z.ZodISODateTime;
1185
+ }, z.core.$strict>>;
1186
+ }, z.core.$strict>>;
1187
+ }, z.core.$strict>;
1188
+ declare const sentinelStatusResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
1189
+ contractVersion: z.ZodLiteral<1>;
1190
+ projectId: z.ZodString;
1191
+ environment: z.ZodString;
1192
+ registration: z.ZodObject<{
1193
+ enabled: z.ZodBoolean;
1194
+ mode: z.ZodEnum<{
1195
+ live: "live";
1196
+ disabled: "disabled";
1197
+ shadow: "shadow";
1198
+ }>;
1199
+ policyDigest: z.ZodString;
1200
+ projectionDigest: z.ZodString;
1201
+ projectedAt: z.ZodISODateTime;
1202
+ sourceRevision: z.ZodString;
1203
+ }, z.core.$strict>;
1204
+ rules: z.ZodArray<z.ZodObject<{
1205
+ id: z.ZodString;
1206
+ semanticDigest: z.ZodString;
1207
+ enabled: z.ZodBoolean;
1208
+ state: z.ZodEnum<{
1209
+ unknown: "unknown";
1210
+ firing: "firing";
1211
+ closed: "closed";
1212
+ idle: "idle";
1213
+ }>;
1214
+ severity: z.ZodNullable<z.ZodEnum<{
1215
+ warning: "warning";
1216
+ critical: "critical";
1217
+ }>>;
1218
+ incidentId: z.ZodNullable<z.ZodUUID>;
1219
+ lastEvaluatedAt: z.ZodNullable<z.ZodISODateTime>;
1220
+ lastEventId: z.ZodNullable<z.ZodUUID>;
1221
+ }, z.core.$strict>>;
1222
+ deliveries: z.ZodArray<z.ZodObject<{
1223
+ contractVersion: z.ZodLiteral<1>;
1224
+ projectId: z.ZodString;
1225
+ environment: z.ZodString;
1226
+ eventId: z.ZodUUID;
1227
+ state: z.ZodEnum<{
1228
+ pending: "pending";
1229
+ delivered: "delivered";
1230
+ failed: "failed";
1231
+ retrying: "retrying";
1232
+ partial: "partial";
1233
+ unavailable: "unavailable";
1234
+ }>;
1235
+ reason: z.ZodEnum<{
1236
+ in_progress: "in_progress";
1237
+ partial_delivery: "partial_delivery";
1238
+ complete: "complete";
1239
+ retry_exhausted: "retry_exhausted";
1240
+ receipt_unavailable: "receipt_unavailable";
1241
+ }>;
1242
+ receivers: z.ZodArray<z.ZodObject<{
1243
+ receiverKey: z.ZodString;
1244
+ state: z.ZodEnum<{
1245
+ pending: "pending";
1246
+ delivering: "delivering";
1247
+ delivered: "delivered";
1248
+ failed: "failed";
1249
+ }>;
1250
+ attempts: z.ZodNumber;
1251
+ failureCode: z.ZodNullable<z.ZodEnum<{
1252
+ delivery_interrupted: "delivery_interrupted";
1253
+ provider_rejected: "provider_rejected";
1254
+ provider_timeout: "provider_timeout";
1255
+ provider_unavailable: "provider_unavailable";
1256
+ receiver_missing: "receiver_missing";
1257
+ synthetic_retry: "synthetic_retry";
1258
+ }>>;
1259
+ leaseExpiresAt: z.ZodNullable<z.ZodISODateTime>;
1260
+ lastAttemptAt: z.ZodNullable<z.ZodISODateTime>;
1261
+ }, z.core.$strict>>;
1262
+ updatedAt: z.ZodISODateTime;
1263
+ }, z.core.$strict>>;
1264
+ heartbeat: z.ZodObject<{
1265
+ state: z.ZodEnum<{
1266
+ unavailable: "unavailable";
1267
+ healthy: "healthy";
1268
+ stale: "stale";
1269
+ }>;
1270
+ lastCompletedAt: z.ZodNullable<z.ZodISODateTime>;
1271
+ }, z.core.$strict>;
1272
+ diagnostics: z.ZodArray<z.ZodObject<{
1273
+ code: z.ZodString;
1274
+ state: z.ZodEnum<{
1275
+ unknown: "unknown";
1276
+ warning: "warning";
1277
+ failed: "failed";
1278
+ degraded: "degraded";
1279
+ }>;
1280
+ summary: z.ZodString;
1281
+ suggestedCommand: z.ZodOptional<z.ZodString>;
1282
+ }, z.core.$strict>>;
1283
+ }, z.core.$strict>, z.ZodObject<{
1284
+ contractVersion: z.ZodLiteral<1>;
1285
+ statusType: z.ZodLiteral<"health">;
1286
+ projectId: z.ZodString;
1287
+ environment: z.ZodString;
1288
+ runtimes: z.ZodArray<z.ZodObject<{
1289
+ runtimeInstanceId: z.ZodString;
1290
+ state: z.ZodEnum<{
1291
+ unavailable: "unavailable";
1292
+ degraded: "degraded";
1293
+ healthy: "healthy";
1294
+ stale: "stale";
1295
+ }>;
1296
+ latestReport: z.ZodNullable<z.ZodObject<{
1297
+ receivedAt: z.ZodISODateTime;
1298
+ report: z.ZodUnion<readonly [z.ZodObject<{
1299
+ contractVersion: z.ZodLiteral<1>;
1300
+ projectId: z.ZodString;
1301
+ environment: z.ZodString;
1302
+ runtimeInstanceId: z.ZodString;
1303
+ reportId: z.ZodUUID;
1304
+ sequence: z.ZodNumber;
1305
+ observedAt: z.ZodISODateTime;
1306
+ components: z.ZodArray<z.ZodObject<{
1307
+ componentKey: z.ZodString;
1308
+ componentClass: z.ZodString;
1309
+ state: z.ZodEnum<{
1310
+ unknown: "unknown";
1311
+ failed: "failed";
1312
+ unavailable: "unavailable";
1313
+ degraded: "degraded";
1314
+ healthy: "healthy";
1315
+ }>;
1316
+ lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
1317
+ facts: z.ZodArray<z.ZodObject<{
1318
+ key: z.ZodString;
1319
+ value: z.ZodNumber;
1320
+ unit: z.ZodOptional<z.ZodEnum<{
1321
+ bytes: "bytes";
1322
+ count: "count";
1323
+ milliseconds: "milliseconds";
1324
+ percent: "percent";
1325
+ ratio: "ratio";
1326
+ }>>;
1327
+ }, z.core.$strict>>;
1328
+ failure: z.ZodNullable<z.ZodObject<{
1329
+ episodeId: z.ZodUUID;
1330
+ attempt: z.ZodNumber;
1331
+ terminal: z.ZodBoolean;
1332
+ operation: z.ZodString;
1333
+ stage: z.ZodString;
1334
+ code: z.ZodString;
1335
+ summary: z.ZodString;
1336
+ correlationId: z.ZodOptional<z.ZodString>;
1337
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
1338
+ upstreamCode: z.ZodOptional<z.ZodString>;
1339
+ }, z.core.$strict>>;
1340
+ }, z.core.$strict>>;
1341
+ }, z.core.$strict>, z.ZodObject<{
1342
+ contractVersion: z.ZodLiteral<2>;
1343
+ projectId: z.ZodString;
1344
+ environment: z.ZodString;
1345
+ runtimeInstanceId: z.ZodString;
1346
+ reportId: z.ZodUUID;
1347
+ sequence: z.ZodNumber;
1348
+ observedAt: z.ZodISODateTime;
1349
+ components: z.ZodArray<z.ZodObject<{
1350
+ componentKey: z.ZodString;
1351
+ componentClass: z.ZodString;
1352
+ state: z.ZodEnum<{
1353
+ unknown: "unknown";
1354
+ failed: "failed";
1355
+ unavailable: "unavailable";
1356
+ degraded: "degraded";
1357
+ healthy: "healthy";
1358
+ }>;
1359
+ lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
1360
+ facts: z.ZodArray<z.ZodObject<{
1361
+ key: z.ZodString;
1362
+ value: z.ZodNumber;
1363
+ unit: z.ZodOptional<z.ZodEnum<{
1364
+ bytes: "bytes";
1365
+ count: "count";
1366
+ milliseconds: "milliseconds";
1367
+ percent: "percent";
1368
+ ratio: "ratio";
1369
+ }>>;
1370
+ }, z.core.$strict>>;
1371
+ failure: z.ZodNullable<z.ZodObject<{
1372
+ episodeId: z.ZodUUID;
1373
+ attempt: z.ZodNumber;
1374
+ terminal: z.ZodBoolean;
1375
+ operation: z.ZodString;
1376
+ stage: z.ZodString;
1377
+ code: z.ZodString;
1378
+ summary: z.ZodString;
1379
+ correlationId: z.ZodOptional<z.ZodString>;
1380
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
1381
+ upstreamCode: z.ZodOptional<z.ZodString>;
1382
+ }, z.core.$strict>>;
1383
+ }, z.core.$strict>>;
1384
+ capabilities: z.ZodArray<z.ZodObject<{
1385
+ capabilityKey: z.ZodString;
1386
+ state: z.ZodEnum<{
1387
+ enabled: "enabled";
1388
+ disabled: "disabled";
1389
+ }>;
1390
+ }, z.core.$strict>>;
1391
+ }, z.core.$strict>]>;
1392
+ }, z.core.$strict>>;
1393
+ componentIncidents: z.ZodArray<z.ZodObject<{
1394
+ componentKey: z.ZodString;
1395
+ failure: z.ZodObject<{
1396
+ episodeId: z.ZodUUID;
1397
+ attempt: z.ZodNumber;
1398
+ terminal: z.ZodBoolean;
1399
+ operation: z.ZodString;
1400
+ stage: z.ZodString;
1401
+ code: z.ZodString;
1402
+ summary: z.ZodString;
1403
+ correlationId: z.ZodOptional<z.ZodString>;
1404
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
1405
+ upstreamCode: z.ZodOptional<z.ZodString>;
1406
+ }, z.core.$strict>;
1407
+ incidentId: z.ZodUUID;
1408
+ }, z.core.$strict>>;
1409
+ runtimeExpectationIncident: z.ZodNullable<z.ZodObject<{
1410
+ differences: z.ZodArray<z.ZodObject<{
1411
+ capabilityKey: z.ZodString;
1412
+ expected: z.ZodEnum<{
1413
+ enabled: "enabled";
1414
+ disabled: "disabled";
1415
+ }>;
1416
+ kind: z.ZodEnum<{
1417
+ mismatch: "mismatch";
1418
+ missing: "missing";
1419
+ }>;
1420
+ observed: z.ZodNullable<z.ZodEnum<{
1421
+ enabled: "enabled";
1422
+ disabled: "disabled";
1423
+ }>>;
1424
+ }, z.core.$strict>>;
1425
+ expectationRevision: z.ZodString;
1426
+ incidentId: z.ZodUUID;
1427
+ observationState: z.ZodEnum<{
1428
+ unavailable: "unavailable";
1429
+ available: "available";
1430
+ }>;
1431
+ }, z.core.$strict>>;
1432
+ staleIncident: z.ZodNullable<z.ZodObject<{
1433
+ incidentId: z.ZodUUID;
1434
+ openedAt: z.ZodISODateTime;
1435
+ }, z.core.$strict>>;
1436
+ }, z.core.$strict>>;
1437
+ }, z.core.$strict>]>;
1033
1438
  declare const sentinelHealthReportAuthenticationSchema: z.ZodObject<{
1034
1439
  timestamp: z.ZodISODateTime;
1035
1440
  nonce: z.ZodUUID;
@@ -1326,6 +1731,8 @@ type SentinelRegistration = z.infer<typeof sentinelRegistrationSchema>;
1326
1731
  type SentinelRegistrationCommand = z.infer<typeof sentinelRegistrationCommandSchema>;
1327
1732
  type SentinelRule = z.infer<typeof sentinelRuleSchema>;
1328
1733
  type SentinelRuntimeStatus = z.infer<typeof sentinelRuntimeStatusSchema>;
1734
+ type SentinelHealthRuntimeStatus = z.infer<typeof sentinelHealthRuntimeStatusSchema>;
1735
+ type SentinelStatusResponse = z.infer<typeof sentinelStatusResponseSchema>;
1329
1736
  type SentinelTestEvent = z.infer<typeof sentinelTestEventSchema>;
1330
1737
  type SentinelHealthComponent = z.infer<typeof sentinelHealthComponentSchema>;
1331
1738
  type SentinelHealthFailure = z.infer<typeof sentinelHealthFailureSchema>;
@@ -1341,4 +1748,4 @@ type SentinelHealthReportSubmissionV2 = z.infer<typeof sentinelHealthReportSubmi
1341
1748
  type SentinelHealthReportSubmissionAny = z.infer<typeof sentinelHealthReportSubmissionAnySchema>;
1342
1749
  type SentinelRuntimeCapabilityObservation = z.infer<typeof sentinelRuntimeCapabilityObservationSchema>;
1343
1750
  //#endregion
1344
- export { SentinelAction, SentinelAlertPolicy, SentinelDeliveryReceipt, SentinelEnvironmentBinding, SentinelHealthComponent, SentinelHealthFailure, SentinelHealthMetricFact, SentinelHealthReport, SentinelHealthReportAny, SentinelHealthReportAuthentication, SentinelHealthReportIngestResult, SentinelHealthReportRejectionCode, SentinelHealthReportServiceAny, SentinelHealthReportServiceV1, SentinelHealthReportServiceV2, SentinelHealthReportSubmission, SentinelHealthReportSubmissionAny, SentinelHealthReportSubmissionV2, SentinelHealthReportV2, SentinelIncidentEvent, SentinelPolicyAction, SentinelProjectManifest, SentinelQueueEvent, SentinelQueueMetrics, SentinelReceiverFailureCode, SentinelRegistration, SentinelRegistrationCommand, SentinelRule, SentinelRuntimeCapabilityObservation, SentinelRuntimeStatus, SentinelTestEvent, sentinelActionSchema, sentinelAlertPolicySchema, sentinelContractVersion, sentinelDeliveryReceiptSchema, sentinelDiagnosticSchema, sentinelEnvironmentBindingSchema, sentinelEventIdSchema, sentinelEvidenceSchema, sentinelHealthComponentSchema, sentinelHealthFailureSchema, sentinelHealthMetricFactSchema, sentinelHealthReportAnySchema, sentinelHealthReportAnySignatureInput, sentinelHealthReportAuthenticationSchema, sentinelHealthReportIngestResultSchema, sentinelHealthReportMaximumBytes, sentinelHealthReportMaximumCapabilities, sentinelHealthReportMaximumComponents, sentinelHealthReportRejectionCodeSchema, sentinelHealthReportSchema, sentinelHealthReportSignatureInput, sentinelHealthReportSubmissionAnySchema, sentinelHealthReportSubmissionSchema, sentinelHealthReportSubmissionV2Schema, sentinelHealthReportV2Schema, sentinelHealthReportV2SignatureInput, sentinelIncidentEventSchema, sentinelPolicyActionSchema, sentinelProjectManifestSchema, sentinelQueueEventIdentityInput, sentinelQueueEventSchema, sentinelQueueMetricsSchema, sentinelReceiverFailureCodeSchema, sentinelReceiverStateSchema, sentinelRegistrationCommandSchema, sentinelRegistrationSchema, sentinelRuleSchema, sentinelRunbookSchema, sentinelRuntimeCapabilityObservationSchema, sentinelRuntimeStatusSchema, sentinelTestEventSchema };
1751
+ export { SentinelAction, SentinelAlertPolicy, SentinelDeliveryReceipt, SentinelEnvironmentBinding, SentinelHealthComponent, SentinelHealthFailure, SentinelHealthMetricFact, SentinelHealthReport, SentinelHealthReportAny, SentinelHealthReportAuthentication, SentinelHealthReportIngestResult, SentinelHealthReportRejectionCode, SentinelHealthReportServiceAny, SentinelHealthReportServiceV1, SentinelHealthReportServiceV2, SentinelHealthReportSubmission, SentinelHealthReportSubmissionAny, SentinelHealthReportSubmissionV2, SentinelHealthReportV2, SentinelHealthRuntimeStatus, SentinelIncidentEvent, SentinelPolicyAction, SentinelProjectManifest, SentinelQueueEvent, SentinelQueueMetrics, SentinelReceiverFailureCode, SentinelRegistration, SentinelRegistrationCommand, SentinelRule, SentinelRuntimeCapabilityObservation, SentinelRuntimeStatus, SentinelStatusResponse, SentinelTestEvent, sentinelActionSchema, sentinelAlertPolicySchema, sentinelContractVersion, sentinelDeliveryReceiptSchema, sentinelDiagnosticSchema, sentinelEnvironmentBindingSchema, sentinelEventIdSchema, sentinelEvidenceSchema, sentinelHealthComponentSchema, sentinelHealthFailureSchema, sentinelHealthMetricFactSchema, sentinelHealthReportAnySchema, sentinelHealthReportAnySignatureInput, sentinelHealthReportAuthenticationSchema, sentinelHealthReportIngestResultSchema, sentinelHealthReportMaximumBytes, sentinelHealthReportMaximumCapabilities, sentinelHealthReportMaximumComponents, sentinelHealthReportRejectionCodeSchema, sentinelHealthReportSchema, sentinelHealthReportSignatureInput, sentinelHealthReportSubmissionAnySchema, sentinelHealthReportSubmissionSchema, sentinelHealthReportSubmissionV2Schema, sentinelHealthReportV2Schema, sentinelHealthReportV2SignatureInput, sentinelHealthRuntimeStatusSchema, sentinelIncidentEventSchema, sentinelPolicyActionSchema, sentinelProjectManifestSchema, sentinelQueueEventIdentityInput, sentinelQueueEventSchema, sentinelQueueMetricsSchema, sentinelReceiverFailureCodeSchema, sentinelReceiverStateSchema, sentinelRegistrationCommandSchema, sentinelRegistrationSchema, sentinelRuleSchema, sentinelRunbookSchema, sentinelRuntimeCapabilityObservationSchema, sentinelRuntimeStatusSchema, sentinelStatusResponseSchema, sentinelTestEventSchema };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{z as e}from"zod";const t=1,n=32*1024,r=64,i=64,a=t=>e.string().trim().min(1).max(t),o=e.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),s=e.string().regex(/^[a-z][A-Za-z0-9_]{0,63}$/),c=e.uuid(),l=c,u=e.url().refine(e=>e.startsWith(`https://`),`must use HTTPS`),d=e.object({label:e.enum([`Observed value`,`Warning threshold`,`Critical threshold`]),value:e.number().finite().nonnegative()}).strict(),f=e.object({label:a(80),url:u}).strict(),p=e.object({type:e.literal(`none`)}).strict(),m=e.object({type:e.literal(`live_command`),command:a(500).regex(/^abuse apply\b/).refine(e=>e.endsWith(` --apply`),`must end with --apply`)}).strict(),h=e.object({type:e.literal(`test_preview`),summary:a(300).refine(e=>!e.includes(`--apply`),`must not contain --apply`)}).strict(),g=e.discriminatedUnion(`type`,[p,m,h]),_=e.object({contractVersion:e.literal(1),projectId:o,environment:o,incidentId:l,eventId:l,kind:e.enum([`firing`,`reminder`,`resolved`]),severity:e.enum([`warning`,`critical`]),signalClass:e.enum([`attack`,`service`]),signal:o,title:a(120),occurredAt:e.iso.datetime(),evidence:e.array(d).max(8),runbook:f,statusCommand:a(300).regex(/^sentinel status\b/),receiverKeys:e.array(o).min(1).max(16),action:g}).strict(),v=_.extend({mode:e.literal(`live`)}).superRefine((e,t)=>{e.signalClass===`service`&&e.action.type!==`none`&&t.addIssue({code:`custom`,message:`service events cannot contain an operational action`,path:[`action`]}),e.action.type===`test_preview`&&t.addIssue({code:`custom`,message:`live events cannot contain a test preview`,path:[`action`]})}),y=_.extend({mode:e.literal(`test`),action:e.discriminatedUnion(`type`,[p,h])}).strict(),b=e.union([v,y]);function x(e){let t=b.parse(e);return JSON.stringify(t)}const S=e.enum([`delivery_interrupted`,`provider_rejected`,`provider_timeout`,`provider_unavailable`,`receiver_missing`,`synthetic_retry`]),C=e.object({receiverKey:o,state:e.enum([`pending`,`delivering`,`delivered`,`failed`]),attempts:e.number().int().min(0).max(4),failureCode:S.nullable(),leaseExpiresAt:e.iso.datetime().nullable(),lastAttemptAt:e.iso.datetime().nullable()}).strict().superRefine((e,t)=>{e.state===`failed`&&e.failureCode===null&&t.addIssue({code:`custom`,message:`failed receivers require failureCode`,path:[`failureCode`]}),e.state!==`failed`&&e.failureCode!==null&&t.addIssue({code:`custom`,message:`only failed receivers can carry failureCode`,path:[`failureCode`]})}),w=e.object({contractVersion:e.literal(1),projectId:o,environment:o,eventId:l,state:e.enum([`pending`,`retrying`,`partial`,`delivered`,`failed`,`unavailable`]),reason:e.enum([`in_progress`,`partial_delivery`,`complete`,`retry_exhausted`,`receipt_unavailable`]),receivers:e.array(C).max(16),updatedAt:e.iso.datetime()}).strict(),T=e.object({code:o,state:e.enum([`degraded`,`failed`,`unknown`,`warning`]),summary:a(300),suggestedCommand:a(500).optional()}).strict(),E=e.object({contractVersion:e.literal(1),projectId:o,environment:o,registration:e.object({enabled:e.boolean(),mode:e.enum([`disabled`,`shadow`,`live`]),policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectedAt:e.iso.datetime(),sourceRevision:a(160)}).strict(),rules:e.array(e.object({id:o,semanticDigest:e.string().regex(/^[a-f0-9]{64}$/),enabled:e.boolean(),state:e.enum([`closed`,`firing`,`idle`,`unknown`]),severity:e.enum([`warning`,`critical`]).nullable(),incidentId:l.nullable(),lastEvaluatedAt:e.iso.datetime().nullable(),lastEventId:l.nullable()}).strict()).max(64),deliveries:e.array(w).max(64),heartbeat:e.object({state:e.enum([`healthy`,`stale`,`unavailable`]),lastCompletedAt:e.iso.datetime().nullable()}).strict(),diagnostics:e.array(T).max(32)}).strict(),D=e.object({state:e.enum([`available`,`unavailable`]),backlogCount:e.number().int().nonnegative().nullable(),backlogBytes:e.number().int().nonnegative().nullable(),oldestMessageAt:e.iso.datetime().nullable(),retentionSeconds:e.number().int().positive().nullable()}).strict(),O=e.string().regex(/^[A-Z][A-Z0-9_]{2,127}$/),k=e.string().max(240).regex(/^(?![A-Za-z]:|\/|.*(?:^|\/)\.\.(?:\/|$)).+\.json$/),A=e.object({mode:e.enum([`disabled`,`shadow`,`live`]),statusUrlEnv:O,statusHmacSecretEnv:O,healthReportHmacSecretEnv:O.optional(),opsAccountIdEnv:O,provisionApiTokenEnv:O,statusApiTokenEnv:O,analyticsAccountIdEnv:O,analyticsApiTokenEnv:O,analyticsDataset:o,workerName:o,queueName:o,dlqName:o,registrationQueueName:o,registrationDlqName:o,notificationWorkerName:o,healthchecksProvisionApiKeyEnv:O.optional(),healthchecksPingUrlEnv:O.optional(),healthchecksStatusApiKeyEnv:O.optional()}).strict().superRefine((e,t)=>{let n=[e.healthchecksProvisionApiKeyEnv,e.healthchecksPingUrlEnv,e.healthchecksStatusApiKeyEnv].filter(Boolean);n.length>0&&n.length!==3&&t.addIssue({code:`custom`,message:`Healthchecks provision, status and ping URL references must be configured together`,path:[`healthchecksProvisionApiKeyEnv`]})}),j=e.object({contractVersion:e.literal(1),projectId:o,policy:k,environments:e.record(o,A)}).strict().superRefine((e,t)=>{Object.keys(e.environments).length===0&&t.addIssue({code:`custom`,message:`at least one environment is required`,path:[`environments`]})}),M=e.object({type:e.literal(`abuse`),project:e.string().regex(/^[a-zA-Z0-9._/-]{1,120}$/),target:o,action:o,layer:o,ttl:e.string().regex(/^[1-9][0-9]{0,4}[smhd]$/).optional()}).strict(),N=e.discriminatedUnion(`type`,[p,M]),P=e.object({id:o,enabled:e.boolean(),signalClass:e.enum([`attack`,`service`]),signal:e.object({type:e.enum([`operation_count`,`worker_error_ratio`,`edge_security_spike`,`provider_health`]),operation:s.optional(),operations:e.array(s).min(1).max(16).optional(),outcomes:e.array(e.enum([`committed`,`accepted_noop`,`rejected`,`failed`])).max(4).optional(),minimumSample:e.number().int().positive().optional()}).strict(),windowMinutes:e.number().int().min(5).max(1440),thresholds:e.object({warning:e.number().nonnegative(),critical:e.number().positive()}).strict().refine(e=>e.critical>e.warning,`critical must exceed warning`),recovery:e.object({healthyEvaluations:e.number().int().min(1).max(24)}).strict(),reminders:e.object({warningMinutes:e.number().int().min(5).max(10080),criticalMinutes:e.number().int().min(5).max(10080)}).strict(),runbook:f,receiverKeys:e.array(o).min(1).max(16),actions:e.object({warning:N,critical:N}).strict()}).strict().superRefine((e,t)=>{e.signal.operation&&e.signal.operations&&t.addIssue({code:`custom`,message:`signal cannot define both operation and operations`,path:[`signal`]}),e.signal.type===`operation_count`&&!e.signal.operation&&!e.signal.operations&&t.addIssue({code:`custom`,message:`operation_count requires operation or operations`,path:[`signal`]}),e.signal.type===`provider_health`&&e.thresholds.warning>1&&t.addIssue({code:`custom`,message:`provider_health warning threshold must be at most 1`,path:[`thresholds`,`warning`]}),e.signalClass===`service`&&(e.actions.warning.type!==`none`||e.actions.critical.type!==`none`)&&t.addIssue({code:`custom`,message:`service rules cannot configure abuse actions`,path:[`actions`]})}),F=e.object({contractVersion:e.literal(1),evaluationMinutes:e.number().int().min(5).max(60),rules:e.array(P).min(1).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.rules.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`duplicate rule id ${i.id}`,path:[`rules`,r,`id`]}),n.add(i.id)}),I=e.object({analytics:e.object({accountIdBinding:O,dataset:o,index:a(160),tokenBinding:O}).strict(),enabled:e.boolean(),environment:o,mode:e.enum([`disabled`,`shadow`,`live`]),policy:F,policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectId:o,projectedAt:e.iso.datetime(),sourceRevision:a(160),healthReportHmacSecretBinding:O.optional()}).strict().refine(e=>e.enabled===(e.mode!==`disabled`),{message:`enabled must match registration mode`,path:[`enabled`]}).superRefine((e,t)=>{e.mode===`live`&&!e.policy.rules.some(e=>e.enabled&&e.signal.type===`provider_health`)&&t.addIssue({code:`custom`,message:`Live registration requires an enabled provider_health rule`,path:[`policy`,`rules`]})}),L=e.object({commandId:l,contractVersion:e.literal(1),expectedPreviousDigest:e.string().regex(/^[a-f0-9]{64}$/).nullable(),kind:e.literal(`registration_upsert`),registration:I}).strict(),R=e.string().trim().min(1).max(160),z=e.object({key:o,value:e.number().finite().nonnegative(),unit:e.enum([`bytes`,`count`,`milliseconds`,`percent`,`ratio`]).optional()}).strict(),B=e.object({episodeId:c,attempt:e.number().int().min(1).max(1e3),terminal:e.boolean(),operation:s,stage:o,code:o,summary:a(300),correlationId:R.optional(),upstreamStatus:e.number().int().min(100).max(599).optional(),upstreamCode:o.optional()}).strict(),V=e.object({componentKey:o,componentClass:o,state:e.enum([`healthy`,`degraded`,`failed`,`unavailable`,`unknown`]),lastSuccessAt:e.iso.datetime().nullable(),facts:e.array(z).max(16),failure:B.nullable()}).strict().superRefine((e,t)=>{e.state===`healthy`&&e.failure!==null&&t.addIssue({code:`custom`,message:`healthy components cannot carry a current failure`,path:[`failure`]}),(e.state===`failed`||e.state===`unavailable`)&&e.failure===null&&t.addIssue({code:`custom`,message:`failed and unavailable components require a current failure`,path:[`failure`]})}),H=e.object({contractVersion:e.literal(1),projectId:o,environment:o,runtimeInstanceId:o,reportId:c,sequence:e.number().int().min(1).max(2**53-1),observedAt:e.iso.datetime(),components:e.array(V).min(1).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.components.entries())n.has(i.componentKey)&&t.addIssue({code:`custom`,message:`duplicate component key ${i.componentKey}`,path:[`components`,r,`componentKey`]}),n.add(i.componentKey)}),U=e.object({capabilityKey:o,state:e.enum([`enabled`,`disabled`])}).strict(),W=e.object({contractVersion:e.literal(2),projectId:o,environment:o,runtimeInstanceId:o,reportId:c,sequence:e.number().int().min(1).max(2**53-1),observedAt:e.iso.datetime(),components:e.array(V).min(1).max(64),capabilities:e.array(U).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.components.entries())n.has(i.componentKey)&&t.addIssue({code:`custom`,message:`duplicate component key ${i.componentKey}`,path:[`components`,r,`componentKey`]}),n.add(i.componentKey);let r=new Set;for(let[n,i]of e.capabilities.entries())r.has(i.capabilityKey)&&t.addIssue({code:`custom`,message:`duplicate capability key ${i.capabilityKey}`,path:[`capabilities`,n,`capabilityKey`]}),r.add(i.capabilityKey)}),G=e.union([H,W]),K=e.object({timestamp:e.iso.datetime(),nonce:c,signature:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),q=e.object({contractVersion:e.literal(1),report:H,authentication:K}).strict(),J=e.object({contractVersion:e.literal(2),report:W,authentication:K}).strict(),Y=e.union([q,J]);function X(e){let t=q.omit({authentication:!0}).extend({authentication:K.omit({signature:!0})}).parse(e);return JSON.stringify(t)}function Z(e){let t=J.omit({authentication:!0}).extend({authentication:K.omit({signature:!0})}).parse(e);return JSON.stringify(t)}function Q(e){return e.contractVersion===1?X(e):Z(e)}const $=e.enum([`authentication_failed`,`identity_not_registered`,`nonce_replayed`,`report_invalid`,`runtime_identity_mismatch`,`sequence_invalid`,`size_exceeded`,`timestamp_out_of_range`,`unexpected_failure`]),ee=e.discriminatedUnion(`outcome`,[e.object({outcome:e.literal(`accepted`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`duplicate`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`out_of_order`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`rejected`),rejectionCode:$,summary:a(300)}).strict()]);export{g as sentinelActionSchema,F as sentinelAlertPolicySchema,t as sentinelContractVersion,w as sentinelDeliveryReceiptSchema,T as sentinelDiagnosticSchema,A as sentinelEnvironmentBindingSchema,c as sentinelEventIdSchema,d as sentinelEvidenceSchema,V as sentinelHealthComponentSchema,B as sentinelHealthFailureSchema,z as sentinelHealthMetricFactSchema,G as sentinelHealthReportAnySchema,Q as sentinelHealthReportAnySignatureInput,K as sentinelHealthReportAuthenticationSchema,ee as sentinelHealthReportIngestResultSchema,n as sentinelHealthReportMaximumBytes,i as sentinelHealthReportMaximumCapabilities,r as sentinelHealthReportMaximumComponents,$ as sentinelHealthReportRejectionCodeSchema,H as sentinelHealthReportSchema,X as sentinelHealthReportSignatureInput,Y as sentinelHealthReportSubmissionAnySchema,q as sentinelHealthReportSubmissionSchema,J as sentinelHealthReportSubmissionV2Schema,W as sentinelHealthReportV2Schema,Z as sentinelHealthReportV2SignatureInput,v as sentinelIncidentEventSchema,N as sentinelPolicyActionSchema,j as sentinelProjectManifestSchema,x as sentinelQueueEventIdentityInput,b as sentinelQueueEventSchema,D as sentinelQueueMetricsSchema,S as sentinelReceiverFailureCodeSchema,C as sentinelReceiverStateSchema,L as sentinelRegistrationCommandSchema,I as sentinelRegistrationSchema,P as sentinelRuleSchema,f as sentinelRunbookSchema,U as sentinelRuntimeCapabilityObservationSchema,E as sentinelRuntimeStatusSchema,y as sentinelTestEventSchema};
1
+ import{z as e}from"zod";const t=1,n=32*1024,r=64,i=64,a=t=>e.string().trim().min(1).max(t),o=e.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),s=e.string().regex(/^[a-z][A-Za-z0-9_]{0,63}$/),c=e.uuid(),l=c,ee=e.url().refine(e=>e.startsWith(`https://`),`must use HTTPS`),u=e.object({label:e.enum([`Observed value`,`Warning threshold`,`Critical threshold`]),value:e.number().finite().nonnegative()}).strict(),d=e.object({label:a(80),url:ee}).strict(),f=e.object({type:e.literal(`none`)}).strict(),p=e.object({type:e.literal(`live_command`),command:a(500).regex(/^abuse apply\b/).refine(e=>e.endsWith(` --apply`),`must end with --apply`)}).strict(),m=e.object({type:e.literal(`test_preview`),summary:a(300).refine(e=>!e.includes(`--apply`),`must not contain --apply`)}).strict(),h=e.discriminatedUnion(`type`,[f,p,m]),g=e.object({contractVersion:e.literal(1),projectId:o,environment:o,incidentId:l,eventId:l,kind:e.enum([`firing`,`reminder`,`resolved`]),severity:e.enum([`warning`,`critical`]),signalClass:e.enum([`attack`,`service`]),signal:o,title:a(120),occurredAt:e.iso.datetime(),evidence:e.array(u).max(8),runbook:d,statusCommand:a(300).regex(/^sentinel status\b/),receiverKeys:e.array(o).min(1).max(16),action:h}).strict(),_=g.extend({mode:e.literal(`live`)}).superRefine((e,t)=>{e.signalClass===`service`&&e.action.type!==`none`&&t.addIssue({code:`custom`,message:`service events cannot contain an operational action`,path:[`action`]}),e.action.type===`test_preview`&&t.addIssue({code:`custom`,message:`live events cannot contain a test preview`,path:[`action`]})}),v=g.extend({mode:e.literal(`test`),action:e.discriminatedUnion(`type`,[f,m])}).strict(),y=e.union([_,v]);function b(e){let t=y.parse(e);return JSON.stringify(t)}const x=e.enum([`delivery_interrupted`,`provider_rejected`,`provider_timeout`,`provider_unavailable`,`receiver_missing`,`synthetic_retry`]),S=e.object({receiverKey:o,state:e.enum([`pending`,`delivering`,`delivered`,`failed`]),attempts:e.number().int().min(0).max(4),failureCode:x.nullable(),leaseExpiresAt:e.iso.datetime().nullable(),lastAttemptAt:e.iso.datetime().nullable()}).strict().superRefine((e,t)=>{e.state===`failed`&&e.failureCode===null&&t.addIssue({code:`custom`,message:`failed receivers require failureCode`,path:[`failureCode`]}),e.state!==`failed`&&e.failureCode!==null&&t.addIssue({code:`custom`,message:`only failed receivers can carry failureCode`,path:[`failureCode`]})}),C=e.object({contractVersion:e.literal(1),projectId:o,environment:o,eventId:l,state:e.enum([`pending`,`retrying`,`partial`,`delivered`,`failed`,`unavailable`]),reason:e.enum([`in_progress`,`partial_delivery`,`complete`,`retry_exhausted`,`receipt_unavailable`]),receivers:e.array(S).max(16),updatedAt:e.iso.datetime()}).strict(),w=e.object({code:o,state:e.enum([`degraded`,`failed`,`unknown`,`warning`]),summary:a(300),suggestedCommand:a(500).optional()}).strict(),T=e.object({contractVersion:e.literal(1),projectId:o,environment:o,registration:e.object({enabled:e.boolean(),mode:e.enum([`disabled`,`shadow`,`live`]),policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectedAt:e.iso.datetime(),sourceRevision:a(160)}).strict(),rules:e.array(e.object({id:o,semanticDigest:e.string().regex(/^[a-f0-9]{64}$/),enabled:e.boolean(),state:e.enum([`closed`,`firing`,`idle`,`unknown`]),severity:e.enum([`warning`,`critical`]).nullable(),incidentId:l.nullable(),lastEvaluatedAt:e.iso.datetime().nullable(),lastEventId:l.nullable()}).strict()).max(64),deliveries:e.array(C).max(64),heartbeat:e.object({state:e.enum([`healthy`,`stale`,`unavailable`]),lastCompletedAt:e.iso.datetime().nullable()}).strict(),diagnostics:e.array(w).max(32)}).strict(),te=e.object({state:e.enum([`available`,`unavailable`]),backlogCount:e.number().int().nonnegative().nullable(),backlogBytes:e.number().int().nonnegative().nullable(),oldestMessageAt:e.iso.datetime().nullable(),retentionSeconds:e.number().int().positive().nullable()}).strict(),E=e.string().regex(/^[A-Z][A-Z0-9_]{2,127}$/),ne=e.string().max(240).regex(/^(?![A-Za-z]:|\/|.*(?:^|\/)\.\.(?:\/|$)).+\.json$/),D=e.object({mode:e.enum([`disabled`,`shadow`,`live`]),statusUrlEnv:E,statusHmacSecretEnv:E,healthReportHmacSecretEnv:E.optional(),opsAccountIdEnv:E,provisionApiTokenEnv:E,statusApiTokenEnv:E,analyticsAccountIdEnv:E,analyticsApiTokenEnv:E,analyticsDataset:o,workerName:o,queueName:o,dlqName:o,registrationQueueName:o,registrationDlqName:o,notificationWorkerName:o,healthchecksProvisionApiKeyEnv:E.optional(),healthchecksPingUrlEnv:E.optional(),healthchecksStatusApiKeyEnv:E.optional()}).strict().superRefine((e,t)=>{let n=[e.healthchecksProvisionApiKeyEnv,e.healthchecksPingUrlEnv,e.healthchecksStatusApiKeyEnv].filter(Boolean);n.length>0&&n.length!==3&&t.addIssue({code:`custom`,message:`Healthchecks provision, status and ping URL references must be configured together`,path:[`healthchecksProvisionApiKeyEnv`]})}),O=e.object({contractVersion:e.literal(1),projectId:o,policy:ne,environments:e.record(o,D)}).strict().superRefine((e,t)=>{Object.keys(e.environments).length===0&&t.addIssue({code:`custom`,message:`at least one environment is required`,path:[`environments`]})}),k=e.object({type:e.literal(`abuse`),project:e.string().regex(/^[a-zA-Z0-9._/-]{1,120}$/),target:o,action:o,layer:o,ttl:e.string().regex(/^[1-9][0-9]{0,4}[smhd]$/).optional()}).strict(),A=e.discriminatedUnion(`type`,[f,k]),j=e.object({id:o,enabled:e.boolean(),signalClass:e.enum([`attack`,`service`]),signal:e.object({type:e.enum([`operation_count`,`worker_error_ratio`,`edge_security_spike`,`provider_health`]),operation:s.optional(),operations:e.array(s).min(1).max(16).optional(),outcomes:e.array(e.enum([`committed`,`accepted_noop`,`rejected`,`failed`])).max(4).optional(),minimumSample:e.number().int().positive().optional()}).strict(),windowMinutes:e.number().int().min(5).max(1440),thresholds:e.object({warning:e.number().nonnegative(),critical:e.number().positive()}).strict().refine(e=>e.critical>e.warning,`critical must exceed warning`),recovery:e.object({healthyEvaluations:e.number().int().min(1).max(24)}).strict(),reminders:e.object({warningMinutes:e.number().int().min(5).max(10080),criticalMinutes:e.number().int().min(5).max(10080)}).strict(),runbook:d,receiverKeys:e.array(o).min(1).max(16),actions:e.object({warning:A,critical:A}).strict()}).strict().superRefine((e,t)=>{e.signal.operation&&e.signal.operations&&t.addIssue({code:`custom`,message:`signal cannot define both operation and operations`,path:[`signal`]}),e.signal.type===`operation_count`&&!e.signal.operation&&!e.signal.operations&&t.addIssue({code:`custom`,message:`operation_count requires operation or operations`,path:[`signal`]}),e.signal.type===`provider_health`&&e.thresholds.warning>1&&t.addIssue({code:`custom`,message:`provider_health warning threshold must be at most 1`,path:[`thresholds`,`warning`]}),e.signalClass===`service`&&(e.actions.warning.type!==`none`||e.actions.critical.type!==`none`)&&t.addIssue({code:`custom`,message:`service rules cannot configure abuse actions`,path:[`actions`]})}),M=e.object({contractVersion:e.literal(1),evaluationMinutes:e.number().int().min(5).max(60),rules:e.array(j).min(1).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.rules.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`duplicate rule id ${i.id}`,path:[`rules`,r,`id`]}),n.add(i.id)}),N=e.object({analytics:e.object({accountIdBinding:E,dataset:o,index:a(160),tokenBinding:E}).strict(),enabled:e.boolean(),environment:o,mode:e.enum([`disabled`,`shadow`,`live`]),policy:M,policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectId:o,projectedAt:e.iso.datetime(),sourceRevision:a(160),healthReportHmacSecretBinding:E.optional()}).strict().refine(e=>e.enabled===(e.mode!==`disabled`),{message:`enabled must match registration mode`,path:[`enabled`]}).superRefine((e,t)=>{e.mode===`live`&&!e.policy.rules.some(e=>e.enabled&&e.signal.type===`provider_health`)&&t.addIssue({code:`custom`,message:`Live registration requires an enabled provider_health rule`,path:[`policy`,`rules`]})}),P=e.object({commandId:l,contractVersion:e.literal(1),expectedPreviousDigest:e.string().regex(/^[a-f0-9]{64}$/).nullable(),kind:e.literal(`registration_upsert`),registration:N}).strict(),F=e.string().trim().min(1).max(160),I=e.object({key:o,value:e.number().finite().nonnegative(),unit:e.enum([`bytes`,`count`,`milliseconds`,`percent`,`ratio`]).optional()}).strict(),L=e.object({episodeId:c,attempt:e.number().int().min(1).max(1e3),terminal:e.boolean(),operation:s,stage:o,code:o,summary:a(300),correlationId:F.optional(),upstreamStatus:e.number().int().min(100).max(599).optional(),upstreamCode:o.optional()}).strict(),R=e.object({componentKey:o,componentClass:o,state:e.enum([`healthy`,`degraded`,`failed`,`unavailable`,`unknown`]),lastSuccessAt:e.iso.datetime().nullable(),facts:e.array(I).max(16),failure:L.nullable()}).strict().superRefine((e,t)=>{e.state===`healthy`&&e.failure!==null&&t.addIssue({code:`custom`,message:`healthy components cannot carry a current failure`,path:[`failure`]}),(e.state===`failed`||e.state===`unavailable`)&&e.failure===null&&t.addIssue({code:`custom`,message:`failed and unavailable components require a current failure`,path:[`failure`]})}),z=e.object({contractVersion:e.literal(1),projectId:o,environment:o,runtimeInstanceId:o,reportId:c,sequence:e.number().int().min(1).max(2**53-1),observedAt:e.iso.datetime(),components:e.array(R).min(1).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.components.entries())n.has(i.componentKey)&&t.addIssue({code:`custom`,message:`duplicate component key ${i.componentKey}`,path:[`components`,r,`componentKey`]}),n.add(i.componentKey)}),B=e.object({capabilityKey:o,state:e.enum([`enabled`,`disabled`])}).strict(),V=e.object({contractVersion:e.literal(2),projectId:o,environment:o,runtimeInstanceId:o,reportId:c,sequence:e.number().int().min(1).max(2**53-1),observedAt:e.iso.datetime(),components:e.array(R).min(1).max(64),capabilities:e.array(B).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.components.entries())n.has(i.componentKey)&&t.addIssue({code:`custom`,message:`duplicate component key ${i.componentKey}`,path:[`components`,r,`componentKey`]}),n.add(i.componentKey);let r=new Set;for(let[n,i]of e.capabilities.entries())r.has(i.capabilityKey)&&t.addIssue({code:`custom`,message:`duplicate capability key ${i.capabilityKey}`,path:[`capabilities`,n,`capabilityKey`]}),r.add(i.capabilityKey)}),H=e.union([z,V]),U=e.object({capabilityKey:o,expected:e.enum([`enabled`,`disabled`]),kind:e.enum([`mismatch`,`missing`]),observed:e.enum([`enabled`,`disabled`]).nullable()}).strict(),W=e.object({componentKey:o,failure:L,incidentId:l}).strict(),G=e.object({runtimeInstanceId:o,state:e.enum([`degraded`,`healthy`,`stale`,`unavailable`]),latestReport:e.object({receivedAt:e.iso.datetime(),report:H}).strict().nullable(),componentIncidents:e.array(W).max(64),runtimeExpectationIncident:e.object({differences:e.array(U).max(64),expectationRevision:o,incidentId:l,observationState:e.enum([`available`,`unavailable`])}).strict().nullable(),staleIncident:e.object({incidentId:l,openedAt:e.iso.datetime()}).strict().nullable()}).strict().superRefine((e,t)=>{let n=e.latestReport===null?`unavailable`:e.staleIncident===null?e.latestReport.report.components.some(e=>e.state!==`healthy`)||e.componentIncidents.length>0||e.runtimeExpectationIncident!==null?`degraded`:`healthy`:`stale`;e.state!==n&&t.addIssue({code:`custom`,message:`runtime state must be ${n}`,path:[`state`]}),e.latestReport===null&&(e.componentIncidents.length>0||e.runtimeExpectationIncident!==null||e.staleIncident!==null)&&t.addIssue({code:`custom`,message:`an unavailable runtime without a report cannot carry incidents`,path:[`latestReport`]})}),K=e.object({contractVersion:e.literal(1),statusType:e.literal(`health`),projectId:o,environment:o,runtimes:e.array(G).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.runtimes.entries()){n.has(i.runtimeInstanceId)&&t.addIssue({code:`custom`,message:`duplicate runtime identity ${i.runtimeInstanceId}`,path:[`runtimes`,r,`runtimeInstanceId`]}),n.add(i.runtimeInstanceId);let a=i.latestReport?.report;a&&(a.projectId!==e.projectId||a.environment!==e.environment||a.runtimeInstanceId!==i.runtimeInstanceId)&&t.addIssue({code:`custom`,message:`latest report identity must match the status runtime identity`,path:[`runtimes`,r,`latestReport`,`report`]})}}),q=e.union([T,K]),J=e.object({timestamp:e.iso.datetime(),nonce:c,signature:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),Y=e.object({contractVersion:e.literal(1),report:z,authentication:J}).strict(),X=e.object({contractVersion:e.literal(2),report:V,authentication:J}).strict(),re=e.union([Y,X]);function Z(e){let t=Y.omit({authentication:!0}).extend({authentication:J.omit({signature:!0})}).parse(e);return JSON.stringify(t)}function Q(e){let t=X.omit({authentication:!0}).extend({authentication:J.omit({signature:!0})}).parse(e);return JSON.stringify(t)}function ie(e){return e.contractVersion===1?Z(e):Q(e)}const $=e.enum([`authentication_failed`,`identity_not_registered`,`nonce_replayed`,`report_invalid`,`runtime_identity_mismatch`,`sequence_invalid`,`size_exceeded`,`timestamp_out_of_range`,`unexpected_failure`]),ae=e.discriminatedUnion(`outcome`,[e.object({outcome:e.literal(`accepted`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`duplicate`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`out_of_order`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`rejected`),rejectionCode:$,summary:a(300)}).strict()]);export{h as sentinelActionSchema,M as sentinelAlertPolicySchema,t as sentinelContractVersion,C as sentinelDeliveryReceiptSchema,w as sentinelDiagnosticSchema,D as sentinelEnvironmentBindingSchema,c as sentinelEventIdSchema,u as sentinelEvidenceSchema,R as sentinelHealthComponentSchema,L as sentinelHealthFailureSchema,I as sentinelHealthMetricFactSchema,H as sentinelHealthReportAnySchema,ie as sentinelHealthReportAnySignatureInput,J as sentinelHealthReportAuthenticationSchema,ae as sentinelHealthReportIngestResultSchema,n as sentinelHealthReportMaximumBytes,i as sentinelHealthReportMaximumCapabilities,r as sentinelHealthReportMaximumComponents,$ as sentinelHealthReportRejectionCodeSchema,z as sentinelHealthReportSchema,Z as sentinelHealthReportSignatureInput,re as sentinelHealthReportSubmissionAnySchema,Y as sentinelHealthReportSubmissionSchema,X as sentinelHealthReportSubmissionV2Schema,V as sentinelHealthReportV2Schema,Q as sentinelHealthReportV2SignatureInput,K as sentinelHealthRuntimeStatusSchema,_ as sentinelIncidentEventSchema,A as sentinelPolicyActionSchema,O as sentinelProjectManifestSchema,b as sentinelQueueEventIdentityInput,y as sentinelQueueEventSchema,te as sentinelQueueMetricsSchema,x as sentinelReceiverFailureCodeSchema,S as sentinelReceiverStateSchema,P as sentinelRegistrationCommandSchema,N as sentinelRegistrationSchema,j as sentinelRuleSchema,d as sentinelRunbookSchema,B as sentinelRuntimeCapabilityObservationSchema,T as sentinelRuntimeStatusSchema,q as sentinelStatusResponseSchema,v as sentinelTestEventSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@closerepo/sentinel-contracts",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {