cicy-desktop 2.1.205 → 2.1.207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cicy-desktop",
3
- "version": "2.1.205",
3
+ "version": "2.1.207",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -140,11 +140,11 @@
140
140
  "//optionalDependencies": "(2026-06 回调): mac/linux 改回 native cicy-code(:8008,colima 在 16G mac 上压垮内存)→ 重新内置 cicy-code-<plat> / cicy-mihomo-<plat>,localbin.fromBundle 零网络 seed(npm 仅作更新通道,带 npmmirror→npmjs 回退)。这些由 scripts/sync-runtime-deps.cjs 在 tag-push 时同步到最新版。npm 的 os/cpu 字段保证每个平台只装自己那份。Windows 仍走 docker(WSL :8009),它那份 cicy-code-windows 用不到但 bundle 着无害。",
141
141
  "optionalDependencies": {
142
142
  "electron": "41.0.3",
143
- "cicy-code-darwin-x64": "2.3.51",
144
- "cicy-code-darwin-arm64": "2.3.51",
145
- "cicy-code-linux-x64": "2.3.51",
146
- "cicy-code-linux-arm64": "2.3.51",
147
- "cicy-code-windows-x64": "2.3.51",
143
+ "cicy-code-darwin-x64": "2.3.53",
144
+ "cicy-code-darwin-arm64": "2.3.53",
145
+ "cicy-code-linux-x64": "2.3.53",
146
+ "cicy-code-linux-arm64": "2.3.53",
147
+ "cicy-code-windows-x64": "2.3.53",
148
148
  "cicy-mihomo-darwin-x64": "1.10.4",
149
149
  "cicy-mihomo-darwin-arm64": "1.10.4",
150
150
  "cicy-mihomo-linux-x64": "1.10.4",
@@ -64,6 +64,27 @@ function mirrored(githubUrl) {
64
64
  return m ? mirrorUrl(githubUrl, m) : githubUrl;
65
65
  }
66
66
 
67
+ // HEAD 探测 URL 是否可下(200/206 = ok)。跟随重定向(GitHub release 会 302 到 CDN)。
68
+ // 用于「先出包再更新版本」的客户端保险:版本号涨了但包还没传 → HEAD 404 → 先不报更新。
69
+ function headOk(url, redirects = 0) {
70
+ return new Promise((resolve) => {
71
+ if (redirects > 6) return resolve(false);
72
+ let req;
73
+ try {
74
+ req = https.request(url, { method: "HEAD", headers: { "User-Agent": "cicy-desktop" }, timeout: 10000 }, (res) => {
75
+ res.resume();
76
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
77
+ return headOk(res.headers.location, redirects + 1).then(resolve);
78
+ }
79
+ resolve(res.statusCode === 200 || res.statusCode === 206);
80
+ });
81
+ } catch { return resolve(false); }
82
+ req.on("error", () => resolve(false));
83
+ req.on("timeout", () => { req.destroy(); resolve(false); });
84
+ req.end();
85
+ });
86
+ }
87
+
67
88
  // ── 最新版本号 ────────────────────────────────────────────────────────────────
68
89
  async function fetchLatestVersion(network) {
69
90
  if (network === "cn") {
@@ -158,7 +179,12 @@ async function check() {
158
179
  const latest = await fetchLatestVersion(net);
159
180
  const current = app.getVersion();
160
181
  if (latest && cmpVer(latest, current) > 0) {
161
- broadcast({ status: "available", version: latest, current, progress: null, filePath: null });
182
+ // 「先出包再更新版本」客户端保险:版本号涨了不代表包传完了。先 HEAD 确认本平台安装包
183
+ // 真能下(200),否则当成「还没就绪」继续显已是最新,避免用户点下载 404。
184
+ const { url } = assetFor(latest, net);
185
+ const ready = await headOk(url);
186
+ if (ready) broadcast({ status: "available", version: latest, current, progress: null, filePath: null });
187
+ else { log.info(`[app-updater] ${latest} 版本号已更新但安装包未就位(HEAD 非 200):${url} — 暂不提示更新`); broadcast({ status: "up-to-date", version: current, current }); }
162
188
  } else {
163
189
  broadcast({ status: "up-to-date", version: latest || current, current });
164
190
  }
@@ -164,6 +164,7 @@ contextBridge.exposeInMainWorld("cicy", {
164
164
  appStatus: () => logInvoke("docker:app-status"),
165
165
  appRedetect: () => logInvoke("docker:app-redetect"), // 「重试检测」: FORCE a fresh probe (appStatus only reads cache)
166
166
  appBootstrap: () => logInvoke("docker:app-bootstrap"),
167
+ appRepairWsl: () => logInvoke("docker:app-repair-wsl"), // WSL 卡死时一键修复(重启服务/标记重启后自愈)
167
168
  appRestart: () => logInvoke("docker:app-restart"), // supervisorctl 重启 cicy-code
168
169
  appDockerRestart: () => logInvoke("docker:app-docker-restart"), // docker restart 整个容器
169
170
  appRecreate: () => logInvoke("docker:app-recreate"), // 删容器+重建(换 key,需 confirm)
@@ -171,6 +172,8 @@ contextBridge.exposeInMainWorld("cicy", {
171
172
  appUpdate: () => logInvoke("docker:app-update"),
172
173
  appStop: () => logInvoke("docker:app-stop"),
173
174
  appUpgrade: () => logInvoke("docker:app-upgrade"),
175
+ getPorts: () => logInvoke("docker:get-ports"), // 读已发布的额外端口
176
+ setPorts: (ports) => logInvoke("docker:set-ports", { ports }), // 存端口 + recreate 带 -p
174
177
  // Open :8008 with the live container token (refuses if it can't read it).
175
178
  appOpen: () => logInvoke("docker:app-open"),
176
179
  openDir: (which) => logInvoke("docker:open-dir", which), // "projects"→C:\projects, 否则 WSL 卷