# 自建 AppContainer 沙盒移除记录(2026-10-20) ## 范围 按用户要求移除 YCode 自建的 Windows AppContainer / Job Object 执行沙盒,包括: - 主进程沙盒实现:`src/main/sandbox` - 原生执行器与文件/Git/工作区组件:`native/sandbox` - 随包资源与内置 MinGit:`resources/sandbox` - 工具适配:`src/main/agent/tools/sandbox-git.ts`、`src/main/agent/tools/sandbox-workspace.ts` - 共享契约:`src/shared/sandbox.ts` - 构建、供应、维护和回归脚本:`scripts/build-sandbox.mjs`、`scripts/vendor-sandbox-git.mjs`、`scripts/verify-sandbox-app.cjs`、`scripts/sandbox-*` - `package.json` 中 `sandbox:build`、`test:sandbox:*`、`sandbox:maintain` 与沙盒 extraResources - `.gitignore` 中沙盒产物规则 - `release/win-unpacked/resources/sandbox` 本地构建产物 ## 保留项 - Electron 渲染进程隔离继续使用 `webPreferences.sandbox`、`contextIsolation` 和无 `nodeIntegration`。 - 对话页“默认权限 / 完全访问”开关保留,因为它是现有权限交互契约;`default-sandbox` 只是枚举名称,不代表仍有自建 AppContainer 后端。 - 历史沙盒设计、验收和取证文档未删除,仍可作为先前工作记录;其中的能力结论不再适用于当前代码。 ## 行为变化 - `npm run build` 不再编译原生沙盒,也不再要求 Visual Studio C++ Build Tools。 - 安装包与免安装目录不再包含 `ycode-sandbox.exe`、沙盒 Node/Python 适配器或内置 MinGit 资源。 - `execute_command` 继续使用宿主 Shell;YCode 不再提供自建 OS 级命令、文件写回、Git 或长期工作区隔离。 - 普通文件工具原有的工作区路径约束和变化检查不受影响。 ## 验证 - `npm run typecheck`:通过。 - `npm run build`:通过(TypeScript、Electron main/preload/renderer)。 - `out/main/index.mjs`:未发现 `windows-appcontainer`、`sandbox_workspace`、`sandbox_git`、`ycode-sandbox`、`executeSandboxCommand`、`sandboxStatus`。 - `src`、`scripts`、`package.json`、`.gitignore`:未发现上述自建沙盒标识。 - `git status` 显示相关受控文件均为删除;唯一既有未跟踪文件为 `in`,未修改。 ## 限制 - 本次没有重新生成 NSIS 安装包;发布前需要重新执行 `npm run dist:installer`,并核对新产物不包含 `resources/sandbox`。 - 历史 `.tmp` 测试记录和用户数据目录中可能残留旧沙盒测试状态,不参与当前运行,也不会被打包。 - 移除 AppContainer 后,若需要操作系统级强制隔离,应作为新方案重新设计和取证,不能引用本仓库旧沙盒结论。