@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
@@ -36,6 +36,18 @@ const nonEmpty = value => typeof value === "string" && value.trim() !== "";
36
36
  const same = (a, b) => stableDigest(a) === stableDigest(b);
37
37
  const fail = (code, message, extra = {}) => ({ code, message, ...extra });
38
38
 
39
+ /** Producer-reserved unknowns may never be closed by a worker resolution. */
40
+ function producerReservedIds({ evidence, discovery }) {
41
+ if (evidence?.profile?.resolution_policy !== "producer-reserved-v1") return new Set();
42
+ const ids = new Set();
43
+ for (const unknown of [...asArray(evidence?.unknowns), ...asArray(discovery?.unknowns)]) {
44
+ if (unknown?.reason === "review-incomplete"
45
+ && ["source-unit-limit", "contract-call-deferred", "contract-evidence-limit"].includes(unknown?.cause)
46
+ && nonEmpty(unknown.id)) ids.add(unknown.id);
47
+ }
48
+ return ids;
49
+ }
50
+
39
51
  export { evidenceSnapshotDigest } from "./behavior-model.mjs";
40
52
 
41
53
  /**
@@ -401,7 +413,9 @@ function checkEvidenceReferences({ evidence, discovery, sourceProject, reconcile
401
413
  const dispositions = new Map(objectEntries(discovery.planned).map(entry => [entry.assertion_id, entry]));
402
414
  const reviews = new Map(objectEntries(discovery.evidence_reviews).map(entry => [entry.assertion_id, entry]));
403
415
  const resolutions = asArray(discovery.resolutions);
416
+ const reservedIds = producerReservedIds({ evidence, discovery });
404
417
  const resolutionAccounts = assertionId => resolutions.some(resolution => {
418
+ if (reservedIds.has(resolution?.unknown_id)) return false;
405
419
  if (resolution?.status !== "resolved") return false;
406
420
  if (!asArray(resolution.assertion_ids).includes(assertionId)) return false;
407
421
  const refs = assertableRefs(resolution.evidence_refs);
@@ -443,6 +457,7 @@ function checkUnknownReferences({ evidence, discovery, sourceProject }) {
443
457
  }
444
458
  }
445
459
  for (const resolution of asArray(discovery.resolutions)) {
460
+ if (producerReservedIds({ evidence, discovery }).has(resolution?.unknown_id)) continue;
446
461
  for (const reference of assertableRefs(resolution?.evidence_refs)) {
447
462
  const state = referenceState({ reference, evidence, sourceProject });
448
463
  if (state.status !== "valid") {
@@ -506,7 +521,9 @@ function hasIncompleteReviews({ evidence, discovery }) {
506
521
  for (const disposition of asArray(discovery.candidate_dispositions)) {
507
522
  if (disposition?.review_status !== undefined && disposition.review_status !== "reviewed") return true;
508
523
  }
524
+ const reservedIds = producerReservedIds({ evidence, discovery });
509
525
  for (const resolution of asArray(discovery.resolutions)) {
526
+ if (reservedIds.has(resolution?.unknown_id)) continue;
510
527
  if (resolution?.review_status === "incomplete") return true;
511
528
  }
512
529
  return false;
@@ -525,7 +542,9 @@ function hasPartialCoverage({ evidence, unresolvedUnknowns, staleUnaccounted })
525
542
  /**
526
543
  * Evaluate one page's pre-authoring audit.
527
544
  *
528
- * @returns {{status:"completed"|"incomplete"|"failed", failures:object[], unknowns:object[], dispositions:object[], discovery_digest:string, coverage_status:"complete"|"partial", attempt:number|null}}
545
+ * @returns {{status:"completed"|"incomplete"|"failed", failures:object[], diagnostics:object[],
546
+ * unknowns:object[], dispositions:object[], discovery_digest:string,
547
+ * coverage_status:"complete"|"partial", attempt:number|null}}
529
548
  */
