@buaa_smat/hometrans 26.0.3 → 26.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/agents/code-reviewer.md +91 -21
- package/env-requirements.json +1 -1
- package/i18n/agents/code-reviewer.md +93 -21
- package/i18n/skills/a2h-app-migrate/SKILL.md +19 -11
- package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +2 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +320 -73
- package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
- package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
- package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
- package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
- package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
- package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
- package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
- package/i18n/skills/a2h-arch-generate/SKILL.md +20 -17
- package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
- package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
- package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +25 -14
- package/i18n/skills/a2h-arch-generate/references/source-baseline.md +4 -4
- package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +304 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +52 -11
- package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
- package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +70 -21
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +31 -0
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +22 -6
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +386 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +133 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
- package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
- package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +11 -9
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +51 -13
- package/i18n/skills/a2h-page-specgen/SKILL.md +123 -20
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
- package/i18n/skills/a2h-page-specgen/references/body-language.md +11 -9
- package/i18n/skills/a2h-page-specgen/references/gates.md +119 -52
- package/i18n/skills/a2h-page-specgen/references/page-inventory.md +69 -22
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +113 -110
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +171 -62
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +314 -192
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +364 -76
- package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +216 -8
- package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -223
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +521 -13
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
- package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +483 -125
- package/i18n/skills/a2h-page-specgen/scripts/render.mjs +10 -33
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +134 -163
- package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +206 -9
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
- package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +862 -12
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +166 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
- package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +69 -44
- package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +658 -120
- package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
- package/i18n/skills/a2h-resource-convert/SKILL.md +9 -1
- package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
- package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
- package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
- package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +69 -109
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +135 -37
- package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +24 -13
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +170 -7
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
- package/i18n/skills/a2h-spec-generate/SKILL.md +2 -2
- package/i18n/skills/a2h-utg-explorer/SKILL.md +9 -3
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +3 -0
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +74 -84
- package/i18n/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
- package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +252 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +211 -61
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +724 -47
- package/i18n/skills/a2h-utg-static/SKILL.md +6 -2
- package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +82 -12
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
- package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
- package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
- package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
- package/i18n/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +50 -5
- package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
- package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +17 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +181 -17
- package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +118 -19
- package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +113 -70
- package/package.json +3 -6
- package/skills/a2h-app-migrate/SKILL.md +19 -11
- package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/skills/a2h-app-migrate/references/stage-map.md +2 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +307 -74
- package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
- package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
- package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +64 -6
- package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +33 -9
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +27 -17
- package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
- package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
- package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
- package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +7 -7
- package/skills/a2h-app-migrate/test/test_incremental_acceptance.mjs +145 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
- package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +10 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +39 -0
- package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +33 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
- package/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
- package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +13 -5
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +170 -3
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +12 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
- package/skills/a2h-arch-generate/SKILL.md +20 -17
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +10 -8
- package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
- package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +17 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +26 -0
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +146 -17
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
- package/skills/a2h-arkts-logic-coder/references/spec-design.md +42 -11
- package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
- package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +244 -0
- package/skills/a2h-batch-ui-align/SKILL.md +72 -22
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
- package/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
- package/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
- package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +30 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
- package/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
- package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +380 -16
- package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
- package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
- package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
- package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +39 -5
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +213 -30
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
- package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
- package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
- package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
- package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +24 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +24 -2
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +14 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_baseline.test.mjs +129 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_runtime2.test.mjs +697 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +41 -7
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +346 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme_runtime.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +1 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +19 -0
- package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack_evidence.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +155 -1
- package/skills/a2h-batch-ui-align/scripts/tests/icon_coverage.test.mjs +314 -0
- package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
- package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
- package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +5 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
- package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
- package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
- package/skills/a2h-dashboard-render/test/test_device_locale_dialogs.mjs +17 -0
- package/skills/a2h-module-semantic-docs/SKILL.md +51 -13
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
- package/skills/a2h-module-semantic-docs/test/test_incremental_fingerprint.mjs +94 -0
- package/skills/a2h-page-specgen/SKILL.md +124 -20
- package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
- package/skills/a2h-page-specgen/references/body-language.md +11 -9
- package/skills/a2h-page-specgen/references/evidence.md +35 -0
- package/skills/a2h-page-specgen/references/execution-model.md +135 -26
- package/skills/a2h-page-specgen/references/footprint-and-grouping.md +20 -15
- package/skills/a2h-page-specgen/references/gates.md +120 -52
- package/skills/a2h-page-specgen/references/page-inventory.md +69 -22
- package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
- package/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/skills/a2h-page-specgen/references/spec-template.md +112 -109
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/skills/a2h-page-specgen/scripts/dispatch.mjs +8 -5
- package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/skills/a2h-page-specgen/scripts/facts-build.mjs +170 -61
- package/skills/a2h-page-specgen/scripts/finalize.mjs +466 -63
- package/skills/a2h-page-specgen/scripts/footprint.mjs +302 -180
- package/skills/a2h-page-specgen/scripts/gate.mjs +372 -82
- package/skills/a2h-page-specgen/scripts/interactions.mjs +215 -8
- package/skills/a2h-page-specgen/scripts/inventory.mjs +102 -0
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -216
- package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +105 -13
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +520 -12
- package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +129 -6
- package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
- package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
- package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
- package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +106 -0
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/skills/a2h-page-specgen/scripts/prepare.mjs +470 -122
- package/skills/a2h-page-specgen/scripts/render.mjs +11 -34
- package/skills/a2h-page-specgen/scripts/report.mjs +339 -6
- package/skills/a2h-page-specgen/scripts/submission.mjs +253 -88
- package/skills/a2h-page-specgen/scripts/submit.mjs +12 -6
- package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
- package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +135 -137
- package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +178 -9
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +19 -1
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshOnResume.java +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
- package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +869 -13
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
- package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
- package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
- package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +42 -2
- package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +171 -3
- package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +365 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
- package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
- package/skills/a2h-page-specgen/scripts/test/render.test.mjs +85 -42
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
- package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
- package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +645 -115
- package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
- package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +88 -74
- package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +30 -1
- package/skills/a2h-page-specgen/scripts/waker.mjs +79 -12
- package/skills/a2h-page-specgen/scripts/watchdog.mjs +18 -17
- package/skills/a2h-resource-convert/SKILL.md +9 -1
- package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
- package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
- package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
- package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
- package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
- package/skills/a2h-resource-convert/scripts/tests/code_vector_guard.test.mjs +75 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
- package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +48 -72
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +123 -37
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +40 -8
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +5 -4
- package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +37 -5
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
- package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +38 -14
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +127 -4
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +90 -24
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +65 -34
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +11 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +10 -2
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/{HttpExtraDataEmptyStringCheck.js → platform/ExtraDataSubCheck.js} +27 -30
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +4 -2
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +3 -2
- package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +55 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +138 -7
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +10 -13
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +21 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +32 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +109 -13
- package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
- package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +12 -17
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +172 -7
- package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +36 -16
- package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +27 -3
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +20 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +143 -13
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +168 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +139 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +25 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +37 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +4 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +59 -8
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +44 -0
- package/skills/a2h-spec-generate/SKILL.md +2 -2
- package/skills/a2h-spec-generate/references/specs.schema.json +24 -11
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +1 -2
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +1 -2
- package/skills/a2h-utg-explorer/SKILL.md +9 -3
- package/skills/a2h-utg-explorer/references/architecture.md +3 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +56 -5
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
- package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
- package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
- package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -0
- package/skills/a2h-utg-explorer/scripts/tests/default_override.test.mjs +109 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -0
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +254 -0
- package/skills/a2h-utg-explorer/scripts/tests/foreground_spelling.test.mjs +155 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +120 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +218 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d_grounding.test.mjs +164 -0
- package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -0
- package/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +122 -4
- package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +138 -4
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +22 -13
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
- package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
- package/skills/a2h-utg-static/SKILL.md +6 -2
- package/skills/a2h-utg-static/scripts/assemble.mjs +65 -0
- package/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +8 -1
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
- package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
- package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +86 -4
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
- package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
- package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +0 -55
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +0 -60
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +0 -948
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +0 -1014
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* task_runner.mjs — port of task_runner.py. Verified parent recovery, finite selector search,
|
|
3
3
|
* scroll sweeps and evidence-backed mappings. Synchronous like the Python.
|
|
4
4
|
*
|
|
5
|
-
* Exports: deviceLock, DeviceBusy, lockOwner, lockWait, LOCK_WAIT_S, BudgetExhausted, _isHorizontal, _viewSig, TRANSIENT_DEVICE_RE, Runner,
|
|
5
|
+
* Exports: deviceLock, DeviceBusy, lockOwner, lockWait, LOCK_WAIT_S, BudgetExhausted, _isHorizontal, _viewSig, TRANSIENT_DEVICE_RE, fixtureStepTarget, Runner,
|
|
6
6
|
* runCampaignPhase, deps (indirection used by tests to replace imported functions,
|
|
7
7
|
* e.g. deps.observationMatchesStatic, like monkeypatching the Python module global)
|
|
8
8
|
*
|
|
@@ -35,11 +35,14 @@ import {
|
|
|
35
35
|
} from './_py.mjs';
|
|
36
36
|
import { deviceLockPath, LOCK_GRACE_S, holderGone, myStartMs } from './device_lock.mjs';
|
|
37
37
|
import {
|
|
38
|
-
DeviceAdapter, AdapterError, atomicWriteJson, event, readJson, matching, observationKey, ruleMatches, tarProblem,
|
|
38
|
+
DeviceAdapter, AdapterError, atomicWriteJson, event, readJson, matching, observationKey, ruleMatches, rowToggle, tarProblem,
|
|
39
39
|
} from './adapters.mjs';
|
|
40
40
|
import { applyStateAnchors, observationMatchesStatic, resolvePage, occludedIndices, resolveTwinByOpener, backCanReach, uiStatesOf, normalized, isInputNode } from './semantics.mjs';
|
|
41
41
|
import { coverageMode, coveredStaticIds, scopeOf } from './coverage.mjs';
|
|
42
|
+
import { COLLAPSE_MIN_CASCADE, collapsedPrefixes, collapseNote, emptyStateComponents, emptyStateShown } from './diagnostics.mjs';
|
|
43
|
+
import { loadStringTables, deviceTextsIn } from './strings.mjs';
|
|
42
44
|
import { triggerAttests } from './attest.mjs';
|
|
45
|
+
import { fallbackScope } from './state_phase.mjs';
|
|
43
46
|
|
|
44
47
|
/** Indirection for functions tests replace (Python patches module globals). */
|
|
45
48
|
export const deps = { observationMatchesStatic, resolvePage, triggerAttests };
|
|
@@ -219,18 +222,54 @@ export function grantRuntimePermissions(device, config) {
|
|
|
219
222
|
export const TRANSIENT_DEVICE_RE = new RegExp(
|
|
220
223
|
"Can't find service|Cannot identify foreground window|device '[^']+' not found|"
|
|
221
224
|
+ 'device offline|error: closed|device-timeout|ui-dump-(?:failed|remote-missing)|Foreground changed during capture');
|
|
225
|
+
/**
|
|
226
|
+
* Route-jump failure codes (hybrid_route_cdp.mjs, carried as `hybrid-route[<code>]: ...`). DOWN codes
|
|
227
|
+
* are deterministic and settle the phase's remaining route tasks; TRANSIENT codes are retried.
|
|
228
|
+
*/
|
|
229
|
+
export const ROUTE_DOWN_CODES = new Set(['no-devtools-socket', 'uni-absent']);
|
|
230
|
+
export const ROUTE_TRANSIENT_CODES = new Set(['cdp-transient', 'adb-error', 'deadline']);
|
|
231
|
+
/** The code of a `hybrid-route[<code>]: ...` adapter error, else null. */
|
|
232
|
+
export function routeErrorCode(msg) {
|
|
233
|
+
const m = /hybrid-route\[([\w-]+)\]/.exec(String(msg));
|
|
234
|
+
return m ? m[1] : null;
|
|
235
|
+
}
|
|
236
|
+
/** The adapter's error for a foreground that moved between a capture's first and last read. */
|
|
237
|
+
const FOREGROUND_MOVED_RE = /Foreground changed during capture/;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* What a failed fixture step acted on, for its `fixture-step-failed` reason: the selector(s) of a
|
|
241
|
+
* tap, else the launch target (component / component_fqn / uri / intent action). A launch has no
|
|
242
|
+
* selector, so the reason read `launch ""` and hid which component failed (yd-weather 11-14).
|
|
243
|
+
*/
|
|
244
|
+
export function fixtureStepTarget(action) {
|
|
245
|
+
for (const k of ['selectors', 'selector', 'component', 'component_fqn', 'uri', 'action']) {
|
|
246
|
+
if (truthy(get(action, k))) { return action[k]; }
|
|
247
|
+
}
|
|
248
|
+
return '';
|
|
249
|
+
}
|
|
222
250
|
|
|
223
251
|
const isVisible = (n) => truthy(get(n, 'visible', true));
|
|
252
|
+
/** Blank waits in a row that ran out before blank frames stop being waited on (Runner.awaitContent). */
|
|
253
|
+
const BLANK_RUN_OUTS = 3;
|
|
254
|
+
/** The distinct visible texts / content descriptions of a capture (at most 200), for a revision item. */
|
|
255
|
+
const visibleTexts = (observation) => [...new Set(get(observation ?? {}, 'nodes', []).filter((n) => isVisible(n))
|
|
256
|
+
.flatMap((n) => [get(n, 'text'), get(n, 'content_desc')]).filter((t) => truthy(t)).map((t) => pyStr(t).trim())
|
|
257
|
+
.filter((t) => t.length > 0))].slice(0, 200);
|
|
224
258
|
/** A consent CheckBox's own label ("I have read and agree"), as against an optional one ("Receive push notifications"). */
|
|
225
|
-
const CONSENT_BOX_RE =
|
|
259
|
+
const CONSENT_BOX_RE = /同意|已阅读|have read|agree|accept/i; // device dialogs follow the device locale, not the build language
|
|
226
260
|
/**
|
|
227
261
|
* A consent dialog's own positive control when it is not android:id/button1 (a custom layout):
|
|
228
262
|
* the whole label is an accept ("Agree", "Agree and continue", "I agree", "Accept", "Agree", "I agree",
|
|
229
263
|
* "Accept & continue"). Anchored, so "Do not agree" / "Disagree" / "I have read and agree" never match.
|
|
230
264
|
*/
|
|
231
|
-
const CONSENT_POSITIVE_RE = /^(?:i )?(?:agree|accept)(?: and (?:continue|use|enter|start using))?$|^(?:i )?(?:agree|accept)(?:(?: and| &) (?:continue|proceed))?$/i;
|
|
265
|
+
const CONSENT_POSITIVE_RE = /^(?:我)?(?:同意|接受)(?:并(?:继续|使用|进入|开始使用))?$|^(?:i )?(?:agree|accept)(?: and (?:continue|use|enter|start using))?$|^(?:i )?(?:agree|accept)(?:(?: and| &) (?:continue|proceed))?$/i;
|
|
232
266
|
/** A label that declines or leaves: an app may put that on button1, so its id alone does not make it the accept. */
|
|
233
|
-
const CONSENT_DECLINE_RE =
|
|
267
|
+
const CONSENT_DECLINE_RE = /不同意|拒绝|退出|取消|暂不|disagree|do(?:n.t| not) agree|decline|reject|refuse|exit|quit|cancel|not now/i;
|
|
268
|
+
/**
|
|
269
|
+
* A system dialog's button that stops it coming back. It is matched against the device's own UI,
|
|
270
|
+
* whose language is the phone's, not this install's, so the Chinese labels stay.
|
|
271
|
+
*/
|
|
272
|
+
const SYSTEM_DIALOG_SUPPRESS_RE = /^(?:不再显示|不再提示|下次不再提示|don['’]?t show again|do not show again|never show again)$/i;
|
|
234
273
|
/** A toggle (CheckBox, Switch, ...): pressing it ticks, it does not accept, even when its label is "Agree". */
|
|
235
274
|
const isToggle = (n) => [true, 'true'].includes(get(n, 'checkable'))
|
|
236
275
|
|| /(?:CheckBox|Switch|RadioButton|ToggleButton|CheckedTextView)$/.test(pyStr(get(n, 'class', '')));
|
|
@@ -239,7 +278,7 @@ export const LIST_CLASS_RE = /(?:RecyclerView|ListView|GridView|WebView)$/;
|
|
|
239
278
|
/** A layout default is a short label; a longer text holding a specifier is content (a note, a log line). */
|
|
240
279
|
export const PLACEHOLDER_MAX_CHARS = 40;
|
|
241
280
|
/** A consent dialog's text (Runner.consentAccept): privacy policy / user agreement / terms. */
|
|
242
|
-
export const CONSENT_RE =
|
|
281
|
+
export const CONSENT_RE = /隐私政策|隐私协议|隐私保护|个人信息保护|用户协议|服务协议|privacy agreement|privacy protection|personal information protection|service agreement|privacy policy|terms of (?:service|use)|user agreement/i;
|
|
243
282
|
/**
|
|
244
283
|
* A text the app has not formatted yet: a java.util.Formatter / Android string-resource
|
|
245
284
|
* specifier left as-is (`%1$s`, `%2$d`, `%.1f`, a bare `%s` / `%d`). It is the layout's
|
|
@@ -292,8 +331,8 @@ const CANDIDATE_KINDS = { click_candidates: 'click', long_click_candidates: 'lon
|
|
|
292
331
|
*/
|
|
293
332
|
export const PERMISSION_ALLOW_IDS = ['permission_allow_foreground_only_button', 'permission_allow_button',
|
|
294
333
|
'permission_allow_all_button', 'permission_allow_one_time_button'];
|
|
295
|
-
const ALLOW_WORDS =
|
|
296
|
-
const DENY_WORDS =
|
|
334
|
+
const ALLOW_WORDS = /允许|allow|while using/i;
|
|
335
|
+
const DENY_WORDS = /不允许|拒绝|deny|don.t allow/i;
|
|
297
336
|
|
|
298
337
|
/**
|
|
299
338
|
* Runtime permissions the package holds, from `dumpsys package <pkg>`: the entries of its
|
|
@@ -375,9 +414,84 @@ export function navigatedAway(before, after, catalog = {}) {
|
|
|
375
414
|
return !OVERLAY_KINDS.has(kind);
|
|
376
415
|
}
|
|
377
416
|
|
|
417
|
+
/**
|
|
418
|
+
* rowGroups(nodes): containers whose children include at least 3 visible clickable rows of one class
|
|
419
|
+
* and similar height (within 25%), stacked vertically: a list the dump does not flag scrollable.
|
|
420
|
+
* Measured (coolmall 2026-11-16): a region picker sheet's LazyColumn of provinces reported no
|
|
421
|
+
* `scrollable`, so a list step there found no list at all.
|
|
422
|
+
*/
|
|
423
|
+
export function rowGroups(nodes) {
|
|
424
|
+
const kids = new Map();
|
|
425
|
+
nodes.forEach((n, i) => { const p = get(n, 'parent_index'); if (p !== null && p !== undefined) { if (!kids.has(p)) { kids.set(p, []); } kids.get(p).push(i); } });
|
|
426
|
+
const hasText = (i, d = 0) => d < 4 && (pyStr(get(nodes[i], 'text', '')).trim() !== '' || (kids.get(i) || []).some((k) => hasText(k, d + 1)));
|
|
427
|
+
const rootW = (() => { const b = get(nodes[0] || {}, 'bounds', []); return b.length === 4 ? b[2] - b[0] : 0; })();
|
|
428
|
+
const out = [];
|
|
429
|
+
for (const [p, ks] of kids) {
|
|
430
|
+
const rows = ks.map((i) => nodes[i]).filter((n) => isVisible(n) && truthy(get(n, 'clickable')) && get(n, 'bounds', []).length === 4);
|
|
431
|
+
// One or two rows (a picker level with one city): every child a full-width clickable row with
|
|
432
|
+
// text, in a container at least half the screen wide; a tab strip, a drag handle or a scrim is not.
|
|
433
|
+
const cb = get(nodes[p] || {}, 'bounds', []);
|
|
434
|
+
if (rows.length && rows.length < 3) {
|
|
435
|
+
const w = cb.length === 4 ? cb[2] - cb[0] : 0;
|
|
436
|
+
const ok = rows.length === ks.length && w > 0 && (!rootW || w >= 0.5 * rootW)
|
|
437
|
+
&& rows.every((r) => r.bounds[2] - r.bounds[0] >= 0.9 * w) && ks.every((i) => hasText(i));
|
|
438
|
+
if (ok) { out.push(p); }
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
if (rows.length < 3) { continue; }
|
|
442
|
+
const cls = pyStr(get(rows[0], 'class', ''));
|
|
443
|
+
if (!rows.every((r) => pyStr(get(r, 'class', '')) === cls)) { continue; }
|
|
444
|
+
const hs = rows.map((r) => r.bounds[3] - r.bounds[1]).sort((a, b) => a - b);
|
|
445
|
+
const tops = rows.map((r) => r.bounds[1]);
|
|
446
|
+
const stacked = tops.every((t, k) => k === 0 || t >= tops[k - 1]);
|
|
447
|
+
// the last row may be cut by the screen edge: compare the full ones
|
|
448
|
+
const full = hs.slice(Math.min(1, hs.length - 3));
|
|
449
|
+
if (stacked && full[0] >= 0.75 * full.at(-1)) { out.push(p); }
|
|
450
|
+
}
|
|
451
|
+
return out;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* sameTemplateRows(nodes, idx): true when the nodes at `idx` are one control repeated by a row
|
|
456
|
+
* template: each lies in a different child ("row") of their deepest common ancestor, every row has
|
|
457
|
+
* the same class tree (texts ignored), and the control sits at the same child path in each. A
|
|
458
|
+
* list's rows qualify; two different buttons that share a label (a tab and a row button, a toolbar
|
|
459
|
+
* and a dialog) never do. Measured (coolmall 2026-11-16): a coupon sheet's "Claim now" per coupon
|
|
460
|
+
* failed three tasks as an ambiguous selector though any row opens the same login page.
|
|
461
|
+
*/
|
|
462
|
+
export function sameTemplateRows(nodes, idx) {
|
|
463
|
+
if (idx.length < 2 || idx.some((i) => !(i >= 0 && i < nodes.length))) { return false; }
|
|
464
|
+
const parent = (i) => { const p = get(nodes[i], 'parent_index'); return p === null || p === undefined || !(p >= 0 && p < nodes.length) ? null : p; };
|
|
465
|
+
const chain = (i) => { const out = []; let c = i; const seen = new Set(); while (c !== null && !seen.has(c)) { seen.add(c); out.push(c); c = parent(c); } return out; };
|
|
466
|
+
const chains = idx.map(chain);
|
|
467
|
+
const common = chains[0].find((a) => chains.every((c) => c.includes(a)));
|
|
468
|
+
if (common === undefined || idx.includes(common)) { return false; }
|
|
469
|
+
const rows = chains.map((c) => c[c.indexOf(common) - 1]);
|
|
470
|
+
if (new Set(rows).size !== rows.length) { return false; }
|
|
471
|
+
const kids = new Map();
|
|
472
|
+
nodes.forEach((n, i) => { const p = parent(i); if (p !== null) { if (!kids.has(p)) { kids.set(p, []); } kids.get(p).push(i); } });
|
|
473
|
+
const shape = (i) => `${pyStr(get(nodes[i], 'class', ''))}(${(kids.get(i) || []).map(shape).join(',')})`;
|
|
474
|
+
const pathIn = (row, i) => { const out = []; let c = i; while (c !== row) { const p = parent(c); out.push((kids.get(p) || []).indexOf(c)); c = p; } return out.join('/'); };
|
|
475
|
+
const s0 = shape(rows[0]); const p0 = pathIn(rows[0], idx[0]);
|
|
476
|
+
return rows.every((r, k) => shape(r) === s0 && pathIn(r, idx[k]) === p0);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* writesData(text): a control label that writes to the app's backend when tapped (claim a coupon, add
|
|
481
|
+
* to cart, buy, delete, follow...). Such a control is never chosen by the runner's own loosening (a
|
|
482
|
+
* repeated row control taken by index, a list row probed) unless `config.allow_data_writes` is true.
|
|
483
|
+
* With the switch off a write is the costly mistake, so any label holding a write verb counts
|
|
484
|
+
* (「领取优惠券」「确认支付」「取消关注」「删除订单」「Add to wishlist」), except a label that names a
|
|
485
|
+
* place to go: a 「我的…」 entry or a page of records (「…记录」「…历史」「…列表」「…中心」「…明细」),
|
|
486
|
+
* which only opens a page.
|
|
487
|
+
*/
|
|
488
|
+
export const WRITE_LABEL_RE = /领取|领券|加购|加入购物车|购买|抢购|下单|提交|支付|付款|删除|收藏|关注|点赞|兑换|签到|确认收货|取消订单|^\s*\+|\b(?:add to|buy|purchase|claim|redeem|delete|remove|submit|pay|order now|place order|follow|unfollow|like|favou?rite|wishlist|subscribe)\b/i;
|
|
489
|
+
export const NAV_LABEL_RE = /^\s*我的|(?:记录|历史|列表|中心|明细|日历|规则|说明|攻略|详情|管理)\s*(?:\(\d+\))?\s*$|^\s*my\b|\b(?:history|records?|list|center|centre|details?|rules|calendar)\s*$/i;
|
|
490
|
+
export function writesData(text) { return typeof text === 'string' && WRITE_LABEL_RE.test(text) && !NAV_LABEL_RE.test(text); }
|
|
491
|
+
|
|
378
492
|
/** Failure reasons that repeat for every task replaying the same prefix in the same environment. */
|
|
379
493
|
export const PREFIX_FAILURES = ['selector-not-found-after-bounded-scroll', 'replay-target-unverified:',
|
|
380
|
-
'ambiguous selector', 'list-item:', 'Scroll requires one visible scrollable container'];
|
|
494
|
+
'ambiguous selector', 'list-item:', 'Scroll requires one visible scrollable container', 'needs-data:', 'needs-network:'];
|
|
381
495
|
|
|
382
496
|
/** Key of a task's launch plus its first `n` replay steps. */
|
|
383
497
|
export function prefixKey(task, n) {
|
|
@@ -504,6 +618,27 @@ export class Runner {
|
|
|
504
618
|
* an upper layer paints over (the host page under a full-screen fragment) is not this page's.
|
|
505
619
|
* a2h-batch-ui-align export_ui_info.mjs placeholderTexts applies the same test to the export.
|
|
506
620
|
*/
|
|
621
|
+
/**
|
|
622
|
+
* A capture of the app under test with nothing on it yet: its own visible nodes carry no text,
|
|
623
|
+
* no content description and none is clickable. A tap that opens a page captures the frame
|
|
624
|
+
* between the two (the old page gone, the new one not yet laid out), and such a frame resolves
|
|
625
|
+
* to no page, so looksLoading (verified pages only) never waited on it. Measured (coolmall
|
|
626
|
+
* 2026-11-18): every goods-list row tap captured a 38-node frame of bare Views and the list probe
|
|
627
|
+
* judged at once that no row opened the goods page; the same tap followed by a 4 s wait landed
|
|
628
|
+
* on it. Another app's foreground (a launcher, a system dialog) is not this.
|
|
629
|
+
*/
|
|
630
|
+
looksBlank(observation) {
|
|
631
|
+
const pkg = get(this.config, 'package');
|
|
632
|
+
if (!truthy(pkg) || get(observation, 'package') !== pkg) { return false; }
|
|
633
|
+
const own = get(observation, 'nodes', []).filter((n) => isVisible(n) && get(n, 'package', pkg) === pkg);
|
|
634
|
+
const blank = !own.some((n) => truthy(get(n, 'clickable')) || pyStr(get(n, 'text', '') ?? '').trim()
|
|
635
|
+
|| pyStr(get(n, 'content_desc', '') ?? '').trim());
|
|
636
|
+
// Only for an app that has shown a labelled screen: one whose tree never carries text (a canvas
|
|
637
|
+
// or a Flutter app without semantics) is blank on every capture and would pay the wait on each.
|
|
638
|
+
if (!blank) { this._appShowedText = true; return false; }
|
|
639
|
+
return this._appShowedText === true;
|
|
640
|
+
}
|
|
641
|
+
|
|
507
642
|
looksLoading(observation) {
|
|
508
643
|
const resolution = get(observation, 'static_resolution', {});
|
|
509
644
|
if (get(resolution, 'status') !== 'verified') { return false; }
|
|
@@ -563,7 +698,9 @@ export class Runner {
|
|
|
563
698
|
if (resolution.status === 'verified') {
|
|
564
699
|
Object.assign(observation.identity, { family: resolution.static_id, status: 'verified', basis: resolution.anchors, reason: resolution.reason });
|
|
565
700
|
}
|
|
566
|
-
if (
|
|
701
|
+
if (resolution.status === 'verified') { this._lastVerified = resolution.static_id; }
|
|
702
|
+
if (this.looksBlank(observation)) { Object.assign(observation, { loading: true, blank: true }); }
|
|
703
|
+
else if (this.looksLoading(observation)) { observation.loading = true; }
|
|
567
704
|
// Seen loaded: its loading passes, so a wait that ran out there was a slow load (awaitContent).
|
|
568
705
|
// Only the first run-out is forgiven: a page that runs out again after that flips between
|
|
569
706
|
// a loading-looking and a loaded view (a spinner a scroll hides) and keeps its zero wait.
|
|
@@ -614,17 +751,28 @@ export class Runner {
|
|
|
614
751
|
* page stays (an empty state, a sparse screen, a spinner or a literal `%s` that never goes), and
|
|
615
752
|
* every later action landing on it would pay the full wait. A page seen loaded since loads
|
|
616
753
|
* slowly rather than never (a slow first fetch), so its next visit waits again.
|
|
754
|
+
* A blank frame that resolves to no page (looksBlank) waits `blank_wait_seconds` (default 6):
|
|
755
|
+
* with no page to remember it by, one that stayed blank must not cut the wait of the next,
|
|
756
|
+
* unrelated transition. Once BLANK_RUN_OUTS blank waits in a row have run out from one origin (the
|
|
757
|
+
* Activity and the last page verified before the frame), blank frames there are how that screen
|
|
758
|
+
* looks (an image viewer, a canvas) and are no longer waited on; other origins still wait.
|
|
617
759
|
*/
|
|
618
760
|
awaitContent(observation) {
|
|
619
761
|
let current = observation;
|
|
620
762
|
if (!current || !current.loading) { return current; }
|
|
621
763
|
const stuck = (this._loadingStuck ??= new Set());
|
|
622
764
|
const sid = () => get(get(current, 'static_resolution', {}), 'static_id');
|
|
623
|
-
const
|
|
765
|
+
const blankOnly = truthy(current.blank) && !truthy(sid());
|
|
766
|
+
const runOuts = (this._blankRunOuts ??= new Map());
|
|
767
|
+
// counted per transition origin: the Activity and the last page verified before the blank frame
|
|
768
|
+
const origin = `${pyStr(get(current, 'activity', ''))}|${pyStr(this._lastVerified ?? '')}`;
|
|
769
|
+
const wait = blankOnly ? ((runOuts.get(origin) ?? 0) >= BLANK_RUN_OUTS ? 0 : toFloat(get(this.config, 'blank_wait_seconds', 6)))
|
|
770
|
+
: stuck.has(sid()) ? 0 : toFloat(get(this.config, 'content_wait_seconds', 10));
|
|
624
771
|
const deadline = monotonic() + Math.max(0, wait);
|
|
625
772
|
while (current.loading && monotonic() < deadline) { sleep(0.5); current = this.capture(); }
|
|
773
|
+
if (blankOnly && wait > 0) { runOuts.set(origin, truthy(current.blank) ? (runOuts.get(origin) ?? 0) + 1 : 0); }
|
|
626
774
|
if (current.loading) {
|
|
627
|
-
if (wait > 0) { stuck.add(sid()); }
|
|
775
|
+
if (wait > 0 && truthy(sid())) { stuck.add(sid()); }
|
|
628
776
|
this.mapCapture(current);
|
|
629
777
|
}
|
|
630
778
|
return current;
|
|
@@ -638,12 +786,13 @@ export class Runner {
|
|
|
638
786
|
get(n, 'package') === pkg && isVisible(n) && truthy(get(n, 'clickable')));
|
|
639
787
|
}
|
|
640
788
|
|
|
641
|
-
atom(action, taskId, purpose) {
|
|
789
|
+
atom(action, taskId, purpose, { restoring: inRestore = false } = {}) {
|
|
642
790
|
const lifetime = this.doc.events.filter((e) => e.kind === 'attempt_started' && truthy(get(e.payload, 'atomic'))).length;
|
|
643
791
|
// A phase's cleanup runs after its budget is spent by design: restoring the
|
|
644
792
|
// environment never counts against it (measured: a recD phase that used its whole
|
|
645
793
|
// budget then threw from its cleanup, which run_cycle took as a fatal stage error).
|
|
646
|
-
|
|
794
|
+
// `inRestore`: a dismissal made on behalf of a restore (cleanup's launch met a dialog) shares its exemption.
|
|
795
|
+
const restoring = (purpose === 'restore' || inRestore) && lifetime < toInt(get(this.config, 'max_campaign_actions', 1800));
|
|
647
796
|
if (!restoring && (this.used >= this.args.budget || lifetime >= toInt(get(this.config, 'max_campaign_actions', 1800)) || monotonic() >= this.deadline)) {
|
|
648
797
|
throw new BudgetExhausted('atomic-action/time budget exhausted');
|
|
649
798
|
}
|
|
@@ -654,19 +803,22 @@ export class Runner {
|
|
|
654
803
|
const started = this.emit('attempt_started', { task_id: taskId, atomic: true, purpose, action, before: before.observation_id });
|
|
655
804
|
this.device.act(action, before);
|
|
656
805
|
this.device.settle();
|
|
657
|
-
|
|
658
|
-
|
|
806
|
+
const isLaunch = get(action, 'type') === 'launch';
|
|
807
|
+
// One budget per launch atom for captures the launch's own foreground moves spoil (launchCapture).
|
|
808
|
+
const moves = isLaunch ? { left: Math.max(0, toInt(get(this.config, 'launch_transition_captures', 3))) } : null;
|
|
809
|
+
let after = isLaunch ? this.launchCapture(taskId, moves) : this.capture();
|
|
810
|
+
if (isLaunch) {
|
|
659
811
|
this.dirty = false;
|
|
660
812
|
const waitS = Math.max(0.0, toFloat(get(this.config, 'launch_ready_seconds', 8)));
|
|
661
813
|
let deadline = monotonic() + waitS;
|
|
662
|
-
|
|
814
|
+
after = this.waitAppUi(deadline, taskId, after, purpose, moves);
|
|
663
815
|
for (let k = 0; k < toInt(get(this.config, 'launch_retries', 1)); k++) {
|
|
664
816
|
if (this.appUiReady()) { break; }
|
|
665
817
|
this.device.act(action, after);
|
|
666
818
|
this.device.settle();
|
|
667
819
|
deadline = monotonic() + waitS;
|
|
668
|
-
after = this.
|
|
669
|
-
|
|
820
|
+
after = this.launchCapture(taskId, moves);
|
|
821
|
+
after = this.waitAppUi(deadline, taskId, after, purpose, moves);
|
|
670
822
|
}
|
|
671
823
|
if (!this.appUiReady()) { throw new AdapterError('launch-ui-not-ready'); }
|
|
672
824
|
}
|
|
@@ -680,9 +832,26 @@ export class Runner {
|
|
|
680
832
|
before: before.observation_id, after: after.observation_id, action });
|
|
681
833
|
}
|
|
682
834
|
|
|
683
|
-
choose(action) {
|
|
835
|
+
choose(action, { alternates = true } = {}) {
|
|
684
836
|
const isCand = Object.hasOwn(CANDIDATE_KINDS, get(action, 'type'));
|
|
685
837
|
const candidates = isCand ? get(action, 'selectors', []) : [get(action, 'selector', {})];
|
|
838
|
+
const found = this._choose(action, isCand, candidates);
|
|
839
|
+
if (found || !alternates) { return found; }
|
|
840
|
+
// No candidate on screen: the same resources' other values (textAlternatesOf), as extra candidates.
|
|
841
|
+
const extra = [];
|
|
842
|
+
for (const s of candidates) {
|
|
843
|
+
for (const k of ['text', 'content_desc']) {
|
|
844
|
+
if (typeof get(s, k) !== 'string') { continue; }
|
|
845
|
+
for (const alt of this.textAlternatesOf(s[k])) {
|
|
846
|
+
const sel = { ...s, [k]: alt };
|
|
847
|
+
if (!extra.some((x) => jsonDumps(x, { sort_keys: true }) === jsonDumps(sel, { sort_keys: true }))) { extra.push(sel); }
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return extra.length ? this._choose(action, isCand, extra) : found;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
_choose(action, isCand, candidates) {
|
|
686
855
|
let ambiguous = false;
|
|
687
856
|
const hidden = occludedIndices(this.current.nodes);
|
|
688
857
|
const live = this.current.nodes.map((n, i) => (!hidden.has(i) ? n : { visible: false }));
|
|
@@ -699,6 +868,26 @@ export class Runner {
|
|
|
699
868
|
if (hits.length > 1) {
|
|
700
869
|
const scoped = { ...selector, actionable: true };
|
|
701
870
|
if (matching(live, scoped).length === 1) { return { type: kindOf(), selector: scoped }; }
|
|
871
|
+
// The same control in every row of one list (a "Claim now" per coupon): any row's opens the
|
|
872
|
+
// same page, so the first is taken by its index, never by coordinates (sameTemplateRows).
|
|
873
|
+
// Not a control that writes data (a coupon's claim, a row's add-to-cart) unless writes are allowed.
|
|
874
|
+
const writes = [selector.text, selector.content_desc, ...hits.flatMap((h) => [get(h, 'text'), get(h, 'content_desc')])].some(writesData);
|
|
875
|
+
if (!Object.hasOwn(selector, 'index') && (!writes || get(this.config, 'allow_data_writes') === true)
|
|
876
|
+
&& sameTemplateRows(this.current.nodes, hits.map((h) => live.indexOf(h)))) {
|
|
877
|
+
return { type: kindOf(), selector: { ...selector, index: 0 } };
|
|
878
|
+
}
|
|
879
|
+
// A record's own text (a seeding recipe's state label, `record_label`): records are listed in
|
|
880
|
+
// a vertical list, so a match inside a horizontal strip (a filter tab of the same words) is
|
|
881
|
+
// not it. One left: taken by its index among the matches, top-down like `matching`.
|
|
882
|
+
if (truthy(get(action, 'record_label')) && !Object.hasOwn(selector, 'index')) {
|
|
883
|
+
const inStrip = (n) => { let p = get(n, 'parent_index'); for (let d = 0; d < 12 && p !== null && p !== undefined && p >= 0; d++) {
|
|
884
|
+
const a = this.current.nodes[p]; if (truthy(get(a, 'scrollable')) && _isHorizontal(a)) { return true; } p = get(a, 'parent_index'); } return false; };
|
|
885
|
+
const keep = hits.filter((h) => !inStrip(h));
|
|
886
|
+
if (keep.length === 1) {
|
|
887
|
+
const ordered = sortedBy(matching(live, selector), (n) => { const b = get(n, 'bounds', [0, 0]); return [b[1], b[0]]; });
|
|
888
|
+
return { type: kindOf(), selector: { ...selector, index: ordered.indexOf(keep[0]) } };
|
|
889
|
+
}
|
|
890
|
+
}
|
|
702
891
|
}
|
|
703
892
|
ambiguous = ambiguous || hits.length > 1;
|
|
704
893
|
}
|
|
@@ -706,6 +895,107 @@ export class Runner {
|
|
|
706
895
|
return permissionGrant(live, candidates, kindOf());
|
|
707
896
|
}
|
|
708
897
|
|
|
898
|
+
/**
|
|
899
|
+
* Several lists hold rows and the step names the page a row opens (`target_id`): tap the first row
|
|
900
|
+
* of each, most rows first, until one lands on that page; Back after a row that opened another.
|
|
901
|
+
* At most `max_list_probes` (default 3) lists. Measured (coolmall 2026-11-16): the home page's
|
|
902
|
+
* flash-sale row, category strip and goods grid failed three tasks with "expected one list,
|
|
903
|
+
* found 3" although every goods list opened the same detail page. The landing page is checked
|
|
904
|
+
* by its own identity, so a wrong list is never taken for the right one.
|
|
905
|
+
*/
|
|
906
|
+
probeLists(target, tapRow, taskId) {
|
|
907
|
+
const lists = this.listCandidates();
|
|
908
|
+
const before = this.current;
|
|
909
|
+
const origin = get(get(before, 'static_resolution', {}), 'status') === 'verified' ? before.static_resolution.static_id : null;
|
|
910
|
+
let last = null;
|
|
911
|
+
for (let [k, [, row]] of lists.slice(0, Math.max(1, toInt(get(this.config, 'max_list_probes', 3)))).entries()) {
|
|
912
|
+
if (k > 0) {
|
|
913
|
+
if (origin === null) { throw new AdapterError('list-item: the probing page is unverified, so a return to it cannot be checked'); }
|
|
914
|
+
// Back only when the last row left the page: a row that stays (a category chip switching a tab) must not exit it.
|
|
915
|
+
if (!this.at(origin)) { this.atom({ type: 'back' }, taskId, 'list-probe-back'); }
|
|
916
|
+
if (!this.at(origin)) { throw new AdapterError(`list-item: could not return to ${origin} after probing a list`); }
|
|
917
|
+
row = this.listCandidates()[k]?.[1] ?? row;
|
|
918
|
+
}
|
|
919
|
+
last = tapRow(row);
|
|
920
|
+
if (this.at(target)) {
|
|
921
|
+
if (typeof this.emit === 'function') { this.emit('list_probe', { task_id: taskId, target, chosen: k, lists: lists.length }); }
|
|
922
|
+
return last;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
throw new AdapterError(`list-item: none of ${lists.length} lists opened ${target}`);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* [listIndex, firstActionableRow] of every visible list holding rows, most rows first, then top-down.
|
|
930
|
+
* Nested scrollables that offer the same first row are one list (a page container around its grid).
|
|
931
|
+
*/
|
|
932
|
+
listCandidates() {
|
|
933
|
+
const out = [];
|
|
934
|
+
for (const li of this._listContainers()) {
|
|
935
|
+
const rows = this._rowsOf(li);
|
|
936
|
+
if (rows.length) { out.push([li, sortedBy(rows, (n) => [n.bounds[1], n.bounds[0]])[0], rows.length]); }
|
|
937
|
+
}
|
|
938
|
+
const seen = new Set();
|
|
939
|
+
return sortedBy(out, (x) => [-x[2], x[1].bounds[1], x[1].bounds[0]])
|
|
940
|
+
.filter(([, r]) => { const k = JSON.stringify(r.bounds); if (seen.has(k)) { return false; } seen.add(k); return true; })
|
|
941
|
+
.map(([li, r]) => [li, r]);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
_listContainers() {
|
|
945
|
+
const nodes = this.current.nodes;
|
|
946
|
+
const adapterCls = ['RecyclerView', 'ListView', 'GridView'];
|
|
947
|
+
const hasKids = new Set(nodes.map((c) => get(c, 'parent_index')));
|
|
948
|
+
const lists = [];
|
|
949
|
+
nodes.forEach((n, i) => { if (isVisible(n) && adapterCls.some((c) => pyStr(get(n, 'class', '')).endsWith(c)) && hasKids.has(i)) { lists.push(i); } });
|
|
950
|
+
if (lists.length === 1) { return lists; }
|
|
951
|
+
const scrollables = [];
|
|
952
|
+
nodes.forEach((n, i) => { if (truthy(get(n, 'scrollable')) && isVisible(n)) { scrollables.push(i); } });
|
|
953
|
+
return scrollables.length ? scrollables : rowGroups(nodes);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
_rowsOf(li) {
|
|
957
|
+
const nodes = this.current.nodes;
|
|
958
|
+
const kidsOf = (i) => nodes.map((n, j) => [n, j]).filter(([n]) => get(n, 'parent_index') === i).map(([, j]) => j);
|
|
959
|
+
// a row's own button that writes data (「领取」「加购」) is never the row to probe, unless writes are allowed.
|
|
960
|
+
// A control's label is its own text, else the texts below it (up to 4 levels, not inside another
|
|
961
|
+
// clickable, which is a control of its own): a button labelled by a nested text is a writer when
|
|
962
|
+
// every such text is; a card holding a title, a price and a 「加购」 is not.
|
|
963
|
+
const allowWrites = get(this.config, 'allow_data_writes') === true;
|
|
964
|
+
const textsOf = (k) => [get(nodes[k], 'text'), get(nodes[k], 'content_desc')].filter((t) => typeof t === 'string' && t.trim());
|
|
965
|
+
const labelsOf = (j) => {
|
|
966
|
+
const own = textsOf(j);
|
|
967
|
+
if (own.length) { return own; }
|
|
968
|
+
const out = []; let level = kidsOf(j);
|
|
969
|
+
for (let d = 0; d < 4 && level.length; d++) {
|
|
970
|
+
const next = [];
|
|
971
|
+
for (const k of level) {
|
|
972
|
+
if (truthy(get(nodes[k], 'clickable')) || truthy(get(nodes[k], 'long-clickable'))) { continue; }
|
|
973
|
+
out.push(...textsOf(k)); next.push(...kidsOf(k));
|
|
974
|
+
}
|
|
975
|
+
level = next;
|
|
976
|
+
}
|
|
977
|
+
return out;
|
|
978
|
+
};
|
|
979
|
+
const writer = (j) => {
|
|
980
|
+
if (allowWrites || !(truthy(get(nodes[j], 'clickable')) || truthy(get(nodes[j], 'long-clickable')))) { return false; }
|
|
981
|
+
const ls = labelsOf(j);
|
|
982
|
+
return ls.length > 0 && ls.every(writesData);
|
|
983
|
+
};
|
|
984
|
+
const actionableRow = (ci) => {
|
|
985
|
+
const cands = [ci, ...kidsOf(ci)];
|
|
986
|
+
for (const c of kidsOf(ci)) { cands.push(...kidsOf(c)); }
|
|
987
|
+
for (const j of cands) {
|
|
988
|
+
const n = nodes[j];
|
|
989
|
+
if (j !== ci && writer(j)) { continue; }
|
|
990
|
+
if ((truthy(get(n, 'clickable')) || truthy(get(n, 'long-clickable'))) && isVisible(n)
|
|
991
|
+
&& !['ImageButton', 'FloatingActionButton'].some((c) => pyStr(get(n, 'class', '')).endsWith(c))
|
|
992
|
+
&& get(n, 'bounds', []).length === 4 && n.bounds[3] > n.bounds[1]) { return n; }
|
|
993
|
+
}
|
|
994
|
+
return null;
|
|
995
|
+
};
|
|
996
|
+
return kidsOf(li).map(actionableRow).filter((r) => truthy(r));
|
|
997
|
+
}
|
|
998
|
+
|
|
709
999
|
listItem() {
|
|
710
1000
|
const nodes = this.current.nodes;
|
|
711
1001
|
const adapterCls = ['RecyclerView', 'ListView', 'GridView'];
|
|
@@ -716,6 +1006,7 @@ export class Runner {
|
|
|
716
1006
|
lists = [];
|
|
717
1007
|
nodes.forEach((n, i) => { if (truthy(get(n, 'scrollable')) && isVisible(n)) { lists.push(i); } });
|
|
718
1008
|
}
|
|
1009
|
+
if (!lists.length) { lists = rowGroups(nodes); }
|
|
719
1010
|
const idxOf = (n) => nodes.findIndex((m) => pyEq(m, n)); // list.index uses ==
|
|
720
1011
|
const actionableRow = (child) => {
|
|
721
1012
|
const cands = [child, ...nodes.filter((n) => get(n, 'parent_index') === idxOf(child))];
|
|
@@ -829,7 +1120,7 @@ export class Runner {
|
|
|
829
1120
|
* required boxes, then the accept), up to `limit` ticks.
|
|
830
1121
|
* Each dismissal is an `interruption` event. Returns true when something was dismissed.
|
|
831
1122
|
*/
|
|
832
|
-
clearInterruption(taskId) {
|
|
1123
|
+
clearInterruption(taskId, { restoring = false } = {}) {
|
|
833
1124
|
const limit = toInt(get(this.config, 'max_interruption_dismissals', 2));
|
|
834
1125
|
let dismissed = false;
|
|
835
1126
|
let ticks = 0;
|
|
@@ -848,23 +1139,101 @@ export class Runner {
|
|
|
848
1139
|
texts: texts.slice(0, 6).map((t) => cpSlice(pyStr(t), 0, 80)), outcome: 'unresolved' });
|
|
849
1140
|
break;
|
|
850
1141
|
}
|
|
851
|
-
|
|
852
|
-
|
|
1142
|
+
const system = !rule && !consent ? this.systemDialogAction() : null;
|
|
1143
|
+
let action = rule ? rule.action : (consent ?? system ?? { type: 'back' });
|
|
1144
|
+
if (!rule && !consent && !system && k > 0 && matching(this.current.nodes, { resource_name: 'button2' }).length === 1) {
|
|
853
1145
|
action = { type: 'click', selector: { resource_name: 'button2' } };
|
|
854
1146
|
}
|
|
855
1147
|
const tick = consent !== null && isToggle(matching(this.current.nodes, consent.selector)[0] ?? {});
|
|
856
|
-
const result = this.atom(action, taskId, 'dismiss-interruption');
|
|
1148
|
+
const result = this.atom(action, taskId, 'dismiss-interruption', { restoring });
|
|
857
1149
|
this.emit('interruption', { task_id: taskId, observation_id: before, bounds, action,
|
|
858
|
-
rule: rule ? get(rule, 'id', null) : (consent ? 'consent-default' :
|
|
1150
|
+
rule: rule ? get(rule, 'id', null) : (consent ? 'consent-default' : (system ? 'system-dialog-default' : null)),
|
|
1151
|
+
texts: texts.slice(0, 6).map((t) => cpSlice(pyStr(t), 0, 80)),
|
|
859
1152
|
outcome: result.payload.outcome });
|
|
860
1153
|
// A rule or a consent click that did nothing would do nothing again; Back/button2 would leave.
|
|
861
|
-
if (result.payload.outcome === 'no_effect' && (rule || consent)) { break; }
|
|
1154
|
+
if (result.payload.outcome === 'no_effect' && (rule || consent || system)) { break; }
|
|
862
1155
|
if (tick && ticks < limit) { ticks += 1; }
|
|
863
1156
|
dismissed = dismissed || result.payload.outcome === 'succeeded';
|
|
864
1157
|
}
|
|
865
1158
|
return dismissed;
|
|
866
1159
|
}
|
|
867
1160
|
|
|
1161
|
+
/**
|
|
1162
|
+
* Whether the app under test is the resumed activity but a system window (package `android`:
|
|
1163
|
+
* the 16 KB page-size compatibility dialog, a "keeps stopping" dialog) is what the dump shows.
|
|
1164
|
+
* Measured (jingmo 2026-11-16): on an x86_64 emulator the 「Android 应用兼容性」 dialog covered
|
|
1165
|
+
* MainActivity after every launch; appUiReady never held, so each launch re-captured for
|
|
1166
|
+
* launch_ready_seconds, relaunched, waited again and threw launch-ui-not-ready: every task
|
|
1167
|
+
* aborted and covered stayed 0. The activity (and `component_package`) still name the app.
|
|
1168
|
+
*/
|
|
1169
|
+
coveredBySystemDialog() {
|
|
1170
|
+
const pkg = get(this.config, 'package');
|
|
1171
|
+
const cur = or(this.current, {});
|
|
1172
|
+
const shown = get(cur, 'package');
|
|
1173
|
+
if (!truthy(pkg) || !truthy(shown) || shown === pkg) { return false; }
|
|
1174
|
+
return get(cur, 'component_package') === pkg || pyStr(or(get(cur, 'activity'), '')).startsWith(pkg + '.');
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* The click that closes a system dialog over the app for good: its positive button
|
|
1179
|
+
* (android:id/button1) when it is labelled 「不再显示」 / "Don't show again", so the dialog does
|
|
1180
|
+
* not return on the next relaunch. Any other system dialog keeps the generic dismissal (Back).
|
|
1181
|
+
* Returns the click action, or null.
|
|
1182
|
+
*/
|
|
1183
|
+
systemDialogAction() {
|
|
1184
|
+
if (!this.coveredBySystemDialog()) { return null; }
|
|
1185
|
+
const hits = matching(get(this.current, 'nodes', []), { resource_id: 'android:id/button1' });
|
|
1186
|
+
if (hits.length !== 1) { return null; }
|
|
1187
|
+
const label = normalized(or(get(hits[0], 'text'), get(hits[0], 'content_desc'), ''));
|
|
1188
|
+
return SYSTEM_DIALOG_SUPPRESS_RE.test(label) ? { type: 'click', selector: { resource_id: 'android:id/button1' } } : null;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* Wait for the app's own UI after a launch until `deadline`. A system dialog over the app
|
|
1193
|
+
* (coveredBySystemDialog) is dismissed instead of waited out, at most `max_interruption_dismissals`
|
|
1194
|
+
* times per wait: a dialog that returns at once (no 「不再显示」 to silence it) would otherwise spend
|
|
1195
|
+
* the action budget until the deadline. After that the wait only polls. A launch made by a
|
|
1196
|
+
* restore (`purpose`) keeps its budget exemption for the dismissals. Returns the latest observation.
|
|
1197
|
+
*/
|
|
1198
|
+
waitAppUi(deadline, taskId, after, purpose = null, moves = null) {
|
|
1199
|
+
const cap = toInt(get(this.config, 'max_interruption_dismissals', 2));
|
|
1200
|
+
const restoring = purpose === 'restore';
|
|
1201
|
+
let cleared = 0;
|
|
1202
|
+
while (!this.appUiReady() && monotonic() < deadline) {
|
|
1203
|
+
// Every attempt counts toward the cap, not only a successful one: a dialog that ignores Back
|
|
1204
|
+
// and button2 would otherwise be pressed on every poll, spend the action budget, and the
|
|
1205
|
+
// press landing just after it closes could leave the app.
|
|
1206
|
+
if (cleared < cap && this.coveredBySystemDialog()) {
|
|
1207
|
+
cleared += 1;
|
|
1208
|
+
if (this.clearInterruption(taskId, { restoring })) { after = this.current; continue; }
|
|
1209
|
+
}
|
|
1210
|
+
sleep(0.5);
|
|
1211
|
+
after = moves ? this.launchCapture(taskId, moves) : this.capture();
|
|
1212
|
+
}
|
|
1213
|
+
return after;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* capture() while a launch brings its UI up. The foreground moves there by design: the
|
|
1218
|
+
* starting window gives way to the activity, a SplashActivity hands over to the main one. A
|
|
1219
|
+
* capture that straddles such a move throws `Foreground changed during capture`; under a launch
|
|
1220
|
+
* it is retried, spending `moves.left` (launch_transition_captures, default 3, one budget per
|
|
1221
|
+
* launch atom). The budget is a count, not a time: on a slow device one capture outlasts the
|
|
1222
|
+
* whole launch_ready_seconds wait (measured yd-weather 11-14: ~30 s per capture, 8 s wait), so a
|
|
1223
|
+
* deadline would stop the retry before it ran. Any other error, or a move once the budget is
|
|
1224
|
+
* spent, is thrown as before. Each retry emits `launch_foreground_moved`.
|
|
1225
|
+
*/
|
|
1226
|
+
launchCapture(taskId, moves) {
|
|
1227
|
+
for (;;) {
|
|
1228
|
+
try { return this.capture(); } catch (e) {
|
|
1229
|
+
if (!(e instanceof AdapterError) || !FOREGROUND_MOVED_RE.test(errStr(e)) || moves.left <= 0) { throw e; }
|
|
1230
|
+
moves.left -= 1;
|
|
1231
|
+
this.emit('launch_foreground_moved', { task_id: taskId, retries_left: moves.left, reason: s200(e) });
|
|
1232
|
+
sleep(0.5);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
868
1237
|
/**
|
|
869
1238
|
* The app's own first-launch consent dialog (privacy policy / user agreement): Back closes the
|
|
870
1239
|
* Activity and its negative button is "decline and exit", so the generic dismissal leaves the
|
|
@@ -1068,17 +1437,31 @@ export class Runner {
|
|
|
1068
1437
|
if (others.length) { payload.unswept_containers = others; }
|
|
1069
1438
|
const maxScrolls = toInt(get(this.config, 'max_sweep_scrolls', 20));
|
|
1070
1439
|
let lastSig = _viewSig(origin);
|
|
1071
|
-
let outcome = 'truncated'; let swipes = 0;
|
|
1440
|
+
let outcome = 'truncated'; let swipes = 0; let effective = 0;
|
|
1072
1441
|
try {
|
|
1073
1442
|
while (swipes <= maxScrolls) {
|
|
1074
1443
|
this.atom({ type: 'scroll', selector, direction: 'down' }, taskId, purpose);
|
|
1075
1444
|
swipes += 1;
|
|
1076
|
-
|
|
1077
|
-
if (still === null) {
|
|
1445
|
+
let still = this._surfaceSelector(origin, selector, node);
|
|
1446
|
+
if (still === null) {
|
|
1447
|
+
// A lazy list can change its node count / indices during the swipe without the page
|
|
1448
|
+
// being left. Re-observe once and resolve the container again before declaring an exit.
|
|
1449
|
+
sleep(0.5);
|
|
1450
|
+
try { this.capture({ acceptLoading: true }); } catch { /* keep the last observation */ }
|
|
1451
|
+
still = this._surfaceSelector(origin, selector, node);
|
|
1452
|
+
if (still === null) { outcome = 'aborted'; payload.abort_reason = 'left-page'; break; }
|
|
1453
|
+
}
|
|
1078
1454
|
selector = still;
|
|
1079
1455
|
const sig = _viewSig(this.current);
|
|
1080
|
-
if (sig === lastSig) {
|
|
1081
|
-
|
|
1456
|
+
if (sig === lastSig) {
|
|
1457
|
+
// No movement: either the page end (after a real scroll) or a container that never
|
|
1458
|
+
// moved. `complete` with 0 frames used to claim the page end and hid every below-fold
|
|
1459
|
+
// section; keep the two apart.
|
|
1460
|
+
outcome = effective > 0 ? 'complete' : 'no-effect';
|
|
1461
|
+
break;
|
|
1462
|
+
}
|
|
1463
|
+
effective += 1;
|
|
1464
|
+
if (payload.frames.length >= maxScrolls) { outcome = 'truncated'; break; }
|
|
1082
1465
|
lastSig = sig;
|
|
1083
1466
|
payload.frames.push(this.current.observation_id);
|
|
1084
1467
|
const r = get(this.current, 'static_resolution', {});
|
|
@@ -1093,6 +1476,7 @@ export class Runner {
|
|
|
1093
1476
|
}
|
|
1094
1477
|
payload.outcome = outcome;
|
|
1095
1478
|
payload.swipes = swipes;
|
|
1479
|
+
payload.effective = effective;
|
|
1096
1480
|
if (outcome !== 'aborted' || get(payload, 'abort_reason') !== 'left-page') {
|
|
1097
1481
|
payload.restored = this._sweepRestore(origin, selector, node, taskId);
|
|
1098
1482
|
} else { payload.restored = false; }
|
|
@@ -1210,12 +1594,27 @@ export class Runner {
|
|
|
1210
1594
|
}
|
|
1211
1595
|
const type = get(action, 'type');
|
|
1212
1596
|
if (type === 'click_list_item' || type === 'long_click_list_item') {
|
|
1213
|
-
const row = this.listItem();
|
|
1214
|
-
const b = row.bounds;
|
|
1215
1597
|
const kind = type.startsWith('long') ? 'long_click_point' : 'click_point';
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
|
|
1598
|
+
const tapRow = (row) => {
|
|
1599
|
+
const b = row.bounds; const rowInfo = {};
|
|
1600
|
+
for (const k of ['class', 'resource_id', 'text', 'content_desc', 'bounds']) { rowInfo[k] = get(row, k); }
|
|
1601
|
+
return this.atom({ type: kind, x: Math.floor((b[0] + b[2]) / 2), y: Math.floor((b[1] + b[3]) / 2), row: rowInfo }, taskId, purpose);
|
|
1602
|
+
};
|
|
1603
|
+
// Rows filled from the network or a database arrive after the page itself (measured, coolmall:
|
|
1604
|
+
// the home page's goods were not yet in the tree when the step ran): wait, bounded, for a row.
|
|
1605
|
+
const until = monotonic() + Math.max(0, toFloat(get(this.config, 'list_wait_seconds', 6)));
|
|
1606
|
+
while (!this.listCandidates().length && !this.emptyFailure() && monotonic() < until) { sleep(0.5); this.capture({ acceptLoading: true }); }
|
|
1607
|
+
let row;
|
|
1608
|
+
try { row = this.listItem(); } catch (e) {
|
|
1609
|
+
if (!(e instanceof AdapterError)) { throw e; }
|
|
1610
|
+
const empty = this.emptyFailure();
|
|
1611
|
+
if (empty) { throw empty; }
|
|
1612
|
+
if (/^list-item: expected one list, found (?:[2-9]|\d{2,})/.test(errStr(e)) && truthy(get(action, 'target_id'))) {
|
|
1613
|
+
return this.probeLists(action.target_id, tapRow, taskId);
|
|
1614
|
+
}
|
|
1615
|
+
throw e;
|
|
1616
|
+
}
|
|
1617
|
+
return tapRow(row);
|
|
1219
1618
|
}
|
|
1220
1619
|
if (type === 'scroll_page') {
|
|
1221
1620
|
const sideways = ['left', 'right'].includes(get(action, 'direction'));
|
|
@@ -1223,6 +1622,15 @@ export class Runner {
|
|
|
1223
1622
|
if (conts.length !== 1) { throw new AdapterError('Scroll requires one visible scrollable container'); }
|
|
1224
1623
|
return this.atom({ type: 'scroll', selector: scrollSel(conts[0], this.current.nodes), direction: get(action, 'direction', 'down') }, taskId, purpose);
|
|
1225
1624
|
}
|
|
1625
|
+
if (type === 'toggle_on') {
|
|
1626
|
+
// the two-state control in the row titled `label`: tapped only when it is off
|
|
1627
|
+
const i = rowToggle(this.current.nodes, get(action, 'label'));
|
|
1628
|
+
if (i === null) { throw new AdapterError(`toggle: no single two-state control in the row "${pyStr(get(action, 'label'))}"`); }
|
|
1629
|
+
const n = this.current.nodes[i];
|
|
1630
|
+
if (truthy(get(n, 'checked'))) { return null; }
|
|
1631
|
+
const b = n.bounds;
|
|
1632
|
+
return this.atom({ type: 'click_point', x: Math.floor((b[0] + b[2]) / 2), y: Math.floor((b[1] + b[3]) / 2), row: { class: get(n, 'class'), bounds: b } }, taskId, purpose);
|
|
1633
|
+
}
|
|
1226
1634
|
if (!Object.hasOwn(CANDIDATE_KINDS, type)) { return this.atom(action, taskId, purpose); }
|
|
1227
1635
|
let selected = this.choose(action);
|
|
1228
1636
|
if (selected) { return this.atom(selected, taskId, purpose); }
|
|
@@ -1230,6 +1638,17 @@ export class Runner {
|
|
|
1230
1638
|
selected = this.choose(action);
|
|
1231
1639
|
if (selected) { return this.atom(selected, taskId, purpose); }
|
|
1232
1640
|
}
|
|
1641
|
+
const between = this.betweenNeighbors(action);
|
|
1642
|
+
if (between) { return this.atom(between, taskId, purpose); }
|
|
1643
|
+
// A soft keyboard left up by the last input covers the bottom of the page (a form's submit
|
|
1644
|
+
// button): close it, never with a bare Back, and look again. Measured (coolmall 2026-11-16):
|
|
1645
|
+
// the address form's "Save" was missing from the tree while the keyboard was shown.
|
|
1646
|
+
if (this.current.nodes.some((n) => /EditText|TextField|AutoComplete/.test(pyStr(get(n, 'class', ''))))
|
|
1647
|
+
&& typeof this.device?._imeShown === 'function' && this.device._imeShown()) {
|
|
1648
|
+
this.atom({ type: 'hide_ime' }, taskId, 'hide-ime');
|
|
1649
|
+
selected = this.choose(action);
|
|
1650
|
+
if (selected) { return this.atom(selected, taskId, purpose); }
|
|
1651
|
+
}
|
|
1233
1652
|
if (!this.appUiReady()) { throw new AdapterError('selector unavailable on non-app/empty UI'); }
|
|
1234
1653
|
// Content that loads after the page is ready (a list filled from the network or a database):
|
|
1235
1654
|
// look again while the screen is still changing, for a bounded time, before scrolling. A
|
|
@@ -1303,7 +1722,108 @@ export class Runner {
|
|
|
1303
1722
|
// Close only what the opener opened; an opener with no visible effect needs no Back.
|
|
1304
1723
|
if (observationKey(this.current) !== key) { this.atom({ type: 'back' }, taskId, 'search-overflow-close'); }
|
|
1305
1724
|
}
|
|
1306
|
-
throw new AdapterError('selector-not-found-after-bounded-scroll');
|
|
1725
|
+
throw this.emptyFailure() ?? new AdapterError('selector-not-found-after-bounded-scroll');
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* A form field whose label the screen does not expose (a picker field under a transparent click
|
|
1730
|
+
* layer: only a text-less clickable shows): when the step names the labels of the fields before and
|
|
1731
|
+
* after it (`neighbors`, from the static form order), the one text-less clickable lying between
|
|
1732
|
+
* them, horizontally overlapping them, is tapped by its centre. Measured (coolmall 2026-11-16): the
|
|
1733
|
+
* address form's "Region" field showed as a bare clickable View between "Phone" and "Street".
|
|
1734
|
+
* -> a click_point action, or null.
|
|
1735
|
+
*/
|
|
1736
|
+
betweenNeighbors(action) {
|
|
1737
|
+
const nb = get(action, 'neighbors');
|
|
1738
|
+
if (!Array.isArray(nb) || nb.length !== 2) { return null; }
|
|
1739
|
+
const nodes = this.current.nodes;
|
|
1740
|
+
const find = (t) => { if (!t) { return null; } const h = nodes.filter((n) => isVisible(n) && pyStr(get(n, 'text', '')).trim() === t); return h.length === 1 ? h[0] : null; };
|
|
1741
|
+
const [prev, next] = [find(nb[0]), find(nb[1])];
|
|
1742
|
+
if (!prev && !next) { return null; }
|
|
1743
|
+
const top = prev ? prev.bounds[3] : 0;
|
|
1744
|
+
const bottom = next ? next.bounds[1] : Infinity;
|
|
1745
|
+
const ref = prev || next;
|
|
1746
|
+
const hits = nodes.filter((n) => isVisible(n) && truthy(get(n, 'clickable')) && !pyStr(get(n, 'text', '')).trim()
|
|
1747
|
+
&& !pyStr(get(n, 'content_desc') ?? get(n, 'content-desc') ?? '').trim() && get(n, 'bounds', []).length === 4
|
|
1748
|
+
&& n.bounds[1] >= top - 8 && n.bounds[3] <= bottom + 8 && n.bounds[0] < ref.bounds[2] && n.bounds[2] > ref.bounds[0]
|
|
1749
|
+
&& (n.bounds[3] - n.bounds[1]) > 20);
|
|
1750
|
+
if (hits.length !== 1) { return null; }
|
|
1751
|
+
const b = hits[0].bounds;
|
|
1752
|
+
return { type: 'click_point', x: Math.floor((b[0] + b[2]) / 2), y: Math.floor((b[1] + b[3]) / 2), row: { class: get(hits[0], 'class'), bounds: b, between: nb } };
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
/**
|
|
1756
|
+
* The failure to report instead of a missing selector or list row when the screen shows one of the
|
|
1757
|
+
* app's empty-state components (diagnostics.emptyStateShown): `needs-data:<page> (texts)`, or
|
|
1758
|
+
* `needs-network:` for a failed load. The path may be right; the data it needs is not there.
|
|
1759
|
+
*/
|
|
1760
|
+
emptyFailure() {
|
|
1761
|
+
const comps = (this._emptyComponents ??= emptyStateComponents(get(this.doc, 'nodes', [])));
|
|
1762
|
+
const shown = emptyStateShown(this.current, comps);
|
|
1763
|
+
if (!shown) { return null; }
|
|
1764
|
+
const page = get(get(this.current, 'static_resolution', {}), 'status') === 'verified'
|
|
1765
|
+
? this.current.static_resolution.static_id : `activity:${get(this.current, 'activity') ?? ''}`;
|
|
1766
|
+
return new AdapterError(`needs-${shown.kind}:${page} (${shown.texts.join(' / ')})`);
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* Other values of the resources a selector text belongs to (strings.deviceTextsIn): a key
|
|
1771
|
+
* two modules define differently resolves to one of them on the device, by the merge order of the
|
|
1772
|
+
* build. Measured (coolmall 2026-11-15): a recipe tapped "Phone number" (feature/user) while the device
|
|
1773
|
+
* showed "Phone" (feature/main wins, declared first), and the phase ran none of its tasks.
|
|
1774
|
+
*/
|
|
1775
|
+
textAlternatesOf(text) {
|
|
1776
|
+
if (this._stringTables === undefined) {
|
|
1777
|
+
const project = get(this.doc, 'source_project');
|
|
1778
|
+
this._stringTables = null;
|
|
1779
|
+
if (truthy(project)) { try { this._stringTables = loadStringTables(project, get(this.doc, 'locale', 'en')); } catch { /* none */ } }
|
|
1780
|
+
}
|
|
1781
|
+
return this._stringTables ? deviceTextsIn(this._stringTables, text || '') : [];
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* The key of a proven route: the phase environment, the start (`fresh` / `warm`), the page the
|
|
1786
|
+
* launch landed on, and the page reached. A route proven from one start and landing replays only
|
|
1787
|
+
* from the same: a first-run page or cleared data changes what the same taps do.
|
|
1788
|
+
*/
|
|
1789
|
+
routeKey(page, start = this._start, landing = this._landing) { return [this.env, start, landing, page].join('\u0000'); }
|
|
1790
|
+
|
|
1791
|
+
/**
|
|
1792
|
+
* recordRoute(page, steps): the replay steps, run from this task's own launch, that the device
|
|
1793
|
+
* verified as reaching `page` (not merely attested). The first route proven to a page is kept for
|
|
1794
|
+
* the rest of the run. Only from a launch made for the current task: a task that started on a page
|
|
1795
|
+
* an earlier task left has no launch the steps start from.
|
|
1796
|
+
*/
|
|
1797
|
+
recordRoute(page, steps) {
|
|
1798
|
+
if (!truthy(page) || this._launchedFor === undefined || !Array.isArray(steps) || !steps.length) { return; }
|
|
1799
|
+
const routes = (this._routes ??= new Map());
|
|
1800
|
+
const k = this.routeKey(page);
|
|
1801
|
+
if (!routes.has(k)) { routes.set(k, structuredClone(steps)); }
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* rerouteTask(task, i, start, landing, reason): the task with replay steps 0..i (whose last hop
|
|
1806
|
+
* names the page it opens) replaced by a route this run proved reaches that page from the same
|
|
1807
|
+
* start and landing, or null. Each task is rerouted once: the substitute carries `rerouted_from`.
|
|
1808
|
+
* A failure (an ambiguous selector, a control not found, a list that opened another page) then
|
|
1809
|
+
* repeats for none of the tasks sharing that prefix. Measured (coolmall 2026-11-18): logged-out
|
|
1810
|
+
* tasks replayed a coupon claim to reach Login (an ambiguous selector) while other tasks of the run
|
|
1811
|
+
* had reached Login, and every task behind that hop failed or was cut by the prefix memo.
|
|
1812
|
+
*/
|
|
1813
|
+
rerouteTask(task, i, start, landing, reason) {
|
|
1814
|
+
if (!truthy(get(this.config, 'reroute_replay', true)) || truthy(get(task, 'rerouted_from'))) { return null; }
|
|
1815
|
+
const replay = or(get(task, 'replay'), []);
|
|
1816
|
+
const page = get(replay[i] ?? {}, 'target_id');
|
|
1817
|
+
if (!truthy(page) || truthy(get(replay[i], 'intermediate'))) { return null; }
|
|
1818
|
+
const route = (this._routes ?? new Map()).get(this.routeKey(page, start, landing));
|
|
1819
|
+
if (!route || jsonDumps(route, { sort_keys: true }) === jsonDumps(replay.slice(0, i + 1), { sort_keys: true })) { return null; }
|
|
1820
|
+
const alt = { ...task, replay: [...structuredClone(route), ...replay.slice(i + 1)], rerouted_from: { replay_index: i, reason } };
|
|
1821
|
+
this.emit('replay_rerouted', { task_id: task.task_id, page, replay_index: i, reason, route_steps: route.length,
|
|
1822
|
+
start, landing, observation_id: get(or(this.current, {}), 'observation_id') });
|
|
1823
|
+
// the substitute launches again: from cleared data when this one did
|
|
1824
|
+
if (start === 'fresh' && this._clearedFor === task.task_id) { this._clearedFor = undefined; }
|
|
1825
|
+
this._launchedFor = undefined;
|
|
1826
|
+
return alt;
|
|
1307
1827
|
}
|
|
1308
1828
|
|
|
1309
1829
|
source(task) {
|
|
@@ -1346,24 +1866,34 @@ export class Runner {
|
|
|
1346
1866
|
const memo = truthy(get(this.config, 'prefix_memo', true)) ? (this._prefixFailures ??= new Map()) : null;
|
|
1347
1867
|
const replay = mget(task, 'replay');
|
|
1348
1868
|
const start = this.resetsBetweenTasks() && this._clearedFor !== task.task_id ? 'fresh' : 'warm';
|
|
1869
|
+
// A failed prefix with a proven route to the page its failing hop opens is replayed through that
|
|
1870
|
+
// route instead (rerouteTask); the reroute runs after the memo check, from the next launch.
|
|
1871
|
+
let reroute = null;
|
|
1349
1872
|
const memoHit = (landing) => {
|
|
1350
1873
|
if (!memo || landing === undefined) { return; }
|
|
1351
1874
|
for (let n = 1; n <= replay.length; n++) {
|
|
1352
1875
|
const k = prefixKey(task, n);
|
|
1353
1876
|
const e = memo.get(k);
|
|
1354
|
-
if (e && e.start === start && e.landing === landing) {
|
|
1877
|
+
if (e && e.start === start && e.landing === landing) {
|
|
1878
|
+
reroute = this.rerouteTask(task, e.replay_index, start, landing, e.reason);
|
|
1879
|
+
if (reroute) { return; }
|
|
1880
|
+
throw new PrefixFailed(e, k);
|
|
1881
|
+
}
|
|
1355
1882
|
}
|
|
1356
1883
|
};
|
|
1357
1884
|
const last = (this._lastLanding ??= {})[start];
|
|
1358
1885
|
const chain = or(get(task, 'launch_chain'), []);
|
|
1359
1886
|
if (last && (start === 'fresh' || (chain.length ? chain.includes(last.landing) : last.repeated))) { memoHit(last.landing); }
|
|
1887
|
+
if (reroute) { return this.source(reroute); }
|
|
1360
1888
|
this.resetBetweenTasks(task.task_id);
|
|
1361
1889
|
this.atom(launch, task.task_id, 'recover');
|
|
1362
1890
|
this.waitLaunchPage(task);
|
|
1363
1891
|
this._landing = landingOf(this.current);
|
|
1364
1892
|
this._start = start;
|
|
1893
|
+
this._launchedFor = task.task_id;
|
|
1365
1894
|
this._lastLanding[start] = { landing: this._landing, repeated: last?.landing === this._landing };
|
|
1366
1895
|
memoHit(this._landing);
|
|
1896
|
+
if (reroute) { return this.source(reroute); }
|
|
1367
1897
|
this.launchBridge(task, { waited: true });
|
|
1368
1898
|
const attested = new Set();
|
|
1369
1899
|
let passedSoFar = 0;
|
|
@@ -1384,6 +1914,8 @@ export class Runner {
|
|
|
1384
1914
|
throw new AdapterError('replay-target-unverified:' + step.target_id);
|
|
1385
1915
|
}
|
|
1386
1916
|
attested.add(step.target_id);
|
|
1917
|
+
} else {
|
|
1918
|
+
this.recordRoute(step.target_id, replay.slice(0, i + 1));
|
|
1387
1919
|
}
|
|
1388
1920
|
} catch (e) {
|
|
1389
1921
|
const msg = errStr(e);
|
|
@@ -1391,6 +1923,10 @@ export class Runner {
|
|
|
1391
1923
|
memo.set(prefixKey(task, i + 1), { reason: msg, task_id: task.task_id, replay_index: i, start: this._start, landing: this._landing,
|
|
1392
1924
|
observation_id: get(or(this.current, {}), 'observation_id'), before_id: stepStart });
|
|
1393
1925
|
}
|
|
1926
|
+
if (e instanceof AdapterError && PREFIX_FAILURES.some((r) => msg.startsWith(r))) {
|
|
1927
|
+
const alt = this.rerouteTask(task, i, this._start, this._landing, msg);
|
|
1928
|
+
if (alt) { return this.source(alt); }
|
|
1929
|
+
}
|
|
1394
1930
|
throw e;
|
|
1395
1931
|
}
|
|
1396
1932
|
}
|
|
@@ -1400,6 +1936,26 @@ export class Runner {
|
|
|
1400
1936
|
if (!this.at(source)) { this.clearInterruption(task.task_id); }
|
|
1401
1937
|
if (!this.at(source)) {
|
|
1402
1938
|
const ctx = get(task, 'source_context');
|
|
1939
|
+
// With no replay the launch alone must have opened the chain. Its deepest anchored page is
|
|
1940
|
+
// checkable, so an anchorless source behind it is not taken on the activity's word while
|
|
1941
|
+
// that page is missing (measured, weather 2026-11-14: the settings tap lost from the path,
|
|
1942
|
+
// every preference-dialog task passed on MainActivity and scrolled the main screen).
|
|
1943
|
+
// Only a screen read as other pages proves the launch fell short: verified as a page outside the
|
|
1944
|
+
// chain's tail, or ambiguous among such pages only. A default child that fills the host (its
|
|
1945
|
+
// widgets gone from the dump) is unmapped, and is left to the checks below.
|
|
1946
|
+
const chain = or(get(task, 'launch_chain'), []);
|
|
1947
|
+
const chainHost = replay.length ? undefined : [...chain].reverse().find((p) => p !== source && !this.anchorless(p));
|
|
1948
|
+
const tailIds = chain.slice(chain.indexOf(chainHost));
|
|
1949
|
+
const outside = (id) => truthy(id) && id !== source && !tailIds.includes(id);
|
|
1950
|
+
const shown = or(get(this.current, 'static_resolution'), {});
|
|
1951
|
+
const shownCands = or(get(shown, 'candidates'), []).map((c) => get(c, 'static_id'));
|
|
1952
|
+
const elsewhere = get(shown, 'status') === 'verified' ? outside(get(shown, 'static_id'))
|
|
1953
|
+
: get(shown, 'status') === 'ambiguous' && shownCands.length > 0 && shownCands.every(outside);
|
|
1954
|
+
if (chainHost !== undefined && elsewhere && !this.at(chainHost)) {
|
|
1955
|
+
this.emit('source_chain_missing', { task_id: task.task_id, source, missing: chainHost,
|
|
1956
|
+
observation_id: get(or(this.current, {}), 'observation_id') });
|
|
1957
|
+
throw new AdapterError('source-unverified:' + source);
|
|
1958
|
+
}
|
|
1403
1959
|
if (!(this.anchorless(source) && (attested.has(source)
|
|
1404
1960
|
|| (truthy(ctx) && (this.at(ctx) || this.transientSuccessor(ctx, source, task.task_id)))
|
|
1405
1961
|
|| (!replay.length && this.launchedInto(source, task.task_id))))) {
|
|
@@ -1417,12 +1973,16 @@ export class Runner {
|
|
|
1417
1973
|
* Not a control of the target page itself (its own label in the catalog): there an absent control
|
|
1418
1974
|
* is below the fold, behind a reveal or still loading, and the gesture is still owed. The caller
|
|
1419
1975
|
* offers only the leading hops, before any replay gesture ran.
|
|
1976
|
+
* `entry_cues` are not the target's own: they are the opener's control texts, on the page before
|
|
1977
|
+
* it. Measured (coolmall 2026-11-15): Main's cues "Skip" / "Get started" read as Main's own controls,
|
|
1978
|
+
* the hop was never passed, and a recovery phase standing on Home failed 20 of 20 tasks behind it.
|
|
1420
1979
|
*/
|
|
1421
1980
|
replayStepPassed(step) {
|
|
1422
1981
|
if (!Object.hasOwn(CANDIDATE_KINDS, get(step, 'type')) && !['click', 'long_click'].includes(get(step, 'type'))) { return false; }
|
|
1423
1982
|
if (truthy(get(step, 'intermediate')) || !truthy(get(step, 'target_id')) || !this.at(step.target_id)) { return false; }
|
|
1424
1983
|
const labels = [get(step, 'static_label'), ...or(get(step, 'static_label_alt'), [])].filter(truthy).map((l) => pyStr(l).trim());
|
|
1425
|
-
const own = Object.
|
|
1984
|
+
const own = Object.entries(or(get(this.catalog, step.target_id), {})).filter(([k]) => k !== 'entry_cues')
|
|
1985
|
+
.flatMap(([, v]) => (Array.isArray(v) ? v : [v]))
|
|
1426
1986
|
.filter((v) => typeof v === 'string').map((v) => v.trim());
|
|
1427
1987
|
if (labels.some((l) => own.includes(l))) { return false; }
|
|
1428
1988
|
try { return !this.choose(step); } catch (e) { if (e instanceof AdapterError) { return false; } throw e; }
|
|
@@ -1719,7 +2279,11 @@ export class Runner {
|
|
|
1719
2279
|
}
|
|
1720
2280
|
|
|
1721
2281
|
_runFixtures() {
|
|
2282
|
+
let skip = 0;
|
|
2283
|
+
// a gesture ran since the last launch / restore: later hops are owed, never "already passed"
|
|
2284
|
+
let gestured = false;
|
|
1722
2285
|
for (const action of get(get(this.config, 'fixtures', {}), this.phase.id, [])) {
|
|
2286
|
+
if (skip > 0) { skip -= 1; continue; }
|
|
1723
2287
|
// A fixture's own save step only exists to hand its state to later phases. When the phase
|
|
1724
2288
|
// runs again (next round, resume) the archive is the one this fixture already wrote: keep it
|
|
1725
2289
|
// (never overwrite) and continue, instead of blocking the phase on its own artifact.
|
|
@@ -1743,6 +2307,26 @@ export class Runner {
|
|
|
1743
2307
|
}
|
|
1744
2308
|
continue;
|
|
1745
2309
|
}
|
|
2310
|
+
// `skip_unless { rule, count }`: the next `count` steps run only when the screen matches `rule`
|
|
2311
|
+
// (a seeding recipe creates a record only while its list page shows the empty state, so a
|
|
2312
|
+
// rerun never makes a second one).
|
|
2313
|
+
if (get(action, 'type') === 'skip_unless') {
|
|
2314
|
+
if (!ruleMatches(this.current, get(action, 'rule', {}))) {
|
|
2315
|
+
const n = Math.max(0, toInt(get(action, 'count', 0)));
|
|
2316
|
+
this.emit('fixture_steps_skipped', { phase: this.phase.id, count: n, rule: action.rule, observation_id: get(this.current, 'observation_id') });
|
|
2317
|
+
skip = n;
|
|
2318
|
+
}
|
|
2319
|
+
continue;
|
|
2320
|
+
}
|
|
2321
|
+
// A recipe step compiled from a click path (it names its target page) whose page is already up
|
|
2322
|
+
// and whose control is gone: a first-run hop the warm launch has passed (replayStepPassed).
|
|
2323
|
+
if (!gestured && truthy(get(action, 'target_id')) && this.replayStepPassed(action)) {
|
|
2324
|
+
this.emit('replay_step_passed', { task_id: 'fixture:' + this.phase.id, target_id: action.target_id, observation_id: get(this.current, 'observation_id') });
|
|
2325
|
+
continue;
|
|
2326
|
+
}
|
|
2327
|
+
const at = get(action, 'type');
|
|
2328
|
+
if (['launch', 'clear_app_data', 'restore_app_data'].includes(at)) { gestured = false; }
|
|
2329
|
+
else if (!['wait', 'snapshot_app_data', 'save_replay'].includes(at)) { gestured = true; }
|
|
1746
2330
|
try {
|
|
1747
2331
|
this.seek(action, 'fixture:' + this.phase.id, 'prepare');
|
|
1748
2332
|
if (['clear_app_data', 'restore_app_data'].includes(get(action, 'type'))) { this.grantRuntimePermissions(); }
|
|
@@ -1753,7 +2337,13 @@ export class Runner {
|
|
|
1753
2337
|
this.seek(action, 'fixture:' + this.phase.id, 'prepare');
|
|
1754
2338
|
} catch (exc2) {
|
|
1755
2339
|
if (!(exc2 instanceof AdapterError)) { throw exc2; }
|
|
1756
|
-
const sel =
|
|
2340
|
+
const sel = fixtureStepTarget(action);
|
|
2341
|
+
// What the screen did show: recover_d.mjs stepFailures offers the recipe back so its steps
|
|
2342
|
+
// can be rewritten from evidence. Measured (coolmall 2026-11-18): a login recipe tapped
|
|
2343
|
+
// "请输入手机号码" on a screen whose field read "请输入手机号", and the phase stayed blocked.
|
|
2344
|
+
this.emit('fixture_step_failed', { phase: this.phase.id, step: get(action, 'type'), part: get(action, 'recipe_part', null), selector: sel,
|
|
2345
|
+
observation_id: get(this.current, 'observation_id'), activity: get(this.current, 'activity'),
|
|
2346
|
+
visible_texts: visibleTexts(this.current) });
|
|
1757
2347
|
this._block(`fixture-step-failed: ${pyStr(get(action, 'type'))} ${cpSlice(jsonDumps(sel, { ensure_ascii: false }), 0, 80)}: ${errStr(exc2)}`);
|
|
1758
2348
|
return false;
|
|
1759
2349
|
}
|
|
@@ -1768,7 +2358,20 @@ export class Runner {
|
|
|
1768
2358
|
const tasks = get(this.doc, 'tasks', []).filter((t) => t.phase === this.phase.id);
|
|
1769
2359
|
const probesFor = get(get(this.config, 'phase_probes', {}), this.phase.id);
|
|
1770
2360
|
if (truthy(this.phase.requires) && !truthy(probesFor)) {
|
|
1771
|
-
|
|
2361
|
+
const fallback = fallbackScope(this.config, this.phase, probesFor, this.doc);
|
|
2362
|
+
if (fallback === null) {
|
|
2363
|
+
return this._block('unresolved prerequisites: ' + this.phase.requires.join(', '));
|
|
2364
|
+
}
|
|
2365
|
+
this.emit('state_probe_missing', { phase: this.phase.id, requires: this.phase.requires, fallback });
|
|
2366
|
+
}
|
|
2367
|
+
// A phase that writes to the backend (a seeding recipe) runs only while the switch is still on:
|
|
2368
|
+
// turning `allow_data_writes` off after scheduling stops it on the next run. `writes_data` decides;
|
|
2369
|
+
// a recS- phase with no flag at all was scheduled before the flag existed (seed_recipes apply
|
|
2370
|
+
// backfills it on its next run) and counts as writing until then.
|
|
2371
|
+
const writes = get(this.phase, 'writes_data');
|
|
2372
|
+
const legacySeed = (writes === undefined || writes === null) && String(this.phase.id).startsWith('recS-');
|
|
2373
|
+
if ((writes === true || legacySeed) && get(this.config, 'allow_data_writes') !== true) {
|
|
2374
|
+
return this._block('data-writes-disabled: config.allow_data_writes is not true');
|
|
1772
2375
|
}
|
|
1773
2376
|
this.prepareEnvironment();
|
|
1774
2377
|
if (!this._runFixtures()) { return undefined; }
|
|
@@ -1777,15 +2380,13 @@ export class Runner {
|
|
|
1777
2380
|
// What the screen did show: recover_d.mjs offers it back so the probe can be rewritten from
|
|
1778
2381
|
// evidence. Measured (ydweather): the recipe reached Main, but its probe asked for a sticky
|
|
1779
2382
|
// title that is never in the tree at rest, and Main stayed uncaptured.
|
|
1780
|
-
const shown = [...new Set(get(this.current, 'nodes', []).filter((n) => isVisible(n))
|
|
1781
|
-
.flatMap((n) => [get(n, 'text'), get(n, 'content_desc')]).filter((t) => truthy(t)).map((t) => pyStr(t).trim())
|
|
1782
|
-
.filter((t) => t.length > 0))].slice(0, 200);
|
|
1783
2383
|
this.emit('state_probe_failed', { phase: this.phase.id, observation_id: get(this.current, 'observation_id'),
|
|
1784
|
-
activity: get(this.current, 'activity'), visible_texts:
|
|
2384
|
+
activity: get(this.current, 'activity'), visible_texts: visibleTexts(this.current), probes });
|
|
1785
2385
|
return this._block('state-probe-failed');
|
|
1786
2386
|
}
|
|
1787
2387
|
this.emit('environment_verified', { phase: this.phase.id, observation_id: this.current.observation_id,
|
|
1788
|
-
scope: truthy(probes) ? 'configured probes'
|
|
2388
|
+
scope: truthy(probes) ? 'configured probes'
|
|
2389
|
+
: (truthy(this.phase.requires) ? fallbackScope(this.config, this.phase, probes, this.doc) : 'existing state, no guard assumed') });
|
|
1789
2390
|
this.phase.status = 'running'; this.save();
|
|
1790
2391
|
let routeFailures = 0;
|
|
1791
2392
|
for (const route of get(get(this.config, 'routes', {}), this.phase.id, [])) {
|
|
@@ -1804,6 +2405,7 @@ export class Runner {
|
|
|
1804
2405
|
this.emit('route_result', { route_id: route.id, outcome: 'failed', reason: errStr(e), observation_id: this.current.observation_id });
|
|
1805
2406
|
}
|
|
1806
2407
|
}
|
|
2408
|
+
const runStart = this.doc.events.length;
|
|
1807
2409
|
const starts = counter(this.doc.events.filter((e) => e.kind === 'task_started').map((e) => e.payload.task_id));
|
|
1808
2410
|
const phaseTaskIds = new Set(tasks.map((t) => t.task_id));
|
|
1809
2411
|
const done = new Set(this.doc.events.filter((e) => e.kind === 'task_result' && e.payload.outcome === 'confirmed'
|
|
@@ -1834,12 +2436,26 @@ export class Runner {
|
|
|
1834
2436
|
}
|
|
1835
2437
|
const invariants = get(get(this.config, 'invariant_probes', {}), this.phase.id, []);
|
|
1836
2438
|
if (truthy(invariants) && !invariants.every((p) => ruleMatches(this.current, p))) { return this._block('state-drift'); }
|
|
2439
|
+
const isRoute = get(task, 'purpose') === 'route-launch' || get(task.action, 'type') === 'route';
|
|
2440
|
+
// A route task that cannot run (capture disabled, route down for this phase) is settled
|
|
2441
|
+
// without starting it: no task_started, no attempt spent, so a later run still gets it.
|
|
2442
|
+
const routeBlocked = isRoute ? this.routeUnavailable() : null;
|
|
2443
|
+
if (routeBlocked) {
|
|
2444
|
+
this.emit('task_result', { task_id: ident, outcome: 'unsupported', reason: routeBlocked, target_static: task.target_static });
|
|
2445
|
+
continue;
|
|
2446
|
+
}
|
|
1837
2447
|
scheduled += 1; starts.set(ident, (starts.get(ident) ?? 0) + 1);
|
|
1838
2448
|
this.emit('task_started', { task_id: ident, target_static: task.target_static });
|
|
1839
2449
|
this.keep = [task.source_static, task.target_static, get(task, 'source_context')].filter((x) => truthy(x));
|
|
1840
2450
|
this._launched = false; // only a launch of this task's own opens the consent window
|
|
1841
2451
|
this._clearedFor = null; // every attempt of a task starts from cleared data (resetBetweenTasks)
|
|
1842
2452
|
if (get(task, 'purpose') === 'direct-launch') { this.runDirect(task, done); continue; }
|
|
2453
|
+
if (isRoute) {
|
|
2454
|
+
const how = this.runRoute(task, done, transient);
|
|
2455
|
+
if (how === 'retry') { starts.set(ident, starts.get(ident) - 1); tasks.push(task); }
|
|
2456
|
+
if (how === DEVICE_UNAVAILABLE) { return this._block(DEVICE_UNAVAILABLE); }
|
|
2457
|
+
continue;
|
|
2458
|
+
}
|
|
1843
2459
|
try {
|
|
1844
2460
|
this._runTask(task, ident, done);
|
|
1845
2461
|
} catch (exc) {
|
|
@@ -1897,16 +2513,77 @@ export class Runner {
|
|
|
1897
2513
|
.map((e) => get(e.payload, 'static_id')));
|
|
1898
2514
|
const missing = this.phase.obligations.filter((o) => o.type === 'node' && !mapped.has(o.id) && !this.scopeExcludes(o.id));
|
|
1899
2515
|
const resolved = new Set([...done, ...skipped]).size;
|
|
2516
|
+
// One failed prefix the memo reused for many tasks: name it, the phase ran little of itself.
|
|
2517
|
+
const byId = new Map(get(this.doc, 'tasks', []).map((t) => [t.task_id, t]));
|
|
2518
|
+
for (const t of tasks) { byId.set(t.task_id, t); }
|
|
2519
|
+
const collapses = collapsedPrefixes(this.doc.events.slice(runStart), byId,
|
|
2520
|
+
{ env: this.env, min: toInt(get(this.config, 'collapse_min_cascade', COLLAPSE_MIN_CASCADE)) });
|
|
2521
|
+
for (const c of collapses) { this.emit('phase_collapsed', { phase: this.phase.id, ...c }); }
|
|
1900
2522
|
Object.assign(this.phase, {
|
|
1901
2523
|
status: resolved === tasks.length && !missing.length && !routeFailures ? 'completed' : 'exhausted-with-gaps',
|
|
1902
2524
|
reason: `${done.size}/${tasks.length} tasks confirmed; ${skipped.size} skipped (target already covered or out of scope); `
|
|
1903
2525
|
+ `${missing.length} node obligations missing; ${routeFailures} routes failed; `
|
|
1904
|
-
+ `discovery=${pyStr(get(discovery, 'outcome', 'disabled'))}; coverage=${this.coverage}
|
|
2526
|
+
+ `discovery=${pyStr(get(discovery, 'outcome', 'disabled'))}; coverage=${this.coverage}`
|
|
2527
|
+
+ collapses.map((c) => `; COLLAPSED: ${collapseNote(c)}`).join(''),
|
|
1905
2528
|
});
|
|
2529
|
+
if (collapses.length) { this.phase.collapsed = collapses.map(({ targets, ...c }) => c); }
|
|
1906
2530
|
this.save();
|
|
1907
2531
|
return undefined;
|
|
1908
2532
|
}
|
|
1909
2533
|
|
|
2534
|
+
/**
|
|
2535
|
+
* A uni-app route-jump task: one page = one route inside the shared WebView host, so there is
|
|
2536
|
+
* no Activity to launch and no in-app click path to replay. `route` (DeviceAdapter) executes
|
|
2537
|
+
* uni.reLaunch / uni.switchTab through the WebView, then the normal capture/mapping pipeline
|
|
2538
|
+
* identifies the landing page by its route token.
|
|
2539
|
+
*/
|
|
2540
|
+
runRoute(task, done, transient = new Map()) {
|
|
2541
|
+
const ident = task.task_id;
|
|
2542
|
+
this.stage = 'target';
|
|
2543
|
+
try {
|
|
2544
|
+
if (get(this.current, 'package') !== mget(this.config, 'package')) {
|
|
2545
|
+
this.atom({ type: 'launch', component: mget(this.config, 'launch_component'), restart: true }, ident, 'route');
|
|
2546
|
+
}
|
|
2547
|
+
this.seek(task.action, ident, 'target');
|
|
2548
|
+
} catch (exc) {
|
|
2549
|
+
if (exc instanceof BudgetExhausted) { throw exc; }
|
|
2550
|
+
const msg = errStr(exc);
|
|
2551
|
+
const code = routeErrorCode(msg);
|
|
2552
|
+
// Only a deterministic cause takes the route down for the rest of the phase (no DevTools
|
|
2553
|
+
// socket while adb works; uni absent in every target that answered).
|
|
2554
|
+
if (ROUTE_DOWN_CODES.has(code)) {
|
|
2555
|
+
this._hybridRouteDown = msg;
|
|
2556
|
+
this.emit('hybrid_route_unavailable', { task_id: ident, reason: msg, code });
|
|
2557
|
+
} else if (ROUTE_TRANSIENT_CODES.has(code) || TRANSIENT_DEVICE_RE.test(msg)) {
|
|
2558
|
+
// A CDP/adb hiccup: retry the task like a transient device error (_runTask's handling).
|
|
2559
|
+
const device = TRANSIENT_DEVICE_RE.test(msg);
|
|
2560
|
+
const recovered = device ? this.waitDevice() : true;
|
|
2561
|
+
transient.set(ident, (transient.get(ident) ?? 0) + 1);
|
|
2562
|
+
const retrying = recovered && transient.get(ident) <= toInt(get(this.config, 'max_device_retries', 1));
|
|
2563
|
+
this.emit('task_result', { task_id: ident, outcome: device ? 'device-error' : 'failed', stage: 'target',
|
|
2564
|
+
reason: cpSlice(msg, 0, 200), transient: true, ...(retrying ? { retrying: true } : {}), target_static: task.target_static });
|
|
2565
|
+
if (retrying) { return 'retry'; }
|
|
2566
|
+
return recovered ? undefined : DEVICE_UNAVAILABLE;
|
|
2567
|
+
}
|
|
2568
|
+
this.emit('task_result', { task_id: ident, outcome: 'failed', stage: 'target', reason: msg,
|
|
2569
|
+
target_static: task.target_static, observation_id: get(or(this.current, {}), 'observation_id') });
|
|
2570
|
+
return undefined;
|
|
2571
|
+
}
|
|
2572
|
+
const confirmed = this.at(task.target_static);
|
|
2573
|
+
if (confirmed) { done.add(ident); }
|
|
2574
|
+
this.emit('task_result', { task_id: ident, outcome: confirmed ? 'confirmed' : 'target-unverified',
|
|
2575
|
+
purpose: 'route-launch', target_static: task.target_static, observation_id: this.current.observation_id });
|
|
2576
|
+
if (confirmed) { this.sweep(task.target_static); }
|
|
2577
|
+
return undefined;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
/** Why a route task cannot run in this phase (capture disabled / route down), else null. */
|
|
2581
|
+
routeUnavailable() {
|
|
2582
|
+
if (get(this.config, 'hybrid_route_capture', true) === false) { return 'hybrid-route-capture disabled'; }
|
|
2583
|
+
if (this._hybridRouteDown) { return 'hybrid-route unavailable earlier in this phase: ' + this._hybridRouteDown; }
|
|
2584
|
+
return null;
|
|
2585
|
+
}
|
|
2586
|
+
|
|
1910
2587
|
_runTask(task, ident, done) {
|
|
1911
2588
|
this.stage = 'source';
|
|
1912
2589
|
this.source(task);
|