cicy-desktop 2.1.304 → 2.1.305

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.304",
3
+ "version": "2.1.305",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -844,11 +844,20 @@ async function runContainer({ port = 8008, container = "cicy-code-docker", volum
844
844
  // must then NOT open with a wrong/host token — that strands the user at login).
845
845
  // 原则:执行什么命令、输出什么、报什么错,全都要可见(onLog),且每一步可重试。
846
846
  // onLog({ status, message }) —— 上层把它接进 drawer。不传也安全(默认静默 + 写 log 文件)。
847
+ // 失败节流:WSL 卡死时每次 readContainerToken 都会起 wsl.exe 挂 8s+,多个调用方(标签恢复 /
848
+ // openTeam / 守护循环)每 10 秒来一次 → 僵死的 wsl.exe 越积越多。读不到就记一下,60 秒内直接返回 ""。
849
+ let _tokenFailAt = 0;
847
850
  async function readContainerToken(port = 8008, container = "cicy-code-docker", volume = "cicy-team-8008", { onLog } = {}) {
848
851
  const say = (status, message) => {
849
852
  try { (status === "error" ? log.warn : log.info)(`[readContainerToken] ${message}`); } catch (e) {}
850
853
  try { onLog && onLog({ status, message }); } catch (e) {}
851
854
  };
855
+ if (Date.now() - _tokenFailAt < 60000) return "";
856
+ const _r = await _readContainerTokenOnce(port, container, volume, say);
857
+ if (!_r) _tokenFailAt = Date.now();
858
+ return _r;
859
+ }
860
+ async function _readContainerTokenOnce(port, container, volume, say) {
852
861
  const volCmd = `cat /var/lib/docker/volumes/${volume}/_data/cicy-ai/global.json`;
853
862
  const execCmd = `docker exec ${container} cat /home/cicy/cicy-ai/global.json`;
854
863
  for (let attempt = 1; attempt <= 5; attempt++) {
@@ -122,3 +122,8 @@ test("a wedged WSL (status unknown) is auto-repaired, then auto-rebooted if stil
122
122
  const w = read("src/sidecar/wsl-docker.js");
123
123
  assert.match(w, /const stillHung = async \(\) => \(await lxssWedged\(\)\) \|\| \(await distroInstalled\(\)\) === null;/);
124
124
  });
125
+
126
+ test("readContainerToken throttles after a failure so a wedged WSL is not hammered", () => {
127
+ const w = read("src/sidecar/wsl-docker.js");
128
+ assert.match(w, /if \(Date\.now\(\) - _tokenFailAt < 60000\) return "";/);
129
+ });