@buaa_smat/hometrans 26.0.5 → 26.0.6

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 (472) hide show
  1. package/README.md +249 -279
  2. package/agents/code-reviewer.md +1 -1
  3. package/dist/cli/editors.json +20 -0
  4. package/dist/platform/registry.js +1 -0
  5. package/dist/platform/validate.js +2 -1
  6. package/i18n/agents/code-reviewer.md +1 -1
  7. package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  8. package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  9. package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  10. package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  11. package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  12. package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  13. package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
  14. package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  15. package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  16. package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  17. package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  18. package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
  19. package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
  20. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
  21. package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
  22. package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
  23. package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
  24. package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
  25. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  26. package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
  27. package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
  28. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
  29. package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
  30. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
  31. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
  32. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
  33. package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
  34. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
  35. package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
  36. package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
  37. package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
  38. package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
  39. package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
  40. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
  41. package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
  42. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
  43. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
  44. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
  45. package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
  46. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
  47. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
  48. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
  49. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
  50. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
  51. package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
  52. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
  53. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
  54. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
  55. package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
  56. package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
  57. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
  58. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
  59. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
  60. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
  61. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
  62. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
  63. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
  64. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
  65. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
  66. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
  67. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
  68. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
  69. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
  70. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
  71. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
  72. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
  73. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
  74. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
  75. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
  76. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
  77. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
  78. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
  79. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
  80. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
  81. package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
  82. package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
  83. package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
  84. package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
  85. package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
  86. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
  87. package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
  88. package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
  89. package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
  90. package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
  91. package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
  92. package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
  93. package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
  94. package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
  95. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
  96. package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
  97. package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
  98. package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
  99. package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
  100. package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
  101. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
  102. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
  103. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
  104. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
  105. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
  106. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
  107. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
  108. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
  109. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
  110. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
  111. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
  112. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
  113. package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
  114. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
  115. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
  116. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
  117. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
  118. package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
  119. package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
  120. package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
  121. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
  122. package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
  123. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
  124. package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
  125. package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
  126. package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
  127. package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
  128. package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
  129. package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
  130. package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
  131. package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
  132. package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
  133. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
  134. package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
  135. package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
  136. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
  137. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
  138. package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
  139. package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
  140. package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
  141. package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
  142. package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
  143. package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
  144. package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
  145. package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
  146. package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
  147. package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
  148. package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
  149. package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
  150. package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
  151. package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
  152. package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
  153. package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
  154. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
  155. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
  156. package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
  157. package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
  158. package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
  159. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
  160. package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
  161. package/package.json +2 -1
  162. package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  163. package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  164. package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
  165. package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
  166. package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
  167. package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
  168. package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
  169. package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  170. package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  171. package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  172. package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
  173. package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
  174. package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
  175. package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
  176. package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
  177. package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  178. package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
  179. package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
  180. package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
  181. package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
  182. package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
  183. package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
  184. package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  185. package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  186. package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  187. package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  188. package/skills/a2h-app-migrate/SKILL.md +31 -14
  189. package/skills/a2h-app-migrate/references/stage-map.md +4 -2
  190. package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
  191. package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
  192. package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
  193. package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
  194. package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
  195. package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
  196. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
  197. package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
  198. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
  199. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
  200. package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
  201. package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
  202. package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
  203. package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
  204. package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
  205. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  206. package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
  207. package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
  208. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
  209. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
  210. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
  211. package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
  212. package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
  213. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
  214. package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
  215. package/skills/a2h-batch-ui-align/SKILL.md +14 -12
  216. package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
  217. package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
  218. package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
  219. package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
  220. package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
  221. package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
  222. package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
  223. package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
  224. package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
  225. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
  226. package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
  227. package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
  228. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
  229. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
  230. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
  231. package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +1 -1
  232. package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
  233. package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
  234. package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
  235. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
  236. package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
  237. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
  238. package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
  239. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
  240. package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
  241. package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
  242. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
  243. package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
  244. package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
  245. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
  246. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
  247. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
  248. package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
  249. package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
  250. package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
  251. package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
  252. package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
  253. package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
  254. package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
  255. package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
  256. package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
  257. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
  258. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
  259. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
  260. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
  261. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
  262. package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
  263. package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
  264. package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
  265. package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
  266. package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
  267. package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
  268. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
  269. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
  270. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
  271. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
  272. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
  273. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
  274. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
  275. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
  276. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
  277. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
  278. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
  279. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
  280. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
  281. package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
  282. package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
  283. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
  284. package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
  285. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
  286. package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
  287. package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
  288. package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
  289. package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
  290. package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
  291. package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
  292. package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
  293. package/skills/a2h-page-specgen/SKILL.md +36 -5
  294. package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
  295. package/skills/a2h-page-specgen/references/evidence.md +2 -1
  296. package/skills/a2h-page-specgen/references/execution-model.md +13 -5
  297. package/skills/a2h-page-specgen/references/gates.md +33 -7
  298. package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
  299. package/skills/a2h-page-specgen/references/spec-example.md +166 -32
  300. package/skills/a2h-page-specgen/references/spec-template.md +8 -5
  301. package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
  302. package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
  303. package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
  304. package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
  305. package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
  306. package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
  307. package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
  308. package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
  309. package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
  310. package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
  311. package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
  312. package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
  313. package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
  314. package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
  315. package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
  316. package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
  317. package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
  318. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
  319. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
  320. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
  321. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
  322. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
  323. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
  324. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
  325. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
  326. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
  327. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
  328. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
  329. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
  330. package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
  331. package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
  332. package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
  333. package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
  334. package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
  335. package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
  336. package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
  337. package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
  338. package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
  339. package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
  340. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
  341. package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
  342. package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
  343. package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
  344. package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
  345. package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
  346. package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
  347. package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
  348. package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
  349. package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
  350. package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
  351. package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
  352. package/skills/a2h-resource-convert/SKILL.md +1 -1
  353. package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
  354. package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
  355. package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
  356. package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
  357. package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
  358. package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
  359. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
  360. package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
  361. package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
  362. package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
  363. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
  364. package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
  365. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
  366. package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
  367. package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
  368. package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
  369. package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
  370. package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
  371. package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
  372. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
  373. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
  374. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
  375. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
  376. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
  377. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
  378. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
  379. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
  380. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
  381. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
  382. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
  383. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
  384. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
  385. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
  386. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
  387. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
  388. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
  389. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
  390. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
  391. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
  392. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
  393. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
  394. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
  395. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
  396. package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
  397. package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
  398. package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
  399. package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
  400. package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
  401. package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
  402. package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
  403. package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
  404. package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
  405. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
  406. package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
  407. package/skills/a2h-spec-generate/references/input-formats.md +1 -1
  408. package/skills/a2h-utg-explorer/SKILL.md +11 -5
  409. package/skills/a2h-utg-explorer/references/architecture.md +37 -19
  410. package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
  411. package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
  412. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
  413. package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
  414. package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
  415. package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
  416. package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
  417. package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
  418. package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
  419. package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
  420. package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
  421. package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
  422. package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
  423. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
  424. package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
  425. package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
  426. package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
  427. package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
  428. package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
  429. package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
  430. package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
  431. package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
  432. package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
  433. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
  434. package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
  435. package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
  436. package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
  437. package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
  438. package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
  439. package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
  440. package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
  441. package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
  442. package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
  443. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
  444. package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
  445. package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
  446. package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
  447. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
  448. package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
  449. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
  450. package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
  451. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
  452. package/skills/a2h-utg-static/SKILL.md +3 -3
  453. package/skills/a2h-utg-static/references/extractors.md +7 -0
  454. package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
  455. package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
  456. package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
  457. package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
  458. package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
  459. package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
  460. package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
  461. package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
  462. package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
  463. package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
  464. package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
  465. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
  466. package/resource/convert_pipeline_process.svg +0 -114
  467. package/resource/project_architecture.svg +0 -120
  468. package/resource/set_environment.png +0 -0
  469. package/resource/set_multimodel.png +0 -0
  470. package/skills/a2h-app-migrate/references/specs.example.json +0 -19
  471. package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
  472. package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
