Skip to content

feat(opencode): add Antigravity CLI connector#31066

Open
anisches wants to merge 1 commit into
anomalyco:devfrom
anisches:antigravity-connector
Open

feat(opencode): add Antigravity CLI connector#31066
anisches wants to merge 1 commit into
anomalyco:devfrom
anisches:antigravity-connector

Conversation

@anisches
Copy link
Copy Markdown

@anisches anisches commented Jun 6, 2026

Issue for this PR

Closes #28889

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a provider that reuses an existing Antigravity CLI (agy) sign-in — Gemini, Claude, and GPT-OSS with no extra login or API key.

  • read agy's OAuth token from the OS keychain (macOS Keychain / Linux Secret Service); refresh with agy's own client, read from the agy binary at runtime rather than hardcoded
  • list models from Code Assist fetchAvailableModels (only responds with the antigravity User-Agent); rewrite @ai-sdk/google requests into the v1internal envelope; unwrap responses (JSON + SSE)
  • synthesize and pair the tool-call ids @ai-sdk/google omits for regular tools — Gemini pairs by position, but the backend maps them to Anthropic tool_use / OpenAI tool_calls, which need a matching id, so Claude/GPT-OSS otherwise fail
  • self-register the provider when models.dev doesn't have it: synthesize a minimal catalog record from the plugin's provider hook (adds optional name to ProviderHook), so it needs no config entry and survives catalog refreshes
  • keychain read works on all three OSes: macOS Keychain (security), Linux Secret Service (secret-tool), Windows Credential Manager (CredRead via PowerShell) — handling go-keyring's base64-on-macOS vs raw-JSON-on-Linux/Windows value formats

How did you verify your code works?

  • exercised end-to-end on macOS, Linux (Fedora), and Windows 11: keychain read → token refresh → model list → generateContent with tool calls, across Gemini, Claude Sonnet/Opus, and GPT-OSS
  • bun test test/plugin/google-antigravity.test.ts (12 pass — envelope translation, SSE unwrap, fallback catalog, auth loader, tool-call id pairing)
  • bunx tsc --noEmit -p tsconfig.json in packages/opencode

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

Hey! Your PR title Add Antigravity CLI connector (Gemini, Claude, GPT-OSS via existing agy sign-in) doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@anisches anisches changed the title Add Antigravity CLI connector (Gemini, Claude, GPT-OSS via existing agy sign-in) feat(opencode): add Antigravity CLI connector Jun 6, 2026
@github-actions github-actions Bot removed needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Jun 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@anisches anisches force-pushed the antigravity-connector branch from 0793b9b to a75ba1b Compare June 6, 2026 08:36
Reuse an existing Google Antigravity CLI (`agy`) sign-in inside opencode and
route inference through Google's Code Assist backend — no new login, no API keys.

- Auth: read agy's OAuth session from the OS credential store — macOS Keychain,
  Linux Secret Service, Windows Credential Manager (CredRead); refresh using
  agy's own client, whose id/secret are read from the agy binary at runtime
  rather than shipped in source.
- Model discovery: fetchAvailableModels (gated behind the `antigravity`
  User-Agent) returns the authoritative catalog with real display names and
  limits — Gemini, Claude Sonnet/Opus 4.6, and GPT-OSS.
- Inference: rewrite @ai-sdk/google requests into the Code Assist v1internal
  envelope and unwrap responses (JSON + SSE).
- Tool calls: synthesize and FIFO-pair the tool-call ids @ai-sdk/google drops
  for regular tools, which the backend needs to build Anthropic tool_use /
  OpenAI tool_calls — this is what makes Claude/GPT-OSS work.
- Core: let a plugin's provider hook self-register a minimal catalog record when
  models.dev/config doesn't have it (ProviderHook gains an optional name).

Verified end-to-end on macOS, Linux, and Windows. Closes anomalyco#28889.
@anisches anisches force-pushed the antigravity-connector branch from a75ba1b to d3d29f0 Compare June 6, 2026 08:37
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.

[FEATURE]: Add Antigravity CLI connector & Google OAuth provider

1 participant