@buaa_smat/hometrans 26.0.7 → 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.
Files changed (154) hide show
  1. package/agents/a2h-executor.md +37 -0
  2. package/env-requirements.json +15 -1
  3. package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +2 -2
  4. package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +1 -1
  5. package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +13 -6
  6. package/i18n/skills/a2h-app-migrate/SKILL.md +2 -2
  7. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +27 -4
  8. package/i18n/skills/a2h-app-migrate/scripts/opencode_depth.mjs +418 -0
  9. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
  10. package/i18n/skills/a2h-batch-ui-align/SKILL.md +7 -7
  11. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -1
  12. package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +20 -2
  13. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +2 -2
  14. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +3 -3
  15. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +3 -1
  16. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +2 -2
  17. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +10 -6
  18. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +13 -9
  19. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +59 -7
  20. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +3 -0
  21. package/i18n/skills/a2h-batch-ui-align/scripts/interactions.mjs +186 -0
  22. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +33 -7
  23. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +83 -22
  24. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +39 -5
  25. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +25 -1
  26. package/i18n/skills/a2h-page-specgen/SKILL.md +1 -1
  27. package/i18n/skills/a2h-page-specgen/references/gates.md +3 -1
  28. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +11 -11
  29. package/i18n/skills/a2h-page-specgen/references/spec-template.md +3 -3
  30. package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +40 -3
  31. package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +73 -5
  32. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +144 -0
  33. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +11 -11
  34. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +11 -11
  35. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +11 -11
  36. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +11 -11
  37. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +10 -10
  38. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +1 -1
  39. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +11 -11
  40. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +11 -11
  41. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +11 -11
  42. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +11 -11
  43. package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +45 -1
  44. package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +100 -0
  45. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +132 -3
  46. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +36 -1
  47. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +1 -1
  48. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +16 -0
  49. package/i18n/skills/a2h-utg-static/SKILL.md +2 -0
  50. package/package.json +1 -1
  51. package/platforms/atomcode/agents/a2h-executor.frontmatter.md +6 -0
  52. package/platforms/codebuddy/agents/a2h-executor.frontmatter.md +5 -0
  53. package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +2 -2
  54. package/platforms/deveco/agents/a2h-executor.frontmatter.md +7 -0
  55. package/platforms/deveco/agents/build-fixer.frontmatter.md +0 -2
  56. package/platforms/deveco/agents/code-reviewer.frontmatter.md +0 -2
  57. package/platforms/deveco/agents/model-render-worker.frontmatter.md +0 -2
  58. package/platforms/deveco/agents/model-worker.frontmatter.md +0 -2
  59. package/platforms/deveco/agents/specgen-worker.frontmatter.md +0 -2
  60. package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +1 -1
  61. package/platforms/opencode/agents/a2h-executor.frontmatter.md +7 -0
  62. package/platforms/opencode/agents/build-fixer.frontmatter.md +0 -2
  63. package/platforms/opencode/agents/code-reviewer.frontmatter.md +0 -2
  64. package/platforms/opencode/agents/model-render-worker.frontmatter.md +0 -2
  65. package/platforms/opencode/agents/model-worker.frontmatter.md +0 -2
  66. package/platforms/opencode/agents/specgen-worker.frontmatter.md +0 -2
  67. package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +13 -6
  68. package/skills/a2h-app-migrate/SKILL.md +29 -3
  69. package/skills/a2h-app-migrate/references/host-rules.md +33 -0
  70. package/skills/a2h-app-migrate/references/workflow.yaml +24 -4
  71. package/skills/a2h-app-migrate/scripts/opencode_depth.mjs +418 -0
  72. package/skills/a2h-app-migrate/test/test_executor_header_sync.mjs +78 -0
  73. package/skills/a2h-app-migrate/test/test_opencode_depth.mjs +312 -0
  74. package/skills/a2h-app-migrate/tools/dag.mjs +267 -0
  75. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
  76. package/skills/a2h-batch-ui-align/SKILL.md +7 -7
  77. package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -1
  78. package/skills/a2h-batch-ui-align/references/cards/state.md +20 -2
  79. package/skills/a2h-batch-ui-align/references/cards/widgets.md +2 -2
  80. package/skills/a2h-batch-ui-align/references/checker-rules.md +3 -3
  81. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +3 -1
  82. package/skills/a2h-batch-ui-align/references/host-dispatch.md +5 -5
  83. package/skills/a2h-batch-ui-align/references/incremental-scope.md +2 -2
  84. package/skills/a2h-batch-ui-align/references/step3-capture.md +10 -6
  85. package/skills/a2h-batch-ui-align/references/step5-convert.md +13 -9
  86. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +59 -7
  87. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +3 -0
  88. package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +3 -2
  89. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +139 -23
  90. package/skills/a2h-batch-ui-align/scripts/host_env.mjs +32 -8
  91. package/skills/a2h-batch-ui-align/scripts/interactions.mjs +186 -0
  92. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +33 -7
  93. package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +83 -22
  94. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +39 -5
  95. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +82 -0
  96. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +25 -1
  97. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +184 -2
  98. package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +33 -0
  99. package/skills/a2h-batch-ui-align/scripts/tests/interactions.test.mjs +258 -0
  100. package/skills/a2h-page-specgen/SKILL.md +1 -1
  101. package/skills/a2h-page-specgen/references/evidence.md +15 -0
  102. package/skills/a2h-page-specgen/references/gates.md +3 -1
  103. package/skills/a2h-page-specgen/references/scenario-authoring.md +10 -10
  104. package/skills/a2h-page-specgen/references/spec-template.md +2 -2
  105. package/skills/a2h-page-specgen/scripts/contract-calls.mjs +40 -3
  106. package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +73 -5
  107. package/skills/a2h-page-specgen/scripts/gate.mjs +141 -0
  108. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +10 -10
  109. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +10 -10
  110. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +10 -10
  111. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +10 -10
  112. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +10 -10
  113. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +1 -1
  114. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +10 -10
  115. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +10 -10
  116. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +10 -10
  117. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +10 -10
  118. package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +45 -1
  119. package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +100 -0
  120. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +104 -3
  121. package/skills/a2h-resource-convert/references/conversion-rules.md +2 -0
  122. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +36 -1
  123. package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +42 -0
  124. package/skills/a2h-spec-design-pipeline/SKILL.md +1 -1
  125. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +16 -0
  126. package/skills/a2h-spec-design-pipeline/references/execution-model.md +2 -2
  127. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +5 -1
  128. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
  129. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
  130. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +2 -1
  131. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +3 -1
  132. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-v2-observation-cn.md +105 -0
  133. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-v2-observation-en.md +122 -0
  134. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +4 -4
  135. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIV2ObservationCheck.js +1862 -0
  136. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +2 -0
  137. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
  138. package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +15 -2
  139. package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +20 -4
  140. package/skills/a2h-spec-design-pipeline/scripts/test_arkui_v2_observation.ts +284 -0
  141. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +32 -0
  142. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +22 -1
  143. package/skills/a2h-utg-static/SKILL.md +2 -0
  144. package/skills/a2h-utg-static/references/extractors.md +16 -0
  145. package/skills/a2h-utg-static/scripts/run_pipeline.mjs +22 -1
  146. package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +4 -0
  147. package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +15 -0
  148. package/skills/a2h-utg-static/scripts/tests/test_view_attachments.mjs +330 -0
  149. package/skills/a2h-utg-static/scripts/view_attachments.mjs +465 -0
  150. package/platforms/codebuddy/agents/build-fixer.frontmatter.md +0 -5
  151. package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +0 -5
  152. package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +0 -5
  153. package/platforms/codebuddy/agents/model-worker.frontmatter.md +0 -5
  154. package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +0 -5
