claw-subagent-service 0.0.30 → 0.0.32
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
CHANGED
|
@@ -41,13 +41,20 @@ class MessageHandler {
|
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
// 优先从融云 mentionedInfo 提取被@用户列表(用户界面 @昵称,但融云底层存的是 userId)
|
|
45
|
+
let mentions = [];
|
|
46
|
+
if (msg.mentionedInfo && Array.isArray(msg.mentionedInfo.userIdList)) {
|
|
47
|
+
mentions = msg.mentionedInfo.userIdList;
|
|
48
|
+
if (mentions.length > 0) {
|
|
49
|
+
this.log?.info(`[MessageHandler] 融云 mentionedInfo: ${mentions.join(', ')}`);
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
// 兜底:从文本内容中正则匹配 @claw_xxx
|
|
54
|
+
if (mentions.length === 0) {
|
|
55
|
+
const textContent = typeof msg.content === 'string' ? msg.content : (msg.content?.content || '');
|
|
56
|
+
mentions = this.extractMentions(textContent);
|
|
57
|
+
}
|
|
51
58
|
|
|
52
59
|
if (mentions.length > 0) {
|
|
53
60
|
if (!mentions.includes(this.nodeId)) {
|
|
@@ -128,9 +128,11 @@ class RongCloudClient {
|
|
|
128
128
|
try {
|
|
129
129
|
const msgType = message.messageType;
|
|
130
130
|
let rawContent = message.content;
|
|
131
|
+
let mentionedInfo = null;
|
|
131
132
|
|
|
132
|
-
// 自定义消息 content
|
|
133
|
+
// 自定义消息 content 可能是对象,提取文本内容并保留 mentionedInfo
|
|
133
134
|
if (rawContent && typeof rawContent === 'object') {
|
|
135
|
+
mentionedInfo = rawContent.mentionedInfo || null;
|
|
134
136
|
rawContent = rawContent.content || rawContent.text || JSON.stringify(rawContent);
|
|
135
137
|
}
|
|
136
138
|
|
|
@@ -174,7 +176,8 @@ class RongCloudClient {
|
|
|
174
176
|
messageType: msgType || 'RC:TxtMsg',
|
|
175
177
|
isOffLineMessage: message.isOffLineMessage || false,
|
|
176
178
|
messageUId: message.messageUId || `local-${Date.now()}`,
|
|
177
|
-
sentTime: message.sentTime || Date.now()
|
|
179
|
+
sentTime: message.sentTime || Date.now(),
|
|
180
|
+
mentionedInfo
|
|
178
181
|
};
|
|
179
182
|
|
|
180
183
|
// 并行处理消息,不等待上一条完成(避免 openclaw 长耗时调用阻塞后续消息)
|