import type { DeployBatch, BatchResult, DeployActionType } from '../types/coordination.js';
/**
 * Dynamic batch window configuration based on action type.
 * Optimizes for speed on time-sensitive operations while allowing
 * batching for operations that benefit from grouping.
 */
export interface DynamicBatchWindows {
    commit: number;
    push: number;
    merge: number;
    workflow: number;
    deploy: number;
}
export interface DeployBatcherConfig {
    dbPath?: string;
    batchWindowMs?: number;
    dynamicWindows?: Partial<DynamicBatchWindows>;
    maxBatchSize?: number;
    dryRun?: boolean;
    parallelExecution?: boolean;
    maxParallelActions?: number;
    execTimeoutMs?: number;
}
export declare class DeployBatcher {
    private db;
    private dynamicWindows;
    private maxBatchSize;
    private dryRun;
    private parallelExecution;
    private maxParallelActions;
    private execTimeoutMs;
    constructor(config?: DeployBatcherConfig);
    /**
     * Get the batch window for a specific action type.
     */
    getBatchWindow(actionType: DeployActionType): number;
    /**
     * Update batch windows dynamically (useful for urgent operations).
     */
    setUrgentMode(urgent: boolean): void;
    /**
     * Queue a deploy action with type-specific batching delay.
     */
    queue(agentId: string, actionType: DeployActionType, target: string, payload?: Record<string, unknown>, options?: {
        priority?: number;
        dependencies?: string[];
        urgent?: boolean;
    }): Promise<number>;
    /**
     * Queue multiple actions atomically with optimized windows.
     */
    queueBulk(agentId: string, actions: Array<{
        actionType: DeployActionType;
        target: string;
        payload?: Record<string, unknown>;
        priority?: number;
    }>): Promise<number[]>;
    /**
     * Synchronous queue for use in transactions.
     */
    private queueSync;
    private findSimilarAction;
    private canMerge;
    private mergeActions;
    private mergePayloads;
    /**
     * Create a batch from ready actions.
     */
    createBatch(): Promise<DeployBatch | null>;
    private groupByTarget;
    private squashActions;
    private squashCommits;
    /**
     * Execute a batch with optional parallel execution for independent actions.
     */
    executeBatch(batchId: string): Promise<BatchResult>;
    /**
     * Categorize actions into parallel-safe and sequential groups.
     */
    private categorizeActions;
    /**
     * Execute actions in parallel with concurrency limit.
     * Uses shared concurrentMapSettled utility.
     */
    private executeParallel;
    private executeAction;
    private executeCommit;
    private executePush;
    private executeMerge;
    private executeWorkflow;
    private executeDeploy;
    private updateActionStatus;
    getBatch(batchId: string): DeployBatch | null;
    getPendingBatches(): DeployBatch[];
    /**
     * Force flush all pending deploys immediately.
     */
    flushAll(): Promise<BatchResult[]>;
    /**
     * Get current batch window configuration.
     */
    getWindowConfig(): DynamicBatchWindows;
    /**
     * Load configuration from `.uap.json` in the project root,
     * falling back to environment variables for each window.
     */
    static loadFromConfig(projectRoot: string): DeployBatcherConfig;
    /**
     * Save the current dynamic window configuration into `.uap.json`
     * under the `deploy.batchWindows` section, preserving existing content.
     */
    saveConfig(projectRoot: string): void;
    /**
     * Return a DeployBatcherConfig for a named profile.
     */
    static fromProfile(profile: 'fast' | 'safe' | 'default'): DeployBatcherConfig;
    /**
     * Execute a command with timeout protection.
     * Prevents hung processes from blocking the batch pipeline.
     */
    private execFileWithTimeout;
}
//# sourceMappingURL=deploy-batcher.d.ts.map