/** * Span-level detail rendering and trace-level usage aggregation for * `eve traces`. Kept separate from the command module: the tree renderer * stays compact while these helpers answer "what does this span carry" — * inline metric chips for tree rows, the `--verbose` per-span block, and * the usage/cost totals summarized in the trace header. */ import type { LocalTraceSpan } from "#tracing/local-trace-reader.js"; /** Usage and cost totals aggregated over a trace's `agent.step` spans. */ export interface LocalTraceSummary { readonly cacheReadTokens: number; readonly cacheWriteTokens: number; /** Total gateway cost in USD; undefined when no span reported cost. */ readonly costUsd?: number; readonly errorCount: number; readonly inputTokens: number; /** Distinct model ids seen on any span, first-seen order. */ readonly models: readonly string[]; readonly outputTokens: number; } /** * Compact metrics for one tree row: token chips (`↑1.4K`/`↓213`), cost * (`$0.0031`), and the tool name for `ai.toolCall` spans. Only chips whose * attributes the span actually carries — rows without usage stay clean. * Raw values: callers sanitize for their output surface. */ export declare function spanMetricChips(span: LocalTraceSpan): string[]; /** * Aggregates usage, cost, models, and errors across one trace. Only * `agent.step` spans contribute usage: model spans carry the same counters * and a subagent's totals already appear as its own step spans in the same * trace, so summing anything else would double-count. */ export declare function summarizeLocalTrace(spans: readonly LocalTraceSpan[]): LocalTraceSummary; /** One-line `Tokens` header value: `↑1.2K in · ↓340 out · 1.1K cached`. */ export declare function formatTokenSummary(summary: LocalTraceSummary): string; /** Formats a USD cost: `$1.50` at scale, `$0.0031` for typical spans. */ export declare function formatCostUsd(costUsd: number): string; /** * The `--verbose` block for one span: facts (status, timing, ids), every * attribute sorted with payloads rendered as transcripts/pretty JSON, then * every event with its offset from span start, rendered as `tree(1)`-style * entries: each fact, attribute key, and event is an entry with a connector * beneath the span's row, so the rails never break. Payload content wraps * under its key on a plain margin. `childrenFollow` decides whether the last * entry closes the branch — child span rows come after the detail entries. */ export declare function renderSpanDetailTree(span: LocalTraceSpan, options: { readonly childrenFollow: boolean; readonly margin: string; readonly mute: (text: string) => string; readonly width: number; }): string[];