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:
@@ -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 () => {
|
||||
// #given
|
||||
const systemDefaultModel = "anthropic/claude-opus-4-6"
|
||||
@@ -428,7 +491,8 @@ describe("createBuiltinAgents with model overrides", () => {
|
||||
)
|
||||
|
||||
// #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)
|
||||
} finally {
|
||||
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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user