//#region src/constants/context-breakdown.d.ts /** * Context breakdown schema definitions. * * This module defines the breakdown components tracked for each system prompt version. * It serves as the single source of truth for: * - Component keys and labels * - OpenTelemetry span attribute keys * - UI visualization colors (auto-generated) */ /** * Defines a single breakdown component for a system prompt version. * Each version can define its own set of components. */ interface BreakdownComponentDef { /** Unique key for this component (used in breakdown.components map) */ key: string; /** Human-readable label for UI display */ label: string; /** OpenTelemetry span attribute key for this component */ spanAttribute: string; /** Hex color for UI visualization (auto-generated) */ color: string; } /** * V1 Breakdown Schema - defines all context components tracked for V1 system prompts. * Colors are automatically generated for visual distinction. */ declare const V1_BREAKDOWN_SCHEMA: BreakdownComponentDef[]; /** Span attribute key for total tokens */ declare const CONTEXT_BREAKDOWN_TOTAL_SPAN_ATTRIBUTE = "context.breakdown.total_tokens"; /** * Dynamic context breakdown interface. * Uses a components map to support different system prompt versions. */ interface ContextBreakdown { /** Token counts by component key (version-specific) */ components: Record; /** Total estimated tokens */ total: number; } /** * Creates an empty context breakdown from a schema definition. * @param schema - Array of breakdown component definitions */ declare function createEmptyBreakdown(schema: BreakdownComponentDef[]): ContextBreakdown; /** * Calculates the total from all breakdown components and updates the total field. * @param breakdown - The context breakdown to calculate total for * @returns The breakdown with updated total */ declare function calculateBreakdownTotal(breakdown: ContextBreakdown): ContextBreakdown; /** * Parses a context breakdown from span attributes using a schema. * @param data - Span attribute data record * @param schema - Breakdown schema to use for parsing * @returns Parsed context breakdown */ declare function parseContextBreakdownFromSpan(data: Record, schema?: BreakdownComponentDef[]): ContextBreakdown; //#endregion export { BreakdownComponentDef, CONTEXT_BREAKDOWN_TOTAL_SPAN_ATTRIBUTE, ContextBreakdown, V1_BREAKDOWN_SCHEMA, calculateBreakdownTotal, createEmptyBreakdown, parseContextBreakdownFromSpan };