@buaa_smat/hometrans 26.0.3 → 26.0.4

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 (750) hide show
  1. package/README.md +1 -1
  2. package/agents/code-reviewer.md +91 -21
  3. package/env-requirements.json +1 -1
  4. package/i18n/agents/code-reviewer.md +93 -21
  5. package/i18n/skills/a2h-app-migrate/SKILL.md +19 -11
  6. package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -0
  7. package/i18n/skills/a2h-app-migrate/references/stage-map.md +2 -2
  8. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +320 -73
  9. package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
  10. package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
  11. package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
  12. package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
  13. package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
  14. package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
  15. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
  16. package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
  17. package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
  18. package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
  19. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
  20. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
  21. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
  22. package/i18n/skills/a2h-arch-generate/SKILL.md +20 -17
  23. package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
  24. package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
  25. package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +25 -14
  26. package/i18n/skills/a2h-arch-generate/references/source-baseline.md +4 -4
  27. package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
  28. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +304 -0
  29. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
  30. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
  31. package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +52 -11
  32. package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
  33. package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +245 -0
  34. package/i18n/skills/a2h-batch-ui-align/SKILL.md +70 -21
  35. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
  36. package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
  37. package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
  38. package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
  39. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
  40. package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
  41. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
  42. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
  43. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
  44. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
  45. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
  46. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +31 -0
  47. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +22 -6
  48. package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
  49. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
  50. package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
  51. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +386 -16
  52. package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
  53. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
  54. package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
  55. package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
  56. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
  57. package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
  58. package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
  59. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
  60. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
  61. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
  62. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
  63. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
  64. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
  65. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
  66. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
  67. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
  68. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
  69. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
  70. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
  71. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
  72. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
  73. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
  74. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
  75. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
  76. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
  77. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
  78. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
  79. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
  80. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
  81. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
  82. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
  83. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
  84. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
  85. package/i18n/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
  86. package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +133 -0
  87. package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
  88. package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
  89. package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
  90. package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
  91. package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
  92. package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +11 -9
  93. package/i18n/skills/a2h-module-semantic-docs/SKILL.md +51 -13
  94. package/i18n/skills/a2h-page-specgen/SKILL.md +123 -20
  95. package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
  96. package/i18n/skills/a2h-page-specgen/references/body-language.md +11 -9
  97. package/i18n/skills/a2h-page-specgen/references/gates.md +119 -52
  98. package/i18n/skills/a2h-page-specgen/references/page-inventory.md +69 -22
  99. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
  100. package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
  101. package/i18n/skills/a2h-page-specgen/references/spec-template.md +113 -110
  102. package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
  103. package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
  104. package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
  105. package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
  106. package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
  107. package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +171 -62
  108. package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +314 -192
  109. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +364 -76
  110. package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +216 -8
  111. package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
  112. package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -223
  113. package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
  114. package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +521 -13
  115. package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
  116. package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
  117. package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
  118. package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
  119. package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
  120. package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
  121. package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
  122. package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +483 -125
  123. package/i18n/skills/a2h-page-specgen/scripts/render.mjs +10 -33
  124. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
  125. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
  126. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
  127. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
  128. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
  129. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
  130. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
  131. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
  132. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
  133. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
  134. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
  135. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
  136. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
  137. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
  138. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
  139. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
  140. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
  141. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
  142. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
  143. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
  144. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
  145. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
  146. package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
  147. package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
  148. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
  149. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
  150. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
  151. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
  152. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
  153. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
  154. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
  155. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
  156. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
  157. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
  158. package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +134 -163
  159. package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
  160. package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
  161. package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +206 -9
  162. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
  163. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
  164. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
  165. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
  166. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
  167. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
  168. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
  169. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
  170. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
  171. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
  172. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
  173. package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
  174. package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
  175. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +862 -12
  176. package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
  177. package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
  178. package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
  179. package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
  180. package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
  181. package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
  182. package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
  183. package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
  184. package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
  185. package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
  186. package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
  187. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
  188. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
  189. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
  190. package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +166 -3
  191. package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
  192. package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
  193. package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
  194. package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
  195. package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +69 -44
  196. package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
  197. package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
  198. package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +658 -120
  199. package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
  200. package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
  201. package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
  202. package/i18n/skills/a2h-resource-convert/SKILL.md +9 -1
  203. package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
  204. package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
  205. package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
  206. package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
  207. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
  208. package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
  209. package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
  210. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +69 -109
  211. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +135 -37
  212. package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
  213. package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
  214. package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
  215. package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
  216. package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
  217. package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +24 -13
  218. package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
  219. package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +170 -7
  220. package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
  221. package/i18n/skills/a2h-spec-generate/SKILL.md +2 -2
  222. package/i18n/skills/a2h-utg-explorer/SKILL.md +9 -3
  223. package/i18n/skills/a2h-utg-explorer/references/architecture.md +3 -0
  224. package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +74 -84
  225. package/i18n/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
  226. package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
  227. package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
  228. package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +252 -0
  229. package/i18n/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
  230. package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
  231. package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
  232. package/i18n/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
  233. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
  234. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
  235. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +211 -61
  236. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
  237. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +724 -47
  238. package/i18n/skills/a2h-utg-static/SKILL.md +6 -2
  239. package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +82 -12
  240. package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
  241. package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
  242. package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
  243. package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
  244. package/i18n/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
  245. package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
  246. package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +50 -5
  247. package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
  248. package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
  249. package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
  250. package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
  251. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +17 -0
  252. package/i18n/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
  253. package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -0
  254. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
  255. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +181 -17
  256. package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
  257. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
  258. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +118 -19
  259. package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
  260. package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +113 -70
  261. package/package.json +3 -6
  262. package/skills/a2h-app-migrate/SKILL.md +19 -11
  263. package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
  264. package/skills/a2h-app-migrate/references/stage-map.md +2 -2
  265. package/skills/a2h-app-migrate/references/workflow.yaml +307 -74
  266. package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
  267. package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
  268. package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
  269. package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
  270. package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
  271. package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
  272. package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
  273. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
  274. package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
  275. package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
  276. package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
  277. package/skills/a2h-app-migrate/scripts/ledger.mjs +64 -6
  278. package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
  279. package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
  280. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +33 -9
  281. package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
  282. package/skills/a2h-app-migrate/scripts/run_dir.mjs +27 -17
  283. package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
  284. package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
  285. package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
  286. package/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
  287. package/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
  288. package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
  289. package/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
  290. package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +7 -7
  291. package/skills/a2h-app-migrate/test/test_incremental_acceptance.mjs +145 -0
  292. package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
  293. package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
  294. package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
  295. package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +10 -0
  296. package/skills/a2h-app-migrate/test/test_json_io.mjs +1 -1
  297. package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +39 -0
  298. package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
  299. package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +33 -0
  300. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
  301. package/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
  302. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
  303. package/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
  304. package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -0
  305. package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +13 -5
  306. package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
  307. package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
  308. package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +170 -3
  309. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
  310. package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
  311. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +12 -0
  312. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
  313. package/skills/a2h-arch-generate/SKILL.md +20 -17
  314. package/skills/a2h-arch-generate/references/homegraph-workflow.md +10 -8
  315. package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
  316. package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
  317. package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
  318. package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
  319. package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
  320. package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +17 -0
  321. package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +26 -0
  322. package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
  323. package/skills/a2h-arkts-logic-coder/SKILL.md +146 -17
  324. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
  325. package/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
  326. package/skills/a2h-arkts-logic-coder/references/spec-design.md +42 -11
  327. package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
  328. package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +244 -0
  329. package/skills/a2h-batch-ui-align/SKILL.md +72 -22
  330. package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
  331. package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
  332. package/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
  333. package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
  334. package/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
  335. package/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
  336. package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
  337. package/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
  338. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
  339. package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
  340. package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
  341. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
  342. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
  343. package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +30 -0
  344. package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
  345. package/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
  346. package/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
  347. package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
  348. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +380 -16
  349. package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
  350. package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
  351. package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
  352. package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
  353. package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +39 -5
  354. package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
  355. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
  356. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +213 -30
  357. package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
  358. package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
  359. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
  360. package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
  361. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
  362. package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
  363. package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
  364. package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
  365. package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
  366. package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
  367. package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
  368. package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
  369. package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
  370. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
  371. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +24 -0
  372. package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
  373. package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
  374. package/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
  375. package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
  376. package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
  377. package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
  378. package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
  379. package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
  380. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
  381. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
  382. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
  383. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
  384. package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
  385. package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
  386. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
  387. package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
  388. package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
  389. package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
  390. package/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
  391. package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
  392. package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
  393. package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
  394. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +24 -2
  395. package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +14 -0
  396. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_baseline.test.mjs +129 -0
  397. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_runtime2.test.mjs +697 -0
  398. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +298 -0
  399. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
  400. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
  401. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
  402. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +41 -7
  403. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +346 -0
  404. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme_runtime.test.mjs +95 -0
  405. package/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
  406. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +126 -0
  407. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +1 -0
  408. package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
  409. package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
  410. package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
  411. package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
  412. package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +19 -0
  413. package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +15 -0
  414. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
  415. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
  416. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
  417. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -0
  418. package/skills/a2h-batch-ui-align/scripts/tests/group_pack_evidence.test.mjs +95 -0
  419. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +155 -1
  420. package/skills/a2h-batch-ui-align/scripts/tests/icon_coverage.test.mjs +314 -0
  421. package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
  422. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
  423. package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
  424. package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
  425. package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
  426. package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +5 -0
  427. package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
  428. package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
  429. package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
  430. package/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
  431. package/skills/a2h-dashboard-render/test/test_device_locale_dialogs.mjs +17 -0
  432. package/skills/a2h-module-semantic-docs/SKILL.md +51 -13
  433. package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
  434. package/skills/a2h-module-semantic-docs/test/test_incremental_fingerprint.mjs +94 -0
  435. package/skills/a2h-page-specgen/SKILL.md +124 -20
  436. package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
  437. package/skills/a2h-page-specgen/references/body-language.md +11 -9
  438. package/skills/a2h-page-specgen/references/evidence.md +35 -0
  439. package/skills/a2h-page-specgen/references/execution-model.md +135 -26
  440. package/skills/a2h-page-specgen/references/footprint-and-grouping.md +20 -15
  441. package/skills/a2h-page-specgen/references/gates.md +120 -52
  442. package/skills/a2h-page-specgen/references/page-inventory.md +69 -22
  443. package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
  444. package/skills/a2h-page-specgen/references/spec-example.md +312 -0
  445. package/skills/a2h-page-specgen/references/spec-template.md +112 -109
  446. package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
  447. package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
  448. package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
  449. package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
  450. package/skills/a2h-page-specgen/scripts/dispatch.mjs +8 -5
  451. package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
  452. package/skills/a2h-page-specgen/scripts/facts-build.mjs +170 -61
  453. package/skills/a2h-page-specgen/scripts/finalize.mjs +466 -63
  454. package/skills/a2h-page-specgen/scripts/footprint.mjs +302 -180
  455. package/skills/a2h-page-specgen/scripts/gate.mjs +372 -82
  456. package/skills/a2h-page-specgen/scripts/interactions.mjs +215 -8
  457. package/skills/a2h-page-specgen/scripts/inventory.mjs +102 -0
  458. package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -216
  459. package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +105 -13
  460. package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
  461. package/skills/a2h-page-specgen/scripts/lib/hg.mjs +520 -12
  462. package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
  463. package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
  464. package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +129 -6
  465. package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
  466. package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
  467. package/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
  468. package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
  469. package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
  470. package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
  471. package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +106 -0
  472. package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
  473. package/skills/a2h-page-specgen/scripts/prepare.mjs +470 -122
  474. package/skills/a2h-page-specgen/scripts/render.mjs +11 -34
  475. package/skills/a2h-page-specgen/scripts/report.mjs +339 -6
  476. package/skills/a2h-page-specgen/scripts/submission.mjs +253 -88
  477. package/skills/a2h-page-specgen/scripts/submit.mjs +12 -6
  478. package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
  479. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
  480. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
  481. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
  482. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
  483. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
  484. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
  485. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
  486. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
  487. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
  488. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
  489. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
  490. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
  491. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
  492. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
  493. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
  494. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
  495. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
  496. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
  497. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
  498. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
  499. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
  500. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
  501. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
  502. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
  503. package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
  504. package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
  505. package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
  506. package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
  507. package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
  508. package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
  509. package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
  510. package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
  511. package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
  512. package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
  513. package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
  514. package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
  515. package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +135 -137
  516. package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
  517. package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
  518. package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +178 -9
  519. package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +19 -1
  520. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
  521. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
  522. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
  523. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
  524. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
  525. package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
  526. package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
  527. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -0
  528. package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshOnResume.java +7 -0
  529. package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
  530. package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
  531. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
  532. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
  533. package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
  534. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
  535. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
  536. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
  537. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
  538. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
  539. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
  540. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
  541. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
  542. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
  543. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
  544. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
  545. package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
  546. package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
  547. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +869 -13
  548. package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
  549. package/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
  550. package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
  551. package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
  552. package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
  553. package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
  554. package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
  555. package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
  556. package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
  557. package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
  558. package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +1 -1
  559. package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
  560. package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
  561. package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
  562. package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
  563. package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
  564. package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +42 -2
  565. package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
  566. package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +171 -3
  567. package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
  568. package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +365 -1
  569. package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
  570. package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
  571. package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
  572. package/skills/a2h-page-specgen/scripts/test/render.test.mjs +85 -42
  573. package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
  574. package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
  575. package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
  576. package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
  577. package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +645 -115
  578. package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
  579. package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
  580. package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
  581. package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +88 -74
  582. package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +30 -1
  583. package/skills/a2h-page-specgen/scripts/waker.mjs +79 -12
  584. package/skills/a2h-page-specgen/scripts/watchdog.mjs +18 -17
  585. package/skills/a2h-resource-convert/SKILL.md +9 -1
  586. package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
  587. package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
  588. package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
  589. package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
  590. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
  591. package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
  592. package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
  593. package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
  594. package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
  595. package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
  596. package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
  597. package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
  598. package/skills/a2h-resource-convert/scripts/tests/code_vector_guard.test.mjs +75 -0
  599. package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
  600. package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
  601. package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
  602. package/skills/a2h-spec-design-pipeline/SKILL.md +48 -72
  603. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +123 -37
  604. package/skills/a2h-spec-design-pipeline/references/execution-model.md +40 -8
  605. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +5 -4
  606. package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
  607. package/skills/a2h-spec-design-pipeline/references/initialization.md +37 -5
  608. package/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
  609. package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
  610. package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
  611. package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +7 -1
  612. package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
  613. package/skills/a2h-spec-design-pipeline/references/scripts.md +38 -14
  614. package/skills/a2h-spec-design-pipeline/references/shared-layer.md +127 -4
  615. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +90 -24
  616. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +65 -34
  617. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +11 -1
  618. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +10 -2
  619. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
  620. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
  621. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
  622. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
  623. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
  624. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
  625. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
  626. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
  627. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
  628. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
  629. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
  630. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
  631. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/{HttpExtraDataEmptyStringCheck.js → platform/ExtraDataSubCheck.js} +27 -30
  632. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +4 -2
  633. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +3 -2
  634. package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
  635. package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
  636. package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
  637. package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +55 -2
  638. package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +138 -7
  639. package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +10 -13
  640. package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +21 -2
  641. package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
  642. package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +32 -2
  643. package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +109 -13
  644. package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
  645. package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
  646. package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +12 -17
  647. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +172 -7
  648. package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +36 -16
  649. package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
  650. package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
  651. package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
  652. package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
  653. package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
  654. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +27 -3
  655. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +20 -7
  656. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +143 -13
  657. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +168 -7
  658. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +139 -2
  659. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +25 -0
  660. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
  661. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +37 -0
  662. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
  663. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
  664. package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +4 -5
  665. package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
  666. package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
  667. package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
  668. package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
  669. package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +59 -8
  670. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +44 -0
  671. package/skills/a2h-spec-generate/SKILL.md +2 -2
  672. package/skills/a2h-spec-generate/references/specs.schema.json +24 -11
  673. package/skills/a2h-spec-generate/scripts/ensure-index.mjs +1 -2
  674. package/skills/a2h-spec-generate/test/ensure-index.test.mjs +1 -2
  675. package/skills/a2h-utg-explorer/SKILL.md +9 -3
  676. package/skills/a2h-utg-explorer/references/architecture.md +3 -0
  677. package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
  678. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +56 -5
  679. package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
  680. package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
  681. package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
  682. package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
  683. package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
  684. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
  685. package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
  686. package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
  687. package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -0
  688. package/skills/a2h-utg-explorer/scripts/tests/default_override.test.mjs +109 -0
  689. package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -0
  690. package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +254 -0
  691. package/skills/a2h-utg-explorer/scripts/tests/foreground_spelling.test.mjs +155 -0
  692. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +120 -0
  693. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
  694. package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
  695. package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
  696. package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +218 -0
  697. package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -0
  698. package/skills/a2h-utg-explorer/scripts/tests/recover_d_grounding.test.mjs +164 -0
  699. package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -0
  700. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +6 -2
  701. package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -0
  702. package/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
  703. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +122 -4
  704. package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
  705. package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
  706. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +138 -4
  707. package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
  708. package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +22 -13
  709. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
  710. package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
  711. package/skills/a2h-utg-static/SKILL.md +6 -2
  712. package/skills/a2h-utg-static/scripts/assemble.mjs +65 -0
  713. package/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
  714. package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
  715. package/skills/a2h-utg-static/scripts/compose_overlay.mjs +8 -1
  716. package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
  717. package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
  718. package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
  719. package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
  720. package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
  721. package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
  722. package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
  723. package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
  724. package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
  725. package/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
  726. package/skills/a2h-utg-static/scripts/run_pipeline.mjs +86 -4
  727. package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +30 -0
  728. package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
  729. package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
  730. package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
  731. package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
  732. package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
  733. package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
  734. package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
  735. package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
  736. package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
  737. package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
  738. package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
  739. package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
  740. package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
  741. package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
  742. package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
  743. package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
  744. package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
  745. package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
  746. package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -1
  747. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +0 -55
  748. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +0 -60
  749. package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +0 -948
  750. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +0 -1014
