import { costRepo } from '../../store/cost-repo.js'; export type { CostsData, BudgetConfig } from '../../store/cost-repo.js'; export interface CostEntry { timestamp: string; project: string; trigger: string; cost_usd: number; num_turns: number | null; duration_s: number | null; backend: string; mode: string; source: string; input_tokens?: number; output_tokens?: number; provider?: string; model?: string; } interface PeriodBucket { today: number; week: number; month: number; total: number; } interface ModeBuckets { total: number; api: number; plan: number; [key: string]: number; } interface TokenBucket { input: number; output: number; } export interface CostSummary { today: number; week: number; month: number; total: number; byMode: Record; byProject: Record; byTrigger: Record; bySource: Record; byBackend: Record; tokens: { today: TokenBucket; month: TokenBucket; total: TokenBucket; }; entryCount: number; } export interface BudgetStatus { withinBudget: boolean; dailyBudget: number; dailySpent: number; dailyRemaining: number; monthlyBudget: number; monthlySpent: number; monthlyRemaining: number; byMode: Record; } /** * Record a cost entry after a Claude invocation. * source: 'estimate' (default, from Claude CLI) or 'gateway' (from aistatus gateway usage data) * Gateway entries may have cost_usd=0 (e.g. plan mode) but still track tokens. */ declare function recordCost({ project, trigger, cost_usd, num_turns, duration_s, backend, mode, source, input_tokens, output_tokens, provider, model }: { project?: string; trigger?: string; cost_usd?: number | null; num_turns?: number | null; duration_s?: number | null; backend?: string; mode?: string; source?: string; input_tokens?: number; output_tokens?: number; provider?: string; model?: string; }): Promise; /** * Detect project from a message string. * * @deprecated Use projectStore.resolveFromMessage() instead. * * Priority: * 1. [project:xxx] explicit tag — always wins * 2. Case-insensitive substring match against context/projects/ directory names * (longest match wins when multiple project names appear in the message) * 3. 'general' fallback */ declare function detectProject(message: string | null | undefined): string; /** * Get cost summary (global, optionally filtered by project). */ declare function getCostSummary(project?: string | null): Promise; /** * Check global budget (not per-project). * Returns budget status and whether we're within limits. */ declare function checkBudget(): Promise; /** * Update global budget limits. */ declare function setBudget({ daily_usd, monthly_usd }: { daily_usd?: number; monthly_usd?: number; }): Promise<{ daily_usd: number; monthly_usd: number; }>; /** * Format cost summary as a readable string for Slack. */ declare function formatCostReport(project?: string | null): Promise; /** Reset the project name cache. Pass an array to pre-seed the cache (for tests). */ declare function _resetProjectCache(names?: string[] | null): void; export { costRepo, recordCost, detectProject, getCostSummary, checkBudget, setBudget, formatCostReport, _resetProjectCache };