@@ -48,8 +48,8 @@ Both modes also need **background sub-agents** and **pre-approved writes**. Run
48
48
  Every sub-agent of this skill (Step 2 resources, Step 3 reviewers, Step 5 groups, Step 5.5 wiring, Step 6 verify) is a **background sub-agent of the parent's own host**; which tool that is per host is in [references/host-dispatch.md](references/host-dispatch.md) — **read it before the first dispatch**. The rules, on every host:
49
49
 
50
50
  1. **One call per unit, several in one message.** Record each resume handle with `group_queue.mjs bind --task <handle>`.
51
- 2. **Completion comes from disk, not from the host:** a report file, `answers_check.mjs` complete, or `detach.mjs` exited. `group_queue.mjs wait` blocks on these (≤ 9 min); a host notice is an early hint.
52
- 3. **The parent never holds the foreground for long.** Anything over ~3 min runs through `detach.mjs start … --name <job>`; pass `--job <job>` to `wait`.
51
+ 2. **Completion comes from disk, not from the host:** a report file, `answers_check.mjs` complete, or `detach.mjs` exited. `group_queue.mjs wait` blocks on these (≤ 5 min; a larger `--timeout-s` is capped at 300); a host notice is an early hint.
52
+ 3. **The parent never holds the foreground for long.** Anything over ~3 min runs through `detach.mjs start … --name <job>`; pass `--job <job>` to `wait`. **One `group_queue.mjs wait` per shell call:** never wrap `wait` / `group_pass.mjs` in a loop or chain several waits in one call. Each return goes back to the parent, which acts on it (dispatch, bind, verify) before the next wait: while a call runs, the host queues every completion notice and no slot is refilled (measured: a 12-wait loop held the foreground for an hour while `group_pass` kept printing dispatches).
53
53
  4. **Never cancel by re-dispatching.** A stalled agent is resumed in its own session with the same handle, never replaced by a fresh one (two writers on one file). `Q requeue` enforces this; `--fresh` only after the old session's completion notice. Pass `--task <handle>` to every `Q release` that comes from a notice.
54
54
  5. **Sub-agents cannot dispatch sub-agents**; every prompt says so.
55
55
  5a. **`image_read=false` (Step 1)**: every prompt opens with the `NO_IMAGE` block of `scripts/group_queue.mjs` (`lease` adds it to group messages; the parent adds it to the others), and the parent never opens an image either.
@@ -147,10 +147,10 @@ The skeleton always ends up in `${harmony_project_dir}/.hometrans/utg_static`; S
147
147
 
148
148
  The parent drives `a2h-utg-explorer`'s `run_cycle.mjs` from its `scripts/` directory. `S` is the Step 3.1 workspace; `C=${harmony_project_dir}/.hometrans/utg_explore`.
149
149
 
150
- 1. **Install and identify.** `<adb> -s <serial> install -r <apk_path>`, where `<adb>` is `ADB_PATH` when the caller passed it and `adb` otherwise. Take package and launcher from `aapt dump badging <apk_path>` (look under `<sdk>/build-tools/<newest version>/`), or, after the install, from `<adb> -s <serial> shell cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.LAUNCHER <package>`.
150
+ 1. **Install and identify.** `<adb>` is `ADB_PATH` when the caller passed it and `adb` otherwise. Take the package from `aapt dump badging <apk_path>` (look under `<sdk>/build-tools/<newest version>/`; `package:`) or the app module's `applicationId`. **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. Take the launcher from the same `aapt dump badging` output (`launchable-activity:`) or, after the install, from `<adb> -s <serial> shell cmd package resolve-activity --brief -a android.intent.action.MAIN -c android.intent.category.LAUNCHER <package>`.
151
151
  2. **Plan and compile.** `node plan.mjs $S/utg.json $C`, review `C/plan.md`, then `node compile_tasks.mjs $S/utg.json $C --project <android_project_dir> --locale <device locale>`.
152
152
  3. **Write `$C/config.json`** — `serial`, `package`, `launch_component`, `"adb": "<ADB_PATH>"` when the caller passed `ADB_PATH`, empty fixtures for phases whose `requires` is empty, `snapshot_dir` / `fixture_server_dir` — then **start the fixture server** with `detach.mjs start … --name fixture_server --service`. `d_prereqs.mjs check` must exit 0 before the first cycle.
153
- 4. **Run the cycle.** Always in the background: `node <this skill>/scripts/detach.mjs start ${harmony_project_dir} --name run_cycle -- node run_cycle.mjs $C --config $C/config.json --static $S/utg.json --project <android_project_dir> --package <app package>`. While `finished` is false, dispatch a reviewer for every `waiting` part not yet dispatched (at most `--max-agents`, `blocked_on` first) and start the cycle again once every `blocked_on` worklist is complete. Never ask the user between calls. Recovery A–D and direct launch run inside the cycle without confirmation; pass `--skip D` only when the user forbids app-data changes.
153
+ 4. **Run the cycle.** Always in the background: `node <this skill>/scripts/detach.mjs start ${harmony_project_dir} --name run_cycle -- node run_cycle.mjs $C --config $C/config.json --static $S/utg.json --project <android_project_dir> --package <app package>`. While `finished` is false, dispatch a reviewer for every `waiting` part not yet dispatched (at most `--max-agents`, `blocked_on` first) and start the cycle again once every `blocked_on` worklist is complete. Never ask the user between calls. Recovery A–D and direct launch run inside the cycle without confirmation; pass `--skip D` only when the user forbids app-data changes, and then leave `reset_between_tasks` out as well (`--skip D` does not stop its clears). A login set up by hand on a debuggable build is archived as `initial` and restored before the login phases run and at the end of the cycle, so keep `reset_between_tasks`; on a non-debuggable build, see `references/step3-capture.md` item 3 (on an emulator it is wiped unless `config.json` holds `allow_unarchived_wipe: false` before the first cycle; check debuggability with `run-as <package> true` beforehand, since `states.json` only says so once the cycle has started).
154
154
  5. **Export and build the conversion set once `run_cycle.mjs` prints `finished: true`:**
155
155
 
