INNER CODE UNIT · TypeScript

mentionedAgents

agentconnect-md/agentconnect · packages/activation-policy/src/index.ts:108

export function mentionedAgents(msg: ActivationMessageFacts, rules: ActivationRule[], exclude?: string): string[] {
  if (msg.mentionedBots.length === 0) return []
  const named = new Set<string>()
  for (const r of rules) {
    if (r.match.kind !== 'mention' || !scopeMatches(r, msg)) continue
    if (r.botUserId === '' || !msg.mentionedBots.includes(r.botUserId)) continue
    if (r.agentId !== exclude) named.add(r.agentId)
  }
  return [...named]
}

/** Agents this connection serves that are ALREADY in the thread, minus `exclude`. Scope
 *  (including the Off fence) is applied here so a participant in a silenced channel is
 *  not revived by conversation it can no longer take part in. */
export function participantAgents(
  msg: ActivationMessageFacts,
  rules: ActivationRule[],
  participants: readonly string[],

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…