Merge pull request #72 from Askhz/fix/costrict-subagent-model-inherit
fix: costrict provider 下子 agent 模型别名继承父模型
This commit is contained in:
commit
9fb1410b6f
|
|
@ -1,6 +1,6 @@
|
||||||
import type { PermissionMode } from '../permissions/PermissionMode.js'
|
import type { PermissionMode } from '../permissions/PermissionMode.js'
|
||||||
import { capitalize } from '../stringUtils.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 { applyBedrockRegionPrefix, getBedrockRegionPrefix } from './bedrock.js'
|
||||||
import {
|
import {
|
||||||
getCanonicalName,
|
getCanonicalName,
|
||||||
|
|
@ -68,7 +68,11 @@ export function getAgentModel(
|
||||||
|
|
||||||
// Prioritize tool-specified model if provided
|
// Prioritize tool-specified model if provided
|
||||||
if (toolSpecifiedModel) {
|
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
|
return parentModel
|
||||||
}
|
}
|
||||||
const model = parseUserSpecifiedModel(toolSpecifiedModel)
|
const model = parseUserSpecifiedModel(toolSpecifiedModel)
|
||||||
|
|
@ -77,6 +81,18 @@ export function getAgentModel(
|
||||||
|
|
||||||
const agentModelWithExp = agentModel ?? getDefaultSubagentModel()
|
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') {
|
if (agentModelWithExp === 'inherit') {
|
||||||
// Apply runtime model resolution for inherit to get the effective model
|
// Apply runtime model resolution for inherit to get the effective model
|
||||||
// This ensures agents using 'inherit' get opusplan→Opus resolution in plan mode
|
// This ensures agents using 'inherit' get opusplan→Opus resolution in plan mode
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user