#!/usr/bin/env node
import { EventEmitter } from 'events';
/**
 * ProcessRecovery manages automatic restart and monitoring of the Crewly backend process
 *
 * Features:
 * - Automatic restart on crashes
 * - Memory usage monitoring
 * - Port conflict detection and resolution
 * - Exponential backoff for restart attempts
 * - Health checks and process monitoring
 *
 * @example
 * ```typescript
 * const recovery = new ProcessRecovery();
 * await recovery.start();
 * ```
 */
export declare class ProcessRecovery extends EventEmitter {
    private childProcess;
    private restartCount;
    private maxRestarts;
    private baseRetryDelay;
    private maxRetryDelay;
    private isShuttingDown;
    private healthCheckInterval;
    private memoryMonitorInterval;
    private processStartTime;
    private minRuntime;
    private logger;
    constructor();
    /**
     * Start the backend process with recovery monitoring
     *
     * @returns Promise that resolves when the process recovery system is started
     */
    start(): Promise<void>;
    /**
     * Start the backend process
     *
     * @returns Promise that resolves when the process is started
     */
    private startBackendProcess;
    /**
     * Handle process exit and determine if restart is needed
     *
     * @param code - Exit code of the process
     * @param signal - Signal that killed the process
     * @param runtime - How long the process ran
     */
    private handleProcessExit;
    /**
     * Start health checks for the backend process
     */
    private startHealthChecks;
    /**
     * Start memory monitoring for early detection of memory leaks
     */
    private startMemoryMonitoring;
    /**
     * Setup signal handlers for graceful shutdown
     */
    private setupSignalHandlers;
    /**
     * Gracefully shutdown the recovery system and backend process
     *
     * @param signal - Signal that triggered the shutdown
     */
    shutdown(signal?: string): Promise<void>;
    /**
     * Get current status of the backend process
     *
     * @returns Status information about the backend process
     */
    getStatus(): {
        isRunning: boolean;
        pid: number | undefined;
        restartCount: number;
        runtime: number;
    };
}
//# sourceMappingURL=process-recovery.d.ts.map