#!/usr/bin/env node
import { StartupConfig } from './types/index.js';
export declare class CrewlyServer {
    private app;
    private httpServer;
    private io;
    private config;
    private logger;
    /** Offline-replay summary from this boot, surfaced in the boot announcement. */
    private lastOfflineReplay?;
    private storageService;
    private tmuxService;
    private schedulerService;
    private messageSchedulerService;
    private activityMonitorService;
    private teamActivityWebSocketService;
    private teamsJsonWatcherService;
    private apiController;
    private terminalGateway;
    private messageQueueService;
    private queueProcessorService;
    private threadStatusQueueService;
    private eventBusService;
    /** BRIDGE-1: subscribes to autonomy events and creates WorkItems. */
    private eventToWorkItemBridge;
    /** LEARN-1: subscribes to terminal task / mission:replanned events and auto-records learnings. */
    private autoLearningSubscriber;
    private milestoneNotificationSubscriber;
    /** INBOUND-1: subscribes to request:created and tracks 5/10 min SLA on respond_to_user WIs. */
    private requestSlaSubscriber;
    /** Pipeline-#4 follow-up: subscribes to request:created and auto-decomposes actionable L2 Requests via plan() → addToPool. */
    private requestDecomposeSubscriber;
    private requestStatusUpdateSubscriber;
    private requestCascadeSubscriber;
    private notifyReconciliationService;
    private systemResourceAlertService;
    private reconcilerService;
    private teamHealthWatchdog;
    private chatV2Gateway;
    private chatV2Dispatcher;
    private isShuttingDown;
    private healthMonitoringInterval;
    constructor(config?: Partial<StartupConfig>);
    private initializeServices;
    private configureMiddleware;
    private configureRoutes;
    private configureWebSocket;
    start(): Promise<void>;
    /**
     * Initialize Slack integration if environment variables are configured.
     * Gracefully handles missing configuration or connection failures.
     */
    private initializeSlackIfConfigured;
    /**
     * Initialize WhatsApp integration if environment variables are configured.
     * Gracefully handles missing configuration or connection failures.
     */
    private initializeWhatsAppIfConfigured;
    /**
     * Initialize Google Chat adapter from saved credentials if available.
     * Restarts the Pub/Sub pull loop automatically on backend restart.
     */
    private initializeGoogleChatIfConfigured;
    /**
     * Initialize Telegram bot from environment variables or saved credentials.
     * Starts long-polling for incoming messages automatically on backend restart.
     */
    private initializeTelegramIfConfigured;
    /**
     * Auto-start the orchestrator if the autoStartOrchestrator setting is enabled.
     * Reads the setting from persistent storage and triggers orchestrator setup.
     * Failures are logged but do not prevent the server from starting.
     */
    private autoStartOrchestratorIfEnabled;
    /**
     * Auto-restore agent sessions that were running before the last shutdown.
     * Loads persisted session state and calls createAgentSession() for each
     * non-orchestrator session. Gated by the autoResumeOnRestart setting.
     * Runs after orchestrator auto-start so the orchestrator is available.
     */
    private autoRestoreAgentSessionsIfEnabled;
    /**
     * Check for and handle pending self-improvement from hot-reload.
     * This runs at startup to validate or rollback any changes made
     * before the process was restarted.
     */
    private checkPendingSelfImprovement;
    private checkPortAvailability;
    private startHttpServer;
    private handlePortConflict;
    private sigintCount;
    private registerSignalHandlers;
    private startHealthMonitoring;
    /**
     * Removes done/cancelled Requests older than 24h from disk,
     * and purges done/cancelled/failed WorkItems from the task pool.
     * Memory, knowledge, and learnings are never purged.
     */
    private purgeCompletedData;
    /**
     * Closes open Requests that were created within the last 10 minutes.
     * Used to handle direct orchestrator responses that don't go through WorkItems.
     * Also rolls up orchestrator token usage and sets ownerAgent for the Request.
     *
     * Token source varies by runtime:
     *   - claude-code: reads session JSONL (TUI status bar not capturable from PTY)
     *   - gemini-cli / codex-cli: reads from TokenUsageService (fed by PTY parser)
     *   - crewly-agent: reads from TokenUsageService (fed by SDK)
     */
    private autoCloseOpenRequests;
    private logMemoryUsage;
    shutdown(): Promise<void>;
    getConfig(): StartupConfig;
}
export default CrewlyServer;
//# sourceMappingURL=index.d.ts.map