mobile-debug-mcp 0.26.5 → 0.27.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 +352 -185
- package/dist/server/common.js +39 -0
- package/dist/server-core.js +1 -1
- package/docs/CHANGELOG.md +3 -0
- package/docs/ROADMAP.md +109 -11
- package/docs/rfcs/010-verification-stabilization-and-temporal-convergence.md +265 -0
- package/docs/rfcs/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows.md +321 -0
- package/docs/rfcs/011.1-recovery-contract-types-and-runtime-wiring-spec.md +253 -0
- package/docs/rfcs/012.md +203 -0
- package/docs/specs/mcp-tooling-spec-v1.md +12 -0
- package/docs/tools/interact.md +10 -0
- package/package.json +1 -1
- package/src/interact/index.ts +393 -186
- package/src/server/common.ts +44 -1
- package/src/server-core.ts +1 -1
- package/src/types.ts +36 -0
- package/test/unit/interact/adjust_control.test.ts +77 -1
- package/test/unit/interact/verification_stabilization.test.ts +94 -0
- package/test/unit/server/common.test.ts +36 -1
package/docs/rfcs/012.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# RFC 012 — Action Trace and Execution Observability
|
|
5
|
+
|
|
6
|
+
## 1. Summary
|
|
7
|
+
|
|
8
|
+
This RFC defines a structured execution trace model for all actions within the MCP runtime. It provides visibility into resolution, execution, verification, stabilization, and recovery stages.
|
|
9
|
+
|
|
10
|
+
The goal is to make system behavior explainable, debuggable, and measurable without altering execution semantics.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 2. Problem Statement
|
|
15
|
+
|
|
16
|
+
As the system has evolved (RFC 005–011), execution has become more reliable but also more opaque due to:
|
|
17
|
+
|
|
18
|
+
- stabilization loops masking transient failures
|
|
19
|
+
- recovery logic retrying actions without visibility
|
|
20
|
+
- multiple execution stages (resolve → execute → verify → stabilize → recover)
|
|
21
|
+
|
|
22
|
+
Current outputs provide final results but lack a structured explanation of how those results were reached.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 3. Goals
|
|
27
|
+
|
|
28
|
+
This RFC introduces an execution trace model that MUST:
|
|
29
|
+
|
|
30
|
+
- provide a step-by-step record of action execution
|
|
31
|
+
- expose resolution, execution, verification, stabilization, and recovery stages
|
|
32
|
+
- remain deterministic and low-overhead
|
|
33
|
+
- be consistent across all tools and handlers
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 4. Non-Goals
|
|
38
|
+
|
|
39
|
+
This RFC does NOT define:
|
|
40
|
+
|
|
41
|
+
- external logging systems
|
|
42
|
+
- UI visualization layers
|
|
43
|
+
- distributed tracing infrastructure
|
|
44
|
+
|
|
45
|
+
It is strictly an in-process observability model.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 5. Runtime Surfaces
|
|
50
|
+
|
|
51
|
+
Trace data MUST be emitted from:
|
|
52
|
+
|
|
53
|
+
- src/server (resolution)
|
|
54
|
+
- src/interact (execution and verification)
|
|
55
|
+
- stabilization layer (RFC 010)
|
|
56
|
+
- recovery layer (RFC 011)
|
|
57
|
+
|
|
58
|
+
All action flows MUST produce a trace.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 6. Trace Model
|
|
63
|
+
|
|
64
|
+
### 6.1 ActionTrace
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
interface ActionTrace {
|
|
68
|
+
action_id: string;
|
|
69
|
+
steps: TraceStep[];
|
|
70
|
+
final_outcome: "success" | "failure";
|
|
71
|
+
attempts: number;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 6.2 TraceStep
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
interface TraceStep {
|
|
79
|
+
stage: "resolve" | "execute" | "verify" | "stabilize" | "recover";
|
|
80
|
+
timestamp: number;
|
|
81
|
+
result: "success" | "failure" | "retry";
|
|
82
|
+
metadata?: Record<string, any>;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 7. Stage Emission Rules
|
|
89
|
+
|
|
90
|
+
### 7.1 Resolve Stage
|
|
91
|
+
|
|
92
|
+
- emitted by findElementHandler and related resolution logic
|
|
93
|
+
- includes selector, matched element, and confidence (if available)
|
|
94
|
+
|
|
95
|
+
### 7.2 Execute Stage
|
|
96
|
+
|
|
97
|
+
- emitted by action handlers (tap, type_text, scroll_to_element, etc.)
|
|
98
|
+
- represents the execution attempt
|
|
99
|
+
|
|
100
|
+
### 7.3 Verify Stage
|
|
101
|
+
|
|
102
|
+
- emitted by expect_* handlers
|
|
103
|
+
- reflects state validation results
|
|
104
|
+
|
|
105
|
+
### 7.4 Stabilize Stage
|
|
106
|
+
|
|
107
|
+
- emitted by RFC 010 stabilization logic
|
|
108
|
+
- includes stabilization attempts and convergence status
|
|
109
|
+
|
|
110
|
+
### 7.5 Recover Stage
|
|
111
|
+
|
|
112
|
+
- emitted by RFC 011 recovery logic
|
|
113
|
+
- includes strategy used and retry attempts
|
|
114
|
+
|
|
115
|
+
### 7.6 Step Emission Timing
|
|
116
|
+
|
|
117
|
+
Each stage MUST emit a TraceStep at the point where its outcome is determined:
|
|
118
|
+
|
|
119
|
+
- resolve: after target selection is finalized
|
|
120
|
+
- execute: after action handler completes (success or failure)
|
|
121
|
+
- verify: after verification result is computed
|
|
122
|
+
- stabilize: after stabilization loop completes (success or failure)
|
|
123
|
+
- recover: after a recovery attempt is decided and executed
|
|
124
|
+
|
|
125
|
+
Each retry or re-attempt MUST emit a separate step.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 8. Deterministic Behavior
|
|
130
|
+
|
|
131
|
+
Trace emission MUST NOT:
|
|
132
|
+
|
|
133
|
+
- alter execution flow
|
|
134
|
+
- introduce timing side effects
|
|
135
|
+
- affect success/failure outcomes
|
|
136
|
+
|
|
137
|
+
It is strictly observational.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 9. Minimal Metadata Contract
|
|
142
|
+
|
|
143
|
+
Implementations SHOULD include where available:
|
|
144
|
+
|
|
145
|
+
- selector or target identifier
|
|
146
|
+
- snapshot identifiers
|
|
147
|
+
- stabilization attempt counts
|
|
148
|
+
- recovery strategy name
|
|
149
|
+
|
|
150
|
+
Metadata MUST remain lightweight.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 10. Integration with Existing RFCs
|
|
155
|
+
|
|
156
|
+
- RFC 006: execution emits execute stage
|
|
157
|
+
- RFC 007: resolution emits resolve stage
|
|
158
|
+
- RFC 010: stabilization emits stabilize stage
|
|
159
|
+
- RFC 011: recovery emits recover stage
|
|
160
|
+
|
|
161
|
+
This RFC unifies these into a single trace model.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 11. Output Behavior
|
|
166
|
+
|
|
167
|
+
Trace MAY be returned as part of action results or stored internally.
|
|
168
|
+
|
|
169
|
+
Example:
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
interface ActionExecutionResult {
|
|
173
|
+
success: boolean;
|
|
174
|
+
failure_code?: string;
|
|
175
|
+
trace?: ActionTrace;
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 12. Failure Analysis
|
|
182
|
+
|
|
183
|
+
Trace data MUST allow identification of:
|
|
184
|
+
|
|
185
|
+
- resolution failures
|
|
186
|
+
- execution failures
|
|
187
|
+
- verification mismatches
|
|
188
|
+
- stabilization convergence issues
|
|
189
|
+
- recovery attempts and outcomes
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 13. Success Metrics
|
|
194
|
+
|
|
195
|
+
- improved debuggability of failures
|
|
196
|
+
- reduced need for manual log inspection
|
|
197
|
+
- clearer differentiation between failure types
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 14. Summary
|
|
202
|
+
|
|
203
|
+
This RFC introduces a structured trace model that makes action execution transparent and debuggable. It builds on existing RFCs without changing behavior, enabling better diagnostics and future analytics capabilities.
|
|
@@ -80,6 +80,17 @@ MUST be returned in this structure:
|
|
|
80
80
|
ui_fingerprint_after: string | null,
|
|
81
81
|
failure_code?: string,
|
|
82
82
|
retryable?: boolean,
|
|
83
|
+
recovery?: {
|
|
84
|
+
failure_class: string,
|
|
85
|
+
runtime_code: string,
|
|
86
|
+
recovery_strategy?: string,
|
|
87
|
+
recovery_attempts: number,
|
|
88
|
+
max_recovery_attempts: number,
|
|
89
|
+
retry_depth: number,
|
|
90
|
+
max_retry_depth: number,
|
|
91
|
+
is_terminal: boolean,
|
|
92
|
+
retry_allowed?: boolean
|
|
93
|
+
},
|
|
83
94
|
device?: DeviceInfo,
|
|
84
95
|
details?: object
|
|
85
96
|
}
|
|
@@ -93,6 +104,7 @@ Rules:
|
|
|
93
104
|
- `source_module` identifies where the envelope was produced
|
|
94
105
|
- fingerprints represent observed pre/post UI state on a best-effort basis
|
|
95
106
|
- `failure_code` is optional but MUST be used when a structured mapping exists
|
|
107
|
+
- `recovery` MAY be attached to failed actions to carry typed recovery metadata
|
|
96
108
|
|
|
97
109
|
### 4.4 Allowed Deviations
|
|
98
110
|
|
package/docs/tools/interact.md
CHANGED
|
@@ -395,6 +395,16 @@ Failure response:
|
|
|
395
395
|
"success": false,
|
|
396
396
|
"failure_code": "STALE_REFERENCE",
|
|
397
397
|
"retryable": true,
|
|
398
|
+
"recovery": {
|
|
399
|
+
"failure_class": "TargetResolutionFailure",
|
|
400
|
+
"runtime_code": "STALE_REFERENCE",
|
|
401
|
+
"recovery_attempts": 0,
|
|
402
|
+
"max_recovery_attempts": 3,
|
|
403
|
+
"retry_depth": 0,
|
|
404
|
+
"max_retry_depth": 3,
|
|
405
|
+
"is_terminal": false,
|
|
406
|
+
"retry_allowed": true
|
|
407
|
+
},
|
|
398
408
|
"ui_fingerprint_before": "fp_before",
|
|
399
409
|
"ui_fingerprint_after": "fp_before"
|
|
400
410
|
}
|