156
156
  ```bash
@@ -165,9 +165,9 @@ Record for Step 7: coverage from `report.md`, phase states and `skipped` stages,
165
165
 
166
166
  ### Step 3.2-I — Scoped capture (incremental mode's I5)
167
167
 
168
- The Step 3.2 explorer cycle with three deltas, all in `./references/incremental-scope.md` I5: the campaign is planned with `plan.mjs --scope <scope.json>` (tasks, review worklists and `capture_pending.json` then cover only the scope), `run_cycle.mjs` gets `--skip D` unless the user allows app-data changes, and the builder runs with `--scope` / `--existing`. No crawler, no model key.
168
+ The Step 3.2 explorer cycle with three deltas, all in `./references/incremental-scope.md` I5: the campaign is planned with `plan.mjs --scope <scope.json>` (tasks, review worklists and `capture_pending.json` then cover only the scope), `run_cycle.mjs` gets `--skip D` unless the user allows app-data changes (and then `config.json` leaves `reset_between_tasks` out too), and the builder runs with `--scope` / `--existing`. No crawler, no model key.
169
169
 
170
- Install the APK first (`adb [-s <ADB_SERIAL>] install -r -t <apk_path>`); the explorer never installs it, and an install failure stops I5. Without a device, or when the user declines capture, skip the cycle and run only `build_conversion_set.mjs`: every member converts source-only.
170
+ Install the APK first (`adb [-s <ADB_SERIAL>] install -r -t <apk_path>`) with the same check and failure handling as Step 3.2 item 1: skipped when the device already holds this exact APK, never an uninstall on your own. The explorer never installs it, and an install that still fails after that handling stops I5. Without a device, or when the user declines capture, skip the cycle and run only `build_conversion_set.mjs`: every member converts source-only.
171
171
 
172
172
  ### Step 3.3 — Confirm pages.json and coverage
173
173
 
@@ -260,7 +260,7 @@ If a task-tracking tool is available, create one task per page, with already-`do
260
260
  - **5.3** host-chain groups run serially, self-contained groups concurrently; `group_queue.mjs` applies the rules from `plan`. When in doubt, serialize. Rule 7 binds every concurrent prompt:
261
261
 
262
262
  7. **The shared registry surface is parent-owned while any other group is in flight.** Every concurrently dispatched group's prompt states: do not edit `main_pages.json`, `resources/**/element/*.json`, `oh-package*.json5`, `module.json5` or the ability's `loadContent()`. Instead, list the additions in the report under `registry_requests`. The parent applies each group's requests when that group is released, one group at a time. Merge, never overwrite: an existing name with a different value is a conflict, so keep the existing value and record it in the report.
263
- - **5.4** Never dispatch blocking waves. `Q init` once, then one pass per parent turn: release (`Q reap` → `Q release`), lease and dispatch (`Q lease`, pass `message` verbatim, `Q bind`), verify every `returned_unverified` group (`phase5_check.mjs --group`, `Q verified --summary`, which marks its pages `done` in `batch_progress.json`, then `group_commit.mjs`), then `Q wait` with a shell timeout above 9 min. Go on only when `summary.idle` is true, nothing is unverified and `summary.stuck` is empty.
263
+ - **5.4** Never dispatch blocking waves. `Q init` once, then one pass per parent turn: release (`Q reap` → `Q release`), lease and dispatch (`Q lease`, pass `message` verbatim, `Q bind`), verify every `returned_unverified` group (`phase5_check.mjs --group`, `Q verified --summary`, which marks its pages `done` in `batch_progress.json`, then `group_commit.mjs`), then one `Q wait` with a shell timeout above 5 min (e.g. 600000 ms). Go on only when `summary.idle` is true, nothing is unverified and `summary.stuck` is empty.
264
264
  - **5.5** One background sub-agent (Step 0.1) does the wiring: confirm every `registry_requests` was applied, wire self-contained components and shell hosts, and wire navigation from `navigates_to`. No group is in flight any more, so this agent may edit the registry surface of Rule 7. The parent writes `${harmony_project_dir}/.hometrans/work/prompts/wiring.md` (the Step 5.5 procedure of step5-convert.md plus its inputs), dispatches it the way Step 2 is dispatched, and joins on `.hometrans/work/wiring.report.md`. **Entry gate:** `node scripts/group_queue.mjs status ${harmony_project_dir} --assert-settled` exits 0 (no group left open; see step5-convert.md item 5). After a `Q stop`, it cannot pass: skip Steps 5.5 and 6 and write the Step 7 report. **Gate (parent re-checks after the join):** `orphan-component` is zero, and `phase5_check.mjs --files <every file changed since the last group commit>` has `blocking` 0, and `node scripts/shell_requests.mjs verify --hp ${harmony_project_dir}` exits 0 (every ledger id answered, every deleted `.ets` has its merge line), before Step 6. Run `shell_requests.mjs collect` before writing `wiring.md` and put its table in the prompt; carry every `deferred` row into Step 7's Manual Follow-up TODOs. Take that file list from `git status --porcelain` (modified and untracked), not from the report: a file the agent edited but left out of the report would otherwise skip the gate and still be committed. The parent then commits the wiring.
265
265
 
266
266
  ## Step 6 — Static Check, Build, Smoke Gate
@@ -10,7 +10,7 @@
10
10
  **对齐要看父容器,不只看含 Text 的那个容器**:`Column` 的子节点里只要有**收缩宽度**的容器(未设 `.width()` / `.layoutWeight()` 的 `Row`/`Column`/`Stack`,典型是「图标 + 标题」行),决定它水平位置的是**父** `Column` 的 `alignItems`,子 `Row` 自己的 `justifyContent(FlexAlign.Start)` 只管 Row **内部**,管不到 Row 在父中的位置。实测漏检:卡片标题行 `Row() { Image; Text }` 被报 `container-align-unset`,回答「Row 主轴默认 Start」本身正确,于是放行,而真正让它居中的是未写 `alignItems` 的卡片 `Column`。修法:父 `Column` 显式 `.alignItems(HorizontalAlign.Start)`,或给子行 `.width('100%')`。检查器 CAND `column-shrink-child-centered`。
11
11
  **`Scroll` 的 `.align()` 决定内容短于视口时的位置**,默认 `Alignment.Center`。**`Alignment.Start` = 左 + 垂直居中,不是左上**。Android `ScrollView`/`NestedScrollView`/`RecyclerView` 内容默认从顶部开始,通常应取 `Alignment.TopStart`(或 `Top`/`TopEnd`)。例外要有 Android 依据:`fillViewport="true"` + 子布局 `gravity="center"`(登录页、空状态页居中)对应 `Alignment.Center`;`stackFromEnd`/`reverseLayout`(聊天页靠底)对应 `Bottom*`。**`align` 是通用属性(API 参考「位置设置」),文档列明它在 `Scroll` 上生效、默认 `Alignment.Center`** —— `scroll.d.ts` 里搜不到 `align` 是因为它定义在 `CommonMethod`,不是 Scroll 不支持,不能据此跳过。「内容恒超视口,对齐无所谓」也不是理由:内容来自 `ForEach`/`LazyForEach`/`Repeat` 时,条数少(筛选后、首屏只回一页、空态切回)是常态。检查器:`Alignment.Start` 报 GATE `scroll-align-not-top`(几乎必是误当左上);其余非 Top 值报 CAND `scroll-align-not-top`;未写 `.align()` 且内容是数据驱动列表时报 GATE `scroll-align-default-center`,只能用 Scroll 上方的 `// SCROLL-CENTER: <依据>` 降级(EVIDENCE 文字不关闭),静态内容未写时为 CAND。
