spana-test 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (548) hide show
  1. package/.agents/skills/spana-testing/SKILL.md +0 -0
  2. package/LICENSE +0 -0
  3. package/README.md +5 -2
  4. package/dist/{accessibility-audit-YZOPUY3D.js → accessibility-audit-MHQ65DUD.js} +61 -12
  5. package/dist/accessibility-audit-MHQ65DUD.js.map +1 -0
  6. package/dist/agent/index.d.ts +3 -11
  7. package/dist/agent/index.d.ts.map +1 -0
  8. package/dist/agent/index.js +38 -15
  9. package/dist/agent/index.js.map +1 -1
  10. package/dist/{session-uT8xL03K.d.ts → agent/session.d.ts} +14 -46
  11. package/dist/agent/session.d.ts.map +1 -0
  12. package/dist/{agent-fixture-5C4MCWRD.js → agent-fixture-H6GOUHNX.js} +3 -3
  13. package/dist/{agent-fixture-5C4MCWRD.js.map → agent-fixture-H6GOUHNX.js.map} +0 -0
  14. package/dist/{allure-FGVR5LND.js → allure-XOM7BXL5.js} +5 -2
  15. package/dist/{allure-FGVR5LND.js.map → allure-XOM7BXL5.js.map} +1 -1
  16. package/dist/{android-6BOQTMM3.js → android-C2S4B4TH.js} +3 -3
  17. package/dist/{android-6BOQTMM3.js.map → android-C2S4B4TH.js.map} +0 -0
  18. package/dist/api/agent-fixture.d.ts +119 -0
  19. package/dist/api/agent-fixture.d.ts.map +1 -0
  20. package/dist/api/app.d.ts +399 -0
  21. package/dist/api/app.d.ts.map +1 -0
  22. package/dist/api/expect.d.ts +180 -0
  23. package/dist/api/expect.d.ts.map +1 -0
  24. package/dist/api/fixtures.d.ts +165 -0
  25. package/dist/api/fixtures.d.ts.map +1 -0
  26. package/dist/api/flow.d.ts +123 -0
  27. package/dist/api/flow.d.ts.map +1 -0
  28. package/dist/api/index.d.ts +4 -0
  29. package/dist/api/index.d.ts.map +1 -0
  30. package/dist/api/snapshots.d.ts +26 -0
  31. package/dist/api/snapshots.d.ts.map +1 -0
  32. package/dist/api/storybook.d.ts +18 -0
  33. package/dist/api/storybook.d.ts.map +1 -0
  34. package/dist/api/suite.d.ts +46 -0
  35. package/dist/api/suite.d.ts.map +1 -0
  36. package/dist/app-W6PRRBMD.js +13 -0
  37. package/dist/{app-RSDPDTKT.js.map → app-W6PRRBMD.js.map} +0 -0
  38. package/dist/appium-CC77BJNK.js +935 -0
  39. package/dist/appium-CC77BJNK.js.map +1 -0
  40. package/dist/{appium-server-66GVUL24.js → appium-server-M6CWWUWF.js} +5 -2
  41. package/dist/{appium-server-66GVUL24.js.map → appium-server-M6CWWUWF.js.map} +1 -1
  42. package/dist/{baseline-manager-5TIUCNP5.js → baseline-manager-LVUVH2MJ.js} +5 -2
  43. package/dist/{baseline-manager-5TIUCNP5.js.map → baseline-manager-LVUVH2MJ.js.map} +1 -1
  44. package/dist/bridge-server-S3DHK7XE.js +12 -0
  45. package/dist/{cache-command-PANUAEMZ.js.map → bridge-server-S3DHK7XE.js.map} +0 -0
  46. package/dist/{cache-command-PANUAEMZ.js → cache-command-OL7HUK2K.js} +3 -3
  47. package/dist/{chunk-DGUM43GV.js.map → cache-command-OL7HUK2K.js.map} +0 -0
  48. package/dist/channels/android-cdp.d.ts +71 -0
  49. package/dist/channels/android-cdp.d.ts.map +1 -0
  50. package/dist/channels/apple-webinspector.d.ts +85 -0
  51. package/dist/channels/apple-webinspector.d.ts.map +1 -0
  52. package/dist/channels/bidi-client.d.ts +79 -0
  53. package/dist/channels/bidi-client.d.ts.map +1 -0
  54. package/dist/channels/bridge-server.d.ts +69 -0
  55. package/dist/channels/bridge-server.d.ts.map +1 -0
  56. package/dist/channels/cdp-client.d.ts +115 -0
  57. package/dist/channels/cdp-client.d.ts.map +1 -0
  58. package/dist/channels/dom-channel.d.ts +246 -0
  59. package/dist/channels/dom-channel.d.ts.map +1 -0
  60. package/dist/channels/index.d.ts +8 -0
  61. package/dist/channels/index.d.ts.map +1 -0
  62. package/dist/channels/webkit-inspector.d.ts +85 -0
  63. package/dist/channels/webkit-inspector.d.ts.map +1 -0
  64. package/dist/channels/ws-server.d.ts +21 -0
  65. package/dist/channels/ws-server.d.ts.map +1 -0
  66. package/dist/chunk-27H6NDA5.js +845 -0
  67. package/dist/chunk-27H6NDA5.js.map +1 -0
  68. package/dist/{chunk-WV3ALL3H.js → chunk-2MA5G2VH.js} +6 -2
  69. package/dist/{chunk-WV3ALL3H.js.map → chunk-2MA5G2VH.js.map} +1 -1
  70. package/dist/chunk-4LJ3KYCX.js +94 -0
  71. package/dist/chunk-4LJ3KYCX.js.map +1 -0
  72. package/dist/chunk-5SDVP53E.js +1046 -0
  73. package/dist/chunk-5SDVP53E.js.map +1 -0
  74. package/dist/{chunk-FPQAJNE3.js → chunk-5T7LSBDM.js} +288 -101
  75. package/dist/chunk-5T7LSBDM.js.map +1 -0
  76. package/dist/chunk-6C2EILMC.js +2589 -0
  77. package/dist/chunk-6C2EILMC.js.map +1 -0
  78. package/dist/{chunk-3IZMPNE7.js → chunk-7IUD55GY.js} +1333 -941
  79. package/dist/chunk-7IUD55GY.js.map +1 -0
  80. package/dist/{chunk-JPZCZHL4.js → chunk-7Q7TSUNL.js} +6 -1
  81. package/dist/{chunk-JPZCZHL4.js.map → chunk-7Q7TSUNL.js.map} +1 -1
  82. package/dist/{chunk-X2TJP7LB.js → chunk-7WHQIQPM.js} +11 -1
  83. package/dist/chunk-7WHQIQPM.js.map +1 -0
  84. package/dist/chunk-A7Z52TDQ.js +97 -0
  85. package/dist/chunk-A7Z52TDQ.js.map +1 -0
  86. package/dist/{chunk-WZAQANN6.js → chunk-BUNMIMGA.js} +9 -3
  87. package/dist/{chunk-WZAQANN6.js.map → chunk-BUNMIMGA.js.map} +1 -1
  88. package/dist/chunk-DMF2BPPA.js +547 -0
  89. package/dist/chunk-DMF2BPPA.js.map +1 -0
  90. package/dist/{chunk-Z6K4QQAR.js → chunk-FHCOPLYB.js} +36 -7
  91. package/dist/chunk-FHCOPLYB.js.map +1 -0
  92. package/dist/{chunk-3SH5JQF7.js → chunk-FSPMFRJO.js} +6 -1
  93. package/dist/{chunk-3SH5JQF7.js.map → chunk-FSPMFRJO.js.map} +1 -1
  94. package/dist/chunk-FTXUQMGH.js +56 -0
  95. package/dist/chunk-FTXUQMGH.js.map +1 -0
  96. package/dist/chunk-FUXFXFBM.js +1962 -0
  97. package/dist/chunk-FUXFXFBM.js.map +1 -0
  98. package/dist/{chunk-SIJJVN2D.js → chunk-FV7ONGQ7.js} +9 -3
  99. package/dist/{chunk-SIJJVN2D.js.map → chunk-FV7ONGQ7.js.map} +1 -1
  100. package/dist/{chunk-VUNH4AJD.js → chunk-GDVHJBR2.js} +9 -5
  101. package/dist/{chunk-VUNH4AJD.js.map → chunk-GDVHJBR2.js.map} +1 -1
  102. package/dist/chunk-GLNTGHR6.js +330 -0
  103. package/dist/chunk-GLNTGHR6.js.map +1 -0
  104. package/dist/{chunk-OPTNFLBL.js → chunk-HIGFQRWM.js} +7 -1
  105. package/dist/{chunk-OPTNFLBL.js.map → chunk-HIGFQRWM.js.map} +1 -1
  106. package/dist/chunk-HJY5YN4N.js +272 -0
  107. package/dist/chunk-HJY5YN4N.js.map +1 -0
  108. package/dist/chunk-HNQLWFHL.js +40 -0
  109. package/dist/chunk-HNQLWFHL.js.map +1 -0
  110. package/dist/chunk-HUYC4OAL.js +72 -0
  111. package/dist/chunk-HUYC4OAL.js.map +1 -0
  112. package/dist/chunk-HWS3XUEF.js +109 -0
  113. package/dist/chunk-HWS3XUEF.js.map +1 -0
  114. package/dist/chunk-IDIHDVGC.js +328 -0
  115. package/dist/chunk-IDIHDVGC.js.map +1 -0
  116. package/dist/{chunk-4SA7JK5D.js → chunk-IUK3RJ6W.js} +38 -20
  117. package/dist/{chunk-4SA7JK5D.js.map → chunk-IUK3RJ6W.js.map} +1 -1
  118. package/dist/chunk-K4K2ACT2.js +179 -0
  119. package/dist/chunk-K4K2ACT2.js.map +1 -0
  120. package/dist/chunk-LKGF75QJ.js +654 -0
  121. package/dist/chunk-LKGF75QJ.js.map +1 -0
  122. package/dist/chunk-MAKZK7GY.js +935 -0
  123. package/dist/chunk-MAKZK7GY.js.map +1 -0
  124. package/dist/chunk-MPJCUL2B.js +154 -0
  125. package/dist/chunk-MPJCUL2B.js.map +1 -0
  126. package/dist/chunk-MUMIMDRJ.js +24 -0
  127. package/dist/chunk-MUMIMDRJ.js.map +1 -0
  128. package/dist/{chunk-KJPHH2TW.js → chunk-NHT3XSX3.js} +6 -1
  129. package/dist/{chunk-KJPHH2TW.js.map → chunk-NHT3XSX3.js.map} +1 -1
  130. package/dist/{chunk-6PTUVG6A.js → chunk-NWGA3R2E.js} +7 -18
  131. package/dist/chunk-NWGA3R2E.js.map +1 -0
  132. package/dist/{chunk-3FSZNKEF.js → chunk-NXET4BFJ.js} +7 -1
  133. package/dist/{chunk-3FSZNKEF.js.map → chunk-NXET4BFJ.js.map} +1 -1
  134. package/dist/chunk-PPRNCRTS.js +1104 -0
  135. package/dist/chunk-PPRNCRTS.js.map +1 -0
  136. package/dist/{chunk-64UZQP7Z.js → chunk-PRQTAIYA.js} +30 -4
  137. package/dist/chunk-PRQTAIYA.js.map +1 -0
  138. package/dist/{chunk-4KK4E3N3.js → chunk-RHQJSPOS.js} +1289 -187
  139. package/dist/chunk-RHQJSPOS.js.map +1 -0
  140. package/dist/{chunk-CY3DKTBZ.js → chunk-RIXZISMX.js} +6 -1
  141. package/dist/{chunk-CY3DKTBZ.js.map → chunk-RIXZISMX.js.map} +1 -1
  142. package/dist/{chunk-S7MSBZ3F.js → chunk-TFEXYI6N.js} +6 -1
  143. package/dist/{chunk-S7MSBZ3F.js.map → chunk-TFEXYI6N.js.map} +1 -1
  144. package/dist/chunk-U56N5JCJ.js +19842 -0
  145. package/dist/chunk-U56N5JCJ.js.map +1 -0
  146. package/dist/{chunk-IHVZKQQW.js → chunk-UKUXNFQP.js} +6 -1
  147. package/dist/{chunk-IHVZKQQW.js.map → chunk-UKUXNFQP.js.map} +1 -1
  148. package/dist/{chunk-SGZMO456.js → chunk-VWJNINPX.js} +667 -123
  149. package/dist/chunk-VWJNINPX.js.map +1 -0
  150. package/dist/chunk-WFC4DCFF.js +529 -0
  151. package/dist/chunk-WFC4DCFF.js.map +1 -0
  152. package/dist/{chunk-26NJXP55.js → chunk-WJH5K42V.js} +6 -2
  153. package/dist/{chunk-26NJXP55.js.map → chunk-WJH5K42V.js.map} +1 -1
  154. package/dist/chunk-X5FRYDZ3.js +91 -0
  155. package/dist/chunk-X5FRYDZ3.js.map +1 -0
  156. package/dist/{chunk-VP6V4XEJ.js → chunk-XD6A3VXB.js} +10 -5
  157. package/dist/{chunk-VP6V4XEJ.js.map → chunk-XD6A3VXB.js.map} +1 -1
  158. package/dist/{chunk-2AFWVHQK.js → chunk-XVL4FHXA.js} +6 -1
  159. package/dist/{chunk-2AFWVHQK.js.map → chunk-XVL4FHXA.js.map} +1 -1
  160. package/dist/chunk-YFTHJRDO.js +37 -0
  161. package/dist/chunk-YFTHJRDO.js.map +1 -0
  162. package/dist/{chunk-LAMTF4LX.js → chunk-ZIETAMAD.js} +6 -1
  163. package/dist/{chunk-LAMTF4LX.js.map → chunk-ZIETAMAD.js.map} +1 -1
  164. package/dist/cli/cache-command.d.ts +29 -0
  165. package/dist/cli/cache-command.d.ts.map +1 -0
  166. package/dist/cli/command-errors.d.ts +7 -0
  167. package/dist/cli/command-errors.d.ts.map +1 -0
  168. package/dist/cli/config-loader.d.ts +11 -0
  169. package/dist/cli/config-loader.d.ts.map +1 -0
  170. package/dist/cli/doctor-command.d.ts +64 -0
  171. package/dist/cli/doctor-command.d.ts.map +1 -0
  172. package/dist/cli/gen-types-command.d.ts +2 -0
  173. package/dist/cli/gen-types-command.d.ts.map +1 -0
  174. package/dist/cli/index.d.ts +2 -0
  175. package/dist/cli/index.d.ts.map +1 -0
  176. package/dist/cli/init-command.d.ts +7 -0
  177. package/dist/cli/init-command.d.ts.map +1 -0
  178. package/dist/cli/init-flow-command.d.ts +11 -0
  179. package/dist/cli/init-flow-command.d.ts.map +1 -0
  180. package/dist/cli/iteration.d.ts +44 -0
  181. package/dist/cli/iteration.d.ts.map +1 -0
  182. package/dist/cli/scaffolds.d.ts +13 -0
  183. package/dist/cli/scaffolds.d.ts.map +1 -0
  184. package/dist/cli/studio-command.d.ts +8 -0
  185. package/dist/cli/studio-command.d.ts.map +1 -0
  186. package/dist/cli/test-command.d.ts +61 -0
  187. package/dist/cli/test-command.d.ts.map +1 -0
  188. package/dist/cli/watch-mode.d.ts +9 -0
  189. package/dist/cli/watch-mode.d.ts.map +1 -0
  190. package/dist/cli.js +86 -30
  191. package/dist/cli.js.map +1 -1
  192. package/dist/cloud/browserstack.d.ts +9 -0
  193. package/dist/cloud/browserstack.d.ts.map +1 -0
  194. package/dist/cloud/common.d.ts +26 -0
  195. package/dist/cloud/common.d.ts.map +1 -0
  196. package/dist/cloud/provider.d.ts +21 -0
  197. package/dist/cloud/provider.d.ts.map +1 -0
  198. package/dist/cloud/saucelabs.d.ts +9 -0
  199. package/dist/cloud/saucelabs.d.ts.map +1 -0
  200. package/dist/{compiler-X6WTFMYF.js → compiler-44UW2FID.js} +7 -3
  201. package/dist/{compiler-X6WTFMYF.js.map → compiler-44UW2FID.js.map} +1 -1
  202. package/dist/config-loader-7W7OEWRG.js +10 -0
  203. package/dist/{config-loader-CNGIW2XK.js.map → config-loader-7W7OEWRG.js.map} +0 -0
  204. package/dist/{console-DIYEJSSP.js → console-T6TVZ65G.js} +8 -2
  205. package/dist/console-T6TVZ65G.js.map +1 -0
  206. package/dist/core/accessibility-audit.d.ts +29 -0
  207. package/dist/core/accessibility-audit.d.ts.map +1 -0
  208. package/dist/core/artifacts.d.ts +27 -0
  209. package/dist/core/artifacts.d.ts.map +1 -0
  210. package/dist/core/baseline-manager.d.ts +18 -0
  211. package/dist/core/baseline-manager.d.ts.map +1 -0
  212. package/dist/core/benchmark.d.ts +21 -0
  213. package/dist/core/benchmark.d.ts.map +1 -0
  214. package/dist/core/debug-repl.d.ts +17 -0
  215. package/dist/core/debug-repl.d.ts.map +1 -0
  216. package/dist/core/engine.d.ts +51 -0
  217. package/dist/core/engine.d.ts.map +1 -0
  218. package/dist/core/filters.d.ts +248 -0
  219. package/dist/core/filters.d.ts.map +1 -0
  220. package/dist/core/flow-generator.d.ts +13 -0
  221. package/dist/core/flow-generator.d.ts.map +1 -0
  222. package/dist/core/graphemes.d.ts +2 -0
  223. package/dist/core/graphemes.d.ts.map +1 -0
  224. package/dist/core/index.d.ts +6 -0
  225. package/dist/core/index.d.ts.map +1 -0
  226. package/dist/core/native-accel.d.ts +21 -0
  227. package/dist/core/native-accel.d.ts.map +1 -0
  228. package/dist/core/network-cache.d.ts +68 -0
  229. package/dist/core/network-cache.d.ts.map +1 -0
  230. package/dist/core/orchestrator.d.ts +44 -0
  231. package/dist/core/orchestrator.d.ts.map +1 -0
  232. package/dist/core/parallel.d.ts +42 -0
  233. package/dist/core/parallel.d.ts.map +1 -0
  234. package/dist/core/port-allocator.d.ts +16 -0
  235. package/dist/core/port-allocator.d.ts.map +1 -0
  236. package/dist/core/projects.d.ts +60 -0
  237. package/dist/core/projects.d.ts.map +1 -0
  238. package/dist/core/replay-cache.d.ts +127 -0
  239. package/dist/core/replay-cache.d.ts.map +1 -0
  240. package/dist/core/runner.d.ts +50 -0
  241. package/dist/core/runner.d.ts.map +1 -0
  242. package/dist/core/screenshot-compare.d.ts +50 -0
  243. package/dist/core/screenshot-compare.d.ts.map +1 -0
  244. package/dist/core/session-manager.d.ts +35 -0
  245. package/dist/core/session-manager.d.ts.map +1 -0
  246. package/dist/core/step-recorder.d.ts +20 -0
  247. package/dist/core/step-recorder.d.ts.map +1 -0
  248. package/dist/core/target-matrix.d.ts +29 -0
  249. package/dist/core/target-matrix.d.ts.map +1 -0
  250. package/dist/core/trace-viewer.d.ts +91 -0
  251. package/dist/core/trace-viewer.d.ts.map +1 -0
  252. package/dist/core/validator.d.ts +18 -0
  253. package/dist/core/validator.d.ts.map +1 -0
  254. package/dist/core/video-recorder.d.ts +120 -0
  255. package/dist/core/video-recorder.d.ts.map +1 -0
  256. package/dist/core/worker-pool.d.ts +87 -0
  257. package/dist/core/worker-pool.d.ts.map +1 -0
  258. package/dist/{daemon-manager-2EQDVUVM.js → daemon-manager-2SK5PHJR.js} +3 -3
  259. package/dist/{daemon-manager-2EQDVUVM.js.map → daemon-manager-2SK5PHJR.js.map} +0 -0
  260. package/dist/device/android.d.ts +66 -0
  261. package/dist/device/android.d.ts.map +1 -0
  262. package/dist/device/discover.d.ts +15 -0
  263. package/dist/device/discover.d.ts.map +1 -0
  264. package/dist/device/index.d.ts +4 -0
  265. package/dist/device/index.d.ts.map +1 -0
  266. package/dist/device/ios.d.ts +126 -0
  267. package/dist/device/ios.d.ts.map +1 -0
  268. package/dist/diagnostics/live-inspector.d.ts +121 -0
  269. package/dist/diagnostics/live-inspector.d.ts.map +1 -0
  270. package/dist/diagnostics/native-logs.d.ts +38 -0
  271. package/dist/diagnostics/native-logs.d.ts.map +1 -0
  272. package/dist/discover-6ULCTB5T.js +15 -0
  273. package/dist/{discover-NKDMB4UI.js.map → discover-6ULCTB5T.js.map} +0 -0
  274. package/dist/{doctor-command-6ZVJWCW7.js → doctor-command-4CQQLB7M.js} +24 -14
  275. package/dist/{doctor-command-6ZVJWCW7.js.map → doctor-command-4CQQLB7M.js.map} +1 -1
  276. package/dist/driver-3MEIFYST.js +19 -0
  277. package/dist/{filters-MQG2RMPX.js.map → driver-3MEIFYST.js.map} +0 -0
  278. package/dist/driver-QTIAADUZ.js +19 -0
  279. package/dist/{github-pr-YMWIPCCZ.js.map → driver-QTIAADUZ.js.map} +0 -0
  280. package/dist/drivers/adapter-registry.d.ts +96 -0
  281. package/dist/drivers/adapter-registry.d.ts.map +1 -0
  282. package/dist/drivers/appium/android.d.ts +22 -0
  283. package/dist/drivers/appium/android.d.ts.map +1 -0
  284. package/dist/drivers/appium/client.d.ts +26 -0
  285. package/dist/drivers/appium/client.d.ts.map +1 -0
  286. package/dist/drivers/appium/ios.d.ts +28 -0
  287. package/dist/drivers/appium/ios.d.ts.map +1 -0
  288. package/dist/drivers/appium/window-size.d.ts +8 -0
  289. package/dist/drivers/appium/window-size.d.ts.map +1 -0
  290. package/dist/drivers/browser-extensions.d.ts +62 -0
  291. package/dist/drivers/browser-extensions.d.ts.map +1 -0
  292. package/dist/drivers/cdp-browser.d.ts +129 -0
  293. package/dist/drivers/cdp-browser.d.ts.map +1 -0
  294. package/dist/drivers/common/xml-tokenizer.d.ts +26 -0
  295. package/dist/drivers/common/xml-tokenizer.d.ts.map +1 -0
  296. package/dist/drivers/device-controls.d.ts +36 -0
  297. package/dist/drivers/device-controls.d.ts.map +1 -0
  298. package/dist/drivers/electrobun.d.ts +47 -0
  299. package/dist/drivers/electrobun.d.ts.map +1 -0
  300. package/dist/drivers/electron.d.ts +36 -0
  301. package/dist/drivers/electron.d.ts.map +1 -0
  302. package/dist/drivers/index.d.ts +2 -0
  303. package/dist/drivers/index.d.ts.map +1 -0
  304. package/dist/drivers/launch-options.d.ts +10 -0
  305. package/dist/drivers/launch-options.d.ts.map +1 -0
  306. package/dist/drivers/network-profiles.d.ts +9 -0
  307. package/dist/drivers/network-profiles.d.ts.map +1 -0
  308. package/dist/drivers/playwright-parser.d.ts +16 -0
  309. package/dist/drivers/playwright-parser.d.ts.map +1 -0
  310. package/dist/drivers/playwright.d.ts +65 -0
  311. package/dist/drivers/playwright.d.ts.map +1 -0
  312. package/dist/drivers/raw-driver.d.ts +403 -0
  313. package/dist/drivers/raw-driver.d.ts.map +1 -0
  314. package/dist/drivers/uiautomator2/client.d.ts +77 -0
  315. package/dist/drivers/uiautomator2/client.d.ts.map +1 -0
  316. package/dist/drivers/uiautomator2/driver.d.ts +20 -0
  317. package/dist/drivers/uiautomator2/driver.d.ts.map +1 -0
  318. package/dist/drivers/uiautomator2/index.d.ts +5 -0
  319. package/dist/drivers/uiautomator2/index.d.ts.map +1 -0
  320. package/dist/drivers/uiautomator2/installer.d.ts +20 -0
  321. package/dist/drivers/uiautomator2/installer.d.ts.map +1 -0
  322. package/dist/drivers/uiautomator2/pagesource.d.ts +12 -0
  323. package/dist/drivers/uiautomator2/pagesource.d.ts.map +1 -0
  324. package/dist/drivers/wasm-utils.d.ts +100 -0
  325. package/dist/drivers/wasm-utils.d.ts.map +1 -0
  326. package/dist/drivers/wasm.d.ts +57 -0
  327. package/dist/drivers/wasm.d.ts.map +1 -0
  328. package/dist/drivers/wda/client.d.ts +116 -0
  329. package/dist/drivers/wda/client.d.ts.map +1 -0
  330. package/dist/drivers/wda/driver.d.ts +26 -0
  331. package/dist/drivers/wda/driver.d.ts.map +1 -0
  332. package/dist/drivers/wda/index.d.ts +5 -0
  333. package/dist/drivers/wda/index.d.ts.map +1 -0
  334. package/dist/drivers/wda/installer.d.ts +51 -0
  335. package/dist/drivers/wda/installer.d.ts.map +1 -0
  336. package/dist/drivers/wda/pagesource.d.ts +12 -0
  337. package/dist/drivers/wda/pagesource.d.ts.map +1 -0
  338. package/dist/electrobun-MPAHMSI2.js +15 -0
  339. package/dist/{installer-5UHTYQTB.js.map → electrobun-MPAHMSI2.js.map} +0 -0
  340. package/dist/electron-SQACDON3.js +9 -0
  341. package/dist/{ios-Y4TO5MBR.js.map → electron-SQACDON3.js.map} +0 -0
  342. package/dist/errors.d.ts +82 -0
  343. package/dist/errors.d.ts.map +1 -0
  344. package/dist/{filters-MQG2RMPX.js → filters-5DCGGJRN.js} +3 -3
  345. package/dist/{local-DM3YBSV5.js.map → filters-5DCGGJRN.js.map} +0 -0
  346. package/dist/gherkin/compiler.d.ts +3 -0
  347. package/dist/gherkin/compiler.d.ts.map +1 -0
  348. package/dist/gherkin/index.d.ts +7 -0
  349. package/dist/gherkin/index.d.ts.map +1 -0
  350. package/dist/gherkin/matcher.d.ts +9 -0
  351. package/dist/gherkin/matcher.d.ts.map +1 -0
  352. package/dist/gherkin/registry.d.ts +28 -0
  353. package/dist/gherkin/registry.d.ts.map +1 -0
  354. package/dist/gherkin/steps.d.ts +13 -31
  355. package/dist/gherkin/steps.d.ts.map +1 -0
  356. package/dist/gherkin/steps.js +5 -2
  357. package/dist/gherkin/steps.js.map +1 -1
  358. package/dist/gherkin/world.d.ts +15 -0
  359. package/dist/gherkin/world.d.ts.map +1 -0
  360. package/dist/{github-pr-YMWIPCCZ.js → github-pr-RYO6IAKD.js} +3 -3
  361. package/dist/{machine-6H25TRTU.js.map → github-pr-RYO6IAKD.js.map} +0 -0
  362. package/dist/{html-FLMWPFQD.js → html-KJ2QAGF4.js} +6 -3
  363. package/dist/{html-FLMWPFQD.js.map → html-KJ2QAGF4.js.map} +1 -1
  364. package/dist/index.d.ts +57 -2267
  365. package/dist/index.d.ts.map +1 -0
  366. package/dist/index.js +460 -69
  367. package/dist/index.js.map +1 -1
  368. package/dist/{init-command-Z3QREABL.js → init-command-V5VGN3IS.js} +5 -2
  369. package/dist/{init-command-Z3QREABL.js.map → init-command-V5VGN3IS.js.map} +1 -1
  370. package/dist/{init-flow-command-4EKRVTNT.js → init-flow-command-INYUCC6N.js} +6 -3
  371. package/dist/{init-flow-command-4EKRVTNT.js.map → init-flow-command-INYUCC6N.js.map} +1 -1
  372. package/dist/{installer-5UHTYQTB.js → installer-DMTY47SI.js} +5 -5
  373. package/dist/{provider-YIPU5K42.js.map → installer-DMTY47SI.js.map} +0 -0
  374. package/dist/installer-KL2NCILK.js +17 -0
  375. package/dist/{runner-WOVZWUQR.js.map → installer-KL2NCILK.js.map} +0 -0
  376. package/dist/{ios-Y4TO5MBR.js → ios-SZ4RBI7Q.js} +4 -4
  377. package/dist/{server-ING5D5ZJ.js.map → ios-SZ4RBI7Q.js.map} +0 -0
  378. package/dist/json-57Z2YSES.js +39 -0
  379. package/dist/json-57Z2YSES.js.map +1 -0
  380. package/dist/{junit-CGB3LKHD.js → junit-MHD5AXBU.js} +26 -6
  381. package/dist/junit-MHD5AXBU.js.map +1 -0
  382. package/dist/{local-DM3YBSV5.js → local-SWHWINSA.js} +11 -12
  383. package/dist/{session-5TNWVGQQ.js.map → local-SWHWINSA.js.map} +0 -0
  384. package/dist/{machine-6H25TRTU.js → machine-NOOFRT45.js} +3 -3
  385. package/dist/{validator-WO5IL7IY.js.map → machine-NOOFRT45.js.map} +0 -0
  386. package/dist/machine.d.ts +20 -0
  387. package/dist/machine.d.ts.map +1 -0
  388. package/dist/mcp/server.d.ts +73 -0
  389. package/dist/mcp/server.d.ts.map +1 -0
  390. package/dist/pagesource-KIQ5T5MA.js +9 -0
  391. package/dist/pagesource-KIQ5T5MA.js.map +1 -0
  392. package/dist/pagesource-KKG7WMFJ.js +9 -0
  393. package/dist/pagesource-KKG7WMFJ.js.map +1 -0
  394. package/dist/playwright-42QYIZEE.js +28 -0
  395. package/dist/playwright-42QYIZEE.js.map +1 -0
  396. package/dist/{provider-YIPU5K42.js → provider-CBAXZ2VA.js} +3 -3
  397. package/dist/provider-CBAXZ2VA.js.map +1 -0
  398. package/dist/{redact-U72BUBBR.js → redact-OG4M3IEU.js} +5 -2
  399. package/dist/{redact-U72BUBBR.js.map → redact-OG4M3IEU.js.map} +1 -1
  400. package/dist/report/allure.d.ts +3 -0
  401. package/dist/report/allure.d.ts.map +1 -0
  402. package/dist/report/classify-error.d.ts +7 -0
  403. package/dist/report/classify-error.d.ts.map +1 -0
  404. package/dist/report/code-frame.d.ts +16 -0
  405. package/dist/report/code-frame.d.ts.map +1 -0
  406. package/dist/report/console.d.ts +7 -0
  407. package/dist/report/console.d.ts.map +1 -0
  408. package/dist/report/failure-bundle.d.ts +66 -0
  409. package/dist/report/failure-bundle.d.ts.map +1 -0
  410. package/dist/report/failure-diagnostics.d.ts +11 -0
  411. package/dist/report/failure-diagnostics.d.ts.map +1 -0
  412. package/dist/report/github-pr.d.ts +20 -0
  413. package/dist/report/github-pr.d.ts.map +1 -0
  414. package/dist/report/html.d.ts +3 -0
  415. package/dist/report/html.d.ts.map +1 -0
  416. package/dist/report/index.d.ts +8 -0
  417. package/dist/report/index.d.ts.map +1 -0
  418. package/dist/report/json.d.ts +3 -0
  419. package/dist/report/json.d.ts.map +1 -0
  420. package/dist/report/junit.d.ts +3 -0
  421. package/dist/report/junit.d.ts.map +1 -0
  422. package/dist/report/redact.d.ts +29 -0
  423. package/dist/report/redact.d.ts.map +1 -0
  424. package/dist/report/selector-guardrails.d.ts +12 -0
  425. package/dist/report/selector-guardrails.d.ts.map +1 -0
  426. package/dist/report/types.d.ts +164 -0
  427. package/dist/report/types.d.ts.map +1 -0
  428. package/dist/{runner-WOVZWUQR.js → runner-ABGUVOJG.js} +5 -3
  429. package/dist/runner-ABGUVOJG.js.map +1 -0
  430. package/dist/runtime/appium-server.d.ts +34 -0
  431. package/dist/runtime/appium-server.d.ts.map +1 -0
  432. package/dist/runtime/appium.d.ts +5 -0
  433. package/dist/runtime/appium.d.ts.map +1 -0
  434. package/dist/runtime/capabilities.d.ts +19 -0
  435. package/dist/runtime/capabilities.d.ts.map +1 -0
  436. package/dist/runtime/daemon-manager.d.ts +83 -0
  437. package/dist/runtime/daemon-manager.d.ts.map +1 -0
  438. package/dist/runtime/local.d.ts +38 -0
  439. package/dist/runtime/local.d.ts.map +1 -0
  440. package/dist/runtime/types.d.ts +21 -0
  441. package/dist/runtime/types.d.ts.map +1 -0
  442. package/dist/runtime/web-server.d.ts +57 -0
  443. package/dist/runtime/web-server.d.ts.map +1 -0
  444. package/dist/schemas/config.d.ts +812 -0
  445. package/dist/schemas/config.d.ts.map +1 -0
  446. package/dist/schemas/device.d.ts +12 -0
  447. package/dist/schemas/device.d.ts.map +1 -0
  448. package/dist/schemas/element.d.ts +66 -0
  449. package/dist/schemas/element.d.ts.map +1 -0
  450. package/dist/schemas/index.d.ts +5 -0
  451. package/dist/schemas/index.d.ts.map +1 -0
  452. package/dist/schemas/selector.d.ts +193 -0
  453. package/dist/schemas/selector.d.ts.map +1 -0
  454. package/dist/screenshot-compare-BJRJHKNQ.js +12 -0
  455. package/dist/screenshot-compare-BJRJHKNQ.js.map +1 -0
  456. package/dist/server-2Y46CDVB.js +6749 -0
  457. package/dist/server-2Y46CDVB.js.map +1 -0
  458. package/dist/{server-ING5D5ZJ.js → server-ZCBZ4UYF.js} +3 -3
  459. package/dist/server-ZCBZ4UYF.js.map +1 -0
  460. package/dist/session-5XW6TKF4.js +39 -0
  461. package/dist/session-5XW6TKF4.js.map +1 -0
  462. package/dist/smart/auto-wait.d.ts +38 -0
  463. package/dist/smart/auto-wait.d.ts.map +1 -0
  464. package/dist/smart/channel-resolver.d.ts +90 -0
  465. package/dist/smart/channel-resolver.d.ts.map +1 -0
  466. package/dist/smart/coordinator.d.ts +162 -0
  467. package/dist/smart/coordinator.d.ts.map +1 -0
  468. package/dist/smart/diagnostics.d.ts +15 -0
  469. package/dist/smart/diagnostics.d.ts.map +1 -0
  470. package/dist/smart/element-matcher.d.ts +24 -0
  471. package/dist/smart/element-matcher.d.ts.map +1 -0
  472. package/dist/smart/hierarchy-cache.d.ts +16 -0
  473. package/dist/smart/hierarchy-cache.d.ts.map +1 -0
  474. package/dist/smart/index.d.ts +4 -0
  475. package/dist/smart/index.d.ts.map +1 -0
  476. package/dist/studio/api.d.ts +317 -0
  477. package/dist/studio/api.d.ts.map +1 -0
  478. package/dist/studio/context.d.ts +7 -0
  479. package/dist/studio/context.d.ts.map +1 -0
  480. package/dist/studio/core/element-tree.d.ts +15 -0
  481. package/dist/studio/core/element-tree.d.ts.map +1 -0
  482. package/dist/studio/effect-handler.d.ts +3 -0
  483. package/dist/studio/effect-handler.d.ts.map +1 -0
  484. package/dist/studio/procedures.d.ts +4 -0
  485. package/dist/studio/procedures.d.ts.map +1 -0
  486. package/dist/studio/recording-session.d.ts +31 -0
  487. package/dist/studio/recording-session.d.ts.map +1 -0
  488. package/dist/studio/routers/devices.d.ts +11 -0
  489. package/dist/studio/routers/devices.d.ts.map +1 -0
  490. package/dist/studio/routers/inspector.d.ts +104 -0
  491. package/dist/studio/routers/inspector.d.ts.map +1 -0
  492. package/dist/studio/routers/recording.d.ts +130 -0
  493. package/dist/studio/routers/recording.d.ts.map +1 -0
  494. package/dist/studio/routers/tests.d.ts +93 -0
  495. package/dist/studio/routers/tests.d.ts.map +1 -0
  496. package/dist/studio/server.d.ts +12 -0
  497. package/dist/studio/server.d.ts.map +1 -0
  498. package/dist/{studio-command-KK7A3KN6.js → studio-command-BNBOL424.js} +6 -3
  499. package/dist/{studio-command-KK7A3KN6.js.map → studio-command-BNBOL424.js.map} +1 -1
  500. package/dist/{test-command-QGIJBRH7.js → test-command-T4PLAZXU.js} +311 -1080
  501. package/dist/test-command-T4PLAZXU.js.map +1 -0
  502. package/dist/{validator-WO5IL7IY.js → validator-AJNOFBQM.js} +4 -4
  503. package/dist/validator-AJNOFBQM.js.map +1 -0
  504. package/dist/watch-mode-NR5MHNNL.js +10 -0
  505. package/dist/watch-mode-NR5MHNNL.js.map +1 -0
  506. package/native/darwin-arm64/libspana_native.dylib +0 -0
  507. package/native/darwin-x64/libspana_native.dylib +0 -0
  508. package/native/linux-arm64/libspana_native.so +0 -0
  509. package/native/linux-x64/libspana_native.so +0 -0
  510. package/native/win32-x64/spana_native.dll +0 -0
  511. package/package.json +16 -19
  512. package/studio-dist/assets/index-CHLA4F7b.css +2 -0
  513. package/studio-dist/assets/index-DXGUfzm3.js +23 -0
  514. package/studio-dist/index.html +2 -2
  515. package/dist/accessibility-audit-YZOPUY3D.js.map +0 -1
  516. package/dist/app-RSDPDTKT.js +0 -10
  517. package/dist/chunk-3IZMPNE7.js.map +0 -1
  518. package/dist/chunk-4KK4E3N3.js.map +0 -1
  519. package/dist/chunk-54ASKII6.js +0 -183
  520. package/dist/chunk-54ASKII6.js.map +0 -1
  521. package/dist/chunk-64UZQP7Z.js.map +0 -1
  522. package/dist/chunk-6PTUVG6A.js.map +0 -1
  523. package/dist/chunk-DGUM43GV.js +0 -11
  524. package/dist/chunk-FPQAJNE3.js.map +0 -1
  525. package/dist/chunk-FXBWACUT.js +0 -4378
  526. package/dist/chunk-FXBWACUT.js.map +0 -1
  527. package/dist/chunk-SGZMO456.js.map +0 -1
  528. package/dist/chunk-WS2TVNMY.js +0 -2494
  529. package/dist/chunk-WS2TVNMY.js.map +0 -1
  530. package/dist/chunk-X2TJP7LB.js.map +0 -1
  531. package/dist/chunk-XA6LWLZQ.js +0 -310
  532. package/dist/chunk-XA6LWLZQ.js.map +0 -1
  533. package/dist/chunk-Z6K4QQAR.js.map +0 -1
  534. package/dist/config-loader-CNGIW2XK.js +0 -9
  535. package/dist/console-DIYEJSSP.js.map +0 -1
  536. package/dist/discover-NKDMB4UI.js +0 -15
  537. package/dist/flow-DddAj1xv.d.ts +0 -1913
  538. package/dist/json-JMRPUVY2.js +0 -20
  539. package/dist/json-JMRPUVY2.js.map +0 -1
  540. package/dist/junit-CGB3LKHD.js.map +0 -1
  541. package/dist/screenshot-compare-POTXVUTL.js +0 -136
  542. package/dist/screenshot-compare-POTXVUTL.js.map +0 -1
  543. package/dist/server-JNQ2PLCC.js +0 -855
  544. package/dist/server-JNQ2PLCC.js.map +0 -1
  545. package/dist/session-5TNWVGQQ.js +0 -21
  546. package/dist/test-command-QGIJBRH7.js.map +0 -1
  547. package/studio-dist/assets/index-CBFsOh-9.js +0 -193
  548. package/studio-dist/assets/index-DH_18EyL.css +0 -1
