mobile-debug-mcp 0.30.1 → 0.31.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.
Files changed (60) hide show
  1. package/README.md +50 -5
  2. package/dist/interact/index.js +546 -133
  3. package/dist/manage/ios.js +1 -1
  4. package/dist/server/tool-definitions.js +13 -9
  5. package/dist/server/tool-handlers.js +4 -4
  6. package/dist/server-core.js +1 -1
  7. package/dist/system/index.js +485 -48
  8. package/dist/system/ios.js +15 -7
  9. package/dist/utils/android/utils.js +4 -4
  10. package/dist/utils/cli/idb/check-idb.js +10 -3
  11. package/dist/utils/cli/idb/idb-helper.js +47 -13
  12. package/dist/utils/ios/utils.js +5 -9
  13. package/docs/CHANGELOG.md +6 -0
  14. package/docs/ROADMAP.md +88 -212
  15. package/docs/specs/baseline-spec-v0.md +1 -1
  16. package/docs/specs-deltas/015-adjustable-control-support.md +541 -0
  17. package/docs/specs-deltas/016-environment-tools.md +533 -0
  18. package/docs/tools/TOOLS.md +2 -0
  19. package/docs/tools/manage.md +4 -2
  20. package/docs/tools/system.md +9 -2
  21. package/package.json +1 -1
  22. package/skills/spec-review/SKILL.md +52 -0
  23. package/skills/spec-review/references/spec-review-checklist.md +13 -0
  24. package/skills/spec-review/references/spec-review-template.md +28 -0
  25. package/src/interact/index.ts +581 -138
  26. package/src/manage/ios.ts +1 -1
  27. package/src/server/tool-definitions.ts +13 -9
  28. package/src/server/tool-handlers.ts +4 -4
  29. package/src/server-core.ts +1 -1
  30. package/src/system/index.ts +572 -50
  31. package/src/system/ios.ts +14 -7
  32. package/src/types.ts +2 -0
  33. package/src/utils/android/utils.ts +3 -3
  34. package/src/utils/cli/idb/check-idb.ts +11 -2
  35. package/src/utils/cli/idb/idb-helper.ts +49 -12
  36. package/src/utils/ios/utils.ts +4 -8
  37. package/test/unit/interact/adjust_control.test.ts +586 -33
  38. package/test/unit/interact/tap_element.test.ts +1 -1
  39. package/test/unit/server/contract.test.ts +4 -0
  40. package/test/unit/system/get_system_status.test.ts +3 -0
  41. package/test/unit/system/system_status.test.ts +40 -0
  42. package/test/unit/utils/idb_health.test.ts +74 -0
  43. package/skills/rfc-review/SKILL.md +0 -52
  44. package/skills/rfc-review/references/rfc-review-checklist.md +0 -12
  45. package/skills/rfc-review/references/rfc-review-template.md +0 -28
  46. /package/docs/{rfcs → specs-deltas}/001-state-verification.md +0 -0
  47. /package/docs/{rfcs → specs-deltas}/002-richer-element-identity +0 -0
  48. /package/docs/{rfcs → specs-deltas}/003-wait-and-synchronization-reliability.md +0 -0
  49. /package/docs/{rfcs → specs-deltas}/004-action-verification-routing.md +0 -0
  50. /package/docs/{rfcs → specs-deltas}/005-unified-action-execution-and-verification-model.md +0 -0
  51. /package/docs/{rfcs → specs-deltas}/006-runtime-action-instrumentation-and-binding-layer.md +0 -0
  52. /package/docs/{rfcs → specs-deltas}/007-actionability-resolution-and-executable-target-selection.md +0 -0
  53. /package/docs/{rfcs → specs-deltas}/008-adjustable-control-support-and-semantic-value-manipulation.md +0 -0
  54. /package/docs/{rfcs → specs-deltas}/009-semantic-control-modeling-for-custom-and-composite-controls.md +0 -0
  55. /package/docs/{rfcs → specs-deltas}/010-verification-stabilization-and-temporal-convergence.md +0 -0
  56. /package/docs/{rfcs → specs-deltas}/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows.md +0 -0
  57. /package/docs/{rfcs → specs-deltas}/011.1-recovery-contract-types-and-runtime-wiring-spec.md +0 -0
  58. /package/docs/{rfcs → specs-deltas}/012-action-trace-and-xecution-observability.md +0 -0
  59. /package/docs/{rfcs → specs-deltas}/013-wait-and-synchronization-reliability.md +0 -0
  60. /package/docs/{rfcs → specs-deltas}/014-actionability-resolution.md +0 -0
