openclaw-pincer 0.3.3 → 0.3.4
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/dist/src/channel.js +6 -0
- package/package.json +1 -1
- package/src/channel.ts +5 -0
package/dist/src/channel.js
CHANGED
|
@@ -247,6 +247,12 @@ function handleMessage(config, ctx, msg) {
|
|
|
247
247
|
const roomId = data.room_id ?? msg.room_id ?? "";
|
|
248
248
|
if (sender === config.agentId || !content)
|
|
249
249
|
return;
|
|
250
|
+
// Mention-only: only respond when @agentName or @all (prevents echo loops)
|
|
251
|
+
const agentName = config.agentName ?? "";
|
|
252
|
+
const isMentioned = agentName && content.includes(`@${agentName}`);
|
|
253
|
+
const isBroadcast = content.includes("@all") || content.includes("@所有人");
|
|
254
|
+
if (!isMentioned && !isBroadcast)
|
|
255
|
+
return;
|
|
250
256
|
console.log(`[openclaw-pincer] 💬 Room msg from ${sender.slice(0, 8)}: ${content.slice(0, 60)}`);
|
|
251
257
|
dispatchToAgent(config, ctx, runtime, sender, content, roomId);
|
|
252
258
|
return;
|
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -277,6 +277,11 @@ function handleMessage(config: PincerConfig, ctx: any, msg: any) {
|
|
|
277
277
|
const content = data.content ?? "";
|
|
278
278
|
const roomId = data.room_id ?? msg.room_id ?? "";
|
|
279
279
|
if (sender === config.agentId || !content) return;
|
|
280
|
+
// Mention-only: only respond when @agentName or @all (prevents echo loops)
|
|
281
|
+
const agentName = config.agentName ?? "";
|
|
282
|
+
const isMentioned = agentName && content.includes(`@${agentName}`);
|
|
283
|
+
const isBroadcast = content.includes("@all") || content.includes("@所有人");
|
|
284
|
+
if (!isMentioned && !isBroadcast) return;
|
|
280
285
|
console.log(`[openclaw-pincer] 💬 Room msg from ${sender.slice(0, 8)}: ${content.slice(0, 60)}`);
|
|
281
286
|
dispatchToAgent(config, ctx, runtime, sender, content, roomId);
|
|
282
287
|
return;
|