@mcesystems/apple-kit 1.0.0 → 1.0.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 (88) hide show
  1. package/dist/index.js +465 -404
  2. package/dist/index.js.map +4 -4
  3. package/dist/types/index.d.ts +6 -3
  4. package/dist/types/index.d.ts.map +1 -1
  5. package/dist/types/logic/actions/activation.d.ts +12 -0
  6. package/dist/types/logic/actions/activation.d.ts.map +1 -0
  7. package/dist/types/logic/actions/device.d.ts +27 -0
  8. package/dist/types/logic/actions/device.d.ts.map +1 -0
  9. package/dist/types/logic/actions/install.d.ts +9 -0
  10. package/dist/types/logic/actions/install.d.ts.map +1 -0
  11. package/dist/types/logic/actions/pair.d.ts +6 -0
  12. package/dist/types/logic/actions/pair.d.ts.map +1 -0
  13. package/dist/types/logic/actions/proxy.d.ts +3 -0
  14. package/dist/types/logic/actions/proxy.d.ts.map +1 -0
  15. package/dist/types/logic/appleDeviceKit.d.ts +53 -7
  16. package/dist/types/logic/appleDeviceKit.d.ts.map +1 -1
  17. package/dist/types/logic/dataParser.d.ts +23 -0
  18. package/dist/types/logic/dataParser.d.ts.map +1 -0
  19. package/dist/types/logic/devicesMonitor.d.ts.map +1 -1
  20. package/dist/types/logic/enrollment.d.ts +56 -0
  21. package/dist/types/logic/enrollment.d.ts.map +1 -0
  22. package/dist/types/logic/skipSetup.d.ts +81 -0
  23. package/dist/types/logic/skipSetup.d.ts.map +1 -0
  24. package/dist/types/types/skipSteps.d.ts +136 -0
  25. package/dist/types/types/skipSteps.d.ts.map +1 -0
  26. package/dist/types/types.d.ts +22 -5
  27. package/dist/types/types.d.ts.map +1 -1
  28. package/dist/types/utils/debug.d.ts +8 -0
  29. package/dist/types/utils/debug.d.ts.map +1 -1
  30. package/dist/types/utils/idevicePath.d.ts +3 -0
  31. package/dist/types/utils/idevicePath.d.ts.map +1 -1
  32. package/dist/types/utils/usbmuxd.d.ts +19 -0
  33. package/dist/types/utils/usbmuxd.d.ts.map +1 -0
  34. package/dist/types/utils/wifiProfile.d.ts +72 -0
  35. package/dist/types/utils/wifiProfile.d.ts.map +1 -0
  36. package/package.json +3 -2
  37. package/resources/bin/windows/ideviceactivation.exe +0 -0
  38. package/resources/bin/windows/libideviceactivation-1.0.dll +0 -0
  39. package/resources/bin/windows/libimobiledevice-1.0.dll +0 -0
  40. package/resources/bin/windows/libimobiledevice-glue-1.0.dll +0 -0
  41. package/resources/bin/windows/libplist-2.0.dll +0 -0
  42. package/resources/bin/windows/libusbmuxd-2.0.dll +0 -0
  43. package/resources/lib/include/libimobiledevice/afc.h +413 -0
  44. package/resources/lib/include/libimobiledevice/bt_packet_logger.h +156 -0
  45. package/resources/lib/include/libimobiledevice/companion_proxy.h +212 -0
  46. package/resources/lib/include/libimobiledevice/debugserver.h +272 -0
  47. package/resources/lib/include/libimobiledevice/diagnostics_relay.h +228 -0
  48. package/resources/lib/include/libimobiledevice/file_relay.h +166 -0
  49. package/resources/lib/include/libimobiledevice/heartbeat.h +137 -0
  50. package/resources/lib/include/libimobiledevice/house_arrest.h +180 -0
  51. package/resources/lib/include/libimobiledevice/installation_proxy.h +505 -0
  52. package/resources/lib/include/libimobiledevice/libimobiledevice.h +444 -0
  53. package/resources/lib/include/libimobiledevice/lockdown.h +577 -0
  54. package/resources/lib/include/libimobiledevice/misagent.h +168 -0
  55. package/resources/lib/include/libimobiledevice/mobile_image_mounter.h +275 -0
  56. package/resources/lib/include/libimobiledevice/mobileactivation.h +192 -0
  57. package/resources/lib/include/libimobiledevice/mobilebackup.h +246 -0
  58. package/resources/lib/include/libimobiledevice/mobilebackup2.h +214 -0
  59. package/resources/lib/include/libimobiledevice/mobilesync.h +359 -0
  60. package/resources/lib/include/libimobiledevice/notification_proxy.h +202 -0
  61. package/resources/lib/include/libimobiledevice/ostrace.h +198 -0
  62. package/resources/lib/include/libimobiledevice/preboard.h +187 -0
  63. package/resources/lib/include/libimobiledevice/property_list_service.h +184 -0
  64. package/resources/lib/include/libimobiledevice/restore.h +179 -0
  65. package/resources/lib/include/libimobiledevice/reverse_proxy.h +213 -0
  66. package/resources/lib/include/libimobiledevice/sbservices.h +175 -0
  67. package/resources/lib/include/libimobiledevice/screenshotr.h +118 -0
  68. package/resources/lib/include/libimobiledevice/service.h +202 -0
  69. package/resources/lib/include/libimobiledevice/syslog_relay.h +184 -0
  70. package/resources/lib/include/libimobiledevice/webinspector.h +137 -0
  71. package/resources/lib/include/plist/Array.h +80 -0
  72. package/resources/lib/include/plist/Boolean.h +48 -0
  73. package/resources/lib/include/plist/Data.h +50 -0
  74. package/resources/lib/include/plist/Date.h +54 -0
  75. package/resources/lib/include/plist/Dictionary.h +73 -0
  76. package/resources/lib/include/plist/Integer.h +54 -0
  77. package/resources/lib/include/plist/Key.h +49 -0
  78. package/resources/lib/include/plist/Node.h +57 -0
  79. package/resources/lib/include/plist/Real.h +48 -0
  80. package/resources/lib/include/plist/String.h +52 -0
  81. package/resources/lib/include/plist/Structure.h +62 -0
  82. package/resources/lib/include/plist/Uid.h +48 -0
  83. package/resources/lib/include/plist/plist++.h +39 -0
  84. package/resources/lib/include/plist/plist.h +1448 -0
  85. package/resources/lib/libimobiledevice-1.0.dll +0 -0
  86. package/resources/lib/libimobiledevice-1.0.dll.a +0 -0
  87. package/resources/lib/libplist-2.0.dll +0 -0
  88. package/resources/lib/libplist-2.0.dll.a +0 -0
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/logic/appleDeviceKit.ts", "../src/utils/debug.ts", "../src/utils/exec.ts", "../src/utils/idevicePath.ts", "../src/logic/devicesMonitor.ts", "../src/utils/usbmuxd.ts"],
4
- "sourcesContent": ["import type { ChildProcess } from \"node:child_process\";\r\nimport { spawn } from \"node:child_process\";\r\nimport type { AppInfo, DeviceListEntry, iOSDeviceInfo } from \"../types\";\r\nimport { logInfo, logTask } from \"../utils/debug\";\r\nimport { runIDeviceTool } from \"../utils/exec\";\r\nimport { getIDeviceBinPath, getIDeviceToolPath } from \"../utils/idevicePath\";\r\n\r\n/**\r\n * Parse plist-style output from ideviceinfo\r\n */\r\nfunction parsePlistOutput(output: string): Record<string, string> {\r\n const result: Record<string, string> = {};\r\n const lines = output.split(\"\\n\");\r\n\r\n for (const line of lines) {\r\n const colonIndex = line.indexOf(\":\");\r\n if (colonIndex > 0) {\r\n const key = line.substring(0, colonIndex).trim();\r\n const value = line.substring(colonIndex + 1).trim();\r\n result[key] = value;\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Parse idevice_id output\r\n */\r\nfunction parseDeviceList(output: string): DeviceListEntry[] {\r\n const devices: DeviceListEntry[] = [];\r\n const lines = output.trim().split(\"\\n\");\r\n\r\n for (const line of lines) {\r\n const trimmed = line.trim();\r\n if (trimmed) {\r\n // Format: \"UDID (connection type)\" or just \"UDID\"\r\n const match = trimmed.match(/^([A-Fa-f0-9-]+)(?:\\s+\\((\\w+)\\))?/);\r\n if (match) {\r\n devices.push({\r\n udid: match[1],\r\n connectionType: match[2] === \"Network\" ? 2 : 1,\r\n });\r\n }\r\n }\r\n }\r\n\r\n return devices;\r\n}\r\n\r\n/**\r\n * Parse ideviceinstaller list output\r\n */\r\nfunction parseAppList(output: string): AppInfo[] {\r\n const apps: AppInfo[] = [];\r\n const lines = output.trim().split(\"\\n\");\r\n\r\n for (const line of lines) {\r\n // Format: \"com.example.app, Version, \"Display Name\"\"\r\n const match = line.match(/^([^,]+),\\s*([^,]+),\\s*\"?([^\"]+)\"?/);\r\n if (match) {\r\n apps.push({\r\n bundleId: match[1].trim(),\r\n version: match[2].trim(),\r\n displayName: match[3].trim(),\r\n bundleVersion: \"\",\r\n });\r\n }\r\n }\r\n\r\n return apps;\r\n}\r\n\r\n/**\r\n * Port forwarding handle\r\n */\r\nexport interface PortForwardHandle {\r\n /** Stop the port forwarding */\r\n stop: () => void;\r\n /** The local port being forwarded */\r\n localPort: number;\r\n /** The device port being forwarded to */\r\n devicePort: number;\r\n /** The underlying process */\r\n process: ChildProcess;\r\n}\r\n\r\n/**\r\n * Activation state\r\n */\r\nexport interface ActivationState {\r\n isActivated: boolean;\r\n activationState: string;\r\n}\r\n\r\n/**\r\n * AppleDeviceKit - iOS device operations wrapper\r\n * \r\n * Uses idevice command-line tools for iOS device operations.\r\n * Each instance is associated with a specific device by UDID.\r\n */\r\nexport class AppleDeviceKit {\r\n private deviceId: string;\r\n\r\n constructor(\r\n udid: string,\r\n private readonly port: number\r\n ) {\r\n this.deviceId = udid;\r\n logInfo(`AppleDeviceKit initialized for device: ${this.deviceId}`);\r\n }\r\n\r\n // ==================== Device Info ====================\r\n\r\n /**\r\n * Get detailed device information\r\n */\r\n public async getDeviceInfo(): Promise<iOSDeviceInfo> {\r\n logTask(`Getting device info for ${this.deviceId}`);\r\n\r\n const toolPath = getIDeviceToolPath(\"ideviceinfo\");\r\n if (!toolPath) {\r\n throw new Error(\"ideviceinfo tool not found\");\r\n }\r\n\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-u\", this.deviceId]);\r\n const props = parsePlistOutput(stdout);\r\n\r\n return {\r\n deviceName: props.DeviceName || \"\",\r\n productType: props.ProductType || \"\",\r\n productVersion: props.ProductVersion || \"\",\r\n buildVersion: props.BuildVersion || \"\",\r\n serialNumber: props.SerialNumber || \"\",\r\n udid: props.UniqueDeviceID || this.deviceId,\r\n wifiAddress: props.WiFiAddress || \"\",\r\n bluetoothAddress: props.BluetoothAddress || \"\",\r\n phoneNumber: props.PhoneNumber || \"\",\r\n cpuArchitecture: props.CPUArchitecture || \"\",\r\n hardwareModel: props.HardwareModel || \"\",\r\n modelNumber: props.ModelNumber || \"\",\r\n regionInfo: props.RegionInfo || \"\",\r\n timeZone: props.TimeZone || \"\",\r\n uniqueChipID: props.UniqueChipID || \"\",\r\n isPaired: true, // If we can get info, device is paired\r\n };\r\n }\r\n\r\n // ==================== Trust/Pairing ====================\r\n\r\n /**\r\n * Check if device is paired/trusted with this computer\r\n */\r\n public async isPaired(): Promise<boolean> {\r\n logTask(`Checking pairing status for ${this.deviceId}`);\r\n\r\n const toolPath = getIDeviceToolPath(\"idevicepair\");\r\n if (!toolPath) {\r\n throw new Error(\"idevicepair tool not found\");\r\n }\r\n\r\n try {\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"validate\"]);\r\n return stdout.toLowerCase().includes(\"success\");\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Wait for device to be paired\r\n * Polls the pairing status until successful or timeout\r\n * \r\n * @param timeout Timeout in milliseconds (default: 120000)\r\n * @param pollInterval Poll interval in milliseconds (default: 1000)\r\n */\r\n public async waitForPairing(timeout = 120000, pollInterval = 1000): Promise<boolean> {\r\n logTask(`Waiting for pairing on device ${this.deviceId}`);\r\n\r\n const startTime = Date.now();\r\n\r\n while (Date.now() - startTime < timeout) {\r\n if (await this.isPaired()) {\r\n logInfo(`Device ${this.deviceId} is now paired`);\r\n return true;\r\n }\r\n\r\n await new Promise(resolve => setTimeout(resolve, pollInterval));\r\n }\r\n\r\n throw new Error(`Timeout waiting for device pairing after ${timeout}ms`);\r\n }\r\n\r\n /**\r\n * Attempt to pair/trust the device\r\n * User must accept the trust dialog on the device\r\n */\r\n public async pair(): Promise<boolean> {\r\n logTask(`Initiating pairing for device ${this.deviceId}`);\r\n\r\n const toolPath = getIDeviceToolPath(\"idevicepair\");\r\n if (!toolPath) {\r\n throw new Error(\"idevicepair tool not found\");\r\n }\r\n\r\n try {\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"pair\"]);\r\n return stdout.toLowerCase().includes(\"success\");\r\n } catch (error) {\r\n const errorMsg = error instanceof Error ? error.message : String(error);\r\n if (errorMsg.includes(\"Please accept the trust dialog\")) {\r\n // Pairing dialog shown on device\r\n return false;\r\n }\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Unpair/untrust the device\r\n */\r\n public async unpair(): Promise<boolean> {\r\n logTask(`Unpairing device ${this.deviceId}`);\r\n\r\n const toolPath = getIDeviceToolPath(\"idevicepair\");\r\n if (!toolPath) {\r\n throw new Error(\"idevicepair tool not found\");\r\n }\r\n\r\n try {\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"unpair\"]);\r\n return stdout.toLowerCase().includes(\"success\");\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n // ==================== App Installation ====================\r\n\r\n /**\r\n * Install an IPA file on the device (install agent)\r\n * \r\n * @param ipaPath Path to the IPA file\r\n */\r\n public async installApp(ipaPath: string): Promise<void> {\r\n logTask(`Installing app ${ipaPath} on device ${this.deviceId}`);\r\n\r\n if (!(await this.isPaired())) {\r\n await this.waitForPairing(10000);\r\n }\r\n\r\n const toolPath = getIDeviceToolPath(\"ideviceinstaller\");\r\n if (!toolPath) {\r\n throw new Error(\"ideviceinstaller tool not found\");\r\n }\r\n\r\n await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"-i\", ipaPath]);\r\n }\r\n\r\n /**\r\n * Uninstall an app by bundle ID (uninstall agent)\r\n * \r\n * @param bundleId Application bundle identifier\r\n */\r\n public async uninstallApp(bundleId: string): Promise<void> {\r\n logTask(`Uninstalling app ${bundleId} from device ${this.deviceId}`);\r\n\r\n if (!(await this.isPaired())) {\r\n await this.waitForPairing(10000);\r\n }\r\n\r\n const toolPath = getIDeviceToolPath(\"ideviceinstaller\");\r\n if (!toolPath) {\r\n throw new Error(\"ideviceinstaller tool not found\");\r\n }\r\n\r\n await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"-U\", bundleId]);\r\n }\r\n\r\n /**\r\n * Check if an app is installed on the device\r\n * \r\n * @param bundleId Application bundle identifier\r\n */\r\n public async isAppInstalled(bundleId: string): Promise<boolean> {\r\n logTask(`Checking if app ${bundleId} is installed on device ${this.deviceId}`);\r\n\r\n const apps = await this.listApps();\r\n return apps.some(app => app.bundleId === bundleId);\r\n }\r\n\r\n /**\r\n * List all installed user applications\r\n */\r\n public async listApps(): Promise<AppInfo[]> {\r\n logTask(`Listing apps on device ${this.deviceId}`);\r\n\r\n if (!(await this.isPaired())) {\r\n await this.waitForPairing(10000);\r\n }\r\n\r\n const toolPath = getIDeviceToolPath(\"ideviceinstaller\");\r\n if (!toolPath) {\r\n throw new Error(\"ideviceinstaller tool not found\");\r\n }\r\n\r\n try {\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"-l\"]);\r\n return parseAppList(stdout);\r\n } catch {\r\n return [];\r\n }\r\n }\r\n\r\n // ==================== Launch Application ====================\r\n\r\n /**\r\n * Launch an application on the device\r\n * \r\n * @param bundleId Application bundle identifier to launch\r\n * @param args Optional arguments to pass to the app\r\n */\r\n public async launchApp(bundleId: string, args: string[] = []): Promise<void> {\r\n logTask(`Launching app ${bundleId} on device ${this.deviceId}`);\r\n\r\n if (!(await this.isPaired())) {\r\n await this.waitForPairing(10000);\r\n }\r\n\r\n const toolPath = getIDeviceToolPath(\"idevicedebug\");\r\n if (!toolPath) {\r\n throw new Error(\"idevicedebug tool not found\");\r\n }\r\n\r\n const toolArgs = [\"-u\", this.deviceId, \"run\", bundleId, ...args];\r\n await runIDeviceTool(toolPath, toolArgs);\r\n }\r\n\r\n // ==================== Port Forwarding ====================\r\n\r\n /**\r\n * Start port forwarding from local port to device port\r\n * \r\n * @param localPort Local port to listen on\r\n * @param devicePort Device port to forward to\r\n * @returns Handle to stop the port forwarding\r\n */\r\n public startPortForward(localPort: number, devicePort: number): PortForwardHandle {\r\n logTask(`Starting port forward ${localPort} -> ${devicePort} for device ${this.deviceId}`);\r\n\r\n const toolPath = getIDeviceToolPath(\"iproxy\");\r\n if (!toolPath) {\r\n throw new Error(\"iproxy tool not found\");\r\n }\r\n\r\n const binPath = getIDeviceBinPath();\r\n const env = {\r\n ...process.env,\r\n PATH: `${binPath};${process.env.PATH}`,\r\n };\r\n\r\n // iproxy LOCAL_PORT DEVICE_PORT -u UDID\r\n const proc = spawn(toolPath, [\r\n localPort.toString(),\r\n devicePort.toString(),\r\n \"-u\",\r\n this.deviceId\r\n ], {\r\n env,\r\n windowsHide: true,\r\n stdio: \"pipe\",\r\n });\r\n\r\n proc.on(\"error\", (err) => {\r\n logInfo(`Port forward error: ${err.message}`);\r\n });\r\n\r\n return {\r\n stop: () => {\r\n proc.kill();\r\n },\r\n localPort,\r\n devicePort,\r\n process: proc,\r\n };\r\n }\r\n\r\n /**\r\n * Start port forwarding and wait for it to be ready\r\n * \r\n * @param localPort Local port to listen on\r\n * @param devicePort Device port to forward to\r\n * @param _timeout Timeout in milliseconds (reserved for future use)\r\n */\r\n public async startPortForwardAsync(\r\n localPort: number,\r\n devicePort: number,\r\n _timeout = 5000\r\n ): Promise<PortForwardHandle> {\r\n const handle = this.startPortForward(localPort, devicePort);\r\n\r\n // Give iproxy a moment to start\r\n await new Promise(resolve => setTimeout(resolve, 500));\r\n\r\n // Check if process is still running\r\n if (handle.process.killed || handle.process.exitCode !== null) {\r\n throw new Error(\"Port forwarding failed to start\");\r\n }\r\n\r\n return handle;\r\n }\r\n\r\n // ==================== Activation ====================\r\n\r\n /**\r\n * Get the activation state of the device\r\n */\r\n public async getActivationState(): Promise<ActivationState> {\r\n logTask(`Getting activation state for device ${this.deviceId}`);\r\n\r\n const toolPath = getIDeviceToolPath(\"ideviceinfo\");\r\n if (!toolPath) {\r\n throw new Error(\"ideviceinfo tool not found\");\r\n }\r\n\r\n try {\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"-k\", \"ActivationState\"]);\r\n const state = stdout.trim();\r\n\r\n return {\r\n isActivated: state === \"Activated\",\r\n activationState: state,\r\n };\r\n } catch {\r\n return {\r\n isActivated: false,\r\n activationState: \"Unknown\",\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Activate the device\r\n * Note: This requires a valid activation record or Apple server access\r\n */\r\n public async activate(): Promise<boolean> {\r\n logTask(`Activating device ${this.deviceId}`);\r\n\r\n const toolPath = getIDeviceToolPath(\"ideviceactivation\");\r\n if (!toolPath) {\r\n throw new Error(\"ideviceactivation tool not found\");\r\n }\r\n\r\n try {\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"activate\"]);\r\n return stdout.toLowerCase().includes(\"success\") ||\r\n stdout.toLowerCase().includes(\"activated\");\r\n } catch (error) {\r\n const errorMsg = error instanceof Error ? error.message : String(error);\r\n throw new Error(`Activation failed: ${errorMsg}`);\r\n }\r\n }\r\n\r\n /**\r\n * Deactivate the device\r\n */\r\n public async deactivate(): Promise<boolean> {\r\n logTask(`Deactivating device ${this.deviceId}`);\r\n\r\n const toolPath = getIDeviceToolPath(\"ideviceactivation\");\r\n if (!toolPath) {\r\n throw new Error(\"ideviceactivation tool not found\");\r\n }\r\n\r\n try {\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-u\", this.deviceId, \"deactivate\"]);\r\n return stdout.toLowerCase().includes(\"success\");\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Get activation state as string\r\n */\r\n public async getActivationStateString(): Promise<string> {\r\n const state = await this.getActivationState();\r\n return state.activationState;\r\n }\r\n\r\n // ==================== Device Identifiers ====================\r\n\r\n /**\r\n * Get the device UDID\r\n */\r\n public getDeviceId(): string {\r\n return this.deviceId;\r\n }\r\n\r\n /**\r\n * Get the logical port number\r\n */\r\n public getPort(): number {\r\n return this.port;\r\n }\r\n\r\n // ==================== Static Methods ====================\r\n\r\n /**\r\n * Static method to list all connected iOS devices\r\n */\r\n public static async listDevices(): Promise<DeviceListEntry[]> {\r\n const toolPath = getIDeviceToolPath(\"idevice_id\");\r\n if (!toolPath) {\r\n throw new Error(\"idevice_id tool not found\");\r\n }\r\n\r\n try {\r\n const { stdout } = await runIDeviceTool(toolPath, [\"-l\"]);\r\n return parseDeviceList(stdout);\r\n } catch {\r\n return [];\r\n }\r\n }\r\n}\r\n", "import createDebug from \"debug\";\r\n\r\nconst debug = createDebug(\"apple-kit\");\r\nconst debugTask = createDebug(\"apple-kit:task\");\r\n\r\n/**\r\n * Log general information\r\n */\r\nexport function logInfo(message: string): void {\r\n\tdebug(message);\r\n}\r\n\r\n/**\r\n * Log task-specific information\r\n */\r\nexport function logTask(message: string): void {\r\n\tdebugTask(message);\r\n}\r\n\r\n", "import { exec as execCallback, type ExecOptions } from \"node:child_process\";\r\nimport { promisify } from \"node:util\";\r\nimport { getIDeviceBinPath } from \"./idevicePath\";\r\n\r\nconst execAsync = promisify(execCallback);\r\n\r\nexport interface ExecResult {\r\n\tstdout: string;\r\n\tstderr: string;\r\n}\r\n\r\n/**\r\n * Execute a command with idevice tools in PATH\r\n */\r\nexport async function execIDevice(command: string, options: ExecOptions = {}): Promise<ExecResult> {\r\n\tconst binPath = getIDeviceBinPath();\r\n\t\r\n\t// Add our bin path to PATH so DLLs can be found\r\n\tconst env = {\r\n\t\t...process.env,\r\n\t\tPATH: `${binPath};${process.env.PATH}`,\r\n\t};\r\n\t\r\n\tconst result = await execAsync(command, {\r\n\t\t...options,\r\n\t\tenv,\r\n\t\twindowsHide: true,\r\n\t\tencoding: \"utf8\",\r\n\t});\r\n\t\r\n\treturn {\r\n\t\tstdout: result.stdout.toString(),\r\n\t\tstderr: result.stderr.toString(),\r\n\t};\r\n}\r\n\r\n/**\r\n * Execute an idevice tool command\r\n */\r\nexport async function runIDeviceTool(\r\n\ttoolPath: string,\r\n\targs: string[] = [],\r\n\toptions: ExecOptions = {}\r\n): Promise<ExecResult> {\r\n\tconst command = `\"${toolPath}\" ${args.map(a => `\"${a}\"`).join(\" \")}`;\r\n\treturn execIDevice(command, options);\r\n}\r\n\r\n", "import { existsSync } from \"node:fs\";\r\nimport { dirname, join } from \"node:path\";\r\nimport { fileURLToPath } from \"node:url\";\r\n\r\n// ESM compatibility: get __dirname equivalent\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = dirname(__filename);\r\n\r\n/**\r\n * Get the path to idevice binaries from resources\r\n */\r\nfunction getResourcesBinPath(): string {\r\n // When built, we're in dist/utils/idevicePath.js\r\n // Resources are at package root: ../../resources/bin/<platform>\r\n const packageRoot = dirname(dirname(__dirname));\r\n\r\n const platform = process.platform;\r\n let platformDir: string;\r\n\r\n switch (platform) {\r\n case \"win32\":\r\n platformDir = \"windows\";\r\n break;\r\n case \"darwin\":\r\n platformDir = \"darwin\";\r\n break;\r\n case \"linux\":\r\n platformDir = \"linux\";\r\n break;\r\n default:\r\n throw new Error(`Unsupported platform: ${platform}`);\r\n }\r\n\r\n return join(packageRoot, \"resources\", \"bin\", platformDir);\r\n}\r\n\r\n/**\r\n * Get the path to a specific idevice tool\r\n */\r\nexport function getIDeviceToolPath(toolName: string): string | null {\r\n const binPath = getResourcesBinPath();\r\n const ext = process.platform === \"win32\" ? \".exe\" : \"\";\r\n const toolPath = join(binPath, `${toolName}${ext}`);\r\n\r\n if (existsSync(toolPath)) {\r\n return toolPath;\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Get paths to all required idevice tools\r\n */\r\nexport function getIDeviceTools() {\r\n return {\r\n idevice_id: getIDeviceToolPath(\"idevice_id\"),\r\n ideviceinfo: getIDeviceToolPath(\"ideviceinfo\"),\r\n ideviceinstaller: getIDeviceToolPath(\"ideviceinstaller\"),\r\n idevicepair: getIDeviceToolPath(\"idevicepair\"),\r\n idevicename: getIDeviceToolPath(\"idevicename\"),\r\n idevicedebug: getIDeviceToolPath(\"idevicedebug\"),\r\n iproxy: getIDeviceToolPath(\"iproxy\"),\r\n ideviceactivation: getIDeviceToolPath(\"ideviceactivation\"),\r\n };\r\n}\r\n\r\n/**\r\n * Get the bin path for PATH environment variable\r\n */\r\nexport function getIDeviceBinPath(): string {\r\n return getResourcesBinPath();\r\n}\r\n\r\n", "import EventEmitter from \"node:events\";\r\nimport type { AppleListenerConfig } from \"../types\";\r\nimport { logInfo } from \"../utils/debug\";\r\nimport { AppleDeviceKit } from \"./appleDeviceKit\";\r\nimport usbDeviceListener from \"@mcesystems/usb-device-listener\";\r\nimport type { DeviceInfo, ListenerConfig } from \"@mcesystems/usb-device-listener\";\r\n\r\n// Apple vendor ID\r\nconst APPLE_VID = 0x05ac;\r\n\r\n/**\r\n * DevicesMonitor - Monitor iOS device connections via USB\r\n * \r\n * Uses usb-device-listener for plug-and-play detection and filters\r\n * for Apple devices (VID 0x05AC).\r\n */\r\nexport class DevicesMonitor {\r\n private kits: Map<string, AppleDeviceKit> = new Map();\r\n private eventEmitter?: EventEmitter;\r\n\r\n constructor(\r\n private config: AppleListenerConfig = {},\r\n private identifyAlreadyConnected = false\r\n ) { }\r\n\r\n /**\r\n * Start tracking iOS device connections\r\n * \r\n * @returns EventEmitter that emits:\r\n * - 'added': (deviceKit: AppleDeviceKit) when a device is connected\r\n * - 'removed': (deviceId: string, port: number) when a device is disconnected\r\n */\r\n public async startTracking(): Promise<EventEmitter> {\r\n logInfo(\"Starting iOS devices monitor\");\r\n\r\n // Build listener config with Apple device filter\r\n const listenerConfig: ListenerConfig = {\r\n logicalPortMap: this.config.logicalPortMap,\r\n // Filter for Apple devices only\r\n listenOnlyDevices: [\r\n { vid: APPLE_VID.toString(16).toUpperCase().padStart(4, \"0\"), pid: \"\" }\r\n ]\r\n };\r\n\r\n usbDeviceListener.startListening(listenerConfig);\r\n this.eventEmitter = new EventEmitter();\r\n\r\n if (this.identifyAlreadyConnected || this.config.identifyAlreadyConnected) {\r\n await this.identifyConnectedDevices();\r\n }\r\n\r\n usbDeviceListener.onDeviceAdd((device: DeviceInfo) => {\r\n // Check if this is an Apple device\r\n if (device.vid !== APPLE_VID) {\r\n return;\r\n }\r\n\r\n logInfo(`Apple device connected: ${device.deviceId}`);\r\n\r\n // Get the UDID by querying connected iOS devices\r\n this.findAndEmitDevice(device);\r\n });\r\n\r\n usbDeviceListener.onDeviceRemove((device: DeviceInfo) => {\r\n // Check if this is an Apple device\r\n if (device.vid !== APPLE_VID) {\r\n return;\r\n }\r\n\r\n logInfo(`Apple device disconnected: ${device.deviceId}`);\r\n\r\n // Find and remove the kit by location\r\n for (const [udid, kit] of this.kits.entries()) {\r\n if (kit.getPort() === device.logicalPort) {\r\n this.kits.delete(udid);\r\n this.eventEmitter?.emit(\"removed\", udid, device.logicalPort);\r\n break;\r\n }\r\n }\r\n });\r\n\r\n return this.eventEmitter;\r\n }\r\n\r\n /**\r\n * Stop tracking device connections\r\n */\r\n public async stopTracking(): Promise<void> {\r\n if (!this.eventEmitter) {\r\n return;\r\n }\r\n\r\n logInfo(\"Stopping iOS devices monitor\");\r\n this.eventEmitter.removeAllListeners();\r\n this.kits.clear();\r\n this.eventEmitter = undefined;\r\n usbDeviceListener.stopListening();\r\n }\r\n\r\n /**\r\n * Get all currently tracked device kits\r\n */\r\n public getKits(): Map<string, AppleDeviceKit> {\r\n return new Map(this.kits);\r\n }\r\n\r\n /**\r\n * Get a specific device kit by UDID\r\n */\r\n public getKit(udid: string): AppleDeviceKit | undefined {\r\n return this.kits.get(udid);\r\n }\r\n\r\n /**\r\n * Find connected iOS device and emit event\r\n */\r\n private async findAndEmitDevice(usbDevice: DeviceInfo): Promise<void> {\r\n // Query libimobiledevice for connected iOS devices\r\n const iOSDevices = await AppleDeviceKit.listDevices();\r\n\r\n if (iOSDevices.length === 0) {\r\n // Device might not be ready yet, retry after a short delay\r\n setTimeout(() => this.findAndEmitDevice(usbDevice), 500);\r\n return;\r\n }\r\n\r\n // For now, match by order of appearance\r\n // In a production scenario, you might want to correlate by additional means\r\n for (const iDevice of iOSDevices) {\r\n if (this.kits.has(iDevice.udid)) {\r\n continue; // Already tracking this device\r\n }\r\n\r\n const port = usbDevice.logicalPort ?? 0;\r\n const kit = new AppleDeviceKit(iDevice.udid, port);\r\n this.kits.set(iDevice.udid, kit);\r\n\r\n // Emit after a short delay to allow device to settle\r\n setTimeout(() => {\r\n this.eventEmitter?.emit(\"added\", kit);\r\n }, 0);\r\n\r\n break; // Only match one device per USB event\r\n }\r\n }\r\n\r\n /**\r\n * Identify already connected iOS devices\r\n */\r\n private async identifyConnectedDevices(): Promise<void> {\r\n logInfo(\"Identifying already connected iOS devices\");\r\n\r\n const iOSDevices = await AppleDeviceKit.listDevices();\r\n const usbDevices = usbDeviceListener.listDevices()\r\n .filter(d => d.vid === APPLE_VID);\r\n\r\n for (let i = 0; i < iOSDevices.length; i++) {\r\n const iDevice = iOSDevices[i];\r\n const usbDevice = usbDevices[i];\r\n\r\n if (this.kits.has(iDevice.udid)) {\r\n continue;\r\n }\r\n\r\n const port = usbDevice?.logicalPort ?? 0;\r\n const kit = new AppleDeviceKit(iDevice.udid, port);\r\n this.kits.set(iDevice.udid, kit);\r\n\r\n // Emit events asynchronously\r\n setTimeout(() => {\r\n this.eventEmitter?.emit(\"added\", kit);\r\n }, 0);\r\n }\r\n }\r\n}\r\n", "import type { ChildProcess } from \"node:child_process\";\r\nimport { spawn } from \"node:child_process\";\r\nimport { getIDeviceBinPath, getIDeviceToolPath } from \"./idevicePath\";\r\nimport { logInfo } from \"./debug\";\r\n\r\n/**\r\n * USBMuxD daemon handle\r\n */\r\nexport interface UsbmuxdHandle {\r\n\t/** Stop the usbmuxd daemon */\r\n\tstop: () => void;\r\n\t/** Check if the daemon is running */\r\n\tisRunning: () => boolean;\r\n\t/** The underlying process */\r\n\tprocess: ChildProcess;\r\n}\r\n\r\nlet usbmuxdProcess: ChildProcess | null = null;\r\n\r\n/**\r\n * Start the usbmuxd daemon\r\n * \r\n * This allows communicating with iOS devices without iTunes installed.\r\n * On Windows, iTunes normally provides the Apple Mobile Device Service.\r\n * Running usbmuxd.exe replaces that need.\r\n * \r\n * @param foreground If true, runs in foreground mode (default: false)\r\n * @returns Handle to control the daemon\r\n */\r\nexport function startUsbmuxd(foreground = false): UsbmuxdHandle {\r\n\tif (usbmuxdProcess && !usbmuxdProcess.killed) {\r\n\t\tlogInfo(\"usbmuxd is already running\");\r\n\t\treturn {\r\n\t\t\tstop: () => stopUsbmuxd(),\r\n\t\t\tisRunning: () => !usbmuxdProcess?.killed,\r\n\t\t\tprocess: usbmuxdProcess,\r\n\t\t};\r\n\t}\r\n\t\r\n\tconst toolPath = getIDeviceToolPath(\"usbmuxd\");\r\n\tif (!toolPath) {\r\n\t\tthrow new Error(\"usbmuxd executable not found\");\r\n\t}\r\n\t\r\n\tconst binPath = getIDeviceBinPath();\r\n\tconst env = {\r\n\t\t...process.env,\r\n\t\tPATH: `${binPath};${process.env.PATH}`,\r\n\t};\r\n\t\r\n\tconst args: string[] = [];\r\n\tif (foreground) {\r\n\t\targs.push(\"-f\"); // Foreground mode\r\n\t}\r\n\targs.push(\"-v\"); // Verbose for debugging\r\n\t\r\n\tlogInfo(`Starting usbmuxd: ${toolPath}`);\r\n\t\r\n\tusbmuxdProcess = spawn(toolPath, args, {\r\n\t\tenv,\r\n\t\twindowsHide: true,\r\n\t\tstdio: \"pipe\",\r\n\t\tdetached: !foreground,\r\n\t});\r\n\t\r\n\tusbmuxdProcess.stdout?.on(\"data\", (data) => {\r\n\t\tlogInfo(`usbmuxd: ${data.toString().trim()}`);\r\n\t});\r\n\t\r\n\tusbmuxdProcess.stderr?.on(\"data\", (data) => {\r\n\t\tlogInfo(`usbmuxd error: ${data.toString().trim()}`);\r\n\t});\r\n\t\r\n\tusbmuxdProcess.on(\"error\", (err) => {\r\n\t\tlogInfo(`usbmuxd failed to start: ${err.message}`);\r\n\t});\r\n\t\r\n\tusbmuxdProcess.on(\"exit\", (code) => {\r\n\t\tlogInfo(`usbmuxd exited with code ${code}`);\r\n\t\tusbmuxdProcess = null;\r\n\t});\r\n\t\r\n\t// Detach if running in background\r\n\tif (!foreground) {\r\n\t\tusbmuxdProcess.unref();\r\n\t}\r\n\t\r\n\treturn {\r\n\t\tstop: () => stopUsbmuxd(),\r\n\t\tisRunning: () => usbmuxdProcess !== null && !usbmuxdProcess.killed,\r\n\t\tprocess: usbmuxdProcess,\r\n\t};\r\n}\r\n\r\n/**\r\n * Stop the usbmuxd daemon\r\n */\r\nexport function stopUsbmuxd(): void {\r\n\tif (usbmuxdProcess && !usbmuxdProcess.killed) {\r\n\t\tlogInfo(\"Stopping usbmuxd\");\r\n\t\tusbmuxdProcess.kill();\r\n\t\tusbmuxdProcess = null;\r\n\t}\r\n}\r\n\r\n/**\r\n * Check if usbmuxd is running\r\n */\r\nexport function isUsbmuxdRunning(): boolean {\r\n\treturn usbmuxdProcess !== null && !usbmuxdProcess.killed;\r\n}\r\n\r\n/**\r\n * Ensure usbmuxd is running\r\n * \r\n * Starts usbmuxd if it's not already running.\r\n * This is useful to call before device operations if iTunes is not installed.\r\n */\r\nexport function ensureUsbmuxd(): UsbmuxdHandle {\r\n\tif (isUsbmuxdRunning()) {\r\n\t\treturn {\r\n\t\t\tstop: () => stopUsbmuxd(),\r\n\t\t\tisRunning: () => isUsbmuxdRunning(),\r\n\t\t\tprocess: usbmuxdProcess!,\r\n\t\t};\r\n\t}\r\n\t\r\n\treturn startUsbmuxd();\r\n}\r\n\r\n"],
5
- "mappings": ";AACA,SAAS,aAAa;;;ACDtB,OAAO,iBAAiB;AAExB,IAAM,QAAQ,YAAY,WAAW;AACrC,IAAM,YAAY,YAAY,gBAAgB;AAKvC,SAAS,QAAQ,SAAuB;AAC9C,QAAM,OAAO;AACd;AAKO,SAAS,QAAQ,SAAuB;AAC9C,YAAU,OAAO;AAClB;;;ACjBA,SAAS,QAAQ,oBAAsC;AACvD,SAAS,iBAAiB;;;ACD1B,SAAS,kBAAkB;AAC3B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAG9B,IAAM,aAAa,cAAc,YAAY,GAAG;AAChD,IAAM,YAAY,QAAQ,UAAU;AAKpC,SAAS,sBAA8B;AAGnC,QAAM,cAAc,QAAQ,QAAQ,SAAS,CAAC;AAE9C,QAAM,WAAW,QAAQ;AACzB,MAAI;AAEJ,UAAQ,UAAU;AAAA,IACd,KAAK;AACD,oBAAc;AACd;AAAA,IACJ,KAAK;AACD,oBAAc;AACd;AAAA,IACJ,KAAK;AACD,oBAAc;AACd;AAAA,IACJ;AACI,YAAM,IAAI,MAAM,yBAAyB,QAAQ,EAAE;AA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Q;AACnC,YAAQ,4BAA4B,IAAI,OAAO,EAAE;AAAA,EAClD,CAAC;AAED,iBAAe,GAAG,QAAQ,CAAC,SAAS;AACnC,YAAQ,4BAA4B,IAAI,EAAE;AAC1C,qBAAiB;AAAA,EAClB,CAAC;AAGD,MAAI,CAAC,YAAY;AAChB,mBAAe,MAAM;AAAA,EACtB;AAEA,SAAO;AAAA,IACN,MAAM,MAAM,YAAY;AAAA,IACxB,WAAW,MAAM,mBAAmB,QAAQ,CAAC,eAAe;AAAA,IAC5D,SAAS;AAAA,EACV;AACD;AAKO,SAAS,cAAoB;AACnC,MAAI,kBAAkB,CAAC,eAAe,QAAQ;AAC7C,YAAQ,kBAAkB;AAC1B,mBAAe,KAAK;AACpB,qBAAiB;AAAA,EAClB;AACD;AAKO,SAAS,mBAA4B;AAC3C,SAAO,mBAAmB,QAAQ,CAAC,eAAe;AACnD;AAQO,SAAS,gBAA+B;AAC9C,MAAI,iBAAiB,GAAG;AACvB,WAAO;AAAA,MACN,MAAM,MAAM,YAAY;AAAA,MACxB,WAAW,MAAM,iBAAiB;AAAA,MAClC,SAAS;AAAA,IACV;AAAA,EACD;AAEA,SAAO,aAAa;AACrB;",
6
- "names": ["spawn", "spawn"]
3
+ "sources": ["../src/utils/debug.ts", "../src/logic/actions/device.ts", "../src/logic/dataParser.ts", "../src/logic/actions/activation.ts", "../src/logic/actions/pair.ts", "../src/logic/actions/install.ts", "../src/logic/actions/proxy.ts", "../src/logic/appleDeviceKit.ts", "../src/logic/devicesMonitor.ts"],
4
+ "sourcesContent": ["import createDebug from \"debug\";\r\n\r\nconst debug = createDebug(\"apple-kit\");\r\nconst debugTask = createDebug(\"apple-kit:task\");\r\nconst debugWarning = createDebug(\"apple-kit:warning\");\r\nconst debugError = createDebug(\"apple-kit:error\");\r\n\r\n/**\r\n * Log general information\r\n */\r\nexport function logInfo(message: string): void {\r\n\tdebug(message);\r\n}\r\n\r\n/**\r\n * Log task-specific information\r\n */\r\nexport function logTask(message: string): void {\r\n\tdebugTask(message);\r\n}\r\n\r\n/**\r\n * Log warning messages\r\n */\r\nexport function logWarning(message: string): void {\r\n\tdebugWarning(message);\r\n}\r\n\r\n/**\r\n * Log error messages\r\n */\r\nexport function logError(message: string): void {\r\n\tdebugError(message);\r\n}\r\n\r\n", "import { type ExecOptions, exec as execCallback } from \"node:child_process\";\r\nimport { existsSync } from \"node:fs\";\r\nimport { join } from \"node:path\";\r\nimport { promisify } from \"node:util\";\r\nimport type { AppleToolType, DeviceListEntry } from \"@/types\";\r\nimport type { iOSDeviceInfo } from \"@/types\";\r\nimport { logTask } from \"@/utils/debug\";\r\nimport { parseDeviceList, parsePlistOutput } from \"../dataParser\";\r\n\r\nconst execAsync = promisify(execCallback);\r\n\r\nexport interface ExecResult {\r\n\tstdout: string;\r\n\tstderr: string;\r\n}\r\n\r\nexport async function getDeviceInfo(udid: string): Promise<iOSDeviceInfo> {\r\n\tlogTask(`Getting device info for ${udid}`);\r\n\r\n\tconst result = await runIDeviceTool(\"ideviceinfo\", [\"-u\", udid]);\r\n\tif (!result) {\r\n\t\tthrow new Error(\"Failed to get device info\");\r\n\t}\r\n\r\n\tconst props = parsePlistOutput(result.stdout);\r\n\r\n\treturn {\r\n\t\tdeviceName: props.DeviceName || \"\",\r\n\t\tproductType: props.ProductType || \"\",\r\n\t\tproductVersion: props.ProductVersion || \"\",\r\n\t\tbuildVersion: props.BuildVersion || \"\",\r\n\t\tserialNumber: props.SerialNumber || \"\",\r\n\t\tudid: props.UniqueDeviceID || udid,\r\n\t\twifiAddress: props.WiFiAddress || \"\",\r\n\t\tbluetoothAddress: props.BluetoothAddress || \"\",\r\n\t\tphoneNumber: props.PhoneNumber || \"\",\r\n\t\tcpuArchitecture: props.CPUArchitecture || \"\",\r\n\t\thardwareModel: props.HardwareModel || \"\",\r\n\t\tmodelNumber: props.ModelNumber || \"\",\r\n\t\tregionInfo: props.RegionInfo || \"\",\r\n\t\ttimeZone: props.TimeZone || \"\",\r\n\t\tuniqueChipID: props.UniqueChipID || \"\",\r\n\t\tisPaired: true, // If we can get info, device is paired\r\n\t};\r\n}\r\n\r\nexport async function listDevices(): Promise<DeviceListEntry[]> {\r\n\ttry {\r\n\t\tconst result = await runIDeviceTool(\"idevice_id\", [\"-l\"]);\r\n\t\tif (!result) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\treturn parseDeviceList(result.stdout);\r\n\t} catch {\r\n\t\treturn [];\r\n\t}\r\n}\r\n\r\n/**\r\n * Execute an idevice tool command\r\n */\r\nexport async function runIDeviceTool(\r\n\ttoolName: AppleToolType,\r\n\targs: string[] = [],\r\n\toptions: ExecOptions = {}\r\n): Promise<ExecResult> {\r\n\tconst command = `\"${toolName}\" ${args.map((a) => `\"${a}\"`).join(\" \")}`;\r\n\treturn execIDevice(command, options);\r\n}\r\n\r\n/**\r\n * Execute a command with idevice tools in PATH\r\n */\r\nasync function execIDevice(command: string, options: ExecOptions = {}): Promise<ExecResult> {\r\n\tconst binPath = getIDeviceBinPath();\r\n\r\n\t// Add our bin path to PATH so DLLs can be found\r\n\tconst env = {\r\n\t\t...process.env,\r\n\t\tPATH: `${binPath};${process.env.PATH}`,\r\n\t};\r\n\r\n\tconst result = await execAsync(command, {\r\n\t\t...options,\r\n\t\tenv,\r\n\t\twindowsHide: true,\r\n\t\tencoding: \"utf8\",\r\n\t});\r\n\r\n\treturn {\r\n\t\tstdout: result.stdout.toString(),\r\n\t\tstderr: result.stderr.toString(),\r\n\t};\r\n}\r\n\r\n/**\r\n * Get the path to idevice binaries from resources\r\n */\r\nfunction getResourcesBinPath(): string {\r\n\tconst binPath = process.env.IDeviceBinPath;\r\n\tif (!binPath) {\r\n\t\tthrow new Error(\"IDeviceBinPath is not set\");\r\n\t}\r\n\treturn binPath;\r\n}\r\n\r\n/**\r\n * Get the path to a specific idevice tool\r\n */\r\nfunction getIDeviceToolPath(toolName: string): string | null {\r\n\tconst binPath = getResourcesBinPath();\r\n\tconst ext = process.platform === \"win32\" ? \".exe\" : \"\";\r\n\tconst toolPath = join(binPath, `${toolName}${ext}`);\r\n\r\n\tif (existsSync(toolPath)) {\r\n\t\treturn toolPath;\r\n\t}\r\n\r\n\treturn null;\r\n}\r\n\r\n/**\r\n * Get paths to all required idevice tools\r\n */\r\nexport function getIDeviceTools() {\r\n\treturn {\r\n\t\tidevice_id: getIDeviceToolPath(\"idevice_id\"),\r\n\t\tideviceinfo: getIDeviceToolPath(\"ideviceinfo\"),\r\n\t\tideviceinstaller: getIDeviceToolPath(\"ideviceinstaller\"),\r\n\t\tidevicepair: getIDeviceToolPath(\"idevicepair\"),\r\n\t\tidevicename: getIDeviceToolPath(\"idevicename\"),\r\n\t\tidevicedebug: getIDeviceToolPath(\"idevicedebug\"),\r\n\t\tiproxy: getIDeviceToolPath(\"iproxy\"),\r\n\t\tideviceactivation: getIDeviceToolPath(\"ideviceactivation\"),\r\n\t};\r\n}\r\n\r\n/**\r\n * Get the bin path for PATH environment variable\r\n */\r\nfunction getIDeviceBinPath(): string {\r\n\treturn getResourcesBinPath();\r\n}\r\n", "import type { AppInfo, DeviceListEntry } from \"../types\";\r\n\r\n\r\n/**\r\n * Parse plist-style output from ideviceinfo\r\n * \r\n * @param output ideviceinfo output\r\n * @returns Plist output\r\n */\r\nexport function parsePlistOutput(output: string): Record<string, string> {\r\n const result: Record<string, string> = {};\r\n const lines = output.split(\"\\n\");\r\n\r\n for (const line of lines) {\r\n const colonIndex = line.indexOf(\":\");\r\n if (colonIndex > 0) {\r\n const key = line.substring(0, colonIndex).trim();\r\n const value = line.substring(colonIndex + 1).trim();\r\n result[key] = value;\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Parse idevice_id output\r\n * \r\n * @param output idevice_id output\r\n * @returns Device list\r\n */\r\nexport function parseDeviceList(output: string): DeviceListEntry[] {\r\n const devices: DeviceListEntry[] = [];\r\n const lines = output.trim().split(\"\\n\");\r\n\r\n for (const line of lines) {\r\n const trimmed = line.trim();\r\n if (trimmed) {\r\n // Format: \"UDID (connection type)\" or just \"UDID\"\r\n const match = trimmed.match(/^([A-Fa-f0-9-]+)(?:\\s+\\((\\w+)\\))?/);\r\n if (match) {\r\n devices.push({\r\n udid: match[1],\r\n connectionType: match[2] === \"Network\" ? 2 : 1,\r\n });\r\n }\r\n }\r\n }\r\n\r\n return devices;\r\n}\r\n\r\n/**\r\n * Parse ideviceinstaller list output\r\n * \r\n * @param output ideviceinstaller list output\r\n * @returns App list\r\n */\r\nexport function parseAppList(output: string): AppInfo[] {\r\n const apps: AppInfo[] = [];\r\n const lines = output.trim().split(\"\\n\");\r\n\r\n for (const line of lines) {\r\n // Format: \"com.example.app, Version, \"Display Name\"\"\r\n const match = line.match(/^([^,]+),\\s*([^,]+),\\s*\"?([^\"]+)\"?/);\r\n if (match) {\r\n apps.push({\r\n bundleId: match[1].trim(),\r\n version: match[2].trim(),\r\n displayName: match[3].trim(),\r\n bundleVersion: \"\",\r\n });\r\n }\r\n }\r\n\r\n return apps;\r\n}", "import type { ActivationState } from \"@/types\";\r\nimport { logTask } from \"@/utils/debug\";\r\nimport { runIDeviceTool } from \"./device\";\r\n\r\nexport async function getActivationState(udid: string): Promise<ActivationState> {\r\n\tlogTask(`Getting activation state for device ${udid}`);\r\n\r\n\ttry {\r\n\t\tconst result = await runIDeviceTool(\"ideviceinfo\", [\"-u\", udid, \"-k\", \"ActivationState\"]);\r\n\t\tif (!result) {\r\n\t\t\treturn {\r\n\t\t\t\tisActivated: false,\r\n\t\t\t\tactivationState: \"Unknown\",\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tconst { stdout } = result;\r\n\t\tconst state = stdout.trim();\r\n\r\n\t\treturn {\r\n\t\t\tisActivated: state === \"Activated\",\r\n\t\t\tactivationState: state,\r\n\t\t};\r\n\t} catch {\r\n\t\treturn {\r\n\t\t\tisActivated: false,\r\n\t\t\tactivationState: \"Unknown\",\r\n\t\t};\r\n\t}\r\n}\r\n\r\nexport async function activate(udid: string): Promise<boolean> {\r\n\tlogTask(`Activating device ${udid}`);\r\n\r\n\ttry {\r\n\t\tconst result = await runIDeviceTool(\"ideviceactivation\", [\"-u\", udid, \"activate\"]);\r\n\t\tif (!result) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn (\r\n\t\t\tresult.stdout.toLowerCase().includes(\"success\") ||\r\n\t\t\tresult.stdout.toLowerCase().includes(\"activated\")\r\n\t\t);\r\n\t} catch (error) {\r\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\r\n\t\tthrow new Error(`Activation failed: ${errorMsg}`);\r\n\t}\r\n}\r\n\r\nexport interface ApplicationConfig {\r\n\tname: string;\r\n\tbundleId: string;\r\n\tversion: string;\r\n\tbuild: string;\r\n\ticon: string;\r\n\ticonData: Buffer;\r\n}\r\n", "import { logInfo, logTask } from \"@/utils/debug\";\r\nimport { runIDeviceTool } from \"./device\";\r\n\r\n\r\nexport async function isPaired(udid: string): Promise<boolean> {\r\n logTask(`Checking pairing status for ${udid}`);\r\n\r\n try {\r\n const result = await runIDeviceTool(\"idevicepair\", [\r\n \"-u\",\r\n udid,\r\n \"validate\",\r\n ]);\r\n if (!result) {\r\n return false;\r\n }\r\n\r\n return result.stdout.toLowerCase().includes(\"success\");\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\nexport async function trustDevice(udid: string, timeout = 60000, onWaitingForTrust?: () => void): Promise<boolean> {\r\n logTask(`Trusting device ${udid}`);\r\n\r\n // Check if already paired\r\n if (await isPaired(udid)) {\r\n logInfo(`Device ${udid} is already trusted`);\r\n return true;\r\n }\r\n\r\n // Initiate pairing - this shows the trust dialog on the device\r\n logInfo(`Initiating pairing for device ${udid}`);\r\n const pairResult = await pair(udid);\r\n\r\n if (pairResult) {\r\n logInfo(`Device ${udid} paired successfully`);\r\n return true;\r\n }\r\n\r\n // Pairing initiated but user needs to accept on device\r\n logInfo(\"Please accept the trust dialog on the device...\");\r\n onWaitingForTrust?.();\r\n\r\n // Wait for user to accept\r\n try {\r\n await waitForPairing(udid, timeout, 1000);\r\n logInfo(`Device ${udid} is now trusted`);\r\n return true;\r\n } catch {\r\n logInfo(`Timeout waiting for trust acceptance on device ${udid}`);\r\n return false;\r\n }\r\n}\r\n\r\nexport async function waitForPairing(udid: string, timeout = 120000, pollInterval = 1000): Promise<boolean> {\r\n logTask(`Waiting for pairing on device ${udid}`);\r\n\r\n const startTime = Date.now();\r\n\r\n while (Date.now() - startTime < timeout) {\r\n if (await isPaired(udid)) {\r\n logInfo(`Device ${udid} is now paired`);\r\n return true;\r\n }\r\n\r\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\r\n }\r\n\r\n throw new Error(`Timeout waiting for device pairing after ${timeout}ms`);\r\n}\r\n\r\nexport async function pair(udid: string): Promise<boolean> {\r\n logTask(`Initiating pairing for device ${udid}`);\r\n\r\n try {\r\n const result = await runIDeviceTool(\"idevicepair\", [\"-u\", udid, \"pair\"]);\r\n if (!result) {\r\n return false;\r\n }\r\n\r\n return result.stdout.toLowerCase().includes(\"success\");\r\n } catch (error) {\r\n const errorMsg = error instanceof Error ? error.message : String(error);\r\n if (errorMsg.includes(\"Please accept the trust dialog\")) {\r\n // Pairing dialog shown on device\r\n return false;\r\n }\r\n throw error;\r\n }\r\n}\r\n\r\nexport async function unpair(udid: string): Promise<boolean> {\r\n logTask(`Un-pairing device ${udid}`);\r\n\r\n try {\r\n const result = await runIDeviceTool(\"idevicepair\", [\r\n \"-u\",\r\n udid,\r\n \"unpair\",\r\n ]);\r\n if (!result) {\r\n return false;\r\n }\r\n\r\n return result.stdout.toLowerCase().includes(\"success\");\r\n } catch {\r\n return false;\r\n }\r\n}", "import type { AppInfo } from \"@/types\";\r\nimport { logInfo, logTask } from \"@/utils/debug\";\r\nimport { parseAppList } from \"../dataParser\";\r\nimport { runIDeviceTool } from \"./device\";\r\nimport { isPaired, waitForPairing } from \"./pair\";\r\n\r\nexport async function installApp(ipaPath: string, udid: string): Promise<void> {\r\n\tlogTask(`Installing app ${ipaPath} on device ${udid}`);\r\n\r\n\tif (!(await isPaired(udid))) {\r\n\t\tawait waitForPairing(udid, 10000);\r\n\t}\r\n\r\n\tawait runIDeviceTool(\"ideviceinstaller\", [\"-u\", udid, \"-i\", ipaPath]);\r\n}\r\n\r\nexport async function uninstallApp(bundleId: string, udid: string): Promise<void> {\r\n\tlogTask(`Uninstalling app ${bundleId} from device ${udid}`);\r\n\r\n\tif (!(await isPaired(udid))) {\r\n\t\tawait waitForPairing(udid, 10000);\r\n\t}\r\n\r\n\tawait runIDeviceTool(\"ideviceinstaller\", [\"-u\", udid, \"-U\", bundleId]);\r\n}\r\n\r\nexport async function listApps(udid: string): Promise<AppInfo[]> {\r\n\tlogTask(`Listing apps on device ${udid}`);\r\n\r\n\tif (!(await isPaired(udid))) {\r\n\t\tawait waitForPairing(udid, 10000);\r\n\t}\r\n\r\n\ttry {\r\n\t\tconst result = await runIDeviceTool(\"ideviceinstaller\", [\"-u\", udid, \"-l\"]);\r\n\t\tif (!result) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\tconst { stdout } = result;\r\n\t\treturn parseAppList(stdout);\r\n\t} catch {\r\n\t\treturn [];\r\n\t}\r\n}\r\n\r\nexport async function isAppInstalled(bundleId: string, udid: string): Promise<boolean> {\r\n\tlogTask(`Checking if app ${bundleId} is installed on device ${udid}`);\r\n\r\n\tconst apps = await listApps(udid);\r\n\treturn apps.some((app) => app.bundleId === bundleId);\r\n}\r\n\r\nexport async function wakeDevice(udid: string): Promise<void> {\r\n\ttry {\r\n\t\tlogInfo(\"Attempting to wake device screen...\");\r\n\r\n\t\t// Try multiple methods to wake the device\r\n\t\t// Method 1: Query device info (wakes some devices)\r\n\t\tawait runIDeviceTool(\"ideviceinfo\", [\"-u\", udid, \"-k\", \"DeviceName\"]);\r\n\r\n\t\t// Method 2: Try to get activation state (another wake trigger)\r\n\t\ttry {\r\n\t\t\tawait runIDeviceTool(\"ideviceinfo\", [\"-u\", udid, \"-k\", \"ActivationState\"]);\r\n\t\t} catch {\r\n\t\t\t// Ignore\r\n\t\t}\r\n\r\n\t\t// Method 3: Try to validate pairing (another interaction that might wake)\r\n\t\ttry {\r\n\t\t\tawait runIDeviceTool(\"idevicepair\", [\"-u\", udid, \"validate\"]);\r\n\t\t} catch {\r\n\t\t\t// Ignore\r\n\t\t}\r\n\r\n\t\t// Longer delay to let screen wake and stabilize\r\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\r\n\r\n\t\tlogInfo(\"Device wake attempt completed\");\r\n\t} catch (error) {\r\n\t\t// Log but don't fail - waking is best effort\r\n\t\tlogInfo(\r\n\t\t\t`Device wake attempt failed (non-critical): ${error instanceof Error ? error.message : String(error)}`\r\n\t\t);\r\n\t}\r\n}\r\n\r\nexport async function launchApp(bundleId: string, args: string[], udid: string): Promise<void> {\r\n\tlogTask(`Launching app ${bundleId} on device ${udid}`);\r\n\r\n\tif (!(await isPaired(udid))) {\r\n\t\tawait waitForPairing(udid, 10000);\r\n\t}\r\n\r\n\t// Wake device screen first to ensure app appears\r\n\tawait wakeDevice(udid);\r\n\r\n\t// Try idevicedebug first (works for iOS 16 and earlier)\r\n\ttry {\r\n\t\tlogInfo(`Attempting to launch ${bundleId} using idevicedebug...`);\r\n\t\tconst result = await runIDeviceTool(\"idevicedebug\", [\"-u\", udid, \"run\", bundleId, ...args]);\r\n\t\tconst output = (result?.stdout ?? \"\") + (result?.stderr ?? \"\");\r\n\r\n\t\t// Log output for debugging\r\n\t\tif (output.trim()) {\r\n\t\t\tlogInfo(`idevicedebug output: ${output.substring(0, 200)}`);\r\n\t\t}\r\n\r\n\t\t// Check if it failed due to missing debugserver\r\n\t\tif (\r\n\t\t\toutput.toLowerCase().includes(\"could not start\") &&\r\n\t\t\toutput.toLowerCase().includes(\"debugserver\")\r\n\t\t) {\r\n\t\t\tlogInfo(\"idevicedebug requires debugserver, falling back to pymobiledevice3...\");\r\n\t\t\tthrow new Error(\"debugserver_not_available\");\r\n\t\t}\r\n\r\n\t\t// Success - app should be launched\r\n\t\tlogInfo(`App ${bundleId} launched successfully using idevicedebug`);\r\n\r\n\t\t// Additional delay to ensure app appears\r\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\r\n\t\treturn;\r\n\t} catch (error) {\r\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\r\n\r\n\t\t// If debugserver is not available, try pymobiledevice3 (iOS 17+)\r\n\t\tif (\r\n\t\t\terrorMsg.includes(\"debugserver_not_available\") ||\r\n\t\t\terrorMsg.toLowerCase().includes(\"could not start\") ||\r\n\t\t\terrorMsg.toLowerCase().includes(\"debugserver\")\r\n\t\t) {\r\n\t\t\tlogInfo(\"idevicedebug failed, trying pymobiledevice3 for iOS 17+...\");\r\n\t\t\tawait launchAppWithPymobiledevice3(bundleId, args, udid);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Re-throw other errors\r\n\t\tthrow error;\r\n\t}\r\n}\r\n\r\nexport async function launchAppWithPymobiledevice3(\r\n\tbundleId: string,\r\n\targs: string[],\r\n\tudid: string\r\n): Promise<void> {\r\n\tlogTask(`Launching app ${bundleId} using pymobiledevice3`);\r\n\r\n\tconst { exec } = await import(\"node:child_process\");\r\n\tconst { promisify } = await import(\"node:util\");\r\n\tconst execAsync = promisify(exec);\r\n\r\n\ttry {\r\n\t\t// Build command: python -m pymobiledevice3 developer dvt launch --udid <UDID> --tunnel \"\" --kill-existing <bundle-id> [args...]\r\n\t\t// Use --tunnel \"\" to auto-detect/create tunnel for iOS 17+\r\n\t\t// Use --kill-existing to ensure app comes to foreground\r\n\t\t// Use python -m to avoid PATH issues\r\n\t\t// Try without tunnel first (works for some iOS versions)\r\n\t\t// If that fails, we'll try with tunnel\r\n\t\tlet cmdArgs = [\r\n\t\t\t\"-m\",\r\n\t\t\t\"pymobiledevice3\",\r\n\t\t\t\"developer\",\r\n\t\t\t\"dvt\",\r\n\t\t\t\"launch\",\r\n\t\t\t\"--udid\",\r\n\t\t\tudid,\r\n\t\t\t\"--kill-existing\", // Kill existing instance to bring app to foreground\r\n\t\t\tbundleId,\r\n\t\t\t...args,\r\n\t\t];\r\n\r\n\t\tlet command = `python ${cmdArgs.map((a) => `\"${a}\"`).join(\" \")}`;\r\n\r\n\t\tlogInfo(`Executing: ${command}`);\r\n\r\n\t\tconst result = await execAsync(command, {\r\n\t\t\twindowsHide: true,\r\n\t\t\tencoding: \"utf8\",\r\n\t\t\ttimeout: 30000, // 30 second timeout\r\n\t\t});\r\n\r\n\t\tconst output = result.stdout.toString() + result.stderr.toString();\r\n\r\n\t\t// Log output for debugging\r\n\t\tif (output.trim()) {\r\n\t\t\tlogInfo(`pymobiledevice3 output: ${output.substring(0, 200)}`);\r\n\t\t}\r\n\r\n\t\t// Check for common errors\r\n\t\tif (\r\n\t\t\toutput.toLowerCase().includes(\"developer mode\") &&\r\n\t\t\toutput.toLowerCase().includes(\"not enabled\")\r\n\t\t) {\r\n\t\t\tthrow new Error(\r\n\t\t\t\t\"Developer Mode is not enabled on the device.\\n\" +\r\n\t\t\t\t\t\"Please enable it: Settings \u2192 Privacy & Security \u2192 Developer Mode \u2192 Enable\"\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t// If tunnel error, try again with tunnel option\r\n\t\tif (\r\n\t\t\toutput.toLowerCase().includes(\"tunneld\") &&\r\n\t\t\t(output.toLowerCase().includes(\"unable to connect\") ||\r\n\t\t\t\toutput.toLowerCase().includes(\"invalidserviceerror\"))\r\n\t\t) {\r\n\t\t\tlogInfo(\"Tunnel required, retrying with tunnel option...\");\r\n\r\n\t\t\t// Retry with tunnel\r\n\t\t\tcmdArgs = [\r\n\t\t\t\t\"-m\",\r\n\t\t\t\t\"pymobiledevice3\",\r\n\t\t\t\t\"developer\",\r\n\t\t\t\t\"dvt\",\r\n\t\t\t\t\"launch\",\r\n\t\t\t\t\"--udid\",\r\n\t\t\t\tudid,\r\n\t\t\t\t\"--tunnel\",\r\n\t\t\t\tudid, // Use UDID for tunnel\r\n\t\t\t\t\"--kill-existing\",\r\n\t\t\t\tbundleId,\r\n\t\t\t\t...args,\r\n\t\t\t];\r\n\r\n\t\t\tcommand = `python ${cmdArgs.map((a) => `\"${a}\"`).join(\" \")}`;\r\n\t\t\tlogInfo(`Retrying with tunnel: ${command}`);\r\n\r\n\t\t\ttry {\r\n\t\t\t\tconst retryResult = await execAsync(command, {\r\n\t\t\t\t\twindowsHide: true,\r\n\t\t\t\t\tencoding: \"utf8\",\r\n\t\t\t\t\ttimeout: 30000,\r\n\t\t\t\t});\r\n\r\n\t\t\t\tconst retryOutput = retryResult.stdout.toString() + retryResult.stderr.toString();\r\n\t\t\t\tif (retryOutput.trim()) {\r\n\t\t\t\t\tlogInfo(`pymobiledevice3 retry output: ${retryOutput.substring(0, 200)}`);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check if still failing\r\n\t\t\t\tif (\r\n\t\t\t\t\tretryOutput.toLowerCase().includes(\"tunneld\") &&\r\n\t\t\t\t\tretryOutput.toLowerCase().includes(\"unable to connect\")\r\n\t\t\t\t) {\r\n\t\t\t\t\tthrow new Error(\r\n\t\t\t\t\t\t\"Tunnel connection failed. For iOS 17+, you may need to start tunneld:\\n\" +\r\n\t\t\t\t\t\t\t\" python -m pymobiledevice3 remote tunneld\\n\" +\r\n\t\t\t\t\t\t\t\"Or ensure Developer Mode is enabled and device is unlocked.\"\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Success on retry\r\n\t\t\t\tlogInfo(`App ${bundleId} launched successfully using pymobiledevice3 with tunnel`);\r\n\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, 500));\r\n\t\t\t\treturn;\r\n\t\t\t} catch {\r\n\t\t\t\t// If retry also fails, throw the original tunnel error\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t\"Tunnel connection failed. For iOS 17+, you may need to start tunneld:\\n\" +\r\n\t\t\t\t\t\t\" python -m pymobiledevice3 remote tunneld\\n\" +\r\n\t\t\t\t\t\t\"Or ensure Developer Mode is enabled and device is unlocked.\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\toutput.toLowerCase().includes(\"not found\") ||\r\n\t\t\toutput.toLowerCase().includes(\"command not found\") ||\r\n\t\t\toutput.toLowerCase().includes(\"cannot find\")\r\n\t\t) {\r\n\t\t\tthrow new Error(\r\n\t\t\t\t\"pymobiledevice3 is not installed.\\n\" +\r\n\t\t\t\t\t\"Install it with: python -m pip install --user pymobiledevice3\"\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\t// Check if there are any errors in output\r\n\t\tif (output.toLowerCase().includes(\"error\") && !output.toLowerCase().includes(\"warning\")) {\r\n\t\t\t// Some errors might be non-fatal, but log them\r\n\t\t\tlogInfo(`Warning: pymobiledevice3 reported errors: ${output.substring(0, 300)}`);\r\n\t\t}\r\n\r\n\t\tlogInfo(`App ${bundleId} launched successfully using pymobiledevice3`);\r\n\r\n\t\t// Longer delay to ensure app appears on screen and device wakes\r\n\t\tawait new Promise((resolve) => setTimeout(resolve, 1000));\r\n\t} catch (error) {\r\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\r\n\r\n\t\t// Check if it's a command not found error\r\n\t\tif (\r\n\t\t\terrorMsg.includes(\"not found\") ||\r\n\t\t\terrorMsg.includes(\"command not found\") ||\r\n\t\t\terrorMsg.includes(\"cannot find\") ||\r\n\t\t\terrorMsg.includes(\"No module named\")\r\n\t\t) {\r\n\t\t\tthrow new Error(\r\n\t\t\t\t\"pymobiledevice3 is not installed or Python is not available.\\n\" +\r\n\t\t\t\t\t\"Install it with: python -m pip install --user pymobiledevice3\\n\" +\r\n\t\t\t\t\t\"For iOS 17+, Developer Mode must also be enabled on the device.\"\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthrow error;\r\n\t}\r\n}\r\n", "import type { PortForwardResult } from \"@/types\";\r\nimport { logTask } from \"@/utils/debug\";\r\nimport { runIDeviceTool } from \"./device\";\r\n\r\nasync function startPortForward(\r\n\tlocalPort: number,\r\n\tdevicePort: number,\r\n\tudid: string\r\n): Promise<PortForwardResult> {\r\n\tlogTask(`Starting port forward ${localPort} -> ${devicePort} for device ${udid}`);\r\n\r\n\tconst result = await runIDeviceTool(\"iproxy\", [\r\n\t\tlocalPort.toString(),\r\n\t\tdevicePort.toString(),\r\n\t\t\"-u\",\r\n\t\tudid,\r\n\t]);\r\n\r\n\treturn {\r\n\t\tlocalPort,\r\n\t\tdevicePort,\r\n\t\t...result,\r\n\t};\r\n}\r\n\r\nexport async function startPortForwardAsync(\r\n\tlocalPort: number,\r\n\tdevicePort: number,\r\n\tudid: string,\r\n\t_timeout = 5000\r\n): Promise<PortForwardResult> {\r\n\tconst result = await startPortForward(localPort, devicePort, udid);\r\n\r\n\t// Give iproxy a moment to start\r\n\tawait new Promise((resolve) => setTimeout(resolve, 500));\r\n\r\n\t// Check if process is still running\r\n\tif (result.stdout.includes(\"error\") || result.stderr.includes(\"error\")) {\r\n\t\tthrow new Error(\"Port forwarding failed to start\");\r\n\t}\r\n\r\n\treturn result;\r\n}\r\n", "import type { ActivationState, AppInfo, PortForwardResult, iOSDeviceInfo } from \"../types\";\r\nimport { logInfo } from \"../utils/debug\";\r\nimport { activate, getActivationState } from \"./actions/activation\";\r\nimport { getDeviceInfo } from \"./actions/device\";\r\nimport { installApp, isAppInstalled, launchApp, listApps, uninstallApp } from \"./actions/install\";\r\nimport { isPaired, pair, trustDevice, unpair, waitForPairing } from \"./actions/pair\";\r\nimport { startPortForwardAsync } from \"./actions/proxy\";\r\n\r\n/**\r\n * AppleDeviceKit - iOS device operations wrapper\r\n *\r\n * Uses idevice command-line tools for iOS device operations.\r\n * Each instance is associated with a specific device by UDID.\r\n */\r\nexport class AppleDeviceKit {\r\n\tprivate deviceId: string;\r\n\r\n\tconstructor(\r\n\t\tudid: string,\r\n\t\tprivate readonly port: number\r\n\t) {\r\n\t\tthis.deviceId = udid;\r\n\t\tlogInfo(`AppleDeviceKit initialized for device: ${this.deviceId}`);\r\n\t}\r\n\r\n\t/**\r\n\t * Get detailed device information\r\n\t */\r\n\tpublic async getDeviceInfo(): Promise<iOSDeviceInfo> {\r\n\t\treturn getDeviceInfo(this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Check if device is paired/trusted with this computer\r\n\t */\r\n\tpublic async isPaired(): Promise<boolean> {\r\n\t\treturn isPaired(this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Wait for device to be paired\r\n\t * Polls the pairing status until successful or timeout\r\n\t *\r\n\t * @param timeout Timeout in milliseconds (default: 120000)\r\n\t * @param pollInterval Poll interval in milliseconds (default: 1000)\r\n\t */\r\n\tpublic async waitForPairing(timeout = 120000, pollInterval = 1000): Promise<boolean> {\r\n\t\treturn waitForPairing(this.deviceId, timeout, pollInterval);\r\n\t}\r\n\r\n\t/**\r\n\t * Attempt to pair/trust the device\r\n\t * User must accept the trust dialog on the device\r\n\t */\r\n\tpublic async pair(): Promise<boolean> {\r\n\t\treturn pair(this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Trust/pair the device - initiates pairing and waits for user to accept\r\n\t *\r\n\t * This is the recommended method for establishing trust with a device.\r\n\t * It will:\r\n\t * 1. Check if already paired\r\n\t * 2. If not, initiate pairing (shows \"Trust This Computer?\" on device)\r\n\t * 3. Wait for user to accept the trust dialog\r\n\t *\r\n\t * @param timeout Timeout in milliseconds to wait for user acceptance (default: 60000)\r\n\t * @param onWaitingForTrust Callback when waiting for user to accept trust dialog\r\n\t * @returns true if device is now trusted\r\n\t */\r\n\tpublic async trustDevice(timeout = 60000, onWaitingForTrust?: () => void): Promise<boolean> {\r\n\t\treturn trustDevice(this.deviceId, timeout, onWaitingForTrust);\r\n\t}\r\n\r\n\t/**\r\n\t * Unpair/untrust the device\r\n\t */\r\n\tpublic async unpair(): Promise<boolean> {\r\n\t\treturn unpair(this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Install an IPA file on the device (install agent)\r\n\t *\r\n\t * @param ipaPath Path to the IPA file\r\n\t */\r\n\tpublic async installApp(ipaPath: string): Promise<void> {\r\n\t\tinstallApp(ipaPath, this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Uninstall an app by bundle ID (uninstall agent)\r\n\t *\r\n\t * @param bundleId Application bundle identifier\r\n\t */\r\n\tpublic async uninstallApp(bundleId: string): Promise<void> {\r\n\t\tuninstallApp(bundleId, this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Check if an app is installed on the device\r\n\t *\r\n\t * @param bundleId Application bundle identifier\r\n\t */\r\n\tpublic async isAppInstalled(bundleId: string): Promise<boolean> {\r\n\t\treturn isAppInstalled(bundleId, this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * List all installed user applications\r\n\t */\r\n\tpublic async listApps(): Promise<AppInfo[]> {\r\n\t\treturn listApps(this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Launch an application on the device\r\n\t *\r\n\t * @param bundleId Application bundle identifier\r\n\t * @param args Application arguments\r\n\t */\r\n\tpublic async launchApp(bundleId: string, args: string[] = []): Promise<void> {\r\n\t\treturn launchApp(bundleId, args, this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Start port forwarding and wait for it to be ready.\r\n\t * we need port forwarding to be able to connect to the device from the computer\r\n\t * and communicate with it using the local port.\r\n\t *\r\n\t * @param localPort Local port to listen on\r\n\t * @param devicePort Device port to forward to\r\n\t * @param _timeout Timeout in milliseconds (reserved for future use)\r\n\t */\r\n\tpublic async startPortForwardAsync(\r\n\t\tlocalPort: number,\r\n\t\tdevicePort: number,\r\n\t\t_timeout = 5000\r\n\t): Promise<PortForwardResult> {\r\n\t\treturn startPortForwardAsync(localPort, devicePort, this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Get the activation state of the device\r\n\t */\r\n\tpublic async getActivationState(): Promise<ActivationState> {\r\n\t\treturn getActivationState(this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Activate the device (register in apple servers), an activated device belongs to someone (a user/company).\r\n\t * A device that is on hello screen cannot pass the wifi step unless it is activated.\r\n\t * the activate save us the need of the device to be connected to the internet to do the activation\r\n\t * and register in apple servers.\r\n\t *\r\n\t * Note: This requires a valid activation record or Apple server access\r\n\t *\r\n\t * precondition: the device must be paired and trusted\r\n\t */\r\n\tpublic async activate(): Promise<boolean> {\r\n\t\treturn activate(this.deviceId);\r\n\t}\r\n\r\n\t/**\r\n\t * Get the device UDID\r\n\t */\r\n\tpublic getDeviceId(): string {\r\n\t\treturn this.deviceId;\r\n\t}\r\n\r\n\t/**\r\n\t * Get the logical port number\r\n\t */\r\n\tpublic getPort(): number {\r\n\t\treturn this.port;\r\n\t}\r\n}\r\n", "import EventEmitter from \"node:events\";\r\nimport usbDeviceListener from \"@mcesystems/usb-device-listener\";\r\nimport type { DeviceInfo, ListenerConfig } from \"@mcesystems/usb-device-listener\";\r\nimport type { AppleListenerConfig } from \"../types\";\r\nimport { logInfo } from \"../utils/debug\";\r\nimport { listDevices } from \"./actions/device\";\r\nimport { AppleDeviceKit } from \"./appleDeviceKit\";\r\n\r\n// Apple vendor ID\r\nconst APPLE_VID = 0x05ac;\r\n\r\n/**\r\n * DevicesMonitor - Monitor iOS device connections via USB\r\n *\r\n * Uses usb-device-listener for plug-and-play detection and filters\r\n * for Apple devices (VID 0x05AC).\r\n */\r\nexport class DevicesMonitor {\r\n\tprivate kits: Map<string, AppleDeviceKit> = new Map();\r\n\tprivate eventEmitter?: EventEmitter;\r\n\r\n\tconstructor(\r\n\t\tprivate config: AppleListenerConfig = {},\r\n\t\tprivate identifyAlreadyConnected = false\r\n\t) {}\r\n\r\n\t/**\r\n\t * Start tracking iOS device connections\r\n\t *\r\n\t * @returns EventEmitter that emits:\r\n\t * - 'added': (deviceKit: AppleDeviceKit) when a device is connected\r\n\t * - 'removed': (deviceId: string, port: number) when a device is disconnected\r\n\t */\r\n\tpublic async startTracking(): Promise<EventEmitter> {\r\n\t\tlogInfo(\"Starting iOS devices monitor\");\r\n\r\n\t\t// Build listener config with Apple device filter\r\n\t\tconst listenerConfig: ListenerConfig = {\r\n\t\t\tlogicalPortMap: this.config.logicalPortMap,\r\n\t\t\t// Filter for Apple devices only\r\n\t\t\tlistenOnlyDevices: [{ vid: APPLE_VID.toString(16).toUpperCase().padStart(4, \"0\"), pid: \"\" }],\r\n\t\t};\r\n\r\n\t\tusbDeviceListener.startListening(listenerConfig);\r\n\t\tthis.eventEmitter = new EventEmitter();\r\n\r\n\t\tif (this.identifyAlreadyConnected || this.config.identifyAlreadyConnected) {\r\n\t\t\tawait this.identifyConnectedDevices();\r\n\t\t}\r\n\r\n\t\tusbDeviceListener.onDeviceAdd((device: DeviceInfo) => {\r\n\t\t\t// Check if this is an Apple device\r\n\t\t\tif (device.vid !== APPLE_VID) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tlogInfo(`Apple device connected: ${device.deviceId}`);\r\n\r\n\t\t\t// Get the UDID by querying connected iOS devices\r\n\t\t\tthis.findAndEmitDevice(device);\r\n\t\t});\r\n\r\n\t\tusbDeviceListener.onDeviceRemove((device: DeviceInfo) => {\r\n\t\t\t// Check if this is an Apple device\r\n\t\t\tif (device.vid !== APPLE_VID) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tlogInfo(`Apple device disconnected: ${device.deviceId}`);\r\n\r\n\t\t\t// Find and remove the kit by location\r\n\t\t\tfor (const [udid, kit] of this.kits.entries()) {\r\n\t\t\t\tif (kit.getPort() === device.logicalPort) {\r\n\t\t\t\t\tthis.kits.delete(udid);\r\n\t\t\t\t\tthis.eventEmitter?.emit(\"removed\", udid, device.logicalPort);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn this.eventEmitter;\r\n\t}\r\n\r\n\t/**\r\n\t * Stop tracking device connections\r\n\t */\r\n\tpublic async stopTracking(): Promise<void> {\r\n\t\tif (!this.eventEmitter) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tlogInfo(\"Stopping iOS devices monitor\");\r\n\t\tthis.eventEmitter.removeAllListeners();\r\n\t\tthis.kits.clear();\r\n\t\tthis.eventEmitter = undefined;\r\n\t\tusbDeviceListener.stopListening();\r\n\t}\r\n\r\n\t/**\r\n\t * Get all currently tracked device kits\r\n\t */\r\n\tpublic getKits(): Map<string, AppleDeviceKit> {\r\n\t\treturn new Map(this.kits);\r\n\t}\r\n\r\n\t/**\r\n\t * Get a specific device kit by UDID\r\n\t */\r\n\tpublic getKit(udid: string): AppleDeviceKit | undefined {\r\n\t\treturn this.kits.get(udid);\r\n\t}\r\n\r\n\t/**\r\n\t * Find connected iOS device and emit event\r\n\t */\r\n\tprivate async findAndEmitDevice(usbDevice: DeviceInfo): Promise<void> {\r\n\t\t// Query libimobiledevice for connected iOS devices\r\n\t\tconst iOSDevices = await listDevices();\r\n\r\n\t\tif (iOSDevices.length === 0) {\r\n\t\t\t// Device might not be ready yet, retry after a short delay\r\n\t\t\tsetTimeout(() => this.findAndEmitDevice(usbDevice), 500);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// For now, match by order of appearance\r\n\t\t// In a production scenario, you might want to correlate by additional means\r\n\t\tfor (const iDevice of iOSDevices) {\r\n\t\t\tif (this.kits.has(iDevice.udid)) {\r\n\t\t\t\tcontinue; // Already tracking this device\r\n\t\t\t}\r\n\r\n\t\t\tconst port = usbDevice.logicalPort ?? 0;\r\n\t\t\tconst kit = new AppleDeviceKit(iDevice.udid, port);\r\n\t\t\tthis.kits.set(iDevice.udid, kit);\r\n\r\n\t\t\t// Emit after a short delay to allow device to settle\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.eventEmitter?.emit(\"added\", kit);\r\n\t\t\t}, 0);\r\n\r\n\t\t\tbreak; // Only match one device per USB event\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Identify already connected iOS devices\r\n\t */\r\n\tprivate async identifyConnectedDevices(): Promise<void> {\r\n\t\tlogInfo(\"Identifying already connected iOS devices\");\r\n\r\n\t\tconst iOSDevices = await listDevices();\r\n\t\tconst usbDevices = usbDeviceListener.listDevices().filter((d) => d.vid === APPLE_VID);\r\n\r\n\t\tfor (let i = 0; i < iOSDevices.length; i++) {\r\n\t\t\tconst iDevice = iOSDevices[i];\r\n\t\t\tconst usbDevice = usbDevices[i];\r\n\r\n\t\t\tif (this.kits.has(iDevice.udid)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tconst port = usbDevice?.logicalPort ?? 0;\r\n\t\t\tconst kit = new AppleDeviceKit(iDevice.udid, port);\r\n\t\t\tthis.kits.set(iDevice.udid, kit);\r\n\r\n\t\t\t// Emit events asynchronously\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.eventEmitter?.emit(\"added\", kit);\r\n\t\t\t}, 0);\r\n\t\t}\r\n\t}\r\n}\r\n"],
5
+ "mappings": ";AAAA,OAAO,iBAAiB;AAExB,IAAM,QAAQ,YAAY,WAAW;AACrC,IAAM,YAAY,YAAY,gBAAgB;AAC9C,IAAM,eAAe,YAAY,mBAAmB;AACpD,IAAM,aAAa,YAAY,iBAAiB;AAKzC,SAAS,QAAQ,SAAuB;AAC9C,QAAM,OAAO;AACd;AAKO,SAAS,QAAQ,SAAuB;AAC9C,YAAU,OAAO;AAClB;;;ACnBA,SAA2B,QAAQ,oBAAoB;AACvD,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,iBAAiB;;;ACMnB,SAAS,iBAAiB,QAAwC;AACrE,QAAM,SAAiC,CAAC;AACxC,QAAM,QAAQ,OAAO,MAAM,IAAI;AAE/B,aAAW,QAAQ,OAAO;AACtB,UAAM,aAAa,KAAK,QAAQ,GAAG;AACnC,QAAI,aAAa,GAAG;AAChB,YAAM,MAAM,KAAK,UAAU,GAAG,UAAU,EAAE,KAAK;AAC/C,YAAM,QAAQ,KAAK,UAAU,aAAa,CAAC,EAAE,KAAK;AAClD,aAAO,GAAG,IAAI;A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ple-kit
3
3
  *
