/** * config.ts — Configuración de claudestat * * Lee/escribe ~/.claudestat/config.json con valores por defecto. * Los thresholds de warning controlan cuándo se emite una alerta SSE * y cuándo se activa el kill switch (hook bloqueante PreToolUse). * * Estructura del archivo: * { * "killSwitchEnabled": true, // activar/desactivar el hook bloqueante * "killSwitchThreshold": 95, // % de cuota para bloquear (1-100) * "warnThresholds": [70, 85, 95],// niveles de aviso: amarillo, naranja, rojo * "plan": null, // forzar plan: "pro"|"max5"|"max20"|null (auto) * "reportsEnabled": false, // activar/desactivar informes automáticos * "reportFrequency": "weekly", // "weekly"|"biweekly"|"monthly" * "reportDay": 1, // día de la semana: 0=Dom, 1=Lun … 6=Sáb * "reportTime": "09:00" // hora HH:MM en que se genera el informe * } */ import type { ClaudePlan } from './quota-tracker'; export type ReportFrequency = 'weekly' | 'biweekly' | 'monthly'; export interface ClaudestatConfig { killSwitchEnabled: boolean; killSwitchThreshold: number; warnThresholds: number[]; weeklyWarnThresholds: number[]; resetReminderMins: number; sessionCostLimitUsd: number; plan: ClaudePlan | null; reportsEnabled: boolean; reportFrequency: ReportFrequency; reportDay: number; reportTime: string; alertsEnabled: boolean; killSwitchForce: boolean; logLevel: 'debug' | 'info' | 'warn' | 'error'; port: number; loopThreshold: number; loopWindowSecs: number; projectAliases: Record; webhookUrl: string | null; contextWindowOverrides: Record; } /** Lee la config del disco. Valores ausentes se rellenan con defaults. */ export declare function readConfig(): ClaudestatConfig; /** Escribe la config en disco. Crea el directorio si no existe. */ export declare function writeConfig(cfg: ClaudestatConfig): void; /** * Valida y sanitiza los campos de una config recibida por la API. * Devuelve un string de error si algo es inválido, o null si está bien. */ export declare function validateConfig(raw: unknown): string | null; /** Devuelve el nivel de warning para un % dado, o null si no alcanza ningún threshold. */ export declare function getWarnLevel(pct: number, thresholds: number[]): 'yellow' | 'orange' | 'red' | null;