Guidance for AI agents working with this repository.
This is an OpenCode plugin that enables OAuth authentication with Google's Antigravity API. It allows access to models like gemini-3-pro-high and claude-opus-4-5-thinking using Google credentials.
npm install # Install dependencies
npm run build # Compile TypeScript
npm run typecheck # Type checking only
npm test # Run testssrc/
├── plugin.ts # Main entry, fetch interceptor
├── constants.ts # Endpoints, headers, config
├── antigravity/oauth.ts # OAuth token exchange
└── plugin/
├── auth.ts # Token validation & refresh
├── request.ts # Request transformation (main logic)
├── request-helpers.ts # Schema cleaning, thinking filters
├── thinking-recovery.ts # Turn boundary detection
├── recovery.ts # Session recovery (tool_result_missing)
├── quota.ts # Quota checking (API usage stats)
├── cache.ts # Auth & signature caching
├── accounts.ts # Multi-account management
└── debug.ts # Debug logging
Plugin intercepts fetch() for generativelanguage.googleapis.com, transforms to Antigravity format.
For Claude models, ALL thinking blocks are stripped from outgoing requests. Claude generates fresh thinking each turn. This eliminates signature validation errors.
When tool execution is interrupted (ESC/timeout), the plugin injects synthetic tool_result blocks to recover the session.
Tool schemas are cleaned via allowlist approach. Unsupported fields (const, $ref, $defs) are removed or converted.
Accounts are rotated on rate limits. Gemini has dual quota pools (Antigravity + Gemini CLI headers).
| File | Purpose |
|---|---|
src/plugin.ts |
Main entry, orchestrates flow |
src/plugin/request.ts |
Request/response transformation |
src/plugin/request-helpers.ts |
Schema cleaning, thinking filters |
src/plugin/thinking-recovery.ts |
Turn boundary detection |
src/plugin/recovery.ts |
Session recovery hook |
- README.md - Installation & usage
- docs/ARCHITECTURE.md - Detailed architecture guide
- docs/ANTIGRAVITY_API_SPEC.md - API reference