* 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, )
| 477 | * a specific older version pinned and a newer one is available. |
| 478 | */ |
| 479 | function getModelFamilyInfo( |
| 480 | model: string, |
| 481 | ): { alias: string; currentVersionName: string } | null { |
| 482 | const canonical = getCanonicalName(model) |
| 483 | |
| 484 | // Sonnet family |
| 485 | if ( |
| 486 | canonical.includes('claude-sonnet-4-6') || |
| 487 | canonical.includes('claude-sonnet-4-5') || |
| 488 | canonical.includes('claude-sonnet-4-') || |
| 489 | canonical.includes('claude-3-7-sonnet') || |
| 490 | canonical.includes('claude-3-5-sonnet') |
| 491 | ) { |
| 492 | const currentName = getMarketingNameForModel(getDefaultSonnetModel()) |
| 493 | if (currentName) { |
| 494 | return { alias: 'Sonnet', currentVersionName: currentName } |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | // Opus family |
| 499 | if (canonical.includes('claude-opus-4')) { |
| 500 | const currentName = getMarketingNameForModel(getDefaultOpusModel()) |
| 501 | if (currentName) { |
| 502 | return { alias: 'Opus', currentVersionName: currentName } |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | // Haiku family |
| 507 | if ( |
| 508 | canonical.includes('claude-haiku') || |
| 509 | canonical.includes('claude-3-5-haiku') |
| 510 | ) { |
| 511 | const currentName = getMarketingNameForModel(getDefaultHaikuModel()) |
| 512 | if (currentName) { |
| 513 | return { alias: 'Haiku', currentVersionName: currentName } |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | return null |
| 518 | } |
| 519 | |
| 520 | /** |
| 521 | * Returns a ModelOption for a known Anthropic model with a human-readable |
no test coverage detected