feat(shared): add requiresModel field and isModelAvailable helper
This commit is contained in:
parent
d2d8d1a782
commit
baefd16b3f
@ -87,6 +87,20 @@ export function fuzzyMatchModel(
|
|||||||
return result
|
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[]> {
|
export async function getConnectedProviders(client: any): Promise<string[]> {
|
||||||
if (!client?.provider?.list) {
|
if (!client?.provider?.list) {
|
||||||
log("[getConnectedProviders] client.provider.list not available")
|
log("[getConnectedProviders] client.provider.list not available")
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export type FallbackEntry = {
|
|||||||
export type ModelRequirement = {
|
export type ModelRequirement = {
|
||||||
fallbackChain: FallbackEntry[]
|
fallbackChain: FallbackEntry[]
|
||||||
variant?: string // Default variant (used when entry doesn't specify one)
|
variant?: string // Default variant (used when entry doesn't specify one)
|
||||||
|
requiresModel?: string // If set, only activates when this model is available (fuzzy match)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AGENT_MODEL_REQUIREMENTS: Record<string, ModelRequirement> = {
|
export const AGENT_MODEL_REQUIREMENTS: Record<string, ModelRequirement> = {
|
||||||
@ -98,20 +99,22 @@ export const CATEGORY_MODEL_REQUIREMENTS: Record<string, ModelRequirement> = {
|
|||||||
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-opus-4-5", variant: "max" },
|
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-opus-4-5", variant: "max" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
deep: {
|
deep: {
|
||||||
fallbackChain: [
|
fallbackChain: [
|
||||||
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.2-codex", variant: "medium" },
|
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.2-codex", variant: "medium" },
|
||||||
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-opus-4-5", variant: "max" },
|
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-opus-4-5", variant: "max" },
|
||||||
{ providers: ["google", "github-copilot", "opencode"], model: "gemini-3-pro", variant: "max" },
|
{ providers: ["google", "github-copilot", "opencode"], model: "gemini-3-pro", variant: "max" },
|
||||||
],
|
],
|
||||||
},
|
requiresModel: "gpt-5.2-codex",
|
||||||
artistry: {
|
},
|
||||||
fallbackChain: [
|
artistry: {
|
||||||
{ providers: ["google", "github-copilot", "opencode"], model: "gemini-3-pro", variant: "max" },
|
fallbackChain: [
|
||||||
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-opus-4-5", variant: "max" },
|
{ providers: ["google", "github-copilot", "opencode"], model: "gemini-3-pro", variant: "max" },
|
||||||
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.2" },
|
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-opus-4-5", variant: "max" },
|
||||||
],
|
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.2" },
|
||||||
},
|
],
|
||||||
|
requiresModel: "gemini-3-pro",
|
||||||
|
},
|
||||||
quick: {
|
quick: {
|
||||||
fallbackChain: [
|
fallbackChain: [
|
||||||
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-haiku-4-5" },
|
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-haiku-4-5" },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user