Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
65 lines
2.2 KiB
TypeScript
65 lines
2.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
agentCapabilityUseDisplayPrompt,
|
|
buildAgentCapabilityUseSubmitPrompt,
|
|
parseAgentCapabilityUseInvocation
|
|
} from "./agentCapabilityUseSubmit";
|
|
|
|
describe("agentCapabilityUseSubmit", () => {
|
|
it.each([
|
|
["browserUse", "/browser", "browser", ""],
|
|
["browserUse", "/browser open google.com", "browser", "open google.com"],
|
|
["browserUse", "/browser打开百度", "browser", "打开百度"],
|
|
["browserUse", "$浏览器 打开百度", "浏览器", "打开百度"],
|
|
["browserUse", "$浏览器打开百度", "浏览器", "打开百度"],
|
|
["computerUse", "/computer", "computer", ""],
|
|
["computerUse", "$computer open Settings", "computer", "open Settings"],
|
|
["computerUse", "/computer点击确认", "computer", "点击确认"],
|
|
["computerUse", "/电脑 点击确认", "电脑", "点击确认"]
|
|
] as const)(
|
|
"parses the %s invocation %s",
|
|
(capability, draft, commandName, args) => {
|
|
expect(parseAgentCapabilityUseInvocation(draft, capability)).toEqual({
|
|
commandName,
|
|
args
|
|
});
|
|
}
|
|
);
|
|
|
|
it("does not match another capability's invocation", () => {
|
|
expect(
|
|
parseAgentCapabilityUseInvocation("/computer test", "browserUse")
|
|
).toBeNull();
|
|
expect(
|
|
parseAgentCapabilityUseInvocation("/browser test", "computerUse")
|
|
).toBeNull();
|
|
expect(
|
|
parseAgentCapabilityUseInvocation("/browsering", "browserUse")
|
|
).toBeNull();
|
|
expect(
|
|
parseAgentCapabilityUseInvocation("/computer2", "computerUse")
|
|
).toBeNull();
|
|
});
|
|
|
|
it.each([
|
|
["browserUse", "visit google.com", "browser-use"],
|
|
["computerUse", "click Confirm", "computer-use"]
|
|
] as const)(
|
|
"builds the %s handoff prompt",
|
|
(capability, args, expectedSkill) => {
|
|
const prompt = buildAgentCapabilityUseSubmitPrompt(capability, args);
|
|
expect(prompt).toContain(expectedSkill);
|
|
expect(prompt).toContain(args);
|
|
}
|
|
);
|
|
|
|
it("normalizes capability display prompts", () => {
|
|
expect(agentCapabilityUseDisplayPrompt("browserUse", " open docs ")).toBe(
|
|
"/browser open docs"
|
|
);
|
|
expect(agentCapabilityUseDisplayPrompt("computerUse", "点击确认")).toBe(
|
|
"/computer 点击确认"
|
|
);
|
|
});
|
|
});
|