devlens-mcp 0.3.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 (175) hide show
  1. package/.claude/settings.json +12 -0
  2. package/.claude/settings.local.json +17 -0
  3. package/INSTALLATION_GUIDE.md +354 -0
  4. package/QUICK_START.md +153 -0
  5. package/README.md +354 -0
  6. package/bin/cli.ts +22 -0
  7. package/bin/register.ts +96 -0
  8. package/dist/bin/cli.d.ts +3 -0
  9. package/dist/bin/cli.d.ts.map +1 -0
  10. package/dist/bin/cli.js +20 -0
  11. package/dist/bin/cli.js.map +1 -0
  12. package/dist/bin/register.d.ts +10 -0
  13. package/dist/bin/register.d.ts.map +1 -0
  14. package/dist/bin/register.js +92 -0
  15. package/dist/bin/register.js.map +1 -0
  16. package/dist/src/config/devlens-config.d.ts +92 -0
  17. package/dist/src/config/devlens-config.d.ts.map +1 -0
  18. package/dist/src/config/devlens-config.js +70 -0
  19. package/dist/src/config/devlens-config.js.map +1 -0
  20. package/dist/src/index.d.ts +35 -0
  21. package/dist/src/index.d.ts.map +1 -0
  22. package/dist/src/index.js +8 -0
  23. package/dist/src/index.js.map +1 -0
  24. package/dist/src/metro/cdp-client.d.ts +48 -0
  25. package/dist/src/metro/cdp-client.d.ts.map +1 -0
  26. package/dist/src/metro/cdp-client.js +127 -0
  27. package/dist/src/metro/cdp-client.js.map +1 -0
  28. package/dist/src/metro/log-collector.d.ts +30 -0
  29. package/dist/src/metro/log-collector.d.ts.map +1 -0
  30. package/dist/src/metro/log-collector.js +114 -0
  31. package/dist/src/metro/log-collector.js.map +1 -0
  32. package/dist/src/metro/metro-bridge.d.ts +56 -0
  33. package/dist/src/metro/metro-bridge.d.ts.map +1 -0
  34. package/dist/src/metro/metro-bridge.js +255 -0
  35. package/dist/src/metro/metro-bridge.js.map +1 -0
  36. package/dist/src/metro/network-inspector.d.ts +34 -0
  37. package/dist/src/metro/network-inspector.d.ts.map +1 -0
  38. package/dist/src/metro/network-inspector.js +100 -0
  39. package/dist/src/metro/network-inspector.js.map +1 -0
  40. package/dist/src/platform/android/adb.d.ts +50 -0
  41. package/dist/src/platform/android/adb.d.ts.map +1 -0
  42. package/dist/src/platform/android/adb.js +137 -0
  43. package/dist/src/platform/android/adb.js.map +1 -0
  44. package/dist/src/platform/android/android-device.d.ts +21 -0
  45. package/dist/src/platform/android/android-device.d.ts.map +1 -0
  46. package/dist/src/platform/android/android-device.js +94 -0
  47. package/dist/src/platform/android/android-device.js.map +1 -0
  48. package/dist/src/platform/android/ui-automator.d.ts +17 -0
  49. package/dist/src/platform/android/ui-automator.d.ts.map +1 -0
  50. package/dist/src/platform/android/ui-automator.js +126 -0
  51. package/dist/src/platform/android/ui-automator.js.map +1 -0
  52. package/dist/src/platform/device-manager.d.ts +28 -0
  53. package/dist/src/platform/device-manager.d.ts.map +1 -0
  54. package/dist/src/platform/device-manager.js +185 -0
  55. package/dist/src/platform/device-manager.js.map +1 -0
  56. package/dist/src/platform/device.d.ts +86 -0
  57. package/dist/src/platform/device.d.ts.map +1 -0
  58. package/dist/src/platform/device.js +7 -0
  59. package/dist/src/platform/device.js.map +1 -0
  60. package/dist/src/platform/ios/accessibility.d.ts +17 -0
  61. package/dist/src/platform/ios/accessibility.d.ts.map +1 -0
  62. package/dist/src/platform/ios/accessibility.js +159 -0
  63. package/dist/src/platform/ios/accessibility.js.map +1 -0
  64. package/dist/src/platform/ios/ios-device.d.ts +22 -0
  65. package/dist/src/platform/ios/ios-device.d.ts.map +1 -0
  66. package/dist/src/platform/ios/ios-device.js +97 -0
  67. package/dist/src/platform/ios/ios-device.js.map +1 -0
  68. package/dist/src/platform/ios/simctl.d.ts +54 -0
  69. package/dist/src/platform/ios/simctl.d.ts.map +1 -0
  70. package/dist/src/platform/ios/simctl.js +192 -0
  71. package/dist/src/platform/ios/simctl.js.map +1 -0
  72. package/dist/src/server.d.ts +3 -0
  73. package/dist/src/server.d.ts.map +1 -0
  74. package/dist/src/server.js +176 -0
  75. package/dist/src/server.js.map +1 -0
  76. package/dist/src/snapshot/formatter.d.ts +18 -0
  77. package/dist/src/snapshot/formatter.d.ts.map +1 -0
  78. package/dist/src/snapshot/formatter.js +86 -0
  79. package/dist/src/snapshot/formatter.js.map +1 -0
  80. package/dist/src/snapshot/ref-registry.d.ts +67 -0
  81. package/dist/src/snapshot/ref-registry.d.ts.map +1 -0
  82. package/dist/src/snapshot/ref-registry.js +169 -0
  83. package/dist/src/snapshot/ref-registry.js.map +1 -0
  84. package/dist/src/snapshot/snapshot-differ.d.ts +57 -0
  85. package/dist/src/snapshot/snapshot-differ.d.ts.map +1 -0
  86. package/dist/src/snapshot/snapshot-differ.js +153 -0
  87. package/dist/src/snapshot/snapshot-differ.js.map +1 -0
  88. package/dist/src/tools/app-tools.d.ts +71 -0
  89. package/dist/src/tools/app-tools.d.ts.map +1 -0
  90. package/dist/src/tools/app-tools.js +97 -0
  91. package/dist/src/tools/app-tools.js.map +1 -0
  92. package/dist/src/tools/device-tools.d.ts +53 -0
  93. package/dist/src/tools/device-tools.d.ts.map +1 -0
  94. package/dist/src/tools/device-tools.js +86 -0
  95. package/dist/src/tools/device-tools.js.map +1 -0
  96. package/dist/src/tools/ds-tools.d.ts +65 -0
  97. package/dist/src/tools/ds-tools.d.ts.map +1 -0
  98. package/dist/src/tools/ds-tools.js +314 -0
  99. package/dist/src/tools/ds-tools.js.map +1 -0
  100. package/dist/src/tools/interaction-tools.d.ts +248 -0
  101. package/dist/src/tools/interaction-tools.d.ts.map +1 -0
  102. package/dist/src/tools/interaction-tools.js +391 -0
  103. package/dist/src/tools/interaction-tools.js.map +1 -0
  104. package/dist/src/tools/metro-tools.d.ts +115 -0
  105. package/dist/src/tools/metro-tools.d.ts.map +1 -0
  106. package/dist/src/tools/metro-tools.js +270 -0
  107. package/dist/src/tools/metro-tools.js.map +1 -0
  108. package/dist/src/tools/navigation-tools.d.ts +36 -0
  109. package/dist/src/tools/navigation-tools.d.ts.map +1 -0
  110. package/dist/src/tools/navigation-tools.js +60 -0
  111. package/dist/src/tools/navigation-tools.js.map +1 -0
  112. package/dist/src/tools/screenshot-tools.d.ts +298 -0
  113. package/dist/src/tools/screenshot-tools.d.ts.map +1 -0
  114. package/dist/src/tools/screenshot-tools.js +565 -0
  115. package/dist/src/tools/screenshot-tools.js.map +1 -0
  116. package/dist/src/tools/snapshot-tools.d.ts +161 -0
  117. package/dist/src/tools/snapshot-tools.d.ts.map +1 -0
  118. package/dist/src/tools/snapshot-tools.js +479 -0
  119. package/dist/src/tools/snapshot-tools.js.map +1 -0
  120. package/dist/src/utils/image-preprocess.d.ts +49 -0
  121. package/dist/src/utils/image-preprocess.d.ts.map +1 -0
  122. package/dist/src/utils/image-preprocess.js +322 -0
  123. package/dist/src/utils/image-preprocess.js.map +1 -0
  124. package/dist/src/utils/retry.d.ts +21 -0
  125. package/dist/src/utils/retry.d.ts.map +1 -0
  126. package/dist/src/utils/retry.js +33 -0
  127. package/dist/src/utils/retry.js.map +1 -0
  128. package/dist/src/visual/comparator.d.ts +51 -0
  129. package/dist/src/visual/comparator.d.ts.map +1 -0
  130. package/dist/src/visual/comparator.js +119 -0
  131. package/dist/src/visual/comparator.js.map +1 -0
  132. package/dist/src/visual/layout-analyzer.d.ts +64 -0
  133. package/dist/src/visual/layout-analyzer.d.ts.map +1 -0
  134. package/dist/src/visual/layout-analyzer.js +198 -0
  135. package/dist/src/visual/layout-analyzer.js.map +1 -0
  136. package/dist/src/visual/screenshot.d.ts +17 -0
  137. package/dist/src/visual/screenshot.d.ts.map +1 -0
  138. package/dist/src/visual/screenshot.js +39 -0
  139. package/dist/src/visual/screenshot.js.map +1 -0
  140. package/docs/figma-workflow.md +289 -0
  141. package/docs/setup-guide.md +360 -0
  142. package/docs/tool-reference.md +622 -0
  143. package/package.json +57 -0
  144. package/src/config/devlens-config.ts +76 -0
  145. package/src/index.ts +5 -0
  146. package/src/metro/cdp-client.ts +160 -0
  147. package/src/metro/log-collector.ts +137 -0
  148. package/src/metro/metro-bridge.ts +307 -0
  149. package/src/metro/network-inspector.ts +134 -0
  150. package/src/platform/android/adb.ts +200 -0
  151. package/src/platform/android/android-device.ts +116 -0
  152. package/src/platform/android/ui-automator.ts +141 -0
  153. package/src/platform/device-manager.ts +229 -0
  154. package/src/platform/device.ts +110 -0
  155. package/src/platform/ios/accessibility.ts +189 -0
  156. package/src/platform/ios/ios-device.ts +116 -0
  157. package/src/platform/ios/simctl.ts +244 -0
  158. package/src/server.ts +228 -0
  159. package/src/snapshot/formatter.ts +102 -0
  160. package/src/snapshot/ref-registry.ts +230 -0
  161. package/src/snapshot/snapshot-differ.ts +220 -0
  162. package/src/tools/app-tools.ts +111 -0
  163. package/src/tools/device-tools.ts +96 -0
  164. package/src/tools/ds-tools.ts +395 -0
  165. package/src/tools/interaction-tools.ts +467 -0
  166. package/src/tools/metro-tools.ts +320 -0
  167. package/src/tools/navigation-tools.ts +71 -0
  168. package/src/tools/screenshot-tools.ts +698 -0
  169. package/src/tools/snapshot-tools.ts +585 -0
  170. package/src/utils/image-preprocess.ts +430 -0
  171. package/src/utils/retry.ts +51 -0
  172. package/src/visual/comparator.ts +191 -0
  173. package/src/visual/layout-analyzer.ts +283 -0
  174. package/src/visual/screenshot.ts +49 -0
  175. package/tsconfig.json +20 -0
