2026-03-31 13:05:38 -07:00
|
|
|
import { describe, expect, spyOn, test } from "bun:test"
|
|
|
|
|
import { createBuiltinAgents } from "./builtin-agents"
|
|
|
|
|
import * as shared from "../shared"
|
|
|
|
|
|
2026-04-17 14:51:52 +09:00
|
|
|
const TEST_DEFAULT_MODEL = "anthropic/claude-opus-4-7"
|
2026-03-31 13:05:38 -07:00
|
|
|
|
|
|
|
|
describe("createBuiltinAgents custom agent visibility", () => {
|
|
|
|
|
test("#given runtime custom agents #when orchestrator prompts are built #then custom agents are not advertised for automatic delegation", async () => {
|
|
|
|
|
//#given
|
|
|
|
|
const fetchSpy = spyOn(shared, "fetchAvailableModels").mockResolvedValue(
|
2026-04-17 14:51:52 +09:00
|
|
|
new Set(["anthropic/claude-opus-4-7", "openai/gpt-5.4"])
|
2026-03-31 13:05:38 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
//#when
|
|
|
|
|
const agents = await createBuiltinAgents(
|
|
|
|
|
[],
|
|
|
|
|
{},
|
|
|
|
|
undefined,
|
|
|
|
|
TEST_DEFAULT_MODEL,
|
|
|
|
|
undefined,
|
|
|
|
|
undefined,
|
|
|
|
|
[],
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
name: "backend-engineer",
|
|
|
|
|
description: "Custom backend specialist",
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
//#then
|
|
|
|
|
expect(agents.sisyphus.prompt).not.toContain("backend-engineer")
|
|
|
|
|
expect(agents.hephaestus.prompt).not.toContain("backend-engineer")
|
|
|
|
|
expect(agents.atlas.prompt).not.toContain("backend-engineer")
|
|
|
|
|
} finally {
|
|
|
|
|
fetchSpy.mockRestore()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|