@junando/core 0.11.0 → 0.12.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.
Files changed (44) hide show
  1. package/dist/index.d.ts +771 -1918
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +2190 -10364
  4. package/dist/index.js.map +1 -0
  5. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  6. package/dist/shared/metrics/index.d.ts +29 -0
  7. package/dist/shared/metrics/index.d.ts.map +1 -0
  8. package/dist/shared/metrics/index.js +131 -0
  9. package/dist/shared/metrics/index.js.map +1 -0
  10. package/package.json +11 -11
  11. package/dist/chunk-3OJNTHWB.js +0 -225
  12. package/dist/chunk-5LNMHOUT.js +0 -229
  13. package/dist/chunk-72FU6SG6.js +0 -236
  14. package/dist/chunk-7SYJ764U.js +0 -579
  15. package/dist/chunk-AZU6S4RC.js +0 -11
  16. package/dist/chunk-BGPI5BQ5.js +0 -27
  17. package/dist/chunk-DKQSWD3S.js +0 -46
  18. package/dist/chunk-H4ND7Z4R.js +0 -504
  19. package/dist/chunk-HVICRLMN.js +0 -742
  20. package/dist/chunk-ID7PWYSN.js +0 -12
  21. package/dist/chunk-KU245W3C.js +0 -16
  22. package/dist/chunk-L67CO4EG.js +0 -1038
  23. package/dist/chunk-MLKGABMK.js +0 -9
  24. package/dist/chunk-MQ4JUE6V.js +0 -447
  25. package/dist/chunk-N5AJP37P.js +0 -385
  26. package/dist/chunk-SIDCDO4Q.js +0 -1315
  27. package/dist/chunk-TDZF3WAT.js +0 -3824
  28. package/dist/chunk-VMBT3R2K.js +0 -0
  29. package/dist/chunk-WWHXKECU.js +0 -100
  30. package/dist/chunk-ZKH7AMP3.js +0 -42
  31. package/dist/chunk-ZOU3QHNL.js +0 -28
  32. package/dist/dist-es-CBFEDVZZ.js +0 -493
  33. package/dist/dist-es-ROXOWRKX.js +0 -22
  34. package/dist/dist-es-S3QCFNII.js +0 -327
  35. package/dist/dist-es-SQCUDQ4Y.js +0 -90
  36. package/dist/dist-es-UWOSB3KA.js +0 -72
  37. package/dist/dist-es-VXERFT35.js +0 -172
  38. package/dist/dist-es-Y44CAW7E.js +0 -385
  39. package/dist/event-streams-2IMLK3TK.js +0 -252
  40. package/dist/event-streams-NLZW3NHF.js +0 -1376
  41. package/dist/loadSso-T6VCDGCZ.js +0 -558
  42. package/dist/signin-BC6ZNJCV.js +0 -653
  43. package/dist/sso-oidc-PTS5E3NX.js +0 -793
  44. package/dist/sts-JSJ57UXB.js +0 -6108
package/dist/index.d.ts CHANGED
@@ -1,51 +1,52 @@
1
- import { z } from 'zod';
2
- import pino from 'pino';
3
- import { Redis } from 'ioredis';
4
- import { Gauge, Counter, Histogram, Registry } from 'prom-client';
5
-
1
+ import { t as index_d_exports } from "./shared/metrics/index.js";
2
+ import { z } from "zod";
3
+ import pino from "pino";
4
+ import { Writable } from "node:stream";
5
+ import { Redis } from "ioredis";
6
+ //#region src/shared/constants.d.ts
6
7
  declare enum AlertType {
7
- Error = "http_500",
8
- Warning = "latency_spike",
9
- Success = "recovery"
8
+ Error = "http_500",
9
+ Warning = "latency_spike",
10
+ Success = "recovery"
10
11
  }
11
12
  interface AlertTypeConfig {
12
- readonly alertName: string;
13
- readonly severity: string;
14
- readonly summary: (service: string, i: number, count: number) => string;
13
+ readonly alertName: string;
14
+ readonly severity: string;
15
+ readonly summary: (service: string, i: number, count: number) => string;
15
16
  }
16
17
  declare const _alertTypeConfigs: Record<AlertType, AlertTypeConfig>;
17
18
  declare const ALERT_TYPE_LABELS: Readonly<typeof _alertTypeConfigs>;
18
19
  declare enum LLMProviderType {
19
- Gemini = "gemini",
20
- Claude = "claude",
21
- OpenRouter = "openrouter",
22
- Qwen = "qwen"
20
+ Gemini = "gemini",
21
+ Claude = "claude",
22
+ OpenRouter = "openrouter",
23
+ Qwen = "qwen"
23
24
  }
24
25
  declare const HTTP_TIMEOUT_MS: Readonly<{
25
- Default: 5000;
26
- LLM: 30000;
26
+ Default: 5000;
27
+ LLM: 30000;
27
28
  }>;
28
29
  declare const CIRCUIT_BREAKER: Readonly<{
29
- Timeout: 10000;
30
- ErrorThresholdPercentage: 70;
31
- ResetTimeoutMs: 30000;
30
+ Timeout: 10000;
31
+ ErrorThresholdPercentage: 70;
32
+ ResetTimeoutMs: 30000;
32
33
  }>;
33
34
  declare const LLM_MAX_TOKENS = 1024;
34
35
  declare const RATE_LIMITER: Readonly<{
35
- MinTimeMs: 100;
36
- MaxConcurrent: 5;
36
+ MinTimeMs: 100;
37
+ MaxConcurrent: 5;
37
38
  }>;
38
39
  declare const DEV_SERVER_PORT = 4000;
39
40
  declare const DEDUP_TTL_MS_MULTIPLIER = 1000;
40
41
  declare const HOUR_MS = 3600000;
41
42
  declare const LLM_FALLBACK_DEFAULTS: Readonly<{
42
- TimeoutMs: 60000;
43
- Models: string[];
43
+ TimeoutMs: 60000;
44
+ Models: string[];
44
45
  }>;
45
46
  declare const LLM_MODELS: Readonly<{
46
- Gemini: "gemini-2.0-flash";
47
- Claude: "claude-haiku-4-5";
48
- OpenRouter: "qwen/qwen-2.5-72b-instruct";
47
+ Gemini: "gemini-2.0-flash";
48
+ Claude: "claude-haiku-4-5";
49
+ OpenRouter: "qwen/qwen-2.5-72b-instruct";
49
50
  }>;
50
51
  declare const SLACK_API_URL = "https://slack.com/api/chat.postMessage";
51
52
  declare const TEAMS_WEBHOOK_TIMEOUT_MS = 10000;
@@ -53,1601 +54,488 @@ declare const _urgencyEmoji: Record<string, string>;
53
54
  declare const URGENCY_EMOJI: Readonly<typeof _urgencyEmoji>;
54
55
  declare const REDIS_KEY_PREFIX = "junando:dedup:";
55
56
  declare const WEBHOOK_DEFAULTS: Readonly<{
56
- AlertmanagerUrl: "http://localhost:9093";
57
- WebhookUrl: "http://localhost:4000/webhook/alert";
57
+ AlertmanagerUrl: "http://localhost:9093";
58
+ WebhookUrl: "http://localhost:4000/webhook/alert";
58
59
  }>;
59
60
  declare const PAYLOAD_DEFAULTS: Readonly<{
60
- Version: "4";
61
- TruncatedAlerts: 0;
62
- Receiver: "junando";
61
+ Version: "4";
62
+ TruncatedAlerts: 0;
63
+ Receiver: "junando";
63
64
  }>;
