Files
mini-openclaw/scripts/test_cloud_assistant_access.cjs
T

39 lines
1.3 KiB
JavaScript
Raw Normal View History

2026-09-21 12:31:35 +08:00
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,
2026-09-21 13:33:00 +08:00
/<section className="ba-workspace">/,
"业务助手应保留单一、直接的项目操作入口",
2026-09-21 12:31:35 +08:00
);
2026-09-21 13:33:00 +08:00
assert.doesNotMatch(
2026-09-21 12:31:35 +08:00
assistant,
2026-09-21 13:33:00 +08:00
/mini-openclaw|ChatPanel|AppProvider|nativeAccess|ba-mode-tabs/,
"业务人员页面不应继续展示或加载重复的 mini-openclaw 入口",
2026-09-21 12:31:35 +08:00
);
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"/,
"修复不得放开原版终端、文件和网页工具的管理员边界",
);
2026-09-21 13:33:00 +08:00
console.log("Cloud business-assistant single-entry checks passed");