@midscene/ios 1.9.8 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/cli.mjs +7 -7
- package/dist/es/index.mjs +6 -6
- package/dist/lib/cli.js +7 -7
- package/dist/lib/index.js +6 -6
- package/dist/types/index.d.ts +4 -4
- package/package.json +5 -10
- package/static/index.html +1 -1
- package/static/static/js/index.9c67d55f.js +951 -0
- package/static/static/js/index.9c67d55f.js.map +1 -0
- package/dist/es/mcp-server.mjs +0 -1485
- package/dist/lib/mcp-server.js +0 -1535
- package/dist/types/mcp-server.d.ts +0 -251
- package/static/static/js/index.44b83907.js +0 -948
- package/static/static/js/index.44b83907.js.map +0 -1
- /package/static/static/js/{index.44b83907.js.LICENSE.txt → index.9c67d55f.js.LICENSE.txt} +0 -0
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { AbstractInterface } from '@midscene/core/device';
|
|
2
|
-
import type { ActionParam } from '@midscene/core';
|
|
3
|
-
import type { ActionReturn } from '@midscene/core';
|
|
4
|
-
import { Agent } from '@midscene/core/agent';
|
|
5
|
-
import { AgentBehaviorInitArgs } from '@midscene/shared/mcp/agent-behavior-init-args';
|
|
6
|
-
import { AgentOpt } from '@midscene/core/agent';
|
|
7
|
-
import { BaseMCPServer } from '@midscene/shared/mcp';
|
|
8
|
-
import { BaseMidsceneTools } from '@midscene/shared/mcp/base-tools';
|
|
9
|
-
import { DeviceAction } from '@midscene/core';
|
|
10
|
-
import type { ElementInfo } from '@midscene/shared/extractor';
|
|
11
|
-
import { InitArgSpec } from '@midscene/shared/mcp/base-tools';
|
|
12
|
-
import { InterfaceType } from '@midscene/core';
|
|
13
|
-
import { IOSDeviceOpt } from '@midscene/core/device';
|
|
14
|
-
import { LaunchMCPServerOptions } from '@midscene/shared/mcp';
|
|
15
|
-
import { LaunchMCPServerResult } from '@midscene/shared/mcp';
|
|
16
|
-
import { MobileInputPrimitives } from '@midscene/core/device';
|
|
17
|
-
import { Point } from '@midscene/core';
|
|
18
|
-
import { Size } from '@midscene/core';
|
|
19
|
-
import { Tool } from '@midscene/shared/mcp';
|
|
20
|
-
import type { ToolDefinition } from '@midscene/shared/mcp/types';
|
|
21
|
-
import { z } from '@midscene/core';
|
|
22
|
-
|
|
23
|
-
declare type ActionArgs<T extends DeviceAction> = [ActionParam<T>] extends [undefined] ? [] : [ActionParam<T>];
|
|
24
|
-
|
|
25
|
-
declare type DeviceActionIOSAppSwitcher = DeviceAction<undefined, void>;
|
|
26
|
-
|
|
27
|
-
declare type DeviceActionIOSHomeButton = DeviceAction<undefined, void>;
|
|
28
|
-
|
|
29
|
-
declare type DeviceActionRunWdaRequest = DeviceAction<RunWdaRequestParam, RunWdaRequestReturn>;
|
|
30
|
-
|
|
31
|
-
declare class IOSAgent extends Agent<IOSDevice> {
|
|
32
|
-
/**
|
|
33
|
-
* Execute WebDriverAgent API request directly
|
|
34
|
-
* Type-safe wrapper around the RunWdaRequest action from actionSpace
|
|
35
|
-
*/
|
|
36
|
-
runWdaRequest: WrappedAction<DeviceActionRunWdaRequest>;
|
|
37
|
-
/**
|
|
38
|
-
* Trigger the system home operation on iOS devices
|
|
39
|
-
*/
|
|
40
|
-
home: WrappedAction<DeviceActionIOSHomeButton>;
|
|
41
|
-
/**
|
|
42
|
-
* Trigger the system app switcher operation on iOS devices
|
|
43
|
-
*/
|
|
44
|
-
appSwitcher: WrappedAction<DeviceActionIOSAppSwitcher>;
|
|
45
|
-
/**
|
|
46
|
-
* User-provided app name to bundle ID mapping
|
|
47
|
-
*/
|
|
48
|
-
private appNameMapping;
|
|
49
|
-
constructor(device: IOSDevice, opts?: IOSAgentOpt);
|
|
50
|
-
/**
|
|
51
|
-
* Launch an iOS app or URL
|
|
52
|
-
* @param uri - App name, bundle ID, or URL to launch
|
|
53
|
-
*/
|
|
54
|
-
launch(uri: string): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Terminate (close) an iOS app by bundle ID
|
|
57
|
-
* @param uri - Bundle ID of the app to terminate
|
|
58
|
-
*/
|
|
59
|
-
terminate(uri: string): Promise<void>;
|
|
60
|
-
private createActionWrapper;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
declare type IOSAgentOpt = AgentOpt & {
|
|
64
|
-
/**
|
|
65
|
-
* Custom mapping of app names to bundle IDs
|
|
66
|
-
* User-provided mappings will take precedence over default mappings
|
|
67
|
-
*/
|
|
68
|
-
appNameMapping?: Record<string, string>;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
declare class IOSDevice implements AbstractInterface {
|
|
72
|
-
private deviceId;
|
|
73
|
-
private devicePixelRatio;
|
|
74
|
-
private devicePixelRatioInitialized;
|
|
75
|
-
private destroyed;
|
|
76
|
-
private description;
|
|
77
|
-
private customActions?;
|
|
78
|
-
private wdaBackend;
|
|
79
|
-
private wdaManager;
|
|
80
|
-
/** URL of WDA's native MJPEG server for real-time streaming */
|
|
81
|
-
mjpegStreamUrl: string;
|
|
82
|
-
private appNameMapping;
|
|
83
|
-
interfaceType: InterfaceType;
|
|
84
|
-
uri: string | undefined;
|
|
85
|
-
options?: IOSDeviceOpt;
|
|
86
|
-
readonly inputPrimitives: MobileInputPrimitives;
|
|
87
|
-
private tapPoint;
|
|
88
|
-
private doubleTapPoint;
|
|
89
|
-
private longPressPoint;
|
|
90
|
-
private swipePoint;
|
|
91
|
-
private clearInputAt;
|
|
92
|
-
actionSpace(): DeviceAction<any>[];
|
|
93
|
-
private performActionScroll;
|
|
94
|
-
constructor(options?: IOSDeviceOpt);
|
|
95
|
-
describe(): string;
|
|
96
|
-
getConnectedDeviceInfo(): Promise<{
|
|
97
|
-
udid: string;
|
|
98
|
-
name: string;
|
|
99
|
-
model: string;
|
|
100
|
-
} | null>;
|
|
101
|
-
connect(): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Set the app name to bundle ID mapping
|
|
104
|
-
*/
|
|
105
|
-
setAppNameMapping(mapping: Record<string, string>): void;
|
|
106
|
-
/**
|
|
107
|
-
* Resolve app name to bundle ID using the mapping.
|
|
108
|
-
* Comparison is case-insensitive and ignores spaces, dashes, and underscores.
|
|
109
|
-
* Keys in appNameMapping are pre-normalized, so we only need to normalize the input.
|
|
110
|
-
*
|
|
111
|
-
* @param appName The app name to resolve.
|
|
112
|
-
*/
|
|
113
|
-
private resolveBundleId;
|
|
114
|
-
launch(uri: string): Promise<IOSDevice>;
|
|
115
|
-
/**
|
|
116
|
-
* Terminate (close) an iOS app by bundle ID.
|
|
117
|
-
* Supports app name resolution via setAppNameMapping when provided.
|
|
118
|
-
*/
|
|
119
|
-
terminate(bundleId: string): Promise<void>;
|
|
120
|
-
getElementsInfo(): Promise<ElementInfo[]>;
|
|
121
|
-
getElementsNodeTree(): Promise<any>;
|
|
122
|
-
private initializeDevicePixelRatio;
|
|
123
|
-
getScreenSize(): Promise<{
|
|
124
|
-
width: number;
|
|
125
|
-
height: number;
|
|
126
|
-
scale: number;
|
|
127
|
-
}>;
|
|
128
|
-
size(): Promise<Size>;
|
|
129
|
-
screenshotBase64(): Promise<string>;
|
|
130
|
-
clearInput(element?: ElementInfo): Promise<void>;
|
|
131
|
-
url(): Promise<string>;
|
|
132
|
-
tap(x: number, y: number): Promise<void>;
|
|
133
|
-
swipe(fromX: number, fromY: number, toX: number, toY: number, duration?: number): Promise<void>;
|
|
134
|
-
private swipeCoordinates;
|
|
135
|
-
private typeText;
|
|
136
|
-
private pressKey;
|
|
137
|
-
scrollUp(distance?: number, startPoint?: Point): Promise<void>;
|
|
138
|
-
scrollDown(distance?: number, startPoint?: Point): Promise<void>;
|
|
139
|
-
scrollLeft(distance?: number, startPoint?: Point): Promise<void>;
|
|
140
|
-
scrollRight(distance?: number, startPoint?: Point): Promise<void>;
|
|
141
|
-
scrollUntilTop(startPoint?: Point): Promise<void>;
|
|
142
|
-
scrollUntilBottom(startPoint?: Point): Promise<void>;
|
|
143
|
-
private compareScreenshots;
|
|
144
|
-
private scrollUntilBoundary;
|
|
145
|
-
scrollUntilLeft(startPoint?: Point): Promise<void>;
|
|
146
|
-
scrollUntilRight(startPoint?: Point): Promise<void>;
|
|
147
|
-
home(): Promise<void>;
|
|
148
|
-
appSwitcher(): Promise<void>;
|
|
149
|
-
hideKeyboard(keyNames?: string[]): Promise<boolean>;
|
|
150
|
-
/**
|
|
151
|
-
* Open a URL using WebDriverAgent
|
|
152
|
-
* @param url The URL to open (supports http://, https://, and custom schemes)
|
|
153
|
-
* @param options Configuration options for URL opening
|
|
154
|
-
*/
|
|
155
|
-
openUrl(url: string, options?: {
|
|
156
|
-
useSafariAsBackup?: boolean;
|
|
157
|
-
waitTime?: number;
|
|
158
|
-
}): Promise<void>;
|
|
159
|
-
/**
|
|
160
|
-
* Open a URL via Safari (backup method for real devices)
|
|
161
|
-
* @param url The URL to open
|
|
162
|
-
*/
|
|
163
|
-
openUrlViaSafari(url: string): Promise<void>;
|
|
164
|
-
/**
|
|
165
|
-
* Execute a WebDriverAgent API request directly
|
|
166
|
-
* This is the iOS equivalent of Android's runAdbShell
|
|
167
|
-
* @param method HTTP method (GET, POST, DELETE, PUT)
|
|
168
|
-
* @param endpoint WebDriver API endpoint
|
|
169
|
-
* @param data Optional request body data
|
|
170
|
-
* @returns Response from the WebDriver API
|
|
171
|
-
*/
|
|
172
|
-
runWdaRequest<TResult = any>(method: WDAHttpMethod, endpoint: string, data?: any): Promise<TResult>;
|
|
173
|
-
destroy(): Promise<void>;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
declare type IOSInitArgs = AgentBehaviorInitArgs & Pick<IOSDeviceOpt, 'deviceId' | 'wdaHost' | 'wdaPort' | 'sessionId' | 'useWDA' | 'wdaMjpegPort'>;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* iOS MCP Server
|
|
180
|
-
* Provides MCP tools for iOS automation through WebDriverAgent
|
|
181
|
-
*/
|
|
182
|
-
export declare class IOSMCPServer extends BaseMCPServer {
|
|
183
|
-
constructor(toolsManager?: IOSMidsceneTools);
|
|
184
|
-
protected createToolsManager(): IOSMidsceneTools;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* iOS-specific tools manager
|
|
189
|
-
* Extends BaseMidsceneTools to provide iOS WebDriverAgent connection tools
|
|
190
|
-
*/
|
|
191
|
-
declare class IOSMidsceneTools extends BaseMidsceneTools<IOSAgent, IOSInitArgs> {
|
|
192
|
-
protected getCliReportSessionName(): string;
|
|
193
|
-
protected readonly initArgSpec: InitArgSpec<IOSInitArgs>;
|
|
194
|
-
private lastOptsSignature?;
|
|
195
|
-
protected createTemporaryDevice(): IOSDevice;
|
|
196
|
-
protected ensureAgent(opts?: IOSInitArgs): Promise<IOSAgent>;
|
|
197
|
-
/**
|
|
198
|
-
* Provide iOS-specific platform tools
|
|
199
|
-
*/
|
|
200
|
-
protected preparePlatformTools(): ToolDefinition[];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Create MCP kit for a specific iOS Agent
|
|
205
|
-
*/
|
|
206
|
-
export declare function mcpKitForAgent(agent: Agent | IOSAgent): Promise<{
|
|
207
|
-
description: string;
|
|
208
|
-
tools: Tool[];
|
|
209
|
-
}>;
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Create an MCP server launcher for a specific iOS Agent
|
|
213
|
-
*/
|
|
214
|
-
export declare function mcpServerForAgent(agent: Agent | IOSAgent): {
|
|
215
|
-
launch(options?: {
|
|
216
|
-
verbose?: boolean;
|
|
217
|
-
}): Promise<LaunchMCPServerResult>;
|
|
218
|
-
launchHttp(options: LaunchMCPServerOptions): Promise<LaunchMCPServerResult>;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
declare type RunWdaRequestParam = z.infer<typeof runWdaRequestParamSchema>;
|
|
222
|
-
|
|
223
|
-
declare const runWdaRequestParamSchema: z.ZodObject<{
|
|
224
|
-
method: z.ZodEnum<["GET", "POST", "DELETE", "PUT"]>;
|
|
225
|
-
endpoint: z.ZodString;
|
|
226
|
-
data: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
227
|
-
}, "strip", z.ZodTypeAny, {
|
|
228
|
-
method: "POST" | "GET" | "DELETE" | "PUT";
|
|
229
|
-
endpoint: string;
|
|
230
|
-
data?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
231
|
-
}, {
|
|
232
|
-
method: "POST" | "GET" | "DELETE" | "PUT";
|
|
233
|
-
endpoint: string;
|
|
234
|
-
data?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
235
|
-
}>;
|
|
236
|
-
|
|
237
|
-
declare type RunWdaRequestReturn = Awaited<ReturnType<IOSDevice['runWdaRequest']>>;
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* HTTP methods supported by WebDriverAgent API
|
|
241
|
-
*/
|
|
242
|
-
declare const WDA_HTTP_METHODS: readonly ["GET", "POST", "DELETE", "PUT"];
|
|
243
|
-
|
|
244
|
-
declare type WDAHttpMethod = (typeof WDA_HTTP_METHODS)[number];
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Helper type to convert DeviceAction to wrapped method signature
|
|
248
|
-
*/
|
|
249
|
-
declare type WrappedAction<T extends DeviceAction> = (...args: ActionArgs<T>) => Promise<ActionReturn<T>>;
|
|
250
|
-
|
|
251
|
-
export { }
|