import type { CostEntry } from '../domain/costs/cost-tracker.js'; export interface CostsData { entries: CostEntry[]; } export interface BudgetConfig { daily_usd: number; monthly_usd: number; } export declare class CostRepo { private costMutex; private _ready; private _budgetRepo; private readonly _costsPath; private readonly _budgetPath; /** * Explicit paths override env-var / DATA_DIR resolution. If omitted, paths are resolved * lazily on first I/O from CORTEX_COSTS_FILE / CORTEX_BUDGET_FILE or default locations. */ constructor(opts?: { costsPath?: string; budgetPath?: string; }); private get costFilePath(); private get budgetRepo(); /** * One-time startup init: ensure dir exists, prune stale entries. * Called from both read and write paths. */ private _ensureReady; /** Read raw JSONL file — no side effects. */ private _readFileEntries; /** * Record a single cost entry. Append-only — no full-file read. */ recordEntry(entry: CostEntry): Promise; /** * Record multiple cost entries atomically in a single append. */ recordEntryBatch(entries: CostEntry[]): Promise; /** * Read all cost entries. Parses JSONL format. Triggers startup prune on first call. */ readCosts(): Promise; readBudget(): Promise; writeBudget(budget: BudgetConfig): Promise; /** * Wait for any in-flight cost append / prune to complete, then flush budget repo. * For graceful SIGTERM drain. */ flush(): Promise; /** * Clear lazy state so the next I/O picks up current env-var values. * Only for tests that change CORTEX_COSTS_FILE / CORTEX_BUDGET_FILE after module import. */ _testReset(): void; } export declare const costRepo: CostRepo;