@vrs-soft/wecom-aibot-mcp 3.4.7 → 3.4.8

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.
@@ -391,16 +391,18 @@ function connectSSE(ccId) {
391
391
  logChannel(`SSE 连接失败(${res.status}),${delay / 1000} 秒后重连`, { ccId });
392
392
  setTimeout(async () => {
393
393
  httpSessionId = null; // 重置 session,防止使用 server 重启前的旧 session
394
- if (ccId) {
395
- // 重新调 enter_headless_mode 恢复 server 端 ccId 注册
396
- await forwardToHttpMcp('enter_headless_mode', {
397
- cc_id: ccId,
398
- robot_id: sseRobotId,
399
- mode: 'channel',
400
- project_dir: sseProjectDir || process.cwd(),
401
- }).catch((e) => logChannel('重注册 ccId 失败', { error: String(e) }));
402
- }
403
- connectSSE(ccId);
394
+ // v3.4.8: SSE 断线自动重连时也走 auth 派生(不用 module-level 缓存的 ccId / sseProjectDir)
395
+ // 避免首次 enter 用了错值时,SSE 重连永远发错值给 daemon
396
+ const authProjectDir = process.cwd();
397
+ const authCcId = path.basename(authProjectDir);
398
+ // 重新调 enter_headless_mode 恢复 server 端 ccId 注册(用 auth 值)
399
+ await forwardToHttpMcp('enter_headless_mode', {
400
+ cc_id: authCcId,
401
+ robot_id: sseRobotId,
402
+ mode: 'channel',
403
+ project_dir: authProjectDir,
404
+ }).catch((e) => logChannel('重注册 ccId 失败', { error: String(e) }));
405
+ connectSSE(authCcId); // 用 auth 值,不用缓存的 ccId
404
406
  }, delay);
405
407
  }
406
408
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrs-soft/wecom-aibot-mcp",
3
- "version": "3.4.7",
3
+ "version": "3.4.8",
4
4
  "description": "企业微信智能机器人 MCP 客户端 - 连接 wecom-aibot-server daemon",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",