/** * traceSummary * * Computes a compact summary for a trace's span tree — the same set of * non-redundant signals shown in the Agent Traces inline-expansion header * strip and the fullscreen header. Keeping the computation in one place * means inline and fullscreen render exactly the same numbers from the * same source-of-truth (`categorizeSpanTree` for category buckets, * `gen_ai.usage.*` attribute aggregation for tokens, and dedup over * `gen_ai.request.model` / `gen_ai.response.model` / `model` for the * model name list). */ import { Span } from '../../types/index.js'; export interface TraceSummary { llm: number; tool: number; agent: number; evalCount: number; errors: number; inputTokens: number; outputTokens: number; totalTokens: number; /** Largest single-span input-token count in the trace. Used for context-window utilization (Ctx%) — the peak request, not the sum. */ peakInputTokens: number; models: string[]; } /** * Aggregate the headline signals from a span tree. * * The category counts come from {@link countByCategory} on a categorized * tree. The token counters look at every span (including children) and * sum the OTel GenAI usage attributes, with `prompt_tokens` / * `completion_tokens` accepted as fallbacks for older instrumentation * that pre-dates the input/output rename. Models are collected and * deduplicated across the trace because some agents fan out to multiple * models in one trace (e.g. a planner + a tool-using model). */ export declare function computeTraceSummary(spanTree: Span[]): TraceSummary; /** * True when no headline signal is present (no LLM/tool/agent/eval span, * no errors, no token counters, no model). Callers can use this to fall * back to a "no summary attributes available" placeholder instead of * collapsing to an empty bar. */ export declare function isEmptyTraceSummary(s: TraceSummary): boolean; //# sourceMappingURL=traceSummary.d.ts.map