/**
 * @module        MonitorEngine
 * @description   异常检测与健康检查引擎，监控孤儿插槽、超时任务及 Worker 状态
 *
 * @author        eddy
 * @organization  wykj
 * @ownership     wykj/eddy
 *
 * @created       2026-03-19
 * @updated       2026-04-03
 *
 * @role          engine
 * @layer         engine
 * @boundedContext pipeline-health
 *
 * @workflow       tick → orphan cleanup → stale detection → timeout check → BLOCKED check → state alignment
 */
import type { ProjectContext } from '../core/context.js';
import type { ProjectPipelineAdapter } from '../core/projectPipelineAdapter.js';
import type { Notifier } from '../interfaces/Notifier.js';
import type { RepoBackend } from '../interfaces/RepoBackend.js';
import type { TaskBackend } from '../interfaces/TaskBackend.js';
import type { ProcessSupervisor } from '../manager/supervisor.js';
import type { WorkerManager } from '../manager/worker-manager.js';
import type { CommandResult } from '../shared/types.js';
/**
 * MonitorEngine performs anomaly detection and health checks.
 *
 * With ProcessSupervisor, completion detection and post-actions are handled
 * by exit callbacks (CompletionJudge + PostActions). MonitorEngine focuses on:
 *   1. Orphan slot cleanup (stale entries not tracked by Supervisor)
 *   2. Stale runtime detection (Inprogress cards with no worker)
 *   3. Timeout detection (INPROGRESS_TIMEOUT_HOURS)
 *   4. BLOCKED condition check
 *   5. State alignment (Supervisor vs state.json sync)
 *   6. Worker health (launch/idle timeouts for Supervisor-tracked workers)
 */
export declare class MonitorEngine {
    private ctx;
    private taskBackend;
    private repoBackend;
    private notifier;
    private supervisor;
    private pipelineAdapter;
    private workerManager;
    private log;
    private runtimeStore;
    constructor(ctx: ProjectContext, taskBackend: TaskBackend, repoBackend: RepoBackend, notifier: Notifier | undefined, supervisor: ProcessSupervisor, pipelineAdapter: ProjectPipelineAdapter, workerManager: WorkerManager);
    /**
     * Safe MR status check — returns { exists: false, state: 'unknown' } if GitLab API
     * fails (project not found, MR_MODE=none, network error). Prevents monitor from
     * crashing on projects without GitLab integration.
     */
    private safeMrStatus;
    tick(): Promise<CommandResult>;
    /**
     * v0.50.18：tick 起步统一入口——race-recovery + halt detection 合在一起。
     * 封装了 "race-recovery 必须在 halt-check 之前" 的语义，tick.ts 只需调这一个。
     *
     * 返回：
     *   - halted=false → tick 继续
     *   - halted=true + needsFixCards → tick 应该提前 return halt result
     */
    preFlightCheck(): Promise<{
        healed: number;
        halted: boolean;
        needsFixCards: string[];
    }>;
    /**
     * v0.50.16：供 tick.ts 在 halt-check 前显式跑一次 race-recovery 的兜底 API。
     * v0.50.18：推荐用 preFlightCheck 统一入口；这个保留做细粒度控制。
     *
     * 返回被自愈的卡片数；失败不抛（best-effort）。
     */
    healRaceConditions(): Promise<number>;
    private checkRaceRecovery;
    private checkOrphanSlots;
    private checkAckTimeout;
    private checkStaleRuntimes;
    private listRuntimeAwareInprogressCards;
    private handleStaleRuntime;
    private checkTimeouts;
    private checkWaitingConfirmation;
    private checkBlockedCards;
    private checkStateAlignment;
    private checkWorkerHealth;
    private checkAcpShimHealth;
    private autoRetry;
    private isAcpSessionAlive;
    private buildBranchName;
    private addLabelSafe;
    private removeLabelSafe;
    private notifySafe;
    private logEvent;
}
//# sourceMappingURL=MonitorEngine.d.ts.map