π File detail
migrations/migrateFennecToOpus.ts
π§© .tsπ 46 linesπΎ 1,372 bytesπ text
β Back to All Filesπ― Use case
This file lives under βmigrations/β, which covers version migrations for settings or on-disk data. On the API surface it exposes migrateFennecToOpus β mainly functions, hooks, or classes. It composes internal code from utils (relative imports).
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
import { getSettingsForSource, updateSettingsForSource, } from '../utils/settings/settings.js'
π€ Exports (heuristic)
migrateFennecToOpus
π₯οΈ Source preview
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,
})
}
}
}