@@ -29,6 +29,8 @@ import { valuesDirRank, loadStringTables as loadStrings, deviceTextsIn, MAX_DEVI
29
29
 
30
30
  export { valuesDirRank };
31
31
  import { panelRoutes } from './panel_routes.mjs';
32
+ import { annotateHosts } from './utg_explorer/hosts.mjs';
33
+ import { coveredStaticIds } from './utg_explorer/coverage.mjs';
32
34
 
33
35
  // ------------------------------------------------------------------ small python helpers
34
36
 
@@ -350,6 +352,25 @@ export function hintLabel(step) {
350
352
  return label;
351
353
  }
352
354
 
355
+ /**
356
+ * ambiguousHintLabels(step, targetNode): the opener labels an nl_hint gives when the click path
357
+ * marks its label ambiguous (`label_ambiguous`). The path could not attribute the trigger, so the
358
+ * label it recorded may be a sibling control's or the overlay's own title; the hint names the
359
+ * gesture. Its 〔id:X〕 and quoted texts are the alternatives; the overlay's own title is dropped
360
+ * (a title is not an opener). -> {ids, words}
361
+ */
362
+ export function ambiguousHintLabels(step, targetNode = {}) {
363
+ const hint = pyStr(or(get(step, 'nl_hint'), ''));
364
+ const ids = reFindall('〔id:(\\w+)〕', hint).map((x) => pyStr(x));
365
+ const titles = new Set([
366
+ get(targetNode, 'label'),
367
+ ...or(get(get(targetNode, 'expected', {}), 'title_any', []), []),
368
+ ...or(get(targetNode, 'aliases', []), []),
369
+ ].filter(truthy).map((x) => pyStrip(pyStr(x))));
370
+ const words = quotedOf(hint).map((x) => pyStrip(x)).filter((x) => x && !titles.has(x));
371
+ return { ids, words };
372
+ }
373
+
353
374
  const afterFirst = (s, sep) => { const i = s.indexOf(sep); return i < 0 ? s : s.slice(i + sep.length); };
354
375
 
355
376
  /**
@@ -392,7 +413,7 @@ export function compileReplayStep(step, catalog) {
392
413
  truthy(get(step, 'trigger_id')) ? [step.trigger_id] : [], [get(step, 'label_key')]);
393
414
  const common = { selectors: choices, static_label: label, target_id: get(step, 'target_id') };
394
415
  const typed = (type) => (choices.length ? [{ type, ...common }, null] : [null, 'missing-replay-selector']);
395
- if (['tap', 'click', 'open-overlay', 'navigate'].includes(action)) { return typed('click_candidates'); }
416
+ if (['tap', 'click', 'navigate', ...TAP_MECHANISMS].includes(action)) { return typed('click_candidates'); }
396
417
  if (['long-press', 'long_press', 'long-click', 'long_click'].includes(action)) { return typed('long_click_candidates'); }
397
418
  if (['double-tap', 'double_tap', 'double-click', 'double_click'].includes(action)) { return typed('double_tap_candidates'); }
398
419
  // click_paths normalises a drawer swipe to `swipe-right`/`swipe-left` (direction in the action
@@ -523,6 +544,36 @@ export function replayRoute(ctx, here, step, atLaunch = false) {
523
544
  return null;
524
545
  }
525
546
 
547
+ /**
548
+ * The gesture another host gives for the same trigger: an edge into the same target with the same
549
+ * static trigger (`onClick@file:line`) from another source, whose click path ends with that source ->
550
+ * target step, or whose nl_hints edge hint names it. A shared composable's panel rendered by two
551
+ * routes has one trigger and one gesture; the click path exists for only one host. -> {step, source}
552
+ * or null. Only a trigger with a file:line counts: a bare mechanism is not the same view.
553
+ */
554
+ export function sharedTriggerStep(ctx, edge) {
555
+ const trig = pyStr(or(get(edge, 'trigger'), ''));
556
+ if (!/@.+:\d+$/.test(trig)) { return null; }
557
+ const target = get(edge, 'target'); const source = get(edge, 'source');
558
+ for (const other of or(ctx.edges, [])) {
559
+ if (other === edge || get(other, 'target') !== target || get(other, 'source') === source
560
+ || pyStr(or(get(other, 'trigger'), '')) !== trig) { continue; }
561
+ const steps = get(g(ctx.paths, target, {}), 'steps', []);
562
+ if (steps.length >= 2 && get(steps[steps.length - 2], 'target_id') === other.source) {
563
+ return { step: steps[steps.length - 1], source: other.source };
564
+ }
565
+ const hint = g(ctx.edgeHints, `${pyStr(other.source)}|${pyStr(target)}|${trig}`, null);
566
+ if (truthy(get(hint, 'nl_hint'))) {
567
+ return { step: { nl_hint: hint.nl_hint, label_source: 'code-name', action: or(get(hint, 'action'), 'tap'),
568
+ target_id: target, _edge_hint: true }, source: other.source };
569
+ }
570
+ }
571
+ return null;
572
+ }
573
+
574
+ /** Mechanisms whose static trigger is a tap on the source page (compiled as a click). */
575
+ export const TAP_MECHANISMS = ['open-overlay', 'compose-navigate', 'surface-switch'];
576
+
526
577
  /** next(p for p in phases if sorted(p.requires) == want) or null. */
527
578
  const phaseWith = (campaign, want) => get(campaign, 'phases', []).find((p) => arrEq(sortedStr(p.requires), want)) ?? null;
528
579
 
@@ -574,6 +625,13 @@ function compileEdge(ctx, edge, i) {
574
625
  targetStep = { nl_hint: edgeHint.nl_hint, label_source: 'code-name', action: or(get(edgeHint, 'action'), 'tap'),
575
626
  target_id: target, _edge_hint: true };
576
627
  }
628
+ // One trigger rendered by several hosts (a shared composable's panel): the gesture a sibling host's
629
+ // click path or nl_hint gives for that same trigger is this edge's gesture too.
630
+ let gestureFrom = null;
631
+ if (!truthy(targetStep) && !truthy(label) && !truthy(triggerId) && !truthy(get(edgeHint, 'not_clickable'))) {
632
+ const shared = sharedTriggerStep(ctx, edge);
633
+ if (shared) { targetStep = shared.step; gestureFrom = shared.source; }
634
+ }
577
635
  let sourcePath = g(paths, source, {});
578
636
  let replay = []; const issues = [];
579
637
  if (!has(paths, source)) { issues.push('missing-source-path'); }
@@ -681,7 +739,7 @@ function compileEdge(ctx, edge, i) {
681
739
  }
682
740
  return compileEdgeTail(ctx, { edge, i, source, target, u, ue, label, triggerId, instructionStep, targetStep, issues,
683
741
  replay, sourceLaunch, sourceContext, expected, req, taskPre, assigned, phase, automatic, edgeActionRaw, resourceNames, selectors,
684
- launchChain, launchPage, route });
742
+ launchChain, launchPage, route, gestureFrom });
685
743
  }
