@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
@@ -207,6 +207,49 @@ function functionWindow(text, sendEnd) {
207
207
  return { start, text: text.slice(start, sendEnd) };
208
208
  }
209
209
 
210
+ /**
211
+ * The current declaration's source range, when HomeGraph recorded it.
212
+ *
213
+ * A byte window around the call (`callStart - 8000`) is not a function scope:
214
+ * for a Java method it reaches back into the file head (`import …model.X`
215
+ * matched the `model.` state pattern) and forward into the *next* method (whose
216
+ * `onResponse` lines became this operation's response branches). Bounding every
217
+ * scan by the enclosing declaration keeps one operation inside one function.
218
+ */
219
+ /**
220
+ * Pick the declaration that encloses `line` from rows ordered nearest-first.
221
+ *
222
+ * `endOf` returns a row's recorded end line, or null when the graph stores no range. A row whose
223
+ * body ended before the line is not an enclosing declaration: returning it would truncate every
224
+ * forward scan (response spans, state reads, transforms) to an empty or misattributed window.
225
+ * When no row carries a range at all, the legacy nearest-row answer is kept for older graphs.
226
+ */
227
+ export function selectEnclosingRow(rows, endOf, line) {
228
+ if (!Array.isArray(rows) || rows.length === 0) return null;
229
+ if (typeof endOf !== "function") return rows[0];
230
+ let sawRange = false;
231
+ for (const row of rows) {
232
+ const end = endOf(row);
233
+ if (end === null || end === undefined) continue;
234
+ sawRange = true;
235
+ if (end >= line) return { ...row, end_line: end };
236
+ }
237
+ return sawRange ? null : rows[0];
238
+ }
239
+
240
+ function nodeBounds(text, node) {
241
+ if (!node || !Number.isInteger(node.start_line)) return { start: null, end: null };
242
+ const start = offsetAtLine(text, node.start_line);
243
+ const endLine = Number.isInteger(node.end_line) ? node.end_line : null;
244
+ const end = endLine === null
245
+ ? null
246
+ : Math.min(text.length, offsetAtLine(text, endLine + 1));
247
+ return {
248
+ start: start === Number.MAX_SAFE_INTEGER ? null : start,
249
+ end: end === null || end === Number.MAX_SAFE_INTEGER ? null : end,
250
+ };
251
+ }
252
+
210
253
  function stateReads(uri, text, start, end, callStart = start, maskedText = maskNonCode(text)) {
211
254
  const window = functionWindow(text.slice(0, end), end - start);
212
255
  const base = start + window.start;
@@ -219,7 +262,12 @@ function stateReads(uri, text, start, end, callStart = start, maskedText = maskN
219
262
  ];
220
263
  for (const pattern of patterns) {
221
264
  for (const match of body.matchAll(pattern)) {
222
- const line = lineAt(text, base + match.index);
265
+ const offset = base + match.index;
266
+ // Declaration imports are not reads: `import …model.PlaceInfo;` matches
267
+ // the `model.` pattern but never reaches the wire.
268
+ const lineStart = text.lastIndexOf("\n", offset) + 1;
269
+ if (/^\s*(?:import|package)\b/.test(text.slice(lineStart, offset))) continue;
270
+ const line = lineAt(text, offset);
223
271
  reads.set(`${line}:${match[1]}`, ref(uri, line));
224
272
  }
225
273
  }
@@ -255,17 +303,38 @@ function transforms(uri, text, start, end) {
255
303
  return [...transforms.values()].sort((a, b) => a.span.start - b.span.start);
256
304
  }
257
305
 
258
- function responseSpans(uri, text, sendEnd) {
259
- const end = Math.min(text.length, sendEnd + 2500);
306
+ /**
307
+ * Response-branch spans after the send.
308
+ *
309
+ * The audit maps a closed role vocabulary to semantic categories
310
+ * (`callback`→ui-result, `promise`→ui-result, `complete`→reset,
311
+ * `response-interceptor`→state-transition); a span with no role becomes a
312
+ * `semantic-response-role-unknown` that keeps the page partial. So only lines
313
+ * that actually are a branch are emitted, each with its role: a plain
314
+ * `try (ResponseBody …)` or `if (!response.isSuccessful())` is a line inside the
315
+ * branch, not the branch.
316
+ */
317
+ function responseRole(line) {
318
+ if (/\.\s*(?:then|catch|finally)\s*[({]/.test(line)) return "promise";
319
+ if (/\b(?:interceptor|Interceptor)\b/.test(line)) return "response-interceptor";
320
+ if (/\bcomplete\b/.test(line)) return "complete";
321
+ if (/\b(?:onResponse|onSuccess|onFailure|success|failure)\b/.test(line)) return "callback";
322
+ return null;
323
+ }
324
+
325
+ function responseSpans(uri, text, sendEnd, limit = null) {
326
+ const end = Math.min(text.length, limit ?? sendEnd + 2500);
260
327
  const body = text.slice(sendEnd, end);
261
328
  const spans = [];
262
329
  let offset = 0;
263
330
  for (const line of body.split(/(?<=\n)/)) {
264
- if (/\b(?:response|result|onSuccess|success)\b|\.data\b|\.then\s*\(|\bawait\b/.test(line)) {
265
- spans.push(ref(uri, lineAt(text, sendEnd + offset)));
331
+ const role = responseRole(line);
332
+ if (role !== null) {
333
+ const span = ref(uri, lineAt(text, sendEnd + offset));
334
+ spans.push({ ...span, role });
266
335
  }
267
336
  offset += line.length;
268
- if (spans.length >= 20) break;
337
+ if (spans.length >= 5) break;
269
338
  }
270
339
  return spans;
271
340
  }
@@ -370,9 +439,11 @@ function candidateFromCall({
370
439
  readSource = null, readMaskedSource = null, maskedText = undefined, callerNode = null,
371
440
  }) {
372
441
  const constructor = constructorFor({ uri, text, callStart, callEnd });
373
- const stateStart = Math.max(0, callStart - 8000);
374
- const stateReadSpans = stateReads(uri, text, stateStart, callEnd + 1, callStart, maskedText);
375
- const transformSpans = transforms(uri, text, stateStart, callEnd + 1);
442
+ const bounds = nodeBounds(text, callerNode);
443
+ const stateStart = bounds.start ?? Math.max(0, callStart - 8000);
444
+ const stateEnd = bounds.end ?? callEnd + 1;
445
+ const stateReadSpans = stateReads(uri, text, stateStart, stateEnd, callStart, maskedText);
446
+ const transformSpans = transforms(uri, text, stateStart, stateEnd);
376
447
  const send = lineRef(uri, text, callStart, callEnd + 1);
377
448
  const encoding = requestEncoding({ db, readSource, readMaskedSource, uri, text, callStart, callEnd, callerNode });
378
449
  const isPartial = partial || encoding.partial;
@@ -388,7 +459,7 @@ function candidateFromCall({
388
459
  transform_spans: transformSpans,
389
460
  encode_span: encoding.span ?? constructor,
390
461
  send_span: send,
391
- response_spans: responseSpans(uri, text, callEnd + 1),
462
+ response_spans: responseSpans(uri, text, callEnd + 1, bounds.end),
392
463
  status: isPartial ? "partial" : "discovered",
393
464
  unknown: isPartial ? (encoding.unknown ?? discoveryUnknown()) : null,
394
465
  };
@@ -623,6 +694,34 @@ function graphLocators(items) {
623
694
 
624
695
  const OPERATION_FUNCTION_KINDS = new Set(["function", "method"]);
625
696
  const OPERATION_CLASS_KINDS = new Set(["class", "interface", "struct"]);
697
+
698
+ /**
699
+ * `contains` is HomeGraph's membership edge, and JVM sources emit it as
700
+ * type -> member (`class MainActivity --contains--> method onCreate`). A page
701
+ * whose declaration resolves to a class node therefore cannot reach its own
702
+ * `onCreate` unless this direction is followed; the previous rule only allowed
703
+ * callable -> type and left such a visit stuck on the seed (observed on a Java
704
+ * app: every page seeded a class, `reachable` stayed 1, and every request call
705
+ * site was gated away as "not page-owned"). Inner/local classes emit the
706
+ * opposite direction and must keep working too.
707
+ *
708
+ * `file` and `namespace` are excluded on purpose: they contain every
709
+ * declaration of a compilation unit, so following them would promote one
710
+ * page's ownership to the whole file.
711
+ */
712
+ const OPERATION_CONTAINER_KINDS = new Set([
713
+ ...OPERATION_CLASS_KINDS, "object", "enum", ...OPERATION_FUNCTION_KINDS,
714
+ ]);
715
+ const OPERATION_CONTAINED_KINDS = new Set([
716
+ ...OPERATION_CONTAINER_KINDS, "field", "constant", "variable", "property",
717
+ "enum_member", "constructor", "type_alias", "annotation",
718
+ ]);
719
+
720
+ function traversableContains(row) {
721
+ return OPERATION_CONTAINER_KINDS.has(row.source_kind)
722
+ && OPERATION_CONTAINED_KINDS.has(row.target_kind);
723
+ }
724
+
626
725
  const OPERATION_REACH_LIMIT = 500;
627
726
 
628
727
  /** Resolve callable ownership without promoting file/class reachability to method reachability. */
@@ -633,10 +732,15 @@ function operationFunctionGraph({ page, db }) {
633
732
  reachable,
634
733
  enclosingNode: () => null,
635
734
  get partial() { return failed; },
735
+ get truncated() { return false; },
736
+ get deadEnd() { return false; },
636
737
  };
637
738
  if (!db || typeof db.prepare !== "function") return empty;
638
739
  let seeds;
639
740
  let declaredSeed;
741
+ let declaredEnclosingType;
742
+ let declaredEnclosingTypeEnd = null;
743
+ let enclosingEnd = null;
640
744
  let outgoing;
641
745
  let enclosing;
642
746
  try {
@@ -646,12 +750,36 @@ function operationFunctionGraph({ page, db }) {
646
750
  AND kind IN ('function', 'method', 'class', 'interface', 'struct')
647
751
  ORDER BY id ASC
648
752
  `);
753
+ // `declared_at` names the line where the page is declared. Prefer the exact
754
+ // declaration that starts there; when the artifact recorded an inner line
755
+ // (an `entry<...> { Route() }` body, an annotation line), fall back only to
756
+ // an enclosing *type*. A shared navigation builder function is deliberately
757
+ // rejected: it encloses every sibling route in the file, so seeding it
758
+ // pulls sibling screens and VMs into this page's closure and burns the
759
+ // traversal budget before the page's own path is visited.
649
760
  declaredSeed = db.prepare(`
650
761
  SELECT id FROM nodes
651
762
  WHERE file_path = ? AND start_line = ?
652
763
  AND kind IN ('function', 'method', 'class', 'interface', 'struct')
653
764
  ORDER BY id ASC
654
765
  `);
766
+ declaredEnclosingType = db.prepare(`
767
+ SELECT id, start_line FROM nodes
768
+ WHERE file_path = ? AND start_line <= ?
769
+ AND kind IN ('class', 'interface', 'struct', 'object', 'enum')
770
+ ORDER BY start_line DESC, id ASC
771
+ `);
772
+ // HomeGraph exposes the body range, so a type that merely *precedes* the
773
+ // line (an unrelated earlier class, or an anonymous listener that ended
774
+ // before it) is rejected. Candidates are walked from nearest to farthest
775
+ // because type ranges nest: the first one that still contains the line is
776
+ // the innermost enclosing type. Without range information the fallback
777
+ // fails closed — the exact match above stays the only seed.
778
+ try {
779
+ declaredEnclosingTypeEnd = db.prepare("SELECT end_line FROM nodes WHERE id = ?");
780
+ } catch {
781
+ declaredEnclosingTypeEnd = null;
782
+ }
655
783
  outgoing = db.prepare(`
656
784
  SELECT e.target AS target, e.kind AS kind,
657
785
  n1.kind AS source_kind, n2.kind AS target_kind
@@ -667,41 +795,70 @@ function operationFunctionGraph({ page, db }) {
667
795
  WHERE file_path = ? AND kind IN ('function', 'method')
668
796
  AND start_line IS NOT NULL AND start_line <= ?
669
797
  ORDER BY start_line DESC, id ASC
670
- LIMIT 1
671
798
  `);
799
+ // The enclosing declaration's end bounds every scan for the operation, so a
800
+ // Java method no longer reads the file head or the next method's response
801
+ // lines. Absent column (fixtures, older graphs) keeps the byte-window path.
802
+ try {
803
+ enclosingEnd = db.prepare("SELECT end_line FROM nodes WHERE id = ?");
804
+ } catch {
805
+ enclosingEnd = null;
806
+ }
672
807
  } catch {
673
808
  failed = true;
674
809
  return empty;
675
810
  }
676
811
 
677
812
  const queue = [];
813
+ const seedIds = new Set();
814
+ let truncated = false;
678
815
  const enqueue = id => {
679
- if (!nonEmpty(id) || reachable.has(id) || reachable.size >= OPERATION_REACH_LIMIT) return;
816
+ if (!nonEmpty(id) || reachable.has(id)) return false;
817
+ if (reachable.size >= OPERATION_REACH_LIMIT) { truncated = true; return false; }
680
818
  reachable.add(id);
681
819
  queue.push(id);
820
+ return true;
682
821
  };
683
822
  const labels = [...new Set([page.label, page.fqn, page.qualified_name,
684
823
  nonEmpty(page.page_id) ? page.page_id.replace(/^[^:]*:/, "") : null].filter(nonEmpty))];
685
824
  try {
686
825
  for (const label of labels) {
687
- for (const row of seeds.all(label, label)) enqueue(row.id);
826
+ for (const row of seeds.all(label, label)) { seedIds.add(row.id); enqueue(row.id); }
688
827
  }
689
828
  const declaredFile = firstLocator(page.declared_at, page.source_file);
690
829
  const declaredLine = /:(\d+)(?:-\d+)?$/.exec(String(page.declared_at ?? ""))?.[1];
691
830
  if (declaredFile !== null && declaredLine !== undefined) {
692
- for (const row of declaredSeed.all(declaredFile, Number(declaredLine))) enqueue(row.id);
831
+ const exact = declaredSeed.all(declaredFile, Number(declaredLine));
832
+ // Walk enclosing-type candidates from nearest to farthest and take the
833
+ // first whose recorded body still covers the line. `declaredEnclosingTypeEnd`
834
+ // being null means the graph exposes no ranges: fail closed rather than
835
+ // accept a type that may not contain the line.
836
+ let enclosingType = [];
837
+ if (exact.length === 0 && declaredEnclosingTypeEnd !== null) {
838
+ for (const row of declaredEnclosingType.all(declaredFile, Number(declaredLine))) {
839
+ let end;
840
+ try {
841
+ end = declaredEnclosingTypeEnd.get(row.id)?.end_line;
842
+ } catch {
843
+ break;
844
+ }
845
+ if (end === null || end === undefined) break;
846
+ if (end >= Number(declaredLine)) { enclosingType = [row]; break; }
847
+ }
848
+ }
849
+ for (const row of [...exact, ...enclosingType]) {
850
+ seedIds.add(row.id);
851
+ enqueue(row.id);
852
+ }
693
853
  }
694
- let traversed = 0;
695
- while (queue.length > 0 && traversed < OPERATION_REACH_LIMIT) {
854
+ // The budget bounds *nodes*, not edge inspections: counting duplicate
855
+ // edges made the traversal stop while nodes were still queued, which
856
+ // silently cut a page's own call path off in a dense navigation graph.
857
+ while (queue.length > 0) {
696
858
  const source = queue.shift();
697
859
  for (const row of outgoing.all(source)) {
698
- if (row.kind === "contains"
699
- && (!OPERATION_FUNCTION_KINDS.has(row.source_kind) || !OPERATION_CLASS_KINDS.has(row.target_kind))) {
700
- continue;
701
- }
860
+ if (row.kind === "contains" && !traversableContains(row)) continue;
702
861
  enqueue(row.target);
703
- traversed += 1;
704
- if (traversed >= OPERATION_REACH_LIMIT) break;
705
862
  }
706
863
  }
707
864
  } catch {
@@ -712,9 +869,27 @@ function operationFunctionGraph({ page, db }) {
712
869
  return {
713
870
  reachable,
714
871
  get partial() { return failed; },
872
+ get truncated() { return truncated; },
873
+ /**
874
+ * The seeds were resolved but no edge expanded them. A page whose call
875
+ * closure is only its own seed cannot own any shared-file call site, so a
876
+ * gated-away call site here is a seeding/shape problem, not "no requests".
877
+ * A page with a normal closure never reports this, which keeps pages that
878
+ * genuinely issue no requests out of partial delivery.
879
+ */
880
+ get deadEnd() { return !failed && seedIds.size > 0 && reachable.size <= seedIds.size; },
715
881
  enclosingNode(uri, callStart, text) {
716
882
  try {
717
- return enclosing.get(uri, lineAt(text, callStart)) ?? null;
883
+ const line = lineAt(text, callStart);
884
+ const rows = enclosing.all(uri, line);
885
+ // A call site outside every recorded body (field initializer, init block, graph gap)
886
+ // must not borrow the previous method: its end bound would make the response slice
887
+ // empty and misplace the state/transform scan in another function's tail.
888
+ return selectEnclosingRow(
889
+ rows,
890
+ enclosingEnd === null ? null : (row) => enclosingEnd.get(row.id)?.end_line ?? null,
891
+ line,
892
+ );
718
893
  } catch {
719
894
  failed = true;
720
895
  return null;
@@ -1223,8 +1398,8 @@ function applyRequestMutations(options, interceptors) {
1223
1398
  return { ...state, partial };
1224
1399
  }
1225
1400
 
1226
- function operationUnknown(reason, nextAction) {
1227
- return { scope: "operation", reason, next_action: nextAction };
1401
+ function operationUnknown(reason, nextAction, detail = {}) {
1402
+ return { ...detail, scope: "operation", reason, next_action: nextAction };
1228
1403
  }
1229
1404
 
1230
1405
  function unsupportedUniCandidate(page, extension) {
@@ -1390,10 +1565,21 @@ export function pageModulePrefixes(values = []) {
1390
1565
  *
1391
1566
  * Ecosystems without feature-module paths (uni-app `src/pages/...`, small
1392
1567
  * fixtures) keep the previous "every candidate belongs to the page" contract.
1568
+ *
1569
+ * `ownersOf` (the run's page-owner index) settles the case the module prefix
1570
+ * cannot: an abstract base method fans out to every override, so reachability
1571
+ * puts a sibling page's request in this page's closure even when both live in
1572
+ * the same feature module. When the file's owner set is non-empty and does not
1573
+ * include this page, the operation belongs to the page(s) that do own it, so it
1574
+ * is `external` here.
1393
1575
  */
1394
- export function operationOwner({ uri, modulePrefixes = [], callerFiles = [] }) {
1395
- if (modulePrefixes.length === 0) return "page";
1576
+ export function operationOwner({ uri, modulePrefixes = [], callerFiles = [], pageId = null, ownersOf = null }) {
1396
1577
  const file = String(uri ?? "").replace(/\\/g, "/");
1578
+ if (typeof ownersOf === "function" && nonEmpty(pageId)) {
1579
+ const owners = ownersOf(file);
1580
+ if (owners instanceof Set && owners.size > 0 && !owners.has(pageId)) return "external";
1581
+ }
1582
+ if (modulePrefixes.length === 0) return "page";
1397
1583
  if (modulePrefixes.some(prefix => file.startsWith(prefix))) return "page";
1398
1584
  if (file.startsWith("core/")
1399
1585
  && callerFiles.some(caller => modulePrefixes.some(prefix =>
@@ -1411,6 +1597,7 @@ export function discoverOperations({
1411
1597
  endpoints = [],
1412
1598
  query = null,
1413
1599
  footprint = new Map(),
1600
+ resolveOwners = null,
1414
1601
  maskImpl = maskNonCode,
1415
1602
  } = {}) {
1416
1603
  if (!Array.isArray(pages)) throw new TypeError("discoverOperations: pages must be an array");
@@ -1473,6 +1660,10 @@ export function discoverOperations({
1473
1660
  const queried = queryCalls({ page, endpoints, query });
1474
1661
  const called = dbCalls({ page, db });
1475
1662
  const functionGraph = operationFunctionGraph({ page, db });
1663
+ // Truncation only matters for a call site whose admission depended on the
1664
+ // reachable set (a footprint-only file). Files in `locators` are scanned
1665
+ // regardless, so a truncated graph cannot hide their call sites and must not
1666
+ // downgrade them.
1476
1667
  const graphPartial = () => queried.partial || called.partial || functionGraph.partial;
1477
1668
  const graphItems = [...queried.items, ...called.items];
1478
1669
  const ownershipPrefixes = pageModulePrefixes([
@@ -1493,6 +1684,15 @@ export function discoverOperations({
1493
1684
  if (!locators.has(locator)) footprintOnly.add(locator);
1494
1685
  locators.add(locator);
1495
1686
  }
1687
+ // Contract-only call targets are not SourceUnits, but an HTTP builder or a
1688
+ // UI adapter there can still own the page's transport/UI contract. Scan
1689
+ // them with the same operation extractor so a call-only client cannot hide
1690
+ // a request.
1691
+ for (const target of asArray(footprintEntry?.contractCalls?.targets)) {
1692
+ const locator = firstLocator(target?.locator);
1693
+ if (locator === null || isExcludedEvidencePath(locator)) continue;
1694
+ locators.add(locator);
1695
+ }
1496
1696
  // Direct transport facts belong to the file that performs the operation.
1497
1697
  // They can add a producer file, but never turn its declaration into a call.
1498
1698
  for (const endpoint of asArray(endpoints)) {
@@ -1501,6 +1701,12 @@ export function discoverOperations({
1501
1701
  }
1502
1702
 
1503
1703
  const candidates = new Map();
1704
+ // Call sites that were found in current bytes but dropped as "not owned by
1705
+ // this page". A non-zero count with zero surviving candidates is a
1706
+ // reachability problem, not a page without requests, so it must be visible.
1707
+ // Keyed by (uri, offset): an endpoint without a function name rescans the
1708
+ // same file once per endpoint record, and the same call must count once.
1709
+ const gatedSites = new Set();
1504
1710
  for (const uri of [...locators].filter(nonEmpty).sort(cmp)) {
1505
1711
  const text = readSource(uri);
1506
1712
  if (text === null) continue;
@@ -1517,24 +1723,59 @@ export function discoverOperations({
1517
1723
  for (const call of directCalls({ text, endpoint, maskedText: readMaskedSource(uri) })) {
1518
1724
  const enclosing = functionGraph.enclosingNode(uri, call.start, text);
1519
1725
  if (footprintOnly.has(uri)
1520
- && (enclosing === null || !functionGraph.reachable.has(enclosing.id))) continue;
1726
+ && (enclosing === null || !functionGraph.reachable.has(enclosing.id))) {
1727
+ gatedSites.add(`${uri}:${call.start}`);
1728
+ continue;
1729
+ }
1521
1730
  const candidate = candidateFromCall({
1522
- page, uri, text, callStart: call.start, callEnd: call.end, partial: graphPartial(),
1731
+ page, uri, text, callStart: call.start, callEnd: call.end,
1732
+ // Only a call site that needed the reachable set is affected by a
1733
+ // truncated traversal.
1734
+ partial: graphPartial() || (footprintOnly.has(uri) && functionGraph.truncated),
1523
1735
  db, readSource, readMaskedSource, maskedText: readMaskedSource(uri), callerNode: enclosing,
1524
1736
  });
1737
+ if (candidate.status === "partial" && !graphPartial()
1738
+ && footprintOnly.has(uri) && functionGraph.truncated
1739
+ && candidate.unknown?.reason === "operation-discovery-partial"
1740
+ && candidate.unknown.cause === undefined) {
1741
+ candidate.unknown = { ...candidate.unknown, cause: "reach-truncated" };
1742
+ }
1525
1743
  const callerFiles = enclosing !== null && operationCallers !== null
1526
1744
  ? operationCallers.all(enclosing.id).map(row => row.file_path)
1527
1745
  : [];
1528
1746
  candidate.owner = operationOwner({
1529
1747
  uri, modulePrefixes: ownershipPrefixes, callerFiles,
1748
+ pageId: page.page_id, ownersOf: resolveOwners,
1530
1749
  });
1531
1750
  if (!candidates.has(candidate.operation_id)) candidates.set(candidate.operation_id, candidate);
1532
1751
  }
1533
1752
  }
1534
1753
  }
1754
+ const gatedOut = gatedSites.size;
1535
1755
  if (candidates.size === 0 && graphPartial()) {
1536
1756
  const candidate = partialCandidate(page);
1537
1757
  candidates.set(candidate.operation_id, candidate);
1758
+ } else if (candidates.size === 0 && gatedOut > 0 && functionGraph.truncated) {
1759
+ // The traversal hit its node cap, so a gated call site may be reachable in
1760
+ // truth. Report the real cause instead of "dynamic request resolution".
1761
+ const candidate = partialCandidate(page);
1762
+ candidate.unknown = operationUnknown(
1763
+ "operation-discovery-partial",
1764
+ "The page's call closure was truncated at the reach limit; raise the budget or narrow the seeds, then rerun operation discovery",
1765
+ { cause: "reach-truncated", gated_call_sites: gatedOut },
1766
+ );
1767
+ candidates.set(candidate.operation_id, candidate);
1768
+ } else if (candidates.size === 0 && gatedOut > 0 && functionGraph.deadEnd) {
1769
+ // The seeds resolved to declarations that expand to nothing, so every
1770
+ // request call site in this page's footprints was gated away. Do not
1771
+ // publish a silent "this page issues no requests".
1772
+ const candidate = partialCandidate(page);
1773
+ candidate.unknown = operationUnknown(
1774
+ "operation-ownership-unresolved",
1775
+ "The page's call closure never expands past its seeds; fix the page declaration/seed or reachability, then rerun operation discovery",
1776
+ { cause: "page-reachability", gated_call_sites: gatedOut },
1777
+ );
1778
+ candidates.set(candidate.operation_id, candidate);
1538
1779
  }
1539
1780
  result.set(page.page_id, [...candidates.values()].sort((a, b) => cmp(a.operation_id, b.operation_id)));
1540
1781
  }
@@ -376,11 +376,12 @@ export function renderPrompt(group, units, pages, plan) {
376
376
  const page = pages.get(pageId);
377
377
  const label = page?.label ? ` (${page.label})` : "";
378
378
  prompt += `- ${pageId}${label}:\n`;
379
- for (const file of ["composition.json", "candidates.json", "assertions.json", "unknowns.json"]) {
379
+ for (const file of ["composition.json", "candidates.json", "assertions.json", "unknowns.json", "contracts.json"]) {
380
380
  prompt += ` - \`evidence/${stemOf(pageId)}/${file}\`\n`;
381
381
  }
382
382
  }
383
383
  prompt += `Do not edit anything under \`evidence/\`.\n`;
384
+ prompt += `\`contracts.json\` is read-only evidence for HTTP/UI/persistence contracts reached on the call graph; every URL, query parameter, response field and UI constructor it records must enter the SPEC or become an explicit unknown.\n`;
384
385
  prompt += `The global fact base lives under \`${outDir}/facts/\`:\n`;
385
386
  prompt += `- symbols.json: {symbols: [...]}\n`;
386
387
  prompt += `- entities.json, endpoints.json, stores.json, strings.json, libs.json\n`;
@@ -400,9 +401,11 @@ export function renderPrompt(group, units, pages, plan) {
400
401
  prompt += `Work in this order on every attempt:\n`;
401
402
  prompt += `1. Read interaction_scans and locate the failed and truncated units: Inspect interaction_scans for every SourceUnit. A record whose status is not ok, or whose truncated flag is true, is the unit this attempt must reconsider first.\n`;
402
403
  prompt += `2. Read each SourceUnit and the related resources it needs: first read the page evidence ledger (composition / candidates / assertions / unknowns) and the source; the source is authoritative for values and branches. Read embedded content, folded overlays, and the same source reused across pages; one file may be both a host page's embedded unit and an overlay page's body, and assertions and reviews still follow page ownership.\n`;
403
- prompt += `3. Add semantic assertions and candidate_ids[]: candidate_ids[] must retain every source of a merged promoted candidate. Do not keep just one.\n`;
404
+ prompt += `3. Add semantic assertions and candidate_ids[]: candidate_ids[] must retain every source of a merged promoted candidate. Do not keep just one.\n`; // The scanner only sees listener registration; name the gap instead of ignoring it.
405
+ prompt += `For interactions the scanner cannot see, follow references/behavior-ledger.md section 2.4: every interactive view either has an assertion or a waiver reason; signal_count=0 does not mean "no interaction".\n`;
406
+
404
407
  prompt += `4. Write each SourceUnit conclusion and the complete assertion_ids: The only completed conclusions are assertions-found and no-assertions-found. assertion_ids must exactly cover every assertion attributed to the SourceUnit.\n`;
405
- prompt += `5. Write an explicit resolution for every fully reviewed truncated unit and every composition unknown: A reviewed truncated SourceUnit closes only through an explicit resolved resolution; every unresolved scope:"composition" entry in \`unknowns.json\` also needs its own \`resolved\` or \`no-user-observable\` record with current evidence. Omitting them leaves composition open and keeps the page partial.\n`;
408
+ prompt += `5. Write an explicit resolved resolution for every fully reviewed truncated unit. A reviewed truncated SourceUnit closes only through an explicit resolved resolution. Composition unknowns fall into two classes: a reason:"unresolved-source-unit" reference gap is resolved by fixing the source reference and then writing a resolution, or it stays partial; a cause:"source-unit-limit" gap is producer-reserved, so never write any resolution for it. The same applies to contract-call-deferred and contract-evidence-limit contract unknowns. Such a resolution never closes the gap, only leaves a diagnostic; the page publishes partial, and only a producer-side change (wider bound or page split) can remove it.\n`;
406
409
  prompt += `6. Settle candidate dispositions and planned dispositions: A terminal candidate review requires a terminal disposition; supported / refuted / insufficient reviews must be disposed, a promoted review needs a promotions record, and a waived review needs a legal reason and current evidence. pending or failed candidates stay undisposed and keep the page partial, so never write a disposition before the review completes. Every assertion needs a terminal disposition.\n`;
407
410
  prompt += `7. Write each page's static discovery to \`behavior/attempt-{{attempt}}/${group.group_id}/discovery.json\` in \`group.pages\` order, persisting each page before moving to the next. Never write \`gen.mjs\` or any unified generator.\n`;
408
411
  prompt += `8. Run the pre-audit: \`node scripts/behavior-audit.mjs ${outDir} pre ${group.group_id} --attempt {{attempt}}\`; when it fails, fix discovery.json and rerun.\n`;
@@ -420,6 +423,7 @@ export function renderPrompt(group, units, pages, plan) {
420
423
  prompt += `\n## Body discipline\n\n`;
421
424
  prompt += `Scenario prose (\`summary\` and \`scenarios\`) is read by both a reviewer and the downstream coder:\n`;
422
425
  prompt += `it carries the user-perceivable behaviour AND the data facts needed to implement it.\n`;
426
+ prompt += `Before writing any value, answer three questions: where it comes from, how it is processed, where it is consumed; missing one means it is not written.\n`;
423
427
  prompt += `- no class or method names; data field, key, parameter, and enum names keep their source spelling\n`;
424
428
  prompt += `- no file:line references\n`;
425
429
  prompt += `- no framework type names (Activity, Fragment, ViewModel, etc.)\n`;
@@ -438,7 +442,8 @@ export function renderPrompt(group, units, pages, plan) {
438
442
  prompt += ` comes from a Room @Entity, also write the \`operations\` array (each item carries the method and\n`;
439
443
  prompt += ` function fields, taken from the same-named fields in entities.json)\n`;
440
444
  prompt += `- \`rules\`: conversion formulas, boundary values, rounding and formatting rules, written as\n`;
441
- prompt += ` statements a coder can follow\n\n`;
445
+ prompt += ` statements a coder can follow; every coefficient, offset, threshold and enum value in them\n`;
446
+ prompt += ` must reach the steps in the shape the steps state it\n\n`;
442
447
  prompt += `Contracts come from entities.json / endpoints.json / stores.json under \`facts/\` and from the\n`;
443
448
  prompt += `evidence slices; the \`scenarios[].contracts\` field structure is in \`references/spec-template.md\`.\n`;
444
449
  prompt += `When a scenario has nothing to write, omit that scenario's \`contracts\` rather than padding it\n`;
@@ -477,8 +482,11 @@ export function renderPrompt(group, units, pages, plan) {
477
482
  prompt += `While working, report progress with \`node scripts/dispatch.mjs ${outDir} beat ${group.group_id} --token {{token}}\`.\n`;
478
483
 
479
484
  prompt += `\n## Submit command and lock contention\n\n`;
480
- prompt += `Submit as soon as the post-audit (step 11) passes; do not wait or do unrelated work first. If discovery, pre-audit or post-review is missing, submit rejects with \`Audit incomplete\`; write the missing artifact and submit again in the same attempt:\n`;
481
- prompt += `\`node scripts/submit.mjs ${outDir} ${group.group_id} --token {{token}} --draft <draft.json>\`.\n`;
485
+ prompt += `Dry-run first once the post-audit (step 11) passes, then submit for real; do not wait or do unrelated work in between. The dry run executes the same G1–G8 gates and writes nothing, so fix every reported failure before submitting:\n`;
486
+ prompt += `\`node scripts/submit.mjs ${outDir} ${group.group_id} --token {{token}} --dry-run --draft <draft.json>\`.\n`;
487
+ prompt += `Real submission: \`node scripts/submit.mjs ${outDir} ${group.group_id} --token {{token}} --draft <draft.json>\`. If discovery, pre-audit or post-review is missing, submit rejects with \`Audit incomplete\`; write the missing artifact and submit again in the same attempt.\n`;
488
+ prompt += `A gate-failing submit records \`precheck-failed\` and keeps the attempt live for up to 3 failed submits; after that the attempt is abandoned and the orchestrator dispatches a retry.\n`;
489
+ prompt += `A \`Token mismatch\` means that attempt was abandoned or retried: stop editing that attempt's drafts/ and behavior/ directories and wait for the retry dispatch prompt.\n`;
482
490
  prompt += `If start, beat or submit hits \`ledger busy\`, make at most three attempts in total (the first\n`;
483
491
  prompt += `one included), with bounded 50ms and 100ms backoff.\n`;
484
492
  prompt += `\`ledger busy\` is not a task failure but a short lock contention; when all three attempts are\n`;
@@ -588,8 +596,19 @@ export function runPreparePipeline({
588
596
  footprint = compute({ pages, sourceProject, db });
589
597
  facts = collect({ sourceProject });
590
598
  entryEvidence = discoverEntries({ pages, db, sourceProject, query });
599
+ // Ownership is a graph question, so it is only enabled when the handle is
600
+ // usable; a fixture without one keeps the legacy "no ownership filter"
601
+ // behavior instead of silently dropping every non-body lifecycle signal.
602
+ // Operation ownership reuses the same index to tell a sibling page's
603
+ // implementation from this page's when both sit in one feature module.
604
+ const resolveOwners = deps.resolveOwners !== undefined
605
+ ? deps.resolveOwners
606
+ : usableDb
607
+ ? buildPageOwnerIndex({ db, footprint }).ownersOf
608
+ : null;
591
609
  operations = discoverOps({
592
610
  pages, entryEvidence, db, sourceProject, endpoints: facts.endpoints, query, facts, footprint,
611
+ resolveOwners,
593
612
  });
594
613
  // incremental SUP / CHG pages: operations outside this round's features become out-of-feature-scope (no-op otherwise)
595
614
  scopeOps({ pages, operations, db });
@@ -600,14 +619,7 @@ export function runPreparePipeline({
600
619
  });
601
620
  behaviors = enrich({
602
621
  pages, footprint, sourceProject, entryEvidence, operations, graphEvidence, facts,
603
- // Ownership is a graph question, so it is only enabled when the handle is
604
- // usable; a fixture without one keeps the legacy "no ownership filter"
605
- // behavior instead of silently dropping every non-body lifecycle signal.
606
- resolveOwners: deps.resolveOwners !== undefined
607
- ? deps.resolveOwners
608
- : usableDb
609
- ? buildPageOwnerIndex({ db, footprint }).ownersOf
610
- : null,
622
+ resolveOwners,
611
623
  });
612
624
  for (const page of pages) page.behavior = behaviors.get(page.page_id);
613
625
  } finally {