feat(shared): add requiresModel field and isModelAvailable helper

This commit is contained in:
justsisyphus
2026-01-30 15:11:19 +09:00
parent d2d8d1a782
commit baefd16b3f
2 changed files with 31 additions and 14 deletions
+14
View File
@@ -87,6 +87,20 @@ export function fuzzyMatchModel(
return result
}
/**
* Check if a target model is available (fuzzy match by model name, no provider filtering)
*
* @param targetModel - Model name to check (e.g., "gpt-5.2-codex")
* @param availableModels - Set of available models in "provider/model" format
* @returns true if model is available, false otherwise
*/
export function isModelAvailable(
targetModel: string,
availableModels: Set<string>,
): boolean {
return fuzzyMatchModel(targetModel, availableModels) !== null
}
export async function getConnectedProviders(client: any): Promise<string[]> {
if (!client?.provider?.list) {
log("[getConnectedProviders] client.provider.list not available")