react-native-mcp-kit 4.2.0 → 4.2.1
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/babel/testIdPlugin/collectHooks.d.ts +13 -0
- package/dist/babel/testIdPlugin/collectHooks.d.ts.map +1 -0
- package/dist/babel/testIdPlugin/collectHooks.js +112 -0
- package/dist/babel/testIdPlugin/collectHooks.js.map +1 -0
- package/dist/babel/testIdPlugin/constants.d.ts +6 -0
- package/dist/babel/testIdPlugin/constants.d.ts.map +1 -0
- package/dist/babel/testIdPlugin/constants.js +49 -0
- package/dist/babel/testIdPlugin/constants.js.map +1 -0
- package/dist/babel/testIdPlugin/helpers.d.ts +7 -0
- package/dist/babel/testIdPlugin/helpers.d.ts.map +1 -0
- package/dist/babel/testIdPlugin/helpers.js +77 -0
- package/dist/babel/testIdPlugin/helpers.js.map +1 -0
- package/dist/babel/testIdPlugin/hocUnwrap.d.ts +4 -0
- package/dist/babel/testIdPlugin/hocUnwrap.d.ts.map +1 -0
- package/dist/babel/testIdPlugin/hocUnwrap.js +94 -0
- package/dist/babel/testIdPlugin/hocUnwrap.js.map +1 -0
- package/dist/babel/{testIdPlugin.d.ts → testIdPlugin/index.d.ts} +1 -1
- package/dist/babel/testIdPlugin/index.d.ts.map +1 -0
- package/dist/babel/testIdPlugin/index.js +205 -0
- package/dist/babel/testIdPlugin/index.js.map +1 -0
- package/dist/babel/testIdPlugin/inject.d.ts +7 -0
- package/dist/babel/testIdPlugin/inject.d.ts.map +1 -0
- package/dist/babel/testIdPlugin/inject.js +86 -0
- package/dist/babel/testIdPlugin/inject.js.map +1 -0
- package/dist/babel/testIdPlugin/types.d.ts +59 -0
- package/dist/babel/testIdPlugin/types.d.ts.map +1 -0
- package/dist/babel/testIdPlugin/types.js +3 -0
- package/dist/babel/testIdPlugin/types.js.map +1 -0
- package/dist/bin/ios-hid +0 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/fiberTree/hooks/extract.d.ts +6 -0
- package/dist/modules/fiberTree/hooks/extract.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/extract.js +187 -0
- package/dist/modules/fiberTree/hooks/extract.js.map +1 -0
- package/dist/modules/fiberTree/hooks/flatten.d.ts +4 -0
- package/dist/modules/fiberTree/hooks/flatten.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/flatten.js +81 -0
- package/dist/modules/fiberTree/hooks/flatten.js.map +1 -0
- package/dist/modules/fiberTree/hooks/index.d.ts +5 -0
- package/dist/modules/fiberTree/hooks/index.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/index.js +10 -0
- package/dist/modules/fiberTree/hooks/index.js.map +1 -0
- package/dist/modules/fiberTree/hooks/options.d.ts +9 -0
- package/dist/modules/fiberTree/hooks/options.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/options.js +27 -0
- package/dist/modules/fiberTree/hooks/options.js.map +1 -0
- package/dist/modules/fiberTree/hooks/patterns.d.ts +2 -0
- package/dist/modules/fiberTree/hooks/patterns.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/patterns.js +26 -0
- package/dist/modules/fiberTree/hooks/patterns.js.map +1 -0
- package/dist/modules/fiberTree/hooks/shape.d.ts +3 -0
- package/dist/modules/fiberTree/hooks/shape.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/shape.js +66 -0
- package/dist/modules/fiberTree/hooks/shape.js.map +1 -0
- package/dist/modules/fiberTree/hooks/slotCount.d.ts +2 -0
- package/dist/modules/fiberTree/hooks/slotCount.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/slotCount.js +93 -0
- package/dist/modules/fiberTree/hooks/slotCount.js.map +1 -0
- package/dist/modules/fiberTree/{hooks.d.ts → hooks/types.d.ts} +1 -34
- package/dist/modules/fiberTree/hooks/types.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/types.js +3 -0
- package/dist/modules/fiberTree/hooks/types.js.map +1 -0
- package/dist/modules/fiberTree/hooks/value.d.ts +2 -0
- package/dist/modules/fiberTree/hooks/value.d.ts.map +1 -0
- package/dist/modules/fiberTree/hooks/value.js +89 -0
- package/dist/modules/fiberTree/hooks/value.js.map +1 -0
- package/dist/modules/fiberTree/utils/constants.d.ts +8 -0
- package/dist/modules/fiberTree/utils/constants.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/constants.js +15 -0
- package/dist/modules/fiberTree/utils/constants.js.map +1 -0
- package/dist/modules/fiberTree/utils/index.d.ts +9 -0
- package/dist/modules/fiberTree/utils/index.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/index.js +34 -0
- package/dist/modules/fiberTree/utils/index.js.map +1 -0
- package/dist/modules/fiberTree/utils/match.d.ts +4 -0
- package/dist/modules/fiberTree/utils/match.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/match.js +169 -0
- package/dist/modules/fiberTree/utils/match.js.map +1 -0
- package/dist/modules/fiberTree/utils/naming.d.ts +4 -0
- package/dist/modules/fiberTree/utils/naming.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/naming.js +52 -0
- package/dist/modules/fiberTree/utils/naming.js.map +1 -0
- package/dist/modules/fiberTree/utils/native.d.ts +5 -0
- package/dist/modules/fiberTree/utils/native.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/native.js +101 -0
- package/dist/modules/fiberTree/utils/native.js.map +1 -0
- package/dist/modules/fiberTree/utils/projection.d.ts +9 -0
- package/dist/modules/fiberTree/utils/projection.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/projection.js +75 -0
- package/dist/modules/fiberTree/utils/projection.js.map +1 -0
- package/dist/modules/fiberTree/utils/root.d.ts +4 -0
- package/dist/modules/fiberTree/utils/root.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/root.js +30 -0
- package/dist/modules/fiberTree/utils/root.js.map +1 -0
- package/dist/modules/fiberTree/utils/screen.d.ts +10 -0
- package/dist/modules/fiberTree/utils/screen.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/screen.js +39 -0
- package/dist/modules/fiberTree/utils/screen.js.map +1 -0
- package/dist/modules/fiberTree/utils/serialize.d.ts +4 -0
- package/dist/modules/fiberTree/utils/serialize.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/serialize.js +102 -0
- package/dist/modules/fiberTree/utils/serialize.js.map +1 -0
- package/dist/modules/fiberTree/utils/traverse.d.ts +12 -0
- package/dist/modules/fiberTree/utils/traverse.d.ts.map +1 -0
- package/dist/modules/fiberTree/utils/traverse.js +107 -0
- package/dist/modules/fiberTree/utils/traverse.js.map +1 -0
- package/dist/server/dispatch.d.ts +15 -0
- package/dist/server/dispatch.d.ts.map +1 -0
- package/dist/server/dispatch.js +121 -0
- package/dist/server/dispatch.js.map +1 -0
- package/dist/server/helpers.d.ts +97 -0
- package/dist/server/helpers.d.ts.map +1 -0
- package/dist/server/helpers.js +162 -0
- package/dist/server/helpers.js.map +1 -0
- package/dist/server/host/deviceResolver/byClient.d.ts +5 -0
- package/dist/server/host/deviceResolver/byClient.d.ts.map +1 -0
- package/dist/server/host/deviceResolver/byClient.js +171 -0
- package/dist/server/host/deviceResolver/byClient.js.map +1 -0
- package/dist/server/host/deviceResolver/byId.d.ts +5 -0
- package/dist/server/host/deviceResolver/byId.d.ts.map +1 -0
- package/dist/server/host/deviceResolver/byId.js +81 -0
- package/dist/server/host/deviceResolver/byId.js.map +1 -0
- package/dist/server/host/deviceResolver/enrich.d.ts +5 -0
- package/dist/server/host/deviceResolver/enrich.d.ts.map +1 -0
- package/dist/server/host/deviceResolver/enrich.js +123 -0
- package/dist/server/host/deviceResolver/enrich.js.map +1 -0
- package/dist/server/host/deviceResolver/index.d.ts +13 -0
- package/dist/server/host/deviceResolver/index.d.ts.map +1 -0
- package/dist/server/host/deviceResolver/index.js +65 -0
- package/dist/server/host/deviceResolver/index.js.map +1 -0
- package/dist/server/host/deviceResolver/list.d.ts +10 -0
- package/dist/server/host/deviceResolver/list.d.ts.map +1 -0
- package/dist/server/host/deviceResolver/list.js +119 -0
- package/dist/server/host/deviceResolver/list.js.map +1 -0
- package/dist/server/host/deviceResolver/scan.d.ts +4 -0
- package/dist/server/host/deviceResolver/scan.d.ts.map +1 -0
- package/dist/server/host/deviceResolver/scan.js +102 -0
- package/dist/server/host/deviceResolver/scan.js.map +1 -0
- package/dist/server/host/{deviceResolver.d.ts → deviceResolver/types.d.ts} +1 -16
- package/dist/server/host/deviceResolver/types.d.ts.map +1 -0
- package/dist/server/host/deviceResolver/types.js +3 -0
- package/dist/server/host/deviceResolver/types.js.map +1 -0
- package/dist/server/host/tools/input/android.d.ts +15 -0
- package/dist/server/host/tools/input/android.d.ts.map +1 -0
- package/dist/server/host/tools/input/android.js +88 -0
- package/dist/server/host/tools/input/android.js.map +1 -0
- package/dist/server/host/tools/input/constants.d.ts +14 -0
- package/dist/server/host/tools/input/constants.d.ts.map +1 -0
- package/dist/server/host/tools/input/constants.js +41 -0
- package/dist/server/host/tools/input/constants.js.map +1 -0
- package/dist/server/host/tools/input/drag.d.ts +4 -0
- package/dist/server/host/tools/input/drag.d.ts.map +1 -0
- package/dist/server/host/tools/input/drag.js +76 -0
- package/dist/server/host/tools/input/drag.js.map +1 -0
- package/dist/server/host/tools/input/index.d.ts +8 -0
- package/dist/server/host/tools/input/index.d.ts.map +1 -0
- package/dist/server/host/tools/input/index.js +18 -0
- package/dist/server/host/tools/input/index.js.map +1 -0
- package/dist/server/host/tools/input/longPress.d.ts +4 -0
- package/dist/server/host/tools/input/longPress.d.ts.map +1 -0
- package/dist/server/host/tools/input/longPress.js +49 -0
- package/dist/server/host/tools/input/longPress.js.map +1 -0
- package/dist/server/host/tools/input/pressKey.d.ts +4 -0
- package/dist/server/host/tools/input/pressKey.d.ts.map +1 -0
- package/dist/server/host/tools/input/pressKey.js +42 -0
- package/dist/server/host/tools/input/pressKey.js.map +1 -0
- package/dist/server/host/tools/input/swipe.d.ts +4 -0
- package/dist/server/host/tools/input/swipe.d.ts.map +1 -0
- package/dist/server/host/tools/input/swipe.js +71 -0
- package/dist/server/host/tools/input/swipe.js.map +1 -0
- package/dist/server/host/tools/input/tap.d.ts +4 -0
- package/dist/server/host/tools/input/tap.d.ts.map +1 -0
- package/dist/server/host/tools/input/tap.js +49 -0
- package/dist/server/host/tools/input/tap.js.map +1 -0
- package/dist/server/host/tools/input/typeText.d.ts +4 -0
- package/dist/server/host/tools/input/typeText.d.ts.map +1 -0
- package/dist/server/host/tools/input/typeText.js +52 -0
- package/dist/server/host/tools/input/typeText.js.map +1 -0
- package/dist/server/host/tools/input/typeTextBatch.d.ts +4 -0
- package/dist/server/host/tools/input/typeTextBatch.d.ts.map +1 -0
- package/dist/server/host/tools/input/typeTextBatch.js +106 -0
- package/dist/server/host/tools/input/typeTextBatch.js.map +1 -0
- package/dist/server/instructions.d.ts +2 -0
- package/dist/server/instructions.d.ts.map +1 -0
- package/dist/server/instructions.js +74 -0
- package/dist/server/instructions.js.map +1 -0
- package/dist/server/mcpServer.d.ts +0 -12
- package/dist/server/mcpServer.d.ts.map +1 -1
- package/dist/server/mcpServer.js +26 -877
- package/dist/server/mcpServer.js.map +1 -1
- package/dist/server/predicate.d.ts +31 -0
- package/dist/server/predicate.d.ts.map +1 -0
- package/dist/server/predicate.js +104 -0
- package/dist/server/predicate.js.map +1 -0
- package/dist/server/tools/assert.d.ts +4 -0
- package/dist/server/tools/assert.d.ts.map +1 -0
- package/dist/server/tools/assert.js +79 -0
- package/dist/server/tools/assert.js.map +1 -0
- package/dist/server/tools/call.d.ts +4 -0
- package/dist/server/tools/call.d.ts.map +1 -0
- package/dist/server/tools/call.js +38 -0
- package/dist/server/tools/call.js.map +1 -0
- package/dist/server/tools/connectionStatus.d.ts +4 -0
- package/dist/server/tools/connectionStatus.d.ts.map +1 -0
- package/dist/server/tools/connectionStatus.js +41 -0
- package/dist/server/tools/connectionStatus.js.map +1 -0
- package/dist/server/tools/describeTool.d.ts +4 -0
- package/dist/server/tools/describeTool.d.ts.map +1 -0
- package/dist/server/tools/describeTool.js +130 -0
- package/dist/server/tools/describeTool.js.map +1 -0
- package/dist/server/tools/listTools.d.ts +4 -0
- package/dist/server/tools/listTools.d.ts.map +1 -0
- package/dist/server/tools/listTools.js +109 -0
- package/dist/server/tools/listTools.js.map +1 -0
- package/dist/server/tools/waitUntil.d.ts +4 -0
- package/dist/server/tools/waitUntil.d.ts.map +1 -0
- package/dist/server/tools/waitUntil.js +119 -0
- package/dist/server/tools/waitUntil.js.map +1 -0
- package/package.json +2 -2
- package/dist/babel/testIdPlugin.d.ts.map +0 -1
- package/dist/babel/testIdPlugin.js +0 -585
- package/dist/babel/testIdPlugin.js.map +0 -1
- package/dist/modules/fiberTree/hooks.d.ts.map +0 -1
- package/dist/modules/fiberTree/hooks.js +0 -550
- package/dist/modules/fiberTree/hooks.js.map +0 -1
- package/dist/modules/fiberTree/utils.d.ts +0 -39
- package/dist/modules/fiberTree/utils.d.ts.map +0 -1
- package/dist/modules/fiberTree/utils.js +0 -641
- package/dist/modules/fiberTree/utils.js.map +0 -1
- package/dist/server/host/deviceResolver.d.ts.map +0 -1
- package/dist/server/host/deviceResolver.js +0 -621
- package/dist/server/host/deviceResolver.js.map +0 -1
- package/dist/server/host/tools/input.d.ts +0 -10
- package/dist/server/host/tools/input.d.ts.map +0 -1
- package/dist/server/host/tools/input.js +0 -503
- package/dist/server/host/tools/input.js.map +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.longPressTool = void 0;
|
|
4
|
+
const deviceResolver_1 = require("../../../../server/host/deviceResolver");
|
|
5
|
+
const helpers_1 = require("../../../../server/host/helpers");
|
|
6
|
+
const iosInput_1 = require("../../../../server/host/iosInput");
|
|
7
|
+
const android_1 = require("./android");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const longPressTool = (runner) => {
|
|
10
|
+
return {
|
|
11
|
+
description: 'Primary way to deliver a long-press: hold a touch at (x, y) for durationMs through the OS gesture pipeline. Default 700ms — above the RN Pressable long-press threshold (~500ms) with margin. Internally a zero-distance swipe kept alive for the full duration on both platforms.',
|
|
12
|
+
handler: async (args, ctx) => {
|
|
13
|
+
const resolved = await (0, deviceResolver_1.resolveDevice)(ctx, (0, helpers_1.parseResolveOptions)(args), runner);
|
|
14
|
+
if (!resolved.ok) {
|
|
15
|
+
return { error: resolved.error };
|
|
16
|
+
}
|
|
17
|
+
const x = (0, helpers_1.parseCoord)(args.x, 'x');
|
|
18
|
+
if (!x.ok)
|
|
19
|
+
return { error: x.error };
|
|
20
|
+
const y = (0, helpers_1.parseCoord)(args.y, 'y');
|
|
21
|
+
if (!y.ok)
|
|
22
|
+
return { error: y.error };
|
|
23
|
+
const durationMs = (0, constants_1.clampLongPressDuration)(args.durationMs);
|
|
24
|
+
const result = resolved.device.platform === 'ios'
|
|
25
|
+
? await (0, iosInput_1.swipeIos)(resolved.device.nativeId, x.value, y.value, x.value, y.value, durationMs, runner)
|
|
26
|
+
: await (0, android_1.swipeAndroid)(resolved.device.nativeId, x.value, y.value, x.value, y.value, durationMs, runner);
|
|
27
|
+
if ('error' in result) {
|
|
28
|
+
return { error: result.error };
|
|
29
|
+
}
|
|
30
|
+
return { device: resolved.device, durationMs, longPressed: true, x: x.value, y: y.value };
|
|
31
|
+
},
|
|
32
|
+
inputSchema: {
|
|
33
|
+
durationMs: {
|
|
34
|
+
default: constants_1.LONG_PRESS_DURATION_DEFAULT_MS,
|
|
35
|
+
description: 'Hold duration in milliseconds.',
|
|
36
|
+
maximum: constants_1.SWIPE_DURATION_MAX_MS,
|
|
37
|
+
minimum: constants_1.SWIPE_DURATION_MIN_MS,
|
|
38
|
+
type: 'number',
|
|
39
|
+
},
|
|
40
|
+
platform: helpers_1.PLATFORM_ARG_SCHEMA,
|
|
41
|
+
x: { description: 'Absolute x pixel coordinate.', minimum: 0, type: 'number' },
|
|
42
|
+
y: { description: 'Absolute y pixel coordinate.', minimum: 0, type: 'number' },
|
|
43
|
+
...helpers_1.NATIVE_ID_SCHEMA,
|
|
44
|
+
},
|
|
45
|
+
timeout: constants_1.INPUT_TIMEOUT_MS + constants_1.SWIPE_DURATION_MAX_MS,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.longPressTool = longPressTool;
|
|
49
|
+
//# sourceMappingURL=longPress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"longPress.js","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/longPress.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,mDAK+B;AAC/B,qDAAkD;AAIlD,uCAAyC;AACzC,2CAMqB;AAEd,MAAM,aAAa,GAAG,CAAC,MAAqB,EAAmB,EAAE;IACtE,OAAO;QACL,WAAW,EACT,oRAAoR;QACtR,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAa,EAAC,GAAG,EAAE,IAAA,6BAAmB,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7E,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnC,CAAC;YACD,MAAM,CAAC,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YACrC,MAAM,CAAC,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YACrC,MAAM,UAAU,GAA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AG,0BAAgB;SACpB;QACD,OAAO,EAAE,4BAAgB,GAAG,iCAAqB;KAClD,CAAC;AACJ,CAAC,CAAC;AAtDW,QAAA,aAAa,iBAsDxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressKey.d.ts","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/pressKey.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,eAAO,MAAM,YAAY,WAAY,aAAa,KAAG,eAgCpD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pressKeyTool = void 0;
|
|
4
|
+
const deviceResolver_1 = require("../../../../server/host/deviceResolver");
|
|
5
|
+
const helpers_1 = require("../../../../server/host/helpers");
|
|
6
|
+
const iosInput_1 = require("../../../../server/host/iosInput");
|
|
7
|
+
const android_1 = require("./android");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const pressKeyTool = (runner) => {
|
|
10
|
+
return {
|
|
11
|
+
description: `Primary way to press a hardware / semantic key — routes through the OS so native handlers (back, home, volume, etc.) fire. Accepted: ${constants_1.KEY_NAMES.join(', ')}. iOS lacks back / menu / power / volume_up / volume_down.`,
|
|
12
|
+
handler: async (args, ctx) => {
|
|
13
|
+
const resolved = await (0, deviceResolver_1.resolveDevice)(ctx, (0, helpers_1.parseResolveOptions)(args), runner);
|
|
14
|
+
if (!resolved.ok) {
|
|
15
|
+
return { error: resolved.error };
|
|
16
|
+
}
|
|
17
|
+
const key = (0, helpers_1.parseStringArg)(args.key);
|
|
18
|
+
if (!key) {
|
|
19
|
+
return { error: `'key' is required. Supported: ${constants_1.KEY_NAMES.join(', ')}.` };
|
|
20
|
+
}
|
|
21
|
+
const result = resolved.device.platform === 'ios'
|
|
22
|
+
? await (0, iosInput_1.pressKeyIos)(resolved.device.nativeId, key, runner)
|
|
23
|
+
: await (0, android_1.pressKeyAndroid)(resolved.device.nativeId, key, runner);
|
|
24
|
+
if ('error' in result) {
|
|
25
|
+
return { error: result.error };
|
|
26
|
+
}
|
|
27
|
+
return { device: resolved.device, key, pressed: true };
|
|
28
|
+
},
|
|
29
|
+
inputSchema: {
|
|
30
|
+
key: {
|
|
31
|
+
description: `Semantic key name. Mapped to the target platform's native key code internally. Supported: ${constants_1.KEY_NAMES.join(', ')}.`,
|
|
32
|
+
enum: constants_1.KEY_NAMES,
|
|
33
|
+
type: 'string',
|
|
34
|
+
},
|
|
35
|
+
platform: helpers_1.PLATFORM_ARG_SCHEMA,
|
|
36
|
+
...helpers_1.NATIVE_ID_SCHEMA,
|
|
37
|
+
},
|
|
38
|
+
timeout: constants_1.INPUT_TIMEOUT_MS,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.pressKeyTool = pressKeyTool;
|
|
42
|
+
//# sourceMappingURL=pressKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressKey.js","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/pressKey.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,mDAK+B;AAC/B,qDAAqD;AAIrD,uCAA4C;AAC5C,2CAA0D;AAEnD,MAAM,YAAY,GAAG,CAAC,MAAqB,EAAmB,EAAE;IACrE,OAAO;QACL,WAAW,EAAE,wIAAwI,qBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,4DAA4D;QACrO,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAa,EAAC,GAAG,EAAE,IAAA,6BAAmB,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7E,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OA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K,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAW3D,eAAO,MAAM,SAAS,WAAY,aAAa,KAAG,eA0EjD,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.swipeTool = void 0;
|
|
4
|
+
const deviceResolver_1 = require("../../../../server/host/deviceResolver");
|
|
5
|
+
const helpers_1 = require("../../../../server/host/helpers");
|
|
6
|
+
const iosInput_1 = require("../../../../server/host/iosInput");
|
|
7
|
+
const android_1 = require("./android");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const swipeTool = (runner) => {
|
|
10
|
+
return {
|
|
11
|
+
description: 'Primary way to deliver a swipe / scroll gesture, from (x1, y1) to (x2, y2) in physical pixels. Runs through the OS gesture pipeline — Pan responders, scroll momentum, and gesture handlers all behave as under a finger. durationMs default 300, clamped 50..5000.',
|
|
12
|
+
handler: async (args, ctx) => {
|
|
13
|
+
const resolved = await (0, deviceResolver_1.resolveDevice)(ctx, (0, helpers_1.parseResolveOptions)(args), runner);
|
|
14
|
+
if (!resolved.ok) {
|
|
15
|
+
return { error: resolved.error };
|
|
16
|
+
}
|
|
17
|
+
const x1 = (0, helpers_1.parseCoord)(args.x1, 'x1');
|
|
18
|
+
if (!x1.ok)
|
|
19
|
+
return { error: x1.error };
|
|
20
|
+
const y1 = (0, helpers_1.parseCoord)(args.y1, 'y1');
|
|
21
|
+
if (!y1.ok)
|
|
22
|
+
return { error: y1.error };
|
|
23
|
+
const x2 = (0, helpers_1.parseCoord)(args.x2, 'x2');
|
|
24
|
+
if (!x2.ok)
|
|
25
|
+
return { error: x2.error };
|
|
26
|
+
const y2 = (0, helpers_1.parseCoord)(args.y2, 'y2');
|
|
27
|
+
if (!y2.ok)
|
|
28
|
+
return { error: y2.error };
|
|
29
|
+
const durationMs = (0, constants_1.clampSwipeDuration)(args.durationMs);
|
|
30
|
+
const result = resolved.device.platform === 'ios'
|
|
31
|
+
? await (0, iosInput_1.swipeIos)(resolved.device.nativeId, x1.value, y1.value, x2.value, y2.value, durationMs, runner)
|
|
32
|
+
: await (0, android_1.swipeAndroid)(resolved.device.nativeId, x1.value, y1.value, x2.value, y2.value, durationMs, runner);
|
|
33
|
+
if ('error' in result) {
|
|
34
|
+
return { error: result.error };
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
device: resolved.device,
|
|
38
|
+
durationMs,
|
|
39
|
+
from: { x: x1.value, y: y1.value },
|
|
40
|
+
swiped: true,
|
|
41
|
+
to: { x: x2.value, y: y2.value },
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
inputSchema: {
|
|
45
|
+
durationMs: {
|
|
46
|
+
default: constants_1.SWIPE_DURATION_DEFAULT_MS,
|
|
47
|
+
description: 'Total swipe duration in milliseconds.',
|
|
48
|
+
maximum: constants_1.SWIPE_DURATION_MAX_MS,
|
|
49
|
+
minimum: constants_1.SWIPE_DURATION_MIN_MS,
|
|
50
|
+
type: 'number',
|
|
51
|
+
},
|
|
52
|
+
platform: helpers_1.PLATFORM_ARG_SCHEMA,
|
|
53
|
+
x1: {
|
|
54
|
+
description: 'Start x pixel coordinate (top-left origin).',
|
|
55
|
+
minimum: 0,
|
|
56
|
+
type: 'number',
|
|
57
|
+
},
|
|
58
|
+
x2: { description: 'End x pixel coordinate (top-left origin).', minimum: 0, type: 'number' },
|
|
59
|
+
y1: {
|
|
60
|
+
description: 'Start y pixel coordinate (top-left origin).',
|
|
61
|
+
minimum: 0,
|
|
62
|
+
type: 'number',
|
|
63
|
+
},
|
|
64
|
+
y2: { description: 'End y pixel coordinate (top-left origin).', minimum: 0, type: 'number' },
|
|
65
|
+
...helpers_1.NATIVE_ID_SCHEMA,
|
|
66
|
+
},
|
|
67
|
+
timeout: constants_1.INPUT_TIMEOUT_MS + constants_1.SWIPE_DURATION_MAX_MS,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
exports.swipeTool = swipeTool;
|
|
71
|
+
//# sourceMappingURL=swipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swipe.js","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/swipe.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,mDAK+B;AAC/B,qDAAkD;AAIlD,uCAAyC;AACzC,2CAMqB;AAEd,MAAM,SAAS,GAAG,CAAC,MAAqB,EAAmB,EAAE;IAClE,OAAO;QACL,WAAW,EACT,qQAAqQ;QACvQ,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAa,EAAC,GAAG,EAAE,IAAA,6BAAmB,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7E,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnC,CAAC;YACD,MAAM,EAAE,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,EAAE,CAAC,EAAE;gBAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC;YACvC,MAAM,EAAE,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,EAAE,CAAC,EAAE;gBAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC;YACvC,MAAM,EAAE,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,EAAE,CAAC,EAAE;gBAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC;Y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pD,OAAO,EAAE,iCAAqB;gBAC9B,OAAO,EAAE,iCAAqB;gBAC9B,IAAI,EAAE,QAAQ;aACf;YACD,QAAQ,EAAE,6BAAmB;YAC7B,EAAE,EAAE;gBACF,WAAW,EAAE,6CAA6C;gBAC1D,OAAO,EAAE,CAAC;gBACV,IAAI,EAAE,QAAQ;aACf;YACD,EAAE,EAAE,EAAE,WAAW,EAAE,2CAA2C,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC5F,EAAE,EAAE;gBACF,WAAW,EAAE,6CAA6C;gBAC1D,OAAO,EAAE,CAAC;gBACV,IAAI,EAAE,QAAQ;aACf;YACD,EAAE,EAAE,EAAE,WAAW,EAAE,2CAA2C,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC5F,GAAG,0BAAgB;SACpB;QACD,OAAO,EAAE,4BAAgB,GAAG,iCAAqB;KAClD,CAAC;AACJ,CAAC,CAAC;AA1EW,QAAA,SAAS,aA0EpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/tap.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,eAAO,MAAM,OAAO,WAAY,aAAa,KAAG,eAsC/C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tapTool = void 0;
|
|
4
|
+
const deviceResolver_1 = require("../../../../server/host/deviceResolver");
|
|
5
|
+
const helpers_1 = require("../../../../server/host/helpers");
|
|
6
|
+
const iosInput_1 = require("../../../../server/host/iosInput");
|
|
7
|
+
const android_1 = require("./android");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const tapTool = (runner) => {
|
|
10
|
+
return {
|
|
11
|
+
description: 'Primary way to deliver a tap to the app, at physical-pixel (x, y). Runs through the real OS gesture pipeline so Pressable feedback, gesture responders, and hit-test all fire. For a fiber-targeted tap without copying bounds by hand, prefer host__tap_fiber.',
|
|
12
|
+
handler: async (args, ctx) => {
|
|
13
|
+
const resolved = await (0, deviceResolver_1.resolveDevice)(ctx, (0, helpers_1.parseResolveOptions)(args), runner);
|
|
14
|
+
if (!resolved.ok) {
|
|
15
|
+
return { error: resolved.error };
|
|
16
|
+
}
|
|
17
|
+
const x = (0, helpers_1.parseCoord)(args.x, 'x');
|
|
18
|
+
if (!x.ok)
|
|
19
|
+
return { error: x.error };
|
|
20
|
+
const y = (0, helpers_1.parseCoord)(args.y, 'y');
|
|
21
|
+
if (!y.ok)
|
|
22
|
+
return { error: y.error };
|
|
23
|
+
const result = resolved.device.platform === 'ios'
|
|
24
|
+
? await (0, iosInput_1.tapIos)(resolved.device.nativeId, x.value, y.value, runner)
|
|
25
|
+
: await (0, android_1.tapAndroid)(resolved.device.nativeId, x.value, y.value, runner);
|
|
26
|
+
if ('error' in result) {
|
|
27
|
+
return { error: result.error };
|
|
28
|
+
}
|
|
29
|
+
return { device: resolved.device, tapped: true, x: x.value, y: y.value };
|
|
30
|
+
},
|
|
31
|
+
inputSchema: {
|
|
32
|
+
platform: helpers_1.PLATFORM_ARG_SCHEMA,
|
|
33
|
+
x: {
|
|
34
|
+
description: 'Absolute x pixel coordinate (top-left origin).',
|
|
35
|
+
minimum: 0,
|
|
36
|
+
type: 'number',
|
|
37
|
+
},
|
|
38
|
+
y: {
|
|
39
|
+
description: 'Absolute y pixel coordinate (top-left origin).',
|
|
40
|
+
minimum: 0,
|
|
41
|
+
type: 'number',
|
|
42
|
+
},
|
|
43
|
+
...helpers_1.NATIVE_ID_SCHEMA,
|
|
44
|
+
},
|
|
45
|
+
timeout: constants_1.INPUT_TIMEOUT_MS,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.tapTool = tapTool;
|
|
49
|
+
//# sourceMappingURL=tap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tap.js","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/tap.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,mDAK+B;AAC/B,qDAAgD;AAIhD,uCAAuC;AACvC,2CAA+C;AAExC,MAAM,OAAO,GAAG,CAAC,MAAqB,EAAmB,EAAE;IAChE,OAAO;QACL,WAAW,EACT,iQAAiQ;QACnQ,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAa,EAAC,GAAG,EAAE,IAAA,6BAAmB,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7E,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnC,CAAC;YACD,MAAM,CAAC,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YACrC,MAAM,CAAC,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YACrC,MAAM,MAAM,GACV,QAAQ,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK;gBAChC,CAAC,CAAC,MAAM,IAAA,iBAAM,EAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC;gBAClE,CAAC,CAAC,MAAM,IAAA,oBAAU,EAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAC3E,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;gBACtB,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;YACjC,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QAC3E,CAAC;QACD,WAAW,EAAE;YACX,QAAQ,EAAE,6BAAmB;YAC7B,CAAC,EAAE;gBACD,WAAW,EAAE,gDAAgD;gBAC7D,OAAO,EAAE,CAAC;gBACV,IAAI,EAAE,QAAQ;aACf;YACD,CAAC,EAAE;gBACD,WAAW,EAAE,gDAAgD;gBAC7D,OAAO,EAAE,CAAC;gBACV,IAAI,EAAE,QAAQ;aACf;YACD,GAAG,0BAAgB;SACpB;QACD,OAAO,EAAE,4BAAgB;KAC1B,CAAC;AACJ,CAAC,CAAC;AAtCW,QAAA,OAAO,WAsClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeText.d.ts","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/typeText.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,eAAO,MAAM,YAAY,WAAY,aAAa,KAAG,eA4CpD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typeTextTool = void 0;
|
|
4
|
+
const deviceResolver_1 = require("../../../../server/host/deviceResolver");
|
|
5
|
+
const helpers_1 = require("../../../../server/host/helpers");
|
|
6
|
+
const iosInput_1 = require("../../../../server/host/iosInput");
|
|
7
|
+
const android_1 = require("./android");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const typeTextTool = (runner) => {
|
|
10
|
+
return {
|
|
11
|
+
description: "Primary way to type into the currently focused text input — replaces existing content (select-all then paste). submit:true presses ENTER after typing. iOS: unicode via clipboard paste, keyboard-layout immune. Android: ASCII only (adb input text limitation); for non-Latin scripts fall back to fiber_tree__call on the input's onChangeText.",
|
|
12
|
+
handler: async (args, ctx) => {
|
|
13
|
+
const resolved = await (0, deviceResolver_1.resolveDevice)(ctx, (0, helpers_1.parseResolveOptions)(args), runner);
|
|
14
|
+
if (!resolved.ok) {
|
|
15
|
+
return { error: resolved.error };
|
|
16
|
+
}
|
|
17
|
+
const text = typeof args.text === 'string' ? args.text : undefined;
|
|
18
|
+
if (text === undefined) {
|
|
19
|
+
return { error: "'text' is required and must be a string" };
|
|
20
|
+
}
|
|
21
|
+
const submit = args.submit === true;
|
|
22
|
+
const result = resolved.device.platform === 'ios'
|
|
23
|
+
? await (0, iosInput_1.typeTextIos)(resolved.device.nativeId, text, submit, runner)
|
|
24
|
+
: await (0, android_1.typeTextAndroid)(resolved.device.nativeId, text, submit, runner);
|
|
25
|
+
if ('error' in result) {
|
|
26
|
+
return { error: result.error };
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
device: resolved.device,
|
|
30
|
+
length: text.length,
|
|
31
|
+
submitted: submit,
|
|
32
|
+
typed: true,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
inputSchema: {
|
|
36
|
+
platform: helpers_1.PLATFORM_ARG_SCHEMA,
|
|
37
|
+
submit: {
|
|
38
|
+
default: false,
|
|
39
|
+
description: 'Press ENTER after typing (e.g. to submit a search).',
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
},
|
|
42
|
+
text: {
|
|
43
|
+
description: 'Text to type into the currently focused input field. Whitespace and shell metacharacters are escaped automatically.',
|
|
44
|
+
type: 'string',
|
|
45
|
+
},
|
|
46
|
+
...helpers_1.NATIVE_ID_SCHEMA,
|
|
47
|
+
},
|
|
48
|
+
timeout: constants_1.INPUT_TIMEOUT_MS,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.typeTextTool = typeTextTool;
|
|
52
|
+
//# sourceMappingURL=typeText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeText.js","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/typeText.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,mDAAmG;AACnG,qDAAqD;AAIrD,uCAA4C;AAC5C,2CAA+C;AAExC,MAAM,YAAY,GAAG,CAAC,MAAqB,EAAmB,EAAE;IACrE,OAAO;QACL,WAAW,EACT,oVAAoV;QACtV,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAa,EAAC,GAAG,EAAE,IAAA,6BAAmB,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7E,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnC,CAAC;YACD,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;YACnE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,EAAE,KAAK,EAAE,yCAAyC,EAAE,CAAC;YAC9D,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC;YACpC,MAAM,MAAM,GACV,QAAQ,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK;gBAChC,CAAC,CAAC,MAAM,IAAA,sBAAW,EAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC;gBACnE,CAAC,CAAC,MAAM,IAAA,yBAAe,EAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YAC5E,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;gBACtB,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;YACjC,CAAC;YACD,OAAO;gBACL,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,SAAS,EAAE,MAAM;gBACjB,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QACD,WAAW,EAAE;YACX,QAAQ,EAAE,6BAAmB;YAC7B,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,qDAAqD;gBAClE,IAAI,EAAE,SAAS;aAChB;YACD,IAAI,EAAE;gBACJ,WAAW,EACT,qHAAqH;gBACvH,IAAI,EAAE,QAAQ;aACf;YACD,GAAG,0BAAgB;SACpB;QACD,OAAO,EAAE,4BAAgB;KAC1B,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,YAAY,gBA4CvB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ProcessRunner } from '../../../../server/host/processRunner';
|
|
2
|
+
import { type HostToolHandler } from '../../../../server/host/types';
|
|
3
|
+
export declare const typeTextBatchTool: (runner: ProcessRunner) => HostToolHandler;
|
|
4
|
+
//# sourceMappingURL=typeTextBatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeTextBatch.d.ts","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/typeTextBatch.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAgB3D,eAAO,MAAM,iBAAiB,WAAY,aAAa,KAAG,eAyGzD,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typeTextBatchTool = void 0;
|
|
4
|
+
const deviceResolver_1 = require("../../../../server/host/deviceResolver");
|
|
5
|
+
const helpers_1 = require("../../../../server/host/helpers");
|
|
6
|
+
const iosInput_1 = require("../../../../server/host/iosInput");
|
|
7
|
+
const android_1 = require("./android");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const typeTextBatchTool = (runner) => {
|
|
10
|
+
return {
|
|
11
|
+
description: `Primary way to fill multiple text fields in one call. Each field: { x, y, text, submit? }. For each entry — tap to focus, wait focusDelayMs, then type via the same semantics as host__type_text (select-all → paste on iOS; adb input text on Android). Stops on the first error and returns { filled, failedAt, error? }.
|
|
12
|
+
|
|
13
|
+
focusDelayMs default is ${constants_1.BATCH_FOCUS_DELAY_DEFAULT_MS}ms — tuned for in-place TextInputs (login / signup forms, already-mounted fields). When the tap triggers a screen transition (e.g. searchBar → SearchScreen) the target input won't be mounted yet and the typed text is lost; bump focusDelayMs to 700-800. Set to 0 when the input is already focused.`,
|
|
14
|
+
handler: async (args, ctx) => {
|
|
15
|
+
const resolved = await (0, deviceResolver_1.resolveDevice)(ctx, (0, helpers_1.parseResolveOptions)(args), runner);
|
|
16
|
+
if (!resolved.ok) {
|
|
17
|
+
return { error: resolved.error };
|
|
18
|
+
}
|
|
19
|
+
const fields = args.fields;
|
|
20
|
+
if (!Array.isArray(fields) || fields.length === 0) {
|
|
21
|
+
return { error: "'fields' must be a non-empty array of { x, y, text, submit? }." };
|
|
22
|
+
}
|
|
23
|
+
const focusDelayMs = typeof args.focusDelayMs === 'number' && Number.isFinite(args.focusDelayMs)
|
|
24
|
+
? Math.max(0, Math.min(constants_1.BATCH_FOCUS_DELAY_MAX_MS, Math.floor(args.focusDelayMs)))
|
|
25
|
+
: constants_1.BATCH_FOCUS_DELAY_DEFAULT_MS;
|
|
26
|
+
const results = [];
|
|
27
|
+
for (let i = 0; i < fields.length; i++) {
|
|
28
|
+
const raw = fields[i];
|
|
29
|
+
if (!raw || typeof raw !== 'object') {
|
|
30
|
+
return { error: `fields[${i}]: must be an object.`, failedAt: i, filled: results.length };
|
|
31
|
+
}
|
|
32
|
+
const x = (0, helpers_1.parseCoord)(raw.x, `fields[${i}].x`);
|
|
33
|
+
if (!x.ok)
|
|
34
|
+
return { error: x.error, failedAt: i, filled: results.length };
|
|
35
|
+
const y = (0, helpers_1.parseCoord)(raw.y, `fields[${i}].y`);
|
|
36
|
+
if (!y.ok)
|
|
37
|
+
return { error: y.error, failedAt: i, filled: results.length };
|
|
38
|
+
if (typeof raw.text !== 'string') {
|
|
39
|
+
return {
|
|
40
|
+
error: `fields[${i}].text must be a string.`,
|
|
41
|
+
failedAt: i,
|
|
42
|
+
filled: results.length,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const submit = raw.submit === true;
|
|
46
|
+
const focused = resolved.device.platform === 'ios'
|
|
47
|
+
? await (0, iosInput_1.tapIos)(resolved.device.nativeId, x.value, y.value, runner)
|
|
48
|
+
: await (0, android_1.tapAndroid)(resolved.device.nativeId, x.value, y.value, runner);
|
|
49
|
+
if ('error' in focused) {
|
|
50
|
+
return { error: focused.error, failedAt: i, filled: results.length };
|
|
51
|
+
}
|
|
52
|
+
// Give the soft keyboard (or a screen transition to a search-style
|
|
53
|
+
// view) a beat to come up before typing. Tunable per-call because
|
|
54
|
+
// navigation-triggering taps need more than in-place input focus.
|
|
55
|
+
if (focusDelayMs > 0) {
|
|
56
|
+
await new Promise((r) => {
|
|
57
|
+
return setTimeout(r, focusDelayMs);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const typed = resolved.device.platform === 'ios'
|
|
61
|
+
? await (0, iosInput_1.typeTextIos)(resolved.device.nativeId, raw.text, submit, runner)
|
|
62
|
+
: await (0, android_1.typeTextAndroid)(resolved.device.nativeId, raw.text, submit, runner);
|
|
63
|
+
if ('error' in typed) {
|
|
64
|
+
return { error: typed.error, failedAt: i, filled: results.length };
|
|
65
|
+
}
|
|
66
|
+
results.push({ submitted: submit, x: x.value, y: y.value });
|
|
67
|
+
}
|
|
68
|
+
return { device: resolved.device, fields: results, filled: results.length };
|
|
69
|
+
},
|
|
70
|
+
inputSchema: {
|
|
71
|
+
fields: {
|
|
72
|
+
description: 'Ordered list of { x, y, text, submit? } entries. Each entry taps the coordinate to focus the input, waits focusDelayMs, then types the text.',
|
|
73
|
+
examples: [
|
|
74
|
+
[
|
|
75
|
+
{ text: 'alice@example.com', x: 120, y: 400 },
|
|
76
|
+
{ submit: true, text: 'pa55word', x: 120, y: 520 },
|
|
77
|
+
],
|
|
78
|
+
],
|
|
79
|
+
items: {
|
|
80
|
+
properties: {
|
|
81
|
+
submit: { default: false, type: 'boolean' },
|
|
82
|
+
text: { type: 'string' },
|
|
83
|
+
x: { minimum: 0, type: 'number' },
|
|
84
|
+
y: { minimum: 0, type: 'number' },
|
|
85
|
+
},
|
|
86
|
+
required: ['x', 'y', 'text'],
|
|
87
|
+
type: 'object',
|
|
88
|
+
},
|
|
89
|
+
minItems: 1,
|
|
90
|
+
type: 'array',
|
|
91
|
+
},
|
|
92
|
+
focusDelayMs: {
|
|
93
|
+
default: constants_1.BATCH_FOCUS_DELAY_DEFAULT_MS,
|
|
94
|
+
description: 'Delay between tap and type. Use 0 to skip when the input is already focused.',
|
|
95
|
+
maximum: constants_1.BATCH_FOCUS_DELAY_MAX_MS,
|
|
96
|
+
minimum: 0,
|
|
97
|
+
type: 'number',
|
|
98
|
+
},
|
|
99
|
+
platform: helpers_1.PLATFORM_ARG_SCHEMA,
|
|
100
|
+
...helpers_1.NATIVE_ID_SCHEMA,
|
|
101
|
+
},
|
|
102
|
+
timeout: constants_1.INPUT_TIMEOUT_MS * 6,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
exports.typeTextBatchTool = typeTextBatchTool;
|
|
106
|
+
//# sourceMappingURL=typeTextBatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeTextBatch.js","sourceRoot":"","sources":["../../../../../src/server/host/tools/input/typeTextBatch.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,mDAK+B;AAC/B,qDAA6D;AAI7D,uCAAwD;AACxD,2CAIqB;AASd,MAAM,iBAAiB,GAAG,CAAC,MAAqB,EAAmB,EAAE;IAC1E,OAAO;QACL,WAAW,EAAE;;0BAES,wCAA4B,0SAA0S;QAC5V,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAa,EAAC,GAAG,EAAE,IAAA,6BAAmB,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7E,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnC,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClD,OAAO,EAAE,KAAK,EAAE,gEAAgE,EAAE,CAAC;YACrF,CAAC;YAED,MAAM,YAAY,GAChB,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;gBACzE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,oCAAwB,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;gBAChF,CAAC,CA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EAAE,QAAQ;aACf;YACD,QAAQ,EAAE,6BAAmB;YAC7B,GAAG,0BAAgB;SACpB;QACD,OAAO,EAAE,4BAAgB,GAAG,CAAC;KAC9B,CAAC;AACJ,CAAC,CAAC;AAzGW,QAAA,iBAAiB,qBAyG5B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const BASE_INSTRUCTIONS = "You are connected to a running React Native app via the react-native-mcp-kit bridge.\n\nMultiple React Native apps can connect simultaneously \u2014 each is identified by a short ID like \"ios-1\", \"android-1\", or \"client-1\". Use `connection_status` or `list_tools` to see which clients are connected and their IDs, platforms, and labels.\n\n## How to interact\n\n1. Use `connection_status` to check which clients are connected.\n2. Use `list_tools` to browse all available tool names and short descriptions. The response is compact \u2014 modules that are structurally identical across multiple clients are deduplicated into a single entry with a `clientIds` array, and input schemas are omitted. Narrow the listing with `{ module }` or `{ clientId }`, or pass `{ compact: true }` to drop module-level descriptions.\n3. Use `describe_tool` with `{ tool, clientId? }` to fetch the full input schema of a specific tool before calling it. Required when you need to know the argument shape. Host tools are resolved directly (no clientId needed). For in-app tools, omit `clientId` to auto-pick; specify it only when multiple clients have the same tool with different schemas.\n4. Use `call` to invoke any tool with format: module__method (e.g. navigation__navigate). When more than one client is connected, specify `clientId`. When exactly one client is connected, `clientId` is optional \u2014 it's auto-picked. `args` accepts either a plain object or a JSON string \u2014 prefer objects to avoid quote escaping.\n5. Use `wait_until` to poll any tool until a predicate over its result holds (or timeout). Replaces \"screenshot in a loop + sleep\" for state-level waits (\"wait for network to idle\", \"wait for state key X to become Y\"). Predicate supports compound forms: { all: [...] } (AND), { any: [...] } (OR), { not: predicate }.\n6. For UI-level waits (\"wait for a screen to appear\", \"wait for a spinner to disappear\") use `fiber_tree__query` with `waitFor: { until: \"appear\" | \"disappear\", timeout?, interval?, stable? }` \u2014 it polls the same query with cache bypassed until the target state holds. `stable: <ms>` requires continuous presence/absence for that many ms to ignore transient matches during screen transitions.\n7. Use `assert` for a single-shot checkpoint after actions \u2014 same predicate vocabulary as wait_until, returns { pass, actual, expected?, result? }. Natural pair: do action \u2192 wait_until / fiber_tree waitFor \u2192 assert.\n8. Use `host__tap_fiber` to collapse \"fiber_tree__query \u2192 host__tap at bounds\" into one call. Pass fiber_tree steps; if exactly one fiber matches, its center is tapped. Ambiguous match returns the candidate list so you can add `index` or narrow the chain.\n\nSome tools run inline on the MCP server host (e.g. `host__screenshot`, `host__list_devices`, `host__launch_app`, `host__terminate_app`, `host__restart_app`, `metro__reload`, `metro__symbolicate`) and work even when no React Native client is connected. They use xcrun simctl / adb on the dev machine. When `clientId` is provided, host tools use that client's platform/label/deviceId as hints to resolve the target device; otherwise they prefer the device of the single connected client, falling back to the single booted sim / online device. `launch_app`, `terminate_app`, and `restart_app` accept an `appId` arg (iOS bundle ID / Android package name); omit it to reuse the target client's registered `bundleId` from its connection metadata.\n\n## Driving the UI \u2014 pick the right tool\n1. **`host__tap_fiber` with `steps: [...]`** \u2014 the canonical way to simulate a user tap. One call locates the fiber via fiber_tree__query and taps its center through the real OS gesture pipeline, so Pressable feedback, gesture responders, and hit-test logic all run. Ambiguous matches return a candidate list so you can add `index` or narrow `steps`. This is what you want whenever the user asks to simulate a tap / press / button click.\n2. **`fiber_tree__query` with `select: [\"mcpId\",\"name\",\"bounds\"]` + `host__tap`** when you want to inspect a match set before committing \u2014 e.g. verify bounds, or skim candidates before picking one. `props` is opt-in on `select` to keep responses small.\n3. **`fiber_tree__call`** for non-gesture callbacks or imperative ref methods. Pass `prop` to call a callback prop (`{ prop: 'onPress' }`) or `method` to call a native-ref method (`{ method: 'focus' }`). Good when the component is off-screen / virtualised, when a scroll-handler parent swallows taps, or when you're driving focus / blur / measure / scrollTo via the native ref. For simulating a user tap, prefer tap_fiber (above).\n4. **`host__screenshot` + manual coordinate estimation + `host__tap`** ONLY for non-React surfaces: system permission dialogs, native alerts, the on-screen keyboard, WebView content, native splash. These have no fiber and no bounds. Pair with `region: { x, y, width, height }` to screenshot just the area you're inspecting \u2014 vision-token cheap.\n\nGesture tools: `host__tap` / `host__long_press` / `host__swipe` / `host__drag` / `host__type_text` / `host__type_text_batch` / `host__press_key` work on both platforms with no external daemons: Android via `adb shell input`, iOS via a bundled `ios-hid` binary that injects HID events directly into iOS Simulator through SimulatorKit.\n\nStack traces: `errors__get_errors` and `log_box__get_logs` return parsed `stackFrames` you can pass straight into `metro__symbolicate` to resolve bundled frames back to source paths via Metro.\n\n## Consolidated tools \u2014 verb + arg, not verb-per-action\n\nEvery module exposes one verb per concept rather than one tool per variant. Reach for the listing tool with a filter arg, not a tool named after the filter:\n\n- **console** \u2014 `get_logs({ level? })` for all levels (no per-level shortcuts).\n- **errors** \u2014 `get_errors({ fatal? })` covers fatal-only too.\n- **network** \u2014 `get_requests({ status?, method?, url? })` covers errors / pending / URL filter.\n- **log_box** \u2014 `clear({ level? })` (warn / error / syntax / all); `set_installed({ enabled })` toggles install/uninstall.\n- **navigation** \u2014 `navigate({ mode: 'reuse' | 'push' | 'replace' })` covers navigate/push/replace; `pop({ to: <number> | <screenName> | 'top' })` covers pop / pop_to / pop_to_top; `get_current_route({ withState? })` covers the route-state read too.\n- **query** (reactQuery) \u2014 `mutate({ action: 'invalidate' | 'refetch' | 'remove' | 'reset', key? })` covers all four cache mutations.\n- **device** \u2014 `info({ select?: [...] })` aggregates platform / dimensions / pixelRatio / appearance / appState / accessibility / keyboard / initialUrl / dev / identity / app / battery / memoryStorage. `open_url({ dryRun? })` covers the canOpenURL check too.\n- **fiber_tree** \u2014 `query` (all inspection: mcpId / name / testID / props / hooks / bounds / refMethods / children) and `call({ prop? | method? })` (callback prop OR native-ref method) \u2014 two tools cover everything fibers offer.\n\n## Path-based drill into heavy responses\n\nAll listing tools that return heavy JSON (console / network / errors / storage / reactQuery / log_box / navigation / metro events / fiber_tree) accept the standard `path` / `depth` / `maxBytes` projection args. Heavy nested values collapse to compact `${...}`-keyed markers; primitives stay raw. Drill into a specific subtree via the same tool with `path` \u2014 no separate by-id fetcher.\n\n `network__get_requests({ path: '[-1:][0].response.body' })` \u2014 last request's body\n `network__get_requests({ path: '[-1:][0].response.body', depth: 8 })` \u2014 fully expanded\n `console__get_logs({ path: '[-3:][0].args[1]' })` \u2014 second arg of the third-from-last log\n `storage__get_item({ key: 'session', path: 'value.user.email' })` \u2014 drill into a stored value\n `query__get_data({ key: '[\"users\"]', path: 'data.email' })` \u2014 drill into cached data\n\nPath syntax (JS-style):\n `.key` or `[\"key.with.dots\"]` \u2014 object key access\n `[N]` \u2014 index (numeric for arrays, Nth char for strings, Nth key in insertion order for objects)\n `[start:end]` / `[start:]` / `[:end]` \u2014 slice (Python/jq-style; negative indices count from end). Works on arrays, strings, and objects (key slice). After array slice, chained `.key` maps over each element; `[N]` picks one.\n\nPath drilling to a string scalar applies `previewCap` as usual \u2014 long leaves still wrap in a `${str}` marker. To get a raw substring, end the path with a slice: `stack[0:500]` returns the first 500 chars verbatim (slice = explicit truncation request, previewCap bypassed). Default `previewCap` is 250; override per call via `previewCap: <N>`.\n\n`depth` (default per tool, max 8) controls how many container levels are walked before collapsing to a marker. Bump `depth` for an exploratory survey, use `path` for a targeted drill. `maxBytes` (default 50KB) caps the total response size \u2014 overflow is replaced with a single `${str}` marker carrying the original byte count + a preview.\n\nFor `fiber_tree__query`, heavy fields (`props`, `hooks`) take projection knobs per-field via `select` so the rest of the response stays raw:\n `select: [{ props: { path: \"style\", depth: 2 } }]` \u2014 drill into props.style 2 levels deep\n `select: [{ props: { path: \"data[0:5]\" } }]` \u2014 slice path: take first 5 items of props.data\n `select: [{ hooks: { kinds: [\"State\"], names: [\"isLoading\"], withValues: true, depth: 2 } }]` \u2014 filter + project hook values\n `select: [{ children: 5 }]` \u2014 light-only recursive tree walker (5 levels deep); use `scope: \"root\"` as the first step to dump the whole tree. props/hooks not supported inside; sub-children past treeDepth surface as `${arr}: N`.\n\nHook filters: `kinds` (State/Effect/Memo/Ref/Custom/...), `names` (exact or `/regex/flags`), `withValues` (adds resolved values), `expansionDepth` (caps custom-hook recursion), `format: \"tree\"` (nested children vs flat `via` chains). Each hook entry carries `{ kind, name, hook?, via?, expanded? }`. Sensitive names (password, token, jwt, secret, credential, apiKey, authorization, Pin suffix) are auto-redacted; configure via `fiberTreeModule({ redactHookNames, additionalRedactHookNames })`.\n\nMarker format: `{ \"${obj}\": N }` for collapsed objects (N keys), `{ \"${arr}\": N }` for arrays (N items), `{ \"${fun}\": \"name\" }` for functions, `{ \"${str}\": { len, preview } }` for long strings (>`previewCap`, default 250), `{ \"${Date}\": \"iso\" }` for Date, `{ \"${Err}\": { name, msg } }` for Error, `{ \"${RegExp}\": \"/.../i\" }` for RegExp, `{ \"${map}\": N }` / `{ \"${set}\": N }` for Map/Set sizes, `{ \"${cyc}\": true }` for cycles, `{ \"${ref}\": { mcpId, name } }` for fiber/native refs, `{ \"${cls}\": { name, len } }` for class instances, `{ \"${truncated}\": { total, slice } }` first key/item when a container is wider than the cap (30 keys for objects, 50 items for arrays).\n";
|
|
2
|
+
//# sourceMappingURL=instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/server/instructions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,22VAoE7B,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASE_INSTRUCTIONS = void 0;
|
|
4
|
+
const protocol_1 = require("../shared/protocol");
|
|
5
|
+
exports.BASE_INSTRUCTIONS = `You are connected to a running React Native app via the react-native-mcp-kit bridge.
|
|
6
|
+
|
|
7
|
+
Multiple React Native apps can connect simultaneously — each is identified by a short ID like "ios-1", "android-1", or "client-1". Use \`connection_status\` or \`list_tools\` to see which clients are connected and their IDs, platforms, and labels.
|
|
8
|
+
|
|
9
|
+
## How to interact
|
|
10
|
+
|
|
11
|
+
1. Use \`connection_status\` to check which clients are connected.
|
|
12
|
+
2. Use \`list_tools\` to browse all available tool names and short descriptions. The response is compact — modules that are structurally identical across multiple clients are deduplicated into a single entry with a \`clientIds\` array, and input schemas are omitted. Narrow the listing with \`{ module }\` or \`{ clientId }\`, or pass \`{ compact: true }\` to drop module-level descriptions.
|
|
13
|
+
3. Use \`describe_tool\` with \`{ tool, clientId? }\` to fetch the full input schema of a specific tool before calling it. Required when you need to know the argument shape. Host tools are resolved directly (no clientId needed). For in-app tools, omit \`clientId\` to auto-pick; specify it only when multiple clients have the same tool with different schemas.
|
|
14
|
+
4. Use \`call\` to invoke any tool with format: module${protocol_1.MODULE_SEPARATOR}method (e.g. navigation${protocol_1.MODULE_SEPARATOR}navigate). When more than one client is connected, specify \`clientId\`. When exactly one client is connected, \`clientId\` is optional — it's auto-picked. \`args\` accepts either a plain object or a JSON string — prefer objects to avoid quote escaping.
|
|
15
|
+
5. Use \`wait_until\` to poll any tool until a predicate over its result holds (or timeout). Replaces "screenshot in a loop + sleep" for state-level waits ("wait for network to idle", "wait for state key X to become Y"). Predicate supports compound forms: { all: [...] } (AND), { any: [...] } (OR), { not: predicate }.
|
|
16
|
+
6. For UI-level waits ("wait for a screen to appear", "wait for a spinner to disappear") use \`fiber_tree${protocol_1.MODULE_SEPARATOR}query\` with \`waitFor: { until: "appear" | "disappear", timeout?, interval?, stable? }\` — it polls the same query with cache bypassed until the target state holds. \`stable: <ms>\` requires continuous presence/absence for that many ms to ignore transient matches during screen transitions.
|
|
17
|
+
7. Use \`assert\` for a single-shot checkpoint after actions — same predicate vocabulary as wait_until, returns { pass, actual, expected?, result? }. Natural pair: do action → wait_until / fiber_tree waitFor → assert.
|
|
18
|
+
8. Use \`host${protocol_1.MODULE_SEPARATOR}tap_fiber\` to collapse "fiber_tree__query → host__tap at bounds" into one call. Pass fiber_tree steps; if exactly one fiber matches, its center is tapped. Ambiguous match returns the candidate list so you can add \`index\` or narrow the chain.
|
|
19
|
+
|
|
20
|
+
Some tools run inline on the MCP server host (e.g. \`host${protocol_1.MODULE_SEPARATOR}screenshot\`, \`host${protocol_1.MODULE_SEPARATOR}list_devices\`, \`host${protocol_1.MODULE_SEPARATOR}launch_app\`, \`host${protocol_1.MODULE_SEPARATOR}terminate_app\`, \`host${protocol_1.MODULE_SEPARATOR}restart_app\`, \`metro${protocol_1.MODULE_SEPARATOR}reload\`, \`metro${protocol_1.MODULE_SEPARATOR}symbolicate\`) and work even when no React Native client is connected. They use xcrun simctl / adb on the dev machine. When \`clientId\` is provided, host tools use that client's platform/label/deviceId as hints to resolve the target device; otherwise they prefer the device of the single connected client, falling back to the single booted sim / online device. \`launch_app\`, \`terminate_app\`, and \`restart_app\` accept an \`appId\` arg (iOS bundle ID / Android package name); omit it to reuse the target client's registered \`bundleId\` from its connection metadata.
|
|
21
|
+
|
|
22
|
+
## Driving the UI — pick the right tool
|
|
23
|
+
1. **\`host${protocol_1.MODULE_SEPARATOR}tap_fiber\` with \`steps: [...]\`** — the canonical way to simulate a user tap. One call locates the fiber via fiber_tree__query and taps its center through the real OS gesture pipeline, so Pressable feedback, gesture responders, and hit-test logic all run. Ambiguous matches return a candidate list so you can add \`index\` or narrow \`steps\`. This is what you want whenever the user asks to simulate a tap / press / button click.
|
|
24
|
+
2. **\`fiber_tree${protocol_1.MODULE_SEPARATOR}query\` with \`select: ["mcpId","name","bounds"]\` + \`host${protocol_1.MODULE_SEPARATOR}tap\`** when you want to inspect a match set before committing — e.g. verify bounds, or skim candidates before picking one. \`props\` is opt-in on \`select\` to keep responses small.
|
|
25
|
+
3. **\`fiber_tree${protocol_1.MODULE_SEPARATOR}call\`** for non-gesture callbacks or imperative ref methods. Pass \`prop\` to call a callback prop (\`{ prop: 'onPress' }\`) or \`method\` to call a native-ref method (\`{ method: 'focus' }\`). Good when the component is off-screen / virtualised, when a scroll-handler parent swallows taps, or when you're driving focus / blur / measure / scrollTo via the native ref. For simulating a user tap, prefer tap_fiber (above).
|
|
26
|
+
4. **\`host${protocol_1.MODULE_SEPARATOR}screenshot\` + manual coordinate estimation + \`host${protocol_1.MODULE_SEPARATOR}tap\`** ONLY for non-React surfaces: system permission dialogs, native alerts, the on-screen keyboard, WebView content, native splash. These have no fiber and no bounds. Pair with \`region: { x, y, width, height }\` to screenshot just the area you're inspecting — vision-token cheap.
|
|
27
|
+
|
|
28
|
+
Gesture tools: \`host${protocol_1.MODULE_SEPARATOR}tap\` / \`host${protocol_1.MODULE_SEPARATOR}long_press\` / \`host${protocol_1.MODULE_SEPARATOR}swipe\` / \`host${protocol_1.MODULE_SEPARATOR}drag\` / \`host${protocol_1.MODULE_SEPARATOR}type_text\` / \`host${protocol_1.MODULE_SEPARATOR}type_text_batch\` / \`host${protocol_1.MODULE_SEPARATOR}press_key\` work on both platforms with no external daemons: Android via \`adb shell input\`, iOS via a bundled \`ios-hid\` binary that injects HID events directly into iOS Simulator through SimulatorKit.
|
|
29
|
+
|
|
30
|
+
Stack traces: \`errors${protocol_1.MODULE_SEPARATOR}get_errors\` and \`log_box${protocol_1.MODULE_SEPARATOR}get_logs\` return parsed \`stackFrames\` you can pass straight into \`metro${protocol_1.MODULE_SEPARATOR}symbolicate\` to resolve bundled frames back to source paths via Metro.
|
|
31
|
+
|
|
32
|
+
## Consolidated tools — verb + arg, not verb-per-action
|
|
33
|
+
|
|
34
|
+
Every module exposes one verb per concept rather than one tool per variant. Reach for the listing tool with a filter arg, not a tool named after the filter:
|
|
35
|
+
|
|
36
|
+
- **console** — \`get_logs({ level? })\` for all levels (no per-level shortcuts).
|
|
37
|
+
- **errors** — \`get_errors({ fatal? })\` covers fatal-only too.
|
|
38
|
+
- **network** — \`get_requests({ status?, method?, url? })\` covers errors / pending / URL filter.
|
|
39
|
+
- **log_box** — \`clear({ level? })\` (warn / error / syntax / all); \`set_installed({ enabled })\` toggles install/uninstall.
|
|
40
|
+
- **navigation** — \`navigate({ mode: 'reuse' | 'push' | 'replace' })\` covers navigate/push/replace; \`pop({ to: <number> | <screenName> | 'top' })\` covers pop / pop_to / pop_to_top; \`get_current_route({ withState? })\` covers the route-state read too.
|
|
41
|
+
- **query** (reactQuery) — \`mutate({ action: 'invalidate' | 'refetch' | 'remove' | 'reset', key? })\` covers all four cache mutations.
|
|
42
|
+
- **device** — \`info({ select?: [...] })\` aggregates platform / dimensions / pixelRatio / appearance / appState / accessibility / keyboard / initialUrl / dev / identity / app / battery / memoryStorage. \`open_url({ dryRun? })\` covers the canOpenURL check too.
|
|
43
|
+
- **fiber_tree** — \`query\` (all inspection: mcpId / name / testID / props / hooks / bounds / refMethods / children) and \`call({ prop? | method? })\` (callback prop OR native-ref method) — two tools cover everything fibers offer.
|
|
44
|
+
|
|
45
|
+
## Path-based drill into heavy responses
|
|
46
|
+
|
|
47
|
+
All listing tools that return heavy JSON (console / network / errors / storage / reactQuery / log_box / navigation / metro events / fiber_tree) accept the standard \`path\` / \`depth\` / \`maxBytes\` projection args. Heavy nested values collapse to compact \`\${...}\`-keyed markers; primitives stay raw. Drill into a specific subtree via the same tool with \`path\` — no separate by-id fetcher.
|
|
48
|
+
|
|
49
|
+
\`network__get_requests({ path: '[-1:][0].response.body' })\` — last request's body
|
|
50
|
+
\`network__get_requests({ path: '[-1:][0].response.body', depth: 8 })\` — fully expanded
|
|
51
|
+
\`console__get_logs({ path: '[-3:][0].args[1]' })\` — second arg of the third-from-last log
|
|
52
|
+
\`storage__get_item({ key: 'session', path: 'value.user.email' })\` — drill into a stored value
|
|
53
|
+
\`query__get_data({ key: '["users"]', path: 'data.email' })\` — drill into cached data
|
|
54
|
+
|
|
55
|
+
Path syntax (JS-style):
|
|
56
|
+
\`.key\` or \`["key.with.dots"]\` — object key access
|
|
57
|
+
\`[N]\` — index (numeric for arrays, Nth char for strings, Nth key in insertion order for objects)
|
|
58
|
+
\`[start:end]\` / \`[start:]\` / \`[:end]\` — slice (Python/jq-style; negative indices count from end). Works on arrays, strings, and objects (key slice). After array slice, chained \`.key\` maps over each element; \`[N]\` picks one.
|
|
59
|
+
|
|
60
|
+
Path drilling to a string scalar applies \`previewCap\` as usual — long leaves still wrap in a \`\${str}\` marker. To get a raw substring, end the path with a slice: \`stack[0:500]\` returns the first 500 chars verbatim (slice = explicit truncation request, previewCap bypassed). Default \`previewCap\` is 250; override per call via \`previewCap: <N>\`.
|
|
61
|
+
|
|
62
|
+
\`depth\` (default per tool, max 8) controls how many container levels are walked before collapsing to a marker. Bump \`depth\` for an exploratory survey, use \`path\` for a targeted drill. \`maxBytes\` (default 50KB) caps the total response size — overflow is replaced with a single \`\${str}\` marker carrying the original byte count + a preview.
|
|
63
|
+
|
|
64
|
+
For \`fiber_tree__query\`, heavy fields (\`props\`, \`hooks\`) take projection knobs per-field via \`select\` so the rest of the response stays raw:
|
|
65
|
+
\`select: [{ props: { path: "style", depth: 2 } }]\` — drill into props.style 2 levels deep
|
|
66
|
+
\`select: [{ props: { path: "data[0:5]" } }]\` — slice path: take first 5 items of props.data
|
|
67
|
+
\`select: [{ hooks: { kinds: ["State"], names: ["isLoading"], withValues: true, depth: 2 } }]\` — filter + project hook values
|
|
68
|
+
\`select: [{ children: 5 }]\` — light-only recursive tree walker (5 levels deep); use \`scope: "root"\` as the first step to dump the whole tree. props/hooks not supported inside; sub-children past treeDepth surface as \`\${arr}: N\`.
|
|
69
|
+
|
|
70
|
+
Hook filters: \`kinds\` (State/Effect/Memo/Ref/Custom/...), \`names\` (exact or \`/regex/flags\`), \`withValues\` (adds resolved values), \`expansionDepth\` (caps custom-hook recursion), \`format: "tree"\` (nested children vs flat \`via\` chains). Each hook entry carries \`{ kind, name, hook?, via?, expanded? }\`. Sensitive names (password, token, jwt, secret, credential, apiKey, authorization, Pin suffix) are auto-redacted; configure via \`fiberTreeModule({ redactHookNames, additionalRedactHookNames })\`.
|
|
71
|
+
|
|
72
|
+
Marker format: \`{ "\${obj}": N }\` for collapsed objects (N keys), \`{ "\${arr}": N }\` for arrays (N items), \`{ "\${fun}": "name" }\` for functions, \`{ "\${str}": { len, preview } }\` for long strings (>\`previewCap\`, default 250), \`{ "\${Date}": "iso" }\` for Date, \`{ "\${Err}": { name, msg } }\` for Error, \`{ "\${RegExp}": "/.../i" }\` for RegExp, \`{ "\${map}": N }\` / \`{ "\${set}": N }\` for Map/Set sizes, \`{ "\${cyc}": true }\` for cycles, \`{ "\${ref}": { mcpId, name } }\` for fiber/native refs, \`{ "\${cls}": { name, len } }\` for class instances, \`{ "\${truncated}": { total, slice } }\` first key/item when a container is wider than the cap (30 keys for objects, 50 items for arrays).
|
|
73
|
+
`;
|
|
74
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/server/instructions.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AAExC,QAAA,iBAAiB,GAAG;;;;;;;;;wDASuB,2BAAgB,0BAA0B,2BAAgB;;2GAEP,2BAAgB;;eAE5G,2BAAgB;;2DAE4B,2BAAgB,uBAAuB,2BAAgB,yBAAyB,2BAAgB,uBAAuB,2BAAgB,0BAA0B,2BAAgB,yBAAyB,2BAAgB,oBAAoB,2BAAgB;;;aAG5S,2BAAgB;mBACV,2BAAgB,8DAA8D,2BAAgB;mBAC9F,2BAAgB;aACtB,2BAAgB,uDAAuD,2BAAgB;;uBAE7E,2BAAgB,iBAAiB,2BAAgB,wBAAwB,2BAAgB,mBAAmB,2BAAgB,kBAAkB,2BAAgB,uBAAuB,2BAAgB,6BAA6B,2BAAgB;;wBAEjP,2BAAgB,6BAA6B,2BAAgB,8EAA8E,2BAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ClL,CAAC"}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
import { type Bridge } from './bridge';
|
|
2
2
|
import { type HostModule } from './host/types';
|
|
3
3
|
export declare class McpServerWrapper {
|
|
4
|
-
private readonly bridge;
|
|
5
|
-
private hostModules;
|
|
6
|
-
private hostToolMap;
|
|
7
4
|
private mcp;
|
|
8
5
|
constructor(bridge: Bridge, hostModules?: HostModule[]);
|
|
9
6
|
start(): Promise<void>;
|
|
10
|
-
private registerTools;
|
|
11
|
-
/**
|
|
12
|
-
* Execute a single tool by full name, returning the raw handler result.
|
|
13
|
-
* Used by both the `call` tool and meta-tools like `wait_until` that need to
|
|
14
|
-
* invoke other tools without going through the full MCP content wrapping.
|
|
15
|
-
*/
|
|
16
|
-
private dispatchTool;
|
|
17
|
-
private buildToolGroups;
|
|
18
|
-
private formatResult;
|
|
19
7
|
}
|
|
20
8
|
//# sourceMappingURL=mcpServer.d.ts.map
|