12
12
  **横向 `Scroll`(`LazyRow` / `HorizontalScrollView`)看的是水平位置**:未写宽度时它按内容收缩,所在 `Column` 默认 `HorizontalAlign.Center` 会把整排推到中间(「我的足迹」只有一两条时居中,安卓从左排起)。写 `.width('100%').align(Alignment.Start)`(横向时 `Start` = 左 + 垂直居中,正是所需),或父 `Column` 写 `.alignItems(HorizontalAlign.Start)`。GATE/CAND `hscroll-centered-in-column`。
13
- **Compose `Box` 子节点的单独对齐(`Modifier.align(X)`)**:`Box(contentAlignment = C)` 里子节点写 `Modifier.align(X)`(X ≠ C)时,该子节点按 X 放、其余按 C 放。ArkUI `Stack` 没有按子节点的对齐,子节点 `.align()` 只排它自己的内容,所以 X 必须单独表达:把该子节点包进与 Stack 同尺寸的容器并在容器里按 X 排(`BottomCenter` + `padding(bottom = 5.dp)` → `Column() { … }.width('100%').height('100%').justifyContent(FlexAlign.End).padding({ bottom: 5 })`;`CenterStart` → `Row()…justifyContent(FlexAlign.Start)`),或用 `.position` / `.markAnchor` 定位。**只留下 `padding` 改成单侧 `margin` 不算译了对齐**:Stack 仍居中,它压在居中的兄弟上。group pack 的「Box children with their own alignment」一节列出本组每一处(`文件:行号`),本项逐条给出鸿蒙侧的 `文件:行号` 与所用写法。检查器:显式 `alignContent: Alignment.Center` 与不写一样走 GATE `stack-overlay-default-center` / `stack-child-align-noop`。
13
+ **Compose `Box` 子节点的单独对齐(`Modifier.align(X)`)**:`Box(contentAlignment = C)` 里子节点写 `Modifier.align(X)`(X ≠ C)时,该子节点按 X 放、其余按 C 放。ArkUI `Stack` 没有按子节点的对齐,子节点 `.align()` 只排它自己的内容,所以 X 必须单独表达:把该子节点包进与 Stack 同尺寸的容器并在容器里按 X 排(`BottomCenter` + `padding(bottom = 5.dp)` → `Column() { … }.width('100%').height('100%').justifyContent(FlexAlign.End).padding({ bottom: 5 }).hitTestBehavior(HitTestMode.Transparent)`;`CenterStart` → `Row()…justifyContent(FlexAlign.Start)`),或用 `.position` / `.markAnchor` 定位。这个同尺寸容器盖住整个 Stack:不写 `hitTestBehavior(HitTestMode.Transparent)` 时它的空白区按 `HitTestMode.Default` 阻塞兄弟节点,下层的列表点不动也滑不动(GATE `fullsize-container`)。**只留下 `padding` 改成单侧 `margin` 不算译了对齐**:Stack 仍居中,它压在居中的兄弟上。group pack 的「Box children with their own alignment」一节列出本组每一处(`文件:行号`),本项逐条给出鸿蒙侧的 `文件:行号` 与所用写法。检查器:显式 `alignContent: Alignment.Center` 与不写一样走 GATE `stack-overlay-default-center` / `stack-child-align-noop`。
14
14
 
15
15
  ### Phase 5「水平内缩证据」—— 判据
16
16
 
@@ -1,7 +1,7 @@
1
1
  # 知识卡 — 状态管理:观测装饰器
2
2
 
3
- > 必读。Phase 5「观测装饰器缺失」的判据(两种范式共用部分)。
4
- > 本卡由 `conversion-procedure.md` 拆出,规则原文不变;卡内提到的 Phase 编号指 `conversion-procedure.md` 的对应阶段。
3
+ > 必读。Phase 5「观测装饰器缺失」的判据(两种范式共用部分),以及 ForEach / LazyForEach / Repeat 的键值规则。
4
+ > 「观测装饰器缺失」一节由 `conversion-procedure.md` 拆出,规则原文不变;「键值生成函数」一节为本卡新增。卡内提到的 Phase 编号指 `conversion-procedure.md` 的对应阶段。
5
5
 
6
6
  ### Phase 5「观测装饰器缺失」—— 判据
7
7
 
@@ -12,3 +12,21 @@
12
12
 
13
13
  - V2:`@ObservedV2` 类中所有在 UI 中使用的属性是否都加了 `@Trace`?没有则补(`@ObservedV2` 与 `@Trace` 必须配合,单独使用任一个都不生效)。派生值用 `@Computed`。
14
14
  - 范式一致性:本页新增/修改的组件与 VM/Model 是否与工程判定范式一致?严禁 V1/V2 装饰器混用(如 `@Component` 里用 `@Local`、`@ComponentV2` 里用 `@State`)
15
+
16
+ ### ForEach / LazyForEach / Repeat 的键值生成函数
17
+
18
+ 鸿蒙的 key 一个值同时决定「是不是同一项」和「要不要重建这一行」:key 不变,ForEach 就复用旧节点、不重跑子项生成器。Android 把这两件事分成两层:`areItemsTheSame`(身份)和 `areContentsTheSame`(内容)。所以 key 要同时满足:
19
+
20
+ - **唯一且稳定**:以 Android 的身份字段为基础,也就是 `DiffUtil.ItemCallback.areItemsTheSame`、`Adapter.getItemId` + `setHasStableIds(true)`、Compose `items(key = { … })` 用的字段。数据可能增删、重排时,不要用 index、`Math.random()` / `Date.now()`,也不要用可能重复的显示文本(如 title)。
21
+ - **覆盖会变的显示内容**:拼上 `areContentsTheSame` 比较的、会影响该行显示的字段,如 `${item.id}:${item.status}`。只用身份键时,换成同 id 的新对象后行内内容不刷新(退页重进才对);`@ObservedV2` / `@Trace` 也不能跨过被复用的行传值。`JSON.stringify(item)` 能覆盖全部字段,可以用,但条目多、对象大时开销高。只有行内每个可变字段都确定不会变(只读数据)时,才可以只用身份键,并在 ForEach 上方写 `// FOREACH-KEY: <理由>`。
22
+ - **Android 侧没有稳定 ID 时**(`ArrayAdapter` / `BaseAdapter` + `notifyDataSetChanged`、Compose `items(list)` 不带 key):内容固定、不会增删重排的列表(菜单、页签),可以用 index 或省略 key 生成函数(用默认规则),在注释里写明 Android 依据(`文件:行号`);数据会增删、重排时,到数据模型里找主键,找不到就用 `JSON.stringify(item)`,不要现编字段。
23
+ - 写法:`ForEach` / `LazyForEach` 的第三个参数,`Repeat` 的 `.key()`。默认规则:ForEach 为 index + `JSON.stringify(item)`,LazyForEach 为 viewId + index,都不能在数据增删、重排时保持稳定。
24
+
25
+ 检查器:a2h-spec-design-pipeline 的 `foreach-key-stale-render`(warn)会报「key 只含身份字段、生成器又读了会变的字段」,`// FOREACH-KEY: <理由>` 关闭单处;同一要求见 `a2h-arkts-logic-coder/references/ISSUES.md`。
26
+
27
+ ## 常见误译(编译期无法发现)
28
+
29
+ | 误译 | 为什么会发生 | 后果 | 自查方法 |
30
+ |---|---|---|---|
31
+ | **ForEach / LazyForEach / Repeat 在数据会增删、重排时省略 key 生成函数,或用 index / 可能重复的显示文本做 key** | 省略时用默认规则(ForEach:index + `JSON.stringify(item)`;LazyForEach:viewId + index),编译不报错 | 增删、重排后组件复用错位(状态串到别的行、图片错位),或重复 key 导致数据项不渲染 | → 本卡「键值生成函数」:逐个列出 key 取自哪些字段及 Android 依据(`areItemsTheSame` / `getItemId` / `items(key=)`) |
32
+ | **只用 id 做 key,而行内显示会变的字段** | 只照搬了 `areItemsTheSame`,漏了 `areContentsTheSame` 这一层 | 换成同 id 的新对象(如未读 → 已读)后行内内容不刷新,退页重进才正确 | → 本卡「覆盖会变的显示内容」;`foreach-key-stale-render`,确属只读数据时写 `// FOREACH-KEY: <理由>` |
@@ -33,8 +33,8 @@
33
33
  | Android | `bindSheet` 选项 | 依据 |
