跳到主要内容

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

提交记录
修改ui/scripts/app-update-ui-smoke.mjs+13 −0看文件
@@ -80,3 +80,16 @@ try {
8080 await fs.writeFile(`${output}/checks.json`, JSON.stringify(result, null, 2));
8181 console.log(JSON.stringify(result));
8282} finally { await browser.close(); }
83新增:
84新增:const recovered = await createWorkbench({ nativeRequest: async body => {
85新增: if (body.action !== "appUpdate") return null;
86新增: return body.operation === "status"
87新增: ? { phase: "failed", message: "新版本工作台未能就绪,已恢复原应用", retryable: true }
88新增: : { phase: "current", currentVersion: "0.1.3-alpha.1" };
89新增:} });
90新增:try {
91新增: await recovered.page.getByRole("alert").filter({ hasText: "已恢复原应用" }).waitFor();
92新增: assert.equal(await recovered.page.locator(".app-update-button").count(), 0, "rollback failure stays visible without advertising an unavailable update");
93新增: assert.deepEqual(recovered.errors, []);
94新增: console.log("PASS: persisted update failure remains visible while the startup check completes");
95新增:} finally { await recovered.browser.close(); }
修改ui/src/app-updates.jsx+13 −6看文件
@@ -8,6 +8,7 @@ const retryInterval = 5 * 60 * 1000;
88
99export function useAppUpdates() {
1010 const [state, setState] = useState({ phase: "idle", message: "" });
11新增: const [startupFailure, setStartupFailure] = useState("");
1112 const current = useRef(state);
1213 current.current = state;
1314 const requestPending = useRef(false);
@@ -46,6 +47,7 @@ export function useAppUpdates() {
4647 try {
4748 const next = await native("appUpdate", { operation: "status" });
4849 if (!live) return;
50新增: if (next?.phase === "failed") setStartupFailure(next.message || "上次应用更新未完成");
4951 if (next?.phase) { current.current = next; setState(next); }
5052 if (!next || ["idle", "current", "failed"].includes(next.phase)) void run("check");
5153 } catch (error) {
@@ -62,11 +64,16 @@ export function useAppUpdates() {
6264 document.removeEventListener("visibilitychange", check);
6365 };
6466 }, [available, run]);
65删除: return { state, run, available };
67新增: useEffect(() => {
68新增: if (!startupFailure) return;
69新增: const timer = setTimeout(() => setStartupFailure(""), 8000);
70新增: return () => clearTimeout(timer);
71新增: }, [startupFailure]);
72新增: return { state, run, available, startupFailure };
6673}
6774
6875export function AppUpdateButton({ updates }) {
69删除: const { state, run, available } = updates;
76新增: const { state, run, available, startupFailure } = updates;
7077 const busy = activePhases.has(state.phase);
7178 const failed = state.phase === "failed";
7279 const visible = state.latestVersion && ["available", "ready", "failed", ...activePhases].includes(state.phase);
@@ -84,7 +91,7 @@ export function AppUpdateButton({ updates }) {
8491 const timer = setTimeout(() => setFailure(""), 8000);
8592 return () => clearTimeout(timer);
8693 }, [failure]);
87删除: if (!available || !visible) return null;
94新增: if (!available || (!visible && !startupFailure)) return null;
8895 const downloading = state.phase === "downloading";
8996 const percent = state.totalBytes > 0
9097 ? Math.max(0, Math.min(100, Math.floor((state.receivedBytes || 0) / state.totalBytes * 100)))
@@ -99,7 +106,7 @@ export function AppUpdateButton({ updates }) {
99106 const circumference = 2 * Math.PI * 15;
100107 return (
101108 <>
102删除: <button
109新增: {visible && <button
103110 className={`app-update-button${busy ? " busy" : ""}${failed ? " failed" : ""}`}
104111 aria-label={label}
105112 title={hint}
@@ -118,8 +125,8 @@ export function AppUpdateButton({ updates }) {
118125 {downloading && percent !== null && <span className="app-update-percent">{percent}%</span>}
119126 </>
120127 ) : failed ? <RefreshCw size={20} /> : <ArrowDownToLine size={22} />}
121删除: </button>
122删除: {failure && <div className="app-update-error" role="alert">{failure}。可点击更新按钮重试。</div>}
128新增: </button>}
129新增: {(failure || startupFailure) && <div className="app-update-error" role="alert">{failure || startupFailure}{visible ? "。可点击更新按钮重试。" : ""}</div>}
123130 </>
124131 );
125132}