/** * Traces Service - Fetch and process trace data from OpenSearch */ import { Span, TimeRange, TraceQueryParams, TraceSearchResult } from '../../types/index.js'; export { groupSpansByTrace, getSpansForTrace } from './traceGrouping.js'; export { extractMessagesFromSpans } from './messageExtraction.js'; /** * Fetch traces from the backend API * Backend handles config resolution (file or env vars) - no headers needed from frontend */ export declare function fetchTraces(params: TraceQueryParams): Promise; /** * Fetch traces by trace ID */ export declare function fetchTraceById(traceId: string): Promise; /** * Fetch traces by run IDs */ export declare function fetchTracesByRunIds(runIds: string[]): Promise; /** * Fetch traces correlated with a single test-case run, using all available * correlation strategies (see AGENTS.md → Trace correlation conventions): * * A. traceId — W3C-propagated agents share traceId with the eval span * B. runId — agents tag spans with `agent_health.run.id == runId` (or the * OTEL-standard `gen_ai.conversation.id`); the server query * unions both. NOT `gen_ai.request.id` — that is not a * registered Gen AI semconv attribute. See AGENTS.md → Strategy B. * C. agents — service.name + time-window fallback (opt-in / `includeWindowFallback`) * * Strategies A and B are always safe (no false positives). Strategy C is * opt-in because it can surface concurrent runs of the same agent and * cross-team noise on a shared cluster. */ export declare function fetchTracesForRun(params: { /** * Agent run id (Strategy B correlation). Optional — runs persisted via the * deferred trace-mode path may not carry one; in that case correlation * falls back to the time-window `windowAgents` clause (Strategy C). */ runId?: string; evalTraceId?: string; /** * Strategy A (direct): the report's own `traceId`. Agents that emit their * own OTel trace (e.g. pi) carry it on every span but NOT our connector * `runId`, so a direct `traceId` lookup returns the run's spans immediately * — independent of the deep-dive's window hints. */ traceId?: string; /** * Strategy D (direct): the report's `session.id`. Claude Code stamps it on * every span; a direct `sessionId` lookup correlates without needing a * window. (Server matches both the analyzed field and its `.keyword`.) */ sessionId?: string; includeWindowFallback?: boolean; windowAgents?: Array<{ serviceName: string; startedAt: number; endedAt: number; sessionId?: string; }>; size?: number; }): Promise; /** * Fetch recent traces for live tailing */ export declare function fetchRecentTraces(options: { minutesAgo?: number; sessionId?: string; serviceName?: string; textSearch?: string; size?: number; cursor?: string; }): Promise; /** * Fetch all traces for a Claude Code session by session ID */ export declare function fetchTracesBySessionId(sessionId: string): Promise; /** * Check traces API health * Backend handles config resolution (file or env vars) - no headers needed from frontend */ export declare function checkTracesHealth(): Promise<{ status: string; index?: string; error?: string; }>; /** * Process flat spans into a hierarchical tree structure */ export declare function processSpansIntoTree(flatSpans: Span[]): Span[]; /** * Calculate global time range across all spans */ export declare function calculateTimeRange(spans: Span[]): TimeRange; /** * Get color for a span based on its type/name */ export declare function getSpanColor(span: Span): string; /** * Compute the initial expanded-spans set for a trace: every root, plus * every ancestor of any ERROR-status span so the failing span is visible * on load instead of hidden behind collapsed parents (TraceTree and * Timeline both key off this set). */ export declare function getInitialExpandedSpans(spanTree: Span[]): Set; /** * Flatten tree into visible spans based on expanded state */ export declare function flattenVisibleSpans(spans: Span[], expandedSpans: Set, depth?: number): Span[]; export { categorizeSpan, categorizeSpans, categorizeSpanTree, getSpanCategory, getCategoryMeta, filterSpansByCategory, filterSpanTreeByCategory, countByCategory, buildDisplayName, checkOTelCompliance, hasAnyWarnings, } from './spanCategorization.js'; export { extractCommonArgKeys, groupToolSpans, calculateToolSimilarity, getToolGroupStats, } from './toolSimilarity.js'; export { calculateSpanSimilarity, compareTraces, flattenAlignedTree, getComparisonTypeInfo, } from './traceComparison.js'; export { spansToFlow, applyDagreLayout, detectParallelExecution, countSpansInTree, } from './flowTransform.js'; export { spansToExecutionFlow, isContainerSpan, findMainFlowSpans, sortByStartTime, } from './executionOrderTransform.js'; export { spansToIntentNodes, getRootContainerSpan, } from './intentTransform.js'; export { CATEGORY_COLORS, getCategoryColors, type CategoryColorConfig, } from './categoryStyles.js'; export { flattenSpans, calculateCategoryStats, extractToolName, extractToolStats, type CategoryStats, type ToolInfo, } from './traceStats.js'; export { computeTraceSummary, isEmptyTraceSummary, type TraceSummary, } from './traceSummary.js'; //# sourceMappingURL=index.d.ts.map