fix: costrict provider 下子 agent 模型别名继承父模型
costrict 没有 haiku/sonnet/opus 模型层级,当子 agent(如 Explore) 配置为 haiku 时,parseUserSpecifiedModel 会解析到 Claude haiku 模型 ID 而非继承主会话所选模型。修复为 costrict 下所有 family alias 强制走 inherit 逻辑,使用 getRuntimeMainLoopModel 以正确 支持 plan mode 等场景。 Co-Authored-By: CoStrict-DeepSeek-V4-Pro <deepseek-ai@claude-code-best.win>
This commit is contained in:
parent
00887762a2
commit
339ef4bc63
|
|
@ -1,6 +1,6 @@
|
|||
import type { PermissionMode } from '../permissions/PermissionMode.js'
|
||||
import { capitalize } from '../stringUtils.js'
|
||||
import { MODEL_ALIASES, type ModelAlias } from './aliases.js'
|
||||
import { isModelFamilyAlias, MODEL_ALIASES, type ModelAlias } from './aliases.js'
|
||||
import { applyBedrockRegionPrefix, getBedrockRegionPrefix } from './bedrock.js'
|
||||
import {
|
||||
getCanonicalName,
|
||||
|
|
@ -68,7 +68,11 @@ export function getAgentModel(
|
|||
|
||||
// Prioritize tool-specified model if provided
|
||||
if (toolSpecifiedModel) {
|
||||
if (aliasMatchesParentTier(toolSpecifiedModel, parentModel)) {
|
||||
if (
|
||||
aliasMatchesParentTier(toolSpecifiedModel, parentModel) ||
|
||||
// CoStrict has no haiku/sonnet/opus tiers — inherit parent model for all aliases
|
||||
(getAPIProvider() === 'costrict' && isModelFamilyAlias(toolSpecifiedModel))
|
||||
) {
|
||||
return parentModel
|
||||
}
|
||||
const model = parseUserSpecifiedModel(toolSpecifiedModel)
|
||||
|
|
@ -77,6 +81,18 @@ export function getAgentModel(
|
|||
|
||||
const agentModelWithExp = agentModel ?? getDefaultSubagentModel()
|
||||
|
||||
// CoStrict has no haiku/sonnet/opus model tiers — all family aliases inherit parent model
|
||||
if (
|
||||
getAPIProvider() === 'costrict' &&
|
||||
isModelFamilyAlias(agentModelWithExp)
|
||||
) {
|
||||
return getRuntimeMainLoopModel({
|
||||
permissionMode: permissionMode ?? 'default',
|
||||
mainLoopModel: parentModel,
|
||||
exceeds200kTokens: false,
|
||||
})
|
||||
}
|
||||
|
||||
if (agentModelWithExp === 'inherit') {
|
||||
// Apply runtime model resolution for inherit to get the effective model
|
||||
// This ensures agents using 'inherit' get opusplan→Opus resolution in plan mode
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user