34
34
  |---|---|---|
35
35
  | `skipPartiallyExpanded = false`(默认值) | `detents: [SheetSize.MEDIUM, SheetSize.LARGE]`:先停在半屏,可以拖到全屏 | 半模态文档:「元组中第一个高度为初始高度」;设置了 `detents` 时 `height` 无效 |
36
- | `skipPartiallyExpanded = true` | `height: SheetSize.LARGE`(不写 `detents`) | 一开始就全屏展开 |
37
- | `BottomSheetDialog` + `behavior.state = STATE_EXPANDED` / `skipCollapsed = true` | `height: SheetSize.LARGE` | 同上 |
36
+ | `skipPartiallyExpanded = true` | 面板内容自适应高度(`wrapContentHeight`、无 `fillMaxHeight` / `weight`):`height: SheetSize.FIT_CONTENT`;内容撑满时才写 `height: SheetSize.LARGE`(都不写 `detents`) | 直接完全展开;Material3 完全展开的高度是内容高度(窗口限高),不是全屏。`FIT_CONTENT` 时 builder 根节点高度不能用百分比(半模态文档 SheetSize.FIT_CONTENT 说明) |
37
+ | `BottomSheetDialog` + `behavior.state = STATE_EXPANDED` / `skipCollapsed = true` | 同上:内容自适应 → `SheetSize.FIT_CONTENT`,内容撑满 → `SheetSize.LARGE` | 同上 |
38
38
 
39
39
  **部件归属判 (a) 自绘时,行为一并接管**:上面三类判定只问了装饰「画几遍、像不像」。改判 (a) 自绘、原子组件不再实例化后,原子组件自带的**交互行为**也一起没了(拖动关闭、惯性、键盘避让、返回键、无障碍角色),编译、截图对比、GATE 都看不出来。所以 (a) 行除了图形结构,还要列出「原控件自带行为 → 自绘实现的 `文件:行号`」,任一行为没有实现位置的,标 `需上报`。
40
40
 
@@ -611,8 +611,8 @@
611
611
  - 级别: GATE
612
612
  - 需要: `--resources`
613
613
  - 知识卡: `references/cards/resources.md`
614
- - 触发: 被 `.fillColor()` 染色的 `app.media.*` 在任何资源限定目录下都只有位图(png/webp/jpg/bmp/gif),没有 SVG。
615
- - 修法: SDK:fillColor「仅对SVG图源生效…如需对png图片进行修改颜色,可以使用colorFilter」。去掉 fillColor,改用 `.colorFilter(new ColorFilter([0,0,0,0,r, 0,0,0,0,g, 0,0,0,0,b, 0,0,0,1,0]))`(r/g/b 取 0~1,保留 alpha,= Android `tint` / `ColorFilter SRC_IN`);或把该图标从 Android `<vector>` 转成 SVG。
614
+ - 触发: 被 `.fillColor()` 染色的 `app.media.*` 在任何资源限定目录下都只有位图(png/webp/jpg/bmp/gif),没有 SVG;或有 SVG,但某个目录里只有同名位图、没有 SVG —— 限定目录(xxldpi/ 等)先于 base/ 匹配,SVG 所在目录都不匹配时用 base/,运行时拿到的是位图。
615
+ - 修法: SDK:fillColor「仅对SVG图源生效…如需对png图片进行修改颜色,可以使用colorFilter」;资源匹配「优先从相匹配的限定词目录中寻找…找不到时才会去base目录」。同名 SVG 在 base/ 时删掉限定目录里的同名位图(多为 Android 打包给矢量图生成的密度兜底 PNG);base/ 没有 SVG 时把 SVG 复制到 base/ 并删掉位图。只有位图时去掉 fillColor,改用 `.colorFilter(new ColorFilter([0,0,0,0,r, 0,0,0,0,g, 0,0,0,0,b, 0,0,0,1,0]))`(r/g/b 取 0~1,保留 alpha,= Android `tint` / `ColorFilter SRC_IN`);或把该图标从 Android `<vector>` 转成 SVG。
616
616
  - 降级标记: 无
617
617
 
618
618
  ### fillcolor-on-stroke-svg
@@ -794,7 +794,7 @@
794
794
  - 需要: —
795
795
  - 知识卡: `references/cards/interaction.md`
796
796
  - 触发: 宽高 `'100%'`(在 `Stack`/`RelativeContainer` 里也包括与父容器写同一尺寸表达式的轴)且没有 `hitTestBehavior` 的节点,检查器按结构证明不了它不吞点击。证明得了的(自身可交互、父容器不层叠、下方没有可点击元素、整页根节点)不再列出。写了任何 `hitTestBehavior`(含 `Block`/`Default`)即视为作者已明确选择,不在检查范围内。
