/**
 * Delegation Engine
 *
 * Matches PlannedTask to the best subagent, manages shared context, aggregates results.
 */
import { EventEmitter } from 'events';
import type { PlannedTask, TaskResult } from './task-graph.js';
export interface DelegationMapping {
    taskType: string;
    subagent: string;
    priority: number;
}
export interface DelegationResult {
    taskId: string;
    subagent: string;
    result: TaskResult;
    retries: number;
}
export interface DelegationEngineConfig {
    maxRetries: number;
    retryDelayMs: number;
    backoffMultiplier: number;
}
export declare class DelegationEngine extends EventEmitter {
    private config;
    private sharedContext;
    private customMappings;
    constructor(config?: Partial<DelegationEngineConfig>);
    /**
     * Determine the best subagent for a task
     */
    matchSubagent(task: PlannedTask): string;
    /**
     * Execute a task with retry and backoff
     */
    executeWithRetry(task: PlannedTask, executor: (task: PlannedTask, context: string) => Promise<TaskResult>): Promise<DelegationResult>;
    /**
     * Build context string from shared context of dependency tasks
     */
    private buildContext;
    /**
     * Add a custom mapping
     */
    addMapping(mapping: DelegationMapping): void;
    /**
     * Get shared context
     */
    getSharedContext(): Map<string, string>;
    /**
     * Clear shared context
     */
    clearContext(): void;
    /**
     * Aggregate results from multiple delegations
     */
    aggregateResults(results: DelegationResult[]): {
        success: boolean;
        summary: string;
        totalRetries: number;
    };
}
export declare function getDelegationEngine(config?: Partial<DelegationEngineConfig>): DelegationEngine;
export declare function resetDelegationEngine(): void;