686
744
 
687
745
  /**
@@ -727,23 +785,35 @@ function compileEdgeTail(ctx, s) {
727
785
  }
728
786
  }
729
787
  if (!automatic && truthy(targetStep) && !truthy(triggerId)) {
730
- const prev = truthy(get(targetStep, '_edge_hint')) ? null : tailHint(get(g(paths, target, {}), 'steps', []));
731
- const hinted = hintedPrefix(dictWith(targetStep, { _prev_hint: prev }));
732
- if (hinted !== null) {
733
- const [prefix, last, reason] = hinted;
734
- if (truthy(reason)) {
735
- issues.push(reason); selectors = [];
736
- } else if (last[0] === 'automatic') {
737
- automatic = true;
738
- } else {
739
- prelude = prefix; hintKind = last[0];
740
- if (last[1] === null) {
741
- label = null; selectors = null;
742
- listAction = compiledHintStep(last[0], null, target);
743
- } else if (pyStr(last[1]).startsWith('id:')) {
744
- label = null; selectors = [{ resource_name: last[1].slice(3) }];
788
+ // The click path could not attribute this trigger (`label_ambiguous`): its recorded label is
789
+ // untrustworthy (a sibling control's or the overlay's own title). The path's nl_hint names the
790
+ // gesture, so take its id / quoted texts as the opener, in order, instead of the recorded label.
791
+ const ambiguous = truthy(get(targetStep, 'label_ambiguous'))
792
+ ? ambiguousHintLabels(targetStep, ctx.staticNodes.get(target) ?? {}) : null;
793
+ if (ambiguous !== null && (ambiguous.ids.length || ambiguous.words.length)) {
794
+ // The hint's last quoted text is the control (hintSteps / hintLabel convention); an
795
+ // explanatory 「即「X」」 makes X the real button, earlier quotes the fallbacks.
796
+ if (ambiguous.words.length) { label = ambiguous.words[ambiguous.words.length - 1]; }
797
+ selectors = selectorCandidates(label, ambiguous.words.slice(0, -1), ambiguous.ids, [get(targetStep, 'label_key')]);
798
+ } else {
799
+ const prev = truthy(get(targetStep, '_edge_hint')) ? null : tailHint(get(g(paths, target, {}), 'steps', []));
800
+ const hinted = hintedPrefix(dictWith(targetStep, { _prev_hint: prev }));
801
+ if (hinted !== null) {
802
+ const [prefix, last, reason] = hinted;
803
+ if (truthy(reason)) {
804
+ issues.push(reason); selectors = [];
805
+ } else if (last[0] === 'automatic') {
806
+ automatic = true;
745
807
  } else {
746
- label = last[1]; selectors = selectorCandidates(label, last[2] ?? []);
808
+ prelude = prefix; hintKind = last[0];
809
+ if (last[1] === null) {
810
+ label = null; selectors = null;
811
+ listAction = compiledHintStep(last[0], null, target);
812
+ } else if (pyStr(last[1]).startsWith('id:')) {
813
+ label = null; selectors = [{ resource_name: last[1].slice(3) }];
814
+ } else {
815
+ label = last[1]; selectors = selectorCandidates(label, last[2] ?? []);
816
+ }
747
817
  }
748
818
  }
749
819
  }
@@ -809,7 +879,10 @@ function compileEdgeTail(ctx, s) {
809
879
  source_launch: sourceLaunch, replay, prelude, task_preconditions: taskPre, action,
810
880
  ...(launchChain.length ? { launch_chain: launchChain, ...(launchPage !== null ? { launch_page: launchPage } : {}) } : {}),
811
881
  status: issues.length ? 'needs_external' : 'compiled', compile_issues: issues,
812
- provenance: { static_edge_index: i, mechanism: get(edge, 'mechanism'), trigger: get(edge, 'trigger'), ui_hint: get(ue, 'hint') },
882
+ provenance: { static_edge_index: i, mechanism: get(edge, 'mechanism'), trigger: get(edge, 'trigger'), ui_hint: get(ue, 'hint'),
883
+ ...(s.gestureFrom ? { gesture_from_host: s.gestureFrom } : {}),
884
+ // a surface-switch edge flips this composable state flag of its host route
885
+ ...(truthy(get(u, 'state_flag')) ? { state_flag: u.state_flag } : {}) },
813
886
  };
814
887
  ctx.byKey.set(keyStr, task);
815
888
  return task;
@@ -893,6 +966,9 @@ export function main(argv = process.argv.slice(2)) {
893
966
  }
894
967
  tasks = [...tasks, ...routeTasks];
895
968
  }
969
+ // One target opened from several hosts: the cheapest host (already verified, fewest data
970
+ // preconditions) runs first, and each task names the others for the runner's host retry.
971
+ tasks = annotateHosts(tasks, coveredStaticIds(campaign));
896
972
  campaign.tasks = tasks;
897
973
  for (const p of get(campaign, 'phases', [])) { p.task_count = tasks.filter((t) => t.phase === p.id).length; }
898
974
  atomicWriteText(pJoin(root, 'campaign.json'), jsonDumps(campaign, { ensure_ascii: false, indent: 2 }));
@@ -4,7 +4,12 @@
4
4
  * local fixture server.
5
5
  *
6
6
  * Exports: DOC, deps (deps.DeviceAdapter, replaceable in tests like patching
7
- * utg_explorer.adapters.DeviceAdapter), snapshot, guessType, makeServer, serve, main
7
+ * utg_explorer.adapters.DeviceAdapter), snapshot, initial, restoreInitial, guessType,
8
+ * makeServer, serve, main
9
+ *
10
+ * Every snapshot taken here is recorded in the campaign's states.json with its landing (the
11
+ * screen a cold launch shows on that data), so a recipe author and recover_d see what a base
12
+ * holds instead of guessing from its name (utg_explorer/states.mjs).
8
13
  *
9
14
  * serve(): Python's ThreadingHTTPServer + SimpleHTTPRequestHandler reproduced on node:net so the
10
15
  * bytes on the wire match (HTTP/1.0 status line, header order and spelling, one request per
@@ -24,6 +29,8 @@ import {
24
29
  atomicWriteText, exitFor,
25
30
  } from './utg_explorer/_py.mjs';
26
31
  import { AdapterError, DeviceAdapter, tarProblem } from './utg_explorer/adapters.mjs';
32
+ import { landingSummary, loadStates, noteLive, recordState } from './utg_explorer/states.mjs';
33
+ import { resolvePage } from './utg_explorer/semantics.mjs';
27
34
  import {
28
35
  deviceLock, DeviceBusy, lockWait, DEVICE_UNAVAILABLE_EXIT, grantRuntimePermissions,
29
36
  } from './utg_explorer/task_runner.mjs';
@@ -36,11 +43,25 @@ Recovery D builds a data state inside the app starting from a snapshot under
36
43
  campaign, so without this step every D recipe is rejected ("base snapshot
37
44
  missing") and apply cannot even start.
38
45
 
46
+ d_prereqs.py initial --config <config.json>
47
+ before any campaign action: archive the app data the device was handed over
48
+ with as <snapshot_dir>/initial.tar (run-as; every data-dir entry but cache,
49
+ code_cache and lib), cold-launch and record its landing in states.json as state
50
+ "initial". An app that has no data yet (installed, never launched) is recorded
51
+ as empty: restore-initial then clears its data. Without run-as the data cannot be archived:
52
+ it is recorded as live-only and config.user_state_protected is set, after which
53
+ every clear_app_data / restore_app_data is refused. Never runs twice
54
+ d_prereqs.py restore-initial --config <config.json>
55
+ restore initial.tar, clearing every data-dir entry first (end of the cycle: the
56
+ device goes back as it came)
39
57
  d_prereqs.py snapshot --config <config.json> [--name fresh]
40
58
  debuggable build: pm clear, launch once, save private data as <snapshot_dir>/<name>.tar
41
59
  (an existing .tar that is not a whole archive is moved to *.corrupt-<ms> and retaken)
42
60
  otherwise: write <snapshot_dir>/<name>.replay.json (empty chain = cleared
43
61
  data), so D rebuilds states by \`pm clear\` + replay. Never overwrites.
62
+ Refused (mode "none") while config.user_state_protected is set: pm clear would
63
+ lose the handed-over data. Run before "initial" (by hand, or a campaign resumed from before that
64
+ stage), it runs initial first, so pm clear never comes before the archive
44
65
  d_prereqs.py serve <dir> --config <config.json> [--port N] [--host 127.0.0.1]
45
66
  serve <dir> over HTTP for the device; foreground -- run it in the background
46
67
  for the whole cycle. The port is --port, else the one config.fixture_server_url
@@ -96,16 +117,27 @@ export function snapshot(configPath, name = 'fresh', settle = 6.0) {
96
117
  };
97
118
  const have = found();
98
119
  if (have) { return have; }
120
+ const campaign = pParent(pResolve(configPath));
121
+ // pm clear must never be the first data change: run alone (by hand, or a campaign resumed from
122
+ // before the initial stage) the handed-over data is archived first, or protected when it cannot be.
123
+ let config2 = config;
124
+ if (!loadStates(campaign).states.some((s) => s.id === 'initial')) {
125
+ initial(configPath, settle);
126
+ config2 = jsonLoads(readText(configPath, { encoding: 'utf-8' }));
127
+ }
128
+ // pm clear would destroy the data the device was handed over with: it could not be archived.
129
+ if (get(config2, 'user_state_protected') === true) {
130
+ return { snapshot: null, created: false, mode: 'none', why: 'user-state-protected: the original app data has no archive, so no pm clear' };
131
+ }
99
132
  const serial = get(config, 'serial');
100
133
  if (!serial) { throw new AdapterError('Explicit serial required to avoid controlling the wrong device'); }
101
- const campaign = pParent(pResolve(configPath));
102
134
  try {
103
135
  return deviceLock(serial, () => {
104
136
  // another campaign may have taken this snapshot while we waited for the lock
105
137
  const taken = found();
106
138
  if (taken) { return taken; }
107
139
  const device = new deps.DeviceAdapter(config, pJoin(campaign, 'artifacts'));
108
- try { return takeSnapshot(device, config, snapDir, name, settle); } finally { device.close?.(); }
140
+ try { return takeSnapshot(device, config2, snapDir, name, settle, campaign); } finally { device.close?.(); }
109
141
  }, lockWait(config, campaign));
110
142
  } catch (e) {
111
143
  if (!(e instanceof DeviceBusy)) { throw e; }
@@ -114,7 +146,7 @@ export function snapshot(configPath, name = 'fresh', settle = 6.0) {
114
146
  }
115
147
  }
116
148
 
117
- function takeSnapshot(device, config, snapDir, name, settle) {
149
+ function takeSnapshot(device, config, snapDir, name, settle, campaign = null) {
118
150
  let mode = get(config, 'snapshot_mode', 'auto');
119
151
  if (!['auto', 'tar', 'replay'].includes(mode)) {
120
152
  throw new SystemExit(`snapshot_mode must be auto, tar or replay, got ${pyRepr(mode)}`);
@@ -140,9 +172,158 @@ function takeSnapshot(device, config, snapDir, name, settle) {
140
172
  device.act({ type: 'launch', component: config.launch_component, restart: true });
141
173
  sleep(Number(settle));
142
174
  device.act({ type: 'snapshot_app_data', archive });
175
+ if (campaign) {
176
+ // The device now holds first-launch data: record what that data lands on.
177
+ const landing = coldLanding(device, config, campaign, settle, `snapshot:${name}`);
178
+ recordState(campaign, { id: name, origin: name === 'fresh' ? 'fresh' : 'snapshot', archive, restorable: true, landing });
179
+ noteLive(campaign, name, `d_prereqs snapshot ${name}`);
180
+ }
143
181
  return { snapshot: archive, created: true, mode: 'tar', bytes: fs.statSync(archive).size };
144
182
  }
145
183
 
184
+ /** Cold-launch the app and summarize the screen it lands on, resolved against the campaign catalog. */
185
+ function coldLanding(device, config, campaign, settle, env) {
186
+ device.act({ type: 'launch', component: config.launch_component, restart: true });
187
+ sleep(Number(settle));
188
+ const obs = device.observe(env);
189
+ let catalog = {};
190
+ try { catalog = get(jsonLoads(readText(pJoin(campaign, 'campaign.json'), { encoding: 'utf-8' })), 'page_catalog', {}) || {}; } catch { catalog = {}; }
191
+ try { obs.static_resolution = resolvePage(obs, catalog, get(obs, 'identity'), { app_package: get(config, 'package') }); } catch { /* landing stays unresolved */ }
192
+ return landingSummary(obs);
193
+ }
194
+
195
+ /**
196
+ * Earlier initial.tar files kept aside (`.prev-<ms>`, `.corrupt-<ms>`): never deleted, so they add up
197
+ * when initial is retried. {kept_aside, kept_aside_bytes} for the result, and one stderr line to clean up.
198
+ */
199
+ function asideOf(snapDir) {
200
+ let names = [];
201
+ try { names = fs.readdirSync(snapDir).filter((n) => /^initial\.tar\.(?:prev|corrupt)-\d+$/.test(n)).sort(); } catch { return {}; }
202
+ if (!names.length) { return {}; }
203
+ let bytes = 0;
204
+ for (const n of names) { try { bytes += fs.statSync(pJoin(snapDir, n)).size; } catch { /* gone */ } }
205
+ pyPrintErr(`initial: ${names.length} earlier initial.tar kept aside in ${snapDir} (${Math.round(bytes / 1048576)} MB); `
206
+ + 'delete them once no campaign needs them: ' + names.join(', '));
207
+ return { kept_aside: names, kept_aside_bytes: bytes };
208
+ }
209
+
210
+ /**
211
+ * initial(configPath): state "initial" = the app data the device was handed over with, taken
212
+ * before the campaign changes anything. Archived when run-as is available; otherwise recorded as
213
+ * live-only and config.user_state_protected is set (no later clear/restore may run). Idempotent.
214
+ */
215
+ export function initial(configPath, settle = 6.0) {
216
+ const config = jsonLoads(readText(configPath, { encoding: 'utf-8' }));
217
+ const campaign = pParent(pResolve(configPath));
218
+ const known = loadStates(campaign).states.find((s) => s.id === 'initial');
219
+ if (known) { return { state: 'initial', created: false, restorable: !!known.restorable }; }
220
+ const serial = get(config, 'serial');
221
+ if (!serial) { throw new AdapterError('Explicit serial required to avoid controlling the wrong device'); }
222
+ if (!get(config, 'snapshot_dir')) {
223
+ config.snapshot_dir = pJoin(campaign, 'snapshots');
224
+ atomicWriteText(configPath, jsonDumps(config, { ensure_ascii: false, indent: 2 }));
225
+ }
226
+ const snapDir = pathStr(config.snapshot_dir);
227
+ try {
228
+ return deviceLock(serial, () => {
229
+ const device = new deps.DeviceAdapter(config, pJoin(campaign, 'artifacts'));
230
+ try {
231
+ let archive = null;
232
+ let empty = false;
233
+ if (device.runAsAvailable()) {
234
+ pMkdir(snapDir, { parents: true, exist_ok: true });
235
+ archive = pJoin(snapDir, 'initial.tar');
236
+ // An initial.tar this campaign has not recorded is not its handed-over data: snapshot_dir may be
237
+ // shared with an earlier campaign of the same app, whose archive holds that campaign's data. This
238
+ // campaign has changed nothing yet, so the device holds its data now: the old file is kept aside
239
+ // (never deleted) and the archive taken again. A torn one left by a crashed initial goes the same way.
240
+ if (pExists(archive)) {
241
+ const bad = tarProblem(pathStr(archive));
242
+ const aside = `${archive}.${bad ? 'corrupt' : 'prev'}-${Date.now()}`;
243
+ fs.renameSync(archive, aside);
244
+ pyPrintErr(`initial ${archive}: ${bad ?? 'not recorded by this campaign'}; moved to ${aside}, taking it again`);
245
+ }
246
+ // every top-level entry but cache: a login may live in app_webview, no_backup, app_flutter
247
+ if (!pExists(archive)) {
248
+ if (device.appDataEntries().length) { device.act({ type: 'snapshot_app_data', archive }); } else { archive = null; empty = true; }
249
+ }
250
+ }
251
+ const landing = coldLanding(device, config, campaign, settle, 'snapshot:initial');
252
+ // An app that never ran has no data to lose: recorded as empty (restore-initial clears it),
253
+ // not restorable as a state to enter (that is "fresh"), and no protection is needed.
254
+ recordState(campaign, { id: 'initial', origin: 'initial', archive, restorable: archive !== null, landing, ...(empty ? { empty: true } : {}) });
255
+ // An emulator is a disposable test device: allow the unarchived wipe unless opted out.
256
+ const wipe = get(config, 'allow_unarchived_wipe');
257
+ const emulator = /^emulator-/.test(String(get(config, 'serial', '') ?? ''));
258
+ if (archive === null && !empty && wipe !== true && (wipe === false || !emulator)) {
259
+ const cfg = jsonLoads(readText(configPath, { encoding: 'utf-8' }));
260
+ cfg.user_state_protected = true;
261
+ atomicWriteText(configPath, jsonDumps(cfg, { ensure_ascii: false, indent: 2 }));
262
+ }
263
+ if (empty) { return { state: 'initial', created: true, restorable: true, empty: true, why: 'the app had no data yet: restore-initial clears it', ...asideOf(snapDir) }; }
264
+ const unarchived = wipe === true || emulator
265
+ ? 'run-as unavailable: original data not archived; allow_unarchived_wipe (or an emulator) lets later clears wipe it'
266
+ : 'run-as unavailable: original data kept live-only; clear/restore disabled (config.user_state_protected)';
267
+ return { state: 'initial', created: true, restorable: archive !== null,
268
+ ...(archive === null ? { why: unarchived } : { archive }), ...asideOf(snapDir) };
269
+ } finally { device.close?.(); }
270
+ }, lockWait(config, campaign));
271
+ } catch (e) {
272
+ if (!(e instanceof DeviceBusy)) { throw e; }
273
+ pyPrintErr(`initial blocked: ${e.message}`);
274
+ throw new SystemExit(DEVICE_UNAVAILABLE_EXIT);
275
+ }
276
+ }
277
+
278
+ /** restoreInitial(configPath): put the handed-over data back (no-op when it was never archived). */
279
+ export function restoreInitial(configPath) {
280
+ const config = jsonLoads(readText(configPath, { encoding: 'utf-8' }));
281
+ const campaign = pParent(pResolve(configPath));
282
+ const s = loadStates(campaign).states.find((x) => x.id === 'initial');
283
+ const archived = !!s && !!s.restorable && !!s.archive && pExists(pathStr(s.archive));
284
+ // both branches below clear app data: never on a device the config does not name
285
+ if (((s && s.empty) || archived) && !get(config, 'serial')) {
286
+ throw new AdapterError('Explicit serial required to avoid controlling the wrong device');
287
+ }
288
+ if (s && s.empty) {
289
+ // handed over before its first launch: clearing the data puts it back
290
+ try {
291
+ return deviceLock(get(config, 'serial'), () => {
292
+ const device = new deps.DeviceAdapter(config, pJoin(campaign, 'artifacts'));
293
+ try {
294
+ device.act({ type: 'clear_app_data' });
295
+ // pm clear revoked every grant; then a launch, as the archived branch does
296
+ grantRuntimePermissions(device, config);
297
+ device.act({ type: 'launch', component: config.launch_component, restart: true });
298
+ noteLive(campaign, null, 'd_prereqs restore-initial (empty: cleared)');
299
+ return { restored: true, empty: true };
300
+ } finally { device.close?.(); }
301
+ }, lockWait(config, campaign));
302
+ } catch (e) {
303
+ if (!(e instanceof DeviceBusy)) { throw e; }
304
+ pyPrintErr(`restore-initial blocked: ${e.message}`);
305
+ throw new SystemExit(DEVICE_UNAVAILABLE_EXIT);
306
+ }
307
+ }
308
+ if (!archived) { return { restored: false, why: s ? 'initial not archived' : 'no initial state' }; }
309
+ try {
310
+ return deviceLock(get(config, 'serial'), () => {
311
+ const device = new deps.DeviceAdapter(config, pJoin(campaign, 'artifacts'));
312
+ try {
313
+ // every entry the archive could hold, so no later state's data stays next to the handed-over one
314
+ device.act({ type: 'restore_app_data', archive: pathStr(s.archive), clear_dirs: 'all' });
315
+ device.act({ type: 'launch', component: config.launch_component, restart: true });
316
+ noteLive(campaign, 'initial', 'd_prereqs restore-initial');
317
+ return { restored: true, archive: pathStr(s.archive) };
318
+ } finally { device.close?.(); }
319
+ }, lockWait(config, campaign));
320
+ } catch (e) {
321
+ if (!(e instanceof DeviceBusy)) { throw e; }
322
+ pyPrintErr(`restore-initial blocked: ${e.message}`);
323
+ throw new SystemExit(DEVICE_UNAVAILABLE_EXIT);
324
+ }
325
+ }
326
+
146
327
  // ------------------------------------------------------------------ mimetypes (CPython 3.13)
