/**
 * Schedule Daemon
 *
 * Background service that periodically checks and executes queued updates.
 * Manages its own lifecycle with PID file and graceful shutdown.
 *
 * @since v1.51.1
 */
import type { ExecutionResult, ScheduleExecutor } from './schedule-executor.js';
/**
 * Daemon status
 */
export type DaemonStatus = 'stopped' | 'starting' | 'running' | 'stopping';
/**
 * Daemon configuration
 */
export interface DaemonConfig {
    /** Check interval in milliseconds (default: 5 minutes) */
    checkIntervalMs: number;
    /** Path to PID file */
    pidFile: string;
    /** Path to daemon log file */
    logFile: string;
    /** Maximum log file size in bytes before rotation (default: 10MB) */
    maxLogSize: number;
    /** Number of log files to keep (default: 5) */
    maxLogFiles: number;
}
/**
 * Daemon state persisted to disk
 */
export interface DaemonState {
    /** Process ID */
    pid: number;
    /** Start timestamp */
    startedAt: string;
    /** Last check timestamp */
    lastCheckAt: string | null;
    /** Last execution result */
    lastResult: ExecutionResult | null;
    /** Total executions */
    totalExecutions: number;
    /** Total updates applied */
    totalUpdatesApplied: number;
    /** Total errors */
    totalErrors: number;
}
/**
 * Default daemon configuration
 */
export declare const DEFAULT_DAEMON_CONFIG: DaemonConfig;
/**
 * Schedule Daemon
 *
 * Runs in the background and periodically executes the schedule executor.
 */
export declare class ScheduleDaemon {
    private config;
    private executor;
    private status;
    private checkTimer;
    private state;
    private shutdownHandlers;
    constructor(executor: ScheduleExecutor, config: Partial<DaemonConfig> & {
        pidFile: string;
        logFile: string;
    });
    /**
     * Get current daemon status
     */
    getStatus(): DaemonStatus;
    /**
     * Get daemon state
     */
    getState(): DaemonState;
    /**
     * Check if daemon is running (based on PID file)
     */
    isRunning(): Promise<boolean>;
    /**
     * Get PID from PID file
     */
    getPid(): Promise<number | null>;
    /**
     * Start the daemon
     */
    start(): Promise<{
        success: boolean;
        message: string;
    }>;
    /**
     * Stop the daemon
     */
    stop(): Promise<{
        success: boolean;
        message: string;
    }>;
    /**
     * Run a single check cycle
     */
    private runCheck;
    /**
     * Write PID file
     */
    private writePidFile;
    /**
     * Remove PID file
     */
    private removePidFile;
    /**
     * Set up signal handlers for graceful shutdown
     */
    private setupSignalHandlers;
    /**
     * Remove signal handlers
     */
    private removeSignalHandlers;
    /**
     * Log a message to the daemon log file
     */
    private log;
    /**
     * Rotate log file if it exceeds max size
     */
    private rotateLogIfNeeded;
    /**
     * Get status summary
     */
    getStatusSummary(): Promise<{
        status: DaemonStatus;
        pid: number | null;
        uptime: number | null;
        lastCheck: string | null;
        totalExecutions: number;
        totalUpdatesApplied: number;
        totalErrors: number;
        nextCheck: Date | null;
    }>;
    /**
     * Format uptime for display
     */
    static formatUptime(ms: number): string;
}
/**
 * Get the singleton daemon instance
 */
export declare function getScheduleDaemon(): ScheduleDaemon | null;
/**
 * Initialize the schedule daemon
 */
export declare function initScheduleDaemon(executor: ScheduleExecutor, config: Partial<DaemonConfig> & {
    pidFile: string;
    logFile: string;
}): ScheduleDaemon;
/**
 * Reset the singleton (for testing)
 */
export declare function resetScheduleDaemon(): void;
//# sourceMappingURL=schedule-daemon.d.ts.map