/**
 * multi-framework-parser.ts
 * Main orchestrator for multi-framework OpenTelemetry trace parsing
 *
 * Features:
 * - Auto-detect framework (LangChain, CrewAI, Autogen)
 * - Dependency injection for parsers
 * - Unified API across all frameworks
 * - Comprehensive edge case handling
 */
import type { Span, FrameworkParser, ParseResult, Tool, Agent, Model, DAGNode, LinearStep, ParseMetadata, DagGraph, RenderLinearGraph } from './types';
import { type EntityNode, type SpanTreeNode } from './utils/treeBuilder';
export declare class MultiFrameworkParser {
    private parsers;
    private defaultParser;
    constructor();
    private extractTraceDimensions;
    private applyTraceDimensions;
    /**
     * Register a custom framework parser
     */
    registerParser(framework: string, parser: FrameworkParser): void;
    /**
     * Unregister a parser
     */
    unregisterParser(framework: string): void;
    /**
     * Get a specific parser
     */
    getParser(framework: string): FrameworkParser | undefined;
    /**
     * AUTO-DETECT framework from spans
     */
    detectFramework(spans: Span[]): 'langgraph' | 'langchain' | 'crewai' | 'autogen' | 'llamaindex' | 'generic';
    /**
     * GET TOOLS from detected framework
     */
    getTools(spans: Span[]): Tool[];
    /**
     * GET AGENTS from detected framework
     */
    getAgents(spans: Span[]): Agent[];
    /**
     * GET MODELS from detected framework
     */
    getModels(spans: Span[]): Model[];
    /**
     * GENERATE DAG from detected framework
     */
    generateDag(spans: Span[]): DAGNode[];
    /**
     * Convert timestamp (string ISO or numeric Unix ns/ms/s) to ms since epoch.
     * Uses number; may lose sub-ms precision for large nanosecond values. Prefer timestampToDecimalMs for sorting.
     */
    private static timestampToMs;
    /**
     * Normalize timestamp to nanoseconds (Decimal) for comparison/sorting only.
     * Single scale so ns/ms/s/ISO are comparable; no conversion to ms needed.
     */
    private static timestampToDecimalNs;
    /**
     * Timestamp in ms (Decimal) for duration/output. Use timestampToDecimalNs for comparison only.
     */
    private static timestampToDecimalMs;
    /**
     * Compare two spans by timestamp (high-precision), then by id for stable order when equal.
     */
    private static compareSpanByTimestamp;
    /**
     * GENERATE LINEAR FLOW from detected framework (sorted by timestamp, stepNumber stable).
     */
    generateLinearFlow(spans: Span[]): LinearStep[];
    /**
     * PARSE ALL - comprehensive parsing in one call
     */
    parse(spans: Span[]): ParseResult;
    /**
     * PARSE with specific framework parser
     */
    parseWithFramework(spans: Span[], framework: string): ParseResult;
    /**
     * Get parser for spans
     */
    private getParserForSpans;
    /**
     * GET DAG DATA - returns only DAG graph data (folded: unique nodes per tool/agent/model/prompt/response).
     * Mirrors getLinearFlowData in structure: prompt → unique entities → response; nodes shown once in acyclic graph.
     */
    getDagData(spans: Span[]): {
        dag: DagGraph;
        input?: string;
        output?: string;
        entityOfSpanId: Map<string, string>;
        promptEntityId?: string;
        responseEntityId?: string;
        nodeIdsWIthNameMap: MapIterator<[string, string]>;
    };
    /**
     * Convert verified linear flow (renderLinear) to DAG format.
     * Creates unique nodes and edges with proper labels (prompt, response, tool:<name>, agent:<name>, model:<name>).
     */
    private foldDagWithPromptAndResponse;
    /**
     * Adapted version of findPromptAndResponseEntities that works with linear flow data
     */
    private findPromptAndResponseEntitiesFromLinear;
    /**
     * GET LINEAR FLOW DATA - uses same logic as getTraceViewDagData (entity hierarchy, DFS order).
     * Returns linearFlow derived from the trace view order so linear and trace view stay in sync.
     */
    getLinearFlowData(spans: Span[]): {
        input?: string;
        output?: string;
        renderLinear: RenderLinearGraph;
    };
    /**
     * TRACE VIEW DAG (span-level, no clubbing):
     * - Only nodes: prompt / agent / tool / model / response
     * - Edges represent a single LINEAR flow (prompt -> step1 -> ... -> response)
     * - Hierarchy is represented by *ordering* (agent then its tool(s) then their model(s)),
     *   derived from real span parent relationships + timestamps (no invented links).
     * - Nodes/edges are returned precomputed for the UI (no frontend stitching required).
     */
    getTraceViewDagData(spans: Span[]): {
        input?: string;
        output?: string;
        renderLinear: RenderLinearGraph;
    };
    /**
     * Check if a model is a descendant of any agent or tool in the span hierarchy
     */
    private isModelDescendantOfAgentOrTool;
    /**
     * Filter root nodes to exclude models that are descendants of agents or tools
     * Models inside agents/tools should appear as children, not as root-level nodes
     */
    private filterRootNodes;
    /**
     * GET DETAILS DATA - returns agents, tools, models, metadata, and pre-built trees
     */
    getDetailsData(spans: Span[]): {
        agents: Agent[];
        tools: Tool[];
        models: Model[];
        metadata: ParseMetadata;
        framework: string;
        input?: string;
        output?: string;
        entityHierarchy: EntityNode[];
        spanTree: SpanTreeNode[];
    };
    private laneForKind;
    private buildRenderLinearGraph;
    /**
     * Extract the initial user input prompt and final response from the trace
     */
    private extractInputOutput;
    /**
     * Helper to extract content from Autogen nested message JSON
     */
    private extractAutogenContent;
    /**
     * Extract user prompt from gen_ai.workflow.input JSON string
     */
    private extractUserPromptFromWorkflowInput;
    /**
     * Extract final response from gen_ai.workflow.output JSON string
     */
    private extractFinalResponseFromWorkflowOutput;
    /**
     * Extract user prompt from gen_ai.prompt string format
     * Format: "system: ...\nhuman: ...\nai: ..."
     */
    private extractUserPromptFromPromptString;
    /**
     * Calculate metadata
     */
    private calculateMetadata;
    /**
     * LlamaIndex: models are not always children of agent spans (e.g. siblings under AgentWorkflow.run).
     * Roll up model metrics to agents in the same workflow root when ancestry-based rollup did not match.
     */
    private rollupModelsToAgentsLlamaIndex;
    private enrichAgentsAndToolsFromModels;
}
export default MultiFrameworkParser;
//# sourceMappingURL=frameworkParser.d.ts.map