feat(config): add custom_agents overrides and strict agent validation
This commit is contained in:
@@ -530,6 +530,79 @@ describe("Sisyphus-Junior agent override", () => {
|
||||
expect(result.data.agents?.momus?.category).toBe("quick")
|
||||
}
|
||||
})
|
||||
|
||||
test("schema accepts custom_agents override keys", () => {
|
||||
// given
|
||||
const config = {
|
||||
custom_agents: {
|
||||
translator: {
|
||||
model: "google/gemini-3-flash-preview",
|
||||
temperature: 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// when
|
||||
const result = OhMyOpenCodeConfigSchema.safeParse(config)
|
||||
|
||||
// then
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.custom_agents?.translator?.model).toBe("google/gemini-3-flash-preview")
|
||||
expect(result.data.custom_agents?.translator?.temperature).toBe(0)
|
||||
}
|
||||
})
|
||||
|
||||
test("schema rejects unknown keys under agents", () => {
|
||||
// given
|
||||
const config = {
|
||||
agents: {
|
||||
sisyphuss: {
|
||||
model: "openai/gpt-5.3-codex",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// when
|
||||
const result = OhMyOpenCodeConfigSchema.safeParse(config)
|
||||
|
||||
// then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
test("schema rejects built-in agent names under custom_agents", () => {
|
||||
// given
|
||||
const config = {
|
||||
custom_agents: {
|
||||
sisyphus: {
|
||||
model: "openai/gpt-5.3-codex",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// when
|
||||
const result = OhMyOpenCodeConfigSchema.safeParse(config)
|
||||
|
||||
// then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
test("schema rejects built-in agent names under custom_agents case-insensitively", () => {
|
||||
// given
|
||||
const config = {
|
||||
custom_agents: {
|
||||
Sisyphus: {
|
||||
model: "openai/gpt-5.3-codex",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// when
|
||||
const result = OhMyOpenCodeConfigSchema.safeParse(config)
|
||||
|
||||
// then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("BrowserAutomationProviderSchema", () => {
|
||||
|
||||
Reference in New Issue
Block a user