Skip to content

CostTracker

Defined in: escalation/cost-tracker.ts:43

Cost tracker for managing cloud agent budgets

new CostTracker(dailyBudget, options?): CostTracker

Defined in: escalation/cost-tracker.ts:48

number

(remaining, total) => void

CostTracker

canAfford(amount, date?): boolean

Defined in: escalation/cost-tracker.ts:89

Check if operation is within budget

number

string

boolean


cleanup(keepDays?): void

Defined in: escalation/cost-tracker.ts:162

Clear old entries (keep last N days)

number = 30

void


export(): Record<string, CostEntry[]>

Defined in: escalation/cost-tracker.ts:178

Export all data (for persistence)

Record<string, CostEntry[]>


getDailyBudget(): number

Defined in: escalation/cost-tracker.ts:214

Get current daily budget

number


getDailyStats(date?): DailyCostStats

Defined in: escalation/cost-tracker.ts:108

Get daily statistics

string

DailyCostStats


getRemainingBudget(date?): number

Defined in: escalation/cost-tracker.ts:99

Get remaining budget for today

string

number


getStatsInRange(startDate, endDate): DailyCostStats[]

Defined in: escalation/cost-tracker.ts:132

Get stats for a date range

string

string

DailyCostStats[]


getTotalCost(): number

Defined in: escalation/cost-tracker.ts:150

Get all-time total cost

number


import(data): void

Defined in: escalation/cost-tracker.ts:190

Import data (from persistence)

Record<string, CostEntry[]>

void


record(taskId, agent, amount, description?): CostEntry

Defined in: escalation/cost-tracker.ts:61

Record a cost entry

string

string

number

string = 'Cloud agent operation'

CostEntry


reset(): void

Defined in: escalation/cost-tracker.ts:200

Reset all tracking data

void


setDailyBudget(budget): void

Defined in: escalation/cost-tracker.ts:207

Update daily budget

number

void