64
-
65
- declare const AlertStatusSchema: z.ZodEnum<["firing", "resolved"]>;
66
- declare const NormalizedAlertSchema: z.ZodObject<{
67
- fingerprint: z.ZodString;
68
- alertName: z.ZodString;
69
- status: z.ZodEnum<["firing", "resolved"]>;
70
- serviceName: z.ZodString;
71
- alertType: z.ZodNativeEnum<typeof AlertType>;
72
- endpointPath: z.ZodString;
73
- traceId: z.ZodOptional<z.ZodString>;
74
- startsAt: z.ZodString;
75
- latencyMs: z.ZodOptional<z.ZodNumber>;
76
- labels: z.ZodRecord<z.ZodString, z.ZodString>;
77
- annotations: z.ZodRecord<z.ZodString, z.ZodString>;
78
- }, "strip", z.ZodTypeAny, {
79
- fingerprint: string;
80
- alertName: string;
81
- status: "firing" | "resolved";
82
- serviceName: string;
83
- alertType: AlertType;
84
- endpointPath: string;
85
- startsAt: string;
86
- labels: Record<string, string>;
87
- annotations: Record<string, string>;
88
- traceId?: string | undefined;
89
- latencyMs?: number | undefined;
90
- }, {
91
- fingerprint: string;
92
- alertName: string;
93
- status: "firing" | "resolved";
94
- serviceName: string;
95
- alertType: AlertType;
96
- endpointPath: string;
97
- startsAt: string;
98
- labels: Record<string, string>;
99
- annotations: Record<string, string>;
100
- traceId?: string | undefined;
101
- latencyMs?: number | undefined;
65
+ //#endregion
66
+ //#region src/domain/entities/alert.d.ts
67
+ declare const AlertStatusSchema: z.ZodEnum<{
68
+ firing: "firing";
69
+ resolved: "resolved";
102
70
  }>;
71
+ declare const NormalizedAlertSchema: z.ZodObject<{
72
+ fingerprint: z.ZodString;
73
+ alertName: z.ZodString;
74
+ status: z.ZodEnum<{
75
+ firing: "firing";
76
+ resolved: "resolved";
77
+ }>;
78
+ serviceName: z.ZodString;
79
+ alertType: z.ZodEnum<typeof AlertType>;
80
+ endpointPath: z.ZodString;
81
+ traceId: z.ZodOptional<z.ZodString>;
82
+ startsAt: z.ZodString;
83
+ latencyMs: z.ZodOptional<z.ZodNumber>;
84
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
85
+ annotations: z.ZodRecord<z.ZodString, z.ZodString>;
86
+ }, z.core.$strip>;
103
87
  declare const AlertmanagerPayloadSchema: z.ZodObject<{
104
- version: z.ZodDefault<z.ZodString>;
105
- groupKey: z.ZodString;
106
- truncatedAlerts: z.ZodDefault<z.ZodNumber>;
107
- status: z.ZodEnum<["firing", "resolved"]>;
108
- receiver: z.ZodString;
109
- groupLabels: z.ZodRecord<z.ZodString, z.ZodString>;
110
- commonLabels: z.ZodRecord<z.ZodString, z.ZodString>;
111
- commonAnnotations: z.ZodRecord<z.ZodString, z.ZodString>;
112
- externalURL: z.ZodString;
113
- alerts: z.ZodArray<z.ZodObject<{
114
- status: z.ZodEnum<["firing", "resolved"]>;
115
- labels: z.ZodRecord<z.ZodString, z.ZodString>;
116
- annotations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
117
- startsAt: z.ZodString;
118
- endsAt: z.ZodString;
119
- fingerprint: z.ZodOptional<z.ZodString>;
120
- }, "strip", z.ZodTypeAny, {
121
- status: "firing" | "resolved";
122
- startsAt: string;
123
- labels: Record<string, string>;
124
- annotations: Record<string, string>;
125
- endsAt: string;
126
- fingerprint?: string | undefined;
127
- }, {
128
- status: "firing" | "resolved";
129
- startsAt: string;
130
- labels: Record<string, string>;
131
- endsAt: string;
132
- fingerprint?: string | undefined;
133
- annotations?: Record<string, string> | undefined;
134
- }>, "many">;
135
- }, "strip", z.ZodTypeAny, {
136
- status: "firing" | "resolved";
137
- version: string;
138
- groupKey: string;
139
- truncatedAlerts: number;
140
- receiver: string;
141
- groupLabels: Record<string, string>;
142
- commonLabels: Record<string, string>;
143
- commonAnnotations: Record<string, string>;
144
- externalURL: string;
145
- alerts: {
146
- status: "firing" | "resolved";
147
- startsAt: string;
148
- labels: Record<string, string>;
149
- annotations: Record<string, string>;
150
- endsAt: string;
151
- fingerprint?: string | undefined;
152
- }[];
153
- }, {
154
- status: "firing" | "resolved";
155
- groupKey: string;
156
- receiver: string;
157
- groupLabels: Record<string, string>;
158
- commonLabels: Record<string, string>;
159
- commonAnnotations: Record<string, string>;
160
- externalURL: string;
161
- alerts: {
162
- status: "firing" | "resolved";
163
- startsAt: string;
164
- labels: Record<string, string>;
165
- endsAt: string;
166
- fingerprint?: string | undefined;
167
- annotations?: Record<string, string> | undefined;
168
- }[];
169
- version?: string | undefined;
170
- truncatedAlerts?: number | undefined;
171
- }>;
88
+ version: z.ZodDefault<z.ZodString>;
89
+ groupKey: z.ZodString;
90
+ truncatedAlerts: z.ZodDefault<z.ZodNumber>;
91
+ status: z.ZodEnum<{
92
+ firing: "firing";
93
+ resolved: "resolved";
94
+ }>;
95
+ receiver: z.ZodString;
96
+ groupLabels: z.ZodRecord<z.ZodString, z.ZodString>;
97
+ commonLabels: z.ZodRecord<z.ZodString, z.ZodString>;
98
+ commonAnnotations: z.ZodRecord<z.ZodString, z.ZodString>;
99
+ externalURL: z.ZodString;
100
+ alerts: z.ZodArray<z.ZodObject<{
101
+ status: z.ZodEnum<{
102
+ firing: "firing";
103
+ resolved: "resolved";
104
+ }>;
105
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
106
+ annotations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
107
+ startsAt: z.ZodString;
108
+ endsAt: z.ZodString;
109
+ fingerprint: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$strip>>;
111
+ }, z.core.$strip>;
172
112
  type AlertStatus = z.infer<typeof AlertStatusSchema>;
173
113
  type NormalizedAlert = z.infer<typeof NormalizedAlertSchema>;
174
114
  type AlertmanagerPayload = z.infer<typeof AlertmanagerPayloadSchema>;
175
115
  type AlertErrorType = NormalizedAlert['alertType'];
176
-
116
+ //#endregion
117
+ //#region src/domain/entities/cluster.d.ts
177
118
  declare const AlertClusterSchema: z.ZodObject<{
119
+ fingerprint: z.ZodString;
120
+ serviceName: z.ZodString;
121
+ alertType: z.ZodEnum<typeof AlertType>;
122
+ endpointPath: z.ZodString;
123
+ alertCount: z.ZodNumber;
124
+ representativeTraceIds: z.ZodArray<z.ZodString>;
125
+ firstSeenAt: z.ZodString;
126
+ latencyP99Ms: z.ZodOptional<z.ZodNumber>;
127
+ severity: z.ZodOptional<z.ZodEnum<{
128
+ critical: "critical";
129
+ high: "high";
130
+ low: "low";
131
+ medium: "medium";
132
+ }>>;
133
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
134
+ }, z.core.$strip>;
135
+ type AlertCluster = z.infer<typeof AlertClusterSchema>;
136
+ //#endregion
137
+ //#region src/domain/entities/incident.d.ts
138
+ declare const UrgencyLevelSchema: z.ZodEnum<{
139
+ critical: "critical";
140
+ high: "high";
141
+ low: "low";
142
+ medium: "medium";
143
+ }>;
144
+ declare const LLMAnalysisSchema: z.ZodObject<{
145
+ probable_cause: z.ZodString;
146
+ impacted_services: z.ZodArray<z.ZodString>;
147
+ recommended_steps: z.ZodArray<z.ZodString>;
148
+ urgency_level: z.ZodEnum<{
149
+ critical: "critical";
150
+ high: "high";
151
+ low: "low";
152
+ medium: "medium";
153
+ }>;
154
+ requires_rollback: z.ZodBoolean;
155
+ }, z.core.$strip>;
156
+ declare const IncidentSchema: z.ZodObject<{
157
+ cluster: z.ZodObject<{
178
158
  fingerprint: z.ZodString;
179
159
  serviceName: z.ZodString;
180
- alertType: z.ZodNativeEnum<typeof AlertType>;
160
+ alertType: z.ZodEnum<typeof AlertType>;
181
161
  endpointPath: z.ZodString;
182
162
  alertCount: z.ZodNumber;
183
- representativeTraceIds: z.ZodArray<z.ZodString, "many">;
163
+ representativeTraceIds: z.ZodArray<z.ZodString>;
184
164
  firstSeenAt: z.ZodString;
185
165
  latencyP99Ms: z.ZodOptional<z.ZodNumber>;
186
- /** Severity level — can be derived from ALERT_TYPE_LABELS[alertType].severity */
187
- severity: z.ZodOptional<z.ZodEnum<["critical", "high", "medium", "low"]>>;
188
- /** Arbitrary key-value labels passed through from alerts */
166
+ severity: z.ZodOptional<z.ZodEnum<{
167
+ critical: "critical";
168
+ high: "high";
169
+ low: "low";
170
+ medium: "medium";
171
+ }>>;
189
172
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
190
- }, "strip", z.ZodTypeAny, {
191
- fingerprint: string;
192
- serviceName: string;
193
- alertType: AlertType;
194
- endpointPath: string;
195
- alertCount: number;
196
- representativeTraceIds: string[];
197
- firstSeenAt: string;
198
- labels?: Record<string, string> | undefined;
199
- latencyP99Ms?: number | undefined;
200
- severity?: "critical" | "high" | "medium" | "low" | undefined;
201
- }, {
202
- fingerprint: string;
203
- serviceName: string;
204
- alertType: AlertType;
205
- endpointPath: string;
206
- alertCount: number;
207
- representativeTraceIds: string[];
208
- firstSeenAt: string;
209
- labels?: Record<string, string> | undefined;
210
- latencyP99Ms?: number | undefined;
211
- severity?: "critical" | "high" | "medium" | "low" | undefined;
212
- }>;
213
- type AlertCluster = z.infer<typeof AlertClusterSchema>;
214
-
215
- declare const UrgencyLevelSchema: z.ZodEnum<["low", "medium", "high", "critical"]>;
216
- declare const LLMAnalysisSchema: z.ZodObject<{
173
+ }, z.core.$strip>;
174
+ traces: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
175
+ analysis: z.ZodOptional<z.ZodObject<{
217
176
  probable_cause: z.ZodString;
218
- impacted_services: z.ZodArray<z.ZodString, "many">;
219
- recommended_steps: z.ZodArray<z.ZodString, "many">;
220
- urgency_level: z.ZodEnum<["low", "medium", "high", "critical"]>;
221
- requires_rollback: z.ZodBoolean;
222
- }, "strip", z.ZodTypeAny, {
223
- probable_cause: string;
224
- impacted_services: string[];
225
- recommended_steps: string[];
226
- urgency_level: "critical" | "high" | "medium" | "low";
227
- requires_rollback: boolean;
228
- }, {
229
- probable_cause: string;
230
- impacted_services: string[];
231
- recommended_steps: string[];
232
- urgency_level: "critical" | "high" | "medium" | "low";
233
- requires_rollback: boolean;
234
- }>;
235
- declare const IncidentSchema: z.ZodObject<{
236
- cluster: z.ZodObject<{
237
- fingerprint: z.ZodString;
238
- serviceName: z.ZodString;
239
- alertType: z.ZodNativeEnum<typeof AlertType>;
240
- endpointPath: z.ZodString;
241
- alertCount: z.ZodNumber;
242
- representativeTraceIds: z.ZodArray<z.ZodString, "many">;
243
- firstSeenAt: z.ZodString;
244
- latencyP99Ms: z.ZodOptional<z.ZodNumber>;
245
- severity: z.ZodOptional<z.ZodEnum<["critical", "high", "medium", "low"]>>;
246
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
247
- }, "strip", z.ZodTypeAny, {
248
- fingerprint: string;
249
- serviceName: string;
250
- alertType: AlertType;
251
- endpointPath: string;
252
- alertCount: number;
253
- representativeTraceIds: string[];
254
- firstSeenAt: string;
255
- labels?: Record<string, string> | undefined;
256
- latencyP99Ms?: number | undefined;
257
- severity?: "critical" | "high" | "medium" | "low" | undefined;
258
- }, {
259
- fingerprint: string;
260
- serviceName: string;
261
- alertType: AlertType;
262
- endpointPath: string;
263
- alertCount: number;
264
- representativeTraceIds: string[];
265
- firstSeenAt: string;
266
- labels?: Record<string, string> | undefined;
267
- latencyP99Ms?: number | undefined;
268
- severity?: "critical" | "high" | "medium" | "low" | undefined;
177
+ impacted_services: z.ZodArray<z.ZodString>;
178
+ recommended_steps: z.ZodArray<z.ZodString>;
179
+ urgency_level: z.ZodEnum<{
180
+ critical: "critical";
181
+ high: "high";
182
+ low: "low";
183
+ medium: "medium";
269
184
  }>;
270
- traces: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
271
- analysis: z.ZodOptional<z.ZodObject<{
272
- probable_cause: z.ZodString;
273
- impacted_services: z.ZodArray<z.ZodString, "many">;
274
- recommended_steps: z.ZodArray<z.ZodString, "many">;
275
- urgency_level: z.ZodEnum<["low", "medium", "high", "critical"]>;
276
- requires_rollback: z.ZodBoolean;
277
- }, "strip", z.ZodTypeAny, {
278
- probable_cause: string;
279
- impacted_services: string[];
280
- recommended_steps: string[];
281
- urgency_level: "critical" | "high" | "medium" | "low";
282
- requires_rollback: boolean;
283
- }, {
284
- probable_cause: string;
285
- impacted_services: string[];
286
- recommended_steps: string[];
287
- urgency_level: "critical" | "high" | "medium" | "low";
288
- requires_rollback: boolean;
289
- }>>;
290
- processedAt: z.ZodString;
291
- }, "strip", z.ZodTypeAny, {
292
- cluster: {
293
- fingerprint: string;
294
- serviceName: string;
295
- alertType: AlertType;
296
- endpointPath: string;
297
- alertCount: number;
298
- representativeTraceIds: string[];
299
- firstSeenAt: string;
300
- labels?: Record<string, string> | undefined;
301
- latencyP99Ms?: number | undefined;
302
- severity?: "critical" | "high" | "medium" | "low" | undefined;
303
- };
304
- processedAt: string;
305
- traces?: Record<string, unknown>[] | undefined;
306
- analysis?: {
307
- probable_cause: string;
308
- impacted_services: string[];
309
- recommended_steps: string[];
310
- urgency_level: "critical" | "high" | "medium" | "low";
311
- requires_rollback: boolean;
312
- } | undefined;
313
- }, {
314
- cluster: {
315
- fingerprint: string;
316
- serviceName: string;
317
- alertType: AlertType;
318
- endpointPath: string;
319
- alertCount: number;
320
- representativeTraceIds: string[];
321
- firstSeenAt: string;
322
- labels?: Record<string, string> | undefined;
323
- latencyP99Ms?: number | undefined;
324
- severity?: "critical" | "high" | "medium" | "low" | undefined;
325
- };
326
- processedAt: string;
327
- traces?: Record<string, unknown>[] | undefined;
328
- analysis?: {
329
- probable_cause: string;
330
- impacted_services: string[];
331
- recommended_steps: string[];
332
- urgency_level: "critical" | "high" | "medium" | "low";
333
- requires_rollback: boolean;
334
- } | undefined;
335
- }>;
185
+ requires_rollback: z.ZodBoolean;
186
+ }, z.core.$strip>>;
187
+ processedAt: z.ZodString;
188
+ }, z.core.$strip>;
336
189
  type UrgencyLevel = z.infer<typeof UrgencyLevelSchema>;
337
190
  type LLMAnalysis = z.infer<typeof LLMAnalysisSchema>;
338
191
  type Incident = z.infer<typeof IncidentSchema>;
339
-
192
+ //#endregion
193
+ //#region src/domain/entities/rule.d.ts
340
194
  declare enum RuleActionType {
341
- Suppress = "suppress",
342
- Route = "route",
343
- Escalate = "escalate",
344
- Tag = "tag"
195
+ Suppress = "suppress",
196
+ Route = "route",
197
+ Escalate = "escalate",
198
+ Tag = "tag"
345
199
  }
346
200
  declare enum SeverityLevel {
347
- Critical = "critical",
348
- High = "high",
349
- Medium = "medium",
350
- Low = "low"
201
+ Critical = "critical",
202
+ High = "high",
203
+ Medium = "medium",
204
+ Low = "low"
351
205
  }
352
206
  /** Rule evaluation points in the pipeline */
353
207
  declare enum RuleEvaluationPhase {
354
- PreLlm = "pre-llm",
355
- PostLlm = "post-llm"
208
+ PreLlm = "pre-llm",
209
+ PostLlm = "post-llm"
356
210
  }
357
211
  interface RuleCondition {
358
- serviceName?: string;
359
- alertType?: AlertType;
360
- severity?: SeverityLevel;
361
- labels?: Record<string, string>;
362
- endpointPath?: string;
363
- alertCount?: {
364
- min?: number;
365
- max?: number;
366
- };
367
- latencyP99Ms?: {
368
- min?: number;
369
- max?: number;
370
- };
371
- /** POST-LLM only (analysis must be present) */
372
- urgencyLevel?: z.infer<typeof UrgencyLevelSchema>;
373
- requiresRollback?: boolean;
374
- impactedServices?: string[];
212
+ serviceName?: string;
213
+ alertType?: AlertType;
214
+ severity?: SeverityLevel;
215
+ labels?: Record<string, string>;
216
+ endpointPath?: string;
217
+ alertCount?: {
218
+ min?: number;
219
+ max?: number;
220
+ };
221
+ latencyP99Ms?: {
222
+ min?: number;
223
+ max?: number;
224
+ };
225
+ /** POST-LLM only (analysis must be present) */
226
+ urgencyLevel?: z.infer<typeof UrgencyLevelSchema>;
227
+ requiresRollback?: boolean;
228
+ impactedServices?: string[];
375
229
  }
376
230
  declare const RuleConditionSchema: z.ZodObject<{
231
+ serviceName: z.ZodOptional<z.ZodString>;
232
+ alertType: z.ZodOptional<z.ZodEnum<typeof AlertType>>;
233
+ severity: z.ZodOptional<z.ZodEnum<typeof SeverityLevel>>;
234
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
235
+ endpointPath: z.ZodOptional<z.ZodString>;
236
+ alertCount: z.ZodOptional<z.ZodObject<{
237
+ min: z.ZodOptional<z.ZodNumber>;
238
+ max: z.ZodOptional<z.ZodNumber>;
239
+ }, z.core.$strip>>;
240
+ latencyP99Ms: z.ZodOptional<z.ZodObject<{
241
+ min: z.ZodOptional<z.ZodNumber>;
242
+ max: z.ZodOptional<z.ZodNumber>;
243
+ }, z.core.$strip>>;
244
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
245
+ critical: "critical";
246
+ high: "high";
247
+ low: "low";
248
+ medium: "medium";
249
+ }>>;
250
+ requiresRollback: z.ZodOptional<z.ZodBoolean>;
251
+ impactedServices: z.ZodOptional<z.ZodArray<z.ZodString>>;
252
+ }, z.core.$strip>;
253
+ type RuleAction = {
254
+ type: RuleActionType.Suppress;
255
+ } | {
256
+ type: RuleActionType.Route;
257
+ channel: string;
258
+ } | {
259
+ type: RuleActionType.Escalate;
260
+ channel: string;
261
+ } | {
262
+ type: RuleActionType.Tag;
263
+ key: string;
264
+ value: string;
265
+ };
266
+ declare const RuleActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
267
+ type: z.ZodLiteral<RuleActionType.Suppress>;
268
+ }, z.core.$strip>, z.ZodObject<{
269
+ type: z.ZodLiteral<RuleActionType.Route>;
270
+ channel: z.ZodString;
271
+ }, z.core.$strip>, z.ZodObject<{
272
+ type: z.ZodLiteral<RuleActionType.Escalate>;
273
+ channel: z.ZodString;
274
+ }, z.core.$strip>, z.ZodObject<{
275
+ type: z.ZodLiteral<RuleActionType.Tag>;
276
+ key: z.ZodString;
277
+ value: z.ZodString;
278
+ }, z.core.$strip>], "type">;
279
+ interface Rule {
280
+ id: string;
281
+ name?: string;
282
+ condition: RuleCondition;
283
+ actions: RuleAction[];
284
+ /** POST-LLM only (can only be used in post-llm section) */
285
+ urgencyLevel?: z.infer<typeof UrgencyLevelSchema>;
286
+ requiresRollback?: boolean;
287
+ }
288
+ declare const RuleSchema: z.ZodObject<{
289
+ id: z.ZodString;
290
+ name: z.ZodOptional<z.ZodString>;
291
+ condition: z.ZodObject<{
377
292
  serviceName: z.ZodOptional<z.ZodString>;
378
- alertType: z.ZodOptional<z.ZodNativeEnum<typeof AlertType>>;
379
- severity: z.ZodOptional<z.ZodNativeEnum<typeof SeverityLevel>>;
293
+ alertType: z.ZodOptional<z.ZodEnum<typeof AlertType>>;
294
+ severity: z.ZodOptional<z.ZodEnum<typeof SeverityLevel>>;
380
295
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
381
296
  endpointPath: z.ZodOptional<z.ZodString>;
382
297
  alertCount: z.ZodOptional<z.ZodObject<{
383
- min: z.ZodOptional<z.ZodNumber>;
384
- max: z.ZodOptional<z.ZodNumber>;
385
- }, "strip", z.ZodTypeAny, {
386
- min?: number | undefined;
387
- max?: number | undefined;
388
- }, {
389
- min?: number | undefined;
390
- max?: number | undefined;
391
- }>>;
298
+ min: z.ZodOptional<z.ZodNumber>;
299
+ max: z.ZodOptional<z.ZodNumber>;
300
+ }, z.core.$strip>>;
392
301
  latencyP99Ms: z.ZodOptional<z.ZodObject<{
393
- min: z.ZodOptional<z.ZodNumber>;
394
- max: z.ZodOptional<z.ZodNumber>;
395
- }, "strip", z.ZodTypeAny, {
396
- min?: number | undefined;
397
- max?: number | undefined;
398
- }, {
399
- min?: number | undefined;
400
- max?: number | undefined;
302
+ min: z.ZodOptional<z.ZodNumber>;
303
+ max: z.ZodOptional<z.ZodNumber>;
304
+ }, z.core.$strip>>;
305
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
306
+ critical: "critical";
307
+ high: "high";
308
+ low: "low";
309
+ medium: "medium";
401
310
  }>>;
402
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
403
311
  requiresRollback: z.ZodOptional<z.ZodBoolean>;
404
- impactedServices: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
405
- }, "strip", z.ZodTypeAny, {
406
- serviceName?: string | undefined;
407
- alertType?: AlertType | undefined;
408
- endpointPath?: string | undefined;
409
- labels?: Record<string, string> | undefined;
410
- alertCount?: {
411
- min?: number | undefined;
412
- max?: number | undefined;
413
- } | undefined;
414
- latencyP99Ms?: {
415
- min?: number | undefined;
416
- max?: number | undefined;
417
- } | undefined;
418
- severity?: SeverityLevel | undefined;
419
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
420
- requiresRollback?: boolean | undefined;
421
- impactedServices?: string[] | undefined;
422
- }, {
423
- serviceName?: string | undefined;
424
- alertType?: AlertType | undefined;
425
- endpointPath?: string | undefined;
426
- labels?: Record<string, string> | undefined;
427
- alertCount?: {
428
- min?: number | undefined;
429
- max?: number | undefined;
430
- } | undefined;
431
- latencyP99Ms?: {
432
- min?: number | undefined;
433
- max?: number | undefined;
434
- } | undefined;
435
- severity?: SeverityLevel | undefined;
436
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
437
- requiresRollback?: boolean | undefined;
438
- impactedServices?: string[] | undefined;
439
- }>;
440
- type RuleAction = {
441
- type: RuleActionType.Suppress;
442
- } | {
443
- type: RuleActionType.Route;
444
- channel: string;
445
- } | {
446
- type: RuleActionType.Escalate;
447
- channel: string;
448
- } | {
449
- type: RuleActionType.Tag;
450
- key: string;
451
- value: string;
452
- };
453
- declare const RuleActionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
312
+ impactedServices: z.ZodOptional<z.ZodArray<z.ZodString>>;
313
+ }, z.core.$strip>;
314
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
454
315
  type: z.ZodLiteral<RuleActionType.Suppress>;
