Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions src/cli/config-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,97 @@ describe("generateOmoConfig - GitHub Copilot fallback", () => {
expect(categories?.["writing"]?.model).toBe("github-copilot/gemini-3-flash-preview")
})
})

describe("generateOmoConfig - Oracle agent configuration", () => {
test("oracle uses openai/gpt-5.2 when hasChatGPT is true", () => {
// #given user has ChatGPT subscription
const config: InstallConfig = {
hasClaude: false,
isMax20: false,
hasChatGPT: true,
hasGemini: false,
hasCopilot: false,
}

// #when generating config
const result = generateOmoConfig(config)

// #then oracle should use openai/gpt-5.2
const agents = result.agents as Record<string, { model?: string }>
expect(agents["oracle"]?.model).toBe("openai/gpt-5.2")
})

test("oracle uses github-copilot/gpt-5.2 when hasCopilot but no ChatGPT", () => {
// #given user has Copilot but no ChatGPT
const config: InstallConfig = {
hasClaude: false,
isMax20: false,
hasChatGPT: false,
hasGemini: false,
hasCopilot: true,
}

// #when generating config
const result = generateOmoConfig(config)

// #then oracle should use Copilot GPT fallback
const agents = result.agents as Record<string, { model?: string }>
expect(agents["oracle"]?.model).toBe("github-copilot/gpt-5.2")
})

test("oracle uses anthropic/claude-opus-4-5 when hasClaude but no ChatGPT or Copilot", () => {
// #given user has Claude but no ChatGPT or Copilot
const config: InstallConfig = {
hasClaude: true,
isMax20: false,
hasChatGPT: false,
hasGemini: false,
hasCopilot: false,
}

// #when generating config
const result = generateOmoConfig(config)

// #then oracle should use Claude fallback
const agents = result.agents as Record<string, { model?: string }>
expect(agents["oracle"]?.model).toBe("anthropic/claude-opus-4-5")
})

test("oracle uses opencode/glm-4.7-free when no providers available", () => {
// #given user has no subscriptions
const config: InstallConfig = {
hasClaude: false,
isMax20: false,
hasChatGPT: false,
hasGemini: false,
hasCopilot: false,
}

// #when generating config
const result = generateOmoConfig(config)

// #then oracle should use free fallback
const agents = result.agents as Record<string, { model?: string }>
expect(agents["oracle"]?.model).toBe("opencode/glm-4.7-free")
})

test("oracle is always present in generated config", () => {
// #given various configurations
const configs: InstallConfig[] = [
{ hasClaude: true, isMax20: true, hasChatGPT: true, hasGemini: true, hasCopilot: true },
{ hasClaude: true, isMax20: false, hasChatGPT: false, hasGemini: false, hasCopilot: false },
{ hasClaude: false, isMax20: false, hasChatGPT: true, hasGemini: false, hasCopilot: false },
{ hasClaude: false, isMax20: false, hasChatGPT: false, hasGemini: false, hasCopilot: false },
]

for (const config of configs) {
// #when generating config
const result = generateOmoConfig(config)

// #then oracle should always be present
const agents = result.agents as Record<string, { model?: string }>
expect(agents["oracle"]).toBeDefined()
expect(agents["oracle"]?.model).toBeTruthy()
}
})
})
6 changes: 5 additions & 1 deletion src/cli/config-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ export function generateOmoConfig(installConfig: InstallConfig): Record<string,
agents["explore"] = { model: "opencode/glm-4.7-free" }
}

if (!installConfig.hasChatGPT) {
if (installConfig.hasChatGPT) {
agents["oracle"] = { model: "openai/gpt-5.2" }
} else {
const oracleFallback = installConfig.hasCopilot
? "github-copilot/gpt-5.2"
: installConfig.hasClaude
Expand Down Expand Up @@ -715,6 +717,8 @@ export function detectCurrentConfig(): DetectedConfig {
result.hasChatGPT = false
} else if (agents["oracle"]?.model === "opencode/glm-4.7-free") {
result.hasChatGPT = false
} else if (agents["oracle"]?.model?.startsWith("github-copilot/")) {
result.hasChatGPT = false
}

const hasAnyCopilotModel = Object.values(agents).some(
Expand Down