/** * PURE, deterministic layered layout for the agent-graph view. No I/O, no * React: derives each span's semantic kind, lays the trace out as a layered * node-edge graph (depth = distance from root, order = index within depth), * flags the root→selected execution path, and caps huge traces — so the SVG * renderer stays thin. SVG-pure by ADR D4 of the blueprint (no elkjs/d3). */ import type { SpanKind, TraceSpan } from "./types.js"; /** * Derive a span's semantic kind from OTel GenAI signals (the raw `.kind` * field is often the OTLP numeric — useless as agent/tool/LLM). Precedence: * tool > retriever > embedding > llm > chain(has children) > unknown. */ export declare function deriveSpanKind(span: TraceSpan): SpanKind; /** Above this span count the graph renders an honest "too large" state. */ export declare const GRAPH_NODE_CAP = 200; export interface GraphNode { spanId: string; name: string; kind: SpanKind; depth: number; order: number; x: number; y: number; error: boolean; selected: boolean; onPath: boolean; } export interface GraphEdge { from: string; to: string; onPath: boolean; } export interface LayeredGraph { nodes: GraphNode[]; edges: GraphEdge[]; width: number; height: number; truncated: boolean; count: number; } /** * Build the deterministic layered graph. Edges come from parent/call order * (`parentId`), NOT the nested `children[]`, so malformed inputs are honest: * a self-loop or cycle is broken by a visited set; a span whose `parentId` * is absent from the trace is attached under the root, never dropped. * `onPath` = root→selected ancestor chain; with no selection, root→deepest * leaf. Over `cap` spans → `{ truncated: true, nodes: [], edges: [] }`. */ export declare function buildLayeredGraph(root: TraceSpan, selectedId?: string, cap?: number): LayeredGraph; /** Kind → display label. */ export declare const KIND_LABEL: Record;