appium-ios-remotexpc 0.17.0 → 0.18.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/src/index.d.ts +1 -1
  3. package/build/src/index.d.ts.map +1 -1
  4. package/build/src/lib/apple-tv/encryption/ed25519.d.ts.map +1 -1
  5. package/build/src/lib/apple-tv/encryption/ed25519.js +1 -1
  6. package/build/src/lib/tunnel/packet-stream-client.js +1 -1
  7. package/build/src/lib/types.d.ts +205 -0
  8. package/build/src/lib/types.d.ts.map +1 -1
  9. package/build/src/services/ios/dvt/instruments/application-listing.d.ts +2 -9
  10. package/build/src/services/ios/dvt/instruments/application-listing.d.ts.map +1 -1
  11. package/build/src/services/ios/dvt/instruments/application-listing.js +2 -15
  12. package/build/src/services/ios/dvt/instruments/base-instrument.d.ts +19 -0
  13. package/build/src/services/ios/dvt/instruments/base-instrument.d.ts.map +1 -0
  14. package/build/src/services/ios/dvt/instruments/base-instrument.js +24 -0
  15. package/build/src/services/ios/dvt/instruments/condition-inducer.d.ts +2 -9
  16. package/build/src/services/ios/dvt/instruments/condition-inducer.d.ts.map +1 -1
  17. package/build/src/services/ios/dvt/instruments/condition-inducer.js +2 -15
  18. package/build/src/services/ios/dvt/instruments/device-info.d.ts +98 -0
  19. package/build/src/services/ios/dvt/instruments/device-info.d.ts.map +1 -0
  20. package/build/src/services/ios/dvt/instruments/device-info.js +167 -0
  21. package/build/src/services/ios/dvt/instruments/graphics.d.ts +2 -6
  22. package/build/src/services/ios/dvt/instruments/graphics.d.ts.map +1 -1
  23. package/build/src/services/ios/dvt/instruments/graphics.js +2 -11
  24. package/build/src/services/ios/dvt/instruments/location-simulation.d.ts +2 -9
  25. package/build/src/services/ios/dvt/instruments/location-simulation.d.ts.map +1 -1
  26. package/build/src/services/ios/dvt/instruments/location-simulation.js +2 -15
  27. package/build/src/services/ios/dvt/instruments/screenshot.d.ts +2 -6
  28. package/build/src/services/ios/dvt/instruments/screenshot.d.ts.map +1 -1
  29. package/build/src/services/ios/dvt/instruments/screenshot.js +2 -11
  30. package/build/src/services.d.ts.map +1 -1
  31. package/build/src/services.js +3 -0
  32. package/package.json +3 -2
  33. package/src/index.ts +2 -0
  34. package/src/lib/apple-tv/encryption/ed25519.ts +2 -6
  35. package/src/lib/tunnel/packet-stream-client.ts +1 -1
  36. package/src/lib/types.ts +224 -0
  37. package/src/services/ios/dvt/instruments/application-listing.ts +2 -17
  38. package/src/services/ios/dvt/instruments/base-instrument.ts +27 -0
  39. package/src/services/ios/dvt/instruments/condition-inducer.ts +2 -17
  40. package/src/services/ios/dvt/instruments/device-info.ts +204 -0
  41. package/src/services/ios/dvt/instruments/graphics.ts +2 -13
  42. package/src/services/ios/dvt/instruments/location-simulation.ts +2 -18
  43. package/src/services/ios/dvt/instruments/screenshot.ts +2 -13
  44. package/src/services.ts +3 -0
