spana-test 0.16.0 → 0.17.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 (286) hide show
  1. package/dist/accessibility-audit-IWTD2HPR.js +17 -0
  2. package/dist/agent/index.js +35 -33
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/{agent-fixture-H6GOUHNX.js → agent-fixture-WQVCNL73.js} +4 -3
  5. package/dist/{allure-XOM7BXL5.js → allure-LF4CALKP.js} +3 -2
  6. package/dist/{allure-XOM7BXL5.js.map → allure-LF4CALKP.js.map} +1 -1
  7. package/dist/{android-C2S4B4TH.js → android-TPO53H5Q.js} +4 -3
  8. package/dist/api/app.d.ts +76 -13
  9. package/dist/api/app.d.ts.map +1 -1
  10. package/dist/api/expect.d.ts +1 -0
  11. package/dist/api/expect.d.ts.map +1 -1
  12. package/dist/api/flow.d.ts +37 -14
  13. package/dist/api/flow.d.ts.map +1 -1
  14. package/dist/app-TX4RYRBY.js +17 -0
  15. package/dist/{appium-CC77BJNK.js → appium-OI2CQON6.js} +13 -12
  16. package/dist/{appium-CC77BJNK.js.map → appium-OI2CQON6.js.map} +1 -1
  17. package/dist/{appium-server-M6CWWUWF.js → appium-server-CCTQQGTV.js} +3 -2
  18. package/dist/{appium-server-M6CWWUWF.js.map → appium-server-CCTQQGTV.js.map} +1 -1
  19. package/dist/{baseline-manager-LVUVH2MJ.js → baseline-manager-XJ3LADKC.js} +3 -2
  20. package/dist/{baseline-manager-LVUVH2MJ.js.map → baseline-manager-XJ3LADKC.js.map} +1 -1
  21. package/dist/bridge-server-X5W4PCAR.js +13 -0
  22. package/dist/cache-command-OMV6DPC7.js +13 -0
  23. package/dist/channels/cdp-client.d.ts +15 -2
  24. package/dist/channels/cdp-client.d.ts.map +1 -1
  25. package/dist/channels/dom-channel.d.ts +28 -1
  26. package/dist/channels/dom-channel.d.ts.map +1 -1
  27. package/dist/{chunk-GMEVJQTT.js → chunk-22VPSGCA.js} +5 -4
  28. package/dist/{chunk-GMEVJQTT.js.map → chunk-22VPSGCA.js.map} +1 -1
  29. package/dist/{chunk-WJH5K42V.js → chunk-3HQKY24K.js} +4 -3
  30. package/dist/{chunk-WJH5K42V.js.map → chunk-3HQKY24K.js.map} +1 -1
  31. package/dist/{chunk-7O5YXVCD.js → chunk-3NZRRXDP.js} +4 -3
  32. package/dist/{chunk-7O5YXVCD.js.map → chunk-3NZRRXDP.js.map} +1 -1
  33. package/dist/{chunk-HJZT6YOA.js → chunk-4GESFVZL.js} +6 -5
  34. package/dist/{chunk-HJZT6YOA.js.map → chunk-4GESFVZL.js.map} +1 -1
  35. package/dist/{chunk-4LJ3KYCX.js → chunk-5DSPPJ76.js} +4 -3
  36. package/dist/{chunk-4LJ3KYCX.js.map → chunk-5DSPPJ76.js.map} +1 -1
  37. package/dist/{accessibility-audit-F5KLUHLS.js → chunk-5TAHLRZD.js} +8 -5
  38. package/dist/chunk-5TAHLRZD.js.map +1 -0
  39. package/dist/{chunk-7K7WVTFZ.js → chunk-7YJBZ4HB.js} +19 -18
  40. package/dist/{chunk-7K7WVTFZ.js.map → chunk-7YJBZ4HB.js.map} +1 -1
  41. package/dist/{chunk-2MA5G2VH.js → chunk-AGG2RJGU.js} +4 -3
  42. package/dist/{chunk-2MA5G2VH.js.map → chunk-AGG2RJGU.js.map} +1 -1
  43. package/dist/{chunk-NWGA3R2E.js → chunk-B4FOISOF.js} +3 -2
  44. package/dist/{chunk-NWGA3R2E.js.map → chunk-B4FOISOF.js.map} +1 -1
  45. package/dist/{chunk-7Q7TSUNL.js → chunk-B6NTHBPF.js} +3 -2
  46. package/dist/{chunk-7Q7TSUNL.js.map → chunk-B6NTHBPF.js.map} +1 -1
  47. package/dist/{chunk-CA66JCX2.js → chunk-CR55BHI2.js} +729 -187
  48. package/dist/chunk-CR55BHI2.js.map +1 -0
  49. package/dist/{chunk-JRGJTUPS.js → chunk-CXXK3JAI.js} +5 -4
  50. package/dist/{chunk-JRGJTUPS.js.map → chunk-CXXK3JAI.js.map} +1 -1
  51. package/dist/{chunk-GDVHJBR2.js → chunk-CZAFFUMN.js} +5 -4
  52. package/dist/{chunk-GDVHJBR2.js.map → chunk-CZAFFUMN.js.map} +1 -1
  53. package/dist/{chunk-FSPMFRJO.js → chunk-FBJPNZUN.js} +3 -2
  54. package/dist/{chunk-FSPMFRJO.js.map → chunk-FBJPNZUN.js.map} +1 -1
  55. package/dist/{chunk-HIEOI3WN.js → chunk-FCUT3OKD.js} +261 -51
  56. package/dist/chunk-FCUT3OKD.js.map +1 -0
  57. package/dist/{chunk-WBCAF7SC.js → chunk-FPCMRYOS.js} +283 -152
  58. package/dist/chunk-FPCMRYOS.js.map +1 -0
  59. package/dist/{chunk-6C2EILMC.js → chunk-FWFT3FEP.js} +3 -2
  60. package/dist/{chunk-6C2EILMC.js.map → chunk-FWFT3FEP.js.map} +1 -1
  61. package/dist/{chunk-X5FRYDZ3.js → chunk-GACJRITH.js} +4 -3
  62. package/dist/{chunk-X5FRYDZ3.js.map → chunk-GACJRITH.js.map} +1 -1
  63. package/dist/{chunk-EA7DZ5TN.js → chunk-GS7DRAOQ.js} +38 -4
  64. package/dist/chunk-GS7DRAOQ.js.map +1 -0
  65. package/dist/{chunk-K4K2ACT2.js → chunk-H5ZMLSVC.js} +8 -7
  66. package/dist/chunk-H5ZMLSVC.js.map +1 -0
  67. package/dist/{chunk-5WPPWTC3.js → chunk-HFQ3KKIB.js} +1620 -528
  68. package/dist/chunk-HFQ3KKIB.js.map +1 -0
  69. package/dist/{chunk-MUMIMDRJ.js → chunk-IKMNHITS.js} +3 -2
  70. package/dist/{chunk-MUMIMDRJ.js.map → chunk-IKMNHITS.js.map} +1 -1
  71. package/dist/{chunk-UZU7VYKN.js → chunk-KRATI3A5.js} +169 -28
  72. package/dist/chunk-KRATI3A5.js.map +1 -0
  73. package/dist/{chunk-TFEXYI6N.js → chunk-KRTQZPYL.js} +3 -2
  74. package/dist/{chunk-TFEXYI6N.js.map → chunk-KRTQZPYL.js.map} +1 -1
  75. package/dist/{chunk-ZCSH3QKX.js → chunk-L5EVAGCV.js} +1188 -891
  76. package/dist/chunk-L5EVAGCV.js.map +1 -0
  77. package/dist/{chunk-MPJCUL2B.js → chunk-MQRGWQI5.js} +3 -2
  78. package/dist/{chunk-MPJCUL2B.js.map → chunk-MQRGWQI5.js.map} +1 -1
  79. package/dist/{chunk-ZIETAMAD.js → chunk-NQYTD3JG.js} +3 -2
  80. package/dist/{chunk-ZIETAMAD.js.map → chunk-NQYTD3JG.js.map} +1 -1
  81. package/dist/{chunk-YFTHJRDO.js → chunk-ODRB22QA.js} +3 -2
  82. package/dist/{chunk-YFTHJRDO.js.map → chunk-ODRB22QA.js.map} +1 -1
  83. package/dist/{chunk-KIFNHFFI.js → chunk-OKU46IDG.js} +273 -33
  84. package/dist/chunk-OKU46IDG.js.map +1 -0
  85. package/dist/{chunk-HNQLWFHL.js → chunk-OYME74M3.js} +3 -2
  86. package/dist/{chunk-HNQLWFHL.js.map → chunk-OYME74M3.js.map} +1 -1
  87. package/dist/{chunk-62SDNQKK.js → chunk-QJPIPZ4S.js} +7 -6
  88. package/dist/{chunk-62SDNQKK.js.map → chunk-QJPIPZ4S.js.map} +1 -1
  89. package/dist/{chunk-UKUXNFQP.js → chunk-QU365GZA.js} +3 -2
  90. package/dist/{chunk-UKUXNFQP.js.map → chunk-QU365GZA.js.map} +1 -1
  91. package/dist/{chunk-HIGFQRWM.js → chunk-R52P4KQC.js} +3 -2
  92. package/dist/{chunk-HIGFQRWM.js.map → chunk-R52P4KQC.js.map} +1 -1
  93. package/dist/{chunk-U56N5JCJ.js → chunk-RL3ICBAB.js} +3 -2
  94. package/dist/{chunk-U56N5JCJ.js.map → chunk-RL3ICBAB.js.map} +1 -1
  95. package/dist/{chunk-HUYC4OAL.js → chunk-RQRJ2I2Z.js} +3 -2
  96. package/dist/{chunk-HUYC4OAL.js.map → chunk-RQRJ2I2Z.js.map} +1 -1
  97. package/dist/{chunk-LGFTUVN4.js → chunk-RXQKH6Z7.js} +11 -10
  98. package/dist/{chunk-LGFTUVN4.js.map → chunk-RXQKH6Z7.js.map} +1 -1
  99. package/dist/{chunk-NXET4BFJ.js → chunk-SPGD4QGA.js} +3 -2
  100. package/dist/{chunk-NXET4BFJ.js.map → chunk-SPGD4QGA.js.map} +1 -1
  101. package/dist/{chunk-XVL4FHXA.js → chunk-T46S4VA3.js} +3 -2
  102. package/dist/{chunk-XVL4FHXA.js.map → chunk-T46S4VA3.js.map} +1 -1
  103. package/dist/{chunk-GLNTGHR6.js → chunk-T7Z2T3NP.js} +4 -3
  104. package/dist/{chunk-GLNTGHR6.js.map → chunk-T7Z2T3NP.js.map} +1 -1
  105. package/dist/{chunk-RIXZISMX.js → chunk-V6PEMZCL.js} +3 -2
  106. package/dist/{chunk-RIXZISMX.js.map → chunk-V6PEMZCL.js.map} +1 -1
  107. package/dist/{chunk-FTXUQMGH.js → chunk-VBAPZMPX.js} +2 -1
  108. package/dist/{chunk-FTXUQMGH.js.map → chunk-VBAPZMPX.js.map} +1 -1
  109. package/dist/{chunk-DMF2BPPA.js → chunk-VILLVGBP.js} +3 -2
  110. package/dist/{chunk-DMF2BPPA.js.map → chunk-VILLVGBP.js.map} +1 -1
  111. package/dist/{chunk-A7Z52TDQ.js → chunk-WPG77TPT.js} +3 -2
  112. package/dist/{chunk-A7Z52TDQ.js.map → chunk-WPG77TPT.js.map} +1 -1
  113. package/dist/{chunk-7WHQIQPM.js → chunk-WZY3MBNG.js} +3 -2
  114. package/dist/{chunk-7WHQIQPM.js.map → chunk-WZY3MBNG.js.map} +1 -1
  115. package/dist/{chunk-XD6A3VXB.js → chunk-X5W7LV2O.js} +8 -7
  116. package/dist/chunk-X5W7LV2O.js.map +1 -0
  117. package/dist/{chunk-4TYO6O7T.js → chunk-XG6UF6BP.js} +12 -11
  118. package/dist/{chunk-4TYO6O7T.js.map → chunk-XG6UF6BP.js.map} +1 -1
  119. package/dist/{chunk-NHT3XSX3.js → chunk-XGXOE3DF.js} +3 -2
  120. package/dist/{chunk-NHT3XSX3.js.map → chunk-XGXOE3DF.js.map} +1 -1
  121. package/dist/{chunk-PRQTAIYA.js → chunk-XPEWAHAK.js} +4 -3
  122. package/dist/{chunk-PRQTAIYA.js.map → chunk-XPEWAHAK.js.map} +1 -1
  123. package/dist/{chunk-FHCOPLYB.js → chunk-YNA6LFBF.js} +3 -2
  124. package/dist/{chunk-FHCOPLYB.js.map → chunk-YNA6LFBF.js.map} +1 -1
  125. package/dist/{chunk-HWS3XUEF.js → chunk-YWASMWPK.js} +5 -4
  126. package/dist/{chunk-HWS3XUEF.js.map → chunk-YWASMWPK.js.map} +1 -1
  127. package/dist/cli/test-command.d.ts +2 -0
  128. package/dist/cli/test-command.d.ts.map +1 -1
  129. package/dist/cli.js +102 -35
  130. package/dist/cli.js.map +1 -1
  131. package/dist/{compiler-44UW2FID.js → compiler-UOVKUQHE.js} +4 -3
  132. package/dist/{compiler-44UW2FID.js.map → compiler-UOVKUQHE.js.map} +1 -1
  133. package/dist/config-loader-OSHDDKH5.js +11 -0
  134. package/dist/{console-T6TVZ65G.js → console-OHKVJLW3.js} +39 -6
  135. package/dist/console-OHKVJLW3.js.map +1 -0
  136. package/dist/core/accessibility-audit.d.ts.map +1 -1
  137. package/dist/core/engine.d.ts +1 -1
  138. package/dist/core/engine.d.ts.map +1 -1
  139. package/dist/core/orchestrator.d.ts +1 -0
  140. package/dist/core/orchestrator.d.ts.map +1 -1
  141. package/dist/core/projects.d.ts +10 -6
  142. package/dist/core/projects.d.ts.map +1 -1
  143. package/dist/{daemon-manager-2SK5PHJR.js → daemon-manager-VEMRSZ5R.js} +4 -3
  144. package/dist/discover-AHMM7QLN.js +16 -0
  145. package/dist/{doctor-command-UUQ4RFMK.js → doctor-command-2O4VK3QR.js} +17 -16
  146. package/dist/{doctor-command-UUQ4RFMK.js.map → doctor-command-2O4VK3QR.js.map} +1 -1
  147. package/dist/driver-BHHIEDX6.js +20 -0
  148. package/dist/driver-ZVDLV6QF.js +20 -0
  149. package/dist/drivers/cdp-browser.d.ts +21 -2
  150. package/dist/drivers/cdp-browser.d.ts.map +1 -1
  151. package/dist/drivers/cdp-embed.d.ts +104 -0
  152. package/dist/drivers/cdp-embed.d.ts.map +1 -0
  153. package/dist/drivers/playwright.d.ts +16 -7
  154. package/dist/drivers/playwright.d.ts.map +1 -1
  155. package/dist/drivers/raw-driver.d.ts +36 -3
  156. package/dist/drivers/raw-driver.d.ts.map +1 -1
  157. package/dist/electrobun-4Z66F5NW.js +16 -0
  158. package/dist/electron-ZXM6SMZU.js +10 -0
  159. package/dist/{filters-5DCGGJRN.js → filters-6W73R3IV.js} +4 -3
  160. package/dist/gherkin/steps.js +3 -2
  161. package/dist/gherkin/steps.js.map +1 -1
  162. package/dist/github-pr-XZZZ3YE6.js +11 -0
  163. package/dist/{html-KJ2QAGF4.js → html-GDWXFYFL.js} +4 -3
  164. package/dist/{html-KJ2QAGF4.js.map → html-GDWXFYFL.js.map} +1 -1
  165. package/dist/index.d.ts +8 -5
  166. package/dist/index.d.ts.map +1 -1
  167. package/dist/index.js +200 -84
  168. package/dist/index.js.map +1 -1
  169. package/dist/{init-command-V5VGN3IS.js → init-command-PYZ5X6M5.js} +3 -2
  170. package/dist/{init-command-V5VGN3IS.js.map → init-command-PYZ5X6M5.js.map} +1 -1
  171. package/dist/{init-flow-command-INYUCC6N.js → init-flow-command-SLLEGSRZ.js} +4 -3
  172. package/dist/{init-flow-command-INYUCC6N.js.map → init-flow-command-SLLEGSRZ.js.map} +1 -1
  173. package/dist/installer-6HV5CU2I.js +18 -0
  174. package/dist/{installer-DMTY47SI.js → installer-DYGA4MRU.js} +6 -5
  175. package/dist/{ios-SZ4RBI7Q.js → ios-YFRAK2CL.js} +5 -4
  176. package/dist/{json-67HY4VQK.js → json-QVHG6I3O.js} +3 -2
  177. package/dist/{json-67HY4VQK.js.map → json-QVHG6I3O.js.map} +1 -1
  178. package/dist/{junit-MHD5AXBU.js → junit-G5LNOYUL.js} +3 -2
  179. package/dist/{junit-MHD5AXBU.js.map → junit-G5LNOYUL.js.map} +1 -1
  180. package/dist/local-OYNEJSSQ.js +37 -0
  181. package/dist/{machine-NOOFRT45.js → machine-VEVBT2GU.js} +4 -3
  182. package/dist/pagesource-GQLIXL5R.js +10 -0
  183. package/dist/pagesource-HKLE3FZN.js +10 -0
  184. package/dist/playwright-SZP56NN2.js +29 -0
  185. package/dist/provider-FKT6FEQS.js +13 -0
  186. package/dist/{redact-OG4M3IEU.js → redact-YWR6GHBX.js} +3 -2
  187. package/dist/{redact-OG4M3IEU.js.map → redact-YWR6GHBX.js.map} +1 -1
  188. package/dist/report/console.d.ts +2 -0
  189. package/dist/report/console.d.ts.map +1 -1
  190. package/dist/report/types.d.ts +2 -0
  191. package/dist/report/types.d.ts.map +1 -1
  192. package/dist/{runner-ABGUVOJG.js → runner-P2BFG4VZ.js} +4 -3
  193. package/dist/runtime/local.d.ts +13 -0
  194. package/dist/runtime/local.d.ts.map +1 -1
  195. package/dist/runtime/web-server.d.ts +5 -1
  196. package/dist/runtime/web-server.d.ts.map +1 -1
  197. package/dist/schemas/config.d.ts +74 -5
  198. package/dist/schemas/config.d.ts.map +1 -1
  199. package/dist/schemas/selector.d.ts +6 -2
  200. package/dist/schemas/selector.d.ts.map +1 -1
  201. package/dist/screenshot-compare-7TE44H7F.js +13 -0
  202. package/dist/{server-RTDMJIQZ.js → server-7QYNULRB.js} +36 -34
  203. package/dist/{server-RTDMJIQZ.js.map → server-7QYNULRB.js.map} +1 -1
  204. package/dist/server-VIXRVKP5.js +15 -0
  205. package/dist/session-3KME2U42.js +41 -0
  206. package/dist/smart/auto-wait.d.ts.map +1 -1
  207. package/dist/smart/coordinator.d.ts +11 -2
  208. package/dist/smart/coordinator.d.ts.map +1 -1
  209. package/dist/smart/diagnostics.d.ts.map +1 -1
  210. package/dist/smart/element-matcher.d.ts.map +1 -1
  211. package/dist/{studio-command-PZHMLCKE.js → studio-command-ALDWIKEE.js} +4 -3
  212. package/dist/{studio-command-PZHMLCKE.js.map → studio-command-ALDWIKEE.js.map} +1 -1
  213. package/dist/{test-command-FJOP2GYD.js → test-command-HP5YE675.js} +444 -83
  214. package/dist/test-command-HP5YE675.js.map +1 -0
  215. package/dist/validator-6XP3PGCP.js +18 -0
  216. package/dist/watch-mode-HWZ4XCKH.js +11 -0
  217. package/dist/watch-mode-HWZ4XCKH.js.map +1 -0
  218. package/native/darwin-arm64/libspana_native.dylib +0 -0
  219. package/native/darwin-x64/libspana_native.dylib +0 -0
  220. package/native/linux-arm64/libspana_native.so +0 -0
  221. package/native/linux-x64/libspana_native.so +0 -0
  222. package/native/win32-x64/spana_native.dll +0 -0
  223. package/package.json +1 -1
  224. package/dist/accessibility-audit-F5KLUHLS.js.map +0 -1
  225. package/dist/app-C353NGBT.js +0 -13
  226. package/dist/bridge-server-S3DHK7XE.js +0 -12
  227. package/dist/cache-command-OL7HUK2K.js +0 -12
  228. package/dist/chunk-5WPPWTC3.js.map +0 -1
  229. package/dist/chunk-CA66JCX2.js.map +0 -1
  230. package/dist/chunk-EA7DZ5TN.js.map +0 -1
  231. package/dist/chunk-HIEOI3WN.js.map +0 -1
  232. package/dist/chunk-K4K2ACT2.js.map +0 -1
  233. package/dist/chunk-KIFNHFFI.js.map +0 -1
  234. package/dist/chunk-UZU7VYKN.js.map +0 -1
  235. package/dist/chunk-WBCAF7SC.js.map +0 -1
  236. package/dist/chunk-XD6A3VXB.js.map +0 -1
  237. package/dist/chunk-ZCSH3QKX.js.map +0 -1
  238. package/dist/config-loader-TSADVSBY.js +0 -10
  239. package/dist/console-T6TVZ65G.js.map +0 -1
  240. package/dist/discover-6ULCTB5T.js +0 -15
  241. package/dist/driver-3HBDKESK.js +0 -19
  242. package/dist/driver-LKXSKNG3.js +0 -19
  243. package/dist/electrobun-HILYDIJ3.js +0 -15
  244. package/dist/electron-SQACDON3.js +0 -9
  245. package/dist/github-pr-RYO6IAKD.js +0 -10
  246. package/dist/installer-KL2NCILK.js +0 -17
  247. package/dist/local-J2NC6YKI.js +0 -30
  248. package/dist/pagesource-KIQ5T5MA.js +0 -9
  249. package/dist/pagesource-KKG7WMFJ.js +0 -9
  250. package/dist/playwright-JMHCABDJ.js +0 -28
  251. package/dist/provider-CBAXZ2VA.js +0 -12
  252. package/dist/screenshot-compare-BJRJHKNQ.js +0 -12
  253. package/dist/server-RHAHCANZ.js +0 -14
  254. package/dist/session-7CWHTQ2E.js +0 -39
  255. package/dist/test-command-FJOP2GYD.js.map +0 -1
  256. package/dist/validator-AJNOFBQM.js +0 -17
  257. package/dist/watch-mode-NR5MHNNL.js +0 -10
  258. /package/dist/{agent-fixture-H6GOUHNX.js.map → accessibility-audit-IWTD2HPR.js.map} +0 -0
  259. /package/dist/{android-C2S4B4TH.js.map → agent-fixture-WQVCNL73.js.map} +0 -0
  260. /package/dist/{app-C353NGBT.js.map → android-TPO53H5Q.js.map} +0 -0
  261. /package/dist/{bridge-server-S3DHK7XE.js.map → app-TX4RYRBY.js.map} +0 -0
  262. /package/dist/{cache-command-OL7HUK2K.js.map → bridge-server-X5W4PCAR.js.map} +0 -0
  263. /package/dist/{config-loader-TSADVSBY.js.map → cache-command-OMV6DPC7.js.map} +0 -0
  264. /package/dist/{daemon-manager-2SK5PHJR.js.map → config-loader-OSHDDKH5.js.map} +0 -0
  265. /package/dist/{discover-6ULCTB5T.js.map → daemon-manager-VEMRSZ5R.js.map} +0 -0
  266. /package/dist/{driver-3HBDKESK.js.map → discover-AHMM7QLN.js.map} +0 -0
  267. /package/dist/{driver-LKXSKNG3.js.map → driver-BHHIEDX6.js.map} +0 -0
  268. /package/dist/{electrobun-HILYDIJ3.js.map → driver-ZVDLV6QF.js.map} +0 -0
  269. /package/dist/{electron-SQACDON3.js.map → electrobun-4Z66F5NW.js.map} +0 -0
  270. /package/dist/{filters-5DCGGJRN.js.map → electron-ZXM6SMZU.js.map} +0 -0
  271. /package/dist/{github-pr-RYO6IAKD.js.map → filters-6W73R3IV.js.map} +0 -0
  272. /package/dist/{installer-DMTY47SI.js.map → github-pr-XZZZ3YE6.js.map} +0 -0
  273. /package/dist/{installer-KL2NCILK.js.map → installer-6HV5CU2I.js.map} +0 -0
  274. /package/dist/{ios-SZ4RBI7Q.js.map → installer-DYGA4MRU.js.map} +0 -0
  275. /package/dist/{local-J2NC6YKI.js.map → ios-YFRAK2CL.js.map} +0 -0
  276. /package/dist/{machine-NOOFRT45.js.map → local-OYNEJSSQ.js.map} +0 -0
  277. /package/dist/{pagesource-KIQ5T5MA.js.map → machine-VEVBT2GU.js.map} +0 -0
  278. /package/dist/{pagesource-KKG7WMFJ.js.map → pagesource-GQLIXL5R.js.map} +0 -0
  279. /package/dist/{playwright-JMHCABDJ.js.map → pagesource-HKLE3FZN.js.map} +0 -0
  280. /package/dist/{provider-CBAXZ2VA.js.map → playwright-SZP56NN2.js.map} +0 -0
  281. /package/dist/{runner-ABGUVOJG.js.map → provider-FKT6FEQS.js.map} +0 -0
  282. /package/dist/{screenshot-compare-BJRJHKNQ.js.map → runner-P2BFG4VZ.js.map} +0 -0
  283. /package/dist/{server-RHAHCANZ.js.map → screenshot-compare-7TE44H7F.js.map} +0 -0
  284. /package/dist/{session-7CWHTQ2E.js.map → server-VIXRVKP5.js.map} +0 -0
  285. /package/dist/{validator-AJNOFBQM.js.map → session-3KME2U42.js.map} +0 -0
  286. /package/dist/{watch-mode-NR5MHNNL.js.map → validator-6XP3PGCP.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/mcp/server.ts","../src/diagnostics/live-inspector.ts"],"sourcesContent":["import { createInterface } from \"node:readline\";\nimport type { ExtendedSelector, Platform } from \"../schemas/selector.js\";\nimport type { ConnectOptions, Session } from \"../agent/session.js\";\nimport {\n buildComponentTreeScript,\n buildPerformanceProfileScript,\n type ComponentTreeReport,\n type PerformanceProfileReport,\n} from \"../diagnostics/live-inspector.js\";\n\n/** MCP Tool definition advertised by `tools/list`. */\nexport interface McpToolDefinition {\n name: string;\n description: string;\n inputSchema: {\n type: \"object\";\n properties: Record<string, unknown>;\n required?: string[];\n };\n}\n\nexport interface McpContentBlock {\n type: \"text\" | \"image\";\n text?: string;\n data?: string;\n mimeType?: string;\n}\n\nexport interface McpToolResult {\n content: McpContentBlock[];\n isError?: boolean;\n}\n\nexport interface JsonRpcRequest {\n jsonrpc: \"2.0\";\n id?: string | number | null;\n method: string;\n params?: Record<string, unknown>;\n}\n\nexport interface JsonRpcResponse {\n jsonrpc: \"2.0\";\n id: string | number | null;\n result?: unknown;\n error?: { code: number; message: string; data?: unknown };\n}\n\nexport interface SpanaMcpServerOptions {\n /** Custom session connector (defaults to `connect()` from `agent/session.js`). */\n connectFn?: (opts: ConnectOptions) => Promise<Session>;\n /** Custom flow runner for `spana_run_flow` (defaults to `runTestCommand`). */\n runFlowFn?: (opts: { flowPath: string; platform?: Platform }) => Promise<boolean>;\n}\n\n/** Format a Spana selector into clean TypeScript code for verified `.flow.ts` generation. */\nexport function formatSelectorCode(selector: ExtendedSelector): string {\n if (typeof selector === \"string\") {\n return JSON.stringify(selector);\n }\n const sel = selector as Record<string, unknown>;\n if (sel.systemUI === true) {\n const rest = { ...sel };\n delete rest.systemUI;\n return `systemUI(${JSON.stringify(rest)})`;\n }\n return JSON.stringify(selector);\n}\n\n/** Generate a complete `.flow.ts` file from recorded verified MCP actions. */\nexport function buildFlowFileFromLines(flowName: string, lines: string[]): string {\n const usesSystemUI = lines.some((l) => l.includes(\"systemUI(\"));\n const imports = usesSystemUI\n ? 'import { flow, systemUI } from \"spana-test\";'\n : 'import { flow } from \"spana-test\";';\n const body =\n lines.length > 0 ? lines.map((l) => ` ${l}`).join(\"\\n\") : \" // Add verified steps here\";\n return `${imports}\\n\\nexport default flow(${JSON.stringify(flowName)}, async ({ app, expect }) => {\\n${body}\\n});\\n`;\n}\n\nexport const SPANA_MCP_TOOLS: McpToolDefinition[] = [\n {\n name: \"spana_session_start\",\n description:\n \"Connect Spana to a live target (web, android, ios, electron, electrobun) and begin recording verified .flow.ts lines.\",\n inputSchema: {\n type: \"object\",\n properties: {\n platform: {\n type: \"string\",\n enum: [\"web\", \"android\", \"ios\", \"electron\", \"electrobun\"],\n },\n baseUrl: { type: \"string\" },\n packageName: { type: \"string\" },\n bundleId: { type: \"string\" },\n device: { type: \"string\" },\n headless: { type: \"boolean\" },\n cdpUrl: { type: \"string\" },\n },\n required: [\"platform\"],\n },\n },\n {\n name: \"spana_session_stop\",\n description:\n \"Disconnect the active Spana session and return the generated .flow.ts file containing every verified step.\",\n inputSchema: {\n type: \"object\",\n properties: {\n flowName: { type: \"string\" },\n },\n },\n },\n {\n name: \"spana_observe\",\n description:\n \"Inspect the current screen: returns actionable elements with suggested { testID } / systemUI() selectors plus recent console logs and JS errors.\",\n inputSchema: {\n type: \"object\",\n properties: {\n maxElements: { type: \"number\" },\n },\n },\n },\n {\n name: \"spana_tap\",\n description:\n \"Tap an element via Spana's dual-channel resolver and return the verified `.flow.ts` line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n selector: { type: \"object\" },\n },\n required: [\"selector\"],\n },\n },\n {\n name: \"spana_input_text\",\n description: \"Type text into the focused element and return the verified `.flow.ts` line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n text: { type: \"string\" },\n },\n required: [\"text\"],\n },\n },\n {\n name: \"spana_fill\",\n description:\n \"Atomically focus, clear, and fill an input/textarea in 1 round trip and return the verified `app.fill(...)` line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n selector: { type: \"object\" },\n value: { type: \"string\" },\n },\n required: [\"selector\", \"value\"],\n },\n },\n {\n name: \"spana_assert_visible\",\n description:\n \"Verify that an element matching selector is currently visible on screen and return the verified `expect(...)` line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n selector: { type: \"object\" },\n },\n required: [\"selector\"],\n },\n },\n {\n name: \"spana_assert_accessible\",\n description:\n \"Run a live WCAG accessibility audit (axe-core on web) and record `await expect.screen().toBeAccessible(...)` into the generated `.flow.ts`.\",\n inputSchema: {\n type: \"object\",\n properties: {\n standard: {\n type: \"string\",\n enum: [\"wcag2a\", \"wcag2aa\", \"wcag21a\", \"wcag21aa\", \"wcag22aa\"],\n },\n failOnSeverity: {\n type: \"string\",\n enum: [\"critical\", \"serious\", \"moderate\", \"minor\"],\n },\n },\n },\n },\n {\n name: \"spana_assert_screenshot\",\n description:\n \"Capture/verify a visual regression checkpoint (accelerated by Spana's Rust SIMD PNG diff) and record `await expect.screen().toMatchScreenshot(...)` into the generated `.flow.ts`.\",\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n mode: { type: \"string\", enum: [\"pixel\", \"layout-tolerant\"] },\n maxDiffPixelRatio: { type: \"number\" },\n },\n required: [\"name\"],\n },\n },\n {\n name: \"spana_open_link\",\n description: \"Navigate the active target to a URL or deep link and record the verified line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n url: { type: \"string\" },\n },\n required: [\"url\"],\n },\n },\n {\n name: \"spana_screenshot\",\n description: \"Capture a live PNG screenshot of the current screen for visual verification.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n },\n },\n {\n name: \"spana_diagnostics\",\n description:\n \"Argent-inspired live runtime diagnostics: returns captured console logs, JS errors, element count, and platform metadata.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n },\n },\n {\n name: \"spana_export_flow\",\n description:\n \"Export all verified actions from the current session as a runnable TypeScript `.flow.ts` file without disconnecting.\",\n inputSchema: {\n type: \"object\",\n properties: {\n flowName: { type: \"string\" },\n },\n },\n },\n {\n name: \"spana_run_flow\",\n description:\n \"Run an existing `.flow.ts` test file via Spana and return pass/fail status for rapid agent fix-and-verify loops.\",\n inputSchema: {\n type: \"object\",\n properties: {\n flowPath: { type: \"string\" },\n platform: {\n type: \"string\",\n enum: [\"web\", \"android\", \"ios\", \"electron\", \"electrobun\"],\n },\n },\n required: [\"flowPath\"],\n },\n },\n {\n name: \"spana_network_logs\",\n description:\n \"Argent-inspired live network inspector: query captured HTTP/Fetch requests with optional URL, method, and status/error filters.\",\n inputSchema: {\n type: \"object\",\n properties: {\n urlIncludes: { type: \"string\" },\n method: { type: \"string\" },\n failedOnly: { type: \"boolean\" },\n limit: { type: \"number\" },\n },\n },\n },\n {\n name: \"spana_component_tree\",\n description:\n \"Argent-inspired live component tree inspector: inspect mounted React Fiber, Vue 3, and Web Component hierarchy with prop previews.\",\n inputSchema: {\n type: \"object\",\n properties: {\n maxDepth: { type: \"number\" },\n maxNodes: { type: \"number\" },\n },\n },\n },\n {\n name: \"spana_performance_profile\",\n description:\n \"Argent-inspired live performance profiler: returns Web Vitals (FCP, LCP, CLS), navigation timing (TTFB, DCL, Load), long tasks, slowest resources, DOM size, and JS heap.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n },\n },\n];\n\n/**\n * Model-free MCP (Model Context Protocol) server for Spana.\n *\n * Lets coding agents (Claude Code, Codex, Cursor, Antigravity) drive live\n * web, iOS, Android, Electron, and Electrobun sessions, inspect unified\n * DOM/native + console/error diagnostics, and receive verified `.flow.ts` lines.\n */\nexport class SpanaMcpServer {\n private session: Session | null = null;\n private recordedLines: string[] = [];\n private readonly connectFn: (opts: ConnectOptions) => Promise<Session>;\n private readonly runFlowFn: (opts: { flowPath: string; platform?: Platform }) => Promise<boolean>;\n\n constructor(options: SpanaMcpServerOptions = {}) {\n this.connectFn =\n options.connectFn ??\n (async (opts) => {\n const { connect } = await import(\"../agent/session.js\");\n return connect(opts);\n });\n this.runFlowFn =\n options.runFlowFn ??\n (async ({ flowPath, platform }) => {\n const { runTestCommand } = await import(\"../cli/test-command.js\");\n return runTestCommand({\n flowPath,\n platforms: platform ? [platform] : [],\n quiet: true,\n });\n });\n }\n\n private requireSession(): Session {\n if (!this.session) {\n throw new Error(\n \"No active Spana MCP session. Call `spana_session_start` first with a target platform.\",\n );\n }\n return this.session;\n }\n\n async handleRequest(req: JsonRpcRequest): Promise<JsonRpcResponse | null> {\n const id = req.id ?? null;\n\n // Notifications (no id) get no JSON-RPC response\n if (req.method === \"notifications/initialized\" || req.id === undefined) {\n return null;\n }\n\n try {\n switch (req.method) {\n case \"initialize\":\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n protocolVersion: \"2024-11-05\",\n capabilities: { tools: {} },\n serverInfo: { name: \"spana-mcp\", version: \"1.0.0\" },\n },\n };\n\n case \"ping\":\n return { jsonrpc: \"2.0\", id, result: {} };\n\n case \"tools/list\":\n return {\n jsonrpc: \"2.0\",\n id,\n result: { tools: SPANA_MCP_TOOLS },\n };\n\n case \"tools/call\": {\n const name = String(req.params?.[\"name\"] ?? \"\");\n const args = (req.params?.[\"arguments\"] ?? {}) as Record<string, unknown>;\n const toolResult = await this.callTool(name, args);\n return { jsonrpc: \"2.0\", id, result: toolResult };\n }\n\n default:\n return {\n jsonrpc: \"2.0\",\n id,\n error: { code: -32601, message: `Method not found: ${req.method}` },\n };\n }\n } catch (err) {\n return {\n jsonrpc: \"2.0\",\n id,\n error: {\n code: -32603,\n message: err instanceof Error ? err.message : String(err),\n },\n };\n }\n }\n\n async callTool(name: string, args: Record<string, unknown>): Promise<McpToolResult> {\n try {\n switch (name) {\n case \"spana_session_start\": {\n if (this.session) {\n await this.session.disconnect().catch(() => undefined);\n this.session = null;\n }\n const platform = args[\"platform\"] as Platform;\n this.session = await this.connectFn({\n platform,\n baseUrl: args[\"baseUrl\"] as string | undefined,\n packageName: args[\"packageName\"] as string | undefined,\n bundleId: args[\"bundleId\"] as string | undefined,\n device: args[\"device\"] as string | undefined,\n headless: (args[\"headless\"] as boolean | undefined) ?? true,\n cdpUrl: args[\"cdpUrl\"] as string | undefined,\n });\n this.recordedLines = [];\n return this.jsonResult({ connected: true, platform });\n }\n\n case \"spana_session_stop\": {\n const flowName = (args[\"flowName\"] as string | undefined) ?? \"recorded flow\";\n const code = buildFlowFileFromLines(flowName, this.recordedLines);\n if (this.session) {\n await this.session.disconnect().catch(() => undefined);\n this.session = null;\n }\n return this.jsonResult({\n disconnected: true,\n stepCount: this.recordedLines.length,\n code,\n });\n }\n\n case \"spana_observe\": {\n const session = this.requireSession();\n const maxElements = (args[\"maxElements\"] as number | undefined) ?? 60;\n const elements = (await session.selectors()).slice(0, maxElements);\n const consoleLogs = await session.getConsoleLogs().catch(() => []);\n const jsErrors = await session.getJSErrors().catch(() => []);\n return this.jsonResult({\n platform: session.platform,\n elementCount: elements.length,\n elements,\n recentConsoleLogs: consoleLogs.slice(-15),\n jsErrors: jsErrors.slice(-10),\n });\n }\n\n case \"spana_tap\": {\n const session = this.requireSession();\n const selector = args[\"selector\"] as ExtendedSelector;\n await session.tap(selector);\n const codeLine = `await app.tap(${formatSelectorCode(selector)});`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_input_text\": {\n const session = this.requireSession();\n const text = String(args[\"text\"] ?? \"\");\n await session.inputText(text);\n const codeLine = `await app.inputText(${JSON.stringify(text)});`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_fill\": {\n const session = this.requireSession();\n const selector = args[\"selector\"] as ExtendedSelector;\n const value = String(args[\"value\"] ?? \"\");\n await session.tap(selector);\n await session.inputText(value);\n const codeLine = `await app.fill(${formatSelectorCode(selector)}, ${JSON.stringify(value)});`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_assert_accessible\": {\n const session = this.requireSession();\n const standard = (args[\"standard\"] as string | undefined) ?? \"wcag21aa\";\n const failOnSeverity = (args[\"failOnSeverity\"] as string | undefined) ?? \"serious\";\n const optsObj: Record<string, string> = {};\n if (args[\"standard\"]) optsObj[\"standard\"] = standard;\n if (args[\"failOnSeverity\"]) optsObj[\"failOnSeverity\"] = failOnSeverity;\n const optsArg = Object.keys(optsObj).length > 0 ? JSON.stringify(optsObj) : \"\";\n const codeLine = `await expect.screen().toBeAccessible(${optsArg});`;\n // Run a fast DOM accessibility sanity snapshot when on web\n let quickIssues: string[] = [];\n if (session.platform === \"web\") {\n const elements = await session.selectors().catch(() => []);\n quickIssues = elements\n .filter((e) => !e.text && !e.accessibilityLabel)\n .slice(0, 10)\n .map((e) => `Unlabeled interactive control (${e.elementType ?? \"element\"})`);\n }\n this.recordedLines.push(codeLine);\n return this.jsonResult({\n ok: true,\n codeLine,\n standard,\n failOnSeverity,\n quickIssues,\n });\n }\n\n case \"spana_assert_screenshot\": {\n const session = this.requireSession();\n const shotName = String(args[\"name\"] ?? \"screen\");\n const png = await session.screenshot();\n const optsObj: Record<string, unknown> = {};\n if (typeof args[\"mode\"] === \"string\") optsObj[\"mode\"] = args[\"mode\"];\n if (typeof args[\"maxDiffPixelRatio\"] === \"number\") {\n optsObj[\"maxDiffPixelRatio\"] = args[\"maxDiffPixelRatio\"];\n }\n const optsArg = Object.keys(optsObj).length > 0 ? `, ${JSON.stringify(optsObj)}` : \"\";\n const codeLine = `await expect.screen().toMatchScreenshot(${JSON.stringify(shotName)}${optsArg});`;\n this.recordedLines.push(codeLine);\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify({ ok: true, name: shotName, codeLine, bytes: png.byteLength }),\n },\n {\n type: \"image\",\n data: Buffer.from(png).toString(\"base64\"),\n mimeType: \"image/png\",\n },\n ],\n };\n }\n\n case \"spana_assert_visible\": {\n const session = this.requireSession();\n const selector = args[\"selector\"] as ExtendedSelector;\n const elements = await session.selectors();\n const sel = selector as Record<string, unknown>;\n const matched = elements.some((el) => {\n if (typeof sel[\"testID\"] === \"string\") return el.id === sel[\"testID\"];\n if (typeof sel[\"text\"] === \"string\") return el.text?.includes(sel[\"text\"]);\n if (typeof sel[\"accessibilityLabel\"] === \"string\") {\n return el.accessibilityLabel === sel[\"accessibilityLabel\"];\n }\n return false;\n });\n if (!matched) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: JSON.stringify({\n ok: false,\n message: `Element not visible: ${formatSelectorCode(selector)}`,\n availableTestIDs: elements\n .map((e) => e.id)\n .filter(Boolean)\n .slice(0, 20),\n }),\n },\n ],\n };\n }\n const codeLine = `await expect(${formatSelectorCode(selector)}).toBeVisible();`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_open_link\": {\n const session = this.requireSession();\n const url = String(args[\"url\"] ?? \"\");\n await session.openLink(url);\n const codeLine = `await app.openLink(${JSON.stringify(url)});`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_screenshot\": {\n const session = this.requireSession();\n const png = await session.screenshot();\n return {\n content: [\n {\n type: \"image\",\n data: Buffer.from(png).toString(\"base64\"),\n mimeType: \"image/png\",\n },\n ],\n };\n }\n\n case \"spana_diagnostics\": {\n const session = this.requireSession();\n const [elements, consoleLogs, jsErrors] = await Promise.all([\n session.selectors().catch(() => []),\n session.getConsoleLogs().catch(() => []),\n session.getJSErrors().catch(() => []),\n ]);\n return this.jsonResult({\n platform: session.platform,\n actionableElements: elements.length,\n testIDCount: elements.filter((e) => Boolean(e.id)).length,\n consoleLogCount: consoleLogs.length,\n consoleLogs: consoleLogs.slice(-25),\n jsErrorCount: jsErrors.length,\n jsErrors: jsErrors.slice(-15),\n });\n }\n\n case \"spana_export_flow\": {\n const flowName = (args[\"flowName\"] as string | undefined) ?? \"recorded flow\";\n return this.jsonResult({\n flowName,\n stepCount: this.recordedLines.length,\n code: buildFlowFileFromLines(flowName, this.recordedLines),\n });\n }\n\n case \"spana_run_flow\": {\n const flowPath = String(args[\"flowPath\"] ?? \"\");\n const platform = args[\"platform\"] as Platform | undefined;\n const passed = await this.runFlowFn({ flowPath, platform });\n return this.jsonResult({ flowPath, platform: platform ?? \"default\", passed });\n }\n\n case \"spana_network_logs\": {\n const session = this.requireSession();\n const har = await session.getHAR().catch(() => null);\n const urlIncludes =\n typeof args[\"urlIncludes\"] === \"string\" ? args[\"urlIncludes\"].toLowerCase() : undefined;\n const methodFilter =\n typeof args[\"method\"] === \"string\" ? args[\"method\"].toUpperCase() : undefined;\n const failedOnly = Boolean(args[\"failedOnly\"]);\n const limit = typeof args[\"limit\"] === \"number\" ? args[\"limit\"] : 50;\n const entries = (har?.log?.entries ?? [])\n .map((e) => ({\n method: e.request.method,\n url: e.request.url,\n status: e.response.status,\n statusText: e.response.statusText,\n durationMs: e.time,\n resourceType: e._resourceType,\n failed:\n e.response.status === 0 || e.response.status >= 400 || Boolean(e._failureText),\n errorText: e._failureText,\n }))\n .filter((e) => {\n if (urlIncludes && !e.url.toLowerCase().includes(urlIncludes)) return false;\n if (methodFilter && e.method.toUpperCase() !== methodFilter) return false;\n if (failedOnly && !e.failed) return false;\n return true;\n })\n .slice(-Math.max(1, limit));\n return this.jsonResult({ count: entries.length, entries });\n }\n\n case \"spana_component_tree\": {\n const session = this.requireSession();\n const maxDepth = typeof args[\"maxDepth\"] === \"number\" ? args[\"maxDepth\"] : undefined;\n const maxNodes = typeof args[\"maxNodes\"] === \"number\" ? args[\"maxNodes\"] : undefined;\n const report = await session.evaluate<ComponentTreeReport>(\n buildComponentTreeScript({ maxDepth, maxNodes }),\n );\n return this.jsonResult(report);\n }\n\n case \"spana_performance_profile\": {\n const session = this.requireSession();\n const profile = await session.evaluate<PerformanceProfileReport>(\n buildPerformanceProfileScript(),\n );\n return this.jsonResult(profile);\n }\n\n default:\n return {\n isError: true,\n content: [{ type: \"text\", text: `Unknown tool: ${name}` }],\n };\n }\n } catch (err) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: err instanceof Error ? err.message : String(err),\n },\n ],\n };\n }\n }\n\n private jsonResult(payload: unknown): McpToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify(payload, null, 2) }],\n };\n }\n\n /** Run the server over newline-delimited JSON-RPC stdio until stdin closes. */\n async runStdio(): Promise<void> {\n const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });\n for await (const line of rl) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n try {\n const req = JSON.parse(trimmed) as JsonRpcRequest;\n const res = await this.handleRequest(req);\n if (res) {\n process.stdout.write(`${JSON.stringify(res)}\\n`);\n }\n } catch (err) {\n const parseErr: JsonRpcResponse = {\n jsonrpc: \"2.0\",\n id: null,\n error: {\n code: -32700,\n message: err instanceof Error ? err.message : \"Parse error\",\n },\n };\n process.stdout.write(`${JSON.stringify(parseErr)}\\n`);\n }\n }\n if (this.session) {\n await this.session.disconnect().catch(() => undefined);\n this.session = null;\n }\n }\n}\n","/**\n * Argent-inspired live diagnostics & profiling utilities:\n * 1. `NetworkEventBuffer` — live ring buffer of HTTP/GraphQL/Fetch requests with status/error/URL filtering.\n * 2. `buildComponentTreeScript()` — inspect live React Fiber, Vue 3, and custom Web Component trees.\n * 3. `buildPerformanceProfileScript()` — capture Web Vitals (LCP, CLS, FCP, TTFB), navigation timing,\n * long tasks, resource breakdown, and V8 JS heap usage in a single evaluation.\n */\n\nexport interface LiveNetworkEvent {\n requestId: string;\n url: string;\n method: string;\n resourceType?: string;\n startedAt: number;\n finishedAt?: number;\n durationMs?: number;\n status?: number;\n statusText?: string;\n mimeType?: string;\n failed?: boolean;\n errorText?: string;\n requestHeaders?: Record<string, string>;\n responseHeaders?: Record<string, string>;\n}\n\nexport interface NetworkEventFilter {\n urlIncludes?: string;\n method?: string;\n minStatus?: number;\n failedOnly?: boolean;\n limit?: number;\n}\n\n/**\n * Bounded in-memory ring buffer capturing live network requests from CDP (`Network.*`)\n * or Playwright (`request` / `response` / `requestfailed`) events.\n */\nexport class NetworkEventBuffer {\n private readonly maxEntries: number;\n private readonly events: LiveNetworkEvent[] = [];\n private readonly byId = new Map<string, LiveNetworkEvent>();\n\n constructor(maxEntries = 300) {\n this.maxEntries = Math.max(10, maxEntries);\n }\n\n recordRequest(input: {\n requestId: string;\n url: string;\n method: string;\n resourceType?: string;\n timestamp?: number;\n headers?: Record<string, string>;\n }): LiveNetworkEvent {\n const entry: LiveNetworkEvent = {\n requestId: input.requestId,\n url: input.url,\n method: input.method.toUpperCase(),\n resourceType: input.resourceType,\n startedAt: input.timestamp ?? Date.now(),\n ...(input.headers ? { requestHeaders: input.headers } : {}),\n };\n this.byId.set(input.requestId, entry);\n this.events.push(entry);\n if (this.events.length > this.maxEntries) {\n const evicted = this.events.shift();\n if (evicted) this.byId.delete(evicted.requestId);\n }\n return entry;\n }\n\n recordResponse(input: {\n requestId: string;\n status: number;\n statusText?: string;\n mimeType?: string;\n timestamp?: number;\n headers?: Record<string, string>;\n url?: string;\n }): LiveNetworkEvent | undefined {\n const existing = this.byId.get(input.requestId);\n const finishedAt = input.timestamp ?? Date.now();\n if (existing) {\n existing.status = input.status;\n existing.statusText = input.statusText;\n existing.mimeType = input.mimeType;\n existing.finishedAt = finishedAt;\n existing.durationMs = Math.max(0, finishedAt - existing.startedAt);\n if (input.headers) existing.responseHeaders = input.headers;\n return existing;\n }\n if (!input.url) return undefined;\n const synthetic = this.recordRequest({\n requestId: input.requestId,\n url: input.url,\n method: \"GET\",\n timestamp: finishedAt,\n });\n synthetic.status = input.status;\n synthetic.statusText = input.statusText;\n synthetic.mimeType = input.mimeType;\n synthetic.finishedAt = finishedAt;\n synthetic.durationMs = 0;\n if (input.headers) synthetic.responseHeaders = input.headers;\n return synthetic;\n }\n\n recordFailure(input: {\n requestId: string;\n errorText: string;\n timestamp?: number;\n }): LiveNetworkEvent | undefined {\n const existing = this.byId.get(input.requestId);\n if (!existing) return undefined;\n const finishedAt = input.timestamp ?? Date.now();\n existing.failed = true;\n existing.errorText = input.errorText;\n existing.finishedAt = finishedAt;\n existing.durationMs = Math.max(0, finishedAt - existing.startedAt);\n return existing;\n }\n\n query(filter: NetworkEventFilter = {}): LiveNetworkEvent[] {\n let result = this.events.filter((e) => {\n if (filter.urlIncludes && !e.url.toLowerCase().includes(filter.urlIncludes.toLowerCase())) {\n return false;\n }\n if (filter.method && e.method !== filter.method.toUpperCase()) {\n return false;\n }\n if (filter.failedOnly && !e.failed && (e.status === undefined || e.status < 400)) {\n return false;\n }\n if (\n filter.minStatus !== undefined &&\n (e.status === undefined || e.status < filter.minStatus)\n ) {\n return false;\n }\n return true;\n });\n if (filter.limit && filter.limit > 0 && result.length > filter.limit) {\n result = result.slice(-filter.limit);\n }\n return result.map((e) => ({ ...e }));\n }\n\n clear(): void {\n this.events.length = 0;\n this.byId.clear();\n }\n\n get size(): number {\n return this.events.length;\n }\n}\n\nexport interface ComponentTreeNode {\n framework: \"react\" | \"vue\" | \"web-component\";\n name: string;\n testID?: string;\n props?: Record<string, unknown>;\n children: ComponentTreeNode[];\n}\n\nexport interface ComponentTreeReport {\n detectedFrameworks: Array<\"react\" | \"vue\" | \"web-component\">;\n nodeCount: number;\n roots: ComponentTreeNode[];\n}\n\n/**\n * Build a self-contained browser JS snippet that extracts the live React Fiber, Vue 3,\n * and Custom Element component tree with sanitized prop previews (Argent-inspired).\n */\nexport function buildComponentTreeScript(opts?: { maxDepth?: number; maxNodes?: number }): string {\n const maxDepth = Math.max(1, opts?.maxDepth ?? 12);\n const maxNodes = Math.max(10, opts?.maxNodes ?? 200);\n return `(() => {\n const MAX_DEPTH = ${maxDepth};\n const MAX_NODES = ${maxNodes};\n let count = 0;\n const detected = new Set();\n\n function summarizeProps(obj) {\n if (!obj || typeof obj !== \"object\") return undefined;\n const out = {};\n let keys = 0;\n for (const [k, v] of Object.entries(obj)) {\n if (k === \"children\" || k.startsWith(\"__\")) continue;\n if (keys >= 8) break;\n if (typeof v === \"string\" || typeof v === \"number\" || typeof v === \"boolean\") {\n out[k] = typeof v === \"string\" && v.length > 60 ? v.slice(0, 57) + \"...\" : v;\n keys++;\n } else if (v === null) {\n out[k] = null;\n keys++;\n } else if (typeof v === \"function\") {\n out[k] = \"[Function]\";\n keys++;\n }\n }\n return keys > 0 ? out : undefined;\n }\n\n function walkReactFiber(fiber, depth) {\n const nodes = [];\n let cur = fiber;\n while (cur && count < MAX_NODES) {\n const type = cur.type;\n const isComponent = typeof type === \"function\" || (type && typeof type === \"object\");\n const name = typeof type === \"function\"\n ? (type.displayName || type.name || \"Anonymous\")\n : (type && typeof type === \"object\" ? (type.displayName || type.render?.name || \"Component\") : null);\n\n if (isComponent && name && depth < MAX_DEPTH) {\n count++;\n const props = cur.memoizedProps;\n const testID = props && (props[\"data-testid\"] || props.testID || undefined);\n const children = cur.child ? walkReactFiber(cur.child, depth + 1) : [];\n nodes.push({\n framework: \"react\",\n name: String(name),\n ...(testID ? { testID: String(testID) } : {}),\n ...(summarizeProps(props) ? { props: summarizeProps(props) } : {}),\n children,\n });\n } else if (cur.child && depth < MAX_DEPTH) {\n nodes.push(...walkReactFiber(cur.child, depth));\n }\n cur = cur.sibling;\n }\n return nodes;\n }\n\n const roots = [];\n\n // 1. React 16-19 Fiber roots\n const allEls = [document.documentElement, document.body, ...Array.from(document.querySelectorAll(\"*\")).slice(0, 250)].filter(Boolean);\n const seenFibers = new Set();\n for (const el of allEls) {\n const keys = Object.keys(el);\n const fiberKey = keys.find((k) => k.startsWith(\"__reactFiber$\") || k.startsWith(\"__reactInternalInstance$\") || k.startsWith(\"__reactContainer$\"));\n if (fiberKey) {\n detected.add(\"react\");\n let rootFiber = el[fiberKey];\n if (rootFiber && rootFiber.stateNode && rootFiber.stateNode.current) {\n rootFiber = rootFiber.stateNode.current;\n }\n while (rootFiber && rootFiber.return) rootFiber = rootFiber.return;\n if (rootFiber && !seenFibers.has(rootFiber)) {\n seenFibers.add(rootFiber);\n roots.push(...walkReactFiber(rootFiber, 0));\n }\n }\n // 2. Vue 3 app root\n if (el.__vue_app__ && el.__vue_app__._container) {\n detected.add(\"vue\");\n const vnode = el.__vue_app__._instance?.subTree;\n const walkVue = (node, depth) => {\n if (!node || count >= MAX_NODES || depth > MAX_DEPTH) return [];\n const name = node.type?.name || node.type?.__name;\n const children = [];\n if (Array.isArray(node.children)) {\n for (const c of node.children) children.push(...walkVue(c, depth + 1));\n } else if (node.component?.subTree) {\n children.push(...walkVue(node.component.subTree, depth + 1));\n }\n if (name) {\n count++;\n return [{\n framework: \"vue\",\n name: String(name),\n ...(summarizeProps(node.props) ? { props: summarizeProps(node.props) } : {}),\n children,\n }];\n }\n return children;\n };\n if (vnode) roots.push(...walkVue(vnode, 0));\n }\n // 3. Custom Web Components (hyphenated tag names)\n if (el.tagName && el.tagName.includes(\"-\") && count < MAX_NODES) {\n detected.add(\"web-component\");\n count++;\n roots.push({\n framework: \"web-component\",\n name: el.tagName.toLowerCase(),\n ...(el.getAttribute(\"data-testid\") ? { testID: el.getAttribute(\"data-testid\") } : {}),\n children: [],\n });\n }\n }\n\n return {\n detectedFrameworks: Array.from(detected),\n nodeCount: count,\n roots,\n };\n })()`;\n}\n\nexport interface PerformanceProfileReport {\n url: string;\n timestamp: string;\n navigation?: {\n ttfbMs: number;\n domContentLoadedMs: number;\n loadEventMs: number;\n transferSizeBytes: number;\n };\n vitals: {\n fcpMs?: number;\n lcpMs?: number;\n cls?: number;\n };\n longTaskCount: number;\n longTaskTotalMs: number;\n resourceCount: number;\n slowestResources: Array<{\n name: string;\n initiatorType: string;\n durationMs: number;\n transferSize: number;\n }>;\n jsHeap?: {\n usedBytes: number;\n totalBytes: number;\n limitBytes: number;\n };\n domNodeCount: number;\n}\n\n/**\n * Build a self-contained browser JS snippet that collects Web Vitals (FCP/LCP/CLS),\n * Navigation Timing (TTFB/DCL/Load), Long Tasks, slowest resources, DOM size, and JS heap.\n */\nexport function buildPerformanceProfileScript(): string {\n return `(() => {\n const perf = window.performance;\n const navEntries = perf && perf.getEntriesByType ? perf.getEntriesByType(\"navigation\") : [];\n const nav = navEntries && navEntries[0];\n const paintEntries = perf && perf.getEntriesByType ? perf.getEntriesByType(\"paint\") : [];\n const fcpEntry = paintEntries.find((e) => e.name === \"first-contentful-paint\");\n const lcpEntries = perf && perf.getEntriesByType ? perf.getEntriesByType(\"largest-contentful-paint\") : [];\n const lcpEntry = lcpEntries && lcpEntries.length > 0 ? lcpEntries[lcpEntries.length - 1] : undefined;\n const layoutShifts = perf && perf.getEntriesByType ? perf.getEntriesByType(\"layout-shift\") : [];\n let cls = 0;\n for (const ls of layoutShifts) {\n if (!ls.hadRecentInput && typeof ls.value === \"number\") cls += ls.value;\n }\n const longTasks = perf && perf.getEntriesByType ? perf.getEntriesByType(\"longtask\") : [];\n let longTaskTotalMs = 0;\n for (const lt of longTasks) longTaskTotalMs += Number(lt.duration || 0);\n\n const resources = perf && perf.getEntriesByType ? perf.getEntriesByType(\"resource\") : [];\n const slowestResources = resources\n .map((r) => ({\n name: String(r.name || \"\").slice(0, 140),\n initiatorType: String(r.initiatorType || \"other\"),\n durationMs: Math.round(Number(r.duration || 0)),\n transferSize: Number(r.transferSize || 0),\n }))\n .sort((a, b) => b.durationMs - a.durationMs)\n .slice(0, 10);\n\n const mem = perf && perf.memory ? {\n usedBytes: Number(perf.memory.usedJSHeapSize || 0),\n totalBytes: Number(perf.memory.totalJSHeapSize || 0),\n limitBytes: Number(perf.memory.jsHeapSizeLimit || 0),\n } : undefined;\n\n return {\n url: String(window.location.href || \"\"),\n timestamp: new Date().toISOString(),\n ...(nav ? {\n navigation: {\n ttfbMs: Math.round(Number(nav.responseStart || 0)),\n domContentLoadedMs: Math.round(Number(nav.domContentLoadedEventEnd || 0)),\n loadEventMs: Math.round(Number(nav.loadEventEnd || 0)),\n transferSizeBytes: Number(nav.transferSize || 0),\n },\n } : {}),\n vitals: {\n ...(fcpEntry ? { fcpMs: Math.round(Number(fcpEntry.startTime || 0)) } : {}),\n ...(lcpEntry ? { lcpMs: Math.round(Number(lcpEntry.startTime || 0)) } : {}),\n cls: Math.round(cls * 10000) / 10000,\n },\n longTaskCount: longTasks.length,\n longTaskTotalMs: Math.round(longTaskTotalMs),\n resourceCount: resources.length,\n slowestResources,\n ...(mem ? { jsHeap: mem } : {}),\n domNodeCount: document.querySelectorAll(\"*\").length,\n };\n })()`;\n}\n"],"mappings":";;;;;AAAA;AAAA,SAAS,uBAAuB;;;ACAhC;AAqCO,IAAM,qBAAN,MAAyB;AAAA,EACb;AAAA,EACA,SAA6B,CAAC;AAAA,EAC9B,OAAO,oBAAI,IAA8B;AAAA,EAE1D,YAAY,aAAa,KAAK;AAC5B,SAAK,aAAa,KAA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A,EAEQ,WAAW,SAAiC;AAClD,WAAO;AAAA,MACL,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE,CAAC;AAAA,IACpE;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,WAA0B;AAC9B,UAAM,KAAK,gBAAgB,EAAE,OAAO,QAAQ,OAAO,WAAW,SAAS,CAAC;AACxE,qBAAiB,QAAQ,IAAI;AAC3B,YAAM,UAAU,KAAK,KAAK;AAC1B,UAAI,CAAC,QAAS;AACd,UAAI;AACF,cAAM,MAAM,KAAK,MAAM,OAAO;AAC9B,cAAM,MAAM,MAAM,KAAK,cAAc,GAAG;AACxC,YAAI,KAAK;AACP,kBAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,GAAG,CAAC;AAAA,CAAI;AAAA,QACjD;AAAA,MACF,SAAS,KAAK;AACZ,cAAM,WAA4B;AAAA,UAChC,SAAS;AAAA,UACT,IAAI;AAAA,UACJ,OAAO;AAAA,YACL,MAAM;AAAA,YACN,SAAS,eAAe,QAAQ,IAAI,UAAU;AAAA,UAChD;AAAA,QACF;AACA,gBAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,CAAC;AAAA,CAAI;AAAA,MACtD;AAAA,IACF;AACA,QAAI,KAAK,SAAS;AAChB,YAAM,KAAK,QAAQ,WAAW,EAAE,MAAM,MAAM,MAAS;AACrD,WAAK,UAAU;AAAA,IACjB;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/mcp/server.ts","../src/diagnostics/live-inspector.ts"],"sourcesContent":["import { createInterface } from \"node:readline\";\nimport type { ExtendedSelector, Platform } from \"../schemas/selector.js\";\nimport type { ConnectOptions, Session } from \"../agent/session.js\";\nimport {\n buildComponentTreeScript,\n buildPerformanceProfileScript,\n type ComponentTreeReport,\n type PerformanceProfileReport,\n} from \"../diagnostics/live-inspector.js\";\n\n/** MCP Tool definition advertised by `tools/list`. */\nexport interface McpToolDefinition {\n name: string;\n description: string;\n inputSchema: {\n type: \"object\";\n properties: Record<string, unknown>;\n required?: string[];\n };\n}\n\nexport interface McpContentBlock {\n type: \"text\" | \"image\";\n text?: string;\n data?: string;\n mimeType?: string;\n}\n\nexport interface McpToolResult {\n content: McpContentBlock[];\n isError?: boolean;\n}\n\nexport interface JsonRpcRequest {\n jsonrpc: \"2.0\";\n id?: string | number | null;\n method: string;\n params?: Record<string, unknown>;\n}\n\nexport interface JsonRpcResponse {\n jsonrpc: \"2.0\";\n id: string | number | null;\n result?: unknown;\n error?: { code: number; message: string; data?: unknown };\n}\n\nexport interface SpanaMcpServerOptions {\n /** Custom session connector (defaults to `connect()` from `agent/session.js`). */\n connectFn?: (opts: ConnectOptions) => Promise<Session>;\n /** Custom flow runner for `spana_run_flow` (defaults to `runTestCommand`). */\n runFlowFn?: (opts: { flowPath: string; platform?: Platform }) => Promise<boolean>;\n}\n\n/** Format a Spana selector into clean TypeScript code for verified `.flow.ts` generation. */\nexport function formatSelectorCode(selector: ExtendedSelector): string {\n if (typeof selector === \"string\") {\n return JSON.stringify(selector);\n }\n const sel = selector as Record<string, unknown>;\n if (sel.systemUI === true) {\n const rest = { ...sel };\n delete rest.systemUI;\n return `systemUI(${JSON.stringify(rest)})`;\n }\n return JSON.stringify(selector);\n}\n\n/** Generate a complete `.flow.ts` file from recorded verified MCP actions. */\nexport function buildFlowFileFromLines(flowName: string, lines: string[]): string {\n const usesSystemUI = lines.some((l) => l.includes(\"systemUI(\"));\n const imports = usesSystemUI\n ? 'import { flow, systemUI } from \"spana-test\";'\n : 'import { flow } from \"spana-test\";';\n const body =\n lines.length > 0 ? lines.map((l) => ` ${l}`).join(\"\\n\") : \" // Add verified steps here\";\n return `${imports}\\n\\nexport default flow(${JSON.stringify(flowName)}, async ({ app, expect }) => {\\n${body}\\n});\\n`;\n}\n\nexport const SPANA_MCP_TOOLS: McpToolDefinition[] = [\n {\n name: \"spana_session_start\",\n description:\n \"Connect Spana to a live target (web, android, ios, electron, electrobun) and begin recording verified .flow.ts lines.\",\n inputSchema: {\n type: \"object\",\n properties: {\n platform: {\n type: \"string\",\n enum: [\"web\", \"android\", \"ios\", \"electron\", \"electrobun\"],\n },\n baseUrl: { type: \"string\" },\n packageName: { type: \"string\" },\n bundleId: { type: \"string\" },\n device: { type: \"string\" },\n headless: { type: \"boolean\" },\n cdpUrl: { type: \"string\" },\n },\n required: [\"platform\"],\n },\n },\n {\n name: \"spana_session_stop\",\n description:\n \"Disconnect the active Spana session and return the generated .flow.ts file containing every verified step.\",\n inputSchema: {\n type: \"object\",\n properties: {\n flowName: { type: \"string\" },\n },\n },\n },\n {\n name: \"spana_observe\",\n description:\n \"Inspect the current screen: returns actionable elements with suggested { testID } / systemUI() selectors plus recent console logs and JS errors.\",\n inputSchema: {\n type: \"object\",\n properties: {\n maxElements: { type: \"number\" },\n },\n },\n },\n {\n name: \"spana_tap\",\n description:\n \"Tap an element via Spana's dual-channel resolver and return the verified `.flow.ts` line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n selector: { type: \"object\" },\n },\n required: [\"selector\"],\n },\n },\n {\n name: \"spana_input_text\",\n description: \"Type text into the focused element and return the verified `.flow.ts` line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n text: { type: \"string\" },\n },\n required: [\"text\"],\n },\n },\n {\n name: \"spana_fill\",\n description:\n \"Atomically focus, clear, and fill an input/textarea in 1 round trip and return the verified `app.fill(...)` line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n selector: { type: \"object\" },\n value: { type: \"string\" },\n },\n required: [\"selector\", \"value\"],\n },\n },\n {\n name: \"spana_assert_visible\",\n description:\n \"Verify that an element matching selector is currently visible on screen and return the verified `expect(...)` line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n selector: { type: \"object\" },\n },\n required: [\"selector\"],\n },\n },\n {\n name: \"spana_assert_accessible\",\n description:\n \"Run a live WCAG accessibility audit (axe-core on web) and record `await expect.screen().toBeAccessible(...)` into the generated `.flow.ts`.\",\n inputSchema: {\n type: \"object\",\n properties: {\n standard: {\n type: \"string\",\n enum: [\"wcag2a\", \"wcag2aa\", \"wcag21a\", \"wcag21aa\", \"wcag22aa\"],\n },\n failOnSeverity: {\n type: \"string\",\n enum: [\"critical\", \"serious\", \"moderate\", \"minor\"],\n },\n },\n },\n },\n {\n name: \"spana_assert_screenshot\",\n description:\n \"Capture/verify a visual regression checkpoint (accelerated by Spana's Rust SIMD PNG diff) and record `await expect.screen().toMatchScreenshot(...)` into the generated `.flow.ts`.\",\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n mode: { type: \"string\", enum: [\"pixel\", \"layout-tolerant\"] },\n maxDiffPixelRatio: { type: \"number\" },\n },\n required: [\"name\"],\n },\n },\n {\n name: \"spana_open_link\",\n description: \"Navigate the active target to a URL or deep link and record the verified line.\",\n inputSchema: {\n type: \"object\",\n properties: {\n url: { type: \"string\" },\n },\n required: [\"url\"],\n },\n },\n {\n name: \"spana_screenshot\",\n description: \"Capture a live PNG screenshot of the current screen for visual verification.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n },\n },\n {\n name: \"spana_diagnostics\",\n description:\n \"Argent-inspired live runtime diagnostics: returns captured console logs, JS errors, element count, and platform metadata.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n },\n },\n {\n name: \"spana_export_flow\",\n description:\n \"Export all verified actions from the current session as a runnable TypeScript `.flow.ts` file without disconnecting.\",\n inputSchema: {\n type: \"object\",\n properties: {\n flowName: { type: \"string\" },\n },\n },\n },\n {\n name: \"spana_run_flow\",\n description:\n \"Run an existing `.flow.ts` test file via Spana and return pass/fail status for rapid agent fix-and-verify loops.\",\n inputSchema: {\n type: \"object\",\n properties: {\n flowPath: { type: \"string\" },\n platform: {\n type: \"string\",\n enum: [\"web\", \"android\", \"ios\", \"electron\", \"electrobun\"],\n },\n },\n required: [\"flowPath\"],\n },\n },\n {\n name: \"spana_network_logs\",\n description:\n \"Argent-inspired live network inspector: query captured HTTP/Fetch requests with optional URL, method, and status/error filters.\",\n inputSchema: {\n type: \"object\",\n properties: {\n urlIncludes: { type: \"string\" },\n method: { type: \"string\" },\n failedOnly: { type: \"boolean\" },\n limit: { type: \"number\" },\n },\n },\n },\n {\n name: \"spana_component_tree\",\n description:\n \"Argent-inspired live component tree inspector: inspect mounted React Fiber, Vue 3, and Web Component hierarchy with prop previews.\",\n inputSchema: {\n type: \"object\",\n properties: {\n maxDepth: { type: \"number\" },\n maxNodes: { type: \"number\" },\n },\n },\n },\n {\n name: \"spana_performance_profile\",\n description:\n \"Argent-inspired live performance profiler: returns Web Vitals (FCP, LCP, CLS), navigation timing (TTFB, DCL, Load), long tasks, slowest resources, DOM size, and JS heap.\",\n inputSchema: {\n type: \"object\",\n properties: {},\n },\n },\n];\n\n/**\n * Model-free MCP (Model Context Protocol) server for Spana.\n *\n * Lets coding agents (Claude Code, Codex, Cursor, Antigravity) drive live\n * web, iOS, Android, Electron, and Electrobun sessions, inspect unified\n * DOM/native + console/error diagnostics, and receive verified `.flow.ts` lines.\n */\nexport class SpanaMcpServer {\n private session: Session | null = null;\n private recordedLines: string[] = [];\n private readonly connectFn: (opts: ConnectOptions) => Promise<Session>;\n private readonly runFlowFn: (opts: { flowPath: string; platform?: Platform }) => Promise<boolean>;\n\n constructor(options: SpanaMcpServerOptions = {}) {\n this.connectFn =\n options.connectFn ??\n (async (opts) => {\n const { connect } = await import(\"../agent/session.js\");\n return connect(opts);\n });\n this.runFlowFn =\n options.runFlowFn ??\n (async ({ flowPath, platform }) => {\n const { runTestCommand } = await import(\"../cli/test-command.js\");\n return runTestCommand({\n flowPath,\n platforms: platform ? [platform] : [],\n quiet: true,\n });\n });\n }\n\n private requireSession(): Session {\n if (!this.session) {\n throw new Error(\n \"No active Spana MCP session. Call `spana_session_start` first with a target platform.\",\n );\n }\n return this.session;\n }\n\n async handleRequest(req: JsonRpcRequest): Promise<JsonRpcResponse | null> {\n const id = req.id ?? null;\n\n // Notifications (no id) get no JSON-RPC response\n if (req.method === \"notifications/initialized\" || req.id === undefined) {\n return null;\n }\n\n try {\n switch (req.method) {\n case \"initialize\":\n return {\n jsonrpc: \"2.0\",\n id,\n result: {\n protocolVersion: \"2024-11-05\",\n capabilities: { tools: {} },\n serverInfo: { name: \"spana-mcp\", version: \"1.0.0\" },\n },\n };\n\n case \"ping\":\n return { jsonrpc: \"2.0\", id, result: {} };\n\n case \"tools/list\":\n return {\n jsonrpc: \"2.0\",\n id,\n result: { tools: SPANA_MCP_TOOLS },\n };\n\n case \"tools/call\": {\n const name = String(req.params?.[\"name\"] ?? \"\");\n const args = (req.params?.[\"arguments\"] ?? {}) as Record<string, unknown>;\n const toolResult = await this.callTool(name, args);\n return { jsonrpc: \"2.0\", id, result: toolResult };\n }\n\n default:\n return {\n jsonrpc: \"2.0\",\n id,\n error: { code: -32601, message: `Method not found: ${req.method}` },\n };\n }\n } catch (err) {\n return {\n jsonrpc: \"2.0\",\n id,\n error: {\n code: -32603,\n message: err instanceof Error ? err.message : String(err),\n },\n };\n }\n }\n\n async callTool(name: string, args: Record<string, unknown>): Promise<McpToolResult> {\n try {\n switch (name) {\n case \"spana_session_start\": {\n if (this.session) {\n await this.session.disconnect().catch(() => undefined);\n this.session = null;\n }\n const platform = args[\"platform\"] as Platform;\n this.session = await this.connectFn({\n platform,\n baseUrl: args[\"baseUrl\"] as string | undefined,\n packageName: args[\"packageName\"] as string | undefined,\n bundleId: args[\"bundleId\"] as string | undefined,\n device: args[\"device\"] as string | undefined,\n headless: (args[\"headless\"] as boolean | undefined) ?? true,\n cdpUrl: args[\"cdpUrl\"] as string | undefined,\n });\n this.recordedLines = [];\n return this.jsonResult({ connected: true, platform });\n }\n\n case \"spana_session_stop\": {\n const flowName = (args[\"flowName\"] as string | undefined) ?? \"recorded flow\";\n const code = buildFlowFileFromLines(flowName, this.recordedLines);\n if (this.session) {\n await this.session.disconnect().catch(() => undefined);\n this.session = null;\n }\n return this.jsonResult({\n disconnected: true,\n stepCount: this.recordedLines.length,\n code,\n });\n }\n\n case \"spana_observe\": {\n const session = this.requireSession();\n const maxElements = (args[\"maxElements\"] as number | undefined) ?? 60;\n const elements = (await session.selectors()).slice(0, maxElements);\n const consoleLogs = await session.getConsoleLogs().catch(() => []);\n const jsErrors = await session.getJSErrors().catch(() => []);\n return this.jsonResult({\n platform: session.platform,\n elementCount: elements.length,\n elements,\n recentConsoleLogs: consoleLogs.slice(-15),\n jsErrors: jsErrors.slice(-10),\n });\n }\n\n case \"spana_tap\": {\n const session = this.requireSession();\n const selector = args[\"selector\"] as ExtendedSelector;\n await session.tap(selector);\n const codeLine = `await app.tap(${formatSelectorCode(selector)});`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_input_text\": {\n const session = this.requireSession();\n const text = String(args[\"text\"] ?? \"\");\n await session.inputText(text);\n const codeLine = `await app.inputText(${JSON.stringify(text)});`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_fill\": {\n const session = this.requireSession();\n const selector = args[\"selector\"] as ExtendedSelector;\n const value = String(args[\"value\"] ?? \"\");\n await session.tap(selector);\n await session.inputText(value);\n const codeLine = `await app.fill(${formatSelectorCode(selector)}, ${JSON.stringify(value)});`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_assert_accessible\": {\n const session = this.requireSession();\n const standard = (args[\"standard\"] as string | undefined) ?? \"wcag21aa\";\n const failOnSeverity = (args[\"failOnSeverity\"] as string | undefined) ?? \"serious\";\n const optsObj: Record<string, string> = {};\n if (args[\"standard\"]) optsObj[\"standard\"] = standard;\n if (args[\"failOnSeverity\"]) optsObj[\"failOnSeverity\"] = failOnSeverity;\n const optsArg = Object.keys(optsObj).length > 0 ? JSON.stringify(optsObj) : \"\";\n const codeLine = `await expect.screen().toBeAccessible(${optsArg});`;\n // Run a fast DOM accessibility sanity snapshot when on web\n let quickIssues: string[] = [];\n if (session.platform === \"web\") {\n const elements = await session.selectors().catch(() => []);\n quickIssues = elements\n .filter((e) => !e.text && !e.accessibilityLabel)\n .slice(0, 10)\n .map((e) => `Unlabeled interactive control (${e.elementType ?? \"element\"})`);\n }\n this.recordedLines.push(codeLine);\n return this.jsonResult({\n ok: true,\n codeLine,\n standard,\n failOnSeverity,\n quickIssues,\n });\n }\n\n case \"spana_assert_screenshot\": {\n const session = this.requireSession();\n const shotName = String(args[\"name\"] ?? \"screen\");\n const png = await session.screenshot();\n const optsObj: Record<string, unknown> = {};\n if (typeof args[\"mode\"] === \"string\") optsObj[\"mode\"] = args[\"mode\"];\n if (typeof args[\"maxDiffPixelRatio\"] === \"number\") {\n optsObj[\"maxDiffPixelRatio\"] = args[\"maxDiffPixelRatio\"];\n }\n const optsArg = Object.keys(optsObj).length > 0 ? `, ${JSON.stringify(optsObj)}` : \"\";\n const codeLine = `await expect.screen().toMatchScreenshot(${JSON.stringify(shotName)}${optsArg});`;\n this.recordedLines.push(codeLine);\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify({ ok: true, name: shotName, codeLine, bytes: png.byteLength }),\n },\n {\n type: \"image\",\n data: Buffer.from(png).toString(\"base64\"),\n mimeType: \"image/png\",\n },\n ],\n };\n }\n\n case \"spana_assert_visible\": {\n const session = this.requireSession();\n const selector = args[\"selector\"] as ExtendedSelector;\n const elements = await session.selectors();\n const sel = selector as Record<string, unknown>;\n const matched = elements.some((el) => {\n if (typeof sel[\"testID\"] === \"string\") return el.id === sel[\"testID\"];\n if (typeof sel[\"text\"] === \"string\") return el.text?.includes(sel[\"text\"]);\n if (typeof sel[\"accessibilityLabel\"] === \"string\") {\n return el.accessibilityLabel === sel[\"accessibilityLabel\"];\n }\n return false;\n });\n if (!matched) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: JSON.stringify({\n ok: false,\n message: `Element not visible: ${formatSelectorCode(selector)}`,\n availableTestIDs: elements\n .map((e) => e.id)\n .filter(Boolean)\n .slice(0, 20),\n }),\n },\n ],\n };\n }\n const codeLine = `await expect(${formatSelectorCode(selector)}).toBeVisible();`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_open_link\": {\n const session = this.requireSession();\n const url = String(args[\"url\"] ?? \"\");\n await session.openLink(url);\n const codeLine = `await app.openLink(${JSON.stringify(url)});`;\n this.recordedLines.push(codeLine);\n return this.jsonResult({ ok: true, codeLine });\n }\n\n case \"spana_screenshot\": {\n const session = this.requireSession();\n const png = await session.screenshot();\n return {\n content: [\n {\n type: \"image\",\n data: Buffer.from(png).toString(\"base64\"),\n mimeType: \"image/png\",\n },\n ],\n };\n }\n\n case \"spana_diagnostics\": {\n const session = this.requireSession();\n const [elements, consoleLogs, jsErrors] = await Promise.all([\n session.selectors().catch(() => []),\n session.getConsoleLogs().catch(() => []),\n session.getJSErrors().catch(() => []),\n ]);\n return this.jsonResult({\n platform: session.platform,\n actionableElements: elements.length,\n testIDCount: elements.filter((e) => Boolean(e.id)).length,\n consoleLogCount: consoleLogs.length,\n consoleLogs: consoleLogs.slice(-25),\n jsErrorCount: jsErrors.length,\n jsErrors: jsErrors.slice(-15),\n });\n }\n\n case \"spana_export_flow\": {\n const flowName = (args[\"flowName\"] as string | undefined) ?? \"recorded flow\";\n return this.jsonResult({\n flowName,\n stepCount: this.recordedLines.length,\n code: buildFlowFileFromLines(flowName, this.recordedLines),\n });\n }\n\n case \"spana_run_flow\": {\n const flowPath = String(args[\"flowPath\"] ?? \"\");\n const platform = args[\"platform\"] as Platform | undefined;\n const passed = await this.runFlowFn({ flowPath, platform });\n return this.jsonResult({ flowPath, platform: platform ?? \"default\", passed });\n }\n\n case \"spana_network_logs\": {\n const session = this.requireSession();\n const har = await session.getHAR().catch(() => null);\n const urlIncludes =\n typeof args[\"urlIncludes\"] === \"string\" ? args[\"urlIncludes\"].toLowerCase() : undefined;\n const methodFilter =\n typeof args[\"method\"] === \"string\" ? args[\"method\"].toUpperCase() : undefined;\n const failedOnly = Boolean(args[\"failedOnly\"]);\n const limit = typeof args[\"limit\"] === \"number\" ? args[\"limit\"] : 50;\n const entries = (har?.log?.entries ?? [])\n .map((e) => ({\n method: e.request.method,\n url: e.request.url,\n status: e.response.status,\n statusText: e.response.statusText,\n durationMs: e.time,\n resourceType: e._resourceType,\n failed:\n e.response.status === 0 || e.response.status >= 400 || Boolean(e._failureText),\n errorText: e._failureText,\n }))\n .filter((e) => {\n if (urlIncludes && !e.url.toLowerCase().includes(urlIncludes)) return false;\n if (methodFilter && e.method.toUpperCase() !== methodFilter) return false;\n if (failedOnly && !e.failed) return false;\n return true;\n })\n .slice(-Math.max(1, limit));\n return this.jsonResult({ count: entries.length, entries });\n }\n\n case \"spana_component_tree\": {\n const session = this.requireSession();\n const maxDepth = typeof args[\"maxDepth\"] === \"number\" ? args[\"maxDepth\"] : undefined;\n const maxNodes = typeof args[\"maxNodes\"] === \"number\" ? args[\"maxNodes\"] : undefined;\n const report = await session.evaluate<ComponentTreeReport>(\n buildComponentTreeScript({ maxDepth, maxNodes }),\n );\n return this.jsonResult(report);\n }\n\n case \"spana_performance_profile\": {\n const session = this.requireSession();\n const profile = await session.evaluate<PerformanceProfileReport>(\n buildPerformanceProfileScript(),\n );\n return this.jsonResult(profile);\n }\n\n default:\n return {\n isError: true,\n content: [{ type: \"text\", text: `Unknown tool: ${name}` }],\n };\n }\n } catch (err) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: err instanceof Error ? err.message : String(err),\n },\n ],\n };\n }\n }\n\n private jsonResult(payload: unknown): McpToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify(payload, null, 2) }],\n };\n }\n\n /** Run the server over newline-delimited JSON-RPC stdio until stdin closes. */\n async runStdio(): Promise<void> {\n const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });\n for await (const line of rl) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n try {\n const req = JSON.parse(trimmed) as JsonRpcRequest;\n const res = await this.handleRequest(req);\n if (res) {\n process.stdout.write(`${JSON.stringify(res)}\\n`);\n }\n } catch (err) {\n const parseErr: JsonRpcResponse = {\n jsonrpc: \"2.0\",\n id: null,\n error: {\n code: -32700,\n message: err instanceof Error ? err.message : \"Parse error\",\n },\n };\n process.stdout.write(`${JSON.stringify(parseErr)}\\n`);\n }\n }\n if (this.session) {\n await this.session.disconnect().catch(() => undefined);\n this.session = null;\n }\n }\n}\n","/**\n * Argent-inspired live diagnostics & profiling utilities:\n * 1. `NetworkEventBuffer` — live ring buffer of HTTP/GraphQL/Fetch requests with status/error/URL filtering.\n * 2. `buildComponentTreeScript()` — inspect live React Fiber, Vue 3, and custom Web Component trees.\n * 3. `buildPerformanceProfileScript()` — capture Web Vitals (LCP, CLS, FCP, TTFB), navigation timing,\n * long tasks, resource breakdown, and V8 JS heap usage in a single evaluation.\n */\n\nexport interface LiveNetworkEvent {\n requestId: string;\n url: string;\n method: string;\n resourceType?: string;\n startedAt: number;\n finishedAt?: number;\n durationMs?: number;\n status?: number;\n statusText?: string;\n mimeType?: string;\n failed?: boolean;\n errorText?: string;\n requestHeaders?: Record<string, string>;\n responseHeaders?: Record<string, string>;\n}\n\nexport interface NetworkEventFilter {\n urlIncludes?: string;\n method?: string;\n minStatus?: number;\n failedOnly?: boolean;\n limit?: number;\n}\n\n/**\n * Bounded in-memory ring buffer capturing live network requests from CDP (`Network.*`)\n * or Playwright (`request` / `response` / `requestfailed`) events.\n */\nexport class NetworkEventBuffer {\n private readonly maxEntries: number;\n private readonly events: LiveNetworkEvent[] = [];\n private readonly byId = new Map<string, LiveNetworkEvent>();\n\n constructor(maxEntries = 300) {\n this.maxEntries = Math.max(10, maxEntries);\n }\n\n recordRequest(input: {\n requestId: string;\n url: string;\n method: string;\n resourceType?: string;\n timestamp?: number;\n headers?: Record<string, string>;\n }): LiveNetworkEvent {\n const entry: LiveNetworkEvent = {\n requestId: input.requestId,\n url: input.url,\n method: input.method.toUpperCase(),\n resourceType: input.resourceType,\n startedAt: input.timestamp ?? Date.now(),\n ...(input.headers ? { requestHeaders: input.headers } : {}),\n };\n this.byId.set(input.requestId, entry);\n this.events.push(entry);\n if (this.events.length > this.maxEntries) {\n const evicted = this.events.shift();\n if (evicted) this.byId.delete(evicted.requestId);\n }\n return entry;\n }\n\n recordResponse(input: {\n requestId: string;\n status: number;\n statusText?: string;\n mimeType?: string;\n timestamp?: number;\n headers?: Record<string, string>;\n url?: string;\n }): LiveNetworkEvent | undefined {\n const existing = this.byId.get(input.requestId);\n const finishedAt = input.timestamp ?? Date.now();\n if (existing) {\n existing.status = input.status;\n existing.statusText = input.statusText;\n existing.mimeType = input.mimeType;\n existing.finishedAt = finishedAt;\n existing.durationMs = Math.max(0, finishedAt - existing.startedAt);\n if (input.headers) existing.responseHeaders = input.headers;\n return existing;\n }\n if (!input.url) return undefined;\n const synthetic = this.recordRequest({\n requestId: input.requestId,\n url: input.url,\n method: \"GET\",\n timestamp: finishedAt,\n });\n synthetic.status = input.status;\n synthetic.statusText = input.statusText;\n synthetic.mimeType = input.mimeType;\n synthetic.finishedAt = finishedAt;\n synthetic.durationMs = 0;\n if (input.headers) synthetic.responseHeaders = input.headers;\n return synthetic;\n }\n\n recordFailure(input: {\n requestId: string;\n errorText: string;\n timestamp?: number;\n }): LiveNetworkEvent | undefined {\n const existing = this.byId.get(input.requestId);\n if (!existing) return undefined;\n const finishedAt = input.timestamp ?? Date.now();\n existing.failed = true;\n existing.errorText = input.errorText;\n existing.finishedAt = finishedAt;\n existing.durationMs = Math.max(0, finishedAt - existing.startedAt);\n return existing;\n }\n\n query(filter: NetworkEventFilter = {}): LiveNetworkEvent[] {\n let result = this.events.filter((e) => {\n if (filter.urlIncludes && !e.url.toLowerCase().includes(filter.urlIncludes.toLowerCase())) {\n return false;\n }\n if (filter.method && e.method !== filter.method.toUpperCase()) {\n return false;\n }\n if (filter.failedOnly && !e.failed && (e.status === undefined || e.status < 400)) {\n return false;\n }\n if (\n filter.minStatus !== undefined &&\n (e.status === undefined || e.status < filter.minStatus)\n ) {\n return false;\n }\n return true;\n });\n if (filter.limit && filter.limit > 0 && result.length > filter.limit) {\n result = result.slice(-filter.limit);\n }\n return result.map((e) => ({ ...e }));\n }\n\n clear(): void {\n this.events.length = 0;\n this.byId.clear();\n }\n\n get size(): number {\n return this.events.length;\n }\n}\n\nexport interface ComponentTreeNode {\n framework: \"react\" | \"vue\" | \"web-component\";\n name: string;\n testID?: string;\n props?: Record<string, unknown>;\n children: ComponentTreeNode[];\n}\n\nexport interface ComponentTreeReport {\n detectedFrameworks: Array<\"react\" | \"vue\" | \"web-component\">;\n nodeCount: number;\n roots: ComponentTreeNode[];\n}\n\n/**\n * Build a self-contained browser JS snippet that extracts the live React Fiber, Vue 3,\n * and Custom Element component tree with sanitized prop previews (Argent-inspired).\n */\nexport function buildComponentTreeScript(opts?: { maxDepth?: number; maxNodes?: number }): string {\n const maxDepth = Math.max(1, opts?.maxDepth ?? 12);\n const maxNodes = Math.max(10, opts?.maxNodes ?? 200);\n return `(() => {\n const MAX_DEPTH = ${maxDepth};\n const MAX_NODES = ${maxNodes};\n let count = 0;\n const detected = new Set();\n\n function summarizeProps(obj) {\n if (!obj || typeof obj !== \"object\") return undefined;\n const out = {};\n let keys = 0;\n for (const [k, v] of Object.entries(obj)) {\n if (k === \"children\" || k.startsWith(\"__\")) continue;\n if (keys >= 8) break;\n if (typeof v === \"string\" || typeof v === \"number\" || typeof v === \"boolean\") {\n out[k] = typeof v === \"string\" && v.length > 60 ? v.slice(0, 57) + \"...\" : v;\n keys++;\n } else if (v === null) {\n out[k] = null;\n keys++;\n } else if (typeof v === \"function\") {\n out[k] = \"[Function]\";\n keys++;\n }\n }\n return keys > 0 ? out : undefined;\n }\n\n function walkReactFiber(fiber, depth) {\n const nodes = [];\n let cur = fiber;\n while (cur && count < MAX_NODES) {\n const type = cur.type;\n const isComponent = typeof type === \"function\" || (type && typeof type === \"object\");\n const name = typeof type === \"function\"\n ? (type.displayName || type.name || \"Anonymous\")\n : (type && typeof type === \"object\" ? (type.displayName || type.render?.name || \"Component\") : null);\n\n if (isComponent && name && depth < MAX_DEPTH) {\n count++;\n const props = cur.memoizedProps;\n const testID = props && (props[\"data-testid\"] || props.testID || undefined);\n const children = cur.child ? walkReactFiber(cur.child, depth + 1) : [];\n nodes.push({\n framework: \"react\",\n name: String(name),\n ...(testID ? { testID: String(testID) } : {}),\n ...(summarizeProps(props) ? { props: summarizeProps(props) } : {}),\n children,\n });\n } else if (cur.child && depth < MAX_DEPTH) {\n nodes.push(...walkReactFiber(cur.child, depth));\n }\n cur = cur.sibling;\n }\n return nodes;\n }\n\n const roots = [];\n\n // 1. React 16-19 Fiber roots\n const allEls = [document.documentElement, document.body, ...Array.from(document.querySelectorAll(\"*\")).slice(0, 250)].filter(Boolean);\n const seenFibers = new Set();\n for (const el of allEls) {\n const keys = Object.keys(el);\n const fiberKey = keys.find((k) => k.startsWith(\"__reactFiber$\") || k.startsWith(\"__reactInternalInstance$\") || k.startsWith(\"__reactContainer$\"));\n if (fiberKey) {\n detected.add(\"react\");\n let rootFiber = el[fiberKey];\n if (rootFiber && rootFiber.stateNode && rootFiber.stateNode.current) {\n rootFiber = rootFiber.stateNode.current;\n }\n while (rootFiber && rootFiber.return) rootFiber = rootFiber.return;\n if (rootFiber && !seenFibers.has(rootFiber)) {\n seenFibers.add(rootFiber);\n roots.push(...walkReactFiber(rootFiber, 0));\n }\n }\n // 2. Vue 3 app root\n if (el.__vue_app__ && el.__vue_app__._container) {\n detected.add(\"vue\");\n const vnode = el.__vue_app__._instance?.subTree;\n const walkVue = (node, depth) => {\n if (!node || count >= MAX_NODES || depth > MAX_DEPTH) return [];\n const name = node.type?.name || node.type?.__name;\n const children = [];\n if (Array.isArray(node.children)) {\n for (const c of node.children) children.push(...walkVue(c, depth + 1));\n } else if (node.component?.subTree) {\n children.push(...walkVue(node.component.subTree, depth + 1));\n }\n if (name) {\n count++;\n return [{\n framework: \"vue\",\n name: String(name),\n ...(summarizeProps(node.props) ? { props: summarizeProps(node.props) } : {}),\n children,\n }];\n }\n return children;\n };\n if (vnode) roots.push(...walkVue(vnode, 0));\n }\n // 3. Custom Web Components (hyphenated tag names)\n if (el.tagName && el.tagName.includes(\"-\") && count < MAX_NODES) {\n detected.add(\"web-component\");\n count++;\n roots.push({\n framework: \"web-component\",\n name: el.tagName.toLowerCase(),\n ...(el.getAttribute(\"data-testid\") ? { testID: el.getAttribute(\"data-testid\") } : {}),\n children: [],\n });\n }\n }\n\n return {\n detectedFrameworks: Array.from(detected),\n nodeCount: count,\n roots,\n };\n })()`;\n}\n\nexport interface PerformanceProfileReport {\n url: string;\n timestamp: string;\n navigation?: {\n ttfbMs: number;\n domContentLoadedMs: number;\n loadEventMs: number;\n transferSizeBytes: number;\n };\n vitals: {\n fcpMs?: number;\n lcpMs?: number;\n cls?: number;\n };\n longTaskCount: number;\n longTaskTotalMs: number;\n resourceCount: number;\n slowestResources: Array<{\n name: string;\n initiatorType: string;\n durationMs: number;\n transferSize: number;\n }>;\n jsHeap?: {\n usedBytes: number;\n totalBytes: number;\n limitBytes: number;\n };\n domNodeCount: number;\n}\n\n/**\n * Build a self-contained browser JS snippet that collects Web Vitals (FCP/LCP/CLS),\n * Navigation Timing (TTFB/DCL/Load), Long Tasks, slowest resources, DOM size, and JS heap.\n */\nexport function buildPerformanceProfileScript(): string {\n return `(() => {\n const perf = window.performance;\n const navEntries = perf && perf.getEntriesByType ? perf.getEntriesByType(\"navigation\") : [];\n const nav = navEntries && navEntries[0];\n const paintEntries = perf && perf.getEntriesByType ? perf.getEntriesByType(\"paint\") : [];\n const fcpEntry = paintEntries.find((e) => e.name === \"first-contentful-paint\");\n const lcpEntries = perf && perf.getEntriesByType ? perf.getEntriesByType(\"largest-contentful-paint\") : [];\n const lcpEntry = lcpEntries && lcpEntries.length > 0 ? lcpEntries[lcpEntries.length - 1] : undefined;\n const layoutShifts = perf && perf.getEntriesByType ? perf.getEntriesByType(\"layout-shift\") : [];\n let cls = 0;\n for (const ls of layoutShifts) {\n if (!ls.hadRecentInput && typeof ls.value === \"number\") cls += ls.value;\n }\n const longTasks = perf && perf.getEntriesByType ? perf.getEntriesByType(\"longtask\") : [];\n let longTaskTotalMs = 0;\n for (const lt of longTasks) longTaskTotalMs += Number(lt.duration || 0);\n\n const resources = perf && perf.getEntriesByType ? perf.getEntriesByType(\"resource\") : [];\n const slowestResources = resources\n .map((r) => ({\n name: String(r.name || \"\").slice(0, 140),\n initiatorType: String(r.initiatorType || \"other\"),\n durationMs: Math.round(Number(r.duration || 0)),\n transferSize: Number(r.transferSize || 0),\n }))\n .sort((a, b) => b.durationMs - a.durationMs)\n .slice(0, 10);\n\n const mem = perf && perf.memory ? {\n usedBytes: Number(perf.memory.usedJSHeapSize || 0),\n totalBytes: Number(perf.memory.totalJSHeapSize || 0),\n limitBytes: Number(perf.memory.jsHeapSizeLimit || 0),\n } : undefined;\n\n return {\n url: String(window.location.href || \"\"),\n timestamp: new Date().toISOString(),\n ...(nav ? {\n navigation: {\n ttfbMs: Math.round(Number(nav.responseStart || 0)),\n domContentLoadedMs: Math.round(Number(nav.domContentLoadedEventEnd || 0)),\n loadEventMs: Math.round(Number(nav.loadEventEnd || 0)),\n transferSizeBytes: Number(nav.transferSize || 0),\n },\n } : {}),\n vitals: {\n ...(fcpEntry ? { fcpMs: Math.round(Number(fcpEntry.startTime || 0)) } : {}),\n ...(lcpEntry ? { lcpMs: Math.round(Number(lcpEntry.startTime || 0)) } : {}),\n cls: Math.round(cls * 10000) / 10000,\n },\n longTaskCount: longTasks.length,\n longTaskTotalMs: Math.round(longTaskTotalMs),\n resourceCount: resources.length,\n slowestResources,\n ...(mem ? { jsHeap: mem } : {}),\n domNodeCount: document.querySelectorAll(\"*\").length,\n };\n })()`;\n}\n"],"mappings":";;;;;;AAAA;AAAA,SAAS,uBAAuB;;;ACAhC;AAqCO,IAAM,qBAAN,MAAyB;AAAA,EACb;AAAA,EACA,SAA6B,CAAC;AAAA,EAC9B,OAAO,oBAAI,IAA8B;AAAA,EAE1D,YAAY,aAAa,KAAK;AAC5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ACF;AAAA,EACF;AAAA,EAEQ,WAAW,SAAiC;AAClD,WAAO;AAAA,MACL,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE,CAAC;AAAA,IACpE;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,WAA0B;AAC9B,UAAM,KAAK,gBAAgB,EAAE,OAAO,QAAQ,OAAO,WAAW,SAAS,CAAC;AACxE,qBAAiB,QAAQ,IAAI;AAC3B,YAAM,UAAU,KAAK,KAAK;AAC1B,UAAI,CAAC,QAAS;AACd,UAAI;AACF,cAAM,MAAM,KAAK,MAAM,OAAO;AAC9B,cAAM,MAAM,MAAM,KAAK,cAAc,GAAG;AACxC,YAAI,KAAK;AACP,kBAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,GAAG,CAAC;AAAA,CAAI;AAAA,QACjD;AAAA,MACF,SAAS,KAAK;AACZ,cAAM,WAA4B;AAAA,UAChC,SAAS;AAAA,UACT,IAAI;AAAA,UACJ,OAAO;AAAA,YACL,MAAM;AAAA,YACN,SAAS,eAAe,QAAQ,IAAI,UAAU;AAAA,UAChD;AAAA,QACF;AACA,gBAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,CAAC;AAAA,CAAI;AAAA,MACtD;AAAA,IACF;AACA,QAAI,KAAK,SAAS;AAChB,YAAM,KAAK,QAAQ,WAAW,EAAE,MAAM,MAAM,MAAS;AACrD,WAAK,UAAU;AAAA,IACjB;AAAA,EACF;AACF;","names":[]}
