MCPcopy Create free account
hub / github.com/Noumena-Network/code / resetProToOpusDefault

Function resetProToOpusDefault

src/migrations/resetProToOpusDefault.ts:6–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { shouldRunCurrentResetProToOpusDefaultMigration } from './migrationSubscriptionSession.js'
5
6export 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}

Callers 1

runMigrationsFunction · 0.85

Calls 4

getGlobalConfigFunction · 0.50
saveGlobalConfigFunction · 0.50
logEventFunction · 0.50

Tested by

no test coverage detected