INNER CODE UNIT · TypeScript

servable

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

  const servable = new Set(rules.filter((r) => scopeMatches(r, msg)).map((r) => r.agentId))
  return participants.filter((id) => id !== exclude && servable.has(id))
}

/** Every agent whose `auto` rule (or, for a human, `decision` rule) covers the conversation — a set, not an arbitration. */
export function automaticAgents(msg: ActivationMessageFacts, rules: ActivationRule[], exclude?: string): string[] {
  return [
    ...new Set(
      rules
        .filter(
          (r) =>
            (r.match.kind === 'auto' || (r.match.kind === 'decision' && !msg.sender.isBot)) &&
            scopeMatches(r, msg) &&
            r.agentId !== exclude
        )
        .map((r) => r.agentId)
    )
  ]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…