39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
const assert = require("node:assert/strict");
|
|||
|
|
const fs = require("node:fs");
|
||
|
|
const path = require("node:path");
|
||
|
|
|
||
|
|
const root = path.resolve(__dirname, "..");
|
||
|
|
const read = (file) => fs.readFileSync(path.join(root, file), "utf8");
|
||
|
|
|
||
|
|
const assistant = read("src/components/xingbang/BusinessAssistant.tsx");
|
||
|
|
const message = read("src/components/chat/ChatMessage.tsx");
|
||
|
|
const coreProxy = read("src/app/api/core/[...path]/route.ts");
|
||
|
|
|
||
|
|
assert.match(
|
||
|
|
assistant,
|
||
|
|
/<section className="ba-workspace">/,
|
||
|
|
"业务助手应保留单一、直接的项目操作入口",
|
||
|
|
);
|
||
|
|
assert.doesNotMatch(
|
||
|
|
assistant,
|
||
|
|
/mini-openclaw|ChatPanel|AppProvider|nativeAccess|ba-mode-tabs/,
|
||
|
|
"业务人员页面不应继续展示或加载重复的 mini-openclaw 入口",
|
||
|
|
);
|
||
|
|
assert.match(
|
||
|
|
assistant,
|
||
|
|
/当前身份只会调用本项目授权的 Skills、规则和业务工具/,
|
||
|
|
"受限工作台应明确说明权限边界",
|
||
|
|
);
|
||
|
|
assert.match(
|
||
|
|
message,
|
||
|
|
/authentication\.\?fail[\s\S]*return "provider";[\s\S]*\/401\|unauthorized[\s\S]*return "identity";/,
|
||
|
|
"401 身份错误不能继续误报为模型 API Key 失败",
|
||
|
|
);
|
||
|
|
assert.match(
|
||
|
|
coreProxy,
|
||
|
|
/user\.role !== "admin"/,
|
||
|
|
"修复不得放开原版终端、文件和网页工具的管理员边界",
|
||
|
|
);
|
||
|
|
|
||
|
|
console.log("Cloud business-assistant single-entry checks passed");
|