@@ -2,7 +2,7 @@
2
2
  * task_runner.mjs — port of task_runner.py. Verified parent recovery, finite selector search,
3
3
  * scroll sweeps and evidence-backed mappings. Synchronous like the Python.
4
4
  *
5
- * Exports: deviceLock, DeviceBusy, lockOwner, lockWait, LOCK_WAIT_S, BudgetExhausted, _isHorizontal, _viewSig, TRANSIENT_DEVICE_RE, Runner,
5
+ * Exports: deviceLock, DeviceBusy, lockOwner, lockWait, LOCK_WAIT_S, BudgetExhausted, _isHorizontal, _viewSig, TRANSIENT_DEVICE_RE, fixtureStepTarget, Runner,
6
6
  * runCampaignPhase, deps (indirection used by tests to replace imported functions,
7
7
  * e.g. deps.observationMatchesStatic, like monkeypatching the Python module global)
8
8
  *
@@ -35,11 +35,14 @@ import {
35
35
  } from './_py.mjs';
36
36
  import { deviceLockPath, LOCK_GRACE_S, holderGone, myStartMs } from './device_lock.mjs';
37
37
  import {
38
- DeviceAdapter, AdapterError, atomicWriteJson, event, readJson, matching, observationKey, ruleMatches, tarProblem,
38
+ DeviceAdapter, AdapterError, atomicWriteJson, event, readJson, matching, observationKey, ruleMatches, rowToggle, tarProblem,
39
39
  } from './adapters.mjs';
40
40
  import { applyStateAnchors, observationMatchesStatic, resolvePage, occludedIndices, resolveTwinByOpener, backCanReach, uiStatesOf, normalized, isInputNode } from './semantics.mjs';
41
41
  import { coverageMode, coveredStaticIds, scopeOf } from './coverage.mjs';
42
+ import { COLLAPSE_MIN_CASCADE, collapsedPrefixes, collapseNote, emptyStateComponents, emptyStateShown } from './diagnostics.mjs';
43
+ import { loadStringTables, deviceTextsIn } from './strings.mjs';
42
44
  import { triggerAttests } from './attest.mjs';
45
+ import { fallbackScope } from './state_phase.mjs';
43
46
 
44
47
  /** Indirection for functions tests replace (Python patches module globals). */
45
48
  export const deps = { observationMatchesStatic, resolvePage, triggerAttests };
