feat(cursor): Integrate Cursor IDE support with OAuth import token flow

- Add CursorExecutor for handling requests to the Cursor API using protobuf over HTTP/2.
- Implement CursorAuthModal for user token import from local SQLite database.
- Update provider models and constants to include Cursor as a supported provider.
- Enhance API service with token validation and user info extraction from Cursor tokens.
- Introduce utility functions for checksum generation and protobuf encoding/decoding for Cursor API interactions.
This commit is contained in:
triadmoko
2026-02-04 12:07:29 +07:00
parent 7881db81ec
commit 137f315bec
17 changed files with 2856 additions and 2 deletions

View File

@@ -149,6 +149,18 @@ export const PROVIDERS = {
// Kiro OAuth endpoints
tokenUrl: "https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken",
authUrl: "https://prod.us-east-1.auth.desktop.kiro.dev"
},
cursor: {
baseUrl: "https://api2.cursor.sh",
chatPath: "/aiserver.v1.ChatService/StreamUnifiedChatWithTools",
format: "cursor",
headers: {
"connect-accept-encoding": "gzip",
"connect-protocol-version": "1",
"Content-Type": "application/connect+proto",
"User-Agent": "connect-es/1.6.1"
},
clientVersion: "1.1.3"
}
};

View File

@@ -73,6 +73,18 @@ export const PROVIDER_MODELS = {
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5" },
{ id: "claude-haiku-4.5", name: "Claude Haiku 4.5" },
],
cu: [ // Cursor IDE
{ id: "default", name: "Default (Server Picks)" },
{ id: "claude-4.5-opus-high-thinking", name: "Claude 4.5 Opus High Thinking" },
{ id: "claude-4.5-opus-high", name: "Claude 4.5 Opus High" },
{ id: "claude-4.5-sonnet-thinking", name: "Claude 4.5 Sonnet Thinking" },
{ id: "claude-4-sonnet", name: "Claude 4 Sonnet" },
{ id: "gpt-4o", name: "GPT-4o" },
{ id: "gpt-5.1-codex", name: "GPT 5.1 Codex" },
{ id: "claude-3.5-sonnet", name: "Claude 3.5 Sonnet" },
{ id: "gpt-4o-mini", name: "GPT-4o Mini" },
{ id: "cursor-small", name: "Cursor Small" },
],
// API Key Providers (alias = id)
openai: [
@@ -149,6 +161,7 @@ export const PROVIDER_ID_TO_ALIAS = {
antigravity: "ag",
github: "gh",
kiro: "kr",
cursor: "cu",
openai: "openai",
anthropic: "anthropic",
gemini: "gemini",