INNER CODE UNIT · TypeScript
hit
agentconnect-md/agentconnect · packages/activation-policy/src/index.ts:573
const hit = (target: SharedBotRouteTarget): SharedBotArbitration => ({ kind: 'target', target })
const none: SharedBotArbitration = { kind: 'none' }
// Own echoes never route. A third-party bot may enter only through an explicit
// mention, and only on a platform whose manifest admits bot senders at all
// (§5 botSenderRouting — fail-closed for unknown ids); AgentConnect-managed app
// messages are removed by the manager using the collaboration snapshot before
// forwarding.
if (a.botUserId !== undefined && msg.sender.id === a.botUserId && verifiedAgentAuthor === undefined) return none
const explicitlyMentioned = a.botUserId !== undefined && msg.mentionedBots.includes(a.botUserId)
if (
msg.sender.isBot &&
verifiedAgentAuthor === undefined &&
(!manifestFor(msg.platform).botSenderRouting || !explicitlyMentioned)
) {
return none
}
// A channel switched Off resolves to no target at all — ahead of every rung, so
// neither an @-mention nor an existing thread binding can reach into it.