Files
boss/tests/master-agent-intent-router.test.ts
2026-05-17 02:20:08 +08:00

49 lines
2.0 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import {
classifyMasterAgentControlIntentForTesting,
} from "@/lib/boss-master-agent";
test("keeps architecture and how-to development questions as discussion", () => {
const result = classifyMasterAgentControlIntentForTesting("我们这个需求应该怎么开发更合理?");
assert.equal(result.intentCategory, "discussion_only");
assert.equal(result.executionMode, "discussion");
assert.equal(result.riskLevel, "low");
});
test("routes explicit Mac desktop file/app work to desktop control", () => {
const result = classifyMasterAgentControlIntentForTesting("帮我在这台 Mac 上找一下下载目录里的安装包");
assert.equal(result.intentCategory, "desktop_control");
assert.equal(result.executionMode, "desktop");
assert.equal(result.riskLevel, "medium");
assert.equal(result.platform, "macos");
assert.equal(result.recommendedProvider, "codex-computer-use");
});
test("routes generic computer web research to browser control", () => {
const result = classifyMasterAgentControlIntentForTesting("用电脑帮我搜一下 Cua Driver 怎么安装");
assert.equal(result.intentCategory, "browser_control");
assert.equal(result.executionMode, "browser");
assert.equal(result.riskLevel, "medium");
assert.equal(result.platform, "macos");
assert.equal(result.recommendedProvider, "openai-computer-use");
});
test("marks externally visible desktop actions as high risk", () => {
const result = classifyMasterAgentControlIntentForTesting("打开 QQ 群,帮我发送一条消息");
assert.equal(result.intentCategory, "desktop_control");
assert.equal(result.executionMode, "desktop");
assert.equal(result.riskLevel, "high");
});
test("does not route casual mentions of desktop control as execution", () => {
const result = classifyMasterAgentControlIntentForTesting("我们讨论一下桌面控制和 Cua Driver 的产品方案");
assert.equal(result.intentCategory, "discussion_only");
assert.equal(result.executionMode, "discussion");
});