From 77c92d06819f7b0bdf9a3c91759539537aee4516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 17 Apr 2026 02:00:37 -0400 Subject: [PATCH] feat(connector): add pi-mono catalog data files Pure-data declaration of the 26 pi-mono connectors split across three files so each stays under the 400-line cap: - connector-definitions-data-oauth.ts (5 OAuth providers) - connector-definitions-data-apikey.ts (18 API-key providers) - connector-definitions-data-cloud.ts (3 Cloud providers) Each entry carries pi-ai provider id, default model, auth descriptor, onboarding flag, and notes. Fireworks + Fire Pass are marked as locally resolved (no pi-ai catalog entry) and share FIREWORKS_API_KEY. --- src/main/connector-definitions-data-apikey.ts | 177 ++++++++++++++++++ src/main/connector-definitions-data-cloud.ts | 47 +++++ src/main/connector-definitions-data-oauth.ts | 75 ++++++++ 3 files changed, 299 insertions(+) create mode 100644 src/main/connector-definitions-data-apikey.ts create mode 100644 src/main/connector-definitions-data-cloud.ts create mode 100644 src/main/connector-definitions-data-oauth.ts diff --git a/src/main/connector-definitions-data-apikey.ts b/src/main/connector-definitions-data-apikey.ts new file mode 100644 index 00000000..64f98440 --- /dev/null +++ b/src/main/connector-definitions-data-apikey.ts @@ -0,0 +1,177 @@ +/** + * API-key pi-mono connectors. + * + * Each entry maps to a pi-ai `KnownProvider` (see + * `pi-mono-reference/packages/ai/src/env-api-keys.ts`) — except for the two + * Fireworks entries, which are resolved locally in `src/main/model-resolver.ts`. + * + * `envKey` is the standard environment variable pi-mono reads when no + * `auth.json` entry is present. AgentCompany's credential store also honours + * it as a fallback so the Settings panel can tell users which variable to + * set. + */ + +import type { ConnectorDefinition } from "./connector-definitions"; + +export const API_KEY_CONNECTORS: ConnectorDefinition[] = [ + { + id: "anthropic", + provider: "anthropic", + label: "Anthropic API", + description: + "Direct Anthropic Messages API. Use this for production workloads where OAuth subscription tiers are not appropriate.", + defaultModel: "claude-sonnet-4-5", + auth: { type: "api_key", envKey: "ANTHROPIC_API_KEY" }, + onboardingFeatured: true, + }, + { + id: "openai", + provider: "openai", + label: "OpenAI API", + description: + "OpenAI Responses + Chat Completions endpoints. Covers GPT-5 family and Codex deployments.", + defaultModel: "gpt-5.4", + auth: { type: "api_key", envKey: "OPENAI_API_KEY" }, + onboardingFeatured: true, + }, + { + id: "google", + provider: "google", + label: "Google Gemini API", + description: + "Google Gemini Generative Language API. Uses the standard GEMINI_API_KEY environment variable.", + defaultModel: "gemini-2.5-pro", + auth: { type: "api_key", envKey: "GEMINI_API_KEY" }, + }, + { + id: "mistral", + provider: "mistral", + label: "Mistral", + description: "Mistral La Plateforme — Codestral, Devstral, and Mistral Medium/Large families.", + defaultModel: "mistral-medium-latest", + auth: { type: "api_key", envKey: "MISTRAL_API_KEY" }, + }, + { + id: "groq", + provider: "groq", + label: "Groq", + description: + "Groq LPU cloud. High-throughput inference for Llama 3, Qwen, DeepSeek, and Groq Compound.", + defaultModel: "groq/compound", + auth: { type: "api_key", envKey: "GROQ_API_KEY" }, + }, + { + id: "cerebras", + provider: "cerebras", + label: "Cerebras", + description: "Cerebras Inference cloud — wafer-scale hardware for Qwen, Llama, and GPT-OSS.", + defaultModel: "qwen-3-235b-a22b-instruct-2507", + auth: { type: "api_key", envKey: "CEREBRAS_API_KEY" }, + }, + { + id: "xai", + provider: "xai", + label: "xAI", + description: "xAI Grok API including Grok 4 Fast and Grok Code Fast.", + defaultModel: "grok-4-fast", + auth: { type: "api_key", envKey: "XAI_API_KEY" }, + }, + { + id: "openrouter", + provider: "openrouter", + label: "OpenRouter", + description: + "OpenRouter aggregator. Access Anthropic, OpenAI, Google, open-weights, and community models through one key.", + defaultModel: "anthropic/claude-sonnet-4.5", + auth: { type: "api_key", envKey: "OPENROUTER_API_KEY" }, + }, + { + id: "vercel-ai-gateway", + provider: "vercel-ai-gateway", + label: "Vercel AI Gateway", + description: + "Vercel's multi-provider proxy. Request models by `provider/model` slug and share one billing profile.", + defaultModel: "anthropic/claude-sonnet-4.5", + auth: { type: "api_key", envKey: "AI_GATEWAY_API_KEY" }, + }, + { + id: "zai", + provider: "zai", + label: "Z.AI", + description: "Z.AI GLM-4.5/4.6 family — coding-tuned Chinese models with tool use.", + defaultModel: "glm-4.6", + auth: { type: "api_key", envKey: "ZAI_API_KEY" }, + }, + { + id: "opencode", + provider: "opencode", + label: "OpenCode Zen", + description: + "OpenCode Zen managed endpoint. Pi-mono uses the same OPENCODE_API_KEY as OpenCode Go.", + defaultModel: "claude-sonnet-4.5", + auth: { type: "api_key", envKey: "OPENCODE_API_KEY" }, + }, + { + id: "opencode-go", + provider: "opencode-go", + label: "OpenCode Go", + description: + "OpenCode Go managed endpoint. Shares OPENCODE_API_KEY with OpenCode Zen.", + defaultModel: "kimi-k2.5", + auth: { type: "api_key", envKey: "OPENCODE_API_KEY" }, + }, + { + id: "huggingface", + provider: "huggingface", + label: "Hugging Face", + description: + "Hugging Face Inference Endpoints. Hosts Kimi K2, GLM, DeepSeek, MiniMax, and other open-weights.", + defaultModel: "moonshotai/Kimi-K2.5", + auth: { type: "api_key", envKey: "HF_TOKEN" }, + }, + { + id: "kimi-coding", + provider: "kimi-coding", + label: "Kimi For Coding", + description: + "Moonshot AI Kimi For Coding endpoint — tuned for agentic coding workloads.", + defaultModel: "kimi-for-coding", + auth: { type: "api_key", envKey: "KIMI_API_KEY" }, + }, + { + id: "minimax", + provider: "minimax", + label: "MiniMax", + description: "MiniMax international endpoint for M2 coding models.", + defaultModel: "MiniMax-M2.7", + auth: { type: "api_key", envKey: "MINIMAX_API_KEY" }, + }, + { + id: "minimax-cn", + provider: "minimax-cn", + label: "MiniMax (China)", + description: "MiniMax mainland China endpoint. Uses a separate key from the international tier.", + defaultModel: "MiniMax-M2.7", + auth: { type: "api_key", envKey: "MINIMAX_CN_API_KEY" }, + }, + { + id: "fireworks", + provider: "fireworks", + label: "Fireworks AI", + description: + "Fireworks inference cloud. Resolved locally through `src/main/model-resolver.ts` — pi-ai does not ship a Fireworks catalog entry.", + defaultModel: "accounts/fireworks/models/kimi-k2.5-turbo", + auth: { type: "api_key", envKey: "FIREWORKS_API_KEY" }, + }, + { + id: "fireworks-firepass", + provider: "fireworks-firepass", + label: "Fireworks Fire Pass", + description: + "Fireworks Fire Pass — $7/week subscription for unlimited Kimi K2.5 Turbo. Uses the same FIREWORKS_API_KEY; the Fire Pass entitlement is attached to the account.", + defaultModel: "accounts/fireworks/models/kimi-k2.5-turbo", + auth: { type: "api_key", envKey: "FIREWORKS_API_KEY" }, + notes: + "Covers Kimi K2.5 Turbo only; other Fireworks models still bill per-token. See https://docs.fireworks.ai/firepass.", + }, +]; diff --git a/src/main/connector-definitions-data-cloud.ts b/src/main/connector-definitions-data-cloud.ts new file mode 100644 index 00000000..edbfe8a1 --- /dev/null +++ b/src/main/connector-definitions-data-cloud.ts @@ -0,0 +1,47 @@ +/** + * Cloud pi-mono connectors. + * + * Cloud providers have bespoke credential discovery — multi-variable AWS / + * Azure setups, or gcloud Application Default Credentials for Vertex. The + * `auth.type` marker tells the credential resolver which discovery path to + * run (see `pi-mono-reference/packages/ai/src/env-api-keys.ts`). + */ + +import type { ConnectorDefinition } from "./connector-definitions"; + +export const CLOUD_CONNECTORS: ConnectorDefinition[] = [ + { + id: "amazon-bedrock", + provider: "amazon-bedrock", + label: "AWS Bedrock", + description: + "Anthropic, Amazon Nova, and Llama models served through AWS Bedrock. Honours standard AWS credential discovery (profile, IAM keys, Bedrock bearer tokens, ECS roles, IRSA).", + defaultModel: "us.anthropic.claude-sonnet-4-20250514-v1:0", + auth: { type: "aws" }, + onboardingFeatured: true, + notes: + "Credentials resolved from AWS_PROFILE | AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEY | AWS_BEARER_TOKEN_BEDROCK | AWS_CONTAINER_CREDENTIALS_* | AWS_WEB_IDENTITY_TOKEN_FILE. Region defaults to us-east-1.", + }, + { + id: "azure-openai", + provider: "azure-openai-responses", + label: "Azure OpenAI", + description: + "Azure-hosted OpenAI deployments via the Responses API. Requires AZURE_OPENAI_API_KEY plus a resource identifier.", + defaultModel: "gpt-5.4", + auth: { type: "azure" }, + notes: + "Provide AZURE_OPENAI_API_KEY plus AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME. Optional AZURE_OPENAI_API_VERSION, AZURE_OPENAI_DEPLOYMENT_NAME_MAP.", + }, + { + id: "google-vertex", + provider: "google-vertex", + label: "Google Vertex AI", + description: + "Gemini, Claude, and third-party models on Google Vertex AI. Uses Application Default Credentials from `gcloud auth application-default login` or GOOGLE_APPLICATION_CREDENTIALS.", + defaultModel: "gemini-2.5-pro", + auth: { type: "gcp_adc" }, + notes: + "Set GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION. Optional GOOGLE_CLOUD_API_KEY takes precedence over ADC when present.", + }, +]; diff --git a/src/main/connector-definitions-data-oauth.ts b/src/main/connector-definitions-data-oauth.ts new file mode 100644 index 00000000..8a48aced --- /dev/null +++ b/src/main/connector-definitions-data-oauth.ts @@ -0,0 +1,75 @@ +/** + * OAuth-based pi-mono connectors. + * + * Each entry targets one of the five built-in pi-ai OAuth providers + * (see `pi-mono-reference/packages/ai/src/utils/oauth/index.ts`). The + * runtime opens the provider's browser auth flow, stores the refreshed + * token in the `credentials` table, and passes it as the API key when + * invoking pi-ai. + * + * The `oauthId` surfaced here is the AgentCompany internal id that the + * catalog test pins (`anthropic` / `openai-codex` / `github-copilot` / + * `gemini-cli` / `antigravity`). It is mapped to the pi-ai provider id + * when resolving the actual OAuth flow — e.g. `gemini-cli` → + * `google-gemini-cli`, `antigravity` → `google-antigravity`. + */ + +import type { ConnectorDefinition } from "./connector-definitions"; + +export const OAUTH_CONNECTORS: ConnectorDefinition[] = [ + { + id: "claude-pro", + provider: "anthropic", + label: "Claude Pro/Max", + description: + "Anthropic Claude via Claude Pro / Max subscription OAuth. Runs entirely through pi-mono's built-in OAuth handler; no API key required.", + defaultModel: "claude-sonnet-4-5", + auth: { type: "oauth", oauthId: "anthropic" }, + onboardingFeatured: true, + notes: + "Requires an active Claude Pro or Max subscription. Tokens refresh automatically.", + }, + { + id: "openai-codex", + provider: "openai-codex", + label: "ChatGPT Plus/Pro (Codex)", + description: + "OpenAI Codex via a ChatGPT Plus or Pro subscription. Personal-use only — production workloads should use the OpenAI API connector.", + defaultModel: "gpt-5.3-codex", + auth: { type: "oauth", oauthId: "openai-codex" }, + onboardingFeatured: true, + notes: "Personal use only; requires ChatGPT Plus or Pro.", + }, + { + id: "github-copilot", + provider: "github-copilot", + label: "GitHub Copilot", + description: + "Models exposed through a GitHub Copilot subscription. Supports github.com and GitHub Enterprise Server.", + defaultModel: "claude-opus-4.5", + auth: { type: "oauth", oauthId: "github-copilot" }, + notes: + "If a model shows 'not supported', enable it in VS Code: Copilot Chat → model selector → Enable.", + }, + { + id: "gemini-cli", + provider: "google-gemini-cli", + label: "Google Gemini CLI", + description: + "Google Gemini models via Cloud Code Assist OAuth. Free tier works with any Google account (rate-limited).", + defaultModel: "gemini-2.5-pro", + auth: { type: "oauth", oauthId: "gemini-cli" }, + notes: + "For paid Cloud Code Assist, set GOOGLE_CLOUD_PROJECT. Google-gemini-cli OAuth provider id in pi-ai.", + }, + { + id: "antigravity", + provider: "google-antigravity", + label: "Google Antigravity", + description: + "Google Antigravity sandbox with Gemini 3, Claude, and GPT-OSS models. Free with any Google account.", + defaultModel: "claude-sonnet-4-5", + auth: { type: "oauth", oauthId: "antigravity" }, + notes: "Maps to pi-ai OAuth provider id `google-antigravity`.", + }, +];