/**
 * @module        EventHandler
 * @description   解耦的事件处理器，处理 WorkerManager 生命周期事件及 PM 操作重试
 *
 * @author        eddy
 * @organization  wykj
 * @ownership     wykj/eddy
 *
 * @created       2026-03-28
 * @updated       2026-04-03
 *
 * @role          engine
 * @layer         engine
 * @boundedContext worker-lifecycle
 *
 * @stateTransition Inprogress → QA | Done (via PM move on worker exit)
 * @workflow       WorkerManager.exit → EventHandler.handle → PM ops → pendingPMActions retry
 */
import type { ProjectPipelineAdapter } from '../core/projectPipelineAdapter.js';
import type { RuntimeStore } from '../core/runtimeStore.js';
import type { Notifier } from '../interfaces/Notifier.js';
import type { TaskBackend } from '../interfaces/TaskBackend.js';
import type { WorkerEvent } from '../manager/worker-manager.js';
export interface EventHandlerDeps {
    taskBackend: TaskBackend;
    notifier?: Notifier;
    runtimeStore: RuntimeStore;
    project: string;
    pipelineAdapter: ProjectPipelineAdapter;
    /** v0.50.12：COMPLETED-<stage> label 轮询参数。测试里传小值加速。 */
    completedLabelPoll?: {
        timeoutMs: number;
        intervalMs: number;
    };
}
export declare class SPSEventHandler {
    private readonly taskBackend;
    private readonly notifier;
    private readonly runtimeStore;
    private readonly project;
    private readonly pipelineAdapter;
    private readonly completedLabelPoll;
    constructor(deps: EventHandlerDeps);
    /**
     * Main entry point — registered with WorkerManager.onEvent().
     * Dispatches to type-specific handlers. Errors are caught and logged
     * to avoid disrupting the WM event loop.
     */
    handle(event: WorkerEvent): void;
    /**
     * Retry any pending PM actions saved from previous failures.
     * Called by tick.ts at the start of each cycle.
     */
    retryPendingActions(): Promise<{
        retried: number;
        succeeded: number;
        failed: number;
    }>;
    private onCompleted;
    private onFailed;
    private onInputRequired;
    private onStatusUpdate;
    private releaseSlot;
    private safeAction;
    private executePMAction;
    private savePendingAction;
    private safeNotify;
    /**
     * v0.50.12：轮询 card 直到 COMPLETED-<stage> label 出现或超时。
     *
     * Stop hook 是 Claude 异步写文件，ACP session_completed 事件可能先到达。
     * 直接判一次 label 会把正常完成的卡片误标 NEEDS-FIX。
     * 一旦看到目标 label 立即返回；超时前至少会读一次卡片。
     */
    private pollForCompletedLabel;
    private log;
    private logError;
}
//# sourceMappingURL=EventHandler.d.ts.map