import type { DriftPlanFile } from './drift-plan.js'; export type WatchdogState = 'open' | 'recovering' | 'attention' | 'resolved' | 'dismissed'; export interface WatchdogIncident { id: string; server: string; server_deleted_at?: string | null; 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; operation_stage?: string | null; } 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 = { open: 'Detected', recovering: 'Recovering', attention: 'Needs attention', resolved: 'Resolved', dismissed: 'Dismissed' };