@eyeclaw/eyeclaw 2.2.3 → 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 CHANGED
@@ -36,12 +36,15 @@ const eyeclawPlugin = {
36
36
 
37
37
  // WebSocket 客户端(连接 Rails 接收消息)
38
38
  if (config.sdkToken && config.botId && config.serverUrl) {
39
- const wsClient = new EyeClawWebSocketClient(api, config)
40
- wsClient.start()
41
- logger.info('[EyeClaw] WebSocket client starting...')
42
-
43
- // 存储客户端引用,防止被垃圾回收
44
- ;(global as any).__eyeclaw_ws = wsClient
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eyeclaw/eyeclaw",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "EyeClaw plugin for OpenClaw - HTTP SSE streaming + WebSocket client",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -190,6 +190,9 @@ export class EyeClawWebSocketClient {
190
190
  const headers: Record<string, string> = { 'Content-Type': 'application/json' }
191
191
  if (gatewayToken) headers['Authorization'] = `Bearer ${gatewayToken}`
192
192
 
193
+ this.api.logger.info(`[EyeClaw] Calling OpenClaw API: ${openclawUrl}`)
194
+ this.api.logger.info(`[EyeClaw] Gateway port: ${gatewayPort}, Has token: ${!!gatewayToken}`)
195
+
193
196
  try {
194
197
  const response = await fetch(openclawUrl, {
195
198
  method: 'POST',
@@ -197,8 +200,11 @@ export class EyeClawWebSocketClient {
197
200
  body: JSON.stringify(openclawBody),
198
201
  })
199
202
 
203
+ this.api.logger.info(`[EyeClaw] OpenClaw response status: ${response.status}`)
204
+
200
205
  if (!response.ok) {
201
206
  const errorText = await response.text()
207
+ this.api.logger.error(`[EyeClaw] OpenClaw API error details: status=${response.status}, body=${errorText}`)
202
208
  throw new Error(`OpenClaw API error: ${response.status} - ${errorText}`)
203
209
  }
204
210