(tree: readonly SubagentNode[])
| 99 | * Drives the inline sparkline (`▁▃▇▅`) and the status-bar HUD. |
| 100 | */ |
| 101 | export function widthByDepth(tree: readonly SubagentNode[]): number[] { |
| 102 | const widths: number[] = [] |
| 103 | |
| 104 | const walk = (nodes: readonly SubagentNode[], depth: number) => { |
| 105 | if (!nodes.length) { |
| 106 | return |
| 107 | } |
| 108 | |
| 109 | widths[depth] = (widths[depth] ?? 0) + nodes.length |
| 110 | |
| 111 | for (const node of nodes) { |
| 112 | walk(node.children, depth + 1) |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | walk(tree, 0) |
| 117 | |
| 118 | return widths |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Flat totals across the full tree — feeds the summary chip header. |
no test coverage detected