mobile-debug-mcp 0.30.0 → 0.30.2

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 (44) hide show
  1. package/dist/interact/index.js +876 -155
  2. package/dist/observe/index.js +1 -0
  3. package/dist/observe/snapshot-metadata.js +62 -1
  4. package/dist/server/tool-definitions.js +20 -11
  5. package/dist/server/tool-handlers.js +7 -5
  6. package/dist/server-core.js +1 -1
  7. package/docs/CHANGELOG.md +9 -0
  8. package/docs/ROADMAP.md +85 -209
  9. package/docs/{rfcs → specs-deltas}/013-wait-and-synchronization-reliability.md +15 -35
  10. package/docs/{rfcs → specs-deltas}/014-actionability-resolution.md +32 -30
  11. package/docs/specs-deltas/015-adjustable-control-support.md +541 -0
  12. package/package.json +1 -1
  13. package/skills/spec-review/SKILL.md +52 -0
  14. package/skills/spec-review/references/spec-review-checklist.md +13 -0
  15. package/skills/spec-review/references/spec-review-template.md +28 -0
  16. package/src/interact/index.ts +1008 -171
  17. package/src/observe/index.ts +1 -0
  18. package/src/observe/snapshot-metadata.ts +69 -2
  19. package/src/server/tool-definitions.ts +20 -11
  20. package/src/server/tool-handlers.ts +7 -5
  21. package/src/server-core.ts +1 -1
  22. package/src/types.ts +26 -0
  23. package/test/unit/interact/adjust_control.test.ts +690 -33
  24. package/test/unit/interact/subtree_collection.test.ts +24 -0
  25. package/test/unit/interact/tap_element.test.ts +71 -0
  26. package/test/unit/interact/wait_for_ui_change.test.ts +92 -1
  27. package/test/unit/observe/snapshot_metadata.test.ts +67 -0
  28. package/test/unit/server/contract.test.ts +4 -0
  29. package/skills/rfc-review/SKILL.md +0 -52
  30. package/skills/rfc-review/references/rfc-review-checklist.md +0 -12
  31. package/skills/rfc-review/references/rfc-review-template.md +0 -28
  32. /package/docs/{rfcs → specs-deltas}/001-state-verification.md +0 -0
  33. /package/docs/{rfcs → specs-deltas}/002-richer-element-identity +0 -0
  34. /package/docs/{rfcs → specs-deltas}/003-wait-and-synchronization-reliability.md +0 -0
  35. /package/docs/{rfcs → specs-deltas}/004-action-verification-routing.md +0 -0
  36. /package/docs/{rfcs → specs-deltas}/005-unified-action-execution-and-verification-model.md +0 -0
  37. /package/docs/{rfcs → specs-deltas}/006-runtime-action-instrumentation-and-binding-layer.md +0 -0
  38. /package/docs/{rfcs → specs-deltas}/007-actionability-resolution-and-executable-target-selection.md +0 -0
  39. /package/docs/{rfcs → specs-deltas}/008-adjustable-control-support-and-semantic-value-manipulation.md +0 -0
  40. /package/docs/{rfcs → specs-deltas}/009-semantic-control-modeling-for-custom-and-composite-controls.md +0 -0
  41. /package/docs/{rfcs → specs-deltas}/010-verification-stabilization-and-temporal-convergence.md +0 -0
  42. /package/docs/{rfcs → specs-deltas}/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows.md +0 -0
  43. /package/docs/{rfcs → specs-deltas}/011.1-recovery-contract-types-and-runtime-wiring-spec.md +0 -0
  44. /package/docs/{rfcs → specs-deltas}/012-action-trace-and-xecution-observability.md +0 -0
