<!-- Generated by scripts/gen-docs.ts from the TSDoc in src/. Do not edit by hand. -->

# `reporters/tree`

Source: [`src/reporters/tree.ts`](https://github.com/AI-for-dev/combo/blob/main/src/reporters/tree.ts)

A run as a tree: a delegated subagent drawn under the one that asked for it.

## `treeOrder`

*function*

```typescript
export function treeOrder(subagents: readonly SubagentSnapshot[]): SubagentSnapshot[] { /* … */ }
```

Launch order, rearranged so that a child follows the parent it hangs under.

The snapshot itself stays flat, and this is why: every existing reader keeps
working, and the one that wants a tree asks for it here. A delegating run
spawns its children after their parent anyway, so with a single root the
order barely moves; with two parents working at once it stops interleaving
three readers of one explorer with three of the other.

**Nothing is ever dropped.** A subagent whose parent is not in the list - a
reporter attached mid-run, a snapshot assembled by hand - is placed as a
root, and anything the walk could not reach is appended rather than lost. A
measurement that silently omits a subagent is worse than one that misplaces
it. How deep each one is drawn is its own `depth`, decided when it spawned.
