Skip to content

feat: Usage & Spend tab, external hooks, Cursor cost labels (0.44/0.45 deferred)#229

Merged
Finesssee merged 1 commit into
mainfrom
port/045-deferred-ui
Jul 21, 2026
Merged

feat: Usage & Spend tab, external hooks, Cursor cost labels (0.44/0.45 deferred)#229
Finesssee merged 1 commit into
mainfrom
port/045-deferred-ui

Conversation

@Finesssee

@Finesssee Finesssee commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Ports deferred upstream 0.44/0.45 UI pieces to Win-CodexBar:

1. Usage & Spend settings tab (upstream 0.44 steipete#2116)

  • New usageSpend settings tab with provider | 7d | 30d | currency table
  • Tauri command get_usage_spend_summary using CostScanner for Codex/Claude local logs
  • Includes period cost snapshots from cached providers when available
  • No share-card PNG (P2 skip)

2. External hooks (upstream steipete#2001) — minimal but real

  • rust/src/core/hooks.rs: HookEvent, HookRule, HooksConfig, HookRunner, HookRateLimiter
  • Loads %APPDATA%\CodexBar\hooks.json (next to settings)
  • Spawn binary with no shell; env whitelist PATH/HOME/USER/TEMP (+ TMP/USERPROFILE) + CODEXBAR_*
  • Stdin JSON payload ≤4KiB; timeout; in-process rate limiter for spammy events
  • Wired on provider refresh when high/critical/exhausted/reset thresholds are crossed
  • Settings Advanced tab: enable toggle hooks_enabled + path help text
  • Unit tests for payload/env + rate limiter

3. Cursor token-cost deepen (best-effort)

  • Plan usage still clamps ≤100 (already)
  • Clearer CostSnapshot period labels: On-demand (billing cycle) and Plan (since …) from existing usage-summary fields only (no new network endpoints)

Tests

cargo test --manifest-path rust/Cargo.toml hooks
cargo test --manifest-path rust/Cargo.toml plan_cost_period
cargo test --manifest-path rust/Cargo.toml test_cursor_on_demand
cargo check --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml
node apps/desktop-tauri/scripts/check-locale-drift.mjs  # OK 691 keys

Note: core::provider::tests::test_provider_id_all fails pre-existing (63 vs 59 count from earlier provider ports); unrelated to this change.

Example hooks.json

{
  enabled: true,
  events: [
    {
      enabled: true,
      event: quota_low,
      threshold: 0.7,
      executable: C:\\\\path\\\\to\\\\notify.exe,
      arguments: [],
      timeoutSecs: 10
    }
  ]
}

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Port deferred 0.44/0.45 UI pieces:
- Settings Usage & Spend tab with 7d/30d CostScanner aggregates
- External hooks runner (hooks.json) with env whitelist + rate limit
- hooks_enabled setting + Advanced tab help
- Cursor CostSnapshot period labels for plan/on-demand spend
@github-actions

Copy link
Copy Markdown

This repository allows each user to open at most 4 pull requests per 7 days.

Closing this automatically.

@github-actions github-actions Bot closed this Jul 21, 2026
@Finesssee
Finesssee merged commit 90e68c7 into main Jul 21, 2026
1 check passed
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