@@ -325,6 +325,7 @@ export class ToolsObserve {
325
325
  const snapshotMetadata = deriveSnapshotMetadata(snapshotDeviceKey, raw.ui_tree, 'snapshot', raw.ui_tree?.snapshot_revision ? null : (raw.fingerprint || raw.activity || null));
326
326
  raw.snapshot_revision = raw.ui_tree?.snapshot_revision ?? snapshotMetadata.snapshot_revision;
327
327
  raw.captured_at_ms = raw.ui_tree?.captured_at_ms ?? snapshotMetadata.captured_at_ms;
328
+ raw.snapshot_delta = raw.ui_tree?.snapshot_delta ?? snapshotMetadata.snapshot_delta ?? null;
328
329
  raw.loading_state = raw.ui_tree?.loading_state ?? snapshotMetadata.loading_state;
329
330
  const semantic = deriveSnapshotSemantic(raw);
330
331
  return semantic ? { raw, semantic } : { raw };
@@ -30,6 +30,58 @@ function stableElementSignature(element) {
30
30
  bounds: normalizeBounds(element.bounds)
31
31
  };
32
32
  }
33
+ function stableElementIdentity(element, index) {
34
+ const stableId = normalize(element.stable_id);
35
+ if (stableId)
36
+ return `stable:${stableId}`;
37
+ return `fallback:${crypto.createHash('sha1').update(JSON.stringify({
38
+ text: normalize(element.text),
39
+ contentDescription: normalize(element.contentDescription),
40
+ resourceId: normalize(element.resourceId),
41
+ type: normalize(element.type),
42
+ bounds: normalizeBounds(element.bounds),
43
+ index
44
+ })).digest('hex')}`;
45
+ }
46
+ function buildElementSignatures(tree) {
47
+ const signatures = new Map();
48
+ const elements = Array.isArray(tree?.elements) ? tree.elements : [];
49
+ for (let index = 0; index < elements.length; index++) {
50
+ const element = elements[index];
51
+ if (!element)
52
+ continue;
53
+ const identity = stableElementIdentity(element, index);
54
+ signatures.set(identity, crypto.createHash('sha1').update(JSON.stringify(stableElementSignature(element))).digest('hex'));
55
+ }
56
+ return signatures;
57
+ }
58
+ function summarizeSnapshotDelta(previous, currentElements) {
59
+ if (!previous)
60
+ return null;
61
+ let added = 0;
62
+ let removed = 0;
63
+ let mutated = 0;
64
+ for (const [identity, signature] of currentElements.entries()) {
65
+ const previousSignature = previous.elementSignatures.get(identity);
66
+ if (previousSignature === undefined) {
67
+ added++;
68
+ }
69
+ else if (previousSignature !== signature) {
70
+ mutated++;
71
+ }
72
+ }
73
+ for (const identity of previous.elementSignatures.keys()) {
74
+ if (!currentElements.has(identity))
75
+ removed++;
76
+ }
77
+ return {
78
+ previous_snapshot_revision: previous.revision,
79
+ added_elements: added,
80
+ removed_elements: removed,
81
+ mutated_elements: mutated,
82
+ total_elements: currentElements.size
83
+ };
84
+ }
33
85
  export function computeSnapshotSignature(tree) {
34
86
  if (!tree || tree.error)
35
87
  return null;
@@ -67,6 +119,10 @@ export function detectLoadingState(tree, source) {
67
119
  export function deriveSnapshotMetadata(deviceKey, tree, source, signatureOverride) {
68
120
  const signature = signatureOverride ?? computeSnapshotSignature(tree);
69
121
  const previous = snapshotStateByDevice.get(deviceKey);
122
+ const hasValidTree = !!tree && !tree.error;
123
+ const currentElementSignatures = hasValidTree
124
+ ? buildElementSignatures(tree)
125
+ : previous?.elementSignatures ?? new Map();
70
126
  let revision = 1;
71
127
  if (previous) {
72
128
  if (signature === null) {
@@ -76,10 +132,15 @@ export function deriveSnapshotMetadata(deviceKey, tree, source, signatureOverrid
76
132
  revision = previous.signature === signature ? previous.revision : previous.revision + 1;
77
133
  }
78
134
  }
79
- snapshotStateByDevice.set(deviceKey, { revision, signature });
135
+ snapshotStateByDevice.set(deviceKey, {
136
+ revision,
137
+ signature,
138
+ elementSignatures: currentElementSignatures
139
+ });
80
140
  return {
81
141
  snapshot_revision: revision,
82
142
  captured_at_ms: Date.now(),
143
+ snapshot_delta: hasValidTree ? summarizeSnapshotDelta(previous, currentElementSignatures) : null,
83
144
  loading_state: detectLoadingState(tree, source)
84
145
  };
85
146
  }
@@ -244,7 +244,7 @@ Failure Handling:
244
244
  },
245
245
  {
246
246
  name: 'capture_debug_snapshot',
247
- description: 'Capture a complete debug snapshot (raw observation layer plus optional derived semantic layer). Returns structured JSON with snapshot_revision, captured_at_ms, and loading_state when detectable.',
247
+ description: 'Capture a complete debug snapshot (raw observation layer plus optional derived semantic layer). Returns structured JSON with snapshot_revision, captured_at_ms, snapshot_delta, and loading_state when detectable.',
248
248
  inputSchema: {
249
249
  type: 'object',
250
250
  properties: {
@@ -295,7 +295,7 @@ Failure Handling:
295
295
  },
296
296
  {
297
297
  name: 'get_ui_tree',
298
- description: 'Get the current UI hierarchy from an Android device or iOS simulator. Returns a structured JSON representation of the screen content with snapshot metadata when available.',
298
+ description: 'Get the current UI hierarchy from an Android device or iOS simulator. Returns a structured JSON representation of the screen content with snapshot metadata and incremental delta signals when available.',
299
299
  inputSchema: {
300
300
  type: 'object',
301
301
  properties: {
@@ -376,11 +376,14 @@ Inputs:
376
376
  - expected_change (optional): hierarchy_diff, text_change, or state_change
377
377
  - timeout_ms (optional)
378
378
  - stability_window_ms (optional)
379
+ - scope (optional): screen or subtree
380
+ - target (optional): element_id when scope=subtree
379
381
 
380
382
  Guidance:
381
383
  - Prefer wait_for_screen_change for navigation transitions.
382
384
  - Prefer wait_for_ui_change for in-place mutations and non-navigation updates.
383
385
  - Use the returned snapshot_revision as the observed synchronization point when available.
386
+ - Scoped waits return scope-aware stability metadata and a lightweight change summary.
384
387
 
385
388
  Failure Handling:
386
389
  - TIMEOUT means the UI did not change in a stable way within the allotted time.`,
@@ -390,6 +393,8 @@ Failure Handling:
390
393
  platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override (android|ios)' },
391
394
  deviceId: { type: 'string', description: 'Optional device id/udid to target' },
392
395
  expected_change: { type: 'string', enum: ['hierarchy_diff', 'text_change', 'state_change'], description: 'Optional type of UI change to wait for' },
396
+ scope: { type: 'string', enum: ['screen', 'subtree'], default: 'screen', description: 'Synchronization scope for the wait' },
397
+ target: { type: 'string', description: 'Target element_id when scope is subtree' },
393
398
  timeout_ms: { type: 'number', description: 'Timeout in ms to wait for change (default 60000)', default: 60000 },
394
399
  stability_window_ms: { type: 'number', description: 'How long the change must remain stable before success (default 300)', default: 300 }
395
400
  }
@@ -563,11 +568,11 @@ Adjust a numeric control value with verification.
563
568
  This is the initial adjustable-control surface for slider-like controls and other controls that expose a numeric value or value_range.
564
569
 
565
570
  Inputs:
566
- - selector or element_id
571
+ - exactly one of selector or element_id
567
572
  - property (defaults to "value")
568
573
  - targetValue
569
- - tolerance (optional)
570
- - maxAttempts (optional)
574
+ - tolerance (optional; discrete default is 0, continuous default is max(step / 2, 1% of range) when omitted)
575
+ - maxAttempts (optional; defaults to 5)
571
576
  - platform/deviceId (optional)
572
577
 
573
578
  Output Structure:
@@ -579,14 +584,14 @@ Output Structure:
579
584
  - success = true when the control converges within tolerance
580
585
 
581
586
  Verification Guidance:
582
- - Prefer direct target placement when value_range is available; fall back to a drag only if the direct tap does not converge
587
+ - Prefer direct platform adjustment when the runtime exposes it; then verified increment/decrement actions; use coordinate fallback only as degraded mode
583
588
  - Use expect_state for the control value readback
584
- - Treat coordinate fallback as degraded mode
589
+ - Do not use derived semantic metadata as proof of success
585
590
 
586
591
  Failure Handling:
587
592
  - ELEMENT_NOT_FOUND → re-resolve the control
588
593
  - ELEMENT_NOT_INTERACTABLE → the control cannot be adjusted through the current runtime
589
- - TIMEOUT → the control did not converge within bounded retries
594
+ - CONTROL_CONVERGENCE_FAILED → the control did not converge within bounded retries or the requested value is out of range
590
595
  - UNKNOWN → capture a snapshot and stop`,
591
596
  inputSchema: {
592
597
  type: 'object',
@@ -603,12 +608,16 @@ Failure Handling:
603
608
  element_id: { type: 'string', description: 'Optional previously resolved element identifier.' },
604
609
  property: { type: 'string', description: 'Readable numeric state property to adjust.', default: 'value' },
605
610
  targetValue: { type: 'number', description: 'Target numeric value.' },
606
- tolerance: { type: 'number', description: 'Accepted numeric tolerance around the target value.', default: 0 },
607
- maxAttempts: { type: 'number', description: 'Maximum adjustment attempts.', default: 3 },
611
+ tolerance: { type: 'number', description: 'Accepted numeric tolerance around the target value. Defaults are derived from the readable control domain.' },
612
+ maxAttempts: { type: 'number', description: 'Maximum adjustment attempts.', default: 5 },
608
613
  platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override' },
609
614
  deviceId: { type: 'string', description: 'Optional device serial/udid' }
610
615
  },
611
- required: ['targetValue']
616
+ required: ['targetValue'],
617
+ oneOf: [
618
+ { required: ['selector'] },
619
+ { required: ['element_id'] }
620
+ ]
612
621
  }
613
622
  },
614
623
  {
@@ -231,12 +231,12 @@ async function handleAdjustControl(args) {
231
231
  const element_id = getStringArg(args, 'element_id');
232
232
  const property = getStringArg(args, 'property') ?? 'value';
233
233
  const targetValue = requireNumberArg(args, 'targetValue');
234
- const tolerance = getNumberArg(args, 'tolerance') ?? 0;
235
- const maxAttempts = getNumberArg(args, 'maxAttempts') ?? 3;
234
+ const tolerance = getNumberArg(args, 'tolerance');
235
+ const maxAttempts = getNumberArg(args, 'maxAttempts');
236
236
  const platform = getStringArg(args, 'platform');
237
237
  const deviceId = getStringArg(args, 'deviceId');
238
- if (!selector && !element_id) {
239
- throw new Error('Missing selector or element_id argument');
238
+ if ((!selector && !element_id) || (selector && element_id)) {
239
+ throw new Error('Exactly one of selector or element_id argument is required');
240
240
  }
241
241
  const res = await ToolsInteract.adjustControlHandler({
242
242
  selector: selector ?? undefined,
@@ -268,7 +268,9 @@ async function handleWaitForUIChange(args) {
268
268
  const timeout_ms = getNumberArg(args, 'timeout_ms') ?? 60000;
269
269
  const stability_window_ms = getNumberArg(args, 'stability_window_ms') ?? 300;
270
270
  const expected_change = getStringArg(args, 'expected_change');
271
- const res = await ToolsInteract.waitForUIChangeHandler({ platform, deviceId, timeout_ms, stability_window_ms, expected_change });
271
+ const scope = getStringArg(args, 'scope');
272
+ const target = getStringArg(args, 'target');
273
+ const res = await ToolsInteract.waitForUIChangeHandler({ platform, deviceId, timeout_ms, stability_window_ms, expected_change, scope, target });
272
274
  return wrapResponse(res);
273
275
  }
274
276
  async function handleFindElement(args) {
@@ -6,7 +6,7 @@ import { handleToolCall } from './server/tool-handlers.js';
6
6
  export { wrapResponse, toolDefinitions, handleToolCall };
7
7
  export const serverInfo = {
8
8
  name: 'mobile-debug-mcp',
9
- version: '0.30.0'
9
+ version: '0.30.2'
10
10
  };
11
11
  export function createServer() {
12
12
  const server = new Server(serverInfo, {
package/docs/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to the **Mobile Debug MCP** project will be documented in this file.
4
4
 
5
+ ## [0.30.2]
6
+ - improved slider interaction
7
+
8
+ ## [0.30.1]
9
+ - Synced the server-reported version in `src/server-core.ts` with `package.json` so contract checks pass.
10
+ - Completed the RFC 013 wait/synchronization implementation, including scoped waits and freshness metadata.
11
+ - Completed the RFC 014 actionability implementation for taps and adjustable controls.
12
+ - Added regression coverage for subtree collection, scoped waits, snapshot deltas, and stale actionability checks.
13
+
5
14
  ## [0.30.0]
6
15
  - Folded RFC 013 synchronization semantics into the main spec and aligned the interact docs with the shipped `wait_for_ui_change` behavior.
7
16
  - Updated `wait_for_ui_change` to use a 300ms stabilization default and to reset stabilization on new in-place mutations.
package/docs/ROADMAP.md CHANGED
@@ -1,124 +1,26 @@
1
1
  # Mobile Debug MCP Roadmap
2
2
 
3
- ## Planning Principles
4
-
5
- Ordered by:
6
-
7
-
8
- 1. Impact on agent reliability
9
- 2. Reduction in retries / brittleness
10
- 3. Breadth of app coverage improved
11
- 4. Implementation complexity vs payoff
12
-
13
- ## Capability Status Definitions
14
-
15
- - **Completed**
16
- Capability implemented and considered part of the baseline platform.
17
-
18
- - **Spec Ready**
19
- Capability design or RFC is mature and implementation-ready, but not yet delivered.
20
-
21
- - **Planned**
22
- Capability is prioritized on the roadmap, but detailed specification and/or implementation work remains ahead.
23
-
24
- ## Program-Level Success Metrics
25
- Track roadmap impact across releases using:
26
-
27
- - Retry reduction rate (% fewer action retries per task)
28
- - Element match success rate (% successful element targeting)
29
- - Verification success rate (% expect_* checks passing first attempt)
30
- - Wait success rate for asynchronous UI flows
31
- - Custom control interaction success rate
32
- - Gesture success rate
33
- - Mean time to root cause during debugging
34
- - Overall agent task completion rate
35
- - Reduced sequencing errors in multi-step interaction flows
36
-
37
- Primary KPI:
38
- Higher task success with fewer retries.
39
-
40
- ---
41
-
42
- # Roadmap Status Overview
43
-
44
- ## Completed Capabilities
45
-
46
- - Stronger State Verification — Complete (Foundational verification layer shipped)
47
- - Richer Element Identity — Complete (Identity and selector confidence foundations shipped)
48
- - Better Compose / Custom Control Semantics — Complete (Semantic role enrichment and custom-adjustable inference shipped)
49
- - Verification Stabilization and Temporal Convergence — Complete (Temporal verification and convergence logic shipped)
50
- - Action Trace and Execution Observability — Complete (Structured execution trace model shipped)
51
- - Wait and Synchronization Reliability — Complete (RFC 013 folded into the main spec and shipped behavior verified on emulator)
52
-
53
- ## Current Focus
3
+ ## Done
54
4
 
5
+ - Stronger State Verification
6
+ - Richer Element Identity
7
+ - Better Compose / Custom Control Semantics
8
+ - Verification Stabilization and Temporal Convergence
9
+ - Action Trace and Execution Observability
10
+ - Wait and Synchronization Reliability
55
11
  - Actionability Resolution
56
- - Adjustable Control Precision Hardening
57
12
 
58
- ## Upcoming Work
13
+ ## Todo
59
14
 
15
+ - Adjustable Control Support
60
16
  - Adjustable Control Precision Hardening
61
17
  - Environment Auto-Configuration and Toolchain Discovery
62
- - Adjustable Control Support
63
18
  - Signal-Oriented Diagnostic Filtering
64
19
  - Long Press Gesture
65
-
66
- ## Rationale
67
- Reduce onboarding friction and improve developer experience by minimizing manual setup dependencies.
68
-
69
- **Status:** Planned
70
-
71
- Addresses friction around:
72
- - manual idb installation
73
- - manual adb path configuration
74
- - manual xcrun path configuration
75
- - environment drift across machines
76
- - setup failures blocking first use
77
-
78
- - Automatic discovery of adb
79
- - Automatic discovery of xcrun
80
- - idb detection and guided bootstrap support
81
- - Startup toolchain validation
82
- - Environment health diagnostics / doctor-style checks
83
- - Minimal-manual-configuration defaults
84
- - Runtime device/emulator health signals (crash detection, process lifecycle awareness)
85
- - App stability monitoring during active sessions
86
-
87
- ## Expected Impact
88
- High.
89
-
90
- ## Exit Criteria
91
- - adb and xcrun auto-discovery implemented
92
- - Missing dependencies surfaced with guided remediation
93
- - Startup environment validation available
94
- - Manual path configuration eliminated or minimized for standard setups
95
- - First-run setup validated on representative developer environments
96
-
97
- ## Success Metrics
98
- - Reduced setup friction during onboarding
99
- - Lower environment configuration failures
100
- - Faster time-to-first-successful-session
101
- - Reduced support/debugging caused by local setup issues
102
- - Reduced unknown-failure sessions caused by app or emulator instability
103
-
104
- ## Dependencies
105
- Depends on:
106
- - Stronger State Verification
107
- - Richer Element Identity
108
-
109
- Strengthens:
110
- - Actionability Resolution
111
- - Broader user adoption readiness
112
-
113
- ---
114
-
115
- ## Later Horizon
116
-
20
+ - Runtime Debugger Introspection
117
21
  - Pinch to Zoom
118
22
  - Advanced Trace Correlation and Analysis
119
23
 
120
- ---
121
-
122
24
  # Stronger State Verification
123
25
 
124
26
  ## Rationale
@@ -577,6 +479,81 @@ Depends on:
577
479
 
578
480
  ---
579
481
 
482
+ # Runtime Debugger Introspection
483
+
484
+ ## Rationale
485
+ Enables agents to move from symptom observation to runtime causal analysis by inspecting paused application state during debugging sessions.
486
+
487
+ **Status:** Planned
488
+
489
+ Addresses limitations where agents:
490
+ - observe UI failures but cannot determine runtime cause
491
+ - cannot inspect ViewModel or controller state
492
+ - lack access to local variables and stack context
493
+ - cannot reason about async execution state
494
+
495
+ ## Scope
496
+ Debugger-assisted runtime inspection primitives:
497
+
498
+ ```javascript
499
+ debugger.pause_state()
500
+ debugger.stack_trace()
501
+ debugger.locals()
502
+ debugger.inspect_object(object_id)
503
+ debugger.evaluate(expression)
504
+ debugger.threads()
505
+ ```
506
+
507
+ Includes:
508
+ - stack frame inspection
509
+ - local variable inspection
510
+ - object graph traversal
511
+ - thread inspection
512
+ - expression evaluation
513
+ - platform abstraction over JDWP / LLDB
514
+ - bounded object expansion and summarization
515
+ - coroutine/task inspection support
516
+
517
+ Future exploration:
518
+ - controlled stepping support
519
+ - debugger-assisted recovery workflows
520
+
521
+ ## Expected Impact
522
+ Very high.
523
+
524
+ Transforms debugging from:
525
+ - surface-level symptom detection
526
+
527
+ toward:
528
+ - root-cause-oriented runtime reasoning
529
+
530
+ ## Exit Criteria
531
+ - Paused runtime state accessible through MCP
532
+ - Local variable inspection implemented
533
+ - Stack trace inspection implemented
534
+ - Object inspection primitives implemented
535
+ - Runtime inspection validated on representative Android flows
536
+ - Object expansion safeguards implemented
537
+ - Expression evaluation available with safety limits
538
+
539
+ ## Success Metrics
540
+ - Lower mean time-to-root-cause
541
+ - Higher causal diagnosis accuracy
542
+ - Reduced debugging iteration loops
543
+ - Faster identification of state-management failures
544
+ - Improved async/concurrency failure diagnosis
545
+
546
+ ## Dependencies
547
+ Depends on:
548
+ - Action Trace and Execution Observability
549
+ - Stronger State Verification
550
+ - Wait and Synchronization Reliability
551
+ - Signal-Oriented Diagnostic Filtering
552
+
553
+ Strengthens:
554
+ - Advanced Trace Correlation and Analysis
555
+ - Future autonomous recovery systems
556
+
580
557
  # Pinch to Zoom
581
558
 
582
559
  ## Rationale
@@ -658,104 +635,3 @@ Depends on:
658
635
  - Stronger State Verification
659
636
  - Richer Element Identity
660
637
  - Wait and Synchronization Reliability
661
-
662
- ---
663
-
664
- # Roadmap Sequence
665
-
666
- ## Dependency Summary
667
-
668
- Foundation
669
- - Stronger State Verification
670
- - Richer Element Identity
671
-
672
- Synchronization & Actionability
673
- - Environment Auto-Configuration and Toolchain Discovery
674
- - Wait and Synchronization Reliability
675
- - Actionability Resolution
676
-
677
- Control Precision & Observability
678
- - Adjustable Control Support
679
- - Adjustable Control Precision Hardening
680
- - Better Compose / Custom Control Semantics
681
- - Signal-Oriented Diagnostic Filtering
682
- - Verification Stabilization and Temporal Convergence
683
-
684
- Interaction Expansion
685
- - Long Press Gesture
686
- - Pinch to Zoom
687
-
688
- Deep Observability
689
- - Advanced Trace Correlation and Analysis
690
-
691
- ## Wave 1 (Current Focus)
692
- - Stronger State Verification
693
- - Richer Element Identity
694
- - Wait and Synchronization Reliability
695
- - Actionability Resolution
696
- - Environment Auto-Configuration and Toolchain Discovery
697
-
698
- Focus:
699
- Make core loop reliable and reduce onboarding friction.
700
-
701
- ---
702
-
703
- ## Wave 2 (Control Precision + Diagnostics)
704
- - Adjustable Control Support
705
- - Adjustable Control Precision Hardening
706
- - Better Compose / Custom Control Semantics
707
- - Signal-Oriented Diagnostic Filtering
708
-
709
- Focus:
710
- Improve control precision, verification convergence, custom control reliability, and signal observability.
711
-
712
- ---
713
-
714
- ## Wave 3 (Interaction Expansion)
715
- - Long Press Gesture
716
-
717
- Focus:
718
- Expand interaction capability after core control reliability is improved.
719
-
720
- ---
721
-
722
- ## Wave 4 (Advanced Gestures + Deep Observability)
723
- - Pinch to Zoom
724
- - Advanced Trace Correlation and Analysis
725
-
726
- Focus:
727
- Advanced gestures + deep observability.
728
-
729
- ---
730
-
731
- # Roadmap Ordering
732
-
733
- Roadmap Ordering:
734
- 1. Stronger State Verification
735
- 2. Richer Element Identity
736
- 3. Wait and Synchronization Reliability
737
- 4. Actionability Resolution
738
- 5. Adjustable Control Support
739
- 6. Adjustable Control Precision Hardening
740
- 7. Environment Auto-Configuration and Toolchain Discovery
741
- 8. Better Compose / Custom Control Semantics
742
- 9. Signal-Oriented Diagnostic Filtering
743
- 10. Long Press Gesture
744
- 11. Pinch to Zoom
745
- 12. Advanced Trace Correlation and Analysis
746
-
747
- Rationale:
748
- - Early roadmap items harden state, targeting, synchronization, environment readiness, and action execution.
749
- - Mid roadmap items improve control precision and signal observability.
750
- - Later interaction-focused items expand interaction coverage.
751
- - Final observability work deepens debugging observability.
752
-
753
- ---
754
-
755
- ## Future Considerations
756
- Still out of scope:
757
-
758
- - Full autonomous recovery planning (deferred until after verification stabilization)
759
- - Autonomous retry strategy
760
- - MCP-level agent orchestration
761
- - Autonomous recovery hinting (future consideration only)
@@ -283,26 +283,13 @@ wait_for_ui_change({
283
283
  deviceId?: string,
284
284
  timeout_ms?: number,
285
285
  stability_window_ms?: number,
286
- expected_change?: string
286
+ expected_change?: string,
287
+ scope?: "screen" | "subtree",
288
+ target?: string
287
289
  })
288
290
  ```
289
291
 
290
- ### Proposed Future Extensions
291
-
292
- The following fields are proposed extensions and are not currently part of the shipped contract:
293
-
294
- ```json
295
- {
296
- "scope": "screen" | "subtree",
297
- "target": "element_id"
298
- }
299
- ```
300
-
301
- These extensions are illustrative and intended to support:
302
-
303
- - subtree synchronization
304
- - scoped convergence
305
- - token-efficient synchronization
292
+ `scope=subtree` requires a target `element_id` and narrows synchronization to the resolved element subtree.
306
293
 
307
294
  ### Semantics
308
295
 
@@ -512,17 +499,12 @@ The current implementation exposes:
512
499
  - `snapshot_revision`
513
500
  - `captured_at_ms`
514
501
  - advisory `loading_state`
502
+ - `scope` and `target` on wait responses
503
+ - `stability_state` and scoped `change_summary` on wait responses
515
504
 
516
505
  The `loading_state` field is currently an advisory structured object rather than a simple enum value.
517
506
 
518
- The implementation does not currently expose explicit freshness states such as:
519
-
520
- - `fresh`
521
- - `stale`
522
- - `transient`
523
- - `stable`
524
-
525
- Those concepts in this RFC describe synchronization semantics rather than currently shipped payload fields.
507
+ Wait responses also include a `snapshot_freshness_ms` age value so callers can reason about freshness without inferring it from revision numbers alone.
526
508
 
527
509
  ### Requirements
528
510
 
@@ -533,15 +515,7 @@ Those concepts in this RFC describe synchronization semantics rather than curren
533
515
 
534
516
  ### Proposed Stability States
535
517
 
536
- Future implementations may expose explicit synchronization stability states.
537
-
538
- Potential states include:
539
-
540
- - `transient`
541
- - `stabilizing`
542
- - `stable`
543
-
544
- These are not currently emitted by the shipped implementation.
518
+ The shipped implementation emits `transient` while a wait is still converging and `stable` once the stabilization window has completed.
545
519
 
546
520
  ---
547
521
 
@@ -586,6 +560,8 @@ Examples:
586
560
  - improve synchronization latency
587
561
  - improve Compose hierarchy handling
588
562
 
563
+ The shipped runtime exposes scope-aware waits and snapshot delta summaries on UI tree and debug snapshot responses to keep this signal lightweight.
564
+
589
565
  ---
590
566
 
591
567
  ## 7.5 Incremental Snapshot Delivery
@@ -599,6 +575,8 @@ Example capabilities:
599
575
  - partial hierarchy refreshes
600
576
  - revision patch delivery
601
577
 
578
+ The shipped runtime currently exposes revision-aware `snapshot_delta` metadata rather than transport-level patch payloads.
579
+
602
580
  ### Dependency
603
581
 
604
582
  Incremental synchronization depends on stable element identity semantics.
@@ -826,6 +804,8 @@ Introduce:
826
804
  - diff-based synchronization
827
805
  - subtree invalidation
828
806
 
807
+ The runtime now exposes scoped diff summaries for waits, but full partial-hierarchy patch delivery remains a future protocol extension.
808
+
829
809
  ---
830
810
 
831
811
  ## Phase 4
@@ -887,4 +867,4 @@ This RFC introduces explicit synchronization semantics that:
887
867
  - establish consistent sequencing expectations
888
868
  - create a foundation for incremental synchronization capabilities
889
869
 
890
- These changes are intended to improve reliability, reduce retries, and make agent behavior substantially more predictable across asynchronous mobile UI frameworks.
870
+ These changes are intended to improve reliability, reduce retries, and make agent behavior substantially more predictable across asynchronous mobile UI frameworks.