@@ -1,13 +1,14 @@
1
+ import { createRequire as __spanaCreateRequire } from "node:module"; const require = __spanaCreateRequire(import.meta.url);
1
2
  import {
2
3
  listIOSPhysicalDevices,
3
4
  listIOSSimulators
4
- } from "./chunk-2MA5G2VH.js";
5
+ } from "./chunk-AGG2RJGU.js";
5
6
  import {
6
7
  listAndroidDevices
7
- } from "./chunk-XVL4FHXA.js";
8
+ } from "./chunk-T46S4VA3.js";
8
9
  import {
9
10
  init_esm_shims
10
- } from "./chunk-FTXUQMGH.js";
11
+ } from "./chunk-VBAPZMPX.js";
11
12
 
12
13
  // src/device/discover.ts
13
14
  init_esm_shims();
@@ -90,4 +91,4 @@ export {
90
91
  firstDeviceForPlatform,
91
92
  findDeviceById
92
93
  };
93
- //# sourceMappingURL=chunk-GDVHJBR2.js.map
94
+ //# sourceMappingURL=chunk-CZAFFUMN.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/device/discover.ts"],"sourcesContent":["import type { Platform } from \"../schemas/selector.js\";\nimport { listAndroidDevices } from \"./android.js\";\nimport { listIOSPhysicalDevices, listIOSSimulators } from \"./ios.js\";\n\nexport interface DiscoveredDevice {\n platform: Platform;\n id: string;\n name: string;\n type: \"emulator\" | \"simulator\" | \"device\" | \"browser\" | \"desktop\";\n state: string;\n}\n\n/** Discover all available devices across requested platforms */\nexport function discoverDevices(platforms: Platform[]): DiscoveredDevice[] {\n const devices: DiscoveredDevice[] = [];\n\n if (platforms.includes(\"web\")) {\n devices.push({\n platform: \"web\",\n id: \"playwright-chromium\",\n name: \"Chromium (Playwright)\",\n type: \"browser\",\n state: \"available\",\n });\n }\n\n if (platforms.includes(\"electron\")) {\n devices.push({\n platform: \"electron\",\n id: \"electron-local\",\n name: \"Electron (Playwright _electron / CDP)\",\n type: \"desktop\",\n state: \"available\",\n });\n }\n\n if (platforms.includes(\"electrobun\")) {\n devices.push({\n platform: \"electrobun\",\n id: \"electrobun-local\",\n name: \"Electrobun (Native WebView / CEF)\",\n type: \"desktop\",\n state: \"available\",\n });\n }\n\n if (platforms.includes(\"android\")) {\n for (const d of listAndroidDevices()) {\n if (d.state === \"device\") {\n devices.push({\n platform: \"android\",\n id: d.serial,\n name: d.serial,\n type: d.type === \"emulator\" ? \"emulator\" : \"device\",\n state: d.state,\n });\n }\n }\n }\n\n if (platforms.includes(\"ios\")) {\n for (const device of listIOSPhysicalDevices()) {\n devices.push({\n platform: \"ios\",\n id: device.udid,\n name: device.name,\n type: \"device\",\n state: \"connected\",\n });\n }\n\n for (const s of listIOSSimulators()) {\n if (!s.isAvailable) continue;\n devices.push({\n platform: \"ios\",\n id: s.udid,\n name: `${s.name} (${s.runtime})`,\n type: \"simulator\",\n state: s.state,\n });\n }\n }\n\n return devices;\n}\n\n/** Get first available device for a platform */\nexport function firstDeviceForPlatform(platform: Platform): DiscoveredDevice | null {\n const devices = discoverDevices([platform]);\n return devices[0] ?? null;\n}\n\n/** Find a specific device by ID across all platforms */\nexport function findDeviceById(id: string): DiscoveredDevice | null {\n const devices = discoverDevices([\"web\", \"android\", \"ios\", \"electron\", \"electrobun\"]);\n return devices.find((d) => d.id === id) ?? null;\n}\n"],"mappings":";;;;;;;;;;;;AAAA;AAaO,SAAS,gBAAgB,WAA2C;AACzE,QAAM,UAA8B,CAAC;AAErC,MAAI,UAAU,SAAS,KAAK,GAAG;AAC7B,YAAQ,KAAK;AAAA,MACX,UAAU;AAAA,MACV,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,MAAI,UAAU,SAAS,UAAU,GAAG;AAClC,YAAQ,KAAK;AAAA,MACX,UAAU;AAAA,MACV,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,MAAI,UAAU,SAAS,YAAY,GAAG;AACpC,YAAQ,KAAK;AAAA,MACX,UAAU;AAAA,MACV,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,MAAI,UAAU,SAAS,SAAS,GAAG;AACjC,eAAW,KAAK,mBAAmB,GAAG;AACpC,UAAI,EAAE,UAAU,UAAU;AACxB,gBAAQ,KAAK;AAAA,UACX,UAAU;AAAA,UACV,IAAI,EAAE;AAAA,UACN,MAAM,EAAE;AAAA,UACR,MAAM,EAAE,SAAS,aAAa,aAAa;AAAA,UAC3C,OAAO,EAAE;AAAA,QACX,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,MAAI,UAAU,SAAS,KAAK,GAAG;AAC7B,eAAW,UAAU,uBAAuB,GAAG;AAC7C,cAAQ,KAAK;AAAA,QACX,UAAU;AAAA,QACV,IAAI,OAAO;AAAA,QACX,MAAM,OAAO;AAAA,QACb,MAAM;AAAA,QACN,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAEA,eAAW,KAAK,kBAAkB,GAAG;AACnC,UAAI,CAAC,EAAE,YAAa;AACpB,cAAQ,KAAK;AAAA,QACX,UAAU;AAAA,QACV,IAAI,EAAE;AAAA,QACN,MAAM,GAAG,EAAE,IAAI,KAAK,EAAE,OAAO;AAAA,QAC7B,MAAM;AAAA,QACN,OAAO,EAAE;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;AAGO,SAAS,uBAAuB,UAA6C;AAClF,QAAM,UAAU,gBAAgB,CAAC,QAAQ,CAAC;AAC1C,SAAO,QAAQ,CAAC,KAAK;AACvB;AAGO,SAAS,eAAe,IAAqC;AAClE,QAAM,UAAU,gBAAgB,CAAC,OAAO,WAAW,OAAO,YAAY,YAAY,CAAC;AACnF,SAAO,QAAQ,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK;AAC7C;","names":[]}
1
+ {"version":3,"sources":["../src/device/discover.ts"],"sourcesContent":["import type { Platform } from \"../schemas/selector.js\";\nimport { listAndroidDevices } from \"./android.js\";\nimport { listIOSPhysicalDevices, listIOSSimulators } from \"./ios.js\";\n\nexport interface DiscoveredDevice {\n platform: Platform;\n id: string;\n name: string;\n type: \"emulator\" | \"simulator\" | \"device\" | \"browser\" | \"desktop\";\n state: string;\n}\n\n/** Discover all available devices across requested platforms */\nexport function discoverDevices(platforms: Platform[]): DiscoveredDevice[] {\n const devices: DiscoveredDevice[] = [];\n\n if (platforms.includes(\"web\")) {\n devices.push({\n platform: \"web\",\n id: \"playwright-chromium\",\n name: \"Chromium (Playwright)\",\n type: \"browser\",\n state: \"available\",\n });\n }\n\n if (platforms.includes(\"electron\")) {\n devices.push({\n platform: \"electron\",\n id: \"electron-local\",\n name: \"Electron (Playwright _electron / CDP)\",\n type: \"desktop\",\n state: \"available\",\n });\n }\n\n if (platforms.includes(\"electrobun\")) {\n devices.push({\n platform: \"electrobun\",\n id: \"electrobun-local\",\n name: \"Electrobun (Native WebView / CEF)\",\n type: \"desktop\",\n state: \"available\",\n });\n }\n\n if (platforms.includes(\"android\")) {\n for (const d of listAndroidDevices()) {\n if (d.state === \"device\") {\n devices.push({\n platform: \"android\",\n id: d.serial,\n name: d.serial,\n type: d.type === \"emulator\" ? \"emulator\" : \"device\",\n state: d.state,\n });\n }\n }\n }\n\n if (platforms.includes(\"ios\")) {\n for (const device of listIOSPhysicalDevices()) {\n devices.push({\n platform: \"ios\",\n id: device.udid,\n name: device.name,\n type: \"device\",\n state: \"connected\",\n });\n }\n\n for (const s of listIOSSimulators()) {\n if (!s.isAvailable) continue;\n devices.push({\n platform: \"ios\",\n id: s.udid,\n name: `${s.name} (${s.runtime})`,\n type: \"simulator\",\n state: s.state,\n });\n }\n }\n\n return devices;\n}\n\n/** Get first available device for a platform */\nexport function firstDeviceForPlatform(platform: Platform): DiscoveredDevice | null {\n const devices = discoverDevices([platform]);\n return devices[0] ?? null;\n}\n\n/** Find a specific device by ID across all platforms */\nexport function findDeviceById(id: string): DiscoveredDevice | null {\n const devices = discoverDevices([\"web\", \"android\", \"ios\", \"electron\", \"electrobun\"]);\n return devices.find((d) => d.id === id) ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AAaO,SAAS,gBAAgB,WAA2C;AACzE,QAAM,UAA8B,CAAC;AAErC,MAAI,UAAU,SAAS,KAAK,GAAG;AAC7B,YAAQ,KAAK;AAAA,MACX,UAAU;AAAA,MACV,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,IACT,CAAC;AAAA,E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vB;AAGO,SAAS,eAAe,IAAqC;AAClE,QAAM,UAAU,gBAAgB,CAAC,OAAO,WAAW,OAAO,YAAY,YAAY,CAAC;AACnF,SAAO,QAAQ,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK;AAC7C;","names":[]}
@@ -1,6 +1,7 @@
1
+ import { createRequire as __spanaCreateRequire } from "node:module"; const require = __spanaCreateRequire(import.meta.url);
1
2
  import {
2
3
  init_esm_shims
3
- } from "./chunk-FTXUQMGH.js";
4
+ } from "./chunk-VBAPZMPX.js";
4
5
 
5
6
  // src/core/filters.ts
6
7
  init_esm_shims();
@@ -613,4 +614,4 @@ export {
613
614
  applyTestFilters,
614
615
  formatFilterSummary
615
616
  };
616
- //# sourceMappingURL=chunk-FSPMFRJO.js.map
617
+ //# sourceMappingURL=chunk-FBJPNZUN.js.map