4
- * iOS device management toolkit using libimobiledevice.
5
- * Provides device detection, app installation/uninstallation,
6
- * and device property access through native N-API bindings.
4
+ * iOS device management toolkit using libimobiledevice command-line tools.
5
+ * Provides device detection, app installation/uninstallation, port forwarding,
6
+ * activation, and device property access.
7
+ *
8
+ * NOTE: On Windows, iTunes must be running for device communication to work.
7
9
  */
8
10
  export { AppleDeviceKit } from "./logic/appleDeviceKit";
9
11
  export { DevicesMonitor } from "./logic/devicesMonitor";
12
+ export { ActivationState } from "./types";
10
13
  export type { AppInfo, AppleListenerConfig, DeviceListEntry, iOSDeviceInfo, } from "./types";
11
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EACX,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,aAAa,GACb,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EACX,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,aAAa,GACb,MAAM,SAAS,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ActivationState } from "@/types";
2
+ export declare function getActivationState(udid: string): Promise<ActivationState>;
3
+ export declare function activate(udid: string): Promise<boolean>;
4
+ export interface ApplicationConfig {
5
+ name: string;
6
+ bundleId: string;
7
+ version: string;
8
+ build: string;
9
+ icon: string;
10
+ iconData: Buffer;
11
+ }
12
+ //# sourceMappingURL=activation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../../../../src/logic/actions/activation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI/C,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAyB/E;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiB7D;AAED,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,27 @@
1
+ import { type ExecOptions } from "node:child_process";
2
+ import type { AppleToolType, DeviceListEntry } from "@/types";
3
+ import type { iOSDeviceInfo } from "@/types";
4
+ export interface ExecResult {
5
+ stdout: string;
6
+ stderr: string;
7
+ }
8
+ export declare function getDeviceInfo(udid: string): Promise<iOSDeviceInfo>;
9
+ export declare function listDevices(): Promise<DeviceListEntry[]>;
10
+ /**
11
+ * Execute an idevice tool command
12
+ */
13
+ export declare function runIDeviceTool(toolName: AppleToolType, args?: string[], options?: ExecOptions): Promise<ExecResult>;
14
+ /**
15
+ * Get paths to all required idevice tools
16
+ */
17
+ export declare function getIDeviceTools(): {
18
+ idevice_id: string | null;
19
+ ideviceinfo: string | null;
20
+ ideviceinstaller: string | null;
21
+ idevicepair: string | null;
22
+ idevicename: string | null;
23
+ idevicedebug: string | null;
24
+ iproxy: string | null;
25
+ ideviceactivation: string | null;
26
+ };
27
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../src/logic/actions/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,oBAAoB,CAAC;AAI5E,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAM7C,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CA4BxE;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAW9D;AAED;;GAEG;AACH,wBAAsB,cAAc,CACnC,QAAQ,EAAE,aAAa,EACvB,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,WAAgB,GACvB,OAAO,CAAC,UAAU,CAAC,CAGrB;AAqDD;;GAEG;AACH,wBAAgB,eAAe;;;;;;;;;EAW9B"}
@@ -0,0 +1,9 @@
1
+ import type { AppInfo } from "@/types";
2
+ export declare function installApp(ipaPath: string, udid: string): Promise<void>;
3
+ export declare function uninstallApp(bundleId: string, udid: string): Promise<void>;
4
+ export declare function listApps(udid: string): Promise<AppInfo[]>;
5
+ export declare function isAppInstalled(bundleId: string, udid: string): Promise<boolean>;
6
+ export declare function wakeDevice(udid: string): Promise<void>;
7
+ export declare function launchApp(bundleId: string, args: string[], udid: string): Promise<void>;
8
+ export declare function launchAppWithPymobiledevice3(bundleId: string, args: string[], udid: string): Promise<void>;
9
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../src/logic/actions/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMvC,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ7E;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhF;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAkB/D;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAKrF;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC5D;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqD7F;AAED,wBAAsB,4BAA4B,CACjD,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAgKf"}
@@ -0,0 +1,6 @@
1
+ export declare function isPaired(udid: string): Promise<boolean>;
2
+ export declare function trustDevice(udid: string, timeout?: number, onWaitingForTrust?: () => void): Promise<boolean>;
3
+ export declare function waitForPairing(udid: string, timeout?: number, pollInterval?: number): Promise<boolean>;
4
+ export declare function pair(udid: string): Promise<boolean>;
5
+ export declare function unpair(udid: string): Promise<boolean>;
6
+ //# sourceMappingURL=pair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pair.d.ts","sourceRoot":"","sources":["../../../../src/logic/actions/pair.ts"],"names":[],"mappings":"AAIA,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiB7D;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,SAAQ,EAAE,iBAAiB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CA+BjH;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,SAAS,EAAE,YAAY,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAe1G;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBzD;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiB3D"}
@@ -0,0 +1,3 @@
1
+ import type { PortForwardResult } from "@/types";
2
+ export declare function startPortForwardAsync(localPort: number, devicePort: number, udid: string, _timeout?: number): Promise<PortForwardResult>;
3
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/logic/actions/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAyBjD,wBAAsB,qBAAqB,CAC1C,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,SAAO,GACb,OAAO,CAAC,iBAAiB,CAAC,CAY5B"}
@@ -1,4 +1,4 @@
1
- import type { AppInfo, DeviceListEntry, iOSDeviceInfo } from "../types";
1
+ import type { ActivationState, AppInfo, PortForwardResult, iOSDeviceInfo } from "../types";
2
2
  /**
3
3
  * AppleDeviceKit - iOS device operations wrapper
4
4
  *
@@ -31,13 +31,31 @@ export declare class AppleDeviceKit {
31
31
  */
