/** * Cost Tracker * * Tracks API costs during certifications with budget limits. * * @module cost/tracker */ import type { ModelId, TokenUsage, ApiCallRecord, CostSummary, BudgetConfig, BudgetStatus, CostTrackerState, CostTrackingOptions } from "./types.js"; /** * Cost tracker for a certification */ export declare class CostTracker { private state; private options; private persistPath?; constructor(certificationId: string, projectPath: string, options?: CostTrackingOptions); /** * Record an API call */ recordCall(model: ModelId, usage: TokenUsage, options?: { agent?: string; operation?: string; cached?: boolean; }): ApiCallRecord; /** * Check if within budget */ isWithinBudget(): boolean; /** * Check budget and throw if exceeded and abortOnExceeded is true */ checkBudget(): void; /** * Get current summary */ getSummary(): CostSummary; /** * Get current status */ getStatus(): BudgetStatus; /** * Get budget configuration */ getBudget(): BudgetConfig; /** * Update budget configuration */ setBudget(budget: Partial): void; /** * Get all call records */ getCalls(): ApiCallRecord[]; /** * Get full state */ getState(): CostTrackerState; /** * Save state to file */ persist(): Promise; /** * Load state from file */ load(): Promise; /** * Generate cost report */ generateReport(): string; /** * Generate compact summary string */ generateCompactSummary(): string; private createEmptySummary; private createInitialStatus; private createDummyRecord; private updateSummary; private updateStatus; private generateProgressBar; } /** * Error thrown when budget is exceeded */ export declare class BudgetExceededError extends Error { readonly summary: CostSummary; readonly budget: BudgetConfig; constructor(message: string, summary: CostSummary, budget: BudgetConfig); } /** * Get or create tracker for a certification */ export declare function getTracker(certificationId: string, projectPath: string, options?: CostTrackingOptions): CostTracker; /** * Remove tracker from registry */ export declare function removeTracker(certificationId: string, projectPath: string): void; /** * Get all active trackers */ export declare function getActiveTrackers(): Map; /** * Cost estimation input */ export interface CostEstimationInput { /** Number of files to scan */ fileCount: number; /** Expected number of findings (or 0 for estimate) */ expectedFindings?: number; /** Number of agents to run */ agentCount?: number; /** Whether cross-verification is enabled */ crossVerify?: boolean; /** Primary model to use */ model?: ModelId; } /** * Cost estimation result */ export interface CostEstimate { /** Estimated total cost */ estimatedCost: number; /** Estimated input tokens */ estimatedInputTokens: number; /** Estimated output tokens */ estimatedOutputTokens: number; /** Cost breakdown by phase */ breakdown: { scanning: number; analysis: number; crossVerification: number; overhead: number; }; /** Confidence level (low/medium/high) */ confidence: "low" | "medium" | "high"; /** Model used for estimation */ model: ModelId; /** Assumptions used */ assumptions: string[]; } /** * Estimate certification cost before running */ export declare function estimateCertificationCost(input: CostEstimationInput): CostEstimate; /** * Historical cost data for forecasting */ export interface HistoricalCostData { fileCount: number; findingCount: number; agentCount: number; actualCost: number; actualInputTokens: number; actualOutputTokens: number; } /** * Forecast future costs based on historical data */ export declare function forecastCost(historical: HistoricalCostData[], future: CostEstimationInput): CostEstimate & { historicalBasis: number; }; /** * Format cost estimate as markdown */ export declare function formatCostEstimate(estimate: CostEstimate): string; //# sourceMappingURL=tracker.d.ts.map