docs/antigravity.md
Antigravity supports four usage data sources:
language_server (preferred when the app is open).agy CLI's embedded HTTPS localhost server (preferred over the IDE because it exposes richer quota data).language_server (used after agy CLI because current IDE local payloads only expose session/model quota data).The local and CLI paths both prefer Antigravity's internal RetrieveUserQuotaSummary quota payload and may fall back to
GetUserStatus, then GetCommandModelConfigs; CodexBar never scrapes the desktop UI or the agy TUI.
As of Antigravity 2.x, the Antigravity app and agy CLI payloads can be richer than Google OAuth and IDE payloads.
RetrieveUserQuotaSummary exposes the same two groups shown by Antigravity's Model Quota UI:
Gemini Models: weekly limit and five-hour limit.Claude and GPT models: weekly limit and five-hour limit.Older local payloads may only include raw Claude, GPT-OSS, Gemini tiers, account plan, and session reset timestamps.
Current Antigravity IDE local endpoints return GetUserStatus, GetAvailableModels, and GetCascadeModelConfigData
with five-hour/session reset data, but not the app/CLI RetrieveUserQuotaSummary weekly/session grouping. OAuth
payloads can be less complete and may only prove model availability. Treat auto as the authoritative user-facing mode:
it accepts the first account-matching source in Antigravity app -> agy CLI -> Antigravity IDE order, and adds OAuth
when CodexBar has a selected/injected Google account or an existing shared credentials file. An all-100%
fetchAvailableModels payload is only accepted after retrieveUserQuota echoes bucket fractions; this can be an
availability-style fallback rather than the full Antigravity quota summary.
Antigravity.app or overridden with ANTIGRAVITY_OAUTH_CLIENT_ID and ANTIGRAVITY_OAUTH_CLIENT_SECRET.~/.codexbar/antigravity/oauth_creds.json and upserts a token-account entry for the Google account.AntigravityOAuthCredentials and is injected into remote fetches through ANTIGRAVITY_OAUTH_CREDENTIALS_JSON.auto mode the ambient Antigravity app, agy CLI, and IDE probes still run first, but a snapshot whose account
does not match the selected account is rejected so the pipeline falls through to the account-scoped OAuth fetch (see
AntigravitySelectedAccountGuard). If no account is selected/injected, auto includes OAuth only when the legacy
shared credentials file already exists. Explicit cli/oauth source modes stay authoritative and are not re-checked.~/.codexbar/antigravity/oauth_creds.json deletes that shared file,
so a removed CodexBar account does not silently continue refreshing through the legacy shared cache.Add Account...; switching between saved accounts scopes Google OAuth fetches.POST https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssistPOST https://cloudcode-pa.googleapis.com/v1internal:onboardUserPOST https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModelsPOST https://cloudcode-pa.googleapis.com/v1internal:retrieveUserQuotaPOST https://cloudcode-pa.googleapis.com/v1internal:retrieveUserQuotaSummary (available, but current observed OAuth
responses are model-bucket shaped rather than Antigravity 2.0's two quota groups)When the Antigravity 2.0 app is running:
Process detection
ps -ax -o pid=,command=.AntigravityStatusProbe(processScope: .appOnly)). It deliberately does not
attach to an IDE or agy CLI process: a lower-information IDE payload should not mask
agy's richer quota summary, and a stale or still-initializing agy can accept the
connection before it is ready. agy is owned exclusively by the CLI HTTPS source below,
which waits for real API readiness. The probe still classifies all kinds
(processInfo(scope: .ideAndCLI) is used by isRunning() for status reporting):
language_server, language_server_macos,
language_server_macos_arm, or language-server plus
Antigravity markers (--app_data_dir antigravity, an Antigravity app bundle path,
or a path containing /antigravity/); orAntigravity IDE.app/.../extensions/antigravity/bin/ with --app_data_dir antigravity-ide; orantigravity-cli / antigravity_cli path segment, or the
agy binary (path-anchored so unrelated arguments/binaries do not match).GetUserStatus
two-pool fallback.--csrf_token <token>. Requirement depends on the match kind:
missingCSRFToken
is reported (unchanged behavior).--csrf_token flag and requires none.--extension_server_port <port> (HTTP fallback; app/IDE only).--extension_server_csrf_token <token> (preferred HTTP fallback token when present).Port discovery
lsof -nP -iTCP -sTCP:LISTEN -a -p <pid>.Connect port probe (HTTPS)
POST https://127.0.0.1:<port>/exa.language_server_pb.LanguageServerService/GetUnleashDataX-Codeium-Csrf-Token: <token>Connect-Protocol-Version: 1Quota fetch
POST https://127.0.0.1:<connectPort>/exa.language_server_pb.LanguageServerService/RetrieveUserQuotaSummaryPOST https://127.0.0.1:<connectPort>/exa.language_server_pb.LanguageServerService/GetUserStatusPOST https://127.0.0.1:<connectPort>/exa.language_server_pb.LanguageServerService/GetCommandModelConfigsextension_server_port.agy CLI HTTPS sourceWhen source mode is auto or cli and the desktop local probe fails, CodexBar resolves agy via:
ANTIGRAVITY_CLI_PATHPATH / login-shell path lookup~/.local/bin/agy/opt/homebrew/bin/agy/usr/local/bin/agyCodexBar launches agy in a PTY because the CLI exposes its quota server only while the interactive process is alive.
The implementation still does not scrape terminal output; it only keeps the process alive, drains discarded PTY
rendering, discovers listening ports with lsof, and probes the local HTTPS server:
POST https://127.0.0.1:<port>/exa.language_server_pb.LanguageServerService/RetrieveUserQuotaSummaryPOST https://127.0.0.1:<port>/exa.language_server_pb.LanguageServerService/GetUserStatusPOST https://127.0.0.1:<port>/exa.language_server_pb.LanguageServerService/GetCommandModelConfigsThe fallback can return quota without the account email or plan fields from GetUserStatus.
Differences from the desktop local probe:
X-Codeium-Csrf-Token.agy
processes can bind a port before the quota service is initialized.agy is kept alive briefly after a refresh, then stopped on idle. CLI runtime
tears it down immediately after the one-shot fetch.agy
process on the next launch. It never blind-kills a user-launched agy.When the Antigravity 2.0 app and agy CLI are unavailable, CodexBar probes Antigravity IDE language servers with
AntigravityStatusProbe(processScope: .ideOnly). Current observed IDE payloads return model-level/session quota data
through GetUserStatus, GetAvailableModels, and GetCascadeModelConfigData; RetrieveUserQuotaSummary returns 404
from the IDE local server. This means the IDE fallback can show session bars, but should not be expected to provide the
weekly limit shown by Antigravity 2.0.
When source mode is auto, OAuth is used after app, agy CLI, and IDE paths fail if CodexBar has a selected/injected
Google account or an existing shared credentials file. The app, agy CLI, and IDE probes still run first, but in
auto mode their snapshots are accepted only when the reported account matches the selected account; otherwise the
pipeline falls through to this account-scoped OAuth fetch. When source mode is oauth, only OAuth is used and the
shared OAuth file can still be used as a fallback credential source.
ideName: antigravityextensionName: antigravitylocale: enideVersion: unknownresponse.groups[].displayNameresponse.groups[].buckets[].bucketIdresponse.groups[].buckets[].displayNameresponse.groups[].buckets[].remaining.remainingFractionresponse.groups[].buckets[].descriptionuserStatus.cascadeModelConfigData.clientModelConfigs[].quotaInfo.remainingFractionuserStatus.cascadeModelConfigData.clientModelConfigs[].quotaInfo.resetTimeGemini Session, Gemini Weekly, Claude + GPT Session, and Claude + GPT Weekly as named windows.windowMinutes from the bucket ID/display name.Gemini groups Gemini Pro and Gemini Flash text models.Claude + GPT groups Claude text models and GPT/GPT-OSS text models.resetTime parsing:
accountEmail and planName only from GetUserStatus.AntigravityGemini (primary), Claude + GPT (secondary)remainingFraction. Those windows stay
in extraRateWindows for reset context and are marked with usageKnown: false; clients should not render their
usedPercent as a real exhausted quota.lsof for local/CLI port detection.Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swiftSources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swiftSources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swiftSources/CodexBar/Providers/Antigravity/AntigravityProviderImplementation.swift