@eyeclaw/eyeclaw 1.0.1 → 1.0.2
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 +21 -3
- package/package.json +1 -1
- package/src/client.ts +7 -12
package/index.ts
CHANGED
|
@@ -21,23 +21,41 @@ const plugin = {
|
|
|
21
21
|
const logger = runtime.logging.getChildLogger({ plugin: 'eyeclaw' })
|
|
22
22
|
const config = runtime.config as any
|
|
23
23
|
|
|
24
|
+
// Debug: log entire config structure
|
|
25
|
+
logger.info('🔍 Full config:', JSON.stringify(config, null, 2))
|
|
26
|
+
logger.info('🔍 Channels config:', JSON.stringify(config?.channels, null, 2))
|
|
27
|
+
|
|
24
28
|
// Get EyeClaw config from channels.eyeclaw
|
|
25
29
|
const eyeclawConfig: PluginConfig = config?.channels?.eyeclaw || {}
|
|
26
30
|
|
|
31
|
+
// Debug: log eyeclaw config
|
|
32
|
+
logger.info('🔍 EyeClaw config:', JSON.stringify(eyeclawConfig, null, 2))
|
|
33
|
+
logger.info('🔍 botId type:', typeof eyeclawConfig.botId)
|
|
34
|
+
logger.info('🔍 botId value:', eyeclawConfig.botId)
|
|
35
|
+
logger.info('🔍 sdkToken type:', typeof eyeclawConfig.sdkToken)
|
|
36
|
+
logger.info('🔍 sdkToken exists:', !!eyeclawConfig.sdkToken)
|
|
37
|
+
|
|
27
38
|
// Check if enabled
|
|
28
39
|
if (eyeclawConfig.enabled === false) {
|
|
29
40
|
logger.info('Plugin disabled in config')
|
|
30
41
|
return
|
|
31
42
|
}
|
|
32
43
|
|
|
33
|
-
// Validate required fields
|
|
34
|
-
if (!eyeclawConfig.botId
|
|
35
|
-
logger.warn('botId
|
|
44
|
+
// Validate required fields with detailed logging
|
|
45
|
+
if (!eyeclawConfig.botId) {
|
|
46
|
+
logger.warn('❌ botId is missing or falsy:', eyeclawConfig.botId)
|
|
36
47
|
logger.warn('Configure with: openclaw config set channels.eyeclaw.botId "YOUR_BOT_ID"')
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!eyeclawConfig.sdkToken) {
|
|
52
|
+
logger.warn('❌ sdkToken is missing or falsy')
|
|
37
53
|
logger.warn('Configure with: openclaw config set channels.eyeclaw.sdkToken "YOUR_SDK_TOKEN"')
|
|
38
54
|
return
|
|
39
55
|
}
|
|
40
56
|
|
|
57
|
+
logger.info('✅ Config validation passed')
|
|
58
|
+
|
|
41
59
|
// Convert botId to string (OpenClaw may auto-convert "1" to number 1)
|
|
42
60
|
eyeclawConfig.botId = String(eyeclawConfig.botId)
|
|
43
61
|
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -33,7 +33,7 @@ export class EyeClawClient {
|
|
|
33
33
|
this.ws.on('error', (error) => this.handleError(error))
|
|
34
34
|
this.ws.on('close', () => this.handleClose())
|
|
35
35
|
} catch (error) {
|
|
36
|
-
this.logger.error(
|
|
36
|
+
this.logger.error(`Failed to create WebSocket connection: ${error}`)
|
|
37
37
|
this.scheduleReconnect()
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -56,7 +56,7 @@ export class EyeClawClient {
|
|
|
56
56
|
private handleMessage(data: WebSocket.Data): void {
|
|
57
57
|
try {
|
|
58
58
|
const message = JSON.parse(data.toString())
|
|
59
|
-
this.logger.debug(
|
|
59
|
+
this.logger.debug(`Received message: ${JSON.stringify(message)}`)
|
|
60
60
|
|
|
61
61
|
// ActionCable protocol messages
|
|
62
62
|
if (message.type === 'ping') {
|
|
@@ -80,7 +80,7 @@ export class EyeClawClient {
|
|
|
80
80
|
this.handleChannelMessage(message.message)
|
|
81
81
|
}
|
|
82
82
|
} catch (error) {
|
|
83
|
-
this.logger.error(
|
|
83
|
+
this.logger.error(`Failed to parse message: ${error}`)
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -102,7 +102,7 @@ export class EyeClawClient {
|
|
|
102
102
|
break
|
|
103
103
|
|
|
104
104
|
case 'command_received':
|
|
105
|
-
this.logger.info(
|
|
105
|
+
this.logger.info(`Command received by server: ${message.command}`)
|
|
106
106
|
break
|
|
107
107
|
|
|
108
108
|
case 'log':
|
|
@@ -110,21 +110,16 @@ export class EyeClawClient {
|
|
|
110
110
|
break
|
|
111
111
|
|
|
112
112
|
default:
|
|
113
|
-
this.logger.warn(
|
|
113
|
+
this.logger.warn(`Unknown message type: ${type}`)
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
private handleStatusResponse(status: BotStatus): void {
|
|
118
|
-
this.logger.info(
|
|
119
|
-
online: status.online,
|
|
120
|
-
status: status.status,
|
|
121
|
-
sessions: status.active_sessions,
|
|
122
|
-
uptime: `${Math.floor(status.uptime / 60)}m`,
|
|
123
|
-
})
|
|
118
|
+
this.logger.info(`Bot status: online=${status.online}, status=${status.status}, sessions=${status.active_sessions}, uptime=${Math.floor(status.uptime / 60)}m`)
|
|
124
119
|
}
|
|
125
120
|
|
|
126
121
|
private handleError(error: Error): void {
|
|
127
|
-
this.logger.error(
|
|
122
|
+
this.logger.error(`WebSocket error: ${error.message}`)
|
|
128
123
|
}
|
|
129
124
|
|
|
130
125
|
private handleClose(): void {
|