agent-ecosystem/src/shared/utils/providerModelVisibility.ts
777genius ac1c99ac1f feat(cliInstaller): add model verification for providers
- Introduced CLI_INSTALLER_VERIFY_PROVIDER_MODELS IPC channel for on-demand model verification.
- Implemented handler for verifying provider models in the CliInstallerService.
- Enhanced CLI installation status management with model verification state and availability.
- Updated related components to support model verification feedback in the UI.
2026-04-16 19:41:23 +03:00

47 lines
1.3 KiB
TypeScript

import type { CliProviderId, TeamProviderId } from '@shared/types';
type SupportedProviderId = CliProviderId | TeamProviderId;
export const GPT_5_1_CODEX_MINI_UI_DISABLED_MODEL = 'gpt-5.1-codex-mini';
export const GPT_5_2_CODEX_UI_DISABLED_MODEL = 'gpt-5.2-codex';
export const GPT_5_3_CODEX_SPARK_UI_DISABLED_MODEL = 'gpt-5.3-codex-spark';
const UI_DISABLED_MODELS_BY_PROVIDER: Partial<Record<SupportedProviderId, readonly string[]>> = {
codex: [
GPT_5_3_CODEX_SPARK_UI_DISABLED_MODEL,
GPT_5_2_CODEX_UI_DISABLED_MODEL,
GPT_5_1_CODEX_MINI_UI_DISABLED_MODEL,
],
};
export function isProviderRuntimeModelUiDisabled(
providerId: SupportedProviderId | undefined,
model: string | undefined
): boolean {
const trimmed = model?.trim();
if (!providerId || !trimmed) {
return false;
}
return UI_DISABLED_MODELS_BY_PROVIDER[providerId]?.includes(trimmed) ?? false;
}
export function filterVisibleProviderRuntimeModels(
providerId: SupportedProviderId,
models: readonly string[]
): string[] {
const seen = new Set<string>();
const visible: string[] = [];
for (const model of models) {
const trimmed = model.trim();
if (!trimmed || seen.has(trimmed) || isProviderRuntimeModelUiDisabled(providerId, trimmed)) {
continue;
}
seen.add(trimmed);
visible.push(trimmed);
}
return visible;
}