The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { |
| 2 | AntigravitySettings, |
| 3 | ClaudeSettings, |
| 4 | CodexSettings, |
| 5 | isProviderDriverKind, |
| 6 | ProviderDriverKind, |
| 7 | } from "@t3tools/contracts"; |
| 8 | import { acpRegistryClient } from "@t3tools/provider-acp-registry/client"; |
| 9 | import { makeProviderClientRegistry, type ProviderIcon } from "@t3tools/provider-core/client"; |
| 10 | import { modelShortName } from "@t3tools/provider-core/modelShortName"; |
| 11 | import { cursorClient } from "@t3tools/provider-cursor/client"; |
| 12 | import { fxClient } from "@t3tools/provider-fx/client"; |
| 13 | import { grokClient } from "@t3tools/provider-grok/client"; |
| 14 | import { kiroClient } from "@t3tools/provider-kiro/client"; |
| 15 | import { museClient } from "@t3tools/provider-muse/client"; |
| 16 | import { openCodeClient } from "@t3tools/provider-opencode/client"; |
| 17 | import { piClient } from "@t3tools/provider-pi/client"; |
| 18 | |
| 19 | // OpenRouter's Ink and Cloud glyphs from https://openrouter.ai/brand. |
| 20 | export const openRouterIcon: ProviderIcon = { |
| 21 | viewBox: "0 0 1024 730", |
| 22 | fill: { light: "#03080A", dark: "#FCFCFE" }, |
| 23 | paths: [ |
| 24 | { |
| 25 | d: "M795.893 0C915.776 0 1012.95 97.9963 1012.95 218.88C1012.95 339.764 915.776 437.76 795.893 437.76L1011.2 654.869C1038.55 682.447 1019.18 729.6 980.504 729.6H361.77C161.97 729.6 0 566.273 0 364.8C0 163.327 161.97 0 361.77 0L795.893 0ZM361.77 145.92C241.89 145.92 144.708 243.916 144.708 364.8C144.708 485.684 241.89 583.68 361.77 583.68C481.649 583.68 578.831 485.684 578.831 364.8C578.831 243.916 481.649 145.92 361.77 145.92Z", |
| 26 | }, |
| 27 | ], |
| 28 | }; |
| 29 | |
| 30 | export const providerClients = makeProviderClientRegistry([ |
| 31 | { |
| 32 | driverKind: ProviderDriverKind.make("codex"), |
| 33 | label: "Codex", |
| 34 | modelFamilies: ["GPT-", "GPT "], |
| 35 | acpRegistryAgentIds: ["codex-acp"], |
| 36 | settingsSchema: CodexSettings, |
| 37 | }, |
| 38 | { |
| 39 | driverKind: ProviderDriverKind.make("claudeAgent"), |
| 40 | label: "Claude", |
| 41 | modelFamilies: ["Claude "], |
| 42 | acpRegistryAgentIds: ["claude-acp"], |
| 43 | settingsSchema: ClaudeSettings, |
| 44 | }, |
| 45 | cursorClient, |
| 46 | grokClient, |
| 47 | fxClient, |
| 48 | openCodeClient, |
| 49 | { |
| 50 | driverKind: ProviderDriverKind.make("antigravity"), |
| 51 | label: "Antigravity", |
| 52 | modelFamilies: ["Gemini "], |
| 53 | acpRegistryAgentIds: ["antigravity-acp"], |
| 54 | settingsSchema: AntigravitySettings, |
| 55 | }, |
| 56 | kiroClient, |
| 57 | museClient, |
| 58 | piClient, |
| 59 | acpRegistryClient, |
| 60 | ]); |
| 61 | |
| 62 | export function getProviderClient(driver: string | null | undefined) { |
| 63 | return isProviderDriverKind(driver) ? providerClients.get(driver) : undefined; |
| 64 | } |
| 65 | |
| 66 | export function resolveModelShortName( |
| 67 | model: { readonly name: string; readonly shortName?: string | undefined }, |
| 68 | driverKind: ProviderDriverKind | null | undefined, |
| 69 | ): string | undefined { |
| 70 | if (model.shortName) return model.shortName; |
| 71 | const families = driverKind ? providerClients.get(driverKind)?.modelFamilies : undefined; |
| 72 | return modelShortName(model.name, families ?? []); |
| 73 | } |