cicy-desktop 2.1.125 → 2.1.126

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.125",
3
+ "version": "2.1.126",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -222,6 +222,39 @@ const probeHealth = docker.probeHealth;
222
222
  // bind-mount 会用空的宿主目录**遮住镜像里预装的 /home/cicy**(cicy-code 装在那),
223
223
  // entrypoint 找不到就试图全局 npm 重装 → EACCES 崩溃,:8009 起不来。named volume
224
224
  // 首次挂载会**从镜像内容预填充**,容器才看得到预装的 cicy-code(和 WSL 一致)。
225
+ // Shared folder bind: the CURRENT macOS user's ~/Desktop/Share ↔
226
+ // /home/cicy/cicy-ai/Share in the container. Auto-created (with a readme) on every
227
+ // container start if missing; os.homedir() makes it per-user. Colima mounts the
228
+ // host $HOME into the VM, so the direct path works (no /mnt translation like WSL).
229
+ const SHARE_README = `# CiCy 共享目录 / Shared Folder
230
+
231
+ 这个文件夹与 CiCy 容器之间双向共享 —— 你和容器里的 agent 都能读写同一份文件。
232
+
233
+ - 你的电脑上: ~/Desktop/Share (就是这个文件夹)
234
+ - 容器里: /home/cicy/cicy-ai/Share
235
+
236
+ 把文件丢进来,CiCy 里的 agent 就能访问;agent 写到容器 Share 里的东西,也会出现在这里。
237
+
238
+ ---
239
+
240
+ This folder is shared both ways between your computer and the CiCy container.
241
+
242
+ - On your computer: ~/Desktop/Share (this folder)
243
+ - Inside the container: /home/cicy/cicy-ai/Share
244
+
245
+ Drop files here for CiCy agents to read; files agents write to Share show up here too.
246
+ `;
247
+
248
+ function shareMountArg() {
249
+ try {
250
+ const share = path.join(os.homedir(), "Desktop", "Share");
251
+ fs.mkdirSync(share, { recursive: true });
252
+ const readme = path.join(share, "readme.md");
253
+ if (!fs.existsSync(readme)) { try { fs.writeFileSync(readme, SHARE_README); } catch {} }
254
+ return `-v '${share}':/home/cicy/cicy-ai/Share`;
255
+ } catch { return ""; }
256
+ }
257
+
225
258
  async function runContainer({ port = 8009, container = "cicy-code-docker-8009", volume = "cicy-team-8009", env = {} } = {}) {
226
259
  if (await probeHealth(port)) return { adopted: true };
227
260
  try { await dk(`rm -f ${container}`, { timeout: 20000 }); } catch {} // 替换同名残留容器
@@ -230,7 +263,7 @@ async function runContainer({ port = 8009, container = "cicy-code-docker-8009",
230
263
  .map(([k, v]) => `-e ${k}='${String(v).replace(/'/g, "'\\''")}'`)
231
264
  .join(" ");
232
265
  const cmd = `run -d --name ${container} --restart unless-stopped ${PLATFORM_FLAG} ` +
233
- `-p 127.0.0.1:${port}:8008 -e CICY_PUBLIC=1 -v ${volume}:/home/cicy ${envArgs} ${IMAGE}`;
266
+ `-p 127.0.0.1:${port}:8008 -e CICY_PUBLIC=1 -v ${volume}:/home/cicy ${shareMountArg()} ${envArgs} ${IMAGE}`;
234
267
  await dk(cmd, { timeout: 90000 });
235
268
  return { started: true };
236
269
  }
@@ -274,6 +274,42 @@ const probeHealth = docker.probeHealth;
274
274
  // network-exposed; the api_token gates access. WSL2's localhost relay then
275
275
  // forwards the distro's 127.0.0.1:<port> to Windows 127.0.0.1:<port>.
276
276
  // Only :<port> is published — sshd/cron stay inside the container's own netns.
277
+ // Shared folder bind: the CURRENT Windows user's ~/Desktop/Share ↔
278
+ // /home/cicy/cicy-ai/Share in the container — a drop-zone both the user and the
279
+ // agent can read/write. Auto-created (with a readme) on every container start if
280
+ // missing; os.homedir() makes it per-user (never hard-coded to one account).
281
+ // Returns the docker `-v` arg, or "" if setup fails (mount is best-effort).
282
+ const SHARE_README = `# CiCy 共享目录 / Shared Folder
283
+
284
+ 这个文件夹与 CiCy 容器之间双向共享 —— 你和容器里的 agent 都能读写同一份文件。
285
+
286
+ - 你的电脑上: ~/Desktop/Share (就是这个文件夹)
287
+ - 容器里: /home/cicy/cicy-ai/Share
288
+
289
+ 把文件丢进来,CiCy 里的 agent 就能访问;agent 写到容器 Share 里的东西,也会出现在这里。
290
+
291
+ ---
292
+
293
+ This folder is shared both ways between your computer and the CiCy container.
294
+
295
+ - On your computer: ~/Desktop/Share (this folder)
296
+ - Inside the container: /home/cicy/cicy-ai/Share
297
+
298
+ Drop files here for CiCy agents to read; files agents write to Share show up here too.
299
+ `;
300
+
301
+ function shareMountArg() {
302
+ try {
303
+ const winShare = path.join(os.homedir(), "Desktop", "Share");
304
+ fs.mkdirSync(winShare, { recursive: true });
305
+ const readme = path.join(winShare, "readme.md");
306
+ if (!fs.existsSync(readme)) { try { fs.writeFileSync(readme, SHARE_README); } catch {} }
307
+ // C:\Users\<user>\Desktop\Share → /mnt/c/Users/<user>/Desktop/Share (WSL view)
308
+ const wslShare = winShare.replace(/^([A-Za-z]):/, (_, d) => `/mnt/${d.toLowerCase()}`).replace(/\\/g, "/");
309
+ return `-v '${wslShare}':/home/cicy/cicy-ai/Share`;
310
+ } catch (e) { log.warn(`[wsl-docker] Share mount setup failed: ${e.message}`); return ""; }
311
+ }
312
+
277
313
  async function runContainer({ port = 8009, container = "cicy-code-docker", volume = "cicy-team-8009", env = {} } = {}) {
278
314
  // 每次容器"启动"(含已在跑被 adopt)都确保桌面快捷方式存在 —— 不存在就建,坏了就修。
279
315
  if (await probeHealth(port)) { ensureDesktopShortcut(volume, port).catch(() => {}); return { adopted: true }; }
@@ -283,7 +319,7 @@ async function runContainer({ port = 8009, container = "cicy-code-docker", volum
283
319
  .filter(([, v]) => v != null && v !== "")
284
320
  .map(([k, v]) => `-e ${k}='${String(v).replace(/'/g, "'\\''")}'`)
285
321
  .join(" ");
286
- const cmd = `docker run -d --name ${container} --restart unless-stopped -p 127.0.0.1:${port}:8008 -e CICY_PUBLIC=1 -v ${volume}:/home/cicy ${envArgs} ${IMAGE}`;
322
+ const cmd = `docker run -d --name ${container} --restart unless-stopped -p 127.0.0.1:${port}:8008 -e CICY_PUBLIC=1 -v ${volume}:/home/cicy ${shareMountArg()} ${envArgs} ${IMAGE}`;
287
323
  await wslRun(cmd, { timeout: 60000 });
288
324
  ensureDesktopShortcut(volume, port).catch(() => {});
289
325
  return { started: true };