diff --git a/src/acp/commands.ts b/src/acp/commands.ts index 2892b2f02..6448a3374 100644 --- a/src/acp/commands.ts +++ b/src/acp/commands.ts @@ -21,7 +21,10 @@ export function getAvailableCommands(): AvailableCommand[] { { name: "dock-telegram", description: "Route replies to Telegram." }, { name: "dock-discord", description: "Route replies to Discord." }, { name: "dock-slack", description: "Route replies to Slack." }, - { name: "activation", description: "Set group activation (mention|always|replies|mention+replies|never)." }, + { + name: "activation", + description: "Set group activation (mention|always|replies|mention+replies|never).", + }, { name: "send", description: "Set send mode (on|off|inherit)." }, { name: "reset", description: "Reset the session (/new)." }, { name: "new", description: "Reset the session (/reset)." }, diff --git a/src/web/auto-reply/monitor/group-gating.ts b/src/web/auto-reply/monitor/group-gating.ts index 8b2c81ae2..44df28fe7 100644 --- a/src/web/auto-reply/monitor/group-gating.ts +++ b/src/web/auto-reply/monitor/group-gating.ts @@ -101,7 +101,7 @@ export function applyGroupGating(params: { sessionKey: params.sessionKey, conversationId: params.conversationId, }); - + // Check if this message is a reply to the bot const selfJid = params.msg.selfJid?.replace(/:\\d+/, ""); const replySenderJid = params.msg.replyToSenderJid?.replace(/:\\d+/, ""); @@ -113,17 +113,18 @@ export function applyGroupGating(params: { (selfJid && replySenderJid && selfJid === replySenderJid) || (selfE164 && replySenderE164 && selfE164 === replySenderE164), ); - + // Determine if we should process based on activation mode const shouldProcess = (() => { if (activation === "always") return true; if (activation === "never") return shouldBypassMention; if (activation === "replies") return isReplyToBot || shouldBypassMention; - if (activation === "mention+replies") return wasMentioned || isReplyToBot || shouldBypassMention; + if (activation === "mention+replies") + return wasMentioned || isReplyToBot || shouldBypassMention; // Default to "mention" mode return wasMentioned || shouldBypassMention; })(); - + const requireMention = activation !== "always" && activation !== "replies"; const mentionGate = resolveMentionGating({ requireMention, @@ -133,7 +134,7 @@ export function applyGroupGating(params: { shouldBypassMention, }); params.msg.wasMentioned = mentionGate.effectiveWasMentioned; - + if (!shouldProcess) { params.logVerbose( `Group message stored for context (no mention detected) in ${params.conversationId}: ${params.msg.body}`,