feat: add Watchdog recovery and drift rebuild workflows

This commit is contained in:
2026-09-27 15:13:38 -04:00
parent a7044f21a1
commit b9f5902945
36 changed files with 2131 additions and 424 deletions
+48
View File
@@ -0,0 +1,48 @@
import type { DriftPlanFile } from './drift-plan.js';
export type WatchdogState = 'open' | 'recovering' | 'attention' | 'resolved' | 'dismissed';
export interface WatchdogIncident {
id: string;
server: string;
kind: 'health' | 'drift';
state: WatchdogState;
summary: string;
details: string;
first_seen_at: string;
last_seen_at: string;
finished_at: string | null;
failures: number;
cycle: number;
}
export interface WatchdogEvidence {
reason?: string;
containerState?: string | null;
files?: DriftPlanFile[];
fingerprint?: string;
}
export interface WatchdogAction {
id: string;
incident_id: string;
action: 'restart' | 'rebuild';
operation_id: string;
campaign_id: string | null;
created_at: string;
cycle: number;
operation_state: string | null;
operation_stage: string | null;
operation_error: string | null;
}
export interface WatchdogOverview {
enabled: boolean;
lastScanAt: string | null;
scanError: string | null;
incidents: WatchdogIncident[];
}
export interface WatchdogDetail {
incident: WatchdogIncident;
events: { id: number; created_at: string; message: string }[];
actions: WatchdogAction[];
}
export const watchdogStateLabels: Record<WatchdogState, string> = {
open: 'Detected', recovering: 'Recovering', attention: 'Needs attention', resolved: 'Resolved', dismissed: 'Dismissed'
};