@iamsamyiok/agents-chat 3.27.0 → 3.29.0

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.
@@ -1036,7 +1036,7 @@ function renderUpdateInfo(data){
1036
1036
  +' <button id="updateCopy">复制升级命令</button>';
1037
1037
  document.body.prepend(bar);
1038
1038
  document.body.style.paddingTop='34px';
1039
- $('#updateCopy').onclick=()=>copyText(data.updateCommand||('npm install -g @iamsamyiok/agents-chat@latest'));
1039
+ $('#updateCopy').onclick=()=>copyText(data.updateCommand||('npm install -g agents-chat-cli@latest'));
1040
1040
  }
1041
1041
  $('#trashEmpty').onclick=async()=>{ if(!confirm('确认清空垃圾桶?所有快照及其过程日志将被永久删除,不可恢复。'))return; const r=await post('/api/cards/trash/empty'); toast('已清空 '+r.cleared+' 项'); await loadCards(); };
1042
1042
 
@@ -3271,7 +3271,7 @@ function renderUpdateInfo(health) {
3271
3271
  bar.innerHTML = `📦 发现新版本 <b>v${esc(health.latestVersion)}</b>(当前 v${esc(health.version)}):终端运行 <code>agents-chat update</code> 一键升级,或执行 <code>${esc(health.updateCommand)}</code> <button id="updateCopy" style="border:1px solid #d8b94a;background:#fff;border-radius:5px;padding:2px 10px;font-size:12px;cursor:pointer;color:#614700">复制升级命令</button>`;
3272
3272
  document.body.prepend(bar);
3273
3273
  document.body.style.paddingTop = '34px';
3274
- document.getElementById('updateCopy').onclick = () => copyText(health.updateCommand || 'npm install -g @iamsamyiok/agents-chat@latest');
3274
+ document.getElementById('updateCopy').onclick = () => copyText(health.updateCommand || 'npm install -g agents-chat-cli@latest');
3275
3275
  }
3276
3276
 
3277
3277
  function openHelp() {
package/app/server.js CHANGED
@@ -8,6 +8,27 @@ const path = require('path');
8
8
  const url = require('url');
9
9
  const { spawn } = require('child_process');
10
10
 
11
+ // 单文件 exe 无控制台(--windows-hide-console)时 stdout 可能不可写:
12
+ // 把 console.* 重定向到数据目录 agents-chat.log(>2MB 滚动到 .1),出错有迹可循。
13
+ // 必须在任何 console 调用前执行;仅 standalone 形态且写入探测失败时启用。
14
+ (function setupHeadlessLogging() {
15
+ if (process.env.AGENTS_CHAT_STANDALONE !== '1') return;
16
+ let writable = true;
17
+ try { if (!process.stdout || typeof process.stdout.write !== 'function') writable = false; else process.stdout.write(''); }
18
+ catch { writable = false; }
19
+ if (writable) return;
20
+ try {
21
+ const dir = process.env.AGENTS_CHAT_DATA || path.join(path.dirname(process.execPath), '.data');
22
+ fs.mkdirSync(dir, { recursive: true });
23
+ const logPath = path.join(dir, 'agents-chat.log');
24
+ try { if (fs.statSync(logPath).size > 2 * 1024 * 1024) fs.renameSync(logPath, logPath + '.1'); } catch { /* 新文件 */ }
25
+ const stream = fs.createWriteStream(logPath, { flags: 'a' });
26
+ const fmt = (args) => args.map(a => typeof a === 'string' ? a : (() => { try { return JSON.stringify(a); } catch { return String(a); } })()).join(' ') + '\n';
27
+ console.log = (...a) => { try { stream.write(fmt(a)); } catch { /* ignore */ } };
28
+ console.warn = console.error = console.log;
29
+ } catch { /* 日志系统自身失败:静默,服务照常 */ }
30
+ })();
31
+
11
32
  // 首先加载 .env(根目录,行为开关配置)
12
33
  const { loadEnv } = require('./lib/env');
13
34
  const ROOT_DIR = path.join(__dirname, '..');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamsamyiok/agents-chat",
3
- "version": "3.27.0",
3
+ "version": "3.29.0",
4
4
  "description": "多智能体群聊工具 - 支持 OpenCode/Claude Code/Codex/pi 内核,微信风格聊天界面",
5
5
  "main": "lib/start.js",
6
6
  "bin": {
@@ -37,4 +37,4 @@
37
37
  "test": "node --test \"test/*.test.js\"",
38
38
  "build:exe": "node scripts/build-exe.js"
39
39
  }
40
- }
40
+ }