vesper-memory 0.5.2 → 0.5.4
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/README.md +49 -14
- package/config/claude-rules/memory-discipline.md +39 -0
- package/config/claude-rules/vesper.md +218 -0
- package/dist/cli.js +59 -0
- package/dist/cli.js.map +1 -1
- package/package.json +1 -2
- package/dist/cli 2.js +0 -583
- package/dist/cli.d 2.ts +0 -8
- package/dist/cli.d.ts 2.map +0 -1
- package/dist/cli.js 2.map +0 -1
- package/dist/config 2/rate-limits.d.ts +0 -76
- package/dist/config 2/rate-limits.d.ts.map +0 -1
- package/dist/config 2/rate-limits.js +0 -161
- package/dist/config 2/rate-limits.js.map +0 -1
- package/dist/consolidation 2/pipeline.d.ts +0 -52
- package/dist/consolidation 2/pipeline.d.ts.map +0 -1
- package/dist/consolidation 2/pipeline.js +0 -193
- package/dist/consolidation 2/pipeline.js.map +0 -1
- package/dist/embeddings 2/client.d.ts +0 -94
- package/dist/embeddings 2/client.d.ts.map +0 -1
- package/dist/embeddings 2/client.js +0 -144
- package/dist/embeddings 2/client.js.map +0 -1
- package/dist/memory-layers 2/semantic-memory.d.ts +0 -33
- package/dist/memory-layers 2/semantic-memory.d.ts.map +0 -1
- package/dist/memory-layers 2/semantic-memory.js +0 -114
- package/dist/memory-layers 2/semantic-memory.js.map +0 -1
- package/dist/memory-layers 2/skill-library.d.ts +0 -25
- package/dist/memory-layers 2/skill-library.d.ts.map +0 -1
- package/dist/memory-layers 2/skill-library.js +0 -54
- package/dist/memory-layers 2/skill-library.js.map +0 -1
- package/dist/memory-layers 2/working-memory.d.ts +0 -57
- package/dist/memory-layers 2/working-memory.d.ts.map +0 -1
- package/dist/memory-layers 2/working-memory.js +0 -153
- package/dist/memory-layers 2/working-memory.js.map +0 -1
- package/dist/middleware 2/auth.d.ts +0 -287
- package/dist/middleware 2/auth.d.ts.map +0 -1
- package/dist/middleware 2/auth.js +0 -610
- package/dist/middleware 2/auth.js.map +0 -1
- package/dist/monitoring 2/health.d.ts +0 -241
- package/dist/monitoring 2/health.d.ts.map +0 -1
- package/dist/monitoring 2/health.js +0 -649
- package/dist/monitoring 2/health.js.map +0 -1
- package/dist/monitoring 2/metrics.d.ts +0 -153
- package/dist/monitoring 2/metrics.d.ts.map +0 -1
- package/dist/monitoring 2/metrics.js +0 -349
- package/dist/monitoring 2/metrics.js.map +0 -1
- package/dist/retrieval 2/hybrid-search.d.ts +0 -186
- package/dist/retrieval 2/hybrid-search.d.ts.map +0 -1
- package/dist/retrieval 2/hybrid-search.js +0 -327
- package/dist/retrieval 2/hybrid-search.js.map +0 -1
- package/dist/router 2/smart-router.d.ts +0 -111
- package/dist/router 2/smart-router.d.ts.map +0 -1
- package/dist/router 2/smart-router.js +0 -383
- package/dist/router 2/smart-router.js.map +0 -1
- package/dist/security 2/rate-limit-middleware.d.ts +0 -119
- package/dist/security 2/rate-limit-middleware.d.ts.map +0 -1
- package/dist/security 2/rate-limit-middleware.js +0 -193
- package/dist/security 2/rate-limit-middleware.js.map +0 -1
- package/dist/server 2.js +0 -861
- package/dist/server-wrapper 2.js +0 -170
- package/dist/server-wrapper.d 2.ts +0 -12
- package/dist/server-wrapper.d.ts 2.map +0 -1
- package/dist/server-wrapper.js 2.map +0 -1
- package/dist/server.d 2.ts +0 -14
- package/dist/server.d.ts 2.map +0 -1
- package/dist/server.js 2.map +0 -1
- package/dist/synthesis 2/conflict-detector.d.ts +0 -43
- package/dist/synthesis 2/conflict-detector.d.ts.map +0 -1
- package/dist/synthesis 2/conflict-detector.js +0 -125
- package/dist/synthesis 2/conflict-detector.js.map +0 -1
- package/dist/utils 2/monitoring.d.ts +0 -25
- package/dist/utils 2/monitoring.d.ts.map +0 -1
- package/dist/utils 2/monitoring.js +0 -41
- package/dist/utils 2/monitoring.js.map +0 -1
- package/dist/utils 2/rate-limiter.d.ts +0 -97
- package/dist/utils 2/rate-limiter.d.ts.map +0 -1
- package/dist/utils 2/rate-limiter.js +0 -166
- package/dist/utils 2/rate-limiter.js.map +0 -1
- package/dist/utils 2/validation.d.ts +0 -139
- package/dist/utils 2/validation.d.ts.map +0 -1
- package/dist/utils 2/validation.js +0 -195
- package/dist/utils 2/validation.js.map +0 -1
|
@@ -1,649 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Health Monitoring Module
|
|
3
|
-
*
|
|
4
|
-
* Provides health checks for system components including:
|
|
5
|
-
* - Certificate expiration monitoring
|
|
6
|
-
* - Service health checks
|
|
7
|
-
* - Resource utilization monitoring
|
|
8
|
-
*
|
|
9
|
-
* @module src/monitoring/health
|
|
10
|
-
*/
|
|
11
|
-
import * as fs from 'fs';
|
|
12
|
-
import * as tls from 'tls';
|
|
13
|
-
/**
|
|
14
|
-
* Parse PEM certificate and extract expiration date
|
|
15
|
-
*/
|
|
16
|
-
function parseCertificateExpiration(certPem) {
|
|
17
|
-
try {
|
|
18
|
-
// Use Node.js TLS to parse the certificate
|
|
19
|
-
const secureContext = tls.createSecureContext({ cert: certPem });
|
|
20
|
-
// Get certificate details - this is a simplified approach
|
|
21
|
-
// In production, use a library like node-forge for proper parsing
|
|
22
|
-
// For now, try to extract the notAfter field using regex
|
|
23
|
-
// This is a simplified implementation
|
|
24
|
-
const notAfterMatch = certPem.match(/Not After\s*:\s*(.+)/i);
|
|
25
|
-
if (notAfterMatch) {
|
|
26
|
-
return new Date(notAfterMatch[1]);
|
|
27
|
-
}
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Check certificate expiration from file
|
|
36
|
-
*
|
|
37
|
-
* @param options - Check options including cert path and thresholds
|
|
38
|
-
* @returns Certificate status with expiration information
|
|
39
|
-
*/
|
|
40
|
-
export async function checkCertificateExpiration(options) {
|
|
41
|
-
const { certPath, warningThresholdDays = 14, criticalThresholdDays = 7, mockExpirationDate, } = options;
|
|
42
|
-
// If mock date is provided (for testing), use it directly
|
|
43
|
-
if (mockExpirationDate) {
|
|
44
|
-
return calculateCertificateStatus(mockExpirationDate, warningThresholdDays, criticalThresholdDays);
|
|
45
|
-
}
|
|
46
|
-
// Try to read the certificate file
|
|
47
|
-
try {
|
|
48
|
-
if (!fs.existsSync(certPath)) {
|
|
49
|
-
return {
|
|
50
|
-
status: 'error',
|
|
51
|
-
daysUntilExpiration: 0,
|
|
52
|
-
expirationDate: null,
|
|
53
|
-
shouldAlert: true,
|
|
54
|
-
error: `Certificate file not found: ${certPath}`,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
const certPem = fs.readFileSync(certPath, 'utf-8');
|
|
58
|
-
const expirationDate = parseCertificateExpiration(certPem);
|
|
59
|
-
if (!expirationDate) {
|
|
60
|
-
return {
|
|
61
|
-
status: 'error',
|
|
62
|
-
daysUntilExpiration: 0,
|
|
63
|
-
expirationDate: null,
|
|
64
|
-
shouldAlert: true,
|
|
65
|
-
error: 'Could not parse certificate expiration date',
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return calculateCertificateStatus(expirationDate, warningThresholdDays, criticalThresholdDays);
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
return {
|
|
72
|
-
status: 'error',
|
|
73
|
-
daysUntilExpiration: 0,
|
|
74
|
-
expirationDate: null,
|
|
75
|
-
shouldAlert: true,
|
|
76
|
-
error: error instanceof Error ? error.message : 'Unknown error reading certificate',
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Check certificate expiration from remote host
|
|
82
|
-
*
|
|
83
|
-
* @param options - Check options including host and thresholds
|
|
84
|
-
* @returns Certificate status with expiration information
|
|
85
|
-
*/
|
|
86
|
-
export async function checkRemoteCertificateExpiration(options) {
|
|
87
|
-
const { host, port = 443, warningThresholdDays = 14, criticalThresholdDays = 7, timeoutMs = 5000, } = options;
|
|
88
|
-
return new Promise((resolve) => {
|
|
89
|
-
const socket = tls.connect(port, host, { rejectUnauthorized: false, servername: host }, () => {
|
|
90
|
-
const cert = socket.getPeerCertificate();
|
|
91
|
-
socket.end();
|
|
92
|
-
if (!cert || !cert.valid_to) {
|
|
93
|
-
resolve({
|
|
94
|
-
status: 'error',
|
|
95
|
-
daysUntilExpiration: 0,
|
|
96
|
-
expirationDate: null,
|
|
97
|
-
shouldAlert: true,
|
|
98
|
-
error: 'Could not retrieve certificate from server',
|
|
99
|
-
});
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const expirationDate = new Date(cert.valid_to);
|
|
103
|
-
resolve(calculateCertificateStatus(expirationDate, warningThresholdDays, criticalThresholdDays));
|
|
104
|
-
});
|
|
105
|
-
socket.setTimeout(timeoutMs, () => {
|
|
106
|
-
socket.destroy();
|
|
107
|
-
resolve({
|
|
108
|
-
status: 'error',
|
|
109
|
-
daysUntilExpiration: 0,
|
|
110
|
-
expirationDate: null,
|
|
111
|
-
shouldAlert: true,
|
|
112
|
-
error: `Connection timeout after ${timeoutMs}ms`,
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
socket.on('error', (error) => {
|
|
116
|
-
resolve({
|
|
117
|
-
status: 'error',
|
|
118
|
-
daysUntilExpiration: 0,
|
|
119
|
-
expirationDate: null,
|
|
120
|
-
shouldAlert: true,
|
|
121
|
-
error: error.message,
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Calculate certificate status based on expiration date and thresholds
|
|
128
|
-
*/
|
|
129
|
-
function calculateCertificateStatus(expirationDate, warningThresholdDays, criticalThresholdDays) {
|
|
130
|
-
const now = new Date();
|
|
131
|
-
const diffMs = expirationDate.getTime() - now.getTime();
|
|
132
|
-
const daysUntilExpiration = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
|
133
|
-
let status;
|
|
134
|
-
let shouldAlert;
|
|
135
|
-
if (daysUntilExpiration < 0) {
|
|
136
|
-
status = 'expired';
|
|
137
|
-
shouldAlert = true;
|
|
138
|
-
}
|
|
139
|
-
else if (daysUntilExpiration <= criticalThresholdDays) {
|
|
140
|
-
status = 'critical';
|
|
141
|
-
shouldAlert = true;
|
|
142
|
-
}
|
|
143
|
-
else if (daysUntilExpiration <= warningThresholdDays) {
|
|
144
|
-
status = 'warning';
|
|
145
|
-
shouldAlert = true;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
status = 'valid';
|
|
149
|
-
shouldAlert = false;
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
status,
|
|
153
|
-
daysUntilExpiration,
|
|
154
|
-
expirationDate,
|
|
155
|
-
shouldAlert,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Comprehensive health check for all services
|
|
160
|
-
*/
|
|
161
|
-
export async function runHealthChecks() {
|
|
162
|
-
const results = [];
|
|
163
|
-
// Check certificate expiration if configured
|
|
164
|
-
const certPath = process.env.SSL_CERT_PATH;
|
|
165
|
-
if (certPath) {
|
|
166
|
-
const certStatus = await checkCertificateExpiration({ certPath });
|
|
167
|
-
results.push({
|
|
168
|
-
name: 'ssl_certificate',
|
|
169
|
-
status: certStatus.status === 'valid' ? 'healthy' :
|
|
170
|
-
certStatus.status === 'warning' ? 'degraded' : 'unhealthy',
|
|
171
|
-
message: `Certificate ${certStatus.status}. Days until expiration: ${certStatus.daysUntilExpiration}`,
|
|
172
|
-
details: {
|
|
173
|
-
expirationDate: certStatus.expirationDate?.toISOString(),
|
|
174
|
-
daysUntilExpiration: certStatus.daysUntilExpiration,
|
|
175
|
-
shouldAlert: certStatus.shouldAlert,
|
|
176
|
-
},
|
|
177
|
-
timestamp: new Date(),
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
return results;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Send alert for certificate expiration
|
|
184
|
-
*/
|
|
185
|
-
export async function sendCertificateAlert(status, config) {
|
|
186
|
-
const message = formatAlertMessage(status);
|
|
187
|
-
// Log to stderr for monitoring
|
|
188
|
-
console.error(JSON.stringify({
|
|
189
|
-
type: 'certificate_alert',
|
|
190
|
-
level: status.status,
|
|
191
|
-
message,
|
|
192
|
-
expirationDate: status.expirationDate?.toISOString(),
|
|
193
|
-
daysUntilExpiration: status.daysUntilExpiration,
|
|
194
|
-
timestamp: new Date().toISOString(),
|
|
195
|
-
}));
|
|
196
|
-
// Slack notification
|
|
197
|
-
if (config.slackWebhook && status.shouldAlert) {
|
|
198
|
-
try {
|
|
199
|
-
await fetch(config.slackWebhook, {
|
|
200
|
-
method: 'POST',
|
|
201
|
-
headers: { 'Content-Type': 'application/json' },
|
|
202
|
-
body: JSON.stringify({
|
|
203
|
-
text: message,
|
|
204
|
-
attachments: [{
|
|
205
|
-
color: status.status === 'critical' || status.status === 'expired' ? 'danger' : 'warning',
|
|
206
|
-
fields: [
|
|
207
|
-
{ title: 'Status', value: status.status, short: true },
|
|
208
|
-
{ title: 'Days Remaining', value: status.daysUntilExpiration.toString(), short: true },
|
|
209
|
-
{ title: 'Expiration Date', value: status.expirationDate?.toISOString() || 'Unknown' },
|
|
210
|
-
],
|
|
211
|
-
}],
|
|
212
|
-
}),
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
catch (error) {
|
|
216
|
-
console.error('Failed to send Slack alert:', error);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Format alert message based on status
|
|
222
|
-
*/
|
|
223
|
-
function formatAlertMessage(status) {
|
|
224
|
-
switch (status.status) {
|
|
225
|
-
case 'expired':
|
|
226
|
-
return `[CRITICAL] SSL Certificate has EXPIRED! Immediate action required.`;
|
|
227
|
-
case 'critical':
|
|
228
|
-
return `[CRITICAL] SSL Certificate expires in ${status.daysUntilExpiration} days! Renew immediately.`;
|
|
229
|
-
case 'warning':
|
|
230
|
-
return `[WARNING] SSL Certificate expires in ${status.daysUntilExpiration} days. Plan renewal soon.`;
|
|
231
|
-
case 'error':
|
|
232
|
-
return `[ERROR] Could not check SSL certificate: ${status.error}`;
|
|
233
|
-
default:
|
|
234
|
-
return `SSL Certificate is valid for ${status.daysUntilExpiration} more days.`;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Start periodic certificate monitoring
|
|
239
|
-
*/
|
|
240
|
-
export function startCertificateMonitoring(options) {
|
|
241
|
-
const { intervalMs = 3600000, alertConfig = {}, ...checkOptions } = options; // Default: 1 hour
|
|
242
|
-
const check = async () => {
|
|
243
|
-
const status = await checkCertificateExpiration(checkOptions);
|
|
244
|
-
if (status.shouldAlert) {
|
|
245
|
-
await sendCertificateAlert(status, alertConfig);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
// Run initial check
|
|
249
|
-
check();
|
|
250
|
-
// Schedule periodic checks
|
|
251
|
-
return setInterval(check, intervalMs);
|
|
252
|
-
}
|
|
253
|
-
// ============================================================================
|
|
254
|
-
// NEW: Comprehensive Health Checker for Service Monitoring
|
|
255
|
-
// ============================================================================
|
|
256
|
-
import { createRequire } from "module";
|
|
257
|
-
import Redis from "ioredis";
|
|
258
|
-
const require = createRequire(import.meta.url);
|
|
259
|
-
/**
|
|
260
|
-
* HealthChecker class for comprehensive system health monitoring
|
|
261
|
-
*/
|
|
262
|
-
export class HealthChecker {
|
|
263
|
-
config;
|
|
264
|
-
options;
|
|
265
|
-
certExpiryDays = 90; // Default: 90 days
|
|
266
|
-
redisClient;
|
|
267
|
-
sqliteDb;
|
|
268
|
-
constructor(config, options = {}) {
|
|
269
|
-
this.config = config;
|
|
270
|
-
this.options = {
|
|
271
|
-
timeout: options.timeout ?? 5000,
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Set certificate expiry days (for testing or manual updates)
|
|
276
|
-
*/
|
|
277
|
-
setCertExpiryDays(days) {
|
|
278
|
-
this.certExpiryDays = days;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Perform comprehensive health check
|
|
282
|
-
*/
|
|
283
|
-
async check() {
|
|
284
|
-
const components = {};
|
|
285
|
-
// Check all configured components in parallel
|
|
286
|
-
const checks = [];
|
|
287
|
-
if (this.config.redis) {
|
|
288
|
-
checks.push(this.checkRedis().then((result) => {
|
|
289
|
-
components.redis = result;
|
|
290
|
-
}));
|
|
291
|
-
}
|
|
292
|
-
if (this.config.postgres) {
|
|
293
|
-
checks.push(this.checkPostgres().then((result) => {
|
|
294
|
-
components.postgres = result;
|
|
295
|
-
}));
|
|
296
|
-
}
|
|
297
|
-
if (this.config.sqlite) {
|
|
298
|
-
checks.push(this.checkSqlite().then((result) => {
|
|
299
|
-
components.sqlite = result;
|
|
300
|
-
}));
|
|
301
|
-
}
|
|
302
|
-
if (this.config.qdrant) {
|
|
303
|
-
checks.push(this.checkQdrant().then((result) => {
|
|
304
|
-
components.qdrant = result;
|
|
305
|
-
}));
|
|
306
|
-
}
|
|
307
|
-
if (this.config.embedding) {
|
|
308
|
-
checks.push(this.checkEmbedding().then((result) => {
|
|
309
|
-
components.embedding = result;
|
|
310
|
-
}));
|
|
311
|
-
}
|
|
312
|
-
// Wait for all checks to complete
|
|
313
|
-
await Promise.all(checks);
|
|
314
|
-
// Determine overall status
|
|
315
|
-
const status = this.determineOverallStatus(components);
|
|
316
|
-
// Get certificate status
|
|
317
|
-
const certificates = this.getCertificateHealthInfo();
|
|
318
|
-
return {
|
|
319
|
-
status,
|
|
320
|
-
timestamp: new Date().toISOString(),
|
|
321
|
-
components,
|
|
322
|
-
certificates,
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Check Redis connectivity
|
|
327
|
-
*/
|
|
328
|
-
async checkRedis() {
|
|
329
|
-
if (!this.config.redis) {
|
|
330
|
-
return { status: "unhealthy", latency_ms: 0, error: "Redis not configured" };
|
|
331
|
-
}
|
|
332
|
-
const startTime = performance.now();
|
|
333
|
-
try {
|
|
334
|
-
// Create a new connection with timeout
|
|
335
|
-
const client = new Redis({
|
|
336
|
-
host: this.config.redis.host,
|
|
337
|
-
port: this.config.redis.port,
|
|
338
|
-
password: this.config.redis.password,
|
|
339
|
-
connectTimeout: this.options.timeout,
|
|
340
|
-
lazyConnect: true,
|
|
341
|
-
maxRetriesPerRequest: 1,
|
|
342
|
-
});
|
|
343
|
-
// Set up a timeout promise
|
|
344
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
345
|
-
setTimeout(() => reject(new Error("Connection timeout")), this.options.timeout);
|
|
346
|
-
});
|
|
347
|
-
// Race between connection and timeout
|
|
348
|
-
await Promise.race([
|
|
349
|
-
client.connect().then(() => client.ping()),
|
|
350
|
-
timeoutPromise,
|
|
351
|
-
]);
|
|
352
|
-
const latency = performance.now() - startTime;
|
|
353
|
-
// Clean up connection
|
|
354
|
-
await client.quit();
|
|
355
|
-
return {
|
|
356
|
-
status: "healthy",
|
|
357
|
-
latency_ms: Math.round(latency),
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
catch (error) {
|
|
361
|
-
const latency = performance.now() - startTime;
|
|
362
|
-
return {
|
|
363
|
-
status: "unhealthy",
|
|
364
|
-
latency_ms: Math.round(latency),
|
|
365
|
-
error: error instanceof Error ? error.message : String(error),
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Check PostgreSQL connectivity
|
|
371
|
-
*/
|
|
372
|
-
async checkPostgres() {
|
|
373
|
-
if (!this.config.postgres) {
|
|
374
|
-
return { status: "unhealthy", latency_ms: 0, error: "PostgreSQL not configured" };
|
|
375
|
-
}
|
|
376
|
-
const startTime = performance.now();
|
|
377
|
-
try {
|
|
378
|
-
// Use TCP socket check for PostgreSQL
|
|
379
|
-
const net = await import("net");
|
|
380
|
-
const connected = await new Promise((resolve) => {
|
|
381
|
-
const socket = new net.Socket();
|
|
382
|
-
socket.setTimeout(this.options.timeout);
|
|
383
|
-
socket.on("connect", () => {
|
|
384
|
-
socket.destroy();
|
|
385
|
-
resolve(true);
|
|
386
|
-
});
|
|
387
|
-
socket.on("timeout", () => {
|
|
388
|
-
socket.destroy();
|
|
389
|
-
resolve(false);
|
|
390
|
-
});
|
|
391
|
-
socket.on("error", () => {
|
|
392
|
-
socket.destroy();
|
|
393
|
-
resolve(false);
|
|
394
|
-
});
|
|
395
|
-
socket.connect(this.config.postgres.port, this.config.postgres.host);
|
|
396
|
-
});
|
|
397
|
-
const latency = performance.now() - startTime;
|
|
398
|
-
if (connected) {
|
|
399
|
-
return {
|
|
400
|
-
status: "healthy",
|
|
401
|
-
latency_ms: Math.round(latency),
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
return {
|
|
406
|
-
status: "unhealthy",
|
|
407
|
-
latency_ms: Math.round(latency),
|
|
408
|
-
error: "Connection failed",
|
|
409
|
-
};
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
catch (error) {
|
|
413
|
-
const latency = performance.now() - startTime;
|
|
414
|
-
return {
|
|
415
|
-
status: "unhealthy",
|
|
416
|
-
latency_ms: Math.round(latency),
|
|
417
|
-
error: error instanceof Error ? error.message : String(error),
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Check SQLite connectivity
|
|
423
|
-
*/
|
|
424
|
-
async checkSqlite() {
|
|
425
|
-
if (!this.config.sqlite) {
|
|
426
|
-
return { status: "unhealthy", latency_ms: 0, error: "SQLite not configured" };
|
|
427
|
-
}
|
|
428
|
-
const startTime = performance.now();
|
|
429
|
-
try {
|
|
430
|
-
// For :memory: database, just create a test connection
|
|
431
|
-
const DatabaseConstructor = require("better-sqlite3");
|
|
432
|
-
const db = new DatabaseConstructor(this.config.sqlite.path);
|
|
433
|
-
// Run a simple query
|
|
434
|
-
const result = db.prepare("SELECT 1 as test").get();
|
|
435
|
-
db.close();
|
|
436
|
-
const latency = performance.now() - startTime;
|
|
437
|
-
if (result && result.test === 1) {
|
|
438
|
-
return {
|
|
439
|
-
status: "healthy",
|
|
440
|
-
latency_ms: Math.round(latency),
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
return {
|
|
445
|
-
status: "unhealthy",
|
|
446
|
-
latency_ms: Math.round(latency),
|
|
447
|
-
error: "Query failed",
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
catch (error) {
|
|
452
|
-
const latency = performance.now() - startTime;
|
|
453
|
-
return {
|
|
454
|
-
status: "unhealthy",
|
|
455
|
-
latency_ms: Math.round(latency),
|
|
456
|
-
error: error instanceof Error ? error.message : String(error),
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Check Qdrant connectivity
|
|
462
|
-
*/
|
|
463
|
-
async checkQdrant() {
|
|
464
|
-
if (!this.config.qdrant) {
|
|
465
|
-
return { status: "unhealthy", latency_ms: 0, error: "Qdrant not configured" };
|
|
466
|
-
}
|
|
467
|
-
const startTime = performance.now();
|
|
468
|
-
try {
|
|
469
|
-
const controller = new AbortController();
|
|
470
|
-
const timeoutId = setTimeout(() => controller.abort(), this.options.timeout);
|
|
471
|
-
const headers = {};
|
|
472
|
-
if (this.config.qdrant.apiKey) {
|
|
473
|
-
headers["api-key"] = this.config.qdrant.apiKey;
|
|
474
|
-
}
|
|
475
|
-
const response = await fetch(`${this.config.qdrant.url}/healthz`, {
|
|
476
|
-
method: "GET",
|
|
477
|
-
headers,
|
|
478
|
-
signal: controller.signal,
|
|
479
|
-
});
|
|
480
|
-
clearTimeout(timeoutId);
|
|
481
|
-
const latency = performance.now() - startTime;
|
|
482
|
-
if (response.ok) {
|
|
483
|
-
return {
|
|
484
|
-
status: "healthy",
|
|
485
|
-
latency_ms: Math.round(latency),
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
489
|
-
return {
|
|
490
|
-
status: "unhealthy",
|
|
491
|
-
latency_ms: Math.round(latency),
|
|
492
|
-
error: `HTTP ${response.status}`,
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
catch (error) {
|
|
497
|
-
const latency = performance.now() - startTime;
|
|
498
|
-
return {
|
|
499
|
-
status: "unhealthy",
|
|
500
|
-
latency_ms: Math.round(latency),
|
|
501
|
-
error: error instanceof Error ? error.message : String(error),
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Check Embedding service connectivity
|
|
507
|
-
*/
|
|
508
|
-
async checkEmbedding() {
|
|
509
|
-
if (!this.config.embedding) {
|
|
510
|
-
return { status: "unhealthy", latency_ms: 0, error: "Embedding service not configured" };
|
|
511
|
-
}
|
|
512
|
-
const startTime = performance.now();
|
|
513
|
-
try {
|
|
514
|
-
const controller = new AbortController();
|
|
515
|
-
const timeoutId = setTimeout(() => controller.abort(), this.options.timeout);
|
|
516
|
-
const response = await fetch(`${this.config.embedding.url}/health`, {
|
|
517
|
-
method: "GET",
|
|
518
|
-
signal: controller.signal,
|
|
519
|
-
});
|
|
520
|
-
clearTimeout(timeoutId);
|
|
521
|
-
const latency = performance.now() - startTime;
|
|
522
|
-
if (response.ok) {
|
|
523
|
-
return {
|
|
524
|
-
status: "healthy",
|
|
525
|
-
latency_ms: Math.round(latency),
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
else {
|
|
529
|
-
return {
|
|
530
|
-
status: "unhealthy",
|
|
531
|
-
latency_ms: Math.round(latency),
|
|
532
|
-
error: `HTTP ${response.status}`,
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
catch (error) {
|
|
537
|
-
const latency = performance.now() - startTime;
|
|
538
|
-
return {
|
|
539
|
-
status: "unhealthy",
|
|
540
|
-
latency_ms: Math.round(latency),
|
|
541
|
-
error: error instanceof Error ? error.message : String(error),
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Get certificate health status for health endpoint
|
|
547
|
-
*/
|
|
548
|
-
getCertificateHealthInfo() {
|
|
549
|
-
let status;
|
|
550
|
-
if (this.certExpiryDays < 0) {
|
|
551
|
-
status = "critical";
|
|
552
|
-
}
|
|
553
|
-
else if (this.certExpiryDays < 14) {
|
|
554
|
-
status = "warning";
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
557
|
-
status = "healthy";
|
|
558
|
-
}
|
|
559
|
-
return {
|
|
560
|
-
expiry_days: this.certExpiryDays,
|
|
561
|
-
status,
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Determine overall system status based on component health
|
|
566
|
-
*/
|
|
567
|
-
determineOverallStatus(components) {
|
|
568
|
-
const statuses = Object.values(components);
|
|
569
|
-
if (statuses.length === 0) {
|
|
570
|
-
return "healthy";
|
|
571
|
-
}
|
|
572
|
-
const unhealthyCount = statuses.filter((c) => c.status === "unhealthy").length;
|
|
573
|
-
const degradedCount = statuses.filter((c) => c.status === "degraded").length;
|
|
574
|
-
// Critical components that must be healthy
|
|
575
|
-
const criticalComponents = ["redis", "sqlite"];
|
|
576
|
-
const criticalUnhealthy = criticalComponents.some((name) => components[name]?.status === "unhealthy");
|
|
577
|
-
if (criticalUnhealthy || unhealthyCount > statuses.length / 2) {
|
|
578
|
-
return "unhealthy";
|
|
579
|
-
}
|
|
580
|
-
if (unhealthyCount > 0 || degradedCount > 0) {
|
|
581
|
-
return "degraded";
|
|
582
|
-
}
|
|
583
|
-
return "healthy";
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* Close any open connections
|
|
587
|
-
*/
|
|
588
|
-
async close() {
|
|
589
|
-
if (this.redisClient) {
|
|
590
|
-
await this.redisClient.quit();
|
|
591
|
-
this.redisClient = undefined;
|
|
592
|
-
}
|
|
593
|
-
if (this.sqliteDb) {
|
|
594
|
-
this.sqliteDb.close();
|
|
595
|
-
this.sqliteDb = undefined;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* Create a new HealthChecker instance
|
|
601
|
-
*/
|
|
602
|
-
export function createHealthChecker(config, options) {
|
|
603
|
-
return new HealthChecker(config, options);
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Create health checker from environment variables
|
|
607
|
-
*/
|
|
608
|
-
export function createHealthCheckerFromEnv(options) {
|
|
609
|
-
const config = {};
|
|
610
|
-
// Redis configuration
|
|
611
|
-
if (process.env.REDIS_HOST) {
|
|
612
|
-
config.redis = {
|
|
613
|
-
host: process.env.REDIS_HOST,
|
|
614
|
-
port: parseInt(process.env.REDIS_PORT || "6379"),
|
|
615
|
-
password: process.env.REDIS_PASSWORD,
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
// PostgreSQL configuration
|
|
619
|
-
if (process.env.POSTGRES_HOST) {
|
|
620
|
-
config.postgres = {
|
|
621
|
-
host: process.env.POSTGRES_HOST,
|
|
622
|
-
port: parseInt(process.env.POSTGRES_PORT || "5432"),
|
|
623
|
-
database: process.env.POSTGRES_DB,
|
|
624
|
-
user: process.env.POSTGRES_USER,
|
|
625
|
-
password: process.env.POSTGRES_PASSWORD,
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
// SQLite configuration
|
|
629
|
-
if (process.env.SQLITE_DB) {
|
|
630
|
-
config.sqlite = {
|
|
631
|
-
path: process.env.SQLITE_DB,
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
// Qdrant configuration
|
|
635
|
-
if (process.env.QDRANT_URL) {
|
|
636
|
-
config.qdrant = {
|
|
637
|
-
url: process.env.QDRANT_URL,
|
|
638
|
-
apiKey: process.env.QDRANT_API_KEY,
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
// Embedding service configuration
|
|
642
|
-
if (process.env.EMBEDDING_SERVICE_URL) {
|
|
643
|
-
config.embedding = {
|
|
644
|
-
url: process.env.EMBEDDING_SERVICE_URL,
|
|
645
|
-
};
|
|
646
|
-
}
|
|
647
|
-
return createHealthChecker(config, options);
|
|
648
|
-
}
|
|
649
|
-
//# sourceMappingURL=health.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/monitoring/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AA4D3B;;GAEG;AACH,SAAS,0BAA0B,CAAC,OAAe;IACjD,IAAI,CAAC;QACH,2CAA2C;QAC3C,MAAM,aAAa,GAAG,GAAG,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QACjE,0DAA0D;QAC1D,kEAAkE;QAElE,yDAAyD;QACzD,sCAAsC;QACtC,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC7D,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,OAAgC;IAEhC,MAAM,EACJ,QAAQ,EACR,oBAAoB,GAAG,EAAE,EACzB,qBAAqB,GAAG,CAAC,EACzB,kBAAkB,GACnB,GAAG,OAAO,CAAC;IAEZ,0DAA0D;IAC1D,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,0BAA0B,CAC/B,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,CACtB,CAAC;IACJ,CAAC;IAED,mCAAmC;IACnC,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CA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