@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.
- package/README.md +249 -279
- package/agents/code-reviewer.md +1 -1
- package/dist/cli/editors.json +20 -0
- package/dist/platform/registry.js +1 -0
- package/dist/platform/validate.js +2 -1
- package/i18n/agents/code-reviewer.md +1 -1
- package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
- package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
- package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/package.json +2 -1
- package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/skills/a2h-app-migrate/SKILL.md +31 -14
- package/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
- package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
- package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
- package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
- package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
- package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
- package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- 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
- package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
- package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
- package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
- package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
- package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
- package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
- package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
- package/skills/a2h-page-specgen/SKILL.md +36 -5
- package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
- package/skills/a2h-page-specgen/references/evidence.md +2 -1
- package/skills/a2h-page-specgen/references/execution-model.md +13 -5
- package/skills/a2h-page-specgen/references/gates.md +33 -7
- package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
- package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
- package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
- package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
- package/skills/a2h-resource-convert/SKILL.md +1 -1
- package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
- package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
- package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
- package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
- package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
- package/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
- package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
- package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
- package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
- package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
- package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
- package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
- package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
- package/skills/a2h-utg-static/SKILL.md +3 -3
- package/skills/a2h-utg-static/references/extractors.md +7 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
- package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
- package/resource/convert_pipeline_process.svg +0 -114
- package/resource/project_architecture.svg +0 -120
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* group_pass.mjs -- one pass of the Step 5.4 loop, as ONE command.
|
|
4
|
+
*
|
|
5
|
+
* Measured (coolmall, deveco): the parent hand-wrote its own driver each session. It released
|
|
6
|
+
* `reported` groups but never the `stalled` units `reap` lists, so silent units sat in `running`
|
|
7
|
+
* for hours; and it slept in the foreground between passes, so no slot refilled and no completion
|
|
8
|
+
* notice was handled. The loop is mechanical, so it lives here and the parent only dispatches.
|
|
9
|
+
*
|
|
10
|
+
* node group_pass.mjs <harmony_dir> [--no-commit] [--no-lease]
|
|
11
|
+
*
|
|
12
|
+
* In order, with no sleeping:
|
|
13
|
+
* 1. reap -> `release --unit <GID>` for each reported group; each stalled unit is released with
|
|
14
|
+
* --stalled on a host that cannot cancel (opencode/DevEco). Elsewhere it is listed in
|
|
15
|
+
* `stop_first`: the parent stops that task, then runs `release --stalled` itself.
|
|
16
|
+
* 1b. retry each checkpoint commit an earlier pass could not make (queue_logs/commit_pending.json),
|
|
17
|
+
* before any newer group commits and takes its files; reported under `committed_late`.
|
|
18
|
+
* 2. each `returned` group: phase5_check --group. blocking 0 -> `verified` + group_commit;
|
|
19
|
+
* otherwise `requeue` with the first blocking items (`--resume` when files are missing).
|
|
20
|
+
* 3. lease -> `dispatch` (the parent starts the agents, then `bind`s them) and `summary`.
|
|
21
|
+
* Output is one JSON line the parent acts on: dispatch, stop_first, needs_human, next.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import * as fs from 'node:fs';
|
|
25
|
+
import * as path from 'node:path';
|
|
26
|
+
import { spawnSync } from 'node:child_process';
|
|
27
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
28
|
+
import * as ac from './agent_cli.mjs';
|
|
29
|
+
import * as gq from './group_queue.mjs';
|
|
30
|
+
|
|
31
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
32
|
+
const script = (n) => path.join(HERE, n);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The last top-level JSON object of a script's stdout, or null. Scans from the end for a line that
|
|
36
|
+
* opens an object at column 0 (one-line or indented JSON): text printed before it, even with braces,
|
|
37
|
+
* and anything on stderr (a Node warning) do not hide it.
|
|
38
|
+
*/
|
|
39
|
+
export function trailingJson(stdout) {
|
|
40
|
+
const lines = String(stdout ?? '').split(/\r?\n/);
|
|
41
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
42
|
+
if (!lines[i].startsWith('{')) continue;
|
|
43
|
+
try { return JSON.parse(lines.slice(i).join('\n')); } catch { /* not where the object starts */ }
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Run a sibling script; the trailing JSON object of its stdout (if any) is parsed into `json`. */
|
|
49
|
+
function run(file, args) {
|
|
50
|
+
const r = spawnSync(process.execPath, [script(file), ...args], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
51
|
+
const out = (r.stdout || '') + (r.stderr || '');
|
|
52
|
+
return { code: r.status, out, json: trailingJson(r.stdout) };
|
|
53
|
+
}
|
|
54
|
+
const Q = (hp, mode, ...rest) => run('group_queue.mjs', [mode, hp, ...rest]);
|
|
55
|
+
/**
|
|
56
|
+
* A verified group's group_commit result. The group stays verified (phase5 passed), but a commit that
|
|
57
|
+
* exited non-zero or printed no {commit} (git add / commit refused, index.lock, a hook, no work tree)
|
|
58
|
+
* is no checkpoint: the entry carries `commit_error` and the parent is told in needs_human.
|
|
59
|
+
* Returns null when settled (committed, or nothing to commit), else the error.
|
|
60
|
+
* `into` is where the entry goes: `verified`, or `committed_late` for a retried commit.
|
|
61
|
+
*/
|
|
62
|
+
export function commitOutcome(out, gid, r, into = 'verified') {
|
|
63
|
+
const sha = String(r?.json?.commit ?? '');
|
|
64
|
+
(out[into] ??= []);
|
|
65
|
+
if (r?.code === 0 && sha) { out[into].push({ group: gid, commit: sha.slice(0, 8) }); return null; }
|
|
66
|
+
// exit 0 with a reason and no commit: nothing of this group changed, so there is nothing to checkpoint
|
|
67
|
+
if (r?.code === 0 && r?.json && r.json.reason) { out[into].push({ group: gid, commit: '', commit_skipped: String(r.json.reason) }); return null; }
|
|
68
|
+
const why = `group_commit exited ${r?.code}: ${String(r?.out ?? '').trim().slice(-300)}`;
|
|
69
|
+
out[into].push({ group: gid, commit: '', commit_error: why });
|
|
70
|
+
out.needs_human.push({ group: gid, hint: `verified but not committed (retried on the next pass): ${why}` });
|
|
71
|
+
return why;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** A queue command that failed: the parent has to look, the pass must not report it as done. */
|
|
75
|
+
const failed = (out, group, r, what) => {
|
|
76
|
+
out.needs_human.push({ group, hint: `${what} exited ${r.code}: ${r.out.trim().slice(-300)}` });
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Blocking count of a phase5_check section heading, 0 when it blocks nothing. Headings are
|
|
81
|
+
* `[k] title (blocking): N`, `[k] N (blocking)`, `[k] …: GATE N (blocking), CAND M`, or an error
|
|
82
|
+
* line `[k] <error> (blocking: …)` that counts as one.
|
|
83
|
+
*/
|
|
84
|
+
export function headingBlocking(line) {
|
|
85
|
+
if (!/^\[/.test(line) || !/\(blocking/.test(line)) return 0;
|
|
86
|
+
const m = /GATE (\d+) \(blocking\)/.exec(line) || /\] (\d+) \(blocking\)/.exec(line)
|
|
87
|
+
|| /\(blocking[^)]*\)[^:]*: (\d+)\s*$/.exec(line);
|
|
88
|
+
// `[k] title (blocking: rename): 0` is a counted section; only a heading with no count at all
|
|
89
|
+
// (`[static] <error> (blocking: …)`) counts as one
|
|
90
|
+
return m ? Number(m[1]) : (/\(blocking:/.test(line) && !/:\s*\d+\s*$/.test(line) ? 1 : 0);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The blocking sections of a phase5_check output: each heading with a non-zero count and the
|
|
95
|
+
* indented items under it (`[cand]` items are not blocking), as one line for a requeue message.
|
|
96
|
+
*/
|
|
97
|
+
export function blockingIssues(out, maxItems = 12) {
|
|
98
|
+
const parts = [];
|
|
99
|
+
let items = 0;
|
|
100
|
+
let on = false;
|
|
101
|
+
for (const raw of String(out).split(/\r?\n/)) {
|
|
102
|
+
const l = raw.trimEnd();
|
|
103
|
+
if (/^\[/.test(l)) { on = headingBlocking(l) > 0; if (on) parts.push(l); continue; }
|
|
104
|
+
if (!on || !/^\s+\S/.test(l) || /^\s+\[cand\]/.test(l) || items >= maxItems) continue;
|
|
105
|
+
parts.push(l.trim());
|
|
106
|
+
items += 1;
|
|
107
|
+
}
|
|
108
|
+
return parts.join(' | ');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** phase5_check for one group -> {blocking, issues, missing}; the log goes to queue_logs/<GID>.phase5.log. */
|
|
112
|
+
function phase5(hp, gid) {
|
|
113
|
+
const r = run('phase5_check.mjs', [hp, '--group', gid]);
|
|
114
|
+
const logs = path.join(hp, '.hometrans', 'queue_logs');
|
|
115
|
+
fs.mkdirSync(logs, { recursive: true });
|
|
116
|
+
fs.writeFileSync(path.join(logs, `${gid}.phase5.log`), r.out, 'utf8');
|
|
117
|
+
const m = /blocking=(\d+)/.exec(r.out);
|
|
118
|
+
const missing = r.out.split(/\r?\n/).some((l) => /^\[missing_files\]/.test(l) && headingBlocking(l) > 0);
|
|
119
|
+
return { blocking: m ? Number(m[1]) : -1, issues: blockingIssues(r.out), missing, out: r.out };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Step 1: release reported groups and stalled units. Returns what the parent must still do. */
|
|
123
|
+
function releaseStep(hp, out) {
|
|
124
|
+
const st = gq.loadState(hp);
|
|
125
|
+
const canStop = !gq.NO_CANCEL_HOSTS.has(ac.get(st.config, 'host', ''));
|
|
126
|
+
const reaped = Q(hp, 'reap').json ?? {};
|
|
127
|
+
for (const gid of reaped.reported ?? []) {
|
|
128
|
+
const r = Q(hp, 'release', '--unit', gid);
|
|
129
|
+
if (r.code !== 0) { failed(out, gid, r, 'release'); continue; }
|
|
130
|
+
out.released.push(gid);
|
|
131
|
+
}
|
|
132
|
+
for (const s of reaped.stalled ?? []) {
|
|
133
|
+
// a host that can cancel needs its task stopped first, or the old agent keeps writing
|
|
134
|
+
if (canStop) { out.stop_first.push({ unit: s.unit, task: s.task ?? null, idle_min: s.idle_min }); continue; }
|
|
135
|
+
const rr = Q(hp, 'release', '--unit', s.unit, '--stalled');
|
|
136
|
+
if (rr.code !== 0) { failed(out, s.unit, rr, 'release --stalled'); continue; }
|
|
137
|
+
const r = rr.json ?? {};
|
|
138
|
+
out.released.push(s.unit);
|
|
139
|
+
for (const row of r.released ?? []) if (row.needs === 'human') out.needs_human.push({ group: row.group, hint: row.hint });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Verified groups whose checkpoint commit failed (queue_logs/commit_pending.json, group_pass's own
|
|
145
|
+
* file: queue_state.json belongs to group_queue). A verified group is never `returned` again, so
|
|
146
|
+
* without this list its commit would be dropped for good and the next group's commit could take
|
|
147
|
+
* its files.
|
|
148
|
+
*/
|
|
149
|
+
const pendingPath = (hp) => path.join(hp, '.hometrans', 'queue_logs', 'commit_pending.json');
|
|
150
|
+
export function loadPending(hp) {
|
|
151
|
+
try { const v = JSON.parse(fs.readFileSync(pendingPath(hp), 'utf8')); return v && typeof v === 'object' && !Array.isArray(v) ? v : {}; } catch { return {}; }
|
|
152
|
+
}
|
|
153
|
+
function savePending(hp, doc) {
|
|
154
|
+
fs.mkdirSync(path.dirname(pendingPath(hp)), { recursive: true });
|
|
155
|
+
fs.writeFileSync(pendingPath(hp), JSON.stringify(doc, null, 2) + '\n', 'utf8');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** A group_commit failure no retry can fix: the group is not in the plan, or was never dispatched. */
|
|
159
|
+
const PERMANENT = /unknown group id|was never dispatched/;
|
|
160
|
+
|
|
161
|
+
/** Step 0: retry each pending checkpoint commit, before any newer group commits. */
|
|
162
|
+
function retryCommits(hp, out) {
|
|
163
|
+
const pending = loadPending(hp);
|
|
164
|
+
const gids = Object.keys(pending);
|
|
165
|
+
if (!gids.length) return;
|
|
166
|
+
for (const gid of gids) {
|
|
167
|
+
const err = commitOutcome(out, gid, run('group_commit.mjs', [hp, '--group', gid]), 'committed_late');
|
|
168
|
+
if (err === null) { delete pending[gid]; continue; }
|
|
169
|
+
if (PERMANENT.test(err)) {
|
|
170
|
+
// retried every pass it would keep the queue from ever going idle
|
|
171
|
+
delete pending[gid];
|
|
172
|
+
out.needs_human.at(-1).hint = `no checkpoint commit possible, dropped from commit_pending.json: ${err}`;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
pending[gid] = { error: err, at: Date.now() };
|
|
176
|
+
}
|
|
177
|
+
savePending(hp, pending);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** A verified group's first commit attempt; a failure goes to commit_pending.json for the next pass. */
|
|
181
|
+
function commitVerified(hp, out, gid) {
|
|
182
|
+
const err = commitOutcome(out, gid, run('group_commit.mjs', [hp, '--group', gid]));
|
|
183
|
+
if (err === null) return;
|
|
184
|
+
if (PERMANENT.test(err)) {
|
|
185
|
+
// not queued for a retry: say so, not "retried on the next pass"
|
|
186
|
+
out.needs_human.at(-1).hint = `no checkpoint commit possible: ${err}`;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const pending = loadPending(hp);
|
|
190
|
+
pending[gid] = { error: err, at: Date.now() };
|
|
191
|
+
savePending(hp, pending);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Step 2: verify each `returned` group from disk; the parent's judgement is phase5_check. */
|
|
195
|
+
function verifyStep(hp, out, commit) {
|
|
196
|
+
const st = gq.loadState(hp);
|
|
197
|
+
for (const [gid, s] of Object.entries(st.groups)) {
|
|
198
|
+
if (s.state !== 'returned') continue;
|
|
199
|
+
const p = phase5(hp, gid);
|
|
200
|
+
if (p.blocking < 0) {
|
|
201
|
+
// phase5_check crashed or printed no verdict: a requeue would ask the agent to fix nothing it can see
|
|
202
|
+
const tail = p.out.trim().split(/\r?\n/).slice(-3).join(' | ').slice(0, 300);
|
|
203
|
+
out.needs_human.push({ group: gid, hint: `phase5_check gave no blocking= verdict (see queue_logs/${gid}.phase5.log): ${tail}` });
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (p.blocking === 0) {
|
|
207
|
+
const v = Q(hp, 'verified', '--group', gid, '--summary', 'phase5 blocking 0');
|
|
208
|
+
if (v.code !== 0) { out.needs_human.push({ group: gid, hint: v.out.slice(0, 300) }); continue; }
|
|
209
|
+
if (!commit) { out.verified.push({ group: gid, commit: '' }); continue; }
|
|
210
|
+
commitVerified(hp, out, gid);
|
|
211
|
+
} else if ((s.attempts ?? 0) >= gq.MAX_ATTEMPTS) {
|
|
212
|
+
// the same session already answered this three times: a fourth identical request will not differ
|
|
213
|
+
out.needs_human.push({ group: gid, hint: `phase5 blocking=${p.blocking} after ${s.attempts} attempts: ${p.issues}` });
|
|
214
|
+
} else {
|
|
215
|
+
const msg = `phase5_check blocking=${p.blocking}: ${p.issues}. Fix every blocking item, rewrite the report, reply DONE ${gid}`;
|
|
216
|
+
const rq = Q(hp, 'requeue', '--group', gid, ...(p.missing ? ['--resume'] : []), '--message', msg);
|
|
217
|
+
if (rq.code !== 0) { failed(out, gid, rq, 'requeue'); continue; }
|
|
218
|
+
out.requeued.push({ group: gid, blocking: p.blocking });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** What the parent does after this pass: one line, so it never has to re-read the queue. */
|
|
224
|
+
function nextAction(out, summary) {
|
|
225
|
+
if (out.stop_first.length) return 'stop each stop_first task, then `group_queue.mjs release --unit <unit> --stalled`, then run this pass again';
|
|
226
|
+
if (out.reviews_unbound) return 'dispatch a reviewer for every reviews_unbound answers file (Step 3.2) and `review-bind` it: the capture cannot finish without them; then start `dispatch`';
|
|
227
|
+
if (out.dispatch.length) return 'start every dispatch entry (resume_task set: resume that session), `group_queue.mjs bind` each, then `group_queue.mjs wait` (shell timeout above 9 min)';
|
|
228
|
+
if (out.needs_human.length) return 'needs_human lists groups the queue cannot move: read each hint, fix the cause, `requeue` or ask the user';
|
|
229
|
+
if (summary?.idle && !(summary.returned_unverified ?? []).length && !Object.keys(summary.stuck ?? {}).length) return 'queue idle: go to Step 5.5';
|
|
230
|
+
return '`group_queue.mjs wait` (never sleep in a loop), then run this pass again';
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function pass(hp, { commit = true, lease = true } = {}) {
|
|
234
|
+
if (!gq.loadState(hp)) {
|
|
235
|
+
throw new ac.SystemExit(`no ${path.join(hp, '.hometrans', 'queue_state.json')}: run "group_queue.mjs init" first`);
|
|
236
|
+
}
|
|
237
|
+
const out = { released: [], verified: [], requeued: [], dispatch: [], stop_first: [], needs_human: [] };
|
|
238
|
+
releaseStep(hp, out);
|
|
239
|
+
if (commit) retryCommits(hp, out);
|
|
240
|
+
verifyStep(hp, out, commit);
|
|
241
|
+
if (lease && !out.stop_first.length) {
|
|
242
|
+
const l = Q(hp, 'lease').json ?? {};
|
|
243
|
+
out.dispatch = (l.dispatch ?? []).map((d) => ({ unit: d.unit, phase: d.phase ?? null, resume_task: d.resume_task ?? null,
|
|
244
|
+
description: d.description ?? null, message: d.message }));
|
|
245
|
+
if ((l.released_without_dispatch ?? []).length) out.released_without_dispatch = l.released_without_dispatch;
|
|
246
|
+
}
|
|
247
|
+
const summary = Q(hp, 'status').json ?? {};
|
|
248
|
+
out.counts = summary.counts ?? null;
|
|
249
|
+
out.free_slots = summary.free_slots ?? null;
|
|
250
|
+
// review parts the explorer waits on with no reviewer: the capture cannot finish without them
|
|
251
|
+
if ((summary.reviews_unbound ?? []).length) out.reviews_unbound = summary.reviews_unbound;
|
|
252
|
+
out.next = nextAction(out, summary);
|
|
253
|
+
return out;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
257
|
+
const { args: a } = ac.parseCli({
|
|
258
|
+
prog: 'group_pass.mjs', description: 'One pass of the Step 5.4 loop: release, verify, lease. No sleeping.',
|
|
259
|
+
positionals: [{ name: 'harmony_dir' }],
|
|
260
|
+
options: [
|
|
261
|
+
{ flags: ['--no-commit'], action: 'store_true', help: 'verify without running group_commit.mjs' },
|
|
262
|
+
{ flags: ['--no-lease'], action: 'store_true', help: 'release and verify only' },
|
|
263
|
+
],
|
|
264
|
+
}, argv);
|
|
265
|
+
ac.printJson(pass(a.harmony_dir, { commit: !a.no_commit, lease: !a.no_lease }), 0);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
|
|
269
|
+
ac.runMain(main);
|
|
270
|
+
}
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
* node group_queue.mjs reap <harmony_dir> # reported / silent units
|
|
76
76
|
* node group_queue.mjs review-bind <harmony_dir> --name <part> --answers <path> [--task <id>]
|
|
77
77
|
* node group_queue.mjs wait <harmony_dir> [--timeout-s 540] [--job run_cycle]
|
|
78
|
-
* node group_queue.mjs status <harmony_dir>
|
|
78
|
+
* node group_queue.mjs status <harmony_dir> [--assert-settled] # exit 1 while a group is still open
|
|
79
79
|
* node group_queue.mjs refresh <harmony_dir> [--force] # rebuild a plan behind the captures
|
|
80
80
|
* node group_queue.mjs verified <harmony_dir> --group G007 [--summary "..."] # also marks its pages done
|
|
81
81
|
* node group_queue.mjs requeue <harmony_dir> --group G007 [--message "..."] [--resume | --fresh]
|
|
82
|
-
* node group_queue.mjs stop <harmony_dir>
|
|
82
|
+
* node group_queue.mjs stop <harmony_dir> --by user|handoff --reason "..."
|
|
83
83
|
*
|
|
84
84
|
* State: .hometrans/queue_state.json, written only by the parent through this
|
|
85
85
|
* script. Reports: .hometrans/queue_logs/<GID>.report.md, written by the agents.
|
|
@@ -522,6 +522,41 @@ export function promptProblem(st, gid) {
|
|
|
522
522
|
return `${Math.round(size / 1024)} KB > ${PROMPT_MAX_BYTES / 1024} KB: the agent's Read tool would truncate it; `
|
|
523
523
|
+ 'reference the source pack and inputs by path instead of inlining them';
|
|
524
524
|
}
|
|
525
|
+
const plan = _plan(st.config.hp, null);
|
|
526
|
+
const group = plan ? plan[0].get(gid) : null;
|
|
527
|
+
return group ? placementProblem(text, group) : null;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** Wording that hands the module choice back to the conversion agent (WeatherApp 11-22: "内容可放 features/x"). */
|
|
531
|
+
// The choice wording must be followed by a module path or the word 模块: "图片可放大", "用户可选择城市" and
|
|
532
|
+
// "sorted by function name" are UI descriptions, not a module choice. A path inside a module (a file with an
|
|
533
|
+
// extension, or one under an ETS directory such as components/ or pages/) says where a file goes, not which module.
|
|
534
|
+
const ETS_DIRS = 'pages|components|views|view|viewmodel|viewmodels|widgets|states|utils|common|model|models|dialogs|entryability|resources|src';
|
|
535
|
+
const MODULE_CHOICE = new RegExp(
|
|
536
|
+
'(?:可以?放(?:置)?|可选择|自行(?:选择|决定|判断)|按功能(?:选择|决定))\\s*(?:放)?(?:在|到|入|于)?\\s*'
|
|
537
|
+
+ `(?:\`?(?!(?:${ETS_DIRS})/)[\\w-]+(?:/[\\w-]+)+(?![\\w./-])\`?|(?:哪个|目标|所属|对应)?模块)`
|
|
538
|
+
+ '|(?:pick|choose|select|decide) (?:the |a |which )?(?:target )?module', 'i');
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Why a prompt does not carry the plan's module placement (module_placement.mjs), or null.
|
|
542
|
+
* A placed group's prompt states `TARGET_MODULE = <module>`, and `TARGET_MODULE <node> = <module>` for every
|
|
543
|
+
* member placed elsewhere, and never tells the agent it may pick the module itself.
|
|
544
|
+
*/
|
|
545
|
+
export function placementProblem(text, group) {
|
|
546
|
+
const mod = ac.get(group ?? {}, 'module', null);
|
|
547
|
+
if (!mod) return null;
|
|
548
|
+
const t = String(text);
|
|
549
|
+
const declared = (node, m) => {
|
|
550
|
+
const esc = (s) => String(s).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
551
|
+
return new RegExp(`^\\s*TARGET_MODULE${node ? `\\s+${esc(node)}` : ''}\\s*=\\s*\`?${esc(m)}\`?\\s*$`, 'm').test(t);
|
|
552
|
+
};
|
|
553
|
+
if (!declared(null, mod)) return `no TARGET_MODULE = ${mod} line: state the module the plan places this group in`;
|
|
554
|
+
const missing = Object.entries(ac.or(ac.get(group, 'member_modules'), {})).filter(([n, m]) => !declared(n, m));
|
|
555
|
+
if (missing.length) {
|
|
556
|
+
return `missing ${missing.map(([n, m]) => `TARGET_MODULE ${n} = ${m}`).join(', ')}: a member the plan places in another module`;
|
|
557
|
+
}
|
|
558
|
+
const choice = t.split(/\r?\n/).find((l) => !/^\s*TARGET_MODULE\b/.test(l) && MODULE_CHOICE.test(l));
|
|
559
|
+
if (choice) return `"${choice.trim().slice(0, 60)}" lets the agent choose the module: the plan's TARGET_MODULE is binding`;
|
|
525
560
|
return null;
|
|
526
561
|
}
|
|
527
562
|
|
|
@@ -609,6 +644,23 @@ export function activeReviews(hp) {
|
|
|
609
644
|
return files.filter((f) => !answersCheck.answersDone(f).complete).length;
|
|
610
645
|
}
|
|
611
646
|
|
|
647
|
+
/**
|
|
648
|
+
* Review parts the explorer waits on (capture_pending.json `reviews`, explorer not finished) that no
|
|
649
|
+
* reviewer is bound to yet. They are demand, not work: `activeReviews` counts only dispatched
|
|
650
|
+
* reviewers, so conversion agents filled every slot and nobody dispatched these. Measured (coolmall):
|
|
651
|
+
* six direct_launch parts sat unanswered for the whole run, the capture cycle never finished, and 9 pages
|
|
652
|
+
* reached conversion as source-only that the explorer could have captured. `freeSlots` holds slots back
|
|
653
|
+
* for them and `summary.reviews_unbound` tells the parent to dispatch.
|
|
654
|
+
*/
|
|
655
|
+
export function unboundReviewParts(hp) {
|
|
656
|
+
const doc = ac.truthy(hp) ? _captureDoc(hp) : null;
|
|
657
|
+
if (!doc || ac.truthy(ac.get(doc, 'finished'))) return [];
|
|
658
|
+
const bound = new Set(Object.values(_reviewers(hp) ?? {}).filter((r) => ac.isDict(r) && ac.truthy(r.answers))
|
|
659
|
+
.map((r) => ac.resolvePath(r.answers)));
|
|
660
|
+
return ac.or(ac.get(doc, 'reviews'), []).map((f) => ac.resolvePath(f))
|
|
661
|
+
.filter((f) => !bound.has(f) && !answersCheck.answersDone(f).complete);
|
|
662
|
+
}
|
|
663
|
+
|
|
612
664
|
/**
|
|
613
665
|
* A binding whose part was already consumed: its worklist part is gone (the explorer merged
|
|
614
666
|
* the parts, or re-extracted and re-split them) or the merged `<stem>_answers.json` is
|
|
@@ -686,7 +738,15 @@ export function freeSlots(st, hp = null) {
|
|
|
686
738
|
const busy = runningUnits(st).size;
|
|
687
739
|
let free = st.width - busy;
|
|
688
740
|
const cap = ac.get(st.config, 'max_agents', 0);
|
|
689
|
-
if (cap > 0)
|
|
741
|
+
if (cap > 0) {
|
|
742
|
+
// Undispatched review parts hold slots back, at most half of them rounded down (max_agents 1 holds
|
|
743
|
+
// none, so conversion always keeps a slot): a capture whose parent never
|
|
744
|
+
// dispatches its reviewers must not take conversion's slots for good (summary.reviews_unbound tells it to).
|
|
745
|
+
// (without reviewers.json activeReviews already falls back to counting every listed part)
|
|
746
|
+
const hold = _reviewers(hp ?? st.config.hp) ? unboundReviewParts(hp ?? st.config.hp).length : 0;
|
|
747
|
+
const held = Math.min(hold, Math.floor(cap / 2));
|
|
748
|
+
free = Math.min(free, cap - activeReviews(hp ?? st.config.hp) - held - busy);
|
|
749
|
+
}
|
|
690
750
|
return Math.max(0, free);
|
|
691
751
|
}
|
|
692
752
|
|
|
@@ -1187,6 +1247,29 @@ export const PROVIDE_RULE = 'You lead shared components other groups are waiting
|
|
|
1187
1247
|
+ '--group <GID> --family "<family>" --files <its ETS-relative files, comma-separated>` -- its '
|
|
1188
1248
|
+ 'followers start then. After that, never change that interface; internal fixes are fine.';
|
|
1189
1249
|
|
|
1250
|
+
/**
|
|
1251
|
+
* A family whose holders sit in several feature modules (plan `shared_families`, build_conversion_set.mjs): the
|
|
1252
|
+
* leader writes it into common/, never into its own feature module. Measured: a shared scaffold, held by
|
|
1253
|
+
* three feature modules, had no common component; each page re-translated it and the settings sheet came out
|
|
1254
|
+
* full-height on three pages and half-height on five.
|
|
1255
|
+
*/
|
|
1256
|
+
export const SHARED_FAMILY_RULE = 'These families are reused across modules: {families}. Write each shared component '
|
|
1257
|
+
+ 'into a common/* HAR that every listed module can depend on (the design\'s shared UI components module; add the '
|
|
1258
|
+
+ 'oh-package.json5 dependency where it is missing), export it from that HAR\'s Index.ets, and provide that path. Never '
|
|
1259
|
+
+ 'put it in your own feature module, and never let a page re-create it. Translate it once from the Android composable '
|
|
1260
|
+
+ '(every parameter, default and state it owns, e.g. a ModalBottomSheet\'s sheetState), so all its pages behave the same.';
|
|
1261
|
+
|
|
1262
|
+
/** Leader families of `ids` that span several modules: {gid: [{family, modules}]}. */
|
|
1263
|
+
export function _sharedFamilies(plan, ids) {
|
|
1264
|
+
plan = asMap(plan);
|
|
1265
|
+
const out = {};
|
|
1266
|
+
for (const id of ids) {
|
|
1267
|
+
const fams = ac.or(ac.get(plan.get(id), 'shared_families'), []);
|
|
1268
|
+
if (fams.length) out[id] = fams;
|
|
1269
|
+
}
|
|
1270
|
+
return out;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1190
1273
|
/**
|
|
1191
1274
|
* Step 5.2 contract item 8, carried by every launch message: any group may be the first to write a component into a
|
|
1192
1275
|
* shared module, so the rule cannot ride on PROVIDE_RULE (leaders only) or on a prompt the parent may have written
|
|
@@ -1288,6 +1371,12 @@ function _messageBody(hp, st, ids, plan = null, launch = false) {
|
|
|
1288
1371
|
leads: leads.map(([g, fs_]) => `${g}: ${fs_.map((x) => `"${x}"`).join(', ')}`).join('; '), skill, hp: String(hp),
|
|
1289
1372
|
});
|
|
1290
1373
|
}
|
|
1374
|
+
const sharedFams = Object.entries(_sharedFamilies(plan ?? _plan(hp, [new Map(), false])[0], ids));
|
|
1375
|
+
if (sharedFams.length) {
|
|
1376
|
+
rule += '\n' + fmt(SHARED_FAMILY_RULE, {
|
|
1377
|
+
families: sharedFams.flatMap(([g, fs_]) => fs_.map((f) => `${g}: "${f.family}" (${f.modules.join(', ')})`)).join('; '),
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1291
1380
|
rule += '\n' + SHARED_MODULE_RULE;
|
|
1292
1381
|
if (!launch && ac.truthy(ac.get(first, 'next_session'))) { // resume: same session, short nudge
|
|
1293
1382
|
let msg = ac.or(ac.get(first, 'next_message'), RESUME);
|
|
@@ -1358,6 +1447,12 @@ export function runningUnits(st) {
|
|
|
1358
1447
|
return out;
|
|
1359
1448
|
}
|
|
1360
1449
|
|
|
1450
|
+
/** Group states that still owe work: never converted, converting, or returned but not yet verified. */
|
|
1451
|
+
export const OPEN_STATES = new Set(['pending', 'queued', 'running', 'blocked', 'returned']);
|
|
1452
|
+
|
|
1453
|
+
/** Who may stop leasing with groups still open. Slow progress or elapsed time is not one of them. */
|
|
1454
|
+
export const STOP_BY = ['user', 'handoff'];
|
|
1455
|
+
|
|
1361
1456
|
export function summary(st, plan = null, exploring = false) {
|
|
1362
1457
|
const counts = {};
|
|
1363
1458
|
const gs = Object.entries(st.groups);
|
|
@@ -1371,6 +1466,7 @@ export function summary(st, plan = null, exploring = false) {
|
|
|
1371
1466
|
return {
|
|
1372
1467
|
counts, width: st.width, running, free_slots: freeSlots(st), ready_units: readyUnits,
|
|
1373
1468
|
backfill_units: backfillUnits, reviews_running: activeReviews(st.config.hp),
|
|
1469
|
+
reviews_unbound: unboundReviewParts(st.config.hp),
|
|
1374
1470
|
max_agents: ac.get(st.config, 'max_agents', 0),
|
|
1375
1471
|
returned_unverified: gs.filter(([, s]) => s.state === 'returned').map(([g]) => g),
|
|
1376
1472
|
// running step 1 of evidence intake (reading only; no task yet)
|
|
@@ -1394,7 +1490,12 @@ export function summary(st, plan = null, exploring = false) {
|
|
|
1394
1490
|
...gs.filter(([g, s]) => s.state === 'blocked' && plan.has(g)).map(([g]) => [g, orphanedBy(st, plan, g)
|
|
1395
1491
|
.map((a) => `blocked: after ${a} is ${ac.get(st.groups[a] ?? {}, 'state') ?? 'not in the plan'} (requeue it)`)]),
|
|
1396
1492
|
]) : {},
|
|
1493
|
+
// Not settled yet: nothing has converted these, or the parent has not verified them. Step 5.5 needs this empty
|
|
1494
|
+
// (status --assert-settled); only a user abort or a host hand-off (stop --by) may leave groups open.
|
|
1495
|
+
open: gs.filter(([, s]) => OPEN_STATES.has(s.state)).map(([g]) => g),
|
|
1397
1496
|
exploring, stopping: st.stopping,
|
|
1497
|
+
...(st.stop ? { stop: st.stop } : {}),
|
|
1498
|
+
...(st.previous_stop ? { previous_stop: st.previous_stop } : {}),
|
|
1398
1499
|
};
|
|
1399
1500
|
}
|
|
1400
1501
|
|
|
@@ -1812,7 +1913,10 @@ function _settle(hp, st, gid, { stalled = false, error = '', report = null } = {
|
|
|
1812
1913
|
next = [RESUME, ac.or(ac.get(s, 'session'), null)];
|
|
1813
1914
|
} else if (row.action === 'redispatch' && !ac.truthy(ac.get(s, 'narrowed'))) {
|
|
1814
1915
|
s.narrowed = true;
|
|
1815
|
-
|
|
1916
|
+
// name the files it never wrote: "write the anchor first" alone let an off-target report repeat itself
|
|
1917
|
+
const names = row.state === 'off-target' && row.missing.length
|
|
1918
|
+
? ` The report names files that are not this group's write set. Write exactly these first: ${row.missing.join(', ')}.` : '';
|
|
1919
|
+
next = [ac.truthy(ac.get(row, 'verify_only')) ? NARROW_VERIFY : NARROW + names, null];
|
|
1816
1920
|
}
|
|
1817
1921
|
const out = { group: gid, action: row.action, state: row.state, written: row.written, missing: row.missing };
|
|
1818
1922
|
if (next) {
|
|
@@ -2071,14 +2175,7 @@ export async function wait(hp, { timeoutS = 540, pollS = 5, jobs = [], answers =
|
|
|
2071
2175
|
const initiallyDoneAgents = new Set(watchedAgents(hp).filter((a) => a.done).map((a) => a.name));
|
|
2072
2176
|
// T5: review parts the explorer waits on (capture_pending.json `reviews`) that no reviewer was
|
|
2073
2177
|
// bound to: a run_cycle that follows its answers (--follow-min) does not exit to say so.
|
|
2074
|
-
const unboundReviews = () =>
|
|
2075
|
-
const doc = _captureDoc(hp);
|
|
2076
|
-
if (!doc || ac.truthy(ac.get(doc, 'finished'))) return [];
|
|
2077
|
-
const bound = new Set(Object.values(_reviewers(hp) ?? {}).filter((r) => ac.isDict(r) && ac.truthy(r.answers))
|
|
2078
|
-
.map((r) => ac.resolvePath(r.answers)));
|
|
2079
|
-
return ac.or(ac.get(doc, 'reviews'), []).map((f) => ac.resolvePath(f))
|
|
2080
|
-
.filter((f) => !bound.has(f) && !answersCheck.answersDone(f).complete);
|
|
2081
|
-
};
|
|
2178
|
+
const unboundReviews = () => unboundReviewParts(hp);
|
|
2082
2179
|
const initiallyUnbound = new Set(unboundReviews());
|
|
2083
2180
|
let lastRefresh = null;
|
|
2084
2181
|
for (;;) {
|
|
@@ -2181,8 +2278,17 @@ export function control(hp, cmd) {
|
|
|
2181
2278
|
const s = typeof gid === 'string' && Object.hasOwn(st.groups, gid) ? st.groups[gid] : null;
|
|
2182
2279
|
const out = { done: cmd };
|
|
2183
2280
|
if (cmd.op === 'stop') {
|
|
2281
|
+
const by = ac.get(cmd, 'by');
|
|
2282
|
+
const reason = String(ac.get(cmd, 'reason') ?? '').trim();
|
|
2283
|
+
if (!STOP_BY.includes(by) || reason === '') {
|
|
2284
|
+
throw new ac.SystemExit('stop needs --by user|handoff and --reason "<why>". It is only for a user abort or a host '
|
|
2285
|
+
+ 'hand-off: slow progress, elapsed time, retries or a long tail of groups are not reasons to stop '
|
|
2286
|
+
+ '(step5-convert.md item 5). Keep running passes; requeue or fix what `status` lists under `stuck`.');
|
|
2287
|
+
}
|
|
2288
|
+
const open = Object.entries(st.groups).filter(([, s]) => OPEN_STATES.has(s.state)).map(([g]) => g);
|
|
2184
2289
|
st.stopping = true;
|
|
2185
|
-
|
|
2290
|
+
st.stop = { by, reason, at: _now(), open };
|
|
2291
|
+
_event(st, null, `stop requested by ${by}: ${reason} (${open.length} group(s) left open)`);
|
|
2186
2292
|
} else if (!s) {
|
|
2187
2293
|
throw new ac.SystemExit(`unknown group id: ${gid}`);
|
|
2188
2294
|
} else if (cmd.op === 'verified') {
|
|
@@ -2340,6 +2446,9 @@ function _init(hp, a) {
|
|
|
2340
2446
|
throw new ac.SystemExit(`ETS root not found: ${ets} -- write batch_progress.json (with ui_module) first`);
|
|
2341
2447
|
}
|
|
2342
2448
|
if (ac.truthy(old)) {
|
|
2449
|
+
// init clears the stop, so a runner retry would no longer see that the user aborted: keep the last one on record
|
|
2450
|
+
const lastStop = ac.get(old, 'stop') ?? ac.get(old, 'previous_stop');
|
|
2451
|
+
if (ac.truthy(lastStop)) st.previous_stop = lastStop;
|
|
2343
2452
|
for (const [gid, s] of Object.entries(ac.get(old, 'groups', {}))) {
|
|
2344
2453
|
if (!Object.hasOwn(st.groups, gid)) continue;
|
|
2345
2454
|
if (['returned', 'verified', 'skipped'].includes(s.state)) st.groups[gid] = s;
|
|
@@ -2402,11 +2511,11 @@ total throughput instead (~1.3 turns/min measured earlier) wants a lower --width
|
|
|
2402
2511
|
group_queue.mjs review-bind <harmony_dir> --name <part> --answers <path> [--task <id>] [--kind reviewer]
|
|
2403
2512
|
group_queue.mjs review-unbind <harmony_dir> --name <part> # the reviewer ended without its answers
|
|
2404
2513
|
group_queue.mjs wait <harmony_dir> [--timeout-s 540] [--job run_cycle] [--answers <file>]
|
|
2405
|
-
group_queue.mjs status <harmony_dir>
|
|
2514
|
+
group_queue.mjs status <harmony_dir> [--assert-settled] # exit 1 while a group is still open
|
|
2406
2515
|
group_queue.mjs refresh <harmony_dir> [--force]
|
|
2407
2516
|
group_queue.mjs verified <harmony_dir> --group G007 [--summary "..."] # also marks its pages done in batch_progress.json
|
|
2408
2517
|
group_queue.mjs requeue <harmony_dir> --group G007 [--message "..."] [--resume | --fresh]
|
|
2409
|
-
group_queue.mjs stop <harmony_dir>
|
|
2518
|
+
group_queue.mjs stop <harmony_dir> --by user|handoff --reason "..."
|
|
2410
2519
|
|
|
2411
2520
|
lease writes each unit's full message to .hometrans/work/dispatch/<unit>.a<attempt>.md and returns
|
|
2412
2521
|
\`message\` = "Read the file <message_file> and follow it fully." -- the sub-agent prompt.
|
|
@@ -2464,6 +2573,10 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
2464
2573
|
{ flags: ['--message'], help: 'extra instruction for a requeued group' },
|
|
2465
2574
|
{ flags: ['--summary'], help: "verified: one-line summary recorded on the group's pages in batch_progress.json" },
|
|
2466
2575
|
{ flags: ['--resume'], action: 'store_true', help: 'requeue into the same session (default when it stalled)' },
|
|
2576
|
+
{ flags: ['--by'], choices: STOP_BY, help: 'stop: who ends the campaign early (user abort / host hand-off)' },
|
|
2577
|
+
{ flags: ['--reason'], help: 'stop: why the campaign ends with groups still open (recorded for the Step 7 report)' },
|
|
2578
|
+
{ flags: ['--assert-settled'], action: 'store_true',
|
|
2579
|
+
help: 'status: exit 1 while any group is pending / queued / running / blocked / returned' },
|
|
2467
2580
|
{ flags: ['--fresh'], action: 'store_true',
|
|
2468
2581
|
help: 'requeue as a new session even though its bound session stalled (stop/await that session first)' },
|
|
2469
2582
|
],
|
|
@@ -2500,8 +2613,13 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
2500
2613
|
out = await wait(hp, { timeoutS: a.timeout_s, jobs: a.job, answers: a.answers });
|
|
2501
2614
|
} else if (a.mode === 'status') {
|
|
2502
2615
|
out = status(hp);
|
|
2616
|
+
if (a.assert_settled && Array.isArray(out.open) && out.open.length) {
|
|
2617
|
+
ac.printJson({ settled: false, open: out.open, stuck: out.stuck, ...(out.stop ? { stop: out.stop } : {}) }, 1);
|
|
2618
|
+
process.exitCode = 1;
|
|
2619
|
+
return;
|
|
2620
|
+
}
|
|
2503
2621
|
} else if (a.mode === 'stop') {
|
|
2504
|
-
out = control(hp, { op: 'stop' });
|
|
2622
|
+
out = control(hp, { op: 'stop', by: a.by, reason: a.reason });
|
|
2505
2623
|
} else {
|
|
2506
2624
|
if (!a.group) error(`${a.mode} requires --group`);
|
|
2507
2625
|
if (a.resume && a.fresh) error('requeue: --resume and --fresh exclude each other');
|
|
@@ -83,12 +83,27 @@ export function _uiModule(hp, progress) {
|
|
|
83
83
|
const named = ac.get(progress, 'ui_module');
|
|
84
84
|
if (ac.truthy(named)) return named;
|
|
85
85
|
if (isDir(path.join(hp, 'entry', 'src', 'main', 'ets'))) return 'entry';
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
const subdirs = (d) => {
|
|
87
|
+
try {
|
|
88
|
+
return fs.readdirSync(d, { withFileTypes: true })
|
|
89
|
+
.filter((e) => e.isDirectory() && !e.name.startsWith('.') && !['node_modules', 'oh_modules', 'build'].includes(e.name))
|
|
90
|
+
.map((e) => path.join(d, e.name));
|
|
91
|
+
} catch { return []; }
|
|
92
|
+
};
|
|
93
|
+
const rel = (d) => path.relative(hp, d).replace(/\\/g, '/');
|
|
94
|
+
// the one module whose module.json5 is the entry HAP first: a layered project (products/phone, features/x)
|
|
95
|
+
// may also have a single top-level HAR, which is no UI module
|
|
96
|
+
const entries = [];
|
|
97
|
+
for (const d of subdirs(hp)) {
|
|
98
|
+
for (const m of [d, ...subdirs(d)]) {
|
|
99
|
+
try {
|
|
100
|
+
const t = fs.readFileSync(path.join(m, 'src', 'main', 'module.json5'), 'utf8');
|
|
101
|
+
if (/["']?type["']?\s*:\s*["']entry["']/.test(t)) entries.push(rel(m));
|
|
102
|
+
} catch { /* not a module */ }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (entries.length === 1) return entries[0];
|
|
106
|
+
const found = subdirs(hp).filter((d) => isDir(path.join(d, 'src', 'main', 'ets'))).map(rel);
|
|
92
107
|
return found.length === 1 ? found[0] : 'entry';
|
|
93
108
|
}
|
|
94
109
|
|
|
@@ -384,11 +399,22 @@ export function _status(hp, group, now = null) {
|
|
|
384
399
|
// a reported file at another path stands in for its namesake -- unless it is itself predicted
|
|
385
400
|
// (pages/Index.ets must not also satisfy a predicted components/x/Index.ets)
|
|
386
401
|
const names = new Set(reported.filter((r) => !predictedRel.has(r)).map((r) => path.posix.basename(r)));
|
|
402
|
+
// A predicted file the report names at its own path counts too, when this group wrote it in an
|
|
403
|
+
// earlier attempt: a re-attempt that only confirms finished code leaves its mtime before `since`.
|
|
404
|
+
// Measured: a group requeued for a parent-side resource gap, told not to edit, was triaged
|
|
405
|
+
// off-target on every attempt until it failed, and its `after` followers stayed blocked.
|
|
406
|
+
// A file older than the group's first dispatch was never written by it: a report that only
|
|
407
|
+
// names it (UNWIRED / 事实冲突 cite `.ets:line` too) is not progress.
|
|
408
|
+
const reportedSet = new Set(reported);
|
|
409
|
+
const first = Math.min(...times);
|
|
387
410
|
const written = [];
|
|
388
411
|
const missing = [];
|
|
389
412
|
for (const rel of predictedFiles(g)) {
|
|
390
413
|
const m = mtimeS(etsFile(hp, ets, rel));
|
|
391
|
-
const
|
|
414
|
+
const norm = String(rel).replace(/\\/g, '/');
|
|
415
|
+
const ok = (m !== null && m >= since)
|
|
416
|
+
|| (reportedSet.has(norm) && m !== null && m >= first)
|
|
417
|
+
|| names.has(path.posix.basename(norm));
|
|
392
418
|
(ok ? written : missing).push(rel);
|
|
393
419
|
}
|
|
394
420
|
return {
|
|
@@ -591,7 +617,12 @@ export function triage(hp, groups, outcomes, now = null) {
|
|
|
591
617
|
}
|
|
592
618
|
let state;
|
|
593
619
|
if (!s.missing.length && s.written.length) state = 'complete';
|
|
594
|
-
else if (s.written.length
|
|
620
|
+
else if (s.written.length) state = 'partial'; // the parent checks the reported files
|
|
621
|
+
// The report names .ets files that exist, but none is a predicted write: it edited something
|
|
622
|
+
// else (measured, coolmall G027: CartRoutePage.ets edited, CartPage.ets never written, "DONE"
|
|
623
|
+
// three times). Resuming that session repeats the same answer, so it is not partial progress.
|
|
624
|
+
else if (s.reported.length && s.missing.length) state = 'off-target';
|
|
625
|
+
else if (s.reported.length) state = 'partial';
|
|
595
626
|
else state = 'empty';
|
|
596
627
|
let action;
|
|
597
628
|
if (net) action = state === 'empty' ? 'retry' : 'resume';
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* Evidence text was wrong, so no rule that asks for more evidence text could have caught it. This stage does not read evidence:
|
|
9
9
|
*
|
|
10
10
|
* 1. read `icon_inventory` from each captured page's measure_pack.json — every visible-to-user ImageView/ImageButton
|
|
11
|
-
* (≥16dp)
|
|
12
|
-
*
|
|
11
|
+
* (≥16dp) and every image-sized leaf of another class (16–96dp, roughly square, no text: Compose draws
|
|
12
|
+
* Image/Icon/AsyncImage as a bare android.view.View), in view.xml and in each scroll frame, sampled by
|
|
13
|
+
* measure_pack itself at its **registered** position (drift corrected per subtree), with `visible` = drawn ink.
|
|
14
|
+
* Rows sharing a key (list rows reuse one resource-id) merge: visible when any row is;
|
|
13
15
|
* 2. in this group's .ets, find `// ICON: <key>[, <key>…]` markers. The key is the one measure_pack prints
|
|
14
16
|
* (resource-id without the package, else content-desc, else node<idx>); text after the key list is a free note.
|
|
15
17
|
* A marker counts only when an image-rendering call (Image / SymbolGlyph / ImageSpan / a component whose name
|
|
@@ -123,7 +125,8 @@ export function iconCoverage({ uiInfo, pageDirs, files, shared = [] }) {
|
|
|
123
125
|
}
|
|
124
126
|
for (const ic of mergeRows(mp.icon_inventory)) {
|
|
125
127
|
checked++;
|
|
126
|
-
const where = `${d} ${ic.key}${ic.rows > 1 ? ` (${ic.rows} rows)` : ''} ${ic.sampledPx}${ic.dy ? ` (dy ${ic.dy})` : ''}
|
|
128
|
+
const where = `${d} ${ic.key}${ic.rows > 1 ? ` (${ic.rows} rows)` : ''} ${ic.sampledPx}${ic.dy ? ` (dy ${ic.dy})` : ''}` +
|
|
129
|
+
`${ic.frame ? ` in scroll frame ${ic.frame}` : ''}${ic.kind === 'leaf' && ic.desc ? ` "${String(ic.desc).trim().slice(0, 16)}"` : ''}`;
|
|
127
130
|
if ((marks.get(ic.key) || []).length || detached.has(ic.key) || sharedMarks.has(ic.key)) continue;
|
|
128
131
|
const om = omits.get(ic.key);
|
|
129
132
|
if (om && om.length) {
|