/**
 * Inserts aggregated trace DAG data into ClickHouse tables:
 * aggregated_trace_dag_metadata, aggregated_trace_dag_nodes, aggregated_trace_dag_edges,
 * and trusys_dev.trace_dag_metadata (per-trace metadata with tools, agents, models, metrics_state, plugins_state).
 * Schema includes metrics_state and plugins_state Map columns.
 */
import type { DagGraph } from './observe/types';
/** Allowed node types for aggregated DAG: prompt, agent, tool, model, response only (no workflow). */
export type DagNodeTypeForInsert = 'prompt' | 'agent' | 'tool' | 'model' | 'response';
interface TransformedDagNode {
    id: string;
    kind: DagNodeTypeForInsert;
    label: string;
    [key: string]: any;
}
interface TransformedDagEdge {
    from: string;
    to: string;
    type: 'invokes' | 'sequence' | 'parent';
    count: number;
    [key: string]: any;
}
export type MetricMapEntry = {
    pass: number;
    fail: number;
    scoreSum: number;
    scoreCount: number;
};
export declare function buildDagWithPromptAndResponse(spans: any[], dag: DagGraph, promptEntityId?: string | null, responseEntityId?: string | null): {
    nodes: TransformedDagNode[];
    edges: TransformedDagEdge[];
};
/**
 * Build DAG from spans and return tool and agent node ids for this trace.
 * Used to populate eval_results.tools and eval_results.agents before insert.
 */
export declare function getToolsAndAgentsFromSpans(spans: any[]): {
    tools: string[];
    agents: string[];
};
export type InsertAggregatedTraceDagParams = {
    spans: any[];
    traceId: string;
    projectId: string;
    workspaceId: string;
    applicationId: string;
    dbResults?: any[] | null;
};
export type InsertAggregatedTraceDagDeps = {
    clickHouseService: {
        command: (sql: string) => Promise<void>;
    };
    logger: {
        error: (msg: string) => void;
    };
};
export declare function insertAggregatedTraceDagData(params: InsertAggregatedTraceDagParams, deps: InsertAggregatedTraceDagDeps): Promise<void>;
export {};
//# sourceMappingURL=aggregatedTraceDagInsert.d.ts.map