@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
@@ -392,6 +392,106 @@ test("outbound resolution rejects labels, unrelated files, duplicates, and unver
392
392
  && unknown.cause === "outbound-implementation-source-unit-unavailable"));
393
393
  });
394
394
 
395
+ test("outbound resolves a target implemented in its declared_at file when no FQN is registered", () => {
396
+ writeSource("src/region.js", ["export const RegionPickerModal = () => {};"]);
397
+ const inventory = buildPages({
398
+ nodes: [
399
+ { id: "page:Source", kind: "activity", label: "Source", declared_at: "src/source.js" },
400
+ { id: "overlay:Region", kind: "sheet", label: "RegionPickerModal", declared_at: "src/region.js:55" },
401
+ ],
402
+ links: [{ source: "page:Source", target: "overlay:Region", trigger: "onClick@src/source.js:307" }],
403
+ });
404
+ const db = new DatabaseSync(":memory:");
405
+ db.exec(`
406
+ CREATE TABLE nodes (
407
+ id TEXT PRIMARY KEY, kind TEXT, name TEXT, qualified_name TEXT,
408
+ file_path TEXT, start_line INTEGER
409
+ );
410
+ CREATE TABLE edges (
411
+ id INTEGER PRIMARY KEY, source TEXT, target TEXT, kind TEXT, line INTEGER
412
+ );
413
+ `);
414
+ db.prepare("INSERT INTO nodes (id, kind, name, qualified_name, file_path, start_line) VALUES (?, ?, ?, ?, ?, ?)")
415
+ .run("region", "class", "RegionPickerModal", "example.RegionPickerModal", "src/region.js", 55);
416
+ const entries = discoverEntryEvidence({
417
+ pages: inventory.pages, db, sourceProject: root,
418
+ query: ({ command }) => ({
419
+ status: "ok",
420
+ items: command === "callees"
421
+ ? [{ name: "RegionPickerModal", qualified_name: "example.RegionPickerModal", file_path: "src/region.js", line: 307 }]
422
+ : [],
423
+ truncated: false,
424
+ reason: null,
425
+ }),
426
+ });
427
+ const out = entries.get("page:Source").outbound[0];
428
+ assert.equal(out.status, "resolved");
429
+ assert.deepEqual(out.implementation, { qualified_name: "example.RegionPickerModal", file_path: "src/region.js" });
430
+ db.close();
431
+ });
432
+
433
+ test("outbound distinguishes a missing implementation identity from an unmatched target", () => {
434
+ const inventory = buildPages({
435
+ nodes: [
436
+ { id: "page:Source", kind: "activity", label: "Source", declared_at: "src/source.js" },
437
+ { id: "overlay:Ghost", kind: "sheet", label: "Ghost", declared_at: "src/ghost.js:1" },
438
+ ],
439
+ links: [{ source: "page:Source", target: "overlay:Ghost", trigger: "onClick@src/source.js:307" }],
440
+ });
441
+ const entries = discoverEntryEvidence({
442
+ pages: inventory.pages, db: null, sourceProject: root,
443
+ query: ({ command }) => ({
444
+ status: "ok",
445
+ items: command === "callees"
446
+ ? [{ name: "Ghost", qualified_name: "example.Ghost", file_path: "src/ghost.js", line: 307 }]
447
+ : [],
448
+ truncated: false,
449
+ reason: null,
450
+ }),
451
+ });
452
+ const out = entries.get("page:Source").outbound[0];
453
+ assert.equal(out.status, "partial");
454
+ assert.equal(out.reason, "outbound-implementation-unavailable");
455
+ });
456
+
457
+ test("outbound keeps the exact FQN match when the declared_at file has a same-named node", () => {
458
+ writeSource("src/home.js", ["export const Home = () => {};"]);
459
+ const inventory = buildPages({
460
+ nodes: [
461
+ { id: "page:Source", kind: "activity", label: "Source", declared_at: "src/source.js" },
462
+ { id: "overlay:Home", kind: "sheet", label: "Home", fqn: "x.HomeScreen", declared_at: "src/home.js" },
463
+ ],
464
+ links: [{ source: "page:Source", target: "overlay:Home", trigger: "onClick@src/source.js:307" }],
465
+ });
466
+ const db = new DatabaseSync(":memory:");
467
+ db.exec(`
468
+ CREATE TABLE nodes (
469
+ id TEXT PRIMARY KEY, kind TEXT, name TEXT, qualified_name TEXT,
470
+ file_path TEXT, start_line INTEGER
471
+ );
472
+ CREATE TABLE edges (
473
+ id INTEGER PRIMARY KEY, source TEXT, target TEXT, kind TEXT, line INTEGER
474
+ );
475
+ `);
476
+ db.prepare("INSERT INTO nodes (id, kind, name, qualified_name, file_path, start_line) VALUES (?, ?, ?, ?, ?, ?)")
477
+ .run("home", "class", "Home", "x.Home", "src/home.js", 10);
478
+ const entries = discoverEntryEvidence({
479
+ pages: inventory.pages, db, sourceProject: root,
480
+ query: ({ command }) => ({
481
+ status: "ok",
482
+ items: command === "callees"
483
+ ? [{ name: "Home", qualified_name: "x.Home", file_path: "src/home.js", line: 307 }]
484
+ : [],
485
+ truncated: false,
486
+ reason: null,
487
+ }),
488
+ });
489
+ const out = entries.get("page:Source").outbound[0];
490
+ assert.equal(out.status, "partial");
491
+ assert.equal(out.reason, "outbound-target-unresolved");
492
+ db.close();
493
+ });
494
+
395
495
  function orderingInventory(reverse = false) {
396
496
  const nodes = [
397
497
  { id: "page:Source", kind: "activity", label: "Source", declared_at: "src/source.js" },
@@ -680,9 +680,10 @@ test("G2 requires a parameter's default and source in the merged steps", () => {
680
680
  response_fields: ["data.list[].id"],
681
681
  }],
682
682
  };
683
- d.scenarios[0].steps.push("The page sends GET to https://api.example.com/forecast with parameter lat defaulting to 0 from local storage and shows response field data.list[].id for each item");
683
+ d.scenarios[0].steps.push("The page sends GET to https://api.example.com/forecast with the query parameters below:\n```text\nWeather query parameters\nfield:lat type/encoding:number default:0 send:required\n```\nSource: lat comes from local storage; it shows response field data.list[].id for each item");
684
684
  const complete = gateDraft(d, { mdText: renderDraft(d) });
685
685
  assert.deepEqual(complete.failures, []);
686
+ assert.ok(!complete.warnings.some((w) => w.gate === "G2"), JSON.stringify(complete.warnings));
686
687
 
687
688
  d.scenarios[0].steps[d.scenarios[0].steps.length - 1] =
688
689
  "The page sends GET to https://api.example.com/forecast with parameter lat read from local storage and shows response field data.list[].id for each item";
@@ -693,6 +694,133 @@ test("G2 requires a parameter's default and source in the merged steps", () => {
693
694
  assert.doesNotMatch(failure.message, /endpoints\/source/);
694
695
  });
695
696
 
697
+ test("G2 requires the four-label field table when an endpoint declares body params", () => {
698
+ const bodyContracts = () => ({
699
+ endpoints: [{
700
+ name: "Order page", method: "POST", url: "https://api.example.com/order/page",
701
+ params: [
702
+ { in: "body", name: "page", type: "int", required: true, default: "1", source: "current page number" },
703
+ { in: "body", name: "size", type: "int", required: true, default: "10", source: "page size" },
704
+ ],
705
+ response_fields: ["data.list[].id"],
706
+ }],
707
+ });
708
+ const prose = "Send POST to https://api.example.com/order/page; page defaults to 1 from the current page number and size defaults to 10 from the page size; show response field data.list[].id for each item";
709
+
710
+ const withoutTable = goodDraft();
711
+ withoutTable.scenarios[0].contracts = bodyContracts();
712
+ withoutTable.scenarios[0].steps.push(prose);
713
+ const rejected = gateDraft(withoutTable, { mdText: renderDraft(withoutTable) });
714
+ const failure = rejected.failures.find((f) => f.gate === "G2" && /four-label field table/.test(f.message));
715
+ assert.ok(failure, JSON.stringify(rejected.failures));
716
+
717
+ const withTable = goodDraft();
718
+ withTable.scenarios[0].contracts = bodyContracts();
719
+ withTable.scenarios[0].steps.push(
720
+ "Serialize the request body as the table below:\n```text\nOrder page request body\nfield:page type/encoding:int default:1 send:required\nfield:size type/encoding:int default:10 send:required\n```\n" + prose);
721
+ const accepted = gateDraft(withTable, { mdText: renderDraft(withTable) });
722
+ assert.deepEqual(accepted.failures, []);
723
+ assert.ok(!accepted.warnings.some((w) => w.gate === "G2"), JSON.stringify(accepted.warnings));
724
+ });
725
+
726
+ test("G2 requires the four-label field table for query params too", () => {
727
+ const queryContracts = () => ({
728
+ endpoints: [{
729
+ name: "Weather forecast", method: "GET", url: "https://api.example.com/forecast",
730
+ params: [{ in: "query", name: "lat", type: "number", required: true, default: "0", source: "local storage" }],
731
+ response_fields: ["temperature"],
732
+ }],
733
+ });
734
+ const prose = "Send GET to https://api.example.com/forecast and show response field temperature for each item";
735
+
736
+ const withoutTable = goodDraft();
737
+ withoutTable.scenarios[0].contracts = queryContracts();
738
+ withoutTable.scenarios[0].steps.push(prose + "; lat defaults to 0 from local storage");
739
+ const rejected = gateDraft(withoutTable, { mdText: renderDraft(withoutTable) });
740
+ const failure = rejected.failures.find((f) => f.gate === "G2" && /four-label field table/.test(f.message));
741
+ assert.ok(failure, JSON.stringify(rejected.failures));
742
+
743
+ const withTable = goodDraft();
744
+ withTable.scenarios[0].contracts = queryContracts();
745
+ withTable.scenarios[0].steps.push(
746
+ "Write the query parameters as the table below:\n```text\nWeather query parameters\nfield:lat type/encoding:number default:0 send:required\n```\nSource: lat comes from local storage; " + prose);
747
+ const accepted = gateDraft(withTable, { mdText: renderDraft(withTable) });
748
+ assert.deepEqual(accepted.failures, []);
749
+ assert.ok(!accepted.warnings.some((w) => w.gate === "G2"), JSON.stringify(accepted.warnings));
750
+ });
751
+
752
+ test("G2 does not require a field table for path/header-only endpoint params", () => {
753
+ const d = goodDraft();
754
+ d.scenarios[0].contracts = {
755
+ endpoints: [{
756
+ name: "Weather forecast", method: "GET", url: "https://api.example.com/forecast/{city}",
757
+ params: [{ in: "path", name: "city", type: "string", required: true, source: "current location" }],
758
+ response_fields: ["temperature"],
759
+ }],
760
+ };
761
+ d.scenarios[0].steps.push("Send GET to https://api.example.com/forecast/{city} with the path parameter city from the current location and show response field temperature for each item");
762
+ const r = gateDraft(d, { mdText: renderDraft(d) });
763
+ assert.ok(!r.failures.some((f) => f.gate === "G2" && /four-label field table/.test(f.message)), JSON.stringify(r.failures));
764
+ });
765
+
766
+ test("G2 accepts full-width colons in the field table", () => {
767
+ const d = goodDraft();
768
+ d.scenarios[0].contracts = {
769
+ endpoints: [{
770
+ name: "Weather forecast", method: "GET", url: "https://api.example.com/forecast",
771
+ params: [{ in: "query", name: "lat", type: "number", required: true, default: "0", source: "local storage" }],
772
+ response_fields: ["temperature"],
773
+ }],
774
+ };
775
+ d.scenarios[0].steps.push("Write the query parameters as the table below:\n```text\nWeather query parameters\nfield:lat type/encoding:number default:0 send:required\n```\nSource: lat comes from local storage; Send GET to https://api.example.com/forecast and show response field temperature for each item");
776
+ const r = gateDraft(d, { mdText: renderDraft(d) });
777
+ assert.deepEqual(r.failures, []);
778
+ assert.ok(!r.warnings.some((w) => w.gate === "G2"), JSON.stringify(r.warnings));
779
+ });
780
+
781
+ test("G2 does not treat information as a body trigger", () => {
782
+ const d = goodDraft();
783
+ d.scenarios[0].steps.push("Send POST to https://api.example.com/page with the information shown on this page");
784
+ const r = gateDraft(d, { mdText: renderDraft(d) });
785
+ assert.ok(!r.warnings.some((w) => w.gate === "G2" && /request body/.test(w.message)), JSON.stringify(r.warnings));
786
+ });
787
+
788
+ test("G2 does not treat a prose 'response field:' line as a table row", () => {
789
+ const d = goodDraft();
790
+ d.scenarios[0].steps.push("Send POST to https://api.example.com/order/page\nresponse field: page\nsend: required");
791
+ const r = gateDraft(d, { mdText: renderDraft(d) });
792
+ assert.ok(!r.warnings.some((w) => w.gate === "G2" && /field table/.test(w.message)), JSON.stringify(r.warnings));
793
+ });
794
+
795
+ test("G2 warns when steps describe a body request without an endpoint declaration", () => {
796
+ const d = goodDraft();
797
+ d.scenarios[0].steps.push("Send POST to https://api.example.com/order/page with request body fields page and size");
798
+ const r = gateDraft(d, { mdText: renderDraft(d) });
799
+ assert.ok(r.warnings.some((w) => w.gate === "G2" && /request body/.test(w.message) && /endpoints/.test(w.message)),
800
+ JSON.stringify(r.warnings));
801
+ });
802
+
803
+ test("G2 body-request warning is closed by an explicit no-body statement", () => {
804
+ const d = goodDraft();
805
+ d.scenarios[0].steps.push("Send POST to https://api.example.com/order/page; the request does not carry a request body");
806
+ const r = gateDraft(d, { mdText: renderDraft(d) });
807
+ assert.ok(!r.warnings.some((w) => w.gate === "G2" && /request body/.test(w.message)), JSON.stringify(r.warnings));
808
+ });
809
+
810
+ test("G2 warns about a body field table with no endpoint declaration", () => {
811
+ const d = goodDraft();
812
+ d.scenarios[0].steps.push("Serialize the request body as the table below:\n```text\nOrder page request body\nfield:page type/encoding:int default:1 send:required\n```");
813
+ const r = gateDraft(d, { mdText: renderDraft(d) });
814
+ assert.ok(r.warnings.some((w) => w.gate === "G2" && /field table/.test(w.message)), JSON.stringify(r.warnings));
815
+ });
816
+
817
+ test("G2 does not warn about a body-less GET request", () => {
818
+ const d = goodDraft();
819
+ d.scenarios[0].steps.push("Send GET to https://api.example.com/forecast and show response field temperature for each item");
820
+ const r = gateDraft(d, { mdText: renderDraft(d) });
821
+ assert.ok(!r.warnings.some((w) => w.gate === "G2" && /request body/.test(w.message)), JSON.stringify(r.warnings));
822
+ });
823
+
696
824
  test("G2 treats empty page-level contracts declarations as absent", () => {
697
825
  for (const value of [null, {}, []]) {
698
826
  const d = goodDraft();
@@ -760,16 +888,17 @@ test("G2 checks endpoint method, url, parameter names and response fields", () =
760
888
  }],
761
889
  };
762
890
  d.scenarios[0].steps.push(
763
- "Issue a GET request to https://api.example.com/weather with the latitude and temperature_unit parameters and read the current_temperature and weather_code response fields",
891
+ "Issue a GET request to https://api.example.com/weather with the query parameters below:\n```text\nWeather query parameters\nfield:latitude type/encoding:number default:0 send:required\n```\nRead the current_temperature and weather_code response fields",
764
892
  );
765
893
  const complete = gateDraft(d, { mdText: renderDraft(d) });
766
894
  assert.deepEqual(complete.failures, []);
895
+ assert.ok(!complete.warnings.some((w) => w.gate === "G2"), JSON.stringify(complete.warnings));
767
896
 
768
897
  // Identifier tokens need a boundary: `latitudeOf` must not satisfy `latitude`.
769
898
  d.scenarios[0].steps[d.scenarios[0].steps.length - 1] =
770
899
  "Issue a GET request to https://api.example.com/weather with the latitudeOf and temperature_unit parameters and read the current_temperature and weather_code response fields";
771
900
  const boundary = gateDraft(d, { mdText: renderDraft(d) });
772
- assert.ok(boundary.failures.some((f) => f.gate === "G2" && /latitude/.test(f.message)),
901
+ assert.ok(boundary.failures.some((f) => f.gate === "G2" && f.message.includes("endpoints/param: latitude")),
773
902
  JSON.stringify(boundary.failures));
774
903
  });
775
904
 
@@ -676,7 +676,7 @@ class Converter {
676
676
  unmappable: 0, skippedQualifierDirs: 0, failed: 0,
677
677
  svgConverted: 0, layeredImages: 0, solidLayersGenerated: 0, safeZoneLayers: 0, uncroppedBitmapIcons: 0, systemColorsResolved: 0,
678
678
  referencesResolved: 0, systemReferencesResolved: 0, fallbacksApplied: 0,
679
- unresolvedPaint: 0, mediaTargetCollisions: 0,
679
+ unresolvedPaint: 0, mediaTargetCollisions: 0, vectorFallbacksDropped: 0,
680
680
  };
681
681
 
682
682
  constructor(resDir: string, harmonyDir: string, dryRun: boolean, uiModule = 'entry', filterSet: Set<string> | null = null) {
@@ -1178,6 +1178,29 @@ class Converter {
1178
1178
  return this.findResXml('drawable', m[1], 'gradient') ?? this.findResXml('drawable', m[1].replace(/\$/g, '_'), 'gradient');
1179
1179
  }
1180
1180
 
1181
+ /**
1182
+ * The `<type>-anydpi[-vNN]/<resName>.xml` `<vector>` whose AAPT density fallback the bitmap in `pngDir` is,
1183
+ * as a res-relative path, or null. Only a pure density pair counts: the anydpi dir may carry nothing but
1184
+ * `anydpi`/`vNN` (so its SVG lands in base/), and `pngDir` nothing but a density and `vNN`. A night/locale/…
1185
+ * qualifier on either side means a hand-made variant that HarmonyOS would otherwise lose (no base/ copy, or no
1186
+ * dark/ look). `<animated-vector>` is excluded: xmlDrawableToSvg cannot convert it, so its PNGs are the only
1187
+ * HarmonyOS copy of the resource.
1188
+ */
1189
+ anydpiVector(type: string, resName: string, pngDir: string): string | null {
1190
+ const quals = (d: string): string[] => d.split('-').slice(1);
1191
+ if (!quals(pngDir).every((q) => (q in DENSITY && DENSITY[q] !== null) || /^v\d+$/.test(q))) return null;
1192
+ for (const d of this.resTypeDirs(type)) {
1193
+ const q = quals(d);
1194
+ if (!q.includes('anydpi') || !q.every((x) => x === 'anydpi' || /^v\d+$/.test(x))) continue;
1195
+ const p = path.join(this.resDir, d, `${resName}.xml`);
1196
+ if (!fs.existsSync(p)) continue;
1197
+ try {
1198
+ if (parseXml(fs.readFileSync(p, 'utf8')).name === 'vector') return `${d}/${resName}.xml`;
1199
+ } catch { /* unparsable: keep the bitmap */ }
1200
+ }
1201
+ return null;
1202
+ }
1203
+
1181
1204
  /** `type` itself and all its qualifier directories (`drawable`, `drawable-v24`…), the unqualified directory first. */
1182
1205
  resTypeDirs(type: string): string[] {
1183
1206
  return fs.readdirSync(this.resDir)
@@ -1948,6 +1971,16 @@ class Converter {
1948
1971
 
1949
1972
  if (IMAGE_EXT.has(ext)) {
1950
1973
  const target = path.join(qdir, 'media', base);
1974
+ const vector = qdir !== 'base' ? this.anydpiVector(type, resName, path.dirname(relFile)) : null;
1975
+ if (vector) {
1976
+ // AAPT's density PNGs for a <vector>: Android (API 24+) picks the anydpi vector over them, but HarmonyOS
1977
+ // resolves a matching density dir before base/, so a copied PNG would hide the SVG (and its fillColor tint).
1978
+ this.counts.vectorFallbacksDropped++;
1979
+ record('N/A', 'unmappable', 'unmapped',
1980
+ `density fallback of res/${vector} (converted to SVG in base/media); copying it would shadow that SVG on HarmonyOS`,
1981
+ 'Image resource');
1982
+ return;
1983
+ }
1951
1984
  if (!this.claimTarget(target, relFile, androidPath, type)) return;
1952
1985
  this.write(target, fs.readFileSync(path.join(this.resDir, relFile)));
1953
1986
  this.counts.mediaCopied++;
@@ -2271,6 +2304,7 @@ class DocWriter {
2271
2304
  p(`- Fallback values applied: ${c.fallbacksApplied}`);
2272
2305
  p(`- SVG paint colors that could not be resolved: ${c.unresolvedPaint}`);
2273
2306
  p(`- HarmonyOS target collisions resolved: ${c.mediaTargetCollisions}`);
2307
+ p(`- Density PNG fallbacks of anydpi vectors dropped: ${c.vectorFallbacksDropped}`);
2274
2308
  p(`- Failed: ${c.failed}`);
2275
2309
  if (this.ctx.icons?.counts) {
2276
2310
  const ic = this.ctx.icons.counts;
@@ -2662,6 +2696,7 @@ function main(): void {
2662
2696
  console.log(` fallbacks applied : ${c.fallbacksApplied}`);
2663
2697
  console.log(` unresolved SVG colors: ${c.unresolvedPaint}`);
2664
2698
  console.log(` target collisions : ${c.mediaTargetCollisions}`);
2699
+ console.log(` vector PNG fallbacks : ${c.vectorFallbacksDropped} dropped`);
2665
2700
  console.log(` failed : ${c.failed}`);
2666
2701
  console.log(` inventory / mapping rows: ${conv.inventory.length} / ${conv.mappings.length}`);
2667
2702
  if (conv.conflicts.length > 0) console.log(` same-name overrides : ${conv.conflicts.length}`);
@@ -53,7 +53,7 @@ Parse the arguments from the user's message (natural language is fine — no fix
53
53
  | `IMAGE_READ` | `--image-read true\|false`: whether this host's sub-agents can read image files (a2h-app-migrate probes it at bootstrap). `false` → every sub-agent prompt carries the no-image rule of I5. Never probe it by opening an image in this session | `true` |
54
54
  | `SHARED_LAYER` | `auto` (default) or `off`; persisted in `state.config.shared_layer` | `auto` |
55
55
  | `SOURCE_KIND` | optional `android` (default) or `uniapp`; persisted in `state.config.source_kind`. No current caller passes it (`a2h-app-migrate` exports no `SOURCE_KIND` variable), so it defaults to `android` and only labels the F0 agent's source-evidence reading — scanning is project-neutral | `android` |
56
- | `WAIT_MODE` | `background` (default): B1 ends the turn and waits for notifications / the waker. `foreground`: this run is itself a dispatched sub-agent (e.g. under `a2h-app-migrate`) whose ended turn would return to its caller — B1 never ends the turn; it blocks in `dispatch.mjs wait` instead and arms no waker (`references/coding-loop.md` → Foreground wait mode) | `background` |
56
+ | `WAIT_MODE` | `background` (default): B1 ends the turn and waits for notifications / the waker. `foreground`: this run is itself a dispatched sub-agent (e.g. under `a2h-app-migrate`) whose ended turn would return to its caller — B1 never ends the turn; it blocks in `dispatch.mjs wait` instead (one short call, ≤ 300 s, then back to step 1; never a self-written wait script) and arms no waker (`references/coding-loop.md` → Foreground wait mode) | `background` |
57
57
 
58
58
  ### specs.json format
59
59
 
@@ -5,6 +5,10 @@ on every wakeup. `SKILL.md` carries the navigation summary; this file is the aut
5
5
  Its numbering (event-loop steps 1–10, the guard bullets) is cross-referenced by B2, the fail-soft rules,
6
6
  and `skills/a2h-spec-design-pipeline/references/execution-model.md`.
7
7
 
8
+ **Running as a dispatched sub-agent (`WAIT_MODE=foreground`, e.g. `a2h-app-migrate` → `logic.spec_pipeline`)?**
9
+ Read **Foreground wait mode** below before the first wave: it replaces step 9's `end-turn` with one
10
+ short `dispatch.mjs wait` call (≤ 300 s) and forbids self-written wait scripts.
11
+
8
12
  ### B1 — Parallel coding (chunked, per-group serial, background-dispatched)
9
13
 
10
14
  Chunk sub-agents are dispatched with the `Agent` tool in **background mode** (`background: true`). Maintain
@@ -229,6 +233,18 @@ wait changes:
229
233
  waker runs). Completion notifications that still arrive are consumed in step 1 as usual.
230
234
  - The turn ends only at the legitimate stops (Finalization done, or a hard stop), with the final report.
231
235
  The "never sit in a foreground `wait`" rule above is for `background` mode only.
236
+ - **The wait only keeps the turn alive; keep every call short.** While a shell call runs, the host
237
+ queues every completion notification until the call returns, so a call's length is the delay added to
238
+ every agent that finishes during it (measured: self-written 25–27 minute waits held finished chunks
239
+ for up to 25 minutes). `dispatch.mjs wait` returns at the first evidence change, or once `--max-wait` has passed
240
+ (plus one snapshot); `--max-wait` above 300 s is clamped to 300 and `--poll` above 30 s to 30. Run **exactly** the command above. Never write
241
+ your own wait / poll / sleep script, never `sleep`, never wrap the wait in a loop inside one shell
242
+ call: each return must come back to step 1.
243
+ - **`wait` sees only ledger units.** It watches the worktrees and attempt artifacts of claimed /
244
+ dispatched / live / orphaned units. An agent dispatched without `claim` → `intent` → `confirm` is
245
+ invisible to it, and a chunk marked `done` in `spec_pipeline_state.json` ahead of its ledger unit
246
+ hides the gap. Every chunk and resolver goes through the ledger; state follows the ledger one way
247
+ (`references/state-and-resume.md` → One-way state repair), never ahead of it.
232
248
 
233
249
  **Waker arming** (`WAIT_MODE=background` only). When active units remain: `dispatch.mjs <HMOS> probe` → if `inPlace:false` or
234
250
  `runId` differs, clear a stale stop file and dispatch a general-purpose sub-agent in **background mode**
@@ -160,6 +160,7 @@ enumerate continuous parameter values or every combination of independent states
160
160
  | `compose_widgets.mjs <ws> --project <project> --append` | **always on Compose app**, AFTER `assemble.mjs` | `widgets[]` per node |
161
161
  | `view_widgets.mjs <ws> --project <project> --append` | **always on View/Fragment app**, AFTER `assemble.mjs` | `widgets[]` from layout XML |
162
162
  | `preference_widgets.mjs <ws> --project <project> --locale <locale> --append` | **when Preference XML pages exist**, AFTER `assemble.mjs` | `widgets[]` from Preference XML |
163
+ | `view_attachments.mjs <ws> --project <project> --append` | **always on a native app**, AFTER `assemble.mjs` | `attachments[]`: project views handed to a non-layout sink (marker, tooltip, empty view), `view_attachments.json` |
163
164
  | `phase_plan.mjs <ws>` + `tools/convert_static_utg_to_ui_elements.ts` | LAST | `phase_plan_nodes.json`, `ui_elements.json` |
164
165
  | `view_interactions.mjs extract <ws> <project>` / `apply <ws>` | inventory after native widgets; apply before final assemble | reviewed custom panels/UI states; `interaction_audit.json` gaps |
165
166
 
@@ -193,6 +194,7 @@ Per-extractor detail (emitted fields, design rationale, refusals, the tests that
193
194
  - **Preferences (`preference_nav.mjs`)** — check `hosts=` / `hostless=` and `programmatic_clicks=` / `programmatic_dialogs=`. Unresolved constants, shared listener factories and custom modal APIs are left to review/exploration.
194
195
  - **Menus (`menu_nav.mjs`)** — often the largest edge source in View apps; check `unclassified=`.
195
196
  - **Window surfaces (`window_nav.mjs`)** — PopupWindow / `WindowManager.addView` / non-Fragment sheets / anonymous `new Dialog(`; View-app branch, after `menu_nav`, before `assemble`. Host-less surfaces are dropped to the explorer's `promote_dynamic.mjs`.
197
+ - **Auxiliary views (`view_attachments.mjs`)** — a project View class constructed and handed to anything but a layout container (`chart.setMarker(M(..))`, `chart.marker = M(..)`, through one variable or factory hop) is stamped on the owning page as `attachments[]`, with the sink, receiver and inflated layout. These surfaces are shown by the receiver's own touch handling, so no click listener names them. Structural only (no API names); check `attachments=` vs `hostless=` / `dropped=` and read `view_attachments.json` for drop reasons. Detail: references/extractors.md.
196
198
  - **Code-built View pages (`viewpage_nav.mjs`)** — a dispatch function mounting project View classes; captions go to `expected.hint_any`, never `title_any`.
197
199
  - **Host indirection (`presenter_nav.mjs`)** and **media browse (`media_browse_nav.mjs`)** — run **in addition** to the normal extractors, never instead.
198
200
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buaa_smat/hometrans",
3
- "version": "26.0.7",
3
+ "version": "26.0.8",
4
4
  "description": "HomeTrans (Android-to-HarmonyOS) skill + agent installer. Run `ht init` to distribute conversion skills and subagents into AI editors.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: a2h-executor
3
+ permission: worker
4
+ difficulty: hard
5
+ when: Generic node executor for HomeTrans orchestration; loads the named skill and runs one workflow node to its terminal state.
6
+ ---
@@ -0,0 +1,5 @@
1
+ ---
2
+ name: a2h-executor
3
+ description: Generic node executor for HomeTrans orchestration. Loads the skill named in the task, runs the given invoke to the node's terminal state, dispatches that skill's own sub-agents the way the skill describes, and replies only with the JSON the invoke asks for. a2h-app-migrate dispatches it for its task_subagent skill nodes instead of the host's general-purpose agent.
4
+ tools: Agent
5
+ ---
@@ -1,8 +1,8 @@
1
1
  # Before Step #
2
2
 
3
- 本平台是 codebuddy(CodeBuddy,IDE 与 CLI 共用 `~/.codebuddy`)。安装层已在全部 agent frontmatter 声明 `tools: Agent`(实测:只增派发能力,不收窄其它工具)。按宿主形态区分:
3
+ 本平台是 codebuddy(CodeBuddy,IDE 与 CLI 共用 `~/.codebuddy`)。安装层已在节点执行 agent `a2h-executor` 的 frontmatter 声明 `tools: Agent`(实测:只增派发能力,不收窄其它工具;只有它在 depth 1 往下派,叶子 worker 不派、不声明)。按宿主形态区分:
4
4
 
5
5
  - **CodeBuddy CLI(>= v2.187.0,实测支持)**:支持嵌套深度 >= 2——节点仍按 policy.dispatch 逐个派子 agent(同一时刻只有一个节点子 agent 在跑),节点子 agent 内可以再派 worker。
6
6
  - **CodeBuddy IDE(v4.12.4,实测不支持)**:默认嵌套深度为 1——所有 skill 节点按 primary_skill_inline 内联执行,**不派节点子 agent**。
7
7
 
8
- 不探测深度配置、不停等,不向用户说明调度,也不问串行或并行。
8
+ 不探测深度配置、不停等,不向用户说明调度,也不问串行或并行。CLI 上派 `a2h-executor` 报未知 agent 类型时,**不要**按 policy.dispatch 退回宿主内置的通用子 agent(它没有派发授权,叶子内部 worker 派不出去),改为该节点 primary_skill_inline 内联执行,最终报告注明。
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: a2h-executor
3
+ description: Generic node executor for HomeTrans orchestration. Loads the skill named in the task, runs the given invoke to the node's terminal state, dispatches that skill's own sub-agents the way the skill describes, and replies only with the JSON the invoke asks for. a2h-app-migrate dispatches it for its task_subagent skill nodes instead of the host's general-purpose agent.
4
+ mode: subagent
5
+ permission:
6
+ task: allow
7
+ ---
@@ -2,6 +2,4 @@
2
2
  name: build-fixer
3
3
  description: Automatically builds a HarmonyOS project, parses compile errors, fixes them, and retries in a loop until build succeeds
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -2,6 +2,4 @@
2
2
  name: code-reviewer
3
3
  description: Reviews HarmonyOS code against the scenarios of a SPEC document and fixes the confirmed defects. mode=review (default, read-only) — extracts the change via git, expands it with homegraph, judges every scenario PASS / PARTIAL / FAIL / UNABLE TO VERIFY with launch-path tracing and cross-cutting checks, writes code-review-report.md. mode=fix — fixes the issues a review report lists, builds once (or leaves the build to the dispatcher), writes review-fix-report.md and commits.
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -2,6 +2,4 @@
2
2
  name: model-render-worker
3
3
  description: Fused Model worker for a2h-spec-generate — executes ONE self-contained per-Area fused task.md (reconcile + SPEC authoring in one session) and writes output.json plus specs/<stem>-SPEC.md (finalized true) after check-fused-spec passes
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -2,6 +2,4 @@
2
2
  name: model-worker
3
3
  description: Model worker for a2h-spec-generate — executes one self-contained interaction task.md (candidate review, or Area reconciliation/discovery) and writes only its own output.json (finalized true) after check-task passes
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -2,6 +2,4 @@
2
2
  name: specgen-worker
3
3
  description: SpecGen page worker for a2h-spec-generate — processes exactly one req-<idx>.txt page batch into <feature>-SPEC.md files from the rendered task.md it is handed
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -1,3 +1,3 @@
1
1
  # Before Step #
2
2
 
3
- 本平台是 deveco(DevEco Code,语义等价 opencode)。安装层已在全部 agent frontmatter 声明 `permission: task: allow`(v0.2.6 实测:agent 加 task 授权即可派发),且默认嵌套深度已 >= 2——无需探测深度配置、无需阻塞提示:节点仍按 policy.dispatch 逐个派子 agent(同一时刻只有一个节点子 agent 在跑),节点子 agent 内可以再派 worker;不向用户说明调度,不问串行或并行。
3
+ 本平台是 deveco(DevEco Code,语义等价 opencode)。安装层已在节点执行 agent `a2h-executor` 的 frontmatter 声明 `permission: task: allow`(v0.2.6 实测:发起派发的 agent 加 task 授权即可派发;只有它在 depth 1 往下派,叶子 worker 不派、不授权),且默认嵌套深度已 >= 2——无需探测深度配置、无需阻塞提示:节点仍按 policy.dispatch 逐个派子 agent(同一时刻只有一个节点子 agent 在跑),节点子 agent 内可以再派 worker;不向用户说明调度,不问串行或并行。派 `a2h-executor` 报未知 agent 类型时,**不要**按 policy.dispatch 退回宿主内置的通用子 agent(它没有派发授权,叶子内部 worker 派不出去),改为该节点 primary_skill_inline 内联执行,最终报告注明。
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: a2h-executor
3
+ description: Generic node executor for HomeTrans orchestration. Loads the skill named in the task, runs the given invoke to the node's terminal state, dispatches that skill's own sub-agents the way the skill describes, and replies only with the JSON the invoke asks for. a2h-app-migrate dispatches it for its task_subagent skill nodes instead of the host's general-purpose agent.
4
+ mode: subagent
5
+ permission:
6
+ task: allow
7
+ ---
@@ -2,6 +2,4 @@
2
2
  name: build-fixer
3
3
  description: Automatically builds a HarmonyOS project, parses compile errors, fixes them, and retries in a loop until build succeeds
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -2,6 +2,4 @@
2
2
  name: code-reviewer
3
3
  description: Reviews HarmonyOS code against the scenarios of a SPEC document and fixes the confirmed defects. mode=review (default, read-only) — extracts the change via git, expands it with homegraph, judges every scenario PASS / PARTIAL / FAIL / UNABLE TO VERIFY with launch-path tracing and cross-cutting checks, writes code-review-report.md. mode=fix — fixes the issues a review report lists, builds once (or leaves the build to the dispatcher), writes review-fix-report.md and commits.
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -2,6 +2,4 @@
2
2
  name: model-render-worker
3
3
  description: Fused Model worker for a2h-spec-generate — executes ONE self-contained per-Area fused task.md (reconcile + SPEC authoring in one session) and writes output.json plus specs/<stem>-SPEC.md (finalized true) after check-fused-spec passes
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -2,6 +2,4 @@
2
2
  name: model-worker
3
3
  description: Model worker for a2h-spec-generate — executes one self-contained interaction task.md (candidate review, or Area reconciliation/discovery) and writes only its own output.json (finalized true) after check-task passes
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -2,6 +2,4 @@
2
2
  name: specgen-worker
3
3
  description: SpecGen page worker for a2h-spec-generate — processes exactly one req-<idx>.txt page batch into <feature>-SPEC.md files from the rendered task.md it is handed
4
4
  mode: subagent
5
- permission:
6
- task: allow
7
5
  ---
@@ -1,10 +1,17 @@
1
1
  # Before Step #
2
2
 
3
- 本平台是 opencode。进入正式迁移流程前,先执行以下只读检查(不向用户说明调度,不问串行或并行):
3
+ 本平台是 opencode。迁移流程需要子 agent 嵌套深度 >= 2,opencode 默认只有 1。进入正式迁移流程前,先在用户当前工作目录(启动 opencode 的目录)执行(不向用户说明调度,不问串行或并行):
4
4
 
5
- 1. **确定 opencode 版本**:执行 `opencode --version`,根据返回值判断当前是 v1 还是 v2。
6
- 2. **确定当前嵌套深度配置**:查看 `~/.config/opencode/opencode.json` 与 `~/.config/opencode/opencode.jsonc`,读 `experimental.subagent_depth` 字段的值,即当前嵌套深度(v1.19.6 兼容 v1 / v2 两种配置形式,统一按此字段读;v2.4.x 只认该形式);字段无定义时默认为 1。
7
- 3. **串行即阻塞**:若当前嵌套深度为 1(只能串行),**立即阻塞**,提示用户手动修改配置文件、把 `experimental.subagent_depth` 配置为 **>= 2**;v1 修改后**不支持热更新,须重启 opencode 生效**,v2 支持热更新、改完即生效;**本轮不执行后续任何步骤**,等用户配置好并重新发起后再继续。
8
- 深度已 >= 2 则直接继续后续流程。
5
+ ```bash
6
+ node <本 SKILL.md 所在目录>/scripts/opencode_depth.mjs
7
+ ```
9
8
 
10
- v1 还要求 agent 具备 task 授权——安装层已在全部 agent frontmatter 声明 `permission: task: allow`,无需用户操作;v2 无此要求(声明保留亦无害)。
9
+ 脚本自行判断 opencode 版本,按 opencode 的加载顺序算生效深度(全局配置、`OPENCODE_CONFIG`、git 根到当前目录的 `opencode.json` / `opencode.jsonc`、`.opencode/` 目录、系统托管目录、`OPENCODE_CONFIG_CONTENT`,后面覆盖前面);不满足 >= 2 时,在当前工作目录的项目级配置中只声明 `"experimental": { "subagent_depth": 2 }`(文件已存在则只改这一项)。脚本新建的文件在 git 工作区且未被跟踪时,会加入 `.git/info/exclude`,不会被迁移流程的提交带进用户仓库。按输出 JSON 的 `next` 处理:
10
+
11
+ - `continue`(退出码 0):深度已满足,或 v2 刚写入项目级配置(热更新、即时生效)→ 直接继续后续流程,此时不打断用户。
12
+ - `restart`(退出码 2):v1 刚写入项目级配置,v1 不支持热更新 → 把 `message` 转告用户(已写入哪个文件、需要在该目录重启 opencode 会话后重新输入原命令),**本轮不执行后续任何步骤**。
13
+ - `manual`(退出码 2):没有自动改写(更后加载的配置把深度定成了 < 2、项目级配置文件带注释,或设置了 `OPENCODE_DISABLE_PROJECT_CONFIG`)→ 把 `message` 转告用户按它说的位置修改,**本轮不执行后续任何步骤**。
14
+
15
+ 输出带 `report: true`(本流程写了配置文件,包括 v1 重启后再跑、生效值来自上一轮写的文件)时,无论 `next` 是什么,最终报告都要写明 `message`:写了哪个文件、是否已加入 `.git/info/exclude`,或该文件是用户原有的、改动留在工作区。
16
+
17
+ v1 还要求发起派发的 agent 具备 task 授权——安装层已在节点执行 agent `a2h-executor` 的 frontmatter 声明 `permission: task: allow`(只有它在 depth 1 往下派,叶子 worker 不派、不授权),无需用户操作;v2 无此要求(声明保留亦无害)。派 `a2h-executor` 报未知 agent 类型时,**不要**按 policy.dispatch 退回宿主内置的通用子 agent(它没有派发授权,叶子内部 worker 派不出去),改为该节点 primary_skill_inline 内联执行,最终报告注明。