/**
 * Module Expert Invoker
 *
 * Bridge between Cross-Domain Experts and Module Skills (YAML).
 * Handles:
 * - Translating ModuleQuery into skill execution
 * - Extracting structured findings and suggestions from results
 * - Managing dialogue context and parameter passing
 *
 * This is the key integration point that allows TypeScript cross-domain experts
 * to leverage the existing YAML skill system.
 */
import { EventEmitter } from 'events';
import { ModuleQuery, ModuleResponse } from './types';
/**
 * Configuration for ModuleExpertInvoker
 */
export interface ModuleExpertInvokerConfig {
    /** Enable result caching */
    enableCache?: boolean;
    /** Cache TTL in ms */
    cacheTtlMs?: number;
    /** Default timeout for skill execution */
    defaultTimeoutMs?: number;
    /** Whether to emit events */
    emitEvents?: boolean;
    /**
     * Use v2.0 DataEnvelope format for SSE events
     * When true, emits 'data' events with DataEnvelope instead of 'skill_data' with LayeredSkillResult
     * Default: false (backward compatible)
     */
    useDataEnvelopeFormat?: boolean;
}
/**
 * ModuleExpertInvoker - Bridges cross-domain experts to module skills
 */
export declare class ModuleExpertInvoker extends EventEmitter {
    private skillExecutor;
    private cache;
    private config;
    constructor(traceProcessorService: any, aiService?: any, config?: ModuleExpertInvokerConfig);
    /**
     * Invoke a module skill with a structured query
     */
    invoke(query: ModuleQuery): Promise<ModuleResponse>;
    /**
     * Invoke multiple modules in parallel
     */
    invokeParallel(queries: ModuleQuery[]): Promise<ModuleResponse[]>;
    /**
     * Get available capabilities for a module
     */
    getModuleCapabilities(moduleName: string): string[];
    /**
     * Check if a module can answer a specific question type
     */
    canAnswer(moduleName: string, questionId: string): boolean;
    /**
     * Get required parameters for a question
     */
    getRequiredParams(moduleName: string, questionId: string): string[];
    /**
     * Clear the response cache
     */
    clearCache(): void;
    /**
     * Build execution parameters from query
     */
    private buildExecutionParams;
    /**
     * Build inherited context from dialogue context
     */
    private buildInheritedContext;
    /**
     * Extract structured findings from skill results
     *
     * Extraction strategy:
     * 1. First try dialogue.findingsSchema (for module experts with explicit schema)
     * 2. Fallback to diagnostics (for composite skills with diagnostic rules)
     */
    private extractModuleFindings;
    /**
     * Unwrap StepResult / nested SkillExecutionResult payloads into row data.
     * This keeps module extraction resilient when a step is switched to `type: skill`.
     */
    private unwrapStepData;
    /**
     * Auto-detect findings from step results
     * Looks for common patterns that indicate performance issues
     */
    private autoDetectFindings;
    /**
     * Extract suggestions from skill results
     */
    private extractModuleSuggestions;
    /**
     * Flatten result data for easier access
     */
    private flattenResultData;
    /**
     * Calculate confidence score for response
     */
    private calculateResponseConfidence;
    /**
     * Create error response
     */
    private createErrorResponse;
    /**
     * Generate cache key for a query
     */
    private getCacheKey;
    /**
     * Get cached response if available and not expired
     */
    private getCachedResponse;
    /**
     * Cache a response
     */
    private cacheResponse;
    /**
     * Emit event if events are enabled
     */
    private emitEvent;
    /**
     * Organize displayResults into a LayeredSkillResult structure
     *
     * Uses the shared data contract types for consistency across
     * backend, frontend, and HTML report generation.
     *
     * @param skillId - The skill identifier
     * @param skillName - Human-readable skill name
     * @param displayResults - Array of DisplayResult from skill execution
     * @param diagnostics - Array of DiagnosticResult findings
     * @param executionTimeMs - Execution time in milliseconds
     * @returns LayeredSkillResult conforming to the data contract
     */
    private buildLayeredSkillResult;
    /**
     * @deprecated Use buildLayeredSkillResult instead
     * Kept for backward compatibility during transition
     */
    private organizeResultsIntoLayers;
}
/**
 * Factory function to create a ModuleExpertInvoker
 * NOTE: This is now async to ensure skill registry is initialized before creating the invoker
 */
export declare function createModuleExpertInvoker(traceProcessorService: any, aiService?: any, config?: ModuleExpertInvokerConfig): Promise<ModuleExpertInvoker>;
//# sourceMappingURL=moduleExpertInvoker.d.ts.map