@agent-wechat/wechat 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5768,7 +5768,8 @@ ${replyBlock}` : replyBlock;
5768
5768
  senderId,
5769
5769
  isGroup,
5770
5770
  timestamp,
5771
- hasMedia
5771
+ hasMedia,
5772
+ isMentioned: isGroup && msg.isMentioned === true
5772
5773
  };
5773
5774
  }
5774
5775
  function buildSegments(processed) {
@@ -5800,6 +5801,18 @@ async function dispatchSegment(segment, client, chatId, chat, liveAccount, cfg,
5800
5801
  log?.info?.(
5801
5802
  `[wechat:${liveAccount.accountId}] Dispatching segment: ${segment.length} msg(s), last=${msg.localId}${mediaPath ? ` media=${mediaPath}` : ""}`
5802
5803
  );
5804
+ if (isGroup) {
5805
+ const wechatCfg = cfg?.channels?.wechat;
5806
+ const groupEntry = wechatCfg?.groups?.[chatId];
5807
+ const defaultEntry = wechatCfg?.groups?.["*"];
5808
+ const requireMention = groupEntry?.requireMention ?? defaultEntry?.requireMention ?? true;
5809
+ if (requireMention && !lastMsg.isMentioned) {
5810
+ log?.info?.(
5811
+ `[wechat:${liveAccount.accountId}] Skipping group message (mention required, not mentioned) in ${chatId}`
5812
+ );
5813
+ return;
5814
+ }
5815
+ }
5803
5816
  try {
5804
5817
  const route = core.channel.routing.resolveAgentRoute({
5805
5818
  cfg,
@@ -5886,6 +5899,7 @@ async function dispatchSegment(segment, client, chatId, chat, liveAccount, cfg,
5886
5899
  Provider: "wechat",
5887
5900
  Surface: "wechat",
5888
5901
  MessageSid: `wechat:${chatId}:${msg.localId}`,
5902
+ WasMentioned: isGroup ? lastMsg.isMentioned : void 0,
5889
5903
  OriginatingChannel: "wechat",
5890
5904
  OriginatingTo: `wechat:${chatId}`,
5891
5905
  ...mediaPath ? { MediaPath: mediaPath, MediaUrl: mediaPath, MediaType: mediaMime } : {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-wechat/wechat",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",