feat: expand codex app server discovery

This commit is contained in:
AI Bot
2026-06-02 23:11:21 +08:00
parent 94e0cc8bad
commit 88b028ad2b
11 changed files with 295 additions and 12 deletions

View File

@@ -8,6 +8,7 @@ import path from "node:path";
import { fileURLToPath } from "node:url";
import {
discoverCodexAppServerCapabilities,
executeCodexAppServerTask,
getCodexAppServerRunnerConfig,
shouldUseCodexAppServerTaskRunner,
@@ -15,6 +16,35 @@ import {
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
test("codex app-server discovery includes governance and MCP summaries without leaking internals", async () => {
const runnerConfig = getCodexAppServerRunnerConfig(process.env, {
codexAppServerEnabled: true,
codexAppServerCommand: process.execPath,
codexAppServerArgs: ["tests/fixtures/codex-app-server-runtime.mjs"],
codexAppServerWorkdir: repoRoot,
codexAppServerTimeoutMs: 5000,
codexAppServerDiscoveryLimit: 20,
});
const metadata = await discoverCodexAppServerCapabilities(runnerConfig);
assert.equal(metadata.experimentalFeatures[0].name, "multi_agent");
assert.equal(metadata.experimentalFeatures[0].stage, "stable");
assert.equal(metadata.experimentalFeatures[0].enabled, true);
assert.equal(metadata.collaborationModes[1].id, "plan");
assert.equal(metadata.permissionProfiles[0].id, ":workspace");
assert.equal(metadata.mcpServers[0].name, "github");
assert.equal(metadata.mcpServers[0].toolCount, 2);
assert.equal(metadata.mcpServers[0].authStatus, "oAuth");
const serialized = JSON.stringify(metadata);
assert.equal(serialized.includes("sk-secret-should-not-leak"), false);
assert.equal(serialized.includes("/Users/kris"), false);
assert.equal(serialized.includes("id_ed25519"), false);
assert.equal(serialized.includes("filesystem"), false);
assert.equal(serialized.includes("resources"), false);
});
function encodeWsTextFrame(value) {
const payload = Buffer.from(value);
if (payload.length < 126) {