|
|
|
@ -935,6 +935,9 @@ class Formatter:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Print a visual tree representation of a nested swarm structure using Rich Tree.
|
|
|
|
Print a visual tree representation of a nested swarm structure using Rich Tree.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: Rich tree visualization is only available for HierarchicalSwarm instances.
|
|
|
|
|
|
|
|
Other swarm types will not be visualized.
|
|
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
Args:
|
|
|
|
swarm (Any): The root swarm object to visualize.
|
|
|
|
swarm (Any): The root swarm object to visualize.
|
|
|
|
title (str): Title to display above the structure. Defaults to "Nested Structure:".
|
|
|
|
title (str): Title to display above the structure. Defaults to "Nested Structure:".
|
|
|
|
@ -942,6 +945,12 @@ class Formatter:
|
|
|
|
if not swarm:
|
|
|
|
if not swarm:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Only use Rich tree for HierarchicalSwarm instances
|
|
|
|
|
|
|
|
swarm_type_name = type(swarm).__name__
|
|
|
|
|
|
|
|
if swarm_type_name != "HierarchicalSwarm":
|
|
|
|
|
|
|
|
# For non-HierarchicalSwarm types, do nothing
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
# Always print title first using regular print to ensure visibility
|
|
|
|
# Always print title first using regular print to ensure visibility
|
|
|
|
print(f"\n{title}")
|
|
|
|
print(f"\n{title}")
|
|
|
|
|
|
|
|
|
|
|
|
|