455
- }, "strip", z.ZodTypeAny, {
456
- type: RuleActionType.Suppress;
457
- }, {
458
- type: RuleActionType.Suppress;
459
- }>, z.ZodObject<{
316
+ }, z.core.$strip>, z.ZodObject<{
460
317
  type: z.ZodLiteral<RuleActionType.Route>;
461
318
  channel: z.ZodString;
462
- }, "strip", z.ZodTypeAny, {
463
- type: RuleActionType.Route;
464
- channel: string;
465
- }, {
466
- type: RuleActionType.Route;
467
- channel: string;
468
- }>, z.ZodObject<{
319
+ }, z.core.$strip>, z.ZodObject<{
469
320
  type: z.ZodLiteral<RuleActionType.Escalate>;
470
321
  channel: z.ZodString;
471
- }, "strip", z.ZodTypeAny, {
472
- type: RuleActionType.Escalate;
473
- channel: string;
474
- }, {
475
- type: RuleActionType.Escalate;
476
- channel: string;
477
- }>, z.ZodObject<{
322
+ }, z.core.$strip>, z.ZodObject<{
478
323
  type: z.ZodLiteral<RuleActionType.Tag>;
479
324
  key: z.ZodString;
480
325
  value: z.ZodString;
481
- }, "strip", z.ZodTypeAny, {
482
- value: string;
483
- type: RuleActionType.Tag;
484
- key: string;
485
- }, {
486
- value: string;
487
- type: RuleActionType.Tag;
488
- key: string;
489
- }>]>;
490
- interface Rule {
491
- id: string;
492
- name?: string;
493
- condition: RuleCondition;
494
- actions: RuleAction[];
495
- /** POST-LLM only (can only be used in post-llm section) */
496
- urgencyLevel?: z.infer<typeof UrgencyLevelSchema>;
497
- requiresRollback?: boolean;
326
+ }, z.core.$strip>], "type">>;
327
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
328
+ critical: "critical";
329
+ high: "high";
330
+ low: "low";
331
+ medium: "medium";
332
+ }>>;
333
+ requiresRollback: z.ZodOptional<z.ZodBoolean>;
334
+ }, z.core.$strip>;
335
+ interface RuleSection {
336
+ rules: Rule[];
498
337
  }
499
- declare const RuleSchema: z.ZodObject<{
338
+ declare const RuleSectionSchema: z.ZodObject<{
339
+ rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
500
340
  id: z.ZodString;
501
341
  name: z.ZodOptional<z.ZodString>;
502
342
  condition: z.ZodObject<{
343
+ serviceName: z.ZodOptional<z.ZodString>;
344
+ alertType: z.ZodOptional<z.ZodEnum<typeof AlertType>>;
345
+ severity: z.ZodOptional<z.ZodEnum<typeof SeverityLevel>>;
346
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
347
+ endpointPath: z.ZodOptional<z.ZodString>;
348
+ alertCount: z.ZodOptional<z.ZodObject<{
349
+ min: z.ZodOptional<z.ZodNumber>;
350
+ max: z.ZodOptional<z.ZodNumber>;
351
+ }, z.core.$strip>>;
352
+ latencyP99Ms: z.ZodOptional<z.ZodObject<{
353
+ min: z.ZodOptional<z.ZodNumber>;
354
+ max: z.ZodOptional<z.ZodNumber>;
355
+ }, z.core.$strip>>;
356
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
357
+ critical: "critical";
358
+ high: "high";
359
+ low: "low";
360
+ medium: "medium";
361
+ }>>;
362
+ requiresRollback: z.ZodOptional<z.ZodBoolean>;
363
+ impactedServices: z.ZodOptional<z.ZodArray<z.ZodString>>;
364
+ }, z.core.$strip>;
365
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
366
+ type: z.ZodLiteral<RuleActionType.Suppress>;
367
+ }, z.core.$strip>, z.ZodObject<{
368
+ type: z.ZodLiteral<RuleActionType.Route>;
369
+ channel: z.ZodString;
370
+ }, z.core.$strip>, z.ZodObject<{
371
+ type: z.ZodLiteral<RuleActionType.Escalate>;
372
+ channel: z.ZodString;
373
+ }, z.core.$strip>, z.ZodObject<{
374
+ type: z.ZodLiteral<RuleActionType.Tag>;
375
+ key: z.ZodString;
376
+ value: z.ZodString;
377
+ }, z.core.$strip>], "type">>;
378
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
379
+ critical: "critical";
380
+ high: "high";
381
+ low: "low";
382
+ medium: "medium";
383
+ }>>;
384
+ requiresRollback: z.ZodOptional<z.ZodBoolean>;
385
+ }, z.core.$strip>>>;
386
+ }, z.core.$strip>;
387
+ interface RuleConfiguration {
388
+ [RuleEvaluationPhase.PreLlm]: RuleSection;
389
+ [RuleEvaluationPhase.PostLlm]: RuleSection;
390
+ }
391
+ declare const RuleConfigurationSchema: z.ZodObject<{
392
+ "pre-llm": z.ZodObject<{
393
+ rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
394
+ id: z.ZodString;
395
+ name: z.ZodOptional<z.ZodString>;
396
+ condition: z.ZodObject<{
503
397
  serviceName: z.ZodOptional<z.ZodString>;
504
- alertType: z.ZodOptional<z.ZodNativeEnum<typeof AlertType>>;
505
- severity: z.ZodOptional<z.ZodNativeEnum<typeof SeverityLevel>>;
398
+ alertType: z.ZodOptional<z.ZodEnum<typeof AlertType>>;
399
+ severity: z.ZodOptional<z.ZodEnum<typeof SeverityLevel>>;
506
400
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
507
401
  endpointPath: z.ZodOptional<z.ZodString>;
508
402
  alertCount: z.ZodOptional<z.ZodObject<{
509
- min: z.ZodOptional<z.ZodNumber>;
510
- max: z.ZodOptional<z.ZodNumber>;
511
- }, "strip", z.ZodTypeAny, {
512
- min?: number | undefined;
513
- max?: number | undefined;
514
- }, {
515
- min?: number | undefined;
516
- max?: number | undefined;
517
- }>>;
403
+ min: z.ZodOptional<z.ZodNumber>;
404
+ max: z.ZodOptional<z.ZodNumber>;
405
+ }, z.core.$strip>>;
518
406
  latencyP99Ms: z.ZodOptional<z.ZodObject<{
519
- min: z.ZodOptional<z.ZodNumber>;
520
- max: z.ZodOptional<z.ZodNumber>;
521
- }, "strip", z.ZodTypeAny, {
522
- min?: number | undefined;
523
- max?: number | undefined;
524
- }, {
525
- min?: number | undefined;
526
- max?: number | undefined;
407
+ min: z.ZodOptional<z.ZodNumber>;
408
+ max: z.ZodOptional<z.ZodNumber>;
409
+ }, z.core.$strip>>;
410
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
411
+ critical: "critical";
412
+ high: "high";
413
+ low: "low";
414
+ medium: "medium";
527
415
  }>>;
528
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
529
416
  requiresRollback: z.ZodOptional<z.ZodBoolean>;
530
- impactedServices: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
531
- }, "strip", z.ZodTypeAny, {
532
- serviceName?: string | undefined;
533
- alertType?: AlertType | undefined;
534
- endpointPath?: string | undefined;
535
- labels?: Record<string, string> | undefined;
536
- alertCount?: {
537
- min?: number | undefined;
538
- max?: number | undefined;
539
- } | undefined;
540
- latencyP99Ms?: {
541
- min?: number | undefined;
542
- max?: number | undefined;
543
- } | undefined;
544
- severity?: SeverityLevel | undefined;
545
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
546
- requiresRollback?: boolean | undefined;
547
- impactedServices?: string[] | undefined;
548
- }, {
549
- serviceName?: string | undefined;
550
- alertType?: AlertType | undefined;
551
- endpointPath?: string | undefined;
552
- labels?: Record<string, string> | undefined;
553
- alertCount?: {
554
- min?: number | undefined;
555
- max?: number | undefined;
556
- } | undefined;
557
- latencyP99Ms?: {
558
- min?: number | undefined;
559
- max?: number | undefined;
560
- } | undefined;
561
- severity?: SeverityLevel | undefined;
562
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
563
- requiresRollback?: boolean | undefined;
564
- impactedServices?: string[] | undefined;
565
- }>;
566
- actions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
417
+ impactedServices: z.ZodOptional<z.ZodArray<z.ZodString>>;
418
+ }, z.core.$strip>;
419
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
567
420
  type: z.ZodLiteral<RuleActionType.Suppress>;
568
- }, "strip", z.ZodTypeAny, {
569
- type: RuleActionType.Suppress;
570
- }, {
571
- type: RuleActionType.Suppress;
572
- }>, z.ZodObject<{
421
+ }, z.core.$strip>, z.ZodObject<{
573
422
  type: z.ZodLiteral<RuleActionType.Route>;
574
423
  channel: z.ZodString;
575
- }, "strip", z.ZodTypeAny, {
576
- type: RuleActionType.Route;
577
- channel: string;
578
- }, {
579
- type: RuleActionType.Route;
580
- channel: string;
581
- }>, z.ZodObject<{
424
+ }, z.core.$strip>, z.ZodObject<{
582
425
  type: z.ZodLiteral<RuleActionType.Escalate>;
583
426
  channel: z.ZodString;
584
- }, "strip", z.ZodTypeAny, {
585
- type: RuleActionType.Escalate;
586
- channel: string;
587
- }, {
588
- type: RuleActionType.Escalate;
589
- channel: string;
590
- }>, z.ZodObject<{
427
+ }, z.core.$strip>, z.ZodObject<{
591
428
  type: z.ZodLiteral<RuleActionType.Tag>;
592
429
  key: z.ZodString;
593
430
  value: z.ZodString;
594
- }, "strip", z.ZodTypeAny, {
595
- value: string;
596
- type: RuleActionType.Tag;
597
- key: string;
598
- }, {
599
- value: string;
600
- type: RuleActionType.Tag;
601
- key: string;
602
- }>]>, "many">;
603
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
604
- requiresRollback: z.ZodOptional<z.ZodBoolean>;
605
- }, "strip", z.ZodTypeAny, {
606
- id: string;
607
- condition: {
608
- serviceName?: string | undefined;
609
- alertType?: AlertType | undefined;
610
- endpointPath?: string | undefined;
611
- labels?: Record<string, string> | undefined;
612
- alertCount?: {
613
- min?: number | undefined;
614
- max?: number | undefined;
615
- } | undefined;
616
- latencyP99Ms?: {
617
- min?: number | undefined;
618
- max?: number | undefined;
619
- } | undefined;
620
- severity?: SeverityLevel | undefined;
621
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
622
- requiresRollback?: boolean | undefined;
623
- impactedServices?: string[] | undefined;
624
- };
625
- actions: ({
626
- type: RuleActionType.Suppress;
627
- } | {
628
- type: RuleActionType.Route;
629
- channel: string;
630
- } | {
631
- type: RuleActionType.Escalate;
632
- channel: string;
633
- } | {
634
- value: string;
635
- type: RuleActionType.Tag;
636
- key: string;
637
- })[];
638
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
639
- requiresRollback?: boolean | undefined;
640
- name?: string | undefined;
641
- }, {
642
- id: string;
643
- condition: {
644
- serviceName?: string | undefined;
645
- alertType?: AlertType | undefined;
646
- endpointPath?: string | undefined;
647
- labels?: Record<string, string> | undefined;
648
- alertCount?: {
649
- min?: number | undefined;
650
- max?: number | undefined;
651
- } | undefined;
652
- latencyP99Ms?: {
653
- min?: number | undefined;
654
- max?: number | undefined;
655
- } | undefined;
656
- severity?: SeverityLevel | undefined;
657
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
658
- requiresRollback?: boolean | undefined;
659
- impactedServices?: string[] | undefined;
660
- };
661
- actions: ({
662
- type: RuleActionType.Suppress;
663
- } | {
664
- type: RuleActionType.Route;
665
- channel: string;
666
- } | {
667
- type: RuleActionType.Escalate;
668
- channel: string;
669
- } | {
670
- value: string;
671
- type: RuleActionType.Tag;
672
- key: string;
673
- })[];
674
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
675
- requiresRollback?: boolean | undefined;
676
- name?: string | undefined;
677
- }>;
678
- interface RuleSection {
679
- rules: Rule[];
680
- }
681
- declare const RuleSectionSchema: z.ZodObject<{
431
+ }, z.core.$strip>], "type">>;
432
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
433
+ critical: "critical";
434
+ high: "high";
435
+ low: "low";
436
+ medium: "medium";
437
+ }>>;
438
+ requiresRollback: z.ZodOptional<z.ZodBoolean>;
439
+ }, z.core.$strip>>>;
440
+ }, z.core.$strip>;
441
+ "post-llm": z.ZodObject<{
682
442
  rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
683
- id: z.ZodString;
684
- name: z.ZodOptional<z.ZodString>;
685
- condition: z.ZodObject<{
686
- serviceName: z.ZodOptional<z.ZodString>;
687
- alertType: z.ZodOptional<z.ZodNativeEnum<typeof AlertType>>;
688
- severity: z.ZodOptional<z.ZodNativeEnum<typeof SeverityLevel>>;
689
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
690
- endpointPath: z.ZodOptional<z.ZodString>;
691
- alertCount: z.ZodOptional<z.ZodObject<{
692
- min: z.ZodOptional<z.ZodNumber>;
693
- max: z.ZodOptional<z.ZodNumber>;
694
- }, "strip", z.ZodTypeAny, {
695
- min?: number | undefined;
696
- max?: number | undefined;
697
- }, {
698
- min?: number | undefined;
699
- max?: number | undefined;
700
- }>>;
701
- latencyP99Ms: z.ZodOptional<z.ZodObject<{
702
- min: z.ZodOptional<z.ZodNumber>;
703
- max: z.ZodOptional<z.ZodNumber>;
704
- }, "strip", z.ZodTypeAny, {
705
- min?: number | undefined;
706
- max?: number | undefined;
707
- }, {
708
- min?: number | undefined;
709
- max?: number | undefined;
710
- }>>;
711
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
712
- requiresRollback: z.ZodOptional<z.ZodBoolean>;
713
- impactedServices: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
714
- }, "strip", z.ZodTypeAny, {
715
- serviceName?: string | undefined;
716
- alertType?: AlertType | undefined;
717
- endpointPath?: string | undefined;
718
- labels?: Record<string, string> | undefined;
719
- alertCount?: {
720
- min?: number | undefined;
721
- max?: number | undefined;
722
- } | undefined;
723
- latencyP99Ms?: {
724
- min?: number | undefined;
725
- max?: number | undefined;
726
- } | undefined;
727
- severity?: SeverityLevel | undefined;
728
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
729
- requiresRollback?: boolean | undefined;
730
- impactedServices?: string[] | undefined;
731
- }, {
732
- serviceName?: string | undefined;
733
- alertType?: AlertType | undefined;
734
- endpointPath?: string | undefined;
735
- labels?: Record<string, string> | undefined;
736
- alertCount?: {
737
- min?: number | undefined;
738
- max?: number | undefined;
739
- } | undefined;
740
- latencyP99Ms?: {
741
- min?: number | undefined;
742
- max?: number | undefined;
743
- } | undefined;
744
- severity?: SeverityLevel | undefined;
745
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
746
- requiresRollback?: boolean | undefined;
747
- impactedServices?: string[] | undefined;
748
- }>;
749
- actions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
750
- type: z.ZodLiteral<RuleActionType.Suppress>;
751
- }, "strip", z.ZodTypeAny, {
752
- type: RuleActionType.Suppress;
753
- }, {
754
- type: RuleActionType.Suppress;
755
- }>, z.ZodObject<{
756
- type: z.ZodLiteral<RuleActionType.Route>;
757
- channel: z.ZodString;
758
- }, "strip", z.ZodTypeAny, {
759
- type: RuleActionType.Route;
760
- channel: string;
761
- }, {
762
- type: RuleActionType.Route;
763
- channel: string;
764
- }>, z.ZodObject<{
765
- type: z.ZodLiteral<RuleActionType.Escalate>;
766
- channel: z.ZodString;
767
- }, "strip", z.ZodTypeAny, {
768
- type: RuleActionType.Escalate;
769
- channel: string;
770
- }, {
771
- type: RuleActionType.Escalate;
772
- channel: string;
773
- }>, z.ZodObject<{
774
- type: z.ZodLiteral<RuleActionType.Tag>;
775
- key: z.ZodString;
776
- value: z.ZodString;
777
- }, "strip", z.ZodTypeAny, {
778
- value: string;
779
- type: RuleActionType.Tag;
780
- key: string;
781
- }, {
782
- value: string;
783
- type: RuleActionType.Tag;
784
- key: string;
785
- }>]>, "many">;
786
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
443
+ id: z.ZodString;
444
+ name: z.ZodOptional<z.ZodString>;
445
+ condition: z.ZodObject<{
446
+ serviceName: z.ZodOptional<z.ZodString>;
447
+ alertType: z.ZodOptional<z.ZodEnum<typeof AlertType>>;
448
+ severity: z.ZodOptional<z.ZodEnum<typeof SeverityLevel>>;
449
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
450
+ endpointPath: z.ZodOptional<z.ZodString>;
451
+ alertCount: z.ZodOptional<z.ZodObject<{
452
+ min: z.ZodOptional<z.ZodNumber>;
453
+ max: z.ZodOptional<z.ZodNumber>;
454
+ }, z.core.$strip>>;
455
+ latencyP99Ms: z.ZodOptional<z.ZodObject<{
456
+ min: z.ZodOptional<z.ZodNumber>;
457
+ max: z.ZodOptional<z.ZodNumber>;
458
+ }, z.core.$strip>>;
459
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
460
+ critical: "critical";
461
+ high: "high";
462
+ low: "low";
463
+ medium: "medium";
464
+ }>>;
787
465
  requiresRollback: z.ZodOptional<z.ZodBoolean>;