797
- - 修法: GATE「条件显示的覆盖层」:它显示时挡住下方的可点击元素。本意就是挡住输入(加载遮罩、模态层)时写降级标记 `// HIT-TEST: blocks-input: <依据>`,否则加 `.hitTestBehavior(HitTestMode.None)`。GATE「子树可交互的覆盖层」:它本身挡住下方的可点击元素,子节点仍要收点击时加 `.hitTestBehavior(HitTestMode.Transparent)`;本意就是盖住下层(全屏 sheet 盖住自己的遮罩)时写 `// HIT-TEST: covers-below: <依据>`。CAND(下方或自身含扫描范围外的组件、`zIndex` 改了层序、未找到调用处):检查器判不了,按「交互可达性证据」核对。
797
+ - 修法: GATE「条件显示的覆盖层」:它显示时挡住下方的可点击元素。本意就是挡住输入(加载遮罩、模态层)时写降级标记 `// HIT-TEST: blocks-input: <依据>`,否则加 `.hitTestBehavior(HitTestMode.None)`。GATE「子树可交互的覆盖层」:它本身挡住下方的可点击元素,子节点仍要收点击时加 `.hitTestBehavior(HitTestMode.Transparent)`;本意就是盖住下层(全屏 sheet 盖住自己的遮罩)时写 `// HIT-TEST: covers-below: <依据>`;被盖住的兄弟含可滚动容器(Scroll / List / Grid / WaterFlow / Swiper …)时该标记不生效,只能改代码。CAND(下方或自身含扫描范围外的组件、`zIndex` 改了层序、未找到调用处):检查器判不了,按「交互可达性证据」核对。
798
798
  - 降级标记: `// HIT-TEST: <blocks-input|covers-below>: <依据>`
799
799
 
800
800
  ### hidden-layer-children-hit
@@ -110,7 +110,7 @@ key 的前缀即范式:V2 分支只读 `v2-*`,V1 分支只读 `v1-*`;`mix-
110
110
 
111
111
  ### 4.1 解析 meta.json
112
112
 
113
- 提取:`page_id`、`label`、`clickable_elements`(含 class/resource-id/text/content-desc/bounds)、`click_path`、`came_from`/`trigger_element`、`screenshot` / `screenshots`、`view_xml` / `view_xmls`。
113
+ 提取:`page_id`、`label`、`clickable_elements`(含 class/resource-id/text/content-desc/bounds)、`click_path`、`came_from`、`screenshot` / `screenshots`、`view_xml` / `view_xmls`,以及静态 UTG 的 `reached_from` / `navigates_to`(每条边带 `mechanism`、`trigger`,有则带 `guard` 跳转条件、`label` 触发控件文案、`gesture` 非点击手势)和 `interactions`(页内交互,见 Phase 4.3「页内交互」)。captured 页与 source-only 页都有这些字段。
114
114
 
115
115
  父 skill 已对 `REFERENCE_SCREENSHOTS` 和 `REFERENCE_VIEW_TREES` 做过精确路径读取验证。必须再次按传入路径读取它们,**每个状态的每一帧都读**,不得只读第一张;不得自行用 Glob 空结果推翻父 skill 的验证,也不得声称已验证存在的截图不存在。
116
116
 
@@ -212,6 +212,8 @@ dialog/fragment/adapter 等必须从主页面拆出去到 `{harmony_project_dir}
212
212
  - **优先真实实现**:mock 之前先在 `{harmony_project_dir}` 搜目标页面/组件 .ets 是否存在;存在则接真实 `router.pushUrl()`;**仅当目标尚未实现**才 mock + `console.info('TODO: ...')`
213
213
  - **入口不得静默禁用**:Android 处理函数非空、目标却不在转换集里时,保留可点击节点,不写 `.hitTestBehavior(HitTestMode.None)`(GATE `click-handler-untestable`),处理函数里写 `// UNWIRED: <Android 处理函数 文件:行> — <原因>`(只有注释的空函数是 GATE `empty-click-handler`,带此标记降为 CAND `unwired-handler`),并在报告 `UNWIRED 入口` 里逐条登记。故意吸收点击的空 `onClick`(弹层卡片区域不让遮罩关闭)写 `// CLICK-SINK: <依据>`。
214
214
  - **弹层的宿主副作用**:`SOURCE_PACK` 有「Overlay host effects」一节时,打开 / 关闭弹层除了切换弹层自己的显示标志,还要在打开 / 关闭它的代码里实现每条 effect(按 `resolved` 语句,如 `contentOpacity = 0` 让卡片淡出),并在实现语句上或上方 3 行内写 `// EFFECT: <id>`;确实不该移植的写 `// EFFECT-OMIT: <id> — <依据>`。
215
+ - **页内交互**:`SOURCE_PACK` 有「In-page interactions」一节时,每条都是 Android 里存在、但截图和点击清单都看不到的交互(例如 `chart.setMarker(..)`:点击曲线才出现高亮线和气泡)。按 Android 源码里接收方的配置实现同样的行为(什么手势触发、显示什么、禁用了什么),ArkUI 组件没有内置等价物时自己写触摸处理(`.onTouch` / `.gesture`)并把附属视图叠加上去;在实现语句或事件属性上、或上方 3 行内写 `// INTERACTION: <id>`;确实不该移植的写 `// INTERACTION-OMIT: <id> — <依据>`。来自被 attach 子节点的交互同样由宿主页负责。同一个 id 列在多个页面下时,说明它来自基类或复用组件里的同一行代码:在共享组件里实现一次、标一次,即覆盖所有这些页面。
216
+ - **带条件的跳转**:`navigates_to` 的边带 `guard` 时,跳转写在同样的条件下(如 `!isLoggedIn` 才跳登录页),不得写成无条件跳转;带 `gesture`(`long_press`、`double_tap`、`swipe-*`)时用对应的手势,不得写成 `.onClick`。
215
217
  - **mock 不引用不可达地址**:mock 里的图片/图标不用虚构 URL(如 `https://mock.weather.icon/…`、`example.com`),它们必然加载失败,渲染成空白格,与参考不符。用工程里已转换的同语义资源(`$r('app.media.…')`),没有就登记 `已降级` 并留空占位;运营下发的远程图标在报告里列为「数据层接入后生效」。
216
218
  - **mock 数据必须复现参考截图的可见状态**:mock/占位数据不是自由值。参考截图里每个可见条目的**取值、数量、起止与顺序**都必须被 mock 如实复现(真实数据层未转换时,mock 应从参考截图**反推**得出)。若实现产出的可见状态与参考不一致,**不得**以「这是 mock 数据、接真实数据后会自愈」为由判定通过 —— 必须先证明规则层正确,再讨论数据来源。规则层错误(选择规则、序列起点、条目数)接上真实数据同样是错的。
217
219
 
@@ -9,27 +9,27 @@ Both modes also need, for unattended sub-agents (Step 0.1):
9
9
 
10
10
  | Requirement | Check | If missing |
11
11
  |---|---|---|
