Class AgentHierarchyMapper

java.lang.Object
com.tnsai.agents.hierarchy.AgentHierarchyMapper

public final class AgentHierarchyMapper extends Object
Maps an Agent hierarchy tree to a flat list of node maps suitable for AgentHierarchyEvent.

This class decouples the event representation from the Agent class, keeping the events package free of agent dependencies.

  • Method Details

    • toNodeList

      public static List<Map<String,Object>> toNodeList(Agent rootAgent)
      Converts an Agent hierarchy starting from the given root into a flat list of node maps.

      Each node map contains:

      • id - Agent ID
      • name - Agent name
      • role - First role name or "No Role"
      • status - Agent health state name
      • children - List of child agent IDs
      Parameters:
      rootAgent - the root agent of the hierarchy
      Returns:
      flat list of agent node maps