cicy-desktop 2.1.67 → 2.1.68
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 +1 -1
- package/src/sidecar/cicy-code.js +18 -4
package/package.json
CHANGED
package/src/sidecar/cicy-code.js
CHANGED
|
@@ -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
|
-
|
|
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 () => {
|