32
32
  pair(): Promise<boolean>;
33
33
  /**
34
- * Install an IPA file on the device
34
+ * Trust/pair the device - initiates pairing and waits for user to accept
35
+ *
36
+ * This is the recommended method for establishing trust with a device.
37
+ * It will:
38
+ * 1. Check if already paired
39
+ * 2. If not, initiate pairing (shows "Trust This Computer?" on device)
40
+ * 3. Wait for user to accept the trust dialog
41
+ *
42
+ * @param timeout Timeout in milliseconds to wait for user acceptance (default: 60000)
43
+ * @param onWaitingForTrust Callback when waiting for user to accept trust dialog
44
+ * @returns true if device is now trusted
45
+ */
46
+ trustDevice(timeout?: number, onWaitingForTrust?: () => void): Promise<boolean>;
47
+ /**
48
+ * Unpair/untrust the device
49
+ */
50
+ unpair(): Promise<boolean>;
51
+ /**
52
+ * Install an IPA file on the device (install agent)
35
53
  *
36
54
  * @param ipaPath Path to the IPA file
37
55
  */
38
56
  installApp(ipaPath: string): Promise<void>;
39
57
  /**
40
- * Uninstall an app by bundle ID
58
+ * Uninstall an app by bundle ID (uninstall agent)
41
59
  *
42
60
  * @param bundleId Application bundle identifier
43
61
  */
