Files
Ignacy Łątka 4185bbbeac fix(describe): return a pretty-printed text tree, drop layout-noise containers
The JSON DescribeNode tree dwarfed the actual tap targets — on a Settings
homepage you'd scroll past ~10 nested LinearLayouts before hitting the
useful nodes, and the agent's tool-result became unreadable. iOS
masked this because the AX service pre-filters; Android exposed the
full uiautomator hierarchy.

Two changes in this commit:

1. `formatDescribeTreeAsText` renders the tree as a one-node-per-line
   outline: `Role [x,y wxh] label='…' id='…' value='…'`, 2-space indent
   per depth. Same shape as `debugger-component-tree`, easy for the
   agent to scan.
2. `filterDescribeTree` drops noise containers (LinearLayout, FrameLayout,
   AXGroup, etc.) and decorative leaves (StaticText / Image with no
   label). Useful descendants survive at the parent's level. Roles in
   INTERACTABLE_ROLES (Button, Switch, ScrollView, AXButton, …) survive
   even without a label since the agent can still tap them.

Contract: DescribeResult.tree changes type DescribeNode -> string. The
adapters (adaptAXDescribeToDescribeResult, parseUiAutomatorDump,
adaptNativeDescribeToDescribeResult) still produce DescribeNode internally;
only the tool boundary stringifies. existing describe-tool tests now assert
on rendered substrings; the AX/native/contract adapter tests are unchanged.
2026-05-05 14:51:43 +02:00
..