migrateFennecToOpus.ts
migrations/migrateFennecToOpus.ts
No strong subsystem tag
46
Lines
1372
Bytes
1
Exports
1
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 46 lines, 1 detected imports, and 1 detected exports.
Important relationships
- migrations/migrateAutoUpdatesToSettings.ts
- migrations/migrateBypassPermissionsAcceptedToSettings.ts
- migrations/migrateEnableAllProjectMcpServersToSettings.ts
- migrations/migrateLegacyOpusToCurrent.ts
- migrations/migrateOpusToOpus1m.ts
- migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts
- migrations/migrateSonnet1mToSonnet45.ts
- migrations/migrateSonnet45ToSonnet46.ts
Detected exports
migrateFennecToOpus
Keywords
modelopussettingsusersettingsupdatesettingsforsourcefennec-lateststartswithaliasesgetsettingsforsourcefennec
Detected imports
../utils/settings/settings.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import {
getSettingsForSource,
updateSettingsForSource,
} from '../utils/settings/settings.js'
/**
* Migrate users on removed fennec model aliases to their new Opus 4.6 aliases.
* - fennec-latest → opus
* - fennec-latest[1m] → opus[1m]
* - fennec-fast-latest → opus[1m] + fast mode
* - opus-4-5-fast → opus + fast mode
*
* Only touches userSettings. Reading and writing the same source keeps this
* idempotent without a completion flag. Fennec aliases in project/local/policy
* settings are left alone — we can't rewrite those, and reading merged
* settings here would cause infinite re-runs + silent global promotion.
*/
export function migrateFennecToOpus(): void {
if (process.env.USER_TYPE !== 'ant') {
return
}
const settings = getSettingsForSource('userSettings')
const model = settings?.model
if (typeof model === 'string') {
if (model.startsWith('fennec-latest[1m]')) {
updateSettingsForSource('userSettings', {
model: 'opus[1m]',
})
} else if (model.startsWith('fennec-latest')) {
updateSettingsForSource('userSettings', {
model: 'opus',
})
} else if (
model.startsWith('fennec-fast-latest') ||
model.startsWith('opus-4-5-fast')
) {
updateSettingsForSource('userSettings', {
model: 'opus[1m]',
fastMode: true,
})
}
}
}