INNER CODE UNIT · TypeScript

selectTurnTargets

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

export function selectTurnTargets(
  roster: readonly string[],
  options: { mentions?: readonly string[]; requestedTargets?: readonly string[] } = {}
): { valid: string[]; invalid: string[] } {
  const chosen = options.requestedTargets?.length
    ? options.requestedTargets
    : options.mentions?.length
      ? options.mentions
      : roster
  const members = new Set(roster)
  return {
    valid: chosen.filter((agentId) => members.has(agentId)),
    invalid: chosen.filter((agentId) => !members.has(agentId))
  }
}

/** The author facts of a committed webchat post — a structural subset of the
 *  wire `WebchatPost['author']`, so callers pass it directly. */

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…