forked from EduCraft/curriculum-project-hub
feat: add curated curriculum agent skills
This commit is contained in:
@@ -33,6 +33,16 @@ function resultMessage(sessionId: string, costUsd?: number) {
|
||||
};
|
||||
}
|
||||
|
||||
function initMessage(skills: string[]) {
|
||||
return {
|
||||
type: "system",
|
||||
subtype: "init",
|
||||
skills,
|
||||
tools: [],
|
||||
plugins: [],
|
||||
};
|
||||
}
|
||||
|
||||
function messages(...items: unknown[]) {
|
||||
return (async function* () {
|
||||
for (const item of items) yield item;
|
||||
@@ -102,6 +112,8 @@ describe("runAgent", () => {
|
||||
permissionMode: "bypassPermissions",
|
||||
allowDangerouslySkipPermissions: true,
|
||||
settingSources: [],
|
||||
plugins: [expect.objectContaining({ type: "local", skipMcpDiscovery: true })],
|
||||
skills: ["cph-curated:outline", "cph-curated:lesson-project", "cph-curated:data-processing-spec"],
|
||||
strictMcpConfig: true,
|
||||
sandbox: expect.objectContaining({
|
||||
enabled: true,
|
||||
@@ -134,6 +146,26 @@ describe("runAgent", () => {
|
||||
expect(call?.options).not.toHaveProperty("resume");
|
||||
});
|
||||
|
||||
it("returns the skills actually reported by SDK initialization", async () => {
|
||||
queryMock.mockReturnValue(messages(
|
||||
initMessage(["cph-curated:outline"]),
|
||||
assistantMessage("fresh"),
|
||||
resultMessage("sdk-session-1"),
|
||||
));
|
||||
|
||||
const result = await runAgent({
|
||||
prompt: "写一个大纲",
|
||||
model: undefined,
|
||||
project: { projectId: "p", boundChatId: "c", workspaceRoot, workspaceDir: workspace },
|
||||
systemPrompt: undefined,
|
||||
runId: "run-1",
|
||||
sessionId: "hub-session-1",
|
||||
prisma: stubPrisma,
|
||||
});
|
||||
|
||||
expect(result.initializedSkillIds).toEqual(["cph-curated:outline"]);
|
||||
});
|
||||
|
||||
it("maps role tool ids to the Claude SDK tool whitelist", async () => {
|
||||
queryMock.mockReturnValue(messages(assistantMessage("ok"), resultMessage("sdk-session-1")));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user