@@ -219,8 +222,39 @@ export function grantRuntimePermissions(device, config) {
219
222
  export const TRANSIENT_DEVICE_RE = new RegExp(
220
223
  "Can't find service|Cannot identify foreground window|device '[^']+' not found|"
221
224
  + 'device offline|error: closed|device-timeout|ui-dump-(?:failed|remote-missing)|Foreground changed during capture');
225
+ /**
226
+ * Route-jump failure codes (hybrid_route_cdp.mjs, carried as `hybrid-route[<code>]: ...`). DOWN codes
227
+ * are deterministic and settle the phase's remaining route tasks; TRANSIENT codes are retried.
228
+ */
229
+ export const ROUTE_DOWN_CODES = new Set(['no-devtools-socket', 'uni-absent']);
230
+ export const ROUTE_TRANSIENT_CODES = new Set(['cdp-transient', 'adb-error', 'deadline']);
231
+ /** The code of a `hybrid-route[<code>]: ...` adapter error, else null. */
232
+ export function routeErrorCode(msg) {
233
+ const m = /hybrid-route\[([\w-]+)\]/.exec(String(msg));
234
+ return m ? m[1] : null;
235
+ }
236
+ /** The adapter's error for a foreground that moved between a capture's first and last read. */
237
+ const FOREGROUND_MOVED_RE = /Foreground changed during capture/;
238
+
239
+ /**
240
+ * What a failed fixture step acted on, for its `fixture-step-failed` reason: the selector(s) of a
241
+ * tap, else the launch target (component / component_fqn / uri / intent action). A launch has no
242
+ * selector, so the reason read `launch ""` and hid which component failed (yd-weather 11-14).
243
+ */
244
+ export function fixtureStepTarget(action) {
245
+ for (const k of ['selectors', 'selector', 'component', 'component_fqn', 'uri', 'action']) {
246
+ if (truthy(get(action, k))) { return action[k]; }
247
+ }
248
+ return '';
249
+ }
222
250
 
223
251
  const isVisible = (n) => truthy(get(n, 'visible', true));
252
+ /** Blank waits in a row that ran out before blank frames stop being waited on (Runner.awaitContent). */
253
+ const BLANK_RUN_OUTS = 3;
254
+ /** The distinct visible texts / content descriptions of a capture (at most 200), for a revision item. */
255
+ const visibleTexts = (observation) => [...new Set(get(observation ?? {}, 'nodes', []).filter((n) => isVisible(n))
256
+ .flatMap((n) => [get(n, 'text'), get(n, 'content_desc')]).filter((t) => truthy(t)).map((t) => pyStr(t).trim())
257
+ .filter((t) => t.length > 0))].slice(0, 200);
224
258
  /** A consent CheckBox's own label (「我已阅读并同意」), as against an optional one (「接收推送」). */
225
259
  const CONSENT_BOX_RE = /同意|已阅读|agree|accept/i;
226
260
  /**
@@ -230,7 +264,9 @@ const CONSENT_BOX_RE = /同意|已阅读|agree|accept/i;
230
264
  */
231
265
  const CONSENT_POSITIVE_RE = /^(?:我)?(?:同意|接受)(?:并(?:继续|使用|进入|开始使用))?$|^(?:i )?(?:agree|accept)(?:(?: and| &) (?:continue|proceed))?$/i;
232
266
  /** A label that declines or leaves: an app may put that on button1, so its id alone does not make it the accept. */
233
- const CONSENT_DECLINE_RE = /不同意|拒绝|退出|取消|暂不|disagree|decline|reject|refuse|exit|quit|cancel|not now/i;
267
+ const CONSENT_DECLINE_RE =/不同意|拒绝|退出|取消|暂不|disagree|decline|reject|refuse|exit|quit|cancel|not now/i;
268
+ /** A system dialog's button that stops it coming back: 「不再显示」, "Don't show again". */
269
+ const SYSTEM_DIALOG_SUPPRESS_RE = /^(?:不再显示|不再提示|下次不再提示|don['’]?t show again|do not show again|never show again)$/i;
234
270
  /** A toggle (CheckBox, Switch, ...): pressing it ticks, it does not accept, even when its label is 「同意」. */
235
271
  const isToggle = (n) => [true, 'true'].includes(get(n, 'checkable'))
236
272
  || /(?:CheckBox|Switch|RadioButton|ToggleButton|CheckedTextView)$/.test(pyStr(get(n, 'class', '')));
@@ -375,9 +411,84 @@ export function navigatedAway(before, after, catalog = {}) {
375
411
  return !OVERLAY_KINDS.has(kind);
376
412
  }
377
413
 
414
+ /**
415
+ * rowGroups(nodes): containers whose children include at least 3 visible clickable rows of one class
416
+ * and similar height (within 25%), stacked vertically: a list the dump does not flag scrollable.
417
+ * Measured (coolmall 2026-11-16): a region picker sheet's LazyColumn of provinces reported no
418
+ * `scrollable`, so a list step there found no list at all.
419
+ */
420
+ export function rowGroups(nodes) {
421
+ const kids = new Map();
422
+ nodes.forEach((n, i) => { const p = get(n, 'parent_index'); if (p !== null && p !== undefined) { if (!kids.has(p)) { kids.set(p, []); } kids.get(p).push(i); } });
423
+ const hasText = (i, d = 0) => d < 4 && (pyStr(get(nodes[i], 'text', '')).trim() !== '' || (kids.get(i) || []).some((k) => hasText(k, d + 1)));
424
+ const rootW = (() => { const b = get(nodes[0] || {}, 'bounds', []); return b.length === 4 ? b[2] - b[0] : 0; })();
425
+ const out = [];
426
+ for (const [p, ks] of kids) {
427
+ const rows = ks.map((i) => nodes[i]).filter((n) => isVisible(n) && truthy(get(n, 'clickable')) && get(n, 'bounds', []).length === 4);
428
+ // One or two rows (a picker level with one city): every child a full-width clickable row with
429
+ // text, in a container at least half the screen wide; a tab strip, a drag handle or a scrim is not.
430
+ const cb = get(nodes[p] || {}, 'bounds', []);
431
+ if (rows.length && rows.length < 3) {
432
+ const w = cb.length === 4 ? cb[2] - cb[0] : 0;
433
+ const ok = rows.length === ks.length && w > 0 && (!rootW || w >= 0.5 * rootW)
434
+ && rows.every((r) => r.bounds[2] - r.bounds[0] >= 0.9 * w) && ks.every((i) => hasText(i));
435
+ if (ok) { out.push(p); }
436
+ continue;
437
+ }
438
+ if (rows.length < 3) { continue; }
439
+ const cls = pyStr(get(rows[0], 'class', ''));
440
+ if (!rows.every((r) => pyStr(get(r, 'class', '')) === cls)) { continue; }
441
+ const hs = rows.map((r) => r.bounds[3] - r.bounds[1]).sort((a, b) => a - b);
442
+ const tops = rows.map((r) => r.bounds[1]);
443
+ const stacked = tops.every((t, k) => k === 0 || t >= tops[k - 1]);
444
+ // the last row may be cut by the screen edge: compare the full ones
445
+ const full = hs.slice(Math.min(1, hs.length - 3));
446
+ if (stacked && full[0] >= 0.75 * full.at(-1)) { out.push(p); }
447
+ }
448
+ return out;
449
+ }
450
+
451
+ /**
452
+ * sameTemplateRows(nodes, idx): true when the nodes at `idx` are one control repeated by a row
453
+ * template: each lies in a different child ("row") of their deepest common ancestor, every row has
454
+ * the same class tree (texts ignored), and the control sits at the same child path in each. A
455
+ * list's rows qualify; two different buttons that share a label (a tab and a row button, a toolbar
456
+ * and a dialog) never do. Measured (coolmall 2026-11-16): a coupon sheet's 「立即领取」 per coupon
457
+ * failed three tasks as an ambiguous selector though any row opens the same login page.
458
+ */
459
+ export function sameTemplateRows(nodes, idx) {
460
+ if (idx.length < 2 || idx.some((i) => !(i >= 0 && i < nodes.length))) { return false; }
461
+ const parent = (i) => { const p = get(nodes[i], 'parent_index'); return p === null || p === undefined || !(p >= 0 && p < nodes.length) ? null : p; };
462
+ const chain = (i) => { const out = []; let c = i; const seen = new Set(); while (c !== null && !seen.has(c)) { seen.add(c); out.push(c); c = parent(c); } return out; };
463
+ const chains = idx.map(chain);
464
+ const common = chains[0].find((a) => chains.every((c) => c.includes(a)));
465
+ if (common === undefined || idx.includes(common)) { return false; }
466
+ const rows = chains.map((c) => c[c.indexOf(common) - 1]);
467
+ if (new Set(rows).size !== rows.length) { return false; }
468
+ const kids = new Map();
469
+ nodes.forEach((n, i) => { const p = parent(i); if (p !== null) { if (!kids.has(p)) { kids.set(p, []); } kids.get(p).push(i); } });
470
+ const shape = (i) => `${pyStr(get(nodes[i], 'class', ''))}(${(kids.get(i) || []).map(shape).join(',')})`;
471
+ const pathIn = (row, i) => { const out = []; let c = i; while (c !== row) { const p = parent(c); out.push((kids.get(p) || []).indexOf(c)); c = p; } return out.join('/'); };
472
+ const s0 = shape(rows[0]); const p0 = pathIn(rows[0], idx[0]);
473
+ return rows.every((r, k) => shape(r) === s0 && pathIn(r, idx[k]) === p0);
474
+ }
475
+
476
+ /**
477
+ * writesData(text): a control label that writes to the app's backend when tapped (claim a coupon, add
478
+ * to cart, buy, delete, follow...). Such a control is never chosen by the runner's own loosening (a
479
+ * repeated row control taken by index, a list row probed) unless `config.allow_data_writes` is true.
480
+ * With the switch off a write is the costly mistake, so any label holding a write verb counts
481
+ * (「领取优惠券」「确认支付」「取消关注」「删除订单」「Add to wishlist」), except a label that names a
482
+ * place to go: a 「我的…」 entry or a page of records (「…记录」「…历史」「…列表」「…中心」「…明细」),
483
+ * which only opens a page.
484
+ */
485
+ export const WRITE_LABEL_RE = /领取|领券|加购|加入购物车|购买|抢购|下单|提交|支付|付款|删除|收藏|关注|点赞|兑换|签到|确认收货|取消订单|^\s*\+|\b(?:add to|buy|purchase|claim|redeem|delete|remove|submit|pay|order now|place order|follow|unfollow|like|favou?rite|wishlist|subscribe)\b/i;
486
+ export const NAV_LABEL_RE = /^\s*我的|(?:记录|历史|列表|中心|明细|日历|规则|说明|攻略|详情|管理)\s*(?:\(\d+\))?\s*$|^\s*my\b|\b(?:history|records?|list|center|centre|details?|rules|calendar)\s*$/i;
487
+ export function writesData(text) { return typeof text === 'string' && WRITE_LABEL_RE.test(text) && !NAV_LABEL_RE.test(text); }
488
+
378
489
  /** Failure reasons that repeat for every task replaying the same prefix in the same environment. */
379
490
  export const PREFIX_FAILURES = ['selector-not-found-after-bounded-scroll', 'replay-target-unverified:',
380
- 'ambiguous selector', 'list-item:', 'Scroll requires one visible scrollable container'];
491
+ 'ambiguous selector', 'list-item:', 'Scroll requires one visible scrollable container', 'needs-data:', 'needs-network:'];
381
492
 
382
493
  /** Key of a task's launch plus its first `n` replay steps. */
383
494
  export function prefixKey(task, n) {
@@ -504,6 +615,27 @@ export class Runner {
504
615
  * an upper layer paints over (the host page under a full-screen fragment) is not this page's.
505
616
  * a2h-batch-ui-align export_ui_info.mjs placeholderTexts applies the same test to the export.
506
617
  */
618
+ /**
619
+ * A capture of the app under test with nothing on it yet: its own visible nodes carry no text,
620
+ * no content description and none is clickable. A tap that opens a page captures the frame
621
+ * between the two (the old page gone, the new one not yet laid out), and such a frame resolves
622
+ * to no page, so looksLoading (verified pages only) never waited on it. Measured (coolmall
623
+ * 2026-11-18): every goods-list row tap captured a 38-node frame of bare Views and the list probe
624
+ * judged at once that no row opened the goods page; the same tap followed by a 4 s wait landed
625
+ * on it. Another app's foreground (a launcher, a system dialog) is not this.
626
+ */
627
+ looksBlank(observation) {
628
+ const pkg = get(this.config, 'package');
629
+ if (!truthy(pkg) || get(observation, 'package') !== pkg) { return false; }
630
+ const own = get(observation, 'nodes', []).filter((n) => isVisible(n) && get(n, 'package', pkg) === pkg);
631
+ const blank = !own.some((n) => truthy(get(n, 'clickable')) || pyStr(get(n, 'text', '') ?? '').trim()
632
+ || pyStr(get(n, 'content_desc', '') ?? '').trim());
633
+ // Only for an app that has shown a labelled screen: one whose tree never carries text (a canvas
634
+ // or a Flutter app without semantics) is blank on every capture and would pay the wait on each.
635
+ if (!blank) { this._appShowedText = true; return false; }
636
+ return this._appShowedText === true;
637
+ }
638
+
507
639
  looksLoading(observation) {
508
640
  const resolution = get(observation, 'static_resolution', {});
509
641
  if (get(resolution, 'status') !== 'verified') { return false; }
@@ -563,7 +695,9 @@ export class Runner {
563
695
  if (resolution.status === 'verified') {
564
696
  Object.assign(observation.identity, { family: resolution.static_id, status: 'verified', basis: resolution.anchors, reason: resolution.reason });
565
697
  }
566
- if (this.looksLoading(observation)) { observation.loading = true; }
698
+ if (resolution.status === 'verified') { this._lastVerified = resolution.static_id; }
699
+ if (this.looksBlank(observation)) { Object.assign(observation, { loading: true, blank: true }); }
700
+ else if (this.looksLoading(observation)) { observation.loading = true; }
567
701
  // Seen loaded: its loading passes, so a wait that ran out there was a slow load (awaitContent).
568
702
  // Only the first run-out is forgiven: a page that runs out again after that flips between
569
703
  // a loading-looking and a loaded view (a spinner a scroll hides) and keeps its zero wait.
@@ -614,17 +748,28 @@ export class Runner {
614
748
  * page stays (an empty state, a sparse screen, a spinner or a literal `%s` that never goes), and
615
749
  * every later action landing on it would pay the full wait. A page seen loaded since loads
616
750
  * slowly rather than never (a slow first fetch), so its next visit waits again.
751
+ * A blank frame that resolves to no page (looksBlank) waits `blank_wait_seconds` (default 6):
752
+ * with no page to remember it by, one that stayed blank must not cut the wait of the next,
753
+ * unrelated transition. Once BLANK_RUN_OUTS blank waits in a row have run out from one origin (the
754
+ * Activity and the last page verified before the frame), blank frames there are how that screen
755
+ * looks (an image viewer, a canvas) and are no longer waited on; other origins still wait.
617
756
  */
618
757
  awaitContent(observation) {
619
758
  let current = observation;
620
759
  if (!current || !current.loading) { return current; }
621
760
  const stuck = (this._loadingStuck ??= new Set());
622
761
  const sid = () => get(get(current, 'static_resolution', {}), 'static_id');
623
- const wait = stuck.has(sid()) ? 0 : toFloat(get(this.config, 'content_wait_seconds', 10));
762
+ const blankOnly = truthy(current.blank) && !truthy(sid());
763
+ const runOuts = (this._blankRunOuts ??= new Map());
764
+ // counted per transition origin: the Activity and the last page verified before the blank frame
765
+ const origin = `${pyStr(get(current, 'activity', ''))}|${pyStr(this._lastVerified ?? '')}`;
766
+ const wait = blankOnly ? ((runOuts.get(origin) ?? 0) >= BLANK_RUN_OUTS ? 0 : toFloat(get(this.config, 'blank_wait_seconds', 6)))
767
+ : stuck.has(sid()) ? 0 : toFloat(get(this.config, 'content_wait_seconds', 10));
624
768
  const deadline = monotonic() + Math.max(0, wait);
625
769
  while (current.loading && monotonic() < deadline) { sleep(0.5); current = this.capture(); }
770
+ if (blankOnly && wait > 0) { runOuts.set(origin, truthy(current.blank) ? (runOuts.get(origin) ?? 0) + 1 : 0); }
626
771
  if (current.loading) {
627
- if (wait > 0) { stuck.add(sid()); }
772
+ if (wait > 0 && truthy(sid())) { stuck.add(sid()); }
628
773
  this.mapCapture(current);
629
774
  }
630
775
  return current;
@@ -638,12 +783,13 @@ export class Runner {
638
783
  get(n, 'package') === pkg && isVisible(n) && truthy(get(n, 'clickable')));
639
784
  }
640
785
 
641
- atom(action, taskId, purpose) {
786
+ atom(action, taskId, purpose, { restoring: inRestore = false } = {}) {
642
787
  const lifetime = this.doc.events.filter((e) => e.kind === 'attempt_started' && truthy(get(e.payload, 'atomic'))).length;
643
788
  // A phase's cleanup runs after its budget is spent by design: restoring the
644
789
  // environment never counts against it (measured: a recD phase that used its whole
645
790
  // budget then threw from its cleanup, which run_cycle took as a fatal stage error).
646
- const restoring = purpose === 'restore' && lifetime < toInt(get(this.config, 'max_campaign_actions', 1800));
791
+ // `inRestore`: a dismissal made on behalf of a restore (cleanup's launch met a dialog) shares its exemption.
792
+ const restoring = (purpose === 'restore' || inRestore) && lifetime < toInt(get(this.config, 'max_campaign_actions', 1800));
647
793
  if (!restoring && (this.used >= this.args.budget || lifetime >= toInt(get(this.config, 'max_campaign_actions', 1800)) || monotonic() >= this.deadline)) {
648
794
  throw new BudgetExhausted('atomic-action/time budget exhausted');
649
795
  }
@@ -654,19 +800,22 @@ export class Runner {
654
800
  const started = this.emit('attempt_started', { task_id: taskId, atomic: true, purpose, action, before: before.observation_id });
655
801
  this.device.act(action, before);
656
802
  this.device.settle();
657
- let after = this.capture();
658
- if (get(action, 'type') === 'launch') {
803
+ const isLaunch = get(action, 'type') === 'launch';
804
+ // One budget per launch atom for captures the launch's own foreground moves spoil (launchCapture).
805
+ const moves = isLaunch ? { left: Math.max(0, toInt(get(this.config, 'launch_transition_captures', 3))) } : null;
806
+ let after = isLaunch ? this.launchCapture(taskId, moves) : this.capture();
807
+ if (isLaunch) {
659
808
  this.dirty = false;
660
809
  const waitS = Math.max(0.0, toFloat(get(this.config, 'launch_ready_seconds', 8)));
661
810
  let deadline = monotonic() + waitS;
662
- while (!this.appUiReady() && monotonic() < deadline) { sleep(0.5); after = this.capture(); }
811
+ after = this.waitAppUi(deadline, taskId, after, purpose, moves);
663
812
  for (let k = 0; k < toInt(get(this.config, 'launch_retries', 1)); k++) {
664
813
  if (this.appUiReady()) { break; }
665
814
  this.device.act(action, after);
666
815
  this.device.settle();
667
816
  deadline = monotonic() + waitS;
668
- after = this.capture();
669
- while (!this.appUiReady() && monotonic() < deadline) { sleep(0.5); after = this.capture(); }
817
+ after = this.launchCapture(taskId, moves);
818
+ after = this.waitAppUi(deadline, taskId, after, purpose, moves);
670
819
  }
671
820
  if (!this.appUiReady()) { throw new AdapterError('launch-ui-not-ready'); }
672
821
  }
@@ -680,9 +829,26 @@ export class Runner {
680
829
  before: before.observation_id, after: after.observation_id, action });
681
830
  }
682
831
 
683
- choose(action) {
832
+ choose(action, { alternates = true } = {}) {
684
833
  const isCand = Object.hasOwn(CANDIDATE_KINDS, get(action, 'type'));
685
834
  const candidates = isCand ? get(action, 'selectors', []) : [get(action, 'selector', {})];
835
+ const found = this._choose(action, isCand, candidates);
836
+ if (found || !alternates) { return found; }
837
+ // No candidate on screen: the same resources' other values (textAlternatesOf), as extra candidates.
838
+ const extra = [];
839
+ for (const s of candidates) {
840
+ for (const k of ['text', 'content_desc']) {
841
+ if (typeof get(s, k) !== 'string') { continue; }
842
+ for (const alt of this.textAlternatesOf(s[k])) {
843
+ const sel = { ...s, [k]: alt };
844
+ if (!extra.some((x) => jsonDumps(x, { sort_keys: true }) === jsonDumps(sel, { sort_keys: true }))) { extra.push(sel); }
845
+ }
846
+ }
847
+ }
848
+ return extra.length ? this._choose(action, isCand, extra) : found;
849
+ }
850
+
851
+ _choose(action, isCand, candidates) {
686
852
  let ambiguous = false;
687
853
  const hidden = occludedIndices(this.current.nodes);
688
854
  const live = this.current.nodes.map((n, i) => (!hidden.has(i) ? n : { visible: false }));
@@ -699,6 +865,26 @@ export class Runner {
699
865
  if (hits.length > 1) {
700
866
  const scoped = { ...selector, actionable: true };
701
867
  if (matching(live, scoped).length === 1) { return { type: kindOf(), selector: scoped }; }
868
+ // The same control in every row of one list (a 「立即领取」 per coupon): any row's opens the
869
+ // same page, so the first is taken by its index, never by coordinates (sameTemplateRows).
870
+ // Not a control that writes data (a coupon's claim, a row's add-to-cart) unless writes are allowed.
871
+ const writes = [selector.text, selector.content_desc, ...hits.flatMap((h) => [get(h, 'text'), get(h, 'content_desc')])].some(writesData);
872
+ if (!Object.hasOwn(selector, 'index') && (!writes || get(this.config, 'allow_data_writes') === true)
873
+ && sameTemplateRows(this.current.nodes, hits.map((h) => live.indexOf(h)))) {
874
+ return { type: kindOf(), selector: { ...selector, index: 0 } };
875
+ }
876
+ // A record's own text (a seeding recipe's state label, `record_label`): records are listed in
877
+ // a vertical list, so a match inside a horizontal strip (a filter tab of the same words) is
878
+ // not it. One left: taken by its index among the matches, top-down like `matching`.
879
+ if (truthy(get(action, 'record_label')) && !Object.hasOwn(selector, 'index')) {
880
+ const inStrip = (n) => { let p = get(n, 'parent_index'); for (let d = 0; d < 12 && p !== null && p !== undefined && p >= 0; d++) {
881
+ const a = this.current.nodes[p]; if (truthy(get(a, 'scrollable')) && _isHorizontal(a)) { return true; } p = get(a, 'parent_index'); } return false; };
882
+ const keep = hits.filter((h) => !inStrip(h));
883
+ if (keep.length === 1) {
884
+ const ordered = sortedBy(matching(live, selector), (n) => { const b = get(n, 'bounds', [0, 0]); return [b[1], b[0]]; });
885
+ return { type: kindOf(), selector: { ...selector, index: ordered.indexOf(keep[0]) } };
886
+ }
887
+ }
702
888
  }
703
889
  ambiguous = ambiguous || hits.length > 1;
704
890
  }
@@ -706,6 +892,107 @@ export class Runner {
706
892
  return permissionGrant(live, candidates, kindOf());
707
893
  }
708
894
 
895
+ /**
896
+ * Several lists hold rows and the step names the page a row opens (`target_id`): tap the first row
897
+ * of each, most rows first, until one lands on that page; Back after a row that opened another.
898
+ * At most `max_list_probes` (default 3) lists. Measured (coolmall 2026-11-16): the home page's
899
+ * flash-sale row, category strip and goods grid failed three tasks with 「expected one list,
900
+ * found 3」 although every goods list opened the same detail page. The landing page is checked
901
+ * by its own identity, so a wrong list is never taken for the right one.
902
+ */
903
+ probeLists(target, tapRow, taskId) {
904
+ const lists = this.listCandidates();
905
+ const before = this.current;
906
+ const origin = get(get(before, 'static_resolution', {}), 'status') === 'verified' ? before.static_resolution.static_id : null;
907
+ let last = null;
908
+ for (let [k, [, row]] of lists.slice(0, Math.max(1, toInt(get(this.config, 'max_list_probes', 3)))).entries()) {
909
+ if (k > 0) {
910
+ if (origin === null) { throw new AdapterError('list-item: the probing page is unverified, so a return to it cannot be checked'); }
911
+ // Back only when the last row left the page: a row that stays (a category chip switching a tab) must not exit it.
912
+ if (!this.at(origin)) { this.atom({ type: 'back' }, taskId, 'list-probe-back'); }
913
+ if (!this.at(origin)) { throw new AdapterError(`list-item: could not return to ${origin} after probing a list`); }
914
+ row = this.listCandidates()[k]?.[1] ?? row;
915
+ }
916
+ last = tapRow(row);
917
+ if (this.at(target)) {
918
+ if (typeof this.emit === 'function') { this.emit('list_probe', { task_id: taskId, target, chosen: k, lists: lists.length }); }
919
+ return last;
920
+ }
921
+ }
922
+ throw new AdapterError(`list-item: none of ${lists.length} lists opened ${target}`);
923
+ }
924
+
925
+ /**
926
+ * [listIndex, firstActionableRow] of every visible list holding rows, most rows first, then top-down.
927
+ * Nested scrollables that offer the same first row are one list (a page container around its grid).
928
+ */
929
+ listCandidates() {
930
+ const out = [];
931
+ for (const li of this._listContainers()) {
932
+ const rows = this._rowsOf(li);
933
+ if (rows.length) { out.push([li, sortedBy(rows, (n) => [n.bounds[1], n.bounds[0]])[0], rows.length]); }
934
+ }
935
+ const seen = new Set();
936
+ return sortedBy(out, (x) => [-x[2], x[1].bounds[1], x[1].bounds[0]])
937
+ .filter(([, r]) => { const k = JSON.stringify(r.bounds); if (seen.has(k)) { return false; } seen.add(k); return true; })
938
+ .map(([li, r]) => [li, r]);
939
+ }
940
+
941
+ _listContainers() {
942
+ const nodes = this.current.nodes;
943
+ const adapterCls = ['RecyclerView', 'ListView', 'GridView'];
944
+ const hasKids = new Set(nodes.map((c) => get(c, 'parent_index')));
945
+ const lists = [];
946
+ nodes.forEach((n, i) => { if (isVisible(n) && adapterCls.some((c) => pyStr(get(n, 'class', '')).endsWith(c)) && hasKids.has(i)) { lists.push(i); } });
947
+ if (lists.length === 1) { return lists; }
948
+ const scrollables = [];
949
+ nodes.forEach((n, i) => { if (truthy(get(n, 'scrollable')) && isVisible(n)) { scrollables.push(i); } });
950
+ return scrollables.length ? scrollables : rowGroups(nodes);
951
+ }
952
+
953
+ _rowsOf(li) {
954
+ const nodes = this.current.nodes;
955
+ const kidsOf = (i) => nodes.map((n, j) => [n, j]).filter(([n]) => get(n, 'parent_index') === i).map(([, j]) => j);
956
+ // a row's own button that writes data (「领取」「加购」) is never the row to probe, unless writes are allowed.
957
+ // A control's label is its own text, else the texts below it (up to 4 levels, not inside another
958
+ // clickable, which is a control of its own): a button labelled by a nested text is a writer when
959
+ // every such text is; a card holding a title, a price and a 「加购」 is not.
960
+ const allowWrites = get(this.config, 'allow_data_writes') === true;
961
+ const textsOf = (k) => [get(nodes[k], 'text'), get(nodes[k], 'content_desc')].filter((t) => typeof t === 'string' && t.trim());
962
+ const labelsOf = (j) => {
963
+ const own = textsOf(j);
964
+ if (own.length) { return own; }
965
+ const out = []; let level = kidsOf(j);
966
+ for (let d = 0; d < 4 && level.length; d++) {
967
+ const next = [];
968
+ for (const k of level) {
969
+ if (truthy(get(nodes[k], 'clickable')) || truthy(get(nodes[k], 'long-clickable'))) { continue; }
970
+ out.push(...textsOf(k)); next.push(...kidsOf(k));
971
+ }
972
+ level = next;
973
+ }
974
+ return out;
975
+ };
976
+ const writer = (j) => {
977
+ if (allowWrites || !(truthy(get(nodes[j], 'clickable')) || truthy(get(nodes[j], 'long-clickable')))) { return false; }
978
+ const ls = labelsOf(j);
979
+ return ls.length > 0 && ls.every(writesData);
980
+ };
981
+ const actionableRow = (ci) => {
982
+ const cands = [ci, ...kidsOf(ci)];
983
+ for (const c of kidsOf(ci)) { cands.push(...kidsOf(c)); }
984
+ for (const j of cands) {
985
+ const n = nodes[j];
986
+ if (j !== ci && writer(j)) { continue; }
987
+ if ((truthy(get(n, 'clickable')) || truthy(get(n, 'long-clickable'))) && isVisible(n)
988
+ && !['ImageButton', 'FloatingActionButton'].some((c) => pyStr(get(n, 'class', '')).endsWith(c))
989
+ && get(n, 'bounds', []).length === 4 && n.bounds[3] > n.bounds[1]) { return n; }
990
+ }
991
+ return null;
992
+ };
993
+ return kidsOf(li).map(actionableRow).filter((r) => truthy(r));
994
+ }
995
+
709
996
  listItem() {
710
997
  const nodes = this.current.nodes;
711
998
  const adapterCls = ['RecyclerView', 'ListView', 'GridView'];
@@ -716,6 +1003,7 @@ export class Runner {
716
1003
  lists = [];
717
1004
  nodes.forEach((n, i) => { if (truthy(get(n, 'scrollable')) && isVisible(n)) { lists.push(i); } });
718
1005
  }
1006
+ if (!lists.length) { lists = rowGroups(nodes); }
719
1007
  const idxOf = (n) => nodes.findIndex((m) => pyEq(m, n)); // list.index uses ==
720
1008
  const actionableRow = (child) => {
721
1009
  const cands = [child, ...nodes.filter((n) => get(n, 'parent_index') === idxOf(child))];
@@ -829,7 +1117,7 @@ export class Runner {
829
1117
  * required boxes, then the accept), up to `limit` ticks.
830
1118
  * Each dismissal is an `interruption` event. Returns true when something was dismissed.
831
1119
  */
832
- clearInterruption(taskId) {
1120
+ clearInterruption(taskId, { restoring = false } = {}) {
833
1121
  const limit = toInt(get(this.config, 'max_interruption_dismissals', 2));
834
1122
  let dismissed = false;
835
1123
  let ticks = 0;
@@ -848,23 +1136,103 @@ export class Runner {
848
1136
  texts: texts.slice(0, 6).map((t) => cpSlice(pyStr(t), 0, 80)), outcome: 'unresolved' });
849
1137
  break;
850
1138
  }
851
- let action = rule ? rule.action : (consent ?? { type: 'back' });
852
- if (!rule && !consent && k > 0 && matching(this.current.nodes, { resource_name: 'button2' }).length === 1) {
1139
+ const system = !rule && !consent ? this.systemDialogAction() : null;
1140
+ let action = rule ? rule.action : (consent ?? system ?? { type: 'back' });
1141
+ if (!rule && !consent && !system && k > 0 && matching(this.current.nodes, { resource_name: 'button2' }).length === 1) {
853
1142
  action = { type: 'click', selector: { resource_name: 'button2' } };
854
1143
  }
855
1144
  const tick = consent !== null && isToggle(matching(this.current.nodes, consent.selector)[0] ?? {});
856
- const result = this.atom(action, taskId, 'dismiss-interruption');
1145
+ const result = this.atom(action, taskId, 'dismiss-interruption', { restoring });
857
1146
  this.emit('interruption', { task_id: taskId, observation_id: before, bounds, action,
858
- rule: rule ? get(rule, 'id', null) : (consent ? 'consent-default' : null), texts: texts.slice(0, 6).map((t) => cpSlice(pyStr(t), 0, 80)),
1147
+ rule: rule ? get(rule, 'id', null) : (consent ? 'consent-default' : (system ? 'system-dialog-default' : null)),
1148
+ texts: texts.slice(0, 6).map((t) => cpSlice(pyStr(t), 0, 80)),
859
1149
  outcome: result.payload.outcome });
860
1150
  // A rule or a consent click that did nothing would do nothing again; Back/button2 would leave.
861
- if (result.payload.outcome === 'no_effect' && (rule || consent)) { break; }
1151
+ if (result.payload.outcome === 'no_effect' && (rule || consent || system)) { break; }
862
1152
  if (tick && ticks < limit) { ticks += 1; }
863
1153
  dismissed = dismissed || result.payload.outcome === 'succeeded';
864
1154
  }
865
1155
  return dismissed;
866
1156
  }
867
1157
 
1158
+ /**
1159
+ * Whether the app under test is the resumed activity but a system window (package `android`:
1160
+ * the 16 KB page-size compatibility dialog, a "keeps stopping" dialog) is what the dump shows.
1161
+ * Measured (jingmo 2026-11-16): on an x86_64 emulator the 「Android 应用兼容性」 dialog covered
1162
+ * MainActivity after every launch; appUiReady never held, so each launch re-captured for
1163
+ * launch_ready_seconds, relaunched, waited again and threw launch-ui-not-ready: every task
1164
+ * aborted and covered stayed 0. The activity (and `component_package`) still name the app.
1165
+ */
1166
+ coveredBySystemDialog() {
1167
+ const pkg = get(this.config, 'package');
1168
+ const cur = or(this.current, {});
1169
+ const shown = get(cur, 'package');
1170
+ if (!truthy(pkg) || !truthy(shown) || shown === pkg) { return false; }
1171
+ return get(cur, 'component_package') === pkg || pyStr(or(get(cur, 'activity'), '')).startsWith(pkg + '.');
1172
+ }
1173
+
1174
+ /**
1175
+ * The click that closes a system dialog over the app for good: its positive button
1176
+ * (android:id/button1) when it is labelled 「不再显示」 / "Don't show again", so the dialog does
1177
+ * not return on the next relaunch. Any other system dialog keeps the generic dismissal (Back).
1178
+ * Returns the click action, or null.
1179
+ */
1180
+ systemDialogAction() {
1181
+ if (!this.coveredBySystemDialog()) { return null; }
1182
+ const hits = matching(get(this.current, 'nodes', []), { resource_id: 'android:id/button1' });
1183
+ if (hits.length !== 1) { return null; }
1184
+ const label = normalized(or(get(hits[0], 'text'), get(hits[0], 'content_desc'), ''));
1185
+ return SYSTEM_DIALOG_SUPPRESS_RE.test(label) ? { type: 'click', selector: { resource_id: 'android:id/button1' } } : null;
1186
+ }
1187
+
1188
+ /**
1189
+ * Wait for the app's own UI after a launch until `deadline`. A system dialog over the app
1190
+ * (coveredBySystemDialog) is dismissed instead of waited out, at most `max_interruption_dismissals`
1191
+ * times per wait: a dialog that returns at once (no 「不再显示」 to silence it) would otherwise spend
1192
+ * the action budget until the deadline. After that the wait only polls. A launch made by a
1193
+ * restore (`purpose`) keeps its budget exemption for the dismissals. With `moves` (a launch's
1194
+ * budget, see launchCapture) a capture the launch's own foreground move spoils is retried.
1195
+ * Returns the latest observation.
1196
+ */
1197
+ waitAppUi(deadline, taskId, after, purpose = null, moves = null) {
1198
+ const cap = toInt(get(this.config, 'max_interruption_dismissals', 2));
1199
+ const restoring = purpose === 'restore';
1200
+ let cleared = 0;
1201
+ while (!this.appUiReady() && monotonic() < deadline) {
1202
+ // Every attempt counts toward the cap, not only a successful one: a dialog that ignores Back
1203
+ // and button2 would otherwise be pressed on every poll, spend the action budget, and the
1204
+ // press landing just after it closes could leave the app.
1205
+ if (cleared < cap && this.coveredBySystemDialog()) {
1206
+ cleared += 1;
1207
+ if (this.clearInterruption(taskId, { restoring })) { after = this.current; continue; }
1208
+ }
1209
+ sleep(0.5);
1210
+ after = moves ? this.launchCapture(taskId, moves) : this.capture();
1211
+ }
1212
+ return after;
1213
+ }
1214
+
1215
+ /**
1216
+ * capture() while a launch brings its UI up. The foreground moves there by design: the
1217
+ * starting window gives way to the activity, a SplashActivity hands over to the main one. A
1218
+ * capture that straddles such a move throws `Foreground changed during capture`; under a launch
1219
+ * it is retried, spending `moves.left` (launch_transition_captures, default 3, one budget per
1220
+ * launch atom). The budget is a count, not a time: on a slow device one capture outlasts the
1221
+ * whole launch_ready_seconds wait (measured yd-weather 11-14: ~30 s per capture, 8 s wait), so a
1222
+ * deadline would stop the retry before it ran. Any other error, or a move once the budget is
1223
+ * spent, is thrown as before. Each retry emits `launch_foreground_moved`.
1224
+ */
1225
+ launchCapture(taskId, moves) {
1226
+ for (;;) {
1227
+ try { return this.capture(); } catch (e) {
1228
+ if (!(e instanceof AdapterError) || !FOREGROUND_MOVED_RE.test(errStr(e)) || moves.left <= 0) { throw e; }
1229
+ moves.left -= 1;
1230
+ this.emit('launch_foreground_moved', { task_id: taskId, retries_left: moves.left, reason: s200(e) });
1231
+ sleep(0.5);
1232
+ }
1233
+ }
1234
+ }
1235
+
868
1236
  /**
869
1237
  * The app's own first-launch consent dialog (privacy policy / user agreement): Back closes the
870
1238
  * Activity and its negative button is "decline and exit", so the generic dismissal leaves the
@@ -1068,17 +1436,31 @@ export class Runner {
1068
1436
  if (others.length) { payload.unswept_containers = others; }
1069
1437
  const maxScrolls = toInt(get(this.config, 'max_sweep_scrolls', 20));
1070
1438
  let lastSig = _viewSig(origin);
1071
- let outcome = 'truncated'; let swipes = 0;
1439
+ let outcome = 'truncated'; let swipes = 0; let effective = 0;
1072
1440
  try {
1073
1441
  while (swipes <= maxScrolls) {
1074
1442
  this.atom({ type: 'scroll', selector, direction: 'down' }, taskId, purpose);
1075
1443
  swipes += 1;
1076
- const still = this._surfaceSelector(origin, selector, node);
1077
- if (still === null) { outcome = 'aborted'; payload.abort_reason = 'left-page'; break; }
1444
+ let still = this._surfaceSelector(origin, selector, node);
1445
+ if (still === null) {
1446
+ // A lazy list can change its node count / indices during the swipe without the page
1447
+ // being left. Re-observe once and resolve the container again before declaring an exit.
1448
+ sleep(0.5);
1449
+ try { this.capture({ acceptLoading: true }); } catch { /* keep the last observation */ }
1450
+ still = this._surfaceSelector(origin, selector, node);
1451
+ if (still === null) { outcome = 'aborted'; payload.abort_reason = 'left-page'; break; }
1452
+ }
1078
1453
  selector = still;
1079
1454
  const sig = _viewSig(this.current);
1080
- if (sig === lastSig) { outcome = 'complete'; break; }
1081
- if (payload.frames.length >= maxScrolls) { break; }
1455
+ if (sig === lastSig) {
1456
+ // No movement: either the page end (after a real scroll) or a container that never
1457
+ // moved. `complete` with 0 frames used to claim the page end and hid every below-fold
1458
+ // section; keep the two apart.
1459
+ outcome = effective > 0 ? 'complete' : 'no-effect';
1460
+ break;
1461
+ }
1462
+ effective += 1;
1463
+ if (payload.frames.length >= maxScrolls) { outcome = 'truncated'; break; }
1082
1464
  lastSig = sig;
1083
1465
  payload.frames.push(this.current.observation_id);
1084
1466
  const r = get(this.current, 'static_resolution', {});
@@ -1093,6 +1475,7 @@ export class Runner {
1093
1475
  }
1094
1476
  payload.outcome = outcome;
1095
1477
  payload.swipes = swipes;
1478
+ payload.effective = effective;
1096
1479
  if (outcome !== 'aborted' || get(payload, 'abort_reason') !== 'left-page') {
1097
1480
  payload.restored = this._sweepRestore(origin, selector, node, taskId);
1098
1481
  } else { payload.restored = false; }
@@ -1210,12 +1593,27 @@ export class Runner {
1210
1593
  }
1211
1594
  const type = get(action, 'type');
1212
1595
  if (type === 'click_list_item' || type === 'long_click_list_item') {
1213
- const row = this.listItem();
1214
- const b = row.bounds;
1215
1596
  const kind = type.startsWith('long') ? 'long_click_point' : 'click_point';
1216
- const rowInfo = {};
1217
- for (const k of ['class', 'resource_id', 'text', 'content_desc', 'bounds']) { rowInfo[k] = get(row, k); }
1218
- return this.atom({ type: kind, x: Math.floor((b[0] + b[2]) / 2), y: Math.floor((b[1] + b[3]) / 2), row: rowInfo }, taskId, purpose);
1597
+ const tapRow = (row) => {
1598
+ const b = row.bounds; const rowInfo = {};
1599
+ for (const k of ['class', 'resource_id', 'text', 'content_desc', 'bounds']) { rowInfo[k] = get(row, k); }
1600
+ return this.atom({ type: kind, x: Math.floor((b[0] + b[2]) / 2), y: Math.floor((b[1] + b[3]) / 2), row: rowInfo }, taskId, purpose);
1601
+ };
1602
+ // Rows filled from the network or a database arrive after the page itself (measured, coolmall:
1603
+ // the home page's goods were not yet in the tree when the step ran): wait, bounded, for a row.
1604
+ const until = monotonic() + Math.max(0, toFloat(get(this.config, 'list_wait_seconds', 6)));
1605
+ while (!this.listCandidates().length && !this.emptyFailure() && monotonic() < until) { sleep(0.5); this.capture({ acceptLoading: true }); }
1606
+ let row;
1607
+ try { row = this.listItem(); } catch (e) {
1608
+ if (!(e instanceof AdapterError)) { throw e; }
1609
+ const empty = this.emptyFailure();
1610
+ if (empty) { throw empty; }
1611
+ if (/^list-item: expected one list, found (?:[2-9]|\d{2,})/.test(errStr(e)) && truthy(get(action, 'target_id'))) {
1612
+ return this.probeLists(action.target_id, tapRow, taskId);
1613
+ }
1614
+ throw e;
1615
+ }
1616
+ return tapRow(row);
1219
1617
  }
1220
1618
  if (type === 'scroll_page') {
1221
1619
  const sideways = ['left', 'right'].includes(get(action, 'direction'));
@@ -1223,6 +1621,15 @@ export class Runner {
1223
1621
  if (conts.length !== 1) { throw new AdapterError('Scroll requires one visible scrollable container'); }
1224
1622
  return this.atom({ type: 'scroll', selector: scrollSel(conts[0], this.current.nodes), direction: get(action, 'direction', 'down') }, taskId, purpose);
1225
1623
  }
1624
+ if (type === 'toggle_on') {
1625
+ // the two-state control in the row titled `label`: tapped only when it is off
1626
+ const i = rowToggle(this.current.nodes, get(action, 'label'));
1627
+ if (i === null) { throw new AdapterError(`toggle: no single two-state control in the row 「${pyStr(get(action, 'label'))}」`); }
1628
+ const n = this.current.nodes[i];
1629
+ if (truthy(get(n, 'checked'))) { return null; }
1630
+ const b = n.bounds;
1631
+ return this.atom({ type: 'click_point', x: Math.floor((b[0] + b[2]) / 2), y: Math.floor((b[1] + b[3]) / 2), row: { class: get(n, 'class'), bounds: b } }, taskId, purpose);
1632
+ }
1226
1633
  if (!Object.hasOwn(CANDIDATE_KINDS, type)) { return this.atom(action, taskId, purpose); }
1227
1634
  let selected = this.choose(action);
1228
1635
  if (selected) { return this.atom(selected, taskId, purpose); }
@@ -1230,6 +1637,17 @@ export class Runner {
1230
1637
  selected = this.choose(action);
1231
1638
  if (selected) { return this.atom(selected, taskId, purpose); }
1232
1639
  }
1640
+ const between = this.betweenNeighbors(action);
1641
+ if (between) { return this.atom(between, taskId, purpose); }
1642
+ // A soft keyboard left up by the last input covers the bottom of the page (a form's submit
1643
+ // button): close it, never with a bare Back, and look again. Measured (coolmall 2026-11-16):
1644
+ // the address form's 「保存」 was missing from the tree while the keyboard was shown.
1645
+ if (this.current.nodes.some((n) => /EditText|TextField|AutoComplete/.test(pyStr(get(n, 'class', ''))))
1646
+ && typeof this.device?._imeShown === 'function' && this.device._imeShown()) {
1647
+ this.atom({ type: 'hide_ime' }, taskId, 'hide-ime');
1648
+ selected = this.choose(action);
1649
+ if (selected) { return this.atom(selected, taskId, purpose); }
1650
+ }
1233
1651
  if (!this.appUiReady()) { throw new AdapterError('selector unavailable on non-app/empty UI'); }
1234
1652
  // Content that loads after the page is ready (a list filled from the network or a database):
1235
1653
  // look again while the screen is still changing, for a bounded time, before scrolling. A
@@ -1303,7 +1721,108 @@ export class Runner {
1303
1721
  // Close only what the opener opened; an opener with no visible effect needs no Back.
1304
1722
  if (observationKey(this.current) !== key) { this.atom({ type: 'back' }, taskId, 'search-overflow-close'); }
1305
1723
  }
1306
- throw new AdapterError('selector-not-found-after-bounded-scroll');
1724
+ throw this.emptyFailure() ?? new AdapterError('selector-not-found-after-bounded-scroll');
1725
+ }
1726
+
1727
+ /**
1728
+ * A form field whose label the screen does not expose (a picker field under a transparent click
1729
+ * layer: only a text-less clickable shows): when the step names the labels of the fields before and
1730
+ * after it (`neighbors`, from the static form order), the one text-less clickable lying between
1731
+ * them, horizontally overlapping them, is tapped by its centre. Measured (coolmall 2026-11-16): the
1732
+ * address form's 「省市区」 field showed as a bare clickable View between 「手机号」 and 「详细地址」.
1733
+ * -> a click_point action, or null.
1734
+ */
1735
+ betweenNeighbors(action) {
1736
+ const nb = get(action, 'neighbors');
1737
+ if (!Array.isArray(nb) || nb.length !== 2) { return null; }
1738
+ const nodes = this.current.nodes;
1739
+ const find = (t) => { if (!t) { return null; } const h = nodes.filter((n) => isVisible(n) && pyStr(get(n, 'text', '')).trim() === t); return h.length === 1 ? h[0] : null; };
1740
+ const [prev, next] = [find(nb[0]), find(nb[1])];
1741
+ if (!prev && !next) { return null; }
1742
+ const top = prev ? prev.bounds[3] : 0;
1743
+ const bottom = next ? next.bounds[1] : Infinity;
1744
+ const ref = prev || next;
1745
+ const hits = nodes.filter((n) => isVisible(n) && truthy(get(n, 'clickable')) && !pyStr(get(n, 'text', '')).trim()
1746
+ && !pyStr(get(n, 'content_desc') ?? get(n, 'content-desc') ?? '').trim() && get(n, 'bounds', []).length === 4
1747
+ && n.bounds[1] >= top - 8 && n.bounds[3] <= bottom + 8 && n.bounds[0] < ref.bounds[2] && n.bounds[2] > ref.bounds[0]
1748
+ && (n.bounds[3] - n.bounds[1]) > 20);
1749
+ if (hits.length !== 1) { return null; }
1750
+ const b = hits[0].bounds;
1751
+ return { type: 'click_point', x: Math.floor((b[0] + b[2]) / 2), y: Math.floor((b[1] + b[3]) / 2), row: { class: get(hits[0], 'class'), bounds: b, between: nb } };
1752
+ }
1753
+
1754
+ /**
1755
+ * The failure to report instead of a missing selector or list row when the screen shows one of the
1756
+ * app's empty-state components (diagnostics.emptyStateShown): `needs-data:<page> (texts)`, or
1757
+ * `needs-network:` for a failed load. The path may be right; the data it needs is not there.
1758
+ */
1759
+ emptyFailure() {
1760
+ const comps = (this._emptyComponents ??= emptyStateComponents(get(this.doc, 'nodes', [])));
1761
+ const shown = emptyStateShown(this.current, comps);
1762
+ if (!shown) { return null; }
1763
+ const page = get(get(this.current, 'static_resolution', {}), 'status') === 'verified'
1764
+ ? this.current.static_resolution.static_id : `activity:${get(this.current, 'activity') ?? ''}`;
1765
+ return new AdapterError(`needs-${shown.kind}:${page} (${shown.texts.join(' / ')})`);
1766
+ }
1767
+
1768
+ /**
1769
+ * Other values of the resources a selector text belongs to (strings.deviceTextsIn): a key
1770
+ * two modules define differently resolves to one of them on the device, by the merge order of the
1771
+ * build. Measured (coolmall 2026-11-15): a recipe tapped 「手机号码」 (feature/user) while the device
1772
+ * showed 「手机号」 (feature/main wins, declared first), and the phase ran none of its tasks.
1773
+ */
1774
+ textAlternatesOf(text) {
1775
+ if (this._stringTables === undefined) {
1776
+ const project = get(this.doc, 'source_project');
1777
+ this._stringTables = null;
1778
+ if (truthy(project)) { try { this._stringTables = loadStringTables(project, get(this.doc, 'locale', 'en')); } catch { /* none */ } }
1779
+ }
1780
+ return this._stringTables ? deviceTextsIn(this._stringTables, text || '') : [];
1781
+ }
1782
+
1783
+ /**
1784
+ * The key of a proven route: the phase environment, the start (`fresh` / `warm`), the page the
1785
+ * launch landed on, and the page reached. A route proven from one start and landing replays only
1786
+ * from the same: a first-run page or cleared data changes what the same taps do.
1787
+ */
1788
+ routeKey(page, start = this._start, landing = this._landing) { return [this.env, start, landing, page].join('\u0000'); }
1789
+
1790
+ /**
1791
+ * recordRoute(page, steps): the replay steps, run from this task's own launch, that the device
1792
+ * verified as reaching `page` (not merely attested). The first route proven to a page is kept for
1793
+ * the rest of the run. Only from a launch made for the current task: a task that started on a page
1794
+ * an earlier task left has no launch the steps start from.
1795
+ */
1796
+ recordRoute(page, steps) {
1797
+ if (!truthy(page) || this._launchedFor === undefined || !Array.isArray(steps) || !steps.length) { return; }
1798
+ const routes = (this._routes ??= new Map());
1799
+ const k = this.routeKey(page);
1800
+ if (!routes.has(k)) { routes.set(k, structuredClone(steps)); }
1801
+ }
1802
+
1803
+ /**
1804
+ * rerouteTask(task, i, start, landing, reason): the task with replay steps 0..i (whose last hop
1805
+ * names the page it opens) replaced by a route this run proved reaches that page from the same
1806
+ * start and landing, or null. Each task is rerouted once: the substitute carries `rerouted_from`.
1807
+ * A failure (an ambiguous selector, a control not found, a list that opened another page) then
1808
+ * repeats for none of the tasks sharing that prefix. Measured (coolmall 2026-11-18): logged-out
1809
+ * tasks replayed a coupon claim to reach Login (an ambiguous selector) while other tasks of the run
1810
+ * had reached Login, and every task behind that hop failed or was cut by the prefix memo.
1811
+ */
1812
+ rerouteTask(task, i, start, landing, reason) {
1813
+ if (!truthy(get(this.config, 'reroute_replay', true)) || truthy(get(task, 'rerouted_from'))) { return null; }
1814
+ const replay = or(get(task, 'replay'), []);
1815
+ const page = get(replay[i] ?? {}, 'target_id');
1816
+ if (!truthy(page) || truthy(get(replay[i], 'intermediate'))) { return null; }
1817
+ const route = (this._routes ?? new Map()).get(this.routeKey(page, start, landing));
1818
+ if (!route || jsonDumps(route, { sort_keys: true }) === jsonDumps(replay.slice(0, i + 1), { sort_keys: true })) { return null; }
1819
+ const alt = { ...task, replay: [...structuredClone(route), ...replay.slice(i + 1)], rerouted_from: { replay_index: i, reason } };
1820
+ this.emit('replay_rerouted', { task_id: task.task_id, page, replay_index: i, reason, route_steps: route.length,
1821
+ start, landing, observation_id: get(or(this.current, {}), 'observation_id') });
1822
+ // the substitute launches again: from cleared data when this one did
1823
+ if (start === 'fresh' && this._clearedFor === task.task_id) { this._clearedFor = undefined; }
1824
+ this._launchedFor = undefined;
1825
+ return alt;
1307
1826
  }
1308
1827
 
1309
1828
  source(task) {
@@ -1346,24 +1865,34 @@ export class Runner {
1346
1865
  const memo = truthy(get(this.config, 'prefix_memo', true)) ? (this._prefixFailures ??= new Map()) : null;
1347
1866
  const replay = mget(task, 'replay');
1348
1867
  const start = this.resetsBetweenTasks() && this._clearedFor !== task.task_id ? 'fresh' : 'warm';
1868
+ // A failed prefix with a proven route to the page its failing hop opens is replayed through that
1869
+ // route instead (rerouteTask); the reroute runs after the memo check, from the next launch.
1870
+ let reroute = null;
1349
1871
  const memoHit = (landing) => {
1350
1872
  if (!memo || landing === undefined) { return; }
1351
1873
  for (let n = 1; n <= replay.length; n++) {
1352
1874
  const k = prefixKey(task, n);
1353
1875
  const e = memo.get(k);
1354
- if (e && e.start === start && e.landing === landing) { throw new PrefixFailed(e, k); }
1876
+ if (e && e.start === start && e.landing === landing) {
1877
+ reroute = this.rerouteTask(task, e.replay_index, start, landing, e.reason);
1878
+ if (reroute) { return; }
1879
+ throw new PrefixFailed(e, k);
1880
+ }
1355
1881
  }
1356
1882
  };
1357
1883
  const last = (this._lastLanding ??= {})[start];
1358
1884
  const chain = or(get(task, 'launch_chain'), []);
1359
1885
  if (last && (start === 'fresh' || (chain.length ? chain.includes(last.landing) : last.repeated))) { memoHit(last.landing); }
1886
+ if (reroute) { return this.source(reroute); }
1360
1887
  this.resetBetweenTasks(task.task_id);
1361
1888
  this.atom(launch, task.task_id, 'recover');
1362
1889
  this.waitLaunchPage(task);
1363
1890
  this._landing = landingOf(this.current);
1364
1891
  this._start = start;
1892
+ this._launchedFor = task.task_id;
1365
1893
  this._lastLanding[start] = { landing: this._landing, repeated: last?.landing === this._landing };
1366
1894
  memoHit(this._landing);
1895
+ if (reroute) { return this.source(reroute); }
1367
1896
  this.launchBridge(task, { waited: true });
1368
1897
  const attested = new Set();
1369
1898
  let passedSoFar = 0;
@@ -1384,6 +1913,8 @@ export class Runner {
1384
1913
  throw new AdapterError('replay-target-unverified:' + step.target_id);
1385
1914
  }
1386
1915
  attested.add(step.target_id);
1916
+ } else {
1917
+ this.recordRoute(step.target_id, replay.slice(0, i + 1));
1387
1918
  }
1388
1919
  } catch (e) {
1389
1920
  const msg = errStr(e);
@@ -1391,6 +1922,10 @@ export class Runner {
1391
1922
  memo.set(prefixKey(task, i + 1), { reason: msg, task_id: task.task_id, replay_index: i, start: this._start, landing: this._landing,
1392
1923
  observation_id: get(or(this.current, {}), 'observation_id'), before_id: stepStart });
1393
1924
  }
1925
+ if (e instanceof AdapterError && PREFIX_FAILURES.some((r) => msg.startsWith(r))) {
1926
+ const alt = this.rerouteTask(task, i, this._start, this._landing, msg);
1927
+ if (alt) { return this.source(alt); }
1928
+ }
1394
1929
  throw e;
1395
1930
  }
1396
1931
  }
@@ -1400,6 +1935,26 @@ export class Runner {
1400
1935
  if (!this.at(source)) { this.clearInterruption(task.task_id); }
1401
1936
  if (!this.at(source)) {
1402
1937
  const ctx = get(task, 'source_context');
1938
+ // With no replay the launch alone must have opened the chain. Its deepest anchored page is
1939
+ // checkable, so an anchorless source behind it is not taken on the activity's word while
1940
+ // that page is missing (measured, weather 2026-11-14: the settings tap lost from the path,
1941
+ // every preference-dialog task passed on MainActivity and scrolled the main screen).
1942
+ // Only a screen read as other pages proves the launch fell short: verified as a page outside the
1943
+ // chain's tail, or ambiguous among such pages only. A default child that fills the host (its
1944
+ // widgets gone from the dump) is unmapped, and is left to the checks below.
1945
+ const chain = or(get(task, 'launch_chain'), []);
1946
+ const chainHost = replay.length ? undefined : [...chain].reverse().find((p) => p !== source && !this.anchorless(p));
1947
+ const tailIds = chain.slice(chain.indexOf(chainHost));
1948
+ const outside = (id) => truthy(id) && id !== source && !tailIds.includes(id);
1949
+ const shown = or(get(this.current, 'static_resolution'), {});
1950
+ const shownCands = or(get(shown, 'candidates'), []).map((c) => get(c, 'static_id'));
1951
+ const elsewhere = get(shown, 'status') === 'verified' ? outside(get(shown, 'static_id'))
1952
+ : get(shown, 'status') === 'ambiguous' && shownCands.length > 0 && shownCands.every(outside);
1953
+ if (chainHost !== undefined && elsewhere && !this.at(chainHost)) {
1954
+ this.emit('source_chain_missing', { task_id: task.task_id, source, missing: chainHost,
1955
+ observation_id: get(or(this.current, {}), 'observation_id') });
1956
+ throw new AdapterError('source-unverified:' + source);
1957
+ }
1403
1958
  if (!(this.anchorless(source) && (attested.has(source)
1404
1959
  || (truthy(ctx) && (this.at(ctx) || this.transientSuccessor(ctx, source, task.task_id)))
1405
1960
  || (!replay.length && this.launchedInto(source, task.task_id))))) {
@@ -1417,12 +1972,16 @@ export class Runner {
1417
1972
  * Not a control of the target page itself (its own label in the catalog): there an absent control
1418
1973
  * is below the fold, behind a reveal or still loading, and the gesture is still owed. The caller
1419
1974
  * offers only the leading hops, before any replay gesture ran.
1975
+ * `entry_cues` are not the target's own: they are the opener's control texts, on the page before
1976
+ * it. Measured (coolmall 2026-11-15): Main's cues 「跳过」「开始体验」 read as Main's own controls, the
1977
+ * hop was never passed, and a recovery phase standing on Home failed 20 of 20 tasks behind it.
1420
1978
  */
1421
1979
  replayStepPassed(step) {
1422
1980
  if (!Object.hasOwn(CANDIDATE_KINDS, get(step, 'type')) && !['click', 'long_click'].includes(get(step, 'type'))) { return false; }
1423
1981
  if (truthy(get(step, 'intermediate')) || !truthy(get(step, 'target_id')) || !this.at(step.target_id)) { return false; }
1424
1982
  const labels = [get(step, 'static_label'), ...or(get(step, 'static_label_alt'), [])].filter(truthy).map((l) => pyStr(l).trim());
1425
- const own = Object.values(or(get(this.catalog, step.target_id), {})).flatMap((v) => (Array.isArray(v) ? v : [v]))
1983
+ const own = Object.entries(or(get(this.catalog, step.target_id), {})).filter(([k]) => k !== 'entry_cues')
1984
+ .flatMap(([, v]) => (Array.isArray(v) ? v : [v]))
1426
1985
  .filter((v) => typeof v === 'string').map((v) => v.trim());
1427
1986
  if (labels.some((l) => own.includes(l))) { return false; }
1428
1987
  try { return !this.choose(step); } catch (e) { if (e instanceof AdapterError) { return false; } throw e; }
@@ -1719,7 +2278,11 @@ export class Runner {
1719
2278
  }
1720
2279
 
1721
2280
  _runFixtures() {
2281
+ let skip = 0;
2282
+ // a gesture ran since the last launch / restore: later hops are owed, never "already passed"
2283
+ let gestured = false;
1722
2284
  for (const action of get(get(this.config, 'fixtures', {}), this.phase.id, [])) {
2285
+ if (skip > 0) { skip -= 1; continue; }
1723
2286
  // A fixture's own save step only exists to hand its state to later phases. When the phase
1724
2287
  // runs again (next round, resume) the archive is the one this fixture already wrote: keep it
1725
2288
  // (never overwrite) and continue, instead of blocking the phase on its own artifact.
@@ -1743,6 +2306,26 @@ export class Runner {
1743
2306
  }
1744
2307
  continue;
1745
2308
  }
2309
+ // `skip_unless { rule, count }`: the next `count` steps run only when the screen matches `rule`
2310
+ // (a seeding recipe creates a record only while its list page shows the empty state, so a
2311
+ // rerun never makes a second one).
2312
+ if (get(action, 'type') === 'skip_unless') {
2313
+ if (!ruleMatches(this.current, get(action, 'rule', {}))) {
2314
+ const n = Math.max(0, toInt(get(action, 'count', 0)));
2315
+ this.emit('fixture_steps_skipped', { phase: this.phase.id, count: n, rule: action.rule, observation_id: get(this.current, 'observation_id') });
2316
+ skip = n;
2317
+ }
2318
+ continue;
2319
+ }
2320
+ // A recipe step compiled from a click path (it names its target page) whose page is already up
2321
+ // and whose control is gone: a first-run hop the warm launch has passed (replayStepPassed).
2322
+ if (!gestured && truthy(get(action, 'target_id')) && this.replayStepPassed(action)) {
2323
+ this.emit('replay_step_passed', { task_id: 'fixture:' + this.phase.id, target_id: action.target_id, observation_id: get(this.current, 'observation_id') });
2324
+ continue;
2325
+ }
2326
+ const at = get(action, 'type');
2327
+ if (['launch', 'clear_app_data', 'restore_app_data'].includes(at)) { gestured = false; }
2328
+ else if (!['wait', 'snapshot_app_data', 'save_replay'].includes(at)) { gestured = true; }
1746
2329
  try {
1747
2330
  this.seek(action, 'fixture:' + this.phase.id, 'prepare');
1748
2331
  if (['clear_app_data', 'restore_app_data'].includes(get(action, 'type'))) { this.grantRuntimePermissions(); }
@@ -1753,7 +2336,13 @@ export class Runner {
1753
2336
  this.seek(action, 'fixture:' + this.phase.id, 'prepare');
1754
2337
  } catch (exc2) {
1755
2338
  if (!(exc2 instanceof AdapterError)) { throw exc2; }
1756
- const sel = or(get(action, 'selectors'), () => or(get(action, 'selector'), ''));
2339
+ const sel = fixtureStepTarget(action);
2340
+ // What the screen did show: recover_d.mjs stepFailures offers the recipe back so its steps
2341
+ // can be rewritten from evidence. Measured (coolmall 2026-11-18): a login recipe tapped
2342
+ // 「请输入手机号码」 on a screen whose field read 「请输入手机号」, and the phase stayed blocked.
2343
+ this.emit('fixture_step_failed', { phase: this.phase.id, step: get(action, 'type'), part: get(action, 'recipe_part', null), selector: sel,
2344
+ observation_id: get(this.current, 'observation_id'), activity: get(this.current, 'activity'),
2345
+ visible_texts: visibleTexts(this.current) });
1757
2346
  this._block(`fixture-step-failed: ${pyStr(get(action, 'type'))} ${cpSlice(jsonDumps(sel, { ensure_ascii: false }), 0, 80)}: ${errStr(exc2)}`);
1758
2347
  return false;
1759
2348
  }
@@ -1768,7 +2357,20 @@ export class Runner {
1768
2357
  const tasks = get(this.doc, 'tasks', []).filter((t) => t.phase === this.phase.id);
1769
2358
  const probesFor = get(get(this.config, 'phase_probes', {}), this.phase.id);
1770
2359
  if (truthy(this.phase.requires) && !truthy(probesFor)) {
1771
- return this._block('unresolved prerequisites: ' + this.phase.requires.join(', '));
2360
+ const fallback = fallbackScope(this.config, this.phase, probesFor, this.doc);
2361
+ if (fallback === null) {
2362
+ return this._block('unresolved prerequisites: ' + this.phase.requires.join(', '));
2363
+ }
2364
+ this.emit('state_probe_missing', { phase: this.phase.id, requires: this.phase.requires, fallback });
2365
+ }
2366
+ // A phase that writes to the backend (a seeding recipe) runs only while the switch is still on:
2367
+ // turning `allow_data_writes` off after scheduling stops it on the next run. `writes_data` decides;
2368
+ // a recS- phase with no flag at all was scheduled before the flag existed (seed_recipes apply
2369
+ // backfills it on its next run) and counts as writing until then.
2370
+ const writes = get(this.phase, 'writes_data');
2371
+ const legacySeed = (writes === undefined || writes === null) && String(this.phase.id).startsWith('recS-');
2372
+ if ((writes === true || legacySeed) && get(this.config, 'allow_data_writes') !== true) {
2373
+ return this._block('data-writes-disabled: config.allow_data_writes is not true');
1772
2374
  }
1773
2375
  this.prepareEnvironment();
1774
2376
  if (!this._runFixtures()) { return undefined; }
@@ -1777,15 +2379,13 @@ export class Runner {
1777
2379
  // What the screen did show: recover_d.mjs offers it back so the probe can be rewritten from
1778
2380
  // evidence. Measured (ydweather): the recipe reached Main, but its probe asked for a sticky
1779
2381
  // title that is never in the tree at rest, and Main stayed uncaptured.
1780
- const shown = [...new Set(get(this.current, 'nodes', []).filter((n) => isVisible(n))
1781
- .flatMap((n) => [get(n, 'text'), get(n, 'content_desc')]).filter((t) => truthy(t)).map((t) => pyStr(t).trim())
1782
- .filter((t) => t.length > 0))].slice(0, 200);
1783
2382
  this.emit('state_probe_failed', { phase: this.phase.id, observation_id: get(this.current, 'observation_id'),
1784
- activity: get(this.current, 'activity'), visible_texts: shown, probes });
2383
+ activity: get(this.current, 'activity'), visible_texts: visibleTexts(this.current), probes });
1785
2384
  return this._block('state-probe-failed');
1786
2385
  }
1787
2386
  this.emit('environment_verified', { phase: this.phase.id, observation_id: this.current.observation_id,
1788
- scope: truthy(probes) ? 'configured probes' : 'existing state, no guard assumed' });
2387
+ scope: truthy(probes) ? 'configured probes'
2388
+ : (truthy(this.phase.requires) ? fallbackScope(this.config, this.phase, probes, this.doc) : 'existing state, no guard assumed') });
1789
2389
  this.phase.status = 'running'; this.save();
1790
2390
  let routeFailures = 0;
1791
2391
  for (const route of get(get(this.config, 'routes', {}), this.phase.id, [])) {
@@ -1804,6 +2404,7 @@ export class Runner {
1804
2404
  this.emit('route_result', { route_id: route.id, outcome: 'failed', reason: errStr(e), observation_id: this.current.observation_id });
1805
2405
  }
1806
2406
  }
2407
+ const runStart = this.doc.events.length;
1807
2408
  const starts = counter(this.doc.events.filter((e) => e.kind === 'task_started').map((e) => e.payload.task_id));
1808
2409
  const phaseTaskIds = new Set(tasks.map((t) => t.task_id));
1809
2410
  const done = new Set(this.doc.events.filter((e) => e.kind === 'task_result' && e.payload.outcome === 'confirmed'
@@ -1834,12 +2435,26 @@ export class Runner {
1834
2435
  }
1835
2436
  const invariants = get(get(this.config, 'invariant_probes', {}), this.phase.id, []);
1836
2437
  if (truthy(invariants) && !invariants.every((p) => ruleMatches(this.current, p))) { return this._block('state-drift'); }
2438
+ const isRoute = get(task, 'purpose') === 'route-launch' || get(task.action, 'type') === 'route';
2439
+ // A route task that cannot run (capture disabled, route down for this phase) is settled
2440
+ // without starting it: no task_started, no attempt spent, so a later run still gets it.
2441
+ const routeBlocked = isRoute ? this.routeUnavailable() : null;
2442
+ if (routeBlocked) {
2443
+ this.emit('task_result', { task_id: ident, outcome: 'unsupported', reason: routeBlocked, target_static: task.target_static });
2444
+ continue;
2445
+ }
1837
2446
  scheduled += 1; starts.set(ident, (starts.get(ident) ?? 0) + 1);
1838
2447
  this.emit('task_started', { task_id: ident, target_static: task.target_static });
1839
2448
  this.keep = [task.source_static, task.target_static, get(task, 'source_context')].filter((x) => truthy(x));
1840
2449
  this._launched = false; // only a launch of this task's own opens the consent window
1841
2450
  this._clearedFor = null; // every attempt of a task starts from cleared data (resetBetweenTasks)
1842
2451
  if (get(task, 'purpose') === 'direct-launch') { this.runDirect(task, done); continue; }
2452
+ if (isRoute) {
2453
+ const how = this.runRoute(task, done, transient);
2454
+ if (how === 'retry') { starts.set(ident, starts.get(ident) - 1); tasks.push(task); }
2455
+ if (how === DEVICE_UNAVAILABLE) { return this._block(DEVICE_UNAVAILABLE); }
2456
+ continue;
2457
+ }
1843
2458
  try {
1844
2459
  this._runTask(task, ident, done);
1845
2460
  } catch (exc) {
@@ -1897,16 +2512,77 @@ export class Runner {
1897
2512
  .map((e) => get(e.payload, 'static_id')));
1898
2513
  const missing = this.phase.obligations.filter((o) => o.type === 'node' && !mapped.has(o.id) && !this.scopeExcludes(o.id));
1899
2514
  const resolved = new Set([...done, ...skipped]).size;
2515
+ // One failed prefix the memo reused for many tasks: name it, the phase ran little of itself.
2516
+ const byId = new Map(get(this.doc, 'tasks', []).map((t) => [t.task_id, t]));
2517
+ for (const t of tasks) { byId.set(t.task_id, t); }
2518
+ const collapses = collapsedPrefixes(this.doc.events.slice(runStart), byId,
2519
+ { env: this.env, min: toInt(get(this.config, 'collapse_min_cascade', COLLAPSE_MIN_CASCADE)) });
2520
+ for (const c of collapses) { this.emit('phase_collapsed', { phase: this.phase.id, ...c }); }
1900
2521
  Object.assign(this.phase, {
1901
2522
  status: resolved === tasks.length && !missing.length && !routeFailures ? 'completed' : 'exhausted-with-gaps',
1902
2523
  reason: `${done.size}/${tasks.length} tasks confirmed; ${skipped.size} skipped (target already covered or out of scope); `
1903
2524
  + `${missing.length} node obligations missing; ${routeFailures} routes failed; `
1904
- + `discovery=${pyStr(get(discovery, 'outcome', 'disabled'))}; coverage=${this.coverage}`,
2525
+ + `discovery=${pyStr(get(discovery, 'outcome', 'disabled'))}; coverage=${this.coverage}`
2526
+ + collapses.map((c) => `; COLLAPSED: ${collapseNote(c)}`).join(''),
1905
2527
  });
2528
+ if (collapses.length) { this.phase.collapsed = collapses.map(({ targets, ...c }) => c); }
1906
2529
  this.save();
1907
2530
  return undefined;
1908
2531
  }
1909
2532
 
2533
+ /**
2534
+ * A uni-app route-jump task: one page = one route inside the shared WebView host, so there is
2535
+ * no Activity to launch and no in-app click path to replay. `route` (DeviceAdapter) executes
2536
+ * uni.reLaunch / uni.switchTab through the WebView, then the normal capture/mapping pipeline
2537
+ * identifies the landing page by its route token.
2538
+ */
2539
+ runRoute(task, done, transient = new Map()) {
2540
+ const ident = task.task_id;
2541
+ this.stage = 'target';
2542
+ try {
2543
+ if (get(this.current, 'package') !== mget(this.config, 'package')) {
2544
+ this.atom({ type: 'launch', component: mget(this.config, 'launch_component'), restart: true }, ident, 'route');
2545
+ }
2546
+ this.seek(task.action, ident, 'target');
2547
+ } catch (exc) {
2548
+ if (exc instanceof BudgetExhausted) { throw exc; }
2549
+ const msg = errStr(exc);
2550
+ const code = routeErrorCode(msg);
2551
+ // Only a deterministic cause takes the route down for the rest of the phase (no DevTools
2552
+ // socket while adb works; uni absent in every target that answered).
2553
+ if (ROUTE_DOWN_CODES.has(code)) {
2554
+ this._hybridRouteDown = msg;
2555
+ this.emit('hybrid_route_unavailable', { task_id: ident, reason: msg, code });
2556
+ } else if (ROUTE_TRANSIENT_CODES.has(code) || TRANSIENT_DEVICE_RE.test(msg)) {
2557
+ // A CDP/adb hiccup: retry the task like a transient device error (_runTask's handling).
2558
+ const device = TRANSIENT_DEVICE_RE.test(msg);
2559
+ const recovered = device ? this.waitDevice() : true;
2560
+ transient.set(ident, (transient.get(ident) ?? 0) + 1);
2561
+ const retrying = recovered && transient.get(ident) <= toInt(get(this.config, 'max_device_retries', 1));
2562
+ this.emit('task_result', { task_id: ident, outcome: device ? 'device-error' : 'failed', stage: 'target',
2563
+ reason: cpSlice(msg, 0, 200), transient: true, ...(retrying ? { retrying: true } : {}), target_static: task.target_static });
2564
+ if (retrying) { return 'retry'; }
2565
+ return recovered ? undefined : DEVICE_UNAVAILABLE;
2566
+ }
2567
+ this.emit('task_result', { task_id: ident, outcome: 'failed', stage: 'target', reason: msg,
2568
+ target_static: task.target_static, observation_id: get(or(this.current, {}), 'observation_id') });
2569
+ return undefined;
2570
+ }
2571
+ const confirmed = this.at(task.target_static);
2572
+ if (confirmed) { done.add(ident); }
2573
+ this.emit('task_result', { task_id: ident, outcome: confirmed ? 'confirmed' : 'target-unverified',
2574
+ purpose: 'route-launch', target_static: task.target_static, observation_id: this.current.observation_id });
2575
+ if (confirmed) { this.sweep(task.target_static); }
2576
+ return undefined;
2577
+ }
2578
+
2579
+ /** Why a route task cannot run in this phase (capture disabled / route down), else null. */
2580
+ routeUnavailable() {
2581
+ if (get(this.config, 'hybrid_route_capture', true) === false) { return 'hybrid-route-capture disabled'; }
2582
+ if (this._hybridRouteDown) { return 'hybrid-route unavailable earlier in this phase: ' + this._hybridRouteDown; }
2583
+ return null;
2584
+ }
2585
+
1910
2586
  _runTask(task, ident, done) {
1911
2587
  this.stage = 'source';
1912
2588
  this.source(task);