Laimiao agent v2 service: agent orchestration, sessions, billing, gateway client, skills catalog, auth, config, plus tests.
37 lines
1.7 KiB
TypeScript
37 lines
1.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildSystemPrompts } from "../src/agent/prompt.js";
|
|
import { makeCatalog, skillFixture, tempRoot, testConfig } from "./helpers.js";
|
|
|
|
describe("system prompts", () => {
|
|
it("uses direct mode when no skill is selected", async () => {
|
|
const catalog = await makeCatalog([
|
|
skillFixture({ key: "poster", content: "# Poster\n\nUse poster rules." }),
|
|
]);
|
|
const prompts = buildSystemPrompts(catalog, testConfig(tempRoot()));
|
|
const text = [prompts.systemPrompt, ...prompts.appendSystemPrompt].join("\n");
|
|
expect(text).toContain("直接生成模式");
|
|
expect(text).toContain("普通直接生成不要读取技能规范");
|
|
expect(text).toContain("省略 skill_id");
|
|
expect(text).toContain("confirm_travel_style");
|
|
expect(text).not.toContain("Use poster rules");
|
|
expect(text).not.toContain("skill_id: poster");
|
|
});
|
|
|
|
it("injects only the selected skill spec", async () => {
|
|
const catalog = await makeCatalog([
|
|
skillFixture({ key: "poster", content: "# Poster\n\nUse poster rules." }),
|
|
skillFixture({ key: "other", content: "# Other\n\nUse other rules." }),
|
|
]);
|
|
const skill = catalog.get("poster");
|
|
if (!skill) throw new Error("missing fixture");
|
|
|
|
const prompts = buildSystemPrompts(catalog, testConfig(tempRoot()), skill);
|
|
const text = [prompts.systemPrompt, ...prompts.appendSystemPrompt].join("\n");
|
|
expect(text).toContain("skill_id: poster");
|
|
expect(text).toContain("Test skill poster");
|
|
expect(text).toContain("Use poster rules");
|
|
expect(text).not.toContain("Use other rules");
|
|
expect(text).not.toContain("直接生成模式");
|
|
});
|
|
});
|