Feat: Implement real GitHub Copilot Device Flow authentication UI

- Add IPC handlers for github-copilot:authenticate, isAuthenticated, disconnect
- Add schema definitions for new IPC handlers in shared/ipc.ts
- Implement Device Flow authentication button with real flow
- Show device code and verification URL to user when authenticating
- Automatically open GitHub verification page in browser
- Auto-load models after successful authentication
- Update GitHub Copilot model list (gpt-4o, gpt-4-turbo, gpt-3.5-turbo, claude-3.5-sonnet)
- Display loading state and error messages in UI
- Properly integrate with existing auth service

This fixes the broken authentication flow where the button didn't do anything.
This commit is contained in:
Rowboat Developer 2026-04-17 09:56:32 -05:00
parent 4f53f0af48
commit b7866e3067
5 changed files with 135 additions and 17 deletions

View file

@ -14,14 +14,13 @@ import { LlmProvider } from '@x/shared/dist/models.js';
const GITHUB_COPILOT_API_BASE = 'https://models.github.com/api/openai/';
// List of models available through GitHub Copilot
// Based on GitHub Copilot documentation
// Based on GitHub Copilot API documentation
// https://docs.github.com/en/copilot/using-github-copilot/asking-github-copilot-questions
export const GITHUB_COPILOT_MODELS = [
'gpt-4o',
'gpt-4-turbo',
'gpt-4',
'gpt-3.5-turbo',
'claude-3.5-sonnet', // If available in student plan
'claude-3-opus', // If available in student plan
'gpt-4o', // GPT-4 Optimized (recommended)
'gpt-4-turbo', // GPT-4 Turbo
'gpt-3.5-turbo', // GPT-3.5 Turbo (fastest)
'claude-3.5-sonnet', // Claude 3.5 Sonnet (if available in plan)
] as const;
export type GitHubCopilotModel = typeof GITHUB_COPILOT_MODELS[number];

View file

@ -227,12 +227,10 @@ export async function listOnboardingModels(): Promise<{ providers: ProviderSumma
id: "github-copilot",
name: "GitHub Copilot Student",
models: [
{ id: "gpt-4o", name: "GPT-4o" },
{ id: "gpt-4o", name: "GPT-4o (Recommended)" },
{ id: "gpt-4-turbo", name: "GPT-4 Turbo" },
{ id: "gpt-4", name: "GPT-4" },
{ id: "gpt-3.5-turbo", name: "GPT-3.5 Turbo" },
{ id: "gpt-3.5-turbo", name: "GPT-3.5 Turbo (Fastest)" },
{ id: "claude-3.5-sonnet", name: "Claude 3.5 Sonnet" },
{ id: "claude-3-opus", name: "Claude 3 Opus" },
],
});