feat(usage): add codex and agy usage visibility#78
Merged
Conversation
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
Adds usage/quota visibility for Codex and Antigravity (agy) to the Usage tab alongside Claude, and reworks the tab into a per-client layout. It now lists each connected client (Claude / Codex / Antigravity) with its plan and shows that client's quota; you can step into the detail pane to scroll it.
Changes
Usage tab → per-client layout (
SessionUsage.swift)↑/↓switch client;→/Enterstep into the pane; once inside↑/↓scroll it and←steps back (Eschides). A focus ring + footer hints reflect which level has focus. Only clients with data appear.Codex quota (
panel/CodexUsage.swift)CodexQuotaProbereads the newest~/.codex/sessionsrollout's latestpayload.rate_limits(primary= 5h,secondary= weekly;used_percent+resets_at+plan_type), mtime-cached, local-only. Rendered as "Codex · ". ChatGPT-plan auth only — API-key users emit none, so it's cleanly absent.Antigravity (agy) usage (
panel/AntigravityUsage.swift)AntigravityUsageProbequeries the runningagy's local loopback Connect-RPC (GetUserStatus, discovered vialsof; HTTP, no auth/CSRF, 127.0.0.1 only) for per-model quota (remainingFraction→ utilization +resetTime) plus plan + credits. Rendered as per-model bars ("Claude Opus 4.6 (Thinking)", "Gemini 3.5 Flash (High)", …) with a credits line, under "Antigravity · ". Only available whileagyis running (live RPC, not a persisted file).Claude plan type (
SessionUsage.swift)QuotaProbenow also readssubscriptionTypefrom theclaudeAiOauthblob it already loads (no new keychain access) → shown as "Claude · ".Wiring (
PanelNav.swift,Panel.swift,build.sh)PanelNav:codexQuota/antigravityQuota,usageClientIndex,usageDetailFocused,availableUsageClients.Panel.swift: both probes polled inrunQuotaProbe(same cadence +STACKNUDGE_QUOTA_TRACKINGtoggle as the Anthropic probe); two-level Usage key handling; restored programmatic detail-pane scroll.build.sh: new files added to the swiftc source list.Testing
swift build→ clean;./build.sh→ full app builds.CodexQuotaProbevalidated against a real ChatGPT-plan rollout: 5h 1% / weekly 0% / planplus— matches the rawrate_limits.AntigravityUsageProbevalidated against the liveagy1.0.6 RPC: plan Pro, per-model bars (Gemini ~19% / Claude 0%), credits 500/50000 + 100/150000 — matches rawGetUserStatus.agy). Manual check: open Usage → Claude / Codex / Antigravity in the left list with plan labels;↑/↓switch;→step into a client (focus ring),↑/↓scroll (e.g. agy's per-model bars),←back.Related issues
Antigravity local-RPC usage approach informed by steipete/CodexBar#1178.