mobile-debug-mcp 0.25.1 → 0.26.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.
- package/dist/interact/index.js +113 -0
- package/dist/observe/android.js +10 -1
- package/dist/observe/index.js +19 -1
- package/dist/observe/ios.js +15 -1
- package/dist/observe/snapshot-metadata.js +88 -0
- package/dist/server/tool-definitions.js +30 -2
- package/dist/server/tool-handlers.js +10 -0
- package/dist/server-core.js +1 -1
- package/docs/CHANGELOG.md +6 -0
- package/docs/rfcs/003-wait-and-synchronization-reliability.md +296 -0
- package/docs/specs/mcp-tooling-spec-v1.md +8 -0
- package/docs/tools/interact.md +21 -0
- package/docs/tools/observe.md +4 -2
- package/package.json +1 -1
- package/skills/rfc-review/SKILL.md +52 -0
- package/skills/rfc-review/references/rfc-review-checklist.md +12 -0
- package/skills/rfc-review/references/rfc-review-template.md +28 -0
- package/src/interact/index.ts +151 -0
- package/src/observe/android.ts +11 -1
- package/src/observe/index.ts +26 -1
- package/src/observe/ios.ts +28 -13
- package/src/observe/snapshot-metadata.ts +107 -0
- package/src/server/tool-definitions.ts +30 -2
- package/src/server/tool-handlers.ts +11 -0
- package/src/server-core.ts +1 -1
- package/src/types.ts +23 -0
- package/test/unit/interact/wait_for_ui_change.test.ts +76 -0
- package/test/unit/server/response_shapes.test.ts +37 -3
- package/docs/rfcs/003-wait-and-synchronization-reliability +0 -232
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
# RFC-003: Wait and Synchronization Reliability
|
|
4
|
-
|
|
5
|
-
Priority: 3
|
|
6
|
-
Depends on: RFC-001 (Stronger State Verification), RFC-002 (Platform-Native Element Metadata and Resolution Hints)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# 1. Problem
|
|
11
|
-
|
|
12
|
-
Agents can often identify the right element (RFC-002) and verify the right state (RFC-001), but still fail because they act before the UI has reached the intended post-action state.
|
|
13
|
-
|
|
14
|
-
This causes:
|
|
15
|
-
|
|
16
|
-
- retries caused by racing the UI
|
|
17
|
-
- false failures from stale snapshots
|
|
18
|
-
- overuse of network/log verification when UI evidence should suffice
|
|
19
|
-
- flakiness in asynchronous and in-place update flows
|
|
20
|
-
- unreliable behaviour in Compose-heavy or thin accessibility trees
|
|
21
|
-
|
|
22
|
-
Current system limitations:
|
|
23
|
-
|
|
24
|
-
- wait_for_ui is underused after actions involving async state changes
|
|
25
|
-
- current waits focus on expected elements appearing, not general UI transition detection
|
|
26
|
-
- snapshot staleness is not explicitly surfaced
|
|
27
|
-
- loading state transitions are inconsistently observable
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
# 2. Goals
|
|
32
|
-
|
|
33
|
-
This RFC introduces:
|
|
34
|
-
|
|
35
|
-
1. UI-first synchronization policy after actions
|
|
36
|
-
2. Snapshot staleness and revision metadata
|
|
37
|
-
3. UI-change based waiting for in-place updates
|
|
38
|
-
4. Structured loading-state detection
|
|
39
|
-
5. Compose-aware synchronization hints
|
|
40
|
-
|
|
41
|
-
Success goals:
|
|
42
|
-
|
|
43
|
-
- reduce retries caused by premature actions
|
|
44
|
-
- increase successful post-action verification
|
|
45
|
-
- reduce unnecessary fallbacks to logs/network checks
|
|
46
|
-
- improve reliability in asynchronous UI flows
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
# 3. Non-Goals
|
|
51
|
-
|
|
52
|
-
This RFC does not:
|
|
53
|
-
|
|
54
|
-
- redefine state verification semantics (RFC-001)
|
|
55
|
-
- redefine element identity contracts (RFC-002)
|
|
56
|
-
- add new interaction primitives (long press, pinch, etc.)
|
|
57
|
-
- replace network or log verification where no UI outcome exists
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
# 4. Proposed Model
|
|
62
|
-
|
|
63
|
-
## 4.1 UI-First Synchronization Policy
|
|
64
|
-
|
|
65
|
-
Default post-action flow SHOULD be:
|
|
66
|
-
|
|
67
|
-
```text
|
|
68
|
-
action
|
|
69
|
-
→ wait_for_ui(expected outcome)
|
|
70
|
-
→ verify state
|
|
71
|
-
→ only fall back to network/logs when no UI outcome exists or wait fails
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Rules:
|
|
75
|
-
|
|
76
|
-
- UI evidence MUST be preferred over network or log evidence when a UI outcome is expected.
|
|
77
|
-
- Actions that trigger navigation, async mutation, or visible state changes SHOULD be followed by a wait.
|
|
78
|
-
- Network/log checks are fallback signals, not primary synchronization mechanisms.
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## 4.2 Snapshot Revision / Staleness Metadata
|
|
83
|
-
|
|
84
|
-
Snapshot responses MUST expose revision metadata.
|
|
85
|
-
|
|
86
|
-
Preferred shape:
|
|
87
|
-
|
|
88
|
-
```json
|
|
89
|
-
{
|
|
90
|
-
"snapshot_revision": 184,
|
|
91
|
-
"captured_at_ms": 1714452012301
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Rules:
|
|
96
|
-
|
|
97
|
-
- snapshot_revision MUST increment when hierarchy meaningfully changes.
|
|
98
|
-
- captured_at_ms MUST reflect snapshot capture time.
|
|
99
|
-
- Agents SHOULD use revision changes as synchronization signals.
|
|
100
|
-
- Agents SHOULD treat stale revisions as suspect for verification.
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## 4.3 wait_for_ui_change Primitive
|
|
105
|
-
|
|
106
|
-
A UI-diff based wait primitive SHOULD support waiting on hierarchy changes, not only explicit expected elements.
|
|
107
|
-
|
|
108
|
-
Conceptual contract:
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
wait_for_ui_change({
|
|
112
|
-
expected_change?: "hierarchy_diff" | "text_change" | "state_change",
|
|
113
|
-
timeout_ms?: number
|
|
114
|
-
})
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Use cases:
|
|
118
|
-
|
|
119
|
-
- in-place content refresh
|
|
120
|
-
- async partial rerender
|
|
121
|
-
- list mutations
|
|
122
|
-
- Compose recomposition-driven updates
|
|
123
|
-
|
|
124
|
-
Rules:
|
|
125
|
-
|
|
126
|
-
- wait_for_ui_change SHOULD detect meaningful UI deltas, not cosmetic noise.
|
|
127
|
-
- It MAY use snapshot revisions as one signal.
|
|
128
|
-
- It complements wait_for_ui; it does not replace it.
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## 4.4 Structured Loading-State Detection
|
|
133
|
-
|
|
134
|
-
Systems SHOULD surface structured loading signals when detectable.
|
|
135
|
-
|
|
136
|
-
Examples:
|
|
137
|
-
|
|
138
|
-
- progress indicator present/absent
|
|
139
|
-
- disabled submit button becomes enabled
|
|
140
|
-
- loading spinner removed
|
|
141
|
-
|
|
142
|
-
Preferred model:
|
|
143
|
-
|
|
144
|
-
```json
|
|
145
|
-
{
|
|
146
|
-
"loading_state": {
|
|
147
|
-
"active": true,
|
|
148
|
-
"signal": "progress_indicator"
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Rules:
|
|
154
|
-
|
|
155
|
-
- loading start and loading completion SHOULD be detectable when possible.
|
|
156
|
-
- Loading signals MAY be used as synchronization hints, not sole success criteria.
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## 4.5 Compose-Aware Synchronization Hints
|
|
161
|
-
|
|
162
|
-
For Compose or thin accessibility structures:
|
|
163
|
-
|
|
164
|
-
Systems SHOULD support:
|
|
165
|
-
|
|
166
|
-
- merged semantic node changes as wait signals
|
|
167
|
-
- text mutations within existing nodes
|
|
168
|
-
- in-place recomposition awareness
|
|
169
|
-
|
|
170
|
-
These are synchronization hints layered on top of standard wait behaviour.
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
# 5. Failure Modes
|
|
175
|
-
|
|
176
|
-
## 5.1 Premature Action Progression
|
|
177
|
-
|
|
178
|
-
If an action is followed immediately by verification without waiting:
|
|
179
|
-
|
|
180
|
-
- system SHOULD bias toward suggesting wait_for_ui
|
|
181
|
-
- retries SHOULD prefer synchronization correction before repeated action execution
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## 5.2 Stale Snapshot Reads
|
|
186
|
-
|
|
187
|
-
If verification uses an old snapshot:
|
|
188
|
-
|
|
189
|
-
- revision metadata SHOULD expose staleness
|
|
190
|
-
- agents SHOULD reacquire snapshot before retrying verification
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## 5.3 No Visible UI Outcome
|
|
195
|
-
|
|
196
|
-
If no UI outcome is expected:
|
|
197
|
-
|
|
198
|
-
- network/log verification MAY be primary evidence
|
|
199
|
-
- UI-first policy does not apply rigidly
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
# 6. Acceptance Criteria
|
|
204
|
-
|
|
205
|
-
RFC-003 is complete when:
|
|
206
|
-
|
|
207
|
-
- UI-first synchronization policy is enforced in agent guidance
|
|
208
|
-
- snapshot revision metadata is exposed in snapshot responses
|
|
209
|
-
- wait_for_ui_change contract is implemented or stubbed
|
|
210
|
-
- structured loading-state hints are surfaced where detectable
|
|
211
|
-
- retries caused by premature action progression are reduced
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
# 7. Success Metrics
|
|
216
|
-
|
|
217
|
-
- Fewer retries caused by timing/synchronization errors
|
|
218
|
-
- Higher post-action verification success rate
|
|
219
|
-
- Reduced unnecessary fallback to network/log evidence
|
|
220
|
-
- Improved stability in asynchronous and Compose-heavy flows
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
# 8. Deferred To Later RFCs
|
|
225
|
-
|
|
226
|
-
- Advanced subscriptions / notify-when-element-appears APIs
|
|
227
|
-
- Full action-to-ui trace correlation (Priority 7)
|
|
228
|
-
- Gesture-trigger-specific synchronization logic
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
This RFC standardises temporal reliability and synchronization signals layered on top of state verification and element identity guarantees from RFC-001 and RFC-002.
|