跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

提交记录
修改docs/getting-started.md+1 −1看文件
@@ -40,7 +40,7 @@
4040
4141### 选择环境存储位置
4242
43删除:Windows 安装器中选择的是程序目录。如果希望镜像下载和虚拟磁盘都放在 D 盘,首次打开工作台后,点击“选择环境存储位置”,选一个专用空文件夹,例如 `D:\CageData`,点击“使用此位置”,再启动环境。macOS 和 Linux 的本机工作台也提供这个入口。Debian 环境默认设置下,虚拟磁盘在用户主目录的 `.claude-cage/state/lima`,镜像下载缓存在系统用户缓存目录下的 `lima`(Windows 为 `%LOCALAPPDATA%\lima`)。
43新增:Windows 安装器中选择的是程序目录。如果希望镜像下载和虚拟磁盘都放在 D 盘,首次登录后在独立初始化界面的“系统与存储”中选择专用空文件夹,例如 `D:\CageData`,点击“使用此位置”,再配置代理并开始安装。macOS 和 Linux 使用相同流程。安装、必要授权与网络检查完成后才进入工作台;中断后重新打开仍可继续。Debian 环境默认设置下,虚拟磁盘在用户主目录的 `.claude-cage/state/lima`,镜像下载缓存在系统用户缓存目录下的 `lima`(Windows 为 `%LOCALAPPDATA%\lima`)。
4444
4545选择支持私有文件权限和稀疏文件的本地磁盘。Windows 可用 NTFS,Linux 可用 ext4、XFS 或 Btrfs。Mac 需要 APFS 卷并启用所有权。使用 Mac 外接盘时,在 Finder 的磁盘“显示简介”中取消“忽略此宗卷的所有权”。
4646
修改internal/workbench/initialization.go+2 −1看文件
@@ -22,6 +22,7 @@ type initializationView struct {
2222 Required bool `json:"required"`
2323 Started bool `json:"started"`
2424 Tracked bool `json:"tracked"`
25新增: Prepared bool `json:"prepared"`
2526}
2627
2728func (s *Server) initializationState() (initializationView, error) {
@@ -34,7 +35,7 @@ func (s *Server) initializationState() (initializationView, error) {
3435 if json.Unmarshal(data, &record) != nil || record.Version != 1 {
3536 return initializationView{}, errors.New("初始化记录无法读取,请保留现有数据并导出诊断包")
3637 }
37删除: return initializationView{Required: !record.Completed || s.macSetupPending(), Started: record.Started, Tracked: true}, nil
38新增: return initializationView{Required: !record.Completed || s.macSetupPending(), Started: record.Started, Tracked: true, Prepared: s.environmentPrepared()}, nil
3839 }
3940 if !errors.Is(err, os.ErrNotExist) {
4041 return initializationView{}, err
修改ui/scripts/initialization-smoke.mjs+35 −0看文件
@@ -86,3 +86,38 @@ for (const [platform, system] of [["darwin", "macos"], ["windows", "windows-11"]
8686 console.log(`PASS ${platform}: independent initialization, inline keyboard selection, back navigation, progress, refresh, retry, completion gate and reopen`);
8787 } finally { await browser.close(); }
8888}
89新增:
90新增:{
91新增: let imported = false, applied = false;
92新增: const f = await createWorkbench({ initialization: { required: true, tracked: true }, beforeNavigate: async (page, state) => {
93新增: state.status.local_vm_storage = true;
94新增: await page.route("**/api/environment/storage", route => route.fulfill({ json: { directory: "/preview/cage-state", has_environment: false } }));
95新增: await page.route("**/api/environment/guest-systems", route => route.fulfill({ json: { fresh: true, available: true, system: "macos" } }));
96新增: await page.route("**/api/proxy", route => route.fulfill({ json: { active: applied, selected: applied ? "node" : "", sources: imported ? [{ id: "source", name: "自有节点", nodes: [{ id: "node", name: "本机测试代理", type: "socks5" }] }] : [], port: 17896, core_available: true } }));
97新增: for (const action of ["import", "route"]) await page.route(`**/api/proxy/${action}`, route => {
98新增: if (action === "import") imported = true;
99新增: else applied = true;
100新增: state.status.job = { id: action, kind: "proxy", running: false, message: "已完成" };
101新增: return route.fulfill({ json: state.status.job });
102新增: });
103新增: } });
104新增: try {
105新增: const { page } = f;
106新增: await page.getByRole("button", { name: "下一步:配置代理" }).click();
107新增: const start = page.getByRole("button", { name: "开始安装", exact: true });
108新增: assert.ok(await start.isDisabled());
109新增: await page.getByRole("button", { name: "添加来源", exact: true }).click();
110新增: await page.getByRole("button", { name: "手动节点", exact: true }).click();
111新增: await page.getByLabel("来源名称", { exact: true }).fill("自有节点");
112新增: await page.getByLabel("节点名称", { exact: true }).fill("本机测试代理");
113新增: await page.getByLabel("服务器", { exact: true }).fill("127.0.0.1");
114新增: await page.getByRole("button", { name: "导入并验证", exact: true }).click();
115新增: await page.getByRole("tab", { name: "节点", exact: true }).click();
116新增: await page.getByRole("button", { name: "选择节点 本机测试代理", exact: true }).click();
117新增: await page.getByRole("button", { name: "应用代理", exact: true }).click();
118新增: await page.getByText("已完成", { exact: true }).waitFor();
119新增: await page.waitForFunction(() => [...document.querySelectorAll('button')].some(button => button.textContent === '开始安装' && !button.disabled));
120新增: assert.deepEqual(f.errors, []);
121新增: console.log("PASS first proxy: manual import, node selection and explicit apply unlock installation inside initialization");
122新增: } finally { await f.browser.close(); }
123新增:}
修改ui/scripts/packaged-startup-smoke.mjs+1 −1看文件
@@ -54,8 +54,8 @@ try {
5454 await page.getByRole("button", { name: "下一步:配置代理", exact: true }).click();
5555 await page.getByRole("heading",{name:"连接你的网络代理",exact:true}).waitFor();
5656 assert.ok(await page.getByRole("button",{name:"开始安装",exact:true}).isDisabled(), "proxy must be applied before installation");
57删除: if(evidence) await page.screenshot({ path:path.join(evidence,"initialization-proxy.png") });
5857 await page.getByText("添加来源", { exact: true }).first().waitFor();
58新增: if(evidence) await page.screenshot({ path:path.join(evidence,"initialization-proxy.png") });
5959 assert.deepEqual(errors, []);
6060 console.log(JSON.stringify({ checks: ["standalone initialization after account setup", "VM stopped throughout", "no workbench navigation before initialization", "SSH-only alternative", "proxy required before installation", packaged ? "packaged helper bootstrap" : "development helper bootstrap", "real session and APIs", "embedded production UI loaded", "private profile onboarding", "launch ticket removed"], version: entry.controller.version }));
6161} finally {
修改ui/src/initialization.jsx+6 −1看文件
@@ -67,6 +67,7 @@ function Initialization({ initial, onComplete }) {
6767 const pollNow = useRef(null);
6868 const activation = useRef(false);
6969 const actionPending = useRef(false);
70新增: const restored = useRef(false);
7071 const job = status?.job || {};
7172 const busy = submitting || Boolean(job.running);
7273 const network = networkState(status);
@@ -96,6 +97,10 @@ function Initialization({ initial, onComplete }) {
9697 if (results[1].status === "fulfilled") {
9798 const install = results[1].value;
9899 setPending(install?.pending || null);
100新增: if (!restored.current) {
101新增: restored.current = true;
102新增: if (initial.started && !initial.prepared && !account?.guest_system && !install?.pending && !next.job?.running && !next.job?.setup_progress && !next.ready) setStep("system");
103新增: }
99104 if (install?.activate && !activation.current) {
100105 activation.current = true;
101106 setStep("install");
@@ -167,7 +172,7 @@ function Initialization({ initial, onComplete }) {
167172 async function back() {
168173 if (step === "proxy" && proxyDirty && !await confirm({ title: "放弃尚未应用的代理修改?", body: "已经保存并应用的代理会保留,当前未应用的表单修改会丢弃。", confirm: "放弃修改" })) return;
169174 setProxyDirty(false);
170删除: setStep(step === "install" ? "proxy" : "system");
175新增: setStep(step === "install" ? "proxy" : pending || account?.guest_system ? "install" : "system");
171176 }
172177 const failed = Boolean(job.error || error);
173178 const progress = job.setup_progress && { ...job, setup_progress: job.setup_progress };
修改ui/src/proxy-settings.jsx+3 −3看文件
@@ -262,11 +262,11 @@ export function ProxySettings({ status, onApplied, onConfirm, onDirty, initializ
262262 const route = routeDraft ?? savedRoute;
263263 const routeChanged = JSON.stringify(route) !== JSON.stringify(savedRoute);
264264 useEffect(() => {
265删除: onDirty?.(routeChanged);
265新增: onDirty?.(routeChanged || initializing && Boolean(form));
266266 return () => onDirty?.(false);
267删除: }, [onDirty, routeChanged]);
267新增: }, [onDirty, routeChanged, initializing, Boolean(form)]);
268268 if (!proxy)
269删除: return <div className="proxy-loading">{error || "正在读取代理配置…"}</div>;
269新增: return <div className="proxy-loading" role={error ? "alert" : "status"}>{error || "正在读取代理配置…"}</div>;
270270 const allNodes = proxy.sources.flatMap((s) =>
271271 s.nodes.map((n) => ({ ...n, source: s.name, sourceID: s.id })),
272272 );