@eyeclaw/eyeclaw 2.2.4 → 2.2.5
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/index.ts +9 -6
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -36,12 +36,15 @@ const eyeclawPlugin = {
|
|
|
36
36
|
|
|
37
37
|
// WebSocket 客户端(连接 Rails 接收消息)
|
|
38
38
|
if (config.sdkToken && config.botId && config.serverUrl) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
// 延迟启动 WebSocket,避免在插件加载/更新时阻塞
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
const wsClient = new EyeClawWebSocketClient(api, config)
|
|
42
|
+
wsClient.start()
|
|
43
|
+
logger.info('[EyeClaw] WebSocket client starting...')
|
|
44
|
+
|
|
45
|
+
// 存储客户端引用,防止被垃圾回收
|
|
46
|
+
;(global as any).__eyeclaw_ws = wsClient
|
|
47
|
+
}, 2000) // 延迟 2 秒启动
|
|
45
48
|
} else {
|
|
46
49
|
logger.warn('[EyeClaw] WebSocket not started: missing config (sdkToken, botId, serverUrl)')
|
|
47
50
|
}
|