cicy-desktop 2.1.67 → 2.1.69

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.67",
3
+ "version": "2.1.69",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -143,7 +143,8 @@
143
143
  "cicy-mihomo-linux-x64": "1.10.4",
144
144
  "cicy-mihomo-linux-arm64": "1.10.4",
145
145
  "cicy-mihomo-windows-x64": "1.10.4",
146
- "cicy-mihomo-windows-arm64": "1.10.4"
146
+ "cicy-mihomo-windows-arm64": "1.10.4",
147
+ "cicy-msys2-windows-x64": "1.0.0"
147
148
  },
148
149
  "devDependencies": {
149
150
  "@babel/core": "^7.29.0",
@@ -154,4 +155,4 @@
154
155
  "prettier": "^3.8.1",
155
156
  "supertest": "^6.3.3"
156
157
  }
157
- }
158
+ }
@@ -42,13 +42,27 @@ let child = null;
42
42
  // network, zero npx), upgrades come through runtime.upgrade(). Returns the
43
43
  // spawn child or null when the store has no usable binary (legacy fallbacks
44
44
  // below take over).
45
- function startFromRuntime({ logPath, port }) {
45
+ async function startFromRuntime({ logPath, port }) {
46
46
  let runtime;
47
47
  try { runtime = require("./runtime"); } catch { return null; }
48
48
  let exe = null;
49
49
  try { exe = runtime.binPath("cicy-code") || runtime.ensureFromBundle("cicy-code"); } catch (e) {
50
50
  console.warn(`[cicy-code-sidecar] runtime store unusable: ${e.message}`);
51
- return null;
51
+ }
52
+ // Bundle absent or empty (npm optionalDependencies are best-effort — a flaky
53
+ // mirror/network can leave the dep recorded but unpopulated). Don't strand
54
+ // the user: pull the pinned/latest version from npm into the runtime store.
55
+ // This is the network fallback to the zero-network bundle seed.
56
+ if (!exe) {
57
+ try {
58
+ const { latest } = await runtime.checkUpdate("cicy-code");
59
+ if (latest) {
60
+ console.log(`[cicy-code-sidecar] bundle missing — npm-pulling cicy-code@${latest} into runtime store`);
61
+ await runtime.fetchVersion("cicy-code", latest);
62
+ runtime.switchCurrent("cicy-code", latest);
63
+ exe = runtime.binPath("cicy-code");
64
+ }
65
+ } catch (e) { console.warn(`[cicy-code-sidecar] runtime npm-pull failed: ${e.message}`); }
52
66
  }
53
67
  if (!exe) return null;
54
68
 
@@ -87,7 +101,7 @@ async function start({ logPath, port = DEFAULT_PORT, force = false, version = nu
87
101
  }
88
102
 
89
103
  // Runtime store first — uniform across platforms.
90
- const rt = startFromRuntime({ logPath, port });
104
+ const rt = await startFromRuntime({ logPath, port });
91
105
  if (rt) { child = rt; return child; }
92
106
 
93
107
  if (process.platform === "win32") {
@@ -275,7 +289,7 @@ async function update({ logPath, port = DEFAULT_PORT, emit } = {}) {
275
289
  emit,
276
290
  stop: () => stop({ port }),
277
291
  start: async () => {
278
- child = startFromRuntime({ logPath, port });
292
+ child = await startFromRuntime({ logPath, port });
279
293
  if (!child) throw new Error("runtime spawn failed");
280
294
  },
281
295
  verify: async () => {
@@ -105,9 +105,17 @@ function installPayload(comp, ver, payloadDir) {
105
105
  fs.rmSync(staging, { recursive: true, force: true });
106
106
  fs.mkdirSync(staging, { recursive: true });
107
107
  if (c.kind === "dir") {
108
- cpDirSync(payloadDir, staging);
108
+ // The 118MB+ MSYS2 tree ships as a single .tar.gz inside the npm package
109
+ // (npm handles one big file far better than 10k tiny ones). Extract it;
110
+ // otherwise the payload is already an unpacked tree → copy.
111
+ const tgz = (() => { try { return fs.readdirSync(payloadDir).find((f) => /\.tar\.gz$/i.test(f)); } catch { return null; } })();
112
+ if (tgz) {
113
+ require("child_process").execFileSync("tar", ["-xzf", path.join(payloadDir, tgz), "-C", staging], { windowsHide: true });
114
+ } else {
115
+ cpDirSync(payloadDir, staging);
116
+ }
109
117
  if (!fs.existsSync(path.join(staging, c.check))) {
110
- // the tree may be nested one level (package/msys64/usr/...)
118
+ // the tree may be nested one level (package/msys64/usr/... or root/usr/...)
111
119
  const sub = fs.readdirSync(staging).find((d) =>
112
120
  fs.existsSync(path.join(staging, d, c.check)));
113
121
  if (!sub) { fs.rmSync(staging, { recursive: true, force: true }); throw new Error(`${comp}: ${c.check} missing in package`); }