MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / widthByDepth

Function widthByDepth

ui-tui/src/lib/subagentTree.ts:101–119  ·  view source on GitHub ↗
(tree: readonly SubagentNode[])

Source from the content-addressed store, hash-verified

99 * Drives the inline sparkline (`▁▃▇▅`) and the status-bar HUD.
100 */
101export 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.

Callers 4

thinking.tsxFile · 0.85
SpawnHudFunction · 0.85
AgentsOverlayFunction · 0.85

Calls 1

walkFunction · 0.85

Tested by

no test coverage detected