qt_prune_snapshot
Compute actual visibility from a saved Qt UI snapshot: remove fully occluded elements, mark partial visibility, and output a pruned tree to identify which element is on top before clicking.
Instructions
Occlusion-prune a saved snapshot.
snapshot_id is the value returned by the last qt_snapshot call of
this session. When to use: after a snapshot, when elements overlap
inside the same window and you need to know which one is really on
top / how much of a target is visible — e.g. before deciding which
element to click or whether a covered element matters.
Reads the saved snapshot JSON and computes what is actually visible:
elements fully covered by higher-z opaque elements are removed (their
still-visible descendants are reparented up), partially covered ones
get a visible_ratio field, fully hidden (opacity 0) elements are
dropped. Writes snapshot_<id>_pruned.json next to the original —
read the tree at the returned uri (same objIDs as the source
snapshot plus visible_ratio annotations). Result field
pruned = {"removed", "kept", "removed_ratio"}; window roots are
never removed.
The solver is a geometric heuristic (axis-aligned rects, per-window z-order with same-z tree order; widgets and QML rectangles/images occlude unless semi-transparent, transparent containers, text and custom QML components do not; a parent never occludes its own children). Occlusion is per top-level window on purpose: the agent must stay able to operate an app that the user has covered or minimised, so windows never occlude each other. The objIDs in the pruned file expire with the next snapshot/find refresh like any other id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | ||
| snapshot_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |