import type { PendingCommand, CommandAck } from "../onboarding/onboarding-service-client.js";
export type CommandHandler = (commandId: number, payload: unknown) => Promise<{
    status: "completed" | "failed";
    result?: string;
}>;
/**
 * Dispatches commands received from the onboarding service heartbeat.
 * Each command is executed asynchronously and independently.
 * Completed/failed acks are queued for the next heartbeat.
 */
export declare class CommandDispatcher {
    private readonly handlers;
    private readonly pendingAcks;
    private readonly inFlight;
    /** Commands that have completed but whose acks may not have reached the server yet. */
    private readonly completed;
    registerHandler(command: string, handler: CommandHandler): void;
    /**
     * Process pending commands from a heartbeat response.
     * Each command is dispatched independently (fire-and-forget).
     */
    dispatch(commands: PendingCommand[]): void;
    /**
     * Drain all queued acks for inclusion in the next heartbeat.
     */
    drainAcks(): CommandAck[];
    /**
     * Notify the dispatcher that acks were successfully delivered to the server.
     * Clears the completed-set entries for those command IDs so they don't leak.
     */
    confirmAcksDelivered(acks: CommandAck[]): void;
    /**
     * Put acks back into the queue (e.g. when the heartbeat POST fails
     * and the acks were not delivered).
     */
    requeueAcks(acks: CommandAck[]): void;
    /**
     * Queue a single ack (e.g. a synthetic ack for a command whose ack was
     * lost due to process restart).
     */
    queueAck(ack: CommandAck): void;
}
//# sourceMappingURL=command-dispatcher.d.ts.map