INNER CODE UNIT · TypeScript
kindCandidates
agentconnect-md/agentconnect · packages/activation-policy/src/index.ts:176
const kindCandidates = scopeCandidates.filter((r) => kindMatches(r, msg))
// 1. explicit @bot mention — across layers; overrides thread affinity (§8.3).
const mention = kindCandidates.find((r) => r.match.kind === 'mention')
if (mention && verifiedAgentAuthor === undefined && (!msg.sender.isBot || msg.platform === 'slack')) {
return pickRule(mention, 'mention')
}
// Only a VERIFIED AgentConnect author continues into the implicit rungs (§2.3); every other bot
// stops here rather than falling through to dm/thread/keyword/auto.
if (msg.sender.isBot && verifiedAgentAuthor === undefined) return null
// An unmatched channel mention belongs to someone else, so thread affinity must not claim it —
// otherwise every daemon believes its own agent owns the thread. A 1:1 DM is already addressed
// to this bot (group DMs normalize isDm=false and stay mention-gated). A verified author is
// exempt: a `<@…>` aimed at anyone must not silence its peers.
if (!msg.isDm && msg.mentionedBots.length > 0 && verifiedAgentAuthor === undefined) return null
// 2. thread affinity (§8.2 step 2 — highest after explicit @; bypasses kind filter).
if (msg.thread) {