metheus-governance-mcp-cli 0.2.257 → 0.2.259
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/cli.mjs +14 -1
- package/lib/runner-trigger.mjs +11 -3
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -11825,11 +11825,24 @@ function resolveRunnerProjectUpRoutes({
|
|
|
11825
11825
|
server_bot_name: botName,
|
|
11826
11826
|
server_bot_id: botID,
|
|
11827
11827
|
});
|
|
11828
|
-
|
|
11828
|
+
const matched = ensureArray(config.routes)
|
|
11829
11829
|
.map((rawRoute) => normalizeRunnerRoute(rawRoute))
|
|
11830
11830
|
.filter((route) => route.enabled)
|
|
11831
11831
|
.filter((route) => configuredRunnerRouteMatchesInlineSelection(route, selectionRoute, selectionFlags, { telegramEntries }))
|
|
11832
11832
|
.filter((route) => !normalizedRoles.length || normalizedRoles.includes(normalizeBotRole(route.role)));
|
|
11833
|
+
if (normalizedRoles.length) {
|
|
11834
|
+
return matched;
|
|
11835
|
+
}
|
|
11836
|
+
const seenBotDestinations = new Map();
|
|
11837
|
+
return matched.filter((route) => {
|
|
11838
|
+
const botIdentity = String(route.serverBotID || route.botID || route.botName || route.serverBotName || "").trim().toLowerCase();
|
|
11839
|
+
const destIdentity = String(route.destinationID || route.destinationLabel || "").trim().toLowerCase();
|
|
11840
|
+
const dedupeKey = `${botIdentity}::${destIdentity}`;
|
|
11841
|
+
if (!dedupeKey || dedupeKey === "::") return true;
|
|
11842
|
+
if (seenBotDestinations.has(dedupeKey)) return false;
|
|
11843
|
+
seenBotDestinations.set(dedupeKey, true);
|
|
11844
|
+
return true;
|
|
11845
|
+
});
|
|
11833
11846
|
}
|
|
11834
11847
|
|
|
11835
11848
|
async function runRunnerProjectUp(flags) {
|
package/lib/runner-trigger.mjs
CHANGED
|
@@ -192,9 +192,17 @@ export function evaluateTelegramRunnerTrigger(record, route, bot) {
|
|
|
192
192
|
return { shouldRespond: false, reason: "bot replies are disabled by trigger_policy", trigger: "bot_reply_disabled", requiresDirectReply: false };
|
|
193
193
|
}
|
|
194
194
|
const mentionsBot = doesTelegramArchiveMentionBot(parsed, bot, route);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
if (mentionsBot) {
|
|
196
|
+
return { shouldRespond: true, reason: "bot reply is a candidate continuation message", trigger: "bot_reply_mention", requiresDirectReply: false };
|
|
197
|
+
}
|
|
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
|
+
const repliesToBot = isTelegramArchiveReplyingToBot(parsed, bot, route);
|
|
202
|
+
if (isOwnReply || repliesToBot) {
|
|
203
|
+
return { shouldRespond: true, reason: "bot reply is a candidate continuation message", trigger: "bot_reply", requiresDirectReply: false };
|
|
204
|
+
}
|
|
205
|
+
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 };
|
|
198
206
|
}
|
|
199
207
|
if (!isInboundArchiveKind(parsed.kind)) {
|
|
200
208
|
return { shouldRespond: false, reason: "comment is not an inbound archived message", trigger: "invalid", requiresDirectReply: false };
|