@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.
- package/dist/channel-server.js +12 -10
- package/package.json +1 -1
package/dist/channel-server.js
CHANGED
|
@@ -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
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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;
|