@@ -0,0 +1,391 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.interactionToolSchemas = void 0;
4
+ exports.createInteractionToolHandlers = createInteractionToolHandlers;
5
+ const zod_1 = require("zod");
6
+ const formatter_js_1 = require("../snapshot/formatter.js");
7
+ const screenshot_js_1 = require("../visual/screenshot.js");
8
+ exports.interactionToolSchemas = {
9
+ devlens_tap: {
10
+ description: "Tap an element on screen by its ref ID. Like Playwright's browser_click. Always provide the element description alongside the ref for safety.",
11
+ parameters: zod_1.z.object({
12
+ ref: zod_1.z
13
+ .string()
14
+ .describe("Element ref from devlens_snapshot (e.g., e1, e5)"),
15
+ element: zod_1.z
16
+ .string()
17
+ .describe("Human-readable description of what you're tapping (e.g., 'Submit button')"),
18
+ }),
19
+ },
20
+ devlens_type: {
21
+ description: "Type text into the currently focused input element. Use devlens_tap first to focus an input, then devlens_type to enter text.",
22
+ parameters: zod_1.z.object({
23
+ ref: zod_1.z.string().describe("Ref of the input element to type into"),
24
+ text: zod_1.z.string().describe("Text to type"),
25
+ submit: zod_1.z
26
+ .boolean()
27
+ .default(false)
28
+ .describe("Press Enter/Return after typing (default: false)"),
29
+ }),
30
+ },
31
+ devlens_swipe: {
32
+ description: "Perform a swipe gesture on the screen. If ref is provided, swipes from that element's center. Otherwise swipes from screen center.",
33
+ parameters: zod_1.z.object({
34
+ direction: zod_1.z
35
+ .enum(["up", "down", "left", "right"])
36
+ .describe("Swipe direction"),
37
+ ref: zod_1.z
38
+ .string()
39
+ .optional()
40
+ .describe("Optional ref to swipe from (swipes from element center)"),
41
+ distance: zod_1.z
42
+ .number()
43
+ .default(500)
44
+ .describe("Swipe distance in pixels (default: 500)"),
45
+ }),
46
+ },
47
+ devlens_scroll: {
48
+ description: "Scroll a scrollable container up or down. Provide the ref of the scrollable element (like a ScrollView or FlatList).",
49
+ parameters: zod_1.z.object({
50
+ ref: zod_1.z.string().describe("Ref of the scrollable container"),
51
+ direction: zod_1.z.enum(["up", "down"]).describe("Scroll direction"),
52
+ }),
53
+ },
54
+ devlens_long_press: {
55
+ description: "Long press an element by ref. Useful for context menus and drag initiation.",
56
+ parameters: zod_1.z.object({
57
+ ref: zod_1.z.string().describe("Element ref to long press"),
58
+ duration: zod_1.z
59
+ .number()
60
+ .default(1000)
61
+ .describe("Press duration in milliseconds (default: 1000)"),
62
+ }),
63
+ },
64
+ devlens_press_button: {
65
+ description: 'Press a hardware/system button. "home" goes to home screen, "back" navigates back, "enter" confirms input.',
66
+ parameters: zod_1.z.object({
67
+ button: zod_1.z
68
+ .enum(["home", "back", "enter"])
69
+ .describe("Button to press"),
70
+ }),
71
+ },
72
+ devlens_fill_form: {
73
+ description: "Fill multiple form fields at once. Taps each field and types the value. More efficient than individual tap+type calls.",
74
+ parameters: zod_1.z.object({
75
+ fields: zod_1.z
76
+ .array(zod_1.z.object({
77
+ ref: zod_1.z.string().describe("Ref of the input field"),
78
+ value: zod_1.z.string().describe("Value to type into the field"),
79
+ }))
80
+ .describe("Array of {ref, value} pairs to fill"),
81
+ }),
82
+ },
83
+ devlens_capture_flow: {
84
+ description: "Execute a sequence of actions and capture labeled screenshots along the way. Useful for batch-verifying multiple screens in a single tool call (e.g., tap tab 1 → screenshot → tap tab 2 → screenshot → go back). Returns all labeled screenshots and a final snapshot.",
85
+ parameters: zod_1.z.object({
86
+ steps: zod_1.z
87
+ .array(zod_1.z.object({
88
+ action: zod_1.z
89
+ .enum([
90
+ "tap",
91
+ "screenshot",
92
+ "go_back",
93
+ "swipe",
94
+ "wait",
95
+ "press_button",
96
+ ])
97
+ .describe("Action to perform"),
98
+ ref: zod_1.z
99
+ .string()
100
+ .optional()
101
+ .describe("Element ref for tap/swipe actions"),
102
+ element: zod_1.z
103
+ .string()
104
+ .optional()
105
+ .describe("Human description for tap action"),
106
+ label: zod_1.z
107
+ .string()
108
+ .optional()
109
+ .describe("Label for screenshots taken in this step. Only used with action='screenshot'."),
110
+ direction: zod_1.z
111
+ .enum(["up", "down", "left", "right"])
112
+ .optional()
113
+ .describe("Direction for swipe action"),
114
+ button: zod_1.z
115
+ .enum(["home", "back", "enter"])
116
+ .optional()
117
+ .describe("Button for press_button action"),
118
+ ms: zod_1.z
119
+ .number()
120
+ .optional()
121
+ .describe("Milliseconds to wait (for wait action, default: 1000)"),
122
+ }))
123
+ .describe("Sequence of actions to execute"),
124
+ }),
125
+ },
126
+ };
127
+ function createInteractionToolHandlers(deviceManager, refRegistry, onNavigate) {
128
+ /** Helper: resolve ref to coordinates, throw clear error if not found */
129
+ function resolveRef(ref) {
130
+ const entry = refRegistry.resolve(ref);
131
+ if (!entry) {
132
+ throw new Error(`Ref "${ref}" not found. Run devlens_snapshot first to get current element refs.`);
133
+ }
134
+ return { x: entry.centerX, y: entry.centerY };
135
+ }
136
+ /** Helper: take a new snapshot and return formatted text */
137
+ async function getUpdatedSnapshot() {
138
+ const device = await deviceManager.getDevice();
139
+ // Small delay for UI to settle after interaction
140
+ await sleep(300);
141
+ const snapshot = await device.getSnapshot();
142
+ const nodeToRef = refRegistry.assignRefs(snapshot);
143
+ return (0, formatter_js_1.formatSnapshot)(snapshot, nodeToRef);
144
+ }
145
+ return {
146
+ devlens_tap: async (params) => {
147
+ const { x, y } = resolveRef(params.ref);
148
+ const device = await deviceManager.getDevice();
149
+ await device.tap(x, y);
150
+ onNavigate?.();
151
+ const snapshot = await getUpdatedSnapshot();
152
+ return {
153
+ content: [
154
+ {
155
+ type: "text",
156
+ text: `Tapped "${params.element}" [${params.ref}] at (${Math.round(x)}, ${Math.round(y)})\n\n${snapshot}`,
157
+ },
158
+ ],
159
+ };
160
+ },
161
+ devlens_type: async (params) => {
162
+ const { x, y } = resolveRef(params.ref);
163
+ const device = await deviceManager.getDevice();
164
+ // Tap to focus the input first
165
+ await device.tap(x, y);
166
+ await sleep(200);
167
+ // Type the text
168
+ await device.typeText(params.text);
169
+ if (params.submit) {
170
+ await device.pressButton("enter");
171
+ }
172
+ const snapshot = await getUpdatedSnapshot();
173
+ return {
174
+ content: [
175
+ {
176
+ type: "text",
177
+ text: `Typed "${params.text}" into [${params.ref}]${params.submit ? " and submitted" : ""}\n\n${snapshot}`,
178
+ },
179
+ ],
180
+ };
181
+ },
182
+ devlens_swipe: async (params) => {
183
+ const device = await deviceManager.getDevice();
184
+ const info = await device.getInfo();
185
+ let startX, startY;
186
+ if (params.ref) {
187
+ const coords = resolveRef(params.ref);
188
+ startX = coords.x;
189
+ startY = coords.y;
190
+ }
191
+ else {
192
+ startX = info.screenWidth / 2;
193
+ startY = info.screenHeight / 2;
194
+ }
195
+ const directionMap = {
196
+ up: { endX: startX, endY: startY - params.distance },
197
+ down: { endX: startX, endY: startY + params.distance },
198
+ left: { endX: startX - params.distance, endY: startY },
199
+ right: { endX: startX + params.distance, endY: startY },
200
+ };
201
+ const { endX, endY } = directionMap[params.direction];
202
+ await device.swipe(startX, startY, endX, endY);
203
+ onNavigate?.();
204
+ const snapshot = await getUpdatedSnapshot();
205
+ return {
206
+ content: [
207
+ {
208
+ type: "text",
209
+ text: `Swiped ${params.direction}${params.ref ? ` from [${params.ref}]` : ""}\n\n${snapshot}`,
210
+ },
211
+ ],
212
+ };
213
+ },
214
+ devlens_scroll: async (params) => {
215
+ const { x, y } = resolveRef(params.ref);
216
+ const device = await deviceManager.getDevice();
217
+ const scrollDistance = 400;
218
+ if (params.direction === "down") {
219
+ await device.swipe(x, y, x, y - scrollDistance, 300);
220
+ }
221
+ else {
222
+ await device.swipe(x, y, x, y + scrollDistance, 300);
223
+ }
224
+ const snapshot = await getUpdatedSnapshot();
225
+ return {
226
+ content: [
227
+ {
228
+ type: "text",
229
+ text: `Scrolled ${params.direction} in [${params.ref}]\n\n${snapshot}`,
230
+ },
231
+ ],
232
+ };
233
+ },
234
+ devlens_long_press: async (params) => {
235
+ const { x, y } = resolveRef(params.ref);
236
+ const device = await deviceManager.getDevice();
237
+ await device.longPress(x, y, params.duration);
238
+ const snapshot = await getUpdatedSnapshot();
239
+ return {
240
+ content: [
241
+ {
242
+ type: "text",
243
+ text: `Long pressed [${params.ref}] for ${params.duration}ms\n\n${snapshot}`,
244
+ },
245
+ ],
246
+ };
247
+ },
248
+ devlens_press_button: async (params) => {
249
+ const device = await deviceManager.getDevice();
250
+ await device.pressButton(params.button);
251
+ onNavigate?.();
252
+ const snapshot = await getUpdatedSnapshot();
253
+ return {
254
+ content: [
255
+ {
256
+ type: "text",
257
+ text: `Pressed ${params.button} button\n\n${snapshot}`,
258
+ },
259
+ ],
260
+ };
261
+ },
262
+ devlens_fill_form: async (params) => {
263
+ const device = await deviceManager.getDevice();
264
+ for (const field of params.fields) {
265
+ const { x, y } = resolveRef(field.ref);
266
+ await device.tap(x, y);
267
+ await sleep(200);
268
+ await device.typeText(field.value);
269
+ await sleep(100);
270
+ }
271
+ const snapshot = await getUpdatedSnapshot();
272
+ return {
273
+ content: [
274
+ {
275
+ type: "text",
276
+ text: `Filled ${params.fields.length} form field(s):\n${params.fields.map((f) => ` [${f.ref}] = "${f.value}"`).join("\n")}\n\n${snapshot}`,
277
+ },
278
+ ],
279
+ };
280
+ },
281
+ devlens_capture_flow: async (params) => {
282
+ const device = await deviceManager.getDevice();
283
+ const screenshots = [];
284
+ const log = [];
285
+ for (let i = 0; i < params.steps.length; i++) {
286
+ const step = params.steps[i];
287
+ const stepNum = i + 1;
288
+ switch (step.action) {
289
+ case "tap": {
290
+ if (!step.ref) {
291
+ log.push(`Step ${stepNum}: tap — SKIPPED (no ref provided)`);
292
+ break;
293
+ }
294
+ const { x, y } = resolveRef(step.ref);
295
+ await device.tap(x, y);
296
+ onNavigate?.();
297
+ await sleep(300);
298
+ log.push(`Step ${stepNum}: tap [${step.ref}]${step.element ? ` "${step.element}"` : ""} at (${Math.round(x)}, ${Math.round(y)})`);
299
+ break;
300
+ }
301
+ case "screenshot": {
302
+ const { base64 } = await (0, screenshot_js_1.captureScreenshot)(device);
303
+ const label = step.label || `screenshot-${screenshots.length + 1}`;
304
+ screenshots.push({ label, base64 });
305
+ log.push(`Step ${stepNum}: screenshot "${label}"`);
306
+ break;
307
+ }
308
+ case "go_back": {
309
+ await device.pressButton("back");
310
+ onNavigate?.();
311
+ await sleep(500);
312
+ log.push(`Step ${stepNum}: go_back`);
313
+ break;
314
+ }
315
+ case "swipe": {
316
+ const dir = step.direction || "up";
317
+ const info = await device.getInfo();
318
+ let startX, startY;
319
+ if (step.ref) {
320
+ const coords = resolveRef(step.ref);
321
+ startX = coords.x;
322
+ startY = coords.y;
323
+ }
324
+ else {
325
+ startX = info.screenWidth / 2;
326
+ startY = info.screenHeight / 2;
327
+ }
328
+ const dist = 500;
329
+ const dirMap = {
330
+ up: { endX: startX, endY: startY - dist },
331
+ down: { endX: startX, endY: startY + dist },
332
+ left: { endX: startX - dist, endY: startY },
333
+ right: { endX: startX + dist, endY: startY },
334
+ };
335
+ const { endX, endY } = dirMap[dir];
336
+ await device.swipe(startX, startY, endX, endY);
337
+ onNavigate?.();
338
+ await sleep(300);
339
+ log.push(`Step ${stepNum}: swipe ${dir}${step.ref ? ` from [${step.ref}]` : ""}`);
340
+ break;
341
+ }
342
+ case "wait": {
343
+ const waitMs = step.ms || 1000;
344
+ await sleep(waitMs);
345
+ log.push(`Step ${stepNum}: wait ${waitMs}ms`);
346
+ break;
347
+ }
348
+ case "press_button": {
349
+ const btn = step.button || "back";
350
+ await device.pressButton(btn);
351
+ onNavigate?.();
352
+ await sleep(300);
353
+ log.push(`Step ${stepNum}: press_button "${btn}"`);
354
+ break;
355
+ }
356
+ }
357
+ }
358
+ // Take final snapshot
359
+ const finalSnapshot = await device.getSnapshot();
360
+ const nodeToRef = refRegistry.assignRefs(finalSnapshot);
361
+ const formattedSnapshot = (0, formatter_js_1.formatSnapshot)(finalSnapshot, nodeToRef);
362
+ // Build content blocks
363
+ const content = [
364
+ {
365
+ type: "text",
366
+ text: `Flow completed (${params.steps.length} steps, ${screenshots.length} screenshots):\n\n${log.join("\n")}`,
367
+ },
368
+ ];
369
+ for (const ss of screenshots) {
370
+ content.push({
371
+ type: "text",
372
+ text: `--- ${ss.label} ---`,
373
+ });
374
+ content.push({
375
+ type: "image",
376
+ data: ss.base64,
377
+ mimeType: "image/png",
378
+ });
379
+ }
380
+ content.push({
381
+ type: "text",
382
+ text: `\n--- Final Snapshot ---\n${formattedSnapshot}\n\n${refRegistry.size} elements with refs.`,
383
+ });
384
+ return { content };
385
+ },
386
+ };
387
+ }
388
+ function sleep(ms) {
389
+ return new Promise((resolve) => setTimeout(resolve, ms));
390
+ }
391
+ //# sourceMappingURL=interaction-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction-tools.js","sourceRoot":"","sources":["../../../src/tools/interaction-tools.ts"],"names":[],"mappings":";;;AA4IA,sEA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AAC;YAED,sBAAsB;YACtB,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,SAAS,GAAG,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YACxD,MAAM,iBAAiB,GAAG,IAAA,6BAAc,EAAC,aAAa,EAAE,SAAS,CAAC,CAAC;YAEnE,uBAAuB;YACvB,MAAM,OAAO,GAAuF;gBAClG;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,mBAAmB,MAAM,CAAC,KAAK,CAAC,MAAM,WAAW,WAAW,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;iBAC/G;aACF,CAAC;YAEF,KAAK,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC;gBAC7B,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,OAAO,EAAE,CAAC,KAAK,MAAM;iBAC5B,CAAC,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,OAAgB;oBACtB,IAAI,EAAE,EAAE,CAAC,MAAM;oBACf,QAAQ,EAAE,WAAW;iBACtB,CAAC,CAAC;YACL,CAAC;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,6BAA6B,iBAAiB,OAAO,WAAW,CAAC,IAAI,sBAAsB;aAClG,CAAC,CAAC;YAEH,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { z } from "zod";
2
+ import type { DeviceManager } from "../platform/device-manager.js";
3
+ export declare const metroToolSchemas: {
4
+ devlens_metro_status: {
5
+ description: string;
6
+ parameters: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
7
+ };
8
+ devlens_metro_logs: {
9
+ description: string;
10
+ parameters: z.ZodObject<{
11
+ level: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug"]>>;
12
+ since: z.ZodOptional<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ level?: "debug" | "error" | "info" | "warn" | undefined;
15
+ since?: string | undefined;
16
+ }, {
17
+ level?: "debug" | "error" | "info" | "warn" | undefined;
18
+ since?: string | undefined;
19
+ }>;
20
+ };
21
+ devlens_component_tree: {
22
+ description: string;
23
+ parameters: z.ZodObject<{
24
+ depth: z.ZodDefault<z.ZodNumber>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ depth: number;
27
+ }, {
28
+ depth?: number | undefined;
29
+ }>;
30
+ };
31
+ devlens_hot_reload: {
32
+ description: string;
33
+ parameters: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
34
+ };
35
+ devlens_network_requests: {
36
+ description: string;
37
+ parameters: z.ZodObject<{
38
+ urlPattern: z.ZodOptional<z.ZodString>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ urlPattern?: string | undefined;
41
+ }, {
42
+ urlPattern?: string | undefined;
43
+ }>;
44
+ };
45
+ devlens_dismiss_overlays: {
46
+ description: string;
47
+ parameters: z.ZodObject<{
48
+ suppressLogBox: z.ZodDefault<z.ZodBoolean>;
49
+ pressBack: z.ZodDefault<z.ZodBoolean>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ suppressLogBox: boolean;
52
+ pressBack: boolean;
53
+ }, {
54
+ suppressLogBox?: boolean | undefined;
55
+ pressBack?: boolean | undefined;
56
+ }>;
57
+ };
58
+ };
59
+ export declare function createMetroToolHandlers(metroPort: number, deviceManager: DeviceManager): {
60
+ devlens_metro_status: () => Promise<{
61
+ isError?: boolean | undefined;
62
+ content: {
63
+ type: "text";
64
+ text: string;
65
+ }[];
66
+ }>;
67
+ devlens_metro_logs: (params: {
68
+ level?: "error" | "warn" | "info" | "debug";
69
+ since?: string;
70
+ }) => Promise<{
71
+ content: {
72
+ type: "text";
73
+ text: string;
74
+ }[];
75
+ }>;
76
+ devlens_component_tree: (params: {
77
+ depth: number;
78
+ }) => Promise<{
79
+ content: {
80
+ type: "text";
81
+ text: string;
82
+ }[];
83
+ isError?: undefined;
84
+ } | {
85
+ content: {
86
+ type: "text";
87
+ text: string;
88
+ }[];
89
+ isError: boolean;
90
+ }>;
91
+ devlens_hot_reload: () => Promise<{
92
+ content: {
93
+ type: "text";
94
+ text: string;
95
+ }[];
96
+ }>;
97
+ devlens_network_requests: (params: {
98
+ urlPattern?: string;
99
+ }) => Promise<{
100
+ content: {
101
+ type: "text";
102
+ text: string;
103
+ }[];
104
+ }>;
105
+ devlens_dismiss_overlays: (params: {
106
+ suppressLogBox: boolean;
107
+ pressBack: boolean;
108
+ }) => Promise<{
109
+ content: {
110
+ type: "text";
111
+ text: string;
112
+ }[];
113
+ }>;
114
+ };
115
+ //# sourceMappingURL=metro-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metro-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/metro-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE5B,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,aAAa;;;;;;;;iCAiES;QACjC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;QAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;;;;;;qCA2CsC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;uCA2Cf;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;uCAsCvB;QACvC,cAAc,EAAE,OAAO,CAAC;QACxB,SAAS,EAAE,OAAO,CAAC;KACpB;;;;;;EA8CJ"}