147
328
 
148
329
  // mimetypes._types_map_default (strict) of CPython 3.13.3.
@@ -599,8 +780,15 @@ export function main(argv = process.argv.slice(2)) {
599
780
  c.add_argument('--wait', { type: toFloat, default: 15.0 });
600
781
  const r = sub.add_parser('release');
601
782
  r.add_argument('--config', { required: true });
783
+ const i = sub.add_parser('initial');
784
+ i.add_argument('--config', { required: true });
785
+ i.add_argument('--settle', { type: toFloat, default: 6.0 });
786
+ const ri = sub.add_parser('restore-initial');
787
+ ri.add_argument('--config', { required: true });
602
788
  const a = ap.parse_args(argv);
603
789
  if (a.mode === 'snapshot') { pyPrint(jsonDumps(snapshot(a.config, a.name, a.settle))); }
790
+ else if (a.mode === 'initial') { pyPrint(jsonDumps(initial(a.config, a.settle))); }
791
+ else if (a.mode === 'restore-initial') { pyPrint(jsonDumps(restoreInitial(a.config))); }
604
792
  else if (a.mode === 'check') {
605
793
  return check(a.config, a.wait).then((out) => { pyPrint(jsonDumps(out)); if (!out.ok) { process.exitCode = 1; } },
606
794
  (e) => { if (e instanceof SystemExit) { exitFor(e); } throw e; });
@@ -145,6 +145,7 @@ export function buildFinal(doc, root, staticDoc = null) {
145
145
  }
146
146
  const captures = {}; const observationLookup = new Map(); const nodeLookup = new Map(); const variantLookup = new Map();
147
147
  const foreign = new Map();
148
+ const unreliable = { count: 0, candidates: new Map() };
148
149
  const viewportLookup = new Map(); const issues = [];
149
150
  const actionToAfter = new Map();
150
151
  for (const event of doc.events) {
@@ -208,6 +209,22 @@ export function buildFinal(doc, root, staticDoc = null) {
208
209
  foreign.set(pkg, (foreign.get(pkg) ?? 0) + 1);
209
210
  return;
210
211
  }
212
+ // A dump that showed nothing usable of a non-blank screen (task_runner treeUnreliableResolution):
213
+ // no page can be read from it, so it is no dynamic node either. Counted in one issue; a capture the
214
+ // running task expected to be its target is listed on that node as an unconfirmed candidate.
215
+ if (get(resolution, 'status') === 'tree-unreliable' && !swept) {
216
+ if (observationLookup.has(key)) { return; }
217
+ observationLookup.set(key, o);
218
+ unreliable.count += 1;
219
+ const want = get(resolution, 'candidate_for');
220
+ if (truthy(want) && nodes.has(vk(want))) {
221
+ const ev = nodes.get(vk(want)).evidence;
222
+ (ev.candidate_captures ??= []).push({ observation_id: oid, environment_id: env, basis: 'tree-unreliable',
223
+ screenshot: asset(get(get(o, 'artifacts', {}), 'screenshot')) });
224
+ unreliable.candidates.set(want, (unreliable.candidates.get(want) ?? 0) + 1);
225
+ }
226
+ return;
227
+ }
211
228
  let ident = get(resolution, 'status') === 'verified' ? get(resolution, 'static_id') : null;
212
229
  if (swept) { ident = sweep.static_id; }
213
230
  if (!nodes.has(vk(ident))) { ident = null; }
@@ -258,6 +275,10 @@ export function buildFinal(doc, root, staticDoc = null) {
258
275
  for (const [pkg, count] of [...foreign].sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0))) {
259
276
  issues.push({ kind: 'foreign-package-observations', package: pkg, count });
260
277
  }
278
+ if (unreliable.count) {
279
+ issues.push({ kind: 'tree-unreliable-observations', count: unreliable.count,
280
+ candidates: Object.fromEntries([...unreliable.candidates].sort((a, b) => (a[0] < b[0] ? -1 : 1))) });
281
+ }
261
282
  assignUiStates({ nodes, captures, stateCandidates, sweeps, nodeLookup, issues, stateCatalog });
262
283
  return buildFinalTail(doc, { baseline, staticDoc, nodes, links, edgeLookup, captures, observationLookup, nodeLookup, issues, sweeps });
263
284
  }
@@ -185,7 +185,7 @@ export function panelRoutes(graph, project) {
185
185
  edges.forEach((e, idx) => {
186
186
  const args = e?.args ?? {};
187
187
  if (args.trigger_id || args.view_id || !e?.source || !e?.target) { return; }
188
- if (['open-overlay', 'close-overlay'].includes(e.mechanism)) { return; }
188
+ if (['open-overlay', 'close-overlay', 'surface-switch'].includes(e.mechanism)) { return; }
189
189
  const key = `${e.source}|${e.target}`;
190
190
  untriggered.set(key, [...(untriggered.get(key) ?? []), idx]);
191
191
  const route = edgeRoute(e);
@@ -106,6 +106,17 @@ export function pathRequirements(ident, paths, byId, hints) {
106
106
  return req;
107
107
  }
108
108
 
109
+ /**
110
+ * bypassNodeIds(legacy): ids the legacy plan marks out of coverage (level BYPASS or phase
111
+ * BYPASS_*: a paywall, an orphan). No obligation is planned for them, so the campaign carries the
112
+ * list for audit/report to leave them out of the denominator (a bypassed page is not a gap).
113
+ */
114
+ export function bypassNodeIds(legacy) {
115
+ return sortedStr(get(truthy(legacy) ? legacy : {}, 'nodes', [])
116
+ .filter((n) => get(n, 'level') === 'BYPASS' || pyStr(get(n, 'phase', '')).startsWith('BYPASS_'))
117
+ .map((n) => pyStr(get(n, 'id'))).filter(Boolean));
118
+ }
119
+
109
120
  /** compile_plan(src, environment='default', legacy=None, paths=None) -> phases. */
110
121
  export function compilePlan(src, environment = 'default', legacy = null, paths = null) {
111
122
  const nodes = get(src, 'nodes', []); const edges = links(src);
@@ -287,6 +298,8 @@ export function main(argv = process.argv.slice(2)) {
287
298
  const doc = jsonLoads(readText(pJoin(out, 'campaign.json'), { encoding: 'utf-8' }));
288
299
  const [legacy, paths] = loadPrior();
289
300
  const [added, grown] = extendPlan(doc, compilePlan(src, a.environment, legacy, paths));
301
+ doc.bypass_nodes = sortedStr(new Set([...(Array.isArray(get(doc, 'bypass_nodes')) ? doc.bypass_nodes : []),
302
+ ...bypassNodeIds(legacy)]));
290
303
  // resolved over the newer static UTG: --extend keeps the campaign's node snapshot
291
304
  applyScope(doc, a.scope, nodes, edges);
292
305
  atomicWriteText(pJoin(out, 'campaign.json'), jsonDumps(doc, { ensure_ascii: false, indent: 2 }));
@@ -297,7 +310,9 @@ export function main(argv = process.argv.slice(2)) {
297
310
  if (pExists(pJoin(out, 'campaign.json'))) { throw new SystemExit('Campaign exists; choose a new directory to preserve evidence'); }
298
311
  const [legacy, paths] = loadPrior();
299
312
  const phases = compilePlan(src, a.environment, legacy, paths);
300
- const doc = { schema: 'utg-campaign/1', campaign_id: uuid4(), static_utg: pResolve(a.static_utg), phases, nodes, edges, events: [] };
313
+ const bypass = bypassNodeIds(legacy);
314
+ const doc = { schema: 'utg-campaign/1', campaign_id: uuid4(), static_utg: pResolve(a.static_utg), phases, nodes, edges, events: [],
315
+ ...(bypass.length ? { bypass_nodes: bypass } : {}) };
301
316
  applyScope(doc, a.scope, nodes, edges);
302
317
  atomicWriteText(pJoin(out, 'campaign.json'), jsonDumps(doc, { ensure_ascii: false, indent: 2 }));
303
318
  writeText(pJoin(out, 'plan.md'), '# UTG campaign\n\n' +