import { AnalysisSession, CollectedResult } from '../types/analysis';
import { OrchestratorResult, MasterOrchestratorResult, Finding } from '../agent/types';
import { DataEnvelope } from '../types/dataContract';
import type { ComparisonReportSection } from '../agentv3/sessionStateSnapshot';
import type { ClaimVerificationResult } from '../types/claimVerification';
import type { ClaimSupportV1 } from '../types/evidenceContract';
import type { IdentityResolutionV1 } from '../types/identityContract';
export interface ReportData {
    sessionId: string;
    traceId: string;
    question: string;
    answer: string;
    /** Trace start timestamp in ns (string to preserve precision) */
    traceStartNs?: string;
    metrics: {
        totalDuration: number;
        iterationsCount: number;
        sqlQueriesCount: number;
    };
    collectedResults: CollectedResult[];
    skillEngineResult?: {
        skillId: string;
        skillName: string;
        sections: Record<string, any>;
        diagnostics: Array<{
            id: string;
            severity: string;
            message: string;
            suggestions?: string[];
        }>;
    };
    timestamp: number;
}
export interface AgentReportData {
    traceId: string;
    query: string;
    result: OrchestratorResult;
    timestamp: number;
}
export interface MasterAgentReportData {
    traceId: string;
    query: string;
    result: MasterOrchestratorResult;
    timestamp: number;
}
export interface AgentDrivenReportData {
    traceId: string;
    query: string;
    /** Trace start timestamp in ns (string to preserve precision) */
    traceStartNs?: string;
    result: {
        sessionId: string;
        success: boolean;
        findings: Finding[];
        hypotheses: Array<{
            id: string;
            description: string;
            confidence: number;
            status: string;
            supportingEvidence: any[];
            contradictingEvidence: any[];
        }>;
        conclusion: string;
        conclusionContract?: unknown;
        claimSupport?: ClaimSupportV1[];
        claimVerificationResult?: ClaimVerificationResult;
        identityResolutions?: IdentityResolutionV1[];
        confidence: number;
        rounds: number;
        totalDurationMs: number;
        partial?: boolean;
        terminationReason?: string;
        terminationMessage?: string;
    };
    hypotheses: Array<{
        id: string;
        description: string;
        confidence: number;
        status: string;
        supportingEvidence: any[];
        contradictingEvidence: any[];
    }>;
    dialogue: Array<{
        agentId: string;
        type: 'task' | 'response' | 'question';
        content: any;
        timestamp: number;
    }>;
    conversationTimeline?: Array<{
        eventId: string;
        ordinal: number;
        phase: 'progress' | 'thinking' | 'tool' | 'result' | 'error';
        role: 'agent' | 'system';
        text: string;
        timestamp: number;
        sourceEventType?: string;
    }>;
    dataEnvelopes?: DataEnvelope[];
    agentResponses?: Array<{
        taskId: string;
        agentId: string;
        response: any;
        timestamp: number;
    }>;
    timestamp: number;
    /** P1-11: User conversation turn count (distinct from SDK internal rounds). */
    conversationTurns?: number;
    /** P0-R1: Cross-turn query history for multi-turn reports */
    queryHistory?: Array<{
        turn: number;
        query: string;
        timestamp: number;
    }>;
    /** P0-R2: Cross-turn conclusion history for multi-turn reports */
    conclusionHistory?: Array<{
        turn: number;
        conclusion: string;
        confidence: number;
        timestamp: number;
    }>;
    /** P1-R3: Analysis notes from Claude's write_analysis_note MCP tool */
    analysisNotes?: Array<{
        section?: string;
        type?: string;
        content: string;
        priority?: string;
        timestamp?: number;
    }>;
    /** P1-R3: Current analysis plan from submit_plan MCP tool */
    analysisPlan?: {
        phases: Array<{
            name: string;
            goal?: string;
            status: string;
            summary?: string;
        }>;
        successCriteria: string;
    } | null;
    /** P1-R3: Uncertainty flags from flag_uncertainty MCP tool */
    uncertaintyFlags?: Array<{
        topic: string;
        assumption: string;
        question: string;
    }>;
    /** Shared deterministic comparison section for raw or snapshot comparison reports. */
    comparisonReportSection?: ComparisonReportSection;
}
export declare class HTMLReportGenerator {
    private domIdSeq;
    private getOutputLanguage;
    private getReportLocale;
    private getLocalizedCausalMapScript;
    private static reportMd;
    private getReportMd;
    /**
     * 【P2 Fix】可配置的元数据列名
     * 这些列的值在同一表格中通常是恒定的，会被提取到表头显示
     */
    private static readonly METADATA_COLUMN_PATTERNS;
    /**
     * 【P2 Fix】检查列名是否为元数据列
     */
    private isMetadataColumn;
    /**
     * 标识符列（如 frame_id/session_id）不应做千分位格式化，
     * 否则用户复制后会变成 "1,435,508" 这类不可直接用于 drill-down 的值。
     */
    private isIdentifierKey;
    private normalizeIdentifierDisplay;
    private sanitizeDomIdPart;
    private nextDomId;
    private parseNs;
    private formatRelativeSeconds;
    private stringifyValueForDisplay;
    /**
     * Generate HTML report from analysis data
     */
    generateHTML(data: ReportData): string;
    /**
     * Generate skill engine specific section
     */
    private generateSkillEngineSection;
    /**
     * Generate expandable section for iterator results
     * 生成可展开的迭代器结果区块，包含主表格和每行的详细数据
     */
    private generateExpandableSection;
    /**
     * Generate detail content for a single expandable row
     * 生成单行展开后的详细内容
     */
    private generateDetailContent;
    /**
     * 生成诊断要点表格（与前端一致的格式）
     */
    private generateDiagnosisTable;
    /**
     * 将诊断数组渲染为表格（与前端一致）
     */
    private generateDiagnosticsAsTable;
    /**
     * Generate query result section with collapsible support
     */
    private generateQueryResultSection;
    /**
     * Generate HTML table from data (with collapsible rows for large tables)
     */
    private generateTable;
    /**
     * Generate HTML table from DataEnvelope (v2.0 schema-driven rendering)
     *
     * This method uses the column definitions from the envelope's display config
     * to render the table with proper formatting and styling.
     */
    private generateTableFromEnvelope;
    private generateSummaryFromEnvelope;
    private generateTextFromEnvelope;
    /**
     * Generate expandable table from DataEnvelope.expandableData while respecting display columns/metadata.
     * This matches frontend behavior: show only visible columns, expand rows to show deep sections.
     */
    private generateExpandableTableFromEnvelope;
    /**
     * Get CSS class for a cell based on column definition
     */
    private getCellClassFromDefinition;
    /**
     * Format a cell value based on column definition
     */
    private formatCellValueFromDefinition;
    /**
     * Format a number in compact notation
     */
    private formatCompactNumber;
    /**
     * Format bytes in human-readable form
     */
    private formatBytes;
    /**
     * Format answer with markdown-like syntax
     * Now delegates to markdownToHtml for full support including tables
     */
    private formatAnswer;
    /**
     * Format cell value for display
     */
    private formatCellValue;
    private getCellClass;
    private getSeverityLabel;
    /**
     * Convert result rows to object array
     */
    private rowsToObjects;
    /**
     * Generate layered result section (overview/list/session/deep)
     * 生成分层结果区块
     */
    private generateLayeredResultSection;
    /**
     * Generate content for a specific layer
     */
    private generateLayerContent;
    /**
     * Render a single step result from layered output
     */
    private renderStepResult;
    /**
     * Render a single displayResult from layered output
     */
    private renderDisplayResult;
    private renderDeepFrameAnalysis;
    /**
     * HTML 转义
     * 【P2 Fix】添加 null/undefined 类型检查，避免 TypeError
     */
    private escapeHtml;
    /**
     * Convert Markdown to HTML using markdown-it.
     * Handles nested lists, tables, blockquotes, fenced code blocks (incl. mermaid),
     * and all standard markdown features with proper XSS safety (html:false).
     */
    private markdownToHtml;
    /**
     * Convert Markdown tables to HTML tables
     */
    private convertMarkdownTables;
    /**
     * Parse a single table row into cells
     */
    private parseTableRow;
    generateAgentHTML(data: AgentReportData): string;
    private renderExpertResult;
    private renderFinding;
    private renderDiagnostic;
    /**
     * Generate HTML report from MasterOrchestratorResult (new architecture)
     */
    generateMasterAgentHTML(data: MasterAgentReportData): string;
    /**
     * Render methodology section for beginners to understand the analysis approach
     */
    private renderMethodologySection;
    /**
     * Render AI reasoning timeline for beginners to understand the analysis flow
     */
    private renderReasoningTimeline;
    private renderStageResult;
    /**
     * Render layered data (overview, list, deep)
     */
    private renderLayeredData;
    /**
     * Render overview data as metric cards or tables
     * Supports both:
     * 1. Simple key-value format: { key: value }
     * 2. StepResult format: { stepId: { stepId, data: [...], display } }
     */
    private renderOverviewData;
    /**
     * Render list data as collapsible tables
     * Supports both:
     * 1. Direct array format: { key: [...] }
     * 2. StepResult format: { stepId: { stepId, data: [...], display } }
     */
    private renderListData;
    /**
     * Render a data table with optional hidden rows
     */
    private renderDataTable;
    /**
     * Render a single table row
     */
    private renderTableRow;
    /**
     * Format a cell value for display in layered data tables (with key-based formatting)
     */
    private formatLayeredCellValue;
    /**
     * Render a nested object as a formatted HTML string
     * Used for displaying complex nested structures in a readable format
     */
    private renderNestedObject;
    /**
     * Render deep analysis data
     */
    private renderDeepAnalysisData;
    /**
     * Render a deep analysis card (for frame details, etc.)
     */
    private renderDeepAnalysisCard;
    /**
     * Format a metric key as a human-readable label
     */
    private formatMetricLabel;
    /**
     * Generate HTML report from agent runtime result (Phase 2-4 architecture)
     */
    generateAgentDrivenHTML(data: AgentDrivenReportData): string;
    private prepareAgentDrivenEnvelopes;
    private buildAgentEnvelopeDedupeKey;
    private renderCodeAwareReferencesSection;
    private formatLineRange;
    private renderConclusionClaimSourcesSection;
    private renderClaimVerificationSection;
    private renderClaimReferenceSummaryItem;
    private buildClaimSourceLookup;
    private claimSourceCombinedKey;
    private normalizeClaimSourceRef;
    private claimSourceRefAliases;
    private formatClaimReferenceLocator;
    private formatReportSelector;
    private asReportRecord;
    private readReportAliasedValue;
    private readReportAliasedString;
    private readReportAliasedRecords;
    private renderComparisonReportSection;
    /**
     * Render the DataEnvelopes section with all collected SQL result tables
     */
    private renderDataEnvelopesSection;
    /**
     * Render a single DataEnvelope as a card with table
     */
    private renderSingleEnvelope;
    private renderEnvelopeTechnicalDetails;
    private renderEnvelopeTechnicalRow;
    private formatTechnicalValue;
    private getReportEnvelopeTitle;
    private getReportEnvelopePurpose;
    private inferReportEnvelopePurpose;
    private isGenericSqlTitle;
    private isLowSignalEnvelopeReason;
    private getEnvelopeColumns;
    private getEnvelopeRowCount;
    private formatEnvelopeSource;
    /**
     * Render a finding with evidence, details, and recommendations
     */
    private renderEnhancedFinding;
    /**
     * 格式化 detail 值为更友好的显示
     */
    private formatDetailValue;
    /**
     * 获取 severity 对应的边框颜色
     */
    private getSeverityColor;
    /**
     * 获取 severity 对应的背景色
     */
    private getSeverityBg;
    /**
     * P1-R3: Render analysis plan section from agentv3 submit_plan data
     */
    private renderAnalysisPlanSection;
    /**
     * P1-R3: Render analysis notes from agentv3 write_analysis_note data
     */
    private renderAnalysisNotesSection;
    /**
     * P1-R3: Render uncertainty flags from agentv3 flag_uncertainty data
     */
    private renderUncertaintyFlagsSection;
    /**
     * 渲染假设与验证部分 - 精简版
     * 只在假设驱动模式下显示，且只显示已确认或高置信度的假设
     */
    private renderHypothesesSection;
    private normalizeConversationTimeline;
    private compactConversationTimelineText;
    private getConversationPhaseLabel;
    private renderConversationTimelineSection;
    /**
     * 渲染发现的问题部分 - 已禁用
     * 数据已在 DataEnvelopes 中详细展示，此部分冗余
     */
    private renderFindingsSection;
    /**
     * Render enhanced dialogue item with meaningful content extraction from agent responses
     */
    private renderEnhancedDialogue;
    generateFromSession(session: AnalysisSession, answer: string): string;
}
export declare function getHTMLReportGenerator(): HTMLReportGenerator;
export default HTMLReportGenerator;
//# sourceMappingURL=htmlReportGenerator.d.ts.map