@buaa_smat/hometrans 26.0.2 → 26.0.4-devecocli.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1496) hide show
  1. package/agents/code-reviewer.md +111 -154
  2. package/devecocli-plugin/common.ts +2271 -0
  3. package/devecocli-plugin/content-resolver.ts +363 -0
  4. package/devecocli-plugin/install.ts +72 -0
  5. package/devecocli-plugin/uninstall.ts +26 -0
  6. package/devecocli-plugin/update.ts +77 -0
  7. package/i18n/FILE-NAMES.md +9 -0
  8. package/i18n/agents/code-reviewer.md +436 -0
  9. package/i18n/agents/model-render-worker.md +38 -0
  10. package/i18n/agents/specgen-worker.md +18 -0
  11. package/i18n/commands/hometrans.md +17 -0
  12. package/i18n/skills/a2h-app-migrate/SKILL.md +206 -0
  13. package/i18n/skills/a2h-app-migrate/references/config.example.json +28 -0
  14. package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -0
  15. package/i18n/skills/a2h-app-migrate/references/specs.example.json +19 -0
  16. package/i18n/skills/a2h-app-migrate/references/stage-map.md +50 -0
  17. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +2007 -0
  18. package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +187 -0
  19. package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1656 -0
  20. package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +728 -0
  21. package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +541 -0
  22. package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +143 -0
  23. package/i18n/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
  24. package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
  25. package/i18n/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
  26. package/i18n/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
  27. package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +713 -0
  28. package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +117 -0
  29. package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
  30. package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
  31. package/i18n/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
  32. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +271 -0
  33. package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +222 -0
  34. package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +136 -0
  35. package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +552 -0
  36. package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
  37. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +263 -0
  38. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +165 -0
  39. package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
  40. package/i18n/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
  41. package/i18n/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
  42. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +207 -0
  43. package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
  44. package/i18n/skills/a2h-arch-generate/SKILL.md +378 -0
  45. package/i18n/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
  46. package/i18n/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
  47. package/i18n/skills/a2h-arch-generate/references/arkts-mvvm-v2.md +1407 -0
  48. package/i18n/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
  49. package/i18n/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
  50. package/i18n/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
  51. package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
  52. package/i18n/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
  53. package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
  54. package/i18n/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
  55. package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +131 -0
  56. package/i18n/skills/a2h-arch-generate/references/source-baseline.md +93 -0
  57. package/i18n/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +360 -0
  58. package/i18n/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +798 -0
  59. package/i18n/skills/a2h-arch-generate/scripts/lib/contract_terms.mjs +40 -0
  60. package/i18n/skills/a2h-arch-generate/scripts/module_create/generate.mjs +639 -0
  61. package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
  62. package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
  63. package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
  64. package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
  65. package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
  66. package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
  67. package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1261 -0
  68. package/i18n/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
  69. package/i18n/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +851 -0
  70. package/i18n/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +982 -0
  71. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +304 -0
  72. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +10 -0
  73. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +249 -0
  74. package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +344 -0
  75. package/i18n/skills/a2h-arkts-logic-coder/scripts/design/move_spec_technical_reference.mjs +162 -0
  76. package/i18n/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +298 -0
  77. package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +877 -0
  78. package/i18n/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
  79. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
  80. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
  81. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
  82. package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
  83. package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
  84. package/i18n/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
  85. package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +597 -0
  86. package/i18n/skills/a2h-batch-ui-align/SKILL.md +372 -0
  87. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +35 -0
  88. package/i18n/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
  89. package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
  90. package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
  91. package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +85 -0
  92. package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +23 -0
  93. package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +89 -0
  94. package/i18n/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
  95. package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
  96. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +62 -0
  97. package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +30 -0
  98. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +930 -0
  99. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +420 -0
  100. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +158 -0
  101. package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
  102. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2552 -0
  103. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +560 -0
  104. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +175 -0
  105. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +251 -0
  106. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +28 -0
  107. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +232 -0
  108. package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +206 -0
  109. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +232 -0
  110. package/i18n/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +2005 -0
  111. package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
  112. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +2118 -0
  113. package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
  114. package/i18n/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +245 -0
  115. package/i18n/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
  116. package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1805 -0
  117. package/i18n/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
  118. package/i18n/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
  119. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1959 -0
  120. package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
  121. package/i18n/skills/a2h-batch-ui-align/scripts/image_probe.mjs +405 -0
  122. package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1632 -0
  123. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1300 -0
  124. package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1234 -0
  125. package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +417 -0
  126. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
  127. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +18 -0
  128. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +216 -0
  129. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +615 -0
  130. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
  131. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +49 -0
  132. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
  133. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
  134. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
  135. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +136 -0
  136. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
  137. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +109 -0
  138. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
  139. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
  140. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
  141. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
  142. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
  143. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
  144. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
  145. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
  146. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
  147. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
  148. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
  149. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
  150. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
  151. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
  152. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +780 -0
  153. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
  154. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
  155. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +408 -0
  156. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
  157. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
  158. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
  159. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
  160. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +179 -0
  161. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
  162. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
  163. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +81 -0
  164. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +137 -0
  165. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
  166. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
  167. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
  168. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
  169. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +147 -0
  170. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
  171. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
  172. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +127 -0
  173. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
  174. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
  175. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
  176. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
  177. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
  178. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
  179. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
  180. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
  181. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
  182. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
  183. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
  184. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +184 -0
  185. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
  186. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
  187. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
  188. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +67 -0
  189. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
  190. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
  191. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
  192. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
  193. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
  194. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +651 -0
  195. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
  196. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
  197. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
  198. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
  199. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
  200. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
  201. package/i18n/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
  202. package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +693 -0
  203. package/i18n/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +245 -0
  204. package/i18n/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
  205. package/i18n/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
  206. package/i18n/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
  207. package/i18n/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
  208. package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +326 -0
  209. package/i18n/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
  210. package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +356 -0
  211. package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +60 -0
  212. package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +395 -0
  213. package/i18n/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
  214. package/i18n/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
  215. package/i18n/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +470 -0
  216. package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +62 -0
  217. package/i18n/skills/a2h-dashboard-render/SKILL.md +73 -0
  218. package/i18n/skills/a2h-dashboard-render/references/artifact-contract.jsonc +117 -0
  219. package/i18n/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
  220. package/i18n/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
  221. package/i18n/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
  222. package/i18n/skills/a2h-dashboard-render/scripts/dashboard.mjs +3245 -0
  223. package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +2050 -0
  224. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
  225. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
  226. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
  227. package/i18n/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
  228. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
  229. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
  230. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +154 -0
  231. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
  232. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
  233. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
  234. package/i18n/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
  235. package/i18n/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
  236. package/i18n/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
  237. package/i18n/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
  238. package/i18n/skills/a2h-fix-build-errors/SKILL.md +304 -0
  239. package/i18n/skills/a2h-fix-build-errors/references/arkts-strict-patterns.md +219 -0
  240. package/i18n/skills/a2h-fix-build-errors/references/rdb-entity-pattern.md +131 -0
  241. package/i18n/skills/a2h-module-semantic-docs/SKILL.md +265 -0
  242. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
  243. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
  244. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
  245. package/i18n/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
  246. package/i18n/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
  247. package/i18n/skills/a2h-page-specgen/SKILL.md +239 -0
  248. package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
  249. package/i18n/skills/a2h-page-specgen/references/body-language.md +179 -0
  250. package/i18n/skills/a2h-page-specgen/references/gates.md +329 -0
  251. package/i18n/skills/a2h-page-specgen/references/page-inventory.md +220 -0
  252. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
  253. package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
  254. package/i18n/skills/a2h-page-specgen/references/spec-template.md +210 -0
  255. package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
  256. package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
  257. package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
  258. package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
  259. package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
  260. package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +1613 -0
  261. package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +1650 -0
  262. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +864 -0
  263. package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +346 -0
  264. package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
  265. package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +155 -0
  266. package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
  267. package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +684 -0
  268. package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
  269. package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
  270. package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
  271. package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +252 -0
  272. package/i18n/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
  273. package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
  274. package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
  275. package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
  276. package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +864 -0
  277. package/i18n/skills/a2h-page-specgen/scripts/render.mjs +276 -0
  278. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +897 -0
  279. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
  280. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
  281. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
  282. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
  283. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
  284. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
  285. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
  286. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
  287. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
  288. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
  289. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
  290. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
  291. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
  292. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
  293. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
  294. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
  295. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
  296. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
  297. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
  298. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
  299. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
  300. package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
  301. package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
  302. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
  303. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
  304. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
  305. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
  306. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
  307. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
  308. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
  309. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
  310. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
  311. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
  312. package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +205 -0
  313. package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
  314. package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1205 -0
  315. package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +271 -0
  316. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +8 -0
  317. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +7 -0
  318. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +8 -0
  319. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
  320. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
  321. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
  322. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
  323. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
  324. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
  325. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
  326. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
  327. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
  328. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
  329. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
  330. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
  331. package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +1029 -0
  332. package/i18n/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
  333. package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +143 -0
  334. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +1121 -0
  335. package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
  336. package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +188 -0
  337. package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +549 -0
  338. package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
  339. package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
  340. package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +368 -0
  341. package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +348 -0
  342. package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +250 -0
  343. package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +776 -0
  344. package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
  345. package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1103 -0
  346. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
  347. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
  348. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
  349. package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +240 -0
  350. package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +427 -0
  351. package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
  352. package/i18n/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
  353. package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +418 -0
  354. package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1782 -0
  355. package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +536 -0
  356. package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
  357. package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
  358. package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +1239 -0
  359. package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
  360. package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
  361. package/i18n/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
  362. package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1801 -0
  363. package/i18n/skills/a2h-resource-convert/SKILL.md +375 -0
  364. package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +336 -0
  365. package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +272 -0
  366. package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +226 -0
  367. package/i18n/skills/a2h-resource-convert/references/resource-mapping-rules.md +493 -0
  368. package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +251 -0
  369. package/i18n/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
  370. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +2596 -0
  371. package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
  372. package/i18n/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
  373. package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
  374. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +238 -0
  375. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +358 -0
  376. package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
  377. package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
  378. package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +266 -0
  379. package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
  380. package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
  381. package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +55 -0
  382. package/i18n/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
  383. package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
  384. package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +752 -0
  385. package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +661 -0
  386. package/i18n/skills/a2h-spec-generate/SKILL.md +375 -0
  387. package/i18n/skills/a2h-spec-generate/references/batch-mode.md +215 -0
  388. package/i18n/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
  389. package/i18n/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
  390. package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +184 -0
  391. package/i18n/skills/a2h-spec-generate/references/input-formats.md +27 -0
  392. package/i18n/skills/a2h-spec-generate/references/library-evidence.md +3 -0
  393. package/i18n/skills/a2h-spec-generate/references/method-discipline.md +64 -0
  394. package/i18n/skills/a2h-spec-generate/references/optional-gates.json +45 -0
  395. package/i18n/skills/a2h-spec-generate/references/recall-guide.md +84 -0
  396. package/i18n/skills/a2h-spec-generate/references/recall-terse.md +3 -0
  397. package/i18n/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
  398. package/i18n/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
  399. package/i18n/skills/a2h-spec-generate/references/review-checklist.md +22 -0
  400. package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
  401. package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
  402. package/i18n/skills/a2h-spec-generate/references/spec-samples.md +65 -0
  403. package/i18n/skills/a2h-spec-generate/references/specs.schema.json +85 -0
  404. package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +145 -0
  405. package/i18n/skills/a2h-spec-generate/references/transfer-file.md +5 -0
  406. package/i18n/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
  407. package/i18n/skills/a2h-spec-generate/references/worker-rules.md +129 -0
  408. package/i18n/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +702 -0
  409. package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +515 -0
  410. package/i18n/skills/a2h-spec-generate/scripts/collect-specs.mjs +727 -0
  411. package/i18n/skills/a2h-spec-generate/scripts/feature-stem.mjs +151 -0
  412. package/i18n/skills/a2h-spec-generate/scripts/parse_requirements.ts +515 -0
  413. package/i18n/skills/a2h-spec-generate/scripts/prepare-facts.mjs +313 -0
  414. package/i18n/skills/a2h-spec-generate/scripts/publish-specs.mjs +354 -0
  415. package/i18n/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +669 -0
  416. package/i18n/skills/a2h-spec-generate/scripts/render-tasks.mjs +385 -0
  417. package/i18n/skills/a2h-spec-generate/scripts/report.mjs +136 -0
  418. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
  419. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
  420. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
  421. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
  422. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1265 -0
  423. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1057 -0
  424. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +565 -0
  425. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +544 -0
  426. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
  427. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +317 -0
  428. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +707 -0
  429. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +436 -0
  430. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +608 -0
  431. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +650 -0
  432. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +178 -0
  433. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
  434. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +912 -0
  435. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +279 -0
  436. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +163 -0
  437. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
  438. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +256 -0
  439. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
  440. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
  441. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
  442. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
  443. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
  444. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
  445. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +340 -0
  446. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1857 -0
  447. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +262 -0
  448. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +722 -0
  449. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
  450. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
  451. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
  452. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
  453. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
  454. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
  455. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
  456. package/i18n/skills/a2h-spec-generate/template/REQ.txt +22 -0
  457. package/i18n/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
  458. package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +847 -0
  459. package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +415 -0
  460. package/i18n/skills/a2h-spec-generate/test/collect-specs.test.mjs +808 -0
  461. package/i18n/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
  462. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
  463. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
  464. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
  465. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
  466. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
  467. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
  468. package/i18n/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
  469. package/i18n/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
  470. package/i18n/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
  471. package/i18n/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
  472. package/i18n/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
  473. package/i18n/skills/a2h-spec-generate/test/report.test.mjs +47 -0
  474. package/i18n/skills/a2h-utg-explorer/SKILL.md +126 -0
  475. package/i18n/skills/a2h-utg-explorer/references/architecture.md +282 -0
  476. package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +908 -0
  477. package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +446 -0
  478. package/i18n/skills/a2h-utg-explorer/scripts/hint_check.mjs +147 -0
  479. package/i18n/skills/a2h-utg-explorer/scripts/hint_source.mjs +119 -0
  480. package/i18n/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
  481. package/i18n/skills/a2h-utg-explorer/scripts/recover_b.mjs +550 -0
  482. package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +647 -0
  483. package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
  484. package/i18n/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
  485. package/i18n/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
  486. package/i18n/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
  487. package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +252 -0
  488. package/i18n/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
  489. package/i18n/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
  490. package/i18n/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
  491. package/i18n/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
  492. package/i18n/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
  493. package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +614 -0
  494. package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +214 -0
  495. package/i18n/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
  496. package/i18n/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
  497. package/i18n/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
  498. package/i18n/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
  499. package/i18n/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
  500. package/i18n/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
  501. package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
  502. package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
  503. package/i18n/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
  504. package/i18n/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
  505. package/i18n/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
  506. package/i18n/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
  507. package/i18n/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
  508. package/i18n/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
  509. package/i18n/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
  510. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
  511. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
  512. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1562 -0
  513. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
  514. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +2714 -0
  515. package/i18n/skills/a2h-utg-static/SKILL.md +372 -0
  516. package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
  517. package/i18n/skills/a2h-utg-static/references/view-interactions.md +215 -0
  518. package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +2190 -0
  519. package/i18n/skills/a2h-utg-static/scripts/audit.mjs +268 -0
  520. package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +720 -0
  521. package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +250 -0
  522. package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +374 -0
  523. package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
  524. package/i18n/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
  525. package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
  526. package/i18n/skills/a2h-utg-static/scripts/fragment_nav.mjs +1137 -0
  527. package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +705 -0
  528. package/i18n/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
  529. package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +958 -0
  530. package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
  531. package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
  532. package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +545 -0
  533. package/i18n/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
  534. package/i18n/skills/a2h-utg-static/scripts/static_prior.mjs +956 -0
  535. package/i18n/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
  536. package/i18n/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
  537. package/i18n/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
  538. package/i18n/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
  539. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +125 -0
  540. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +289 -0
  541. package/i18n/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
  542. package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -0
  543. package/i18n/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
  544. package/i18n/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
  545. package/i18n/skills/a2h-utg-static/scripts/tests/test_fresh_branch_guard.mjs +49 -0
  546. package/i18n/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +136 -0
  547. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
  548. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
  549. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
  550. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +457 -0
  551. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
  552. package/i18n/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
  553. package/i18n/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
  554. package/i18n/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
  555. package/i18n/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +368 -0
  556. package/i18n/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
  557. package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +78 -0
  558. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
  559. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
  560. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_off_path.mjs +67 -0
  561. package/i18n/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
  562. package/i18n/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
  563. package/i18n/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
  564. package/i18n/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
  565. package/i18n/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
  566. package/i18n/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
  567. package/i18n/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +61 -0
  568. package/i18n/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
  569. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_data_table.mjs +340 -0
  570. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_relative_url.mjs +125 -0
  571. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
  572. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +330 -0
  573. package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
  574. package/i18n/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +340 -0
  575. package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1394 -0
  576. package/i18n/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
  577. package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
  578. package/index.js +1643 -0
  579. package/package.json +18 -168
  580. package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
  581. package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
  582. package/plugin.jsonc +12 -0
  583. package/skills/a2h-app-migrate/SKILL.md +31 -12
  584. package/skills/a2h-app-migrate/references/config.example.json +1 -0
  585. package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
  586. package/skills/a2h-app-migrate/references/stage-map.md +4 -2
  587. package/skills/a2h-app-migrate/references/workflow.yaml +427 -103
  588. package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
  589. package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
  590. package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -6
  591. package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
  592. package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
  593. package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
  594. package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
  595. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +178 -44
  596. package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
  597. package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +81 -11
  598. package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
  599. package/skills/a2h-app-migrate/scripts/ledger.mjs +80 -10
  600. package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
  601. package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
  602. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +72 -12
  603. package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
  604. package/skills/a2h-app-migrate/scripts/run_dir.mjs +137 -41
  605. package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
  606. package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
  607. package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
  608. package/skills/a2h-app-migrate/scripts/spec_layout.mjs +2 -0
  609. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +38 -0
  610. package/skills/a2h-app-migrate/test/test_android_index.mjs +143 -0
  611. package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
  612. package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
  613. package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
  614. package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
  615. package/skills/a2h-app-migrate/test/test_devecocli_docs_preflight.mjs +32 -0
  616. package/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
  617. package/skills/a2h-app-migrate/test/test_entry_guards.mjs +102 -0
  618. package/skills/a2h-app-migrate/test/test_env_requirements.mjs +713 -0
  619. package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
  620. package/skills/a2h-app-migrate/test/test_finalize.mjs +117 -0
  621. package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
  622. package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
  623. package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +51 -0
  624. package/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
  625. package/skills/a2h-app-migrate/test/test_incremental_acceptance.mjs +145 -0
  626. package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
  627. package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
  628. package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
  629. package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +101 -0
  630. package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
  631. package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
  632. package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +150 -0
  633. package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
  634. package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +86 -0
  635. package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
  636. package/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
  637. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +271 -0
  638. package/skills/a2h-app-migrate/test/test_resume_summary.mjs +222 -0
  639. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +136 -0
  640. package/skills/a2h-app-migrate/test/test_run_dir.mjs +552 -0
  641. package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -0
  642. package/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
  643. package/skills/a2h-app-migrate/test/test_spec_engine_acceptance.mjs +94 -0
  644. package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +155 -0
  645. package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +263 -0
  646. package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +165 -0
  647. package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +511 -0
  648. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
  649. package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
  650. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +65 -0
  651. package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
  652. package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +83 -0
  653. package/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
  654. package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +41 -0
  655. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +214 -0
  656. package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
  657. package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
  658. package/skills/a2h-arch-generate/SKILL.md +20 -17
  659. package/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
  660. package/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
  661. package/skills/a2h-arch-generate/references/homegraph-workflow.md +25 -14
  662. package/skills/a2h-arch-generate/references/module-evidence-subagent.md +2 -2
  663. package/skills/a2h-arch-generate/references/source-baseline.md +4 -4
  664. package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
  665. package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
  666. package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +35 -46
  667. package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
  668. package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +33 -40
  669. package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +2 -3
  670. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
  671. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
  672. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
  673. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
  674. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
  675. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
  676. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
  677. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
  678. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
  679. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
  680. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
  681. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
  682. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
  683. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
  684. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
  685. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
  686. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
  687. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
  688. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
  689. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
  690. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
  691. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
  692. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
  693. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
  694. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
  695. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
  696. package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
  697. package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1260 -0
  698. package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +208 -0
  699. package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
  700. package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
  701. package/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
  702. package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +164 -0
  703. package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +2 -5
  704. package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
  705. package/skills/a2h-arkts-logic-coder/SKILL.md +163 -15
  706. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +3 -1
  707. package/skills/a2h-arkts-logic-coder/references/code-generation.md +120 -1
  708. package/skills/a2h-arkts-logic-coder/references/spec-design.md +46 -11
  709. package/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +22 -25
  710. package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +873 -0
  711. package/skills/a2h-arkts-logic-coder/test/golden/inspect_happy.json +20 -0
  712. package/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
  713. package/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
  714. package/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
  715. package/skills/a2h-arkts-logic-coder/test/golden/resolve_cases.json +36 -0
  716. package/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
  717. package/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
  718. package/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
  719. package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +596 -0
  720. package/skills/a2h-batch-ui-align/SKILL.md +78 -26
  721. package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
  722. package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
  723. package/skills/a2h-batch-ui-align/references/cards/geometry.md +6 -1
  724. package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
  725. package/skills/a2h-batch-ui-align/references/cards/resources.md +9 -3
  726. package/skills/a2h-batch-ui-align/references/cards/widgets.md +27 -3
  727. package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
  728. package/skills/a2h-batch-ui-align/references/checker-rules.md +301 -13
  729. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +53 -13
  730. package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
  731. package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
  732. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +14 -9
  733. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +2 -2
  734. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
  735. 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
  736. package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
  737. package/skills/a2h-batch-ui-align/references/step4-prepare.md +7 -2
  738. package/skills/a2h-batch-ui-align/references/step5-convert.md +33 -9
  739. package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +6 -7
  740. package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
  741. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +463 -22
  742. package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
  743. package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
  744. package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
  745. package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
  746. package/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
  747. package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +263 -0
  748. package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +20 -3
  749. package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +4 -5
  750. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +220 -35
  751. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +517 -41
  752. package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
  753. package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +231 -54
  754. package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
  755. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +239 -14
  756. package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
  757. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +98 -11
  758. package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
  759. package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
  760. package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +118 -4
  761. package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
  762. package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
  763. package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +231 -0
  764. package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
  765. package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +1 -5
  766. package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
  767. package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
  768. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +61 -12
  769. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +32 -0
  770. package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
  771. package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +3 -3
  772. package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
  773. package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +2 -2
  774. package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +84 -19
  775. package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +11 -4
  776. package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +2 -2
  777. package/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
  778. package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
  779. package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
  780. package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +5 -5
  781. package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
  782. package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
  783. package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
  784. package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
  785. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
  786. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +2 -2
  787. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +110 -12
  788. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
  789. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
  790. package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +179 -0
  791. package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
  792. package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +81 -8
  793. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
  794. package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
  795. package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
  796. package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
  797. package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
  798. package/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
  799. package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +184 -0
  800. package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
  801. package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
  802. package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +2 -3
  803. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +30 -2
  804. package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +231 -0
  805. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
  806. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +312 -0
  807. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_baseline.test.mjs +129 -0
  808. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
  809. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
  810. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +312 -0
  811. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_runtime2.test.mjs +697 -0
  812. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
  813. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +298 -0
  814. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
  815. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +651 -0
  816. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
  817. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
  818. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
  819. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +269 -0
  820. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
  821. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +346 -0
  822. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
  823. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_safearea.test.mjs +742 -0
  824. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +91 -0
  825. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +86 -0
  826. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme_runtime.test.mjs +95 -0
  827. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
  828. package/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
  829. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +693 -0
  830. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +291 -0
  831. package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
  832. package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
  833. package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
  834. package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
  835. package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +93 -0
  836. package/skills/a2h-batch-ui-align/scripts/tests/detect_paradigm.test.mjs +260 -0
  837. package/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +244 -0
  838. package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +435 -0
  839. package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +31 -0
  840. package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
  841. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
  842. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
  843. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
  844. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -0
  845. package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
  846. package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
  847. package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
  848. package/skills/a2h-batch-ui-align/scripts/tests/group_pack_evidence.test.mjs +95 -0
  849. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1782 -0
  850. package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
  851. package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
  852. package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
  853. package/skills/a2h-batch-ui-align/scripts/tests/icon_coverage.test.mjs +314 -0
  854. package/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
  855. package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
  856. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +326 -0
  857. package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
  858. package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
  859. package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +356 -0
  860. package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
  861. package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +302 -0
  862. package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
  863. package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +60 -0
  864. package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +395 -0
  865. package/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
  866. package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
  867. package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
  868. package/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
  869. package/skills/a2h-dashboard-render/scripts/dashboard.mjs +12 -14
  870. package/skills/a2h-dashboard-render/scripts/device_capture.mjs +29 -30
  871. package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
  872. package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
  873. package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
  874. package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
  875. package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
  876. package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
  877. package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
  878. package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
  879. package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
  880. package/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +203 -0
  881. package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
  882. package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
  883. package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
  884. package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
  885. package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
  886. package/skills/a2h-dashboard-render/test/test_device_locale_dialogs.mjs +17 -0
  887. package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
  888. package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
  889. package/skills/a2h-module-semantic-docs/SKILL.md +51 -13
  890. package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
  891. package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
  892. package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
  893. package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
  894. package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
  895. package/skills/a2h-module-semantic-docs/test/test_incremental_fingerprint.mjs +94 -0
  896. package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
  897. package/skills/a2h-page-specgen/SKILL.md +240 -0
  898. package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
  899. package/skills/a2h-page-specgen/references/body-language.md +179 -0
  900. package/skills/a2h-page-specgen/references/evidence.md +105 -0
  901. package/skills/a2h-page-specgen/references/execution-model.md +364 -0
  902. package/skills/a2h-page-specgen/references/footprint-and-grouping.md +255 -0
  903. package/skills/a2h-page-specgen/references/gates.md +323 -0
  904. package/skills/a2h-page-specgen/references/page-inventory.md +220 -0
  905. package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
  906. package/skills/a2h-page-specgen/references/spec-example.md +312 -0
  907. package/skills/a2h-page-specgen/references/spec-template.md +210 -0
  908. package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
  909. package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
  910. package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
  911. package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
  912. package/skills/a2h-page-specgen/scripts/dispatch.mjs +212 -0
  913. package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
  914. package/skills/a2h-page-specgen/scripts/facts-build.mjs +1613 -0
  915. package/skills/a2h-page-specgen/scripts/finalize.mjs +825 -0
  916. package/skills/a2h-page-specgen/scripts/footprint.mjs +1650 -0
  917. package/skills/a2h-page-specgen/scripts/gate.mjs +848 -0
  918. package/skills/a2h-page-specgen/scripts/interactions.mjs +344 -0
  919. package/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
  920. package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +155 -0
  921. package/skills/a2h-page-specgen/scripts/lib/deps-source.mjs +399 -0
  922. package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +229 -0
  923. package/skills/a2h-page-specgen/scripts/lib/footprint-roles.mjs +278 -0
  924. package/skills/a2h-page-specgen/scripts/lib/fsx.mjs +79 -0
  925. package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
  926. package/skills/a2h-page-specgen/scripts/lib/hg.mjs +683 -0
  927. package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
  928. package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
  929. package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +478 -0
  930. package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
  931. package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
  932. package/skills/a2h-page-specgen/scripts/lib/prose.mjs +238 -0
  933. package/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
  934. package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
  935. package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
  936. package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
  937. package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
  938. package/skills/a2h-page-specgen/scripts/lib/symbols.mjs +125 -0
  939. package/skills/a2h-page-specgen/scripts/lib/utg-io.mjs +110 -0
  940. package/skills/a2h-page-specgen/scripts/lib/waker-event-store.mjs +658 -0
  941. package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
  942. package/skills/a2h-page-specgen/scripts/prepare.mjs +840 -0
  943. package/skills/a2h-page-specgen/scripts/render.mjs +294 -0
  944. package/skills/a2h-page-specgen/scripts/report.mjs +340 -0
  945. package/skills/a2h-page-specgen/scripts/submission.mjs +697 -0
  946. package/skills/a2h-page-specgen/scripts/submit.mjs +85 -0
  947. package/skills/a2h-page-specgen/scripts/test/acceptance/README.md +77 -0
  948. package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +871 -0
  949. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
  950. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
  951. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
  952. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
  953. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
  954. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
  955. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
  956. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
  957. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
  958. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
  959. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
  960. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
  961. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
  962. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
  963. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
  964. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
  965. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
  966. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
  967. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
  968. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
  969. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
  970. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
  971. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
  972. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
  973. package/skills/a2h-page-specgen/scripts/test/acceptance/cases.example.json +57 -0
  974. package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
  975. package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
  976. package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
  977. package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
  978. package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
  979. package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
  980. package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
  981. package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
  982. package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
  983. package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
  984. package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
  985. package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
  986. package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +205 -0
  987. package/skills/a2h-page-specgen/scripts/test/dispatch.test.mjs +258 -0
  988. package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
  989. package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1203 -0
  990. package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +243 -0
  991. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Api.kt +20 -0
  992. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/BothAnnotations.kt +28 -0
  993. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Cache.kt +7 -0
  994. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Comments.kt +26 -0
  995. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Mmkv.kt +7 -0
  996. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Models.kt +19 -0
  997. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Pair.kt +7 -0
  998. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Prefs.kt +9 -0
  999. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Room.kt +11 -0
  1000. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Sample.kt +43 -0
  1001. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Templates.kt +34 -0
  1002. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Timeouts.kt +8 -0
  1003. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/androidTest/Helper.kt +5 -0
  1004. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/build.gradle.kts +16 -0
  1005. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/en.js.txt +5 -0
  1006. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +4 -0
  1007. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/libs.versions.toml +14 -0
  1008. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/package.json +10 -0
  1009. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values/strings.xml +10 -0
  1010. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +4 -0
  1011. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-land/strings.xml +5 -0
  1012. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-night/strings.xml +5 -0
  1013. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-v21/strings.xml +4 -0
  1014. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +4 -0
  1015. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/test/Legacy.kt +4 -0
  1016. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/weather.proto +11 -0
  1017. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/AppPreferences.kt +13 -0
  1018. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/SettingsViewModel.kt +16 -0
  1019. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-dao/src/UserDao.kt +28 -0
  1020. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/base/strings.xml +6 -0
  1021. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/fil/strings.xml +6 -0
  1022. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/arrays.xml +25 -0
  1023. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/strings.xml +10 -0
  1024. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/xml/prefs.xml +27 -0
  1025. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Api.java +19 -0
  1026. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Datastore.kt +12 -0
  1027. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Settings.java +13 -0
  1028. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/forecast.js +14 -0
  1029. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/store.js +14 -0
  1030. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/BasePreferences.kt +13 -0
  1031. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/Screen.kt +14 -0
  1032. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/UiPreferences.kt +8 -0
  1033. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-retrofit/src/AuthAPI.kt +26 -0
  1034. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/AndroidManifest.xml +20 -0
  1035. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/feature/auth/navigation/ScreenRoute.kt +8 -0
  1036. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/pages.json +19 -0
  1037. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/components/Widget.vue +11 -0
  1038. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/detail/detail.vue +14 -0
  1039. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/index/index.vue +24 -0
  1040. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/store/userStore.js +11 -0
  1041. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/uni_modules/uview-ui/components/u-thing.js +5 -0
  1042. package/skills/a2h-page-specgen/scripts/test/fixtures/fp.mkdb.mjs +144 -0
  1043. package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +112 -0
  1044. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
  1045. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
  1046. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
  1047. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
  1048. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
  1049. package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
  1050. package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
  1051. package/skills/a2h-page-specgen/scripts/test/fixtures/src/MainFragment.java +6 -0
  1052. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -0
  1053. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyListeners.java +12 -0
  1054. package/skills/a2h-page-specgen/scripts/test/fixtures/src/PlainActivity.java +3 -0
  1055. package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshOnResume.java +7 -0
  1056. package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
  1057. package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
  1058. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
  1059. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
  1060. package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
  1061. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
  1062. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
  1063. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
  1064. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
  1065. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
  1066. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
  1067. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
  1068. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
  1069. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
  1070. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
  1071. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
  1072. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
  1073. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/fold-chain/utg.json +12 -0
  1074. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/utg.json +34 -0
  1075. package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +1029 -0
  1076. package/skills/a2h-page-specgen/scripts/test/footprint-roles.test.mjs +172 -0
  1077. package/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
  1078. package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +143 -0
  1079. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +1078 -0
  1080. package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
  1081. package/skills/a2h-page-specgen/scripts/test/helpers.mjs +188 -0
  1082. package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +549 -0
  1083. package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
  1084. package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
  1085. package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +368 -0
  1086. package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +310 -0
  1087. package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +250 -0
  1088. package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +776 -0
  1089. package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
  1090. package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +464 -0
  1091. package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
  1092. package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
  1093. package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1103 -0
  1094. package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
  1095. package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
  1096. package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +160 -0
  1097. package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
  1098. package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +236 -0
  1099. package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +398 -0
  1100. package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
  1101. package/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
  1102. package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +418 -0
  1103. package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
  1104. package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1782 -0
  1105. package/skills/a2h-page-specgen/scripts/test/render.test.mjs +546 -0
  1106. package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
  1107. package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
  1108. package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
  1109. package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
  1110. package/skills/a2h-page-specgen/scripts/test/source-text.test.mjs +181 -0
  1111. package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +1231 -0
  1112. package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
  1113. package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
  1114. package/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
  1115. package/skills/a2h-page-specgen/scripts/test/waker-event-store.test.mjs +1365 -0
  1116. package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1801 -0
  1117. package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +1993 -0
  1118. package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +342 -0
  1119. package/skills/a2h-page-specgen/scripts/waker.mjs +1301 -0
  1120. package/skills/a2h-page-specgen/scripts/watchdog.mjs +299 -0
  1121. package/skills/a2h-resource-convert/SKILL.md +9 -1
  1122. package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
  1123. package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
  1124. package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
  1125. package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
  1126. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +115 -53
  1127. package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
  1128. package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
  1129. package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
  1130. package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
  1131. package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
  1132. package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
  1133. package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
  1134. package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
  1135. package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
  1136. package/skills/a2h-resource-convert/scripts/tests/code_vector_guard.test.mjs +75 -0
  1137. package/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
  1138. package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
  1139. package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
  1140. package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
  1141. package/skills/a2h-spec-design-pipeline/SKILL.md +98 -121
  1142. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +170 -45
  1143. package/skills/a2h-spec-design-pipeline/references/execution-model.md +62 -12
  1144. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -4
  1145. package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
  1146. package/skills/a2h-spec-design-pipeline/references/initialization.md +49 -6
  1147. package/skills/a2h-spec-design-pipeline/references/merge-queue.md +198 -54
  1148. package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
  1149. package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
  1150. package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +67 -0
  1151. package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
  1152. package/skills/a2h-spec-design-pipeline/references/scripts.md +47 -14
  1153. package/skills/a2h-spec-design-pipeline/references/shared-layer.md +390 -0
  1154. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +148 -29
  1155. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +104 -24
  1156. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +18 -0
  1157. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +16 -0
  1158. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
  1159. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
  1160. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
  1161. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
  1162. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
  1163. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
  1164. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
  1165. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
  1166. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
  1167. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
  1168. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
  1169. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
  1170. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/platform/ExtraDataSubCheck.js +485 -0
  1171. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +13 -0
  1172. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +18 -0
  1173. package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +12 -38
  1174. package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
  1175. package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
  1176. package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
  1177. package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +95 -7
  1178. package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +156 -7
  1179. package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +71 -0
  1180. package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +22 -3
  1181. package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
  1182. package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +33 -3
  1183. package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +2 -2
  1184. package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +232 -13
  1185. package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
  1186. package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
  1187. package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +220 -44
  1188. package/skills/a2h-spec-design-pipeline/scripts/lib/shared_classes.ts +113 -0
  1189. package/skills/a2h-spec-design-pipeline/scripts/lib/shared_docs.ts +202 -0
  1190. package/skills/a2h-spec-design-pipeline/scripts/lib/wiring.ts +58 -0
  1191. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +178 -14
  1192. package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +3 -0
  1193. package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +368 -0
  1194. package/skills/a2h-spec-design-pipeline/scripts/scan_shared.ts +642 -0
  1195. package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
  1196. package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
  1197. package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
  1198. package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
  1199. package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
  1200. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +42 -8
  1201. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +27 -9
  1202. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +242 -9
  1203. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +192 -7
  1204. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +531 -0
  1205. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +49 -1
  1206. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
  1207. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +51 -0
  1208. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
  1209. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
  1210. package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +17 -10
  1211. package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
  1212. package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
  1213. package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
  1214. package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
  1215. package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +14 -0
  1216. package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +401 -0
  1217. package/skills/a2h-spec-design-pipeline/scripts/test_scan_shared.ts +996 -0
  1218. package/skills/a2h-spec-design-pipeline/scripts/test_shared_classes.ts +80 -0
  1219. package/skills/a2h-spec-design-pipeline/scripts/test_shared_docs.ts +205 -0
  1220. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +165 -0
  1221. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_e2e.ts +85 -0
  1222. package/skills/a2h-spec-design-pipeline/scripts/test_validate_shared_manifest.ts +720 -0
  1223. package/skills/a2h-spec-design-pipeline/scripts/test_wiring.ts +40 -0
  1224. package/skills/a2h-spec-design-pipeline/scripts/validate_shared_manifest.ts +566 -0
  1225. package/skills/a2h-spec-generate/SKILL.md +89 -23
  1226. package/skills/a2h-spec-generate/references/batch-mode.md +78 -17
  1227. package/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
  1228. package/skills/a2h-spec-generate/references/fusion-task-contract.md +7 -0
  1229. package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  1230. package/skills/a2h-spec-generate/references/specs.schema.json +24 -11
  1231. package/skills/a2h-spec-generate/references/synthesis-rules.md +4 -2
  1232. package/skills/a2h-spec-generate/references/worker-rules.md +6 -3
  1233. package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +4 -5
  1234. package/skills/a2h-spec-generate/scripts/check_spec.ts +145 -14
  1235. package/skills/a2h-spec-generate/scripts/collect-specs.mjs +261 -19
  1236. package/skills/a2h-spec-generate/scripts/dispatch-watch.mjs +1168 -0
  1237. package/skills/a2h-spec-generate/scripts/ensure-index.mjs +1 -2
  1238. package/skills/a2h-spec-generate/scripts/feature-stem.mjs +1 -2
  1239. package/skills/a2h-spec-generate/scripts/publish-specs.mjs +1 -2
  1240. package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +1 -2
  1241. package/skills/a2h-spec-generate/scripts/render-tasks.mjs +25 -46
  1242. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +26 -27
  1243. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +3 -6
  1244. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +31 -32
  1245. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +2 -3
  1246. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +15 -26
  1247. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +102 -81
  1248. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +39 -19
  1249. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +12 -13
  1250. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
  1251. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +35 -196
  1252. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +3 -1
  1253. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +22 -96
  1254. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +3 -4
  1255. package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +1 -1
  1256. package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +74 -7
  1257. package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +51 -7
  1258. package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +42 -111
  1259. package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +1 -20
  1260. package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1 -2
  1261. package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +3 -4
  1262. package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
  1263. package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
  1264. package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
  1265. package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
  1266. package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/zip.ts +63 -0
  1267. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +650 -0
  1268. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
  1269. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
  1270. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
  1271. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-seed.test.ts +195 -0
  1272. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
  1273. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +347 -0
  1274. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1948 -0
  1275. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-library-evidence.test.ts +239 -0
  1276. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +277 -0
  1277. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +844 -0
  1278. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
  1279. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
  1280. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
  1281. package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
  1282. package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
  1283. package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
  1284. package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
  1285. package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
  1286. package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
  1287. package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
  1288. package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
  1289. package/skills/a2h-spec-generate/scripts/reqgen/test/zip.test.ts +61 -0
  1290. package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +879 -0
  1291. package/skills/a2h-spec-generate/test/check-spec.test.ts +430 -0
  1292. package/skills/a2h-spec-generate/test/collect-specs.test.mjs +811 -0
  1293. package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
  1294. package/skills/a2h-spec-generate/test/dispatch-watch.test.mjs +606 -0
  1295. package/skills/a2h-spec-generate/test/ensure-index.test.mjs +229 -0
  1296. package/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
  1297. package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
  1298. package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
  1299. package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
  1300. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
  1301. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
  1302. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
  1303. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
  1304. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
  1305. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
  1306. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
  1307. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
  1308. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
  1309. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
  1310. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
  1311. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
  1312. package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
  1313. package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
  1314. package/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
  1315. package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +182 -0
  1316. package/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
  1317. package/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
  1318. package/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
  1319. package/skills/a2h-spec-generate/test/report.test.mjs +47 -0
  1320. package/skills/a2h-utg-explorer/SKILL.md +9 -3
  1321. package/skills/a2h-utg-explorer/references/architecture.md +7 -0
  1322. package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
  1323. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +120 -85
  1324. package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
  1325. package/skills/a2h-utg-explorer/scripts/hint_check.mjs +1 -2
  1326. package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
  1327. package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
  1328. package/skills/a2h-utg-explorer/scripts/recover.mjs +1 -1
  1329. package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
  1330. package/skills/a2h-utg-explorer/scripts/rejudge.mjs +5 -3
  1331. package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
  1332. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
  1333. package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
  1334. package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
  1335. package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
  1336. package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -0
  1337. package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +244 -0
  1338. package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
  1339. package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
  1340. package/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
  1341. package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
  1342. package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +231 -0
  1343. package/skills/a2h-utg-explorer/scripts/tests/default_override.test.mjs +109 -0
  1344. package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +160 -0
  1345. package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -0
  1346. package/skills/a2h-utg-explorer/scripts/tests/device_locale_identity.test.mjs +77 -0
  1347. package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
  1348. package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +254 -0
  1349. package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
  1350. package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +137 -0
  1351. package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
  1352. package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
  1353. package/skills/a2h-utg-explorer/scripts/tests/foreground_spelling.test.mjs +155 -0
  1354. package/skills/a2h-utg-explorer/scripts/tests/fresh_state_plan.test.mjs +78 -0
  1355. package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
  1356. package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
  1357. package/skills/a2h-utg-explorer/scripts/tests/holds_without_data_parity.test.mjs +26 -0
  1358. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +120 -0
  1359. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
  1360. package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +614 -0
  1361. package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +214 -0
  1362. package/skills/a2h-utg-explorer/scripts/tests/launch_failure.test.mjs +40 -0
  1363. package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
  1364. package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
  1365. package/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
  1366. package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
  1367. package/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
  1368. package/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
  1369. package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
  1370. package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +218 -0
  1371. package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -0
  1372. package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
  1373. package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
  1374. package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
  1375. package/skills/a2h-utg-explorer/scripts/tests/recover_d_grounding.test.mjs +164 -0
  1376. package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -0
  1377. package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
  1378. package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
  1379. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +458 -0
  1380. package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -0
  1381. package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
  1382. package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
  1383. package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +336 -0
  1384. package/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
  1385. package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
  1386. package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +142 -0
  1387. package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
  1388. package/skills/a2h-utg-explorer/scripts/tests/string_tables_twin_ties.test.mjs +83 -0
  1389. package/skills/a2h-utg-explorer/scripts/tests/tar_fixture.mjs +12 -0
  1390. package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
  1391. package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
  1392. package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
  1393. package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
  1394. package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
  1395. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +135 -7
  1396. package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
  1397. package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
  1398. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +245 -69
  1399. package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
  1400. package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +164 -0
  1401. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
  1402. package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
  1403. package/skills/a2h-utg-static/SKILL.md +6 -2
  1404. package/skills/a2h-utg-static/scripts/assemble.mjs +93 -3
  1405. package/skills/a2h-utg-static/scripts/click_paths.mjs +135 -25
  1406. package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
  1407. package/skills/a2h-utg-static/scripts/compose_overlay.mjs +110 -3
  1408. package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
  1409. package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
  1410. package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
  1411. package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
  1412. package/skills/a2h-utg-static/scripts/fragment_nav.mjs +2 -3
  1413. package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
  1414. package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
  1415. package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
  1416. package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
  1417. package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
  1418. package/skills/a2h-utg-static/scripts/nl_hints.mjs +34 -7
  1419. package/skills/a2h-utg-static/scripts/presenter_nav.mjs +1 -2
  1420. package/skills/a2h-utg-static/scripts/route_interceptor.mjs +21 -7
  1421. package/skills/a2h-utg-static/scripts/run_pipeline.mjs +86 -4
  1422. package/skills/a2h-utg-static/scripts/static_prior.mjs +26 -29
  1423. package/skills/a2h-utg-static/scripts/tests/test_activity_gates.mjs +84 -0
  1424. package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +30 -0
  1425. package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
  1426. package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
  1427. package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
  1428. package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
  1429. package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
  1430. package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
  1431. package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
  1432. package/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +38 -0
  1433. package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
  1434. package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
  1435. package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
  1436. package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
  1437. package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
  1438. package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +29 -1
  1439. package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
  1440. package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
  1441. package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
  1442. package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
  1443. package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
  1444. package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
  1445. package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -1
  1446. package/README.md +0 -439
  1447. package/dist/cli/config-store.js +0 -128
  1448. package/dist/cli/config.js +0 -48
  1449. package/dist/cli/editors.json +0 -114
  1450. package/dist/cli/env-vars.js +0 -127
  1451. package/dist/cli/index.js +0 -73
  1452. package/dist/cli/init.js +0 -2513
  1453. package/dist/cli/uninstall.js +0 -406
  1454. package/dist/platform/compose.js +0 -228
  1455. package/dist/platform/frontmatter.js +0 -151
  1456. package/dist/platform/installer.js +0 -417
  1457. package/dist/platform/registry.js +0 -337
  1458. package/dist/platform/transform.js +0 -363
  1459. package/dist/platform/types.js +0 -9
  1460. package/dist/platform/validate.js +0 -152
  1461. package/dist/utils/regex.js +0 -7
  1462. package/env-requirements.json +0 -511
  1463. package/resource/choose_editor.png +0 -0
  1464. package/resource/convert_pipeline_process.svg +0 -114
  1465. package/resource/project_architecture.svg +0 -120
  1466. package/resource/set_environment.png +0 -0
  1467. package/resource/set_multimodel.png +0 -0
  1468. package/resource/set_sdk.png +0 -0
  1469. package/resource/title_dark.png +0 -0
  1470. package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +0 -5
  1471. package/skills/a2h-app-migrate/scripts/i18n-term.mjs +0 -54
  1472. package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +0 -5
  1473. package/skills/a2h-arch-generate/scripts/i18n-term.mjs +0 -54
  1474. package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +0 -5
  1475. package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +0 -54
  1476. package/skills/a2h-batch-ui-align/references/source-only-tier.md +0 -38
  1477. package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +0 -5
  1478. package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +0 -54
  1479. package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +0 -5
  1480. package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +0 -54
  1481. package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +0 -5
  1482. package/skills/a2h-resource-convert/scripts/i18n-term.mjs +0 -54
  1483. package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +0 -885
  1484. package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +0 -5
  1485. package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +0 -54
  1486. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +0 -856
  1487. package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +0 -70
  1488. package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +0 -5
  1489. package/skills/a2h-spec-generate/scripts/i18n-term.mjs +0 -54
  1490. package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +0 -5
  1491. package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +0 -54
  1492. package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +0 -5
  1493. package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +0 -54
  1494. package/skills/a2h-utg-static/scripts/i18n-term.d.mts +0 -5
  1495. package/skills/a2h-utg-static/scripts/i18n-term.mjs +0 -54
  1496. package/skills/a2h-utg-static/scripts/tests/test_i18n_term.mjs +0 -155
