$ show Draculabo/AntigravityManager
Antigravity Manager is an Electron desktop application that serves as a multi-account manager and local API proxy gateway for AI models (Google Gemini, Claude, OpenAI-compatible). It allows users to pool multiple Google Cloud accounts, automatically rotates between them based on real-time quota and rate limits, and exposes a local proxy server that translates between OpenAI, Anthropic, and Gemini API protocols. The application handles OAuth token lifecycle, credential storage across OS keychains and encrypted files, and includes a React UI for account management, quota monitoring, and configuration. Architecturally, the app is a monolith with three major layers: an Electron main process that bootstraps a NestJS server (Fastify), a React renderer with TanStack Router and shadcn/ui, and a Python CLI for headless account operations. The proxy gateway is the most complex module, with controllers for OpenAI chat completions, Anthropic messages, Gemini models, batch jobs, file uploads, and WebSocket-based Responses API. Credential management is handled through a multi-provider master key system with migration paths, atomic file writes, and SQLite persistence via Drizzle ORM. The codebase also includes device identity profile manipulation (fingerprint spoofing) gated by environment variables, and binary patching of the agy CLI executable. The codebase demonstrates strong engineering practices with extensive Vitest unit tests (250+ test files), Playwright e2e tests, Zod schema validation at IPC boundaries, and structured error handling. However, it also carries risks: hardcoded model aliases and Google API endpoints, fragile binary patching logic, and a large surface area of credential storage strategies that may drift as OS APIs evolve. The repo is actively maintained with frequent commits and CI pipelines, but the complex fallback chains and security-sensitive code require careful ongoing maintenance.
The LLM identified 5 files worth highlighting for reuse:
A crash-safe, JSON-backed key-value store with configurable TTL, max entry limits, and a revive callback for data validation on load. Uses atomic file writes (temp + rename) and supports overflow eviction by least-recently-written or oldest-first policy. Reusable in any Node.js application needing lightweight, durable persistence without a full database engine.
A set of pure functions implementing a batch job state machine with transitions (reset, cancel, expire, claim, complete) and status/error type narrowing. Completely side-effect-free and domain-independent, making it extractable into any project requiring a deterministic job lifecycle. Demonstrates clean TypeScript with discriminated unions and exhaustive type guards.
Exponential backoff and retry utilities with jitter, configurable max attempts, timeout, and error classification. Supports both immediate retries and delayed retries with backoff, and provides a retry loop that integrates with upstream error details. The code is self-contained, well-typed, and can be reused in any Node.js HTTP client or service needing resilient retry logic.
A content-addressed file store that deduplicates by SHA-256 hash, with TTL-based expiry, atomic index persistence (crash-safe via temp file + rename), MIME type sniffing, and configurable storage backend. Designed for storing uploaded files in a proxy context but fully extractable as a general-purpose blob store. Demonstrates careful handling of concurrent writes, index corruption recovery, and streaming read/write operations.
An LRU cache for thought/response signatures with cross-session persistence via a DurableRecordStore. Handles signature matching, eviction, and recovery across application restarts. The implementation includes size-bounded LRU eviction, atomic persistence of signatures, and a cleanup mechanism for stale entries. Reusable in any application needing to maintain stateful signature tracking across sessions with bounded memory usage.