cicy-desktop 2.1.182 → 2.1.183

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.
@@ -23,36 +23,10 @@ jobs:
23
23
  node-version: "20"
24
24
  cache: "npm"
25
25
 
26
- - name: Setup Go (for cicy-code sidecar build)
27
- uses: actions/setup-go@v5
28
- with:
29
- go-version: '1.25'
30
-
31
- - name: Read cicy-code ref pin
32
- id: cicy_code_ref
33
- shell: bash
34
- run: |
35
- ref="$(cat .cicy-code-ref | tr -d '[:space:]')"
36
- echo "ref=${ref}" >> "$GITHUB_OUTPUT"
37
- if ! [[ "$ref" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
38
- echo "::error::.cicy-code-ref must be a release tag (vX.Y.Z), got: $ref"
39
- exit 1
40
- fi
41
-
42
- - name: Checkout cicy-code as sibling
43
- uses: actions/checkout@v4
44
- with:
45
- repository: cicy-ai/cicy-code
46
- ref: ${{ steps.cicy_code_ref.outputs.ref }}
47
- path: cicy-code
48
-
49
- - name: Build cicy-code sidecar binaries (linux amd64 + arm64)
50
- shell: bash
51
- working-directory: cicy-code
52
- run: |
53
- SKIP_TTYD_ASSET=1 SKIP_SKILLS_EMBED=1 bash build.sh all
54
- ls -lh dist/
55
-
26
+ # cicy-code is NOT built-from-source here anymore (主人 2026-06): bundled
27
+ # sidecar = the per-platform optionalDependency, seeded by localbin at runtime.
28
+ # The .cicy-code-ref source-build → vendor/cicy-code path was stale + never
29
+ # packaged, so it's removed. Sync just pins optionalDeps to latest.
56
30
  - name: Sync runtime deps to latest (cicy-code + cicy-mihomo; drop msys2)
57
31
  run: node scripts/sync-runtime-deps.cjs
58
32
 
@@ -69,7 +43,6 @@ jobs:
69
43
  - name: Build Linux app (deb + AppImage)
70
44
  shell: bash
71
45
  env:
72
- CICY_CODE_DIST_DIR: ${{ github.workspace }}/cicy-code/dist
73
46
  GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74
47
  run: |
75
48
  set -euo pipefail
@@ -23,44 +23,12 @@ jobs:
23
23
  node-version: "20"
24
24
  cache: "npm"
25
25
 
26
- - name: Setup Go (for cicy-code sidecar build)
27
- uses: actions/setup-go@v5
28
- with:
29
- go-version: '1.25'
30
-
31
- - name: Read cicy-code ref pin
32
- id: cicy_code_ref
33
- shell: bash
34
- run: |
35
- ref="$(cat .cicy-code-ref | tr -d '[:space:]')"
36
- echo "ref=${ref}" >> "$GITHUB_OUTPUT"
37
- # Enforce: ref must be a tagged release (vX.Y.Z), not a branch.
38
- # This guarantees a deterministic build and lets the homepage
39
- # display the same version it shipped with.
40
- if ! [[ "$ref" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
41
- echo "::error::.cicy-code-ref must be a release tag (vX.Y.Z), got: $ref"
42
- exit 1
43
- fi
44
-
45
- - name: Checkout cicy-code as sibling
46
- uses: actions/checkout@v4
47
- with:
48
- repository: cicy-ai/cicy-code
49
- ref: ${{ steps.cicy_code_ref.outputs.ref }}
50
- path: cicy-code
51
-
52
- - name: Build cicy-code sidecar binaries (darwin amd64 + arm64)
53
- # `bash build.sh all` runs prepare_embed (cicy-skills tarball, frontend,
54
- # ttyd assets) and cross-compiles all four darwin/linux targets.
55
- # We only need the two darwin slots for the Mac .app, but building
56
- # the linux ones here is cheap (~20s) and keeps the prepare:sidecar
57
- # script's "all targets at once" mode happy.
58
- shell: bash
59
- working-directory: cicy-code
60
- run: |
61
- bash build.sh all
62
- ls -lh dist/
63
-
26
+ # cicy-code is NOT built-from-source here anymore. 主人(2026-06): the bundled
27
+ # sidecar = the per-platform optionalDependency (cicy-code-<plat>, prebuilt +
28
+ # arm64 linker-adhoc-signed), seeded at runtime by localbin.fromBundle. The old
29
+ # .cicy-code-ref source-build → vendor/cicy-code path was stale + never packaged
30
+ # (vendor/ not in package.json files), so it's removed. Sync just pins the
31
+ # optionalDeps to the latest published cicy-code/cicy-mihomo.
64
32
  - name: Sync runtime deps to latest (cicy-code + cicy-mihomo; drop msys2)
65
33
  run: node scripts/sync-runtime-deps.cjs
66
34
 
@@ -100,16 +68,13 @@ jobs:
100
68
  iconutil -c icns build/icon.iconset -o build/logo.icns || { echo "::warning::iconutil failed"; exit 0; }
101
69
 
102
70
  - name: Build macOS app (dmg + zip, unsigned)
103
- # prebuild:mac (declared in package.json) chains npm run prepare:sidecar
104
- # which reads CICY_CODE_DIST_DIR and populates vendor/cicy-code/.
105
- # CSC_IDENTITY_AUTO_DISCOVERY=false stops electron-builder from probing
106
- # the runner keychain for a cert it does not have; combined with
107
- # build.mac.identity=null in package.json this produces a clean
108
- # unsigned build (with the cicy-code sidecar ad-hoc signed by
109
- # prepare-cicy-code-sidecar.js so Apple Silicon will exec it).
71
+ # CSC_IDENTITY_AUTO_DISCOVERY=false stops electron-builder from probing the
72
+ # runner keychain for a cert it does not have; combined with
73
+ # build.mac.identity=null in package.json this produces a clean unsigned
74
+ # build. The cicy-code sidecar arrives via the optionalDependency
75
+ # (arm64 is linker-adhoc-signed already), seeded by localbin at runtime.
110
76
  shell: bash
111
77
  env:
112
- CICY_CODE_DIST_DIR: ${{ github.workspace }}/cicy-code/dist
113
78
  CSC_IDENTITY_AUTO_DISCOVERY: "false"
114
79
  GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115
80
  run: |
@@ -161,7 +126,6 @@ jobs:
161
126
  shell: bash
162
127
  env:
163
128
  GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164
- CICY_CODE_DIST_DIR: ${{ github.workspace }}/cicy-code/dist
165
129
  CSC_IDENTITY_AUTO_DISCOVERY: "false"
166
130
  run: |
167
131
  gh release upload "${{ steps.meta.outputs.tag }}" dist/*.dmg dist/*.zip \
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cicy-desktop",
3
- "version": "2.1.182",
3
+ "version": "2.1.183",
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.22",
144
- "cicy-code-darwin-arm64": "2.3.22",
145
- "cicy-code-linux-x64": "2.3.22",
146
- "cicy-code-linux-arm64": "2.3.22",
147
- "cicy-code-windows-x64": "2.3.22",
143
+ "cicy-code-darwin-x64": "2.3.23",
144
+ "cicy-code-darwin-arm64": "2.3.23",
145
+ "cicy-code-linux-x64": "2.3.23",
146
+ "cicy-code-linux-arm64": "2.3.23",
147
+ "cicy-code-windows-x64": "2.3.23",
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",
@@ -174,18 +174,20 @@ function register(opts = {}) {
174
174
  ipcMain.handle("app:check-update", async () => { await appUpdater.check(); return appUpdater.getState(); });
175
175
  ipcMain.handle("app:install-update", () => { appUpdater.installNow(); return true; });
176
176
 
177
- // Static version info: cicy-desktop's own version + the cicy-code tag
178
- // we shipped with (`.cicy-code-ref` content from build time). Used by the
179
- // homepage footer to show "CiCy Desktop vX.Y · cicy-code vA.B".
177
+ // Static version info: cicy-desktop's own version + the cicy-code version we
178
+ // actually ship. 主人(2026-06): the real bundled cicy-code = the per-platform
179
+ // optionalDependency (localbin.bundledVersion), not the retired `.cicy-code-ref`
180
+ // source-build pin (which was stale + never packaged). Used by the homepage
181
+ // footer to show "CiCy Desktop vX.Y · cicy-code vA.B".
180
182
  ipcMain.handle("app:get-version", () => {
181
183
  let cicyCodeRef = "";
182
184
  try {
183
- const refPath = path.join(app.getAppPath(), ".cicy-code-ref");
184
- cicyCodeRef = require("fs").readFileSync(refPath, "utf8").trim();
185
+ const bv = require("../sidecar/localbin").bundledVersion("cicy-code");
186
+ if (bv) cicyCodeRef = `v${bv}`;
185
187
  } catch {}
186
188
  return {
187
189
  desktop: app.getVersion(),
188
- cicyCodeRef, // e.g. "v2.0.11" — what we *intended* to ship
190
+ cicyCodeRef, // e.g. "v2.3.22" — the bundled cicy-code
189
191
  electron: process.versions.electron,
190
192
  node: process.versions.node,
191
193
  chrome: process.versions.chrome,
@@ -35,11 +35,36 @@ const path = require("path");
35
35
  const { execFile, execFileSync } = require("child_process");
36
36
 
37
37
  const IS_WIN = process.platform === "win32";
38
- const REGISTRY = process.env.CICY_NPM_REGISTRY || "https://registry.npmmirror.com";
39
- // registry 回退(主人): npmmirror(CN 快)优先,失败回退 npmjs.org(官方)。新发布的
40
- // cicy-code-<plat> 子包/新版本先到 npmjs,npmmirror 同步有延迟 —— 只查 npmmirror 会
41
- // "package not found" 把 seed/更新 整死(实测 mac:npm view cicy-code-darwin-x64 失败)。
42
- const REGISTRIES = [REGISTRY, "https://registry.npmjs.org"].filter((r, i, a) => a.indexOf(r) === i);
38
+ const NPMMIRROR = "https://registry.npmmirror.com"; // CN-fast
39
+ const NPMJS = "https://registry.npmjs.org"; // 官方,新版本/新子包先到这
40
+
41
+ // 主人(2026-06): 按网络环境选 registry 顺序,两边都用各自最快的源(对方做回退)。
42
+ // CN(GFW ):npmmirror 优先 npmjs 兜底
43
+ // 非CN: npmjs 优先 → npmmirror 兜底(npmmirror 海外慢,别让它当首选)
44
+ // 判断:探 generate_204 —— 能 204(够到 Google/有代理)= 非CN;超时/失败 = CN。探一次缓存。
45
+ // CICY_NPM_REGISTRY 覆盖时强制该源优先(测试/私有源用)。
46
+ let _cnProbe = null;
47
+ function probeIsCN() {
48
+ if (_cnProbe) return _cnProbe;
49
+ _cnProbe = new Promise((resolve) => {
50
+ let done = false;
51
+ const fin = (cn) => { if (!done) { done = true; resolve(cn); } };
52
+ try {
53
+ const req = require("https").get("https://www.gstatic.com/generate_204", { timeout: 2000 }, (res) => {
54
+ const ok = res.statusCode === 204; res.destroy(); fin(!ok); // 204 够到 = 非CN
55
+ });
56
+ req.on("timeout", () => { req.destroy(); fin(true); }); // 超时 = GFW = CN
57
+ req.on("error", () => fin(true)); // 连不上 = CN
58
+ } catch { fin(true); }
59
+ });
60
+ return _cnProbe;
61
+ }
62
+ async function registries() {
63
+ const override = process.env.CICY_NPM_REGISTRY;
64
+ if (override) return [override, NPMJS, NPMMIRROR].filter((r, i, a) => a.indexOf(r) === i);
65
+ const cn = await probeIsCN();
66
+ return cn ? [NPMMIRROR, NPMJS] : [NPMJS, NPMMIRROR];
67
+ }
43
68
  const LOCAL_BIN = path.join(os.homedir(), ".local", "bin");
44
69
  const MANIFEST = path.join(LOCAL_BIN, ".cicy-localbin.json");
45
70
 
@@ -126,11 +151,12 @@ function npmExec(args, timeout = 600000) {
126
151
  });
127
152
  }
128
153
 
129
- // Latest published version of the per-platform subpackage. Tries npmmirror then
130
- // npmjs.org (REGISTRIES) so a not-yet-mirrored package/version still resolves.
154
+ // Latest published version of the per-platform subpackage. Tries the env-ordered
155
+ // registries (CN→npmmirror first, 非CN→npmjs first) so a not-yet-mirrored
156
+ // package/version still resolves and 非CN 不被慢镜像拖住。
131
157
  async function latestVersion(name = DEFAULT) {
132
158
  let lastErr;
133
- for (const reg of REGISTRIES) {
159
+ for (const reg of await registries()) {
134
160
  try { return (await npmExec(["view", pkgFor(name), "version", `--registry=${reg}`], 30000)).trim(); }
135
161
  catch (e) { lastErr = e; }
136
162
  }
@@ -221,7 +247,7 @@ async function fetchToLocalBin(ver, { emit, name = DEFAULT } = {}) {
221
247
  try {
222
248
  e({ phase: "download", status: "running", message: `下载 ${label} ${ver}…` });
223
249
  let out, lastErr;
224
- for (const reg of REGISTRIES) {
250
+ for (const reg of await registries()) {
225
251
  try { out = await npmExec(["pack", `${pkgFor(name)}@${ver}`, `--registry=${reg}`, "--pack-destination", tmp]); break; }
226
252
  catch (e2) { lastErr = e2; }
227
253
  }
package/.cicy-code-ref DELETED
@@ -1 +0,0 @@
1
- v2.2.5
@@ -1,116 +0,0 @@
1
- #!/usr/bin/env node
2
- // Populates vendor/cicy-code/<platform>-<arch>/cicy-code so electron-builder
3
- // can include the cicy-code daemon as an extraResources sidecar.
4
- //
5
- // Source resolution (first hit wins):
6
- // 1. CICY_CODE_BIN_PATH — single binary file, copied to the current host's
7
- // platform/arch slot only. Dev shortcut on the maintainer's own box.
8
- // 2. CICY_CODE_DIST_DIR — directory containing all four
9
- // cicy-code-{darwin,linux}-{amd64,arm64} files as produced by
10
- // `bash build.sh all` in the cicy-code repo. Used by CI.
11
- // 3. ../cicy-code/dist — sibling checkout fallback.
12
- //
13
- // Output layout (the ${arch} macro in electron-builder uses x64/arm64 naming,
14
- // not Go's amd64/arm64, so we rename at copy time):
15
- // vendor/cicy-code/darwin-x64/cicy-code
16
- // vendor/cicy-code/darwin-arm64/cicy-code
17
- // vendor/cicy-code/linux-x64/cicy-code
18
- // vendor/cicy-code/linux-arm64/cicy-code
19
- //
20
- // On macOS hosts the copied binary is ad-hoc signed (`codesign --sign -`) so
21
- // it loads on Apple Silicon (which refuses to exec any unsigned mach-o).
22
- // When a real Apple Developer ID is configured, electron-builder's signing
23
- // pass during build:mac will overwrite this ad-hoc sig.
24
-
25
- const fs = require("fs");
26
- const path = require("path");
27
- const { spawnSync } = require("child_process");
28
-
29
- const REPO_ROOT = path.resolve(__dirname, "..");
30
- const VENDOR_ROOT = path.join(REPO_ROOT, "vendor", "cicy-code");
31
-
32
- const TARGETS = [
33
- { platform: "darwin", goArch: "amd64", electronArch: "x64" },
34
- { platform: "darwin", goArch: "arm64", electronArch: "arm64" },
35
- { platform: "linux", goArch: "amd64", electronArch: "x64" },
36
- { platform: "linux", goArch: "arm64", electronArch: "arm64" },
37
- ];
38
-
39
- function nodePlatformToGo(p) {
40
- if (p === "darwin") return "darwin";
41
- if (p === "linux") return "linux";
42
- return null;
43
- }
44
- function nodeArchToGo(a) {
45
- if (a === "x64") return "amd64";
46
- if (a === "arm64") return "arm64";
47
- return null;
48
- }
49
-
50
- function adhocSignIfDarwin(destPath, target) {
51
- if (process.platform !== "darwin" || target.platform !== "darwin") return;
52
- const r = spawnSync("codesign", ["--force", "--sign", "-", destPath], { stdio: "pipe", encoding: "utf8" });
53
- if (r.status === 0) {
54
- console.log(`[cicy-code-sidecar] ad-hoc signed ${path.basename(destPath)}`);
55
- } else {
56
- console.warn(`[cicy-code-sidecar] codesign failed (rc=${r.status}); arm64 may refuse to launch this binary: ${r.stderr.trim()}`);
57
- }
58
- }
59
-
60
- function copyOne(srcPath, target) {
61
- if (!fs.existsSync(srcPath)) return false;
62
- const destDir = path.join(VENDOR_ROOT, `${target.platform}-${target.electronArch}`);
63
- fs.mkdirSync(destDir, { recursive: true });
64
- const destPath = path.join(destDir, "cicy-code");
65
- fs.copyFileSync(srcPath, destPath);
66
- fs.chmodSync(destPath, 0o755);
67
- const sizeMB = (fs.statSync(destPath).size / (1024 * 1024)).toFixed(1);
68
- console.log(`[cicy-code-sidecar] ${target.platform}/${target.electronArch} ${sizeMB} MB <- ${srcPath}`);
69
- adhocSignIfDarwin(destPath, target);
70
- return true;
71
- }
72
-
73
- function main() {
74
- fs.mkdirSync(VENDOR_ROOT, { recursive: true });
75
-
76
- const binPath = process.env.CICY_CODE_BIN_PATH;
77
- if (binPath) {
78
- const goPlat = nodePlatformToGo(process.platform);
79
- const goArch = nodeArchToGo(process.arch);
80
- if (!goPlat || !goArch) {
81
- console.error(`[cicy-code-sidecar] CICY_CODE_BIN_PATH set but current host ${process.platform}/${process.arch} is not a supported sidecar target`);
82
- process.exit(1);
83
- }
84
- const t = TARGETS.find(x => x.platform === goPlat && x.goArch === goArch);
85
- if (!copyOne(binPath, t)) {
86
- console.error(`[cicy-code-sidecar] CICY_CODE_BIN_PATH=${binPath} does not exist`);
87
- process.exit(1);
88
- }
89
- return;
90
- }
91
-
92
- const sibling = path.resolve(REPO_ROOT, "..", "cicy-code", "dist");
93
- const distDir = process.env.CICY_CODE_DIST_DIR
94
- || (fs.existsSync(sibling) ? sibling : null);
95
- if (!distDir) {
96
- console.error("[cicy-code-sidecar] no source found.");
97
- console.error(" Set one of:");
98
- console.error(" CICY_CODE_BIN_PATH=/path/to/cicy-code");
99
- console.error(" CICY_CODE_DIST_DIR=/path/to/cicy-code/dist");
100
- console.error(" …or check out cicy-code as a sibling at ../cicy-code and run `bash build.sh all` there.");
101
- process.exit(1);
102
- }
103
-
104
- let copied = 0;
105
- for (const t of TARGETS) {
106
- const srcPath = path.join(distDir, `cicy-code-${t.platform}-${t.goArch}`);
107
- if (copyOne(srcPath, t)) copied++;
108
- }
109
- if (copied === 0) {
110
- console.error(`[cicy-code-sidecar] no expected binaries found under ${distDir}`);
111
- console.error(" Expected: cicy-code-{darwin,linux}-{amd64,arm64}");
112
- process.exit(1);
113
- }
114
- }
115
-
116
- main();