Repository navigation
feat(widget): show a prepaid balance as its amount in the bar - #107
Merged
Merged
Conversation
A prepaid balance has no total to measure against, so its window reports 0% used (100% only once it is empty) and the bar read 100% left for any balance. Adapters now mark such a window with isBalance, and the bar pill, its tooltip and the card header show its displayValue amount instead of the percentage. The flag is explicit rather than guessed from the label or the shape of displayValue: DeepSeek, Kimi, xAI prepaid credits, Cline, Ollama Cloud purchased credits and Vercel AI Gateway set it, and an informational value such as Unlimited keeps its percentage. DeepSeek formats its amounts at the source with the currency symbol and two decimals, like the other balance adapters, so the widget hard-codes no currency table. Co-authored-by: dotredstone <[email protected]> Signed-off-by: Bernardo Pinto Gomes <[email protected]>
Signed-off-by: Bernardo Pinto Gomes <[email protected]>
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Split out of #101 (the "prepaid balance pill" part by @DotRedstone, credited as co-author) and rebuilt around an explicit flag. Stacked on #106, because it shares the card header lines; review that one first.
A prepaid balance has no total to measure against, so its window reports 0% used (100% only once empty), and the bar read "100% left" for any balance. With this PR the bar pill, its tooltip, multi-window pills and the card header show the amount (
$95.50,¥9.34).Changes from #101:
resetDescriptiontext ("balance", "credits") and the shape ofdisplayValue. Adapters now setisBalance: trueon real balance windows: DeepSeek (all three), Kimi available balance, xAI prepaid credits, Cline credits (only when the balance is known), Ollama Cloud purchased credits and Vercel AI Gateway. Informational values such asUnlimitedkeep their percentage.CNY/USD/EUR/GBPprefixes in the widget and changedformatUsageLine()for every provider. Instead, DeepSeek formats at the source like the other balance adapters: currency symbol and two decimals (¥9.34rather thanCNY 9.34; unknown ISO codes keep their prefix).isBalanceis described inarchitecture.mdandproviders.md.Tests:
test-cov-d2-deepseek.shandtest-cov-d-simple-api.shcover symbols, rounding, unknown codes, the flag on all three windows andcredits.remaining.test-widget-runtime.shrenders a balance window and checks the pill, the card header, the tooltip, the multi-window pill row, and that an informationaldisplayValuekeeps its percentage. I ran it natively on Wayland.Related issues
Part of #101.
Type of change
Checklist
plugin.json.versionandCHANGELOG.mdare consistent (not release-bearing;## Unreleasedbullet)i18n/en.jsonkeys have translations in every localegit commit -s) under the DCOLocal gates:
check-metadata,check-changelog,check-dco,bash -n,shellcheck -S warning,qmllint,actionlint,gitleaks, everytests/test-*.sh(including the native widget runtime on Wayland), andAIOC_COVERAGE_MIN=95 scripts/coverage.