cicy-desktop 2.1.84 → 2.1.86

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/bin/cicy-desktop CHANGED
@@ -40,10 +40,49 @@ function globalElectronBin() {
40
40
  return _globalElectronBin;
41
41
  }
42
42
 
43
+ // Self-heal electron's downloaded binary so a FRESH `npx cicy-desktop` starts
44
+ // first-try. cicy-desktop pins electron 41.0.3 as a dependency; its postinstall
45
+ // downloads the platform binary. If that never ran (--ignore-scripts), failed
46
+ // (GitHub blocked in CN with no mirror) or got wiped (AV touched node_modules),
47
+ // `npx electron` throws "Electron failed to install correctly" and the worker
48
+ // crash-loops. Detect a missing binary and re-run electron's OWN install.js with
49
+ // the npmmirror ELECTRON_MIRROR. Uses the pinned 41.0.3 already on disk — never
50
+ // pulls latest (latest's native extract-zip is unpublished for win32-x64 →
51
+ // "Cannot find native binding"). Runs once per process.
52
+ let _electronEnsured = false;
53
+ function ensureElectron() {
54
+ if (_electronEnsured) return;
55
+ _electronEnsured = true;
56
+ let electronDir;
57
+ try { electronDir = path.dirname(require.resolve("electron/package.json", { paths: [PACKAGE_ROOT] })); }
58
+ catch { return; } // not resolvable from here → leave it to npx
59
+ try {
60
+ const pathTxt = path.join(electronDir, "path.txt");
61
+ if (fs.existsSync(pathTxt)) {
62
+ const exe = fs.readFileSync(pathTxt, "utf8").trim();
63
+ if (exe && fs.existsSync(path.join(electronDir, "dist", exe))) return; // healthy
64
+ }
65
+ } catch {}
66
+ const installJs = path.join(electronDir, "install.js");
67
+ if (!fs.existsSync(installJs)) return;
68
+ console.log("⚙️ Electron binary missing — repairing via electron/install.js (mirror)…");
69
+ try {
70
+ execSync(`"${process.execPath}" "${installJs}"`, {
71
+ cwd: electronDir,
72
+ stdio: "inherit",
73
+ env: { ...process.env, ELECTRON_MIRROR, npm_config_registry: NPM_REGISTRY },
74
+ });
75
+ } catch (e) {
76
+ console.warn(`⚠️ Electron repair failed: ${e.message}`);
77
+ console.warn(` Fix manually: set ELECTRON_MIRROR=${ELECTRON_MIRROR} && npm i -g electron@41.0.3`);
78
+ }
79
+ }
80
+
43
81
  // Resolve the electron binary to spawn. Order: (C) a shared GLOBAL electron,
44
82
  // then the project-local copy, then `npx electron` as a last resort.
45
83
  // Windows uses `npx.cmd electron` to handle the shim correctly.
46
84
  function resolveElectronSpawn() {
85
+ ensureElectron();
47
86
  const g = globalElectronBin();
48
87
  if (g) return { cmd: g, prefixArgs: [] };
49
88
  if (isWindows) return { cmd: "npx.cmd", prefixArgs: ["electron"] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cicy-desktop",
3
- "version": "2.1.84",
3
+ "version": "2.1.86",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -133,11 +133,11 @@
133
133
  },
134
134
  "//optionalDependencies": "Runtime Bundle v1 (主人指令): platform binaries delivered by `npm i -g cicy-desktop` itself — npm installs only the current-platform subpackage (os/cpu pinned in each), so first start seeds the runtime store with ZERO network, ZERO npx. Windows packages are named *-windows-* (npm spam filter 403s new names containing win32). cicy-msys2 added once published.",
135
135
  "optionalDependencies": {
136
- "cicy-code-darwin-x64": "2.3.4",
137
- "cicy-code-darwin-arm64": "2.3.4",
138
- "cicy-code-linux-x64": "2.3.4",
139
- "cicy-code-linux-arm64": "2.3.4",
140
- "cicy-code-windows-x64": "2.3.4",
136
+ "cicy-code-darwin-x64": "2.3.7",
137
+ "cicy-code-darwin-arm64": "2.3.7",
138
+ "cicy-code-linux-x64": "2.3.7",
139
+ "cicy-code-linux-arm64": "2.3.7",
140
+ "cicy-code-windows-x64": "2.3.7",
141
141
  "cicy-mihomo-darwin-x64": "1.10.4",
142
142
  "cicy-mihomo-darwin-arm64": "1.10.4",
143
143
  "cicy-mihomo-linux-x64": "1.10.4",
@@ -223,7 +223,7 @@ contextBridge.exposeInMainWorld("cicy", {
223
223
  localTeams: {
224
224
  list: (opts) => logInvoke("localTeams:list", opts),
225
225
  open: (id) => logInvoke("localTeams:open", id),
226
- reload: (id) => logInvoke("localTeams:reload", id),
226
+ reload: (id, opts) => logInvoke("localTeams:reload", id, opts),
227
227
  add: (spec) => logInvoke("localTeams:add", spec),
228
228
  remove: (id) => logInvoke("localTeams:remove", id),
229
229
  update: (id, patch) => logInvoke("localTeams:update", { id, patch }),