docs/antigravity.md
Antigravity supports three usage data sources:
language_server (preferred when the IDE/desktop app is open).agy CLI's embedded HTTPS localhost server (used when the desktop app is closed).The local and CLI paths both prefer Antigravity's internal GetUserStatus quota payload and may fall back to
GetCommandModelConfigs; CodexBar never scrapes the desktop UI or the agy TUI.
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 local desktop and agy CLI 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). Explicit cli/oauth source modes stay authoritative and are not re-checked.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:retrieveUserQuotaWhen the Antigravity desktop app is running:
Process detection
ps -ax -o pid=,command=.AntigravityStatusProbe(processScope: .ideOnly)). It deliberately does not
attach to an agy CLI process: a stale or still-initializing agy accepts the
connection but returns transient GetUserStatus errors, which would burn the
probe timeout. agy is owned exclusively by the CLI HTTPS source below, which
waits for real API readiness. The probe still classifies both kinds
(processInfo(scope: .ideAndCLI) is used by isRunning() for status reporting):
language_server* or language-server plus
Antigravity markers (--app_data_dir antigravity, an Antigravity app bundle path,
or a path containing /antigravity/); orantigravity-cli / antigravity_cli path segment, or the
agy binary (path-anchored so unrelated arguments/binaries do not match).--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; 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/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/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 source mode is auto, OAuth is used after both local paths fail. A selected saved Google account scopes the OAuth
fallback. The local and agy CLI 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.
ideName: antigravityextensionName: antigravitylocale: enideVersion: unknownuserStatus.cascadeModelConfigData.clientModelConfigs[].quotaInfo.remainingFractionuserStatus.cascadeModelConfigData.clientModelConfigs[].quotaInfo.resetTimeresetTime parsing:
accountEmail and planName only from GetUserStatus.AntigravityClaude (primary), Gemini Pro (secondary), Gemini Flash (tertiary)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