@agent-wechat/wechat 0.8.4 → 0.8.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/dist/index.js +10 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5521,8 +5521,7 @@ import {
|
|
|
5521
5521
|
resolveSenderCommandAuthorization
|
|
5522
5522
|
} from "openclaw/plugin-sdk";
|
|
5523
5523
|
var INVISIBLE_TEXT_RE = /[\u200b-\u200f\u202a-\u202e\u2060-\u206f]/g;
|
|
5524
|
-
var
|
|
5525
|
-
var WECHAT_MENTION_TOKEN_RE = /^[@@][^\s\u2005]+$/u;
|
|
5524
|
+
var WECHAT_MENTION_START_RE = /^[@@]/u;
|
|
5526
5525
|
function unique(values) {
|
|
5527
5526
|
return Array.from(new Set(values));
|
|
5528
5527
|
}
|
|
@@ -5580,12 +5579,18 @@ function normalizeWeChatCommandBody(raw, params) {
|
|
|
5580
5579
|
if (commandStart < 0) {
|
|
5581
5580
|
return trimmed;
|
|
5582
5581
|
}
|
|
5583
|
-
const
|
|
5582
|
+
const rawPrefix = trimmed.slice(0, commandStart);
|
|
5583
|
+
const prefix = rawPrefix.trim();
|
|
5584
5584
|
if (!prefix) {
|
|
5585
5585
|
return trimmed.slice(commandStart).trimStart();
|
|
5586
5586
|
}
|
|
5587
|
-
const
|
|
5588
|
-
if (
|
|
5587
|
+
const hasHairSpace = rawPrefix.includes("\u2005") || trimmed[commandStart] === "\u2005";
|
|
5588
|
+
if (!hasHairSpace) {
|
|
5589
|
+
return trimmed;
|
|
5590
|
+
}
|
|
5591
|
+
const mentionRegion = rawPrefix + (trimmed[commandStart] === "\u2005" ? "\u2005" : "");
|
|
5592
|
+
const prefixTokens = mentionRegion.split(/\u2005+/).map((token) => token.trim()).filter(Boolean);
|
|
5593
|
+
if (prefixTokens.length > 0 && prefixTokens.every((token) => WECHAT_MENTION_START_RE.test(token))) {
|
|
5589
5594
|
return trimmed.slice(commandStart).trimStart();
|
|
5590
5595
|
}
|
|
5591
5596
|
return trimmed;
|