788
- }, "strip", z.ZodTypeAny, {
789
- id: string;
790
- condition: {
791
- serviceName?: string | undefined;
792
- alertType?: AlertType | undefined;
793
- endpointPath?: string | undefined;
794
- labels?: Record<string, string> | undefined;
795
- alertCount?: {
796
- min?: number | undefined;
797
- max?: number | undefined;
798
- } | undefined;
799
- latencyP99Ms?: {
800
- min?: number | undefined;
801
- max?: number | undefined;
802
- } | undefined;
803
- severity?: SeverityLevel | undefined;
804
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
805
- requiresRollback?: boolean | undefined;
806
- impactedServices?: string[] | undefined;
807
- };
808
- actions: ({
809
- type: RuleActionType.Suppress;
810
- } | {
811
- type: RuleActionType.Route;
812
- channel: string;
813
- } | {
814
- type: RuleActionType.Escalate;
815
- channel: string;
816
- } | {
817
- value: string;
818
- type: RuleActionType.Tag;
819
- key: string;
820
- })[];
821
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
822
- requiresRollback?: boolean | undefined;
823
- name?: string | undefined;
824
- }, {
825
- id: string;
826
- condition: {
827
- serviceName?: string | undefined;
828
- alertType?: AlertType | undefined;
829
- endpointPath?: string | undefined;
830
- labels?: Record<string, string> | undefined;
831
- alertCount?: {
832
- min?: number | undefined;
833
- max?: number | undefined;
834
- } | undefined;
835
- latencyP99Ms?: {
836
- min?: number | undefined;
837
- max?: number | undefined;
838
- } | undefined;
839
- severity?: SeverityLevel | undefined;
840
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
841
- requiresRollback?: boolean | undefined;
842
- impactedServices?: string[] | undefined;
843
- };
844
- actions: ({
845
- type: RuleActionType.Suppress;
846
- } | {
847
- type: RuleActionType.Route;
848
- channel: string;
849
- } | {
850
- type: RuleActionType.Escalate;
851
- channel: string;
852
- } | {
853
- value: string;
854
- type: RuleActionType.Tag;
855
- key: string;
856
- })[];
857
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
858
- requiresRollback?: boolean | undefined;
859
- name?: string | undefined;
860
- }>, "many">>;
861
- }, "strip", z.ZodTypeAny, {
862
- rules: {
863
- id: string;
864
- condition: {
865
- serviceName?: string | undefined;
866
- alertType?: AlertType | undefined;
867
- endpointPath?: string | undefined;
868
- labels?: Record<string, string> | undefined;
869
- alertCount?: {
870
- min?: number | undefined;
871
- max?: number | undefined;
872
- } | undefined;
873
- latencyP99Ms?: {
874
- min?: number | undefined;
875
- max?: number | undefined;
876
- } | undefined;
877
- severity?: SeverityLevel | undefined;
878
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
879
- requiresRollback?: boolean | undefined;
880
- impactedServices?: string[] | undefined;
881
- };
882
- actions: ({
883
- type: RuleActionType.Suppress;
884
- } | {
885
- type: RuleActionType.Route;
886
- channel: string;
887
- } | {
888
- type: RuleActionType.Escalate;
889
- channel: string;
890
- } | {
891
- value: string;
892
- type: RuleActionType.Tag;
893
- key: string;
894
- })[];
895
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
896
- requiresRollback?: boolean | undefined;
897
- name?: string | undefined;
898
- }[];
899
- }, {
900
- rules?: {
901
- id: string;
902
- condition: {
903
- serviceName?: string | undefined;
904
- alertType?: AlertType | undefined;
905
- endpointPath?: string | undefined;
906
- labels?: Record<string, string> | undefined;
907
- alertCount?: {
908
- min?: number | undefined;
909
- max?: number | undefined;
910
- } | undefined;
911
- latencyP99Ms?: {
912
- min?: number | undefined;
913
- max?: number | undefined;
914
- } | undefined;
915
- severity?: SeverityLevel | undefined;
916
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
917
- requiresRollback?: boolean | undefined;
918
- impactedServices?: string[] | undefined;
919
- };
920
- actions: ({
921
- type: RuleActionType.Suppress;
922
- } | {
923
- type: RuleActionType.Route;
924
- channel: string;
925
- } | {
926
- type: RuleActionType.Escalate;
927
- channel: string;
928
- } | {
929
- value: string;
930
- type: RuleActionType.Tag;
931
- key: string;
932
- })[];
933
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
934
- requiresRollback?: boolean | undefined;
935
- name?: string | undefined;
936
- }[] | undefined;
937
- }>;
938
- interface RuleConfiguration {
939
- [RuleEvaluationPhase.PreLlm]: RuleSection;
940
- [RuleEvaluationPhase.PostLlm]: RuleSection;
941
- }
942
- declare const RuleConfigurationSchema: z.ZodObject<{
943
- "pre-llm": z.ZodObject<{
944
- rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
945
- id: z.ZodString;
946
- name: z.ZodOptional<z.ZodString>;
947
- condition: z.ZodObject<{
948
- serviceName: z.ZodOptional<z.ZodString>;
949
- alertType: z.ZodOptional<z.ZodNativeEnum<typeof AlertType>>;
950
- severity: z.ZodOptional<z.ZodNativeEnum<typeof SeverityLevel>>;
951
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
952
- endpointPath: z.ZodOptional<z.ZodString>;
953
- alertCount: z.ZodOptional<z.ZodObject<{
954
- min: z.ZodOptional<z.ZodNumber>;
955
- max: z.ZodOptional<z.ZodNumber>;
956
- }, "strip", z.ZodTypeAny, {
957
- min?: number | undefined;
958
- max?: number | undefined;
959
- }, {
960
- min?: number | undefined;
961
- max?: number | undefined;
962
- }>>;
963
- latencyP99Ms: z.ZodOptional<z.ZodObject<{
964
- min: z.ZodOptional<z.ZodNumber>;
965
- max: z.ZodOptional<z.ZodNumber>;
966
- }, "strip", z.ZodTypeAny, {
967
- min?: number | undefined;
968
- max?: number | undefined;
969
- }, {
970
- min?: number | undefined;
971
- max?: number | undefined;
972
- }>>;
973
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
974
- requiresRollback: z.ZodOptional<z.ZodBoolean>;
975
- impactedServices: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
976
- }, "strip", z.ZodTypeAny, {
977
- serviceName?: string | undefined;
978
- alertType?: AlertType | undefined;
979
- endpointPath?: string | undefined;
980
- labels?: Record<string, string> | undefined;
981
- alertCount?: {
982
- min?: number | undefined;
983
- max?: number | undefined;
984
- } | undefined;
985
- latencyP99Ms?: {
986
- min?: number | undefined;
987
- max?: number | undefined;
988
- } | undefined;
989
- severity?: SeverityLevel | undefined;
990
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
991
- requiresRollback?: boolean | undefined;
992
- impactedServices?: string[] | undefined;
993
- }, {
994
- serviceName?: string | undefined;
995
- alertType?: AlertType | undefined;
996
- endpointPath?: string | undefined;
997
- labels?: Record<string, string> | undefined;
998
- alertCount?: {
999
- min?: number | undefined;
1000
- max?: number | undefined;
1001
- } | undefined;
1002
- latencyP99Ms?: {
1003
- min?: number | undefined;
1004
- max?: number | undefined;
1005
- } | undefined;
1006
- severity?: SeverityLevel | undefined;
1007
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1008
- requiresRollback?: boolean | undefined;
1009
- impactedServices?: string[] | undefined;
1010
- }>;
1011
- actions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1012
- type: z.ZodLiteral<RuleActionType.Suppress>;
1013
- }, "strip", z.ZodTypeAny, {
1014
- type: RuleActionType.Suppress;
1015
- }, {
1016
- type: RuleActionType.Suppress;
1017
- }>, z.ZodObject<{
1018
- type: z.ZodLiteral<RuleActionType.Route>;
1019
- channel: z.ZodString;
1020
- }, "strip", z.ZodTypeAny, {
1021
- type: RuleActionType.Route;
1022
- channel: string;
1023
- }, {
1024
- type: RuleActionType.Route;
1025
- channel: string;
1026
- }>, z.ZodObject<{
1027
- type: z.ZodLiteral<RuleActionType.Escalate>;
1028
- channel: z.ZodString;
1029
- }, "strip", z.ZodTypeAny, {
1030
- type: RuleActionType.Escalate;
1031
- channel: string;
1032
- }, {
1033
- type: RuleActionType.Escalate;
1034
- channel: string;
1035
- }>, z.ZodObject<{
1036
- type: z.ZodLiteral<RuleActionType.Tag>;
1037
- key: z.ZodString;
1038
- value: z.ZodString;
1039
- }, "strip", z.ZodTypeAny, {
1040
- value: string;
1041
- type: RuleActionType.Tag;
1042
- key: string;
1043
- }, {
1044
- value: string;
1045
- type: RuleActionType.Tag;
1046
- key: string;
1047
- }>]>, "many">;
1048
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
1049
- requiresRollback: z.ZodOptional<z.ZodBoolean>;
1050
- }, "strip", z.ZodTypeAny, {
1051
- id: string;
1052
- condition: {
1053
- serviceName?: string | undefined;
1054
- alertType?: AlertType | undefined;
1055
- endpointPath?: string | undefined;
1056
- labels?: Record<string, string> | undefined;
1057
- alertCount?: {
1058
- min?: number | undefined;
1059
- max?: number | undefined;
1060
- } | undefined;
1061
- latencyP99Ms?: {
1062
- min?: number | undefined;
1063
- max?: number | undefined;
1064
- } | undefined;
1065
- severity?: SeverityLevel | undefined;
1066
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1067
- requiresRollback?: boolean | undefined;
1068
- impactedServices?: string[] | undefined;
1069
- };
1070
- actions: ({
1071
- type: RuleActionType.Suppress;
1072
- } | {
1073
- type: RuleActionType.Route;
1074
- channel: string;
1075
- } | {
1076
- type: RuleActionType.Escalate;
1077
- channel: string;
1078
- } | {
1079
- value: string;
1080
- type: RuleActionType.Tag;
1081
- key: string;
1082
- })[];
1083
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1084
- requiresRollback?: boolean | undefined;
1085
- name?: string | undefined;
1086
- }, {
1087
- id: string;
1088
- condition: {
1089
- serviceName?: string | undefined;
1090
- alertType?: AlertType | undefined;
1091
- endpointPath?: string | undefined;
1092
- labels?: Record<string, string> | undefined;
1093
- alertCount?: {
1094
- min?: number | undefined;
1095
- max?: number | undefined;
1096
- } | undefined;
1097
- latencyP99Ms?: {
1098
- min?: number | undefined;
1099
- max?: number | undefined;
1100
- } | undefined;
1101
- severity?: SeverityLevel | undefined;
1102
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1103
- requiresRollback?: boolean | undefined;
1104
- impactedServices?: string[] | undefined;
1105
- };
1106
- actions: ({
1107
- type: RuleActionType.Suppress;
1108
- } | {
1109
- type: RuleActionType.Route;
1110
- channel: string;
1111
- } | {
1112
- type: RuleActionType.Escalate;
1113
- channel: string;
1114
- } | {
1115
- value: string;
1116
- type: RuleActionType.Tag;
1117
- key: string;
1118
- })[];
1119
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1120
- requiresRollback?: boolean | undefined;
1121
- name?: string | undefined;
1122
- }>, "many">>;
1123
- }, "strip", z.ZodTypeAny, {
1124
- rules: {
1125
- id: string;
1126
- condition: {
1127
- serviceName?: string | undefined;
1128
- alertType?: AlertType | undefined;
1129
- endpointPath?: string | undefined;
1130
- labels?: Record<string, string> | undefined;
1131
- alertCount?: {
1132
- min?: number | undefined;
1133
- max?: number | undefined;
1134
- } | undefined;
1135
- latencyP99Ms?: {
1136
- min?: number | undefined;
1137
- max?: number | undefined;
1138
- } | undefined;
1139
- severity?: SeverityLevel | undefined;
1140
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1141
- requiresRollback?: boolean | undefined;
1142
- impactedServices?: string[] | undefined;
1143
- };
1144
- actions: ({
1145
- type: RuleActionType.Suppress;
1146
- } | {
1147
- type: RuleActionType.Route;
1148
- channel: string;
1149
- } | {
1150
- type: RuleActionType.Escalate;
1151
- channel: string;
1152
- } | {
1153
- value: string;
1154
- type: RuleActionType.Tag;
1155
- key: string;
1156
- })[];
1157
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1158
- requiresRollback?: boolean | undefined;
1159
- name?: string | undefined;
1160
- }[];
1161
- }, {
1162
- rules?: {
1163
- id: string;
1164
- condition: {
1165
- serviceName?: string | undefined;
1166
- alertType?: AlertType | undefined;
1167
- endpointPath?: string | undefined;
1168
- labels?: Record<string, string> | undefined;
1169
- alertCount?: {
1170
- min?: number | undefined;
1171
- max?: number | undefined;
1172
- } | undefined;
1173
- latencyP99Ms?: {
1174
- min?: number | undefined;
1175
- max?: number | undefined;
1176
- } | undefined;
1177
- severity?: SeverityLevel | undefined;
1178
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1179
- requiresRollback?: boolean | undefined;
1180
- impactedServices?: string[] | undefined;
1181
- };
1182
- actions: ({
1183
- type: RuleActionType.Suppress;
1184
- } | {
1185
- type: RuleActionType.Route;
1186
- channel: string;
1187
- } | {
1188
- type: RuleActionType.Escalate;
1189
- channel: string;
1190
- } | {
1191
- value: string;
1192
- type: RuleActionType.Tag;
1193
- key: string;
1194
- })[];
1195
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1196
- requiresRollback?: boolean | undefined;
1197
- name?: string | undefined;
1198
- }[] | undefined;
1199
- }>;
1200
- "post-llm": z.ZodObject<{
1201
- rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
1202
- id: z.ZodString;
1203
- name: z.ZodOptional<z.ZodString>;
1204
- condition: z.ZodObject<{
1205
- serviceName: z.ZodOptional<z.ZodString>;
1206
- alertType: z.ZodOptional<z.ZodNativeEnum<typeof AlertType>>;
1207
- severity: z.ZodOptional<z.ZodNativeEnum<typeof SeverityLevel>>;
1208
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1209
- endpointPath: z.ZodOptional<z.ZodString>;
1210
- alertCount: z.ZodOptional<z.ZodObject<{
1211
- min: z.ZodOptional<z.ZodNumber>;
1212
- max: z.ZodOptional<z.ZodNumber>;
1213
- }, "strip", z.ZodTypeAny, {
1214
- min?: number | undefined;
1215
- max?: number | undefined;
1216
- }, {
1217
- min?: number | undefined;
1218
- max?: number | undefined;
1219
- }>>;
1220
- latencyP99Ms: z.ZodOptional<z.ZodObject<{
1221
- min: z.ZodOptional<z.ZodNumber>;
1222
- max: z.ZodOptional<z.ZodNumber>;
1223
- }, "strip", z.ZodTypeAny, {
1224
- min?: number | undefined;
1225
- max?: number | undefined;
1226
- }, {
1227
- min?: number | undefined;
1228
- max?: number | undefined;
1229
- }>>;
1230
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
1231
- requiresRollback: z.ZodOptional<z.ZodBoolean>;
1232
- impactedServices: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1233
- }, "strip", z.ZodTypeAny, {
1234
- serviceName?: string | undefined;
1235
- alertType?: AlertType | undefined;
1236
- endpointPath?: string | undefined;
1237
- labels?: Record<string, string> | undefined;
1238
- alertCount?: {
1239
- min?: number | undefined;
1240
- max?: number | undefined;
1241
- } | undefined;
1242
- latencyP99Ms?: {
1243
- min?: number | undefined;
1244
- max?: number | undefined;
1245
- } | undefined;
1246
- severity?: SeverityLevel | undefined;
1247
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1248
- requiresRollback?: boolean | undefined;
1249
- impactedServices?: string[] | undefined;
1250
- }, {
1251
- serviceName?: string | undefined;
1252
- alertType?: AlertType | undefined;
1253
- endpointPath?: string | undefined;
1254
- labels?: Record<string, string> | undefined;
1255
- alertCount?: {
1256
- min?: number | undefined;
1257
- max?: number | undefined;
1258
- } | undefined;
1259
- latencyP99Ms?: {
1260
- min?: number | undefined;
1261
- max?: number | undefined;
1262
- } | undefined;
1263
- severity?: SeverityLevel | undefined;
1264
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1265
- requiresRollback?: boolean | undefined;
1266
- impactedServices?: string[] | undefined;
1267
- }>;
1268
- actions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1269
- type: z.ZodLiteral<RuleActionType.Suppress>;
1270
- }, "strip", z.ZodTypeAny, {
1271
- type: RuleActionType.Suppress;
1272
- }, {
1273
- type: RuleActionType.Suppress;
1274
- }>, z.ZodObject<{
1275
- type: z.ZodLiteral<RuleActionType.Route>;
1276
- channel: z.ZodString;
1277
- }, "strip", z.ZodTypeAny, {
1278
- type: RuleActionType.Route;
1279
- channel: string;
1280
- }, {
1281
- type: RuleActionType.Route;
1282
- channel: string;
1283
- }>, z.ZodObject<{
1284
- type: z.ZodLiteral<RuleActionType.Escalate>;
1285
- channel: z.ZodString;
1286
- }, "strip", z.ZodTypeAny, {
1287
- type: RuleActionType.Escalate;
1288
- channel: string;
1289
- }, {
1290
- type: RuleActionType.Escalate;
1291
- channel: string;
1292
- }>, z.ZodObject<{
1293
- type: z.ZodLiteral<RuleActionType.Tag>;
1294
- key: z.ZodString;
1295
- value: z.ZodString;
1296
- }, "strip", z.ZodTypeAny, {
1297
- value: string;
1298
- type: RuleActionType.Tag;
1299
- key: string;
1300
- }, {
1301
- value: string;
1302
- type: RuleActionType.Tag;
1303
- key: string;
1304
- }>]>, "many">;
1305
- urgencyLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
1306
- requiresRollback: z.ZodOptional<z.ZodBoolean>;
1307
- }, "strip", z.ZodTypeAny, {
1308
- id: string;
1309
- condition: {
1310
- serviceName?: string | undefined;
1311
- alertType?: AlertType | undefined;
1312
- endpointPath?: string | undefined;
1313
- labels?: Record<string, string> | undefined;
1314
- alertCount?: {
1315
- min?: number | undefined;
1316
- max?: number | undefined;
1317
- } | undefined;
1318
- latencyP99Ms?: {
1319
- min?: number | undefined;
1320
- max?: number | undefined;
1321
- } | undefined;
1322
- severity?: SeverityLevel | undefined;
1323
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1324
- requiresRollback?: boolean | undefined;
1325
- impactedServices?: string[] | undefined;
1326
- };
1327
- actions: ({
1328
- type: RuleActionType.Suppress;
1329
- } | {
1330
- type: RuleActionType.Route;
1331
- channel: string;
1332
- } | {
1333
- type: RuleActionType.Escalate;
1334
- channel: string;
1335
- } | {
1336
- value: string;
1337
- type: RuleActionType.Tag;
1338
- key: string;
1339
- })[];
1340
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1341
- requiresRollback?: boolean | undefined;
1342
- name?: string | undefined;
1343
- }, {
1344
- id: string;
1345
- condition: {
1346
- serviceName?: string | undefined;
1347
- alertType?: AlertType | undefined;
1348
- endpointPath?: string | undefined;
1349
- labels?: Record<string, string> | undefined;
1350
- alertCount?: {
1351
- min?: number | undefined;
1352
- max?: number | undefined;
1353
- } | undefined;
1354
- latencyP99Ms?: {
1355
- min?: number | undefined;
1356
- max?: number | undefined;
1357
- } | undefined;
1358
- severity?: SeverityLevel | undefined;
1359
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1360
- requiresRollback?: boolean | undefined;
1361
- impactedServices?: string[] | undefined;
1362
- };
1363
- actions: ({
1364
- type: RuleActionType.Suppress;
1365
- } | {
1366
- type: RuleActionType.Route;
1367
- channel: string;
1368
- } | {
1369
- type: RuleActionType.Escalate;
1370
- channel: string;
1371
- } | {
1372
- value: string;
1373
- type: RuleActionType.Tag;
1374
- key: string;
1375
- })[];
1376
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1377
- requiresRollback?: boolean | undefined;
1378
- name?: string | undefined;
1379
- }>, "many">>;
1380
- }, "strip", z.ZodTypeAny, {
1381
- rules: {
1382
- id: string;
1383
- condition: {
1384
- serviceName?: string | undefined;
1385
- alertType?: AlertType | undefined;
1386
- endpointPath?: string | undefined;
1387
- labels?: Record<string, string> | undefined;
1388
- alertCount?: {
1389
- min?: number | undefined;
1390
- max?: number | undefined;
1391
- } | undefined;
1392
- latencyP99Ms?: {
1393
- min?: number | undefined;
1394
- max?: number | undefined;
1395
- } | undefined;
1396
- severity?: SeverityLevel | undefined;
1397
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1398
- requiresRollback?: boolean | undefined;
1399
- impactedServices?: string[] | undefined;
1400
- };
1401
- actions: ({
1402
- type: RuleActionType.Suppress;
1403
- } | {
1404
- type: RuleActionType.Route;
1405
- channel: string;
1406
- } | {
1407
- type: RuleActionType.Escalate;
1408
- channel: string;
1409
- } | {
1410
- value: string;
1411
- type: RuleActionType.Tag;
1412
- key: string;
1413
- })[];
1414
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1415
- requiresRollback?: boolean | undefined;
1416
- name?: string | undefined;
1417
- }[];
1418
- }, {
1419
- rules?: {
1420
- id: string;
1421
- condition: {
1422
- serviceName?: string | undefined;
1423
- alertType?: AlertType | undefined;
1424
- endpointPath?: string | undefined;
1425
- labels?: Record<string, string> | undefined;
1426
- alertCount?: {
1427
- min?: number | undefined;
1428
- max?: number | undefined;
1429
- } | undefined;
1430
- latencyP99Ms?: {
1431
- min?: number | undefined;
1432
- max?: number | undefined;
1433
- } | undefined;
1434
- severity?: SeverityLevel | undefined;
1435
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1436
- requiresRollback?: boolean | undefined;
1437
- impactedServices?: string[] | undefined;
1438
- };
1439
- actions: ({
1440
- type: RuleActionType.Suppress;
1441
- } | {
1442
- type: RuleActionType.Route;
1443
- channel: string;
1444
- } | {
1445
- type: RuleActionType.Escalate;
1446
- channel: string;
1447
- } | {
1448
- value: string;
1449
- type: RuleActionType.Tag;
1450
- key: string;
1451
- })[];
1452
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1453
- requiresRollback?: boolean | undefined;
1454
- name?: string | undefined;
1455
- }[] | undefined;
1456
- }>;
1457
- }, "strip", z.ZodTypeAny, {
1458
- "pre-llm": {
1459
- rules: {
1460
- id: string;
1461
- condition: {
1462
- serviceName?: string | undefined;
1463
- alertType?: AlertType | undefined;
1464
- endpointPath?: string | undefined;
1465
- labels?: Record<string, string> | undefined;
1466
- alertCount?: {
1467
- min?: number | undefined;
1468
- max?: number | undefined;
1469
- } | undefined;
1470
- latencyP99Ms?: {
1471
- min?: number | undefined;
1472
- max?: number | undefined;
1473
- } | undefined;
1474
- severity?: SeverityLevel | undefined;
1475
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1476
- requiresRollback?: boolean | undefined;
1477
- impactedServices?: string[] | undefined;
1478
- };
1479
- actions: ({
1480
- type: RuleActionType.Suppress;
1481
- } | {
1482
- type: RuleActionType.Route;
1483
- channel: string;
1484
- } | {
1485
- type: RuleActionType.Escalate;
1486
- channel: string;
1487
- } | {
1488
- value: string;
1489
- type: RuleActionType.Tag;
1490
- key: string;
1491
- })[];
1492
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1493
- requiresRollback?: boolean | undefined;
1494
- name?: string | undefined;
1495
- }[];
1496
- };
1497
- "post-llm": {
1498
- rules: {
1499
- id: string;
1500
- condition: {
1501
- serviceName?: string | undefined;
1502
- alertType?: AlertType | undefined;
1503
- endpointPath?: string | undefined;
1504
- labels?: Record<string, string> | undefined;
1505
- alertCount?: {
1506
- min?: number | undefined;
1507
- max?: number | undefined;
1508
- } | undefined;
1509
- latencyP99Ms?: {
1510
- min?: number | undefined;
1511
- max?: number | undefined;
1512
- } | undefined;
1513
- severity?: SeverityLevel | undefined;
1514
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1515
- requiresRollback?: boolean | undefined;
1516
- impactedServices?: string[] | undefined;
1517
- };
1518
- actions: ({
1519
- type: RuleActionType.Suppress;
1520
- } | {
1521
- type: RuleActionType.Route;
1522
- channel: string;
1523
- } | {
1524
- type: RuleActionType.Escalate;
1525
- channel: string;
1526
- } | {
1527
- value: string;
1528
- type: RuleActionType.Tag;
1529
- key: string;
1530
- })[];
1531
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1532
- requiresRollback?: boolean | undefined;
1533
- name?: string | undefined;
1534
- }[];
1535
- };
1536
- }, {
1537
- "pre-llm": {
1538
- rules?: {
1539
- id: string;
1540
- condition: {
1541
- serviceName?: string | undefined;
1542
- alertType?: AlertType | undefined;
1543
- endpointPath?: string | undefined;
1544
- labels?: Record<string, string> | undefined;
1545
- alertCount?: {
1546
- min?: number | undefined;
1547
- max?: number | undefined;
1548
- } | undefined;
1549
- latencyP99Ms?: {
1550
- min?: number | undefined;
1551
- max?: number | undefined;
1552
- } | undefined;
1553
- severity?: SeverityLevel | undefined;
1554
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1555
- requiresRollback?: boolean | undefined;
1556
- impactedServices?: string[] | undefined;
1557
- };
1558
- actions: ({
1559
- type: RuleActionType.Suppress;
1560
- } | {
1561
- type: RuleActionType.Route;
1562
- channel: string;
1563
- } | {
1564
- type: RuleActionType.Escalate;
1565
- channel: string;
1566
- } | {
1567
- value: string;
1568
- type: RuleActionType.Tag;
1569
- key: string;
1570
- })[];
1571
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1572
- requiresRollback?: boolean | undefined;
1573
- name?: string | undefined;
1574
- }[] | undefined;
1575
- };
1576
- "post-llm": {
1577
- rules?: {
1578
- id: string;
1579
- condition: {
1580
- serviceName?: string | undefined;
1581
- alertType?: AlertType | undefined;
1582
- endpointPath?: string | undefined;
1583
- labels?: Record<string, string> | undefined;
1584
- alertCount?: {
1585
- min?: number | undefined;
1586
- max?: number | undefined;
1587
- } | undefined;
1588
- latencyP99Ms?: {
1589
- min?: number | undefined;
1590
- max?: number | undefined;
1591
- } | undefined;
1592
- severity?: SeverityLevel | undefined;
1593
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1594
- requiresRollback?: boolean | undefined;
1595
- impactedServices?: string[] | undefined;
1596
- };
1597
- actions: ({
1598
- type: RuleActionType.Suppress;
1599
- } | {
1600
- type: RuleActionType.Route;
1601
- channel: string;
1602
- } | {
1603
- type: RuleActionType.Escalate;
1604
- channel: string;
1605
- } | {
1606
- value: string;
1607
- type: RuleActionType.Tag;
1608
- key: string;
1609
- })[];
1610
- urgencyLevel?: "critical" | "high" | "medium" | "low" | undefined;
1611
- requiresRollback?: boolean | undefined;
1612
- name?: string | undefined;
1613
- }[] | undefined;
1614
- };
1615
- }>;
466
+ impactedServices: z.ZodOptional<z.ZodArray<z.ZodString>>;
467
+ }, z.core.$strip>;
468
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
469
+ type: z.ZodLiteral<RuleActionType.Suppress>;
470
+ }, z.core.$strip>, z.ZodObject<{
471
+ type: z.ZodLiteral<RuleActionType.Route>;
472
+ channel: z.ZodString;
473
+ }, z.core.$strip>, z.ZodObject<{
474
+ type: z.ZodLiteral<RuleActionType.Escalate>;
475
+ channel: z.ZodString;
476
+ }, z.core.$strip>, z.ZodObject<{
477
+ type: z.ZodLiteral<RuleActionType.Tag>;
478
+ key: z.ZodString;
479
+ value: z.ZodString;
480
+ }, z.core.$strip>], "type">>;
481
+ urgencyLevel: z.ZodOptional<z.ZodEnum<{
482
+ critical: "critical";
483
+ high: "high";
484
+ low: "low";
485
+ medium: "medium";
486
+ }>>;
487
+ requiresRollback: z.ZodOptional<z.ZodBoolean>;
488
+ }, z.core.$strip>>>;
489
+ }, z.core.$strip>;
490
+ }, z.core.$strip>;
1616
491
  type ValidatedRuleCondition = z.infer<typeof RuleConditionSchema>;
