import type { AnalyticsEntry } from '../analytics/analytics-types.js'; import type { AnalyticsRollup } from '../analytics/analytics-rollup.js'; import { type SavingsClassification } from '../analytics/savings-classification.js'; import { type ProviderUsageSummary } from '../analytics/native-provider-usage.js'; interface EffectivePricing { available: boolean; effectiveInputUsdPerMillion: number | null; source: 'versioned-provider-model-catalog'; verifiedAt: string; explanation: string; } export interface DashboardActionAnalytics { name: string; totalOperations: number; totalOriginalTokens: number; totalOptimizedTokens: number; totalTokensSaved: number; grossTokensSaved: number; expansionTokensReturned: number; unverifiedReportedTokensSaved: number; savingsPercentage: number | null; contextUsd: number | null; savedUsd: number | null; firstSeen: string; lastSeen: string; measuredSavingsOperations: number; pricedReturnedContextOperations: number; pricedSavingsOperations: number; verifiedExpansionOperations: number; unmeasuredSavingsOperations: number; observedReturnedContextOperations: number; unverifiedReportedOperations: number; } export interface DashboardAnalyticsReport { schemaVersion: 3; available: boolean; source: string; pricing: EffectivePricing; summary: { totalOperations: number; totalOriginalTokens: number; totalOptimizedTokens: number; measuredOptimizedTokens: number; totalTokensSaved: number; grossTokensSaved: number; expansionTokensReturned: number; unverifiedReportedTokensSaved: number; savingsPercentage: number | null; contextUsd: number | null; savedUsd: number | null; firstSeen: string | null; lastSeen: string | null; measuredSavingsOperations: number; pricedReturnedContextOperations: number; pricedSavingsOperations: number; verifiedExpansionOperations: number; unmeasuredSavingsOperations: number; actualReturnedContextOperations: number; legacyReportedContextOperations: number; observedReturnedContextOperations: number; unverifiedReportedOperations: number; /** * Operations that live in folded day totals rather than in rows. * * DISCLOSED BECAUSE `recent` CANNOT BE FOLDED. Every total above is exact * across the fold, so nothing here shrinks when a day ages out -- but the * recent list is per-operation by construction and a folded day has no * operations left to list. Without this an operator reading an empty tail * under a large total would have no way to tell "nothing happened" from * "it is a total now". */ foldedOperations: number; foldedDays: number; /** * File reads this store measured the tool as standing in for, in tokens. * * ITS OWN FIGURE, NEVER FOLDED INTO `totalTokensSaved`. See the note on * `Split.inputDisplacementTokens`: these two credits share one `after` and * have different `before`s, so adding them would double-count the reply. */ inputDisplacementTokens: number; displacementOperations: number; /** * The same avoidance on weaker evidence: the before was DECLARED by the * tool because the recorder could not reach it from the arguments, and * only the after was counted here. Published as its own figure so a * reader can see how much of a total rests on a tool's own word. */ declaredDisplacementTokens: number; declaredOperations: number; /** * What each measurement contract in this store contributed. * * THE BREAK IS SHOWN, NOT SUMMED ACROSS. Every figure above spans every * contract the store holds, and a reader has no way to tell a total drawn * from one definition of a saving from one drawn from two. A day already * folded cannot be re-measured under the newer contract -- its rows are * gone -- so the honest move is to label which definition produced which * part. Version 0 is a day folded before the stamp existed. */ contracts: Array<{ measurementSchemaVersion: number; current: boolean; operations: number; verifiedSavingsOperations: number; totalTokensSaved: number; inputDisplacementTokens: number; declaredDisplacementTokens: number; firstSeen: string | null; lastSeen: string | null; }>; }; byAction: DashboardActionAnalytics[]; byClient: Array<{ name: string; attribution: 'recorded' | 'historical-unattributed'; totalOperations: number; observedReturnedContextOperations: number; verifiedSavingsOperations: number; verifiedExpansionOperations: number; unverifiedReportedOperations: number; totalOptimizedTokens: number | null; totalTokensSaved: number | null; unverifiedReportedTokensSaved: number; contextUsd: number | null; savedUsd: number | null; pricedReturnedContextOperations: number; pricedSavingsOperations: number; }>; recent: Array<{ name: string; originalTokens: number; optimizedTokens: number; tokensSaved: number; reportedTokensSaved: number; contextUsd: number | null; savedUsd: number | null; timestamp: string; savingsMeasured: boolean; classification: SavingsClassification; client: string | null; model: string | null; }>; measurement: { definition: string; tokenCountMethod: string; legacyPolicy: string; priceBasis: string; }; providerUsage: ProviderUsageSummary; } /** * Summarize only provenance-qualified savings. Historical tool-reported rows * stay visible as an audit population, but never enter the verified headline. */ export declare function summarizeDashboardAnalytics(input: AnalyticsEntry[], options?: { limit?: number; providerUsage?: ProviderUsageSummary; rollups?: readonly AnalyticsRollup[]; }): DashboardAnalyticsReport; export declare function readDashboardAnalytics(limit?: number): Promise; export declare function readDashboardProviderUsage(limit?: number): Promise; export {}; //# sourceMappingURL=dashboard-analytics.d.ts.map