* 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)
| 108 | * since they carry semantics beyond "same tier as parent". |
| 109 | */ |
| 110 | function 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 | |
| 124 | export function getAgentModelDisplay(model: string | undefined): string { |
| 125 | // When model is omitted, getDefaultSubagentModel() returns 'inherit' at runtime |
no test coverage detected