Live Codex usage (fix 0%), OpenCode Go provider, multi-account Gemini + UI fixes - #6
Open
luispriet wants to merge 1 commit into
Open
Conversation
…UI fixes - Codex: query live /backend-api/codex/usage instead of stale session logs (fixes 0%) - OpenCode Go: dollar-value limit windows from local opencode.db (this-machine estimate) - Gemini: multiple accounts (~/.gemini/accounts/*.json) + self-refresh via gemini-cli public OAuth client - Fix: derive isLoading from connectedSources (manual counter desynced -> stuck loading) - Fix: Flickable + height cap so the popup scrolls instead of clipping Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
This adds the improvements I built locally on top of
v1.1.0(Fedora 44, KDE Plasma 6). All changes are backward-compatible;metadatabumped to1.2.0.Fix — Codex usage showed
0%The Codex provider read the passive
~/.codex/sessionslogs. Codex0.139.0emits atoken_countwhoserate_limits.limit_id == "premium"with null primary/secondary; the old fallback picked it, soused_percentfell back to0. Now it queries the same live endpoint/statususes —GET https://chatgpt.com/backend-api/codex/usage(ChatGPT OAuth from~/.codex/auth.json,ChatGPT-Account-Idheader). It's a plain GET (no token cost), read-only (never writesauth.json), and falls back to the local history (hardened to skip the nullpremiumbucket) if the request fails.Feature — OpenCode Go provider
Dollar-value limit windows ($12 / 5h, $30 / week, $60 / month, all configurable). OpenCode has no public usage API, so spend is a local estimate from
~/.local/share/opencode/opencode.db(read-only SQLite) and is clearly labeled "this machine (est.)". The monthly window is anchored to a configurable renewal day.Feature — multiple Gemini accounts
Reads the primary
~/.gemini/oauth_creds.jsonplus any~/.gemini/accounts/*.json→ one card per account (labeled by email from theid_token). It refreshes expired tokens itself (viaoauth2.googleapis.com/token) using gemini-cli's public OAuth client (installed-app credentials shipped in the gemini-cli package — not a user secret), so an account the CLI isn't actively using doesn't die when its token expires. JSON stays backward-compatible (top-level = first account, plus anaccountsarray).Fixes
…instead of values):isLoadingwas a manual+1/-1counter, but Plasma'sexecutableengine collapses identical in-flight sources, so the counter never returned to 0. Now derived fromrunner.connectedSources.length.Flickablewith a height cap → it scrolls instead of being cut off.Happy to adjust naming, split into smaller PRs, or rework anything you prefer.