|
|
@@ -8,6 +8,23 @@ import { hasGlob, realpathLoose } from '../../lib/paths'
|
|
|
|
|
|
export const PROFILE_NAME = 'agent_server'
|
|
|
|
|
|
+/**
|
|
|
+ * 服务场景下关闭的 Codex 功能(每次对话的 config 覆盖)。已验证(2026-10-23,codex 0.164):服务账号登录 ChatGPT 后,
|
|
|
+ * Codex 会自动安装 openai-curated-remote 中的插件(Google Drive、Gmail、Pages、Sites 等),把插件技能、应用连接器
|
|
|
+ * 和插件安装建议带进对话,调用方可能借此访问账号绑定的个人数据。对话只使用 AgentServer 提供的能力(技能、MCP Gateway)
|
|
|
+ */
|
|
|
+export const DISABLED_FEATURES = {
|
|
|
+ plugins: false,
|
|
|
+ remote_plugin: false,
|
|
|
+ apps: false,
|
|
|
+ tool_suggest: false,
|
|
|
+ skill_mcp_dependency_install: false,
|
|
|
+ // 子代理的事件与审批不经过 AgentServer
|
|
|
+ multi_agent: false,
|
|
|
+ browser_use: false,
|
|
|
+ computer_use: false,
|
|
|
+} as const
|
|
|
+
|
|
|
type Access = 'read' | 'write' | 'deny'
|
|
|
type FsTable = Record<string, Access | Record<string, Access> | number>
|
|
|
|
|
|
@@ -15,6 +32,7 @@ export interface CodexThreadConfig {
|
|
|
default_permissions: string
|
|
|
permissions: Record<string, { filesystem: FsTable; network: { enabled: boolean } }>
|
|
|
shell_environment_policy: { inherit: 'core'; set: Record<string, string> }
|
|
|
+ features: Record<string, boolean>
|
|
|
[key: string]: unknown
|
|
|
}
|
|
|
|
|
|
@@ -61,6 +79,9 @@ export function buildThreadConfig(opts: {
|
|
|
const py = opts.settings.paths.pythonRuntime
|
|
|
const agentDir = path.join(access.workspaceDir, '.agent')
|
|
|
return {
|
|
|
+ features: { ...DISABLED_FEATURES },
|
|
|
+ // 即使有应用被启用,也不暴露连接器工具
|
|
|
+ apps: { _default: { enabled: false, destructive_enabled: false, open_world_enabled: false } },
|
|
|
default_permissions: PROFILE_NAME,
|
|
|
permissions: { [PROFILE_NAME]: { filesystem: fs, network: { enabled: false } } },
|
|
|
// 只继承基础环境变量(PATH、HOME 等),不把服务进程中的密钥带进命令
|