visionclaw 0.1.193 → 0.1.194-dev.feat-backup-progress-reporting.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/dist/agent/backup-uploader.d.ts +44 -0
  2. package/dist/agent/backup-uploader.d.ts.map +1 -0
  3. package/dist/agent/backup-uploader.js +83 -0
  4. package/dist/agent/backup-uploader.js.map +1 -0
  5. package/dist/agent/backup.d.ts +7 -1
  6. package/dist/agent/backup.d.ts.map +1 -1
  7. package/dist/agent/backup.js +337 -52
  8. package/dist/agent/backup.js.map +1 -1
  9. package/dist/agent/command-handlers.d.ts +2 -0
  10. package/dist/agent/command-handlers.d.ts.map +1 -1
  11. package/dist/agent/command-handlers.js +29 -3
  12. package/dist/agent/command-handlers.js.map +1 -1
  13. package/dist/agent/context.d.ts +2 -0
  14. package/dist/agent/context.d.ts.map +1 -1
  15. package/dist/agent/context.js +11 -1
  16. package/dist/agent/context.js.map +1 -1
  17. package/dist/agent/data-collector.d.ts.map +1 -1
  18. package/dist/agent/data-collector.js +23 -38
  19. package/dist/agent/data-collector.js.map +1 -1
  20. package/dist/agent/loop.d.ts +3 -0
  21. package/dist/agent/loop.d.ts.map +1 -1
  22. package/dist/agent/loop.js +48 -0
  23. package/dist/agent/loop.js.map +1 -1
  24. package/dist/agent/message-format.d.ts.map +1 -1
  25. package/dist/agent/message-format.js +3 -0
  26. package/dist/agent/message-format.js.map +1 -1
  27. package/dist/agent/status.d.ts.map +1 -1
  28. package/dist/agent/status.js +2 -1
  29. package/dist/agent/status.js.map +1 -1
  30. package/dist/backup.d.ts +4 -1
  31. package/dist/backup.d.ts.map +1 -1
  32. package/dist/backup.js +86 -3
  33. package/dist/backup.js.map +1 -1
  34. package/dist/calendar/google-calendar.d.ts +2 -0
  35. package/dist/calendar/google-calendar.d.ts.map +1 -1
  36. package/dist/calendar/google-calendar.js +3 -0
  37. package/dist/calendar/google-calendar.js.map +1 -1
  38. package/dist/channels/interface.d.ts +9 -0
  39. package/dist/channels/interface.d.ts.map +1 -1
  40. package/dist/channels/manager.d.ts +7 -1
  41. package/dist/channels/manager.d.ts.map +1 -1
  42. package/dist/channels/manager.js +12 -0
  43. package/dist/channels/manager.js.map +1 -1
  44. package/dist/channels/telegram.d.ts.map +1 -1
  45. package/dist/channels/telegram.js +5 -0
  46. package/dist/channels/telegram.js.map +1 -1
  47. package/dist/cli/index.d.ts +1 -0
  48. package/dist/cli/index.d.ts.map +1 -1
  49. package/dist/cli/index.js +42 -2
  50. package/dist/cli/index.js.map +1 -1
  51. package/dist/config/types.d.ts +9 -0
  52. package/dist/config/types.d.ts.map +1 -1
  53. package/dist/config/types.js +6 -0
  54. package/dist/config/types.js.map +1 -1
  55. package/dist/drive/google-drive.d.ts +1 -0
  56. package/dist/drive/google-drive.d.ts.map +1 -1
  57. package/dist/drive/google-drive.js +5 -0
  58. package/dist/drive/google-drive.js.map +1 -1
  59. package/dist/i18n/messages.d.ts +4 -0
  60. package/dist/i18n/messages.d.ts.map +1 -1
  61. package/dist/i18n/messages.js +7 -2
  62. package/dist/i18n/messages.js.map +1 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/obs/server.d.ts +7 -0
  65. package/dist/obs/server.d.ts.map +1 -1
  66. package/dist/obs/server.js +22 -0
  67. package/dist/obs/server.js.map +1 -1
  68. package/dist/onboarding/bot-profile.d.ts.map +1 -1
  69. package/dist/onboarding/bot-profile.js +1 -0
  70. package/dist/onboarding/bot-profile.js.map +1 -1
  71. package/dist/onboarding/index.d.ts.map +1 -1
  72. package/dist/onboarding/index.js +5 -0
  73. package/dist/onboarding/index.js.map +1 -1
  74. package/dist/onboarding/prepare-mac.d.ts +1 -0
  75. package/dist/onboarding/prepare-mac.d.ts.map +1 -1
  76. package/dist/onboarding/prepare-mac.js +32 -15
  77. package/dist/onboarding/prepare-mac.js.map +1 -1
  78. package/dist/onboarding/setup-shared.d.ts.map +1 -1
  79. package/dist/onboarding/setup-shared.js +6 -0
  80. package/dist/onboarding/setup-shared.js.map +1 -1
  81. package/dist/onboarding/setup-steps.d.ts.map +1 -1
  82. package/dist/onboarding/setup-steps.js +8 -0
  83. package/dist/onboarding/setup-steps.js.map +1 -1
  84. package/dist/realtime/agent-bridge.d.ts +7 -0
  85. package/dist/realtime/agent-bridge.d.ts.map +1 -0
  86. package/dist/realtime/agent-bridge.js +31 -0
  87. package/dist/realtime/agent-bridge.js.map +1 -0
  88. package/dist/realtime/assets/index.html +1058 -0
  89. package/dist/realtime/assets/samples/alloy.mp3 +0 -0
  90. package/dist/realtime/assets/samples/ash.mp3 +0 -0
  91. package/dist/realtime/assets/samples/ballad.mp3 +0 -0
  92. package/dist/realtime/assets/samples/cedar.mp3 +0 -0
  93. package/dist/realtime/assets/samples/coral.mp3 +0 -0
  94. package/dist/realtime/assets/samples/echo.mp3 +0 -0
  95. package/dist/realtime/assets/samples/marin.mp3 +0 -0
  96. package/dist/realtime/assets/samples/sage.mp3 +0 -0
  97. package/dist/realtime/assets/samples/shimmer.mp3 +0 -0
  98. package/dist/realtime/assets/samples/verse.mp3 +0 -0
  99. package/dist/realtime/context.d.ts +14 -0
  100. package/dist/realtime/context.d.ts.map +1 -0
  101. package/dist/realtime/context.js +153 -0
  102. package/dist/realtime/context.js.map +1 -0
  103. package/dist/realtime/http-helpers.d.ts +5 -0
  104. package/dist/realtime/http-helpers.d.ts.map +1 -0
  105. package/dist/realtime/http-helpers.js +29 -0
  106. package/dist/realtime/http-helpers.js.map +1 -0
  107. package/dist/realtime/index.d.ts +62 -0
  108. package/dist/realtime/index.d.ts.map +1 -0
  109. package/dist/realtime/index.js +94 -0
  110. package/dist/realtime/index.js.map +1 -0
  111. package/dist/realtime/server.d.ts +6 -0
  112. package/dist/realtime/server.d.ts.map +1 -0
  113. package/dist/realtime/server.js +476 -0
  114. package/dist/realtime/server.js.map +1 -0
  115. package/dist/realtime/telegram-auth.d.ts +2 -0
  116. package/dist/realtime/telegram-auth.d.ts.map +1 -0
  117. package/dist/realtime/telegram-auth.js +24 -0
  118. package/dist/realtime/telegram-auth.js.map +1 -0
  119. package/dist/realtime/tools.d.ts +829 -0
  120. package/dist/realtime/tools.d.ts.map +1 -0
  121. package/dist/realtime/tools.js +630 -0
  122. package/dist/realtime/tools.js.map +1 -0
  123. package/dist/realtime/types.d.ts +62 -0
  124. package/dist/realtime/types.d.ts.map +1 -0
  125. package/dist/realtime/types.js +3 -0
  126. package/dist/realtime/types.js.map +1 -0
  127. package/dist/realtime/voice-summarizer.d.ts +4 -0
  128. package/dist/realtime/voice-summarizer.d.ts.map +1 -0
  129. package/dist/realtime/voice-summarizer.js +129 -0
  130. package/dist/realtime/voice-summarizer.js.map +1 -0
  131. package/dist/restore.d.ts +5 -0
  132. package/dist/restore.d.ts.map +1 -1
  133. package/dist/restore.js +132 -16
  134. package/dist/restore.js.map +1 -1
  135. package/dist/tools/email.d.ts +1 -1
  136. package/dist/tools/memory.d.ts +13 -0
  137. package/dist/tools/memory.d.ts.map +1 -1
  138. package/dist/tools/memory.js +43 -43
  139. package/dist/tools/memory.js.map +1 -1
  140. package/dist/tools/stock-data.d.ts +16 -0
  141. package/dist/tools/stock-data.d.ts.map +1 -1
  142. package/dist/tools/stock-data.js +36 -38
  143. package/dist/tools/stock-data.js.map +1 -1
  144. package/dist/tools/web-fetch.d.ts +4 -0
  145. package/dist/tools/web-fetch.d.ts.map +1 -1
  146. package/dist/tools/web-fetch.js +95 -23
  147. package/dist/tools/web-fetch.js.map +1 -1
  148. package/dist/tos-storage.d.ts +45 -0
  149. package/dist/tos-storage.d.ts.map +1 -0
  150. package/dist/tos-storage.js +134 -0
  151. package/dist/tos-storage.js.map +1 -0
  152. package/dist-agent/bundle.cjs +170934 -167547
  153. package/package.json +3 -2
  154. package/dist/agent/applied-credential-signature.d.ts +0 -53
  155. package/dist/agent/applied-credential-signature.d.ts.map +0 -1
  156. package/dist/agent/applied-credential-signature.js +0 -137
  157. package/dist/agent/applied-credential-signature.js.map +0 -1
  158. package/dist/agent/engines/claude/cli-resolver.d.ts +0 -16
  159. package/dist/agent/engines/claude/cli-resolver.d.ts.map +0 -1
  160. package/dist/agent/engines/claude/cli-resolver.js +0 -83
  161. package/dist/agent/engines/claude/cli-resolver.js.map +0 -1
  162. package/dist/agent/engines/claude/session-browser-policy.d.ts +0 -9
  163. package/dist/agent/engines/claude/session-browser-policy.d.ts.map +0 -1
  164. package/dist/agent/engines/claude/session-browser-policy.js +0 -49
  165. package/dist/agent/engines/claude/session-browser-policy.js.map +0 -1
  166. package/dist/agent/engines/claude/session.d.ts +0 -291
  167. package/dist/agent/engines/claude/session.d.ts.map +0 -1
  168. package/dist/agent/engines/claude/session.js +0 -1177
  169. package/dist/agent/engines/claude/session.js.map +0 -1
  170. package/dist/agent/engines/client-factory.d.ts +0 -63
  171. package/dist/agent/engines/client-factory.d.ts.map +0 -1
  172. package/dist/agent/engines/client-factory.js +0 -382
  173. package/dist/agent/engines/client-factory.js.map +0 -1
  174. package/dist/agent/engines/engine.d.ts +0 -8
  175. package/dist/agent/engines/engine.d.ts.map +0 -1
  176. package/dist/agent/engines/engine.js +0 -15
  177. package/dist/agent/engines/engine.js.map +0 -1
  178. package/dist/agent/engines/openai/file-session.d.ts +0 -49
  179. package/dist/agent/engines/openai/file-session.d.ts.map +0 -1
  180. package/dist/agent/engines/openai/file-session.js +0 -108
  181. package/dist/agent/engines/openai/file-session.js.map +0 -1
  182. package/dist/agent/engines/openai/file-tools.d.ts +0 -35
  183. package/dist/agent/engines/openai/file-tools.d.ts.map +0 -1
  184. package/dist/agent/engines/openai/file-tools.js +0 -194
  185. package/dist/agent/engines/openai/file-tools.js.map +0 -1
  186. package/dist/agent/engines/openai/session.d.ts +0 -190
  187. package/dist/agent/engines/openai/session.d.ts.map +0 -1
  188. package/dist/agent/engines/openai/session.js +0 -1066
  189. package/dist/agent/engines/openai/session.js.map +0 -1
  190. package/dist/agent/engines/openai/tools.d.ts +0 -13
  191. package/dist/agent/engines/openai/tools.d.ts.map +0 -1
  192. package/dist/agent/engines/openai/tools.js +0 -248
  193. package/dist/agent/engines/openai/tools.js.map +0 -1
  194. package/dist/agent/engines/session-types.d.ts +0 -146
  195. package/dist/agent/engines/session-types.d.ts.map +0 -1
  196. package/dist/agent/engines/session-types.js +0 -2
  197. package/dist/agent/engines/session-types.js.map +0 -1
  198. package/dist/agent/engines/system-prompt-log.d.ts +0 -9
  199. package/dist/agent/engines/system-prompt-log.d.ts.map +0 -1
  200. package/dist/agent/engines/system-prompt-log.js +0 -46
  201. package/dist/agent/engines/system-prompt-log.js.map +0 -1
  202. package/dist/agent/transcript/transcript-backfill.d.ts +0 -54
  203. package/dist/agent/transcript/transcript-backfill.d.ts.map +0 -1
  204. package/dist/agent/transcript/transcript-backfill.js +0 -604
  205. package/dist/agent/transcript/transcript-backfill.js.map +0 -1
  206. package/dist/agent/transcript/transcript-indexer.d.ts +0 -273
  207. package/dist/agent/transcript/transcript-indexer.d.ts.map +0 -1
  208. package/dist/agent/transcript/transcript-indexer.js +0 -1217
  209. package/dist/agent/transcript/transcript-indexer.js.map +0 -1
  210. package/dist/agent/transcript/transcript-memory-migrations.d.ts +0 -25
  211. package/dist/agent/transcript/transcript-memory-migrations.d.ts.map +0 -1
  212. package/dist/agent/transcript/transcript-memory-migrations.js +0 -87
  213. package/dist/agent/transcript/transcript-memory-migrations.js.map +0 -1
  214. package/dist/agent/transcript-memory-migrations.d.ts +0 -25
  215. package/dist/agent/transcript-memory-migrations.d.ts.map +0 -1
  216. package/dist/agent/transcript-memory-migrations.js +0 -87
  217. package/dist/agent/transcript-memory-migrations.js.map +0 -1
  218. package/dist/agent/tunnel-credential-handler.d.ts +0 -90
  219. package/dist/agent/tunnel-credential-handler.d.ts.map +0 -1
  220. package/dist/agent/tunnel-credential-handler.js +0 -162
  221. package/dist/agent/tunnel-credential-handler.js.map +0 -1
  222. package/dist/agent/usage/usage-backfill-handler.d.ts +0 -18
  223. package/dist/agent/usage/usage-backfill-handler.d.ts.map +0 -1
  224. package/dist/agent/usage/usage-backfill-handler.js +0 -69
  225. package/dist/agent/usage/usage-backfill-handler.js.map +0 -1
  226. package/dist/agent/usage/usage-gate.d.ts +0 -25
  227. package/dist/agent/usage/usage-gate.d.ts.map +0 -1
  228. package/dist/agent/usage/usage-gate.js +0 -83
  229. package/dist/agent/usage/usage-gate.js.map +0 -1
  230. package/dist/agent/usage/usage-handler.d.ts +0 -7
  231. package/dist/agent/usage/usage-handler.d.ts.map +0 -1
  232. package/dist/agent/usage/usage-handler.js +0 -28
  233. package/dist/agent/usage/usage-handler.js.map +0 -1
  234. package/dist/agent/usage/usage-report-builder.d.ts +0 -26
  235. package/dist/agent/usage/usage-report-builder.d.ts.map +0 -1
  236. package/dist/agent/usage/usage-report-builder.js +0 -80
  237. package/dist/agent/usage/usage-report-builder.js.map +0 -1
  238. package/dist/agent/usage/usage-report-queue.d.ts +0 -26
  239. package/dist/agent/usage/usage-report-queue.d.ts.map +0 -1
  240. package/dist/agent/usage/usage-report-queue.js +0 -199
  241. package/dist/agent/usage/usage-report-queue.js.map +0 -1
  242. package/dist/agent/usage/usage-report-types.d.ts +0 -41
  243. package/dist/agent/usage/usage-report-types.d.ts.map +0 -1
  244. package/dist/agent/usage/usage-report-types.js +0 -2
  245. package/dist/agent/usage/usage-report-types.js.map +0 -1
  246. package/dist/agent/usage/usage-reporter.d.ts +0 -31
  247. package/dist/agent/usage/usage-reporter.d.ts.map +0 -1
  248. package/dist/agent/usage/usage-reporter.js +0 -102
  249. package/dist/agent/usage/usage-reporter.js.map +0 -1
  250. package/dist/agent/usage-backfill-handler.d.ts +0 -18
  251. package/dist/agent/usage-backfill-handler.d.ts.map +0 -1
  252. package/dist/agent/usage-backfill-handler.js +0 -69
  253. package/dist/agent/usage-backfill-handler.js.map +0 -1
  254. package/dist/agent/usage-gate.d.ts +0 -25
  255. package/dist/agent/usage-gate.d.ts.map +0 -1
  256. package/dist/agent/usage-gate.js +0 -83
  257. package/dist/agent/usage-gate.js.map +0 -1
  258. package/dist/agent/usage-report-builder.d.ts +0 -26
  259. package/dist/agent/usage-report-builder.d.ts.map +0 -1
  260. package/dist/agent/usage-report-builder.js +0 -80
  261. package/dist/agent/usage-report-builder.js.map +0 -1
  262. package/dist/agent/usage-report-queue.d.ts +0 -26
  263. package/dist/agent/usage-report-queue.d.ts.map +0 -1
  264. package/dist/agent/usage-report-queue.js +0 -199
  265. package/dist/agent/usage-report-queue.js.map +0 -1
  266. package/dist/agent/usage-report-types.d.ts +0 -41
  267. package/dist/agent/usage-report-types.d.ts.map +0 -1
  268. package/dist/agent/usage-report-types.js +0 -2
  269. package/dist/agent/usage-report-types.js.map +0 -1
  270. package/dist/agent/usage-reporter.d.ts +0 -31
  271. package/dist/agent/usage-reporter.d.ts.map +0 -1
  272. package/dist/agent/usage-reporter.js +0 -102
  273. package/dist/agent/usage-reporter.js.map +0 -1
  274. package/dist/agent/wake-cycle-tool-tracker.d.ts +0 -39
  275. package/dist/agent/wake-cycle-tool-tracker.d.ts.map +0 -1
  276. package/dist/agent/wake-cycle-tool-tracker.js +0 -72
  277. package/dist/agent/wake-cycle-tool-tracker.js.map +0 -1
  278. package/dist/billing/payg-handler.d.ts +0 -29
  279. package/dist/billing/payg-handler.d.ts.map +0 -1
  280. package/dist/billing/payg-handler.js +0 -92
  281. package/dist/billing/payg-handler.js.map +0 -1
  282. package/dist/billing/payment-handler.d.ts +0 -24
  283. package/dist/billing/payment-handler.d.ts.map +0 -1
  284. package/dist/billing/payment-handler.js +0 -101
  285. package/dist/billing/payment-handler.js.map +0 -1
  286. package/dist/builtin-skills/catalog/phone-adb-automation/SKILL.md +0 -412
  287. package/dist/builtin-skills/catalog/phone-adb-automation/phone_input.sh +0 -132
  288. package/dist/builtin-skills/catalog/phone-adb-automation/phone_launch.sh +0 -166
  289. package/dist/builtin-skills/catalog/phone-adb-automation/phone_screenshot.sh +0 -87
  290. package/dist/builtin-skills/catalog/phone-adb-automation/phone_security_kbd.py +0 -174
  291. package/dist/builtin-skills/catalog/phone-adb-automation/phone_setup.sh +0 -274
  292. package/dist/builtin-skills/catalog/phone-adb-automation/phone_swipe.sh +0 -111
  293. package/dist/builtin-skills/catalog/phone-adb-automation/phone_tap.sh +0 -87
  294. package/dist/builtin-skills/catalog/phone-adb-automation/phone_ui_parse.py +0 -176
  295. package/dist/builtin-skills/catalog/phone-adb-automation/phone_wake_unlock.sh +0 -67
  296. package/dist/builtin-skills/transcribe-audio/SKILL.md +0 -122
  297. package/dist/data-processing/convert-demo-cli.d.ts +0 -7
  298. package/dist/data-processing/convert-demo-cli.d.ts.map +0 -1
  299. package/dist/data-processing/convert-demo-cli.js +0 -30
  300. package/dist/data-processing/convert-demo-cli.js.map +0 -1
  301. package/dist/data-processing/convert-demo.d.ts +0 -26
  302. package/dist/data-processing/convert-demo.d.ts.map +0 -1
  303. package/dist/data-processing/convert-demo.js +0 -233
  304. package/dist/data-processing/convert-demo.js.map +0 -1
  305. package/dist/obs/rdp/icons/icons/app_windows.svg +0 -4
  306. package/dist/obs/rdp/icons/icons/clip_get.svg +0 -4
  307. package/dist/obs/rdp/icons/icons/clip_send.svg +0 -4
  308. package/dist/obs/rdp/icons/icons/clip_shared.svg +0 -4
  309. package/dist/obs/rdp/icons/icons/clipboard.svg +0 -4
  310. package/dist/obs/rdp/icons/icons/clipboard_shared.svg +0 -4
  311. package/dist/obs/rdp/icons/icons/control.svg +0 -4
  312. package/dist/obs/rdp/icons/icons/desktop.svg +0 -4
  313. package/dist/obs/rdp/icons/icons/display.svg +0 -4
  314. package/dist/obs/rdp/icons/icons/launchpad.svg +0 -4
  315. package/dist/obs/rdp/icons/icons/mission_control.svg +0 -4
  316. package/dist/obs/rdp/icons/icons/screenshot.svg +0 -4
  317. package/dist/obs/rdp/icons/icons/zoom_actual.svg +0 -4
  318. package/dist/obs/rdp/icons/icons/zoom_fit.svg +0 -4
  319. package/dist/obs/rdp/icons/icons/zoom_in.svg +0 -4
  320. package/dist/obs/rdp/icons/icons/zoom_out.svg +0 -4
  321. package/dist/obs/tunnel-telemetry.d.ts +0 -46
  322. package/dist/obs/tunnel-telemetry.d.ts.map +0 -1
  323. package/dist/obs/tunnel-telemetry.js +0 -70
  324. package/dist/obs/tunnel-telemetry.js.map +0 -1
  325. package/dist/onboarding/cloudflared-cert.d.ts +0 -15
  326. package/dist/onboarding/cloudflared-cert.d.ts.map +0 -1
  327. package/dist/onboarding/cloudflared-cert.js +0 -57
  328. package/dist/onboarding/cloudflared-cert.js.map +0 -1
  329. package/dist/onboarding/playwriter-extension.d.ts +0 -19
  330. package/dist/onboarding/playwriter-extension.d.ts.map +0 -1
  331. package/dist/onboarding/playwriter-extension.js +0 -246
  332. package/dist/onboarding/playwriter-extension.js.map +0 -1
  333. package/dist/service/gbox-tun.d.ts +0 -14
  334. package/dist/service/gbox-tun.d.ts.map +0 -1
  335. package/dist/service/gbox-tun.js +0 -315
  336. package/dist/service/gbox-tun.js.map +0 -1
  337. package/dist/skills/installed.d.ts +0 -11
  338. package/dist/skills/installed.d.ts.map +0 -1
  339. package/dist/skills/installed.js +0 -35
  340. package/dist/skills/installed.js.map +0 -1
  341. package/dist/tools/coordinate-resolver.d.ts +0 -30
  342. package/dist/tools/coordinate-resolver.d.ts.map +0 -1
  343. package/dist/tools/coordinate-resolver.js +0 -104
  344. package/dist/tools/coordinate-resolver.js.map +0 -1
  345. package/dist/utils/playwriter-relay.d.ts +0 -9
  346. package/dist/utils/playwriter-relay.d.ts.map +0 -1
  347. package/dist/utils/playwriter-relay.js +0 -77
  348. package/dist/utils/playwriter-relay.js.map +0 -1
  349. package/dist/utils/wechat-monitor.d.ts +0 -21
  350. package/dist/utils/wechat-monitor.d.ts.map +0 -1
  351. package/dist/utils/wechat-monitor.js +0 -88
  352. package/dist/utils/wechat-monitor.js.map +0 -1
