Files
oh-my-opencode/src/shared/migration/model-versions.ts
T
YeonGyu-Kim 3d56df4e1b feat(deep): upgrade default model from gpt-5.3-codex to gpt-5.4
Deep category now uses gpt-5.4 as its default model across all providers
(openai, github-copilot, venice, opencode), matching Hephaestus's GPT 5.4
upgrade. The requiresModel constraint is removed since gpt-5.4 is widely
available. Adds openai/gpt-5.3-codex -> openai/gpt-5.4 config migration
for existing user configs. Deep category prompt optimized for GPT 5.4's
stronger native capabilities (leaner, less verbose).
2026-03-31 17:26:30 -07:00

51 lines
1.7 KiB
TypeScript

/**
* Model version migration map: old full model strings → new full model strings.
* Used to auto-upgrade hardcoded model versions in user configs when the plugin
* bumps to newer model versions.
*
* Keys are full "provider/model" strings. Only openai and anthropic entries needed.
*/
export const MODEL_VERSION_MAP: Record<string, string> = {
"anthropic/claude-opus-4-5": "anthropic/claude-opus-4-6",
"anthropic/claude-sonnet-4-5": "anthropic/claude-sonnet-4-6",
"openai/gpt-5.3-codex": "openai/gpt-5.4",
}
function migrationKey(oldModel: string, newModel: string): string {
return `model-version:${oldModel}->${newModel}`
}
export function migrateModelVersions(
configs: Record<string, unknown>,
appliedMigrations?: Set<string>
): { migrated: Record<string, unknown>; changed: boolean; newMigrations: string[] } {
const migrated: Record<string, unknown> = {}
let changed = false
const newMigrations: string[] = []
for (const [key, value] of Object.entries(configs)) {
if (value && typeof value === "object" && !Array.isArray(value)) {
const config = value as Record<string, unknown>
if (typeof config.model === "string" && MODEL_VERSION_MAP[config.model]) {
const oldModel = config.model
const newModel = MODEL_VERSION_MAP[oldModel]
const mKey = migrationKey(oldModel, newModel)
// Skip if this migration was already applied (user may have reverted)
if (appliedMigrations?.has(mKey)) {
migrated[key] = value
continue
}
migrated[key] = { ...config, model: newModel }
changed = true
newMigrations.push(mKey)
continue
}
}
migrated[key] = value
}
return { migrated, changed, newMigrations }
}