cicy-desktop 2.1.259 → 2.1.261

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.259",
3
+ "version": "2.1.261",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -139,10 +139,10 @@
139
139
  "//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 着无害。",
140
140
  "optionalDependencies": {
141
141
  "electron": "41.0.3",
142
- "cicy-code-darwin-x64": "2.3.315",
143
- "cicy-code-darwin-arm64": "2.3.315",
144
- "cicy-code-linux-x64": "2.3.315",
145
- "cicy-code-linux-arm64": "2.3.315",
142
+ "cicy-code-darwin-x64": "2.3.331",
143
+ "cicy-code-darwin-arm64": "2.3.331",
144
+ "cicy-code-linux-x64": "2.3.331",
145
+ "cicy-code-linux-arm64": "2.3.331",
146
146
  "cicy-code-windows-x64": "2.3.193",
147
147
  "cicy-mihomo-darwin-x64": "1.10.4",
148
148
  "cicy-mihomo-darwin-arm64": "1.10.4",
package/src/main.js CHANGED
@@ -1470,12 +1470,6 @@ electronApp.whenReady().then(async () => {
1470
1470
  : [{ label: i18n.t("menu.close"), role: "close" }]),
1471
1471
  ],
1472
1472
  },
1473
- ...(process.platform !== "darwin" ? [{
1474
- label: i18n.t("menu.help"),
1475
- submenu: [
1476
- { label: "打开 cicy-ai.com", click: openCicyAi },
1477
- ],
1478
- }] : []),
1479
1473
  ];
1480
1474
  Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));
1481
1475
  };
@@ -32,7 +32,11 @@ const DOCKER_DESKTOP_URL = process.env.CICY_DOCKER_DESKTOP_URL
32
32
  const DOCKER_DESKTOP_MIRROR = process.env.CICY_DOCKER_DESKTOP_MIRROR
33
33
  || "https://cicy-1372193042.cos.ap-shanghai.myqcloud.com/binaries/DockerDesktopInstaller.exe";
34
34
  // CICY_* env vars forwarded into the container (team onboarding, version pin…).
35
- const PASS_ENV = ["CICY_TEAM_TOKEN", "CICY_CODE_VERSION", "NPM_REGISTRY", "CICY_NPM_REGISTRY", "CICY_AGENTS", "ENABLE_CDN", "CICY_CLOUDFLARED_TOKEN"];
35
+ const PASS_ENV = [
36
+ "CICY_TEAM_TOKEN", "CICY_CODE_VERSION", "NPM_REGISTRY", "CICY_NPM_REGISTRY",
37
+ "CICY_AGENTS", "ENABLE_CDN", "CICY_CLOUDFLARED_TOKEN",
38
+ "CICY_CLOUD_EMAIL", "CICY_CLOUD_TEAM_ID",
39
+ ];
36
40
 
37
41
  // Resolve the docker CLI. CRITICAL on Windows: right after Docker Desktop
38
42
  // installs, it adds `...\Docker\resources\bin` to the SYSTEM PATH — but the
