@closerepo/sentinel-contracts 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1005 @@
1
+ import { z } from "zod";
2
+ //#region src/index.d.ts
3
+ declare const sentinelContractVersion: 1;
4
+ declare const sentinelHealthReportMaximumBytes: number;
5
+ declare const sentinelHealthReportMaximumComponents = 64;
6
+ declare const sentinelEventIdSchema: z.ZodUUID;
7
+ declare const sentinelEvidenceSchema: z.ZodObject<{
8
+ label: z.ZodEnum<{
9
+ "Observed value": "Observed value";
10
+ "Warning threshold": "Warning threshold";
11
+ "Critical threshold": "Critical threshold";
12
+ }>;
13
+ value: z.ZodNumber;
14
+ }, z.core.$strict>;
15
+ declare const sentinelRunbookSchema: z.ZodObject<{
16
+ label: z.ZodString;
17
+ url: z.ZodURL;
18
+ }, z.core.$strict>;
19
+ declare const sentinelActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
20
+ type: z.ZodLiteral<"none">;
21
+ }, z.core.$strict>, z.ZodObject<{
22
+ type: z.ZodLiteral<"live_command">;
23
+ command: z.ZodString;
24
+ }, z.core.$strict>, z.ZodObject<{
25
+ type: z.ZodLiteral<"test_preview">;
26
+ summary: z.ZodString;
27
+ }, z.core.$strict>], "type">;
28
+ declare const sentinelIncidentEventSchema: z.ZodObject<{
29
+ contractVersion: z.ZodLiteral<1>;
30
+ projectId: z.ZodString;
31
+ environment: z.ZodString;
32
+ incidentId: z.ZodUUID;
33
+ eventId: z.ZodUUID;
34
+ kind: z.ZodEnum<{
35
+ firing: "firing";
36
+ reminder: "reminder";
37
+ resolved: "resolved";
38
+ }>;
39
+ severity: z.ZodEnum<{
40
+ warning: "warning";
41
+ critical: "critical";
42
+ }>;
43
+ signalClass: z.ZodEnum<{
44
+ attack: "attack";
45
+ service: "service";
46
+ }>;
47
+ signal: z.ZodString;
48
+ title: z.ZodString;
49
+ occurredAt: z.ZodISODateTime;
50
+ evidence: z.ZodArray<z.ZodObject<{
51
+ label: z.ZodEnum<{
52
+ "Observed value": "Observed value";
53
+ "Warning threshold": "Warning threshold";
54
+ "Critical threshold": "Critical threshold";
55
+ }>;
56
+ value: z.ZodNumber;
57
+ }, z.core.$strict>>;
58
+ runbook: z.ZodObject<{
59
+ label: z.ZodString;
60
+ url: z.ZodURL;
61
+ }, z.core.$strict>;
62
+ statusCommand: z.ZodString;
63
+ receiverKeys: z.ZodArray<z.ZodString>;
64
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
65
+ type: z.ZodLiteral<"none">;
66
+ }, z.core.$strict>, z.ZodObject<{
67
+ type: z.ZodLiteral<"live_command">;
68
+ command: z.ZodString;
69
+ }, z.core.$strict>, z.ZodObject<{
70
+ type: z.ZodLiteral<"test_preview">;
71
+ summary: z.ZodString;
72
+ }, z.core.$strict>], "type">;
73
+ mode: z.ZodLiteral<"live">;
74
+ }, z.core.$strict>;
75
+ declare const sentinelTestEventSchema: z.ZodObject<{
76
+ contractVersion: z.ZodLiteral<1>;
77
+ projectId: z.ZodString;
78
+ environment: z.ZodString;
79
+ incidentId: z.ZodUUID;
80
+ eventId: z.ZodUUID;
81
+ kind: z.ZodEnum<{
82
+ firing: "firing";
83
+ reminder: "reminder";
84
+ resolved: "resolved";
85
+ }>;
86
+ severity: z.ZodEnum<{
87
+ warning: "warning";
88
+ critical: "critical";
89
+ }>;
90
+ signalClass: z.ZodEnum<{
91
+ attack: "attack";
92
+ service: "service";
93
+ }>;
94
+ signal: z.ZodString;
95
+ title: z.ZodString;
96
+ occurredAt: z.ZodISODateTime;
97
+ evidence: z.ZodArray<z.ZodObject<{
98
+ label: z.ZodEnum<{
99
+ "Observed value": "Observed value";
100
+ "Warning threshold": "Warning threshold";
101
+ "Critical threshold": "Critical threshold";
102
+ }>;
103
+ value: z.ZodNumber;
104
+ }, z.core.$strict>>;
105
+ runbook: z.ZodObject<{
106
+ label: z.ZodString;
107
+ url: z.ZodURL;
108
+ }, z.core.$strict>;
109
+ statusCommand: z.ZodString;
110
+ receiverKeys: z.ZodArray<z.ZodString>;
111
+ mode: z.ZodLiteral<"test">;
112
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
+ type: z.ZodLiteral<"none">;
114
+ }, z.core.$strict>, z.ZodObject<{
115
+ type: z.ZodLiteral<"test_preview">;
116
+ summary: z.ZodString;
117
+ }, z.core.$strict>], "type">;
118
+ }, z.core.$strict>;
119
+ declare const sentinelQueueEventSchema: z.ZodUnion<readonly [z.ZodObject<{
120
+ contractVersion: z.ZodLiteral<1>;
121
+ projectId: z.ZodString;
122
+ environment: z.ZodString;
123
+ incidentId: z.ZodUUID;
124
+ eventId: z.ZodUUID;
125
+ kind: z.ZodEnum<{
126
+ firing: "firing";
127
+ reminder: "reminder";
128
+ resolved: "resolved";
129
+ }>;
130
+ severity: z.ZodEnum<{
131
+ warning: "warning";
132
+ critical: "critical";
133
+ }>;
134
+ signalClass: z.ZodEnum<{
135
+ attack: "attack";
136
+ service: "service";
137
+ }>;
138
+ signal: z.ZodString;
139
+ title: z.ZodString;
140
+ occurredAt: z.ZodISODateTime;
141
+ evidence: z.ZodArray<z.ZodObject<{
142
+ label: z.ZodEnum<{
143
+ "Observed value": "Observed value";
144
+ "Warning threshold": "Warning threshold";
145
+ "Critical threshold": "Critical threshold";
146
+ }>;
147
+ value: z.ZodNumber;
148
+ }, z.core.$strict>>;
149
+ runbook: z.ZodObject<{
150
+ label: z.ZodString;
151
+ url: z.ZodURL;
152
+ }, z.core.$strict>;
153
+ statusCommand: z.ZodString;
154
+ receiverKeys: z.ZodArray<z.ZodString>;
155
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
156
+ type: z.ZodLiteral<"none">;
157
+ }, z.core.$strict>, z.ZodObject<{
158
+ type: z.ZodLiteral<"live_command">;
159
+ command: z.ZodString;
160
+ }, z.core.$strict>, z.ZodObject<{
161
+ type: z.ZodLiteral<"test_preview">;
162
+ summary: z.ZodString;
163
+ }, z.core.$strict>], "type">;
164
+ mode: z.ZodLiteral<"live">;
165
+ }, z.core.$strict>, z.ZodObject<{
166
+ contractVersion: z.ZodLiteral<1>;
167
+ projectId: z.ZodString;
168
+ environment: z.ZodString;
169
+ incidentId: z.ZodUUID;
170
+ eventId: z.ZodUUID;
171
+ kind: z.ZodEnum<{
172
+ firing: "firing";
173
+ reminder: "reminder";
174
+ resolved: "resolved";
175
+ }>;
176
+ severity: z.ZodEnum<{
177
+ warning: "warning";
178
+ critical: "critical";
179
+ }>;
180
+ signalClass: z.ZodEnum<{
181
+ attack: "attack";
182
+ service: "service";
183
+ }>;
184
+ signal: z.ZodString;
185
+ title: z.ZodString;
186
+ occurredAt: z.ZodISODateTime;
187
+ evidence: z.ZodArray<z.ZodObject<{
188
+ label: z.ZodEnum<{
189
+ "Observed value": "Observed value";
190
+ "Warning threshold": "Warning threshold";
191
+ "Critical threshold": "Critical threshold";
192
+ }>;
193
+ value: z.ZodNumber;
194
+ }, z.core.$strict>>;
195
+ runbook: z.ZodObject<{
196
+ label: z.ZodString;
197
+ url: z.ZodURL;
198
+ }, z.core.$strict>;
199
+ statusCommand: z.ZodString;
200
+ receiverKeys: z.ZodArray<z.ZodString>;
201
+ mode: z.ZodLiteral<"test">;
202
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
203
+ type: z.ZodLiteral<"none">;
204
+ }, z.core.$strict>, z.ZodObject<{
205
+ type: z.ZodLiteral<"test_preview">;
206
+ summary: z.ZodString;
207
+ }, z.core.$strict>], "type">;
208
+ }, z.core.$strict>]>;
209
+ declare function sentinelQueueEventIdentityInput(event: SentinelQueueEvent): string;
210
+ declare const sentinelReceiverFailureCodeSchema: z.ZodEnum<{
211
+ delivery_interrupted: "delivery_interrupted";
212
+ provider_rejected: "provider_rejected";
213
+ provider_timeout: "provider_timeout";
214
+ provider_unavailable: "provider_unavailable";
215
+ receiver_missing: "receiver_missing";
216
+ synthetic_retry: "synthetic_retry";
217
+ }>;
218
+ declare const sentinelReceiverStateSchema: z.ZodObject<{
219
+ receiverKey: z.ZodString;
220
+ state: z.ZodEnum<{
221
+ pending: "pending";
222
+ delivering: "delivering";
223
+ delivered: "delivered";
224
+ failed: "failed";
225
+ }>;
226
+ attempts: z.ZodNumber;
227
+ failureCode: z.ZodNullable<z.ZodEnum<{
228
+ delivery_interrupted: "delivery_interrupted";
229
+ provider_rejected: "provider_rejected";
230
+ provider_timeout: "provider_timeout";
231
+ provider_unavailable: "provider_unavailable";
232
+ receiver_missing: "receiver_missing";
233
+ synthetic_retry: "synthetic_retry";
234
+ }>>;
235
+ leaseExpiresAt: z.ZodNullable<z.ZodISODateTime>;
236
+ lastAttemptAt: z.ZodNullable<z.ZodISODateTime>;
237
+ }, z.core.$strict>;
238
+ declare const sentinelDeliveryReceiptSchema: z.ZodObject<{
239
+ contractVersion: z.ZodLiteral<1>;
240
+ projectId: z.ZodString;
241
+ environment: z.ZodString;
242
+ eventId: z.ZodUUID;
243
+ state: z.ZodEnum<{
244
+ pending: "pending";
245
+ delivered: "delivered";
246
+ failed: "failed";
247
+ retrying: "retrying";
248
+ partial: "partial";
249
+ unavailable: "unavailable";
250
+ }>;
251
+ reason: z.ZodEnum<{
252
+ in_progress: "in_progress";
253
+ partial_delivery: "partial_delivery";
254
+ complete: "complete";
255
+ retry_exhausted: "retry_exhausted";
256
+ receipt_unavailable: "receipt_unavailable";
257
+ }>;
258
+ receivers: z.ZodArray<z.ZodObject<{
259
+ receiverKey: z.ZodString;
260
+ state: z.ZodEnum<{
261
+ pending: "pending";
262
+ delivering: "delivering";
263
+ delivered: "delivered";
264
+ failed: "failed";
265
+ }>;
266
+ attempts: z.ZodNumber;
267
+ failureCode: z.ZodNullable<z.ZodEnum<{
268
+ delivery_interrupted: "delivery_interrupted";
269
+ provider_rejected: "provider_rejected";
270
+ provider_timeout: "provider_timeout";
271
+ provider_unavailable: "provider_unavailable";
272
+ receiver_missing: "receiver_missing";
273
+ synthetic_retry: "synthetic_retry";
274
+ }>>;
275
+ leaseExpiresAt: z.ZodNullable<z.ZodISODateTime>;
276
+ lastAttemptAt: z.ZodNullable<z.ZodISODateTime>;
277
+ }, z.core.$strict>>;
278
+ updatedAt: z.ZodISODateTime;
279
+ }, z.core.$strict>;
280
+ declare const sentinelDiagnosticSchema: z.ZodObject<{
281
+ code: z.ZodString;
282
+ state: z.ZodEnum<{
283
+ unknown: "unknown";
284
+ warning: "warning";
285
+ failed: "failed";
286
+ degraded: "degraded";
287
+ }>;
288
+ summary: z.ZodString;
289
+ suggestedCommand: z.ZodOptional<z.ZodString>;
290
+ }, z.core.$strict>;
291
+ declare const sentinelRuntimeStatusSchema: z.ZodObject<{
292
+ contractVersion: z.ZodLiteral<1>;
293
+ projectId: z.ZodString;
294
+ environment: z.ZodString;
295
+ registration: z.ZodObject<{
296
+ enabled: z.ZodBoolean;
297
+ mode: z.ZodEnum<{
298
+ live: "live";
299
+ disabled: "disabled";
300
+ shadow: "shadow";
301
+ }>;
302
+ policyDigest: z.ZodString;
303
+ projectionDigest: z.ZodString;
304
+ projectedAt: z.ZodISODateTime;
305
+ sourceRevision: z.ZodString;
306
+ }, z.core.$strict>;
307
+ rules: z.ZodArray<z.ZodObject<{
308
+ id: z.ZodString;
309
+ semanticDigest: z.ZodString;
310
+ enabled: z.ZodBoolean;
311
+ state: z.ZodEnum<{
312
+ unknown: "unknown";
313
+ firing: "firing";
314
+ closed: "closed";
315
+ idle: "idle";
316
+ }>;
317
+ severity: z.ZodNullable<z.ZodEnum<{
318
+ warning: "warning";
319
+ critical: "critical";
320
+ }>>;
321
+ incidentId: z.ZodNullable<z.ZodUUID>;
322
+ lastEvaluatedAt: z.ZodNullable<z.ZodISODateTime>;
323
+ lastEventId: z.ZodNullable<z.ZodUUID>;
324
+ }, z.core.$strict>>;
325
+ deliveries: z.ZodArray<z.ZodObject<{
326
+ contractVersion: z.ZodLiteral<1>;
327
+ projectId: z.ZodString;
328
+ environment: z.ZodString;
329
+ eventId: z.ZodUUID;
330
+ state: z.ZodEnum<{
331
+ pending: "pending";
332
+ delivered: "delivered";
333
+ failed: "failed";
334
+ retrying: "retrying";
335
+ partial: "partial";
336
+ unavailable: "unavailable";
337
+ }>;
338
+ reason: z.ZodEnum<{
339
+ in_progress: "in_progress";
340
+ partial_delivery: "partial_delivery";
341
+ complete: "complete";
342
+ retry_exhausted: "retry_exhausted";
343
+ receipt_unavailable: "receipt_unavailable";
344
+ }>;
345
+ receivers: z.ZodArray<z.ZodObject<{
346
+ receiverKey: z.ZodString;
347
+ state: z.ZodEnum<{
348
+ pending: "pending";
349
+ delivering: "delivering";
350
+ delivered: "delivered";
351
+ failed: "failed";
352
+ }>;
353
+ attempts: z.ZodNumber;
354
+ failureCode: z.ZodNullable<z.ZodEnum<{
355
+ delivery_interrupted: "delivery_interrupted";
356
+ provider_rejected: "provider_rejected";
357
+ provider_timeout: "provider_timeout";
358
+ provider_unavailable: "provider_unavailable";
359
+ receiver_missing: "receiver_missing";
360
+ synthetic_retry: "synthetic_retry";
361
+ }>>;
362
+ leaseExpiresAt: z.ZodNullable<z.ZodISODateTime>;
363
+ lastAttemptAt: z.ZodNullable<z.ZodISODateTime>;
364
+ }, z.core.$strict>>;
365
+ updatedAt: z.ZodISODateTime;
366
+ }, z.core.$strict>>;
367
+ heartbeat: z.ZodObject<{
368
+ state: z.ZodEnum<{
369
+ unavailable: "unavailable";
370
+ healthy: "healthy";
371
+ stale: "stale";
372
+ }>;
373
+ lastCompletedAt: z.ZodNullable<z.ZodISODateTime>;
374
+ }, z.core.$strict>;
375
+ diagnostics: z.ZodArray<z.ZodObject<{
376
+ code: z.ZodString;
377
+ state: z.ZodEnum<{
378
+ unknown: "unknown";
379
+ warning: "warning";
380
+ failed: "failed";
381
+ degraded: "degraded";
382
+ }>;
383
+ summary: z.ZodString;
384
+ suggestedCommand: z.ZodOptional<z.ZodString>;
385
+ }, z.core.$strict>>;
386
+ }, z.core.$strict>;
387
+ declare const sentinelQueueMetricsSchema: z.ZodObject<{
388
+ state: z.ZodEnum<{
389
+ unavailable: "unavailable";
390
+ available: "available";
391
+ }>;
392
+ backlogCount: z.ZodNullable<z.ZodNumber>;
393
+ backlogBytes: z.ZodNullable<z.ZodNumber>;
394
+ oldestMessageAt: z.ZodNullable<z.ZodISODateTime>;
395
+ retentionSeconds: z.ZodNullable<z.ZodNumber>;
396
+ }, z.core.$strict>;
397
+ declare const sentinelEnvironmentBindingSchema: z.ZodObject<{
398
+ mode: z.ZodEnum<{
399
+ live: "live";
400
+ disabled: "disabled";
401
+ shadow: "shadow";
402
+ }>;
403
+ statusUrlEnv: z.ZodString;
404
+ statusHmacSecretEnv: z.ZodString;
405
+ healthReportHmacSecretEnv: z.ZodOptional<z.ZodString>;
406
+ opsAccountIdEnv: z.ZodString;
407
+ provisionApiTokenEnv: z.ZodString;
408
+ statusApiTokenEnv: z.ZodString;
409
+ analyticsAccountIdEnv: z.ZodString;
410
+ analyticsApiTokenEnv: z.ZodString;
411
+ analyticsDataset: z.ZodString;
412
+ workerName: z.ZodString;
413
+ queueName: z.ZodString;
414
+ dlqName: z.ZodString;
415
+ registrationQueueName: z.ZodString;
416
+ registrationDlqName: z.ZodString;
417
+ notificationWorkerName: z.ZodString;
418
+ healthchecksProvisionApiKeyEnv: z.ZodOptional<z.ZodString>;
419
+ healthchecksPingUrlEnv: z.ZodOptional<z.ZodString>;
420
+ healthchecksStatusApiKeyEnv: z.ZodOptional<z.ZodString>;
421
+ }, z.core.$strict>;
422
+ declare const sentinelProjectManifestSchema: z.ZodObject<{
423
+ contractVersion: z.ZodLiteral<1>;
424
+ projectId: z.ZodString;
425
+ policy: z.ZodString;
426
+ environments: z.ZodRecord<z.ZodString, z.ZodObject<{
427
+ mode: z.ZodEnum<{
428
+ live: "live";
429
+ disabled: "disabled";
430
+ shadow: "shadow";
431
+ }>;
432
+ statusUrlEnv: z.ZodString;
433
+ statusHmacSecretEnv: z.ZodString;
434
+ healthReportHmacSecretEnv: z.ZodOptional<z.ZodString>;
435
+ opsAccountIdEnv: z.ZodString;
436
+ provisionApiTokenEnv: z.ZodString;
437
+ statusApiTokenEnv: z.ZodString;
438
+ analyticsAccountIdEnv: z.ZodString;
439
+ analyticsApiTokenEnv: z.ZodString;
440
+ analyticsDataset: z.ZodString;
441
+ workerName: z.ZodString;
442
+ queueName: z.ZodString;
443
+ dlqName: z.ZodString;
444
+ registrationQueueName: z.ZodString;
445
+ registrationDlqName: z.ZodString;
446
+ notificationWorkerName: z.ZodString;
447
+ healthchecksProvisionApiKeyEnv: z.ZodOptional<z.ZodString>;
448
+ healthchecksPingUrlEnv: z.ZodOptional<z.ZodString>;
449
+ healthchecksStatusApiKeyEnv: z.ZodOptional<z.ZodString>;
450
+ }, z.core.$strict>>;
451
+ }, z.core.$strict>;
452
+ declare const sentinelPolicyActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
453
+ type: z.ZodLiteral<"none">;
454
+ }, z.core.$strict>, z.ZodObject<{
455
+ type: z.ZodLiteral<"abuse">;
456
+ project: z.ZodString;
457
+ target: z.ZodString;
458
+ action: z.ZodString;
459
+ layer: z.ZodString;
460
+ ttl: z.ZodOptional<z.ZodString>;
461
+ }, z.core.$strict>], "type">;
462
+ declare const sentinelRuleSchema: z.ZodObject<{
463
+ id: z.ZodString;
464
+ enabled: z.ZodBoolean;
465
+ signalClass: z.ZodEnum<{
466
+ attack: "attack";
467
+ service: "service";
468
+ }>;
469
+ signal: z.ZodObject<{
470
+ type: z.ZodEnum<{
471
+ operation_count: "operation_count";
472
+ worker_error_ratio: "worker_error_ratio";
473
+ edge_security_spike: "edge_security_spike";
474
+ provider_health: "provider_health";
475
+ }>;
476
+ operation: z.ZodOptional<z.ZodString>;
477
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
478
+ outcomes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
479
+ failed: "failed";
480
+ committed: "committed";
481
+ accepted_noop: "accepted_noop";
482
+ rejected: "rejected";
483
+ }>>>;
484
+ minimumSample: z.ZodOptional<z.ZodNumber>;
485
+ }, z.core.$strict>;
486
+ windowMinutes: z.ZodNumber;
487
+ thresholds: z.ZodObject<{
488
+ warning: z.ZodNumber;
489
+ critical: z.ZodNumber;
490
+ }, z.core.$strict>;
491
+ recovery: z.ZodObject<{
492
+ healthyEvaluations: z.ZodNumber;
493
+ }, z.core.$strict>;
494
+ reminders: z.ZodObject<{
495
+ warningMinutes: z.ZodNumber;
496
+ criticalMinutes: z.ZodNumber;
497
+ }, z.core.$strict>;
498
+ runbook: z.ZodObject<{
499
+ label: z.ZodString;
500
+ url: z.ZodURL;
501
+ }, z.core.$strict>;
502
+ receiverKeys: z.ZodArray<z.ZodString>;
503
+ actions: z.ZodObject<{
504
+ warning: z.ZodDiscriminatedUnion<[z.ZodObject<{
505
+ type: z.ZodLiteral<"none">;
506
+ }, z.core.$strict>, z.ZodObject<{
507
+ type: z.ZodLiteral<"abuse">;
508
+ project: z.ZodString;
509
+ target: z.ZodString;
510
+ action: z.ZodString;
511
+ layer: z.ZodString;
512
+ ttl: z.ZodOptional<z.ZodString>;
513
+ }, z.core.$strict>], "type">;
514
+ critical: z.ZodDiscriminatedUnion<[z.ZodObject<{
515
+ type: z.ZodLiteral<"none">;
516
+ }, z.core.$strict>, z.ZodObject<{
517
+ type: z.ZodLiteral<"abuse">;
518
+ project: z.ZodString;
519
+ target: z.ZodString;
520
+ action: z.ZodString;
521
+ layer: z.ZodString;
522
+ ttl: z.ZodOptional<z.ZodString>;
523
+ }, z.core.$strict>], "type">;
524
+ }, z.core.$strict>;
525
+ }, z.core.$strict>;
526
+ declare const sentinelAlertPolicySchema: z.ZodObject<{
527
+ contractVersion: z.ZodLiteral<1>;
528
+ evaluationMinutes: z.ZodNumber;
529
+ rules: z.ZodArray<z.ZodObject<{
530
+ id: z.ZodString;
531
+ enabled: z.ZodBoolean;
532
+ signalClass: z.ZodEnum<{
533
+ attack: "attack";
534
+ service: "service";
535
+ }>;
536
+ signal: z.ZodObject<{
537
+ type: z.ZodEnum<{
538
+ operation_count: "operation_count";
539
+ worker_error_ratio: "worker_error_ratio";
540
+ edge_security_spike: "edge_security_spike";
541
+ provider_health: "provider_health";
542
+ }>;
543
+ operation: z.ZodOptional<z.ZodString>;
544
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
545
+ outcomes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
546
+ failed: "failed";
547
+ committed: "committed";
548
+ accepted_noop: "accepted_noop";
549
+ rejected: "rejected";
550
+ }>>>;
551
+ minimumSample: z.ZodOptional<z.ZodNumber>;
552
+ }, z.core.$strict>;
553
+ windowMinutes: z.ZodNumber;
554
+ thresholds: z.ZodObject<{
555
+ warning: z.ZodNumber;
556
+ critical: z.ZodNumber;
557
+ }, z.core.$strict>;
558
+ recovery: z.ZodObject<{
559
+ healthyEvaluations: z.ZodNumber;
560
+ }, z.core.$strict>;
561
+ reminders: z.ZodObject<{
562
+ warningMinutes: z.ZodNumber;
563
+ criticalMinutes: z.ZodNumber;
564
+ }, z.core.$strict>;
565
+ runbook: z.ZodObject<{
566
+ label: z.ZodString;
567
+ url: z.ZodURL;
568
+ }, z.core.$strict>;
569
+ receiverKeys: z.ZodArray<z.ZodString>;
570
+ actions: z.ZodObject<{
571
+ warning: z.ZodDiscriminatedUnion<[z.ZodObject<{
572
+ type: z.ZodLiteral<"none">;
573
+ }, z.core.$strict>, z.ZodObject<{
574
+ type: z.ZodLiteral<"abuse">;
575
+ project: z.ZodString;
576
+ target: z.ZodString;
577
+ action: z.ZodString;
578
+ layer: z.ZodString;
579
+ ttl: z.ZodOptional<z.ZodString>;
580
+ }, z.core.$strict>], "type">;
581
+ critical: z.ZodDiscriminatedUnion<[z.ZodObject<{
582
+ type: z.ZodLiteral<"none">;
583
+ }, z.core.$strict>, z.ZodObject<{
584
+ type: z.ZodLiteral<"abuse">;
585
+ project: z.ZodString;
586
+ target: z.ZodString;
587
+ action: z.ZodString;
588
+ layer: z.ZodString;
589
+ ttl: z.ZodOptional<z.ZodString>;
590
+ }, z.core.$strict>], "type">;
591
+ }, z.core.$strict>;
592
+ }, z.core.$strict>>;
593
+ }, z.core.$strict>;
594
+ declare const sentinelRegistrationSchema: z.ZodObject<{
595
+ analytics: z.ZodObject<{
596
+ accountIdBinding: z.ZodString;
597
+ dataset: z.ZodString;
598
+ index: z.ZodString;
599
+ tokenBinding: z.ZodString;
600
+ }, z.core.$strict>;
601
+ enabled: z.ZodBoolean;
602
+ environment: z.ZodString;
603
+ mode: z.ZodEnum<{
604
+ live: "live";
605
+ disabled: "disabled";
606
+ shadow: "shadow";
607
+ }>;
608
+ policy: z.ZodObject<{
609
+ contractVersion: z.ZodLiteral<1>;
610
+ evaluationMinutes: z.ZodNumber;
611
+ rules: z.ZodArray<z.ZodObject<{
612
+ id: z.ZodString;
613
+ enabled: z.ZodBoolean;
614
+ signalClass: z.ZodEnum<{
615
+ attack: "attack";
616
+ service: "service";
617
+ }>;
618
+ signal: z.ZodObject<{
619
+ type: z.ZodEnum<{
620
+ operation_count: "operation_count";
621
+ worker_error_ratio: "worker_error_ratio";
622
+ edge_security_spike: "edge_security_spike";
623
+ provider_health: "provider_health";
624
+ }>;
625
+ operation: z.ZodOptional<z.ZodString>;
626
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
627
+ outcomes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
628
+ failed: "failed";
629
+ committed: "committed";
630
+ accepted_noop: "accepted_noop";
631
+ rejected: "rejected";
632
+ }>>>;
633
+ minimumSample: z.ZodOptional<z.ZodNumber>;
634
+ }, z.core.$strict>;
635
+ windowMinutes: z.ZodNumber;
636
+ thresholds: z.ZodObject<{
637
+ warning: z.ZodNumber;
638
+ critical: z.ZodNumber;
639
+ }, z.core.$strict>;
640
+ recovery: z.ZodObject<{
641
+ healthyEvaluations: z.ZodNumber;
642
+ }, z.core.$strict>;
643
+ reminders: z.ZodObject<{
644
+ warningMinutes: z.ZodNumber;
645
+ criticalMinutes: z.ZodNumber;
646
+ }, z.core.$strict>;
647
+ runbook: z.ZodObject<{
648
+ label: z.ZodString;
649
+ url: z.ZodURL;
650
+ }, z.core.$strict>;
651
+ receiverKeys: z.ZodArray<z.ZodString>;
652
+ actions: z.ZodObject<{
653
+ warning: z.ZodDiscriminatedUnion<[z.ZodObject<{
654
+ type: z.ZodLiteral<"none">;
655
+ }, z.core.$strict>, z.ZodObject<{
656
+ type: z.ZodLiteral<"abuse">;
657
+ project: z.ZodString;
658
+ target: z.ZodString;
659
+ action: z.ZodString;
660
+ layer: z.ZodString;
661
+ ttl: z.ZodOptional<z.ZodString>;
662
+ }, z.core.$strict>], "type">;
663
+ critical: z.ZodDiscriminatedUnion<[z.ZodObject<{
664
+ type: z.ZodLiteral<"none">;
665
+ }, z.core.$strict>, z.ZodObject<{
666
+ type: z.ZodLiteral<"abuse">;
667
+ project: z.ZodString;
668
+ target: z.ZodString;
669
+ action: z.ZodString;
670
+ layer: z.ZodString;
671
+ ttl: z.ZodOptional<z.ZodString>;
672
+ }, z.core.$strict>], "type">;
673
+ }, z.core.$strict>;
674
+ }, z.core.$strict>>;
675
+ }, z.core.$strict>;
676
+ policyDigest: z.ZodString;
677
+ projectionDigest: z.ZodString;
678
+ projectId: z.ZodString;
679
+ projectedAt: z.ZodISODateTime;
680
+ sourceRevision: z.ZodString;
681
+ healthReportHmacSecretBinding: z.ZodOptional<z.ZodString>;
682
+ }, z.core.$strict>;
683
+ declare const sentinelRegistrationCommandSchema: z.ZodObject<{
684
+ commandId: z.ZodUUID;
685
+ contractVersion: z.ZodLiteral<1>;
686
+ expectedPreviousDigest: z.ZodNullable<z.ZodString>;
687
+ kind: z.ZodLiteral<"registration_upsert">;
688
+ registration: z.ZodObject<{
689
+ analytics: z.ZodObject<{
690
+ accountIdBinding: z.ZodString;
691
+ dataset: z.ZodString;
692
+ index: z.ZodString;
693
+ tokenBinding: z.ZodString;
694
+ }, z.core.$strict>;
695
+ enabled: z.ZodBoolean;
696
+ environment: z.ZodString;
697
+ mode: z.ZodEnum<{
698
+ live: "live";
699
+ disabled: "disabled";
700
+ shadow: "shadow";
701
+ }>;
702
+ policy: z.ZodObject<{
703
+ contractVersion: z.ZodLiteral<1>;
704
+ evaluationMinutes: z.ZodNumber;
705
+ rules: z.ZodArray<z.ZodObject<{
706
+ id: z.ZodString;
707
+ enabled: z.ZodBoolean;
708
+ signalClass: z.ZodEnum<{
709
+ attack: "attack";
710
+ service: "service";
711
+ }>;
712
+ signal: z.ZodObject<{
713
+ type: z.ZodEnum<{
714
+ operation_count: "operation_count";
715
+ worker_error_ratio: "worker_error_ratio";
716
+ edge_security_spike: "edge_security_spike";
717
+ provider_health: "provider_health";
718
+ }>;
719
+ operation: z.ZodOptional<z.ZodString>;
720
+ operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
721
+ outcomes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
722
+ failed: "failed";
723
+ committed: "committed";
724
+ accepted_noop: "accepted_noop";
725
+ rejected: "rejected";
726
+ }>>>;
727
+ minimumSample: z.ZodOptional<z.ZodNumber>;
728
+ }, z.core.$strict>;
729
+ windowMinutes: z.ZodNumber;
730
+ thresholds: z.ZodObject<{
731
+ warning: z.ZodNumber;
732
+ critical: z.ZodNumber;
733
+ }, z.core.$strict>;
734
+ recovery: z.ZodObject<{
735
+ healthyEvaluations: z.ZodNumber;
736
+ }, z.core.$strict>;
737
+ reminders: z.ZodObject<{
738
+ warningMinutes: z.ZodNumber;
739
+ criticalMinutes: z.ZodNumber;
740
+ }, z.core.$strict>;
741
+ runbook: z.ZodObject<{
742
+ label: z.ZodString;
743
+ url: z.ZodURL;
744
+ }, z.core.$strict>;
745
+ receiverKeys: z.ZodArray<z.ZodString>;
746
+ actions: z.ZodObject<{
747
+ warning: z.ZodDiscriminatedUnion<[z.ZodObject<{
748
+ type: z.ZodLiteral<"none">;
749
+ }, z.core.$strict>, z.ZodObject<{
750
+ type: z.ZodLiteral<"abuse">;
751
+ project: z.ZodString;
752
+ target: z.ZodString;
753
+ action: z.ZodString;
754
+ layer: z.ZodString;
755
+ ttl: z.ZodOptional<z.ZodString>;
756
+ }, z.core.$strict>], "type">;
757
+ critical: z.ZodDiscriminatedUnion<[z.ZodObject<{
758
+ type: z.ZodLiteral<"none">;
759
+ }, z.core.$strict>, z.ZodObject<{
760
+ type: z.ZodLiteral<"abuse">;
761
+ project: z.ZodString;
762
+ target: z.ZodString;
763
+ action: z.ZodString;
764
+ layer: z.ZodString;
765
+ ttl: z.ZodOptional<z.ZodString>;
766
+ }, z.core.$strict>], "type">;
767
+ }, z.core.$strict>;
768
+ }, z.core.$strict>>;
769
+ }, z.core.$strict>;
770
+ policyDigest: z.ZodString;
771
+ projectionDigest: z.ZodString;
772
+ projectId: z.ZodString;
773
+ projectedAt: z.ZodISODateTime;
774
+ sourceRevision: z.ZodString;
775
+ healthReportHmacSecretBinding: z.ZodOptional<z.ZodString>;
776
+ }, z.core.$strict>;
777
+ }, z.core.$strict>;
778
+ declare const sentinelHealthMetricFactSchema: z.ZodObject<{
779
+ key: z.ZodString;
780
+ value: z.ZodNumber;
781
+ unit: z.ZodOptional<z.ZodEnum<{
782
+ bytes: "bytes";
783
+ count: "count";
784
+ milliseconds: "milliseconds";
785
+ percent: "percent";
786
+ ratio: "ratio";
787
+ }>>;
788
+ }, z.core.$strict>;
789
+ declare const sentinelHealthFailureSchema: z.ZodObject<{
790
+ episodeId: z.ZodUUID;
791
+ attempt: z.ZodNumber;
792
+ terminal: z.ZodBoolean;
793
+ operation: z.ZodString;
794
+ stage: z.ZodString;
795
+ code: z.ZodString;
796
+ summary: z.ZodString;
797
+ correlationId: z.ZodOptional<z.ZodString>;
798
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
799
+ upstreamCode: z.ZodOptional<z.ZodString>;
800
+ }, z.core.$strict>;
801
+ declare const sentinelHealthComponentSchema: z.ZodObject<{
802
+ componentKey: z.ZodString;
803
+ componentClass: z.ZodString;
804
+ state: z.ZodEnum<{
805
+ unknown: "unknown";
806
+ failed: "failed";
807
+ unavailable: "unavailable";
808
+ degraded: "degraded";
809
+ healthy: "healthy";
810
+ }>;
811
+ lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
812
+ facts: z.ZodArray<z.ZodObject<{
813
+ key: z.ZodString;
814
+ value: z.ZodNumber;
815
+ unit: z.ZodOptional<z.ZodEnum<{
816
+ bytes: "bytes";
817
+ count: "count";
818
+ milliseconds: "milliseconds";
819
+ percent: "percent";
820
+ ratio: "ratio";
821
+ }>>;
822
+ }, z.core.$strict>>;
823
+ failure: z.ZodNullable<z.ZodObject<{
824
+ episodeId: z.ZodUUID;
825
+ attempt: z.ZodNumber;
826
+ terminal: z.ZodBoolean;
827
+ operation: z.ZodString;
828
+ stage: z.ZodString;
829
+ code: z.ZodString;
830
+ summary: z.ZodString;
831
+ correlationId: z.ZodOptional<z.ZodString>;
832
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
833
+ upstreamCode: z.ZodOptional<z.ZodString>;
834
+ }, z.core.$strict>>;
835
+ }, z.core.$strict>;
836
+ declare const sentinelHealthReportSchema: z.ZodObject<{
837
+ contractVersion: z.ZodLiteral<1>;
838
+ projectId: z.ZodString;
839
+ environment: z.ZodString;
840
+ runtimeInstanceId: z.ZodString;
841
+ reportId: z.ZodUUID;
842
+ sequence: z.ZodNumber;
843
+ observedAt: z.ZodISODateTime;
844
+ components: z.ZodArray<z.ZodObject<{
845
+ componentKey: z.ZodString;
846
+ componentClass: z.ZodString;
847
+ state: z.ZodEnum<{
848
+ unknown: "unknown";
849
+ failed: "failed";
850
+ unavailable: "unavailable";
851
+ degraded: "degraded";
852
+ healthy: "healthy";
853
+ }>;
854
+ lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
855
+ facts: z.ZodArray<z.ZodObject<{
856
+ key: z.ZodString;
857
+ value: z.ZodNumber;
858
+ unit: z.ZodOptional<z.ZodEnum<{
859
+ bytes: "bytes";
860
+ count: "count";
861
+ milliseconds: "milliseconds";
862
+ percent: "percent";
863
+ ratio: "ratio";
864
+ }>>;
865
+ }, z.core.$strict>>;
866
+ failure: z.ZodNullable<z.ZodObject<{
867
+ episodeId: z.ZodUUID;
868
+ attempt: z.ZodNumber;
869
+ terminal: z.ZodBoolean;
870
+ operation: z.ZodString;
871
+ stage: z.ZodString;
872
+ code: z.ZodString;
873
+ summary: z.ZodString;
874
+ correlationId: z.ZodOptional<z.ZodString>;
875
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
876
+ upstreamCode: z.ZodOptional<z.ZodString>;
877
+ }, z.core.$strict>>;
878
+ }, z.core.$strict>>;
879
+ }, z.core.$strict>;
880
+ declare const sentinelHealthReportAuthenticationSchema: z.ZodObject<{
881
+ timestamp: z.ZodISODateTime;
882
+ nonce: z.ZodUUID;
883
+ signature: z.ZodString;
884
+ }, z.core.$strict>;
885
+ declare const sentinelHealthReportSubmissionSchema: z.ZodObject<{
886
+ contractVersion: z.ZodLiteral<1>;
887
+ report: z.ZodObject<{
888
+ contractVersion: z.ZodLiteral<1>;
889
+ projectId: z.ZodString;
890
+ environment: z.ZodString;
891
+ runtimeInstanceId: z.ZodString;
892
+ reportId: z.ZodUUID;
893
+ sequence: z.ZodNumber;
894
+ observedAt: z.ZodISODateTime;
895
+ components: z.ZodArray<z.ZodObject<{
896
+ componentKey: z.ZodString;
897
+ componentClass: z.ZodString;
898
+ state: z.ZodEnum<{
899
+ unknown: "unknown";
900
+ failed: "failed";
901
+ unavailable: "unavailable";
902
+ degraded: "degraded";
903
+ healthy: "healthy";
904
+ }>;
905
+ lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
906
+ facts: z.ZodArray<z.ZodObject<{
907
+ key: z.ZodString;
908
+ value: z.ZodNumber;
909
+ unit: z.ZodOptional<z.ZodEnum<{
910
+ bytes: "bytes";
911
+ count: "count";
912
+ milliseconds: "milliseconds";
913
+ percent: "percent";
914
+ ratio: "ratio";
915
+ }>>;
916
+ }, z.core.$strict>>;
917
+ failure: z.ZodNullable<z.ZodObject<{
918
+ episodeId: z.ZodUUID;
919
+ attempt: z.ZodNumber;
920
+ terminal: z.ZodBoolean;
921
+ operation: z.ZodString;
922
+ stage: z.ZodString;
923
+ code: z.ZodString;
924
+ summary: z.ZodString;
925
+ correlationId: z.ZodOptional<z.ZodString>;
926
+ upstreamStatus: z.ZodOptional<z.ZodNumber>;
927
+ upstreamCode: z.ZodOptional<z.ZodString>;
928
+ }, z.core.$strict>>;
929
+ }, z.core.$strict>>;
930
+ }, z.core.$strict>;
931
+ authentication: z.ZodObject<{
932
+ timestamp: z.ZodISODateTime;
933
+ nonce: z.ZodUUID;
934
+ signature: z.ZodString;
935
+ }, z.core.$strict>;
936
+ }, z.core.$strict>;
937
+ declare function sentinelHealthReportSignatureInput(submission: Pick<SentinelHealthReportSubmission, 'contractVersion' | 'report'> & {
938
+ authentication: Pick<SentinelHealthReportAuthentication, 'timestamp' | 'nonce'>;
939
+ }): string;
940
+ declare const sentinelHealthReportRejectionCodeSchema: z.ZodEnum<{
941
+ authentication_failed: "authentication_failed";
942
+ identity_not_registered: "identity_not_registered";
943
+ nonce_replayed: "nonce_replayed";
944
+ report_invalid: "report_invalid";
945
+ runtime_identity_mismatch: "runtime_identity_mismatch";
946
+ sequence_invalid: "sequence_invalid";
947
+ size_exceeded: "size_exceeded";
948
+ timestamp_out_of_range: "timestamp_out_of_range";
949
+ unexpected_failure: "unexpected_failure";
950
+ }>;
951
+ declare const sentinelHealthReportIngestResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
952
+ outcome: z.ZodLiteral<"accepted">;
953
+ acceptedSequence: z.ZodNumber;
954
+ receivedAt: z.ZodISODateTime;
955
+ }, z.core.$strict>, z.ZodObject<{
956
+ outcome: z.ZodLiteral<"duplicate">;
957
+ acceptedSequence: z.ZodNumber;
958
+ receivedAt: z.ZodISODateTime;
959
+ }, z.core.$strict>, z.ZodObject<{
960
+ outcome: z.ZodLiteral<"out_of_order">;
961
+ acceptedSequence: z.ZodNumber;
962
+ receivedAt: z.ZodISODateTime;
963
+ }, z.core.$strict>, z.ZodObject<{
964
+ outcome: z.ZodLiteral<"rejected">;
965
+ rejectionCode: z.ZodEnum<{
966
+ authentication_failed: "authentication_failed";
967
+ identity_not_registered: "identity_not_registered";
968
+ nonce_replayed: "nonce_replayed";
969
+ report_invalid: "report_invalid";
970
+ runtime_identity_mismatch: "runtime_identity_mismatch";
971
+ sequence_invalid: "sequence_invalid";
972
+ size_exceeded: "size_exceeded";
973
+ timestamp_out_of_range: "timestamp_out_of_range";
974
+ unexpected_failure: "unexpected_failure";
975
+ }>;
976
+ summary: z.ZodString;
977
+ }, z.core.$strict>], "outcome">;
978
+ interface SentinelHealthReportServiceV1 {
979
+ reportHealth(submission: SentinelHealthReportSubmission): Promise<SentinelHealthReportIngestResult>;
980
+ }
981
+ type SentinelAction = z.infer<typeof sentinelActionSchema>;
982
+ type SentinelAlertPolicy = z.infer<typeof sentinelAlertPolicySchema>;
983
+ type SentinelDeliveryReceipt = z.infer<typeof sentinelDeliveryReceiptSchema>;
984
+ type SentinelEnvironmentBinding = z.infer<typeof sentinelEnvironmentBindingSchema>;
985
+ type SentinelIncidentEvent = z.infer<typeof sentinelIncidentEventSchema>;
986
+ type SentinelPolicyAction = z.infer<typeof sentinelPolicyActionSchema>;
987
+ type SentinelProjectManifest = z.infer<typeof sentinelProjectManifestSchema>;
988
+ type SentinelQueueEvent = z.infer<typeof sentinelQueueEventSchema>;
989
+ type SentinelQueueMetrics = z.infer<typeof sentinelQueueMetricsSchema>;
990
+ type SentinelReceiverFailureCode = z.infer<typeof sentinelReceiverFailureCodeSchema>;
991
+ type SentinelRegistration = z.infer<typeof sentinelRegistrationSchema>;
992
+ type SentinelRegistrationCommand = z.infer<typeof sentinelRegistrationCommandSchema>;
993
+ type SentinelRule = z.infer<typeof sentinelRuleSchema>;
994
+ type SentinelRuntimeStatus = z.infer<typeof sentinelRuntimeStatusSchema>;
995
+ type SentinelTestEvent = z.infer<typeof sentinelTestEventSchema>;
996
+ type SentinelHealthComponent = z.infer<typeof sentinelHealthComponentSchema>;
997
+ type SentinelHealthFailure = z.infer<typeof sentinelHealthFailureSchema>;
998
+ type SentinelHealthMetricFact = z.infer<typeof sentinelHealthMetricFactSchema>;
999
+ type SentinelHealthReport = z.infer<typeof sentinelHealthReportSchema>;
1000
+ type SentinelHealthReportAuthentication = z.infer<typeof sentinelHealthReportAuthenticationSchema>;
1001
+ type SentinelHealthReportIngestResult = z.infer<typeof sentinelHealthReportIngestResultSchema>;
1002
+ type SentinelHealthReportRejectionCode = z.infer<typeof sentinelHealthReportRejectionCodeSchema>;
1003
+ type SentinelHealthReportSubmission = z.infer<typeof sentinelHealthReportSubmissionSchema>;
1004
+ //#endregion
1005
+ export { SentinelAction, SentinelAlertPolicy, SentinelDeliveryReceipt, SentinelEnvironmentBinding, SentinelHealthComponent, SentinelHealthFailure, SentinelHealthMetricFact, SentinelHealthReport, SentinelHealthReportAuthentication, SentinelHealthReportIngestResult, SentinelHealthReportRejectionCode, SentinelHealthReportServiceV1, SentinelHealthReportSubmission, SentinelIncidentEvent, SentinelPolicyAction, SentinelProjectManifest, SentinelQueueEvent, SentinelQueueMetrics, SentinelReceiverFailureCode, SentinelRegistration, SentinelRegistrationCommand, SentinelRule, SentinelRuntimeStatus, SentinelTestEvent, sentinelActionSchema, sentinelAlertPolicySchema, sentinelContractVersion, sentinelDeliveryReceiptSchema, sentinelDiagnosticSchema, sentinelEnvironmentBindingSchema, sentinelEventIdSchema, sentinelEvidenceSchema, sentinelHealthComponentSchema, sentinelHealthFailureSchema, sentinelHealthMetricFactSchema, sentinelHealthReportAuthenticationSchema, sentinelHealthReportIngestResultSchema, sentinelHealthReportMaximumBytes, sentinelHealthReportMaximumComponents, sentinelHealthReportRejectionCodeSchema, sentinelHealthReportSchema, sentinelHealthReportSignatureInput, sentinelHealthReportSubmissionSchema, sentinelIncidentEventSchema, sentinelPolicyActionSchema, sentinelProjectManifestSchema, sentinelQueueEventIdentityInput, sentinelQueueEventSchema, sentinelQueueMetricsSchema, sentinelReceiverFailureCodeSchema, sentinelReceiverStateSchema, sentinelRegistrationCommandSchema, sentinelRegistrationSchema, sentinelRuleSchema, sentinelRunbookSchema, sentinelRuntimeStatusSchema, sentinelTestEventSchema };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";const t=1,n=32*1024,r=64,i=t=>e.string().trim().min(1).max(t),a=e.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),o=e.string().regex(/^[a-z][A-Za-z0-9_]{0,63}$/),s=e.uuid(),c=s,l=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:i(80),url:l}).strict(),f=e.object({type:e.literal(`none`)}).strict(),p=e.object({type:e.literal(`live_command`),command:i(500).regex(/^abuse apply\b/).refine(e=>e.endsWith(` --apply`),`must end with --apply`)}).strict(),m=e.object({type:e.literal(`test_preview`),summary:i(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:a,environment:a,incidentId:c,eventId:c,kind:e.enum([`firing`,`reminder`,`resolved`]),severity:e.enum([`warning`,`critical`]),signalClass:e.enum([`attack`,`service`]),signal:a,title:i(120),occurredAt:e.iso.datetime(),evidence:e.array(u).max(8),runbook:d,statusCommand:i(300).regex(/^sentinel status\b/),receiverKeys:e.array(a).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:a,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:a,environment:a,eventId:c,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:a,state:e.enum([`degraded`,`failed`,`unknown`,`warning`]),summary:i(300),suggestedCommand:i(500).optional()}).strict(),T=e.object({contractVersion:e.literal(1),projectId:a,environment:a,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:i(160)}).strict(),rules:e.array(e.object({id:a,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:c.nullable(),lastEvaluatedAt:e.iso.datetime().nullable(),lastEventId:c.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(),E=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(),D=e.string().regex(/^[A-Z][A-Z0-9_]{2,127}$/),O=e.string().max(240).regex(/^(?![A-Za-z]:|\/|.*(?:^|\/)\.\.(?:\/|$)).+\.json$/),k=e.object({mode:e.enum([`disabled`,`shadow`,`live`]),statusUrlEnv:D,statusHmacSecretEnv:D,healthReportHmacSecretEnv:D.optional(),opsAccountIdEnv:D,provisionApiTokenEnv:D,statusApiTokenEnv:D,analyticsAccountIdEnv:D,analyticsApiTokenEnv:D,analyticsDataset:a,workerName:a,queueName:a,dlqName:a,registrationQueueName:a,registrationDlqName:a,notificationWorkerName:a,healthchecksProvisionApiKeyEnv:D.optional(),healthchecksPingUrlEnv:D.optional(),healthchecksStatusApiKeyEnv:D.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`]})}),A=e.object({contractVersion:e.literal(1),projectId:a,policy:O,environments:e.record(a,k)}).strict().superRefine((e,t)=>{Object.keys(e.environments).length===0&&t.addIssue({code:`custom`,message:`at least one environment is required`,path:[`environments`]})}),j=e.object({type:e.literal(`abuse`),project:e.string().regex(/^[a-zA-Z0-9._/-]{1,120}$/),target:a,action:a,layer:a,ttl:e.string().regex(/^[1-9][0-9]{0,4}[smhd]$/).optional()}).strict(),M=e.discriminatedUnion(`type`,[f,j]),N=e.object({id:a,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:o.optional(),operations:e.array(o).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(a).min(1).max(16),actions:e.object({warning:M,critical:M}).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`]})}),P=e.object({contractVersion:e.literal(1),evaluationMinutes:e.number().int().min(5).max(60),rules:e.array(N).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)}),F=e.object({analytics:e.object({accountIdBinding:D,dataset:a,index:i(160),tokenBinding:D}).strict(),enabled:e.boolean(),environment:a,mode:e.enum([`disabled`,`shadow`,`live`]),policy:P,policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectId:a,projectedAt:e.iso.datetime(),sourceRevision:i(160),healthReportHmacSecretBinding:D.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`]})}),I=e.object({commandId:c,contractVersion:e.literal(1),expectedPreviousDigest:e.string().regex(/^[a-f0-9]{64}$/).nullable(),kind:e.literal(`registration_upsert`),registration:F}).strict(),L=e.string().trim().min(1).max(160),R=e.object({key:a,value:e.number().finite().nonnegative(),unit:e.enum([`bytes`,`count`,`milliseconds`,`percent`,`ratio`]).optional()}).strict(),z=e.object({episodeId:s,attempt:e.number().int().min(1).max(1e3),terminal:e.boolean(),operation:o,stage:a,code:a,summary:i(300),correlationId:L.optional(),upstreamStatus:e.number().int().min(100).max(599).optional(),upstreamCode:a.optional()}).strict(),B=e.object({componentKey:a,componentClass:a,state:e.enum([`healthy`,`degraded`,`failed`,`unavailable`,`unknown`]),lastSuccessAt:e.iso.datetime().nullable(),facts:e.array(R).max(16),failure:z.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`]})}),V=e.object({contractVersion:e.literal(1),projectId:a,environment:a,runtimeInstanceId:a,reportId:s,sequence:e.number().int().min(1).max(2**53-1),observedAt:e.iso.datetime(),components:e.array(B).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)}),H=e.object({timestamp:e.iso.datetime(),nonce:s,signature:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),U=e.object({contractVersion:e.literal(1),report:V,authentication:H}).strict();function W(e){let t=U.omit({authentication:!0}).extend({authentication:H.omit({signature:!0})}).parse(e);return JSON.stringify(t)}const G=e.enum([`authentication_failed`,`identity_not_registered`,`nonce_replayed`,`report_invalid`,`runtime_identity_mismatch`,`sequence_invalid`,`size_exceeded`,`timestamp_out_of_range`,`unexpected_failure`]),K=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:G,summary:i(300)}).strict()]);export{h as sentinelActionSchema,P as sentinelAlertPolicySchema,t as sentinelContractVersion,C as sentinelDeliveryReceiptSchema,w as sentinelDiagnosticSchema,k as sentinelEnvironmentBindingSchema,s as sentinelEventIdSchema,u as sentinelEvidenceSchema,B as sentinelHealthComponentSchema,z as sentinelHealthFailureSchema,R as sentinelHealthMetricFactSchema,H as sentinelHealthReportAuthenticationSchema,K as sentinelHealthReportIngestResultSchema,n as sentinelHealthReportMaximumBytes,r as sentinelHealthReportMaximumComponents,G as sentinelHealthReportRejectionCodeSchema,V as sentinelHealthReportSchema,W as sentinelHealthReportSignatureInput,U as sentinelHealthReportSubmissionSchema,_ as sentinelIncidentEventSchema,M as sentinelPolicyActionSchema,A as sentinelProjectManifestSchema,b as sentinelQueueEventIdentityInput,y as sentinelQueueEventSchema,E as sentinelQueueMetricsSchema,x as sentinelReceiverFailureCodeSchema,S as sentinelReceiverStateSchema,I as sentinelRegistrationCommandSchema,F as sentinelRegistrationSchema,N as sentinelRuleSchema,d as sentinelRunbookSchema,T as sentinelRuntimeStatusSchema,v as sentinelTestEventSchema};
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@closerepo/sentinel-contracts",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "license": "UNLICENSED",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/closerepo/packages.git",
9
+ "directory": "packages/sentinel-contracts"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "files": [
15
+ "dist/index.d.ts",
16
+ "dist/index.js"
17
+ ],
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ }
23
+ },
24
+ "dependencies": {
25
+ "zod": "4.3.6"
26
+ }
27
+ }