@@ -0,0 +1,1562 @@
1
+ /**
2
+ * semantics.mjs — port of semantics.py. Source-backed page identities. Incoming click labels
3
+ * are NOT landing evidence.
4
+ *
5
+ * Exports: ANDROID, normalized, buildCatalog, _selectorHits, learnedRuleMatches,
6
+ * occludedIndices, treePackage, resolvePage, _SCREEN_KINDS, _shareRowContainer,
7
+ * _hostCompatible, _toolbarTitleCandidates, _selectedTabCandidates,
8
+ * _ownWidgetCandidates, _overlayLeadTitleCandidates, OVERLAY_KINDS, androidUnescape, androidValue, decodeAndroidString,
9
+ * panelHost, observationMatchesStatic, _hybridRouteOf, _hybridRouteResolution, _hybridModalOpen
10
+ *
11
+ * Python sets become JS Sets in insertion order. Where Python iterated a set of strings to
12
+ * build an ordered result (only `_toolbarTitleCandidates`, whose order Python leaves to the
13
+ * per-process string hash), the JS order is the node order of the capture.
14
+ */
15
+ import {
16
+ get, truthy, pyStr, pyStrip, sortedStr, sortedBy, pyMax, pyRe, reEscape,
17
+ pathStr, pJoin, pResolve, pIsFile, pIsDir, pSuffix, pName, pParent, pParents, pStem, pGlob,
18
+ pOrder, pKey, pRelativeParts, pIsRelativeTo, etParse, XmlParseError, readText, dset, reFindall,
19
+ } from './_py.mjs';
20
+ import { normalized, androidValue, decodeAndroidString, valuesDirRank, loadStringTables, deviceTextsIn, MAX_DEVICE_TEXTS } from './strings.mjs';
21
+
22
+ export { normalized, androidValue, decodeAndroidString, valuesDirRank, MAX_DEVICE_TEXTS };
23
+
24
+ export const ANDROID = '{http://schemas.android.com/apk/res/android}';
25
+
26
+ const S = (v) => pyStr(v);
27
+ const g = (o, k, d = null) => get(o, k, d);
28
+ const vis = (n) => truthy(g(n, 'visible', true));
29
+ const tail = (rid) => S(rid).split('/').pop();
30
+ const endsWithAny = (s, xs) => xs.some((x) => s.endsWith(x));
31
+ const setOf = (it) => new Set(it);
32
+ const inter = (a, b) => new Set([...a].filter((x) => b.has(x)));
33
+ const inRange = (i, nodes) => i !== null && i !== undefined && i >= 0 && i < nodes.length;
34
+ const parentOf = (n) => { const p = g(n, 'parent_index'); return p === undefined ? null : p; };
35
+
36
+ /** A text input (EditText and subclasses, AutoCompleteTextView, SearchView's SearchAutoComplete): its text is the user's. */
37
+ export const isInputNode = (n) => /(?:EditText|AutoCompleteTextView|SearchAutoComplete)$/.test(S(g(n, 'class', '')));
38
+
39
+ const isBuildPath = (p, project) => (pRelativeParts(p, project) ?? []).includes('build');
40
+
41
+ /**
42
+ * aapt's backslash escapes in an (already entity-decoded) strings.xml value: `\n`, `\t`, `\'`, `\"`,
43
+ * `\@`, `\uXXXX`. Only `\'` was undone before, so a title such as `你好,\n欢迎注册青商城` ("Hello,\nWelcome to Qing Mall") kept a literal
44
+ * backslash-n and never equalled the rendered two-line text.
45
+ */
46
+ export function androidUnescape(value) {
47
+ return S(value).replace(/\\(u[0-9a-fA-F]{4}|[\s\S])/g, (m, c) => {
48
+ if (c.length === 5) { return String.fromCharCode(parseInt(c.slice(1), 16)); }
49
+ return c === 'n' ? '\n' : c === 't' ? '\t' : c;
50
+ });
51
+ }
52
+
53
+ /** build_catalog(graph, project=None, locale='en'). */
54
+ const _STRING_ROW = /<string\s+name="([^"]+)"[^>]*>([\s\S]*?)<\/string>/g;
55
+
56
+ /** Map(main-source-set value -> [values the same key takes in another source set]), e.g. a debug
57
+ * build type's `app_name`. Only the default-language `values` dirs: locales are buildCatalog's job. */
58
+ export function _variantOverrides(project) {
59
+ const main = new Map(); const other = new Map();
60
+ for (const file of pGlob(project, '**/src/*/res/values/*.xml')) {
61
+ if (pRelativeParts(file, project).includes('build')) { continue; }
62
+ const set = pName(pParent(pParent(pParent(file))));
63
+ let text;
64
+ try { text = readText(file); } catch { continue; }
65
+ for (const m of text.matchAll(_STRING_ROW)) {
66
+ const v = decodeAndroidString(m[2]).trim();
67
+ if (!v) { continue; }
68
+ const tbl = set === 'main' ? main : other;
69
+ if (!tbl.has(m[1])) { tbl.set(m[1], new Set()); }
70
+ tbl.get(m[1]).add(v);
71
+ }
72
+ }
73
+ const out = new Map();
74
+ for (const [k, alts] of other) {
75
+ for (const mv of main.get(k) ?? []) {
76
+ for (const a of alts) {
77
+ if (a === mv) { continue; }
78
+ if (!out.has(mv)) { out.set(mv, []); }
79
+ if (!out.get(mv).includes(a)) { out.get(mv).push(a); }
80
+ }
81
+ }
82
+ }
83
+ return out;
84
+ }
85
+
86
+ /**
87
+ * deviceTextsOf(project, locale) -> (text) => [device-locale texts]. The static layer renders every
88
+ * text in the default / Chinese strings (a2h-utg-static loadProjectStrings skips `values-en`), while the
89
+ * device shows its own locale. Measured (coolmall, en device): splash "青商城" (Qing Mall) rendered "CoolMall", login
90
+ * "验证码登录" (code login) rendered "SMS Login"; no body anchor ever matched and 112 captures stayed unmapped.
91
+ * Value -> resource keys (any locale) -> the key's device-locale value; the original is kept.
92
+ */
93
+ export function deviceTextsOf(project, locale) {
94
+ const tables = loadStringTables(project, locale);
95
+ return (t) => deviceTextsIn(tables, t);
96
+ }
97
+
98
+ export function buildCatalog(graph, project = null, locale = 'en') {
99
+ const nodes = g(graph, 'nodes', []);
100
+ project = truthy(project) ? pResolve(project) : null;
101
+ const stringCache = new Map(); const xmlCache = new Map();
102
+
103
+ const resources = (res) => {
104
+ // Project-wide string lookup (the XML's own `res` first so a local override wins).
105
+ const key = project ? 'project' : pKey(res);
106
+ if (stringCache.has(key)) { return stringCache.get(key); }
107
+ const strings = {};
108
+ const lang = locale.replace(/_/g, '-').split('-')[0];
109
+ const variants = ['values', 'values-' + lang, 'values-' + locale.replace(/-/g, '-r')];
110
+ if (lang === 'zh') { variants.push(!locale.includes('TW') ? 'values-zh-rCN' : 'values-zh-rTW'); }
111
+ let resDirs = [res];
112
+ if (project) {
113
+ resDirs = resDirs.concat(sortedBy(pGlob(project, '**/src/main/res'), pOrder)
114
+ .filter((d) => !isBuildPath(d, project) && pKey(d) !== pKey(res)));
115
+ }
116
+ for (const variant of [...new Set(variants)]) {
117
+ for (const rd of [...resDirs].reverse()) {
118
+ for (const file of sortedBy(pGlob(pJoin(rd, variant), '*.xml'), pOrder)) {
119
+ let root;
120
+ try { root = etParse(file); } catch (e) { if (e instanceof XmlParseError) { continue; } throw e; }
121
+ for (const el of root) {
122
+ // a nameless <string> lands under None in Python: unreachable by any str key
123
+ if (el.tag === 'string' && el.get('name') !== null) { dset(strings, el.get('name'), androidValue([...el.itertext()].join(''))); }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ stringCache.set(key, strings);
129
+ return strings;
130
+ };
131
+
132
+ const resolve = (value, res) => {
133
+ if (!truthy(value)) { return ''; }
134
+ if (value.startsWith('@string/')) { return g(resources(res), value.split('/').slice(1).join('/'), ''); }
135
+ return !value.startsWith('@') ? value : '';
136
+ };
137
+
138
+ const parse = (p) => {
139
+ const k = pKey(p);
140
+ if (!xmlCache.has(k)) {
141
+ try { xmlCache.set(k, etParse(p)); } catch (e) {
142
+ if (e instanceof XmlParseError || (e && e.code)) { xmlCache.set(k, null); } else { throw e; }
143
+ }
144
+ }
145
+ return xmlCache.get(k);
146
+ };
147
+
148
+ const rows = (el, res) => {
149
+ const result = [];
150
+ for (const child of el) {
151
+ if (child.tag.endsWith('PreferenceCategory')) { result.push(...rows(child, res)); }
152
+ else {
153
+ const title = resolve(child.get(ANDROID + 'title'), res);
154
+ if (title) { result.push(title); }
155
+ }
156
+ }
157
+ return sortedStr(new Set(result));
158
+ };
159
+
160
+ const catalog = {};
161
+ for (const n of nodes) {
162
+ const ident = n.id;
163
+ const expected = g(n, 'expected') || {};
164
+ let titles = truthy(g(expected, 'title_any')) ? g(expected, 'title_any') : [];
165
+ if (typeof titles === 'string') { titles = [titles]; }
166
+ let component = truthy(g(expected, 'component')) ? g(expected, 'component') : g(expected, 'activity');
167
+ if (!truthy(component) && ['activity', 'host-activity'].includes(g(n, 'kind'))) { component = g(n, 'fqn'); }
168
+ const item = { id: ident, kind: g(n, 'kind'), label: g(n, 'label', ident), titles: [...titles], row_titles: [],
169
+ component: truthy(g(expected, 'component')) ? g(expected, 'component') : g(expected, 'activity'),
170
+ basis: [], entry_labels: [] };
171
+ item.component = component;
172
+ // uni-app page: its route is what the runtime's page WebView reports as its text (_hybridRouteOf).
173
+ if (item.kind === 'hybrid-page') {
174
+ item.route = truthy(g(n, 'route')) ? S(n.route) : null;
175
+ item.appid = truthy(g(n, 'appid')) ? S(n.appid) : null;
176
+ }
177
+ const links = g(graph, 'links', g(graph, 'edges', []));
178
+ item.hosts_static_pages = links.some((e) => g(e, 'source') === ident && g(e, 'target') !== ident
179
+ && !S(g(e, 'target', '')).startsWith('activity:'));
180
+ // Static openers: the pages with an edge into this one (used to tell layout twins apart).
181
+ item.opened_from = sortedStr(new Set(links.filter((e) => g(e, 'target') === ident && truthy(g(e, 'source'))
182
+ && g(e, 'source') !== ident).map((e) => S(g(e, 'source')))));
183
+ // the parameterized template an instance node was made from (a2h-utg-static compose_overlay)
184
+ if (truthy(g(n, 'template_of'))) { item.template_of = S(g(n, 'template_of')); }
185
+ item.default_children = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident && g(e, 'target') !== ident
186
+ && !S(g(e, 'target', '')).startsWith('activity:')
187
+ && (g(g(e, 'args') || {}, 'action') === 'default' || g(e, 'mechanism') === 'fragment-embed')
188
+ && !truthy(g(e, 'guard') || {})).map((e) => g(e, 'target'))));
189
+ if (g(n, 'kind') === 'dialog' && truthy(g(n, 'label')) && !/^[A-Za-z][A-Za-z0-9_]*$/.test(n.label)) {
190
+ item.titles.push(n.label);
191
+ }
192
+ const location = S(g(n, 'declared_at', '')).replace(/:\d+$/, '');
193
+ const file = project && location ? pResolve(pJoin(project, location)) : null;
194
+ if (file && pIsRelativeTo(file, project) && pIsFile(file)) {
195
+ if (pSuffix(file) === '.xml' && pName(pParent(file)) === 'xml') {
196
+ const root = parse(file);
197
+ const res = pParent(pParent(file));
198
+ const key = ident.split('/').pop().split(':').pop();
199
+ const candidates = root === null ? [] : [...root.iter()].filter((e) => e.get(ANDROID + 'key') === key);
200
+ if (!candidates.length) {
201
+ const comments = reFindall(pyRe('<!--(.*?)-->', 's'), readText(file));
202
+ const kre = pyRe('android:key\\s*=\\s*["\']' + reEscape(key) + '["\']');
203
+ if (comments.some((c) => kre.test(c))) {
204
+ item.source_gap = 'preference-defined-only-in-XML-comment';
205
+ item.basis.push(pathStr(file) + '#' + key);
206
+ }
207
+ }
208
+ if (candidates.length === 1) {
209
+ const element = candidates[0];
210
+ const entry = resolve(element.get(ANDROID + 'title'), res);
211
+ const title = resolve(element.get(ANDROID + 'dialogTitle'), res) || entry;
212
+ item.entry_labels = entry ? [entry] : [];
213
+ item.titles = title ? [title] : item.titles;
214
+ item.basis.push(pathStr(file) + '#' + key);
215
+ item.preference_type = element.tag.split('.').pop();
216
+ if (element.tag.endsWith('PreferenceScreen')) {
217
+ item.row_titles = rows(element, res);
218
+ item.row_source = 'preference-xml';
219
+ }
220
+ if (!title) { dynamicTitle(item, key, res, project, resources); }
221
+ }
222
+ } else if (['.java', '.kt'].includes(pSuffix(file)) && ident.split(':').pop() === pStem(file)) {
223
+ const text = readText(file);
224
+ const refs = new Set(reFindall(pyRe('(?:add|set)PreferencesFromResource\\(\\s*R\\.xml\\.(\\w+)'), text));
225
+ if (refs.size === 1) {
226
+ const name = [...refs][0] + '.xml';
227
+ const roots = pParents(file).map((p) => pJoin(p, 'res')).filter((p) => pIsDir(p)).slice(0, 1);
228
+ let found = roots.filter((r) => pIsFile(pJoin(r, 'xml', name)));
229
+ if (!found.length) {
230
+ found = pGlob(project, '**/src/main/res/xml/' + name).filter((x) => !isBuildPath(x, project))
231
+ .map((x) => pParent(pParent(x)));
232
+ }
233
+ if (found.length === 1) {
234
+ const resource = found[0];
235
+ const xml = pJoin(resource, 'xml', name);
236
+ const element = parse(xml);
237
+ if (element !== null) {
238
+ item.row_titles = rows(element, resource);
239
+ item.row_source = 'preference-xml';
240
+ item.basis.push(pathStr(xml) + '#root');
241
+ }
242
+ }
243
+ }
244
+ }
245
+ if (g(n, 'kind') === 'activity' && !truthy(item.component) && ident.startsWith('activity:')) {
246
+ for (const manifest of pGlob(project, '**/src/main/AndroidManifest.xml')) {
247
+ const root = parse(manifest);
248
+ if (root === null) { continue; }
249
+ for (const el of root.iter('activity')) {
250
+ const name = el.get(ANDROID + 'name', '');
251
+ if (name.split('.').pop() === ident.split(':').pop()) {
252
+ const pkg = root.get('package', '');
253
+ item.component = name.startsWith('.') ? pkg + name : (!name.includes('.') ? pkg + '.' + name : name);
254
+ item.basis.push(pathStr(manifest));
255
+ }
256
+ }
257
+ }
258
+ }
259
+ }
260
+ if (g(n, 'kind') === 'menu') {
261
+ item.row_titles = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident
262
+ && truthy(g(g(e, 'args') || {}, 'label')) && g(g(e, 'args') || {}, 'label_key') !== 'widget:')
263
+ .map((e) => S(g(g(e, 'args') || {}, 'label')))));
264
+ if (project) {
265
+ const resName = ident.slice(ident.indexOf(':') + 1).split('@')[0];
266
+ const files = pGlob(project, '**/src/main/res/menu/' + resName + '.xml').filter((x) => !isBuildPath(x, project));
267
+ if (files.length === 1) {
268
+ const root = parse(files[0]);
269
+ const resdir = pParent(pParent(files[0]));
270
+ if (root !== null) {
271
+ const extra = new Set();
272
+ for (const el of root.iter('item')) {
273
+ const show = el.get('{http://schemas.android.com/apk/res-auto}showAsAction', '') || el.get(ANDROID + 'showAsAction', '');
274
+ if (show.includes('always') || show.includes('ifRoom')) { continue; }
275
+ const t = resolve(el.get(ANDROID + 'title'), resdir);
276
+ if (t) { extra.add(t); }
277
+ }
278
+ item.row_titles = sortedStr(new Set([...item.row_titles, ...extra]));
279
+ item.basis.push(pathStr(files[0]));
280
+ }
281
+ }
282
+ }
283
+ item.titles = item.titles.filter((t) => !t.endsWith('(overflow)'));
284
+ }
285
+ item.titles = sortedStr(new Set(item.titles.filter((t) => truthy(t))));
286
+ const hints = truthy(g(expected, 'hint_any')) ? g(expected, 'hint_any') : [];
287
+ item.hint_titles = sortedStr(new Set(typeof hints === 'string' ? [hints] : hints));
288
+ item.widget_ids = ident.includes('@') ? [] : sortedStr(new Set([
289
+ ...(truthy(g(n, 'layout_ids', [])) ? g(n, 'layout_ids', []) : []).map(S),
290
+ ...(truthy(g(n, 'widgets', [])) ? g(n, 'widgets', []) : [])
291
+ .filter((w) => w && typeof w === 'object' && !Array.isArray(w) && truthy(g(w, 'view_id'))).map((w) => S(w.view_id)),
292
+ ]));
293
+ const wid = new Set(item.widget_ids);
294
+ item.hidden_ids = sortedStr(new Set((truthy(g(n, 'layout_hidden_ids')) ? n.layout_hidden_ids : []).filter((x) => wid.has(x))));
295
+ // Fixed texts the page's own source renders (a2h-utg-static compose_body_text); kept below
296
+ // only when no other page claims them.
297
+ const bodyText = ident.includes('@') ? [] : (truthy(g(n, 'body_text')) ? n.body_text : []);
298
+ const isPrefix = (t) => typeof t === 'object' && t !== null && truthy(g(t, 'prefix'));
299
+ item.body_titles = sortedStr(new Set(bodyText.filter((t) => !isPrefix(t))
300
+ .map((t) => normalized(typeof t === 'string' ? t : g(t, 'text', ''))).filter((t) => truthy(t))));
301
+ // Fixed leads of template strings (`"From ${x}"`): matched as the start of a rendered text.
302
+ item.body_prefixes = sortedStr(new Set(bodyText.filter(isPrefix).map((t) => normalized(g(t, 'text', ''))).filter((t) => truthy(t))));
303
+ // A folded host Activity (assemble._foldUilessHosts) still names the component that shows this page.
304
+ const host = g(n, 'host_activity');
305
+ if (!truthy(item.component) && truthy(g(host, 'fqn'))) { item.component = host.fqn; }
306
+ item.transient = truthy(g(n, 'transient'));
307
+ // An in-page state (a mode tab: calendar day/week/month/year) is told apart only by content
308
+ // its host shows in that state; `state_anchors` names it ({all: [selector], none: [selector]}).
309
+ if (STATE_KINDS.includes(item.kind)) {
310
+ item.host_node = truthy(g(n, 'host_node')) ? n.host_node : stateHost(ident);
311
+ const rule = _stateRule(g(n, 'state_anchors'), 'static');
312
+ if (rule) { item.state_rules = [rule]; }
313
+ }
314
+ item.auto_targets = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident && g(e, 'target') !== ident
315
+ && (['lifecycle', 'startDestination'].includes(S(g(e, 'trigger', '')).split('@')[0])
316
+ || g(g(e, 'args') || {}, 'action') === 'default')).map((e) => S(g(e, 'target')))));
317
+ dset(catalog, ident, item);
318
+ }
319
+ // A static title is the MAIN source set's string; the installed build may override that resource in a
320
+ // build-type / flavor source set (`src/debug/res/values/strings.xml` renaming `app_name` to "AppDebug").
321
+ // The overriding value is what the device renders, so it joins the titles: without it a page titled
322
+ // by such a string was never recognised on the debug build every campaign installs.
323
+ if (project) {
324
+ const variants = _variantOverrides(project);
325
+ if (variants.size) {
326
+ for (const item of Object.values(catalog)) {
327
+ for (const t of [...item.titles]) {
328
+ for (const alt of variants.get(t) ?? []) { if (!item.titles.includes(alt)) { item.titles.push(alt); } }
329
+ }
330
+ }
331
+ }
332
+ // Static titles / hint titles / body texts in the device locale too (before the shared-title and
333
+ // unique-claim passes below, so a translation is claimed like its source text).
334
+ const deviceTexts = deviceTextsOf(project, locale);
335
+ const plus = (xs, norm) => [...new Set([...xs, ...xs.flatMap((t) => deviceTexts(t).map(norm))])];
336
+ for (const item of Object.values(catalog)) {
337
+ item.titles = plus(item.titles, (x) => x);
338
+ item.hint_titles = plus(item.hint_titles, (x) => x);
339
+ item.body_titles = plus(item.body_titles, normalized);
340
+ }
341
+ }
342
+ // Shared titles: a title / hint title / own body text that 2+ screens render (twins built on one
343
+ // scaffold: every feature's "Bookmarks" page). Not an anchor by itself -- resolvePage offers the
344
+ // sharers as `shared-title-twin` candidates only when nothing unique matched, and
345
+ // resolveTwinByOpener settles them by the verified page shown before. Computed before the
346
+ // unique-claim filter below, which it leaves unchanged.
347
+ // A bar title is matched against shared TITLES only (a page's body button "Bookmarks" that opens the
348
+ // twin is not that page's title); a search placeholder also against shared body texts.
349
+ const sharersOf = (textsOf) => {
350
+ const m = new Map();
351
+ for (const [ident, item] of Object.entries(catalog)) {
352
+ if (!_SCREEN_KINDS.includes(item.kind)) { continue; }
353
+ for (const t of new Set(textsOf(item))) {
354
+ if (!truthy(t)) { continue; }
355
+ if (!m.has(t)) { m.set(t, new Set()); }
356
+ m.get(t).add(ident);
357
+ }
358
+ }
359
+ return (ident) => sortedStr([...m].filter(([, ids]) => ids.size >= 2 && ids.has(ident)).map(([t]) => t));
360
+ };
361
+ const titleShare = sharersOf((it) => [...it.titles, ...it.hint_titles].map(normalized));
362
+ const textShare = sharersOf((it) => [...it.titles, ...it.hint_titles].map(normalized).concat(it.body_titles));
363
+ for (const [ident, item] of Object.entries(catalog)) {
364
+ item.shared_titles = titleShare(ident);
365
+ item.shared_texts = textShare(ident);
366
+ }
367
+ // Overlay titles no screen renders (as title, row, hint or own body text, before the unique-claim
368
+ // filter below): a sheet / dialog whose window shows such a title first is that overlay
369
+ // (_overlayLeadTitleCandidates). A title a screen also renders (the opener's "Get Coupons" button)
370
+ // is no proof of the overlay.
371
+ const screenTexts = new Map();
372
+ for (const [ident, item] of Object.entries(catalog)) {
373
+ if (OVERLAY_KINDS.includes(item.kind)) { continue; }
374
+ for (const t of [...item.titles, ...item.hint_titles, ...item.row_titles].map(normalized).concat(item.body_titles)) {
375
+ if (!screenTexts.has(t)) { screenTexts.set(t, new Set()); }
376
+ screenTexts.get(t).add(ident);
377
+ }
378
+ }
379
+ // An overlay's own body text leads its window too (ThemeModeModal: title "Night Mode" is a Text, its
380
+ // `title_any` holds the options). A lead a screen also renders -- the opener's row, coolmall
381
+ // Settings "Theme Color" / "Night Mode" -- goes to `lead_shared` with those screens: it names the
382
+ // overlay only in a dump that shows none of their other texts (the overlay's own window).
383
+ for (const item of Object.values(catalog)) {
384
+ if (!OVERLAY_KINDS.includes(item.kind)) { continue; }
385
+ const leads = new Set([...item.titles.map(normalized), ...item.body_titles].filter((t) => [...t].length >= 2));
386
+ item.lead_titles = sortedStr([...leads].filter((t) => !screenTexts.has(t)));
387
+ item.lead_shared = Object.fromEntries(sortedStr([...leads].filter((t) => screenTexts.has(t)))
388
+ .map((t) => [t, sortedStr(screenTexts.get(t))]));
389
+ }
390
+ // A body text is an anchor only for its single claimant, and never one that is some page's title.
391
+ const claims = new Map();
392
+ for (const item of Object.values(catalog)) {
393
+ for (const t of new Set([...item.body_titles, ...item.titles.map(normalized), ...item.row_titles.map(normalized)])) {
394
+ claims.set(t, (claims.get(t) ?? 0) + 1);
395
+ }
396
+ }
397
+ for (const item of Object.values(catalog)) {
398
+ // every own source text, before the app-wide unique filter: _twinContrast compares twins on it
399
+ item.source_texts = sortedStr(new Set([...item.body_titles, ...item.titles.map(normalized), ...item.hint_titles.map(normalized)]));
400
+ item.body_titles = item.body_titles.filter((t) => claims.get(t) === 1 && !item.titles.map(normalized).includes(t));
401
+ }
402
+ // A prefix is an anchor only when no text or prefix of another page starts with it.
403
+ const allTexts = Object.entries(catalog).map(([id, it]) => [id, [...it.body_titles, ...it.titles.map(normalized),
404
+ ...it.row_titles.map(normalized), ...it.body_prefixes]]);
405
+ for (const [ident, item] of Object.entries(catalog)) {
406
+ item.body_prefixes = item.body_prefixes.filter((p) => !allTexts.some(([id, ts]) => id !== ident && ts.some((t) => t.startsWith(p) || p.startsWith(t))));
407
+ }
408
+ return catalog;
409
+ }
410
+
411
+ /** Fewest body anchors that identify a page: two, or one of at least this many characters. */
412
+ export const BODY_ANCHOR_MIN_CHARS = 4;
413
+ /** Shared source texts of the same page that must be on screen to back one short own text. */
414
+ export const BODY_CORROBORATION = 2;
415
+
416
+ /** Catalog kinds shown in a window of their own over a page. */
417
+ export const OVERLAY_KINDS = ['dialog', 'sheet', 'menu'];
418
+
419
+ /**
420
+ * Overlays whose catalog `lead_titles` holds the dump's first visible text. A Compose bottom sheet
421
+ * (ModalBottomSheet) or dialog is its own window: the dump is the overlay alone, title first, and has
422
+ * no `alertTitle` / `dialog_title` id for the modal branch to read. Measured (coolmall): the goods
423
+ * page's coupon sheet showed "Get Coupons" first, matched no rule, and its 5 captures stayed unmapped.
424
+ * Only the FIRST text counts: an option row (ThemeModeModal's "Dark Mode") a settings page may also
425
+ * show as its current value is never the lead.
426
+ */
427
+ export function _overlayLeadTitleCandidates(nodes, catalog, observation) {
428
+ const first = nodes.find((n) => vis(n) && truthy(g(n, 'text')) && !isInputNode(n));
429
+ if (!first) { return []; }
430
+ const lead = normalized(g(first, 'text'));
431
+ const shown = new Set(nodes.filter((n) => vis(n)).flatMap((n) => [g(n, 'text'), g(n, 'content_desc')])
432
+ .filter((t) => truthy(t)).map(normalized));
433
+ const screenShown = (sid) => {
434
+ const p = g(catalog, sid, {});
435
+ return [...g(p, 'titles', []), ...g(p, 'hint_titles', []), ...g(p, 'row_titles', [])].map(normalized)
436
+ .concat(g(p, 'body_titles', [])).some((t) => t !== lead && shown.has(t));
437
+ };
438
+ const out = [];
439
+ for (const [ident, page] of Object.entries(catalog)) {
440
+ if (!OVERLAY_KINDS.includes(g(page, 'kind'))) { continue; }
441
+ const owners = g(g(page, 'lead_shared', {}) ?? {}, lead);
442
+ const own = (g(page, 'lead_titles', []) || []).includes(lead);
443
+ if (!own && !(Array.isArray(owners) && owners.length && !owners.some(screenShown))) { continue; }
444
+ if (_hostCompatible(page, catalog, observation)) {
445
+ out.push({ static_id: ident, reason: own ? 'overlay-lead-title' : 'overlay-lead-title-alone', anchors: [lead] });
446
+ }
447
+ }
448
+ return out;
449
+ }
450
+
451
+ /**
452
+ * _body_text_candidates(nodes, catalog, observation): pages whose own fixed source texts are on
453
+ * screen. The page with the most visible anchors wins; a tie is ambiguous.
454
+ */
455
+ export function _bodyTextCandidates(nodes, catalog, observation, tabBar = null) {
456
+ const shown = new Set();
457
+ tabBar ??= _composeTabBarNodes(nodes, catalog); // resolvePage passes the set it already built
458
+ for (const n of nodes) {
459
+ if (!vis(n) || tabBar.has(n)) { continue; }
460
+ for (const k of ['text', 'content_desc']) { if (truthy(g(n, k))) { shown.add(normalized(n[k])); } }
461
+ }
462
+ if (!shown.size) { return []; }
463
+ const scored = []; const weak = [];
464
+ for (const [ident, page] of Object.entries(catalog)) {
465
+ const hits = (g(page, 'body_titles', []) || []).filter((t) => shown.has(t));
466
+ for (const p of (g(page, 'body_prefixes', []) || [])) { if ([...shown].some((t) => t.startsWith(p))) { hits.push(p + '…'); } }
467
+ if (!hits.length) { continue; }
468
+ if (!_hostCompatible(page, catalog, observation)) { continue; }
469
+ if (hits.length < 2 && !hits.some((t) => [...t.replace(/…$/, '')].length >= BODY_ANCHOR_MIN_CHARS)) {
470
+ // A short own text (the splash's 3-character app name "Qing Mall") still identifies the page when
471
+ // BODY_CORROBORATION of the page's own source texts that other pages also render are on screen
472
+ // with it (its "Logo" and copyright line, shared with About). Alone it stays weak: an empty
473
+ // cart shows "Cart", the goods page's short own text, and nothing else of that page.
474
+ const backing = (g(page, 'shared_texts', []) || []).filter((t) => shown.has(normalized(t)));
475
+ if (backing.length < BODY_CORROBORATION) {
476
+ weak.push({ static_id: ident, reason: 'weak-body-text', anchors: sortedStr(hits) });
477
+ continue;
478
+ }
479
+ // ranked by its own texts only: the shared backing must not outrank a page with two own texts
480
+ scored.push([hits.length, ident, sortedStr([...hits, ...backing.map(normalized)])]);
481
+ continue;
482
+ }
483
+ scored.push([hits.length, ident, sortedStr(hits)]);
484
+ }
485
+ // Too weak alone: handed back unverified, for resolveTwinByOpener to settle by the opener.
486
+ if (!scored.length) { return weak.length ? [{ weak }] : []; }
487
+ scored.sort((a, b) => b[0] - a[0] || (a[1] < b[1] ? -1 : 1));
488
+ const top = scored.filter((x) => x[0] === scored[0][0]);
489
+ return top.map(([, ident, hits]) => ({ static_id: ident, reason: 'source-body-text', anchors: hits }));
490
+ }
491
+
492
+ /** The "dynamic Preference title from localized R.string constants" block of build_catalog. */
493
+ function dynamicTitle(item, key, res, project, resources) {
494
+ // Offsets are UTF-16 here (Python: code points); they differ only for astral chars in Java source.
495
+ for (const java of pGlob(project, '**/src/main/java/**/*.java')) {
496
+ const code = readText(java);
497
+ const binding = pyRe('\\b(\\w+)\\s*=\\s*[^;]*findPreference\\("' + reEscape(key) + '"\\)\\s*;').exec(code);
498
+ if (!binding) { continue; }
499
+ const variable = binding[1];
500
+ const bEnd = binding.index + binding[0].length;
501
+ let tl = code.slice(bEnd, bEnd + 2600);
502
+ const rebound = pyRe('\\b' + reEscape(variable) + '\\s*=').exec(tl);
503
+ if (rebound) { tl = tl.slice(0, rebound.index); }
504
+ const setter = pyRe('\\b' + reEscape(variable) + '\\.setTitle\\((\\w+)\\)').exec(tl);
505
+ if (!setter) { continue; }
506
+ const assignment = pyRe('\\b' + reEscape(setter[1]) + '\\s*=([^;]+);').exec(tl.slice(0, setter.index));
507
+ if (!assignment) { continue; }
508
+ const refs = reFindall(pyRe('R\\.string\\.(\\w+)'), assignment[1]);
509
+ if (refs.length && (new Set(refs).size === 1 || refs.filter((r) => r === refs[0]).length > 1)) {
510
+ const dynamic = g(resources(res), refs[0]);
511
+ if (truthy(dynamic)) {
512
+ item.titles = [dynamic]; item.entry_labels = [dynamic];
513
+ item.basis.push(pathStr(java) + '#' + variable + '.setTitle');
514
+ }
515
+ }
516
+ }
517
+ }
518
+
519
+ /** _selector_hits(nodes, sel): visible nodes matching a learned-rule selector. */
520
+ export function _selectorHits(nodes, sel) {
521
+ const out = [];
522
+ for (const n of nodes) {
523
+ if (!vis(n)) { continue; }
524
+ let ok = true;
525
+ for (const [k, v] of Object.entries(sel)) {
526
+ if (k === 'resource_name') { ok = tail(truthy(g(n, 'resource_id')) ? g(n, 'resource_id') : '') === v; }
527
+ else if (k === 'modal_title') {
528
+ ok = ['alertTitle', 'dialog_title'].includes(tail(truthy(g(n, 'resource_id')) ? g(n, 'resource_id') : ''))
529
+ && normalized(g(n, 'text')) === normalized(v);
530
+ } else if (k === 'text' || k === 'content_desc') { ok = normalized(g(n, k)) === normalized(v); }
531
+ else if (k === 'selected') { ok = truthy(g(n, 'selected')) === truthy(v); }
532
+ else { ok = false; }
533
+ if (!ok) { break; }
534
+ }
535
+ if (ok) { out.push(n); }
536
+ }
537
+ return out;
538
+ }
539
+
540
+ /** learned_rule_matches(nodes, rule): all positive selectors present, no negative present. */
541
+ export function learnedRuleMatches(nodes, rule) {
542
+ if (!truthy(g(rule, 'all'))) { return false; }
543
+ return rule.all.every((s) => _selectorHits(nodes, s).length > 0)
544
+ && !g(rule, 'none', []).some((s) => _selectorHits(nodes, s).length > 0);
545
+ }
546
+
547
+ const bnds = (n) => { const b = g(n, 'bounds'); return truthy(b) ? b : []; };
548
+
549
+ /** occluded_indices(nodes) -> Set of indices painted over by a covering sibling. */
550
+ export function occludedIndices(nodes) {
551
+ const children = new Map();
552
+ nodes.forEach((n, i) => {
553
+ const p = parentOf(n);
554
+ if (!children.has(p)) { children.set(p, []); }
555
+ children.get(p).push(i);
556
+ });
557
+ const kidsOf = (j) => children.get(j) ?? [];
558
+ const tops = nodes.map(bnds).filter((b) => b.length === 4);
559
+ const screenH = (tops.length ? Math.max(...tops.map((b) => b[3])) : 0) - (tops.length ? Math.min(...tops.map((b) => b[1])) : 0);
560
+ const area = (b) => (b[2] - b[0]) * (b[3] - b[1]);
561
+ const hasContent = (j) => {
562
+ const stack = [...kidsOf(j)];
563
+ while (stack.length) {
564
+ const k = stack.pop();
565
+ if (truthy(g(nodes[k], 'text')) || truthy(g(nodes[k], 'clickable'))) { return true; }
566
+ stack.push(...kidsOf(k));
567
+ }
568
+ return false;
569
+ };
570
+ const hasContentOver = (j, bi) => {
571
+ const stack = [...kidsOf(j)];
572
+ while (stack.length) {
573
+ const k = stack.pop();
574
+ if (truthy(g(nodes[k], 'text')) || truthy(g(nodes[k], 'clickable'))) {
575
+ const bk = bnds(nodes[k]);
576
+ if (bk.length === 4 && bk[0] < bi[2] && bk[2] > bi[0] && bk[1] < bi[3] && bk[3] > bi[1]) { return true; }
577
+ }
578
+ stack.push(...kidsOf(k));
579
+ }
580
+ return false;
581
+ };
582
+ const hideTree = (hidden, root) => {
583
+ const stack = [root];
584
+ while (stack.length) { const m = stack.pop(); hidden.add(m); stack.push(...kidsOf(m)); }
585
+ };
586
+ const hidden = new Set();
587
+ for (const [parent, kids] of children) {
588
+ const pcls = parent !== null && parent >= 0 && parent < nodes.length ? S(g(nodes[parent], 'class', '')) : '';
589
+ if (pcls.endsWith('DrawerLayout') && kids.length >= 2) {
590
+ const pb = bnds(nodes[parent]);
591
+ const drawers = kids.filter((k) => {
592
+ const b = bnds(nodes[k]);
593
+ return b.length === 4 && pb.length === 4 && (b[0] === pb[0] || b[2] === pb[2])
594
+ && b[2] - b[0] < pb[2] - pb[0] && b[2] > b[0] && hasContent(k);
595
+ });
596
+ if (drawers.length === 1) {
597
+ for (const k of kids) { if (k !== drawers[0]) { hideTree(hidden, k); } }
598
+ continue;
599
+ }
600
+ }
601
+ for (const i of kids) {
602
+ const bi = bnds(nodes[i]);
603
+ if (bi.length !== 4 || bi[2] <= bi[0] || bi[3] <= bi[1]) { continue; }
604
+ if (screenH && bi[3] - bi[1] < 0.25 * screenH) { continue; }
605
+ for (const j of kids) {
606
+ if (j === i) { continue; }
607
+ const bj = bnds(nodes[j]);
608
+ // A clickable cover (a scrim, a loading mask) takes every touch on its area, wherever its
609
+ // content sits; any other cover hides only what its content actually overlaps.
610
+ if (bj.length === 4 && bj[0] <= bi[0] && bj[1] <= bi[1] && bj[2] >= bi[2] && bj[3] >= bi[3]
611
+ && area(bj) > area(bi) && screenH && bj[3] - bj[1] >= 0.5 * screenH
612
+ && (truthy(g(nodes[j], 'clickable')) ? hasContent(j) : hasContentOver(j, bi))) {
613
+ hideTree(hidden, i);
614
+ break;
615
+ }
616
+ }
617
+ }
618
+ }
619
+ return hidden;
620
+ }
621
+
622
+ /** tree_package(nodes): majority `package` of a dumped tree (first maximal on ties), or null. */
623
+ export function treePackage(nodes) {
624
+ const counts = new Map();
625
+ for (const n of nodes || []) {
626
+ if (truthy(g(n, 'package'))) { counts.set(n.package, (counts.get(n.package) ?? 0) + 1); }
627
+ }
628
+ return counts.size ? pyMax(counts.keys(), (k) => counts.get(k)) : null;
629
+ }
630
+
631
+ const textSet = (nodes, pred) => {
632
+ const out = new Set();
633
+ nodes.forEach((n) => { if (truthy(g(n, 'text')) && pred(n)) { out.add(normalized(g(n, 'text'))); } });
634
+ return out;
635
+ };
636
+
637
+ /** resolve_page(observation, catalog, configured_identity=None, app_package=None). */
638
+ // Call forms: resolvePage(obs, catalog, identity, {app_package}) (Python keyword), or
639
+ // resolvePage(obs, catalog, identity, 'pkg') (positional), or resolvePage(obs, catalog, {configured_identity, app_package}).
640
+ export function resolvePage(observation, catalog, configuredIdentity = null, opts = null) {
641
+ let appPackage = null;
642
+ let skipHybrid = false;
643
+ if (typeof opts === 'string') { appPackage = opts; } else if (opts && typeof opts === 'object') { appPackage = opts.app_package ?? null; skipHybrid = opts._skip_hybrid === true; }
644
+ if (configuredIdentity && typeof configuredIdentity === 'object' && !Array.isArray(configuredIdentity)
645
+ && ('configured_identity' in configuredIdentity || 'app_package' in configuredIdentity)) {
646
+ appPackage = configuredIdentity.app_package ?? appPackage;
647
+ configuredIdentity = configuredIdentity.configured_identity ?? null;
648
+ }
649
+ const ci = truthy(configuredIdentity) ? configuredIdentity : (truthy(g(observation, 'identity')) ? observation.identity : {});
650
+ const configuredId = g(ci, 'family');
651
+ const pkgTree = treePackage(g(observation, 'nodes'));
652
+ const pkg = truthy(pkgTree) ? pkgTree : g(observation, 'package');
653
+ if (truthy(appPackage) && truthy(pkg) && pkg !== appPackage) {
654
+ return { status: 'foreign-package', candidates: [], package: pkg };
655
+ }
656
+ // A uni-app page names itself: the runtime's page WebView carries its route as text. It runs before
657
+ // the configured anchors, which read every stacked page WebView (the hidden tab pages too).
658
+ const hybrid = skipHybrid ? null : _hybridRouteResolution(g(observation, 'nodes', []), catalog);
659
+ if (hybrid) {
660
+ // A native dialog over the WebViews (showModal, an action sheet, a permission prompt): the route
661
+ // names the page behind it, not the screen. The other tiers may name the overlay, but never a page
662
+ // (they would read the hidden tab WebViews too). The same route in several bundles (a host app and
663
+ // a UniMP; the WebView text carries no appid): the other tiers may pick among the route's owners.
664
+ const modal = _hybridModalOpen(observation);
665
+ if (!modal && hybrid.status !== 'ambiguous') { return hybrid; }
666
+ const owners = hybrid.status === 'ambiguous' ? hybrid.candidates.map((c) => c.static_id) : [];
667
+ const accept = (id) => (modal ? OVERLAY_KINDS.includes(g(g(catalog, id, {}), 'kind')) : owners.includes(id));
668
+ const rest = resolvePage(observation, catalog, ci, { app_package: appPackage, _skip_hybrid: true });
669
+ if (g(rest, 'status') === 'verified' && accept(rest.static_id)) {
670
+ return { ...rest, reason: 'hybrid-webview-route+' + rest.reason, webview_route: hybrid.webview_route };
671
+ }
672
+ return modal ? { status: 'unmapped', candidates: [], webview_route: hybrid.webview_route, overlay_open: true } : hybrid;
673
+ }
674
+ if (g(ci, 'status') === 'verified' && Object.hasOwn(catalog, configuredId)) {
675
+ return { status: 'verified', static_id: configuredId, reason: 'configured-positive-anchor', anchors: [...g(ci, 'basis', [])] };
676
+ }
677
+ const allNodes = g(observation, 'nodes', []);
678
+ const hidden = occludedIndices(allNodes);
679
+ const nodes = allNodes.map((n, i) => (vis(n) && !hidden.has(i) ? n : { parent_index: g(n, 'parent_index'), visible: false }));
680
+ observation = { ...observation, nodes };
681
+ // in-page states never compete for the page identity (uiStatesOf reads their rules)
682
+ const learned = Object.keys(catalog).filter((ident) => !STATE_KINDS.includes(g(catalog[ident], 'kind'))
683
+ && g(catalog[ident], 'learned_rules', []).some((r) => learnedRuleMatches(nodes, r)));
684
+ if (learned.length === 1) {
685
+ const rule = catalog[learned[0]].learned_rules.find((r) => learnedRuleMatches(nodes, r));
686
+ return { status: 'verified', static_id: learned[0], reason: 'learned-rule:' + rule.id,
687
+ anchors: rule.all.map((s) => Object.values(s)[0]) };
688
+ }
689
+ // Several learned rules at once decide nothing: the source tiers below still may. Measured
690
+ // (coolmall): UserAgreement / PrivacyPolicy rules ("User Agreement" / "Privacy Policy") both hit the
691
+ // consent line of every login and register page, and returning here left 14 captures ambiguous.
692
+ const learnedTie = learned.length > 1 ? learned.map((i) => ({ static_id: i, reason: 'learned-rule' })) : null;
693
+ const verdict = _resolveBySource(observation, nodes, catalog);
694
+ if (learnedTie && verdict.status !== 'verified' && !(verdict.status === 'ambiguous' && verdict.candidates.length)) {
695
+ return { status: 'ambiguous', candidates: learnedTie };
696
+ }
697
+ return verdict;
698
+ }
699
+
700
+ // A uni-app page WebView's text: `<route>[<webview id>]` (pages/mine/mine[4],
701
+ // team/baseTeam/pages/enterprise/enterprise-index[2]).
702
+ const HYBRID_ROUTE = /^([A-Za-z0-9_.@-]+(?:\/[A-Za-z0-9_.@-]+)+)\[\d+\]$/;
703
+
704
+ /**
705
+ * _hybridRouteOf(nodes) -> the route of the uni-app page shown, or null. The runtime stacks one
706
+ * WebView per open page (tab pages stay loaded behind the current one) and reports every one as
707
+ * visible. The page on top is the one whose branch draws last where the branches part: the higher
708
+ * `drawing-order` of the two ancestors below their common one. Dump order does not tell it.
709
+ * Measured (app_uni_harmony): a 我的收藏 (My Favorites) capture dumped collect-category[4] first, under a
710
+ * ViewGroup drawn 5th, then the tab pages customIndex[2] / mine[3] under a FrameLayout drawn 4th;
711
+ * the screenshot showed 我的收藏 (My Favorites). Without drawing orders, the later in dump order wins.
712
+ */
713
+ export function _hybridRouteOf(nodes) {
714
+ // Every visible WebView with an area takes part in the stacking, routed or not: a pushed page still
715
+ // loading (empty text) is on top, and the routed tab page below it is not the screen.
716
+ const routes = [];
717
+ nodes.forEach((n, i) => {
718
+ if (!S(g(n, 'class', '')).endsWith('WebView') || !vis(n)) { return; }
719
+ const b = g(n, 'bounds', null);
720
+ if (Array.isArray(b) && b.length === 4 && (b[2] <= b[0] || b[3] <= b[1])) { return; }
721
+ const m = HYBRID_ROUTE.exec(S(g(n, 'text', '')).trim());
722
+ routes.push([i, m ? m[1] : null]);
723
+ });
724
+ if (!routes.some(([, r]) => r !== null)) { return null; }
725
+ const chain = (i) => {
726
+ const out = [];
727
+ for (let k = i, guard = 0; inRange(k, nodes) && guard < 256; k = parentOf(nodes[k]), guard++) { out.unshift(k); }
728
+ return out;
729
+ };
730
+ const order = (k) => {
731
+ const v = Number.parseInt(S(g(nodes[k], 'drawing-order', g(nodes[k], 'drawing_order', ''))), 10);
732
+ return Number.isFinite(v) ? v : null;
733
+ };
734
+ // b above a?
735
+ const above = (a, b) => {
736
+ const ca = chain(a); const cb = chain(b);
737
+ let d = 0;
738
+ while (d < ca.length && d < cb.length && ca[d] === cb[d]) { d++; }
739
+ const oa = d < ca.length ? order(ca[d]) : null;
740
+ const ob = d < cb.length ? order(cb[d]) : null;
741
+ return oa !== null && ob !== null && oa !== ob ? ob > oa : b > a;
742
+ };
743
+ // A WebView drawn inside a routed page WebView's subtree (a <web-view> component) belongs to that page.
744
+ const routed = routes.filter(([, r]) => r !== null);
745
+ const owner = (i) => routed.find(([j]) => j !== i && chain(i).includes(j));
746
+ const pages = routes.filter(([i, r]) => r !== null || owner(i) === undefined);
747
+ let top = pages[0];
748
+ for (const r of pages.slice(1)) { if (above(top[0], r[0])) { top = r; } }
749
+ // Top WebView without a route (still loading): this tier does not decide.
750
+ return top[1];
751
+ }
752
+
753
+ /**
754
+ * A native modal window shown over the page WebViews: uni.showModal / showActionSheet, a permission
755
+ * prompt. Its dump still lists the page WebViews as visible, so the route would name the page behind
756
+ * it. Read from visible nodes only: the modal ids _ownWidgetCandidates reads, plus an id that starts
757
+ * with `dialog` / `alert` (dialog_title, alert_message), not one that only mentions it (btn_dialog_close).
758
+ */
759
+ const _MODAL_IDS = ['alertTitle', 'parentPanel', 'design_bottom_sheet', 'permission_message'];
760
+ export function _hybridModalOpen(observation) {
761
+ const nodes = g(observation, 'nodes', []);
762
+ // Ancestors of the page WebViews (a host `dialog_container` holding them) are page chrome, not a modal.
763
+ const hosts = new Set();
764
+ nodes.forEach((n, i) => {
765
+ if (!S(g(n, 'class', '')).endsWith('WebView')) { return; }
766
+ for (let k = i, guard = 0; inRange(k, nodes) && guard < 256; k = parentOf(nodes[k]), guard++) { hosts.add(k); }
767
+ });
768
+ return g(observation, 'window') === 'dialog' || nodes.some((n, i) => {
769
+ if (!vis(n)) { return false; }
770
+ const id = tail(S(g(n, 'resource_id', '')));
771
+ return _MODAL_IDS.includes(id) || (/^(?:dialog|alert)(?:_|$)/i.test(id) && !hosts.has(i));
772
+ });
773
+ }
774
+
775
+ /**
776
+ * _hybridRouteResolution(nodes, catalog) -> a resolution from the shown uni-app route, or null when
777
+ * the catalog has no hybrid page or no page WebView names a route. A route no catalog page owns is
778
+ * unmapped: the other tiers would read the stacked pages behind it.
779
+ */
780
+ export function _hybridRouteResolution(nodes, catalog) {
781
+ const pages = Object.entries(catalog).filter(([, p]) => g(p, 'kind') === 'hybrid-page');
782
+ if (!pages.length) { return null; }
783
+ const route = _hybridRouteOf(nodes);
784
+ if (!route) { return null; }
785
+ const owners = pages.filter(([ident, p]) => (truthy(g(p, 'route'))
786
+ ? S(p.route).replace(/^\/+/, '') === route : ident.replace(/^hybrid-page:[^/]+\//, '') === route)).map(([ident]) => ident);
787
+ const anchors = ['webview-route:' + route];
788
+ if (owners.length === 1) {
789
+ return { status: 'verified', static_id: owners[0], reason: 'hybrid-webview-route', anchors, webview_route: route };
790
+ }
791
+ if (owners.length > 1) {
792
+ return { status: 'ambiguous', webview_route: route,
793
+ candidates: sortedStr(owners).map((static_id) => ({ static_id, reason: 'hybrid-webview-route', anchors })) };
794
+ }
795
+ return { status: 'unmapped', candidates: [], webview_route: route };
796
+ }
797
+
798
+ /** resolvePage's source-anchor tiers (after configured and learned rules). */
799
+ function _resolveBySource(observation, nodes, catalog) {
800
+ const rid = (n) => S(g(n, 'resource_id', ''));
801
+ const modalTitles = textSet(nodes, (n) => ['alertTitle', 'dialog_title'].includes(tail(rid(n))));
802
+ const frameworkRows = textSet(nodes, (n) => tail(rid(n)) === 'title' && rid(n).endsWith(':id/title'));
803
+ const inNavBar = (n) => {
804
+ let idx = parentOf(n);
805
+ for (let k = 0; k < 6; k++) {
806
+ if (!inRange(idx, nodes)) { return false; }
807
+ const p = nodes[idx];
808
+ const cls = S(g(p, 'class', ''));
809
+ if (endsWithAny(cls, ['BottomNavigationView', 'NavigationBarView', 'TabLayout', 'BottomNavigationItemView', 'NavigationBarItemView'])
810
+ || S(g(p, 'resource_id', '')).includes('navigation_bar_item')) { return true; }
811
+ idx = parentOf(p);
812
+ }
813
+ return false;
814
+ };
815
+ const tabBar = _composeTabBarNodes(nodes, catalog);
816
+ const bodyText = textSet(nodes, (n) => !inNavBar(n) && !tabBar.has(n) && !endsWithAny(S(g(n, 'class', '')), ['.Button', 'MaterialButton', 'ImageButton']));
817
+ const prefRows = frameworkRows.size >= 2 ? frameworkRows : bodyText;
818
+ let candidates = []; let weakBody = null;
819
+ if (modalTitles.size) {
820
+ for (const [ident, page] of Object.entries(catalog)) {
821
+ const hits = inter(modalTitles, setOf(page.titles.map(normalized)));
822
+ if (page.kind === 'dialog' && hits.size) {
823
+ candidates.push({ static_id: ident, reason: 'unique-modal-title', anchors: sortedStr(hits) });
824
+ }
825
+ }
826
+ if (!candidates.length) {
827
+ const modalCatalog = {};
828
+ for (const [k, v] of Object.entries(catalog)) { if (['dialog', 'sheet', 'menu'].includes(g(v, 'kind'))) { dset(modalCatalog, k, v); } }
829
+ candidates = _ownWidgetCandidates(nodes, modalCatalog, observation);
830
+ }
831
+ } else {
832
+ const counts = new Map();
833
+ for (const page of Object.values(catalog)) {
834
+ for (const title of setOf(g(page, 'row_titles', []).map(normalized))) { counts.set(title, (counts.get(title) ?? 0) + 1); }
835
+ }
836
+ for (const [ident, page] of Object.entries(catalog)) {
837
+ const sourceRows = g(page, 'row_source') === 'preference-xml' ? frameworkRows : prefRows;
838
+ const hits = inter(sourceRows, setOf(g(page, 'row_titles', []).map(normalized)));
839
+ const unique = [...hits].filter((h) => counts.get(h) === 1);
840
+ const single = g(page, 'row_titles', []).length === 1 && unique.length === 1
841
+ && g(page, 'kind') === 'menu' && frameworkRows.has(unique[0]);
842
+ if (!frameworkRows.size && hits.size >= 2 && !_shareRowContainer(nodes, hits)) { continue; }
843
+ if ((hits.size >= 2 && unique.length) || single) {
844
+ candidates.push({ static_id: ident, reason: 'source-owned-preference-rows', anchors: sortedStr(hits) });
845
+ }
846
+ }
847
+ if (!candidates.length) { candidates = _selectedTabCandidates(nodes, catalog, observation); }
848
+ if (!candidates.length) { candidates = _tabTitleCandidates(nodes, catalog, observation); }
849
+ if (!candidates.length) { candidates = _toolbarTitleCandidates(nodes, catalog, observation); }
850
+ if (!candidates.length) { candidates = _ownWidgetCandidates(nodes, catalog, observation); }
851
+ if (!candidates.length) { candidates = _overlayLeadTitleCandidates(nodes, catalog, observation); }
852
+ if (!candidates.length) {
853
+ candidates = _bodyTextCandidates(nodes, catalog, observation, tabBar);
854
+ if (candidates.length === 1 && candidates[0].weak) {
855
+ weakBody = candidates[0].weak; candidates = [];
856
+ }
857
+ }
858
+ if (!candidates.length) {
859
+ for (const [ident, page] of Object.entries(catalog)) {
860
+ const hasList = nodes.some((n) => g(n, 'resource_id') === 'android:id/list');
861
+ if (page.kind === 'activity' && g(page, 'component') === g(observation, 'activity')
862
+ && (!hasList || g(page, 'hosts_static_pages') === false)) {
863
+ candidates.push({ static_id: ident, reason: 'exact-activity', anchors: [page.component] });
864
+ }
865
+ }
866
+ }
867
+ }
868
+ // Twins sharing every source anchor: nothing unique matched (or only a weak text of a page that is
869
+ // not one of them), but the bar title / search placeholder is a title several pages share.
870
+ if (!modalTitles.size && !candidates.length) {
871
+ const twins = _sharedTitleCandidates(nodes, catalog, observation);
872
+ const ids = new Set(twins.map((c) => c.static_id));
873
+ if (twins.length >= 2 && !(weakBody || []).some((c) => ids.has(g(c, 'static_id')))) {
874
+ return _twinContrast(nodes, twins, catalog) ?? { status: 'ambiguous', candidates: twins };
875
+ }
876
+ }
877
+ if (candidates.length === 1) { return { status: 'verified', ...candidates[0] }; }
878
+ const out = { status: candidates.length ? 'ambiguous' : 'unmapped', candidates };
879
+ if (!candidates.length && weakBody) { out.weak_candidates = weakBody; }
880
+ return out;
881
+ }
882
+
883
+ export const _SCREEN_KINDS = ['fragment', 'activity', 'screen', 'compose-route', 'panel', 'view-page'];
884
+
885
+ /** _share_row_container(nodes, texts): >=2 of `texts` are rows of ONE list. */
886
+ export function _shareRowContainer(nodes, texts) {
887
+ const rowList = (n) => {
888
+ const chain = [];
889
+ let idx = parentOf(n);
890
+ for (let k = 0; k < 8; k++) {
891
+ if (!inRange(idx, nodes)) { return null; }
892
+ const p = nodes[idx];
893
+ if (truthy(g(p, 'scrollable')) || endsWithAny(S(g(p, 'class', '')), ['ListView', 'RecyclerView'])) {
894
+ let depth = chain.length;
895
+ if (S(g(p, 'class', '')).endsWith('ScrollView')) { depth -= 1; }
896
+ return depth <= 2 ? idx : null;
897
+ }
898
+ chain.push(idx);
899
+ idx = parentOf(p);
900
+ }
901
+ return null;
902
+ };
903
+ const owners = new Map();
904
+ for (const n of nodes) {
905
+ const t = normalized(g(n, 'text'));
906
+ if (texts.has(t)) {
907
+ const c = rowList(n);
908
+ if (c !== null) { if (!owners.has(c)) { owners.set(c, new Set()); } owners.get(c).add(t); }
909
+ }
910
+ }
911
+ return [...owners.values()].some((v) => v.size >= 2);
912
+ }
913
+
914
+ /** _host_compatible(page, catalog, observation). */
915
+ export function _hostCompatible(page, catalog, observation) {
916
+ const component = g(page, 'component');
917
+ return !truthy(component) || component === g(observation, 'activity');
918
+ }
919
+
920
+ /** _toolbar_title_candidates(nodes, catalog, observation). */
921
+ export function _toolbarTitleCandidates(nodes, catalog, observation) {
922
+ const shown = _barTitles(nodes);
923
+ if (!shown.size) { return []; }
924
+ const owners = new Map();
925
+ for (const [ident, page] of Object.entries(catalog)) {
926
+ if (!_SCREEN_KINDS.includes(g(page, 'kind'))) { continue; }
927
+ for (const title of setOf([...g(page, 'titles', []), ...g(page, 'hint_titles', [])].map(normalized))) {
928
+ if (!owners.has(title)) { owners.set(title, new Set()); }
929
+ owners.get(title).add(ident);
930
+ }
931
+ }
932
+ const found = new Map();
933
+ for (const title of shown) {
934
+ const ids = owners.get(title) ?? new Set();
935
+ if (ids.size === 1) {
936
+ const ident = [...ids][0];
937
+ if (_hostCompatible(catalog[ident], catalog, observation)) {
938
+ if (!found.has(ident)) { found.set(ident, []); }
939
+ found.get(ident).push(title);
940
+ }
941
+ }
942
+ }
943
+ return [...found].map(([ident, t]) => ({ static_id: ident, reason: 'unique-toolbar-title', anchors: sortedStr(t) }));
944
+ }
945
+
946
+ /**
947
+ * Pages that share the screen's bar title or search-field placeholder (catalog `shared_titles`):
948
+ * `shared-title-twin` candidates, host-compatible ones only. Several shared texts shown narrow the
949
+ * set to the pages sharing all of them. Never a verdict: resolveTwinByOpener settles it by the opener.
950
+ */
951
+ export function _sharedTitleCandidates(nodes, catalog, observation) {
952
+ const index = (key) => {
953
+ const m = new Map();
954
+ for (const [ident, page] of Object.entries(catalog)) {
955
+ for (const t of (g(page, key, []) || [])) { if (!m.has(t)) { m.set(t, new Set()); } m.get(t).add(ident); }
956
+ }
957
+ return m;
958
+ };
959
+ const byTitle = index('shared_titles'); const byText = index('shared_texts');
960
+ const sets = [];
961
+ for (const t of _barTitles(nodes)) { if (byTitle.has(t)) { sets.push([t, byTitle.get(t)]); } }
962
+ for (const t of _placeholders(nodes)) { if (byText.has(t)) { sets.push([t, byText.get(t)]); } }
963
+ if (!sets.length) { return []; }
964
+ const shown = new Set(sets.map(([t]) => t));
965
+ let ids = null;
966
+ for (const [, s] of sets) { ids = ids === null ? new Set(s) : inter(ids, s); }
967
+ const anchors = sortedStr(shown);
968
+ return sortedStr(ids).filter((i) => _hostCompatible(catalog[i], catalog, observation))
969
+ .map((i) => ({ static_id: i, reason: 'shared-title-twin', anchors }));
970
+ }
971
+
972
+ /** Texts on screen that tell shared-title twins apart: at least this many, or one this long. */
973
+ export const TWIN_CONTRAST_MIN = 2;
974
+
975
+ /**
976
+ * Shared-title twins told apart among THEMSELVES. The app-wide unique filter drops a text every
977
+ * feature's index page renders ("Favorites List", "Read More"), so it never anchored the index -- yet among
978
+ * one feature's twins (index / read / show built on one shared panel) only the index renders it.
979
+ * Measured (jingmo): 7 groups (Idioms, Lyrics, Poems, Proverbs, Sentences, Famous Lines, Poetry) stayed ambiguous this way.
980
+ * A twin is chosen only when TWIN_CONTRAST_MIN shown texts (or one of BODY_ANCHOR_MIN_CHARS) are in its
981
+ * source and in no other candidate's, and no other candidate qualifies the same way.
982
+ * Null when that does not single one out: the opener rule then decides.
983
+ */
984
+ export function _twinContrast(nodes, twins, catalog) {
985
+ const shown = new Set();
986
+ for (const n of nodes) {
987
+ if (!vis(n)) { continue; }
988
+ for (const k of ['text', 'content_desc']) { if (truthy(g(n, k))) { shown.add(normalized(n[k])); } }
989
+ }
990
+ const texts = new Map(twins.map((c) => [c.static_id, new Set(g(g(catalog, c.static_id, {}), 'source_texts', []) || [])]));
991
+ const fits = [];
992
+ for (const c of twins) {
993
+ const own = [...shown].filter((t) => texts.get(c.static_id).has(t)
994
+ && twins.every((o) => o.static_id === c.static_id || !texts.get(o.static_id).has(t)));
995
+ if (own.length >= TWIN_CONTRAST_MIN || own.some((t) => [...t].length >= BODY_ANCHOR_MIN_CHARS)) {
996
+ fits.push({ ...c, reason: 'twin-contrast', anchors: sortedStr(new Set([...(g(c, 'anchors', []) || []), ...own])) });
997
+ }
998
+ }
999
+ return fits.length === 1 ? { status: 'verified', ...fits[0] } : null;
1000
+ }
1001
+
1002
+ /** Bar titles on screen: a TextView in a Toolbar (3 levels) or a Compose top bar title. */
1003
+ function _barTitles(nodes) {
1004
+ const inToolbar = (n) => {
1005
+ let idx = parentOf(n);
1006
+ for (let k = 0; k < 3; k++) {
1007
+ if (!inRange(idx, nodes)) { return false; }
1008
+ const parent = nodes[idx];
1009
+ const cls = S(g(parent, 'class', ''));
1010
+ const r = tail(S(g(parent, 'resource_id', ''))).toLowerCase();
1011
+ if (cls.endsWith('Toolbar') || ['toolbar', 'action_bar', 'toolbar_title'].includes(r)) { return true; }
1012
+ idx = parentOf(parent);
1013
+ }
1014
+ return false;
1015
+ };
1016
+ if (nodes.some((n) => S(g(n, 'resource_id', '')) === 'android:id/title')) { return new Set(); }
1017
+ return textSet(nodes, (n) => g(n, 'class') === 'android.widget.TextView' && (inToolbar(n) || _composeTopBarTitle(nodes, n)));
1018
+ }
1019
+
1020
+ /** Search-field placeholders: an empty EditText's hint, or a TextView drawn inside an EditText (Compose). */
1021
+ function _placeholders(nodes) {
1022
+ const out = new Set();
1023
+ nodes.forEach((n) => {
1024
+ if (!vis(n)) { return; }
1025
+ if (isInputNode(n) && !truthy(g(n, 'text')) && truthy(g(n, 'hint'))) { out.add(normalized(n.hint)); }
1026
+ if (g(n, 'class') !== 'android.widget.TextView' || !truthy(g(n, 'text'))) { return; }
1027
+ let idx = parentOf(n);
1028
+ for (let k = 0; k < 3 && inRange(idx, nodes); k++) {
1029
+ if (isInputNode(nodes[idx])) { out.add(normalized(n.text)); return; }
1030
+ idx = parentOf(nodes[idx]);
1031
+ }
1032
+ });
1033
+ return out;
1034
+ }
1035
+
1036
+ /**
1037
+ * A Compose top bar has no Toolbar class and no ids: its title is a plain TextView under an
1038
+ * android.view.View, next to a clickable navigation icon (back / menu) in the same row.
1039
+ * Measured (Salt Player 10-18): SETTINGS / ABOUT / MEDIA_SOURCE were reached 46 times and all
1040
+ * resolved unmapped. The title must sit in the top band of the window, outside any scrollable
1041
+ * container, with a clickable sibling to its left that overlaps it vertically.
1042
+ */
1043
+ export function _composeTopBarTitle(nodes, n) {
1044
+ const b = bnds(n);
1045
+ if (b.length !== 4 || !truthy(g(n, 'text'))) { return false; }
1046
+ const height = _extent(nodes)[1];
1047
+ if (!(height > 0) || b[3] > TOP_BAR_BAND * height) { return false; }
1048
+ let idx = parentOf(n);
1049
+ for (let k = 0; k < 8 && inRange(idx, nodes); k++) {
1050
+ if (truthy(g(nodes[idx], 'scrollable'))) { return false; }
1051
+ idx = parentOf(nodes[idx]);
1052
+ }
1053
+ // A centered top bar (Material CenterAlignedTopAppBar and look-alikes) puts its navigation icon
1054
+ // in another branch of the tree: a title centered on the window, with a clickable control
1055
+ // beside it in the same band, is the bar's title.
1056
+ const width = _extent(nodes)[0];
1057
+ if (width > 0 && Math.abs((b[0] + b[2]) / 2 - width / 2) <= CENTERED_TITLE_TOLERANCE * width
1058
+ && nodes.some((c) => {
1059
+ if (c === n || !truthy(g(c, 'clickable')) || !vis(c)) { return false; }
1060
+ const cb = bnds(c);
1061
+ return cb.length === 4 && cb[1] < b[3] && cb[3] > b[1] && (cb[2] <= b[0] + 2 || cb[0] >= b[2] - 2);
1062
+ })) { return true; }
1063
+ const pi = parentOf(n);
1064
+ if (!inRange(pi, nodes)) { return false; }
1065
+ // The navigation icon is a sibling of the title, or (Material3 TopAppBar wraps the title and the
1066
+ // icon in their own slot boxes) a descendant of the row one or two levels up.
1067
+ const within = (c, anc) => {
1068
+ let i = parentOf(c);
1069
+ for (let k = 0; k < 3 && inRange(i, nodes); k++) { if (i === anc) { return true; } i = parentOf(nodes[i]); }
1070
+ return false;
1071
+ };
1072
+ let scope = pi;
1073
+ for (let lvl = 0; lvl < 3 && inRange(scope, nodes); lvl++) {
1074
+ if (nodes.some((c) => {
1075
+ if (c === n || !truthy(g(c, 'clickable')) || !vis(c) || !within(c, scope)) { return false; }
1076
+ const cb = bnds(c);
1077
+ return cb.length === 4 && cb[2] <= b[0] + 2 && cb[1] < b[3] && cb[3] > b[1];
1078
+ })) { return true; }
1079
+ scope = parentOf(nodes[scope]);
1080
+ }
1081
+ // A ROOT page's bar (a home screen, a main tab) has no navigation icon: the title starts the row and
1082
+ // the bar's action icons follow it on the right, one level up (the title sits in its own slot). It is
1083
+ // the bar's title when it is the row's only text and every clickable in the row lies to its right.
1084
+ const row = parentOf(nodes[pi]);
1085
+ if (!inRange(row, nodes)) { return false; }
1086
+ const under = (c, anc) => {
1087
+ let i = parentOf(c);
1088
+ for (let k = 0; k < 4 && inRange(i, nodes); k++) { if (i === anc) { return true; } i = parentOf(nodes[i]); }
1089
+ return false;
1090
+ };
1091
+ const inRow = nodes.filter((c) => c !== n && vis(c) && under(c, row));
1092
+ const overlaps = (cb) => cb.length === 4 && cb[1] < b[3] && cb[3] > b[1];
1093
+ if (inRow.some((c) => g(c, 'class') === 'android.widget.TextView' && truthy(g(c, 'text')) && overlaps(bnds(c)))) { return false; }
1094
+ const actions = inRow.filter((c) => truthy(g(c, 'clickable')) && overlaps(bnds(c)));
1095
+ return actions.length > 0 && actions.every((c) => bnds(c)[0] >= b[2] - 2);
1096
+ }
1097
+
1098
+ /** How far (as a share of the window width) a centered top-bar title's center may sit off center. */
1099
+ export const CENTERED_TITLE_TOLERANCE = 0.03;
1100
+
1101
+ const _EXTENTS = new WeakMap();
1102
+ /** [width, height] of the window a tree covers (rightmost / lowest bound), computed once per tree. */
1103
+ function _extent(nodes) {
1104
+ let e = _EXTENTS.get(nodes);
1105
+ if (e === undefined) {
1106
+ let w = 0; let h = 0;
1107
+ for (const x of nodes) { const xb = bnds(x); if (xb.length === 4) { w = Math.max(w, xb[2]); h = Math.max(h, xb[3]); } }
1108
+ e = [w, h]; _EXTENTS.set(nodes, e);
1109
+ }
1110
+ return e;
1111
+ }
1112
+
1113
+ /** Fraction of the window height a top-bar title may reach down to. */
1114
+ export const TOP_BAR_BAND = 0.12;
1115
+
1116
+ /** _selected_tab_candidates(nodes, catalog, observation). */
1117
+ export function _selectedTabCandidates(nodes, catalog, observation) {
1118
+ const strips = [];
1119
+ nodes.forEach((n, i) => {
1120
+ if (endsWithAny(S(g(n, 'class', '')), ['HorizontalScrollView', 'TabLayout'])
1121
+ || ['tabs', 'tab_layout', 'sliding_tabs', 'tabLayout'].includes(tail(S(g(n, 'resource_id', ''))))) { strips.push(i); }
1122
+ });
1123
+ if (!strips.length) { return []; }
1124
+ const under = (i, root) => {
1125
+ for (let k = 0; k < 6; k++) {
1126
+ i = i >= 0 && i < nodes.length ? parentOf(nodes[i]) : null;
1127
+ if (i === null) { return false; }
1128
+ if (i === root) { return true; }
1129
+ }
1130
+ return false;
1131
+ };
1132
+ const selected = new Set();
1133
+ nodes.forEach((n, i) => {
1134
+ const cap = truthy(g(n, 'text')) ? g(n, 'text') : g(n, 'content_desc');
1135
+ if (truthy(g(n, 'selected')) && truthy(cap) && strips.some((s) => under(i, s))) { selected.add(normalized(cap)); }
1136
+ });
1137
+ if (selected.size !== 1) { return []; }
1138
+ const cap = [...selected][0];
1139
+ const hits = Object.keys(catalog).filter((ident) => normalized(g(catalog[ident], 'tab_label')) === cap && truthy(g(catalog[ident], 'tab_label')));
1140
+ if (hits.length !== 1) { return []; }
1141
+ return [{ static_id: hits[0], reason: 'selected-tab', anchors: [cap] }];
1142
+ }
1143
+
1144
+ /** Fewest labels a bottom row needs to be a tab bar. */
1145
+ export const TAB_BAR_MIN_LABELS = 3;
1146
+
1147
+ /**
1148
+ * A top-level tab page of a Compose pager: a centered top-bar title (no back icon, so not a bar
1149
+ * title by _composeTopBarTitle) that is also one label of the bottom tab row. A Compose
1150
+ * NavigationBar reports no `selected`, so the bar title is what names the current tab. Measured
1151
+ * (coolmall 2026-11-08): "Categories" / "Cart" tabs captured with only server data on screen stayed
1152
+ * unmapped. Among the pages titled that way, pager pages win: the standalone route sharing the
1153
+ * title (compose-route:Cart, with a back icon) does not show the tab row.
1154
+ */
1155
+ /** Text nodes of the bottom tab row: ≥ TAB_BAR_MIN_LABELS labels on one line, outside any scroller. */
1156
+ export function _bottomTabRow(nodes) {
1157
+ const [, height] = _extent(nodes);
1158
+ if (!(height > 0)) { return []; }
1159
+ const free = (n) => {
1160
+ let idx = parentOf(n);
1161
+ for (let k = 0; k < 8 && inRange(idx, nodes); k++) { if (truthy(g(nodes[idx], 'scrollable'))) { return false; } idx = parentOf(nodes[idx]); }
1162
+ return true;
1163
+ };
1164
+ // The tab row sits outside the pager; the title is the page's own, inside the (scrollable) pager.
1165
+ const bottom = nodes.filter((n) => vis(n) && truthy(g(n, 'text')) && bnds(n).length === 4
1166
+ && bnds(n)[1] >= (1 - TOP_BAR_BAND) * height && free(n));
1167
+ const mid = (n) => (bnds(n)[1] + bnds(n)[3]) / 2;
1168
+ const out = new Set();
1169
+ for (const n of bottom) {
1170
+ const row = bottom.filter((c) => Math.abs(mid(c) - mid(n)) <= 0.01 * height);
1171
+ if (row.length >= TAB_BAR_MIN_LABELS) { row.forEach((c) => out.add(c)); }
1172
+ }
1173
+ return [...out];
1174
+ }
1175
+
1176
+ /**
1177
+ * The bottom tab row's nodes when at least two of its labels are catalog tab labels: a Compose
1178
+ * NavigationBar, which inNavBar (View classes) cannot see. Measured (CoolMall 11-07): its "Cart"
1179
+ * label counted as body text of GoodsRoutes.Detail, so the reached Category tab verified as the goods
1180
+ * page and neither exact-page nor attestedArrival held. A goods page's own bottom bar
1181
+ * (Cart / Add to Cart / Buy Now) shares at most one tab label and stays body text.
1182
+ */
1183
+ export function _composeTabBarNodes(nodes, catalog) {
1184
+ const labels = new Set(Object.values(catalog).map((p) => g(p, 'tab_label')).filter((t) => truthy(t)).map(normalized));
1185
+ if (labels.size < 2) { return new Set(); }
1186
+ const row = _bottomTabRow(nodes);
1187
+ const known = row.filter((n) => labels.has(normalized(n.text)));
1188
+ return known.length >= 2 ? new Set(row) : new Set();
1189
+ }
1190
+
1191
+ export function _tabTitleCandidates(nodes, catalog, observation) {
1192
+ const [width, height] = _extent(nodes);
1193
+ if (!(width > 0 && height > 0)) { return []; }
1194
+ const texts = nodes.filter((n) => vis(n) && truthy(g(n, 'text')) && bnds(n).length === 4);
1195
+ const tabs = new Set(_bottomTabRow(nodes).map((c) => normalized(c.text)));
1196
+ if (!tabs.size) { return []; }
1197
+ const titles = new Set(texts.filter((n) => bnds(n)[3] <= TOP_BAR_BAND * height
1198
+ && Math.abs((bnds(n)[0] + bnds(n)[2]) / 2 - width / 2) <= CENTERED_TITLE_TOLERANCE * width)
1199
+ .map((n) => normalized(n.text)).filter((t) => tabs.has(t)));
1200
+ if (titles.size !== 1) { return []; }
1201
+ const title = [...titles][0];
1202
+ const hits = Object.keys(catalog).filter((ident) => g(catalog[ident], 'kind') === 'pager-page'
1203
+ && [...g(catalog[ident], 'titles', []), ...g(catalog[ident], 'hint_titles', []), g(catalog[ident], 'tab_label')]
1204
+ .some((t) => truthy(t) && normalized(t) === title)
1205
+ && _hostCompatible(catalog[ident], catalog, observation));
1206
+ return hits.length === 1 ? [{ static_id: hits[0], reason: 'tab-bar-title', anchors: [title] }] : [];
1207
+ }
1208
+
1209
+ const setKey = (xs) => JSON.stringify(sortedStr(new Set(xs)));
1210
+
1211
+ /** _own_widget_candidates(nodes, catalog, observation): identify a page by ids only its layout declares. */
1212
+ export function _ownWidgetCandidates(nodes, catalog, observation) {
1213
+ const overlay = new Set();
1214
+ const kidsOf = new Map();
1215
+ nodes.forEach((c, k) => { const p = parentOf(c); if (!kidsOf.has(p)) { kidsOf.set(p, []); } kidsOf.get(p).push(k); });
1216
+ nodes.forEach((n, i) => {
1217
+ const pi = parentOf(n);
1218
+ const p = pi !== null && pi >= 0 && pi < nodes.length ? nodes[pi] : {};
1219
+ if (!endsWithAny(S(g(p, 'class', '')), ['CoordinatorLayout', 'ViewGroup', 'FrameLayout'])) { return; }
1220
+ const siblings = (kidsOf.get(pi) ?? []).filter((k) => nodes[k] !== n).map((k) => nodes[k]);
1221
+ const nb = truthy(g(n, 'bounds')) ? n.bounds : [0, 0, 0, 0];
1222
+ const pbA = truthy(g(p, 'bounds')) ? p.bounds : [0, 0, 0, 1];
1223
+ const pbB = truthy(g(p, 'bounds')) ? p.bounds : [0, 0, 0, 0];
1224
+ if (!siblings.some((c) => bnds(c).length === 4 && c.bounds[3] <= nb[1] + 2
1225
+ && c.bounds[3] - c.bounds[1] > 0.5 * (pbA[3] - pbB[1]))) { return; }
1226
+ const pb = bnds(p); const b = bnds(n);
1227
+ if (pb.length === 4 && b.length === 4 && pb[3] - pb[1] > 0 && b[1] >= pb[1] + 0.75 * (pb[3] - pb[1])
1228
+ && b[3] - b[1] < 0.25 * (pb[3] - pb[1]) && Math.abs(b[3] - pb[3]) <= 2) {
1229
+ const stack = [i];
1230
+ while (stack.length) { const j = stack.pop(); overlay.add(j); stack.push(...(kidsOf.get(j) ?? [])); }
1231
+ }
1232
+ });
1233
+ const visible = new Set();
1234
+ nodes.forEach((n, i) => { if (truthy(g(n, 'resource_id')) && !overlay.has(i)) { visible.add(tail(S(g(n, 'resource_id', '')))); } });
1235
+ const counts = new Map(); const groups = new Map();
1236
+ for (const [ident, page] of Object.entries(catalog)) {
1237
+ const ids = g(page, 'widget_ids', []);
1238
+ if (ids.length) {
1239
+ const k = setKey(ids);
1240
+ if (!groups.has(k)) { groups.set(k, { ids: new Set(ids), members: [] }); }
1241
+ groups.get(k).members.push(ident);
1242
+ }
1243
+ }
1244
+ for (const { ids } of groups.values()) { for (const r of ids) { counts.set(r, (counts.get(r) ?? 0) + 1); } }
1245
+ const modalOpen = g(observation, 'window') === 'dialog' || nodes.some((n) =>
1246
+ ['alertTitle', 'parentPanel', 'design_bottom_sheet'].includes(tail(S(g(n, 'resource_id', '')))));
1247
+ let scored = [];
1248
+ for (const [ident, page] of Object.entries(catalog)) {
1249
+ if (['dialog', 'sheet'].includes(g(page, 'kind')) && !modalOpen) { continue; }
1250
+ const unique = sortedStr(g(page, 'widget_ids', []).filter((r) => counts.get(r) === 1 && visible.has(r)));
1251
+ const hiddenIds = g(page, 'hidden_ids', []);
1252
+ const shown = g(page, 'widget_ids', []).filter((r) => !hiddenIds.includes(r));
1253
+ const need = shown.filter((r) => counts.get(r) === 1).length === 1 ? 1 : 2;
1254
+ if (unique.length >= need && _hostCompatible(page, catalog, observation)) { scored.push([unique.length, ident, unique]); }
1255
+ }
1256
+ if (!scored.length) {
1257
+ const own = [];
1258
+ for (const [ident, page] of Object.entries(catalog)) {
1259
+ if (['dialog', 'sheet'].includes(g(page, 'kind')) && !modalOpen) { continue; }
1260
+ if (!_hostCompatible(page, catalog, observation)) { continue; }
1261
+ const ids = new Set(g(page, 'widget_ids', []));
1262
+ const informative = new Set([...ids].filter((r) => visible.has(r) && (counts.get(r) ?? 0) <= 5));
1263
+ if (informative.size >= 3) { own.push([ident, informative, ids]); }
1264
+ }
1265
+ const best = sortedBy(own, (x) => x[1].size, true);
1266
+ if (best.length) {
1267
+ const [ident, hit] = best[0];
1268
+ const superset = (a, b) => [...b].every((x) => a.has(x));
1269
+ const rivals = best.slice(1).filter(([, h, i]) => superset(h, hit) || [...i].every((x) => h.has(x)) || h.size === hit.size);
1270
+ if (!rivals.length) { return [{ static_id: ident, reason: 'best-layout-cover', anchors: sortedStr(hit) }]; }
1271
+ }
1272
+ return [];
1273
+ }
1274
+ scored = sortedBy(scored, (x) => [x[0], x[1]], true);
1275
+ const top = scored.filter((x) => x[0] === scored[0][0]);
1276
+ if (top.length > 1 && new Set(top.map(([, i]) => setKey(g(catalog[i], 'widget_ids', [])))).size === 1) {
1277
+ return top.map(([, i, u]) => ({ static_id: i, reason: 'layout-twin', anchors: u }));
1278
+ }
1279
+ if (scored.length > 1 && scored[0][0] === scored[1][0]) {
1280
+ return scored.filter((x) => x[0] === scored[0][0]).map(([, i, u]) => ({ static_id: i, reason: 'own-layout-ids', anchors: u }));
1281
+ }
1282
+ const best = scored[0];
1283
+ return [{ static_id: best[1], reason: 'own-layout-ids', anchors: best[2] }];
1284
+ }
1285
+
1286
+ /**
1287
+ * resolve_twin_by_opener(resolution, prior, catalog): layout twins (several pages inflating the
1288
+ * same layout) cannot be told apart by the screen alone, but the static graph knows which page
1289
+ * OPENS each of them. When the screen shown just before was verified as page P (or P's host /
1290
+ * panel host) and exactly one twin is opened from P, that twin is the page. Otherwise the
1291
+ * resolution is returned unchanged.
1292
+ */
1293
+ export function resolveTwinByOpener(resolution, prior, catalog) {
1294
+ const weak = g(resolution, 'status') === 'unmapped' ? (g(resolution, 'weak_candidates') || []) : [];
1295
+ if (weak.length) { return _weakByOpener(resolution, weak, prior, catalog); }
1296
+ const cands = truthy(g(resolution, 'candidates')) ? resolution.candidates : [];
1297
+ let kind = cands.length ? g(cands[0], 'reason') : null;
1298
+ // Instances of one template (`template_of`) that show one title (a cancel-reason sheet opened from
1299
+ // three pages): matched alike by any rule, they are twins when each has its own openers, none shared.
1300
+ // Measured (coolmall 2026-11-16): `overlay-lead-title-alone` on all three left the sheet unmapped.
1301
+ if (g(resolution, 'status') === 'ambiguous' && cands.length >= 2 && !['layout-twin', 'shared-title-twin'].includes(kind)
1302
+ && cands.every((c) => g(c, 'reason') === kind)) {
1303
+ const tpl = new Set(cands.map((c) => g(g(catalog, g(c, 'static_id'), {}), 'template_of') ?? null));
1304
+ const ops = cands.map((c) => new Set(g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []) || []));
1305
+ const disjoint = ops.every((s) => s.size) && ops.every((s, i) => ops.every((t, j) => i === j || ![...s].some((x) => t.has(x))));
1306
+ if (tpl.size === 1 && !tpl.has(null) && disjoint) { kind = 'layout-twin'; }
1307
+ }
1308
+ if (g(resolution, 'status') !== 'ambiguous' || cands.length < 2 || !['layout-twin', 'shared-title-twin'].includes(kind)
1309
+ || !cands.every((c) => g(c, 'reason') === cands[0].reason)) {
1310
+ return resolution;
1311
+ }
1312
+ const pr = g(prior || {}, 'static_resolution', {});
1313
+ if (g(pr, 'status') !== 'verified' || !truthy(g(pr, 'static_id'))) { return resolution; }
1314
+ const p = S(pr.static_id);
1315
+ // A shared-title twin captured again (content loaded, scrolled) is still the twin verified before
1316
+ // -- unless another twin is opened FROM it: then "stayed" and "navigated to the child" look the
1317
+ // same (measured, jingmo: riddle index and riddle read share only the title "Riddles"; after tapping
1318
+ // "Read More" the read page was kept as the index). Leave that ambiguous rather than guess.
1319
+ const childOfPrior = (c) => g(c, 'static_id') !== p
1320
+ && (g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []) || []).includes(p);
1321
+ if (kind === 'shared-title-twin' && cands.some((c) => g(c, 'static_id') === p)) {
1322
+ if (cands.some(childOfPrior)) { return resolution; }
1323
+ const c = cands.find((x) => g(x, 'static_id') === p);
1324
+ return { status: 'verified', static_id: p, reason: 'shared-title-continued',
1325
+ anchors: [...(g(c, 'anchors', []) || []), 'continued-from:' + p] };
1326
+ }
1327
+ // The opener as recorded statically: the page itself, a menu's/panel's host page.
1328
+ const openers = new Set([p]);
1329
+ const host = panelHost(p); if (host) { openers.add(host); }
1330
+ const at = p.lastIndexOf('@');
1331
+ if (p.startsWith('menu:') && at > 0) {
1332
+ const owner = p.slice(at + 1);
1333
+ for (const ident of Object.keys(catalog)) { if (ident.split(':').pop() === owner) { openers.add(ident); } }
1334
+ }
1335
+ const hit = cands.filter((c) => g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []).some((o) => openers.has(o)));
1336
+ if (hit.length !== 1) { return resolution; }
1337
+ // The opener rule assumes the device went FORWARD from P. A shared-title twin that P itself was
1338
+ // opened from may be the screen just as well -- Back (or a relaunch's replay) lands on it
1339
+ // (measured, jingmo: back from a *_bookmarks page to its index was taken as the bookmark's *_show).
1340
+ if (kind === 'shared-title-twin') {
1341
+ const parents = new Set(g(g(catalog, p, {}), 'opened_from', []) || []);
1342
+ if (cands.some((c) => parents.has(g(c, 'static_id')))) { return resolution; }
1343
+ }
1344
+ return { status: 'verified', static_id: hit[0].static_id, reason: kind === 'layout-twin' ? 'layout-twin-opener' : 'shared-title-opener',
1345
+ anchors: [...(g(hit[0], 'anchors', []) || []), 'opened-from:' + p] };
1346
+ }
1347
+
1348
+ /**
1349
+ * A screen whose only anchor is one short unique source text (an "Add" button) is that page when
1350
+ * the screen just before was verified as a page with a static edge to exactly one such candidate.
1351
+ */
1352
+ export function _weakByOpener(resolution, weak, prior, catalog) {
1353
+ const pr = g(prior || {}, 'static_resolution', {});
1354
+ if (g(pr, 'status') !== 'verified' || !truthy(g(pr, 'static_id'))) { return resolution; }
1355
+ const p = S(pr.static_id);
1356
+ // The opener, or the page itself on the capture before (its content finished loading, it
1357
+ // scrolled): the weak anchor is still the one it showed when verified.
1358
+ const hit = weak.filter((c) => g(c, 'static_id') === p
1359
+ || (g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []) || []).includes(p));
1360
+ if (hit.length !== 1) { return resolution; }
1361
+ const same = hit[0].static_id === p;
1362
+ return { status: 'verified', static_id: hit[0].static_id, reason: same ? 'weak-body-text-continued' : 'weak-body-text-opener',
1363
+ anchors: [...(g(hit[0], 'anchors', []) || []), (same ? 'continued-from:' : 'opened-from:') + p] };
1364
+ }
1365
+
1366
+ export const BACK_MAX_DEPTH = 6;
1367
+
1368
+ /**
1369
+ * back_can_reach(observation, target, catalog): may a Back press from this screen land on
1370
+ * `target`? Back can only return to a page the current one was opened from, so the target must be
1371
+ * a static ancestor (via `opened_from`, a menu's owner page, a panel's host) within
1372
+ * BACK_MAX_DEPTH hops. Unknown evidence -- screen not verified, or a catalog built without
1373
+ * `opened_from` -- answers true, keeping the plain Back-then-relaunch behaviour.
1374
+ */
1375
+ export function backCanReach(observation, target, catalog) {
1376
+ const r = g(observation || {}, 'static_resolution', {});
1377
+ if (g(r, 'status') !== 'verified' || !truthy(g(r, 'static_id')) || !truthy(target)) { return true; }
1378
+ if (!Object.values(catalog || {}).some((p) => Array.isArray(g(p, 'opened_from')))) { return true; }
1379
+ const owners = (ident) => {
1380
+ const out = new Set(g(g(catalog, ident, {}), 'opened_from', []) || []);
1381
+ const host = panelHost(ident); if (host) { out.add(host); }
1382
+ const at = S(ident).lastIndexOf('@');
1383
+ if (S(ident).startsWith('menu:') && at > 0) {
1384
+ const owner = S(ident).slice(at + 1);
1385
+ for (const k of Object.keys(catalog)) { if (k.split(':').pop() === owner) { out.add(k); } }
1386
+ }
1387
+ return out;
1388
+ };
1389
+ let frontier = new Set([S(r.static_id)]); const seen = new Set(frontier);
1390
+ for (let d = 0; d < BACK_MAX_DEPTH && frontier.size; d++) {
1391
+ const next = new Set();
1392
+ for (const id of frontier) {
1393
+ for (const o of owners(id)) {
1394
+ if (o === target) { return true; }
1395
+ if (!seen.has(o)) { seen.add(o); next.add(o); }
1396
+ }
1397
+ }
1398
+ frontier = next;
1399
+ }
1400
+ return false;
1401
+ }
1402
+
1403
+ /** Kinds that are a state of a host page, not a screen: identified by `state_rules`, never by resolvePage. */
1404
+ export const STATE_KINDS = ['ui-state', 'mode'];
1405
+
1406
+ /** state_host(ident): `ui-state:<host id>#<name>` / `mode:<host id>#<name>` -> host id, else null. */
1407
+ export function stateHost(ident) {
1408
+ const s = S(ident);
1409
+ const kind = STATE_KINDS.find((k) => s.startsWith(k + ':'));
1410
+ if (!kind || !s.includes('#')) { return null; }
1411
+ const rest = s.slice(kind.length + 1);
1412
+ return rest.slice(0, rest.lastIndexOf('#')) || null;
1413
+ }
1414
+
1415
+ /** A state anchor rule ({all, none}) with at least one positive selector, else null. */
1416
+ export function _stateRule(spec, id) {
1417
+ if (!spec || typeof spec !== 'object' || Array.isArray(spec)) { return null; }
1418
+ const sel = (xs) => (Array.isArray(xs) ? xs : []).filter((s) => s && typeof s === 'object' && !Array.isArray(s) && Object.keys(s).length);
1419
+ const all = sel(g(spec, 'all'));
1420
+ return all.length ? { id, all, none: sel(g(spec, 'none')) } : null;
1421
+ }
1422
+
1423
+ /**
1424
+ * apply_state_anchors(catalog, anchors): campaign/config anchors ({<state id>: {all, none}}) replace
1425
+ * the static ones for that state. Returns the ids that got a rule; unknown or non-state ids are ignored.
1426
+ */
1427
+ export function applyStateAnchors(catalog, anchors) {
1428
+ const applied = [];
1429
+ for (const [ident, spec] of Object.entries(anchors && typeof anchors === 'object' ? anchors : {})) {
1430
+ const item = g(catalog, ident);
1431
+ if (!item || !STATE_KINDS.includes(item.kind)) { continue; }
1432
+ const rule = _stateRule(spec, 'configured');
1433
+ if (!rule) { continue; }
1434
+ // a catalog compiled before states carried `host_node`: the id names it (`ui-state:<host>#<name>`)
1435
+ if (!truthy(item.host_node)) { item.host_node = stateHost(ident); }
1436
+ if (!truthy(item.host_node)) { continue; }
1437
+ item.state_rules = [rule]; applied.push(ident);
1438
+ }
1439
+ return applied;
1440
+ }
1441
+
1442
+ /**
1443
+ * ui_states_of(observation, catalog): the in-page states the observation shows -- each one's host is
1444
+ * the page shown and its anchor rule holds on the visible, unoccluded tree. Two states of one host
1445
+ * holding at once say nothing about either, so neither is returned.
1446
+ */
1447
+ export function uiStatesOf(observation, catalog) {
1448
+ return sortedStr([...uiStateCandidates(observation, catalog).values()].filter((ids) => ids.length === 1).flat());
1449
+ }
1450
+
1451
+ /**
1452
+ * ui_state_candidates(observation, catalog): host id -> every in-page state of that host whose anchor
1453
+ * rule holds on the observation (uiStatesOf keeps only hosts with exactly one). final_utg resolves the
1454
+ * hosts with several across the whole run: a state whose anchor holds wherever a sibling's does (its
1455
+ * anchor is the mode-tab strip, visible in every mode) is not evidence for itself there.
1456
+ */
1457
+ export function uiStateCandidates(observation, catalog) {
1458
+ const allNodes = g(observation, 'nodes', []) || [];
1459
+ if (!allNodes.length) { return new Map(); }
1460
+ const hidden = occludedIndices(allNodes);
1461
+ const nodes = allNodes.map((n, i) => (vis(n) && !hidden.has(i) ? n : { parent_index: g(n, 'parent_index'), visible: false }));
1462
+ const byHost = new Map();
1463
+ for (const [ident, item] of Object.entries(catalog || {})) {
1464
+ if (!truthy(g(item, 'state_rules')) || !truthy(g(item, 'host_node'))) { continue; }
1465
+ // a state of a state is not resolved (its host check would recurse into this one)
1466
+ if (truthy(g(g(catalog, item.host_node, {}), 'state_rules'))) { continue; }
1467
+ if (!item.state_rules.some((r) => learnedRuleMatches(nodes, r))) { continue; }
1468
+ if (!observationMatchesStatic(observation, item.host_node, catalog)[0]) { continue; }
1469
+ if (!byHost.has(item.host_node)) { byHost.set(item.host_node, []); }
1470
+ byHost.get(item.host_node).push(ident);
1471
+ }
1472
+ for (const [h, ids] of byHost) { byHost.set(h, sortedStr(ids)); }
1473
+ return byHost;
1474
+ }
1475
+
1476
+ /**
1477
+ * resolve_state_ambiguity(perCapture): perCapture = [{ cid, byHost: Map(host -> [state ids]) }].
1478
+ * Returns { assign: Map(cid -> [state ids]), nonExclusive: [{ host, state, with: [ids], captures }] }.
1479
+ *
1480
+ * A state s is non-exclusive w.r.t. a sibling t when s's anchor holds on **every** capture where
1481
+ * t's holds: s's anchor is chrome shown in t's mode too (measured: `course_current_tab`, the
1482
+ * mode-tab strip itself, anchored "My Courses" and held under Grades/Exams/Assignments too, so those three
1483
+ * captures matched two states, were assigned to none and fell back to the host as its "default").
1484
+ * The test is per sibling, so a mode that hides the strip (rows {A,B},{A,D},{C}) does not clear A.
1485
+ * s is weak when, over the siblings it is non-exclusive w.r.t., it co-holds on >= 2 captures: one
1486
+ * co-hold alone ({A},{A},{A},{A,B} with B a transient overlay of A's page) cannot tell chrome from
1487
+ * a coincidence, so that capture stays unassigned (ambiguous) instead of going to B. The threshold
1488
+ * is counted across those siblings, not per pair: each mode is often captured once (Grades/Exams/Assignments).
1489
+ * A weak s is dropped from a capture only where one of those siblings also holds; it keeps the
1490
+ * captures where it holds alone. Two states that both remain stay unassigned, as before.
1491
+ */
1492
+ export function resolveStateAmbiguity(perCapture) {
1493
+ const assign = new Map();
1494
+ const nonExclusive = [];
1495
+ const hosts = new Map();
1496
+ for (const { cid, byHost } of perCapture) {
1497
+ for (const [h, ids] of byHost) {
1498
+ if (!hosts.has(h)) { hosts.set(h, []); }
1499
+ hosts.get(h).push({ cid, ids });
1500
+ }
1501
+ }
1502
+ for (const [h, rows] of hosts) {
1503
+ const over = new Map(); // weak s -> siblings s is non-exclusive w.r.t.
1504
+ if (rows.some((r) => r.ids.length > 1)) {
1505
+ const states = sortedStr([...new Set(rows.flatMap((r) => r.ids))]);
1506
+ for (const s of states) {
1507
+ const ts = states.filter((t) => t !== s && rows.every((r) => !r.ids.includes(t) || r.ids.includes(s)));
1508
+ const coRows = rows.filter((r) => r.ids.includes(s) && r.ids.some((x) => ts.includes(x)));
1509
+ if (!ts.length || coRows.length < 2) { continue; }
1510
+ over.set(s, new Set(ts));
1511
+ nonExclusive.push({ host: h, state: s, with: ts, captures: coRows.length });
1512
+ }
1513
+ }
1514
+ for (const r of rows) {
1515
+ let ids = r.ids;
1516
+ if (ids.length > 1) { ids = ids.filter((x) => !(over.has(x) && r.ids.some((t) => over.get(x).has(t)))); }
1517
+ if (ids.length === 1) {
1518
+ if (!assign.has(r.cid)) { assign.set(r.cid, []); }
1519
+ assign.get(r.cid).push(ids[0]);
1520
+ }
1521
+ }
1522
+ }
1523
+ for (const [c, ids] of assign) { assign.set(c, sortedStr(ids)); }
1524
+ return { assign, nonExclusive };
1525
+ }
1526
+
1527
+ /** panel_host(ident): `panel:<host id>#<name>` -> host id, else null. */
1528
+ export function panelHost(ident) {
1529
+ const s = S(truthy(ident) ? ident : '');
1530
+ if (!s.startsWith('panel:') || !s.includes('#')) { return null; }
1531
+ const h = s.slice('panel:'.length);
1532
+ return h.slice(0, h.lastIndexOf('#')) || null;
1533
+ }
1534
+
1535
+ /** observation_matches_static(observation, ident, catalog) -> [matched, how]. */
1536
+ export function observationMatchesStatic(observation, ident, catalog) {
1537
+ const resolution = g(observation, 'static_resolution', {});
1538
+ const verified = g(resolution, 'status') === 'verified';
1539
+ const rsid = g(resolution, 'static_id');
1540
+ if (verified && rsid === ident) { return [true, 'exact-page']; }
1541
+ const page = g(catalog, ident, {});
1542
+ if (truthy(g(page, 'state_rules')) && truthy(g(page, 'host_node'))) {
1543
+ // Per-observation only: a capture where two states of the host hold is a mismatch here, though
1544
+ // final_utg may still assign it run-wide (resolveStateAmbiguity, a non-exclusive anchor yields).
1545
+ return uiStatesOf(observation, catalog).includes(ident) ? [true, 'ui-state-anchor'] : [false, 'ui-state-anchor-mismatch'];
1546
+ }
1547
+ if (g(page, 'kind') === 'host-activity' && g(page, 'component') === g(observation, 'activity')) { return [true, 'host-component']; }
1548
+ if (verified && g(page, 'default_children', []).includes(rsid)) { return [true, 'host-default-child']; }
1549
+ if (verified && panelHost(rsid) === ident) { return [true, 'host-of-panel']; }
1550
+ const shown = verified ? g(catalog, rsid, {}) : {};
1551
+ if (g(shown, 'default_children', []).includes(ident)) { return [true, 'default-child-of-host']; }
1552
+ const ownIds = g(page, 'widget_ids', []);
1553
+ if (ownIds.length && truthy(shown) && g(shown, 'kind') === g(page, 'kind') && setKey(g(shown, 'widget_ids', [])) === setKey(ownIds)) {
1554
+ return [true, 'layout-twin'];
1555
+ }
1556
+ const cands = truthy(g(resolution, 'candidates')) ? resolution.candidates : [];
1557
+ if (g(resolution, 'status') === 'ambiguous' && cands.length && cands.every((c) => g(c, 'reason') === 'layout-twin')
1558
+ && cands.some((c) => g(c, 'static_id') === ident)) {
1559
+ return [true, 'layout-twin'];
1560
+ }
1561
+ return [false, 'static-context-mismatch'];
1562
+ }