fix(model-resolution): normalize model format and remove dead config flag

This commit is contained in:
YeonGyu-Kim
2026-03-03 00:31:12 +09:00
parent e461c81cec
commit e2ddd03306
4 changed files with 60 additions and 5 deletions
+12 -3
View File
@@ -51,7 +51,11 @@ Create the work plan directly - that's your job as the planning agent.`,
try {
const agentsResult = await client.app.agents()
type AgentInfo = { name: string; mode?: "subagent" | "primary" | "all"; model?: { providerID: string; modelID: string } }
type AgentInfo = {
name: string
mode?: "subagent" | "primary" | "all"
model?: string | { providerID: string; modelID: string }
}
const agents = normalizeSDKResponse(agentsResult, [] as AgentInfo[], {
preferResponseOnMissingData: true,
})
@@ -99,7 +103,9 @@ Create the work plan directly - that's your job as the planning agent.`,
if (agentOverride?.model || agentRequirement || matchedAgent.model) {
const availableModels = await getAvailableModelsForDelegateTask(client)
const normalizedMatchedModel = normalizeModelFormat(matchedAgent.model as Parameters<typeof normalizeModelFormat>[0])
const normalizedMatchedModel = matchedAgent.model
? normalizeModelFormat(matchedAgent.model)
: undefined
const matchedAgentModelStr = normalizedMatchedModel
? `${normalizedMatchedModel.providerID}/${normalizedMatchedModel.modelID}`
: undefined
@@ -122,7 +128,10 @@ Create the work plan directly - that's your job as the planning agent.`,
}
if (!categoryModel && matchedAgent.model) {
categoryModel = matchedAgent.model
const normalizedMatchedModel = normalizeModelFormat(matchedAgent.model)
if (normalizedMatchedModel) {
categoryModel = normalizedMatchedModel
}
}
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error)