INNER CODE UNIT · TypeScript
sharedBotSessionKey
agentconnect-md/agentconnect · packages/activation-policy/src/index.ts:493
export function sharedBotSessionKey(msg: { channel: string; thread?: string | undefined }): string {
return `${msg.channel}/${msg.thread ?? msg.channel}`
}
/** Scope filter over attributed routes (exported for the relay's peer fan-out,
* which reads the same routes for its mention/auto join selection). */
export function sharedBotScopeMatches(r: SharedBotRoute, msg: SharedBotMessageFacts): boolean {
if (r.scope?.channel !== undefined && r.scope.channel !== msg.channel) return false
if (r.scope?.thread !== undefined && r.scope.thread !== msg.thread) return false
return true
}
function sharedBotKindMatches(r: SharedBotRoute, msg: SharedBotMessageFacts, botUserId: string | undefined): boolean {
switch (r.match.kind) {
case 'mention':
return botUserId !== undefined && msg.mentionedBots.includes(botUserId)
case 'dm':
return msg.isDm