* Map a full model name to its family alias and the marketing name of the * version the alias currently resolves to. Used to detect when a user has * a specific older version pinned and a newer one is available.
( model: string, )
| 383 | * a specific older version pinned and a newer one is available. |
| 384 | */ |
| 385 | function getModelFamilyInfo( |
| 386 | model: string, |
| 387 | ): { alias: string; currentVersionName: string } | null { |
| 388 | const canonical = getCanonicalName(model) |
| 389 | |
| 390 | // Sonnet family |
| 391 | if ( |
| 392 | canonical.includes('claude-sonnet-4-6') || |
| 393 | canonical.includes('claude-sonnet-4-5') || |
| 394 | canonical.includes('claude-sonnet-4-') || |
| 395 | canonical.includes('claude-3-7-sonnet') || |
| 396 | canonical.includes('claude-3-5-sonnet') |
| 397 | ) { |
| 398 | const currentName = getMarketingNameForModel(getDefaultSonnetModel()) |
| 399 | if (currentName) { |
| 400 | return { alias: 'Sonnet', currentVersionName: currentName } |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | // Opus family |
| 405 | if (canonical.includes('claude-opus-4')) { |
| 406 | const currentName = getMarketingNameForModel(getDefaultOpusModel()) |
| 407 | if (currentName) { |
| 408 | return { alias: 'Opus', currentVersionName: currentName } |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | // Haiku family |
| 413 | if ( |
| 414 | canonical.includes('claude-haiku') || |
| 415 | canonical.includes('claude-3-5-haiku') |
| 416 | ) { |
| 417 | const currentName = getMarketingNameForModel(getDefaultHaikuModel()) |
| 418 | if (currentName) { |
| 419 | return { alias: 'Haiku', currentVersionName: currentName } |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | return null |
| 424 | } |
| 425 | |
| 426 | /** |
| 427 | * Returns a ModelOption for a known Anthropic model with a human-readable |
no test coverage detected