@buaa_smat/hometrans 26.0.5 → 26.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +249 -279
- package/agents/code-reviewer.md +1 -1
- package/dist/cli/editors.json +20 -0
- package/dist/platform/registry.js +1 -0
- package/dist/platform/validate.js +2 -1
- package/i18n/agents/code-reviewer.md +1 -1
- package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
- package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
- package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/package.json +2 -1
- package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/skills/a2h-app-migrate/SKILL.md +31 -14
- package/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
- package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
- package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
- package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
- package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
- package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
- package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +1 -1
- package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
- package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
- package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
- package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
- package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
- package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
- package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
- package/skills/a2h-page-specgen/SKILL.md +36 -5
- package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
- package/skills/a2h-page-specgen/references/evidence.md +2 -1
- package/skills/a2h-page-specgen/references/execution-model.md +13 -5
- package/skills/a2h-page-specgen/references/gates.md +33 -7
- package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
- package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
- package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
- package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
- package/skills/a2h-resource-convert/SKILL.md +1 -1
- package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
- package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
- package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
- package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
- package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
- package/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
- package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
- package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
- package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
- package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
- package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
- package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
- package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
- package/skills/a2h-utg-static/SKILL.md +3 -3
- package/skills/a2h-utg-static/references/extractors.md +7 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
- package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
- package/resource/convert_pipeline_process.svg +0 -114
- package/resource/project_architecture.svg +0 -120
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* predicates.mjs — compile each phase requirement into a predicate the device evidence can decide.
|
|
4
|
+
*
|
|
5
|
+
* A static plan puts pages behind requirements written for people ("needs login", "branch:
|
|
6
|
+
* showUI?.device != null"). Nothing could check them, so a phase ran only when someone had
|
|
7
|
+
* configured a fixture for it, and a device that already held the state never ran its tasks
|
|
8
|
+
* (measured, universalapp TV 2026-11-25: logged in with a non-empty device list, 160 tasks of
|
|
9
|
+
* 16 state phases blocked as "no fixture/probe establishes"). Here every distinct requirement
|
|
10
|
+
* becomes either
|
|
11
|
+
*
|
|
12
|
+
* { status: 'compiled', clauses: [{ page, rule? }] } it holds in a data state when one clause
|
|
13
|
+
* matches a verified capture of `page` in that state (ruleMatches over `rule`; no rule:
|
|
14
|
+
* the page rendering at all proves it), or
|
|
15
|
+
* { status: 'unevaluable', why } no screen shows it; reported, never guessed.
|
|
16
|
+
*
|
|
17
|
+
* Besides these, states.mjs always accepts guarded-page evidence (a page the plan puts behind the
|
|
18
|
+
* requirement on its route was verified in the state), which needs no review.
|
|
19
|
+
*
|
|
20
|
+
* predicates.mjs extract <campaign> -> predicates_worklist.json (one item per requirement
|
|
21
|
+
* not compiled yet)
|
|
22
|
+
* predicates.mjs apply <campaign> predicates_answers.json -> predicates.json
|
|
23
|
+
* (+ predicates_report.json)
|
|
24
|
+
*
|
|
25
|
+
* Grounding (apply rejects otherwise): `page` is a catalog page; a selector names `resource_name`
|
|
26
|
+
* (an id of that page's own layout, catalog widget_ids, or one a capture of it showed: list rows
|
|
27
|
+
* come from adapter item layouts the catalog does not hold) and/or `text` / `content_desc` (a text
|
|
28
|
+
* the page's source or a capture of it shows).
|
|
29
|
+
*
|
|
30
|
+
* Exports: requirementKey, verifiedPages, groundingFacts, extract, validate, apply, main
|
|
31
|
+
*/
|
|
32
|
+
import * as path from 'node:path';
|
|
33
|
+
import { pathToFileURL } from 'node:url';
|
|
34
|
+
import {
|
|
35
|
+
ArgumentParser, get, jsonDumps, jsonLoads, pIsFile, pJoin, pathStr, pyPrint, pyStr, readText, runMain, sha256Hex, truthy,
|
|
36
|
+
} from './utg_explorer/_py.mjs';
|
|
37
|
+
import { atomicWriteJson } from './utg_explorer/adapters.mjs';
|
|
38
|
+
import { PREDICATES_FILE, guardedPages } from './utg_explorer/states.mjs';
|
|
39
|
+
import { screenTexts } from './recover_d.mjs';
|
|
40
|
+
import { normalized } from './utg_explorer/strings.mjs';
|
|
41
|
+
|
|
42
|
+
const isDict = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
43
|
+
const load = (p, d = null) => (pIsFile(p) ? jsonLoads(readText(p, { encoding: 'utf-8' })) : d);
|
|
44
|
+
const SELECTOR_KEYS = new Set(['resource_name', 'text', 'content_desc']);
|
|
45
|
+
const RULE_KEYS = new Set(['all', 'any', 'none']);
|
|
46
|
+
const MAX_PAGES = 8;
|
|
47
|
+
const MAX_TEXTS = 40;
|
|
48
|
+
const MAX_IDS = 80;
|
|
49
|
+
const CAPTURES_READ = 6;
|
|
50
|
+
|
|
51
|
+
/** Stable, short key of a requirement string. */
|
|
52
|
+
export const requirementKey = (r) => 'q-' + sha256Hex(Buffer.from(pyStr(r), 'utf8')).slice(0, 12);
|
|
53
|
+
|
|
54
|
+
function parsed(r) {
|
|
55
|
+
try { const j = JSON.parse(r); if (isDict(j)) { return j; } } catch { /* bare word */ }
|
|
56
|
+
return { kind: pyStr(r), text: null };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Source file of a static node's declaration, without the line. */
|
|
60
|
+
const declFile = (n) => pyStr(get(n, 'declared_at', '') || '').replace(/:\d+$/, '');
|
|
61
|
+
|
|
62
|
+
/** Requirements of the plan's own phases (recovery and scheduled variants repeat them). */
|
|
63
|
+
function planRequirements(doc) {
|
|
64
|
+
const out = new Map();
|
|
65
|
+
for (const ph of get(doc, 'phases', []) || []) {
|
|
66
|
+
if (pyStr(ph.id).startsWith('rec') || pyStr(ph.id).startsWith('st-')) { continue; }
|
|
67
|
+
for (const r of ph.requires || []) {
|
|
68
|
+
if (!out.has(r)) { out.set(r, []); }
|
|
69
|
+
out.get(r).push(ph.id);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Every verified capture in the event log: static id -> observation ids, most captured first. */
|
|
76
|
+
export function verifiedPages(root) {
|
|
77
|
+
const p = pJoin(root, 'events.jsonl');
|
|
78
|
+
const n = new Map();
|
|
79
|
+
if (!pIsFile(p)) { return n; }
|
|
80
|
+
for (const line of readText(p, { encoding: 'utf-8' }).split('\n')) {
|
|
81
|
+
if (!line.includes('"mapping"')) { continue; }
|
|
82
|
+
let e;
|
|
83
|
+
try { e = JSON.parse(line); } catch { continue; }
|
|
84
|
+
const id = get(get(e, 'payload', {}), 'static_id');
|
|
85
|
+
if (e.kind !== 'mapping' || !truthy(id)) { continue; }
|
|
86
|
+
if (!n.has(id)) { n.set(id, []); }
|
|
87
|
+
n.get(id).push(e.payload.observation_id);
|
|
88
|
+
}
|
|
89
|
+
return new Map([...n.entries()].sort((a, b) => b[1].length - a[1].length));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** ids and texts the device showed on a page (a few of its captures). */
|
|
93
|
+
function seenOn(root, oids) {
|
|
94
|
+
const ids = new Set();
|
|
95
|
+
const texts = new Set();
|
|
96
|
+
for (const oid of (oids || []).slice(0, CAPTURES_READ)) {
|
|
97
|
+
const o = load(pJoin(root, 'artifacts', pyStr(oid), 'observation.json'), null);
|
|
98
|
+
for (const nd of get(o, 'nodes', []) || []) {
|
|
99
|
+
const r = get(nd, 'resource_id') || get(nd, 'resource-id');
|
|
100
|
+
if (truthy(r)) { ids.add(pyStr(r).split('/').pop()); }
|
|
101
|
+
for (const k of ['text', 'content_desc']) {
|
|
102
|
+
const t = pyStr(get(nd, k, '') ?? '').trim();
|
|
103
|
+
if (t) { texts.add(t); }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return { ids: [...ids], texts: [...texts] };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Grounding sets of a page: its layout ids and source texts, plus what its captures showed. */
|
|
111
|
+
export function groundingFacts(doc, texts, root, captures, page) {
|
|
112
|
+
const seen = seenOn(root, captures.get(page));
|
|
113
|
+
const own = get(get(get(doc, 'page_catalog', {}), page, {}), 'widget_ids', []) || [];
|
|
114
|
+
// normalized -> the text as written, captured first: the device matches a selector exactly
|
|
115
|
+
const raw = new Map();
|
|
116
|
+
for (const t of [...seen.texts, ...(texts.get(page) || [])]) { if (!raw.has(normalized(t))) { raw.set(normalized(t), t); } }
|
|
117
|
+
return { page, ids: new Set([...own, ...seen.ids]), texts: new Set(raw.keys()), raw };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The rule with each text / content_desc replaced by the text the page shows. Validation compares
|
|
122
|
+
* normalized texts; the device (adapters.matching) compares exactly, so a reviewer's "Network quality"
|
|
123
|
+
* or full-width form would compile and then never match.
|
|
124
|
+
*/
|
|
125
|
+
export function canonicalRule(rule, facts) {
|
|
126
|
+
const fix = (sel) => {
|
|
127
|
+
if (!isDict(sel)) { return sel; }
|
|
128
|
+
const out = { ...sel };
|
|
129
|
+
for (const k of ['text', 'content_desc']) {
|
|
130
|
+
if (Object.hasOwn(out, k)) { out[k] = facts.raw?.get(normalized(pyStr(out[k]))) ?? out[k]; }
|
|
131
|
+
}
|
|
132
|
+
return out;
|
|
133
|
+
};
|
|
134
|
+
return Object.fromEntries(Object.entries(rule).map(([k, v]) => [k, Array.isArray(v) ? v.map(fix) : v]));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function pageFacts(doc, texts, ident, root, captures) {
|
|
138
|
+
const page = get(get(doc, 'page_catalog', {}), ident, {}) || {};
|
|
139
|
+
const seen = seenOn(root, captures.get(ident));
|
|
140
|
+
const own = new Set(get(page, 'widget_ids', []) || []);
|
|
141
|
+
return { page: ident, kind: get(page, 'kind'), widget_ids: [...own].slice(0, MAX_IDS),
|
|
142
|
+
// ids hidden by default: an empty-state placeholder is usually one of them
|
|
143
|
+
hidden_ids: get(page, 'hidden_ids', []) || [],
|
|
144
|
+
// ids a capture showed beyond the page's layout: list rows (adapter item layouts) and the like
|
|
145
|
+
captured_ids: seen.ids.filter((r) => !own.has(r)).slice(0, MAX_IDS),
|
|
146
|
+
texts: (texts.get(ident) || []).slice(0, MAX_TEXTS), captured_texts: seen.texts.slice(0, MAX_TEXTS) };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const QUESTION = [
|
|
150
|
+
'Each item is one requirement a static plan put pages behind. Answer every item by its `key` with',
|
|
151
|
+
"verdict 'predicate' and `clauses`: [{page, rule?}], where `page` is a page id (prefer `candidate_pages`,",
|
|
152
|
+
'pages the device already showed) and `rule` is {all|any|none: [selector]} with selectors of `resource_name`',
|
|
153
|
+
"(an id from that page's `widget_ids` or `captured_ids`) and/or `text` / `content_desc` (from its `texts` or",
|
|
154
|
+
'`captured_texts`). The requirement holds in a data state when one clause matches a capture of its page there;',
|
|
155
|
+
'a clause without `rule` means the page rendering at all proves it. Choose evidence that is on screen ONLY when',
|
|
156
|
+
'the requirement holds: for a non-empty list, an id of a row (from `captured_ids`), never the list container or',
|
|
157
|
+
'an empty-state view (a container id is there when the list is empty too; `hidden_ids` often holds the',
|
|
158
|
+
"empty-state placeholder, usable under `none`). Answer verdict 'unevaluable' with `why` when no screen shows",
|
|
159
|
+
'the requirement (a code branch with no visible effect). Pages in `pages_behind` already count as evidence',
|
|
160
|
+
'when they render; do not repeat them as clauses.',
|
|
161
|
+
].join(' ');
|
|
162
|
+
|
|
163
|
+
/** extract(root): the worklist of requirements still to compile. */
|
|
164
|
+
export function extract(root) {
|
|
165
|
+
const doc = load(pJoin(root, 'campaign.json'), {});
|
|
166
|
+
const done = get(load(pJoin(root, PREDICATES_FILE), {}), 'items', {}) || {};
|
|
167
|
+
const texts = screenTexts(doc);
|
|
168
|
+
const guarded = guardedPages(doc);
|
|
169
|
+
// pages the device showed (any state): a predicate over one of them can be decided at once
|
|
170
|
+
const captures = verifiedPages(root);
|
|
171
|
+
const nodes = get(doc, 'nodes', []) || [];
|
|
172
|
+
const items = [];
|
|
173
|
+
for (const [r, phases] of planRequirements(doc)) {
|
|
174
|
+
if (Object.hasOwn(done, r)) { continue; }
|
|
175
|
+
const j = parsed(r);
|
|
176
|
+
// the page whose source states the requirement, when the guard says where
|
|
177
|
+
const at = pyStr(get(j, 'at', '') || '').replace(/:\d+$/, '');
|
|
178
|
+
const anchors = at ? nodes.filter((n) => declFile(n) === at).map((n) => n.id) : [];
|
|
179
|
+
const behind = [...(guarded.get(r) ?? [])];
|
|
180
|
+
const candidates = [...new Set([...anchors, ...[...captures.keys()].filter((p) => !behind.includes(p))])].slice(0, MAX_PAGES);
|
|
181
|
+
items.push({ key: requirementKey(r), requirement: r, kind: get(j, 'kind'), text: get(j, 'text'), at: get(j, 'at', null),
|
|
182
|
+
phases, pages_behind: behind.slice(0, 20), candidate_pages: candidates.map((p) => pageFacts(doc, texts, p, root, captures)) });
|
|
183
|
+
}
|
|
184
|
+
const wl = { schema: 'utg-predicates-worklist/1', question: QUESTION, count: items.length, items };
|
|
185
|
+
atomicWriteJson(pJoin(root, 'predicates_worklist.json'), wl);
|
|
186
|
+
return wl;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function selectorProblem(s, facts) {
|
|
190
|
+
if (!isDict(s) || !Object.keys(s).length) { return 'a selector must be a non-empty object'; }
|
|
191
|
+
const extra = Object.keys(s).filter((k) => !SELECTOR_KEYS.has(k));
|
|
192
|
+
if (extra.length) { return `unsupported selector field(s) ${extra.join(', ')} (use resource_name, text, content_desc)`; }
|
|
193
|
+
if (Object.hasOwn(s, 'resource_name') && !facts.ids.has(pyStr(s.resource_name))) {
|
|
194
|
+
return `resource_name ${pyStr(s.resource_name)} is neither an id of ${facts.page}'s layout nor shown on a capture of it`;
|
|
195
|
+
}
|
|
196
|
+
for (const k of ['text', 'content_desc']) {
|
|
197
|
+
if (Object.hasOwn(s, k) && !facts.texts.has(normalized(pyStr(s[k])))) { return `${k} ${JSON.stringify(s[k])} is not a text ${facts.page} shows`; }
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** validate(answer, doc, factsOf): null, or why the answer is rejected (factsOf(page) -> groundingFacts). */
|
|
203
|
+
export function validate(a, doc, factsOf) {
|
|
204
|
+
const verdict = get(a, 'verdict');
|
|
205
|
+
if (verdict === 'unevaluable') { return truthy(get(a, 'why')) ? null : 'unevaluable needs a why'; }
|
|
206
|
+
if (verdict !== 'predicate') { return "verdict must be 'predicate' or 'unevaluable'"; }
|
|
207
|
+
const clauses = get(a, 'clauses');
|
|
208
|
+
if (!Array.isArray(clauses) || !clauses.length) { return 'a predicate needs at least one clause'; }
|
|
209
|
+
const catalog = get(doc, 'page_catalog', {}) || {};
|
|
210
|
+
for (const c of clauses) {
|
|
211
|
+
if (!isDict(c) || !Object.hasOwn(catalog, pyStr(get(c, 'page')))) { return `unknown page ${pyStr(get(c, 'page'))}`; }
|
|
212
|
+
if (!truthy(get(c, 'rule'))) { continue; }
|
|
213
|
+
if (!isDict(c.rule) || Object.keys(c.rule).some((k) => !RULE_KEYS.has(k))) { return 'rule keys are all / any / none'; }
|
|
214
|
+
if (Object.keys(c.rule).some((k) => !Array.isArray(c.rule[k]))) { return 'each rule key (all/any/none) must be an array'; }
|
|
215
|
+
if (!(get(c.rule, 'all', []) || []).length && !(get(c.rule, 'any', []) || []).length) {
|
|
216
|
+
return 'a rule needs all or any (none alone matches every other screen)';
|
|
217
|
+
}
|
|
218
|
+
const facts = factsOf(c.page);
|
|
219
|
+
for (const k of RULE_KEYS) {
|
|
220
|
+
for (const s of get(c.rule, k, []) || []) {
|
|
221
|
+
const why = selectorProblem(s, facts);
|
|
222
|
+
if (why) { return why; }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** apply(root): merge accepted answers into predicates.json; returns the report rows. */
|
|
230
|
+
export function apply(root) {
|
|
231
|
+
const doc = load(pJoin(root, 'campaign.json'), {});
|
|
232
|
+
const wl = load(pJoin(root, 'predicates_worklist.json'), { items: [] });
|
|
233
|
+
const raw = load(pJoin(root, 'predicates_answers.json'), []);
|
|
234
|
+
const answers = Array.isArray(raw) ? raw : get(raw, 'items', []) || [];
|
|
235
|
+
const byKey = new Map((get(wl, 'items', []) || []).map((i) => [i.key, i]));
|
|
236
|
+
const texts = screenTexts(doc);
|
|
237
|
+
const captures = verifiedPages(root);
|
|
238
|
+
const factsOf = (page) => groundingFacts(doc, texts, root, captures, page);
|
|
239
|
+
const out = load(pJoin(root, PREDICATES_FILE), { schema: 'utg-predicates/1', items: {} });
|
|
240
|
+
const report = [];
|
|
241
|
+
for (const a of answers) {
|
|
242
|
+
const it = byKey.get(pyStr(get(a, 'key')));
|
|
243
|
+
if (!it) { report.push({ key: get(a, 'key'), status: 'rejected', why: 'unknown key' }); continue; }
|
|
244
|
+
const why = validate(a, doc, factsOf);
|
|
245
|
+
if (why) { report.push({ key: it.key, status: 'rejected', why }); continue; }
|
|
246
|
+
out.items[it.requirement] = a.verdict === 'predicate'
|
|
247
|
+
? { key: it.key, status: 'compiled', source: 'review', clauses: a.clauses.map((c) => ({ page: c.page, ...(truthy(c.rule) ? { rule: canonicalRule(c.rule, factsOf(c.page)) } : {}) })) }
|
|
248
|
+
: { key: it.key, status: 'unevaluable', source: 'review', why: a.why };
|
|
249
|
+
report.push({ key: it.key, status: out.items[it.requirement].status });
|
|
250
|
+
}
|
|
251
|
+
out.schema = 'utg-predicates/1';
|
|
252
|
+
atomicWriteJson(pJoin(root, PREDICATES_FILE), out);
|
|
253
|
+
atomicWriteJson(pJoin(root, 'predicates_report.json'), report);
|
|
254
|
+
return report;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export function main(argv = process.argv.slice(2)) {
|
|
258
|
+
const ap = new ArgumentParser({ prog: 'predicates.mjs' });
|
|
259
|
+
ap.add_argument('mode', { choices: ['extract', 'apply'] });
|
|
260
|
+
ap.add_argument('campaign');
|
|
261
|
+
const a = ap.parse_args(argv);
|
|
262
|
+
const root = pathStr(a.campaign);
|
|
263
|
+
if (a.mode === 'extract') { pyPrint(jsonDumps({ items: extract(root).count })); return; }
|
|
264
|
+
const rep = apply(root);
|
|
265
|
+
const counts = {};
|
|
266
|
+
for (const r of rep) { counts[r.status] = (counts[r.status] || 0) + 1; }
|
|
267
|
+
pyPrint(jsonDumps({ items: counts }));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { runMain(main); }
|
|
@@ -58,6 +58,8 @@ function loadEvents(campaign) {
|
|
|
58
58
|
mapped.add(p.observation_id);
|
|
59
59
|
prevMappedByEnv.set(e.environment_id || 'default', p.static_id);
|
|
60
60
|
} else if (e.kind === 'observation') {
|
|
61
|
+
// A dump with nothing usable of a non-blank screen (tree_unreliable): no surface can be read from it.
|
|
62
|
+
if (p.tree_unreliable || (p.static_resolution || {}).status === 'tree-unreliable') { continue; }
|
|
61
63
|
obs.set(p.observation_id, { nodes: p.nodes || [], activity: p.activity, env: e.environment_id, ts: e.ts, sweep: p.sweep || null });
|
|
62
64
|
const pm = prevMappedByEnv.get(e.environment_id || 'default');
|
|
63
65
|
if (pm) lastPage.set(p.observation_id, pm);
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { atomicWriteJson, event } from './utg_explorer/adapters.mjs';
|
|
25
25
|
import { strongOther } from './utg_explorer/attest.mjs';
|
|
26
26
|
import { addItemFilterArgs, nodeFilter, unmappedOnly } from './utg_explorer/coverage.mjs';
|
|
27
|
-
import { buildCatalog, learnedRuleMatches, occludedIndices, panelHost, resolvePage, resolveTwinByOpener } from './utg_explorer/semantics.mjs';
|
|
27
|
+
import { buildCatalog, learnedRuleMatches, occludedIndices, panelHost, resolvePage, resolveTwinByOpener, keepTreeUnreliable } from './utg_explorer/semantics.mjs';
|
|
28
28
|
import { augmentCatalog } from './compile_tasks.mjs';
|
|
29
29
|
import { appendEvents, clickPathsOf, freshIdentity, rejudge } from './rejudge.mjs';
|
|
30
30
|
|
|
@@ -389,8 +389,9 @@ export function apply(doc, graph, project, pkg, root) {
|
|
|
389
389
|
for (const e of doc.events) {
|
|
390
390
|
if (e.kind === 'observation') {
|
|
391
391
|
const o = e.payload;
|
|
392
|
-
|
|
393
|
-
|
|
392
|
+
const before = get(o, 'static_resolution', {});
|
|
393
|
+
dset(o, 'static_resolution', keepTreeUnreliable(o, before, resolveTwinByOpener(resolvePage(o, cat, freshIdentity(o), { app_package: pkg }),
|
|
394
|
+
prior.get(e.environment_id), cat)));
|
|
394
395
|
prior.set(e.environment_id, o);
|
|
395
396
|
obs.set(o.observation_id, o);
|
|
396
397
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Exports: MAX_SETUP_STEPS, REPLAY, MAX_REPLAY_STEPS, load, snapshotNames, outputName, extract,
|
|
11
11
|
* checkSteps, knownTexts, screenTexts, fixtureServerTexts, groundingProblem, stepFailedPhases, stepFailures,
|
|
12
|
-
* revisablePhases, validate, apply, main
|
|
12
|
+
* revisablePhases, snapshotLandings, baseProblem, validate, apply, main
|
|
13
13
|
*/
|
|
14
14
|
import * as fs from 'node:fs';
|
|
15
15
|
import * as path from 'node:path';
|
|
@@ -22,6 +22,8 @@ import { atomicWriteJson } from './utg_explorer/adapters.mjs';
|
|
|
22
22
|
import { addItemFilterArgs, nodeFilter, scopeOf, unmappedOnly } from './utg_explorer/coverage.mjs';
|
|
23
23
|
import { KEYS, MAX_STEPS, STEP_TYPES, overrideFor, selectorProblem, toRunner } from './recover_b.mjs';
|
|
24
24
|
import { unrunnable } from './close_phases.mjs';
|
|
25
|
+
import { isServed } from './schedule_states.mjs';
|
|
26
|
+
import { loadStates } from './utg_explorer/states.mjs';
|
|
25
27
|
import { addVariant } from './variant.mjs';
|
|
26
28
|
import { normalized } from './utg_explorer/strings.mjs';
|
|
27
29
|
|
|
@@ -52,10 +54,13 @@ const keyOf = (v) => sha256Hex(Buffer.from(jsonDumps(v, { sort_keys: true }), 'u
|
|
|
52
54
|
|
|
53
55
|
/**
|
|
54
56
|
* Phases D should build a state for: blocked ones, and pending ones no fixture/probe can enter
|
|
55
|
-
* (close_phases only marks those `blocked` at the end of the cycle, after D has run).
|
|
57
|
+
* (close_phases only marks those `blocked` at the end of the cycle, after D has run). A phase a
|
|
58
|
+
* known state already serves (schedule_states.mjs) is not one, and neither is a state phase
|
|
59
|
+
* itself (`st-*`: its origin phase is offered once it no longer counts as served).
|
|
56
60
|
*/
|
|
57
61
|
export function phasesNeedingState(doc, config) {
|
|
58
|
-
return doc.phases.filter((p) => !p.id.startsWith('rec') &&
|
|
62
|
+
return doc.phases.filter((p) => !p.id.startsWith('rec') && !p.id.startsWith('st-') && !isServed(doc, p)
|
|
63
|
+
&& (p.status === 'blocked' || unrunnable(p, config, doc)));
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
/**
|
|
@@ -322,7 +327,7 @@ function recipeFixtures(r, config) {
|
|
|
322
327
|
save = { type: 'save_replay', archive, steps: full, from: r.base };
|
|
323
328
|
} else {
|
|
324
329
|
restore = [{ type: 'restore_app_data', archive: pJoin(snapDir, r.base),
|
|
325
|
-
clear_dirs:
|
|
330
|
+
clear_dirs: 'all' }, launch, { type: 'wait', seconds: 2 }];
|
|
326
331
|
save = { type: 'snapshot_app_data', archive };
|
|
327
332
|
}
|
|
328
333
|
const fixtures = [...restore, ...r.steps.map((s) => tagged(s, 'steps')),
|
|
@@ -399,7 +404,9 @@ export function extract(doc, root, config, unmapped = false) {
|
|
|
399
404
|
'a feed URL that returns an error; never modify existing files. Give positive probes proving ' +
|
|
400
405
|
'the state on the screen the app shows after relaunch. Choose probe texts that are on that ' +
|
|
401
406
|
'screen at rest: a section title that only appears while scrolling (sticky header) or inside ' +
|
|
402
|
-
"a dialog is not.
|
|
407
|
+
"a dialog is not. `snapshot_landings` shows the screen each base lands on after relaunch: a recipe's " +
|
|
408
|
+
'steps start there (a base landing on an agreement or login screen needs steps through it). ' +
|
|
409
|
+
"A `probe-revision` item is a recipe whose steps ran but whose probe did not " +
|
|
403
410
|
"match: answer it with verdict 'revise' and new `probes` whose texts are all in its " +
|
|
404
411
|
"`visible_texts` (open its `screenshot`) and that tell the target state apart from the base " +
|
|
405
412
|
"one, or verdict 'skipped' when that screen is not the wanted state. Every text or " +
|
|
@@ -413,6 +420,9 @@ export function extract(doc, root, config, unmapped = false) {
|
|
|
413
420
|
screen_texts: Object.fromEntries([...screenTexts(doc).entries()].sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0))
|
|
414
421
|
.map(([sid, list]) => [sid, list.slice(0, SCREEN_TEXTS_PER_PAGE)])),
|
|
415
422
|
snapshots: snapshotNames(snapDir),
|
|
423
|
+
// what each base holds: the screen a cold launch shows on its data (states.json). A recipe
|
|
424
|
+
// starts from this screen, so its steps must lead from it to the probed one.
|
|
425
|
+
snapshot_landings: snapshotLandings(root, snapshotNames(snapDir)),
|
|
416
426
|
fixture_server_files: feedDir && pIsDir(feedDir) ? sortedStr(listDirNames(feedDir).map((e) => e.name)) : [],
|
|
417
427
|
fixture_feed: feedDir && pIsFile(pJoin(feedDir, 'feed.xml')) ? readText(pJoin(feedDir, 'feed.xml'), { encoding: 'utf-8' }) : null };
|
|
418
428
|
atomicWriteText(pJoin(root, 'recovery_d_worklist.json'), jsonDumps(wl, { ensure_ascii: false, indent: 1 }));
|
|
@@ -462,9 +472,57 @@ export function checkRevisedProbes(probes, visible) {
|
|
|
462
472
|
}
|
|
463
473
|
return null;
|
|
464
474
|
}
|
|
475
|
+
/** The state whose archive file is named `name` (paths in states.json may be Windows or POSIX). */
|
|
476
|
+
const stateOfArchive = (states, name) => states.find((x) => T(x.archive) && pyStr(x.archive).split(/[/\\]/).pop() === name);
|
|
477
|
+
|
|
478
|
+
/** base snapshot name -> its recorded landing (states.json), for the worklist. */
|
|
479
|
+
export function snapshotLandings(root, names) {
|
|
480
|
+
const states = root ? loadStates(root).states : [];
|
|
481
|
+
const out = {};
|
|
482
|
+
for (const n of names) {
|
|
483
|
+
const s = stateOfArchive(states, n);
|
|
484
|
+
const l = get(s ?? {}, 'landing');
|
|
485
|
+
if (l) { out[n] = { state: s.id, activity: l.activity, page: l.static_id, texts: (l.texts || []).slice(0, 15) }; }
|
|
486
|
+
}
|
|
487
|
+
return out;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* baseProblem(r, landing): a recipe with no step that changes the screen (waits only, no
|
|
492
|
+
* probe_steps) whose probe cannot match the screen its base lands on. Such a recipe can only
|
|
493
|
+
* re-read the base: measured (universalapp TV 2026-11-25), six "devices" recipes were [wait] on a
|
|
494
|
+
* first-launch base that lands on the agreement dialog, and each blocked state-probe-failed on
|
|
495
|
+
* the device. Decided from the recorded landing only when a probe names an activity or a text
|
|
496
|
+
* / resource id the landing does not have (content_desc and unknown fields never reject).
|
|
497
|
+
*/
|
|
498
|
+
export function baseProblem(r, landing) {
|
|
499
|
+
if (!isDict(landing)) { return null; }
|
|
500
|
+
const steps = [...or_(get(r, 'steps'), []), ...or_(get(r, 'probe_steps'), [])];
|
|
501
|
+
if (steps.some((s) => get(s, 'type') !== 'wait')) { return null; }
|
|
502
|
+
const texts = new Set((landing.texts || []).map((t) => normalized(pyStr(t))));
|
|
503
|
+
const ids = new Set((landing.ids || []).map((x) => pyStr(x)));
|
|
504
|
+
const tails = new Set([...ids].map((x) => x.split('/').pop()));
|
|
505
|
+
const missing = (sel) => {
|
|
506
|
+
if (!isDict(sel)) { return null; }
|
|
507
|
+
if (Object.hasOwn(sel, 'text') && !texts.has(normalized(pyStr(sel.text)))) { return `text ${JSON.stringify(sel.text)}`; }
|
|
508
|
+
if (Object.hasOwn(sel, 'resource_id') && !ids.has(pyStr(sel.resource_id))) { return `resource_id ${pyStr(sel.resource_id)}`; }
|
|
509
|
+
if (Object.hasOwn(sel, 'resource_name') && !tails.has(pyStr(sel.resource_name))) { return `resource_name ${pyStr(sel.resource_name)}`; }
|
|
510
|
+
return null;
|
|
511
|
+
};
|
|
512
|
+
for (const p of or_(get(r, 'probes'), [])) {
|
|
513
|
+
let why = T(get(p, 'activity')) && T(landing.activity) && p.activity !== landing.activity ? `activity ${pyStr(p.activity)}` : null;
|
|
514
|
+
for (const sel of or_(get(p, 'all'), [])) { why = why ?? missing(sel); }
|
|
515
|
+
if (!why && T(get(p, 'any')) && p.any.every((sel) => missing(sel))) { why = 'none of its any-selectors'; }
|
|
516
|
+
if (why) {
|
|
517
|
+
return `steps only wait, but base ${pyStr(r.base)} lands on ${pyStr(landing.static_id || landing.activity)}, which does not show the probe's ${why}: add the steps that lead from that screen to the state`;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
|
|
465
523
|
const FILE_RE = /^[\p{L}\p{N}_.-]{1,40}\.(xml|json|txt|srt|vtt|html)$/u;
|
|
466
524
|
|
|
467
|
-
export function validate(r, doc, config) {
|
|
525
|
+
export function validate(r, doc, config, root = null) {
|
|
468
526
|
if (!ID_RE.test(pyStr(get(r, 'id', '')))) { return 'recipe id must be [a-z0-9-]{2,32}'; }
|
|
469
527
|
const snapDir = pathStr(get(config, 'snapshot_dir', ''));
|
|
470
528
|
const base = pyStr(get(r, 'base', ''));
|
|
@@ -503,7 +561,8 @@ export function validate(r, doc, config) {
|
|
|
503
561
|
why = checkSteps(ts[tid], MAX_STEPS);
|
|
504
562
|
if (why) { return `${tid}: ${why}`; }
|
|
505
563
|
}
|
|
506
|
-
|
|
564
|
+
const landing = root ? get(stateOfArchive(loadStates(root).states, base) ?? {}, 'landing') : null;
|
|
565
|
+
return baseProblem(r, landing) ?? groundingProblem(r, knownTexts(doc), [], fixtureServerTexts(config));
|
|
507
566
|
}
|
|
508
567
|
|
|
509
568
|
/**
|
|
@@ -583,7 +642,7 @@ export function apply(doc, config, root) {
|
|
|
583
642
|
tasks: doc.tasks.filter((t) => t.phase === existing.id).length, archive: pJoin(snapDir, outputName(r.base, r.id)) });
|
|
584
643
|
continue;
|
|
585
644
|
}
|
|
586
|
-
const why = ids.has(get(r, 'id')) ? 'duplicate recipe id' : validate(r, doc, config);
|
|
645
|
+
const why = ids.has(get(r, 'id')) ? 'duplicate recipe id' : validate(r, doc, config, root);
|
|
587
646
|
if (why) { report.push({ ...(key !== null ? { key } : {}), id: get(r, 'id'), status: 'rejected', why }); continue; }
|
|
588
647
|
ids.add(r.id);
|
|
589
648
|
for (const f of get(r, 'fixture_files', [])) { writeText(pJoin(feedDir, f.name), f.content); }
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
pathStr, pyPrint, pyStr, readText, appendText, runMain, truthy, tupleKey,
|
|
17
17
|
} from './utg_explorer/_py.mjs';
|
|
18
18
|
import { atomicWriteJson, event } from './utg_explorer/adapters.mjs';
|
|
19
|
-
import { buildCatalog, observationMatchesStatic, resolvePage, resolveTwinByOpener } from './utg_explorer/semantics.mjs';
|
|
19
|
+
import { buildCatalog, observationMatchesStatic, resolvePage, resolveTwinByOpener, keepTreeUnreliable } from './utg_explorer/semantics.mjs';
|
|
20
20
|
import { rebuild as chainRebuild, validate as chainValidate } from './utg_explorer/chain.mjs';
|
|
21
21
|
import { triggerAttests } from './utg_explorer/attest.mjs';
|
|
22
22
|
import { augmentCatalog } from './compile_tasks.mjs';
|
|
@@ -57,8 +57,9 @@ export function rejudge(doc, graph, project, pkg, locale = null) {
|
|
|
57
57
|
for (const e of doc.events) {
|
|
58
58
|
if (e.kind !== 'observation') { continue; }
|
|
59
59
|
const o = e.payload;
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const before = get(o, 'static_resolution', {});
|
|
61
|
+
dset(o, 'static_resolution', keepTreeUnreliable(o, before, resolveTwinByOpener(resolvePage(o, cat, freshIdentity(o), { app_package: pkg }),
|
|
62
|
+
prior.get(e.environment_id), cat)));
|
|
62
63
|
prior.set(e.environment_id, o);
|
|
63
64
|
obs.set(o.observation_id, o);
|
|
64
65
|
const r = o.static_resolution;
|
|
@@ -18,6 +18,7 @@ import { graph } from './evidence.mjs';
|
|
|
18
18
|
import { readJson, atomicWriteJson } from './utg_explorer/adapters.mjs';
|
|
19
19
|
import { buildCatalog } from './utg_explorer/semantics.mjs';
|
|
20
20
|
import { exportFinal } from './final_utg.mjs';
|
|
21
|
+
import { hostsTried } from './utg_explorer/hosts.mjs';
|
|
21
22
|
import { COLLAPSE_MIN_CASCADE, collapsedPrefixes, collapseNote, presentEntities, seedPlan, seedNote } from './utg_explorer/diagnostics.mjs';
|
|
22
23
|
|
|
23
24
|
/** The static layer's data_model.json next to the campaign's static utg.json, or null. */
|
|
@@ -42,8 +43,10 @@ export function latestTaskResults(events) {
|
|
|
42
43
|
export function dataPrerequisites(gaps) {
|
|
43
44
|
const by = new Map();
|
|
44
45
|
for (const g of gaps) {
|
|
45
|
-
// Drop the cascade note gapsOf appends, or it lands inside the captured empty-state texts
|
|
46
|
-
|
|
46
|
+
// Drop the cascade note gapsOf appends, or it lands inside the captured empty-state texts; and the
|
|
47
|
+
// hosts-tried / candidate notes the gap loop appends after it.
|
|
48
|
+
const reason = pyStr(get(g, 'reason', '')).replace(/; (?:hosts tried|unconfirmed tree-unreliable capture\(s\)): .*$/, '')
|
|
49
|
+
.replace(/ \(not run: cascaded from .*\)$/, '');
|
|
47
50
|
const m = /^needs-(data|network):(\S+)(?: \((.*)\))?$/.exec(reason);
|
|
48
51
|
if (!m) { continue; }
|
|
49
52
|
const k = m[1] + '|' + m[2];
|
|
@@ -101,6 +104,25 @@ export function main(argv = process.argv.slice(2)) {
|
|
|
101
104
|
}
|
|
102
105
|
const latest = new Map();
|
|
103
106
|
for (const e of doc.events) { if (e.kind === 'task_result') { latest.set(vk(get(e.payload, 'target_static')), e.payload); } }
|
|
107
|
+
// Every task result per target (the last of each task), and the unconfirmed tree-unreliable
|
|
108
|
+
// captures a task expected to be its target: a gap lists every host tried and those candidates.
|
|
109
|
+
const taskById = new Map(get(doc, 'tasks', []).map((t) => [t.task_id, t]));
|
|
110
|
+
const resultsByTarget = new Map();
|
|
111
|
+
for (const e of latestTaskResults(doc.events)) {
|
|
112
|
+
if (e.kind !== 'task_result') { continue; }
|
|
113
|
+
const tid = get(e.payload, 'task_id');
|
|
114
|
+
const target = or(get(e.payload, 'target_static'), get(taskById.get(tid) ?? taskById.get(S(tid).split('@')[0]) ?? {}, 'target_static'));
|
|
115
|
+
if (!truthy(target)) { continue; }
|
|
116
|
+
if (!resultsByTarget.has(target)) { resultsByTarget.set(target, []); }
|
|
117
|
+
resultsByTarget.get(target).push(e.payload);
|
|
118
|
+
}
|
|
119
|
+
const candidatesOf = new Map();
|
|
120
|
+
for (const e of doc.events) {
|
|
121
|
+
if (e.kind !== 'candidate_capture') { continue; }
|
|
122
|
+
const sid = get(e.payload, 'static_id');
|
|
123
|
+
if (!candidatesOf.has(sid)) { candidatesOf.set(sid, []); }
|
|
124
|
+
if (!candidatesOf.get(sid).includes(e.payload.observation_id)) { candidatesOf.get(sid).push(e.payload.observation_id); }
|
|
125
|
+
}
|
|
104
126
|
const gaps = [];
|
|
105
127
|
for (const node of result.missing_nodes) {
|
|
106
128
|
const ident = node.id; const item = cget(ident);
|
|
@@ -118,7 +140,15 @@ export function main(argv = process.argv.slice(2)) {
|
|
|
118
140
|
}
|
|
119
141
|
const gap = {};
|
|
120
142
|
for (const k of keysOf(node)) { dset(gap, k, node[k]); }
|
|
143
|
+
const hosts = hostsTried((resultsByTarget.get(ident) ?? []).filter((r) => r.outcome !== 'confirmed'), taskById);
|
|
144
|
+
if (hosts.length >= 2) {
|
|
145
|
+
reason = `${S(reason)}; hosts tried: ${hosts.map((h) => `${h.source} (${S(or(h.reason, h.outcome))})`).join('; ')}`;
|
|
146
|
+
}
|
|
147
|
+
const cands = candidatesOf.get(ident) ?? [];
|
|
148
|
+
if (cands.length) { reason = `${S(reason)}; unconfirmed tree-unreliable capture(s): ${cands.slice(0, 3).join(', ')}`; }
|
|
121
149
|
gap.reason = reason; gap.basis = get(item, 'basis', []); gap.observation_id = get(task, 'observation_id');
|
|
150
|
+
if (hosts.length >= 2) { gap.hosts_tried = hosts; }
|
|
151
|
+
if (cands.length) { gap.candidate_observations = cands; }
|
|
122
152
|
gaps.push(gap);
|
|
123
153
|
}
|
|
124
154
|
atomicWriteJson(pJoin(root, 'gaps.json'), gaps);
|