@midscene/ios 1.8.0 → 1.8.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/es/bin.mjs +120 -131
- package/dist/es/cli.mjs +121 -132
- package/dist/es/index.mjs +120 -131
- package/dist/es/mcp-server.mjs +121 -132
- package/dist/lib/bin.js +118 -129
- package/dist/lib/cli.js +119 -130
- package/dist/lib/index.js +118 -129
- package/dist/lib/mcp-server.js +119 -130
- package/dist/types/index.d.ts +11 -7
- package/dist/types/mcp-server.d.ts +11 -7
- package/package.json +5 -5
- package/static/index.html +1 -1
- package/static/static/css/{index.63b028da.css → index.26c9c911.css} +2 -2
- package/static/static/css/{index.63b028da.css.map → index.26c9c911.css.map} +1 -1
- package/static/static/js/{889.c8e2e995.js → 596.5426be9e.js} +27 -27
- package/static/static/js/596.5426be9e.js.map +1 -0
- package/static/static/js/index.acaa5ec1.js +914 -0
- package/static/static/js/index.acaa5ec1.js.map +1 -0
- package/static/static/js/889.c8e2e995.js.map +0 -1
- package/static/static/js/index.7d3d953d.js +0 -914
- package/static/static/js/index.7d3d953d.js.map +0 -1
- /package/static/static/js/{889.c8e2e995.js.LICENSE.txt → 596.5426be9e.js.LICENSE.txt} +0 -0
- /package/static/static/js/{index.7d3d953d.js.LICENSE.txt → index.acaa5ec1.js.LICENSE.txt} +0 -0
package/dist/lib/mcp-server.js
CHANGED
|
@@ -688,16 +688,6 @@ function _define_property(obj, key, value) {
|
|
|
688
688
|
return obj;
|
|
689
689
|
}
|
|
690
690
|
const debugDevice = (0, logger_namespaceObject.getDebug)('ios:device');
|
|
691
|
-
const iosInputParamSchema = core_namespaceObject.z.object({
|
|
692
|
-
value: core_namespaceObject.z.string().describe('The text to input. Provide the final content for replace/append modes, or an empty string when using clear mode to remove existing text.'),
|
|
693
|
-
autoDismissKeyboard: core_namespaceObject.z.boolean().optional().describe('Whether to dismiss the keyboard after input. Defaults to true if not specified. Set to false to keep the keyboard visible after input.'),
|
|
694
|
-
mode: core_namespaceObject.z.preprocess((val)=>'append' === val ? 'typeOnly' : val, core_namespaceObject.z["enum"]([
|
|
695
|
-
'replace',
|
|
696
|
-
'clear',
|
|
697
|
-
'typeOnly'
|
|
698
|
-
]).default('replace').optional().describe('Input mode: "replace" (default) - clear the field and input the value; "typeOnly" - type the value directly without clearing the field first; "clear" - clear the field without inputting new text.')),
|
|
699
|
-
locate: (0, core_namespaceObject.getMidsceneLocationSchema)().describe('The input field to be filled').optional()
|
|
700
|
-
});
|
|
701
691
|
const WDA_HTTP_METHODS = [
|
|
702
692
|
'GET',
|
|
703
693
|
'POST',
|
|
@@ -706,96 +696,39 @@ const WDA_HTTP_METHODS = [
|
|
|
706
696
|
];
|
|
707
697
|
const DEFAULT_WDA_MJPEG_PORT = 9100;
|
|
708
698
|
class IOSDevice {
|
|
699
|
+
async tapPoint(point) {
|
|
700
|
+
debugDevice(`tap at coordinates (${point.x}, ${point.y})`);
|
|
701
|
+
await this.wdaBackend.tap(Math.round(point.x), Math.round(point.y));
|
|
702
|
+
}
|
|
703
|
+
async doubleTapPoint(point) {
|
|
704
|
+
await this.wdaBackend.doubleTap(Math.round(point.x), Math.round(point.y));
|
|
705
|
+
}
|
|
706
|
+
async longPressPoint(point, duration = 1000) {
|
|
707
|
+
await this.wdaBackend.longPress(Math.round(point.x), Math.round(point.y), duration);
|
|
708
|
+
}
|
|
709
|
+
async swipePoint(start, end, duration = 500) {
|
|
710
|
+
await this.wdaBackend.swipe(Math.round(start.x), Math.round(start.y), Math.round(end.x), Math.round(end.y), duration);
|
|
711
|
+
}
|
|
712
|
+
async clearInputAt(point) {
|
|
713
|
+
if (point) {
|
|
714
|
+
await this.tapPoint(point);
|
|
715
|
+
await (0, core_utils_namespaceObject.sleep)(100);
|
|
716
|
+
}
|
|
717
|
+
debugDevice('Attempting to clear input with WebDriver Clear API');
|
|
718
|
+
const cleared = await this.wdaBackend.clearActiveElement();
|
|
719
|
+
cleared ? debugDevice('Successfully cleared input with WebDriver Clear API') : debugDevice('WebDriver Clear API returned false (no active element or clear failed)');
|
|
720
|
+
}
|
|
709
721
|
actionSpace() {
|
|
722
|
+
const mobileActionContext = {
|
|
723
|
+
input: this.inputPrimitives,
|
|
724
|
+
size: ()=>this.size(),
|
|
725
|
+
sleep: async (timeMs)=>{
|
|
726
|
+
await (0, core_utils_namespaceObject.sleep)(timeMs);
|
|
727
|
+
},
|
|
728
|
+
getDefaultAutoDismissKeyboard: ()=>this.options?.autoDismissKeyboard
|
|
729
|
+
};
|
|
710
730
|
const defaultActions = [
|
|
711
|
-
(0, device_namespaceObject.
|
|
712
|
-
const element = param.locate;
|
|
713
|
-
external_node_assert_default()(element, 'Element not found, cannot tap');
|
|
714
|
-
await this.mouseClick(element.center[0], element.center[1]);
|
|
715
|
-
}),
|
|
716
|
-
(0, device_namespaceObject.defineActionDoubleClick)(async (param)=>{
|
|
717
|
-
const element = param.locate;
|
|
718
|
-
external_node_assert_default()(element, 'Element not found, cannot double click');
|
|
719
|
-
await this.doubleTap(element.center[0], element.center[1]);
|
|
720
|
-
}),
|
|
721
|
-
(0, device_namespaceObject.defineAction)({
|
|
722
|
-
name: 'Input',
|
|
723
|
-
description: 'Input text into the input field',
|
|
724
|
-
interfaceAlias: 'aiInput',
|
|
725
|
-
paramSchema: iosInputParamSchema,
|
|
726
|
-
sample: {
|
|
727
|
-
value: 'test@example.com',
|
|
728
|
-
locate: {
|
|
729
|
-
prompt: 'the email input field'
|
|
730
|
-
}
|
|
731
|
-
},
|
|
732
|
-
call: async (param)=>{
|
|
733
|
-
const element = param.locate;
|
|
734
|
-
if ('typeOnly' !== param.mode) await this.clearInput(element);
|
|
735
|
-
if ('clear' === param.mode) return;
|
|
736
|
-
if (!param || !param.value) return;
|
|
737
|
-
const autoDismissKeyboard = param.autoDismissKeyboard ?? this.options?.autoDismissKeyboard;
|
|
738
|
-
await this.typeText(param.value, {
|
|
739
|
-
autoDismissKeyboard
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
}),
|
|
743
|
-
(0, device_namespaceObject.defineActionScroll)(async (param)=>{
|
|
744
|
-
const element = param.locate;
|
|
745
|
-
const startingPoint = element ? {
|
|
746
|
-
left: element.center[0],
|
|
747
|
-
top: element.center[1]
|
|
748
|
-
} : void 0;
|
|
749
|
-
const scrollToEventName = param?.scrollType;
|
|
750
|
-
if ('scrollToTop' === scrollToEventName) await this.scrollUntilTop(startingPoint);
|
|
751
|
-
else if ('scrollToBottom' === scrollToEventName) await this.scrollUntilBottom(startingPoint);
|
|
752
|
-
else if ('scrollToRight' === scrollToEventName) await this.scrollUntilRight(startingPoint);
|
|
753
|
-
else if ('scrollToLeft' === scrollToEventName) await this.scrollUntilLeft(startingPoint);
|
|
754
|
-
else if ('singleAction' !== scrollToEventName && scrollToEventName) throw new Error(`Unknown scroll event type: ${scrollToEventName}, param: ${JSON.stringify(param)}`);
|
|
755
|
-
else {
|
|
756
|
-
if (param?.direction !== 'down' && param && param.direction) if ('up' === param.direction) await this.scrollUp(param.distance || void 0, startingPoint);
|
|
757
|
-
else if ('left' === param.direction) await this.scrollLeft(param.distance || void 0, startingPoint);
|
|
758
|
-
else if ('right' === param.direction) await this.scrollRight(param.distance || void 0, startingPoint);
|
|
759
|
-
else throw new Error(`Unknown scroll direction: ${param.direction}`);
|
|
760
|
-
else await this.scrollDown(param?.distance || void 0, startingPoint);
|
|
761
|
-
await (0, core_utils_namespaceObject.sleep)(500);
|
|
762
|
-
}
|
|
763
|
-
}),
|
|
764
|
-
(0, device_namespaceObject.defineActionDragAndDrop)(async (param)=>{
|
|
765
|
-
const from = param.from;
|
|
766
|
-
const to = param.to;
|
|
767
|
-
external_node_assert_default()(from, 'missing "from" param for drag and drop');
|
|
768
|
-
external_node_assert_default()(to, 'missing "to" param for drag and drop');
|
|
769
|
-
await this.swipe(from.center[0], from.center[1], to.center[0], to.center[1], 1000);
|
|
770
|
-
}),
|
|
771
|
-
(0, device_namespaceObject.defineActionSwipe)(async (param)=>{
|
|
772
|
-
const { startPoint, endPoint, duration, repeatCount } = (0, device_namespaceObject.normalizeMobileSwipeParam)(param, await this.size());
|
|
773
|
-
for(let i = 0; i < repeatCount; i++)await this.swipe(startPoint.x, startPoint.y, endPoint.x, endPoint.y, duration);
|
|
774
|
-
}),
|
|
775
|
-
(0, device_namespaceObject.defineActionKeyboardPress)(async (param)=>{
|
|
776
|
-
await this.pressKey(param.keyName);
|
|
777
|
-
}),
|
|
778
|
-
(0, device_namespaceObject.defineActionCursorMove)(async (param)=>{
|
|
779
|
-
const arrowKey = 'left' === param.direction ? 'ArrowLeft' : 'ArrowRight';
|
|
780
|
-
const times = param.times ?? 1;
|
|
781
|
-
for(let i = 0; i < times; i++){
|
|
782
|
-
await this.pressKey(arrowKey);
|
|
783
|
-
await (0, core_utils_namespaceObject.sleep)(100);
|
|
784
|
-
}
|
|
785
|
-
}),
|
|
786
|
-
(0, device_namespaceObject.defineActionLongPress)(async (param)=>{
|
|
787
|
-
const element = param.locate;
|
|
788
|
-
external_node_assert_default()(element, 'LongPress requires an element to be located');
|
|
789
|
-
const [x, y] = element.center;
|
|
790
|
-
await this.longPress(x, y, param?.duration);
|
|
791
|
-
}),
|
|
792
|
-
(0, device_namespaceObject.defineActionPinch)(async (param)=>{
|
|
793
|
-
const { centerX, centerY, startDistance, endDistance, duration } = (0, device_namespaceObject.normalizePinchParam)(param, await this.size());
|
|
794
|
-
await this.wdaBackend.pinch(centerX, centerY, startDistance, endDistance, duration);
|
|
795
|
-
}),
|
|
796
|
-
(0, device_namespaceObject.defineActionClearInput)(async (param)=>{
|
|
797
|
-
await this.clearInput(param.locate);
|
|
798
|
-
})
|
|
731
|
+
...(0, device_namespaceObject.createDefaultMobileActions)(mobileActionContext)
|
|
799
732
|
];
|
|
800
733
|
const platformSpecificActions = Object.values(createPlatformActions(this));
|
|
801
734
|
const customActions = this.customActions || [];
|
|
@@ -805,6 +738,27 @@ class IOSDevice {
|
|
|
805
738
|
...customActions
|
|
806
739
|
];
|
|
807
740
|
}
|
|
741
|
+
async performActionScroll(param) {
|
|
742
|
+
const element = param.locate;
|
|
743
|
+
const startingPoint = element ? {
|
|
744
|
+
left: element.center[0],
|
|
745
|
+
top: element.center[1]
|
|
746
|
+
} : void 0;
|
|
747
|
+
const scrollToEventName = param?.scrollType;
|
|
748
|
+
if ('scrollToTop' === scrollToEventName) await this.scrollUntilTop(startingPoint);
|
|
749
|
+
else if ('scrollToBottom' === scrollToEventName) await this.scrollUntilBottom(startingPoint);
|
|
750
|
+
else if ('scrollToRight' === scrollToEventName) await this.scrollUntilRight(startingPoint);
|
|
751
|
+
else if ('scrollToLeft' === scrollToEventName) await this.scrollUntilLeft(startingPoint);
|
|
752
|
+
else if ('singleAction' !== scrollToEventName && scrollToEventName) throw new Error(`Unknown scroll event type: ${scrollToEventName}, param: ${JSON.stringify(param)}`);
|
|
753
|
+
else {
|
|
754
|
+
if (param?.direction !== 'down' && param && param.direction) if ('up' === param.direction) await this.scrollUp(param.distance || void 0, startingPoint);
|
|
755
|
+
else if ('left' === param.direction) await this.scrollLeft(param.distance || void 0, startingPoint);
|
|
756
|
+
else if ('right' === param.direction) await this.scrollRight(param.distance || void 0, startingPoint);
|
|
757
|
+
else throw new Error(`Unknown scroll direction: ${param.direction}`);
|
|
758
|
+
else await this.scrollDown(param?.distance || void 0, startingPoint);
|
|
759
|
+
await (0, core_utils_namespaceObject.sleep)(500);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
808
762
|
describe() {
|
|
809
763
|
return this.description || `Device ID: ${this.deviceId}`;
|
|
810
764
|
}
|
|
@@ -916,35 +870,31 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
916
870
|
}
|
|
917
871
|
}
|
|
918
872
|
async clearInput(element) {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
debugDevice('Attempting to clear input with WebDriver Clear API');
|
|
924
|
-
const cleared = await this.wdaBackend.clearActiveElement();
|
|
925
|
-
cleared ? debugDevice('Successfully cleared input with WebDriver Clear API') : debugDevice('WebDriver Clear API returned false (no active element or clear failed)');
|
|
873
|
+
await this.clearInputAt(element ? {
|
|
874
|
+
x: element.center[0],
|
|
875
|
+
y: element.center[1]
|
|
876
|
+
} : void 0);
|
|
926
877
|
}
|
|
927
878
|
async url() {
|
|
928
879
|
return '';
|
|
929
880
|
}
|
|
930
881
|
async tap(x, y) {
|
|
931
|
-
await this.
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
await this.tap(x, y);
|
|
936
|
-
}
|
|
937
|
-
async doubleTap(x, y) {
|
|
938
|
-
await this.wdaBackend.doubleTap(Math.round(x), Math.round(y));
|
|
939
|
-
}
|
|
940
|
-
async tripleTap(x, y) {
|
|
941
|
-
await this.wdaBackend.tripleTap(Math.round(x), Math.round(y));
|
|
942
|
-
}
|
|
943
|
-
async longPress(x, y, duration = 1000) {
|
|
944
|
-
await this.wdaBackend.longPress(Math.round(x), Math.round(y), duration);
|
|
882
|
+
await this.tapPoint({
|
|
883
|
+
x,
|
|
884
|
+
y
|
|
885
|
+
});
|
|
945
886
|
}
|
|
946
887
|
async swipe(fromX, fromY, toX, toY, duration = 500) {
|
|
947
|
-
await this.
|
|
888
|
+
await this.swipeCoordinates(fromX, fromY, toX, toY, duration);
|
|
889
|
+
}
|
|
890
|
+
async swipeCoordinates(fromX, fromY, toX, toY, duration = 500) {
|
|
891
|
+
await this.swipePoint({
|
|
892
|
+
x: fromX,
|
|
893
|
+
y: fromY
|
|
894
|
+
}, {
|
|
895
|
+
x: toX,
|
|
896
|
+
y: toY
|
|
897
|
+
}, duration);
|
|
948
898
|
}
|
|
949
899
|
async typeText(text, options) {
|
|
950
900
|
if (!text) return;
|
|
@@ -973,7 +923,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
973
923
|
y: Math.round(height / 2)
|
|
974
924
|
};
|
|
975
925
|
const scrollDistance = Math.round(distance || height / 3);
|
|
976
|
-
await this.
|
|
926
|
+
await this.swipeCoordinates(start.x, start.y, start.x, start.y + scrollDistance);
|
|
977
927
|
}
|
|
978
928
|
async scrollDown(distance, startPoint) {
|
|
979
929
|
const { width, height } = await this.size();
|
|
@@ -985,7 +935,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
985
935
|
y: Math.round(height / 2)
|
|
986
936
|
};
|
|
987
937
|
const scrollDistance = Math.round(distance || height / 3);
|
|
988
|
-
await this.
|
|
938
|
+
await this.swipeCoordinates(start.x, start.y, start.x, start.y - scrollDistance);
|
|
989
939
|
}
|
|
990
940
|
async scrollLeft(distance, startPoint) {
|
|
991
941
|
const { width, height } = await this.size();
|
|
@@ -997,7 +947,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
997
947
|
y: Math.round(height / 2)
|
|
998
948
|
};
|
|
999
949
|
const scrollDistance = Math.round(distance || 0.7 * width);
|
|
1000
|
-
await this.
|
|
950
|
+
await this.swipeCoordinates(start.x, start.y, start.x + scrollDistance, start.y);
|
|
1001
951
|
}
|
|
1002
952
|
async scrollRight(distance, startPoint) {
|
|
1003
953
|
const { width, height } = await this.size();
|
|
@@ -1009,7 +959,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
1009
959
|
y: Math.round(height / 2)
|
|
1010
960
|
};
|
|
1011
961
|
const scrollDistance = Math.round(distance || 0.7 * width);
|
|
1012
|
-
await this.
|
|
962
|
+
await this.swipeCoordinates(start.x, start.y, start.x - scrollDistance, start.y);
|
|
1013
963
|
}
|
|
1014
964
|
async scrollUntilTop(startPoint) {
|
|
1015
965
|
debugDevice('Using screenshot-based scroll detection for better reliability');
|
|
@@ -1105,16 +1055,16 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
1105
1055
|
debugDevice(`Performing scroll: ${direction}, distance: ${scrollDistance}`);
|
|
1106
1056
|
switch(direction){
|
|
1107
1057
|
case 'up':
|
|
1108
|
-
await this.
|
|
1058
|
+
await this.swipeCoordinates(start.x, start.y, start.x, start.y + scrollDistance, 300);
|
|
1109
1059
|
break;
|
|
1110
1060
|
case 'down':
|
|
1111
|
-
await this.
|
|
1061
|
+
await this.swipeCoordinates(start.x, start.y, start.x, start.y - scrollDistance, 300);
|
|
1112
1062
|
break;
|
|
1113
1063
|
case 'left':
|
|
1114
|
-
await this.
|
|
1064
|
+
await this.swipeCoordinates(start.x, start.y, start.x + scrollDistance, start.y, 300);
|
|
1115
1065
|
break;
|
|
1116
1066
|
case 'right':
|
|
1117
|
-
await this.
|
|
1067
|
+
await this.swipeCoordinates(start.x, start.y, start.x - scrollDistance, start.y, 300);
|
|
1118
1068
|
break;
|
|
1119
1069
|
}
|
|
1120
1070
|
debugDevice('Waiting for scroll and inertia to complete...');
|
|
@@ -1171,7 +1121,7 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
1171
1121
|
const centerX = Math.round(windowSize.width / 2);
|
|
1172
1122
|
const startY = Math.round(0.9 * windowSize.height);
|
|
1173
1123
|
const endY = Math.round(0.5 * windowSize.height);
|
|
1174
|
-
await this.
|
|
1124
|
+
await this.swipeCoordinates(centerX, startY, centerX, endY, 300);
|
|
1175
1125
|
debugDevice('Dismissed keyboard with swipe up gesture from bottom of screen');
|
|
1176
1126
|
await (0, core_utils_namespaceObject.sleep)(500);
|
|
1177
1127
|
return true;
|
|
@@ -1248,6 +1198,45 @@ ScreenSize: ${size.width}x${size.height} (DPR: ${size.scale})
|
|
|
1248
1198
|
_define_property(this, "interfaceType", 'ios');
|
|
1249
1199
|
_define_property(this, "uri", void 0);
|
|
1250
1200
|
_define_property(this, "options", void 0);
|
|
1201
|
+
_define_property(this, "inputPrimitives", {
|
|
1202
|
+
pointer: {
|
|
1203
|
+
tap: (point)=>this.tapPoint(point),
|
|
1204
|
+
doubleClick: (point)=>this.doubleTapPoint(point),
|
|
1205
|
+
longPress: (point, opts)=>this.longPressPoint(point, opts?.duration),
|
|
1206
|
+
dragAndDrop: (from, to)=>this.swipePoint(from, to, 1000)
|
|
1207
|
+
},
|
|
1208
|
+
keyboard: {
|
|
1209
|
+
keyboardPress: (keyName)=>this.pressKey(keyName),
|
|
1210
|
+
typeText: async (value, opts)=>{
|
|
1211
|
+
const target = opts?.target;
|
|
1212
|
+
if (target && opts?.replace !== false) await this.clearInput(target);
|
|
1213
|
+
else if (target) await this.tapPoint({
|
|
1214
|
+
x: target.center[0],
|
|
1215
|
+
y: target.center[1]
|
|
1216
|
+
});
|
|
1217
|
+
if (opts?.focusOnly) return;
|
|
1218
|
+
await this.typeText(value, opts);
|
|
1219
|
+
},
|
|
1220
|
+
clearInput: (target)=>this.clearInput(target),
|
|
1221
|
+
cursorMove: async (direction, times = 1)=>{
|
|
1222
|
+
const arrowKey = 'left' === direction ? 'ArrowLeft' : 'ArrowRight';
|
|
1223
|
+
for(let i = 0; i < times; i++)await this.pressKey(arrowKey);
|
|
1224
|
+
}
|
|
1225
|
+
},
|
|
1226
|
+
touch: {
|
|
1227
|
+
swipe: async (start, end, opts)=>{
|
|
1228
|
+
const duration = opts?.duration ?? 300;
|
|
1229
|
+
const repeat = opts?.repeat ?? 1;
|
|
1230
|
+
for(let i = 0; i < repeat; i++)await this.swipePoint(start, end, duration);
|
|
1231
|
+
},
|
|
1232
|
+
pinch: async (center, opts)=>{
|
|
1233
|
+
await this.wdaBackend.pinch(Math.round(center.x), Math.round(center.y), opts.startDistance, opts.endDistance, opts.duration);
|
|
1234
|
+
}
|
|
1235
|
+
},
|
|
1236
|
+
scroll: {
|
|
1237
|
+
scroll: (param)=>this.performActionScroll(param)
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1251
1240
|
this.deviceId = 'pending-connection';
|
|
1252
1241
|
this.options = options;
|
|
1253
1242
|
this.customActions = options?.customActions;
|
|
@@ -1491,7 +1480,7 @@ class IOSMCPServer extends mcp_namespaceObject.BaseMCPServer {
|
|
|
1491
1480
|
constructor(toolsManager){
|
|
1492
1481
|
super({
|
|
1493
1482
|
name: '@midscene/ios-mcp',
|
|
1494
|
-
version: "1.8.
|
|
1483
|
+
version: "1.8.1",
|
|
1495
1484
|
description: 'Control the iOS device using natural language commands'
|
|
1496
1485
|
}, toolsManager);
|
|
1497
1486
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import { DeviceAction } from '@midscene/core';
|
|
|
8
8
|
import type { ElementInfo } from '@midscene/shared/extractor';
|
|
9
9
|
import { InitArgSpec } from '@midscene/shared/mcp/base-tools';
|
|
10
10
|
import { InterfaceType } from '@midscene/core';
|
|
11
|
-
import { IOSDeviceInputOpt } from '@midscene/core/device';
|
|
12
11
|
import { IOSDeviceOpt } from '@midscene/core/device';
|
|
12
|
+
import { MobileInputPrimitives } from '@midscene/core/device';
|
|
13
13
|
import { overrideAIConfig } from '@midscene/shared/env';
|
|
14
14
|
import { PlaygroundPlatformDescriptor } from '@midscene/playground';
|
|
15
15
|
import { Point } from '@midscene/core';
|
|
@@ -88,7 +88,14 @@ export declare class IOSDevice implements AbstractInterface {
|
|
|
88
88
|
interfaceType: InterfaceType;
|
|
89
89
|
uri: string | undefined;
|
|
90
90
|
options?: IOSDeviceOpt;
|
|
91
|
+
readonly inputPrimitives: MobileInputPrimitives;
|
|
92
|
+
private tapPoint;
|
|
93
|
+
private doubleTapPoint;
|
|
94
|
+
private longPressPoint;
|
|
95
|
+
private swipePoint;
|
|
96
|
+
private clearInputAt;
|
|
91
97
|
actionSpace(): DeviceAction<any>[];
|
|
98
|
+
private performActionScroll;
|
|
92
99
|
constructor(options?: IOSDeviceOpt);
|
|
93
100
|
describe(): string;
|
|
94
101
|
getConnectedDeviceInfo(): Promise<{
|
|
@@ -128,13 +135,10 @@ export declare class IOSDevice implements AbstractInterface {
|
|
|
128
135
|
clearInput(element?: ElementInfo): Promise<void>;
|
|
129
136
|
url(): Promise<string>;
|
|
130
137
|
tap(x: number, y: number): Promise<void>;
|
|
131
|
-
mouseClick(x: number, y: number): Promise<void>;
|
|
132
|
-
doubleTap(x: number, y: number): Promise<void>;
|
|
133
|
-
tripleTap(x: number, y: number): Promise<void>;
|
|
134
|
-
longPress(x: number, y: number, duration?: number): Promise<void>;
|
|
135
138
|
swipe(fromX: number, fromY: number, toX: number, toY: number, duration?: number): Promise<void>;
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
private swipeCoordinates;
|
|
140
|
+
private typeText;
|
|
141
|
+
private pressKey;
|
|
138
142
|
scrollUp(distance?: number, startPoint?: Point): Promise<void>;
|
|
139
143
|
scrollDown(distance?: number, startPoint?: Point): Promise<void>;
|
|
140
144
|
scrollLeft(distance?: number, startPoint?: Point): Promise<void>;
|
|
@@ -9,10 +9,10 @@ import { DeviceAction } from '@midscene/core';
|
|
|
9
9
|
import type { ElementInfo } from '@midscene/shared/extractor';
|
|
10
10
|
import { InitArgSpec } from '@midscene/shared/mcp/base-tools';
|
|
11
11
|
import { InterfaceType } from '@midscene/core';
|
|
12
|
-
import { IOSDeviceInputOpt } from '@midscene/core/device';
|
|
13
12
|
import { IOSDeviceOpt } from '@midscene/core/device';
|
|
14
13
|
import { LaunchMCPServerOptions } from '@midscene/shared/mcp';
|
|
15
14
|
import { LaunchMCPServerResult } from '@midscene/shared/mcp';
|
|
15
|
+
import { MobileInputPrimitives } from '@midscene/core/device';
|
|
16
16
|
import { Point } from '@midscene/core';
|
|
17
17
|
import { Size } from '@midscene/core';
|
|
18
18
|
import { Tool } from '@midscene/shared/mcp';
|
|
@@ -82,7 +82,14 @@ declare class IOSDevice implements AbstractInterface {
|
|
|
82
82
|
interfaceType: InterfaceType;
|
|
83
83
|
uri: string | undefined;
|
|
84
84
|
options?: IOSDeviceOpt;
|
|
85
|
+
readonly inputPrimitives: MobileInputPrimitives;
|
|
86
|
+
private tapPoint;
|
|
87
|
+
private doubleTapPoint;
|
|
88
|
+
private longPressPoint;
|
|
89
|
+
private swipePoint;
|
|
90
|
+
private clearInputAt;
|
|
85
91
|
actionSpace(): DeviceAction<any>[];
|
|
92
|
+
private performActionScroll;
|
|
86
93
|
constructor(options?: IOSDeviceOpt);
|
|
87
94
|
describe(): string;
|
|
88
95
|
getConnectedDeviceInfo(): Promise<{
|
|
@@ -122,13 +129,10 @@ declare class IOSDevice implements AbstractInterface {
|
|
|
122
129
|
clearInput(element?: ElementInfo): Promise<void>;
|
|
123
130
|
url(): Promise<string>;
|
|
124
131
|
tap(x: number, y: number): Promise<void>;
|
|
125
|
-
mouseClick(x: number, y: number): Promise<void>;
|
|
126
|
-
doubleTap(x: number, y: number): Promise<void>;
|
|
127
|
-
tripleTap(x: number, y: number): Promise<void>;
|
|
128
|
-
longPress(x: number, y: number, duration?: number): Promise<void>;
|
|
129
132
|
swipe(fromX: number, fromY: number, toX: number, toY: number, duration?: number): Promise<void>;
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
private swipeCoordinates;
|
|
134
|
+
private typeText;
|
|
135
|
+
private pressKey;
|
|
132
136
|
scrollUp(distance?: number, startPoint?: Point): Promise<void>;
|
|
133
137
|
scrollDown(distance?: number, startPoint?: Point): Promise<void>;
|
|
134
138
|
scrollLeft(distance?: number, startPoint?: Point): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/ios",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "iOS automation library for Midscene",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iOS UI automation",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@inquirer/prompts": "^7.8.6",
|
|
45
45
|
"open": "10.1.0",
|
|
46
|
-
"@midscene/core": "1.8.
|
|
47
|
-
"@midscene/
|
|
48
|
-
"@midscene/
|
|
49
|
-
"@midscene/
|
|
46
|
+
"@midscene/core": "1.8.1",
|
|
47
|
+
"@midscene/shared": "1.8.1",
|
|
48
|
+
"@midscene/playground": "1.8.1",
|
|
49
|
+
"@midscene/webdriver": "1.8.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@rslib/core": "^0.18.3",
|
package/static/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.7b1abe58.js"></script><script defer src="/static/js/
|
|
1
|
+
<!doctype html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.7b1abe58.js"></script><script defer src="/static/js/596.5426be9e.js"></script><script defer src="/static/js/index.acaa5ec1.js"></script><link href="/static/css/index.26c9c911.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
|