import type { VisionClawConfig, OwnerConfig } from "../config/types.js";
import type { CommandMessage } from "../channels/interface.js";
import type { ChannelManager } from "../channels/manager.js";
import type { MessageQueue } from "../channels/queue.js";
import type { SessionManager } from "./session-manager.js";
import type { ActivityTracker } from "./activity-tracker.js";
import type { AgentState } from "./state.js";
import type { AgentSessionLike } from "./engines/session-types.js";
export interface InterruptHandlerDeps {
    session: AgentSessionLike;
    sessionManager: SessionManager;
    config: VisionClawConfig;
    ownerConfig: OwnerConfig;
    channelManager: ChannelManager;
    messageQueue: MessageQueue;
    activityTracker: ActivityTracker;
    getAgentState: () => AgentState;
    /** Resolve the main loop's sleep promise so it wakes immediately. */
    wakeMainLoop: () => void;
}
export declare class InterruptHandler {
    private deps;
    private timer;
    private inFlight;
    private lastInjectedBatch;
    /** Message dedup keys that already received a fast response in this process. */
    private fastRespondedKeys;
    /** Chat monitor channels that already injected a notification this wake cycle. */
    private notifiedChatMonitorChannels;
    constructor(deps: InterruptHandlerDeps);
    /**
     * Clear per-cycle chat-monitor tracking. Fast-response message keys are
     * intentionally process-wide so session-switch redelivery cannot get a
     * second quick ack for the same provider message.
     */
    clearFastResponseTracking(): void;
    /**
     * Record chat monitor channels from the initial wake messages so that
     * duplicate notifications for the same app are suppressed during the cycle.
     */
    recordInitialChatMonitorMessages(messages: CommandMessage[]): void;
    private filterDuplicateChatMonitorMessages;
    private getFastResponseEligibleMessages;
    /**
     * Called from the channelManager "message" event when the agent is busy.
     * Schedules a debounced interrupt batch.
     */
    schedule(): void;
    dispose(): void;
    /**
     * Watchdog fallback: called when the primary agent hasn't replied within
     * the watchdog timeout on a message-triggered wake. Runs the fast
     * responder and injects a briefing into the active session.
     */
    fireWatchdog(messages: CommandMessage[]): Promise<void>;
    private requeue;
    /**
     * If injected messages were orphaned (accepted but never delivered to SDK),
     * re-queue the original CommandMessages so they're handled on the next wake.
     */
    requeueIfOrphaned(): void;
    /**
     * Send a generic "your message is being processed" acknowledgment to each
     * unique sender in a batch. Used as a fallback when the fast responder fails.
     */
    private sendProcessingNotification;
    /**
     * Shared logic: call fastRespond with a timeout, match replies to actual
     * recipients, and send them. Returns the fast response and how many
     * recipients were sent to, or null if the call failed/timed out.
     *
     * @param shouldSend Optional guard checked before sending each reply.
     *   If it returns false, remaining sends are skipped.
     */
    private callFastRespondAndSend;
    private processBatch;
}
//# sourceMappingURL=interrupt-handler.d.ts.map