- Root: Add Prometheus/Metis/Momus agents, MCP architecture, 82 test files - agents/: Document 7-section delegation and wisdom notepad - auth/: Multi-account load balancing (10 accounts), endpoint fallback - features/: Update background-agent 825 lines, builtin-skills 1230 lines - hooks/: 22+ hooks with event timing details - tools/: sisyphus-task 583 lines, LSP client 632 lines - cli/: config-manager 725 lines, 17+ doctor checks - shared/: Cross-cutting utilities with usage patterns
2.5 KiB
2.5 KiB
AUTH KNOWLEDGE BASE
OVERVIEW
Google Antigravity OAuth for Gemini models. Token management, fetch interception, thinking block extraction.
STRUCTURE
auth/
└── antigravity/
├── plugin.ts # Main export, hooks registration (554 lines)
├── oauth.ts # OAuth flow, token acquisition
├── token.ts # Token storage, refresh logic
├── fetch.ts # Fetch interceptor (798 lines)
├── response.ts # Response transformation (598 lines)
├── thinking.ts # Thinking block extraction (755 lines)
├── thought-signature-store.ts # Signature caching
├── message-converter.ts # Format conversion
├── accounts.ts # Multi-account management (up to 10 accounts)
├── browser.ts # Browser automation for OAuth
├── cli.ts # CLI interaction
├── request.ts # Request building
├── project.ts # Project ID management
├── storage.ts # Token persistence
├── tools.ts # OAuth tool registration
├── constants.ts # API endpoints, model mappings
└── types.ts
KEY COMPONENTS
| File | Purpose |
|---|---|
| fetch.ts | URL rewriting, multi-account rotation, endpoint fallback |
| thinking.ts | Thinking block extraction, signature management, budget mapping |
| response.ts | Streaming SSE parsing and response transformation |
| accounts.ts | Load balancing across up to 10 Google accounts |
| thought-signature-store.ts | Caching signatures for multi-turn thinking conversations |
HOW IT WORKS
- Intercept:
fetch.tsintercepts Anthropic/Google requests. - Route: Rotates accounts and selects best endpoint (daily → autopush → prod).
- Auth: Injects Bearer tokens from
token.tspersistence. - Process:
response.tsparses SSE;thinking.tsmanages thought blocks. - Recovery: Detects GCP permission errors and triggers recovery/rotation.
FEATURES
- Multi-account load balancing (up to 10 accounts)
- Strategic endpoint fallback: daily → autopush → prod
- Persistent thought signatures for continuity in thinking models
- Automated GCP permission error recovery
ANTI-PATTERNS
- Hardcoding endpoints: Use
constants.tsor letfetch.tsroute. - Manual token handling: Use
token.tsandstorage.tsabstraction. - Sync OAuth calls: All auth flows must be non-blocking/async.
- Ignoring account rotation: Let
fetch.tshandle load balancing.