@largezhou/ddingtalk 1.4.1 → 1.4.3
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 +3 -3
- package/src/monitor.ts +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@largezhou/ddingtalk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "OpenClaw DingTalk (钉钉) channel plugin",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^20.10.0",
|
|
37
37
|
"dotenv": "^17.3.1",
|
|
38
|
-
"openclaw": "
|
|
38
|
+
"openclaw": "<=2026.3.13",
|
|
39
39
|
"tsx": "^4.6.0",
|
|
40
40
|
"typescript": "^5.3.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": "
|
|
43
|
+
"openclaw": "<=2026.3.13"
|
|
44
44
|
},
|
|
45
45
|
"openclaw": {
|
|
46
46
|
"extensions": [
|
package/src/monitor.ts
CHANGED
|
@@ -703,6 +703,25 @@ export function monitorDingTalkProvider(options: MonitorOptions): MonitorResult
|
|
|
703
703
|
keepAlive: true,
|
|
704
704
|
});
|
|
705
705
|
|
|
706
|
+
// ============================================================================
|
|
707
|
+
// 🔧 修复 dingtalk-stream SDK 的 keepAlive 重连 bug
|
|
708
|
+
// SDK 的 close 事件处理中没有 clearInterval(heartbeatIntervallId),
|
|
709
|
+
// 导致重连时旧的 heartbeat interval 还在运行,会 terminate 正在建立的新连接。
|
|
710
|
+
// 这里通过 monkey-patch _connect,在每次连接前先清理旧 interval。
|
|
711
|
+
// ============================================================================
|
|
712
|
+
const originalInternalConnect = (client as any)._connect.bind(client);
|
|
713
|
+
(client as any)._connect = function (this: any) {
|
|
714
|
+
// 清理上一轮的 heartbeat interval,防止它干扰新连接
|
|
715
|
+
if (this.heartbeatIntervallId !== undefined) {
|
|
716
|
+
clearInterval(this.heartbeatIntervallId);
|
|
717
|
+
this.heartbeatIntervallId = undefined;
|
|
718
|
+
logger.info('[PATCH] Cleared stale heartbeat interval before reconnect');
|
|
719
|
+
}
|
|
720
|
+
// 重置心跳状态,给新连接一个干净的起点
|
|
721
|
+
this.isAlive = false;
|
|
722
|
+
return originalInternalConnect();
|
|
723
|
+
};
|
|
724
|
+
|
|
706
725
|
// ============================================================================
|
|
707
726
|
// 群聊策略与 Mention 门控
|
|
708
727
|
// ============================================================================
|