()
| 4 | import { shouldRunCurrentResetProToOpusDefaultMigration } from './migrationSubscriptionSession.js' |
| 5 | |
| 6 | export function resetProToOpusDefault(): void { |
| 7 | const config = getGlobalConfig() |
| 8 | |
| 9 | if (config.opusProMigrationComplete) { |
| 10 | return |
| 11 | } |
| 12 | |
| 13 | // Pro users on firstParty get auto-migrated to Opus 4.5 default |
| 14 | if (!shouldRunCurrentResetProToOpusDefaultMigration()) { |
| 15 | saveGlobalConfig(current => ({ |
| 16 | ...current, |
| 17 | opusProMigrationComplete: true, |
| 18 | })) |
| 19 | logEvent('ncode_reset_pro_to_default_model', { skipped: true }) |
| 20 | return |
| 21 | } |
| 22 | |
| 23 | const settings = getSettings_DEPRECATED() |
| 24 | |
| 25 | // Only show notification if user was on default (no custom model setting) |
| 26 | if (settings?.model === undefined) { |
| 27 | const opusProMigrationTimestamp = Date.now() |
| 28 | saveGlobalConfig(current => ({ |
| 29 | ...current, |
| 30 | opusProMigrationComplete: true, |
| 31 | opusProMigrationTimestamp, |
| 32 | })) |
| 33 | logEvent('ncode_reset_pro_to_default_model', { |
| 34 | skipped: false, |
| 35 | had_custom_model: false, |
| 36 | }) |
| 37 | } else { |
| 38 | // User has a custom model setting, just mark migration complete |
| 39 | saveGlobalConfig(current => ({ |
| 40 | ...current, |
| 41 | opusProMigrationComplete: true, |
| 42 | })) |
| 43 | logEvent('ncode_reset_pro_to_default_model', { |
| 44 | skipped: false, |
| 45 | had_custom_model: true, |
| 46 | }) |
| 47 | } |
| 48 | } |
no test coverage detected