@buaa_smat/hometrans 0.1.19 → 26.0.0-devecocli.2
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/agents/build-fixer.md +406 -0
- package/agents/code-reviewer.md +461 -496
- package/agents/model-render-worker.md +34 -0
- package/agents/model-worker.md +23 -0
- package/agents/specgen-worker.md +18 -0
- package/commands/hometrans.md +17 -0
- package/devecocli-plugin/common.ts +2203 -0
- package/devecocli-plugin/install.ts +61 -0
- package/devecocli-plugin/uninstall.ts +26 -0
- package/devecocli-plugin/update.ts +66 -0
- package/index.js +1418 -0
- package/package.json +81 -66
- package/platforms/atomcode/agents/build-fixer.frontmatter.md +6 -0
- package/platforms/atomcode/agents/code-reviewer.frontmatter.md +6 -0
- package/platforms/atomcode/agents/model-render-worker.frontmatter.md +6 -0
- package/platforms/atomcode/agents/model-worker.frontmatter.md +6 -0
- package/platforms/atomcode/agents/specgen-worker.frontmatter.md +6 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +5 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +5 -0
- package/plugin.jsonc +12 -0
- package/skills/a2h-app-migrate/SKILL.md +181 -0
- package/skills/a2h-app-migrate/references/config.example.json +27 -0
- package/skills/a2h-app-migrate/references/specs.example.json +19 -0
- package/skills/a2h-app-migrate/references/stage-map.md +33 -0
- package/skills/a2h-app-migrate/references/workflow.yaml +1600 -0
- package/skills/a2h-app-migrate/scripts/android_index.mjs +109 -0
- package/skills/a2h-app-migrate/scripts/check_arch_done.mjs +80 -0
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +95 -0
- package/skills/a2h-app-migrate/scripts/check_signing.mjs +152 -0
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +114 -0
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +277 -0
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +77 -0
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +147 -0
- package/skills/a2h-app-migrate/scripts/cli_values.mjs +32 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1388 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +651 -0
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +53 -0
- package/skills/a2h-app-migrate/scripts/json_io.mjs +35 -0
- package/skills/a2h-app-migrate/scripts/ledger.mjs +104 -0
- package/skills/a2h-app-migrate/scripts/lib-yaml-lite.mjs +288 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +713 -0
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +205 -0
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +121 -0
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +212 -0
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +30 -0
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +455 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +80 -0
- package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
- package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +92 -0
- package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +93 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +505 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
- package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +91 -0
- package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +109 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
- package/skills/a2h-app-migrate/test/test_preflight_report.mjs +83 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +144 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +315 -0
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +133 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +133 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +158 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +181 -0
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +39 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +168 -0
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
- package/skills/a2h-arch-generate/SKILL.md +375 -0
- package/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-android.md +103 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-uniapp.md +106 -0
- package/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
- package/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
- package/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
- package/skills/a2h-arch-generate/references/clustering-guidance.md +33 -0
- package/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
- package/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
- package/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
- package/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +120 -0
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +45 -0
- package/skills/a2h-arch-generate/references/reconciliation-model.md +204 -0
- package/skills/a2h-arch-generate/references/scope-policy.md +28 -0
- package/skills/a2h-arch-generate/references/semantic-review.md +65 -0
- package/skills/a2h-arch-generate/references/source-baseline.md +93 -0
- package/skills/a2h-arch-generate/references/source-ecosystems.md +54 -0
- package/skills/a2h-arch-generate/references/transformation-model.md +78 -0
- package/skills/a2h-arch-generate/scripts/check_module_staleness.mjs +284 -0
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +260 -0
- package/skills/a2h-arch-generate/scripts/compute_processing_order.mjs +325 -0
- package/skills/a2h-arch-generate/scripts/create_project.mjs +149 -0
- package/skills/a2h-arch-generate/scripts/dump_core_facts.mjs +151 -0
- package/skills/a2h-arch-generate/scripts/extract_core_components.mjs +167 -0
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +363 -0
- package/skills/a2h-arch-generate/scripts/generate_state.mjs +60 -0
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +326 -0
- package/skills/a2h-arch-generate/scripts/inspect_android_project.mjs +3739 -0
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +800 -0
- package/skills/a2h-arch-generate/scripts/inspect_project.mjs +251 -0
- package/skills/a2h-arch-generate/scripts/inspect_uniapp_project.mjs +809 -0
- package/skills/a2h-arch-generate/scripts/lib/py_compat.mjs +1454 -0
- package/skills/a2h-arch-generate/scripts/module_create/create.mjs +136 -0
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +636 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/build-profile.json5 +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/oh-package.json5 +10 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/applicationability/ApplicationAbility.ets +43 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/pages/Index.ets +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/module.json5 +26 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/color.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/string.json +16 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/background.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/foreground.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/layered_image.json +7 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/startIcon.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/mock/mock-config.json5 +2 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/Index.ets +1 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/build-profile.json5 +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/ets/components/MainPage.ets +19 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/module.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/string.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/Index.ets +1 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/build-profile.json5 +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/consumer-rules.txt +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/oh-package.json5 +10 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/pages/Index.ets +20 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/utils/Calc.ets +3 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/module.json5 +12 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/string.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
- package/skills/a2h-arch-generate/scripts/resolve_android_stores.mjs +529 -0
- package/skills/a2h-arch-generate/scripts/scaffold_project.mjs +230 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1122 -0
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +191 -0
- package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
- package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +138 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +829 -0
- package/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +937 -0
- package/skills/a2h-arch-generate/scripts/validate_homegraph_artifacts.mjs +542 -0
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +415 -0
- package/skills/a2h-arkts-logic-coder/SKILL.md +125 -0
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +6 -0
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +124 -0
- package/skills/a2h-arkts-logic-coder/scripts/check_module_scope.ts +224 -0
- package/skills/a2h-arkts-logic-coder/scripts/check_mvvm.ts +377 -0
- package/skills/a2h-arkts-logic-coder/scripts/stop_check_hook.ts +443 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_check_scripts.ts +211 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_worktree_compat.ts +81 -0
- package/skills/a2h-batch-ui-align/SKILL.md +309 -0
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +81 -0
- package/skills/a2h-batch-ui-align/flowchart.html +271 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/conversion-procedure.md +523 -661
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +139 -0
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +8 -8
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +3 -0
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +32 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +211 -0
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +192 -0
- package/skills/a2h-batch-ui-align/references/step5-convert.md +202 -0
- package/skills/a2h-batch-ui-align/scripts/agent_cli.mjs +572 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/scripts/android_parse_fast.ts +246 -39
- package/skills/a2h-batch-ui-align/scripts/answers_check.mjs +86 -0
- package/skills/a2h-batch-ui-align/scripts/arkts_static_check.ts +2689 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1656 -0
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +258 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1524 -0
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +166 -0
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1437 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +1869 -0
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +696 -0
- package/skills/a2h-batch-ui-align/scripts/harmony_index.mjs +218 -0
- package/skills/a2h-batch-ui-align/scripts/host_env.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1229 -0
- package/skills/a2h-batch-ui-align/scripts/occlusion.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1124 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +996 -0
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +253 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +72 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +353 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +345 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +290 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +74 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +507 -0
- package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1451 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
- package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +170 -0
- package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +244 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +130 -0
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +57 -0
- package/skills/a2h-dashboard-render/SKILL.md +65 -0
- package/skills/a2h-dashboard-render/references/artifact-contract.jsonc +147 -0
- package/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
- package/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
- package/skills/a2h-dashboard-render/references//347/234/213/346/235/277/350/257/264/346/230/216.md +83 -0
- package/skills/a2h-dashboard-render/scripts/artifact_contract.mjs +138 -0
- package/skills/a2h-dashboard-render/scripts/check-registry.mjs +87 -0
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +3215 -0
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +2010 -0
- package/skills/a2h-dashboard-render/scripts/page_capture.mjs +828 -0
- package/skills/a2h-dashboard-render/scripts/usage_readers.mjs +459 -0
- package/skills/a2h-dashboard-render/scripts/usage_worker.mjs +13 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
- package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +170 -0
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +182 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +64 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1172 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +251 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +303 -0
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +444 -0
- package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/SKILL.md +305 -293
- package/skills/a2h-module-semantic-docs/SKILL.md +227 -0
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +168 -0
- package/skills/a2h-module-semantic-docs/scripts/lib/py_compat.mjs +688 -0
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +1021 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/skills/a2h-resource-convert/SKILL.md +369 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/code-vector-icon-rules.md +4 -4
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/conversion-rules.md +16 -5
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +251 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/lottie-conversion-rules.md +17 -17
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/resource-mapping-rules.md +15 -4
- package/skills/a2h-resource-convert/references/step3_5-dependency-filter.md +54 -0
- package/skills/a2h-resource-convert/references/step4-qualifiers-and-values.md +142 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +249 -0
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +154 -0
- package/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/xml-drawable-to-svg-rules.md +38 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/a2h_resource_convert.ts +456 -90
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +1072 -0
- package/skills/a2h-resource-convert/scripts/app_identity.ts +947 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/code_vector_icons.ts +19 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +989 -0
- package/skills/a2h-resource-convert/scripts/extract_project_resources.ts +1464 -0
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
- package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
- package/skills/a2h-spec-design/SKILL.md +336 -0
- package/skills/a2h-spec-design/scripts/inspect_spec_design_inputs.mjs +146 -0
- package/skills/a2h-spec-design/scripts/lib/py_compat.mjs +481 -0
- package/skills/a2h-spec-design/scripts/move_spec_technical_reference.mjs +159 -0
- package/skills/a2h-spec-design/scripts/resolve_module_design.mjs +102 -0
- package/skills/a2h-spec-design/scripts/validate_spec_design_output.mjs +285 -0
- package/skills/a2h-spec-design/test/golden/inspect_happy.json +20 -0
- package/skills/a2h-spec-design/test/golden/move_design.md +18 -0
- package/skills/a2h-spec-design/test/golden/move_design_crlf.md +18 -0
- package/skills/a2h-spec-design/test/golden/move_spec.md +7 -0
- package/skills/a2h-spec-design/test/golden/resolve_cases.json +36 -0
- package/skills/a2h-spec-design/test/golden/validate_issue_file.md +12 -0
- package/skills/a2h-spec-design/test/golden/validate_issues.json +57 -0
- package/skills/a2h-spec-design/test/test_spec_design_scripts.mjs +381 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +228 -0
- package/skills/a2h-spec-design-pipeline/package.json +4 -0
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +63 -0
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +69 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +24 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +57 -0
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +21 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +27 -0
- package/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +21 -0
- package/skills/a2h-spec-design-pipeline/scripts/atomic_write.ts +42 -0
- package/skills/a2h-spec-design-pipeline/scripts/audit_claims.ts +252 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +77 -0
- package/skills/a2h-spec-design-pipeline/scripts/deps_ready.ts +195 -0
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +651 -0
- package/skills/a2h-spec-design-pipeline/scripts/git_baseline.ts +124 -0
- package/skills/a2h-spec-design-pipeline/scripts/inflight.mjs +944 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/bgcli.mjs +95 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +502 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_waves.ts +475 -0
- package/skills/a2h-spec-design-pipeline/scripts/reconcile.mjs +218 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +164 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_atomic_write.ts +44 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_audit_claims.ts +301 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_bgcli.mjs +64 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_branch_landed.ts +87 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_deps_ready.ts +265 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +675 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_git_baseline.ts +105 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_inflight.mjs +452 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +375 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_waves.ts +561 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_reconcile.mjs +182 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +138 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_watchdog.mjs +289 -0
- package/skills/a2h-spec-design-pipeline/scripts/watchdog.mjs +441 -0
- package/skills/a2h-spec-generate/SKILL.md +285 -0
- package/skills/a2h-spec-generate/package.json +9 -0
- package/skills/a2h-spec-generate/references/batch-mode.md +151 -0
- package/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +114 -0
- package/skills/a2h-spec-generate/references/input-formats.md +27 -0
- package/skills/a2h-spec-generate/references/library-evidence.md +3 -0
- package/skills/a2h-spec-generate/references/method-discipline.md +64 -0
- package/skills/a2h-spec-generate/references/optional-gates.json +45 -0
- package/skills/a2h-spec-generate/references/recall-guide.md +83 -0
- package/skills/a2h-spec-generate/references/recall-terse.md +3 -0
- package/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
- package/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
- package/skills/a2h-spec-generate/references/review-checklist.md +21 -0
- package/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
- package/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
- package/skills/a2h-spec-generate/references/spec-samples.md +65 -0
- package/skills/a2h-spec-generate/references/specs.schema.json +79 -0
- package/skills/a2h-spec-generate/references/synthesis-rules.md +143 -0
- package/skills/a2h-spec-generate/references/transfer-file.md +5 -0
- package/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
- package/skills/a2h-spec-generate/references/worker-rules.md +126 -0
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +514 -0
- package/skills/a2h-spec-generate/scripts/check_spec.ts +361 -0
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +470 -0
- package/skills/a2h-spec-generate/scripts/detect-project.mjs +271 -0
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +188 -0
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +150 -0
- package/skills/a2h-spec-generate/scripts/inspect-uniapp.mjs +733 -0
- package/skills/{hmos-spec-generate → a2h-spec-generate}/scripts/parse_requirements.ts +1 -1
- package/skills/a2h-spec-generate/scripts/prepare-facts.mjs +307 -0
- package/skills/a2h-spec-generate/scripts/publication-verdict.mjs +171 -0
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +280 -0
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +399 -0
- package/skills/a2h-spec-generate/scripts/report.mjs +132 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/dashboard.html +149 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-api.js +49 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-code-view.js +140 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-format.js +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-handoff.js +42 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-splitters.js +78 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-state.js +47 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-tree.js +194 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-virtual-list.js +118 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.css +245 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.html +99 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.js +220 -0
- package/skills/a2h-spec-generate/scripts/reqgen/package-lock.json +47 -0
- package/skills/a2h-spec-generate/scripts/reqgen/package.json +23 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/agent-render/serve.ts +95 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/callback-call-sites.ts +82 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/area-ownership.ts +496 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/callback-flow.ts +386 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/index.ts +24 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/index.ts +22 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1270 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/index.ts +10 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/projection.ts +804 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/render-projection.ts +51 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/android-interaction-registry.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/builder.ts +453 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/compose-api-registry.ts +526 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/index.ts +15 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/connector/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/connector/utg-inbound.ts +763 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/area-graph.ts +383 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/artifact.ts +68 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/common.ts +88 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/diagnostic.ts +64 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/gap-audit.ts +113 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/index.ts +12 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/name-traceability.ts +108 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/raw-fact.ts +377 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/req-model.ts +238 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/run.ts +134 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/semantic-completeness.ts +35 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/source-facts.ts +48 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/utg.ts +133 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/core/output-guard.ts +42 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/core/stable-id.ts +118 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/cross-area-tally-cli.ts +179 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dashboard-cli.ts +188 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump/dump.ts +1184 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump-cli.ts +373 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1014 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-output.ts +32 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +142 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +312 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +310 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +685 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/graph/paths.ts +575 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/homegraph-cli.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/android-resource-resolver.ts +391 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/androidx-preference-contracts.ts +44 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +640 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/cross-area.ts +207 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/finalizer.ts +1297 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/identity.ts +186 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/index.ts +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/planner.ts +312 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/preference-enrichment.ts +793 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/raw-facts.ts +355 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/rules.ts +271 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/scanner.ts +666 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/schema.ts +365 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/stable-key.ts +144 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +301 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/uniapp-utg-adapter.ts +543 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/xml-adapter.ts +262 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/assemble.ts +2079 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +157 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +809 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/index.ts +17 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/io.ts +165 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +806 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/query.ts +360 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/seeds.ts +218 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/spec-bindings-sidecar.ts +240 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +359 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model-cli.ts +500 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/pipeline/index.ts +7 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/pipeline/output.ts +307 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +172 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-cov/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-cov/source-cov.ts +176 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/area-graph.ts +490 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/index.ts +23 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-model.ts +957 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +248 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/semantic-area-graph.ts +1600 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/types.ts +10 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/artifact-data.ts +201 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-api.ts +74 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-code-view.ts +180 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-format.ts +18 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-handoff.ts +55 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-splitters.ts +78 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-state.ts +66 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-tree.ts +232 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-virtual-list.ts +179 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz.ts +240 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/contracts.d.ts +86 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/index.ts +3 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/server.ts +239 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/source-project.ts +316 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz-cli.ts +200 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +290 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1323 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +574 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +831 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +548 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +396 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +298 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/skills/a2h-spec-generate/scripts/reqgen/tsconfig.json +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/tsconfig.viz-client.json +12 -0
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +632 -0
- package/skills/a2h-spec-generate/test/check-spec.test.ts +200 -0
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +538 -0
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +45 -0
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +147 -0
- package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
- package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
- package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +157 -0
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +282 -0
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +593 -0
- package/skills/a2h-utg-explorer/SKILL.md +120 -0
- package/skills/a2h-utg-explorer/assets/final_viewer.html +64 -0
- package/skills/a2h-utg-explorer/assets/u2.LICENSE +21 -0
- package/skills/a2h-utg-explorer/assets/u2.NOTICE +25 -0
- package/skills/a2h-utg-explorer/assets/u2.jar +0 -0
- package/skills/a2h-utg-explorer/references/architecture.md +270 -0
- package/skills/a2h-utg-explorer/references/protocol.md +9 -0
- package/skills/a2h-utg-explorer/scripts/app_settings.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +749 -0
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +597 -0
- package/skills/a2h-utg-explorer/scripts/device_health.mjs +227 -0
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +276 -0
- package/skills/a2h-utg-explorer/scripts/evidence.mjs +108 -0
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +258 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +170 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +467 -0
- package/skills/a2h-utg-explorer/scripts/recover_b.mjs +542 -0
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +302 -0
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +203 -0
- package/skills/a2h-utg-explorer/scripts/report.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +831 -0
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +137 -0
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +223 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +88 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
- package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +136 -0
- package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
- package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +251 -0
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +42 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +162 -0
- package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
- package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +204 -0
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +355 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
- package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +453 -0
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +131 -0
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +321 -0
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
- package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
- package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/_device_io.mjs +244 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/_py.mjs +2097 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +1213 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/attest.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/chain.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/coverage.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/device_lock.mjs +46 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1136 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +1513 -0
- package/skills/a2h-utg-explorer/scripts/variant.mjs +75 -0
- package/skills/a2h-utg-explorer/scripts/worklist_parts.mjs +122 -0
- package/skills/a2h-utg-static/SKILL.md +361 -0
- package/skills/a2h-utg-static/config.json +19 -0
- package/skills/a2h-utg-static/references/extractors.md +217 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
- package/skills/a2h-utg-static/references/view-interactions.md +215 -0
- package/skills/a2h-utg-static/scripts/_graph.mjs +361 -0
- package/skills/a2h-utg-static/scripts/_py.mjs +2177 -0
- package/skills/a2h-utg-static/scripts/_spawn.mjs +45 -0
- package/skills/a2h-utg-static/scripts/activity_nav.mjs +738 -0
- package/skills/a2h-utg-static/scripts/activity_widgets.mjs +254 -0
- package/skills/a2h-utg-static/scripts/adapter_nav.mjs +229 -0
- package/skills/a2h-utg-static/scripts/androidfragment_nav.mjs +208 -0
- package/skills/a2h-utg-static/scripts/assemble.mjs +2065 -0
- package/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/skills/a2h-utg-static/scripts/carry_answers.mjs +201 -0
- package/skills/a2h-utg-static/scripts/click_paths.mjs +594 -0
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +172 -0
- package/skills/a2h-utg-static/scripts/compose_merge.mjs +263 -0
- package/skills/a2h-utg-static/scripts/compose_nav.mjs +1216 -0
- package/skills/a2h-utg-static/scripts/compose_navbar_nav.mjs +238 -0
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +2760 -0
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +365 -0
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
- package/skills/a2h-utg-static/scripts/dialog_listener_nav.mjs +237 -0
- package/skills/a2h-utg-static/scripts/dialogshow_nav.mjs +308 -0
- package/skills/a2h-utg-static/scripts/fragfactory_nav.mjs +170 -0
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +1136 -0
- package/skills/a2h-utg-static/scripts/guard_subjects.mjs +162 -0
- package/skills/a2h-utg-static/scripts/hg_query.mjs +137 -0
- package/skills/a2h-utg-static/scripts/host_resolve.mjs +393 -0
- package/skills/a2h-utg-static/scripts/hybrid_bundle.mjs +165 -0
- package/skills/a2h-utg-static/scripts/hybrid_pages.mjs +713 -0
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -0
- package/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/skills/a2h-utg-static/scripts/io_utils.mjs +59 -0
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +864 -0
- package/skills/a2h-utg-static/scripts/launch_extras.mjs +91 -0
- package/skills/a2h-utg-static/scripts/layout_resolve.mjs +148 -0
- package/skills/a2h-utg-static/scripts/manifest.mjs +483 -0
- package/skills/a2h-utg-static/scripts/measure/measure_corpus.mjs +297 -0
- package/skills/a2h-utg-static/scripts/measure/measure_guards.mjs +98 -0
- package/skills/a2h-utg-static/scripts/media_browse_nav.mjs +356 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +603 -0
- package/skills/a2h-utg-static/scripts/navactions_nav.mjs +255 -0
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +453 -0
- package/skills/a2h-utg-static/scripts/orphan_overlay_nav.mjs +89 -0
- package/skills/a2h-utg-static/scripts/phase_plan.mjs +108 -0
- package/skills/a2h-utg-static/scripts/phase_planner.mjs +119 -0
- package/skills/a2h-utg-static/scripts/plaindialog_nav.mjs +411 -0
- package/skills/a2h-utg-static/scripts/preference_nav.mjs +761 -0
- package/skills/a2h-utg-static/scripts/preference_widgets.mjs +142 -0
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
- package/skills/a2h-utg-static/scripts/registry_nav.mjs +288 -0
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +870 -0
- package/skills/a2h-utg-static/scripts/scope_utils.mjs +430 -0
- package/skills/a2h-utg-static/scripts/screen_merge.mjs +287 -0
- package/skills/a2h-utg-static/scripts/screen_nav.mjs +279 -0
- package/skills/a2h-utg-static/scripts/single_host_nav.mjs +291 -0
- package/skills/a2h-utg-static/scripts/starter_nav.mjs +198 -0
- package/skills/a2h-utg-static/scripts/state_guard.mjs +579 -0
- package/skills/a2h-utg-static/scripts/static_prior.mjs +904 -0
- package/skills/a2h-utg-static/scripts/tests/_zipw.mjs +28 -0
- package/skills/a2h-utg-static/scripts/tests/probe_autoload.mjs +108 -0
- package/skills/a2h-utg-static/scripts/tests/probe_layout_fragments.mjs +90 -0
- package/skills/a2h-utg-static/scripts/tests/probe_unknown_scope.mjs +61 -0
- package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
- package/skills/a2h-utg-static/scripts/tests/test_activity_alias_launcher.mjs +90 -0
- package/skills/a2h-utg-static/scripts/tests/test_activity_supertype_chain.mjs +106 -0
- package/skills/a2h-utg-static/scripts/tests/test_bottom_sheet_container.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_branch_guard.mjs +19 -0
- package/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +103 -0
- package/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
- package/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
- package/skills/a2h-utg-static/scripts/tests/test_commit_scope.mjs +113 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_file_private_route.mjs +117 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_nested_graph.mjs +166 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_route_holder_collision.mjs +112 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +267 -0
- package/skills/a2h-utg-static/scripts/tests/test_custom_source_root.mjs +71 -0
- package/skills/a2h-utg-static/scripts/tests/test_defensive_null_guard.mjs +77 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialog_orphan_entries.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialog_page_owner.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_builder_forms.mjs +96 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_java_factory.mjs +37 -0
- package/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
- package/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
- package/skills/a2h-utg-static/scripts/tests/test_edge_dedupe_by_gesture.mjs +111 -0
- package/skills/a2h-utg-static/scripts/tests/test_edge_provenance_lint.mjs +70 -0
- package/skills/a2h-utg-static/scripts/tests/test_enclosing_gesture.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_external_surface_roots.mjs +43 -0
- package/skills/a2h-utg-static/scripts/tests/test_find_package_indirect.mjs +67 -0
- package/skills/a2h-utg-static/scripts/tests/test_forwarding_wrapper.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_fragment_containment.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_fragment_helper_trigger.mjs +92 -0
- package/skills/a2h-utg-static/scripts/tests/test_graph.mjs +55 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_clause.mjs +86 -0
- package/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +119 -0
- package/skills/a2h-utg-static/scripts/tests/test_host_kind_by_chain.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
- package/skills/a2h-utg-static/scripts/tests/test_interaction_sites.mjs +272 -0
- package/skills/a2h-utg-static/scripts/tests/test_item_data_instance.mjs +51 -0
- package/skills/a2h-utg-static/scripts/tests/test_kotlin_fn_spans.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
- package/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
- package/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
- package/skills/a2h-utg-static/scripts/tests/test_layout_declared_fragment.mjs +103 -0
- package/skills/a2h-utg-static/scripts/tests/test_listener_call_forms.mjs +79 -0
- package/skills/a2h-utg-static/scripts/tests/test_listener_receiver_binding.mjs +47 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_exported_default.mjs +40 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_filters_modules.mjs +84 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_srcfile.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_namespace.mjs +33 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +44 -0
- package/skills/a2h-utg-static/scripts/tests/test_multiple_entry_contracts.mjs +80 -0
- package/skills/a2h-utg-static/scripts/tests/test_nav_graph_xml.mjs +35 -0
- package/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_node_id_collision.mjs +57 -0
- package/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
- package/skills/a2h-utg-static/scripts/tests/test_out_of_scope_and_settings.mjs +72 -0
- package/skills/a2h-utg-static/scripts/tests/test_overload_and_climb.mjs +86 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_page_source.mjs +78 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_position_zero.mjs +65 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_variant_guard.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +107 -0
- package/skills/a2h-utg-static/scripts/tests/test_plain_dialog_nodes.mjs +167 -0
- package/skills/a2h-utg-static/scripts/tests/test_plaindialog_shared_anchor.mjs +117 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_click_nav.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_host_binding.mjs +87 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_nesting.mjs +183 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
- package/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
- package/skills/a2h-utg-static/scripts/tests/test_resolver_tier_parity.mjs +126 -0
- package/skills/a2h-utg-static/scripts/tests/test_result_launcher.mjs +142 -0
- package/skills/a2h-utg-static/scripts/tests/test_review_fixes.mjs +135 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +66 -0
- package/skills/a2h-utg-static/scripts/tests/test_same_name_decl_scope.mjs +236 -0
- package/skills/a2h-utg-static/scripts/tests/test_scope_utils.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_overlay_split.mjs +63 -0
- package/skills/a2h-utg-static/scripts/tests/test_slug_parity.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_starter_node_id.mjs +41 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_arity.mjs +109 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_commented_candidates.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_model_gates.mjs +127 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
- package/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
- package/skills/a2h-utg-static/scripts/tests/test_template_method_layout.mjs +81 -0
- package/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_trigger_id_spelling.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_action_override.mjs +91 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_nl_hint_key.mjs +89 -0
- package/skills/a2h-utg-static/scripts/tests/test_uiless_host_fold.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_click_refs.mjs +104 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_id_label.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_interactions.mjs +346 -0
- package/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +273 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_widget_class_scope.mjs +92 -0
- package/skills/a2h-utg-static/scripts/tests/test_window_nav_kotlin.mjs +158 -0
- package/skills/a2h-utg-static/scripts/tests/test_worklist_parts.mjs +65 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1119 -0
- package/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +721 -0
- package/skills/a2h-utg-static/scripts/view_interactions.mjs +799 -0
- package/skills/a2h-utg-static/scripts/view_widgets.mjs +512 -0
- package/skills/a2h-utg-static/scripts/viewpage_nav.mjs +485 -0
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +422 -0
- package/skills/a2h-utg-static/scripts/window_nav.mjs +240 -0
- package/skills/a2h-utg-static/scripts/worklist_parts.mjs +154 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
- package/skills/a2h-utg-static/tools/package.json +3 -0
- package/README.md +0 -427
- package/agents/logic-coder.md +0 -224
- package/agents/logic-context-builder.md +0 -212
- package/agents/scripts/hmos-precheck/backends/arkts.mjs +0 -567
- package/agents/scripts/hmos-precheck/backends/arkts_diff.mjs +0 -159
- package/agents/scripts/hmos-precheck/backends/arkts_project_rules.mjs +0 -398
- package/agents/scripts/hmos-precheck/backends/codelinter.mjs +0 -250
- package/agents/scripts/hmos-precheck/backends/project_integrity.mjs +0 -321
- package/agents/scripts/hmos-precheck/backends/static_precheck.mjs +0 -247
- package/agents/scripts/hmos-precheck/core/config.mjs +0 -184
- package/agents/scripts/hmos-precheck/core/diagnostic_scope.mjs +0 -20
- package/agents/scripts/hmos-precheck/core/process_adapter.mjs +0 -47
- package/agents/scripts/hmos-precheck/core/project_catalog.mjs +0 -50
- package/agents/scripts/hmos-precheck/core/result_projection.mjs +0 -147
- package/agents/scripts/hmos-precheck/core/scope_plan.mjs +0 -131
- package/agents/scripts/hmos-precheck/core/sdk_context.mjs +0 -67
- package/agents/scripts/hmos-precheck/docs/architecture.md +0 -37
- package/agents/scripts/hmos-precheck/docs/performance-optimization.md +0 -28
- package/agents/scripts/hmos-precheck/docs/upstream-reference.json +0 -19
- package/agents/scripts/hmos-precheck/docs/validation.md +0 -50
- package/agents/scripts/hmos-precheck/index.mjs +0 -17
- package/agents/scripts/hmos-precheck/invocation.mjs +0 -231
- package/agents/scripts/hmos-precheck/rules/rule_case_matrix.csv +0 -32
- package/agents/scripts/hmos-precheck/rules/rule_inventory.csv +0 -64
- package/agents/scripts/hmos-precheck/rules/rule_inventory.mjs +0 -59
- package/agents/scripts/hmos-precheck/rules/rule_policy.mjs +0 -54
- package/agents/scripts/platform_query.mjs +0 -626
- package/agents/scripts/platform_query.test.mjs +0 -422
- package/agents/self-test-fixer.md +0 -298
- package/agents/self-tester.md +0 -376
- package/agents/test-case-generation-generator.md +0 -317
- package/agents/test-case-generation-validator.md +0 -231
- package/dist/cli/config-store.js +0 -390
- package/dist/cli/config.js +0 -46
- package/dist/cli/env-vars.js +0 -127
- package/dist/cli/index.js +0 -56
- package/dist/cli/init.js +0 -1194
- package/dist/cli/uninstall.js +0 -427
- package/dist/utils/regex.js +0 -8
- package/env-requirements.json +0 -178
- package/resource/choose_editor.png +0 -0
- package/resource/convert_pipeline_process.svg +0 -103
- package/resource/project_architecture.svg +0 -122
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/resource/set_sdk.png +0 -0
- package/resource/title_dark.png +0 -0
- package/skills/hmos-batch-ui-align/SKILL.md +0 -413
- package/skills/hmos-batch-ui-align/scripts/arkts_static_check.ts +0 -1592
- package/skills/hmos-batch-ui-align/scripts/measure_pack.ts +0 -752
- package/skills/hmos-convert-pipeline/SKILL.md +0 -476
- package/skills/hmos-incremental-ui-align/README.md +0 -251
- package/skills/hmos-incremental-ui-align/SKILL.md +0 -375
- package/skills/hmos-incremental-ui-align/diff_analysis.md +0 -53
- package/skills/hmos-incremental-ui-align/page_align.md +0 -62
- package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +0 -38
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -648
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +0 -2089
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +0 -1033
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -1183
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +0 -576
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +0 -297
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +0 -395
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -903
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +0 -106
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -1178
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +0 -911
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +0 -355
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +0 -11
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +0 -206
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +0 -373
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +0 -158
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +0 -750
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +0 -1704
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +0 -1012
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +0 -164
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +0 -840
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -856
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +0 -83
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -294
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +0 -1220
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +0 -47
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +0 -840
- package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +0 -74
- package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +0 -34
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +0 -2533
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +0 -555
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -117
- package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +0 -937
- package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +0 -343
- package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +0 -76
- package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +0 -977
- package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +0 -188
- package/skills/hmos-integration-test/README.md +0 -300
- package/skills/hmos-integration-test/SKILL.md +0 -397
- package/skills/hmos-resources-convert/SKILL.md +0 -891
- package/skills/hmos-spec-generate/SKILL.md +0 -404
- package/skills/hmos-test-case-generation/README.md +0 -241
- package/skills/hmos-test-case-generation/SKILL.md +0 -324
- package/skills/hmos-test-case-generation/references/contract.md +0 -315
- package/skills/hmos-test-case-generation/references/review-notes-template.md +0 -84
- package/skills/hmos-test-case-generation/references/ui-elements-schema.md +0 -142
- package/skills/hmos-test-case-generation/tools/convert_to_ui_elements.ts +0 -550
- package/skills/hmos-test-case-generation/tools/validate.ts +0 -1312
- package/tools/bfs-crawl/README.md +0 -73
- package/tools/bfs-crawl/android_viewtree_bfs_crawler.ts +0 -1662
- package/tools/test-tools/autotest/config.ts +0 -175
- package/tools/test-tools/autotest/deps/autotest-agent-0.1.1.tgz +0 -0
- package/tools/test-tools/autotest/docs/README.md +0 -266
- package/tools/test-tools/autotest/docs/testcases_schema.md +0 -143
- package/tools/test-tools/autotest/engine/batch-launcher.ts +0 -327
- package/tools/test-tools/autotest/engine/report-tool.ts +0 -773
- package/tools/test-tools/autotest/engine/self-test-runner.ts +0 -961
- package/tools/test-tools/autotest/engine/testcases-tool.ts +0 -246
- package/tools/test-tools/autotest/paths.ts +0 -41
- package/tools/test-tools/autotest/resolve-metadata-tool.ts +0 -143
- package/tools/test-tools/autotest/runner/logger.ts +0 -45
- package/tools/test-tools/autotest/runner/process-utils.ts +0 -41
- package/tools/test-tools/autotest/validate.ts +0 -167
- /package/skills/{hmos-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" → a2h-arch-generate/references/arkts-mvvm-v2.md} +0 -0
- /package/{README.en.md → skills/a2h-arch-generate/scripts/module_create/har/consumer-rules.txt} +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2 → a2h-batch-ui-align/references/mvvm-v2}/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md" +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/arkts-strict-patterns.md +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/known-patterns.md +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/rdb-entity-pattern.md +0 -0
- /package/skills/{hmos-resources-convert → a2h-resource-convert}/references/dependency-analysis-rules.md +0 -0
- /package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/svg_fidelity_check.ts +0 -0
- /package/skills/{hmos-spec-generate → a2h-spec-generate}/template/REQ.txt +0 -0
- /package/skills/{hmos-spec-generate → a2h-spec-generate}/template/REQ.xlsx +0 -0
|
@@ -0,0 +1,1297 @@
|
|
|
1
|
+
import { readFile, realpath } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
import type { SourceKind, SourceLocation } from "../contracts/common.ts";
|
|
5
|
+
import type { RawConfidence } from "../contracts/raw-fact.ts";
|
|
6
|
+
import type {
|
|
7
|
+
ActionIdentityAnchor,
|
|
8
|
+
AgentCandidateDecision,
|
|
9
|
+
AgentCitation,
|
|
10
|
+
ControlIdentityAnchor,
|
|
11
|
+
FinalizedActionPatch,
|
|
12
|
+
FinalizedControlPatch,
|
|
13
|
+
FinalizedInteractionAnalysis,
|
|
14
|
+
InteractionAreaExpected,
|
|
15
|
+
InteractionAreaOutput,
|
|
16
|
+
InteractionAreaSeed,
|
|
17
|
+
InteractionCandidate,
|
|
18
|
+
InteractionDraft,
|
|
19
|
+
InteractionFinalizeDiagnostic,
|
|
20
|
+
InteractionFramework,
|
|
21
|
+
InteractionShardExpected,
|
|
22
|
+
InteractionShardManifest,
|
|
23
|
+
InteractionShardOutput,
|
|
24
|
+
InteractionUnresolved
|
|
25
|
+
} from "./contracts.ts";
|
|
26
|
+
import { INTERACTION_ANALYSIS_CONTRACT_VERSION } from "./contracts.ts";
|
|
27
|
+
import {
|
|
28
|
+
assertScopeExclusionReason,
|
|
29
|
+
type ReqGenerationScope
|
|
30
|
+
} from "../requirement-scope.ts";
|
|
31
|
+
import {
|
|
32
|
+
canonicalActionAnchor,
|
|
33
|
+
canonicalControlAnchor,
|
|
34
|
+
createFinalActionId,
|
|
35
|
+
createFinalControlId
|
|
36
|
+
} from "./identity.ts";
|
|
37
|
+
import {
|
|
38
|
+
findCrossAreaAnchorCollisions,
|
|
39
|
+
partitionCrossAreaDuplicateControls,
|
|
40
|
+
suggestedCrossAreaAnchorOwner
|
|
41
|
+
} from "./cross-area.ts";
|
|
42
|
+
import {
|
|
43
|
+
parseInteractionAreaOutput,
|
|
44
|
+
parseInteractionShardOutput
|
|
45
|
+
} from "./schema.ts";
|
|
46
|
+
import { createAgentDiscoveryCandidateKey } from "./stable-key.ts";
|
|
47
|
+
|
|
48
|
+
export type InteractionShardOutputs =
|
|
49
|
+
| ReadonlyMap<string, unknown>
|
|
50
|
+
| Readonly<Record<string, unknown>>;
|
|
51
|
+
|
|
52
|
+
export interface FinalizeInteractionShardsInput {
|
|
53
|
+
readonly manifest: InteractionShardManifest;
|
|
54
|
+
readonly areas: readonly InteractionAreaSeed[];
|
|
55
|
+
readonly candidates: readonly InteractionCandidate[];
|
|
56
|
+
readonly outputs: InteractionShardOutputs;
|
|
57
|
+
readonly projectRoot: string;
|
|
58
|
+
readonly sourceFiles: readonly InteractionSourceFileFingerprint[];
|
|
59
|
+
readonly readFile?: (path: string) => Promise<string>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface InteractionSourceFileFingerprint {
|
|
63
|
+
readonly path: string;
|
|
64
|
+
readonly sha256: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function compareText(left: string, right: string): number {
|
|
68
|
+
return left.localeCompare(right, "en");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function sortedUnique(values: readonly string[]): string[] {
|
|
72
|
+
return [...new Set(values)].sort(compareText);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function outputFor(outputs: InteractionShardOutputs, taskId: string): unknown {
|
|
76
|
+
const possibleMap = outputs as ReadonlyMap<string, unknown>;
|
|
77
|
+
return typeof possibleMap.get === "function"
|
|
78
|
+
? possibleMap.get(taskId)
|
|
79
|
+
: (outputs as Readonly<Record<string, unknown>>)[taskId];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function sourceKind(file: string): SourceKind {
|
|
83
|
+
if (file.endsWith(".kt")) return "kotlin";
|
|
84
|
+
if (file.endsWith(".java")) return "java";
|
|
85
|
+
if (file.endsWith(".xml")) return "xml";
|
|
86
|
+
return "other";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function locationKey(location: SourceLocation): string {
|
|
90
|
+
return JSON.stringify([
|
|
91
|
+
location.path.replaceAll("\\", "/"),
|
|
92
|
+
location.range.startLine,
|
|
93
|
+
location.range.endLine,
|
|
94
|
+
location.range.startColumn ?? 0,
|
|
95
|
+
location.range.endColumn ?? 0,
|
|
96
|
+
location.anchor,
|
|
97
|
+
location.symbol ?? ""
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function nonEmptyLocations(
|
|
102
|
+
locations: readonly SourceLocation[]
|
|
103
|
+
): [SourceLocation, ...SourceLocation[]] {
|
|
104
|
+
const byKey = new Map(locations.map((location) => [locationKey(location), location]));
|
|
105
|
+
const values = [...byKey.values()].sort((left, right) =>
|
|
106
|
+
compareText(locationKey(left), locationKey(right))
|
|
107
|
+
);
|
|
108
|
+
if (values.length === 0) throw new Error("Finalized interaction has no evidence");
|
|
109
|
+
return values as [SourceLocation, ...SourceLocation[]];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Per-finalize citation I/O cache. Hoists the root `realpath` and memoizes each
|
|
113
|
+
* file's resolved real path and (newline-normalized) contents, so a finalize
|
|
114
|
+
* that verifies many render blocks reads each source file at most once instead
|
|
115
|
+
* of once per citation. Determinism is unchanged: every cached value is exactly
|
|
116
|
+
* what `realpath`/`read` returned, and all path/census/range checks still run per
|
|
117
|
+
* citation. */
|
|
118
|
+
export interface CitationIoCache {
|
|
119
|
+
readonly rootRealPath: Map<string, string>;
|
|
120
|
+
readonly targetRealPath: Map<string, string>;
|
|
121
|
+
readonly contents: Map<string, string>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function createCitationIoCache(): CitationIoCache {
|
|
125
|
+
return {
|
|
126
|
+
rootRealPath: new Map(),
|
|
127
|
+
targetRealPath: new Map(),
|
|
128
|
+
contents: new Map()
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Verify Agent citation anchors against the frozen Model source census and
|
|
133
|
+
* resolve them to {@link SourceLocation}s. Throws when a citation is
|
|
134
|
+
* project-escaping, outside the census, out of range, or unreadable. Shared by
|
|
135
|
+
* the legacy interaction finalize AND the fused L2 sidecar build so both apply
|
|
136
|
+
* the exact same evidence check (single source of truth). Pass one
|
|
137
|
+
* {@link CitationIoCache} across a batch to read each file at most once. */
|
|
138
|
+
export async function citationLocations(
|
|
139
|
+
citations: readonly AgentCitation[],
|
|
140
|
+
projectRoot: string,
|
|
141
|
+
sourceFiles: ReadonlySet<string>,
|
|
142
|
+
read: (path: string) => Promise<string>,
|
|
143
|
+
resolveRealPaths: boolean,
|
|
144
|
+
anchorPrefix: string,
|
|
145
|
+
cache: CitationIoCache = createCitationIoCache()
|
|
146
|
+
): Promise<SourceLocation[]> {
|
|
147
|
+
const root = path.resolve(projectRoot);
|
|
148
|
+
let realRoot = root;
|
|
149
|
+
if (resolveRealPaths) {
|
|
150
|
+
const cachedRoot = cache.rootRealPath.get(root);
|
|
151
|
+
realRoot = cachedRoot ?? await realpath(root);
|
|
152
|
+
if (cachedRoot === undefined) cache.rootRealPath.set(root, realRoot);
|
|
153
|
+
}
|
|
154
|
+
const result: SourceLocation[] = [];
|
|
155
|
+
for (const [index, citation] of citations.entries()) {
|
|
156
|
+
const citationPath = citation.file.replaceAll("\\", "/");
|
|
157
|
+
if (path.isAbsolute(citationPath)) {
|
|
158
|
+
throw new Error(`Citation path must be project-relative: ${citation.file}`);
|
|
159
|
+
}
|
|
160
|
+
const absolute = path.resolve(root, ...citationPath.split("/"));
|
|
161
|
+
const relativePath = path.relative(root, absolute).replaceAll("\\", "/");
|
|
162
|
+
if (
|
|
163
|
+
relativePath === ".." || relativePath.startsWith("../") ||
|
|
164
|
+
path.isAbsolute(relativePath)
|
|
165
|
+
) throw new Error(`Citation is outside project root: ${citation.file}`);
|
|
166
|
+
if (!sourceFiles.has(relativePath)) {
|
|
167
|
+
throw new Error(`Citation is outside the frozen Model source census: ${citation.file}`);
|
|
168
|
+
}
|
|
169
|
+
let target = absolute;
|
|
170
|
+
if (resolveRealPaths) {
|
|
171
|
+
const cachedTarget = cache.targetRealPath.get(absolute);
|
|
172
|
+
target = cachedTarget ?? await realpath(absolute);
|
|
173
|
+
if (cachedTarget === undefined) cache.targetRealPath.set(absolute, target);
|
|
174
|
+
}
|
|
175
|
+
const realRelative = path.relative(realRoot, target).replaceAll("\\", "/");
|
|
176
|
+
if (
|
|
177
|
+
realRelative === ".." || realRelative.startsWith("../") ||
|
|
178
|
+
path.isAbsolute(realRelative)
|
|
179
|
+
) throw new Error(`Citation resolves outside project root: ${citation.file}`);
|
|
180
|
+
const cachedContent = cache.contents.get(target);
|
|
181
|
+
const content = cachedContent ?? (await read(target)).replace(/\r\n?/gu, "\n");
|
|
182
|
+
if (cachedContent === undefined) cache.contents.set(target, content);
|
|
183
|
+
const lines = content.split("\n");
|
|
184
|
+
if (citation.endLine > lines.length) {
|
|
185
|
+
throw new Error(
|
|
186
|
+
`Citation range exceeds file length: ${citation.file}:${citation.endLine}`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
result.push({
|
|
190
|
+
sourceKind: sourceKind(relativePath),
|
|
191
|
+
path: relativePath,
|
|
192
|
+
anchor: `${anchorPrefix}:${index + 1}`,
|
|
193
|
+
range: { startLine: citation.startLine, endLine: citation.endLine }
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function sameSet(left: readonly string[], right: readonly string[]): boolean {
|
|
200
|
+
const a = sortedUnique(left);
|
|
201
|
+
const b = sortedUnique(right);
|
|
202
|
+
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function duplicate(values: readonly string[]): string | undefined {
|
|
206
|
+
const seen = new Set<string>();
|
|
207
|
+
for (const value of values) {
|
|
208
|
+
if (seen.has(value)) return value;
|
|
209
|
+
seen.add(value);
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function validateDraftScope(
|
|
215
|
+
draft: InteractionDraft,
|
|
216
|
+
expectedAreaRef: string,
|
|
217
|
+
knownAreas: ReadonlySet<string>
|
|
218
|
+
): string | undefined {
|
|
219
|
+
if (draft.areaRef !== expectedAreaRef) {
|
|
220
|
+
return `interaction must resolve to Area ${expectedAreaRef}`;
|
|
221
|
+
}
|
|
222
|
+
if (!draft.areaCandidates.includes(expectedAreaRef)) {
|
|
223
|
+
return "resolved Area is missing from areaCandidates";
|
|
224
|
+
}
|
|
225
|
+
if (draft.areaCandidates.some((areaRef) => !knownAreas.has(areaRef))) {
|
|
226
|
+
return "interaction contains an unknown Area candidate";
|
|
227
|
+
}
|
|
228
|
+
if (duplicate(draft.action.conditions.map((item) => item.semanticKey))) {
|
|
229
|
+
return "interaction contains duplicate condition source keys";
|
|
230
|
+
}
|
|
231
|
+
if (duplicate(draft.action.effects.map((item) => item.semanticKey))) {
|
|
232
|
+
return "interaction contains duplicate effect source keys";
|
|
233
|
+
}
|
|
234
|
+
const conditionKeys = new Set(
|
|
235
|
+
draft.action.conditions.map((condition) => condition.semanticKey)
|
|
236
|
+
);
|
|
237
|
+
for (const effect of draft.action.effects) {
|
|
238
|
+
const missing = effect.conditionKeys.find((key) => !conditionKeys.has(key));
|
|
239
|
+
if (missing) return `effect references missing condition ${missing}`;
|
|
240
|
+
if (effect.target?.kind === "area" && !knownAreas.has(effect.target.areaRef)) {
|
|
241
|
+
return `interaction effect references unknown UTG Area ${effect.target.areaRef}`;
|
|
242
|
+
}
|
|
243
|
+
if (effect.utgEdgeRef && !(
|
|
244
|
+
effect.kind === "navigate-area" || effect.kind === "show-surface"
|
|
245
|
+
)) return "non-navigation effect carries a UTG edge reference";
|
|
246
|
+
if (effect.closePolicy && effect.kind !== "close-surface") {
|
|
247
|
+
return "non-close effect carries a close policy";
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// Unknown trigger/effect details are allowed here. The Area task resolves
|
|
251
|
+
// the known Action trigger; remaining unknown fields stay explicitly unknown.
|
|
252
|
+
return undefined;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function validateReviewedInteraction(
|
|
256
|
+
draft: InteractionDraft,
|
|
257
|
+
disposition: "accept" | "correct"
|
|
258
|
+
): string | undefined {
|
|
259
|
+
if (draft.action.effects.length === 0) {
|
|
260
|
+
return "an included interaction must have at least one source-backed Effect; " +
|
|
261
|
+
"exclude a callback with no observable result";
|
|
262
|
+
}
|
|
263
|
+
if (
|
|
264
|
+
disposition === "accept" &&
|
|
265
|
+
draft.action.effects.some((effect) => effect.kind === "unknown")
|
|
266
|
+
) {
|
|
267
|
+
return "accept cannot retain an unknown Effect; audit the callback and use correct " +
|
|
268
|
+
"with citations, retaining unknown only when the source truly cannot resolve it";
|
|
269
|
+
}
|
|
270
|
+
return undefined;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export interface ValidateInteractionShardOutputInput {
|
|
274
|
+
readonly value: unknown;
|
|
275
|
+
readonly expected: InteractionShardExpected;
|
|
276
|
+
readonly areas: readonly InteractionAreaSeed[];
|
|
277
|
+
readonly candidates: readonly InteractionCandidate[];
|
|
278
|
+
readonly projectRoot: string;
|
|
279
|
+
readonly sourceFiles: readonly InteractionSourceFileFingerprint[];
|
|
280
|
+
readonly readFile?: (path: string) => Promise<string>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface ValidatedInteractionShardOutput {
|
|
284
|
+
readonly expected: InteractionShardExpected;
|
|
285
|
+
readonly output: InteractionShardOutput;
|
|
286
|
+
readonly decisionEvidence: ReadonlyMap<string, readonly SourceLocation[]>;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** The shared gate used by check-task, prepare resume, and finalization. */
|
|
290
|
+
export async function validateInteractionShardOutput(
|
|
291
|
+
input: ValidateInteractionShardOutputInput
|
|
292
|
+
): Promise<ValidatedInteractionShardOutput> {
|
|
293
|
+
const parsed = parseInteractionShardOutput(input.value);
|
|
294
|
+
if (!parsed.success) {
|
|
295
|
+
throw new Error(`Invalid review output: ${parsed.issues.join("; ")}`);
|
|
296
|
+
}
|
|
297
|
+
const output = parsed.data;
|
|
298
|
+
if (
|
|
299
|
+
output.taskId !== input.expected.taskId ||
|
|
300
|
+
output.inputFingerprint !== input.expected.inputFingerprint
|
|
301
|
+
) throw new Error("Review output task or input fingerprint does not match expected.json");
|
|
302
|
+
const decisionKeys = output.decisions.map((item) => item.candidateKey);
|
|
303
|
+
if (duplicate(decisionKeys)) throw new Error("Review output has duplicate decisions");
|
|
304
|
+
if (!sameSet(decisionKeys, input.expected.candidateKeys)) {
|
|
305
|
+
throw new Error("Review output candidate census does not match expected.json");
|
|
306
|
+
}
|
|
307
|
+
if (
|
|
308
|
+
input.expected.areaRefs.length !== 1 ||
|
|
309
|
+
input.expected.areaRefs[0] !== input.expected.areaRef
|
|
310
|
+
) throw new Error("Review expected.json is not scoped to exactly one Area");
|
|
311
|
+
const candidateByKey = new Map(input.candidates.map((item) =>
|
|
312
|
+
[item.candidateKey, item]
|
|
313
|
+
));
|
|
314
|
+
const knownAreas = new Set(input.areas.map((item) => item.areaRef));
|
|
315
|
+
const sourceFiles = new Set(input.sourceFiles.map((item) =>
|
|
316
|
+
item.path.replaceAll("\\", "/")
|
|
317
|
+
));
|
|
318
|
+
const read = input.readFile ?? ((target: string) => readFile(target, "utf8"));
|
|
319
|
+
const resolveRealPaths = input.readFile === undefined;
|
|
320
|
+
const decisionEvidence = new Map<string, readonly SourceLocation[]>();
|
|
321
|
+
for (const decision of output.decisions) {
|
|
322
|
+
const candidate = candidateByKey.get(decision.candidateKey);
|
|
323
|
+
if (!candidate) throw new Error(`Missing frozen candidate ${decision.candidateKey}`);
|
|
324
|
+
if (decision.disposition === "correct") {
|
|
325
|
+
const corrected = decision.correctedInteraction as InteractionDraft;
|
|
326
|
+
const problem = validateDraftScope(corrected, input.expected.areaRef, knownAreas);
|
|
327
|
+
if (problem) throw new Error(`${decision.candidateKey}: ${problem}`);
|
|
328
|
+
const reviewProblem = validateReviewedInteraction(corrected, "correct");
|
|
329
|
+
if (reviewProblem) throw new Error(`${decision.candidateKey}: ${reviewProblem}`);
|
|
330
|
+
const locations = await citationLocations(
|
|
331
|
+
decision.citations ?? [],
|
|
332
|
+
input.projectRoot,
|
|
333
|
+
sourceFiles,
|
|
334
|
+
read,
|
|
335
|
+
resolveRealPaths,
|
|
336
|
+
`review:${input.expected.taskId}:${decision.candidateKey}`
|
|
337
|
+
);
|
|
338
|
+
decisionEvidence.set(decision.candidateKey, nonEmptyLocations(locations));
|
|
339
|
+
} else if (decision.disposition === "accept") {
|
|
340
|
+
const problem = validateDraftScope(
|
|
341
|
+
candidate.interaction,
|
|
342
|
+
input.expected.areaRef,
|
|
343
|
+
knownAreas
|
|
344
|
+
);
|
|
345
|
+
if (problem) {
|
|
346
|
+
throw new Error(
|
|
347
|
+
`${decision.candidateKey}: accept cannot retain invalid scanner data: ${problem}`
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
const reviewProblem = validateReviewedInteraction(candidate.interaction, "accept");
|
|
351
|
+
if (reviewProblem) throw new Error(`${decision.candidateKey}: ${reviewProblem}`);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return { expected: input.expected, output, decisionEvidence };
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface ValidateInteractionAreaOutputInput {
|
|
358
|
+
readonly value: unknown;
|
|
359
|
+
readonly expected: InteractionAreaExpected;
|
|
360
|
+
readonly reviews: readonly ValidatedInteractionShardOutput[];
|
|
361
|
+
readonly areas: readonly InteractionAreaSeed[];
|
|
362
|
+
readonly candidates: readonly InteractionCandidate[];
|
|
363
|
+
readonly projectRoot: string;
|
|
364
|
+
readonly sourceFiles: readonly InteractionSourceFileFingerprint[];
|
|
365
|
+
readonly readFile?: (path: string) => Promise<string>;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface ValidatedInteractionAreaOutput {
|
|
369
|
+
readonly expected: InteractionAreaExpected;
|
|
370
|
+
readonly output: InteractionAreaOutput;
|
|
371
|
+
readonly restorationEvidence: ReadonlyMap<string, readonly SourceLocation[]>;
|
|
372
|
+
readonly overrideEvidence: ReadonlyMap<string, readonly SourceLocation[]>;
|
|
373
|
+
readonly discoveryEvidence: ReadonlyMap<string, readonly SourceLocation[]>;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* The reconciliation-only fields the shared structural gate reads. Both the
|
|
378
|
+
* legacy `InteractionAreaOutput` and the fused draft satisfy this shape, so the
|
|
379
|
+
* per-Area L1 self-check can reuse the exact same conservation logic without
|
|
380
|
+
* forking it. `contractVersion` and render-only fields are deliberately absent,
|
|
381
|
+
* and the array members are the loose structural minimums the gate reads (the
|
|
382
|
+
* fused draft is zod-inferred, so its `citations` are `T[]`, not the hand
|
|
383
|
+
* written non-empty tuple).
|
|
384
|
+
*/
|
|
385
|
+
export interface AreaReconciliationOutput {
|
|
386
|
+
readonly taskId: string;
|
|
387
|
+
readonly inputFingerprint: string;
|
|
388
|
+
readonly restorations: readonly { readonly candidateKey: string }[];
|
|
389
|
+
readonly overrides: readonly {
|
|
390
|
+
readonly candidateKey: string;
|
|
391
|
+
readonly disposition: "correct" | "exclude";
|
|
392
|
+
}[];
|
|
393
|
+
readonly discoveries: readonly { readonly discoveryKey: string }[];
|
|
394
|
+
readonly controlGroups: readonly {
|
|
395
|
+
readonly controlGroupKey: string;
|
|
396
|
+
readonly identityAnchor: ControlIdentityAnchor;
|
|
397
|
+
readonly candidateKeys: readonly string[];
|
|
398
|
+
readonly discoveryKeys: readonly string[];
|
|
399
|
+
readonly scopeDecision?: {
|
|
400
|
+
readonly decision: "include";
|
|
401
|
+
readonly rationale: string;
|
|
402
|
+
};
|
|
403
|
+
readonly actions: readonly {
|
|
404
|
+
readonly actionGroupKey: string;
|
|
405
|
+
readonly trigger: string;
|
|
406
|
+
readonly identityAnchor: ActionIdentityAnchor;
|
|
407
|
+
readonly candidateKeys: readonly string[];
|
|
408
|
+
readonly discoveryKeys: readonly string[];
|
|
409
|
+
}[];
|
|
410
|
+
}[];
|
|
411
|
+
readonly scopeExclusions?: readonly {
|
|
412
|
+
readonly candidateKeys: readonly string[];
|
|
413
|
+
readonly reasonCode: string;
|
|
414
|
+
readonly rationale: string;
|
|
415
|
+
}[];
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/** The run/task facts the structural gate compares an output against. */
|
|
419
|
+
export interface AreaReconciliationExpectation {
|
|
420
|
+
readonly taskId: string;
|
|
421
|
+
readonly inputFingerprint: string;
|
|
422
|
+
readonly candidateKeys: readonly string[];
|
|
423
|
+
readonly reviewTaskIds: readonly string[];
|
|
424
|
+
readonly requirementScope?: ReqGenerationScope;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Minimal review surface: the structural gate needs each review's task identity
|
|
429
|
+
* and candidate census, not its evidence. `ValidatedInteractionShardOutput` is
|
|
430
|
+
* assignable to it, so the full validator keeps passing its richer reviews.
|
|
431
|
+
*/
|
|
432
|
+
export interface AreaReviewDecisionSource {
|
|
433
|
+
readonly expected: {
|
|
434
|
+
readonly taskId: string;
|
|
435
|
+
readonly candidateKeys: readonly string[];
|
|
436
|
+
};
|
|
437
|
+
readonly output: {
|
|
438
|
+
readonly decisions: readonly AgentCandidateDecision[];
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export interface AreaReconciliationStructureInput {
|
|
443
|
+
readonly output: AreaReconciliationOutput;
|
|
444
|
+
readonly expected: AreaReconciliationExpectation;
|
|
445
|
+
readonly reviews: readonly AreaReviewDecisionSource[];
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Shared synchronous conservation/anchor gate. Extracted verbatim from
|
|
450
|
+
* `validateInteractionAreaOutput` so the fused L1 self-check runs exactly the
|
|
451
|
+
* same per-Area rules (candidate/discovery conservation, anchor uniqueness,
|
|
452
|
+
* restoration/override/scope-exclusion integrity) without the citation reads or
|
|
453
|
+
* the cross-Area steps, which stay in the full validator and L2 respectively.
|
|
454
|
+
*/
|
|
455
|
+
export function assertAreaReconciliationStructure(
|
|
456
|
+
input: AreaReconciliationStructureInput
|
|
457
|
+
): void {
|
|
458
|
+
const output = input.output;
|
|
459
|
+
const expected = input.expected;
|
|
460
|
+
const reviews = input.reviews;
|
|
461
|
+
if (
|
|
462
|
+
output.taskId !== expected.taskId ||
|
|
463
|
+
output.inputFingerprint !== expected.inputFingerprint
|
|
464
|
+
) throw new Error("Area output task or input fingerprint does not match expected.json");
|
|
465
|
+
if (!sameSet(reviews.map((item) => item.expected.taskId), expected.reviewTaskIds)) {
|
|
466
|
+
throw new Error("Area task review dependencies are incomplete");
|
|
467
|
+
}
|
|
468
|
+
const decisions = reviews.flatMap((review) => review.output.decisions);
|
|
469
|
+
const decisionByKey = new Map(decisions.map((decision) =>
|
|
470
|
+
[decision.candidateKey, decision]
|
|
471
|
+
));
|
|
472
|
+
if (decisionByKey.size !== decisions.length ||
|
|
473
|
+
!sameSet([...decisionByKey.keys()], expected.candidateKeys)) {
|
|
474
|
+
throw new Error("Area task does not receive exactly one review decision per candidate");
|
|
475
|
+
}
|
|
476
|
+
const restorationKeys = output.restorations.map((item) => item.candidateKey);
|
|
477
|
+
if (duplicate(restorationKeys)) throw new Error("Area output has duplicate restorations");
|
|
478
|
+
for (const candidateKey of restorationKeys) {
|
|
479
|
+
if (decisionByKey.get(candidateKey)?.disposition !== "exclude") {
|
|
480
|
+
throw new Error(`Restoration ${candidateKey} is not an excluded review candidate`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
const overrideKeys = output.overrides.map((item) => item.candidateKey);
|
|
484
|
+
if (duplicate(overrideKeys)) throw new Error("Area output has duplicate candidate overrides");
|
|
485
|
+
for (const candidateKey of overrideKeys) {
|
|
486
|
+
const decision = decisionByKey.get(candidateKey);
|
|
487
|
+
if (!decision) throw new Error(`Override ${candidateKey} is not a review candidate`);
|
|
488
|
+
if (decision.disposition === "exclude") {
|
|
489
|
+
throw new Error(
|
|
490
|
+
`Override ${candidateKey} targets an excluded review candidate; use restoration instead`
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
if (restorationKeys.includes(candidateKey)) {
|
|
494
|
+
throw new Error(`Candidate ${candidateKey} cannot be both restored and overridden`);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
const overrideByKey = new Map(output.overrides.map((item) => [item.candidateKey, item]));
|
|
498
|
+
const scopeExcluded = new Set<string>();
|
|
499
|
+
for (const exclusion of output.scopeExclusions ?? []) {
|
|
500
|
+
assertScopeExclusionReason(expected.requirementScope, exclusion.reasonCode);
|
|
501
|
+
for (const candidateKey of exclusion.candidateKeys) {
|
|
502
|
+
if (scopeExcluded.has(candidateKey)) throw new Error(`Duplicate scope exclusion: ${candidateKey}`);
|
|
503
|
+
const decision = decisionByKey.get(candidateKey);
|
|
504
|
+
if (!decision || (decision.disposition === "exclude" && !restorationKeys.includes(candidateKey)) ||
|
|
505
|
+
overrideByKey.get(candidateKey)?.disposition === "exclude") {
|
|
506
|
+
throw new Error(`Scope exclusion must reference an existing included candidate: ${candidateKey}`);
|
|
507
|
+
}
|
|
508
|
+
scopeExcluded.add(candidateKey);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const includedCandidates = decisions.flatMap((decision) =>
|
|
512
|
+
(decision.disposition === "exclude" && !restorationKeys.includes(decision.candidateKey)) ||
|
|
513
|
+
overrideByKey.get(decision.candidateKey)?.disposition === "exclude" ||
|
|
514
|
+
scopeExcluded.has(decision.candidateKey)
|
|
515
|
+
? []
|
|
516
|
+
: [decision.candidateKey]
|
|
517
|
+
);
|
|
518
|
+
const discoveryKeys = output.discoveries.map((item) => item.discoveryKey);
|
|
519
|
+
if (duplicate(discoveryKeys)) throw new Error("Area output has duplicate discovery keys");
|
|
520
|
+
const controlKeys = output.controlGroups.map((group) => group.controlGroupKey);
|
|
521
|
+
if (duplicate(controlKeys)) throw new Error("Area output has duplicate Control group keys");
|
|
522
|
+
const controlAnchors = output.controlGroups.map((group) =>
|
|
523
|
+
canonicalControlAnchor(group.identityAnchor)
|
|
524
|
+
);
|
|
525
|
+
if (duplicate(controlAnchors)) {
|
|
526
|
+
throw new Error("Area output has duplicate canonical Control anchors");
|
|
527
|
+
}
|
|
528
|
+
const groupedCandidates: string[] = [];
|
|
529
|
+
const groupedDiscoveries: string[] = [];
|
|
530
|
+
for (const group of output.controlGroups) {
|
|
531
|
+
if (expected.requirementScope && !group.scopeDecision) {
|
|
532
|
+
throw new Error(`Control group ${group.controlGroupKey} must explain scope inclusion`);
|
|
533
|
+
}
|
|
534
|
+
if (duplicate(group.candidateKeys) || duplicate(group.discoveryKeys)) {
|
|
535
|
+
throw new Error(`Control group ${group.controlGroupKey} has duplicate members`);
|
|
536
|
+
}
|
|
537
|
+
const actionKeys = group.actions.map((action) => action.actionGroupKey);
|
|
538
|
+
if (duplicate(actionKeys)) {
|
|
539
|
+
throw new Error(`Control group ${group.controlGroupKey} has duplicate Action group keys`);
|
|
540
|
+
}
|
|
541
|
+
const actionAnchors = group.actions.map((action) => JSON.stringify([
|
|
542
|
+
action.trigger,
|
|
543
|
+
canonicalActionAnchor(action.identityAnchor)
|
|
544
|
+
]));
|
|
545
|
+
if (duplicate(actionAnchors)) {
|
|
546
|
+
throw new Error(`Control group ${group.controlGroupKey} has duplicate Action anchors`);
|
|
547
|
+
}
|
|
548
|
+
const actionCandidates = group.actions.flatMap((action) => action.candidateKeys);
|
|
549
|
+
const actionDiscoveries = group.actions.flatMap((action) => action.discoveryKeys);
|
|
550
|
+
if (duplicate(actionCandidates) || !sameSet(actionCandidates, group.candidateKeys)) {
|
|
551
|
+
throw new Error(
|
|
552
|
+
`Control group ${group.controlGroupKey} must assign each candidate to one Action`
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
if (duplicate(actionDiscoveries) || !sameSet(actionDiscoveries, group.discoveryKeys)) {
|
|
556
|
+
throw new Error(
|
|
557
|
+
`Control group ${group.controlGroupKey} must assign each discovery to one Action`
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
// A Control/Action exists only to hold members. A source-found interaction
|
|
561
|
+
// belongs in `discoveries` (and then becomes a group member); an Area with
|
|
562
|
+
// no interaction must carry `controlGroups: []`. Conservation is vacuously
|
|
563
|
+
// true for a memberless Action, so it must be rejected explicitly here —
|
|
564
|
+
// L2 `finalize` would otherwise dereference an empty `ordered[0]`.
|
|
565
|
+
if (group.candidateKeys.length === 0 && group.discoveryKeys.length === 0) {
|
|
566
|
+
throw new Error(
|
|
567
|
+
`Control group ${group.controlGroupKey} has no candidate or discovery members`
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
for (const action of group.actions) {
|
|
571
|
+
if (action.candidateKeys.length === 0 && action.discoveryKeys.length === 0) {
|
|
572
|
+
throw new Error(
|
|
573
|
+
`Action group ${action.actionGroupKey} of Control group ` +
|
|
574
|
+
`${group.controlGroupKey} has no candidate or discovery members`
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
groupedCandidates.push(...group.candidateKeys);
|
|
579
|
+
groupedDiscoveries.push(...group.discoveryKeys);
|
|
580
|
+
}
|
|
581
|
+
if (duplicate(groupedCandidates) || !sameSet(groupedCandidates, includedCandidates)) {
|
|
582
|
+
throw new Error("Area output must place every included candidate in exactly one Control");
|
|
583
|
+
}
|
|
584
|
+
if (duplicate(groupedDiscoveries) || !sameSet(groupedDiscoveries, discoveryKeys)) {
|
|
585
|
+
throw new Error("Area output must place every discovery in exactly one Control");
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export async function validateInteractionAreaOutput(
|
|
590
|
+
input: ValidateInteractionAreaOutputInput
|
|
591
|
+
): Promise<ValidatedInteractionAreaOutput> {
|
|
592
|
+
const parsed = parseInteractionAreaOutput(input.value);
|
|
593
|
+
if (!parsed.success) {
|
|
594
|
+
throw new Error(`Invalid Area output: ${parsed.issues.join("; ")}`);
|
|
595
|
+
}
|
|
596
|
+
const output = parsed.data;
|
|
597
|
+
assertAreaReconciliationStructure({
|
|
598
|
+
output,
|
|
599
|
+
expected: input.expected,
|
|
600
|
+
reviews: input.reviews
|
|
601
|
+
});
|
|
602
|
+
const knownAreas = new Set(input.areas.map((item) => item.areaRef));
|
|
603
|
+
const sourceFiles = new Set(input.sourceFiles.map((item) =>
|
|
604
|
+
item.path.replaceAll("\\", "/")
|
|
605
|
+
));
|
|
606
|
+
const read = input.readFile ?? ((target: string) => readFile(target, "utf8"));
|
|
607
|
+
const resolveRealPaths = input.readFile === undefined;
|
|
608
|
+
const restorationEvidence = new Map<string, readonly SourceLocation[]>();
|
|
609
|
+
for (const restoration of output.restorations) {
|
|
610
|
+
const locations = await citationLocations(
|
|
611
|
+
restoration.citations,
|
|
612
|
+
input.projectRoot,
|
|
613
|
+
sourceFiles,
|
|
614
|
+
read,
|
|
615
|
+
resolveRealPaths,
|
|
616
|
+
`restore:${input.expected.taskId}:${restoration.candidateKey}`
|
|
617
|
+
);
|
|
618
|
+
restorationEvidence.set(restoration.candidateKey, nonEmptyLocations(locations));
|
|
619
|
+
}
|
|
620
|
+
const overrideEvidence = new Map<string, readonly SourceLocation[]>();
|
|
621
|
+
for (const override of output.overrides) {
|
|
622
|
+
if (override.disposition === "correct") {
|
|
623
|
+
const corrected = override.correctedInteraction as InteractionDraft;
|
|
624
|
+
const problem = validateDraftScope(corrected, input.expected.areaRef, knownAreas);
|
|
625
|
+
if (problem) throw new Error(`Override ${override.candidateKey}: ${problem}`);
|
|
626
|
+
const reviewProblem = validateReviewedInteraction(corrected, "correct");
|
|
627
|
+
if (reviewProblem) {
|
|
628
|
+
throw new Error(`Override ${override.candidateKey}: ${reviewProblem}`);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
const locations = await citationLocations(
|
|
632
|
+
override.citations,
|
|
633
|
+
input.projectRoot,
|
|
634
|
+
sourceFiles,
|
|
635
|
+
read,
|
|
636
|
+
resolveRealPaths,
|
|
637
|
+
`override:${input.expected.taskId}:${override.candidateKey}`
|
|
638
|
+
);
|
|
639
|
+
overrideEvidence.set(override.candidateKey, nonEmptyLocations(locations));
|
|
640
|
+
}
|
|
641
|
+
const discoveryEvidence = new Map<string, readonly SourceLocation[]>();
|
|
642
|
+
for (const discovery of output.discoveries) {
|
|
643
|
+
const problem = validateDraftScope(
|
|
644
|
+
discovery.interaction,
|
|
645
|
+
input.expected.areaRef,
|
|
646
|
+
knownAreas
|
|
647
|
+
);
|
|
648
|
+
if (problem) throw new Error(`Discovery ${discovery.discoveryKey}: ${problem}`);
|
|
649
|
+
const locations = await citationLocations(
|
|
650
|
+
discovery.citations,
|
|
651
|
+
input.projectRoot,
|
|
652
|
+
sourceFiles,
|
|
653
|
+
read,
|
|
654
|
+
resolveRealPaths,
|
|
655
|
+
`discovery:${input.expected.taskId}:${discovery.discoveryKey}`
|
|
656
|
+
);
|
|
657
|
+
discoveryEvidence.set(discovery.discoveryKey, nonEmptyLocations(locations));
|
|
658
|
+
}
|
|
659
|
+
return {
|
|
660
|
+
expected: input.expected,
|
|
661
|
+
output,
|
|
662
|
+
restorationEvidence,
|
|
663
|
+
overrideEvidence,
|
|
664
|
+
discoveryEvidence
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
interface EffectiveRecord {
|
|
669
|
+
readonly ref: string;
|
|
670
|
+
readonly draft: InteractionDraft;
|
|
671
|
+
readonly evidence: readonly SourceLocation[];
|
|
672
|
+
readonly confidence: RawConfidence;
|
|
673
|
+
readonly rank: number;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
const confidenceRank: Readonly<Record<RawConfidence, number>> = {
|
|
677
|
+
low: 0,
|
|
678
|
+
medium: 1,
|
|
679
|
+
high: 2
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
function lowestConfidence(records: readonly EffectiveRecord[]): RawConfidence {
|
|
683
|
+
return records.reduce<RawConfidence>((value, record) =>
|
|
684
|
+
confidenceRank[record.confidence] < confidenceRank[value]
|
|
685
|
+
? record.confidence
|
|
686
|
+
: value,
|
|
687
|
+
"high");
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
function mergeControl(
|
|
691
|
+
records: readonly EffectiveRecord[],
|
|
692
|
+
semanticKey: string,
|
|
693
|
+
anchor: InteractionAreaOutput["controlGroups"][number]["identityAnchor"]
|
|
694
|
+
): InteractionDraft["control"] {
|
|
695
|
+
const ordered = [...records].sort((left, right) =>
|
|
696
|
+
right.rank - left.rank || compareText(left.ref, right.ref)
|
|
697
|
+
);
|
|
698
|
+
const preferred = ordered[0] as EffectiveRecord;
|
|
699
|
+
const properties = new Map<string, NonNullable<InteractionDraft["control"]["properties"]>[number]>();
|
|
700
|
+
for (const record of [...ordered].reverse()) {
|
|
701
|
+
for (const property of record.draft.control.properties ?? []) {
|
|
702
|
+
const previous = properties.get(property.semanticKey);
|
|
703
|
+
if (!previous || property.status === "resolved") {
|
|
704
|
+
properties.set(property.semanticKey, property);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
const first = (field: keyof InteractionDraft["control"]): string | undefined => {
|
|
709
|
+
for (const record of ordered) {
|
|
710
|
+
const value = record.draft.control[field];
|
|
711
|
+
if (typeof value === "string" && value.trim()) return value;
|
|
712
|
+
}
|
|
713
|
+
return undefined;
|
|
714
|
+
};
|
|
715
|
+
const anchorResource = ["resource-id", "preference-key", "menu-id"].includes(
|
|
716
|
+
anchor.kind
|
|
717
|
+
) ? anchor.value : undefined;
|
|
718
|
+
const framework = first("framework") as InteractionFramework | undefined;
|
|
719
|
+
return {
|
|
720
|
+
semanticKey,
|
|
721
|
+
kind: preferred.draft.control.kind,
|
|
722
|
+
...(framework ? { framework } : {}),
|
|
723
|
+
...(first("visibleText") ? { visibleText: first("visibleText") } : {}),
|
|
724
|
+
...(first("contentDescription")
|
|
725
|
+
? { contentDescription: first("contentDescription") }
|
|
726
|
+
: {}),
|
|
727
|
+
...(first("associatedLabel") ? { associatedLabel: first("associatedLabel") } : {}),
|
|
728
|
+
...(first("resourceId") ?? anchorResource
|
|
729
|
+
? { resourceId: first("resourceId") ?? anchorResource }
|
|
730
|
+
: {}),
|
|
731
|
+
...(first("symbol") ? { symbol: first("symbol") } : {}),
|
|
732
|
+
...(properties.size > 0
|
|
733
|
+
? {
|
|
734
|
+
properties: [...properties.values()].sort((left, right) =>
|
|
735
|
+
compareText(left.semanticKey, right.semanticKey)
|
|
736
|
+
)
|
|
737
|
+
}
|
|
738
|
+
: {})
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function effectOutcomeKey(effect: InteractionDraft["action"]["effects"][number]): string {
|
|
743
|
+
return JSON.stringify([
|
|
744
|
+
effect.kind,
|
|
745
|
+
effect.target ?? null,
|
|
746
|
+
effect.stateKey ?? "",
|
|
747
|
+
effect.value ?? null,
|
|
748
|
+
effect.closePolicy ?? "",
|
|
749
|
+
[...effect.conditionKeys].sort(compareText)
|
|
750
|
+
]);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
function mergeAction(
|
|
754
|
+
records: readonly EffectiveRecord[],
|
|
755
|
+
semanticKey: string,
|
|
756
|
+
trigger: FinalizedActionPatch["trigger"]
|
|
757
|
+
): FinalizedActionPatch {
|
|
758
|
+
const ordered = [...records].sort((left, right) =>
|
|
759
|
+
right.rank - left.rank || compareText(left.ref, right.ref)
|
|
760
|
+
);
|
|
761
|
+
const preferred = ordered[0] as EffectiveRecord;
|
|
762
|
+
const conditions = new Map<string, InteractionDraft["action"]["conditions"][number]>();
|
|
763
|
+
const effects = new Map<string, InteractionDraft["action"]["effects"][number]>();
|
|
764
|
+
for (const record of [...ordered].reverse()) {
|
|
765
|
+
for (const condition of record.draft.action.conditions) {
|
|
766
|
+
conditions.set(condition.semanticKey, condition);
|
|
767
|
+
}
|
|
768
|
+
for (const effect of record.draft.action.effects) {
|
|
769
|
+
const key = effectOutcomeKey(effect);
|
|
770
|
+
const previous = effects.get(key);
|
|
771
|
+
effects.set(key, previous ? {
|
|
772
|
+
...previous,
|
|
773
|
+
...effect,
|
|
774
|
+
semanticKey: previous.semanticKey,
|
|
775
|
+
confidence: confidenceRank[previous.confidence] >= confidenceRank[effect.confidence]
|
|
776
|
+
? previous.confidence
|
|
777
|
+
: effect.confidence,
|
|
778
|
+
evidence: nonEmptyLocations([...previous.evidence, ...effect.evidence])
|
|
779
|
+
} : effect);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
return {
|
|
783
|
+
...preferred.draft.action,
|
|
784
|
+
semanticKey,
|
|
785
|
+
trigger,
|
|
786
|
+
conditions: [...conditions.values()].sort((left, right) =>
|
|
787
|
+
compareText(left.semanticKey, right.semanticKey)
|
|
788
|
+
),
|
|
789
|
+
effects: [...effects.values()].sort((left, right) =>
|
|
790
|
+
compareText(effectOutcomeKey(left), effectOutcomeKey(right))
|
|
791
|
+
),
|
|
792
|
+
candidateRefs: sortedUnique(records.map((record) => record.ref)),
|
|
793
|
+
evidence: nonEmptyLocations(records.flatMap((record) => record.evidence)),
|
|
794
|
+
confidence: lowestConfidence(records)
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function reconcileNavigation(
|
|
799
|
+
draft: InteractionDraft,
|
|
800
|
+
sourceAreaRef: string,
|
|
801
|
+
areaByRef: ReadonlyMap<string, InteractionAreaSeed>,
|
|
802
|
+
diagnostics: InteractionFinalizeDiagnostic[],
|
|
803
|
+
candidateKey: string
|
|
804
|
+
): { readonly draft: InteractionDraft; readonly conflicts: number } {
|
|
805
|
+
const sourceArea = areaByRef.get(sourceAreaRef);
|
|
806
|
+
let conflicts = 0;
|
|
807
|
+
const effects = draft.action.effects.map((effect) => {
|
|
808
|
+
if (
|
|
809
|
+
!(effect.kind === "navigate-area" || effect.kind === "show-surface") ||
|
|
810
|
+
effect.target?.kind !== "area"
|
|
811
|
+
) return effect;
|
|
812
|
+
const actualMatches = sourceArea?.outgoingLinks.filter((link) =>
|
|
813
|
+
effect.target?.kind === "area" && link.targetAreaRef === effect.target.areaRef
|
|
814
|
+
) ?? [];
|
|
815
|
+
if (actualMatches.length === 1) {
|
|
816
|
+
return { ...effect, utgEdgeRef: actualMatches[0]?.edgeId };
|
|
817
|
+
}
|
|
818
|
+
conflicts += 1;
|
|
819
|
+
diagnostics.push({
|
|
820
|
+
code: "UTG_NAV_CONFLICT",
|
|
821
|
+
message: actualMatches.length === 0
|
|
822
|
+
? `Source navigation ${sourceAreaRef} -> ${effect.target.areaRef} has no frozen UTG link`
|
|
823
|
+
: `Source navigation ${sourceAreaRef} -> ${effect.target.areaRef} matches multiple frozen UTG links`,
|
|
824
|
+
candidateKey,
|
|
825
|
+
areaRef: sourceAreaRef
|
|
826
|
+
});
|
|
827
|
+
const { utgEdgeRef: _ignored, ...withoutEdge } = effect;
|
|
828
|
+
return withoutEdge;
|
|
829
|
+
});
|
|
830
|
+
return { draft: { ...draft, action: { ...draft.action, effects } }, conflicts };
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
function unresolvedEntry(
|
|
834
|
+
candidate: InteractionCandidate,
|
|
835
|
+
reasonCode: string,
|
|
836
|
+
message: string
|
|
837
|
+
): InteractionUnresolved {
|
|
838
|
+
return {
|
|
839
|
+
candidateKey: candidate.candidateKey,
|
|
840
|
+
areaRefs: candidate.interaction.areaRef
|
|
841
|
+
? [candidate.interaction.areaRef]
|
|
842
|
+
: candidate.interaction.areaCandidates,
|
|
843
|
+
reasonCode,
|
|
844
|
+
message
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
export async function finalizeInteractionShards(
|
|
849
|
+
input: FinalizeInteractionShardsInput
|
|
850
|
+
): Promise<FinalizedInteractionAnalysis> {
|
|
851
|
+
const candidateByKey = new Map(input.candidates.map((candidate) =>
|
|
852
|
+
[candidate.candidateKey, candidate]
|
|
853
|
+
));
|
|
854
|
+
if (candidateByKey.size !== input.candidates.length ||
|
|
855
|
+
!sameSet([...candidateByKey.keys()], input.manifest.candidateKeys)) {
|
|
856
|
+
throw new Error("Interaction manifest candidate census does not match scanner output");
|
|
857
|
+
}
|
|
858
|
+
const areaByRef = new Map(input.areas.map((area) => [area.areaRef, area]));
|
|
859
|
+
if (areaByRef.size !== input.areas.length) {
|
|
860
|
+
throw new Error("Interaction Area seeds contain duplicate areaRef values");
|
|
861
|
+
}
|
|
862
|
+
const scopeExcludedAreas = new Set(input.manifest.scopeExcludedAreaRefs ?? []);
|
|
863
|
+
const plannedAreas = input.manifest.areaPlans.map((plan) => plan.expected.areaRef);
|
|
864
|
+
if (plannedAreas.some((ref) => scopeExcludedAreas.has(ref)) ||
|
|
865
|
+
!sameSet([...plannedAreas, ...scopeExcludedAreas], [...areaByRef.keys()])) {
|
|
866
|
+
throw new Error("Interaction manifest must contain exactly one Area task per frozen Area");
|
|
867
|
+
}
|
|
868
|
+
const diagnostics: InteractionFinalizeDiagnostic[] = [];
|
|
869
|
+
const unresolved: InteractionUnresolved[] = [];
|
|
870
|
+
const failedTaskIds = new Set<string>();
|
|
871
|
+
const reviewById = new Map<string, ValidatedInteractionShardOutput>();
|
|
872
|
+
const invalidCandidateReasons = new Map<string, string>();
|
|
873
|
+
|
|
874
|
+
for (const plan of input.manifest.shards) {
|
|
875
|
+
try {
|
|
876
|
+
reviewById.set(plan.shardId, await validateInteractionShardOutput({
|
|
877
|
+
value: outputFor(input.outputs, plan.shardId),
|
|
878
|
+
expected: plan.expected,
|
|
879
|
+
areas: input.areas,
|
|
880
|
+
candidates: input.candidates,
|
|
881
|
+
projectRoot: input.projectRoot,
|
|
882
|
+
sourceFiles: input.sourceFiles,
|
|
883
|
+
...(input.readFile ? { readFile: input.readFile } : {})
|
|
884
|
+
}));
|
|
885
|
+
} catch (error) {
|
|
886
|
+
const message = `Invalid review output: ${error instanceof Error ? error.message : String(error)}`;
|
|
887
|
+
failedTaskIds.add(plan.shardId);
|
|
888
|
+
diagnostics.push({ code: "SHARD_FAILED", message, shardId: plan.shardId });
|
|
889
|
+
for (const candidateKey of plan.expected.candidateKeys) {
|
|
890
|
+
invalidCandidateReasons.set(candidateKey, message);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
const controls: FinalizedControlPatch[] = [];
|
|
896
|
+
const controlAnchorClaims: {
|
|
897
|
+
readonly areaRef: string;
|
|
898
|
+
readonly controlRef: string;
|
|
899
|
+
readonly anchor: ControlIdentityAnchor;
|
|
900
|
+
}[] = [];
|
|
901
|
+
const candidateOutcome = new Map<string, "accept" | "correct" | "exclude" | "scope-excluded" | "unresolved">();
|
|
902
|
+
const scopeExcludedKeys = new Set(input.manifest.scopeExcludedCandidateKeys ?? []);
|
|
903
|
+
for (const key of scopeExcludedKeys) {
|
|
904
|
+
if (!candidateByKey.has(key) || input.manifest.shards.some((plan) => plan.expected.candidateKeys.includes(key))) {
|
|
905
|
+
throw new Error(`Invalid skipped candidate in scope: ${key}`);
|
|
906
|
+
}
|
|
907
|
+
candidateOutcome.set(key, "scope-excluded");
|
|
908
|
+
}
|
|
909
|
+
let discoveryAccepted = 0;
|
|
910
|
+
let merged = 0;
|
|
911
|
+
let navConflicts = 0;
|
|
912
|
+
const coverage = new Map<string, "reviewed" | "incomplete">();
|
|
913
|
+
|
|
914
|
+
for (const areaPlan of input.manifest.areaPlans) {
|
|
915
|
+
const expected = areaPlan.expected;
|
|
916
|
+
const reviews = expected.reviewTaskIds.flatMap((taskId) => {
|
|
917
|
+
const review = reviewById.get(taskId);
|
|
918
|
+
return review ? [review] : [];
|
|
919
|
+
});
|
|
920
|
+
const dependencyFailure = expected.reviewTaskIds.find((taskId) =>
|
|
921
|
+
!reviewById.has(taskId)
|
|
922
|
+
);
|
|
923
|
+
if (dependencyFailure) {
|
|
924
|
+
coverage.set(expected.areaRef, "incomplete");
|
|
925
|
+
for (const candidateKey of expected.candidateKeys) {
|
|
926
|
+
const candidate = candidateByKey.get(candidateKey) as InteractionCandidate;
|
|
927
|
+
const message = invalidCandidateReasons.get(candidateKey) ??
|
|
928
|
+
`Area reconciliation dependency failed: ${dependencyFailure}`;
|
|
929
|
+
candidateOutcome.set(candidateKey, "unresolved");
|
|
930
|
+
unresolved.push(unresolvedEntry(candidate, "SHARD_FAILED", message));
|
|
931
|
+
}
|
|
932
|
+
continue;
|
|
933
|
+
}
|
|
934
|
+
let area: ValidatedInteractionAreaOutput;
|
|
935
|
+
try {
|
|
936
|
+
area = await validateInteractionAreaOutput({
|
|
937
|
+
value: outputFor(input.outputs, areaPlan.areaTaskId),
|
|
938
|
+
expected,
|
|
939
|
+
reviews,
|
|
940
|
+
areas: input.areas,
|
|
941
|
+
candidates: input.candidates,
|
|
942
|
+
projectRoot: input.projectRoot,
|
|
943
|
+
sourceFiles: input.sourceFiles,
|
|
944
|
+
...(input.readFile ? { readFile: input.readFile } : {})
|
|
945
|
+
});
|
|
946
|
+
} catch (error) {
|
|
947
|
+
const message = `Invalid Area output: ${error instanceof Error ? error.message : String(error)}`;
|
|
948
|
+
failedTaskIds.add(areaPlan.areaTaskId);
|
|
949
|
+
diagnostics.push({
|
|
950
|
+
code: "SHARD_FAILED",
|
|
951
|
+
message,
|
|
952
|
+
shardId: areaPlan.areaTaskId,
|
|
953
|
+
areaRef: expected.areaRef
|
|
954
|
+
});
|
|
955
|
+
coverage.set(expected.areaRef, "incomplete");
|
|
956
|
+
const decisions = reviews.flatMap((review) => review.output.decisions);
|
|
957
|
+
for (const decision of decisions) {
|
|
958
|
+
const candidate = candidateByKey.get(decision.candidateKey) as InteractionCandidate;
|
|
959
|
+
if (decision.disposition === "exclude") {
|
|
960
|
+
candidateOutcome.set(decision.candidateKey, "exclude");
|
|
961
|
+
} else {
|
|
962
|
+
candidateOutcome.set(decision.candidateKey, "unresolved");
|
|
963
|
+
unresolved.push(unresolvedEntry(candidate, "AREA_RECONCILIATION_FAILED", message));
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
continue;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
coverage.set(
|
|
970
|
+
expected.areaRef,
|
|
971
|
+
area.output.coverage.status === "incomplete" ? "incomplete" : "reviewed"
|
|
972
|
+
);
|
|
973
|
+
const decisions = reviews.flatMap((review) => review.output.decisions);
|
|
974
|
+
const decisionByKey = new Map(decisions.map((decision) =>
|
|
975
|
+
[decision.candidateKey, decision]
|
|
976
|
+
));
|
|
977
|
+
const reviewByCandidate = new Map<string, ValidatedInteractionShardOutput>();
|
|
978
|
+
for (const review of reviews) {
|
|
979
|
+
for (const decision of review.output.decisions) {
|
|
980
|
+
reviewByCandidate.set(decision.candidateKey, review);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
const restorations = new Set(area.output.restorations.map((item) => item.candidateKey));
|
|
984
|
+
const overrides = new Map(area.output.overrides.map((item) => [item.candidateKey, item]));
|
|
985
|
+
const areaScopeExcluded = new Set((area.output.scopeExclusions ?? []).flatMap((item) => item.candidateKeys));
|
|
986
|
+
const effectiveCandidates = new Map<string, EffectiveRecord>();
|
|
987
|
+
for (const decision of decisions) {
|
|
988
|
+
const candidate = candidateByKey.get(decision.candidateKey) as InteractionCandidate;
|
|
989
|
+
if (areaScopeExcluded.has(decision.candidateKey)) {
|
|
990
|
+
candidateOutcome.set(decision.candidateKey, "scope-excluded");
|
|
991
|
+
scopeExcludedKeys.add(decision.candidateKey);
|
|
992
|
+
continue;
|
|
993
|
+
}
|
|
994
|
+
if (decision.disposition === "exclude" && !restorations.has(decision.candidateKey)) {
|
|
995
|
+
candidateOutcome.set(decision.candidateKey, "exclude");
|
|
996
|
+
continue;
|
|
997
|
+
}
|
|
998
|
+
const areaOverride = overrides.get(decision.candidateKey);
|
|
999
|
+
if (areaOverride?.disposition === "exclude") {
|
|
1000
|
+
candidateOutcome.set(decision.candidateKey, "exclude");
|
|
1001
|
+
continue;
|
|
1002
|
+
}
|
|
1003
|
+
const review = reviewByCandidate.get(decision.candidateKey) as ValidatedInteractionShardOutput;
|
|
1004
|
+
const areaCorrected = areaOverride?.disposition === "correct";
|
|
1005
|
+
const reviewCorrected = decision.disposition === "correct";
|
|
1006
|
+
const corrected = areaCorrected || reviewCorrected;
|
|
1007
|
+
// A cited `correct` decision audits the complete interaction. Treat its
|
|
1008
|
+
// draft as authoritative: restoring scanner properties or Effects here
|
|
1009
|
+
// would make false-positive scanner facts impossible to remove.
|
|
1010
|
+
const draft = areaCorrected
|
|
1011
|
+
? areaOverride.correctedInteraction as InteractionDraft
|
|
1012
|
+
: reviewCorrected
|
|
1013
|
+
? decision.correctedInteraction as InteractionDraft
|
|
1014
|
+
: candidate.interaction;
|
|
1015
|
+
const evidence = areaCorrected
|
|
1016
|
+
? area.overrideEvidence.get(decision.candidateKey) ?? candidate.evidence
|
|
1017
|
+
: reviewCorrected
|
|
1018
|
+
? review.decisionEvidence.get(decision.candidateKey) ?? candidate.evidence
|
|
1019
|
+
: restorations.has(decision.candidateKey)
|
|
1020
|
+
? area.restorationEvidence.get(decision.candidateKey) ?? candidate.evidence
|
|
1021
|
+
: candidate.evidence;
|
|
1022
|
+
const reconciled = reconcileNavigation(
|
|
1023
|
+
draft,
|
|
1024
|
+
expected.areaRef,
|
|
1025
|
+
areaByRef,
|
|
1026
|
+
diagnostics,
|
|
1027
|
+
decision.candidateKey
|
|
1028
|
+
);
|
|
1029
|
+
navConflicts += reconciled.conflicts;
|
|
1030
|
+
effectiveCandidates.set(decision.candidateKey, {
|
|
1031
|
+
ref: decision.candidateKey,
|
|
1032
|
+
draft: reconciled.draft,
|
|
1033
|
+
evidence,
|
|
1034
|
+
confidence: candidate.confidence,
|
|
1035
|
+
rank: areaCorrected ? 4 : reviewCorrected ? 3 : 2
|
|
1036
|
+
});
|
|
1037
|
+
candidateOutcome.set(
|
|
1038
|
+
decision.candidateKey,
|
|
1039
|
+
corrected ? "correct" : "accept"
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
const discoveryRecords = new Map<string, EffectiveRecord>();
|
|
1044
|
+
// Agent discoveries carry no framework (the Agent writes only the tag name
|
|
1045
|
+
// as `kind`); infer it from the frozen Area so a UniApp discovery still
|
|
1046
|
+
// gets `framework: "uniapp"` and can fall back to its tag name as a name.
|
|
1047
|
+
const inferredFramework = areaByRef.get(expected.areaRef)?.kind === "hybrid-page"
|
|
1048
|
+
? "uniapp" as const
|
|
1049
|
+
: undefined;
|
|
1050
|
+
for (const discovery of area.output.discoveries) {
|
|
1051
|
+
const ref = createAgentDiscoveryCandidateKey({
|
|
1052
|
+
caseId: input.manifest.caseId,
|
|
1053
|
+
taskId: area.output.taskId,
|
|
1054
|
+
discoveryKey: discovery.discoveryKey,
|
|
1055
|
+
areaRef: expected.areaRef,
|
|
1056
|
+
controlKey: canonicalControlAnchor(discovery.identityAnchors.control),
|
|
1057
|
+
actionKey: canonicalActionAnchor(discovery.identityAnchors.action)
|
|
1058
|
+
});
|
|
1059
|
+
const reconciled = reconcileNavigation(
|
|
1060
|
+
discovery.interaction,
|
|
1061
|
+
expected.areaRef,
|
|
1062
|
+
areaByRef,
|
|
1063
|
+
diagnostics,
|
|
1064
|
+
ref
|
|
1065
|
+
);
|
|
1066
|
+
navConflicts += reconciled.conflicts;
|
|
1067
|
+
discoveryRecords.set(discovery.discoveryKey, {
|
|
1068
|
+
ref,
|
|
1069
|
+
draft: inferredFramework && !reconciled.draft.control.framework
|
|
1070
|
+
? {
|
|
1071
|
+
...reconciled.draft,
|
|
1072
|
+
control: { ...reconciled.draft.control, framework: inferredFramework }
|
|
1073
|
+
}
|
|
1074
|
+
: reconciled.draft,
|
|
1075
|
+
evidence: area.discoveryEvidence.get(discovery.discoveryKey) ?? [],
|
|
1076
|
+
confidence: "medium",
|
|
1077
|
+
rank: 1
|
|
1078
|
+
});
|
|
1079
|
+
discoveryAccepted += 1;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
for (const group of area.output.controlGroups) {
|
|
1083
|
+
const groupRecords = [
|
|
1084
|
+
...group.candidateKeys.map((key) => effectiveCandidates.get(key) as EffectiveRecord),
|
|
1085
|
+
...group.discoveryKeys.map((key) => discoveryRecords.get(key) as EffectiveRecord)
|
|
1086
|
+
];
|
|
1087
|
+
// Defense in depth: L1 rejects a memberless Control group, but a
|
|
1088
|
+
// hand-written/legacy draft can bypass the structural gate. Drop it with
|
|
1089
|
+
// a diagnostic instead of dereferencing an empty `ordered[0]` below.
|
|
1090
|
+
if (groupRecords.length === 0) {
|
|
1091
|
+
diagnostics.push({
|
|
1092
|
+
code: "INTERACTION_CONFLICT",
|
|
1093
|
+
message: `Control group ${group.controlGroupKey} has no candidate or discovery members; dropped`,
|
|
1094
|
+
areaRef: expected.areaRef
|
|
1095
|
+
});
|
|
1096
|
+
continue;
|
|
1097
|
+
}
|
|
1098
|
+
const controlId = createFinalControlId({
|
|
1099
|
+
caseId: input.manifest.caseId,
|
|
1100
|
+
areaRef: expected.areaRef,
|
|
1101
|
+
anchor: group.identityAnchor
|
|
1102
|
+
});
|
|
1103
|
+
const actions = group.actions.flatMap((actionGroup) => {
|
|
1104
|
+
const records = [
|
|
1105
|
+
...actionGroup.candidateKeys.map((key) =>
|
|
1106
|
+
effectiveCandidates.get(key) as EffectiveRecord
|
|
1107
|
+
),
|
|
1108
|
+
...actionGroup.discoveryKeys.map((key) =>
|
|
1109
|
+
discoveryRecords.get(key) as EffectiveRecord
|
|
1110
|
+
)
|
|
1111
|
+
];
|
|
1112
|
+
// Same defense as the memberless-group guard: a memberless Action must
|
|
1113
|
+
// never reach `mergeAction` (it would dereference an empty `ordered[0]`).
|
|
1114
|
+
if (records.length === 0) {
|
|
1115
|
+
diagnostics.push({
|
|
1116
|
+
code: "INTERACTION_CONFLICT",
|
|
1117
|
+
message: `Action group ${actionGroup.actionGroupKey} of Control group ${group.controlGroupKey} has no candidate or discovery members; dropped`,
|
|
1118
|
+
areaRef: expected.areaRef,
|
|
1119
|
+
controlRef: controlId
|
|
1120
|
+
});
|
|
1121
|
+
return [];
|
|
1122
|
+
}
|
|
1123
|
+
const actionId = createFinalActionId({
|
|
1124
|
+
caseId: input.manifest.caseId,
|
|
1125
|
+
controlId,
|
|
1126
|
+
trigger: actionGroup.trigger,
|
|
1127
|
+
anchor: actionGroup.identityAnchor
|
|
1128
|
+
});
|
|
1129
|
+
merged += Math.max(0, records.length - 1);
|
|
1130
|
+
return [mergeAction(records, actionId, actionGroup.trigger)];
|
|
1131
|
+
}).sort((left, right) => compareText(left.semanticKey, right.semanticKey));
|
|
1132
|
+
if (actions.length === 0) {
|
|
1133
|
+
diagnostics.push({
|
|
1134
|
+
code: "INTERACTION_CONFLICT",
|
|
1135
|
+
message: `Control group ${group.controlGroupKey} has no Action members; dropped`,
|
|
1136
|
+
areaRef: expected.areaRef,
|
|
1137
|
+
controlRef: controlId
|
|
1138
|
+
});
|
|
1139
|
+
continue;
|
|
1140
|
+
}
|
|
1141
|
+
controls.push({
|
|
1142
|
+
areaRef: expected.areaRef,
|
|
1143
|
+
control: mergeControl(groupRecords, controlId, group.identityAnchor),
|
|
1144
|
+
actions: actions as [FinalizedActionPatch, ...FinalizedActionPatch[]]
|
|
1145
|
+
});
|
|
1146
|
+
controlAnchorClaims.push({
|
|
1147
|
+
areaRef: expected.areaRef,
|
|
1148
|
+
controlRef: controlId,
|
|
1149
|
+
anchor: group.identityAnchor
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
const crossAreaFindings = findCrossAreaAnchorCollisions(controlAnchorClaims);
|
|
1155
|
+
const crossAreaAreaKinds = new Map(controlAnchorClaims.map((claim) => [
|
|
1156
|
+
claim.areaRef,
|
|
1157
|
+
areaByRef.get(claim.areaRef)?.kind ?? ""
|
|
1158
|
+
]));
|
|
1159
|
+
for (const finding of crossAreaFindings) {
|
|
1160
|
+
const memberList = finding.members
|
|
1161
|
+
.map((member) => `${member.areaRef} (${member.controlRef})`)
|
|
1162
|
+
.join(", ");
|
|
1163
|
+
const suggestedOwnerAreaRef = suggestedCrossAreaAnchorOwner(finding, crossAreaAreaKinds);
|
|
1164
|
+
const demotedMembers = suggestedOwnerAreaRef
|
|
1165
|
+
? finding.members.filter((member) => member.areaRef !== suggestedOwnerAreaRef)
|
|
1166
|
+
: [];
|
|
1167
|
+
const resolution = suggestedOwnerAreaRef
|
|
1168
|
+
? `; auto-resolved: kept ${suggestedOwnerAreaRef}, demoted ${demotedMembers
|
|
1169
|
+
.map((member) => member.areaRef).join(", ")}`
|
|
1170
|
+
: "";
|
|
1171
|
+
for (const member of finding.members) {
|
|
1172
|
+
const other = finding.members.find(
|
|
1173
|
+
(candidate) => candidate.areaRef !== member.areaRef
|
|
1174
|
+
);
|
|
1175
|
+
diagnostics.push({
|
|
1176
|
+
code: finding.code,
|
|
1177
|
+
message: `Normalized ${finding.anchorKind} anchor "${finding.anchorValue}" is claimed by ${finding.members.length} Area(s): ${memberList}${resolution}`,
|
|
1178
|
+
areaRef: member.areaRef,
|
|
1179
|
+
controlRef: member.controlRef,
|
|
1180
|
+
...(other ? { relatedAreaRef: other.areaRef } : {}),
|
|
1181
|
+
...(suggestedOwnerAreaRef ? { suggestedOwnerAreaRef } : {})
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
const { kept: keptControls, excluded: excludedDuplicateControls } =
|
|
1186
|
+
partitionCrossAreaDuplicateControls(controls, crossAreaFindings, crossAreaAreaKinds);
|
|
1187
|
+
|
|
1188
|
+
for (const candidate of input.candidates) {
|
|
1189
|
+
if (candidateOutcome.has(candidate.candidateKey)) continue;
|
|
1190
|
+
candidateOutcome.set(candidate.candidateKey, "unresolved");
|
|
1191
|
+
unresolved.push(unresolvedEntry(
|
|
1192
|
+
candidate,
|
|
1193
|
+
"CANDIDATE_NOT_PLANNED",
|
|
1194
|
+
"Candidate was not assigned to a completed Area reconciliation task"
|
|
1195
|
+
));
|
|
1196
|
+
}
|
|
1197
|
+
const counts = { agentAccepted: 0, corrected: 0, excluded: 0, unresolved: 0, "scope-excluded": 0 };
|
|
1198
|
+
for (const outcome of candidateOutcome.values()) {
|
|
1199
|
+
const key = outcome === "accept"
|
|
1200
|
+
? "agentAccepted"
|
|
1201
|
+
: outcome === "correct"
|
|
1202
|
+
? "corrected"
|
|
1203
|
+
: outcome === "exclude" ? "excluded" : outcome;
|
|
1204
|
+
counts[key] += 1;
|
|
1205
|
+
}
|
|
1206
|
+
const incompleteAreaRefs = input.areas
|
|
1207
|
+
.filter((area) => !scopeExcludedAreas.has(area.areaRef) && coverage.get(area.areaRef) !== "reviewed")
|
|
1208
|
+
.map((area) => area.areaRef).sort(compareText);
|
|
1209
|
+
return {
|
|
1210
|
+
contractVersion: INTERACTION_ANALYSIS_CONTRACT_VERSION,
|
|
1211
|
+
...(input.manifest.scopeExcludedAreaRefs ? {
|
|
1212
|
+
scopeExcludedAreaRefs: [...scopeExcludedAreas].sort(compareText),
|
|
1213
|
+
scopeExcludedCandidateKeys: [...scopeExcludedKeys].sort(compareText)
|
|
1214
|
+
} : {}),
|
|
1215
|
+
caseId: input.manifest.caseId,
|
|
1216
|
+
inputFingerprint: input.manifest.inputFingerprint,
|
|
1217
|
+
controls: keptControls.sort((left, right) => compareText(
|
|
1218
|
+
`${left.areaRef}\u0000${left.control.semanticKey}`,
|
|
1219
|
+
`${right.areaRef}\u0000${right.control.semanticKey}`
|
|
1220
|
+
)),
|
|
1221
|
+
excludedDuplicateControls,
|
|
1222
|
+
unresolved: unresolved.sort((left, right) => compareText(
|
|
1223
|
+
left.candidateKey,
|
|
1224
|
+
right.candidateKey
|
|
1225
|
+
)),
|
|
1226
|
+
diagnostics: diagnostics.sort((left, right) => compareText(
|
|
1227
|
+
`${left.code}\u0000${left.shardId ?? ""}\u0000${left.candidateKey ?? ""}`,
|
|
1228
|
+
`${right.code}\u0000${right.shardId ?? ""}\u0000${right.candidateKey ?? ""}`
|
|
1229
|
+
)),
|
|
1230
|
+
failedShardIds: [...failedTaskIds].sort(compareText),
|
|
1231
|
+
incompleteAreaRefs,
|
|
1232
|
+
utgNavConflicts: navConflicts,
|
|
1233
|
+
conservation: {
|
|
1234
|
+
...(input.manifest.scopeExcludedAreaRefs ? { scopeExcluded: counts["scope-excluded"] } : {}),
|
|
1235
|
+
candidateTotal: input.candidates.length,
|
|
1236
|
+
agentAccepted: counts.agentAccepted,
|
|
1237
|
+
corrected: counts.corrected,
|
|
1238
|
+
merged,
|
|
1239
|
+
excluded: counts.excluded,
|
|
1240
|
+
unresolved: counts.unresolved,
|
|
1241
|
+
discoveryAccepted,
|
|
1242
|
+
...(excludedDuplicateControls.length > 0 ? {
|
|
1243
|
+
demotedDuplicate: excludedDuplicateControls.reduce(
|
|
1244
|
+
(sum, item) => sum + item.candidateKeys.length, 0)
|
|
1245
|
+
} : {})
|
|
1246
|
+
},
|
|
1247
|
+
semanticCompleteness: interactionSemanticCompleteness({
|
|
1248
|
+
failedTaskCount: failedTaskIds.size,
|
|
1249
|
+
incompleteAreaCount: incompleteAreaRefs.length,
|
|
1250
|
+
unresolvedCount: unresolved.length,
|
|
1251
|
+
diagnostics
|
|
1252
|
+
})
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* A diagnostic the pipeline already decided: nothing is left for an operator
|
|
1258
|
+
* to resolve. A navigation conflict retains the existing-Area target as a
|
|
1259
|
+
* semantic Edge, and an auto-resolved cross-Area duplicate demoted every
|
|
1260
|
+
* non-owner copy (the diagnostic then carries `suggestedOwnerAreaRef`). An
|
|
1261
|
+
* UNRESOLVED duplicate — ambiguous members, nothing demoted, both copies
|
|
1262
|
+
* retained — is NOT decided; it is an open gap.
|
|
1263
|
+
*/
|
|
1264
|
+
export function isDecidedInteractionDiagnostic(
|
|
1265
|
+
item: InteractionFinalizeDiagnostic
|
|
1266
|
+
): boolean {
|
|
1267
|
+
if (item.code === "UTG_NAV_CONFLICT") return true;
|
|
1268
|
+
if (item.code === "CROSS_AREA_DUPLICATE_ANCHOR") {
|
|
1269
|
+
return item.suggestedOwnerAreaRef !== undefined;
|
|
1270
|
+
}
|
|
1271
|
+
return false;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* The completeness verdict for one finalized interaction pass.
|
|
1276
|
+
*
|
|
1277
|
+
* A `CROSS_AREA_DUPLICATE_ANCHOR` is closed only when it was auto-resolved
|
|
1278
|
+
* above (exactly one dialog/transient member: the owning Area keeps the
|
|
1279
|
+
* Feature, every other copy is demoted). An unresolved one — ambiguous
|
|
1280
|
+
* members, nothing demoted, both copies retained — is an open gap: publishing
|
|
1281
|
+
* two Features for one control while reporting `complete` would be a
|
|
1282
|
+
* fail-open. A `UTG_NAV_CONFLICT` and every other decided diagnostic are not
|
|
1283
|
+
* gaps; every other diagnostic, an unfinished Area, a failed task and an
|
|
1284
|
+
* unclaimed candidate are.
|
|
1285
|
+
*/
|
|
1286
|
+
export function interactionSemanticCompleteness(input: {
|
|
1287
|
+
readonly failedTaskCount: number;
|
|
1288
|
+
readonly incompleteAreaCount: number;
|
|
1289
|
+
readonly unresolvedCount: number;
|
|
1290
|
+
readonly diagnostics: readonly InteractionFinalizeDiagnostic[];
|
|
1291
|
+
}): "complete" | "incomplete-known" {
|
|
1292
|
+
const open = input.failedTaskCount > 0 ||
|
|
1293
|
+
input.incompleteAreaCount > 0 ||
|
|
1294
|
+
input.unresolvedCount > 0 ||
|
|
1295
|
+
input.diagnostics.some((item) => !isDecidedInteractionDiagnostic(item));
|
|
1296
|
+
return open ? "incomplete-known" : "complete";
|
|
1297
|
+
}
|