Skip to content

feat(menubar): daily budget alert respects the display metric (Cost or Tokens) (#497)#505

Merged
iamtoruk merged 1 commit into
mainfrom
feat/menubar-metric-aware-budget
Jun 18, 2026
Merged

feat(menubar): daily budget alert respects the display metric (Cost or Tokens) (#497)#505
iamtoruk merged 1 commit into
mainfrom
feat/menubar-metric-aware-budget

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Addresses the title of #497: the daily budget alert was cost-only, so users tracking the Tokens / Total Tokens metric had no token-based budget or alert. (The issue's body — a compact combined 🔥 20M view — is already shipped as the "Total Tokens" display metric; that part will be answered on the issue separately.)

Changes (macOS menubar app)

  • Separate token budget: new dailyTokenBudget, stored independently from the cost dailyBudget, so switching metric never reinterprets a dollar threshold as a token count.
  • Centralized, metric-aware check on AppStore: isTokenMetric, activeDailyBudget, todayMetricTotal, isOverDailyBudget, dailyBudgetLabel. The flame tint (CodeBurnApp) and the hero "budget exceeded" banner (HeroSection) both go through these instead of duplicating a cost-only comparison.
  • Settings: shows a token-threshold picker (Off / 1M / 5M / 10M / 25M / 50M / 100M) when the metric is token-based, and the existing dollar picker for the cost metric; help text adapts ("today's tokens" vs "today's cost").
  • Today's token total is inputTokens + outputTokens, matching the "Total Tokens" display.

Behavior

  • Cost metric (or Icon Only): unchanged — dollar budget, dollar alert.
  • Tokens / Total Tokens metric: budget and alert are token-based.
  • Existing users' cost budgets are untouched; the token budget defaults to off until set. No migration needed.

Validation

  • swift build (mac package) passes.
  • This is the macOS app, so the JS test suite does not cover it. Verified by compiling; a manual menubar check (set a token budget, exceed it, confirm flame turns yellow and the banner reads "Daily budget of NM tokens exceeded") is the runtime check.

…#497)

The daily budget was always measured in dollars, so users tracking the
Tokens or Total Tokens metric had no token-based budget alert. Add a
separate token-denominated daily budget and route the flame tint and the
hero "budget exceeded" banner through one metric-aware check.

- New dailyTokenBudget (stored separately from the cost budget so switching
  metric never reinterprets a threshold).
- Centralize the logic on AppStore: isTokenMetric, activeDailyBudget,
  todayMetricTotal, isOverDailyBudget, dailyBudgetLabel.
- Settings shows a token-threshold picker (1M..100M) for token metrics and
  the existing dollar picker for the cost metric, with metric-aware help text.
- Flame tint and the banner now use isOverDailyBudget / dailyBudgetLabel.
@iamtoruk iamtoruk merged commit dab1297 into main Jun 18, 2026
3 checks passed
@iamtoruk iamtoruk deleted the feat/menubar-metric-aware-budget branch June 18, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant