import requests, json

r = requests.get('http://127.0.0.1:8765/cache', timeout=10)
rows = r.json()['rows']
print(f"Total nodes: {len(rows)}")
for row in rows:
    indent = '  ' * row.get('depth', 0)
    node_id = row['id']
    role = row.get('role', '?')
    name = row.get('name', '')
    children = row.get('children_count', 0)
    bounds = row.get('bounds', {})
    b = f"({bounds.get('x')},{bounds.get('y')},{bounds.get('width')},{bounds.get('height')})" if bounds else "?"
    print(f"{indent}[{node_id:3}] role={role:<22} name={name!r:<30} children={children} bounds={b}")