12
- | Background sub-agents | `node ./scripts/host_env.mjs check` → `background_ready`. Claude Code: always ready. **opencode v2+: always ready** — background sub-agents are native (`native_background: true`, the `subagent` tool's `background: true`), no flag. opencode v1 (≥ 1.16.2) / DevEco Code (0.2.0-3) need `OPENCODE_` / `DEVECO_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true`, which the host reads only at start-up | follow `action`. When it starts with `none` (Claude, opencode v2, or a v1/DevEco session with the flag active), go straight on. When the result carries `verify` (`opencode_version_source: "path"`), the version came from the `opencode` on PATH, which may not be this session's binary: trust your own tool list instead — a `subagent` tool means v2 (native), only `task` means v1 (follow the flag path as if `native_background` were false). `enable` (v1/DevEco only): run `node ./scripts/host_env.mjs enable` (persists both flags for the user: Windows `setx`, macOS/Linux a marked block in the shell rc; `disable` removes them). After `enable` or on `restart`, tell the user to restart the host session from a new terminal and resume this skill there; stop here until they do. If they decline, continue with blocking waves (Step 0.1 item 6) |
12
+ | Background sub-agents | `node ./scripts/host_env.mjs check` → `background_ready`. Claude Code: always ready. **opencode v2+: always ready** — background sub-agents are native (`native_background: true`, the `subagent` tool's `background: true`), no flag. **DevEco Code: ready by default** — `DEVECO_EXPERIMENTAL_BACKGROUND_SUBAGENTS` defaults to on, so it is only not ready when the user explicitly set it to `false` / `0`. opencode v1 (≥ 1.16.2) needs `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true`. Both flags are read only at start-up | follow `action`. When it starts with `none` (Claude, opencode v2, DevEco without the flag turned off, or a v1 session with the flag active), go straight on. When the result carries `verify` (`opencode_version_source: "path"`), the version came from the `opencode` on PATH, which may not be this session's binary: trust your own tool list instead — a `subagent` tool means v2 (native), only `task` means v1 (follow the flag path as if `native_background` were false). `enable` (v1/DevEco only): run `node ./scripts/host_env.mjs enable` (persists both flags for the user: Windows `setx`, macOS/Linux a marked block in the shell rc; `disable` removes them). After `enable` or on `restart`, tell the user to restart the host session from a new terminal and resume this skill there; stop here until they do. If they decline, continue with blocking waves (Step 0.1 item 6) |
13
13
  | Pre-approved writes | the session may edit under `harmony_project_dir` and run `node <this skill>/scripts/*`, `node <a2h-utg-*>/scripts/*`, `adb` without asking | sub-agents inherit the parent's permissions, so an unapproved first write waits for a human. Ask the user to allow them (Claude Code: `permissions.allow`; opencode/DevEco: the agent's `permission` config) |
14
14
 
15
15
  ### Step 0.1 — How sub-agents are dispatched (every step)
16
16
 
17
17
  Every sub-agent of this skill (the Step 2 resource agent, the Step 3 reviewers, the Step 5 groups, the Step 5.5 wiring agent, the Step 6 verify agent) is a **background sub-agent of the parent's own host**: Claude Code `Agent`; **opencode v2 the `subagent` tool with `background: true`**; opencode v1 / DevEco `task` with `background: true` (v2 renamed the v1 `task` tool to `subagent`). No other agent CLI is started. Which one applies is exactly what `host_env.mjs check` reported in Step 0 (`native_background: true` ⇒ the v2 `subagent` tool).
18
18
  1. **One call per unit, several in one message.** Each returns at once with a resume handle — opencode v2 the `sessionID`, opencode v1 / DevEco the `task_id`, Claude Code the agent id. Record it (`group_queue.mjs bind --task <handle>`), because a resume must continue *that* session.
19
- 2. **Completion comes from disk, not from the host.** A group is done when its report file exists; a reviewer when `answers_check.mjs` says complete; a background command when `detach.mjs` says exited. `group_queue.mjs wait` blocks until one of these happens (≤ 9 min), so refill takes seconds whenever the host delivers its completion notice. Treat a notice as an early hint and act on it the same way.
19
+ 2. **Completion comes from disk, not from the host.** A group is done when its report file exists; a reviewer when `answers_check.mjs` says complete; a background command when `detach.mjs` says exited. `group_queue.mjs wait` blocks until one of these happens (≤ 5 min, one wait per shell call), so refill takes seconds whenever the host delivers its completion notice. Treat a notice as an early hint and act on it the same way.
20
20
  3. **The parent never holds the foreground for long.** While a foreground shell call runs, no slot is refilled. Run anything over ~3 min in the background: `node ./scripts/detach.mjs start ${harmony_project_dir} --name <job> -- <command…>` (or the host's own background shell), and pass `--job <job>` to `wait`.
21
21
  4. **Never cancel by re-dispatching.** opencode and DevEco have no tool to cancel a background task. A stalled agent is resumed in its own session — opencode v2: `subagent` with its `sessionID`; opencode v1 / DevEco: `task` with its `task_id` — which queues behind the old run. It is never replaced by a fresh agent, which would leave two writers on one file. Claude Code may stop it (TaskStop) before resuming.
22
- - A resume call always carries the handle. If the tool call errors (e.g. a missing `agent` parameter), fix the error and retry **with the same `sessionID` / `task_id`**; a retry without it starts a new session.
22
+ - A resume call always carries the handle. If the tool call errors (e.g. a missing `agent` parameter), fix the error and retry **with the same `sessionID` / `task_id`** and the same `background: true`; a retry without the handle starts a new session, and one without `background` blocks the parent until that agent finishes.
23
23
  - A heartbeat that looks old does not prove a session dead. Its times are epoch seconds in local time. Only the host's completion notice proves the session ended.
24
24
  - `Q requeue` enforces this rule: a group whose bound session stalled is requeued into that same session. `--fresh` overrides this and returns `stop_first: true` plus a `warning`. Dispatch the fresh agent only after the old session's completion notice has arrived (Claude Code: after TaskStop).
25
25
  - Pass `--task <handle>` to every `Q release` that comes from a completion notice. A notice from a session other than the group's bound one, or from one a fresh dispatch retired (`prev_sessions`; a fresh lease clears `session` until the next `bind`), returns `stale-notice` and changes nothing.
26
- 5. **Sub-agents cannot dispatch sub-agents** (`subagent_depth` 1); every prompt says so.
26
+ 5. **Sub-agents never dispatch sub-agents of their own.** Under `a2h-app-migrate` they already run at depth 2 (node executor at depth 1), the deepest level the migration relies on; every prompt says so.
27
27
  5a. **Image reads follow `image_read` (Step 1: passed by the caller, else probed by one throwaway sub-agent with `scripts/image_probe.mjs` before any other dispatch, never assumed `true`).** When it is `false`, every prompt this skill hands a sub-agent opens with the `NO_IMAGE` block of `scripts/group_queue.mjs` (verbatim): `lease` adds it to Step 5 group messages itself; the parent adds it to the Step 2 resource, Step 3 reviewer, Step 5.5 wiring and Step 6 verify prompts. The parent never opens an image either. The probe makes this the exception, not the way the capability is discovered. A sub-agent that still dies on image content (`messages.content.type` invalid, the session cannot be resumed) means the host cannot read images: set `image_read` to `false` in `host_caps.json` for the rest of the run, release that unit and dispatch it fresh, and say so in the Step 7 report.
28
28
  6. **Without background sub-agents** the same loop runs, but each `lease` is dispatched as one blocking wave. This is correct but slow, because every wave waits for its slowest member. Say so in the Step 7 report.
29
29
  7. **If the parent session ends,** its sub-agents end with it. A new session re-runs `group_queue.mjs init`, which keeps results and queues the interrupted groups to resume.
30
30
  - **One parent per campaign.** Never assume the previous parent ended because this is a new session: the user may have opened a second one while the first is still dispatching. Before writing **anything** under `.hometrans/` (plan, prompts, measure packs, `batch_progress.json`, queue), check: a `detach.mjs status` job `running` (other than a `service: true` one such as `fixture_server`, which runs across sessions by design), a `reviewers.json` entry bound in the last 20 min whose answers are incomplete, or a running group with recent activity. `Q init` runs the same check and refuses (`another parent session may still be driving this campaign`). On any of these, stop and ask the user: monitor only, or stop that session and re-run `init --takeover`. `Q wait`, `lease`, `reap` and `refresh` are not read-only either (they re-plan and settle groups), so a monitoring session never calls them.
31
31
  - **A crashed parent is told apart by its heartbeat.** Every queue command and each `wait` poll writes `.hometrans/queue_parent.json`. A live parent sits in `wait`, so its beat is seconds old. A beat older than 10 min with no group or reviewer activity after it means the parent is gone (its sub-agents went with it): `init` then resumes without `--takeover`, and that parent's background jobs, which outlive it, come back as `adopt_jobs` to wait on with `wait --job`. Otherwise the refusal ends with `retry_after_s=N`, the time until a crash would be provable.
32
- - **Skill agents are followed through their report.** The Step 2 resource, Step 5.5 wiring and Step 6 verify agents write no heartbeat. Bind each as you dispatch it: `group_queue.mjs review-bind <hp> --name resources|wiring|verify --kind skill-agent --answers <its report file>`. `wait` then returns `agent` (`agents_done`) when the report appears, and `agent-silent` (`agents_silent`) when none appeared 3× the stall limit (at least 45 min) after the bind: check that agent's session and resume it with its task id.
32
+ - **Skill agents are followed through their report.** The Step 2 resource, Step 5.5 wiring and Step 6 verify agents write no heartbeat. Bind each as you dispatch it: `group_queue.mjs review-bind <hp> --name resources|wiring|verify --kind skill-agent --answers <its report file>`. `wait` then returns `agent` (`agents_done`) when the report appears, and `agent-silent` (`agents_silent`) when none appeared 3× the stall limit (at least 45 min) after the bind: check that agent's session and resume it with its task id. An idle queue is reported (`idle`) once; after that, while a bound skill agent or reviewer, an `--answers` file or a `--job` is still pending, `wait` blocks for it instead of returning `idle` again, so wait on the wiring / verify agent with `Q wait` too, never with `Start-Sleep` / `sleep`. Such a wait ends with the news (`agent`, `answers`, `job`, …) or, at `--timeout-s` (at most 300 s), with `timeout` and `waiting_on` listing what held it; `summary.idle` is still in the result. Read `agents_done` / `waiting_on` and call `Q wait` again. A reviewer whose agent ended without its answers stays in `waiting_on` until you `review-unbind` it. On `agent-silent` / `answers-silent`, resume that agent or `review-unbind` it first: until then every `wait` returns at once with the same silence instead of blocking. After `init` in a new session (crash, `--takeover`), the skill agents and reviewers the previous session bound ended with it: resume each from its task id or `review-unbind` it.
33
33
 
34
34
  ## Step 1 — `STATE_DOCS` failure modes
35
35
 
@@ -130,10 +130,10 @@ a2h-app-migrate 的 `discover.feature_scope` 已按功能确认过范围(或
130
130
  node compile_tasks.mjs $S/utg.json $C --project <android_project_dir> --locale <device locale>
131
131
  ```
132
132
  `--scope` 自动纳入挂在成员上的 menu / ui-state / mode / 内嵌 fragment(宿主判定与 `build_conversion_set.mjs` 相同);只改 `utg.json` 后 `plan.mjs --extend` 不带 `--scope` 也会按新图重算范围。范围外的节点视为已结清:设备阶段跳过以它们为目标的任务(`task_skipped: target-out-of-scope`;去往成员的路径上照样经过它们),A–D 与 direct launch 的审阅清单不收它们,`capture_pending.json` 只列成员。所以审阅量与设备时长按成员数计,不按全 app。
133
- 2. **`run_cycle.mjs` 加 `--skip D`**,除非用户明确同意改动应用数据。增量面对的常是用户正在用的应用;D 会 `pm clear` 并按配方造数据。成员需要的数据态因此进 `deferred_human.json`,由 Step 7 报告。
133
+ 2. **`run_cycle.mjs` 加 `--skip D`,同时 `config.json` 不写 `reset_between_tasks`**,除非用户明确同意改动应用数据。增量面对的常是用户正在用的应用;D 会 `pm clear` 并按配方造数据,`reset_between_tasks` 也会在每个 `p0-fresh` task 前 `pm clear`。`--skip D` 只跳过 D 与 fresh 快照,拦不住后者,所以两项要一起做。成员需要的数据态因此进 `deferred_human.json`,由 Step 7 报告。
134
134
  3. **`--max-rounds 1`** 通常已够(成员少,direct launch 一轮就能结清);仍有成员答了 `launch` 而未覆盖时再放宽。
135
135
 
136
- 其余(config.json、审阅子 agent、看门狗、`detach.mjs` 后台运行)照抄 Step 3.2。
136
+ 其余(config.json 除上面第 2 条的 `reset_between_tasks` 外、审阅子 agent、看门狗、`detach.mjs` 后台运行)照抄 Step 3.2。
137
137
 
138
138
  **建 plan**(`run_cycle.mjs` 输出 `finished: true` 后,与全量 Step 3.2 item 5 相同,多两个参数):
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 in the `wait` loop; 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
- - loop on `node ./scripts/group_queue.mjs wait ${harmony_project_dir}` (plus `--job run_cycle` in Step 3.2 while it runs). 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`), 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 9 min. Give the shell call a timeout above that;
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> -s <serial> install -r <apk_path>`, where `<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>`.
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 only when the device holds a state you set up by hand for this phase (a login), since the clear wipes it. A first-launch consent dialog (privacy policy / user agreement) is not such a state: 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;
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 档」, which then applies to that node only; "the data layer is not converted yet" is never a reason to degrade it).
25
- - For `source-only` members also pass `SOURCE_HINTS` (= `meta.json.source_hints`), `REACHED_FROM` / `NAVIGATES_TO`, `TEMPLATE_PAGES` + `TEMPLATE_MEASUREMENTS`, and the host-chain source file list (now the primary evidence, so resolve it before dispatch).
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 `项目事实(外壳契约)`:
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 four points against the Android source of the component (its `@Composable fun` / custom View):
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` with `sessionID` = `resume_task`; opencode v1 / DevEco: `task` with `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).
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>"`. If the group's bound session had stalled, this resumes that session automatically. Use `--fresh` only after that session's completion notice has arrived.
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 9 min. Give the shell call a timeout above that (e.g. 600000 ms). Never sleep in a loop instead.
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 `navigates_to`;
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.