1617
492
  type ValidatedRuleAction = z.infer<typeof RuleActionSchema>;
1618
493
  type ValidatedRule = z.infer<typeof RuleSchema>;
1619
494
  type ValidatedRuleSection = z.infer<typeof RuleSectionSchema>;
1620
495
  type ValidatedRuleConfiguration = z.infer<typeof RuleConfigurationSchema>;
1621
-
496
+ //#endregion
497
+ //#region src/domain/entities/traceability.d.ts
1622
498
  interface TraceabilityDocument {
1623
- '@timestamp': string;
1624
- uploadId?: string;
1625
- channel: string;
1626
- application: string;
1627
- messageType: string;
1628
- message: string;
1629
- originFlow?: string;
1630
- refId?: string;
1631
- fingerprint: string;
1632
- correlationId: string;
499
+ '@timestamp': string;
500
+ uploadId?: string;
501
+ channel: string;
502
+ application: string;
503
+ messageType: string;
504
+ message: string;
505
+ originFlow?: string;
506
+ refId?: string;
507
+ fingerprint: string;
508
+ correlationId: string;
1633
509
  }
1634
-
510
+ //#endregion
511
+ //#region src/domain/value-objects/fingerprint.d.ts
1635
512
  declare class Fingerprint {
1636
- readonly value: string;
1637
- private constructor();
1638
- static fromAlert(alert: NormalizedAlert): Fingerprint;
1639
- equals(other: Fingerprint): boolean;
1640
- toString(): string;
513
+ readonly value: string;
514
+ private constructor();
515
+ static fromAlert(alert: NormalizedAlert): Fingerprint;
516
+ equals(other: Fingerprint): boolean;
517
+ toString(): string;
518
+ }
519
+ //#endregion
520
+ //#region src/domain/ports/index.d.ts
521
+ /**
522
+ * Structured result of a deduplication check.
523
+ * Feeds the `dedup` section of the wide event.
524
+ */
525
+ interface DedupResult {
526
+ isNew: boolean;
527
+ ttlSeconds: number;
528
+ /** Fail-open error message when the store was unreachable (e.g. Redis down). */
529
+ error?: string;
1641
530
  }
