feat: add inherit model profile for OpenCode /model (#951)

This commit is contained in:
jorge g
2026-03-15 13:40:08 -04:00
committed by GitHub
parent 789cac127d
commit 698985feb1
14 changed files with 111 additions and 50 deletions

View File

@@ -405,9 +405,10 @@ function resolveModelInternal(cwd, agentType) {
}
// Fall back to profile lookup
const profile = config.model_profile || 'balanced';
const profile = String(config.model_profile || 'balanced').toLowerCase();
const agentModels = MODEL_PROFILES[agentType];
if (!agentModels) return 'sonnet';
if (profile === 'inherit') return 'inherit';
const resolved = agentModels[profile] || agentModels['balanced'] || 'sonnet';
return resolved === 'opus' ? 'inherit' : resolved;
}

View File

@@ -607,7 +607,7 @@ function cmdValidateHealth(cwd, options, raw) {
const raw = fs.readFileSync(configPath, 'utf-8');
const parsed = JSON.parse(raw);
// Validate known fields
const validProfiles = ['quality', 'balanced', 'budget'];
const validProfiles = ['quality', 'balanced', 'budget', 'inherit'];
if (parsed.model_profile && !validProfiles.includes(parsed.model_profile)) {
addIssue('warning', 'W004', `config.json: invalid model_profile "${parsed.model_profile}"`, `Valid values: ${validProfiles.join(', ')}`);
}