mirror of
https://github.com/software-mansion/argent.git
synced 2026-09-14 19:27:14 +08:00
4185bbbeac
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.