// 新的 sendConnect 方法 - 严格按照协议文档 sendConnect(nonce = null) { const crypto = require('crypto'); const tempPublicKey = crypto.randomBytes(32).toString('hex'); const tempSignature = crypto.randomBytes(64).toString('hex'); const connectMessage = { type: 'req', id: this.nextId(), method: 'connect', params: { minProtocol: 3, maxProtocol: 3, client: { id: 'cli', version: '1.0.0', platform: process.platform, mode: 'operator' }, role: 'operator', scopes: ['operator.read', 'operator.write'], caps: [], commands: [], permissions: {}, auth: this.token ? { token: this.token } : {}, locale: 'zh-CN', userAgent: 'wecome-openclaw-client/1.0.0', device: { id: this.deviceId, publicKey: tempPublicKey, signature: tempSignature, signedAt: Date.now(), nonce: nonce || crypto.randomUUID() } } }; console.log('[OpenClaw] Sending connect request'); this.send(connectMessage); }