@@ -52,6 +70,38 @@ export declare class AppleDeviceKit {
52
70
  * List all installed user applications
53
71
  */
54
72
  listApps(): Promise<AppInfo[]>;
73
+ /**
74
+ * Launch an application on the device
75
+ *
76
+ * @param bundleId Application bundle identifier
77
+ * @param args Application arguments
78
+ */
79
+ launchApp(bundleId: string, args?: string[]): Promise<void>;
80
+ /**
81
+ * Start port forwarding and wait for it to be ready.
82
+ * we need port forwarding to be able to connect to the device from the computer
83
+ * and communicate with it using the local port.
84
+ *
85
+ * @param localPort Local port to listen on
86
+ * @param devicePort Device port to forward to
87
+ * @param _timeout Timeout in milliseconds (reserved for future use)
88
+ */
89
+ startPortForwardAsync(localPort: number, devicePort: number, _timeout?: number): Promise<PortForwardResult>;
90
+ /**
91
+ * Get the activation state of the device
92
+ */
93
+ getActivationState(): Promise<ActivationState>;
94
+ /**
95
+ * Activate the device (register in apple servers), an activated device belongs to someone (a user/company).
96
+ * A device that is on hello screen cannot pass the wifi step unless it is activated.
97
+ * the activate save us the need of the device to be connected to the internet to do the activation
98
+ * and register in apple servers.
99
+ *
100
+ * Note: This requires a valid activation record or Apple server access
101
+ *
102
+ * precondition: the device must be paired and trusted
103
+ */
104
+ activate(): Promise<boolean>;
55
105
  /**
56
106
  * Get the device UDID
57
107
  */
@@ -60,9 +110,5 @@ export declare class AppleDeviceKit {
60
110
  * Get the logical port number
61
111
  */
62
112
  getPort(): number;
63
- /**
64
- * Static method to list all connected iOS devices
65
- */
66
- static listDevices(): Promise<DeviceListEntry[]>;
67
113
  }
68
114
  //# sourceMappingURL=appleDeviceKit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appleDeviceKit.d.ts","sourceRoot":"","sources":["../../../src/logic/appleDeviceKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAuExE;;;;;GAKG;AACH,qBAAa,cAAc;IAKnB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJzB,OAAO,CAAC,QAAQ,CAAS;gBAGrB,IAAI,EAAE,MAAM,EACK,IAAI,EAAE,MAAM;IAMjC;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IA+BpD;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBzC;;;;;;OAMG;IACU,cAAc,CAAC,OAAO,SAAS,EAAE,YAAY,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAiBpF;;;OAGG;IACU,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAqBrC;;;;OAIG;IACU,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAevD;;;;OAIG;IACU,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe1D;;;;OAIG;IACU,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO/D;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAoB3C;;OAEG;IACI,WAAW,IAAI,MAAM;IAI5B;;OAEG;IACI,OAAO,IAAI,MAAM;IAIxB;;OAEG;WACiB,WAAW,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;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OAQG;IACU,qBAAqB,CACjC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,SAAO,GACb,OAAO,CAAC,iBAAiB,CAAC;IAI7B;;OAEG;IACU,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAI3D;;;;;;;;;OASG;IACU,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIzC;;OAEG;IACI,WAAW,IAAI,MAAM;IAI5B;;OAEG;IACI,OAAO,IAAI,MAAM;CAGxB"}
@@ -0,0 +1,23 @@
1
+ import type { AppInfo, DeviceListEntry } from "../types";
2
+ /**
3
+ * Parse plist-style output from ideviceinfo
4
+ *
5
+ * @param output ideviceinfo output
6
+ * @returns Plist output
7
+ */
8
+ export declare function parsePlistOutput(output: string): Record<string, string>;
9
+ /**
10
+ * Parse idevice_id output
11
+ *
12
+ * @param output idevice_id output
13
+ * @returns Device list
14
+ */
15
+ export declare function parseDeviceList(output: string): DeviceListEntry[];
16
+ /**
17
+ * Parse ideviceinstaller list output
18
+ *
19
+ * @param output ideviceinstaller list output
20
+ * @returns App list
21
+ */
22
+ export declare function parseAppList(output: string): AppInfo[];
23
+ //# sourceMappingURL=dataParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataParser.d.ts","sourceRoot":"","sources":["../../../src/logic/dataParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGzD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcvE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,EAAE,CAmBjE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,CAkBtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"devicesMonitor.d.ts","sourceRoot":"","sources":["../../../src/logic/devicesMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD;;;;;GAKG;AACH,qBAAa,cAAc;IAKnB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,wBAAwB;IALpC,OAAO,CAAC,IAAI,CAA0C;IACtD,OAAO,CAAC,YAAY,CAAC,CAAe;gBAGxB,MAAM,GAAE,mBAAwB,EAChC,wBAAwB,UAAQ;IAG5C;;;;;;OAMG;IACU,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC;IAoDnD;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAY1C;;OAEG;IACI,OAAO,IAAI,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC;IAI7C;;OAEG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIvD;;OAEG;YACW,iBAAiB;IA8B/B;;OAEG;YACW,wBAAwB;CAyBzC"}
1
+ {"version":3,"file":"devicesMonitor.d.ts","sourceRoot":"","sources":["../../../src/logic/devicesMonitor.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AAGvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD;;;;;GAKG;AACH,qBAAa,cAAc;IAKzB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,wBAAwB;IALjC,OAAO,CAAC,IAAI,CAA0C;IACtD,OAAO,CAAC,YAAY,CAAC,CAAe;gBAG3B,MAAM,GAAE,mBAAwB,EAChC,wBAAwB,UAAQ;IAGzC;;;;;;OAMG;IACU,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC;IAkDnD;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAY1C;;OAEG;IACI,OAAO,IAAI,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC;IAI7C;;OAEG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIvD;;OAEG;YACW,iBAAiB;IA8B/B;;OAEG;YACW,wBAAwB;CAwBtC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Configuration profile metadata
3
+ */
4
+ export interface ProfileMetadata {
5
+ PayloadIdentifier: string;
6
+ PayloadDisplayName?: string;
7
+ PayloadDescription?: string;
8
+ PayloadType?: string;
9
+ PayloadUUID?: string;
10
+ PayloadVersion?: number;
11
+ }
12
+ /**
13
+ * Install a configuration profile on the device
14
+ *
15
+ * Profiles can be:
16
+ * - MDM enrollment profiles (.mobileconfig)
17
+ * - WiFi configuration profiles
18
+ * - VPN profiles
19
+ * - Certificate profiles
20
+ * - Any other configuration profile
21
+ *
22
+ * @param udid Device UDID (leave empty for first connected device)
23
+ * @param profile Profile data (Buffer or base64 string)
24
+ * @param maxRetries Maximum number of retry attempts (default: 3)
25
+ * @returns Promise that resolves when profile is installed
26
+ */
27
+ export declare function installProfile(udid: string | undefined, profile: Buffer | string, maxRetries?: number): Promise<void>;
28
+ /**
29
+ * Get list of installed configuration profiles on device
30
+ *
31
+ * @param udid Device UDID (leave empty for first connected device)
32
+ * @returns Dictionary of installed profiles keyed by PayloadIdentifier
33
+ */
34
+ export declare function getProfileList(udid?: string): Promise<Record<string, ProfileMetadata>>;
35
+ /**
36
+ * Wait for a profile to be installed on the device
37
+ *
38
+ * @param udid Device UDID
39
+ * @param expectedProfileCount Expected number of profiles after installation
40
+ * @param timeoutMs Timeout in milliseconds (default: 60000)
41
+ * @param pollIntervalMs Poll interval in milliseconds (default: 1000)
42
+ * @returns Promise that resolves when profile count increases
43
+ */
44
+ export declare function waitForProfileInstallation(udid: string, expectedProfileCount: number, timeoutMs?: number, pollIntervalMs?: number): Promise<void>;
45
+ /**
46
+ * Install enrollment profile and wait for it to be installed
47
+ *
48
+ * This combines installProfile and waitForProfileInstallation for convenience.
49
+ *
50
+ * @param udid Device UDID (leave empty for first connected device)
51
+ * @param enrollmentProfile Enrollment profile data (Buffer or base64 string)
52
+ * @param waitForInstallation Whether to wait for installation to be confirmed (default: true)
53
+ * @returns Promise that resolves when profile is installed
54
+ */
55
+ export declare function installEnrollmentProfile(udid: string | undefined, enrollmentProfile: Buffer | string, waitForInstallation?: boolean): Promise<void>;
56
+ //# sourceMappingURL=enrollment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrollment.d.ts","sourceRoot":"","sources":["../../../src/logic/enrollment.ts"],"names":[],"mappings":"AAkCA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,YAAK,EACjB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,UAAU,SAAI,GACZ,OAAO,CAAC,IAAI,CAAC,CAoCf;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CACnC,IAAI,GAAE,MAAW,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAqB1C;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC/C,IAAI,EAAE,MAAM,EACZ,oBAAoB,EAAE,MAAM,EAC5B,SAAS,SAAQ,EACjB,cAAc,SAAO,GACnB,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAC7C,IAAI,EAAE,MAAM,YAAK,EACjB,iBAAiB,EAAE,MAAM,GAAG,MAAM,EAClC,mBAAmB,UAAO,GACxB,OAAO,CAAC,IAAI,CAAC,CAgBf"}