feat(heartbeat): add process memory and backup health checks

This commit is contained in:
William Valentin
2026-02-16 13:50:39 -08:00
parent 8684c3a07d
commit 07340ff0af
11 changed files with 282 additions and 8 deletions
+8
View File
@@ -962,6 +962,14 @@ describe('configSchema automation', () => {
expect(result.automation.daily_briefing.prompt).toBe('Custom briefing prompt');
expect(result.automation.daily_briefing.model_tier).toBe('fast');
});
it('defaults heartbeat extended thresholds and checks', () => {
const result = configSchema.parse(baseConfig);
expect(result.automation.heartbeat.process_memory_threshold_mb).toBe(1500);
expect(result.automation.heartbeat.backup_failure_threshold).toBe(1);
expect(result.automation.heartbeat.checks).toContain('process_memory');
expect(result.automation.heartbeat.checks).toContain('backup');
});
});
describe('configSchema — intents', () => {
+4 -2
View File
@@ -302,18 +302,20 @@ const gmailSchema = z.object({
message: z.string().default('New email from {{from}}: {{subject}}\n\n{{snippet}}'),
}).optional();
const heartbeatCheckSchema = z.enum(['gateway', 'model', 'channels', 'memory', 'disk']);
const heartbeatCheckSchema = z.enum(['gateway', 'model', 'channels', 'memory', 'disk', 'process_memory', 'backup']);
const heartbeatSchema = z.object({
enabled: z.boolean().default(false),
interval: z.string().default('5m'),
checks: z.array(heartbeatCheckSchema).default(['gateway', 'model', 'channels', 'memory', 'disk']),
checks: z.array(heartbeatCheckSchema).default(['gateway', 'model', 'channels', 'memory', 'disk', 'process_memory', 'backup']),
notify: z.object({
channel: z.string().min(1),
peer: z.string().min(1),
}).optional(),
failure_threshold: z.number().min(1).max(10).default(2),
disk_threshold_mb: z.number().min(10).default(100),
process_memory_threshold_mb: z.number().min(64).default(1500),
backup_failure_threshold: z.number().min(1).max(10).default(1),
}).default({});
const gcalSchema = z.object({