1642
-
1643
531
  /**
1644
532
  * Deduplication store.
1645
533
  * Determines whether an alert fingerprint is new within a rolling TTL window.
1646
534
  * Implementations: RedisDeduplicationStore, InMemoryDeduplicationStore (tests)
1647
535
  */
1648
536
  interface IDeduplicationStore {
1649
- isNew(fingerprint: string, ttlSeconds: number): Promise<boolean>;
1650
- reset(fingerprint: string): Promise<void>;
537
+ isNew(fingerprint: string, ttlSeconds: number): Promise<DedupResult>;
538
+ reset(fingerprint: string): Promise<void>;
1651
539
  }
1652
540
  /**
1653
541
  * Alert queue.
@@ -1655,7 +543,7 @@ interface IDeduplicationStore {
1655
543
  * Implementations: SQSAlertQueue, BullMQAlertQueue, InMemoryAlertQueue (tests)
1656
544
  */
1657
545
  interface IAlertQueue {
1658
- publish(alert: NormalizedAlert): Promise<void>;
546
+ publish(alert: NormalizedAlert): Promise<void>;
1659
547
  }
1660
548
  /**
1661
549
  * Trace repository.
@@ -1663,7 +551,21 @@ interface IAlertQueue {
1663
551
  * Implementations: LokiTraceRepository, DatadogTraceRepository, MockTraceRepository (tests)
1664
552
  */
1665
553
  interface ITraceRepository {
1666
- findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
554
+ findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
555
+ }
556
+ /**
557
+ * Structured result of an LLM analysis call.
558
+ * Carries the diagnosis plus the observability metadata that feeds the
559
+ * `llm` section of the wide event (urgency comes from analysis.urgency_level;
560
+ * total tokens = promptTokens + completionTokens).
561
+ */
562
+ interface LLMResult {
563
+ analysis: LLMAnalysis;
564
+ provider: string;
565
+ model: string;
566
+ latencyMs: number;
567
+ promptTokens: number;
568
+ completionTokens: number;
1667
569
  }
1668
570
  /**
1669
571
  * LLM provider.
@@ -1671,7 +573,28 @@ interface ITraceRepository {
1671
573
  * Implementations: GeminiProvider, ClaudeProvider, OpenAIProvider, MockLLMProvider (tests)
1672
574
  */
1673
575
  interface ILLMProvider {
1674
- analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMAnalysis>;
576
+ analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMResult>;
577
+ }
578
+ /**
579
+ * Terminal outcome of a single notification send.
580
+ * Feeds the `notify` section of the wide event.
581
+ */
582
+ declare const NotifyOutcome: {
583
+ readonly Success: 'success';
584
+ readonly Failure: 'failure';
585
+ };
586
+ type NotifyOutcome = (typeof NotifyOutcome)[keyof typeof NotifyOutcome];
587
+ /**
588
+ * Structured result of a notification send.
589
+ * Adapters throw on failure (the caller records NotifyOutcome.Failure and
590
+ * rethrows for the queue retry), so a resolved promise always carries
591
+ * outcome=success.
592
+ */
593
+ interface NotifyResult {
594
+ outcome: NotifyOutcome;
595
+ latencyMs: number;
596
+ /** Concrete channels the notification was delivered to. */
597
+ channels: string[];
1675
598
  }
1676
599
  /**
1677
600
  * Notifier.
@@ -1679,14 +602,14 @@ interface ILLMProvider {
1679
602
  * Implementations: SlackNotifier, TeamsNotifier, ConsoleNotifier (local dev/tests)
1680
603
  */
1681
604
  interface INotifier {
1682
- /**
1683
- * Deliver an incident diagnosis to a ChatOps channel.
1684
- * @param channel — optional channel override for multi-channel routing.
1685
- * When provided, implementations MAY route to the specified channel
1686
- * instead of their default. Backward-compatible — existing call sites
1687
- * work unchanged.
1688
- */
1689
- send(cluster: AlertCluster, analysis: LLMAnalysis | null, channel?: string): Promise<void>;
605
+ /**
606
+ * Deliver an incident diagnosis to a ChatOps channel.
607
+ * @param channel — optional channel override for multi-channel routing.
608
+ * When provided, implementations MAY route to the specified channel
609
+ * instead of their default. Backward-compatible — existing call sites
610
+ * work unchanged.
611
+ */
612
+ send(cluster: AlertCluster, analysis: LLMAnalysis | null, channel?: string): Promise<NotifyResult>;
1690
613
  }
1691
614
  /**
1692
615
  * Indexer.
@@ -1694,49 +617,52 @@ interface INotifier {
1694
617
  * Implementations: OpenSearchIndexer, InMemoryIndexer (tests)
1695
618
  */
1696
619
  interface IIndexer<TDocument> {
1697
- index(doc: TDocument): Promise<void>;
620
+ index(doc: TDocument): Promise<void>;
1698
621
  }
1699
622
  /**
1700
623
  * Result of rule engine evaluation.
1701
624
  */
1702
625
  interface RuleActionResult {
1703
- suppressed: boolean;
1704
- actions: RuleAction[];
1705
- matchedRuleId?: string;
1706
- tags: Record<string, string>;
626
+ suppressed: boolean;
627
+ actions: RuleAction[];
628
+ matchedRuleId?: string;
629
+ tags: Record<string, string>;
1707
630
  }
1708
631
  /**
1709
632
  * Rule engine port — evaluates rules at pipeline hooks.
1710
633
  */
1711
634
  interface IRuleEngine {
1712
- /**
1713
- * PRE-LLM: evaluated after dedup, before LLM.
1714
- * Returns actions to apply, or suppressed=true if should not proceed.
1715
- */
1716
- evaluatePreLlm(cluster: AlertCluster): RuleActionResult;
1717
- /**
1718
- * POST-LLM: evaluated after LLM analysis.
1719
- * Returns additional actions based on analysis (escalate, tag, etc.).
1720
- */
1721
- evaluatePostLlm(cluster: AlertCluster, analysis: LLMAnalysis): RuleActionResult;
635
+ /**
636
+ * PRE-LLM: evaluated after dedup, before LLM.
637
+ * Returns actions to apply, or suppressed=true if should not proceed.
638
+ */
639
+ evaluatePreLlm(cluster: AlertCluster): RuleActionResult;
640
+ /**
641
+ * POST-LLM: evaluated after LLM analysis.
642
+ * Returns additional actions based on analysis (escalate, tag, etc.).
643
+ */
644
+ evaluatePostLlm(cluster: AlertCluster, analysis: LLMAnalysis): RuleActionResult;
1722
645
  }
1723
-
646
+ //#endregion
647
+ //#region src/domain/services/clustering.service.d.ts
1724
648
  declare class ClusteringService {
1725
- /**
1726
- * Groups alerts by fingerprint and builds AlertCluster objects.
1727
- * 300 alerts with the same root cause → 1 cluster with 2 representative traces.
1728
- */
1729
- buildClusters(alerts: NormalizedAlert[]): AlertCluster[];
1730
- private buildCluster;
1731
- private sampleTraceIds;
649
+ /**
650
+ * Groups alerts by fingerprint and builds AlertCluster objects.
651
+ * 300 alerts with the same root cause → 1 cluster with 2 representative traces.
652
+ */
653
+ buildClusters(alerts: NormalizedAlert[]): AlertCluster[];
654
+ private buildCluster;
655
+ private sampleTraceIds;
1732
656
  }
1733
-
657
+ //#endregion
658
+ //#region src/application/dtos/normalize-payload.d.ts
1734
659
  declare function normalizePayload(payload: AlertmanagerPayload): NormalizedAlert[];
1735
-
660
+ //#endregion
661
+ //#region src/shared/logger/index.d.ts
1736
662
  type Logger = pino.Logger;
1737
663
  interface LoggerOptions {
1738
- level?: string;
1739
- name?: string;
664
+ level?: string;
665
+ name?: string;
1740
666
  }
1741
667
  /**
1742
668
  * Returns a Proxy logger that always delegates to the current root logger.
@@ -1753,210 +679,165 @@ declare function createLogger(levelOrOptions?: string | LoggerOptions): Logger;
1753
679
  * reinitLogger(); // all module-level proxy loggers now write to Loki
1754
680
  */
1755
681
  declare function reinitLogger(opts?: LoggerOptions): void;
1756
-
682
+ //#endregion
683
+ //#region src/application/use-cases/process-incident.use-case.d.ts
1757
684
  interface Dependencies {
1758
- dedup: IDeduplicationStore;
1759
- traces: ITraceRepository;
1760
- llm: ILLMProvider;
1761
- notifier: INotifier;
1762
- logger: Logger;
1763
- dedupTtlSeconds: number;
1764
- clustering?: ClusteringService;
1765
- onClustersBuilt?: (count: number) => void;
1766
- ruleEngine?: IRuleEngine;
685
+ dedup: IDeduplicationStore;
686
+ traces: ITraceRepository;
687
+ llm: ILLMProvider;
688
+ notifier: INotifier;
689
+ logger: Logger;
690
+ dedupTtlSeconds: number;
691
+ clustering?: ClusteringService;
692
+ onClustersBuilt?: (count: number) => void;
693
+ ruleEngine?: IRuleEngine;
1767
694
  }
1768
695
  declare class ProcessIncidentUseCase {
1769
- private readonly deps;
1770
- private readonly clustering;
1771
- constructor(deps: Dependencies);
1772
- execute(alerts: NormalizedAlert[], correlationId: string): Promise<void>;
696
+ private readonly deps;
697
+ private readonly clustering;
698
+ private readonly wideEventsEnabled;
699
+ constructor(deps: Dependencies);
700
+ execute(alerts: NormalizedAlert[], correlationId: string): Promise<void>;
701
+ /**
702
+ * Flushes the builder into a final event, applies tail sampling, redacts
703
+ * PII, and emits the single canonical log line for the cluster.
704
+ */
705
+ private emit;
1773
706
  }
1774
-
707
+ //#endregion
708
+ //#region src/infrastructure/dedup/redis-dedup.adapter.d.ts
1775
709
  declare class RedisDeduplicationStore implements IDeduplicationStore {
1776
- private readonly redis;
1777
- private readonly keyPrefix;
1778
- constructor(redis: Redis);
1779
- isNew(fingerprint: string, ttlSeconds: number): Promise<boolean>;
1780
- reset(fingerprint: string): Promise<void>;
710
+ private readonly redis;
711
+ private readonly keyPrefix;
712
+ constructor(redis: Redis);
713
+ isNew(fingerprint: string, ttlSeconds: number): Promise<DedupResult>;
714
+ reset(fingerprint: string): Promise<void>;
1781
715
  }
1782
716
  declare class InMemoryDeduplicationStore implements IDeduplicationStore {
1783
- private readonly store;
1784
- isNew(fingerprint: string, ttlSeconds: number): Promise<boolean>;
1785
- reset(fingerprint: string): Promise<void>;
1786
- clear(): void;
717
+ private readonly store;
718
+ isNew(fingerprint: string, ttlSeconds: number): Promise<DedupResult>;
719
+ reset(fingerprint: string): Promise<void>;
720
+ clear(): void;
1787
721
  }
1788
-
722
+ //#endregion
723
+ //#region src/infrastructure/indexer/opensearch.adapter.d.ts
1789
724
  interface SignedHttpRequest {
1790
- method: string;
1791
- url: string;
1792
- headers: Record<string, string>;
1793
- body: string;
725
+ method: string;
726
+ url: string;
727
+ headers: Record<string, string>;
728
+ body: string;
1794
729
  }
1795
730
  interface OpenSearchHttpResponse {
1796
- status: number;
1797
- body: string;
731
+ status: number;
732
+ body: string;
1798
733
  }
1799
734
  type OpenSearchHttpFetcher = (request: SignedHttpRequest) => Promise<OpenSearchHttpResponse>;
1800
735
  interface OpenSearchIndexerDeps {
1801
- endpoint: string;
1802
- indexName: string;
1803
- region: string;
1804
- fetcher: OpenSearchHttpFetcher;
736
+ endpoint: string;
737
+ indexName: string;
738
+ region: string;
739
+ fetcher: OpenSearchHttpFetcher;
1805
740
  }
1806
741
  declare class OpenSearchIndexer implements IIndexer<TraceabilityDocument> {
1807
- private readonly endpoint;
1808
- private readonly indexName;
1809
- private readonly region;
1810
- private readonly fetcher;
1811
- constructor(deps: OpenSearchIndexerDeps);
1812
- index(doc: TraceabilityDocument): Promise<void>;
742
+ private readonly endpoint;
743
+ private readonly indexName;
744
+ private readonly region;
745
+ private readonly fetcher;
746
+ constructor(deps: OpenSearchIndexerDeps);
747
+ index(doc: TraceabilityDocument): Promise<void>;
1813
748
  }
1814
749
  declare class InMemoryIndexer implements IIndexer<TraceabilityDocument> {
1815
- readonly indexed: TraceabilityDocument[];
1816
- index(doc: TraceabilityDocument): Promise<void>;
750
+ readonly indexed: TraceabilityDocument[];
751
+ index(doc: TraceabilityDocument): Promise<void>;
1817
752
  }
1818
-
753
+ //#endregion
754
+ //#region src/infrastructure/llm/llm.adapter.d.ts
1819
755
  /**
1820
756
  * Gemini LLM provider using Google Generative AI SDK.
1821
757
  * Wrapped with circuit breaker for resilience.
1822
758
  */
1823
759
  declare class GeminiProvider implements ILLMProvider {
1824
- private readonly apiKey;
1825
- private readonly model;
1826
- private readonly breaker;
1827
- constructor(apiKey: string, model?: string);
1828
- analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMAnalysis>;
1829
- private analyzeRaw;
760
+ private readonly apiKey;
761
+ private readonly model;
762
+ private readonly breaker;
763
+ constructor(apiKey: string, model?: string);
764
+ analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMResult>;
765
+ private analyzeWithBreaker;
766
+ private analyzeRaw;
1830
767
  }
1831
768
  /**
1832
769
  * Claude LLM provider using Anthropic SDK.
1833
770
  * Supports Claude Haiku and other models.
1834
771
  */
1835
772
  declare class ClaudeProvider implements ILLMProvider {
1836
- private readonly apiKey;
1837
- private readonly model;
1838
- constructor(apiKey: string, model?: string);
1839
- analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMAnalysis>;
773
+ private readonly apiKey;
774
+ private readonly model;
775
+ constructor(apiKey: string, model?: string);
776
+ analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMResult>;
1840
777
  }
