mobridge-mcp 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: mobridge-surfaces
3
+ description: Use when a screen has no usable nodes - Flutter, Compose, WebView, canvas, games, unlabeled icons or ads
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # MoBridge UI surfaces
8
+
9
+ Accessibility only sees what the app exposes. Different UI toolkits expose different amounts. Pick the playbook by
10
+ what `observe` returned, not by guessing the framework.
11
+
12
+ ## When to use
13
+
14
+ - `observe` returns few or no nodes, or only a single container.
15
+ - A query gives `NODE_NOT_FOUND` for something clearly visible.
16
+ - The result says `NEEDS_VISION`, or `treeEvidence.state` stays `UNCHANGED` after a visible change.
17
+ - The target is an icon without a label, a game, a canvas, a video, or an ad.
18
+
19
+ ## Workflow
20
+
21
+ 1. Run `mobridge screen observe --actionable` and classify the surface with the table below.
22
+ 2. Semantic surface: act by query (apply `mobridge-core`). No usable nodes: capture, choose a point, `act at`.
23
+ 3. Verify with a new read; vision taps are never verified by the tree.
24
+ 4. After two misses on the same point stop and change approach (apply `mobridge-debugging`).
25
+
26
+ ## Pick the playbook
27
+
28
+ | What you see in `observe` | Surface | Playbook |
29
+ |---|---|---|
30
+ | Nodes with `text`, `contentDescription`, `resourceId` | Native views / Compose with semantics | Query by text, label or resource id |
31
+ | Compose, labels present but no `resourceId` | Compose | Query by text or label; scope with `--within` |
32
+ | Flutter: nodes with labels only, ids absent | Flutter | Query by label; no resource ids exist |
33
+ | One big `WebView` node, little inside | WebView | Use `inspect`, scroll the WebView, fall back to capture |
34
+ | One node covering the screen | Canvas / game / custom view | Capture, then `act at` |
35
+ | Icon buttons without text | Unlabeled icons | `capture --regions`, choose a region, `act at` |
36
+ | Ad or video overlay | Ad / media | Capture, `act at` with `VISUAL_DYNAMIC` |
37
+
38
+ ## Semantic surfaces (native, Compose, Flutter)
39
+
40
+ ```bash
41
+ mobridge screen observe --actionable
42
+ mobridge screen act click --text "Continue" --verify auto
43
+ mobridge screen act click --resource-id "com.example:id/save" --verify auto
44
+ ```
45
+
46
+ - Prefer the most specific stable selector: resource id, then label, then text. Text changes with language.
47
+ - Lists: scope with `--within` or scroll first. A match inside a nested scroll host needs `axis`
48
+ (`VERTICAL` / `HORIZONTAL`) or it fails with `AMBIGUOUS_MATCH`.
49
+ - Flutter and Compose may rebuild nodes each frame. Re-resolve from the original query, never from an old NodeRef.
50
+ - If the tree stays `UNCHANGED` after a visible change, the surface is not in the tree: switch to the vision path.
51
+
52
+ ## WebView
53
+
54
+ - WebView content may be absent from the Accessibility tree. `treeEvidence` can say `UNCHANGED` even when the page
55
+ changed; do not read that as failure.
56
+ - Scroll by gesture on the WebView node, then capture to read the result.
57
+ - Use a short wait after navigation, then capture; do not trust a tree-based verify alone.
58
+
59
+ ```bash
60
+ mobridge screen observe
61
+ mobridge screen capture
62
+ ```
63
+
64
+ ## Vision path (canvas, games, unlabeled icons, ads)
65
+
66
+ Rule: never guess coordinates. Every `act at` uses a point read from a fresh capture.
67
+
68
+ 1. Capture. The image stays in daemon memory (about 30 s) under a `captureId`.
69
+ 2. For an icon without a node, list neutral regions:
70
+
71
+ ```bash
72
+ mobridge screen capture --regions
73
+ ```
74
+
75
+ 3. For a known colour: `mobridge screen capture --color "#FF0000"` returns matches. Only exactly one match can be
76
+ tapped through a pipe.
77
+ 4. Look at the image, choose the point, act on it:
78
+
79
+ ```bash
80
+ mobridge screen act at --capture <captureId> --x 540 --y 1200
81
+ ```
82
+
83
+ 5. Verify with a new capture or `observe`. An old `captureId` fails with `STALE_CAPTURE`; capture again.
84
+
85
+ Small text or icons: `mobridge screen capture --mode detail --roi x,y,w,h` returns native pixels for one region.
86
+ Dynamic UI (video, ads, animation): the daemon applies `VISUAL_DYNAMIC` so a changing screen does not invalidate your
87
+ point; keep the delay between capture and tap short.
88
+
89
+ ## Ads
90
+
91
+ There is no ad command. An ad is just a surface: capture, find the close control (often a small corner icon),
92
+ choose its point from the image, `act at`, then observe. If the ad is a full-screen interstitial in the app's own
93
+ Activity, `app.open` may report the wrong screen; observe before continuing. Never loop on taps: after two misses stop
94
+ and ask the person.
95
+
96
+ ## Blocked pixels
97
+
98
+ `CAPTURE_BLOCKED_SECURE_WINDOW` means the app marks the window secure (banking, password fields, DRM). No capture is
99
+ possible and none should be attempted by another route. Use semantic reads only, or ask the person to act.
100
+
101
+ ## Verification
102
+
103
+ - After a vision tap, always verify with a new read; vision taps are `unverified` by design.
104
+ - Keep your own count: if the same point failed twice, change approach instead of retrying.
105
+
106
+ References: `references/tree-evidence.md`.
@@ -0,0 +1,26 @@
1
+ # Tree evidence
2
+
3
+ `observation.treeEvidence.state` compares the Accessibility tree before and after an action.
4
+
5
+ | State | Meaning | What to do |
6
+ |---|---|---|
7
+ | `CHANGED` | The tree differs | Normal for navigation and edits |
8
+ | `UNCHANGED` | The tree is the same | On a native screen the action probably did nothing. On WebView, canvas or games it proves nothing: capture. |
9
+ | `UNKNOWN` | Not comparable | Observe, then decide |
10
+
11
+ `screenChanged` is the same tree comparison. It is never a pixel comparison.
12
+
13
+ ## `stuck`
14
+
15
+ `stuck {repeatCount, hint}` appears after the same action hit the same target three times with the tree unchanged.
16
+ Stop, observe, and change approach: another selector, a scroll, a capture, or ask the person.
17
+
18
+ ## Partial changes
19
+
20
+ A BACK that changes only part of the tree may still be a real navigation. Do not retry BACK blindly; use an explicit
21
+ verify (a node that must appear) or tap the screen's own back control.
22
+
23
+ ## Surfaces that hide from the tree
24
+
25
+ Canvas, games, video and parts of WebView are not in the tree. For them the only evidence is pixels: capture before
26
+ and after, and compare what you see.