appium-ios-remotexpc 0.7.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.8.0](https://github.com/appium/appium-ios-remotexpc/compare/v0.7.0...v0.8.0) (2025-10-17)
2
+
3
+ ### Features
4
+
5
+ * implement `webinspector` shim service ([#81](https://github.com/appium/appium-ios-remotexpc/issues/81)) ([0abd6e3](https://github.com/appium/appium-ios-remotexpc/commit/0abd6e32ba3f6abdbc238bde7201abf96646cbcc))
6
+
1
7
  ## [0.7.0](https://github.com/appium/appium-ios-remotexpc/compare/v0.6.2...v0.7.0) (2025-10-09)
2
8
 
3
9
  ### Features
@@ -4,6 +4,6 @@ import { TunnelRegistryServer, startTunnelRegistryServer } from './lib/tunnel/tu
4
4
  import { Usbmux, createUsbmux } from './lib/usbmux/index.js';
5
5
  import * as Services from './services.js';
6
6
  import { startCoreDeviceProxy } from './services/ios/tunnel-service/index.js';
7
- export type { DiagnosticsService, MobileImageMounterService, NotificationProxyService, MobileConfigService, SpringboardService, SyslogService, SocketInfo, TunnelResult, TunnelRegistry, TunnelRegistryEntry, DiagnosticsServiceWithConnection, MobileImageMounterServiceWithConnection, NotificationProxyServiceWithConnection, MobileConfigServiceWithConnection, SpringboardServiceWithConnection, } from './lib/types.js';
7
+ export type { DiagnosticsService, MobileImageMounterService, NotificationProxyService, MobileConfigService, SpringboardService, WebInspectorService, SyslogService, SocketInfo, TunnelResult, TunnelRegistry, TunnelRegistryEntry, DiagnosticsServiceWithConnection, MobileImageMounterServiceWithConnection, NotificationProxyServiceWithConnection, MobileConfigServiceWithConnection, SpringboardServiceWithConnection, WebInspectorServiceWithConnection, } from './lib/types.js';
8
8
  export { createUsbmux, Services, Usbmux, TunnelManager, PacketStreamServer, PacketStreamClient, createLockdownServiceByUDID, startCoreDeviceProxy, TunnelRegistryServer, startTunnelRegistryServer, };
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,YAAY,EACV,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,gCAAgC,EAChC,uCAAuC,EACvC,sCAAsC,EACtC,iCAAiC,EACjC,gCAAgC,GACjC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,GAC1B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,YAAY,EACV,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,gCAAgC,EAChC,uCAAuC,EACvC,sCAAsC,EACtC,iCAAiC,EACjC,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,GAC1B,CAAC"}
@@ -269,6 +269,90 @@ export interface MobileConfigServiceWithConnection {
269
269
  /** The RemoteXPC connection that can be used to close the connection */
270
270
  remoteXPC: RemoteXpcConnection;
271
271
  }
272
+ /**
273
+ * Represents the WebInspectorService
274
+ */
275
+ export interface WebInspectorService extends BaseService {
276
+ /**
277
+ * Send a message to the WebInspector service
278
+ * @param selector The RPC selector (e.g., '_rpc_reportIdentifier:')
279
+ * @param args The arguments dictionary for the message
280
+ * @returns Promise that resolves when the message is sent
281
+ */
282
+ sendMessage(selector: string, args?: PlistDictionary): Promise<void>;
283
+ /**
284
+ * Listen to messages from the WebInspector service using async generator
285
+ * @yields PlistMessage - Messages received from the WebInspector service
286
+ */
287
+ listenMessage(): AsyncGenerator<PlistMessage, void, unknown>;
288
+ /**
289
+ * Stop listening to messages
290
+ */
291
+ stopListening(): void;
292
+ /**
293
+ * Close the connection and clean up resources
294
+ */
295
+ close(): Promise<void>;
296
+ /**
297
+ * Get the connection ID being used for this service
298
+ * @returns The connection identifier
299
+ */
300
+ getConnectionId(): string;
301
+ /**
302
+ * Request application launch
303
+ * @param bundleId The bundle identifier of the application to launch
304
+ */
305
+ requestApplicationLaunch(bundleId: string): Promise<void>;
306
+ /**
307
+ * Get connected applications
308
+ */
309
+ getConnectedApplications(): Promise<void>;
310
+ /**
311
+ * Forward get listing for an application
312
+ * @param appId The application identifier
313
+ */
314
+ forwardGetListing(appId: string): Promise<void>;
315
+ /**
316
+ * Forward automation session request
317
+ * @param sessionId The session identifier
318
+ * @param appId The application identifier
319
+ * @param capabilities Optional session capabilities
320
+ */
321
+ forwardAutomationSessionRequest(sessionId: string, appId: string, capabilities?: PlistDictionary): Promise<void>;
322
+ /**
323
+ * Forward socket setup for inspector connection
324
+ * @param sessionId The session identifier
325
+ * @param appId The application identifier
326
+ * @param pageId The page identifier
327
+ * @param automaticallyPause Whether to automatically pause (defaults to true)
328
+ */
329
+ forwardSocketSetup(sessionId: string, appId: string, pageId: number, automaticallyPause?: boolean): Promise<void>;
330
+ /**
331
+ * Forward socket data to a page
332
+ * @param sessionId The session identifier
333
+ * @param appId The application identifier
334
+ * @param pageId The page identifier
335
+ * @param data The data to send (will be JSON stringified)
336
+ */
337
+ forwardSocketData(sessionId: string, appId: string, pageId: number, data: any): Promise<void>;
338
+ /**
339
+ * Forward indicate web view
340
+ * @param appId The application identifier
341
+ * @param pageId The page identifier
342
+ * @param enable Whether to enable indication
343
+ */
344
+ forwardIndicateWebView(appId: string, pageId: number, enable: boolean): Promise<void>;
345
+ }
346
+ /**
347
+ * Represents a WebInspectorService instance with its associated RemoteXPC connection
348
+ * This allows callers to properly manage the connection lifecycle
349
+ */
350
+ export interface WebInspectorServiceWithConnection {
351
+ /** The WebInspectorService instance */
352
+ webInspectorService: WebInspectorService;
353
+ /** The RemoteXPC connection that can be used to close the connection */
354
+ remoteXPC: RemoteXpcConnection;
355
+ }
272
356
  /**
273
357
  * Options for configuring syslog capture
274
358
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,O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@ -20,6 +20,12 @@ export declare class ServiceConnection extends BasePlistService {
20
20
  * Sends a plist request to the device and returns the response
21
21
  */
22
22
  sendPlistRequest(requestObj: PlistDictionary, timeout?: number): Promise<PlistDictionary>;
23
+ /**
24
+ * Sends a plist message without waiting for a response
25
+ * This is useful for fire-and-forget style communication
26
+ * @param message The message to send
27
+ */
28
+ sendPlist(message: PlistDictionary): void;
23
29
  /**
24
30
  * Gets the underlying socket
25
31
  * @returns The socket used by this service
@@ -1 +1 @@
1
- {"version":3,"file":"service-connection.d.ts","sourceRoot":"","sources":["../../src/service-connection.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAIlE;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,iBAAiB,CAAC;IAyB7B;;OAEG;IACH,gBAAgB,CACd,UAAU,EAAE,eAAe,EAC3B,OAAO,SAAQ,GACd,OAAO,CAAC,eAAe,CAAC;IAI3B;;;OAGG;IACH,SAAS,IAAI,GAAG,CAAC,MAAM;IAIvB;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"service-connection.d.ts","sourceRoot":"","sources":["../../src/service-connection.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAIlE;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,iBAAiB,CAAC;IAyB7B;;OAEG;IACH,gBAAgB,CACd,UAAU,EAAE,eAAe,EAC3B,OAAO,SAAQ,GACd,OAAO,CAAC,eAAe,CAAC;IAI3B;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAIzC;;;OAGG;IACH,SAAS,IAAI,GAAG,CAAC,MAAM;IAIvB;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAED,eAAe,iBAAiB,CAAC"}
@@ -34,6 +34,14 @@ export class ServiceConnection extends BasePlistService {
34
34
  sendPlistRequest(requestObj, timeout = 10000) {
35
35
  return this.sendAndReceive(requestObj, timeout);
36
36
  }
37
+ /**
38
+ * Sends a plist message without waiting for a response
39
+ * This is useful for fire-and-forget style communication
40
+ * @param message The message to send
41
+ */
42
+ sendPlist(message) {
43
+ this.send(message);
44
+ }
37
45
  /**
38
46
  * Gets the underlying socket
39
47
  * @returns The socket used by this service
@@ -3,5 +3,6 @@ import * as diagnostics from './ios/diagnostic-service/index.js';
3
3
  import * as mobileImageMounter from './ios/mobile-image-mounter/index.js';
4
4
  import * as syslog from './ios/syslog-service/index.js';
5
5
  import * as tunnel from './ios/tunnel-service/index.js';
6
- export { diagnostics, mobileImageMounter, syslog, tunnel, TunnelRegistryServer, startTunnelRegistryServer, };
6
+ import * as webinspector from './ios/webinspector/index.js';
7
+ export { diagnostics, mobileImageMounter, syslog, tunnel, webinspector, TunnelRegistryServer, startTunnelRegistryServer, };
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,kBAAkB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AACxD,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAExD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,MAAM,EACN,oBAAoB,EACpB,yBAAyB,GAC1B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,kBAAkB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AACxD,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,GAC1B,CAAC"}
@@ -3,4 +3,5 @@ import * as diagnostics from './ios/diagnostic-service/index.js';
3
3
  import * as mobileImageMounter from './ios/mobile-image-mounter/index.js';
4
4
  import * as syslog from './ios/syslog-service/index.js';
5
5
  import * as tunnel from './ios/tunnel-service/index.js';
6
- export { diagnostics, mobileImageMounter, syslog, tunnel, TunnelRegistryServer, startTunnelRegistryServer, };
6
+ import * as webinspector from './ios/webinspector/index.js';
7
+ export { diagnostics, mobileImageMounter, syslog, tunnel, webinspector, TunnelRegistryServer, startTunnelRegistryServer, };
@@ -0,0 +1,114 @@
1
+ import type { PlistDictionary, PlistMessage } from '../../../lib/types.js';
2
+ import { BaseService } from '../base-service.js';
3
+ /**
4
+ * Interface for WebInspector message structure
5
+ */
6
+ export interface WebInspectorMessage extends PlistDictionary {
7
+ __selector: string;
8
+ __argument: PlistDictionary;
9
+ }
10
+ /**
11
+ * WebInspectorService provides an API to:
12
+ * - Send messages to webinspectord
13
+ * - Listen to messages from webinspectord
14
+ * - Communicate with web views and Safari on iOS devices
15
+ *
16
+ * This service is used for web automation, inspection, and debugging.
17
+ */
18
+ export declare class WebInspectorService extends BaseService {
19
+ static readonly RSD_SERVICE_NAME = "com.apple.webinspector.shim.remote";
20
+ private static readonly RPC_REPORT_IDENTIFIER;
21
+ private static readonly RPC_REQUEST_APPLICATION_LAUNCH;
22
+ private static readonly RPC_GET_CONNECTED_APPLICATIONS;
23
+ private static readonly RPC_FORWARD_GET_LISTING;
24
+ private static readonly RPC_FORWARD_AUTOMATION_SESSION_REQUEST;
25
+ private static readonly RPC_FORWARD_SOCKET_SETUP;
26
+ private static readonly RPC_FORWARD_SOCKET_DATA;
27
+ private static readonly RPC_FORWARD_INDICATE_WEB_VIEW;
28
+ private connection;
29
+ private messageEmitter;
30
+ private isReceiving;
31
+ private readonly connectionId;
32
+ private receivePromise;
33
+ constructor(address: [string, number]);
34
+ /**
35
+ * Send a message to the WebInspector service
36
+ * @param selector The RPC selector (e.g., '_rpc_reportIdentifier:')
37
+ * @param args The arguments dictionary for the message
38
+ * @returns Promise that resolves when the message is sent
39
+ */
40
+ sendMessage(selector: string, args?: PlistDictionary): Promise<void>;
41
+ /**
42
+ * Listen to messages from the WebInspector service using async generator
43
+ * @yields PlistMessage - Messages received from the WebInspector service
44
+ */
45
+ listenMessage(): AsyncGenerator<PlistMessage, void, unknown>;
46
+ /**
47
+ * Stop listening to messages
48
+ */
49
+ stopListening(): void;
50
+ /**
51
+ * Close the connection and clean up resources
52
+ */
53
+ close(): Promise<void>;
54
+ /**
55
+ * Get the connection ID being used for this service
56
+ * @returns The connection identifier
57
+ */
58
+ getConnectionId(): string;
59
+ /**
60
+ * Request application launch
61
+ * @param bundleId The bundle identifier of the application to launch
62
+ */
63
+ requestApplicationLaunch(bundleId: string): Promise<void>;
64
+ /**
65
+ * Get connected applications
66
+ */
67
+ getConnectedApplications(): Promise<void>;
68
+ /**
69
+ * Forward get listing for an application
70
+ * @param appId The application identifier
71
+ */
72
+ forwardGetListing(appId: string): Promise<void>;
73
+ /**
74
+ * Forward automation session request
75
+ * @param sessionId The session identifier
76
+ * @param appId The application identifier
77
+ * @param capabilities Optional session capabilities
78
+ */
79
+ forwardAutomationSessionRequest(sessionId: string, appId: string, capabilities?: PlistDictionary): Promise<void>;
80
+ /**
81
+ * Forward socket setup for inspector connection
82
+ * @param sessionId The session identifier
83
+ * @param appId The application identifier
84
+ * @param pageId The page identifier
85
+ * @param automaticallyPause Whether to automatically pause (defaults to true)
86
+ */
87
+ forwardSocketSetup(sessionId: string, appId: string, pageId: number, automaticallyPause?: boolean): Promise<void>;
88
+ /**
89
+ * Forward socket data to a page
90
+ * @param sessionId The session identifier
91
+ * @param appId The application identifier
92
+ * @param pageId The page identifier
93
+ * @param data The data to send (will be JSON stringified)
94
+ */
95
+ forwardSocketData(sessionId: string, appId: string, pageId: number, data: any): Promise<void>;
96
+ /**
97
+ * Forward indicate web view
98
+ * @param appId The application identifier
99
+ * @param pageId The page identifier
100
+ * @param enable Whether to enable indication
101
+ */
102
+ forwardIndicateWebView(appId: string, pageId: number, enable: boolean): Promise<void>;
103
+ /**
104
+ * Connect to the WebInspector service
105
+ * @returns Promise resolving to the ServiceConnection instance
106
+ */
107
+ private connectToWebInspectorService;
108
+ /**
109
+ * Start receiving messages from the WebInspector service in the background
110
+ */
111
+ private startMessageReceiver;
112
+ }
113
+ export default WebInspectorService;
114
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/ios/webinspector/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjD;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,MAAM,CAAC,QAAQ,CAAC,gBAAgB,wCAAwC;IAGxE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAA4B;IACzE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CACnB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CACnB;IACnC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAA6B;IAC5E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sCAAsC,CACpB;IAC1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAA8B;IAC9E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAA6B;IAC5E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,6BAA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;IAYhB;;;;;OAKG;IACG,sBAAsB,CAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC;IAQhB;;;OAGG;YACW,4BAA4B;IA2B1C;;OAEG;IACH,OAAO,CAAC,oBAAoB;CA0B7B;AAED,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,286 @@
1
+ import { logger } from '@appium/support';
2
+ import { randomUUID } from 'crypto';
3
+ import { EventEmitter } from 'events';
4
+ import { ServiceConnection } from '../../../service-connection.js';
5
+ import { BaseService } from '../base-service.js';
6
+ const log = logger.getLogger('WebInspectorService');
7
+ /**
8
+ * WebInspectorService provides an API to:
9
+ * - Send messages to webinspectord
10
+ * - Listen to messages from webinspectord
11
+ * - Communicate with web views and Safari on iOS devices
12
+ *
13
+ * This service is used for web automation, inspection, and debugging.
14
+ */
15
+ export class WebInspectorService extends BaseService {
16
+ static RSD_SERVICE_NAME = 'com.apple.webinspector.shim.remote';
17
+ // RPC method selectors
18
+ static RPC_REPORT_IDENTIFIER = '_rpc_reportIdentifier:';
19
+ static RPC_REQUEST_APPLICATION_LAUNCH = '_rpc_requestApplicationLaunch:';
20
+ static RPC_GET_CONNECTED_APPLICATIONS = '_rpc_getConnectedApplications:';
21
+ static RPC_FORWARD_GET_LISTING = '_rpc_forwardGetListing:';
22
+ static RPC_FORWARD_AUTOMATION_SESSION_REQUEST = '_rpc_forwardAutomationSessionRequest:';
23
+ static RPC_FORWARD_SOCKET_SETUP = '_rpc_forwardSocketSetup:';
24
+ static RPC_FORWARD_SOCKET_DATA = '_rpc_forwardSocketData:';
25
+ static RPC_FORWARD_INDICATE_WEB_VIEW = '_rpc_forwardIndicateWebView:';
26
+ connection = null;
27
+ messageEmitter = new EventEmitter();
28
+ isReceiving = false;
29
+ connectionId;
30
+ receivePromise = null;
31
+ constructor(address) {
32
+ super(address);
33
+ this.connectionId = randomUUID().toUpperCase();
34
+ }
35
+ /**
36
+ * Send a message to the WebInspector service
37
+ * @param selector The RPC selector (e.g., '_rpc_reportIdentifier:')
38
+ * @param args The arguments dictionary for the message
39
+ * @returns Promise that resolves when the message is sent
40
+ */
41
+ async sendMessage(selector, args = {}) {
42
+ const connection = await this.connectToWebInspectorService();
43
+ // Add connection identifier to all messages
44
+ const message = {
45
+ __selector: selector,
46
+ __argument: {
47
+ ...args,
48
+ WIRConnectionIdentifierKey: this.connectionId,
49
+ },
50
+ };
51
+ log.debug(`Sending WebInspector message: ${selector}`);
52
+ connection.sendPlist(message);
53
+ }
54
+ /**
55
+ * Listen to messages from the WebInspector service using async generator
56
+ * @yields PlistMessage - Messages received from the WebInspector service
57
+ */
58
+ async *listenMessage() {
59
+ await this.connectToWebInspectorService();
60
+ // Start receiving messages in background if not already started
61
+ if (!this.isReceiving) {
62
+ this.startMessageReceiver();
63
+ }
64
+ const queue = [];
65
+ let resolveNext = null;
66
+ let stopped = false;
67
+ const messageHandler = (message) => {
68
+ if (resolveNext) {
69
+ resolveNext({ value: message, done: false });
70
+ resolveNext = null;
71
+ }
72
+ else {
73
+ queue.push(message);
74
+ }
75
+ };
76
+ const stopHandler = () => {
77
+ stopped = true;
78
+ if (resolveNext) {
79
+ resolveNext({ value: undefined, done: true });
80
+ resolveNext = null;
81
+ }
82
+ };
83
+ this.messageEmitter.on('message', messageHandler);
84
+ this.messageEmitter.once('stop', stopHandler);
85
+ try {
86
+ while (!stopped) {
87
+ if (queue.length > 0) {
88
+ yield queue.shift();
89
+ }
90
+ else {
91
+ const message = await new Promise((resolve) => {
92
+ if (stopped) {
93
+ resolve(null);
94
+ return;
95
+ }
96
+ resolveNext = (result) => {
97
+ resolve(result.done ? null : result.value);
98
+ };
99
+ });
100
+ if (message === null) {
101
+ break;
102
+ }
103
+ yield message;
104
+ }
105
+ }
106
+ }
107
+ finally {
108
+ this.messageEmitter.off('message', messageHandler);
109
+ this.messageEmitter.off('stop', stopHandler);
110
+ }
111
+ }
112
+ /**
113
+ * Stop listening to messages
114
+ */
115
+ stopListening() {
116
+ this.isReceiving = false;
117
+ this.messageEmitter.emit('stop');
118
+ }
119
+ /**
120
+ * Close the connection and clean up resources
121
+ */
122
+ async close() {
123
+ this.stopListening();
124
+ if (this.connection) {
125
+ await this.connection.close();
126
+ this.connection = null;
127
+ log.debug('WebInspector connection closed');
128
+ }
129
+ if (this.receivePromise) {
130
+ await this.receivePromise;
131
+ }
132
+ }
133
+ /**
134
+ * Get the connection ID being used for this service
135
+ * @returns The connection identifier
136
+ */
137
+ getConnectionId() {
138
+ return this.connectionId;
139
+ }
140
+ /**
141
+ * Request application launch
142
+ * @param bundleId The bundle identifier of the application to launch
143
+ */
144
+ async requestApplicationLaunch(bundleId) {
145
+ await this.sendMessage(WebInspectorService.RPC_REQUEST_APPLICATION_LAUNCH, {
146
+ WIRApplicationBundleIdentifierKey: bundleId,
147
+ });
148
+ }
149
+ /**
150
+ * Get connected applications
151
+ */
152
+ async getConnectedApplications() {
153
+ await this.sendMessage(WebInspectorService.RPC_GET_CONNECTED_APPLICATIONS, {});
154
+ }
155
+ /**
156
+ * Forward get listing for an application
157
+ * @param appId The application identifier
158
+ */
159
+ async forwardGetListing(appId) {
160
+ await this.sendMessage(WebInspectorService.RPC_FORWARD_GET_LISTING, {
161
+ WIRApplicationIdentifierKey: appId,
162
+ });
163
+ }
164
+ /**
165
+ * Forward automation session request
166
+ * @param sessionId The session identifier
167
+ * @param appId The application identifier
168
+ * @param capabilities Optional session capabilities
169
+ */
170
+ async forwardAutomationSessionRequest(sessionId, appId, capabilities) {
171
+ const defaultCapabilities = {
172
+ 'org.webkit.webdriver.webrtc.allow-insecure-media-capture': true,
173
+ 'org.webkit.webdriver.webrtc.suppress-ice-candidate-filtering': false,
174
+ };
175
+ await this.sendMessage(WebInspectorService.RPC_FORWARD_AUTOMATION_SESSION_REQUEST, {
176
+ WIRApplicationIdentifierKey: appId,
177
+ WIRSessionIdentifierKey: sessionId,
178
+ WIRSessionCapabilitiesKey: {
179
+ ...defaultCapabilities,
180
+ ...(capabilities ?? {}),
181
+ },
182
+ });
183
+ }
184
+ /**
185
+ * Forward socket setup for inspector connection
186
+ * @param sessionId The session identifier
187
+ * @param appId The application identifier
188
+ * @param pageId The page identifier
189
+ * @param automaticallyPause Whether to automatically pause (defaults to true)
190
+ */
191
+ async forwardSocketSetup(sessionId, appId, pageId, automaticallyPause = true) {
192
+ const message = {
193
+ WIRApplicationIdentifierKey: appId,
194
+ WIRPageIdentifierKey: pageId,
195
+ WIRSenderKey: sessionId,
196
+ WIRMessageDataTypeChunkSupportedKey: 0,
197
+ };
198
+ if (!automaticallyPause) {
199
+ message.WIRAutomaticallyPause = false;
200
+ }
201
+ await this.sendMessage(WebInspectorService.RPC_FORWARD_SOCKET_SETUP, message);
202
+ }
203
+ /**
204
+ * Forward socket data to a page
205
+ * @param sessionId The session identifier
206
+ * @param appId The application identifier
207
+ * @param pageId The page identifier
208
+ * @param data The data to send (will be JSON stringified)
209
+ */
210
+ async forwardSocketData(sessionId, appId, pageId, data) {
211
+ const socketData = typeof data === 'string' ? data : JSON.stringify(data);
212
+ await this.sendMessage(WebInspectorService.RPC_FORWARD_SOCKET_DATA, {
213
+ WIRApplicationIdentifierKey: appId,
214
+ WIRPageIdentifierKey: pageId,
215
+ WIRSessionIdentifierKey: sessionId,
216
+ WIRSenderKey: sessionId,
217
+ WIRSocketDataKey: Buffer.from(socketData, 'utf-8'),
218
+ });
219
+ }
220
+ /**
221
+ * Forward indicate web view
222
+ * @param appId The application identifier
223
+ * @param pageId The page identifier
224
+ * @param enable Whether to enable indication
225
+ */
226
+ async forwardIndicateWebView(appId, pageId, enable) {
227
+ await this.sendMessage(WebInspectorService.RPC_FORWARD_INDICATE_WEB_VIEW, {
228
+ WIRApplicationIdentifierKey: appId,
229
+ WIRPageIdentifierKey: pageId,
230
+ WIRIndicateEnabledKey: enable,
231
+ });
232
+ }
233
+ /**
234
+ * Connect to the WebInspector service
235
+ * @returns Promise resolving to the ServiceConnection instance
236
+ */
237
+ async connectToWebInspectorService() {
238
+ if (this.connection) {
239
+ return this.connection;
240
+ }
241
+ const service = {
242
+ serviceName: WebInspectorService.RSD_SERVICE_NAME,
243
+ port: this.address[1].toString(),
244
+ };
245
+ this.connection = await this.startLockdownService(service);
246
+ // Consume the StartService response from RSDCheckin
247
+ const startServiceResponse = await this.connection.receive();
248
+ if (startServiceResponse?.Request !== 'StartService') {
249
+ log.warn(`Expected StartService response, got: ${JSON.stringify(startServiceResponse)}`);
250
+ }
251
+ // Send initial identifier report
252
+ await this.sendMessage(WebInspectorService.RPC_REPORT_IDENTIFIER, {});
253
+ log.debug('Connected to WebInspector service');
254
+ return this.connection;
255
+ }
256
+ /**
257
+ * Start receiving messages from the WebInspector service in the background
258
+ */
259
+ startMessageReceiver() {
260
+ if (this.isReceiving || !this.connection) {
261
+ return;
262
+ }
263
+ this.isReceiving = true;
264
+ this.receivePromise = (async () => {
265
+ try {
266
+ while (this.isReceiving && this.connection) {
267
+ try {
268
+ const message = await this.connection.receive();
269
+ this.messageEmitter.emit('message', message);
270
+ }
271
+ catch (error) {
272
+ if (this.isReceiving) {
273
+ log.error('Error receiving message:', error);
274
+ this.messageEmitter.emit('error', error);
275
+ }
276
+ break;
277
+ }
278
+ }
279
+ }
280
+ finally {
281
+ this.isReceiving = false;
282
+ }
283
+ })();
284
+ }
285
+ }
286
+ export default WebInspectorService;
@@ -1,11 +1,12 @@
1
1
  import { RemoteXpcConnection } from './lib/remote-xpc/remote-xpc-connection.js';
2
- import type { DiagnosticsServiceWithConnection, MobileConfigServiceWithConnection, MobileImageMounterServiceWithConnection, NotificationProxyServiceWithConnection, SpringboardServiceWithConnection, SyslogService as SyslogServiceType } from './lib/types.js';
2
+ import type { DiagnosticsServiceWithConnection, MobileConfigServiceWithConnection, MobileImageMounterServiceWithConnection, NotificationProxyServiceWithConnection, SpringboardServiceWithConnection, SyslogService as SyslogServiceType, WebInspectorServiceWithConnection } from './lib/types.js';
3
3
  export declare function startDiagnosticsService(udid: string): Promise<DiagnosticsServiceWithConnection>;
4
4
  export declare function startNotificationProxyService(udid: string): Promise<NotificationProxyServiceWithConnection>;
5
5
  export declare function startMobileConfigService(udid: string): Promise<MobileConfigServiceWithConnection>;
6
6
  export declare function startMobileImageMounterService(udid: string): Promise<MobileImageMounterServiceWithConnection>;
7
7
  export declare function startSpringboardService(udid: string): Promise<SpringboardServiceWithConnection>;
8
8
  export declare function startSyslogService(udid: string): Promise<SyslogServiceType>;
9
+ export declare function startWebInspectorService(udid: string): Promise<WebInspectorServiceWithConnection>;
9
10
  export declare function createRemoteXPCConnection(udid: string): Promise<{
10
11
  remoteXPC: RemoteXpcConnection;
11
12
  tunnelConnection: {
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,KAAK,EACV,gCAAgC,EAChC,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,gCAAgC,EAChC,aAAa,IAAI,iBAAiB,EACnC,MAAM,gBAAgB,CAAC;AAWxB,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gCAAgC,CAAC,CAY3C;AAED,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,sCAAsC,CAAC,CAYjD;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iCAAiC,CAAC,CAY5C;AACD,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,uCAAuC,CAAC,CAYlD;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gCAAgC,CAAC,CAY3C;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,CAAC,CAG5B;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM;;;;;;;;GAO3D"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,KAAK,EACV,gCAAgC,EAChC,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,gCAAgC,EAChC,aAAa,IAAI,iBAAiB,EAClC,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AAYxB,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gCAAgC,CAAC,CAY3C;AAED,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,sCAAsC,CAAC,CAYjD;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iCAAiC,CAAC,CAY5C;AACD,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,uCAAuC,CAAC,CAYlD;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,gCAAgC,CAAC,CAY3C;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,CAAC,CAG5B;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iCAAiC,CAAC,CAY5C;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM;;;;;;;;GAO3D"}
@@ -8,6 +8,7 @@ import MobileImageMounterService from './services/ios/mobile-image-mounter/index
8
8
  import { NotificationProxyService } from './services/ios/notification-proxy/index.js';
9
9
  import { SpringBoardService } from './services/ios/springboard-service/index.js';
10
10
  import SyslogService from './services/ios/syslog-service/index.js';
11
+ import { WebInspectorService } from './services/ios/webinspector/index.js';
11
12
  const APPIUM_XCUITEST_DRIVER_NAME = 'appium-xcuitest-driver';
12
13
  const TUNNEL_REGISTRY_PORT = 'tunnelRegistryPort';
13
14
  export async function startDiagnosticsService(udid) {
@@ -69,6 +70,17 @@ export async function startSyslogService(udid) {
69
70
  const { tunnelConnection } = await createRemoteXPCConnection(udid);
70
71
  return new SyslogService([tunnelConnection.host, tunnelConnection.port]);
71
72
  }
73
+ export async function startWebInspectorService(udid) {
74
+ const { remoteXPC, tunnelConnection } = await createRemoteXPCConnection(udid);
75
+ const webInspectorService = remoteXPC.findService(WebInspectorService.RSD_SERVICE_NAME);
76
+ return {
77
+ remoteXPC: remoteXPC,
78
+ webInspectorService: new WebInspectorService([
79
+ tunnelConnection.host,
80
+ parseInt(webInspectorService.port, 10),
81
+ ]),
82
+ };
83
+ }
72
84
  export async function createRemoteXPCConnection(udid) {
73
85
  const tunnelConnection = await getTunnelInformation(udid);
74
86
  const remoteXPC = await startService(tunnelConnection.host, tunnelConnection.port);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-ios-remotexpc",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "main": "build/src/index.js",
5
5
  "types": "build/src/index.d.ts",
6
6
  "type": "module",
@@ -32,6 +32,7 @@
32
32
  "test:image-mounter": "mocha test/integration/mobile-image-mounter-test.ts --exit --timeout 1m",
33
33
  "test:mobile-config": "mocha test/integration/mobile-config-test.ts --exit --timeout 1m",
34
34
  "test:springboard": "mocha test/integration/springboard-service-test.ts --exit --timeout 1m",
35
+ "test:webinspector": "mocha test/integration/webinspector-test.ts --exit --timeout 1m",
35
36
  "test:unit": "mocha 'test/unit/**/*.ts' --exit --timeout 2m",
36
37
  "test:tunnel-creation": "sudo tsx scripts/test-tunnel-creation.ts",
37
38
  "test:tunnel-creation:lsof": "sudo tsx scripts/test-tunnel-creation.ts --keep-open"
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export type {
18
18
  NotificationProxyService,
19
19
  MobileConfigService,
20
20
  SpringboardService,
21
+ WebInspectorService,
21
22
  SyslogService,
22
23
  SocketInfo,
23
24
  TunnelResult,
@@ -28,6 +29,7 @@ export type {
28
29
  NotificationProxyServiceWithConnection,
29
30
  MobileConfigServiceWithConnection,
30
31
  SpringboardServiceWithConnection,
32
+ WebInspectorServiceWithConnection,
31
33
  } from './lib/types.js';
32
34
  export {
33
35
  createUsbmux,
package/src/lib/types.ts CHANGED
@@ -312,6 +312,121 @@ export interface MobileConfigServiceWithConnection {
312
312
  remoteXPC: RemoteXpcConnection;
313
313
  }
314
314
 
315
+ /**
316
+ * Represents the WebInspectorService
317
+ */
318
+ export interface WebInspectorService extends BaseService {
319
+ /**
320
+ * Send a message to the WebInspector service
321
+ * @param selector The RPC selector (e.g., '_rpc_reportIdentifier:')
322
+ * @param args The arguments dictionary for the message
323
+ * @returns Promise that resolves when the message is sent
324
+ */
325
+ sendMessage(selector: string, args?: PlistDictionary): Promise<void>;
326
+
327
+ /**
328
+ * Listen to messages from the WebInspector service using async generator
329
+ * @yields PlistMessage - Messages received from the WebInspector service
330
+ */
331
+ listenMessage(): AsyncGenerator<PlistMessage, void, unknown>;
332
+
333
+ /**
334
+ * Stop listening to messages
335
+ */
336
+ stopListening(): void;
337
+
338
+ /**
339
+ * Close the connection and clean up resources
340
+ */
341
+ close(): Promise<void>;
342
+
343
+ /**
344
+ * Get the connection ID being used for this service
345
+ * @returns The connection identifier
346
+ */
347
+ getConnectionId(): string;
348
+
349
+ /**
350
+ * Request application launch
351
+ * @param bundleId The bundle identifier of the application to launch
352
+ */
353
+ requestApplicationLaunch(bundleId: string): Promise<void>;
354
+
355
+ /**
356
+ * Get connected applications
357
+ */
358
+ getConnectedApplications(): Promise<void>;
359
+
360
+ /**
361
+ * Forward get listing for an application
362
+ * @param appId The application identifier
363
+ */
364
+ forwardGetListing(appId: string): Promise<void>;
365
+
366
+ /**
367
+ * Forward automation session request
368
+ * @param sessionId The session identifier
369
+ * @param appId The application identifier
370
+ * @param capabilities Optional session capabilities
371
+ */
372
+ forwardAutomationSessionRequest(
373
+ sessionId: string,
374
+ appId: string,
375
+ capabilities?: PlistDictionary,
376
+ ): Promise<void>;
377
+
378
+ /**
379
+ * Forward socket setup for inspector connection
380
+ * @param sessionId The session identifier
381
+ * @param appId The application identifier
382
+ * @param pageId The page identifier
383
+ * @param automaticallyPause Whether to automatically pause (defaults to true)
384
+ */
385
+ forwardSocketSetup(
386
+ sessionId: string,
387
+ appId: string,
388
+ pageId: number,
389
+ automaticallyPause?: boolean,
390
+ ): Promise<void>;
391
+
392
+ /**
393
+ * Forward socket data to a page
394
+ * @param sessionId The session identifier
395
+ * @param appId The application identifier
396
+ * @param pageId The page identifier
397
+ * @param data The data to send (will be JSON stringified)
398
+ */
399
+ forwardSocketData(
400
+ sessionId: string,
401
+ appId: string,
402
+ pageId: number,
403
+ data: any,
404
+ ): Promise<void>;
405
+
406
+ /**
407
+ * Forward indicate web view
408
+ * @param appId The application identifier
409
+ * @param pageId The page identifier
410
+ * @param enable Whether to enable indication
411
+ */
412
+ forwardIndicateWebView(
413
+ appId: string,
414
+ pageId: number,
415
+ enable: boolean,
416
+ ): Promise<void>;
417
+ }
418
+
419
+ /**
420
+ * Represents a WebInspectorService instance with its associated RemoteXPC connection
421
+ * This allows callers to properly manage the connection lifecycle
422
+ */
423
+ export interface WebInspectorServiceWithConnection {
424
+ /** The WebInspectorService instance */
425
+ webInspectorService: WebInspectorService;
426
+ /** The RemoteXPC connection that can be used to close the connection */
427
+ remoteXPC: RemoteXpcConnection;
428
+ }
429
+
315
430
  /**
316
431
  * Options for configuring syslog capture
317
432
  */
@@ -60,6 +60,15 @@ export class ServiceConnection extends BasePlistService {
60
60
  return this.sendAndReceive(requestObj, timeout);
61
61
  }
62
62
 
63
+ /**
64
+ * Sends a plist message without waiting for a response
65
+ * This is useful for fire-and-forget style communication
66
+ * @param message The message to send
67
+ */
68
+ sendPlist(message: PlistDictionary): void {
69
+ this.send(message);
70
+ }
71
+
63
72
  /**
64
73
  * Gets the underlying socket
65
74
  * @returns The socket used by this service
@@ -6,12 +6,14 @@ import * as diagnostics from './ios/diagnostic-service/index.js';
6
6
  import * as mobileImageMounter from './ios/mobile-image-mounter/index.js';
7
7
  import * as syslog from './ios/syslog-service/index.js';
8
8
  import * as tunnel from './ios/tunnel-service/index.js';
9
+ import * as webinspector from './ios/webinspector/index.js';
9
10
 
10
11
  export {
11
12
  diagnostics,
12
13
  mobileImageMounter,
13
14
  syslog,
14
15
  tunnel,
16
+ webinspector,
15
17
  TunnelRegistryServer,
16
18
  startTunnelRegistryServer,
17
19
  };
@@ -0,0 +1,372 @@
1
+ import { logger } from '@appium/support';
2
+ import { randomUUID } from 'crypto';
3
+ import { EventEmitter } from 'events';
4
+
5
+ import type { PlistDictionary, PlistMessage } from '../../../lib/types.js';
6
+ import { ServiceConnection } from '../../../service-connection.js';
7
+ import { BaseService } from '../base-service.js';
8
+
9
+ const log = logger.getLogger('WebInspectorService');
10
+
11
+ /**
12
+ * Interface for WebInspector message structure
13
+ */
14
+ export interface WebInspectorMessage extends PlistDictionary {
15
+ __selector: string;
16
+ __argument: PlistDictionary;
17
+ }
18
+
19
+ /**
20
+ * WebInspectorService provides an API to:
21
+ * - Send messages to webinspectord
22
+ * - Listen to messages from webinspectord
23
+ * - Communicate with web views and Safari on iOS devices
24
+ *
25
+ * This service is used for web automation, inspection, and debugging.
26
+ */
27
+ export class WebInspectorService extends BaseService {
28
+ static readonly RSD_SERVICE_NAME = 'com.apple.webinspector.shim.remote';
29
+
30
+ // RPC method selectors
31
+ private static readonly RPC_REPORT_IDENTIFIER = '_rpc_reportIdentifier:';
32
+ private static readonly RPC_REQUEST_APPLICATION_LAUNCH =
33
+ '_rpc_requestApplicationLaunch:';
34
+ private static readonly RPC_GET_CONNECTED_APPLICATIONS =
35
+ '_rpc_getConnectedApplications:';
36
+ private static readonly RPC_FORWARD_GET_LISTING = '_rpc_forwardGetListing:';
37
+ private static readonly RPC_FORWARD_AUTOMATION_SESSION_REQUEST =
38
+ '_rpc_forwardAutomationSessionRequest:';
39
+ private static readonly RPC_FORWARD_SOCKET_SETUP = '_rpc_forwardSocketSetup:';
40
+ private static readonly RPC_FORWARD_SOCKET_DATA = '_rpc_forwardSocketData:';
41
+ private static readonly RPC_FORWARD_INDICATE_WEB_VIEW =
42
+ '_rpc_forwardIndicateWebView:';
43
+
44
+ private connection: ServiceConnection | null = null;
45
+ private messageEmitter: EventEmitter = new EventEmitter();
46
+ private isReceiving: boolean = false;
47
+ private readonly connectionId: string;
48
+ private receivePromise: Promise<void> | null = null;
49
+
50
+ constructor(address: [string, number]) {
51
+ super(address);
52
+ this.connectionId = randomUUID().toUpperCase();
53
+ }
54
+
55
+ /**
56
+ * Send a message to the WebInspector service
57
+ * @param selector The RPC selector (e.g., '_rpc_reportIdentifier:')
58
+ * @param args The arguments dictionary for the message
59
+ * @returns Promise that resolves when the message is sent
60
+ */
61
+ async sendMessage(
62
+ selector: string,
63
+ args: PlistDictionary = {},
64
+ ): Promise<void> {
65
+ const connection = await this.connectToWebInspectorService();
66
+
67
+ // Add connection identifier to all messages
68
+ const message: WebInspectorMessage = {
69
+ __selector: selector,
70
+ __argument: {
71
+ ...args,
72
+ WIRConnectionIdentifierKey: this.connectionId,
73
+ },
74
+ };
75
+
76
+ log.debug(`Sending WebInspector message: ${selector}`);
77
+
78
+ connection.sendPlist(message);
79
+ }
80
+
81
+ /**
82
+ * Listen to messages from the WebInspector service using async generator
83
+ * @yields PlistMessage - Messages received from the WebInspector service
84
+ */
85
+ async *listenMessage(): AsyncGenerator<PlistMessage, void, unknown> {
86
+ await this.connectToWebInspectorService();
87
+
88
+ // Start receiving messages in background if not already started
89
+ if (!this.isReceiving) {
90
+ this.startMessageReceiver();
91
+ }
92
+
93
+ const queue: PlistMessage[] = [];
94
+ let resolveNext: ((value: IteratorResult<PlistMessage>) => void) | null =
95
+ null;
96
+ let stopped = false;
97
+
98
+ const messageHandler = (message: PlistMessage) => {
99
+ if (resolveNext) {
100
+ resolveNext({ value: message, done: false });
101
+ resolveNext = null;
102
+ } else {
103
+ queue.push(message);
104
+ }
105
+ };
106
+
107
+ const stopHandler = () => {
108
+ stopped = true;
109
+ if (resolveNext) {
110
+ resolveNext({ value: undefined, done: true });
111
+ resolveNext = null;
112
+ }
113
+ };
114
+
115
+ this.messageEmitter.on('message', messageHandler);
116
+ this.messageEmitter.once('stop', stopHandler);
117
+
118
+ try {
119
+ while (!stopped) {
120
+ if (queue.length > 0) {
121
+ yield queue.shift()!;
122
+ } else {
123
+ const message = await new Promise<PlistMessage | null>((resolve) => {
124
+ if (stopped) {
125
+ resolve(null);
126
+ return;
127
+ }
128
+ resolveNext = (result) => {
129
+ resolve(result.done ? null : result.value);
130
+ };
131
+ });
132
+
133
+ if (message === null) {
134
+ break;
135
+ }
136
+
137
+ yield message;
138
+ }
139
+ }
140
+ } finally {
141
+ this.messageEmitter.off('message', messageHandler);
142
+ this.messageEmitter.off('stop', stopHandler);
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Stop listening to messages
148
+ */
149
+ stopListening(): void {
150
+ this.isReceiving = false;
151
+ this.messageEmitter.emit('stop');
152
+ }
153
+
154
+ /**
155
+ * Close the connection and clean up resources
156
+ */
157
+ async close(): Promise<void> {
158
+ this.stopListening();
159
+
160
+ if (this.connection) {
161
+ await this.connection.close();
162
+ this.connection = null;
163
+ log.debug('WebInspector connection closed');
164
+ }
165
+
166
+ if (this.receivePromise) {
167
+ await this.receivePromise;
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Get the connection ID being used for this service
173
+ * @returns The connection identifier
174
+ */
175
+ getConnectionId(): string {
176
+ return this.connectionId;
177
+ }
178
+
179
+ /**
180
+ * Request application launch
181
+ * @param bundleId The bundle identifier of the application to launch
182
+ */
183
+ async requestApplicationLaunch(bundleId: string): Promise<void> {
184
+ await this.sendMessage(WebInspectorService.RPC_REQUEST_APPLICATION_LAUNCH, {
185
+ WIRApplicationBundleIdentifierKey: bundleId,
186
+ });
187
+ }
188
+
189
+ /**
190
+ * Get connected applications
191
+ */
192
+ async getConnectedApplications(): Promise<void> {
193
+ await this.sendMessage(
194
+ WebInspectorService.RPC_GET_CONNECTED_APPLICATIONS,
195
+ {},
196
+ );
197
+ }
198
+
199
+ /**
200
+ * Forward get listing for an application
201
+ * @param appId The application identifier
202
+ */
203
+ async forwardGetListing(appId: string): Promise<void> {
204
+ await this.sendMessage(WebInspectorService.RPC_FORWARD_GET_LISTING, {
205
+ WIRApplicationIdentifierKey: appId,
206
+ });
207
+ }
208
+
209
+ /**
210
+ * Forward automation session request
211
+ * @param sessionId The session identifier
212
+ * @param appId The application identifier
213
+ * @param capabilities Optional session capabilities
214
+ */
215
+ async forwardAutomationSessionRequest(
216
+ sessionId: string,
217
+ appId: string,
218
+ capabilities?: PlistDictionary,
219
+ ): Promise<void> {
220
+ const defaultCapabilities: PlistDictionary = {
221
+ 'org.webkit.webdriver.webrtc.allow-insecure-media-capture': true,
222
+ 'org.webkit.webdriver.webrtc.suppress-ice-candidate-filtering': false,
223
+ };
224
+
225
+ await this.sendMessage(
226
+ WebInspectorService.RPC_FORWARD_AUTOMATION_SESSION_REQUEST,
227
+ {
228
+ WIRApplicationIdentifierKey: appId,
229
+ WIRSessionIdentifierKey: sessionId,
230
+ WIRSessionCapabilitiesKey: {
231
+ ...defaultCapabilities,
232
+ ...(capabilities ?? {}),
233
+ },
234
+ },
235
+ );
236
+ }
237
+
238
+ /**
239
+ * Forward socket setup for inspector connection
240
+ * @param sessionId The session identifier
241
+ * @param appId The application identifier
242
+ * @param pageId The page identifier
243
+ * @param automaticallyPause Whether to automatically pause (defaults to true)
244
+ */
245
+ async forwardSocketSetup(
246
+ sessionId: string,
247
+ appId: string,
248
+ pageId: number,
249
+ automaticallyPause: boolean = true,
250
+ ): Promise<void> {
251
+ const message: PlistDictionary = {
252
+ WIRApplicationIdentifierKey: appId,
253
+ WIRPageIdentifierKey: pageId,
254
+ WIRSenderKey: sessionId,
255
+ WIRMessageDataTypeChunkSupportedKey: 0,
256
+ };
257
+
258
+ if (!automaticallyPause) {
259
+ message.WIRAutomaticallyPause = false;
260
+ }
261
+
262
+ await this.sendMessage(
263
+ WebInspectorService.RPC_FORWARD_SOCKET_SETUP,
264
+ message,
265
+ );
266
+ }
267
+
268
+ /**
269
+ * Forward socket data to a page
270
+ * @param sessionId The session identifier
271
+ * @param appId The application identifier
272
+ * @param pageId The page identifier
273
+ * @param data The data to send (will be JSON stringified)
274
+ */
275
+ async forwardSocketData(
276
+ sessionId: string,
277
+ appId: string,
278
+ pageId: number,
279
+ data: any,
280
+ ): Promise<void> {
281
+ const socketData = typeof data === 'string' ? data : JSON.stringify(data);
282
+
283
+ await this.sendMessage(WebInspectorService.RPC_FORWARD_SOCKET_DATA, {
284
+ WIRApplicationIdentifierKey: appId,
285
+ WIRPageIdentifierKey: pageId,
286
+ WIRSessionIdentifierKey: sessionId,
287
+ WIRSenderKey: sessionId,
288
+ WIRSocketDataKey: Buffer.from(socketData, 'utf-8'),
289
+ });
290
+ }
291
+
292
+ /**
293
+ * Forward indicate web view
294
+ * @param appId The application identifier
295
+ * @param pageId The page identifier
296
+ * @param enable Whether to enable indication
297
+ */
298
+ async forwardIndicateWebView(
299
+ appId: string,
300
+ pageId: number,
301
+ enable: boolean,
302
+ ): Promise<void> {
303
+ await this.sendMessage(WebInspectorService.RPC_FORWARD_INDICATE_WEB_VIEW, {
304
+ WIRApplicationIdentifierKey: appId,
305
+ WIRPageIdentifierKey: pageId,
306
+ WIRIndicateEnabledKey: enable,
307
+ });
308
+ }
309
+
310
+ /**
311
+ * Connect to the WebInspector service
312
+ * @returns Promise resolving to the ServiceConnection instance
313
+ */
314
+ private async connectToWebInspectorService(): Promise<ServiceConnection> {
315
+ if (this.connection) {
316
+ return this.connection;
317
+ }
318
+
319
+ const service = {
320
+ serviceName: WebInspectorService.RSD_SERVICE_NAME,
321
+ port: this.address[1].toString(),
322
+ };
323
+
324
+ this.connection = await this.startLockdownService(service);
325
+
326
+ // Consume the StartService response from RSDCheckin
327
+ const startServiceResponse = await this.connection.receive();
328
+ if (startServiceResponse?.Request !== 'StartService') {
329
+ log.warn(
330
+ `Expected StartService response, got: ${JSON.stringify(startServiceResponse)}`,
331
+ );
332
+ }
333
+
334
+ // Send initial identifier report
335
+ await this.sendMessage(WebInspectorService.RPC_REPORT_IDENTIFIER, {});
336
+
337
+ log.debug('Connected to WebInspector service');
338
+ return this.connection;
339
+ }
340
+
341
+ /**
342
+ * Start receiving messages from the WebInspector service in the background
343
+ */
344
+ private startMessageReceiver(): void {
345
+ if (this.isReceiving || !this.connection) {
346
+ return;
347
+ }
348
+
349
+ this.isReceiving = true;
350
+
351
+ this.receivePromise = (async () => {
352
+ try {
353
+ while (this.isReceiving && this.connection) {
354
+ try {
355
+ const message = await this.connection.receive();
356
+ this.messageEmitter.emit('message', message);
357
+ } catch (error) {
358
+ if (this.isReceiving) {
359
+ log.error('Error receiving message:', error);
360
+ this.messageEmitter.emit('error', error);
361
+ }
362
+ break;
363
+ }
364
+ }
365
+ } finally {
366
+ this.isReceiving = false;
367
+ }
368
+ })();
369
+ }
370
+ }
371
+
372
+ export default WebInspectorService;
package/src/services.ts CHANGED
@@ -10,6 +10,7 @@ import type {
10
10
  NotificationProxyServiceWithConnection,
11
11
  SpringboardServiceWithConnection,
12
12
  SyslogService as SyslogServiceType,
13
+ WebInspectorServiceWithConnection,
13
14
  } from './lib/types.js';
14
15
  import DiagnosticsService from './services/ios/diagnostic-service/index.js';
15
16
  import { MobileConfigService } from './services/ios/mobile-config/index.js';
@@ -17,6 +18,7 @@ import MobileImageMounterService from './services/ios/mobile-image-mounter/index
17
18
  import { NotificationProxyService } from './services/ios/notification-proxy/index.js';
18
19
  import { SpringBoardService } from './services/ios/springboard-service/index.js';
19
20
  import SyslogService from './services/ios/syslog-service/index.js';
21
+ import { WebInspectorService } from './services/ios/webinspector/index.js';
20
22
 
21
23
  const APPIUM_XCUITEST_DRIVER_NAME = 'appium-xcuitest-driver';
22
24
  const TUNNEL_REGISTRY_PORT = 'tunnelRegistryPort';
@@ -107,6 +109,22 @@ export async function startSyslogService(
107
109
  return new SyslogService([tunnelConnection.host, tunnelConnection.port]);
108
110
  }
109
111
 
112
+ export async function startWebInspectorService(
113
+ udid: string,
114
+ ): Promise<WebInspectorServiceWithConnection> {
115
+ const { remoteXPC, tunnelConnection } = await createRemoteXPCConnection(udid);
116
+ const webInspectorService = remoteXPC.findService(
117
+ WebInspectorService.RSD_SERVICE_NAME,
118
+ );
119
+ return {
120
+ remoteXPC: remoteXPC as RemoteXpcConnection,
121
+ webInspectorService: new WebInspectorService([
122
+ tunnelConnection.host,
123
+ parseInt(webInspectorService.port, 10),
124
+ ]),
125
+ };
126
+ }
127
+
110
128
  export async function createRemoteXPCConnection(udid: string) {
111
129
  const tunnelConnection = await getTunnelInformation(udid);
112
130
  const remoteXPC = await startService(