#803

feat: integrate ai gateway w/ onboarding

Openwillsatherwants to merge intofrom

Summary

This PR integrates Vercel AI Gateway connectivity into the application with a comprehensive onboarding flow, team management, credit tracking, and enhanced account settings. It adds new API endpoints for Vercel integration, database migrations, and improved UI components for managing Vercel connections.

Changes

API Routes (apps/web/app/api/)

  • Added onboarding status endpoint (onboarding/status/route.ts)
  • Added Vercel credits endpoint with teamId support (vercel/credits/route.ts)
  • Added Vercel gateway key endpoint for OAuth exchange (vercel/gateway-key/route.ts)
  • Added Vercel teams endpoint for team retrieval (vercel/teams/route.ts)
  • Updated chat route for AI Gateway integration (chat/route.ts)
  • Updated auth callback route for Vercel OAuth flow (auth/vercel/callback/route.ts)

Onboarding Flow (apps/web/app/onboarding/)

  • Implemented comprehensive onboarding flow component with Vercel and GitHub selection (onboarding-flow.tsx)
  • Added onboarding page (page.tsx)
  • Added onboarding utility functions (lib/onboarding.ts)
  • Simplified onboarding logic with AI Gateway integration

Vercel Integration (apps/web/lib/vercel/)

  • Created Vercel API client for gateway operations (api-client.ts)
  • Implemented gateway key management and OAuth exchange logic (gateway-key.ts)
  • Implemented teams retrieval and management (teams.ts)
  • Added Vercel-specific type definitions (types.ts)

Settings UI (apps/web/app/settings/)

  • Created Vercel-specific settings section with team selection and credit display (vercel-section.tsx)
  • Enhanced accounts section with improved descriptions and UI (accounts-section.tsx)
  • Updated connections page routing (connections/page.tsx)

Database (apps/web/lib/db/)

  • Added migration for Vercel integration schema (migrations/0029_lying_cardiac.sql)
  • Updated schema with new Vercel-related fields (schema.ts)
  • Updated migration metadata (migrations/meta/0029_snapshot.json, migrations/meta/_journal.json)

GitHub Integration (apps/web/lib/github/)

  • Enhanced GitHub module with improved integration helpers (index.ts)

UI & Core (apps/web/app/)

  • Updated home page with onboarding link (page.tsx)
  • Added OpenAgentsLogo component and refactored onboarding UI
  • Replaced Select components with Popover for better team switcher UX
  • Replaced img tags with Next.js Image component for optimization

Agent Package (packages/agent/)

  • Updated open-harness-agent with AI Gateway support (open-harness-agent.ts)

Documentation & Planning

  • Added planning document for user AI Gateway connections (plans/user-ai-gateway-connections.md)
  • Updated AGENTS.md with current integration details

Chat - Built with guidance from Will Sather