Skip to content

feat(usage): add codex and agy usage visibility#78

Merged
StuBehan merged 1 commit into
mainfrom
feat/add-codex-agy-usage
Jun 8, 2026
Merged

feat(usage): add codex and agy usage visibility#78
StuBehan merged 1 commit into
mainfrom
feat/add-codex-agy-usage

Conversation

@StuBehan

@StuBehan StuBehan commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

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)

  • Reworked from a single Claude quota list into a left client list + right detail pane. ↑/↓ switch client; /Enter step into the pane; once inside ↑/↓ scroll it and steps back (Esc hides). A focus ring + footer hints reflect which level has focus. Only clients with data appear.

Codex quota (panel/CodexUsage.swift)

  • CodexQuotaProbe reads the newest ~/.codex/sessions rollout's latest payload.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)

  • AntigravityUsageProbe queries the running agy's local loopback Connect-RPC (GetUserStatus, discovered via lsof; 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 while agy is running (live RPC, not a persisted file).

Claude plan type (SessionUsage.swift)

  • QuotaProbe now also reads subscriptionType from the claudeAiOauth blob 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 in runQuotaProbe (same cadence + STACKNUDGE_QUOTA_TRACKING toggle as the Anthropic probe); two-level Usage key handling; restored programmatic detail-pane scroll. build.sh: new files added to the swiftc source list.
image

Testing

  • swift build → clean; ./build.sh → full app builds.
  • CodexQuotaProbe validated against a real ChatGPT-plan rollout: 5h 1% / weekly 0% / plan plus — matches the raw rate_limits.
  • AntigravityUsageProbe validated against the live agy 1.0.6 RPC: plan Pro, per-model bars (Gemini ~19% / Claude 0%), credits 500/50000 + 100/150000 — matches raw GetUserStatus.
  • Not exercisable in CI (panel/AX + live 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.
  • No new external network calls — Codex reads a local rollout file, agy hits loopback; the Anthropic probe is unchanged.

Related issues

Antigravity local-RPC usage approach informed by steipete/CodexBar#1178.

@StuBehan StuBehan merged commit e41f018 into main Jun 8, 2026
5 checks passed
@StuBehan StuBehan deleted the feat/add-codex-agy-usage branch June 8, 2026 22:11
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