feat(config): implement Copilot fallback in model assignment logic

Update generateOmoConfig to use GitHub Copilot models as fallback when native providers are unavailable.

- Sisyphus: claude-opus-4-5 > github-copilot/claude-opus-4.5 > glm-4.7-free
- Oracle: gpt-5.2 > github-copilot/gpt-5.2 > claude-opus-4-5 > glm-4.7-free
- Add Copilot detection in detectCurrentConfig from agent models

Addresses #762

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
sisyphus-dev-ai 2026-01-14 02:25:04 +00:00
parent d7326e1eeb
commit 9f07aae0a1

View File

@ -270,7 +270,9 @@ export function generateOmoConfig(installConfig: InstallConfig): Record<string,
const agents: Record<string, Record<string, unknown>> = {} const agents: Record<string, Record<string, unknown>> = {}
if (!installConfig.hasClaude) { if (!installConfig.hasClaude) {
agents["Sisyphus"] = { model: "opencode/glm-4.7-free" } agents["Sisyphus"] = {
model: installConfig.hasCopilot ? "github-copilot/claude-opus-4.5" : "opencode/glm-4.7-free",
}
} }
agents["librarian"] = { model: "opencode/glm-4.7-free" } agents["librarian"] = { model: "opencode/glm-4.7-free" }
@ -286,9 +288,12 @@ export function generateOmoConfig(installConfig: InstallConfig): Record<string,
} }
if (!installConfig.hasChatGPT) { if (!installConfig.hasChatGPT) {
agents["oracle"] = { const oracleFallback = installConfig.hasCopilot
model: installConfig.hasClaude ? "anthropic/claude-opus-4-5" : "opencode/glm-4.7-free", ? "github-copilot/gpt-5.2"
} : installConfig.hasClaude
? "anthropic/claude-opus-4-5"
: "opencode/glm-4.7-free"
agents["oracle"] = { model: oracleFallback }
} }
if (installConfig.hasGemini) { if (installConfig.hasGemini) {
@ -648,6 +653,7 @@ export function detectCurrentConfig(): DetectedConfig {
isMax20: true, isMax20: true,
hasChatGPT: true, hasChatGPT: true,
hasGemini: false, hasGemini: false,
hasCopilot: false,
} }
const { format, path } = detectConfigFormat() const { format, path } = detectConfigFormat()
@ -708,6 +714,11 @@ export function detectCurrentConfig(): DetectedConfig {
result.hasChatGPT = false result.hasChatGPT = false
} }
const hasAnyCopilotModel = Object.values(agents).some(
(agent) => agent?.model?.startsWith("github-copilot/")
)
result.hasCopilot = hasAnyCopilotModel
} catch { } catch {
/* intentionally empty - malformed omo config returns defaults from opencode config detection */ /* intentionally empty - malformed omo config returns defaults from opencode config detection */
} }