feat: expose codex mcp guardian governance

This commit is contained in:
AI Bot
2026-06-03 12:13:57 +08:00
parent afeb352fe3
commit f23ed9f188
12 changed files with 171 additions and 7 deletions

View File

@@ -1457,6 +1457,49 @@ function normalizeDiscoveryFuzzyFileSearchSummary() {
};
}
function normalizeDiscoveryMcpGovernanceSummary() {
const actions = [
{ label: "OAuth 登录", group: "oauth" },
{ label: "OAuth 完成", group: "oauth" },
{ label: "资源读取", group: "resource" },
{ label: "工具调用", group: "tool" },
{ label: "交互请求", group: "elicitation", elicitation: true },
];
return {
actionCount: actions.length,
oauthActionCount: actions.filter((action) => action.group === "oauth").length,
resourceActionCount: actions.filter((action) => action.group === "resource").length,
toolActionCount: actions.filter((action) => action.group === "tool").length,
elicitationAvailable: actions.some((action) => action.elicitation === true),
userInitiatedOnly: true,
labels: actions.map((action) => action.label),
};
}
function normalizeDiscoveryUserInteractionGovernanceSummary() {
const actions = [{ label: "请求用户输入", group: "input", requestUserInput: true }];
return {
actionCount: actions.length,
requestUserInputAvailable: actions.some((action) => action.requestUserInput === true),
userInitiatedOnly: true,
labels: actions.map((action) => action.label),
};
}
function normalizeDiscoveryGuardianGovernanceSummary() {
const actions = [
{ label: "Guardian 放行", group: "approval" },
{ label: "权限请求", group: "permissionEvent", permissionRequest: true },
];
return {
actionCount: actions.length,
approvalActionCount: actions.filter((action) => action.group === "approval").length,
permissionRequestEventAvailable: actions.some((action) => action.permissionRequest === true),
userInitiatedOnly: true,
labels: actions.map((action) => action.label),
};
}
function normalizeDiscoveryPlugins(result) {
return asArray(result?.marketplaces)
.flatMap((marketplace) => asArray(marketplace?.plugins))
@@ -1951,6 +1994,9 @@ export async function discoverCodexAppServerCapabilities(runnerConfig) {
reviewGovernanceSummary: normalizeDiscoveryReviewGovernanceSummary(),
windowsSandboxGovernanceSummary: normalizeDiscoveryWindowsSandboxGovernanceSummary(),
fuzzyFileSearchSummary: normalizeDiscoveryFuzzyFileSearchSummary(),
mcpGovernanceSummary: normalizeDiscoveryMcpGovernanceSummary(),
userInteractionGovernanceSummary: normalizeDiscoveryUserInteractionGovernanceSummary(),
guardianGovernanceSummary: normalizeDiscoveryGuardianGovernanceSummary(),
errors: [
modelResult?.__bossError ? `model/list:${safeRuntimeDiagnosticText(modelResult.__bossError)}` : undefined,
providerCapabilities?.__bossError