@@ -1,274 +0,0 @@
1
- #!/usr/bin/env bash
2
- # phone_setup.sh - One-time setup for ADB phone automation
3
- #
4
- # What it does:
5
- # 1. Checks ADB connectivity
6
- # 2. Downloads & installs ADBKeyboard APK (for Chinese text input)
7
- # 3. Enables ADBKeyboard as the active input method
8
- # 4. Verifies everything works
9
- #
10
- # Usage:
11
- # bash phone_setup.sh [options]
12
- #
13
- # Options:
14
- # -d DEVICE_ID Target specific device
15
- # -q Quiet mode
16
- # --skip-kbd Skip ADBKeyboard installation
17
- # --uninstall Remove ADBKeyboard and restore default IME
18
- # --status Just check current setup status
19
- #
20
- # Examples:
21
- # bash phone_setup.sh # Full setup
22
- # bash phone_setup.sh -d DEVICE_ID # Setup specific device
23
- # bash phone_setup.sh --status # Check status only
24
- # bash phone_setup.sh --uninstall # Remove ADBKeyboard
25
-
26
- set -euo pipefail
27
-
28
- DEVICE=""
29
- QUIET=false
30
- SKIP_KBD=false
31
- UNINSTALL=false
32
- STATUS_ONLY=false
33
-
34
- ADBKBD_PKG="com.android.adbkeyboard"
35
- ADBKBD_IME="$ADBKBD_PKG/.AdbIME"
36
- ADBKBD_APK_URL="https://github.com/senzhk/ADBKeyBoard/releases/download/v2.4-dev/keyboardservice-debug.apk"
37
- ADBKBD_APK="/tmp/ADBKeyboard.apk"
38
-
39
- # Parse args
40
- ARGV=("$@")
41
- i=0
42
- while [ $i -lt ${#ARGV[@]} ]; do
43
- case "${ARGV[$i]}" in
44
- -d) DEVICE="${ARGV[$((i+1))]}"; i=$((i+2)) ;;
45
- -q) QUIET=true; i=$((i+1)) ;;
46
- --skip-kbd) SKIP_KBD=true; i=$((i+1)) ;;
47
- --uninstall) UNINSTALL=true; i=$((i+1)) ;;
48
- --status) STATUS_ONLY=true; i=$((i+1)) ;;
49
- -h|--help) head -25 "$0" | tail -20; exit 0 ;;
50
- *) echo "Unknown option: ${ARGV[$i]}" >&2; exit 1 ;;
51
- esac
52
- done
53
-
54
- ADB_CMD="adb"
55
- if [ -n "$DEVICE" ]; then
56
- ADB_CMD="adb -s $DEVICE"
57
- fi
58
-
59
- info() { $QUIET || echo "✅ $*"; }
60
- warn() { echo "⚠️ $*" >&2; }
61
- error() { echo "❌ $*" >&2; }
62
- step() { $QUIET || echo ""; $QUIET || echo "▶ $*"; }
63
-
64
- # ─── Check ADB connectivity ─────────────────────────────────────────
65
-
66
- check_device() {
67
- step "Checking ADB device connection..."
68
- if ! command -v adb &>/dev/null; then
69
- error "adb not found. Install Android SDK platform-tools."
70
- echo " brew install android-platform-tools" >&2
71
- exit 1
72
- fi
73
-
74
- local devices
75
- devices=$($ADB_CMD devices 2>/dev/null | grep -v "^List" | grep -v "^$" | wc -l | tr -d ' ')
76
- if [ "$devices" -eq 0 ]; then
77
- error "No devices connected. Connect via USB or WiFi:"
78
- echo " USB: adb devices" >&2
79
- echo " WiFi: adb connect <IP>:5555" >&2
80
- exit 1
81
- fi
82
-
83
- local device_model
84
- device_model=$($ADB_CMD shell getprop ro.product.model 2>/dev/null | tr -d '\r')
85
- local android_ver
86
- android_ver=$($ADB_CMD shell getprop ro.build.version.release 2>/dev/null | tr -d '\r')
87
- local resolution
88
- resolution=$($ADB_CMD shell wm size 2>/dev/null | grep "Physical" | awk '{print $3}' | tr -d '\r')
89
-
90
- info "Device: $device_model (Android $android_ver, $resolution)"
91
- }
92
-
93
- # ─── Check ADBKeyboard status ───────────────────────────────────────
94
-
95
- check_adbkbd_status() {
96
- local installed=false
97
- local enabled=false
98
- local active=false
99
-
100
- # Check if installed
101
- if $ADB_CMD shell pm list packages 2>/dev/null | grep -q "$ADBKBD_PKG"; then
102
- installed=true
103
- fi
104
-
105
- # Check if enabled as IME
106
- if $ADB_CMD shell ime list -s 2>/dev/null | grep -q "adbkeyboard"; then
107
- enabled=true
108
- fi
109
-
110
- # Check if currently active
111
- local current_ime
112
- current_ime=$($ADB_CMD shell settings get secure default_input_method 2>/dev/null | tr -d '\r')
113
- if echo "$current_ime" | grep -q "adbkeyboard"; then
114
- active=true
115
- fi
116
-
117
- if $STATUS_ONLY; then
118
- echo ""
119
- echo "=== ADB Phone Automation Status ==="
120
- echo "ADBKeyboard installed: $installed"
121
- echo "ADBKeyboard enabled: $enabled"
122
- echo "ADBKeyboard active: $active"
123
- echo "Current IME: $current_ime"
124
- echo ""
125
- # Test input if active
126
- if $active; then
127
- echo "Testing ADBKeyboard broadcast..."
128
- $ADB_CMD shell am broadcast -a ADB_INPUT_TEXT --es msg "test" 2>/dev/null | grep -q "result=0" && \
129
- echo "✅ ADBKeyboard working!" || echo "⚠️ ADBKeyboard broadcast failed"
130
- fi
131
- return
132
- fi
133
-
134
- echo "installed:$installed enabled:$enabled active:$active current:$current_ime"
135
- }
136
-
137
- # ─── Install ADBKeyboard ────────────────────────────────────────────
138
-
139
- install_adbkbd() {
140
- step "Installing ADBKeyboard for Chinese text input support..."
141
-
142
- # Check if already installed
143
- if $ADB_CMD shell pm list packages 2>/dev/null | grep -q "$ADBKBD_PKG"; then
144
- info "ADBKeyboard already installed"
145
- else
146
- # Download APK
147
- info "Downloading ADBKeyboard APK..."
148
- if ! curl -sL -o "$ADBKBD_APK" "$ADBKBD_APK_URL"; then
149
- error "Failed to download ADBKeyboard APK from GitHub"
150
- warn "You can manually download from: $ADBKBD_APK_URL"
151
- return 1
152
- fi
153
-
154
- # Verify download is a valid APK (zip archive), not an error page
155
- if [ ! -s "$ADBKBD_APK" ]; then
156
- error "Downloaded APK is empty"
157
- return 1
158
- fi
159
- if ! file "$ADBKBD_APK" | grep -qi "zip"; then
160
- error "Downloaded file is not a valid APK (got: $(file -b "$ADBKBD_APK"))"
161
- rm -f "$ADBKBD_APK"
162
- return 1
163
- fi
164
-
165
- # Install
166
- info "Installing APK on device..."
167
- if ! $ADB_CMD install "$ADBKBD_APK" 2>/dev/null; then
168
- error "Failed to install ADBKeyboard"
169
- warn "Try: adb install $ADBKBD_APK"
170
- return 1
171
- fi
172
- info "ADBKeyboard installed successfully"
173
-
174
- # Clean up
175
- rm -f "$ADBKBD_APK"
176
- fi
177
-
178
- # Enable ADBKeyboard as an input method
179
- step "Enabling ADBKeyboard as input method..."
180
- $ADB_CMD shell ime enable "$ADBKBD_IME" 2>/dev/null || true
181
- # Some devices (e.g. Xiaomi/MIUI) don't add to enabled list via 'ime enable'
182
- # Manually append to enabled_input_methods if needed
183
- local enabled_imes
184
- enabled_imes=$($ADB_CMD shell settings get secure enabled_input_methods 2>/dev/null | tr -d '\r')
185
- if ! echo "$enabled_imes" | grep -q "adbkeyboard"; then
186
- $ADB_CMD shell settings put secure enabled_input_methods "$enabled_imes:$ADBKBD_IME" 2>/dev/null || true
187
- fi
188
- info "ADBKeyboard enabled"
189
-
190
- # Set as active input method
191
- $ADB_CMD shell ime set "$ADBKBD_IME" 2>/dev/null || true
192
- info "ADBKeyboard set as active IME"
193
-
194
- # Verify
195
- step "Verifying ADBKeyboard..."
196
- local current_ime
197
- current_ime=$($ADB_CMD shell settings get secure default_input_method 2>/dev/null | tr -d '\r')
198
- if echo "$current_ime" | grep -q "adbkeyboard"; then
199
- info "ADBKeyboard is ready!"
200
- # Quick test
201
- $ADB_CMD shell am broadcast -a ADB_INPUT_TEXT --es msg "setup_ok" 2>/dev/null | grep -q "result=0" && \
202
- info "Broadcast test passed" || warn "Broadcast test inconclusive (may still work)"
203
- else
204
- warn "ADBKeyboard might need manual enabling in Settings > Language & Input"
205
- fi
206
- }
207
-
208
- # ─── Uninstall ADBKeyboard ──────────────────────────────────────────
209
-
210
- uninstall_adbkbd() {
211
- step "Uninstalling ADBKeyboard..."
212
-
213
- # Restore default IME first
214
- local default_ime
215
- default_ime=$($ADB_CMD shell settings get secure default_input_method 2>/dev/null | tr -d '\r')
216
- if echo "$default_ime" | grep -q "adbkeyboard"; then
217
- # Try to switch to a standard IME
218
- local other_ime
219
- other_ime=$($ADB_CMD shell ime list -s 2>/dev/null | grep -v "adbkeyboard" | head -1 | tr -d '\r')
220
- if [ -n "$other_ime" ]; then
221
- $ADB_CMD shell ime set "$other_ime" 2>/dev/null
222
- info "Switched IME to: $other_ime"
223
- fi
224
- fi
225
-
226
- # Uninstall
227
- if $ADB_CMD shell pm list packages 2>/dev/null | grep -q "$ADBKBD_PKG"; then
228
- $ADB_CMD uninstall "$ADBKBD_PKG" 2>/dev/null && \
229
- info "ADBKeyboard uninstalled" || error "Failed to uninstall"
230
- else
231
- info "ADBKeyboard was not installed"
232
- fi
233
- }
234
-
235
- # ─── Main ────────────────────────────────────────────────────────────
236
-
237
- check_device
238
-
239
- if $STATUS_ONLY; then
240
- check_adbkbd_status
241
- exit 0
242
- fi
243
-
244
- if $UNINSTALL; then
245
- uninstall_adbkbd
246
- exit 0
247
- fi
248
-
249
- if ! $SKIP_KBD; then
250
- install_adbkbd
251
- fi
252
-
253
- if ! $QUIET; then
254
- echo ""
255
- echo "══════════════════════════════════════════"
256
- echo " Setup complete! Quick reference:"
257
- echo "══════════════════════════════════════════"
258
- echo ""
259
- echo " # Take screenshot"
260
- echo " bash phone_screenshot.sh"
261
- echo ""
262
- echo " # Tap at coordinates"
263
- echo " bash phone_tap.sh 500 800"
264
- echo ""
265
- echo " # Type Chinese text"
266
- echo " bash phone_input.sh \"你好世界\" -m adbkbd"
267
- echo ""
268
- echo " # Type English + press Enter"
269
- echo " bash phone_input.sh \"hello\" -e"
270
- echo ""
271
- echo " # Check status anytime"
272
- echo " bash phone_setup.sh --status"
273
- echo ""
274
- fi
@@ -1,111 +0,0 @@
1
- #!/usr/bin/env bash
2
- # phone_swipe.sh - Swipe on Android phone with presets and coordinate scaling
3
- #
4
- # Usage:
5
- # bash phone_swipe.sh <preset|x1 y1 x2 y2> [options]
6
- #
7
- # Presets (auto-calculated from device resolution):
8
- # up - Scroll up (swipe from bottom to top, reveals content below)
9
- # down - Scroll down (swipe from top to bottom, reveals content above)
10
- # left - Swipe left (next page)
11
- # right - Swipe right (previous page)
12
- #
13
- # Options:
14
- # -d DEVICE_ID Target specific device
15
- # -S SCALE Input coords from scaled screenshot (for custom x1 y1 x2 y2)
16
- # -t DURATION Swipe duration in ms (default: 300)
17
- # -q Quiet mode
18
- #
19
- # Examples:
20
- # bash phone_swipe.sh up # Scroll up
21
- # bash phone_swipe.sh down # Scroll down
22
- # bash phone_swipe.sh left # Swipe left
23
- # bash phone_swipe.sh 100 2000 100 800 # Custom swipe (native coords)
24
- # bash phone_swipe.sh 50 1000 50 400 -S 50 # Custom swipe (scaled coords)
25
- # bash phone_swipe.sh up -t 500 # Slow scroll up
26
-
27
- set -euo pipefail
28
-
29
- DEVICE=""
30
- SCALE=""
31
- DURATION=300
32
- QUIET=false
33
-
34
- # Collect all args, separate flags from positional
35
- POSITIONAL=()
36
- ARGV=("$@")
37
- i=0
38
- while [ $i -lt ${#ARGV[@]} ]; do
39
- case "${ARGV[$i]}" in
40
- -d) DEVICE="${ARGV[$((i+1))]}"; i=$((i+2)) ;;
41
- -S) SCALE="${ARGV[$((i+1))]}"; i=$((i+2)) ;;
42
- -t) DURATION="${ARGV[$((i+1))]}"; i=$((i+2)) ;;
43
- -q) QUIET=true; i=$((i+1)) ;;
44
- -*) echo "Unknown option: ${ARGV[$i]}" >&2; exit 1 ;;
45
- *) POSITIONAL+=("${ARGV[$i]}"); i=$((i+1)) ;;
46
- esac
47
- done
48
-
49
- ADB_CMD="adb"
50
- if [ -n "$DEVICE" ]; then
51
- ADB_CMD="adb -s $DEVICE"
52
- fi
53
-
54
- info() { $QUIET || echo "[phone_swipe] $*" >&2; }
55
-
56
- if [ ${#POSITIONAL[@]} -eq 0 ]; then
57
- echo "Usage: $0 <up|down|left|right|x1 y1 x2 y2> [-d device] [-S scale%] [-t ms] [-q]" >&2
58
- exit 1
59
- fi
60
-
61
- # Get device resolution for presets
62
- get_resolution() {
63
- local size
64
- size=$($ADB_CMD shell wm size | grep "Physical" | awk '{print $3}')
65
- echo "$size"
66
- }
67
-
68
- PRESET="${POSITIONAL[0]}"
69
-
70
- case "$PRESET" in
71
- up|down|left|right)
72
- SIZE=$(get_resolution)
73
- W=$(echo "$SIZE" | cut -d'x' -f1)
74
- H=$(echo "$SIZE" | cut -d'x' -f2)
75
- CX=$((W / 2))
76
- CY=$((H / 2))
77
-
78
- case "$PRESET" in
79
- up) X1=$CX; Y1=$((H * 3 / 4)); X2=$CX; Y2=$((H / 4)) ;;
80
- down) X1=$CX; Y1=$((H / 4)); X2=$CX; Y2=$((H * 3 / 4)) ;;
81
- left) X1=$((W * 4 / 5)); Y1=$CY; X2=$((W / 5)); Y2=$CY ;;
82
- right) X1=$((W / 5)); Y1=$CY; X2=$((W * 4 / 5)); Y2=$CY ;;
83
- esac
84
-
85
- info "Preset '$PRESET' on ${W}x${H}: ($X1,$Y1) -> ($X2,$Y2)"
86
- ;;
87
- *)
88
- if [ ${#POSITIONAL[@]} -lt 4 ]; then
89
- echo "ERROR: Custom swipe needs 4 coordinates: x1 y1 x2 y2" >&2
90
- exit 1
91
- fi
92
- X1="${POSITIONAL[0]}"
93
- Y1="${POSITIONAL[1]}"
94
- X2="${POSITIONAL[2]}"
95
- Y2="${POSITIONAL[3]}"
96
-
97
- if [ -n "$SCALE" ] && [ "$SCALE" -gt 0 ]; then
98
- X1=$((X1 * 100 / SCALE))
99
- Y1=$((Y1 * 100 / SCALE))
100
- X2=$((X2 * 100 / SCALE))
101
- Y2=$((Y2 * 100 / SCALE))
102
- info "Scaled coords at ${SCALE}% -> Native: ($X1,$Y1) -> ($X2,$Y2)"
103
- else
104
- info "Swipe: ($X1,$Y1) -> ($X2,$Y2)"
105
- fi
106
- ;;
107
- esac
108
-
109
- $ADB_CMD shell input swipe "$X1" "$Y1" "$X2" "$Y2" "$DURATION"
110
- info "Done."
111
- echo "swiped $X1 $Y1 $X2 $Y2"
@@ -1,87 +0,0 @@
1
- #!/usr/bin/env bash
2
- # phone_tap.sh - Tap on Android phone with optional coordinate scaling
3
- #
4
- # Usage:
5
- # bash phone_tap.sh <x> <y> [options]
6
- #
7
- # The x,y coordinates are in the coordinate space you specify:
8
- # - By default, treated as native device coordinates (no scaling)
9
- # - With -S, treated as scaled coordinates and auto-converted to native
10
- #
11
- # Options:
12
- # -d DEVICE_ID Target specific device
13
- # -S SCALE Input coords are from a screenshot scaled to this % (e.g. 50)
14
- # Will multiply by 100/SCALE to get native coords
15
- # -l Long press (500ms hold)
16
- # -t DURATION Hold duration in ms (default: tap=50, long=500)
17
- # -q Quiet mode
18
- #
19
- # Examples:
20
- # bash phone_tap.sh 610 1328 # Tap at native coords
21
- # bash phone_tap.sh 305 664 -S 50 # Tap at 50%-scaled coords -> auto-converts to 610,1328
22
- # bash phone_tap.sh 305 664 -S 50 -l # Long press at scaled coords
23
-
24
- set -euo pipefail
25
-
26
- DEVICE=""
27
- SCALE=""
28
- LONG=false
29
- DURATION=""
30
- QUIET=false
31
-
32
- # Parse options after positional args
33
- ARGS=()
34
- while [ $# -gt 0 ]; do
35
- case "$1" in
36
- -d) DEVICE="$2"; shift 2 ;;
37
- -S) SCALE="$2"; shift 2 ;;
38
- -l) LONG=true; shift ;;
39
- -t) DURATION="$2"; shift 2 ;;
40
- -q) QUIET=true; shift ;;
41
- -*) echo "Unknown option: $1" >&2; exit 1 ;;
42
- *) ARGS+=("$1"); shift ;;
43
- esac
44
- done
45
-
46
- if [ ${#ARGS[@]} -lt 2 ]; then
47
- echo "Usage: $0 <x> <y> [-d device] [-S scale%] [-l] [-t duration_ms] [-q]" >&2
48
- exit 1
49
- fi
50
-
51
- X="${ARGS[0]}"
52
- Y="${ARGS[1]}"
53
-
54
- ADB_CMD="adb"
55
- if [ -n "$DEVICE" ]; then
56
- ADB_CMD="adb -s $DEVICE"
57
- fi
58
-
59
- info() { $QUIET || echo "[phone_tap] $*" >&2; }
60
-
61
- # Scale coordinates if needed
62
- if [ -n "$SCALE" ] && [ "$SCALE" -gt 0 ]; then
63
- NATIVE_X=$((X * 100 / SCALE))
64
- NATIVE_Y=$((Y * 100 / SCALE))
65
- info "Scaled ($X, $Y) at ${SCALE}% -> Native ($NATIVE_X, $NATIVE_Y)"
66
- X=$NATIVE_X
67
- Y=$NATIVE_Y
68
- fi
69
-
70
- # Determine duration
71
- if [ -n "$DURATION" ]; then
72
- DUR=$DURATION
73
- elif $LONG; then
74
- DUR=500
75
- else
76
- DUR=50
77
- fi
78
-
79
- if $LONG || [ "$DUR" -gt 100 ]; then
80
- info "Long press at ($X, $Y) for ${DUR}ms"
81
- $ADB_CMD shell input swipe "$X" "$Y" "$X" "$Y" "$DUR"
82
- else
83
- info "Tap at ($X, $Y)"
84
- $ADB_CMD shell input tap "$X" "$Y"
85
- fi
86
-
87
- echo "tapped $X $Y"
@@ -1,176 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- phone_ui_parse.py - Dump and parse Android UI hierarchy via ADB uiautomator.
4
-
5
- Usage:
6
- python3 phone_ui_parse.py [options]
7
-
8
- Options:
9
- -d DEVICE_ID Target specific device
10
- -f XML_FILE Parse existing XML file instead of dumping from device
11
- -c Show only clickable elements
12
- -s SEARCH Filter by text/description containing SEARCH (case-insensitive)
13
- -j Output as JSON
14
- --bounds-only Show only elements with bounds
15
- -q Quiet (no info messages)
16
-
17
- Output:
18
- Each line: "text" desc="description" center=(x,y) bounds=[x1,y1,x2,y2] clickable=true/false class=ClassName
19
-
20
- Examples:
21
- python3 phone_ui_parse.py # Dump & parse all elements
22
- python3 phone_ui_parse.py -c # Only clickable elements
23
- python3 phone_ui_parse.py -s "send" # Elements matching "send"
24
- python3 phone_ui_parse.py -c -s "confirm" -j # Clickable "confirm" as JSON
25
- python3 phone_ui_parse.py -f /tmp/ui.xml # Parse local XML file
26
- """
27
-
28
- import argparse
29
- import json
30
- import os
31
- import re
32
- import subprocess
33
- import sys
34
- import tempfile
35
- import xml.etree.ElementTree as ET
36
-
37
-
38
- def run_adb(device, *args):
39
- cmd = ["adb"]
40
- if device:
41
- cmd += ["-s", device]
42
- cmd += list(args)
43
- result = subprocess.run(cmd, capture_output=True, text=True)
44
- return result.stdout, result.stderr, result.returncode
45
-
46
-
47
- def dump_ui(device=None):
48
- """Dump UI hierarchy from device and return local XML path."""
49
- remote_path = "/sdcard/ui_dump.xml"
50
- local_path = os.path.join(tempfile.gettempdir(), f"phone_ui_{os.getpid()}.xml")
51
-
52
- _, stderr, rc = run_adb(device, "shell", "uiautomator", "dump", remote_path)
53
- if rc != 0:
54
- print(f"ERROR: uiautomator dump failed: {stderr}", file=sys.stderr)
55
- sys.exit(1)
56
-
57
- _, stderr, rc = run_adb(device, "pull", remote_path, local_path)
58
- if rc != 0:
59
- print(f"ERROR: Failed to pull UI dump: {stderr}", file=sys.stderr)
60
- sys.exit(1)
61
-
62
- run_adb(device, "shell", "rm", "-f", remote_path)
63
- return local_path
64
-
65
-
66
- def parse_ui_xml(xml_path, clickable_only=False, search=None):
67
- """Parse UI XML and return list of element dicts."""
68
- tree = ET.parse(xml_path)
69
- root = tree.getroot()
70
- elements = []
71
-
72
- for node in root.iter():
73
- text = node.get("text", "")
74
- desc = node.get("content-desc", "")
75
- bounds = node.get("bounds", "")
76
- clickable = node.get("clickable", "false")
77
- class_name = node.get("class", "")
78
- resource_id = node.get("resource-id", "")
79
- enabled = node.get("enabled", "true")
80
- focused = node.get("focused", "false")
81
- selected = node.get("selected", "false")
82
- checked = node.get("checked", "false")
83
-
84
- if not bounds:
85
- continue
86
-
87
- if clickable_only and clickable != "true":
88
- continue
89
-
90
- if search:
91
- combined = f"{text} {desc} {resource_id}".lower()
92
- if search.lower() not in combined:
93
- continue
94
-
95
- # Parse bounds: [x1,y1][x2,y2]
96
- m = re.findall(r"\d+", bounds)
97
- if len(m) != 4:
98
- continue
99
-
100
- x1, y1, x2, y2 = int(m[0]), int(m[1]), int(m[2]), int(m[3])
101
- cx = (x1 + x2) // 2
102
- cy = (y1 + y2) // 2
103
-
104
- elements.append({
105
- "text": text,
106
- "content_desc": desc,
107
- "resource_id": resource_id,
108
- "class": class_name,
109
- "bounds": [x1, y1, x2, y2],
110
- "center": [cx, cy],
111
- "clickable": clickable == "true",
112
- "enabled": enabled == "true",
113
- "focused": focused == "true",
114
- "selected": selected == "true",
115
- "checked": checked == "true",
116
- })
117
-
118
- return elements
119
-
120
-
121
- def main():
122
- parser = argparse.ArgumentParser(description="Parse Android UI hierarchy")
123
- parser.add_argument("-d", "--device", help="Target device ID")
124
- parser.add_argument("-f", "--file", help="Parse existing XML file")
125
- parser.add_argument("-c", "--clickable", action="store_true", help="Clickable only")
126
- parser.add_argument("-s", "--search", help="Filter by text/desc")
127
- parser.add_argument("-j", "--json", action="store_true", help="JSON output")
128
- parser.add_argument("--bounds-only", action="store_true", help="Elements with bounds only")
129
- parser.add_argument("-q", "--quiet", action="store_true", help="Quiet mode")
130
- args = parser.parse_args()
131
-
132
- if args.file:
133
- xml_path = args.file
134
- cleanup = False
135
- else:
136
- if not args.quiet:
137
- print("[phone_ui_parse] Dumping UI hierarchy...", file=sys.stderr)
138
- xml_path = dump_ui(args.device)
139
- cleanup = True
140
-
141
- elements = parse_ui_xml(xml_path, args.clickable, args.search)
142
-
143
- if cleanup:
144
- os.unlink(xml_path)
145
-
146
- if not args.quiet:
147
- print(f"[phone_ui_parse] Found {len(elements)} elements", file=sys.stderr)
148
-
149
- if args.json:
150
- print(json.dumps(elements, ensure_ascii=False, indent=2))
151
- else:
152
- for el in elements:
153
- text = el["text"]
154
- desc = el["content_desc"]
155
- cx, cy = el["center"]
156
- click = el["clickable"]
157
- cls = el["class"].split(".")[-1] if el["class"] else ""
158
- rid = el["resource_id"].split("/")[-1] if el["resource_id"] else ""
159
-
160
- parts = []
161
- if text:
162
- parts.append(f'"{text}"')
163
- if desc:
164
- parts.append(f'desc="{desc}"')
165
- if rid:
166
- parts.append(f"id={rid}")
167
- parts.append(f"center=({cx},{cy})")
168
- parts.append(f"clickable={click}")
169
- if cls:
170
- parts.append(f"class={cls}")
171
-
172
- print(" ".join(parts))
173
-
174
-
175
- if __name__ == "__main__":
176
- main()