@buaa_smat/hometrans 26.0.6 → 26.0.8
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 +6 -3
- package/agents/a2h-executor.md +37 -0
- package/dist/cli/editors.json +13 -0
- package/dist/platform/compose.js +4 -0
- package/dist/platform/registry.js +3 -1
- package/dist/platform/transform.js +37 -3
- package/env-requirements.json +15 -1
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +2 -2
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +1 -1
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +13 -6
- package/i18n/skills/a2h-app-migrate/SKILL.md +2 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +27 -4
- package/i18n/skills/a2h-app-migrate/scripts/opencode_depth.mjs +418 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +7 -7
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +20 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +3 -3
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +3 -1
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +10 -6
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +13 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +59 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +3 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/interactions.mjs +186 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +33 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +83 -22
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +39 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +25 -1
- package/i18n/skills/a2h-page-specgen/SKILL.md +1 -1
- package/i18n/skills/a2h-page-specgen/references/gates.md +3 -1
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +11 -11
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +3 -3
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +40 -3
- package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +73 -5
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +144 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +10 -10
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +11 -11
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +45 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +100 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +132 -3
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +36 -1
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +16 -0
- package/i18n/skills/a2h-utg-static/SKILL.md +2 -0
- package/package.json +1 -1
- package/platforms/atomcode/agents/a2h-executor.frontmatter.md +6 -0
- package/platforms/codebuddy/agents/a2h-executor.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +2 -2
- package/platforms/deveco/agents/a2h-executor.frontmatter.md +7 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +0 -2
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +0 -2
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +0 -2
- package/platforms/deveco/agents/model-worker.frontmatter.md +0 -2
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +0 -2
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +1 -1
- package/platforms/opencode/agents/a2h-executor.frontmatter.md +7 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +0 -2
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +0 -2
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +0 -2
- package/platforms/opencode/agents/model-worker.frontmatter.md +0 -2
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +0 -2
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +13 -6
- package/skills/a2h-app-migrate/SKILL.md +29 -3
- package/skills/a2h-app-migrate/references/host-rules.md +33 -0
- package/skills/a2h-app-migrate/references/workflow.yaml +24 -4
- package/skills/a2h-app-migrate/scripts/opencode_depth.mjs +418 -0
- package/skills/a2h-app-migrate/test/test_executor_header_sync.mjs +78 -0
- package/skills/a2h-app-migrate/test/test_opencode_depth.mjs +312 -0
- package/skills/a2h-app-migrate/tools/dag.mjs +267 -0
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
- package/skills/a2h-batch-ui-align/SKILL.md +7 -7
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -1
- package/skills/a2h-batch-ui-align/references/cards/state.md +20 -2
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +3 -3
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +3 -1
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +5 -5
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +2 -2
- package/skills/a2h-batch-ui-align/references/step3-capture.md +10 -6
- package/skills/a2h-batch-ui-align/references/step5-convert.md +13 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +59 -7
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +3 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +3 -2
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +139 -23
- package/skills/a2h-batch-ui-align/scripts/host_env.mjs +32 -8
- package/skills/a2h-batch-ui-align/scripts/interactions.mjs +186 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +33 -7
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +83 -22
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +39 -5
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +82 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +25 -1
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +184 -2
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +33 -0
- package/skills/a2h-batch-ui-align/scripts/tests/interactions.test.mjs +258 -0
- package/skills/a2h-page-specgen/SKILL.md +1 -1
- package/skills/a2h-page-specgen/references/evidence.md +15 -0
- package/skills/a2h-page-specgen/references/gates.md +3 -1
- package/skills/a2h-page-specgen/references/scenario-authoring.md +10 -10
- package/skills/a2h-page-specgen/references/spec-template.md +2 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +40 -3
- package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +73 -5
- package/skills/a2h-page-specgen/scripts/gate.mjs +141 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +10 -10
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +45 -1
- package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +100 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +104 -3
- package/skills/a2h-resource-convert/references/conversion-rules.md +2 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +36 -1
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +42 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +1 -1
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +16 -0
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +5 -1
- 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/document/checker/hometrans/arkui-runtime-pitfall-cn.md +2 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +3 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-v2-observation-cn.md +105 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-v2-observation-en.md +122 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +4 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIV2ObservationCheck.js +1862 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +2 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +15 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +20 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_v2_observation.ts +284 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +32 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +22 -1
- package/skills/a2h-utg-static/SKILL.md +2 -0
- package/skills/a2h-utg-static/references/extractors.md +16 -0
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +22 -1
- package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +4 -0
- package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +15 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_attachments.mjs +330 -0
- package/skills/a2h-utg-static/scripts/view_attachments.mjs +465 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +0 -5
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +0 -5
|
@@ -130,10 +130,10 @@ Only the `screenshot.png` + `view.xml` + `meta.json` of the pages in `SCOPE` are
|
|
|
130
130
|
node compile_tasks.mjs $S/utg.json $C --project <android_project_dir> --locale <device locale>
|
|
131
131
|
```
|
|
132
132
|
`--scope` automatically includes the menus / ui-states / modes / embedded fragments attached to members (host resolution is the same as in `build_conversion_set.mjs`); after changing only `utg.json`, `plan.mjs --extend` without `--scope` also recomputes the scope against the new graph. Nodes outside the scope are treated as settled: the device stage skips tasks targeting them (`task_skipped: target-out-of-scope`; paths to members still pass through them), the A–D and direct-launch review lists exclude them, and `capture_pending.json` lists only members. So review volume and device time scale with the number of members, not the whole app.
|
|
133
|
-
2. **Add `--skip D` to `run_cycle.mjs
|
|
133
|
+
2. **Add `--skip D` to `run_cycle.mjs`, and leave `reset_between_tasks` out of `config.json`**, unless the user explicitly agrees to changing app data. Incremental mode often faces an app the user is actively using; D runs `pm clear` and fabricates data per recipe, and `reset_between_tasks` runs `pm clear` before every `p0-fresh` task. `--skip D` skips only D and the fresh snapshot, not the latter, so do both. Data states the members need therefore go into `deferred_human.json` and are reported in Step 7.
|
|
134
134
|
3. **`--max-rounds 1`** is usually enough (few members; one round of direct launch settles them); relax it only when some member still answered `launch` without being covered.
|
|
135
135
|
|
|
136
|
-
Everything else (config.json
|
|
136
|
+
Everything else (config.json apart from item 2's `reset_between_tasks`, reviewer sub-agents, the watchdog, running in the background with `detach.mjs`) is copied from Step 3.2.
|
|
137
137
|
|
|
138
138
|
**Build the plan** (after `run_cycle.mjs` prints `finished: true`, the same as full-mode Step 3.2 item 5, with two extra arguments):
|
|
139
139
|
```bash
|
|
@@ -59,8 +59,8 @@ A refused merge names the stage and missing keys; re-dispatch only those parts.
|
|
|
59
59
|
**Reviewer waves (Steps 3.1 and 3.2).** Do not dispatch reviewers as a blocking wave. A blocking wave returns only when its slowest member returns, so one hung agent stalls the whole run: a single reviewer whose connection drops can hold its wave for hours after the others have finished. Instead (Step 0.1):
|
|
60
60
|
- write each part's prompt to `${harmony_project_dir}/.hometrans/work/prompts/<stage>_part<N>.md` and dispatch one **background sub-agent** per part, all in one message: "Read `<that file>` and follow it fully; reply `DONE <stage>_part<N>`." Record each one as you dispatch it with `node ./scripts/group_queue.mjs review-bind ${harmony_project_dir} --name <stage>_part<N> --answers <abs answers path> --task <handle>`. This writes `.hometrans/work/reviewers.json`, which the queue counts against `--max-agents`. Use `--kind skill-agent` for an agent that is not a reviewer, such as the Step 2 resource agent; it does not count. A binding stops counting by itself once its part is consumed (the explorer merged or re-split the parts); a reviewer that ended without its answers is released with `group_queue.mjs review-unbind ${harmony_project_dir} --name <part>`. Never hand-edit that file, and never re-bind a finished reviewer as `skill-agent` to free its slot;
|
|
61
61
|
- the answers file is the completion signal, never the agent: a part is done when `node ./scripts/answers_check.mjs <answers path>` reports `complete` (it parses and covers every key of the sibling `*_worklist.part<N>.json`); a reviewer whose answers are complete can stay "running" for hours;
|
|
62
|
-
- an `nl_hints` or `view_interactions` part is done only when, in addition, `node <a2h-utg-explorer skill>/scripts/hint_check.mjs --project <Android source root> <answers path>` exits 0 (`bad=0`). Its reviewer writes every key first and then rewrites hints in place, so `complete` alone means it may still be fixing them. While `bad>0`, keep the part
|
|
63
|
-
-
|
|
62
|
+
- an `nl_hints` or `view_interactions` part is done only when, in addition, `node <a2h-utg-explorer skill>/scripts/hint_check.mjs --project <Android source root> <answers path>` exits 0 (`bad=0`). Its reviewer writes every key first and then rewrites hints in place, so `complete` alone means it may still be fixing them. While `bad>0`, keep waiting on the part across turns (one wait per shell call); do not merge, apply or stop it. If its agent ends with `bad>0`, resume it in its own session with the lines `hint_check` prints;
|
|
63
|
+
- wait with `node ./scripts/group_queue.mjs wait ${harmony_project_dir}` (plus `--job run_cycle` in Step 3.2 while it runs), one wait per shell call. Never loop several waits inside one shell call: handle each return before the next wait. It follows every reviewer bound with `review-bind` that is not done or consumed, so no `--answers` is needed for them; pass `--answers <path>` (once per path) only for an answers file you did not bind. A job exit is reported once: a later `wait --job run_cycle` does not return again for the same exit, only after a restart ends. It returns when one becomes complete (`answers_complete`; each completion is reported once per bind, including one that completed after the previous wait returned), has been silent for the stall limit (`answers_silent`; counted from the file's last write, or from its bind when it has never been written; `stall_limit_min` in the output, at least 20 min and scaled up with load), or after 5 min (a larger `--timeout-s` is capped at 300). Give the shell call a timeout above that (e.g. 600000 ms);
|
|
64
64
|
- on each return: a silent part, or one whose agent ended without a complete file, is resumed in its own session with its task id (Step 0.1 item 4), and re-bound at once with the same `review-bind` line, which restarts its silence clock. `answers_silent` means only "no write for the limit"; a reviewer of a few items often writes them all at the end. A resume the host answers with "sent to the running background task" was queued behind a run still in progress: that agent is alive. A resume "also goes silent" only when, after the re-bind, `wait` reports the part silent again or its agent ends without a complete file; only then answer the remaining items `unresolved` yourself. Never answer for a part whose agent is still running: it may still write correct answers after your guesses have been merged;
|
|
65
65
|
- in Step 3.2, conversion (item 5) starts only after the cycle prints `finished: true`; nothing converts between `wait` returns.
|
|
66
66
|
|
|
@@ -69,7 +69,7 @@ A refused merge names the stage and missing keys; re-dispatch only those parts.
|
|
|
69
69
|
|
|
70
70
|
The parent drives the `a2h-utg-explorer` skill's `run_cycle.mjs`; reviewers are parallel sub-agents as in Step 3.1. Commands run from its `scripts/` directory with Node ≥ 22.18 (no Python dependency). `S` is the Step 3.1 workspace; `C=${harmony_project_dir}/.hometrans/utg_explore` is the campaign directory.
|
|
71
71
|
|
|
72
|
-
1. **Install and identify.** `<adb
|
|
72
|
+
1. **Install and identify.** `<adb>` is `ADB_PATH` when the caller passed it and `adb` otherwise (the same adb goes into `config.json` below); the explorer never installs anything. Read the package and launcher component from `aapt dump badging <apk_path>` (`package:`, `launchable-activity:`), and the device locale. `aapt2 dump badging` works the same. Neither is usually on PATH: look under `<sdk>/build-tools/<newest version>/`, where `<sdk>` is `ANDROID_HOME`, `ANDROID_SDK_ROOT`, or the parent of adb's `platform-tools`. If neither exists, take the package from the app module's `applicationId` and, after the install, the launcher from the last line of `<adb> -s <serial> shell cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.LAUNCHER <package>`. **Install only when the device lacks this exact APK.** Never uninstall on your own: an uninstall wipes the app data, including a login set up by hand. Run `<adb> -s <serial> shell pm path --user 0 <package>`. Skip the install only when it prints exactly one `package:<path>` line (no splits) and the first column of `<adb> -s <serial> shell sha256sum <path>` (it prints `<hash> <path>`) equals the local APK's SHA-256 (`node -e "console.log(require('crypto').createHash('sha256').update(require('fs').readFileSync(process.argv[1])).digest('hex'))" <apk_path>`). In every other case (not installed, split APKs, a different hash, no `sha256sum` on the device) run `<adb> -s <serial> install -r -t <apk_path>`: `-r` replaces the app in place and keeps its data, `-t` lets a testOnly (IDE-built) APK install. Never compare `versionCode` / `versionName` alone: a debug rebuild keeps them while the UI changes, so the capture would show the old pages. When the install fails: on `INSTALL_FAILED_VERSION_DOWNGRADE`, retry once with `-d` added (an older build may crash on the newer one's data: note the downgrade for Step 7); on `INSTALL_FAILED_UPDATE_INCOMPATIBLE` (the installed app has another signature), or when the `-d` retry fails too (a user build refuses downgrading a non-debuggable app), stop and ask the user to choose between uninstalling (the app data and any login go with it; log in again afterwards) and supplying an APK the device accepts as an update (same signature, `versionCode` not below the installed one), and record the choice for Step 7.
|
|
73
73
|
2. **Plan and compile.** Review `C/plan.md` before running anything on the device.
|
|
74
74
|
```bash
|
|
75
75
|
node plan.mjs $S/utg.json $C
|
|
@@ -80,7 +80,11 @@ The parent drives the `a2h-utg-explorer` skill's `run_cycle.mjs`; reviewers are
|
|
|
80
80
|
- `serial`, `package`, `launch_component` (`pkg/fully.qualified.Activity`), `page_rules: []`, `state_rules: []`;
|
|
81
81
|
- `"adb": "<ADB_PATH>"` when the caller passed `ADB_PATH`. The explorer and its device watchdog default to a bare `adb` on PATH, which fails when adb is not on PATH (only `ADB_PATH` names it);
|
|
82
82
|
- an empty fixture list for every phase whose `requires` is empty (e.g. `"fixtures": {"p0-fresh": []}`). Phases needing login, content or a data state get no fixture; the explorer does not guess credentials;
|
|
83
|
-
- `"reset_between_tasks": ["p0-fresh"]`: the explorer clears app data (`pm clear`, runtime grants restored) before each task of that fixture-less phase. Without it a setting one task changes persists into every later launch. Leave it out
|
|
83
|
+
- `"reset_between_tasks": ["p0-fresh"]`: the explorer clears app data (`pm clear`, runtime grants restored) before each task of that fixture-less phase. Without it a setting one task changes persists into every later launch. With a login set up by hand, whether to keep it depends on the build and device (see below). Leave it out when the user forbids app-data changes: `--skip D` skips stage D and the fresh snapshot only, never these clears. A first-launch consent dialog (privacy policy / user agreement) is no reason to leave it out: the explorer accepts the app's own one by its positive button after each clear (`consent_default`, see the explorer's architecture.md). A consent dialog with custom buttons (no `android:id/button1`) gets an `interruption_rules` entry that clicks its accept button; check the `interruption` events of the first tasks for it;
|
|
84
|
+
- **A login set up by hand.** What `reset_between_tasks` does to it depends on whether `d_prereqs initial` can archive the data, i.e. whether the build is debuggable. Decide this before the first `run_cycle.mjs`, not from `states.json`: `initial` is recorded once, by the cycle's first step, with the `allow_unarchived_wipe` the config held then, so a later change does not take effect (the only repair is setting `"user_state_protected": true` by hand). Check it with `<adb> -s <serial> shell run-as <package> true` (exit 0 = debuggable), or `application-debuggable` in the `aapt dump badging <apk_path>` output. Simplest: whenever a login was set up by hand on an emulator, write `"allow_unarchived_wipe": false` into `config.json` before the first cycle; it does nothing on a debuggable build.
|
|
85
|
+
- **Debuggable build (`run-as` works)**: the login is kept this way, not by dropping `reset_between_tasks`: `run_cycle.mjs` archives it as `initial`, restores it before the login phases run (stage S enters them through the archive) and at the end of the cycle, so the device goes back with it. Between those points the device can sit on cleared data (the `p0-fresh` resets, until the fresh snapshot or stage S restores it). Keep `reset_between_tasks: ["p0-fresh"]` so the pages only first-launch data shows (login, onboarding, consent, empty states) are still captured. The archive covers `/data/data/<pkg>` only: a login kept in device-protected storage (`/data/user_de/0/<pkg>`), external `Android/data/<pkg>` or a KeyStore key bound to it does not survive `pm clear`. When `states.json`'s `initial` landing is a logged-in page but the login phases' captures show the login page, the login lived there: report it in Step 7 and do not drop the reset to work around it.
|
|
86
|
+
- **Non-debuggable build on a real device**: no archive, so `config.user_state_protected` is set and every reset is skipped (`reset_skipped` event): the login stays, and pages only first-launch data shows stay uncaptured and are reported.
|
|
87
|
+
- **Non-debuggable build on an emulator (`emulator-*`)**: no archive, yet an emulator counts as disposable, so the resets run and the first `p0-fresh` task wipes the login for good. Before the first cycle, set `"allow_unarchived_wipe": false` in `config.json`: it protects the data as on a real device. Leaving `reset_between_tasks` out is not enough: without the protection stage D still runs and rebuilds each state from a replay base, which starts with `pm clear` (prevented only by `--skip D` as well). Once the cycle has started, the setting no longer takes effect: set `"user_state_protected": true` by hand, as above, while the login is still there.
|
|
84
88
|
- for recovery D: `"snapshot_dir": "$C/snapshots"`, `"fixture_server_dir": "$C/fixtures"`. Leave `fixture_server_url` out (or keep the value an earlier run wrote): the server writes it. Without `snapshot_dir` the cycle skips D and lists why under `skipped`;
|
|
85
89
|
- never `layout_backend: android`, which writes JSON, while this skill needs uiautomator XML;
|
|
86
90
|
- `state_anchors` for the static UTG's in-page states whose look differs a lot (mode tabs: a calendar's day/week/month/year, a query page's sub-modes): `{"<ui-state id>": {"all": [{"resource_name": "<id only that state shows>"}], "none": [...]}}`. Take the anchor from the Android source/layout of that state's **content**, not from the tab (tabs often never set `selected`). The tab strip and every other control that all modes show cannot anchor a state either. An anchor on the mode tab itself holds under every sibling mode as well, so their captures match two states, are attributed to neither, and end up exported as the host's "default" directory. `final_utg` now resolves this run-wide: an anchor that holds wherever a sibling's holds yields to the sibling, and the export prints `[WARN] state anchor of <id> also holds under …` with the count in `export_manifest.json` `state_anchor_warnings`. Fix the anchor when that warning appears. Sweep frames take their origin capture's state even after the anchor scrolls out of view. A capture reached by a swipe joins the state it scrolled from instead of becoming a `_sN` state of its own. When every real capture of a host belongs to its states, the host directory is its opening state (`meta.default_state`). A state verified this way is exported as its own `page_NNNN_<host>_<state>` directory and joins the host's group as a captured attached member; without an anchor it stays source-only inside the host. `run_cycle` adds a missing `p0-fresh: []` fixture itself, but write it anyway.
|
|
@@ -119,7 +123,7 @@ The parent drives the `a2h-utg-explorer` skill's `run_cycle.mjs`; reviewers are
|
|
|
119
123
|
**Recovery classes** run inside the cycle without user confirmation: A (offline page identity), B / C (a new gesture for a failed step or an unknown trigger), D (constructing a data state in-app), and direct launch.
|
|
120
124
|
- **D runs by default**, because blocked `content` / `data-state` phases hold most core pages. Its worklist is split into parts like A–C, one item per state (phases sharing the same `requires` form one item); reviewers answer each item by `key` with `verdict: "recipe"` or `"skipped"`, within D's limits (`references/architecture.md` §D): in-app steps only, ASCII text input, white-listed keys, fixture-server files added but never modified (names and recipe ids prefixed with the item key), snapshots only under `snapshot_dir`, and a positive probe before any task.
|
|
121
125
|
- Items needing a real account, an external service, another flavor or the system file picker are answered `skipped` with the reason, and reach Step 7 via `deferred_human.json`.
|
|
122
|
-
- Pass `--skip D` only when the user asked not to change app data.
|
|
126
|
+
- Pass `--skip D` only when the user asked not to change app data, and then leave `reset_between_tasks` out of `config.json` too: `--skip D` skips stage D and the fresh snapshot, not the `p0-fresh` clears.
|
|
123
127
|
- Before anything else, `run_cycle.mjs` archives the app data the device was handed over with (`initial`, via `run-as`) and restores it at the end. After the first round it takes the first-launch base (`fresh.tar` via `run-as`). A build without `run-as` keeps the original data live-only: no `pm clear`, no fresh base, and every clear / restore is refused (`config.user_state_protected`), so pages only first-launch data shows stay uncaptured and are reported.
|
|
124
128
|
- **Stage S** (before A) compiles each phase requirement into an on-screen predicate (`predicates_worklist.json`, reviewed by `key` like A–D) and runs every state phase in a known data state its requirements hold in (`schedule_states.mjs`): a device handed over logged in with content runs those phases directly. D only builds the states no known one satisfies.
|
|
125
129
|
- The cycle repeats while a round still adds a covered node, up to `--max-rounds` (2). Round 1 runs A–D and direct launch; later rounds run direct launch only (`--later-rounds direct`, the default): later A–D rounds cost hours for few new captures. Pass `--later-rounds all` to run A–D in every round.
|
|
@@ -131,7 +135,7 @@ The parent drives the `a2h-utg-explorer` skill's `run_cycle.mjs`; reviewers are
|
|
|
131
135
|
`build_conversion_set.mjs` must run after **every** `export_ui_info.mjs`, because export rewrites `pages.json`. The builder then:
|
|
132
136
|
- re-appends the source-only pages and removes any source-only directory whose node has since been captured;
|
|
133
137
|
- assigns every static node a role and writes `conversion_set.json` (to `${harmony_project_dir}/.hometrans/ui_info/`, next to `pages.json`; not under `utg_static/`). Read `plan.entry_node` / `plan.entry_chosen_by` from its output line `groups N (entry …)`: an empty entry prints a `[WARN]` and means no group owns the launch page, so re-run with `--entry <static node of the launch page>`;
|
|
134
|
-
- writes one `page_NNNN_<Name>/meta.json` per uncaptured page (`evidence_tier: "source-only"`, empty `screenshots`/`view_xmls`, plus `source_hints` / `attached_nodes` / `reached_from` / `navigates_to` / `template_pages`);
|
|
138
|
+
- writes one `page_NNNN_<Name>/meta.json` per uncaptured page (`evidence_tier: "source-only"`, empty `screenshots`/`view_xmls`, plus `source_hints` / `attached_nodes` / `reached_from` / `navigates_to` / `template_pages` / `interactions`), and adds `reached_from` / `navigates_to` / `overlay_effects` / `interactions` to each captured page's `meta.json` (export_ui_info writes none of them);
|
|
135
139
|
- writes `pages.json` with captured pages first, then source-only pages in click-path order.
|
|
136
140
|
|
|
137
141
|
**Convert after the cycle finishes.** Once `run_cycle.mjs` prints `finished: true` and Step 2's report exists: run Step 4.4's `shell_contract.mjs` (it needs `utg.json`, `conversion_set.json`'s plan and Step 2's fonts, which all exist now), Step 4.3, `group_queue.mjs init` (Step 5.4 item 2), then build Step 4.4's packs and prompts for every group and enter the Step 5.4 loop. Both scripts are incremental:
|
|
@@ -22,7 +22,9 @@ Every prompt instructs the agent to **load and follow `./references/conversion-p
|
|
|
22
22
|
- `REUSE_FROM` = the group's `reuse_from`: the files the leader wrote, stated **read-only** (extend by composition, never edit).
|
|
23
23
|
- `OVERLAYS_OWNED_ELSEWHERE` = the group's `overlays_owned_elsewhere`, whenever non-empty: overlays a member opens that another group converts (a shared overlay is a group of its own). The prompt says: import `<file>` from group `<group>` and mount it; never write your own copy under another name; if the file does not exist yet or lacks something this page needs, report it under `shell requests`.
|
|
24
24
|
- `ATTACHED_NODES`, whenever non-empty (both tiers). Menu → the page's overflow/context menu; ui-state/mode → a state of this page; panel/embedded fragment → a component this page hosts. Mark each one **captured** (it has a `###` state in `REFERENCE_SCREENSHOTS`: convert it against those frames) or **uncaptured** (in `uncaptured[]`: convert it from its source branch per conversion-procedure.md §"source-only tier", which then applies to that node only; "the data layer is not converted yet" is never a reason to degrade it).
|
|
25
|
-
-
|
|
25
|
+
- `REACHED_FROM` / `NAVIGATES_TO` (both tiers: `meta.json.reached_from` / `navigates_to`), with each edge's `guard` / `label` / `gesture` when present. A guarded edge is wired under the same condition, a `gesture` edge with that gesture.
|
|
26
|
+
- `INTERACTIONS` (both tiers), whenever `meta.json.interactions` is non-empty: in-page interactions of the page and of its attached nodes; the pack's「In-page interactions」section lists them with the marker rule.
|
|
27
|
+
- For `source-only` members also pass `SOURCE_HINTS` (= `meta.json.source_hints`), `TEMPLATE_PAGES` + `TEMPLATE_MEASUREMENTS`, and the host-chain source file list (now the primary evidence, so resolve it before dispatch).
|
|
26
28
|
12. **`LOTTIE_ENTRIES_FOR_THIS_PAGE`**, only when `lottie_by_page[suggested_page_name]` is non-empty: the matching rows verbatim as JSON, used per Phase 4.5. Otherwise omit the block and never mention Lottie.
|
|
27
29
|
13. **`PRESENTATION` / `HOST_ACTIVITY`**, only when the group carries `presentation` in `conversion_set.json` → `plan` (the app has a shell host; otherwise omit both and say nothing about shells). State it as decided, with the host's `Shell hosts` entry from `Project Fact (Shell Contract)`:
|
|
28
30
|
- `shell-content`: the group's pages are content the shell mounts. Prompt rules: no `@Entry`; no chrome of its own (bottom nav, tabs, drawer, persistent player bar); a jump to another fragment of the same host goes through a callback parameter the shell passes in, never `router.pushUrl` and never a `console.info('TODO: navigate')` stub; only a jump to another Activity uses `router.pushUrl`; transitions follow the host's declared `transitions`, and "NOT animated" means no `pageTransition()`. Anything the shell must provide goes under `shell requests`. Phase 4.2's chrome description of the screenshot is evidence about the **shell**, not something to draw again.
|
|
@@ -56,9 +58,11 @@ Every prompt instructs the agent to **load and follow `./references/conversion-p
|
|
|
56
58
|
- From that point the interface is frozen. Internal fixes are allowed; a changed signature is not. If it must change, say so in the report: `release` reports every provided file changed afterwards as `provided_changed`.
|
|
57
59
|
- **Chrome shared by several `@Entry` pages is provided as a host container, not as a bare bar.** With no `shell_hosts` (each destination its own `@Entry` page), the group that writes the persistent chrome (bottom nav, tab strip, player bar) also provides the scaffold that places it: `XxxScaffold({ currentTab, onNavigate }) { @BuilderParam content }` with the `Stack({ alignContent: … })`, floating margins and `hitTestBehavior` fixed inside. Pages fill the content slot and never re-create the placement. A bar plus a usage comment leaves the placement to every page, and a page that writes `Stack()` + `.align(Alignment.Bottom)` on the bar's wrapper gets its nav floating mid-screen (GATE `stack-child-align-noop` now catches that shape; the scaffold removes it).
|
|
58
60
|
|
|
59
|
-
8. **A component written into a shared module (`common/*`, the design system, `uicomponents`) follows its Android component's signature, parameter by parameter.** Any group can be the first to write one, a leader or not, and every later group reuses it as is. One wrong default here repeats on every page. Before the first page uses it, check these
|
|
61
|
+
8. **A component written into a shared module (`common/*`, the design system, `uicomponents`) follows its Android component's signature, parameter by parameter.** Any group can be the first to write one, a leader or not, and every later group reuses it as is. One wrong default here repeats on every page. Before the first page uses it, check these points against the Android source of the component (its `@Composable fun` / custom View):
|
|
60
62
|
- **Nullable callbacks stay optional.** `onClick: (() -> Unit)? = null` becomes `@Event onClick: (() => void) | undefined = undefined`, and the node joins hit testing only when it is set. Never write an empty-function default bound unconditionally with `.onClick`: the component then takes every tap meant for a clickable parent (GATE `event-default-click-swallows-parent`).
|
|
61
63
|
- **No weight or size the source does not have.** `Modifier.weight` lives at the call site in Compose, so the component root gets no `.layoutWeight()` (GATE `layout-weight-on-shared-component-root`). Likewise no `'100%'` on an axis the source wraps.
|
|
64
|
+
- **Size the caller passes reaches the visible root.** Compose applies a call site's `modifier` (`weight(1f)`, `fillMaxWidth()`) to the component's own root; ArkUI puts a custom component's call-site attributes on an invisible wrapper, so the inner root keeps its content size (a bordered button stays narrow next to its `weight(1f)` sibling). When the Android signature has `modifier: Modifier`, give the component `@Param fillMaxWidth: boolean = false` and write its root `.width(this.fillMaxWidth ? '100%' : 'auto')`; a call site that passes `weight` / `fillMaxWidth` passes `fillMaxWidth: true` with its `.layoutWeight(1)`. A source default such as `fullWidth = true` maps to that same `'100%'` width, never to `constraintSize({ minWidth: '100%' })`: a percentage resolves against the nearest ancestor with a fixed size, so in a wrap-content Row the button stretches to the screen width.
|
|
65
|
+
- **Every variant the call sites use exists.** Match the Android function name, not the look: `XxxButtonFixed` is not `XxxButton`. A variant the shared module lacks is added to the same family file from its own `@Composable fun`, never replaced by the closest existing one.
|
|
62
66
|
- **Slots are @BuilderParam filled with @Builder content.** Callers pass `() => { this.X() }` and nothing else (GATE `builder-param-arrow-inline-component`). This arrow form is for a custom component's @BuilderParam only: built-in attributes (`bindSheet` / `bindContentCover` / `overlay` / `background` / `bindMenu`) take `this.X()` directly (GATE `overlay-builder-arrow-arg`).
|
|
63
67
|
- **Defaults equal the source's defaults** (padding, colors, maxLines, showDivider …), each written with its `file:line`.
|
|
64
68
|
|
|
@@ -130,18 +134,18 @@ Only true dependencies make a group wait (`after`, lane, `reuse_from`, `template
|
|
|
130
134
|
- **Queued resumes of a finished group.** Once every group of a unit is settled from its report, `release` overwrites the unit's message file with a stop notice. A resume that was queued behind the run reads it and replies `DONE` at once instead of re-running the task, which would edit the group's files while the parent verifies them. Its completion notice then releases nothing (`action: none`).
|
|
131
135
|
- **Re-running `init`** (a new parent session) keeps returned/verified results and queues groups left `running` to resume their own sessions. It also keeps every other group's session bindings: a `queued` group keeps its pending decision (a resume stays a resume), and a failed group whose session stalled resumes that session, so re-initing to change `--width` never starts a second writer.
|
|
132
136
|
3. **The loop.** One pass per parent turn, in this order, so no slot ever waits on the parent's review:
|
|
133
|
-
**One command per pass.** `node <this skill>/scripts/group_pass.mjs ${harmony_project_dir}` runs 3.1 and 3.3 and the lease half of 3.2: it releases `reported` groups, releases `stalled` units on opencode/DevEco, runs `phase5_check --group` on every `returned` group (blocking 0: `Q verified` + `group_commit.mjs`; otherwise `Q requeue` with the blocking items, `--resume` when files are missing), then `Q lease`. It prints one JSON line: `dispatch` (start each entry, then `bind` it), `stop_first` (Claude Code only: stop that task, then `Q release --unit <unit> --stalled`), `needs_human` (a group the queue cannot move: read its `hint`), and `next`. Do not write your own driver, and never sleep between passes: `Q wait` is the only wait.
|
|
137
|
+
**One command per pass.** `node <this skill>/scripts/group_pass.mjs ${harmony_project_dir}` runs 3.1 and 3.3 and the lease half of 3.2: it releases `reported` groups, releases `stalled` units on opencode/DevEco, runs `phase5_check --group` on every `returned` group (blocking 0: `Q verified` + `group_commit.mjs`; otherwise `Q requeue` with the blocking items, `--resume` when files are missing), then `Q lease`. It prints one JSON line: `dispatch` (start each entry, then `bind` it), `stop_first` (Claude Code only: stop that task, then `Q release --unit <unit> --stalled`), `needs_human` (a group the queue cannot move: read its `hint`), and `next`. Do not write your own driver, and never sleep between passes: `Q wait` is the only wait. Run `group_pass.mjs` and `Q wait` as separate shell calls, one each per pass: never loop them inside one shell call, or the dispatches `group_pass` prints wait until the whole loop ends.
|
|
134
138
|
1. **Release.** `Q reap ${harmony_project_dir}` lists `reported` groups (report file written, even mid-batch) and `stalled` units.
|
|
135
139
|
- Each reported group: `Q release ${harmony_project_dir} --unit <GID>`.
|
|
136
140
|
- Each stalled unit: Claude Code stops its task first (TaskStop); opencode/DevEco cannot, so it is not stopped. Then `Q release … --unit <unit> --stalled`.
|
|
137
141
|
- Each host completion notice: `Q release … --unit <unit> --task <the notice's handle>`, with `--error "<its error text>"` if it failed. A `stale-notice` row means the notice came from an older session than the bound one: ignore it.
|
|
138
142
|
- Parallel `Q` calls are safe: every mutating call holds `.hometrans/queue_state.json.lock`.
|
|
139
|
-
2. **Lease and dispatch.** `Q lease ${harmony_project_dir}` returns `dispatch: [{unit, groups, resume_task, description, message, message_file}]`. `message` is a one-line pointer (`Read the file <message_file> and follow it fully.`), and the full text is in `message_file` (`.hometrans/work/dispatch/<unit>.a<attempt>.md`, one file per attempt). Pass `message` verbatim as the sub-agent prompt, for fresh and resumed sessions alike. `Q message ${harmony_project_dir} --unit <unit>` prints it again while the unit runs. Never rebuild a message yourself or call the script's internal functions. `released_without_dispatch` lists queued resumes whose session had already written its report: they are released without an agent; verify them like any return. For each `dispatch` entry, start one background sub-agent with `message` as its prompt (all in one message; opencode v2 `subagent` with `background: true`, opencode v1 / DevEco `task` with `background: true`). When `resume_task` is set, resume that session instead (opencode v2: `subagent
|
|
143
|
+
2. **Lease and dispatch.** `Q lease ${harmony_project_dir}` returns `dispatch: [{unit, groups, resume_task, description, message, message_file}]`. `message` is a one-line pointer (`Read the file <message_file> and follow it fully.`), and the full text is in `message_file` (`.hometrans/work/dispatch/<unit>.a<attempt>.md`, one file per attempt). Pass `message` verbatim as the sub-agent prompt, for fresh and resumed sessions alike. `Q message ${harmony_project_dir} --unit <unit>` prints it again while the unit runs. Never rebuild a message yourself or call the script's internal functions. `released_without_dispatch` lists queued resumes whose session had already written its report: they are released without an agent; verify them like any return. For each `dispatch` entry, start one background sub-agent with `message` as its prompt (all in one message; opencode v2 `subagent` with `background: true`, opencode v1 / DevEco `task` with `background: true`). When `resume_task` is set, resume that session instead, still in the background (opencode v2: `subagent({ agent, background: true, sessionID: resume_task })`; opencode v1 / DevEco: `task` with `background: true` and `task_id` = `resume_task`; Claude Code: SendMessage to that agent if it is still known, otherwise a fresh agent with the same message). Then `Q bind … --unit <unit> --task <handle>` for each, where `<handle>` is the returned `sessionID` (v2) or `task_id` (v1/DevEco). A `bind` that returns `foreground` (the attempt's report was already on disk and the bind came more than 5 min after the lease) most likely means the call blocked until the agent finished. It is an inference: if that dispatch did pass `background: true`, ignore it; otherwise dispatch the next ones with `background: true`.
|
|
140
144
|
- **Evidence intake (two steps, one session).** A fresh session of a group with screenshots or view trees is leased with `phase: "intake"`: its message lists only that group's evidence (`.hometrans/work/evidence/<GID>.json`: meta.json, every screenshot, every view tree, measure_summary.txt, plus `conversion-procedure.md` with its source-only section named when a member is source-only or an attached node has no capture) and the `evidence_gate.mjs ack` command. It carries no conversion task and no write set, so nothing can be written before the evidence is read. Dispatch and `bind` it like any unit; the agent replies `READY <GID>`. Its release returns `intake-accepted` once every member's ack covers its manifest, and the next `lease` resumes **that same session** (`phase: "convert"`, `resume_task` set) with the full prompt. The evidence it read stays in its context. The continuation is leased before any other unit and keeps its slot and lane. `intake-resume` resumes the session with the files still unread (at most `INTAKE_MAX_ROUNDS` rounds, then `intake-failed`). `intake-unbound` means no `bind` was recorded, so a fresh session reads again: always bind. After `INTAKE_MAX_ROUNDS` unbound intakes the group is `intake-failed`. `intake-recaptured` means a member was captured while the session read: it reads again with the new frames. A queued `RECAPTURED` or `requeue --message` text is held through intake and delivered with the conversion task, and `requeue` after a failed intake starts a new one. A predicted file changed during intake is listed as `touched`, and the conversion message tells the agent to re-check it. A source-only group (no frames) and every resume of a converting session skip intake; `init --no-evidence-gate` turns it off.
|
|
141
145
|
3. **Verify** every group in `summary.returned_unverified` (below). Then run `Q verified … --group <GID> --summary "<one line>"` (only a `returned` group: never mark a group done in `batch_progress.json` by hand to close it). It marks every page of the group `done` in `batch_progress.json` (`status`, `group`, `verified_at`, `tier`, `output` = the files it wrote plus the `.ets` its report names, `summary`) and refreshes `updated_at`, so the page ledger never trails the queue; it refuses a file that belongs to another run. Then, when `harmony_project_dir` is in a git work tree, `node <this skill>/scripts/group_commit.mjs ${harmony_project_dir} --group <GID>`. The commit takes only the files that group changed and holds other unsettled groups' predicted writes; a file shared by several groups goes to the first one committed.
|
|
142
146
|
- `missing` non-empty: `Q requeue … --group <GID> --resume --message "<missing files; written files are read-only context>"`.
|
|
143
|
-
- Verification failed: `Q requeue … --group <GID> --message "<what to fix>"`.
|
|
144
|
-
4. **Capture track** (Step 3.2) work, if any. Then `Q wait ${harmony_project_dir} [--job run_cycle]` (bound reviewers are followed; `--answers` only for unbound files). It returns within seconds of a report, a silent unit, an ended job, complete answers, or an evidence-intake ack that now covers every file (`reasons: ["intake"]`, `intake_acked: [GID…]` — release those groups). It also returns when a free slot has a ready or backfill unit. Otherwise it returns after
|
|
147
|
+
- Verification failed: `Q requeue … --group <GID> --message "<what to fix>"`. This resumes the group's bound session (returned or stalled), which still holds the evidence it read, so no new intake re-reads the frames. When that session's `release --error` text says it ran out of context, the queue starts the next attempt (automatic retry or `requeue`) fresh by itself (`fresh_reason: "context-exhausted"`). Use `--fresh` yourself only when the session cannot continue for a reason the queue cannot see (it repeats itself, its context is near full), and only after its completion notice has arrived.
|
|
148
|
+
4. **Capture track** (Step 3.2) work, if any. Then `Q wait ${harmony_project_dir} [--job run_cycle]` (bound reviewers are followed; `--answers` only for unbound files). It returns within seconds of a report, a silent unit, an ended job, complete answers, or an evidence-intake ack that now covers every file (`reasons: ["intake"]`, `intake_acked: [GID…]` — release those groups). It also returns when a free slot has a ready or backfill unit. Otherwise it returns after 5 min (a larger `--timeout-s` is capped at 300). Give the shell call a timeout above that (e.g. 600000 ms). Never sleep in a loop instead, and never loop several waits inside one shell call.
|
|
145
149
|
4. **What `release` decides** (no user involved):
|
|
146
150
|
- a group's written files are its predicted writes plus the `.ets` files its report names. A file named in the report counts even at another path than predicted, and even when it was written before a resume. `written` / `missing` in the row come from this;
|
|
147
151
|
- a network failure or stall resumes the same session, at most 3 attempts. A second stall of the same session fails the group (a fresh dispatch starts the count at 0), and the row carries `needs: 'human'` with a `hint`. Do not requeue it fresh while that session may be alive: resume it (`Q requeue` does so by default) or wait for its completion notice.
|
|
@@ -177,7 +181,7 @@ Parent-side re-verification checks the sub-agent's claims independently of its n
|
|
|
177
181
|
|
|
178
182
|
| Check | How |
|
|
179
183
|
|---|---|
|
|
180
|
-
| Lexical checks, in one call | `node ./scripts/phase5_check.mjs ${harmony_project_dir} --group <GID>` (or `--files` with what the report lists). It covers GATE for the group's files, unresolved `$r`/`$rawfile`, misnamed / missing / over-budget `EVIDENCE()`, forbidden patterns (`.position(`/`.offset(`, `` $r(` ``, V1 decorators in a V2 project) and brace balance. With `--group` it also runs `[text_color]`. That compares each measured text colour in the group's `measure_pack.json` files with the colour the matching `Text`/`Span` actually renders; `text-color-unset` / `-mismatch` block. It also runs `[icons]`: every visible ImageView in `measure_pack.json` `icon_inventory` (sampled at the drift-corrected position) needs a `// ICON: <key>` marker on its Image/SymbolGlyph line; `icon-uncovered` / `icon-omit-refused` / `icon-marker-detached` block, and `[drift]` lines mean the screenshot was captured mid-animation. With `--group` or `--files` it runs `[effects]` when the UTG carries overlay `host_effects`: every effect of an overlay edge touching the group (with `--files`: any converted page) needs `// EFFECT: <id>` on or up to 3 lines above its implementing statement, or `// EFFECT-OMIT: <id> — <basis>`; `overlay-effect-uncovered` / `effect-marker-detached` block (an edge whose opener is in another group is `[cand]` there). Exit 1 = blocking finding; a static-checker run with no verdict (non-0/1 exit, no report, 0 files scanned) is `[static] …` and blocks too. `--group` covers the predicted writes plus every `.ets` named in the group's report and in its `provides/` markers, so a leader's shared files need no separate `--files` run |
|
|
184
|
+
| Lexical checks, in one call | `node ./scripts/phase5_check.mjs ${harmony_project_dir} --group <GID>` (or `--files` with what the report lists). It covers GATE for the group's files, unresolved `$r`/`$rawfile`, misnamed / missing / over-budget `EVIDENCE()`, forbidden patterns (`.position(`/`.offset(`, `` $r(` ``, V1 decorators in a V2 project) and brace balance. With `--group` it also runs `[text_color]`. That compares each measured text colour in the group's `measure_pack.json` files with the colour the matching `Text`/`Span` actually renders; `text-color-unset` / `-mismatch` block. It also runs `[icons]`: every visible ImageView in `measure_pack.json` `icon_inventory` (sampled at the drift-corrected position) needs a `// ICON: <key>` marker on its Image/SymbolGlyph line; `icon-uncovered` / `icon-omit-refused` / `icon-marker-detached` block, and `[drift]` lines mean the screenshot was captured mid-animation. With `--group` or `--files` it runs `[effects]` when the UTG carries overlay `host_effects`: every effect of an overlay edge touching the group (with `--files`: any converted page) needs `// EFFECT: <id>` on or up to 3 lines above its implementing statement, or `// EFFECT-OMIT: <id> — <basis>`; `overlay-effect-uncovered` / `effect-marker-detached` block (an edge whose opener is in another group is `[cand]` there). It also runs `[interactions]` when `conversion_set.json` carries `interactions` (a2h-utg-static `attachments`): every in-page interaction of a page in the group (with `--files`: any converted page), including those folded in from its attached nodes, needs `// INTERACTION: <id>` on or up to 3 lines above its implementing statement or event attribute (`.onTouch(` / `.gesture(` / `.bind*(`; a plain style attribute does not count), or `// INTERACTION-OMIT: <id> — <basis>`; an id shared by several pages (one line in a base class or reused component) is ported and marked once; `interaction-uncovered` / `interaction-marker-detached` block. Exit 1 = blocking finding; a static-checker run with no verdict (non-0/1 exit, no report, 0 files scanned) is `[static] …` and blocks too. `--group` covers the predicted writes plus every `.ets` named in the group's report and in its `provides/` markers, so a leader's shared files need no separate `--files` run |
|
|
181
185
|
| No SDK API that does not exist | GATE `sdk-api-nonexistent` (inside the call above) must be 0. These are compile errors the lexical items cannot see.
|
|
182
186
|
| Claimed output files exist and are complete | file exists, non-trivial length, no truncated tail |
|
|
183
187
|
| Cited `file:line` really contains the claimed fact | read that exact line; never accept a citation on faith |
|
|
@@ -219,7 +223,7 @@ Pages in a shell-content group that still declare `@Entry` are fixed here (drop
|
|
|
219
223
|
**No `shell_hosts`, but one chrome component already sits in several destination pages.** Before writing any copy, check whether the launcher Activity is a missed shell host: the UTG has ≥ 2 `fragment-transaction` or `view-swap` edges from it, and its source adds the chrome once (a layout XML widget, or `addView(<XxxNavigationBar>(…), LayoutParams(…, Gravity.BOTTOM))` in code). If so, build the shell as above and report the miss so `shell_contract.mjs` can be fixed. This overrides the per-page convention the groups already used and this prompt's `router.pushUrl` rule for the host's own destinations: the destination pages become shell content (their `@Entry` and bar copies go), and only edges to another Activity keep `router.pushUrl`. Do not give each destination its own `@Entry` page with its own bar and switch tabs with `router.pushUrl`. That stacks a page per tap, which Android never does. It also loses the indicator animation, and every copy re-creates the placement. If copies are truly unavoidable, copy the placement together with the bar: the host `Stack`'s `alignContent`, the margins, and the layer order. A bar copied without its parent's `alignContent` lands in a `Stack()` that defaults to Center. Inside the bar, a selection surface (indicator) is declared before the items: a `Stack` paints later children on top, so an opaque indicator written after them hides the selected icon and label, and `hitTestBehavior(None)` only lets taps through.
|
|
220
224
|
|
|
221
225
|
Then wire navigation to real pages:
|
|
222
|
-
- walk `conversion_set.json`'s `page` rows and each page's `
|
|
226
|
+
- walk `conversion_set.json`'s `page` rows and each row's `navigates_to` (the same edge views as the page's `meta.json`, captured pages included); an edge with a `guard` is wired under that condition, never unconditionally;
|
|
223
227
|
- an edge with `host_effects` (in `navigates_to` / `reached_from`, a captured page's `overlay_effects`, and `conversion_set.json` `overlay_effects`) also changes the host when the overlay opens or dismisses. When you move an overlay's mounting into its page, or write its trigger / onDismiss here, carry every effect with it: implement it from its `resolved` statements in the code that opens / dismisses the overlay and keep (or add) `// EFFECT: <id>` on or up to 3 lines above the implementing statement, or `// EFFECT-OMIT: <id> — <basis>`. The gate's `phase5_check --files` run checks every converted page's effects (`overlay-effect-uncovered`, `effect-marker-detached`);
|
|
224
228
|
- an `// UNWIRED: <android file:line> — <reason>` handler whose target is now converted gets its real body here, and the marker goes. Every one still left is listed in the report and carried into Step 7's Manual Follow-up TODOs;
|
|
225
229
|
- every edge whose target is a converted page gets a real `router.pushUrl` or component toggle;
|
|
@@ -237,4 +241,4 @@ A choice that only lives in this agent's reasoning ("dark mode is handled by res
|
|
|
237
241
|
|
|
238
242
|
**Global state contract.** For every `AppStorageV2` / `PersistenceV2` key shared across modules, write one row in the report: `key | class | owning module | connect sites`. The class and its connect (with a default creator) live once, in a shared HAR under `common/*` that every user imports. A feature module does not declare its own copy of the class to avoid importing the entry HAP: a same-named class in another file is a different type for the same key, and leaving the key uncreated to dodge that makes the first connect without a creator crash. GATE `appstoragev2-connect-creator` covers both shapes.
|
|
239
243
|
|
|
240
|
-
**Gate:** run `scripts/arkts_static_check.ts` (Step 6.1 command). `orphan-component` must be **zero** before Step 6. An exported struct that no file imports or instantiates can never render: every file is legal and the build is green, but every trigger is dead. Also, **every GATE in a file this step edited must be zero**. Wiring is new code that no group's Phase 5 ever saw.
|
|
244
|
+
**Gate:** run `scripts/arkts_static_check.ts` (Step 6.1 command). `orphan-component` must be **zero** before Step 6. An exported struct that no file imports or instantiates can never render: every file is legal and the build is green, but every trigger is dead. Also, **every GATE in a file this step edited must be zero**. Wiring is new code that no group's Phase 5 ever saw. A GATE that wiring newly exposes in a group's file (its call site now resolves) is fixed in code; wiring never closes it with a downgrade marker (`// HIT-TEST:` …), which only the group that wrote the layout can justify.
|
|
@@ -56,6 +56,7 @@ import { _replace, _uiModule } from './group_watch.mjs';
|
|
|
56
56
|
import { scrollableContainers, sourceDeclaresScroll, sourceFileFor } from './capture_audit.mjs';
|
|
57
57
|
import { scrollVerdict } from './scroll_verdict.mjs';
|
|
58
58
|
import * as mp from './module_placement.mjs';
|
|
59
|
+
import { interactionsOf } from './interactions.mjs';
|
|
59
60
|
|
|
60
61
|
// ---------------------------------------------------------------- Python compatibility layer
|
|
61
62
|
// These outputs are a contract read by other scripts and the agent and must match the original Python version byte for byte:
|
|
@@ -892,8 +893,26 @@ export function templateKeys(node, shareable = shareableByPath) {
|
|
|
892
893
|
|
|
893
894
|
const tkey = (k) => pyRepr(k[0]) + '\u0000' + pyRepr(k[1]);
|
|
894
895
|
|
|
896
|
+
// `args.action` values that name no gesture: a plain tap, and the placeholders a2h-utg-static writes on
|
|
897
|
+
// fragment-transaction / embed / pager edges (`default`) and launch-path edges (`launch`).
|
|
898
|
+
const NOT_A_GESTURE = new Set(['tap', 'click', 'onClick', 'default', 'launch']);
|
|
899
|
+
|
|
895
900
|
export function edgeView(e, end) {
|
|
896
901
|
const v = { [end]: e[end], mechanism: get(e, 'mechanism'), trigger: get(e, 'trigger') };
|
|
902
|
+
// The condition the jump needs (`!isLoggedIn` → login page): without it the conversion writes an unconditional jump.
|
|
903
|
+
const guard = get(e, 'guard');
|
|
904
|
+
if (truthy(guard)) { v.guard = guard; }
|
|
905
|
+
// On-screen wording of the trigger, and a gesture other than a plain tap (long_press, double_tap, swipe-*).
|
|
906
|
+
const args = get(e, 'args', {}) ?? {};
|
|
907
|
+
const label = get(args, 'label');
|
|
908
|
+
if (truthy(label)) { v.label = label; }
|
|
909
|
+
// `action` names the gesture; when it is a placeholder or the generic `swipe`, `args.gesture` is the more
|
|
910
|
+
// specific one (`{action: 'swipe', gesture: 'open-drawer'}`), and a placeholder never hides a real gesture.
|
|
911
|
+
const action = get(args, 'action');
|
|
912
|
+
const named = get(args, 'gesture');
|
|
913
|
+
const useAction = truthy(action) && !NOT_A_GESTURE.has(action) && !(action === 'swipe' && truthy(named));
|
|
914
|
+
const gesture = useAction ? action : named;
|
|
915
|
+
if (truthy(gesture) && !NOT_A_GESTURE.has(gesture)) { v.gesture = gesture; }
|
|
897
916
|
// What opening / dismissing an overlay also does to its host (a2h-utg-static `args.host_effects`:
|
|
898
917
|
// `{open: [{id, stmt, at, resolved}], dismiss: [...]}`). Absent on an older UTG.
|
|
899
918
|
const fx = get(get(e, 'args', {}) ?? {}, 'host_effects');
|
|
@@ -920,7 +939,9 @@ const isEmptyish = (v) => v === null || v === undefined || (Array.isArray(v) &&
|
|
|
920
939
|
export function hintsOf(node) {
|
|
921
940
|
const widgets = (or(get(node, 'widgets'), [])).map((w) => {
|
|
922
941
|
const o = {};
|
|
923
|
-
|
|
942
|
+
// gesture_param (long press / double tap ...) and trigger_targets (the nodes this control opens): without them a
|
|
943
|
+
// source-only page cannot tell a long-press control from a tap one, or which control opens which page.
|
|
944
|
+
for (const k of ['widget', 'kind', 'view_id', 'text', 'placeholder', 'preference_type', 'at', 'gesture_param', 'trigger_targets']) {
|
|
924
945
|
const v = get(w, k);
|
|
925
946
|
if (v !== null && v !== undefined) { o[k] = w[k]; }
|
|
926
947
|
}
|
|
@@ -1886,6 +1907,17 @@ export function build(ws, uiInfo, entry = null, renumber = false, exploring = fa
|
|
|
1886
1907
|
for (const [nid, r] of roles) {
|
|
1887
1908
|
if (r.role === 'attach') { setdefault(attached, r.host, []).push(nid); }
|
|
1888
1909
|
}
|
|
1910
|
+
// In-page interactions of a page (interactions.mjs): its own, and those of the nodes attached to it. An attach
|
|
1911
|
+
// node has no page dir of its own, so its interactions would otherwise reach neither a meta.json nor a prompt.
|
|
1912
|
+
// Computed once per page: the source-only meta, the captured meta and conversion_set.json all read it.
|
|
1913
|
+
const interactionsCache = new Map();
|
|
1914
|
+
const interactionsFor = (nid) => {
|
|
1915
|
+
if (!interactionsCache.has(nid)) {
|
|
1916
|
+
interactionsCache.set(nid, [nid, ...sortedBy(attached.get(nid) ?? [])]
|
|
1917
|
+
.flatMap((n) => interactionsOf(g.nodes.get(n))).map((x) => ({ ...x, host: nid })));
|
|
1918
|
+
}
|
|
1919
|
+
return interactionsCache.get(nid);
|
|
1920
|
+
};
|
|
1889
1921
|
|
|
1890
1922
|
const tmplIndex = new Map();
|
|
1891
1923
|
for (const [nid, dirs] of captured) {
|
|
@@ -2021,6 +2053,7 @@ export function build(ws, uiInfo, entry = null, renumber = false, exploring = fa
|
|
|
2021
2053
|
const p = or(paths.get(nid), {});
|
|
2022
2054
|
const labels = get(p, 'steps', []).map((s) => get(s, 'label')).filter(truthy);
|
|
2023
2055
|
const route = or(get(p, 'nl_path_text'), get(p, 'path_text'));
|
|
2056
|
+
const ixs = interactionsFor(nid);
|
|
2024
2057
|
const meta = {
|
|
2025
2058
|
page_id: slug, static_node: nid, kind: get(node, 'kind'), label: get(node, 'label'),
|
|
2026
2059
|
declared_at: get(node, 'declared_at'),
|
|
@@ -2033,6 +2066,7 @@ export function build(ws, uiInfo, entry = null, renumber = false, exploring = fa
|
|
|
2033
2066
|
reached_from: (g.inbound.get(nid) ?? []).map((e) => edgeView(e, 'source')),
|
|
2034
2067
|
navigates_to: (g.outbound.get(nid) ?? []).map((e) => edgeView(e, 'target')),
|
|
2035
2068
|
template_pages: templates.slice(0, MAX_TEMPLATES),
|
|
2069
|
+
...(ixs.length ? { interactions: ixs } : {}),
|
|
2036
2070
|
click_path: get(p, 'steps', []),
|
|
2037
2071
|
breadcrumb: labels.join(' > '),
|
|
2038
2072
|
click_path_text: or(route, ''),
|
|
@@ -2059,6 +2093,9 @@ export function build(ws, uiInfo, entry = null, renumber = false, exploring = fa
|
|
|
2059
2093
|
if (blank) { demoted.set(nid, blank); }
|
|
2060
2094
|
row.tier = captured.has(nid) && !blank ? 'captured' : 'source-only';
|
|
2061
2095
|
row.page_dirs = dirs;
|
|
2096
|
+
// Step 5.5 wires navigation by walking these rows' navigates_to (step5-convert.md).
|
|
2097
|
+
const out = (g.outbound.get(nid) ?? []).map((e) => edgeView(e, 'target'));
|
|
2098
|
+
if (out.length) { row.navigates_to = out; }
|
|
2062
2099
|
// captured but every frame FLAG_SECURE-blocked: view tree only, no pixel verification possible
|
|
2063
2100
|
if (row.tier === 'captured' && row.page_dirs.every((d) => pixelsBlocked(uiInfo, d))) { row.pixels = 'blocked'; }
|
|
2064
2101
|
if (blank) { row.pixels = 'rejected'; row.capture_rejected = blank; }
|
|
@@ -2105,15 +2142,27 @@ export function build(ws, uiInfo, entry = null, renumber = false, exploring = fa
|
|
|
2105
2142
|
for (const [nid, dirs] of captured) {
|
|
2106
2143
|
if (get(roles.get(nid), 'role') !== 'page') { continue; }
|
|
2107
2144
|
for (const d of dirs ?? []) { writeDemotion(d, demoted.get(nid) ?? null); }
|
|
2108
|
-
//
|
|
2109
|
-
//
|
|
2110
|
-
|
|
2145
|
+
// export_ui_info writes a captured meta.json without the static edges. Step 5.5 wires navigation from
|
|
2146
|
+
// navigates_to, so a captured page — usually the main path — needs them as much as a source-only one does.
|
|
2147
|
+
// The overlay edges that carry host effects also go in as overlay_effects, and the page's in-page
|
|
2148
|
+
// interactions (its own and its attached nodes') as interactions.
|
|
2149
|
+
const want = g.nodes.has(nid) ? {
|
|
2150
|
+
reached_from: (g.inbound.get(nid) ?? []).map((e) => edgeView(e, 'source')),
|
|
2151
|
+
navigates_to: (g.outbound.get(nid) ?? []).map((e) => edgeView(e, 'target')),
|
|
2152
|
+
overlay_effects: overlayEffectsOf(g, nid),
|
|
2153
|
+
interactions: interactionsFor(nid),
|
|
2154
|
+
} : { reached_from: [], navigates_to: [], overlay_effects: [], interactions: [] };
|
|
2111
2155
|
for (const d of dirs ?? []) {
|
|
2112
2156
|
const file = path.join(uiInfo, pathName(String(d)), 'meta.json');
|
|
2113
2157
|
const meta = or(readJson(file), null);
|
|
2114
2158
|
if (!meta) { continue; }
|
|
2115
|
-
|
|
2116
|
-
|
|
2159
|
+
let changed = false;
|
|
2160
|
+
for (const [k, v] of Object.entries(want)) {
|
|
2161
|
+
if (v.length) {
|
|
2162
|
+
if (JSON.stringify(meta[k]) !== JSON.stringify(v)) { meta[k] = v; changed = true; }
|
|
2163
|
+
} else if (meta[k] !== undefined) { delete meta[k]; changed = true; }
|
|
2164
|
+
}
|
|
2165
|
+
if (changed) { writeJson(file, meta); }
|
|
2117
2166
|
}
|
|
2118
2167
|
}
|
|
2119
2168
|
// pages.json rows feed Step 4.1 and group_queue: a demoted page must not read "captured" there.
|
|
@@ -2245,8 +2294,11 @@ export function build(ws, uiInfo, entry = null, renumber = false, exploring = fa
|
|
|
2245
2294
|
if (hasHostEffects(get(get(e, 'args', {}) ?? {}, 'host_effects'))) { overlayEffects.push({ source: nid, ...edgeView(e, 'target') }); }
|
|
2246
2295
|
}
|
|
2247
2296
|
}
|
|
2297
|
+
// Every page's in-page interactions, for the group pack and phase5_check interaction-uncovered.
|
|
2298
|
+
const interactions = nodesOut.filter((r) => r.role === 'page').flatMap((r) => interactionsFor(r.node));
|
|
2248
2299
|
writeJson(path.join(uiInfo, 'conversion_set.json'),
|
|
2249
|
-
{ summary, nodes: nodesOut, plan, ...(overlayEffects.length ? { overlay_effects: overlayEffects } : {})
|
|
2300
|
+
{ summary, nodes: nodesOut, plan, ...(overlayEffects.length ? { overlay_effects: overlayEffects } : {}),
|
|
2301
|
+
...(interactions.length ? { interactions } : {}) });
|
|
2250
2302
|
return summary;
|
|
2251
2303
|
}
|
|
2252
2304
|
|
|
@@ -38,6 +38,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
38
38
|
import { scrollableContainers } from './capture_audit.mjs';
|
|
39
39
|
import { scrollVerdict } from './scroll_verdict.mjs';
|
|
40
40
|
import { edgesInScope, loadEffects, renderEffectsSection } from './overlay_effects.mjs';
|
|
41
|
+
import { interactionsInScope, loadInteractions, renderInteractionsSection } from './interactions.mjs';
|
|
41
42
|
|
|
42
43
|
/** A doc heading / evidence name quoted the way the docs quote it: 「name」 in zh, "name" in en. */
|
|
43
44
|
const quoteName = (s) => (`"${s}"`);
|
|
@@ -1626,6 +1627,8 @@ export function render(group, pack, idx, hres, android, uiInfo = null, { inline
|
|
|
1626
1627
|
if (uiInfo !== null) {
|
|
1627
1628
|
const members = new Set(pyIter(or(dget(group, 'members'), [])).map((m) => pyStr(dget(m, 'node'))));
|
|
1628
1629
|
lines.push(...renderEffectsSection(edgesInScope(loadEffects(uiInfo), { members })));
|
|
1630
|
+
// In-page interactions of this group's pages and their attached nodes (interactions.mjs)
|
|
1631
|
+
lines.push(...renderInteractionsSection(interactionsInScope(loadInteractions(uiInfo), members)));
|
|
1629
1632
|
}
|
|
1630
1633
|
if (uiInfo !== null) { lines.push(...renderEvidence(referenceEvidence(group, uiInfo))); }
|
|
1631
1634
|
lines.push(...renderCards([...pack.files.values()].map(([p]) => pathStr(p))));
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// interactions.mjs — in-page interactions a2h-utg-static found that no navigation edge expresses, end to end.
|
|
2
|
+
//
|
|
3
|
+
// a2h-utg-static stamps on a page node `attachments[]` (view_attachments.mjs): a project View constructed and
|
|
4
|
+
// handed to another view's non-layout sink — a chart marker, a tooltip, an empty view. The receiver shows it from
|
|
5
|
+
// its own touch handling, so no click listener names it and the explorer never taps it (clickable=false). Lead
|
|
6
|
+
// case: a weather app's TodayWeatherFragment.java:173 `chart.setMarker(new CustomMarkerView(ctx, R.layout.marker))`
|
|
7
|
+
// (tap the forecast curve → highlight line + a bubble with the temperature). The fragment was an `attach` node of
|
|
8
|
+
// the captured main page, the marker reached neither the meta.json nor the prompt, and the converted chart drew the
|
|
9
|
+
// curve with no touch handling at all.
|
|
10
|
+
//
|
|
11
|
+
// build_conversion_set.mjs turns each attachment into an interaction {id, kind, host, node, view_class, layout,
|
|
12
|
+
// sink, evidence} (interactionsOf), folds an attach node's interactions into its host page, and writes them to
|
|
13
|
+
// meta.json `interactions` and conversion_set.json `interactions`. This module reads them back for the group pack
|
|
14
|
+
// (renderInteractionsSection) and phase5_check (interactionCoverage): each interaction is implemented in the
|
|
15
|
+
// converted page and marked `// INTERACTION: <id>` on or up to 3 lines above the implementing statement, or waived
|
|
16
|
+
// with `// INTERACTION-OMIT: <id> — <basis>`.
|
|
17
|
+
//
|
|
18
|
+
// An older UTG has no attachments: every function returns nothing and the check is skipped silently.
|
|
19
|
+
|
|
20
|
+
import * as fs from 'node:fs';
|
|
21
|
+
import * as path from 'node:path';
|
|
22
|
+
import { hasBasis, realStatement } from './overlay_effects.mjs';
|
|
23
|
+
|
|
24
|
+
const LOOKAHEAD = 3;
|
|
25
|
+
|
|
26
|
+
function readJson(p) {
|
|
27
|
+
try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch { return null; }
|
|
28
|
+
}
|
|
29
|
+
const isObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
30
|
+
|
|
31
|
+
/** `app/src/.../X.java:173` -> `X.java:173`. */
|
|
32
|
+
const shortAt = (at) => String(at ?? '').split('/').at(-1);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Interactions of one UTG node: one per `attachments[]` entry (a2h-utg-static view_attachments). The id is
|
|
36
|
+
* `ix:<sink path>:<line>:<ViewClass>` — the line that attaches the view plus the attached class, so two views
|
|
37
|
+
* attached on one line (`chart.setMarker(new A(..)); chart.setEmptyView(new B(..));`) stay two interactions;
|
|
38
|
+
* stable across runs while the source does not move.
|
|
39
|
+
*/
|
|
40
|
+
export function interactionsOf(node) {
|
|
41
|
+
const out = [];
|
|
42
|
+
if (!isObj(node)) { return out; }
|
|
43
|
+
const seen = new Set();
|
|
44
|
+
for (const a of Array.isArray(node.attachments) ? node.attachments : []) {
|
|
45
|
+
if (!isObj(a) || !isObj(a.sink) || !a.sink.at) { continue; }
|
|
46
|
+
const id = `ix:${a.sink.at}${a.view_class ? `:${a.view_class}` : ''}`;
|
|
47
|
+
if (seen.has(id)) { continue; }
|
|
48
|
+
seen.add(id);
|
|
49
|
+
out.push({
|
|
50
|
+
id, kind: 'attached-view', node: node.id,
|
|
51
|
+
view_class: a.view_class ?? null, view_class_at: a.view_class_at ?? null, base: a.base ?? null,
|
|
52
|
+
...(a.layout ? { layout: a.layout } : {}),
|
|
53
|
+
sink: a.sink, at: a.at ?? a.sink.at,
|
|
54
|
+
...(a.via_var ? { via_var: a.via_var } : {}), ...(a.via_fn ? { via_fn: a.via_fn } : {}),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** conversion_set.json `interactions`, each {id, kind, host, node, ...}. [] for an older set. */
|
|
61
|
+
export function loadInteractions(uiInfo) {
|
|
62
|
+
const cs = uiInfo ? readJson(path.join(uiInfo, 'conversion_set.json')) : null;
|
|
63
|
+
return isObj(cs) && Array.isArray(cs.interactions) ? cs.interactions.filter((x) => isObj(x) && x.id) : [];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Interactions whose host page (or own node) is in `set`; all of them when `set` is null. */
|
|
67
|
+
export function interactionsInScope(items, set) {
|
|
68
|
+
return set === null || set === undefined ? items : items.filter((x) => set.has(x.host) || set.has(x.node));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// `ix:<path>:<line>:<ViewClass>`; path rules as overlay_effects FX_ID (no spaces or ':'). Without a view class (an
|
|
72
|
+
// attachment that names none) the line number ends it.
|
|
73
|
+
const IX_ID = String.raw`ix:(?:[A-Za-z]:)?[^\s:]+:\d+(?::[A-Za-z_]\w*|(?!\d|:\d))`;
|
|
74
|
+
const RE_MARK = new RegExp(String.raw`\/\/\s*INTERACTION(?!-)\s*[::]\s*(${IX_ID})`);
|
|
75
|
+
const RE_OMIT = new RegExp(String.raw`\/\/\s*INTERACTION-OMIT\s*[::]\s*(${IX_ID})\s*(?:[—–::-]+\s*)?(.*)$`);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A line that implements an interaction: overlay_effects.realStatement, plus an ArkUI event / gesture
|
|
79
|
+
* attribute (`.onTouch(`, `.gesture(`, `.onClick(`, `.bindPopup(`, ...) — the usual implementation of a
|
|
80
|
+
* touch-shown auxiliary view, which realStatement rejects as a component line.
|
|
81
|
+
*/
|
|
82
|
+
export function implementingLine(line) {
|
|
83
|
+
const code = line.replace(/\/\/.*$/, '').trim();
|
|
84
|
+
// A chained attribute line implements an interaction only when it is an event / gesture / popup one:
|
|
85
|
+
// `.width(100)` is a call to realStatement, but a marker above it would cover nothing.
|
|
86
|
+
if (code.startsWith('.')) { return /^\.\s*(?:on[A-Z]\w*|gesture|priorityGesture|parallelGesture|bind[A-Z]\w*|overlay)\s*\(/.test(code); }
|
|
87
|
+
return realStatement(line);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** markers in src: marks id -> [{line, attached}], omits id -> [{line, reason}]. */
|
|
91
|
+
export function scanInteractionMarkers(src) {
|
|
92
|
+
const lines = src.split(/\r?\n/);
|
|
93
|
+
const marks = new Map();
|
|
94
|
+
const omits = new Map();
|
|
95
|
+
lines.forEach((ln, i) => {
|
|
96
|
+
const o = RE_OMIT.exec(ln);
|
|
97
|
+
if (o) { if (!omits.has(o[1])) { omits.set(o[1], []); } omits.get(o[1]).push({ line: i + 1, reason: o[2].trim() }); return; }
|
|
98
|
+
const m = RE_MARK.exec(ln);
|
|
99
|
+
if (!m) { return; }
|
|
100
|
+
const attached = implementingLine(ln.slice(0, ln.indexOf('//'))) || lines.slice(i + 1, i + 1 + LOOKAHEAD).some(implementingLine);
|
|
101
|
+
if (!marks.has(m[1])) { marks.set(m[1], []); }
|
|
102
|
+
marks.get(m[1]).push({ line: i + 1, attached });
|
|
103
|
+
});
|
|
104
|
+
return { marks, omits };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* GATE interaction-uncovered: an interaction in scope with no attached `// INTERACTION: <id>` in files or shared and
|
|
109
|
+
* no `// INTERACTION-OMIT: <id> — <basis>`. GATE interaction-marker-detached: a marker in files with no statement or
|
|
110
|
+
* event attribute on its line or the next 3. files / shared: [[rel, src]]; scope: a Set of node ids or null (all).
|
|
111
|
+
*
|
|
112
|
+
* An id is one sink line in the Android source. When that line sits in a base class or a reused component, several
|
|
113
|
+
* host pages carry the same id: it is ported once, as the shared component it is, and one marker covers every host.
|
|
114
|
+
* An uncovered one is reported once, naming all its hosts.
|
|
115
|
+
*/
|
|
116
|
+
export function interactionCoverage({ items, scope = null, files = [], shared = [] }) {
|
|
117
|
+
const gate = [];
|
|
118
|
+
const marks = new Set();
|
|
119
|
+
const omits = new Map();
|
|
120
|
+
const seen = new Set();
|
|
121
|
+
const add = (rel, src, own) => {
|
|
122
|
+
const s = scanInteractionMarkers(src);
|
|
123
|
+
for (const [id, v] of s.marks) {
|
|
124
|
+
for (const x of v) {
|
|
125
|
+
if (x.attached) { marks.add(id); continue; }
|
|
126
|
+
if (own) { gate.push(`interaction-marker-detached ${rel}:${x.line} // INTERACTION: ${id} — no statement or event attribute on this line or the next ${LOOKAHEAD}`); }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
for (const [id, v] of s.omits) { if (!omits.has(id)) { omits.set(id, []); } omits.get(id).push(...v.map((x) => ({ ...x, at: `${rel}:${x.line}` }))); }
|
|
130
|
+
};
|
|
131
|
+
for (const [rel, src] of files) { seen.add(rel); add(rel, src, true); }
|
|
132
|
+
for (const [rel, src] of shared) { if (!seen.has(rel)) { add(rel, src, false); } }
|
|
133
|
+
const byId = new Map();
|
|
134
|
+
for (const x of interactionsInScope(items, scope)) { if (!byId.has(x.id)) { byId.set(x.id, []); } byId.get(x.id).push(x); }
|
|
135
|
+
for (const [id, xs] of byId) {
|
|
136
|
+
if (marks.has(id) || (omits.get(id) ?? []).some((o) => hasBasis(o.reason))) { continue; }
|
|
137
|
+
const x = xs[0];
|
|
138
|
+
const where = [...new Set(xs.map((h) => `${h.host}${h.node !== h.host ? ` ← ${h.node}` : ''}`))].join(', ');
|
|
139
|
+
const bad = (omits.get(x.id) ?? [])[0];
|
|
140
|
+
gate.push(`interaction-uncovered ${x.id} (${where}): ${describe(x)} ` +
|
|
141
|
+
`has no // INTERACTION: ${x.id} on an implementing statement${bad ? ` (INTERACTION-OMIT at ${bad.at} has no basis)` : ''}`);
|
|
142
|
+
}
|
|
143
|
+
return { gate, checked: byId.size };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** One-line description of an interaction for reports. */
|
|
147
|
+
export function describe(x) {
|
|
148
|
+
if (x.kind === 'attached-view') {
|
|
149
|
+
const recv = x.sink?.receiver ? `${x.sink.receiver}.` : '';
|
|
150
|
+
const how = x.sink?.kind === 'prop-assign' ? `${recv}${x.sink.target} = ${x.view_class}(..)` : `${recv}${x.sink?.callee}(${x.view_class}(..))`;
|
|
151
|
+
return `\`${how}\` at ${shortAt(x.sink?.at)}`;
|
|
152
|
+
}
|
|
153
|
+
return `${x.kind} at ${shortAt(x.at)}`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Group pack section: every interaction of the group's pages, with the marker rule. [] when there is none. */
|
|
157
|
+
export function renderInteractionsSection(items) {
|
|
158
|
+
if (!items.length) { return []; }
|
|
159
|
+
const lines = ['## In-page interactions — implement each one in the converted page', '',
|
|
160
|
+
'a2h-utg-static found these interactions in the Android source. No navigation edge or click listener expresses ' +
|
|
161
|
+
'them, and the reference screenshots do not show them: an **attached view** is a project View the page hands to ' +
|
|
162
|
+
'another view (`chart.setMarker(..)`, `x.marker = ..`, a tooltip, an empty view), and the receiving view shows it ' +
|
|
163
|
+
'from its own touch / state handling. Read the receiver\'s configuration in the Android source around the sink ' +
|
|
164
|
+
'(what gesture shows it, what it displays, what is disabled) and implement the same behaviour in HarmonyOS: an ' +
|
|
165
|
+
'ArkUI component has no such built-in, so a drawn chart needs its own touch handling (`.onTouch` / `.gesture`) ' +
|
|
166
|
+
'plus the auxiliary view as an overlay. Put `// INTERACTION: <id>` on the implementing statement or event ' +
|
|
167
|
+
'attribute, or up to 3 lines above it. An interaction that cannot or must not be ported gets ' +
|
|
168
|
+
'`// INTERACTION-OMIT: <id> — <basis>`. phase5_check gates both (`interaction-uncovered`, ' +
|
|
169
|
+
'`interaction-marker-detached`). An id listed under several pages comes from one line in a shared base class or ' +
|
|
170
|
+
'component: port it once, in the shared component, and mark it once.', ''];
|
|
171
|
+
const byHost = new Map();
|
|
172
|
+
for (const x of items) { if (!byHost.has(x.host)) { byHost.set(x.host, []); } byHost.get(x.host).push(x); }
|
|
173
|
+
for (const [host, xs] of byHost) {
|
|
174
|
+
lines.push(`### ${host}`, '');
|
|
175
|
+
for (const x of xs) {
|
|
176
|
+
lines.push(`- \`${x.id}\` ${x.kind}${x.node !== host ? ` (from attached \`${x.node}\`)` : ''}: ${describe(x)}`);
|
|
177
|
+
if (x.kind === 'attached-view') {
|
|
178
|
+
lines.push(` - view class \`${x.view_class}\`${x.base ? ` extends \`${x.base}\`` : ''} at \`${x.view_class_at ?? ''}\`` +
|
|
179
|
+
`${x.layout ? `, layout \`${x.layout}\`` : ''}`);
|
|
180
|
+
if (x.via_var || x.via_fn) { lines.push(` - constructed at \`${x.at}\` via ${x.via_var ? `variable \`${x.via_var}\`` : `factory \`${x.via_fn}()\``}`); }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
lines.push('');
|
|
184
|
+
}
|
|
185
|
+
return lines;
|
|
186
|
+
}
|