feat(coding-agent): add provider display names

closes #3956
This commit is contained in:
Mario Zechner
2026-04-30 00:10:38 +02:00
parent b79e7f8058
commit cf5ec23240
10 changed files with 110 additions and 40 deletions

View File

@@ -26,6 +26,7 @@ import { Compile } from "typebox/compile";
import type { TLocalizedValidationError } from "typebox/error";
import { getAgentDir } from "../config.js";
import type { AuthStatus, AuthStorage } from "./auth-storage.js";
import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "./provider-display-names.js";
import {
clearConfigValueCache,
resolveConfigValueOrThrow,
@@ -177,6 +178,7 @@ const ModelOverrideSchema = Type.Object({
type ModelOverride = Static<typeof ModelOverrideSchema>;
const ProviderConfigSchema = Type.Object({
name: Type.Optional(Type.String({ minLength: 1 })),
baseUrl: Type.Optional(Type.String({ minLength: 1 })),
apiKey: Type.Optional(Type.String({ minLength: 1 })),
api: Type.Optional(Type.String({ minLength: 1 })),
@@ -727,6 +729,22 @@ export class ModelRegistry {
return { configured: true, source: "models_json_key" };
}
/**
* Get display name for a provider.
*/
getProviderDisplayName(provider: string): string {
const registeredProvider = this.registeredProviders.get(provider);
const oauthProvider = this.authStorage.getOAuthProviders().find((p) => p.id === provider);
return (
registeredProvider?.name ??
registeredProvider?.oauth?.name ??
oauthProvider?.name ??
BUILT_IN_PROVIDER_DISPLAY_NAMES[provider] ??
provider
);
}
/**
* Get API key for a provider.
*/
@@ -893,6 +911,7 @@ export class ModelRegistry {
* Input type for registerProvider API.
*/
export interface ProviderConfigInput {
name?: string;
baseUrl?: string;
apiKey?: string;
api?: Api;