@@ -0,0 +1,654 @@
1
+ import {
2
+ buildDomQueryScript,
3
+ buildDomScrollIntoViewScript,
4
+ buildDomTapScript,
5
+ buildEvaluateExpression
6
+ } from "./chunk-VWJNINPX.js";
7
+ import {
8
+ init_esm_shims
9
+ } from "./chunk-FTXUQMGH.js";
10
+
11
+ // src/channels/apple-webinspector.ts
12
+ init_esm_shims();
13
+ import { execSync } from "child_process";
14
+ import { randomUUID } from "crypto";
15
+ import { existsSync, readdirSync } from "fs";
16
+ import { createConnection } from "net";
17
+ import { join } from "path";
18
+ function escapeXml(value) {
19
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
20
+ }
21
+ function encodePlistValue(value) {
22
+ if (typeof value === "string") {
23
+ return `<string>${escapeXml(value)}</string>`;
24
+ }
25
+ if (typeof value === "number") {
26
+ return Number.isInteger(value) ? `<integer>${value}</integer>` : `<real>${value}</real>`;
27
+ }
28
+ if (typeof value === "boolean") {
29
+ return value ? "<true/>" : "<false/>";
30
+ }
31
+ if (Buffer.isBuffer(value) || value instanceof Uint8Array) {
32
+ return `<data>${Buffer.from(value).toString("base64")}</data>`;
33
+ }
34
+ if (Array.isArray(value)) {
35
+ return `<array>${value.map(encodePlistValue).join("")}</array>`;
36
+ }
37
+ if (value && typeof value === "object") {
38
+ const entries = Object.entries(value).map(([k, v]) => `<key>${escapeXml(k)}</key>${encodePlistValue(v)}`).join("");
39
+ return `<dict>${entries}</dict>`;
40
+ }
41
+ return "<string></string>";
42
+ }
43
+ function encodeWebInspectorPacket(selector, args) {
44
+ const xml = [
45
+ '<?xml version="1.0" encoding="UTF-8"?>',
46
+ '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
47
+ '<plist version="1.0">',
48
+ "<dict>",
49
+ "<key>__selector</key>",
50
+ `<string>${escapeXml(selector)}</string>`,
51
+ "<key>__argument</key>",
52
+ encodePlistValue(args),
53
+ "</dict>",
54
+ "</plist>"
55
+ ].join("");
56
+ const payload = Buffer.from(xml, "utf-8");
57
+ const header = Buffer.alloc(4);
58
+ header.writeUInt32BE(payload.length, 0);
59
+ return Buffer.concat([header, payload]);
60
+ }
61
+ function decodeWebInspectorFrames(buffer) {
62
+ const frames = [];
63
+ let offset = 0;
64
+ while (buffer.length - offset >= 4) {
65
+ const len = buffer.readUInt32BE(offset);
66
+ if (buffer.length - offset < 4 + len) break;
67
+ const payload = buffer.subarray(offset + 4, offset + 4 + len);
68
+ frames.push(payload.toString("utf-8"));
69
+ offset += 4 + len;
70
+ }
71
+ return {
72
+ frames,
73
+ remaining: buffer.subarray(offset)
74
+ };
75
+ }
76
+ function parseWebInspectorXmlFrame(xml) {
77
+ const selectorMatch = xml.match(/<key>__selector<\/key>\s*<string>([^<]+)<\/string>/);
78
+ const selector = selectorMatch?.[1] ?? null;
79
+ const appIdMatch = xml.match(
80
+ /<key>WIRApplicationIdentifierKey<\/key>\s*<string>([^<]+)<\/string>/
81
+ );
82
+ const appId = appIdMatch?.[1];
83
+ let messageDataJson;
84
+ const dataMatch = xml.match(/<key>WIRMessageDataKey<\/key>\s*<data>([\s\S]*?)<\/data>/);
85
+ if (dataMatch?.[1]) {
86
+ try {
87
+ const decoded = Buffer.from(dataMatch[1].replaceAll(/\s+/g, ""), "base64").toString("utf-8");
88
+ messageDataJson = JSON.parse(decoded);
89
+ } catch {
90
+ }
91
+ }
92
+ let pages;
93
+ if (selector === "_rpc_applicationSentListing:" && appId) {
94
+ pages = [];
95
+ const pageIdMatches = [
96
+ ...xml.matchAll(/<key>WIRPageIdentifierKey<\/key>\s*<integer>(\d+)<\/integer>/g)
97
+ ];
98
+ const urlMatches = [...xml.matchAll(/<key>WIRURLKey<\/key>\s*<string>([^<]*)<\/string>/g)];
99
+ const titleMatches = [...xml.matchAll(/<key>WIRTitleKey<\/key>\s*<string>([^<]*)<\/string>/g)];
100
+ for (let i = 0; i < pageIdMatches.length; i++) {
101
+ pages.push({
102
+ appId,
103
+ pageId: Number.parseInt(pageIdMatches[i][1], 10),
104
+ url: urlMatches[i]?.[1],
105
+ title: titleMatches[i]?.[1],
106
+ type: "WIRTypeWebPage"
107
+ });
108
+ }
109
+ }
110
+ return { selector, appId, messageDataJson, pages };
111
+ }
112
+ function findSimulatorWebInspectorSocket(udid) {
113
+ if (process.env["SIMULATOR_WEBINSPECTOR_SOCKET"]) {
114
+ const envSock = process.env["SIMULATOR_WEBINSPECTOR_SOCKET"];
115
+ if (existsSync(envSock)) return envSock;
116
+ }
117
+ try {
118
+ const out = execSync("launchctl getenv SIMULATOR_WEBINSPECTOR_SOCKET 2>/dev/null || true", {
119
+ encoding: "utf-8",
120
+ timeout: 2e3
121
+ }).trim();
122
+ if (out && existsSync(out)) return out;
123
+ } catch {
124
+ }
125
+ if (udid && process.env["HOME"]) {
126
+ const tmpDir = join(
127
+ process.env["HOME"],
128
+ "Library/Developer/CoreSimulator/Devices",
129
+ udid,
130
+ "data/tmp"
131
+ );
132
+ if (existsSync(tmpDir)) {
133
+ try {
134
+ const entry = readdirSync(tmpDir).find((f) => f.includes("webinspector"));
135
+ if (entry) return join(tmpDir, entry);
136
+ } catch {
137
+ }
138
+ }
139
+ }
140
+ return null;
141
+ }
142
+ var AppleWebInspectorClient = class {
143
+ socketPath;
144
+ bundleId;
145
+ timeoutMs;
146
+ connectSocket;
147
+ connectionId = randomUUID().toUpperCase();
148
+ senderKey = randomUUID().toUpperCase();
149
+ socket = null;
150
+ readBuffer = Buffer.alloc(0);
151
+ connected = false;
152
+ nextRpcId = 1;
153
+ pages = [];
154
+ activePage = null;
155
+ pendingRpc = /* @__PURE__ */ new Map();
156
+ listingWaiters = [];
157
+ constructor(options) {
158
+ this.socketPath = options.socketPath;
159
+ this.bundleId = options.bundleId;
160
+ this.timeoutMs = options.timeoutMs ?? 8e3;
161
+ this.connectSocket = options.connectSocket ?? ((p) => createConnection(p));
162
+ }
163
+ isConnected() {
164
+ return this.connected && this.socket !== null && !this.socket.destroyed;
165
+ }
166
+ async connect() {
167
+ if (this.isConnected()) return;
168
+ await new Promise((resolve, reject) => {
169
+ const sock = this.connectSocket(this.socketPath);
170
+ this.socket = sock;
171
+ let settled = false;
172
+ const timer = setTimeout(() => {
173
+ if (settled) return;
174
+ settled = true;
175
+ sock.destroy();
176
+ reject(new Error(`Apple webinspectord socket connect timed out (${this.socketPath})`));
177
+ }, this.timeoutMs);
178
+ sock.once("connect", () => {
179
+ if (settled) return;
180
+ settled = true;
181
+ clearTimeout(timer);
182
+ this.connected = true;
183
+ sock.write(
184
+ encodeWebInspectorPacket("_rpc_reportIdentifier:", {
185
+ WIRConnectionIdentifierKey: this.connectionId
186
+ })
187
+ );
188
+ resolve();
189
+ });
190
+ sock.once("error", (err) => {
191
+ if (!settled) {
192
+ settled = true;
193
+ clearTimeout(timer);
194
+ reject(err);
195
+ }
196
+ });
197
+ sock.on("data", (chunk) => {
198
+ this.readBuffer = Buffer.concat([this.readBuffer, chunk]);
199
+ const { frames, remaining } = decodeWebInspectorFrames(this.readBuffer);
200
+ this.readBuffer = remaining;
201
+ for (const frame of frames) {
202
+ this.handleFrame(frame);
203
+ }
204
+ });
205
+ sock.on("close", () => {
206
+ this.connected = false;
207
+ for (const [, p] of this.pendingRpc) {
208
+ clearTimeout(p.timer);
209
+ p.reject(new Error("Apple webinspectord socket closed"));
210
+ }
211
+ this.pendingRpc.clear();
212
+ });
213
+ });
214
+ }
215
+ handleFrame(xml) {
216
+ const parsed = parseWebInspectorXmlFrame(xml);
217
+ if (parsed.pages && parsed.pages.length > 0) {
218
+ this.pages = parsed.pages;
219
+ while (this.listingWaiters.length > 0) {
220
+ this.listingWaiters.shift()(this.pages);
221
+ }
222
+ return;
223
+ }
224
+ const msg = parsed.messageDataJson;
225
+ if (msg && typeof msg["id"] === "number") {
226
+ const entry = this.pendingRpc.get(msg["id"]);
227
+ if (!entry) return;
228
+ this.pendingRpc.delete(msg["id"]);
229
+ clearTimeout(entry.timer);
230
+ if (msg["error"]) {
231
+ entry.reject(new Error(msg["error"].message ?? JSON.stringify(msg["error"])));
232
+ } else {
233
+ entry.resolve(msg["result"]);
234
+ }
235
+ }
236
+ }
237
+ async listPages() {
238
+ if (!this.isConnected()) await this.connect();
239
+ if (this.pages.length > 0) return this.pages;
240
+ if (this.bundleId) {
241
+ this.socket.write(
242
+ encodeWebInspectorPacket("_rpc_forwardGetListing:", {
243
+ WIRConnectionIdentifierKey: this.connectionId,
244
+ WIRApplicationIdentifierKey: this.bundleId
245
+ })
246
+ );
247
+ }
248
+ return new Promise((resolve) => {
249
+ const timer = setTimeout(() => resolve(this.pages), 1500);
250
+ this.listingWaiters.push((pages) => {
251
+ clearTimeout(timer);
252
+ resolve(pages);
253
+ });
254
+ });
255
+ }
256
+ async ensurePageAttached() {
257
+ if (this.activePage) return this.activePage;
258
+ const pages = await this.listPages();
259
+ const chosen = pages.find((p) => p.url && p.url !== "about:blank") ?? pages[0];
260
+ if (!chosen) {
261
+ throw new Error(
262
+ `No inspectable WKWebView pages reported by webinspectord (${this.socketPath})`
263
+ );
264
+ }
265
+ this.activePage = chosen;
266
+ this.socket.write(
267
+ encodeWebInspectorPacket("_rpc_forwardSocketSetup:", {
268
+ WIRConnectionIdentifierKey: this.connectionId,
269
+ WIRApplicationIdentifierKey: chosen.appId,
270
+ WIRPageIdentifierKey: chosen.pageId,
271
+ WIRSenderKey: this.senderKey,
272
+ WIRAutomaticallyPause: false
273
+ })
274
+ );
275
+ return chosen;
276
+ }
277
+ async sendInspectorCommand(method, params = {}) {
278
+ const page = await this.ensurePageAttached();
279
+ const id = this.nextRpcId++;
280
+ const payload = Buffer.from(JSON.stringify({ id, method, params }), "utf-8");
281
+ return new Promise((resolve, reject) => {
282
+ const timer = setTimeout(() => {
283
+ this.pendingRpc.delete(id);
284
+ reject(new Error(`webinspectord command "${method}" timed out after ${this.timeoutMs}ms`));
285
+ }, this.timeoutMs);
286
+ this.pendingRpc.set(id, { resolve, reject, timer });
287
+ this.socket.write(
288
+ encodeWebInspectorPacket("_rpc_forwardSocketData:", {
289
+ WIRConnectionIdentifierKey: this.connectionId,
290
+ WIRApplicationIdentifierKey: page.appId,
291
+ WIRPageIdentifierKey: page.pageId,
292
+ WIRSenderKey: this.senderKey,
293
+ WIRSocketDataKey: payload
294
+ })
295
+ );
296
+ });
297
+ }
298
+ async disconnect() {
299
+ this.connected = false;
300
+ this.activePage = null;
301
+ if (this.socket) {
302
+ this.socket.destroy();
303
+ this.socket = null;
304
+ }
305
+ }
306
+ };
307
+
308
+ // src/channels/webkit-inspector.ts
309
+ init_esm_shims();
310
+ import { execSync as execSync2, spawn } from "child_process";
311
+ var WS_OPEN = 1;
312
+ function defaultWebSocketFactory(url) {
313
+ return new WebSocket(url);
314
+ }
315
+ function parseWebKitTargetListing(payload) {
316
+ if (!Array.isArray(payload)) return [];
317
+ const results = [];
318
+ for (const item of payload) {
319
+ if (!item || typeof item !== "object") continue;
320
+ const obj = item;
321
+ const id = String(obj["id"] ?? obj["pageId"] ?? obj["devtoolsFrontendUrl"] ?? "");
322
+ const wsUrl = typeof obj["webSocketDebuggerUrl"] === "string" ? obj["webSocketDebuggerUrl"] : typeof obj["wsUrl"] === "string" ? obj["wsUrl"] : void 0;
323
+ if (!id && !wsUrl) continue;
324
+ results.push({
325
+ id: id || wsUrl,
326
+ title: typeof obj["title"] === "string" ? obj["title"] : void 0,
327
+ url: typeof obj["url"] === "string" ? obj["url"] : void 0,
328
+ type: typeof obj["type"] === "string" ? obj["type"] : "page",
329
+ webSocketDebuggerUrl: wsUrl,
330
+ appId: typeof obj["appId"] === "string" ? obj["appId"] : void 0
331
+ });
332
+ }
333
+ return results;
334
+ }
335
+ function selectWebKitTarget(targets, bundleId) {
336
+ const attachable = targets.filter((t) => Boolean(t.webSocketDebuggerUrl));
337
+ if (attachable.length === 0) return void 0;
338
+ if (bundleId) {
339
+ const byBundle = attachable.find(
340
+ (t) => t.appId === bundleId || (t.url ?? "").includes(bundleId) || (t.title ?? "").includes(bundleId)
341
+ );
342
+ if (byBundle) return byBundle;
343
+ }
344
+ const nonBlank = attachable.find(
345
+ (t) => t.url && t.url !== "about:blank" && !t.url.startsWith("webkit-")
346
+ );
347
+ return nonBlank ?? attachable[0];
348
+ }
349
+ function isWebKitDebugProxyInstalled() {
350
+ try {
351
+ execSync2("which ios_webkit_debug_proxy", { stdio: "ignore" });
352
+ return true;
353
+ } catch {
354
+ return false;
355
+ }
356
+ }
357
+ var WebKitInspectorChannel = class {
358
+ kind = "webkit-inspector";
359
+ endpointUrl;
360
+ explicitWsUrl;
361
+ udid;
362
+ bundleId;
363
+ port;
364
+ autoStartProxy;
365
+ timeoutMs;
366
+ fetchFn;
367
+ createWebSocket;
368
+ ws = null;
369
+ nativeInspector = null;
370
+ proxyProcess = null;
371
+ connected = false;
372
+ nextId = 1;
373
+ pending = /* @__PURE__ */ new Map();
374
+ currentTargetId = null;
375
+ constructor(options = {}) {
376
+ this.port = options.port ?? 9221;
377
+ this.endpointUrl = (options.endpointUrl ?? `http://127.0.0.1:${this.port}`).replace(/\/+$/, "");
378
+ this.explicitWsUrl = options.webSocketUrl;
379
+ this.udid = options.udid;
380
+ this.bundleId = options.bundleId;
381
+ this.autoStartProxy = options.autoStartProxy ?? false;
382
+ this.timeoutMs = options.timeoutMs ?? 1e4;
383
+ this.fetchFn = options.fetchFn ?? fetch;
384
+ this.createWebSocket = options.createWebSocket ?? defaultWebSocketFactory;
385
+ }
386
+ isConnected() {
387
+ return this.connected && this.ws !== null && this.ws.readyState === WS_OPEN || (this.nativeInspector?.isConnected() ?? false);
388
+ }
389
+ async ensureProxyIfNeeded() {
390
+ if (!this.autoStartProxy || this.proxyProcess || !this.udid) return;
391
+ if (!isWebKitDebugProxyInstalled()) return;
392
+ try {
393
+ const probe = await this.fetchFn(`${this.endpointUrl}/json`);
394
+ if (probe.ok) return;
395
+ } catch {
396
+ }
397
+ const proc = spawn("ios_webkit_debug_proxy", ["-c", `${this.udid}:${this.port}`, "-d"], {
398
+ stdio: "ignore",
399
+ detached: true
400
+ });
401
+ proc.unref();
402
+ this.proxyProcess = proc;
403
+ const deadline = Date.now() + 3e3;
404
+ while (Date.now() < deadline) {
405
+ try {
406
+ const res = await this.fetchFn(`${this.endpointUrl}/json`);
407
+ if (res.ok) return;
408
+ } catch {
409
+ }
410
+ await new Promise((r) => setTimeout(r, 150));
411
+ }
412
+ }
413
+ async fetchTargets() {
414
+ for (const path of ["/json", "/json/list"]) {
415
+ try {
416
+ const res = await this.fetchFn(`${this.endpointUrl}${path}`);
417
+ if (!res.ok) continue;
418
+ const data = await res.json();
419
+ const parsed = parseWebKitTargetListing(data);
420
+ if (parsed.length > 0 || Array.isArray(data)) {
421
+ return parsed;
422
+ }
423
+ } catch {
424
+ }
425
+ }
426
+ throw new Error(
427
+ `WebKit Inspector unreachable at ${this.endpointUrl}. Ensure WKWebView.isInspectable = true (iOS 16.4+) and start ios_webkit_debug_proxy (or use spana-bridge for zero-protocol DOM access).`
428
+ );
429
+ }
430
+ async listTargets() {
431
+ await this.ensureProxyIfNeeded();
432
+ const targets = await this.fetchTargets();
433
+ return targets.map((t) => ({
434
+ id: t.id,
435
+ title: t.title,
436
+ url: t.url,
437
+ type: t.type
438
+ }));
439
+ }
440
+ async selectTarget(targetId) {
441
+ const targets = await this.fetchTargets();
442
+ const match = targets.find((t) => t.id === targetId && t.webSocketDebuggerUrl);
443
+ if (!match?.webSocketDebuggerUrl) {
444
+ throw new Error(`WebKit Inspector: target "${targetId}" not found`);
445
+ }
446
+ await this.disconnectSocketOnly();
447
+ this.currentTargetId = match.id;
448
+ await this.openSocket(match.webSocketDebuggerUrl);
449
+ }
450
+ async connect() {
451
+ if (this.isConnected()) return;
452
+ let wsUrl = this.explicitWsUrl;
453
+ if (!wsUrl) {
454
+ await this.ensureProxyIfNeeded();
455
+ try {
456
+ const targets = await this.fetchTargets();
457
+ const chosen = selectWebKitTarget(targets, this.bundleId);
458
+ if (!chosen?.webSocketDebuggerUrl) {
459
+ throw new Error(
460
+ `WebKit Inspector: no inspectable WKWebView page found at ${this.endpointUrl}. Verify webView.isInspectable = true on iOS 16.4+.`
461
+ );
462
+ }
463
+ this.currentTargetId = chosen.id;
464
+ wsUrl = chosen.webSocketDebuggerUrl;
465
+ } catch (proxyErr) {
466
+ const nativeSock = findSimulatorWebInspectorSocket(this.udid);
467
+ if (!nativeSock) {
468
+ throw proxyErr;
469
+ }
470
+ this.nativeInspector = new AppleWebInspectorClient({
471
+ socketPath: nativeSock,
472
+ bundleId: this.bundleId,
473
+ timeoutMs: this.timeoutMs
474
+ });
475
+ await this.nativeInspector.connect();
476
+ await this.nativeInspector.ensurePageAttached();
477
+ return;
478
+ }
479
+ }
480
+ await this.openSocket(wsUrl);
481
+ }
482
+ async openSocket(wsUrl) {
483
+ await new Promise((resolve, reject) => {
484
+ const ws = this.createWebSocket(wsUrl);
485
+ this.ws = ws;
486
+ let settled = false;
487
+ const timer = setTimeout(() => {
488
+ if (settled) return;
489
+ settled = true;
490
+ reject(
491
+ new Error(`WebKit Inspector connection to ${wsUrl} timed out after ${this.timeoutMs}ms`)
492
+ );
493
+ }, this.timeoutMs);
494
+ const onOpen = () => {
495
+ if (settled) return;
496
+ settled = true;
497
+ clearTimeout(timer);
498
+ this.connected = true;
499
+ resolve();
500
+ };
501
+ const onError = (err) => {
502
+ const error = new Error(
503
+ `WebKit Inspector WebSocket error: ${err instanceof Error ? err.message : String(err)}`
504
+ );
505
+ if (!settled) {
506
+ settled = true;
507
+ clearTimeout(timer);
508
+ reject(error);
509
+ }
510
+ };
511
+ const onClose = () => {
512
+ this.connected = false;
513
+ this.rejectAllPending(new Error("WebKit Inspector WebSocket closed"));
514
+ };
515
+ const onMessage = (event) => {
516
+ const raw = typeof event.data === "string" ? event.data : String(event.data ?? "");
517
+ let parsed;
518
+ try {
519
+ parsed = JSON.parse(raw);
520
+ } catch {
521
+ return;
522
+ }
523
+ const id = parsed["id"];
524
+ if (typeof id === "number") {
525
+ const entry = this.pending.get(id);
526
+ if (!entry) return;
527
+ this.pending.delete(id);
528
+ clearTimeout(entry.timer);
529
+ if (parsed["error"]) {
530
+ const msg = parsed["error"].message ?? JSON.stringify(parsed["error"]);
531
+ entry.reject(new Error(`WebKit Inspector error: ${msg}`));
532
+ } else {
533
+ entry.resolve(parsed["result"]);
534
+ }
535
+ }
536
+ };
537
+ ws.addEventListener("open", onOpen);
538
+ ws.addEventListener("error", onError);
539
+ ws.addEventListener("close", onClose);
540
+ ws.addEventListener("message", onMessage);
541
+ if (ws.readyState === WS_OPEN) {
542
+ onOpen();
543
+ }
544
+ });
545
+ }
546
+ rejectAllPending(error) {
547
+ for (const [, entry] of this.pending) {
548
+ clearTimeout(entry.timer);
549
+ entry.reject(error);
550
+ }
551
+ this.pending.clear();
552
+ }
553
+ async sendCommand(method, params = {}) {
554
+ if (!this.isConnected()) {
555
+ await this.connect();
556
+ }
557
+ if (this.nativeInspector?.isConnected()) {
558
+ return this.nativeInspector.sendInspectorCommand(method, params);
559
+ }
560
+ const ws = this.ws;
561
+ const id = this.nextId++;
562
+ return new Promise((resolve, reject) => {
563
+ const timer = setTimeout(() => {
564
+ this.pending.delete(id);
565
+ reject(
566
+ new Error(`WebKit Inspector command "${method}" timed out after ${this.timeoutMs}ms`)
567
+ );
568
+ }, this.timeoutMs);
569
+ this.pending.set(id, { resolve, reject, timer });
570
+ ws.send(JSON.stringify({ id, method, params }));
571
+ });
572
+ }
573
+ async evaluate(script, ...args) {
574
+ const expression = buildEvaluateExpression(script, args);
575
+ const response = await this.sendCommand("Runtime.evaluate", {
576
+ expression,
577
+ returnByValue: true,
578
+ awaitPromise: true,
579
+ includeCommandLineAPI: false
580
+ });
581
+ if (response?.wasThrown) {
582
+ throw new Error(
583
+ `WebKit Inspector evaluate failed: ${response.result?.description ?? "Evaluation threw"}`
584
+ );
585
+ }
586
+ if (response?.exceptionDetails) {
587
+ const detail = response.exceptionDetails.exception?.description ?? response.exceptionDetails.text ?? "Evaluation threw";
588
+ throw new Error(`WebKit Inspector evaluate failed: ${detail}`);
589
+ }
590
+ return response?.result?.value;
591
+ }
592
+ async query(selector) {
593
+ const result = await this.evaluate(buildDomQueryScript(selector));
594
+ return Array.isArray(result) ? result : [];
595
+ }
596
+ async tapDom(selector) {
597
+ const result = await this.evaluate(buildDomTapScript(selector));
598
+ return Boolean(result);
599
+ }
600
+ async scrollIntoView(selector) {
601
+ const result = await this.evaluate(
602
+ buildDomScrollIntoViewScript(selector)
603
+ );
604
+ return result ?? null;
605
+ }
606
+ async reload() {
607
+ await this.sendCommand("Page.reload", { ignoreCache: false }).catch(async () => {
608
+ await this.evaluate("window.location.reload()");
609
+ });
610
+ }
611
+ async disconnectSocketOnly() {
612
+ this.connected = false;
613
+ this.rejectAllPending(new Error("WebKit Inspector disconnected"));
614
+ if (this.ws) {
615
+ try {
616
+ this.ws.close();
617
+ } catch {
618
+ }
619
+ this.ws = null;
620
+ }
621
+ if (this.nativeInspector) {
622
+ await this.nativeInspector.disconnect();
623
+ this.nativeInspector = null;
624
+ }
625
+ }
626
+ async disconnect() {
627
+ await this.disconnectSocketOnly();
628
+ if (this.proxyProcess) {
629
+ try {
630
+ this.proxyProcess.kill();
631
+ } catch {
632
+ }
633
+ this.proxyProcess = null;
634
+ }
635
+ }
636
+ get targetId() {
637
+ return this.currentTargetId;
638
+ }
639
+ };
640
+ function createWebKitInspectorChannel(options = {}) {
641
+ return new WebKitInspectorChannel(options);
642
+ }
643
+
644
+ export {
645
+ encodeWebInspectorPacket,
646
+ decodeWebInspectorFrames,
647
+ parseWebInspectorXmlFrame,
648
+ findSimulatorWebInspectorSocket,
649
+ AppleWebInspectorClient,
650
+ isWebKitDebugProxyInstalled,
651
+ WebKitInspectorChannel,
652
+ createWebKitInspectorChannel
653
+ };
654
+ //# sourceMappingURL=chunk-LKGF75QJ.js.map