metheus-governance-mcp-cli 0.2.259 → 0.2.260
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/lib/runner-trigger.mjs +7 -4
- package/package.json +1 -1
package/lib/runner-trigger.mjs
CHANGED
|
@@ -191,15 +191,18 @@ export function evaluateTelegramRunnerTrigger(record, route, bot) {
|
|
|
191
191
|
if (!route?.triggerPolicy?.replyToBotMessages) {
|
|
192
192
|
return { shouldRespond: false, reason: "bot replies are disabled by trigger_policy", trigger: "bot_reply_disabled", requiresDirectReply: false };
|
|
193
193
|
}
|
|
194
|
+
const replySenderUsername = normalizeTelegramMentionUsername(parsed.username || parsed.botUsername || parsed.botName || parsed.sender);
|
|
195
|
+
const currentBotCandidates = buildTelegramBotUsernameCandidates(bot, route);
|
|
196
|
+
const isOwnReply = replySenderUsername && currentBotCandidates.includes(replySenderUsername);
|
|
197
|
+
if (isOwnReply) {
|
|
198
|
+
return { shouldRespond: false, reason: "bot reply is from this bot (self-loop prevention)", trigger: "bot_reply_self", requiresDirectReply: false };
|
|
199
|
+
}
|
|
194
200
|
const mentionsBot = doesTelegramArchiveMentionBot(parsed, bot, route);
|
|
195
201
|
if (mentionsBot) {
|
|
196
202
|
return { shouldRespond: true, reason: "bot reply is a candidate continuation message", trigger: "bot_reply_mention", requiresDirectReply: false };
|
|
197
203
|
}
|
|
198
|
-
const replySenderUsername = normalizeTelegramMentionUsername(parsed.username || parsed.botUsername || parsed.botName || parsed.sender);
|
|
199
|
-
const currentBotCandidates = buildTelegramBotUsernameCandidates(bot, route);
|
|
200
|
-
const isOwnReply = replySenderUsername && currentBotCandidates.includes(replySenderUsername);
|
|
201
204
|
const repliesToBot = isTelegramArchiveReplyingToBot(parsed, bot, route);
|
|
202
|
-
if (
|
|
205
|
+
if (repliesToBot) {
|
|
203
206
|
return { shouldRespond: true, reason: "bot reply is a candidate continuation message", trigger: "bot_reply", requiresDirectReply: false };
|
|
204
207
|
}
|
|
205
208
|
return { shouldRespond: false, reason: "bot reply is from a different bot and does not mention or reply to this bot", trigger: "bot_reply_foreign", requiresDirectReply: false };
|