1841
778
  /**
1842
779
  * Mock LLM provider for testing and local development.
1843
780
  * Returns deterministic responses without external API calls.
1844
781
  */
1845
782
  declare class MockLLMProvider implements ILLMProvider {
1846
- readonly callLog: Array<{
1847
- cluster: AlertCluster;
1848
- }>;
1849
- analyze(cluster: AlertCluster, _traces: Record<string, unknown>[]): Promise<LLMAnalysis>;
783
+ readonly callLog: Array<{
784
+ cluster: AlertCluster;
785
+ }>;
786
+ analyze(cluster: AlertCluster, _traces: Record<string, unknown>[]): Promise<LLMResult>;
1850
787
  }
1851
788
  /**
1852
789
  * Options for configuring the OpenRouter fallback chain.
1853
790
  * Infra-internal — not exported.
1854
791
  */
1855
792
  interface FallbackOptions {
1856
- fallbackModels?: string[];
1857
- fallbackTimeoutMs?: number;
793
+ fallbackModels?: string[];
794
+ fallbackTimeoutMs?: number;
1858
795
  }
1859
796
  declare function createLLMProvider(provider: string, apiKey: string, model?: string, options?: FallbackOptions): ILLMProvider;
1860
-
1861
- declare const ConfigSchema: z.ZodEffects<z.ZodObject<{
1862
- llmProvider: z.ZodEnum<["gemini", "claude", "openrouter", "qwen"]>;
1863
- llmApiKey: z.ZodString;
1864
- llmModel: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
1865
- notifierType: z.ZodDefault<z.ZodEnum<["slack", "teams"]>>;
1866
- slackBotToken: z.ZodOptional<z.ZodString>;
1867
- slackSigningSecret: z.ZodOptional<z.ZodString>;
1868
- slackChannel: z.ZodOptional<z.ZodString>;
1869
- teamsWebhookUrl: z.ZodOptional<z.ZodString>;
1870
- lokiUrl: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
1871
- redisUrl: z.ZodString;
1872
- sqsQueueUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
1873
- dedupTtlSeconds: z.ZodDefault<z.ZodNumber>;
1874
- clusterWindowMs: z.ZodDefault<z.ZodNumber>;
1875
- logLevel: z.ZodDefault<z.ZodEnum<["trace", "debug", "info", "warn", "error"]>>;
1876
- nodeEnv: z.ZodDefault<z.ZodEnum<["development", "test", "production"]>>;
1877
- llmFallbackModels: z.ZodEffects<z.ZodOptional<z.ZodString>, string[], string | undefined>;
1878
- llmFallbackTimeoutMs: z.ZodDefault<z.ZodNumber>;
1879
- rulesConfigPath: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
1880
- }, "strip", z.ZodTypeAny, {
1881
- dedupTtlSeconds: number;
1882
- llmProvider: "gemini" | "claude" | "openrouter" | "qwen";
1883
- llmApiKey: string;
1884
- notifierType: "slack" | "teams";
1885
- redisUrl: string;
1886
- clusterWindowMs: number;
1887
- logLevel: "info" | "error" | "warn" | "debug" | "trace";
1888
- nodeEnv: "production" | "development" | "test";
1889
- llmFallbackModels: string[];
1890
- llmFallbackTimeoutMs: number;
1891
- llmModel?: string | undefined;
1892
- slackBotToken?: string | undefined;
1893
- slackSigningSecret?: string | undefined;
1894
- slackChannel?: string | undefined;
1895
- teamsWebhookUrl?: string | undefined;
1896
- lokiUrl?: string | undefined;
1897
- sqsQueueUrl?: string | undefined;
1898
- rulesConfigPath?: string | undefined;
1899
- }, {
1900
- llmProvider: "gemini" | "claude" | "openrouter" | "qwen";
1901
- llmApiKey: string;
1902
- redisUrl: string;
1903
- dedupTtlSeconds?: number | undefined;
1904
- llmModel?: string | undefined;
1905
- notifierType?: "slack" | "teams" | undefined;
1906
- slackBotToken?: string | undefined;
1907
- slackSigningSecret?: string | undefined;
1908
- slackChannel?: string | undefined;
1909
- teamsWebhookUrl?: string | undefined;
1910
- lokiUrl?: string | undefined;
1911
- sqsQueueUrl?: string | undefined;
1912
- clusterWindowMs?: number | undefined;
1913
- logLevel?: "info" | "error" | "warn" | "debug" | "trace" | undefined;
1914
- nodeEnv?: "production" | "development" | "test" | undefined;
1915
- llmFallbackModels?: string | undefined;
1916
- llmFallbackTimeoutMs?: number | undefined;
1917
- rulesConfigPath?: string | undefined;
1918
- }>, {
1919
- dedupTtlSeconds: number;
1920
- llmProvider: "gemini" | "claude" | "openrouter" | "qwen";
1921
- llmApiKey: string;
1922
- notifierType: "slack" | "teams";
1923
- redisUrl: string;
1924
- clusterWindowMs: number;
1925
- logLevel: "info" | "error" | "warn" | "debug" | "trace";
1926
- nodeEnv: "production" | "development" | "test";
1927
- llmFallbackModels: string[];
1928
- llmFallbackTimeoutMs: number;
1929
- llmModel?: string | undefined;
1930
- slackBotToken?: string | undefined;
1931
- slackSigningSecret?: string | undefined;
1932
- slackChannel?: string | undefined;
1933
- teamsWebhookUrl?: string | undefined;
1934
- lokiUrl?: string | undefined;
1935
- sqsQueueUrl?: string | undefined;
1936
- rulesConfigPath?: string | undefined;
1937
- }, {
1938
- llmProvider: "gemini" | "claude" | "openrouter" | "qwen";
1939
- llmApiKey: string;
1940
- redisUrl: string;
1941
- dedupTtlSeconds?: number | undefined;
1942
- llmModel?: string | undefined;
1943
- notifierType?: "slack" | "teams" | undefined;
1944
- slackBotToken?: string | undefined;
1945
- slackSigningSecret?: string | undefined;
1946
- slackChannel?: string | undefined;
1947
- teamsWebhookUrl?: string | undefined;
1948
- lokiUrl?: string | undefined;
1949
- sqsQueueUrl?: string | undefined;
1950
- clusterWindowMs?: number | undefined;
1951
- logLevel?: "info" | "error" | "warn" | "debug" | "trace" | undefined;
1952
- nodeEnv?: "production" | "development" | "test" | undefined;
1953
- llmFallbackModels?: string | undefined;
1954
- llmFallbackTimeoutMs?: number | undefined;
1955
- rulesConfigPath?: string | undefined;
1956
- }>;
797
+ //#endregion
798
+ //#region src/shared/config/index.d.ts
799
+ declare const ConfigSchema: z.ZodObject<{
800
+ llmProvider: z.ZodEnum<{
801
+ claude: "claude";
802
+ gemini: "gemini";
803
+ openrouter: "openrouter";
804
+ qwen: "qwen";
805
+ }>;
806
+ llmApiKey: z.ZodString;
807
+ llmModel: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
808
+ notifierType: z.ZodDefault<z.ZodEnum<{
809
+ slack: "slack";
810
+ teams: "teams";
811
+ }>>;
812
+ slackBotToken: z.ZodOptional<z.ZodString>;
813
+ slackSigningSecret: z.ZodOptional<z.ZodString>;
814
+ slackChannel: z.ZodOptional<z.ZodString>;
815
+ teamsWebhookUrl: z.ZodOptional<z.ZodString>;
816
+ lokiUrl: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
817
+ redisUrl: z.ZodString;
818
+ sqsQueueUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
819
+ dedupTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
820
+ clusterWindowMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
821
+ logLevel: z.ZodDefault<z.ZodEnum<{
822
+ debug: "debug";
823
+ error: "error";
824
+ info: "info";
825
+ trace: "trace";
826
+ warn: "warn";
827
+ }>>;
828
+ nodeEnv: z.ZodDefault<z.ZodEnum<{
829
+ development: "development";
830
+ production: "production";
831
+ test: "test";
832
+ }>>;
833
+ llmFallbackModels: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string[], string | undefined>>;
834
+ llmFallbackTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
835
+ rulesConfigPath: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
836
+ }, z.core.$strip>;
1957
837
  type Config = z.infer<typeof ConfigSchema>;
1958
838
  declare function loadConfig(): Promise<Config>;
1959
-
839
+ //#endregion
840
+ //#region src/infrastructure/notifier/factory.d.ts
1960
841
  /**
1961
842
  * Creates the notifier for the application.
1962
843
  *
@@ -1969,122 +850,130 @@ declare function loadConfig(): Promise<Config>;
1969
850
  * - Returns the default notifier directly (backward-compatible)
1970
851
  */
1971
852
  declare function createNotifier(config: Config): INotifier;
1972
-
853
+ //#endregion
854
+ //#region src/infrastructure/notifier/slack.adapter.d.ts
1973
855
  declare class SlackNotifier implements INotifier {
1974
- private readonly botToken;
1975
- private readonly channel;
1976
- constructor(botToken: string, channel: string);
1977
- send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<void>;
1978
- private buildAnalysisMessage;
1979
- private buildFallbackMessage;
856
+ private readonly botToken;
857
+ private readonly channel;
858
+ constructor(botToken: string, channel: string);
859
+ send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<NotifyResult>;
860
+ private buildAnalysisMessage;
861
+ private buildFallbackMessage;
1980
862
  }
1981
863
  declare class ConsoleNotifier implements INotifier {
1982
- readonly sent: Array<{
1983
- cluster: AlertCluster;
1984
- analysis: LLMAnalysis | null;
1985
- }>;
1986
- send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<void>;
864
+ readonly sent: Array<{
865
+ cluster: AlertCluster;
866
+ analysis: LLMAnalysis | null;
867
+ }>;
868
+ send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<NotifyResult>;
1987
869
  }
1988
-
870
+ //#endregion
871
+ //#region src/infrastructure/notifier/teams.adapter.d.ts
1989
872
  declare class TeamsNotifierError extends Error {
1990
- constructor(message: string);
873
+ constructor(message: string);
1991
874
  }
1992
875
  declare class TeamsNotifier implements INotifier {
1993
- private readonly webhookUrl;
1994
- private readonly timeoutMs;
1995
- private readonly hostForErrors;
1996
- constructor(webhookUrl: string, timeoutMs?: number);
1997
- send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<void>;
876
+ private readonly webhookUrl;
877
+ private readonly timeoutMs;
878
+ private readonly hostForErrors;
879
+ constructor(webhookUrl: string, timeoutMs?: number);
880
+ send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<NotifyResult>;
1998
881
  }
1999
-
882
+ //#endregion
883
+ //#region src/infrastructure/rules/channel-registry.d.ts
2000
884
  declare class ChannelRegistry {
2001
- private readonly _channels;
2002
- private _default;
2003
- /**
2004
- * Register a notifier for a given channel name.
2005
- * Overwrites any existing registration for that name.
2006
- */
2007
- register(channel: string, notifier: INotifier): void;
2008
- /**
2009
- * Set the default notifier to use when a channel is not found.
2010
- */
2011
- setDefault(notifier: INotifier): void;
2012
- /**
2013
- * Resolve a channel name to its notifier instance.
2014
- * Falls back to the default notifier if the channel is unknown.
2015
- *
2016
- * @throws {Error} if the channel is unknown and no default is set
2017
- */
2018
- resolve(channel: string): INotifier;
2019
- /**
2020
- * Check if a channel is registered.
2021
- */
2022
- has(channel: string): boolean;
885
+ private readonly _channels;
886
+ private _default;
887
+ /**
888
+ * Register a notifier for a given channel name.
889
+ * Overwrites any existing registration for that name.
890
+ */
891
+ register(channel: string, notifier: INotifier): void;
892
+ /**
893
+ * Set the default notifier to use when a channel is not found.
894
+ */
895
+ setDefault(notifier: INotifier): void;
896
+ /**
897
+ * Resolve a channel name to its notifier instance.
898
+ * Falls back to the default notifier if the channel is unknown.
899
+ *
900
+ * @throws {Error} if the channel is unknown and no default is set
901
+ */
902
+ resolve(channel: string): INotifier;
903
+ /**
904
+ * Check if a channel is registered.
905
+ */
906
+ has(channel: string): boolean;
2023
907
  }
2024
-
908
+ //#endregion
909
+ //#region src/infrastructure/notifier/routing-notifier.d.ts
2025
910
  declare class RoutingNotifier implements INotifier {
2026
- private readonly registry;
2027
- private readonly defaultNotifier;
2028
- constructor(registry: ChannelRegistry, defaultNotifier: INotifier);
2029
- /**
2030
- * Implements INotifier.send — sends via default notifier.
2031
- * Backward-compatible with existing call sites that don't use rule actions.
2032
- */
2033
- send(cluster: AlertCluster, analysis: LLMAnalysis | null): Promise<void>;
2034
- /**
2035
- * Dispatch notifications based on rule engine actions.
2036
- *
2037
- * - Route actions: send to the specified channel instead of default.
2038
- * - Escalate actions: send additional notifications to escalation channels.
2039
- * - Tag actions: metadata-only, no notification side effect.
2040
- * - Suppress actions: skip all notification (defensive — caller should have already skipped).
2041
- * - Unknown channels: fall back to default notifier.
2042
- * - Empty actions or no Route/Escalate: send via default notifier.
2043
- */
2044
- sendWithActions(cluster: AlertCluster, analysis: LLMAnalysis | null, actions: RuleAction[]): Promise<void>;
2045
- /**
2046
- * Resolve a channel name to its notifier and send.
2047
- * Falls back to default notifier if channel is unknown.
2048
- */
2049
- private tryResolveAndSend;
911
+ private readonly registry;
912
+ private readonly defaultNotifier;
913
+ constructor(registry: ChannelRegistry, defaultNotifier: INotifier);
914
+ /**
915
+ * Implements INotifier.send — sends via default notifier.
916
+ * Backward-compatible with existing call sites that don't use rule actions.
917
+ */
918
+ send(cluster: AlertCluster, analysis: LLMAnalysis | null): Promise<NotifyResult>;
919
+ /**
920
+ * Dispatch notifications based on rule engine actions.
921
+ *
922
+ * - Route actions: send to the specified channel instead of default.
923
+ * - Escalate actions: send additional notifications to escalation channels.
924
+ * - Tag actions: metadata-only, no notification side effect.
925
+ * - Suppress actions: skip all notification (defensive — caller should have already skipped).
926
+ * - Unknown channels: fall back to default notifier.
927
+ * - Empty actions or no Route/Escalate: send via default notifier.
928
+ */
929
+ sendWithActions(cluster: AlertCluster, analysis: LLMAnalysis | null, actions: RuleAction[]): Promise<void>;
930
+ /**
931
+ * Resolve a channel name to its notifier and send.
932
+ * Falls back to default notifier if channel is unknown.
933
+ */
934
+ private tryResolveAndSend;
2050
935
  }
2051
-
936
+ //#endregion
937
+ //#region src/infrastructure/queue/sqs.adapter.d.ts
2052
938
  interface SendMessageParams {
2053
- messageBody: string;
2054
- messageGroupId: string;
2055
- messageDeduplicationId: string;
939
+ messageBody: string;
940
+ messageGroupId: string;
941
+ messageDeduplicationId: string;
2056
942
  }
2057
943
  declare class SQSAlertQueue implements IAlertQueue {
2058
- private readonly queueUrl;
2059
- private readonly region?;
2060
- private sqsClient;
2061
- constructor(queueUrl: string, region?: string | undefined);
2062
- private getClient;
2063
- sendMessage(params: SendMessageParams): Promise<void>;
2064
- publish(alert: NormalizedAlert): Promise<void>;
944
+ private readonly queueUrl;
945
+ private readonly region?;
946
+ private sqsClient;
947
+ constructor(queueUrl: string, region?: string | undefined);
948
+ private getClient;
949
+ sendMessage(params: SendMessageParams): Promise<void>;
950
+ publish(alert: NormalizedAlert): Promise<void>;
2065
951
  }
