feat: harden enterprise control plane

This commit is contained in:
AI Bot
2026-05-17 02:20:08 +08:00
parent 67511c31f4
commit e1aed590f8
112 changed files with 10977 additions and 2004 deletions

View File

@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
test("shipped local-agent configs include browser and desktop runtime smoke defaults", async () => {
test("shipped local-agent configs include browser and desktop runtime defaults", async () => {
const exampleConfig = JSON.parse(
await readFile(path.join(repoRoot, "local-agent", "config.example.json"), "utf8"),
);
@@ -25,10 +25,26 @@ test("shipped local-agent configs include browser and desktop runtime smoke defa
assert.equal(exampleConfig.computerUseEnabled, true);
assert.equal(cloudConfig.computerUseEnabled, true);
assert.equal(exampleConfig.codexAppServerEnabled, true);
assert.equal(cloudConfig.codexAppServerEnabled, true);
assert.equal(exampleConfig.codexComputerUseEnabled, true);
assert.equal(cloudConfig.codexComputerUseEnabled, true);
assert.equal(exampleConfig.codexComputerUseCommand, "node");
assert.equal(cloudConfig.codexComputerUseCommand, "node");
assert.deepEqual(exampleConfig.codexComputerUseArgs, ["scripts/codex-computer-use-runtime.mjs"]);
assert.deepEqual(cloudConfig.codexComputerUseArgs, ["scripts/codex-computer-use-runtime.mjs"]);
assert.equal(exampleConfig.codexComputerUseFallbackToCua, true);
assert.equal(cloudConfig.codexComputerUseFallbackToCua, true);
assert.equal(exampleConfig.computerUseCommand, "node");
assert.equal(cloudConfig.computerUseCommand, "node");
assert.deepEqual(exampleConfig.computerUseArgs, ["scripts/computer-use-smoke.mjs"]);
assert.deepEqual(cloudConfig.computerUseArgs, ["scripts/computer-use-smoke.mjs"]);
assert.deepEqual(exampleConfig.computerUseArgs, ["scripts/cua-driver-computer-use-runtime.mjs"]);
assert.deepEqual(cloudConfig.computerUseArgs, ["scripts/cua-driver-computer-use-runtime.mjs"]);
assert.equal(exampleConfig.cuaDriverCommand, "cua-driver");
assert.equal(cloudConfig.cuaDriverCommand, "cua-driver");
assert.deepEqual(exampleConfig.cuaDriverArgs, []);
assert.deepEqual(cloudConfig.cuaDriverArgs, []);
assert.equal(exampleConfig.cuaDriverTimeoutMs, 45000);
assert.equal(cloudConfig.cuaDriverTimeoutMs, 45000);
assert.equal(exampleConfig.computerUseConnected, true);
assert.equal(cloudConfig.computerUseConnected, true);
assert.equal(exampleConfig.dialogGuardEnabled, true);
@@ -46,6 +62,15 @@ test("shipped local-agent configs include browser and desktop runtime smoke defa
assert.deepEqual(exampleConfig.dialogGuardWindowsActionArgs, []);
assert.deepEqual(cloudConfig.dialogGuardWindowsActionArgs, []);
assert.equal(exampleConfig.bossAgentOtaEnabled, true);
assert.equal(cloudConfig.bossAgentOtaEnabled, true);
assert.equal(exampleConfig.bossAgentVersion, "dev");
assert.equal(cloudConfig.bossAgentVersion, "dev");
assert.equal(exampleConfig.bossAgentOtaAutoInstall, false);
assert.equal(cloudConfig.bossAgentOtaAutoInstall, false);
assert.equal(exampleConfig.bossAgentOtaCheckIntervalMs, 300000);
assert.equal(cloudConfig.bossAgentOtaCheckIntervalMs, 300000);
assert.equal(exampleConfig.codexDesktopRefreshEnabled, true);
assert.equal(cloudConfig.codexDesktopRefreshEnabled, true);
assert.equal(exampleConfig.codexDesktopRefreshCommand, "node");
@@ -64,9 +89,17 @@ test("shipped local-agent configs include browser and desktop runtime smoke defa
assert.equal(cloudConfig.codexDesktopRefreshRetryDelayMs, 120);
});
test("repo ships browser and desktop smoke runtime scripts", async () => {
test("repo ships browser and desktop runtime scripts", async () => {
const browserSmoke = await readFile(path.join(repoRoot, "scripts", "browser-control-smoke.mjs"), "utf8");
const computerSmoke = await readFile(path.join(repoRoot, "scripts", "computer-use-smoke.mjs"), "utf8");
const cuaComputerUseRuntime = await readFile(
path.join(repoRoot, "scripts", "cua-driver-computer-use-runtime.mjs"),
"utf8",
);
const codexComputerUseRuntime = await readFile(
path.join(repoRoot, "scripts", "codex-computer-use-runtime.mjs"),
"utf8",
);
const codexDesktopRefreshHint = await readFile(
path.join(repoRoot, "scripts", "codex-desktop-refresh-hint.mjs"),
"utf8",
@@ -87,6 +120,18 @@ test("repo ships browser and desktop smoke runtime scripts", async () => {
path.join(repoRoot, "deployment", "launchd", "com.hyzq.boss.codex-desktop-bridge.plist"),
"utf8",
);
const bossAgentPackageScript = await readFile(
path.join(repoRoot, "scripts", "package-boss-agent-mac-runtime.sh"),
"utf8",
);
const startLocalAgent = await readFile(
path.join(repoRoot, "scripts", "start-local-agent.sh"),
"utf8",
);
const installLocalLaunchAgent = await readFile(
path.join(repoRoot, "scripts", "install-local-launchagent.sh"),
"utf8",
);
assert.match(browserSmoke, /status/);
assert.match(browserSmoke, /replyBody/);
@@ -96,6 +141,13 @@ test("repo ships browser and desktop smoke runtime scripts", async () => {
assert.match(computerSmoke, /resolveOpenAppPrefixArgs/);
assert.match(computerSmoke, /BOSS_COMPUTER_USE_MODE/);
assert.match(computerSmoke, /osascript/);
assert.match(cuaComputerUseRuntime, /runCuaDriverComputerUseTask/);
assert.match(cuaComputerUseRuntime, /BOSS_CUA_DRIVER_COMMAND/);
assert.match(cuaComputerUseRuntime, /launch_app/);
assert.match(cuaComputerUseRuntime, /get_window_state/);
assert.match(cuaComputerUseRuntime, /needs_user_action/);
assert.match(codexComputerUseRuntime, /Codex Computer Use/);
assert.match(codexComputerUseRuntime, /executeCodexAppServerTask/);
assert.match(codexDesktopRefreshHint, /codex_desktop_refresh_hint/);
assert.match(codexDesktopRefreshHint, /osascript/);
assert.match(codexDesktopRefreshHint, /activate/);
@@ -115,4 +167,22 @@ test("repo ships browser and desktop smoke runtime scripts", async () => {
assert.match(codexDesktopIntegrationProbe, /packagePatch/);
assert.match(codexDesktopBridgeLaunchAgent, /codex-desktop-refresh-bridge-daemon\.mjs/);
assert.match(codexDesktopBridgeLaunchAgent, /BOSS_CODEX_DESKTOP_BRIDGE_PORT/);
assert.match(bossAgentPackageScript, /boss-agent-mac-latest\.zip/);
assert.match(bossAgentPackageScript, /boss-agent-mac-latest\.json/);
assert.match(bossAgentPackageScript, /bossAgentVersion = version/);
assert.match(bossAgentPackageScript, /config\*\.json/);
assert.match(bossAgentPackageScript, /codexComputerUseArgs/);
assert.match(bossAgentPackageScript, /PlistBuddy/);
assert.match(bossAgentPackageScript, /ACTIVE_CONFIG_PATH/);
assert.match(bossAgentPackageScript, /CUSTOM_CONFIGS/);
assert.match(bossAgentPackageScript, /config\.installed\.json\|config\.cloud\.json\|config\.example\.json/);
assert.match(bossAgentPackageScript, /BOSS_AGENT_INSTALL_ROOT/);
assert.match(installLocalLaunchAgent, /resolve_default_config_source/);
assert.match(installLocalLaunchAgent, /PlistBuddy/);
assert.match(installLocalLaunchAgent, /ACTIVE_CONFIG_PATH/);
assert.match(installLocalLaunchAgent, /CONFIG_SOURCE_ARG/);
assert.match(installLocalLaunchAgent, /codexAppServerWorkdir/);
assert.match(installLocalLaunchAgent, /codexComputerUseWorkdir/);
assert.match(startLocalAgent, /BOSS_NODE_BIN/);
assert.match(startLocalAgent, /\.boss-runtime\/node-\*\/bin\/node/);
});