530
549
  export function evaluatePreAudit({ plan, evidence, discovery, sourceProject, includeLiveDrift = false } = {}) {
531
550
  if (!evidence || typeof evidence !== "object") {
@@ -586,6 +605,7 @@ export function evaluatePreAudit({ plan, evidence, discovery, sourceProject, inc
586
605
  return {
587
606
  status,
588
607
  failures,
608
+ ...(asArray(reconciled.diagnostics).length > 0 ? { diagnostics: reconciled.diagnostics } : {}),
589
609
  unknowns: unresolvedUnknowns,
590
610
  dispositions: asArray(doc.planned),
591
611
  discovery_digest: stableDigest(doc),
@@ -728,7 +748,9 @@ function placeholderPageState({ preAudit, failures }) {
728
748
  }
729
749
 
730
750
  function resolutionAccounts({ assertionId, discovery, evidence, sourceProject }) {
751
+ const reservedIds = producerReservedIds({ evidence, discovery });
731
752
  return asArray(discovery.resolutions).some(resolution => {
753
+ if (reservedIds.has(resolution?.unknown_id)) return false;
732
754
  if (resolution?.status !== "resolved") return false;
733
755
  if (!asArray(resolution.assertion_ids).includes(assertionId)) return false;
734
756
  const refs = assertableRefs(resolution.evidence_refs);
@@ -1819,6 +1841,7 @@ export function evaluateBehaviorGroup({
1819
1841
  if (behaviorPages.length === 0) return null;
1820
1842
 
1821
1843
  const failures = [];
1844
+ const warnings = [];
1822
1845
  const pageResults = {};
1823
1846
  let state = null;
1824
1847
  let ledgerError = null;
@@ -2102,6 +2125,17 @@ export function evaluateBehaviorGroup({
2102
2125
  { spec_id: pageSpecIdsFor(pageId)[0] ?? null });
2103
2126
  failures.push(failure);
2104
2127
  }
2128
+ for (const diagnostic of asArray(pagePre?.diagnostics)) {
2129
+ if (!nonEmpty(diagnostic?.code)) continue;
2130
+ warnings.push({
2131
+ gate: "G4",
2132
+ page_id: pageId,
2133
+ spec_id: pageSpecIdsFor(pageId)[0] ?? null,
2134
+ code: diagnostic.code,
2135
+ unknown_id: diagnostic.unknown_id ?? null,
2136
+ message: diagnostic.message ?? "",
2137
+ });
2138
+ }
2105
2139
 
2106
2140
  let pagePost;
2107
2141
  if (post !== undefined) {
@@ -2212,6 +2246,9 @@ export function evaluateBehaviorGroup({
2212
2246
  return {
2213
2247
  status,
2214
2248
  failures,
2249
+ warnings: warnings.sort((left, right) =>
2250
+ `${left.code}\u0000${left.unknown_id ?? ""}` < `${right.code}\u0000${right.unknown_id ?? ""}` ? -1
2251
+ : `${left.code}\u0000${left.unknown_id ?? ""}` > `${right.code}\u0000${right.unknown_id ?? ""}` ? 1 : 0),
2215
2252
  pages: pageResults,
2216
2253
  counts,
2217
2254
  discovery_digest: groupDigest,
@@ -2304,11 +2341,12 @@ const BEHAVIOR_EVIDENCE_FILES = Object.freeze([
2304
2341
  "candidates.json",
2305
2342
  "assertions.json",
2306
2343
  "unknowns.json",
2344
+ "contracts.json",
2307
2345
  ]);
2308
2346
 
2309
2347
  /**
2310
2348
  * Collect the submission/commit fence for immutable evidence and the
2311
- * attempt-scoped audit artifacts. The four fixed evidence files of every
2349
+ * attempt-scoped audit artifacts. The five fixed evidence files of every
2312
2350
  * behavior page are always present in the map: a file missing at collection
2313
2351
  * time is recorded as `null` so a later appearance is a conflict rather than a
2314
2352
  * newly discovered expected artifact.
@@ -24,11 +24,12 @@ import {
24
24
  } from "./behavior-model.mjs";
25
25
  import { createGraphEvidence } from "./lib/graph-evidence.mjs";
26
26
  import { writeJsonAtomic } from "./lib/fsx.mjs";
27
- import { stripDeclaredLine } from "./footprint.mjs";
27
+ import { stripDeclaredLine, moduleRootOf } from "./footprint.mjs";
28
28
  import { scanInteractions, scanLifecycle } from "./interactions.mjs";
29
29
  import { stemOf } from "./render.mjs";
30
30
  import { isExcludedEvidencePath } from "./facts-build.mjs";
31
31
  import { redirectingInterceptors } from "./inventory.mjs";
32
+ import { CONTRACT_CALLS_SCHEMA_VERSION } from "./contract-calls.mjs";
32
33
 
33
34
  function cmp(a, b) {
34
35
  return a < b ? -1 : a > b ? 1 : 0;
@@ -53,6 +54,32 @@ function normalizeFootprintEntry(entry) {
53
54
  : null,
54
55
  origin_units: Array.isArray(value.origin_units) ? value.origin_units : [],
55
56
  unresolved: Array.isArray(value.unresolved) ? value.unresolved : [],
57
+ composition: value.composition instanceof Set
58
+ ? new Set(value.composition)
59
+ : new Set(value.composition ?? value.all ?? []),
60
+ bodyInheritance: value.bodyInheritance instanceof Set
61
+ ? new Set(value.bodyInheritance)
62
+ : new Set(value.bodyInheritance ?? []),
63
+ compositionUnresolved: Array.isArray(value.compositionUnresolved)
64
+ ? value.compositionUnresolved
65
+ : (Array.isArray(value.unresolved) ? value.unresolved : []),
66
+ behaviorReachUnresolved: Array.isArray(value.behaviorReachUnresolved)
67
+ ? value.behaviorReachUnresolved
68
+ : (Array.isArray(value.unresolved) ? value.unresolved : []),
69
+ compositionFrontier: Array.isArray(value.compositionFrontier) ? value.compositionFrontier : [],
70
+ reachOnly: value.reachOnly instanceof Set
71
+ ? new Set(value.reachOnly)
72
+ : new Set(value.reachOnly ?? []),
73
+ imports: value.imports instanceof Set
74
+ ? new Set(value.imports)
75
+ : new Set(value.imports ?? []),
76
+ distance: value.distance instanceof Map
77
+ ? Object.fromEntries(value.distance)
78
+ : (value.distance && typeof value.distance === "object" ? value.distance : {}),
79
+ directInheritance: value.directInheritance instanceof Set
80
+ ? new Set(value.directInheritance)
81
+ : new Set(value.directInheritance ?? []),
82
+ contractCalls: value.contractCalls ?? value.contract_calls ?? null,
56
83
  };
57
84
  }
58
85
 
@@ -273,7 +300,12 @@ function sourceUnitRoles({ page, entry, requiredLocators = [] }) {
273
300
  // Traversal-discovered files are shared content until an origin or the page
274
301
  // body says otherwise. Required entry/operation evidence has its own role so
275
302
  // producer-only click signals cannot become interactions of this target page.
276
- for (const locator of entry.all) assign(locator, "shared-content");
303
+ for (const locator of entry.composition) assign(locator, "shared-content");
304
+ for (const locator of entry.bodyInheritance) assign(locator, "shared-content");
305
+ // The page body's direct base classes are retained even when a lexical or
306
+ // module-based budget would otherwise drop them. The role makes the target
307
+ // visible to snapshotSourceUnits; boundedSourceRoles treats it as an origin.
308
+ for (const locator of entry.directInheritance ?? []) assign(locator, "shared-content");
277
309
  for (const locator of requiredLocators) assign(locator, "required-evidence");
278
310
  const folded = new Set(page.folded_overlays ?? []);
279
311
  for (const unit of entry.origin_units) {
@@ -332,7 +364,7 @@ function unresolvedReferencesOf({ page, entry, unitsByLocator }) {
332
364
  };
333
365
 
334
366
  // HomeGraph references that ended at a node with no file_path.
335
- for (const record of entry.unresolved) push(record);
367
+ for (const record of entry.compositionUnresolved ?? entry.unresolved) push(record);
336
368
 
337
369
  // Origins that resolved to no source. The footprint normally records these
338
370
  // already; synthesizing the same fact here keeps hand-built evidence honest.
@@ -1235,7 +1267,7 @@ function graphUnknownsOf(graph) {
1235
1267
  });
1236
1268
  }
1237
1269
 
1238
- function boundedSourceRoles({ entry, roles, requiredLocators = [] }) {
1270
+ function boundedSourceRoles({ entry, roles, requiredLocators = [], trimExclusions = [] }) {
1239
1271
  // Origins and the selected page body retain the legacy uncapped guarantee.
1240
1272
  const originRequired = new Set();
1241
1273
  if (entry.resolvedFile !== null && !isExcludedEvidencePath(entry.resolvedFile)) {
@@ -1245,6 +1277,35 @@ function boundedSourceRoles({ entry, roles, requiredLocators = [] }) {
1245
1277
  if (typeof unit?.resolvedFile === "string" && unit.resolvedFile !== ""
1246
1278
  && !isExcludedEvidencePath(unit.resolvedFile)) originRequired.add(unit.resolvedFile);
1247
1279
  }
1280
+ for (const locator of entry.directInheritance ?? []) {
1281
+ if (typeof locator === "string" && locator !== ""
1282
+ && !isExcludedEvidencePath(locator)) originRequired.add(locator);
1283
+ }
1284
+ for (const locator of entry.bodyInheritance ?? []) {
1285
+ if (typeof locator === "string" && locator !== ""
1286
+ && !isExcludedEvidencePath(locator)) originRequired.add(locator);
1287
+ }
1288
+
1289
+ const pageModule = entry.resolvedFile === null ? null : moduleRootOf(entry.resolvedFile);
1290
+ const distanceOf = (locator) => {
1291
+ const value = entry.distance?.[locator];
1292
+ return Number.isInteger(value) && value >= 0 ? value : Infinity;
1293
+ };
1294
+ const rankTraversal = (left, right) => {
1295
+ const leftDirect = distanceOf(left) <= 1 ? 0 : 1;
1296
+ const rightDirect = distanceOf(right) <= 1 ? 0 : 1;
1297
+ if (leftDirect !== rightDirect) return leftDirect - rightDirect;
1298
+ const leftModule = pageModule !== null && moduleRootOf(left) === pageModule ? 0 : 1;
1299
+ const rightModule = pageModule !== null && moduleRootOf(right) === pageModule ? 0 : 1;
1300
+ if (leftModule !== rightModule) return leftModule - rightModule;
1301
+ const leftDistance = distanceOf(left);
1302
+ const rightDistance = distanceOf(right);
1303
+ if (leftDistance !== rightDistance) return leftDistance - rightDistance;
1304
+ const leftWritable = entry.writable?.has(left) ? 0 : 1;
1305
+ const rightWritable = entry.writable?.has(right) ? 0 : 1;
1306
+ if (leftWritable !== rightWritable) return leftWritable - rightWritable;
1307
+ return cmp(left, right);
1308
+ };
1248
1309
 
1249
1310
  // Required behavior files have priority over traversal-expanded content. If
1250
1311
  // the required set itself exceeds the breadth bound, the omission is named
@@ -1252,11 +1313,22 @@ function boundedSourceRoles({ entry, roles, requiredLocators = [] }) {
1252
1313
  const behaviorRequired = [...new Set(requiredLocators)]
1253
1314
  .filter(locator => !originRequired.has(locator) && !isExcludedEvidencePath(locator))
1254
1315
  .sort(cmp);
1316
+ // Owner trim: a composition unit another page owns is that page's evidence,
1317
+ // not this page's. Dropping it before the breadth bound is what makes the
1318
+ // bound affordable; the drop stays auditable through `trim_exclusions`.
1319
+ // Protected units (body, origins, direct bases, required evidence) are never
1320
+ // trimmed, so the page's own behavior can't disappear this way.
1321
+ const requiredSet = new Set(behaviorRequired);
1322
+ const trimmed = [...new Set(trimExclusions)]
1323
+ .filter(locator => typeof locator === "string" && locator !== ""
1324
+ && !originRequired.has(locator) && !requiredSet.has(locator))
1325
+ .sort(cmp);
1326
+ const trimmedSet = new Set(trimmed);
1255
1327
  const keptBehavior = behaviorRequired.slice(0, MAX_TRAVERSAL_SOURCE_UNITS);
1256
1328
  const omittedRequired = behaviorRequired.slice(MAX_TRAVERSAL_SOURCE_UNITS);
1257
1329
  const traversal = [...roles.keys()]
1258
- .filter(locator => !originRequired.has(locator) && !behaviorRequired.includes(locator))
1259
- .sort(cmp);
1330
+ .filter(locator => !trimmedSet.has(locator) && !originRequired.has(locator) && !requiredSet.has(locator))
1331
+ .sort(rankTraversal);
1260
1332
  const remaining = Math.max(0, MAX_TRAVERSAL_SOURCE_UNITS - keptBehavior.length);
1261
1333
  const kept = new Set([
1262
1334
  ...originRequired,
@@ -1268,6 +1340,7 @@ function boundedSourceRoles({ entry, roles, requiredLocators = [] }) {
1268
1340
  roles: new Map([...roles.entries()].filter(([locator]) => kept.has(locator))),
1269
1341
  omitted,
1270
1342
  omittedRequired,
1343
+ trimmed,
1271
1344
  };
1272
1345
  }
1273
1346
 
@@ -1278,11 +1351,12 @@ function boundedSourceRoles({ entry, roles, requiredLocators = [] }) {
1278
1351
  * reference validation replays exactly that bundle, so page-level aggregates
1279
1352
  * (such as interaction scans) must live in the Evidence-level digest instead.
1280
1353
  */
1281
- function snapshotSourceUnits({ page, entry, sourceProject, requiredLocators = [] }) {
1354
+ function snapshotSourceUnits({ page, entry, sourceProject, requiredLocators = [], trimExclusions = [] }) {
1282
1355
  const bounded = boundedSourceRoles({
1283
1356
  entry,
1284
1357
  roles: sourceUnitRoles({ page, entry, requiredLocators }),
1285
1358
  requiredLocators,
1359
+ trimExclusions,
1286
1360
  });
1287
1361
  const sourceUnits = [...bounded.roles.entries()]
1288
1362
  .filter(([locator]) => !isExcludedEvidencePath(locator))
@@ -1302,6 +1376,7 @@ function snapshotSourceUnits({ page, entry, sourceProject, requiredLocators = []
1302
1376
  return {
1303
1377
  sourceUnits, currentSnapshot, snapshotHistory,
1304
1378
  omitted: bounded.omitted, omittedRequired: bounded.omittedRequired,
1379
+ trimmed: bounded.trimmed,
1305
1380
  };
1306
1381
  }
1307
1382
 
@@ -1321,25 +1396,46 @@ function firstLocatorForFilter(value) {
1321
1396
  * open question (the attribution unknown), not an exclusion. Without a
1322
1397
  * resolver there is no attribution at all, so nothing is excluded.
1323
1398
  */
1324
- function scopeExclusionsOf({ page, sourceUnits, ownersOf }) {
1325
- if (typeof ownersOf !== "function") return [];
1326
- const exclusions = new Set();
1327
- for (const unit of sourceUnits) {
1328
- const locator = unit?.locator;
1399
+ function ownershipExclusionsOf({ page, entry, ownersOf, requiredLocators = [] }) {
1400
+ if (typeof ownersOf !== "function") return { waiver: [], trim: [] };
1401
+ const candidates = entry.composition ?? entry.all;
1402
+ const protectedLocators = new Set();
1403
+ // Inheritance is behavior this page has, so an inherited base is never another page's
1404
+ // surface: it stays required evidence and cannot be waived as `explicitly-excluded-source`.
1405
+ const inheritanceLocators = new Set();
1406
+ const protect = locator => {
1407
+ if (typeof locator === "string" && locator !== "") protectedLocators.add(locator);
1408
+ };
1409
+ const protectInheritance = locator => {
1410
+ if (typeof locator === "string" && locator !== "") {
1411
+ protectedLocators.add(locator);
1412
+ inheritanceLocators.add(locator);
1413
+ }
1414
+ };
1415
+ protect(entry.resolvedFile);
1416
+ for (const unit of entry.origin_units ?? []) protect(unit?.resolvedFile);
1417
+ for (const locator of entry.directInheritance ?? []) protectInheritance(locator);
1418
+ for (const locator of entry.bodyInheritance ?? []) protectInheritance(locator);
1419
+ for (const locator of requiredLocators) protect(locator);
1420
+
1421
+ const waiver = new Set();
1422
+ const trim = new Set();
1423
+ for (const locator of candidates) {
1329
1424
  if (typeof locator !== "string" || locator === "") continue;
1330
1425
  const owners = ownersOf(locator);
1331
- if (owners instanceof Set && owners.size > 0 && !owners.has(page.page_id)) {
1332
- exclusions.add(locator);
1333
- }
1426
+ if (!(owners instanceof Set) || owners.size === 0 || owners.has(page.page_id)) continue;
1427
+ if (inheritanceLocators.has(locator)) continue;
1428
+ waiver.add(locator);
1429
+ if (!protectedLocators.has(locator)) trim.add(locator);
1334
1430
  }
1335
- return [...exclusions].sort(cmp);
1431
+ return { waiver: [...waiver].sort(cmp), trim: [...trim].sort(cmp) };
1336
1432
  }
1337
1433
 
1338
1434
  function buildEvidence({
1339
1435
  page, entry, scan, lifecycleScan = { lifecycle: [], issues: [] }, sourceProject, sourceUnits,
1340
1436
  currentSnapshot, snapshotHistory, omitted, pageById,
1341
1437
  omittedRequired = [], entryRecord = {}, operationRecord = {}, graphEvidence = null,
1342
- ownersOf = null, attribution = null,
1438
+ ownersOf = null, attribution = null, requiredLocators = [], scopeExclusions = null,
1343
1439
  }) {
1344
1440
  const unitsByLocator = new Map(sourceUnits.map((unit) => [unit.locator, unit]));
1345
1441
 
@@ -1473,7 +1569,82 @@ function buildEvidence({
1473
1569
  // later `explicitly-excluded-source` waiver may honestly cite: an exclusion
1474
1570
  // claim must land on a recorded exclusion, never on this page's own unit or
1475
1571
  // on an unresolved shared file (that is what the attribution unknown is for).
1476
- const scopeExclusions = scopeExclusionsOf({ page, sourceUnits, ownersOf });
1572
+ // Ownership exclusions are computed over the full composition candidate set,
1573
+ // before the breadth bound, and frozen into evidence. `waiver` keeps every
1574
+ // file another page owns; `trim` removes only non-protected composition units.
1575
+ const resolvedScopeExclusions = scopeExclusions
1576
+ ?? ownershipExclusionsOf({ page, entry, ownersOf, requiredLocators });
1577
+ const requiredSet = new Set(requiredLocators);
1578
+ const originSet = new Set([
1579
+ entry.resolvedFile,
1580
+ ...(entry.origin_units ?? []).map(unit => unit?.resolvedFile),
1581
+ ...(entry.bodyInheritance ?? []),
1582
+ ...(entry.directInheritance ?? []),
1583
+ ].filter(Boolean));
1584
+ const reachOnlyLocators = [...(entry.reachOnly ?? [])]
1585
+ .filter(locator => !requiredSet.has(locator) && !originSet.has(locator))
1586
+ .sort(cmp);
1587
+ const reachOnlyByModule = {};
1588
+ for (const locator of reachOnlyLocators) {
1589
+ const module = moduleRootOf(locator) ?? "(none)";
1590
+ reachOnlyByModule[module] = (reachOnlyByModule[module] ?? 0) + 1;
1591
+ }
1592
+ const reachOnly = {
1593
+ count: reachOnlyLocators.length,
1594
+ by_module: Object.fromEntries(Object.entries(reachOnlyByModule).sort(([a], [b]) => cmp(a, b))),
1595
+ sample: reachOnlyLocators.slice(0, 20),
1596
+ digest: stableDigest(reachOnlyLocators),
1597
+ };
1598
+ const behaviorReachUnresolved = sortByDigest(entry.behaviorReachUnresolved ?? []);
1599
+ const compositionUnresolved = sortByDigest(entry.compositionUnresolved ?? []);
1600
+ const contractCalls = entry.contractCalls ?? null;
1601
+ const contractTargets = contractCalls?.targets ?? [];
1602
+ const contractDeferred = contractCalls?.deferred ?? [];
1603
+ const contractOmitted = contractCalls?.omitted ?? [];
1604
+ const contractDispositions = contractCalls?.dispositions ?? [];
1605
+ const pageContractDeferred = contractDeferred.filter(record => record?.from_scope !== false);
1606
+ const hasContractInventory = contractCalls?.source_contracts
1607
+ ? Object.values(contractCalls.source_contracts).some(value => Array.isArray(value) && value.length > 0)
1608
+ : false;
1609
+ const hasContractCalls = contractTargets.length > 0
1610
+ || contractDeferred.length > 0
1611
+ || contractOmitted.length > 0
1612
+ || hasContractInventory
1613
+ || contractDispositions.some(item => item?.disposition !== "reviewed-scope");
1614
+ if (pageContractDeferred.length > 0) {
1615
+ unknowns.push(unknownRecord({
1616
+ scope: "contract",
1617
+ reason: "review-incomplete",
1618
+ cause: "contract-call-deferred",
1619
+ referring_file: entry.resolvedFile ?? page.declared_at ?? null,
1620
+ locator: "contract-call-deferred",
1621
+ count: pageContractDeferred.length,
1622
+ sample: pageContractDeferred.slice(0, 20),
1623
+ relevance_review: { status: "reviewed", conclusion: "blocks-composition" },
1624
+ }, "Read or resolve the deferred contract-only call targets"));
1625
+ }
1626
+ if (contractOmitted.length > 0) {
1627
+ unknowns.push(unknownRecord({
1628
+ scope: "contract",
1629
+ reason: "review-incomplete",
1630
+ cause: "contract-evidence-limit",
1631
+ referring_file: entry.resolvedFile ?? page.declared_at ?? null,
1632
+ locator: "contract-evidence-limit",
1633
+ count: contractOmitted.length,
1634
+ sample: contractOmitted.slice(0, 20),
1635
+ relevance_review: { status: "reviewed", conclusion: "blocks-composition" },
1636
+ }, "Raise the contract-evidence budget or split the page"));
1637
+ }
1638
+ if (entry.composition.size === 0 && entry.imports.size > 0) {
1639
+ unknowns.push(unknownRecord({
1640
+ scope: "composition",
1641
+ reason: "review-incomplete",
1642
+ cause: "composition-graph-incomplete",
1643
+ referring_file: entry.resolvedFile ?? page.declared_at ?? null,
1644
+ locator: "composition-graph-incomplete",
1645
+ relevance_review: { status: "reviewed", conclusion: "blocks-composition" },
1646
+ }, "Restore composition edges for this page in the index and re-run prepare"));
1647
+ }
1477
1648
 
1478
1649
  const evidence = {
1479
1650
  schema_version: BEHAVIOR_SCHEMA_VERSION,
@@ -1486,16 +1657,42 @@ function buildEvidence({
1486
1657
  snapshot_history: snapshotHistory,
1487
1658
  inventory_status: inventoryClosed ? "closed" : "partial",
1488
1659
  unresolved_references: unresolved,
1660
+ composition: [...(entry.composition ?? [])].sort(cmp),
1661
+ body_inheritance: [...(entry.bodyInheritance ?? [])].sort(cmp),
1662
+ composition_unresolved: compositionUnresolved,
1663
+ behavior_reach_unresolved: {
1664
+ count: behaviorReachUnresolved.length,
1665
+ sample: behaviorReachUnresolved.slice(0, 20),
1666
+ digest: stableDigest(behaviorReachUnresolved),
1667
+ },
1668
+ composition_frontier: entry.compositionFrontier ?? [],
1669
+ reach_only: reachOnly,
1670
+ imports: [...(entry.imports ?? [])].sort(cmp),
1489
1671
  interaction_scans: scan.interactionScans,
1490
1672
  lifecycle_scans: lifecycleScan.lifecycleScans,
1491
1673
  outbound_evidence: outbound.records,
1492
1674
  operation_candidates: operationCandidates,
1493
1675
  ...(graph === null ? {} : { graph_evidence: graph }),
1494
- ...(scopeExclusions.length > 0 ? { scope_exclusions: scopeExclusions } : {}),
1676
+ ...(resolvedScopeExclusions.waiver.length > 0 ? { scope_exclusions: resolvedScopeExclusions.waiver } : {}),
1677
+ ...(resolvedScopeExclusions.trim.length > 0 ? { trim_exclusions: resolvedScopeExclusions.trim } : {}),
1678
+ ...(hasContractCalls ? {
1679
+ contract_evidence: contractTargets,
1680
+ contract_inventory: {
1681
+ counts: contractCalls.counts,
1682
+ digest: contractCalls.digest,
1683
+ deferred: contractDeferred,
1684
+ omitted: contractOmitted,
1685
+ source_contracts: contractCalls.source_contracts,
1686
+ },
1687
+ contract_dispositions: contractDispositions,
1688
+ } : {}),
1495
1689
  candidates,
1496
1690
  assertions,
1497
1691
  unknowns: sortByDigest(unknowns),
1498
1692
  };
1693
+ if (pageContractDeferred.length > 0 || contractOmitted.length > 0) {
1694
+ evidence.inventory_status = "partial";
1695
+ }
1499
1696
  evidence.snapshot_digest = evidenceSnapshotDigest(evidence);
1500
1697
  return evidence;
1501
1698
  }
@@ -1573,7 +1770,7 @@ export function enrichBehaviorEvidence({
1573
1770
  groupOfPage.set(page.page_id, groupKey);
1574
1771
  if (!pagesOfGroup.has(groupKey)) pagesOfGroup.set(groupKey, new Set());
1575
1772
  pagesOfGroup.get(groupKey).add(page.page_id);
1576
- for (const locator of normalized.all) {
1773
+ for (const locator of new Set([...normalized.composition, ...normalized.bodyInheritance])) {
1577
1774
  if (typeof locator !== "string" || locator === "" || isExcludedEvidencePath(locator)) continue;
1578
1775
  if (!refGroupsByLocator.has(locator)) refGroupsByLocator.set(locator, new Set());
1579
1776
  refGroupsByLocator.get(locator).add(groupKey);
@@ -1590,7 +1787,10 @@ export function enrichBehaviorEvidence({
1590
1787
  const entryRecord = entryRecords.get(page.page_id) ?? {};
1591
1788
  const operationRecord = operationRecords.get(page.page_id) ?? {};
1592
1789
  const requiredLocators = requiredLocatorsOf(entryRecord, operationRecord, page, entry);
1593
- const snapshot = snapshotSourceUnits({ page, entry, sourceProject, requiredLocators });
1790
+ const scopeExclusions = ownershipExclusionsOf({ page, entry, ownersOf, requiredLocators });
1791
+ const snapshot = snapshotSourceUnits({
1792
+ page, entry, sourceProject, requiredLocators, trimExclusions: scopeExclusions.trim,
1793
+ });
1594
1794
  const scan = scanInteractionUnits({ page, sourceProject, sourceUnits: snapshot.sourceUnits });
1595
1795
  // A page's own view model is a required-evidence unit (it is not page UI, so
1596
1796
  // the interaction scan skips it), yet it is exactly where lifecycle
@@ -1618,7 +1818,7 @@ export function enrichBehaviorEvidence({
1618
1818
 
1619
1819
  const evidence = buildEvidence({
1620
1820
  page, entry, scan, lifecycleScan, sourceProject, pageById, entryRecord, operationRecord, graphEvidence,
1621
- ownersOf, attribution, ...snapshot,
1821
+ ownersOf, attribution, requiredLocators, scopeExclusions, ...snapshot,
1622
1822
  });
1623
1823
  page.behavior = evidence;
1624
1824
  behaviors.set(evidence.page_id, evidence);
@@ -1813,6 +2013,13 @@ export function writeBehaviorEvidence({ outDir, behaviors } = {}) {
1813
2013
  profile: behavior.profile ?? COVERAGE_PROFILE,
1814
2014
  snapshot_digest: behavior.snapshot_digest,
1815
2015
  composition_roots: behavior.composition_roots ?? [],
2016
+ composition: behavior.composition ?? [],
2017
+ body_inheritance: behavior.body_inheritance ?? [],
2018
+ composition_unresolved: behavior.composition_unresolved ?? [],
2019
+ behavior_reach_unresolved: behavior.behavior_reach_unresolved ?? null,
2020
+ composition_frontier: behavior.composition_frontier ?? [],
2021
+ reach_only: behavior.reach_only ?? null,
2022
+ imports: behavior.imports ?? [],
1816
2023
  source_units: behavior.source_units ?? [],
1817
2024
  current_snapshot: behavior.current_snapshot ?? null,
1818
2025
  snapshot_history: behavior.snapshot_history ?? [],
@@ -1823,6 +2030,18 @@ export function writeBehaviorEvidence({ outDir, behaviors } = {}) {
1823
2030
  graph_evidence: behavior.graph_evidence ?? null,
1824
2031
  operation_candidates: behavior.operation_candidates ?? [],
1825
2032
  outbound_evidence: behavior.outbound_evidence ?? [],
2033
+ ...(Array.isArray(behavior.scope_exclusions) ? { scope_exclusions: behavior.scope_exclusions } : {}),
2034
+ ...(Array.isArray(behavior.trim_exclusions) ? { trim_exclusions: behavior.trim_exclusions } : {}),
2035
+ ...(Array.isArray(behavior.contract_evidence) ? { contract_evidence: behavior.contract_evidence } : {}),
2036
+ ...(behavior.contract_inventory ? { contract_inventory: behavior.contract_inventory } : {}),
2037
+ ...(Array.isArray(behavior.contract_dispositions) ? { contract_dispositions: behavior.contract_dispositions } : {}),
2038
+ });
2039
+ writeJsonAtomic(path.join(dir, "contracts.json"), {
2040
+ schema_version: CONTRACT_CALLS_SCHEMA_VERSION,
2041
+ page_id: behavior.page_id,
2042
+ evidence: behavior.contract_evidence ?? [],
2043
+ inventory: behavior.contract_inventory ?? null,
2044
+ dispositions: behavior.contract_dispositions ?? [],
1826
2045
  });
1827
2046
  writeJsonAtomic(path.join(dir, "candidates.json"), behavior.candidates ?? []);
1828
2047
  writeJsonAtomic(path.join(dir, "assertions.json"), behavior.assertions ?? []);
@@ -5,9 +5,14 @@ import path from "node:path";
5
5
  export const BEHAVIOR_SCHEMA_VERSION = "behavior-ledger-v3";
6
6
  export const LEGACY_BEHAVIOR_SCHEMA_VERSION = "behavior-ledger-v2";
7
7
  export const COVERAGE_PROFILE = Object.freeze({
8
- id: "static-source-v2",
8
+ id: "static-source-v3",
9
9
  interaction_rules: "interaction-rules-v2",
10
- composition_depth: 3,
10
+ composition_depth: 2,
11
+ composition_edges: ["imports", "references", "instantiates"],
12
+ composition_inheritance: "body-chain",
13
+ reach_depth: 3,
14
+ selection_policy: "direct-then-module-v1",
15
+ resolution_policy: "producer-reserved-v1",
11
16
  });
12
17
 
13
18
  // Out-of-scope is a scope decision, not a free-form waiver. These are the only
@@ -75,6 +80,28 @@ export function evidenceSnapshotDigest(evidence) {
75
80
  if (asArray(evidence?.outbound_evidence).length > 0) {
76
81
  bundle.outbound_evidence = evidence.outbound_evidence;
77
82
  }
83
+ if (Array.isArray(evidence?.scope_exclusions) && evidence.scope_exclusions.length > 0) {
84
+ bundle.scope_exclusions = evidence.scope_exclusions;
85
+ }
86
+ if (Array.isArray(evidence?.trim_exclusions) && evidence.trim_exclusions.length > 0) {
87
+ bundle.trim_exclusions = evidence.trim_exclusions;
88
+ }
89
+ if (Array.isArray(evidence?.contract_evidence) && evidence.contract_evidence.length > 0) {
90
+ bundle.contract_evidence = evidence.contract_evidence;
91
+ }
92
+ if (evidence?.contract_inventory) {
93
+ bundle.contract_inventory = evidence.contract_inventory;
94
+ }
95
+ if (Array.isArray(evidence?.contract_dispositions) && evidence.contract_dispositions.length > 0) {
96
+ bundle.contract_dispositions = evidence.contract_dispositions;
97
+ }
98
+ if (Array.isArray(evidence?.composition)) bundle.composition = evidence.composition;
99
+ if (Array.isArray(evidence?.body_inheritance)) bundle.body_inheritance = evidence.body_inheritance;
100
+ if (Array.isArray(evidence?.composition_unresolved)) bundle.composition_unresolved = evidence.composition_unresolved;
101
+ if (evidence?.behavior_reach_unresolved !== undefined) bundle.behavior_reach_unresolved = evidence.behavior_reach_unresolved;
102
+ if (Array.isArray(evidence?.composition_frontier)) bundle.composition_frontier = evidence.composition_frontier;
103
+ if (evidence?.reach_only) bundle.reach_only = evidence.reach_only;
104
+ if (Array.isArray(evidence?.imports)) bundle.imports = evidence.imports;
78
105
  return stableDigest(withoutObservationMetadata(bundle));
79
106
  }
80
107
 
@@ -35,6 +35,10 @@ const IMMUTABLE_FIELDS = [
35
35
  "current_snapshot", "snapshot_history", "snapshot_digest", "inventory_status",
36
36
  "unresolved_references", "interaction_scans", "candidates",
37
37
  "graph_evidence", "operation_candidates", "outbound_evidence",
38
+ "scope_exclusions", "trim_exclusions",
39
+ "composition", "body_inheritance", "composition_unresolved",
40
+ "behavior_reach_unresolved", "composition_frontier", "reach_only", "imports",
41
+ "contract_evidence", "contract_inventory", "contract_dispositions",
38
42
  ];
39
43
  const OBSERVATION_INDEPENDENT_FIELDS = new Set([
40
44
  "graph_evidence", "operation_candidates", "outbound_evidence",
@@ -263,8 +267,9 @@ function exclusionFailureDetail({ exclusions, unmatched, subject }) {
263
267
  * @param {object} args
264
268
  * @param {object} args.evidence immutable page evidence
265
269
  * @param {object} args.discovery worker discovery for the page
266
- * @returns {{discovery: object, failures: object[], unresolved_unknowns: object[],
267
- * source_review_incomplete: boolean, source_unit_reviews: object[]}}
270
+ * @returns {{discovery: object, failures: object[], diagnostics: object[],
271
+ * unresolved_unknowns: object[], source_review_incomplete: boolean,
272
+ * source_unit_reviews: object[]}}
268
273
  * `source_review_incomplete` is true when any SourceUnit lacks a digest-matched
269
274
  * review with a legal conclusion and the exact attributed assertion set.
270
275
  * `source_unit_reviews` is the shape-validated review projection, sorted by
@@ -277,7 +282,14 @@ export function reconcileDiscovery({ evidence, discovery, sourceProject } = {})
277
282
  }
278
283
  const doc = discovery && typeof discovery === "object" ? discovery : {};
279
284
  const failures = [];
285
+ const diagnostics = [];
280
286
  const fail = (code, message, extra = {}) => failures.push({ code, message, ...extra });
287
+ const note = (code, message, extra = {}) => diagnostics.push({ code, message, ...extra });
288
+ const policy = evidence?.profile?.resolution_policy ?? null;
289
+ const producerReserved = unknown =>
290
+ policy === "producer-reserved-v1"
291
+ && unknown?.reason === "review-incomplete"
292
+ && ["source-unit-limit", "contract-call-deferred", "contract-evidence-limit"].includes(unknown?.cause);
281
293
 
282
294
  const pageId = doc.page_id ?? evidence.page_id;
283
295
  if (doc.page_id !== undefined && evidence.page_id !== undefined && doc.page_id !== evidence.page_id) {
@@ -607,6 +619,13 @@ export function reconcileDiscovery({ evidence, discovery, sourceProject } = {})
607
619
  continue;
608
620
  }
609
621
  if (resolutionById.has(resolution.unknown_id)) {
622
+ const existing = unknownById.get(resolution.unknown_id);
623
+ if (producerReserved(existing)) {
624
+ note("resolution-producer-reserved",
625
+ `duplicate resolution ${resolution.unknown_id} ignored; the gap is producer-reserved`,
626
+ { unknown_id: resolution.unknown_id });
627
+ continue;
628
+ }
610
629
  fail("resolution-duplicate", `duplicate resolution for ${resolution.unknown_id}`);
611
630
  continue;
612
631
  }
@@ -616,6 +635,13 @@ export function reconcileDiscovery({ evidence, discovery, sourceProject } = {})
616
635
  }
617
636
  if (resolution.review_status !== undefined
618
637
  && resolution.review_status !== "reviewed" && resolution.review_status !== "incomplete") {
638
+ const unknown = unknownById.get(resolution.unknown_id);
639
+ if (producerReserved(unknown)) {
640
+ note("resolution-producer-reserved",
641
+ `resolution ${resolution.unknown_id} has invalid review_status; the gap is producer-reserved`,
642
+ { unknown_id: resolution.unknown_id });
643
+ continue;
644
+ }
619
645
  fail("resolution-review-status", `resolution ${resolution.unknown_id} has invalid review_status`);
620
646
  continue;
621
647
  }
@@ -773,6 +799,12 @@ export function reconcileDiscovery({ evidence, discovery, sourceProject } = {})
773
799
  for (const [unknownId, resolution] of resolutionById) {
774
800
  if (resolution.review_status === "incomplete") continue;
775
801
  const unknown = unknownById.get(unknownId);
802
+ if (producerReserved(unknown)) {
803
+ note("resolution-producer-reserved",
804
+ `resolution ${unknownId} ignored; the gap is producer-reserved and only a producer-side change can remove it`,
805
+ { unknown_id: unknownId });
806
+ continue;
807
+ }
776
808
  const failureCount = failures.length;
777
809
  if (unknown?.scope === "interaction" && unknown?.cause === "truncated") {
778
810
  // A worker resolution may never upgrade immutable read/unread evidence:
@@ -1196,6 +1228,7 @@ export function reconcileDiscovery({ evidence, discovery, sourceProject } = {})
1196
1228
  return {
1197
1229
  discovery: doc,
1198
1230
  failures,
1231
+ diagnostics,
1199
1232
  unresolved_unknowns: unresolvedUnknowns,
1200
1233
  source_review_incomplete: sourceReviewIncomplete,
1201
1234
  source_unit_reviews: validatedSourceReviews