2066
952
  declare class InMemoryAlertQueue implements IAlertQueue {
2067
- readonly published: NormalizedAlert[];
2068
- publish(alert: NormalizedAlert): Promise<void>;
953
+ readonly published: NormalizedAlert[];
954
+ publish(alert: NormalizedAlert): Promise<void>;
2069
955
  }
2070
-
956
+ //#endregion
957
+ //#region src/infrastructure/queue/sqs-lag-poller.d.ts
2071
958
  declare function startSqsLagPoller(queueUrl: string, intervalMs: number, region?: string): () => void;
2072
-
959
+ //#endregion
960
+ //#region src/infrastructure/traces/loki-trace.adapter.d.ts
2073
961
  declare class LokiTraceRepository implements ITraceRepository {
2074
- private readonly lokiUrl;
2075
- private readonly apiKey?;
2076
- constructor(lokiUrl: string, apiKey?: string | undefined);
2077
- findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
2078
- private parseResponse;
2079
- private tryParseJSON;
962
+ private readonly lokiUrl;
963
+ private readonly apiKey?;
964
+ constructor(lokiUrl: string, apiKey?: string | undefined);
965
+ findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
966
+ private parseResponse;
967
+ private tryParseJSON;
2080
968
  }
2081
969
  declare class MockTraceRepository implements ITraceRepository {
2082
- private readonly fixtures;
2083
- constructor(fixtures?: Map<string, Record<string, unknown>[]>);
2084
- findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
2085
- addFixture(traceId: string, spans: Record<string, unknown>[]): void;
970
+ private readonly fixtures;
971
+ constructor(fixtures?: Map<string, Record<string, unknown>[]>);
972
+ findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
973
+ addFixture(traceId: string, spans: Record<string, unknown>[]): void;
2086
974
  }
2087
-
975
+ //#endregion
976
+ //#region src/infrastructure/rules/yaml-rule-loader.d.ts
2088
977
  /**
2089
978
  * Parse and validate a YAML string into a RuleConfiguration.
2090
979
  * Pure function — no I/O, no side effects. Fast-fails on invalid config.
@@ -2092,7 +981,8 @@ declare class MockTraceRepository implements ITraceRepository {
2092
981
  * @throws {Error} if YAML is malformed or Zod validation fails
2093
982
  */
2094
983
  declare function parseRuleConfig(yamlString: string): ValidatedRuleConfiguration;
2095
-
984
+ //#endregion
985
+ //#region src/infrastructure/rules/condition-evaluator.d.ts
2096
986
  type Predicate = (cluster: AlertCluster, analysis?: LLMAnalysis) => boolean;
2097
987
  /**
2098
988
  * Compile a RuleCondition into a predicate function.
@@ -2103,7 +993,8 @@ type Predicate = (cluster: AlertCluster, analysis?: LLMAnalysis) => boolean;
2103
993
  * If no fields are specified, the predicate returns true (match-all).
2104
994
  */
2105
995
  declare function compileCondition(condition: ValidatedRuleCondition): Predicate;
2106
-
996
+ //#endregion
997
+ //#region src/infrastructure/rules/action-dispatcher.d.ts
2107
998
  /**
2108
999
  * Dispatch an array of RuleAction into a RuleActionResult.
2109
1000
  * All actions are processed in order.
@@ -2112,101 +1003,63 @@ declare function compileCondition(condition: ValidatedRuleCondition): Predicate;
2112
1003
  * Pure function — no I/O, no side effects beyond the returned result.
2113
1004
  */
2114
1005
  declare function dispatchActions(actions: RuleAction[]): RuleActionResult;
2115
-
1006
+ //#endregion
1007
+ //#region src/infrastructure/rules/rule-engine.d.ts
2116
1008
  declare class RuleEngine implements IRuleEngine {
2117
- private readonly preLlmRules;
2118
- private readonly postLlmRules;
2119
- constructor(config: ValidatedRuleConfiguration);
2120
- /**
2121
- * Evaluate PRE-LLM rules against a cluster.
2122
- * First-match-wins — returns result of first matching rule.
2123
- * If no rule matches, returns pass-through (suppressed=false, no actions).
2124
- */
2125
- evaluatePreLlm(cluster: AlertCluster): RuleActionResult;
2126
- /**
2127
- * Evaluate POST-LLM rules against a cluster and LLM analysis.
2128
- * First-match-wins — returns result of first matching rule.
2129
- * If no rule matches, returns pass-through.
2130
- */
2131
- evaluatePostLlm(cluster: AlertCluster, analysis: LLMAnalysis): RuleActionResult;
2132
- private compileSection;
2133
- private evaluateRules;
1009
+ private readonly preLlmRules;
1010
+ private readonly postLlmRules;
1011
+ constructor(config: ValidatedRuleConfiguration);
1012
+ /**
1013
+ * Evaluate PRE-LLM rules against a cluster.
1014
+ * First-match-wins — returns result of first matching rule.
1015
+ * If no rule matches, returns pass-through (suppressed=false, no actions).
1016
+ */
1017
+ evaluatePreLlm(cluster: AlertCluster): RuleActionResult;
1018
+ /**
1019
+ * Evaluate POST-LLM rules against a cluster and LLM analysis.
1020
+ * First-match-wins — returns result of first matching rule.
1021
+ * If no rule matches, returns pass-through.
1022
+ */
1023
+ evaluatePostLlm(cluster: AlertCluster, analysis: LLMAnalysis): RuleActionResult;
1024
+ private compileSection;
1025
+ private evaluateRules;
2134
1026
  }
2135
-
1027
+ //#endregion
1028
+ //#region src/shared/factory-registry.d.ts
2136
1029
  declare class FactoryRegistry<T> {
2137
- private readonly _factories;
2138
- private _default;
2139
- /**
2140
- * Register a factory for a given key.
2141
- * Overwrites any existing registration for that key.
2142
- */
2143
- register(key: string, factory: () => T): void;
2144
- /**
2145
- * Set the default factory to use when no key matches.
2146
- */
2147
- registerDefault(factory: () => T): void;
2148
- /**
2149
- * Resolve the factory for a given key.
2150
- * Returns the default if no specific factory is registered for that key.
2151
- */
2152
- resolve(key: string): T;
2153
- /**
2154
- * Check if a factory is registered for a given key.
2155
- */
2156
- has(key: string): boolean;
2157
- /**
2158
- * Return all registered keys.
2159
- */
2160
- keys(): string[];
1030
+ private readonly _factories;
1031
+ private _default;
1032
+ /**
1033
+ * Register a factory for a given key.
1034
+ * Overwrites any existing registration for that key.
1035
+ */
1036
+ register(key: string, factory: () => T): void;
1037
+ /**
1038
+ * Set the default factory to use when no key matches.
1039
+ */
1040
+ registerDefault(factory: () => T): void;
1041
+ /**
1042
+ * Resolve the factory for a given key.
1043
+ * Returns the default if no specific factory is registered for that key.
1044
+ */
1045
+ resolve(key: string): T;
1046
+ /**
1047
+ * Check if a factory is registered for a given key.
1048
+ */
1049
+ has(key: string): boolean;
1050
+ /**
1051
+ * Return all registered keys.
1052
+ */
1053
+ keys(): string[];
2161
1054
  }
2162
-
1055
+ //#endregion
1056
+ //#region src/shared/logger/loki-transport.d.ts
2163
1057
  /**
2164
1058
  * Flush all buffered log entries to Loki in a single HTTP request.
2165
1059
  * Call this at the END of the Lambda handler, after all business logic completes.
2166
1060
  * Errors are swallowed — Loki is best-effort; CloudWatch is the primary sink.
2167
1061
  */
2168
1062
  declare function flushLoki(): Promise<void>;
2169
-
2170
- declare const registry: Registry<"text/plain; version=0.0.4; charset=utf-8">;
2171
- declare const alertsReceived: Counter<"status">;
2172
- declare const webhookRequestsTotal: Counter<"status" | "endpoint">;
2173
- declare const alertsProcessed: Counter<"result">;
2174
- declare const alertClusters: Gauge<string>;
2175
- declare const latency: Histogram<"status">;
2176
- declare const llmInferenceDuration: Histogram<"model">;
2177
- declare const llmInferenceTotal: Counter<"status">;
2178
- /** Tracks inline pipeline failures in local dev mode. */
2179
- declare const pipelineInlineFailuresTotal: Counter<"reason">;
2180
- /** Tracks Redis dedup fallback activations. */
2181
- declare const dedupRedisFailoverTotal: Counter<string>;
2182
- /** Tracks new alert clusters (dedup: first-time fingerprint). */
2183
- declare const dedupNew: Counter<"source">;
2184
- /** Tracks duplicate alert clusters (dedup: fingerprint already seen). */
2185
- declare const dedupDuplicate: Counter<"source">;
2186
- /** Tracks outbound notification attempts by channel and outcome. */
2187
- declare const notificationsTotal: Counter<"channel" | "outcome">;
2188
- /** Tracks approximate number of unprocessed SQS messages (queue lag). */
2189
- declare const sqsQueueLag: Gauge<"queue_name">;
2190
- /** Tracks clusters suppressed by the rule engine, segmented by rule ID. */
2191
- declare const suppressedClusters: Gauge<"rule_id">;
2192
-
2193
- declare const index_alertClusters: typeof alertClusters;
2194
- declare const index_alertsProcessed: typeof alertsProcessed;
2195
- declare const index_alertsReceived: typeof alertsReceived;
2196
- declare const index_dedupDuplicate: typeof dedupDuplicate;
2197
- declare const index_dedupNew: typeof dedupNew;
2198
- declare const index_dedupRedisFailoverTotal: typeof dedupRedisFailoverTotal;
2199
- declare const index_latency: typeof latency;
2200
- declare const index_llmInferenceDuration: typeof llmInferenceDuration;
2201
- declare const index_llmInferenceTotal: typeof llmInferenceTotal;
2202
- declare const index_notificationsTotal: typeof notificationsTotal;
2203
- declare const index_pipelineInlineFailuresTotal: typeof pipelineInlineFailuresTotal;
2204
- declare const index_registry: typeof registry;
2205
- declare const index_sqsQueueLag: typeof sqsQueueLag;
2206
- declare const index_suppressedClusters: typeof suppressedClusters;
2207
- declare const index_webhookRequestsTotal: typeof webhookRequestsTotal;
2208
- declare namespace index {
2209
- export { index_alertClusters as alertClusters, index_alertsProcessed as alertsProcessed, index_alertsReceived as alertsReceived, index_dedupDuplicate as dedupDuplicate, index_dedupNew as dedupNew, index_dedupRedisFailoverTotal as dedupRedisFailoverTotal, index_latency as latency, index_llmInferenceDuration as llmInferenceDuration, index_llmInferenceTotal as llmInferenceTotal, index_notificationsTotal as notificationsTotal, index_pipelineInlineFailuresTotal as pipelineInlineFailuresTotal, index_registry as registry, index_sqsQueueLag as sqsQueueLag, index_suppressedClusters as suppressedClusters, index_webhookRequestsTotal as webhookRequestsTotal };
2210
- }
2211
-
2212
- export { ALERT_TYPE_LABELS, type AlertCluster, AlertClusterSchema, type AlertErrorType, type AlertStatus, AlertStatusSchema, AlertType, type AlertmanagerPayload, AlertmanagerPayloadSchema, CIRCUIT_BREAKER, ChannelRegistry, ClaudeProvider, ClusteringService, type Config, ConsoleNotifier, DEDUP_TTL_MS_MULTIPLIER, DEV_SERVER_PORT, FactoryRegistry, Fingerprint, GeminiProvider, HOUR_MS, HTTP_TIMEOUT_MS, type IAlertQueue, type IDeduplicationStore, type IIndexer, type ILLMProvider, type INotifier, type IRuleEngine, type ITraceRepository, InMemoryAlertQueue, InMemoryDeduplicationStore, InMemoryIndexer, type Incident, IncidentSchema, type LLMAnalysis, LLMAnalysisSchema, LLMProviderType, LLM_FALLBACK_DEFAULTS, LLM_MAX_TOKENS, LLM_MODELS, type Logger, type LoggerOptions, LokiTraceRepository, MockLLMProvider, MockTraceRepository, type NormalizedAlert, NormalizedAlertSchema, type OpenSearchHttpFetcher, type OpenSearchHttpResponse, OpenSearchIndexer, type OpenSearchIndexerDeps, PAYLOAD_DEFAULTS, ProcessIncidentUseCase, RATE_LIMITER, REDIS_KEY_PREFIX, RedisDeduplicationStore, RoutingNotifier, type Rule, type RuleAction, type RuleActionResult, RuleActionSchema, RuleActionType, type RuleCondition, RuleConditionSchema, type RuleConfiguration, RuleConfigurationSchema, RuleEngine, RuleEvaluationPhase, RuleSchema, type RuleSection, RuleSectionSchema, SLACK_API_URL, SQSAlertQueue, SeverityLevel, type SignedHttpRequest, SlackNotifier, TEAMS_WEBHOOK_TIMEOUT_MS, TeamsNotifier, TeamsNotifierError, type TraceabilityDocument, URGENCY_EMOJI, type UrgencyLevel, UrgencyLevelSchema, type ValidatedRule, type ValidatedRuleAction, type ValidatedRuleCondition, type ValidatedRuleConfiguration, type ValidatedRuleSection, WEBHOOK_DEFAULTS, compileCondition, createLLMProvider, createLogger, createNotifier, dispatchActions, flushLoki, loadConfig, index as metrics, normalizePayload, parseRuleConfig, reinitLogger, startSqsLagPoller };
1063
+ //#endregion
1064
+ export { ALERT_TYPE_LABELS, AlertCluster, AlertClusterSchema, AlertErrorType, AlertStatus, AlertStatusSchema, AlertType, AlertmanagerPayload, AlertmanagerPayloadSchema, CIRCUIT_BREAKER, ChannelRegistry, ClaudeProvider, ClusteringService, type Config, ConsoleNotifier, DEDUP_TTL_MS_MULTIPLIER, DEV_SERVER_PORT, type DedupResult, FactoryRegistry, Fingerprint, GeminiProvider, HOUR_MS, HTTP_TIMEOUT_MS, type IAlertQueue, type IDeduplicationStore, type IIndexer, type ILLMProvider, type INotifier, type IRuleEngine, type ITraceRepository, InMemoryAlertQueue, InMemoryDeduplicationStore, InMemoryIndexer, Incident, IncidentSchema, LLMAnalysis, LLMAnalysisSchema, LLMProviderType, type LLMResult, LLM_FALLBACK_DEFAULTS, LLM_MAX_TOKENS, LLM_MODELS, type Logger, type LoggerOptions, LokiTraceRepository, MockLLMProvider, MockTraceRepository, NormalizedAlert, NormalizedAlertSchema, NotifyOutcome, type NotifyResult, type OpenSearchHttpFetcher, type OpenSearchHttpResponse, OpenSearchIndexer, type OpenSearchIndexerDeps, PAYLOAD_DEFAULTS, ProcessIncidentUseCase, RATE_LIMITER, REDIS_KEY_PREFIX, RedisDeduplicationStore, RoutingNotifier, Rule, RuleAction, type RuleActionResult, RuleActionSchema, RuleActionType, RuleCondition, RuleConditionSchema, RuleConfiguration, RuleConfigurationSchema, RuleEngine, RuleEvaluationPhase, RuleSchema, RuleSection, RuleSectionSchema, SLACK_API_URL, SQSAlertQueue, SeverityLevel, type SignedHttpRequest, SlackNotifier, TEAMS_WEBHOOK_TIMEOUT_MS, TeamsNotifier, TeamsNotifierError, type TraceabilityDocument, URGENCY_EMOJI, UrgencyLevel, UrgencyLevelSchema, ValidatedRule, ValidatedRuleAction, ValidatedRuleCondition, ValidatedRuleConfiguration, ValidatedRuleSection, WEBHOOK_DEFAULTS, compileCondition, createLLMProvider, createLogger, createNotifier, dispatchActions, flushLoki, loadConfig, index_d_exports as metrics, normalizePayload, parseRuleConfig, reinitLogger, startSqsLagPoller };
1065
+ //# sourceMappingURL=index.d.ts.map