/**
 * Daemon Manager
 *
 * Manages the Code Buddy daemon process lifecycle:
 * - Start/stop/restart daemon as a detached background process
 * - PID file management (~/.codebuddy/daemon/codebuddy.pid)
 * - Log file management (~/.codebuddy/daemon/codebuddy.log)
 * - Auto-restart on crash (max 3 attempts)
 */
import { EventEmitter } from 'events';
export interface DaemonConfig {
    /** PID file path */
    pidFile: string;
    /** Log file path */
    logFile: string;
    /** Max auto-restart attempts */
    maxRestarts: number;
    /** Services to auto-start */
    autoStart: ('server' | 'scheduler' | 'channels')[];
    /** Server port */
    port: number;
    /** Health check interval in ms */
    healthCheckIntervalMs: number;
}
export interface DaemonStatus {
    running: boolean;
    pid?: number;
    uptime?: number;
    startedAt?: Date;
    services: ServiceStatus[];
    restartCount: number;
}
export interface ServiceStatus {
    name: string;
    running: boolean;
    startedAt?: Date;
    error?: string;
}
export declare const DEFAULT_DAEMON_CONFIG: DaemonConfig;
export declare class DaemonManager extends EventEmitter {
    private config;
    private childProcess;
    private restartCount;
    private startedAt;
    constructor(config?: Partial<DaemonConfig>);
    /**
     * Start the daemon process
     */
    start(detach?: boolean): Promise<void>;
    /**
     * Start daemon as a detached background process
     */
    private startDetached;
    /**
     * Start daemon in the foreground (for __run__ mode)
     */
    private startForeground;
    /**
     * Stop the daemon process
     */
    stop(): Promise<void>;
    /**
     * Restart the daemon
     */
    restart(): Promise<void>;
    /**
     * Get daemon status
     */
    status(): Promise<DaemonStatus>;
    /**
     * Get recent log lines
     */
    logs(lines?: number): Promise<string>;
    /**
     * Attempt auto-restart if crashes
     */
    attemptAutoRestart(): Promise<boolean>;
    private writePid;
    readPid(): Promise<number | null>;
    private removePid;
    isProcessRunning(pid: number): boolean;
    private waitForExit;
    getConfig(): DaemonConfig;
}
export declare function getDaemonManager(config?: Partial<DaemonConfig>): DaemonManager;
export declare function resetDaemonManager(): void;
