| import { |
| type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| logEvent, |
| } from '../services/analytics/index.js' |
| import { |
| isMaxSubscriber, |
| isProSubscriber, |
| isTeamPremiumSubscriber, |
| } from '../utils/auth.js' |
| import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js' |
| import { getAPIProvider } from '../utils/model/providers.js' |
| import { |
| getSettingsForSource, |
| updateSettingsForSource, |
| } from '../utils/settings/settings.js' |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export function migrateSonnet45ToSonnet46(): void { |
| if (getAPIProvider() !== 'firstParty') { |
| return |
| } |
|
|
| if (!isProSubscriber() && !isMaxSubscriber() && !isTeamPremiumSubscriber()) { |
| return |
| } |
|
|
| const model = getSettingsForSource('userSettings')?.model |
| if ( |
| model !== 'claude-sonnet-4-5-20250929' && |
| model !== 'claude-sonnet-4-5-20250929[1m]' && |
| model !== 'sonnet-4-5-20250929' && |
| model !== 'sonnet-4-5-20250929[1m]' |
| ) { |
| return |
| } |
|
|
| const has1m = model.endsWith('[1m]') |
| updateSettingsForSource('userSettings', { |
| model: has1m ? 'sonnet[1m]' : 'sonnet', |
| }) |
|
|
| |
| const config = getGlobalConfig() |
| if (config.numStartups > 1) { |
| saveGlobalConfig(current => ({ |
| ...current, |
| sonnet45To46MigrationTimestamp: Date.now(), |
| })) |
| } |
|
|
| logEvent('tengu_sonnet45_to_46_migration', { |
| from_model: |
| model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| has_1m: has1m, |
| }) |
| } |
|
|