MCPcopy Index your code
hub / github.com/codeaashu/claude-code / aliasMatchesParentTier

Function aliasMatchesParentTier

src/utils/model/agent.ts:110–122  ·  view source on GitHub ↗

* Check if a bare family alias (opus/sonnet/haiku) matches the parent model's * tier. When it does, the subagent inherits the parent's exact model string * instead of resolving the alias to a provider default. * * Prevents surprising downgrades: a Vertex user on Opus 4.6 (via /model) who * spaw

(alias: string, parentModel: string)

Source from the content-addressed store, hash-verified

108 * since they carry semantics beyond "same tier as parent".
109 */
110function aliasMatchesParentTier(alias: string, parentModel: string): boolean {
111 const canonical = getCanonicalName(parentModel)
112 switch (alias.toLowerCase()) {
113 case 'opus':
114 return canonical.includes('opus')
115 case 'sonnet':
116 return canonical.includes('sonnet')
117 case 'haiku':
118 return canonical.includes('haiku')
119 default:
120 return false
121 }
122}
123
124export function getAgentModelDisplay(model: string | undefined): string {
125 // When model is omitted, getDefaultSubagentModel() returns 'inherit' at runtime

Callers 1

getAgentModelFunction · 0.85

Calls 1

getCanonicalNameFunction · 0.85

Tested by

no test coverage detected