@junando/core 0.10.1 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +829 -577
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1877 -9909
- package/dist/index.js.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/shared/metrics/index.d.ts +29 -0
- package/dist/shared/metrics/index.d.ts.map +1 -0
- package/dist/shared/metrics/index.js +131 -0
- package/dist/shared/metrics/index.js.map +1 -0
- package/package.json +12 -11
- package/dist/chunk-3OJNTHWB.js +0 -225
- package/dist/chunk-5LNMHOUT.js +0 -229
- package/dist/chunk-72FU6SG6.js +0 -236
- package/dist/chunk-7SYJ764U.js +0 -579
- package/dist/chunk-AZU6S4RC.js +0 -11
- package/dist/chunk-BGPI5BQ5.js +0 -27
- package/dist/chunk-DKQSWD3S.js +0 -46
- package/dist/chunk-H4ND7Z4R.js +0 -504
- package/dist/chunk-HVICRLMN.js +0 -742
- package/dist/chunk-ID7PWYSN.js +0 -12
- package/dist/chunk-KU245W3C.js +0 -16
- package/dist/chunk-L67CO4EG.js +0 -1038
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-MQ4JUE6V.js +0 -447
- package/dist/chunk-N5AJP37P.js +0 -385
- package/dist/chunk-SIDCDO4Q.js +0 -1315
- package/dist/chunk-TDZF3WAT.js +0 -3824
- package/dist/chunk-VMBT3R2K.js +0 -0
- package/dist/chunk-WWHXKECU.js +0 -100
- package/dist/chunk-ZKH7AMP3.js +0 -42
- package/dist/chunk-ZOU3QHNL.js +0 -28
- package/dist/dist-es-CBFEDVZZ.js +0 -493
- package/dist/dist-es-ROXOWRKX.js +0 -22
- package/dist/dist-es-S3QCFNII.js +0 -327
- package/dist/dist-es-SQCUDQ4Y.js +0 -90
- package/dist/dist-es-UWOSB3KA.js +0 -72
- package/dist/dist-es-VXERFT35.js +0 -172
- package/dist/dist-es-Y44CAW7E.js +0 -385
- package/dist/event-streams-2IMLK3TK.js +0 -252
- package/dist/event-streams-NLZW3NHF.js +0 -1376
- package/dist/loadSso-T6VCDGCZ.js +0 -558
- package/dist/signin-BC6ZNJCV.js +0 -653
- package/dist/sso-oidc-PTS5E3NX.js +0 -793
- package/dist/sts-JSJ57UXB.js +0 -6108
package/dist/index.d.ts
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Error = "http_500",
|
|
9
|
+
Warning = "latency_spike",
|
|
10
|
+
Success = "recovery"
|
|
10
11
|
}
|
|
11
12
|
interface AlertTypeConfig {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
Gemini = "gemini",
|
|
21
|
+
Claude = "claude",
|
|
22
|
+
OpenRouter = "openrouter",
|
|
23
|
+
Qwen = "qwen"
|
|
23
24
|
}
|
|
24
25
|
declare const HTTP_TIMEOUT_MS: Readonly<{
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
Default: 5000;
|
|
27
|
+
LLM: 30000;
|
|
27
28
|
}>;
|
|
28
29
|
declare const CIRCUIT_BREAKER: Readonly<{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
36
|
-
|
|
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
|
-
|
|
43
|
-
|
|
43
|
+
TimeoutMs: 60000;
|
|
44
|
+
Models: string[];
|
|
44
45
|
}>;
|
|
45
46
|
declare const LLM_MODELS: Readonly<{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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,301 +54,478 @@ 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
|
-
|
|
57
|
-
|
|
57
|
+
AlertmanagerUrl: "http://localhost:9093";
|
|
58
|
+
WebhookUrl: "http://localhost:4000/webhook/alert";
|
|
58
59
|
}>;
|
|
59
60
|
declare const PAYLOAD_DEFAULTS: Readonly<{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
Version: "4";
|
|
62
|
+
TruncatedAlerts: 0;
|
|
63
|
+
Receiver: "junando";
|
|
63
64
|
}>;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
declare const
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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.
|
|
160
|
+
alertType: z.ZodEnum<typeof AlertType>;
|
|
181
161
|
endpointPath: z.ZodString;
|
|
182
162
|
alertCount: z.ZodNumber;
|
|
183
|
-
representativeTraceIds: z.ZodArray<z.ZodString
|
|
163
|
+
representativeTraceIds: z.ZodArray<z.ZodString>;
|
|
184
164
|
firstSeenAt: z.ZodString;
|
|
185
165
|
latencyP99Ms: z.ZodOptional<z.ZodNumber>;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
fingerprint: string;
|
|
197
|
-
serviceName: string;
|
|
198
|
-
alertType: AlertType;
|
|
199
|
-
endpointPath: string;
|
|
200
|
-
alertCount: number;
|
|
201
|
-
representativeTraceIds: string[];
|
|
202
|
-
firstSeenAt: string;
|
|
203
|
-
latencyP99Ms?: number | undefined;
|
|
204
|
-
}>;
|
|
205
|
-
type AlertCluster = z.infer<typeof AlertClusterSchema>;
|
|
206
|
-
|
|
207
|
-
declare const UrgencyLevelSchema: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
208
|
-
declare const LLMAnalysisSchema: z.ZodObject<{
|
|
166
|
+
severity: z.ZodOptional<z.ZodEnum<{
|
|
167
|
+
critical: "critical";
|
|
168
|
+
high: "high";
|
|
169
|
+
low: "low";
|
|
170
|
+
medium: "medium";
|
|
171
|
+
}>>;
|
|
172
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
173
|
+
}, z.core.$strip>;
|
|
174
|
+
traces: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
175
|
+
analysis: z.ZodOptional<z.ZodObject<{
|
|
209
176
|
probable_cause: z.ZodString;
|
|
210
|
-
impacted_services: z.ZodArray<z.ZodString
|
|
211
|
-
recommended_steps: z.ZodArray<z.ZodString
|
|
212
|
-
urgency_level: z.ZodEnum<
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
recommended_steps: string[];
|
|
218
|
-
urgency_level: "critical" | "high" | "medium" | "low";
|
|
219
|
-
requires_rollback: boolean;
|
|
220
|
-
}, {
|
|
221
|
-
probable_cause: string;
|
|
222
|
-
impacted_services: string[];
|
|
223
|
-
recommended_steps: string[];
|
|
224
|
-
urgency_level: "critical" | "high" | "medium" | "low";
|
|
225
|
-
requires_rollback: boolean;
|
|
226
|
-
}>;
|
|
227
|
-
declare const IncidentSchema: z.ZodObject<{
|
|
228
|
-
cluster: z.ZodObject<{
|
|
229
|
-
fingerprint: z.ZodString;
|
|
230
|
-
serviceName: z.ZodString;
|
|
231
|
-
alertType: z.ZodNativeEnum<typeof AlertType>;
|
|
232
|
-
endpointPath: z.ZodString;
|
|
233
|
-
alertCount: z.ZodNumber;
|
|
234
|
-
representativeTraceIds: z.ZodArray<z.ZodString, "many">;
|
|
235
|
-
firstSeenAt: z.ZodString;
|
|
236
|
-
latencyP99Ms: z.ZodOptional<z.ZodNumber>;
|
|
237
|
-
}, "strip", z.ZodTypeAny, {
|
|
238
|
-
fingerprint: string;
|
|
239
|
-
serviceName: string;
|
|
240
|
-
alertType: AlertType;
|
|
241
|
-
endpointPath: string;
|
|
242
|
-
alertCount: number;
|
|
243
|
-
representativeTraceIds: string[];
|
|
244
|
-
firstSeenAt: string;
|
|
245
|
-
latencyP99Ms?: number | undefined;
|
|
246
|
-
}, {
|
|
247
|
-
fingerprint: string;
|
|
248
|
-
serviceName: string;
|
|
249
|
-
alertType: AlertType;
|
|
250
|
-
endpointPath: string;
|
|
251
|
-
alertCount: number;
|
|
252
|
-
representativeTraceIds: string[];
|
|
253
|
-
firstSeenAt: string;
|
|
254
|
-
latencyP99Ms?: number | 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";
|
|
255
184
|
}>;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
recommended_steps: z.ZodArray<z.ZodString, "many">;
|
|
261
|
-
urgency_level: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
262
|
-
requires_rollback: z.ZodBoolean;
|
|
263
|
-
}, "strip", z.ZodTypeAny, {
|
|
264
|
-
probable_cause: string;
|
|
265
|
-
impacted_services: string[];
|
|
266
|
-
recommended_steps: string[];
|
|
267
|
-
urgency_level: "critical" | "high" | "medium" | "low";
|
|
268
|
-
requires_rollback: boolean;
|
|
269
|
-
}, {
|
|
270
|
-
probable_cause: string;
|
|
271
|
-
impacted_services: string[];
|
|
272
|
-
recommended_steps: string[];
|
|
273
|
-
urgency_level: "critical" | "high" | "medium" | "low";
|
|
274
|
-
requires_rollback: boolean;
|
|
275
|
-
}>>;
|
|
276
|
-
processedAt: z.ZodString;
|
|
277
|
-
}, "strip", z.ZodTypeAny, {
|
|
278
|
-
cluster: {
|
|
279
|
-
fingerprint: string;
|
|
280
|
-
serviceName: string;
|
|
281
|
-
alertType: AlertType;
|
|
282
|
-
endpointPath: string;
|
|
283
|
-
alertCount: number;
|
|
284
|
-
representativeTraceIds: string[];
|
|
285
|
-
firstSeenAt: string;
|
|
286
|
-
latencyP99Ms?: number | undefined;
|
|
287
|
-
};
|
|
288
|
-
processedAt: string;
|
|
289
|
-
traces?: Record<string, unknown>[] | undefined;
|
|
290
|
-
analysis?: {
|
|
291
|
-
probable_cause: string;
|
|
292
|
-
impacted_services: string[];
|
|
293
|
-
recommended_steps: string[];
|
|
294
|
-
urgency_level: "critical" | "high" | "medium" | "low";
|
|
295
|
-
requires_rollback: boolean;
|
|
296
|
-
} | undefined;
|
|
297
|
-
}, {
|
|
298
|
-
cluster: {
|
|
299
|
-
fingerprint: string;
|
|
300
|
-
serviceName: string;
|
|
301
|
-
alertType: AlertType;
|
|
302
|
-
endpointPath: string;
|
|
303
|
-
alertCount: number;
|
|
304
|
-
representativeTraceIds: string[];
|
|
305
|
-
firstSeenAt: string;
|
|
306
|
-
latencyP99Ms?: number | undefined;
|
|
307
|
-
};
|
|
308
|
-
processedAt: string;
|
|
309
|
-
traces?: Record<string, unknown>[] | undefined;
|
|
310
|
-
analysis?: {
|
|
311
|
-
probable_cause: string;
|
|
312
|
-
impacted_services: string[];
|
|
313
|
-
recommended_steps: string[];
|
|
314
|
-
urgency_level: "critical" | "high" | "medium" | "low";
|
|
315
|
-
requires_rollback: boolean;
|
|
316
|
-
} | undefined;
|
|
317
|
-
}>;
|
|
185
|
+
requires_rollback: z.ZodBoolean;
|
|
186
|
+
}, z.core.$strip>>;
|
|
187
|
+
processedAt: z.ZodString;
|
|
188
|
+
}, z.core.$strip>;
|
|
318
189
|
type UrgencyLevel = z.infer<typeof UrgencyLevelSchema>;
|
|
319
190
|
type LLMAnalysis = z.infer<typeof LLMAnalysisSchema>;
|
|
320
191
|
type Incident = z.infer<typeof IncidentSchema>;
|
|
321
|
-
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/domain/entities/rule.d.ts
|
|
194
|
+
declare enum RuleActionType {
|
|
195
|
+
Suppress = "suppress",
|
|
196
|
+
Route = "route",
|
|
197
|
+
Escalate = "escalate",
|
|
198
|
+
Tag = "tag"
|
|
199
|
+
}
|
|
200
|
+
declare enum SeverityLevel {
|
|
201
|
+
Critical = "critical",
|
|
202
|
+
High = "high",
|
|
203
|
+
Medium = "medium",
|
|
204
|
+
Low = "low"
|
|
205
|
+
}
|
|
206
|
+
/** Rule evaluation points in the pipeline */
|
|
207
|
+
declare enum RuleEvaluationPhase {
|
|
208
|
+
PreLlm = "pre-llm",
|
|
209
|
+
PostLlm = "post-llm"
|
|
210
|
+
}
|
|
211
|
+
interface RuleCondition {
|
|
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[];
|
|
229
|
+
}
|
|
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<{
|
|
292
|
+
serviceName: z.ZodOptional<z.ZodString>;
|
|
293
|
+
alertType: z.ZodOptional<z.ZodEnum<typeof AlertType>>;
|
|
294
|
+
severity: z.ZodOptional<z.ZodEnum<typeof SeverityLevel>>;
|
|
295
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
296
|
+
endpointPath: z.ZodOptional<z.ZodString>;
|
|
297
|
+
alertCount: z.ZodOptional<z.ZodObject<{
|
|
298
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
299
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
300
|
+
}, z.core.$strip>>;
|
|
301
|
+
latencyP99Ms: z.ZodOptional<z.ZodObject<{
|
|
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";
|
|
310
|
+
}>>;
|
|
311
|
+
requiresRollback: z.ZodOptional<z.ZodBoolean>;
|
|
312
|
+
impactedServices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
313
|
+
}, z.core.$strip>;
|
|
314
|
+
actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
315
|
+
type: z.ZodLiteral<RuleActionType.Suppress>;
|
|
316
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
317
|
+
type: z.ZodLiteral<RuleActionType.Route>;
|
|
318
|
+
channel: z.ZodString;
|
|
319
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
320
|
+
type: z.ZodLiteral<RuleActionType.Escalate>;
|
|
321
|
+
channel: z.ZodString;
|
|
322
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
323
|
+
type: z.ZodLiteral<RuleActionType.Tag>;
|
|
324
|
+
key: z.ZodString;
|
|
325
|
+
value: z.ZodString;
|
|
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[];
|
|
337
|
+
}
|
|
338
|
+
declare const RuleSectionSchema: z.ZodObject<{
|
|
339
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
340
|
+
id: z.ZodString;
|
|
341
|
+
name: z.ZodOptional<z.ZodString>;
|
|
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<{
|
|
397
|
+
serviceName: z.ZodOptional<z.ZodString>;
|
|
398
|
+
alertType: z.ZodOptional<z.ZodEnum<typeof AlertType>>;
|
|
399
|
+
severity: z.ZodOptional<z.ZodEnum<typeof SeverityLevel>>;
|
|
400
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
401
|
+
endpointPath: z.ZodOptional<z.ZodString>;
|
|
402
|
+
alertCount: z.ZodOptional<z.ZodObject<{
|
|
403
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
404
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
405
|
+
}, z.core.$strip>>;
|
|
406
|
+
latencyP99Ms: z.ZodOptional<z.ZodObject<{
|
|
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";
|
|
415
|
+
}>>;
|
|
416
|
+
requiresRollback: z.ZodOptional<z.ZodBoolean>;
|
|
417
|
+
impactedServices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
418
|
+
}, z.core.$strip>;
|
|
419
|
+
actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
420
|
+
type: z.ZodLiteral<RuleActionType.Suppress>;
|
|
421
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
422
|
+
type: z.ZodLiteral<RuleActionType.Route>;
|
|
423
|
+
channel: z.ZodString;
|
|
424
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
425
|
+
type: z.ZodLiteral<RuleActionType.Escalate>;
|
|
426
|
+
channel: z.ZodString;
|
|
427
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
428
|
+
type: z.ZodLiteral<RuleActionType.Tag>;
|
|
429
|
+
key: z.ZodString;
|
|
430
|
+
value: z.ZodString;
|
|
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<{
|
|
442
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
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
|
+
}>>;
|
|
465
|
+
requiresRollback: z.ZodOptional<z.ZodBoolean>;
|
|
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>;
|
|
491
|
+
type ValidatedRuleCondition = z.infer<typeof RuleConditionSchema>;
|
|
492
|
+
type ValidatedRuleAction = z.infer<typeof RuleActionSchema>;
|
|
493
|
+
type ValidatedRule = z.infer<typeof RuleSchema>;
|
|
494
|
+
type ValidatedRuleSection = z.infer<typeof RuleSectionSchema>;
|
|
495
|
+
type ValidatedRuleConfiguration = z.infer<typeof RuleConfigurationSchema>;
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region src/domain/entities/traceability.d.ts
|
|
322
498
|
interface TraceabilityDocument {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
|
|
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;
|
|
509
|
+
}
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/domain/value-objects/fingerprint.d.ts
|
|
335
512
|
declare class Fingerprint {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
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
|
|
343
521
|
/**
|
|
344
522
|
* Deduplication store.
|
|
345
523
|
* Determines whether an alert fingerprint is new within a rolling TTL window.
|
|
346
524
|
* Implementations: RedisDeduplicationStore, InMemoryDeduplicationStore (tests)
|
|
347
525
|
*/
|
|
348
526
|
interface IDeduplicationStore {
|
|
349
|
-
|
|
350
|
-
|
|
527
|
+
isNew(fingerprint: string, ttlSeconds: number): Promise<boolean>;
|
|
528
|
+
reset(fingerprint: string): Promise<void>;
|
|
351
529
|
}
|
|
352
530
|
/**
|
|
353
531
|
* Alert queue.
|
|
@@ -355,7 +533,7 @@ interface IDeduplicationStore {
|
|
|
355
533
|
* Implementations: SQSAlertQueue, BullMQAlertQueue, InMemoryAlertQueue (tests)
|
|
356
534
|
*/
|
|
357
535
|
interface IAlertQueue {
|
|
358
|
-
|
|
536
|
+
publish(alert: NormalizedAlert): Promise<void>;
|
|
359
537
|
}
|
|
360
538
|
/**
|
|
361
539
|
* Trace repository.
|
|
@@ -363,7 +541,7 @@ interface IAlertQueue {
|
|
|
363
541
|
* Implementations: LokiTraceRepository, DatadogTraceRepository, MockTraceRepository (tests)
|
|
364
542
|
*/
|
|
365
543
|
interface ITraceRepository {
|
|
366
|
-
|
|
544
|
+
findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
|
|
367
545
|
}
|
|
368
546
|
/**
|
|
369
547
|
* LLM provider.
|
|
@@ -371,7 +549,7 @@ interface ITraceRepository {
|
|
|
371
549
|
* Implementations: GeminiProvider, ClaudeProvider, OpenAIProvider, MockLLMProvider (tests)
|
|
372
550
|
*/
|
|
373
551
|
interface ILLMProvider {
|
|
374
|
-
|
|
552
|
+
analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMAnalysis>;
|
|
375
553
|
}
|
|
376
554
|
/**
|
|
377
555
|
* Notifier.
|
|
@@ -379,7 +557,14 @@ interface ILLMProvider {
|
|
|
379
557
|
* Implementations: SlackNotifier, TeamsNotifier, ConsoleNotifier (local dev/tests)
|
|
380
558
|
*/
|
|
381
559
|
interface INotifier {
|
|
382
|
-
|
|
560
|
+
/**
|
|
561
|
+
* Deliver an incident diagnosis to a ChatOps channel.
|
|
562
|
+
* @param channel — optional channel override for multi-channel routing.
|
|
563
|
+
* When provided, implementations MAY route to the specified channel
|
|
564
|
+
* instead of their default. Backward-compatible — existing call sites
|
|
565
|
+
* work unchanged.
|
|
566
|
+
*/
|
|
567
|
+
send(cluster: AlertCluster, analysis: LLMAnalysis | null, channel?: string): Promise<void>;
|
|
383
568
|
}
|
|
384
569
|
/**
|
|
385
570
|
* Indexer.
|
|
@@ -387,25 +572,52 @@ interface INotifier {
|
|
|
387
572
|
* Implementations: OpenSearchIndexer, InMemoryIndexer (tests)
|
|
388
573
|
*/
|
|
389
574
|
interface IIndexer<TDocument> {
|
|
390
|
-
|
|
575
|
+
index(doc: TDocument): Promise<void>;
|
|
391
576
|
}
|
|
392
|
-
|
|
577
|
+
/**
|
|
578
|
+
* Result of rule engine evaluation.
|
|
579
|
+
*/
|
|
580
|
+
interface RuleActionResult {
|
|
581
|
+
suppressed: boolean;
|
|
582
|
+
actions: RuleAction[];
|
|
583
|
+
matchedRuleId?: string;
|
|
584
|
+
tags: Record<string, string>;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Rule engine port — evaluates rules at pipeline hooks.
|
|
588
|
+
*/
|
|
589
|
+
interface IRuleEngine {
|
|
590
|
+
/**
|
|
591
|
+
* PRE-LLM: evaluated after dedup, before LLM.
|
|
592
|
+
* Returns actions to apply, or suppressed=true if should not proceed.
|
|
593
|
+
*/
|
|
594
|
+
evaluatePreLlm(cluster: AlertCluster): RuleActionResult;
|
|
595
|
+
/**
|
|
596
|
+
* POST-LLM: evaluated after LLM analysis.
|
|
597
|
+
* Returns additional actions based on analysis (escalate, tag, etc.).
|
|
598
|
+
*/
|
|
599
|
+
evaluatePostLlm(cluster: AlertCluster, analysis: LLMAnalysis): RuleActionResult;
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/domain/services/clustering.service.d.ts
|
|
393
603
|
declare class ClusteringService {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
|
|
604
|
+
/**
|
|
605
|
+
* Groups alerts by fingerprint and builds AlertCluster objects.
|
|
606
|
+
* 300 alerts with the same root cause → 1 cluster with 2 representative traces.
|
|
607
|
+
*/
|
|
608
|
+
buildClusters(alerts: NormalizedAlert[]): AlertCluster[];
|
|
609
|
+
private buildCluster;
|
|
610
|
+
private sampleTraceIds;
|
|
611
|
+
}
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region src/application/dtos/normalize-payload.d.ts
|
|
403
614
|
declare function normalizePayload(payload: AlertmanagerPayload): NormalizedAlert[];
|
|
404
|
-
|
|
615
|
+
//#endregion
|
|
616
|
+
//#region src/shared/logger/index.d.ts
|
|
405
617
|
type Logger = pino.Logger;
|
|
406
618
|
interface LoggerOptions {
|
|
407
|
-
|
|
408
|
-
|
|
619
|
+
level?: string;
|
|
620
|
+
name?: string;
|
|
409
621
|
}
|
|
410
622
|
/**
|
|
411
623
|
* Returns a Proxy logger that always delegates to the current root logger.
|
|
@@ -422,340 +634,380 @@ declare function createLogger(levelOrOptions?: string | LoggerOptions): Logger;
|
|
|
422
634
|
* reinitLogger(); // all module-level proxy loggers now write to Loki
|
|
423
635
|
*/
|
|
424
636
|
declare function reinitLogger(opts?: LoggerOptions): void;
|
|
425
|
-
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region src/application/use-cases/process-incident.use-case.d.ts
|
|
426
639
|
interface Dependencies {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
640
|
+
dedup: IDeduplicationStore;
|
|
641
|
+
traces: ITraceRepository;
|
|
642
|
+
llm: ILLMProvider;
|
|
643
|
+
notifier: INotifier;
|
|
644
|
+
logger: Logger;
|
|
645
|
+
dedupTtlSeconds: number;
|
|
646
|
+
clustering?: ClusteringService;
|
|
647
|
+
onClustersBuilt?: (count: number) => void;
|
|
648
|
+
ruleEngine?: IRuleEngine;
|
|
435
649
|
}
|
|
436
650
|
declare class ProcessIncidentUseCase {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
651
|
+
private readonly deps;
|
|
652
|
+
private readonly clustering;
|
|
653
|
+
constructor(deps: Dependencies);
|
|
654
|
+
execute(alerts: NormalizedAlert[], correlationId: string): Promise<void>;
|
|
441
655
|
}
|
|
442
|
-
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region src/infrastructure/dedup/redis-dedup.adapter.d.ts
|
|
443
658
|
declare class RedisDeduplicationStore implements IDeduplicationStore {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
659
|
+
private readonly redis;
|
|
660
|
+
private readonly keyPrefix;
|
|
661
|
+
constructor(redis: Redis);
|
|
662
|
+
isNew(fingerprint: string, ttlSeconds: number): Promise<boolean>;
|
|
663
|
+
reset(fingerprint: string): Promise<void>;
|
|
449
664
|
}
|
|
450
665
|
declare class InMemoryDeduplicationStore implements IDeduplicationStore {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
666
|
+
private readonly store;
|
|
667
|
+
isNew(fingerprint: string, ttlSeconds: number): Promise<boolean>;
|
|
668
|
+
reset(fingerprint: string): Promise<void>;
|
|
669
|
+
clear(): void;
|
|
455
670
|
}
|
|
456
|
-
|
|
671
|
+
//#endregion
|
|
672
|
+
//#region src/infrastructure/indexer/opensearch.adapter.d.ts
|
|
457
673
|
interface SignedHttpRequest {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
674
|
+
method: string;
|
|
675
|
+
url: string;
|
|
676
|
+
headers: Record<string, string>;
|
|
677
|
+
body: string;
|
|
462
678
|
}
|
|
463
679
|
interface OpenSearchHttpResponse {
|
|
464
|
-
|
|
465
|
-
|
|
680
|
+
status: number;
|
|
681
|
+
body: string;
|
|
466
682
|
}
|
|
467
683
|
type OpenSearchHttpFetcher = (request: SignedHttpRequest) => Promise<OpenSearchHttpResponse>;
|
|
468
684
|
interface OpenSearchIndexerDeps {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
685
|
+
endpoint: string;
|
|
686
|
+
indexName: string;
|
|
687
|
+
region: string;
|
|
688
|
+
fetcher: OpenSearchHttpFetcher;
|
|
473
689
|
}
|
|
474
690
|
declare class OpenSearchIndexer implements IIndexer<TraceabilityDocument> {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
691
|
+
private readonly endpoint;
|
|
692
|
+
private readonly indexName;
|
|
693
|
+
private readonly region;
|
|
694
|
+
private readonly fetcher;
|
|
695
|
+
constructor(deps: OpenSearchIndexerDeps);
|
|
696
|
+
index(doc: TraceabilityDocument): Promise<void>;
|
|
481
697
|
}
|
|
482
698
|
declare class InMemoryIndexer implements IIndexer<TraceabilityDocument> {
|
|
483
|
-
|
|
484
|
-
|
|
699
|
+
readonly indexed: TraceabilityDocument[];
|
|
700
|
+
index(doc: TraceabilityDocument): Promise<void>;
|
|
485
701
|
}
|
|
486
|
-
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region src/infrastructure/llm/llm.adapter.d.ts
|
|
487
704
|
/**
|
|
488
705
|
* Gemini LLM provider using Google Generative AI SDK.
|
|
489
706
|
* Wrapped with circuit breaker for resilience.
|
|
490
707
|
*/
|
|
491
708
|
declare class GeminiProvider implements ILLMProvider {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
709
|
+
private readonly apiKey;
|
|
710
|
+
private readonly model;
|
|
711
|
+
private readonly breaker;
|
|
712
|
+
constructor(apiKey: string, model?: string);
|
|
713
|
+
analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMAnalysis>;
|
|
714
|
+
private analyzeRaw;
|
|
498
715
|
}
|
|
499
716
|
/**
|
|
500
717
|
* Claude LLM provider using Anthropic SDK.
|
|
501
718
|
* Supports Claude Haiku and other models.
|
|
502
719
|
*/
|
|
503
720
|
declare class ClaudeProvider implements ILLMProvider {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
721
|
+
private readonly apiKey;
|
|
722
|
+
private readonly model;
|
|
723
|
+
constructor(apiKey: string, model?: string);
|
|
724
|
+
analyze(cluster: AlertCluster, traces: Record<string, unknown>[]): Promise<LLMAnalysis>;
|
|
508
725
|
}
|
|
509
726
|
/**
|
|
510
727
|
* Mock LLM provider for testing and local development.
|
|
511
728
|
* Returns deterministic responses without external API calls.
|
|
512
729
|
*/
|
|
513
730
|
declare class MockLLMProvider implements ILLMProvider {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
731
|
+
readonly callLog: Array<{
|
|
732
|
+
cluster: AlertCluster;
|
|
733
|
+
}>;
|
|
734
|
+
analyze(cluster: AlertCluster, _traces: Record<string, unknown>[]): Promise<LLMAnalysis>;
|
|
518
735
|
}
|
|
519
736
|
/**
|
|
520
737
|
* Options for configuring the OpenRouter fallback chain.
|
|
521
738
|
* Infra-internal — not exported.
|
|
522
739
|
*/
|
|
523
740
|
interface FallbackOptions {
|
|
524
|
-
|
|
525
|
-
|
|
741
|
+
fallbackModels?: string[];
|
|
742
|
+
fallbackTimeoutMs?: number;
|
|
526
743
|
}
|
|
527
744
|
declare function createLLMProvider(provider: string, apiKey: string, model?: string, options?: FallbackOptions): ILLMProvider;
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
redisUrl: string;
|
|
569
|
-
dedupTtlSeconds?: number | undefined;
|
|
570
|
-
llmModel?: string | undefined;
|
|
571
|
-
notifierType?: "slack" | "teams" | undefined;
|
|
572
|
-
slackBotToken?: string | undefined;
|
|
573
|
-
slackSigningSecret?: string | undefined;
|
|
574
|
-
slackChannel?: string | undefined;
|
|
575
|
-
teamsWebhookUrl?: string | undefined;
|
|
576
|
-
lokiUrl?: string | undefined;
|
|
577
|
-
sqsQueueUrl?: string | undefined;
|
|
578
|
-
clusterWindowMs?: number | undefined;
|
|
579
|
-
logLevel?: "info" | "error" | "warn" | "debug" | "trace" | undefined;
|
|
580
|
-
nodeEnv?: "production" | "development" | "test" | undefined;
|
|
581
|
-
llmFallbackModels?: string | undefined;
|
|
582
|
-
llmFallbackTimeoutMs?: number | undefined;
|
|
583
|
-
}>, {
|
|
584
|
-
dedupTtlSeconds: number;
|
|
585
|
-
llmProvider: "gemini" | "claude" | "openrouter" | "qwen";
|
|
586
|
-
llmApiKey: string;
|
|
587
|
-
notifierType: "slack" | "teams";
|
|
588
|
-
redisUrl: string;
|
|
589
|
-
clusterWindowMs: number;
|
|
590
|
-
logLevel: "info" | "error" | "warn" | "debug" | "trace";
|
|
591
|
-
nodeEnv: "production" | "development" | "test";
|
|
592
|
-
llmFallbackModels: string[];
|
|
593
|
-
llmFallbackTimeoutMs: number;
|
|
594
|
-
llmModel?: string | undefined;
|
|
595
|
-
slackBotToken?: string | undefined;
|
|
596
|
-
slackSigningSecret?: string | undefined;
|
|
597
|
-
slackChannel?: string | undefined;
|
|
598
|
-
teamsWebhookUrl?: string | undefined;
|
|
599
|
-
lokiUrl?: string | undefined;
|
|
600
|
-
sqsQueueUrl?: string | undefined;
|
|
601
|
-
}, {
|
|
602
|
-
llmProvider: "gemini" | "claude" | "openrouter" | "qwen";
|
|
603
|
-
llmApiKey: string;
|
|
604
|
-
redisUrl: string;
|
|
605
|
-
dedupTtlSeconds?: number | undefined;
|
|
606
|
-
llmModel?: string | undefined;
|
|
607
|
-
notifierType?: "slack" | "teams" | undefined;
|
|
608
|
-
slackBotToken?: string | undefined;
|
|
609
|
-
slackSigningSecret?: string | undefined;
|
|
610
|
-
slackChannel?: string | undefined;
|
|
611
|
-
teamsWebhookUrl?: string | undefined;
|
|
612
|
-
lokiUrl?: string | undefined;
|
|
613
|
-
sqsQueueUrl?: string | undefined;
|
|
614
|
-
clusterWindowMs?: number | undefined;
|
|
615
|
-
logLevel?: "info" | "error" | "warn" | "debug" | "trace" | undefined;
|
|
616
|
-
nodeEnv?: "production" | "development" | "test" | undefined;
|
|
617
|
-
llmFallbackModels?: string | undefined;
|
|
618
|
-
llmFallbackTimeoutMs?: number | undefined;
|
|
619
|
-
}>;
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region src/shared/config/index.d.ts
|
|
747
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
748
|
+
llmProvider: z.ZodEnum<{
|
|
749
|
+
claude: "claude";
|
|
750
|
+
gemini: "gemini";
|
|
751
|
+
openrouter: "openrouter";
|
|
752
|
+
qwen: "qwen";
|
|
753
|
+
}>;
|
|
754
|
+
llmApiKey: z.ZodString;
|
|
755
|
+
llmModel: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
756
|
+
notifierType: z.ZodDefault<z.ZodEnum<{
|
|
757
|
+
slack: "slack";
|
|
758
|
+
teams: "teams";
|
|
759
|
+
}>>;
|
|
760
|
+
slackBotToken: z.ZodOptional<z.ZodString>;
|
|
761
|
+
slackSigningSecret: z.ZodOptional<z.ZodString>;
|
|
762
|
+
slackChannel: z.ZodOptional<z.ZodString>;
|
|
763
|
+
teamsWebhookUrl: z.ZodOptional<z.ZodString>;
|
|
764
|
+
lokiUrl: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
765
|
+
redisUrl: z.ZodString;
|
|
766
|
+
sqsQueueUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
767
|
+
dedupTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
768
|
+
clusterWindowMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
769
|
+
logLevel: z.ZodDefault<z.ZodEnum<{
|
|
770
|
+
debug: "debug";
|
|
771
|
+
error: "error";
|
|
772
|
+
info: "info";
|
|
773
|
+
trace: "trace";
|
|
774
|
+
warn: "warn";
|
|
775
|
+
}>>;
|
|
776
|
+
nodeEnv: z.ZodDefault<z.ZodEnum<{
|
|
777
|
+
development: "development";
|
|
778
|
+
production: "production";
|
|
779
|
+
test: "test";
|
|
780
|
+
}>>;
|
|
781
|
+
llmFallbackModels: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string[], string | undefined>>;
|
|
782
|
+
llmFallbackTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
783
|
+
rulesConfigPath: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
784
|
+
}, z.core.$strip>;
|
|
620
785
|
type Config = z.infer<typeof ConfigSchema>;
|
|
621
786
|
declare function loadConfig(): Promise<Config>;
|
|
622
|
-
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region src/infrastructure/notifier/factory.d.ts
|
|
789
|
+
/**
|
|
790
|
+
* Creates the notifier for the application.
|
|
791
|
+
*
|
|
792
|
+
* When `config.rulesConfigPath` is set:
|
|
793
|
+
* - Reads and validates the rules YAML config
|
|
794
|
+
* - Creates a ChannelRegistry with the default notifier as fallback
|
|
795
|
+
* - Wraps the default notifier with a RoutingNotifier for multi-channel dispatch
|
|
796
|
+
*
|
|
797
|
+
* When `config.rulesConfigPath` is NOT set:
|
|
798
|
+
* - Returns the default notifier directly (backward-compatible)
|
|
799
|
+
*/
|
|
623
800
|
declare function createNotifier(config: Config): INotifier;
|
|
624
|
-
|
|
801
|
+
//#endregion
|
|
802
|
+
//#region src/infrastructure/notifier/slack.adapter.d.ts
|
|
625
803
|
declare class SlackNotifier implements INotifier {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
804
|
+
private readonly botToken;
|
|
805
|
+
private readonly channel;
|
|
806
|
+
constructor(botToken: string, channel: string);
|
|
807
|
+
send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<void>;
|
|
808
|
+
private buildAnalysisMessage;
|
|
809
|
+
private buildFallbackMessage;
|
|
632
810
|
}
|
|
633
811
|
declare class ConsoleNotifier implements INotifier {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
}
|
|
640
|
-
|
|
812
|
+
readonly sent: Array<{
|
|
813
|
+
cluster: AlertCluster;
|
|
814
|
+
analysis: LLMAnalysis | null;
|
|
815
|
+
}>;
|
|
816
|
+
send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<void>;
|
|
817
|
+
}
|
|
818
|
+
//#endregion
|
|
819
|
+
//#region src/infrastructure/notifier/teams.adapter.d.ts
|
|
641
820
|
declare class TeamsNotifierError extends Error {
|
|
642
|
-
|
|
821
|
+
constructor(message: string);
|
|
643
822
|
}
|
|
644
823
|
declare class TeamsNotifier implements INotifier {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
651
|
-
|
|
824
|
+
private readonly webhookUrl;
|
|
825
|
+
private readonly timeoutMs;
|
|
826
|
+
private readonly hostForErrors;
|
|
827
|
+
constructor(webhookUrl: string, timeoutMs?: number);
|
|
828
|
+
send(cluster: AlertCluster, analysis: LLMAnalysis | null, _channel?: string): Promise<void>;
|
|
829
|
+
}
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/infrastructure/rules/channel-registry.d.ts
|
|
832
|
+
declare class ChannelRegistry {
|
|
833
|
+
private readonly _channels;
|
|
834
|
+
private _default;
|
|
835
|
+
/**
|
|
836
|
+
* Register a notifier for a given channel name.
|
|
837
|
+
* Overwrites any existing registration for that name.
|
|
838
|
+
*/
|
|
839
|
+
register(channel: string, notifier: INotifier): void;
|
|
840
|
+
/**
|
|
841
|
+
* Set the default notifier to use when a channel is not found.
|
|
842
|
+
*/
|
|
843
|
+
setDefault(notifier: INotifier): void;
|
|
844
|
+
/**
|
|
845
|
+
* Resolve a channel name to its notifier instance.
|
|
846
|
+
* Falls back to the default notifier if the channel is unknown.
|
|
847
|
+
*
|
|
848
|
+
* @throws {Error} if the channel is unknown and no default is set
|
|
849
|
+
*/
|
|
850
|
+
resolve(channel: string): INotifier;
|
|
851
|
+
/**
|
|
852
|
+
* Check if a channel is registered.
|
|
853
|
+
*/
|
|
854
|
+
has(channel: string): boolean;
|
|
855
|
+
}
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/infrastructure/notifier/routing-notifier.d.ts
|
|
858
|
+
declare class RoutingNotifier implements INotifier {
|
|
859
|
+
private readonly registry;
|
|
860
|
+
private readonly defaultNotifier;
|
|
861
|
+
constructor(registry: ChannelRegistry, defaultNotifier: INotifier);
|
|
862
|
+
/**
|
|
863
|
+
* Implements INotifier.send — sends via default notifier.
|
|
864
|
+
* Backward-compatible with existing call sites that don't use rule actions.
|
|
865
|
+
*/
|
|
866
|
+
send(cluster: AlertCluster, analysis: LLMAnalysis | null): Promise<void>;
|
|
867
|
+
/**
|
|
868
|
+
* Dispatch notifications based on rule engine actions.
|
|
869
|
+
*
|
|
870
|
+
* - Route actions: send to the specified channel instead of default.
|
|
871
|
+
* - Escalate actions: send additional notifications to escalation channels.
|
|
872
|
+
* - Tag actions: metadata-only, no notification side effect.
|
|
873
|
+
* - Suppress actions: skip all notification (defensive — caller should have already skipped).
|
|
874
|
+
* - Unknown channels: fall back to default notifier.
|
|
875
|
+
* - Empty actions or no Route/Escalate: send via default notifier.
|
|
876
|
+
*/
|
|
877
|
+
sendWithActions(cluster: AlertCluster, analysis: LLMAnalysis | null, actions: RuleAction[]): Promise<void>;
|
|
878
|
+
/**
|
|
879
|
+
* Resolve a channel name to its notifier and send.
|
|
880
|
+
* Falls back to default notifier if channel is unknown.
|
|
881
|
+
*/
|
|
882
|
+
private tryResolveAndSend;
|
|
883
|
+
}
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region src/infrastructure/queue/sqs.adapter.d.ts
|
|
652
886
|
interface SendMessageParams {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
887
|
+
messageBody: string;
|
|
888
|
+
messageGroupId: string;
|
|
889
|
+
messageDeduplicationId: string;
|
|
656
890
|
}
|
|
657
891
|
declare class SQSAlertQueue implements IAlertQueue {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
892
|
+
private readonly queueUrl;
|
|
893
|
+
private readonly region?;
|
|
894
|
+
private sqsClient;
|
|
895
|
+
constructor(queueUrl: string, region?: string | undefined);
|
|
896
|
+
private getClient;
|
|
897
|
+
sendMessage(params: SendMessageParams): Promise<void>;
|
|
898
|
+
publish(alert: NormalizedAlert): Promise<void>;
|
|
665
899
|
}
|
|
666
900
|
declare class InMemoryAlertQueue implements IAlertQueue {
|
|
667
|
-
|
|
668
|
-
|
|
901
|
+
readonly published: NormalizedAlert[];
|
|
902
|
+
publish(alert: NormalizedAlert): Promise<void>;
|
|
669
903
|
}
|
|
670
|
-
|
|
904
|
+
//#endregion
|
|
905
|
+
//#region src/infrastructure/queue/sqs-lag-poller.d.ts
|
|
671
906
|
declare function startSqsLagPoller(queueUrl: string, intervalMs: number, region?: string): () => void;
|
|
672
|
-
|
|
907
|
+
//#endregion
|
|
908
|
+
//#region src/infrastructure/traces/loki-trace.adapter.d.ts
|
|
673
909
|
declare class LokiTraceRepository implements ITraceRepository {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
910
|
+
private readonly lokiUrl;
|
|
911
|
+
private readonly apiKey?;
|
|
912
|
+
constructor(lokiUrl: string, apiKey?: string | undefined);
|
|
913
|
+
findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
|
|
914
|
+
private parseResponse;
|
|
915
|
+
private tryParseJSON;
|
|
680
916
|
}
|
|
681
917
|
declare class MockTraceRepository implements ITraceRepository {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
918
|
+
private readonly fixtures;
|
|
919
|
+
constructor(fixtures?: Map<string, Record<string, unknown>[]>);
|
|
920
|
+
findByTraceId(traceId: string): Promise<Record<string, unknown>[]>;
|
|
921
|
+
addFixture(traceId: string, spans: Record<string, unknown>[]): void;
|
|
686
922
|
}
|
|
687
|
-
|
|
923
|
+
//#endregion
|
|
924
|
+
//#region src/infrastructure/rules/yaml-rule-loader.d.ts
|
|
925
|
+
/**
|
|
926
|
+
* Parse and validate a YAML string into a RuleConfiguration.
|
|
927
|
+
* Pure function — no I/O, no side effects. Fast-fails on invalid config.
|
|
928
|
+
*
|
|
929
|
+
* @throws {Error} if YAML is malformed or Zod validation fails
|
|
930
|
+
*/
|
|
931
|
+
declare function parseRuleConfig(yamlString: string): ValidatedRuleConfiguration;
|
|
932
|
+
//#endregion
|
|
933
|
+
//#region src/infrastructure/rules/condition-evaluator.d.ts
|
|
934
|
+
type Predicate = (cluster: AlertCluster, analysis?: LLMAnalysis) => boolean;
|
|
935
|
+
/**
|
|
936
|
+
* Compile a RuleCondition into a predicate function.
|
|
937
|
+
* The returned function can be called with (cluster, analysis?) to evaluate the condition.
|
|
938
|
+
* Pre-compilation ensures the field iteration and matcher assembly happen once at load time.
|
|
939
|
+
*
|
|
940
|
+
* All specified conditions must match (AND logic).
|
|
941
|
+
* If no fields are specified, the predicate returns true (match-all).
|
|
942
|
+
*/
|
|
943
|
+
declare function compileCondition(condition: ValidatedRuleCondition): Predicate;
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region src/infrastructure/rules/action-dispatcher.d.ts
|
|
946
|
+
/**
|
|
947
|
+
* Dispatch an array of RuleAction into a RuleActionResult.
|
|
948
|
+
* All actions are processed in order.
|
|
949
|
+
* The result accumulates: suppressed flag, route/escalate actions, and tags.
|
|
950
|
+
*
|
|
951
|
+
* Pure function — no I/O, no side effects beyond the returned result.
|
|
952
|
+
*/
|
|
953
|
+
declare function dispatchActions(actions: RuleAction[]): RuleActionResult;
|
|
954
|
+
//#endregion
|
|
955
|
+
//#region src/infrastructure/rules/rule-engine.d.ts
|
|
956
|
+
declare class RuleEngine implements IRuleEngine {
|
|
957
|
+
private readonly preLlmRules;
|
|
958
|
+
private readonly postLlmRules;
|
|
959
|
+
constructor(config: ValidatedRuleConfiguration);
|
|
960
|
+
/**
|
|
961
|
+
* Evaluate PRE-LLM rules against a cluster.
|
|
962
|
+
* First-match-wins — returns result of first matching rule.
|
|
963
|
+
* If no rule matches, returns pass-through (suppressed=false, no actions).
|
|
964
|
+
*/
|
|
965
|
+
evaluatePreLlm(cluster: AlertCluster): RuleActionResult;
|
|
966
|
+
/**
|
|
967
|
+
* Evaluate POST-LLM rules against a cluster and LLM analysis.
|
|
968
|
+
* First-match-wins — returns result of first matching rule.
|
|
969
|
+
* If no rule matches, returns pass-through.
|
|
970
|
+
*/
|
|
971
|
+
evaluatePostLlm(cluster: AlertCluster, analysis: LLMAnalysis): RuleActionResult;
|
|
972
|
+
private compileSection;
|
|
973
|
+
private evaluateRules;
|
|
974
|
+
}
|
|
975
|
+
//#endregion
|
|
976
|
+
//#region src/shared/factory-registry.d.ts
|
|
688
977
|
declare class FactoryRegistry<T> {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
}
|
|
714
|
-
|
|
978
|
+
private readonly _factories;
|
|
979
|
+
private _default;
|
|
980
|
+
/**
|
|
981
|
+
* Register a factory for a given key.
|
|
982
|
+
* Overwrites any existing registration for that key.
|
|
983
|
+
*/
|
|
984
|
+
register(key: string, factory: () => T): void;
|
|
985
|
+
/**
|
|
986
|
+
* Set the default factory to use when no key matches.
|
|
987
|
+
*/
|
|
988
|
+
registerDefault(factory: () => T): void;
|
|
989
|
+
/**
|
|
990
|
+
* Resolve the factory for a given key.
|
|
991
|
+
* Returns the default if no specific factory is registered for that key.
|
|
992
|
+
*/
|
|
993
|
+
resolve(key: string): T;
|
|
994
|
+
/**
|
|
995
|
+
* Check if a factory is registered for a given key.
|
|
996
|
+
*/
|
|
997
|
+
has(key: string): boolean;
|
|
998
|
+
/**
|
|
999
|
+
* Return all registered keys.
|
|
1000
|
+
*/
|
|
1001
|
+
keys(): string[];
|
|
1002
|
+
}
|
|
1003
|
+
//#endregion
|
|
1004
|
+
//#region src/shared/logger/loki-transport.d.ts
|
|
715
1005
|
/**
|
|
716
1006
|
* Flush all buffered log entries to Loki in a single HTTP request.
|
|
717
1007
|
* Call this at the END of the Lambda handler, after all business logic completes.
|
|
718
1008
|
* Errors are swallowed — Loki is best-effort; CloudWatch is the primary sink.
|
|
719
1009
|
*/
|
|
720
1010
|
declare function flushLoki(): Promise<void>;
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
declare const webhookRequestsTotal: Counter<"status" | "endpoint">;
|
|
725
|
-
declare const alertsProcessed: Counter<"result">;
|
|
726
|
-
declare const alertClusters: Gauge<string>;
|
|
727
|
-
declare const latency: Histogram<"status">;
|
|
728
|
-
declare const llmInferenceDuration: Histogram<"model">;
|
|
729
|
-
declare const llmInferenceTotal: Counter<"status">;
|
|
730
|
-
/** Tracks inline pipeline failures in local dev mode. */
|
|
731
|
-
declare const pipelineInlineFailuresTotal: Counter<"reason">;
|
|
732
|
-
/** Tracks Redis dedup fallback activations. */
|
|
733
|
-
declare const dedupRedisFailoverTotal: Counter<string>;
|
|
734
|
-
/** Tracks new alert clusters (dedup: first-time fingerprint). */
|
|
735
|
-
declare const dedupNew: Counter<"source">;
|
|
736
|
-
/** Tracks duplicate alert clusters (dedup: fingerprint already seen). */
|
|
737
|
-
declare const dedupDuplicate: Counter<"source">;
|
|
738
|
-
/** Tracks outbound notification attempts by channel and outcome. */
|
|
739
|
-
declare const notificationsTotal: Counter<"channel" | "outcome">;
|
|
740
|
-
/** Tracks approximate number of unprocessed SQS messages (queue lag). */
|
|
741
|
-
declare const sqsQueueLag: Gauge<"queue_name">;
|
|
742
|
-
|
|
743
|
-
declare const index_alertClusters: typeof alertClusters;
|
|
744
|
-
declare const index_alertsProcessed: typeof alertsProcessed;
|
|
745
|
-
declare const index_alertsReceived: typeof alertsReceived;
|
|
746
|
-
declare const index_dedupDuplicate: typeof dedupDuplicate;
|
|
747
|
-
declare const index_dedupNew: typeof dedupNew;
|
|
748
|
-
declare const index_dedupRedisFailoverTotal: typeof dedupRedisFailoverTotal;
|
|
749
|
-
declare const index_latency: typeof latency;
|
|
750
|
-
declare const index_llmInferenceDuration: typeof llmInferenceDuration;
|
|
751
|
-
declare const index_llmInferenceTotal: typeof llmInferenceTotal;
|
|
752
|
-
declare const index_notificationsTotal: typeof notificationsTotal;
|
|
753
|
-
declare const index_pipelineInlineFailuresTotal: typeof pipelineInlineFailuresTotal;
|
|
754
|
-
declare const index_registry: typeof registry;
|
|
755
|
-
declare const index_sqsQueueLag: typeof sqsQueueLag;
|
|
756
|
-
declare const index_webhookRequestsTotal: typeof webhookRequestsTotal;
|
|
757
|
-
declare namespace index {
|
|
758
|
-
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_webhookRequestsTotal as webhookRequestsTotal };
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
export { ALERT_TYPE_LABELS, type AlertCluster, AlertClusterSchema, type AlertErrorType, type AlertStatus, AlertStatusSchema, AlertType, type AlertmanagerPayload, AlertmanagerPayloadSchema, CIRCUIT_BREAKER, 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 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, SLACK_API_URL, SQSAlertQueue, type SignedHttpRequest, SlackNotifier, TEAMS_WEBHOOK_TIMEOUT_MS, TeamsNotifier, TeamsNotifierError, type TraceabilityDocument, URGENCY_EMOJI, type UrgencyLevel, UrgencyLevelSchema, WEBHOOK_DEFAULTS, createLLMProvider, createLogger, createNotifier, flushLoki, loadConfig, index as metrics, normalizePayload, reinitLogger, startSqsLagPoller };
|
|
1011
|
+
//#endregion
|
|
1012
|
+
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, 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, LLM_FALLBACK_DEFAULTS, LLM_MAX_TOKENS, LLM_MODELS, type Logger, type LoggerOptions, LokiTraceRepository, MockLLMProvider, MockTraceRepository, NormalizedAlert, NormalizedAlertSchema, 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 };
|
|
1013
|
+
//# sourceMappingURL=index.d.ts.map
|