@@ -0,0 +1,167 @@
1
+ import { getLogger } from '../../../../lib/logger.js';
2
+ import { parseBinaryPlist } from '../../../../lib/plist/index.js';
3
+ import { MessageAux } from '../dtx-message.js';
4
+ import { BaseInstrument } from './base-instrument.js';
5
+ const log = getLogger('DeviceInfo');
6
+ /**
7
+ * DeviceInfo service provides access to device information, file system,
8
+ * and process management through the DTX protocol.
9
+ *
10
+ * Available methods:
11
+ * - ls(path): List directory contents
12
+ * - execnameForPid(pid): Get executable path for a process ID
13
+ * - proclist(): Get list of running processes
14
+ * - isRunningPid(pid): Check if a process is running
15
+ * - hardwareInformation(): Get hardware details
16
+ * - networkInformation(): Get network configuration
17
+ * - machTimeInfo(): Get mach time information
18
+ * - machKernelName(): Get kernel name
19
+ * - kpepDatabase(): Get kernel performance event database
20
+ * - traceCodes(): Get trace code mappings
21
+ * - nameForUid(uid): Get username for UID
22
+ * - nameForGid(gid): Get group name for GID
23
+ */
24
+ export class DeviceInfo extends BaseInstrument {
25
+ static IDENTIFIER = 'com.apple.instruments.server.services.deviceinfo';
26
+ /**
27
+ * List directory contents at the specified path.
28
+ * @param path - The directory path to list
29
+ * @returns Array of filenames
30
+ * @throws {Error} If the directory doesn't exist or cannot be accessed
31
+ */
32
+ async ls(path) {
33
+ const result = await this.requestInformation('directoryListingForPath_', path);
34
+ if (result === null || result === undefined) {
35
+ throw new Error(`Failed to list directory: ${path}`);
36
+ }
37
+ log.debug(`Listed directory ${path}: ${result.length} entries`);
38
+ return result;
39
+ }
40
+ /**
41
+ * Get the full executable path for a given process ID.
42
+ * @param pid - The process identifier
43
+ * @returns The full path to the executable
44
+ */
45
+ async execnameForPid(pid) {
46
+ return this.requestInformation('execnameForPid_', pid);
47
+ }
48
+ /**
49
+ * Get the list of all running processes on the device.
50
+ * @returns Array of process information objects
51
+ */
52
+ async proclist() {
53
+ const result = await this.requestInformation('runningProcesses');
54
+ if (!Array.isArray(result)) {
55
+ throw new Error(`proclist returned invalid data: expected an array, got ${typeof result} (${JSON.stringify(result)})`);
56
+ }
57
+ log.debug(`Retrieved ${result.length} running processes`);
58
+ return result;
59
+ }
60
+ /**
61
+ * Check if a process with the given PID is currently running.
62
+ * @param pid - The process identifier to check
63
+ * @returns true if the process is running, false otherwise
64
+ */
65
+ async isRunningPid(pid) {
66
+ return this.requestInformation('isRunningPid_', pid);
67
+ }
68
+ /**
69
+ * Get hardware information about the device.
70
+ * @returns Object containing hardware information
71
+ */
72
+ async hardwareInformation() {
73
+ return this.requestInformation('hardwareInformation');
74
+ }
75
+ /**
76
+ * Get network configuration information.
77
+ * @returns Object containing network information
78
+ */
79
+ async networkInformation() {
80
+ return this.requestInformation('networkInformation');
81
+ }
82
+ /**
83
+ * Get mach kernel time information.
84
+ * @returns Object containing mach time info
85
+ */
86
+ async machTimeInfo() {
87
+ return this.requestInformation('machTimeInfo');
88
+ }
89
+ /**
90
+ * Get the mach kernel name.
91
+ * @returns The kernel name string
92
+ */
93
+ async machKernelName() {
94
+ return this.requestInformation('machKernelName');
95
+ }
96
+ /**
97
+ * Get the kernel performance event (kpep) database.
98
+ * @returns Object containing kpep database or null if not available
99
+ */
100
+ async kpepDatabase() {
101
+ const kpepData = await this.requestInformation('kpepDatabase');
102
+ if (kpepData === null || kpepData === undefined) {
103
+ return null;
104
+ }
105
+ // The kpepDatabase is returned as binary plist data
106
+ if (Buffer.isBuffer(kpepData)) {
107
+ try {
108
+ return parseBinaryPlist(kpepData);
109
+ }
110
+ catch (error) {
111
+ log.warn('Failed to parse kpep database:', error);
112
+ return null;
113
+ }
114
+ }
115
+ return kpepData;
116
+ }
117
+ /**
118
+ * Get trace code mappings.
119
+ * @returns Object mapping trace codes (as hex strings) to descriptions
120
+ */
121
+ async traceCodes() {
122
+ const codesFile = await this.requestInformation('traceCodesFile');
123
+ if (typeof codesFile !== 'string') {
124
+ return {};
125
+ }
126
+ const codes = {};
127
+ for (const line of codesFile.split('\n')) {
128
+ const match = line.trim().match(/^(\S+)\s+(.+)$/);
129
+ if (match) {
130
+ const [, hex, description] = match;
131
+ codes[hex] = description;
132
+ }
133
+ }
134
+ log.debug(`Retrieved ${Object.keys(codes).length} trace codes`);
135
+ return codes;
136
+ }
137
+ /**
138
+ * Get the username for a given user ID (UID).
139
+ * @param uid - The user identifier
140
+ * @returns The username string
141
+ */
142
+ async nameForUid(uid) {
143
+ return this.requestInformation('nameForUID_', uid);
144
+ }
145
+ /**
146
+ * Get the group name for a given group ID (GID).
147
+ * @param gid - The group identifier
148
+ * @returns The group name string
149
+ */
150
+ async nameForGid(gid) {
151
+ return this.requestInformation('nameForGID_', gid);
152
+ }
153
+ /**
154
+ * Generic method to request information from the device.
155
+ * @param selectorName - The selector name to call
156
+ * @param arg - Optional argument to pass to the selector
157
+ * @returns The information object or value returned by the selector
158
+ * @private
159
+ */
160
+ async requestInformation(selectorName, arg) {
161
+ await this.initialize();
162
+ const call = this.channel.call(selectorName);
163
+ const args = arg !== undefined ? new MessageAux().appendObj(arg) : undefined;
164
+ await call(args);
165
+ return this.channel.receivePlist();
166
+ }
167
+ }
@@ -1,10 +1,6 @@
1
- import type { DVTSecureSocketProxyService } from '../index.js';
2
- export declare class Graphics {
3
- private readonly dvt;
1
+ import { BaseInstrument } from './base-instrument.js';
2
+ export declare class Graphics extends BaseInstrument {
4
3
  static readonly IDENTIFIER = "com.apple.instruments.server.services.graphics.opengl";
5
- private channel;
6
- constructor(dvt: DVTSecureSocketProxyService);
7
- initialize(): Promise<void>;
8
4
  start(): Promise<void>;
9
5
  stop(): Promise<void>;
10
6
  messages(): AsyncGenerator<unknown, void, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"graphics.d.ts","sourceRoot":"","sources":["../../../../../../src/services/ios/dvt/instruments/graphics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAI/D,qBAAa,QAAQ;IAMP,OAAO,CAAC,QAAQ,CAAC,GAAG;IALhC,MAAM,CAAC,QAAQ,CAAC,UAAU,2DACgC;IAE1D,OAAO,CAAC,OAAO,CAAwB;gBAEV,GAAG,EAAE,2BAA2B;IAEvD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpB,QAAQ,IAAI,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;CAa1D"}
1
+ {"version":3,"file":"graphics.d.ts","sourceRoot":"","sources":["../../../../../../src/services/ios/dvt/instruments/graphics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,qBAAa,QAAS,SAAQ,cAAc;IAC1C,MAAM,CAAC,QAAQ,CAAC,UAAU,2DACgC;IAEpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpB,QAAQ,IAAI,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;CAa1D"}
@@ -1,18 +1,9 @@
1
1
  import { getLogger } from '../../../../lib/logger.js';
2
2
  import { MessageAux } from '../dtx-message.js';
3
+ import { BaseInstrument } from './base-instrument.js';
3
4
  const log = getLogger('Graphics');
4
- export class Graphics {
5
- dvt;
5
+ export class Graphics extends BaseInstrument {
6
6
  static IDENTIFIER = 'com.apple.instruments.server.services.graphics.opengl';
7
- channel = null;
8
- constructor(dvt) {
9
- this.dvt = dvt;
10
- }
11
- async initialize() {
12
- if (!this.channel) {
13
- this.channel = await this.dvt.makeChannel(Graphics.IDENTIFIER);
14
- }
15
- }
16
7
  async start() {
17
8
  await this.initialize();
18
9
  const args = new MessageAux().appendObj(0.0);
@@ -1,4 +1,4 @@
1
- import type { DVTSecureSocketProxyService } from '../index.js';
1
+ import { BaseInstrument } from './base-instrument.js';
2
2
  /**
3
3
  * Geographic coordinates
4
4
  */
@@ -9,15 +9,8 @@ export interface LocationCoordinates {
9
9
  /**
10
10
  * Location simulation service for simulating device GPS location
11
11
  */
12
- export declare class LocationSimulation {
13
- private readonly dvt;
12
+ export declare class LocationSimulation extends BaseInstrument {
14
13
  static readonly IDENTIFIER = "com.apple.instruments.server.services.LocationSimulation";
15
- private channel;
16
- constructor(dvt: DVTSecureSocketProxyService);
17
- /**
18
- * Initialize the location simulation channel
19
- */
20
- initialize(): Promise<void>;
21
14
  /**
22
15
  * Set the simulated GPS location
23
16
  * @param coordinates The location coordinates
@@ -1 +1 @@
1
- {"version":3,"file":"location-simulation.d.ts","sourceRoot":"","sources":["../../../../../../src/services/ios/dvt/instruments/location-simulation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAI/D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAMjB,OAAO,CAAC,QAAQ,CAAC,GAAG;IALhC,MAAM,CAAC,QAAQ,CAAC,UAAU,8DACmC;IAE7D,OAAO,CAAC,OAAO,CAAwB;gBAEV,GAAG,EAAE,2BAA2B;IAE7D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAQjC;;;OAGG;IACG,GAAG,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAe1D;;;;OAIG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
1
+ {"version":3,"file":"location-simulation.d.ts","sourceRoot":"","sources":["../../../../../../src/services/ios/dvt/instruments/location-simulation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,MAAM,CAAC,QAAQ,CAAC,UAAU,8DACmC;IAE7D;;;OAGG;IACG,GAAG,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAe1D;;;;OAIG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
@@ -1,25 +1,12 @@
1
1
  import { getLogger } from '../../../../lib/logger.js';
2
2
  import { MessageAux } from '../dtx-message.js';
3
+ import { BaseInstrument } from './base-instrument.js';
3
4
  const log = getLogger('LocationSimulation');
4
5
  /**
5
6
  * Location simulation service for simulating device GPS location
6
7
  */
7
- export class LocationSimulation {
8
- dvt;
8
+ export class LocationSimulation extends BaseInstrument {
9
9
  static IDENTIFIER = 'com.apple.instruments.server.services.LocationSimulation';
10
- channel = null;
11
- constructor(dvt) {
12
- this.dvt = dvt;
13
- }
14
- /**
15
- * Initialize the location simulation channel
16
- */
17
- async initialize() {
18
- if (this.channel) {
19
- return;
20
- }
21
- this.channel = await this.dvt.makeChannel(LocationSimulation.IDENTIFIER);
22
- }
23
10
  /**
24
11
  * Set the simulated GPS location
25
12
  * @param coordinates The location coordinates
@@ -1,13 +1,9 @@
1
- import type { DVTSecureSocketProxyService } from '../index.js';
1
+ import { BaseInstrument } from './base-instrument.js';
2
2
  /**
3
3
  * Screenshot service for capturing device screenshots
4
4
  */
5
- export declare class Screenshot {
6
- private readonly dvt;
5
+ export declare class Screenshot extends BaseInstrument {
7
6
  static readonly IDENTIFIER = "com.apple.instruments.server.services.screenshot";
8
- private channel;
9
- constructor(dvt: DVTSecureSocketProxyService);
10
- initialize(): Promise<void>;
11
7
  /**
12
8
  * Capture a screenshot from the device
13
9
  * @returns The screenshot data as a Buffer
@@ -1 +1 @@
1
- {"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../../../../../src/services/ios/dvt/instruments/screenshot.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAI/D;;GAEG;AACH,qBAAa,UAAU;IAMT,OAAO,CAAC,QAAQ,CAAC,GAAG;IALhC,MAAM,CAAC,QAAQ,CAAC,UAAU,sDAC2B;IAErD,OAAO,CAAC,OAAO,CAAwB;gBAEV,GAAG,EAAE,2BAA2B;IAEvD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAMjC;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAmBvC"}
1
+ {"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../../../../../src/services/ios/dvt/instruments/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD;;GAEG;AACH,qBAAa,UAAW,SAAQ,cAAc;IAC5C,MAAM,CAAC,QAAQ,CAAC,UAAU,sDAC2B;IAErD;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAmBvC"}
@@ -1,20 +1,11 @@
1
1
  import { getLogger } from '../../../../lib/logger.js';
2
+ import { BaseInstrument } from './base-instrument.js';
2
3
  const log = getLogger('Screenshot');
3
4
  /**
4
5
  * Screenshot service for capturing device screenshots
5
6
  */
6
- export class Screenshot {
7
- dvt;
7
+ export class Screenshot extends BaseInstrument {
8
8
  static IDENTIFIER = 'com.apple.instruments.server.services.screenshot';
9
- channel = null;
10
- constructor(dvt) {
11
- this.dvt = dvt;
12
- }
13
- async initialize() {
14
- if (!this.channel) {
15
- this.channel = await this.dvt.makeChannel(Screenshot.IDENTIFIER);
16
- }
17
- }
18
9
  /**
19
10
  * Capture a screenshot from the device
20
11
  * @returns The screenshot data as a Buffer
@@ -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,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,mCAAmC,EACnC,gCAAgC,EAChC,aAAa,IAAI,iBAAiB,EAClC,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAoBrD,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;AAED,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,oBAAoB,CACxC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,6BAA6B,CAAC,CAYxC;AAED,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,mCAAmC,CAAC,CAY9C;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,CAAC,CAG5B;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvE;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iCAAiC,CAAC,CAY5C;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,wBAAwB,CAAC,CA+BnC;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,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,mCAAmC,EACnC,gCAAgC,EAChC,aAAa,IAAI,iBAAiB,EAClC,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAqBrD,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;AAED,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,oBAAoB,CACxC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,6BAA6B,CAAC,CAYxC;AAED,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,mCAAmC,CAAC,CAY9C;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,CAAC,CAG5B;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvE;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iCAAiC,CAAC,CAY5C;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,wBAAwB,CAAC,CAiCnC;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM;;;;;;;;GAO3D"}
@@ -7,6 +7,7 @@ import DiagnosticsService from './services/ios/diagnostic-service/index.js';
7
7
  import { DVTSecureSocketProxyService } from './services/ios/dvt/index.js';
8
8
  import { ApplicationListing } from './services/ios/dvt/instruments/application-listing.js';
9
9
  import { ConditionInducer } from './services/ios/dvt/instruments/condition-inducer.js';
10
+ import { DeviceInfo } from './services/ios/dvt/instruments/device-info.js';
10
11
  import { Graphics } from './services/ios/dvt/instruments/graphics.js';
11
12
  import { LocationSimulation } from './services/ios/dvt/instruments/location-simulation.js';
12
13
  import { Screenshot } from './services/ios/dvt/instruments/screenshot.js';
@@ -140,6 +141,7 @@ export async function startDVTService(udid) {
140
141
  const screenshot = new Screenshot(dvtService);
141
142
  const appListing = new ApplicationListing(dvtService);
142
143
  const graphics = new Graphics(dvtService);
144
+ const deviceInfo = new DeviceInfo(dvtService);
143
145
  return {
144
146
  remoteXPC: remoteXPC,
145
147
  dvtService,
@@ -148,6 +150,7 @@ export async function startDVTService(udid) {
148
150
  screenshot,
149
151
  appListing,
150
152
  graphics,
153
+ deviceInfo,
151
154
  };
152
155
  }
153
156
  export async function createRemoteXPCConnection(udid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-ios-remotexpc",
3
- "version": "0.17.0",
3
+ "version": "0.18.1",
4
4
  "main": "build/src/index.js",
5
5
  "types": "build/src/index.d.ts",
6
6
  "type": "module",
@@ -44,6 +44,7 @@
44
44
  "test:dvt:location-simulation": "mocha test/integration/dvt_instruments/location-simulation-test.ts --exit --timeout 1m",
45
45
  "test:dvt:condition-inducer": "mocha test/integration/dvt_instruments/condition-inducer-test.ts --exit --timeout 1m",
46
46
  "test:dvt:screenshot": "mocha test/integration/dvt_instruments/screenshot-test.ts --exit --timeout 1m",
47
+ "test:dvt:device-info": "mocha test/integration/dvt_instruments/device-info-test.ts --exit --timeout 1m",
47
48
  "test:dvt:applist": "mocha test/integration/dvt_instruments/app-listing-test.ts --exit --timeout 1m",
48
49
  "test:tunnel-creation": "sudo tsx scripts/test-tunnel-creation.ts",
49
50
  "test:tunnel-creation:lsof": "sudo tsx scripts/test-tunnel-creation.ts --keep-open"
@@ -83,7 +84,7 @@
83
84
  "dependencies": {
84
85
  "@appium/strongbox": "^1.0.0-rc.1",
85
86
  "@appium/support": "^7.0.0-rc.1",
86
- "@types/node": "^24.0.10",
87
+ "@types/node": "^25.0.2",
87
88
  "@xmldom/xmldom": "^0.9.8",
88
89
  "appium-ios-tuntap": "^0.x",
89
90
  "axios": "^1.12.0",
package/src/index.ts CHANGED
@@ -29,6 +29,8 @@ export type {
29
29
  ConditionInducerService,
30
30
  ScreenshotService,
31
31
  GraphicsService,
32
+ DeviceInfoService,
33
+ ProcessInfo,
32
34
  ConditionProfile,
33
35
  ConditionGroup,
34
36
  SocketInfo,
@@ -1,8 +1,4 @@
1
- import {
2
- type KeyPairKeyObjectResult,
3
- generateKeyPairSync,
4
- sign,
5
- } from 'node:crypto';
1
+ import { generateKeyPairSync, sign } from 'node:crypto';
6
2
 
7
3
  import { getLogger } from '../../logger.js';
8
4
  import { CryptographyError } from '../errors.js';
@@ -24,7 +20,7 @@ const ED25519_PKCS8_PREFIX = Buffer.from(
24
20
  */
25
21
  export function generateEd25519KeyPair(): PairingKeys {
26
22
  try {
27
- const keyPair: KeyPairKeyObjectResult = generateKeyPairSync('ed25519');
23
+ const keyPair = generateKeyPairSync('ed25519');
28
24
 
29
25
  const publicKeyDer = keyPair.publicKey.export({
30
26
  type: 'spki',
@@ -47,7 +47,7 @@ export class PacketStreamClient extends EventEmitter {
47
47
  );
48
48
 
49
49
  this.socket.on('data', (data) => {
50
- this.handleData(data);
50
+ this.handleData(Buffer.isBuffer(data) ? data : Buffer.from(data));
51
51
  });
52
52
 
53
53
  this.socket.once('close', () => {
package/src/lib/types.ts CHANGED
@@ -574,6 +574,228 @@ export interface GraphicsService {
574
574
  messages(): AsyncGenerator<unknown, void, unknown>;
575
575
  }
576
576
 
577
+ /**
578
+ * Process information
579
+ */
580
+ export interface ProcessInfo {
581
+ /** Process identifier (may be negative for system services) */
582
+ pid: number;
583
+
584
+ /** Process name */
585
+ name?: string;
586
+
587
+ /** Indicates whether the process is an application */
588
+ isApplication: boolean;
589
+
590
+ /** Bundle identifier for application processes */
591
+ bundleIdentifier?: string;
592
+
593
+ /** Full path to the executable */
594
+ realAppName?: string;
595
+
596
+ /** Raw device start timestamp */
597
+ startDate?: {
598
+ /** Mach-based timestamp value */
599
+ 'NS.time': number;
600
+ };
601
+
602
+ /** Whether crash analysis should include corpse sampling */
603
+ shouldAnalyzeWithCorpse?: boolean;
604
+ }
605
+
606
+ /**
607
+ * DeviceInfo service interface for accessing device information,
608
+ * file system, and process management
609
+ */
610
+ export interface DeviceInfoService {
611
+ /**
612
+ * List directory contents
613
+ * @param path The directory path to list
614
+ * @returns Array of filenames
615
+ */
616
+ ls(path: string): Promise<string[]>;
617
+
618
+ /**
619
+ * Get executable path for a process
620
+ * @param pid The process identifier
621
+ * @returns The full path to the executable
622
+ */
623
+ execnameForPid(pid: number): Promise<string>;
624
+
625
+ /**
626
+ * Get list of running processes
627
+ * @returns Array of process information
628
+ * @example
629
+ * ```typescript
630
+ * const processes = await deviceInfo.proclist();
631
+ * // Example response:
632
+ * // [
633
+ * // {
634
+ * // name: 'audioaccessoryd',
635
+ * // startDate: { 'NS.time': 786563887.8186979 },
636
+ * // isApplication: false,
637
+ * // pid: 77,
638
+ * // realAppName: '/usr/libexec/audioaccessoryd'
639
+ * // },
640
+ * // {
641
+ * // name: 'dmd',
642
+ * // startDate: { 'NS.time': 786563890.2724509 },
643
+ * // isApplication: false,
644
+ * // pid: -102,
645
+ * // realAppName: '/usr/libexec/dmd'
646
+ * // },
647
+ * // ...
648
+ * // ]
649
+ * ```
650
+ */
651
+ proclist(): Promise<ProcessInfo[]>;
652
+
653
+ /**
654
+ * Check if a process is running
655
+ * @param pid The process identifier
656
+ * @returns true if running, false otherwise
657
+ */
658
+ isRunningPid(pid: number): Promise<boolean>;
659
+
660
+ /**
661
+ * Get hardware information
662
+ * @returns Hardware information object
663
+ * @example
664
+ * ```typescript
665
+ * const hwInfo = await deviceInfo.hardwareInformation();
666
+ * // Example response:
667
+ * // {
668
+ * // numberOfPhysicalCpus: 6,
669
+ * // hwCPUsubtype: 2,
670
+ * // numberOfCpus: 6,
671
+ * // hwCPUtype: 16777228,
672
+ * // hwCPU64BitCapable: 1,
673
+ * // ProcessorTraceState: {
674
+ * // HWTraceVersion: '{\n "lib_ver": "libhwtrace @ tag libhwtrace-118.1",\n "api_ver": 21,\n ...\n}',
675
+ * // Streaming: false,
676
+ * // ProdTraceSupported: false,
677
+ * // AllocatedBufferSize: 0,
678
+ * // HWSupported: false,
679
+ * // HWConfigured: false,
680
+ * // RequestedBufferSize: 0,
681
+ * // DevTraceSupported: false
682
+ * // }
683
+ * // }
684
+ * ```
685
+ */
686
+ hardwareInformation(): Promise<any>;
687
+
688
+ /**
689
+ * Get network information
690
+ * @returns Network information object
691
+ * @example
692
+ * ```typescript
693
+ * const networkInfo = await deviceInfo.networkInformation();
694
+ * // Example response:
695
+ * // {
696
+ * // en2: 'Ethernet Adapter (en2)',
697
+ * // en0: 'Wi-Fi',
698
+ * // en1: 'Ethernet Adapter (en1)',
699
+ * // lo0: 'Loopback'
700
+ * // }
701
+ * ```
702
+ */
703
+ networkInformation(): Promise<any>;
704
+
705
+ /**
706
+ * Get mach time information
707
+ * @returns Mach time info array containing [machAbsoluteTime, numer, denom, machContinuousTime, systemTime, timezone]
708
+ * @example
709
+ * ```typescript
710
+ * const machTime = await deviceInfo.machTimeInfo();
711
+ * // Example response:
712
+ * // [
713
+ * // 1536005260807, // machAbsoluteTime
714
+ * // 125, // numer
715
+ * // 3, // denom
716
+ * // 1713684132688, // machContinuousTime
717
+ * // 1764942215.065243, // systemTime
718
+ * // 'Asia/Kolkata' // timezone
719
+ * // ]
720
+ * ```
721
+ */
722
+ machTimeInfo(): Promise<any>;
723
+
724
+ /**
725
+ * Get mach kernel name
726
+ * @returns Kernel name string
727
+ * @example
728
+ * ```typescript
729
+ * const kernelName = await deviceInfo.machKernelName();
730
+ * // Example response:
731
+ * // '/mach.release.t8030'
732
+ * ```
733
+ */
734
+ machKernelName(): Promise<string>;
735
+
736
+ /**
737
+ * Get kernel performance event database
738
+ * @returns KPEP database object or null
739
+ * @example
740
+ * ```typescript
741
+ * const kpep = await deviceInfo.kpepDatabase();
742
+ * // Example response:
743
+ * // {
744
+ * // system: {
745
+ * // cpu: {
746
+ * // config_counters: 1020,
747
+ * // marketing_name: 'Apple A13',
748
+ * // fixed_counters: 3,
749
+ * // aliases: { ... },
750
+ * // events: { ... },
751
+ * // architecture: 'arm64',
752
+ * // power_counters: -32
753
+ * // }
754
+ * // },
755
+ * // internal: false,
756
+ * // id: 'cpu_100000c_2_462504d2',
757
+ * // name: 'a13',
758
+ * // version: [1, 0]
759
+ * // }
760
+ * ```
761
+ */
762
+ kpepDatabase(): Promise<any | null>;
763
+
764
+ /**
765
+ * Get trace code mappings
766
+ * @returns Object mapping trace codes (as hex strings) to descriptions
767
+ * @example
768
+ * ```typescript
769
+ * const codes = await deviceInfo.traceCodes();
770
+ * // Example response:
771
+ * // {
772
+ * // '0x1020000': 'KTrap_DivideError',
773
+ * // '0x1020004': 'KTrap_Debug',
774
+ * // '0x1020008': 'KTrap_NMI',
775
+ * // '0x102000c': 'KTrap_Int3',
776
+ * // '0x1020010': 'KTrap_Overflow',
777
+ * // '0x1020014': 'KTrap_BoundRange',
778
+ * // ...
779
+ * // }
780
+ * ```
781
+ */
782
+ traceCodes(): Promise<Record<string, string>>;
783
+
784
+ /**
785
+ * Get username for UID
786
+ * @param uid The user identifier
787
+ * @returns Username string
788
+ */
789
+ nameForUid(uid: number): Promise<string>;
790
+
791
+ /**
792
+ * Get group name for GID
793
+ * @param gid The group identifier
794
+ * @returns Group name string
795
+ */
796
+ nameForGid(gid: number): Promise<string>;
797
+ }
798
+
577
799
  /**
578
800
  * DVT service with connection
579
801
  * This allows callers to properly manage the connection lifecycle
@@ -591,6 +813,8 @@ export interface DVTServiceWithConnection {
591
813
  appListing: AppListService;
592
814
  /** The Graphics service instance */
593
815
  graphics: GraphicsService;
816
+ /** The DeviceInfo service instance */
817
+ deviceInfo: DeviceInfoService;
594
818
  /** The RemoteXPC connection that can be used to close the connection */
595
819
  remoteXPC: RemoteXpcConnection;
596
820
  }