test(04-01): add Athena registration and schema regressions
- verify Athena primary agents honor uiSelectedModel and override precedence - add schema tests to lock athena acceptance in builtin and overridable names
This commit is contained in:
parent
c1fab24b46
commit
b1f43e8113
@ -147,6 +147,69 @@ describe("createBuiltinAgents with model overrides", () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("Athena uses uiSelectedModel when provided", async () => {
|
||||||
|
// #given
|
||||||
|
const fetchSpy = spyOn(shared, "fetchAvailableModels").mockResolvedValue(
|
||||||
|
new Set(["openai/gpt-5.2", "anthropic/claude-opus-4-6"])
|
||||||
|
)
|
||||||
|
const uiSelectedModel = "openai/gpt-5.2"
|
||||||
|
|
||||||
|
try {
|
||||||
|
// #when
|
||||||
|
const agents = await createBuiltinAgents(
|
||||||
|
[],
|
||||||
|
{},
|
||||||
|
undefined,
|
||||||
|
TEST_DEFAULT_MODEL,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
[],
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
uiSelectedModel
|
||||||
|
)
|
||||||
|
|
||||||
|
// #then
|
||||||
|
expect(agents.athena).toBeDefined()
|
||||||
|
expect(agents.athena.model).toBe("openai/gpt-5.2")
|
||||||
|
} finally {
|
||||||
|
fetchSpy.mockRestore()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
test("user config model takes priority over uiSelectedModel for athena", async () => {
|
||||||
|
// #given
|
||||||
|
const fetchSpy = spyOn(shared, "fetchAvailableModels").mockResolvedValue(
|
||||||
|
new Set(["openai/gpt-5.2", "anthropic/claude-opus-4-6"])
|
||||||
|
)
|
||||||
|
const uiSelectedModel = "openai/gpt-5.2"
|
||||||
|
const overrides = {
|
||||||
|
athena: { model: "anthropic/claude-opus-4-6" },
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// #when
|
||||||
|
const agents = await createBuiltinAgents(
|
||||||
|
[],
|
||||||
|
overrides,
|
||||||
|
undefined,
|
||||||
|
TEST_DEFAULT_MODEL,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
[],
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
uiSelectedModel
|
||||||
|
)
|
||||||
|
|
||||||
|
// #then
|
||||||
|
expect(agents.athena).toBeDefined()
|
||||||
|
expect(agents.athena.model).toBe("anthropic/claude-opus-4-6")
|
||||||
|
} finally {
|
||||||
|
fetchSpy.mockRestore()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
test("Sisyphus is created on first run when no availableModels or cache exist", async () => {
|
test("Sisyphus is created on first run when no availableModels or cache exist", async () => {
|
||||||
// #given
|
// #given
|
||||||
const systemDefaultModel = "anthropic/claude-opus-4-6"
|
const systemDefaultModel = "anthropic/claude-opus-4-6"
|
||||||
@ -428,7 +491,8 @@ describe("createBuiltinAgents with model overrides", () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// #then
|
// #then
|
||||||
const matches = (agents.sisyphus?.prompt ?? "").match(/Custom agent: researcher/gi) ?? []
|
expect(agents.sisyphus.prompt).toBeDefined()
|
||||||
|
const matches = (agents.sisyphus.prompt ?? "").match(/Custom agent: researcher/gi) ?? []
|
||||||
expect(matches.length).toBe(1)
|
expect(matches.length).toBe(1)
|
||||||
} finally {
|
} finally {
|
||||||
fetchSpy.mockRestore()
|
fetchSpy.mockRestore()
|
||||||
|
|||||||
26
src/config/schema/agent-names.test.ts
Normal file
26
src/config/schema/agent-names.test.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { describe, expect, test } from "bun:test"
|
||||||
|
import { BuiltinAgentNameSchema, OverridableAgentNameSchema } from "./agent-names"
|
||||||
|
|
||||||
|
describe("agent name schemas", () => {
|
||||||
|
test("BuiltinAgentNameSchema accepts athena", () => {
|
||||||
|
//#given
|
||||||
|
const candidate = "athena"
|
||||||
|
|
||||||
|
//#when
|
||||||
|
const result = BuiltinAgentNameSchema.safeParse(candidate)
|
||||||
|
|
||||||
|
//#then
|
||||||
|
expect(result.success).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
test("OverridableAgentNameSchema accepts athena", () => {
|
||||||
|
//#given
|
||||||
|
const candidate = "athena"
|
||||||
|
|
||||||
|
//#when
|
||||||
|
const result = OverridableAgentNameSchema.safeParse(candidate)
|
||||||
|
|
||||||
|
//#then
|
||||||
|
expect(result.success).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user