@@ -670,7 +670,15 @@ async function runContainer({ port = 8008, container = "cicy-code-docker", volum
670
670
  if (await probeHealth(port)) { ensureDesktopShortcut(volume, port).catch(() => {}); return { adopted: true }; }
671
671
  // Replace any stale same-named container.
672
672
  try { await wslRun(`docker rm -f ${container}`, { timeout: 20000 }); } catch {}
673
- const envArgs = Object.entries(env || {})
673
+ // Windows workflow/user-level environment is inherited by cicy-desktop, then
674
+ // explicitly forwarded across both boundaries: Windows → WSL → container.
675
+ // Without this, Desktop starts a healthy cicy-code that never registers the
676
+ // requested Cloud account/team even though the variables exist on Windows.
677
+ const inheritedCloudEnv = {};
678
+ for (const key of ["CICY_CLOUD_EMAIL", "CICY_CLOUD_TEAM_ID"]) {
679
+ if (process.env[key]) inheritedCloudEnv[key] = process.env[key];
680
+ }
681
+ const envArgs = Object.entries({ ...inheritedCloudEnv, ...(env || {}) })
674
682
  .filter(([, v]) => v != null && v !== "")
675
683
  .map(([k, v]) => `-e ${k}='${String(v).replace(/'/g, "'\\''")}'`)
676
684
  .join(" ");
package/src/tray.js CHANGED
@@ -7,7 +7,7 @@
7
7
  // so they're available at runtime in both dev (./build/...) and packaged
8
8
  // (process.resourcesPath/build/...) modes.
9
9
 
10
- const { app, Tray, Menu, nativeImage, BrowserWindow } = require("electron");
10
+ const { app, Tray, Menu, nativeImage, dialog } = require("electron");
11
11
  const path = require("path");
12
12
  const fs = require("fs");
13
13
  const log = require("electron-log");
@@ -42,6 +42,134 @@ function setupDockIcon() {
42
42
  }
43
43
  }
44
44
 
45
+ async function openCicyAiInProfile1() {
46
+ try {
47
+ const tabs = require("./tools/tab-browser-tools");
48
+ await tabs.openTab(1, "https://cicy-ai.com", { activate: true });
49
+ const manager = tabs.ensureManager(1);
50
+ if (manager.win.isMinimized()) manager.win.restore();
51
+ manager.win.show();
52
+ manager.win.focus();
53
+ } catch (e) {
54
+ log.warn(`[Tray] open cicy-ai.com in Electron Profile 1 failed: ${e.message}`);
55
+ }
56
+ }
57
+
58
+ async function openElectronProfile(accountIdx) {
59
+ try {
60
+ const tabs = require("./tools/tab-browser-tools");
61
+ await tabs.openTab(accountIdx, undefined, { activate: true });
62
+ const manager = tabs.ensureManager(accountIdx);
63
+ if (manager.win.isMinimized()) manager.win.restore();
64
+ manager.win.show();
65
+ manager.win.focus();
66
+ } catch (e) {
67
+ showProfileError("Electron", e);
68
+ }
69
+ }
70
+
71
+ async function openChromeProfile(accountIdx) {
72
+ try {
73
+ await require("./tools/chrome-tools").launchOrActivateProfile({
74
+ accountIdx,
75
+ activateIfRunning: true,
76
+ });
77
+ } catch (e) {
78
+ showProfileError("Chrome", e);
79
+ }
80
+ }
81
+
82
+ function showProfileError(kind, error) {
83
+ dialog.showMessageBox({
84
+ type: "error",
85
+ message: `${kind} Profile 操作失败`,
86
+ detail: String((error && error.message) || error),
87
+ buttons: ["OK"],
88
+ });
89
+ }
90
+
91
+ function listProfiles(backend) {
92
+ try {
93
+ let rows = require("./profiles/profile-store").listProfiles(backend);
94
+ if (backend === "electron") {
95
+ rows = rows.filter((p) => ![0, 9].includes(Number(p.accountIdx)));
96
+ }
97
+ return rows;
98
+ } catch (_) {
99
+ return [];
100
+ }
101
+ }
102
+
103
+ async function addProfileFromTray(kind) {
104
+ try {
105
+ const { executeTool } = require("./server/tool-executor");
106
+ const result = await executeTool(kind === "Electron" ? "electron_add_profile" : "chrome_add_profile", {});
107
+ const text = result && result.content && result.content[0] && result.content[0].text;
108
+ let data = {};
109
+ try { data = JSON.parse(text || "{}"); } catch {}
110
+ if (result && result.isError) throw new Error(data.error || text || "unknown error");
111
+ const accountIdx = Number(data.accountIdx ?? (data.created && data.created.accountIdx));
112
+ installTrayMenu();
113
+ if (Number.isFinite(accountIdx)) {
114
+ if (kind === "Electron") await openElectronProfile(accountIdx);
115
+ else await openChromeProfile(accountIdx);
116
+ }
117
+ } catch (e) {
118
+ showProfileError(kind, e);
119
+ }
120
+ }
121
+
122
+ function installTrayMenu() {
123
+ if (!trayInstance) return;
124
+ const electronRows = listProfiles("electron");
125
+ const chromeRows = listProfiles("chrome");
126
+ const template = [
127
+ {
128
+ label: i18n.t("tray.openHomepage"),
129
+ click: () => openHomepage(),
130
+ },
131
+ ...(process.platform === "win32" ? [
132
+ {
133
+ label: "打开 cicy-ai.com",
134
+ click: () => openCicyAiInProfile1(),
135
+ },
136
+ { type: "separator" },
137
+ {
138
+ label: "Electron",
139
+ submenu: [
140
+ { label: "新增 Profile", click: () => addProfileFromTray("Electron") },
141
+ ...(electronRows.length ? [{ type: "separator" }] : []),
142
+ ...electronRows.map((p) => ({
143
+ label: `Profile ${p.accountIdx}${p.name ? ` · ${p.name}` : ""}`,
144
+ click: () => openElectronProfile(Number(p.accountIdx)),
145
+ })),
146
+ ],
147
+ },
148
+ {
149
+ label: "Chrome",
150
+ submenu: [
151
+ { label: "新增 Profile", click: () => addProfileFromTray("Chrome") },
152
+ { label: "原生 Chrome", click: () => {
153
+ try { require("./tools/chrome-tools").launchNativeChrome(); }
154
+ catch (e) { showProfileError("Chrome", e); }
155
+ } },
156
+ ...(chromeRows.length ? [{ type: "separator" }] : []),
157
+ ...chromeRows.map((p) => ({
158
+ label: `Profile ${p.accountIdx}${p.gmail ? ` · ${p.gmail}` : p.note ? ` · ${p.note}` : ""}`,
159
+ click: () => openChromeProfile(Number(p.accountIdx)),
160
+ })),
161
+ ],
162
+ },
163
+ ] : []),
164
+ { type: "separator" },
165
+ {
166
+ label: i18n.t("tray.quit"),
167
+ click: () => app.quit(),
168
+ },
169
+ ];
170
+ trayInstance.setContextMenu(Menu.buildFromTemplate(template));
171
+ }
172
+
45
173
  function setupTray() {
46
174
  try {
47
175
  let iconPath;
@@ -65,19 +193,7 @@ function setupTray() {
65
193
 
66
194
  trayInstance = new Tray(img);
67
195
  trayInstance.setToolTip(i18n.t("tray.tooltip"));
68
-
69
- const menu = Menu.buildFromTemplate([
70
- {
71
- label: i18n.t("tray.openHomepage"),
72
- click: () => openHomepage(),
73
- },
74
- { type: "separator" },
75
- {
76
- label: i18n.t("tray.quit"),
77
- click: () => app.quit(),
78
- },
79
- ]);
80
- trayInstance.setContextMenu(menu);
196
+ installTrayMenu();
81
197
 
82
198
  // Click on tray icon: open homepage on macOS, toggle on others
83
199
  trayInstance.on("click", () => openHomepage());