Skip to content

feat(opencode): show quota usage toast after quota refresh#26

Open
iceteaSA wants to merge 1 commit into
cortexkit:mainfrom
iceteaSA:feat/quota-toast
Open

feat(opencode): show quota usage toast after quota refresh#26
iceteaSA wants to merge 1 commit into
cortexkit:mainfrom
iceteaSA:feat/quota-toast

Conversation

@iceteaSA
Copy link
Copy Markdown

Summary

Displays a visual toast notification with quota usage bars after each quota cache refresh. Shows usage for both main and fallback accounts.

Example output

5h  ████████░░░░░░░░  50%
1w  ██████████████░░  87%

── work-alt ──
5h  ██████░░░░░░░░░░  38%
1w  ████████████░░░░  75%

Behavior

  • Fires after refreshMainQuotaCache completes (quota routing path)
  • Includes all enabled fallback accounts from storage
  • Toast variant scales with usage:
    • info — usage below 70%
    • warning — 70-90%
    • error — 90%+ (longer duration: 8s vs 5s)
  • Uses client.tui.showToast — gracefully no-ops if TUI is unavailable

Files changed

  • packages/opencode/src/index.ts — adds quotaBar() and showQuotaToast() utilities, calls from refreshMainQuotaCache

Testing

All 214 tests pass. Toast is fire-and-forget with .catch(() => {}) — no impact on request latency.

Displays a visual toast with quota bars (5h/1w) for main and fallback
accounts after each quota cache refresh. Shows 🟢 next to the currently
routable account (main if it passes quota policy, otherwise the first
qualifying fallback). Variant scales with usage: info < 70%, warning
70-90%, error >= 90%.
@iceteaSA iceteaSA force-pushed the feat/quota-toast branch from bb1169c to aec50fa Compare May 17, 2026 10:09
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