@@ -0,0 +1,541 @@
1
+ # Spec: Adjustable Control Support
2
+
3
+ ## Purpose
4
+
5
+ Provide a deterministic, semantic interface for interacting with adjustable controls (such as sliders, steppers and other value-based controls) without relying primarily on coordinate manipulation.
6
+
7
+ The goal is to allow agents to request a target value rather than perform low-level gestures while ensuring deterministic convergence through runtime verification.
8
+
9
+ ---
10
+
11
+ # Rationale
12
+
13
+ Adjustable controls are common throughout modern mobile applications, but they remain one of the least reliable interaction types for autonomous agents.
14
+
15
+ Current interaction typically depends on coordinate dragging, which is affected by:
16
+
17
+ - varying control sizes
18
+ - snapping behaviour
19
+ - quantised values
20
+ - custom widget implementations
21
+ - accessibility differences
22
+ - platform-specific gesture handling
23
+
24
+ This specification introduces a semantic adjustment model where agents request the desired value rather than the physical gesture required to achieve it.
25
+
26
+ ---
27
+
28
+ # Goals
29
+
30
+ The implementation shall:
31
+
32
+ - Prefer semantic adjustment over gesture simulation.
33
+ - Read the current control state before adjustment where possible.
34
+ - Determine the most appropriate adjustment strategy.
35
+ - Converge deterministically toward the requested value.
36
+ - Verify the resulting value after every adjustment.
37
+ - Return deterministic failures when convergence cannot be achieved.
38
+
39
+ ---
40
+
41
+ # Non-Goals
42
+
43
+ This specification does not:
44
+
45
+ - Improve gesture precision (covered by **Adjustable Control Precision Hardening**).
46
+ - Introduce new gesture types.
47
+ - Implement visual inference of control state.
48
+ - Replace coordinate interaction for unsupported controls.
49
+ - Introduce adaptive or heuristic convergence strategies beyond deterministic bounded attempts.
50
+
51
+ ---
52
+
53
+ # Supported Controls
54
+
55
+ Initial scope includes:
56
+
57
+ - Sliders
58
+ - Seek bars
59
+ - Steppers
60
+ - Rating controls
61
+ - Adjustable Compose controls
62
+ - Adjustable UIKit / SwiftUI controls
63
+ - Accessibility-adjustable controls
64
+
65
+ All supported controls must expose or deterministically parse into a numeric value domain. Non-numeric adjustable properties are outside the initial scope.
66
+
67
+ ---
68
+
69
+ # Runtime Interface
70
+
71
+ The public tool contract remains the existing `adjust_control` operation.
72
+
73
+ ```text
74
+ adjust_control(
75
+ selector?,
76
+ element_id?,
77
+ property,
78
+ targetValue,
79
+ tolerance?,
80
+ maxAttempts?
81
+ )
82
+ ```
83
+
84
+ Exactly one of `selector` or `element_id` must be supplied.
85
+
86
+ ## Parameters
87
+
88
+ | Parameter | Description |
89
+ |----------|-------------|
90
+ | selector | Selector used by the existing element resolution pipeline |
91
+ | element_id | Previously resolved runtime element identifier |
92
+ | property | Adjustable property to modify, initially limited to numeric value properties |
93
+ | targetValue | Requested logical numeric value in the normalized domain defined by this specification |
94
+ | tolerance | Optional acceptable absolute error in the same normalized domain as `targetValue` |
95
+ | maxAttempts | Optional positive integer limiting bounded adjustment and verification attempts |
96
+
97
+ The internal execution operation may be represented as:
98
+
99
+ ```text
100
+ set_adjustable_value(
101
+ target,
102
+ property,
103
+ target_value,
104
+ tolerance,
105
+ max_attempts
106
+ )
107
+ ```
108
+
109
+ This internal operation is not a separate public tool. It is invoked only after `adjust_control` resolves `selector | element_id` into a target and maps:
110
+
111
+ - `property` to the adjustable runtime property
112
+ - `targetValue` to `target_value`
113
+ - omitted `tolerance` to the implementation default defined below
114
+ - omitted `maxAttempts` to the implementation default defined below
115
+
116
+
117
+ Defaults:
118
+
119
+ - `tolerance = 0` for discrete controls
120
+ - `tolerance = max(step / 2, 0.01 * normalized_range)` for continuous controls when a step is unavailable
121
+ - `maxAttempts = 5`
122
+
123
+ ## Compatibility Notes
124
+
125
+ This specification intentionally tightens the current runtime contract.
126
+
127
+ Compared with the current implementation:
128
+
129
+ - Exactly one of `selector` or `element_id` shall be supplied. Supplying neither or both is invalid.
130
+ - The default tolerance becomes dynamic as defined by this specification instead of the current implementation default.
131
+ - The default `maxAttempts` becomes `5`.
132
+
133
+ These changes require corresponding updates to the existing `adjust_control` implementation before this specification can be considered fully implemented.
134
+
135
+ ---
136
+
137
+ # Preconditions
138
+
139
+ Before execution the following conditions must be satisfied:
140
+
141
+ 1. Target successfully resolved using Richer Element Identity.
142
+ 2. Target passes Actionability Resolution.
143
+ 3. UI state satisfies Wait and Synchronization Reliability.
144
+ 4. The requested `property` resolves to a supported numeric adjustable domain.
145
+ 5. At least one strategy described in Strategy Detection is supported for the resolved target.
146
+
147
+ If any precondition fails, execution shall terminate without attempting adjustment.
148
+
149
+ ---
150
+
151
+ # Execution Model
152
+
153
+ ## Phase 1 — Resolve
154
+
155
+ Resolve the target using the existing element resolution pipeline.
156
+
157
+ If resolution fails:
158
+
159
+ ```
160
+ return ELEMENT_NOT_FOUND
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Phase 2 — Validate
166
+
167
+ Evaluate actionability.
168
+
169
+ The target must satisfy the Actionability Resolution specification.
170
+
171
+ If validation fails:
172
+
173
+ ```
174
+ return ELEMENT_NOT_INTERACTABLE
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Phase 3 — Read Current State
180
+
181
+ Read authoritative runtime state for the requested property.
182
+
183
+ The implementation shall attempt to obtain:
184
+
185
+ - current raw value
186
+ - minimum raw value
187
+ - maximum raw value
188
+ - discrete increment or step size, if available
189
+ - raw accessibility value, if this is the authoritative platform state
190
+ - platform control state required by the selected strategy
191
+
192
+ Derived semantic hints may be used for planning or strategy selection, but shall not be used as the success criterion for verification.
193
+
194
+ If the current value cannot be read from raw control state, readable accessibility state, or platform control state:
195
+
196
+ ```text
197
+ return UNKNOWN
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Phase 4 — Select Adjustment Strategy
203
+
204
+ Select the first supported strategy from the deterministic platform-specific order defined in Strategy Detection.
205
+
206
+ Strategy support must be proven by runtime capabilities on the resolved target. Control type names, labels, or derived semantic hints alone do not prove support.
207
+
208
+ If no strategy is supported:
209
+
210
+ ```text
211
+ return ELEMENT_NOT_INTERACTABLE
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Phase 5 — Execute
217
+
218
+ Normalize the requested value into the control domain defined in Value Domains and Normalization.
219
+
220
+ Apply the selected strategy toward the normalized target.
221
+
222
+ Execution may consist of multiple bounded operations, but shall not exceed `maxAttempts`.
223
+
224
+ After each operation:
225
+
226
+ 1. wait for the existing synchronization contract to report a stable readable state
227
+ 2. read authoritative runtime state
228
+ 3. compare the actual normalized value against the target and tolerance
229
+
230
+ No additional adjustment shall be attempted after success.
231
+
232
+ ---
233
+
234
+ ## Phase 6 — Verify
235
+
236
+ Verification must use authoritative runtime state only.
237
+
238
+ Valid sources are:
239
+
240
+ - raw readable control value
241
+ - raw accessibility value when exposed as the platform control value
242
+ - platform-native control state
243
+
244
+ Derived semantic metadata may not be used as proof of success.
245
+
246
+ If:
247
+
248
+ ```text
249
+ abs(actual_normalized - target_normalized) <= tolerance
250
+ ```
251
+
252
+ the operation succeeds.
253
+
254
+ A successful response shall contain the existing `adjust_control` response shape and include the final readable value when the current runtime contract exposes it.
255
+
256
+ If the value remains outside tolerance after `maxAttempts`:
257
+
258
+ ```text
259
+ return CONTROL_CONVERGENCE_FAILED
260
+ ```
261
+
262
+ ---
263
+
264
+ # Strategy Detection
265
+
266
+ Strategy selection is deterministic and platform-specific.
267
+
268
+ ## Android Strategy Order
269
+
270
+ ### 1. Direct platform control action
271
+
272
+ Support is proven when the resolved Android node or control exposes a runtime action capable of setting or adjusting the requested numeric value directly.
273
+
274
+ Initial implementation should target, in order:
275
+
276
+ - Android Accessibility `ACTION_SET_PROGRESS`, where supported.
277
+ - Jetpack Compose `SemanticsActions.SetProgress`, when exposed by the semantics tree.
278
+
279
+ Additional direct-value mechanisms may be added in future revisions provided they preserve the deterministic strategy ordering defined by this specification.
280
+
281
+ Examples include:
282
+
283
+ - an accessibility or automation action equivalent to setting progress
284
+ - a platform control API that accepts the requested numeric value
285
+ - a Compose testing or runtime action that exposes direct progress/value mutation
286
+
287
+ The implementation shall invoke the direct set-value action when available.
288
+
289
+ ### 2. Increment/decrement accessibility action
290
+
291
+ Support is proven when the target exposes readable current value and executable increment and/or decrement actions.
292
+
293
+ The implementation shall:
294
+
295
+ 1. compare current value with target value
296
+ 2. choose increment or decrement deterministically
297
+ 3. execute one action
298
+ 4. synchronize and verify
299
+ 5. repeat until success or `maxAttempts`
300
+
301
+ ### 3. Coordinate fallback
302
+
303
+ Support is proven only when:
304
+
305
+ - the target has stable bounds
306
+ - the value domain has readable minimum and maximum values
307
+ - the control is visible and interactable
308
+ - the requested value can be mapped deterministically to a coordinate within the control track
309
+
310
+ The implementation shall map the normalized target proportionally into the stable control bounds and perform the existing coordinate interaction primitive.
311
+
312
+ ## iOS Strategy Order
313
+
314
+ ### 1. Direct platform control action
315
+
316
+ Support is proven when the resolved UIKit, SwiftUI, XCTest, or accessibility element exposes a writable value or direct adjustment API for the requested property.
317
+
318
+ Initial implementation should target, in order:
319
+
320
+ - XCTest-supported direct value mutation for adjustable controls.
321
+ - UIKit accessibility controls exposing writable adjustable values.
322
+
323
+ Additional direct-value mechanisms may be added in future revisions provided they preserve the deterministic strategy ordering defined by this specification.
324
+
325
+ The implementation shall invoke the direct value-setting API when available.
326
+
327
+ ### 2. Accessibility increment/decrement action
328
+
329
+ Support is proven when the target exposes:
330
+
331
+ - a readable accessibility value
332
+ - an increment action and/or decrement action
333
+
334
+ The implementation shall apply one action per attempt, then synchronize and verify the updated readable value.
335
+
336
+ ### 3. Coordinate fallback
337
+
338
+ Support is proven only when:
339
+
340
+ - the element frame is stable
341
+ - the numeric minimum and maximum are readable
342
+ - the target value maps deterministically to a point within the adjustable track
343
+ - the control is visible and interactable
344
+
345
+ The implementation shall use the existing coordinate gesture primitive and then verify using authoritative runtime state.
346
+
347
+ ## Strategy Rules
348
+
349
+ - Direct value setting always takes priority over incremental adjustment.
350
+ - Incremental adjustment always takes priority over coordinate fallback.
351
+ - Strategy selection shall not change between attempts unless the selected strategy becomes unavailable in newly read runtime state.
352
+ - If a selected strategy becomes unavailable, the implementation may select the next supported strategy once, using the same deterministic order.
353
+
354
+ ---
355
+
356
+ # Value Domains and Normalization
357
+
358
+ The initial public contract is numeric.
359
+
360
+ The implementation shall normalize supported control values into a finite numeric domain before adjustment and verification.
361
+
362
+ ## Continuous Values
363
+
364
+ Continuous sliders and seek bars use their readable numeric minimum and maximum values directly.
365
+
366
+ Example:
367
+
368
+ ```text
369
+ min = 0.0
370
+ max = 1.0
371
+ targetValue = 0.65
372
+ ```
373
+
374
+ ## Discrete Steps
375
+
376
+ When a step size is available, the target shall be quantized to the nearest valid step before execution.
377
+
378
+ ```text
379
+ quantized = min + round((targetValue - min) / step) * step
380
+ ```
381
+
382
+ The quantized value becomes the verification target.
383
+
384
+ ## Percentage Values
385
+
386
+ Percentage controls are represented in the numeric domain `0..100` unless the runtime control exposes a different authoritative numeric domain.
387
+
388
+ The implementation shall not silently convert `0.5` to `50` or `50` to `0.5`. The caller must supply the value in the domain exposed by the tool response or current control state.
389
+
390
+ ## Rating Values
391
+
392
+ Ratings use their readable numeric scale, such as `0..5` or `1..10`.
393
+
394
+ Half-step or other fractional ratings are supported only when the runtime exposes the corresponding step size.
395
+
396
+ ## String Accessibility Values
397
+
398
+ String values are supported only when they can be parsed without ambiguity into a numeric value and optional unit.
399
+
400
+ Accepted examples include:
401
+
402
+ - `"50%"` -> `50`
403
+ - `"3 of 5"` -> `3`, with maximum `5`
404
+ - `"Volume, 7"` -> `7` only when the platform exposes `7` as the readable control value
405
+
406
+ Localized or free-form strings that cannot be parsed deterministically are unsupported and return:
407
+
408
+ ```text
409
+ return UNKNOWN
410
+ ```
411
+
412
+ ## Range Validation
413
+
414
+ If `targetValue` is outside the readable normalized range:
415
+
416
+ ```text
417
+ return CONTROL_CONVERGENCE_FAILED
418
+ ```
419
+
420
+ Although an out-of-range request is detected before adjustment begins, this specification classifies it as `CONTROL_CONVERGENCE_FAILED` to remain compatible with the existing shared runtime error contract.
421
+
422
+ A dedicated `OUT_OF_RANGE` runtime error may be introduced in a future revision without changing the adjustment model.
423
+
424
+ The implementation shall not silently clamp an out-of-range request unless the existing `adjust_control` contract explicitly requires clamping.
425
+
426
+ ---
427
+
428
+ # Failure Modes
429
+
430
+ The implementation shall use existing runtime error codes.
431
+
432
+ | Runtime code | Condition |
433
+ |----------|-------------|
434
+ | ELEMENT_NOT_FOUND | Neither `selector` nor `element_id` resolves to a target |
435
+ | ELEMENT_NOT_INTERACTABLE | The target fails actionability checks, the property is unsupported, or no valid adjustment strategy is available |
436
+ | CONTROL_CONVERGENCE_FAILED | The target remains outside tolerance after `maxAttempts`, or the requested value is outside the supported numeric range |
437
+ | UNKNOWN | Required readable value or range state is unavailable, a string value cannot be parsed deterministically, or an unmapped platform failure occurs |
438
+
439
+ The implementation shall not introduce new public failure codes for this capability unless the shared runtime error contract is revised separately.
440
+
441
+ ---
442
+
443
+ # Acceptance Criteria
444
+
445
+ The implementation is complete when all of the following automated fixtures or smoke scenarios pass on each supported platform.
446
+
447
+ ## Contract Tests
448
+
449
+ 1. `adjust_control` accepts exactly one of `selector` or `element_id`.
450
+ 2. `property`, `targetValue`, `tolerance`, and `maxAttempts` map to the internal operation without renaming or unit conversion ambiguity.
451
+ 3. Omitting `tolerance` and `maxAttempts` applies the defaults defined in this specification.
452
+ 4. Invalid target resolution returns `ELEMENT_NOT_FOUND` in the existing error response shape.
453
+
454
+ ## Android Fixtures
455
+
456
+ 1. A continuous slider exposing direct set-progress support reaches the requested target within tolerance using one direct action.
457
+ 2. A discrete slider exposing a readable step size quantizes the request to the nearest valid step and verifies the quantized value.
458
+ 3. An adjustable control exposing only increment/decrement actions converges within `maxAttempts` and performs one verified increment or decrement per attempt.
459
+ 4. A coordinate-fallback slider with stable bounds and readable range maps the target deterministically and verifies the resulting raw control value.
460
+ 5. A non-adjustable or non-interactable control returns `ELEMENT_NOT_INTERACTABLE`.
461
+ 6. A control whose value remains unchanged after `maxAttempts` returns `CONTROL_CONVERGENCE_FAILED`.
462
+ 7. A control with no readable numeric or parseable accessibility value returns `UNKNOWN`.
463
+
464
+ ## iOS Fixtures
465
+
466
+ 1. A UISlider or equivalent control exposing direct writable value reaches and verifies the target in one direct action.
467
+ 2. An accessibility-adjustable element exposing increment/decrement actions converges through bounded verified actions.
468
+ 3. A coordinate-fallback slider with stable frame and readable range maps the target deterministically and verifies using platform control state or readable accessibility value.
469
+ 4. A rating control verifies a valid discrete or fractional rating according to its exposed step size.
470
+ 5. An unsupported adjustable-looking element returns `ELEMENT_NOT_INTERACTABLE` rather than attempting an unproven strategy.
471
+ 6. An unparseable localized accessibility value returns `UNKNOWN`.
472
+
473
+ ## Verification Assertions
474
+
475
+ For every successful fixture:
476
+
477
+ - the response uses the existing successful `adjust_control` response shape
478
+ - the final authoritative runtime value is within tolerance of the normalized target
479
+ - no derived semantic hint is used as the success assertion
480
+ - the number of adjustment attempts is less than or equal to `maxAttempts`
481
+
482
+ For every failed fixture:
483
+
484
+ - the response uses the existing error response shape
485
+ - the runtime code matches one of `ELEMENT_NOT_FOUND`, `ELEMENT_NOT_INTERACTABLE`, `CONTROL_CONVERGENCE_FAILED`, or `UNKNOWN`
486
+ - no additional adjustment occurs after the terminal failure is known
487
+
488
+ ---
489
+
490
+ # Dependencies
491
+
492
+ Depends on:
493
+
494
+ - Stronger State Verification
495
+ - Richer Element Identity
496
+ - Wait and Synchronization Reliability
497
+ - Actionability Resolution
498
+
499
+ Strengthens:
500
+
501
+ - Better Compose / Custom Control Semantics
502
+ - Adjustable Control Precision Hardening
503
+ - Pinch to Zoom
504
+
505
+ ---
506
+
507
+ # Future Work
508
+
509
+ The following capabilities are intentionally excluded from this specification:
510
+
511
+ - binary-search convergence
512
+ - adaptive convergence algorithms
513
+ - drag-versus-tap optimisation
514
+ - control-specific heuristics
515
+ - fine-grained precision tuning
516
+ - gesture optimisation
517
+
518
+ These are covered by the **Adjustable Control Precision Hardening** specification.
519
+
520
+ ---
521
+
522
+ # Determinism Requirements
523
+
524
+ Given identical:
525
+
526
+ - snapshot
527
+ - control state
528
+ - requested value
529
+ - tolerance
530
+ - maxAttempts
531
+
532
+ the implementation shall produce identical behaviour.
533
+
534
+ Execution shall not rely on:
535
+
536
+ - randomness
537
+ - timing heuristics
538
+ - hidden mutable state
539
+ - undefined platform behaviour
540
+
541
+ ---