feat: expose codex fs command governance

This commit is contained in:
AI Bot
2026-06-03 11:44:07 +08:00
parent 21e514a895
commit 0fdee4bcf7
12 changed files with 164 additions and 7 deletions

View File

@@ -1331,6 +1331,48 @@ function normalizeDiscoveryConfigGovernanceSummary() {
};
}
function normalizeDiscoveryFileSystemGovernanceSummary() {
const actions = [
{ label: "读取文件", group: "read" },
{ label: "读取目录", group: "read" },
{ label: "元数据", group: "read" },
{ label: "写入文件", group: "write" },
{ label: "创建目录", group: "write" },
{ label: "复制", group: "write" },
{ label: "删除", group: "destructive" },
{ label: "监听", group: "watch" },
{ label: "取消监听", group: "watch" },
];
return {
actionCount: actions.length,
readActionCount: actions.filter((action) => action.group === "read").length,
writeActionCount: actions.filter((action) => action.group === "write").length,
destructiveActionCount: actions.filter((action) => action.group === "destructive").length,
watchActionCount: actions.filter((action) => action.group === "watch").length,
userInitiatedOnly: true,
labels: actions.map((action) => action.label),
};
}
function normalizeDiscoveryCommandSessionSummary() {
const actions = [
{ label: "执行命令", group: "run" },
{ label: "写入 stdin", group: "control" },
{ label: "调整 PTY", group: "control" },
{ label: "终止命令", group: "control", termination: true },
{ label: "输出流", group: "stream", stream: true },
];
return {
actionCount: actions.length,
controlActionCount: actions.filter((action) => action.group === "control").length,
streamAvailable: actions.some((action) => action.stream === true),
terminationAvailable: actions.some((action) => action.termination === true),
sandboxedCommandAvailable: actions.some((action) => action.group === "run"),
userInitiatedOnly: true,
labels: actions.map((action) => action.label),
};
}
function normalizeDiscoveryPlugins(result) {
return asArray(result?.marketplaces)
.flatMap((marketplace) => asArray(marketplace?.plugins))
@@ -1817,6 +1859,8 @@ export async function discoverCodexAppServerCapabilities(runnerConfig) {
pluginGovernanceSummary: normalizeDiscoveryPluginGovernanceSummary(),
accountGovernanceSummary: normalizeDiscoveryAccountGovernanceSummary(),
configGovernanceSummary: normalizeDiscoveryConfigGovernanceSummary(),
fileSystemGovernanceSummary: normalizeDiscoveryFileSystemGovernanceSummary(),
commandSessionSummary: normalizeDiscoveryCommandSessionSummary(),
errors: [
modelResult?.__bossError ? `model/list:${safeRuntimeDiagnosticText(modelResult.__bossError)}` : undefined,
providerCapabilities?.__bossError